/*File: video.min.js*//**
 * @license
 * Video.js 7.21.7 <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";for(var e,u="7.21.7",i={},a=function(e,t){return i[e]=i[e]||[],t&&(i[e]=i[e].concat(t)),i[e]},n=function(e,t){t=a(e).indexOf(t);return!(t<=-1)&&(i[e]=i[e].slice(),i[e].splice(t,1),!0)},l={prefixed:!0},t=[["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"]],r=t[0],s=0;s<t.length;s++)if(t[s][1]in document){e=t[s];break}if(e){for(var o=0;o<e.length;o++)l[r[o]]=e[o];l.prefixed=e[0]!==r[0]}var d=[],c=function(a,s){return function(e,t,i){var n,r=s.levels[t],t=new RegExp("^("+r+")$");"log"!==e&&i.unshift(e.toUpperCase()+":"),i.unshift(a+":"),d&&(d.push([].concat(i)),n=d.length-1e3,d.splice(0,0<n?n:0)),!window.console||(n=!(n=window.console[e])&&"debug"===e?window.console.info||window.console.log:n)&&r&&t.test(e)&&n[Array.isArray(i)?"apply":"call"](window.console,i)}};var h=function t(i){function n(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];a("log",r,t)}var r="info",a=c(i,n);return n.createLogger=function(e){return 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:r},n.level=function(e){if("string"==typeof e){if(!n.levels.hasOwnProperty(e))throw new Error('"'+e+'" in not a valid log level');r=e}return r},(n.history=function(){return d?[].concat(d):[]}).filter=function(t){return(d||[]).filter(function(e){return new RegExp(".*"+t+".*").test(e[0])})},n.history.clear=function(){d&&(d.length=0)},n.history.disable=function(){null!==d&&(d.length=0,d=null)},n.history.enable=function(){null===d&&(d=[])},n.error=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return a("error",r,t)},n.warn=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return a("warn",r,t)},n.debug=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return a("debug",r,t)},n}("VIDEOJS"),p=h.createLogger,f="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function m(e,t){return e(t={exports:{}},t.exports),t.exports}var g=m(function(e){function t(){return e.exports=t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,n=arguments[t];for(i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},t.apply(this,arguments)}e.exports=t}),y=Object.prototype.toString,v=function(e){return T(e)?Object.keys(e):[]};function _(t,i){v(t).forEach(function(e){return i(t[e],e)})}function b(i){for(var e=arguments.length,t=new Array(1<e?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return Object.assign?g.apply(void 0,[i].concat(t)):(t.forEach(function(e){e&&_(e,function(e,t){i[t]=e})}),i)}function T(e){return!!e&&"object"==typeof e}function w(e){return T(e)&&"[object Object]"===y.call(e)&&e.constructor===Object}function S(e,t){if(!e||!t)return"";if("function"!=typeof window.getComputedStyle)return"";var i;try{i=window.getComputedStyle(e)}catch(e){return""}return i?i.getPropertyValue(t)||i[t]:""}var E=window.navigator&&window.navigator.userAgent||"",k=/AppleWebKit\/([\d.]+)/i.exec(E),C=k?parseFloat(k.pop()):null,I=/iPod/i.test(E),x=(jt=E.match(/OS (\d+)_/i))&&jt[1]?jt[1]:null,A=/Android/i.test(E),P=function(){var e=E.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;var t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),L=A&&P<5&&C<537,O=/Firefox/i.test(E),D=/Edg/i.test(E),R=!D&&(/Chrome/i.test(E)||/CriOS/i.test(E)),M=(zt=E.match(/(Chrome|CriOS)\/(\d+)/))&&zt[2]?parseFloat(zt[2]):null,N=Xt=!(Xt=(Xt=/MSIE\s(\d+)\.\d/.exec(E))&&parseFloat(Xt[1]))&&/Trident\/7.0/i.test(E)&&/rv:11.0/.test(E)?11:Xt,U=/Safari/i.test(E)&&!R&&!A&&!D,B=/Windows/i.test(E),F=Boolean(X()&&("ontouchstart"in window||window.navigator.maxTouchPoints||window.DocumentTouch&&window.document instanceof window.DocumentTouch)),j=/iPad/i.test(E)||U&&F&&!/iPhone/i.test(E),H=/iPhone/i.test(E)&&!j,V=H||j||I,q=(U||V)&&!R,W=Object.freeze({__proto__:null,IS_IPOD:I,IOS_VERSION:x,IS_ANDROID:A,ANDROID_VERSION:P,IS_NATIVE_ANDROID:L,IS_FIREFOX:O,IS_EDGE:D,IS_CHROME:R,CHROME_VERSION:M,IE_VERSION:N,IS_SAFARI:U,IS_WINDOWS:B,TOUCH_ENABLED:F,IS_IPAD:j,IS_IPHONE:H,IS_IOS:V,IS_ANY_SAFARI:q});function G(e){return"string"==typeof e&&Boolean(e.trim())}function z(e){if(0<=e.indexOf(" "))throw new Error("class has illegal whitespace characters")}function X(){return document===window.document}function K(e){return T(e)&&1===e.nodeType}function Y(){try{return window.parent!==window.self}catch(e){return!0}}function Q(i){return function(e,t){if(!G(e))return document[i](null);t=K(t=G(t)?document.querySelector(t):t)?t:document;return t[i]&&t[i](e)}}function $(e,i,t,n){void 0===e&&(e="div"),void 0===i&&(i={}),void 0===t&&(t={});var r=document.createElement(e);return Object.getOwnPropertyNames(i).forEach(function(e){var t=i[e];-1!==e.indexOf("aria-")||"role"===e||"type"===e?(h.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\ncreateEl(type, properties, attributes). Attempting to set "+e+" to "+t+"."),r.setAttribute(e,t)):"textContent"===e?J(r,t):r[e]===t&&"tabIndex"!==e||(r[e]=t)}),Object.getOwnPropertyNames(t).forEach(function(e){r.setAttribute(e,t[e])}),n&&ye(r,n),r}function J(e,t){return"undefined"==typeof e.textContent?e.innerText=t:e.textContent=t,e}function Z(e,t){t.firstChild?t.insertBefore(e,t.firstChild):t.appendChild(e)}function ee(e,t){return z(t),e.classList?e.classList.contains(t):new RegExp("(^|\\s)"+t+"($|\\s)").test(e.className)}function te(e,t){return e.classList?e.classList.add(t):ee(e,t)||(e.className=(e.className+" "+t).trim()),e}function ie(e,t){return e?(e.classList?e.classList.remove(t):(z(t),e.className=e.className.split(/\s+/).filter(function(e){return e!==t}).join(" ")),e):(h.warn("removeClass was called with an element that doesn't exist"),null)}function ne(e,t,i){var n=ee(e,t);if((i="boolean"!=typeof(i="function"==typeof i?i(e,t):i)?!n:i)!==n)return(i?te:ie)(e,t),e}function re(i,n){Object.getOwnPropertyNames(n).forEach(function(e){var t=n[e];null===t||"undefined"==typeof t||!1===t?i.removeAttribute(e):i.setAttribute(e,!0===t?"":t)})}function ae(e){var t={},i=",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";if(e&&e.attributes&&0<e.attributes.length)for(var n=e.attributes,r=n.length-1;0<=r;r--){var a=n[r].name,s=n[r].value;"boolean"!=typeof e[a]&&-1===i.indexOf(","+a+",")||(s=null!==s),t[a]=s}return t}function se(e,t){return e.getAttribute(t)}function oe(e,t,i){e.setAttribute(t,i)}function ue(e,t){e.removeAttribute(t)}function le(){document.body.focus(),document.onselectstart=function(){return!1}}function de(){document.onselectstart=function(){return!0}}function ce(e){if(e&&e.getBoundingClientRect&&e.parentNode){var t=e.getBoundingClientRect(),i={};return["bottom","height","left","right","top","width"].forEach(function(e){void 0!==t[e]&&(i[e]=t[e])}),i.height||(i.height=parseFloat(S(e,"height"))),i.width||(i.width=parseFloat(S(e,"width"))),i}}function he(e){if(!e||e&&!e.offsetParent)return{left:0,top:0,width:0,height:0};for(var t=e.offsetWidth,i=e.offsetHeight,n=0,r=0;e.offsetParent&&e!==document[l.fullscreenElement];)n+=e.offsetLeft,r+=e.offsetTop,e=e.offsetParent;return{left:n,top:r,width:t,height:i}}function pe(e,t){var i={x:0,y:0};if(V)for(var n=e;n&&"html"!==n.nodeName.toLowerCase();){var r,a=S(n,"transform");/^matrix/.test(a)?(r=a.slice(7,-1).split(/,\s/).map(Number),i.x+=r[4],i.y+=r[5]):/^matrix3d/.test(a)&&(a=a.slice(9,-1).split(/,\s/).map(Number),i.x+=a[12],i.y+=a[13]),n=n.parentNode}var s={},o=he(t.target),u=he(e),l=u.width,d=u.height,e=t.offsetY-(u.top-o.top),o=t.offsetX-(u.left-o.left);return t.changedTouches&&(o=t.changedTouches[0].pageX-u.left,e=t.changedTouches[0].pageY+u.top,V&&(o-=i.x,e-=i.y)),s.y=1-Math.max(0,Math.min(1,e/d)),s.x=Math.max(0,Math.min(1,o/l)),s}function fe(e){return T(e)&&3===e.nodeType}function me(e){for(;e.firstChild;)e.removeChild(e.firstChild);return e}function ge(e){return"function"==typeof e&&(e=e()),(Array.isArray(e)?e:[e]).map(function(e){return K(e="function"==typeof e?e():e)||fe(e)?e:"string"==typeof e&&/\S/.test(e)?document.createTextNode(e):void 0}).filter(function(e){return e})}function ye(t,e){return ge(e).forEach(function(e){return t.appendChild(e)}),t}function ve(e,t){return ye(me(e),t)}function _e(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))}var be,Te=Q("querySelector"),we=Q("querySelectorAll"),Se=Object.freeze({__proto__:null,isReal:X,isEl:K,isInFrame:Y,createEl:$,textContent:J,prependTo:Z,hasClass:ee,addClass:te,removeClass:ie,toggleClass:ne,setAttributes:re,getAttributes:ae,getAttribute:se,setAttribute:oe,removeAttribute:ue,blockTextSelection:le,unblockTextSelection:de,getBoundingClientRect:ce,findPosition:he,getPointerPosition:pe,isTextNode:fe,emptyEl:me,normalizeContent:ge,appendContent:ye,insertContent:ve,isSingleLeftClick:_e,$:Te,$$:we}),Ee=!1,ke=function(){if(!1!==be.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")),n=e.concat(t,i);if(n&&0<n.length)for(var r=0,a=n.length;r<a;r++){var s=n[r];if(!s||!s.getAttribute){Ce(1);break}void 0===s.player&&null!==s.getAttribute("data-setup")&&be(s)}else Ee||Ce(1)}};function Ce(e,t){X()&&(t&&(be=t),window.setTimeout(ke,e))}function Ie(){Ee=!0,window.removeEventListener("load",Ie)}X()&&("complete"===document.readyState?Ie():window.addEventListener("load",Ie));function xe(e){var t=document.createElement("style");return t.className=e,t}function Ae(e,t){e.styleSheet?e.styleSheet.cssText=t:e.textContent=t}var Pe=3;window.WeakMap||(ui=function(){function e(){this.vdata="vdata"+Math.floor(window.performance&&window.performance.now()||Date.now()),this.data={}}var t=e.prototype;return t.set=function(e,t){var i=e[this.vdata]||Pe++;return e[this.vdata]||(e[this.vdata]=i),this.data[i]=t,this},t.get=function(e){var t=e[this.vdata];if(t)return this.data[t];h("We have no data for this element",e)},t.has=function(e){return e[this.vdata]in this.data},t.delete=function(e){var t=e[this.vdata];t&&(delete this.data[t],delete e[this.vdata])},e}());var Le,Oe=new(window.WeakMap?WeakMap:ui);function De(e,t){var i;Oe.has(e)&&(0===(i=Oe.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&&Oe.delete(e))}function Re(t,i,e,n){e.forEach(function(e){t(i,e,n)})}function Me(e){if(e.fixed_)return e;function t(){return!0}function i(){return!1}if(!e||!e.isPropagationStopped||!e.isImmediatePropagationStopped){var n,r,a,s=e||window.event;for(n in e={},s)"layerX"!==n&&"layerY"!==n&&"keyLocation"!==n&&"webkitMovementX"!==n&&"webkitMovementY"!==n&&"path"!==n&&("returnValue"===n&&s.preventDefault||(e[n]=s[n]));e.target||(e.target=e.srcElement||document),e.relatedTarget||(e.relatedTarget=e.fromElement===e.target?e.toElement:e.fromElement),e.preventDefault=function(){s.preventDefault&&s.preventDefault(),e.returnValue=!1,s.returnValue=!1,e.defaultPrevented=!0},e.defaultPrevented=!1,e.stopPropagation=function(){s.stopPropagation&&s.stopPropagation(),e.cancelBubble=!0,s.cancelBubble=!0,e.isPropagationStopped=t},e.isPropagationStopped=i,e.stopImmediatePropagation=function(){s.stopImmediatePropagation&&s.stopImmediatePropagation(),e.isImmediatePropagationStopped=t,e.stopPropagation()},e.isImmediatePropagationStopped=i,null!==e.clientX&&void 0!==e.clientX&&(r=document.documentElement,a=document.body,e.pageX=e.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=e.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.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)}return e.fixed_=!0,e}var Ne=function(){if("boolean"!=typeof Le){Le=!1;try{var e=Object.defineProperty({},"passive",{get:function(){Le=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){}}return Le},Ue=["touchstart","touchmove"];function Be(s,e,t){if(Array.isArray(e))return Re(Be,s,e,t);Oe.has(s)||Oe.set(s,{});var o=Oe.get(s);o.handlers||(o.handlers={}),o.handlers[e]||(o.handlers[e]=[]),t.guid||(t.guid=Pe++),o.handlers[e].push(t),o.dispatcher||(o.disabled=!1,o.dispatcher=function(e,t){if(!o.disabled){e=Me(e);var i=o.handlers[e.type];if(i)for(var n=i.slice(0),r=0,a=n.length;r<a&&!e.isImmediatePropagationStopped();r++)try{n[r].call(s,e,t)}catch(e){h.error(e)}}}),1===o.handlers[e].length&&(s.addEventListener?(t=!1,Ne()&&-1<Ue.indexOf(e)&&(t={passive:!0}),s.addEventListener(e,o.dispatcher,t)):s.attachEvent&&s.attachEvent("on"+e,o.dispatcher))}function Fe(e,t,i){if(Oe.has(e)){var n=Oe.get(e);if(n.handlers){if(Array.isArray(t))return Re(Fe,e,t,i);var r=function(e,t){n.handlers[t]=[],De(e,t)};if(void 0!==t){var a=n.handlers[t];if(a)if(i){if(i.guid)for(var s=0;s<a.length;s++)a[s].guid===i.guid&&a.splice(s--,1);De(e,t)}else r(e,t)}else for(var o in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},o)&&r(e,o)}}}function je(e,t,i){var n=Oe.has(e)?Oe.get(e):{},r=e.parentNode||e.ownerDocument;return"string"==typeof t?t={type:t,target:e}:t.target||(t.target=e),t=Me(t),n.dispatcher&&n.dispatcher.call(e,t,i),r&&!t.isPropagationStopped()&&!0===t.bubbles?je.call(null,r,t,i):!r&&!t.defaultPrevented&&t.target&&t.target[t.type]&&(Oe.has(t.target)||Oe.set(t.target,{}),r=Oe.get(t.target),t.target[t.type]&&(r.disabled=!0,"function"==typeof t.target[t.type]&&t.target[t.type](),r.disabled=!1)),!t.defaultPrevented}function He(e,t,i){if(Array.isArray(t))return Re(He,e,t,i);function n(){Fe(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||Pe++,Be(e,t,n)}function Ve(e,t,i){function n(){Fe(e,t,n),i.apply(this,arguments)}n.guid=i.guid=i.guid||Pe++,Be(e,t,n)}function qe(e,t,i){return t.guid||(t.guid=Pe++),(e=t.bind(e)).guid=i?i+"_"+t.guid:t.guid,e}function We(t,i){var n=window.performance.now();return function(){var e=window.performance.now();i<=e-n&&(t.apply(void 0,arguments),n=e)}}function Ge(n,r,a,s){var o;function e(){var e=this,t=arguments,i=function(){i=o=null,a||n.apply(e,t)};!o&&a&&n.apply(e,t),s.clearTimeout(o),o=s.setTimeout(i,r)}return void 0===s&&(s=window),e.cancel=function(){s.clearTimeout(o),o=null},e}function ze(){}var Xe,Ke=Object.freeze({__proto__:null,fixEvent:Me,on:Be,off:Fe,trigger:je,one:He,any:Ve});ze.prototype.allowedEvents_={},ze.prototype.addEventListener=ze.prototype.on=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Be(this,e,t),this.addEventListener=i},ze.prototype.removeEventListener=ze.prototype.off=function(e,t){Fe(this,e,t)},ze.prototype.one=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},He(this,e,t),this.addEventListener=i},ze.prototype.any=function(e,t){var i=this.addEventListener;this.addEventListener=function(){},Ve(this,e,t),this.addEventListener=i},ze.prototype.dispatchEvent=ze.prototype.trigger=function(e){var t=e.type||e;e=Me(e="string"==typeof e?{type:t}:e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),je(this,e)},ze.prototype.queueTrigger=function(e){var t=this;Xe=Xe||new Map;var i=e.type||e,n=Xe.get(this);n||(n=new Map,Xe.set(this,n));var r=n.get(i);n.delete(i),window.clearTimeout(r);r=window.setTimeout(function(){n.delete(i),0===n.size&&(n=null,Xe.delete(t)),t.trigger(e)},0);n.set(i,r)};function Ye(e){return"function"==typeof e.name?e.name():"string"==typeof e.name?e.name:e.name_||(e.constructor&&e.constructor.name?e.constructor.name:typeof e)}function Qe(e){return"string"==typeof e&&/\S/.test(e)||Array.isArray(e)&&!!e.length}function $e(e,t,i){if(!e||!e.nodeName&&!it(e))throw new Error("Invalid target for "+Ye(t)+"#"+i+"; must be a DOM node or evented object.")}function Je(e,t,i){if(!Qe(e))throw new Error("Invalid event type for "+Ye(t)+"#"+i+"; must be a non-empty string or array.")}function Ze(e,t,i){if("function"!=typeof e)throw new Error("Invalid listener for "+Ye(t)+"#"+i+"; must be a function.")}function et(e,t,i){var n,r,a=t.length<3||t[0]===e||t[0]===e.eventBusEl_,t=a?(n=e.eventBusEl_,3<=t.length&&t.shift(),r=t[0],t[1]):(n=t[0],r=t[1],t[2]);return $e(n,e,i),Je(r,e,i),Ze(t,e,i),{isTargetingSelf:a,target:n,type:r,listener:t=qe(e,t)}}function tt(e,t,i,n){$e(e,e,t),e.nodeName?Ke[t](e,i,n):e[t](i,n)}var it=function(t){return t instanceof ze||!!t.eventBusEl_&&["on","one","off","trigger"].every(function(e){return"function"==typeof t[e]})},nt={on:function(){for(var e=this,t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];var r,a=et(this,i,"on"),s=a.isTargetingSelf,o=a.target,u=a.type,l=a.listener;tt(o,"on",u,l),s||((r=function(){return e.off(o,u,l)}).guid=l.guid,(s=function(){return e.off("dispose",r)}).guid=l.guid,tt(this,"on","dispose",r),tt(o,"on","dispose",s))},one:function(){for(var r=this,e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=et(this,t,"one"),a=n.isTargetingSelf,s=n.target,o=n.type,u=n.listener;a?tt(s,"one",o,u):((a=function e(){r.off(s,o,e);for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];u.apply(null,i)}).guid=u.guid,tt(s,"one",o,a))},any:function(){for(var r=this,e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=et(this,t,"any"),a=n.isTargetingSelf,s=n.target,o=n.type,u=n.listener;a?tt(s,"any",o,u):((a=function e(){r.off(s,o,e);for(var t=arguments.length,i=new Array(t),n=0;n<t;n++)i[n]=arguments[n];u.apply(null,i)}).guid=u.guid,tt(s,"any",o,a))},off:function(e,t,i){!e||Qe(e)?Fe(this.eventBusEl_,e,t):(t=t,$e(e=e,this,"off"),Je(t,this,"off"),Ze(i,this,"off"),i=qe(this,i),this.off("dispose",i),e.nodeName?(Fe(e,t,i),Fe(e,"dispose",i)):it(e)&&(e.off(t,i),e.off("dispose",i)))},trigger:function(e,t){$e(this.eventBusEl_,this,"trigger");var i=e&&"string"!=typeof e?e.type:e;if(!Qe(i)){i="Invalid event type for "+Ye(this)+"#trigger; must be a non-empty string or object with a type key that has a non-empty value.";if(!e)throw new Error(i);(this.log||h).error(i)}return je(this.eventBusEl_,e,t)}};function rt(e,t){t=(t=void 0===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_=$("span",{className:"vjs-event-bus"});return b(e,nt),e.eventedCallbacks&&e.eventedCallbacks.forEach(function(e){e()}),e.on("dispose",function(){e.off(),[e,e.el_,e.eventBusEl_].forEach(function(e){e&&Oe.has(e)&&Oe.delete(e)}),window.setTimeout(function(){e.eventBusEl_=null},0)}),e}var at={state:{},setState:function(e){var i,n=this;return _(e="function"==typeof e?e():e,function(e,t){n.state[t]!==e&&((i=i||{})[t]={from:n.state[t],to:e}),n.state[t]=e}),i&&it(this)&&this.trigger({changes:i,type:"statechanged"}),i}};function st(e,t){return b(e,at),e.state=b({},e.state,t),"function"==typeof e.handleStateChanged&&it(e)&&e.on("statechanged",e.handleStateChanged),e}function ot(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toLowerCase()})}function ut(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})}function lt(){for(var i={},e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.forEach(function(e){e&&_(e,function(e,t){w(e)?(w(i[t])||(i[t]={}),i[t]=lt(i[t],e)):i[t]=e})}),i}var dt=window.Map||function(){function e(){this.map_={}}var t=e.prototype;return t.has=function(e){return e in this.map_},t.delete=function(e){var t=this.has(e);return delete this.map_[e],t},t.set=function(e,t){return this.map_[e]=t,this},t.forEach=function(e,t){for(var i in this.map_)e.call(t,this.map_[i],i,this)},e}(),ct=window.Set||function(){function e(){this.set_={}}var t=e.prototype;return t.has=function(e){return e in this.set_},t.delete=function(e){var t=this.has(e);return delete this.set_[e],t},t.add=function(e){return this.set_[e]=1,this},t.forEach=function(e,t){for(var i in this.set_)e.call(t,i,i,this)},e}(),ht=m(function(e,t){function i(e){if(!e||"object"!=typeof e||(t=e.which||e.keyCode||e.charCode)&&(e=t),"number"==typeof e)return o[e];var t=String(e),e=n[t.toLowerCase()];return e||((e=r[t.toLowerCase()])?e:1===t.length?t.charCodeAt(0):void 0)}i.isEventKey=function(e,t){if(e&&"object"==typeof e){var i=e.which||e.keyCode||e.charCode;if(null==i)return!1;if("string"==typeof t){e=n[t.toLowerCase()];if(e)return e===i;if(e=r[t.toLowerCase()])return e===i}else if("number"==typeof t)return t===i;return!1}};for(var n=(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},a=97;a<123;a++)n[String.fromCharCode(a)]=a-32;for(var a=48;a<58;a++)n[a-48]=a;for(a=1;a<13;a++)n["f"+a]=a+111;for(a=0;a<10;a++)n["numpad "+a]=a+96;var s,o=t.names=t.title={};for(a in n)o[n[a]]=a;for(s in r)n[s]=r[s]});ht.code,ht.codes,ht.aliases,ht.names,ht.title;var pt=function(){function s(e,t,i){var n=this;!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=lt({},this.options_),t=this.options_=lt(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_"+Pe++),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(function(e){return n.addClass(e)}),!1!==t.evented&&(rt(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),st(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new ct,this.setIntervalIds_=new ct,this.rafIds_=new ct,this.namedRafs_=new dt,(this.clearingTimersOnDispose_=!1)!==t.initChildren&&this.initChildren(),this.ready(i),!1!==t.reportTouchActivity&&this.enableTouchActivity()}var e=s.prototype;return e.dispose=function(e){if(void 0===e&&(e={}),!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(var t=this.children_.length-1;0<=t;t--)this.children_[t].dispose&&this.children_[t].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}},e.isDisposed=function(){return Boolean(this.isDisposed_)},e.player=function(){return this.player_},e.options=function(e){return e&&(this.options_=lt(this.options_,e)),this.options_},e.el=function(){return this.el_},e.createEl=function(e,t,i){return $(e,t,i)},e.localize=function(e,i,t){void 0===t&&(t=e);var n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],n=n&&n.split("-")[0],n=r&&r[n],t=t;return a&&a[e]?t=a[e]:n&&n[e]&&(t=n[e]),t=i?t.replace(/\{(\d+)\}/g,function(e,t){t=i[t-1];return"undefined"==typeof t?e:t}):t},e.handleLanguagechange=function(){},e.contentEl=function(){return this.contentEl_||this.el_},e.id=function(){return this.id_},e.name=function(){return this.name_},e.children=function(){return this.children_},e.getChildById=function(e){return this.childIndex_[e]},e.getChild=function(e){if(e)return this.childNameIndex_[e]},e.getDescendant=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];for(var t=t.reduce(function(e,t){return e.concat(t)},[]),n=this,r=0;r<t.length;r++)if(!(n=n.getChild(t[r]))||!n.getChild)return;return n},e.addChild=function(e,t,i){if(void 0===t&&(t={}),void 0===i&&(i=this.children_.length),"string"==typeof e){var n=ut(e),r=t.componentClass||n;t.name=n;var a=s.getComponent(r);if(!a)throw new Error("Component "+r+" does not exist");if("function"!=typeof a)return null;a=new a(this.player_||this,t)}else a=e;return a.parentComponent_&&a.parentComponent_.removeChild(a),this.children_.splice(i,0,a),a.parentComponent_=this,"function"==typeof a.id&&(this.childIndex_[a.id()]=a),(n=n||a.name&&ut(a.name()))&&(this.childNameIndex_[n]=a,this.childNameIndex_[ot(n)]=a),"function"==typeof a.el&&a.el()&&(n=null,this.children_[i+1]&&(this.children_[i+1].el_?n=this.children_[i+1].el_:K(this.children_[i+1])&&(n=this.children_[i+1])),this.contentEl().insertBefore(a.el(),n)),a},e.removeChild=function(e){if((e="string"==typeof e?this.getChild(e):e)&&this.children_){for(var t,i=!1,n=this.children_.length-1;0<=n;n--)if(this.children_[n]===e){i=!0,this.children_.splice(n,1);break}i&&(e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[ut(e.name())]=null,this.childNameIndex_[ot(e.name())]=null,(t=e.el())&&t.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el()))}},e.initChildren=function(){var i,t,e,n=this,r=this.options_.children;r&&(i=this.options_,t=s.getComponent("Tech"),(e=Array.isArray(r)?r:Object.keys(r)).concat(Object.keys(this.options_).filter(function(t){return!e.some(function(e){return"string"==typeof e?t===e:t===e.name})})).map(function(e){var t,e="string"==typeof e?r[t=e]||n.options_[t]||{}:(t=e.name,e);return{name:t,opts:e}}).filter(function(e){e=s.getComponent(e.opts.componentClass||ut(e.name));return e&&!t.isTech(e)}).forEach(function(e){var t=e.name,e=e.opts;!1!==(e=void 0!==i[t]?i[t]:e)&&((e=!0===e?{}:e).playerOptions=n.options_.playerOptions,(e=n.addChild(t,e))&&(n[t]=e))}))},e.buildCSSClass=function(){return""},e.ready=function(e,t){if(void 0===t&&(t=!1),e)return this.isReady_?void(t?e.call(this):this.setTimeout(e,1)):(this.readyQueue_=this.readyQueue_||[],void this.readyQueue_.push(e))},e.triggerReady=function(){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.$=function(e,t){return Te(e,t||this.contentEl())},e.$$=function(e,t){return we(e,t||this.contentEl())},e.hasClass=function(e){return ee(this.el_,e)},e.addClass=function(e){te(this.el_,e)},e.removeClass=function(e){ie(this.el_,e)},e.toggleClass=function(e,t){ne(this.el_,e,t)},e.show=function(){this.removeClass("vjs-hidden")},e.hide=function(){this.addClass("vjs-hidden")},e.lockShowing=function(){this.addClass("vjs-lock-showing")},e.unlockShowing=function(){this.removeClass("vjs-lock-showing")},e.getAttribute=function(e){return se(this.el_,e)},e.setAttribute=function(e,t){oe(this.el_,e,t)},e.removeAttribute=function(e){ue(this.el_,e)},e.width=function(e,t){return this.dimension("width",e,t)},e.height=function(e,t){return this.dimension("height",e,t)},e.dimensions=function(e,t){this.width(e,!0),this.height(t)},e.dimension=function(e,t,i){if(void 0!==t)return-1!==(""+(t=null===t||t!=t?0:t)).indexOf("%")||-1!==(""+t).indexOf("px")?this.el_.style[e]=t:this.el_.style[e]="auto"===t?"":t+"px",void(i||this.trigger("componentresize"));if(!this.el_)return 0;t=this.el_.style[e],i=t.indexOf("px");return-1!==i?parseInt(t.slice(0,i),10):parseInt(this.el_["offset"+ut(e)],10)},e.currentDimension=function(e){var t=0;if("width"!==e&&"height"!==e)throw new Error("currentDimension only accepts width or height value");return t=S(this.el_,e),0!==(t=parseFloat(t))&&!isNaN(t)||(e="offset"+ut(e),t=this.el_[e]),t},e.currentDimensions=function(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}},e.currentWidth=function(){return this.currentDimension("width")},e.currentHeight=function(){return this.currentDimension("height")},e.focus=function(){this.el_.focus()},e.blur=function(){this.el_.blur()},e.handleKeyDown=function(e){this.player_&&(ht.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))},e.handleKeyPress=function(e){this.handleKeyDown(e)},e.emitTapEvents=function(){var i,t=0,n=null;this.on("touchstart",function(e){1===e.touches.length&&(n={pageX:e.touches[0].pageX,pageY:e.touches[0].pageY},t=window.performance.now(),i=!0)}),this.on("touchmove",function(e){var t;1<e.touches.length?i=!1:n&&(t=e.touches[0].pageX-n.pageX,e=e.touches[0].pageY-n.pageY,10<Math.sqrt(t*t+e*e)&&(i=!1))});function e(){i=!1}this.on("touchleave",e),this.on("touchcancel",e),this.on("touchend",function(e){!(n=null)===i&&window.performance.now()-t<200&&(e.preventDefault(),this.trigger("tap"))})},e.enableTouchActivity=function(){var t,i,e;this.player()&&this.player().reportUserActivity&&(t=qe(this.player(),this.player().reportUserActivity),this.on("touchstart",function(){t(),this.clearInterval(i),i=this.setInterval(t,250)}),e=function(e){t(),this.clearInterval(i)},this.on("touchmove",t),this.on("touchend",e),this.on("touchcancel",e))},e.setTimeout=function(e,t){var i,n=this;return e=qe(this,e),this.clearTimersOnDispose_(),i=window.setTimeout(function(){n.setTimeoutIds_.has(i)&&n.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i},e.clearTimeout=function(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),window.clearTimeout(e)),e},e.setInterval=function(e,t){e=qe(this,e),this.clearTimersOnDispose_();t=window.setInterval(e,t);return this.setIntervalIds_.add(t),t},e.clearInterval=function(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),window.clearInterval(e)),e},e.requestAnimationFrame=function(e){var t,i=this;return this.supportsRaf_?(this.clearTimersOnDispose_(),e=qe(this,e),t=window.requestAnimationFrame(function(){i.rafIds_.has(t)&&i.rafIds_.delete(t),e()}),this.rafIds_.add(t),t):this.setTimeout(e,1e3/60)},e.requestNamedAnimationFrame=function(e,t){var i=this;if(!this.namedRafs_.has(e)){this.clearTimersOnDispose_(),t=qe(this,t);var n=this.requestAnimationFrame(function(){t(),i.namedRafs_.has(e)&&i.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),e}},e.cancelNamedAnimationFrame=function(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))},e.cancelAnimationFrame=function(e){return this.supportsRaf_?(this.rafIds_.has(e)&&(this.rafIds_.delete(e),window.cancelAnimationFrame(e)),e):this.clearTimeout(e)},e.clearTimersOnDispose_=function(){var n=this;this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",function(){[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(function(e){var t=e[0],i=e[1];n[t].forEach(function(e,t){return n[i](t)})}),n.clearingTimersOnDispose_=!1}))},s.registerComponent=function(e,t){if("string"!=typeof e||!e)throw new Error('Illegal component name, "'+e+'"; must be a non-empty string.');var i=s.getComponent("Tech"),n=i&&i.isTech(t),i=s===t||s.prototype.isPrototypeOf(t.prototype);if(n||!i){var r=n?"techs must be registered using Tech.registerTech()":"must be a Component subclass";throw new Error('Illegal component, "'+e+'"; '+r+".")}e=ut(e),s.components_||(s.components_={});r=s.getComponent("Player");if("Player"===e&&r&&r.players){var a=r.players,r=Object.keys(a);if(a&&0<r.length&&r.map(function(e){return a[e]}).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return s.components_[e]=t,s.components_[ot(e)]=t},s.getComponent=function(e){if(e&&s.components_)return s.components_[e]},s}();pt.prototype.supportsRaf_="function"==typeof window.requestAnimationFrame&&"function"==typeof window.cancelAnimationFrame,pt.registerComponent("Component",pt);var ft=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var mt=function(e,t){e.prototype=Object.create(t.prototype),(e.prototype.constructor=e).__proto__=t};function gt(e,t,i,n){return function(e,t,i){if("number"!=typeof t||t<0||i<t)throw new Error("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+t+") is non-numeric or out of bounds (0-"+i+").")}(e,n,i.length-1),i[n][t]}function yt(e){var t=void 0===e||0===e.length?{length:0,start:function(){throw new Error("This TimeRanges object is empty")},end:function(){throw new Error("This TimeRanges object is empty")}}:{length:e.length,start:gt.bind(null,"start",0,e),end:gt.bind(null,"end",1,e)};return window.Symbol&&window.Symbol.iterator&&(t[window.Symbol.iterator]=function(){return(e||[]).values()}),t}function vt(e,t){return Array.isArray(e)?yt(e):void 0===e||void 0===t?yt():yt([[e,t]])}function _t(e,t){var i,n,r=0;if(!t)return 0;e&&e.length||(e=vt(0,0));for(var a=0;a<e.length;a++)i=e.start(a),r+=(n=t<(n=e.end(a))?t:n)-i;return r/t}function bt(e){if(e instanceof bt)return e;"number"==typeof e?this.code=e:"string"==typeof e?this.message=e:T(e)&&("number"==typeof e.code&&(this.code=e.code),b(this,e)),this.message||(this.message=bt.defaultMessages[this.code]||"")}bt.prototype.code=0,bt.prototype.message="",bt.prototype.status=null,bt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"],bt.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(var Tt=0;Tt<bt.errorTypes.length;Tt++)bt[bt.errorTypes[Tt]]=Tt,bt.prototype[bt.errorTypes[Tt]]=Tt;var wt=function(e,t){var i,n=null;try{i=JSON.parse(e,t)}catch(e){n=e}return[n,i]};function St(e){return null!=e&&"function"==typeof e.then}function Et(e){St(e)&&e.then(null,function(e){})}function kt(n){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce(function(e,t,i){return n[t]&&(e[t]=n[t]),e},{cues:n.cues&&Array.prototype.map.call(n.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})}var Ct=function(e){var t=e.$$("track"),i=Array.prototype.map.call(t,function(e){return e.track});return Array.prototype.map.call(t,function(e){var t=kt(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(kt))},It=function(e,i){return e.forEach(function(e){var t=i.addRemoteTextTrack(e).track;!e.src&&e.cues&&e.cues.forEach(function(e){return t.addCue(e)})}),i.textTracks()},xt="vjs-modal-dialog",At=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.close_=function(e){return i.close(e)},i.opened_=i.hasBeenOpened_=i.hasBeenFilled_=!1,i.closeable(!i.options_.uncloseable),i.content(i.options_.content),i.contentEl_=$("div",{className:xt+"-content"},{role:"document"}),i.descEl_=$("p",{className:xt+"-description vjs-control-text",id:i.el().getAttribute("aria-describedby")}),J(i.descEl_,i.description()),i.el_.appendChild(i.descEl_),i.el_.appendChild(i.contentEl_),i}mt(e,n);var t=e.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":this.id()+"_description","aria-hidden":"true","aria-label":this.label(),role:"dialog"})},t.dispose=function(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,n.prototype.dispose.call(this)},t.buildCSSClass=function(){return xt+" vjs-hidden "+n.prototype.buildCSSClass.call(this)},t.label=function(){return this.localize(this.options_.label||"Modal Window")},t.description=function(){var 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},t.open=function(){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)},t.opened=function(e){return"boolean"==typeof e&&this[e?"open":"close"](),this.opened_},t.close=function(){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())},t.closeable=function(e){var t,i;return"boolean"==typeof e&&(t=this.closeable_=!!e,i=this.getChild("closeButton"),t&&!i&&(e=this.contentEl_,this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=e,this.on(i,"close",this.close_)),!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())),this.closeable_},t.fill=function(){this.fillWith(this.content())},t.fillWith=function(e){var t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),ve(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);t=this.getChild("closeButton");t&&i.appendChild(t.el_)},t.empty=function(){this.trigger("beforemodalempty"),me(this.contentEl()),this.trigger("modalempty")},t.content=function(e){return"undefined"!=typeof e&&(this.content_=e),this.content_},t.conditionalFocus_=function(){var e=document.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,!t.contains(e)&&t!==e||(this.previouslyActiveEl_=e,this.focus())},t.conditionalBlur_=function(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)},t.handleKeyDown=function(e){if(e.stopPropagation(),ht.isEventKey(e,"Escape")&&this.closeable())return e.preventDefault(),void this.close();if(ht.isEventKey(e,"Tab")){for(var t,i=this.focusableEls_(),n=this.el_.querySelector(":focus"),r=0;r<i.length;r++)if(n===i[r]){t=r;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())}},t.focusableEls_=function(){var e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,function(e){return(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")})},e}(pt);At.prototype.options_={pauseOnOpen:!0,temporary:!0},pt.registerComponent("ModalDialog",At);var Pt,Lt=function(n){function e(e){var t;void 0===e&&(e=[]),(t=n.call(this)||this).tracks_=[],Object.defineProperty(ft(t),"length",{get:function(){return this.tracks_.length}});for(var i=0;i<e.length;i++)t.addTrack(e[i]);return t}mt(e,n);var t=e.prototype;return t.addTrack=function(e){var t=this,i=this.tracks_.length;""+i in this||Object.defineProperty(this,i,{get:function(){return this.tracks_[i]}}),-1===this.tracks_.indexOf(e)&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=function(){t.trigger({track:e,type:"labelchange",target:t})},it(e)&&e.addEventListener("labelchange",e.labelchange_)},t.removeTrack=function(e){for(var t,i=0,n=this.length;i<n;i++)if(this[i]===e){(t=this[i]).off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})},t.getTrackById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},e}(ze);for(Pt in Lt.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"},Lt.prototype.allowedEvents_)Lt.prototype["on"+Pt]=null;function Ot(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].enabled=!1)}function Dt(e,t){for(var i=0;i<e.length;i++)Object.keys(e[i]).length&&t.id!==e[i].id&&(e[i].selected=!1)}function Rt(e){var t=["protocol","hostname","port","pathname","search","hash","host"],i=document.createElement("a");i.href=e;for(var n={},r=0;r<t.length;r++)n[t[r]]=i[t[r]];return"http:"===n.protocol&&(n.host=n.host.replace(/:80$/,"")),"https:"===n.protocol&&(n.host=n.host.replace(/:443$/,"")),n.protocol||(n.protocol=window.location.protocol),n.host||(n.host=window.location.host),n}function Mt(e){var t;return e.match(/^https?:\/\//)||((t=document.createElement("a")).href=e,e=t.href),e}function Nt(e){if("string"==typeof e){e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(e);if(e)return e.pop().toLowerCase()}return""}function Ut(e,t){return void 0===t&&(t=window.location),(":"===(e=Rt(e)).protocol?t:e).protocol+e.host!==t.protocol+t.host}var Bt=function(n){function e(e){for(var t,i=(e=void 0===e?[]:e).length-1;0<=i;i--)if(e[i].enabled){Ot(e,e[i]);break}return(t=n.call(this,e)||this).changing_=!1,t}mt(e,n);var t=e.prototype;return t.addTrack=function(e){var t=this;e.enabled&&Ot(this,e),n.prototype.addTrack.call(this,e),e.addEventListener&&(e.enabledChange_=function(){t.changing_||(t.changing_=!0,Ot(t,e),t.changing_=!1,t.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))},t.removeTrack=function(e){n.prototype.removeTrack.call(this,e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)},e}(Lt),Ft=function(n){function e(e){for(var t,i=(e=void 0===e?[]:e).length-1;0<=i;i--)if(e[i].selected){Dt(e,e[i]);break}return(t=n.call(this,e)||this).changing_=!1,Object.defineProperty(ft(t),"selectedIndex",{get:function(){for(var e=0;e<this.length;e++)if(this[e].selected)return e;return-1},set:function(){}}),t}mt(e,n);var t=e.prototype;return t.addTrack=function(e){var t=this;e.selected&&Dt(this,e),n.prototype.addTrack.call(this,e),e.addEventListener&&(e.selectedChange_=function(){t.changing_||(t.changing_=!0,Dt(t,e),t.changing_=!1,t.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))},t.removeTrack=function(e){n.prototype.removeTrack.call(this,e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)},e}(Lt),k=function(i){function e(){return i.apply(this,arguments)||this}mt(e,i);var t=e.prototype;return t.addTrack=function(e){var t=this;i.prototype.addTrack.call(this,e),this.queueChange_||(this.queueChange_=function(){return t.queueTrigger("change")}),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=function(){return t.trigger("selectedlanguagechange")}),e.addEventListener("modechange",this.queueChange_);-1===["metadata","chapters"].indexOf(e.kind)&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)},t.removeTrack=function(e){i.prototype.removeTrack.call(this,e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))},e}(Lt),jt=function(){function e(e){void 0===e&&(e=[]),this.trackElements_=[],Object.defineProperty(this,"length",{get:function(){return this.trackElements_.length}});for(var t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}var t=e.prototype;return t.addTrackElement_=function(e){var t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get:function(){return this.trackElements_[t]}}),-1===this.trackElements_.indexOf(e)&&this.trackElements_.push(e)},t.getTrackElementByTrack_=function(e){for(var t,i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t},t.removeTrackElement_=function(e){for(var t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&"function"==typeof this.trackElements_[t].track.off&&this.trackElements_[t].track.off(),"function"==typeof this.trackElements_[t].off&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}},e}(),Ht=function(){function t(e){t.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get:function(){return this.length_}})}var e=t.prototype;return e.setCues_=function(e){var t=this.length||0,i=0,n=e.length;this.cues_=e,this.length_=e.length;function r(e){""+e in this||Object.defineProperty(this,""+e,{get:function(){return this.cues_[e]}})}if(t<n)for(i=t;i<n;i++)r.call(this,i)},e.getCueById=function(e){for(var t=null,i=0,n=this.length;i<n;i++){var r=this[i];if(r.id===e){t=r;break}}return t},t}(),Vt={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},qt={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Wt={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Gt={disabled:"disabled",hidden:"hidden",showing:"showing"},C=function(a){function e(e){void 0===e&&(e={});var t,i=a.call(this)||this,n={id:e.id||"vjs_track_"+Pe++,kind:e.kind||"",language:e.language||""},r=e.label||"";for(t in n)!function(e){Object.defineProperty(ft(i),e,{get:function(){return n[e]},set:function(){}})}(t);return Object.defineProperty(ft(i),"label",{get:function(){return r},set:function(e){e!==r&&(r=e,this.trigger("labelchange"))}}),i}return mt(e,a),e}(ze),zt=Object.freeze({__proto__:null,parseUrl:Rt,getAbsoluteURL:Mt,getFileExtension:Nt,isCrossOrigin:Ut}),Xt="undefined"!=typeof window?window:"undefined"!=typeof f?f:"undefined"!=typeof self?self:{},Kt=Xt,Yt=function(e){if(!e)return!1;var t=Qt.call(e);return"[object Function]"===t||"function"==typeof e&&"[object RegExp]"!==t||"undefined"!=typeof window&&(e===window.setTimeout||e===window.alert||e===window.confirm||e===window.prompt)},Qt=Object.prototype.toString;ei.httpHandler=function(n,r){return void 0===r&&(r=!1),function(e,t,i){if(e)n(e);else if(400<=t.statusCode&&t.statusCode<=599){e=i;if(r)if(Kt.TextDecoder){t=function(e){void 0===e&&(e="");return e.toLowerCase().split(";").reduce(function(e,t){var i=t.split("="),t=i[0],i=i[1];return"charset"===t.trim()?i.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));n({cause:e})}else n(null,i)}};
/**
   * @license
   * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
   * Copyright (c) 2014 David Björklund
   * Available under the MIT license
   * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
   */
var $t=function(e){var n={};return e&&e.trim().split("\n").forEach(function(e){var t=e.indexOf(":"),i=e.slice(0,t).trim().toLowerCase(),t=e.slice(t+1).trim();"undefined"==typeof n[i]?n[i]=t:Array.isArray(n[i])?n[i].push(t):n[i]=[n[i],t]}),n},Jt=ei,I=ei;function Zt(e,t,i){var n=e;return Yt(t)?(i=t,"string"==typeof e&&(n={uri:e})):n=g({},t,{uri:e}),n.callback=i,n}function ei(e,t,i){return ti(t=Zt(e,t,i))}function ti(n){if("undefined"==typeof n.callback)throw new Error("callback argument missing");var r=!1,a=function(e,t,i){r||(r=!0,n.callback(e,t,i))};function s(){var e=void 0,e=l.response||l.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}(l);if(m)try{e=JSON.parse(e)}catch(e){}return e}function t(e){return clearTimeout(u),(e=!(e instanceof Error)?new Error(""+(e||"Unknown XMLHttpRequest Error")):e).statusCode=0,a(e,g)}function e(){if(!o){clearTimeout(u);var e=n.useXDR&&void 0===l.status?200:1223===l.status?204:l.status,t=g,i=null;return 0!==e?(t={body:s(),statusCode:e,method:c,headers:{},url:d,rawRequest:l},l.getAllResponseHeaders&&(t.headers=$t(l.getAllResponseHeaders()))):i=new Error("Internal XMLHttpRequest Error"),a(i,t,t.body)}}var i,o,u,l=n.xhr||null,d=(l=l||new(n.cors||n.useXDR?ei.XDomainRequest:ei.XMLHttpRequest)).url=n.uri||n.url,c=l.method=n.method||"GET",h=n.body||n.data,p=l.headers=n.headers||{},f=!!n.sync,m=!1,g={body:void 0,headers:{},statusCode:0,method:c,url:d,rawRequest:l};if("json"in n&&!1!==n.json&&(m=!0,p.accept||p.Accept||(p.Accept="application/json"),"GET"!==c&&"HEAD"!==c&&(p["content-type"]||p["Content-Type"]||(p["Content-Type"]="application/json"),h=JSON.stringify(!0===n.json?h:n.json))),l.onreadystatechange=function(){4===l.readyState&&setTimeout(e,0)},l.onload=e,l.onerror=t,l.onprogress=function(){},l.onabort=function(){o=!0},l.ontimeout=t,l.open(c,d,!f,n.username,n.password),f||(l.withCredentials=!!n.withCredentials),!f&&0<n.timeout&&(u=setTimeout(function(){var e;o||(o=!0,l.abort("timeout"),(e=new Error("XMLHttpRequest timeout")).code="ETIMEDOUT",t(e))},n.timeout)),l.setRequestHeader)for(i in p)p.hasOwnProperty(i)&&l.setRequestHeader(i,p[i]);else if(n.headers&&!function(e){for(var t in e)if(e.hasOwnProperty(t))return;return 1}(n.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in n&&(l.responseType=n.responseType),"beforeSend"in n&&"function"==typeof n.beforeSend&&n.beforeSend(l),l.send(h||null),l}ei.XMLHttpRequest=Kt.XMLHttpRequest||function(){},ei.XDomainRequest="withCredentials"in new ei.XMLHttpRequest?ei.XMLHttpRequest:Kt.XDomainRequest,function(e,t){for(var i=0;i<e.length;i++)t(e[i])}(["get","put","post","patch","head","delete"],function(n){ei["delete"===n?"del":n]=function(e,t,i){return(t=Zt(e,t,i)).method=n.toUpperCase(),ti(t)}}),Jt.default=I;function ii(e,t){var i=new window.WebVTT.Parser(window,window.vttjs,window.WebVTT.StringDecoder()),n=[];i.oncue=function(e){t.addCue(e)},i.onparsingerror=function(e){n.push(e)},i.onflush=function(){t.trigger({type:"loadeddata",target:t})},i.parse(e),0<n.length&&(window.console&&window.console.groupCollapsed&&window.console.groupCollapsed("Text Track parsing errors for "+t.src),n.forEach(function(e){return h.error(e)}),window.console&&window.console.groupEnd&&window.console.groupEnd()),i.flush()}function ni(e,n){var t={uri:e};(e=Ut(e))&&(t.cors=e),(e="use-credentials"===n.tech_.crossOrigin())&&(t.withCredentials=e),Jt(t,qe(this,function(e,t,i){return e?h.error(e,t):(n.loaded_=!0,void("function"!=typeof window.WebVTT?n.tech_&&n.tech_.any(["vttjsloaded","vttjserror"],function(e){return"vttjserror"!==e.type?ii(i,n):void h.error("vttjs failed to load, stopping trying to process "+n.src)}):ii(i,n)))}))}var ri=function(a){function e(e){var t;if(!(e=void 0===e?{}:e).tech)throw new Error("A tech was not provided.");var e=lt(e,{kind:Wt[e.kind]||"subtitles",language:e.language||e.srclang||""}),i=Gt[e.mode]||"disabled",n=e.default;"metadata"!==e.kind&&"chapters"!==e.kind||(i="hidden"),(t=a.call(this,e)||this).tech_=e.tech,t.cues_=[],t.activeCues_=[],t.preload_=!1!==t.tech_.preloadTextTracks;var r=new Ht(t.cues_),s=new Ht(t.activeCues_),o=!1;t.timeupdateHandler=qe(ft(t),function(e){void 0===e&&(e={}),this.tech_.isDisposed()||(this.tech_.isReady_&&(this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1)),"timeupdate"!==e.type&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler)))});return t.tech_.one("dispose",function(){t.stopTracking()}),"disabled"!==i&&t.startTracking(),Object.defineProperties(ft(t),{default:{get:function(){return n},set:function(){}},mode:{get:function(){return i},set:function(e){Gt[e]&&i!==e&&(i=e,this.preload_||"disabled"===i||0!==this.cues.length||ni(this.src,this),this.stopTracking(),"disabled"!==i&&this.startTracking(),this.trigger("modechange"))}},cues:{get:function(){return this.loaded_?r:null},set:function(){}},activeCues:{get:function(){if(!this.loaded_)return null;if(0===this.cues.length)return s;for(var e=this.tech_.currentTime(),t=[],i=0,n=this.cues.length;i<n;i++){var r=this.cues[i];(r.startTime<=e&&r.endTime>=e||r.startTime===r.endTime&&r.startTime<=e&&r.startTime+.5>=e)&&t.push(r)}if(o=!1,t.length!==this.activeCues_.length)o=!0;else for(var a=0;a<t.length;a++)-1===this.activeCues_.indexOf(t[a])&&(o=!0);return this.activeCues_=t,s.setCues_(this.activeCues_),s},set:function(){}}}),e.src?(t.src=e.src,t.preload_||(t.loaded_=!0),(t.preload_||"subtitles"!==e.kind&&"captions"!==e.kind)&&ni(t.src,ft(t))):t.loaded_=!0,t}mt(e,a);var t=e.prototype;return t.startTracking=function(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)},t.stopTracking=function(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)},t.addCue=function(e){var t=e;if(!("getCueAsHTML"in t)){for(var i in t=new window.vttjs.VTTCue(e.startTime,e.endTime,e.text),e)i in t||(t[i]=e[i]);t.id=e.id,t.originalCue_=e}for(var n=this.tech_.textTracks(),r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)},t.removeCue=function(e){for(var t=this.cues_.length;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}}},e}(C);ri.prototype.allowedEvents_={cuechange:"cuechange"};x=function(n){function e(e){var t=lt(e=void 0===e?{}:e,{kind:qt[e.kind]||""}),e=n.call(this,t)||this,i=!1;return Object.defineProperty(ft(e),"enabled",{get:function(){return i},set:function(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("enabledchange"))}}),t.enabled&&(e.enabled=t.enabled),e.loaded_=!0,e}return mt(e,n),e}(C),U=function(n){function e(e){var t=lt(e=void 0===e?{}:e,{kind:Vt[e.kind]||""}),e=n.call(this,t)||this,i=!1;return Object.defineProperty(ft(e),"selected",{get:function(){return i},set:function(e){"boolean"==typeof e&&e!==i&&(i=e,this.trigger("selectedchange"))}}),t.selected&&(e.selected=t.selected),e}return mt(e,n),e}(C),j=function(r){function e(e){var t;void 0===e&&(e={});var i=r.call(this)||this,n=new ri(e);return i.kind=n.kind,i.src=n.src,i.srclang=n.language,i.label=n.label,i.default=n.default,Object.defineProperties(ft(i),{readyState:{get:function(){return t}},track:{get:function(){return n}}}),t=0,n.addEventListener("loadeddata",function(){t=2,i.trigger({type:"load",target:ft(i)})}),i}return mt(e,r),e}(ze);j.prototype.allowedEvents_={load:"load"},j.NONE=0,j.LOADING=1,j.LOADED=2,j.ERROR=3;var ai={audio:{ListClass:Bt,TrackClass:x,capitalName:"Audio"},video:{ListClass:Ft,TrackClass:U,capitalName:"Video"},text:{ListClass:k,TrackClass:ri,capitalName:"Text"}};Object.keys(ai).forEach(function(e){ai[e].getterName=e+"Tracks",ai[e].privateName=e+"Tracks_"});var si={remoteText:{ListClass:k,TrackClass:ri,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:jt,TrackClass:j,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},oi=g({},ai,si);si.names=Object.keys(si),ai.names=Object.keys(ai),oi.names=[].concat(si.names).concat(ai.names);var ui="undefined"!=typeof f?f:"undefined"!=typeof window?window:{},li="undefined"!=typeof document?document:(li=ui["__GLOBAL_DOCUMENT_CACHE@4"])||(ui["__GLOBAL_DOCUMENT_CACHE@4"]={}),Xt=li,di=Object.create||function(e){if(1!==arguments.length)throw new Error("Object.create shim only accepts one parameter.");return ci.prototype=e,new ci};function ci(){}function hi(e,t){this.name="ParsingError",this.code=e.code,this.message=t||e.message}function pi(e){function t(e,t,i,n){return 3600*(0|e)+60*(0|t)+(0|i)+(0|n)/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 fi(){this.values=di(null)}function mi(e,t,i,n){var r,a,s=n?e.split(n):[e];for(r in s)"string"==typeof s[r]&&(2===(a=s[r].split(i)).length&&t(a[0].trim(),a[1].trim()))}function gi(t,e,s){var i=t;function n(){var e=pi(t);if(null===e)throw new hi(hi.Errors.BadTimeStamp,"Malformed timestamp: "+i);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function r(){t=t.replace(/^\s+/,"")}if(r(),e.startTime=n(),r(),"--\x3e"!==t.substr(0,3))throw new hi(hi.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '--\x3e'): "+i);t=t.substr(3),r(),e.endTime=n(),r(),function(e,t){var a=new fi;mi(e,function(e,t){switch(e){case"region":for(var i=s.length-1;0<=i;i--)if(s[i].id===t){a.set(e,s[i].region);break}break;case"vertical":a.alt(e,t,["rl","lr"]);break;case"line":var n=t.split(","),r=n[0];a.integer(e,r),a.percent(e,r)&&a.set("snapToLines",!1),a.alt(e,r,["auto"]),2===n.length&&a.alt("lineAlign",n[1],["start","center","end"]);break;case"position":n=t.split(","),a.percent(e,n[0]),2===n.length&&a.alt("positionAlign",n[1],["start","center","end"]);break;case"size":a.percent(e,t);break;case"align":a.alt(e,t,["start","center","end","left","right"])}},/:/,/\s/),t.region=a.get("region",null),t.vertical=a.get("vertical","");try{t.line=a.get("line","auto")}catch(e){}t.lineAlign=a.get("lineAlign","start"),t.snapToLines=a.get("snapToLines",!0),t.size=a.get("size",100);try{t.align=a.get("align","center")}catch(e){t.align=a.get("align","middle")}try{t.position=a.get("position","auto")}catch(e){t.position=a.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},t.align)}t.positionAlign=a.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},t.align)}(t,e)}((hi.prototype=di(Error.prototype)).constructor=hi).Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}},fi.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 n=0;n<i.length;++n)if(t===i[n]){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 yi=Xt.createElement&&Xt.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)"},bi={v:"title",lang:"lang"},Ti={rt:"ruby"};function wi(e,t){for(var i,n,r,a,s,o,u,l,d,c,h=e.document.createElement("div"),p=h,f=[];null!==(i=function(){if(!t)return null;var e=t.match(/^([^<]*)(<[^>]*>?)?/);return e=e[1]||e[2],t=t.substr(e.length),e}());)"<"!==i[0]?p.appendChild(e.document.createTextNode((s=i,yi.innerHTML=s,s=yi.textContent,yi.textContent="",s))):"/"!==i[1]?(a=pi(i.substr(1,i.length-2)))?(n=e.document.createProcessingInstruction("timestamp",a),p.appendChild(n)):(r=i.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/))&&(l=r[1],d=r[3],c=void 0,c=vi[l],(n=c?(c=e.document.createElement(c),(l=bi[l])&&d&&(c[l]=d.trim()),c):null)&&(o=p,Ti[(u=n).localName]&&Ti[u.localName]!==o.localName||(r[2]&&((a=r[2].split(".")).forEach(function(e){var t=/^bg_/.test(e),e=t?e.slice(3):e;_i.hasOwnProperty(e)&&(e=_i[e],n.style[t?"background-color":"color"]=e)}),n.className=a.join(" ")),f.push(r[1]),p.appendChild(n),p=n))):f.length&&f[f.length-1]===i.substr(2).replace(">","")&&(f.pop(),p=p.parentNode);return h}var Si=[[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 Ei(e){var t=[],i="";if(!e||!e.childNodes)return"ltr";function a(e,t){for(var i=t.childNodes.length-1;0<=i;i--)e.push(t.childNodes[i])}for(a(t,e);i=function e(t){if(!t||!t.length)return null;var i=t.pop(),n=i.textContent||i.innerText;if(n){var r=n.match(/^.*(\n|\r)/);return r?r[t.length=0]:n}return"ruby"===i.tagName?e(t):i.childNodes?(a(t,i),e(t)):void 0}(t);)for(var n=0;n<i.length;n++)if(function(e){for(var t=0;t<Si.length;t++){var i=Si[t];if(e>=i[0]&&e<=i[1])return 1}}(i.charCodeAt(n)))return"rtl";return"ltr"}function ki(){}function Ci(e,t,i){ki.call(this),this.cue=t,this.cueDiv=wi(e,t.text);var n={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"};this.applyStyles(n,this.cueDiv),this.div=e.document.createElement("div"),n={direction:Ei(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(n),this.div.appendChild(this.cueDiv);var r=0;switch(t.positionAlign){case"start":case"line-left":r=t.position;break;case"center":r=t.position-t.size/2;break;case"end":case"line-right":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 Ii(e){var t,i,n,r;e.div&&(t=e.div.offsetHeight,i=e.div.offsetWidth,n=e.div.offsetTop,r=(r=e.div.childNodes)&&(r=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||n,this.height=e.height||t,this.bottom=e.bottom||n+(e.height||t),this.width=e.width||i,this.lineHeight=void 0!==r?r:e.lineHeight}function xi(e,t,o,u){var i,n=new Ii(t),r=t.cue,a=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,n=0,r=0;r<i.length&&i[r]!==t;r++)"showing"===i[r].mode&&n++;return-1*++n}(r),s=[];if(r.snapToLines){switch(r.vertical){case"":s=["+y","-y"],i="height";break;case"rl":s=["+x","-x"],i="width";break;case"lr":s=["-x","+x"],i="width"}var l=n.lineHeight,d=l*Math.round(a),c=o[i]+l,h=s[0];Math.abs(d)>c&&(d=d<0?-1:1,d*=Math.ceil(c/l)*l),a<0&&(d+=""===r.vertical?o.height:o.width,s=s.reverse()),n.move(h,d)}else{var p=n.lineHeight/o.height*100;switch(r.lineAlign){case"center":a-=p/2;break;case"end":a-=p}switch(r.vertical){case"":t.applyStyles({top:t.formatStyle(a,"%")});break;case"rl":t.applyStyles({left:t.formatStyle(a,"%")});break;case"lr":t.applyStyles({right:t.formatStyle(a,"%")})}s=["+y","-x","+x","-y"],n=new Ii(t)}n=function(e,t){for(var i,n=new Ii(e),r=1,a=0;a<t.length;a++){for(;e.overlapsOppositeAxis(o,t[a])||e.within(o)&&e.overlapsAny(u);)e.move(t[a]);if(e.within(o))return e;var s=e.intersectPercentage(o);s<r&&(i=new Ii(e),r=s),e=new Ii(n)}return i||n}(n,s);t.move(n.toCSSCompatValues(o))}function Ai(){}ki.prototype.applyStyles=function(e,t){for(var i in t=t||this.div,e)e.hasOwnProperty(i)&&(t.style[i]=e[i])},ki.prototype.formatStyle=function(e,t){return 0===e?0:e+t},(Ci.prototype=di(ki.prototype)).constructor=Ci,Ii.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}},Ii.prototype.overlaps=function(e){return this.left<e.right&&this.right>e.left&&this.top<e.bottom&&this.bottom>e.top},Ii.prototype.overlapsAny=function(e){for(var t=0;t<e.length;t++)if(this.overlaps(e[t]))return!0;return!1},Ii.prototype.within=function(e){return this.top>=e.top&&this.bottom<=e.bottom&&this.left>=e.left&&this.right<=e.right},Ii.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}},Ii.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)},Ii.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}},Ii.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,n=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||n,height:e.height||t,bottom:e.bottom||n+(e.height||t),width:e.width||i}},Ai.StringDecoder=function(){return{decode:function(e){if(!e)return"";if("string"!=typeof e)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}},Ai.convertCueToDOMTree=function(e,t){return e&&t?wi(e,t):null};Ai.processCues=function(n,r,e){if(!n||!r||!e)return null;for(;e.firstChild;)e.removeChild(e.firstChild);var a=n.document.createElement("div");if(a.style.position="absolute",a.style.left="0",a.style.right="0",a.style.top="0",a.style.bottom="0",a.style.margin="1.5%",e.appendChild(a),function(e){for(var t=0;t<e.length;t++)if(e[t].hasBeenReset||!e[t].displayState)return 1}(r)){var s=[],o=Ii.getSimpleBoxPosition(a),u={font:Math.round(.05*o.height*100)/100+"px sans-serif"};!function(){for(var e,t,i=0;i<r.length;i++)t=r[i],e=new Ci(n,t,u),a.appendChild(e.div),xi(0,e,o,s),t.displayState=e.div,s.push(Ii.getSimpleBoxPosition(e))}()}else for(var t=0;t<r.length;t++)a.appendChild(r[t].displayState)},(Ai.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 hi))throw e;this.onparsingerror&&this.onparsingerror(e)},parse:function(e){var n=this;function t(){for(var e=n.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,n.buffer=e.substr(t),i}function i(e){e.match(/X-TIMESTAMP-MAP/)?mi(e,function(e,t){var i;"X-TIMESTAMP-MAP"===e&&(t=t,i=new fi,mi(t,function(e,t){switch(e){case"MPEGT":i.integer(e+"S",t);break;case"LOCA":i.set(e+"L",pi(t))}},/[^\d]:/,/,/),n.ontimestampmap&&n.ontimestampmap({MPEGTS:i.get("MPEGTS"),LOCAL:i.get("LOCAL")}))},/=/):mi(e,function(e,t){var r;"Region"===e&&(t=t,r=new fi,mi(t,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=t.split(",");if(2!==i.length)break;var n=new fi;if(n.percent("x",i[0]),n.percent("y",i[1]),!n.has("x")||!n.has("y"))break;r.set(e+"X",n.get("x")),r.set(e+"Y",n.get("y"));break;case"scroll":r.alt(e,t,["up"])}},/=/,/\s/),r.has("id")&&((t=new(n.vttjs.VTTRegion||n.window.VTTRegion)).width=r.get("width",100),t.lines=r.get("lines",3),t.regionAnchorX=r.get("regionanchorX",0),t.regionAnchorY=r.get("regionanchorY",100),t.viewportAnchorX=r.get("viewportanchorX",0),t.viewportAnchorY=r.get("viewportanchorY",100),t.scroll=r.get("scroll",""),n.onregion&&n.onregion(t),n.regionList.push({id:r.get("id"),region:t})))},/:/)}e&&(n.buffer+=n.decoder.decode(e,{stream:!0}));try{if("INITIAL"===n.state){if(!/\r\n|\n/.test(n.buffer))return this;var r,a=(r=t()).match(/^WEBVTT([ \t].*)?$/);if(!a||!a[0])throw new hi(hi.Errors.BadSignature);n.state="HEADER"}for(var s=!1;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(s?s=!1:r=t(),n.state){case"HEADER":/:/.test(r)?i(r):r||(n.state="ID");continue;case"NOTE":r||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(r)){n.state="NOTE";break}if(!r)continue;n.cue=new(n.vttjs.VTTCue||n.window.VTTCue)(0,0,"");try{n.cue.align="center"}catch(e){n.cue.align="middle"}if(n.state="CUE",-1===r.indexOf("--\x3e")){n.cue.id=r;continue}case"CUE":try{gi(r,n.cue,n.regionList)}catch(e){n.reportOrThrowError(e),n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":var o=-1!==r.indexOf("--\x3e");if(!r||o&&(s=!0)){n.oncue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}n.cue.text&&(n.cue.text+="\n"),n.cue.text+=r.replace(/\u2028/g,"\n").replace(/u2029/g,"\n");continue;case"BADCUE":r||(n.state="ID");continue}}}catch(e){n.reportOrThrowError(e),"CUETEXT"===n.state&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state="INITIAL"===n.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 hi(hi.Errors.BadSignature)}catch(e){t.reportOrThrowError(e)}return t.onflush&&t.onflush(),this}};var Pi=Ai,Li={"":1,lr:1,rl:1},Oi={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Di(e){return"string"==typeof e&&(!!Oi[e.toLowerCase()]&&e.toLowerCase())}function Ri(e,t,i){this.hasBeenReset=!1;var n="",r=!1,a=e,s=t,o=i,u=null,l="",d=!0,c="auto",h="start",p="auto",f="auto",m=100,g="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(e){n=""+e}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(e){r=!!e}},startTime:{enumerable:!0,get:function(){return a},set:function(e){if("number"!=typeof e)throw new TypeError("Start time must be set to a number.");a=e,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return s},set:function(e){if("number"!=typeof e)throw new TypeError("End time must be set to a number.");s=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 u},set:function(e){u=e,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return l},set:function(e){e="string"==typeof(e=e)&&(!!Li[e.toLowerCase()]&&e.toLowerCase());if(!1===e)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");l=e,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return d},set:function(e){d=!!e,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e&&"auto"!==e)throw new SyntaxError("Line: an invalid number or illegal string was specified.");c=e,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return h},set:function(e){e=Di(e);e&&(h=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 f},set:function(e){e=Di(e);e&&(f=e,this.hasBeenReset=!0)}},size:{enumerable:!0,get:function(){return m},set:function(e){if(e<0||100<e)throw new Error("Size must be between 0 and 100.");m=e,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return g},set:function(e){e=Di(e);if(!e)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");g=e,this.hasBeenReset=!0}}}),this.displayState=void 0}Ri.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var Mi=Ri,Ni={"":!0,up:!0};function Ui(e){return"number"==typeof e&&0<=e&&e<=100}function Bi(){var t=100,i=3,n=0,r=100,a=0,s=100,o="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return t},set:function(e){if(!Ui(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(!Ui(e))throw new Error("RegionAnchorX must be between 0 and 100.");r=e}},regionAnchorX:{enumerable:!0,get:function(){return n},set:function(e){if(!Ui(e))throw new Error("RegionAnchorY must be between 0 and 100.");n=e}},viewportAnchorY:{enumerable:!0,get:function(){return s},set:function(e){if(!Ui(e))throw new Error("ViewportAnchorY must be between 0 and 100.");s=e}},viewportAnchorX:{enumerable:!0,get:function(){return a},set:function(e){if(!Ui(e))throw new Error("ViewportAnchorX must be between 0 and 100.");a=e}},scroll:{enumerable:!0,get:function(){return o},set:function(e){e="string"==typeof(e=e)&&(!!Ni[e.toLowerCase()]&&e.toLowerCase());!1===e||(o=e)}}})}var Fi=m(function(e){e=e.exports={WebVTT:Pi,VTTCue:Mi,VTTRegion:Bi};Kt.vttjs=e,Kt.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,n=Kt.VTTCue,r=Kt.VTTRegion;e.shim=function(){Kt.VTTCue=t,Kt.VTTRegion=i},e.restore=function(){Kt.VTTCue=n,Kt.VTTRegion=r},Kt.VTTCue||e.shim()});Fi.WebVTT,Fi.VTTCue,Fi.VTTRegion;var ji=function(n){function i(t,e){var i;return void 0===e&&(e=function(){}),(t=void 0===t?{}:t).reportTouchActivity=!1,(i=n.call(this,null,t,e)||this).onDurationChange_=function(e){return i.onDurationChange(e)},i.trackProgress_=function(e){return i.trackProgress(e)},i.trackCurrentTime_=function(e){return i.trackCurrentTime(e)},i.stopTrackingCurrentTime_=function(e){return i.stopTrackingCurrentTime(e)},i.disposeSourceHandler_=function(e){return i.disposeSourceHandler(e)},i.queuedHanders_=new Set,i.hasStarted_=!1,i.on("playing",function(){this.hasStarted_=!0}),i.on("loadstart",function(){this.hasStarted_=!1}),oi.names.forEach(function(e){e=oi[e];t&&t[e.getterName]&&(i[e.privateName]=t[e.getterName])}),i.featuresProgressEvents||i.manualProgressOn(),i.featuresTimeupdateEvents||i.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(function(e){!1===t["native"+e+"Tracks"]&&(i["featuresNative"+e+"Tracks"]=!1)}),!1===t.nativeCaptions||!1===t.nativeTextTracks?i.featuresNativeTextTracks=!1:!0!==t.nativeCaptions&&!0!==t.nativeTextTracks||(i.featuresNativeTextTracks=!0),i.featuresNativeTextTracks||i.emulateTextTracks(),i.preloadTextTracks=!1!==t.preloadTextTracks,i.autoRemoteTextTracks_=new oi.text.ListClass,i.initTrackListeners(),t.nativeControlsForTouch||i.emitTapEvents(),i.constructor&&(i.name_=i.constructor.name||"Unknown Tech"),i}mt(i,n);var e=i.prototype;return e.triggerSourceset=function(e){var t=this;this.isReady_||this.one("ready",function(){return t.setTimeout(function(){return t.triggerSourceset(e)},1)}),this.trigger({src:e,type:"sourceset"})},e.manualProgressOn=function(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)},e.manualProgressOff=function(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)},e.trackProgress=function(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(qe(this,function(){var e=this.bufferedPercent();this.bufferedPercent_!==e&&this.trigger("progress"),1===(this.bufferedPercent_=e)&&this.stopTrackingProgress()}),500)},e.onDurationChange=function(e){this.duration_=this.duration()},e.buffered=function(){return vt(0,0)},e.bufferedPercent=function(){return _t(this.buffered(),this.duration_)},e.stopTrackingProgress=function(){this.clearInterval(this.progressInterval)},e.manualTimeUpdatesOn=function(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)},e.manualTimeUpdatesOff=function(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)},e.trackCurrentTime=function(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)},e.stopTrackingCurrentTime=function(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.dispose=function(){this.clearTracks(ai.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),n.prototype.dispose.call(this)},e.clearTracks=function(e){var r=this;(e=[].concat(e)).forEach(function(e){for(var t=r[e+"Tracks"]()||[],i=t.length;i--;){var n=t[i];"text"===e&&r.removeRemoteTextTrack(n),t.removeTrack(n)}})},e.cleanupAutoTextTracks=function(){for(var e=this.autoRemoteTextTracks_||[],t=e.length;t--;){var i=e[t];this.removeRemoteTextTrack(i)}},e.reset=function(){},e.crossOrigin=function(){},e.setCrossOrigin=function(){},e.error=function(e){return void 0!==e&&(this.error_=new bt(e),this.trigger("error")),this.error_},e.played=function(){return this.hasStarted_?vt(0,0):vt()},e.play=function(){},e.setScrubbing=function(){},e.scrubbing=function(){},e.setCurrentTime=function(){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},e.initTrackListeners=function(){var r=this;ai.names.forEach(function(e){function t(){r.trigger(e+"trackchange")}var i=ai[e],n=r[i.getterName]();n.addEventListener("removetrack",t),n.addEventListener("addtrack",t),r.on("dispose",function(){n.removeEventListener("removetrack",t),n.removeEventListener("addtrack",t)})})},e.addWebVttScript_=function(){var e,t=this;window.WebVTT||(document.body.contains(this.el())?!this.options_["vtt.js"]&&w(Fi)&&0<Object.keys(Fi).length?this.trigger("vttjsloaded"):((e=document.createElement("script")).src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=function(){t.trigger("vttjsloaded")},e.onerror=function(){t.trigger("vttjserror")},this.on("dispose",function(){e.onload=null,e.onerror=null}),window.WebVTT=!0,this.el().parentNode.appendChild(e)):this.ready(this.addWebVttScript_))},e.emulateTextTracks=function(){function t(e){return n.addTrack(e.track)}function i(e){return n.removeTrack(e.track)}var e=this,n=this.textTracks(),r=this.remoteTextTracks();r.on("addtrack",t),r.on("removetrack",i),this.addWebVttScript_();function a(){return e.trigger("texttrackchange")}function s(){a();for(var e=0;e<n.length;e++){var t=n[e];t.removeEventListener("cuechange",a),"showing"===t.mode&&t.addEventListener("cuechange",a)}}s(),n.addEventListener("change",s),n.addEventListener("addtrack",s),n.addEventListener("removetrack",s),this.on("dispose",function(){r.off("addtrack",t),r.off("removetrack",i),n.removeEventListener("change",s),n.removeEventListener("addtrack",s),n.removeEventListener("removetrack",s);for(var e=0;e<n.length;e++)n[e].removeEventListener("cuechange",a)})},e.addTextTrack=function(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return function(e,t,i,n,r){void 0===r&&(r={});var a=e.textTracks();return r.kind=t,i&&(r.label=i),n&&(r.language=n),r.tech=e,r=new oi.text.TrackClass(r),a.addTrack(r),r}(this,e,t,i)},e.createRemoteTextTrack=function(e){e=lt(e,{tech:this});return new si.remoteTextEl.TrackClass(e)},e.addRemoteTextTrack=function(e,t){var i=this,n=this.createRemoteTextTrack(e=void 0===e?{}:e);return!0!==t&&!1!==t&&(h.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js'),t=!0),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),!0!==t&&this.ready(function(){return i.autoRemoteTextTracks_.addTrack(n.track)}),n},e.removeRemoteTextTrack=function(e){var t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)},e.getVideoPlaybackQuality=function(){return{}},e.requestPictureInPicture=function(){var e=this.options_.Promise||window.Promise;if(e)return e.reject()},e.disablePictureInPicture=function(){return!0},e.setDisablePictureInPicture=function(){},e.requestVideoFrameCallback=function(e){var t=this,i=Pe++;return!this.isReady_||this.paused()?(this.queuedHanders_.add(i),this.one("playing",function(){t.queuedHanders_.has(i)&&(t.queuedHanders_.delete(i),e())})):this.requestNamedAnimationFrame(i,e),i},e.cancelVideoFrameCallback=function(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)},e.setPoster=function(){},e.playsinline=function(){},e.setPlaysinline=function(){},e.overrideNativeAudioTracks=function(){},e.overrideNativeVideoTracks=function(){},e.canPlayType=function(){return""},i.canPlayType=function(){return""},i.canPlaySource=function(e,t){return i.canPlayType(e.type)},i.isTech=function(e){return e.prototype instanceof i||e instanceof i||e===i},i.registerTech=function(e,t){if(i.techs_||(i.techs_={}),!i.isTech(t))throw new Error("Tech "+e+" must be a Tech");if(!i.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!i.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=ut(e),i.techs_[e]=t,i.techs_[ot(e)]=t,"Tech"!==e&&i.defaultTechOrder_.push(e),t},i.getTech=function(e){if(e)return i.techs_&&i.techs_[e]?i.techs_[e]:(e=ut(e),window&&window.videojs&&window.videojs[e]?(h.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)},i}(pt);oi.names.forEach(function(e){var t=oi[e];ji.prototype[t.getterName]=function(){return this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName]}}),ji.prototype.featuresVolumeControl=!0,ji.prototype.featuresMuteControl=!0,ji.prototype.featuresFullscreenResize=!1,ji.prototype.featuresPlaybackRate=!1,ji.prototype.featuresProgressEvents=!1,ji.prototype.featuresSourceset=!1,ji.prototype.featuresTimeupdateEvents=!1,ji.prototype.featuresNativeTextTracks=!1,ji.prototype.featuresVideoFrameCallback=!1,ji.withSourceHandlers=function(r){r.registerSourceHandler=function(e,t){var i=(i=r.sourceHandlers)||(r.sourceHandlers=[]);void 0===t&&(t=i.length),i.splice(t,0,e)},r.canPlayType=function(e){for(var t,i=r.sourceHandlers||[],n=0;n<i.length;n++)if(t=i[n].canPlayType(e))return t;return""},r.selectSourceHandler=function(e,t){for(var i=r.sourceHandlers||[],n=0;n<i.length;n++)if(i[n].canHandleSource(e,t))return i[n];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){var 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){var t=r.selectSourceHandler(e,this.options_);t||(r.nativeSourceHandler?t=r.nativeSourceHandler:h.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)}},pt.registerComponent("Tech",ji),ji.registerTech("Tech",ji),ji.defaultTechOrder_=[];var Hi={},Vi={},qi={};function Wi(e,t,i){e.setTimeout(function(){return function i(n,e,r,a,s,o){void 0===n&&(n={});void 0===e&&(e=[]);void 0===s&&(s=[]);void 0===o&&(o=!1);var t=e,e=t[0],u=t.slice(1);if("string"==typeof e)i(n,Hi[e],r,a,s,o);else if(e){var l=Qi(a,e);if(!l.setSource)return s.push(l),i(n,u,r,a,s,o);l.setSource(b({},n),function(e,t){return e?i(n,u,r,a,s,o):(s.push(l),void i(t,n.type===t.type?u:Hi[t.type],r,a,s,o))})}else u.length?i(n,u,r,a,s,o):o?r(n,s):i(n,Hi["*"],r,a,s,!0)}(t,Hi[t.type],i,e)},1)}function Gi(e,t,i,n){void 0===n&&(n=null);var r="call"+ut(i),r=e.reduce(Yi(r),n),n=r===qi,r=n?null:t[i](r);return function(e,t,i,n){for(var r=e.length-1;0<=r;r--){var a=e[r];a[t]&&a[t](n,i)}}(e,i,r,n),r}var zi={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Xi={setCurrentTime:1,setMuted:1,setVolume:1},Ki={play:1,pause:1};function Yi(i){return function(e,t){return e===qi?qi:t[i]?t[i](e):e}}function Qi(e,t){var i=Vi[e.id()],n=null;if(null==i)return n=t(e),Vi[e.id()]=[[t,n]],n;for(var r=0;r<i.length;r++){var a=i[r],s=a[0],a=a[1];s===t&&(n=a)}return null===n&&(n=t(e),i.push([t,n])),n}function $i(e){return e=Nt(e=void 0===e?"":e),Zi[e.toLowerCase()]||""}function Ji(e){var t;return e=Array.isArray(e)?(t=[],e.forEach(function(e){e=Ji(e),Array.isArray(e)?t=t.concat(e):T(e)&&t.push(e)}),t):"string"==typeof e&&e.trim()?[en({src:e})]:T(e)&&"string"==typeof e.src&&e.src&&e.src.trim()?[en(e)]:[]}var Zi={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"};function en(e){var t;return e.type||(t=$i(e.src))&&(e.type=t),e}I=function(u){function e(e,t,i){var n=lt({createEl:!1},t),i=u.call(this,e,n,i)||this;if(t.playerOptions.sources&&0!==t.playerOptions.sources.length)e.src(t.playerOptions.sources);else for(var r=0,a=t.playerOptions.techOrder;r<a.length;r++){var s=ut(a[r]),o=ji.getTech(s);if((o=!s?pt.getComponent(s):o)&&o.isSupported()){e.loadTech_(s);break}}return i}return mt(e,u),e}(pt);pt.registerComponent("MediaLoader",I);C=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.options_.controlText&&i.controlText(i.options_.controlText),i.handleMouseOver_=function(e){return i.handleMouseOver(e)},i.handleMouseOut_=function(e){return i.handleMouseOut(e)},i.handleClick_=function(e){return i.handleClick(e)},i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.emitTapEvents(),i.enable(),i}mt(e,n);var t=e.prototype;return t.createEl=function(e,t,i){void 0===e&&(e="div"),void 0===t&&(t={}),void 0===i&&(i={}),t=b({className:this.buildCSSClass(),tabIndex:0},t),"button"===e&&h.error("Creating a ClickableComponent with an HTML element of "+e+" is not supported; use a Button instead."),i=b({role:"button"},i),this.tabIndex_=t.tabIndex;i=$(e,t,i);return i.appendChild($("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i},t.dispose=function(){this.controlTextEl_=null,n.prototype.dispose.call(this)},t.createControlTextEl=function(e){return this.controlTextEl_=$("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_},t.controlText=function(e,t){if(void 0===t&&(t=this.el()),void 0===e)return this.controlText_||"Need Text";var i=this.localize(e);this.controlText_=e,J(this.controlTextEl_,i),this.nonIconControl||this.player_.options_.noUITitleAttributes||t.setAttribute("title",i)},t.buildCSSClass=function(){return"vjs-control vjs-button "+n.prototype.buildCSSClass.call(this)},t.enable=function(){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_))},t.disable=function(){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_)},t.handleLanguagechange=function(){this.controlText(this.controlText_)},t.handleClick=function(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)},t.handleKeyDown=function(e){ht.isEventKey(e,"Space")||ht.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):n.prototype.handleKeyDown.call(this,e)},e}(pt);pt.registerComponent("ClickableComponent",C),pt.registerComponent("PosterImage",function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.update(),i.update_=function(e){return i.update(e)},e.on("posterchange",i.update_),i}mt(e,n);var t=e.prototype;return t.dispose=function(){this.player().off("posterchange",this.update_),n.prototype.dispose.call(this)},t.createEl=function(){return $("div",{className:"vjs-poster",tabIndex:-1})},t.update=function(e){var t=this.player().poster();this.setSrc(t),t?this.show():this.hide()},t.setSrc=function(e){this.el_.style.backgroundImage=e?'url("'+e+'")':""},t.handleClick=function(e){var t;this.player_.controls()&&(t=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length,!this.player_.tech(!0)||(N||D)&&t||this.player_.tech(!0).focus(),this.player_.paused()?Et(this.player_.play()):this.player_.pause())},e}(C));var tn="#222",nn={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 rn(e,t){var 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 an(e,t,i){try{e.style[t]=i}catch(e){return}}pt.registerComponent("TextTrackDisplay",function(a){function e(i,e,t){function n(e){return r.updateDisplay(e)}var r=a.call(this,i,e,t)||this;return i.on("loadstart",function(e){return r.toggleDisplay(e)}),i.on("texttrackchange",n),i.on("loadedmetadata",function(e){return r.preselectTrack(e)}),i.ready(qe(ft(r),function(){if(i.tech_&&i.tech_.featuresNativeTextTracks)this.hide();else{i.on("fullscreenchange",n),i.on("playerresize",n),window.addEventListener("orientationchange",n),i.on("dispose",function(){return window.removeEventListener("orientationchange",n)});for(var e=this.options_.playerOptions.tracks||[],t=0;t<e.length;t++)this.player_.addRemoteTextTrack(e[t],!0);this.preselectTrack()}})),r}mt(e,a);var t=e.prototype;return t.preselectTrack=function(){for(var e,t,i,n={captions:1,subtitles:1},r=this.player_.textTracks(),a=this.player_.cache_.selectedLanguage,s=0;s<r.length;s++){var o=r[s];a&&a.enabled&&a.language&&a.language===o.language&&o.kind in n?i=o.kind!==a.kind&&i||o:a&&!a.enabled?t=e=i=null:o.default&&("descriptions"!==o.kind||e?o.kind in n&&!t&&(t=o):e=o)}i?i.mode="showing":t?t.mode="showing":e&&(e.mode="showing")},t.toggleDisplay=function(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()},t.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})},t.clearDisplay=function(){"function"==typeof window.WebVTT&&window.WebVTT.processCues(window,[],this.el_)},t.updateDisplay=function(){var e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){for(var i=[],n=0;n<e.length;++n){var r=e[n];"showing"===r.mode&&i.push(r)}this.updateForTrack(i)}else{for(var a=null,s=null,o=e.length;o--;){var u=e[o];"showing"===u.mode&&("descriptions"===u.kind?a=u:s=u)}s?("off"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):a&&("assertive"!==this.getAttribute("aria-live")&&this.setAttribute("aria-live","assertive"),this.updateForTrack(a))}},t.updateDisplayState=function(e){for(var t=this.player_.textTrackSettings.getValues(),i=e.activeCues,n=i.length;n--;){var r,a=i[n];a&&(r=a.displayState,t.color&&(r.firstChild.style.color=t.color),t.textOpacity&&an(r.firstChild,"color",rn(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(r.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&an(r.firstChild,"backgroundColor",rn(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?an(r,"backgroundColor",rn(t.windowColor,t.windowOpacity)):r.style.backgroundColor=t.windowColor),t.edgeStyle&&("dropshadow"===t.edgeStyle?r.firstChild.style.textShadow="2px 2px 3px #222, 2px 2px 4px #222, 2px 2px 5px "+tn:"raised"===t.edgeStyle?r.firstChild.style.textShadow="1px 1px #222, 2px 2px #222, 3px 3px "+tn:"depressed"===t.edgeStyle?r.firstChild.style.textShadow="1px 1px #ccc, 0 1px #ccc, -1px -1px #222, 0 -1px "+tn:"uniform"===t.edgeStyle&&(r.firstChild.style.textShadow="0 0 4px #222, 0 0 4px #222, 0 0 4px #222, 0 0 4px "+tn)),t.fontPercent&&1!==t.fontPercent&&(a=window.parseFloat(r.style.fontSize),r.style.fontSize=a*t.fontPercent+"px",r.style.height="auto",r.style.top="auto"),t.fontFamily&&"default"!==t.fontFamily&&("small-caps"===t.fontFamily?r.firstChild.style.fontVariant="small-caps":r.firstChild.style.fontFamily=nn[t.fontFamily]))}},t.updateForTrack=function(e){if(Array.isArray(e)||(e=[e]),"function"==typeof window.WebVTT&&!e.every(function(e){return!e.activeCues})){for(var t=[],i=0;i<e.length;++i)for(var n=e[i],r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r]);window.WebVTT.processCues(window,t,this.el_);for(var a=0;a<e.length;++a){for(var s=e[a],o=0;o<s.activeCues.length;++o){var u=s.activeCues[o].displayState;te(u,"vjs-text-track-cue"),te(u,"vjs-text-track-cue-"+(s.language||a)),s.language&&oe(u,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}},e}(pt)),pt.registerComponent("LoadingSpinner",function(i){function e(){return i.apply(this,arguments)||this}return mt(e,i),e.prototype.createEl=function(){var e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),e=$("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),t=i.prototype.createEl.call(this,"div",{className:"vjs-loading-spinner",dir:"ltr"});return t.appendChild(e),t},e}(pt));var sn=function(t){function e(){return t.apply(this,arguments)||this}mt(e,t);var i=e.prototype;return i.createEl=function(e,t,i){void 0===t&&(t={}),void 0===i&&(i={});i=$("button",t=b({className:this.buildCSSClass()},t),i=b({type:"button"},i));return i.appendChild($("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(i),i},i.addChild=function(e,t){void 0===t&&(t={});var i=this.constructor.name;return h.warn("Adding an actionable (user controllable) child to a Button ("+i+") is not supported; use a ClickableComponent instead."),pt.prototype.addChild.call(this,e,t)},i.enable=function(){t.prototype.enable.call(this),this.el_.removeAttribute("disabled")},i.disable=function(){t.prototype.disable.call(this),this.el_.setAttribute("disabled","disabled")},i.handleKeyDown=function(e){ht.isEventKey(e,"Space")||ht.isEventKey(e,"Enter")?e.stopPropagation():t.prototype.handleKeyDown.call(this,e)},e}(C);pt.registerComponent("Button",sn);Bt=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.mouseused_=!1,i.on("mousedown",function(e){return i.handleMouseDown(e)}),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-big-play-button"},t.handleClick=function(e){var t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){var i=this.player_.usingPlugin("eme")&&this.player_.eme.sessions&&0<this.player_.eme.sessions.length;return Et(t),void(!this.player_.tech(!0)||(N||D)&&i||this.player_.tech(!0).focus())}var i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");n?(i=function(){return n.focus()},St(t)?t.then(i,function(){}):this.setTimeout(i,1)):this.player_.tech(!0).focus()},t.handleKeyDown=function(e){this.mouseused_=!1,n.prototype.handleKeyDown.call(this,e)},t.handleMouseDown=function(e){this.mouseused_=!0},e}(sn);Bt.prototype.controlText_="Play Video",pt.registerComponent("BigPlayButton",Bt),pt.registerComponent("CloseButton",function(i){function e(e,t){e=i.call(this,e,t)||this;return e.controlText(t&&t.controlText||e.localize("Close")),e}mt(e,i);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-close-button "+i.prototype.buildCSSClass.call(this)},t.handleClick=function(e){this.trigger({type:"close",bubbles:!1})},t.handleKeyDown=function(e){ht.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):i.prototype.handleKeyDown.call(this,e)},e}(sn));Ft=function(n){function e(e,t){var i=n.call(this,e,t=void 0===t?{}:t)||this;return t.replay=void 0===t.replay||t.replay,i.on(e,"play",function(e){return i.handlePlay(e)}),i.on(e,"pause",function(e){return i.handlePause(e)}),t.replay&&i.on(e,"ended",function(e){return i.handleEnded(e)}),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-play-control "+n.prototype.buildCSSClass.call(this)},t.handleClick=function(e){this.player_.paused()?Et(this.player_.play()):this.player_.pause()},t.handleSeeked=function(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)},t.handlePlay=function(e){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.controlText("Pause")},t.handlePause=function(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.controlText("Play")},t.handleEnded=function(e){var t=this;this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.controlText("Replay"),this.one(this.player_,"seeked",function(e){return t.handleSeeked(e)})},e}(sn);Ft.prototype.controlText_="Play",pt.registerComponent("PlayToggle",Ft);function on(e,t){e=e<0?0:e;var i=Math.floor(e%60),n=Math.floor(e/60%60),r=Math.floor(e/3600),a=Math.floor(t/60%60),t=Math.floor(t/3600);return(r=0<(r=isNaN(e)||e===1/0?n=i="-":r)||0<t?r+":":"")+(n=((r||10<=a)&&n<10?"0"+n:n)+":")+(i=i<10?"0"+i:i)}var un=on;function ln(e,t){return un(e,t=void 0===t?e:t)}k=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.on(e,["timeupdate","ended"],function(e){return i.updateContent(e)}),i.updateTextNode_(),i}mt(e,n);var t=e.prototype;return t.createEl=function(){var e=this.buildCSSClass(),t=n.prototype.createEl.call(this,"div",{className:e+" vjs-time-control vjs-control"}),i=$("span",{className:"vjs-control-text",textContent:this.localize(this.labelText_)+" "},{role:"presentation"});return t.appendChild(i),this.contentEl_=$("span",{className:e+"-display"},{"aria-live":"off",role:"presentation"}),t.appendChild(this.contentEl_),t},t.dispose=function(){this.contentEl_=null,this.textNode_=null,n.prototype.dispose.call(this)},t.updateTextNode_=function(e){var t=this;e=ln(e=void 0===e?0:e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",function(){var e;t.contentEl_&&((e=t.textNode_)&&t.contentEl_.firstChild!==e&&(e=null,h.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),t.textNode_=document.createTextNode(t.formattedTime_),t.textNode_&&(e?t.contentEl_.replaceChild(t.textNode_,e):t.contentEl_.appendChild(t.textNode_)))}))},t.updateContent=function(e){},e}(pt);k.prototype.labelText_="Time",k.prototype.controlText_="Time",pt.registerComponent("TimeDisplay",k);jt=function(e){function t(){return e.apply(this,arguments)||this}mt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-current-time"},i.updateContent=function(e){var t=this.player_.ended()?this.player_.duration():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();this.updateTextNode_(t)},t}(k);jt.prototype.labelText_="Current Time",jt.prototype.controlText_="Current Time",pt.registerComponent("CurrentTimeDisplay",jt);j=function(n){function e(e,t){var i=n.call(this,e,t)||this,t=function(e){return i.updateContent(e)};return i.on(e,"durationchange",t),i.on(e,"loadstart",t),i.on(e,"loadedmetadata",t),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-duration"},t.updateContent=function(e){var t=this.player_.duration();this.updateTextNode_(t)},e}(k);j.prototype.labelText_="Duration",j.prototype.controlText_="Duration",pt.registerComponent("DurationDisplay",j),pt.registerComponent("TimeDivider",function(n){function e(){return n.apply(this,arguments)||this}return mt(e,n),e.prototype.createEl=function(){var e=n.prototype.createEl.call(this,"div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=n.prototype.createEl.call(this,"div"),i=n.prototype.createEl.call(this,"span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e},e}(pt));f=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.on(e,"durationchange",function(e){return i.updateContent(e)}),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-remaining-time"},t.createEl=function(){var e=n.prototype.createEl.call(this);return!1!==this.options_.displayNegative&&e.insertBefore($("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e},t.updateContent=function(e){var t;"number"==typeof this.player_.duration()&&(t=this.player_.ended()?0:this.player_.remainingTimeDisplay?this.player_.remainingTimeDisplay():this.player_.remainingTime(),this.updateTextNode_(t))},e}(k);f.prototype.labelText_="Remaining Time",f.prototype.controlText_="Remaining Time",pt.registerComponent("RemainingTimeDisplay",f),pt.registerComponent("LiveDisplay",function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.updateShowing(),i.on(i.player(),"durationchange",function(e){return i.updateShowing(e)}),i}mt(e,n);var t=e.prototype;return t.createEl=function(){var e=n.prototype.createEl.call(this,"div",{className:"vjs-live-control vjs-control"});return this.contentEl_=$("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild($("span",{className:"vjs-control-text",textContent:this.localize("Stream Type")+" "})),this.contentEl_.appendChild(document.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e},t.dispose=function(){this.contentEl_=null,n.prototype.dispose.call(this)},t.updateShowing=function(e){this.player().duration()===1/0?this.show():this.hide()},e}(pt));ui=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.updateLiveEdgeStatus(),i.player_.liveTracker&&(i.updateLiveEdgeStatusHandler_=function(e){return i.updateLiveEdgeStatus(e)},i.on(i.player_.liveTracker,"liveedgechange",i.updateLiveEdgeStatusHandler_)),i}mt(e,n);var t=e.prototype;return t.createEl=function(){var e=n.prototype.createEl.call(this,"button",{className:"vjs-seek-to-live-control vjs-control"});return this.textEl_=$("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e},t.updateLiveEdgeStatus=function(){!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"))},t.handleClick=function(){this.player_.liveTracker.seekToLiveEdge()},t.dispose=function(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,n.prototype.dispose.call(this)},e}(sn);ui.prototype.controlText_="Seek to live, currently playing live",pt.registerComponent("SeekToLive",ui);function dn(e,t,i){return e=Number(e),Math.min(i,Math.max(t,isNaN(e)?t:e))}li=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.handleMouseDown_=function(e){return i.handleMouseDown(e)},i.handleMouseUp_=function(e){return i.handleMouseUp(e)},i.handleKeyDown_=function(e){return i.handleKeyDown(e)},i.handleClick_=function(e){return i.handleClick(e)},i.handleMouseMove_=function(e){return i.handleMouseMove(e)},i.update_=function(e){return i.update(e)},i.bar=i.getChild(i.options_.barName),i.vertical(!!i.options_.vertical),i.enable(),i}mt(e,n);var t=e.prototype;return t.enabled=function(){return this.enabled_},t.enable=function(){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)},t.disable=function(){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)},t.createEl=function(e,t,i){return void 0===i&&(i={}),(t=void 0===t?{}:t).className=t.className+" vjs-slider",t=b({tabIndex:0},t),i=b({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100,tabIndex:0},i),n.prototype.createEl.call(this,e,t,i)},t.handleMouseDown=function(e){var t=this.bar.el_.ownerDocument;"mousedown"===e.type&&e.preventDefault(),"touchstart"!==e.type||R||e.preventDefault(),le(),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)},t.handleMouseMove=function(e){},t.handleMouseUp=function(){var e=this.bar.el_.ownerDocument;de(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),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.update()},t.update=function(){var t=this;if(this.el_&&this.bar){var i=this.getProgress();return i===this.progress_?i:(this.progress_=i,this.requestNamedAnimationFrame("Slider#update",function(){var e=t.vertical()?"height":"width";t.bar.el().style[e]=(100*i).toFixed(2)+"%"}),i)}},t.getProgress=function(){return Number(dn(this.getPercent(),0,1).toFixed(4))},t.calculateDistance=function(e){e=pe(this.el_,e);return this.vertical()?e.y:e.x},t.handleKeyDown=function(e){ht.isEventKey(e,"Left")||ht.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):ht.isEventKey(e,"Right")||ht.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):n.prototype.handleKeyDown.call(this,e)},t.handleClick=function(e){e.stopPropagation(),e.preventDefault()},t.vertical=function(e){if(void 0===e)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")},e}(pt);pt.registerComponent("Slider",li);function cn(e,t){return dn(e/t*100,0,100).toFixed(2)+"%"}pt.registerComponent("LoadProgressBar",function(r){function e(e,t){var i=r.call(this,e,t)||this;return i.partEls_=[],i.on(e,"progress",function(e){return i.update(e)}),i}mt(e,r);var t=e.prototype;return t.createEl=function(){var e=r.prototype.createEl.call(this,"div",{className:"vjs-load-progress"}),t=$("span",{className:"vjs-control-text"}),i=$("span",{textContent:this.localize("Loaded")}),n=document.createTextNode(": ");return this.percentageEl_=$("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(n),t.appendChild(this.percentageEl_),e},t.dispose=function(){this.partEls_=null,this.percentageEl_=null,r.prototype.dispose.call(this)},t.update=function(e){var l=this;this.requestNamedAnimationFrame("LoadProgressBar#update",function(){var e=l.player_.liveTracker,t=l.player_.buffered(),e=e&&e.isLive()?e.seekableEnd():l.player_.duration(),i=l.player_.bufferedEnd(),n=l.partEls_,e=cn(i,e);l.percent_!==e&&(l.el_.style.width=e,J(l.percentageEl_,e),l.percent_=e);for(var r=0;r<t.length;r++){var a=t.start(r),s=t.end(r),o=n[r];o||(o=l.el_.appendChild($()),n[r]=o),o.dataset.start===a&&o.dataset.end===s||(o.dataset.start=a,o.dataset.end=s,o.style.left=cn(a,i),o.style.width=cn(s-a,i))}for(var u=n.length;u>t.length;u--)l.el_.removeChild(n[u-1]);n.length=t.length})},e}(pt)),pt.registerComponent("TimeTooltip",function(i){function e(e,t){t=i.call(this,e,t)||this;return t.update=We(qe(ft(t),t.update),30),t}mt(e,i);var t=e.prototype;return t.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})},t.update=function(e,t,i){var n=he(this.el_),r=ce(this.player_.el()),a=e.width*t;r&&n&&(t=e.left-r.left+a,r=e.width-a+(r.right-e.right),t<(e=n.width/2)?e+=e-t:r<e&&(e=r),e<0?e=0:e>n.width&&(e=n.width),e=Math.round(e),this.el_.style.right="-"+e+"px",this.write(i))},t.write=function(e){J(this.el_,e)},t.updateTime=function(n,r,a,s){var o=this;this.requestNamedAnimationFrame("TimeTooltip#updateTime",function(){var e,t,i=o.player_.duration();i=o.player_.liveTracker&&o.player_.liveTracker.isLive()?((t=(e=o.player_.liveTracker.liveWindow())-r*e)<1?"":"-")+ln(t,e):ln(a,i),o.update(n,r,i),s&&s()})},e}(pt));Xt=function(i){function e(e,t){t=i.call(this,e,t)||this;return t.update=We(qe(ft(t),t.update),30),t}mt(e,i);var t=e.prototype;return t.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})},t.update=function(e,t){var i,n=this.getChild("timeTooltip");n&&(i=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),n.updateTime(e,t,i))},e}(pt);Xt.prototype.options_={children:[]},V||A||Xt.prototype.options_.children.push("timeTooltip"),pt.registerComponent("PlayProgressBar",Xt);I=function(i){function e(e,t){t=i.call(this,e,t)||this;return t.update=We(qe(ft(t),t.update),30),t}mt(e,i);var t=e.prototype;return t.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},t.update=function(e,t){var i=this,n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,function(){i.el_.style.left=e.width*t+"px"})},e}(pt);I.prototype.options_={children:["timeTooltip"]},pt.registerComponent("MouseTimeDisplay",I);Bt=function(a){function e(e,t){t=a.call(this,e,t)||this;return t.setEventHandlers_(),t}mt(e,a);var t=e.prototype;return t.setEventHandlers_=function(){var t=this;this.update_=qe(this,this.update),this.update=We(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_=function(e){return t.enableInterval_(e)},this.disableIntervalHandler_=function(e){return t.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_)},t.toggleVisibility_=function(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())},t.enableInterval_=function(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,30))},t.disableInterval_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&"ended"!==e.type||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)},t.createEl=function(){return a.prototype.createEl.call(this,"div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})},t.update=function(e){var n=this;if("hidden"!==document.visibilityState){var r=a.prototype.update.call(this);return this.requestNamedAnimationFrame("SeekBar#update",function(){var e=n.player_.ended()?n.player_.duration():n.getCurrentTime_(),t=n.player_.liveTracker,i=n.player_.duration();t&&t.isLive()&&(i=n.player_.liveTracker.liveCurrentTime()),n.percent_!==r&&(n.el_.setAttribute("aria-valuenow",(100*r).toFixed(2)),n.percent_=r),n.currentTime_===e&&n.duration_===i||(n.el_.setAttribute("aria-valuetext",n.localize("progress bar timing: currentTime={1} duration={2}",[ln(e,i),ln(i,i)],"{1} of {2}")),n.currentTime_=e,n.duration_=i),n.bar&&n.bar.update(ce(n.el()),n.getProgress())}),r}},t.userSeek_=function(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)},t.getCurrentTime_=function(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()},t.getPercent=function(){var e,t=this.getCurrentTime_(),i=this.player_.liveTracker;return i&&i.isLive()?(e=(t-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(e=1)):e=t/this.player_.duration(),e},t.handleMouseDown=function(e){_e(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),a.prototype.handleMouseDown.call(this,e))},t.handleMouseMove=function(e,t){if(void 0===t&&(t=!1),_e(e)){t||this.player_.scrubbing()||this.player_.scrubbing(!0);var i=this.calculateDistance(e),n=this.player_.liveTracker;if(n&&n.isLive()){if(.99<=i)return void n.seekToLiveEdge();var r,t=n.seekableStart(),e=n.liveCurrentTime();if((r=(r=e<=(r=t+i*n.liveWindow())?e:r)<=t?t+.1:r)===1/0)return}else(r=i*this.player_.duration())===this.player_.duration()&&(r-=.1);this.userSeek_(r)}},t.enable=function(){a.prototype.enable.call(this);var e=this.getChild("mouseTimeDisplay");e&&e.show()},t.disable=function(){a.prototype.disable.call(this);var e=this.getChild("mouseTimeDisplay");e&&e.hide()},t.handleMouseUp=function(e){a.prototype.handleMouseUp.call(this,e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Et(this.player_.play()):this.update_()},t.stepForward=function(){this.userSeek_(this.player_.currentTime()+5)},t.stepBack=function(){this.userSeek_(this.player_.currentTime()-5)},t.handleAction=function(e){this.player_.paused()?this.player_.play():this.player_.pause()},t.handleKeyDown=function(e){var t,i=this.player_.liveTracker;ht.isEventKey(e,"Space")||ht.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.handleAction(e)):ht.isEventKey(e,"Home")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(0)):ht.isEventKey(e,"End")?(e.preventDefault(),e.stopPropagation(),i&&i.isLive()?this.userSeek_(i.liveCurrentTime()):this.userSeek_(this.player_.duration())):/^[0-9]$/.test(ht(e))?(e.preventDefault(),e.stopPropagation(),t=10*(ht.codes[ht(e)]-ht.codes[0])/100,i&&i.isLive()?this.userSeek_(i.seekableStart()+i.liveWindow()*t):this.userSeek_(this.player_.duration()*t)):ht.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-60)):ht.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+60)):a.prototype.handleKeyDown.call(this,e)},t.dispose=function(){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_),a.prototype.dispose.call(this)},e}(li);Bt.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"},V||A||Bt.prototype.options_.children.splice(1,0,"mouseTimeDisplay"),pt.registerComponent("SeekBar",Bt);Ft=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.handleMouseMove=We(qe(ft(i),i.handleMouseMove),30),i.throttledHandleMouseSeek=We(qe(ft(i),i.handleMouseSeek),30),i.handleMouseUpHandler_=function(e){return i.handleMouseUp(e)},i.handleMouseDownHandler_=function(e){return i.handleMouseDown(e)},i.enable(),i}mt(e,n);var t=e.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-progress-control vjs-control"})},t.handleMouseMove=function(e){var t,i,n,r,a=this.getChild("seekBar");a&&(t=a.getChild("playProgressBar"),i=a.getChild("mouseTimeDisplay"),(t||i)&&(r=he(n=a.el()),e=pe(n,e).x,e=dn(e,0,1),i&&i.update(r,e),t&&t.update(r,a.getProgress())))},t.handleMouseSeek=function(e){var t=this.getChild("seekBar");t&&t.handleMouseMove(e)},t.enabled=function(){return this.enabled_},t.disable=function(){var e;this.children().forEach(function(e){return 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&&Et(this.player_.play())))},t.enable=function(){this.children().forEach(function(e){return 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)},t.removeListenersAddedOnMousedownAndTouchstart=function(){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_)},t.handleMouseDown=function(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_)},t.handleMouseUp=function(e){var t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()},e}(pt);Ft.prototype.options_={children:["seekBar"]},pt.registerComponent("ProgressControl",Ft);jt=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.on(e,["enterpictureinpicture","leavepictureinpicture"],function(e){return i.handlePictureInPictureChange(e)}),i.on(e,["disablepictureinpicturechanged","loadedmetadata"],function(e){return i.handlePictureInPictureEnabledChange(e)}),i.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],function(){"audio"===e.currentType().substring(0,5)||e.audioPosterMode()||e.audioOnlyMode()?(e.isInPictureInPicture()&&e.exitPictureInPicture(),i.hide()):i.show()}),i.disable(),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-picture-in-picture-control "+n.prototype.buildCSSClass.call(this)},t.handlePictureInPictureEnabledChange=function(){document.pictureInPictureEnabled&&!1===this.player_.disablePictureInPicture()?this.enable():this.disable()},t.handlePictureInPictureChange=function(e){this.player_.isInPictureInPicture()?this.controlText("Exit Picture-in-Picture"):this.controlText("Picture-in-Picture"),this.handlePictureInPictureEnabledChange()},t.handleClick=function(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()},e}(sn);jt.prototype.controlText_="Picture-in-Picture",pt.registerComponent("PictureInPictureToggle",jt);j=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.on(e,"fullscreenchange",function(e){return i.handleFullscreenChange(e)}),!1===document[e.fsApi_.fullscreenEnabled]&&i.disable(),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-fullscreen-control "+n.prototype.buildCSSClass.call(this)},t.handleFullscreenChange=function(e){this.player_.isFullscreen()?this.controlText("Non-Fullscreen"):this.controlText("Fullscreen")},t.handleClick=function(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()},e}(sn);j.prototype.controlText_="Fullscreen",pt.registerComponent("FullscreenToggle",j);pt.registerComponent("VolumeLevel",function(t){function e(){return t.apply(this,arguments)||this}return mt(e,t),e.prototype.createEl=function(){var e=t.prototype.createEl.call(this,"div",{className:"vjs-volume-level"});return e.appendChild(t.prototype.createEl.call(this,"span",{className:"vjs-control-text"})),e},e}(pt)),pt.registerComponent("VolumeLevelTooltip",function(i){function e(e,t){t=i.call(this,e,t)||this;return t.update=We(qe(ft(t),t.update),30),t}mt(e,i);var t=e.prototype;return t.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})},t.update=function(e,t,i,n){if(!i){var r=ce(this.el_),a=ce(this.player_.el()),i=e.width*t;if(!a||!r)return;t=e.left-a.left+i,a=e.width-i+(a.right-e.right),e=r.width/2;t<e?e+=e-t:a<e&&(e=a),e<0?e=0:e>r.width&&(e=r.width),this.el_.style.right="-"+e+"px"}this.write(n+"%")},t.write=function(e){J(this.el_,e)},t.updateVolume=function(e,t,i,n,r){var a=this;this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",function(){a.update(e,t,i,n.toFixed(0)),r&&r()})},e}(pt));k=function(i){function e(e,t){t=i.call(this,e,t)||this;return t.update=We(qe(ft(t),t.update),30),t}mt(e,i);var t=e.prototype;return t.createEl=function(){return i.prototype.createEl.call(this,"div",{className:"vjs-mouse-display"})},t.update=function(e,t,i){var n=this,r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,function(){i?n.el_.style.bottom=e.height*t+"px":n.el_.style.left=e.width*t+"px"})},e}(pt);k.prototype.options_={children:["volumeLevelTooltip"]},pt.registerComponent("MouseVolumeLevelDisplay",k);f=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.on("slideractive",function(e){return i.updateLastVolume_(e)}),i.on(e,"volumechange",function(e){return i.updateARIAAttributes(e)}),e.ready(function(){return i.updateARIAAttributes()}),i}mt(e,n);var t=e.prototype;return t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})},t.handleMouseDown=function(e){_e(e)&&n.prototype.handleMouseDown.call(this,e)},t.handleMouseMove=function(e){var t,i,n,r=this.getChild("mouseVolumeLevelDisplay");r&&(t=ce(n=this.el()),i=this.vertical(),n=pe(n,e),n=i?n.y:n.x,n=dn(n,0,1),r.update(t,n,i)),_e(e)&&(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))},t.checkMuted=function(){this.player_.muted()&&this.player_.muted(!1)},t.getPercent=function(){return this.player_.muted()?0:this.player_.volume()},t.stepForward=function(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)},t.stepBack=function(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)},t.updateARIAAttributes=function(e){var t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")},t.volumeAsPercentage_=function(){return Math.round(100*this.player_.volume())},t.updateLastVolume_=function(){var e=this,t=this.player_.volume();this.one("sliderinactive",function(){0===e.player_.volume()&&e.player_.lastVolume_(t)})},e}(li);f.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"},V||A||f.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay"),f.prototype.playerEvent="volumechange",pt.registerComponent("VolumeBar",f);ui=function(a){function e(e,t){var i,n,r;return(t=void 0===t?{}:t).vertical=t.vertical||!1,"undefined"!=typeof t.volumeBar&&!w(t.volumeBar)||(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),i=a.call(this,e,t)||this,n=ft(i),(r=e).tech_&&!r.tech_.featuresVolumeControl&&n.addClass("vjs-hidden"),n.on(r,"loadstart",function(){r.tech_.featuresVolumeControl?n.removeClass("vjs-hidden"):n.addClass("vjs-hidden")}),i.throttledHandleMouseMove=We(qe(ft(i),i.handleMouseMove),30),i.handleMouseUpHandler_=function(e){return i.handleMouseUp(e)},i.on("mousedown",function(e){return i.handleMouseDown(e)}),i.on("touchstart",function(e){return i.handleMouseDown(e)}),i.on("mousemove",function(e){return i.handleMouseMove(e)}),i.on(i.volumeBar,["focus","slideractive"],function(){i.volumeBar.addClass("vjs-slider-active"),i.addClass("vjs-slider-active"),i.trigger("slideractive")}),i.on(i.volumeBar,["blur","sliderinactive"],function(){i.volumeBar.removeClass("vjs-slider-active"),i.removeClass("vjs-slider-active"),i.trigger("sliderinactive")}),i}mt(e,a);var t=e.prototype;return t.createEl=function(){var e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),a.prototype.createEl.call(this,"div",{className:"vjs-volume-control vjs-control "+e})},t.handleMouseDown=function(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_)},t.handleMouseUp=function(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_)},t.handleMouseMove=function(e){this.volumeBar.handleMouseMove(e)},e}(pt);ui.prototype.options_={children:["volumeBar"]},pt.registerComponent("VolumeControl",ui);Xt=function(a){function e(e,t){var i,n,r=a.call(this,e,t)||this;return i=ft(r),(n=e).tech_&&!n.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(n,"loadstart",function(){n.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")}),r.on(e,["loadstart","volumechange"],function(e){return r.update(e)}),r}mt(e,a);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-mute-control "+a.prototype.buildCSSClass.call(this)},t.handleClick=function(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())},t.update=function(e){this.updateIcon_(),this.updateControlText_()},t.updateIcon_=function(){var e=this.player_.volume(),t=3;V&&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);for(var i=0;i<4;i++)ie(this.el_,"vjs-vol-"+i);te(this.el_,"vjs-vol-"+t)},t.updateControlText_=function(){var e=this.player_.muted()||0===this.player_.volume()?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)},e}(sn);Xt.prototype.controlText_="Mute",pt.registerComponent("MuteToggle",Xt);I=function(n){function e(e,t){var i;return"undefined"!=typeof(t=void 0===t?{}:t).inline?t.inline=t.inline:t.inline=!0,"undefined"!=typeof t.volumeControl&&!w(t.volumeControl)||(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),(i=n.call(this,e,t)||this).handleKeyPressHandler_=function(e){return i.handleKeyPress(e)},i.on(e,["loadstart"],function(e){return i.volumePanelState_(e)}),i.on(i.muteToggle,"keyup",function(e){return i.handleKeyPress(e)}),i.on(i.volumeControl,"keyup",function(e){return i.handleVolumeControlKeyUp(e)}),i.on("keydown",function(e){return i.handleKeyPress(e)}),i.on("mouseover",function(e){return i.handleMouseOver(e)}),i.on("mouseout",function(e){return i.handleMouseOut(e)}),i.on(i.volumeControl,["slideractive"],i.sliderActive_),i.on(i.volumeControl,["sliderinactive"],i.sliderInactive_),i}mt(e,n);var t=e.prototype;return t.sliderActive_=function(){this.addClass("vjs-slider-active")},t.sliderInactive_=function(){this.removeClass("vjs-slider-active")},t.volumePanelState_=function(){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")},t.createEl=function(){var e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),n.prototype.createEl.call(this,"div",{className:"vjs-volume-panel vjs-control "+e})},t.dispose=function(){this.handleMouseOut(),n.prototype.dispose.call(this)},t.handleVolumeControlKeyUp=function(e){ht.isEventKey(e,"Esc")&&this.muteToggle.focus()},t.handleMouseOver=function(e){this.addClass("vjs-hover"),Be(document,"keyup",this.handleKeyPressHandler_)},t.handleMouseOut=function(e){this.removeClass("vjs-hover"),Fe(document,"keyup",this.handleKeyPressHandler_)},t.handleKeyPress=function(e){ht.isEventKey(e,"Esc")&&this.handleMouseOut()},e}(pt);I.prototype.options_={children:["muteToggle","volumeControl"]},pt.registerComponent("VolumePanel",I);var hn=function(n){function e(e,t){var i=n.call(this,e,t)||this;return t&&(i.menuButton_=t.menuButton),i.focusedChild_=-1,i.on("keydown",function(e){return i.handleKeyDown(e)}),i.boundHandleBlur_=function(e){return i.handleBlur(e)},i.boundHandleTapClick_=function(e){return i.handleTapClick(e)},i}mt(e,n);var t=e.prototype;return t.addEventListenerForItem=function(e){e instanceof pt&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))},t.removeEventListenerForItem=function(e){e instanceof pt&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))},t.removeChild=function(e){"string"==typeof e&&(e=this.getChild(e)),this.removeEventListenerForItem(e),n.prototype.removeChild.call(this,e)},t.addItem=function(e){e=this.addChild(e);e&&this.addEventListenerForItem(e)},t.createEl=function(){var e=this.options_.contentElType||"ul";this.contentEl_=$(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");e=n.prototype.createEl.call(this,"div",{append:this.contentEl_,className:"vjs-menu"});return e.appendChild(this.contentEl_),Be(e,"click",function(e){e.preventDefault(),e.stopImmediatePropagation()}),e},t.dispose=function(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,n.prototype.dispose.call(this)},t.handleBlur=function(e){var t=e.relatedTarget||document.activeElement;this.children().some(function(e){return e.el()===t})||(e=this.menuButton_)&&e.buttonPressed_&&t!==e.el().firstChild&&e.unpressButton()},t.handleTapClick=function(t){var e;this.menuButton_&&(this.menuButton_.unpressButton(),e=this.children(),!Array.isArray(e)||(e=e.filter(function(e){return e.el()===t.target})[0])&&"CaptionSettingsMenuItem"!==e.name()&&this.menuButton_.focus())},t.handleKeyDown=function(e){ht.isEventKey(e,"Left")||ht.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(ht.isEventKey(e,"Right")||ht.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())},t.stepForward=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_+1),this.focus(e)},t.stepBack=function(){var e=0;void 0!==this.focusedChild_&&(e=this.focusedChild_-1),this.focus(e)},t.focus=function(e){void 0===e&&(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())},e}(pt);pt.registerComponent("Menu",hn);Bt=function(n){function e(e,t){var i;(i=n.call(this,e,t=void 0===t?{}:t)||this).menuButton_=new sn(e,t),i.menuButton_.controlText(i.controlText_),i.menuButton_.el_.setAttribute("aria-haspopup","true");t=sn.prototype.buildCSSClass();i.menuButton_.el_.className=i.buildCSSClass()+" "+t,i.menuButton_.removeClass("vjs-control"),i.addChild(i.menuButton_),i.update(),i.enabled_=!0;t=function(e){return i.handleClick(e)};return i.handleMenuKeyUp_=function(e){return i.handleMenuKeyUp(e)},i.on(i.menuButton_,"tap",t),i.on(i.menuButton_,"click",t),i.on(i.menuButton_,"keydown",function(e){return i.handleKeyDown(e)}),i.on(i.menuButton_,"mouseenter",function(){i.addClass("vjs-hover"),i.menu.show(),Be(document,"keyup",i.handleMenuKeyUp_)}),i.on("mouseleave",function(e){return i.handleMouseLeave(e)}),i.on("keydown",function(e){return i.handleSubmenuKeyDown(e)}),i}mt(e,n);var t=e.prototype;return t.update=function(){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"))},t.createMenu=function(){var e,t=new hn(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title&&(e=$("li",{className:"vjs-menu-title",textContent:ut(this.options_.title),tabIndex:-1}),e=new pt(this.player_,{el:e}),t.addItem(e)),this.items=this.createItems(),this.items)for(var i=0;i<this.items.length;i++)t.addItem(this.items[i]);return t},t.createItems=function(){},t.createEl=function(){return n.prototype.createEl.call(this,"div",{className:this.buildWrapperCSSClass()},{})},t.buildWrapperCSSClass=function(){var e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup","vjs-menu-button "+e+" "+sn.prototype.buildCSSClass()+" "+n.prototype.buildCSSClass.call(this)},t.buildCSSClass=function(){var e="vjs-menu-button";return!0===this.options_.inline?e+="-inline":e+="-popup","vjs-menu-button "+e+" "+n.prototype.buildCSSClass.call(this)},t.controlText=function(e,t){return void 0===t&&(t=this.menuButton_.el()),this.menuButton_.controlText(e,t)},t.dispose=function(){this.handleMouseLeave(),n.prototype.dispose.call(this)},t.handleClick=function(e){this.buttonPressed_?this.unpressButton():this.pressButton()},t.handleMouseLeave=function(e){this.removeClass("vjs-hover"),Fe(document,"keyup",this.handleMenuKeyUp_)},t.focus=function(){this.menuButton_.focus()},t.blur=function(){this.menuButton_.blur()},t.handleKeyDown=function(e){ht.isEventKey(e,"Esc")||ht.isEventKey(e,"Tab")?(this.buttonPressed_&&this.unpressButton(),ht.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus())):(ht.isEventKey(e,"Up")||ht.isEventKey(e,"Down"))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))},t.handleMenuKeyUp=function(e){(ht.isEventKey(e,"Esc")||ht.isEventKey(e,"Tab"))&&this.removeClass("vjs-hover")},t.handleSubmenuKeyPress=function(e){this.handleSubmenuKeyDown(e)},t.handleSubmenuKeyDown=function(e){(ht.isEventKey(e,"Esc")||ht.isEventKey(e,"Tab"))&&(this.buttonPressed_&&this.unpressButton(),ht.isEventKey(e,"Tab")||(e.preventDefault(),this.menuButton_.focus()))},t.pressButton=function(){this.enabled_&&(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),V&&Y()||this.menu.focus())},t.unpressButton=function(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))},t.disable=function(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()},t.enable=function(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()},e}(pt);pt.registerComponent("MenuButton",Bt);Ft=function(r){function e(e,t){var i=t.tracks,t=r.call(this,e,t)||this;if(t.items.length<=1&&t.hide(),!i)return ft(t);var n=qe(ft(t),t.update);return i.addEventListener("removetrack",n),i.addEventListener("addtrack",n),i.addEventListener("labelchange",n),t.player_.on("ready",n),t.player_.on("dispose",function(){i.removeEventListener("removetrack",n),i.removeEventListener("addtrack",n),i.removeEventListener("labelchange",n)}),t}return mt(e,r),e}(Bt);pt.registerComponent("TrackButton",Ft);var pn=["Tab","Esc","Up","Down","Right","Left"],jt=function(n){function e(e,t){e=n.call(this,e,t)||this;return e.selectable=t.selectable,e.isSelected_=t.selected||!1,e.multiSelectable=t.multiSelectable,e.selected(e.isSelected_),e.selectable?e.multiSelectable?e.el_.setAttribute("role","menuitemcheckbox"):e.el_.setAttribute("role","menuitemradio"):e.el_.setAttribute("role","menuitem"),e}mt(e,n);var t=e.prototype;return t.createEl=function(e,t,i){this.nonIconControl=!0;i=n.prototype.createEl.call(this,"li",b({className:"vjs-menu-item",tabIndex:-1},t),i);return i.replaceChild($("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)}),i.querySelector(".vjs-icon-placeholder")),i},t.handleKeyDown=function(t){pn.some(function(e){return ht.isEventKey(t,e)})||n.prototype.handleKeyDown.call(this,t)},t.handleClick=function(e){this.selected(!0)},t.selected=function(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))},e}(C);pt.registerComponent("MenuItem",jt);var fn=function(u){function e(e,t){var n,i=t.track,r=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected="showing"===i.mode,(n=u.call(this,e,t)||this).track=i,n.kinds=(t.kinds||[t.kind||n.track.kind]).filter(Boolean);function a(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(ft(n),t)}function s(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleSelectedLanguageChange.apply(ft(n),t)}var o;return e.on(["loadstart","texttrackchange"],a),r.addEventListener("change",a),r.addEventListener("selectedlanguagechange",s),n.on("dispose",function(){e.off(["loadstart","texttrackchange"],a),r.removeEventListener("change",a),r.removeEventListener("selectedlanguagechange",s)}),void 0===r.onchange&&n.on(["tap","click"],function(){if("object"!=typeof window.Event)try{o=new window.Event("change")}catch(e){}o||(o=document.createEvent("Event")).initEvent("change",!0,!0),r.dispatchEvent(o)}),n.handleTracksChange(),n}mt(e,u);var t=e.prototype;return t.handleClick=function(e){var t=this.track,i=this.player_.textTracks();if(u.prototype.handleClick.call(this,e),i)for(var n=0;n<i.length;n++){var r=i[n];-1!==this.kinds.indexOf(r.kind)&&(r===t?"showing"!==r.mode&&(r.mode="showing"):"disabled"!==r.mode&&(r.mode="disabled"))}},t.handleTracksChange=function(e){var t="showing"===this.track.mode;t!==this.isSelected_&&this.selected(t)},t.handleSelectedLanguageChange=function(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}))},t.dispose=function(){this.track=null,u.prototype.dispose.call(this)},e}(jt);pt.registerComponent("TextTrackMenuItem",fn);var mn=function(i){function e(e,t){return 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,i.call(this,e,t)||this}mt(e,i);var t=e.prototype;return t.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(-1<this.options_.kinds.indexOf(a.kind)&&"showing"===a.mode){i=!1;break}}i!==this.isSelected_&&this.selected(i)},t.handleSelectedLanguageChange=function(e){for(var t=this.player().textTracks(),i=!0,n=0,r=t.length;n<r;n++){var a=t[n];if(-1<["captions","descriptions","subtitles"].indexOf(a.kind)&&"showing"===a.mode){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})},e}(fn);pt.registerComponent("OffTextTrackMenuItem",mn);j=function(i){function e(e,t){return(t=void 0===t?{}:t).tracks=e.textTracks(),i.call(this,e,t)||this}return mt(e,i),e.prototype.createItems=function(e,t){var i;void 0===t&&(t=fn),this.label_&&(i=this.label_+" off"),(e=void 0===e?[]:e).push(new mn(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;var n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(var r=0;r<n.length;r++){var a,s=n[r];-1<this.kinds_.indexOf(s.kind)&&((a=new t(this.player_,{track:s,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1})).addClass("vjs-"+s.kind+"-menu-item"),e.push(a))}return e},e}(Ft);pt.registerComponent("TextTrackButton",j);var gn=function(a){function e(e,t){var i=t.track,n=t.cue,r=e.currentTime();return t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r<n.endTime,(t=a.call(this,e,t)||this).track=i,t.cue=n,t}return mt(e,a),e.prototype.handleClick=function(e){a.prototype.handleClick.call(this),this.player_.currentTime(this.cue.startTime)},e}(jt);pt.registerComponent("ChaptersTrackMenuItem",gn);k=function(r){function e(e,t,i){var n=r.call(this,e,t,i)||this;return n.selectCurrentItem_=function(){n.items.forEach(function(e){e.selected(n.track_.activeCues[0]===e.cue)})},n}mt(e,r);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-chapters-button "+r.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-chapters-button "+r.prototype.buildWrapperCSSClass.call(this)},t.update=function(e){e&&e.track&&"chapters"!==e.track.kind||((e=this.findChaptersTrack())!==this.track_?(this.setTrack(e),r.prototype.update.call(this)):(!this.items||e&&e.cues&&e.cues.length!==this.items.length)&&r.prototype.update.call(this))},t.setTrack=function(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",(e=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_))&&e.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)))},t.findChaptersTrack=function(){for(var e=this.player_.textTracks()||[],t=e.length-1;0<=t;t--){var i=e[t];if(i.kind===this.kind_)return i}},t.getMenuCaption=function(){return this.track_&&this.track_.label?this.track_.label:this.localize(ut(this.kind_))},t.createMenu=function(){return this.options_.title=this.getMenuCaption(),r.prototype.createMenu.call(this)},t.createItems=function(){var e=[];if(!this.track_)return e;var t=this.track_.cues;if(!t)return e;for(var i=0,n=t.length;i<n;i++){var r=t[i],r=new gn(this.player_,{track:this.track_,cue:r});e.push(r)}return e},e}(j);k.prototype.kind_="chapters",k.prototype.controlText_="Chapters",pt.registerComponent("ChaptersButton",k);li=function(a){function e(e,t,i){var i=a.call(this,e,t,i)||this,n=e.textTracks(),r=qe(ft(i),i.handleTracksChange);return n.addEventListener("change",r),i.on("dispose",function(){n.removeEventListener("change",r)}),i}mt(e,a);var t=e.prototype;return t.handleTracksChange=function(e){for(var t=this.player().textTracks(),i=!1,n=0,r=t.length;n<r;n++){var a=t[n];if(a.kind!==this.kind_&&"showing"===a.mode){i=!0;break}}i?this.disable():this.enable()},t.buildCSSClass=function(){return"vjs-descriptions-button "+a.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-descriptions-button "+a.prototype.buildWrapperCSSClass.call(this)},e}(j);li.prototype.kind_="descriptions",li.prototype.controlText_="Descriptions",pt.registerComponent("DescriptionsButton",li);f=function(n){function e(e,t,i){return n.call(this,e,t,i)||this}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-subtitles-button "+n.prototype.buildWrapperCSSClass.call(this)},e}(j);f.prototype.kind_="subtitles",f.prototype.controlText_="Subtitles",pt.registerComponent("SubtitlesButton",f);var yn=function(i){function e(e,t){return t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",(e=i.call(this,e,t)||this).addClass("vjs-texttrack-settings"),e.controlText(", opens "+t.kind+" settings dialog"),e}return mt(e,i),e.prototype.handleClick=function(e){this.player().getChild("textTrackSettings").open()},e}(fn);pt.registerComponent("CaptionSettingsMenuItem",yn);ui=function(n){function e(e,t,i){return n.call(this,e,t,i)||this}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-captions-button "+n.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-captions-button "+n.prototype.buildWrapperCSSClass.call(this)},t.createItems=function(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new yn(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),n.prototype.createItems.call(this,e)},e}(j);ui.prototype.kind_="captions",ui.prototype.controlText_="Captions",pt.registerComponent("CaptionsButton",ui);var vn=function(n){function e(){return n.apply(this,arguments)||this}return mt(e,n),e.prototype.createEl=function(e,t,i){t=n.prototype.createEl.call(this,e,t,i),i=t.querySelector(".vjs-menu-item-text");return"captions"===this.options_.track.kind&&(i.appendChild($("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild($("span",{className:"vjs-control-text",textContent:" "+this.localize("Captions")}))),t},e}(fn);pt.registerComponent("SubsCapsMenuItem",vn);Xt=function(i){function e(e,t){return(t=i.call(this,e,t=void 0===t?{}:t)||this).label_="subtitles",-1<["en","en-us","en-ca","fr-ca"].indexOf(t.player_.language_)&&(t.label_="captions"),t.menuButton_.controlText(ut(t.label_)),t}mt(e,i);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-subs-caps-button "+i.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-subs-caps-button "+i.prototype.buildWrapperCSSClass.call(this)},t.createItems=function(){var e=[];return this.player().tech_&&this.player().tech_.featuresNativeTextTracks||!this.player().getChild("textTrackSettings")||(e.push(new yn(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=i.prototype.createItems.call(this,e,vn)},e}(j);Xt.prototype.kinds_=["captions","subtitles"],Xt.prototype.controlText_="Subtitles",pt.registerComponent("SubsCapsButton",Xt);var _n=function(s){function e(e,t){var n,i=t.track,r=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,(n=s.call(this,e,t)||this).track=i,n.addClass("vjs-"+i.kind+"-menu-item");function a(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];n.handleTracksChange.apply(ft(n),t)}return r.addEventListener("change",a),n.on("dispose",function(){r.removeEventListener("change",a)}),n}mt(e,s);var t=e.prototype;return t.createEl=function(e,t,i){t=s.prototype.createEl.call(this,e,t,i),i=t.querySelector(".vjs-menu-item-text");return"main-desc"===this.options_.track.kind&&(i.appendChild($("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild($("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),t},t.handleClick=function(e){if(s.prototype.handleClick.call(this,e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks)for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];n!==this.track&&(n.enabled=n===this.track)}},t.handleTracksChange=function(e){this.selected(this.track.enabled)},e}(jt);pt.registerComponent("AudioTrackMenuItem",_n);I=function(i){function e(e,t){return(t=void 0===t?{}:t).tracks=e.audioTracks(),i.call(this,e,t)||this}mt(e,i);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-audio-button "+i.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-audio-button "+i.prototype.buildWrapperCSSClass.call(this)},t.createItems=function(e){void 0===e&&(e=[]),this.hideThreshold_=1;for(var t=this.player_.audioTracks(),i=0;i<t.length;i++){var n=t[i];e.push(new _n(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e},e}(Ft);I.prototype.controlText_="Audio Track",pt.registerComponent("AudioTrackButton",I);var bn=function(a){function e(e,t){var i,n=t.rate,r=parseFloat(n,10);return t.label=n,t.selected=r===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,(i=a.call(this,e,t)||this).label=n,i.rate=r,i.on(e,"ratechange",function(e){return i.update(e)}),i}mt(e,a);var t=e.prototype;return t.handleClick=function(e){a.prototype.handleClick.call(this),this.player().playbackRate(this.rate)},t.update=function(e){this.selected(this.player().playbackRate()===this.rate)},e}(jt);bn.prototype.contentElType="button",pt.registerComponent("PlaybackRateMenuItem",bn);C=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.menuButton_.el_.setAttribute("aria-describedby",i.labelElId_),i.updateVisibility(),i.updateLabel(),i.on(e,"loadstart",function(e){return i.updateVisibility(e)}),i.on(e,"ratechange",function(e){return i.updateLabel(e)}),i.on(e,"playbackrateschange",function(e){return i.handlePlaybackRateschange(e)}),i}mt(e,n);var t=e.prototype;return t.createEl=function(){var e=n.prototype.createEl.call(this);return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=$("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e},t.dispose=function(){this.labelEl_=null,n.prototype.dispose.call(this)},t.buildCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildCSSClass.call(this)},t.buildWrapperCSSClass=function(){return"vjs-playback-rate "+n.prototype.buildWrapperCSSClass.call(this)},t.createItems=function(){for(var e=this.playbackRates(),t=[],i=e.length-1;0<=i;i--)t.push(new bn(this.player(),{rate:e[i]+"x"}));return t},t.updateARIAAttributes=function(){this.el().setAttribute("aria-valuenow",this.player().playbackRate())},t.handleClick=function(e){var t=this.player().playbackRate(),i=this.playbackRates(),t=(i.indexOf(t)+1)%i.length;this.player().playbackRate(i[t])},t.handlePlaybackRateschange=function(e){this.update()},t.playbackRates=function(){var e=this.player();return e.playbackRates&&e.playbackRates()||[]},t.playbackRateSupported=function(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&0<this.playbackRates().length},t.updateVisibility=function(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")},t.updateLabel=function(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")},e}(Bt);C.prototype.controlText_="Playback Rate",pt.registerComponent("PlaybackRateMenuButton",C);k=function(n){function e(){return n.apply(this,arguments)||this}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-spacer "+n.prototype.buildCSSClass.call(this)},t.createEl=function(e,t,i){return void 0===e&&(e="div"),void 0===i&&(i={}),(t=void 0===t?{}:t).className||(t.className=this.buildCSSClass()),n.prototype.createEl.call(this,e,t,i)},e}(pt);pt.registerComponent("Spacer",k),pt.registerComponent("CustomControlSpacer",function(e){function t(){return e.apply(this,arguments)||this}mt(t,e);var i=t.prototype;return i.buildCSSClass=function(){return"vjs-custom-control-spacer "+e.prototype.buildCSSClass.call(this)},i.createEl=function(){return e.prototype.createEl.call(this,"div",{className:this.buildCSSClass(),textContent:" "})},t}(k));li=function(e){function t(){return e.apply(this,arguments)||this}return mt(t,e),t.prototype.createEl=function(){return e.prototype.createEl.call(this,"div",{className:"vjs-control-bar",dir:"ltr"})},t}(pt);li.prototype.options_={children:["playToggle","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","fullscreenToggle"]},"exitPictureInPicture"in document&&li.prototype.options_.children.splice(li.prototype.options_.children.length-1,0,"pictureInPictureToggle"),pt.registerComponent("ControlBar",li);f=function(n){function e(e,t){var i=n.call(this,e,t)||this;return i.on(e,"error",function(e){return i.open(e)}),i}mt(e,n);var t=e.prototype;return t.buildCSSClass=function(){return"vjs-error-display "+n.prototype.buildCSSClass.call(this)},t.content=function(){var e=this.player().error();return e?this.localize(e.message):""},e}(At);f.prototype.options_=g({},At.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0}),pt.registerComponent("ErrorDisplay",f);var Tn="vjs-text-track-settings",ui=["#000","Black"],j=["#00F","Blue"],Xt=["#0FF","Cyan"],Ft=["#0F0","Green"],I=["#F0F","Magenta"],jt=["#F00","Red"],Bt=["#FFF","White"],C=["#FF0","Yellow"],k=["1","Opaque"],li=["0.5","Semi-Transparent"],f=["0","Transparent"],wn={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ui,Bt,jt,Ft,j,C,I,Xt]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[k,li,f]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Bt,ui,jt,Ft,j,C,I,Xt]},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:function(e){return"1.00"===e?null:Number(e)}},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[k,li]},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:"Transparency",options:[f,li,k]}};function Sn(e,t){if((e=t?t(e):e)&&"none"!==e)return e}wn.windowColor.options=wn.backgroundColor.options,pt.registerComponent("TextTrackSettings",function(n){function e(e,t){var i;return t.temporary=!1,(i=n.call(this,e,t)||this).updateDisplay=i.updateDisplay.bind(ft(i)),i.fill(),i.hasBeenOpened_=i.hasBeenFilled_=!0,i.endDialog=$("p",{className:"vjs-control-text",textContent:i.localize("End of dialog window.")}),i.el().appendChild(i.endDialog),i.setDefaults(),void 0===t.persistTextTrackSettings&&(i.options_.persistTextTrackSettings=i.options_.playerOptions.persistTextTrackSettings),i.on(i.$(".vjs-done-button"),"click",function(){i.saveSettings(),i.close()}),i.on(i.$(".vjs-default-button"),"click",function(){i.setDefaults(),i.updateDisplay()}),_(wn,function(e){i.on(i.$(e.selector),"change",i.updateDisplay)}),i.options_.persistTextTrackSettings&&i.restoreSettings(),i}mt(e,n);var t=e.prototype;return t.dispose=function(){this.endDialog=null,n.prototype.dispose.call(this)},t.createElSelect_=function(e,t,i){var n=this;void 0===t&&(t=""),void 0===i&&(i="label");var e=wn[e],r=e.id.replace("%s",this.id_),a=[t,r].join(" ").trim();return["<"+i+' id="'+r+'" class="'+("label"===i?"vjs-label":"")+'">',this.localize(e.label),"</"+i+">",'<select aria-labelledby="'+a+'">'].concat(e.options.map(function(e){var t=r+"-"+e[1].replace(/\W+/g,"");return['<option id="'+t+'" value="'+e[0]+'" ','aria-labelledby="'+a+" "+t+'">',n.localize(e[1]),"</option>"].join("")})).concat("</select>").join("")},t.createElFgColor_=function(){var e="captions-text-legend-"+this.id_;return['<fieldset class="vjs-fg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")},t.createElBgColor_=function(){var e="captions-background-"+this.id_;return['<fieldset class="vjs-bg-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")},t.createElWinColor_=function(){var e="captions-window-"+this.id_;return['<fieldset class="vjs-window-color vjs-track-setting">','<legend id="'+e+'">',this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")},t.createElColors_=function(){return $("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})},t.createElFont_=function(){return $("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("")})},t.createElControls_=function(){var e=this.localize("restore all settings to the default values");return $("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("")})},t.content=function(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]},t.label=function(){return this.localize("Caption Settings Dialog")},t.description=function(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")},t.buildCSSClass=function(){return n.prototype.buildCSSClass.call(this)+" vjs-text-track-settings"},t.getValues=function(){var i,n,e,r=this;return n=function(e,t,i){var n,t=(n=r.$(t.selector),t=t.parser,Sn(n.options[n.options.selectedIndex].value,t));return void 0!==t&&(e[i]=t),e},void 0===(e={})&&(e=0),v(i=wn).reduce(function(e,t){return n(e,i[t],t)},e)},t.setValues=function(i){var n=this;_(wn,function(e,t){!function(e,t,i){if(t)for(var n=0;n<e.options.length;n++)if(Sn(e.options[n].value,i)===t){e.selectedIndex=n;break}}(n.$(e.selector),i[t],e.parser)})},t.setDefaults=function(){var i=this;_(wn,function(e){var t=e.hasOwnProperty("default")?e.default:0;i.$(e.selector).selectedIndex=t})},t.restoreSettings=function(){var e;try{e=JSON.parse(window.localStorage.getItem(Tn))}catch(e){h.warn(e)}e&&this.setValues(e)},t.saveSettings=function(){if(this.options_.persistTextTrackSettings){var e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(Tn,JSON.stringify(e)):window.localStorage.removeItem(Tn)}catch(e){h.warn(e)}}},t.updateDisplay=function(){var e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()},t.conditionalBlur_=function(){this.previouslyActiveEl_=null;var e=this.player_.controlBar,t=e&&e.subsCapsButton,e=e&&e.captionsButton;t?t.focus():e&&e.focus()},e}(At)),pt.registerComponent("ResizeManager",function(a){function e(e,t){var i,n=t.ResizeObserver||window.ResizeObserver,r=lt({createEl:!(n=null===t.ResizeObserver?!1:n),reportTouchActivity:!1},t);return(i=a.call(this,e,r)||this).ResizeObserver=t.ResizeObserver||window.ResizeObserver,i.loadListener_=null,i.resizeObserver_=null,i.debouncedHandler_=Ge(function(){i.resizeHandler()},100,!1,ft(i)),n?(i.resizeObserver_=new i.ResizeObserver(i.debouncedHandler_),i.resizeObserver_.observe(e.el())):(i.loadListener_=function(){var e,t;i.el_&&i.el_.contentWindow&&(e=i.debouncedHandler_,t=i.unloadListener_=function(){Fe(this,"resize",e),Fe(this,"unload",t),t=null},Be(i.el_.contentWindow,"unload",t),Be(i.el_.contentWindow,"resize",e))},i.one("load",i.loadListener_)),i}mt(e,a);var t=e.prototype;return t.createEl=function(){return a.prototype.createEl.call(this,"iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})},t.resizeHandler=function(){this.player_&&this.player_.trigger&&this.player_.trigger("playerresize")},t.dispose=function(){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,a.prototype.dispose.call(this)},e}(pt));var En={trackingThreshold:20,liveTolerance:15};pt.registerComponent("LiveTracker",function(n){function e(e,t){var t=lt(En,t,{createEl:!1}),i=n.call(this,e,t)||this;return i.handleVisibilityChange_=function(e){return i.handleVisibilityChange(e)},i.trackLiveHandler_=function(){return i.trackLive_()},i.handlePlay_=function(e){return i.handlePlay(e)},i.handleFirstTimeupdate_=function(e){return i.handleFirstTimeupdate(e)},i.handleSeeked_=function(e){return i.handleSeeked(e)},i.seekToLiveEdge_=function(e){return i.seekToLiveEdge(e)},i.reset_(),i.on(i.player_,"durationchange",function(e){return i.handleDurationchange(e)}),i.on(i.player_,"canplay",function(){return i.toggleTracking()}),N&&"hidden"in document&&"visibilityState"in document&&i.on(document,"visibilitychange",i.handleVisibilityChange_),i}mt(e,n);var t=e.prototype;return t.handleVisibilityChange=function(){this.player_.duration()===1/0&&(document.hidden?this.stopTracking():this.startTracking())},t.trackLive_=function(){var e,t=this.player_.seekable();t&&t.length&&(e=Number(window.performance.now().toFixed(4)),t=-1===this.lastTime_?0:(e-this.lastTime_)/1e3,this.lastTime_=e,this.pastSeekEnd_=this.pastSeekEnd()+t,e=this.liveCurrentTime(),t=this.player_.currentTime(),t=this.player_.paused()||this.seekedBehindLive_||Math.abs(e-t)>this.options_.liveTolerance,(t=!this.timeupdateSeen_||e===1/0?!1:t)!==this.behindLiveEdge_&&(this.behindLiveEdge_=t,this.trigger("liveedgechange")))},t.handleDurationchange=function(){this.toggleTracking()},t.toggleTracking=function(){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())},t.startTracking=function(){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_)))},t.handleFirstTimeupdate=function(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)},t.handleSeeked=function(){var e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&2<e,this.nextSeekedFromUser_=!1,this.trackLive_()},t.handlePlay=function(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)},t.reset_=function(){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_)},t.nextSeekedFromUser=function(){this.nextSeekedFromUser_=!0},t.stopTracking=function(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))},t.seekableEnd=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0},t.seekableStart=function(){for(var e=this.player_.seekable(),t=[],i=e?e.length:0;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0},t.liveWindow=function(){var e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()},t.isLive=function(){return this.isTracking()},t.atLiveEdge=function(){return!this.behindLiveEdge()},t.liveCurrentTime=function(){return this.pastSeekEnd()+this.seekableEnd()},t.pastSeekEnd=function(){var e=this.seekableEnd();return-1!==this.lastSeekEnd_&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_},t.behindLiveEdge=function(){return this.behindLiveEdge_},t.isTracking=function(){return"number"==typeof this.trackingInterval_},t.seekToLiveEdge=function(){this.seekedBehindLive_=!1,this.atLiveEdge()||(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))},t.dispose=function(){this.off(document,"visibilitychange",this.handleVisibilityChange_),this.stopTracking(),n.prototype.dispose.call(this)},e}(pt));function kn(e){if((n=e.el()).hasAttribute("src"))return e.triggerSourceset(n.src),1;var t=e.$$("source"),i=[],n="";if(t.length){for(var r=0;r<t.length;r++){var a=t[r].src;a&&-1===i.indexOf(a)&&i.push(a)}return!!i.length&&(1===i.length&&(n=i[0]),e.triggerSourceset(n),!0)}}function Cn(e,t){for(var i={},n=0;n<e.length&&!((i=Object.getOwnPropertyDescriptor(e[n],t))&&i.set&&i.get);n++);return i.enumerable=!0,i.configurable=!0,i}function In(a){var t,e,i,s=a.el();s.resetSourceWatch_||(t={},e=Cn([a.el(),window.HTMLMediaElement.prototype,window.Element.prototype,Ln],"innerHTML"),i=function(r){return function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=r.apply(s,t);return kn(a),n}},["append","appendChild","insertAdjacentHTML"].forEach(function(e){s[e]&&(t[e]=s[e],s[e]=i(t[e]))}),Object.defineProperty(s,"innerHTML",lt(e,{set:i(e.set)})),s.resetSourceWatch_=function(){s.resetSourceWatch_=null,Object.keys(t).forEach(function(e){s[e]=t[e]}),Object.defineProperty(s,"innerHTML",e)},a.one("sourceset",s.resetSourceWatch_))}function xn(i){var n,t,r,a;i.featuresSourceset&&((n=i.el()).resetSourceset_||(t=Cn([i.el(),window.HTMLMediaElement.prototype,On],"src"),r=n.setAttribute,a=n.load,Object.defineProperty(n,"src",lt(t,{set:function(e){e=t.set.call(n,e);return i.triggerSourceset(n.src),e}})),n.setAttribute=function(e,t){t=r.call(n,e,t);return/src/i.test(e)&&i.triggerSourceset(n.src),t},n.load=function(){var e=a.call(n);return kn(i)||(i.triggerSourceset(""),In(i)),e},n.currentSrc?i.triggerSourceset(n.currentSrc):kn(i)||In(i),n.resetSourceset_=function(){n.resetSourceset_=null,n.load=a,n.setAttribute=r,Object.defineProperty(n,"src",t),n.resetSourceWatch_&&n.resetSourceWatch_()}))}function An(t,i,n,e){function r(e){return Object.defineProperty(t,i,{value:e,enumerable:!0,writable:!0})}var a={configurable:!0,enumerable:!0,get:function(){var e=n();return r(e),e}};return(e=void 0===e?!0:e)&&(a.set=r),Object.defineProperty(t,i,a)}var Pn,Ln=Object.defineProperty({},"innerHTML",{get:function(){return this.cloneNode(!0).innerHTML},set:function(e){var t=document.createElement(this.nodeName.toLowerCase());t.innerHTML=e;for(var i=document.createDocumentFragment();t.childNodes.length;)i.appendChild(t.childNodes[0]);return this.innerText="",window.Element.prototype.appendChild.call(this,i),this.innerHTML}}),On=Object.defineProperty({},"src",{get:function(){return this.hasAttribute("src")?Mt(window.Element.prototype.getAttribute.call(this,"src")):""},set:function(e){return window.Element.prototype.setAttribute.call(this,"src",e),e}}),Dn=function(l){function s(e,t){var i=l.call(this,e,t)||this,t=e.source,n=!1;if(i.featuresVideoFrameCallback=i.featuresVideoFrameCallback&&"VIDEO"===i.el_.tagName,t&&(i.el_.currentSrc!==t.src||e.tag&&3===e.tag.initNetworkState_)?i.setSource(t):i.handleLateInit_(i.el_),e.enableSourceset&&i.setupSourcesetHandling_(),i.isScrubbing_=!1,i.el_.hasChildNodes()){for(var r=i.el_.childNodes,a=r.length,s=[];a--;){var o=r[a];"track"===o.nodeName.toLowerCase()&&(i.featuresNativeTextTracks?(i.remoteTextTrackEls().addTrackElement_(o),i.remoteTextTracks().addTrack(o.track),i.textTracks().addTrack(o.track),n||i.el_.hasAttribute("crossorigin")||!Ut(o.src)||(n=!0)):s.push(o))}for(var u=0;u<s.length;u++)i.el_.removeChild(s[u])}return i.proxyNativeTracks_(),i.featuresNativeTextTracks&&n&&h.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading."),i.restoreMetadataTracksInIOSNativePlayer_(),(F||H||L)&&!0===e.nativeControlsForTouch&&i.setControls(!0),i.proxyWebkitFullscreen_(),i.triggerReady(),i}mt(s,l);var e=s.prototype;return e.dispose=function(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),s.disposeMediaElement(this.el_),this.options_=null,l.prototype.dispose.call(this)},e.setupSourcesetHandling_=function(){xn(this)},e.restoreMetadataTracksInIOSNativePlayer_=function(){function e(){i=[];for(var e=0;e<n.length;e++){var t=n[e];"metadata"===t.kind&&i.push({track:t,storedMode:t.mode})}}var i,n=this.textTracks();e(),n.addEventListener("change",e),this.on("dispose",function(){return n.removeEventListener("change",e)});function r(){for(var e=0;e<i.length;e++){var t=i[e];"disabled"===t.track.mode&&t.track.mode!==t.storedMode&&(t.track.mode=t.storedMode)}n.removeEventListener("change",r)}this.on("webkitbeginfullscreen",function(){n.removeEventListener("change",e),n.removeEventListener("change",r),n.addEventListener("change",r)}),this.on("webkitendfullscreen",function(){n.removeEventListener("change",e),n.addEventListener("change",e),n.removeEventListener("change",r)})},e.overrideNative_=function(e,t){var i,n=this;t===this["featuresNative"+e+"Tracks"]&&(this[(i=e.toLowerCase())+"TracksListeners_"]&&Object.keys(this[i+"TracksListeners_"]).forEach(function(e){n.el()[i+"Tracks"].removeEventListener(e,n[i+"TracksListeners_"][e])}),this["featuresNative"+e+"Tracks"]=!t,this[i+"TracksListeners_"]=null,this.proxyNativeTracksForType_(i))},e.overrideNativeAudioTracks=function(e){this.overrideNative_("Audio",e)},e.overrideNativeVideoTracks=function(e){this.overrideNative_("Video",e)},e.proxyNativeTracksForType_=function(i){var e,t,n=this,r=ai[i],a=this.el()[r.getterName],s=this[r.getterName]();this["featuresNative"+r.capitalName+"Tracks"]&&a&&a.addEventListener&&(t=function(){for(var e=[],t=0;t<s.length;t++){for(var i=!1,n=0;n<a.length;n++)if(a[n]===s[t]){i=!0;break}i||e.push(s[t])}for(;e.length;)s.removeTrack(e.shift())},this[r.getterName+"Listeners_"]=e={change:function(e){var t={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(t),"text"===i&&n[si.remoteText.getterName]().trigger(t)},addtrack:function(e){s.addTrack(e.track)},removetrack:function(e){s.removeTrack(e.track)}},Object.keys(e).forEach(function(t){var i=e[t];a.addEventListener(t,i),n.on("dispose",function(e){return a.removeEventListener(t,i)})}),this.on("loadstart",t),this.on("dispose",function(e){return n.off("loadstart",t)}))},e.proxyNativeTracks_=function(){var t=this;ai.names.forEach(function(e){t.proxyNativeTracksForType_(e)})},e.createEl=function(){var e,t=this.options_.tag;t&&(this.options_.playerElIngest||this.movingMediaElementInDOM)||(t?(e=t.cloneNode(!0),t.parentNode&&t.parentNode.insertBefore(e,t),s.disposeMediaElement(t),t=e):(t=document.createElement("video"),e=lt({},this.options_.tag&&ae(this.options_.tag)),F&&!0===this.options_.nativeControlsForTouch||delete e.controls,re(t,b(e,{id:this.options_.techId,class:"vjs-tech"}))),t.playerId=this.options_.playerId),"undefined"!=typeof this.options_.preload&&oe(t,"preload",this.options_.preload),void 0!==this.options_.disablePictureInPicture&&(t.disablePictureInPicture=this.options_.disablePictureInPicture);for(var i=["loop","muted","playsinline","autoplay"],n=0;n<i.length;n++){var r=i[n],a=this.options_[r];"undefined"!=typeof a&&(a?oe(t,r,r):ue(t,r),t[r]=a)}return t},e.handleLateInit_=function(e){if(0!==e.networkState&&3!==e.networkState){if(0===e.readyState){var t=!1,i=function(){t=!0};this.on("loadstart",i);var n=function(){t||this.trigger("loadstart")};return this.on("loadedmetadata",n),void this.ready(function(){this.off("loadstart",i),this.off("loadedmetadata",n),t||this.trigger("loadstart")})}var r=["loadstart"];r.push("loadedmetadata"),2<=e.readyState&&r.push("loadeddata"),3<=e.readyState&&r.push("canplay"),4<=e.readyState&&r.push("canplaythrough"),this.ready(function(){r.forEach(function(e){this.trigger(e)},this)})}},e.setScrubbing=function(e){this.isScrubbing_=e},e.scrubbing=function(){return this.isScrubbing_},e.setCurrentTime=function(e){try{this.isScrubbing_&&this.el_.fastSeek&&q?this.el_.fastSeek(e):this.el_.currentTime=e}catch(e){h(e,"Video is not ready. (Video.js)")}},e.duration=function(){var t=this;return this.el_.duration===1/0&&A&&R&&0===this.el_.currentTime?(this.on("timeupdate",function e(){0<t.el_.currentTime&&(t.el_.duration===1/0&&t.trigger("durationchange"),t.off("timeupdate",e))}),NaN):this.el_.duration||NaN},e.width=function(){return this.el_.offsetWidth},e.height=function(){return this.el_.offsetHeight},e.proxyWebkitFullscreen_=function(){var e,t,i=this;"webkitDisplayingFullscreen"in this.el_&&(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",function(){i.off("webkitbeginfullscreen",t),i.off("webkitendfullscreen",e)}))},e.supportsFullScreen=function(){if("function"==typeof this.el_.webkitEnterFullScreen){var e=window.navigator&&window.navigator.userAgent||"";if(/Android/.test(e)||!/Chrome|Mac OS X 10.5/.test(e))return!0}return!1},e.enterFullScreen=function(){var e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Et(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)}},e.exitFullScreen=function(){this.el_.webkitDisplayingFullscreen?this.el_.webkitExitFullScreen():this.trigger("fullscreenerror",new Error("The video is not fullscreen"))},e.requestPictureInPicture=function(){return this.el_.requestPictureInPicture()},e.requestVideoFrameCallback=function(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):l.prototype.requestVideoFrameCallback.call(this,e)},e.cancelVideoFrameCallback=function(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):l.prototype.cancelVideoFrameCallback.call(this,e)},e.src=function(e){if(void 0===e)return this.el_.src;this.setSrc(e)},e.reset=function(){s.resetMediaElement(this.el_)},e.currentSrc=function(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc},e.setControls=function(e){this.el_.controls=!!e},e.addTextTrack=function(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):l.prototype.addTextTrack.call(this,e,t,i)},e.createRemoteTextTrack=function(e){if(!this.featuresNativeTextTracks)return l.prototype.createRemoteTextTrack.call(this,e);var t=document.createElement("track");return 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},e.addRemoteTextTrack=function(e,t){t=l.prototype.addRemoteTextTrack.call(this,e,t);return this.featuresNativeTextTracks&&this.el().appendChild(t),t},e.removeRemoteTextTrack=function(e){if(l.prototype.removeRemoteTextTrack.call(this,e),this.featuresNativeTextTracks)for(var t=this.$$("track"),i=t.length;i--;)e!==t[i]&&e!==t[i].track||this.el().removeChild(t[i])},e.getVideoPlaybackQuality=function(){if("function"==typeof this.el().getVideoPlaybackQuality)return this.el().getVideoPlaybackQuality();var e={};return"undefined"!=typeof this.el().webkitDroppedFrameCount&&"undefined"!=typeof this.el().webkitDecodedFrameCount&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),window.performance&&"function"==typeof window.performance.now?e.creationTime=window.performance.now():window.performance&&window.performance.timing&&"number"==typeof window.performance.timing.navigationStart&&(e.creationTime=window.Date.now()-window.performance.timing.navigationStart),e},s}(ji);An(Dn,"TEST_VID",function(){if(X()){var e=document.createElement("video"),t=document.createElement("track");return t.kind="captions",t.srclang="en",t.label="English",e.appendChild(t),e}}),Dn.isSupported=function(){try{Dn.TEST_VID.volume=.5}catch(e){return!1}return!(!Dn.TEST_VID||!Dn.TEST_VID.canPlayType)},Dn.canPlayType=function(e){return Dn.TEST_VID.canPlayType(e)},Dn.canPlaySource=function(e,t){return Dn.canPlayType(e.type)},Dn.canControlVolume=function(){try{var e=Dn.TEST_VID.volume;Dn.TEST_VID.volume=e/2+.1;var t=e!==Dn.TEST_VID.volume;return t&&V?(window.setTimeout(function(){Dn&&Dn.prototype&&(Dn.prototype.featuresVolumeControl=e!==Dn.TEST_VID.volume)}),!1):t}catch(e){return!1}},Dn.canMuteVolume=function(){try{var e=Dn.TEST_VID.muted;return Dn.TEST_VID.muted=!e,Dn.TEST_VID.muted?oe(Dn.TEST_VID,"muted","muted"):ue(Dn.TEST_VID,"muted"),e!==Dn.TEST_VID.muted}catch(e){return!1}},Dn.canControlPlaybackRate=function(){if(A&&R&&M<58)return!1;try{var e=Dn.TEST_VID.playbackRate;return Dn.TEST_VID.playbackRate=e/2+.1,e!==Dn.TEST_VID.playbackRate}catch(e){return!1}},Dn.canOverrideAttributes=function(){try{var e=function(){};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},Dn.supportsNativeTextTracks=function(){return q||V&&R},Dn.supportsNativeVideoTracks=function(){return!(!Dn.TEST_VID||!Dn.TEST_VID.videoTracks)},Dn.supportsNativeAudioTracks=function(){return!(!Dn.TEST_VID||!Dn.TEST_VID.audioTracks)},Dn.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){var t=e[0],i=e[1];An(Dn.prototype,t,function(){return Dn[i]()},!0)}),Dn.prototype.featuresVolumeControl=Dn.canControlVolume(),Dn.prototype.movingMediaElementInDOM=!V,Dn.prototype.featuresFullscreenResize=!0,Dn.prototype.featuresProgressEvents=!0,Dn.prototype.featuresTimeupdateEvents=!0,Dn.prototype.featuresVideoFrameCallback=!(!Dn.TEST_VID||!Dn.TEST_VID.requestVideoFrameCallback),Dn.patchCanPlayType=function(){4<=P&&!O&&!R&&(Pn=Dn.TEST_VID&&Dn.TEST_VID.constructor.prototype.canPlayType,Dn.TEST_VID.constructor.prototype.canPlayType=function(e){return e&&/^application\/(?:x-|vnd\.apple\.)mpegurl/i.test(e)?"maybe":Pn.call(this,e)})},Dn.unpatchCanPlayType=function(){var e=Dn.TEST_VID.constructor.prototype.canPlayType;return Pn&&(Dn.TEST_VID.constructor.prototype.canPlayType=Pn),e},Dn.patchCanPlayType(),Dn.disposeMediaElement=function(e){if(e){for(e.parentNode&&e.parentNode.removeChild(e);e.hasChildNodes();)e.removeChild(e.firstChild);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},Dn.resetMediaElement=function(e){if(e){for(var t=e.querySelectorAll("source"),i=t.length;i--;)e.removeChild(t[i]);e.removeAttribute("src"),"function"==typeof e.load&&function(){try{e.load()}catch(e){}}()}},["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(e){Dn.prototype[e]=function(){return this.el_[e]||this.el_.hasAttribute(e)}}),["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(t){Dn.prototype["set"+ut(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){Dn.prototype[e]=function(){return this.el_[e]}}),["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(t){Dn.prototype["set"+ut(t)]=function(e){this.el_[t]=e}}),["pause","load","play"].forEach(function(e){Dn.prototype[e]=function(){return this.el_[e]()}}),ji.withSourceHandlers(Dn),Dn.nativeSourceHandler={},Dn.nativeSourceHandler.canPlayType=function(e){try{return Dn.TEST_VID.canPlayType(e)}catch(e){return""}},Dn.nativeSourceHandler.canHandleSource=function(e,t){if(e.type)return Dn.nativeSourceHandler.canPlayType(e.type);if(e.src){e=Nt(e.src);return Dn.nativeSourceHandler.canPlayType("video/"+e)}return""},Dn.nativeSourceHandler.handleSource=function(e,t,i){t.setSrc(e.src)},Dn.nativeSourceHandler.dispose=function(){},Dn.registerSourceHandler(Dn.nativeSourceHandler),ji.registerTech("Html5",Dn);var Rn=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Mn={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Nn=["tiny","xsmall","small","medium","large","xlarge","huge"],Un={};Nn.forEach(function(e){var t="x"===e.charAt(0)?"x-"+e.substring(1):e;Un[e]="vjs-layout-"+t});var Bn={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0},Fn=function(d){function o(e,t,i){var n,r;if(e.id=e.id||t.id||"vjs_video_"+Pe++,(t=b(o.getTagSettings(e),t)).initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language)if("function"==typeof e.closest){var a=e.closest("[lang]");a&&a.getAttribute&&(t.language=a.getAttribute("lang"))}else for(var s=e;s&&1===s.nodeType;){if(ae(s).hasOwnProperty("lang")){t.language=s.getAttribute("lang");break}s=s.parentNode}if((n=d.call(this,null,t,i)||this).boundDocumentFullscreenChange_=function(e){return n.documentFullscreenChange_(e)},n.boundFullWindowOnEscKey_=function(e){return n.fullWindowOnEscKey(e)},n.boundUpdateStyleEl_=function(e){return n.updateStyleEl_(e)},n.boundApplyInitTime_=function(e){return n.applyInitTime_(e)},n.boundUpdateCurrentBreakpoint_=function(e){return n.updateCurrentBreakpoint_(e)},n.boundHandleTechClick_=function(e){return n.handleTechClick_(e)},n.boundHandleTechDoubleClick_=function(e){return n.handleTechDoubleClick_(e)},n.boundHandleTechTouchStart_=function(e){return n.handleTechTouchStart_(e)},n.boundHandleTechTouchMove_=function(e){return n.handleTechTouchMove_(e)},n.boundHandleTechTouchEnd_=function(e){return n.handleTechTouchEnd_(e)},n.boundHandleTechTap_=function(e){return n.handleTechTap_(e)},n.isFullscreen_=!1,n.log=p(n.id_),n.fsApi_=l,n.isPosterFromTech_=!1,n.queuedCallbacks_=[],n.isReady_=!1,n.hasStarted_=!1,n.userActive_=!1,n.debugEnabled_=!1,n.audioOnlyMode_=!1,n.audioPosterMode_=!1,n.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!n.options_||!n.options_.techOrder||!n.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");n.tag=e,n.tagAttributes=e&&ae(e),n.language(n.options_.language),t.languages?(r={},Object.getOwnPropertyNames(t.languages).forEach(function(e){r[e.toLowerCase()]=t.languages[e]}),n.languages_=r):n.languages_=o.prototype.options_.languages,n.resetCache_(),n.poster_=t.poster||"",n.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),n.changingSrc_=!1,n.playCallbacks_=[],n.playTerminatedQueue_=[],e.hasAttribute("autoplay")?n.autoplay(!0):n.autoplay(n.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(function(e){if("function"!=typeof n[e])throw new Error('plugin "'+e+'" does not exist')}),n.scrubbing_=!1,n.el_=n.createEl(),rt(ft(n),{eventBusKey:"el_"}),n.fsApi_.requestFullscreen&&(Be(document,n.fsApi_.fullscreenchange,n.boundDocumentFullscreenChange_),n.on(n.fsApi_.fullscreenchange,n.boundDocumentFullscreenChange_)),n.fluid_&&n.on(["playerreset","resize"],n.boundUpdateStyleEl_);i=lt(n.options_);t.plugins&&Object.keys(t.plugins).forEach(function(e){n[e](t.plugins[e])}),t.debug&&n.debug(!0),n.options_.playerOptions=i,n.middleware_=[],n.playbackRates(t.playbackRates),n.initChildren(),n.isAudio("audio"===e.nodeName.toLowerCase()),n.controls()?n.addClass("vjs-controls-enabled"):n.addClass("vjs-controls-disabled"),n.el_.setAttribute("role","region"),n.isAudio()?n.el_.setAttribute("aria-label",n.localize("Audio Player")):n.el_.setAttribute("aria-label",n.localize("Video Player")),n.isAudio()&&n.addClass("vjs-audio"),n.flexNotSupported_()&&n.addClass("vjs-no-flex"),F&&n.addClass("vjs-touch-enabled"),V||n.addClass("vjs-workinghover"),o.players[n.id_]=ft(n);e=u.split(".")[0];return n.addClass("vjs-v"+e),n.userActive(!0),n.reportUserActivity(),n.one("play",function(e){return n.listenForUserActivity_(e)}),n.on("stageclick",function(e){return n.handleStageClick_(e)}),n.on("keydown",function(e){return n.handleKeyDown(e)}),n.on("languagechange",function(e){return n.handleLanguagechange(e)}),n.breakpoints(n.options_.breakpoints),n.responsive(n.options_.responsive),n.on("ready",function(){n.audioPosterMode(n.options_.audioPosterMode),n.audioOnlyMode(n.options_.audioOnlyMode)}),n}mt(o,d);var e=o.prototype;return e.dispose=function(){var t=this;this.trigger("dispose"),this.off("dispose"),Fe(document,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Fe(document,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),o.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),Vi[this.id()]=null,oi.names.forEach(function(e){e=oi[e],e=t[e.getterName]();e&&e.off&&e.off()}),d.prototype.dispose.call(this,{restoreEl:this.options_.restoreEl})},e.createEl=function(){var t,i=this.tag,e=this.playerElIngest_=i.parentNode&&i.parentNode.hasAttribute&&i.parentNode.hasAttribute("data-vjs-player"),n="video-js"===this.tag.tagName.toLowerCase();e?t=this.el_=i.parentNode:n||(t=this.el_=d.prototype.createEl.call(this,"div"));var r,a,s=ae(i);if(n){for(t=this.el_=i,i=this.tag=document.createElement("video");t.children.length;)i.appendChild(t.firstChild);ee(t,"video-js")||te(t,"video-js"),t.appendChild(i),e=this.playerElIngest_=t,Object.keys(t).forEach(function(e){try{i[e]=t[e]}catch(e){}})}i.setAttribute("tabindex","-1"),s.tabindex="-1",(N||R&&B)&&(i.setAttribute("role","application"),s.role="application"),i.removeAttribute("width"),i.removeAttribute("height"),"width"in s&&delete s.width,"height"in s&&delete s.height,Object.getOwnPropertyNames(s).forEach(function(e){n&&"class"===e||t.setAttribute(e,s[e]),n&&i.setAttribute(e,s[e])}),i.playerId=i.id,i.id+="_html5_api",i.className="vjs-tech",(i.player=t.player=this).addClass("vjs-paused"),!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&(this.styleEl_=xe("vjs-styles-dimensions"),r=Te(".vjs-styles-defaults"),(a=Te("head")).insertBefore(this.styleEl_,r?r.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);for(var o=i.getElementsByTagName("a"),u=0;u<o.length;u++){var l=o.item(u);te(l,"vjs-hidden"),l.setAttribute("hidden","hidden")}return i.initNetworkState_=i.networkState,i.parentNode&&!e&&i.parentNode.insertBefore(t,i),Z(i,t),this.children_.unshift(i),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t},e.crossOrigin=function(e){if(!e)return this.techGet_("crossOrigin");"anonymous"===e||"use-credentials"===e?this.techCall_("setCrossOrigin",e):h.warn('crossOrigin must be "anonymous" or "use-credentials", given "'+e+'"')},e.width=function(e){return this.dimension("width",e)},e.height=function(e){return this.dimension("height",e)},e.dimension=function(e,t){var i=e+"_";if(void 0===t)return this[i]||0;if(""===t||"auto"===t)return this[i]=void 0,void this.updateStyleEl_();var n=parseFloat(t);isNaN(n)?h.error('Improper value "'+t+'" supplied for for '+e):(this[i]=n,this.updateStyleEl_())},e.fluid=function(e){var t,i=this;if(void 0===e)return!!this.fluid_;this.fluid_=!!e,it(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),t=function(){i.on(["playerreset","resize"],i.boundUpdateStyleEl_)},it(e=this)?t():(e.eventedCallbacks||(e.eventedCallbacks=[]),e.eventedCallbacks.push(t))):this.removeClass("vjs-fluid"),this.updateStyleEl_()},e.fill=function(e){if(void 0===e)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")},e.aspectRatio=function(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_()},e.updateStyleEl_=function(){var e,t,i,n;!0!==window.VIDEOJS_NO_DYNAMIC_STYLE?(n=(i=(void 0!==this.aspectRatio_&&"auto"!==this.aspectRatio_?this.aspectRatio_:0<this.videoWidth()?this.videoWidth()+":"+this.videoHeight():"16:9").split(":"))[1]/i[0],e=void 0!==this.width_?this.width_:void 0!==this.height_?this.height_/n:this.videoWidth()||300,t=void 0!==this.height_?this.height_:e*n,i=/^[^a-zA-Z]/.test(this.id())?"dimensions-"+this.id():this.id()+"-dimensions",this.addClass(i),Ae(this.styleEl_,"\n      ."+i+" {\n        width: "+e+"px;\n        height: "+t+"px;\n      }\n\n      ."+i+".vjs-fluid:not(.vjs-audio-only-mode) {\n        padding-top: "+100*n+"%;\n      }\n    ")):(t="number"==typeof this.width_?this.width_:this.options_.width,i="number"==typeof this.height_?this.height_:this.options_.height,(n=this.tech_&&this.tech_.el())&&(0<=t&&(n.width=t),0<=i&&(n.height=i)))},e.loadTech_=function(e,t){var i=this;this.tech_&&this.unloadTech_();var n=ut(e),r=e.charAt(0).toLowerCase()+e.slice(1);"Html5"!==n&&this.tag&&(ji.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;var a=this.autoplay(),s={source:t,autoplay:a="string"==typeof this.autoplay()||!0===this.autoplay()&&this.options_.normalizeAutoplay?!1:a,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:this.id()+"_"+r+"_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,Promise:this.options_.Promise};oi.names.forEach(function(e){e=oi[e];s[e.getterName]=i[e.privateName]}),b(s,this.options_[n]),b(s,this.options_[r]),b(s,this.options_[e.toLowerCase()]),this.tag&&(s.tag=this.tag),t&&t.src===this.cache_.src&&0<this.cache_.currentTime&&(s.startTime=this.cache_.currentTime);e=ji.getTech(e);if(!e)throw new Error("No Tech named '"+n+"' exists! '"+n+"' should be registered using videojs.registerTech()'");this.tech_=new e(s),this.tech_.ready(qe(this,this.handleTechReady_),!0),It(this.textTracksJson_||[],this.tech_),Rn.forEach(function(t){i.on(i.tech_,t,function(e){return i["handleTech"+ut(t)+"_"](e)})}),Object.keys(Mn).forEach(function(t){i.on(i.tech_,t,function(e){0===i.tech_.playbackRate()&&i.tech_.seeking()?i.queuedCallbacks_.push({callback:i["handleTech"+Mn[t]+"_"].bind(i),event:e}):i["handleTech"+Mn[t]+"_"](e)})}),this.on(this.tech_,"loadstart",function(e){return i.handleTechLoadStart_(e)}),this.on(this.tech_,"sourceset",function(e){return i.handleTechSourceset_(e)}),this.on(this.tech_,"waiting",function(e){return i.handleTechWaiting_(e)}),this.on(this.tech_,"ended",function(e){return i.handleTechEnded_(e)}),this.on(this.tech_,"seeking",function(e){return i.handleTechSeeking_(e)}),this.on(this.tech_,"play",function(e){return i.handleTechPlay_(e)}),this.on(this.tech_,"firstplay",function(e){return i.handleTechFirstPlay_(e)}),this.on(this.tech_,"pause",function(e){return i.handleTechPause_(e)}),this.on(this.tech_,"durationchange",function(e){return i.handleTechDurationChange_(e)}),this.on(this.tech_,"fullscreenchange",function(e,t){return i.handleTechFullscreenChange_(e,t)}),this.on(this.tech_,"fullscreenerror",function(e,t){return i.handleTechFullscreenError_(e,t)}),this.on(this.tech_,"enterpictureinpicture",function(e){return i.handleTechEnterPictureInPicture_(e)}),this.on(this.tech_,"leavepictureinpicture",function(e){return i.handleTechLeavePictureInPicture_(e)}),this.on(this.tech_,"error",function(e){return i.handleTechError_(e)}),this.on(this.tech_,"posterchange",function(e){return i.handleTechPosterChange_(e)}),this.on(this.tech_,"textdata",function(e){return i.handleTechTextData_(e)}),this.on(this.tech_,"ratechange",function(e){return i.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"===n&&this.tag||Z(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)},e.unloadTech_=function(){var t=this;oi.names.forEach(function(e){e=oi[e];t[e.privateName]=t[e.getterName]()}),this.textTracksJson_=Ct(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1},e.tech=function(e){return void 0===e&&h.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_},e.addTechControlsListeners_=function(){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_)},e.removeTechControlsListeners_=function(){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_)},e.handleTechReady_=function(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()},e.handleTechLoadStart_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):(this.trigger("loadstart"),this.trigger("firstplay")),this.manualAutoplay_(!0===this.autoplay()&&this.options_.normalizeAutoplay?"play":this.autoplay())},e.manualAutoplay_=function(e){var n=this;if(this.tech_&&"string"==typeof e){var t,i=function(){var e=n.muted();n.muted(!0);function t(){n.muted(e)}n.playTerminatedQueue_.push(t);var i=n.play();if(St(i))return i.catch(function(e){throw t(),new Error("Rejection at manualAutoplay. Restoring muted value. "+(e||""))})};if("any"!==e||this.muted()?t="muted"!==e||this.muted()?this.play():i():St(t=this.play())&&(t=t.catch(i)),St(t))return t.then(function(){n.trigger({type:"autoplay-success",autoplay:e})}).catch(function(){n.trigger({type:"autoplay-failure",autoplay:e})})}},e.updateSourceCaches_=function(e){var t=e=void 0===e?"":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=function(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(function(e){return e.src===t});if(i.length)return i[0].type;for(var n=e.$$("source"),r=0;r<n.length;r++){var a=n[r];if(a.type&&a.src&&a.src===t)return a.type}return $i(t)}(this,t)),this.cache_.source=lt({},e,{src:t,type:i});for(var i=this.cache_.sources.filter(function(e){return e.src&&e.src===t}),n=[],r=this.$$("source"),a=[],s=0;s<r.length;s++){var o=ae(r[s]);n.push(o),o.src&&o.src===t&&a.push(o.src)}a.length&&!i.length?this.cache_.sources=n:i.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t},e.handleTechSourceset_=function(e){var t,i,n,r=this;this.changingSrc_||(t=function(e){return r.updateSourceCaches_(e)},i=this.currentSource().src,n=e.src,i&&!/^blob:/.test(i)&&/^blob:/.test(n)&&(this.lastSource_&&(this.lastSource_.tech===n||this.lastSource_.player===i)||(t=function(){})),t(n),e.src||this.tech_.any(["sourceset","loadstart"],function(e){"sourceset"!==e.type&&(e=r.techGet("currentSrc"),r.lastSource_.tech=e,r.updateSourceCaches_(e))})),this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})},e.hasStarted=function(e){if(void 0===e)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?(this.addClass("vjs-has-started"),this.trigger("firstplay")):this.removeClass("vjs-has-started"))},e.handleTechPlay_=function(){this.removeClass("vjs-ended"),this.removeClass("vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")},e.handleTechRateChange_=function(){0<this.tech_.playbackRate()&&0===this.cache_.lastPlaybackRate&&(this.queuedCallbacks_.forEach(function(e){return e.callback(e.event)}),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")},e.handleTechWaiting_=function(){var t=this;this.addClass("vjs-waiting"),this.trigger("waiting");var i=this.currentTime();this.on("timeupdate",function e(){i!==t.currentTime()&&(t.removeClass("vjs-waiting"),t.off("timeupdate",e))})},e.handleTechCanPlay_=function(){this.removeClass("vjs-waiting"),this.trigger("canplay")},e.handleTechCanPlayThrough_=function(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")},e.handleTechPlaying_=function(){this.removeClass("vjs-waiting"),this.trigger("playing")},e.handleTechSeeking_=function(){this.addClass("vjs-seeking"),this.trigger("seeking")},e.handleTechSeeked_=function(){this.removeClass("vjs-seeking"),this.removeClass("vjs-ended"),this.trigger("seeked")},e.handleTechFirstPlay_=function(){this.options_.starttime&&(h.warn("Passing the `starttime` option to the player will be deprecated in 6.0"),this.currentTime(this.options_.starttime)),this.addClass("vjs-has-started"),this.trigger("firstplay")},e.handleTechPause_=function(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")},e.handleTechEnded_=function(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")},e.handleTechDurationChange_=function(){this.duration(this.techGet_("duration"))},e.handleTechClick_=function(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()?Et(this.play()):this.pause()))},e.handleTechDoubleClick_=function(t){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),function(e){return 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()))},e.handleTechTap_=function(){this.userActive(!this.userActive())},e.handleTechTouchStart_=function(){this.userWasActive=this.userActive()},e.handleTechTouchMove_=function(){this.userWasActive&&this.reportUserActivity()},e.handleTechTouchEnd_=function(e){e.cancelable&&e.preventDefault()},e.handleStageClick_=function(){this.reportUserActivity()},e.toggleFullscreenClass_=function(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")},e.documentFullscreenChange_=function(e){var t=e.target.player;t&&t!==this||(e=this.el(),!(t=document[this.fsApi_.fullscreenElement]===e)&&e.matches?t=e.matches(":"+this.fsApi_.fullscreen):!t&&e.msMatchesSelector&&(t=e.msMatchesSelector(":"+this.fsApi_.fullscreen)),this.isFullscreen(t))},e.handleTechFullscreenChange_=function(e,t){var i=this;t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",function(){i.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))},e.handleTechFullscreenError_=function(e,t){this.trigger("fullscreenerror",t)},e.togglePictureInPictureClass_=function(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")},e.handleTechEnterPictureInPicture_=function(e){this.isInPictureInPicture(!0)},e.handleTechLeavePictureInPicture_=function(e){this.isInPictureInPicture(!1)},e.handleTechError_=function(){var e=this.tech_.error();this.error(e)},e.handleTechTextData_=function(){this.trigger("textdata",1<arguments.length?arguments[1]:null)},e.getCache=function(){return this.cache_},e.resetCache_=function(){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}},e.techCall_=function(n,r){this.ready(function(){if(n in Xi)return e=this.middleware_,t=this.tech_,i=r,t[t=n](e.reduce(Yi(t),i));if(n in Ki)return Gi(this.middleware_,this.tech_,n,r);var e,t,i;try{this.tech_&&this.tech_[n](r)}catch(e){throw h(e),e}},!0)},e.techGet_=function(t){if(this.tech_&&this.tech_.isReady_){if(t in zi)return e=this.middleware_,i=this.tech_,n=t,e.reduceRight(Yi(n),i[n]());if(t in Ki)return Gi(this.middleware_,this.tech_,t);var e,i,n;try{return this.tech_[t]()}catch(e){if(void 0===this.tech_[t])throw h("Video.js: "+t+" method not defined for "+this.techName_+" playback technology.",e),e;if("TypeError"===e.name)throw h("Video.js: "+t+" unavailable on "+this.techName_+" playback technology element.",e),this.tech_.isReady_=!1,e;throw h(e),e}}},e.play=function(){var t=this,e=this.options_.Promise||window.Promise;return e?new e(function(e){t.play_(e)}):this.play_()},e.play_=function(e){var t=this;this.playCallbacks_.push(e=void 0===e?Et:e);var i=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),e=Boolean(q||V);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!i)return this.waitToPlay_=function(e){t.play_()},this.one(["ready","loadstart"],this.waitToPlay_),void(!i&&e&&this.load());i=this.techGet_("play");e&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),null===i?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(i)},e.runPlayTerminatedQueue_=function(){var e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(e){e()})},e.runPlayCallbacks_=function(t){var e=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],e.forEach(function(e){e(t)})},e.pause=function(){this.techCall_("pause")},e.paused=function(){return!1!==this.techGet_("paused")},e.played=function(){return this.techGet_("played")||vt(0,0)},e.scrubbing=function(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")},e.currentTime=function(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)},e.applyInitTime_=function(){this.currentTime(this.cache_.initTime)},e.duration=function(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"))},e.remainingTime=function(){return this.duration()-this.currentTime()},e.remainingTimeDisplay=function(){return Math.floor(this.duration())-Math.floor(this.currentTime())},e.buffered=function(){var e;return e=!(e=this.techGet_("buffered"))||!e.length?vt(0,0):e},e.bufferedPercent=function(){return _t(this.buffered(),this.duration())},e.bufferedEnd=function(){var e=this.buffered(),t=this.duration(),e=e.end(e.length-1);return e=t<e?t:e},e.volume=function(e){var t;return void 0!==e?(t=Math.max(0,Math.min(1,parseFloat(e))),this.cache_.volume=t,this.techCall_("setVolume",t),void(0<t&&this.lastVolume_(t))):(t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t)},e.muted=function(e){if(void 0===e)return this.techGet_("muted")||!1;this.techCall_("setMuted",e)},e.defaultMuted=function(e){return void 0!==e?this.techCall_("setDefaultMuted",e):this.techGet_("defaultMuted")||!1},e.lastVolume_=function(e){if(void 0===e||0===e)return this.cache_.lastVolume;this.cache_.lastVolume=e},e.supportsFullScreen=function(){return this.techGet_("supportsFullScreen")||!1},e.isFullscreen=function(e){if(void 0===e)return this.isFullscreen_;var t=this.isFullscreen_;this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_()},e.requestFullscreen=function(s){var e=this.options_.Promise||window.Promise;if(e){var o=this;return new e(function(e,i){function n(){o.off("fullscreenerror",r),o.off("fullscreenchange",t)}function t(){n(),e()}function r(e,t){n(),i(t)}o.one("fullscreenchange",t),o.one("fullscreenerror",r);var a=o.requestFullscreenHelper_(s);a&&(a.then(n,n),a.then(e,i))})}return this.requestFullscreenHelper_()},e.requestFullscreenHelper_=function(e){var t=this;if(this.fsApi_.prefixed||(i=this.options_.fullscreen&&this.options_.fullscreen.options||{},void 0!==e&&(i=e)),this.fsApi_.requestFullscreen){var i=this.el_[this.fsApi_.requestFullscreen](i);return i&&i.then(function(){return t.isFullscreen(!0)},function(){return t.isFullscreen(!1)}),i}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()},e.exitFullscreen=function(){var e=this.options_.Promise||window.Promise;if(e){var s=this;return new e(function(e,i){function n(){s.off("fullscreenerror",r),s.off("fullscreenchange",t)}function t(){n(),e()}function r(e,t){n(),i(t)}s.one("fullscreenchange",t),s.one("fullscreenerror",r);var a=s.exitFullscreenHelper_();a&&(a.then(n,n),a.then(e,i))})}return this.exitFullscreenHelper_()},e.exitFullscreenHelper_=function(){var e=this;if(this.fsApi_.requestFullscreen){var t=document[this.fsApi_.exitFullscreen]();return t&&Et(t.then(function(){return e.isFullscreen(!1)})),t}this.tech_.supportsFullScreen()&&!0==!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()},e.enterFullWindow=function(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=document.documentElement.style.overflow,Be(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow="hidden",te(document.body,"vjs-full-window"),this.trigger("enterFullWindow")},e.fullWindowOnEscKey=function(e){ht.isEventKey(e,"Esc")&&!0===this.isFullscreen()&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())},e.exitFullWindow=function(){this.isFullscreen(!1),this.isFullWindow=!1,Fe(document,"keydown",this.boundFullWindowOnEscKey_),document.documentElement.style.overflow=this.docOrigOverflow,ie(document.body,"vjs-full-window"),this.trigger("exitFullWindow")},e.disablePictureInPicture=function(e){if(void 0===e)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")},e.isInPictureInPicture=function(e){return void 0!==e?(this.isInPictureInPicture_=!!e,void this.togglePictureInPictureClass_()):!!this.isInPictureInPicture_},e.requestPictureInPicture=function(){if("pictureInPictureEnabled"in document&&!1===this.disablePictureInPicture())return this.techGet_("requestPictureInPicture")},e.exitPictureInPicture=function(){if("pictureInPictureEnabled"in document)return document.exitPictureInPicture()},e.handleKeyDown=function(e){var t=this.options_.userActions;t&&t.hotkeys&&(function(e){var t=e.tagName.toLowerCase();if(e.isContentEditable)return!0;if("input"===t)return-1===["button","checkbox","hidden","radio","reset","submit"].indexOf(e.type);return-1!==["textarea"].indexOf(t)}(this.el_.ownerDocument.activeElement)||("function"==typeof t.hotkeys?t.hotkeys.call(this,e):this.handleHotkeys(e)))},e.handleHotkeys=function(e){var t=this.options_.userActions?this.options_.userActions.hotkeys:{},i=t.fullscreenKey,n=t.muteKey,n=void 0===n?function(e){return ht.isEventKey(e,"m")}:n,t=t.playPauseKey,t=void 0===t?function(e){return ht.isEventKey(e,"k")||ht.isEventKey(e,"Space")}:t;(void 0===i?function(e){return ht.isEventKey(e,"f")}:i).call(this,e)?(e.preventDefault(),e.stopPropagation(),i=pt.getComponent("FullscreenToggle"),!1!==document[this.fsApi_.fullscreenEnabled]&&i.prototype.handleClick.call(this,e)):n.call(this,e)?(e.preventDefault(),e.stopPropagation(),pt.getComponent("MuteToggle").prototype.handleClick.call(this,e)):t.call(this,e)&&(e.preventDefault(),e.stopPropagation(),pt.getComponent("PlayToggle").prototype.handleClick.call(this,e))},e.canPlayType=function(e){for(var t,i=0,n=this.options_.techOrder;i<n.length;i++){var r=n[i],a=ji.getTech(r);if(a=a||pt.getComponent(r)){if(a.isSupported()&&(t=a.canPlayType(e)))return t}else h.error('The "'+r+'" tech is undefined. Skipped browser support check for that tech.')}return""},e.selectSource=function(e){function t(e,i,n){var r;return e.some(function(t){return i.some(function(e){if(r=n(t,e))return!0})}),r}var i,n=this,r=this.options_.techOrder.map(function(e){return[e,ji.getTech(e)]}).filter(function(e){var t=e[0],e=e[1];return e?e.isSupported():(h.error('The "'+t+'" tech is undefined. Skipped browser support check for that tech.'),!1)}),a=function(e,t){var i=e[0];if(e[1].canPlaySource(t,n.options_[i.toLowerCase()]))return{source:t,tech:i}},a=this.options_.sourceOrder?t(e,r,(i=a,function(e,t){return i(t,e)})):t(r,e,a);return a||!1},e.handleSrc_=function(e,n){var r=this;if("undefined"==typeof e)return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();var t,i,a=Ji(e);a.length?(this.changingSrc_=!0,n||(this.cache_.sources=a),this.updateSourceCaches_(a[0]),Wi(this,a[0],function(e,t){var i;return r.middleware_=t,n||(r.cache_.sources=a),r.updateSourceCaches_(e),r.src_(e)?1<a.length?r.handleSrc_(a.slice(1)):(r.changingSrc_=!1,r.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),void r.triggerReady()):(t=t,i=r.tech_,void t.forEach(function(e){return e.setTech&&e.setTech(i)}))}),this.options_.retryOnError&&1<a.length&&(i=function(){r.off("error",t)},this.one("error",t=function(){r.error(null),r.handleSrc_(a.slice(1),!0)}),this.one("playing",i),this.resetRetryOnError_=function(){r.off("error",t),r.off("playing",i)})):this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0)},e.src=function(e){return this.handleSrc_(e,!1)},e.src_=function(e){var t,i,n=this,r=this.selectSource([e]);return!r||(t=r.tech,i=this.techName_,ut(t)!==ut(i)?(this.changingSrc_=!0,this.loadTech_(r.tech,r.source),this.tech_.ready(function(){n.changingSrc_=!1})):this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1)},e.load=function(){this.techCall_("load")},e.reset=function(){var e=this,t=this.options_.Promise||window.Promise;this.paused()||!t?this.doReset_():Et(this.play().then(function(){return e.doReset_()}))},e.doReset_=function(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),it(this)&&this.trigger("playerreset")},e.resetControlBarUI_=function(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()},e.resetProgressBar_=function(){this.currentTime(0);var e=this.controlBar||{},t=e.durationDisplay,e=e.remainingTimeDisplay;t&&t.updateContent(),e&&e.updateContent()},e.resetPlaybackRate_=function(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()},e.resetVolumeBar_=function(){this.volume(1),this.trigger("volumechange")},e.currentSources=function(){var e=this.currentSource(),t=[];return 0!==Object.keys(e).length&&t.push(e),this.cache_.sources||t},e.currentSource=function(){return this.cache_.source||{}},e.currentSrc=function(){return this.currentSource()&&this.currentSource().src||""},e.currentType=function(){return this.currentSource()&&this.currentSource().type||""},e.preload=function(e){return void 0!==e?(this.techCall_("setPreload",e),void(this.options_.preload=e)):this.techGet_("preload")},e.autoplay=function(e){if(void 0===e)return this.options_.autoplay||!1;var 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)},e.playsinline=function(e){return void 0!==e?(this.techCall_("setPlaysinline",e),this.options_.playsinline=e,this):this.techGet_("playsinline")},e.loop=function(e){return void 0!==e?(this.techCall_("setLoop",e),void(this.options_.loop=e)):this.techGet_("loop")},e.poster=function(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"))},e.handleTechPosterChange_=function(){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"))},e.controls=function(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_()))},e.usingNativeControls=function(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")))},e.error=function(t){var i=this;if(void 0===t)return this.error_||null;if(a("beforeerror").forEach(function(e){e=e(i,t);T(e)&&!Array.isArray(e)||"string"==typeof e||"number"==typeof e||null===e?t=e:i.log.error("please return a value that MediaError expects in beforeerror hooks")}),this.options_.suppressNotSupportedError&&t&&4===t.code){var e=function(){this.error(t)};return this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],e),void this.one("loadstart",function(){this.off(["click","touchstart"],e)})}if(null===t)return this.error_=t,this.removeClass("vjs-error"),void(this.errorDisplay&&this.errorDisplay.close());this.error_=new bt(t),this.addClass("vjs-error"),h.error("(CODE:"+this.error_.code+" "+bt.errorTypes[this.error_.code]+")",this.error_.message,this.error_),this.trigger("error"),a("error").forEach(function(e){return e(i,i.error_)})},e.reportUserActivity=function(e){this.userActivity_=!0},e.userActive=function(e){if(void 0===e)return this.userActive_;if((e=!!e)!==this.userActive_){if(this.userActive_=e,this.userActive_)return this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),void 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")}},e.listenForUserActivity_=function(){var t,i,n,r=qe(this,this.reportUserActivity),e=function(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===n||(i=e.screenX,n=e.screenY,r())}),this.on("mouseup",e),this.on("mouseleave",e);var a,e=this.getChild("controlBar");!e||V||A||(e.on("mouseenter",function(e){0!==this.player().options_.inactivityTimeout&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),e.on("mouseleave",function(e){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r),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)},e.playbackRate=function(e){if(void 0===e)return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1;this.techCall_("setPlaybackRate",e)},e.defaultPlaybackRate=function(e){return void 0!==e?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1},e.isAudio=function(e){if(void 0===e)return!!this.isAudio_;this.isAudio_=!!e},e.enableAudioOnlyUI_=function(){var t=this;this.addClass("vjs-audio-only-mode");var e=this.children(),i=this.getChild("ControlBar"),n=i&&i.currentHeight();e.forEach(function(e){e!==i&&e.el_&&!e.hasClass("vjs-hidden")&&(e.hide(),t.audioOnlyCache_.hiddenChildren.push(e))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(n),this.trigger("audioonlymodechange")},e.disableAudioOnlyUI_=function(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(function(e){return e.show()}),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")},e.audioOnlyMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioOnlyMode_)return this.audioOnlyMode_;this.audioOnlyMode_=e;var i=this.options_.Promise||window.Promise;if(i){if(e){var n=[];return this.isInPictureInPicture()&&n.push(this.exitPictureInPicture()),this.isFullscreen()&&n.push(this.exitFullscreen()),this.audioPosterMode()&&n.push(this.audioPosterMode(!1)),i.all(n).then(function(){return t.enableAudioOnlyUI_()})}return i.resolve().then(function(){return t.disableAudioOnlyUI_()})}e?(this.isInPictureInPicture()&&this.exitPictureInPicture(),this.isFullscreen()&&this.exitFullscreen(),this.enableAudioOnlyUI_()):this.disableAudioOnlyUI_()},e.enablePosterModeUI_=function(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},e.disablePosterModeUI_=function(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")},e.audioPosterMode=function(e){var t=this;if("boolean"!=typeof e||e===this.audioPosterMode_)return this.audioPosterMode_;this.audioPosterMode_=e;var i=this.options_.Promise||window.Promise;return i?e?(this.audioOnlyMode()?this.audioOnlyMode(!1):i.resolve()).then(function(){t.enablePosterModeUI_()}):i.resolve().then(function(){t.disablePosterModeUI_()}):e?(this.audioOnlyMode()&&this.audioOnlyMode(!1),void this.enablePosterModeUI_()):void this.disablePosterModeUI_()},e.addTextTrack=function(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)},e.addRemoteTextTrack=function(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)},e.removeRemoteTextTrack=function(e){var t=(t=(e=void 0===e?{}:e).track)||e;if(this.tech_)return this.tech_.removeRemoteTextTrack(t)},e.getVideoPlaybackQuality=function(){return this.techGet_("getVideoPlaybackQuality")},e.videoWidth=function(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0},e.videoHeight=function(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0},e.language=function(e){if(void 0===e)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),it(this)&&this.trigger("languagechange"))},e.languages=function(){return lt(o.prototype.options_.languages,this.languages_)},e.toJSON=function(){var e=lt(this.options_),t=e.tracks;e.tracks=[];for(var i=0;i<t.length;i++){var n=t[i];(n=lt(n)).player=void 0,e.tracks[i]=n}return e},e.createModal=function(e,t){var i=this;(t=t||{}).content=e||"";var n=new At(this,t);return this.addChild(n),n.on("dispose",function(){i.removeChild(n)}),n.open(),n},e.updateCurrentBreakpoint_=function(){if(this.responsive())for(var e=this.currentBreakpoint(),t=this.currentWidth(),i=0;i<Nn.length;i++){var n=Nn[i];if(t<=this.breakpoints_[n]){if(e===n)return;e&&this.removeClass(Un[e]),this.addClass(Un[n]),this.breakpoint_=n;break}}},e.removeCurrentBreakpoint_=function(){var e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)},e.breakpoints=function(e){return void 0===e||(this.breakpoint_="",this.breakpoints_=b({},Bn,e),this.updateCurrentBreakpoint_()),b(this.breakpoints_)},e.responsive=function(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},e.currentBreakpoint=function(){return this.breakpoint_},e.currentBreakpointClass=function(){return Un[this.breakpoint_]||""},e.loadMedia=function(e,t){var i,n,r,a=this;e&&"object"==typeof e&&(this.reset(),this.cache_.media=lt(e),i=(r=this.cache_.media).artwork,n=r.poster,e=r.src,r=r.textTracks,!i&&n&&(this.cache_.media.artwork=[{src:n,type:$i(n)}]),e&&this.src(e),n&&this.poster(n),Array.isArray(r)&&r.forEach(function(e){return a.addRemoteTextTrack(e,!1)}),this.ready(t))},e.getMedia=function(){if(this.cache_.media)return lt(this.cache_.media);var e=this.poster(),t={src:this.currentSources(),textTracks:Array.prototype.map.call(this.remoteTextTracks(),function(e){return{kind:e.kind,label:e.label,language:e.language,src:e.src}})};return e&&(t.poster=e,t.artwork=[{src:t.poster,type:$i(t.poster)}]),t},o.getTagSettings=function(e){var t,i={sources:[],tracks:[]},n=ae(e),r=n["data-setup"];if(ee(e,"vjs-fill")&&(n.fill=!0),ee(e,"vjs-fluid")&&(n.fluid=!0),null!==r&&(r=(t=wt(r||"{}"))[0],t=t[1],r&&h.error(r),b(n,t)),b(i,n),e.hasChildNodes())for(var a=e.childNodes,s=0,o=a.length;s<o;s++){var u=a[s],l=u.nodeName.toLowerCase();"source"===l?i.sources.push(ae(u)):"track"===l&&i.tracks.push(ae(u))}return i},e.flexNotSupported_=function(){var e=document.createElement("i");return!("flexBasis"in e.style||"webkitFlexBasis"in e.style||"mozFlexBasis"in e.style||"msFlexBasis"in e.style||"msFlexOrder"in e.style)},e.debug=function(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)},e.playbackRates=function(e){if(void 0===e)return this.cache_.playbackRates;Array.isArray(e)&&e.every(function(e){return"number"==typeof e})&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))},o}(pt);oi.names.forEach(function(e){var t=oi[e];Fn.prototype[t.getterName]=function(){return this.tech_?this.tech_[t.getterName]():(this[t.privateName]=this[t.privateName]||new t.ListClass,this[t.privateName])}}),Fn.prototype.crossorigin=Fn.prototype.crossOrigin,Fn.players={};k=window.navigator;Fn.prototype.options_={techOrder:ji.defaultTechOrder_,html5:{},inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:k&&(k.languages&&k.languages[0]||k.userLanguage||k.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){Fn.prototype[e]=function(){return this.techGet_(e)}}),Rn.forEach(function(e){Fn.prototype["handleTech"+ut(e)+"_"]=function(){return this.trigger(e)}}),pt.registerComponent("Player",Fn);var jn=m(function(i){function n(e,t){return i.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(e,t)}i.exports=n});function Hn(e){return Qn.hasOwnProperty(e)}function Vn(e){return Hn(e)?Qn[e]:void 0}function qn(e,t,i){i=(i?"before":"")+"pluginsetup",e.trigger(i,t),e.trigger(i+":"+t.name,t)}function Wn(t,i){function n(){qn(this,{name:t,plugin:i,instance:null},!0);var e=i.apply(this,arguments);return $n(this,t),qn(this,{name:t,plugin:i,instance:e}),e}return Object.keys(i).forEach(function(e){n[e]=i[e]}),n}function Gn(r,a){return a.prototype.name=r,function(){qn(this,{name:r,plugin:a,instance:null},!0);for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=Xn(a,[this].concat(t));return this[r]=function(){return n},qn(this,n.getEventHash()),n}}var zn=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}},Xn=m(function(n){function r(e,t,i){return zn()?n.exports=r=Reflect.construct:n.exports=r=function(e,t,i){var n=[null];n.push.apply(n,t);n=new(Function.bind.apply(e,n));return i&&jn(n,i.prototype),n},r.apply(null,arguments)}n.exports=r}),Kn="plugin",Yn="activePlugins_",Qn={},$n=function(e,t){e[Yn]=e[Yn]||{},e[Yn][t]=!0},Jn=function(){function i(e){if(this.constructor===i)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),rt(this),delete this.trigger,st(this,this.constructor.defaultState),$n(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}var e=i.prototype;return e.version=function(){return this.constructor.VERSION},e.getEventHash=function(e){return(e=void 0===e?{}:e).name=this.name,e.plugin=this.constructor,e.instance=this,e},e.trigger=function(e,t){return je(this.eventBusEl_,e,this.getEventHash(t=void 0===t?{}:t))},e.handleStateChanged=function(e){},e.dispose=function(){var e=this.name,t=this.player;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[Yn][e]=!1,this.player=this.state=null,t[e]=Gn(e,Qn[e])},i.isBasic=function(e){e="string"==typeof e?Vn(e):e;return"function"==typeof e&&!i.prototype.isPrototypeOf(e.prototype)},i.registerPlugin=function(e,t){if("string"!=typeof e)throw new Error('Illegal plugin name, "'+e+'", must be a string, was '+typeof e+".");if(Hn(e))h.warn('A plugin named "'+e+'" already exists. You may want to avoid re-registering plugins!');else if(Fn.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 Qn[e]=t,e!==Kn&&(i.isBasic(t)?Fn.prototype[e]=Wn(e,t):Fn.prototype[e]=Gn(e,t)),t},i.deregisterPlugin=function(e){if(e===Kn)throw new Error("Cannot de-register base plugin.");Hn(e)&&(delete Qn[e],delete Fn.prototype[e])},i.getPlugins=function(e){var i;return(e=void 0===e?Object.keys(Qn):e).forEach(function(e){var t=Vn(e);t&&((i=i||{})[e]=t)}),i},i.getPluginVersion=function(e){e=Vn(e);return e&&e.VERSION||""},i}();Jn.getPlugin=Vn,Jn.BASE_PLUGIN_NAME=Kn,Jn.registerPlugin(Kn,Jn),Fn.prototype.usingPlugin=function(e){return!!this[Yn]&&!0===this[Yn][e]},Fn.prototype.hasPlugin=function(e){return!!Hn(e)};var Zn=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jn(e,t)},er=!1,tr=function(e){return 0===e.indexOf("#")?e.slice(1):e};function ir(e,t,i){if(r=ir.getPlayer(e))return t&&h.warn('Player "'+e+'" is already initialised. Options will not be applied.'),i&&r.ready(i),r;var n="string"==typeof e?Te("#"+tr(e)):e;if(!K(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");n.ownerDocument.defaultView&&n.ownerDocument.body.contains(n)||h.warn("The element supplied is not included in the DOM"),!0===(t=t||{}).restoreEl&&(t.restoreEl=(n.parentNode&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),a("beforesetup").forEach(function(e){e=e(n,lt(t));T(e)&&!Array.isArray(e)?t=lt(t,e):h.error("please return an object in beforesetup hooks")});var r=new(pt.getComponent("Player"))(n,t,i);return a("setup").forEach(function(e){return e(r)}),r}ir.hooks_=i,ir.hooks=a,ir.hook=function(e,t){a(e,t)},ir.hookOnce=function(i,e){a(i,[].concat(e).map(function(t){return function e(){return n(i,e),t.apply(void 0,arguments)}}))},ir.removeHook=n,!0!==window.VIDEOJS_NO_DYNAMIC_STYLE&&X()&&((Qr=Te(".vjs-styles-defaults"))||(Qr=xe("vjs-styles-defaults"),(ar=Te("head"))&&ar.insertBefore(Qr,ar.firstChild),Ae(Qr,"\n      .video-js {\n        width: 300px;\n        height: 150px;\n      }\n\n      .vjs-fluid:not(.vjs-audio-only-mode) {\n        padding-top: 56.25%\n      }\n    "))),Ce(1,ir),ir.VERSION=u,ir.options=Fn.prototype.options_,ir.getPlayers=function(){return Fn.players},ir.getPlayer=function(e){var t=Fn.players;if("string"==typeof e){var i=tr(e),n=t[i];if(n)return n;i=Te("#"+i)}else i=e;if(K(i)){e=i.player,i=i.playerId;if(e||t[i])return e||t[i]}},ir.getAllPlayers=function(){return Object.keys(Fn.players).map(function(e){return Fn.players[e]}).filter(Boolean)},ir.players=Fn.players,ir.getComponent=pt.getComponent,ir.registerComponent=function(e,t){ji.isTech(t)&&h.warn("The "+e+" tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)"),pt.registerComponent.call(pt,e,t)},ir.getTech=ji.getTech,ir.registerTech=ji.registerTech,ir.use=function(e,t){Hi[e]=Hi[e]||[],Hi[e].push(t)},Object.defineProperty(ir,"middleware",{value:{},writeable:!1,enumerable:!0}),Object.defineProperty(ir.middleware,"TERMINATOR",{value:qi,writeable:!1,enumerable:!0}),ir.browser=W,ir.TOUCH_ENABLED=F,ir.extend=function(e,t){void 0===t&&(t={}),er||(h.warn("videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0"),er=!0);var i,n=function(){e.apply(this,arguments)},r={};for(i in"object"==typeof t?(t.constructor!==Object.prototype.constructor&&(n=t.constructor),r=t):"function"==typeof t&&(n=t),Zn(n,e),e&&(n.super_=e),r)r.hasOwnProperty(i)&&(n.prototype[i]=r[i]);return n},ir.mergeOptions=lt,ir.bind=qe,ir.registerPlugin=Jn.registerPlugin,ir.deregisterPlugin=Jn.deregisterPlugin,ir.plugin=function(e,t){return h.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Jn.registerPlugin(e,t)},ir.getPlugins=Jn.getPlugins,ir.getPlugin=Jn.getPlugin,ir.getPluginVersion=Jn.getPluginVersion,ir.addLanguage=function(e,t){var i;return e=(""+e).toLowerCase(),ir.options.languages=lt(ir.options.languages,((i={})[e]=t,i)),ir.options.languages[e]},ir.log=h,ir.createLogger=p,ir.createTimeRange=ir.createTimeRanges=vt,ir.formatTime=ln,ir.setFormatTime=function(e){un=e},ir.resetFormatTime=function(){un=on},ir.parseUrl=Rt,ir.isCrossOrigin=Ut,ir.EventTarget=ze,ir.on=Be,ir.one=He,ir.off=Fe,ir.trigger=je,ir.xhr=Jt,ir.TextTrack=ri,ir.AudioTrack=x,ir.VideoTrack=U,["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(function(e){ir[e]=function(){return h.warn("videojs."+e+"() is deprecated; use videojs.dom."+e+"() instead"),Se[e].apply(null,arguments)}}),ir.computedStyle=S,ir.dom=Se,ir.url=zt,ir.defineLazyProperty=An,ir.addLanguage("en",{"Non-Fullscreen":"Exit Fullscreen"});var nr=m(function(e,t){var i,a,n,r,s;i=/^((?:[a-zA-Z0-9+\-.]+:)?)(\/\/[^\/?#]*)?((?:[^\/?#]*\/)*[^;?#]*)?(;[^?#]*)?(\?[^#]*)?(#[^]*)?$/,a=/^([^\/?#]*)([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,r=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(e,t,i){if(i=i||{},e=e.trim(),!(t=t.trim())){if(!i.alwaysNormalize)return e;var n=s.parseURL(e);if(!n)throw new Error("Error trying to parse base URL.");return n.path=s.normalizePath(n.path),s.buildURLFromParts(n)}n=s.parseURL(t);if(!n)throw new Error("Error trying to parse relative URL.");if(n.scheme)return i.alwaysNormalize?(n.path=s.normalizePath(n.path),s.buildURLFromParts(n)):t;t=s.parseURL(e);if(!t)throw new Error("Error trying to parse base URL.");!t.netLoc&&t.path&&"/"!==t.path[0]&&(r=a.exec(t.path),t.netLoc=r[1],t.path=r[2]),t.netLoc&&!t.path&&(t.path="/");var r,e={scheme:t.scheme,netLoc:n.netLoc,path:null,params:n.params,query:n.query,fragment:n.fragment};return n.netLoc||(e.netLoc=t.netLoc,"/"!==n.path[0]&&(n.path?(r=(r=t.path).substring(0,r.lastIndexOf("/")+1)+n.path,e.path=s.normalizePath(r)):(e.path=t.path,n.params||(e.params=t.params,n.query||(e.query=t.query))))),null===e.path&&(e.path=i.alwaysNormalize?s.normalizePath(n.path):n.path),s.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(n,"");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=s}),rr="http://example.com",ar=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;t=this.listeners[e].indexOf(t);return 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,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(t){this.on("data",function(e){t.push(e)})},e}(),sr=function(e){return window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")};function or(e){var t=/([0-9.]*)?@?([0-9.]*)?/.exec(e||""),e={};return t[1]&&(e.length=parseInt(t[1],10)),t[2]&&(e.offset=parseInt(t[2],10)),e}function ur(e){for(var t,i=e.split(new RegExp('(?:^|,)((?:[^=]*)=(?:"[^"]*"|[^,]*))')),n={},r=i.length;r--;)""!==i[r]&&((t=/([^=]*)=(.*)/.exec(i[r]).slice(1))[0]=t[0].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^\s+|\s+$/g,""),t[1]=t[1].replace(/^['"](.*)['"]$/g,"$1"),n[t[0]]=t[1]);return n}function lr(t){var i={};return Object.keys(t).forEach(function(e){i[e.toLowerCase().replace(/-(\w)/g,function(e){return e[1].toUpperCase()})]=t[e]}),i}function dr(e){var t,i,n,r,a=e.serverControl,s=e.targetDuration,o=e.partTargetDuration;a&&(t="#EXT-X-SERVER-CONTROL",i="holdBack",n="partHoldBack",r=s&&3*s,e=o&&2*o,s&&!a.hasOwnProperty(i)&&(a[i]=r,this.trigger("info",{message:t+" defaulting HOLD-BACK to targetDuration * 3 ("+r+")."})),r&&a[i]<r&&(this.trigger("warn",{message:t+" clamping HOLD-BACK ("+a[i]+") to targetDuration * 3 ("+r+")"}),a[i]=r),o&&!a.hasOwnProperty(n)&&(a[n]=3*o,this.trigger("info",{message:t+" defaulting PART-HOLD-BACK to partTargetDuration * 3 ("+a[n]+")."})),o&&a[n]<e&&(this.trigger("warn",{message:t+" clamping PART-HOLD-BACK ("+a[n]+") to partTargetDuration * 2 ("+e+")."}),a[n]=e))}function cr(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)})}function hr(e){var e=(e=void 0===e?"":e).split(","),a=[];return e.forEach(function(n){var r;n=n.trim(),Ar.forEach(function(e){var t,i=xr[e].exec(n.toLowerCase());!i||i.length<=1||(r=e,t=n.substring(0,i[1].length),i=n.replace(t,""),a.push({type:t,details:i,mediaType:e}))}),r||a.push({type:n,details:"",mediaType:"unknown"})}),a}function pr(e){return xr.audio.test((e=void 0===e?"":e).trim().toLowerCase())}function fr(e){if(e&&"string"==typeof e){var t=e.toLowerCase().split(",").map(function(e){return cr(e.trim())}),i="video";1===t.length&&pr(t[0])?i="audio":1===t.length&&(n=t[0],xr.text.test((n=void 0===n?"":n).trim().toLowerCase()))&&(i="application");var n="mp4";return t.every(function(e){return xr.mp4.test(e)})?n="mp4":t.every(function(e){return xr.webm.test(e)})?n="webm":t.every(function(e){return xr.ogg.test(e)})&&(n="ogg"),i+"/"+n+';codecs="'+e+'"'}}function mr(e){return void 0===e&&(e=""),window.MediaSource&&window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported(fr(e))||!1}function gr(e){return(e=void 0===e?"":e).toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<Pr.length;t++)if(xr["muxer"+Pr[t]].test(e))return!0;return!1})}function yr(e){return Or.test(e)?"hls":Dr.test(e)?"dash":"application/vnd.videojs.vhs+json"===e?"vhs-json":null}function vr(e){return"function"===ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer}function _r(e){return e instanceof Uint8Array?e:(Array.isArray(e)||Rr(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))}function br(e,t){var i=void 0!==(t=(void 0===t?{}:t).le)&&t;e=Mr(e="bigint"!=typeof e&&"number"!=typeof e||"number"==typeof e&&e!=e?0:e);for(var n=(t=e,Math.ceil(t.toString(2).length/8)),r=new Uint8Array(new ArrayBuffer(n)),a=0;a<n;a++){var s=i?a:Math.abs(a+1-r.length);r[s]=Number(e/Nr[a]&Mr(255)),e<0&&(r[s]=Math.abs(~r[s]),r[s]-=0===a?1:2)}return r}function Tr(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),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i}function wr(i,e,t){var n=void 0===t?{}:t,r=void 0===(t=n.offset)?0:t,a=void 0===(n=n.mask)?[]:n;return i=_r(i),n=(e=_r(e)).every||Array.prototype.every,e.length&&i.length-r>=e.length&&n.call(e,function(e,t){return e===(a[t]?a[t]&i[r+t]:i[r+t])})}function Sr(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,n=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);if(i?e=new window.URL(e,window.location||Ur):/\/\//i.test(e)||(e=nr.buildAbsoluteURL(window.location&&window.location.href||"",e)),i){i=new URL(t,e);return r?i.href.slice(Ur.length):n?i.href.slice(i.protocol.length):i.href}return nr.buildAbsoluteURL(e,t)}
/*! @name m3u8-parser @version 4.8.0 @license Apache-2.0 */
var Er=function(t){function e(){var e=t.call(this)||this;return e.buffer="",e}return mt(e,t),e.prototype.push=function(e){var 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)},e}(ar),kr=String.fromCharCode(9),Cr=function(t){function e(){var e=t.call(this)||this;return e.customParsers=[],e.tagMappers=[],e}mt(e,t);var i=e.prototype;return i.push=function(i){var r,a,s=this;0!==(i=i.trim()).length&&("#"===i[0]?this.tagMappers.reduce(function(e,t){t=t(i);return t===i?e:e.concat([t])},[i]).forEach(function(e){for(var t,i,n=0;n<s.customParsers.length;n++)if(s.customParsers[n].call(s,e))return;if(0===e.indexOf("#EXT"))if(e=e.replace("\r",""),r=/^#EXTM3U/.exec(e))s.trigger("data",{type:"tag",tagType:"m3u"});else{if(r=/^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(e))return a={type:"tag",tagType:"inf"},r[1]&&(a.duration=parseFloat(r[1])),r[2]&&(a.title=r[2]),void s.trigger("data",a);if(r=/^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(e))return a={type:"tag",tagType:"targetduration"},r[1]&&(a.duration=parseInt(r[1],10)),void s.trigger("data",a);if(r=/^#EXT-X-VERSION:?([0-9.]*)?/.exec(e))return a={type:"tag",tagType:"version"},r[1]&&(a.version=parseInt(r[1],10)),void s.trigger("data",a);if(r=/^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return a={type:"tag",tagType:"media-sequence"},r[1]&&(a.number=parseInt(r[1],10)),void s.trigger("data",a);if(r=/^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(e))return a={type:"tag",tagType:"discontinuity-sequence"},r[1]&&(a.number=parseInt(r[1],10)),void s.trigger("data",a);if(r=/^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(e))return a={type:"tag",tagType:"playlist-type"},r[1]&&(a.playlistType=r[1]),void s.trigger("data",a);if(r=/^#EXT-X-BYTERANGE:?(.*)?$/.exec(e))return a=g(or(r[1]),{type:"tag",tagType:"byterange"}),void s.trigger("data",a);if(r=/^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(e))return a={type:"tag",tagType:"allow-cache"},r[1]&&(a.allowed=!/NO/.test(r[1])),void s.trigger("data",a);if(r=/^#EXT-X-MAP:?(.*)$/.exec(e))return a={type:"tag",tagType:"map"},r[1]&&((t=ur(r[1])).URI&&(a.uri=t.URI),t.BYTERANGE&&(a.byterange=or(t.BYTERANGE))),void s.trigger("data",a);if(r=/^#EXT-X-STREAM-INF:?(.*)$/.exec(e))return a={type:"tag",tagType:"stream-inf"},r[1]&&(a.attributes=ur(r[1]),a.attributes.RESOLUTION&&(i={},(t=a.attributes.RESOLUTION.split("x"))[0]&&(i.width=parseInt(t[0],10)),t[1]&&(i.height=parseInt(t[1],10)),a.attributes.RESOLUTION=i),a.attributes.BANDWIDTH&&(a.attributes.BANDWIDTH=parseInt(a.attributes.BANDWIDTH,10)),a.attributes["FRAME-RATE"]&&(a.attributes["FRAME-RATE"]=parseFloat(a.attributes["FRAME-RATE"])),a.attributes["PROGRAM-ID"]&&(a.attributes["PROGRAM-ID"]=parseInt(a.attributes["PROGRAM-ID"],10))),void s.trigger("data",a);if(r=/^#EXT-X-MEDIA:?(.*)$/.exec(e))return a={type:"tag",tagType:"media"},r[1]&&(a.attributes=ur(r[1])),void s.trigger("data",a);if(r=/^#EXT-X-ENDLIST/.exec(e))s.trigger("data",{type:"tag",tagType:"endlist"});else{if(!(r=/^#EXT-X-DISCONTINUITY/.exec(e)))return(r=/^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(e))?(a={type:"tag",tagType:"program-date-time"},r[1]&&(a.dateTimeString=r[1],a.dateTimeObject=new Date(r[1])),void s.trigger("data",a)):(r=/^#EXT-X-KEY:?(.*)$/.exec(e))?(a={type:"tag",tagType:"key"},r[1]&&(a.attributes=ur(r[1]),a.attributes.IV&&("0x"===a.attributes.IV.substring(0,2).toLowerCase()&&(a.attributes.IV=a.attributes.IV.substring(2)),a.attributes.IV=a.attributes.IV.match(/.{8}/g),a.attributes.IV[0]=parseInt(a.attributes.IV[0],16),a.attributes.IV[1]=parseInt(a.attributes.IV[1],16),a.attributes.IV[2]=parseInt(a.attributes.IV[2],16),a.attributes.IV[3]=parseInt(a.attributes.IV[3],16),a.attributes.IV=new Uint32Array(a.attributes.IV))),void s.trigger("data",a)):(r=/^#EXT-X-START:?(.*)$/.exec(e))?(a={type:"tag",tagType:"start"},r[1]&&(a.attributes=ur(r[1]),a.attributes["TIME-OFFSET"]=parseFloat(a.attributes["TIME-OFFSET"]),a.attributes.PRECISE=/YES/.test(a.attributes.PRECISE)),void s.trigger("data",a)):(r=/^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(e))?(a={type:"tag",tagType:"cue-out-cont"},r[1]?a.data=r[1]:a.data="",void s.trigger("data",a)):(r=/^#EXT-X-CUE-OUT:?(.*)?$/.exec(e))?(a={type:"tag",tagType:"cue-out"},r[1]?a.data=r[1]:a.data="",void s.trigger("data",a)):(r=/^#EXT-X-CUE-IN:?(.*)?$/.exec(e))?(a={type:"tag",tagType:"cue-in"},r[1]?a.data=r[1]:a.data="",void s.trigger("data",a)):(r=/^#EXT-X-SKIP:(.*)$/.exec(e))&&r[1]?((a={type:"tag",tagType:"skip"}).attributes=ur(r[1]),a.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(a.attributes["SKIPPED-SEGMENTS"]=parseInt(a.attributes["SKIPPED-SEGMENTS"],10)),a.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(a.attributes["RECENTLY-REMOVED-DATERANGES"]=a.attributes["RECENTLY-REMOVED-DATERANGES"].split(kr)),void s.trigger("data",a)):(r=/^#EXT-X-PART:(.*)$/.exec(e))&&r[1]?((a={type:"tag",tagType:"part"}).attributes=ur(r[1]),["DURATION"].forEach(function(e){a.attributes.hasOwnProperty(e)&&(a.attributes[e]=parseFloat(a.attributes[e]))}),["INDEPENDENT","GAP"].forEach(function(e){a.attributes.hasOwnProperty(e)&&(a.attributes[e]=/YES/.test(a.attributes[e]))}),a.attributes.hasOwnProperty("BYTERANGE")&&(a.attributes.byterange=or(a.attributes.BYTERANGE)),void s.trigger("data",a)):(r=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(e))&&r[1]?((a={type:"tag",tagType:"server-control"}).attributes=ur(r[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(e){a.attributes.hasOwnProperty(e)&&(a.attributes[e]=parseFloat(a.attributes[e]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(e){a.attributes.hasOwnProperty(e)&&(a.attributes[e]=/YES/.test(a.attributes[e]))}),void s.trigger("data",a)):(r=/^#EXT-X-PART-INF:(.*)$/.exec(e))&&r[1]?((a={type:"tag",tagType:"part-inf"}).attributes=ur(r[1]),["PART-TARGET"].forEach(function(e){a.attributes.hasOwnProperty(e)&&(a.attributes[e]=parseFloat(a.attributes[e]))}),void s.trigger("data",a)):(r=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(e))&&r[1]?((a={type:"tag",tagType:"preload-hint"}).attributes=ur(r[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(e){var t;a.attributes.hasOwnProperty(e)&&(a.attributes[e]=parseInt(a.attributes[e],10),t="BYTERANGE-LENGTH"===e?"length":"offset",a.attributes.byterange=a.attributes.byterange||{},a.attributes.byterange[t]=a.attributes[e],delete a.attributes[e])}),void s.trigger("data",a)):(r=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(e))&&r[1]?((a={type:"tag",tagType:"rendition-report"}).attributes=ur(r[1]),["LAST-MSN","LAST-PART"].forEach(function(e){a.attributes.hasOwnProperty(e)&&(a.attributes[e]=parseInt(a.attributes[e],10))}),void s.trigger("data",a)):void s.trigger("data",{type:"tag",data:e.slice(4)});s.trigger("data",{type:"tag",tagType:"discontinuity"})}}else s.trigger("data",{type:"comment",text:e.slice(1)})}):this.trigger("data",{type:"uri",uri:i}))},i.addParser=function(e){var t=this,i=e.expression,n=e.customType,r=e.dataParser,a=e.segment;"function"!=typeof r&&(r=function(e){return e}),this.customParsers.push(function(e){if(i.exec(e))return t.trigger("data",{type:"custom",data:r(e),customType:n,segment:a}),!0})},i.addTagMapper=function(e){var t=e.expression,i=e.map;this.tagMappers.push(function(e){return t.test(e)?i(e):e})},e}(ar),Ir=function(t){function e(){var e=t.call(this)||this;e.lineStream=new Er,e.parseStream=new Cr,e.lineStream.pipe(e.parseStream);var n,r,a=ft(e),o=[],u={},l=!1,d={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},c=0;e.manifest={allowCache:!0,discontinuityStarts:[],segments:[]};var h=0,p=0;return e.on("end",function(){u.uri||!u.parts&&!u.preloadHints||(!u.map&&n&&(u.map=n),!u.key&&r&&(u.key=r),u.timeline||"number"!=typeof c||(u.timeline=c),e.manifest.preloadSegment=u)}),e.parseStream.on("data",function(s){var t,i;({tag:function(){({version:function(){s.version&&(this.manifest.version=s.version)},"allow-cache":function(){this.manifest.allowCache=s.allowed,"allowed"in s||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange:function(){var e={};"length"in s&&((u.byterange=e).length=s.length,"offset"in s||(s.offset=h)),"offset"in s&&((u.byterange=e).offset=s.offset),h=e.offset+e.length},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"})),0<s.duration&&(u.duration=s.duration),0===s.duration&&(u.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=o},key:function(){if(s.attributes)if("NONE"!==s.attributes.METHOD)if(s.attributes.URI){if("com.apple.streamingkeydelivery"===s.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:s.attributes});if("com.microsoft.playready"===s.attributes.KEYFORMAT)return this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.microsoft.playready"]={uri:s.attributes.URI});if("urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"===s.attributes.KEYFORMAT)return-1===["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(s.attributes.METHOD)?void this.trigger("warn",{message:"invalid key method provided for Widevine"}):("SAMPLE-AES-CENC"===s.attributes.METHOD&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),"data:text/plain;base64,"!==s.attributes.URI.substring(0,23)?void this.trigger("warn",{message:"invalid key URI provided for Widevine"}):s.attributes.KEYID&&"0x"===s.attributes.KEYID.substring(0,2)?(this.manifest.contentProtection=this.manifest.contentProtection||{},void(this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:s.attributes.KEYFORMAT,keyId:s.attributes.KEYID.substring(2)},pssh:function(e){for(var t=sr(e),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}(s.attributes.URI.split(",")[1])})):void this.trigger("warn",{message:"invalid key ID provided for Widevine"}));s.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),r={method:s.attributes.METHOD||"AES-128",uri:s.attributes.URI},"undefined"!=typeof s.attributes.IV&&(r.iv=s.attributes.IV)}else this.trigger("warn",{message:"ignoring key declaration without URI"});else r=null;else this.trigger("warn",{message:"ignoring key declaration without attribute list"})},"media-sequence":function(){isFinite(s.number)?this.manifest.mediaSequence=s.number:this.trigger("warn",{message:"ignoring invalid media sequence: "+s.number})},"discontinuity-sequence":function(){isFinite(s.number)?(this.manifest.discontinuitySequence=s.number,c=s.number):this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+s.number})},"playlist-type":function(){/VOD|EVENT/.test(s.playlistType)?this.manifest.playlistType=s.playlistType:this.trigger("warn",{message:"ignoring unknown playlist type: "+s.playlist})},map:function(){n={},s.uri&&(n.uri=s.uri),s.byterange&&(n.byterange=s.byterange),r&&(n.key=r)},"stream-inf":function(){this.manifest.playlists=o,this.manifest.mediaGroups=this.manifest.mediaGroups||d,s.attributes?(u.attributes||(u.attributes={}),g(u.attributes,s.attributes)):this.trigger("warn",{message:"ignoring empty stream-inf attributes"})},media:function(){var e;this.manifest.mediaGroups=this.manifest.mediaGroups||d,s.attributes&&s.attributes.TYPE&&s.attributes["GROUP-ID"]&&s.attributes.NAME?((e=this.manifest.mediaGroups[s.attributes.TYPE])[s.attributes["GROUP-ID"]]=e[s.attributes["GROUP-ID"]]||{},t=e[s.attributes["GROUP-ID"]],(i={default:/yes/i.test(s.attributes.DEFAULT)}).default?i.autoselect=!0:i.autoselect=/yes/i.test(s.attributes.AUTOSELECT),s.attributes.LANGUAGE&&(i.language=s.attributes.LANGUAGE),s.attributes.URI&&(i.uri=s.attributes.URI),s.attributes["INSTREAM-ID"]&&(i.instreamId=s.attributes["INSTREAM-ID"]),s.attributes.CHARACTERISTICS&&(i.characteristics=s.attributes.CHARACTERISTICS),s.attributes.FORCED&&(i.forced=/yes/i.test(s.attributes.FORCED)),t[s.attributes.NAME]=i):this.trigger("warn",{message:"ignoring incomplete or missing media group"})},discontinuity:function(){c+=1,u.discontinuity=!0,this.manifest.discontinuityStarts.push(o.length)},"program-date-time":function(){"undefined"==typeof this.manifest.dateTimeString&&(this.manifest.dateTimeString=s.dateTimeString,this.manifest.dateTimeObject=s.dateTimeObject),u.dateTimeString=s.dateTimeString,u.dateTimeObject=s.dateTimeObject},targetduration:function(){!isFinite(s.duration)||s.duration<0?this.trigger("warn",{message:"ignoring invalid target duration: "+s.duration}):(this.manifest.targetDuration=s.duration,dr.call(this,this.manifest))},start:function(){s.attributes&&!isNaN(s.attributes["TIME-OFFSET"])?this.manifest.start={timeOffset:s.attributes["TIME-OFFSET"],precise:s.attributes.PRECISE}:this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"})},"cue-out":function(){u.cueOut=s.data},"cue-out-cont":function(){u.cueOutCont=s.data},"cue-in":function(){u.cueIn=s.data},skip:function(){this.manifest.skip=lr(s.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",s.attributes,["SKIPPED-SEGMENTS"])},part:function(){var i=this;l=!0;var e=this.manifest.segments.length,t=lr(s.attributes);u.parts=u.parts||[],u.parts.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=p),p=t.byterange.offset+t.byterange.length);var n=u.parts.length-1;this.warnOnMissingAttributes_("#EXT-X-PART #"+n+" for segment #"+e,s.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach(function(e,t){e.hasOwnProperty("lastPart")||i.trigger("warn",{message:"#EXT-X-RENDITION-REPORT #"+t+" lacks required attribute(s): LAST-PART"})})},"server-control":function(){var e=this.manifest.serverControl=lr(s.attributes);e.hasOwnProperty("canBlockReload")||(e.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),dr.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":function(){var e=this.manifest.segments.length,t=lr(s.attributes),i=t.type&&"PART"===t.type;u.preloadHints=u.preloadHints||[],u.preloadHints.push(t),t.byterange&&(t.byterange.hasOwnProperty("offset")||(t.byterange.offset=i?p:0,i&&(p=t.byterange.offset+t.byterange.length)));var n=u.preloadHints.length-1;if(this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #"+n+" for segment #"+e,s.attributes,["TYPE","URI"]),t.type)for(var r=0;r<u.preloadHints.length-1;r++){var a=u.preloadHints[r];a.type&&a.type===t.type&&this.trigger("warn",{message:"#EXT-X-PRELOAD-HINT #"+n+" for segment #"+e+" has the same TYPE "+t.type+" as preload hint #"+r})}},"rendition-report":function(){var e=lr(s.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(e);var t=this.manifest.renditionReports.length-1,e=["LAST-MSN","URI"];l&&e.push("LAST-PART"),this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #"+t,s.attributes,e)},"part-inf":function(){this.manifest.partInf=lr(s.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",s.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),dr.call(this,this.manifest)}}[s.tagType]||function(){}).call(a)},uri:function(){u.uri=s.uri,o.push(u),!this.manifest.targetDuration||"duration"in u||(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),u.duration=this.manifest.targetDuration),r&&(u.key=r),u.timeline=c,n&&(u.map=n),p=0,u={}},comment:function(){},custom:function(){s.segment?(u.custom=u.custom||{},u.custom[s.customType]=s.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[s.customType]=s.data)}})[s.type].call(a)}),e}mt(e,t);var i=e.prototype;return i.warnOnMissingAttributes_=function(e,t,i){var n=[];i.forEach(function(e){t.hasOwnProperty(e)||n.push(e)}),n.length&&this.trigger("warn",{message:e+" lacks required attribute(s): "+n.join(", ")})},i.push=function(e){this.lineStream.push(e)},i.end=function(){this.lineStream.push("\n"),this.trigger("end")},i.addParser=function(e){this.parseStream.addParser(e)},i.addTagMapper=function(e){this.parseStream.addTagMapper(e)},e}(ar),xr={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^/},Ar=["video","audio","text"],Pr=["Video","Audio","Text"],Lr="mp4a.40.2",Or=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Dr=/^application\/dash\+xml/i,Rr=vr,Mr=window.BigInt||Number,Nr=[Mr("0x1"),Mr("0x100"),Mr("0x10000"),Mr("0x1000000"),Mr("0x100000000"),Mr("0x10000000000"),Mr("0x1000000000000"),Mr("0x100000000000000"),Mr("0x10000000000000000")],Ur="http://example.com";function Br(e){for(var t=(e=e,window.atob?window.atob(e):Buffer.from(e,"base64").toString("binary")),i=new Uint8Array(t.length),n=0;n<t.length;n++)i[n]=t.charCodeAt(n);return i}function Fr(e,t){return(t=void 0===t?Object:t)&&"function"==typeof t.freeze?t.freeze(e):e}var jr=Fr({HTML:"text/html",isHTML:function(e){return e===jr.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Hr=Fr({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(e){return e===Hr.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),Vr={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 n=0;n<e.length;n++)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(t.call(void 0,r,n,e))return r}},freeze:Fr,MIME_TYPE:jr,NAMESPACE:Hr},qr=Vr.find,Wr=Vr.NAMESPACE;function Gr(e){return""!==e}function zr(e,t){return e.hasOwnProperty(t)||(e[t]=!0),e}function Xr(e){if(!e)return[];e=(e=e)?e.split(/[\t\n\f\r ]+/).filter(Gr):[];return Object.keys(e.reduce(zr,{}))}function Kr(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function Yr(e,t){var i,n=e.prototype;n instanceof t||((i=function(){}).prototype=t.prototype,Kr(n,i=new i),e.prototype=n=i),n.constructor!=e&&(n.constructor=e)}var Qr={},$r=Qr.ELEMENT_NODE=1,Jr=Qr.ATTRIBUTE_NODE=2,Zr=Qr.TEXT_NODE=3,ea=Qr.CDATA_SECTION_NODE=4,ta=Qr.ENTITY_REFERENCE_NODE=5,ia=(Qr.ENTITY_NODE=6,Qr.PROCESSING_INSTRUCTION_NODE=7),na=Qr.COMMENT_NODE=8,ra=Qr.DOCUMENT_NODE=9,aa=Qr.DOCUMENT_TYPE_NODE=10,sa=Qr.DOCUMENT_FRAGMENT_NODE=11,W=(Qr.NOTATION_NODE=12,{}),oa={};W.INDEX_SIZE_ERR=(oa[1]="Index size error",1),W.DOMSTRING_SIZE_ERR=(oa[2]="DOMString size error",2);var ua=W.HIERARCHY_REQUEST_ERR=(oa[3]="Hierarchy request error",3);W.WRONG_DOCUMENT_ERR=(oa[4]="Wrong document",4),W.INVALID_CHARACTER_ERR=(oa[5]="Invalid character",5),W.NO_DATA_ALLOWED_ERR=(oa[6]="No data allowed",6),W.NO_MODIFICATION_ALLOWED_ERR=(oa[7]="No modification allowed",7);var la=W.NOT_FOUND_ERR=(oa[8]="Not found",8);W.NOT_SUPPORTED_ERR=(oa[9]="Not supported",9);var da;W.INUSE_ATTRIBUTE_ERR=(oa[10]="Attribute in use",10);function ca(e,t){var i;return t instanceof Error?i=t:(i=this,Error.call(this,oa[e]),this.message=oa[e],Error.captureStackTrace&&Error.captureStackTrace(this,ca)),i.code=e,t&&(this.message=this.message+": "+t),i}function ha(){}function pa(e,t){this._node=e,this._refresh=t,fa(this)}function fa(e){var t,i=e._node._inc||e._node.ownerDocument._inc;e._inc!=i&&(t=e._refresh(e._node),Za(e,"length",t.length),Kr(t,e),e._inc=i)}function ma(){}function ga(e,t){for(var i=e.length;i--;)if(e[i]===t)return i}function ya(e,t,i,n){n?t[ga(t,n)]=i:t[t.length++]=i,!e||(t=(i.ownerElement=e).ownerDocument)&&(n&&Ea(t,e,n),e=e,i=i,(t=t)&&t._inc++,i.namespaceURI===Wr.XMLNS&&(e._nsMap[i.prefix?i.localName:""]=i.value))}function va(e,t,i){var n=ga(t,i);if(!(0<=n))throw new ca(la,new Error(e.tagName+"@"+i));for(var r,a=t.length-1;n<a;)t[n]=t[++n];t.length=a,!e||(r=e.ownerDocument)&&(Ea(r,e,i),i.ownerElement=null)}function _a(){}function ba(){}function Ta(e){return("<"==e?"&lt;":">"==e&&"&gt;")||"&"==e&&"&amp;"||'"'==e&&"&quot;"||"&#"+e.charCodeAt()+";"}function wa(e,t){if(t(e))return 1;if(e=e.firstChild)do{if(wa(e,t))return 1}while(e=e.nextSibling)}function Sa(){this.ownerDocument=this}function Ea(e,t,i){e&&e._inc++,i.namespaceURI===Wr.XMLNS&&delete t._nsMap[i.prefix?i.localName:""]}function ka(e,t,i){if(e&&e._inc){e._inc++;var n=t.childNodes;if(i)n[n.length++]=i;else{for(var r=t.firstChild,a=0;r;)r=(n[a++]=r).nextSibling;n.length=a,delete n[n.length]}}}function Ca(e,t){var i=t.previousSibling,n=t.nextSibling;return i?i.nextSibling=n:e.firstChild=n,n?n.previousSibling=i:e.lastChild=i,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,ka(e.ownerDocument,e),t}function Ia(e){return e&&e.nodeType===ba.DOCUMENT_TYPE_NODE}function xa(e){return e&&e.nodeType===ba.ELEMENT_NODE}function Aa(e){return e&&e.nodeType===ba.TEXT_NODE}function Pa(e,t){var i=e.childNodes||[];if(!qr(i,xa)&&!Ia(t)){e=qr(i,Ia);return!(t&&e&&i.indexOf(e)>i.indexOf(t))}}function La(e,t){var i=e.childNodes||[];if(!qr(i,function(e){return xa(e)&&e!==t})){e=qr(i,Ia);return!(t&&e&&i.indexOf(e)>i.indexOf(t))}}function Oa(e,t,i){if(!(n=e)||n.nodeType!==ba.DOCUMENT_NODE&&n.nodeType!==ba.DOCUMENT_FRAGMENT_NODE&&n.nodeType!==ba.ELEMENT_NODE)throw new ca(ua,"Unexpected parent node type "+e.nodeType);var n;if(i&&i.parentNode!==e)throw new ca(la,"child not in parent");if(!(i=t)||!(xa(i)||Aa(i)||Ia(i)||i.nodeType===ba.DOCUMENT_FRAGMENT_NODE||i.nodeType===ba.COMMENT_NODE||i.nodeType===ba.PROCESSING_INSTRUCTION_NODE)||Ia(t)&&e.nodeType!==ba.DOCUMENT_NODE)throw new ca(ua,"Unexpected node type "+t.nodeType+" for parent node type "+e.nodeType)}function Da(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===ba.DOCUMENT_FRAGMENT_NODE){var a=r.filter(xa);if(1<a.length||qr(r,Aa))throw new ca(ua,"More than one element or text in fragment");if(1===a.length&&!Pa(e,i))throw new ca(ua,"Element in fragment can not be inserted before doctype")}if(xa(t)&&!Pa(e,i))throw new ca(ua,"Only one element can be added and only after doctype");if(Ia(t)){if(qr(n,Ia))throw new ca(ua,"Only one doctype is allowed");t=qr(n,xa);if(i&&n.indexOf(t)<n.indexOf(i))throw new ca(ua,"Doctype can only be inserted before an element");if(!i&&t)throw new ca(ua,"Doctype can not be appended since element is present")}}function Ra(e,t,i){var n=e.childNodes||[],r=t.childNodes||[];if(t.nodeType===ba.DOCUMENT_FRAGMENT_NODE){var a=r.filter(xa);if(1<a.length||qr(r,Aa))throw new ca(ua,"More than one element or text in fragment");if(1===a.length&&!La(e,i))throw new ca(ua,"Element in fragment can not be inserted before doctype")}if(xa(t)&&!La(e,i))throw new ca(ua,"Only one element can be added and only after doctype");if(Ia(t)){if(qr(n,function(e){return Ia(e)&&e!==i}))throw new ca(ua,"Only one doctype is allowed");t=qr(n,xa);if(i&&n.indexOf(t)<n.indexOf(i))throw new ca(ua,"Doctype can only be inserted before an element")}}function Ma(e,t,i,n){Oa(e,t,i),e.nodeType===ba.DOCUMENT_NODE&&(n||Da)(e,t,i);n=t.parentNode;if(n&&n.removeChild(t),t.nodeType===sa){var r=t.firstChild;if(null==r)return t;var a=t.lastChild}else r=a=t;n=i?i.previousSibling:e.lastChild;for(r.previousSibling=n,a.nextSibling=i,n?n.nextSibling=r:e.firstChild=r,null==i?e.lastChild=a:i.previousSibling=a;r.parentNode=e,r!==a&&(r=r.nextSibling););return ka(e.ownerDocument||e,e),t.nodeType==sa&&(t.firstChild=t.lastChild=null),t}function Na(){this._nsMap={}}function Ua(){}function Ba(){}function Fa(){}function ja(){}function Ha(){}function Va(){}function qa(){}function Wa(){}function Ga(){}function za(){}function Xa(){}function Ka(){}function Ya(e,t){var i,n=[],r=9==this.nodeType&&this.documentElement||this,a=r.prefix,s=r.namespaceURI;return Ja(this,n,e,t,i=s&&null==a&&null==(a=r.lookupPrefix(s))?[{namespace:s,prefix:null}]:i),n.join("")}function Qa(e,t,i){var n=e.prefix||"",r=e.namespaceURI;if(r&&("xml"!==n||r!==Wr.XML)&&r!==Wr.XMLNS){for(var a=i.length;a--;){var s=i[a];if(s.prefix===n)return s.namespace!==r}return 1}}function $a(e,t,i){e.push(" ",t,'="',i.replace(/[<>&"\t\n\r]/g,Ta),'"')}function Ja(e,t,i,n,r){if(r=r||[],n){if(!(e=n(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case $r:var a=e.attributes,s=a.length,o=e.firstChild,u=e.tagName,l=u;if(!(i=Wr.isHTML(e.namespaceURI)||i)&&!e.prefix&&e.namespaceURI){for(var d,c=0;c<a.length;c++)if("xmlns"===a.item(c).name){d=a.item(c).value;break}if(!d)for(var h=r.length-1;0<=h;h--)if(""===(p=r[h]).prefix&&p.namespace===e.namespaceURI){d=p.namespace;break}if(d!==e.namespaceURI)for(var p,h=r.length-1;0<=h;h--)if((p=r[h]).namespace===e.namespaceURI){p.prefix&&(l=p.prefix+":"+u);break}}t.push("<",l);for(var f=0;f<s;f++)"xmlns"==(m=a.item(f)).prefix?r.push({prefix:m.localName,namespace:m.value}):"xmlns"==m.nodeName&&r.push({prefix:"",namespace:m.value});for(var m,g,y,f=0;f<s;f++)Qa(m=a.item(f),0,r)&&($a(t,(g=m.prefix||"")?"xmlns:"+g:"xmlns",y=m.namespaceURI),r.push({prefix:g,namespace:y})),Ja(m,t,i,n,r);if(u===l&&Qa(e,0,r)&&($a(t,(g=e.prefix||"")?"xmlns:"+g:"xmlns",y=e.namespaceURI),r.push({prefix:g,namespace:y})),o||i&&!/^(?:meta|link|img|br|hr|input)$/i.test(u)){if(t.push(">"),i&&/^script$/i.test(u))for(;o;)o.data?t.push(o.data):Ja(o,t,i,n,r.slice()),o=o.nextSibling;else for(;o;)Ja(o,t,i,n,r.slice()),o=o.nextSibling;t.push("</",l,">")}else t.push("/>");return;case ra:case sa:for(o=e.firstChild;o;)Ja(o,t,i,n,r.slice()),o=o.nextSibling;return;case Jr:return $a(t,e.name,e.value),0;case Zr:return t.push(e.data.replace(/[<&>]/g,Ta));case ea:return t.push("<![CDATA[",e.data,"]]>");case na:return t.push("\x3c!--",e.data,"--\x3e");case aa:var v=e.publicId,_=e.systemId;return t.push("<!DOCTYPE ",e.name),void(v?(t.push(" PUBLIC ",v),_&&"."!=_&&t.push(" ",_),t.push(">")):_&&"."!=_?t.push(" SYSTEM ",_,">"):((_=e.internalSubset)&&t.push(" [",_,"]"),t.push(">")));case ia:return t.push("<?",e.target," ",e.data,"?>");case ta:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function Za(e,t,i){e[t]=i}W.INVALID_STATE_ERR=(oa[11]="Invalid state",11),W.SYNTAX_ERR=(oa[12]="Syntax error",12),W.INVALID_MODIFICATION_ERR=(oa[13]="Invalid modification",13),W.NAMESPACE_ERR=(oa[14]="Invalid namespace",14),W.INVALID_ACCESS_ERR=(oa[15]="Invalid access",15),ca.prototype=Error.prototype,Kr(W,ca),ha.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var i=[],n=0;n<this.length;n++)Ja(this[n],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)}},pa.prototype.item=function(e){return fa(this),this[e]},Yr(pa,ha),ma.prototype={length:0,item:ha.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 ca(10);t=this.getNamedItem(e.nodeName);return ya(this._ownerElement,this,e,t),t},setNamedItemNS:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new ca(10);return t=this.getNamedItemNS(e.namespaceURI,e.localName),ya(this._ownerElement,this,e,t),t},removeNamedItem:function(e){e=this.getNamedItem(e);return va(this._ownerElement,this,e),e},removeNamedItemNS:function(e,t){t=this.getNamedItemNS(e,t);return va(this._ownerElement,this,t),t},getNamedItemNS:function(e,t){for(var i=this.length;i--;){var n=this[i];if(n.localName==t&&n.namespaceURI==e)return n}return null}},_a.prototype={hasFeature:function(e,t){return!0},createDocument:function(e,t,i){var n=new Sa;return n.implementation=this,n.childNodes=new ha,n.doctype=i||null,i&&n.appendChild(i),t&&(t=n.createElementNS(e,t),n.appendChild(t)),n},createDocumentType:function(e,t,i){var n=new Va;return n.name=e,n.nodeName=e,n.publicId=t||"",n.systemId=i||"",n}},ba.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 Ma(this,e,t)},replaceChild:function(e,t){Ma(this,e,t,Ra),t&&this.removeChild(t)},removeChild:function(e){return Ca(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,i,n){var r=new i.constructor;for(var a in i){var s;!Object.prototype.hasOwnProperty.call(i,a)||"object"!=typeof(s=i[a])&&s!=r[a]&&(r[a]=s)}i.childNodes&&(r.childNodes=new ha);r.ownerDocument=t;switch(r.nodeType){case $r:var o=i.attributes,u=r.attributes=new ma,l=o.length;u._ownerElement=r;for(var d=0;d<l;d++)r.setAttributeNode(e(t,o.item(d),!0));break;case Jr:n=!0}if(n)for(var c=i.firstChild;c;)r.appendChild(e(t,c,n)),c=c.nextSibling;return r}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==Zr&&e.nodeType==Zr?(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 n in i)if(Object.prototype.hasOwnProperty.call(i,n)&&i[n]===e)return n;t=t.nodeType==Jr?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=t.nodeType==Jr?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},Kr(Qr,ba),Kr(Qr,ba.prototype),Sa.prototype={nodeName:"#document",nodeType:ra,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType!=sa)return Ma(this,e,t),null===(e.ownerDocument=this).documentElement&&e.nodeType===$r&&(this.documentElement=e),e;for(var i=e.firstChild;i;){var n=i.nextSibling;this.insertBefore(i,t),i=n}return e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),Ca(this,e)},replaceChild:function(e,t){Ma(this,e,t,Ra),e.ownerDocument=this,t&&this.removeChild(t),xa(e)&&(this.documentElement=e)},importNode:function(e,t){return function e(t,i,n){var r;switch(i.nodeType){case $r:(r=i.cloneNode(!1)).ownerDocument=t;case sa:break;case Jr:n=!0}r=r||i.cloneNode(!1);r.ownerDocument=t;r.parentNode=null;if(n)for(var a=i.firstChild;a;)r.appendChild(e(t,a,n)),a=a.nextSibling;return r}(this,e,t)},getElementById:function(t){var i=null;return wa(this.documentElement,function(e){if(e.nodeType==$r&&e.getAttribute("id")==t)return i=e,!0}),i},getElementsByClassName:function(s){var o=Xr(s);return new pa(this,function(r){var a=[];return 0<o.length&&wa(r.documentElement,function(e){var t,i,n;e===r||e.nodeType!==$r||(t=e.getAttribute("class"))&&((i=s===t)||(t=Xr(t),i=o.every((n=t,function(e){return n&&-1!==n.indexOf(e)}))),i&&a.push(e))}),a})},createElement:function(e){var t=new Na;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.localName=e,t.childNodes=new ha,(t.attributes=new ma)._ownerElement=t},createDocumentFragment:function(){var e=new za;return e.ownerDocument=this,e.childNodes=new ha,e},createTextNode:function(e){var t=new Fa;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new ja;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new Ha;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var i=new Xa;return i.ownerDocument=this,i.tagName=i.target=e,i.nodeValue=i.data=t,i},createAttribute:function(e){var t=new Ua;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Ga;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var i=new Na,n=t.split(":"),r=i.attributes=new ma;return i.childNodes=new ha,i.ownerDocument=this,i.nodeName=t,i.tagName=t,i.namespaceURI=e,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,r._ownerElement=i},createAttributeNS:function(e,t){var i=new Ua,n=t.split(":");return i.ownerDocument=this,i.nodeName=t,i.name=t,i.namespaceURI=e,i.specified=!0,2==n.length?(i.prefix=n[0],i.localName=n[1]):i.localName=t,i}},Yr(Sa,ba),Sa.prototype.getElementsByTagName=(Na.prototype={nodeType:$r,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 e.nodeType===sa?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,ka(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){t=this.getAttributeNodeNS(e,t);t&&this.removeAttributeNode(t)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){t=this.getAttributeNodeNS(e,t);return t&&t.value||""},setAttributeNS:function(e,t,i){t=this.ownerDocument.createAttributeNS(e,t);t.value=t.nodeValue=""+i,this.setAttributeNode(t)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(n){return new pa(this,function(t){var i=[];return wa(t,function(e){e===t||e.nodeType!=$r||"*"!==n&&e.tagName!=n||i.push(e)}),i})},getElementsByTagNameNS:function(n,r){return new pa(this,function(t){var i=[];return wa(t,function(e){e===t||e.nodeType!==$r||"*"!==n&&e.namespaceURI!==n||"*"!==r&&e.localName!=r||i.push(e)}),i})}}).getElementsByTagName,Sa.prototype.getElementsByTagNameNS=Na.prototype.getElementsByTagNameNS,Yr(Na,ba),Ua.prototype.nodeType=Jr,Yr(Ua,ba),Ba.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(oa[ua])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,i){var n=this.data.substring(0,e),t=this.data.substring(e+t);this.nodeValue=this.data=i=n+i+t,this.length=i.length}},Yr(Ba,ba),Fa.prototype={nodeName:"#text",nodeType:Zr,splitText:function(e){var t=(i=this.data).substring(e),i=i.substring(0,e);this.data=this.nodeValue=i,this.length=i.length;t=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(t,this.nextSibling),t}},Yr(Fa,Ba),ja.prototype={nodeName:"#comment",nodeType:na},Yr(ja,Ba),Ha.prototype={nodeName:"#cdata-section",nodeType:ea},Yr(Ha,Ba),Va.prototype.nodeType=aa,Yr(Va,ba),qa.prototype.nodeType=12,Yr(qa,ba),Wa.prototype.nodeType=6,Yr(Wa,ba),Ga.prototype.nodeType=ta,Yr(Ga,ba),za.prototype.nodeName="#document-fragment",za.prototype.nodeType=sa,Yr(za,ba),Xa.prototype.nodeType=ia,Yr(Xa,ba),Ka.prototype.serializeToString=function(e,t,i){return Ya.call(e,t,i)},ba.prototype.toString=Ya;try{Object.defineProperty&&(da=function e(t){switch(t.nodeType){case $r:case sa: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}},Object.defineProperty(pa.prototype,"length",{get:function(){return fa(this),this.$$length}}),Object.defineProperty(ba.prototype,"textContent",{get:function(){return da(this)},set:function(e){switch(this.nodeType){case $r:case sa: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}}}),Za=function(e,t,i){e["$$"+t]=i})}catch(e){}var x={DocumentType:Va,DOMException:ca,DOMImplementation:_a,Element:Na,Node:ba,NodeList:ha,XMLSerializer:Ka},es=m(function(e,t){var i=Vr.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});es.XML_ENTITIES,es.HTML_ENTITIES,es.entityMap;var ts=Vr.NAMESPACE,U=/[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]/,zt=new RegExp("[\\-\\.0-9"+U.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),is=new RegExp("^"+U.source+zt.source+"*(?::"+U.source+zt.source+"*)?$"),ns=0,rs=1,as=2,ss=3,os=4,us=5,ls=6,ds=7;function cs(e,t){this.message=e,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,cs)}function hs(){}function ps(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function fs(e,t,i){for(var n=e.tagName,r=null,a=e.length;a--;){var s=e[a],o=s.qName,u=s.value,o=0<(d=o.indexOf(":"))?(l=s.prefix=o.slice(0,d),c=o.slice(d+1),"xmlns"===l&&c):(l=null,"xmlns"===(c=o)&&"");s.localName=c,!1!==o&&(null==r&&(r={},ms(i,i={})),i[o]=r[o]=u,s.uri=ts.XMLNS,t.startPrefixMapping(o,u))}for(var l,a=e.length;a--;)(l=(s=e[a]).prefix)&&("xml"===l&&(s.uri=ts.XML),"xmlns"!==l&&(s.uri=i[l||""]));var d,c=0<(d=n.indexOf(":"))?(l=e.prefix=n.slice(0,d),e.localName=n.slice(d+1)):(l=null,e.localName=n),h=e.uri=i[l||""];if(t.startElement(h,c,n,e),!e.closed)return e.currentNSMap=i,e.localNSMap=r,1;if(t.endElement(h,c,n),r)for(l in r)Object.prototype.hasOwnProperty.call(r,l)&&t.endPrefixMapping(l)}function ms(e,t){for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}function gs(){this.attributeNames={}}(cs.prototype=new Error).name=cs.name,hs.prototype={parse:function(e,t,i){var n=this.domBuilder;n.startDocument(),ms(t,t={}),function(i,e,n,r,a){function s(e){var t=e.slice(1,-1);return Object.hasOwnProperty.call(n,t)?n[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):(a.error("entity not found:"+e),e)}function t(e){var t;f<e&&(t=i.substring(f,e).replace(/&#?\w+;/g,s),c&&o(f),r.characters(t,0,e-f),f=e)}function o(e,t){for(;l<=e&&(t=d.exec(i));)u=t.index,l=u+t[0].length,c.lineNumber++;c.columnNumber=e-u+1}var u=0,l=0,d=/.*(?:\r\n?|\n)|.*$/g,c=r.locator,h=[{currentNSMap:e}],p={},f=0;for(;;){try{var m,g,y=i.indexOf("<",f);if(y<0)return i.substr(f).match(/^\s*$/)||(m=r.doc,g=m.createTextNode(i.substr(f)),m.appendChild(g),r.currentElement=g);switch(f<y&&t(y),i.charAt(y+1)){case"/":var v=i.indexOf(">",y+3),_=i.substring(y+2,v).replace(/[ \t\n\r]+$/g,""),b=h.pop();v<0?(_=i.substring(y+2).replace(/[\s<].*/,""),a.error("end tag name: "+_+" is not complete:"+b.tagName),v=y+1+_.length):_.match(/\s</)&&(_=_.replace(/[\s<].*/,""),a.error("end tag name: "+_+" maybe not complete"),v=y+1+_.length);var T=b.localNSMap,w=b.tagName==_;if(w||b.tagName&&b.tagName.toLowerCase()==_.toLowerCase()){if(r.endElement(b.uri,b.localName,_),T)for(var S in T)Object.prototype.hasOwnProperty.call(T,S)&&r.endPrefixMapping(S);w||a.fatalError("end tag name: "+_+" is not match the current start tagName:"+b.tagName)}else h.push(b);v++;break;case"?":c&&o(y),v=function(e,t,i){var n=e.indexOf("?>",t);if(n){t=e.substring(t,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return t?(t[0].length,i.processingInstruction(t[1],t[2]),n+2):-1}return-1}(i,y,r);break;case"!":c&&o(y),v=function(e,t,i,n){{if("-"===e.charAt(t+2)){if("-"!==e.charAt(t+3))return-1;var r=e.indexOf("--\x3e",t+4);return t<r?(i.comment(e,t+4,r-t-4),r+3):(n.error("Unclosed comment"),-1)}if("CDATA["==e.substr(t+3,6)){r=e.indexOf("]]>",t+9);return i.startCDATA(),i.characters(e,t+9,r-t-9),i.endCDATA(),r+3}var a=function(e,t){var i,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;r.lastIndex=t,r.exec(e);for(;i=r.exec(e);)if(n.push(i),i[1])return n}(e,t),n=a.length;if(1<n&&/!doctype/i.test(a[0][0])){r=a[1][0],e=!1,t=!1;3<n&&(/^public$/i.test(a[2][0])?(e=a[3][0],t=4<n&&a[4][0]):/^system$/i.test(a[2][0])&&(t=a[3][0]));n=a[n-1];return i.startDTD(r,e,t),i.endDTD(),n.index+n[0].length}}return-1}(i,y,r,a);break;default:c&&o(y);var E=new gs,k=h[h.length-1].currentNSMap,v=function(e,t,n,i,r,a){function s(e,t,i){n.attributeNames.hasOwnProperty(e)&&a.fatalError("Attribute "+e+" redefined"),n.addValue(e,t.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),i)}var o,u=++t,l=ns;for(;;){var d=e.charAt(u);switch(d){case"=":if(l===rs)o=e.slice(t,u),l=ss;else{if(l!==as)throw new Error("attribute equal must after attrName");l=ss}break;case"'":case'"':if(l===ss||l===rs){if(l===rs&&(a.warning('attribute value must after "="'),o=e.slice(t,u)),t=u+1,!(0<(u=e.indexOf(d,t))))throw new Error("attribute value no end '"+d+"' match");c=e.slice(t,u),s(o,c,t-1),l=us}else{if(l!=os)throw new Error('attribute value must after "="');c=e.slice(t,u),s(o,c,t),a.warning('attribute "'+o+'" missed start quot('+d+")!!"),t=u+1,l=us}break;case"/":switch(l){case ns:n.setTagName(e.slice(t,u));case us:case ls:case ds:l=ds,n.closed=!0;case os:case rs:case as:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return a.error("unexpected end of input"),l==ns&&n.setTagName(e.slice(t,u)),u;case">":switch(l){case ns:n.setTagName(e.slice(t,u));case us:case ls:case ds:break;case os:case rs:"/"===(c=e.slice(t,u)).slice(-1)&&(n.closed=!0,c=c.slice(0,-1));case as:l===as&&(c=o),l==os?(a.warning('attribute "'+c+'" missed quot(")!'),s(o,c,t)):(ts.isHTML(i[""])&&c.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),s(c,c,t));break;case ss:throw new Error("attribute value missed!!")}return u;case"":d=" ";default:if(d<=" ")switch(l){case ns:n.setTagName(e.slice(t,u)),l=ls;break;case rs:o=e.slice(t,u),l=as;break;case os:var c=e.slice(t,u);a.warning('attribute "'+c+'" missed quot(")!!'),s(o,c,t);case us:l=ls}else switch(l){case as:n.tagName,ts.isHTML(i[""])&&o.match(/^(?:disabled|checked|selected)$/i)||a.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),s(o,o,t),t=u,l=rs;break;case us:a.warning('attribute space is required"'+o+'"!!');case ls:l=rs,t=u;break;case ss:l=os,t=u;break;case ds:throw new Error("elements closed character '/' and '>' must be connected to")}}u++}}(i,y,E,k,s,a),C=E.length;if(!E.closed&&function(e,t,i,n){var r=n[i];null==r&&((r=e.lastIndexOf("</"+i+">"))<t&&(r=e.lastIndexOf("</"+i)),n[i]=r);return r<t}(i,v,E.tagName,p)&&(E.closed=!0,n.nbsp||a.warning("unclosed xml attribute")),c&&C){for(var I=ps(c,{}),x=0;x<C;x++){var A=E[x];o(A.offset),A.locator=ps(c,{})}r.locator=I,fs(E,r,k)&&h.push(E),r.locator=c}else fs(E,r,k)&&h.push(E);ts.isHTML(E.uri)&&!E.closed?v=function(e,t,i,n,r){if(/^(?:script|textarea)$/i.test(i)){var a=e.indexOf("</"+i+">",t),e=e.substring(t+1,a);if(/[&<]/.test(e))return/^script$/i.test(i)||(e=e.replace(/&#?\w+;/g,n)),r.characters(e,0,e.length),a}return t+1}(i,v,E.tagName,s,r):v++}}catch(e){if(e instanceof cs)throw e;a.error("element parse error: "+e),v=-1}f<v?f=v:t(Math.max(y,f)+1)}}(e,t,i,n,this.errorHandler),n.endDocument()}},gs.prototype={setTagName:function(e){if(!is.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},addValue:function(e,t,i){if(!is.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 ar={XMLReader:hs,ParseError:cs},ys=x.DOMImplementation,vs=Vr.NAMESPACE,_s=ar.ParseError,bs=ar.XMLReader;function Ts(e){return e.replace(/\r[\n\u0085]/g,"\n").replace(/[\r\u0085\u2028]/g,"\n")}function ws(e){this.options=e||{locator:{}}}function Ss(){this.cdata=!1}function Es(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function ks(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function Cs(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 Is(e,t){(e.currentElement||e.doc).appendChild(t)}ws.prototype.parseFromString=function(e,t){var i=this.options,n=new bs,r=i.domBuilder||new Ss,a=i.errorHandler,s=i.locator,o=i.xmlns||{},u=/\/x?html?$/.test(t),t=u?es.HTML_ENTITIES:es.XML_ENTITIES;s&&r.setDocumentLocator(s),n.errorHandler=function(n,e,r){if(!n){if(e instanceof Ss)return e;n=e}var a={},s=n instanceof Function;function t(t){var i=n[t];!i&&s&&(i=2==n.length?function(e){n(t,e)}:n),a[t]=i?function(e){i("[xmldom "+t+"]\t"+e+ks(r))}:function(){}}return r=r||{},t("warning"),t("error"),t("fatalError"),a}(a,r,s),n.domBuilder=i.domBuilder||r,u&&(o[""]=vs.HTML),o.xml=o.xml||vs.XML;i=i.normalizeLineEndings||Ts;return e&&"string"==typeof e?n.parse(i(e),o,t):n.errorHandler.error("invalid doc source"),r.doc},Ss.prototype={startDocument:function(){this.doc=(new ys).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,i,n){var r=this.doc,a=r.createElementNS(e,i||t),s=n.length;Is(this,a),this.currentElement=a,this.locator&&Es(this.locator,a);for(var o=0;o<s;o++){var e=n.getURI(o),u=n.getValue(o),i=n.getQName(o),l=r.createAttributeNS(e,i);this.locator&&Es(n.getLocator(o),l),l.value=l.nodeValue=u,a.setAttributeNode(l)}},endElement:function(e,t,i){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){t=this.doc.createProcessingInstruction(e,t);this.locator&&Es(this.locator,t),Is(this,t)},ignorableWhitespace:function(e,t,i){},characters:function(e,t,i){var n;(e=Cs.apply(this,arguments))&&(n=this.cdata?this.doc.createCDATASection(e):this.doc.createTextNode(e),this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(e)&&this.doc.appendChild(n),this.locator&&Es(this.locator,n))},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,i){e=Cs.apply(this,arguments);e=this.doc.createComment(e);this.locator&&Es(this.locator,e),Is(this,e)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,i){var n=this.doc.implementation;n&&n.createDocumentType&&(i=n.createDocumentType(e,t,i),this.locator&&Es(this.locator,i),Is(this,i),this.doc.doctype=i)},warning:function(e){},error:function(e){},fatalError:function(e){throw new _s(e,this.locator)}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){Ss.prototype[e]=function(){return null}});function xs(e){return!!e&&"object"==typeof e}function As(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return t.reduce(function(t,i){return"object"!=typeof i||Object.keys(i).forEach(function(e){Array.isArray(t[e])&&Array.isArray(i[e])?t[e]=t[e].concat(i[e]):xs(t[e])&&xs(i[e])?t[e]=As(t[e],i[e]):t[e]=i[e]}),t},{})}function Ps(t){return Object.keys(t).map(function(e){return t[e]})}function Ls(e){return e.reduce(function(e,t){return e.concat(t)},[])}function Os(e){if(!e.length)return[];for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t}function Ds(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return i;return-1}function Rs(e){var t=e.baseUrl,i=void 0===(n=e.source)?"":n,n=void 0===(n=e.range)?"":n,e=void 0===(e=e.indexRange)?"":e,i={uri:i,resolvedUri:Sr((void 0===t?"":t)||"",i)};return(n||e)&&(n=(n||e).split("-"),e=window.BigInt?window.BigInt(n[0]):parseInt(n[0],10),n=window.BigInt?window.BigInt(n[1]):parseInt(n[1],10),e<Number.MAX_SAFE_INTEGER&&"bigint"==typeof e&&(e=Number(e)),"bigint"==typeof(n="bigint"==typeof(n=n<Number.MAX_SAFE_INTEGER&&"bigint"==typeof n?Number(n):n)||"bigint"==typeof e?window.BigInt(n)-window.BigInt(e)+window.BigInt(1):n-e+1)&&n<Number.MAX_SAFE_INTEGER&&(n=Number(n)),i.byterange={length:n,offset:e}),i}function Ms(e){return e&&"number"!=typeof e&&(e=parseInt(e,10)),isNaN(e)?null:e}function Ns(e){var a,t=e.type,i=e.duration,n=e.timescale,r=void 0===n?1:n,s=e.periodDuration,o=e.sourceDuration,e=function(e,t){for(var i=[],n=e;n<t;n++)i.push(n);return i}((n=Lo[t](e)).start,n.end).map((a=e,function(e){var t=a.duration,i=a.timescale,n=a.periodStart,r=a.startNumber;return{number:(void 0===r?1:r)+e,duration:t/(void 0===i?1:i),timeline:n,time:e*t}}));return"static"===t&&(e[t=e.length-1].duration=("number"==typeof s?s:o)-i/r*t),e}function Us(e){var t=e.baseUrl,i=void 0===(u=e.initialization)?{}:u,n=e.sourceDuration,r=void 0===(o=e.indexRange)?"":o,a=e.periodStart,s=e.presentationTime,o=void 0===(u=e.number)?0:u,u=e.duration;if(!t)throw new Error(xo);return i=Rs({baseUrl:t,source:i.sourceURL,range:i.range}),(r=Rs({baseUrl:t,source:t,indexRange:r})).map=i,u?(e=Ns(e)).length&&(r.duration=e[0].duration,r.timeline=e[0].timeline):n&&(r.duration=n,r.timeline=a),r.presentationTime=s||a,r.number=o,[r]}function Bs(e,t,i){for(var n=e.sidx.map||null,r=e.sidx.duration,a=e.timeline||0,s=(s=e.sidx.byterange).offset+s.length,o=t.timescale,u=t.references.filter(function(e){return 1!==e.referenceType}),l=[],d=e.endList?"static":"dynamic",c=e.sidx.timeline,h=c,p=e.mediaSequence||0,f="bigint"==typeof t.firstOffset?window.BigInt(s)+t.firstOffset:s+t.firstOffset,m=0;m<u.length;m++){var g=t.references[m],y=g.referencedSize,v=g.subsegmentDuration,g=void 0,g="bigint"==typeof f?f+window.BigInt(y)-window.BigInt(1):f+y-1,g=Us({baseUrl:i,timescale:o,timeline:a,periodStart:c,presentationTime:h,number:p,duration:v,sourceDuration:r,indexRange:f+"-"+g,type:d})[0];n&&(g.map=n),l.push(g),f+="bigint"==typeof f?window.BigInt(y):y,h+=v/o,p++}return e.segments=l,e}function Fs(e){return i=function(e){return e.timeline},Ps(e.reduce(function(t,e){return e.forEach(function(e){t[i(e)]=e}),t},{})).sort(function(e,t){return e.timeline>t.timeline?1:-1});var i}function js(e){var r,a,s=[];return r=e,a=function(e,t,i,n){s=s.concat(e.playlists||[])},Oo.forEach(function(e){for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var n=r.mediaGroups[e][t][i];a(n,e,t,i)}}),s}function Hs(e){var i=e.playlist,e=e.mediaSequence;i.mediaSequence=e,i.segments.forEach(function(e,t){e.number=i.mediaSequence+t})}function Vs(e){var r,a,t=e.oldManifest,i=e.newManifest,n=t.playlists.concat(js(t)),e=i.playlists.concat(js(i));return i.timelineStarts=Fs([t.timelineStarts,i.timelineStarts]),n={oldPlaylists:n,newPlaylists:e,timelineStarts:i.timelineStarts},r=n.oldPlaylists,e=n.newPlaylists,a=n.timelineStarts,e.forEach(function(t){t.discontinuitySequence=Ds(a,function(e){return e.timeline===t.timeline});var e=function(e,t){for(var i=0;i<e.length;i++)if(e[i].attributes.NAME===t)return e[i];return null}(r,t.attributes.NAME);if(e&&!t.sidx){var i=t.segments[0],n=Ds(e.segments,function(e){return Math.abs(e.presentationTime-i.presentationTime)<1/60});if(-1===n)return Hs({playlist:t,mediaSequence:e.mediaSequence+e.segments.length}),t.segments[0].discontinuity=!0,t.discontinuityStarts.unshift(0),void((!e.segments.length&&t.timeline>e.timeline||e.segments.length&&t.timeline>e.segments[e.segments.length-1].timeline)&&t.discontinuitySequence--);e.segments[n].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,t.discontinuityStarts.unshift(0),t.discontinuitySequence--),Hs({playlist:t,mediaSequence:e.segments[n].number})}}),i}function qs(e){return e&&e.uri+"-"+(t=e.byterange,e="bigint"==typeof t.offset||"bigint"==typeof t.length?window.BigInt(t.offset)+window.BigInt(t.length)-window.BigInt(1):t.offset+t.length-1,t.offset+"-"+e);var t}function Ws(e){return Ps(e.reduce(function(e,t){var i,n=t.attributes.id+(t.attributes.lang||"");return e[n]?(t.segments&&(t.segments[0]&&(t.segments[0].discontinuity=!0),(i=e[n].segments).push.apply(i,t.segments)),t.attributes.contentProtection&&(e[n].attributes.contentProtection=t.attributes.contentProtection)):(e[n]=t,e[n].attributes.timelineStarts=[]),e[n].attributes.timelineStarts.push({start:t.attributes.periodStart,timeline:t.attributes.periodStart}),e},{})).map(function(e){var t,n;return e.discontinuityStarts=(t=e.segments||[],n="discontinuity",t.reduce(function(e,t,i){return t[n]&&e.push(i),e},[])),e})}function Gs(e,t){var i=qs(e.sidx);return(i=i&&t[i]&&t[i].sidx)&&Bs(e,i,e.sidx.resolvedUri),e}function zs(e,h,p){var f;return void 0===h&&(h={}),void 0===p&&(p=!1),e=e.reduce(function(e,t){var i=t.attributes.role&&t.attributes.role.value||"",n=t.attributes.lang||"",r=t.attributes.label||"main";e[r=n&&!t.attributes.label?t.attributes.lang+(i?" ("+i+")":""):r]||(e[r]={language:n,autoselect:!0,default:"main"===i,playlists:[],uri:""});var a,s,o,u,l,d,c,u=Gs((s=p,o=(a=t).attributes,u=a.segments,l=a.sidx,d=a.mediaSequence,c=a.discontinuitySequence,n=a.discontinuityStarts,u={attributes:((a={NAME:o.id,BANDWIDTH:o.bandwidth,CODECS:o.codecs})["PROGRAM-ID"]=1,a),uri:"",endList:"static"===o.type,timeline:o.periodStart,resolvedUri:"",targetDuration:o.duration,discontinuitySequence:c,discontinuityStarts:n,timelineStarts:o.timelineStarts,mediaSequence:d,segments:u},o.contentProtection&&(u.contentProtection=o.contentProtection),l&&(u.sidx=l),s&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u),h);return e[r].playlists.push(u),"undefined"==typeof f&&"main"===i&&((f=t).default=!0),e},{}),f||(e[Object.keys(e)[0]].default=!0),e}function Xs(e){var t=e.attributes,i=e.segments,n=e.sidx,r=e.discontinuityStarts,i={attributes:((e={NAME:t.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:t.width,height:t.height},CODECS:t.codecs,BANDWIDTH:t.bandwidth})["PROGRAM-ID"]=1,e),uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:"",targetDuration:t.duration,discontinuityStarts:r,timelineStarts:t.timelineStarts,segments:i};return t.frameRate&&(i.attributes["FRAME-RATE"]=t.frameRate),t.contentProtection&&(i.contentProtection=t.contentProtection),n&&(i.sidx=n),i}function Ks(e){return"video/mp4"===(e=e.attributes).mimeType||"video/webm"===e.mimeType||"video"===e.contentType}function Ys(e){return"audio/mp4"===(e=e.attributes).mimeType||"audio/webm"===e.mimeType||"audio"===e.contentType}function Qs(e){return"text/vtt"===(e=e.attributes).mimeType||"text"===e.contentType}function $s(i){return i?Object.keys(i).reduce(function(e,t){t=i[t];return e.concat(t.playlists)},[]):[]}function Js(e){var t=e.dashPlaylists,i=e.locations,n=void 0===(d=e.sidxMapping)?{}:d,r=e.previousManifest;if(!t.length)return{};var a=(c=t[0].attributes).sourceDuration,s=c.type,o=c.suggestedPresentationDelay,u=c.minimumUpdatePeriod,l=Ws(t.filter(Ks)).map(Xs),d=Ws(t.filter(Ys)),e=Ws(t.filter(Qs)),c=t.map(function(e){return e.attributes.captionServices}).filter(Boolean),a={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:((t={AUDIO:{},VIDEO:{}})["CLOSED-CAPTIONS"]={},t.SUBTITLES={},t),uri:"",duration:a,playlists:function(e,t){if(void 0===t&&(t={}),!Object.keys(t).length)return e;for(var i in e)e[i]=Gs(e[i],t);return e}(l,n)};0<=u&&(a.minimumUpdatePeriod=1e3*u),i&&(a.locations=i),"dynamic"===s&&(a.suggestedPresentationDelay=o);var h,p,o=0===a.playlists.length,o=d.length?zs(d,n,o):null,n=e.length?(void 0===(h=n)&&(h={}),e.reduce(function(e,t){var i=t.attributes.lang||"text";return e[i]||(e[i]={language:i,default:!1,autoselect:!1,playlists:[],uri:""}),e[i].playlists.push(Gs(function(e){var t=e.attributes,i=e.segments,n=e.mediaSequence,r=e.discontinuityStarts,a=e.discontinuitySequence;"undefined"==typeof i&&(i=[{uri:t.baseUrl,timeline:t.periodStart,resolvedUri:t.baseUrl||"",duration:t.sourceDuration,number:0}],t.duration=t.sourceDuration);(e={NAME:t.id,BANDWIDTH:t.bandwidth})["PROGRAM-ID"]=1;return t.codecs&&(e.CODECS=t.codecs),{attributes:e,uri:"",endList:"static"===t.type,timeline:t.periodStart,resolvedUri:t.baseUrl||"",targetDuration:t.duration,timelineStarts:t.timelineStarts,discontinuityStarts:r,discontinuitySequence:a,mediaSequence:n,segments:i}}(t),h)),e},{})):null,l=(e=l.concat($s(o),$s(n))).map(function(e){return e.timelineStarts});return a.timelineStarts=Fs(l),e=e,p=a.timelineStarts,e.forEach(function(t){t.mediaSequence=0,t.discontinuitySequence=Ds(p,function(e){return e.timeline===t.timeline}),t.segments&&t.segments.forEach(function(e,t){e.number=t})}),o&&(a.mediaGroups.AUDIO.audio=o),n&&(a.mediaGroups.SUBTITLES.subs=n),c.length&&(a.mediaGroups["CLOSED-CAPTIONS"].cc=c.reduce(function(n,e){return e&&e.forEach(function(e){var t=e.channel,i=e.language;n[i]={autoselect:!1,default:!1,instreamId:t,language:i},e.hasOwnProperty("aspectRatio")&&(n[i].aspectRatio=e.aspectRatio),e.hasOwnProperty("easyReader")&&(n[i].easyReader=e.easyReader),e.hasOwnProperty("3D")&&(n[i]["3D"]=e["3D"])}),n},{})),r?Vs({oldManifest:r,newManifest:a}):a}function Zs(e,t){for(var i,n,r,a,s,o,u=e.type,l=e.minimumUpdatePeriod,d=void 0===l?0:l,c=void 0===(l=e.media)?"":l,h=e.sourceDuration,p=void 0===(l=e.timescale)?1:l,f=void 0===(l=e.startNumber)?1:l,m=e.periodStart,g=[],y=-1,v=0;v<t.length;v++){var _=t[v],b=_.d,T=_.r||0,w=_.t||0;y<0&&(y=w),w&&y<w&&(y=w);var S,E=void 0;E=T<0?(S=v+1)===t.length?"dynamic"===u&&0<d&&0<c.indexOf("$Number$")?(i=y,n=b,_=o=s=a=r=void 0,r=(w=e).NOW,a=w.clientOffset,s=w.availabilityStartTime,o=w.timescale,_=w.periodStart,w=w.minimumUpdatePeriod,Math.ceil((((r+a)/1e3+(void 0===w?0:w)-(s+(void 0===_?0:_)))*(void 0===o?1:o)-i)/n)):(h*p-y)/b:(t[S].t-y)/b:T+1;for(var k=f+g.length+E,C=f+g.length;C<k;)g.push({number:C,duration:b/p,time:y,timeline:m}),y+=b,C++}return g}function eo(e,t){return e.replace(Do,(r=t,function(e,t,i,n){if("$$"===e)return"$";if("undefined"==typeof r[t])return e;e=""+r[t];return"RepresentationID"===t||(n=i?parseInt(n,10):1)<=e.length?e:new Array(n-e.length+1).join("0")+e}));var r}function to(r,e){var a={RepresentationID:r.id,Bandwidth:r.bandwidth||0},t=void 0===(t=r.initialization)?{sourceURL:"",range:""}:t,s=Rs({baseUrl:r.baseUrl,source:eo(t.sourceURL,a),range:t.range});return(t=e,(e=r).duration||t?e.duration?Ns(e):Zs(e,t):[{number:e.startNumber||1,duration:e.sourceDuration,time:0,timeline:e.periodStart}]).map(function(e){a.Number=e.number,a.Time=e.time;var t=eo(r.media||"",a),i=r.timescale||1,n=r.presentationTimeOffset||0,i=r.periodStart+(e.time-n)/i;return{uri:t,timeline:e.timeline,duration:e.duration,resolvedUri:Sr(r.baseUrl||"",t),map:s,number:e.number,presentationTime:i}})}function io(r,e){var t=r.duration,i=void 0===(i=r.segmentUrls)?[]:i,a=r.periodStart;if(!t&&!e||t&&e)throw new Error(Ao);var n,s=i.map(function(e){return i=e,e=(t=r).baseUrl,t=t.initialization,t=Rs({baseUrl:e,source:(t=void 0===t?{}:t).sourceURL,range:t.range}),(i=Rs({baseUrl:e,source:i.media,range:i.mediaRange})).map=t,i;var t,i});return t&&(n=Ns(r)),(n=e?Zs(r,e):n).map(function(e,t){if(s[t]){var i=s[t],n=r.timescale||1,t=r.presentationTimeOffset||0;return i.timeline=e.timeline,i.duration=e.duration,i.number=e.number,i.presentationTime=a+(e.time-t)/n,i}}).filter(function(e){return e})}function no(e){var t,i=e.attributes,n=e.segmentInfo;n.template?(a=to,t=As(i,n.template)):n.base?(a=Us,t=As(i,n.base)):n.list&&(a=io,t=As(i,n.list));var r={attributes:i};if(!a)return r;var a,e=a(t,n.segmentTimeline);return t.duration?(i=t.duration,a=t.timescale,t.duration=i/(void 0===a?1:a)):e.length?t.duration=e.reduce(function(e,t){return Math.max(e,Math.ceil(t.duration))},0):t.duration=0,r.attributes=t,r.segments=e,n.base&&t.indexRange&&(r.sidx=e[0],r.segments=[]),r}function ro(e,t){return Os(e.childNodes).filter(function(e){return e.tagName===t})}function ao(e){return e.textContent.trim()}function so(e){if(!(r=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(e)))return 0;var t=(a=r.slice(1))[0],i=a[1],n=a[2],e=a[3],r=a[4],a=a[5];return 31536e3*parseFloat(t||0)+2592e3*parseFloat(i||0)+86400*parseFloat(n||0)+3600*parseFloat(e||0)+60*parseFloat(r||0)+parseFloat(a||0)}function oo(e){return e&&e.attributes?Os(e.attributes).reduce(function(e,t){var i=Ro[t.name]||Ro.DEFAULT;return e[t.name]=i(t.value),e},{}):{}}function uo(e,i){return i.length?Ls(e.map(function(t){return i.map(function(e){return Sr(t,ao(e))})})):e}function lo(e){var t=ro(e,"SegmentTemplate")[0],i=ro(e,"SegmentList")[0],n=i&&ro(i,"SegmentURL").map(function(e){return As({tag:"SegmentURL"},oo(e))}),r=ro(e,"SegmentBase")[0],e=(a=i||t)&&ro(a,"SegmentTimeline")[0],a=(a=i||r||t)&&ro(a,"Initialization")[0];(t=t&&oo(t))&&a?t.initialization=a&&oo(a):t&&t.initialization&&(t.initialization={sourceURL:t.initialization});var s={template:t,segmentTimeline:e&&ro(e,"S").map(oo),list:i&&As(oo(i),{segmentUrls:n,initialization:oo(a)}),base:r&&As(oo(r),{initialization:oo(a)})};return Object.keys(s).forEach(function(e){s[e]||delete s[e]}),s}function co(u,l,d){return function(e){var t=oo(e),i=uo(l,ro(e,"BaseURL")),n=ro(e,"Role")[0],n={role:oo(n)},t=As(u,t,n),n=ro(e,"Accessibility")[0],n="urn:scte:dash:cc:cea-608:2015"===(n=oo(n)).schemeIdUri?("string"!=typeof n.value?[]:n.value.split(";")).map(function(e){var t,i,n;return/^CC\d=/.test(n=e)?(i=(t=e.split("="))[0],n=t[1]):/^CC\d$/.test(e)&&(i=e),{channel:i,language:n}}):"urn:scte:dash:cc:cea-708:2015"===n.schemeIdUri?("string"!=typeof n.value?[]:n.value.split(";")).map(function(e){var t,i,n={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};return/=/.test(e)?(t=(i=e.split("="))[0],i=void 0===(i=i[1])?"":i,n.channel=t,n.language=e,i.split(",").forEach(function(e){var t=e.split(":"),e=t[0],t=t[1];"lang"===e?n.language=t:"er"===e?n.easyReader=Number(t):"war"===e?n.aspectRatio=Number(t):"3D"===e&&(n["3D"]=Number(t))})):n.language=e,n.channel&&(n.channel="SERVICE"+n.channel),n}):void 0;n&&(t=As(t,{captionServices:n}));n=ro(e,"Label")[0];n&&n.childNodes.length&&(r=n.childNodes[0].nodeValue.trim(),t=As(t,{label:r}));var r=ro(e,"ContentProtection").reduce(function(e,t){var i=oo(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());var n=Mo[i.schemeIdUri];return n&&(e[n]={attributes:i},(t=ro(t,"cenc:pssh")[0])&&(t=ao(t),e[n].pssh=t&&Br(t))),e},{});Object.keys(r).length&&(t=As(t,{contentProtection:r}));var a,s,o,r=lo(e),e=ro(e,"Representation"),r=As(d,r);return Ls(e.map((a=t,s=i,o=r,function(e){var t=ro(e,"BaseURL"),t=uo(s,t),i=As(a,oo(e)),n=lo(e);return t.map(function(e){return{segmentInfo:As(o,n),attributes:As(i,{baseUrl:e})}})})))}}function ho(e,t){var i=t=void 0===t?{}:t,n=void 0===(a=i.manifestUri)?"":a,t=void 0===(r=i.NOW)?Date.now():r,r=void 0===(a=i.clientOffset)?0:a;if(!(i=ro(e,"Period")).length)throw new Error(ko);var a=ro(e,"Location"),s=oo(e),e=uo([n],ro(e,"BaseURL"));s.type=s.type||"static",s.sourceDuration=s.mediaPresentationDuration||0,s.NOW=t,s.clientOffset=r,a.length&&(s.locations=a.map(ao));var o,u,l=[];return i.forEach(function(e,t){var i,n=oo(e),r=l[t-1];n.start=(i={attributes:n,priorPeriodAttributes:r?r.attributes:null,mpdType:s.type},t=i.attributes,r=i.priorPeriodAttributes,i=i.mpdType,"number"==typeof t.start?t.start:r&&"number"==typeof r.start&&"number"==typeof r.duration?r.start+r.duration:r||"static"!==i?null:0),l.push({node:e,attributes:n})}),{locations:s.locations,representationInfo:Ls(l.map((o=s,u=e,function(e,t){var i=uo(u,ro(e.node,"BaseURL")),n=As(o,{periodStart:e.attributes.start});"number"==typeof e.attributes.duration&&(n.periodDuration=e.attributes.duration);var r=ro(e.node,"AdaptationSet"),e=lo(e.node);return Ls(r.map(co(n,i,e)))})))}}function po(e){if(""===e)throw new Error(Co);var t,i,n=new Eo;try{i=(t=n.parseFromString(e,"application/xml"))&&"MPD"===t.documentElement.tagName?t.documentElement:null}catch(e){}if(!i||i&&0<i.getElementsByTagName("parsererror").length)throw new Error(Io);return i}function fo(e,t){void 0===t&&(t={});var i=ho(po(e),t),e=i.representationInfo.map(no);return Js({dashPlaylists:e,locations:i.locations,sidxMapping:t.sidxMapping,previousManifest:t.previousManifest})}function mo(e){return function(e){e=ro(e,"UTCTiming")[0];if(!e)return null;var t=oo(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;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Po)}return t}(po(e))}function go(e,t){return void 0===t&&(t=0),(e=_r(e)).length-t<10||!wr(e,Fo,{offset:t})?t:go(e,t+=function(e,t){void 0===t&&(t=0);var i=(e=_r(e))[t+5],t=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9];return(16&i)>>4?20+t:10+t}(e,t))}function yo(e){return"string"==typeof e?Tr(e):e}function vo(e,t,i){var n;void 0===i&&(i=!1),n=t,t=Array.isArray(n)?n.map(yo):[yo(n)],e=_r(e);var r=[];if(!t.length)return r;for(var a=0;a<e.length;){var s=(e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3])>>>0,o=e.subarray(a+4,a+8);if(0==s)break;var u=a+s;if(u>e.length){if(i)break;u=e.length}s=e.subarray(a+8,u);wr(o,t[0])&&(1===t.length?r.push(s):r.push.apply(r,vo(s,t.slice(1),i))),a=u}return r}function _o(e,t,i,n){void 0===i&&(i=!0),void 0===n&&(n=!1);var r=function(e){for(var t=1,i=0;i<Ho.length&&!(e&Ho[i]);i++)t++;return t}(e[t]),a=e.subarray(t,t+r);return i&&((a=Array.prototype.slice.call(e,t,t+r))[0]^=Ho[r-1]),{length:r,value:function(n,e){var t=void 0===e?{}:e,e=t.signed,e=void 0!==e&&e,t=t.le,r=void 0!==t&&t;n=_r(n);t=r?"reduce":"reduceRight",t=(n[t]||Array.prototype[t]).call(n,function(e,t,i){i=r?i:Math.abs(i+1-n.length);return e+Mr(t)*Nr[i]},Mr(0));return!e||(e=Nr[n.length]/Mr(2)-Mr(1))<(t=Mr(t))&&(t-=e,t-=e,t-=Mr(2)),Number(t)}(a,{signed:n}),bytes:a}}function bo(e){return"string"==typeof e?e.match(/.{1,2}/g).map(bo):"number"==typeof e?br(e):e}function To(e,t,i){if(i>=t.length)return t.length;var n=_o(t,i,!1);if(wr(e.bytes,n.bytes))return i;var r=_o(t,i+n.length);return To(e,t,i+r.length+r.value+n.length)}function wo(e,t){var i;i=t,t=Array.isArray(i)?i.map(bo):[bo(i)],e=_r(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var a=_o(e,r,!1),s=_o(e,r+a.length),o=r+a.length+s.length;127===s.value&&(s.value=To(a,e,o),s.value!==e.length&&(s.value-=o));var u=o+s.value>e.length?e.length:o+s.value,u=e.subarray(o,u);wr(t[0],a.bytes)&&(1===t.length?n.push(u):n=n.concat(wo(u,t.slice(1)))),r+=a.length+s.length+u.length}return n}function So(e,t,i,n){void 0===n&&(n=1/0),e=_r(e),i=[].concat(i);for(var r,a=0,s=0;a<e.length&&(s<n||r);){var o=void 0;if(wr(e.subarray(a),Vo)?o=4:wr(e.subarray(a),qo)&&(o=3),o){if(s++,r)return function(e){for(var t=[],i=1;i<e.length-2;)wr(e.subarray(i,i+3),Wo)&&(t.push(i+2),i++),i++;if(0===t.length)return e;for(var n=e.length-t.length,r=new Uint8Array(n),a=0,i=0;i<n;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=e[a];return r}(e.subarray(r,a));var u=void 0;"h264"===t?u=31&e[a+o]:"h265"===t&&(u=e[a+o]>>1&63),-1!==i.indexOf(u)&&(r=a+o),a+=o+("h264"===t?1:2)}else a++}return e.subarray(0,0)}var Eo={__DOMHandler:Ss,normalizeLineEndings:Ts,DOMParser:ws}.DOMParser,ko="INVALID_NUMBER_OF_PERIOD",Co="DASH_EMPTY_MANIFEST",Io="DASH_INVALID_XML",xo="NO_BASE_URL",Ao="SEGMENT_TIME_UNSPECIFIED",Po="UNSUPPORTED_UTC_TIMING_SCHEME",Lo={static:function(e){var t=e.duration,i=e.timescale,n=void 0===i?1:i,r=e.sourceDuration,i=e.periodDuration,e=Ms(e.endNumber),n=t/n;return"number"==typeof e?{start:0,end:e}:"number"==typeof i?{start:0,end:i/n}:{start:0,end:r/n}},dynamic:function(e){var t=e.NOW,i=e.clientOffset,n=e.availabilityStartTime,r=e.timescale,a=void 0===r?1:r,s=e.duration,o=e.periodStart,u=void 0===o?0:o,r=e.minimumUpdatePeriod,o=void 0===r?0:r,r=e.timeShiftBufferDepth,r=void 0===r?1/0:r,e=Ms(e.endNumber),i=(t+i)/1e3,u=n+u,o=Math.ceil((i+o-u)*a/s),r=Math.floor((i-u-r)*a/s),s=Math.floor((i-u)*a/s);return{start:Math.max(0,r),end:"number"==typeof e?e:Math.min(o,s)}}},Oo=["AUDIO","SUBTITLES"],Do=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,Ro={mediaPresentationDuration:so,availabilityStartTime:function(e){return/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(e=e)&&(e+="Z"),Date.parse(e)/1e3},minimumUpdatePeriod:so,suggestedPresentationDelay:so,type:function(e){return e},timeShiftBufferDepth:so,start:so,width:function(e){return parseInt(e,10)},height:function(e){return parseInt(e,10)},bandwidth:function(e){return parseInt(e,10)},frameRate:function(e){return parseFloat(e.split("/").reduce(function(e,t){return e/t}))},startNumber:function(e){return parseInt(e,10)},timescale:function(e){return parseInt(e,10)},presentationTimeOffset:function(e){return parseInt(e,10)},duration:function(e){var t=parseInt(e,10);return isNaN(t)?so(e):t},d:function(e){return parseInt(e,10)},t:function(e){return parseInt(e,10)},r:function(e){return parseInt(e,10)},DEFAULT:function(e){return e}},Mo={"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"},No=Math.pow(2,32),Uo=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.getBigUint64?(e=t.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(e):e:t.getUint32(0)*No+t.getUint32(4)},Bo=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)},n=12;0===i.version?(i.earliestPresentationTime=t.getUint32(n),i.firstOffset=t.getUint32(n+4),n+=8):(i.earliestPresentationTime=Uo(e.subarray(n)),i.firstOffset=Uo(e.subarray(n+8)),n+=16);var r=t.getUint16(n+=2);for(n+=2;0<r;n+=12,r--)i.references.push({referenceType:(128&e[n])>>>7,referencedSize:2147483647&t.getUint32(n),subsegmentDuration:t.getUint32(n+4),startsWithSap:!!(128&e[n+8]),sapType:(112&e[n+8])>>>4,sapDeltaTime:268435455&t.getUint32(n+8)});return i},Fo=_r([73,68,51]),jo={EBML:_r([26,69,223,163]),DocType:_r([66,130]),Segment:_r([24,83,128,103]),SegmentInfo:_r([21,73,169,102]),Tracks:_r([22,84,174,107]),Track:_r([174]),TrackNumber:_r([215]),DefaultDuration:_r([35,227,131]),TrackEntry:_r([174]),TrackType:_r([131]),FlagDefault:_r([136]),CodecID:_r([134]),CodecPrivate:_r([99,162]),VideoTrack:_r([224]),AudioTrack:_r([225]),Cluster:_r([31,67,182,117]),Timestamp:_r([231]),TimestampScale:_r([42,215,177]),BlockGroup:_r([160]),BlockDuration:_r([155]),Block:_r([161]),SimpleBlock:_r([163])},Ho=[128,64,32,16,8,4,2,1],Vo=_r([0,0,0,1]),qo=_r([0,0,1]),Wo=_r([0,0,3]),Go={webm:_r([119,101,98,109]),matroska:_r([109,97,116,114,111,115,107,97]),flac:_r([102,76,97,67]),ogg:_r([79,103,103,83]),ac3:_r([11,119]),riff:_r([82,73,70,70]),avi:_r([65,86,73]),wav:_r([87,65,86,69]),"3gp":_r([102,116,121,112,51,103]),mp4:_r([102,116,121,112]),fmp4:_r([115,116,121,112]),mov:_r([102,116,121,112,113,116]),moov:_r([109,111,111,118]),moof:_r([109,111,111,102])},zo={aac:function(e){var t=go(e);return wr(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=go(e);return wr(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){e=wo(e,[jo.EBML,jo.DocType])[0];return wr(e,Go.webm)},mkv:function(e){e=wo(e,[jo.EBML,jo.DocType])[0];return wr(e,Go.matroska)},mp4:function(e){return!zo["3gp"](e)&&!zo.mov(e)&&(!(!wr(e,Go.mp4,{offset:4})&&!wr(e,Go.fmp4,{offset:4}))||(!(!wr(e,Go.moof,{offset:4})&&!wr(e,Go.moov,{offset:4}))||void 0))},mov:function(e){return wr(e,Go.mov,{offset:4})},"3gp":function(e){return wr(e,Go["3gp"],{offset:4})},ac3:function(e){var t=go(e);return wr(e,Go.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=go(e);return wr(e,Go.flac,{offset:t})},ogg:function(e){return wr(e,Go.ogg)},avi:function(e){return wr(e,Go.riff)&&wr(e,Go.avi,{offset:8})},wav:function(e){return wr(e,Go.riff)&&wr(e,Go.wav,{offset:8})},h264:function(e){return So(e,"h264",7,3).length},h265:function(e){return So(e,"h265",[32,33],3).length}},Xo=Object.keys(zo).filter(function(e){return"ts"!==e&&"h264"!==e&&"h265"!==e}).concat(["ts","h264","h265"]);Xo.forEach(function(e){var t=zo[e];zo[e]=function(e){return t(_r(e))}});function Ko(e){e=_r(e);for(var t=0;t<Xo.length;t++){var i=Xo[t];if(Yo[i](e))return i}return""}var Yo=zo,Qo=9e4,$o=m(function(t){function i(e){return t.exports=i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},i(e)}t.exports=i});function Jo(e,t,i){return e&&i&&i.responseURL&&t!==i.responseURL?i.responseURL:t}function Zo(e){return ir.log.debug?ir.log.debug.bind(ir,"VHS:",e+" >"):function(){}}function eu(e,t){var i,n=[];if(e&&e.length)for(i=0;i<e.length;i++)t(e.start(i),e.end(i))&&n.push([e.start(i),e.end(i)]);return ir.createTimeRanges(n)}function tu(e,i){return eu(e,function(e,t){return e-.1<=i&&i<=t+.1})}function iu(e,t){return eu(e,function(e){return t<=e-Rl})}function nu(e){var t=[];if(!e||!e.length)return"";for(var i=0;i<e.length;i++)t.push(e.start(i)+" => "+e.end(i));return t.join(", ")}function ru(e){for(var t=[],i=0;i<e.length;i++)t.push({start:e.start(i),end:e.end(i)});return t}function au(e){if(e&&e.length&&e.end)return e.end(e.length-1)}function su(e,t){var i=0;if(!e||!e.length)return i;for(var n=0;n<e.length;n++){var r=e.start(n),a=e.end(n);a<t||(i+=r<t&&t<=a?a-t:a-r)}return i}function ou(t,e){if(!e.preload)return e.duration;var i=0;return(e.parts||[]).forEach(function(e){i+=e.duration}),(e.preloadHints||[]).forEach(function(e){"PART"===e.type&&(i+=t.partTargetDuration)}),i}function uu(e){return(e.segments||[]).reduce(function(i,n,r){return n.parts?n.parts.forEach(function(e,t){i.push({duration:e.duration,segmentIndex:r,partIndex:t,part:e,segment:n})}):i.push({duration:n.duration,segmentIndex:r,partIndex:null,segment:n,part:null}),i},[])}function lu(e){return(e=e.segments&&e.segments.length&&e.segments[e.segments.length-1])&&e.parts||[]}function du(e){var t=e.preloadSegment;if(t){e=t.parts,t=(t.preloadHints||[]).reduce(function(e,t){return e+("PART"===t.type?1:0)},0);return t+=e&&e.length?e.length:0}}function cu(e,t){return t.endList?0:e&&e.suggestedPresentationDelay?e.suggestedPresentationDelay:(e=0<lu(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}function hu(e,t,i){if((t="undefined"==typeof t?e.mediaSequence+e.segments.length:t)<e.mediaSequence)return 0;var n=function(e,t){var i=0,n=t-e.mediaSequence,r=e.segments[n];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(;n--;){if("undefined"!=typeof(r=e.segments[n]).end)return{result:i+r.end,precise:!0};if(i+=ou(e,r),"undefined"!=typeof r.start)return{result:i+r.start,precise:!0}}return{result:i,precise:!1}}(e,t);return n.precise?n.result:(t=function(e,t){for(var i,n=0,r=t-e.mediaSequence;r<e.segments.length;r++){if("undefined"!=typeof(i=e.segments[r]).start)return{result:i.start-n,precise:!0};if(n+=ou(e,i),"undefined"!=typeof i.end)return{result:i.end-n,precise:!0}}return{result:-1,precise:!1}}(e,t)).precise?t.result:n.result+i}function pu(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 hu(e,t,i)}function fu(e){var t=e.defaultDuration,i=e.durationList,n=e.startIndex,r=e.endIndex,a=0;if(r<n&&(n=(e=[r,n])[0],r=e[1]),n<0){for(var s=n;s<Math.min(0,r);s++)a+=t;n=0}for(var o=n;o<r;o++)a+=i[o].duration;return a}function mu(e,t,i,n){return e&&e.segments?e.endList?pu(e):null===t?null:(t=hu(e,e.mediaSequence+e.segments.length,t=t||0),i&&(t-=n="number"==typeof n?n:cu(null,e)),Math.max(0,t)):null}function gu(e){return e.excludeUntil&&e.excludeUntil>Date.now()}function yu(e){return e.excludeUntil&&e.excludeUntil===1/0}function vu(e){var t=gu(e);return!e.disabled&&!t}function _u(e,t){return t.attributes&&t.attributes[e]}function bu(e,t){if(1===e.playlists.length)return!0;var i=t.attributes.BANDWIDTH||Number.MAX_VALUE;return 0===e.playlists.filter(function(e){return!!vu(e)&&(e.attributes.BANDWIDTH||0)<i}).length}function Tu(e,t){return!(!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))))}function wu(e,t){var i,n=e&&e.mediaGroups&&e.mediaGroups.AUDIO||{},r=!1;for(i in n){for(var a in n[i])if(r=t(n[i][a]))break;if(r)break}return!!r}function Su(i){if(!i||!i.playlists||!i.playlists.length)return wu(i,function(e){return e.playlists&&e.playlists.length||e.uri});for(var e=0;e<i.playlists.length;e++){var t=function(e){var t=i.playlists[e],e=t.attributes&&t.attributes.CODECS;return e&&e.split(",").every(pr)||wu(i,function(e){return Tu(t,e)})?"continue":{v:!1}}(e);if("continue"!==t&&"object"==typeof t)return t.v}return!0}function Eu(e,t){return e+"-"+t}function ku(e,t,i){return"placeholder-uri-"+e+"-"+t+"-"+i}function Cu(r,a){r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(function(e){if(r.mediaGroups[e])for(var t in r.mediaGroups[e])for(var i in r.mediaGroups[e][t]){var n=r.mediaGroups[e][t][i];a(n,e,t,i)}})}function Iu(e){var t=e.playlist,i=e.uri,e=e.id;t.id=e,t.playlistErrors_=0,i&&(t.uri=i),t.attributes=t.attributes||{}}function xu(o,e,u){void 0===u&&(u=ku),o.uri=e;for(var t=0;t<o.playlists.length;t++)o.playlists[t].uri||(o.playlists[t].uri="placeholder-uri-"+t);var i,n=Su(o);Cu(o,function(e,r,a,s){if(!e.playlists||!e.playlists.length){if(n&&"AUDIO"===r&&!e.uri)for(var t=0;t<o.playlists.length;t++){var i=o.playlists[t];if(i.attributes&&i.attributes.AUDIO&&i.attributes.AUDIO===a)return}e.playlists=[g({},e)]}e.playlists.forEach(function(e,t){var i=u(r,a,s,e),n=Eu(t,i);e.uri?e.resolvedUri=e.resolvedUri||Dl(o.uri,e.uri):(e.uri=0===t?i:n,e.resolvedUri=e.uri),e.id=e.id||n,e.attributes=e.attributes||{},o.playlists[e.id]=e,o.playlists[e.uri]=e})}),function(e){for(var t=e.playlists.length;t--;){var i=e.playlists[t];Iu({playlist:i,id:Eu(t,i.uri)}),i.resolvedUri=Dl(e.uri,i.uri),e.playlists[i.id]=i,(e.playlists[i.uri]=i).attributes.BANDWIDTH||Ul.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}}(o),Cu(i=o,function(e){e.uri&&(e.resolvedUri=Dl(i.uri,e.uri))})}function Au(e,t,i){var n=e.slice(),r=t.slice();i=i||0;for(var a,s=[],o=0;o<r.length;o++){var u=n[o+i],l=r[o];u?(a=u.map||a,s.push(function(e,t){if(!e)return t;var i=Bl(e,t);if(e.preloadHints&&!t.preloadHints&&delete i.preloadHints,e.parts&&!t.parts)delete i.parts;else if(e.parts&&t.parts)for(var n=0;n<t.parts.length;n++)e.parts&&e.parts[n]&&(i.parts[n]=Bl(e.parts[n],t.parts[n]));return!e.skipped&&t.skipped&&(i.skipped=!1),e.preload&&!t.preload&&(i.preload=!1),i}(u,l))):(a&&!l.map&&(l.map=a),s.push(l))}return s}function Pu(e,t){!e.resolvedUri&&e.uri&&(e.resolvedUri=Dl(t,e.uri)),e.key&&!e.key.resolvedUri&&(e.key.resolvedUri=Dl(t,e.key.uri)),e.map&&!e.map.resolvedUri&&(e.map.resolvedUri=Dl(t,e.map.uri)),e.map&&e.map.key&&!e.map.key.resolvedUri&&(e.map.key.resolvedUri=Dl(t,e.map.key.uri)),e.parts&&e.parts.length&&e.parts.forEach(function(e){e.resolvedUri||(e.resolvedUri=Dl(t,e.uri))}),e.preloadHints&&e.preloadHints.length&&e.preloadHints.forEach(function(e){e.resolvedUri||(e.resolvedUri=Dl(t,e.uri))})}function Lu(e){var t=e.segments||[],i=e.preloadSegment;if(i&&i.parts&&i.parts.length){if(i.preloadHints)for(var n=0;n<i.preloadHints.length;n++)if("MAP"===i.preloadHints[n].type)return t;i.duration=e.targetDuration,i.preload=!0,t.push(i)}return t}function Ou(e,t){return e===t||e.segments&&t.segments&&e.segments.length===t.segments.length&&e.endList===t.endList&&e.mediaSequence===t.mediaSequence&&e.preloadSegment===t.preloadSegment}function Du(e,a,t){void 0===t&&(t=Ou);var i=Bl(e,{}),n=i.playlists[a.id];if(!n)return null;if(t(n,a))return null;a.segments=Lu(a);var s=Bl(n,a);if(s.preloadSegment&&!a.preloadSegment&&delete s.preloadSegment,n.segments){if(a.skip){a.segments=a.segments||[];for(var r=0;r<a.skip.skippedSegments;r++)a.segments.unshift({skipped:!0})}s.segments=Au(n.segments,a.segments,a.mediaSequence-n.mediaSequence)}s.segments.forEach(function(e){Pu(e,s.resolvedUri)});for(var o=0;o<i.playlists.length;o++)i.playlists[o].id===a.id&&(i.playlists[o]=s);return i.playlists[a.id]=s,i.playlists[a.uri]=s,Cu(e,function(e,t,i,n){if(e.playlists)for(var r=0;r<e.playlists.length;r++)a.id===e.playlists[r].id&&(e.playlists[r]=s)}),i}function Ru(e,t){var i=e.segments||[],n=i[i.length-1],n=(i=n&&n.parts&&n.parts[n.parts.length-1])&&i.duration||n&&n.duration;return t&&n?1e3*n:500*(e.partTargetDuration||e.targetDuration||10)}function Mu(e,t,i,n){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),n(t=!t&&!e.aborted&&200!==i.statusCode&&206!==i.statusCode&&0!==i.statusCode?new Error("XHR Failed with a response of: "+(e&&(r||e.responseText))):t,e)}function Nu(){function a(e,i){e=Hl({timeout:45e3},e);var t=a.beforeRequest||ir.Vhs.xhr.beforeRequest;!t||"function"!=typeof t||(t=t(e))&&(e=t);var n=(!0===ir.Vhs.xhr.original?jl:ir.Vhs.xhr)(e,function(e,t){return Mu(n,e,t,i)}),r=n.abort;return n.abort=function(){return n.aborted=!0,r.apply(n,arguments)},n.uri=e.uri,n.requestTime=Date.now(),n}return a.original=!0,a}function Uu(e){var t,i={};return e.byterange&&(i.Range=(t=e.byterange,e=t.offset,t="bigint"==typeof t.offset||"bigint"==typeof t.length?window.BigInt(t.offset)+window.BigInt(t.length)-window.BigInt(1):t.offset+t.length-1,"bytes="+e+"-"+t)),i}function Bu(e,t){return e=e.toString(16),"00".substring(0,2-e.length)+e+(t%2?" ":"")}function Fu(e){return 32<=e&&e<126?String.fromCharCode(e):"."}function ju(i){var n={};return Object.keys(i).forEach(function(e){var t=i[e];vr(t)?n[e]={bytes:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength}:n[e]=t}),n}function Hu(e){var t=e.byterange||{length:1/0,offset:0};return[t.length,t.offset,e.resolvedUri].join(",")}function Vu(e){return e.resolvedUri}function qu(e){for(var t=Array.prototype.slice.call(e),i="",n=0;n<t.length/16;n++)i+=t.slice(16*n,16*n+16).map(Bu).join("")+" "+t.slice(16*n,16*n+16).map(Fu).join("")+"\n";return i}function Wu(e){var t=e.playlist,i=e.time,n=void 0===i?void 0:i;if(!(i=e.callback))throw new Error("getProgramTime: callback must be provided");return t&&void 0!==n?(e=function(e,t){if(!t||!t.segments||0===t.segments.length)return null;for(var i,n=0,r=0;r<t.segments.length&&!(e<=(n=(i=t.segments[r]).videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:n+i.duration));r++);var a=t.segments[t.segments.length-1];if(a.videoTimingInfo&&a.videoTimingInfo.transmuxedPresentationEnd<e)return null;if(n<e){if(e>n+.25*a.duration)return null;i=a}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:n-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}}(n,t))?"estimate"===e.type?i({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:e.estimatedStart}):(t={mediaSeconds:n},(e=function(e,t){if(!t.dateTimeObject)return null;var i=t.videoTimingInfo.transmuxerPrependedSeconds,i=e-(t.videoTimingInfo.transmuxedPresentationStart+i);return new Date(t.dateTimeObject.getTime()+1e3*i)}(n,e.segment))&&(t.programDateTime=e.toISOString()),i(null,t)):i({message:"valid programTime was not found"}):i({message:"getProgramTime: playlist and time must be provided"})}function Gu(e){var t=e.programTime,i=e.playlist,n=e.retryCount,r=void 0===n?2:n,a=e.seekTo,s=e.pauseAfterSeek,o=void 0===s||s,u=e.tech,l=e.callback;if(!l)throw new Error("seekToProgramTime: callback must be provided");return"undefined"!=typeof t&&i&&a?i.endList||u.hasStarted_?function(e){if(!e.segments||0===e.segments.length)return!1;for(var t=0;t<e.segments.length;t++)if(!e.segments[t].dateTimeObject)return!1;return!0}(i)?(n=function(e,t){var i;try{i=new Date(e)}catch(e){return null}if(!t||!t.segments||0===t.segments.length)return null;if(i<(r=t.segments[0]).dateTimeObject)return null;for(var n=0;n<t.segments.length-1;n++){var r=t.segments[n];if(i<t.segments[n+1].dateTimeObject)break}var a,s=t.segments[t.segments.length-1],e=s.dateTimeObject,a=s.videoTimingInfo?(a=s.videoTimingInfo).transmuxedPresentationEnd-a.transmuxedPresentationStart-a.transmuxerPrependedSeconds:s.duration+.25*s.duration;return new Date(e.getTime()+1e3*a)<i?null:{segment:r=e<i?s:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Nl.duration(t,t.mediaSequence+t.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"}}(t,i))?(s=n.segment,e=function(e,t){var i;try{n=new Date(e),i=new Date(t)}catch(e){}var n=n.getTime();return(i.getTime()-n)/1e3}(s.dateTimeObject,t),"estimate"===n.type?0===r?l({message:t+" is not buffered yet. Try again"}):(a(n.estimatedStart+e),void u.one("seeked",function(){Gu({programTime:t,playlist:i,retryCount:r-1,seekTo:a,pauseAfterSeek:o,tech:u,callback:l})})):(e=s.start+e,u.one("seeked",function(){return l(null,u.currentTime())}),o&&u.pause(),void a(e))):l({message:t+" was not found in the stream"}):l({message:"programDateTime tags must be provided in the manifest "+i.resolvedUri}):l({message:"player must be playing a live stream to start buffering"}):l({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"})}function zu(e,t){if(4===e.readyState)return t()}function Xu(e,t,r){function n(e,t,i,n){return t.abort(),o=!0,r(e,t,i,n)}function i(e,t){if(!o){if(e)return n(e,t,"",s);var i=t.responseText.substring(s&&s.byteLength||0,t.responseText.length);if(s=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if((t=t.filter(function(e){return e&&(e.byteLength||e.length)&&"string"!=typeof e})).length<=1)return _r(t[0]);var n=t.reduce(function(e,t,i){return e+(t.byteLength||t.length)},0),r=new Uint8Array(n),a=0;return t.forEach(function(e){e=_r(e),r.set(e,a),a+=e.byteLength}),r}(s,Tr(i,!0)),a=a||go(s),s.length<10||a&&s.length<a+2)return zu(t,function(){return n(e,t,"",s)});i=Ko(s);return"ts"===i&&s.length<188||!i&&s.length<376?zu(t,function(){return n(e,t,"",s)}):n(null,t,i,s)}}var a,s=[],o=!1,u=t({uri:e,beforeSend:function(t){t.overrideMimeType("text/plain; charset=x-user-defined"),t.addEventListener("progress",function(e){return e.total,e.loaded,Mu(t,null,{statusCode:t.status},i)})}},function(e,t){return Mu(u,e,t,i)});return u}function Ku(e,t){if(!Ou(e,t))return!1;if(e.sidx&&t.sidx&&(e.sidx.offset!==t.sidx.offset||e.sidx.length!==t.sidx.length))return!1;if(!e.sidx&&t.sidx||e.sidx&&!t.sidx)return!1;if(e.segments&&!t.segments||!e.segments&&t.segments)return!1;if(!e.segments&&!t.segments)return!0;for(var i=0;i<e.segments.length;i++){var n=e.segments[i],r=t.segments[i];if(n.uri!==r.uri)return!1;if(n.byterange||r.byterange){n=n.byterange,r=r.byterange;if(n&&!r||!n&&r)return!1;if(n.offset!==r.offset||n.length!==r.length)return!1}}return!0}function Yu(e,t,i,n){return"placeholder-uri-"+e+"-"+t+"-"+(n.attributes.NAME||i)}function Qu(e,t,i){for(var r,a,s=!0,o=Vl(e,{duration:t.duration,minimumUpdatePeriod:t.minimumUpdatePeriod,timelineStarts:t.timelineStarts}),n=0;n<t.playlists.length;n++){var u,l=t.playlists[n];l.sidx&&(u=qs(l.sidx),i&&i[u]&&i[u].sidx&&Bs(l,i[u].sidx,l.sidx.resolvedUri));l=Du(o,l,Ku);l&&(o=l,s=!1)}return Cu(t,function(e,t,i,n){var r,a;e.playlists&&e.playlists.length&&(r=e.playlists[0].id,(a=Du(o,e.playlists[0],Ku))&&(n in(o=a).mediaGroups[t][i]||(o.mediaGroups[t][i][n]=e),o.mediaGroups[t][i][n].playlists[0]=o.playlists[r],s=!1))}),a=t,Cu(r=o,function(e,t,i,n){n in a.mediaGroups[t][i]||delete r.mediaGroups[t][i][n]}),(s=t.minimumUpdatePeriod===e.minimumUpdatePeriod&&s)?null:o}function $u(e,t){var i,n={};for(i in e){var r=e[i].sidx;if(r){var a=qs(r);if(!t[a])break;var s=t[a].sidxInfo;s=s,r=r,(Boolean(!s.map&&!r.map)||Boolean(s.map&&r.map&&s.map.byterange.offset===r.map.byterange.offset&&s.map.byterange.length===r.map.byterange.length))&&s.uri===r.uri&&s.byterange.offset===r.byterange.offset&&s.byterange.length===r.byterange.length&&(n[a]=t[a])}}return n}function Ju(e){return e.on=e.addEventListener,e.off=e.removeEventListener,e}function Zu(i){var n=i.transmuxer,e=i.bytes,t=i.audioAppendStart,r=i.gopsToAlignWith,a=i.remux,s=i.onData,o=i.onTrackInfo,u=i.onAudioTimingInfo,l=i.onVideoTimingInfo,d=i.onVideoSegmentTimingInfo,c=i.onAudioSegmentTimingInfo,h=i.onId3,p=i.onCaptions,f=i.onDone,m=i.onEndedTimeline,g=i.onTransmuxerLog,y=i.isEndOfTimeline,v={buffer:[]},_=y;n.onmessage=function(e){var t;n.currentTransmux===i&&("data"===e.data.action&&function(e,t,i){var n=e.data.segment,r=n.type,a=n.initSegment,s=n.captions,o=n.captionStreams,u=n.metadata,l=n.videoFrameDtsTime,n=n.videoFramePtsTime;t.buffer.push({captions:s,captionStreams:o,metadata:u});e=e.data.segment.boxes||{data:e.data.segment.data},a={type:r,data:new Uint8Array(e.data,e.data.byteOffset,e.data.byteLength),initSegment:new Uint8Array(a.data,a.byteOffset,a.byteLength)};"undefined"!=typeof l&&(a.videoFrameDtsTime=l),"undefined"!=typeof n&&(a.videoFramePtsTime=n),i(a)}(e,v,s),"trackinfo"===e.data.action&&o(e.data.trackInfo),"gopInfo"===e.data.action&&(v.gopInfo=e.data.gopInfo),"audioTimingInfo"===e.data.action&&u(e.data.audioTimingInfo),"videoTimingInfo"===e.data.action&&l(e.data.videoTimingInfo),"videoSegmentTimingInfo"===e.data.action&&d(e.data.videoSegmentTimingInfo),"audioSegmentTimingInfo"===e.data.action&&c(e.data.audioSegmentTimingInfo),"id3Frame"===e.data.action&&h([e.data.id3Frame],e.data.id3Frame.dispatchType),"caption"===e.data.action&&p(e.data.caption),"endedtimeline"===e.data.action&&(_=!1,m()),"log"===e.data.action&&g(e.data.log),"transmuxed"===e.data.type&&(_||(n.onmessage=null,e=(t={transmuxedData:v,callback:f}).transmuxedData,t=t.callback,e.buffer=[],t(e),zl(n))))},t&&n.postMessage({action:"setAudioAppendStart",appendStart:t}),Array.isArray(r)&&n.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),"undefined"!=typeof a&&n.postMessage({action:"setRemux",remux:a}),e.byteLength&&(r=e instanceof ArrayBuffer?e:e.buffer,a=e instanceof ArrayBuffer?0:e.byteOffset,n.postMessage({action:"push",data:r,byteOffset:a,byteLength:e.byteLength},[r])),y&&n.postMessage({action:"endTimeline"}),n.postMessage({action:"flush"})}function el(e,t){e.postMessage({action:t}),zl(e)}function tl(e,t){if(!t.currentTransmux)return t.currentTransmux=e,el(t,e),0;t.transmuxQueue.push(el.bind(null,t,e))}function il(e){if(!e.transmuxer.currentTransmux)return e.transmuxer.currentTransmux=e,void Zu(e);e.transmuxer.transmuxQueue.push(e)}function nl(i){var n=i.transmuxer,r=i.endAction||i.action,a=i.callback,e=g({},i,{endAction:null,transmuxer:null,callback:null}),t=function e(t){t.data.action===r&&(n.removeEventListener("message",e),t.data.data&&(t.data.data=new Uint8Array(t.data.data,i.byteOffset||0,i.byteLength||t.data.data.byteLength),i.data&&(i.data=t.data.data)),a(t.data))};n.addEventListener("message",t),i.data?(t=i.data instanceof ArrayBuffer,e.byteOffset=t?0:i.data.byteOffset,e.byteLength=i.data.byteLength,t=[t?i.data:i.data.buffer],n.postMessage(e,t)):n.postMessage(e)}function rl(e){e.forEach(function(e){e.abort()})}function al(e,t){return t.timedout?{status:t.status,message:"HLS request timed-out at URL: "+t.uri,code:Ql,xhr:t}:t.aborted?{status:t.status,message:"HLS request aborted at URL: "+t.uri,code:$l,xhr:t}:e?{status:t.status,message:"HLS request errored at URL: "+t.uri,code:Yl,xhr:t}:"arraybuffer"===t.responseType&&0===t.response.byteLength?{status:t.status,message:"Empty HLS response at URL: "+t.uri,code:Yl,xhr:t}:null}function sl(a,s,o){return function(e,t){var i=t.response,e=al(e,t);if(e)return o(e,a);if(16!==i.byteLength)return o({status:t.status,message:"Invalid HLS key at URL: "+t.uri,code:Yl,xhr:t},a);for(var i=new DataView(i),n=new Uint32Array([i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12)]),r=0;r<s.length;r++)s[r].bytes=n;return o(null,a)}}function ol(i,n){var e=Ko(i.map.bytes);if("mp4"!==e){var t=i.map.resolvedUri||i.map.uri;return n({internal:!0,message:"Found unsupported "+(e||"unknown")+" container for initialization segment at URL: "+t,code:Yl})}nl({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:function(e){var t=e.tracks,e=e.data;return i.map.bytes=e,t.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)}),n(null)}})}function ul(e){var i=e.segment,n=e.finishProcessingFn,r=e.responseType;return function(e,t){e=al(e,t);if(e)return n(e,i);e="arraybuffer"!==r&&t.responseText?function(e){for(var t=new Uint8Array(new ArrayBuffer(e.length)),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t.buffer}(t.responseText.substring(i.lastReachedChar||0)):t.response;return i.stats={bandwidth:(t=t).bandwidth,bytesReceived:t.bytesReceived||0,roundTripTime:t.roundTripTime||0},i.key?i.encryptedBytes=new Uint8Array(e):i.bytes=new Uint8Array(e),n(null,i)}}function ll(e){var i=e.segment,t=e.bytes,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,d=e.endedTimelineFn,c=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,e=i.map&&i.map.tracks||{},f=Boolean(e.audio&&e.video),m=r.bind(null,i,"audio","start"),g=r.bind(null,i,"audio","end"),y=r.bind(null,i,"video","start"),v=r.bind(null,i,"video","end");nl({action:"probeTs",transmuxer:i.transmuxer,data:t,baseStartTime:i.baseStartTime,callback:function(e){i.bytes=t=e.data;e=e.result;e&&(n(i,{hasAudio:e.hasAudio,hasVideo:e.hasVideo,isMuxed:f}),n=null,e.hasAudio&&!f&&m(e.audioStart),e.hasVideo&&y(e.videoStart),y=m=null),il({bytes:t,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:f,onData:function(e){e.type="combined"===e.type?"video":e.type,c(i,e)},onTrackInfo:function(e){n&&(f&&(e.isMuxed=!0),n(i,e))},onAudioTimingInfo:function(e){m&&"undefined"!=typeof e.start&&(m(e.start),m=null),g&&"undefined"!=typeof e.end&&g(e.end)},onVideoTimingInfo:function(e){y&&"undefined"!=typeof e.start&&(y(e.start),y=null),v&&"undefined"!=typeof e.end&&v(e.end)},onVideoSegmentTimingInfo:function(e){a(e)},onAudioSegmentTimingInfo:function(e){s(e)},onId3:function(e,t){o(i,e,t)},onCaptions:function(e){u(i,[e])},isEndOfTimeline:l,onEndedTimeline:function(){d()},onTransmuxerLog:p,onDone:function(e){h&&(e.type="combined"===e.type?"video":e.type,h(null,i,e))}})}})}function dl(e){var i=e.segment,n=e.bytes,t=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,d=e.endedTimelineFn,c=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,f=new Uint8Array(n);if(0<vo(f,["moof"]).length){i.isFmp4=!0;var m=i.map.tracks,g={isFmp4:!0,hasVideo:!!m.video,hasAudio:!!m.audio};m.audio&&m.audio.codec&&"enca"!==m.audio.codec&&(g.audioCodec=m.audio.codec),m.video&&m.video.codec&&"encv"!==m.video.codec&&(g.videoCodec=m.video.codec),m.video&&m.audio&&(g.isMuxed=!0),t(i,g);var y=function(e){c(i,{data:f,type:g.hasAudio&&!g.isMuxed?"audio":"video"}),e&&e.length&&u(i,e),h(null,i,{})};nl({action:"probeMp4StartTime",timescales:i.map.timescales,data:f,transmuxer:i.transmuxer,callback:function(e){var t=e.data,e=e.startTime;n=t.buffer,i.bytes=f=t,g.hasAudio&&!g.isMuxed&&r(i,"audio","start",e),g.hasVideo&&r(i,"video","start",e),m.video&&t.byteLength&&i.transmuxer?nl({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:f,timescales:i.map.timescales,trackIds:[m.video.id],callback:function(e){n=e.data.buffer,i.bytes=f=e.data,e.logs.forEach(function(e){p(ir.mergeOptions(e,{stream:"mp4CaptionParser"}))}),y(e.captions)}}):y()}})}else if(i.transmuxer){if("undefined"==typeof i.container&&(i.container=Ko(f)),"ts"!==i.container&&"aac"!==i.container)return t(i,{hasAudio:!1,hasVideo:!1}),h(null,i,{}),0;ll({segment:i,bytes:n,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:d,dataFn:c,doneFn:h,onTransmuxerLog:p})}else h(null,i,{})}function cl(e,i){var n=e.id,t=e.key,r=e.encryptedBytes,a=e.decryptionWorker,e=function e(t){t.data.source===n&&(a.removeEventListener("message",e),t=t.data.decrypted,i(new Uint8Array(t.bytes,t.byteOffset,t.byteLength)))};a.addEventListener("message",e),e=t.bytes.slice?t.bytes.slice():new Uint32Array(Array.prototype.slice.call(t.bytes)),a.postMessage(ju({source:n,encrypted:r,key:e,iv:t.iv}),[r.buffer,e.buffer])}function hl(e){var i=e.activeXhrs,m=e.decryptionWorker,g=e.trackInfoFn,y=e.timingInfoFn,v=e.videoSegmentTimingInfoFn,_=e.audioSegmentTimingInfoFn,b=e.id3Fn,T=e.captionsFn,w=e.isEndOfTimeline,S=e.endedTimelineFn,E=e.dataFn,k=e.doneFn,C=e.onTransmuxerLog,n=0,r=!1;return function(e,f){if(!r){if(e)return r=!0,rl(i),k(e,f);if((n+=1)===i.length){var t=function(){if(f.encryptedBytes)return t=(e={decryptionWorker:m,segment:f,trackInfoFn:g,timingInfoFn:y,videoSegmentTimingInfoFn:v,audioSegmentTimingInfoFn:_,id3Fn:b,captionsFn:T,isEndOfTimeline:w,endedTimelineFn:S,dataFn:E,doneFn:k,onTransmuxerLog:C}).decryptionWorker,i=e.segment,n=e.trackInfoFn,r=e.timingInfoFn,a=e.videoSegmentTimingInfoFn,s=e.audioSegmentTimingInfoFn,o=e.id3Fn,u=e.captionsFn,l=e.isEndOfTimeline,d=e.endedTimelineFn,c=e.dataFn,h=e.doneFn,p=e.onTransmuxerLog,void cl({id:i.requestId,key:i.key,encryptedBytes:i.encryptedBytes,decryptionWorker:t},function(e){i.bytes=e,dl({segment:i,bytes:i.bytes,trackInfoFn:n,timingInfoFn:r,videoSegmentTimingInfoFn:a,audioSegmentTimingInfoFn:s,id3Fn:o,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:d,dataFn:c,doneFn:h,onTransmuxerLog:p})});var e,t,i,n,r,a,s,o,u,l,d,c,h,p;dl({segment:f,bytes:f.bytes,trackInfoFn:g,timingInfoFn:y,videoSegmentTimingInfoFn:v,audioSegmentTimingInfoFn:_,id3Fn:b,captionsFn:T,isEndOfTimeline:w,endedTimelineFn:S,dataFn:E,doneFn:k,onTransmuxerLog:C})};if(f.endOfAllRequests=Date.now(),f.map&&f.map.encryptedBytes&&!f.map.bytes)return cl({decryptionWorker:m,id:f.requestId+"-init",encryptedBytes:f.map.encryptedBytes,key:f.map.key},function(e){f.map.bytes=e,ol(f,function(e){return e?(rl(i),k(e,f)):void t()})});t()}}}}function pl(e){var n=e.segment,r=e.progressFn;return e.trackInfoFn,e.timingInfoFn,e.videoSegmentTimingInfoFn,e.audioSegmentTimingInfoFn,e.id3Fn,e.captionsFn,e.isEndOfTimeline,e.endedTimelineFn,e.dataFn,function(e){var t,i=e.target;if(!i.aborted)return n.stats=ir.mergeOptions(n.stats,(i=(t=e).target,(i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-i.requestTime||0}).bytesReceived=t.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i)),!n.stats.firstBytesReceivedAt&&n.stats.bytesReceived&&(n.stats.firstBytesReceivedAt=Date.now()),r(e,n)}}function fl(e){var t,i,n,r=e.xhr,a=e.xhrOptions,s=e.decryptionWorker,o=e.segment,u=e.abortFn,l=e.progressFn,d=e.trackInfoFn,c=e.timingInfoFn,h=e.videoSegmentTimingInfoFn,p=e.audioSegmentTimingInfoFn,f=e.id3Fn,m=e.captionsFn,g=e.isEndOfTimeline,y=e.endedTimelineFn,v=e.dataFn,_=e.doneFn,e=e.onTransmuxerLog,b=[],_=hl({activeXhrs:b,decryptionWorker:s,trackInfoFn:d,timingInfoFn:c,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:p,id3Fn:f,captionsFn:m,isEndOfTimeline:g,endedTimelineFn:y,dataFn:v,doneFn:_,onTransmuxerLog:e});o.key&&!o.key.bytes&&(e=[o.key],o.map&&!o.map.bytes&&o.map.key&&o.map.key.resolvedUri===o.key.resolvedUri&&e.push(o.map.key),e=r(ir.mergeOptions(a,{uri:o.key.resolvedUri,responseType:"arraybuffer"}),sl(o,e,_)),b.push(e)),o.map&&!o.map.bytes&&(!o.map.key||o.key&&o.key.resolvedUri===o.map.key.resolvedUri||(t=r(ir.mergeOptions(a,{uri:o.map.key.resolvedUri,responseType:"arraybuffer"}),sl(o,[o.map.key],_)),b.push(t)),t=r(ir.mergeOptions(a,{uri:o.map.resolvedUri,responseType:"arraybuffer",headers:Uu(o.map)}),(i=(t={segment:o,finishProcessingFn:_}).segment,n=t.finishProcessingFn,function(e,t){e=al(e,t);if(e)return n(e,i);e=new Uint8Array(t.response);if(i.map.key)return i.map.encryptedBytes=e,n(null,i);i.map.bytes=e,ol(i,function(e){return e?(e.xhr=t,e.status=t.status,n(e,i)):void n(null,i)})})),b.push(t)),a=ir.mergeOptions(a,{uri:o.part&&o.part.resolvedUri||o.resolvedUri,responseType:"arraybuffer",headers:Uu(o)}),(a=r(a,ul({segment:o,finishProcessingFn:_,responseType:a.responseType}))).addEventListener("progress",pl({segment:o,progressFn:l,trackInfoFn:d,timingInfoFn:c,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:p,id3Fn:f,captionsFn:m,isEndOfTimeline:g,endedTimelineFn:y,dataFn:v})),b.push(a);var T={};return b.forEach(function(e){var t,i;e.addEventListener("loadend",(t=(e={loadendState:T,abortFn:u}).loadendState,i=e.abortFn,function(e){e.target.aborted&&i&&!t.calledAbortFn&&(i(),t.calledAbortFn=!0)}))}),function(){return rl(b)}}function ml(e,t){return t=t.attributes||{},e&&e.mediaGroups&&e.mediaGroups.AUDIO&&t.AUDIO&&e.mediaGroups.AUDIO[t.AUDIO]}function gl(e){var n={};return e.forEach(function(e){var t=e.mediaType,i=e.type,e=e.details;n[t]=n[t]||[],n[t].push(cr(""+i+e))}),Object.keys(n).forEach(function(e){return 1<n[e].length?(Jl("multiple "+e+" codecs found as attributes: "+n[e].join(", ")+". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs."),void(n[e]=null)):void(n[e]=n[e][0])}),n}function yl(e){var t=0;return e.audio&&t++,e.video&&t++,t}function vl(e,t){var i,n=t.attributes||{},r=gl(function(e){e=e.attributes||{};if(e.CODECS)return hr(e.CODECS)}(t)||[]);return ml(e,t)&&!r.audio&&!function(e,t){if(!ml(e,t))return!0;var i,t=t.attributes||{},n=e.mediaGroups.AUDIO[t.AUDIO];for(i in n)if(!n[i].uri&&!n[i].playlists)return!0;return!1}(e,t)&&(i=gl(function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i,n=e.mediaGroups.AUDIO[t];if(!n)return null;for(i in n){var r=n[i];if(r.default&&r.playlists)return hr(r.playlists[0].attributes.CODECS)}return null}(e,n.AUDIO)||[])).audio&&(r.audio=i.audio),r}function _l(e){if(e&&e.playlist){var t=e.playlist;return JSON.stringify({id:t.id,bandwidth:e.bandwidth,width:e.width,height:e.height,codecs:t.attributes&&t.attributes.CODECS||""})}}function bl(e,t){return(e=e&&window.getComputedStyle(e))?e[t]:""}function Tl(e,n){var r=e.slice();e.sort(function(e,t){var i=n(e,t);return 0===i?r.indexOf(e)-r.indexOf(t):i})}function wl(e,t){var i,n;return(i=(i=e.attributes.BANDWIDTH?e.attributes.BANDWIDTH:i)||window.Number.MAX_VALUE)-(n=(n=t.attributes.BANDWIDTH?t.attributes.BANDWIDTH:n)||window.Number.MAX_VALUE)}function Sl(e,t,i,n,r,a){if(e){var s={bandwidth:t,width:i,height:n,limitRenditionByPlayerDimensions:r},o=e.playlists;Nl.isAudioOnly(e)&&(o=a.getAudioTrackPlaylists_(),s.audioOnly=!0);var u=o.map(function(e){var t=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width,i=e.attributes&&e.attributes.RESOLUTION&&e.attributes.RESOLUTION.height,n=e.attributes&&e.attributes.BANDWIDTH;return{bandwidth:n||window.Number.MAX_VALUE,width:t,height:i,playlist:e}});Tl(u,function(e,t){return e.bandwidth-t.bandwidth});var l=(u=u.filter(function(e){return!Nl.isIncompatible(e.playlist)})).filter(function(e){return Nl.isEnabled(e.playlist)}),e=(l=!l.length?u.filter(function(e){return!Nl.isDisabled(e.playlist)}):l).filter(function(e){return e.bandwidth*Wl.BANDWIDTH_VARIANCE<t}),d=e[e.length-1],o=e.filter(function(e){return e.bandwidth===d.bandwidth})[0];if(!1===r){var c=o||l[0]||u[0];if(c&&c.playlist){r=o?"bandwidthBestRep":"sortedPlaylistReps";return l[0]&&(r="enabledPlaylistReps"),Zl("choosing "+_l(c)+" using "+r+" with options",s),c.playlist}return Zl("could not choose a playlist with options",s),null}c=e.filter(function(e){return e.width&&e.height});Tl(c,function(e,t){return e.width-t.width});var h,p,f,e=c.filter(function(e){return e.width===i&&e.height===n}),d=e[e.length-1],e=e.filter(function(e){return e.bandwidth===d.bandwidth})[0];e||(p=(h=c.filter(function(e){return e.width>i||e.height>n})).filter(function(e){return e.width===h[0].width&&e.height===h[0].height}),d=p[p.length-1],p=p.filter(function(e){return e.bandwidth===d.bandwidth})[0]),a.experimentalLeastPixelDiffSelector&&(m=c.map(function(e){return e.pixelDiff=Math.abs(e.width-i)+Math.abs(e.height-n),e}),Tl(m,function(e,t){return e.pixelDiff===t.pixelDiff?t.bandwidth-e.bandwidth:e.pixelDiff-t.pixelDiff}),f=m[0]);var m=f||p||e||o||l[0]||u[0];if(m&&m.playlist){u="sortedPlaylistReps";return f?u="leastPixelDiffRep":p?u="resolutionPlusOneRep":e?u="resolutionBestRep":o?u="bandwidthBestRep":l[0]&&(u="enabledPlaylistReps"),Zl("choosing "+_l(m)+" using "+u+" with options",s),m.playlist}return Zl("could not choose a playlist with options",s),null}}function El(e){var t=e.inbandTextTracks,i=e.metadataArray,r=e.timestampOffset,n=e.videoDuration;if(i){var a=window.WebKitDataCue||window.VTTCue,s=t.metadataTrack_;if(s&&(i.forEach(function(e){var n=e.cueTime+r;!("number"!=typeof n||window.isNaN(n)||n<0)&&n<1/0&&e.frames.forEach(function(e){var t,i=new a(n,n,e.value||e.url||e.data||"");i.frame=e,i.value=e,t=i,Object.defineProperties(t.frame,{id:{get:function(){return ir.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),t.value.key}},value:{get:function(){return ir.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),t.value.data}},privateData:{get:function(){return ir.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),t.value.data}}}),s.addCue(i)})}),s.cues&&s.cues.length)){for(var o=s.cues,u=[],l=0;l<o.length;l++)o[l]&&u.push(o[l]);var d=u.reduce(function(e,t){var i=e[t.startTime]||[];return i.push(t),e[t.startTime]=i,e},{}),c=Object.keys(d).sort(function(e,t){return Number(e)-Number(t)});c.forEach(function(e,t){var e=d[e],i=Number(c[t+1])||n;e.forEach(function(e){e.endTime=i})})}}}function kl(e,t,i){var n,r;if(i&&i.cues)for(n=i.cues.length;n--;)(r=i.cues[n]).startTime>=e&&r.endTime<=t&&i.removeCue(r)}function Cl(e){return"number"==typeof e&&isFinite(e)}function Il(e){var t=e.startOfSegment,i=e.duration,n=e.segment,r=e.part,a=e.playlist,s=a.mediaSequence,o=a.id,u=a.segments,l=e.mediaIndex,d=e.partIndex,c=e.timeline,h=(void 0===u?[]:u).length-1,p="mediaIndex/partIndex increment";return e.getMediaInfoForTime?p="getMediaInfoForTime ("+e.getMediaInfoForTime+")":e.isSyncRequest&&(p="getSyncSegmentCandidate (isSyncRequest)"),e.independent&&(p+=" with independent "+e.independent),a="number"==typeof d,u=e.segment.uri?"segment":"pre-segment",e=a?du({preloadSegment:n})-1:0,u+" ["+(s+l)+"/"+(s+h)+"]"+(a?" part ["+d+"/"+e+"]":"")+" segment start/end ["+n.start+" => "+n.end+"]"+(a?" part start/end ["+r.start+" => "+r.end+"]":"")+" startOfSegment ["+t+"] duration ["+i+"] timeline ["+c+"] selected by ["+p+"] playlist ["+o+"]"}function xl(e){return e+"TimingInfo"}function Al(e){var t=e.timelineChangeController,i=e.currentTimeline,n=e.segmentTimeline,r=e.loaderType,e=e.audioDisabled;if(i!==n){if("audio"===r){i=t.lastTimelineChange({type:"main"});return!i||i.to!==n}if("main"===r&&e){t=t.pendingTimelineChange({type:"audio"});return t&&t.to===n?!1:!0}}}function Pl(e){var t=e.segmentDuration,e=e.maxDuration;return!!t&&Math.round(t)>e+Rl}function Ll(e,t){if("hls"!==t)return null;var n,r,i=(n={audioTimingInfo:e.audioTimingInfo,videoTimingInfo:e.videoTimingInfo},r=0,["video","audio"].forEach(function(e){var t,i=n[e+"TimingInfo"];i&&(e=i.start,i=i.end,"bigint"==typeof e||"bigint"==typeof i?t=window.BigInt(i)-window.BigInt(e):"number"==typeof e&&"number"==typeof i&&(t=i-e),"undefined"!=typeof t&&r<t&&(r=t))}),r="bigint"==typeof r&&r<Number.MAX_SAFE_INTEGER?Number(r):r);if(!i)return null;var a=e.playlist.targetDuration,s=Pl({segmentDuration:i,maxDuration:2*a}),t=Pl({segmentDuration:i,maxDuration:a}),a="Segment with index "+e.mediaIndex+" from playlist "+e.playlist.id+" has a duration of "+i+" when the reported duration is "+e.duration+" and the target duration is "+a+". 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";return s||t?{severity:s?"warn":"info",message:a}:null}var Ol=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},W=m(function(t){function n(e){var i="function"==typeof Map?new Map:void 0;return t.exports=n=function(e){if(null===e||!Ol(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!=typeof i){if(i.has(e))return i.get(e);i.set(e,t)}function t(){return Xn(e,arguments,$o(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),jn(t,e)},n(e)}t.exports=n}),Dl=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,n=/^\/\//.test(e),r=!window.location&&!/\/\//i.test(e);if(i?e=new window.URL(e,window.location||rr):/\/\//i.test(e)||(e=nr.buildAbsoluteURL(window.location&&window.location.href||"",e)),i){i=new URL(t,e);return r?i.href.slice(rr.length):n?i.href.slice(i.protocol.length):i.href}return nr.buildAbsoluteURL(e,t)},Rl=1/30,Ml=ir.createTimeRange,Nl={liveEdgeDelay:cu,duration:pu,seekable:function(e,t,i){var n=t||0,i=mu(e,t,!0,i);return null===i?Ml():Ml(n,i)},getMediaInfoForTime:function(e){for(var t=e.playlist,i=e.currentTime,n=e.startingSegmentIndex,r=e.startingPartIndex,a=e.startTime,s=e.experimentalExactManifestTimings,o=i-a,u=uu(t),l=0,d=0;d<u.length;d++){var c=u[d];if(n===c.segmentIndex&&("number"!=typeof r||"number"!=typeof c.partIndex||r===c.partIndex)){l=d;break}}if(o<0){if(0<l)for(var h=l-1;0<=h;h--){var p=u[h];if(o+=p.duration,s){if(o<0)continue}else if(o+Rl<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:a-fu({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:h})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i}}if(l<0){for(var f=l;f<0;f++)if((o-=t.targetDuration)<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:i};l=0}for(var m=l;m<u.length;m++){var g=u[m];if(o-=g.duration,s){if(0<o)continue}else if(0<=o-Rl)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:a+fu({defaultDuration:t.targetDuration,durationList:u,startIndex:l,endIndex:m})}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:i}},isEnabled:vu,isDisabled:function(e){return e.disabled},isBlacklisted:gu,isIncompatible:yu,playlistEnd:mu,isAes:function(e){for(var t=0;t<e.segments.length;t++)if(e.segments[t].key)return!0;return!1},hasAttribute:_u,estimateSegmentRequestTime:function(e,t,i,n){return _u("BANDWIDTH",i)?(e*i.attributes.BANDWIDTH-8*(n=void 0===n?0:n))/t:NaN},isLowestEnabledRendition:bu,isAudioOnly:Su,playlistMatch:Tu,segmentDurationWithParts:ou},Ul=ir.log,Bl=ir.mergeOptions,Qr=ir.EventTarget,Fl=function(a){function e(e,t,i){var n;if(void 0===i&&(i={}),n=a.call(this)||this,!e)throw new Error("A non-empty playlist URL or object is required");n.logger_=Zo("PlaylistLoader");var r=i.withCredentials,r=void 0!==r&&r,i=i.handleManifestRedirects,i=void 0!==i&&i;n.src=e,n.vhs_=t,n.withCredentials=r,n.handleManifestRedirects=i;t=t.options_;return n.customTagParsers=t&&t.customTagParsers||[],n.customTagMappers=t&&t.customTagMappers||[],n.experimentalLLHLS=t&&t.experimentalLLHLS||!1,ir.browser.IE_VERSION&&(n.experimentalLLHLS=!1),n.state="HAVE_NOTHING",n.handleMediaupdatetimeout_=n.handleMediaupdatetimeout_.bind(ft(n)),n.on("mediaupdatetimeout",n.handleMediaupdatetimeout_),n}mt(e,a);var t=e.prototype;return t.handleMediaupdatetimeout_=function(){var e,t,i=this;"HAVE_METADATA"===this.state&&(e=this.media(),t=Dl(this.master.uri,e.uri),this.experimentalLLHLS&&(t=function(e,t){if(t.endList||!t.serverControl)return e;var i,n,r,a,s={};return t.serverControl.canBlockReload&&(r=t.preloadSegment,i=t.mediaSequence+t.segments.length,r&&(n=r.parts||[],-1<(r=du(t)-1)&&r!=n.length-1&&(s._HLS_part=r),(-1<r||n.length)&&i--),s._HLS_msn=i),t.serverControl&&t.serverControl.canSkipUntil&&(s._HLS_skip=t.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(s).length&&(a=new window.URL(e),["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(e){s.hasOwnProperty(e)&&a.searchParams.set(e,s[e])}),e=a.toString()),e}(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},function(e,t){if(i.request)return e?i.playlistRequestError(i.request,i.media(),"HAVE_METADATA"):void i.haveMetadata({playlistString:i.request.responseText,url:i.media().uri,id:i.media().id})}))},t.playlistRequestError=function(e,t,i){var n=t.uri,t=t.id;this.request=null,i&&(this.state=i),this.error={playlist:this.master.playlists[t],status:e.status,message:"HLS playlist request error at URL: "+n+".",responseText:e.responseText,code:500<=e.status?4:2},this.trigger("error")},t.parseManifest_=function(e){var t=this,i=e.url;return function(e){var t=e.onwarn,i=e.oninfo,n=e.manifestString,r=e.customTagParsers,a=void 0===r?[]:r,r=e.customTagMappers,r=void 0===r?[]:r,e=e.experimentalLLHLS,s=new Ir;t&&s.on("warn",t),i&&s.on("info",i),a.forEach(function(e){return s.addParser(e)}),r.forEach(function(e){return s.addTagMapper(e)}),s.push(n),s.end();var o=s.manifest;e||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(e){o.hasOwnProperty(e)&&delete o[e]}),o.segments&&o.segments.forEach(function(t){["parts","preloadHints"].forEach(function(e){t.hasOwnProperty(e)&&delete t[e]})})),o.targetDuration||(u=10,o.segments&&o.segments.length&&(u=o.segments.reduce(function(e,t){return Math.max(e,t.duration)},0)),t&&t("manifest has no targetDuration defaulting to "+u),o.targetDuration=u);var u=lu(o);return u.length&&!o.partTargetDuration&&(u=u.reduce(function(e,t){return Math.max(e,t.duration)},0),t&&(t("manifest has no partTargetDuration defaulting to "+u),Ul.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.")),o.partTargetDuration=u),o}({onwarn:function(e){e=e.message;return t.logger_("m3u8-parser warn for "+i+": "+e)},oninfo:function(e){e=e.message;return t.logger_("m3u8-parser info for "+i+": "+e)},manifestString:e.manifestString,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,experimentalLLHLS:this.experimentalLLHLS})},t.haveMetadata=function(e){var t=e.playlistString,i=e.playlistObject,n=e.url,e=e.id;this.request=null,this.state="HAVE_METADATA";t=i||this.parseManifest_({url:n,manifestString:t});t.lastRequest=Date.now(),Iu({playlist:t,uri:n,id:e});n=Du(this.master,t);this.targetDuration=t.partTargetDuration||t.targetDuration,this.pendingMedia_=null,n?(this.master=n,this.media_=this.master.playlists[e]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(Ru(this.media(),!!n)),this.trigger("loadedplaylist")},t.dispose=function(){this.trigger("dispose"),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),window.clearTimeout(this.finalRenditionTimeout),this.off()},t.stopRequest=function(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())},t.media=function(i,e){var n=this;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.master.playlists[i])throw new Error("Unknown playlist URI: "+i);i=this.master.playlists[i]}if(window.clearTimeout(this.finalRenditionTimeout),e){var t=(i.partTargetDuration||i.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=window.setTimeout(this.media.bind(this,i,!1),t)}else{var r=this.state,e=!this.media_||i.id!==this.media_.id,t=this.master.playlists[i.id];if(t&&t.endList||i.endList&&i.segments.length)return this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=i,void(e&&(this.trigger("mediachanging"),"HAVE_MASTER"===r?this.trigger("loadedmetadata"):this.trigger("mediachange")));if(this.updateMediaUpdateTimeout_(Ru(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},function(e,t){if(n.request){if(i.lastRequest=Date.now(),i.resolvedUri=Jo(n.handleManifestRedirects,i.resolvedUri,t),e)return n.playlistRequestError(n.request,i,r);n.haveMetadata({playlistString:t.responseText,url:i.uri,id:i.id}),"HAVE_MASTER"===r?n.trigger("loadedmetadata"):n.trigger("mediachange")}})}}},t.pause=function(){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_MASTER":"HAVE_CURRENT_METADATA"===this.state&&(this.state="HAVE_METADATA")},t.load=function(e){var t=this;this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);var i=this.media();e?(e=i?(i.partTargetDuration||i.targetDuration)/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(function(){t.mediaUpdateTimeout=null,t.load()},e)):this.started?i&&!i.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist"):this.start()},t.updateMediaUpdateTimeout_=function(e){var t=this;this.mediaUpdateTimeout&&(window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.media()&&!this.media().endList&&(this.mediaUpdateTimeout=window.setTimeout(function(){t.mediaUpdateTimeout=null,t.trigger("mediaupdatetimeout"),t.updateMediaUpdateTimeout_(e)},e))},t.start=function(){var i=this;if(this.started=!0,"object"==typeof this.src)return this.src.uri||(this.src.uri=window.location.href),this.src.resolvedUri=this.src.uri,void setTimeout(function(){i.setupInitialPlaylist(i.src)},0);this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},function(e,t){if(i.request){if(i.request=null,e)return i.error={status:t.status,message:"HLS playlist request error at URL: "+i.src+".",responseText:t.responseText,code:2},"HAVE_NOTHING"===i.state&&(i.started=!1),i.trigger("error");i.src=Jo(i.handleManifestRedirects,i.src,t);t=i.parseManifest_({manifestString:t.responseText,url:i.src});i.setupInitialPlaylist(t)}})},t.srcUri=function(){return"string"==typeof this.src?this.src:this.src.uri},t.setupInitialPlaylist=function(e){if(this.state="HAVE_MASTER",e.playlists)return this.master=e,xu(this.master,this.srcUri()),e.playlists.forEach(function(t){t.segments=Lu(t),t.segments.forEach(function(e){Pu(e,t.resolvedUri)})}),this.trigger("loadedplaylist"),void(this.request||this.media(this.master.playlists[0]));var t,i,n,r=this.srcUri()||window.location.href;this.master=(i=Eu(0,t=r),(n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:window.location.href,resolvedUri:window.location.href,playlists:[{uri:t,id:i,resolvedUri:t,attributes:{}}]}).playlists[i]=n.playlists[0],n.playlists[t]=n.playlists[0],n),this.haveMetadata({playlistObject:e,url:r,id:this.master.playlists[0].id}),this.trigger("loadedmetadata")},e}(Qr),jl=ir.xhr,Hl=ir.mergeOptions,U=Object.freeze({__proto__:null,createTransferableMessage:ju,initSegmentId:Hu,segmentKeyId:Vu,hexDump:qu,tagDump:function(e){e=e.bytes;return qu(e)},textRanges:function(e){for(var t,i,n="",r=0;r<e.length;r++)n+=(i=r,(t=e).start(i)+"-"+t.end(i)+" ");return n}}),zt=ir.EventTarget,Vl=ir.mergeOptions,ql=function(a){function e(e,t,i,n){var r;void 0===i&&(i={}),(r=a.call(this)||this).masterPlaylistLoader_=n||ft(r),n||(r.isMaster_=!0);n=i.withCredentials,n=void 0!==n&&n,i=i.handleManifestRedirects,i=void 0!==i&&i;if(r.vhs_=t,r.withCredentials=n,r.handleManifestRedirects=i,!e)throw new Error("A non-empty playlist URL or object is required");return r.on("minimumUpdatePeriod",function(){r.refreshXml_()}),r.on("mediaupdatetimeout",function(){r.refreshMedia_(r.media().id)}),r.state="HAVE_NOTHING",r.loadedPlaylists_={},r.logger_=Zo("DashPlaylistLoader"),r.isMaster_?(r.masterPlaylistLoader_.srcUrl=e,r.masterPlaylistLoader_.sidxMapping_={}):r.childPlaylist_=e,r}mt(e,a);var t=e.prototype;return t.requestErrored_=function(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)},t.addSidxSegments_=function(a,n,r){var s,o,u=this,l=a.sidx&&qs(a.sidx);a.sidx&&l&&!this.masterPlaylistLoader_.sidxMapping_[l]?(s=Jo(this.handleManifestRedirects,a.sidx.resolvedUri),o=function(e,t){if(!u.requestErrored_(e,t,n)){var i,e=u.masterPlaylistLoader_.sidxMapping_;try{i=Bo(_r(t.response).subarray(8))}catch(e){return void u.requestErrored_(e,t,n)}return e[l]={sidxInfo:a.sidx,sidx:i},Bs(a,i,a.sidx.resolvedUri),r(!0)}},this.request=Xu(s,this.vhs_.xhr,function(e,t,i,n){if(e)return o(e,t);if(!i||"mp4"!==i)return o({status:t.status,message:"Unsupported "+(i||"unknown")+" container type for sidx segment at URL: "+s,response:"",playlist:a,internal:!0,blacklistDuration:1/0,code:2},t);var r=a.sidx.byterange,i=r.offset,r=r.length;if(n.length>=r+i)return o(e,{response:n.subarray(i,i+r),status:t.status,uri:t.uri});u.request=u.vhs_.xhr({uri:s,responseType:"arraybuffer",headers:Uu({byterange:a.sidx.byterange})},o)})):this.mediaRequest_=window.setTimeout(function(){return r(!1)},0)},t.dispose=function(){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.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.off()},t.hasPendingRequest=function(){return this.request||this.mediaRequest_},t.stopRequest=function(){var e;this.request&&(e=this.request,this.request=null,e.onreadystatechange=null,e.abort())},t.media=function(t){var i=this;if(!t)return this.media_;if("HAVE_NOTHING"===this.state)throw new Error("Cannot switch media playlist from "+this.state);var n=this.state;if("string"==typeof t){if(!this.masterPlaylistLoader_.master.playlists[t])throw new Error("Unknown playlist URI: "+t);t=this.masterPlaylistLoader_.master.playlists[t]}var e=!this.media_||t.id!==this.media_.id;if(e&&this.loadedPlaylists_[t.id]&&this.loadedPlaylists_[t.id].endList)return this.state="HAVE_METADATA",this.media_=t,void(e&&(this.trigger("mediachanging"),this.trigger("mediachange")));e&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(t,n,function(e){i.haveMetadata({startingState:n,playlist:t})}))},t.haveMetadata=function(e){var t=e.startingState,e=e.playlist;this.state="HAVE_METADATA",this.loadedPlaylists_[e.id]=e,this.mediaRequest_=null,this.refreshMedia_(e.id),"HAVE_MASTER"===t?this.trigger("loadedmetadata"):this.trigger("mediachange")},t.pause=function(){this.masterPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.masterPlaylistLoader_.createMupOnMedia_),this.masterPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMaster_&&(window.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_),this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_=null),"HAVE_NOTHING"===this.state&&(this.started=!1)},t.load=function(e){var t=this;window.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;var i=this.media();e?(e=i?i.targetDuration/2*1e3:5e3,this.mediaUpdateTimeout=window.setTimeout(function(){return t.load()},e)):this.started?i&&!i.endList?(this.isMaster_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist"):this.start()},t.start=function(){var i=this;this.started=!0,this.isMaster_?this.requestMaster_(function(e,t){i.haveMaster_(),i.hasPendingRequest()||i.media_||i.media(i.masterPlaylistLoader_.master.playlists[0])}):this.mediaRequest_=window.setTimeout(function(){return i.haveMaster_()},0)},t.requestMaster_=function(n){var r=this;this.request=this.vhs_.xhr({uri:this.masterPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},function(e,t){if(!r.requestErrored_(e,t)){var i=t.responseText!==r.masterPlaylistLoader_.masterXml_;return r.masterPlaylistLoader_.masterXml_=t.responseText,t.responseHeaders&&t.responseHeaders.date?r.masterLoaded_=Date.parse(t.responseHeaders.date):r.masterLoaded_=Date.now(),r.masterPlaylistLoader_.srcUrl=Jo(r.handleManifestRedirects,r.masterPlaylistLoader_.srcUrl,t),i?(r.handleMaster_(),void r.syncClientServerClock_(function(){return n(t,i)})):n(t,i)}"HAVE_NOTHING"===r.state&&(r.started=!1)})},t.syncClientServerClock_=function(i){var n=this,r=mo(this.masterPlaylistLoader_.masterXml_);return null===r?(this.masterPlaylistLoader_.clientOffset_=this.masterLoaded_-Date.now(),i()):"DIRECT"===r.method?(this.masterPlaylistLoader_.clientOffset_=r.value-Date.now(),i()):void(this.request=this.vhs_.xhr({uri:Dl(this.masterPlaylistLoader_.srcUrl,r.value),method:r.method,withCredentials:this.withCredentials},function(e,t){if(n.request){if(e)return n.masterPlaylistLoader_.clientOffset_=n.masterLoaded_-Date.now(),i();t="HEAD"===r.method?t.responseHeaders&&t.responseHeaders.date?Date.parse(t.responseHeaders.date):n.masterLoaded_:Date.parse(t.responseText);n.masterPlaylistLoader_.clientOffset_=t-Date.now(),i()}}))},t.haveMaster_=function(){this.state="HAVE_MASTER",this.isMaster_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)},t.handleMaster_=function(){this.mediaRequest_=null;var e,t,i,n,r=this.masterPlaylistLoader_.master,t=(a={masterXml:this.masterPlaylistLoader_.masterXml_,srcUrl:this.masterPlaylistLoader_.srcUrl,clientOffset:this.masterPlaylistLoader_.clientOffset_,sidxMapping:this.masterPlaylistLoader_.sidxMapping_,previousManifest:r},e=a.masterXml,t=a.srcUrl,i=a.clientOffset,n=a.sidxMapping,a=a.previousManifest,a=fo(e,{manifestUri:t,clientOffset:i,sidxMapping:n,previousManifest:a}),xu(a,t,Yu),a);r&&(t=Qu(r,t,this.masterPlaylistLoader_.sidxMapping_)),this.masterPlaylistLoader_.master=t||r;var a=this.masterPlaylistLoader_.master.locations&&this.masterPlaylistLoader_.master.locations[0];return a&&a!==this.masterPlaylistLoader_.srcUrl&&(this.masterPlaylistLoader_.srcUrl=a),(!r||t&&t.minimumUpdatePeriod!==r.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),Boolean(t)},t.updateMinimumUpdatePeriodTimeout_=function(){var e=this.masterPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(window.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);var t=e.master&&e.master.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)},t.createMUPTimeout_=function(e){var t=this.masterPlaylistLoader_;t.minimumUpdatePeriodTimeout_=window.setTimeout(function(){t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)},t.refreshXml_=function(){var i=this;this.requestMaster_(function(e,t){var r,a;t&&(i.media_&&(i.media_=i.masterPlaylistLoader_.master.playlists[i.media_.id]),i.masterPlaylistLoader_.sidxMapping_=(t=i.masterPlaylistLoader_.master,r=i.masterPlaylistLoader_.sidxMapping_,a=$u(t.playlists,r),Cu(t,function(e,t,i,n){e.playlists&&e.playlists.length&&(e=e.playlists,a=Vl(a,$u(e,r)))}),a),i.addSidxSegments_(i.media(),i.state,function(e){i.refreshMedia_(i.media().id)}))})},t.refreshMedia_=function(e){var t=this;if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMaster_&&this.handleMaster_();var i=this.masterPlaylistLoader_.master.playlists,n=!this.media_||this.media_!==i[e];n?this.media_=i[e]:this.trigger("playlistunchanged"),this.mediaUpdateTimeout||function e(){t.media().endList||(t.mediaUpdateTimeout=window.setTimeout(function(){t.trigger("mediaupdatetimeout"),e()},Ru(t.media(),Boolean(n))))}(),this.trigger("loadedplaylist")},e}(zt),Wl={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},x=function(n){return function(){var 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())}}(n),t=Ju(new Worker(e));t.objURL=e;var i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},ar=function(e){return"var browserWorkerPolyFill = "+Ju.toString()+";\nbrowserWorkerPolyFill(self);\n"+e},Qr=function(e){return e.toString().replace(/^function.+?{/,"").slice(0,-1)},Gl=x(ar(Qr(function(){var e=function(){this.init=function(){var a={};this.on=function(e,t){a[e]||(a[e]=[]),a[e]=a[e].concat(t)},this.off=function(e,t){return!!a[e]&&(t=a[e].indexOf(t),a[e]=a[e].slice(),a[e].splice(t,1),-1<t)},this.trigger=function(e){var t,i,n,r=a[e];if(r)if(2===arguments.length)for(i=r.length,t=0;t<i;++t)r[t].call(this,arguments[1]);else{for(n=[],t=arguments.length,t=1;t<arguments.length;++t)n.push(arguments[t]);for(i=r.length,t=0;t<i;++t)r[t].apply(this,n)}},this.dispose=function(){a={}}}};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)};var u,t,i,n,r,a,s,o,l,d,c,h,p,f,m,g,y,v,_,b,T,w,S,E,k,C,I,x,A,P,L,O,D,R,M,N,U,B,F,j=e,H=Math.pow(2,32),V={getUint64:function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);return t.getBigUint64?(e=t.getBigUint64(0))<Number.MAX_SAFE_INTEGER?Number(e):e:t.getUint32(0)*H+t.getUint32(4)},MAX_UINT32:H},q=V.MAX_UINT32;!function(){if(T={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 e in T)T.hasOwnProperty(e)&&(T[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);w=new Uint8Array(["i".charCodeAt(0),"s".charCodeAt(0),"o".charCodeAt(0),"m".charCodeAt(0)]),E=new Uint8Array(["a".charCodeAt(0),"v".charCodeAt(0),"c".charCodeAt(0),"1".charCodeAt(0)]),S=new Uint8Array([0,0,0,1]),k=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]),C=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={video:k,audio:C},P=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]),L=new Uint8Array([0,0,0,0,0,0,0,0]),O=L,D=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),R=L,x=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}}(),u=function(e){for(var t,i=[],n=0,r=1;r<arguments.length;r++)i.push(arguments[r]);for(r=i.length;r--;)n+=i[r].byteLength;for(t=new Uint8Array(n+8),new DataView(t.buffer,t.byteOffset,t.byteLength).setUint32(0,t.byteLength),t.set(e,4),r=0,n=8;r<i.length;r++)t.set(i[r],n),n+=i[r].byteLength;return t},t=function(){return u(T.dinf,u(T.dref,P))},i=function(e){return u(T.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]))},f=function(e){return u(T.hdlr,I[e])},p=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),u(T.mdhd,t)},h=function(e){return u(T.mdia,p(e),f(e.type),a(e))},r=function(e){return u(T.mfhd,new Uint8Array([0,0,0,0,(4278190080&e)>>24,(16711680&e)>>16,(65280&e)>>8,255&e]))},a=function(e){return u(T.minf,"video"===e.type?u(T.vmhd,x):u(T.smhd,A),t(),g(e))},We=function(e,t){for(var i=[],n=t.length;n--;)i[n]=v(t[n]);return u.apply(null,[T.moof,r(e)].concat(i))},s=function(e){for(var t=e.length,i=[];t--;)i[t]=d(e[t]);return u.apply(null,[T.moov,l(4294967295)].concat(i).concat(o(e)))},o=function(e){for(var t=e.length,i=[];t--;)i[t]=_(e[t]);return u.apply(null,[T.mvex].concat(i))},l=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 u(T.mvhd,e)},m=function(e){for(var t,i=e.samples||[],n=new Uint8Array(4+i.length),r=0;r<i.length;r++)t=i[r].flags,n[r+4]=t.dependsOn<<4|t.isDependedOn<<2|t.hasRedundancy;return u(T.sdtp,n)},g=function(e){return u(T.stbl,y(e),u(T.stts,R),u(T.stsc,O),u(T.stsz,D),u(T.stco,L))},y=function(e){return u(T.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),("video"===e.type?M:N)(e))},M=function(e){for(var t,i,n=e.sps||[],r=e.pps||[],a=[],s=[],o=0;o<n.length;o++)a.push((65280&n[o].byteLength)>>>8),a.push(255&n[o].byteLength),a=a.concat(Array.prototype.slice.call(n[o]));for(o=0;o<r.length;o++)s.push((65280&r[o].byteLength)>>>8),s.push(255&r[o].byteLength),s=s.concat(Array.prototype.slice.call(r[o]));return t=[T.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]),u(T.avcC,new Uint8Array([1,e.profileIdc,e.profileCompatibility,e.levelIdc,255].concat([n.length],a,[r.length],s))),u(T.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(u(T.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])))),u.apply(null,t)},N=function(e){return u(T.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]),i(e))},c=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 u(T.tkhd,e)},v=function(e){var t,i=u(T.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])),n=Math.floor(e.baseMediaDecodeTime/q),r=Math.floor(e.baseMediaDecodeTime%q),n=u(T.tfdt,new Uint8Array([1,0,0,0,n>>>24&255,n>>>16&255,n>>>8&255,255&n,r>>>24&255,r>>>16&255,r>>>8&255,255&r]));return"audio"===e.type?(t=b(e,92),u(T.traf,i,n,t)):(r=m(e),t=b(e,r.length+92),u(T.traf,i,n,t,r))},d=function(e){return e.duration=e.duration||4294967295,u(T.trak,c(e),h(e))},_=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),u(T.trex,t)},U=function(e,t){var i=0,n=0,r=0,a=0;return e.length&&(void 0!==e[0].duration&&(i=1),void 0!==e[0].size&&(n=2),void 0!==e[0].flags&&(r=4),void 0!==e[0].compositionTimeOffset&&(a=8)),[0,0,i|n|r|a,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]},B=function(e,t){var i,n,r,a,s=e.samples||[];for(t+=20+16*s.length,t=U(s,t),(n=new Uint8Array(t.length+16*s.length)).set(t),i=t.length,a=0;a<s.length;a++)r=s[a],n[i++]=(4278190080&r.duration)>>>24,n[i++]=(16711680&r.duration)>>>16,n[i++]=(65280&r.duration)>>>8,n[i++]=255&r.duration,n[i++]=(4278190080&r.size)>>>24,n[i++]=(16711680&r.size)>>>16,n[i++]=(65280&r.size)>>>8,n[i++]=255&r.size,n[i++]=r.flags.isLeading<<2|r.flags.dependsOn,n[i++]=r.flags.isDependedOn<<6|r.flags.hasRedundancy<<4|r.flags.paddingValue<<1|r.flags.isNonSyncSample,n[i++]=61440&r.flags.degradationPriority,n[i++]=15&r.flags.degradationPriority,n[i++]=(4278190080&r.compositionTimeOffset)>>>24,n[i++]=(16711680&r.compositionTimeOffset)>>>16,n[i++]=(65280&r.compositionTimeOffset)>>>8,n[i++]=255&r.compositionTimeOffset;return u(T.trun,n)},F=function(e,t){var i,n,r,a,s=e.samples||[];for(t+=20+8*s.length,t=U(s,t),(i=new Uint8Array(t.length+8*s.length)).set(t),n=t.length,a=0;a<s.length;a++)r=s[a],i[n++]=(4278190080&r.duration)>>>24,i[n++]=(16711680&r.duration)>>>16,i[n++]=(65280&r.duration)>>>8,i[n++]=255&r.duration,i[n++]=(4278190080&r.size)>>>24,i[n++]=(16711680&r.size)>>>16,i[n++]=(65280&r.size)>>>8,i[n++]=255&r.size;return u(T.trun,i)},b=function(e,t){return("audio"===e.type?F:B)(e,t)};n=function(){return u(T.ftyp,w,S,w,E)};function W(e,t){var i={size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}};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 G(e){for(var t=[];e--;)t.push(0);return t}function z(){var e,i;return X||(e={96e3:[ie,[227,64],G(154),[56]],88200:[ie,[231],G(170),[56]],64e3:[ie,[248,192],G(240),[56]],48e3:[ie,[255,192],G(268),[55,148,128],G(54),[112]],44100:[ie,[255,192],G(268),[55,163,128],G(84),[112]],32e3:[ie,[255,192],G(268),[55,234],G(226),[112]],24e3:[ie,[255,192],G(268),[55,255,128],G(268),[111,112],G(126),[224]],16e3:[ie,[255,192],G(268),[55,255,128],G(268),[111,255],G(269),[223,108],G(195),[1,192]],12e3:[ne,G(268),[3,127,248],G(268),[6,255,240],G(268),[13,255,224],G(268),[27,253,128],G(259),[56]],11025:[ne,G(268),[3,127,248],G(268),[6,255,240],G(268),[13,255,224],G(268),[27,255,192],G(268),[55,175,128],G(108),[112]],8e3:[ne,G(268),[3,121,16],G(47),[7]]},i=e,X=Object.keys(i).reduce(function(e,t){return e[t]=new Uint8Array(i[t].reduce(function(e,t){return e.concat(t)},[])),e},{})),X}var X,K=function(e){return u(T.mdat,e)},Y=We,Q=function(e){var t=n(),i=s(e),e=new Uint8Array(t.byteLength+i.byteLength);return e.set(t),e.set(i,t.byteLength),e},$=function(e){var t,i,n=[],r=[];for(r.byteLength=0,r.nalCount=0,r.duration=0,t=n.byteLength=0;t<e.length;t++)"access_unit_delimiter_rbsp"===(i=e[t]).nalUnitType?(n.length&&(n.duration=i.dts-n.dts,r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n)),(n=[i]).byteLength=i.data.byteLength,n.pts=i.pts,n.dts=i.dts):("slice_layer_without_partitioning_rbsp_idr"===i.nalUnitType&&(n.keyFrame=!0),n.duration=i.dts-n.dts,n.byteLength+=i.data.byteLength,n.push(i));return r.length&&(!n.duration||n.duration<=0)&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.length,r.duration+=n.duration,r.push(n),r},J=function(e){var t,i,n=[],r=[];for(n.byteLength=0,n.nalCount=0,n.duration=0,n.pts=e[0].pts,n.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?(n.length&&(r.push(n),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration),(n=[i]).nalCount=i.length,n.byteLength=i.byteLength,n.pts=i.pts,n.dts=i.dts,n.duration=i.duration):(n.duration+=i.duration,n.nalCount+=i.length,n.byteLength+=i.byteLength,n.push(i));return r.length&&n.duration<=0&&(n.duration=r[r.length-1].duration),r.byteLength+=n.byteLength,r.nalCount+=n.nalCount,r.duration+=n.duration,r.push(n),r},Z=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},ee=function(e,t){for(var i,n,r,a=t||0,s=[],o=0;o<e.length;o++)for(n=e[o],i=0;i<n.length;i++)r=n[i],a+=(r=W(r,a)).size,s.push(r);return s},te=function(e){for(var t,i,n,r,a,s=0,o=e.byteLength,u=e.nalCount,l=new Uint8Array(o+4*u),d=new DataView(l.buffer),c=0;c<e.length;c++)for(n=e[c],t=0;t<n.length;t++)for(r=n[t],i=0;i<r.length;i++)a=r[i],d.setUint32(s,a.data.byteLength),l.set(a.data,s+=4),s+=a.data.byteLength;return l},ie=[33,16,5,32,164,27],ne=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],re=function(e){return 9e4*e},ae=function(e,t){return e*t},se=function(e){return e/9e4},oe=function(e,t){return e/t},ue=9e4,le=re,de=se,ce=function(e,t){return re(oe(e,t))},he=function(e,t){return ae(se(e),t)},pe=function(e,t,i){return se(i?e:e-t)},fe=function(e,t,i,n){var r,a,s,o,u,l,d=0,c=0;if(t.length&&(r=ce(e.baseMediaDecodeTime,e.samplerate),a=Math.ceil(ue/(e.samplerate/1024)),i&&n&&(s=r-Math.max(i,n),c=(d=Math.floor(s/a))*a),!(d<1||ue/2<c))){for(o=(o=z()[e.samplerate])||t[0].data,u=0;u<d;u++)l=t[0],t.splice(0,0,{data:o,dts:l.dts-a,pts:l.pts-a});return e.baseMediaDecodeTime-=Math.floor(he(c,e.samplerate)),c}},me=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)}))},ge=function(e){for(var t,i=[],n=0;n<e.length;n++)t=e[n],i.push({size:t.data.byteLength,duration:1024});return i},ye=function(e){for(var t,i=0,n=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],n.set(t.data,i),i+=t.data.byteLength;return n},ve=ue,_e=function(e){delete e.minSegmentDts,delete e.maxSegmentDts,delete e.minSegmentPts,delete e.maxSegmentPts},be=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/ve,t=Math.floor(t)),t},Te=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))},we=function(e){for(var t=0,i={payloadType:-1,payloadSize:0},n=0,r=0;t<e.byteLength&&128!==e[t];){for(;255===e[t];)n+=255,t++;for(n+=e[t++];255===e[t];)r+=255,t++;if(r+=e[t++],!i.payload&&4===n){if("GA94"===String.fromCharCode(e[t+3],e[t+4],e[t+5],e[t+6])){i.payloadType=n,i.payloadSize=r,i.payload=e.subarray(t,t+r);break}i.payload=void 0}t+=r,r=n=0}return i},Se=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)},Ee=function(e,t){var i,n,r,a,s=[];if(!(64&t[0]))return s;for(n=31&t[0],i=0;i<n;i++)a={type:3&t[2+(r=3*i)],pts:e},4&t[2+r]&&(a.ccData=t[3+r]<<8|t[4+r],s.push(a));return s},ke=function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;for(var r=t-i.length,a=new Uint8Array(r),s=0,n=0;n<r;s++,n++)s===i[0]&&(s++,i.shift()),a[n]=e[s];return a},Ce=4,Ie=function e(t){t=t||{},e.prototype.init.call(this),this.parse708captions_="boolean"!=typeof t.parse708captions||t.parse708captions,this.captionPackets_=[],this.ccStreams_=[new Ue(0,0),new Ue(0,1),new Ue(1,0),new Ue(1,1)],this.parse708captions_&&(this.cc708Stream_=new Oe({captionServices:t.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")))};(Ie.prototype=new j).push=function(e){var t,i;if("sei_rbsp"===e.nalUnitType&&(t=we(e.escapedRBSP)).payload&&t.payloadType===Ce&&(i=Se(t)))if(e.dts<this.latestDts_)this.ignoreNextEqualDts_=!0;else{if(e.dts===this.latestDts_&&this.ignoreNextEqualDts_)return this.numSameDts_--,void(this.numSameDts_||(this.ignoreNextEqualDts_=!1));i=Ee(e.pts,i),this.captionPackets_=this.captionPackets_.concat(i),this.latestDts_!==e.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=e.dts}},Ie.prototype.flushCCStreams=function(t){this.ccStreams_.forEach(function(e){return"flush"===t?e.flush():e.partialFlush()},this)},Ie.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)},Ie.prototype.flush=function(){return this.flushStream("flush")},Ie.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ie.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(e){e.reset()})},Ie.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)},Ie.prototype.setsChannel1Active=function(e){return 4096==(30720&e.ccData)},Ie.prototype.setsChannel2Active=function(e){return 6144==(30720&e.ccData)},Ie.prototype.setsTextOrXDSActive=function(e){return 256==(28928&e.ccData)||4138==(30974&e.ccData)||6186==(30974&e.ccData)},Ie.prototype.dispatchCea708Packet=function(e){this.parse708captions_&&this.cc708Stream_.push(e)};function xe(e){return 32<=e&&e<=127||160<=e&&e<=255}function Ae(e){this.windowNum=e,this.reset()}var Pe={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};Ae.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},Ae.prototype.getText=function(){return this.rows.join("\n")},Ae.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ae.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--},Ae.prototype.isEmpty=function(){return 0===this.rows.length||1===this.rows.length&&""===this.rows[0]},Ae.prototype.addText=function(e){this.rows[this.rowIdx]+=e},Ae.prototype.backspace=function(){var e;this.isEmpty()||(e=this.rows[this.rowIdx],this.rows[this.rowIdx]=e.substr(0,e.length-1))};function Le(e,t,i){this.serviceNum=e,this.text="",this.currentWindow=new Ae(-1),this.windows=[],this.stream=i,"string"==typeof t&&this.createTextDecoder(t)}Le.prototype.init=function(e,t){this.startPts=e;for(var i=0;i<8;i++)this.windows[i]=new Ae(i),"function"==typeof t&&(this.windows[i].beforeRowOverflow=t)},Le.prototype.setCurrentWindow=function(e){this.currentWindow=this.windows[e]},Le.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})}};var Oe=function e(t){t=t||{},e.prototype.init.call(this);var i,n=this,r=t.captionServices||{},a={};Object.keys(r).forEach(function(e){i=r[e],/^SERVICE/.test(e)&&(a[e]=i.encoding)}),this.serviceEncodings=a,this.current708Packet=null,this.services={},this.push=function(e){(3===e.type||null===n.current708Packet)&&n.new708Packet(),n.add708Bytes(e)}};Oe.prototype=new j,Oe.prototype.new708Packet=function(){null!==this.current708Packet&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Oe.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)},Oe.prototype.push708Packet=function(){var e,t=this.current708Packet,i=t.data,n=null,r=0,a=i[r++];for(t.seq=a>>6,t.sizeCode=63&a;r<i.length;r++)e=31&(a=i[r++]),7===(n=a>>5)&&0<e&&(n=i[r++]),this.pushServiceBlock(n,r,e),0<e&&(r+=e-1)},Oe.prototype.pushServiceBlock=function(e,t,i){for(var n,r=t,a=this.current708Packet.data,s=(s=this.services[e])||this.initService(e,r);r<t+i&&r<a.length;r++)n=a[r],xe(n)?r=this.handleText(r,s):24===n?r=this.multiByteCharacter(r,s):16===n?r=this.extendedCommands(r,s):128<=n&&n<=135?r=this.setCurrentWindow(r,s):152<=n&&n<=159?r=this.defineWindow(r,s):136===n?r=this.clearWindows(r,s):140===n?r=this.deleteWindows(r,s):137===n?r=this.displayWindows(r,s):138===n?r=this.hideWindows(r,s):139===n?r=this.toggleWindows(r,s):151===n?r=this.setWindowAttributes(r,s):144===n?r=this.setPenAttributes(r,s):145===n?r=this.setPenColor(r,s):146===n?r=this.setPenLocation(r,s):143===n?s=this.reset(r,s):8===n?s.currentWindow.backspace():12===n?s.currentWindow.clearText():13===n?s.currentWindow.pendingNewLine=!0:14===n?s.currentWindow.clearText():141===n&&r++},Oe.prototype.extendedCommands=function(e,t){var i=this.current708Packet.data[++e];return e=xe(i)?this.handleText(e,t,{isExtended:!0}):e},Oe.prototype.getPts=function(e){return this.current708Packet.ptsVals[Math.floor(e/2)]},Oe.prototype.initService=function(t,e){var i,n="SERVICE"+t,r=this;return n in this.serviceEncodings&&(i=this.serviceEncodings[n]),this.services[t]=new Le(t,i,r),this.services[t].init(this.getPts(e),function(e){r.flushDisplayed(e,r.services[t])}),this.services[t]},Oe.prototype.handleText=function(e,t,i){var n,r=i&&i.isExtended,a=i&&i.isMultiByte,s=this.current708Packet.data,o=r?4096:0,u=s[e],i=s[e+1],s=t.currentWindow,l=t.textDecoder_&&!r?(a?(n=[u,i],e++):n=[u],t.textDecoder_.decode(new Uint8Array(n))):(l=Pe[u=o|u]||u,4096&u&&u===l?"":String.fromCharCode(l));return s.pendingNewLine&&!s.isEmpty()&&s.newLine(this.getPts(e)),s.pendingNewLine=!1,s.addText(l),e},Oe.prototype.multiByteCharacter=function(e,t){var i=this.current708Packet.data,n=i[e+1],i=i[e+2];return e=xe(n)&&xe(i)?this.handleText(++e,t,{isMultiByte:!0}):e},Oe.prototype.setCurrentWindow=function(e,t){var i=this.current708Packet.data[e];return t.setCurrentWindow(7&i),e},Oe.prototype.defineWindow=function(e,t){var i=this.current708Packet.data,n=i[e];t.setCurrentWindow(7&n);t=t.currentWindow,n=i[++e];return t.visible=(32&n)>>5,t.rowLock=(16&n)>>4,t.columnLock=(8&n)>>3,t.priority=7&n,n=i[++e],t.relativePositioning=(128&n)>>7,t.anchorVertical=127&n,n=i[++e],t.anchorHorizontal=n,n=i[++e],t.anchorPoint=(240&n)>>4,t.rowCount=15&n,n=i[++e],t.columnCount=63&n,n=i[++e],t.windowStyle=(56&n)>>3,t.penStyle=7&n,t.virtualRowCount=t.rowCount+1,e},Oe.prototype.setWindowAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],t=t.currentWindow.winAttr,n=i[++e];return t.fillOpacity=(192&n)>>6,t.fillRed=(48&n)>>4,t.fillGreen=(12&n)>>2,t.fillBlue=3&n,n=i[++e],t.borderType=(192&n)>>6,t.borderRed=(48&n)>>4,t.borderGreen=(12&n)>>2,t.borderBlue=3&n,n=i[++e],t.borderType+=(128&n)>>5,t.wordWrap=(64&n)>>6,t.printDirection=(48&n)>>4,t.scrollDirection=(12&n)>>2,t.justify=3&n,n=i[++e],t.effectSpeed=(240&n)>>4,t.effectDirection=(12&n)>>2,t.displayEffect=3&n,e},Oe.prototype.flushDisplayed=function(e,t){for(var i=[],n=0;n<8;n++)t.windows[n].visible&&!t.windows[n].isEmpty()&&i.push(t.windows[n].getText());t.endPts=e,t.text=i.join("\n\n"),this.pushCaption(t),t.startPts=e},Oe.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)},Oe.prototype.displayWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=1);return e},Oe.prototype.hideWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible=0);return e},Oe.prototype.toggleWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&(t.windows[r].visible^=1);return e},Oe.prototype.clearWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].clearText();return e},Oe.prototype.deleteWindows=function(e,t){var i=this.current708Packet.data[++e],n=this.getPts(e);this.flushDisplayed(n,t);for(var r=0;r<8;r++)i&1<<r&&t.windows[r].reset();return e},Oe.prototype.setPenAttributes=function(e,t){var i=this.current708Packet.data,n=i[e],t=t.currentWindow.penAttr,n=i[++e];return t.textTag=(240&n)>>4,t.offset=(12&n)>>2,t.penSize=3&n,n=i[++e],t.italics=(128&n)>>7,t.underline=(64&n)>>6,t.edgeType=(56&n)>>3,t.fontStyle=7&n,e},Oe.prototype.setPenColor=function(e,t){var i=this.current708Packet.data,n=i[e],t=t.currentWindow.penColor,n=i[++e];return t.fgOpacity=(192&n)>>6,t.fgRed=(48&n)>>4,t.fgGreen=(12&n)>>2,t.fgBlue=3&n,n=i[++e],t.bgOpacity=(192&n)>>6,t.bgRed=(48&n)>>4,t.bgGreen=(12&n)>>2,t.bgBlue=3&n,n=i[++e],t.edgeRed=(48&n)>>4,t.edgeGreen=(12&n)>>2,t.edgeBlue=3&n,e},Oe.prototype.setPenLocation=function(e,t){var i=this.current708Packet.data,n=i[e],r=t.currentWindow.penLoc;return t.currentWindow.pendingNewLine=!0,n=i[++e],r.row=15&n,n=i[++e],r.column=63&n,e},Oe.prototype.reset=function(e,t){var i=this.getPts(e);return this.flushDisplayed(i,t),this.initService(t.serviceNum,e)};function De(e){return null===e?"":(e=Me[e]||e,String.fromCharCode(e))}function Re(){for(var e=[],t=15;t--;)e.push("");return e}var Me={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},Ne=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ue=function e(t,i){e.prototype.init.call(this),this.field_=t||0,this.dataChannel_=i||0,this.name_="CC"+(1+(this.field_<<1|this.dataChannel_)),this.setConstants(),this.reset(),this.push=function(e){var t,i,n,r,a=32639&e.ccData;a!==this.lastControlCode_?(4096==(61440&a)?this.lastControlCode_=a:a!==this.PADDING_&&(this.lastControlCode_=null),t=a>>>8,i=255&a,a===this.PADDING_||(a===this.RESUME_CAPTION_LOADING_?this.mode_="popOn":a===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):a===this.ROLL_UP_2_ROWS_?(this.rollUpRows_=2,this.setRollUp(e.pts)):a===this.ROLL_UP_3_ROWS_?(this.rollUpRows_=3,this.setRollUp(e.pts)):a===this.ROLL_UP_4_ROWS_?(this.rollUpRows_=4,this.setRollUp(e.pts)):a===this.CARRIAGE_RETURN_?(this.clearFormatting(e.pts),this.flushDisplayed(e.pts),this.shiftRowsUp_(),this.startPts_=e.pts):a===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):a===this.ERASE_DISPLAYED_MEMORY_?(this.flushDisplayed(e.pts),this.displayed_=Re()):a===this.ERASE_NON_DISPLAYED_MEMORY_?this.nonDisplayed_=Re():a===this.RESUME_DIRECT_CAPTIONING_?("paintOn"!==this.mode_&&(this.flushDisplayed(e.pts),this.displayed_=Re()),this.mode_="paintOn",this.startPts_=e.pts):this.isSpecialCharacter(t,i)?(n=De((t=(3&t)<<8)|i),this[this.mode_](e.pts,n),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),n=De((t=(3&t)<<8)|i),this[this.mode_](e.pts,n),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=Ne.indexOf(7968&a),"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&a)&&(this.column_=4*((14&a)>>1)),this.isColorPAC(i)&&14==(14&i)&&this.addFormatting(e.pts,["i"])):this.isNormalChar(t)&&(0===i&&(i=null),n=De(t),n+=De(i),this[this.mode_](e.pts,n),this.column_+=n.length))):this.lastControlCode_=null}};Ue.prototype=new j,Ue.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_})},Ue.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Re(),this.nonDisplayed_=Re(),this.lastControlCode_=null,this.column_=0,this.row_=14,this.rollUpRows_=2,this.formatting_=[]},Ue.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_},Ue.prototype.isSpecialCharacter=function(e,t){return e===this.EXT_&&48<=t&&t<=63},Ue.prototype.isExtCharacter=function(e,t){return(e===this.EXT_+1||e===this.EXT_+2)&&32<=t&&t<=63},Ue.prototype.isMidRowCode=function(e,t){return e===this.EXT_&&32<=t&&t<=47},Ue.prototype.isOffsetControlCode=function(e,t){return e===this.OFFSET_&&33<=t&&t<=35},Ue.prototype.isPAC=function(e,t){return e>=this.BASE_&&e<this.BASE_+8&&64<=t&&t<=127},Ue.prototype.isColorPAC=function(e){return 64<=e&&e<=79||96<=e&&e<=127},Ue.prototype.isNormalChar=function(e){return 32<=e&&e<=127},Ue.prototype.setRollUp=function(e,t){if("rollUp"!==this.mode_&&(this.row_=14,this.mode_="rollUp",this.flushDisplayed(e),this.nonDisplayed_=Re(),this.displayed_=Re()),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},Ue.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)},Ue.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))},Ue.prototype.popOn=function(e,t){var i=this.nonDisplayed_[this.row_];this.nonDisplayed_[this.row_]=i+=t},Ue.prototype.rollUp=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t},Ue.prototype.shiftRowsUp_=function(){for(var e=0;e<this.topRow_;e++)this.displayed_[e]="";for(e=this.row_+1;e<15;e++)this.displayed_[e]="";for(e=this.topRow_;e<this.row_;e++)this.displayed_[e]=this.displayed_[e+1];this.displayed_[this.row_]=""},Ue.prototype.paintOn=function(e,t){var i=this.displayed_[this.row_];this.displayed_[this.row_]=i+=t};function Be(e,t){var i=1;for(t<e&&(i=-1);4294967296<Math.abs(t-e);)e+=8589934592*i;return e}var Fe={CaptionStream:Ie,Cea608Stream:Ue,Cea708Stream:Oe},je={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},e=function e(t){var i,n;e.prototype.init.call(this),this.type_=t||"shared",this.push=function(e){"shared"!==this.type_&&e.type!==this.type_||(void 0===n&&(n=e.dts),e.dts=Be(e.dts,n),e.pts=Be(e.pts,n),i=e.dts,this.trigger("data",e))},this.flush=function(){n=i,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){i=n=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};e.prototype=new j;function He(e,t,i){for(var n="",r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n}function Ve(e,t,i){return decodeURIComponent(He(e,t,i))}function qe(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}var We=e,Ie=Be,Ge={TXXX:function(e){var t;if(3===e.data[0]){for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ve(e.data,1,t),e.value=Ve(e.data,t+1,e.data.length).replace(/\0*$/,"");break}e.data=e.value}},WXXX:function(e){var t;if(3===e.data[0])for(t=1;t<e.data.length;t++)if(0===e.data[t]){e.description=Ve(e.data,1,t),e.url=Ve(e.data,t+1,e.data.length);break}},PRIV:function(e){for(var t,i=0;i<e.data.length;i++)if(0===e.data[i]){e.owner=(t=e.data,unescape(He(t,0,i)));break}e.privateData=e.data.subarray(i+1),e.data=e.privateData}},ze=function(e){var t,i={descriptor:e&&e.descriptor},u=0,l=[],d=0;if(ze.prototype.init.call(this),this.dispatchType=je.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,n,r,a,s,o;if("timed-metadata"===e.type)if(e.dataAlignmentIndicator&&(d=0,l.length=0),0===l.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(l.push(e),d+=e.data.byteLength,1===l.length&&(u=qe(e.data.subarray(6,10)),u+=10),!(d<u)){for(t={data:new Uint8Array(u),frames:[],pts:l[0].pts,dts:l[0].dts},r=0;r<u;)t.data.set(l[0].data.subarray(0,u-r),r),r+=l[0].data.byteLength,d-=l[0].data.byteLength,l.shift();i=10,64&t.data[5]&&(i+=4,i+=qe(t.data.subarray(10,14)),u-=qe(t.data.subarray(16,20)));do{if((n=qe(t.data.subarray(i+4,i+8)))<1)return void this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping metadata parsing."})}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+n+10)}).key=o.id,Ge[o.id]&&(Ge[o.id](o),"com.apple.streaming.transportStreamTimestamp"===o.owner&&(s=(1&(a=o.data)[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2,s*=4,s+=3&a[7],o.timeStamp=s,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+=10,(i+=n)<u);this.trigger("data",t)}}};ze.prototype=new j;var Xe,Ke,e=ze,We=We,Ye=function(){var r=new Uint8Array(188),a=0;Ye.prototype.init.call(this),this.push=function(e){var t,i=0,n=188;for(a?((t=new Uint8Array(e.byteLength+a)).set(r.subarray(0,a)),t.set(e,a),a=0):t=e;n<t.byteLength;)71!==t[i]||71!==t[n]?(i++,n++):(this.trigger("data",t.subarray(i,n)),i+=188,n+=188);i<t.byteLength&&(r.set(t.subarray(i),0),a=t.byteLength-i)},this.flush=function(){188===a&&71===r[0]&&(this.trigger("data",r),a=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){a=0,this.trigger("reset")}};Ye.prototype=new j,(Xe=function(){var n,r,a,s;Xe.prototype.init.call(this),(s=this).packetsWaitingForPmt=[],this.programMapTable=void 0,n=function(e,t){var i=0;t.payloadUnitStartIndicator&&(i+=e[i]+1),("pat"===t.type?r:a)(e.subarray(i),t)},r=function(e,t){t.section_number=e[7],t.last_section_number=e[8],s.pmtPid=(31&e[10])<<8|e[11],t.pmtPid=s.pmtPid},a=function(e,t){var i,n;if(1&e[5]){for(s.programMapTable={video:null,audio:null,"timed-metadata":{}},i=3+((15&e[1])<<8|e[2])-4,n=12+((15&e[10])<<8|e[11]);n<i;){var r=e[n],a=(31&e[n+1])<<8|e[n+2];r===je.H264_STREAM_TYPE&&null===s.programMapTable.video?s.programMapTable.video=a:r===je.ADTS_STREAM_TYPE&&null===s.programMapTable.audio?s.programMapTable.audio=a:r===je.METADATA_STREAM_TYPE&&(s.programMapTable["timed-metadata"][a]=r),n+=5+((15&e[n+3])<<8|e[n+4])}t.programMapTable=s.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",n(e.subarray(i),t),this.trigger("data",t);else if(t.pid===this.pmtPid)for(t.type="pmt",n(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=je.H264_STREAM_TYPE:i.pid===this.programMapTable.audio?i.streamType=je.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 j,Xe.STREAM_TYPES={h264:27,adts:15},(Ke=function(){function n(e,t,i){var n,r,a,s,o=new Uint8Array(e.size),u={type:t},l=0,d=0;if(e.data.length&&!(e.size<9)){for(u.trackId=e.data[0].pid,l=0;l<e.data.length;l++)n=e.data[l],o.set(n.data,d),d+=n.data.byteLength;a=u,s=(r=o)[0]<<16|r[1]<<8|r[2],a.data=new Uint8Array,1==s&&(a.packetLength=6+(r[4]<<8|r[5]),a.dataAlignmentIndicator=0!=(4&r[6]),192&(s=r[7])&&(a.pts=(14&r[9])<<27|(255&r[10])<<20|(254&r[11])<<12|(255&r[12])<<5|(254&r[13])>>>3,a.pts*=4,a.pts+=(6&r[13])>>>1,a.dts=a.pts,64&s&&(a.dts=(14&r[14])<<27|(255&r[15])<<20|(254&r[16])<<12|(255&r[17])<<5|(254&r[18])>>>3,a.dts*=4,a.dts+=(6&r[18])>>>1)),a.data=r.subarray(9+r[8])),t="video"===t||u.packetLength<=e.size,(i||t)&&(e.size=0,e.data.length=0),t&&c.trigger("data",u)}}var t,c=this,r=!1,a={data:[],size:0},s={data:[],size:0},o={data:[],size:0};Ke.prototype.init.call(this),this.push=function(i){({pat:function(){},pes:function(){var e,t;switch(i.streamType){case je.H264_STREAM_TYPE:e=a,t="video";break;case je.ADTS_STREAM_TYPE:e=s,t="audio";break;case je.METADATA_STREAM_TYPE:e=o,t="timed-metadata";break;default:return}i.payloadUnitStartIndicator&&n(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,c.trigger("data",e)}})[i.type]()},this.reset=function(){a.size=0,a.data.length=0,s.size=0,s.data.length=0,this.trigger("reset")},this.flushStreams_=function(){n(a,"video"),n(s,"audio"),n(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"}),c.trigger("data",e)),r=!1,this.flushStreams_(),this.trigger("done")}}).prototype=new j;var Qe,$e={PAT_PID:0,MP2T_PACKET_LENGTH:188,TransportPacketStream:Ye,TransportParseStream:Xe,ElementaryStream:Ke,TimestampRolloverStream:We,CaptionStream:Fe.CaptionStream,Cea608Stream:Fe.Cea608Stream,Cea708Stream:Fe.Cea708Stream,MetadataStream:e};for(Qe in je)je.hasOwnProperty(Qe)&&($e[Qe]=je[Qe]);var Je=$e,Ze=ue,et=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],tt=function(u){var l,d=0;tt.prototype.init.call(this),this.skipWarn_=function(e,t){this.trigger("log",{level:"warn",message:"adts skiping bytes "+e+" to "+t+" in frame "+d+" outside syncword"})},this.push=function(e){var t,i,n,r,a,s,o=0;if(u||(d=0),"audio"===e.type){for(l&&l.length?(n=l,(l=new Uint8Array(n.byteLength+e.data.byteLength)).set(n),l.set(e.data,n.byteLength)):l=e.data;o+7<l.length;)if(255===l[o]&&240==(246&l[o+1])){if("number"==typeof s&&(this.skipWarn_(s,o),s=null),i=2*(1&~l[o+1]),t=(3&l[o+3])<<11|l[o+4]<<3|(224&l[o+5])>>5,a=(r=1024*(1+(3&l[o+6])))*Ze/et[(60&l[o+2])>>>2],l.byteLength-o<t)break;this.trigger("data",{pts:e.pts+d*a,dts:e.dts+d*a,sampleCount:r,audioobjecttype:1+(l[o+2]>>>6&3),channelcount:(1&l[o+2])<<2|(192&l[o+3])>>>6,samplerate:et[(60&l[o+2])>>>2],samplingfrequencyindex:(60&l[o+2])>>>2,samplesize:16,data:l.subarray(o+7+i,o+t)}),d++,o+=t}else"number"!=typeof s&&(s=o),o++;"number"==typeof s&&(this.skipWarn_(s,o),s=null),l=l.subarray(o)}},this.flush=function(){d=0,this.trigger("done")},this.reset=function(){l=void 0,this.trigger("reset")},this.endTimeline=function(){l=void 0,this.trigger("endedtimeline")}};tt.prototype=new j;var it,nt,rt=tt,at=function(n){var r=n.byteLength,a=0,s=0;this.length=function(){return 8*r},this.bitsAvailable=function(){return 8*r+s},this.loadWord=function(){var e=n.byteLength-r,t=new Uint8Array(4),i=Math.min(4,r);if(0===i)throw new Error("no bytes available");t.set(n.subarray(e,e+i)),a=new DataView(t.buffer).getUint32(0),s=8*i,r-=i},this.skipBits=function(e){var t;e<s||(e-=s,e-=8*(t=Math.floor(e/8)),r-=t,this.loadWord()),a<<=e,s-=e},this.readBits=function(e){var t=Math.min(s,e),i=a>>>32-t;return 0<(s-=t)?a<<=t:0<r&&this.loadWord(),0<(t=e-t)?i<<t|this.readBits(t):i},this.skipLeadingZeros=function(){for(var e=0;e<s;++e)if(0!=(a&2147483648>>>e))return a<<=e,s-=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()},st=function(){var n,r,a=0;st.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;a<i-3;a++)if(1===r[a+2]){n=a+5;break}for(;n<i;)switch(r[n]){case 0:if(0!==r[n-1]){n+=2;break}if(0!==r[n-2]){n++;break}for(a+3!==n-2&&this.trigger("data",r.subarray(a+3,n-2));1!==r[++n]&&n<i;);a=n-2,n+=3;break;case 1:if(0!==r[n-1]||0!==r[n-2]){n+=3;break}this.trigger("data",r.subarray(a+3,n-2)),a=n-2,n+=3;break;default:n+=3}r=r.subarray(a),n-=a,a=0},this.reset=function(){r=null,a=0,this.trigger("reset")},this.flush=function(){r&&3<r.byteLength&&this.trigger("data",r.subarray(a+3)),r=null,a=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}};st.prototype=new j,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},(it=function(){var i,n,r,a,s,o,m,t=new st;it.prototype.init.call(this),(i=this).push=function(e){"video"===e.type&&(n=e.trackId,r=e.pts,a=e.dts,t.push(e))},t.on("data",function(e){var t={trackId:n,pts:r,dts:a,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=s(e.subarray(1));break;case 7:t.nalUnitType="seq_parameter_set_rbsp",t.escapedRBSP=s(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()},m=function(e,t){for(var i=8,n=8,r=0;r<e;r++)i=0===(n=0!==n?(i+t.readExpGolomb()+256)%256:n)?i:n},s=function(e){for(var t=e.byteLength,i=[],n=1;n<t-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(i.push(n+2),n+=2):n++;if(0===i.length)return e;for(var r=t-i.length,a=new Uint8Array(r),s=0,n=0;n<r;s++,n++)s===i[0]&&(s++,i.shift()),a[n]=e[s];return a},o=function(e){var t,i,n,r,a,s=0,o=0,u=0,l=0,d=[1,1],c=new at(e),h=c.readUnsignedByte(),p=c.readUnsignedByte(),f=c.readUnsignedByte();if(c.skipUnsignedExpGolomb(),nt[h]&&(3===(i=c.readUnsignedExpGolomb())&&c.skipBits(1),c.skipUnsignedExpGolomb(),c.skipUnsignedExpGolomb(),c.skipBits(1),c.readBoolean()))for(r=3!==i?8:12,a=0;a<r;a++)c.readBoolean()&&m(a<6?16:64,c);if(c.skipUnsignedExpGolomb(),0===(n=c.readUnsignedExpGolomb()))c.readUnsignedExpGolomb();else if(1===n)for(c.skipBits(1),c.skipExpGolomb(),c.skipExpGolomb(),t=c.readUnsignedExpGolomb(),a=0;a<t;a++)c.skipExpGolomb();if(c.skipUnsignedExpGolomb(),c.skipBits(1),e=c.readUnsignedExpGolomb(),i=c.readUnsignedExpGolomb(),0===(n=c.readBits(1))&&c.skipBits(1),c.skipBits(1),c.readBoolean()&&(s=c.readUnsignedExpGolomb(),o=c.readUnsignedExpGolomb(),u=c.readUnsignedExpGolomb(),l=c.readUnsignedExpGolomb()),c.readBoolean()&&c.readBoolean()){switch(c.readUnsignedByte()){case 1:d=[1,1];break;case 2:d=[12,11];break;case 3:d=[10,11];break;case 4:d=[16,11];break;case 5:d=[40,33];break;case 6:d=[24,11];break;case 7:d=[20,11];break;case 8:d=[32,11];break;case 9:d=[80,33];break;case 10:d=[18,11];break;case 11:d=[15,11];break;case 12:d=[64,33];break;case 13:d=[160,99];break;case 14:d=[4,3];break;case 15:d=[3,2];break;case 16:d=[2,1];break;case 255:d=[c.readUnsignedByte()<<8|c.readUnsignedByte(),c.readUnsignedByte()<<8|c.readUnsignedByte()]}d&&(d[0],d[1])}return{profileIdc:h,levelIdc:f,profileCompatibility:p,width:16*(e+1)-2*s-2*o,height:(2-n)*(i+1)*16-2*u-2*l,sarRatio:d}}}).prototype=new j;function ot(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?i+20:i+10}function ut(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:ut(e,t+=ot(e,t))}function lt(e){return e[0]<<21|e[1]<<14|e[2]<<7|e[3]}var e={H264Stream:it,NalByteStream:st},dt=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],ct={isLikelyAacData:function(e){var t=ut(e,0);return e.length>=t+2&&255==(255&e[t])&&240==(240&e[t+1])&&16==(22&e[t+1])},parseId3TagSize:ot,parseAdtsSize:function(e,t){var i=(224&e[t+5])>>5,n=e[t+4]<<3;return 6144&e[t+3]|n|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 dt[(60&e[t+2])>>>2];t++}return null},parseAacTimestamp:function(e){var t,i=10;64&e[5]&&(i+=4,i+=lt(e.subarray(10,14)));do{if((t=lt(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 n=e.subarray(i+10,i+t+10),r=0;r<n.byteLength;r++)if(0===n[r]){if("com.apple.streaming.transportStreamTimestamp"!==unescape(function(e,t,i){for(var n="",r=t;r<i;r++)n+="%"+("00"+e[r].toString(16)).slice(-2);return n}(n,0,r)))break;var a=n.subarray(r+1),s=(1&a[3])<<30|a[4]<<22|a[5]<<14|a[6]<<6|a[7]>>>2;return s*=4,s+=3&a[7]}}while(i+=10,(i+=t)<e.byteLength);return null}},ht=function(){var a=new Uint8Array,s=0;ht.prototype.init.call(this),this.setTimestamp=function(e){s=e},this.push=function(e){var t,i,n=0,r=0;for(a.length?(i=a.length,(a=new Uint8Array(e.byteLength+i)).set(a.subarray(0,i)),a.set(e,i)):a=e;3<=a.length-r;)if(a[r]!=="I".charCodeAt(0)||a[r+1]!=="D".charCodeAt(0)||a[r+2]!=="3".charCodeAt(0))if(255!=(255&a[r])||240!=(240&a[r+1]))r++;else{if(a.length-r<7)break;if(r+(n=ct.parseAdtsSize(a,r))>a.length)break;t={type:"audio",data:a.subarray(r,r+n),pts:s,dts:s},this.trigger("data",t),r+=n}else{if(a.length-r<10)break;if(r+(n=ct.parseId3TagSize(a,r))>a.length)break;t={type:"timed-metadata",data:a.subarray(r,r+n)},this.trigger("data",t),r+=n}e=a.length-r,a=0<e?a.subarray(r):new Uint8Array},this.reset=function(){a=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){a=new Uint8Array,this.trigger("endedtimeline")}};ht.prototype=new j;function pt(e,t){t.stream=e,this.trigger("log",t)}function ft(e,t){for(var i=Object.keys(t),n=0;n<i.length;n++){var r=i[n];"headOfPipeline"!==r&&t[r].on&&t[r].on("log",pt.bind(e,r))}}function mt(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 gt(e,t,i,n,r,a){return{start:{dts:e,pts:e+(i-t)},end:{dts:e+(n-t),pts:e+(r-i)},prependedContentDuration:a,baseMediaDecodeTime:e}}var yt,vt,_t,bt=ht,Tt=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],wt=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],St=e.H264Stream,Et=ct.isLikelyAacData,kt=ue,Ct=function(a,s){var o=[],u=0,l=0,d=1/0,c=(s=s||{}).firstSequenceNumber||0;Ct.prototype.init.call(this),this.push=function(t){Te(a,t),a&&Tt.forEach(function(e){a[e]=t[e]}),o.push(t)},this.setEarliestDts=function(e){u=e},this.setVideoBaseMediaDecodeTime=function(e){d=e},this.setAudioAppendStart=function(e){l=e},this.flush=function(){var e,t,i,n,r;0!==o.length&&(e=me(o,a,u),a.baseMediaDecodeTime=be(a,s.keepOriginalTimestamps),r=fe(a,e,l,d),a.samples=ge(e),t=K(ye(e)),o=[],n=Y(c,[a]),i=new Uint8Array(n.byteLength+t.byteLength),c++,i.set(n),i.set(t,n.byteLength),_e(a),n=Math.ceil(1024*kt/a.samplerate),e.length&&(n=e.length*n,this.trigger("segmentTimingInfo",gt(ce(a.baseMediaDecodeTime,a.samplerate),e[0].dts,e[0].pts,e[0].dts+n,e[0].pts+n,r||0)),this.trigger("timingInfo",{start:e[0].pts,end:e[0].pts+n})),this.trigger("data",{track:a,boxes:i})),this.trigger("done","AudioSegmentStream")},this.reset=function(){_e(a),o=[],this.trigger("reset")}};Ct.prototype=new j,(yt=function(s,a){var t,i,o=[],l=[],u=(a=a||{}).firstSequenceNumber||0;yt.prototype.init.call(this),delete s.minPTS,this.gopCache_=[],this.push=function(e){Te(s,e),"seq_parameter_set_rbsp"!==e.nalUnitType||t||(t=e.config,s.sps=[e.data],wt.forEach(function(e){s[e]=t[e]},this)),"pic_parameter_set_rbsp"!==e.nalUnitType||i||(i=e.data,s.pps=[e.data]),o.push(e)},this.flush=function(){for(var e,t,i,n=0;o.length&&"access_unit_delimiter_rbsp"!==o[0].nalUnitType;)o.shift();if(0===o.length)return this.resetStream_(),void this.trigger("done","VideoSegmentStream");if(e=$(o),(t=J(e))[0][0].keyFrame||((i=this.getGopForFusion_(o[0],s))?(n=i.duration,t.unshift(i),t.byteLength+=i.byteLength,t.nalCount+=i.nalCount,t.pts=i.pts,t.dts=i.dts,t.duration+=i.duration):t=Z(t)),l.length){var r=a.alignGopsAtEnd?this.alignGopsAtEnd_(t):this.alignGopsAtStart_(t);if(!r)return this.gopCache_.unshift({gop:t.pop(),pps:s.pps,sps:s.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.resetStream_(),void this.trigger("done","VideoSegmentStream");_e(s),t=r}Te(s,t),s.samples=ee(t),e=K(te(t)),s.baseMediaDecodeTime=be(s,a.keepOriginalTimestamps),this.trigger("processedGopsInfo",t.map(function(e){return{pts:e.pts,dts:e.dts,byteLength:e.byteLength}})),i=t[0],r=t[t.length-1],this.trigger("segmentTimingInfo",gt(s.baseMediaDecodeTime,i.dts,i.pts,r.dts+r.duration,r.pts+r.duration,n)),this.trigger("timingInfo",{start:t[0].pts,end:t[t.length-1].pts+t[t.length-1].duration}),this.gopCache_.unshift({gop:t.pop(),pps:s.pps,sps:s.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),o=[],this.trigger("baseMediaDecodeTime",s.baseMediaDecodeTime),this.trigger("timelineStartInfo",s.timelineStartInfo),n=Y(u,[s]),t=new Uint8Array(n.byteLength+e.byteLength),u++,t.set(n),t.set(e,n.byteLength),this.trigger("data",{track:s,boxes:t}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),o=[],this.gopCache_.length=0,l.length=0,this.trigger("reset")},this.resetStream_=function(){_e(s),i=t=void 0},this.getGopForFusion_=function(e){for(var t,i,n,r=1/0,a=0;a<this.gopCache_.length;a++)i=(n=this.gopCache_[a]).gop,s.pps&&mt(s.pps[0],n.pps[0])&&s.sps&&mt(s.sps[0],n.sps[0])&&(i.dts<s.timelineStartInfo.dts||-1e4<=(i=e.dts-i.dts-i.duration)&&i<=45e3&&(!t||i<r)&&(t=n,r=i));return t?t.gop:null},this.alignGopsAtStart_=function(e){for(var t,i,n,r,a=e.byteLength,s=e.nalCount,o=e.duration,u=t=0;u<l.length&&t<e.length&&(i=l[u],n=e[t],i.pts!==n.pts);)n.pts>i.pts?u++:(t++,a-=n.byteLength,s-=n.nalCount,o-=n.duration);return 0===t?e:t===e.length?null:((r=e.slice(t)).byteLength=a,r.duration=o,r.nalCount=s,r.pts=r[0].pts,r.dts=r[0].dts,r)},this.alignGopsAtEnd_=function(e){for(var t,i,n=l.length-1,r=e.length-1,a=null,s=!1;0<=n&&0<=r;){if(t=l[n],i=e[r],t.pts===i.pts){s=!0;break}t.pts>i.pts?n--:(n===l.length-1&&(a=r),r--)}if(!s&&null===a)return null;if(0===(u=s?r:a))return e;var o=e.slice(u),u=o.reduce(function(e,t){return e.byteLength+=t.byteLength,e.duration+=t.duration,e.nalCount+=t.nalCount,e},{byteLength:0,duration:0,nalCount:0});return o.byteLength=u.byteLength,o.duration=u.duration,o.nalCount=u.nalCount,o.pts=o[0].pts,o.dts=o[0].dts,o},this.alignGopsWith=function(e){l=e}}).prototype=new j,(_t=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,_t.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 j,_t.prototype.flush=function(e){var t,i,n,r=0,a={captions:[],captionStreams:{},metadata:[],info:{}},s=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?(s=this.videoTrack.timelineStartInfo.pts,wt.forEach(function(e){a.info[e]=this.videoTrack[e]},this)):this.audioTrack&&(s=this.audioTrack.timelineStartInfo.pts,Tt.forEach(function(e){a.info[e]=this.audioTrack[e]},this)),this.videoTrack||this.audioTrack){for(1===this.pendingTracks.length?a.type=this.pendingTracks[0].type:a.type="combined",this.emittedTracks+=this.pendingTracks.length,e=Q(this.pendingTracks),a.initSegment=new Uint8Array(e.byteLength),a.initSegment.set(e),a.data=new Uint8Array(this.pendingBytes),n=0;n<this.pendingBoxes.length;n++)a.data.set(this.pendingBoxes[n],r),r+=this.pendingBoxes[n].byteLength;for(n=0;n<this.pendingCaptions.length;n++)(t=this.pendingCaptions[n]).startTime=pe(t.startPts,s,this.keepOriginalTimestamps),t.endTime=pe(t.endPts,s,this.keepOriginalTimestamps),a.captionStreams[t.stream]=!0,a.captions.push(t);for(n=0;n<this.pendingMetadata.length;n++)(i=this.pendingMetadata[n]).cueTime=pe(i.pts,s,this.keepOriginalTimestamps),a.metadata.push(i);for(a.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",a),n=0;n<a.captions.length;n++)t=a.captions[n],this.trigger("caption",t);for(n=0;n<a.metadata.length;n++)i=a.metadata[n],this.trigger("id3Frame",i)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},_t.prototype.setRemux=function(e){this.remuxTracks=e},(vt=function(n){var r,a,s=this,i=!0;vt.prototype.init.call(this),this.baseMediaDecodeTime=(n=n||{}).baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var t={};(this.transmuxPipeline_=t).type="aac",t.metadataStream=new Je.MetadataStream,t.aacStream=new bt,t.audioTimestampRolloverStream=new Je.TimestampRolloverStream("audio"),t.timedMetadataTimestampRolloverStream=new Je.TimestampRolloverStream("timed-metadata"),t.adtsStream=new rt,t.coalesceStream=new _t(n,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||(a=a||{timelineStartInfo:{baseMediaDecodeTime:s.baseMediaDecodeTime},codec:"adts",type:"audio"},t.coalesceStream.numberOfTracks++,t.audioSegmentStream=new Ct(a,n),t.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),t.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),t.adtsStream.pipe(t.audioSegmentStream).pipe(t.coalesceStream),s.trigger("trackinfo",{hasAudio:!!a,hasVideo:!!r}))}),t.coalesceStream.on("data",this.trigger.bind(this,"data")),t.coalesceStream.on("done",this.trigger.bind(this,"done")),ft(this,t)},this.setupTsPipeline=function(){var i={};(this.transmuxPipeline_=i).type="ts",i.metadataStream=new Je.MetadataStream,i.packetStream=new Je.TransportPacketStream,i.parseStream=new Je.TransportParseStream,i.elementaryStream=new Je.ElementaryStream,i.timestampRolloverStream=new Je.TimestampRolloverStream,i.adtsStream=new rt,i.h264Stream=new St,i.captionStream=new Je.CaptionStream(n),i.coalesceStream=new _t(n,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?a||"audio"!==e.tracks[t].type||((a=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime):(r=e.tracks[t]).timelineStartInfo.baseMediaDecodeTime=s.baseMediaDecodeTime;r&&!i.videoSegmentStream&&(i.coalesceStream.numberOfTracks++,i.videoSegmentStream=new yt(r,n),i.videoSegmentStream.on("log",s.getLogTrigger_("videoSegmentStream")),i.videoSegmentStream.on("timelineStartInfo",function(e){a&&!n.keepOriginalTimestamps&&(a.timelineStartInfo=e,i.audioSegmentStream.setEarliestDts(e.dts-s.baseMediaDecodeTime))}),i.videoSegmentStream.on("processedGopsInfo",s.trigger.bind(s,"gopInfo")),i.videoSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"videoSegmentTimingInfo")),i.videoSegmentStream.on("baseMediaDecodeTime",function(e){a&&i.audioSegmentStream.setVideoBaseMediaDecodeTime(e)}),i.videoSegmentStream.on("timingInfo",s.trigger.bind(s,"videoTimingInfo")),i.h264Stream.pipe(i.videoSegmentStream).pipe(i.coalesceStream)),a&&!i.audioSegmentStream&&(i.coalesceStream.numberOfTracks++,i.audioSegmentStream=new Ct(a,n),i.audioSegmentStream.on("log",s.getLogTrigger_("audioSegmentStream")),i.audioSegmentStream.on("timingInfo",s.trigger.bind(s,"audioTimingInfo")),i.audioSegmentStream.on("segmentTimingInfo",s.trigger.bind(s,"audioSegmentTimingInfo")),i.adtsStream.pipe(i.audioSegmentStream).pipe(i.coalesceStream)),s.trigger("trackinfo",{hasAudio:!!a,hasVideo:!!r})}}),i.coalesceStream.on("data",this.trigger.bind(this,"data")),i.coalesceStream.on("id3Frame",function(e){e.dispatchType=i.metadataStream.dispatchType,s.trigger("id3Frame",e)}),i.coalesceStream.on("caption",this.trigger.bind(this,"caption")),i.coalesceStream.on("done",this.trigger.bind(this,"done")),ft(this,i)},this.setBaseMediaDecodeTime=function(e){var t=this.transmuxPipeline_;n.keepOriginalTimestamps||(this.baseMediaDecodeTime=e),a&&(a.timelineStartInfo.dts=void 0,a.timelineStartInfo.pts=void 0,_e(a),t.audioTimestampRolloverStream&&t.audioTimestampRolloverStream.discontinuity()),r&&(t.videoSegmentStream&&(t.videoSegmentStream.gopCache_=[]),r.timelineStartInfo.dts=void 0,r.timelineStartInfo.pts=void 0,_e(r),t.captionStream.reset()),t.timestampRolloverStream&&t.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(e){a&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(e)},this.setRemux=function(e){var t=this.transmuxPipeline_;n.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=Et(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 j;function It(e,d){var i=Mt(e,["moof","traf"]),e=Mt(e,["mdat"]),c={},n=[];return e.forEach(function(e,t){t=i[t];n.push({mdat:e,traf:t})}),n.forEach(function(e){var t,i,n,r,a,s=e.mdat,o=e.traf,u=Mt(o,["tfhd"]),l=Ht(u[0]),e=l.trackId,u=Mt(o,["tfdt"]),u=0<u.length?Bt(u[0]).baseMediaDecodeTime:0,o=Mt(o,["trun"]);d===e&&0<o.length&&(o=o,t=u,i=(l=l).defaultSampleDuration||0,n=l.defaultSampleSize||0,r=l.trackId,a=[],o.forEach(function(e){e=jt(e).samples;e.forEach(function(e){void 0===e.duration&&(e.duration=i),void 0===e.size&&(e.size=n),e.trackId=r,e.dts=t,void 0===e.compositionTimeOffset&&(e.compositionTimeOffset=0),"bigint"==typeof t?(e.pts=t+Vt.BigInt(e.compositionTimeOffset),t+=Vt.BigInt(e.duration)):(e.pts=t+e.compositionTimeOffset,t+=e.duration)}),a=a.concat(e)}),s=function(e,t,i){for(var n,r,a=new DataView(e.buffer,e.byteOffset,e.byteLength),s={logs:[],seiNals:[]},o=0;o+4<e.length;o+=n)if(n=a.getUint32(o),o+=4,!(n<=0))switch(31&e[o]){case 6:var u=e.subarray(o+1,o+1+n),l=function(e,t){for(var i=e,n=0;n<t.length;n++){var r=t[n];if(i<r.size)return r;i-=r.size}return null}(o,t),u={nalUnitType:"sei_rbsp",size:n,data:u,escapedRBSP:qt(u),trackId:i};if(l)u.pts=l.pts,u.dts=l.dts,r=l;else{if(!r){s.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+o+" for trackId "+i+". See mux.js#223."});break}u.pts=r.pts,u.dts=r.dts}s.seiNals.push(u)}return s}(s,a,e),c[e]||(c[e]={seiNals:[],logs:[]}),c[e].seiNals=c[e].seiNals.concat(s.seiNals),c[e].logs=c[e].logs.concat(s.logs))}),c}function xt(e){var t=31&e[1];return t<<=8,t|=e[2]}function At(e){return!!(64&e[1])}function Pt(e){var t=0;return 1<(48&e[3])>>>4&&(t+=e[4]+1),t}function Lt(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 Ot={Transmuxer:vt,VideoSegmentStream:yt,AudioSegmentStream:Ct,AUDIO_PROPERTIES:Tt,VIDEO_PROPERTIES:wt,generateSegmentTimingInfo:gt},e=function(e){return e>>>0},Dt=function(e){var t="";return t+=String.fromCharCode(e[0]),t+=String.fromCharCode(e[1]),t+=String.fromCharCode(e[2]),t+=String.fromCharCode(e[3])},Rt=e,Mt=function e(t,i){var n,r,a,s=[];if(!i.length)return null;for(n=0;n<t.byteLength;)r=Rt(t[n]<<24|t[n+1]<<16|t[n+2]<<8|t[n+3]),a=Dt(t.subarray(n+4,n+8)),r=1<r?n+r:t.byteLength,a===i[0]&&(1===i.length?s.push(t.subarray(n+8,r)):(a=e(t.subarray(n+8,r),i.slice(1))).length&&(s=s.concat(a))),n=r;return s},Nt=e,Ut=V.getUint64,Bt=function(e){var t={version:e[0],flags:new Uint8Array(e.subarray(1,4))};return 1===t.version?t.baseMediaDecodeTime=Ut(e.subarray(4)):t.baseMediaDecodeTime=Nt(e[4]<<24|e[5]<<16|e[6]<<8|e[7]),t},Ft=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]}},jt=function(e){var t,i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),samples:[]},n=new DataView(e.buffer,e.byteOffset,e.byteLength),r=1&i.flags[2],a=4&i.flags[2],s=1&i.flags[1],o=2&i.flags[1],u=4&i.flags[1],l=8&i.flags[1],d=n.getUint32(4),c=8;for(r&&(i.dataOffset=n.getInt32(c),c+=4),a&&d&&(t={flags:Ft(e.subarray(c,c+4))},c+=4,s&&(t.duration=n.getUint32(c),c+=4),o&&(t.size=n.getUint32(c),c+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(c):t.compositionTimeOffset=n.getUint32(c),c+=4),i.samples.push(t),d--);d--;)t={},s&&(t.duration=n.getUint32(c),c+=4),o&&(t.size=n.getUint32(c),c+=4),u&&(t.flags=Ft(e.subarray(c,c+4)),c+=4),l&&(1===i.version?t.compositionTimeOffset=n.getInt32(c):t.compositionTimeOffset=n.getUint32(c),c+=4),i.samples.push(t);return i},Ht=function(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength),i={version:e[0],flags:new Uint8Array(e.subarray(1,4)),trackId:t.getUint32(4)},n=1&i.flags[2],r=2&i.flags[2],a=8&i.flags[2],s=16&i.flags[2],o=32&i.flags[2],u=65536&i.flags[0],l=131072&i.flags[0],e=8;return n&&(e+=4,i.baseDataOffset=t.getUint32(12),e+=4),r&&(i.sampleDescriptionIndex=t.getUint32(e),e+=4),a&&(i.defaultSampleDuration=t.getUint32(e),e+=4),s&&(i.defaultSampleSize=t.getUint32(e),e+=4),o&&(i.defaultSampleFlags=t.getUint32(e)),u&&(i.durationIsEmpty=!0),!n&&l&&(i.baseDataOffsetIsMoof=!0),i},j="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},j="undefined"!=typeof window?window:"undefined"!=typeof j?j:"undefined"!=typeof self?self:{},Vt=j,qt=ke,Wt=Fe.CaptionStream,Gt=function(){var t,r,a,s,o,i,n=!1;this.isInitialized=function(){return n},this.init=function(e){t=new Wt,n=!0,i=!!e&&e.isPartial,t.on("data",function(e){e.startTime=e.startPts/s,e.endTime=e.endPts/s,o.captions.push(e),o.captionStreams[e.stream]=!0}),t.on("log",function(e){o.logs.push(e)})},this.isNewInit=function(e,t){return!(e&&0===e.length||t&&"object"==typeof t&&0===Object.keys(t).length)&&(a!==e[0]||s!==t[a])},this.parse=function(e,t,i){if(!this.isInitialized())return null;if(!t||!i)return null;if(this.isNewInit(t,i))a=t[0],s=i[a];else if(null===a||!s)return r.push(e),null;for(;0<r.length;){var n=r.shift();this.parse(n,t,i)}return(e=function(e,t,i){if(null===t)return null;t=It(e,t)[t]||{};return{seiNals:t.seiNals,logs:t.logs,timescale:i}}(e,a,s))&&e.logs&&(o.logs=o.logs.concat(e.logs)),null!==e&&e.seiNals?(this.pushNals(e.seiNals),this.flushStream(),o):o.logs.length?{logs:o.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(){o.captions=[],o.captionStreams={},o.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;t.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){r=[],s=a=null,o?this.clearParsedCaptions():o={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},zt=e,Xt=function(e){return("00"+e.toString(16)).slice(-2)},Kt=V.getUint64,j=function(e){return Mt(e,["moov","trak"]).reduce(function(e,t){var i,n,r=Mt(t,["tkhd"])[0];return r?(i=r[0],r=zt(r[n=0===i?12:20]<<24|r[1+n]<<16|r[2+n]<<8|r[3+n]),(t=Mt(t,["mdia","mdhd"])[0])?(i=t[0],e[r]=zt(t[n=0===i?12:20]<<24|t[1+n]<<16|t[2+n]<<8|t[3+n]),e):null):null},{})},ke=function(a,e){e=Mt(e,["moof","traf"]).reduce(function(e,t){var i,n=Mt(t,["tfhd"])[0],r=zt(n[4]<<24|n[5]<<16|n[6]<<8|n[7]),n=a[r]||9e4,r=Mt(t,["tfdt"])[0],t=new DataView(r.buffer,r.byteOffset,r.byteLength),t=1===r[0]?Kt(r.subarray(4,12)):t.getUint32(4);return"bigint"==typeof t?i=t/Vt.BigInt(n):"number"!=typeof t||isNaN(t)||(i=t/n),e=(i=i<Number.MAX_SAFE_INTEGER?Number(i):i)<e?i:e},1/0);return"bigint"==typeof e||isFinite(e)?e:0},e=function(e){var e=Mt(e,["moov","trak"]),n=[];return e.forEach(function(e){var t=Mt(e,["mdia","hdlr"]),i=Mt(e,["tkhd"]);t.forEach(function(e,t){e=Dt(e.subarray(8,12)),t=i[t];"vide"===e&&(t=0===(t=new DataView(t.buffer,t.byteOffset,t.byteLength)).getUint8(0)?t.getUint32(12):t.getUint32(20),n.push(t))})}),n},Yt=function(e){var t=0===e[0]?12:20;return zt(e[t]<<24|e[1+t]<<16|e[2+t]<<8|e[3+t])},V=function(e){var e=Mt(e,["moov","trak"]),s=[];return e.forEach(function(e){var t={},i=Mt(e,["tkhd"])[0];i&&(i=(n=new DataView(i.buffer,i.byteOffset,i.byteLength)).getUint8(0),t.id=0===i?n.getUint32(12):n.getUint32(20));var n=Mt(e,["mdia","hdlr"])[0];n&&(a=Dt(n.subarray(8,12)),t.type="vide"===a?"video":"soun"===a?"audio":a);var r,a=Mt(e,["mdia","minf","stbl","stsd"])[0];a&&(a=a.subarray(8),t.codec=Dt(a.subarray(4,8)),(a=Mt(a,[t.codec])[0])&&(/^[asm]vc[1-9]$/i.test(t.codec)?(r=a.subarray(78),"avcC"===Dt(r.subarray(4,8))&&11<r.length?(t.codec+=".",t.codec+=Xt(r[9]),t.codec+=Xt(r[10]),t.codec+=Xt(r[11])):t.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(t.codec)?(r=a.subarray(28),"esds"===Dt(r.subarray(4,8))&&20<r.length&&0!==r[19]?(t.codec+="."+Xt(r[19]),t.codec+="."+Xt(r[20]>>>2&63).replace(/^0/,"")):t.codec="mp4a.40.2"):t.codec=t.codec.toLowerCase()));e=Mt(e,["mdia","mdhd"])[0];e&&(t.timescale=Yt(e)),s.push(t)}),s},Qt=ke,$t=V,Jt=Ie,Zt={};Zt.ts={parseType:function(e,t){e=xt(e);return 0===e?"pat":e===t?"pmt":t?"pes":null},parsePat:function(e){var t=At(e),i=4+Pt(e);return t&&(i+=e[i]+1),(31&e[i+10])<<8|e[i+11]},parsePmt:function(e){var t={},i=At(e),n=4+Pt(e);if(i&&(n+=e[n]+1),1&e[n+5]){for(var r=3+((15&e[n+1])<<8|e[n+2])-4,a=12+((15&e[n+10])<<8|e[n+11]);a<r;){var s=n+a;t[(31&e[s+1])<<8|e[s+2]]=e[s],a+=5+((15&e[s+3])<<8|e[s+4])}return t}},parsePayloadUnitStartIndicator:At,parsePesType:function(e,t){switch(t[xt(e)]){case je.H264_STREAM_TYPE:return"video";case je.ADTS_STREAM_TYPE:return"audio";case je.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},parsePesTime:function(e){if(!At(e))return null;var t=4+Pt(e);if(t>=e.byteLength)return null;var i=null,n=e[t+7];return 192&n&&((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&n&&(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+Pt(e),i=e.subarray(t),n=0,r=0,a=!1;r<i.byteLength-3;r++)if(1===i[r+2]){n=r+5;break}for(;n<i.byteLength;)switch(i[n]){case 0:if(0!==i[n-1]){n+=2;break}if(0!==i[n-2]){n++;break}for(r+3!==n-2&&"slice_layer_without_partitioning_rbsp_idr"===Lt(31&i[r+3])&&(a=!0);1!==i[++n]&&n<i.length;);r=n-2,n+=3;break;case 1:if(0!==i[n-1]||0!==i[n-2]){n+=3;break}"slice_layer_without_partitioning_rbsp_idr"===Lt(31&i[r+3])&&(a=!0),r=n-2,n+=3;break;default:n+=3}return i=i.subarray(r),n-=r,r=0,a=i&&3<i.byteLength&&"slice_layer_without_partitioning_rbsp_idr"===Lt(31&i[r+3])?!0:a}},Zt.aac=ct;function ei(e,t,i){for(var n,r,a,s,o=0,u=188,l=!1;u<=e.byteLength;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o++,u++;else{if(n=e.subarray(o,u),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),a=Zt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Zt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)),l)break;o+=188,u+=188}for(o=(u=e.byteLength)-188,l=!1;0<=o;)if(71!==e[o]||71!==e[u]&&u!==e.byteLength)o--,u--;else{if(n=e.subarray(o,u),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),a=Zt.ts.parsePayloadUnitStartIndicator(n),"audio"===r&&a&&(s=Zt.ts.parsePesTime(n))&&(s.type="audio",i.audio.push(s),l=!0)),l)break;o-=188,u-=188}}function ti(e){var t,i={pid:null,table:null},n={};for(t in!function(e,t){for(var i,n=0,r=188;r<e.byteLength;)if(71!==e[n]||71!==e[r])n++,r++;else{switch(i=e.subarray(n,r),Zt.ts.parseType(i,t.pid)){case"pat":t.pid=Zt.ts.parsePat(i);break;case"pmt":var a=Zt.ts.parsePmt(i);t.table=t.table||{},Object.keys(a).forEach(function(e){t.table[e]=a[e]})}n+=188,r+=188}}(e,i),i.table)if(i.table.hasOwnProperty(t))switch(i.table[t]){case je.H264_STREAM_TYPE:n.video=[],function(e,t,i){for(var n,r,a,s,o,u,l,d,c=0,h=188,p=!1,f={data:[],size:0};h<e.byteLength;)if(71!==e[c]||71!==e[h])c++,h++;else{if(n=e.subarray(c,h),"pes"===Zt.ts.parseType(n,t.pid))if(r=Zt.ts.parsePesType(n,t.table),a=Zt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&(a&&!p&&(s=Zt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),p=!0),!i.firstKeyFrame)){if(a&&0!==f.size){for(o=new Uint8Array(f.size),u=0;f.data.length;)l=f.data.shift(),o.set(l,u),u+=l.byteLength;!Zt.ts.videoPacketContainsKeyFrame(o)||(d=Zt.ts.parsePesTime(o))&&(i.firstKeyFrame=d,i.firstKeyFrame.type="video"),f.size=0}f.data.push(n),f.size+=n.byteLength}if(p&&i.firstKeyFrame)break;c+=188,h+=188}for(c=(h=e.byteLength)-188,p=!1;0<=c;)if(71!==e[c]||71!==e[h])c--,h--;else{if(n=e.subarray(c,h),"pes"===Zt.ts.parseType(n,t.pid)&&(r=Zt.ts.parsePesType(n,t.table),a=Zt.ts.parsePayloadUnitStartIndicator(n),"video"===r&&a&&(s=Zt.ts.parsePesTime(n))&&(s.type="video",i.video.push(s),p=!0)),p)break;c-=188,h-=188}}(e,i,n),0===n.video.length&&delete n.video;break;case je.ADTS_STREAM_TYPE:n.audio=[],ei(e,i,n),0===n.audio.length&&delete n.audio}return n}var ii=ue,ni=function(e,t){var i,n,r=(Zt.aac.isLikelyAacData(e)?function(e){for(var t,i=!1,n=0,r=null,a=null,s=0,o=0;3<=e.length-o;){switch(Zt.aac.parseType(e,o)){case"timed-metadata":if(e.length-o<10){i=!0;break}if((s=Zt.aac.parseId3TagSize(e,o))>e.length){i=!0;break}null===a&&(t=e.subarray(o,o+s),a=Zt.aac.parseAacTimestamp(t)),o+=s;break;case"audio":if(e.length-o<7){i=!0;break}if((s=Zt.aac.parseAdtsSize(e,o))>e.length){i=!0;break}null===r&&(t=e.subarray(o,o+s),r=Zt.aac.parseSampleRate(t)),n++,o+=s;break;default:o++}if(i)return null}if(null===r||null===a)return null;var u=ii/r;return{audio:[{type:"audio",dts:a,pts:a},{type:"audio",dts:a+1024*n*u,pts:a+1024*n*u}]}}:ti)(e);return r&&(r.audio||r.video)?(e=t,(t=r).audio&&t.audio.length&&("undefined"!=typeof(i=e)&&!isNaN(i)||(i=t.audio[0].dts),t.audio.forEach(function(e){e.dts=Jt(e.dts,i),e.pts=Jt(e.pts,i),e.dtsTime=e.dts/ii,e.ptsTime=e.pts/ii})),t.video&&t.video.length&&("undefined"!=typeof(n=e)&&!isNaN(n)||(n=t.video[0].dts),t.video.forEach(function(e){e.dts=Jt(e.dts,n),e.pts=Jt(e.pts,n),e.dtsTime=e.dts/ii,e.ptsTime=e.pts/ii}),t.firstKeyFrame&&((t=t.firstKeyFrame).dts=Jt(t.dts,n),t.pts=Jt(t.pts,n),t.dtsTime=t.dts/ii,t.ptsTime=t.pts/ii)),r):null},ri=function(){function e(e,t){this.options=t||{},this.self=e,this.init()}var t=e.prototype;return t.init=function(){var i,e;this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Ot.Transmuxer(this.options),i=this.self,(e=this.transmuxer).on("data",function(e){var t=e.initSegment;e.initSegment={data:t.buffer,byteOffset:t.byteOffset,byteLength:t.byteLength};t=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:de(e.start.dts),presentation:de(e.start.pts)},end:{decode:de(e.end.dts),presentation:de(e.end.pts)},baseMediaDecodeTime:de(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=de(e.prependedContentDuration)),i.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:t})}),e.on("audioSegmentTimingInfo",function(e){var t={start:{decode:de(e.start.dts),presentation:de(e.start.pts)},end:{decode:de(e.end.dts),presentation:de(e.end.pts)},baseMediaDecodeTime:de(e.baseMediaDecodeTime)};e.prependedContentDuration&&(t.prependedContentDuration=de(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:de(e.start),end:de(e.end)}})}),e.on("videoTimingInfo",function(e){i.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:de(e.start),end:de(e.end)}})}),e.on("log",function(e){i.postMessage({action:"log",log:e})})},t.pushMp4Captions=function(e){this.captionParser||(this.captionParser=new Gt,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])},t.probeMp4StartTime=function(e){var t=e.timescales,e=e.data,t=Qt(t,e);this.self.postMessage({action:"probeMp4StartTime",startTime:t,data:e},[e.buffer])},t.probeMp4Tracks=function(e){var t=e.data,e=$t(t);this.self.postMessage({action:"probeMp4Tracks",tracks:e,data:t},[t.buffer])},t.probeTs=function(e){var t=e.data,i=e.baseStartTime,e="number"!=typeof i||isNaN(i)?void 0:i*ue,i=ni(t,e),e=null;i&&((e={hasVideo:i.video&&2===i.video.length||!1,hasAudio:i.audio&&2===i.audio.length||!1}).hasVideo&&(e.videoStart=i.video[0].ptsTime),e.hasAudio&&(e.audioStart=i.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:e,data:t},[t.buffer])},t.clearAllMp4Captions=function(){this.captionParser&&this.captionParser.clearAllCaptions()},t.clearParsedMp4Captions=function(){this.captionParser&&this.captionParser.clearParsedCaptions()},t.push=function(e){e=new Uint8Array(e.data,e.byteOffset,e.byteLength);this.transmuxer.push(e)},t.reset=function(){this.transmuxer.reset()},t.setTimestampOffset=function(e){e=e.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(le(e)))},t.setAudioAppendStart=function(e){this.transmuxer.setAudioAppendStart(Math.ceil(le(e.appendStart)))},t.setRemux=function(e){this.transmuxer.setRemux(e.remux)},t.flush=function(e){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})},t.endTimeline=function(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})},t.alignGopsWith=function(e){this.transmuxer.alignGopsWith(e.gopsToAlignWith.slice())},e}();self.onmessage=function(e){"init"===e.data.action&&e.data.options?this.messageHandlers=new ri(self,e.data.options):(this.messageHandlers||(this.messageHandlers=new ri(self)),e.data&&e.data.action&&"init"!==e.data.action&&this.messageHandlers[e.data.action]&&this.messageHandlers[e.data.action](e.data))}}))),zl=function(e){e.currentTransmux=null,e.transmuxQueue.length&&(e.currentTransmux=e.transmuxQueue.shift(),"function"==typeof e.currentTransmux?e.currentTransmux():Zu(e.currentTransmux))},Xl=function(e){tl("reset",e)},Kl=function(e){var t=new Gl;t.currentTransmux=null,t.transmuxQueue=[];var i=t.terminate;return t.terminate=function(){return t.currentTransmux=null,t.transmuxQueue.length=0,i.call(t)},t.postMessage({action:"init",options:e}),t},Yl=2,Ql=-101,$l=-102,Jl=Zo("CodecUtils"),Zl=Zo("PlaylistSelector"),zt=function(){var e=this.useDevicePixelRatio&&window.devicePixelRatio||1;return Sl(this.playlists.master,this.systemBandwidth,parseInt(bl(this.tech_.el(),"width"),10)*e,parseInt(bl(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)},ed=function(n){function e(e,t){var i=n.call(this)||this;if(!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");return i.bandwidth=e.bandwidth,i.throughput={rate:0,count:0},i.roundTrip=NaN,i.resetStats_(),i.mediaIndex=null,i.partIndex=null,i.hasPlayed_=e.hasPlayed,i.currentTime_=e.currentTime,i.seekable_=e.seekable,i.seeking_=e.seeking,i.duration_=e.duration,i.mediaSource_=e.mediaSource,i.vhs_=e.vhs,i.loaderType_=e.loaderType,i.currentMediaInfo_=void 0,i.startingMediaInfo_=void 0,i.segmentMetadataTrack_=e.segmentMetadataTrack,i.goalBufferLength_=e.goalBufferLength,i.sourceType_=e.sourceType,i.sourceUpdater_=e.sourceUpdater,i.inbandTextTracks_=e.inbandTextTracks,i.state_="INIT",i.timelineChangeController_=e.timelineChangeController,i.shouldSaveSegmentTimingInfo_=!0,i.parse708captions_=e.parse708captions,i.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,i.captionServices_=e.captionServices,i.experimentalExactManifestTimings=e.experimentalExactManifestTimings,i.checkBufferTimeout_=null,i.error_=void 0,i.currentTimeline_=-1,i.pendingSegment_=null,i.xhrOptions_=null,i.pendingSegments_=[],i.audioDisabled_=!1,i.isPendingTimestampOffset_=!1,i.gopBuffer_=[],i.timeMapping_=0,i.safeAppend_=11<=ir.browser.IE_VERSION,i.appendInitSegment_={audio:!0,video:!0},i.playlistOfLastInitSegment_={audio:null,video:null},i.callQueue_=[],i.loadQueue_=[],i.metadataQueue_={id3:[],caption:[]},i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=null,i.activeInitSegmentId_=null,i.initSegments_={},i.cacheEncryptionKeys_=e.cacheEncryptionKeys,i.keyCache_={},i.decrypter_=e.decrypter,i.syncController_=e.syncController,i.syncPoint_={segmentIndex:0,time:0},i.transmuxer_=i.createTransmuxer_(),i.triggerSyncInfoUpdate_=function(){return i.trigger("syncinfoupdate")},i.syncController_.on("syncinfoupdate",i.triggerSyncInfoUpdate_),i.mediaSource_.addEventListener("sourceopen",function(){i.isEndOfStream_()||(i.ended_=!1)}),i.fetchAtBuffer_=!1,i.logger_=Zo("SegmentLoader["+i.loaderType_+"]"),Object.defineProperty(ft(i),"state",{get:function(){return this.state_},set:function(e){e!==this.state_&&(this.logger_(this.state_+" -> "+e),this.state_=e,this.trigger("statechange"))}}),i.sourceUpdater_.on("ready",function(){i.hasEnoughInfoToAppend_()&&i.processCallQueue_()}),"main"===i.loaderType_&&i.timelineChangeController_.on("pendingtimelinechange",function(){i.hasEnoughInfoToAppend_()&&i.processCallQueue_()}),"audio"===i.loaderType_&&i.timelineChangeController_.on("timelinechange",function(){i.hasEnoughInfoToLoad_()&&i.processLoadQueue_(),i.hasEnoughInfoToAppend_()&&i.processCallQueue_()}),i}mt(e,n);var t=e.prototype;return t.createTransmuxer_=function(){return Kl({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})},t.resetStats_=function(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0},t.dispose=function(){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()},t.setAudio=function(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())},t.abort=function(){"WAITING"===this.state?(this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()):this.pendingSegment_&&(this.pendingSegment_=null)},t.abort_=function(){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},t.checkForAbort_=function(e){return"APPENDING"!==this.state||this.pendingSegment_?!this.pendingSegment_||this.pendingSegment_.requestId!==e:(this.state="READY",!0)},t.error=function(e){return"undefined"!=typeof e&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_},t.endOfStream=function(){this.ended_=!0,this.transmuxer_&&Xl(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")},t.buffered_=function(){var e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ir.createTimeRanges();if("main"===this.loaderType_){var t=e.hasAudio,i=e.hasVideo,e=e.isMuxed;if(i&&t&&!this.audioDisabled_&&!e)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()},t.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Hu(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e},t.segmentKey=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Vu(e),n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});e={resolvedUri:(n||e).resolvedUri};return n&&(e.bytes=n.bytes),e},t.couldBeginLoading_=function(){return this.playlist_&&!this.paused()},t.load=function(){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"))},t.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},t.playlist=function(e,t){if(void 0===t&&(t={}),e){var i=this.playlist_,n=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,"INIT"===this.state&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},"main"===this.loaderType_&&this.syncController_.setDateTimeMappingForStart(e));var r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_("playlist update ["+r+" => "+(e.id||e.uri)+"]"),this.trigger("syncinfoupdate"),"INIT"===this.state&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri)return null!==this.mediaIndex&&(e.endList?this.resyncLoader():this.resetLoader()),this.currentMediaInfo_=void 0,void this.trigger("playlistupdate");t=e.mediaSequence-i.mediaSequence;this.logger_("live window shift ["+t+"]"),null!==this.mediaIndex&&(this.mediaIndex-=t,this.mediaIndex<0?(this.mediaIndex=null,this.partIndex=null):(r=this.playlist_.segments[this.mediaIndex],!this.partIndex||r.parts&&r.parts.length&&r.parts[this.partIndex]||(r=this.mediaIndex,this.logger_("currently processing part (index "+this.partIndex+") no longer exists."),this.resetLoader(),this.mediaIndex=r))),n&&(n.mediaIndex-=t,n.mediaIndex<0?(n.mediaIndex=null,n.partIndex=null):(0<=n.mediaIndex&&(n.segment=e.segments[n.mediaIndex]),0<=n.partIndex&&n.segment.parts&&(n.part=n.segment.parts[n.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}},t.pause=function(){this.checkBufferTimeout_&&(window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)},t.paused=function(){return null===this.checkBufferTimeout_},t.resetEverything=function(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"}))},t.resetLoader=function(){this.fetchAtBuffer_=!1,this.resyncLoader()},t.resyncLoader=function(){this.transmuxer_&&Xl(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"})},t.remove=function(e,t,i,n){if(void 0===i&&(i=function(){}),void 0===n&&(n=!1),(t=t===1/0?this.duration_():t)<=e)this.logger_("skipping remove because end ${end} is <= start ${start}");else if(this.sourceUpdater_&&this.getMediaInfo_()){var r,a=1,s=function(){0===--a&&i()};for(r in!n&&this.audioDisabled_||(a++,this.sourceUpdater_.removeAudio(e,t,s)),!n&&"main"!==this.loaderType_||(this.gopBuffer_=function(e,t,i,n){for(var r=Math.ceil((t-n)*Qo),a=Math.ceil((i-n)*Qo),n=e.slice(),s=e.length;s--&&!(e[s].pts<=a););if(-1===s)return n;for(var o=s+1;o--&&!(e[o].pts<=r););return o=Math.max(o,0),n.splice(o,s-o+1),n}(this.gopBuffer_,e,t,this.timeMapping_),a++,this.sourceUpdater_.removeVideo(e,t,s)),this.inbandTextTracks_)kl(e,t,this.inbandTextTracks_[r]);kl(e,t,this.segmentMetadataTrack_),s()}else this.logger_("skipping remove because no source updater or starting media info")},t.monitorBuffer_=function(){this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),1)},t.monitorBufferTick_=function(){"READY"===this.state&&this.fillBuffer_(),this.checkBufferTimeout_&&window.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=window.setTimeout(this.monitorBufferTick_.bind(this),500)},t.fillBuffer_=function(){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))},t.isEndOfStream_=function(e,t,i){if(void 0===e&&(e=this.mediaIndex),void 0===t&&(t=this.playlist_),void 0===i&&(i=this.partIndex),!t||!this.mediaSource_)return!1;var n="number"==typeof e&&t.segments[e],e=e+1===t.segments.length,n=!n||!n.parts||i+1===n.parts.length;return t.endList&&"open"===this.mediaSource_.readyState&&e&&n},t.chooseNextRequest_=function(){var e=this.buffered_(),t=au(e)||0,i=su(e,this.currentTime_()),n=!this.hasPlayed_()&&1<=i,r=i>=this.goalBufferLength_(),e=this.playlist_.segments;if(!e.length||n||r)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());var a,n={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};n.isSyncRequest?n.mediaIndex=function(e,t,i){t=t||[];for(var n=[],r=0,a=0;a<t.length;a++){var s=t[a];if(e===s.timeline&&(n.push(a),i<(r+=s.duration)))return a}return 0===n.length?0:n[n.length-1]}(this.currentTimeline_,e,t):null!==this.mediaIndex?(r=e[this.mediaIndex],a="number"==typeof this.partIndex?this.partIndex:-1,n.startOfSegment=r.end||t,r.parts&&r.parts[a+1]?(n.mediaIndex=this.mediaIndex,n.partIndex=a+1):n.mediaIndex=this.mediaIndex+1):(a=(o=Nl.getMediaInfoForTime({experimentalExactManifestTimings:this.experimentalExactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time})).segmentIndex,s=o.startTime,o=o.partIndex,n.getMediaInfoForTime=this.fetchAtBuffer_?"bufferedEnd "+t:"currentTime "+this.currentTime_(),n.mediaIndex=a,n.startOfSegment=s,n.partIndex=o);var s=e[n.mediaIndex],o=s&&"number"==typeof n.partIndex&&s.parts&&s.parts[n.partIndex];if(!s||"number"==typeof n.partIndex&&!o)return null;"number"!=typeof n.partIndex&&s.parts&&(n.partIndex=0,o=s.parts[0]),i||!o||o.independent||(0===n.partIndex?(o=(i=e[n.mediaIndex-1]).parts&&i.parts.length&&i.parts[i.parts.length-1])&&o.independent&&(--n.mediaIndex,n.partIndex=i.parts.length-1,n.independent="previous segment"):s.parts[n.partIndex-1].independent&&(--n.partIndex,n.independent="previous part"));s=this.mediaSource_&&"ended"===this.mediaSource_.readyState;return n.mediaIndex>=e.length-1&&s&&!this.seeking_()?null:this.generateSegmentInfo_(n)},t.generateSegmentInfo_=function(e){var t=e.independent,i=e.playlist,n=e.mediaIndex,r=e.startOfSegment,a=e.isSyncRequest,s=e.partIndex,o=e.forceTimestampOffset,u=e.getMediaInfoForTime,l=i.segments[n],e="number"==typeof s&&l.parts[s],t={requestId:"segment-loader-"+Math.random(),uri:e&&e.resolvedUri||l.resolvedUri,mediaIndex:n,partIndex:e?s:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:l.timeline,duration:e&&e.duration||l.duration,segment:l,part:e,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:u,independent:t},o="undefined"!=typeof o?o:this.isPendingTimestampOffset_;t.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:l.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:o});o=au(this.sourceUpdater_.audioBuffered());return"number"==typeof o&&(t.audioAppendStart=o-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(t.gopsToAlignWith=function(e,t,i){if("undefined"==typeof t||null===t||!e.length)return[];for(var n=Math.ceil((t-i+3)*Qo),r=0;r<e.length&&!(e[r].pts>n);r++);return e.slice(r)}(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),t},t.timestampOffsetForSegment_=function(e){return i=(t=e).segmentTimeline,n=t.currentTimeline,r=t.startOfSegment,e=t.buffered,t.overrideCheck||i!==n?!(i<n)&&e.length?e.end(e.length-1):r:null;var t,i,n,r},t.earlyAbortWhenNeeded_=function(e){var t,i,n,r,a,s,o,u,l,d,c,h,p;!this.vhs_.tech_.paused()&&this.xhrOptions_.timeout&&this.playlist_.attributes.BANDWIDTH&&(Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3||(t=this.currentTime_(),r=e.bandwidth,a=this.pendingSegment_.duration,p=Nl.estimateSegmentRequestTime(a,r,this.playlist_,e.bytesReceived),i=this.buffered_(),n=t,void 0===(e=this.vhs_.tech_.playbackRate())&&(e=1),p<=(e=((i.length?i.end(i.length-1):0)-n)/e-1)||(r={master:this.vhs_.playlists.master,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:a,timeUntilRebuffer:e,currentTimeline:this.currentTimeline_,syncController:this.syncController_},a=r.master,s=r.currentTime,o=r.bandwidth,u=r.duration,l=r.segmentDuration,d=r.timeUntilRebuffer,c=r.currentTimeline,h=r.syncController,a=(r=(a=!(a=(r=a.playlists.filter(function(e){return!Nl.isIncompatible(e)})).filter(Nl.isEnabled)).length?r.filter(function(e){return!Nl.isDisabled(e)}):a).filter(Nl.hasAttribute.bind(null,"BANDWIDTH")).map(function(e){var t=h.getSyncPoint(e,u,c,s)?1:2;return{playlist:e,rebufferingImpact:Nl.estimateSegmentRequestTime(l,o,e)*t-d}})).filter(function(e){return e.rebufferingImpact<=0}),Tl(a,function(e,t){return wl(t.playlist,e.playlist)}),(r=a.length?a[0]:(Tl(r,function(e,t){return e.rebufferingImpact-t.rebufferingImpact}),r[0]||null))&&(p=p-e-r.rebufferingImpact,!r.playlist||r.playlist.uri===this.playlist_.uri||p<(e<=Rl?1:.5)||(this.bandwidth=r.playlist.attributes.BANDWIDTH*Wl.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))))))},t.handleAbort_=function(e){this.logger_("Aborting "+Il(e)),this.mediaRequestsAborted+=1},t.handleProgress_=function(e,t){this.earlyAbortWhenNeeded_(t.stats),this.checkForAbort_(t.requestId)||this.trigger("progress")},t.handleTrackInfo_=function(e,t){this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||this.checkForIllegalMediaSwitch(t)||(function(e,t){if(!e&&!t||!e&&t||e&&!t)return!1;if(e===t)return!0;var i=Object.keys(e).sort(),n=Object.keys(t).sort();if(i.length!==n.length)return!1;for(var r=0;r<i.length;r++){var a=i[r];if(a!==n[r])return!1;if(e[a]!==t[a])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_()))},t.handleTimingInfo_=function(e,t,i,n){var r;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||((r=this.pendingSegment_)[e=xl(t)]=r[e]||{},r[e][i]=n,this.logger_("timinginfo: "+t+" - "+i+" - "+n),this.hasEnoughInfoToAppend_()&&this.processCallQueue_())},t.handleCaptions_=function(e,t){var g,y,v=this;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(0!==t.length?this.pendingSegment_.hasAppendedData_?(g=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),y={},t.forEach(function(e){y[e.stream]=y[e.stream]||{startTime:1/0,captions:[],endTime:0};var t=y[e.stream];t.startTime=Math.min(t.startTime,e.startTime+g),t.endTime=Math.max(t.endTime,e.endTime+g),t.captions.push(e)}),Object.keys(y).forEach(function(e){var t,i,n,r,a,s,o,u,l,d,c=y[e],h=c.startTime,p=c.endTime,f=c.captions,m=v.inbandTextTracks_;v.logger_("adding cues from "+h+" -> "+p+" for "+e),t=m,i=v.vhs_.tech_,t[n=e]||(i.trigger({type:"usage",name:"vhs-608"}),i.trigger({type:"usage",name:"hls-608"}),/^cc708_/.test(r=n)&&(r="SERVICE"+n.split("_")[1]),(o=i.textTracks().getTrackById(r))?t[n]=o:(s=a=n,c=!1,(o=(i.options_.vhs&&i.options_.vhs.captionServices||{})[r])&&(a=o.label,s=o.language,c=o.default),t[n]=i.addRemoteTextTrack({kind:"captions",id:r,default:c,label:a,language:s},!1).track)),kl(h,p,m[e]),l=(f={captionArray:f,inbandTextTracks:m,timestampOffset:g}).inbandTextTracks,m=f.captionArray,d=f.timestampOffset,m&&(u=window.WebKitDataCue||window.VTTCue,m.forEach(function(e){var t=e.stream;l[t].addCue(new u(e.startTime+d,e.endTime+d,e.text))}))}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})):this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t)):this.logger_("SegmentLoader received no captions from a caption event"))},t.handleId3_=function(e,t,i){var n,r,a,s;this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId)||(this.pendingSegment_.hasAppendedData_?(n=null===this.sourceUpdater_.videoTimestampOffset()?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r=this.inbandTextTracks_,a=i,s=this.vhs_.tech_,r.metadataTrack_||(r.metadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,r.metadataTrack_.inBandMetadataTrackDispatchType=a),El({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:this.duration_()})):this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i)))},t.processMetadataQueue_=function(){this.metadataQueue_.id3.forEach(function(e){return e()}),this.metadataQueue_.caption.forEach(function(e){return e()}),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]},t.processCallQueue_=function(){var e=this.callQueue_;this.callQueue_=[],e.forEach(function(e){return e()})},t.processLoadQueue_=function(){var e=this.loadQueue_;this.loadQueue_=[],e.forEach(function(e){return e()})},t.hasEnoughInfoToLoad_=function(){if("audio"!==this.loaderType_)return!0;var e=this.pendingSegment_;return!!e&&(!this.getCurrentMediaInfo_()||!Al({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},t.getCurrentMediaInfo_=function(e){return(e=void 0===e?this.pendingSegment_:e)&&e.trackInfo||this.currentMediaInfo_},t.getMediaInfo_=function(e){return void 0===e&&(e=this.pendingSegment_),this.getCurrentMediaInfo_(e)||this.startingMediaInfo_},t.getPendingSegmentPlaylist=function(){return this.pendingSegment_?this.pendingSegment_.playlist:null},t.hasEnoughInfoToAppend_=function(){if(!this.sourceUpdater_.ready())return!1;if(this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;var e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;var i=t.hasAudio,n=t.hasVideo,t=t.isMuxed;return!(n&&!e.videoTimingInfo)&&(!(i&&!this.audioDisabled_&&!t&&!e.audioTimingInfo)&&!Al({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))},t.handleData_=function(e,t){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId))if(!this.callQueue_.length&&this.hasEnoughInfoToAppend_()){var i,n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),"closed"!==this.mediaSource_.readyState){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4?(this.trigger("fmp4"),n.timingInfo.start=n[xl(t.type)].start):(i=this.getCurrentMediaInfo_(),(i="main"===this.loaderType_&&i&&i.hasVideo)&&(r=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:i,firstVideoFrameTimeForData:r,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})),this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:"main"===this.loaderType_});var r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex)return void this.logger_("sync segment was incorrect, not appending");this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,t)}}else this.callQueue_.push(this.handleData_.bind(this,e,t))},t.updateAppendInitSegmentStatus=function(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)},t.getInitSegmentAndUpdateState_=function(e){var t=e.type,i=e.initSegment,n=e.map,r=e.playlist;if(n){e=Hu(n);if(this.activeInitSegmentId_===e)return null;i=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=e}return i&&this.appendInitSegment_[t]?(this.playlistOfLastInitSegment_[t]=r,this.appendInitSegment_[t]=!1,this.activeInitSegmentId_=null,i):null},t.handleQuotaExceededError_=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes,s=this.sourceUpdater_.audioBuffered(),o=this.sourceUpdater_.videoBuffered();1<s.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ru(s).join(", ")),1<o.length&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ru(o).join(", "));var u=s.length?s.start(0):0,l=s.length?s.end(s.length-1):0,d=o.length?o.start(0):0,e=o.length?o.end(o.length-1):0;if(l-u<=1&&e-d<=1)return this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: "+a.byteLength+", audio buffer: "+ru(s).join(", ")+", video buffer: "+ru(o).join(", ")+", "),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),void this.trigger("error");this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:n,type:r,bytes:a}));a=this.currentTime_()-1;this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to "+a),this.remove(0,a,function(){i.logger_("On QUOTA_EXCEEDED_ERR, retrying append in 1s"),i.waitingOnRemove_=!1,i.quotaExceededErrorRetryTimeout_=window.setTimeout(function(){i.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),i.quotaExceededErrorRetryTimeout_=null,i.processCallQueue_()},1e3)},!0)},t.handleAppendError_=function(e,t){var i=e.segmentInfo,n=e.type,e=e.bytes;t&&(22!==t.code?(this.logger_("Received non QUOTA_EXCEEDED_ERR on append",t),this.error(n+" append of "+e.length+"b failed for segment #"+i.mediaIndex+" in playlist "+i.playlist.id),this.trigger("appenderror")):this.handleQuotaExceededError_({segmentInfo:i,type:n,bytes:e}))},t.appendToSourceBuffer_=function(e){var t,i,n=e.segmentInfo,r=e.type,a=e.initSegment,s=e.data,o=e.bytes;o||(e=[s],s=s.byteLength,a&&(e.unshift(a),s+=a.byteLength),i=0,(e={bytes:s,segments:e}).bytes&&(t=new Uint8Array(e.bytes),e.segments.forEach(function(e){t.set(e,i),i+=e.byteLength})),o=t),this.sourceUpdater_.appendBuffer({segmentInfo:n,type:r,bytes:o},this.handleAppendError_.bind(this,{segmentInfo:n,type:r,bytes:o}))},t.handleSegmentTimingInfo_=function(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)},t.appendData_=function(e,t){var i=t.type,n=t.data;n&&n.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:n})))},t.loadSegment_=function(t){var i=this;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(function(){var e=g({},t,{forceTimestampOffset:!0});g(t,i.generateSegmentInfo_(e)),i.isPendingTimestampOffset_=!1,i.updateTransmuxerAndRequestSegment_(t)})},t.updateTransmuxerAndRequestSegment_=function(n){var r=this;this.shouldUpdateTransmuxerTimestampOffset_(n.timestampOffset)&&(this.gopBuffer_.length=0,n.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:n.timestampOffset}));var e=this.createSimplifiedSegmentObj_(n),t=this.isEndOfStream_(n.mediaIndex,n.playlist,n.partIndex),i=null!==this.mediaIndex,a=n.timeline!==this.currentTimeline_&&0<n.timeline,a=t||i&&a;this.logger_("Requesting "+Il(n)),e.map&&!e.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),n.abortRequests=fl({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:e,abortFn:this.handleAbort_.bind(this,n),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",n.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",n.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:function(){r.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:function(e){var t=e.message,i=e.level,e=e.stream;r.logger_(Il(n)+" logged from transmuxer stream "+e+" as a "+i+": "+t)}})},t.trimBackBuffer_=function(e){var t,i,n,r,r=(t=this.seekable_(),i=this.currentTime_(),n=this.playlist_.targetDuration||10,r=i-Wl.BACK_BUFFER_LENGTH,t.length&&(r=Math.max(r,t.start(0))),Math.min(i-n,r));0<r&&this.remove(0,r)},t.createSimplifiedSegmentObj_=function(e){var t=e.segment,i=e.part,n={resolvedUri:(i||t).resolvedUri,byterange:(i||t).byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},i=e.playlist.segments[e.mediaIndex-1];return i&&i.timeline===t.timeline&&(i.videoTimingInfo?n.baseStartTime=i.videoTimingInfo.transmuxedDecodeEnd:i.audioTimingInfo&&(n.baseStartTime=i.audioTimingInfo.transmuxedDecodeEnd)),t.key&&(e=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]),n.key=this.segmentKey(t.key),n.key.iv=e),t.map&&(n.map=this.initSegmentForMap(t.map)),n},t.saveTransferStats_=function(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)},t.saveBandwidthRelatedStats_=function(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)},t.handleTimeout_=function(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")},t.segmentRequestFinished_=function(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===$l?void 0:(this.pause(),e.code===Ql?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_=function(e,t,i){if(!t.length)return e;if(i)return t.slice();for(var n=t[0].pts,r=0;r<e.length&&!(e[r].pts>=n);r++);return e.slice(0,r).concat(t)}(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(e)}},t.setTimeMapping_=function(e){e=this.syncController_.mappingForTimeline(e);null!==e&&(this.timeMapping_=e)},t.updateMediaSecondsLoaded_=function(e){"number"==typeof e.start&&"number"==typeof e.end?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration},t.shouldUpdateTransmuxerTimestampOffset_=function(e){return null!==e&&("main"===this.loaderType_&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset())},t.trueSegmentStart_=function(e){var t=e.currentStart,i=e.playlist,n=e.mediaIndex,r=e.firstVideoFrameTimeForData,a=e.currentVideoTimestampOffset,s=e.useVideoTimingInfo,o=e.videoTimingInfo,e=e.audioTimingInfo;if("undefined"!=typeof t)return t;if(!s)return e.start;i=i.segments[n-1];return 0!==n&&i&&"undefined"!=typeof i.start&&i.end===r+a?o.start:r},t.waitForAppendsToComplete_=function(e){var t=this.getCurrentMediaInfo_(e);if(!t)return this.error({message:"No starting media returned, likely due to an unsupported media format.",blacklistDuration:1/0}),void this.trigger("error");var i=t.hasAudio,n=t.hasVideo,t=t.isMuxed,n="main"===this.loaderType_&&n,t=!this.audioDisabled_&&i&&!t;if(e.waitingOnAppends=0,!e.hasAppendedData_)return e.timingInfo||"number"!=typeof e.timestampOffset||(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),void this.checkAppendsDone_(e);n&&e.waitingOnAppends++,t&&e.waitingOnAppends++,n&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),t&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))},t.checkAppendsDone_=function(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,0===e.waitingOnAppends&&this.handleAppendsDone_())},t.checkForIllegalMediaSwitch=function(e){var t,i,e=(t=this.loaderType_,i=this.getCurrentMediaInfo_(),e=e,"main"===t&&i&&e?e.hasAudio||e.hasVideo?i.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.":!i.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!!e&&(this.error({message:e,blacklistDuration:1/0}),this.trigger("error"),!0)},t.updateSourceBufferTimestampOffset_=function(e){var t;null===e.timestampOffset||"number"!=typeof e.timingInfo.start||e.changedTimestampOffset||"main"!==this.loaderType_||(t=!1,e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset"))},t.getSegmentStartTimeForTimestampOffsetCalculation_=function(e){var t=e.videoTimingInfo,i=e.audioTimingInfo,e=e.timingInfo;return this.useDtsForTimestampOffset_?t&&"number"==typeof t.transmuxedDecodeStart?t.transmuxedDecodeStart:i&&"number"==typeof i.transmuxedDecodeStart?i.transmuxedDecodeStart:e.start:e.start},t.updateTimingInfoEnd_=function(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)},t.handleAppendsDone_=function(){if(this.pendingSegment_&&this.trigger("appendsdone"),!this.pendingSegment_)return this.state="READY",void(this.paused()||this.monitorBuffer_());var e=this.pendingSegment_;this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:"main"===this.loaderType_});var t=Ll(e,this.sourceType_);if(t&&("warn"===t.severity?ir.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_("Appended "+Il(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");var i=e.segment,t=e.part,i=i.end&&this.currentTime_()-i.end>3*e.playlist.targetDuration,t=t&&t.end&&this.currentTime_()-t.end>3*e.playlist.partTargetDuration;if(i||t)return this.logger_("bad "+(i?"segment":"part")+" "+Il(e)),void 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_()}else this.logger_("Throwing away un-appended sync request "+Il(e))},t.recordThroughput_=function(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,i=Math.floor(e.byteLength/i*8*1e3),this.throughput.rate+=(i-t)/++this.throughput.count)},t.addSegmentMetadataCue_=function(e){var t,i,n,r;this.segmentMetadataTrack_&&(i=(t=e.segment).start,r=t.end,Cl(i)&&Cl(r)&&(kl(i,r,this.segmentMetadataTrack_),n=window.WebKitDataCue||window.VTTCue,e={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.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:i,end:r},(r=new n(i,r,JSON.stringify(e))).value=e,this.segmentMetadataTrack_.addCue(r)))},e}(ir.EventTarget);function td(){}function id(e){return"string"!=typeof e?e:e.replace(/./,function(e){return e.toUpperCase()})}function nd(e,t){var i=t[e+"Buffer"];return i&&i.updating||t.queuePending[e]}function rd(e,t){if(0!==t.queue.length){var i=0,n=t.queue[i];if("mediaSource"!==n.type){if("mediaSource"!==e&&t.ready()&&"closed"!==t.mediaSource.readyState&&!nd(e,t)){if(n.type!==e){if(null===(i=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];if("mediaSource"===n.type)return null;if(n.type===e)return i}return null}(e,t.queue)))return;n=t.queue[i]}t.queue.splice(i,1),(t.queuePending[e]=n).action(e,t),n.doneFn||(t.queuePending[e]=null,rd(e,t))}}else t.updating()||"closed"===t.mediaSource.readyState||(t.queue.shift(),n.action(t),n.doneFn&&n.doneFn(),rd("audio",t),rd("video",t))}}function ad(e,t){var i=t[e+"Buffer"],n=id(e);i&&(i.removeEventListener("updateend",t["on"+n+"UpdateEnd_"]),i.removeEventListener("error",t["on"+n+"Error_"]),t.codecs[e]=null,t[e+"Buffer"]=null)}function sd(e,t){return e&&t&&-1!==Array.prototype.indexOf.call(e.sourceBuffers,t)}function od(e){var t=e.type,i=e.sourceUpdater,n=e.action,r=e.doneFn,e=e.name;i.queue.push({type:t,action:n,doneFn:r,name:e}),rd(t,i)}function ud(i,n){return function(e){var t;n.queuePending[i]&&(t=n.queuePending[i].doneFn,n.queuePending[i]=null,t&&t(n[i+"Error_"])),rd(i,n)}}function ld(e){return decodeURIComponent(escape(String.fromCharCode.apply(null,e)))}function dd(e,t){e.abort(),e.pause(),t&&t.activePlaylistLoader&&(t.activePlaylistLoader.pause(),t.activePlaylistLoader=null)}function cd(e,t){(t.activePlaylistLoader=e).load()}function hd(e,t){for(var i=0;i<e.length;i++){if(Tu(t,e[i]))return!0;if(e[i].playlists&&hd(e[i].playlists,t))return!0}return!1}function pd(a){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){Bd[e](e,a)});var e,s=a.mediaTypes,t=a.masterPlaylistLoader,i=a.tech,n=a.vhs,r=a.segmentLoaders,o=r.AUDIO,u=r.main;function l(){s.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"}),i.trigger({type:"usage",name:"hls-audio-change"})}for(e in["AUDIO","SUBTITLES"].forEach(function(e){var u,l,o,d,t,i,c,h,n,r;s[e].activeGroup=(u=e,l=a,function(t){var e=l.masterPlaylistLoader,i=l.mediaTypes[u].groups,n=e.media();if(!n)return null;var r=null;n.attributes[u]&&(r=i[n.attributes[u]]);var a=Object.keys(i);if(!r)if("AUDIO"===u&&1<a.length&&Su(l.master))for(var s=0;s<a.length;s++){var o=i[a[s]];if(hd(o,n)){r=o;break}}else i.main?r=i.main:1===a.length&&(r=i[a[0]]);return"undefined"==typeof t?r:null!==t&&r&&r.filter(function(e){return e.id===t.id})[0]||null}),s[e].activeTrack=Fd[e](e,a),s[e].onGroupChanged=(o=e,d=a,function(){var e=d.segmentLoaders,t=e[o],i=e.main,n=d.mediaTypes[o],r=n.activeTrack(),a=n.getActiveGroup(),s=n.activePlaylistLoader,e=n.lastGroup_;a&&e&&a.id===e.id||(n.lastGroup_=a,n.lastTrack_=r,dd(t,n),a&&!a.isMasterPlaylist&&(a.playlistLoader?(t.resyncLoader(),cd(a.playlistLoader,n)):s&&i.resetEverything()))}),s[e].onGroupChanging=(t=e,i=a,function(){var e=i.segmentLoaders[t];i.mediaTypes[t].lastGroup_=null,e.abort(),e.pause()}),s[e].onTrackChanged=(c=e,h=a,function(){var e=h.masterPlaylistLoader,t=h.segmentLoaders,i=t[c],n=t.main,r=h.mediaTypes[c],a=r.activeTrack(),s=r.getActiveGroup(),o=r.activePlaylistLoader,u=r.lastTrack_;if((!u||!a||u.id!==a.id)&&(r.lastGroup_=s,r.lastTrack_=a,dd(i,r),s)){if(s.isMasterPlaylist){if(!a||!u||a.id===u.id)return;var l=h.vhs.masterPlaylistController_,t=l.selectPlaylist();return l.media()===t?void 0:(r.logger_("track change. Switching master audio from "+u.id+" to "+a.id),e.pause(),n.resetEverything(),void l.fastQualityChange_(t))}if("AUDIO"===c){if(!s.playlistLoader)return n.setAudio(!0),void n.resetEverything();i.setAudio(!0),n.setAudio(!1)}o!==s.playlistLoader&&(i.track&&i.track(a),i.resetEverything()),cd(s.playlistLoader,r)}}),s[e].getActiveGroup=(n=e,r=a.mediaTypes,function(){var e=r[n].activeTrack();return e?r[n].activeGroup(e):null})}),(r=s.AUDIO.activeGroup())&&(r=(r.filter(function(e){return e.default})[0]||r[0]).id,s.AUDIO.tracks[r].enabled=!0,s.AUDIO.onGroupChanged(),s.AUDIO.onTrackChanged(),s.AUDIO.getActiveGroup().playlistLoader?(u.setAudio(!1),o.setAudio(!0)):u.setAudio(!0)),t.on("mediachange",function(){["AUDIO","SUBTITLES"].forEach(function(e){return s[e].onGroupChanged()})}),t.on("mediachanging",function(){["AUDIO","SUBTITLES"].forEach(function(e){return s[e].onGroupChanging()})}),i.audioTracks().addEventListener("change",l),i.remoteTextTracks().addEventListener("change",s.SUBTITLES.onTrackChanged),n.on("dispose",function(){i.audioTracks().removeEventListener("change",l),i.remoteTextTracks().removeEventListener("change",s.SUBTITLES.onTrackChanged)}),i.clearTracks("audio"),s.AUDIO.tracks)i.audioTracks().addTrack(s.AUDIO.tracks[e])}function fd(e,t,i){var n,r,a,s,o=e.masterPlaylistController_,u=o[(e.options_.smoothQualityChange?"smooth":"fast")+"QualityChange_"].bind(o);t.attributes&&(n=t.attributes.RESOLUTION,this.width=n&&n.width,this.height=n&&n.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]),this.codecs=vl(o.master(),t),this.playlist=t,this.id=i,this.enabled=(r=e.playlists,a=t.id,s=u,function(e){var t=r.master.playlists[a],i=yu(t),n=vu(t);return"undefined"==typeof e?n:(e?delete t.disabled:t.disabled=!0,e===n||i||(s(),e?r.trigger("renditionenabled"):r.trigger("renditiondisabled")),e)})}function md(t,e){var i=0,n=0,r=ir.mergeOptions(Wd,e);function a(){n&&t.currentTime(n)}function s(e){null!=e&&(n=t.duration()!==1/0&&t.currentTime()||0,t.one("loadedmetadata",a),t.src(e),t.trigger({type:"usage",name:"vhs-error-reload"}),t.trigger({type:"usage",name:"hls-error-reload"}),t.play())}function o(){return Date.now()-i<1e3*r.errorInterval?(t.trigger({type:"usage",name:"vhs-error-reload-canceled"}),void t.trigger({type:"usage",name:"hls-error-reload-canceled"})):r.getSource&&"function"==typeof r.getSource?(i=Date.now(),r.getSource.call(t,s)):void ir.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!")}function u(){t.off("loadedmetadata",a),t.off("error",o),t.off("dispose",u)}t.ready(function(){t.trigger({type:"usage",name:"vhs-error-reload-initialized"}),t.trigger({type:"usage",name:"hls-error-reload-initialized"})}),t.on("error",o),t.on("dispose",u),t.reloadSourceOnError=function(e){u(),md(t,e)}}var gd,yd=["video","audio"],vd=function(n,r,a){return function(t,i){var e=i[t+"Buffer"];if(sd(i.mediaSource,e)){i.logger_("Appending segment "+r.mediaIndex+"'s "+n.length+" bytes to "+t+"Buffer");try{e.appendBuffer(n)}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,a(e)}}}},_d=function(n,r){return function(t,i){var e=i[t+"Buffer"];if(sd(i.mediaSource,e)){i.logger_("Removing "+n+" to "+r+" from "+t+"Buffer");try{e.remove(n,r)}catch(e){i.logger_("Remove "+n+" to "+r+" from "+t+"Buffer failed")}}}},bd=function(n){return function(e,t){var i=t[e+"Buffer"];sd(t.mediaSource,i)&&(t.logger_("Setting "+e+"timestampOffset to "+n),i.timestampOffset=n)}},Td=function(i){return function(e,t){i()}},wd=function(t){return function(e){if("open"===e.mediaSource.readyState){e.logger_("Calling mediaSource endOfStream("+(t||"")+")");try{e.mediaSource.endOfStream(t)}catch(e){ir.log.warn("Failed to call media source endOfStream",e)}}}},Sd=function(t){return function(e){e.logger_("Setting mediaSource duration to "+t);try{e.mediaSource.duration=t}catch(e){ir.log.warn("Failed to set media source duration",e)}}},Ed=function(){return function(t,e){if("open"===e.mediaSource.readyState){var i=e[t+"Buffer"];if(sd(e.mediaSource,i)){e.logger_("calling abort on "+t+"Buffer");try{i.abort()}catch(e){ir.log.warn("Failed to abort on "+t+"Buffer",e)}}}}},kd=function(n,r){return function(e){var t=id(n),i=fr(r);e.logger_("Adding "+n+"Buffer with codec "+r+" to mediaSource");i=e.mediaSource.addSourceBuffer(i);i.addEventListener("updateend",e["on"+t+"UpdateEnd_"]),i.addEventListener("error",e["on"+t+"Error_"]),e.codecs[n]=r,e[n+"Buffer"]=i}},Cd=function(i){return function(e){var t=e[i+"Buffer"];if(ad(i,e),sd(e.mediaSource,t)){e.logger_("Removing "+i+"Buffer with codec "+e.codecs[i]+" from mediaSource");try{e.mediaSource.removeSourceBuffer(t)}catch(e){ir.log.warn("Failed to removeSourceBuffer "+i+"Buffer",e)}}}},Id=function(r){return function(t,e){var i=e[t+"Buffer"],n=fr(r);if(sd(e.mediaSource,i)&&e.codecs[t]!==r){e.logger_("changing "+t+"Buffer codec from "+e.codecs[t]+" to "+r);try{i.changeType(n),e.codecs[t]=r}catch(e){ir.log.warn("Failed to changeType on "+t+"Buffer",e)}}}},xd=function(i){function e(e){var t=i.call(this)||this;return t.mediaSource=e,t.sourceopenListener_=function(){return rd("mediaSource",ft(t))},t.mediaSource.addEventListener("sourceopen",t.sourceopenListener_),t.logger_=Zo("SourceUpdater"),t.audioTimestampOffset_=0,t.videoTimestampOffset_=0,t.queue=[],t.queuePending={audio:null,video:null},t.delayedAudioAppendQueue_=[],t.videoAppendQueued_=!1,t.codecs={},t.onVideoUpdateEnd_=ud("video",ft(t)),t.onAudioUpdateEnd_=ud("audio",ft(t)),t.onVideoError_=function(e){t.videoError_=e},t.onAudioError_=function(e){t.audioError_=e},t.createdSourceBuffers_=!1,t.initializedEme_=!1,t.triggeredReady_=!1,t}mt(e,i);var t=e.prototype;return t.initializedEme=function(){this.initializedEme_=!0,this.triggerReady()},t.hasCreatedSourceBuffers=function(){return this.createdSourceBuffers_},t.hasInitializedAnyEme=function(){return this.initializedEme_},t.ready=function(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()},t.createSourceBuffers=function(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())},t.triggerReady=function(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))},t.addSourceBuffer=function(e,t){od({type:"mediaSource",sourceUpdater:this,action:kd(e,t),name:"addSourceBuffer"})},t.abort=function(e){od({type:e,sourceUpdater:this,action:Ed(e),name:"abort"})},t.removeSourceBuffer=function(e){this.canRemoveSourceBuffer()?od({type:"mediaSource",sourceUpdater:this,action:Cd(e),name:"removeSourceBuffer"}):ir.log.error("removeSourceBuffer is not supported!")},t.canRemoveSourceBuffer=function(){return!ir.browser.IE_VERSION&&!ir.browser.IS_FIREFOX&&window.MediaSource&&window.MediaSource.prototype&&"function"==typeof window.MediaSource.prototype.removeSourceBuffer},e.canChangeType=function(){return window.SourceBuffer&&window.SourceBuffer.prototype&&"function"==typeof window.SourceBuffer.prototype.changeType},t.canChangeType=function(){return this.constructor.canChangeType()},t.changeType=function(e,t){this.canChangeType()?od({type:e,sourceUpdater:this,action:Id(t),name:"changeType"}):ir.log.error("changeType is not supported!")},t.addOrChangeSourceBuffers=function(i){var n=this;if(!i||"object"!=typeof i||0===Object.keys(i).length)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(i).forEach(function(e){var t=i[e];if(!n.hasCreatedSourceBuffers())return n.addSourceBuffer(e,t);n.canChangeType()&&n.changeType(e,t)})},t.appendBuffer=function(e,t){var i=this,n=e.segmentInfo,r=e.type,a=e.bytes;if(this.processedAppend_=!0,"audio"===r&&this.videoBuffer&&!this.videoAppendQueued_)return this.delayedAudioAppendQueue_.push([e,t]),void this.logger_("delayed audio append of "+a.length+" until video append");od({type:r,sourceUpdater:this,action:vd(a,n||{mediaIndex:-1},t),doneFn:t,name:"appendBuffer"}),"video"===r&&(this.videoAppendQueued_=!0,this.delayedAudioAppendQueue_.length&&(r=this.delayedAudioAppendQueue_.slice(),this.logger_("queuing delayed audio "+r.length+" appendBuffers"),this.delayedAudioAppendQueue_.length=0,r.forEach(function(e){i.appendBuffer.apply(i,e)})))},t.audioBuffered=function(){return sd(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered||ir.createTimeRange()},t.videoBuffered=function(){return sd(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered||ir.createTimeRange()},t.buffered=function(){var e=sd(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=sd(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():function(e,t){var i=null,n=null,r=0,a=[],s=[];if(!(e&&e.length&&t&&t.length))return ir.createTimeRange();for(var o=e.length;o--;)a.push({time:e.start(o),type:"start"}),a.push({time:e.end(o),type:"end"});for(o=t.length;o--;)a.push({time:t.start(o),type:"start"}),a.push({time:t.end(o),type:"end"});for(a.sort(function(e,t){return e.time-t.time}),o=0;o<a.length;o++)"start"===a[o].type?2===++r&&(i=a[o].time):"end"===a[o].type&&1===--r&&(n=a[o].time),null!==i&&null!==n&&(s.push([i,n]),n=i=null);return ir.createTimeRanges(s)}(this.audioBuffered(),this.videoBuffered())},t.setDuration=function(e,t){void 0===t&&(t=td),od({type:"mediaSource",sourceUpdater:this,action:Sd(e),name:"duration",doneFn:t})},t.endOfStream=function(e,t){void 0===t&&(t=td),od({type:"mediaSource",sourceUpdater:this,action:wd(e="string"!=typeof(e=void 0===e?null:e)?void 0:e),name:"endOfStream",doneFn:t})},t.removeAudio=function(e,t,i){void 0===i&&(i=td),this.audioBuffered().length&&0!==this.audioBuffered().end(0)?od({type:"audio",sourceUpdater:this,action:_d(e,t),doneFn:i,name:"remove"}):i()},t.removeVideo=function(e,t,i){void 0===i&&(i=td),this.videoBuffered().length&&0!==this.videoBuffered().end(0)?od({type:"video",sourceUpdater:this,action:_d(e,t),doneFn:i,name:"remove"}):i()},t.updating=function(){return!(!nd("audio",this)&&!nd("video",this))},t.audioTimestampOffset=function(e){return"undefined"!=typeof e&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(od({type:"audio",sourceUpdater:this,action:bd(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_},t.videoTimestampOffset=function(e){return"undefined"!=typeof e&&this.videoBuffer&&this.videoTimestampOffset!==e&&(od({type:"video",sourceUpdater:this,action:bd(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_},t.audioQueueCallback=function(e){this.audioBuffer&&od({type:"audio",sourceUpdater:this,action:Td(e),name:"callback"})},t.videoQueueCallback=function(e){this.videoBuffer&&od({type:"video",sourceUpdater:this,action:Td(e),name:"callback"})},t.dispose=function(){var t=this;this.trigger("dispose"),yd.forEach(function(e){t.abort(e),t.canRemoveSourceBuffer()?t.removeSourceBuffer(e):t[e+"QueueCallback"](function(){return ad(e,t)})}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()},e}(ir.EventTarget),Ad=new Uint8Array("\n\n".split("").map(function(e){return e.charCodeAt(0)})),Pd=function(e){function t(){return e.call(this,"Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")||this}return mt(t,e),t}(W(Error)),Ld=function(i){function e(e,t){return(t=i.call(this,e,t=void 0===t?{}:t)||this).mediaSource_=null,t.subtitlesTrack_=null,t.loaderType_="subtitle",t.featuresNativeTextTracks_=e.featuresNativeTextTracks,t.loadVttJs=e.loadVttJs,t.shouldSaveSegmentTimingInfo_=!1,t}mt(e,i);var t=e.prototype;return t.createTransmuxer_=function(){return null},t.buffered_=function(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return ir.createTimeRanges();var e=this.subtitlesTrack_.cues,t=e[0].startTime,e=e[e.length-1].startTime;return ir.createTimeRanges([[t,e]])},t.initSegmentForMap=function(e,t){if(void 0===t&&(t=!1),!e)return null;var i=Hu(e),n=this.initSegments_[i];return t&&!n&&e.bytes&&(t=Ad.byteLength+e.bytes.byteLength,(t=new Uint8Array(t)).set(e.bytes),t.set(Ad,e.bytes.byteLength),this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:t}),n||e},t.couldBeginLoading_=function(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()},t.init_=function(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()},t.track=function(e){return"undefined"==typeof e||(this.subtitlesTrack_=e,"INIT"===this.state&&this.couldBeginLoading_()&&this.init_()),this.subtitlesTrack_},t.remove=function(e,t){kl(e,t,this.subtitlesTrack_)},t.fillBuffer_=function(){var e=this,t=this.chooseNextRequest_();if(t){if(null===this.syncController_.timestampOffsetForTimeline(t.timeline))return this.syncController_.one("timestampoffset",function(){e.state="READY",e.paused()||e.monitorBuffer_()}),void(this.state="WAITING_ON_TIMELINE");this.loadSegment_(t)}},t.timestampOffsetForSegment_=function(){return null},t.chooseNextRequest_=function(){return this.skipEmptySegments_(i.prototype.chooseNextRequest_.call(this))},t.skipEmptySegments_=function(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},t.stopForError=function(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")},t.segmentRequestFinished_=function(e,t,i){var n=this;if(this.subtitlesTrack_){if(this.saveTransferStats_(t.stats),!this.pendingSegment_)return this.state="READY",void(this.mediaRequestsAborted+=1);if(e)return e.code===Ql&&this.handleTimeout_(),e.code===$l?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,void this.stopForError(e);var r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");var a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,"function"!=typeof window.WebVTT&&"function"==typeof this.loadVttJs)return this.state="WAITING_ON_VTTJS",void this.loadVttJs().then(function(){return n.segmentRequestFinished_(e,t,i)},function(){return n.stopForError({message:"Error loading vtt.js"})});a.requested=!0;try{this.parseVTTCues_(r)}catch(e){return void this.stopForError({message:e.message})}if(this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest)return this.trigger("syncinfoupdate"),this.pendingSegment_=null,void(this.state="READY");r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach(function(e){n.subtitlesTrack_.addCue(n.featuresNativeTextTracks_?new window.VTTCue(e.startTime,e.endTime,e.text):e)}),function(t){var e=t.cues;if(e)for(var i=0;i<e.length;i++){for(var n=[],r=0,a=0;a<e.length;a++)e[i].startTime===e[a].startTime&&e[i].endTime===e[a].endTime&&e[i].text===e[a].text&&1<++r&&n.push(e[a]);n.length&&n.forEach(function(e){return t.removeCue(e)})}}(this.subtitlesTrack_),this.handleAppendsDone_()}else this.state="READY"},t.handleData_=function(){},t.updateTimingInfoEnd_=function(){},t.parseVTTCues_=function(t){var e=!1;if("function"!=typeof window.WebVTT)throw new Pd;"function"==typeof window.TextDecoder?i=new window.TextDecoder("utf8"):(i=window.WebVTT.StringDecoder(),e=!0);var i=new window.WebVTT.Parser(window,window.vttjs,i);t.cues=[],t.timestampmap={MPEGTS:0,LOCAL:0},i.oncue=t.cues.push.bind(t.cues),i.ontimestampmap=function(e){t.timestampmap=e},i.onparsingerror=function(e){ir.log.warn("Error encountered when parsing cues: "+e.message)},t.segment.map&&(n=t.segment.map.bytes,e&&(n=ld(n)),i.parse(n));var n=t.bytes;e&&(n=ld(n)),i.parse(n),i.flush()},t.updateTimeMapping_=function(e,t,i){var n,r,a=e.segment;t&&(e.cues.length?(r=e.timestampmap,n=r.MPEGTS/Qo-r.LOCAL+t.mapping,e.cues.forEach(function(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-a.duration)})):a.empty=!0)},e}(ed),Od=[{name:"VOD",run:function(e,t,i,n,r){if(i===1/0)return null;return{time:0,segmentIndex:0,partIndex:null}}},{name:"ProgramDateTime",run:function(e,t,i,n,r){if(!Object.keys(e.timelineToDatetimeMappings).length)return null;var a=null,s=null,o=uu(t);r=r||0;for(var u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],d=l.segment,c=e.timelineToDatetimeMappings[d.timeline];if(c&&d.dateTimeObject){var h=d.dateTimeObject.getTime()/1e3+c;if(d.parts&&"number"==typeof l.partIndex)for(var p=0;p<l.partIndex;p++)h+=d.parts[p].duration;c=Math.abs(r-h);if(null!==s&&(0===c||s<c))break;s=c,a={time:h,segmentIndex:l.segmentIndex,partIndex:l.partIndex}}}return a}},{name:"Segment",run:function(e,t,i,n,r){var a=null,s=null;r=r||0;for(var o=uu(t),u=0;u<o.length;u++){var l=o[t.endList||0===r?u:o.length-(u+1)],d=l.segment,c=l.part&&l.part.start||d&&d.start;if(d.timeline===n&&"undefined"!=typeof c){d=Math.abs(r-c);if(null!==s&&s<d)break;(!a||null===s||d<=s)&&(s=d,a={time:c,segmentIndex:l.segmentIndex,partIndex:l.partIndex})}}return a}},{name:"Discontinuity",run:function(e,t,i,n,r){var a=null;if(r=r||0,t.discontinuityStarts&&t.discontinuityStarts.length)for(var s=null,o=0;o<t.discontinuityStarts.length;o++){var u=t.discontinuityStarts[o],l=t.discontinuitySequence+o+1,d=e.discontinuities[l];if(d){l=Math.abs(r-d.time);if(null!==s&&s<l)break;(!a||null===s||l<=s)&&(s=l,a={time:d.time,segmentIndex:u,partIndex:null})}}return a}},{name:"Playlist",run:function(e,t,i,n,r){return t.syncInfo?{time:t.syncInfo.time,segmentIndex:t.syncInfo.mediaSequence-t.mediaSequence,partIndex:null}:null}}],Dd=function(i){function e(e){var t=i.call(this)||this;return t.timelines=[],t.discontinuities=[],t.timelineToDatetimeMappings={},t.logger_=Zo("SyncController"),t}mt(e,i);var t=e.prototype;return t.getSyncPoint=function(e,t,i,n){i=this.runStrategies_(e,t,i,n);return i.length?this.selectSyncPoint_(i,{key:"time",value:n}):null},t.getExpiredTime=function(e,t){if(!e||!e.segments)return null;t=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!t.length)return null;t=this.selectSyncPoint_(t,{key:"segmentIndex",value:0});return 0<t.segmentIndex&&(t.time*=-1),Math.abs(t.time+fu({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:t.segmentIndex,endIndex:0}))},t.runStrategies_=function(e,t,i,n){for(var r=[],a=0;a<Od.length;a++){var s=Od[a],o=s.run(this,e,t,i,n);o&&(o.strategy=s.name,r.push({strategy:s.name,syncPoint:o}))}return r},t.selectSyncPoint_=function(e,t){for(var i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy,a=1;a<e.length;a++){var s=Math.abs(e[a].syncPoint[t.key]-t.value);s<n&&(n=s,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_("syncPoint for ["+t.key+": "+t.value+"] chosen with strategy ["+r+"]: [time:"+i.time+", segmentIndex:"+i.segmentIndex+("number"==typeof i.partIndex?",partIndex:"+i.partIndex:"")+"]"),i},t.saveExpiredSegmentInfo=function(e,t){var i=t.mediaSequence-e.mediaSequence;if(86400<i)ir.log.warn("Not saving expired segment info. Media sequence gap "+i+" is too large.");else for(var n=i-1;0<=n;n--){var r=e.segments[n];if(r&&"undefined"!=typeof r.start){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_("playlist refresh sync: [time:"+t.syncInfo.time+", mediaSequence: "+t.syncInfo.mediaSequence+"]"),this.trigger("syncinfoupdate");break}}},t.setDateTimeMappingForStart=function(e){var t;this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject&&(e=(t=e.segments[0]).dateTimeObject.getTime()/1e3,this.timelineToDatetimeMappings[t.timeline]=-e)},t.saveSegmentTimingInfo=function(e){var t=e.segmentInfo,i=e.shouldSaveTimelineMapping,n=this.calculateSegmentTimeMapping_(t,t.timingInfo,i),e=t.segment;n&&(this.saveDiscontinuitySyncInfo_(t),t.playlist.syncInfo||(t.playlist.syncInfo={mediaSequence:t.playlist.mediaSequence+t.mediaIndex,time:e.start}));t=e.dateTimeObject;e.discontinuity&&i&&t&&(this.timelineToDatetimeMappings[e.timeline]=-t.getTime()/1e3)},t.timestampOffsetForTimeline=function(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].time},t.mappingForTimeline=function(e){return"undefined"==typeof this.timelines[e]?null:this.timelines[e].mapping},t.calculateSegmentTimeMapping_=function(e,t,i){var n,r,a=e.segment,s=e.part,o=this.timelines[e.timeline];if("number"==typeof e.timestampOffset)o={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=o,this.trigger("timestampoffset"),this.logger_("time mapping for timeline "+e.timeline+": [time: "+o.time+"] [mapping: "+o.mapping+"]")),n=e.startOfSegment,r=t.end+o.mapping;else{if(!o)return!1;n=t.start+o.mapping,r=t.end+o.mapping}return s&&(s.start=n,s.end=r),(!a.start||n<a.start)&&(a.start=n),a.end=r,!0},t.saveDiscontinuitySyncInfo_=function(e){var t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(var n=0;n<t.discontinuityStarts.length;n++){var r,a=t.discontinuityStarts[n],s=t.discontinuitySequence+n+1,o=a-e.mediaIndex,u=Math.abs(o);(!this.discontinuities[s]||this.discontinuities[s].accuracy>u)&&(r=void 0,r=o<0?i.start-fu({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:a}):i.end+fu({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:a}),this.discontinuities[s]={time:r,accuracy:u})}},t.dispose=function(){this.trigger("dispose"),this.off()},e}(ir.EventTarget),Rd=function(t){function e(){var e=t.call(this)||this;return e.pendingTimelineChanges_={},e.lastTimelineChanges_={},e}mt(e,t);var i=e.prototype;return i.clearPendingTimelineChange=function(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")},i.pendingTimelineChange=function(e){var t=e.type,i=e.from,e=e.to;return"number"==typeof i&&"number"==typeof e&&(this.pendingTimelineChanges_[t]={type:t,from:i,to:e},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[t]},i.lastTimelineChange=function(e){var t=e.type,i=e.from,e=e.to;return"number"==typeof i&&"number"==typeof e&&(this.lastTimelineChanges_[t]={type:t,from:i,to:e},delete this.pendingTimelineChanges_[t],this.trigger("timelinechange")),this.lastTimelineChanges_[t]},i.dispose=function(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()},e}(ir.EventTarget),Md=x(ar(Qr(function(){var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t,i){return e(i={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&i.path)}},i.exports),i.exports}var i=t(function(e){function n(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}e.exports=function(e,t,i){return t&&n(e.prototype,t),i&&n(e,i),e},e.exports.default=e.exports,e.exports.__esModule=!0}),n=t(function(i){function n(e,t){return i.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i.exports.default=i.exports,i.exports.__esModule=!0,n(e,t)}i.exports=n,i.exports.default=i.exports,i.exports.__esModule=!0}),r=t(function(e){e.exports=function(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,n(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0}),a=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;t=this.listeners[e].indexOf(t);return 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,n=0;n<i;++n)t[n].call(this,arguments[1]);else for(var r=Array.prototype.slice.call(arguments,1),a=t.length,s=0;s<a;++s)t[s].apply(this,r)},t.dispose=function(){this.listeners={}},t.pipe=function(t){this.on("data",function(e){t.push(e)})},e}();
/*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
var d=null,m=function(){function e(e){var t,i,n;d=d||function(){for(var e,t,i,n,r,a,s,o=[[[],[],[],[],[]],[[],[],[],[],[]]],u=o[0],l=o[1],d=u[4],c=l[4],h=[],p=[],f=0;f<256;f++)p[(h[f]=f<<1^283*(f>>7))^f]=f;for(e=t=0;!d[e];e^=i||1,t=p[t]||1)for(s=16843009*h[n=h[i=h[c[d[e]=r=(r=t^t<<1^t<<2^t<<3^t<<4)>>8^255&r^99]=e]]]^65537*n^257*i^16843008*e,a=257*h[r]^16843008*r,f=0;f<4;f++)u[f][e]=a=a<<24^a>>>8,l[f][r]=s=s<<24^s>>>8;for(f=0;f<5;f++)u[f]=u[f].slice(0),l[f]=l[f].slice(0);return o}(),this._tables=[[d[0][0].slice(),d[0][1].slice(),d[0][2].slice(),d[0][3].slice(),d[0][4].slice()],[d[1][0].slice(),d[1][1].slice(),d[1][2].slice(),d[1][3].slice(),d[1][4].slice()]];var r=this._tables[0][4],a=this._tables[1],s=e.length,o=1;if(4!==s&&6!==s&&8!==s)throw new Error("Invalid aes key size");var u=e.slice(0),l=[];for(this._key=[u,l],t=s;t<4*s+28;t++)n=u[t-1],(t%s==0||8===s&&t%s==4)&&(n=r[n>>>24]<<24^r[n>>16&255]<<16^r[n>>8&255]<<8^r[255&n],t%s==0&&(n=n<<8^n>>>24^o<<24,o=o<<1^283*(o>>7))),u[t]=u[t-s]^n;for(i=0;t;i++,t--)n=u[3&i?t:t-4],l[i]=t<=4||i<4?n:a[0][r[n>>>24]]^a[1][r[n>>16&255]]^a[2][r[n>>8&255]]^a[3][r[255&n]]}return e.prototype.decrypt=function(e,t,i,n,r,a){for(var s,o,u,l=this._key[1],d=e^l[0],c=n^l[1],h=i^l[2],p=t^l[3],f=l.length/4-2,m=4,t=this._tables[1],g=t[0],y=t[1],v=t[2],_=t[3],b=t[4],T=0;T<f;T++)s=g[d>>>24]^y[c>>16&255]^v[h>>8&255]^_[255&p]^l[m],o=g[c>>>24]^y[h>>16&255]^v[p>>8&255]^_[255&d]^l[m+1],u=g[h>>>24]^y[p>>16&255]^v[d>>8&255]^_[255&c]^l[m+2],p=g[p>>>24]^y[d>>16&255]^v[c>>8&255]^_[255&h]^l[m+3],m+=4,d=s,c=o,h=u;for(T=0;T<4;T++)r[(3&-T)+a]=b[d>>>24]<<24^b[c>>16&255]<<16^b[h>>8&255]<<8^b[255&p]^l[m++],s=d,d=c,c=h,h=p,p=s},e}(),l=function(t){function e(){var e=t.call(this,a)||this;return e.jobs=[],e.delay=1,e.timeout_=null,e}r(e,t);var i=e.prototype;return i.processJob_=function(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null},i.push=function(e){this.jobs.push(e),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))},e}(a),g=function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24},s=function(){function u(e,t,i,n){var r=u.STEP,a=new Int32Array(e.buffer),s=new Uint8Array(e.byteLength),o=0;for(this.asyncStream_=new l,this.asyncStream_.push(this.decryptChunk_(a.subarray(o,o+r),t,i,s)),o=r;o<a.length;o+=r)i=new Uint32Array([g(a[o-4]),g(a[o-3]),g(a[o-2]),g(a[o-1])]),this.asyncStream_.push(this.decryptChunk_(a.subarray(o,o+r),t,i,s));this.asyncStream_.push(function(){
/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
var e;n(null,(e=s).subarray(0,e.byteLength-e[e.byteLength-1]))})}return u.prototype.decryptChunk_=function(t,i,n,r){return function(){var e=function(e,t,i){for(var n,r,a,s,o=new Int32Array(e.buffer,e.byteOffset,e.byteLength>>2),u=new m(Array.prototype.slice.call(t)),e=new Uint8Array(e.byteLength),l=new Int32Array(e.buffer),d=i[0],c=i[1],h=i[2],p=i[3],f=0;f<o.length;f+=4)n=g(o[f]),r=g(o[f+1]),a=g(o[f+2]),s=g(o[f+3]),u.decrypt(n,r,a,s,l,f),l[f]=g(l[f]^d),l[f+1]=g(l[f+1]^c),l[f+2]=g(l[f+2]^h),l[f+3]=g(l[f+3]^p),d=n,c=r,h=a,p=s;return e}(t,i,n);r.set(e,t.byteOffset)}},i(u,null,[{key:"STEP",get:function(){return 32e3}}]),u}(),e="undefined"!=typeof window?window:"undefined"!=typeof e?e:"undefined"!=typeof self?self:{},e=e.BigInt||Number;e("0x1"),e("0x100"),e("0x10000"),e("0x1000000"),e("0x100000000"),e("0x10000000000"),e("0x1000000000000"),e("0x100000000000000"),e("0x10000000000000000");function o(n){var r={};return Object.keys(n).forEach(function(e){var t,i=n[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){var i=e.data,t=new Uint8Array(i.encrypted.bytes,i.encrypted.byteOffset,i.encrypted.byteLength),n=new Uint32Array(i.key.bytes,i.key.byteOffset,i.key.byteLength/4),e=new Uint32Array(i.iv.bytes,i.iv.byteOffset,i.iv.byteLength/4);new s(t,n,e,function(e,t){self.postMessage(o({source:i.source,decrypted:t}),[t.buffer])})}}))),Nd={AUDIO:function(s,o){return function(){var e=o.segmentLoaders[s],t=o.mediaTypes[s],i=o.blacklistCurrentPlaylist;dd(e,t);var n=t.activeTrack(),e=t.activeGroup(),e=(e.filter(function(e){return e.default})[0]||e[0]).id,r=t.tracks[e];if(n!==r){for(var a in ir.log.warn("Problem encountered loading the alternate audio track.Switching back to default."),t.tracks)t.tracks[a].enabled=t.tracks[a]===r;t.onTrackChanged()}else i({message:"Problem encountered loading the default audio track."})}},SUBTITLES:function(i,n){return function(){var e=n.segmentLoaders[i],t=n.mediaTypes[i];ir.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),dd(e,t);e=t.activeTrack();e&&(e.mode="disabled"),t.onTrackChanged()}}},Ud={AUDIO:function(e,t,i){var n,r,a;t&&(n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),n.paused()||a.load()}),t.on("error",Nd[e](e,i)))},SUBTITLES:function(e,t,i){var n=i.tech,r=i.requestOptions,a=i.segmentLoaders[e],s=i.mediaTypes[e];t.on("loadedmetadata",function(){var e=t.media();a.playlist(e,r),a.track(s.activeTrack()),(!n.paused()||e.endList&&"none"!==n.preload())&&a.load()}),t.on("loadedplaylist",function(){a.playlist(t.media(),r),n.paused()||a.load()}),t.on("error",Nd[e](e,i))}},Bd={AUDIO:function(e,t){var i,n,r=t.vhs,a=t.sourceType,s=t.segmentLoaders[e],o=t.requestOptions,u=t.master.mediaGroups,l=t.mediaTypes[e],d=l.groups,c=l.tracks,h=l.logger_,p=t.masterPlaylistLoader,f=Su(p.master);for(i in u[e]&&0!==Object.keys(u[e]).length||(u[e]={main:{default:{default:!0}}},f&&(u[e].main.default.playlists=p.master.playlists)),u[e])for(var m in d[i]||(d[i]=[]),u[e][i]){var g=u[e][i][m],y=void 0,y=f?(h("AUDIO group '"+i+"' label '"+m+"' is a master playlist"),g.isMasterPlaylist=!0,null):"vhs-json"===a&&g.playlists?new Fl(g.playlists[0],r,o):g.resolvedUri?new Fl(g.resolvedUri,r,o):g.playlists&&"dash"===a?new ql(g.playlists[0],r,o,p):null,g=ir.mergeOptions({id:m,playlistLoader:y},g);Ud[e](e,g.playlistLoader,t),d[i].push(g),"undefined"==typeof c[m]&&(g=new ir.AudioTrack({id:m,kind:(n=void 0,n=(y=g).default?"main":"alternative",n=y.characteristics&&0<=y.characteristics.indexOf("public.accessibility.describes-video")?"main-desc":n),enabled:!1,language:g.language,default:g.default,label:m}),c[m]=g)}s.on("error",Nd[e](e,t))},SUBTITLES:function(e,t){var i,n=t.tech,r=t.vhs,a=t.sourceType,s=t.segmentLoaders[e],o=t.requestOptions,u=t.master.mediaGroups,l=t.mediaTypes[e],d=l.groups,c=l.tracks,h=t.masterPlaylistLoader;for(i in u[e])for(var p in d[i]||(d[i]=[]),u[e][i])if(!u[e][i][p].forced){var f=u[e][i][p],m=void 0;if("hls"===a)m=new Fl(f.resolvedUri,r,o);else if("dash"===a){if(!f.playlists.filter(function(e){return e.excludeUntil!==1/0}).length)return;m=new ql(f.playlists[0],r,o,h)}else"vhs-json"===a&&(m=new Fl(f.playlists?f.playlists[0]:f.resolvedUri,r,o));f=ir.mergeOptions({id:p,playlistLoader:m},f),Ud[e](e,f.playlistLoader,t),d[i].push(f),"undefined"==typeof c[p]&&(f=n.addRemoteTextTrack({id:p,kind:"subtitles",default:f.default&&f.autoselect,language:f.language,label:p},!1).track,c[p]=f)}s.on("error",Nd[e](e,t))},"CLOSED-CAPTIONS":function(e,t){var i,n=t.tech,r=t.master.mediaGroups,t=t.mediaTypes[e],a=t.groups,s=t.tracks;for(i in r[e])for(var o in a[i]||(a[i]=[]),r[e][i]){var u,l,d=r[e][i][o];/^(?:CC|SERVICE)/.test(d.instreamId)&&(void 0===(l=(u=n.options_.vhs&&n.options_.vhs.captionServices||{})[(l={label:o,language:d.language,instreamId:d.instreamId,default:d.default&&d.autoselect}).instreamId]?ir.mergeOptions(l,u[l.instreamId]):l).default&&delete l.default,a[i].push(ir.mergeOptions({id:o},d)),"undefined"==typeof s[o]&&(l=n.addRemoteTextTrack({id:l.instreamId,kind:"captions",default:l.default,language:l.language,label:l.label},!1).track,s[o]=l))}}},Fd={AUDIO:function(i,n){return function(){var e,t=n.mediaTypes[i].tracks;for(e in t)if(t[e].enabled)return t[e];return null}},SUBTITLES:function(i,n){return function(){var e,t=n.mediaTypes[i].tracks;for(e in t)if("showing"===t[e].mode||"hidden"===t[e].mode)return t[e];return null}}},jd=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Hd=function(v){function e(e){var t=v.call(this)||this,i=e.src,n=e.handleManifestRedirects,r=e.withCredentials,a=e.tech,s=e.bandwidth,o=e.externVhs,u=e.useCueTags,l=e.blacklistDuration,d=e.enableLowInitialPlaylist,c=e.sourceType,h=e.cacheEncryptionKeys,p=e.experimentalBufferBasedABR,f=e.experimentalLeastPixelDiffSelector,m=e.captionServices;if(!i)throw new Error("A non-empty playlist URL or JSON manifest string is required");var g,y=e.maxPlaylistRetries;null!==y&&"undefined"!=typeof y||(y=1/0),gd=o,t.experimentalBufferBasedABR=Boolean(p),t.experimentalLeastPixelDiffSelector=Boolean(f),t.withCredentials=r,t.tech_=a,t.vhs_=a.vhs,t.sourceType_=c,t.useCueTags_=u,t.blacklistDuration=l,t.maxPlaylistRetries=y,t.enableLowInitialPlaylist=d,t.useCueTags_&&(t.cueTagsTrack_=t.tech_.addTextTrack("metadata","ad-cues"),t.cueTagsTrack_.inBandMetadataTrackDispatchType=""),t.requestOptions_={withCredentials:r,handleManifestRedirects:n,maxPlaylistRetries:y,timeout:null},t.on("error",t.pauseLoading),t.mediaTypes_=(g={},["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(function(e){g[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:td,activeTrack:td,getActiveGroup:td,onGroupChanged:td,onTrackChanged:td,lastTrack_:null,logger_:Zo("MediaGroups["+e+"]")}}),g),t.mediaSource=new window.MediaSource,t.handleDurationChange_=t.handleDurationChange_.bind(ft(t)),t.handleSourceOpen_=t.handleSourceOpen_.bind(ft(t)),t.handleSourceEnded_=t.handleSourceEnded_.bind(ft(t)),t.mediaSource.addEventListener("durationchange",t.handleDurationChange_),t.mediaSource.addEventListener("sourceopen",t.handleSourceOpen_),t.mediaSource.addEventListener("sourceended",t.handleSourceEnded_),t.seekable_=ir.createTimeRanges(),t.hasPlayed_=!1,t.syncController_=new Dd(e),t.segmentMetadataTrack_=a.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,t.decrypter_=new Md,t.sourceUpdater_=new xd(t.mediaSource),t.inbandTextTracks_={},t.timelineChangeController_=new Rd;h={vhs:t.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:m,mediaSource:t.mediaSource,currentTime:t.tech_.currentTime.bind(t.tech_),seekable:function(){return t.seekable()},seeking:function(){return t.tech_.seeking()},duration:function(){return t.duration()},hasPlayed:function(){return t.hasPlayed_},goalBufferLength:function(){return t.goalBufferLength()},bandwidth:s,syncController:t.syncController_,decrypter:t.decrypter_,sourceType:t.sourceType_,inbandTextTracks:t.inbandTextTracks_,cacheEncryptionKeys:h,sourceUpdater:t.sourceUpdater_,timelineChangeController:t.timelineChangeController_,experimentalExactManifestTimings:e.experimentalExactManifestTimings};t.masterPlaylistLoader_=new("dash"===t.sourceType_?ql:Fl)(i,t.vhs_,t.requestOptions_),t.setupMasterPlaylistLoaderListeners_(),t.mainSegmentLoader_=new ed(ir.mergeOptions(h,{segmentMetadataTrack:t.segmentMetadataTrack_,loaderType:"main"}),e),t.audioSegmentLoader_=new ed(ir.mergeOptions(h,{loaderType:"audio"}),e),t.subtitleSegmentLoader_=new Ld(ir.mergeOptions(h,{loaderType:"vtt",featuresNativeTextTracks:t.tech_.featuresNativeTextTracks,loadVttJs:function(){return new Promise(function(e,t){function i(){a.off("vttjserror",n),e()}function n(){a.off("vttjsloaded",i),t()}a.one("vttjsloaded",i),a.one("vttjserror",n),a.addWebVttScript_()})}}),e),t.setupSegmentLoaderListeners_(),t.experimentalBufferBasedABR&&(t.masterPlaylistLoader_.one("loadedplaylist",function(){return t.startABRTimer_()}),t.tech_.on("pause",function(){return t.stopABRTimer_()}),t.tech_.on("play",function(){return t.startABRTimer_()})),jd.forEach(function(e){t[e+"_"]=function(e){return this.audioSegmentLoader_[e]+this.mainSegmentLoader_[e]}.bind(ft(t),e)}),t.logger_=Zo("MPC"),t.triggeredFmp4Usage=!1,"none"===t.tech_.preload()?(t.loadOnPlay_=function(){t.loadOnPlay_=null,t.masterPlaylistLoader_.load()},t.tech_.one("play",t.loadOnPlay_)):t.masterPlaylistLoader_.load(),t.timeToLoadedData__=-1,t.mainAppendsToLoadedData__=-1,t.audioAppendsToLoadedData__=-1;e="none"===t.tech_.preload()?"play":"loadstart";return t.tech_.one(e,function(){var e=Date.now();t.tech_.one("loadeddata",function(){t.timeToLoadedData__=Date.now()-e,t.mainAppendsToLoadedData__=t.mainSegmentLoader_.mediaAppends,t.audioAppendsToLoadedData__=t.audioSegmentLoader_.mediaAppends})}),t}mt(e,v);var t=e.prototype;return t.mainAppendsToLoadedData_=function(){return this.mainAppendsToLoadedData__},t.audioAppendsToLoadedData_=function(){return this.audioAppendsToLoadedData__},t.appendsToLoadedData_=function(){var e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return-1===e||-1===t?-1:e+t},t.timeToLoadedData_=function(){return this.timeToLoadedData__},t.checkABR_=function(e){void 0===e&&(e="abr");var t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)},t.switchMedia_=function(e,t,i){var n=this.media(),r=n&&(n.id||n.uri),n=e.id||e.uri;r&&r!==n&&(this.logger_("switch media "+r+" -> "+n+" from "+t),this.tech_.trigger({type:"usage",name:"vhs-rendition-change-"+t})),this.masterPlaylistLoader_.media(e,i)},t.startABRTimer_=function(){var e=this;this.stopABRTimer_(),this.abrTimer_=window.setInterval(function(){return e.checkABR_()},250)},t.stopABRTimer_=function(){this.tech_.scrubbing&&this.tech_.scrubbing()||(window.clearInterval(this.abrTimer_),this.abrTimer_=null)},t.getAudioTrackPlaylists_=function(){var e=this.master(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;var i,n=e.mediaGroups.AUDIO,r=Object.keys(n);if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{var a,s=n.main||r.length&&n[r[0]];for(a in s)if(s[a].default){i={label:a};break}}if(!i)return t;var o,u=[];for(o in n)if(n[o][i.label]){var l=n[o][i.label];if(l.playlists&&l.playlists.length)u.push.apply(u,l.playlists);else if(l.uri)u.push(l);else if(e.playlists.length)for(var d=0;d<e.playlists.length;d++){var c=e.playlists[d];c.attributes&&c.attributes.AUDIO&&c.attributes.AUDIO===o&&u.push(c)}}return u.length?u:t},t.setupMasterPlaylistLoaderListeners_=function(){var i=this;this.masterPlaylistLoader_.on("loadedmetadata",function(){var e=i.masterPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;bu(i.masterPlaylistLoader_.master,i.masterPlaylistLoader_.media())?i.requestOptions_.timeout=0:i.requestOptions_.timeout=t,e.endList&&"none"!==i.tech_.preload()&&(i.mainSegmentLoader_.playlist(e,i.requestOptions_),i.mainSegmentLoader_.load()),pd({sourceType:i.sourceType_,segmentLoaders:{AUDIO:i.audioSegmentLoader_,SUBTITLES:i.subtitleSegmentLoader_,main:i.mainSegmentLoader_},tech:i.tech_,requestOptions:i.requestOptions_,masterPlaylistLoader:i.masterPlaylistLoader_,vhs:i.vhs_,master:i.master(),mediaTypes:i.mediaTypes_,blacklistCurrentPlaylist:i.blacklistCurrentPlaylist.bind(i)}),i.triggerPresenceUsage_(i.master(),e),i.setupFirstPlay(),!i.mediaTypes_.AUDIO.activePlaylistLoader||i.mediaTypes_.AUDIO.activePlaylistLoader.media()?i.trigger("selectedinitialmedia"):i.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",function(){i.trigger("selectedinitialmedia")})}),this.masterPlaylistLoader_.on("loadedplaylist",function(){i.loadOnPlay_&&i.tech_.off("play",i.loadOnPlay_);var e,t=i.masterPlaylistLoader_.media();if(!t){if(i.excludeUnsupportedVariants_(),!(e=(e=i.enableLowInitialPlaylist?i.selectInitialPlaylist():e)||i.selectPlaylist())||!i.shouldSwitchToMedia_(e))return;if(i.initialMedia_=e,i.switchMedia_(i.initialMedia_,"initial"),!("vhs-json"===i.sourceType_&&i.initialMedia_.segments))return;t=i.initialMedia_}i.handleUpdatedMediaPlaylist(t)}),this.masterPlaylistLoader_.on("error",function(){i.blacklistCurrentPlaylist(i.masterPlaylistLoader_.error)}),this.masterPlaylistLoader_.on("mediachanging",function(){i.mainSegmentLoader_.abort(),i.mainSegmentLoader_.pause()}),this.masterPlaylistLoader_.on("mediachange",function(){var e=i.masterPlaylistLoader_.media(),t=1.5*e.targetDuration*1e3;bu(i.masterPlaylistLoader_.master,i.masterPlaylistLoader_.media())?i.requestOptions_.timeout=0:i.requestOptions_.timeout=t,i.masterPlaylistLoader_.load(),i.mainSegmentLoader_.playlist(e,i.requestOptions_),i.mainSegmentLoader_.load(),i.tech_.trigger({type:"mediachange",bubbles:!0})}),this.masterPlaylistLoader_.on("playlistunchanged",function(){var e=i.masterPlaylistLoader_.media();"playlist-unchanged"!==e.lastExcludeReason_&&i.stuckAtPlaylistEnd_(e)&&(i.blacklistCurrentPlaylist({message:"Playlist no longer updating.",reason:"playlist-unchanged"}),i.tech_.trigger("playliststuck"))}),this.masterPlaylistLoader_.on("renditiondisabled",function(){i.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"}),i.tech_.trigger({type:"usage",name:"hls-rendition-disabled"})}),this.masterPlaylistLoader_.on("renditionenabled",function(){i.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"}),i.tech_.trigger({type:"usage",name:"hls-rendition-enabled"})})},t.handleUpdatedMediaPlaylist=function(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())},t.triggerPresenceUsage_=function(e,t){var i,n=e.mediaGroups||{},r=!0,e=Object.keys(n.AUDIO);for(i in n.AUDIO)for(var a in n.AUDIO[i])n.AUDIO[i][a].uri||(r=!1);r&&(this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),this.tech_.trigger({type:"usage",name:"hls-demuxed"})),Object.keys(n.SUBTITLES).length&&(this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),this.tech_.trigger({type:"usage",name:"hls-webvtt"})),gd.Playlist.isAes(t)&&(this.tech_.trigger({type:"usage",name:"vhs-aes"}),this.tech_.trigger({type:"usage",name:"hls-aes"})),e.length&&1<Object.keys(n.AUDIO[e[0]]).length&&(this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.tech_.trigger({type:"usage",name:"hls-alternate-audio"})),this.useCueTags_&&(this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"}),this.tech_.trigger({type:"usage",name:"hls-playlist-cue-tags"}))},t.shouldSwitchToMedia_=function(e){var t=this.masterPlaylistLoader_.media()||this.masterPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine();return function(e){var t=e.currentPlaylist,i=e.buffered,n=e.currentTime,r=e.nextPlaylist,a=e.bufferLowWaterLine,s=e.bufferHighWaterLine,o=e.duration,u=e.experimentalBufferBasedABR,l=e.log;if(!r)return ir.log.warn("We received no playlist to switch to. Please check your stream."),!1;var d="allowing switch "+(t&&t.id||"null")+" -> "+r.id;if(!t)return l(d+" as current playlist is not set"),!0;if(r.id===t.id)return!1;e=Boolean(tu(i,n).length);if(!t.endList)return e||"number"!=typeof t.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);i=su(i,n),n=u?Wl.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Wl.MAX_BUFFER_LOW_WATER_LINE;if(o<n)return l(d+" as duration < max low water line ("+o+" < "+n+")"),!0;n=r.attributes.BANDWIDTH,r=t.attributes.BANDWIDTH;if(n<r&&(!u||i<s)){t=d+" as next bandwidth < current bandwidth ("+n+" < "+r+")";return u&&(t+=" and forwardBuffer < bufferHighWaterLine ("+i+" < "+s+")"),l(t),!0}if((!u||r<n)&&a<=i){a=d+" as forwardBuffer >= bufferLowWaterLine ("+i+" >= "+a+")";return u&&(a+=" and next bandwidth > current bandwidth ("+n+" > "+r+")"),l(a),!0}return l("not "+d+" as no switching criteria met"),!1}({buffered:this.tech_.buffered(),currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),experimentalBufferBasedABR:this.experimentalBufferBasedABR,log:this.logger_})},t.setupSegmentLoaderListeners_=function(){var t=this;this.mainSegmentLoader_.on("bandwidthupdate",function(){t.checkABR_("bandwidthupdate"),t.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",function(){t.experimentalBufferBasedABR&&t.mainSegmentLoader_.load()}),this.experimentalBufferBasedABR||this.mainSegmentLoader_.on("progress",function(){t.trigger("progress")}),this.mainSegmentLoader_.on("error",function(){t.blacklistCurrentPlaylist(t.mainSegmentLoader_.error())}),this.mainSegmentLoader_.on("appenderror",function(){t.error=t.mainSegmentLoader_.error_,t.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",function(){t.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"}),t.tech_.trigger({type:"usage",name:"hls-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",function(){t.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",function(){t.error=t.audioSegmentLoader_.error_,t.trigger("error")}),this.mainSegmentLoader_.on("ended",function(){t.logger_("main segment loader ended"),t.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",function(e){t.experimentalBufferBasedABR||(t.delegateLoaders_("all",["abort"]),t.blacklistCurrentPlaylist({message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},120))});function e(){if(!t.sourceUpdater_.hasCreatedSourceBuffers())return t.tryToCreateSourceBuffers_();var e=t.getCodecsOrExclude_();e&&t.sourceUpdater_.addOrChangeSourceBuffers(e)}this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",function(){t.triggeredFmp4Usage||(t.tech_.trigger({type:"usage",name:"vhs-fmp4"}),t.tech_.trigger({type:"usage",name:"hls-fmp4"}),t.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",function(){t.triggeredFmp4Usage||(t.tech_.trigger({type:"usage",name:"vhs-fmp4"}),t.tech_.trigger({type:"usage",name:"hls-fmp4"}),t.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",function(){t.logger_("audioSegmentLoader ended"),t.onEndOfStream()})},t.mediaSecondsLoaded_=function(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)},t.load=function(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()},t.smoothQualityChange_=function(e){void 0===e&&(e=this.selectPlaylist()),this.fastQualityChange_(e)},t.fastQualityChange_=function(e){var t=this;(e=void 0===e?this.selectPlaylist():e)!==this.masterPlaylistLoader_.media()?(this.switchMedia_(e,"fast-quality"),this.mainSegmentLoader_.resetEverything(function(){ir.browser.IE_VERSION||ir.browser.IS_EDGE?t.tech_.setCurrentTime(t.tech_.currentTime()+.04):t.tech_.setCurrentTime(t.tech_.currentTime())})):this.logger_("skipping fastQualityChange because new media is same as old")},t.play=function(){if(!this.setupFirstPlay()){this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();var e=this.tech_.seekable();return this.tech_.duration()===1/0&&this.tech_.currentTime()<e.start(0)?this.tech_.setCurrentTime(e.end(e.length-1)):void 0}},t.setupFirstPlay=function(){var e=this,t=this.masterPlaylistLoader_.media();if(!t||this.tech_.paused()||this.hasPlayed_)return!1;if(!t.endList){var i=this.seekable();if(!i.length)return!1;if(ir.browser.IE_VERSION&&0===this.tech_.readyState())return this.tech_.one("loadedmetadata",function(){e.trigger("firstplay"),e.tech_.setCurrentTime(i.end(0)),e.hasPlayed_=!0}),!1;this.trigger("firstplay"),this.tech_.setCurrentTime(i.end(0))}return this.hasPlayed_=!0,this.load(),!0},t.handleSourceOpen_=function(){var e;this.tryToCreateSourceBuffers_(),!this.tech_.autoplay()||"undefined"!=typeof(e=this.tech_.play())&&"function"==typeof e.then&&e.then(null,function(e){}),this.trigger("sourceopen")},t.handleSourceEnded_=function(){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)},t.handleDurationChange_=function(){this.tech_.trigger("durationchange")},t.onEndOfStream=function(){var e,t=this.mainSegmentLoader_.ended_;(t=this.mediaTypes_.AUDIO.activePlaylistLoader?((e=this.mainSegmentLoader_.getCurrentMediaInfo_())&&!e.hasVideo||t)&&this.audioSegmentLoader_.ended_:t)&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())},t.stuckAtPlaylistEnd_=function(e){if(!this.seekable().length)return!1;var t=this.syncController_.getExpiredTime(e,this.duration());if(null===t)return!1;var i=gd.Playlist.playlistEnd(e,t),e=this.tech_.currentTime(),t=this.tech_.buffered();if(!t.length)return i-e<=.1;t=t.end(t.length-1);return t-e<=.1&&i-t<=.1},t.blacklistCurrentPlaylist=function(e,t){var i=(e=void 0===e?{}:e).playlist||this.masterPlaylistLoader_.media();if(t=t||e.blacklistDuration||this.blacklistDuration,!i)return this.error=e,void("open"!==this.mediaSource.readyState?this.trigger("error"):this.sourceUpdater_.endOfStream("network"));i.playlistErrors_++;var n,r=this.masterPlaylistLoader_.master.playlists,a=r.filter(vu),s=1===a.length&&a[0]===i;if(1===r.length&&t!==1/0)return ir.log.warn("Problem encountered with playlist "+i.id+". Trying again since it is the only playlist."),this.tech_.trigger("retryplaylist"),this.masterPlaylistLoader_.load(s);s&&(n=!1,r.forEach(function(e){var t;e===i||"undefined"!=typeof(t=e.excludeUntil)&&t!==1/0&&(n=!0,delete e.excludeUntil)}),n&&(ir.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))),a=i.playlistErrors_>this.maxPlaylistRetries?1/0:Date.now()+1e3*t,i.excludeUntil=a,e.reason&&(i.lastExcludeReason_=e.reason),this.tech_.trigger("blacklistplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-blacklisted"}),this.tech_.trigger({type:"usage",name:"hls-rendition-blacklisted"});r=this.selectPlaylist();if(!r)return this.error="Playback cannot continue. No available working or supported playlists.",void this.trigger("error");t=e.internal?this.logger_:ir.log.warn,a=e.message?" "+e.message:"";t((e.internal?"Internal problem":"Problem")+" encountered with playlist "+i.id+"."+a+" Switching to playlist "+r.id+"."),r.attributes.AUDIO!==i.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),r.attributes.SUBTITLES!==i.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);a=r.targetDuration/2*1e3||5e3,a="number"==typeof r.lastRequest&&Date.now()-r.lastRequest<=a;return this.switchMedia_(r,"exclude",s||a)},t.pauseLoading=function(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()},t.delegateLoaders_=function(i,e){var n=this,r=[],t="all"===i;!t&&"main"!==i||r.push(this.masterPlaylistLoader_);var a=[];!t&&"audio"!==i||a.push("AUDIO"),!t&&"subtitle"!==i||(a.push("CLOSED-CAPTIONS"),a.push("SUBTITLES")),a.forEach(function(e){e=n.mediaTypes_[e]&&n.mediaTypes_[e].activePlaylistLoader;e&&r.push(e)}),["main","audio","subtitle"].forEach(function(e){var t=n[e+"SegmentLoader_"];!t||i!==e&&"all"!==i||r.push(t)}),r.forEach(function(t){return e.forEach(function(e){"function"==typeof t[e]&&t[e]()})})},t.setCurrentTime=function(e){var t=tu(this.tech_.buffered(),e);return this.masterPlaylistLoader_&&this.masterPlaylistLoader_.media()&&this.masterPlaylistLoader_.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},t.duration=function(){if(!this.masterPlaylistLoader_)return 0;var e=this.masterPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:gd.Playlist.duration(e):1/0:0},t.seekable=function(){return this.seekable_},t.onSyncInfoUpdate_=function(){var e;if(this.masterPlaylistLoader_){var t=this.masterPlaylistLoader_.media();if(t){var i=this.syncController_.getExpiredTime(t,this.duration());if(null!==i){var n,r,a=this.masterPlaylistLoader_.master,s=gd.Playlist.seekable(t,i,gd.Playlist.liveEdgeDelay(a,t));if(0!==s.length){if(this.mediaTypes_.AUDIO.activePlaylistLoader){if(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),null===(i=this.syncController_.getExpiredTime(t,this.duration())))return;if(0===(e=gd.Playlist.seekable(t,i,gd.Playlist.liveEdgeDelay(a,t))).length)return}this.seekable_&&this.seekable_.length&&(n=this.seekable_.end(0),r=this.seekable_.start(0)),!e||e.start(0)>s.end(0)||s.start(0)>e.end(0)?this.seekable_=s:this.seekable_=ir.createTimeRanges([[(e.start(0)>s.start(0)?e:s).start(0),(e.end(0)<s.end(0)?e:s).end(0)]]),this.seekable_&&this.seekable_.length&&this.seekable_.end(0)===n&&this.seekable_.start(0)===r||(this.logger_("seekable updated ["+nu(this.seekable_)+"]"),this.tech_.trigger("seekablechanged"))}}}}},t.updateDuration=function(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),"open"!==this.mediaSource.readyState)return this.updateDuration_=this.updateDuration.bind(this,e),void this.mediaSource.addEventListener("sourceopen",this.updateDuration_);if(e){var t=this.seekable();return t.length?void((isNaN(this.mediaSource.duration)||this.mediaSource.duration<t.end(t.length-1))&&this.sourceUpdater_.setDuration(t.end(t.length-1))):void 0}e=this.tech_.buffered(),t=gd.Playlist.duration(this.masterPlaylistLoader_.media());0<e.length&&(t=Math.max(t,e.end(e.length-1))),this.mediaSource.duration!==t&&this.sourceUpdater_.setDuration(t)},t.dispose=function(){var n=this;this.trigger("dispose"),this.decrypter_.terminate(),this.masterPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(function(e){var t,i=n.mediaTypes_[e].groups;for(t in i)i[t].forEach(function(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()},t.master=function(){return this.masterPlaylistLoader_.master},t.media=function(){return this.masterPlaylistLoader_.media()||this.initialMedia_},t.areMediaTypesKnown_=function(){var e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),e=!e||!!this.audioSegmentLoader_.getCurrentMediaInfo_();return t&&e},t.getCodecsOrExclude_=function(){var n=this,r={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();r.video=r.main;var e=vl(this.master(),t),a={},i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(r.main.hasVideo&&(a.video=e.video||r.main.videoCodec||"avc1.4d400d"),r.main.isMuxed&&(a.video+=","+(e.audio||r.main.audioCodec||Lr)),(r.main.hasAudio&&!r.main.isMuxed||r.audio.hasAudio||i)&&(a.audio=e.audio||r.main.audioCodec||r.audio.audioCodec||Lr,r.audio.isFmp4=(r.main.hasAudio&&!r.main.isMuxed?r.main:r.audio).isFmp4),a.audio||a.video){var s,o,u={};if(["video","audio"].forEach(function(e){var t,i;a.hasOwnProperty(e)&&(t=r[e].isFmp4,i=a[e],!(t?mr:gr)(i))&&(i=r[e].isFmp4?"browser":"muxer",u[i]=u[i]||[],u[i].push(a[e]),"audio"===e&&(s=i))}),i&&s&&t.attributes.AUDIO&&(o=t.attributes.AUDIO,this.master().playlists.forEach(function(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): "'+a.audio+'"')),!Object.keys(u).length){if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){var l=[];if(["video","audio"].forEach(function(e){var t=(hr(n.sourceUpdater_.codecs[e]||"")[0]||{}).type,i=(hr(a[e]||"")[0]||{}).type;t&&i&&t.toLowerCase()!==i.toLowerCase()&&l.push('"'+n.sourceUpdater_.codecs[e]+'" -> "'+a[e]+'"')}),l.length)return void this.blacklistCurrentPlaylist({playlist:t,message:"Codec switching not supported: "+l.join(", ")+".",blacklistDuration:1/0,internal:!0})}return a}i=Object.keys(u).reduce(function(e,t){return e&&(e+=", "),e+=t+' does not support codec(s): "'+u[t].join(",")+'"'},"")+".";this.blacklistCurrentPlaylist({playlist:t,internal:!0,message:i,blacklistDuration:1/0})}else this.blacklistCurrentPlaylist({playlist:t,message:"Could not determine codecs for playlist.",blacklistDuration:1/0})},t.tryToCreateSourceBuffers_=function(){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))},t.excludeUnsupportedVariants_=function(){var n=this,r=this.master().playlists,a=[];Object.keys(r).forEach(function(e){var t,i=r[e];-1===a.indexOf(i.id)&&(a.push(i.id),t=[],!(e=vl(n.master,i)).audio||gr(e.audio)||mr(e.audio)||t.push("audio codec "+e.audio),!e.video||gr(e.video)||mr(e.video)||t.push("video codec "+e.video),e.text&&"stpp.ttml.im1t"===e.text&&t.push("text codec "+e.text),t.length&&(i.excludeUntil=1/0,n.logger_("excluding "+i.id+" for unsupported: "+t.join(", "))))})},t.excludeIncompatibleVariants_=function(e){var r=this,a=[],s=this.master().playlists,e=gl(hr(e)),o=yl(e),u=e.video&&hr(e.video)[0]||null,l=e.audio&&hr(e.audio)[0]||null;Object.keys(s).forEach(function(e){var t,i,n=s[e];-1===a.indexOf(n.id)&&n.excludeUntil!==1/0&&(a.push(n.id),t=[],i=vl(r.masterPlaylistLoader_.master,n),e=yl(i),(i.audio||i.video)&&(e!==o&&t.push('codec count "'+e+'" !== "'+o+'"'),r.sourceUpdater_.canChangeType()||(e=i.video&&hr(i.video)[0]||null,i=i.audio&&hr(i.audio)[0]||null,e&&u&&e.type.toLowerCase()!==u.type.toLowerCase()&&t.push('video codec "'+e.type+'" !== "'+u.type+'"'),i&&l&&i.type.toLowerCase()!==l.type.toLowerCase()&&t.push('audio codec "'+i.type+'" !== "'+l.type+'"')),t.length&&(n.excludeUntil=1/0,r.logger_("blacklisting "+n.id+": "+t.join(" && ")))))})},t.updateAdCues_=function(e){var t=0,i=this.seekable();i.length&&(t=i.start(0)),function(e,t,i){if(void 0===i&&(i=0),e.segments)for(var n=i,r=0;r<e.segments.length;r++){var a,s,o,u=e.segments[r];if(o=o||function(e,t){for(var i=e.cues,n=0;n<i.length;n++){var r=i[n];if(t>=r.adStartTime&&t<=r.adEndTime)return r}return null}(t,n+u.duration/2)){if("cueIn"in u){o.endTime=n,o.adEndTime=n,n+=u.duration,o=null;continue}if(n<o.endTime){n+=u.duration;continue}o.endTime+=u.duration}else"cueOut"in u&&((o=new window.VTTCue(n,n+u.duration,u.cueOut)).adStartTime=n,o.adEndTime=n+parseFloat(u.cueOut),t.addCue(o)),"cueOutCont"in u&&(a=(s=u.cueOutCont.split("/").map(parseFloat))[0],s=s[1],(o=new window.VTTCue(n,n+u.duration,"")).adStartTime=n-a,o.adEndTime=o.adStartTime+s,t.addCue(o));n+=u.duration}}(e,this.cueTagsTrack_,t)},t.goalBufferLength=function(){var e=this.tech_.currentTime(),t=Wl.GOAL_BUFFER_LENGTH,i=Wl.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,Wl.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)},t.bufferLowWaterLine=function(){var e=this.tech_.currentTime(),t=Wl.BUFFER_LOW_WATER_LINE,i=Wl.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,Wl.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,Wl.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.experimentalBufferBasedABR?r:n)},t.bufferHighWaterLine=function(){return Wl.BUFFER_HIGH_WATER_LINE},e}(ir.EventTarget),Vd=["seeking","seeked","pause","playing","error"],qd=function(){function e(e){var i=this;this.masterPlaylistController_=e.masterPlaylistController,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.timer_=null,this.checkCurrentTimeTimeout_=null,this.logger_=Zo("PlaybackWatcher"),this.logger_("initialize");function t(){return i.monitorCurrentTime_()}function n(){return i.monitorCurrentTime_()}function r(){return i.techWaiting_()}function a(){return i.cancelTimer_()}var s=this.masterPlaylistController_,o=["main","subtitle","audio"],u={};o.forEach(function(e){u[e]={reset:function(){return i.resetSegmentDownloads_(e)},updateend:function(){return i.checkSegmentDownloads_(e)}},s[e+"SegmentLoader_"].on("appendsdone",u[e].updateend),s[e+"SegmentLoader_"].on("playlistupdate",u[e].reset),i.tech_.on(["seeked","seeking"],u[e].reset)});function l(t){["main","audio"].forEach(function(e){s[e+"SegmentLoader_"][t]("appended",i.seekingAppendCheck_)})}this.seekingAppendCheck_=function(){i.fixesBadSeeks_()&&(i.consecutiveUpdates=0,i.lastRecordedTime=i.tech_.currentTime(),l("off"))},this.clearSeekingAppendCheck_=function(){return l("off")},this.watchForBadSeeking_=function(){i.clearSeekingAppendCheck_(),l("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Vd,a),this.tech_.on("canplay",n),this.tech_.one("play",t),this.dispose=function(){i.clearSeekingAppendCheck_(),i.logger_("dispose"),i.tech_.off("waiting",r),i.tech_.off(Vd,a),i.tech_.off("canplay",n),i.tech_.off("play",t),i.tech_.off("seeking",i.watchForBadSeeking_),i.tech_.off("seeked",i.clearSeekingAppendCheck_),o.forEach(function(e){s[e+"SegmentLoader_"].off("appendsdone",u[e].updateend),s[e+"SegmentLoader_"].off("playlistupdate",u[e].reset),i.tech_.off(["seeked","seeking"],u[e].reset)}),i.checkCurrentTimeTimeout_&&window.clearTimeout(i.checkCurrentTimeTimeout_),i.cancelTimer_()}}var t=e.prototype;return t.monitorCurrentTime_=function(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&window.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=window.setTimeout(this.monitorCurrentTime_.bind(this),250)},t.resetSegmentDownloads_=function(e){var t=this.masterPlaylistController_[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_()},t.checkSegmentDownloads_=function(e){var t=this.masterPlaylistController_,i=t[e+"SegmentLoader_"],n=i.buffered_(),r=function(e,t){if(e===t)return!1;if(!e&&t||!t&&e)return!0;if(e.length!==t.length)return!0;for(var i=0;i<e.length;i++)if(e.start(i)!==t.start(i)||e.end(i)!==t.end(i))return!0;return!1}(this[e+"Buffered_"],n);this[e+"Buffered_"]=n,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:ru(n)}),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.blacklistCurrentPlaylist({message:"Excessive "+e+" segment downloading detected."},1/0)))},t.checkCurrentTime_=function(){if(!this.tech_.paused()&&!this.tech_.seeking()){var e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+.1>=t.end(t.length-1)))return this.techWaiting_();5<=this.consecutiveUpdates&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}},t.cancelTimer_=function(){this.consecutiveUpdates=0,this.timer_&&(this.logger_("cancelTimer_"),clearTimeout(this.timer_)),this.timer_=null},t.fixesBadSeeks_=function(){if(!this.tech_.seeking())return!1;var e,t=this.seekable(),i=this.tech_.currentTime();if(this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow)&&(e=t.end(t.length-1)),"undefined"!=typeof(e=this.beforeSeekableWindow_(t,i)?(a=t.start(0))+(a===t.end(0)?0:.1):e))return this.logger_("Trying to seek outside of seekable at time "+i+" with seekable range "+nu(t)+". Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0;for(var n=this.masterPlaylistController_.sourceUpdater_,r=this.tech_.buffered(),a=n.audioBuffer?n.audioBuffered():null,t=n.videoBuffer?n.videoBuffered():null,n=this.media(),s=n.partTargetDuration||2*(n.targetDuration-Rl),o=[a,t],u=0;u<o.length;u++)if(o[u])if(su(o[u],i)<s)return!1;r=iu(r,i);return 0!==r.length&&(e=r.start(0)+.1,this.logger_("Buffered region starts ("+r.start(0)+")  just beyond seek point ("+i+"). Seeking to "+e+"."),this.tech_.setCurrentTime(e),!0)},t.waiting_=function(){var e,t;this.techWaiting_()||(e=this.tech_.currentTime(),t=this.tech_.buffered(),(t=tu(t,e)).length&&e+3<=t.end(0)&&(this.cancelTimer_(),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"}),this.tech_.trigger({type:"usage",name:"hls-unknown-waiting"})))},t.techWaiting_=function(){var e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking()||null!==this.timer_)return!0;if(this.beforeSeekableWindow_(e,t)){var i=e.end(e.length-1);return this.logger_("Fell out of live window at time "+t+". Seeking to live point (seekable end) "+i),this.cancelTimer_(),this.tech_.setCurrentTime(i),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),this.tech_.trigger({type:"usage",name:"hls-live-resync"}),!0}e=this.tech_.vhs.masterPlaylistController_.sourceUpdater_,i=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:e.audioBuffered(),videoBuffered:e.videoBuffered(),currentTime:t}))return this.cancelTimer_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),this.tech_.trigger({type:"usage",name:"hls-video-underflow"}),!0;e=iu(i,t);if(0<e.length){i=e.start(0)-t;return this.logger_("Stopped at "+t+", setting timer for "+i+", seeking to "+e.start(0)),this.cancelTimer_(),this.timer_=setTimeout(this.skipTheGap_.bind(this),1e3*i,t),!0}return!1},t.afterSeekableWindow_=function(e,t,i,n){if(void 0===n&&(n=!1),!e.length)return!1;var r=e.end(e.length-1)+.1;return(r=!i.endList&&n?e.end(e.length-1)+3*i.targetDuration:r)<t},t.beforeSeekableWindow_=function(e,t){return!!(e.length&&0<e.start(0)&&t<e.start(0)-this.liveRangeSafeTimeDelta)},t.videoUnderflow_=function(e){var t,i,n=e.videoBuffered,r=e.audioBuffered,a=e.currentTime;if(n)return n.length&&r.length?(i=tu(n,a-3),e=tu(n,a),(r=tu(r,a)).length&&!e.length&&i.length&&(t={start:i.end(0),end:r.end(0)})):iu(n,a).length||(t=this.gapFromVideoUnderflow_(n,a)),!!t&&(this.logger_("Encountered a gap in video from "+t.start+" to "+t.end+". Seeking to current time "+a),!0)},t.skipTheGap_=function(e){var t=this.tech_.buffered(),i=this.tech_.currentTime(),t=iu(t,i);this.cancelTimer_(),0!==t.length&&i===e&&(this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",t.start(0)),this.tech_.setCurrentTime(t.start(0)+Rl),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"}),this.tech_.trigger({type:"usage",name:"hls-gap-skip"}))},t.gapFromVideoUnderflow_=function(e,t){for(var i=function(e){if(e.length<2)return ir.createTimeRanges();for(var t=[],i=1;i<e.length;i++){var n=e.end(i-1),r=e.start(i);t.push([n,r])}return ir.createTimeRanges(t)}(e),n=0;n<i.length;n++){var r=i.start(n),a=i.end(n);if(t-r<4&&2<t-r)return{start:r,end:a}}return null},e}(),Wd={errorInterval:30,getSource:function(e){return e(this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource())}},Gd={PlaylistLoader:Fl,Playlist:Nl,utils:U,STANDARD_PLAYLIST_SELECTOR:zt,INITIAL_PLAYLIST_SELECTOR:function(){var t=this,e=this.playlists.master.playlists.filter(Nl.isEnabled);return Tl(e,wl),e.filter(function(e){return!!vl(t.playlists.master,e).video})[0]||null},lastBandwidthSelector:zt,movingAverageBandwidthSelector:function(t){var i=-1,n=-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,n=this.systemBandwidth),0<this.systemBandwidth&&this.systemBandwidth!==n&&(i=t*this.systemBandwidth+(1-t)*i,n=this.systemBandwidth),Sl(this.playlists.master,i,parseInt(bl(this.tech_.el(),"width"),10)*e,parseInt(bl(this.tech_.el(),"height"),10)*e,this.limitRenditionByPlayerDimensions,this.masterPlaylistController_)}},comparePlaylistBandwidth:wl,comparePlaylistResolution:function(e,t){var i,n;return(i=(i=e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width?e.attributes.RESOLUTION.width:i)||window.Number.MAX_VALUE)===(n=(n=t.attributes.RESOLUTION&&t.attributes.RESOLUTION.width?t.attributes.RESOLUTION.width:n)||window.Number.MAX_VALUE)&&e.attributes.BANDWIDTH&&t.attributes.BANDWIDTH?e.attributes.BANDWIDTH-t.attributes.BANDWIDTH:i-n},xhr:Nu()};Object.keys(Wl).forEach(function(t){Object.defineProperty(Gd,t,{get:function(){return ir.log.warn("using Vhs."+t+" is UNSAFE be sure you know what you are doing"),Wl[t]},set:function(e){ir.log.warn("using Vhs."+t+" is UNSAFE be sure you know what you are doing"),"number"!=typeof e||e<0?ir.log.warn("value of Vhs."+t+" must be greater than or equal to 0"):Wl[t]=e}})});function zd(e,t){for(var i=t.media(),n=-1,r=0;r<e.length;r++)if(e[r].id===i.id){n=r;break}e.selectedIndex_=n,e.trigger({selectedIndex:n,type:"change"})}var Xd="videojs-vhs";Gd.canPlaySource=function(){return ir.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};function Kd(e){var n=e.player,t=e.sourceKeySystems,i=e.audioMedia,e=e.mainPlaylists;if(!n.eme.initializeMediaKeys)return Promise.resolve();var r,e=(e=e=i?e.concat([i]):e,r=Object.keys(t),e.reduce(function(e,n){if(!n.contentProtection)return e;var t=r.reduce(function(e,t){var i=n.contentProtection[t];return i&&i.pssh&&(e[t]={pssh:i.pssh}),e},{});return Object.keys(t).length&&e.push(t),e},[])),a=[],s=[];return e.forEach(function(e){s.push(new Promise(function(e,t){n.tech_.one("keysessioncreated",e)})),a.push(new Promise(function(t,i){n.eme.initializeMediaKeys({keySystems:e},function(e){e?i(e):t()})}))}),Promise.race([Promise.all(a),Promise.race(s)])}function Yd(e){var t=e.player;return!!(e=function(e,t,i){if(!e)return e;var n={};t&&t.attributes&&t.attributes.CODECS&&(n=gl(hr(t.attributes.CODECS))),i&&i.attributes&&i.attributes.CODECS&&(n.audio=i.attributes.CODECS);var r,a=fr(n.video),s=fr(n.audio),o={};for(r in e)o[r]={},s&&(o[r].audioContentType=s),a&&(o[r].videoContentType=a),t.contentProtection&&t.contentProtection[r]&&t.contentProtection[r].pssh&&(o[r].pssh=t.contentProtection[r].pssh),"string"==typeof e[r]&&(o[r].url=e[r]);return ir.mergeOptions(e,o)}(e.sourceKeySystems,e.media,e.audioMedia))&&(!((t.currentSource().keySystems=e)&&!t.eme)||(ir.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1))}function Qd(){if(!window.localStorage)return null;var e=window.localStorage.getItem(Xd);if(!e)return null;try{return JSON.parse(e)}catch(e){return null}}Gd.supportsNativeHls=function(){if(!document||!document.createElement)return!1;var t=document.createElement("video");if(!ir.getTech("Html5").isSupported())return!1;return["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))})}(),Gd.supportsNativeDash=!!(document&&document.createElement&&ir.getTech("Html5").isSupported())&&/maybe|probably/i.test(document.createElement("video").canPlayType("application/dash+xml")),Gd.supportsTypeNatively=function(e){return"hls"===e?Gd.supportsNativeHls:"dash"===e&&Gd.supportsNativeDash},Gd.isSupported=function(){return ir.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.")};var $d=function(r){function e(e,t,i){var n=r.call(this,t,ir.mergeOptions(i.hls,i.vhs))||this;if(i.hls&&Object.keys(i.hls).length&&ir.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object."),"number"==typeof i.initialBandwidth&&(n.options_.bandwidth=i.initialBandwidth),n.logger_=Zo("VhsHandler"),t.options_&&t.options_.playerId&&((i=ir(t.options_.playerId)).hasOwnProperty("hls")||Object.defineProperty(i,"hls",{get:function(){return ir.log.warn("player.hls is deprecated. Use player.tech().vhs instead."),t.trigger({type:"usage",name:"hls-player-access"}),ft(n)},configurable:!0}),i.hasOwnProperty("vhs")||Object.defineProperty(i,"vhs",{get:function(){return ir.log.warn("player.vhs is deprecated. Use player.tech().vhs instead."),t.trigger({type:"usage",name:"vhs-player-access"}),ft(n)},configurable:!0}),i.hasOwnProperty("dash")||Object.defineProperty(i,"dash",{get:function(){return ir.log.warn("player.dash is deprecated. Use player.tech().vhs instead."),ft(n)},configurable:!0}),n.player_=i),n.tech_=t,n.source_=e,n.stats={},n.ignoreNextSeekingEvent_=!1,n.setOptions_(),n.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(n.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");return n.on(document,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],function(e){var t=document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;t&&t.contains(n.tech_.el())?n.masterPlaylistController_.fastQualityChange_():n.masterPlaylistController_.checkABR_()}),n.on(n.tech_,"seeking",function(){this.ignoreNextSeekingEvent_?this.ignoreNextSeekingEvent_=!1:this.setCurrentTime(this.tech_.currentTime())}),n.on(n.tech_,"error",function(){this.tech_.error()&&this.masterPlaylistController_&&this.masterPlaylistController_.pauseLoading()}),n.on(n.tech_,"play",n.play),n}mt(e,r);var t=e.prototype;return t.setOptions_=function(){var e,t=this;this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.handleManifestRedirects=!1!==this.options_.handleManifestRedirects,this.options_.limitRenditionByPlayerDimensions=!1!==this.options_.limitRenditionByPlayerDimensions,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.smoothQualityChange=this.options_.smoothQualityChange||!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,"number"!=typeof this.options_.blacklistDuration&&(this.options_.blacklistDuration=300),"number"!=typeof this.options_.bandwidth&&this.options_.useBandwidthFromLocalStorage&&((e=Qd())&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}),this.tech_.trigger({type:"usage",name:"hls-throughput-from-local-storage"}))),"number"!=typeof this.options_.bandwidth&&(this.options_.bandwidth=Wl.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Wl.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","smoothQualityChange","customTagParsers","customTagMappers","handleManifestRedirects","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","experimentalBufferBasedABR","liveRangeSafeTimeDelta","experimentalLLHLS","useNetworkInformationApi","useDtsForTimestampOffset","experimentalExactManifestTimings","experimentalLeastPixelDiffSelector"].forEach(function(e){"undefined"!=typeof t.source_[e]&&(t.options_[e]=t.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio},t.src=function(e,t){var n=this;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=Gd,this.options_.sourceType=yr(t),this.options_.seekTo=function(e){n.tech_.setCurrentTime(e)},this.options_.smoothQualityChange&&ir.log.warn("smoothQualityChange is deprecated and will be removed in the next major version"),this.masterPlaylistController_=new Hd(this.options_),t=ir.mergeOptions({liveRangeSafeTimeDelta:.1},this.options_,{seekable:function(){return n.seekable()},media:function(){return n.masterPlaylistController_.media()},masterPlaylistController:this.masterPlaylistController_}),this.playbackWatcher_=new qd(t),this.masterPlaylistController_.on("error",function(){var e=ir.players[n.tech_.options_.playerId],t=n.masterPlaylistController_.error;"object"!=typeof t||t.code?"string"==typeof t&&(t={message:t,code:3}):t.code=3,e.error(t)}),t=this.options_.experimentalBufferBasedABR?Gd.movingAverageBandwidthSelector(.55):Gd.STANDARD_PLAYLIST_SELECTOR,this.masterPlaylistController_.selectPlaylist=(this.selectPlaylist||t).bind(this),this.masterPlaylistController_.selectInitialPlaylist=Gd.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.masterPlaylistController_.masterPlaylistLoader_,this.mediaSource=this.masterPlaylistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get:function(){return this.masterPlaylistController_.selectPlaylist},set:function(e){this.masterPlaylistController_.selectPlaylist=e.bind(this)}},throughput:{get:function(){return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.throughput.rate=e,this.masterPlaylistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get:function(){var e=this.masterPlaylistController_.mainSegmentLoader_.bandwidth,t=window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection;return e=this.options_.useNetworkInformationApi&&t?1e7<=(t=1e3*t.downlink*1e3)&&1e7<=e?Math.max(e,t):t:e},set:function(e){this.masterPlaylistController_.mainSegmentLoader_.bandwidth=e,this.masterPlaylistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get:function(){var e=1/(this.bandwidth||1),t=0<this.throughput?1/this.throughput:0;return Math.floor(1/(e+t))},set:function(){ir.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:function(){return n.bandwidth||0},enumerable:!0},mediaRequests:{get:function(){return n.masterPlaylistController_.mediaRequests_()||0},enumerable:!0},mediaRequestsAborted:{get:function(){return n.masterPlaylistController_.mediaRequestsAborted_()||0},enumerable:!0},mediaRequestsTimedout:{get:function(){return n.masterPlaylistController_.mediaRequestsTimedout_()||0},enumerable:!0},mediaRequestsErrored:{get:function(){return n.masterPlaylistController_.mediaRequestsErrored_()||0},enumerable:!0},mediaTransferDuration:{get:function(){return n.masterPlaylistController_.mediaTransferDuration_()||0},enumerable:!0},mediaBytesTransferred:{get:function(){return n.masterPlaylistController_.mediaBytesTransferred_()||0},enumerable:!0},mediaSecondsLoaded:{get:function(){return n.masterPlaylistController_.mediaSecondsLoaded_()||0},enumerable:!0},mediaAppends:{get:function(){return n.masterPlaylistController_.mediaAppends_()||0},enumerable:!0},mainAppendsToLoadedData:{get:function(){return n.masterPlaylistController_.mainAppendsToLoadedData_()||0},enumerable:!0},audioAppendsToLoadedData:{get:function(){return n.masterPlaylistController_.audioAppendsToLoadedData_()||0},enumerable:!0},appendsToLoadedData:{get:function(){return n.masterPlaylistController_.appendsToLoadedData_()||0},enumerable:!0},timeToLoadedData:{get:function(){return n.masterPlaylistController_.timeToLoadedData_()||0},enumerable:!0},buffered:{get:function(){return ru(n.tech_.buffered())},enumerable:!0},currentTime:{get:function(){return n.tech_.currentTime()},enumerable:!0},currentSource:{get:function(){return n.tech_.currentSource_},enumerable:!0},currentTech:{get:function(){return n.tech_.name_},enumerable:!0},duration:{get:function(){return n.tech_.duration()},enumerable:!0},master:{get:function(){return n.playlists.master},enumerable:!0},playerDimensions:{get:function(){return n.tech_.currentDimensions()},enumerable:!0},seekable:{get:function(){return ru(n.tech_.seekable())},enumerable:!0},timestamp:{get:function(){return Date.now()},enumerable:!0},videoPlaybackQuality:{get:function(){return n.tech_.getVideoPlaybackQuality()},enumerable:!0}}),this.tech_.one("canplay",this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_)),this.tech_.on("bandwidthupdate",function(){n.options_.useBandwidthFromLocalStorage&&function(e){if(!window.localStorage)return;var t=(t=Qd())?ir.mergeOptions(t,e):e;try{window.localStorage.setItem(Xd,JSON.stringify(t))}catch(e){return}}({bandwidth:n.bandwidth,throughput:Math.round(n.throughput)})}),this.masterPlaylistController_.on("selectedinitialmedia",function(){var i;(i=n).representations=function(){var e=i.masterPlaylistController_.master(),e=Su(e)?i.masterPlaylistController_.getAudioTrackPlaylists_():e.playlists;return e?e.filter(function(e){return!yu(e)}).map(function(e,t){return new fd(i,e,e.id)}):[]}}),this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers",function(){n.setupEme_()}),this.on(this.masterPlaylistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.masterPlaylistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=window.URL.createObjectURL(this.masterPlaylistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_)))},t.createKeySessions_=function(){var t=this,e=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Kd({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.master.playlists}).then(function(){t.logger_("created EME key session"),t.masterPlaylistController_.sourceUpdater_.initializedEme()}).catch(function(e){t.logger_("error while creating EME key session",e),t.player_.error({message:"Failed to initialize media keys for EME",code:3})})},t.handleWaitingForKey_=function(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()},t.setupEme_=function(){var i=this,e=this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader,e=Yd({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});this.player_.tech_.on("keystatuschange",function(e){var t;"output-restricted"!==e.status||(e=i.masterPlaylistController_.master())&&e.playlists&&(t=[],e.playlists.forEach(function(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&&((e=ir.log).warn.apply(e,['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.'].concat(t)),i.masterPlaylistController_.fastQualityChange_()))}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),11!==ir.browser.IE_VERSION&&e?this.createKeySessions_():this.masterPlaylistController_.sourceUpdater_.initializedEme()},t.setupQualityLevels_=function(){var i=this,e=ir.players[this.tech_.options_.playerId];e&&e.qualityLevels&&!this.qualityLevels_&&(this.qualityLevels_=e.qualityLevels(),this.masterPlaylistController_.on("selectedinitialmedia",function(){var t,e;t=i.qualityLevels_,(e=i).representations().forEach(function(e){t.addQualityLevel(e)}),zd(t,e.playlists)}),this.playlists.on("mediachange",function(){zd(i.qualityLevels_,i.playlists)}))},e.version=function(){return{"@videojs/http-streaming":"2.16.3","mux.js":"6.0.1","mpd-parser":"0.22.1","m3u8-parser":"4.8.0","aes-decrypter":"3.1.3"}},t.version=function(){return this.constructor.version()},t.canChangeType=function(){return xd.canChangeType()},t.play=function(){this.masterPlaylistController_.play()},t.setCurrentTime=function(e){this.masterPlaylistController_.setCurrentTime(e)},t.duration=function(){return this.masterPlaylistController_.duration()},t.seekable=function(){return this.masterPlaylistController_.seekable()},t.dispose=function(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.masterPlaylistController_&&this.masterPlaylistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.player_&&(delete this.player_.vhs,delete this.player_.dash,delete this.player_.hls),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.tech_&&delete this.tech_.hls,this.mediaSourceUrl_&&window.URL.revokeObjectURL&&(window.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),r.prototype.dispose.call(this)},t.convertToProgramTime=function(e,t){return Wu({playlist:this.masterPlaylistController_.media(),time:e,callback:t})},t.seekToProgramTime=function(e,t,i,n){return void 0===i&&(i=!0),void 0===n&&(n=2),Gu({programTime:e,playlist:this.masterPlaylistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})},e}(ir.getComponent("Component")),Jd={name:"videojs-http-streaming",VERSION:"2.16.3",canHandleSource:function(e,t){t=ir.mergeOptions(ir.options,t=void 0===t?{}:t);return Jd.canPlayType(e.type,t)},handleSource:function(e,t,i){i=ir.mergeOptions(ir.options,i=void 0===i?{}:i);return t.vhs=new $d(e,t,i),ir.hasOwnProperty("hls")||Object.defineProperty(t,"hls",{get:function(){return ir.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead."),t.vhs},configurable:!0}),t.vhs.xhr=Nu(),t.vhs.src(e.src,e.type),t.vhs},canPlayType:function(e,t){e=yr(e);if(!e)return"";t=Jd.getOverrideNative(t);return!Gd.supportsTypeNatively(e)||t?"maybe":""},getOverrideNative:function(e){var t=(e=void 0===e?{}:e).vhs,i=e.hls,e=!(ir.browser.IS_ANY_SAFARI||ir.browser.IS_IOS),t=(void 0===t?{}:t).overrideNative,i=(void 0===i?{}:i).overrideNative;return void 0!==i&&i||(void 0===t?e:t)}};return mr("avc1.4d400d,mp4a.40.2")&&ir.getTech("Html5").registerSourceHandler(Jd,0),ir.VhsHandler=$d,Object.defineProperty(ir,"HlsHandler",{get:function(){return ir.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead."),$d},configurable:!0}),ir.VhsSourceHandler=Jd,Object.defineProperty(ir,"HlsSourceHandler",{get:function(){return ir.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead."),Jd},configurable:!0}),ir.Vhs=Gd,Object.defineProperty(ir,"Hls",{get:function(){return ir.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead."),Gd},configurable:!0}),ir.use||(ir.registerComponent("Hls",Gd),ir.registerComponent("Vhs",Gd)),ir.options.vhs=ir.options.vhs||{},ir.options.hls=ir.options.hls||{},ir.getPlugin&&ir.getPlugin("reloadSourceOnError")||(ir.registerPlugin||ir.plugin)("reloadSourceOnError",function(e){md(this,e)}),ir});/*File: videojs-errors.min.js*//*! @name videojs-errors @version 4.3.2 @license Apache-2.0 */
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("video.js"),require("global/document")):"function"==typeof define&&define.amd?define(["video.js","global/document"],r):(e=e||self).videojsErrors=r(e.videojs,e.document)}(this,(function(e,r){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e,r=r&&r.hasOwnProperty("default")?r.default:r;var o=e.getComponent("Flash"),n=!e.browser.IS_IPHONE,i=e.registerPlugin||e.plugin,t={header:"",code:"",message:"",timeout:45e3,dismiss:n,errors:{1:{type:"MEDIA_ERR_ABORTED",headline:"The video download was cancelled"},2:{type:"MEDIA_ERR_NETWORK",headline:"The video connection was lost, please confirm you are connected to the internet"},3:{type:"MEDIA_ERR_DECODE",headline:"The video is bad or in a format that cannot be played on your browser"},4:{type:"MEDIA_ERR_SRC_NOT_SUPPORTED",headline:"This video is either unavailable or not supported in this browser"},5:{type:"MEDIA_ERR_ENCRYPTED",headline:"The video you are trying to watch is encrypted and we do not know how to decrypt it"},unknown:{type:"MEDIA_ERR_UNKNOWN",headline:"An unanticipated problem was encountered, check back soon and try again"},"-1":{type:"PLAYER_ERR_NO_SRC",headline:"No video has been loaded"},"-2":{type:"PLAYER_ERR_TIMEOUT",headline:"Could not download the video"},PLAYER_ERR_DOMAIN_RESTRICTED:{headline:"This video is restricted from playing on your current domain"},PLAYER_ERR_IP_RESTRICTED:{headline:"This video is restricted at your current IP address"},PLAYER_ERR_GEO_RESTRICTED:{headline:"This video is restricted from playing in your current geographic region"},FLASHLS_ERR_CROSS_DOMAIN:{headline:"The video could not be loaded: crossdomain access denied."}}},s=function n(i,s){var a,d,l,c=[],u=function(r){s.errors=e.mergeOptions(s.errors,r),Object.keys(s.errors).forEach((function(e){var r=s.errors[e];r.type||(r.type=e)}))};u();var f=function(){i.clearTimeout(d),l&&(l=!1,i.removeClass("vjs-waiting")),d=i.setTimeout((function(){i.error()||i.paused()||i.ended()||(l=!0,i.addClass("vjs-waiting"))}),1e3),i.clearTimeout(a),a=i.setTimeout((function(){i.error()||i.paused()||i.ended()||i.error({code:-2,type:"PLAYER_ERR_TIMEOUT"})}),s.timeout),i.error()&&-2===i.error().code&&i.error(null)},h=function(){for(var e;c.length;)e=c.shift(),i.off(e[0],e[1]);i.clearTimeout(a),i.clearTimeout(d)},p=function(){var e,r,o,n=0;h(),f(),e=["timeupdate","adtimeupdate"],r=function(){var e=i.currentTime();e!==n&&(n=e,f())},o=function(){if(!i.error()){var e=i.$(".vjs-tech");if(e&&"application/x-shockwave-flash"===e.type&&!e.vjs_getProperty)return void i.error({code:-2,type:"PLAYER_ERR_TIMEOUT"});if(i.paused())return f();if(i.ended())return f()}r.call(this)},i.on(e,o),c.push([e,o])},v=function(){i.currentSrc()||i.error({code:-1,type:"PLAYER_ERR_NO_SRC"})},E=function(){var n="",t=i.error(),a=r.createElement("div"),d="";if(t){if((t=e.mergeOptions(t,s.errors[t.code||t.type||0])).message&&(n='<div class="vjs-errors-details">'+i.localize("Technical details")+'\n        : <div class="vjs-errors-message">'+i.localize(t.message)+"</div>\n        </div>"),4===t.code&&o&&!o.isSupported())n+='<span class="vjs-errors-flashmessage">'+i.localize("If you are using an older browser please try upgrading or installing Flash.")+"</span>";var l=i.getChild("errorDisplay");if(a.className="vjs-errors-dialog",a.id="vjs-errors-dialog",d='<div class="vjs-errors-content-container">\n      <h2 class="vjs-errors-headline">'+this.localize(t.headline)+'</h2>\n        <div class="vjs-errors-code"><b>'+this.localize("Error Code")+":</b> "+(t.type||t.code)+"</div>\n        "+n+"\n      </div>",l.closeable(!("dismiss"in t)||t.dismiss)){d+='<div class="vjs-errors-ok-button-container">\n          <button class="vjs-errors-ok-button">'+this.localize("OK")+"</button>\n        </div>",a.innerHTML=d,l.fillWith(a),l.contentEl().firstChild.appendChild(l.getChild("closeButton").el());var c=l.el().querySelector(".vjs-errors-ok-button");i.on(c,"click",(function(){l.close()}))}else a.innerHTML=d,l.fillWith(a);(i.currentWidth()<=600||i.currentHeight()<=250)&&l.addClass("vjs-xs"),l.one("modalclose",(function(){return i.error(null)}))}},R=function e(){h(),i.removeClass("vjs-errors"),i.off("play",p),i.off("play",v),i.off("dispose",e),i.off(["aderror","error"],E)},m=function(r){R(),n(i,e.mergeOptions(t,r))};m.extend=function(e){return u(e)},m.getAll=function(){return e.mergeOptions(s.errors)},m.timeout=function(e){if(void 0===e)return s.timeout;e!==s.timeout&&(s.timeout=e,i.paused()||p())},m.disableProgress=function(){},i.on("play",p),i.on("play",v),i.on("dispose",R),i.on(["aderror","contenterror","error"],E),i.ready((function(){i.addClass("vjs-errors")})),i.paused()||p(),m.VERSION="4.3.2",i.errors=m},a=function(r){s(this,e.mergeOptions(t,r))};return["extend","getAll"].forEach((function(r){a[r]=function(){e.log.warn("The errors."+r+"() method is not available until the plugin has been initialized!")}})),a.VERSION="4.3.2",i("errors",a),a}));
/*File: videojs-sardius.min.js*//*! For license information please see videojs-sardius.min.js.LICENSE.txt */
(()=>{var t={2928:t=>{!function(e){"use strict";var r,n=Object.prototype,i=n.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},a=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",l=s.toStringTag||"@@toStringTag",u=e.regeneratorRuntime;if(u)t.exports=u;else{(u=e.regeneratorRuntime=t.exports).wrap=E;var c="suspendedStart",h="suspendedYield",d="executing",f="completed",p={},g={};g[a]=function(){return this};var v=Object.getPrototypeOf,m=v&&v(v(I([])));m&&m!==n&&i.call(m,a)&&(g=m);var y=_.prototype=b.prototype=Object.create(g);T.prototype=y.constructor=_,_.constructor=T,_[l]=T.displayName="GeneratorFunction",u.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===T||"GeneratorFunction"===(e.displayName||e.name))},u.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,l in t||(t[l]="GeneratorFunction")),t.prototype=Object.create(y),t},u.awrap=function(t){return{__await:t}},A(L.prototype),L.prototype[o]=function(){return this},u.AsyncIterator=L,u.async=function(t,e,r,n){var i=new L(E(t,e,r,n));return u.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},A(y),y[l]="Generator",y[a]=function(){return this},y.toString=function(){return"[object Generator]"},u.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},u.values=I,D.prototype={constructor:D,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(k),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,i){return o.type="throw",o.arg=t,e.next=n,i&&(e.method="next",e.arg=r),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var a=this.tryEntries[s],o=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var l=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(l&&u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(l){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var s=n;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),k(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;k(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:I(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),p}}}function E(t,e,r,n){var i=e&&e.prototype instanceof b?e:b,s=Object.create(i.prototype),a=new D(n||[]);return s._invoke=function(t,e,r){var n=c;return function(i,s){if(n===d)throw new Error("Generator is already running");if(n===f){if("throw"===i)throw s;return P()}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=w(a,r);if(o){if(o===p)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===c)throw n=f,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=d;var l=S(t,e,r);if("normal"===l.type){if(n=r.done?f:h,l.arg===p)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n=f,r.method="throw",r.arg=l.arg)}}}(t,r,a),s}function S(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}function b(){}function T(){}function _(){}function A(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function L(t){function e(r,n,s,a){var o=S(t[r],t,n);if("throw"!==o.type){var l=o.arg,u=l.value;return u&&"object"==typeof u&&i.call(u,"__await")?Promise.resolve(u.__await).then((function(t){e("next",t,s,a)}),(function(t){e("throw",t,s,a)})):Promise.resolve(u).then((function(t){l.value=t,s(l)}),a)}a(o.arg)}var r;this._invoke=function(t,n){function i(){return new Promise((function(r,i){e(t,n,r,i)}))}return r=r?r.then(i,i):i()}}function w(t,e){var n=t.iterator[e.method];if(n===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=r,w(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var i=S(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,p;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,p):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function R(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function k(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(R,this),this.reset(!0)}function I(t){if(t){var e=t[a];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,s=function e(){for(;++n<t.length;)if(i.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return s.next=s}}return{next:P}}function P(){return{value:r,done:!0}}}(function(){return this}()||Function("return this")())},9272:(t,e,r)=>{"use strict";var n=r(723),i=[],s=[],a=n.makeRequestCallFromTimer((function(){if(s.length)throw s.shift()}));function o(t){var e;(e=i.length?i.pop():new l).task=t,n(e)}function l(){this.task=null}t.exports=o,l.prototype.call=function(){try{this.task.call()}catch(t){o.onerror?o.onerror(t):(s.push(t),a())}finally{this.task=null,i[i.length]=this}}},723:(t,e,r)=>{"use strict";function n(t){s.length||i(),s[s.length]=t}t.exports=n;var i,s=[],a=0;function o(){for(;a<s.length;){var t=a;if(a+=1,s[t].call(),a>1024){for(var e=0,r=s.length-a;e<r;e++)s[e]=s[e+a];s.length-=a,a=0}}s.length=0,a=0}var l,u,c,h=void 0!==r.g?r.g:self,d=h.MutationObserver||h.WebKitMutationObserver;function f(t){return function(){var e=setTimeout(n,0),r=setInterval(n,50);function n(){clearTimeout(e),clearInterval(r),t()}}}"function"==typeof d?(l=1,u=new d(o),c=document.createTextNode(""),u.observe(c,{characterData:!0}),i=function(){l=-l,c.data=l}):i=f(o),n.requestFlush=i,n.makeRequestCallFromTimer=f},6266:(t,e,r)=>{r(5767),r(8132),r(8388),r(7470),r(4882),r(1520),r(7476),r(9622),r(9375),r(3533),r(4672),r(4157),r(5095),r(9892),r(5115),r(9176),r(8838),r(6253),r(9730),r(6059),r(8377),r(1084),r(4299),r(1246),r(726),r(1901),r(5972),r(3403),r(2516),r(9371),r(6479),r(1736),r(1889),r(5177),r(6943),r(6503),r(6786),r(932),r(7526),r(1591),r(9073),r(347),r(579),r(4669),r(7710),r(5789),r(3514),r(9978),r(8472),r(6946),r(5068),r(413),r(191),r(8306),r(4564),r(9115),r(9539),r(6620),r(2850),r(823),r(7732),r(856),r(703),r(1539),r(5292),r(6629),r(3694),r(7648),r(7795),r(4531),r(3605),r(6780),r(9937),r(511),r(1822),r(9977),r(1031),r(6331),r(1560),r(774),r(522),r(8295),r(7842),r(110),r(75),r(4336),r(1802),r(8837),r(6773),r(5745),r(3057),r(3750),r(3369),r(9564),r(2e3),r(8977),r(2310),r(4899),r(1842),r(6997),r(3946),r(8269),r(6108),r(6774),r(1466),r(9357),r(6142),r(1876),r(851),r(8416),r(8184),r(147),r(9192),r(142),r(1786),r(5368),r(6964),r(2152),r(4821),r(9103),r(1303),r(3318),r(162),r(3834),r(1572),r(2139),r(685),r(5535),r(7347),r(3049),r(6633),r(8989),r(8270),r(4510),r(3984),r(5769),r(55),r(6014),t.exports=r(5645)},990:(t,e,r)=>{r(2773),t.exports=r(5645).Array.includes},5434:(t,e,r)=>{r(3276),t.exports=r(5645).Object.entries},8051:(t,e,r)=>{r(8351),t.exports=r(5645).Object.getOwnPropertyDescriptors},8250:(t,e,r)=>{r(6409),t.exports=r(5645).Object.values},4952:(t,e,r)=>{"use strict";r(851),r(9865),t.exports=r(5645).Promise.finally},6197:(t,e,r)=>{r(2770),t.exports=r(5645).String.padEnd},4160:(t,e,r)=>{r(1784),t.exports=r(5645).String.padStart},3568:(t,e,r)=>{r(9665),t.exports=r(8787).f("asyncIterator")},4963:t=>{t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},3365:(t,e,r)=>{var n=r(2032);t.exports=function(t,e){if("number"!=typeof t&&"Number"!=n(t))throw TypeError(e);return+t}},7722:(t,e,r)=>{var n=r(6314)("unscopables"),i=Array.prototype;null==i[n]&&r(7728)(i,n,{}),t.exports=function(t){i[n][t]=!0}},6793:(t,e,r)=>{"use strict";var n=r(4496)(!0);t.exports=function(t,e,r){return e+(r?n(t,e).length:1)}},3328:t=>{t.exports=function(t,e,r,n){if(!(t instanceof e)||void 0!==n&&n in t)throw TypeError(r+": incorrect invocation!");return t}},7007:(t,e,r)=>{var n=r(5286);t.exports=function(t){if(!n(t))throw TypeError(t+" is not an object!");return t}},5216:(t,e,r)=>{"use strict";var n=r(508),i=r(2337),s=r(875);t.exports=[].copyWithin||function(t,e){var r=n(this),a=s(r.length),o=i(t,a),l=i(e,a),u=arguments.length>2?arguments[2]:void 0,c=Math.min((void 0===u?a:i(u,a))-l,a-o),h=1;for(l<o&&o<l+c&&(h=-1,l+=c-1,o+=c-1);c-- >0;)l in r?r[o]=r[l]:delete r[o],o+=h,l+=h;return r}},6852:(t,e,r)=>{"use strict";var n=r(508),i=r(2337),s=r(875);t.exports=function(t){for(var e=n(this),r=s(e.length),a=arguments.length,o=i(a>1?arguments[1]:void 0,r),l=a>2?arguments[2]:void 0,u=void 0===l?r:i(l,r);u>o;)e[o++]=t;return e}},9315:(t,e,r)=>{var n=r(2110),i=r(875),s=r(2337);t.exports=function(t){return function(e,r,a){var o,l=n(e),u=i(l.length),c=s(a,u);if(t&&r!=r){for(;u>c;)if((o=l[c++])!=o)return!0}else for(;u>c;c++)if((t||c in l)&&l[c]===r)return t||c||0;return!t&&-1}}},50:(t,e,r)=>{var n=r(741),i=r(9797),s=r(508),a=r(875),o=r(6886);t.exports=function(t,e){var r=1==t,l=2==t,u=3==t,c=4==t,h=6==t,d=5==t||h,f=e||o;return function(e,o,p){for(var g,v,m=s(e),y=i(m),E=n(o,p,3),S=a(y.length),b=0,T=r?f(e,S):l?f(e,0):void 0;S>b;b++)if((d||b in y)&&(v=E(g=y[b],b,m),t))if(r)T[b]=v;else if(v)switch(t){case 3:return!0;case 5:return g;case 6:return b;case 2:T.push(g)}else if(c)return!1;return h?-1:u||c?c:T}}},7628:(t,e,r)=>{var n=r(4963),i=r(508),s=r(9797),a=r(875);t.exports=function(t,e,r,o,l){n(e);var u=i(t),c=s(u),h=a(u.length),d=l?h-1:0,f=l?-1:1;if(r<2)for(;;){if(d in c){o=c[d],d+=f;break}if(d+=f,l?d<0:h<=d)throw TypeError("Reduce of empty array with no initial value")}for(;l?d>=0:h>d;d+=f)d in c&&(o=e(o,c[d],d,u));return o}},2736:(t,e,r)=>{var n=r(5286),i=r(4302),s=r(6314)("species");t.exports=function(t){var e;return i(t)&&("function"!=typeof(e=t.constructor)||e!==Array&&!i(e.prototype)||(e=void 0),n(e)&&null===(e=e[s])&&(e=void 0)),void 0===e?Array:e}},6886:(t,e,r)=>{var n=r(2736);t.exports=function(t,e){return new(n(t))(e)}},4398:(t,e,r)=>{"use strict";var n=r(4963),i=r(5286),s=r(7242),a=[].slice,o={};t.exports=Function.bind||function(t){var e=n(this),r=a.call(arguments,1),l=function(){var n=r.concat(a.call(arguments));return this instanceof l?function(t,e,r){if(!(e in o)){for(var n=[],i=0;i<e;i++)n[i]="a["+i+"]";o[e]=Function("F,a","return new F("+n.join(",")+")")}return o[e](t,r)}(e,n.length,n):s(e,n,t)};return i(e.prototype)&&(l.prototype=e.prototype),l}},1488:(t,e,r)=>{var n=r(2032),i=r(6314)("toStringTag"),s="Arguments"==n(function(){return arguments}());t.exports=function(t){var e,r,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(r=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),i))?r:s?n(e):"Object"==(a=n(e))&&"function"==typeof e.callee?"Arguments":a}},2032:t=>{var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},9824:(t,e,r)=>{"use strict";var n=r(9275).f,i=r(2503),s=r(4408),a=r(741),o=r(3328),l=r(3531),u=r(2923),c=r(5436),h=r(2974),d=r(7057),f=r(4728).fastKey,p=r(1616),g=d?"_s":"size",v=function(t,e){var r,n=f(e);if("F"!==n)return t._i[n];for(r=t._f;r;r=r.n)if(r.k==e)return r};t.exports={getConstructor:function(t,e,r,u){var c=t((function(t,n){o(t,c,e,"_i"),t._t=e,t._i=i(null),t._f=void 0,t._l=void 0,t[g]=0,null!=n&&l(n,r,t[u],t)}));return s(c.prototype,{clear:function(){for(var t=p(this,e),r=t._i,n=t._f;n;n=n.n)n.r=!0,n.p&&(n.p=n.p.n=void 0),delete r[n.i];t._f=t._l=void 0,t[g]=0},delete:function(t){var r=p(this,e),n=v(r,t);if(n){var i=n.n,s=n.p;delete r._i[n.i],n.r=!0,s&&(s.n=i),i&&(i.p=s),r._f==n&&(r._f=i),r._l==n&&(r._l=s),r[g]--}return!!n},forEach:function(t){p(this,e);for(var r,n=a(t,arguments.length>1?arguments[1]:void 0,3);r=r?r.n:this._f;)for(n(r.v,r.k,this);r&&r.r;)r=r.p},has:function(t){return!!v(p(this,e),t)}}),d&&n(c.prototype,"size",{get:function(){return p(this,e)[g]}}),c},def:function(t,e,r){var n,i,s=v(t,e);return s?s.v=r:(t._l=s={i:i=f(e,!0),k:e,v:r,p:n=t._l,n:void 0,r:!1},t._f||(t._f=s),n&&(n.n=s),t[g]++,"F"!==i&&(t._i[i]=s)),t},getEntry:v,setStrong:function(t,e,r){u(t,e,(function(t,r){this._t=p(t,e),this._k=r,this._l=void 0}),(function(){for(var t=this,e=t._k,r=t._l;r&&r.r;)r=r.p;return t._t&&(t._l=r=r?r.n:t._t._f)?c(0,"keys"==e?r.k:"values"==e?r.v:[r.k,r.v]):(t._t=void 0,c(1))}),r?"entries":"values",!r,!0),h(e)}}},3657:(t,e,r)=>{"use strict";var n=r(4408),i=r(4728).getWeak,s=r(7007),a=r(5286),o=r(3328),l=r(3531),u=r(50),c=r(9181),h=r(1616),d=u(5),f=u(6),p=0,g=function(t){return t._l||(t._l=new v)},v=function(){this.a=[]},m=function(t,e){return d(t.a,(function(t){return t[0]===e}))};v.prototype={get:function(t){var e=m(this,t);if(e)return e[1]},has:function(t){return!!m(this,t)},set:function(t,e){var r=m(this,t);r?r[1]=e:this.a.push([t,e])},delete:function(t){var e=f(this.a,(function(e){return e[0]===t}));return~e&&this.a.splice(e,1),!!~e}},t.exports={getConstructor:function(t,e,r,s){var u=t((function(t,n){o(t,u,e,"_i"),t._t=e,t._i=p++,t._l=void 0,null!=n&&l(n,r,t[s],t)}));return n(u.prototype,{delete:function(t){if(!a(t))return!1;var r=i(t);return!0===r?g(h(this,e)).delete(t):r&&c(r,this._i)&&delete r[this._i]},has:function(t){if(!a(t))return!1;var r=i(t);return!0===r?g(h(this,e)).has(t):r&&c(r,this._i)}}),u},def:function(t,e,r){var n=i(s(e),!0);return!0===n?g(t).set(e,r):n[t._i]=r,t},ufstore:g}},5795:(t,e,r)=>{"use strict";var n=r(3816),i=r(2985),s=r(7234),a=r(4408),o=r(4728),l=r(3531),u=r(3328),c=r(5286),h=r(4253),d=r(7462),f=r(2943),p=r(266);t.exports=function(t,e,r,g,v,m){var y=n[t],E=y,S=v?"set":"add",b=E&&E.prototype,T={},_=function(t){var e=b[t];s(b,t,"delete"==t||"has"==t?function(t){return!(m&&!c(t))&&e.call(this,0===t?0:t)}:"get"==t?function(t){return m&&!c(t)?void 0:e.call(this,0===t?0:t)}:"add"==t?function(t){return e.call(this,0===t?0:t),this}:function(t,r){return e.call(this,0===t?0:t,r),this})};if("function"==typeof E&&(m||b.forEach&&!h((function(){(new E).entries().next()})))){var A=new E,L=A[S](m?{}:-0,1)!=A,w=h((function(){A.has(1)})),R=d((function(t){new E(t)})),k=!m&&h((function(){for(var t=new E,e=5;e--;)t[S](e,e);return!t.has(-0)}));R||((E=e((function(e,r){u(e,E,t);var n=p(new y,e,E);return null!=r&&l(r,v,n[S],n),n}))).prototype=b,b.constructor=E),(w||k)&&(_("delete"),_("has"),v&&_("get")),(k||L)&&_(S),m&&b.clear&&delete b.clear}else E=g.getConstructor(e,t,v,S),a(E.prototype,r),o.NEED=!0;return f(E,t),T[t]=E,i(i.G+i.W+i.F*(E!=y),T),m||g.setStrong(E,t,v),E}},5645:t=>{var e=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=e)},2811:(t,e,r)=>{"use strict";var n=r(9275),i=r(681);t.exports=function(t,e,r){e in t?n.f(t,e,i(0,r)):t[e]=r}},741:(t,e,r)=>{var n=r(4963);t.exports=function(t,e,r){if(n(t),void 0===e)return t;switch(r){case 1:return function(r){return t.call(e,r)};case 2:return function(r,n){return t.call(e,r,n)};case 3:return function(r,n,i){return t.call(e,r,n,i)}}return function(){return t.apply(e,arguments)}}},3537:(t,e,r)=>{"use strict";var n=r(4253),i=Date.prototype.getTime,s=Date.prototype.toISOString,a=function(t){return t>9?t:"0"+t};t.exports=n((function(){return"0385-07-25T07:06:39.999Z"!=s.call(new Date(-50000000000001))}))||!n((function(){s.call(new Date(NaN))}))?function(){if(!isFinite(i.call(this)))throw RangeError("Invalid time value");var t=this,e=t.getUTCFullYear(),r=t.getUTCMilliseconds(),n=e<0?"-":e>9999?"+":"";return n+("00000"+Math.abs(e)).slice(n?-6:-4)+"-"+a(t.getUTCMonth()+1)+"-"+a(t.getUTCDate())+"T"+a(t.getUTCHours())+":"+a(t.getUTCMinutes())+":"+a(t.getUTCSeconds())+"."+(r>99?r:"0"+a(r))+"Z"}:s},870:(t,e,r)=>{"use strict";var n=r(7007),i=r(1689),s="number";t.exports=function(t){if("string"!==t&&t!==s&&"default"!==t)throw TypeError("Incorrect hint");return i(n(this),t!=s)}},1355:t=>{t.exports=function(t){if(null==t)throw TypeError("Can't call method on  "+t);return t}},7057:(t,e,r)=>{t.exports=!r(4253)((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},2457:(t,e,r)=>{var n=r(5286),i=r(3816).document,s=n(i)&&n(i.createElement);t.exports=function(t){return s?i.createElement(t):{}}},4430:t=>{t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},5541:(t,e,r)=>{var n=r(7184),i=r(4548),s=r(4682);t.exports=function(t){var e=n(t),r=i.f;if(r)for(var a,o=r(t),l=s.f,u=0;o.length>u;)l.call(t,a=o[u++])&&e.push(a);return e}},2985:(t,e,r)=>{var n=r(3816),i=r(5645),s=r(7728),a=r(7234),o=r(741),l="prototype",u=function(t,e,r){var c,h,d,f,p=t&u.F,g=t&u.G,v=t&u.S,m=t&u.P,y=t&u.B,E=g?n:v?n[e]||(n[e]={}):(n[e]||{})[l],S=g?i:i[e]||(i[e]={}),b=S[l]||(S[l]={});for(c in g&&(r=e),r)d=((h=!p&&E&&void 0!==E[c])?E:r)[c],f=y&&h?o(d,n):m&&"function"==typeof d?o(Function.call,d):d,E&&a(E,c,d,t&u.U),S[c]!=d&&s(S,c,f),m&&b[c]!=d&&(b[c]=d)};n.core=i,u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,t.exports=u},8852:(t,e,r)=>{var n=r(6314)("match");t.exports=function(t){var e=/./;try{"/./"[t](e)}catch(r){try{return e[n]=!1,!"/./"[t](e)}catch(t){}}return!0}},4253:t=>{t.exports=function(t){try{return!!t()}catch(t){return!0}}},8082:(t,e,r)=>{"use strict";r(8269);var n=r(7234),i=r(7728),s=r(4253),a=r(1355),o=r(6314),l=r(1165),u=o("species"),c=!s((function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")})),h=function(){var t=/(?:)/,e=t.exec;t.exec=function(){return e.apply(this,arguments)};var r="ab".split(t);return 2===r.length&&"a"===r[0]&&"b"===r[1]}();t.exports=function(t,e,r){var d=o(t),f=!s((function(){var e={};return e[d]=function(){return 7},7!=""[t](e)})),p=f?!s((function(){var e=!1,r=/a/;return r.exec=function(){return e=!0,null},"split"===t&&(r.constructor={},r.constructor[u]=function(){return r}),r[d](""),!e})):void 0;if(!f||!p||"replace"===t&&!c||"split"===t&&!h){var g=/./[d],v=r(a,d,""[t],(function(t,e,r,n,i){return e.exec===l?f&&!i?{done:!0,value:g.call(e,r,n)}:{done:!0,value:t.call(r,e,n)}:{done:!1}})),m=v[0],y=v[1];n(String.prototype,t,m),i(RegExp.prototype,d,2==e?function(t,e){return y.call(t,this,e)}:function(t){return y.call(t,this)})}}},3218:(t,e,r)=>{"use strict";var n=r(7007);t.exports=function(){var t=n(this),e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),t.unicode&&(e+="u"),t.sticky&&(e+="y"),e}},3531:(t,e,r)=>{var n=r(741),i=r(8851),s=r(6555),a=r(7007),o=r(875),l=r(9002),u={},c={},h=t.exports=function(t,e,r,h,d){var f,p,g,v,m=d?function(){return t}:l(t),y=n(r,h,e?2:1),E=0;if("function"!=typeof m)throw TypeError(t+" is not iterable!");if(s(m)){for(f=o(t.length);f>E;E++)if((v=e?y(a(p=t[E])[0],p[1]):y(t[E]))===u||v===c)return v}else for(g=m.call(t);!(p=g.next()).done;)if((v=i(g,y,p.value,e))===u||v===c)return v};h.BREAK=u,h.RETURN=c},18:(t,e,r)=>{t.exports=r(3825)("native-function-to-string",Function.toString)},3816:t=>{var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},9181:t=>{var e={}.hasOwnProperty;t.exports=function(t,r){return e.call(t,r)}},7728:(t,e,r)=>{var n=r(9275),i=r(681);t.exports=r(7057)?function(t,e,r){return n.f(t,e,i(1,r))}:function(t,e,r){return t[e]=r,t}},639:(t,e,r)=>{var n=r(3816).document;t.exports=n&&n.documentElement},1734:(t,e,r)=>{t.exports=!r(7057)&&!r(4253)((function(){return 7!=Object.defineProperty(r(2457)("div"),"a",{get:function(){return 7}}).a}))},266:(t,e,r)=>{var n=r(5286),i=r(7375).set;t.exports=function(t,e,r){var s,a=e.constructor;return a!==r&&"function"==typeof a&&(s=a.prototype)!==r.prototype&&n(s)&&i&&i(t,s),t}},7242:t=>{t.exports=function(t,e,r){var n=void 0===r;switch(e.length){case 0:return n?t():t.call(r);case 1:return n?t(e[0]):t.call(r,e[0]);case 2:return n?t(e[0],e[1]):t.call(r,e[0],e[1]);case 3:return n?t(e[0],e[1],e[2]):t.call(r,e[0],e[1],e[2]);case 4:return n?t(e[0],e[1],e[2],e[3]):t.call(r,e[0],e[1],e[2],e[3])}return t.apply(r,e)}},9797:(t,e,r)=>{var n=r(2032);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==n(t)?t.split(""):Object(t)}},6555:(t,e,r)=>{var n=r(2803),i=r(6314)("iterator"),s=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||s[i]===t)}},4302:(t,e,r)=>{var n=r(2032);t.exports=Array.isArray||function(t){return"Array"==n(t)}},8367:(t,e,r)=>{var n=r(5286),i=Math.floor;t.exports=function(t){return!n(t)&&isFinite(t)&&i(t)===t}},5286:t=>{t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},5364:(t,e,r)=>{var n=r(5286),i=r(2032),s=r(6314)("match");t.exports=function(t){var e;return n(t)&&(void 0!==(e=t[s])?!!e:"RegExp"==i(t))}},8851:(t,e,r)=>{var n=r(7007);t.exports=function(t,e,r,i){try{return i?e(n(r)[0],r[1]):e(r)}catch(e){var s=t.return;throw void 0!==s&&n(s.call(t)),e}}},9988:(t,e,r)=>{"use strict";var n=r(2503),i=r(681),s=r(2943),a={};r(7728)(a,r(6314)("iterator"),(function(){return this})),t.exports=function(t,e,r){t.prototype=n(a,{next:i(1,r)}),s(t,e+" Iterator")}},2923:(t,e,r)=>{"use strict";var n=r(4461),i=r(2985),s=r(7234),a=r(7728),o=r(2803),l=r(9988),u=r(2943),c=r(468),h=r(6314)("iterator"),d=!([].keys&&"next"in[].keys()),f="keys",p="values",g=function(){return this};t.exports=function(t,e,r,v,m,y,E){l(r,e,v);var S,b,T,_=function(t){if(!d&&t in R)return R[t];switch(t){case f:case p:return function(){return new r(this,t)}}return function(){return new r(this,t)}},A=e+" Iterator",L=m==p,w=!1,R=t.prototype,k=R[h]||R["@@iterator"]||m&&R[m],D=k||_(m),I=m?L?_("entries"):D:void 0,P="Array"==e&&R.entries||k;if(P&&(T=c(P.call(new t)))!==Object.prototype&&T.next&&(u(T,A,!0),n||"function"==typeof T[h]||a(T,h,g)),L&&k&&k.name!==p&&(w=!0,D=function(){return k.call(this)}),n&&!E||!d&&!w&&R[h]||a(R,h,D),o[e]=D,o[A]=g,m)if(S={values:L?D:_(p),keys:y?D:_(f),entries:I},E)for(b in S)b in R||s(R,b,S[b]);else i(i.P+i.F*(d||w),e,S);return S}},7462:(t,e,r)=>{var n=r(6314)("iterator"),i=!1;try{var s=[7][n]();s.return=function(){i=!0},Array.from(s,(function(){throw 2}))}catch(t){}t.exports=function(t,e){if(!e&&!i)return!1;var r=!1;try{var s=[7],a=s[n]();a.next=function(){return{done:r=!0}},s[n]=function(){return a},t(s)}catch(t){}return r}},5436:t=>{t.exports=function(t,e){return{value:e,done:!!t}}},2803:t=>{t.exports={}},4461:t=>{t.exports=!1},3086:t=>{var e=Math.expm1;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},4934:(t,e,r)=>{var n=r(1801),i=Math.pow,s=i(2,-52),a=i(2,-23),o=i(2,127)*(2-a),l=i(2,-126);t.exports=Math.fround||function(t){var e,r,i=Math.abs(t),u=n(t);return i<l?u*(i/l/a+1/s-1/s)*l*a:(r=(e=(1+a/s)*i)-(e-i))>o||r!=r?u*(1/0):u*r}},6206:t=>{t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},1801:t=>{t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},4728:(t,e,r)=>{var n=r(3953)("meta"),i=r(5286),s=r(9181),a=r(9275).f,o=0,l=Object.isExtensible||function(){return!0},u=!r(4253)((function(){return l(Object.preventExtensions({}))})),c=function(t){a(t,n,{value:{i:"O"+ ++o,w:{}}})},h=t.exports={KEY:n,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!s(t,n)){if(!l(t))return"F";if(!e)return"E";c(t)}return t[n].i},getWeak:function(t,e){if(!s(t,n)){if(!l(t))return!0;if(!e)return!1;c(t)}return t[n].w},onFreeze:function(t){return u&&h.NEED&&l(t)&&!s(t,n)&&c(t),t}}},4351:(t,e,r)=>{var n=r(3816),i=r(4193).set,s=n.MutationObserver||n.WebKitMutationObserver,a=n.process,o=n.Promise,l="process"==r(2032)(a);t.exports=function(){var t,e,r,u=function(){var n,i;for(l&&(n=a.domain)&&n.exit();t;){i=t.fn,t=t.next;try{i()}catch(n){throw t?r():e=void 0,n}}e=void 0,n&&n.enter()};if(l)r=function(){a.nextTick(u)};else if(!s||n.navigator&&n.navigator.standalone)if(o&&o.resolve){var c=o.resolve(void 0);r=function(){c.then(u)}}else r=function(){i.call(n,u)};else{var h=!0,d=document.createTextNode("");new s(u).observe(d,{characterData:!0}),r=function(){d.data=h=!h}}return function(n){var i={fn:n,next:void 0};e&&(e.next=i),t||(t=i,r()),e=i}}},3499:(t,e,r)=>{"use strict";var n=r(4963);function i(t){var e,r;this.promise=new t((function(t,n){if(void 0!==e||void 0!==r)throw TypeError("Bad Promise constructor");e=t,r=n})),this.resolve=n(e),this.reject=n(r)}t.exports.f=function(t){return new i(t)}},5345:(t,e,r)=>{"use strict";var n=r(7057),i=r(7184),s=r(4548),a=r(4682),o=r(508),l=r(9797),u=Object.assign;t.exports=!u||r(4253)((function(){var t={},e={},r=Symbol(),n="abcdefghijklmnopqrst";return t[r]=7,n.split("").forEach((function(t){e[t]=t})),7!=u({},t)[r]||Object.keys(u({},e)).join("")!=n}))?function(t,e){for(var r=o(t),u=arguments.length,c=1,h=s.f,d=a.f;u>c;)for(var f,p=l(arguments[c++]),g=h?i(p).concat(h(p)):i(p),v=g.length,m=0;v>m;)f=g[m++],n&&!d.call(p,f)||(r[f]=p[f]);return r}:u},2503:(t,e,r)=>{var n=r(7007),i=r(5588),s=r(4430),a=r(9335)("IE_PROTO"),o=function(){},l="prototype",u=function(){var t,e=r(2457)("iframe"),n=s.length;for(e.style.display="none",r(639).appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),u=t.F;n--;)delete u[l][s[n]];return u()};t.exports=Object.create||function(t,e){var r;return null!==t?(o[l]=n(t),r=new o,o[l]=null,r[a]=t):r=u(),void 0===e?r:i(r,e)}},9275:(t,e,r)=>{var n=r(7007),i=r(1734),s=r(1689),a=Object.defineProperty;e.f=r(7057)?Object.defineProperty:function(t,e,r){if(n(t),e=s(e,!0),n(r),i)try{return a(t,e,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(t[e]=r.value),t}},5588:(t,e,r)=>{var n=r(9275),i=r(7007),s=r(7184);t.exports=r(7057)?Object.defineProperties:function(t,e){i(t);for(var r,a=s(e),o=a.length,l=0;o>l;)n.f(t,r=a[l++],e[r]);return t}},8693:(t,e,r)=>{var n=r(4682),i=r(681),s=r(2110),a=r(1689),o=r(9181),l=r(1734),u=Object.getOwnPropertyDescriptor;e.f=r(7057)?u:function(t,e){if(t=s(t),e=a(e,!0),l)try{return u(t,e)}catch(t){}if(o(t,e))return i(!n.f.call(t,e),t[e])}},9327:(t,e,r)=>{var n=r(2110),i=r(616).f,s={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return a&&"[object Window]"==s.call(t)?function(t){try{return i(t)}catch(t){return a.slice()}}(t):i(n(t))}},616:(t,e,r)=>{var n=r(189),i=r(4430).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,i)}},4548:(t,e)=>{e.f=Object.getOwnPropertySymbols},468:(t,e,r)=>{var n=r(9181),i=r(508),s=r(9335)("IE_PROTO"),a=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),n(t,s)?t[s]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},189:(t,e,r)=>{var n=r(9181),i=r(2110),s=r(9315)(!1),a=r(9335)("IE_PROTO");t.exports=function(t,e){var r,o=i(t),l=0,u=[];for(r in o)r!=a&&n(o,r)&&u.push(r);for(;e.length>l;)n(o,r=e[l++])&&(~s(u,r)||u.push(r));return u}},7184:(t,e,r)=>{var n=r(189),i=r(4430);t.exports=Object.keys||function(t){return n(t,i)}},4682:(t,e)=>{e.f={}.propertyIsEnumerable},3160:(t,e,r)=>{var n=r(2985),i=r(5645),s=r(4253);t.exports=function(t,e){var r=(i.Object||{})[t]||Object[t],a={};a[t]=e(r),n(n.S+n.F*s((function(){r(1)})),"Object",a)}},1131:(t,e,r)=>{var n=r(7057),i=r(7184),s=r(2110),a=r(4682).f;t.exports=function(t){return function(e){for(var r,o=s(e),l=i(o),u=l.length,c=0,h=[];u>c;)r=l[c++],n&&!a.call(o,r)||h.push(t?[r,o[r]]:o[r]);return h}}},7643:(t,e,r)=>{var n=r(616),i=r(4548),s=r(7007),a=r(3816).Reflect;t.exports=a&&a.ownKeys||function(t){var e=n.f(s(t)),r=i.f;return r?e.concat(r(t)):e}},7743:(t,e,r)=>{var n=r(3816).parseFloat,i=r(9599).trim;t.exports=1/n(r(4644)+"-0")!=-1/0?function(t){var e=i(String(t),3),r=n(e);return 0===r&&"-"==e.charAt(0)?-0:r}:n},5960:(t,e,r)=>{var n=r(3816).parseInt,i=r(9599).trim,s=r(4644),a=/^[-+]?0[xX]/;t.exports=8!==n(s+"08")||22!==n(s+"0x16")?function(t,e){var r=i(String(t),3);return n(r,e>>>0||(a.test(r)?16:10))}:n},188:t=>{t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},94:(t,e,r)=>{var n=r(7007),i=r(5286),s=r(3499);t.exports=function(t,e){if(n(t),i(e)&&e.constructor===t)return e;var r=s.f(t);return(0,r.resolve)(e),r.promise}},681:t=>{t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},4408:(t,e,r)=>{var n=r(7234);t.exports=function(t,e,r){for(var i in e)n(t,i,e[i],r);return t}},7234:(t,e,r)=>{var n=r(3816),i=r(7728),s=r(9181),a=r(3953)("src"),o=r(18),l="toString",u=(""+o).split(l);r(5645).inspectSource=function(t){return o.call(t)},(t.exports=function(t,e,r,o){var l="function"==typeof r;l&&(s(r,"name")||i(r,"name",e)),t[e]!==r&&(l&&(s(r,a)||i(r,a,t[e]?""+t[e]:u.join(String(e)))),t===n?t[e]=r:o?t[e]?t[e]=r:i(t,e,r):(delete t[e],i(t,e,r)))})(Function.prototype,l,(function(){return"function"==typeof this&&this[a]||o.call(this)}))},7787:(t,e,r)=>{"use strict";var n=r(1488),i=RegExp.prototype.exec;t.exports=function(t,e){var r=t.exec;if("function"==typeof r){var s=r.call(t,e);if("object"!=typeof s)throw new TypeError("RegExp exec method returned something other than an Object or null");return s}if("RegExp"!==n(t))throw new TypeError("RegExp#exec called on incompatible receiver");return i.call(t,e)}},1165:(t,e,r)=>{"use strict";var n,i,s=r(3218),a=RegExp.prototype.exec,o=String.prototype.replace,l=a,u="lastIndex",c=(n=/a/,i=/b*/g,a.call(n,"a"),a.call(i,"a"),0!==n[u]||0!==i[u]),h=void 0!==/()??/.exec("")[1];(c||h)&&(l=function(t){var e,r,n,i,l=this;return h&&(r=new RegExp("^"+l.source+"$(?!\\s)",s.call(l))),c&&(e=l[u]),n=a.call(l,t),c&&n&&(l[u]=l.global?n.index+n[0].length:e),h&&n&&n.length>1&&o.call(n[0],r,(function(){for(i=1;i<arguments.length-2;i++)void 0===arguments[i]&&(n[i]=void 0)})),n}),t.exports=l},7195:t=>{t.exports=Object.is||function(t,e){return t===e?0!==t||1/t==1/e:t!=t&&e!=e}},7375:(t,e,r)=>{var n=r(5286),i=r(7007),s=function(t,e){if(i(t),!n(e)&&null!==e)throw TypeError(e+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,e,n){try{(n=r(741)(Function.call,r(8693).f(Object.prototype,"__proto__").set,2))(t,[]),e=!(t instanceof Array)}catch(t){e=!0}return function(t,r){return s(t,r),e?t.__proto__=r:n(t,r),t}}({},!1):void 0),check:s}},2974:(t,e,r)=>{"use strict";var n=r(3816),i=r(9275),s=r(7057),a=r(6314)("species");t.exports=function(t){var e=n[t];s&&e&&!e[a]&&i.f(e,a,{configurable:!0,get:function(){return this}})}},2943:(t,e,r)=>{var n=r(9275).f,i=r(9181),s=r(6314)("toStringTag");t.exports=function(t,e,r){t&&!i(t=r?t:t.prototype,s)&&n(t,s,{configurable:!0,value:e})}},9335:(t,e,r)=>{var n=r(3825)("keys"),i=r(3953);t.exports=function(t){return n[t]||(n[t]=i(t))}},3825:(t,e,r)=>{var n=r(5645),i=r(3816),s="__core-js_shared__",a=i[s]||(i[s]={});(t.exports=function(t,e){return a[t]||(a[t]=void 0!==e?e:{})})("versions",[]).push({version:n.version,mode:r(4461)?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},8364:(t,e,r)=>{var n=r(7007),i=r(4963),s=r(6314)("species");t.exports=function(t,e){var r,a=n(t).constructor;return void 0===a||null==(r=n(a)[s])?e:i(r)}},7717:(t,e,r)=>{"use strict";var n=r(4253);t.exports=function(t,e){return!!t&&n((function(){e?t.call(null,(function(){}),1):t.call(null)}))}},4496:(t,e,r)=>{var n=r(1467),i=r(1355);t.exports=function(t){return function(e,r){var s,a,o=String(i(e)),l=n(r),u=o.length;return l<0||l>=u?t?"":void 0:(s=o.charCodeAt(l))<55296||s>56319||l+1===u||(a=o.charCodeAt(l+1))<56320||a>57343?t?o.charAt(l):s:t?o.slice(l,l+2):a-56320+(s-55296<<10)+65536}}},2094:(t,e,r)=>{var n=r(5364),i=r(1355);t.exports=function(t,e,r){if(n(e))throw TypeError("String#"+r+" doesn't accept regex!");return String(i(t))}},9395:(t,e,r)=>{var n=r(2985),i=r(4253),s=r(1355),a=/"/g,o=function(t,e,r,n){var i=String(s(t)),o="<"+e;return""!==r&&(o+=" "+r+'="'+String(n).replace(a,"&quot;")+'"'),o+">"+i+"</"+e+">"};t.exports=function(t,e){var r={};r[t]=e(o),n(n.P+n.F*i((function(){var e=""[t]('"');return e!==e.toLowerCase()||e.split('"').length>3})),"String",r)}},5442:(t,e,r)=>{var n=r(875),i=r(8595),s=r(1355);t.exports=function(t,e,r,a){var o=String(s(t)),l=o.length,u=void 0===r?" ":String(r),c=n(e);if(c<=l||""==u)return o;var h=c-l,d=i.call(u,Math.ceil(h/u.length));return d.length>h&&(d=d.slice(0,h)),a?d+o:o+d}},8595:(t,e,r)=>{"use strict";var n=r(1467),i=r(1355);t.exports=function(t){var e=String(i(this)),r="",s=n(t);if(s<0||s==1/0)throw RangeError("Count can't be negative");for(;s>0;(s>>>=1)&&(e+=e))1&s&&(r+=e);return r}},9599:(t,e,r)=>{var n=r(2985),i=r(1355),s=r(4253),a=r(4644),o="["+a+"]",l=RegExp("^"+o+o+"*"),u=RegExp(o+o+"*$"),c=function(t,e,r){var i={},o=s((function(){return!!a[t]()||"​"!="​"[t]()})),l=i[t]=o?e(h):a[t];r&&(i[r]=l),n(n.P+n.F*o,"String",i)},h=c.trim=function(t,e){return t=String(i(t)),1&e&&(t=t.replace(l,"")),2&e&&(t=t.replace(u,"")),t};t.exports=c},4644:t=>{t.exports="\t\n\v\f\r   ᠎             　\u2028\u2029\ufeff"},4193:(t,e,r)=>{var n,i,s,a=r(741),o=r(7242),l=r(639),u=r(2457),c=r(3816),h=c.process,d=c.setImmediate,f=c.clearImmediate,p=c.MessageChannel,g=c.Dispatch,v=0,m={},y="onreadystatechange",E=function(){var t=+this;if(m.hasOwnProperty(t)){var e=m[t];delete m[t],e()}},S=function(t){E.call(t.data)};d&&f||(d=function(t){for(var e=[],r=1;arguments.length>r;)e.push(arguments[r++]);return m[++v]=function(){o("function"==typeof t?t:Function(t),e)},n(v),v},f=function(t){delete m[t]},"process"==r(2032)(h)?n=function(t){h.nextTick(a(E,t,1))}:g&&g.now?n=function(t){g.now(a(E,t,1))}:p?(s=(i=new p).port2,i.port1.onmessage=S,n=a(s.postMessage,s,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(t){c.postMessage(t+"","*")},c.addEventListener("message",S,!1)):n=y in u("script")?function(t){l.appendChild(u("script"))[y]=function(){l.removeChild(this),E.call(t)}}:function(t){setTimeout(a(E,t,1),0)}),t.exports={set:d,clear:f}},2337:(t,e,r)=>{var n=r(1467),i=Math.max,s=Math.min;t.exports=function(t,e){return(t=n(t))<0?i(t+e,0):s(t,e)}},4843:(t,e,r)=>{var n=r(1467),i=r(875);t.exports=function(t){if(void 0===t)return 0;var e=n(t),r=i(e);if(e!==r)throw RangeError("Wrong length!");return r}},1467:t=>{var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},2110:(t,e,r)=>{var n=r(9797),i=r(1355);t.exports=function(t){return n(i(t))}},875:(t,e,r)=>{var n=r(1467),i=Math.min;t.exports=function(t){return t>0?i(n(t),9007199254740991):0}},508:(t,e,r)=>{var n=r(1355);t.exports=function(t){return Object(n(t))}},1689:(t,e,r)=>{var n=r(5286);t.exports=function(t,e){if(!n(t))return t;var r,i;if(e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;if("function"==typeof(r=t.valueOf)&&!n(i=r.call(t)))return i;if(!e&&"function"==typeof(r=t.toString)&&!n(i=r.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},8440:(t,e,r)=>{"use strict";if(r(7057)){var n=r(4461),i=r(3816),s=r(4253),a=r(2985),o=r(9383),l=r(1125),u=r(741),c=r(3328),h=r(681),d=r(7728),f=r(4408),p=r(1467),g=r(875),v=r(4843),m=r(2337),y=r(1689),E=r(9181),S=r(1488),b=r(5286),T=r(508),_=r(6555),A=r(2503),L=r(468),w=r(616).f,R=r(9002),k=r(3953),D=r(6314),I=r(50),P=r(9315),O=r(8364),C=r(6997),x=r(2803),M=r(7462),F=r(2974),N=r(6852),B=r(5216),U=r(9275),j=r(8693),H=U.f,G=j.f,V=i.RangeError,K=i.TypeError,$=i.Uint8Array,W="ArrayBuffer",q="Shared"+W,Y="BYTES_PER_ELEMENT",z="prototype",X=Array[z],J=l.ArrayBuffer,Q=l.DataView,Z=I(0),tt=I(2),et=I(3),rt=I(4),nt=I(5),it=I(6),st=P(!0),at=P(!1),ot=C.values,lt=C.keys,ut=C.entries,ct=X.lastIndexOf,ht=X.reduce,dt=X.reduceRight,ft=X.join,pt=X.sort,gt=X.slice,vt=X.toString,mt=X.toLocaleString,yt=D("iterator"),Et=D("toStringTag"),St=k("typed_constructor"),bt=k("def_constructor"),Tt=o.CONSTR,_t=o.TYPED,At=o.VIEW,Lt="Wrong length!",wt=I(1,(function(t,e){return Pt(O(t,t[bt]),e)})),Rt=s((function(){return 1===new $(new Uint16Array([1]).buffer)[0]})),kt=!!$&&!!$[z].set&&s((function(){new $(1).set({})})),Dt=function(t,e){var r=p(t);if(r<0||r%e)throw V("Wrong offset!");return r},It=function(t){if(b(t)&&_t in t)return t;throw K(t+" is not a typed array!")},Pt=function(t,e){if(!b(t)||!(St in t))throw K("It is not a typed array constructor!");return new t(e)},Ot=function(t,e){return Ct(O(t,t[bt]),e)},Ct=function(t,e){for(var r=0,n=e.length,i=Pt(t,n);n>r;)i[r]=e[r++];return i},xt=function(t,e,r){H(t,e,{get:function(){return this._d[r]}})},Mt=function(t){var e,r,n,i,s,a,o=T(t),l=arguments.length,c=l>1?arguments[1]:void 0,h=void 0!==c,d=R(o);if(null!=d&&!_(d)){for(a=d.call(o),n=[],e=0;!(s=a.next()).done;e++)n.push(s.value);o=n}for(h&&l>2&&(c=u(c,arguments[2],2)),e=0,r=g(o.length),i=Pt(this,r);r>e;e++)i[e]=h?c(o[e],e):o[e];return i},Ft=function(){for(var t=0,e=arguments.length,r=Pt(this,e);e>t;)r[t]=arguments[t++];return r},Nt=!!$&&s((function(){mt.call(new $(1))})),Bt=function(){return mt.apply(Nt?gt.call(It(this)):It(this),arguments)},Ut={copyWithin:function(t,e){return B.call(It(this),t,e,arguments.length>2?arguments[2]:void 0)},every:function(t){return rt(It(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return N.apply(It(this),arguments)},filter:function(t){return Ot(this,tt(It(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return nt(It(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return it(It(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){Z(It(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return at(It(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return st(It(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ft.apply(It(this),arguments)},lastIndexOf:function(t){return ct.apply(It(this),arguments)},map:function(t){return wt(It(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ht.apply(It(this),arguments)},reduceRight:function(t){return dt.apply(It(this),arguments)},reverse:function(){for(var t,e=this,r=It(e).length,n=Math.floor(r/2),i=0;i<n;)t=e[i],e[i++]=e[--r],e[r]=t;return e},some:function(t){return et(It(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return pt.call(It(this),t)},subarray:function(t,e){var r=It(this),n=r.length,i=m(t,n);return new(O(r,r[bt]))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,g((void 0===e?n:m(e,n))-i))}},jt=function(t,e){return Ot(this,gt.call(It(this),t,e))},Ht=function(t){It(this);var e=Dt(arguments[1],1),r=this.length,n=T(t),i=g(n.length),s=0;if(i+e>r)throw V(Lt);for(;s<i;)this[e+s]=n[s++]},Gt={entries:function(){return ut.call(It(this))},keys:function(){return lt.call(It(this))},values:function(){return ot.call(It(this))}},Vt=function(t,e){return b(t)&&t[_t]&&"symbol"!=typeof e&&e in t&&String(+e)==String(e)},Kt=function(t,e){return Vt(t,e=y(e,!0))?h(2,t[e]):G(t,e)},$t=function(t,e,r){return!(Vt(t,e=y(e,!0))&&b(r)&&E(r,"value"))||E(r,"get")||E(r,"set")||r.configurable||E(r,"writable")&&!r.writable||E(r,"enumerable")&&!r.enumerable?H(t,e,r):(t[e]=r.value,t)};Tt||(j.f=Kt,U.f=$t),a(a.S+a.F*!Tt,"Object",{getOwnPropertyDescriptor:Kt,defineProperty:$t}),s((function(){vt.call({})}))&&(vt=mt=function(){return ft.call(this)});var Wt=f({},Ut);f(Wt,Gt),d(Wt,yt,Gt.values),f(Wt,{slice:jt,set:Ht,constructor:function(){},toString:vt,toLocaleString:Bt}),xt(Wt,"buffer","b"),xt(Wt,"byteOffset","o"),xt(Wt,"byteLength","l"),xt(Wt,"length","e"),H(Wt,Et,{get:function(){return this[_t]}}),t.exports=function(t,e,r,l){var u=t+((l=!!l)?"Clamped":"")+"Array",h="get"+t,f="set"+t,p=i[u],m=p||{},y=p&&L(p),E=!p||!o.ABV,T={},_=p&&p[z],R=function(t,r){H(t,r,{get:function(){return function(t,r){var n=t._d;return n.v[h](r*e+n.o,Rt)}(this,r)},set:function(t){return function(t,r,n){var i=t._d;l&&(n=(n=Math.round(n))<0?0:n>255?255:255&n),i.v[f](r*e+i.o,n,Rt)}(this,r,t)},enumerable:!0})};E?(p=r((function(t,r,n,i){c(t,p,u,"_d");var s,a,o,l,h=0,f=0;if(b(r)){if(!(r instanceof J||(l=S(r))==W||l==q))return _t in r?Ct(p,r):Mt.call(p,r);s=r,f=Dt(n,e);var m=r.byteLength;if(void 0===i){if(m%e)throw V(Lt);if((a=m-f)<0)throw V(Lt)}else if((a=g(i)*e)+f>m)throw V(Lt);o=a/e}else o=v(r),s=new J(a=o*e);for(d(t,"_d",{b:s,o:f,l:a,e:o,v:new Q(s)});h<o;)R(t,h++)})),_=p[z]=A(Wt),d(_,"constructor",p)):s((function(){p(1)}))&&s((function(){new p(-1)}))&&M((function(t){new p,new p(null),new p(1.5),new p(t)}),!0)||(p=r((function(t,r,n,i){var s;return c(t,p,u),b(r)?r instanceof J||(s=S(r))==W||s==q?void 0!==i?new m(r,Dt(n,e),i):void 0!==n?new m(r,Dt(n,e)):new m(r):_t in r?Ct(p,r):Mt.call(p,r):new m(v(r))})),Z(y!==Function.prototype?w(m).concat(w(y)):w(m),(function(t){t in p||d(p,t,m[t])})),p[z]=_,n||(_.constructor=p));var k=_[yt],D=!!k&&("values"==k.name||null==k.name),I=Gt.values;d(p,St,!0),d(_,_t,u),d(_,At,!0),d(_,bt,p),(l?new p(1)[Et]==u:Et in _)||H(_,Et,{get:function(){return u}}),T[u]=p,a(a.G+a.W+a.F*(p!=m),T),a(a.S,u,{BYTES_PER_ELEMENT:e}),a(a.S+a.F*s((function(){m.of.call(p,1)})),u,{from:Mt,of:Ft}),Y in _||d(_,Y,e),a(a.P,u,Ut),F(u),a(a.P+a.F*kt,u,{set:Ht}),a(a.P+a.F*!D,u,Gt),n||_.toString==vt||(_.toString=vt),a(a.P+a.F*s((function(){new p(1).slice()})),u,{slice:jt}),a(a.P+a.F*(s((function(){return[1,2].toLocaleString()!=new p([1,2]).toLocaleString()}))||!s((function(){_.toLocaleString.call([1,2])}))),u,{toLocaleString:Bt}),x[u]=D?k:I,n||D||d(_,yt,I)}}else t.exports=function(){}},1125:(t,e,r)=>{"use strict";var n=r(3816),i=r(7057),s=r(4461),a=r(9383),o=r(7728),l=r(4408),u=r(4253),c=r(3328),h=r(1467),d=r(875),f=r(4843),p=r(616).f,g=r(9275).f,v=r(6852),m=r(2943),y="ArrayBuffer",E="DataView",S="prototype",b="Wrong index!",T=n[y],_=n[E],A=n.Math,L=n.RangeError,w=n.Infinity,R=T,k=A.abs,D=A.pow,I=A.floor,P=A.log,O=A.LN2,C="buffer",x="byteLength",M="byteOffset",F=i?"_b":C,N=i?"_l":x,B=i?"_o":M;function U(t,e,r){var n,i,s,a=new Array(r),o=8*r-e-1,l=(1<<o)-1,u=l>>1,c=23===e?D(2,-24)-D(2,-77):0,h=0,d=t<0||0===t&&1/t<0?1:0;for((t=k(t))!=t||t===w?(i=t!=t?1:0,n=l):(n=I(P(t)/O),t*(s=D(2,-n))<1&&(n--,s*=2),(t+=n+u>=1?c/s:c*D(2,1-u))*s>=2&&(n++,s/=2),n+u>=l?(i=0,n=l):n+u>=1?(i=(t*s-1)*D(2,e),n+=u):(i=t*D(2,u-1)*D(2,e),n=0));e>=8;a[h++]=255&i,i/=256,e-=8);for(n=n<<e|i,o+=e;o>0;a[h++]=255&n,n/=256,o-=8);return a[--h]|=128*d,a}function j(t,e,r){var n,i=8*r-e-1,s=(1<<i)-1,a=s>>1,o=i-7,l=r-1,u=t[l--],c=127&u;for(u>>=7;o>0;c=256*c+t[l],l--,o-=8);for(n=c&(1<<-o)-1,c>>=-o,o+=e;o>0;n=256*n+t[l],l--,o-=8);if(0===c)c=1-a;else{if(c===s)return n?NaN:u?-w:w;n+=D(2,e),c-=a}return(u?-1:1)*n*D(2,c-e)}function H(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function G(t){return[255&t]}function V(t){return[255&t,t>>8&255]}function K(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function $(t){return U(t,52,8)}function W(t){return U(t,23,4)}function q(t,e,r){g(t[S],e,{get:function(){return this[r]}})}function Y(t,e,r,n){var i=f(+r);if(i+e>t[N])throw L(b);var s=t[F]._b,a=i+t[B],o=s.slice(a,a+e);return n?o:o.reverse()}function z(t,e,r,n,i,s){var a=f(+r);if(a+e>t[N])throw L(b);for(var o=t[F]._b,l=a+t[B],u=n(+i),c=0;c<e;c++)o[l+c]=u[s?c:e-c-1]}if(a.ABV){if(!u((function(){T(1)}))||!u((function(){new T(-1)}))||u((function(){return new T,new T(1.5),new T(NaN),T.name!=y}))){for(var X,J=(T=function(t){return c(this,T),new R(f(t))})[S]=R[S],Q=p(R),Z=0;Q.length>Z;)(X=Q[Z++])in T||o(T,X,R[X]);s||(J.constructor=T)}var tt=new _(new T(2)),et=_[S].setInt8;tt.setInt8(0,2147483648),tt.setInt8(1,2147483649),!tt.getInt8(0)&&tt.getInt8(1)||l(_[S],{setInt8:function(t,e){et.call(this,t,e<<24>>24)},setUint8:function(t,e){et.call(this,t,e<<24>>24)}},!0)}else T=function(t){c(this,T,y);var e=f(t);this._b=v.call(new Array(e),0),this[N]=e},_=function(t,e,r){c(this,_,E),c(t,T,E);var n=t[N],i=h(e);if(i<0||i>n)throw L("Wrong offset!");if(i+(r=void 0===r?n-i:d(r))>n)throw L("Wrong length!");this[F]=t,this[B]=i,this[N]=r},i&&(q(T,x,"_l"),q(_,C,"_b"),q(_,x,"_l"),q(_,M,"_o")),l(_[S],{getInt8:function(t){return Y(this,1,t)[0]<<24>>24},getUint8:function(t){return Y(this,1,t)[0]},getInt16:function(t){var e=Y(this,2,t,arguments[1]);return(e[1]<<8|e[0])<<16>>16},getUint16:function(t){var e=Y(this,2,t,arguments[1]);return e[1]<<8|e[0]},getInt32:function(t){return H(Y(this,4,t,arguments[1]))},getUint32:function(t){return H(Y(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return j(Y(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return j(Y(this,8,t,arguments[1]),52,8)},setInt8:function(t,e){z(this,1,t,G,e)},setUint8:function(t,e){z(this,1,t,G,e)},setInt16:function(t,e){z(this,2,t,V,e,arguments[2])},setUint16:function(t,e){z(this,2,t,V,e,arguments[2])},setInt32:function(t,e){z(this,4,t,K,e,arguments[2])},setUint32:function(t,e){z(this,4,t,K,e,arguments[2])},setFloat32:function(t,e){z(this,4,t,W,e,arguments[2])},setFloat64:function(t,e){z(this,8,t,$,e,arguments[2])}});m(T,y),m(_,E),o(_[S],a.VIEW,!0),e[y]=T,e[E]=_},9383:(t,e,r)=>{for(var n,i=r(3816),s=r(7728),a=r(3953),o=a("typed_array"),l=a("view"),u=!(!i.ArrayBuffer||!i.DataView),c=u,h=0,d="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");h<9;)(n=i[d[h++]])?(s(n.prototype,o,!0),s(n.prototype,l,!0)):c=!1;t.exports={ABV:u,CONSTR:c,TYPED:o,VIEW:l}},3953:t=>{var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},575:(t,e,r)=>{var n=r(3816).navigator;t.exports=n&&n.userAgent||""},1616:(t,e,r)=>{var n=r(5286);t.exports=function(t,e){if(!n(t)||t._t!==e)throw TypeError("Incompatible receiver, "+e+" required!");return t}},6074:(t,e,r)=>{var n=r(3816),i=r(5645),s=r(4461),a=r(8787),o=r(9275).f;t.exports=function(t){var e=i.Symbol||(i.Symbol=s?{}:n.Symbol||{});"_"==t.charAt(0)||t in e||o(e,t,{value:a.f(t)})}},8787:(t,e,r)=>{e.f=r(6314)},6314:(t,e,r)=>{var n=r(3825)("wks"),i=r(3953),s=r(3816).Symbol,a="function"==typeof s;(t.exports=function(t){return n[t]||(n[t]=a&&s[t]||(a?s:i)("Symbol."+t))}).store=n},9002:(t,e,r)=>{var n=r(1488),i=r(6314)("iterator"),s=r(2803);t.exports=r(5645).getIteratorMethod=function(t){if(null!=t)return t[i]||t["@@iterator"]||s[n(t)]}},2e3:(t,e,r)=>{var n=r(2985);n(n.P,"Array",{copyWithin:r(5216)}),r(7722)("copyWithin")},5745:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(4);n(n.P+n.F*!r(7717)([].every,!0),"Array",{every:function(t){return i(this,t,arguments[1])}})},8977:(t,e,r)=>{var n=r(2985);n(n.P,"Array",{fill:r(6852)}),r(7722)("fill")},8837:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(2);n(n.P+n.F*!r(7717)([].filter,!0),"Array",{filter:function(t){return i(this,t,arguments[1])}})},4899:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(6),s="findIndex",a=!0;s in[]&&Array(1)[s]((function(){a=!1})),n(n.P+n.F*a,"Array",{findIndex:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(7722)(s)},2310:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(5),s="find",a=!0;s in[]&&Array(1)[s]((function(){a=!1})),n(n.P+n.F*a,"Array",{find:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(7722)(s)},4336:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(0),s=r(7717)([].forEach,!0);n(n.P+n.F*!s,"Array",{forEach:function(t){return i(this,t,arguments[1])}})},522:(t,e,r)=>{"use strict";var n=r(741),i=r(2985),s=r(508),a=r(8851),o=r(6555),l=r(875),u=r(2811),c=r(9002);i(i.S+i.F*!r(7462)((function(t){Array.from(t)})),"Array",{from:function(t){var e,r,i,h,d=s(t),f="function"==typeof this?this:Array,p=arguments.length,g=p>1?arguments[1]:void 0,v=void 0!==g,m=0,y=c(d);if(v&&(g=n(g,p>2?arguments[2]:void 0,2)),null==y||f==Array&&o(y))for(r=new f(e=l(d.length));e>m;m++)u(r,m,v?g(d[m],m):d[m]);else for(h=y.call(d),r=new f;!(i=h.next()).done;m++)u(r,m,v?a(h,g,[i.value,m],!0):i.value);return r.length=m,r}})},3369:(t,e,r)=>{"use strict";var n=r(2985),i=r(9315)(!1),s=[].indexOf,a=!!s&&1/[1].indexOf(1,-0)<0;n(n.P+n.F*(a||!r(7717)(s)),"Array",{indexOf:function(t){return a?s.apply(this,arguments)||0:i(this,t,arguments[1])}})},774:(t,e,r)=>{var n=r(2985);n(n.S,"Array",{isArray:r(4302)})},6997:(t,e,r)=>{"use strict";var n=r(7722),i=r(5436),s=r(2803),a=r(2110);t.exports=r(2923)(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,r=this._i++;return!t||r>=t.length?(this._t=void 0,i(1)):i(0,"keys"==e?r:"values"==e?t[r]:[r,t[r]])}),"values"),s.Arguments=s.Array,n("keys"),n("values"),n("entries")},7842:(t,e,r)=>{"use strict";var n=r(2985),i=r(2110),s=[].join;n(n.P+n.F*(r(9797)!=Object||!r(7717)(s)),"Array",{join:function(t){return s.call(i(this),void 0===t?",":t)}})},9564:(t,e,r)=>{"use strict";var n=r(2985),i=r(2110),s=r(1467),a=r(875),o=[].lastIndexOf,l=!!o&&1/[1].lastIndexOf(1,-0)<0;n(n.P+n.F*(l||!r(7717)(o)),"Array",{lastIndexOf:function(t){if(l)return o.apply(this,arguments)||0;var e=i(this),r=a(e.length),n=r-1;for(arguments.length>1&&(n=Math.min(n,s(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in e&&e[n]===t)return n||0;return-1}})},1802:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(1);n(n.P+n.F*!r(7717)([].map,!0),"Array",{map:function(t){return i(this,t,arguments[1])}})},8295:(t,e,r)=>{"use strict";var n=r(2985),i=r(2811);n(n.S+n.F*r(4253)((function(){function t(){}return!(Array.of.call(t)instanceof t)})),"Array",{of:function(){for(var t=0,e=arguments.length,r=new("function"==typeof this?this:Array)(e);e>t;)i(r,t,arguments[t++]);return r.length=e,r}})},3750:(t,e,r)=>{"use strict";var n=r(2985),i=r(7628);n(n.P+n.F*!r(7717)([].reduceRight,!0),"Array",{reduceRight:function(t){return i(this,t,arguments.length,arguments[1],!0)}})},3057:(t,e,r)=>{"use strict";var n=r(2985),i=r(7628);n(n.P+n.F*!r(7717)([].reduce,!0),"Array",{reduce:function(t){return i(this,t,arguments.length,arguments[1],!1)}})},110:(t,e,r)=>{"use strict";var n=r(2985),i=r(639),s=r(2032),a=r(2337),o=r(875),l=[].slice;n(n.P+n.F*r(4253)((function(){i&&l.call(i)})),"Array",{slice:function(t,e){var r=o(this.length),n=s(this);if(e=void 0===e?r:e,"Array"==n)return l.call(this,t,e);for(var i=a(t,r),u=a(e,r),c=o(u-i),h=new Array(c),d=0;d<c;d++)h[d]="String"==n?this.charAt(i+d):this[i+d];return h}})},6773:(t,e,r)=>{"use strict";var n=r(2985),i=r(50)(3);n(n.P+n.F*!r(7717)([].some,!0),"Array",{some:function(t){return i(this,t,arguments[1])}})},75:(t,e,r)=>{"use strict";var n=r(2985),i=r(4963),s=r(508),a=r(4253),o=[].sort,l=[1,2,3];n(n.P+n.F*(a((function(){l.sort(void 0)}))||!a((function(){l.sort(null)}))||!r(7717)(o)),"Array",{sort:function(t){return void 0===t?o.call(s(this)):o.call(s(this),i(t))}})},1842:(t,e,r)=>{r(2974)("Array")},1822:(t,e,r)=>{var n=r(2985);n(n.S,"Date",{now:function(){return(new Date).getTime()}})},1031:(t,e,r)=>{var n=r(2985),i=r(3537);n(n.P+n.F*(Date.prototype.toISOString!==i),"Date",{toISOString:i})},9977:(t,e,r)=>{"use strict";var n=r(2985),i=r(508),s=r(1689);n(n.P+n.F*r(4253)((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})})),"Date",{toJSON:function(t){var e=i(this),r=s(e);return"number"!=typeof r||isFinite(r)?e.toISOString():null}})},1560:(t,e,r)=>{var n=r(6314)("toPrimitive"),i=Date.prototype;n in i||r(7728)(i,n,r(870))},6331:(t,e,r)=>{var n=Date.prototype,i="Invalid Date",s="toString",a=n[s],o=n.getTime;new Date(NaN)+""!=i&&r(7234)(n,s,(function(){var t=o.call(this);return t==t?a.call(this):i}))},9730:(t,e,r)=>{var n=r(2985);n(n.P,"Function",{bind:r(4398)})},8377:(t,e,r)=>{"use strict";var n=r(5286),i=r(468),s=r(6314)("hasInstance"),a=Function.prototype;s in a||r(9275).f(a,s,{value:function(t){if("function"!=typeof this||!n(t))return!1;if(!n(this.prototype))return t instanceof this;for(;t=i(t);)if(this.prototype===t)return!0;return!1}})},6059:(t,e,r)=>{var n=r(9275).f,i=Function.prototype,s=/^\s*function ([^ (]*)/,a="name";a in i||r(7057)&&n(i,a,{configurable:!0,get:function(){try{return(""+this).match(s)[1]}catch(t){return""}}})},8416:(t,e,r)=>{"use strict";var n=r(9824),i=r(1616),s="Map";t.exports=r(5795)(s,(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{get:function(t){var e=n.getEntry(i(this,s),t);return e&&e.v},set:function(t,e){return n.def(i(this,s),0===t?0:t,e)}},n,!0)},6503:(t,e,r)=>{var n=r(2985),i=r(6206),s=Math.sqrt,a=Math.acosh;n(n.S+n.F*!(a&&710==Math.floor(a(Number.MAX_VALUE))&&a(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:i(t-1+s(t-1)*s(t+1))}})},6786:(t,e,r)=>{var n=r(2985),i=Math.asinh;n(n.S+n.F*!(i&&1/i(0)>0),"Math",{asinh:function t(e){return isFinite(e=+e)&&0!=e?e<0?-t(-e):Math.log(e+Math.sqrt(e*e+1)):e}})},932:(t,e,r)=>{var n=r(2985),i=Math.atanh;n(n.S+n.F*!(i&&1/i(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},7526:(t,e,r)=>{var n=r(2985),i=r(1801);n(n.S,"Math",{cbrt:function(t){return i(t=+t)*Math.pow(Math.abs(t),1/3)}})},1591:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},9073:(t,e,r)=>{var n=r(2985),i=Math.exp;n(n.S,"Math",{cosh:function(t){return(i(t=+t)+i(-t))/2}})},347:(t,e,r)=>{var n=r(2985),i=r(3086);n(n.S+n.F*(i!=Math.expm1),"Math",{expm1:i})},579:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{fround:r(4934)})},4669:(t,e,r)=>{var n=r(2985),i=Math.abs;n(n.S,"Math",{hypot:function(t,e){for(var r,n,s=0,a=0,o=arguments.length,l=0;a<o;)l<(r=i(arguments[a++]))?(s=s*(n=l/r)*n+1,l=r):s+=r>0?(n=r/l)*n:r;return l===1/0?1/0:l*Math.sqrt(s)}})},7710:(t,e,r)=>{var n=r(2985),i=Math.imul;n(n.S+n.F*r(4253)((function(){return-5!=i(4294967295,5)||2!=i.length})),"Math",{imul:function(t,e){var r=65535,n=+t,i=+e,s=r&n,a=r&i;return 0|s*a+((r&n>>>16)*a+s*(r&i>>>16)<<16>>>0)}})},5789:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},3514:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{log1p:r(6206)})},9978:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},8472:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{sign:r(1801)})},6946:(t,e,r)=>{var n=r(2985),i=r(3086),s=Math.exp;n(n.S+n.F*r(4253)((function(){return-2e-17!=!Math.sinh(-2e-17)})),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(i(t)-i(-t))/2:(s(t-1)-s(-t-1))*(Math.E/2)}})},5068:(t,e,r)=>{var n=r(2985),i=r(3086),s=Math.exp;n(n.S,"Math",{tanh:function(t){var e=i(t=+t),r=i(-t);return e==1/0?1:r==1/0?-1:(e-r)/(s(t)+s(-t))}})},413:(t,e,r)=>{var n=r(2985);n(n.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},1246:(t,e,r)=>{"use strict";var n=r(3816),i=r(9181),s=r(2032),a=r(266),o=r(1689),l=r(4253),u=r(616).f,c=r(8693).f,h=r(9275).f,d=r(9599).trim,f="Number",p=n[f],g=p,v=p.prototype,m=s(r(2503)(v))==f,y="trim"in String.prototype,E=function(t){var e=o(t,!1);if("string"==typeof e&&e.length>2){var r,n,i,s=(e=y?e.trim():d(e,3)).charCodeAt(0);if(43===s||45===s){if(88===(r=e.charCodeAt(2))||120===r)return NaN}else if(48===s){switch(e.charCodeAt(1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+e}for(var a,l=e.slice(2),u=0,c=l.length;u<c;u++)if((a=l.charCodeAt(u))<48||a>i)return NaN;return parseInt(l,n)}}return+e};if(!p(" 0o1")||!p("0b1")||p("+0x1")){p=function(t){var e=arguments.length<1?0:t,r=this;return r instanceof p&&(m?l((function(){v.valueOf.call(r)})):s(r)!=f)?a(new g(E(e)),r,p):E(e)};for(var S,b=r(7057)?u(g):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),T=0;b.length>T;T++)i(g,S=b[T])&&!i(p,S)&&h(p,S,c(g,S));p.prototype=v,v.constructor=p,r(7234)(n,f,p)}},5972:(t,e,r)=>{var n=r(2985);n(n.S,"Number",{EPSILON:Math.pow(2,-52)})},3403:(t,e,r)=>{var n=r(2985),i=r(3816).isFinite;n(n.S,"Number",{isFinite:function(t){return"number"==typeof t&&i(t)}})},2516:(t,e,r)=>{var n=r(2985);n(n.S,"Number",{isInteger:r(8367)})},9371:(t,e,r)=>{var n=r(2985);n(n.S,"Number",{isNaN:function(t){return t!=t}})},6479:(t,e,r)=>{var n=r(2985),i=r(8367),s=Math.abs;n(n.S,"Number",{isSafeInteger:function(t){return i(t)&&s(t)<=9007199254740991}})},1736:(t,e,r)=>{var n=r(2985);n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},1889:(t,e,r)=>{var n=r(2985);n(n.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},5177:(t,e,r)=>{var n=r(2985),i=r(7743);n(n.S+n.F*(Number.parseFloat!=i),"Number",{parseFloat:i})},6943:(t,e,r)=>{var n=r(2985),i=r(5960);n(n.S+n.F*(Number.parseInt!=i),"Number",{parseInt:i})},726:(t,e,r)=>{"use strict";var n=r(2985),i=r(1467),s=r(3365),a=r(8595),o=1..toFixed,l=Math.floor,u=[0,0,0,0,0,0],c="Number.toFixed: incorrect invocation!",h="0",d=function(t,e){for(var r=-1,n=e;++r<6;)n+=t*u[r],u[r]=n%1e7,n=l(n/1e7)},f=function(t){for(var e=6,r=0;--e>=0;)r+=u[e],u[e]=l(r/t),r=r%t*1e7},p=function(){for(var t=6,e="";--t>=0;)if(""!==e||0===t||0!==u[t]){var r=String(u[t]);e=""===e?r:e+a.call(h,7-r.length)+r}return e},g=function(t,e,r){return 0===e?r:e%2==1?g(t,e-1,r*t):g(t*t,e/2,r)};n(n.P+n.F*(!!o&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!r(4253)((function(){o.call({})}))),"Number",{toFixed:function(t){var e,r,n,o,l=s(this,c),u=i(t),v="",m=h;if(u<0||u>20)throw RangeError(c);if(l!=l)return"NaN";if(l<=-1e21||l>=1e21)return String(l);if(l<0&&(v="-",l=-l),l>1e-21)if(e=function(t){for(var e=0,r=t;r>=4096;)e+=12,r/=4096;for(;r>=2;)e+=1,r/=2;return e}(l*g(2,69,1))-69,r=e<0?l*g(2,-e,1):l/g(2,e,1),r*=4503599627370496,(e=52-e)>0){for(d(0,r),n=u;n>=7;)d(1e7,0),n-=7;for(d(g(10,n,1),0),n=e-1;n>=23;)f(1<<23),n-=23;f(1<<n),d(1,1),f(2),m=p()}else d(0,r),d(1<<-e,0),m=p()+a.call(h,u);return u>0?v+((o=m.length)<=u?"0."+a.call(h,u-o)+m:m.slice(0,o-u)+"."+m.slice(o-u)):v+m}})},1901:(t,e,r)=>{"use strict";var n=r(2985),i=r(4253),s=r(3365),a=1..toPrecision;n(n.P+n.F*(i((function(){return"1"!==a.call(1,void 0)}))||!i((function(){a.call({})}))),"Number",{toPrecision:function(t){var e=s(this,"Number#toPrecision: incorrect invocation!");return void 0===t?a.call(e):a.call(e,t)}})},5115:(t,e,r)=>{var n=r(2985);n(n.S+n.F,"Object",{assign:r(5345)})},8132:(t,e,r)=>{var n=r(2985);n(n.S,"Object",{create:r(2503)})},7470:(t,e,r)=>{var n=r(2985);n(n.S+n.F*!r(7057),"Object",{defineProperties:r(5588)})},8388:(t,e,r)=>{var n=r(2985);n(n.S+n.F*!r(7057),"Object",{defineProperty:r(9275).f})},9375:(t,e,r)=>{var n=r(5286),i=r(4728).onFreeze;r(3160)("freeze",(function(t){return function(e){return t&&n(e)?t(i(e)):e}}))},4882:(t,e,r)=>{var n=r(2110),i=r(8693).f;r(3160)("getOwnPropertyDescriptor",(function(){return function(t,e){return i(n(t),e)}}))},9622:(t,e,r)=>{r(3160)("getOwnPropertyNames",(function(){return r(9327).f}))},1520:(t,e,r)=>{var n=r(508),i=r(468);r(3160)("getPrototypeOf",(function(){return function(t){return i(n(t))}}))},9892:(t,e,r)=>{var n=r(5286);r(3160)("isExtensible",(function(t){return function(e){return!!n(e)&&(!t||t(e))}}))},4157:(t,e,r)=>{var n=r(5286);r(3160)("isFrozen",(function(t){return function(e){return!n(e)||!!t&&t(e)}}))},5095:(t,e,r)=>{var n=r(5286);r(3160)("isSealed",(function(t){return function(e){return!n(e)||!!t&&t(e)}}))},9176:(t,e,r)=>{var n=r(2985);n(n.S,"Object",{is:r(7195)})},7476:(t,e,r)=>{var n=r(508),i=r(7184);r(3160)("keys",(function(){return function(t){return i(n(t))}}))},4672:(t,e,r)=>{var n=r(5286),i=r(4728).onFreeze;r(3160)("preventExtensions",(function(t){return function(e){return t&&n(e)?t(i(e)):e}}))},3533:(t,e,r)=>{var n=r(5286),i=r(4728).onFreeze;r(3160)("seal",(function(t){return function(e){return t&&n(e)?t(i(e)):e}}))},8838:(t,e,r)=>{var n=r(2985);n(n.S,"Object",{setPrototypeOf:r(7375).set})},6253:(t,e,r)=>{"use strict";var n=r(1488),i={};i[r(6314)("toStringTag")]="z",i+""!="[object z]"&&r(7234)(Object.prototype,"toString",(function(){return"[object "+n(this)+"]"}),!0)},4299:(t,e,r)=>{var n=r(2985),i=r(7743);n(n.G+n.F*(parseFloat!=i),{parseFloat:i})},1084:(t,e,r)=>{var n=r(2985),i=r(5960);n(n.G+n.F*(parseInt!=i),{parseInt:i})},851:(t,e,r)=>{"use strict";var n,i,s,a,o=r(4461),l=r(3816),u=r(741),c=r(1488),h=r(2985),d=r(5286),f=r(4963),p=r(3328),g=r(3531),v=r(8364),m=r(4193).set,y=r(4351)(),E=r(3499),S=r(188),b=r(575),T=r(94),_="Promise",A=l.TypeError,L=l.process,w=L&&L.versions,R=w&&w.v8||"",k=l[_],D="process"==c(L),I=function(){},P=i=E.f,O=!!function(){try{var t=k.resolve(1),e=(t.constructor={})[r(6314)("species")]=function(t){t(I,I)};return(D||"function"==typeof PromiseRejectionEvent)&&t.then(I)instanceof e&&0!==R.indexOf("6.6")&&-1===b.indexOf("Chrome/66")}catch(t){}}(),C=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},x=function(t,e){if(!t._n){t._n=!0;var r=t._c;y((function(){for(var n=t._v,i=1==t._s,s=0,a=function(e){var r,s,a,o=i?e.ok:e.fail,l=e.resolve,u=e.reject,c=e.domain;try{o?(i||(2==t._h&&N(t),t._h=1),!0===o?r=n:(c&&c.enter(),r=o(n),c&&(c.exit(),a=!0)),r===e.promise?u(A("Promise-chain cycle")):(s=C(r))?s.call(r,l,u):l(r)):u(n)}catch(t){c&&!a&&c.exit(),u(t)}};r.length>s;)a(r[s++]);t._c=[],t._n=!1,e&&!t._h&&M(t)}))}},M=function(t){m.call(l,(function(){var e,r,n,i=t._v,s=F(t);if(s&&(e=S((function(){D?L.emit("unhandledRejection",i,t):(r=l.onunhandledrejection)?r({promise:t,reason:i}):(n=l.console)&&n.error&&n.error("Unhandled promise rejection",i)})),t._h=D||F(t)?2:1),t._a=void 0,s&&e.e)throw e.v}))},F=function(t){return 1!==t._h&&0===(t._a||t._c).length},N=function(t){m.call(l,(function(){var e;D?L.emit("rejectionHandled",t):(e=l.onrejectionhandled)&&e({promise:t,reason:t._v})}))},B=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),x(e,!0))},U=function(t){var e,r=this;if(!r._d){r._d=!0,r=r._w||r;try{if(r===t)throw A("Promise can't be resolved itself");(e=C(t))?y((function(){var n={_w:r,_d:!1};try{e.call(t,u(U,n,1),u(B,n,1))}catch(t){B.call(n,t)}})):(r._v=t,r._s=1,x(r,!1))}catch(t){B.call({_w:r,_d:!1},t)}}};O||(k=function(t){p(this,k,_,"_h"),f(t),n.call(this);try{t(u(U,this,1),u(B,this,1))}catch(t){B.call(this,t)}},(n=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=r(4408)(k.prototype,{then:function(t,e){var r=P(v(this,k));return r.ok="function"!=typeof t||t,r.fail="function"==typeof e&&e,r.domain=D?L.domain:void 0,this._c.push(r),this._a&&this._a.push(r),this._s&&x(this,!1),r.promise},catch:function(t){return this.then(void 0,t)}}),s=function(){var t=new n;this.promise=t,this.resolve=u(U,t,1),this.reject=u(B,t,1)},E.f=P=function(t){return t===k||t===a?new s(t):i(t)}),h(h.G+h.W+h.F*!O,{Promise:k}),r(2943)(k,_),r(2974)(_),a=r(5645)[_],h(h.S+h.F*!O,_,{reject:function(t){var e=P(this);return(0,e.reject)(t),e.promise}}),h(h.S+h.F*(o||!O),_,{resolve:function(t){return T(o&&this===a?k:this,t)}}),h(h.S+h.F*!(O&&r(7462)((function(t){k.all(t).catch(I)}))),_,{all:function(t){var e=this,r=P(e),n=r.resolve,i=r.reject,s=S((function(){var r=[],s=0,a=1;g(t,!1,(function(t){var o=s++,l=!1;r.push(void 0),a++,e.resolve(t).then((function(t){l||(l=!0,r[o]=t,--a||n(r))}),i)})),--a||n(r)}));return s.e&&i(s.v),r.promise},race:function(t){var e=this,r=P(e),n=r.reject,i=S((function(){g(t,!1,(function(t){e.resolve(t).then(r.resolve,n)}))}));return i.e&&n(i.v),r.promise}})},1572:(t,e,r)=>{var n=r(2985),i=r(4963),s=r(7007),a=(r(3816).Reflect||{}).apply,o=Function.apply;n(n.S+n.F*!r(4253)((function(){a((function(){}))})),"Reflect",{apply:function(t,e,r){var n=i(t),l=s(r);return a?a(n,e,l):o.call(n,e,l)}})},2139:(t,e,r)=>{var n=r(2985),i=r(2503),s=r(4963),a=r(7007),o=r(5286),l=r(4253),u=r(4398),c=(r(3816).Reflect||{}).construct,h=l((function(){function t(){}return!(c((function(){}),[],t)instanceof t)})),d=!l((function(){c((function(){}))}));n(n.S+n.F*(h||d),"Reflect",{construct:function(t,e){s(t),a(e);var r=arguments.length<3?t:s(arguments[2]);if(d&&!h)return c(t,e,r);if(t==r){switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3])}var n=[null];return n.push.apply(n,e),new(u.apply(t,n))}var l=r.prototype,f=i(o(l)?l:Object.prototype),p=Function.apply.call(t,f,e);return o(p)?p:f}})},685:(t,e,r)=>{var n=r(9275),i=r(2985),s=r(7007),a=r(1689);i(i.S+i.F*r(4253)((function(){Reflect.defineProperty(n.f({},1,{value:1}),1,{value:2})})),"Reflect",{defineProperty:function(t,e,r){s(t),e=a(e,!0),s(r);try{return n.f(t,e,r),!0}catch(t){return!1}}})},5535:(t,e,r)=>{var n=r(2985),i=r(8693).f,s=r(7007);n(n.S,"Reflect",{deleteProperty:function(t,e){var r=i(s(t),e);return!(r&&!r.configurable)&&delete t[e]}})},7347:(t,e,r)=>{"use strict";var n=r(2985),i=r(7007),s=function(t){this._t=i(t),this._i=0;var e,r=this._k=[];for(e in t)r.push(e)};r(9988)(s,"Object",(function(){var t,e=this,r=e._k;do{if(e._i>=r.length)return{value:void 0,done:!0}}while(!((t=r[e._i++])in e._t));return{value:t,done:!1}})),n(n.S,"Reflect",{enumerate:function(t){return new s(t)}})},6633:(t,e,r)=>{var n=r(8693),i=r(2985),s=r(7007);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(t,e){return n.f(s(t),e)}})},8989:(t,e,r)=>{var n=r(2985),i=r(468),s=r(7007);n(n.S,"Reflect",{getPrototypeOf:function(t){return i(s(t))}})},3049:(t,e,r)=>{var n=r(8693),i=r(468),s=r(9181),a=r(2985),o=r(5286),l=r(7007);a(a.S,"Reflect",{get:function t(e,r){var a,u,c=arguments.length<3?e:arguments[2];return l(e)===c?e[r]:(a=n.f(e,r))?s(a,"value")?a.value:void 0!==a.get?a.get.call(c):void 0:o(u=i(e))?t(u,r,c):void 0}})},8270:(t,e,r)=>{var n=r(2985);n(n.S,"Reflect",{has:function(t,e){return e in t}})},4510:(t,e,r)=>{var n=r(2985),i=r(7007),s=Object.isExtensible;n(n.S,"Reflect",{isExtensible:function(t){return i(t),!s||s(t)}})},3984:(t,e,r)=>{var n=r(2985);n(n.S,"Reflect",{ownKeys:r(7643)})},5769:(t,e,r)=>{var n=r(2985),i=r(7007),s=Object.preventExtensions;n(n.S,"Reflect",{preventExtensions:function(t){i(t);try{return s&&s(t),!0}catch(t){return!1}}})},6014:(t,e,r)=>{var n=r(2985),i=r(7375);i&&n(n.S,"Reflect",{setPrototypeOf:function(t,e){i.check(t,e);try{return i.set(t,e),!0}catch(t){return!1}}})},55:(t,e,r)=>{var n=r(9275),i=r(8693),s=r(468),a=r(9181),o=r(2985),l=r(681),u=r(7007),c=r(5286);o(o.S,"Reflect",{set:function t(e,r,o){var h,d,f=arguments.length<4?e:arguments[3],p=i.f(u(e),r);if(!p){if(c(d=s(e)))return t(d,r,o,f);p=l(0)}if(a(p,"value")){if(!1===p.writable||!c(f))return!1;if(h=i.f(f,r)){if(h.get||h.set||!1===h.writable)return!1;h.value=o,n.f(f,r,h)}else n.f(f,r,l(0,o));return!0}return void 0!==p.set&&(p.set.call(f,o),!0)}})},3946:(t,e,r)=>{var n=r(3816),i=r(266),s=r(9275).f,a=r(616).f,o=r(5364),l=r(3218),u=n.RegExp,c=u,h=u.prototype,d=/a/g,f=/a/g,p=new u(d)!==d;if(r(7057)&&(!p||r(4253)((function(){return f[r(6314)("match")]=!1,u(d)!=d||u(f)==f||"/a/i"!=u(d,"i")})))){u=function(t,e){var r=this instanceof u,n=o(t),s=void 0===e;return!r&&n&&t.constructor===u&&s?t:i(p?new c(n&&!s?t.source:t,e):c((n=t instanceof u)?t.source:t,n&&s?l.call(t):e),r?this:h,u)};for(var g=function(t){t in u||s(u,t,{configurable:!0,get:function(){return c[t]},set:function(e){c[t]=e}})},v=a(c),m=0;v.length>m;)g(v[m++]);h.constructor=u,u.prototype=h,r(7234)(n,"RegExp",u)}r(2974)("RegExp")},8269:(t,e,r)=>{"use strict";var n=r(1165);r(2985)({target:"RegExp",proto:!0,forced:n!==/./.exec},{exec:n})},6774:(t,e,r)=>{r(7057)&&"g"!=/./g.flags&&r(9275).f(RegExp.prototype,"flags",{configurable:!0,get:r(3218)})},1466:(t,e,r)=>{"use strict";var n=r(7007),i=r(875),s=r(6793),a=r(7787);r(8082)("match",1,(function(t,e,r,o){return[function(r){var n=t(this),i=null==r?void 0:r[e];return void 0!==i?i.call(r,n):new RegExp(r)[e](String(n))},function(t){var e=o(r,t,this);if(e.done)return e.value;var l=n(t),u=String(this);if(!l.global)return a(l,u);var c=l.unicode;l.lastIndex=0;for(var h,d=[],f=0;null!==(h=a(l,u));){var p=String(h[0]);d[f]=p,""===p&&(l.lastIndex=s(u,i(l.lastIndex),c)),f++}return 0===f?null:d}]}))},9357:(t,e,r)=>{"use strict";var n=r(7007),i=r(508),s=r(875),a=r(1467),o=r(6793),l=r(7787),u=Math.max,c=Math.min,h=Math.floor,d=/\$([$&`']|\d\d?|<[^>]*>)/g,f=/\$([$&`']|\d\d?)/g;r(8082)("replace",2,(function(t,e,r,p){return[function(n,i){var s=t(this),a=null==n?void 0:n[e];return void 0!==a?a.call(n,s,i):r.call(String(s),n,i)},function(t,e){var i=p(r,t,this,e);if(i.done)return i.value;var h=n(t),d=String(this),f="function"==typeof e;f||(e=String(e));var v=h.global;if(v){var m=h.unicode;h.lastIndex=0}for(var y=[];;){var E=l(h,d);if(null===E)break;if(y.push(E),!v)break;""===String(E[0])&&(h.lastIndex=o(d,s(h.lastIndex),m))}for(var S,b="",T=0,_=0;_<y.length;_++){E=y[_];for(var A=String(E[0]),L=u(c(a(E.index),d.length),0),w=[],R=1;R<E.length;R++)w.push(void 0===(S=E[R])?S:String(S));var k=E.groups;if(f){var D=[A].concat(w,L,d);void 0!==k&&D.push(k);var I=String(e.apply(void 0,D))}else I=g(A,d,L,w,k,e);L>=T&&(b+=d.slice(T,L)+I,T=L+A.length)}return b+d.slice(T)}];function g(t,e,n,s,a,o){var l=n+t.length,u=s.length,c=f;return void 0!==a&&(a=i(a),c=d),r.call(o,c,(function(r,i){var o;switch(i.charAt(0)){case"$":return"$";case"&":return t;case"`":return e.slice(0,n);case"'":return e.slice(l);case"<":o=a[i.slice(1,-1)];break;default:var c=+i;if(0===c)return r;if(c>u){var d=h(c/10);return 0===d?r:d<=u?void 0===s[d-1]?i.charAt(1):s[d-1]+i.charAt(1):r}o=s[c-1]}return void 0===o?"":o}))}}))},6142:(t,e,r)=>{"use strict";var n=r(7007),i=r(7195),s=r(7787);r(8082)("search",1,(function(t,e,r,a){return[function(r){var n=t(this),i=null==r?void 0:r[e];return void 0!==i?i.call(r,n):new RegExp(r)[e](String(n))},function(t){var e=a(r,t,this);if(e.done)return e.value;var o=n(t),l=String(this),u=o.lastIndex;i(u,0)||(o.lastIndex=0);var c=s(o,l);return i(o.lastIndex,u)||(o.lastIndex=u),null===c?-1:c.index}]}))},1876:(t,e,r)=>{"use strict";var n=r(5364),i=r(7007),s=r(8364),a=r(6793),o=r(875),l=r(7787),u=r(1165),c=r(4253),h=Math.min,d=[].push,f="split",p="length",g="lastIndex",v=4294967295,m=!c((function(){RegExp(v,"y")}));r(8082)("split",2,(function(t,e,r,c){var y;return y="c"=="abbc"[f](/(b)*/)[1]||4!="test"[f](/(?:)/,-1)[p]||2!="ab"[f](/(?:ab)*/)[p]||4!="."[f](/(.?)(.?)/)[p]||"."[f](/()()/)[p]>1||""[f](/.?/)[p]?function(t,e){var i=String(this);if(void 0===t&&0===e)return[];if(!n(t))return r.call(i,t,e);for(var s,a,o,l=[],c=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),h=0,f=void 0===e?v:e>>>0,m=new RegExp(t.source,c+"g");(s=u.call(m,i))&&!((a=m[g])>h&&(l.push(i.slice(h,s.index)),s[p]>1&&s.index<i[p]&&d.apply(l,s.slice(1)),o=s[0][p],h=a,l[p]>=f));)m[g]===s.index&&m[g]++;return h===i[p]?!o&&m.test("")||l.push(""):l.push(i.slice(h)),l[p]>f?l.slice(0,f):l}:"0"[f](void 0,0)[p]?function(t,e){return void 0===t&&0===e?[]:r.call(this,t,e)}:r,[function(r,n){var i=t(this),s=null==r?void 0:r[e];return void 0!==s?s.call(r,i,n):y.call(String(i),r,n)},function(t,e){var n=c(y,t,this,e,y!==r);if(n.done)return n.value;var u=i(t),d=String(this),f=s(u,RegExp),p=u.unicode,g=(u.ignoreCase?"i":"")+(u.multiline?"m":"")+(u.unicode?"u":"")+(m?"y":"g"),E=new f(m?u:"^(?:"+u.source+")",g),S=void 0===e?v:e>>>0;if(0===S)return[];if(0===d.length)return null===l(E,d)?[d]:[];for(var b=0,T=0,_=[];T<d.length;){E.lastIndex=m?T:0;var A,L=l(E,m?d:d.slice(T));if(null===L||(A=h(o(E.lastIndex+(m?0:T)),d.length))===b)T=a(d,T,p);else{if(_.push(d.slice(b,T)),_.length===S)return _;for(var w=1;w<=L.length-1;w++)if(_.push(L[w]),_.length===S)return _;T=b=A}}return _.push(d.slice(b)),_}]}))},6108:(t,e,r)=>{"use strict";r(6774);var n=r(7007),i=r(3218),s=r(7057),a="toString",o=/./[a],l=function(t){r(7234)(RegExp.prototype,a,t,!0)};r(4253)((function(){return"/a/b"!=o.call({source:"a",flags:"b"})}))?l((function(){var t=n(this);return"/".concat(t.source,"/","flags"in t?t.flags:!s&&t instanceof RegExp?i.call(t):void 0)})):o.name!=a&&l((function(){return o.call(this)}))},8184:(t,e,r)=>{"use strict";var n=r(9824),i=r(1616);t.exports=r(5795)("Set",(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return n.def(i(this,"Set"),t=0===t?0:t,t)}},n)},856:(t,e,r)=>{"use strict";r(9395)("anchor",(function(t){return function(e){return t(this,"a","name",e)}}))},703:(t,e,r)=>{"use strict";r(9395)("big",(function(t){return function(){return t(this,"big","","")}}))},1539:(t,e,r)=>{"use strict";r(9395)("blink",(function(t){return function(){return t(this,"blink","","")}}))},5292:(t,e,r)=>{"use strict";r(9395)("bold",(function(t){return function(){return t(this,"b","","")}}))},9539:(t,e,r)=>{"use strict";var n=r(2985),i=r(4496)(!1);n(n.P,"String",{codePointAt:function(t){return i(this,t)}})},6620:(t,e,r)=>{"use strict";var n=r(2985),i=r(875),s=r(2094),a="endsWith",o=""[a];n(n.P+n.F*r(8852)(a),"String",{endsWith:function(t){var e=s(this,t,a),r=arguments.length>1?arguments[1]:void 0,n=i(e.length),l=void 0===r?n:Math.min(i(r),n),u=String(t);return o?o.call(e,u,l):e.slice(l-u.length,l)===u}})},6629:(t,e,r)=>{"use strict";r(9395)("fixed",(function(t){return function(){return t(this,"tt","","")}}))},3694:(t,e,r)=>{"use strict";r(9395)("fontcolor",(function(t){return function(e){return t(this,"font","color",e)}}))},7648:(t,e,r)=>{"use strict";r(9395)("fontsize",(function(t){return function(e){return t(this,"font","size",e)}}))},191:(t,e,r)=>{var n=r(2985),i=r(2337),s=String.fromCharCode,a=String.fromCodePoint;n(n.S+n.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,r=[],n=arguments.length,a=0;n>a;){if(e=+arguments[a++],i(e,1114111)!==e)throw RangeError(e+" is not a valid code point");r.push(e<65536?s(e):s(55296+((e-=65536)>>10),e%1024+56320))}return r.join("")}})},2850:(t,e,r)=>{"use strict";var n=r(2985),i=r(2094),s="includes";n(n.P+n.F*r(8852)(s),"String",{includes:function(t){return!!~i(this,t,s).indexOf(t,arguments.length>1?arguments[1]:void 0)}})},7795:(t,e,r)=>{"use strict";r(9395)("italics",(function(t){return function(){return t(this,"i","","")}}))},9115:(t,e,r)=>{"use strict";var n=r(4496)(!0);r(2923)(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,r=this._i;return r>=e.length?{value:void 0,done:!0}:(t=n(e,r),this._i+=t.length,{value:t,done:!1})}))},4531:(t,e,r)=>{"use strict";r(9395)("link",(function(t){return function(e){return t(this,"a","href",e)}}))},8306:(t,e,r)=>{var n=r(2985),i=r(2110),s=r(875);n(n.S,"String",{raw:function(t){for(var e=i(t.raw),r=s(e.length),n=arguments.length,a=[],o=0;r>o;)a.push(String(e[o++])),o<n&&a.push(String(arguments[o]));return a.join("")}})},823:(t,e,r)=>{var n=r(2985);n(n.P,"String",{repeat:r(8595)})},3605:(t,e,r)=>{"use strict";r(9395)("small",(function(t){return function(){return t(this,"small","","")}}))},7732:(t,e,r)=>{"use strict";var n=r(2985),i=r(875),s=r(2094),a="startsWith",o=""[a];n(n.P+n.F*r(8852)(a),"String",{startsWith:function(t){var e=s(this,t,a),r=i(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),n=String(t);return o?o.call(e,n,r):e.slice(r,r+n.length)===n}})},6780:(t,e,r)=>{"use strict";r(9395)("strike",(function(t){return function(){return t(this,"strike","","")}}))},9937:(t,e,r)=>{"use strict";r(9395)("sub",(function(t){return function(){return t(this,"sub","","")}}))},511:(t,e,r)=>{"use strict";r(9395)("sup",(function(t){return function(){return t(this,"sup","","")}}))},4564:(t,e,r)=>{"use strict";r(9599)("trim",(function(t){return function(){return t(this,3)}}))},5767:(t,e,r)=>{"use strict";var n=r(3816),i=r(9181),s=r(7057),a=r(2985),o=r(7234),l=r(4728).KEY,u=r(4253),c=r(3825),h=r(2943),d=r(3953),f=r(6314),p=r(8787),g=r(6074),v=r(5541),m=r(4302),y=r(7007),E=r(5286),S=r(508),b=r(2110),T=r(1689),_=r(681),A=r(2503),L=r(9327),w=r(8693),R=r(4548),k=r(9275),D=r(7184),I=w.f,P=k.f,O=L.f,C=n.Symbol,x=n.JSON,M=x&&x.stringify,F="prototype",N=f("_hidden"),B=f("toPrimitive"),U={}.propertyIsEnumerable,j=c("symbol-registry"),H=c("symbols"),G=c("op-symbols"),V=Object[F],K="function"==typeof C&&!!R.f,$=n.QObject,W=!$||!$[F]||!$[F].findChild,q=s&&u((function(){return 7!=A(P({},"a",{get:function(){return P(this,"a",{value:7}).a}})).a}))?function(t,e,r){var n=I(V,e);n&&delete V[e],P(t,e,r),n&&t!==V&&P(V,e,n)}:P,Y=function(t){var e=H[t]=A(C[F]);return e._k=t,e},z=K&&"symbol"==typeof C.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof C},X=function(t,e,r){return t===V&&X(G,e,r),y(t),e=T(e,!0),y(r),i(H,e)?(r.enumerable?(i(t,N)&&t[N][e]&&(t[N][e]=!1),r=A(r,{enumerable:_(0,!1)})):(i(t,N)||P(t,N,_(1,{})),t[N][e]=!0),q(t,e,r)):P(t,e,r)},J=function(t,e){y(t);for(var r,n=v(e=b(e)),i=0,s=n.length;s>i;)X(t,r=n[i++],e[r]);return t},Q=function(t){var e=U.call(this,t=T(t,!0));return!(this===V&&i(H,t)&&!i(G,t))&&(!(e||!i(this,t)||!i(H,t)||i(this,N)&&this[N][t])||e)},Z=function(t,e){if(t=b(t),e=T(e,!0),t!==V||!i(H,e)||i(G,e)){var r=I(t,e);return!r||!i(H,e)||i(t,N)&&t[N][e]||(r.enumerable=!0),r}},tt=function(t){for(var e,r=O(b(t)),n=[],s=0;r.length>s;)i(H,e=r[s++])||e==N||e==l||n.push(e);return n},et=function(t){for(var e,r=t===V,n=O(r?G:b(t)),s=[],a=0;n.length>a;)!i(H,e=n[a++])||r&&!i(V,e)||s.push(H[e]);return s};K||(o((C=function(){if(this instanceof C)throw TypeError("Symbol is not a constructor!");var t=d(arguments.length>0?arguments[0]:void 0),e=function(r){this===V&&e.call(G,r),i(this,N)&&i(this[N],t)&&(this[N][t]=!1),q(this,t,_(1,r))};return s&&W&&q(V,t,{configurable:!0,set:e}),Y(t)})[F],"toString",(function(){return this._k})),w.f=Z,k.f=X,r(616).f=L.f=tt,r(4682).f=Q,R.f=et,s&&!r(4461)&&o(V,"propertyIsEnumerable",Q,!0),p.f=function(t){return Y(f(t))}),a(a.G+a.W+a.F*!K,{Symbol:C});for(var rt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;rt.length>nt;)f(rt[nt++]);for(var it=D(f.store),st=0;it.length>st;)g(it[st++]);a(a.S+a.F*!K,"Symbol",{for:function(t){return i(j,t+="")?j[t]:j[t]=C(t)},keyFor:function(t){if(!z(t))throw TypeError(t+" is not a symbol!");for(var e in j)if(j[e]===t)return e},useSetter:function(){W=!0},useSimple:function(){W=!1}}),a(a.S+a.F*!K,"Object",{create:function(t,e){return void 0===e?A(t):J(A(t),e)},defineProperty:X,defineProperties:J,getOwnPropertyDescriptor:Z,getOwnPropertyNames:tt,getOwnPropertySymbols:et});var at=u((function(){R.f(1)}));a(a.S+a.F*at,"Object",{getOwnPropertySymbols:function(t){return R.f(S(t))}}),x&&a(a.S+a.F*(!K||u((function(){var t=C();return"[null]"!=M([t])||"{}"!=M({a:t})||"{}"!=M(Object(t))}))),"JSON",{stringify:function(t){for(var e,r,n=[t],i=1;arguments.length>i;)n.push(arguments[i++]);if(r=e=n[1],(E(e)||void 0!==t)&&!z(t))return m(e)||(e=function(t,e){if("function"==typeof r&&(e=r.call(this,t,e)),!z(e))return e}),n[1]=e,M.apply(x,n)}}),C[F][B]||r(7728)(C[F],B,C[F].valueOf),h(C,"Symbol"),h(Math,"Math",!0),h(n.JSON,"JSON",!0)},142:(t,e,r)=>{"use strict";var n=r(2985),i=r(9383),s=r(1125),a=r(7007),o=r(2337),l=r(875),u=r(5286),c=r(3816).ArrayBuffer,h=r(8364),d=s.ArrayBuffer,f=s.DataView,p=i.ABV&&c.isView,g=d.prototype.slice,v=i.VIEW,m="ArrayBuffer";n(n.G+n.W+n.F*(c!==d),{ArrayBuffer:d}),n(n.S+n.F*!i.CONSTR,m,{isView:function(t){return p&&p(t)||u(t)&&v in t}}),n(n.P+n.U+n.F*r(4253)((function(){return!new d(2).slice(1,void 0).byteLength})),m,{slice:function(t,e){if(void 0!==g&&void 0===e)return g.call(a(this),t);for(var r=a(this).byteLength,n=o(t,r),i=o(void 0===e?r:e,r),s=new(h(this,d))(l(i-n)),u=new f(this),c=new f(s),p=0;n<i;)c.setUint8(p++,u.getUint8(n++));return s}}),r(2974)(m)},1786:(t,e,r)=>{var n=r(2985);n(n.G+n.W+n.F*!r(9383).ABV,{DataView:r(1125).DataView})},162:(t,e,r)=>{r(8440)("Float32",4,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},3834:(t,e,r)=>{r(8440)("Float64",8,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},4821:(t,e,r)=>{r(8440)("Int16",2,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},1303:(t,e,r)=>{r(8440)("Int32",4,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},5368:(t,e,r)=>{r(8440)("Int8",1,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},9103:(t,e,r)=>{r(8440)("Uint16",2,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},3318:(t,e,r)=>{r(8440)("Uint32",4,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},6964:(t,e,r)=>{r(8440)("Uint8",1,(function(t){return function(e,r,n){return t(this,e,r,n)}}))},2152:(t,e,r)=>{r(8440)("Uint8",1,(function(t){return function(e,r,n){return t(this,e,r,n)}}),!0)},147:(t,e,r)=>{"use strict";var n,i=r(3816),s=r(50)(0),a=r(7234),o=r(4728),l=r(5345),u=r(3657),c=r(5286),h=r(1616),d=r(1616),f=!i.ActiveXObject&&"ActiveXObject"in i,p="WeakMap",g=o.getWeak,v=Object.isExtensible,m=u.ufstore,y=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},E={get:function(t){if(c(t)){var e=g(t);return!0===e?m(h(this,p)).get(t):e?e[this._i]:void 0}},set:function(t,e){return u.def(h(this,p),t,e)}},S=t.exports=r(5795)(p,y,E,u,!0,!0);d&&f&&(l((n=u.getConstructor(y,p)).prototype,E),o.NEED=!0,s(["delete","has","get","set"],(function(t){var e=S.prototype,r=e[t];a(e,t,(function(e,i){if(c(e)&&!v(e)){this._f||(this._f=new n);var s=this._f[t](e,i);return"set"==t?this:s}return r.call(this,e,i)}))})))},9192:(t,e,r)=>{"use strict";var n=r(3657),i=r(1616),s="WeakSet";r(5795)(s,(function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}}),{add:function(t){return n.def(i(this,s),t,!0)}},n,!1,!0)},2773:(t,e,r)=>{"use strict";var n=r(2985),i=r(9315)(!0);n(n.P,"Array",{includes:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0)}}),r(7722)("includes")},3276:(t,e,r)=>{var n=r(2985),i=r(1131)(!0);n(n.S,"Object",{entries:function(t){return i(t)}})},8351:(t,e,r)=>{var n=r(2985),i=r(7643),s=r(2110),a=r(8693),o=r(2811);n(n.S,"Object",{getOwnPropertyDescriptors:function(t){for(var e,r,n=s(t),l=a.f,u=i(n),c={},h=0;u.length>h;)void 0!==(r=l(n,e=u[h++]))&&o(c,e,r);return c}})},6409:(t,e,r)=>{var n=r(2985),i=r(1131)(!1);n(n.S,"Object",{values:function(t){return i(t)}})},9865:(t,e,r)=>{"use strict";var n=r(2985),i=r(5645),s=r(3816),a=r(8364),o=r(94);n(n.P+n.R,"Promise",{finally:function(t){var e=a(this,i.Promise||s.Promise),r="function"==typeof t;return this.then(r?function(r){return o(e,t()).then((function(){return r}))}:t,r?function(r){return o(e,t()).then((function(){throw r}))}:t)}})},2770:(t,e,r)=>{"use strict";var n=r(2985),i=r(5442),s=r(575),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(s);n(n.P+n.F*a,"String",{padEnd:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},1784:(t,e,r)=>{"use strict";var n=r(2985),i=r(5442),s=r(575),a=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(s);n(n.P+n.F*a,"String",{padStart:function(t){return i(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},9665:(t,e,r)=>{r(6074)("asyncIterator")},1181:(t,e,r)=>{for(var n=r(6997),i=r(7184),s=r(7234),a=r(3816),o=r(7728),l=r(2803),u=r(6314),c=u("iterator"),h=u("toStringTag"),d=l.Array,f={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},p=i(f),g=0;g<p.length;g++){var v,m=p[g],y=f[m],E=a[m],S=E&&E.prototype;if(S&&(S[c]||o(S,c,d),S[h]||o(S,h,m),l[m]=d,y))for(v in n)S[v]||s(S,v,n[v],!0)}},4633:(t,e,r)=>{var n=r(2985),i=r(4193);n(n.G+n.B,{setImmediate:i.set,clearImmediate:i.clear})},2564:(t,e,r)=>{var n=r(3816),i=r(2985),s=r(575),a=[].slice,o=/MSIE .\./.test(s),l=function(t){return function(e,r){var n=arguments.length>2,i=!!n&&a.call(arguments,2);return t(n?function(){("function"==typeof e?e:Function(e)).apply(this,i)}:e,r)}};i(i.G+i.B+i.F*o,{setTimeout:l(n.setTimeout),setInterval:l(n.setInterval)})},6337:(t,e,r)=>{r(2564),r(4633),r(1181),t.exports=r(5645)},452:function(t,e,r){var n;t.exports=(n=r(8249),r(764),r(8214),r(888),r(5109),function(){var t=n,e=t.lib.BlockCipher,r=t.algo,i=[],s=[],a=[],o=[],l=[],u=[],c=[],h=[],d=[],f=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var r=0,n=0;for(e=0;e<256;e++){var p=n^n<<1^n<<2^n<<3^n<<4;p=p>>>8^255&p^99,i[r]=p,s[p]=r;var g=t[r],v=t[g],m=t[v],y=257*t[p]^16843008*p;a[r]=y<<24|y>>>8,o[r]=y<<16|y>>>16,l[r]=y<<8|y>>>24,u[r]=y,y=16843009*m^65537*v^257*g^16843008*r,c[p]=y<<24|y>>>8,h[p]=y<<16|y>>>16,d[p]=y<<8|y>>>24,f[p]=y,r?(r=g^t[t[t[m^g]]],n^=t[t[n]]):r=n=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],g=r.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,r=t.sigBytes/4,n=4*((this._nRounds=r+6)+1),s=this._keySchedule=[],a=0;a<n;a++)a<r?s[a]=e[a]:(u=s[a-1],a%r?r>6&&a%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=p[a/r|0]<<24),s[a]=s[a-r]^u);for(var o=this._invKeySchedule=[],l=0;l<n;l++){if(a=n-l,l%4)var u=s[a];else u=s[a-4];o[l]=l<4||a<=4?u:c[i[u>>>24]]^h[i[u>>>16&255]]^d[i[u>>>8&255]]^f[i[255&u]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,o,l,u,i)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,c,h,d,f,s),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,s,a,o){for(var l=this._nRounds,u=t[e]^r[0],c=t[e+1]^r[1],h=t[e+2]^r[2],d=t[e+3]^r[3],f=4,p=1;p<l;p++){var g=n[u>>>24]^i[c>>>16&255]^s[h>>>8&255]^a[255&d]^r[f++],v=n[c>>>24]^i[h>>>16&255]^s[d>>>8&255]^a[255&u]^r[f++],m=n[h>>>24]^i[d>>>16&255]^s[u>>>8&255]^a[255&c]^r[f++],y=n[d>>>24]^i[u>>>16&255]^s[c>>>8&255]^a[255&h]^r[f++];u=g,c=v,h=m,d=y}g=(o[u>>>24]<<24|o[c>>>16&255]<<16|o[h>>>8&255]<<8|o[255&d])^r[f++],v=(o[c>>>24]<<24|o[h>>>16&255]<<16|o[d>>>8&255]<<8|o[255&u])^r[f++],m=(o[h>>>24]<<24|o[d>>>16&255]<<16|o[u>>>8&255]<<8|o[255&c])^r[f++],y=(o[d>>>24]<<24|o[u>>>16&255]<<16|o[c>>>8&255]<<8|o[255&h])^r[f++],t[e]=g,t[e+1]=v,t[e+2]=m,t[e+3]=y},keySize:8});t.AES=e._createHelper(g)}(),n.AES)},5109:function(t,e,r){var n,i,s,a,o,l,u,c,h,d,f,p,g,v,m,y,E,S,b;t.exports=(n=r(8249),r(888),void(n.lib.Cipher||(i=n,s=i.lib,a=s.Base,o=s.WordArray,l=s.BufferedBlockAlgorithm,u=i.enc,u.Utf8,c=u.Base64,h=i.algo.EvpKDF,d=s.Cipher=l.extend({cfg:a.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){l.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?b:E}return function(e){return{encrypt:function(r,n,i){return t(n).encrypt(e,r,n,i)},decrypt:function(r,n,i){return t(n).decrypt(e,r,n,i)}}}}()}),s.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),f=i.mode={},p=s.BlockCipherMode=a.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),g=f.CBC=function(){var t=p.extend();function e(t,e,r){var n,i=this._iv;i?(n=i,this._iv=void 0):n=this._prevBlock;for(var s=0;s<r;s++)t[e+s]^=n[s]}return t.Encryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize;e.call(this,t,r,i),n.encryptBlock(t,r),this._prevBlock=t.slice(r,r+i)}}),t.Decryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize,s=t.slice(r,r+i);n.decryptBlock(t,r),e.call(this,t,r,i),this._prevBlock=s}}),t}(),v=(i.pad={}).Pkcs7={pad:function(t,e){for(var r=4*e,n=r-t.sigBytes%r,i=n<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);var l=o.create(s,n);t.concat(l)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},s.BlockCipher=d.extend({cfg:d.cfg.extend({mode:g,padding:v}),reset:function(){var t;d.reset.call(this);var e=this.cfg,r=e.iv,n=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=n.createEncryptor:(t=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,r&&r.words):(this._mode=t.call(n,this,r&&r.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),m=s.CipherParams=a.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),y=(i.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,r=t.salt;return(r?o.create([1398893684,1701076831]).concat(r).concat(e):e).toString(c)},parse:function(t){var e,r=c.parse(t),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(e=o.create(n.slice(2,4)),n.splice(0,4),r.sigBytes-=16),m.create({ciphertext:r,salt:e})}},E=s.SerializableCipher=a.extend({cfg:a.extend({format:y}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n),s=i.finalize(e),a=i.cfg;return m.create({ciphertext:s,key:r,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),S=(i.kdf={}).OpenSSL={execute:function(t,e,r,n){n||(n=o.random(8));var i=h.create({keySize:e+r}).compute(t,n),s=o.create(i.words.slice(e),4*r);return i.sigBytes=4*e,m.create({key:i,iv:s,salt:n})}},b=s.PasswordBasedCipher=E.extend({cfg:E.cfg.extend({kdf:S}),encrypt:function(t,e,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize);n.iv=i.iv;var s=E.encrypt.call(this,t,e,i.key,n);return s.mixIn(i),s},decrypt:function(t,e,r,n){n=this.cfg.extend(n),e=this._parse(e,n.format);var i=n.kdf.execute(r,t.keySize,t.ivSize,e.salt);return n.iv=i.iv,E.decrypt.call(this,t,e,i.key,n)}}))))},8249:function(t,e,r){var n;t.exports=(n=n||function(t,e){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(n=globalThis.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==r.g&&r.g.crypto&&(n=r.g.crypto),!n)try{n=r(2480)}catch(t){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function t(){}return function(e){var r;return t.prototype=e,r=new t,t.prototype=null,r}}(),a={},o=a.lib={},l=o.Base={extend:function(t){var e=s(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},u=o.WordArray=l.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var s=0;s<i;s++){var a=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=a<<24-(n+s)%4*8}else for(var o=0;o<i;o+=4)e[n+o>>>2]=r[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=t.ceil(r/4)},clone:function(){var t=l.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(i());return new u.init(e,t)}}),c=a.enc={},h=c.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new u.init(r,e/2)}},d=c.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new u.init(r,e)}},f=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(d.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return d.parse(unescape(encodeURIComponent(t)))}},p=o.BufferedBlockAlgorithm=l.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=f.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var r,n=this._data,i=n.words,s=n.sigBytes,a=this.blockSize,o=s/(4*a),l=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*a,c=t.min(4*l,s);if(l){for(var h=0;h<l;h+=a)this._doProcessBlock(i,h);r=i.splice(0,l),n.sigBytes-=c}return new u.init(r,c)},clone:function(){var t=l.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),g=(o.Hasher=p.extend({cfg:l.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new g.HMAC.init(t,r).finalize(e)}}}),a.algo={});return a}(Math),n)},764:function(t,e,r){var n,i,s;t.exports=(n=r(8249),s=(i=n).lib.WordArray,i.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp();for(var i=[],s=0;s<r;s+=3)for(var a=(e[s>>>2]>>>24-s%4*8&255)<<16|(e[s+1>>>2]>>>24-(s+1)%4*8&255)<<8|e[s+2>>>2]>>>24-(s+2)%4*8&255,o=0;o<4&&s+.75*o<r;o++)i.push(n.charAt(a>>>6*(3-o)&63));var l=n.charAt(64);if(l)for(;i.length%4;)i.push(l);return i.join("")},parse:function(t){var e=t.length,r=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var i=0;i<r.length;i++)n[r.charCodeAt(i)]=i}var a=r.charAt(64);if(a){var o=t.indexOf(a);-1!==o&&(e=o)}return function(t,e,r){for(var n=[],i=0,a=0;a<e;a++)if(a%4){var o=r[t.charCodeAt(a-1)]<<a%4*2|r[t.charCodeAt(a)]>>>6-a%4*2;n[i>>>2]|=o<<24-i%4*8,i++}return s.create(n,i)}(t,e,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)},1179:function(t,e,r){var n,i,s;t.exports=(n=r(8249),s=(i=n).lib.WordArray,i.enc.Base64url={stringify:function(t,e=!0){var r=t.words,n=t.sigBytes,i=e?this._safe_map:this._map;t.clamp();for(var s=[],a=0;a<n;a+=3)for(var o=(r[a>>>2]>>>24-a%4*8&255)<<16|(r[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|r[a+2>>>2]>>>24-(a+2)%4*8&255,l=0;l<4&&a+.75*l<n;l++)s.push(i.charAt(o>>>6*(3-l)&63));var u=i.charAt(64);if(u)for(;s.length%4;)s.push(u);return s.join("")},parse:function(t,e=!0){var r=t.length,n=e?this._safe_map:this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<n.length;a++)i[n.charCodeAt(a)]=a}var o=n.charAt(64);if(o){var l=t.indexOf(o);-1!==l&&(r=l)}return function(t,e,r){for(var n=[],i=0,a=0;a<e;a++)if(a%4){var o=r[t.charCodeAt(a-1)]<<a%4*2|r[t.charCodeAt(a)]>>>6-a%4*2;n[i>>>2]|=o<<24-i%4*8,i++}return s.create(n,i)}(t,r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},n.enc.Base64url)},298:function(t,e,r){var n;t.exports=(n=r(8249),function(){var t=n,e=t.lib.WordArray,r=t.enc;function i(t){return t<<8&4278255360|t>>>8&16711935}r.Utf16=r.Utf16BE={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i+=2){var s=e[i>>>2]>>>16-i%4*8&65535;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var r=t.length,n=[],i=0;i<r;i++)n[i>>>1]|=t.charCodeAt(i)<<16-i%2*16;return e.create(n,2*r)}},r.Utf16LE={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],s=0;s<r;s+=2){var a=i(e[s>>>2]>>>16-s%4*8&65535);n.push(String.fromCharCode(a))}return n.join("")},parse:function(t){for(var r=t.length,n=[],s=0;s<r;s++)n[s>>>1]|=i(t.charCodeAt(s)<<16-s%2*16);return e.create(n,2*r)}}}(),n.enc.Utf16)},888:function(t,e,r){var n,i,s,a,o,l,u,c;t.exports=(c=r(8249),r(2783),r(9422),s=(i=(n=c).lib).Base,a=i.WordArray,l=(o=n.algo).MD5,u=o.EvpKDF=s.extend({cfg:s.extend({keySize:4,hasher:l,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r,n=this.cfg,i=n.hasher.create(),s=a.create(),o=s.words,l=n.keySize,u=n.iterations;o.length<l;){r&&i.update(r),r=i.update(t).finalize(e),i.reset();for(var c=1;c<u;c++)r=i.finalize(r),i.reset();s.concat(r)}return s.sigBytes=4*l,s}}),n.EvpKDF=function(t,e,r){return u.create(r).compute(t,e)},c.EvpKDF)},2209:function(t,e,r){var n,i,s,a;t.exports=(a=r(8249),r(5109),i=(n=a).lib.CipherParams,s=n.enc.Hex,n.format.Hex={stringify:function(t){return t.ciphertext.toString(s)},parse:function(t){var e=s.parse(t);return i.create({ciphertext:e})}},a.format.Hex)},9422:function(t,e,r){var n,i,s;t.exports=(i=(n=r(8249)).lib.Base,s=n.enc.Utf8,void(n.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=s.parse(e));var r=t.blockSize,n=4*r;e.sigBytes>n&&(e=t.finalize(e)),e.clamp();for(var i=this._oKey=e.clone(),a=this._iKey=e.clone(),o=i.words,l=a.words,u=0;u<r;u++)o[u]^=1549556828,l[u]^=909522486;i.sigBytes=a.sigBytes=n,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,r=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(r))}})))},1354:function(t,e,r){var n;t.exports=(n=r(8249),r(4938),r(4433),r(298),r(764),r(1179),r(8214),r(2783),r(3770),r(7792),r(34),r(7460),r(3327),r(706),r(9422),r(2112),r(888),r(5109),r(8568),r(4242),r(9968),r(7660),r(1148),r(3615),r(2807),r(1077),r(6475),r(6991),r(2209),r(452),r(7957),r(1857),r(4454),r(3974),n)},4433:function(t,e,r){var n;t.exports=(n=r(8249),function(){if("function"==typeof ArrayBuffer){var t=n.lib.WordArray,e=t.init,r=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var r=t.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=t[i]<<24-i%4*8;e.call(this,n,r)}else e.apply(this,arguments)};r.prototype=t}}(),n.lib.WordArray)},8214:function(t,e,r){var n;t.exports=(n=r(8249),function(t){var e=n,r=e.lib,i=r.WordArray,s=r.Hasher,a=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var l=a.MD5=s.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var s=this._hash.words,a=t[e+0],l=t[e+1],f=t[e+2],p=t[e+3],g=t[e+4],v=t[e+5],m=t[e+6],y=t[e+7],E=t[e+8],S=t[e+9],b=t[e+10],T=t[e+11],_=t[e+12],A=t[e+13],L=t[e+14],w=t[e+15],R=s[0],k=s[1],D=s[2],I=s[3];R=u(R,k,D,I,a,7,o[0]),I=u(I,R,k,D,l,12,o[1]),D=u(D,I,R,k,f,17,o[2]),k=u(k,D,I,R,p,22,o[3]),R=u(R,k,D,I,g,7,o[4]),I=u(I,R,k,D,v,12,o[5]),D=u(D,I,R,k,m,17,o[6]),k=u(k,D,I,R,y,22,o[7]),R=u(R,k,D,I,E,7,o[8]),I=u(I,R,k,D,S,12,o[9]),D=u(D,I,R,k,b,17,o[10]),k=u(k,D,I,R,T,22,o[11]),R=u(R,k,D,I,_,7,o[12]),I=u(I,R,k,D,A,12,o[13]),D=u(D,I,R,k,L,17,o[14]),R=c(R,k=u(k,D,I,R,w,22,o[15]),D,I,l,5,o[16]),I=c(I,R,k,D,m,9,o[17]),D=c(D,I,R,k,T,14,o[18]),k=c(k,D,I,R,a,20,o[19]),R=c(R,k,D,I,v,5,o[20]),I=c(I,R,k,D,b,9,o[21]),D=c(D,I,R,k,w,14,o[22]),k=c(k,D,I,R,g,20,o[23]),R=c(R,k,D,I,S,5,o[24]),I=c(I,R,k,D,L,9,o[25]),D=c(D,I,R,k,p,14,o[26]),k=c(k,D,I,R,E,20,o[27]),R=c(R,k,D,I,A,5,o[28]),I=c(I,R,k,D,f,9,o[29]),D=c(D,I,R,k,y,14,o[30]),R=h(R,k=c(k,D,I,R,_,20,o[31]),D,I,v,4,o[32]),I=h(I,R,k,D,E,11,o[33]),D=h(D,I,R,k,T,16,o[34]),k=h(k,D,I,R,L,23,o[35]),R=h(R,k,D,I,l,4,o[36]),I=h(I,R,k,D,g,11,o[37]),D=h(D,I,R,k,y,16,o[38]),k=h(k,D,I,R,b,23,o[39]),R=h(R,k,D,I,A,4,o[40]),I=h(I,R,k,D,a,11,o[41]),D=h(D,I,R,k,p,16,o[42]),k=h(k,D,I,R,m,23,o[43]),R=h(R,k,D,I,S,4,o[44]),I=h(I,R,k,D,_,11,o[45]),D=h(D,I,R,k,w,16,o[46]),R=d(R,k=h(k,D,I,R,f,23,o[47]),D,I,a,6,o[48]),I=d(I,R,k,D,y,10,o[49]),D=d(D,I,R,k,L,15,o[50]),k=d(k,D,I,R,v,21,o[51]),R=d(R,k,D,I,_,6,o[52]),I=d(I,R,k,D,p,10,o[53]),D=d(D,I,R,k,b,15,o[54]),k=d(k,D,I,R,l,21,o[55]),R=d(R,k,D,I,E,6,o[56]),I=d(I,R,k,D,w,10,o[57]),D=d(D,I,R,k,m,15,o[58]),k=d(k,D,I,R,A,21,o[59]),R=d(R,k,D,I,g,6,o[60]),I=d(I,R,k,D,T,10,o[61]),D=d(D,I,R,k,f,15,o[62]),k=d(k,D,I,R,S,21,o[63]),s[0]=s[0]+R|0,s[1]=s[1]+k|0,s[2]=s[2]+D|0,s[3]=s[3]+I|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var s=t.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(r.length+1),this._process();for(var o=this._hash,l=o.words,u=0;u<4;u++){var c=l[u];l[u]=16711935&(c<<8|c>>>24)|4278255360&(c<<24|c>>>8)}return o},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});function u(t,e,r,n,i,s,a){var o=t+(e&r|~e&n)+i+a;return(o<<s|o>>>32-s)+e}function c(t,e,r,n,i,s,a){var o=t+(e&n|r&~n)+i+a;return(o<<s|o>>>32-s)+e}function h(t,e,r,n,i,s,a){var o=t+(e^r^n)+i+a;return(o<<s|o>>>32-s)+e}function d(t,e,r,n,i,s,a){var o=t+(r^(e|~n))+i+a;return(o<<s|o>>>32-s)+e}e.MD5=s._createHelper(l),e.HmacMD5=s._createHmacHelper(l)}(Math),n.MD5)},8568:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.mode.CFB=function(){var t=n.lib.BlockCipherMode.extend();function e(t,e,r,n){var i,s=this._iv;s?(i=s.slice(0),this._iv=void 0):i=this._prevBlock,n.encryptBlock(i,0);for(var a=0;a<r;a++)t[e+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize;e.call(this,t,r,i,n),this._prevBlock=t.slice(r,r+i)}}),t.Decryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize,s=t.slice(r,r+i);e.call(this,t,r,i,n),this._prevBlock=s}}),t}(),n.mode.CFB)},9968:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.mode.CTRGladman=function(){var t=n.lib.BlockCipherMode.extend();function e(t){if(255==(t>>24&255)){var e=t>>16&255,r=t>>8&255,n=255&t;255===e?(e=0,255===r?(r=0,255===n?n=0:++n):++r):++e,t=0,t+=e<<16,t+=r<<8,t+=n}else t+=1<<24;return t}var r=t.Encryptor=t.extend({processBlock:function(t,r){var n=this._cipher,i=n.blockSize,s=this._iv,a=this._counter;s&&(a=this._counter=s.slice(0),this._iv=void 0),function(t){0===(t[0]=e(t[0]))&&(t[1]=e(t[1]))}(a);var o=a.slice(0);n.encryptBlock(o,0);for(var l=0;l<i;l++)t[r+l]^=o[l]}});return t.Decryptor=r,t}(),n.mode.CTRGladman)},4242:function(t,e,r){var n,i,s;t.exports=(s=r(8249),r(5109),s.mode.CTR=(i=(n=s.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,s=this._counter;i&&(s=this._counter=i.slice(0),this._iv=void 0);var a=s.slice(0);r.encryptBlock(a,0),s[n-1]=s[n-1]+1|0;for(var o=0;o<n;o++)t[e+o]^=a[o]}}),n.Decryptor=i,n),s.mode.CTR)},1148:function(t,e,r){var n,i;t.exports=(i=r(8249),r(5109),i.mode.ECB=((n=i.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),n.Decryptor=n.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),n),i.mode.ECB)},7660:function(t,e,r){var n,i,s;t.exports=(s=r(8249),r(5109),s.mode.OFB=(i=(n=s.lib.BlockCipherMode.extend()).Encryptor=n.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=this._iv,s=this._keystream;i&&(s=this._keystream=i.slice(0),this._iv=void 0),r.encryptBlock(s,0);for(var a=0;a<n;a++)t[e+a]^=s[a]}}),n.Decryptor=i,n),s.mode.OFB)},3615:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.pad.AnsiX923={pad:function(t,e){var r=t.sigBytes,n=4*e,i=n-r%n,s=r+i-1;t.clamp(),t.words[s>>>2]|=i<<24-s%4*8,t.sigBytes+=i},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},n.pad.Ansix923)},2807:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.pad.Iso10126={pad:function(t,e){var r=4*e,i=r-t.sigBytes%r;t.concat(n.lib.WordArray.random(i-1)).concat(n.lib.WordArray.create([i<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},n.pad.Iso10126)},1077:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.pad.Iso97971={pad:function(t,e){t.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(t,e)},unpad:function(t){n.pad.ZeroPadding.unpad(t),t.sigBytes--}},n.pad.Iso97971)},6991:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding)},6475:function(t,e,r){var n;t.exports=(n=r(8249),r(5109),n.pad.ZeroPadding={pad:function(t,e){var r=4*e;t.clamp(),t.sigBytes+=r-(t.sigBytes%r||r)},unpad:function(t){var e=t.words,r=t.sigBytes-1;for(r=t.sigBytes-1;r>=0;r--)if(e[r>>>2]>>>24-r%4*8&255){t.sigBytes=r+1;break}}},n.pad.ZeroPadding)},2112:function(t,e,r){var n,i,s,a,o,l,u,c,h;t.exports=(h=r(8249),r(2783),r(9422),s=(i=(n=h).lib).Base,a=i.WordArray,l=(o=n.algo).SHA1,u=o.HMAC,c=o.PBKDF2=s.extend({cfg:s.extend({keySize:4,hasher:l,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var r=this.cfg,n=u.create(r.hasher,t),i=a.create(),s=a.create([1]),o=i.words,l=s.words,c=r.keySize,h=r.iterations;o.length<c;){var d=n.update(e).finalize(s);n.reset();for(var f=d.words,p=f.length,g=d,v=1;v<h;v++){g=n.finalize(g),n.reset();for(var m=g.words,y=0;y<p;y++)f[y]^=m[y]}i.concat(d),l[0]++}return i.sigBytes=4*c,i}}),n.PBKDF2=function(t,e,r){return c.create(r).compute(t,e)},h.PBKDF2)},3974:function(t,e,r){var n;t.exports=(n=r(8249),r(764),r(8214),r(888),r(5109),function(){var t=n,e=t.lib.StreamCipher,r=t.algo,i=[],s=[],a=[],o=r.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],n=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var i=0;i<4;i++)l.call(this);for(i=0;i<8;i++)n[i]^=r[i+4&7];if(e){var s=e.words,a=s[0],o=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=u>>>16|4294901760&c,d=c<<16|65535&u;for(n[0]^=u,n[1]^=h,n[2]^=c,n[3]^=d,n[4]^=u,n[5]^=h,n[6]^=c,n[7]^=d,i=0;i<4;i++)l.call(this)}},_doProcessBlock:function(t,e){var r=this._X;l.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),t[e+n]^=i[n]},blockSize:4,ivSize:2});function l(){for(var t=this._X,e=this._C,r=0;r<8;r++)s[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<s[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<s[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<s[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<s[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<s[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<s[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<s[6]>>>0?1:0)|0,this._b=e[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],i=65535&n,o=n>>>16,l=((i*i>>>17)+i*o>>>15)+o*o,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=l^u}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(o)}(),n.RabbitLegacy)},4454:function(t,e,r){var n;t.exports=(n=r(8249),r(764),r(8214),r(888),r(5109),function(){var t=n,e=t.lib.StreamCipher,r=t.algo,i=[],s=[],a=[],o=r.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,r=0;r<4;r++)t[r]=16711935&(t[r]<<8|t[r]>>>24)|4278255360&(t[r]<<24|t[r]>>>8);var n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],i=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,r=0;r<4;r++)l.call(this);for(r=0;r<8;r++)i[r]^=n[r+4&7];if(e){var s=e.words,a=s[0],o=s[1],u=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),c=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),h=u>>>16|4294901760&c,d=c<<16|65535&u;for(i[0]^=u,i[1]^=h,i[2]^=c,i[3]^=d,i[4]^=u,i[5]^=h,i[6]^=c,i[7]^=d,r=0;r<4;r++)l.call(this)}},_doProcessBlock:function(t,e){var r=this._X;l.call(this),i[0]=r[0]^r[5]>>>16^r[3]<<16,i[1]=r[2]^r[7]>>>16^r[5]<<16,i[2]=r[4]^r[1]>>>16^r[7]<<16,i[3]=r[6]^r[3]>>>16^r[1]<<16;for(var n=0;n<4;n++)i[n]=16711935&(i[n]<<8|i[n]>>>24)|4278255360&(i[n]<<24|i[n]>>>8),t[e+n]^=i[n]},blockSize:4,ivSize:2});function l(){for(var t=this._X,e=this._C,r=0;r<8;r++)s[r]=e[r];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<s[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<s[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<s[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<s[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<s[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<s[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<s[6]>>>0?1:0)|0,this._b=e[7]>>>0<s[7]>>>0?1:0,r=0;r<8;r++){var n=t[r]+e[r],i=65535&n,o=n>>>16,l=((i*i>>>17)+i*o>>>15)+o*o,u=((4294901760&n)*n|0)+((65535&n)*n|0);a[r]=l^u}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(o)}(),n.Rabbit)},1857:function(t,e,r){var n;t.exports=(n=r(8249),r(764),r(8214),r(888),r(5109),function(){var t=n,e=t.lib.StreamCipher,r=t.algo,i=r.RC4=e.extend({_doReset:function(){for(var t=this._key,e=t.words,r=t.sigBytes,n=this._S=[],i=0;i<256;i++)n[i]=i;i=0;for(var s=0;i<256;i++){var a=i%r,o=e[a>>>2]>>>24-a%4*8&255;s=(s+n[i]+o)%256;var l=n[i];n[i]=n[s],n[s]=l}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=s.call(this)},keySize:8,ivSize:0});function s(){for(var t=this._S,e=this._i,r=this._j,n=0,i=0;i<4;i++){r=(r+t[e=(e+1)%256])%256;var s=t[e];t[e]=t[r],t[r]=s,n|=t[(t[e]+t[r])%256]<<24-8*i}return this._i=e,this._j=r,n}t.RC4=e._createHelper(i);var a=r.RC4Drop=i.extend({cfg:i.cfg.extend({drop:192}),_doReset:function(){i._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)s.call(this)}});t.RC4Drop=e._createHelper(a)}(),n.RC4)},706:function(t,e,r){var n;t.exports=(n=r(8249),function(t){var e=n,r=e.lib,i=r.WordArray,s=r.Hasher,a=e.algo,o=i.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),l=i.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),u=i.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),c=i.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=i.create([0,1518500249,1859775393,2400959708,2840853838]),d=i.create([1352829926,1548603684,1836072691,2053994217,0]),f=a.RIPEMD160=s.extend({_doReset:function(){this._hash=i.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;r<16;r++){var n=e+r,i=t[n];t[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var s,a,f,S,b,T,_,A,L,w,R,k=this._hash.words,D=h.words,I=d.words,P=o.words,O=l.words,C=u.words,x=c.words;for(T=s=k[0],_=a=k[1],A=f=k[2],L=S=k[3],w=b=k[4],r=0;r<80;r+=1)R=s+t[e+P[r]]|0,R+=r<16?p(a,f,S)+D[0]:r<32?g(a,f,S)+D[1]:r<48?v(a,f,S)+D[2]:r<64?m(a,f,S)+D[3]:y(a,f,S)+D[4],R=(R=E(R|=0,C[r]))+b|0,s=b,b=S,S=E(f,10),f=a,a=R,R=T+t[e+O[r]]|0,R+=r<16?y(_,A,L)+I[0]:r<32?m(_,A,L)+I[1]:r<48?v(_,A,L)+I[2]:r<64?g(_,A,L)+I[3]:p(_,A,L)+I[4],R=(R=E(R|=0,x[r]))+w|0,T=w,w=L,L=E(A,10),A=_,_=R;R=k[1]+f+L|0,k[1]=k[2]+S+w|0,k[2]=k[3]+b+T|0,k[3]=k[4]+s+_|0,k[4]=k[0]+a+A|0,k[0]=R},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,s=i.words,a=0;a<5;a++){var o=s[a];s[a]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return i},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,r){return t^e^r}function g(t,e,r){return t&e|~t&r}function v(t,e,r){return(t|~e)^r}function m(t,e,r){return t&r|e&~r}function y(t,e,r){return t^(e|~r)}function E(t,e){return t<<e|t>>>32-e}e.RIPEMD160=s._createHelper(f),e.HmacRIPEMD160=s._createHmacHelper(f)}(Math),n.RIPEMD160)},2783:function(t,e,r){var n,i,s,a,o,l,u,c;t.exports=(i=(n=c=r(8249)).lib,s=i.WordArray,a=i.Hasher,o=n.algo,l=[],u=o.SHA1=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],o=r[4],u=0;u<80;u++){if(u<16)l[u]=0|t[e+u];else{var c=l[u-3]^l[u-8]^l[u-14]^l[u-16];l[u]=c<<1|c>>>31}var h=(n<<5|n>>>27)+o+l[u];h+=u<20?1518500249+(i&s|~i&a):u<40?1859775393+(i^s^a):u<60?(i&s|i&a|s&a)-1894007588:(i^s^a)-899497514,o=a,a=s,s=i<<30|i>>>2,i=n,n=h}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}}),n.SHA1=a._createHelper(u),n.HmacSHA1=a._createHmacHelper(u),c.SHA1)},7792:function(t,e,r){var n,i,s,a,o,l;t.exports=(l=r(8249),r(3770),i=(n=l).lib.WordArray,s=n.algo,a=s.SHA256,o=s.SHA224=a.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=4,t}}),n.SHA224=a._createHelper(o),n.HmacSHA224=a._createHmacHelper(o),l.SHA224)},3770:function(t,e,r){var n;t.exports=(n=r(8249),function(t){var e=n,r=e.lib,i=r.WordArray,s=r.Hasher,a=e.algo,o=[],l=[];!function(){function e(e){for(var r=t.sqrt(e),n=2;n<=r;n++)if(!(e%n))return!1;return!0}function r(t){return 4294967296*(t-(0|t))|0}for(var n=2,i=0;i<64;)e(n)&&(i<8&&(o[i]=r(t.pow(n,.5))),l[i]=r(t.pow(n,1/3)),i++),n++}();var u=[],c=a.SHA256=s.extend({_doReset:function(){this._hash=new i.init(o.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],o=r[4],c=r[5],h=r[6],d=r[7],f=0;f<64;f++){if(f<16)u[f]=0|t[e+f];else{var p=u[f-15],g=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,v=u[f-2],m=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;u[f]=g+u[f-7]+m+u[f-16]}var y=n&i^n&s^i&s,E=(n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22),S=d+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&c^~o&h)+l[f]+u[f];d=h,h=c,c=o,o=a+S|0,a=s,s=i,i=n,n=S+(E+y)|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+a|0,r[4]=r[4]+o|0,r[5]=r[5]+c|0,r[6]=r[6]+h|0,r[7]=r[7]+d|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=s.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=s._createHelper(c),e.HmacSHA256=s._createHmacHelper(c)}(Math),n.SHA256)},3327:function(t,e,r){var n;t.exports=(n=r(8249),r(4938),function(t){var e=n,r=e.lib,i=r.WordArray,s=r.Hasher,a=e.x64.Word,o=e.algo,l=[],u=[],c=[];!function(){for(var t=1,e=0,r=0;r<24;r++){l[t+5*e]=(r+1)*(r+2)/2%64;var n=(2*t+3*e)%5;t=e%5,e=n}for(t=0;t<5;t++)for(e=0;e<5;e++)u[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,s=0;s<24;s++){for(var o=0,h=0,d=0;d<7;d++){if(1&i){var f=(1<<d)-1;f<32?h^=1<<f:o^=1<<f-32}128&i?i=i<<1^113:i<<=1}c[s]=a.create(o,h)}}();var h=[];!function(){for(var t=0;t<25;t++)h[t]=a.create()}();var d=o.SHA3=s.extend({cfg:s.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var r=this._state,n=this.blockSize/2,i=0;i<n;i++){var s=t[e+2*i],a=t[e+2*i+1];s=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(k=r[i]).high^=a,k.low^=s}for(var o=0;o<24;o++){for(var d=0;d<5;d++){for(var f=0,p=0,g=0;g<5;g++)f^=(k=r[d+5*g]).high,p^=k.low;var v=h[d];v.high=f,v.low=p}for(d=0;d<5;d++){var m=h[(d+4)%5],y=h[(d+1)%5],E=y.high,S=y.low;for(f=m.high^(E<<1|S>>>31),p=m.low^(S<<1|E>>>31),g=0;g<5;g++)(k=r[d+5*g]).high^=f,k.low^=p}for(var b=1;b<25;b++){var T=(k=r[b]).high,_=k.low,A=l[b];A<32?(f=T<<A|_>>>32-A,p=_<<A|T>>>32-A):(f=_<<A-32|T>>>64-A,p=T<<A-32|_>>>64-A);var L=h[u[b]];L.high=f,L.low=p}var w=h[0],R=r[0];for(w.high=R.high,w.low=R.low,d=0;d<5;d++)for(g=0;g<5;g++){var k=r[b=d+5*g],D=h[b],I=h[(d+1)%5+5*g],P=h[(d+2)%5+5*g];k.high=D.high^~I.high&P.high,k.low=D.low^~I.low&P.low}k=r[0];var O=c[o];k.high^=O.high,k.low^=O.low}},_doFinalize:function(){var e=this._data,r=e.words,n=(this._nDataBytes,8*e.sigBytes),s=32*this.blockSize;r[n>>>5]|=1<<24-n%32,r[(t.ceil((n+1)/s)*s>>>5)-1]|=128,e.sigBytes=4*r.length,this._process();for(var a=this._state,o=this.cfg.outputLength/8,l=o/8,u=[],c=0;c<l;c++){var h=a[c],d=h.high,f=h.low;d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),u.push(f),u.push(d)}return new i.init(u,o)},clone:function(){for(var t=s.clone.call(this),e=t._state=this._state.slice(0),r=0;r<25;r++)e[r]=e[r].clone();return t}});e.SHA3=s._createHelper(d),e.HmacSHA3=s._createHmacHelper(d)}(Math),n.SHA3)},7460:function(t,e,r){var n,i,s,a,o,l,u,c;t.exports=(c=r(8249),r(4938),r(34),i=(n=c).x64,s=i.Word,a=i.WordArray,o=n.algo,l=o.SHA512,u=o.SHA384=l.extend({_doReset:function(){this._hash=new a.init([new s.init(3418070365,3238371032),new s.init(1654270250,914150663),new s.init(2438529370,812702999),new s.init(355462360,4144912697),new s.init(1731405415,4290775857),new s.init(2394180231,1750603025),new s.init(3675008525,1694076839),new s.init(1203062813,3204075428)])},_doFinalize:function(){var t=l._doFinalize.call(this);return t.sigBytes-=16,t}}),n.SHA384=l._createHelper(u),n.HmacSHA384=l._createHmacHelper(u),c.SHA384)},34:function(t,e,r){var n;t.exports=(n=r(8249),r(4938),function(){var t=n,e=t.lib.Hasher,r=t.x64,i=r.Word,s=r.WordArray,a=t.algo;function o(){return i.create.apply(i,arguments)}var l=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],u=[];!function(){for(var t=0;t<80;t++)u[t]=o()}();var c=a.SHA512=e.extend({_doReset:function(){this._hash=new s.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],a=r[3],o=r[4],c=r[5],h=r[6],d=r[7],f=n.high,p=n.low,g=i.high,v=i.low,m=s.high,y=s.low,E=a.high,S=a.low,b=o.high,T=o.low,_=c.high,A=c.low,L=h.high,w=h.low,R=d.high,k=d.low,D=f,I=p,P=g,O=v,C=m,x=y,M=E,F=S,N=b,B=T,U=_,j=A,H=L,G=w,V=R,K=k,$=0;$<80;$++){var W,q,Y=u[$];if($<16)q=Y.high=0|t[e+2*$],W=Y.low=0|t[e+2*$+1];else{var z=u[$-15],X=z.high,J=z.low,Q=(X>>>1|J<<31)^(X>>>8|J<<24)^X>>>7,Z=(J>>>1|X<<31)^(J>>>8|X<<24)^(J>>>7|X<<25),tt=u[$-2],et=tt.high,rt=tt.low,nt=(et>>>19|rt<<13)^(et<<3|rt>>>29)^et>>>6,it=(rt>>>19|et<<13)^(rt<<3|et>>>29)^(rt>>>6|et<<26),st=u[$-7],at=st.high,ot=st.low,lt=u[$-16],ut=lt.high,ct=lt.low;q=(q=(q=Q+at+((W=Z+ot)>>>0<Z>>>0?1:0))+nt+((W+=it)>>>0<it>>>0?1:0))+ut+((W+=ct)>>>0<ct>>>0?1:0),Y.high=q,Y.low=W}var ht,dt=N&U^~N&H,ft=B&j^~B&G,pt=D&P^D&C^P&C,gt=I&O^I&x^O&x,vt=(D>>>28|I<<4)^(D<<30|I>>>2)^(D<<25|I>>>7),mt=(I>>>28|D<<4)^(I<<30|D>>>2)^(I<<25|D>>>7),yt=(N>>>14|B<<18)^(N>>>18|B<<14)^(N<<23|B>>>9),Et=(B>>>14|N<<18)^(B>>>18|N<<14)^(B<<23|N>>>9),St=l[$],bt=St.high,Tt=St.low,_t=V+yt+((ht=K+Et)>>>0<K>>>0?1:0),At=mt+gt;V=H,K=G,H=U,G=j,U=N,j=B,N=M+(_t=(_t=(_t=_t+dt+((ht+=ft)>>>0<ft>>>0?1:0))+bt+((ht+=Tt)>>>0<Tt>>>0?1:0))+q+((ht+=W)>>>0<W>>>0?1:0))+((B=F+ht|0)>>>0<F>>>0?1:0)|0,M=C,F=x,C=P,x=O,P=D,O=I,D=_t+(vt+pt+(At>>>0<mt>>>0?1:0))+((I=ht+At|0)>>>0<ht>>>0?1:0)|0}p=n.low=p+I,n.high=f+D+(p>>>0<I>>>0?1:0),v=i.low=v+O,i.high=g+P+(v>>>0<O>>>0?1:0),y=s.low=y+x,s.high=m+C+(y>>>0<x>>>0?1:0),S=a.low=S+F,a.high=E+M+(S>>>0<F>>>0?1:0),T=o.low=T+B,o.high=b+N+(T>>>0<B>>>0?1:0),A=c.low=A+j,c.high=_+U+(A>>>0<j>>>0?1:0),w=h.low=w+G,h.high=L+H+(w>>>0<G>>>0?1:0),k=d.low=k+K,d.high=R+V+(k>>>0<K>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(n+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=e.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});t.SHA512=e._createHelper(c),t.HmacSHA512=e._createHmacHelper(c)}(),n.SHA512)},7957:function(t,e,r){var n;t.exports=(n=r(8249),r(764),r(8214),r(888),r(5109),function(){var t=n,e=t.lib,r=e.WordArray,i=e.BlockCipher,s=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],l=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],u=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=s.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;r<56;r++){var n=a[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(var i=this._subKeys=[],s=0;s<16;s++){var u=i[s]=[],c=l[s];for(r=0;r<24;r++)u[r/6|0]|=e[(o[r]-1+c)%28]<<31-r%6,u[4+(r/6|0)]|=e[28+(o[r+24]-1+c)%28]<<31-r%6;for(u[0]=u[0]<<1|u[0]>>>31,r=1;r<7;r++)u[r]=u[r]>>>4*(r-1)+3;u[7]=u[7]<<5|u[7]>>>27}var h=this._invSubKeys=[];for(r=0;r<16;r++)h[r]=i[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,r){this._lBlock=t[e],this._rBlock=t[e+1],d.call(this,4,252645135),d.call(this,16,65535),f.call(this,2,858993459),f.call(this,8,16711935),d.call(this,1,1431655765);for(var n=0;n<16;n++){for(var i=r[n],s=this._lBlock,a=this._rBlock,o=0,l=0;l<8;l++)o|=u[l][((a^i[l])&c[l])>>>0];this._lBlock=a,this._rBlock=s^o}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),f.call(this,8,16711935),f.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function d(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function f(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}t.DES=i._createHelper(h);var p=s.TripleDES=i.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),n=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=h.createEncryptor(r.create(e)),this._des2=h.createEncryptor(r.create(n)),this._des3=h.createEncryptor(r.create(i))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=i._createHelper(p)}(),n.TripleDES)},4938:function(t,e,r){var n,i,s,a,o,l;t.exports=(n=r(8249),s=(i=n).lib,a=s.Base,o=s.WordArray,(l=i.x64={}).Word=a.extend({init:function(t,e){this.high=t,this.low=e}}),l.WordArray=a.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;n<e;n++){var i=t[n];r.push(i.high),r.push(i.low)}return o.create(r,this.sigBytes)},clone:function(){for(var t=a.clone.call(this),e=t.words=this.words.slice(0),r=e.length,n=0;n<r;n++)e[n]=e[n].clone();return t}}),n)},4020:t=>{"use strict";var e="%[a-f0-9]{2}",r=new RegExp(e,"gi"),n=new RegExp("("+e+")+","gi");function i(t,e){try{return decodeURIComponent(t.join(""))}catch(t){}if(1===t.length)return t;e=e||1;var r=t.slice(0,e),n=t.slice(e);return Array.prototype.concat.call([],i(r),i(n))}function s(t){try{return decodeURIComponent(t)}catch(s){for(var e=t.match(r),n=1;n<e.length;n++)e=(t=i(e,n).join("")).match(r);return t}}t.exports=function(t){if("string"!=typeof t)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch(e){return function(t){for(var e={"%FE%FF":"��","%FF%FE":"��"},r=n.exec(t);r;){try{e[r[0]]=decodeURIComponent(r[0])}catch(t){var i=s(r[0]);i!==r[0]&&(e[r[0]]=i)}r=n.exec(t)}e["%C2"]="�";for(var a=Object.keys(e),o=0;o<a.length;o++){var l=a[o];t=t.replace(new RegExp(l,"g"),e[l])}return t}(t)}}},2806:t=>{"use strict";t.exports=function(t,e){for(var r={},n=Object.keys(t),i=Array.isArray(e),s=0;s<n.length;s++){var a=n[s],o=t[a];(i?-1!==e.indexOf(a):e(a,o,t))&&(r[a]=o)}return r}},7631:t=>{!function e(r){t.exports=function(){"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function n(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){var r,s,a;r=e,s=t,a=n[t],(s=i(s))in r?Object.defineProperty(r,s,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[s]=a})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;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 s(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}function a(t,e,r){return e&&s(t.prototype,e),r&&s(t,r),Object.defineProperty(t,"prototype",{writable:!1}),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 n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o.apply(this,arguments)}function l(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,c(t,e)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function h(t,e,r){return h=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 n=[null];n.push.apply(n,e);var i=new(Function.bind.apply(t,n));return r&&c(i,r.prototype),i},h.apply(null,arguments)}function d(t){var e="function"==typeof Map?new Map:void 0;return d=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;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,r)}function r(){return h(t,arguments,u(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),c(r,t)},d(t)}function f(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function p(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 n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var v={exports:{}};!function(t,e){var r,n,i,s,a;r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,s=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,a={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=a.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=a.normalizePath(i.path),a.buildURLFromParts(i)}var s=a.parseURL(e);if(!s)throw new Error("Error trying to parse relative URL.");if(s.scheme)return r.alwaysNormalize?(s.path=a.normalizePath(s.path),a.buildURLFromParts(s)):e;var o=a.parseURL(t);if(!o)throw new Error("Error trying to parse base URL.");if(!o.netLoc&&o.path&&"/"!==o.path[0]){var l=n.exec(o.path);o.netLoc=l[1],o.path=l[2]}o.netLoc&&!o.path&&(o.path="/");var u={scheme:o.scheme,netLoc:s.netLoc,path:null,params:s.params,query:s.query,fragment:s.fragment};if(!s.netLoc&&(u.netLoc=o.netLoc,"/"!==s.path[0]))if(s.path){var c=o.path,h=c.substring(0,c.lastIndexOf("/")+1)+s.path;u.path=a.normalizePath(h)}else u.path=o.path,s.params||(u.params=o.params,s.query||(u.query=o.query));return null===u.path&&(u.path=r.alwaysNormalize?a.normalizePath(s.path):s.path),a.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(i,"");t.length!==(t=t.replace(s,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}},t.exports=a}(v);var m=v.exports,y=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},E=Number.isSafeInteger||function(t){return"number"==typeof t&&Math.abs(t)<=S},S=Number.MAX_SAFE_INTEGER||9007199254740991,b=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.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",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.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t}({}),T=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}({}),_=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}({}),A=function(){},L={trace:A,debug:A,log:A,warn:A,info:A,error:A},w=L;function R(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];r.forEach((function(e){w[e]=t[e]?t[e].bind(t):function(t){var e=self.console[t];return e?e.bind(self.console,"["+t+"] >"):A}(e)}))}function k(t,e){if("object"==typeof console&&!0===t||"object"==typeof t){R(t,"debug","log","info","warn","error");try{w.log('Debug logs enabled for "'+e+'" in hls.js version 1.5.17')}catch(t){w=L}}else w=L}var D=w,I=/^(\d+)x(\d+)$/,P=/(.+?)=(".*?"|.*?)(?:,|$)/g,O=function(){function t(e){"string"==typeof e&&(e=t.parseAttrList(e)),o(this,e)}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),n=0;n<e.length/2;n++)r[n]=parseInt(e.slice(2*n,2*n+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=I.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(P.lastIndex=0;null!==(e=P.exec(t));){var n=e[2];0===n.indexOf('"')&&n.lastIndexOf('"')===n.length-1&&(n=n.slice(1,-1)),r[e[1].trim()]=n}return r},a(t,[{key:"clientAttrs",get:function(){return Object.keys(this).filter((function(t){return"X-"===t.substring(0,2)}))}}]),t}();function C(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 n in r)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]!==r[n]){D.warn('DATERANGE tag attribute: "'+n+'" does not match for tags with ID: "'+t.ID+'"'),this._badValueForSameId=n;break}t=o(new O({}),r,t)}if(this.attr=t,this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){var i=new Date(this.attr["END-DATE"]);y(i.getTime())&&(this._endDate=i)}}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(y(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&&y(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}]),t}(),M=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}},F="audio",N="video",B="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={})[F]=null,e[N]=null,e[B]=null,e),this.baseurl=t}return t.prototype.setByteRange=function(t,e){var r,n=t.split("@",2);r=1===n.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(n[1]),this._byteRange=[r,parseInt(n[0])+r]},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=m.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""},set:function(t){this._url=t}}]),t}(),j=function(t){function e(e,r){var n;return(n=t.call(this,r)||this)._decryptdata=null,n.rawProgramDateTime=null,n.programDateTime=null,n.tagList=[],n.duration=0,n.sn=0,n.levelkeys=void 0,n.type=void 0,n.loader=null,n.keyLoader=null,n.level=-1,n.cc=0,n.startPTS=void 0,n.endPTS=void 0,n.startDTS=void 0,n.endDTS=void 0,n.start=0,n.deltaPTS=void 0,n.maxStartPTS=void 0,n.minEndPTS=void 0,n.stats=new M,n.data=void 0,n.bitrateTest=!1,n.title=null,n.initSegment=null,n.endList=void 0,n.gap=void 0,n.urlId=0,n.type=e,n}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,n,i,s){void 0===s&&(s=!1);var a=this.elementaryStreams,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,i)):a[t]={startPTS:e,endPTS:r,startDTS:n,endDTS:i,partial:s}},r.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[F]=null,t[N]=null,t[B]=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(!y(this.programDateTime))return null;var t=y(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),H=function(t){function e(e,r,n,i,s){var a;(a=t.call(this,n)||this).fragOffset=0,a.duration=0,a.gap=!1,a.independent=!1,a.relurl=void 0,a.fragment=void 0,a.index=void 0,a.stats=new M,a.duration=e.decimalFloatingPoint("DURATION"),a.gap=e.bool("GAP"),a.independent=e.bool("INDEPENDENT"),a.relurl=e.enumeratedString("URI"),a.fragment=r,a.index=i;var o=e.enumeratedString("BYTERANGE");return o&&a.setByteRange(o,s),s&&(a.fragOffset=s.fragOffset+s.duration),a}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),G=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.live,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&&y(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 V(t){return Uint8Array.from(atob(t),(function(t){return t.charCodeAt(0)}))}function K(t){var e,r,n=t.split(":"),i=null;if("data"===n[0]&&2===n.length){var s=n[1].split(";"),a=s[s.length-1].split(",");if(2===a.length){var o="base64"===a[0],l=a[1];o?(s.splice(-1,1),i=V(l)):(e=$(l).subarray(0,16),(r=new Uint8Array(16)).set(e,16-e.length),i=r)}}return i}function $(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(function(t){return t.charCodeAt(0)}))}var W="undefined"!=typeof self?self:void 0,q={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},Y="org.w3.clearkey",z="com.apple.streamingkeydelivery",X="com.microsoft.playready",J="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function Q(t){switch(t){case z:return q.FAIRPLAY;case X:return q.PLAYREADY;case J:return q.WIDEVINE;case Y:return q.CLEARKEY}}var Z="1077efecc0b24d02ace33c1e52e2fb4b",tt="e2719d58a985b3c9781ab030af78d30e",et="9a04f07998404286ab92e65be0885f95",rt="edef8ba979d64acea3c827dcd51d21ed";function nt(t){return t===rt?q.WIDEVINE:t===et?q.PLAYREADY:t===Z||t===tt?q.CLEARKEY:void 0}function it(t){switch(t){case q.FAIRPLAY:return z;case q.PLAYREADY:return X;case q.WIDEVINE:return J;case q.CLEARKEY:return Y}}function st(t){var e=t.drmSystems,r=t.widevineLicenseUrl,n=e?[q.FAIRPLAY,q.WIDEVINE,q.PLAYREADY,q.CLEARKEY].filter((function(t){return!!e[t]})):[];return!n[q.WIDEVINE]&&r&&n.push(q.WIDEVINE),n}var at,ot=null!=W&&null!=(at=W.navigator)&&at.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;function lt(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}var ut,ct=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},ht=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},dt=function(t,e){for(var r=e,n=0;ct(t,e);)n+=10,n+=ft(t,e+6),ht(t,e+10)&&(n+=10),e+=n;if(n>0)return t.subarray(r,r+n)},ft=function(t,e){var r=0;return r=(127&t[e])<<21,r|=(127&t[e+1])<<14,(r|=(127&t[e+2])<<7)|127&t[e+3]},pt=function(t,e){return ct(t,e)&&ft(t,e+6)+10<=t.length-e},gt=function(t){for(var e=yt(t),r=0;r<e.length;r++){var n=e[r];if(vt(n))return _t(n)}},vt=function(t){return t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info},mt=function(t){var e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=ft(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},yt=function(t){for(var e=0,r=[];ct(t,e);){for(var n=ft(t,e+6),i=(e+=10)+n;e+8<i;){var s=mt(t.subarray(e)),a=Et(s);a&&r.push(a),e+=s.size+10}ht(t,e)&&(e+=10)}return r},Et=function(t){return"PRIV"===t.type?St(t):"W"===t.type[0]?Tt(t):bt(t)},St=function(t){if(!(t.size<2)){var e=At(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}}},bt=function(t){if(!(t.size<2)){if("TXXX"===t.type){var e=1,r=At(t.data.subarray(e),!0);e+=r.length+1;var n=At(t.data.subarray(e));return{key:t.type,info:r,data:n}}var i=At(t.data.subarray(1));return{key:t.type,data:i}}},Tt=function(t){if("WXXX"===t.type){if(t.size<2)return;var e=1,r=At(t.data.subarray(e),!0);e+=r.length+1;var n=At(t.data.subarray(e));return{key:t.type,info:r,data:n}}var i=At(t.data);return{key:t.type,data:i}},_t=function(t){if(8===t.data.byteLength){var e=new Uint8Array(t.data),r=1&e[3],n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},At=function(t,e){void 0===e&&(e=!1);var r=Lt();if(r){var n=r.decode(t);if(e){var i=n.indexOf("\0");return-1!==i?n.substring(0,i):n}return n.replace(/\0/g,"")}for(var s,a,o,l=t.length,u="",c=0;c<l;){if(0===(s=t[c++])&&e)return u;if(0!==s&&3!==s)switch(s>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:u+=String.fromCharCode(s);break;case 12:case 13:a=t[c++],u+=String.fromCharCode((31&s)<<6|63&a);break;case 14:a=t[c++],o=t[c++],u+=String.fromCharCode((15&s)<<12|(63&a)<<6|(63&o)<<0)}}return u};function Lt(){if(!navigator.userAgent.includes("PlayStation 4"))return ut||void 0===self.TextDecoder||(ut=new self.TextDecoder("utf-8")),ut}var wt={hexDump:function(t){for(var e="",r=0;r<t.length;r++){var n=t[r].toString(16);n.length<2&&(n="0"+n),e+=n}return e}},Rt=Math.pow(2,32)-1,kt=[].push,Dt={video:1,audio:2,id3:3,text:4};function It(t){return String.fromCharCode.apply(null,t)}function Pt(t,e){var r=t[e]<<8|t[e+1];return r<0?65536+r:r}function Ot(t,e){var r=xt(t,e);return r<0?4294967296+r:r}function Ct(t,e){var r=Ot(t,e);return(r*=Math.pow(2,32))+Ot(t,e+4)}function xt(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function Mt(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 Ft(t,e){var r=[];if(!e.length)return r;for(var n=t.byteLength,i=0;i<n;){var s=Ot(t,i),a=s>1?i+s:n;if(It(t.subarray(i+4,i+8))===e[0])if(1===e.length)r.push(t.subarray(i+8,a));else{var o=Ft(t.subarray(i+8,a),e.slice(1));o.length&&kt.apply(r,o)}i=a}return r}function Nt(t){var e=[],r=t[0],n=8,i=Ot(t,n);n+=4;var s=0,a=0;0===r?(s=Ot(t,n),a=Ot(t,n+4),n+=8):(s=Ct(t,n),a=Ct(t,n+8),n+=16),n+=2;var o=t.length+a,l=Pt(t,n);n+=2;for(var u=0;u<l;u++){var c=n,h=Ot(t,c);c+=4;var d=2147483647&h;if(1==(2147483648&h)>>>31)return D.warn("SIDX has hierarchical references (not supported)"),null;var f=Ot(t,c);c+=4,e.push({referenceSize:d,subsegmentDuration:f,info:{duration:f/i,start:o,end:o+d-1}}),o+=d,n=c+=4}return{earliestPresentationTime:s,timescale:i,version:r,referencesCount:l,references:e}}function Bt(t){for(var e=[],r=Ft(t,["moov","trak"]),i=0;i<r.length;i++){var s=r[i],a=Ft(s,["tkhd"])[0];if(a){var o=a[0],l=Ot(a,0===o?12:20),u=Ft(s,["mdia","mdhd"])[0];if(u){var c=Ot(u,0===(o=u[0])?12:20),h=Ft(s,["mdia","hdlr"])[0];if(h){var d=It(h.subarray(8,12)),f={soun:F,vide:N}[d];if(f){var p=Ut(Ft(s,["mdia","minf","stbl","stsd"])[0]);e[l]={timescale:c,type:f},e[f]=n({timescale:c,id:l},p)}}}}}return Ft(t,["moov","mvex","trex"]).forEach((function(t){var r=Ot(t,4),n=e[r];n&&(n.default={duration:Ot(t,12),flags:Ot(t,20)})})),e}function Ut(t){var e=t.subarray(8),r=e.subarray(86),n=It(e.subarray(4,8)),i=n,s="enca"===n||"encv"===n;if(s){var a=Ft(e,[n])[0];Ft(a.subarray("enca"===n?28:78),["sinf"]).forEach((function(t){var e=Ft(t,["schm"])[0];if(e){var r=It(e.subarray(4,8));if("cbcs"===r||"cenc"===r){var n=Ft(t,["frma"])[0];n&&(i=It(n))}}}))}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":var o=Ft(r,["avcC"])[0];i+="."+Ht(o[1])+Ht(o[2])+Ht(o[3]);break;case"mp4a":var l=Ft(e,[n])[0],u=Ft(l.subarray(28),["esds"])[0];if(u&&u.length>12){var c=4;if(3!==u[c++])break;c=jt(u,c),c+=2;var h=u[c++];if(128&h&&(c+=2),64&h&&(c+=u[c++]),4!==u[c++])break;c=jt(u,c);var d=u[c++];if(64!==d)break;if(i+="."+Ht(d),c+=12,5!==u[c++])break;c=jt(u,c);var f=u[c++],p=(248&f)>>3;31===p&&(p+=1+((7&f)<<3)+((224&u[c])>>5)),i+="."+p}break;case"hvc1":case"hev1":var g=Ft(r,["hvcC"])[0],v=g[1],m=["","A","B","C"][v>>6],y=31&v,E=Ot(g,2),S=(32&v)>>5?"H":"L",b=g[12],T=g.subarray(6,12);i+="."+m+y,i+="."+E.toString(16).toUpperCase(),i+="."+S+b;for(var _="",A=T.length;A--;){var L=T[A];(L||_)&&(_="."+L.toString(16).toUpperCase()+_)}i+=_;break;case"dvh1":case"dvhe":var w=Ft(r,["dvcC"])[0],R=w[2]>>1&127,k=w[2]<<5&32|w[3]>>3&31;i+="."+Gt(R)+"."+Gt(k);break;case"vp09":var D=Ft(r,["vpcC"])[0],I=D[4],P=D[5],O=D[6]>>4&15;i+="."+Gt(I)+"."+Gt(P)+"."+Gt(O);break;case"av01":var C=Ft(r,["av1C"])[0],x=C[1]>>>5,M=31&C[1],F=C[2]>>>7?"H":"M",N=(64&C[2])>>6,B=(32&C[2])>>5,U=2===x&&N?B?12:10:N?10:8,j=(16&C[2])>>4,H=(8&C[2])>>3,G=(4&C[2])>>2,V=3&C[2];i+="."+x+"."+Gt(M)+F+"."+Gt(U)+"."+j+"."+H+G+V+"."+Gt(1)+"."+Gt(1)+"."+Gt(1)+".0"}return{codec:i,encrypted:s}}function jt(t,e){for(var r=e+5;128&t[e++]&&e<r;);return e}function Ht(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function Gt(t){return(t<10?"0":"")+t}function Vt(t){var e=Ft(t,["schm"])[0];if(e){var r=It(e.subarray(4,8));if("cbcs"===r||"cenc"===r)return Ft(t,["schi","tenc"])[0]}return null}function Kt(t){var e=Ot(t,0),r=8;1&e&&(r+=4),4&e&&(r+=4);for(var n=0,i=Ot(t,4),s=0;s<i;s++)256&e&&(n+=Ot(t,r),r+=4),512&e&&(r+=4),1024&e&&(r+=4),2048&e&&(r+=4);return n}function $t(t,e){var r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function Wt(t,e){var r=[],n=e.samples,i=e.timescale,s=e.id,a=!1;return Ft(n,["moof"]).map((function(o){var l=o.byteOffset-8;Ft(o,["traf"]).map((function(o){var u=Ft(o,["tfdt"]).map((function(t){var e=t[0],r=Ot(t,4);return 1===e&&(r*=Math.pow(2,32),r+=Ot(t,8)),r/i}))[0];return void 0!==u&&(t=u),Ft(o,["tfhd"]).map((function(u){var c=Ot(u,4),h=16777215&Ot(u,0),d=0,f=0!=(16&h),p=0,g=0!=(32&h),v=8;c===s&&(0!=(1&h)&&(v+=8),0!=(2&h)&&(v+=4),0!=(8&h)&&(d=Ot(u,v),v+=4),f&&(p=Ot(u,v),v+=4),g&&(v+=4),"video"===e.type&&(a=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)),Ft(o,["trun"]).map((function(s){var o=s[0],u=16777215&Ot(s,0),c=0!=(1&u),h=0,f=0!=(4&u),g=0!=(256&u),v=0,m=0!=(512&u),y=0,E=0!=(1024&u),S=0!=(2048&u),b=0,T=Ot(s,4),_=8;c&&(h=Ot(s,_),_+=4),f&&(_+=4);for(var A=h+l,L=0;L<T;L++){if(g?(v=Ot(s,_),_+=4):v=d,m?(y=Ot(s,_),_+=4):y=p,E&&(_+=4),S&&(b=0===o?Ot(s,_):xt(s,_),_+=4),e.type===N)for(var w=0;w<y;){var R=Ot(n,A);qt(a,n[A+=4])&&Yt(n.subarray(A,A+R),a?2:1,t+b/i,r),A+=R,w+=R+4}t+=v/i}})))}))}))})),r}function qt(t,e){if(t){var r=e>>1&63;return 39===r||40===r}return 6==(31&e)}function Yt(t,e,r,n){var i=zt(t),s=0;s+=e;for(var a=0,o=0,l=0;s<i.length;){a=0;do{if(s>=i.length)break;a+=l=i[s++]}while(255===l);o=0;do{if(s>=i.length)break;o+=l=i[s++]}while(255===l);var u=i.length-s,c=s;if(o<u)s+=o;else if(o>u){D.error("Malformed SEI payload. "+o+" is too small, only "+u+" bytes left to parse.");break}if(4===a){if(181===i[c++]){var h=Pt(i,c);if(c+=2,49===h){var d=Ot(i,c);if(c+=4,1195456820===d){var f=i[c++];if(3===f){var p=i[c++],g=64&p,v=g?2+3*(31&p):0,m=new Uint8Array(v);if(g){m[0]=p;for(var y=1;y<v;y++)m[y]=i[c++]}n.push({type:f,payloadType:a,pts:r,bytes:m})}}}}}else if(5===a&&o>16){for(var E=[],S=0;S<16;S++){var b=i[c++].toString(16);E.push(1==b.length?"0"+b:b),3!==S&&5!==S&&7!==S&&9!==S||E.push("-")}for(var T=o-16,_=new Uint8Array(T),A=0;A<T;A++)_[A]=i[c++];n.push({payloadType:a,pts:r,uuid:E.join(""),userData:At(_),userDataBytes:_})}}}function zt(t){for(var e=t.byteLength,r=[],n=1;n<e-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return t;var i=e-r.length,s=new Uint8Array(i),a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),s[n]=t[a];return s}function Xt(t,e,r){if(16!==t.byteLength)throw new RangeError("Invalid system id");var n,i,s;if(e){n=1,i=new Uint8Array(16*e.length);for(var a=0;a<e.length;a++){var o=e[a];if(16!==o.byteLength)throw new RangeError("Invalid key");i.set(o,16*a)}}else n=0,i=new Uint8Array;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=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),n=1;n<e;n++)r[n-1]=arguments[n];for(var i=r.length,s=8,a=i;a--;)s+=r[a].byteLength;var o=new Uint8Array(s);for(o[0]=s>>24&255,o[1]=s>>16&255,o[2]=s>>8&255,o[3]=255&s,o.set(t,4),a=0,s=8;a<i;a++)o.set(r[a],s),s+=r[a].byteLength;return o}([112,115,115,104],new Uint8Array([n,0,0,0]),t,s,i,l,r||new Uint8Array)}function Jt(t){var e=t.getUint32(0),r=t.byteOffset,n=t.byteLength;if(n<e)return{offset:r,size:n};if(1886614376!==t.getUint32(4))return{offset:r,size:e};var i=t.getUint32(8)>>>24;if(0!==i&&1!==i)return{offset:r,size:e};var s=t.buffer,a=wt.hexDump(new Uint8Array(s,r+12,16)),o=t.getUint32(28),l=null,u=null;if(0===i){if(e-32<o||o<22)return{offset:r,size:e};u=new Uint8Array(s,r+32,o)}else if(1===i){if(!o||n<r+32+16*o+16)return{offset:r,size:e};l=[];for(var c=0;c<o;c++)l.push(new Uint8Array(s,r+32+16*c,16))}return{version:i,systemId:a,kids:l,data:u,offset:r,size:e}}var Qt={},Zt=function(){function t(t,e,r,n,i){void 0===n&&(n=[1]),void 0===i&&(i=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=n,this.iv=i,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&"AES-128"!==t}t.clearKeyUriToKeyIdMap=function(){Qt={}};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 z:case J:case X:case Y: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||D.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 n=K(this.uri);if(n)switch(this.keyFormat){case J:this.pssh=n,n.length>=22&&(this.keyId=n.subarray(n.length-22,n.length-6));break;case X:var i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=Xt(i,null,n);var s=new Uint16Array(n.buffer,n.byteOffset,n.byteLength/2),a=String.fromCharCode.apply(null,Array.from(s)),o=a.substring(a.indexOf("<"),a.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 c=V(u).subarray(0,16);(function(t){var e=function(t,e,r){var n=t[e];t[e]=t[r],t[r]=n};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)})(c),this.keyId=c}}break;default:var h=n.subarray(0,16);if(16!==h.length){var d=new Uint8Array(16);d.set(h,16-h.length),h=d}this.keyId=h}if(!this.keyId||16!==this.keyId.byteLength){var f=Qt[this.uri];if(!f){var p=Object.keys(Qt).length%Number.MAX_SAFE_INTEGER;f=new Uint8Array(16),new DataView(f.buffer,12,4).setUint32(0,p),Qt[this.uri]=f}this.keyId=f}return this},t}();var te=/\{\$([a-zA-Z0-9-_]+)\}/g;function ee(t){return te.test(t)}function re(t,e,r){if(null!==t.variableList||t.hasVariableRefs)for(var n=r.length;n--;){var i=r[n],s=e[i];s&&(e[i]=ne(t,s))}}function ne(t,e){if(null!==t.variableList||t.hasVariableRefs){var r=t.variableList;return e.replace(te,(function(e){var n=e.substring(2,e.length-1),i=null==r?void 0:r[n];return void 0===i?(t.playlistParsingError||(t.playlistParsingError=new Error('Missing preceding EXT-X-DEFINE tag for Variable Reference: "'+n+'"')),e):i}))}return e}function ie(t,e,r){var n,i,s=t.variableList;if(s||(t.variableList=s={}),"QUERYPARAM"in e){n=e.QUERYPARAM;try{var a=new self.URL(r).searchParams;if(!a.has(n))throw new Error('"'+n+'" does not match any query parameter in URI: "'+r+'"');i=a.get(n)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error("EXT-X-DEFINE QUERYPARAM: "+e.message))}}else n=e.NAME,i=e.VALUE;n in s?t.playlistParsingError||(t.playlistParsingError=new Error('EXT-X-DEFINE duplicate Variable Name declarations: "'+n+'"')):s[n]=i||""}function se(t,e,r){var n=e.IMPORT;if(r&&n in r){var i=t.variableList;i||(t.variableList=i={}),i[n]=r[n]}else t.playlistParsingError||(t.playlistParsingError=new Error('EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "'+n+'"'))}function ae(t){if(void 0===t&&(t=!0),"undefined"!=typeof self)return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}var oe={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function le(t,e,r){return void 0===r&&(r=!0),!t.split(",").some((function(t){return!ue(t,e,r)}))}function ue(t,e,r){var n;void 0===r&&(r=!0);var i=ae(r);return null!=(n=null==i?void 0:i.isTypeSupported(ce(t,e)))&&n}function ce(t,e){return e+'/mp4;codecs="'+t+'"'}function he(t){if(t){var e=t.substring(0,4);return oe.video[e]}return 2}function de(t){return t.split(",").reduce((function(t,e){var r=oe.video[e];return r?(2*r+t)/(t?3:2):(oe.audio[e]+t)/(t?2:1)}),0)}var fe={};var pe=/flac|opus/i;function ge(t,e){return void 0===e&&(e=!0),t.replace(pe,(function(t){return function(t,e){if(void 0===e&&(e=!0),fe[t])return fe[t];for(var r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[t],n=0;n<r.length;n++)if(ue(r[n],"audio",e))return fe[t]=r[n],r[n];return t}(t.toLowerCase(),e)}))}function ve(t,e){return t&&"mp4a"!==t?t:e?e.split(",")[0]:e}var me=/#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,ye=/#EXT-X-MEDIA:(.*)/g,Ee=/^#EXT(?:INF|-X-TARGETDURATION):/m,Se=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),be=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|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|")),Te=function(){function t(){}return t.findGroup=function(t,e){for(var r=0;r<t.length;r++){var n=t[r];if(n.id===e)return n}},t.resolve=function(t,e){return m.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.isMediaPlaylist=function(t){return Ee.test(t)},t.parseMasterPlaylist=function(e,r){var n,i={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:ee(e)},s=[];for(me.lastIndex=0;null!=(n=me.exec(e));)if(n[1]){var a,o=new O(n[1]);re(i,o,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);var l=ne(i,n[2]),u={attrs:o,bitrate:o.decimalInteger("BANDWIDTH")||o.decimalInteger("AVERAGE-BANDWIDTH"),name:o.NAME,url:t.resolve(l,r)},c=o.decimalResolution("RESOLUTION");c&&(u.width=c.width,u.height=c.height),Le(o.CODECS,u),null!=(a=u.unknownCodecs)&&a.length||s.push(u),i.levels.push(u)}else if(n[3]){var h=n[3],d=n[4];switch(h){case"SESSION-DATA":var f=new O(d);re(i,f,["DATA-ID","LANGUAGE","VALUE","URI"]);var p=f["DATA-ID"];p&&(null===i.sessionData&&(i.sessionData={}),i.sessionData[p]=f);break;case"SESSION-KEY":var g=_e(d,r,i);g.encrypted&&g.isSupported()?(null===i.sessionKeys&&(i.sessionKeys=[]),i.sessionKeys.push(g)):D.warn('[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "'+d+'"');break;case"DEFINE":var v=new O(d);re(i,v,["NAME","VALUE","QUERYPARAM"]),ie(i,v,r);break;case"CONTENT-STEERING":var m=new O(d);re(i,m,["SERVER-URI","PATHWAY-ID"]),i.contentSteering={uri:t.resolve(m["SERVER-URI"],r),pathwayId:m["PATHWAY-ID"]||"."};break;case"START":i.startTimeOffset=Ae(d)}}var y=s.length>0&&s.length<i.levels.length;return i.levels=y?s:i.levels,0===i.levels.length&&(i.playlistParsingError=new Error("no levels found in manifest")),i},t.parseMasterPlaylistMedia=function(e,r,n){var i,s={},a=n.levels,o={AUDIO:a.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),SUBTITLES:a.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),"CLOSED-CAPTIONS":[]},l=0;for(ye.lastIndex=0;null!==(i=ye.exec(e));){var u=new O(i[1]),c=u.TYPE;if(c){var h=o[c],d=s[c]||[];s[c]=d,re(n,u,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);var f=u.LANGUAGE,p=u["ASSOC-LANGUAGE"],g=u.CHANNELS,v=u.CHARACTERISTICS,m=u["INSTREAM-ID"],y={attrs:u,bitrate:0,id:l++,groupId:u["GROUP-ID"]||"",name:u.NAME||f||"",type:c,default:u.bool("DEFAULT"),autoselect:u.bool("AUTOSELECT"),forced:u.bool("FORCED"),lang:f,url:u.URI?t.resolve(u.URI,r):""};if(p&&(y.assocLang=p),g&&(y.channels=g),v&&(y.characteristics=v),m&&(y.instreamId=m),null!=h&&h.length){var E=t.findGroup(h,y.groupId)||h[0];we(y,E,"audioCodec"),we(y,E,"textCodec")}d.push(y)}}return s},t.parseLevelPlaylist=function(t,e,r,n,i,s){var a,l,u,c=new G(e),h=c.fragments,d=null,f=0,p=0,g=0,v=0,m=null,E=new j(n,e),S=-1,b=!1,T=null;for(Se.lastIndex=0,c.m3u8=t,c.hasVariableRefs=ee(t);null!==(a=Se.exec(t));){b&&(b=!1,(E=new j(n,e)).start=g,E.sn=f,E.cc=v,E.level=r,d&&(E.initSegment=d,E.rawProgramDateTime=d.rawProgramDateTime,d.rawProgramDateTime=null,T&&(E.setByteRange(T),T=null)));var _=a[1];if(_){E.duration=parseFloat(_);var A=(" "+a[2]).slice(1);E.title=A||null,E.tagList.push(A?["INF",_,A]:["INF",_])}else if(a[3]){if(y(E.duration)){E.start=g,u&&De(E,u,c),E.sn=f,E.level=r,E.cc=v,h.push(E);var L=(" "+a[3]).slice(1);E.relurl=ne(c,L),Re(E,m),m=E,g+=E.duration,f++,p=0,b=!0}}else if(a[4]){var w=(" "+a[4]).slice(1);m?E.setByteRange(w,m):E.setByteRange(w)}else if(a[5])E.rawProgramDateTime=(" "+a[5]).slice(1),E.tagList.push(["PROGRAM-DATE-TIME",E.rawProgramDateTime]),-1===S&&(S=h.length);else{if(!(a=a[0].match(be))){D.warn("No matches on slow regex match for level playlist!");continue}for(l=1;l<a.length&&void 0===a[l];l++);var R=(" "+a[l]).slice(1),k=(" "+a[l+1]).slice(1),I=a[l+2]?(" "+a[l+2]).slice(1):"";switch(R){case"PLAYLIST-TYPE":c.type=k.toUpperCase();break;case"MEDIA-SEQUENCE":f=c.startSN=parseInt(k);break;case"SKIP":var P=new O(k);re(c,P,["RECENTLY-REMOVED-DATERANGES"]);var C=P.decimalInteger("SKIPPED-SEGMENTS");if(y(C)){c.skippedSegments=C;for(var M=C;M--;)h.unshift(null);f+=C}var F=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");F&&(c.recentlyRemovedDateranges=F.split("\t"));break;case"TARGETDURATION":c.targetduration=Math.max(parseInt(k),1);break;case"VERSION":c.version=parseInt(k);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":c.live=!1;break;case"#":(k||I)&&E.tagList.push(I?[k,I]:[k]);break;case"DISCONTINUITY":v++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([R]);break;case"BITRATE":E.tagList.push([R,k]);break;case"DATERANGE":var N=new O(k);re(c,N,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),re(c,N,N.clientAttrs);var B=new x(N,c.dateRanges[N.ID]);B.isValid||c.skippedSegments?c.dateRanges[B.id]=B:D.warn('Ignoring invalid DATERANGE tag: "'+k+'"'),E.tagList.push(["EXT-X-DATERANGE",k]);break;case"DEFINE":var U=new O(k);re(c,U,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in U?se(c,U,s):ie(c,U,e);break;case"DISCONTINUITY-SEQUENCE":v=parseInt(k);break;case"KEY":var V=_e(k,e,c);if(V.isSupported()){if("NONE"===V.method){u=void 0;break}u||(u={}),u[V.keyFormat]&&(u=o({},u)),u[V.keyFormat]=V}else D.warn('[Keys] Ignoring invalid EXT-X-KEY tag: "'+k+'"');break;case"START":c.startTimeOffset=Ae(k);break;case"MAP":var K=new O(k);if(re(c,K,["BYTERANGE","URI"]),E.duration){var $=new j(n,e);ke($,K,r,u),d=$,E.initSegment=d,d.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=d.rawProgramDateTime)}else{var W=E.byteRangeEndOffset;if(W){var q=E.byteRangeStartOffset;T=W-q+"@"+q}else T=null;ke(E,K,r,u),d=E,b=!0}break;case"SERVER-CONTROL":var Y=new O(k);c.canBlockReload=Y.bool("CAN-BLOCK-RELOAD"),c.canSkipUntil=Y.optionalFloat("CAN-SKIP-UNTIL",0),c.canSkipDateRanges=c.canSkipUntil>0&&Y.bool("CAN-SKIP-DATERANGES"),c.partHoldBack=Y.optionalFloat("PART-HOLD-BACK",0),c.holdBack=Y.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var z=new O(k);c.partTarget=z.decimalFloatingPoint("PART-TARGET");break;case"PART":var X=c.partList;X||(X=c.partList=[]);var J=p>0?X[X.length-1]:void 0,Q=p++,Z=new O(k);re(c,Z,["BYTERANGE","URI"]);var tt=new H(Z,E,e,Q,J);X.push(tt),E.duration+=tt.duration;break;case"PRELOAD-HINT":var et=new O(k);re(c,et,["URI"]),c.preloadHint=et;break;case"RENDITION-REPORT":var rt=new O(k);re(c,rt,["URI"]),c.renditionReports=c.renditionReports||[],c.renditionReports.push(rt);break;default:D.warn("line parsed but not handled: "+a)}}}m&&!m.relurl?(h.pop(),g-=m.duration,c.partList&&(c.fragmentHint=m)):c.partList&&(Re(E,m),E.cc=v,c.fragmentHint=E,u&&De(E,u,c));var nt=h.length,it=h[0],st=h[nt-1];if((g+=c.skippedSegments*c.targetduration)>0&&nt&&st){c.averagetargetduration=g/nt;var at=st.sn;c.endSN="initSegment"!==at?at:0,c.live||(st.endList=!0),it&&(c.startCC=it.cc)}else c.endSN=0,c.startCC=0;return c.fragmentHint&&(g+=c.fragmentHint.duration),c.totalduration=g,c.endCC=v,S>0&&function(t,e){for(var r=t[e],n=e;n--;){var i=t[n];if(!i)return;i.programDateTime=r.programDateTime-1e3*i.duration,r=i}}(h,S),c},t}();function _e(t,e,r){var n,i,s=new O(t);re(r,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);var a=null!=(n=s.METHOD)?n:"",o=s.URI,l=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,c=null!=(i=s.KEYFORMAT)?i:"identity";o&&s.IV&&!l&&D.error("Invalid IV: "+s.IV);var h=o?Te.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Zt(a,h,c,d,l)}function Ae(t){var e=new O(t).decimalFloatingPoint("TIME-OFFSET");return y(e)?e:null}function Le(t,e){var r=(t||"").split(/[ ,]+/).filter((function(t){return t}));["video","audio","text"].forEach((function(t){var n=r.filter((function(e){return function(t,e){var r=oe[e];return!!r&&!!r[t.slice(0,4)]}(e,t)}));n.length&&(e[t+"Codec"]=n.join(","),r=r.filter((function(t){return-1===n.indexOf(t)})))})),e.unknownCodecs=r}function we(t,e,r){var n=e[r];n&&(t[r]=n)}function Re(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),y(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function ke(t,e,r,n){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=r,t.sn="initSegment",n&&(t.levelkeys=n),t.initSegment=null}function De(t,e,r){t.levelkeys=e;var n=r.encryptedFragments;n.length&&n[n.length-1].levelkeys===e||!Object.keys(e).some((function(t){return e[t].isCommonEncryption}))||n.push(t)}var Ie="manifest",Pe="level",Oe="audioTrack",Ce="subtitleTrack",xe="main",Me="audio",Fe="subtitle";function Ne(t){switch(t.type){case Oe:return Me;case Ce:return Fe;default:return xe}}function Be(t,e){var r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r}var Ue=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(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.LEVEL_LOADING,this.onLevelLoading,this),t.on(b.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(b.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.LEVEL_LOADING,this.onLevelLoading,this),t.off(b.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(b.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,r=e.pLoader,n=e.loader,i=new(r||n)(e);return this.loaders[t.type]=i,i},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:Ie,url:r,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var r=e.id,n=e.level,i=e.pathwayId,s=e.url,a=e.deliveryDirectives;this.load({id:r,level:n,pathwayId:i,responseType:"text",type:Pe,url:s,deliveryDirectives:a})},e.onAudioTrackLoading=function(t,e){var r=e.id,n=e.groupId,i=e.url,s=e.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:Oe,url:i,deliveryDirectives:s})},e.onSubtitleTrackLoading=function(t,e){var r=e.id,n=e.groupId,i=e.url,s=e.deliveryDirectives;this.load({id:r,groupId:n,level:null,responseType:"text",type:Ce,url:i,deliveryDirectives:s})},e.load=function(t){var e,r,n,i=this,s=this.hls.config,a=this.getInternalLoader(t);if(a){var l=a.context;if(l&&l.url===t.url&&l.level===t.level)return void D.trace("[playlist-loader]: playlist request ongoing");D.log("[playlist-loader]: aborting previous loader for type: "+t.type),a.abort()}if(r=t.type===Ie?s.manifestLoadPolicy.default:o({},s.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),a=this.createInternalLoader(t),y(null==(e=t.deliveryDirectives)?void 0:e.part)&&(t.type===Pe&&null!==t.level?n=this.hls.levels[t.level].details:t.type===Oe&&null!==t.id?n=this.hls.audioTracks[t.id].details:t.type===Ce&&null!==t.id&&(n=this.hls.subtitleTracks[t.id].details),n)){var u=n.partTarget,c=n.targetduration;if(u&&c){var h=1e3*Math.max(3*u,.8*c);r=o({},r,{maxTimeToFirstByteMs:Math.min(h,r.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(h,r.maxTimeToFirstByteMs)})}}var d=r.errorRetry||r.timeoutRetry||{},f={loadPolicy:r,timeout:r.maxLoadTimeMs,maxRetry:d.maxNumRetry||0,retryDelay:d.retryDelayMs||0,maxRetryDelay:d.maxRetryDelayMs||0},p={onSuccess:function(t,e,r,n){var s=i.getInternalLoader(r);i.resetInternalLoader(r.type);var a=t.data;0===a.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),Te.isMediaPlaylist(a)?i.handleTrackOrLevelPlaylist(t,e,r,n||null,s):i.handleMasterPlaylist(t,e,r,n)):i.handleManifestParsingError(t,r,new Error("no EXTM3U delimiter"),n||null,e)},onError:function(t,e,r,n){i.handleNetworkError(e,r,!1,t,n)},onTimeout:function(t,e,r){i.handleNetworkError(e,r,!0,void 0,t)}};a.load(t,f,p)},e.handleMasterPlaylist=function(t,e,r,n){var i=this.hls,s=t.data,a=Be(t,r),o=Te.parseMasterPlaylist(s,a);if(o.playlistParsingError)this.handleManifestParsingError(t,r,o.playlistParsingError,n,e);else{var l=o.contentSteering,u=o.levels,c=o.sessionData,h=o.sessionKeys,d=o.startTimeOffset,f=o.variableList;this.variableList=f;var p=Te.parseMasterPlaylistMedia(s,a,o),g=p.AUDIO,v=void 0===g?[]:g,m=p.SUBTITLES,y=p["CLOSED-CAPTIONS"];v.length&&(v.some((function(t){return!t.url}))||!u[0].audioCodec||u[0].attrs.AUDIO||(D.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new O({}),bitrate:0,url:""}))),i.trigger(b.MANIFEST_LOADED,{levels:u,audioTracks:v,subtitles:m,captions:y,contentSteering:l,url:a,stats:e,networkDetails:n,sessionData:c,sessionKeys:h,startTimeOffset:d,variableList:f})}},e.handleTrackOrLevelPlaylist=function(t,e,r,n,i){var s=this.hls,a=r.id,o=r.level,l=r.type,u=Be(t,r),c=y(o)?o:y(a)?a:0,h=Ne(r),d=Te.parseLevelPlaylist(t.data,u,c,h,0,this.variableList);if(l===Ie){var f={attrs:new O({}),bitrate:0,details:d,name:"",url:u};s.trigger(b.MANIFEST_LOADED,{levels:[f],audioTracks:[],url:u,stats:e,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),r.levelDetails=d,this.handlePlaylistLoaded(d,t,e,r,n,i)},e.handleManifestParsingError=function(t,e,r,n,i){this.hls.trigger(b.ERROR,{type:T.NETWORK_ERROR,details:_.MANIFEST_PARSING_ERROR,fatal:e.type===Ie,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:n,stats:i})},e.handleNetworkError=function(t,e,r,i,s){void 0===r&&(r=!1);var a="A network "+(r?"timeout":"error"+(i?" (status "+i.code+")":""))+" occurred while loading "+t.type;t.type===Pe?a+=": "+t.level+" id: "+t.id:t.type!==Oe&&t.type!==Ce||(a+=" id: "+t.id+' group-id: "'+t.groupId+'"');var o=new Error(a);D.warn("[playlist-loader]: "+a);var l=_.UNKNOWN,u=!1,c=this.getInternalLoader(t);switch(t.type){case Ie:l=r?_.MANIFEST_LOAD_TIMEOUT:_.MANIFEST_LOAD_ERROR,u=!0;break;case Pe:l=r?_.LEVEL_LOAD_TIMEOUT:_.LEVEL_LOAD_ERROR,u=!1;break;case Oe:l=r?_.AUDIO_TRACK_LOAD_TIMEOUT:_.AUDIO_TRACK_LOAD_ERROR,u=!1;break;case Ce:l=r?_.SUBTITLE_TRACK_LOAD_TIMEOUT:_.SUBTITLE_LOAD_ERROR,u=!1}c&&this.resetInternalLoader(t.type);var h={type:T.NETWORK_ERROR,details:l,fatal:u,url:t.url,loader:c,context:t,error:o,networkDetails:e,stats:s};if(i){var d=(null==e?void 0:e.url)||t.url;h.response=n({url:d,data:void 0},i)}this.hls.trigger(b.ERROR,h)},e.handlePlaylistLoaded=function(t,e,r,n,i,s){var a=this.hls,o=n.type,l=n.level,u=n.id,c=n.groupId,h=n.deliveryDirectives,d=Be(e,n),f=Ne(n),p="number"==typeof n.level&&f===xe?l:void 0;if(t.fragments.length){t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));var g=t.playlistParsingError;if(g)a.trigger(b.ERROR,{type:T.NETWORK_ERROR,details:_.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:g,reason:g.message,response:e,context:n,level:p,parent:f,networkDetails:i,stats:r});else switch(t.live&&s&&(s.getCacheAge&&(t.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),o){case Ie:case Pe:a.trigger(b.LEVEL_LOADED,{details:t,level:p||0,id:u||0,stats:r,networkDetails:i,deliveryDirectives:h});break;case Oe:a.trigger(b.AUDIO_TRACK_LOADED,{details:t,id:u||0,groupId:c||"",stats:r,networkDetails:i,deliveryDirectives:h});break;case Ce:a.trigger(b.SUBTITLE_TRACK_LOADED,{details:t,id:u||0,groupId:c||"",stats:r,networkDetails:i,deliveryDirectives:h})}}else{var v=new Error("No Segments found in Playlist");a.trigger(b.ERROR,{type:T.NETWORK_ERROR,details:_.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:v,reason:v.message,response:e,context:n,level:p,parent:f,networkDetails:i,stats:r})}},t}();function je(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 He(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){D.debug("[texttrack-utils]: "+r);try{var n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,t.addCue(n)}catch(t){D.debug("[texttrack-utils]: Legacy TextTrackCue fallback failed: "+t)}}"disabled"===r&&(t.mode=r)}function Ge(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 Ve(t,e,r,n){var i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues&&t.cues.length>0)for(var s=function(t,e,r){var n=[],i=function(t,e){if(e<t[0].startTime)return 0;var r=t.length-1;if(e>t[r].endTime)return-1;for(var n=0,i=r;n<=i;){var s=Math.floor((i+n)/2);if(e<t[s].startTime)i=s-1;else{if(!(e>t[s].startTime&&n<r))return s;n=s+1}}return t[n].startTime-e<e-t[i].startTime?n:i}(t,e);if(i>-1)for(var s=i,a=t.length;s<a;s++){var o=t[s];if(o.startTime>=e&&o.endTime<=r)n.push(o);else if(o.startTime>r)return n}return n}(t.cues,e,r),a=0;a<s.length;a++)n&&!n(s[a])||t.removeCue(s[a]);"disabled"===i&&(t.mode=i)}function Ke(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||e.push(t[r])}return e}var $e="org.id3",We="com.apple.quicktime.HLS",qe="https://aomedia.org/emsg/ID3";function Ye(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function ze(t,e,r,i,s){var a=new t(e,r,"");try{a.value=i,s&&(a.type=s)}catch(o){a=new t(e,r,JSON.stringify(s?n({type:s},i):i))}return a}var Xe=function(){var t=Ye();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY}();function Je(t,e){return t.getTime()/1e3-e}var Qe=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(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(b.LEVEL_UPDATED,this.onLevelUpdated,this)},e._unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(b.LEVEL_UPDATED,this.onLevelUpdated,this)},e.onMediaAttached=function(t,e){this.media=e.media},e.onMediaDetaching=function(){this.id3Track&&(Ge(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 je(r,this.media),r}return this.media.addTextTrack("metadata","id3")}},e.onFragParsingMetadata=function(t,e){if(this.media){var r=this.hls.config,n=r.enableEmsgMetadataCues,i=r.enableID3MetadataCues;if(n||i){var s=e.samples;this.id3Track||(this.id3Track=this.createTrack(this.media));var a=Ye();if(a)for(var o=0;o<s.length;o++){var l=s[o].type;if((l!==qe||n)&&i){var u=yt(s[o].data);if(u){var c=s[o].pts,h=c+s[o].duration;h>Xe&&(h=Xe),h-c<=0&&(h=c+.25);for(var d=0;d<u.length;d++){var f=u[d];if(!vt(f)){this.updateId3CueEnds(c,l);var p=ze(a,c,h,f,l);p&&this.id3Track.addCue(p)}}}}}}}},e.updateId3CueEnds=function(t,e){var r,n=null==(r=this.id3Track)?void 0:r.cues;if(n)for(var i=n.length;i--;){var s=n[i];s.type===e&&s.startTime<t&&s.endTime===Xe&&(s.endTime=t)}},e.onBufferFlushing=function(t,e){var r=e.startOffset,n=e.endOffset,i=e.type,s=this.id3Track,a=this.hls;if(a){var o=a.config,l=o.enableEmsgMetadataCues,u=o.enableID3MetadataCues;s&&(l||u)&&Ve(s,r,n,"audio"===i?function(t){return t.type===$e&&u}:"video"===i?function(t){return t.type===qe&&l}:function(t){return t.type===$e&&u||t.type===qe&&l})}},e.onLevelUpdated=function(t,e){var r=this,n=e.details;if(this.media&&n.hasProgramDateTime&&this.hls.config.enableDateRangeMetadataCues){var i=this.dateRangeCuesAppended,s=this.id3Track,a=n.dateRanges,o=Object.keys(a);if(s)for(var l=Object.keys(i).filter((function(t){return!o.includes(t)})),u=function(){var t=l[c];Object.keys(i[t].cues).forEach((function(e){s.removeCue(i[t].cues[e])})),delete i[t]},c=l.length;c--;)u();var h=n.fragments[n.fragments.length-1];if(0!==o.length&&y(null==h?void 0:h.programDateTime)){this.id3Track||(this.id3Track=this.createTrack(this.media));for(var d=h.programDateTime/1e3-h.start,f=Ye(),p=function(){var t,e,n=o[g],s=a[n],l=Je(s.startDate,d),u=i[n],c=(null==u?void 0:u.cues)||{},h=(null==u?void 0:u.durationKnown)||!1,p=Xe,v=s.endDate;if(v)p=Je(v,d),h=!0;else if(s.endOnNext&&!h){var m=o.reduce((function(t,e){if(e!==s.id){var r=a[e];if(r.class===s.class&&r.startDate>s.startDate&&(!t||s.startDate<t.startDate))return r}return t}),null);m&&(p=Je(m.startDate,d),h=!0)}for(var y=Object.keys(s.attr),E=0;E<y.length;E++){var S=y[E];if("ID"!==(e=S)&&"CLASS"!==e&&"START-DATE"!==e&&"DURATION"!==e&&"END-DATE"!==e&&"END-ON-NEXT"!==e){var b=c[S];if(b)h&&!u.durationKnown&&(b.endTime=p);else if(f){var T=s.attr[S];C(S)&&(t=T,T=Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);var _=ze(f,l,p,{key:S,data:T},We);_&&(_.id=n,r.id3Track.addCue(_),c[S]=_)}}}i[n]={cues:c,dateRange:s,durationKnown:h}},g=0;g<o.length;g++)p()}}},t}(),Ze=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(b.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(b.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(b.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(b.ERROR,this.onError,this)},e.unregisterListeners=function(){this.hls.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(b.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(b.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(b.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===_.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(r=this.levelDetails)&&r.live&&D.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 n=this.config,i=n.lowLatencyMode,s=n.maxLiveSyncPlaybackRate;if(i&&1!==s&&e.live){var a=this.targetLatency;if(null!==a){var o=r-a;if(o<Math.min(this.maxLatency,a+e.targetduration)&&o>.05&&this.forwardBufferLength>1){var l=Math.min(2,Math.max(1,s)),u=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;t.playbackRate=Math.min(l,Math.max(1,u))}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,n=t.targetduration,i=this.config,s=i.liveSyncDuration,a=i.liveSyncDurationCount,o=i.lowLatencyMode,l=this.hls.userConfig,u=o&&r||e;(l.liveSyncDuration||l.liveSyncDurationCount||0===u)&&(u=void 0!==s?s:a*n);var c=n;return u+Math.min(1*this.stallCount,c)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,r=this.levelDetails;if(null===t||null===e||null===r)return null;var n=r.edge,i=t-e-this.edgeStalled,s=n-r.totalduration,a=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(s,i),a)}},{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}(),tr=["NONE","TYPE-0","TYPE-1",null];var er=["SDR","PQ","HLG"];var rr="",nr="YES",ir="v2";function sr(t){var e=t.canSkipUntil,r=t.canSkipDateRanges,n=t.age;return e&&n<e/2?r?ir:nr:rr}var ar=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}(),or=function(){function t(t){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter((function(t){return!!t})).map((function(t){return t.substring(0,4)})).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}var e=t.prototype;return e.hasAudioGroup=function(t){return lr(this._audioGroups,t)},e.hasSubtitleGroup=function(t){return lr(this._subtitleGroups,t)},e.addGroupId=function(t,e){if(e)if("audio"===t){var r=this._audioGroups;r||(r=this._audioGroups=[]),-1===r.indexOf(e)&&r.push(e)}else if("text"===t){var n=this._subtitleGroups;n||(n=this._subtitleGroups=[]),-1===n.indexOf(e)&&n.push(e)}},e.addFallback=function(){},a(t,[{key:"maxBitrate",get:function(){return Math.max(this.realBitrate,this.bitrate)}},{key:"averageBitrate",get:function(){return this._avgBitrate||this.realBitrate||this.bitrate}},{key:"attrs",get:function(){return this._attrs[0]}},{key:"codecs",get:function(){return this.attrs.CODECS||""}},{key:"pathwayId",get:function(){return this.attrs["PATHWAY-ID"]||"."}},{key:"videoRange",get:function(){return this.attrs["VIDEO-RANGE"]||"SDR"}},{key:"score",get:function(){return this.attrs.optionalFloat("SCORE",0)}},{key:"uri",get:function(){return this.url[0]||""}},{key:"audioGroups",get:function(){return this._audioGroups}},{key:"subtitleGroups",get:function(){return this._subtitleGroups}},{key:"urlId",get:function(){return 0},set:function(t){}},{key:"audioGroupIds",get:function(){return this.audioGroups?[this.audioGroupId]:void 0}},{key:"textGroupIds",get:function(){return this.subtitleGroups?[this.textGroupId]:void 0}},{key:"audioGroupId",get:function(){var t;return null==(t=this.audioGroups)?void 0:t[0]}},{key:"textGroupId",get:function(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}}]),t}();function lr(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}function ur(t,e){var r=e.startPTS;if(y(r)){var n,i=0;e.sn>t.sn?(i=r-t.start,n=t):(i=t.start-r,n=e),n.duration!==i&&(n.duration=i)}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 cr(t,e,r,n,i,s){n-r<=0&&(D.warn("Fragment should have a positive duration",e),n=r+e.duration,s=i+e.duration);var a=r,o=n,l=e.startPTS,u=e.endPTS;if(y(l)){var c=Math.abs(l-r);y(e.deltaPTS)?e.deltaPTS=Math.max(c,e.deltaPTS):e.deltaPTS=c,a=Math.max(r,l),r=Math.min(r,l),i=Math.min(i,e.startDTS),o=Math.min(n,u),n=Math.max(n,u),s=Math.max(s,e.endDTS)}var h=r-e.start;0!==e.start&&(e.start=r),e.duration=n-e.start,e.startPTS=r,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=o,e.endDTS=s;var d,f=e.sn;if(!t||f<t.startSN||f>t.endSN)return 0;var p=f-t.startSN,g=t.fragments;for(g[p]=e,d=p;d>0;d--)ur(g[d],g[d-1]);for(d=p;d<g.length-1;d++)ur(g[d],g[d+1]);return t.fragmentHint&&ur(g[g.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,h}function hr(t,e){for(var r=null,n=t.fragments,i=n.length-1;i>=0;i--){var s=n[i].initSegment;if(s){r=s;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var a,l,u,c,h,d=0;if(function(t,e,r){for(var n=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,s=(t.fragmentHint?1:0)+(n?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=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=i;u<=s;u++){var c=l[a+u],h=o[u];n&&!h&&u<n&&(h=e.fragments[u]=c),c&&h&&r(c,h)}}(t,e,(function(t,n){t.relurl&&(d=t.cc-n.cc),y(t.startPTS)&&y(t.endPTS)&&(n.start=n.startPTS=t.startPTS,n.startDTS=t.startDTS,n.maxStartPTS=t.maxStartPTS,n.endPTS=t.endPTS,n.endDTS=t.endDTS,n.minEndPTS=t.minEndPTS,n.duration=t.endPTS-t.startPTS,n.duration&&(a=n),e.PTSKnown=e.alignedSliding=!0),n.elementaryStreams=t.elementaryStreams,n.loader=t.loader,n.stats=t.stats,t.initSegment&&(n.initSegment=t.initSegment,r=t.initSegment)})),r&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((function(t){var e;!t||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){D.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,c=e.recentlyRemovedDateranges,h=o({},l),c&&c.forEach((function(t){delete h[t]})),Object.keys(u).forEach((function(t){var e=new x(u[t].attr,h[t]);e.isValid?h[t]=e:D.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(u[t].attr)+'"')})),h));var p=e.fragments;if(d){D.warn("discontinuity sliding from playlist, take drift into account");for(var g=0;g<p.length;g++)p[g].cc+=d}e.skippedSegments&&(e.startCC=e.fragments[0].cc),function(t,e,r){if(t&&e)for(var n=0,i=0,s=t.length;i<=s;i++){var a=t[i],o=e[i+n];a&&o&&a.index===o.index&&a.fragment.sn===o.fragment.sn?r(a,o):n--}}(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),a?cr(e,a,a.startPTS,a.endPTS,a.startDTS,a.endDTS):dr(t,e),p.length&&(e.totalduration=e.edge-p[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var v=e.advancedDateTime;if(e.advanced&&v){var m=e.edge;e.driftStart||(e.driftStartTime=v,e.driftStart=m),e.driftEndTime=v,e.driftEnd=m}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function dr(t,e){var r=e.startSN+e.skippedSegments-t.startSN,n=t.fragments;r<0||r>=n.length||fr(e,n[r].start)}function fr(t,e){if(e){for(var r=t.fragments,n=t.skippedSegments;n<r.length;n++)r[n].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function pr(t,e,r){var n;return null!=t&&t.details?gr(null==(n=t.details)?void 0:n.partList,e,r):null}function gr(t,e,r){if(t)for(var n=t.length;n--;){var i=t[n];if(i.index===r&&i.fragment.sn===e)return i}return null}function vr(t){t.forEach((function(t,e){var r=t.details;null!=r&&r.fragments&&r.fragments.forEach((function(t){t.level=e}))}))}function mr(t){switch(t.details){case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_TIMEOUT:case _.LEVEL_LOAD_TIMEOUT:case _.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function yr(t,e){var r=mr(e);return t.default[(r?"timeout":"error")+"Retry"]}function Er(t,e){var r="linear"===t.backoff?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function Sr(t){return n(n({},t),{errorRetry:null,timeoutRetry:null})}function br(t,e,r,n){if(!t)return!1;var i=null==n?void 0:n.code,s=e<t.maxNumRetry&&(function(t){return 0===t&&!1===navigator.onLine||!!t&&(t<400||t>499)}(i)||!!r);return t.shouldRetry?t.shouldRetry(t,e,r,n,s):s}var Tr=function(t,e){for(var r=0,n=t.length-1,i=null,s=null;r<=n;){var a=e(s=t[i=(r+n)/2|0]);if(a>0)r=i+1;else{if(!(a<0))return s;n=i-1}}return null};function _r(t,e,r,n,i){void 0===r&&(r=0),void 0===n&&(n=0),void 0===i&&(i=.005);var s=null;if(t){s=e[t.sn-e[0].sn+1]||null;var a=t.endDTS-r;a>0&&a<15e-7&&(r+=15e-7)}else 0===r&&0===e[0].start&&(s=e[0]);if(s&&((!t||t.level===s.level)&&0===Ar(r,n,s)||function(t,e,r){if(e&&0===e.start&&e.level<t.level&&(e.endPTS||0)>0){var n=e.tagList.reduce((function(t,e){return"INF"===e[0]&&(t+=parseFloat(e[1])),t}),r);return t.start<=n}return!1}(s,t,Math.min(i,n))))return s;var o=Tr(e,Ar.bind(null,r,n));return!o||o===t&&s?s:o}function Ar(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 n=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=t?1:r.start-n>t&&r.start?-1:0}function Lr(t,e,r){var n=1e3*Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>t}var wr=0,Rr=2,kr=3,Dr=5,Ir=0,Pr=1,Or=2,Cr=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=D.log.bind(D,"[info]:"),this.warn=D.warn.bind(D,"[warning]:"),this.error=D.error.bind(D,"[error]:"),this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(b.ERROR,this.onError,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.LEVEL_UPDATED,this.onLevelUpdated,this)},e.unregisterListeners=function(){var t=this.hls;t&&(t.off(b.ERROR,this.onError,this),t.off(b.ERROR,this.onErrorOut,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.LEVEL_UPDATED,this.onLevelUpdated,this))},e.destroy=function(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}},e.startLoad=function(t){},e.stopLoad=function(){this.playlistError=0},e.getVariantLevelIndex=function(t){return(null==t?void 0:t.type)===xe?t.level:this.hls.loadLevel},e.onManifestLoading=function(){this.playlistError=0,this.penalizedRenditions={}},e.onLevelUpdated=function(){this.playlistError=0},e.onError=function(t,e){var r,n;if(!e.fatal){var i=this.hls,s=e.context;switch(e.details){case _.FRAG_LOAD_ERROR:case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_ERROR:case _.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case _.FRAG_PARSING_ERROR:if(null!=(r=e.frag)&&r.gap)return void(e.errorAction={action:wr,flags:Ir});case _.FRAG_GAP:case _.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=Rr);case _.LEVEL_EMPTY_ERROR:case _.LEVEL_PARSING_ERROR:var a,o,l=e.parent===xe?e.level:i.loadLevel;return void(e.details===_.LEVEL_EMPTY_ERROR&&null!=(a=e.context)&&null!=(o=a.levelDetails)&&o.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,l):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,l)));case _.LEVEL_LOAD_ERROR:case _.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==s?void 0:s.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,s.level)));case _.AUDIO_TRACK_LOAD_ERROR:case _.AUDIO_TRACK_LOAD_TIMEOUT:case _.SUBTITLE_LOAD_ERROR:case _.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){var u=i.levels[i.loadLevel];if(u&&(s.type===Oe&&u.hasAudioGroup(s.groupId)||s.type===Ce&&u.hasSubtitleGroup(s.groupId)))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,i.loadLevel),e.errorAction.action=Rr,void(e.errorAction.flags=Pr)}return;case _.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:var c=i.levels[i.loadLevel],h=null==c?void 0:c.attrs["HDCP-LEVEL"];return void(h?e.errorAction={action:Rr,flags:Or,hdcpLevel:h}:this.keySystemError(e));case _.BUFFER_ADD_CODEC_ERROR:case _.REMUX_ALLOC_ERROR:case _.BUFFER_APPEND_ERROR:return void(e.errorAction=this.getLevelSwitchAction(e,null!=(n=e.level)?n:i.loadLevel));case _.INTERNAL_EXCEPTION:case _.BUFFER_APPENDING_ERROR:case _.BUFFER_FULL_ERROR:case _.LEVEL_SWITCH_ERROR:case _.BUFFER_STALLED_ERROR:case _.BUFFER_SEEK_OVER_HOLE:case _.BUFFER_NUDGE_ON_STALL:return void(e.errorAction={action:wr,flags:Ir})}e.type===T.KEY_SYSTEM_ERROR&&this.keySystemError(e)}},e.keySystemError=function(t){var e=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e)},e.getPlaylistRetryOrSwitchAction=function(t,e){var r=yr(this.hls.config.playlistLoadPolicy,t),n=this.playlistError++;if(br(r,n,mr(t),t.response))return{action:Dr,flags:Ir,retryConfig:r,retryCount:n};var i=this.getLevelSwitchAction(t,e);return r&&(i.retryConfig=r,i.retryCount=n),i},e.getFragRetryOrSwitchAction=function(t){var e=this.hls,r=this.getVariantLevelIndex(t.frag),n=e.levels[r],i=e.config,s=i.fragLoadPolicy,a=i.keyLoadPolicy,o=yr(t.details.startsWith("key")?a:s,t),l=e.levels.reduce((function(t,e){return t+e.fragmentError}),0);if(n&&(t.details!==_.FRAG_GAP&&n.fragmentError++,br(o,l,mr(t),t.response)))return{action:Dr,flags:Ir,retryConfig:o,retryCount:l};var u=this.getLevelSwitchAction(t,r);return o&&(u.retryConfig=o,u.retryCount=l),u},e.getLevelSwitchAction=function(t,e){var r=this.hls;null==e&&(e=r.loadLevel);var n=this.hls.levels[e];if(n){var i,s,a=t.details;n.loadError++,a===_.BUFFER_APPEND_ERROR&&n.fragmentError++;var o=-1,l=r.levels,u=r.loadLevel,c=r.minAutoLevel,h=r.maxAutoLevel;r.autoLevelEnabled||(r.loadLevel=-1);for(var d,f=null==(i=t.frag)?void 0:i.type,p=(f===Me&&a===_.FRAG_PARSING_ERROR||"audio"===t.sourceBufferName&&(a===_.BUFFER_ADD_CODEC_ERROR||a===_.BUFFER_APPEND_ERROR))&&l.some((function(t){var e=t.audioCodec;return n.audioCodec!==e})),g="video"===t.sourceBufferName&&(a===_.BUFFER_ADD_CODEC_ERROR||a===_.BUFFER_APPEND_ERROR)&&l.some((function(t){var e=t.codecSet,r=t.audioCodec;return n.codecSet!==e&&n.audioCodec===r})),v=null!=(s=t.context)?s:{},m=v.type,y=v.groupId,E=function(){var e=(S+u)%l.length;if(e!==u&&e>=c&&e<=h&&0===l[e].loadError){var r,i,s=l[e];if(a===_.FRAG_GAP&&f===xe&&t.frag){var d=l[e].details;if(d){var v=_r(t.frag,d.fragments,t.frag.start);if(null!=v&&v.gap)return 0}}else{if(m===Oe&&s.hasAudioGroup(y)||m===Ce&&s.hasSubtitleGroup(y))return 0;if(f===Me&&null!=(r=n.audioGroups)&&r.some((function(t){return s.hasAudioGroup(t)}))||f===Fe&&null!=(i=n.subtitleGroups)&&i.some((function(t){return s.hasSubtitleGroup(t)}))||p&&n.audioCodec===s.audioCodec||!p&&n.audioCodec!==s.audioCodec||g&&n.codecSet===s.codecSet)return 0}return o=e,1}},S=l.length;S--&&(0===(d=E())||1!==d););if(o>-1&&r.loadLevel!==o)return t.levelRetry=!0,this.playlistError=0,{action:Rr,flags:Ir,nextAutoLevel:o}}return{action:Rr,flags:Pr}},e.onErrorOut=function(t,e){var r;switch(null==(r=e.errorAction)?void 0:r.action){case wr:break;case Rr:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===_.FRAG_GAP?/MediaSource readyState: ended/.test(e.error.message)&&(this.warn('MediaSource ended after "'+e.sourceBufferName+'" sourceBuffer append error. Attempting to recover from media error.'),this.hls.recoverMediaError()):e.fatal=!0}e.fatal&&this.hls.stopLoad()},e.sendAlternateToPenaltyBox=function(t){var e=this.hls,r=t.errorAction;if(r){var n=r.flags,i=r.hdcpLevel,s=r.nextAutoLevel;switch(n){case Ir:this.switchLevel(t,s);break;case Or:i&&(e.maxHdcpLevel=tr[tr.indexOf(i)-1],r.resolved=!0),this.warn('Restricting playback to HDCP-LEVEL of "'+e.maxHdcpLevel+'" or lower')}r.resolved||this.switchLevel(t,s)}},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)},t}(),xr=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=D.log.bind(D,e+":"),this.warn=D.warn.bind(D,e+":"),this.hls=t}var e=t.prototype;return e.destroy=function(){this.clearTimer(),this.hls=this.log=this.warn=null},e.clearTimer=function(){-1!==this.timer&&(self.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,r){var n=null==e?void 0:e.renditionReports;if(n){for(var i=-1,s=0;s<n.length;s++){var a=n[s],o=void 0;try{o=new self.URL(a.URI,e.url).href}catch(t){D.warn("Could not construct new URL for Rendition Report: "+t),o=a.URI||""}if(o===t){i=s;break}o===t.substring(0,o.length)&&(i=s)}if(-1!==i){var l=n[i],u=parseInt(l["LAST-MSN"])||(null==e?void 0:e.lastPartSn),c=parseInt(l["LAST-PART"])||(null==e?void 0:e.lastPartIndex);if(this.hls.config.lowLatencyMode){var h=Math.min(e.age-e.partTarget,e.targetduration);c>=0&&h>e.partTarget&&(c+=1)}var d=r&&sr(r);return new ar(u,c>=0?c:void 0,d)}}},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 n=this,i=e.details,s=e.stats,a=self.performance.now(),o=s.loading.first?Math.max(0,a-s.loading.first):0;if(i.advancedDateTime=Date.now()-o,i.live||null!=r&&r.live){if(i.reloaded(r),r&&this.log("live playlist "+t+" "+(i.advanced?"REFRESHED "+i.lastPartSn+"-"+i.lastPartIndex:i.updated?"UPDATED":"MISSED")),r&&i.fragments.length>0&&hr(r,i),!this.canLoad||!i.live)return;var l,u=void 0,c=void 0;if(i.canBlockReload&&i.endSN&&i.advanced){var h=this.hls.config.lowLatencyMode,d=i.lastPartSn,f=i.endSN,p=i.lastPartIndex,g=d===f;-1!==p?(u=g?f+1:d,c=g?h?0:p:p+1):u=f+1;var v=i.age,m=v+i.ageHeader,y=Math.min(m-i.partTarget,1.5*i.targetduration);if(y>0){if(r&&y>r.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+r.tuneInGoal+" to: "+y+" with playlist age: "+i.age),y=0;else{var E=Math.floor(y/i.targetduration);u+=E,void 0!==c&&(c+=Math.round(y%i.targetduration/i.partTarget)),this.log("CDN Tune-in age: "+i.ageHeader+"s last advanced "+v.toFixed(2)+"s goal: "+y+" skip sn "+E+" to part "+c)}i.tuneInGoal=y}if(l=this.getDeliveryDirectives(i,e.deliveryDirectives,u,c),h||!g)return void this.loadPlaylist(l)}else(i.canBlockReload||i.canSkipUntil)&&(l=this.getDeliveryDirectives(i,e.deliveryDirectives,u,c));var S=this.hls.mainForwardBufferInfo,b=S?S.end-S.len:0,T=function(t,e){void 0===e&&(e=1/0);var r=1e3*t.targetduration;if(t.updated){var n=t.fragments;if(n.length&&4*r>e){var i=1e3*n[n.length-1].duration;i<r&&(r=i)}}else r/=2;return Math.round(r)}(i,1e3*(i.edge-b));i.updated&&a>this.requestScheduled+T&&(this.requestScheduled=s.loading.start),void 0!==u&&i.canBlockReload?this.requestScheduled=s.loading.first+T-(1e3*i.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+T<a?this.requestScheduled=a:this.requestScheduled-a<=0&&(this.requestScheduled+=T);var _=this.requestScheduled-a;_=Math.max(0,_),this.log("reload live playlist "+t+" in "+Math.round(_)+" ms"),this.timer=self.setTimeout((function(){return n.loadPlaylist(l)}),_)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,r,n){var i=sr(t);return null!=e&&e.skip&&t.deltaUpdateFailed&&(r=e.msn,n=e.part,i=rr),new ar(r,n,i)},e.checkRetry=function(t){var e=this,r=t.details,n=mr(t),i=t.errorAction,s=i||{},a=s.action,o=s.retryCount,l=void 0===o?0:o,u=s.retryConfig,c=!!i&&!!u&&(a===Dr||!i.resolved&&a===Rr);if(c){var h;if(this.requestScheduled=-1,l>=u.maxNumRetry)return!1;if(n&&null!=(h=t.context)&&h.deliveryDirectives)this.warn("Retrying playlist loading "+(l+1)+"/"+u.maxNumRetry+' after "'+r+'" without delivery-directives'),this.loadPlaylist();else{var d=Er(u,l);this.timer=self.setTimeout((function(){return e.loadPlaylist()}),d),this.warn("Retrying playlist loading "+(l+1)+"/"+u.maxNumRetry+' after "'+r+'" in '+d+"ms")}t.levelRetry=!0,i.resolved=!0}return c},t}(),Mr=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}(),Fr=function(){function t(t,e,r,n){void 0===n&&(n=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 Mr(t),this.fast_=new Mr(e),this.defaultTTFB_=n,this.ttfb_=new Mr(t)}var e=t.prototype;return e.update=function(t,e){var r=this.slow_,n=this.fast_,i=this.ttfb_;r.halfLife!==t&&(this.slow_=new Mr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.fast_=new Mr(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.ttfb_=new Mr(t,i.getEstimate(),i.getTotalWeight()))},e.sample=function(t,e){var r=(t=Math.max(t,this.minDelayMs_))/1e3,n=8*e/r;this.fast_.sample(r,n),this.slow_.sample(r,n)},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}(),Nr={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},Br={};function Ur(t,e,r){var i=t.videoCodec,s=t.audioCodec;if(!i||!s||!r)return Promise.resolve(Nr);var a={width:t.width,height:t.height,bitrate:Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)),framerate:t.frameRate||30},o=t.videoRange;"SDR"!==o&&(a.transferFunction=o.toLowerCase());var l=i.split(",").map((function(t){return{type:"media-source",video:n(n({},a),{},{contentType:ce(t,"video")})}}));return s&&t.audioGroups&&t.audioGroups.forEach((function(t){var r;t&&(null==(r=e.groups[t])||r.tracks.forEach((function(e){if(e.groupId===t){var r=e.channels||"",n=parseFloat(r);y(n)&&n>2&&l.push.apply(l,s.split(",").map((function(t){return{type:"media-source",audio:{contentType:ce(t,"audio"),channels:""+n}}})))}})))})),Promise.all(l.map((function(t){var e=function(t){var e=t.audio,r=t.video,n=r||e;if(n){var i=n.contentType.split('"')[1];if(r)return"r"+r.height+"x"+r.width+"f"+Math.ceil(r.framerate)+(r.transferFunction||"sd")+"_"+i+"_"+Math.ceil(r.bitrate/1e5);if(e)return"c"+e.channels+(e.spatialRendering?"s":"n")+"_"+i}return""}(t);return Br[e]||(Br[e]=r.decodingInfo(t))}))).then((function(t){return{supported:!t.some((function(t){return!t.supported})),configurations:l,decodingInfoResults:t}})).catch((function(t){return{supported:!1,configurations:l,decodingInfoResults:[],error:t}}))}function jr(t,e){var r=!1,n=[];return t&&(r="SDR"!==t,n=[t]),e&&(n=e.allowedVideoRanges||er.slice(0),n=(r=void 0!==e.preferHDR?e.preferHDR:function(){if("function"==typeof matchMedia){var t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return!0===t.matches}return!1}())?n.filter((function(t){return"SDR"!==t})):["SDR"]),{preferHDR:r,allowedVideoRanges:n}}function Hr(t,e){D.log('[abr] start candidates with "'+t+'" ignored because '+e)}function Gr(t,e,r){if("attrs"in t){var n=e.indexOf(t);if(-1!==n)return n}for(var i=0;i<e.length;i++)if(Vr(t,e[i],r))return i;return-1}function Vr(t,e,r){var n=t.groupId,i=t.name,s=t.lang,a=t.assocLang,o=t.characteristics,l=t.default,u=t.forced;return(void 0===n||e.groupId===n)&&(void 0===i||e.name===i)&&(void 0===s||e.lang===s)&&(void 0===s||e.assocLang===a)&&(void 0===l||e.default===l)&&(void 0===u||e.forced===u)&&(void 0===o||function(t,e){void 0===e&&(e="");var r=t.split(","),n=e.split(",");return r.length===n.length&&!r.some((function(t){return-1===n.indexOf(t)}))}(o,e.characteristics))&&(void 0===r||r(t,e))}function Kr(t,e){var r=t.audioCodec,n=t.channels;return!(void 0!==r&&(e.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==n&&n!==(e.channels||"2"))}function $r(t,e,r){for(var n=e;n>-1;n--)if(r(t[n]))return n;for(var i=e+1;i<t.length;i++)if(r(t[i]))return i;return-1}var Wr=function(){function t(t){var e=this;this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=function(){var t=e.fragCurrent,r=e.partCurrent,n=e.hls,i=n.autoLevelEnabled,s=n.media;if(t&&s){var a=performance.now(),o=r?r.stats:t.stats,l=r?r.duration:t.duration,u=a-o.loading.start,c=n.minAutoLevel;if(o.aborted||o.loaded&&o.loaded===o.total||t.level<=c)return e.clearTimer(),void(e._nextAutoLevel=-1);if(i&&!s.paused&&s.playbackRate&&s.readyState){var h=n.mainForwardBufferInfo;if(null!==h){var d=e.bwEstimator.getEstimateTTFB(),f=Math.abs(s.playbackRate);if(!(u<=Math.max(d,l/(2*f)*1e3))){var p=h.len/f,g=o.loading.first?o.loading.first-o.loading.start:-1,v=o.loaded&&g>-1,m=e.getBwEstimate(),E=n.levels,S=E[t.level],T=o.total||Math.max(o.loaded,Math.round(l*S.averageBitrate/8)),_=v?u-g:u;_<1&&v&&(_=Math.min(u,8*o.loaded/m));var A=v?1e3*o.loaded/_:0,L=A?(T-o.loaded)/A:8*T/m+d/1e3;if(!(L<=p)){var w,R=A?8*A:m,k=Number.POSITIVE_INFINITY;for(w=t.level-1;w>c;w--){var I=E[w].maxBitrate;if((k=e.getTimeToLoadFrag(d/1e3,R,l*I,!E[w].details))<p)break}if(!(k>=L||k>10*l)){n.nextLoadLevel=n.nextAutoLevel=w,v?e.bwEstimator.sample(u-Math.min(d,g),o.loaded):e.bwEstimator.sampleTTFB(u);var P=E[w].maxBitrate;e.getBwEstimate()*e.hls.config.abrBandWidthUpFactor>P&&e.resetEstimator(P),e.clearTimer(),D.warn("[abr] Fragment "+t.sn+(r?" part "+r.index:"")+" of level "+t.level+" is loading too slowly;\n      Time to underbuffer: "+p.toFixed(3)+" s\n      Estimated load time for current fragment: "+L.toFixed(3)+" s\n      Estimated load time for down switch fragment: "+k.toFixed(3)+" s\n      TTFB estimate: "+(0|g)+" ms\n      Current BW estimate: "+(y(m)?0|m:"Unknown")+" bps\n      New BW estimate: "+(0|e.getBwEstimate())+" bps\n      Switching to level "+w+" @ "+(0|P)+" bps"),n.trigger(b.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:r,stats:o})}}}}}}},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}var e=t.prototype;return e.resetEstimator=function(t){t&&(D.log("setting initial bwe to "+t),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()},e.initEstimator=function(){var t=this.hls.config;return new Fr(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)},e.registerListeners=function(){var t=this.hls;t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.FRAG_LOADING,this.onFragLoading,this),t.on(b.FRAG_LOADED,this.onFragLoaded,this),t.on(b.FRAG_BUFFERED,this.onFragBuffered,this),t.on(b.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(b.LEVEL_LOADED,this.onLevelLoaded,this),t.on(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(b.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(b.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t&&(t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.FRAG_LOADING,this.onFragLoading,this),t.off(b.FRAG_LOADED,this.onFragLoaded,this),t.off(b.FRAG_BUFFERED,this.onFragBuffered,this),t.off(b.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(b.LEVEL_LOADED,this.onLevelLoaded,this),t.off(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(b.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(b.ERROR,this.onError,this))},e.destroy=function(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null},e.onManifestLoading=function(t,e){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()},e.onLevelsUpdated=function(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null},e.onMaxAutoLevelUpdated=function(){this.firstSelection=-1,this.nextAutoLevelKey=""},e.onFragLoading=function(t,e){var r,n=e.frag;this.ignoreFragment(n)||(n.bitrateTest||(this.fragCurrent=n,this.partCurrent=null!=(r=e.part)?r:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))},e.onLevelSwitching=function(t,e){this.clearTimer()},e.onError=function(t,e){if(!e.fatal)switch(e.details){case _.BUFFER_ADD_CODEC_ERROR:case _.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case _.FRAG_LOAD_TIMEOUT:var r=e.frag,n=this.fragCurrent,i=this.partCurrent;if(r&&n&&r.sn===n.sn&&r.level===n.level){var s=performance.now(),a=i?i.stats:r.stats,o=s-a.loading.start,l=a.loading.first?a.loading.first-a.loading.start:-1;if(a.loaded&&l>-1){var u=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(o-Math.min(u,l),a.loaded)}else this.bwEstimator.sampleTTFB(o)}}},e.getTimeToLoadFrag=function(t,e,r,n){return t+r/e+(n?this.lastLevelLoadSec:0)},e.onLevelLoaded=function(t,e){var r=this.hls.config,n=e.stats.loading,i=n.end-n.start;y(i)&&(this.lastLevelLoadSec=i/1e3),e.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)},e.onFragLoaded=function(t,e){var r=e.frag,n=e.part,i=n?n.stats:r.stats;if(r.type===xe&&this.bwEstimator.sampleTTFB(i.loading.first-i.loading.start),!this.ignoreFragment(r)){if(this.clearTimer(),r.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){var s=n?n.duration:r.duration,a=this.hls.levels[r.level],o=(a.loaded?a.loaded.bytes:0)+i.loaded,l=(a.loaded?a.loaded.duration:0)+s;a.loaded={bytes:o,duration:l},a.realBitrate=Math.round(8*o/l)}if(r.bitrateTest){var u={stats:i,frag:r,part:n,id:r.type};this.onFragBuffered(b.FRAG_BUFFERED,u),r.bitrateTest=!1}else this.lastLoadedFragLevel=r.level}},e.onFragBuffered=function(t,e){var r=e.frag,n=e.part,i=null!=n&&n.stats.loaded?n.stats:r.stats;if(!i.aborted&&!this.ignoreFragment(r)){var s=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,i.loaded),i.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}},e.ignoreFragment=function(t){return t.type!==xe||"initSegment"===t.sn},e.clearTimer=function(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)},e.getAutoLevelKey=function(){return this.getBwEstimate()+"_"+this.getStarvationDelay().toFixed(2)},e.getNextABRAutoLevel=function(){var t=this.fragCurrent,e=this.partCurrent,r=this.hls,n=r.maxAutoLevel,i=r.config,s=r.minAutoLevel,a=e?e.duration:t?t.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay(),u=i.abrBandWidthFactor,c=i.abrBandWidthUpFactor;if(l){var h=this.findBestLevel(o,s,n,l,0,u,c);if(h>=0)return h}var d=a?Math.min(a,i.maxStarvationDelay):i.maxStarvationDelay;if(!l){var f=this.bitrateTestDelay;f&&(d=(a?Math.min(a,i.maxLoadingDelay):i.maxLoadingDelay)-f,D.info("[abr] bitrate test took "+Math.round(1e3*f)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*d)+" ms"),u=c=1)}var p=this.findBestLevel(o,s,n,l,d,u,c);if(D.info("[abr] "+(l?"rebuffering expected":"buffer is empty")+", optimal quality level "+p),p>-1)return p;var g=r.levels[s],v=r.levels[r.loadLevel];return(null==g?void 0:g.bitrate)<(null==v?void 0:v.bitrate)?s:r.loadLevel},e.getStarvationDelay=function(){var t=this.hls,e=t.media;if(!e)return 1/0;var r=e&&0!==e.playbackRate?Math.abs(e.playbackRate):1,n=t.mainForwardBufferInfo;return(n?n.len:0)/r},e.getBwEstimate=function(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate},e.findBestLevel=function(t,e,r,n,i,s,a){var o,l=this,u=n+i,c=this.lastLoadedFragLevel,h=-1===c?this.hls.firstLevel:c,d=this.fragCurrent,f=this.partCurrent,p=this.hls,g=p.levels,v=p.allAudioTracks,m=p.loadLevel,E=p.config;if(1===g.length)return 0;var S,b=g[h],T=!(null==b||null==(o=b.details)||!o.live),_=-1===m||-1===c,A="SDR",L=(null==b?void 0:b.frameRate)||0,w=E.audioPreference,R=E.videoPreference,k=this.audioTracksByGroup||(this.audioTracksByGroup=function(t){return t.reduce((function(t,e){var r=t.groups[e.groupId];r||(r=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(e);var n=e.channels||"2";return r.channels[n]=(r.channels[n]||0)+1,r.hasDefault=r.hasDefault||e.default,r.hasAutoSelect=r.hasAutoSelect||e.autoselect,r.hasDefault&&(t.hasDefaultAudio=!0),r.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(v));if(_){if(-1!==this.firstSelection)return this.firstSelection;var I=function(t,e,r,n,i){for(var s=Object.keys(t),a=null==n?void 0:n.channels,o=null==n?void 0:n.audioCodec,l=a&&2===parseInt(a),u=!0,c=!1,h=1/0,d=1/0,f=1/0,p=0,g=[],v=jr(e,i),m=v.preferHDR,E=v.allowedVideoRanges,S=function(){var e=t[s[b]];u=e.channels[2]>0,h=Math.min(h,e.minHeight),d=Math.min(d,e.minFramerate),f=Math.min(f,e.minBitrate);var r=E.filter((function(t){return e.videoRanges[t]>0}));r.length>0&&(c=!0,g=r)},b=s.length;b--;)S();h=y(h)?h:0,d=y(d)?d:0;var T=Math.max(1080,h),_=Math.max(30,d);return f=y(f)?f:r,r=Math.max(f,r),c||(e=void 0,g=[]),{codecSet:s.reduce((function(e,n){var i=t[n];if(n===e)return e;if(i.minBitrate>r)return Hr(n,"min bitrate of "+i.minBitrate+" > current estimate of "+r),e;if(!i.hasDefaultAudio)return Hr(n,"no renditions with default or auto-select sound found"),e;if(o&&n.indexOf(o.substring(0,4))%5!=0)return Hr(n,'audio codec preference "'+o+'" not found'),e;if(a&&!l){if(!i.channels[a])return Hr(n,"no renditions with "+a+" channel sound found (channels options: "+Object.keys(i.channels)+")"),e}else if((!o||l)&&u&&0===i.channels[2])return Hr(n,"no renditions with stereo sound found"),e;return i.minHeight>T?(Hr(n,"min resolution of "+i.minHeight+" > maximum of "+T),e):i.minFramerate>_?(Hr(n,"min framerate of "+i.minFramerate+" > maximum of "+_),e):g.some((function(t){return i.videoRanges[t]>0}))?i.maxScore<p?(Hr(n,"max score of "+i.maxScore+" < selected max of "+p),e):e&&(de(n)>=de(e)||i.fragmentError>t[e].fragmentError)?e:(p=i.maxScore,n):(Hr(n,"no variants with VIDEO-RANGE of "+JSON.stringify(g)+" found"),e)}),void 0),videoRanges:g,preferHDR:m,minFramerate:d,minBitrate:f}}(this.codecTiers||(this.codecTiers=function(t,e,r,n){return t.slice(r,n+1).reduce((function(t,r){if(!r.codecSet)return t;var n=r.audioGroups,i=t[r.codecSet];i||(t[r.codecSet]=i={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),i.minBitrate=Math.min(i.minBitrate,r.bitrate);var s=Math.min(r.height,r.width);return i.minHeight=Math.min(i.minHeight,s),i.minFramerate=Math.min(i.minFramerate,r.frameRate),i.maxScore=Math.max(i.maxScore,r.score),i.fragmentError+=r.fragmentError,i.videoRanges[r.videoRange]=(i.videoRanges[r.videoRange]||0)+1,n&&n.forEach((function(t){if(t){var r=e.groups[t];r&&(i.hasDefaultAudio=i.hasDefaultAudio||e.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(r.channels).forEach((function(t){i.channels[t]=(i.channels[t]||0)+r.channels[t]})))}})),t}),{})}(g,k,e,r)),A,t,w,R),P=I.codecSet,O=I.videoRanges,C=I.minFramerate,x=I.minBitrate,M=I.preferHDR;S=P,A=M?O[O.length-1]:O[0],L=C,t=Math.max(t,x),D.log("[abr] picked start tier "+JSON.stringify(I))}else S=null==b?void 0:b.codecSet,A=null==b?void 0:b.videoRange;for(var F,N=f?f.duration:d?d.duration:0,B=this.bwEstimator.getEstimateTTFB()/1e3,U=[],j=function(){var e,o=g[H],d=H>h;if(!o)return 0;if(E.useMediaCapabilities&&!o.supportedResult&&!o.supportedPromise){var p=navigator.mediaCapabilities;"function"==typeof(null==p?void 0:p.decodingInfo)&&function(t,e,r,n,i,s){var a=t.audioCodec?t.audioGroups:null,o=null==s?void 0:s.audioCodec,l=null==s?void 0:s.channels,u=l?parseInt(l):o?1/0:2,c=null;if(null!=a&&a.length)try{c=1===a.length&&a[0]?e.groups[a[0]].channels:a.reduce((function(t,r){if(r){var n=e.groups[r];if(!n)throw new Error("Audio track group "+r+" not found");Object.keys(n.channels).forEach((function(e){t[e]=(t[e]||0)+n.channels[e]}))}return t}),{2:0})}catch(t){return!0}return void 0!==t.videoCodec&&(t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(n,30)||"SDR"!==t.videoRange&&t.videoRange!==r||t.bitrate>Math.max(i,8e6))||!!c&&y(u)&&Object.keys(c).some((function(t){return parseInt(t)>u}))}(o,k,A,L,t,w)?(o.supportedPromise=Ur(o,k,p),o.supportedPromise.then((function(t){if(l.hls){o.supportedResult=t;var e=l.hls.levels,r=e.indexOf(o);t.error?D.warn('[abr] MediaCapabilities decodingInfo error: "'+t.error+'" for level '+r+" "+JSON.stringify(t)):t.supported||(D.warn("[abr] Unsupported MediaCapabilities decodingInfo result for level "+r+" "+JSON.stringify(t)),r>-1&&e.length>1&&(D.log("[abr] Removing unsupported level "+r),l.hls.removeLevel(r)))}}))):o.supportedResult=Nr}if(S&&o.codecSet!==S||A&&o.videoRange!==A||d&&L>o.frameRate||!d&&L>0&&L<o.frameRate||o.supportedResult&&(null==(e=o.supportedResult.decodingInfoResults)||!e[0].smooth))return U.push(H),0;var v,R=o.details,I=(f?null==R?void 0:R.partTarget:null==R?void 0:R.averagetargetduration)||N;v=d?a*t:s*t;var P=N&&n>=2*N&&0===i?g[H].averageBitrate:g[H].maxBitrate,O=l.getTimeToLoadFrag(B,v,P*I,void 0===R);if(v>=P&&(H===c||0===o.loadError&&0===o.fragmentError)&&(O<=B||!y(O)||T&&!l.bitrateTestDelay||O<u)){var C=l.forcedAutoLevel;return H===m||-1!==C&&C===m||(U.length&&D.trace("[abr] Skipped level(s) "+U.join(",")+" of "+r+' max with CODECS and VIDEO-RANGE:"'+g[U[0]].codecs+'" '+g[U[0]].videoRange+'; not compatible with "'+b.codecs+'" '+A),D.info("[abr] switch candidate:"+h+"->"+H+" adjustedbw("+Math.round(v)+")-bitrate="+Math.round(v-P)+" ttfb:"+B.toFixed(1)+" avgDuration:"+I.toFixed(1)+" maxFetchDuration:"+u.toFixed(1)+" fetchDuration:"+O.toFixed(1)+" firstSelection:"+_+" codecSet:"+S+" videoRange:"+A+" hls.loadLevel:"+m)),_&&(l.firstSelection=H),{v:H}}},H=r;H>=e;H--)if(0!==(F=j())&&F)return F.v;return-1},a(t,[{key:"firstAutoLevel",get:function(){var t=this.hls,e=t.maxAutoLevel,r=t.minAutoLevel,n=this.getBwEstimate(),i=this.hls.config.maxStarvationDelay,s=this.findBestLevel(n,r,e,0,i,1,1);if(s>-1)return s;var a=this.hls.firstLevel,o=Math.min(Math.max(a,r),e);return D.warn("[abr] Could not find best starting auto level. Defaulting to first in playlist "+a+" clamped to "+o),o}},{key:"forcedAutoLevel",get:function(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}},{key:"nextAutoLevel",get:function(){var t=this.forcedAutoLevel,e=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===t||e&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return t;var n=e&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==t){var i=this.hls.levels;if(i.length>Math.max(t,n)&&i[t].loadError<=i[n].loadError)return t}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n},set:function(t){var e=this.hls,r=e.maxAutoLevel,n=e.minAutoLevel,i=Math.min(Math.max(t,n),r);this._nextAutoLevel!==i&&(this.nextAutoLevelKey="",this._nextAutoLevel=i)}}]),t}(),qr=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}(),Yr="NOT_LOADED",zr="APPENDING",Xr="PARTIAL",Jr="OK",Qr=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(b.BUFFER_APPENDED,this.onBufferAppended,this),t.on(b.FRAG_BUFFERED,this.onFragBuffered,this),t.on(b.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(b.BUFFER_APPENDED,this.onBufferAppended,this),t.off(b.FRAG_BUFFERED,this.onFragBuffered,this),t.off(b.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 n=r.length;n--;){var i=r[n];if(!i)break;var s=i.end;if(i.start<=t&&null!==s&&t<=s)return i}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var r=this.fragments,n=Object.keys(r),i=n.length;i--;){var s=r[n[i]];if((null==s?void 0:s.body.type)===e&&s.buffered){var a=s.body;if(a.start<=t&&t<=a.end)return a}}return null},e.detectEvictedFragments=function(t,e,r,n){var i=this;this.timeRanges&&(this.timeRanges[t]=e);var s=(null==n?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach((function(n){var a=i.fragments[n];if(a&&!(s>=a.body.sn))if(a.buffered||a.loaded){var o=a.range[t];o&&o.time.some((function(t){var r=!i.isTimeBuffered(t.startPTS,t.endPTS,e);return r&&i.removeFragment(a.body),r}))}else a.body.type===r&&i.removeFragment(a.body)}))},e.detectPartialFragments=function(t){var e=this,r=this.timeRanges,n=t.frag,i=t.part;if(r&&"initSegment"!==n.sn){var s=tn(n),a=this.fragments[s];if(!(!a||a.buffered&&n.gap)){var o=!n.relurl;Object.keys(r).forEach((function(t){var s=n.elementaryStreams[t];if(s){var l=r[t],u=o||!0===s.partial;a.range[t]=e.getBufferedTimes(n,i,u,l)}})),a.loaded=null,Object.keys(a.range).length?(a.buffered=!0,(a.body.endList=n.endList||a.body.endList)&&(this.endListFragments[a.body.type]=a),Zr(a)||this.removeParts(n.sn-1,n.type)):this.removeFragment(a.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=tn(t),n=this.fragments[r];!n&&e&&(n=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)},e.getBufferedTimes=function(t,e,r,n){for(var i={time:[],partial:r},s=t.start,a=t.end,o=t.minEndPTS||a,l=t.maxStartPTS||s,u=0;u<n.length;u++){var c=n.start(u)-this.bufferPadding,h=n.end(u)+this.bufferPadding;if(l>=c&&o<=h){i.time.push({startPTS:Math.max(s,n.start(u)),endPTS:Math.min(a,n.end(u))});break}if(s<h&&a>c){var d=Math.max(s,n.start(u)),f=Math.min(a,n.end(u));f>d&&(i.partial=!0,i.time.push({startPTS:d,endPTS:f}))}else if(a<=c)break}return i},e.getPartialFragment=function(t){var e,r,n,i=null,s=0,a=this.bufferPadding,o=this.fragments;return Object.keys(o).forEach((function(l){var u=o[l];u&&Zr(u)&&(r=u.body.start-a,n=u.body.end+a,t>=r&&t<=n&&(e=Math.min(t-r,n-t),s<=e&&(i=u.body,s=e)))})),i},e.isEndListAppended=function(t){var e=this.endListFragments[t];return void 0!==e&&(e.buffered||Zr(e))},e.getState=function(t){var e=tn(t),r=this.fragments[e];return r?r.buffered?Zr(r)?Xr:Jr:zr:Yr},e.isTimeBuffered=function(t,e,r){for(var n,i,s=0;s<r.length;s++){if(n=r.start(s)-this.bufferPadding,i=r.end(s)+this.bufferPadding,t>=n&&e<=i)return!0;if(e<=n)return!1}return!1},e.onFragLoaded=function(t,e){var r=e.frag,n=e.part;if("initSegment"!==r.sn&&!r.bitrateTest){var i=n?null:e,s=tn(r);this.fragments[s]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var r=this,n=e.frag,i=e.part,s=e.timeRanges;if("initSegment"!==n.sn){var a=n.type;if(i){var o=this.activePartLists[a];o||(this.activePartLists[a]=o=[]),o.push(i)}this.timeRanges=s,Object.keys(s).forEach((function(t){var e=s[t];r.detectEvictedFragments(t,e,a,i)}))}},e.onFragBuffered=function(t,e){this.detectPartialFragments(e)},e.hasFragment=function(t){var e=tn(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,n,i){var s=this;n&&!this.hasGaps||Object.keys(this.fragments).forEach((function(a){var o=s.fragments[a];if(o){var l=o.body;l.type!==r||n&&!l.gap||l.start<e&&l.end>t&&(o.buffered||i)&&s.removeFragment(l)}}))},e.removeFragment=function(t){var e=tn(t);t.stats.loaded=0,t.clearElementaryStreamInfo();var r=this.activePartLists[t.type];if(r){var n=t.sn;this.activePartLists[t.type]=r.filter((function(t){return t.fragment.sn!==n}))}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 Zr(t){var e,r,n;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==(n=t.range.audiovideo)?void 0:n.partial))}function tn(t){return t.type+"_"+t.level+"_"+t.sn}var en={length:0,start:function(){return 0},end:function(){return 0}},rn=function(){function t(){}return t.isBuffered=function(e,r){try{if(e)for(var n=t.getBuffered(e),i=0;i<n.length;i++)if(r>=n.start(i)&&r<=n.end(i))return!0}catch(t){}return!1},t.bufferInfo=function(e,r,n){try{if(e){var i,s=t.getBuffered(e),a=[];for(i=0;i<s.length;i++)a.push({start:s.start(i),end:s.end(i)});return this.bufferedInfo(a,r,n)}}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){return t.start-e.start||e.end-t.end}));var n=[];if(r)for(var i=0;i<t.length;i++){var s=n.length;if(s){var a=n[s-1].end;t[i].start-a<r?t[i].end>a&&(n[s-1].end=t[i].end):n.push(t[i])}else n.push(t[i])}else n=t;for(var o,l=0,u=e,c=e,h=0;h<n.length;h++){var d=n[h].start,f=n[h].end;if(e+r>=d&&e<f)u=d,l=(c=f)-e;else if(e+r<d){o=d;break}}return{len:l,start:u||0,end:c||0,nextStart:o}},t.getBuffered=function(t){try{return t.buffered}catch(t){return D.log("failed to get media.buffered",t),en}},t}(),nn=function(t,e,r,n,i,s){void 0===n&&(n=0),void 0===i&&(i=-1),void 0===s&&(s=!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=n,this.part=i,this.partial=s};function sn(t,e){for(var r=0,n=t.length;r<n;r++){var i;if((null==(i=t[r])?void 0:i.cc)===e)return t[r]}return null}function an(t,e){if(t){var r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function on(t,e){for(var r=e.fragments,n=0,i=r.length;n<i;n++)an(r[n],t);e.fragmentHint&&an(e.fragmentHint,t),e.alignedSliding=!0}function ln(t,e,r){e&&(function(t,e,r){if(function(t,e,r){return!(!e||!(r.endCC>r.startCC||t&&t.cc<r.startCC))}(t,r,e)){var n=function(t,e){var r=t.fragments,n=e.fragments;if(n.length&&r.length){var i=sn(r,n[0].cc);if(i&&(!i||i.startPTS))return i;D.log("No frag in previous level to align on")}else D.log("No fragments to align")}(r,e);n&&y(n.start)&&(D.log("Adjusting PTS using last level due to CC increase within current level "+e.url),on(n.start,e))}}(t,r,e),!r.alignedSliding&&e&&un(r,e),r.alignedSliding||!e||r.skippedSegments||dr(e,r))}function un(t,e){if(t.hasProgramDateTime&&e.hasProgramDateTime){var r=t.fragments,n=e.fragments;if(r.length&&n.length){var i,s,a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(i=sn(n,a),s=sn(r,a)),i&&s||(s=sn(r,(i=n[Math.floor(n.length/2)]).cc)||r[Math.floor(r.length/2)]);var o=i.programDateTime,l=s.programDateTime;o&&l&&on((l-o)/1e3-(s.start-i.start),t)}}}var cn=Math.pow(2,17),hn=function(){function t(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}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,i=t.url;if(!i)return Promise.reject(new pn({type:T.NETWORK_ERROR,details:_.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(i?"part list":"url")),networkDetails:null}));this.abort();var s=this.config,a=s.fLoader,o=s.loader;return new Promise((function(l,u){if(r.loader&&r.loader.destroy(),t.gap){if(t.tagList.some((function(t){return"GAP"===t[0]})))return void u(fn(t));t.gap=!1}var c=r.loader=t.loader=a?new a(s):new o(s),h=dn(t),d=Sr(s.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:cn};t.stats=c.stats,c.load(h,f,{onSuccess:function(e,n,i,s){r.resetLoader(t,c);var a=e.data;i.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(a.slice(0,16)),a=a.slice(16)),l({frag:t,part:null,payload:a,networkDetails:s})},onError:function(e,s,a,o){r.resetLoader(t,c),u(new pn({type:T.NETWORK_ERROR,details:_.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:n({url:i,data:void 0},e),error:new Error("HTTP Error "+e.code+" "+e.text),networkDetails:a,stats:o}))},onAbort:function(e,n,i){r.resetLoader(t,c),u(new pn({type:T.NETWORK_ERROR,details:_.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:i,stats:e}))},onTimeout:function(e,n,i){r.resetLoader(t,c),u(new pn({type:T.NETWORK_ERROR,details:_.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error("Timeout after "+f.timeout+"ms"),networkDetails:i,stats:e}))},onProgress:function(r,n,i,s){e&&e({frag:t,part:null,payload:i,networkDetails:s})}})}))},e.loadPart=function(t,e,r){var i=this;this.abort();var s=this.config,a=s.fLoader,o=s.loader;return new Promise((function(l,u){if(i.loader&&i.loader.destroy(),t.gap||e.gap)u(fn(t,e));else{var c=i.loader=t.loader=a?new a(s):new o(s),h=dn(t,e),d=Sr(s.fragLoadPolicy.default),f={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:cn};e.stats=c.stats,c.load(h,f,{onSuccess:function(n,s,a,o){i.resetLoader(t,c),i.updateStatsFromPart(t,e);var u={frag:t,part:e,payload:n.data,networkDetails:o};r(u),l(u)},onError:function(r,s,a,o){i.resetLoader(t,c),u(new pn({type:T.NETWORK_ERROR,details:_.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:n({url:h.url,data:void 0},r),error:new Error("HTTP Error "+r.code+" "+r.text),networkDetails:a,stats:o}))},onAbort:function(r,n,s){t.stats.aborted=e.stats.aborted,i.resetLoader(t,c),u(new pn({type:T.NETWORK_ERROR,details:_.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:s,stats:r}))},onTimeout:function(r,n,s){i.resetLoader(t,c),u(new pn({type:T.NETWORK_ERROR,details:_.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error("Timeout after "+f.timeout+"ms"),networkDetails:s,stats:r}))}})}}))},e.updateStatsFromPart=function(t,e){var r=t.stats,n=e.stats,i=n.total;if(r.loaded+=n.loaded,i){var s=Math.round(t.duration/e.duration),a=Math.min(Math.round(r.loaded/i),s),o=(s-a)*Math.round(r.loaded/a);r.total=r.loaded+o}else r.total=Math.max(r.loaded,r.total);var l=r.loading,u=n.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 dn(t,e){void 0===e&&(e=null);var r=e||t,n={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},i=r.byteRangeStartOffset,s=r.byteRangeEndOffset;if(y(i)&&y(s)){var a,o=i,l=s;if("initSegment"===t.sn&&"AES-128"===(null==(a=t.decryptdata)?void 0:a.method)){var u=s-i;u%16&&(l=s+(16-u%16)),0!==i&&(n.resetIV=!0,o=i-16)}n.rangeStart=o,n.rangeEnd=l}return n}function fn(t,e){var r=new Error("GAP "+(t.gap?"tag":"attribute")+" found"),n={type:T.MEDIA_ERROR,details:_.FRAG_GAP,fatal:!1,frag:t,error:r,networkDetails:null};return e&&(n.part=e),(e||t).stats.aborted=!0,new pn(n)}var pn=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}(d(Error)),gn=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}(),vn=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}();var mn=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),n=0;n<4;n++)r[n]=e.getUint32(4*n);return r},e.initTable=function(){var t=this.sBox,e=this.invSBox,r=this.subMix,n=r[0],i=r[1],s=r[2],a=r[3],o=this.invSubMix,l=o[0],u=o[1],c=o[2],h=o[3],d=new Uint32Array(256),f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){var v=p^p<<1^p<<2^p<<3^p<<4;v=v>>>8^255&v^99,t[f]=v,e[v]=f;var m=d[f],y=d[m],E=d[y],S=257*d[v]^16843008*v;n[f]=S<<24|S>>>8,i[f]=S<<16|S>>>16,s[f]=S<<8|S>>>24,a[f]=S,S=16843009*E^65537*y^257*m^16843008*f,l[v]=S<<24|S>>>8,u[v]=S<<16|S>>>16,c[v]=S<<8|S>>>24,h[v]=S,f?(f=m^d[d[d[E^m]]],p^=d[d[p]]):f=p=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),r=!0,n=0;n<e.length&&r;)r=e[n]===this.key[n],n++;if(!r){this.key=e;var i=this.keySize=e.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);var s,a,o,l,u=this.ksRows=4*(i+6+1),c=this.keySchedule=new Uint32Array(u),h=this.invKeySchedule=new Uint32Array(u),d=this.sBox,f=this.rcon,p=this.invSubMix,g=p[0],v=p[1],m=p[2],y=p[3];for(s=0;s<u;s++)s<i?o=c[s]=e[s]:(l=o,s%i==0?(l=d[(l=l<<8|l>>>24)>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l],l^=f[s/i|0]<<24):i>6&&s%i==4&&(l=d[l>>>24]<<24|d[l>>>16&255]<<16|d[l>>>8&255]<<8|d[255&l]),c[s]=o=(c[s-i]^l)>>>0);for(a=0;a<u;a++)s=u-a,l=3&a?c[s]:c[s-4],h[a]=a<4||s<=4?l:g[d[l>>>24]]^v[d[l>>>16&255]]^m[d[l>>>8&255]]^y[d[255&l]],h[a]=h[a]>>>0}},e.networkToHostOrderSwap=function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24},e.decrypt=function(t,e,r){for(var n,i,s,a,o,l,u,c,h,d,f,p,g,v,m=this.keySize+6,y=this.invKeySchedule,E=this.invSBox,S=this.invSubMix,b=S[0],T=S[1],_=S[2],A=S[3],L=this.uint8ArrayToUint32Array_(r),w=L[0],R=L[1],k=L[2],D=L[3],I=new Int32Array(t),P=new Int32Array(I.length),O=this.networkToHostOrderSwap;e<I.length;){for(h=O(I[e]),d=O(I[e+1]),f=O(I[e+2]),p=O(I[e+3]),o=h^y[0],l=p^y[1],u=f^y[2],c=d^y[3],g=4,v=1;v<m;v++)n=b[o>>>24]^T[l>>16&255]^_[u>>8&255]^A[255&c]^y[g],i=b[l>>>24]^T[u>>16&255]^_[c>>8&255]^A[255&o]^y[g+1],s=b[u>>>24]^T[c>>16&255]^_[o>>8&255]^A[255&l]^y[g+2],a=b[c>>>24]^T[o>>16&255]^_[l>>8&255]^A[255&u]^y[g+3],o=n,l=i,u=s,c=a,g+=4;n=E[o>>>24]<<24^E[l>>16&255]<<16^E[u>>8&255]<<8^E[255&c]^y[g],i=E[l>>>24]<<24^E[u>>16&255]<<16^E[c>>8&255]<<8^E[255&o]^y[g+1],s=E[u>>>24]<<24^E[c>>16&255]<<16^E[o>>8&255]<<8^E[255&l]^y[g+2],a=E[c>>>24]<<24^E[o>>16&255]<<16^E[l>>8&255]<<8^E[255&u]^y[g+3],P[e]=O(n^w),P[e+1]=O(a^R),P[e+2]=O(s^k),P[e+3]=O(i^D),w=h,R=d,k=f,D=p,e+=4}return P.buffer},t}(),yn=function(){function t(t,e){var r=(void 0===e?{}:e).removePKCS7Padding,n=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=n,n)try{var i=self.crypto;i&&(this.subtle=i.subtle||i.webkitSubtle)}catch(t){}this.useSoftware=!this.subtle}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,n,i,s=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?(n=(r=s).byteLength,(i=n&&new DataView(r.buffer).getUint8(n-1))?lt(r,0,n-i):r):s},e.reset=function(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)},e.decrypt=function(t,e,r){var n=this;return this.useSoftware?new Promise((function(i,s){n.softwareDecrypt(new Uint8Array(t),e,r);var a=n.flush();a?i(a.buffer):s(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(t),e,r)},e.softwareDecrypt=function(t,e,r){var n=this.currentIV,i=this.currentResult,s=this.remainderData;this.logOnce("JS AES decrypt"),s&&(t=$t(s,t),this.remainderData=null);var a=this.getValidChunk(t);if(!a.length)return null;n&&(r=n);var o=this.softwareDecrypter;o||(o=this.softwareDecrypter=new mn),o.expandKey(e);var l=i;return this.currentResult=o.decrypt(a.buffer,0,r),this.currentIV=lt(a,-16).buffer,l||null},e.webCryptoDecrypt=function(t,e,r){var n=this;if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,r));this.key=e,this.fastAesKey=new vn(this.subtle,e)}return this.fastAesKey.expandKey().then((function(e){return n.subtle?(n.logOnce("WebCrypto AES decrypt"),new gn(n.subtle,new Uint8Array(r)).decrypt(t.buffer,e)):Promise.reject(new Error("web crypto not initialized"))})).catch((function(i){return D.warn("[decrypter]: WebCrypto Error, disable WebCrypto API, "+i.name+": "+i.message),n.onWebCryptoError(t,e,r)}))},e.onWebCryptoError=function(t,e,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,r);var n=this.flush();if(n)return n.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=lt(t,0,r),this.remainderData=lt(t,r)),e},e.logOnce=function(t){this.logEnabled&&(D.log("[decrypter]: "+t),this.logEnabled=!1)},t}(),En=function(t){for(var e="",r=t.length,n=0;n<r;n++)e+="["+t.start(n).toFixed(3)+"-"+t.end(n).toFixed(3)+"]";return e},Sn="STOPPED",bn="IDLE",Tn="KEY_LOADING",_n="FRAG_LOADING",An="FRAG_LOADING_WAITING_RETRY",Ln="WAITING_TRACK",wn="PARSING",Rn="PARSED",kn="ENDED",Dn="ERROR",In="WAITING_INIT_PTS",Pn="WAITING_LEVEL",On=function(t){function e(e,r,n,i,s){var a;return(a=t.call(this)||this).hls=void 0,a.fragPrevious=null,a.fragCurrent=null,a.fragmentTracker=void 0,a.transmuxer=null,a._state=Sn,a.playlistType=void 0,a.media=null,a.mediaBuffer=null,a.config=void 0,a.bitrateTest=!1,a.lastCurrentTime=0,a.nextLoadPosition=0,a.startPosition=0,a.startTimeOffset=null,a.loadedmetadata=!1,a.retryDate=0,a.levels=null,a.fragmentLoader=void 0,a.keyLoader=void 0,a.levelLastLoaded=null,a.startFragRequested=!1,a.decrypter=void 0,a.initPTS=[],a.onvseeking=null,a.onvended=null,a.logPrefix="",a.log=void 0,a.warn=void 0,a.playlistType=s,a.logPrefix=i,a.log=D.log.bind(D,i+":"),a.warn=D.warn.bind(D,i+":"),a.hls=e,a.fragmentLoader=new hn(e.config),a.keyLoader=n,a.fragmentTracker=r,a.config=e.config,a.decrypter=new yn(e.config),e.on(b.MANIFEST_LOADED,a.onManifestLoaded,function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(a)),a}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=Sn},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 n=r[r.length-1];return rn.isBuffered(this.media,n.start+n.duration/2)}var i=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(i)},r.getLevelDetails=function(){var t;if(this.levels&&null!==this.levelLastLoaded)return null==(t=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 n=this.config;this.levels&&n.autoStartLoad&&this.state===Sn&&this.startLoad(n.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,n=this.mediaBuffer,i=this.state,s=r?r.currentTime:0,a=rn.bufferInfo(n||r,s,t.maxBufferHole);if(this.log("media seeking to "+(y(s)?s.toFixed(3):s)+", state: "+i),this.state===kn)this.resetLoadingState();else if(e){var o=t.maxFragLookUpTolerance,l=e.start-o,u=e.start+e.duration+o;if(!a.len||u<a.start||l>a.end){var c=s>u;(s<l||c)&&(c&&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(s,1/0,this.playlistType,!0),this.lastCurrentTime=s),this.loadedmetadata||a.len||(this.nextLoadPosition=this.startPosition=s),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.hls.off(b.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),t.prototype.onHandlerDestroying.call(this),this.hls=null},r.onHandlerDestroyed=function(){this.state=Sn,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 n=this;this._doFragLoad(t,e,r,(function(e){if(n.fragContextChanged(t))return n.warn("Fragment "+t.sn+(e.part?" p: "+e.part.index:"")+" of level "+t.level+" was dropped during download."),void n.fragmentTracker.removeFragment(t);t.stats.chunkCount++,n._handleFragmentLoadProgress(e)})).then((function(e){if(e){var r=n.state;n.fragContextChanged(t)?(r===_n||!n.fragCurrent&&r===wn)&&(n.fragmentTracker.removeFragment(t),n.state=bn):("payload"in e&&(n.log("Loaded fragment "+t.sn+" of level "+t.level),n.hls.trigger(b.FRAG_LOADED,e)),n._handleFragmentLoadComplete(e))}})).catch((function(e){n.state!==Sn&&n.state!==Dn&&(n.warn("Frag error: "+((null==e?void 0:e.message)||e)),n.resetFragmentLoading(t))}))},r.clearTrackerIfNeeded=function(t){var e,r=this.fragmentTracker;if(r.getState(t)===zr){var n=t.type,i=this.getFwdBufferInfo(this.mediaBuffer,n),s=Math.max(t.duration,i?i.len:this.config.maxBufferLength),a=this.backtrackFragment;(1==(a?t.sn-a.sn:0)||this.reduceMaxBufferLength(s,t.duration))&&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)===Xr&&r.removeFragment(t))},r.checkLiveUpdate=function(t){if(t.updated&&!t.live){var e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)},r.flushMainBuffer=function(t,e,r){if(void 0===r&&(r=null),t-e){var n={startOffset:t,endOffset:e,type:r};this.hls.trigger(b.BUFFER_FLUSHING,n)}},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 n=r.hls,i=e.payload,s=t.decryptdata;if(i&&i.byteLength>0&&null!=s&&s.key&&s.iv&&"AES-128"===s.method){var a=self.performance.now();return r.decrypter.decrypt(new Uint8Array(i),s.key.buffer,s.iv.buffer).catch((function(e){throw n.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((function(i){var s=self.performance.now();return n.trigger(b.FRAG_DECRYPTED,{frag:t,payload:i,stats:{tstart:a,tdecrypt:s}}),e.payload=i,r.completeInitSegmentLoad(e)}))}return r.completeInitSegmentLoad(e)})).catch((function(e){r.state!==Sn&&r.state!==Dn&&(r.warn(e),r.resetFragmentLoading(t))}))},r.completeInitSegmentLoad=function(t){if(!this.levels)throw new Error("init load aborted, missing levels");var e=t.frag.stats;this.state=bn,t.frag.data=new Uint8Array(t.payload),e.parsing.start=e.buffering.start=self.performance.now(),e.parsing.end=e.buffering.end=self.performance.now(),this.tick()},r.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.sn!==e.sn||t.level!==e.level},r.fragBufferedComplete=function(t,e){var r,n,i,s,a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+(this.playlistType===xe?"level":"track")+" "+t.level+" (frag:["+(null!=(r=t.startPTS)?r:NaN).toFixed(3)+"-"+(null!=(n=t.endPTS)?n:NaN).toFixed(3)+"] > buffer:"+(a?En(rn.getBuffered(a)):"(detached)")+")"),"initSegment"!==t.sn){var o;if(t.type!==Fe){var l=t.elementaryStreams;if(!Object.keys(l).some((function(t){return!!l[t]})))return void(this.state=bn)}var u=null==(o=this.levels)?void 0:o[t.level];null!=u&&u.fragmentError&&(this.log("Resetting level fragment error count of "+u.fragmentError+" on frag buffered"),u.fragmentError=0)}this.state=bn,a&&(!this.loadedmetadata&&t.type==xe&&a.buffered.length&&(null==(i=this.fragCurrent)?void 0:i.sn)===(null==(s=this.fragPrevious)?void 0:s.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,n=t.part,i=t.partsLoaded,s=!i||0===i.length||i.some((function(t){return!t})),a=new nn(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!s);e.flush(a)}},r._handleFragmentLoadProgress=function(t){},r._doFragLoad=function(t,e,r,n){var i,s=this;void 0===r&&(r=null);var a=null==e?void 0:e.details;if(!this.levels||!a)throw new Error("frag load aborted, missing level"+(a?"":" detail")+"s");var o=null;if(!t.encrypted||null!=(i=t.decryptdata)&&i.key?!t.encrypted&&a.encryptedFragments.length&&this.keyLoader.loadClear(t,a.encryptedFragments):(this.log("Loading key for "+t.sn+" of ["+a.startSN+"-"+a.endSN+"], "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level),this.state=Tn,this.fragCurrent=t,o=this.keyLoader.load(t).then((function(t){if(!s.fragContextChanged(t.frag))return s.hls.trigger(b.KEY_LOADED,t),s.state===Tn&&(s.state=bn),t})),this.hls.trigger(b.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=a.partList;if(l&&n){r>t.end&&a.fragmentHint&&(t=a.fragmentHint);var u=this.getNextPart(l,t,r);if(u>-1){var c,h=l[u];return this.log("Loading part sn: "+t.sn+" p: "+h.index+" cc: "+t.cc+" of playlist ["+a.startSN+"-"+a.endSN+"] parts [0-"+u+"-"+(l.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),this.nextLoadPosition=h.start+h.duration,this.state=_n,c=o?o.then((function(r){return!r||s.fragContextChanged(r.frag)?null:s.doFragPartsLoad(t,h,e,n)})).catch((function(t){return s.handleFragLoadError(t)})):this.doFragPartsLoad(t,h,e,n).catch((function(t){return s.handleFragLoadError(t)})),this.hls.trigger(b.FRAG_LOADING,{frag:t,part:h,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):c}if(!t.url||this.loadedEndOfParts(l,r))return Promise.resolve(null)}}this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(a?"of ["+a.startSN+"-"+a.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(r.toFixed(3))),y(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=_n;var d,f=this.config.progressive;return d=f&&o?o.then((function(e){return!e||s.fragContextChanged(null==e?void 0:e.frag)?null:s.fragmentLoader.load(t,n)})).catch((function(t){return s.handleFragLoadError(t)})):Promise.all([this.fragmentLoader.load(t,f?n:void 0),o]).then((function(t){var e=t[0];return!f&&e&&n&&n(e),e})).catch((function(t){return s.handleFragLoadError(t)})),this.hls.trigger(b.FRAG_LOADING,{frag:t,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):d},r.doFragPartsLoad=function(t,e,r,n){var i=this;return new Promise((function(s,a){var o,l=[],u=null==(o=r.details)?void 0:o.partList;!function e(o){i.fragmentLoader.loadPart(t,o,n).then((function(n){l[o.index]=n;var a=n.part;i.hls.trigger(b.FRAG_LOADED,n);var c=pr(r,t.sn,o.index+1)||gr(u,t.sn,o.index+1);if(!c)return s({frag:t,part:a,partsLoaded:l});e(c)})).catch(a)}(e)}))},r.handleFragLoadError=function(t){if("data"in t){var e=t.data;t.data&&e.details===_.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(b.ERROR,e)}else this.hls.trigger(b.ERROR,{type:T.OTHER_ERROR,details:_.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null},r._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===wn){var r=e.frag,n=e.part,i=e.level,s=self.performance.now();r.stats.parsing.end=s,n&&(n.stats.parsing.end=s),this.updateLevelTiming(r,n,i,t.partial)}else this.fragCurrent||this.state===Sn||this.state===Dn||(this.state=bn)},r.getCurrentContext=function(t){var e=this.levels,r=this.fragCurrent,n=t.level,i=t.sn,s=t.part;if(null==e||!e[n])return this.warn("Levels object was unset while buffering fragment "+i+" of level "+n+". The current chunk will not be buffered."),null;var a=e[n],o=s>-1?pr(a,i,s):null,l=o?o.fragment:function(t,e,r){if(null==t||!t.details)return null;var n=t.details,i=n.fragments[e-n.startSN];return i||((i=n.fragmentHint)&&i.sn===e?i:e<n.startSN&&r&&r.sn===e?r:null)}(a,i,r);return l?(r&&r!==l&&(l.stats=r.stats),{frag:l,part:o,level:a}):null},r.bufferFragmentData=function(t,e,r,n,i){var s;if(t&&this.state===wn){var a=t.data1,o=t.data2,l=a;if(a&&o&&(l=$t(a,o)),null!=(s=l)&&s.length){var u={type:t.type,frag:e,part:r,chunkMeta:n,parent:e.type,data:l};if(this.hls.trigger(b.BUFFER_APPENDING,u),t.dropped&&t.independent&&!r){if(i)return;this.flushBufferGap(e)}}}},r.flushBufferGap=function(t){var e=this.media;if(e)if(rn.isBuffered(e,e.currentTime)){var r=e.currentTime,n=rn.bufferInfo(e,r,0),i=t.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),a=Math.max(Math.min(t.start-s,n.end-s),r+s);t.start-a>s&&this.flushMainBuffer(a,t.start)}else this.flushMainBuffer(0,t.start)},r.getFwdBufferInfo=function(t,e){var r=this.getLoadPosition();return y(r)?this.getFwdBufferInfoAtPos(t,r,e):null},r.getFwdBufferInfoAtPos=function(t,e,r){var n=this.config.maxBufferHole,i=rn.bufferInfo(t,e,n);if(0===i.len&&void 0!==i.nextStart){var s=this.fragmentTracker.getBufferedFrag(e,r);if(s&&i.nextStart<s.end)return rn.bufferInfo(t,e,Math.max(i.nextStart,n))}return i},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,e){var r=this.config,n=Math.max(Math.min(t-e,r.maxBufferLength),e),i=Math.max(t-3*e,r.maxMaxBufferLength/2,n);return i>=n&&(r.maxMaxBufferLength=i,this.warn("Reduce max buffer length to "+i+"s"),!0)},r.getAppendedFrag=function(t,e){var r=this.fragmentTracker.getAppendedFrag(t,xe);return r&&"fragment"in r?r.fragment:r},r.getNextFragment=function(t,e){var r=e.fragments,n=r.length;if(!n)return null;var i,s=this.config,a=r[0].start;if(e.live){var o=s.initialLiveManifestSize;if(n<o)return this.warn("Not enough fragments to start playback (have: "+n+", need: "+o+")"),null;(!e.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||t<a)&&(i=this.getInitialLiveFragment(e,r),this.startPosition=this.nextLoadPosition=i?this.hls.liveSyncPosition||i.start:t)}else t<=a&&(i=r[0]);if(!i){var l=s.lowLatencyMode?e.partEnd:e.fragmentEnd;i=this.getFragmentAtPosition(t,l,e)}return this.mapToInitFragWhenRequired(i)},r.isLoopLoading=function(t,e){var r=this.fragmentTracker.getState(t);return(r===Jr||r===Xr&&!!t.gap)&&this.nextLoadPosition>e},r.getNextFragmentLoopLoading=function(t,e,r,n,i){var s=t.gap,a=this.getNextFragment(this.nextLoadPosition,e);if(null===a)return a;if(t=a,s&&t&&!t.gap&&r.nextStart){var o=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,n);if(null!==o&&r.len+o.len>=i)return this.log('buffer full after gaps in "'+n+'" 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 n=-1,i=!1,s=!0,a=0,o=t.length;a<o;a++){var l=t[a];if(s=s&&!l.independent,n>-1&&r<l.start)break;var u=l.loaded;u?n=-1:(i||l.independent||s)&&l.fragment===e&&(n=a),i=u}return n},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,n=null;if(r){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+r.programDateTime),n=function(t,e,r){if(null===e||!Array.isArray(t)||!t.length||!y(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 n=0;n<t.length;++n){var i=t[n];if(Lr(e,r,i))return i}return null}(e,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){var i=r.sn+1;if(i>=t.startSN&&i<=t.endSN){var s=e[i-t.startSN];r.cc===s.cc&&(n=s,this.log("Live playlist, switching playlist, load frag with next SN: "+n.sn))}n||(n=function(t,e){return Tr(t,(function(t){return t.cc<e?1:t.cc>e?-1:0}))}(e,r.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+n.sn)}}else{var a=this.hls.liveSyncPosition;null!==a&&(n=this.getFragmentAtPosition(a,this.bitrateTest?t.fragmentEnd:t.edge,t))}return n},r.getFragmentAtPosition=function(t,e,r){var n,i=this.config,s=this.fragPrevious,a=r.fragments,o=r.endSN,l=r.fragmentHint,u=i.maxFragLookUpTolerance,c=r.partList,h=!!(i.lowLatencyMode&&null!=c&&c.length&&l);if(h&&l&&!this.bitrateTest&&(a=a.concat(l),o=l.sn),n=t<e?_r(s,a,t,t>e-u?0:u):a[a.length-1]){var d=n.sn-r.startSN,f=this.fragmentTracker.getState(n);if((f===Jr||f===Xr&&n.gap)&&(s=n),s&&n.sn===s.sn&&(!h||c[0].fragment.sn>n.sn)&&s&&n.level===s.level){var p=a[d+1];n=n.sn<o&&this.fragmentTracker.getState(p)!==Jr?p:null}}return n},r.synchronizeToLiveEdge=function(t){var e=this.config,r=this.media;if(r){var n=this.hls.liveSyncPosition,i=r.currentTime,s=t.fragments[0].start,a=t.edge,o=i>=s-e.maxFragLookUpTolerance&&i<=a;if(null!==n&&r.duration>n&&(i<n||!o)){var l=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!o&&r.readyState<4||i<a-l)&&(this.loadedmetadata||(this.nextLoadPosition=n),r.readyState&&(this.warn("Playback: "+i.toFixed(3)+" is located too far from the end of live sliding playlist: "+a+", reset currentTime to : "+n.toFixed(3)),r.currentTime=n))}}},r.alignPlaylists=function(t,e,r){var n=t.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;var i=t.fragments[0].start,s=!e,a=t.alignedSliding&&y(i);if(s||!a&&!i){var o=this.fragPrevious;ln(o,r,t);var l=t.fragments[0].start;return this.log("Live playlist sliding: "+l.toFixed(2)+" start-sn: "+(e?e.startSN:"na")+"->"+t.startSN+" prev-sn: "+(o?o.sn:"na")+" fragments: "+n),l}return i},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 n=null!==this.startTimeOffset,i=n?this.startTimeOffset:t.startTimeOffset;null!==i&&y(i)?(r=e+i,i<0&&(r+=t.totalduration),r=Math.min(Math.max(e,r),e+t.totalduration),this.log("Start time offset "+i+" found in "+(n?"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===An)||(this.state=bn)},r.onFragmentOrKeyLoadError=function(t,e){if(e.chunkMeta&&!e.frag){var r=this.getCurrentContext(e.chunkMeta);r&&(e.frag=r.frag)}var n=e.frag;if(n&&n.type===t&&this.levels)if(this.fragContextChanged(n)){var i;this.warn("Frag load error must match current frag to retry "+n.url+" > "+(null==(i=this.fragCurrent)?void 0:i.url))}else{var s=e.details===_.FRAG_GAP;s&&this.fragmentTracker.fragBuffered(n,!0);var a=e.errorAction,o=a||{},l=o.action,u=o.retryCount,c=void 0===u?0:u,h=o.retryConfig;if(a&&l===Dr&&h){this.resetStartWhenNotLoaded(this.levelLastLoaded);var d=Er(h,c);this.warn("Fragment "+n.sn+" of "+t+" "+n.level+" errored with "+e.details+", retrying loading "+(c+1)+"/"+h.maxNumRetry+" in "+d+"ms"),a.resolved=!0,this.retryDate=self.performance.now()+d,this.state=An}else if(h&&a){if(this.resetFragmentErrors(t),!(c<h.maxNumRetry))return void D.warn(e.details+" reached or exceeded max retry ("+c+")");s||l===kr||(a.resolved=!0)}else(null==a?void 0:a.action)===Rr?this.state=Pn:this.state=Dn;this.tickImmediate()}},r.reduceLengthAndFlushBuffer=function(t){if(this.state===wn||this.state===Rn){var e=t.frag,r=t.parent,n=this.getFwdBufferInfo(this.mediaBuffer,r),i=n&&n.len>.5;i&&this.reduceMaxBufferLength(n.len,(null==e?void 0:e.duration)||10);var s=!i;return s&&this.warn("Buffer full error while media.currentTime is not buffered, flush "+r+" buffer"),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),s}return!1},r.resetFragmentErrors=function(t){t===Me&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Sn&&(this.state=bn)},r.afterBufferFlushed=function(t,e,r){if(t){var n=rn.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,n,r),this.state===kn&&this.resetLoadingState()}},r.resetLoadingState=function(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=bn},r.resetStartWhenNotLoaded=function(t){if(!this.loadedmetadata){this.startFragRequested=!1;var e=t?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(this.levelLastLoaded),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,n){var i,s=this,a=r.details;if(a){if(!Object.keys(t.elementaryStreams).reduce((function(e,i){var o=t.elementaryStreams[i];if(o){var l=o.endPTS-o.startPTS;if(l<=0)return s.warn("Could not parse fragment "+t.sn+" "+i+" duration reliably ("+l+")"),e||!1;var u=n?0:cr(a,t,o.startPTS,o.endPTS,o.startDTS,o.endDTS);return s.hls.trigger(b.LEVEL_PTS_UPDATED,{details:a,level:r,drift:u,type:i,frag:t,start:o.startPTS,end:o.endPTS}),!0}return e}),!1)&&null===(null==(i=this.transmuxer)?void 0:i.error)){var o=new Error("Found no media in fragment "+t.sn+" of level "+t.level+" resetting transmuxer to fallback to playlist timing");if(0===r.fragmentError&&(r.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)),this.warn(o.message),this.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.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=Rn,this.hls.trigger(b.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.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),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}(qr),Cn=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),n=0,i=0;i<t.length;i++){var s=t[i];r.set(s,n),n+=s.length}return r}(e,r),this.reset(),t):new Uint8Array(0)},e.reset=function(){this.chunks.length=0,this.dataLength=0},t}();function xn(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 Mn=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,n){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=$t(this.cachedData,t),this.cachedData=null);var r,n=dt(t,0),i=n?n.length:0,s=this._audioTrack,a=this._id3Track,o=n?gt(n):void 0,l=t.length;for((null===this.basePTS||0===this.frameIndex&&y(o))&&(this.basePTS=Fn(o,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:$e,duration:Number.POSITIVE_INFINITY});i<l;){if(this.canParse(t,i)){var u=this.appendFrame(s,t,i);u?(this.frameIndex++,this.lastPTS=u.sample.pts,r=i+=u.length):i=l}else pt(t,i)?(n=dt(t,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:$e,duration:Number.POSITIVE_INFINITY}),r=i+=n.length):i++;if(i===l&&r!==l){var c=lt(t,r);this.cachedData?this.cachedData=$t(this.cachedData,c):this.cachedData=c}}return{audioTrack:s,videoTrack:xn(),id3Track:a,textTrack:xn()}},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:xn(),id3Track:this._id3Track,textTrack:xn()}},e.destroy=function(){},t}(),Fn=function(t,e,r){return y(t)?90*t:9e4*e+(r?9e4*r.baseTime/r.timescale:0)};function Nn(t,e){return 255===t[e]&&240==(246&t[e+1])}function Bn(t,e){return 1&t[e+1]?7:9}function Un(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function jn(t,e){return e+1<t.length&&Nn(t,e)}function Hn(t,e){if(jn(t,e)){var r=Bn(t,e);if(e+r>=t.length)return!1;var n=Un(t,e);if(n<=r)return!1;var i=e+n;return i===t.length||jn(t,i)}return!1}function Gn(t,e,r,n,i){if(!t.samplerate){var s=function(t,e,r,n){var i,s,a,o,l=navigator.userAgent.toLowerCase(),u=n,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=1+((192&e[r+2])>>>6);var h=(60&e[r+2])>>>2;if(!(h>c.length-1))return a=(1&e[r+2])<<2,a|=(192&e[r+3])>>>6,D.log("manifest codec:"+n+", ADTS type:"+i+", samplingIndex:"+h),/firefox/i.test(l)?h>=6?(i=5,o=new Array(4),s=h-3):(i=2,o=new Array(2),s=h):-1!==l.indexOf("android")?(i=2,o=new Array(2),s=h):(i=5,o=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&h>=6?s=h-3:((n&&-1!==n.indexOf("mp4a.40.2")&&(h>=6&&1===a||/vivaldi/i.test(l))||!n&&1===a)&&(i=2,o=new Array(2)),s=h)),o[0]=i<<3,o[0]|=(14&h)>>1,o[1]|=(1&h)<<7,o[1]|=a<<3,5===i&&(o[1]|=(14&s)>>1,o[2]=(1&s)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:c[h],channelCount:a,codec:"mp4a.40."+i,manifestCodec:u};var d=new Error("invalid ADTS sampling index:"+h);t.emit(b.ERROR,b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:!0,error:d,reason:d.message})}(e,r,n,i);if(!s)return;t.config=s.config,t.samplerate=s.samplerate,t.channelCount=s.channelCount,t.codec=s.codec,t.manifestCodec=s.manifestCodec,D.log("parsed codec:"+t.codec+", rate:"+s.samplerate+", channels:"+s.channelCount)}}function Vn(t){return 9216e4/t}function Kn(t,e,r,n,i){var s,a=n+i*Vn(t.samplerate),o=function(t,e){var r=Bn(t,e);if(e+r<=t.length){var n=Un(t,e)-r;if(n>0)return{headerLength:r,frameLength:n}}}(e,r);if(o){var l=o.frameLength,u=o.headerLength,c=u+l,h=Math.max(0,r+c-e.length);h?(s=new Uint8Array(c-u)).set(e.subarray(r+u,e.length),0):s=e.subarray(r+u,r+c);var d={unit:s,pts:a};return h||t.samples.push(d),{sample:d,length:c,missing:h}}var f=e.length-r;return(s=new Uint8Array(f)).set(e.subarray(r,e.length),0),{sample:{unit:s,pts:a},length:f,missing:-1}}var $n=null,Wn=[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],qn=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],Yn=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],zn=[0,1,1,4];function Xn(t,e,r,n,i){if(!(r+24>e.length)){var s=Jn(e,r);if(s&&r+s.frameLength<=e.length){var a=n+i*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:e.subarray(r,r+s.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=s.channelCount,t.samplerate=s.sampleRate,t.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}}function Jn(t,e){var r=t[e+1]>>3&3,n=t[e+1]>>1&3,i=t[e+2]>>4&15,s=t[e+2]>>2&3;if(1!==r&&0!==i&&15!==i&&3!==s){var a=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*Wn[14*(3===r?3-n:3===n?3:4)+i-1],u=qn[3*(3===r?0:2===r?1:2)+s],c=3===o?1:2,h=Yn[r][n],d=zn[n],f=8*h*d,p=Math.floor(h*l/u+a)*d;if(null===$n){var g=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);$n=g?parseInt(g[1]):0}return!!$n&&$n<=87&&2===n&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:u,channelCount:c,frameLength:p,samplesPerFrame:f}}}function Qn(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function Zn(t,e){return e+1<t.length&&Qn(t,e)}function ti(t,e){if(e+1<t.length&&Qn(t,e)){var r=Jn(t,e),n=4;null!=r&&r.frameLength&&(n=r.frameLength);var i=e+n;return i===t.length||Zn(t,i)}return!1}var ei=function(t){function e(e,r){var n;return(n=t.call(this)||this).observer=void 0,n.config=void 0,n.observer=e,n.config=r,n}l(e,t);var r=e.prototype;return r.resetInitSegment=function(e,r,n,i){t.prototype.resetInitSegment.call(this,e,r,n,i),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:r,duration:i,inputTimeScale:9e4,dropped:0}},e.probe=function(t){if(!t)return!1;var e=dt(t,0),r=(null==e?void 0:e.length)||0;if(ti(t,r))return!1;for(var n=t.length;r<n;r++)if(Hn(t,r))return D.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)&&Nn(t,e)&&Un(t,e)<=t.length-e}(t,e)},r.appendFrame=function(t,e,r){Gn(t,this.observer,e,r,t.manifestCodec);var n=Kn(t,e,r,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n},e}(Mn),ri=/\/emsg[-/]ID3/i,ni=function(){function t(t,e){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=e}var e=t.prototype;return e.resetTimeStamp=function(){},e.resetInitSegment=function(t,e,r,n){var i=this.videoTrack=xn("video",1),s=this.audioTrack=xn("audio",1),a=this.txtTrack=xn("text",1);if(this.id3Track=xn("id3",1),this.timeOffset=0,null!=t&&t.byteLength){var o=Bt(t);if(o.video){var l=o.video,u=l.id,c=l.timescale,h=l.codec;i.id=u,i.timescale=a.timescale=c,i.codec=h}if(o.audio){var d=o.audio,f=d.id,p=d.timescale,g=d.codec;s.id=f,s.timescale=p,s.codec=g}a.id=Dt.text,i.sampleDuration=0,i.duration=s.duration=n}},e.resetContiguity=function(){this.remainderData=null},t.probe=function(t){return function(t){for(var e=t.byteLength,r=0;r<e;){var n=Ot(t,r);if(n>8&&109===t[r+4]&&111===t[r+5]&&111===t[r+6]&&102===t[r+7])return!0;r=n>1?r+n:e}return!1}(t)},e.demux=function(t,e){this.timeOffset=e;var r=t,n=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=$t(this.remainderData,t));var s=function(t){var e={valid:null,remainder:null},r=Ft(t,["moof"]);if(r.length<2)return e.remainder=t,e;var n=r[r.length-1];return e.valid=lt(t,0,n.byteOffset-8),e.remainder=lt(t,n.byteOffset-8),e}(r);this.remainderData=s.remainder,n.samples=s.valid||new Uint8Array}else n.samples=r;var a=this.extractID3Track(n,e);return i.samples=Wt(e,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:a,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 n=this.extractID3Track(e,this.timeOffset);return r.samples=Wt(t,e),{videoTrack:e,audioTrack:xn(),id3Track:n,textTrack:xn()}},e.extractID3Track=function(t,e){var r=this.id3Track;if(t.samples.length){var n=Ft(t.samples,["emsg"]);n&&n.forEach((function(t){var n=function(t){var e=t[0],r="",n="",i=0,s=0,a=0,o=0,l=0,u=0;if(0===e){for(;"\0"!==It(t.subarray(u,u+1));)r+=It(t.subarray(u,u+1)),u+=1;for(r+=It(t.subarray(u,u+1)),u+=1;"\0"!==It(t.subarray(u,u+1));)n+=It(t.subarray(u,u+1)),u+=1;n+=It(t.subarray(u,u+1)),u+=1,i=Ot(t,12),s=Ot(t,16),o=Ot(t,20),l=Ot(t,24),u=28}else if(1===e){i=Ot(t,u+=4);var c=Ot(t,u+=4),h=Ot(t,u+=4);for(u+=4,a=Math.pow(2,32)*c+h,E(a)||(a=Number.MAX_SAFE_INTEGER,D.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Ot(t,u),l=Ot(t,u+=4),u+=4;"\0"!==It(t.subarray(u,u+1));)r+=It(t.subarray(u,u+1)),u+=1;for(r+=It(t.subarray(u,u+1)),u+=1;"\0"!==It(t.subarray(u,u+1));)n+=It(t.subarray(u,u+1)),u+=1;n+=It(t.subarray(u,u+1)),u+=1}return{schemeIdUri:r,value:n,timeScale:i,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:l,payload:t.subarray(u,t.byteLength)}}(t);if(ri.test(n.schemeIdUri)){var i=y(n.presentationTime)?n.presentationTime/n.timeScale:e+n.presentationTimeDelta/n.timeScale,s=4294967295===n.eventDuration?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;s<=.001&&(s=Number.POSITIVE_INFINITY);var a=n.payload;r.samples.push({data:a,len:a.byteLength,dts:i,pts:i,type:qe,duration:s})}}))}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}(),ii=function(t,e){var r=0,n=5;e+=n;for(var i=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);n>0;){a[0]=t[e];var o=Math.min(n,8),l=8-o;s[0]=4278190080>>>24+l<<l,i[0]=(a[0]&s[0])>>l,r=r?r<<o|i[0]:i[0],e+=1,n-=o}return r},si=function(t){function e(e){var r;return(r=t.call(this)||this).observer=void 0,r.observer=e,r}l(e,t);var r=e.prototype;return r.resetInitSegment=function(e,r,n,i){t.prototype.resetInitSegment.call(this,e,r,n,i),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:r,duration:i,inputTimeScale:9e4,dropped:0}},r.canParse=function(t,e){return e+64<t.length},r.appendFrame=function(t,e,r){var n=ai(t,e,r,this.basePTS,this.frameIndex);if(-1!==n)return{sample:t.samples[t.samples.length-1],length:n,missing:0}},e.probe=function(t){if(!t)return!1;var e=dt(t,0);if(!e)return!1;var r=e.length;return 11===t[r]&&119===t[r+1]&&void 0!==gt(e)&&ii(t,r)<16},e}(Mn);function ai(t,e,r,n,i){if(r+8>e.length)return-1;if(11!==e[r]||119!==e[r+1])return-1;var s=e[r+4]>>6;if(s>=3)return-1;var a=[48e3,44100,32e3][s],o=63&e[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+s];if(r+l>e.length)return-1;var u=e[r+6]>>5,c=0;2===u?c+=2:(1&u&&1!==u&&(c+=2),4&u&&(c+=2));var h=(e[r+6]<<8|e[r+7])>>12-c&1,d=[2,1,2,3,3,4,4,5][u]+h,f=e[r+5]>>3,p=7&e[r+5],g=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|u<<3|h<<2|o>>4,o<<4&224]),v=n+i*(1536/a*9e4),m=e.subarray(r,r+l);return t.config=g,t.channelCount=d,t.samplerate=a,t.samples.push({unit:m,pts:v}),l}var oi=function(){function t(){this.VideoSample=null}var e=t.prototype;return e.createVideoSample=function(t,e,r,n){return{key:t,frame:!1,pts:e,dts:r,units:[],debug:n,length:0}},e.getLastNalUnit=function(t){var e,r,n=this.VideoSample;if(n&&0!==n.units.length||(n=t[t.length-1]),null!=(e=n)&&e.units){var i=n.units;r=i[i.length-1]}return r},e.pushAccessUnit=function(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var r=e.samples,n=r.length;if(!n)return void e.dropped++;var i=r[n-1];t.pts=i.pts,t.dts=i.dts}e.samples.push(t)}t.debug.length&&D.log(t.pts+"/"+t.dts+":"+t.debug)},t}(),li=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,n=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");n.set(t.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i},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&&D.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,n=0;n<t;n++)0!==r&&(r=(e+this.readEG()+256)%256),e=0===r?e:r},e.readSPS=function(){var t,e,r,n=0,i=0,s=0,a=0,o=this.readUByte.bind(this),l=this.readBits.bind(this),u=this.readUEG.bind(this),c=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();var g=o();if(l(5),h(3),o(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){var v=u();if(3===v&&h(1),f(),f(),h(1),c())for(e=3!==v?8:12,r=0;r<e;r++)c()&&p(r<6?16:64)}f();var m=u();if(0===m)u();else if(1===m)for(h(1),d(),d(),t=u(),r=0;r<t;r++)d();f(),h(1);var y=u(),E=u(),S=l(1);0===S&&h(1),h(1),c()&&(n=u(),i=u(),s=u(),a=u());var b=[1,1];if(c()&&c())switch(o()){case 1:b=[1,1];break;case 2:b=[12,11];break;case 3:b=[10,11];break;case 4:b=[16,11];break;case 5:b=[40,33];break;case 6:b=[24,11];break;case 7:b=[20,11];break;case 8:b=[32,11];break;case 9:b=[80,33];break;case 10:b=[18,11];break;case 11:b=[15,11];break;case 12:b=[64,33];break;case 13:b=[160,99];break;case 14:b=[4,3];break;case 15:b=[3,2];break;case 16:b=[2,1];break;case 255:b=[o()<<8|o(),o()<<8|o()]}return{width:Math.ceil(16*(y+1)-2*n-2*i),height:(2-S)*(E+1)*16-(S?2:4)*(s+a),pixelRatio:b}},e.readSliceType=function(){return this.readUByte(),this.readUEG(),this.readUEG()},t}(),ui=function(t){function e(){return t.apply(this,arguments)||this}l(e,t);var r=e.prototype;return r.parseAVCPES=function(t,e,r,n,i){var s,a=this,o=this.parseAVCNALu(t,r.data),l=this.VideoSample,u=!1;r.data=null,l&&o.length&&!t.audFound&&(this.pushAccessUnit(l,t),l=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),o.forEach((function(n){var o;switch(n.type){case 1:var c=!1;s=!0;var h,d=n.data;if(u&&d.length>4){var f=new li(d).readSliceType();2!==f&&4!==f&&7!==f&&9!==f||(c=!0)}c&&null!=(h=l)&&h.frame&&!l.key&&(a.pushAccessUnit(l,t),l=a.VideoSample=null),l||(l=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts,"")),l.frame=!0,l.key=c;break;case 5:s=!0,null!=(o=l)&&o.frame&&!l.key&&(a.pushAccessUnit(l,t),l=a.VideoSample=null),l||(l=a.VideoSample=a.createVideoSample(!0,r.pts,r.dts,"")),l.key=!0,l.frame=!0;break;case 6:s=!0,Yt(n.data,1,r.pts,e.samples);break;case 7:var p,g;s=!0,u=!0;var v=n.data,m=new li(v).readSPS();if(!t.sps||t.width!==m.width||t.height!==m.height||(null==(p=t.pixelRatio)?void 0:p[0])!==m.pixelRatio[0]||(null==(g=t.pixelRatio)?void 0:g[1])!==m.pixelRatio[1]){t.width=m.width,t.height=m.height,t.pixelRatio=m.pixelRatio,t.sps=[v],t.duration=i;for(var y=v.subarray(1,4),E="avc1.",S=0;S<3;S++){var b=y[S].toString(16);b.length<2&&(b="0"+b),E+=b}t.codec=E}break;case 8:s=!0,t.pps=[n.data];break;case 9:s=!0,t.audFound=!0,l&&a.pushAccessUnit(l,t),l=a.VideoSample=a.createVideoSample(!1,r.pts,r.dts,"");break;case 12:s=!0;break;default:s=!1,l&&(l.debug+="unknown NAL "+n.type+" ")}l&&s&&l.units.push(n)})),n&&l&&(this.pushAccessUnit(l,t),this.VideoSample=null)},r.parseAVCNALu=function(t,e){var r,n,i=e.byteLength,s=t.naluState||0,a=s,o=[],l=0,u=-1,c=0;for(-1===s&&(u=0,c=31&e[0],s=0,l=1);l<i;)if(r=e[l++],s)if(1!==s)if(r)if(1===r){if(n=l-s-1,u>=0){var h={data:e.subarray(u,n),type:c};o.push(h)}else{var d=this.getLastNalUnit(t.samples);d&&(a&&l<=4-a&&d.state&&(d.data=d.data.subarray(0,d.data.byteLength-a)),n>0&&(d.data=$t(d.data,e.subarray(0,n)),d.state=0))}l<i?(u=l,c=31&e[l],s=0):s=-1}else s=0;else s=3;else s=r?0:2;else s=r?0:1;if(u>=0&&s>=0){var f={data:e.subarray(u,i),type:c,state:s};o.push(f)}if(0===o.length){var p=this.getLastNalUnit(t.samples);p&&(p.data=$t(p.data,e))}return t.naluState=s,o},e}(oi),ci=function(){function t(t,e,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new yn(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 n=this,i=t[e].unit;if(!(i.length<=16)){var s=i.subarray(16,i.length-i.length%16),a=s.buffer.slice(s.byteOffset,s.byteOffset+s.length);this.decryptBuffer(a).then((function(s){var a=new Uint8Array(s);i.set(a,16),n.decrypter.isSync()||n.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),n=0,i=32;i<t.length-16;i+=160,n+=16)r.set(t.subarray(i,i+16),n);return r},e.getAvcDecryptedUnit=function(t,e){for(var r=new Uint8Array(e),n=0,i=32;i<t.length-16;i+=160,n+=16)t.set(r.subarray(n,n+16),i);return t},e.decryptAvcSample=function(t,e,r,n,i){var s=this,a=zt(i.data),o=this.getAvcEncryptedData(a);this.decryptBuffer(o.buffer).then((function(o){i.data=s.getAvcDecryptedUnit(a,o),s.decrypter.isSync()||s.decryptAvcSamples(t,e,r+1,n)}))},e.decryptAvcSamples=function(t,e,r,n){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length)return void n();for(var i=t[e].units;!(r>=i.length);r++){var s=i[r];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(t,e,r,n,s),this.decrypter.isSync())))return}}},t}(),hi=188,di=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._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.videoParser=new ui}t.probe=function(e){var r=t.syncOffset(e);return r>0&&D.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,e-hi)+1,n=0;n<r;){for(var i=!1,s=-1,a=0,o=n;o<e;o+=hi){if(71!==t[o]||e-o!==hi&&71!==t[o+hi]){if(a)return-1;break}if(a++,-1===s&&0!==(s=o)&&(r=Math.min(s+18612,t.length-hi)+1),i||(i=0===fi(t,o)),i&&a>1&&(0===s&&a>2||o+hi>r))return s}n++}return-1},t.createTrack=function(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:Dt[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,n,i){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=t.createTrack("video"),this._audioTrack=t.createTrack("audio",i),this._id3Track=t.createTrack("id3"),this._txtTrack=t.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=r,this.videoCodec=n,this._duration=i},e.resetTimeStamp=function(){},e.resetContiguity=function(){var t=this._audioTrack,e=this._videoTrack,r=this._id3Track;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null},e.demux=function(e,r,n,i){var s;void 0===n&&(n=!1),void 0===i&&(i=!1),n||(this.sampleAes=null);var a=this._videoTrack,o=this._audioTrack,l=this._id3Track,u=this._txtTrack,c=a.pid,h=a.pesData,d=o.pid,f=l.pid,p=o.pesData,g=l.pesData,v=null,m=this.pmtParsed,y=this._pmtId,E=e.length;if(this.remainderData&&(E=(e=$t(this.remainderData,e)).length,this.remainderData=null),E<hi&&!i)return this.remainderData=e,{audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};var S=Math.max(0,t.syncOffset(e));(E-=(E-S)%hi)<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,E,e.buffer.byteLength-E));for(var b=0,T=S;T<E;T+=hi)if(71===e[T]){var _=!!(64&e[T+1]),A=fi(e,T),L=void 0;if((48&e[T+3])>>4>1){if((L=T+5+e[T+4])===T+hi)continue}else L=T+4;switch(A){case c:_&&(h&&(s=yi(h))&&this.videoParser.parseAVCPES(a,u,s,!1,this._duration),h={data:[],size:0}),h&&(h.data.push(e.subarray(L,T+hi)),h.size+=T+hi-L);break;case d:if(_){if(p&&(s=yi(p)))switch(o.segmentCodec){case"aac":this.parseAACPES(o,s);break;case"mp3":this.parseMPEGPES(o,s);break;case"ac3":this.parseAC3PES(o,s)}p={data:[],size:0}}p&&(p.data.push(e.subarray(L,T+hi)),p.size+=T+hi-L);break;case f:_&&(g&&(s=yi(g))&&this.parseID3PES(l,s),g={data:[],size:0}),g&&(g.data.push(e.subarray(L,T+hi)),g.size+=T+hi-L);break;case 0:_&&(L+=e[L]+1),y=this._pmtId=pi(e,L);break;case y:_&&(L+=e[L]+1);var w=gi(e,L,this.typeSupported,n,this.observer);(c=w.videoPid)>0&&(a.pid=c,a.segmentCodec=w.segmentVideoCodec),(d=w.audioPid)>0&&(o.pid=d,o.segmentCodec=w.segmentAudioCodec),(f=w.id3Pid)>0&&(l.pid=f),null===v||m||(D.warn("MPEG-TS PMT found at "+T+" after unknown PID '"+v+"'. Backtracking to sync byte @"+S+" to parse all TS packets."),v=null,T=S-188),m=this.pmtParsed=!0;break;case 17:case 8191:break;default:v=A}}else b++;b>0&&vi(this.observer,new Error("Found "+b+" TS packet/s that do not start with 0x47")),a.pesData=h,o.pesData=p,l.pesData=g;var R={audioTrack:o,videoTrack:a,id3Track:l,textTrack:u};return i&&this.extractRemainingSamples(R),R},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._videoTrack,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,n=t.videoTrack,i=t.id3Track,s=t.textTrack,a=n.pesData,o=r.pesData,l=i.pesData;if(a&&(e=yi(a))?(this.videoParser.parseAVCPES(n,s,e,!0,this._duration),n.pesData=null):n.pesData=a,o&&(e=yi(o))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,e);break;case"mp3":this.parseMPEGPES(r,e);break;case"ac3":this.parseAC3PES(r,e)}r.pesData=null}else null!=o&&o.size&&D.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=o;l&&(e=yi(l))?(this.parseID3PES(i,e),i.pesData=null):i.pesData=l},e.demuxSampleAes=function(t,e,r){var n=this.demux(t,r,!0,!this.config.progressive),i=this.sampleAes=new ci(this.observer,this.config,e);return this.decrypt(n,i)},e.decrypt=function(t,e){return new Promise((function(r){var n=t.audioTrack,i=t.videoTrack;n.samples&&"aac"===n.segmentCodec?e.decryptAacSamples(n.samples,0,(function(){i.samples?e.decryptAvcSamples(i.samples,0,0,(function(){r(t)})):r(t)})):i.samples&&e.decryptAvcSamples(i.samples,0,0,(function(){r(t)}))}))},e.destroy=function(){this._duration=0},e.parseAACPES=function(t,e){var r,n,i,s=0,a=this.aacOverFlow,o=e.data;if(a){this.aacOverFlow=null;var l=a.missing,u=a.sample.unit.byteLength;if(-1===l)o=$t(a.sample.unit,o);else{var c=u-l;a.sample.unit.set(o.subarray(0,l),c),t.samples.push(a.sample),s=a.missing}}for(r=s,n=o.length;r<n-1&&!jn(o,r);r++);if(r!==s){var h,d=r<n-1;if(h=d?"AAC PES did not start with ADTS header,offset:"+r:"No ADTS header found in AAC PES",vi(this.observer,new Error(h),d),!d)return}if(Gn(t,this.observer,o,r,this.audioCodec),void 0!==e.pts)i=e.pts;else{if(!a)return void D.warn("[tsdemuxer]: AAC PES unknown PTS");var f=Vn(t.samplerate);i=a.sample.pts+f}for(var p,g=0;r<n;){if(r+=(p=Kn(t,o,r,i,g)).length,p.missing){this.aacOverFlow=p;break}for(g++;r<n-1&&!jn(o,r);r++);}},e.parseMPEGPES=function(t,e){var r=e.data,n=r.length,i=0,s=0,a=e.pts;if(void 0!==a)for(;s<n;)if(Zn(r,s)){var o=Xn(t,r,s,a,i);if(!o)break;s+=o.length,i++}else s++;else D.warn("[tsdemuxer]: MPEG PES unknown PTS")},e.parseAC3PES=function(t,e){var r=e.data,n=e.pts;if(void 0!==n)for(var i,s=r.length,a=0,o=0;o<s&&(i=ai(t,r,o,n,a++))>0;)o+=i;else D.warn("[tsdemuxer]: AC3 PES unknown PTS")},e.parseID3PES=function(t,e){if(void 0!==e.pts){var r=o({},e,{type:this._videoTrack?qe:$e,duration:Number.POSITIVE_INFINITY});t.samples.push(r)}else D.warn("[tsdemuxer]: ID3 PES unknown PTS")},t}();function fi(t,e){return((31&t[e+1])<<8)+t[e+2]}function pi(t,e){return(31&t[e+10])<<8|t[e+11]}function gi(t,e,r,n,i){var s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<a;){var o=fi(t,e),l=(15&t[e+3])<<8|t[e+4];switch(t[e]){case 207:if(!n){mi("ADTS AAC");break}case 15:-1===s.audioPid&&(s.audioPid=o);break;case 21:-1===s.id3Pid&&(s.id3Pid=o);break;case 219:if(!n){mi("H.264");break}case 27:-1===s.videoPid&&(s.videoPid=o,s.segmentVideoCodec="avc");break;case 3:case 4:r.mpeg||r.mp3?-1===s.audioPid&&(s.audioPid=o,s.segmentAudioCodec="mp3"):D.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){mi("AC-3");break}case 129:r.ac3?-1===s.audioPid&&(s.audioPid=o,s.segmentAudioCodec="ac3"):D.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&l>0)for(var u=e+5,c=l;c>2;){106===t[u]&&(!0!==r.ac3?D.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=o,s.segmentAudioCodec="ac3"));var h=t[u+1]+2;u+=h,c-=h}break;case 194:case 135:return vi(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return vi(i,new Error("Unsupported HEVC in M2TS found")),s}e+=l+5}return s}function vi(t,e,r){D.warn("parsing error: "+e.message),t.emit(b.ERROR,b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:e,reason:e.message})}function mi(t){D.log(t+" with AES-128-CBC encryption found in unencrypted stream")}function yi(t){var e,r,n,i,s,a=0,o=t.data;if(!t||0===t.size)return null;for(;o[0].length<19&&o.length>1;)o[0]=$t(o[0],o[1]),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 l=e[7];192&l&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&l?i-(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(D.warn(Math.round((i-s)/9e4)+"s delta between PTS and DTS, align them"),i=s):s=i);var u=(n=e[8])+9;if(t.size<=u)return null;t.size-=u;for(var c=new Uint8Array(t.size),h=0,d=o.length;h<d;h++){var f=(e=o[h]).byteLength;if(u){if(u>f){u-=f;continue}e=e.subarray(u),f-=u,u=0}c.set(e,a),a+=f}return r&&(r-=n+3),{data:c,pts:i,dts:s,len:r}}return null}var Ei=function(t){function e(){return t.apply(this,arguments)||this}l(e,t);var r=e.prototype;return r.resetInitSegment=function(e,r,n,i){t.prototype.resetInitSegment.call(this,e,r,n,i),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:r,duration:i,inputTimeScale:9e4,dropped:0}},e.probe=function(t){if(!t)return!1;var e=dt(t,0),r=(null==e?void 0:e.length)||0;if(e&&11===t[r]&&119===t[r+1]&&void 0!==gt(e)&&ii(t,r)<=16)return!1;for(var n=t.length;r<n;r++)if(ti(t,r))return D.log("MPEG Audio sync word found !"),!0;return!1},r.canParse=function(t,e){return function(t,e){return Qn(t,e)&&4<=t.length-e}(t,e)},r.appendFrame=function(t,e,r){if(null!==this.basePTS)return Xn(t,e,r,this.basePTS,this.frameIndex)},e}(Mn),Si=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}(),bi=Math.pow(2,32)-1,Ti=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":[],dac3:[],"ac-3":[],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]),n=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:n};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=s,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 a=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,a,l,a,o),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))},t.box=function(t){for(var e=8,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var s=n.length,a=s;s--;)e+=n[s].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),s=0,e=8;s<a;s++)o.set(n[s],e),e+=n[s].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 n=Math.floor(r/(bi+1)),i=Math.floor(r%(bi+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,n>>24,n>>16&255,n>>8&255,255&n,i>>24,i>>16&255,i>>8&255,255&i,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,n){return t.box(t.types.moof,t.mfhd(e),t.traf(n,r))},t.moov=function(e){for(var r=e.length,n=[];r--;)n[r]=t.trak(e[r]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(n).concat(t.mvex(e)))},t.mvex=function(e){for(var r=e.length,n=[];r--;)n[r]=t.trex(e[r]);return t.box.apply(null,[t.types.mvex].concat(n))},t.mvhd=function(e,r){r*=e;var n=Math.floor(r/(bi+1)),i=Math.floor(r%(bi+1)),s=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,n>>24,n>>16&255,n>>8&255,255&n,i>>24,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]);return t.box(t.types.mvhd,s)},t.sdtp=function(e){var r,n,i=e.samples||[],s=new Uint8Array(4+i.length);for(r=0;r<i.length;r++)n=i[r].flags,s[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return t.box(t.types.sdtp,s)},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,n,i,s=[],a=[];for(r=0;r<e.sps.length;r++)i=(n=e.sps[r]).byteLength,s.push(i>>>8&255),s.push(255&i),s=s.concat(Array.prototype.slice.call(n));for(r=0;r<e.pps.length;r++)i=(n=e.pps[r]).byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(n));var o=t.box(t.types.avcC,new Uint8Array([1,s[3],s[4],s[5],255,224|e.sps.length].concat(s).concat([e.pps.length]).concat(a))),l=e.width,u=e.height,c=e.pixelRatio[0],h=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([c>>24,c>>16&255,c>>8&255,255&c,h>>24,h>>16&255,h>>8&255,255&h])))},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.audioStsd=function(t){var e=t.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0])},t.mp4a=function(e){return t.box(t.types.mp4a,t.audioStsd(e),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){return t.box(t.types[".mp3"],t.audioStsd(e))},t.ac3=function(e){return t.box(t.types["ac-3"],t.audioStsd(e),t.box(t.types.dac3,e.config))},t.stsd=function(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?t.box(t.types.stsd,t.STSD,t.mp3(e)):"ac3"===e.segmentCodec?t.box(t.types.stsd,t.STSD,t.ac3(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,n=e.duration*e.timescale,i=e.width,s=e.height,a=Math.floor(n/(bi+1)),o=Math.floor(n%(bi+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,a>>24,a>>16&255,a>>8&255,255&a,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,i>>8&255,255&i,0,0,s>>8&255,255&s,0,0]))},t.traf=function(e,r){var n=t.sdtp(e),i=e.id,s=Math.floor(r/(bi+1)),a=Math.floor(r%(bi+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a])),t.trun(e,n.length+16+20+8+16+8+8),n)},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 n,i,s,a,o,l,u=e.samples||[],c=u.length,h=12+16*c,d=new Uint8Array(h);for(r+=8+h,d.set(["video"===e.type?1:0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,r>>>24&255,r>>>16&255,r>>>8&255,255&r],0),n=0;n<c;n++)s=(i=u[n]).duration,a=i.size,o=i.flags,l=i.cts,d.set([s>>>24&255,s>>>16&255,s>>>8&255,255&s,a>>>24&255,a>>>16&255,a>>>8&255,255&a,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*n);return t.box(t.types.trun,d)},t.initSegment=function(e){t.types||t.init();var r=t.moov(e);return $t(t.FTYP,r)},t}();Ti.types=void 0,Ti.HDLR_TYPES=void 0,Ti.STTS=void 0,Ti.STSC=void 0,Ti.STCO=void 0,Ti.STSZ=void 0,Ti.VMHD=void 0,Ti.SMHD=void 0,Ti.STSD=void 0,Ti.FTYP=void 0,Ti.DINF=void 0;var _i=9e4;function Ai(t,e,r,n){void 0===r&&(r=1),void 0===n&&(n=!1);var i=t*e*r;return n?Math.round(i):i}function Li(t,e){return void 0===e&&(e=!1),Ai(t,1e3,1/_i,e)}var wi=null,Ri=null,ki=function(){function t(t,e,r,n){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.videoTrackConfig=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.ISGenerated=!1,null===wi){var i=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);wi=i?parseInt(i[1]):0}if(null===Ri){var s=navigator.userAgent.match(/Safari\/(\d+)/i);Ri=s?parseInt(s[1]):0}}var e=t.prototype;return e.destroy=function(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null},e.resetTimeStamp=function(t){D.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){D.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){D.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0},e.getVideoStartPts=function(t){var e=!1,r=t.reduce((function(t,r){var n=r.pts-t;return n<-4294967296?(e=!0,Di(t,r.pts)):n>0?t:r.pts}),t[0].pts);return e&&D.debug("PTS rollover detected"),r},e.remux=function(t,e,r,n,i,s,a,o){var l,u,c,h,d,f,p=i,g=i,v=t.pid>-1,m=e.pid>-1,y=e.samples.length,E=t.samples.length>0,S=a&&y>0||y>1;if((!v||E)&&(!m||S)||this.ISGenerated||a){if(this.ISGenerated){var b,T,_,A,L=this.videoTrackConfig;!L||e.width===L.width&&e.height===L.height&&(null==(b=e.pixelRatio)?void 0:b[0])===(null==(T=L.pixelRatio)?void 0:T[0])&&(null==(_=e.pixelRatio)?void 0:_[1])===(null==(A=L.pixelRatio)?void 0:A[1])||this.resetInitSegment()}else c=this.generateIS(t,e,i,s);var w,R=this.isVideoContiguous,k=-1;if(S&&(k=function(t){for(var e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!R&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,k>0){D.warn("[mp4-remuxer]: Dropped "+k+" out of "+y+" video samples due to a missing keyframe");var I=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(k),e.dropped+=k,w=g+=(e.samples[0].pts-I)/e.inputTimeScale}else-1===k&&(D.warn("[mp4-remuxer]: No keyframe found out of "+y+" video samples"),f=!1);if(this.ISGenerated){if(E&&S){var P=this.getVideoStartPts(e.samples),O=(Di(t.samples[0].pts,P)-P)/e.inputTimeScale;p+=Math.max(0,O),g+=Math.max(0,-O)}if(E){if(t.samplerate||(D.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(t,e,i,s)),u=this.remuxAudio(t,p,this.isAudioContiguous,s,m||S||o===Me?g:void 0),S){var C=u?u.endPTS-u.startPTS:0;e.inputTimeScale||(D.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(t,e,i,s)),l=this.remuxVideo(e,g,R,C)}}else S&&(l=this.remuxVideo(e,g,R,0));l&&(l.firstKeyFrame=k,l.independent=-1!==k,l.firstKeyFramePTS=w)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(d=Ii(r,i,this._initPTS,this._initDTS)),n.samples.length&&(h=Pi(n,i,this._initPTS))),{audio:u,video:l,initSegment:c,independent:f,text:h,id3:d}},e.generateIS=function(t,e,r,n){var i,s,a,o=t.samples,l=e.samples,u=this.typeSupported,c={},h=this._initPTS,d=!h||n,f="audio/mp4";if(d&&(i=s=1/0),t.config&&o.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":u.mpeg?(f="audio/mpeg",t.codec=""):u.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}c.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&u.mpeg?new Uint8Array(0):Ti.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(a=t.inputTimeScale,h&&a===h.timescale?d=!1:i=s=o[0].pts-Math.round(a*r))}if(e.sps&&e.pps&&l.length){if(e.timescale=e.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:Ti.initSegment([e]),metadata:{width:e.width,height:e.height}},d)if(a=e.inputTimeScale,h&&a===h.timescale)d=!1;else{var p=this.getVideoStartPts(l),g=Math.round(a*r);s=Math.min(s,Di(l[0].dts,p)-g),i=Math.min(i,p-g)}this.videoTrackConfig={width:e.width,height:e.height,pixelRatio:e.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:i,timescale:a},this._initDTS={baseTime:s,timescale:a}):i=a=void 0,{tracks:c,initPTS:i,timescale:a}},e.remuxVideo=function(t,e,r,n){var i,s,a=t.inputTimeScale,l=t.samples,u=[],c=l.length,h=this._initPTS,d=this.nextAvcDts,f=8,p=this.videoSampleDuration,g=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY,m=!1;if(!r||null===d){var y=e*a,E=l[0].pts-Di(l[0].dts,l[0].pts);wi&&null!==d&&Math.abs(y-E-d)<15e3?r=!0:d=y-E}for(var S=h.baseTime*a/h.timescale,A=0;A<c;A++){var L=l[A];L.pts=Di(L.pts-S,d),L.dts=Di(L.dts-S,d),L.dts<l[A>0?A-1:A].dts&&(m=!0)}m&&l.sort((function(t,e){var r=t.dts-e.dts,n=t.pts-e.pts;return r||n})),i=l[0].dts;var w=l[l.length-1].dts-i,R=w?Math.round(w/(c-1)):p||t.inputTimeScale/30;if(r){var k=i-d,I=k>R,P=k<-1;if((I||P)&&(I?D.warn("AVC: "+Li(k,!0)+" ms ("+k+"dts) hole between fragments detected at "+e.toFixed(3)):D.warn("AVC: "+Li(-k,!0)+" ms ("+k+"dts) overlapping between fragments detected at "+e.toFixed(3)),!P||d>=l[0].pts||wi)){i=d;var O=l[0].pts-k;if(I)l[0].dts=i,l[0].pts=O;else for(var C=0;C<l.length&&!(l[C].dts>O);C++)l[C].dts-=k,l[C].pts-=k;D.log("Video: Initial PTS/DTS adjusted: "+Li(O,!0)+"/"+Li(i,!0)+", delta: "+Li(k,!0)+" ms")}}for(var x=0,M=0,F=i=Math.max(0,i),N=0;N<c;N++){for(var B=l[N],U=B.units,j=U.length,H=0,G=0;G<j;G++)H+=U[G].data.length;M+=H,x+=j,B.length=H,B.dts<F?(B.dts=F,F+=R/4|0||1):F=B.dts,g=Math.min(B.pts,g),v=Math.max(B.pts,v)}s=l[c-1].dts;var V,K=M+4*x+8;try{V=new Uint8Array(K)}catch(t){return void this.observer.emit(b.ERROR,b.ERROR,{type:T.MUX_ERROR,details:_.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:K,reason:"fail allocating video mdat "+K})}var $=new DataView(V.buffer);$.setUint32(0,K),V.set(Ti.types.mdat,4);for(var W=!1,q=Number.POSITIVE_INFINITY,Y=Number.POSITIVE_INFINITY,z=Number.NEGATIVE_INFINITY,X=Number.NEGATIVE_INFINITY,J=0;J<c;J++){for(var Q=l[J],Z=Q.units,tt=0,et=0,rt=Z.length;et<rt;et++){var nt=Z[et],it=nt.data,st=nt.data.byteLength;$.setUint32(f,st),f+=4,V.set(it,f),f+=st,tt+=4+st}var at=void 0;if(J<c-1)p=l[J+1].dts-Q.dts,at=l[J+1].pts-Q.pts;else{var ot=this.config,lt=J>0?Q.dts-l[J-1].dts:R;if(at=J>0?Q.pts-l[J-1].pts:R,ot.stretchShortVideoTrack&&null!==this.nextAudioPts){var ut=Math.floor(ot.maxBufferHole*a),ct=(n?g+n*a:this.nextAudioPts)-Q.pts;ct>ut?((p=ct-lt)<0?p=lt:W=!0,D.log("[mp4-remuxer]: It is approximately "+ct/90+" ms to the next segment; using duration "+p/90+" ms for the last video frame.")):p=lt}else p=lt}var ht=Math.round(Q.pts-Q.dts);q=Math.min(q,p),z=Math.max(z,p),Y=Math.min(Y,at),X=Math.max(X,at),u.push(new Ci(Q.key,p,tt,ht))}if(u.length)if(wi){if(wi<70){var dt=u[0].flags;dt.dependsOn=2,dt.isNonSync=0}}else if(Ri&&X-Y<z-q&&R/z<.025&&0===u[0].cts){D.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");for(var ft=i,pt=0,gt=u.length;pt<gt;pt++){var vt=ft+u[pt].duration,mt=ft+u[pt].cts;if(pt<gt-1){var yt=vt+u[pt+1].cts;u[pt].duration=yt-mt}else u[pt].duration=pt?u[pt-1].duration:R;u[pt].cts=0,ft=vt}}p=W||!p?R:p,this.nextAvcDts=d=s+p,this.videoSampleDuration=p,this.isVideoContiguous=!0;var Et={data1:Ti.moof(t.sequenceNumber++,i,o({},t,{samples:u})),data2:V,startPTS:g/a,endPTS:(v+p)/a,startDTS:i/a,endDTS:d/a,type:"video",hasAudio:!1,hasVideo:!0,nb:u.length,dropped:t.dropped};return t.samples=[],t.dropped=0,Et},e.getSamplesPerFrame=function(t){switch(t.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}},e.remuxAudio=function(t,e,r,n,i){var s=t.inputTimeScale,a=s/(t.samplerate?t.samplerate:s),l=this.getSamplesPerFrame(t),u=l*a,c=this._initPTS,h="mp3"===t.segmentCodec&&this.typeSupported.mpeg,d=[],f=void 0!==i,p=t.samples,g=h?0:8,v=this.nextAudioPts||-1,m=e*s,y=c.baseTime*s/c.timescale;if(this.isAudioContiguous=r=r||p.length&&v>0&&(n&&Math.abs(m-v)<9e3||Math.abs(Di(p[0].pts-y,m)-v)<20*u),p.forEach((function(t){t.pts=Di(t.pts-y,m)})),!r||v<0){if(p=p.filter((function(t){return t.pts>=0})),!p.length)return;v=0===i?0:n&&!f?Math.max(0,m):p[0].pts}if("aac"===t.segmentCodec)for(var E=this.config.maxAudioFramesDrift,S=0,A=v;S<p.length;S++){var L=p[S],w=L.pts,R=w-A,k=Math.abs(1e3*R/s);if(R<=-E*u&&f)0===S&&(D.warn("Audio frame @ "+(w/s).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*R/s)+" ms."),this.nextAudioPts=v=A=w);else if(R>=E*u&&k<1e4&&f){var I=Math.round(R/u);(A=w-I*u)<0&&(I--,A+=u),0===S&&(this.nextAudioPts=v=A),D.warn("[mp4-remuxer]: Injecting "+I+" audio frame @ "+(A/s).toFixed(3)+"s due to "+Math.round(1e3*R/s)+" ms gap.");for(var P=0;P<I;P++){var O=Math.max(A,0),C=Si.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);C||(D.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),C=L.unit.subarray()),p.splice(S,0,{unit:C,pts:O}),A+=u,S++}}L.pts=A,A+=u}for(var x,M=null,F=null,N=0,B=p.length;B--;)N+=p[B].unit.byteLength;for(var U=0,j=p.length;U<j;U++){var H=p[U],G=H.unit,V=H.pts;if(null!==F)d[U-1].duration=Math.round((V-F)/a);else{if(r&&"aac"===t.segmentCodec&&(V=v),M=V,!(N>0))return;N+=g;try{x=new Uint8Array(N)}catch(t){return void this.observer.emit(b.ERROR,b.ERROR,{type:T.MUX_ERROR,details:_.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:N,reason:"fail allocating audio mdat "+N})}h||(new DataView(x.buffer).setUint32(0,N),x.set(Ti.types.mdat,4))}x.set(G,g);var K=G.byteLength;g+=K,d.push(new Ci(!0,l,K,0)),F=V}var $=d.length;if($){var W=d[d.length-1];this.nextAudioPts=v=F+a*W.duration;var q=h?new Uint8Array(0):Ti.moof(t.sequenceNumber++,M/a,o({},t,{samples:d}));t.samples=[];var Y=M/s,z=v/s,X={data1:q,data2:x,startPTS:Y,endPTS:z,startDTS:Y,endDTS:z,type:"audio",hasAudio:!0,hasVideo:!1,nb:$};return this.isAudioContiguous=!0,X}},e.remuxEmptyAudio=function(t,e,r,n){var i=t.inputTimeScale,s=i/(t.samplerate?t.samplerate:i),a=this.nextAudioPts,o=this._initDTS,l=9e4*o.baseTime/o.timescale,u=(null!==a?a:n.startDTS*i)+l,c=n.endDTS*i+l,h=1024*s,d=Math.ceil((c-u)/h),f=Si.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(D.warn("[mp4-remuxer]: remux empty Audio"),f){for(var p=[],g=0;g<d;g++){var v=u+g*h;p.push({unit:f,pts:v,dts:v})}return t.samples=p,this.remuxAudio(t,e,r,!1)}D.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec")},t}();function Di(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 Ii(t,e,r,n){var i=t.samples.length;if(i){for(var s=t.inputTimeScale,a=0;a<i;a++){var o=t.samples[a];o.pts=Di(o.pts-r.baseTime*s/r.timescale,e*s)/s,o.dts=Di(o.dts-n.baseTime*s/n.timescale,e*s)/s}var l=t.samples;return t.samples=[],{samples:l}}}function Pi(t,e,r){var n=t.samples.length;if(n){for(var i=t.inputTimeScale,s=0;s<n;s++){var a=t.samples[s];a.pts=Di(a.pts-r.baseTime*i/r.timescale,e*i)/i}t.samples.sort((function(t,e){return t.pts-e.pts}));var o=t.samples;return t.samples=[],{samples:o}}}var Oi,Ci=function(t,e,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=r,this.cts=n,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}},xi=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,n){this.audioCodec=e,this.videoCodec=r,this.generateInitSegment(function(t,e){if(!t||!e)return t;var r=e.keyId;return r&&e.isCommonEncryption&&Ft(t,["moov","trak"]).forEach((function(t){var e=Ft(t,["mdia","minf","stbl","stsd"])[0].subarray(8),n=Ft(e,["enca"]),i=n.length>0;i||(n=Ft(e,["encv"])),n.forEach((function(t){Ft(i?t.subarray(28):t.subarray(78),["sinf"]).forEach((function(t){var e=Vt(t);if(e){var n=e.subarray(8,24);n.some((function(t){return 0!==t}))||(D.log("[eme] Patching keyId in 'enc"+(i?"a":"v")+">sinf>>tenc' box: "+wt.hexDump(n)+" -> "+wt.hexDump(r)),e.set(r,8))}}))}))})),t}(t,n)),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 n=this.initData=Bt(t);n.audio&&(e=Mi(n.audio,F)),n.video&&(r=Mi(n.video,N));var i={};n.audio&&n.video?i.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:t,id:"main"}:n.audio?i.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:n.video?i.video={container:"video/mp4",codec:r,initSegment:t,id:"main"}:D.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i},e.remux=function(t,e,r,n,i,s){var a,o,l=this.initPTS,u=this.lastEndTime,c={audio:void 0,video:void 0,text:n,id3:r,initSegment:void 0};y(u)||(u=this.lastEndTime=i||0);var h=e.samples;if(null==h||!h.length)return c;var d={initPTS:void 0,timescale:1},f=this.initData;if(null!=(a=f)&&a.length||(this.generateInitSegment(h),f=this.initData),null==(o=f)||!o.length)return D.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);var p=function(t,e){for(var r=0,n=0,i=0,s=Ft(t,["moof","traf"]),a=0;a<s.length;a++){var o=s[a],l=Ft(o,["tfhd"])[0],u=e[Ot(l,4)];if(u){var c=u.default,h=Ot(l,0)|(null==c?void 0:c.flags),d=null==c?void 0:c.duration;8&h&&(d=Ot(l,2&h?12:8));for(var f=u.timescale||9e4,p=Ft(o,["trun"]),g=0;g<p.length;g++)!(r=Kt(p[g]))&&d&&(r=d*Ot(p[g],4)),u.type===N?n+=r/f:u.type===F&&(i+=r/f)}}if(0===n&&0===i){for(var v=1/0,m=0,E=0,S=Ft(t,["sidx"]),b=0;b<S.length;b++){var T=Nt(S[b]);if(null!=T&&T.references){v=Math.min(v,T.earliestPresentationTime/T.timescale);var _=T.references.reduce((function(t,e){return t+e.info.duration||0}),0);E=(m=Math.max(m,_+T.earliestPresentationTime/T.timescale))-v}}if(E&&y(E))return E}return n||i}(h,f),g=function(t,e){return Ft(e,["moof","traf"]).reduce((function(e,r){var n=Ft(r,["tfdt"])[0],i=n[0],s=Ft(r,["tfhd"]).reduce((function(e,r){var s=Ot(r,4),a=t[s];if(a){var o=Ot(n,4);if(1===i){if(o===Rt)return D.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;o*=Rt+1,o+=Ot(n,8)}var l=o/(a.timescale||9e4);if(y(l)&&(null===e||l<e))return l}return e}),null);return null!==s&&y(s)&&(null===e||s<e)?s:e}),null)}(f,h),v=null===g?i:g;(function(t,e,r,n){if(null===t)return!0;var i=Math.max(n,1),s=e-t.baseTime/t.timescale;return Math.abs(s-r)>i}(l,v,i,p)||d.timescale!==l.timescale&&s)&&(d.initPTS=v-i,l&&1===l.timescale&&D.warn("Adjusting initPTS by "+(d.initPTS-l.baseTime)),this.initPTS=l={baseTime:d.initPTS,timescale:1});var m=t?v-l.baseTime/l.timescale:u,E=m+p;(function(t,e,r){Ft(e,["moof","traf"]).forEach((function(e){Ft(e,["tfhd"]).forEach((function(n){var i=Ot(n,4),s=t[i];if(s){var a=s.timescale||9e4;Ft(e,["tfdt"]).forEach((function(t){var e=t[0],n=r*a;if(n){var i=Ot(t,4);if(0===e)i-=n,Mt(t,4,i=Math.max(i,0));else{i*=Math.pow(2,32),i+=Ot(t,8),i-=n,i=Math.max(i,0);var s=Math.floor(i/(Rt+1)),o=Math.floor(i%(Rt+1));Mt(t,4,s),Mt(t,8,o)}}}))}}))}))})(f,h,l.baseTime/l.timescale),p>0?this.lastEndTime=E:(D.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var S=!!f.audio,b=!!f.video,T="";S&&(T+="audio"),b&&(T+="video");var _={data1:h,startPTS:m,startDTS:m,endPTS:E,endDTS:E,type:T,hasAudio:S,hasVideo:b,nb:1,dropped:0};return c.audio="audio"===_.type?_:void 0,c.video="audio"!==_.type?_:void 0,c.initSegment=d,c.id3=Ii(r,i,l,l),n.samples.length&&(c.text=Pi(n,i,l)),c},t}();function Mi(t,e){var r=null==t?void 0:t.codec;if(r&&r.length>4)return r;if(e===F){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r)return ge(r,!1);var n="mp4a.40.5";return D.info('Parsed audio codec "'+r+'" or audio object type not handled. Using "'+n+'"'),n}return D.warn('Unhandled video codec "'+r+'"'),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}try{Oi=self.performance.now.bind(self.performance)}catch(t){D.debug("Unable to use Performance API on this environment"),Oi=null==W?void 0:W.Date.now}var Fi=[{demux:ni,remux:xi},{demux:di,remux:ki},{demux:ei,remux:ki},{demux:Ei,remux:ki}];Fi.splice(2,0,{demux:si,remux:ki});var Ni=function(){function t(t,e,r,n,i){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=n,this.id=i}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,r,n){var i=this,s=r.transmuxing;s.executeStart=Oi();var a=new Uint8Array(t),o=this.currentTransmuxState,l=this.transmuxConfig;n&&(this.currentTransmuxState=n);var u=n||o,c=u.contiguous,h=u.discontinuity,d=u.trackSwitch,f=u.accurateTimeOffset,p=u.timeOffset,g=u.initSegmentChange,v=l.audioCodec,m=l.videoCodec,y=l.defaultInitPts,E=l.duration,S=l.initSegmentData,A=function(t,e){var r=null;return t.byteLength>0&&null!=(null==e?void 0:e.key)&&null!==e.iv&&null!=e.method&&(r=e),r}(a,e);if(A&&"AES-128"===A.method){var L=this.getDecrypter();if(!L.isSync())return this.decryptionPromise=L.webCryptoDecrypt(a,A.key.buffer,A.iv.buffer).then((function(t){var e=i.push(t,null,r);return i.decryptionPromise=null,e})),this.decryptionPromise;var w=L.softwareDecrypt(a,A.key.buffer,A.iv.buffer);if(r.part>-1&&(w=L.flush()),!w)return s.executeEnd=Oi(),Bi(r);a=new Uint8Array(w)}var R=this.needsProbing(h,d);if(R){var k=this.configureTransmuxer(a);if(k)return D.warn("[transmuxer] "+k.message),this.observer.emit(b.ERROR,b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,fatal:!1,error:k,reason:k.message}),s.executeEnd=Oi(),Bi(r)}(h||d||g||R)&&this.resetInitSegment(S,v,m,E,e),(h||g||R)&&this.resetInitialTimestamp(y),c||this.resetContiguity();var I=this.transmux(a,A,p,f,r),P=this.currentTransmuxState;return P.contiguous=!0,P.discontinuity=!1,P.trackSwitch=!1,s.executeEnd=Oi(),I},e.flush=function(t){var e=this,r=t.transmuxing;r.executeStart=Oi();var n=this.decrypter,i=this.currentTransmuxState,s=this.decryptionPromise;if(s)return s.then((function(){return e.flush(t)}));var a=[],o=i.timeOffset;if(n){var l=n.flush();l&&a.push(this.push(l,null,t))}var u=this.demuxer,c=this.remuxer;if(!u||!c)return r.executeEnd=Oi(),[Bi(t)];var h=u.flush(o);return Ui(h)?h.then((function(r){return e.flushRemux(a,r,t),a})):(this.flushRemux(a,h,t),a)},e.flushRemux=function(t,e,r){var n=e.audioTrack,i=e.videoTrack,s=e.id3Track,a=e.textTrack,o=this.currentTransmuxState,l=o.accurateTimeOffset,u=o.timeOffset;D.log("[transmuxer.ts]: Flushed fragment "+r.sn+(r.part>-1?" p: "+r.part:"")+" of level "+r.level);var c=this.remuxer.remux(n,i,s,a,u,l,!0,this.id);t.push({remuxResult:c,chunkMeta:r}),r.transmuxing.executeEnd=Oi()},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,n,i){var s=this.demuxer,a=this.remuxer;s&&a&&(s.resetInitSegment(t,e,r,n),a.resetInitSegment(t,e,r,i))},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,n,i){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,r,n,i):this.transmuxUnencrypted(t,r,n,i)},e.transmuxUnencrypted=function(t,e,r,n){var i=this.demuxer.demux(t,e,!1,!this.config.progressive),s=i.audioTrack,a=i.videoTrack,o=i.id3Track,l=i.textTrack;return{remuxResult:this.remuxer.remux(s,a,o,l,e,r,!1,this.id),chunkMeta:n}},e.transmuxSampleAes=function(t,e,r,n,i){var s=this;return this.demuxer.demuxSampleAes(t,e,r).then((function(t){return{remuxResult:s.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,r,n,!1,s.id),chunkMeta:i}}))},e.configureTransmuxer=function(t){for(var e,r=this.config,n=this.observer,i=this.typeSupported,s=this.vendor,a=0,o=Fi.length;a<o;a++){var l;if(null!=(l=Fi[a].demux)&&l.probe(t)){e=Fi[a];break}}if(!e)return new Error("Failed to find demuxer by probing fragment data");var u=this.demuxer,c=this.remuxer,h=e.remux,d=e.demux;c&&c instanceof h||(this.remuxer=new h(n,r,i,s)),u&&u instanceof d||(this.demuxer=new d(n,r,i),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 yn(this.config)),t},t}();var Bi=function(t){return{remuxResult:{},chunkMeta:t}};function Ui(t){return"then"in t&&t.then instanceof Function}var ji=function(t,e,r,n,i){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=n,this.defaultInitPts=i||null},Hi=function(t,e,r,n,i,s){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=n,this.timeOffset=i,this.initSegmentChange=s},Gi={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,n,s,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new i(n,s||t,a),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 a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),o.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},o.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,a=new Array(s);i<s;i++)a[i]=n[i].fn;return a},o.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,i,s,a){var o=r?r+t:t;if(!this._events[o])return!1;var l,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,i),!0;case 5:return c.fn.call(c.context,e,n,i,s),!0;case 6:return c.fn.call(c.context,e,n,i,s,a),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,n);break;case 4:c[u].fn.call(c[u].context,e,n,i);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},o.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},o.prototype.removeListener=function(t,e,n,i){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==e||i&&!o.once||n&&o.context!==n||a(this,s);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==e||i&&!o[l].once||n&&o[l].context!==n)&&u.push(o[l]);u.length?this._events[s]=1===u.length?u[0]:u:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,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}(Gi);var Vi=g(Gi.exports);function Ki(t,e){if(!((r=e.remuxResult).audio||r.video||r.text||r.id3||r.initSegment))return!1;var r,n=[],i=e.remuxResult,s=i.audio,a=i.video;return s&&$i(n,s),a&&$i(n,a),t.postMessage({event:"transmuxComplete",data:e},n),!0}function $i(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function Wi(t,e,r){e.reduce((function(e,r){return Ki(t,r)||e}),!1)||t.postMessage({event:"transmuxComplete",data:e[0]}),t.postMessage({event:"flush",data:r})}void 0!==r&&r&&function(t){var e=new Vi,r=function(e,r){t.postMessage({event:e,data:r})};e.on(b.FRAG_DECRYPTED,r),e.on(b.ERROR,r),t.addEventListener("message",(function(n){var i=n.data;switch(i.cmd){case"init":var s=JSON.parse(i.config);t.transmuxer=new Ni(e,i.typeSupported,s,"",i.id),k(s.debug,i.id),function(){var t=function(t){D[t]=function(e){r("workerLog",{logType:t,message:e})}};for(var e in D)t(e)}(),r("init",null);break;case"configure":t.transmuxer.configure(i.config);break;case"demux":var a=t.transmuxer.push(i.data,i.decryptdata,i.chunkMeta,i.state);Ui(a)?(t.transmuxer.async=!0,a.then((function(e){Ki(t,e)})).catch((function(t){r(b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,chunkMeta:i.chunkMeta,fatal:!1,error:t,err:t,reason:"transmuxer-worker push error"})}))):(t.transmuxer.async=!1,Ki(t,a));break;case"flush":var o=i.chunkMeta,l=t.transmuxer.flush(o);Ui(l)||t.transmuxer.async?(Ui(l)||(l=Promise.resolve(l)),l.then((function(e){Wi(t,e,o)})).catch((function(t){r(b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,chunkMeta:i.chunkMeta,fatal:!1,error:t,err:t,reason:"transmuxer-worker flush error"})}))):Wi(t,l,o)}}))}(self);var qi=function(){function t(t,r,n,i){var s=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 a=t.config;this.hls=t,this.id=r,this.useWorker=!!a.enableWorker,this.onTransmuxComplete=n,this.onFlush=i;var o=function(t,e){(e=e||{}).frag=s.frag,e.id=s.id,t===b.ERROR&&(s.error=e.error),s.hls.trigger(t,e)};this.observer=new Vi,this.observer.on(b.FRAG_DECRYPTED,o),this.observer.on(b.ERROR,o);var l,u,c,h,d=ae(a.preferManagedMediaSource)||{isTypeSupported:function(){return!1}},f={mpeg:d.isTypeSupported("audio/mpeg"),mp3:d.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:d.isTypeSupported('audio/mp4; codecs="ac-3"')};if(this.useWorker&&"undefined"!=typeof Worker&&(a.workerPath,1))try{a.workerPath?(D.log("loading Web Worker "+a.workerPath+' for "'+r+'"'),this.workerContext=(c=a.workerPath,h=new self.URL(c,self.location.href).href,{worker:new self.Worker(h),scriptURL:h})):(D.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;("+e.toString()+")(true);"],{type:"text/javascript"}),u=self.URL.createObjectURL(l),{worker:new self.Worker(u),objectURL:u})),this.onwmsg=function(t){return s.onWorkerMessage(t)};var p=this.workerContext.worker;p.addEventListener("message",this.onwmsg),p.onerror=function(t){var e=new Error(t.message+"  ("+t.filename+":"+t.lineno+")");a.enableWorker=!1,D.warn('Error in "'+r+'" Web Worker, fallback to inline'),s.hls.trigger(b.ERROR,{type:T.OTHER_ERROR,details:_.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:e})},p.postMessage({cmd:"init",typeSupported:f,vendor:"",id:r,config:JSON.stringify(a)})}catch(t){D.warn('Error setting up "'+r+'" Web Worker, fallback to inline',t),this.resetWorker(),this.error=null,this.transmuxer=new Ni(this.observer,f,a,"",r)}else this.transmuxer=new Ni(this.observer,f,a,"",r)}var r=t.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,n,i,s,a,o,l,u){var c,h,d=this;l.transmuxing.start=self.performance.now();var f=this.transmuxer,p=s?s.start:i.start,g=i.decryptdata,v=this.frag,m=!(v&&i.cc===v.cc),y=!(v&&l.level===v.level),E=v?l.sn-v.sn:-1,S=this.part?l.part-this.part.index:-1,b=0===E&&l.id>1&&l.id===(null==v?void 0:v.stats.chunkCount),T=!y&&(1===E||0===E&&(1===S||b&&S<=0)),_=self.performance.now();(y||E||0===i.stats.parsing.start)&&(i.stats.parsing.start=_),!s||!S&&T||(s.stats.parsing.start=_);var A=!(v&&(null==(c=i.initSegment)?void 0:c.url)===(null==(h=v.initSegment)?void 0:h.url)),L=new Hi(m,T,o,y,p,A);if(!T||m||A){D.log("[transmuxer-interface, "+i.type+"]: Starting new transmux session for sn: "+l.sn+" p: "+l.part+" level: "+l.level+" id: "+l.id+"\n        discontinuity: "+m+"\n        trackSwitch: "+y+"\n        contiguous: "+T+"\n        accurateTimeOffset: "+o+"\n        timeOffset: "+p+"\n        initSegmentChange: "+A);var w=new ji(r,n,e,a,u);this.configureTransmuxer(w)}if(this.frag=i,this.part=s,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:t,decryptdata:g,chunkMeta:l,state:L},t instanceof ArrayBuffer?[t]:[]);else if(f){var R=f.push(t,g,l,L);Ui(R)?(f.async=!0,R.then((function(t){d.handleTransmuxComplete(t)})).catch((function(t){d.transmuxerError(t,l,"transmuxer-interface push error")}))):(f.async=!1,this.handleTransmuxComplete(R))}},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 n=r.flush(t);Ui(n)||r.async?(Ui(n)||(n=Promise.resolve(n)),n.then((function(r){e.handleFlushResult(r,t)})).catch((function(r){e.transmuxerError(r,t,"transmuxer-interface flush error")}))):this.handleFlushResult(n,t)}},r.transmuxerError=function(t,e,r){this.hls&&(this.error=t,this.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,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;if(null!=e&&e.event){var r=this.hls;if(this.hls)switch(e.event){case"init":var n,i=null==(n=this.workerContext)?void 0:n.objectURL;i&&self.URL.revokeObjectURL(i);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":D[e.data.logType]&&D[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)}}else D.warn("worker message received with no "+(e?"event name":"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)},t}();function Yi(t,e){if(t.length!==e.length)return!1;for(var r=0;r<t.length;r++)if(!zi(t[r].attrs,e[r].attrs))return!1;return!0}function zi(t,e,r){var n=t["STABLE-RENDITION-ID"];return n&&!r?n===e["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((function(r){return t[r]!==e[r]}))}function Xi(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}var Ji=function(t){function e(e,r,n){var i;return(i=t.call(this,e,r,n,"[audio-stream-controller]",Me)||this).videoBuffer=null,i.videoTrackCC=-1,i.waitingVideoCC=-1,i.bufferedTrack=null,i.switchingTrack=null,i.trackId=-1,i.waitingData=null,i.mainDetails=null,i.flushing=!1,i.bufferFlushed=!1,i.cachedTrackLoadedData=null,i._registerListeners(),i}l(e,t);var r=e.prototype;return r.onHandlerDestroying=function(){this._unregisterListeners(),t.prototype.onHandlerDestroying.call(this),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null},r._registerListeners=function(){var t=this.hls;t.on(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.LEVEL_LOADED,this.onLevelLoaded,this),t.on(b.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(b.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(b.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(b.ERROR,this.onError,this),t.on(b.BUFFER_RESET,this.onBufferReset,this),t.on(b.BUFFER_CREATED,this.onBufferCreated,this),t.on(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(b.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(b.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(b.FRAG_BUFFERED,this.onFragBuffered,this)},r._unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.LEVEL_LOADED,this.onLevelLoaded,this),t.off(b.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(b.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(b.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(b.ERROR,this.onError,this),t.off(b.BUFFER_RESET,this.onBufferReset,this),t.off(b.BUFFER_CREATED,this.onBufferCreated,this),t.off(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(b.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(b.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(b.FRAG_BUFFERED,this.onFragBuffered,this)},r.onInitPtsFound=function(t,e){var r=e.frag,n=e.id,i=e.initPTS,s=e.timescale;if("main"===n){var a=r.cc;this.initPTS[r.cc]={baseTime:i,timescale:s},this.log("InitPTS for cc: "+a+" found from main: "+i),this.videoTrackCC=a,this.state===In&&this.tick()}},r.startLoad=function(t){if(!this.levels)return this.startPosition=t,void(this.state=Sn);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=bn):(this.loadedmetadata=!1,this.state=Ln),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},r.doTick=function(){switch(this.state){case bn:this.doTickIdle();break;case Ln:var e,r=this.levels,n=this.trackId,i=null==r||null==(e=r[n])?void 0:e.details;if(i){if(this.waitForCdnTuneIn(i))break;this.state=In}break;case An:var s,a=performance.now(),o=this.retryDate;if(!o||a>=o||null!=(s=this.media)&&s.seeking){var l=this.levels,u=this.trackId;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==l?void 0:l[u])||null),this.state=bn}break;case In:var c=this.waitingData;if(c){var h=c.frag,d=c.part,f=c.cache,p=c.complete;if(void 0!==this.initPTS[h.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=_n;var g={frag:h,part:d,payload:f.flush(),networkDetails:null};this._handleFragmentLoadProgress(g),p&&t.prototype._handleFragmentLoadComplete.call(this,g)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+h.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var v=this.getLoadPosition(),m=rn.bufferInfo(this.mediaBuffer,v,this.config.maxBufferHole);Ar(m.end,this.config.maxFragLookUpTolerance,h)<0&&(this.log("Waiting fragment cc ("+h.cc+") @ "+h.start+" cancelled because another fragment at "+m.end+" is needed"),this.clearWaitingFragment())}}else this.state=bn}this.onTickEnd()},r.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=bn)},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,n=this.trackId,i=t.config;if((r||!this.startFragRequested&&i.startFragPrefetch)&&null!=e&&e[n]){var s=e[n],a=s.details;if(!a||a.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(a))this.state=Ln;else{var o=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&o&&(this.bufferFlushed=!1,this.afterBufferFlushed(o,F,Me));var l=this.getFwdBufferInfo(o,Me);if(null!==l){var u=this.bufferedTrack,c=this.switchingTrack;if(!c&&this._streamEnded(l,a))return t.trigger(b.BUFFER_EOS,{type:"audio"}),void(this.state=kn);var h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,xe),d=l.len,f=this.getMaxBufferLength(null==h?void 0:h.len),p=a.fragments,g=p[0].start,v=this.flushing?this.getLoadPosition():l.end;if(c&&r){var m=this.getLoadPosition();u&&!zi(c.attrs,u.attrs)&&(v=m),a.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)}if(!(d>=f&&!c&&v<p[p.length-1].start)){var y=this.getNextFragment(v,a),E=!1;if(y&&this.isLoopLoading(y,v)&&(E=!!y.gap,y=this.getNextFragmentLoopLoading(y,a,l,xe,f)),y){var S=h&&y.start>h.end+a.targetduration;if(S||(null==h||!h.len)&&l.len){var T=this.getAppendedFrag(y.start,xe);if(null===T)return;if(E||(E=!!T.gap||!!S&&0===h.len),S&&!E||E&&l.nextStart&&l.nextStart<T.end)return}this.loadFragment(y,s,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,this.bufferFlushed=this.flushing=!1,t.prototype.onMediaDetaching.call(this)},r.onAudioTracksUpdated=function(t,e){var r=e.audioTracks;this.resetTransmuxer(),this.levels=r.map((function(t){return new or(t)}))},r.onAudioTrackSwitching=function(t,e){var r=!!e.url;this.trackId=e.id;var n=this.fragCurrent;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=e,this.state=bn,this.flushAudioIfNeeded(e)):(this.switchingTrack=null,this.bufferedTrack=e,this.state=Sn),this.tick()},r.onManifestLoading=function(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1},r.onLevelLoaded=function(t,e){this.mainDetails=e.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(b.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},r.onAudioTrackLoaded=function(t,e){var r;if(null!=this.mainDetails){var n=this.levels,i=e.details,s=e.id;if(n){this.log("Audio track "+s+" loaded ["+i.startSN+","+i.endSN+"]"+(i.lastPartSn?"[part-"+i.lastPartSn+"-"+i.lastPartIndex+"]":"")+",duration:"+i.totalduration);var a=n[s],o=0;if(i.live||null!=(r=a.details)&&r.live){this.checkLiveUpdate(i);var l,u=this.mainDetails;if(i.deltaUpdateFailed||!u)return;!a.details&&i.hasProgramDateTime&&u.hasProgramDateTime?(un(i,u),o=i.fragments[0].start):o=this.alignPlaylists(i,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=i,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&i.live||this.setStartPosition(this.mainDetails||i,o),this.state!==Ln||this.waitForCdnTuneIn(i)||(this.state=bn),this.tick()}else this.warn("Audio tracks were reset while loading level "+s)}else this.cachedTrackLoadedData=e},r._handleFragmentLoadProgress=function(t){var e,r=t.frag,n=t.part,i=t.payload,s=this.config,a=this.trackId,o=this.levels;if(o){var l=o[a];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 c=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2",h=this.transmuxer;h||(h=this.transmuxer=new qi(this.hls,Me,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var d=this.initPTS[r.cc],f=null==(e=r.initSegment)?void 0:e.data;if(void 0!==d){var p=n?n.index:-1,g=-1!==p,v=new nn(r.level,r.sn,r.stats.chunkCount,i.byteLength,p,g);h.push(i,f,c,"",r,n,u.totalduration,!1,v,d)}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 "+a),(this.waitingData=this.waitingData||{frag:r,part:n,cache:new Cn,complete:!1}).cache.push(new Uint8Array(i)),this.waitingVideoCC=this.videoTrackCC,this.state=In}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=e.frag,i=e.part;if(r.type===Me)if(this.fragContextChanged(r))this.warn("Fragment "+r.sn+(i?" p: "+i.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+(this.switchingTrack?this.switchingTrack.name:"false"));else{if("initSegment"!==r.sn){this.fragPrevious=r;var s=this.switchingTrack;s&&(this.bufferedTrack=s,this.switchingTrack=null,this.hls.trigger(b.AUDIO_TRACK_SWITCHED,n({},s)))}this.fragBufferedComplete(r,i)}else if(!this.loadedmetadata&&r.type===xe){var a=this.videoBuffer||this.media;a&&rn.getBuffered(a).length&&(this.loadedmetadata=!0)}},r.onError=function(e,r){var n;if(r.fatal)this.state=Dn;else switch(r.details){case _.FRAG_GAP:case _.FRAG_PARSING_ERROR:case _.FRAG_DECRYPT_ERROR:case _.FRAG_LOAD_ERROR:case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_ERROR:case _.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Me,r);break;case _.AUDIO_TRACK_LOAD_ERROR:case _.AUDIO_TRACK_LOAD_TIMEOUT:case _.LEVEL_PARSING_ERROR:r.levelRetry||this.state!==Ln||(null==(n=r.context)?void 0:n.type)!==Oe||(this.state=bn);break;case _.BUFFER_APPEND_ERROR:case _.BUFFER_FULL_ERROR:if(!r.parent||"audio"!==r.parent)return;if(r.details===_.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(r)&&(this.bufferedTrack=null,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"));break;case _.INTERNAL_EXCEPTION:this.recoverWorkerError(r)}},r.onBufferFlushing=function(t,e){e.type!==N&&(this.flushing=!0)},r.onBufferFlushed=function(t,e){var r=e.type;if(r!==N){this.flushing=!1,this.bufferFlushed=!0,this.state===kn&&(this.state=bn);var n=this.mediaBuffer||this.media;n&&(this.afterBufferFlushed(n,r,Me),this.tick())}},r._handleTransmuxComplete=function(t){var e,r="audio",n=this.hls,i=t.remuxResult,s=t.chunkMeta,a=this.getCurrentContext(s);if(a){var l=a.frag,u=a.part,c=a.level,h=c.details,d=i.audio,f=i.text,p=i.id3,g=i.initSegment;if(!this.fragContextChanged(l)&&h){if(this.state=wn,this.switchingTrack&&d&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){var v=l.initSegment||l;this._bufferInitSegment(c,g.tracks,v,s),n.trigger(b.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:g.tracks})}if(d){var m=d.startPTS,y=d.endPTS,E=d.startDTS,S=d.endDTS;u&&(u.elementaryStreams[F]={startPTS:m,endPTS:y,startDTS:E,endDTS:S}),l.setElementaryStreamInfo(F,m,y,E,S),this.bufferFragmentData(d,l,u,s)}if(null!=p&&null!=(e=p.samples)&&e.length){var T=o({id:r,frag:l,details:h},p);n.trigger(b.FRAG_PARSING_METADATA,T)}if(f){var _=o({id:r,frag:l,details:h},f);n.trigger(b.FRAG_PARSING_USERDATA,_)}}else this.fragmentTracker.removeFragment(l)}else this.resetWhenMissingContext(s)},r._bufferInitSegment=function(t,e,r,n){if(this.state===wn){e.video&&delete e.video;var i=e.audio;if(i){i.id="audio";var s=t.audioCodec;this.log("Init audio buffer, container:"+i.container+", codecs[level/parsed]=["+s+"/"+i.codec+"]"),s&&1===s.split(",").length&&(i.levelCodec=s),this.hls.trigger(b.BUFFER_CODECS,e);var a=i.initSegment;if(null!=a&&a.byteLength){var o={type:"audio",frag:r,part:null,chunkMeta:n,parent:r.type,data:a};this.hls.trigger(b.BUFFER_APPENDING,o)}this.tickImmediate()}}},r.loadFragment=function(e,r,n){var i,s=this.fragmentTracker.getState(e);if(this.fragCurrent=e,this.switchingTrack||s===Yr||s===Xr)if("initSegment"===e.sn)this._loadInitSegment(e,r);else if(null!=(i=r.details)&&i.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=In;var a=this.mainDetails;a&&a.fragments[0].start!==r.details.fragments[0].start&&un(r.details,a)}else this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,n);else this.clearTrackerIfNeeded(e)},r.flushAudioIfNeeded=function(e){var r=this.media,n=this.bufferedTrack,i=null==n?void 0:n.attrs,s=e.attrs;r&&i&&(i.CHANNELS!==s.CHANNELS||n.name!==e.name||n.lang!==e.lang)&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)},r.completeAudioSwitch=function(t){var e=this.hls;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,e.trigger(b.AUDIO_TRACK_SWITCHED,n({},t))},e}(On),Qi=function(t){function e(e){var r;return(r=t.call(this,e,"[audio-track-controller]")||this).tracks=[],r.groupIds=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(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_PARSED,this.onManifestParsed,this),t.on(b.LEVEL_LOADING,this.onLevelLoading,this),t.on(b.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(b.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(b.ERROR,this.onError,this)},r.unregisterListeners=function(){var t=this.hls;t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_PARSED,this.onManifestParsed,this),t.off(b.LEVEL_LOADING,this.onLevelLoading,this),t.off(b.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(b.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(b.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.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0},r.onManifestParsed=function(t,e){this.tracks=e.audioTracks||[]},r.onAudioTrackLoaded=function(t,e){var r=e.id,n=e.groupId,i=e.details,s=this.tracksInGroup[r];if(s&&s.groupId===n){var a=s.details;s.details=e.details,this.log("Audio track "+r+' "'+s.name+'" lang:'+s.lang+" group:"+n+" loaded ["+i.startSN+"-"+i.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,e,a)}else this.warn("Audio track with id:"+r+" and group:"+n+" not found in active group "+(null==s?void 0:s.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(e){var r=e.audioGroups||null,n=this.groupIds,i=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&r.some((function(t){return-1===(null==n?void 0:n.indexOf(t))}))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;var s=this.tracks.filter((function(t){return!r||-1!==r.indexOf(t.groupId)}));if(s.length)this.selectDefaultTrack&&!s.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),s.forEach((function(t,e){t.id=e}));else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=s;var a=this.hls.config.audioPreference;if(!i&&a){var o=Gr(a,s,Kr);if(o>-1)i=s[o];else{var l=Gr(a,this.tracks);i=this.tracks[l]}}var u=this.findTrackId(i);-1===u&&i&&(u=this.findTrackId(null));var c={audioTracks:s};this.log("Updating audio tracks, "+s.length+" track(s) found in group(s): "+(null==r?void 0:r.join(","))),this.hls.trigger(b.AUDIO_TRACKS_UPDATED,c);var h=this.trackId;if(-1!==u&&-1===h)this.setAudioTrack(u);else if(s.length&&-1===h){var d,f=new Error("No audio track selected for current audio group-ID(s): "+(null==(d=this.groupIds)?void 0:d.join(","))+" track count: "+s.length);this.warn(f.message),this.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:f})}}else this.shouldReloadPlaylist(i)&&this.setAudioTrack(this.trackId)}},r.onError=function(t,e){!e.fatal&&e.context&&(e.context.type!==Oe||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||(this.requestScheduled=-1,this.checkRetry(e)))},r.setAudioOption=function(t){var e=this.hls;if(e.config.audioPreference=t,t){var r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){var n=this.currentTrack;if(n&&Vr(t,n,Kr))return n;var i=Gr(t,this.tracksInGroup,Kr);if(i>-1){var s=this.tracksInGroup[i];return this.setAudioTrack(i),s}if(n){var a=e.loadLevel;-1===a&&(a=e.firstAutoLevel);var o=function(t,e,r,n,i){var s=e[n],a=e.reduce((function(t,e,r){var n=e.uri;return(t[n]||(t[n]=[])).push(r),t}),{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));var o=s.videoRange,l=s.frameRate,u=s.codecSet.substring(0,4),c=$r(e,n,(function(e){if(e.videoRange!==o||e.frameRate!==l||e.codecSet.substring(0,4)!==u)return!1;var n=e.audioGroups,s=r.filter((function(t){return!n||-1!==n.indexOf(t.groupId)}));return Gr(t,s,i)>-1}));return c>-1?c:$r(e,n,(function(e){var n=e.audioGroups,s=r.filter((function(t){return!n||-1!==n.indexOf(t.groupId)}));return Gr(t,s,i)>-1}))}(t,e.levels,r,a,Kr);if(-1===o)return null;e.nextLoadLevel=o}if(t.channels||t.audioCodec){var l=Gr(t,r);if(l>-1)return r[l]}}}return null},r.setAudioTrack=function(t){var e=this.tracksInGroup;if(t<0||t>=e.length)this.warn("Invalid audio track id: "+t);else{this.clearTimer(),this.selectDefaultTrack=!1;var r=this.currentTrack,i=e[t],s=i.details&&!i.details.live;if(!(t===this.trackId&&i===r&&s||(this.log("Switching to audio-track "+t+' "'+i.name+'" lang:'+i.lang+" group:"+i.groupId+" channels:"+i.channels),this.trackId=t,this.currentTrack=i,this.hls.trigger(b.AUDIO_TRACK_SWITCHING,n({},i)),s))){var a=this.switchParams(i.url,null==r?void 0:r.details,i.details);this.loadPlaylist(a)}}},r.findTrackId=function(t){for(var e=this.tracksInGroup,r=0;r<e.length;r++){var n=e[r];if((!this.selectDefaultTrack||n.default)&&(!t||Vr(t,n,Kr)))return r}if(t){for(var i=t.name,s=t.lang,a=t.assocLang,o=t.characteristics,l=t.audioCodec,u=t.channels,c=0;c<e.length;c++)if(Vr({name:i,lang:s,assocLang:a,characteristics:o,audioCodec:l,channels:u},e[c],Kr))return c;for(var h=0;h<e.length;h++){var d=e[h];if(zi(t.attrs,d.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return h}for(var f=0;f<e.length;f++){var p=e[f];if(zi(t.attrs,p.attrs,["LANGUAGE"]))return f}}return-1},r.loadPlaylist=function(e){var r=this.currentTrack;if(this.shouldLoadPlaylist(r)&&r){t.prototype.loadPlaylist.call(this);var n=r.id,i=r.groupId,s=r.url;if(e)try{s=e.addDirectives(s)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("loading audio-track playlist "+n+' "'+r.name+'" lang:'+r.lang+" group:"+i),this.clearTimer(),this.hls.trigger(b.AUDIO_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}},a(e,[{key:"allAudioTracks",get:function(){return this.tracks}},{key:"audioTracks",get:function(){return this.tracksInGroup}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}}]),e}(xr),Zi=function(t){function e(e,r,n){var i;return(i=t.call(this,e,r,n,"[subtitle-stream-controller]",Fe)||this).currentTrackId=-1,i.tracksBuffered=[],i.mainDetails=null,i._registerListeners(),i}l(e,t);var r=e.prototype;return r.onHandlerDestroying=function(){this._unregisterListeners(),t.prototype.onHandlerDestroying.call(this),this.mainDetails=null},r._registerListeners=function(){var t=this.hls;t.on(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.LEVEL_LOADED,this.onLevelLoaded,this),t.on(b.ERROR,this.onError,this),t.on(b.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(b.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(b.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(b.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(b.FRAG_BUFFERED,this.onFragBuffered,this)},r._unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.LEVEL_LOADED,this.onLevelLoaded,this),t.off(b.ERROR,this.onError,this),t.off(b.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(b.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(b.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(b.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(b.FRAG_BUFFERED,this.onFragBuffered,this)},r.startLoad=function(t){this.stopLoad(),this.state=bn,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,n=e.success;if(this.fragPrevious=r,this.state=bn,n){var i=this.tracksBuffered[this.currentTrackId];if(i){for(var s,a=r.start,o=0;o<i.length;o++)if(a>=i[o].start&&a<=i[o].end){s=i[o];break}var l=r.start+r.duration;s?s.end=l:(s={start:a,end:l},i.push(s)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}}},r.onBufferFlushing=function(t,e){var r=e.startOffset,n=e.endOffset;if(0===r&&n!==Number.POSITIVE_INFINITY){var i=n-1;if(i<=0)return;e.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach((function(t){for(var e=0;e<t.length;)if(t[e].end<=i)t.shift();else{if(!(t[e].start<i))break;t[e].start=i,e++}})),this.fragmentTracker.removeFragmentsInRange(r,i,Fe)}},r.onFragBuffered=function(t,e){var r;this.loadedmetadata||e.frag.type!==xe||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)===Fe&&(e.details===_.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Sn&&(this.state=bn))},r.onSubtitleTracksUpdated=function(t,e){var r=this,n=e.subtitleTracks;this.levels&&Yi(this.levels,n)?this.levels=n.map((function(t){return new or(t)})):(this.tracksBuffered=[],this.levels=n.map((function(t){var e=new or(t);return r.tracksBuffered[e.id]=[],e})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Fe),this.fragPrevious=null,this.mediaBuffer=null)},r.onSubtitleTrackSwitch=function(t,e){var r;if(this.currentTrackId=e.id,null!=(r=this.levels)&&r.length&&-1!==this.currentTrackId){var n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(500)}else this.clearInterval()},r.onSubtitleTrackLoaded=function(t,e){var r,n=this.currentTrackId,i=this.levels,s=e.details,a=e.id;if(i){var o=i[a];if(!(a>=i.length)&&o){this.log("Subtitle track "+a+" loaded ["+s.startSN+","+s.endSN+"]"+(s.lastPartSn?"[part-"+s.lastPartSn+"-"+s.lastPartIndex+"]":"")+",duration:"+s.totalduration),this.mediaBuffer=this.mediaBufferTimeRanges;var l=0;if(s.live||null!=(r=o.details)&&r.live){var u=this.mainDetails;if(s.deltaUpdateFailed||!u)return;var c,h=u.fragments[0];o.details?0===(l=this.alignPlaylists(s,o.details,null==(c=this.levelLastLoaded)?void 0:c.details))&&h&&fr(s,l=h.start):s.hasProgramDateTime&&u.hasProgramDateTime?(un(s,u),l=s.fragments[0].start):h&&fr(s,l=h.start)}o.details=s,this.levelLastLoaded=o,a===n&&(this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(this.mainDetails||s,l),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===bn&&(_r(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0)))}}else this.warn("Subtitle tracks were reset while loading level "+a)},r._handleFragmentLoadComplete=function(t){var e=this,r=t.frag,n=t.payload,i=r.decryptdata,s=this.hls;if(!this.fragContextChanged(r)&&n&&n.byteLength>0&&null!=i&&i.key&&i.iv&&"AES-128"===i.method){var a=performance.now();this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch((function(t){throw s.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:r}),t})).then((function(t){var e=performance.now();s.trigger(b.FRAG_DECRYPTED,{frag:r,payload:t,stats:{tstart:a,tdecrypt:e}})})).catch((function(t){e.warn(t.name+": "+t.message),e.state=bn}))}},r.doTick=function(){if(this.media){if(this.state===bn){var t=this.currentTrackId,e=this.levels,r=null==e?void 0:e[t];if(!r||!e.length||!r.details)return;var n=this.config,i=this.getLoadPosition(),s=rn.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,n.maxBufferHole),a=s.end,o=s.len,l=this.getFwdBufferInfo(this.media,xe),u=r.details;if(o>this.getMaxBufferLength(null==l?void 0:l.len)+u.levelTargetDuration)return;var c=u.fragments,h=c.length,d=u.edge,f=null,p=this.fragPrevious;if(a<d){var g=n.maxFragLookUpTolerance,v=a>d-g?0:g;!(f=_r(p,c,Math.max(c[0].start,a),v))&&p&&p.start<c[0].start&&(f=c[0])}else f=c[h-1];if(!f)return;if("initSegment"!==(f=this.mapToInitFragWhenRequired(f)).sn){var m=c[f.sn-u.startSN-1];m&&m.cc===f.cc&&this.fragmentTracker.getState(m)===Yr&&(f=m)}this.fragmentTracker.getState(f)===Yr&&this.loadFragment(f,r,a)}}else this.state=bn},r.getMaxBufferLength=function(e){var r=t.prototype.getMaxBufferLength.call(this);return e?Math.max(r,e):r},r.loadFragment=function(e,r,n){this.fragCurrent=e,"initSegment"===e.sn?this._loadInitSegment(e,r):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,r,n))},a(e,[{key:"mediaBufferTimeRanges",get:function(){return new ts(this.tracksBuffered[this.currentTrackId]||[])}}]),e}(On),ts=function(t){this.buffered=void 0;var e=function(e,r,n){if((r>>>=0)>n-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+r+") is greater than the maximum bound ("+n+")");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)}}},es=function(t){function e(e){var r;return(r=t.call(this,e,"[subtitle-track-controller]")||this).media=null,r.tracks=[],r.groupIds=null,r.tracksInGroup=[],r.trackId=-1,r.currentTrack=null,r.selectDefaultTrack=!0,r.queuedDefaultTrack=-1,r.asyncPollTrackChange=function(){return r.pollTrackChange(0)},r.useTextTrackPolling=!1,r.subtitlePollingInterval=-1,r._subtitleDisplay=!0,r.onTextTracksChanged=function(){if(r.useTextTrackPolling||self.clearInterval(r.subtitlePollingInterval),r.media&&r.hls.config.renderTextTracksNatively){for(var t=null,e=Ke(r.media.textTracks),n=0;n<e.length;n++)if("hidden"===e[n].mode)t=e[n];else if("showing"===e[n].mode){t=e[n];break}var i=r.findTrackForTextTrack(t);r.subtitleTrack!==i&&r.setSubtitleTrack(i)}},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.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,t.prototype.destroy.call(this)},r.registerListeners=function(){var t=this.hls;t.on(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_PARSED,this.onManifestParsed,this),t.on(b.LEVEL_LOADING,this.onLevelLoading,this),t.on(b.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(b.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(b.ERROR,this.onError,this)},r.unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_PARSED,this.onManifestParsed,this),t.off(b.LEVEL_LOADING,this.onLevelLoading,this),t.off(b.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(b.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(b.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.onTextTracksChanged,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),Ke(this.media.textTracks).forEach((function(t){Ge(t)})),this.subtitleTrack=-1,this.media=null)},r.onManifestLoading=function(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0},r.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},r.onSubtitleTrackLoaded=function(t,e){var r=e.id,n=e.groupId,i=e.details,s=this.tracksInGroup[r];if(s&&s.groupId===n){var a=s.details;s.details=e.details,this.log("Subtitle track "+r+' "'+s.name+'" lang:'+s.lang+" group:"+n+" loaded ["+i.startSN+"-"+i.endSN+"]"),r===this.trackId&&this.playlistLoaded(r,e,a)}else this.warn("Subtitle track with id:"+r+" and group:"+n+" not found in active group "+(null==s?void 0:s.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(e){var r=e.subtitleGroups||null,n=this.groupIds,i=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&r.some((function(t){return-1===(null==n?void 0:n.indexOf(t))}))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;var s=this.tracks.filter((function(t){return!r||-1!==r.indexOf(t.groupId)}));if(s.length)this.selectDefaultTrack&&!s.some((function(t){return t.default}))&&(this.selectDefaultTrack=!1),s.forEach((function(t,e){t.id=e}));else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=s;var a=this.hls.config.subtitlePreference;if(!i&&a){this.selectDefaultTrack=!1;var o=Gr(a,s);if(o>-1)i=s[o];else{var l=Gr(a,this.tracks);i=this.tracks[l]}}var u=this.findTrackId(i);-1===u&&i&&(u=this.findTrackId(null));var c={subtitleTracks:s};this.log("Updating subtitle tracks, "+s.length+' track(s) found in "'+(null==r?void 0:r.join(","))+'" group-id'),this.hls.trigger(b.SUBTITLE_TRACKS_UPDATED,c),-1!==u&&-1===this.trackId&&this.setSubtitleTrack(u)}else this.shouldReloadPlaylist(i)&&this.setSubtitleTrack(this.trackId)}},r.findTrackId=function(t){for(var e=this.tracksInGroup,r=this.selectDefaultTrack,n=0;n<e.length;n++){var i=e[n];if((!r||i.default)&&(r||t)&&(!t||Vr(i,t)))return n}if(t){for(var s=0;s<e.length;s++){var a=e[s];if(zi(t.attrs,a.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(var o=0;o<e.length;o++){var l=e[o];if(zi(t.attrs,l.attrs,["LANGUAGE"]))return o}}return-1},r.findTrackForTextTrack=function(t){if(t)for(var e=this.tracksInGroup,r=0;r<e.length;r++)if(Xi(e[r],t))return r;return-1},r.onError=function(t,e){!e.fatal&&e.context&&(e.context.type!==Ce||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))},r.setSubtitleOption=function(t){if(this.hls.config.subtitlePreference=t,t){var e=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,e.length){var r=this.currentTrack;if(r&&Vr(t,r))return r;var n=Gr(t,this.tracksInGroup);if(n>-1){var i=this.tracksInGroup[n];return this.setSubtitleTrack(n),i}if(r)return null;var s=Gr(t,e);if(s>-1)return e[s]}}return null},r.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.currentTrack;if(this.shouldLoadPlaylist(r)&&r){var n=r.id,i=r.groupId,s=r.url;if(e)try{s=e.addDirectives(s)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Loading subtitle playlist for id "+n),this.hls.trigger(b.SUBTITLE_TRACK_LOADING,{url:s,id:n,groupId:i,deliveryDirectives:e||null})}},r.toggleTrackModes=function(){var t=this.media;if(t){var e,r=Ke(t.textTracks),n=this.currentTrack;if(n&&((e=r.filter((function(t){return Xi(n,t)}))[0])||this.warn('Unable to find subtitle TextTrack with name "'+n.name+'" and language "'+n.lang+'"')),[].slice.call(r).forEach((function(t){"disabled"!==t.mode&&t!==e&&(t.mode="disabled")})),e){var i=this.subtitleDisplay?"showing":"hidden";e.mode!==i&&(e.mode=i)}}},r.setSubtitleTrack=function(t){var e=this.tracksInGroup;if(this.media)if(t<-1||t>=e.length||!y(t))this.warn("Invalid subtitle track id: "+t);else{this.clearTimer(),this.selectDefaultTrack=!1;var r=this.currentTrack,n=e[t]||null;if(this.trackId=t,this.currentTrack=n,this.toggleTrackModes(),n){var i=!!n.details&&!n.details.live;if(t!==this.trackId||n!==r||!i){this.log("Switching to subtitle-track "+t+(n?' "'+n.name+'" lang:'+n.lang+" group:"+n.groupId:""));var s=n.id,a=n.groupId,o=void 0===a?"":a,l=n.name,u=n.type,c=n.url;this.hls.trigger(b.SUBTITLE_TRACK_SWITCH,{id:s,groupId:o,name:l,type:u,url:c});var h=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(h)}}else this.hls.trigger(b.SUBTITLE_TRACK_SWITCH,{id:t})}else this.queuedDefaultTrack=t},a(e,[{key:"subtitleDisplay",get:function(){return this._subtitleDisplay},set:function(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}},{key:"allSubtitleTracks",get:function(){return this.tracks}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}}]),e}(xr),rs=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,r){var n=this.queues[e];n.push(t),1!==n.length||r||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})),n={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(n,t),r},e.executeNext=function(t){var e=this.queues[t];if(e.length){var r=e[0];try{r.execute()}catch(e){D.warn('[buffer-operation-queue]: Exception executing "'+t+'" SourceBuffer operation: '+e),r.onError(e);var n=this.buffers[t];null!=n&&n.updating||this.shiftAndExecuteNext(t)}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}(),ns=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,is=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.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=function(t){e.hls&&e.hls.pauseBuffering()},this._onStartStreaming=function(t){e.hls&&e.hls.resumeBuffering()},this._onMediaSourceOpen=function(){var t=e.media,r=e.mediaSource;e.log("Media source opened"),t&&(t.removeEventListener("emptied",e._onMediaEmptied),e.updateMediaElementDuration(),e.hls.trigger(b.MEDIA_ATTACHED,{media:t,mediaSource:r})),r&&r.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){e.log("Media source closed")},this._onMediaSourceEnded=function(){e.log("Media source ended")},this._onMediaEmptied=function(){var t=e.mediaSrc,r=e._objectUrl;t!==r&&D.error("Media element src was set while attaching MediaSource ("+r+" > "+t+")")},this.hls=t;var r,n="[buffer-controller]";this.appendSource=(r=ae(t.config.preferManagedMediaSource),"undefined"!=typeof self&&r===self.ManagedMediaSource),this.log=D.log.bind(D,n),this.warn=D.warn.bind(D,n),this.error=D.error.bind(D,n),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,this.hls=null},e.registerListeners=function(){var t=this.hls;t.on(b.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_PARSED,this.onManifestParsed,this),t.on(b.BUFFER_RESET,this.onBufferReset,this),t.on(b.BUFFER_APPENDING,this.onBufferAppending,this),t.on(b.BUFFER_CODECS,this.onBufferCodecs,this),t.on(b.BUFFER_EOS,this.onBufferEos,this),t.on(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(b.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(b.FRAG_PARSED,this.onFragParsed,this),t.on(b.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_PARSED,this.onManifestParsed,this),t.off(b.BUFFER_RESET,this.onBufferReset,this),t.off(b.BUFFER_APPENDING,this.onBufferAppending,this),t.off(b.BUFFER_CODECS,this.onBufferCodecs,this),t.off(b.BUFFER_EOS,this.onBufferEos,this),t.off(b.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(b.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(b.FRAG_PARSED,this.onFragParsed,this),t.off(b.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new rs(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},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,this.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var r=this.media=e.media,n=ae(this.appendSource);if(r&&n){var i,s=this.mediaSource=new n;this.log("created media source: "+(null==(i=s.constructor)?void 0:i.name)),s.addEventListener("sourceopen",this._onMediaSourceOpen),s.addEventListener("sourceended",this._onMediaSourceEnded),s.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(s.addEventListener("startstreaming",this._onStartStreaming),s.addEventListener("endstreaming",this._onEndStreaming));var a=this._objectUrl=self.URL.createObjectURL(s);if(this.appendSource)try{r.removeAttribute("src");var o=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||o&&s instanceof o,ss(r),function(t,e){var r=self.document.createElement("source");r.type="video/mp4",r.src=e,t.appendChild(r)}(r,a),r.load()}catch(t){r.src=a}else r.src=a;r.addEventListener("emptied",this._onMediaEmptied)}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,r=this._objectUrl;if(e){if(this.log("media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){this.warn("onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.removeEventListener("startstreaming",this._onStartStreaming),e.removeEventListener("endstreaming",this._onEndStreaming)),t&&(t.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(t.removeAttribute("src"),this.appendSource&&ss(t),t.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(b.MEDIA_DETACHED,void 0)},e.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){t.resetBuffer(e)})),this._initSourceBuffer()},e.resetBuffer=function(t){var e=this.sourceBuffer[t];try{var r;e&&(this.removeBufferListeners(t),this.sourceBuffer[t]=void 0,null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(e))}catch(e){this.warn("onBufferReset "+t,e)}},e.onBufferCodecs=function(t,e){var r=this,n=this.getSourceBufferTypes().length,i=Object.keys(e);if(i.forEach((function(t){if(n){var i=r.tracks[t];if(i&&"function"==typeof i.buffer.changeType){var s,a=e[t],o=a.id,l=a.codec,u=a.levelCodec,c=a.container,h=a.metadata,d=ve(i.codec,i.levelCodec),f=null==d?void 0:d.replace(ns,"$1"),p=ve(l,u),g=null==(s=p)?void 0:s.replace(ns,"$1");if(p&&f!==g){"audio"===t.slice(0,5)&&(p=ge(p,r.appendSource));var v=c+";codecs="+p;r.appendChangeType(t,v),r.log("switching codec "+d+" to "+p),r.tracks[t]={buffer:i.buffer,codec:l,container:c,levelCodec:u,metadata:h,id:o}}}}else r.pendingTracks[t]=e[t]})),!n){var s=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==s&&(this.log(s+" bufferCodec event(s) expected "+i.join(",")),this.bufferCodecEventsExpected=s),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}},e.appendChangeType=function(t,e){var r=this,n=this.operationQueue,i={execute:function(){var i=r.sourceBuffer[t];i&&(r.log("changing "+t+" sourceBuffer type to "+e),i.changeType(e)),n.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){r.warn("Failed to change "+t+" SourceBuffer type",e)}};n.append(i,t,!!this.pendingTracks[t])},e.onBufferAppending=function(t,e){var r=this,n=this.hls,i=this.operationQueue,s=this.tracks,a=e.data,o=e.type,l=e.frag,u=e.part,c=e.chunkMeta,h=c.buffering[o],d=self.performance.now();h.start=d;var f=l.stats.buffering,p=u?u.stats.buffering:null;0===f.start&&(f.start=d),p&&0===p.start&&(p.start=d);var g=s.audio,v=!1;"audio"===o&&"audio/mpeg"===(null==g?void 0:g.container)&&(v=!this.lastMpegAudioChunk||1===c.id||this.lastMpegAudioChunk.sn!==c.sn,this.lastMpegAudioChunk=c);var m=l.start,y={execute:function(){if(h.executeStart=self.performance.now(),v){var t=r.sourceBuffer[o];if(t){var e=m-t.timestampOffset;Math.abs(e)>=.1&&(r.log("Updating audio SourceBuffer timestampOffset to "+m+" (delta: "+e+") sn: "+l.sn+")"),t.timestampOffset=m)}}r.appendExecutor(a,o)},onStart:function(){},onComplete:function(){var t=self.performance.now();h.executeEnd=h.end=t,0===f.first&&(f.first=t),p&&0===p.first&&(p.first=t);var e=r.sourceBuffer,n={};for(var i in e)n[i]=rn.getBuffered(e[i]);r.appendErrors[o]=0,"audio"===o||"video"===o?r.appendErrors.audiovideo=0:(r.appendErrors.audio=0,r.appendErrors.video=0),r.hls.trigger(b.BUFFER_APPENDED,{type:o,frag:l,part:u,chunkMeta:c,parent:l.type,timeRanges:n})},onError:function(t){var e={type:T.MEDIA_ERROR,parent:l.type,details:_.BUFFER_APPEND_ERROR,sourceBufferName:o,frag:l,part:u,chunkMeta:c,error:t,err:t,fatal:!1};if(t.code===DOMException.QUOTA_EXCEEDED_ERR)e.details=_.BUFFER_FULL_ERROR;else{var i=++r.appendErrors[o];e.details=_.BUFFER_APPEND_ERROR,r.warn("Failed "+i+"/"+n.config.appendErrorMaxRetry+' times to append segment in "'+o+'" sourceBuffer'),i>=n.config.appendErrorMaxRetry&&(e.fatal=!0)}n.trigger(b.ERROR,e)}};i.append(y,o,!!this.pendingTracks[o])},e.onBufferFlushing=function(t,e){var r=this,n=this.operationQueue,i=function(t){return{execute:r.removeExecutor.bind(r,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){r.hls.trigger(b.BUFFER_FLUSHED,{type:t})},onError:function(e){r.warn("Failed to remove from "+t+" SourceBuffer",e)}}};e.type?n.append(i(e.type),e.type):this.getSourceBufferTypes().forEach((function(t){n.append(i(t),t)}))},e.onFragParsed=function(t,e){var r=this,n=e.frag,i=e.part,s=[],a=i?i.elementaryStreams:n.elementaryStreams;a[B]?s.push("audiovideo"):(a[F]&&s.push("audio"),a[N]&&s.push("video"));0===s.length&&this.warn("Fragments must have at least one ElementaryStreamType set. type: "+n.type+" level: "+n.level+" sn: "+n.sn),this.blockBuffers((function(){var t=self.performance.now();n.stats.buffering.end=t,i&&(i.stats.buffering.end=t);var e=i?i.stats:n.stats;r.hls.trigger(b.FRAG_BUFFERED,{frag:n,part:i,stats:e,id:n.type})}),s)},e.onFragChanged=function(t,e){this.trimBuffers()},e.onBufferEos=function(t,e){var r=this;this.getSourceBufferTypes().reduce((function(t,n){var i=r.sourceBuffer[n];return!i||e.type&&e.type!==n||(i.ending=!0,i.ended||(i.ended=!0,r.log(n+" sourceBuffer now EOS"))),t&&!(i&&!i.ended)}),!0)&&(this.log("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?(r.log("Calling mediaSource.endOfStream()"),t.endOfStream()):t&&r.log("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.trimBuffers=function(){var t=this.hls,e=this.details,r=this.media;if(r&&null!==e&&this.getSourceBufferTypes().length){var n=t.config,i=r.currentTime,s=e.levelTargetDuration,a=e.live&&null!==n.liveBackBufferLength?n.liveBackBufferLength:n.backBufferLength;if(y(a)&&a>0){var o=Math.max(a,s),l=Math.floor(i/s)*s-o;this.flushBackBuffer(i,s,l)}if(y(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){var u=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),c=Math.max(u,s),h=Math.floor(i/s)*s+c;this.flushFrontBuffer(i,s,h)}}},e.flushBackBuffer=function(t,e,r){var n=this,i=this.details,s=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(a){var o=s[a];if(o){var l=rn.getBuffered(o);if(l.length>0&&r>l.start(0)){if(n.hls.trigger(b.BACK_BUFFER_REACHED,{bufferEnd:r}),null!=i&&i.live)n.hls.trigger(b.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(o.ended&&l.end(l.length-1)-t<2*e)return void n.log("Cannot flush "+a+" back buffer while SourceBuffer is in ended state");n.hls.trigger(b.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:a})}}}))},e.flushFrontBuffer=function(t,e,r){var n=this,i=this.sourceBuffer;this.getSourceBufferTypes().forEach((function(s){var a=i[s];if(a){var o=rn.getBuffered(a),l=o.length;if(l<2)return;var u=o.start(l-1),c=o.end(l-1);if(r>u||t>=u&&t<=c)return;if(a.ended&&t-c<2*e)return void n.log("Cannot flush "+s+" front buffer while SourceBuffer is in ended state");n.hls.trigger(b.BUFFER_FLUSHING,{startOffset:u,endOffset:1/0,type:s})}}))},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,r=this.media,n=this.mediaSource,i=t.fragments[0].start+t.totalduration,s=r.duration,a=y(n.duration)?n.duration:0;t.live&&e.config.liveDurationInfinity?(n.duration=1/0,this.updateSeekableRange(t)):(i>a&&i>s||!y(s))&&(this.log("Updating Media Source duration to "+i.toFixed(3)),n.duration=i)}},e.updateSeekableRange=function(t){var e=this.mediaSource,r=t.fragments;if(r.length&&t.live&&null!=e&&e.setLiveSeekableRange){var n=Math.max(0,r[0].start),i=Math.max(n,n+t.totalduration);this.log("Media Source duration is set to "+e.duration+". Setting seekable range to "+n+"-"+i+"."),e.setLiveSeekableRange(n,i)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,r=this.pendingTracks,n=Object.keys(r).length;if(n&&(!t||2===n||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};var i=this.getSourceBufferTypes();if(i.length)this.hls.trigger(b.BUFFER_CREATED,{tracks:this.tracks}),i.forEach((function(t){e.executeNext(t)}));else{var s=new Error("could not create source buffer for media codec(s)");this.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:s,reason:s.message})}}},e.createSourceBuffers=function(t){var e=this,r=this.sourceBuffer,n=this.mediaSource;if(!n)throw Error("createSourceBuffers called when mediaSource was null");var i=function(i){if(!r[i]){var s,a=t[i];if(!a)throw Error("source buffer exists for track "+i+", however track does not");var o=-1===(null==(s=a.levelCodec)?void 0:s.indexOf(","))?a.levelCodec:a.codec;o&&"audio"===i.slice(0,5)&&(o=ge(o,e.appendSource));var l=a.container+";codecs="+o;e.log("creating sourceBuffer("+l+")");try{var u=r[i]=n.addSourceBuffer(l),c=i;e.addBufferListener(c,"updatestart",e._onSBUpdateStart),e.addBufferListener(c,"updateend",e._onSBUpdateEnd),e.addBufferListener(c,"error",e._onSBUpdateError),e.appendSource&&e.addBufferListener(c,"bufferedchange",(function(t,r){var n=r.removedRanges;null!=n&&n.length&&e.hls.trigger(b.BUFFER_FLUSHED,{type:i})})),e.tracks[i]={buffer:u,codec:o,container:a.container,levelCodec:a.levelCodec,metadata:a.metadata,id:a.id}}catch(t){e.error("error while trying to add sourceBuffer: "+t.message),e.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,sourceBufferName:i,mimeType:l})}}};for(var s in t)i(s)},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e;if("closed"!==(null==(e=this.mediaSource)?void 0:e.readyState)){var r=this.operationQueue;r.current(t).onComplete(),r.shiftAndExecuteNext(t)}else this.resetBuffer(t)},e._onSBUpdateError=function(t,e){var r,n=new Error(t+" SourceBuffer error. MediaSource readyState: "+(null==(r=this.mediaSource)?void 0:r.readyState));this.error(""+n,e),this.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:n,fatal:!1});var i=this.operationQueue.current(t);i&&i.onError(n)},e.removeExecutor=function(t,e,r){var n=this.media,i=this.mediaSource,s=this.operationQueue,a=this.sourceBuffer[t];if(!n||!i||!a)return this.warn("Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void s.shiftAndExecuteNext(t);var o=y(n.duration)?n.duration:1/0,l=y(i.duration)?i.duration:1/0,u=Math.max(0,e),c=Math.min(r,o,l);c>u&&(!a.ending||a.ended)?(a.ended=!1,this.log("Removing ["+u+","+c+"] from the "+t+" SourceBuffer"),a.remove(u,c)):s.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var r=this.sourceBuffer[e];if(r)r.ended=!1,r.appendBuffer(t);else if(!this.pendingTracks[e])throw new Error("Attempting to append to the "+e+" SourceBuffer, but it does not exist")},e.blockBuffers=function(t,e){var r=this;if(void 0===e&&(e=this.getSourceBufferTypes()),!e.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(t);var n=this.operationQueue,i=e.map((function(t){return n.appendBlocker(t)}));Promise.all(i).then((function(){t(),e.forEach((function(t){var e=r.sourceBuffer[t];null!=e&&e.updating||n.shiftAndExecuteNext(t)}))}))},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,r){var n=this.sourceBuffer[t];if(n){var i=r.bind(this,t);this.listeners[t].push({event:e,listener:i}),n.addEventListener(e,i)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},a(t,[{key:"mediaSrc",get:function(){var t,e,r=(null==(t=this.media)||null==(e=t.querySelector)?void 0:e.call(t,"source"))||this.media;return null==r?void 0:r.src}}]),t}();function ss(t){var e=t.querySelectorAll("source");[].slice.call(e).forEach((function(e){t.removeChild(e)}))}var as={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},os=function(t){return String.fromCharCode(as[t]||t)},ls=15,us=100,cs={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},hs={17:2,18:4,21:6,22:8,23:10,19:13,20:15},ds={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},fs={25:2,26:4,29:6,30:8,31:10,27:13,28:15},ps=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],gs=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;D.log(this.time+" ["+t+"] "+r)}},t}(),vs=function(t){for(var e=[],r=0;r<t.length;r++)e.push(t[r].toString(16));return e},ms=function(){function t(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!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 n=e[r];t.hasOwnProperty(n)&&(this[n]=t[n])}},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}(),ys=function(){function t(){this.uchar=" ",this.penState=new ms}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}(),Es=function(){function t(t){this.chars=[],this.pos=0,this.currPenState=new ms,this.cueStartTime=null,this.logger=void 0;for(var e=0;e<us;e++)this.chars.push(new ys);this.logger=t}var e=t.prototype;return e.equals=function(t){for(var e=0;e<us;e++)if(!this.chars[e].equals(t.chars[e]))return!1;return!0},e.copy=function(t){for(var e=0;e<us;e++)this.chars[e].copy(t.chars[e])},e.isEmpty=function(){for(var t=!0,e=0;e<us;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>us&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=us)},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=os(t);this.pos>=us?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<us;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<us;r++){var n=this.chars[r].uchar;" "!==n&&(e=!1),t.push(n)}return e?"":t.join("")},e.setPenStyles=function(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)},t}(),Ss=function(){function t(t){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(var e=0;e<ls;e++)this.rows.push(new Es(t));this.logger=t}var e=t.prototype;return e.reset=function(){for(var t=0;t<ls;t++)this.rows[t].clear();this.currRow=14},e.equals=function(t){for(var e=!0,r=0;r<ls;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e},e.copy=function(t){for(var e=0;e<ls;e++)this.rows[e].copy(t.rows[e])},e.isEmpty=function(){for(var t=!0,e=0;e<ls;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<ls;r++)this.rows[r].clear();var n=this.currRow+1-this.nrRollUpRows,i=this.lastOutputScreen;if(i){var s=i.rows[n].cueStartTime,a=this.logger.time;if(null!==s&&null!==a&&s<a)for(var o=0;o<this.nrRollUpRows;o++)this.rows[e-this.nrRollUpRows+o+1].copy(i.rows[n+o])}}this.currRow=e;var l=this.rows[this.currRow];if(null!==t.indent){var u=t.indent,c=Math.max(u-1,0);l.setCursor(t.indent),t.color=l.chars[c].penState.foreground}var h={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(h)},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="",n=-1,i=0;i<ls;i++){var s=this.rows[i].getTextString();s&&(n=i+1,t?e.push("Row "+n+": '"+s+"'"):e.push(s.trim()))}return e.length>0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r},e.getTextAndFormat=function(){return this.rows},t}(),bs=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 Ss(r),this.nonDisplayedMemory=new Ss(r),this.lastOutputScreen=new Ss(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 n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(function(){return n+": "+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}(),Ts=function(){function t(t,e,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;var n=this.logger=new gs;this.channels=[null,new bs(t,e,n),new bs(t+1,r,n)]}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=this;this.logger.time=t;for(var n=function(t){var n=127&e[t],i=127&e[t+1],s=!1,a=null;if(0===n&&0===i)return 0;r.logger.log(3,(function(){return"["+vs([e[t],e[t+1]])+"] -> ("+vs([n,i])+")"}));var o=r.cmdHistory;if(n>=16&&n<=31){if(function(t,e,r){return r.a===t&&r.b===e}(n,i,o))return _s(null,null,o),r.logger.log(3,(function(){return"Repeated command ("+vs([n,i])+") is dropped"})),0;_s(n,i,r.cmdHistory),(s=r.parseCmd(n,i))||(s=r.parseMidrow(n,i)),s||(s=r.parsePAC(n,i)),s||(s=r.parseBackgroundAttributes(n,i))}else _s(null,null,o);if(!s&&(a=r.parseChars(n,i))){var l=r.currentChannel;l&&l>0?r.channels[l].insertChars(a):r.logger.log(2,"No channel found yet. TEXT-MODE?")}s||a||r.logger.log(2,(function(){return"Couldn't parse cleaned data "+vs([n,i])+" orig: "+vs([e[t],e[t+1]])}))},i=0;i<e.length;i+=2)n(i)},e.parseCmd=function(t,e){if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;var r=20===t||21===t||23===t?1:2,n=this.channels[r];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),this.currentChannel=r,!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 n=this.channels[r];return!!n&&(n.ccMIDROW(e),this.logger.log(3,(function(){return"MIDROW ("+vs([t,e])+")"})),!0)}return!1},e.parsePAC=function(t,e){var r;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;var n=t<=23?1:2;r=e>=64&&e<=95?1===n?cs[t]:ds[t]:1===n?hs[t]:fs[t];var i=this.channels[n];return!!i&&(i.setPAC(this.interpretPAC(r,e)),this.currentChannel=n,!0)},e.interpretPAC=function(t,e){var r,n={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n},e.parseChars=function(t,e){var r,n,i=null,s=null;return t>=25?(r=2,s=t-8):(r=1,s=t),s>=17&&s<=19?(n=17===s?e+80:18===s?e+112:e+144,this.logger.log(2,(function(){return"Special char '"+os(n)+"' in channel "+r})),i=[n]):t>=32&&t<=127&&(i=0===e?[t]:[t,e]),i&&this.logger.log(3,(function(){return"Char codes =  "+vs(i).join(",")})),i},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 n={};16===t||24===t?(r=Math.floor((e-32)/2),n.background=ps[r],e%2==1&&(n.background=n.background+"_semi")):45===e?n.background="transparent":(n.foreground="black",47===e&&(n.underline=!0));var i=t<=23?1:2;return this.channels[i].setBkgData(n),!0},e.reset=function(){for(var t=0;t<Object.keys(this.channels).length;t++){var e=this.channels[t];e&&e.reset()}_s(null,null,this.cmdHistory)},e.cueSplitAtTime=function(t){for(var e=0;e<this.channels.length;e++){var r=this.channels[e];r&&r.cueSplitAtTime(t)}},t}();function _s(t,e,r){r.a=t,r.b=e}var As=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}(),Ls=function(){if(null!=W&&W.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 n(t){return r(e,t)}function i(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),n=1;n<e;n++)r[n-1]=arguments[n];for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var a in s)t[a]=s[a]}return t}function s(e,s,a){var o=this,l={enumerable:!0};o.hasBeenReset=!1;var u="",c=!1,h=e,d=s,f=a,p=null,g="",v=!0,m="auto",y="start",E=50,S="middle",b=50,T="middle";Object.defineProperty(o,"id",i({},l,{get:function(){return u},set:function(t){u=""+t}})),Object.defineProperty(o,"pauseOnExit",i({},l,{get:function(){return c},set:function(t){c=!!t}})),Object.defineProperty(o,"startTime",i({},l,{get:function(){return h},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");h=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},l,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},l,{get:function(){return g},set:function(e){var n=function(e){return r(t,e)}(e);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");g=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},l,{get:function(){return v},set:function(t){v=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},l,{get:function(){return m},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},l,{get:function(){return y},set:function(t){var e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},l,{get:function(){return E},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},l,{get:function(){return S},set:function(t){var e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");S=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},l,{get:function(){return b},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},l,{get:function(){return T},set:function(t){var e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");T=e,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}(),ws=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 Rs(t){function e(t,e,r,n){return 3600*(0|t)+60*(0|e)+(0|r)+parseFloat(n||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 ks=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 n=0;n<r.length;++n)if(e===r[n]){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 Ds(t,e,r,n){var i=n?t.split(n):[t];for(var s in i)if("string"==typeof i[s]){var a=i[s].split(r);2===a.length&&e(a[0],a[1])}}var Is=new Ls(0,0,""),Ps="middle"===Is.align?"middle":"center";function Os(t,e,r){var n=t;function i(){var e=Rs(t);if(null===e)throw new Error("Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function s(){t=t.replace(/^\s+/,"")}if(s(),e.startTime=i(),s(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);t=t.slice(3),s(),e.endTime=i(),s(),function(t,e){var n=new ks;Ds(t,(function(t,e){var i;switch(t){case"region":for(var s=r.length-1;s>=0;s--)if(r[s].id===e){n.set(t,r[s].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":i=e.split(","),n.integer(t,i[0]),n.percent(t,i[0])&&n.set("snapToLines",!1),n.alt(t,i[0],["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",Ps,"end"]);break;case"position":i=e.split(","),n.percent(t,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",Ps,"end","line-left","line-right","auto"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start",Ps,"end","left","right"])}}),/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");var i=n.get("line","auto");"auto"===i&&-1===Is.line&&(i=-1),e.line=i,e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100),e.align=n.get("align",Ps);var s=n.get("position","auto");"auto"===s&&50===Is.position&&(s="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=s}(t,e)}function Cs(t){return t.replace(/<br(?: \/)?>/gi,"\n")}var xs=function(){function t(){this.state="INITIAL",this.buffer="",this.decoder=new ws,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=Cs(t);r<t.length&&"\r"!==t[r]&&"\n"!==t[r];)++r;var n=t.slice(0,r);return"\r"===t[r]&&++r,"\n"===t[r]&&++r,e.buffer=t.slice(r),n}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{var n="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;var i=(n=r()).match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(null==i||!i[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}for(var s=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(s?s=!1:n=r(),e.state){case"HEADER":/:/.test(n)?Ds(n,(function(t,e){}),/:/):n||(e.state="ID");continue;case"NOTE":n||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(n)){e.state="NOTE";break}if(!n)continue;if(e.cue=new Ls(0,0,""),e.state="CUE",-1===n.indexOf("--\x3e")){e.cue.id=n;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{Os(n,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var a=-1!==n.indexOf("--\x3e");if(!n||a&&(s=!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+=n;continue;case"BADCUE":n||(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}(),Ms=/\r\n|\n\r|\n|\r/g,Fs=function(t,e,r){return void 0===r&&(r=0),t.slice(r,r+e.length)===e},Ns=function(t){for(var e=5381,r=t.length;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()};function Bs(t,e,r){return Ns(t.toString())+Ns(e.toString())+Ns(r)}function Us(t,e,r,n,i,s,a){var o,l,u,c=new xs,h=At(new Uint8Array(t)).trim().replace(Ms,"\n").split("\n"),d=[],f=e?(l=e.baseTime,void 0===(u=e.timescale)&&(u=1),Ai(l,_i,1/u)):0,p="00:00.000",g=0,v=0,m=!0;c.oncue=function(t){var s=r[n],a=r.ccOffset,l=(g-f)/9e4;if(null!=s&&s.new&&(void 0!==v?a=r.ccOffset=s.start:function(t,e,r){var n=t[e],i=t[n.prevCC];if(!i||!i.new&&n.new)return t.ccOffset=t.presentationOffset=n.start,void(n.new=!1);for(;null!=(s=i)&&s.new;){var s;t.ccOffset+=n.start-i.start,n.new=!1,i=t[(n=i).prevCC]}t.presentationOffset=r}(r,n,l)),l){if(!e)return void(o=new Error("Missing initPTS for VTT MPEGTS"));a=l-r.presentationOffset}var u=t.endTime-t.startTime,c=Di(9e4*(t.startTime+a-v),9e4*i)/9e4;t.startTime=Math.max(c,0),t.endTime=Math.max(c+u,0);var h=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(h)),t.id||(t.id=Bs(t.startTime,t.endTime,h)),t.endTime>0&&d.push(t)},c.onparsingerror=function(t){o=t},c.onflush=function(){o?a(o):s(d)},h.forEach((function(t){if(m){if(Fs(t,"X-TIMESTAMP-MAP=")){m=!1,t.slice(16).split(",").forEach((function(t){Fs(t,"LOCAL:")?p=t.slice(6):Fs(t,"MPEGTS:")&&(g=parseInt(t.slice(7)))}));try{v=function(t){var e=parseInt(t.slice(-3)),r=parseInt(t.slice(-6,-4)),n=parseInt(t.slice(-9,-7)),i=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(y(e)&&y(r)&&y(n)&&y(i)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*r,(e+=6e4*n)+36e5*i}(p)/1e3}catch(t){o=t}return}""===t&&(m=!1)}c.parse(t+"\n")})),c.flush()}var js="stpp.ttml.im1t",Hs=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Gs=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Vs={left:"start",center:"center",right:"end",start:"start",end:"end"};function Ks(t,e,r,n){var i,s,a,l,u=Ft(new Uint8Array(t),["mdat"]);if(0!==u.length){var c=u.map((function(t){return At(t)})),h=(i=e.baseTime,s=1,void 0===(a=e.timescale)&&(a=1),void 0===l&&(l=!1),Ai(i,s,1/a,l));try{c.forEach((function(t){return r(function(t,e){var r=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");var n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(n).reduce((function(t,e){return t[e]=r.getAttribute("ttp:"+e)||n[e],t}),{}),s="preserve"!==r.getAttribute("xml:space"),a=Ws($s(r,"styling","style")),l=Ws($s(r,"layout","region")),u=$s(r,"body","[begin]");return[].map.call(u,(function(t){var r=qs(t,s);if(!r||!t.hasAttribute("begin"))return null;var n=Xs(t.getAttribute("begin"),i),u=Xs(t.getAttribute("dur"),i),c=Xs(t.getAttribute("end"),i);if(null===n)throw zs(t);if(null===c){if(null===u)throw zs(t);c=n+u}var h=new Ls(n-e,c-e,r);h.id=Bs(h.startTime,h.endTime,h.text);var d=function(t,e,r){var n="http://www.w3.org/ns/ttml#styling",i=null,s=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],a=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;return a&&r.hasOwnProperty(a)&&(i=r[a]),s.reduce((function(r,s){var a=Ys(e,n,s)||Ys(t,n,s)||Ys(i,n,s);return a&&(r[s]=a),r}),{})}(l[t.getAttribute("region")],a[t.getAttribute("style")],a),f=d.textAlign;if(f){var p=Vs[f];p&&(h.lineAlign=p),h.align=f}return o(h,d),h})).filter((function(t){return null!==t}))}(t,h))}))}catch(t){n(t)}}else n(new Error("Could not parse IMSC1 mdat"))}function $s(t,e,r){var n=t.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function Ws(t){return t.reduce((function(t,e){var r=e.getAttribute("xml:id");return r&&(t[r]=e),t}),{})}function qs(t,e){return[].slice.call(t.childNodes).reduce((function(t,r,n){var i;return"br"===r.nodeName&&n?t+"\n":null!=(i=r.childNodes)&&i.length?qs(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}function Ys(t,e,r){return t&&t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function zs(t){return new Error("Could not parse ttml timestamp "+t)}function Xs(t,e){if(!t)return null;var r=Rs(t);return null===r&&(Hs.test(t)?r=function(t,e){var r=Hs.exec(t),n=(0|r[4])+(0|r[5])/e.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+n/e.frameRate}(t,e):Gs.test(t)&&(r=function(t,e){var r=Gs.exec(t),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}(t,e))),r}var Js=function(){function t(t){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},t.on(b.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(b.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(b.FRAG_LOADING,this.onFragLoading,this),t.on(b.FRAG_LOADED,this.onFragLoaded,this),t.on(b.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(b.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(b.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(b.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(b.BUFFER_FLUSHING,this.onBufferFlushing,this)}var e=t.prototype;return e.destroy=function(){var t=this.hls;t.off(b.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(b.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(b.FRAG_LOADING,this.onFragLoading,this),t.off(b.FRAG_LOADED,this.onFragLoaded,this),t.off(b.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(b.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(b.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(b.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(b.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0},e.initCea608Parsers=function(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){var t=new As(this,"textTrack1"),e=new As(this,"textTrack2"),r=new As(this,"textTrack3"),n=new As(this,"textTrack4");this.cea608Parser1=new Ts(1,t,e),this.cea608Parser2=new Ts(3,r,n)}},e.addCues=function(t,e,r,n,i){for(var s=!1,a=i.length;a--;){var o=i[a],l=(u=o[0],c=o[1],h=e,d=r,Math.min(c,d)-Math.max(u,h));if(l>=0&&(o[0]=Math.min(o[0],e),o[1]=Math.max(o[1],r),s=!0,l/(r-e)>.5))return}var u,c,h,d;if(s||i.push([e,r]),this.config.renderTextTracksNatively){var f=this.captionsTracks[t];this.Cues.newCue(f,e,r,n)}else{var p=this.Cues.newCue(null,e,r,n);this.hls.trigger(b.CUES_PARSED,{type:"captions",cues:p,track:t})}},e.onInitPtsFound=function(t,e){var r=this,n=e.frag,i=e.id,s=e.initPTS,a=e.timescale,o=this.unparsedVttFrags;"main"===i&&(this.initPTS[n.cc]={baseTime:s,timescale:a}),o.length&&(this.unparsedVttFrags=[],o.forEach((function(t){r.onFragLoaded(b.FRAG_LOADED,t)})))},e.getExistingTrack=function(t,e){var r=this.media;if(r)for(var n=0;n<r.textTracks.length;n++){var i=r.textTracks[n];if(Zs(i,{name:t,lang:e,attrs:{}}))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,n=this.media,i=e[t],s=i.label,a=i.languageCode,o=this.getExistingTrack(s,a);if(o)r[t]=o,Ge(r[t]),je(r[t],n);else{var l=this.createTextTrack("captions",s,a);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(b.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}}},e.createTextTrack=function(t,e,r){var n=this.media;if(n)return n.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){Ge(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}},e.onManifestLoading=function(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],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++)Ge(e[r])}},e.onSubtitleTracksUpdated=function(t,e){var r=this,n=e.subtitleTracks||[],i=n.some((function(t){return t.textCodec===js}));if(this.config.enableWebVTT||i&&this.config.enableIMSC1){if(Yi(this.tracks,n))return void(this.tracks=n);if(this.textTracks=[],this.tracks=n,this.config.renderTextTracksNatively){var s=this.media,a=s?Ke(s.textTracks):null;if(this.tracks.forEach((function(t,e){var n;if(a){for(var i=null,s=0;s<a.length;s++)if(a[s]&&Zs(a[s],t)){i=a[s],a[s]=null;break}i&&(n=i)}if(n)Ge(n);else{var o=Qs(t);(n=r.createTextTrack(o,t.name,t.lang))&&(n.mode="disabled")}n&&r.textTracks.push(n)})),null!=a&&a.length){var o=a.filter((function(t){return null!==t})).map((function(t){return t.label}));o.length&&D.warn("Media element contains unused subtitle tracks: "+o.join(", ")+". Replace media element for each source to clear TextTracks and captions menu.")}}else if(this.tracks.length){var l=this.tracks.map((function(t){return{label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t}}));this.hls.trigger(b.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:l})}}},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 n="textTrack"+e[1],i=r.captionsProperties[n];i&&(i.label=t.name,t.lang&&(i.languageCode=t.lang),i.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){if(this.enabled&&e.frag.type===xe){var r,n,i=this.cea608Parser1,s=this.cea608Parser2,a=this.lastSn,o=e.frag,l=o.cc,u=o.sn,c=null!=(r=null==(n=e.part)?void 0:n.index)?r:-1;i&&s&&(u!==a+1||u===a&&c!==this.lastPartIndex+1||l!==this.lastCc)&&(i.reset(),s.reset()),this.lastCc=l,this.lastSn=u,this.lastPartIndex=c}},e.onFragLoaded=function(t,e){var r=e.frag,n=e.payload;if(r.type===Fe)if(n.byteLength){var i=r.decryptdata,s="stats"in e;if(null==i||!i.encrypted||s){var a=this.tracks[r.level],o=this.vttCCs;o[r.cc]||(o[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),a&&a.textCodec===js?this._parseIMSC1(r,n):this._parseVTTs(e)}}else this.hls.trigger(b.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})},e._parseIMSC1=function(t,e){var r=this,n=this.hls;Ks(e,this.initPTS[t.cc],(function(e){r._appendCues(e,t.level),n.trigger(b.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(function(e){D.log("Failed to parse IMSC1: "+e),n.trigger(b.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))},e._parseVTTs=function(t){var e,r=this,n=t.frag,i=t.payload,s=this.initPTS,a=this.unparsedVttFrags,o=s.length-1;if(s[n.cc]||-1!==o){var l=this.hls;Us(null!=(e=n.initSegment)&&e.data?$t(n.initSegment.data,new Uint8Array(i)):i,this.initPTS[n.cc],this.vttCCs,n.cc,n.start,(function(t){r._appendCues(t,n.level),l.trigger(b.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n})}),(function(e){var s="Missing initPTS for VTT MPEGTS"===e.message;s?a.push(t):r._fallbackToIMSC1(n,i),D.log("Failed to parse VTT cue: "+e),s&&o>n.cc||l.trigger(b.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,error:e})}))}else a.push(t)},e._fallbackToIMSC1=function(t,e){var r=this,n=this.tracks[t.level];n.textCodec||Ks(e,this.initPTS[t.cc],(function(){n.textCodec=js,r._parseIMSC1(t,e)}),(function(){n.textCodec="wvtt"}))},e._appendCues=function(t,e){var r=this.hls;if(this.config.renderTextTracksNatively){var n=this.textTracks[e];if(!n||"disabled"===n.mode)return;t.forEach((function(t){return He(n,t)}))}else{var i=this.tracks[e];if(!i)return;var s=i.default?"default":"subtitles"+e;r.trigger(b.CUES_PARSED,{type:"subtitles",cues:t,track:s})}},e.onFragDecrypted=function(t,e){e.frag.type===Fe&&this.onFragLoaded(b.FRAG_LOADED,e)},e.onSubtitleTracksCleared=function(){this.tracks=[],this.captionsTracks={}},e.onFragParsingUserdata=function(t,e){this.initCea608Parsers();var r=this.cea608Parser1,n=this.cea608Parser2;if(this.enabled&&r&&n){var i=e.frag,s=e.samples;if(i.type!==xe||"NONE"!==this.closedCaptionsForLevel(i))for(var a=0;a<s.length;a++){var o=s[a].bytes;if(o){var l=this.extractCea608Data(o);r.addData(s[a].pts,l[0]),n.addData(s[a].pts,l[1])}}}},e.onBufferFlushing=function(t,e){var r=e.startOffset,n=e.endOffset,i=e.endOffsetSubtitles,s=e.type,a=this.media;if(a&&!(a.currentTime<n)){if(!s||"video"===s){var o=this.captionsTracks;Object.keys(o).forEach((function(t){return Ve(o[t],r,n)}))}if(this.config.renderTextTracksNatively&&0===r&&void 0!==i){var l=this.textTracks;Object.keys(l).forEach((function(t){return Ve(l[t],r,i)}))}}},e.extractCea608Data=function(t){for(var e=[[],[]],r=31&t[0],n=2,i=0;i<r;i++){var s=t[n++],a=127&t[n++],o=127&t[n++];if((0!==a||0!==o)&&0!=(4&s)){var l=3&s;0!==l&&1!==l||(e[l].push(a),e[l].push(o))}}return e},t}();function Qs(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function Zs(t,e){return!!t&&t.kind===Qs(e)&&Xi(e,t)}var ta=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.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null},e.registerListeners=function(){var t=this.hls;t.on(b.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(b.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(b.MANIFEST_PARSED,this.onManifestParsed,this),t.on(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(b.BUFFER_CODECS,this.onBufferCodecs,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this)},e.unregisterListener=function(){var t=this.hls;t.off(b.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(b.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(b.MANIFEST_PARSED,this.onManifestParsed,this),t.off(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(b.BUFFER_CODECS,this.onBufferCodecs,this),t.off(b.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,this.timer&&this.hls.levels.length&&this.detectPlayerSize()},e.onManifestParsed=function(t,e){var r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()},e.onLevelsUpdated=function(t,e){this.timer&&y(this.autoLevelCapping)&&this.detectPlayerSize()},e.onBufferCodecs=function(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()},e.onMediaDetaching=function(){this.stopCapping()},e.detectPlayerSize=function(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);var t=this.hls.levels;if(t.length){var e=this.hls,r=this.getMaxLevel(t.length-1);r!==this.autoLevelCapping&&D.log("Setting autoLevelCapping to "+r+": "+t[r].height+"p@"+t[r].bitrate+" for media "+this.mediaWidth+"x"+this.mediaHeight),e.autoLevelCapping=r,e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},e.getMaxLevel=function(e){var r=this,n=this.hls.levels;if(!n.length)return-1;var i=n.filter((function(t,n){return r.isLevelAllowed(t)&&n<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(i,this.mediaWidth,this.mediaHeight)},e.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,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 n=t.length-1,i=Math.max(e,r),s=0;s<t.length;s+=1){var a=t[s];if((a.width>=i||a.height>=i)&&(o=a,!(l=t[s+1])||o.width!==l.width||o.height!==l.height)){n=s;break}}var o,l;return n},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}(),ea=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(b.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(b.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 n=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=n,n&&"function"==typeof n.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 n=performance.now();if(e){if(this.lastTime){var i=n-this.lastTime,s=r-this.lastDroppedFrames,a=e-this.lastDecodedFrames,o=1e3*s/i,l=this.hls;if(l.trigger(b.FPS_DROP,{currentDropped:s,currentDecoded:a,totalDroppedFrames:r}),o>0&&s>l.config.fpsDroppedMonitoringThreshold*a){var u=l.currentLevel;D.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===l.autoLevelCapping||l.autoLevelCapping>=u)&&(u-=1,l.trigger(b.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:l.currentLevel}),l.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=n,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}(),ra="[eme]",na=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=D.debug.bind(D,ra),this.log=D.log.bind(D,ra),this.warn=D.warn.bind(D,ra),this.error=D.error.bind(D,ra),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(b.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(b.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(b.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(b.MANIFEST_LOADED,this.onManifestLoaded,this)},e.unregisterListeners=function(){this.hls.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(b.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(b.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(b.MANIFEST_LOADED,this.onManifestLoaded,this)},e.getLicenseServerUrl=function(t){var e=this.config,r=e.drmSystems,n=e.widevineLicenseUrl,i=r[t];if(i)return i.licenseUrl;if(t===q.WIDEVINE&&n)return n;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,n=function(t,e,r){return!!t&&r.indexOf(t)===e},i=r.map((function(t){return t.audioCodec})).filter(n),s=r.map((function(t){return t.videoCodec})).filter(n);return i.length+s.length===0&&s.push("avc1.42e01e"),new Promise((function(r,n){!function t(a){var o=a.shift();e.getMediaKeysPromise(o,i,s).then((function(t){return r({keySystem:o,mediaKeys:t})})).catch((function(e){a.length?t(a):n(e instanceof la?e:new la({type:T.KEY_SYSTEM_ERROR,details:_.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 n="Configured requestMediaKeySystemAccess is not a function "+r;return null===ot&&"http:"===self.location.protocol&&(n="navigator.requestMediaKeySystemAccess is not available over insecure protocol "+location.protocol),Promise.reject(new Error(n))}return r(t,e)},e.getMediaKeysPromise=function(t,e,r){var n=this,i=function(t,e,r,n){var i;switch(t){case q.FAIRPLAY:i=["cenc","sinf"];break;case q.WIDEVINE:case q.PLAYREADY:i=["cenc"];break;case q.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error("Unknown key-system: "+t)}return function(t,e,r,n){return[{initDataTypes:t,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map((function(t){return{contentType:'audio/mp4; codecs="'+t+'"',robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null}})),videoCapabilities:r.map((function(t){return{contentType:'video/mp4; codecs="'+t+'"',robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null}}))}]}(i,e,r,n)}(t,e,r,this.config.drmSystemOptions),s=this.keySystemAccessPromises[t],a=null==s?void 0:s.keySystemAccess;if(!a){this.log('Requesting encrypted media "'+t+'" key-system access with config: '+JSON.stringify(i)),a=this.requestMediaKeySystemAccess(t,i);var o=this.keySystemAccessPromises[t]={keySystemAccess:a};return a.catch((function(e){n.log('Failed to obtain access to key-system "'+t+'": '+e)})),a.then((function(e){n.log('Access for key-system "'+e.keySystem+'" obtained');var r=n.fetchServerCertificate(t);return n.log('Create media-keys for "'+t+'"'),o.mediaKeys=e.createMediaKeys().then((function(e){return n.log('Media-keys created for "'+t+'"'),r.then((function(r){return r?n.setMediaKeysServerCertificate(e,t,r):e}))})),o.mediaKeys.catch((function(e){n.error('Failed to create media-keys for "'+t+'"}: '+e)})),o.mediaKeys}))}return a.then((function(){return s.mediaKeys}))},e.createMediaKeySessionContext=function(t){var e=t.decryptdata,r=t.keySystem,n=t.mediaKeys;this.log('Creating key-system session "'+r+'" keyId: '+wt.hexDump(e.keyId||[]));var i=n.createSession(),s={decryptdata:e,keySystem:r,mediaKeys:n,mediaKeysSession:i,keyStatus:"status-pending"};return this.mediaKeySessions.push(s),s},e.renewKeySession=function(t){var e=t.decryptdata;if(e.pssh){var r=this.createMediaKeySessionContext(t),n=this.getKeyIdString(e);this.keyIdToKeySessionPromise[n]=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 wt.hexDump(t.keyId)},e.updateKeySession=function(t,e){var r,n=t.mediaKeysSession;return this.log('Updating key-session "'+n.sessionId+'" for keyID '+wt.hexDump((null==(r=t.decryptdata)?void 0:r.keyId)||[])+"\n      } (data length: "+(e?e.byteLength:e)+")"),n.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,n){var i=st(e.config),s=t.map(Q).filter((function(t){return!!t&&-1!==i.indexOf(t)}));return e.getKeySystemSelectionPromise(s).then((function(t){var e=t.keySystem,i=it(e);i?r(i):n(new Error('Unable to find format for key-system "'+e+'"'))})).catch(n)}))},e.loadKey=function(t){var e=this,r=t.keyInfo.decryptdata,n=this.getKeyIdString(r),i="(keyId: "+n+' format: "'+r.keyFormat+'" method: '+r.method+" uri: "+r.uri+")";this.log("Starting session for key "+i);var s=this.keyIdToKeySessionPromise[n];return s||(s=this.keyIdToKeySessionPromise[n]=this.getKeySystemForKeyPromise(r).then((function(n){var s=n.keySystem,a=n.mediaKeys;return e.throwIfDestroyed(),e.log("Handle encrypted media sn: "+t.frag.sn+" "+t.frag.type+": "+t.frag.level+" using key "+i),e.attemptSetMediaKeys(s,a).then((function(){e.throwIfDestroyed();var t=e.createMediaKeySessionContext({keySystem:s,mediaKeys:a,decryptdata:r});return e.generateRequestWithPreferredKeySession(t,"cenc",r.pssh,"playlist-key")}))}))).catch((function(t){return e.handleError(t)})),s},e.throwIfDestroyed=function(t){if(!this.hls)throw new Error("invalid state")},e.handleError=function(t){this.hls&&(this.error(t.message),t instanceof la?this.hls.trigger(b.ERROR,t.data):this.hls.trigger(b.ERROR,{type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))},e.getKeySystemForKeyPromise=function(t){var e=this.getKeyIdString(t),r=this.keyIdToKeySessionPromise[e];if(!r){var n=Q(t.keyFormat),i=n?[n]:st(this.config);return this.attemptKeySystemAccess(i)}return r},e.getKeySystemSelectionPromise=function(t){if(t.length||(t=st(this.config)),0===t.length)throw new la({type:T.KEY_SYSTEM_ERROR,details:_.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,n=t.initData,i='"'+t.type+'" event: init data type: "'+r+'"';if(this.debug(i),null!==n){var s,a;if("sinf"===r&&this.config.drmSystems[q.FAIRPLAY]){var o=It(new Uint8Array(n));try{var l=V(JSON.parse(o).sinf),u=Vt(new Uint8Array(l));if(!u)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");s=u.subarray(8,24),a=q.FAIRPLAY}catch(t){return void this.warn(i+" Failed to parse sinf: "+t)}}else{var c=function(t){var e=[];if(t instanceof ArrayBuffer)for(var r=t.byteLength,n=0;n+32<r;){var i=Jt(new DataView(t,n));e.push(i),n+=i.size}return e}(n),h=c.filter((function(t){return t.systemId===rt}))[0];if(!h)return void(0===c.length||c.some((function(t){return!t.systemId}))?this.warn(i+" contains incomplete or invalid pssh data"):this.log("ignoring "+i+" for "+c.map((function(t){return nt(t.systemId)})).join(",")+" pssh data in favor of playlist keys"));if(a=nt(h.systemId),0===h.version&&h.data){var d=h.data.length-22;s=h.data.subarray(d,d+16)}}if(a&&s){for(var f,p=wt.hexDump(s),g=this.keyIdToKeySessionPromise,v=this.mediaKeySessions,m=g[p],y=function(){var t=v[E],i=t.decryptdata;if(!i.keyId)return 0;var a=wt.hexDump(i.keyId);return p===a||-1!==i.uri.replace(/-/g,"").indexOf(p)?(m=g[a],i.pssh||(delete g[a],i.pssh=new Uint8Array(n),i.keyId=s,m=g[p]=m.then((function(){return e.generateRequestWithPreferredKeySession(t,r,n,"encrypted-event-key-match")}))),1):void 0},E=0;E<v.length&&(0===(f=y())||1!==f);E++);m||(m=g[p]=this.getKeySystemSelectionPromise([a]).then((function(t){var i,a=t.keySystem,o=t.mediaKeys;e.throwIfDestroyed();var l=new Zt("ISO-23001-7",p,null!=(i=it(a))?i:"");return l.pssh=new Uint8Array(n),l.keyId=s,e.attemptSetMediaKeys(a,o).then((function(){e.throwIfDestroyed();var t=e.createMediaKeySessionContext({decryptdata:l,keySystem:a,mediaKeys:o});return e.generateRequestWithPreferredKeySession(t,r,n,"encrypted-event-no-match")}))}))),m.catch((function(t){return e.handleError(t)}))}}},e._onWaitingForKey=function(t){this.log('"'+t.type+'" event')},e.attemptSetMediaKeys=function(t,e){var r=this,n=this.setMediaKeysQueue.slice();this.log('Setting media-keys for "'+t+'"');var i=Promise.all(n).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(i),i.then((function(){r.log('Media-keys set for "'+t+'"'),n.push(i),r.setMediaKeysQueue=r.setMediaKeysQueue.filter((function(t){return-1===n.indexOf(t)}))}))},e.generateRequestWithPreferredKeySession=function(t,e,r,n){var i,s,a=this,o=null==(i=this.config.drmSystems)||null==(s=i[t.keySystem])?void 0:s.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 "'+n+'" (no initData)'),Promise.resolve(t);var c=this.getKeyIdString(t.decryptdata);this.log('Generating key-session request for "'+n+'": '+c+" (init data type: "+e+" length: "+(r?r.byteLength:null)+")");var h=new Vi,d=t._onmessage=function(e){var r=t.mediaKeysSession;if(r){var n=e.messageType,i=e.message;a.log('"'+n+'" message event for session "'+r.sessionId+'" message size: '+i.byteLength),"license-request"===n||"license-renewal"===n?a.renewLicense(t,i).catch((function(t){a.handleError(t),h.emit("error",t)})):"license-release"===n?t.keySystem===q.FAIRPLAY&&(a.updateKeySession(t,$("acknowledged")),a.removeSession(t)):a.warn('unhandled media key message type "'+n+'"')}else h.emit("error",new Error("invalid state"))},f=t._onkeystatuseschange=function(e){if(t.mediaKeysSession){a.onKeyStatusChange(t);var r=t.keyStatus;h.emit("keyStatus",r),"expired"===r&&(a.warn(t.keySystem+" expired for key "+c),a.renewKeySession(t))}else h.emit("error",new Error("invalid state"))};t.mediaKeysSession.addEventListener("message",d),t.mediaKeysSession.addEventListener("keystatuseschange",f);var p=new Promise((function(t,e){h.on("error",e),h.on("keyStatus",(function(r){r.startsWith("usable")?t():"output-restricted"===r?e(new la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?e(new la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},'key status changed to "'+r+'"')):"expired"===r?e(new Error("key expired while generating request")):a.warn('unhandled key status change "'+r+'"')}))}));return t.mediaKeysSession.generateRequest(e,r).then((function(){var e;a.log('Request generated for key-session "'+(null==(e=t.mediaKeysSession)?void 0:e.sessionId)+'" keyId: '+c)})).catch((function(t){throw new la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_NO_SESSION,error:t,fatal:!1},"Error generating key-session request: "+t)})).then((function(){return p})).catch((function(e){throw h.removeAllListeners(),a.removeSession(t),e})).then((function(){return h.removeAllListeners(),t}))},e.onKeyStatusChange=function(t){var e=this;t.mediaKeysSession.keyStatuses.forEach((function(r,n){e.log('key status change "'+r+'" for keyStatuses keyId: '+wt.hexDump("buffer"in n?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(n))+" session keyId: "+wt.hexDump(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),i=this.getServerCertificateUrl(t);return i?(this.log('Fetching server certificate for "'+t+'"'),new Promise((function(s,a){var o={responseType:"arraybuffer",url:i},l=e.certLoadPolicy.default,u={loadPolicy:l,timeout:l.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},c={onSuccess:function(t,e,r,n){s(t.data)},onError:function(e,r,s,l){a(new la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:s,response:n({url:o.url,data:void 0},e)},'"'+t+'" certificate request failed ('+i+"). Status: "+e.code+" ("+e.text+")"))},onTimeout:function(e,r,n){a(new la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:n,response:{url:o.url,data:void 0}},'"'+t+'" certificate request timed out ('+i+")"))},onAbort:function(t,e,r){a(new Error("aborted"))}};r.load(o,u,c)}))):Promise.resolve()},e.setMediaKeysServerCertificate=function(t,e,r){var n=this;return new Promise((function(i,s){t.setServerCertificate(r).then((function(s){n.log("setServerCertificate "+(s?"success":"not supported by CDM")+" ("+(null==r?void 0:r.byteLength)+') on "'+e+'"'),i(t)})).catch((function(t){s(new la({type:T.KEY_SYSTEM_ERROR,details:_.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 la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:t,fatal:!0},t.message)}))}))},e.unpackPlayReadyKeyMessage=function(t,e){var r=String.fromCharCode.apply(null,new Uint16Array(e.buffer));if(!r.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),e;var n=(new DOMParser).parseFromString(r,"application/xml"),i=n.querySelectorAll("HttpHeader");if(i.length>0)for(var s,a=0,o=i.length;a<o;a++){var l,u,c=null==(l=(s=i[a]).querySelector("name"))?void 0:l.textContent,h=null==(u=s.querySelector("value"))?void 0:u.textContent;c&&h&&t.setRequestHeader(c,h)}var d=n.querySelector("Challenge"),f=null==d?void 0:d.textContent;if(!f)throw new Error("Cannot find <Challenge> in key message");return $(atob(f))},e.setupLicenseXHR=function(t,e,r,n){var i=this,s=this.config.licenseXhrSetup;return s?Promise.resolve().then((function(){if(!r.decryptdata)throw new Error("Key removed");return s.call(i.hls,t,e,r,n)})).catch((function(a){if(!r.decryptdata)throw a;return t.open("POST",e,!0),s.call(i.hls,t,e,r,n)})).then((function(r){return t.readyState||t.open("POST",e,!0),{xhr:t,licenseChallenge:r||n}})):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:n}))},e.requestLicense=function(t,e){var r=this,n=this.config.keyLoadPolicy.default;return new Promise((function(i,s){var a=r.getLicenseServerUrl(t.keySystem);r.log("Sending license request to URL: "+a);var o=new XMLHttpRequest;o.responseType="arraybuffer",o.onreadystatechange=function(){if(!r.hls||!t.mediaKeysSession)return s(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,a,t)}catch(t){r.error(t)}i(l)}else{var c=n.errorRetry,h=c?c.maxNumRetry:0;if(r._requestLicenseFailureCount++,r._requestLicenseFailureCount>h||o.status>=400&&o.status<500)s(new la({type:T.KEY_SYSTEM_ERROR,details:_.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:o,response:{url:a,data:void 0,code:o.status,text:o.statusText}},"License Request XHR failed ("+a+"). Status: "+o.status+" ("+o.statusText+")"));else{var d=h-r._requestLicenseFailureCount+1;r.warn("Retrying license request, "+d+" attempts left"),r.requestLicense(t,e).then(i,s)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=o,r.setupLicenseXHR(o,a,t,e).then((function(e){var n=e.xhr,i=e.licenseChallenge;t.keySystem==q.PLAYREADY&&(i=r.unpackPlayReadyKeyMessage(n,i)),n.send(i)}))}))},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,n=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={},Zt.clearKeyUriToKeyIdMap();var i=n.length;t.CDMCleanupPromise=Promise.all(n.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)})))).then((function(){i&&(e.log("finished closing key sessions and clearing media keys"),n.length=0)})).catch((function(t){e.log("Could not close sessions and clear media keys: "+t)}))},e.onManifestLoading=function(){this.keyFormatPromise=null},e.onManifestLoaded=function(t,e){var r=e.sessionKeys;if(r&&this.config.emeEnabled&&!this.keyFormatPromise){var n=r.reduce((function(t,e){return-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t}),[]);this.log("Selecting key-system from session-keys "+n.join(", ")),this.keyFormatPromise=this.getKeyFormatPromise(n)}},e.removeSession=function(t){var e=this,r=t.mediaKeysSession,n=t.licenseXhr;if(r){this.log("Remove licenses and keys and close session "+r.sessionId),t._onmessage&&(r.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(r.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),n&&n.readyState!==XMLHttpRequest.DONE&&n.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;var i=this.mediaKeySessions.indexOf(t);return i>-1&&this.mediaKeySessions.splice(i,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}();na.CDMCleanupPromise=void 0;var ia,sa,aa,oa,la=function(t){function e(e,r){var n;return(n=t.call(this,r)||this).data=void 0,e.error||(e.error=new Error(r)),n.data=e,e.err=e.error,n}return l(e,t),e}(d(Error));(function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"})(ia||(ia={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(sa||(sa={})),function(t){t.OBJECT="CMCD-Object",t.REQUEST="CMCD-Request",t.SESSION="CMCD-Session",t.STATUS="CMCD-Status"}(aa||(aa={}));var ua=((oa={})[aa.OBJECT]=["br","d","ot","tb"],oa[aa.REQUEST]=["bl","dl","mtp","nor","nrr","su"],oa[aa.SESSION]=["cid","pr","sf","sid","st","v"],oa[aa.STATUS]=["bs","rtp"],oa),ca=function t(e,r){this.value=void 0,this.params=void 0,Array.isArray(e)&&(e=e.map((function(e){return e instanceof t?e:new t(e)}))),this.value=e,this.params=r},ha=function(t){this.description=void 0,this.description=t},da="Dict";function fa(t,e,r,n){return new Error("failed to "+t+' "'+(i=e,(Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":"object"==typeof i?JSON.stringify(i):String(i))+'" as ')+r,{cause:n});var i}var pa="Bare Item",ga="Boolean",va="Byte Sequence",ma="Decimal",ya="Integer";var Ea=/[\x00-\x1f\x7f]+/,Sa="Token",ba="Key";function Ta(t,e,r){return fa("serialize",t,e,r)}function _a(t){if(!1===ArrayBuffer.isView(t))throw Ta(t,va);return":"+(e=t,btoa(String.fromCharCode.apply(String,e))+":");var e}function Aa(t){if(function(t){return t<-999999999999999||999999999999999<t}(t))throw Ta(t,ya);return t.toString()}function La(t,e){if(t<0)return-La(-t,e);var r=Math.pow(10,e);if(Math.abs(t*r%1-.5)<Number.EPSILON){var n=Math.floor(t*r);return(n%2==0?n:n+1)/r}return Math.round(t*r)/r}function wa(t){var e=La(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ta(t,ma);var r=e.toString();return r.includes(".")?r:r+".0"}var Ra="String";function ka(t){var e,r=(e=t).description||e.toString().slice(7,-1);if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(r))throw Ta(r,Sa);return r}function Da(t){switch(typeof t){case"number":if(!y(t))throw Ta(t,pa);return Number.isInteger(t)?Aa(t):wa(t);case"string":return function(t){if(Ea.test(t))throw Ta(t,Ra);return'"'+t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'}(t);case"symbol":return ka(t);case"boolean":return function(t){if("boolean"!=typeof t)throw Ta(t,ga);return t?"?1":"?0"}(t);case"object":if(t instanceof Date)return function(t){return"@"+Aa(t.getTime()/1e3)}(t);if(t instanceof Uint8Array)return _a(t);if(t instanceof ha)return ka(t);default:throw Ta(t,pa)}}function Ia(t){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(t))throw Ta(t,ba);return t}function Pa(t){return null==t?"":Object.entries(t).map((function(t){var e=t[0],r=t[1];return!0===r?";"+Ia(e):";"+Ia(e)+"="+Da(r)})).join("")}function Oa(t){return t instanceof ca?""+Da(t.value)+Pa(t.params):Da(t)}function Ca(t,e){var r;if(void 0===e&&(e={whitespace:!0}),"object"!=typeof t)throw Ta(t,da);var n=t instanceof Map?t.entries():Object.entries(t),i=null!=(r=e)&&r.whitespace?" ":"";return Array.from(n).map((function(t){var e=t[0],r=t[1];r instanceof ca==0&&(r=new ca(r));var n,i=Ia(e);return!0===r.value?i+=Pa(r.params):(i+="=",Array.isArray(r.value)?i+="("+(n=r).value.map(Oa).join(" ")+")"+Pa(n.params):i+=Oa(r)),i})).join(","+i)}var xa=function(t){return"ot"===t||"sf"===t||"st"===t},Ma=function(t){return"number"==typeof t?y(t):null!=t&&""!==t&&!1!==t};var Fa=function(t){return Math.round(t)},Na=function(t){return 100*Fa(t/100)},Ba={br:Fa,d:Fa,bl:Na,dl:Na,mtp:Na,nor:function(t,e){return null!=e&&e.baseUrl&&(t=function(t,e){var r=new URL(t),n=new URL(e);if(r.origin!==n.origin)return t;for(var i=r.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}(t,e.baseUrl)),encodeURIComponent(t)},rtp:Na,tb:Fa};function Ua(t,e){return void 0===e&&(e={}),t?function(t,e){return Ca(t,e)}(function(t,e){var r={};if(null==t||"object"!=typeof t)return r;var n=Object.keys(t).sort(),i=o({},Ba,null==e?void 0:e.formatters),s=null==e?void 0:e.filter;return n.forEach((function(n){if(null==s||!s(n)){var a=t[n],o=i[n];o&&(a=o(a,e)),"v"===n&&1===a||"pr"==n&&1===a||Ma(a)&&(xa(n)&&"string"==typeof a&&(a=new ha(a)),r[n]=a)}})),r}(t,e),o({whitespace:!1},e)):""}function ja(t,e,r){return o(t,function(t,e){var r;if(void 0===e&&(e={}),!t)return{};var n=Object.entries(t),i=Object.entries(ua).concat(Object.entries((null==(r=e)?void 0:r.customHeaderMap)||{})),s=n.reduce((function(t,e){var r,n=e[0],s=e[1],a=(null==(r=i.find((function(t){return t[1].includes(n)})))?void 0:r[0])||aa.REQUEST;return null!=t[a]||(t[a]={}),t[a][n]=s,t}),{});return Object.entries(s).reduce((function(t,r){var n=r[0],i=r[1];return t[n]=Ua(i,e),t}),{})}(e,r))}var Ha="CMCD";var Ga=/CMCD=[^&#]+/;function Va(t,e,r){var n=function(t,e){if(void 0===e&&(e={}),!t)return"";var r=Ua(t,e);return Ha+"="+encodeURIComponent(r)}(e,r);if(!n)return t;if(Ga.test(t))return t.replace(Ga,n);var i=t.includes("?")?"&":"?";return""+t+i+n}var Ka=function(){function t(t){var e=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.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=function(){e.initialized&&(e.starved=!0),e.buffering=!0},this.onPlaying=function(){e.initialized||(e.initialized=!0),e.buffering=!1},this.applyPlaylistData=function(t){try{e.apply(t,{ot:ia.MANIFEST,su:!e.initialized})}catch(t){D.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=function(t){try{var r=t.frag,n=e.hls.levels[r.level],i=e.getObjectType(r),s={d:1e3*r.duration,ot:i};i!==ia.VIDEO&&i!==ia.AUDIO&&i!=ia.MUXED||(s.br=n.bitrate/1e3,s.tb=e.getTopBandwidth(i)/1e3,s.bl=e.getBufferLength(i)),e.apply(t,s)}catch(t){D.warn("Could not generate segment CMCD data.",t)}},this.hls=t;var r=this.config=t.config,n=r.cmcd;null!=n&&(r.pLoader=this.createPlaylistLoader(),r.fLoader=this.createFragmentLoader(),this.sid=n.sessionId||function(){try{return crypto.randomUUID()}catch(n){try{var t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)}catch(t){var r=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var e=(r+16*Math.random())%16|0;return r=Math.floor(r/16),("x"==t?e:3&e|8).toString(16)}))}}}(),this.cid=n.contentId,this.useHeaders=!0===n.useHeaders,this.includeKeys=n.includeKeys,this.registerListeners())}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(b.MEDIA_DETACHED,this.onMediaDetached,this),t.on(b.BUFFER_CREATED,this.onBufferCreated,this)},e.unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(b.MEDIA_DETACHED,this.onMediaDetached,this),t.off(b.BUFFER_CREATED,this.onBufferCreated,this)},e.destroy=function(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=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,n;this.audioBuffer=null==(r=e.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(n=e.tracks.video)?void 0:n.buffer},e.createData=function(){var t;return{v:1,sf:sa.HLS,sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}},e.apply=function(t,e){void 0===e&&(e={}),o(e,this.createData());var r=e.ot===ia.INIT||e.ot===ia.VIDEO||e.ot===ia.MUXED;this.starved&&r&&(e.bs=!0,e.su=!0,this.starved=!1),null==e.su&&(e.su=this.buffering);var n=this.includeKeys;n&&(e=Object.keys(e).reduce((function(t,r){return n.includes(r)&&(t[r]=e[r]),t}),{})),this.useHeaders?(t.headers||(t.headers={}),ja(t.headers,e)):t.url=Va(t.url,e)},e.getObjectType=function(t){var e=t.type;return"subtitle"===e?ia.TIMED_TEXT:"initSegment"===t.sn?ia.INIT:"audio"===e?ia.AUDIO:"main"===e?this.hls.audioTracks.length?ia.VIDEO:ia.MUXED:void 0},e.getTopBandwidth=function(t){var e,r=0,n=this.hls;if(t===ia.AUDIO)e=n.audioTracks;else{var i=n.maxAutoLevel,s=i>-1?i+1:n.levels.length;e=n.levels.slice(0,s)}for(var a,o=p(e);!(a=o()).done;){var l=a.value;l.bitrate>r&&(r=l.bitrate)}return r>0?r:NaN},e.getBufferLength=function(t){var e=this.hls.media,r=t===ia.AUDIO?this.audioBuffer:this.videoBuffer;return r&&e?1e3*rn.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 n=t.prototype;return n.destroy=function(){this.loader.destroy()},n.abort=function(){this.loader.abort()},n.load=function(t,r,n){e(t),this.loader.load(t,r,n)},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 n=t.prototype;return n.destroy=function(){this.loader.destroy()},n.abort=function(){this.loader.abort()},n.load=function(t,r,n){e(t),this.loader.load(t,r,n)},a(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},t}(),$a=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=D.log.bind(D,"[content-steering]:"),this.registerListeners()}var e=t.prototype;return e.registerListeners=function(){var t=this.hls;t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(b.MANIFEST_PARSED,this.onManifestParsed,this),t.on(b.ERROR,this.onError,this)},e.unregisterListeners=function(){var t=this.hls;t&&(t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(b.MANIFEST_PARSED,this.onManifestParsed,this),t.off(b.ERROR,this.onError,this))},e.startLoad=function(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){var t=1e3*this.timeToLoad-(performance.now()-this.updated);if(t>0)return void this.scheduleRefresh(this.uri,t)}this.loadSteeringManifest(this.uri)}},e.stopLoad=function(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()},e.clearTimeout=function(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)},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===Pr){var n=this.levels,i=this.pathwayPriority,s=this.pathwayId;if(e.context){var a=e.context,o=a.groupId,l=a.pathwayId,u=a.type;o&&n?s=this.getPathwayForGroupId(o,u,s):l&&(s=l)}s in this.penalizedPathways||(this.penalizedPathways[s]=performance.now()),!i&&n&&(i=n.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!==s),r.resolved||D.warn("Could not resolve "+e.details+' ("'+e.error.message+'") with content-steering for Pathway: '+s+" levels: "+(n?n.length:n)+" priorities: "+JSON.stringify(i)+" penalized: "+JSON.stringify(this.penalizedPathways))}},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},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,n=performance.now();Object.keys(r).forEach((function(t){n-r[t]>3e5&&delete r[t]}));for(var i=0;i<t.length;i++){var s=t[i];if(!(s in r)){if(s===this.pathwayId)return;var a=this.hls.nextLoadLevel,o=this.hls.levels[a];if((e=this.getLevelsForPathway(s)).length>0){this.log('Setting Pathway to "'+s+'"'),this.pathwayId=s,vr(e),this.hls.trigger(b.LEVELS_UPDATED,{levels:e});var l=this.hls.levels[a];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=a);break}}}},e.getPathwayForGroupId=function(t,e,r){for(var n=this.getLevelsForPathway(r).concat(this.levels||[]),i=0;i<n.length;i++)if(e===Oe&&n[i].hasAudioGroup(t)||e===Ce&&n[i].hasSubtitleGroup(t))return n[i].pathwayId;return r},e.clonePathways=function(t){var e=this,r=this.levels;if(r){var n={},i={};t.forEach((function(t){var s=t.ID,a=t["BASE-ID"],o=t["URI-REPLACEMENT"];if(!r.some((function(t){return t.pathwayId===s}))){var l=e.getLevelsForPathway(a).map((function(t){var e=new O(t.attrs);e["PATHWAY-ID"]=s;var r=e.AUDIO&&e.AUDIO+"_clone_"+s,a=e.SUBTITLES&&e.SUBTITLES+"_clone_"+s;r&&(n[e.AUDIO]=r,e.AUDIO=r),a&&(i[e.SUBTITLES]=a,e.SUBTITLES=a);var l=qa(t.uri,e["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",o),u=new or({attrs:e,audioCodec:t.audioCodec,bitrate:t.bitrate,height:t.height,name:t.name,url:l,videoCodec:t.videoCodec,width:t.width});if(t.audioGroups)for(var c=1;c<t.audioGroups.length;c++)u.addGroupId("audio",t.audioGroups[c]+"_clone_"+s);if(t.subtitleGroups)for(var h=1;h<t.subtitleGroups.length;h++)u.addGroupId("text",t.subtitleGroups[h]+"_clone_"+s);return u}));r.push.apply(r,l),Wa(e.audioTracks,n,o,s),Wa(e.subtitleTracks,i,o,s)}}))}},e.loadSteeringManifest=function(t){var e,r=this,n=this.hls.config,i=n.loader;this.loader&&this.loader.destroy(),this.loader=new i(n);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 s=0|(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate);e.searchParams.set("_HLS_pathway",this.pathwayId),e.searchParams.set("_HLS_throughput",""+s)}var a={responseType:"json",url:e.href},o=n.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},c={onSuccess:function(t,n,i,s){r.log('Loaded steering manifest: "'+e+'"');var a=t.data;if(1===a.VERSION){r.updated=performance.now(),r.timeToLoad=a.TTL;var o=a["RELOAD-URI"],l=a["PATHWAY-CLONES"],u=a["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||i.url),l&&r.clonePathways(l);var c={steeringManifest:a,url:e.toString()};r.hls.trigger(b.STEERING_MANIFEST_LOADED,c),u&&r.updatePathwayPriority(u)}else r.log("Steering VERSION "+a.VERSION+" not supported!")},onError:function(t,e,n,i){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 s=1e3*r.timeToLoad;if(429!==t.code)r.scheduleRefresh(r.uri||e.url,s);else{var a=r.loader;if("function"==typeof(null==a?void 0:a.getResponseHeader)){var o=a.getResponseHeader("Retry-After");o&&(s=1e3*parseFloat(o))}r.log("Steering manifest "+e.url+" rate limited")}},onTimeout:function(t,e,n){r.log("Timeout loading steering manifest ("+e.url+")"),r.scheduleRefresh(r.uri||e.url)}};this.log("Requesting steering manifest: "+e),this.loader.load(a,u,c)},e.scheduleRefresh=function(t,e){var r=this;void 0===e&&(e=1e3*this.timeToLoad),this.clearTimeout(),this.reloadTimer=self.setTimeout((function(){var e,n=null==(e=r.hls)?void 0:e.media;!n||n.ended?r.scheduleRefresh(t,1e3*r.timeToLoad):r.loadSteeringManifest(t)}),e)},t}();function Wa(t,e,r,n){t&&Object.keys(e).forEach((function(i){var s=t.filter((function(t){return t.groupId===i})).map((function(t){var s=o({},t);return s.details=void 0,s.attrs=new O(s.attrs),s.url=s.attrs.URI=qa(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),s.groupId=s.attrs["GROUP-ID"]=e[i],s.attrs["PATHWAY-ID"]=n,s}));t.push.apply(t,s)}))}function qa(t,e,r,n){var i,s=n.HOST,a=n.PARAMS,o=n[r];e&&(i=null==o?void 0:o[e])&&(t=i);var l=new self.URL(t);return s&&!i&&(l.host=s),a&&Object.keys(a).sort().forEach((function(t){t&&l.searchParams.set(t,a[t])})),l.href}var Ya=/^age:\s*[\d.]+\s*$/im,za=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=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new M,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=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&&r){var n=this.loader=new self.XMLHttpRequest,i=this.stats;i.loading.first=0,i.loaded=0,i.aborted=!1;var s=this.xhrSetup;s?Promise.resolve().then((function(){if(t.loader===n&&!t.stats.aborted)return s(n,r.url)})).catch((function(e){if(t.loader===n&&!t.stats.aborted)return n.open("GET",r.url,!0),s(n,r.url)})).then((function(){t.loader!==n||t.stats.aborted||t.openAndSendXhr(n,r,e)})).catch((function(e){t.callbacks.onError({code:n.status,text:e.message},r,n,i)})):this.openAndSendXhr(n,r,e)}},e.openAndSendXhr=function(t,e,r){t.readyState||t.open("GET",e.url,!0);var n=e.headers,i=r.loadPolicy,s=i.maxTimeToFirstByteMs,a=i.maxLoadTimeMs;if(n)for(var o in n)t.setRequestHeader(o,n[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=s&&y(s)?s:a,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 n=e.readyState,i=this.config;if(!r.aborted&&n>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===n)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;var s=e.status,a="text"!==e.responseType;if(s>=200&&s<300&&(a&&e.response||null!==e.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);var o=a?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 c={url:e.responseURL,data:o,code:s};this.callbacks.onSuccess(c,r,t,e)}else{var h=i.loadPolicy.errorRetry;br(h,r.retry,!1,{url:t.url,data:void 0,code:s})?this.retry(h):(D.error(s+" while loading "+t.url),this.callbacks.onError({code:s,text:e.statusText},t,e,r))}}}},e.loadtimeout=function(){if(this.config){var t=this.config.loadPolicy.timeoutRetry;if(br(t,this.stats.retry,!0))this.retry(t);else{var e;D.warn("timeout while loading "+(null==(e=this.context)?void 0:e.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=Er(t,r.retry),r.retry++,D.warn((status?"HTTP Status "+status:"Timeout")+" while loading "+(null==e?void 0: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&&Ya.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}();var Xa=/(\d+)-(\d+)\/(\d+)/,Ja=function(){function t(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||Qa,this.controller=new self.AbortController,this.stats=new M}var e=t.prototype;return e.destroy=function(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null},e.abortInternal=function(){this.controller&&!this.stats.loading.end&&(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 n=this,i=this.stats;if(i.loading.start)throw new Error("Loader can only be used once.");i.loading.start=self.performance.now();var s=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),a=r.onProgress,l="arraybuffer"===t.responseType,u=l?"byteLength":"length",c=e.loadPolicy,h=c.maxTimeToFirstByteMs,d=c.maxLoadTimeMs;this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,s),self.clearTimeout(this.requestTimeout),e.timeout=h&&y(h)?h:d,this.requestTimeout=self.setTimeout((function(){n.abortInternal(),r.onTimeout(i,t,n.response)}),e.timeout),self.fetch(this.request).then((function(s){n.response=n.loader=s;var o=Math.max(self.performance.now(),i.loading.start);if(self.clearTimeout(n.requestTimeout),e.timeout=d,n.requestTimeout=self.setTimeout((function(){n.abortInternal(),r.onTimeout(i,t,n.response)}),d-(o-i.loading.start)),!s.ok){var u=s.status,c=s.statusText;throw new to(c||"fetch, bad network response",u,s)}return i.loading.first=o,i.total=function(t){var e=t.get("Content-Range");if(e){var r=function(t){var e=Xa.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(y(r))return r}var n=t.get("Content-Length");if(n)return parseInt(n)}(s.headers)||i.total,a&&y(e.highWaterMark)?n.loadProgressively(s,i,t,e.highWaterMark,a):l?s.arrayBuffer():"json"===t.responseType?s.json():s.text()})).then((function(s){var o=n.response;if(!o)throw new Error("loader destroyed");self.clearTimeout(n.requestTimeout),i.loading.end=Math.max(self.performance.now(),i.loading.first);var l=s[u];l&&(i.loaded=i.total=l);var c={url:o.url,data:s,code:o.status};a&&!y(e.highWaterMark)&&a(i,t,s,o),r.onSuccess(c,i,t,o)})).catch((function(e){if(self.clearTimeout(n.requestTimeout),!i.aborted){var s=e&&e.code||0,a=e?e.message:null;r.onError({code:s,text:a},t,e?e.details:null,i)}}))},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,n,i){void 0===n&&(n=0);var s=new Cn,a=t.body.getReader();return function o(){return a.read().then((function(a){if(a.done)return s.dataLength&&i(e,r,s.flush(),t),Promise.resolve(new ArrayBuffer(0));var l=a.value,u=l.length;return e.loaded+=u,u<n||s.dataLength?(s.push(l),s.dataLength>=n&&i(e,r,s.flush(),t)):i(e,r,l,t),o()})).catch((function(){return Promise.reject()}))}()},t}();function Qa(t,e){return new self.Request(t.url,e)}var Za,to=function(t){function e(e,r,n){var i;return(i=t.call(this,e)||this).code=void 0,i.details=void 0,i.code=r,i.details=n,i}return l(e,t),e}(d(Error)),eo=/\s/,ro=n(n({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:za,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:Wr,bufferController:is,capLevelController:ta,errorController:Cr,fpsController:ea,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:ot,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:{newCue:function(t,e,r,n){for(var i,s,a,o,l,u=[],c=self.VTTCue||self.TextTrackCue,h=0;h<n.rows.length;h++)if(a=!0,o=0,l="",!(i=n.rows[h]).isEmpty()){for(var d,f=0;f<i.chars.length;f++)eo.test(i.chars[f].uchar)&&a?o++:(l+=i.chars[f].uchar,a=!1);i.cueStartTime=e,e===r&&(r+=1e-4),o>=16?o--:o++;var p=Cs(l.trim()),g=Bs(e,r,p);null!=t&&null!=(d=t.cues)&&d.getCueById(g)||((s=new c(e,r,p)).id=g,s.line=h+1,s.align="left",s.position=10+Math.min(80,10*Math.floor(8*o/32)),u.push(s))}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 He(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:Zi,subtitleTrackController:es,timelineController:Js,audioStreamController:Ji,audioTrackController:Qi,emeController:na,cmcdController:Ka,contentSteeringController:$a});function no(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(no):Object.keys(t).reduce((function(e,r){return e[r]=no(t[r]),e}),{}):t}function io(t){var e=t.loader;e!==Ja&&e!==za?(D.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=Ja,t.progressive=!0,t.enableSoftwareAES=!0,D.log("[config]: Progressive streaming enabled, using FetchLoader"))}var so=function(t){function e(e,r){var n;return(n=t.call(this,e,"[level-controller]")||this)._levels=[],n._firstLevel=-1,n._maxAutoLevel=-1,n._startLevel=void 0,n.currentLevel=null,n.currentLevelIndex=-1,n.manualLevelIndex=-1,n.steering=void 0,n.onParsedComplete=void 0,n.steering=r,n._registerListeners(),n}l(e,t);var r=e.prototype;return r._registerListeners=function(){var t=this.hls;t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(b.LEVEL_LOADED,this.onLevelLoaded,this),t.on(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(b.FRAG_BUFFERED,this.onFragBuffered,this),t.on(b.ERROR,this.onError,this)},r._unregisterListeners=function(){var t=this.hls;t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(b.LEVEL_LOADED,this.onLevelLoaded,this),t.off(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(b.FRAG_BUFFERED,this.onFragBuffered,this),t.off(b.ERROR,this.onError,this)},r.destroy=function(){this._unregisterListeners(),this.steering=null,this.resetLevels(),t.prototype.destroy.call(this)},r.stopLoad=function(){this._levels.forEach((function(t){t.loadError=0,t.fragmentError=0})),t.prototype.stopLoad.call(this)},r.resetLevels=function(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1},r.onManifestLoading=function(t,e){this.resetLevels()},r.onManifestLoaded=function(t,e){var r=this.hls.config.preferManagedMediaSource,n=[],i={},s={},a=!1,o=!1,l=!1;e.levels.forEach((function(t){var e,u,c=t.attrs,h=t.audioCodec,d=t.videoCodec;-1!==(null==(e=h)?void 0:e.indexOf("mp4a.40.34"))&&(Za||(Za=/chrome|firefox/i.test(navigator.userAgent)),Za&&(t.audioCodec=h=void 0)),h&&(t.audioCodec=h=ge(h,r)),0===(null==(u=d)?void 0:u.indexOf("avc1"))&&(d=t.videoCodec=function(t){for(var e=t.split(","),r=0;r<e.length;r++){var n=e[r].split(".");if(n.length>2){var i=n.shift()+".";i+=parseInt(n.shift()).toString(16),i+=("000"+parseInt(n.shift()).toString(16)).slice(-4),e[r]=i}}return e.join(",")}(d));var f=t.width,p=t.height,g=t.unknownCodecs;if(a||(a=!(!f||!p)),o||(o=!!d),l||(l=!!h),!(null!=g&&g.length||h&&!le(h,"audio",r)||d&&!le(d,"video",r))){var v=c.CODECS,m=c["FRAME-RATE"],y=c["HDCP-LEVEL"],E=c["PATHWAY-ID"],S=c.RESOLUTION,b=c["VIDEO-RANGE"],T=(E||".")+"-"+t.bitrate+"-"+S+"-"+m+"-"+v+"-"+b+"-"+y;if(i[T])if(i[T].uri===t.url||t.attrs["PATHWAY-ID"])i[T].addGroupId("audio",c.AUDIO),i[T].addGroupId("text",c.SUBTITLES);else{var _=s[T]+=1;t.attrs["PATHWAY-ID"]=new Array(_+1).join(".");var A=new or(t);i[T]=A,n.push(A)}else{var L=new or(t);i[T]=L,s[T]=1,n.push(L)}}})),this.filterAndSortMediaOptions(n,e,a,o,l)},r.filterAndSortMediaOptions=function(t,e,r,n,i){var s=this,a=[],o=[],l=t;if((r||n)&&i&&(l=l.filter((function(t){var e,r=t.videoCodec,n=t.videoRange,i=t.width,s=t.height;return(!!r||!(!i||!s))&&(!!(e=n)&&er.indexOf(e)>-1)}))),0!==l.length){if(e.audioTracks){var u=this.hls.config.preferManagedMediaSource;ao(a=e.audioTracks.filter((function(t){return!t.audioCodec||le(t.audioCodec,"audio",u)})))}e.subtitles&&ao(o=e.subtitles);var c=l.slice(0);l.sort((function(t,e){if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"])return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&t.height!==e.height)return t.height-e.height;if(t.frameRate!==e.frameRate)return t.frameRate-e.frameRate;if(t.videoRange!==e.videoRange)return er.indexOf(t.videoRange)-er.indexOf(e.videoRange);if(t.videoCodec!==e.videoCodec){var n=he(t.videoCodec),i=he(e.videoCodec);if(n!==i)return i-n}if(t.uri===e.uri&&t.codecSet!==e.codecSet){var s=de(t.codecSet),a=de(e.codecSet);if(s!==a)return a-s}return t.averageBitrate!==e.averageBitrate?t.averageBitrate-e.averageBitrate:0}));var h=c[0];if(this.steering&&(l=this.steering.filterParsedLevels(l)).length!==c.length)for(var d=0;d<c.length;d++)if(c[d].pathwayId===l[0].pathwayId){h=c[d];break}this._levels=l;for(var f=0;f<l.length;f++)if(l[f]===h){var p;this._firstLevel=f;var g=h.bitrate,v=this.hls.bandwidthEstimate;if(this.log("manifest loaded, "+l.length+" level(s) found, first bitrate: "+g),void 0===(null==(p=this.hls.userConfig)?void 0:p.abrEwmaDefaultEstimate)){var m=Math.min(g,this.hls.config.abrEwmaDefaultEstimateMax);m>v&&v===ro.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=m)}break}var y=i&&!n,E={levels:l,audioTracks:a,subtitleTracks:o,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:i,video:n,altAudio:!y&&a.some((function(t){return!!t.url}))};this.hls.trigger(b.MANIFEST_PARSED,E),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}else Promise.resolve().then((function(){if(s.hls){e.levels.length&&s.warn("One or more CODECS in variant not supported: "+JSON.stringify(e.levels[0].attrs));var t=new Error("no level with compatible codecs found in manifest");s.hls.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.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===Pe&&e.context.level===this.level&&this.checkRetry(e)},r.onFragBuffered=function(t,e){var r=e.frag;if(void 0!==r&&r.type===xe){var n=r.elementaryStreams;if(!Object.keys(n).some((function(t){return!!n[t]})))return;var i=this._levels[r.level];null!=i&&i.loadError&&(this.log("Resetting level error count of "+i.loadError+" on frag buffered"),i.loadError=0)}},r.onLevelLoaded=function(t,e){var r,n,i=e.level,s=e.details,a=this._levels[i];if(!a)return this.warn("Invalid level index "+i),void(null!=(n=e.deliveryDirectives)&&n.skip&&(s.deltaUpdateFailed=!0));i===this.currentLevelIndex?(0===a.fragmentError&&(a.loadError=0),this.playlistLoaded(i,e,a.details)):null!=(r=e.deliveryDirectives)&&r.skip&&(s.deltaUpdateFailed=!0)},r.loadPlaylist=function(e){t.prototype.loadPlaylist.call(this);var r=this.currentLevelIndex,n=this.currentLevel;if(n&&this.shouldLoadPlaylist(n)){var i=n.uri;if(e)try{i=e.addDirectives(i)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}var s=n.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:"")+" "+i),this.clearTimer(),this.hls.trigger(b.LEVEL_LOADING,{url:i,level:r,pathwayId:n.attrs["PATHWAY-ID"],id:0,deliveryDirectives:e||null})}},r.removeLevel=function(t){var e,r=this,n=this._levels.filter((function(e,n){return n!==t||(r.steering&&r.steering.removeLevel(e),e===r.currentLevel&&(r.currentLevel=null,r.currentLevelIndex=-1,e.details&&e.details.fragments.forEach((function(t){return t.level=-1}))),!1)}));vr(n),this._levels=n,this.currentLevelIndex>-1&&null!=(e=this.currentLevel)&&e.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(b.LEVELS_UPDATED,{levels:n})},r.onLevelsUpdated=function(t,e){var r=e.levels;this._levels=r},r.checkMaxAutoUpdated=function(){var t=this.hls,e=t.autoLevelCapping,r=t.maxAutoLevel,n=t.maxHdcpLevel;this._maxAutoLevel!==r&&(this._maxAutoLevel=r,this.hls.trigger(b.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:r,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:n}))},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"),n=t<0;if(this.hls.trigger(b.ERROR,{type:T.OTHER_ERROR,details:_.LEVEL_SWITCH_ERROR,level:t,fatal:n,error:r,reason:r.message}),n)return;t=Math.min(t,e.length-1)}var i=this.currentLevelIndex,s=this.currentLevel,a=s?s.attrs["PATHWAY-ID"]:void 0,o=e[t],l=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=o,i!==t||!o.details||!s||a!==l){this.log("Switching to level "+t+" ("+(o.height?o.height+"p ":"")+(o.videoRange?o.videoRange+" ":"")+(o.codecSet?o.codecSet+" ":"")+"@"+o.bitrate+")"+(l?" with Pathway "+l:"")+" from level "+i+(a?" with Pathway "+a:""));var u={level:t,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(b.LEVEL_SWITCHING,u);var c=o.details;if(!c||c.live){var h=this.switchParams(o.uri,null==s?void 0:s.details,c);this.loadPlaylist(h)}}}}},{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.hls.firstAutoLevel}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}(xr);function ao(t){var e={};t.forEach((function(t){var r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++}))}var oo=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){var n;if(t&&t!==(null==(n=r.context)?void 0:n.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,n,i){return void 0===e&&(e=_.KEY_LOAD_ERROR),new pn({type:T.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:i,error:r,networkDetails:n})},e.loadClear=function(t,e){var r=this;if(this.emeController&&this.config.emeEnabled)for(var n=t.sn,i=t.cc,s=function(){var t=e[a];if(i<=t.cc&&("initSegment"===n||"initSegment"===t.sn||n<t.sn))return r.emeController.selectKeySystemFormat(t).then((function(e){t.setKeyFormat(e)})),1},a=0;a<e.length&&!s();a++);},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,n;e&&t.setKeyFormat(e);var i=t.decryptdata;if(!i){var s=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,_.KEY_LOAD_ERROR,s))}var a=i.uri;if(!a)return Promise.reject(this.createKeyLoadError(t,_.KEY_LOAD_ERROR,new Error('Invalid key URI: "'+a+'"')));var o,l=this.keyUriToKeyInfo[a];if(null!=(r=l)&&r.decryptdata.key)return i.key=l.decryptdata.key,Promise.resolve({frag:t,keyInfo:l});if(null!=(n=l)&&n.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 i.key=e.keyInfo.decryptdata.key,{frag:t,keyInfo:l}}))}switch(l=this.keyUriToKeyInfo[a]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===i.keyFormat?this.loadKeyHTTP(l,t):this.loadKeyEME(l,t);case"AES-128":return this.loadKeyHTTP(l,t);default:return Promise.reject(this.createKeyLoadError(t,_.KEY_LOAD_ERROR,new Error('Key supplied with unsupported METHOD: "'+i.method+'"')))}},e.loadKeyEME=function(t,e){var r={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){var n=this.emeController.loadKey(r);if(n)return(t.keyLoadPromise=n.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,i=this.config,s=new(0,i.loader)(i);return e.keyLoader=t.loader=s,t.keyLoadPromise=new Promise((function(a,o){var l={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},u=i.keyLoadPolicy.default,c={loadPolicy:u,timeout:u.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:function(t,e,n,i){var s=n.frag,l=n.keyInfo,u=n.url;if(!s.decryptdata||l!==r.keyUriToKeyInfo[u])return o(r.createKeyLoadError(s,_.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),i));l.decryptdata.key=s.decryptdata.key=new Uint8Array(t.data),s.keyLoader=null,l.loader=null,a({frag:s,keyInfo:l})},onError:function(t,i,s,a){r.resetLoader(i),o(r.createKeyLoadError(e,_.KEY_LOAD_ERROR,new Error("HTTP Error "+t.code+" loading key "+t.text),s,n({url:l.url,data:void 0},t)))},onTimeout:function(t,n,i){r.resetLoader(n),o(r.createKeyLoadError(e,_.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),i))},onAbort:function(t,n,i){r.resetLoader(n),o(r.createKeyLoadError(e,_.INTERNAL_ABORTED,new Error("key loading aborted"),i))}};s.load(l,c,h)}))},e.resetLoader=function(t){var e=t.frag,r=t.keyInfo,n=t.url,i=r.loader;e.keyLoader===i&&(e.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[n],i&&i.destroy()},t}();function lo(){return self.SourceBuffer||self.WebKitSourceBuffer}function uo(){if(!ae())return!1;var t=lo();return!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove}var co=function(){function t(t,e,r,n){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=n}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,n=this.media,i=this.stalled;if(null!==n){var s=n.currentTime,a=n.seeking,o=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,s===t)if(l||o)this.stalled=null;else if(n.paused&&!a||n.ended||0===n.playbackRate||!rn.getBuffered(n).length)this.nudgeRetry=0;else{var u=rn.bufferInfo(n,s,0),c=u.nextStart||0;if(a){var h=u.len>2,d=!c||e&&e.start<=s||c-s>2&&!this.fragmentTracker.getPartialFragment(s);if(h||d)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var f;if(!(u.len>0||c))return;var p=Math.max(c,u.start||0)-s,g=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,v=(null==g||null==(f=g.details)?void 0:f.live)?2*g.details.targetduration:2,m=this.fragmentTracker.getPartialFragment(s);if(p>0&&(p<=v||m))return void(n.paused||this._trySkipBufferHole(m))}var y=self.performance.now();if(null!==i){var E=y-i;if(a||!(E>=250)||(this._reportStall(u),this.media)){var S=rn.bufferInfo(n,s,r.maxBufferHole);this._tryFixBufferStall(S,E)}}else this.stalled=y}else if(this.moved=!0,a||(this.nudgeRetry=0),null!==i){if(this.stallReported){var b=self.performance.now()-i;D.warn("playback not stuck anymore @"+s+", after "+Math.round(b)+"ms"),this.stallReported=!1}this.stalled=null}}},e._tryFixBufferStall=function(t,e){var r=this.config,n=this.fragmentTracker,i=this.media;if(null!==i){var s=i.currentTime,a=n.getPartialFragment(s);if(a&&(this._trySkipBufferHole(a)||!this.media))return;(t.len>r.maxBufferHole||t.nextStart&&t.nextStart-s<r.maxBufferHole)&&e>1e3*r.highBufferWatchdogPeriod&&(D.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 n=new Error("Playback stalling at @"+r.currentTime+" due to low buffer ("+JSON.stringify(t)+")");D.warn(n.message),e.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:t.len})}},e._trySkipBufferHole=function(t){var e=this.config,r=this.hls,n=this.media;if(null===n)return 0;var i=n.currentTime,s=rn.bufferInfo(n,i,0),a=i<s.start?s.start:s.nextStart;if(a){var o=s.len<=e.maxBufferHole,l=s.len>0&&s.len<1&&n.readyState<3,u=a-i;if(u>0&&(o||l)){if(u>e.maxBufferHole){var c=this.fragmentTracker,h=!1;if(0===i){var d=c.getAppendedFrag(0,xe);d&&a<d.end&&(h=!0)}if(!h){var f=t||c.getAppendedFrag(i,xe);if(f){for(var p=!1,g=f.end;g<a;){var v=c.getPartialFragment(g);if(!v){p=!0;break}g+=v.duration}if(p)return 0}}}var m=Math.max(a+.05,i+.1);if(D.warn("skipping hole, adjusting currentTime from "+i+" to "+m),this.moved=!0,this.stalled=null,n.currentTime=m,t&&!t.gap){var y=new Error("fragment loaded with buffer holes, seeking from "+i+" to "+m);r.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:y,reason:y.message,frag:t})}return m}}return 0},e._tryNudgeBuffer=function(){var t=this.config,e=this.hls,r=this.media,n=this.nudgeRetry;if(null!==r){var i=r.currentTime;if(this.nudgeRetry++,n<t.nudgeMaxRetry){var s=i+(n+1)*t.nudgeOffset,a=new Error("Nudging 'currentTime' from "+i+" to "+s);D.warn(a.message),r.currentTime=s,e.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{var o=new Error("Playhead still not moving while enough data buffered @"+i+" after "+t.nudgeMaxRetry+" nudges");D.error(o.message),e.trigger(b.ERROR,{type:T.MEDIA_ERROR,details:_.BUFFER_STALLED_ERROR,error:o,fatal:!0})}}},t}(),ho=function(t){function e(e,r,n){var i;return(i=t.call(this,e,r,n,"[stream-controller]",xe)||this).audioCodecSwap=!1,i.gapController=null,i.level=-1,i._forceStartLoad=!1,i.altAudio=!1,i.audioOnly=!1,i.fragPlaying=null,i.onvplaying=null,i.onvseeked=null,i.fragLastKbps=0,i.couldBacktrack=!1,i.backtrackFragment=null,i.audioCodecSwitch=!1,i.videoBuffer=null,i._registerListeners(),i}l(e,t);var r=e.prototype;return r._registerListeners=function(){var t=this.hls;t.on(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(b.MANIFEST_LOADING,this.onManifestLoading,this),t.on(b.MANIFEST_PARSED,this.onManifestParsed,this),t.on(b.LEVEL_LOADING,this.onLevelLoading,this),t.on(b.LEVEL_LOADED,this.onLevelLoaded,this),t.on(b.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(b.ERROR,this.onError,this),t.on(b.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(b.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(b.BUFFER_CREATED,this.onBufferCreated,this),t.on(b.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(b.FRAG_BUFFERED,this.onFragBuffered,this)},r._unregisterListeners=function(){var t=this.hls;t.off(b.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(b.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(b.MANIFEST_LOADING,this.onManifestLoading,this),t.off(b.MANIFEST_PARSED,this.onManifestParsed,this),t.off(b.LEVEL_LOADED,this.onLevelLoaded,this),t.off(b.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(b.ERROR,this.onError,this),t.off(b.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(b.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(b.BUFFER_CREATED,this.onBufferCreated,this),t.off(b.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(b.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(b.FRAG_BUFFERED,this.onFragBuffered,this)},r.onHandlerDestroying=function(){this._unregisterListeners(),t.prototype.onHandlerDestroying.call(this)},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 n=r.startLevel;-1===n&&(r.config.testBandwidth&&this.levels.length>1?(n=0,this.bitrateTest=!0):n=r.firstAutoLevel),r.nextLoadLevel=n,this.level=r.loadLevel,this.loadedmetadata=!1}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=bn,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Sn},r.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},r.doTick=function(){switch(this.state){case Pn:var t=this.levels,e=this.level,r=null==t?void 0:t[e],n=null==r?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=bn;break}if(this.hls.nextLoadLevel!==this.level){this.state=bn;break}break;case An:var i,s=self.performance.now(),a=this.retryDate;if(!a||s>=a||null!=(i=this.media)&&i.seeking){var o=this.levels,l=this.level,u=null==o?void 0:o[l];this.resetStartWhenNotLoaded(u||null),this.state=bn}}this.state===bn&&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,n=this.media;if(null!==e&&(n||!this.startFragRequested&&t.config.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)){var i=t.nextLoadLevel;if(null!=r&&r[i]){var s=r[i],a=this.getMainFwdBufferInfo();if(null!==a){var o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){var l={};return this.altAudio&&(l.type="video"),this.hls.trigger(b.BUFFER_EOS,l),void(this.state=kn)}t.loadLevel!==i&&-1===t.manualLevel&&this.log("Adapting to level "+i+" from level "+this.level),this.level=t.nextLoadLevel=i;var u=s.details;if(!u||this.state===Pn||u.live&&this.levelLastLoaded!==s)return this.level=i,void(this.state=Pn);var c=a.len,h=this.getMaxBufferLength(s.maxBitrate);if(!(c>=h)){this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);var d=this.backtrackFragment?this.backtrackFragment.start:a.end,f=this.getNextFragment(d,u);if(this.couldBacktrack&&!this.fragPrevious&&f&&"initSegment"!==f.sn&&this.fragmentTracker.getState(f)!==Jr){var p,g=(null!=(p=this.backtrackFragment)?p:f).sn-u.startSN,v=u.fragments[g-1];v&&f.cc===v.cc&&(f=v,this.fragmentTracker.removeFragment(v))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,d)){if(!f.gap){var m=this.audioOnly&&!this.altAudio?F:N,y=(m===N?this.videoBuffer:this.mediaBuffer)||this.media;y&&this.afterBufferFlushed(y,m,xe)}f=this.getNextFragmentLoopLoading(f,u,a,xe,h)}f&&(!f.initSegment||f.initSegment.data||this.bitrateTest||(f=f.initSegment),this.loadFragment(f,s,d))}}}}},r.loadFragment=function(e,r,n){var i=this.fragmentTracker.getState(e);this.fragCurrent=e,i===Yr||i===Xr?"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,n)):this.clearTrackerIfNeeded(e)},r.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,xe)},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,n=this.getAppendedFrag(e.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);var i=this.getLevelDetails();if(null!=i&&i.live){var s=this.getMainFwdBufferInfo();if(!s||s.len<2*i.targetduration)return}if(!e.paused&&t){var a=t[this.hls.nextLoadLevel],o=this.fragLastKbps;r=o&&this.fragCurrent?this.fragCurrent.duration*a.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 c=u.maxStartPTS?u.maxStartPTS:u.start,h=u.duration,d=Math.max(l.end,c+Math.min(Math.max(h-this.config.maxFragLookUpTolerance,h*(this.couldBacktrack?.5:.125)),h*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(d,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 Tn:case _n:case An:case wn:case Rn:this.state=bn}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 n=r.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),n.addEventListener("playing",this.onvplaying),n.addEventListener("seeked",this.onvseeked),this.gapController=new co(this.config,n,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;y(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(b.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1},r.onManifestParsed=function(t,e){var r,n,i=!1,s=!1;e.levels.forEach((function(t){var e=t.audioCodec;e&&(i=i||-1!==e.indexOf("mp4a.40.2"),s=s||-1!==e.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=i&&s&&!("function"==typeof(null==(n=lo())||null==(r=n.prototype)?void 0:r.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===bn){var n=r[e.level];(!n.details||n.details.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(n.details))&&(this.state=Pn)}},r.onLevelLoaded=function(t,e){var r,n=this.levels,i=e.level,s=e.details,a=s.totalduration;if(n){this.log("Level "+i+" loaded ["+s.startSN+","+s.endSN+"]"+(s.lastPartSn?"[part-"+s.lastPartSn+"-"+s.lastPartIndex+"]":"")+", cc ["+s.startCC+", "+s.endCC+"] duration:"+a);var o=n[i],l=this.fragCurrent;!l||this.state!==_n&&this.state!==An||l.level!==e.level&&l.loader&&this.abortCurrentFrag();var u=0;if(s.live||null!=(r=o.details)&&r.live){var c;if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;u=this.alignPlaylists(s,o.details,null==(c=this.levelLastLoaded)?void 0:c.details)}if(o.details=s,this.levelLastLoaded=o,this.hls.trigger(b.LEVEL_UPDATED,{details:s,level:i}),this.state===Pn){if(this.waitForCdnTuneIn(s))return;this.state=bn}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,u),this.tick()}else this.warn("Levels were reset while loading level "+i)},r._handleFragmentLoadProgress=function(t){var e,r=t.frag,n=t.part,i=t.payload,s=this.levels;if(s){var a=s[r.level],o=a.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=a.videoCodec,u=o.PTSKnown||!o.live,c=null==(e=r.initSegment)?void 0:e.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new qi(this.hls,xe,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=-1!==f,g=new nn(r.level,r.sn,r.stats.chunkCount,i.byteLength,f,p),v=this.initPTS[r.cc];d.push(i,c,h,l,r,n,o.totalduration,u,g,v)}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 n=this.fragCurrent;n&&(this.log("Switching to main audio track, cancel main fragment load"),n.abortRequests(),this.fragmentTracker.removeFragment(n)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var i=this.hls;r&&(i.trigger(b.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),i.trigger(b.AUDIO_TRACK_SWITCHED,e)}},r.onAudioTrackSwitched=function(t,e){var r=e.id,n=!!this.hls.audioTracks[r].url;if(n){var i=this.videoBuffer;i&&this.mediaBuffer!==i&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=i)}this.altAudio=n,this.tick()},r.onBufferCreated=function(t,e){var r,n,i=e.tracks,s=!1;for(var a in i){var o=i[a];if("main"===o.id){if(n=a,r=o,"video"===a){var l=i[a];l&&(this.videoBuffer=l.buffer)}}else s=!0}s&&r?(this.log("Alternate track found, use "+n+".buffered to schedule main fragment loading"),this.mediaBuffer=r.buffer):this.mediaBuffer=this.media},r.onFragBuffered=function(t,e){var r=e.frag,n=e.part;if(!r||r.type===xe){if(this.fragContextChanged(r))return this.warn("Fragment "+r.sn+(n?" p: "+n.index:"")+" of level "+r.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===Rn&&(this.state=bn));var i=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}},r.onError=function(t,e){var r;if(e.fatal)this.state=Dn;else switch(e.details){case _.FRAG_GAP:case _.FRAG_PARSING_ERROR:case _.FRAG_DECRYPT_ERROR:case _.FRAG_LOAD_ERROR:case _.FRAG_LOAD_TIMEOUT:case _.KEY_LOAD_ERROR:case _.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(xe,e);break;case _.LEVEL_LOAD_ERROR:case _.LEVEL_LOAD_TIMEOUT:case _.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Pn||(null==(r=e.context)?void 0:r.type)!==Pe||(this.state=bn);break;case _.BUFFER_APPEND_ERROR:case _.BUFFER_FULL_ERROR:if(!e.parent||"main"!==e.parent)return;if(e.details===_.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case _.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}},r.checkBuffer=function(){var t=this.media,e=this.gapController;if(t&&e&&t.readyState){if(this.loadedmetadata||!rn.getBuffered(t).length){var r=this.state!==bn?this.fragCurrent:null;e.poll(this.lastCurrentTime,r)}this.lastCurrentTime=t.currentTime}},r.onFragLoadEmergencyAborted=function(){this.state=bn,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},r.onBufferFlushed=function(t,e){var r=e.type;if(r!==F||this.audioOnly&&!this.altAudio){var n=(r===N?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(n,r,xe),this.tick()}},r.onLevelsUpdated=function(t,e){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),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 n=rn.getBuffered(t),i=(n.length?n.start(0):0)-r;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(this.log("adjusting start position by "+i+" to match buffer start"),r+=i,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(n){var i=r.hls;if(n&&!r.fragContextChanged(t)){e.fragmentError=0,r.state=bn,r.startFragRequested=!1,r.bitrateTest=!1;var s=t.stats;s.parsing.start=s.parsing.end=s.buffering.start=s.buffering.end=self.performance.now(),i.trigger(b.FRAG_LOADED,n),t.bitrateTest=!1}}))},r._handleTransmuxComplete=function(t){var e,r="main",n=this.hls,i=t.remuxResult,s=t.chunkMeta,a=this.getCurrentContext(s);if(a){var o=a.frag,l=a.part,u=a.level,c=i.video,h=i.text,d=i.id3,f=i.initSegment,p=u.details,g=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=wn,f){if(null!=f&&f.tracks){var v=o.initSegment||o;this._bufferInitSegment(u,f.tracks,v,s),n.trigger(b.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:f.tracks})}var m=f.initPTS,E=f.timescale;y(m)&&(this.initPTS[o.cc]={baseTime:m,timescale:E},n.trigger(b.INIT_PTS_FOUND,{frag:o,id:r,initPTS:m,timescale:E}))}if(c&&p&&"initSegment"!==o.sn){var S=p.fragments[o.sn-1-p.startSN],T=o.sn===p.startSN,_=!S||o.cc>S.cc;if(!1!==i.independent){var A=c.startPTS,L=c.endPTS,w=c.startDTS,R=c.endDTS;if(l)l.elementaryStreams[c.type]={startPTS:A,endPTS:L,startDTS:w,endDTS:R};else if(c.firstKeyFrame&&c.independent&&1===s.id&&!_&&(this.couldBacktrack=!0),c.dropped&&c.independent){var k=this.getMainFwdBufferInfo(),D=(k?k.end:this.getLoadPosition())+this.config.maxBufferHole,I=c.firstKeyFramePTS?c.firstKeyFramePTS:A;if(!T&&D<I-this.config.maxBufferHole&&!_)return void this.backtrack(o);_&&(o.gap=!0),o.setElementaryStreamInfo(c.type,o.start,L,o.start,R,!0)}else T&&A>2&&(o.gap=!0);o.setElementaryStreamInfo(c.type,A,L,w,R),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,l,s,T||_)}else{if(!T&&!_)return void this.backtrack(o);o.gap=!0}}if(g){var P=g.startPTS,O=g.endPTS,C=g.startDTS,x=g.endDTS;l&&(l.elementaryStreams[F]={startPTS:P,endPTS:O,startDTS:C,endDTS:x}),o.setElementaryStreamInfo(F,P,O,C,x),this.bufferFragmentData(g,o,l,s)}if(p&&null!=d&&null!=(e=d.samples)&&e.length){var M={id:r,frag:o,details:p,samples:d.samples};n.trigger(b.FRAG_PARSING_METADATA,M)}if(p&&h){var N={id:r,frag:o,details:p,samples:h.samples};n.trigger(b.FRAG_PARSING_USERDATA,N)}}}else this.resetWhenMissingContext(s)},r._bufferInitSegment=function(t,e,r,n){var i=this;if(this.state===wn){this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;var s=e.audio,a=e.video,o=e.audiovideo;if(s){var l=t.audioCodec,u=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){l&&(l=-1!==l.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");var c=s.metadata;c&&"channelCount"in c&&1!==(c.channelCount||1)&&-1===u.indexOf("firefox")&&(l="mp4a.40.5")}l&&-1!==l.indexOf("mp4a.40.5")&&-1!==u.indexOf("android")&&"audio/mpeg"!==s.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+'"'),s.levelCodec=l,s.id="main",this.log("Init audio buffer, container:"+s.container+", codecs[selected/level/parsed]=["+(l||"")+"/"+(t.audioCodec||"")+"/"+s.codec+"]")}a&&(a.levelCodec=t.videoCodec,a.id="main",this.log("Init video buffer, container:"+a.container+", codecs[level/parsed]=["+(t.videoCodec||"")+"/"+a.codec+"]")),o&&this.log("Init audiovideo buffer, container:"+o.container+", codecs[level/parsed]=["+t.codecs+"/"+o.codec+"]"),this.hls.trigger(b.BUFFER_CODECS,e),Object.keys(e).forEach((function(t){var s=e[t].initSegment;null!=s&&s.byteLength&&i.hls.trigger(b.BUFFER_APPENDING,{type:t,data:s,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tickImmediate()}},r.getMainFwdBufferInfo=function(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,xe)},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=bn},r.checkFragmentChanged=function(){var t=this.media,e=null;if(t&&t.readyState>1&&!1===t.seeking){var r=t.currentTime;if(rn.isBuffered(t,r)?e=this.getAppendedFrag(r):rn.isBuffered(t,r+.1)&&(e=this.getAppendedFrag(r+.1)),e){this.backtrackFragment=null;var n=this.fragPlaying,i=e.level;n&&e.sn===n.sn&&n.level===i||(this.fragPlaying=e,this.hls.trigger(b.FRAG_CHANGED,{frag:e}),n&&n.level===i||this.hls.trigger(b.LEVEL_SWITCHED,{level:i}))}}},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&&y(e)&&y(r.programDateTime)){var n=r.programDateTime+1e3*(e-r.start);return new Date(n)}}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}(On),fo=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.started=!1,this._emitter=new Vi,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,k(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=no(t),i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((function(t){var n=("level"===t?"playlist":t)+"LoadPolicy",s=void 0===e[n],a=[];i.forEach((function(i){var o=t+"Loading"+i,l=e[o];if(void 0!==l&&s){a.push(o);var u=r[n].default;switch(e[n]={default:u},i){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}}})),a.length&&D.warn('hls.js config: "'+a.join('", "')+'" setting(s) are deprecated, use "'+n+'": '+JSON.stringify(e[n]))})),n(n({},r),e)}(t.DefaultConfig,e);this.userConfig=e,r.progressive&&io(r);var i=r.abrController,s=r.bufferController,a=r.capLevelController,o=r.errorController,l=r.fpsController,u=new o(this),c=this.abrController=new i(this),h=this.bufferController=new s(this),d=this.capLevelController=new a(this),f=new l(this),p=new Ue(this),g=new Qe(this),v=r.contentSteeringController,m=v?new v(this):null,y=this.levelController=new so(this,m),E=new Qr(this),S=new oo(this.config),T=this.streamController=new ho(this,E,S);d.setStreamController(T),f.setStreamController(T);var _=[p,y,T];m&&_.splice(1,0,m),this.networkControllers=_;var A=[c,h,d,f,g,E];this.audioTrackController=this.createController(r.audioTrackController,_);var L=r.audioStreamController;L&&_.push(new L(this,E,S)),this.subtitleTrackController=this.createController(r.subtitleTrackController,_);var w=r.subtitleStreamController;w&&_.push(new w(this,E,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(Ze,A),this.coreComponents=A,_.push(u);var R=u.onErrorOut;"function"==typeof R&&this.on(b.ERROR,R,u)}t.isMSESupported=function(){return uo()},t.isSupported=function(){return function(){if(!uo())return!1;var t=ae();return"function"==typeof(null==t?void 0:t.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((function(e){return t.isTypeSupported(ce(e,"video"))}))||["mp4a.40.2","fLaC"].some((function(e){return t.isTypeSupported(ce(e,"audio"))})))}()},t.getMediaSource=function(){return ae()};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,n){void 0===r&&(r=this),this._emitter.off(t,e,r,n)},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){if(D.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),!this.triggeringException){this.triggeringException=!0;var r=t===b.ERROR;this.trigger(b.ERROR,{type:T.OTHER_ERROR,details:_.INTERNAL_EXCEPTION,fatal:r,event:t,error:e}),this.triggeringException=!1}}return!1},e.listenerCount=function(t){return this._emitter.listenerCount(t)},e.destroy=function(){D.log("destroy"),this.trigger(b.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){D.log("attachMedia"),this._media=t,this.trigger(b.MEDIA_ATTACHING,{media:t})},e.detachMedia=function(){D.log("detachMedia"),this.trigger(b.MEDIA_DETACHING,void 0),this._media=null},e.loadSource=function(t){this.stopLoad();var e=this.media,r=this.url,n=this.url=m.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,D.log("loadSource:"+n),e&&r&&(r!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(b.MANIFEST_LOADING,{url:t})},e.startLoad=function(t){void 0===t&&(t=-1),D.log("startLoad("+t+")"),this.started=!0,this.networkControllers.forEach((function(e){e.startLoad(t)}))},e.stopLoad=function(){D.log("stopLoad"),this.started=!1,this.networkControllers.forEach((function(t){t.stopLoad()}))},e.resumeBuffering=function(){this.started&&this.networkControllers.forEach((function(t){"fragmentLoader"in t&&t.startLoad(-1)}))},e.pauseBuffering=function(){this.networkControllers.forEach((function(t){"fragmentLoader"in t&&t.stopLoad()}))},e.swapAudioCodec=function(){D.log("swapAudioCodec"),this.streamController.swapAudioCodec()},e.recoverMediaError=function(){D.log("recoverMediaError");var t=this._media;this.detachMedia(),t&&this.attachMedia(t)},e.removeLevel=function(t){this.levelController.removeLevel(t)},e.setAudioOption=function(t){var e;return null==(e=this.audioTrackController)?void 0:e.setAudioOption(t)},e.setSubtitleOption=function(t){var e;return null==(e=this.subtitleTrackController)||e.setSubtitleOption(t),null},a(t,[{key:"levels",get:function(){return this.levelController.levels||[]}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){D.log("set currentLevel:"+t),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){D.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){D.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){D.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){var t=this.levelController.startLevel;return-1===t&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t},set:function(t){D.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&&(D.log("set autoLevelCapping:"+t),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}},{key:"bandwidthEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimate():NaN},set:function(t){this.abrController.resetEstimator(t)}},{key:"ttfbEstimate",get:function(){var t=this.abrController.bwEstimator;return t?t.getEstimateTTFB():NaN}},{key:"maxHdcpLevel",get:function(){return this._maxHdcpLevel},set:function(t){(function(t){return tr.indexOf(t)>-1})(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"minAutoLevel",get:function(){var t=this.levels,e=this.config.minAutoBitrate;if(!t)return 0;for(var r=t.length,n=0;n<r;n++)if(t[n].maxBitrate>=e)return n;return 0}},{key:"maxAutoLevel",get:function(){var t,e=this.levels,r=this.autoLevelCapping,n=this.maxHdcpLevel;if(t=-1===r&&null!=e&&e.length?e.length-1:r,n)for(var i=t;i--;){var s=e[i].attrs["HDCP-LEVEL"];if(s&&s<=n)return i}return t}},{key:"firstAutoLevel",get:function(){return this.abrController.firstAutoLevel}},{key:"nextAutoLevel",get:function(){return this.abrController.nextAutoLevel},set:function(t){this.abrController.nextAutoLevel=t}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"mainForwardBufferInfo",get:function(){return this.streamController.getMainFwdBufferInfo()}},{key:"allAudioTracks",get:function(){var t=this.audioTrackController;return t?t.allAudioTracks:[]}},{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:"allSubtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}},{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(){return"1.5.17"}},{key:"Events",get:function(){return b}},{key:"ErrorTypes",get:function(){return T}},{key:"ErrorDetails",get:function(){return _}},{key:"DefaultConfig",get:function(){return t.defaultConfig?t.defaultConfig:ro},set:function(e){t.defaultConfig=e}}]),t}();return fo.defaultConfig=void 0,fo}()}(!1)},5194:(t,e,r)=>{var n;r.amdD,void 0===(n=function(){var t=function(t){return Number.prototype.toString.call(t,36).toUpperCase()},e=function(t){return parseInt(t,36)},r=Array.prototype.indexOf||function(t,e){for(var r=e||0,n=this.length;r<n;r++)if(this[r]===t)return r;return-1};return{JSON,pack:function(e,n){var i=(n=n||{}).verbose||!1;i&&console.log("Normalize the JSON Object"),e="string"==typeof e?this.JSON.parse(e):e,i&&console.log("Creating a empty dictionary");var s={strings:[],integers:[],floats:[]};i&&console.log("Creating the AST");var a=function e(n){i&&console.log("Calling recursiveAstBuilder with "+this.JSON.stringify(n));var a,o,l=typeof n;if(null===n)return{type:"null",index:-3};if(void 0===n)return{type:"undefined",index:-5};if(n instanceof Array){var u=["@"];for(var c in n)n.hasOwnProperty(c)&&u.push(e(n[c]));return u}if("object"===l){for(var h in u=["$"],n)n.hasOwnProperty(h)&&(u.push(e(h)),u.push(e(n[h])));return u}if(""===n)return{type:"empty",index:-4};if("string"===l)return-1==(a=r.call(s.strings,n))&&(s.strings.push("string"!=typeof(o=n)?o:o.replace(/[\+ \|\^\%]/g,(function(t){return{" ":"+","+":"%2B","|":"%7C","^":"%5E","%":"%25"}[t]}))),a=s.strings.length-1),{type:"strings",index:a};if("number"===l&&n%1==0)return-1==(a=r.call(s.integers,n))&&(s.integers.push(t(n)),a=s.integers.length-1),{type:"integers",index:a};if("number"===l)return-1==(a=r.call(s.floats,n))&&(s.floats.push(n),a=s.floats.length-1),{type:"floats",index:a};if("boolean"===l)return{type:"boolean",index:n?-1:-2};throw new Error("Unexpected argument of type "+typeof n)}(e),o=s.strings.length,l=s.integers.length;s.floats.length,i&&console.log("Parsing the dictionary");var u=s.strings.join("|");return u+="^"+s.integers.join("|"),u+="^"+s.floats.join("|"),i&&console.log("Parsing the structure"),u+="^"+function e(r){if(i&&console.log("Calling a recursiveParser with "+this.JSON.stringify(r)),r instanceof Array){var n=r.shift();for(var s in r)r.hasOwnProperty(s)&&(n+=e(r[s])+"|");return("|"===n[n.length-1]?n.slice(0,-1):n)+"]"}var a=r.type,u=r.index;if("strings"===a)return t(u);if("integers"===a)return t(o+u);if("floats"===a)return t(o+l+u);if("boolean"===a)return r.index;if("null"===a)return-3;if("undefined"===a)return-5;if("empty"===a)return-4;throw new TypeError("The item is alien!")}(a),i&&console.log("Ending parser"),n.debug?{dictionary:s,ast:a,packed:u}:u},unpack:function(t,r){r=r||{};var n=t.split("^");r.verbose&&console.log("Building dictionary");var i,s=[],a=n[0];if(""!==a){a=a.split("|"),r.verbose&&console.log("Parse the strings dictionary");for(var o=0,l=a.length;o<l;o++)s.push("string"!=typeof(i=a[o])?i:i.replace(/\+|%2B|%7C|%5E|%25/g,(function(t){return{"+":" ","%2B":"+","%7C":"|","%5E":"^","%25":"%"}[t]})))}if(""!==(a=n[1]))for(a=a.split("|"),r.verbose&&console.log("Parse the integers dictionary"),o=0,l=a.length;o<l;o++)s.push(e(a[o]));if(""!==(a=n[2]))for(a=a.split("|"),r.verbose&&console.log("Parse the floats dictionary"),o=0,l=a.length;o<l;o++)s.push(parseFloat(a[o]));a=null,r.verbose&&console.log("Tokenizing the structure");var u="",c=[],h=n[3].length;for(o=0;o<h;o++){var d=n[3].charAt(o);"|"===d||"$"===d||"@"===d||"]"===d?(u&&(c.push(e(u)),u=""),"|"!==d&&c.push(d)):u+=d}var f=c.length,p=0;return r.verbose&&console.log("Starting recursive parser"),function t(){var e=c[p++];if(r.verbose&&console.log("Reading collection type "+("$"===e?"object":"Array")),"@"===e){for(var n=[];p<f;p++){var i=c[p];if(r.verbose&&console.log("Read "+i+" symbol"),"]"===i)return n;if("@"===i||"$"===i)n.push(t());else switch(i){case-1:n.push(!0);break;case-2:n.push(!1);break;case-3:n.push(null);break;case-5:n.push(void 0);break;case-4:n.push("");break;default:n.push(s[i])}}return r.verbose&&console.log("Parsed "+this.JSON.stringify(n)),n}if("$"===e){for(n={};p<f;p++){var a=c[p];if("]"===a)return n;if(a=-4===a?"":s[a],"@"===(i=c[++p])||"$"===i)n[a]=t();else switch(i){case-1:n[a]=!0;break;case-2:n[a]=!1;break;case-3:n[a]=null;break;case-5:n[a]=void 0;break;case-4:n[a]="";break;default:n[a]=s[i]}}return r.verbose&&console.log("Parsed "+this.JSON.stringify(n)),n}throw new TypeError("Bad token "+e+" isn't a type")}()}}}.apply(e,[]))||(t.exports=n)},6486:function(t,e,r){var n;t=r.nmd(t),function(){var i,s="Expected a function",a="__lodash_hash_undefined__",o="__lodash_placeholder__",l=32,u=128,c=1/0,h=9007199254740991,d=NaN,f=4294967295,p=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],g="[object Arguments]",v="[object Array]",m="[object Boolean]",y="[object Date]",E="[object Error]",S="[object Function]",b="[object GeneratorFunction]",T="[object Map]",_="[object Number]",A="[object Object]",L="[object Promise]",w="[object RegExp]",R="[object Set]",k="[object String]",D="[object Symbol]",I="[object WeakMap]",P="[object ArrayBuffer]",O="[object DataView]",C="[object Float32Array]",x="[object Float64Array]",M="[object Int8Array]",F="[object Int16Array]",N="[object Int32Array]",B="[object Uint8Array]",U="[object Uint8ClampedArray]",j="[object Uint16Array]",H="[object Uint32Array]",G=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,K=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,W=/[&<>"']/g,q=RegExp($.source),Y=RegExp(W.source),z=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,rt=RegExp(et.source),nt=/^\s+/,it=/\s/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,at=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ut=/[()=,{}\[\]\/\s]/,ct=/\\(\\)?/g,ht=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,pt=/^0b[01]+$/i,gt=/^\[object .+?Constructor\]$/,vt=/^0o[0-7]+$/i,mt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Et=/($^)/,St=/['\n\r\u2028\u2029\\]/g,bt="\\ud800-\\udfff",Tt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_t="\\u2700-\\u27bf",At="a-z\\xdf-\\xf6\\xf8-\\xff",Lt="A-Z\\xc0-\\xd6\\xd8-\\xde",wt="\\ufe0e\\ufe0f",Rt="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",kt="["+bt+"]",Dt="["+Rt+"]",It="["+Tt+"]",Pt="\\d+",Ot="["+_t+"]",Ct="["+At+"]",xt="[^"+bt+Rt+Pt+_t+At+Lt+"]",Mt="\\ud83c[\\udffb-\\udfff]",Ft="[^"+bt+"]",Nt="(?:\\ud83c[\\udde6-\\uddff]){2}",Bt="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Lt+"]",jt="\\u200d",Ht="(?:"+Ct+"|"+xt+")",Gt="(?:"+Ut+"|"+xt+")",Vt="(?:['’](?:d|ll|m|re|s|t|ve))?",Kt="(?:['’](?:D|LL|M|RE|S|T|VE))?",$t="(?:"+It+"|"+Mt+")?",Wt="["+wt+"]?",qt=Wt+$t+"(?:"+jt+"(?:"+[Ft,Nt,Bt].join("|")+")"+Wt+$t+")*",Yt="(?:"+[Ot,Nt,Bt].join("|")+")"+qt,zt="(?:"+[Ft+It+"?",It,Nt,Bt,kt].join("|")+")",Xt=RegExp("['’]","g"),Jt=RegExp(It,"g"),Qt=RegExp(Mt+"(?="+Mt+")|"+zt+qt,"g"),Zt=RegExp([Ut+"?"+Ct+"+"+Vt+"(?="+[Dt,Ut,"$"].join("|")+")",Gt+"+"+Kt+"(?="+[Dt,Ut+Ht,"$"].join("|")+")",Ut+"?"+Ht+"+"+Vt,Ut+"+"+Kt,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Pt,Yt].join("|"),"g"),te=RegExp("["+jt+bt+Tt+wt+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,re=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],ne=-1,ie={};ie[C]=ie[x]=ie[M]=ie[F]=ie[N]=ie[B]=ie[U]=ie[j]=ie[H]=!0,ie[g]=ie[v]=ie[P]=ie[m]=ie[O]=ie[y]=ie[E]=ie[S]=ie[T]=ie[_]=ie[A]=ie[w]=ie[R]=ie[k]=ie[I]=!1;var se={};se[g]=se[v]=se[P]=se[O]=se[m]=se[y]=se[C]=se[x]=se[M]=se[F]=se[N]=se[T]=se[_]=se[A]=se[w]=se[R]=se[k]=se[D]=se[B]=se[U]=se[j]=se[H]=!0,se[E]=se[S]=se[I]=!1;var ae={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},oe=parseFloat,le=parseInt,ue="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,ce="object"==typeof self&&self&&self.Object===Object&&self,he=ue||ce||Function("return this")(),de=e&&!e.nodeType&&e,fe=de&&t&&!t.nodeType&&t,pe=fe&&fe.exports===de,ge=pe&&ue.process,ve=function(){try{return fe&&fe.require&&fe.require("util").types||ge&&ge.binding&&ge.binding("util")}catch(t){}}(),me=ve&&ve.isArrayBuffer,ye=ve&&ve.isDate,Ee=ve&&ve.isMap,Se=ve&&ve.isRegExp,be=ve&&ve.isSet,Te=ve&&ve.isTypedArray;function _e(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}function Ae(t,e,r,n){for(var i=-1,s=null==t?0:t.length;++i<s;){var a=t[i];e(n,a,r(a),t)}return n}function Le(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t}function we(t,e){for(var r=null==t?0:t.length;r--&&!1!==e(t[r],r,t););return t}function Re(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(!e(t[r],r,t))return!1;return!0}function ke(t,e){for(var r=-1,n=null==t?0:t.length,i=0,s=[];++r<n;){var a=t[r];e(a,r,t)&&(s[i++]=a)}return s}function De(t,e){return!(null==t||!t.length)&&Ue(t,e,0)>-1}function Ie(t,e,r){for(var n=-1,i=null==t?0:t.length;++n<i;)if(r(e,t[n]))return!0;return!1}function Pe(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i}function Oe(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t}function Ce(t,e,r,n){var i=-1,s=null==t?0:t.length;for(n&&s&&(r=t[++i]);++i<s;)r=e(r,t[i],i,t);return r}function xe(t,e,r,n){var i=null==t?0:t.length;for(n&&i&&(r=t[--i]);i--;)r=e(r,t[i],i,t);return r}function Me(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1}var Fe=Ve("length");function Ne(t,e,r){var n;return r(t,(function(t,r,i){if(e(t,r,i))return n=r,!1})),n}function Be(t,e,r,n){for(var i=t.length,s=r+(n?1:-1);n?s--:++s<i;)if(e(t[s],s,t))return s;return-1}function Ue(t,e,r){return e==e?function(t,e,r){for(var n=r-1,i=t.length;++n<i;)if(t[n]===e)return n;return-1}(t,e,r):Be(t,He,r)}function je(t,e,r,n){for(var i=r-1,s=t.length;++i<s;)if(n(t[i],e))return i;return-1}function He(t){return t!=t}function Ge(t,e){var r=null==t?0:t.length;return r?We(t,e)/r:d}function Ve(t){return function(e){return null==e?i:e[t]}}function Ke(t){return function(e){return null==t?i:t[e]}}function $e(t,e,r,n,i){return i(t,(function(t,i,s){r=n?(n=!1,t):e(r,t,i,s)})),r}function We(t,e){for(var r,n=-1,s=t.length;++n<s;){var a=e(t[n]);a!==i&&(r=r===i?a:r+a)}return r}function qe(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n}function Ye(t){return t?t.slice(0,hr(t)+1).replace(nt,""):t}function ze(t){return function(e){return t(e)}}function Xe(t,e){return Pe(e,(function(e){return t[e]}))}function Je(t,e){return t.has(e)}function Qe(t,e){for(var r=-1,n=t.length;++r<n&&Ue(e,t[r],0)>-1;);return r}function Ze(t,e){for(var r=t.length;r--&&Ue(e,t[r],0)>-1;);return r}var tr=Ke({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",Ĳ:"IJ",ĳ:"ij",Œ:"Oe",œ:"oe",ŉ:"'n",ſ:"s"}),er=Ke({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"});function rr(t){return"\\"+ae[t]}function nr(t){return te.test(t)}function ir(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r}function sr(t,e){return function(r){return t(e(r))}}function ar(t,e){for(var r=-1,n=t.length,i=0,s=[];++r<n;){var a=t[r];a!==e&&a!==o||(t[r]=o,s[i++]=r)}return s}function or(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r}function lr(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=[t,t]})),r}function ur(t){return nr(t)?function(t){for(var e=Qt.lastIndex=0;Qt.test(t);)++e;return e}(t):Fe(t)}function cr(t){return nr(t)?function(t){return t.match(Qt)||[]}(t):function(t){return t.split("")}(t)}function hr(t){for(var e=t.length;e--&&it.test(t.charAt(e)););return e}var dr=Ke({"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"}),fr=function t(e){var r,n=(e=null==e?he:fr.defaults(he.Object(),e,fr.pick(he,re))).Array,it=e.Date,bt=e.Error,Tt=e.Function,_t=e.Math,At=e.Object,Lt=e.RegExp,wt=e.String,Rt=e.TypeError,kt=n.prototype,Dt=Tt.prototype,It=At.prototype,Pt=e["__core-js_shared__"],Ot=Dt.toString,Ct=It.hasOwnProperty,xt=0,Mt=(r=/[^.]+$/.exec(Pt&&Pt.keys&&Pt.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Ft=It.toString,Nt=Ot.call(At),Bt=he._,Ut=Lt("^"+Ot.call(Ct).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),jt=pe?e.Buffer:i,Ht=e.Symbol,Gt=e.Uint8Array,Vt=jt?jt.allocUnsafe:i,Kt=sr(At.getPrototypeOf,At),$t=At.create,Wt=It.propertyIsEnumerable,qt=kt.splice,Yt=Ht?Ht.isConcatSpreadable:i,zt=Ht?Ht.iterator:i,Qt=Ht?Ht.toStringTag:i,te=function(){try{var t=ls(At,"defineProperty");return t({},"",{}),t}catch(t){}}(),ae=e.clearTimeout!==he.clearTimeout&&e.clearTimeout,ue=it&&it.now!==he.Date.now&&it.now,ce=e.setTimeout!==he.setTimeout&&e.setTimeout,de=_t.ceil,fe=_t.floor,ge=At.getOwnPropertySymbols,ve=jt?jt.isBuffer:i,Fe=e.isFinite,Ke=kt.join,pr=sr(At.keys,At),gr=_t.max,vr=_t.min,mr=it.now,yr=e.parseInt,Er=_t.random,Sr=kt.reverse,br=ls(e,"DataView"),Tr=ls(e,"Map"),_r=ls(e,"Promise"),Ar=ls(e,"Set"),Lr=ls(e,"WeakMap"),wr=ls(At,"create"),Rr=Lr&&new Lr,kr={},Dr=Fs(br),Ir=Fs(Tr),Pr=Fs(_r),Or=Fs(Ar),Cr=Fs(Lr),xr=Ht?Ht.prototype:i,Mr=xr?xr.valueOf:i,Fr=xr?xr.toString:i;function Nr(t){if(Za(t)&&!Ga(t)&&!(t instanceof Hr)){if(t instanceof jr)return t;if(Ct.call(t,"__wrapped__"))return Ns(t)}return new jr(t)}var Br=function(){function t(){}return function(e){if(!Qa(e))return{};if($t)return $t(e);t.prototype=e;var r=new t;return t.prototype=i,r}}();function Ur(){}function jr(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=i}function Hr(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=f,this.__views__=[]}function Gr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Vr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function Kr(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}function $r(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Kr;++e<r;)this.add(t[e])}function Wr(t){var e=this.__data__=new Vr(t);this.size=e.size}function qr(t,e){var r=Ga(t),n=!r&&Ha(t),i=!r&&!n&&Wa(t),s=!r&&!n&&!i&&oo(t),a=r||n||i||s,o=a?qe(t.length,wt):[],l=o.length;for(var u in t)!e&&!Ct.call(t,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||s&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||gs(u,l))||o.push(u);return o}function Yr(t){var e=t.length;return e?t[$n(0,e-1)]:i}function zr(t,e){return Ps(wi(t),sn(e,0,t.length))}function Xr(t){return Ps(wi(t))}function Jr(t,e,r){(r!==i&&!Ba(t[e],r)||r===i&&!(e in t))&&rn(t,e,r)}function Qr(t,e,r){var n=t[e];Ct.call(t,e)&&Ba(n,r)&&(r!==i||e in t)||rn(t,e,r)}function Zr(t,e){for(var r=t.length;r--;)if(Ba(t[r][0],e))return r;return-1}function tn(t,e,r,n){return cn(t,(function(t,i,s){e(n,t,r(t),s)})),n}function en(t,e){return t&&Ri(e,Io(e),t)}function rn(t,e,r){"__proto__"==e&&te?te(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}function nn(t,e){for(var r=-1,s=e.length,a=n(s),o=null==t;++r<s;)a[r]=o?i:Lo(t,e[r]);return a}function sn(t,e,r){return t==t&&(r!==i&&(t=t<=r?t:r),e!==i&&(t=t>=e?t:e)),t}function an(t,e,r,n,s,a){var o,l=1&e,u=2&e,c=4&e;if(r&&(o=s?r(t,n,s,a):r(t)),o!==i)return o;if(!Qa(t))return t;var h=Ga(t);if(h){if(o=function(t){var e=t.length,r=new t.constructor(e);return e&&"string"==typeof t[0]&&Ct.call(t,"index")&&(r.index=t.index,r.input=t.input),r}(t),!l)return wi(t,o)}else{var d=hs(t),f=d==S||d==b;if(Wa(t))return Si(t,l);if(d==A||d==g||f&&!s){if(o=u||f?{}:fs(t),!l)return u?function(t,e){return Ri(t,cs(t),e)}(t,function(t,e){return t&&Ri(e,Po(e),t)}(o,t)):function(t,e){return Ri(t,us(t),e)}(t,en(o,t))}else{if(!se[d])return s?t:{};o=function(t,e,r){var n,i=t.constructor;switch(e){case P:return bi(t);case m:case y:return new i(+t);case O:return function(t,e){var r=e?bi(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.byteLength)}(t,r);case C:case x:case M:case F:case N:case B:case U:case j:case H:return Ti(t,r);case T:return new i;case _:case k:return new i(t);case w:return function(t){var e=new t.constructor(t.source,dt.exec(t));return e.lastIndex=t.lastIndex,e}(t);case R:return new i;case D:return n=t,Mr?At(Mr.call(n)):{}}}(t,d,l)}}a||(a=new Wr);var p=a.get(t);if(p)return p;a.set(t,o),io(t)?t.forEach((function(n){o.add(an(n,e,r,n,t,a))})):to(t)&&t.forEach((function(n,i){o.set(i,an(n,e,r,i,t,a))}));var v=h?i:(c?u?es:ts:u?Po:Io)(t);return Le(v||t,(function(n,i){v&&(n=t[i=n]),Qr(o,i,an(n,e,r,i,t,a))})),o}function on(t,e,r){var n=r.length;if(null==t)return!n;for(t=At(t);n--;){var s=r[n],a=e[s],o=t[s];if(o===i&&!(s in t)||!a(o))return!1}return!0}function ln(t,e,r){if("function"!=typeof t)throw new Rt(s);return Rs((function(){t.apply(i,r)}),e)}function un(t,e,r,n){var i=-1,s=De,a=!0,o=t.length,l=[],u=e.length;if(!o)return l;r&&(e=Pe(e,ze(r))),n?(s=Ie,a=!1):e.length>=200&&(s=Je,a=!1,e=new $r(e));t:for(;++i<o;){var c=t[i],h=null==r?c:r(c);if(c=n||0!==c?c:0,a&&h==h){for(var d=u;d--;)if(e[d]===h)continue t;l.push(c)}else s(e,h,n)||l.push(c)}return l}Nr.templateSettings={escape:z,evaluate:X,interpolate:J,variable:"",imports:{_:Nr}},Nr.prototype=Ur.prototype,Nr.prototype.constructor=Nr,jr.prototype=Br(Ur.prototype),jr.prototype.constructor=jr,Hr.prototype=Br(Ur.prototype),Hr.prototype.constructor=Hr,Gr.prototype.clear=function(){this.__data__=wr?wr(null):{},this.size=0},Gr.prototype.delete=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},Gr.prototype.get=function(t){var e=this.__data__;if(wr){var r=e[t];return r===a?i:r}return Ct.call(e,t)?e[t]:i},Gr.prototype.has=function(t){var e=this.__data__;return wr?e[t]!==i:Ct.call(e,t)},Gr.prototype.set=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=wr&&e===i?a:e,this},Vr.prototype.clear=function(){this.__data__=[],this.size=0},Vr.prototype.delete=function(t){var e=this.__data__,r=Zr(e,t);return!(r<0||(r==e.length-1?e.pop():qt.call(e,r,1),--this.size,0))},Vr.prototype.get=function(t){var e=this.__data__,r=Zr(e,t);return r<0?i:e[r][1]},Vr.prototype.has=function(t){return Zr(this.__data__,t)>-1},Vr.prototype.set=function(t,e){var r=this.__data__,n=Zr(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this},Kr.prototype.clear=function(){this.size=0,this.__data__={hash:new Gr,map:new(Tr||Vr),string:new Gr}},Kr.prototype.delete=function(t){var e=as(this,t).delete(t);return this.size-=e?1:0,e},Kr.prototype.get=function(t){return as(this,t).get(t)},Kr.prototype.has=function(t){return as(this,t).has(t)},Kr.prototype.set=function(t,e){var r=as(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this},$r.prototype.add=$r.prototype.push=function(t){return this.__data__.set(t,a),this},$r.prototype.has=function(t){return this.__data__.has(t)},Wr.prototype.clear=function(){this.__data__=new Vr,this.size=0},Wr.prototype.delete=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r},Wr.prototype.get=function(t){return this.__data__.get(t)},Wr.prototype.has=function(t){return this.__data__.has(t)},Wr.prototype.set=function(t,e){var r=this.__data__;if(r instanceof Vr){var n=r.__data__;if(!Tr||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Kr(n)}return r.set(t,e),this.size=r.size,this};var cn=Ii(yn),hn=Ii(En,!0);function dn(t,e){var r=!0;return cn(t,(function(t,n,i){return r=!!e(t,n,i)})),r}function fn(t,e,r){for(var n=-1,s=t.length;++n<s;){var a=t[n],o=e(a);if(null!=o&&(l===i?o==o&&!ao(o):r(o,l)))var l=o,u=a}return u}function pn(t,e){var r=[];return cn(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r}function gn(t,e,r,n,i){var s=-1,a=t.length;for(r||(r=ps),i||(i=[]);++s<a;){var o=t[s];e>0&&r(o)?e>1?gn(o,e-1,r,n,i):Oe(i,o):n||(i[i.length]=o)}return i}var vn=Pi(),mn=Pi(!0);function yn(t,e){return t&&vn(t,e,Io)}function En(t,e){return t&&mn(t,e,Io)}function Sn(t,e){return ke(e,(function(e){return za(t[e])}))}function bn(t,e){for(var r=0,n=(e=vi(e,t)).length;null!=t&&r<n;)t=t[Ms(e[r++])];return r&&r==n?t:i}function Tn(t,e,r){var n=e(t);return Ga(t)?n:Oe(n,r(t))}function _n(t){return null==t?t===i?"[object Undefined]":"[object Null]":Qt&&Qt in At(t)?function(t){var e=Ct.call(t,Qt),r=t[Qt];try{t[Qt]=i;var n=!0}catch(t){}var s=Ft.call(t);return n&&(e?t[Qt]=r:delete t[Qt]),s}(t):function(t){return Ft.call(t)}(t)}function An(t,e){return t>e}function Ln(t,e){return null!=t&&Ct.call(t,e)}function wn(t,e){return null!=t&&e in At(t)}function Rn(t,e,r){for(var s=r?Ie:De,a=t[0].length,o=t.length,l=o,u=n(o),c=1/0,h=[];l--;){var d=t[l];l&&e&&(d=Pe(d,ze(e))),c=vr(d.length,c),u[l]=!r&&(e||a>=120&&d.length>=120)?new $r(l&&d):i}d=t[0];var f=-1,p=u[0];t:for(;++f<a&&h.length<c;){var g=d[f],v=e?e(g):g;if(g=r||0!==g?g:0,!(p?Je(p,v):s(h,v,r))){for(l=o;--l;){var m=u[l];if(!(m?Je(m,v):s(t[l],v,r)))continue t}p&&p.push(v),h.push(g)}}return h}function kn(t,e,r){var n=null==(t=As(t,e=vi(e,t)))?t:t[Ms(Ys(e))];return null==n?i:_e(n,t,r)}function Dn(t){return Za(t)&&_n(t)==g}function In(t,e,r,n,s){return t===e||(null==t||null==e||!Za(t)&&!Za(e)?t!=t&&e!=e:function(t,e,r,n,s,a){var o=Ga(t),l=Ga(e),u=o?v:hs(t),c=l?v:hs(e),h=(u=u==g?A:u)==A,d=(c=c==g?A:c)==A,f=u==c;if(f&&Wa(t)){if(!Wa(e))return!1;o=!0,h=!1}if(f&&!h)return a||(a=new Wr),o||oo(t)?Qi(t,e,r,n,s,a):function(t,e,r,n,i,s,a){switch(r){case O:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case P:return!(t.byteLength!=e.byteLength||!s(new Gt(t),new Gt(e)));case m:case y:case _:return Ba(+t,+e);case E:return t.name==e.name&&t.message==e.message;case w:case k:return t==e+"";case T:var o=ir;case R:var l=1&n;if(o||(o=or),t.size!=e.size&&!l)return!1;var u=a.get(t);if(u)return u==e;n|=2,a.set(t,e);var c=Qi(o(t),o(e),n,i,s,a);return a.delete(t),c;case D:if(Mr)return Mr.call(t)==Mr.call(e)}return!1}(t,e,u,r,n,s,a);if(!(1&r)){var p=h&&Ct.call(t,"__wrapped__"),S=d&&Ct.call(e,"__wrapped__");if(p||S){var b=p?t.value():t,L=S?e.value():e;return a||(a=new Wr),s(b,L,r,n,a)}}return!!f&&(a||(a=new Wr),function(t,e,r,n,s,a){var o=1&r,l=ts(t),u=l.length;if(u!=ts(e).length&&!o)return!1;for(var c=u;c--;){var h=l[c];if(!(o?h in e:Ct.call(e,h)))return!1}var d=a.get(t),f=a.get(e);if(d&&f)return d==e&&f==t;var p=!0;a.set(t,e),a.set(e,t);for(var g=o;++c<u;){var v=t[h=l[c]],m=e[h];if(n)var y=o?n(m,v,h,e,t,a):n(v,m,h,t,e,a);if(!(y===i?v===m||s(v,m,r,n,a):y)){p=!1;break}g||(g="constructor"==h)}if(p&&!g){var E=t.constructor,S=e.constructor;E==S||!("constructor"in t)||!("constructor"in e)||"function"==typeof E&&E instanceof E&&"function"==typeof S&&S instanceof S||(p=!1)}return a.delete(t),a.delete(e),p}(t,e,r,n,s,a))}(t,e,r,n,In,s))}function Pn(t,e,r,n){var s=r.length,a=s,o=!n;if(null==t)return!a;for(t=At(t);s--;){var l=r[s];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<a;){var u=(l=r[s])[0],c=t[u],h=l[1];if(o&&l[2]){if(c===i&&!(u in t))return!1}else{var d=new Wr;if(n)var f=n(c,h,u,t,e,d);if(!(f===i?In(h,c,3,n,d):f))return!1}}return!0}function On(t){return!(!Qa(t)||(e=t,Mt&&Mt in e))&&(za(t)?Ut:gt).test(Fs(t));var e}function Cn(t){return"function"==typeof t?t:null==t?rl:"object"==typeof t?Ga(t)?Bn(t[0],t[1]):Nn(t):hl(t)}function xn(t){if(!Ss(t))return pr(t);var e=[];for(var r in At(t))Ct.call(t,r)&&"constructor"!=r&&e.push(r);return e}function Mn(t,e){return t<e}function Fn(t,e){var r=-1,i=Ka(t)?n(t.length):[];return cn(t,(function(t,n,s){i[++r]=e(t,n,s)})),i}function Nn(t){var e=os(t);return 1==e.length&&e[0][2]?Ts(e[0][0],e[0][1]):function(r){return r===t||Pn(r,t,e)}}function Bn(t,e){return ms(t)&&bs(e)?Ts(Ms(t),e):function(r){var n=Lo(r,t);return n===i&&n===e?wo(r,t):In(e,n,3)}}function Un(t,e,r,n,s){t!==e&&vn(e,(function(a,o){if(s||(s=new Wr),Qa(a))!function(t,e,r,n,s,a,o){var l=Ls(t,r),u=Ls(e,r),c=o.get(u);if(c)Jr(t,r,c);else{var h=a?a(l,u,r+"",t,e,o):i,d=h===i;if(d){var f=Ga(u),p=!f&&Wa(u),g=!f&&!p&&oo(u);h=u,f||p||g?Ga(l)?h=l:$a(l)?h=wi(l):p?(d=!1,h=Si(u,!0)):g?(d=!1,h=Ti(u,!0)):h=[]:ro(u)||Ha(u)?(h=l,Ha(l)?h=vo(l):Qa(l)&&!za(l)||(h=fs(u))):d=!1}d&&(o.set(u,h),s(h,u,n,a,o),o.delete(u)),Jr(t,r,h)}}(t,e,o,r,Un,n,s);else{var l=n?n(Ls(t,o),a,o+"",t,e,s):i;l===i&&(l=a),Jr(t,o,l)}}),Po)}function jn(t,e){var r=t.length;if(r)return gs(e+=e<0?r:0,r)?t[e]:i}function Hn(t,e,r){e=e.length?Pe(e,(function(t){return Ga(t)?function(e){return bn(e,1===t.length?t[0]:t)}:t})):[rl];var n=-1;e=Pe(e,ze(ss()));var i=Fn(t,(function(t,r,i){var s=Pe(e,(function(e){return e(t)}));return{criteria:s,index:++n,value:t}}));return function(t,e){var n=t.length;for(t.sort((function(t,e){return function(t,e,r){for(var n=-1,i=t.criteria,s=e.criteria,a=i.length,o=r.length;++n<a;){var l=_i(i[n],s[n]);if(l)return n>=o?l:l*("desc"==r[n]?-1:1)}return t.index-e.index}(t,e,r)}));n--;)t[n]=t[n].value;return t}(i)}function Gn(t,e,r){for(var n=-1,i=e.length,s={};++n<i;){var a=e[n],o=bn(t,a);r(o,a)&&Xn(s,vi(a,t),o)}return s}function Vn(t,e,r,n){var i=n?je:Ue,s=-1,a=e.length,o=t;for(t===e&&(e=wi(e)),r&&(o=Pe(t,ze(r)));++s<a;)for(var l=0,u=e[s],c=r?r(u):u;(l=i(o,c,l,n))>-1;)o!==t&&qt.call(o,l,1),qt.call(t,l,1);return t}function Kn(t,e){for(var r=t?e.length:0,n=r-1;r--;){var i=e[r];if(r==n||i!==s){var s=i;gs(i)?qt.call(t,i,1):li(t,i)}}return t}function $n(t,e){return t+fe(Er()*(e-t+1))}function Wn(t,e){var r="";if(!t||e<1||e>h)return r;do{e%2&&(r+=t),(e=fe(e/2))&&(t+=t)}while(e);return r}function qn(t,e){return ks(_s(t,e,rl),t+"")}function Yn(t){return Yr(Uo(t))}function zn(t,e){var r=Uo(t);return Ps(r,sn(e,0,r.length))}function Xn(t,e,r,n){if(!Qa(t))return t;for(var s=-1,a=(e=vi(e,t)).length,o=a-1,l=t;null!=l&&++s<a;){var u=Ms(e[s]),c=r;if("__proto__"===u||"constructor"===u||"prototype"===u)return t;if(s!=o){var h=l[u];(c=n?n(h,u,l):i)===i&&(c=Qa(h)?h:gs(e[s+1])?[]:{})}Qr(l,u,c),l=l[u]}return t}var Jn=Rr?function(t,e){return Rr.set(t,e),t}:rl,Qn=te?function(t,e){return te(t,"toString",{configurable:!0,enumerable:!1,value:Zo(e),writable:!0})}:rl;function Zn(t){return Ps(Uo(t))}function ti(t,e,r){var i=-1,s=t.length;e<0&&(e=-e>s?0:s+e),(r=r>s?s:r)<0&&(r+=s),s=e>r?0:r-e>>>0,e>>>=0;for(var a=n(s);++i<s;)a[i]=t[i+e];return a}function ei(t,e){var r;return cn(t,(function(t,n,i){return!(r=e(t,n,i))})),!!r}function ri(t,e,r){var n=0,i=null==t?n:t.length;if("number"==typeof e&&e==e&&i<=2147483647){for(;n<i;){var s=n+i>>>1,a=t[s];null!==a&&!ao(a)&&(r?a<=e:a<e)?n=s+1:i=s}return i}return ni(t,e,rl,r)}function ni(t,e,r,n){var s=0,a=null==t?0:t.length;if(0===a)return 0;for(var o=(e=r(e))!=e,l=null===e,u=ao(e),c=e===i;s<a;){var h=fe((s+a)/2),d=r(t[h]),f=d!==i,p=null===d,g=d==d,v=ao(d);if(o)var m=n||g;else m=c?g&&(n||f):l?g&&f&&(n||!p):u?g&&f&&!p&&(n||!v):!p&&!v&&(n?d<=e:d<e);m?s=h+1:a=h}return vr(a,4294967294)}function ii(t,e){for(var r=-1,n=t.length,i=0,s=[];++r<n;){var a=t[r],o=e?e(a):a;if(!r||!Ba(o,l)){var l=o;s[i++]=0===a?0:a}}return s}function si(t){return"number"==typeof t?t:ao(t)?d:+t}function ai(t){if("string"==typeof t)return t;if(Ga(t))return Pe(t,ai)+"";if(ao(t))return Fr?Fr.call(t):"";var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function oi(t,e,r){var n=-1,i=De,s=t.length,a=!0,o=[],l=o;if(r)a=!1,i=Ie;else if(s>=200){var u=e?null:Wi(t);if(u)return or(u);a=!1,i=Je,l=new $r}else l=e?[]:o;t:for(;++n<s;){var c=t[n],h=e?e(c):c;if(c=r||0!==c?c:0,a&&h==h){for(var d=l.length;d--;)if(l[d]===h)continue t;e&&l.push(h),o.push(c)}else i(l,h,r)||(l!==o&&l.push(h),o.push(c))}return o}function li(t,e){return null==(t=As(t,e=vi(e,t)))||delete t[Ms(Ys(e))]}function ui(t,e,r,n){return Xn(t,e,r(bn(t,e)),n)}function ci(t,e,r,n){for(var i=t.length,s=n?i:-1;(n?s--:++s<i)&&e(t[s],s,t););return r?ti(t,n?0:s,n?s+1:i):ti(t,n?s+1:0,n?i:s)}function hi(t,e){var r=t;return r instanceof Hr&&(r=r.value()),Ce(e,(function(t,e){return e.func.apply(e.thisArg,Oe([t],e.args))}),r)}function di(t,e,r){var i=t.length;if(i<2)return i?oi(t[0]):[];for(var s=-1,a=n(i);++s<i;)for(var o=t[s],l=-1;++l<i;)l!=s&&(a[s]=un(a[s]||o,t[l],e,r));return oi(gn(a,1),e,r)}function fi(t,e,r){for(var n=-1,s=t.length,a=e.length,o={};++n<s;){var l=n<a?e[n]:i;r(o,t[n],l)}return o}function pi(t){return $a(t)?t:[]}function gi(t){return"function"==typeof t?t:rl}function vi(t,e){return Ga(t)?t:ms(t,e)?[t]:xs(mo(t))}var mi=qn;function yi(t,e,r){var n=t.length;return r=r===i?n:r,!e&&r>=n?t:ti(t,e,r)}var Ei=ae||function(t){return he.clearTimeout(t)};function Si(t,e){if(e)return t.slice();var r=t.length,n=Vt?Vt(r):new t.constructor(r);return t.copy(n),n}function bi(t){var e=new t.constructor(t.byteLength);return new Gt(e).set(new Gt(t)),e}function Ti(t,e){var r=e?bi(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}function _i(t,e){if(t!==e){var r=t!==i,n=null===t,s=t==t,a=ao(t),o=e!==i,l=null===e,u=e==e,c=ao(e);if(!l&&!c&&!a&&t>e||a&&o&&u&&!l&&!c||n&&o&&u||!r&&u||!s)return 1;if(!n&&!a&&!c&&t<e||c&&r&&s&&!n&&!a||l&&r&&s||!o&&s||!u)return-1}return 0}function Ai(t,e,r,i){for(var s=-1,a=t.length,o=r.length,l=-1,u=e.length,c=gr(a-o,0),h=n(u+c),d=!i;++l<u;)h[l]=e[l];for(;++s<o;)(d||s<a)&&(h[r[s]]=t[s]);for(;c--;)h[l++]=t[s++];return h}function Li(t,e,r,i){for(var s=-1,a=t.length,o=-1,l=r.length,u=-1,c=e.length,h=gr(a-l,0),d=n(h+c),f=!i;++s<h;)d[s]=t[s];for(var p=s;++u<c;)d[p+u]=e[u];for(;++o<l;)(f||s<a)&&(d[p+r[o]]=t[s++]);return d}function wi(t,e){var r=-1,i=t.length;for(e||(e=n(i));++r<i;)e[r]=t[r];return e}function Ri(t,e,r,n){var s=!r;r||(r={});for(var a=-1,o=e.length;++a<o;){var l=e[a],u=n?n(r[l],t[l],l,r,t):i;u===i&&(u=t[l]),s?rn(r,l,u):Qr(r,l,u)}return r}function ki(t,e){return function(r,n){var i=Ga(r)?Ae:tn,s=e?e():{};return i(r,t,ss(n,2),s)}}function Di(t){return qn((function(e,r){var n=-1,s=r.length,a=s>1?r[s-1]:i,o=s>2?r[2]:i;for(a=t.length>3&&"function"==typeof a?(s--,a):i,o&&vs(r[0],r[1],o)&&(a=s<3?i:a,s=1),e=At(e);++n<s;){var l=r[n];l&&t(e,l,n,a)}return e}))}function Ii(t,e){return function(r,n){if(null==r)return r;if(!Ka(r))return t(r,n);for(var i=r.length,s=e?i:-1,a=At(r);(e?s--:++s<i)&&!1!==n(a[s],s,a););return r}}function Pi(t){return function(e,r,n){for(var i=-1,s=At(e),a=n(e),o=a.length;o--;){var l=a[t?o:++i];if(!1===r(s[l],l,s))break}return e}}function Oi(t){return function(e){var r=nr(e=mo(e))?cr(e):i,n=r?r[0]:e.charAt(0),s=r?yi(r,1).join(""):e.slice(1);return n[t]()+s}}function Ci(t){return function(e){return Ce(Xo(Go(e).replace(Xt,"")),t,"")}}function xi(t){return function(){var e=arguments;switch(e.length){case 0:return new t;case 1:return new t(e[0]);case 2:return new t(e[0],e[1]);case 3:return new t(e[0],e[1],e[2]);case 4:return new t(e[0],e[1],e[2],e[3]);case 5:return new t(e[0],e[1],e[2],e[3],e[4]);case 6:return new t(e[0],e[1],e[2],e[3],e[4],e[5]);case 7:return new t(e[0],e[1],e[2],e[3],e[4],e[5],e[6])}var r=Br(t.prototype),n=t.apply(r,e);return Qa(n)?n:r}}function Mi(t){return function(e,r,n){var s=At(e);if(!Ka(e)){var a=ss(r,3);e=Io(e),r=function(t){return a(s[t],t,s)}}var o=t(e,r,n);return o>-1?s[a?e[o]:o]:i}}function Fi(t){return Zi((function(e){var r=e.length,n=r,a=jr.prototype.thru;for(t&&e.reverse();n--;){var o=e[n];if("function"!=typeof o)throw new Rt(s);if(a&&!l&&"wrapper"==ns(o))var l=new jr([],!0)}for(n=l?n:r;++n<r;){var u=ns(o=e[n]),c="wrapper"==u?rs(o):i;l=c&&ys(c[0])&&424==c[1]&&!c[4].length&&1==c[9]?l[ns(c[0])].apply(l,c[3]):1==o.length&&ys(o)?l[u]():l.thru(o)}return function(){var t=arguments,n=t[0];if(l&&1==t.length&&Ga(n))return l.plant(n).value();for(var i=0,s=r?e[i].apply(this,t):n;++i<r;)s=e[i].call(this,s);return s}}))}function Ni(t,e,r,s,a,o,l,c,h,d){var f=e&u,p=1&e,g=2&e,v=24&e,m=512&e,y=g?i:xi(t);return function u(){for(var E=arguments.length,S=n(E),b=E;b--;)S[b]=arguments[b];if(v)var T=is(u),_=function(t,e){for(var r=t.length,n=0;r--;)t[r]===e&&++n;return n}(S,T);if(s&&(S=Ai(S,s,a,v)),o&&(S=Li(S,o,l,v)),E-=_,v&&E<d){var A=ar(S,T);return Ki(t,e,Ni,u.placeholder,r,S,A,c,h,d-E)}var L=p?r:this,w=g?L[t]:t;return E=S.length,c?S=function(t,e){for(var r=t.length,n=vr(e.length,r),s=wi(t);n--;){var a=e[n];t[n]=gs(a,r)?s[a]:i}return t}(S,c):m&&E>1&&S.reverse(),f&&h<E&&(S.length=h),this&&this!==he&&this instanceof u&&(w=y||xi(w)),w.apply(L,S)}}function Bi(t,e){return function(r,n){return function(t,e,r,n){return yn(t,(function(t,i,s){e(n,r(t),i,s)})),n}(r,t,e(n),{})}}function Ui(t,e){return function(r,n){var s;if(r===i&&n===i)return e;if(r!==i&&(s=r),n!==i){if(s===i)return n;"string"==typeof r||"string"==typeof n?(r=ai(r),n=ai(n)):(r=si(r),n=si(n)),s=t(r,n)}return s}}function ji(t){return Zi((function(e){return e=Pe(e,ze(ss())),qn((function(r){var n=this;return t(e,(function(t){return _e(t,n,r)}))}))}))}function Hi(t,e){var r=(e=e===i?" ":ai(e)).length;if(r<2)return r?Wn(e,t):e;var n=Wn(e,de(t/ur(e)));return nr(e)?yi(cr(n),0,t).join(""):n.slice(0,t)}function Gi(t){return function(e,r,s){return s&&"number"!=typeof s&&vs(e,r,s)&&(r=s=i),e=ho(e),r===i?(r=e,e=0):r=ho(r),function(t,e,r,i){for(var s=-1,a=gr(de((e-t)/(r||1)),0),o=n(a);a--;)o[i?a:++s]=t,t+=r;return o}(e,r,s=s===i?e<r?1:-1:ho(s),t)}}function Vi(t){return function(e,r){return"string"==typeof e&&"string"==typeof r||(e=go(e),r=go(r)),t(e,r)}}function Ki(t,e,r,n,s,a,o,u,c,h){var d=8&e;e|=d?l:64,4&(e&=~(d?64:l))||(e&=-4);var f=[t,e,s,d?a:i,d?o:i,d?i:a,d?i:o,u,c,h],p=r.apply(i,f);return ys(t)&&ws(p,f),p.placeholder=n,Ds(p,t,e)}function $i(t){var e=_t[t];return function(t,r){if(t=go(t),(r=null==r?0:vr(fo(r),292))&&Fe(t)){var n=(mo(t)+"e").split("e");return+((n=(mo(e(n[0]+"e"+(+n[1]+r)))+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}var Wi=Ar&&1/or(new Ar([,-0]))[1]==c?function(t){return new Ar(t)}:ol;function qi(t){return function(e){var r=hs(e);return r==T?ir(e):r==R?lr(e):function(t,e){return Pe(e,(function(e){return[e,t[e]]}))}(e,t(e))}}function Yi(t,e,r,a,c,h,d,f){var p=2&e;if(!p&&"function"!=typeof t)throw new Rt(s);var g=a?a.length:0;if(g||(e&=-97,a=c=i),d=d===i?d:gr(fo(d),0),f=f===i?f:fo(f),g-=c?c.length:0,64&e){var v=a,m=c;a=c=i}var y=p?i:rs(t),E=[t,e,r,a,c,v,m,h,d,f];if(y&&function(t,e){var r=t[1],n=e[1],i=r|n,s=i<131,a=n==u&&8==r||n==u&&256==r&&t[7].length<=e[8]||384==n&&e[7].length<=e[8]&&8==r;if(!s&&!a)return t;1&n&&(t[2]=e[2],i|=1&r?0:4);var l=e[3];if(l){var c=t[3];t[3]=c?Ai(c,l,e[4]):l,t[4]=c?ar(t[3],o):e[4]}(l=e[5])&&(c=t[5],t[5]=c?Li(c,l,e[6]):l,t[6]=c?ar(t[5],o):e[6]),(l=e[7])&&(t[7]=l),n&u&&(t[8]=null==t[8]?e[8]:vr(t[8],e[8])),null==t[9]&&(t[9]=e[9]),t[0]=e[0],t[1]=i}(E,y),t=E[0],e=E[1],r=E[2],a=E[3],c=E[4],!(f=E[9]=E[9]===i?p?0:t.length:gr(E[9]-g,0))&&24&e&&(e&=-25),e&&1!=e)S=8==e||16==e?function(t,e,r){var s=xi(t);return function a(){for(var o=arguments.length,l=n(o),u=o,c=is(a);u--;)l[u]=arguments[u];var h=o<3&&l[0]!==c&&l[o-1]!==c?[]:ar(l,c);return(o-=h.length)<r?Ki(t,e,Ni,a.placeholder,i,l,h,i,i,r-o):_e(this&&this!==he&&this instanceof a?s:t,this,l)}}(t,e,f):e!=l&&33!=e||c.length?Ni.apply(i,E):function(t,e,r,i){var s=1&e,a=xi(t);return function e(){for(var o=-1,l=arguments.length,u=-1,c=i.length,h=n(c+l),d=this&&this!==he&&this instanceof e?a:t;++u<c;)h[u]=i[u];for(;l--;)h[u++]=arguments[++o];return _e(d,s?r:this,h)}}(t,e,r,a);else var S=function(t,e,r){var n=1&e,i=xi(t);return function e(){return(this&&this!==he&&this instanceof e?i:t).apply(n?r:this,arguments)}}(t,e,r);return Ds((y?Jn:ws)(S,E),t,e)}function zi(t,e,r,n){return t===i||Ba(t,It[r])&&!Ct.call(n,r)?e:t}function Xi(t,e,r,n,s,a){return Qa(t)&&Qa(e)&&(a.set(e,t),Un(t,e,i,Xi,a),a.delete(e)),t}function Ji(t){return ro(t)?i:t}function Qi(t,e,r,n,s,a){var o=1&r,l=t.length,u=e.length;if(l!=u&&!(o&&u>l))return!1;var c=a.get(t),h=a.get(e);if(c&&h)return c==e&&h==t;var d=-1,f=!0,p=2&r?new $r:i;for(a.set(t,e),a.set(e,t);++d<l;){var g=t[d],v=e[d];if(n)var m=o?n(v,g,d,e,t,a):n(g,v,d,t,e,a);if(m!==i){if(m)continue;f=!1;break}if(p){if(!Me(e,(function(t,e){if(!Je(p,e)&&(g===t||s(g,t,r,n,a)))return p.push(e)}))){f=!1;break}}else if(g!==v&&!s(g,v,r,n,a)){f=!1;break}}return a.delete(t),a.delete(e),f}function Zi(t){return ks(_s(t,i,Vs),t+"")}function ts(t){return Tn(t,Io,us)}function es(t){return Tn(t,Po,cs)}var rs=Rr?function(t){return Rr.get(t)}:ol;function ns(t){for(var e=t.name+"",r=kr[e],n=Ct.call(kr,e)?r.length:0;n--;){var i=r[n],s=i.func;if(null==s||s==t)return i.name}return e}function is(t){return(Ct.call(Nr,"placeholder")?Nr:t).placeholder}function ss(){var t=Nr.iteratee||nl;return t=t===nl?Cn:t,arguments.length?t(arguments[0],arguments[1]):t}function as(t,e){var r,n,i=t.__data__;return("string"==(n=typeof(r=e))||"number"==n||"symbol"==n||"boolean"==n?"__proto__"!==r:null===r)?i["string"==typeof e?"string":"hash"]:i.map}function os(t){for(var e=Io(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,bs(i)]}return e}function ls(t,e){var r=function(t,e){return null==t?i:t[e]}(t,e);return On(r)?r:i}var us=ge?function(t){return null==t?[]:(t=At(t),ke(ge(t),(function(e){return Wt.call(t,e)})))}:pl,cs=ge?function(t){for(var e=[];t;)Oe(e,us(t)),t=Kt(t);return e}:pl,hs=_n;function ds(t,e,r){for(var n=-1,i=(e=vi(e,t)).length,s=!1;++n<i;){var a=Ms(e[n]);if(!(s=null!=t&&r(t,a)))break;t=t[a]}return s||++n!=i?s:!!(i=null==t?0:t.length)&&Ja(i)&&gs(a,i)&&(Ga(t)||Ha(t))}function fs(t){return"function"!=typeof t.constructor||Ss(t)?{}:Br(Kt(t))}function ps(t){return Ga(t)||Ha(t)||!!(Yt&&t&&t[Yt])}function gs(t,e){var r=typeof t;return!!(e=null==e?h:e)&&("number"==r||"symbol"!=r&&mt.test(t))&&t>-1&&t%1==0&&t<e}function vs(t,e,r){if(!Qa(r))return!1;var n=typeof e;return!!("number"==n?Ka(r)&&gs(e,r.length):"string"==n&&e in r)&&Ba(r[e],t)}function ms(t,e){if(Ga(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!ao(t))||Z.test(t)||!Q.test(t)||null!=e&&t in At(e)}function ys(t){var e=ns(t),r=Nr[e];if("function"!=typeof r||!(e in Hr.prototype))return!1;if(t===r)return!0;var n=rs(r);return!!n&&t===n[0]}(br&&hs(new br(new ArrayBuffer(1)))!=O||Tr&&hs(new Tr)!=T||_r&&hs(_r.resolve())!=L||Ar&&hs(new Ar)!=R||Lr&&hs(new Lr)!=I)&&(hs=function(t){var e=_n(t),r=e==A?t.constructor:i,n=r?Fs(r):"";if(n)switch(n){case Dr:return O;case Ir:return T;case Pr:return L;case Or:return R;case Cr:return I}return e});var Es=Pt?za:gl;function Ss(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||It)}function bs(t){return t==t&&!Qa(t)}function Ts(t,e){return function(r){return null!=r&&r[t]===e&&(e!==i||t in At(r))}}function _s(t,e,r){return e=gr(e===i?t.length-1:e,0),function(){for(var i=arguments,s=-1,a=gr(i.length-e,0),o=n(a);++s<a;)o[s]=i[e+s];s=-1;for(var l=n(e+1);++s<e;)l[s]=i[s];return l[e]=r(o),_e(t,this,l)}}function As(t,e){return e.length<2?t:bn(t,ti(e,0,-1))}function Ls(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}var ws=Is(Jn),Rs=ce||function(t,e){return he.setTimeout(t,e)},ks=Is(Qn);function Ds(t,e,r){var n=e+"";return ks(t,function(t,e){var r=e.length;if(!r)return t;var n=r-1;return e[n]=(r>1?"& ":"")+e[n],e=e.join(r>2?", ":" "),t.replace(st,"{\n/* [wrapped with "+e+"] */\n")}(n,function(t,e){return Le(p,(function(r){var n="_."+r[0];e&r[1]&&!De(t,n)&&t.push(n)})),t.sort()}(function(t){var e=t.match(at);return e?e[1].split(ot):[]}(n),r)))}function Is(t){var e=0,r=0;return function(){var n=mr(),s=16-(n-r);if(r=n,s>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(i,arguments)}}function Ps(t,e){var r=-1,n=t.length,s=n-1;for(e=e===i?n:e;++r<e;){var a=$n(r,s),o=t[a];t[a]=t[r],t[r]=o}return t.length=e,t}var Os,Cs,xs=(Os=Oa((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(tt,(function(t,r,n,i){e.push(n?i.replace(ct,"$1"):r||t)})),e}),(function(t){return 500===Cs.size&&Cs.clear(),t})),Cs=Os.cache,Os);function Ms(t){if("string"==typeof t||ao(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}function Fs(t){if(null!=t){try{return Ot.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Ns(t){if(t instanceof Hr)return t.clone();var e=new jr(t.__wrapped__,t.__chain__);return e.__actions__=wi(t.__actions__),e.__index__=t.__index__,e.__values__=t.__values__,e}var Bs=qn((function(t,e){return $a(t)?un(t,gn(e,1,$a,!0)):[]})),Us=qn((function(t,e){var r=Ys(e);return $a(r)&&(r=i),$a(t)?un(t,gn(e,1,$a,!0),ss(r,2)):[]})),js=qn((function(t,e){var r=Ys(e);return $a(r)&&(r=i),$a(t)?un(t,gn(e,1,$a,!0),i,r):[]}));function Hs(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:fo(r);return i<0&&(i=gr(n+i,0)),Be(t,ss(e,3),i)}function Gs(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var s=n-1;return r!==i&&(s=fo(r),s=r<0?gr(n+s,0):vr(s,n-1)),Be(t,ss(e,3),s,!0)}function Vs(t){return null!=t&&t.length?gn(t,1):[]}function Ks(t){return t&&t.length?t[0]:i}var $s=qn((function(t){var e=Pe(t,pi);return e.length&&e[0]===t[0]?Rn(e):[]})),Ws=qn((function(t){var e=Ys(t),r=Pe(t,pi);return e===Ys(r)?e=i:r.pop(),r.length&&r[0]===t[0]?Rn(r,ss(e,2)):[]})),qs=qn((function(t){var e=Ys(t),r=Pe(t,pi);return(e="function"==typeof e?e:i)&&r.pop(),r.length&&r[0]===t[0]?Rn(r,i,e):[]}));function Ys(t){var e=null==t?0:t.length;return e?t[e-1]:i}var zs=qn(Xs);function Xs(t,e){return t&&t.length&&e&&e.length?Vn(t,e):t}var Js=Zi((function(t,e){var r=null==t?0:t.length,n=nn(t,e);return Kn(t,Pe(e,(function(t){return gs(t,r)?+t:t})).sort(_i)),n}));function Qs(t){return null==t?t:Sr.call(t)}var Zs=qn((function(t){return oi(gn(t,1,$a,!0))})),ta=qn((function(t){var e=Ys(t);return $a(e)&&(e=i),oi(gn(t,1,$a,!0),ss(e,2))})),ea=qn((function(t){var e=Ys(t);return e="function"==typeof e?e:i,oi(gn(t,1,$a,!0),i,e)}));function ra(t){if(!t||!t.length)return[];var e=0;return t=ke(t,(function(t){if($a(t))return e=gr(t.length,e),!0})),qe(e,(function(e){return Pe(t,Ve(e))}))}function na(t,e){if(!t||!t.length)return[];var r=ra(t);return null==e?r:Pe(r,(function(t){return _e(e,i,t)}))}var ia=qn((function(t,e){return $a(t)?un(t,e):[]})),sa=qn((function(t){return di(ke(t,$a))})),aa=qn((function(t){var e=Ys(t);return $a(e)&&(e=i),di(ke(t,$a),ss(e,2))})),oa=qn((function(t){var e=Ys(t);return e="function"==typeof e?e:i,di(ke(t,$a),i,e)})),la=qn(ra),ua=qn((function(t){var e=t.length,r=e>1?t[e-1]:i;return r="function"==typeof r?(t.pop(),r):i,na(t,r)}));function ca(t){var e=Nr(t);return e.__chain__=!0,e}function ha(t,e){return e(t)}var da=Zi((function(t){var e=t.length,r=e?t[0]:0,n=this.__wrapped__,s=function(e){return nn(e,t)};return!(e>1||this.__actions__.length)&&n instanceof Hr&&gs(r)?((n=n.slice(r,+r+(e?1:0))).__actions__.push({func:ha,args:[s],thisArg:i}),new jr(n,this.__chain__).thru((function(t){return e&&!t.length&&t.push(i),t}))):this.thru(s)})),fa=ki((function(t,e,r){Ct.call(t,r)?++t[r]:rn(t,r,1)})),pa=Mi(Hs),ga=Mi(Gs);function va(t,e){return(Ga(t)?Le:cn)(t,ss(e,3))}function ma(t,e){return(Ga(t)?we:hn)(t,ss(e,3))}var ya=ki((function(t,e,r){Ct.call(t,r)?t[r].push(e):rn(t,r,[e])})),Ea=qn((function(t,e,r){var i=-1,s="function"==typeof e,a=Ka(t)?n(t.length):[];return cn(t,(function(t){a[++i]=s?_e(e,t,r):kn(t,e,r)})),a})),Sa=ki((function(t,e,r){rn(t,r,e)}));function ba(t,e){return(Ga(t)?Pe:Fn)(t,ss(e,3))}var Ta=ki((function(t,e,r){t[r?0:1].push(e)}),(function(){return[[],[]]})),_a=qn((function(t,e){if(null==t)return[];var r=e.length;return r>1&&vs(t,e[0],e[1])?e=[]:r>2&&vs(e[0],e[1],e[2])&&(e=[e[0]]),Hn(t,gn(e,1),[])})),Aa=ue||function(){return he.Date.now()};function La(t,e,r){return e=r?i:e,e=t&&null==e?t.length:e,Yi(t,u,i,i,i,i,e)}function wa(t,e){var r;if("function"!=typeof e)throw new Rt(s);return t=fo(t),function(){return--t>0&&(r=e.apply(this,arguments)),t<=1&&(e=i),r}}var Ra=qn((function(t,e,r){var n=1;if(r.length){var i=ar(r,is(Ra));n|=l}return Yi(t,n,e,r,i)})),ka=qn((function(t,e,r){var n=3;if(r.length){var i=ar(r,is(ka));n|=l}return Yi(e,n,t,r,i)}));function Da(t,e,r){var n,a,o,l,u,c,h=0,d=!1,f=!1,p=!0;if("function"!=typeof t)throw new Rt(s);function g(e){var r=n,s=a;return n=a=i,h=e,l=t.apply(s,r)}function v(t){var r=t-c;return c===i||r>=e||r<0||f&&t-h>=o}function m(){var t=Aa();if(v(t))return y(t);u=Rs(m,function(t){var r=e-(t-c);return f?vr(r,o-(t-h)):r}(t))}function y(t){return u=i,p&&n?g(t):(n=a=i,l)}function E(){var t=Aa(),r=v(t);if(n=arguments,a=this,c=t,r){if(u===i)return function(t){return h=t,u=Rs(m,e),d?g(t):l}(c);if(f)return Ei(u),u=Rs(m,e),g(c)}return u===i&&(u=Rs(m,e)),l}return e=go(e)||0,Qa(r)&&(d=!!r.leading,o=(f="maxWait"in r)?gr(go(r.maxWait)||0,e):o,p="trailing"in r?!!r.trailing:p),E.cancel=function(){u!==i&&Ei(u),h=0,n=c=a=u=i},E.flush=function(){return u===i?l:y(Aa())},E}var Ia=qn((function(t,e){return ln(t,1,e)})),Pa=qn((function(t,e,r){return ln(t,go(e)||0,r)}));function Oa(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new Rt(s);var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],s=r.cache;if(s.has(i))return s.get(i);var a=t.apply(this,n);return r.cache=s.set(i,a)||s,a};return r.cache=new(Oa.Cache||Kr),r}function Ca(t){if("function"!=typeof t)throw new Rt(s);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Oa.Cache=Kr;var xa=mi((function(t,e){var r=(e=1==e.length&&Ga(e[0])?Pe(e[0],ze(ss())):Pe(gn(e,1),ze(ss()))).length;return qn((function(n){for(var i=-1,s=vr(n.length,r);++i<s;)n[i]=e[i].call(this,n[i]);return _e(t,this,n)}))})),Ma=qn((function(t,e){var r=ar(e,is(Ma));return Yi(t,l,i,e,r)})),Fa=qn((function(t,e){var r=ar(e,is(Fa));return Yi(t,64,i,e,r)})),Na=Zi((function(t,e){return Yi(t,256,i,i,i,e)}));function Ba(t,e){return t===e||t!=t&&e!=e}var Ua=Vi(An),ja=Vi((function(t,e){return t>=e})),Ha=Dn(function(){return arguments}())?Dn:function(t){return Za(t)&&Ct.call(t,"callee")&&!Wt.call(t,"callee")},Ga=n.isArray,Va=me?ze(me):function(t){return Za(t)&&_n(t)==P};function Ka(t){return null!=t&&Ja(t.length)&&!za(t)}function $a(t){return Za(t)&&Ka(t)}var Wa=ve||gl,qa=ye?ze(ye):function(t){return Za(t)&&_n(t)==y};function Ya(t){if(!Za(t))return!1;var e=_n(t);return e==E||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!ro(t)}function za(t){if(!Qa(t))return!1;var e=_n(t);return e==S||e==b||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Xa(t){return"number"==typeof t&&t==fo(t)}function Ja(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=h}function Qa(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Za(t){return null!=t&&"object"==typeof t}var to=Ee?ze(Ee):function(t){return Za(t)&&hs(t)==T};function eo(t){return"number"==typeof t||Za(t)&&_n(t)==_}function ro(t){if(!Za(t)||_n(t)!=A)return!1;var e=Kt(t);if(null===e)return!0;var r=Ct.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&Ot.call(r)==Nt}var no=Se?ze(Se):function(t){return Za(t)&&_n(t)==w},io=be?ze(be):function(t){return Za(t)&&hs(t)==R};function so(t){return"string"==typeof t||!Ga(t)&&Za(t)&&_n(t)==k}function ao(t){return"symbol"==typeof t||Za(t)&&_n(t)==D}var oo=Te?ze(Te):function(t){return Za(t)&&Ja(t.length)&&!!ie[_n(t)]},lo=Vi(Mn),uo=Vi((function(t,e){return t<=e}));function co(t){if(!t)return[];if(Ka(t))return so(t)?cr(t):wi(t);if(zt&&t[zt])return function(t){for(var e,r=[];!(e=t.next()).done;)r.push(e.value);return r}(t[zt]());var e=hs(t);return(e==T?ir:e==R?or:Uo)(t)}function ho(t){return t?(t=go(t))===c||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function fo(t){var e=ho(t),r=e%1;return e==e?r?e-r:e:0}function po(t){return t?sn(fo(t),0,f):0}function go(t){if("number"==typeof t)return t;if(ao(t))return d;if(Qa(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=Qa(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=Ye(t);var r=pt.test(t);return r||vt.test(t)?le(t.slice(2),r?2:8):ft.test(t)?d:+t}function vo(t){return Ri(t,Po(t))}function mo(t){return null==t?"":ai(t)}var yo=Di((function(t,e){if(Ss(e)||Ka(e))Ri(e,Io(e),t);else for(var r in e)Ct.call(e,r)&&Qr(t,r,e[r])})),Eo=Di((function(t,e){Ri(e,Po(e),t)})),So=Di((function(t,e,r,n){Ri(e,Po(e),t,n)})),bo=Di((function(t,e,r,n){Ri(e,Io(e),t,n)})),To=Zi(nn),_o=qn((function(t,e){t=At(t);var r=-1,n=e.length,s=n>2?e[2]:i;for(s&&vs(e[0],e[1],s)&&(n=1);++r<n;)for(var a=e[r],o=Po(a),l=-1,u=o.length;++l<u;){var c=o[l],h=t[c];(h===i||Ba(h,It[c])&&!Ct.call(t,c))&&(t[c]=a[c])}return t})),Ao=qn((function(t){return t.push(i,Xi),_e(Co,i,t)}));function Lo(t,e,r){var n=null==t?i:bn(t,e);return n===i?r:n}function wo(t,e){return null!=t&&ds(t,e,wn)}var Ro=Bi((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),t[e]=r}),Zo(rl)),ko=Bi((function(t,e,r){null!=e&&"function"!=typeof e.toString&&(e=Ft.call(e)),Ct.call(t,e)?t[e].push(r):t[e]=[r]}),ss),Do=qn(kn);function Io(t){return Ka(t)?qr(t):xn(t)}function Po(t){return Ka(t)?qr(t,!0):function(t){if(!Qa(t))return function(t){var e=[];if(null!=t)for(var r in At(t))e.push(r);return e}(t);var e=Ss(t),r=[];for(var n in t)("constructor"!=n||!e&&Ct.call(t,n))&&r.push(n);return r}(t)}var Oo=Di((function(t,e,r){Un(t,e,r)})),Co=Di((function(t,e,r,n){Un(t,e,r,n)})),xo=Zi((function(t,e){var r={};if(null==t)return r;var n=!1;e=Pe(e,(function(e){return e=vi(e,t),n||(n=e.length>1),e})),Ri(t,es(t),r),n&&(r=an(r,7,Ji));for(var i=e.length;i--;)li(r,e[i]);return r})),Mo=Zi((function(t,e){return null==t?{}:function(t,e){return Gn(t,e,(function(e,r){return wo(t,r)}))}(t,e)}));function Fo(t,e){if(null==t)return{};var r=Pe(es(t),(function(t){return[t]}));return e=ss(e),Gn(t,r,(function(t,r){return e(t,r[0])}))}var No=qi(Io),Bo=qi(Po);function Uo(t){return null==t?[]:Xe(t,Io(t))}var jo=Ci((function(t,e,r){return e=e.toLowerCase(),t+(r?Ho(e):e)}));function Ho(t){return zo(mo(t).toLowerCase())}function Go(t){return(t=mo(t))&&t.replace(yt,tr).replace(Jt,"")}var Vo=Ci((function(t,e,r){return t+(r?"-":"")+e.toLowerCase()})),Ko=Ci((function(t,e,r){return t+(r?" ":"")+e.toLowerCase()})),$o=Oi("toLowerCase"),Wo=Ci((function(t,e,r){return t+(r?"_":"")+e.toLowerCase()})),qo=Ci((function(t,e,r){return t+(r?" ":"")+zo(e)})),Yo=Ci((function(t,e,r){return t+(r?" ":"")+e.toUpperCase()})),zo=Oi("toUpperCase");function Xo(t,e,r){return t=mo(t),(e=r?i:e)===i?function(t){return ee.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.match(lt)||[]}(t):t.match(e)||[]}var Jo=qn((function(t,e){try{return _e(t,i,e)}catch(t){return Ya(t)?t:new bt(t)}})),Qo=Zi((function(t,e){return Le(e,(function(e){e=Ms(e),rn(t,e,Ra(t[e],t))})),t}));function Zo(t){return function(){return t}}var tl=Fi(),el=Fi(!0);function rl(t){return t}function nl(t){return Cn("function"==typeof t?t:an(t,1))}var il=qn((function(t,e){return function(r){return kn(r,t,e)}})),sl=qn((function(t,e){return function(r){return kn(t,r,e)}}));function al(t,e,r){var n=Io(e),i=Sn(e,n);null!=r||Qa(e)&&(i.length||!n.length)||(r=e,e=t,t=this,i=Sn(e,Io(e)));var s=!(Qa(r)&&"chain"in r&&!r.chain),a=za(t);return Le(i,(function(r){var n=e[r];t[r]=n,a&&(t.prototype[r]=function(){var e=this.__chain__;if(s||e){var r=t(this.__wrapped__);return(r.__actions__=wi(this.__actions__)).push({func:n,args:arguments,thisArg:t}),r.__chain__=e,r}return n.apply(t,Oe([this.value()],arguments))})})),t}function ol(){}var ll=ji(Pe),ul=ji(Re),cl=ji(Me);function hl(t){return ms(t)?Ve(Ms(t)):function(t){return function(e){return bn(e,t)}}(t)}var dl=Gi(),fl=Gi(!0);function pl(){return[]}function gl(){return!1}var vl,ml=Ui((function(t,e){return t+e}),0),yl=$i("ceil"),El=Ui((function(t,e){return t/e}),1),Sl=$i("floor"),bl=Ui((function(t,e){return t*e}),1),Tl=$i("round"),_l=Ui((function(t,e){return t-e}),0);return Nr.after=function(t,e){if("function"!=typeof e)throw new Rt(s);return t=fo(t),function(){if(--t<1)return e.apply(this,arguments)}},Nr.ary=La,Nr.assign=yo,Nr.assignIn=Eo,Nr.assignInWith=So,Nr.assignWith=bo,Nr.at=To,Nr.before=wa,Nr.bind=Ra,Nr.bindAll=Qo,Nr.bindKey=ka,Nr.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Ga(t)?t:[t]},Nr.chain=ca,Nr.chunk=function(t,e,r){e=(r?vs(t,e,r):e===i)?1:gr(fo(e),0);var s=null==t?0:t.length;if(!s||e<1)return[];for(var a=0,o=0,l=n(de(s/e));a<s;)l[o++]=ti(t,a,a+=e);return l},Nr.compact=function(t){for(var e=-1,r=null==t?0:t.length,n=0,i=[];++e<r;){var s=t[e];s&&(i[n++]=s)}return i},Nr.concat=function(){var t=arguments.length;if(!t)return[];for(var e=n(t-1),r=arguments[0],i=t;i--;)e[i-1]=arguments[i];return Oe(Ga(r)?wi(r):[r],gn(e,1))},Nr.cond=function(t){var e=null==t?0:t.length,r=ss();return t=e?Pe(t,(function(t){if("function"!=typeof t[1])throw new Rt(s);return[r(t[0]),t[1]]})):[],qn((function(r){for(var n=-1;++n<e;){var i=t[n];if(_e(i[0],this,r))return _e(i[1],this,r)}}))},Nr.conforms=function(t){return function(t){var e=Io(t);return function(r){return on(r,t,e)}}(an(t,1))},Nr.constant=Zo,Nr.countBy=fa,Nr.create=function(t,e){var r=Br(t);return null==e?r:en(r,e)},Nr.curry=function t(e,r,n){var s=Yi(e,8,i,i,i,i,i,r=n?i:r);return s.placeholder=t.placeholder,s},Nr.curryRight=function t(e,r,n){var s=Yi(e,16,i,i,i,i,i,r=n?i:r);return s.placeholder=t.placeholder,s},Nr.debounce=Da,Nr.defaults=_o,Nr.defaultsDeep=Ao,Nr.defer=Ia,Nr.delay=Pa,Nr.difference=Bs,Nr.differenceBy=Us,Nr.differenceWith=js,Nr.drop=function(t,e,r){var n=null==t?0:t.length;return n?ti(t,(e=r||e===i?1:fo(e))<0?0:e,n):[]},Nr.dropRight=function(t,e,r){var n=null==t?0:t.length;return n?ti(t,0,(e=n-(e=r||e===i?1:fo(e)))<0?0:e):[]},Nr.dropRightWhile=function(t,e){return t&&t.length?ci(t,ss(e,3),!0,!0):[]},Nr.dropWhile=function(t,e){return t&&t.length?ci(t,ss(e,3),!0):[]},Nr.fill=function(t,e,r,n){var s=null==t?0:t.length;return s?(r&&"number"!=typeof r&&vs(t,e,r)&&(r=0,n=s),function(t,e,r,n){var s=t.length;for((r=fo(r))<0&&(r=-r>s?0:s+r),(n=n===i||n>s?s:fo(n))<0&&(n+=s),n=r>n?0:po(n);r<n;)t[r++]=e;return t}(t,e,r,n)):[]},Nr.filter=function(t,e){return(Ga(t)?ke:pn)(t,ss(e,3))},Nr.flatMap=function(t,e){return gn(ba(t,e),1)},Nr.flatMapDeep=function(t,e){return gn(ba(t,e),c)},Nr.flatMapDepth=function(t,e,r){return r=r===i?1:fo(r),gn(ba(t,e),r)},Nr.flatten=Vs,Nr.flattenDeep=function(t){return null!=t&&t.length?gn(t,c):[]},Nr.flattenDepth=function(t,e){return null!=t&&t.length?gn(t,e=e===i?1:fo(e)):[]},Nr.flip=function(t){return Yi(t,512)},Nr.flow=tl,Nr.flowRight=el,Nr.fromPairs=function(t){for(var e=-1,r=null==t?0:t.length,n={};++e<r;){var i=t[e];n[i[0]]=i[1]}return n},Nr.functions=function(t){return null==t?[]:Sn(t,Io(t))},Nr.functionsIn=function(t){return null==t?[]:Sn(t,Po(t))},Nr.groupBy=ya,Nr.initial=function(t){return null!=t&&t.length?ti(t,0,-1):[]},Nr.intersection=$s,Nr.intersectionBy=Ws,Nr.intersectionWith=qs,Nr.invert=Ro,Nr.invertBy=ko,Nr.invokeMap=Ea,Nr.iteratee=nl,Nr.keyBy=Sa,Nr.keys=Io,Nr.keysIn=Po,Nr.map=ba,Nr.mapKeys=function(t,e){var r={};return e=ss(e,3),yn(t,(function(t,n,i){rn(r,e(t,n,i),t)})),r},Nr.mapValues=function(t,e){var r={};return e=ss(e,3),yn(t,(function(t,n,i){rn(r,n,e(t,n,i))})),r},Nr.matches=function(t){return Nn(an(t,1))},Nr.matchesProperty=function(t,e){return Bn(t,an(e,1))},Nr.memoize=Oa,Nr.merge=Oo,Nr.mergeWith=Co,Nr.method=il,Nr.methodOf=sl,Nr.mixin=al,Nr.negate=Ca,Nr.nthArg=function(t){return t=fo(t),qn((function(e){return jn(e,t)}))},Nr.omit=xo,Nr.omitBy=function(t,e){return Fo(t,Ca(ss(e)))},Nr.once=function(t){return wa(2,t)},Nr.orderBy=function(t,e,r,n){return null==t?[]:(Ga(e)||(e=null==e?[]:[e]),Ga(r=n?i:r)||(r=null==r?[]:[r]),Hn(t,e,r))},Nr.over=ll,Nr.overArgs=xa,Nr.overEvery=ul,Nr.overSome=cl,Nr.partial=Ma,Nr.partialRight=Fa,Nr.partition=Ta,Nr.pick=Mo,Nr.pickBy=Fo,Nr.property=hl,Nr.propertyOf=function(t){return function(e){return null==t?i:bn(t,e)}},Nr.pull=zs,Nr.pullAll=Xs,Nr.pullAllBy=function(t,e,r){return t&&t.length&&e&&e.length?Vn(t,e,ss(r,2)):t},Nr.pullAllWith=function(t,e,r){return t&&t.length&&e&&e.length?Vn(t,e,i,r):t},Nr.pullAt=Js,Nr.range=dl,Nr.rangeRight=fl,Nr.rearg=Na,Nr.reject=function(t,e){return(Ga(t)?ke:pn)(t,Ca(ss(e,3)))},Nr.remove=function(t,e){var r=[];if(!t||!t.length)return r;var n=-1,i=[],s=t.length;for(e=ss(e,3);++n<s;){var a=t[n];e(a,n,t)&&(r.push(a),i.push(n))}return Kn(t,i),r},Nr.rest=function(t,e){if("function"!=typeof t)throw new Rt(s);return qn(t,e=e===i?e:fo(e))},Nr.reverse=Qs,Nr.sampleSize=function(t,e,r){return e=(r?vs(t,e,r):e===i)?1:fo(e),(Ga(t)?zr:zn)(t,e)},Nr.set=function(t,e,r){return null==t?t:Xn(t,e,r)},Nr.setWith=function(t,e,r,n){return n="function"==typeof n?n:i,null==t?t:Xn(t,e,r,n)},Nr.shuffle=function(t){return(Ga(t)?Xr:Zn)(t)},Nr.slice=function(t,e,r){var n=null==t?0:t.length;return n?(r&&"number"!=typeof r&&vs(t,e,r)?(e=0,r=n):(e=null==e?0:fo(e),r=r===i?n:fo(r)),ti(t,e,r)):[]},Nr.sortBy=_a,Nr.sortedUniq=function(t){return t&&t.length?ii(t):[]},Nr.sortedUniqBy=function(t,e){return t&&t.length?ii(t,ss(e,2)):[]},Nr.split=function(t,e,r){return r&&"number"!=typeof r&&vs(t,e,r)&&(e=r=i),(r=r===i?f:r>>>0)?(t=mo(t))&&("string"==typeof e||null!=e&&!no(e))&&!(e=ai(e))&&nr(t)?yi(cr(t),0,r):t.split(e,r):[]},Nr.spread=function(t,e){if("function"!=typeof t)throw new Rt(s);return e=null==e?0:gr(fo(e),0),qn((function(r){var n=r[e],i=yi(r,0,e);return n&&Oe(i,n),_e(t,this,i)}))},Nr.tail=function(t){var e=null==t?0:t.length;return e?ti(t,1,e):[]},Nr.take=function(t,e,r){return t&&t.length?ti(t,0,(e=r||e===i?1:fo(e))<0?0:e):[]},Nr.takeRight=function(t,e,r){var n=null==t?0:t.length;return n?ti(t,(e=n-(e=r||e===i?1:fo(e)))<0?0:e,n):[]},Nr.takeRightWhile=function(t,e){return t&&t.length?ci(t,ss(e,3),!1,!0):[]},Nr.takeWhile=function(t,e){return t&&t.length?ci(t,ss(e,3)):[]},Nr.tap=function(t,e){return e(t),t},Nr.throttle=function(t,e,r){var n=!0,i=!0;if("function"!=typeof t)throw new Rt(s);return Qa(r)&&(n="leading"in r?!!r.leading:n,i="trailing"in r?!!r.trailing:i),Da(t,e,{leading:n,maxWait:e,trailing:i})},Nr.thru=ha,Nr.toArray=co,Nr.toPairs=No,Nr.toPairsIn=Bo,Nr.toPath=function(t){return Ga(t)?Pe(t,Ms):ao(t)?[t]:wi(xs(mo(t)))},Nr.toPlainObject=vo,Nr.transform=function(t,e,r){var n=Ga(t),i=n||Wa(t)||oo(t);if(e=ss(e,4),null==r){var s=t&&t.constructor;r=i?n?new s:[]:Qa(t)&&za(s)?Br(Kt(t)):{}}return(i?Le:yn)(t,(function(t,n,i){return e(r,t,n,i)})),r},Nr.unary=function(t){return La(t,1)},Nr.union=Zs,Nr.unionBy=ta,Nr.unionWith=ea,Nr.uniq=function(t){return t&&t.length?oi(t):[]},Nr.uniqBy=function(t,e){return t&&t.length?oi(t,ss(e,2)):[]},Nr.uniqWith=function(t,e){return e="function"==typeof e?e:i,t&&t.length?oi(t,i,e):[]},Nr.unset=function(t,e){return null==t||li(t,e)},Nr.unzip=ra,Nr.unzipWith=na,Nr.update=function(t,e,r){return null==t?t:ui(t,e,gi(r))},Nr.updateWith=function(t,e,r,n){return n="function"==typeof n?n:i,null==t?t:ui(t,e,gi(r),n)},Nr.values=Uo,Nr.valuesIn=function(t){return null==t?[]:Xe(t,Po(t))},Nr.without=ia,Nr.words=Xo,Nr.wrap=function(t,e){return Ma(gi(e),t)},Nr.xor=sa,Nr.xorBy=aa,Nr.xorWith=oa,Nr.zip=la,Nr.zipObject=function(t,e){return fi(t||[],e||[],Qr)},Nr.zipObjectDeep=function(t,e){return fi(t||[],e||[],Xn)},Nr.zipWith=ua,Nr.entries=No,Nr.entriesIn=Bo,Nr.extend=Eo,Nr.extendWith=So,al(Nr,Nr),Nr.add=ml,Nr.attempt=Jo,Nr.camelCase=jo,Nr.capitalize=Ho,Nr.ceil=yl,Nr.clamp=function(t,e,r){return r===i&&(r=e,e=i),r!==i&&(r=(r=go(r))==r?r:0),e!==i&&(e=(e=go(e))==e?e:0),sn(go(t),e,r)},Nr.clone=function(t){return an(t,4)},Nr.cloneDeep=function(t){return an(t,5)},Nr.cloneDeepWith=function(t,e){return an(t,5,e="function"==typeof e?e:i)},Nr.cloneWith=function(t,e){return an(t,4,e="function"==typeof e?e:i)},Nr.conformsTo=function(t,e){return null==e||on(t,e,Io(e))},Nr.deburr=Go,Nr.defaultTo=function(t,e){return null==t||t!=t?e:t},Nr.divide=El,Nr.endsWith=function(t,e,r){t=mo(t),e=ai(e);var n=t.length,s=r=r===i?n:sn(fo(r),0,n);return(r-=e.length)>=0&&t.slice(r,s)==e},Nr.eq=Ba,Nr.escape=function(t){return(t=mo(t))&&Y.test(t)?t.replace(W,er):t},Nr.escapeRegExp=function(t){return(t=mo(t))&&rt.test(t)?t.replace(et,"\\$&"):t},Nr.every=function(t,e,r){var n=Ga(t)?Re:dn;return r&&vs(t,e,r)&&(e=i),n(t,ss(e,3))},Nr.find=pa,Nr.findIndex=Hs,Nr.findKey=function(t,e){return Ne(t,ss(e,3),yn)},Nr.findLast=ga,Nr.findLastIndex=Gs,Nr.findLastKey=function(t,e){return Ne(t,ss(e,3),En)},Nr.floor=Sl,Nr.forEach=va,Nr.forEachRight=ma,Nr.forIn=function(t,e){return null==t?t:vn(t,ss(e,3),Po)},Nr.forInRight=function(t,e){return null==t?t:mn(t,ss(e,3),Po)},Nr.forOwn=function(t,e){return t&&yn(t,ss(e,3))},Nr.forOwnRight=function(t,e){return t&&En(t,ss(e,3))},Nr.get=Lo,Nr.gt=Ua,Nr.gte=ja,Nr.has=function(t,e){return null!=t&&ds(t,e,Ln)},Nr.hasIn=wo,Nr.head=Ks,Nr.identity=rl,Nr.includes=function(t,e,r,n){t=Ka(t)?t:Uo(t),r=r&&!n?fo(r):0;var i=t.length;return r<0&&(r=gr(i+r,0)),so(t)?r<=i&&t.indexOf(e,r)>-1:!!i&&Ue(t,e,r)>-1},Nr.indexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:fo(r);return i<0&&(i=gr(n+i,0)),Ue(t,e,i)},Nr.inRange=function(t,e,r){return e=ho(e),r===i?(r=e,e=0):r=ho(r),function(t,e,r){return t>=vr(e,r)&&t<gr(e,r)}(t=go(t),e,r)},Nr.invoke=Do,Nr.isArguments=Ha,Nr.isArray=Ga,Nr.isArrayBuffer=Va,Nr.isArrayLike=Ka,Nr.isArrayLikeObject=$a,Nr.isBoolean=function(t){return!0===t||!1===t||Za(t)&&_n(t)==m},Nr.isBuffer=Wa,Nr.isDate=qa,Nr.isElement=function(t){return Za(t)&&1===t.nodeType&&!ro(t)},Nr.isEmpty=function(t){if(null==t)return!0;if(Ka(t)&&(Ga(t)||"string"==typeof t||"function"==typeof t.splice||Wa(t)||oo(t)||Ha(t)))return!t.length;var e=hs(t);if(e==T||e==R)return!t.size;if(Ss(t))return!xn(t).length;for(var r in t)if(Ct.call(t,r))return!1;return!0},Nr.isEqual=function(t,e){return In(t,e)},Nr.isEqualWith=function(t,e,r){var n=(r="function"==typeof r?r:i)?r(t,e):i;return n===i?In(t,e,i,r):!!n},Nr.isError=Ya,Nr.isFinite=function(t){return"number"==typeof t&&Fe(t)},Nr.isFunction=za,Nr.isInteger=Xa,Nr.isLength=Ja,Nr.isMap=to,Nr.isMatch=function(t,e){return t===e||Pn(t,e,os(e))},Nr.isMatchWith=function(t,e,r){return r="function"==typeof r?r:i,Pn(t,e,os(e),r)},Nr.isNaN=function(t){return eo(t)&&t!=+t},Nr.isNative=function(t){if(Es(t))throw new bt("Unsupported core-js use. Try https://npms.io/search?q=ponyfill.");return On(t)},Nr.isNil=function(t){return null==t},Nr.isNull=function(t){return null===t},Nr.isNumber=eo,Nr.isObject=Qa,Nr.isObjectLike=Za,Nr.isPlainObject=ro,Nr.isRegExp=no,Nr.isSafeInteger=function(t){return Xa(t)&&t>=-9007199254740991&&t<=h},Nr.isSet=io,Nr.isString=so,Nr.isSymbol=ao,Nr.isTypedArray=oo,Nr.isUndefined=function(t){return t===i},Nr.isWeakMap=function(t){return Za(t)&&hs(t)==I},Nr.isWeakSet=function(t){return Za(t)&&"[object WeakSet]"==_n(t)},Nr.join=function(t,e){return null==t?"":Ke.call(t,e)},Nr.kebabCase=Vo,Nr.last=Ys,Nr.lastIndexOf=function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var s=n;return r!==i&&(s=(s=fo(r))<0?gr(n+s,0):vr(s,n-1)),e==e?function(t,e,r){for(var n=r+1;n--;)if(t[n]===e)return n;return n}(t,e,s):Be(t,He,s,!0)},Nr.lowerCase=Ko,Nr.lowerFirst=$o,Nr.lt=lo,Nr.lte=uo,Nr.max=function(t){return t&&t.length?fn(t,rl,An):i},Nr.maxBy=function(t,e){return t&&t.length?fn(t,ss(e,2),An):i},Nr.mean=function(t){return Ge(t,rl)},Nr.meanBy=function(t,e){return Ge(t,ss(e,2))},Nr.min=function(t){return t&&t.length?fn(t,rl,Mn):i},Nr.minBy=function(t,e){return t&&t.length?fn(t,ss(e,2),Mn):i},Nr.stubArray=pl,Nr.stubFalse=gl,Nr.stubObject=function(){return{}},Nr.stubString=function(){return""},Nr.stubTrue=function(){return!0},Nr.multiply=bl,Nr.nth=function(t,e){return t&&t.length?jn(t,fo(e)):i},Nr.noConflict=function(){return he._===this&&(he._=Bt),this},Nr.noop=ol,Nr.now=Aa,Nr.pad=function(t,e,r){t=mo(t);var n=(e=fo(e))?ur(t):0;if(!e||n>=e)return t;var i=(e-n)/2;return Hi(fe(i),r)+t+Hi(de(i),r)},Nr.padEnd=function(t,e,r){t=mo(t);var n=(e=fo(e))?ur(t):0;return e&&n<e?t+Hi(e-n,r):t},Nr.padStart=function(t,e,r){t=mo(t);var n=(e=fo(e))?ur(t):0;return e&&n<e?Hi(e-n,r)+t:t},Nr.parseInt=function(t,e,r){return r||null==e?e=0:e&&(e=+e),yr(mo(t).replace(nt,""),e||0)},Nr.random=function(t,e,r){if(r&&"boolean"!=typeof r&&vs(t,e,r)&&(e=r=i),r===i&&("boolean"==typeof e?(r=e,e=i):"boolean"==typeof t&&(r=t,t=i)),t===i&&e===i?(t=0,e=1):(t=ho(t),e===i?(e=t,t=0):e=ho(e)),t>e){var n=t;t=e,e=n}if(r||t%1||e%1){var s=Er();return vr(t+s*(e-t+oe("1e-"+((s+"").length-1))),e)}return $n(t,e)},Nr.reduce=function(t,e,r){var n=Ga(t)?Ce:$e,i=arguments.length<3;return n(t,ss(e,4),r,i,cn)},Nr.reduceRight=function(t,e,r){var n=Ga(t)?xe:$e,i=arguments.length<3;return n(t,ss(e,4),r,i,hn)},Nr.repeat=function(t,e,r){return e=(r?vs(t,e,r):e===i)?1:fo(e),Wn(mo(t),e)},Nr.replace=function(){var t=arguments,e=mo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Nr.result=function(t,e,r){var n=-1,s=(e=vi(e,t)).length;for(s||(s=1,t=i);++n<s;){var a=null==t?i:t[Ms(e[n])];a===i&&(n=s,a=r),t=za(a)?a.call(t):a}return t},Nr.round=Tl,Nr.runInContext=t,Nr.sample=function(t){return(Ga(t)?Yr:Yn)(t)},Nr.size=function(t){if(null==t)return 0;if(Ka(t))return so(t)?ur(t):t.length;var e=hs(t);return e==T||e==R?t.size:xn(t).length},Nr.snakeCase=Wo,Nr.some=function(t,e,r){var n=Ga(t)?Me:ei;return r&&vs(t,e,r)&&(e=i),n(t,ss(e,3))},Nr.sortedIndex=function(t,e){return ri(t,e)},Nr.sortedIndexBy=function(t,e,r){return ni(t,e,ss(r,2))},Nr.sortedIndexOf=function(t,e){var r=null==t?0:t.length;if(r){var n=ri(t,e);if(n<r&&Ba(t[n],e))return n}return-1},Nr.sortedLastIndex=function(t,e){return ri(t,e,!0)},Nr.sortedLastIndexBy=function(t,e,r){return ni(t,e,ss(r,2),!0)},Nr.sortedLastIndexOf=function(t,e){if(null!=t&&t.length){var r=ri(t,e,!0)-1;if(Ba(t[r],e))return r}return-1},Nr.startCase=qo,Nr.startsWith=function(t,e,r){return t=mo(t),r=null==r?0:sn(fo(r),0,t.length),e=ai(e),t.slice(r,r+e.length)==e},Nr.subtract=_l,Nr.sum=function(t){return t&&t.length?We(t,rl):0},Nr.sumBy=function(t,e){return t&&t.length?We(t,ss(e,2)):0},Nr.template=function(t,e,r){var n=Nr.templateSettings;r&&vs(t,e,r)&&(e=i),t=mo(t),e=So({},e,n,zi);var s,a,o=So({},e.imports,n.imports,zi),l=Io(o),u=Xe(o,l),c=0,h=e.interpolate||Et,d="__p += '",f=Lt((e.escape||Et).source+"|"+h.source+"|"+(h===J?ht:Et).source+"|"+(e.evaluate||Et).source+"|$","g"),p="//# sourceURL="+(Ct.call(e,"sourceURL")?(e.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++ne+"]")+"\n";t.replace(f,(function(e,r,n,i,o,l){return n||(n=i),d+=t.slice(c,l).replace(St,rr),r&&(s=!0,d+="' +\n__e("+r+") +\n'"),o&&(a=!0,d+="';\n"+o+";\n__p += '"),n&&(d+="' +\n((__t = ("+n+")) == null ? '' : __t) +\n'"),c=l+e.length,e})),d+="';\n";var g=Ct.call(e,"variable")&&e.variable;if(g){if(ut.test(g))throw new bt("Invalid `variable` option passed into `_.template`")}else d="with (obj) {\n"+d+"\n}\n";d=(a?d.replace(G,""):d).replace(V,"$1").replace(K,"$1;"),d="function("+(g||"obj")+") {\n"+(g?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(s?", __e = _.escape":"")+(a?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+d+"return __p\n}";var v=Jo((function(){return Tt(l,p+"return "+d).apply(i,u)}));if(v.source=d,Ya(v))throw v;return v},Nr.times=function(t,e){if((t=fo(t))<1||t>h)return[];var r=f,n=vr(t,f);e=ss(e),t-=f;for(var i=qe(n,e);++r<t;)e(r);return i},Nr.toFinite=ho,Nr.toInteger=fo,Nr.toLength=po,Nr.toLower=function(t){return mo(t).toLowerCase()},Nr.toNumber=go,Nr.toSafeInteger=function(t){return t?sn(fo(t),-9007199254740991,h):0===t?t:0},Nr.toString=mo,Nr.toUpper=function(t){return mo(t).toUpperCase()},Nr.trim=function(t,e,r){if((t=mo(t))&&(r||e===i))return Ye(t);if(!t||!(e=ai(e)))return t;var n=cr(t),s=cr(e);return yi(n,Qe(n,s),Ze(n,s)+1).join("")},Nr.trimEnd=function(t,e,r){if((t=mo(t))&&(r||e===i))return t.slice(0,hr(t)+1);if(!t||!(e=ai(e)))return t;var n=cr(t);return yi(n,0,Ze(n,cr(e))+1).join("")},Nr.trimStart=function(t,e,r){if((t=mo(t))&&(r||e===i))return t.replace(nt,"");if(!t||!(e=ai(e)))return t;var n=cr(t);return yi(n,Qe(n,cr(e))).join("")},Nr.truncate=function(t,e){var r=30,n="...";if(Qa(e)){var s="separator"in e?e.separator:s;r="length"in e?fo(e.length):r,n="omission"in e?ai(e.omission):n}var a=(t=mo(t)).length;if(nr(t)){var o=cr(t);a=o.length}if(r>=a)return t;var l=r-ur(n);if(l<1)return n;var u=o?yi(o,0,l).join(""):t.slice(0,l);if(s===i)return u+n;if(o&&(l+=u.length-l),no(s)){if(t.slice(l).search(s)){var c,h=u;for(s.global||(s=Lt(s.source,mo(dt.exec(s))+"g")),s.lastIndex=0;c=s.exec(h);)var d=c.index;u=u.slice(0,d===i?l:d)}}else if(t.indexOf(ai(s),l)!=l){var f=u.lastIndexOf(s);f>-1&&(u=u.slice(0,f))}return u+n},Nr.unescape=function(t){return(t=mo(t))&&q.test(t)?t.replace($,dr):t},Nr.uniqueId=function(t){var e=++xt;return mo(t)+e},Nr.upperCase=Yo,Nr.upperFirst=zo,Nr.each=va,Nr.eachRight=ma,Nr.first=Ks,al(Nr,(vl={},yn(Nr,(function(t,e){Ct.call(Nr.prototype,e)||(vl[e]=t)})),vl),{chain:!1}),Nr.VERSION="4.17.21",Le(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Nr[t].placeholder=Nr})),Le(["drop","take"],(function(t,e){Hr.prototype[t]=function(r){r=r===i?1:gr(fo(r),0);var n=this.__filtered__&&!e?new Hr(this):this.clone();return n.__filtered__?n.__takeCount__=vr(r,n.__takeCount__):n.__views__.push({size:vr(r,f),type:t+(n.__dir__<0?"Right":"")}),n},Hr.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Le(["filter","map","takeWhile"],(function(t,e){var r=e+1,n=1==r||3==r;Hr.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:ss(t,3),type:r}),e.__filtered__=e.__filtered__||n,e}})),Le(["head","last"],(function(t,e){var r="take"+(e?"Right":"");Hr.prototype[t]=function(){return this[r](1).value()[0]}})),Le(["initial","tail"],(function(t,e){var r="drop"+(e?"":"Right");Hr.prototype[t]=function(){return this.__filtered__?new Hr(this):this[r](1)}})),Hr.prototype.compact=function(){return this.filter(rl)},Hr.prototype.find=function(t){return this.filter(t).head()},Hr.prototype.findLast=function(t){return this.reverse().find(t)},Hr.prototype.invokeMap=qn((function(t,e){return"function"==typeof t?new Hr(this):this.map((function(r){return kn(r,t,e)}))})),Hr.prototype.reject=function(t){return this.filter(Ca(ss(t)))},Hr.prototype.slice=function(t,e){t=fo(t);var r=this;return r.__filtered__&&(t>0||e<0)?new Hr(r):(t<0?r=r.takeRight(-t):t&&(r=r.drop(t)),e!==i&&(r=(e=fo(e))<0?r.dropRight(-e):r.take(e-t)),r)},Hr.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Hr.prototype.toArray=function(){return this.take(f)},yn(Hr.prototype,(function(t,e){var r=/^(?:filter|find|map|reject)|While$/.test(e),n=/^(?:head|last)$/.test(e),s=Nr[n?"take"+("last"==e?"Right":""):e],a=n||/^find/.test(e);s&&(Nr.prototype[e]=function(){var e=this.__wrapped__,o=n?[1]:arguments,l=e instanceof Hr,u=o[0],c=l||Ga(e),h=function(t){var e=s.apply(Nr,Oe([t],o));return n&&d?e[0]:e};c&&r&&"function"==typeof u&&1!=u.length&&(l=c=!1);var d=this.__chain__,f=!!this.__actions__.length,p=a&&!d,g=l&&!f;if(!a&&c){e=g?e:new Hr(this);var v=t.apply(e,o);return v.__actions__.push({func:ha,args:[h],thisArg:i}),new jr(v,d)}return p&&g?t.apply(this,o):(v=this.thru(h),p?n?v.value()[0]:v.value():v)})})),Le(["pop","push","shift","sort","splice","unshift"],(function(t){var e=kt[t],r=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",n=/^(?:pop|shift)$/.test(t);Nr.prototype[t]=function(){var t=arguments;if(n&&!this.__chain__){var i=this.value();return e.apply(Ga(i)?i:[],t)}return this[r]((function(r){return e.apply(Ga(r)?r:[],t)}))}})),yn(Hr.prototype,(function(t,e){var r=Nr[e];if(r){var n=r.name+"";Ct.call(kr,n)||(kr[n]=[]),kr[n].push({name:e,func:r})}})),kr[Ni(i,2).name]=[{name:"wrapper",func:i}],Hr.prototype.clone=function(){var t=new Hr(this.__wrapped__);return t.__actions__=wi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=wi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=wi(this.__views__),t},Hr.prototype.reverse=function(){if(this.__filtered__){var t=new Hr(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Hr.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,r=Ga(t),n=e<0,i=r?t.length:0,s=function(t,e,r){for(var n=-1,i=r.length;++n<i;){var s=r[n],a=s.size;switch(s.type){case"drop":t+=a;break;case"dropRight":e-=a;break;case"take":e=vr(e,t+a);break;case"takeRight":t=gr(t,e-a)}}return{start:t,end:e}}(0,i,this.__views__),a=s.start,o=s.end,l=o-a,u=n?o:a-1,c=this.__iteratees__,h=c.length,d=0,f=vr(l,this.__takeCount__);if(!r||!n&&i==l&&f==l)return hi(t,this.__actions__);var p=[];t:for(;l--&&d<f;){for(var g=-1,v=t[u+=e];++g<h;){var m=c[g],y=m.iteratee,E=m.type,S=y(v);if(2==E)v=S;else if(!S){if(1==E)continue t;break t}}p[d++]=v}return p},Nr.prototype.at=da,Nr.prototype.chain=function(){return ca(this)},Nr.prototype.commit=function(){return new jr(this.value(),this.__chain__)},Nr.prototype.next=function(){this.__values__===i&&(this.__values__=co(this.value()));var t=this.__index__>=this.__values__.length;return{done:t,value:t?i:this.__values__[this.__index__++]}},Nr.prototype.plant=function(t){for(var e,r=this;r instanceof Ur;){var n=Ns(r);n.__index__=0,n.__values__=i,e?s.__wrapped__=n:e=n;var s=n;r=r.__wrapped__}return s.__wrapped__=t,e},Nr.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof Hr){var e=t;return this.__actions__.length&&(e=new Hr(this)),(e=e.reverse()).__actions__.push({func:ha,args:[Qs],thisArg:i}),new jr(e,this.__chain__)}return this.thru(Qs)},Nr.prototype.toJSON=Nr.prototype.valueOf=Nr.prototype.value=function(){return hi(this.__wrapped__,this.__actions__)},Nr.prototype.first=Nr.prototype.head,zt&&(Nr.prototype[zt]=function(){return this}),Nr}();he._=fr,(n=function(){return fr}.call(e,r,e,t))===i||(t.exports=n)}.call(this)},8259:(t,e,r)=>{"use strict";t.exports=r(2159)},3434:(t,e,r)=>{"use strict";var n=r(723);function i(){}var s=null,a={};function o(t){if("object"!=typeof this)throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("Promise constructor's argument is not a function");this._h=0,this._i=0,this._j=null,this._k=null,t!==i&&f(t,this)}function l(t,e){for(;3===t._i;)t=t._j;if(o._l&&o._l(t),0===t._i)return 0===t._h?(t._h=1,void(t._k=e)):1===t._h?(t._h=2,void(t._k=[t._k,e])):void t._k.push(e);!function(t,e){n((function(){var r=1===t._i?e.onFulfilled:e.onRejected;if(null!==r){var n=function(t,e){try{return t(e)}catch(t){return s=t,a}}(r,t._j);n===a?c(e.promise,s):u(e.promise,n)}else 1===t._i?u(e.promise,t._j):c(e.promise,t._j)}))}(t,e)}function u(t,e){if(e===t)return c(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"==typeof e||"function"==typeof e)){var r=function(t){try{return t.then}catch(t){return s=t,a}}(e);if(r===a)return c(t,s);if(r===t.then&&e instanceof o)return t._i=3,t._j=e,void h(t);if("function"==typeof r)return void f(r.bind(e),t)}t._i=1,t._j=e,h(t)}function c(t,e){t._i=2,t._j=e,o._m&&o._m(t,e),h(t)}function h(t){if(1===t._h&&(l(t,t._k),t._k=null),2===t._h){for(var e=0;e<t._k.length;e++)l(t,t._k[e]);t._k=null}}function d(t,e,r){this.onFulfilled="function"==typeof t?t:null,this.onRejected="function"==typeof e?e:null,this.promise=r}function f(t,e){var r=!1,n=function(t,n,i){try{t((function(t){r||(r=!0,u(e,t))}),(function(t){r||(r=!0,c(e,t))}))}catch(t){return s=t,a}}(t);r||n!==a||(r=!0,c(e,s))}t.exports=o,o._l=null,o._m=null,o._n=i,o.prototype.then=function(t,e){if(this.constructor!==o)return function(t,e,r){return new t.constructor((function(n,s){var a=new o(i);a.then(n,s),l(t,new d(e,r,a))}))}(this,t,e);var r=new o(i);return l(this,new d(t,e,r)),r}},4445:(t,e,r)=>{"use strict";var n=r(3434);t.exports=n,n.prototype.done=function(t,e){(arguments.length?this.then.apply(this,arguments):this).then(null,(function(t){setTimeout((function(){throw t}),0)}))}},1803:(t,e,r)=>{"use strict";var n=r(3434);t.exports=n;var i=c(!0),s=c(!1),a=c(null),o=c(void 0),l=c(0),u=c("");function c(t){var e=new n(n._n);return e._i=1,e._j=t,e}n.resolve=function(t){if(t instanceof n)return t;if(null===t)return a;if(void 0===t)return o;if(!0===t)return i;if(!1===t)return s;if(0===t)return l;if(""===t)return u;if("object"==typeof t||"function"==typeof t)try{var e=t.then;if("function"==typeof e)return new n(e.bind(t))}catch(t){return new n((function(e,r){r(t)}))}return c(t)},n.all=function(t){var e=Array.prototype.slice.call(t);return new n((function(t,r){if(0===e.length)return t([]);var i=e.length;function s(a,o){if(o&&("object"==typeof o||"function"==typeof o)){if(o instanceof n&&o.then===n.prototype.then){for(;3===o._i;)o=o._j;return 1===o._i?s(a,o._j):(2===o._i&&r(o._j),void o.then((function(t){s(a,t)}),r))}var l=o.then;if("function"==typeof l)return void new n(l.bind(o)).then((function(t){s(a,t)}),r)}e[a]=o,0==--i&&t(e)}for(var a=0;a<e.length;a++)s(a,e[a])}))},n.reject=function(t){return new n((function(e,r){r(t)}))},n.race=function(t){return new n((function(e,r){t.forEach((function(t){n.resolve(t).then(e,r)}))}))},n.prototype.catch=function(t){return this.then(null,t)}},8029:(t,e,r)=>{"use strict";var n=r(3434);t.exports=n,n.prototype.finally=function(t){return this.then((function(e){return n.resolve(t()).then((function(){return e}))}),(function(e){return n.resolve(t()).then((function(){throw e}))}))}},2159:(t,e,r)=>{"use strict";t.exports=r(3434),r(4445),r(8029),r(1803),r(2490),r(3690)},2490:(t,e,r)=>{"use strict";var n=r(3434),i=r(9272);t.exports=n,n.denodeify=function(t,e){return"number"==typeof e&&e!==1/0?function(t,e){for(var r=[],i=0;i<e;i++)r.push("a"+i);var a=["return function ("+r.join(",")+") {","var self = this;","return new Promise(function (rs, rj) {","var res = fn.call(",["self"].concat(r).concat([s]).join(","),");","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],a)(n,t)}(t,e):function(t){for(var e=Math.max(t.length-1,3),r=[],i=0;i<e;i++)r.push("a"+i);var a=["return function ("+r.join(",")+") {","var self = this;","var args;","var argLength = arguments.length;","if (arguments.length > "+e+") {","args = new Array(arguments.length + 1);","for (var i = 0; i < arguments.length; i++) {","args[i] = arguments[i];","}","}","return new Promise(function (rs, rj) {","var cb = "+s+";","var res;","switch (argLength) {",r.concat(["extra"]).map((function(t,e){return"case "+e+":res = fn.call("+["self"].concat(r.slice(0,e)).concat("cb").join(",")+");break;"})).join(""),"default:","args[argLength] = cb;","res = fn.apply(self, args);","}","if (res &&",'(typeof res === "object" || typeof res === "function") &&','typeof res.then === "function"',") {rs(res);}","});","};"].join("");return Function(["Promise","fn"],a)(n,t)}(t)};var s="function (err, res) {if (err) { rj(err); } else { rs(res); }}";n.nodeify=function(t){return function(){var e=Array.prototype.slice.call(arguments),r="function"==typeof e[e.length-1]?e.pop():null,s=this;try{return t.apply(this,arguments).nodeify(r,s)}catch(t){if(null==r)return new n((function(e,r){r(t)}));i((function(){r.call(s,t)}))}}},n.prototype.nodeify=function(t,e){if("function"!=typeof t)return this;this.then((function(r){i((function(){t.call(e,null,r)}))}),(function(r){i((function(){t.call(e,r)}))}))}},3690:(t,e,r)=>{"use strict";var n=r(3434);t.exports=n,n.enableSynchronous=function(){n.prototype.isPending=function(){return 0==this.getState()},n.prototype.isFulfilled=function(){return 1==this.getState()},n.prototype.isRejected=function(){return 2==this.getState()},n.prototype.getValue=function(){if(3===this._i)return this._j.getValue();if(!this.isFulfilled())throw new Error("Cannot get a value of an unfulfilled promise.");return this._j},n.prototype.getReason=function(){if(3===this._i)return this._j.getReason();if(!this.isRejected())throw new Error("Cannot get a rejection reason of a non-rejected promise.");return this._j},n.prototype.getState=function(){return 3===this._i?this._j.getState():-1===this._i||-2===this._i?0:this._i}},n.disableSynchronous=function(){n.prototype.isPending=void 0,n.prototype.isFulfilled=void 0,n.prototype.isRejected=void 0,n.prototype.getValue=void 0,n.prototype.getReason=void 0,n.prototype.getState=void 0}},7563:(t,e,r)=>{"use strict";const n=r(610),i=r(4020),s=r(500),a=r(2806),o=Symbol("encodeFragmentIdentifier");function l(t){if("string"!=typeof t||1!==t.length)throw new TypeError("arrayFormatSeparator must be single character string")}function u(t,e){return e.encode?e.strict?n(t):encodeURIComponent(t):t}function c(t,e){return e.decode?i(t):t}function h(t){return Array.isArray(t)?t.sort():"object"==typeof t?h(Object.keys(t)).sort(((t,e)=>Number(t)-Number(e))).map((e=>t[e])):t}function d(t){const e=t.indexOf("#");return-1!==e&&(t=t.slice(0,e)),t}function f(t){const e=(t=d(t)).indexOf("?");return-1===e?"":t.slice(e+1)}function p(t,e){return e.parseNumbers&&!Number.isNaN(Number(t))&&"string"==typeof t&&""!==t.trim()?t=Number(t):!e.parseBooleans||null===t||"true"!==t.toLowerCase()&&"false"!==t.toLowerCase()||(t="true"===t.toLowerCase()),t}function g(t,e){l((e=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},e)).arrayFormatSeparator);const r=function(t){let e;switch(t.arrayFormat){case"index":return(t,r,n)=>{e=/\[(\d*)\]$/.exec(t),t=t.replace(/\[\d*\]$/,""),e?(void 0===n[t]&&(n[t]={}),n[t][e[1]]=r):n[t]=r};case"bracket":return(t,r,n)=>{e=/(\[\])$/.exec(t),t=t.replace(/\[\]$/,""),e?void 0!==n[t]?n[t]=[].concat(n[t],r):n[t]=[r]:n[t]=r};case"colon-list-separator":return(t,r,n)=>{e=/(:list)$/.exec(t),t=t.replace(/:list$/,""),e?void 0!==n[t]?n[t]=[].concat(n[t],r):n[t]=[r]:n[t]=r};case"comma":case"separator":return(e,r,n)=>{const i="string"==typeof r&&r.includes(t.arrayFormatSeparator),s="string"==typeof r&&!i&&c(r,t).includes(t.arrayFormatSeparator);r=s?c(r,t):r;const a=i||s?r.split(t.arrayFormatSeparator).map((e=>c(e,t))):null===r?r:c(r,t);n[e]=a};case"bracket-separator":return(e,r,n)=>{const i=/(\[\])$/.test(e);if(e=e.replace(/\[\]$/,""),!i)return void(n[e]=r?c(r,t):r);const s=null===r?[]:r.split(t.arrayFormatSeparator).map((e=>c(e,t)));void 0!==n[e]?n[e]=[].concat(n[e],s):n[e]=s};default:return(t,e,r)=>{void 0!==r[t]?r[t]=[].concat(r[t],e):r[t]=e}}}(e),n=Object.create(null);if("string"!=typeof t)return n;if(!(t=t.trim().replace(/^[?#&]/,"")))return n;for(const i of t.split("&")){if(""===i)continue;let[t,a]=s(e.decode?i.replace(/\+/g," "):i,"=");a=void 0===a?null:["comma","separator","bracket-separator"].includes(e.arrayFormat)?a:c(a,e),r(c(t,e),a,n)}for(const t of Object.keys(n)){const r=n[t];if("object"==typeof r&&null!==r)for(const t of Object.keys(r))r[t]=p(r[t],e);else n[t]=p(r,e)}return!1===e.sort?n:(!0===e.sort?Object.keys(n).sort():Object.keys(n).sort(e.sort)).reduce(((t,e)=>{const r=n[e];return Boolean(r)&&"object"==typeof r&&!Array.isArray(r)?t[e]=h(r):t[e]=r,t}),Object.create(null))}e.extract=f,e.parse=g,e.stringify=(t,e)=>{if(!t)return"";l((e=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},e)).arrayFormatSeparator);const r=r=>e.skipNull&&null==t[r]||e.skipEmptyString&&""===t[r],n=function(t){switch(t.arrayFormat){case"index":return e=>(r,n)=>{const i=r.length;return void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[u(e,t),"[",i,"]"].join("")]:[...r,[u(e,t),"[",u(i,t),"]=",u(n,t)].join("")]};case"bracket":return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[u(e,t),"[]"].join("")]:[...r,[u(e,t),"[]=",u(n,t)].join("")];case"colon-list-separator":return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,[u(e,t),":list="].join("")]:[...r,[u(e,t),":list=",u(n,t)].join("")];case"comma":case"separator":case"bracket-separator":{const e="bracket-separator"===t.arrayFormat?"[]=":"=";return r=>(n,i)=>void 0===i||t.skipNull&&null===i||t.skipEmptyString&&""===i?n:(i=null===i?"":i,0===n.length?[[u(r,t),e,u(i,t)].join("")]:[[n,u(i,t)].join(t.arrayFormatSeparator)])}default:return e=>(r,n)=>void 0===n||t.skipNull&&null===n||t.skipEmptyString&&""===n?r:null===n?[...r,u(e,t)]:[...r,[u(e,t),"=",u(n,t)].join("")]}}(e),i={};for(const e of Object.keys(t))r(e)||(i[e]=t[e]);const s=Object.keys(i);return!1!==e.sort&&s.sort(e.sort),s.map((r=>{const i=t[r];return void 0===i?"":null===i?u(r,e):Array.isArray(i)?0===i.length&&"bracket-separator"===e.arrayFormat?u(r,e)+"[]":i.reduce(n(r),[]).join("&"):u(r,e)+"="+u(i,e)})).filter((t=>t.length>0)).join("&")},e.parseUrl=(t,e)=>{e=Object.assign({decode:!0},e);const[r,n]=s(t,"#");return Object.assign({url:r.split("?")[0]||"",query:g(f(t),e)},e&&e.parseFragmentIdentifier&&n?{fragmentIdentifier:c(n,e)}:{})},e.stringifyUrl=(t,r)=>{r=Object.assign({encode:!0,strict:!0,[o]:!0},r);const n=d(t.url).split("?")[0]||"",i=e.extract(t.url),s=e.parse(i,{sort:!1}),a=Object.assign(s,t.query);let l=e.stringify(a,r);l&&(l=`?${l}`);let c=function(t){let e="";const r=t.indexOf("#");return-1!==r&&(e=t.slice(r)),e}(t.url);return t.fragmentIdentifier&&(c=`#${r[o]?u(t.fragmentIdentifier,r):t.fragmentIdentifier}`),`${n}${l}${c}`},e.pick=(t,r,n)=>{n=Object.assign({parseFragmentIdentifier:!0,[o]:!1},n);const{url:i,query:s,fragmentIdentifier:l}=e.parseUrl(t,n);return e.stringifyUrl({url:i,query:a(s,r),fragmentIdentifier:l},n)},e.exclude=(t,r,n)=>{const i=Array.isArray(r)?t=>!r.includes(t):(t,e)=>!r(t,e);return e.pick(t,i,n)}},500:t=>{"use strict";t.exports=(t,e)=>{if("string"!=typeof t||"string"!=typeof e)throw new TypeError("Expected the arguments to be of type `string`");if(""===e)return[t];const r=t.indexOf(e);return-1===r?[t]:[t.slice(0,r),t.slice(r+e.length)]}},610:t=>{"use strict";t.exports=t=>encodeURIComponent(t).replace(/[!'()*]/g,(t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`))},9947:t=>{t.exports='<svg id="sp-airplay-icon" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" viewBox="-9 -9 42 42" fill="white"><g><polygon points="6,22 18,22 12,16"></polygon><path d="M21,3H3C1.9,3,1,3.9,1,5v12c0,1.1,0.9,2,2,2h4v-2H3V5h18v12h-4v2h4c1.1,0,2-0.9,2-2V5C23,3.9,22.1,3,21,3z"></path></g><rect fill="none" height="24" width="24"></rect></svg>'},4001:(t,e,r)=>{var n=r(3823),i=r(8121);n.adapters.Hlsjs=n.Adapter.extend({getVersion:function(){return i.version+"-"+i.name+"-"+i.tech},getPlayhead:function(){var t=null;return this.tag&&(t=this.tag.currentTime),t},getPlayrate:function(){var t=null;return this.tag&&(t=this.tag.playbackRate),t},getDroppedFrames:function(){var t=null;return this.tag&&(t=this.tag.webkitDroppedFrameCount),t},getDuration:function(){var t=null;return this.tag&&!this.getIsLive()&&(t=this.tag.duration),t},getBitrate:function(){var t=null;return-1!==this.player.currentLevel&&this.player.levels[this.player.currentLevel]&&(t=this.player.levels[this.player.currentLevel].bitrate),t},getRendition:function(){var t=null;if(-1!==this.player.currentLevel){var e=this.player.levels[this.player.currentLevel];e&&(e.name?t=e.name:e.bitrate&&(t=n.Util.buildRenditionString(e.width,e.height,e.bitrate)))}return t},getIsLive:function(){var t=null;return this.player.levels&&this.player.levels[this.player.currentLevel]&&(t=this.player.levels[this.player.currentLevel].details.live),t},getLatency:function(){var t=this.player.latency;return t?1e3*t:void 0},getResource:function(){return this.player.url},getPlayerVersion:function(){return"undefined"!=typeof Hls?Hls.version:"unknown"},getPlayerName:function(){return"Hls.js"},registerListeners:function(){if(this.mediaFound)for(var t in this.hlsReference||this.hlsMediaReference||(this.tag=this.player?this.player.media:null,this._registerHlsRef()),this.references={play:this.playListener.bind(this),pause:this.pauseListener.bind(this),playing:this.playingListener.bind(this),seeking:this.seekingListener.bind(this),error:this.errorListener.bind(this),ended:this.endedListener.bind(this),progress:this.progressListener.bind(this),waiting:this.bufferingListener.bind(this)},this.references)this.tag.addEventListener(t,this.references[t]);else this._registerHlsRef()},_registerHlsRef:function(){this.hlsReference=this.hlsErrorListener.bind(this),this.hlsMediaReference=this.getTagListener.bind(this),this.player.on("hlsError",this.hlsReference,this),this.player.on("hlsMediaAttached",this.hlsMediaReference)},unregisterListeners:function(){if(this.monitor&&this.monitor.stop(),this.player&&(this.hlsReference&&this.player.off("hlsError",this.hlsReference,this),this.hlsMediaReference&&this.player.off("hlsMediaAttached",this.hlsMediaReference),this.hlsReference=null,this.hlsMediaReference=null),this.tag&&this.references){for(var t in this.references)this.tag.removeEventListener(t,this.references[t]);delete this.references}},progressListener:function(t){this.flags.isStarted?!this.flags.isJoined&&this.plugin.getIsLive()&&this.fireJoin({},"progressListener"):this.getPlayhead()>1&&(this.startedOnce||!this.plugin.getIsLive())&&(this.fireStart({},"progressListener"),this.fireJoin({},"progressListener"))},playListener:function(t){this.fireStart({},"playListener"),this.startedOnce=!0},pauseListener:function(t){this.flags.isBuffering||(this.firePause({},"pauseListener"),this.pauseStamp=t.timeStamp)},playingListener:function(t){this.fireJoin({},"playingListener"),this.fireBufferEnd({},"playingListener"),this.fireSeekEnd({},"playingListener"),this.fireResume({},"playingListener")},seekingListener:function(t){this.fireSeekBegin({},!1,"seekingListener")},bufferingListener:function(t){this.tag&&2!==this.tag.readyState||this.fireBufferBegin({},!1,"bufferingListener")},errorListener:function(t){t&&t.data&&t.data.code&&t.data.message?this.fireError(t.data.code,t.data.message,void 0,void 0,"errorListener"):t&&t.data&&t.data.code?this.fireError(t.data.code,"PLAY FAILURE",void 0,void 0,"errorListener"):this.tag&&this.tag.error&&this.tag.error.code&&this.fireError(this.tag.error.code,"PLAY FAILURE",void 0,void 0,"errorListener")},endedListener:function(t){this.fireStop({},"endedListener")},hlsErrorListener:function(t,e){e.fatal&&this.fireFatalError(e.details,"PLAYER FAILURE",void 0,void 0,"hlsErrorListener")},getTagListener:function(){this.tag=this.player?this.player.media:null,this.mediaFound=!0,this.registerListeners()}}),t.exports=n.adapters.Hlsjs},7442:(t,e,r)=>{var n=r(6471),i=r(9777),s={getPosition:function(){return null},getGivenBreaks:function(){return null},getExpectedBreaks:function(){return null},getExpectedPattern:function(){return null},getBreaksTime:function(){return null},getGivenAds:function(){return null},getExpectedAds:function(){return null},getIsVisible:function(){return!0},getAudioEnabled:function(){return null},getIsSkippable:function(){return null},getIsFullscreen:function(){return null},getCampaign:function(){return null},getCreativeId:function(){return null},getProvider:function(){return null},getAdInsertionType:function(){return null},fireClick:function(t){"string"==typeof t&&(t={url:t}),this.emit(n.Event.CLICK,{params:t})},fireQuartile:function(t){this.flags.isStarted&&"number"==typeof t&&t>this.flags.lastQuartileSent&&t<4&&(this.flags.lastQuartileSent++,this.emit(n.Event.QUARTILE,{params:{quartile:t}}))},startChronoView:function(){if(this.getIsVisible()&&!this.plugin.backgroundDetector.isInBackground){var t=this.chronos.viewedMax;0!==t.length&&0===t[t.length-1].stopTime||(t.push(new i),t[t.length-1].start())}},stopChronoView:function(){var t=this.chronos.viewedMax;t[0]&&t.length>0&&0===t[t.length-1].stopTime&&t[t.length-1].stop()},fireManifest:function(t,e){var r={params:t};"string"==typeof t&&(r={params:{errorType:t,errorMessage:e}}),this.emit(n.Event.MANIFEST,r)},fireSkip:function(t){void 0===t&&(t={}),t.skipped=!0,this.fireStop(t)},fireBreakStart:function(t){this.emit(n.Event.PODSTART,{params:t})},fireBreakStop:function(t){this.emit(n.Event.PODSTOP,{params:t})}};t.exports=s},8590:(t,e,r)=>{var n=r(6471),i=r(6654),s={getPlayrate:function(){return this.flags.isPaused?0:1},getFramesPerSecond:function(){return null},getDroppedFrames:function(){return null},getThroughput:function(){return null},getRendition:function(){return null},getTitle2:function(){return null},getIsLive:function(){return null},getCdnTraffic:function(){return null},getP2PTraffic:function(){return null},getUploadTraffic:function(){return null},getIsP2PEnabled:function(){return null},getSegmentDuration:function(){return null},getHouseholdId:function(){return null},getLatency:function(){return null},getPacketLoss:function(){return null},getPacketSent:function(){return null},getMetrics:function(){return null},getAudioCodec:function(){return null},getVideoCodec:function(){return null},getURLToParse:function(){return null},fireSeekBegin:function(t,e,r){if(this._discardFalseBuffers(),this.plugin&&this.plugin.getIsLive()&&this.plugin.options["content.isLive.noSeek"])return null;if(this.flags.isJoined&&!this.flags.isSeeking){if(this.flags.isBuffering){if(!1===e)return;i.notice("Converting current buffer to seek"),this.chronos.seek=this.chronos.buffer.clone(),this.chronos.buffer.reset(),this.flags.isBuffering=!1}else this.chronos.seek.start();try{this.fireEventsStruct.seek=[],r?this.fireEventsStruct.seek.push(r):this.fireEventsStruct.seek.push("undefinedEvent")}catch(t){}this.flags.isSeeking=!0,this.emit(n.Event.SEEK_BEGIN,{params:t})}},fireSeekEnd:function(t,e){if(this.plugin&&this.plugin.getIsLive()&&this.plugin.options["content.isLive.noSeek"])return null;if(this.flags.isJoined&&this.flags.isSeeking){try{e?this.fireEventsStruct.seek.push(e):this.fireEventsStruct.seek.push("undefinedEvent")}catch(t){}(t=t||{}).triggeredEvents=this.fireEventsStruct.seek,this.cancelSeek(),this.emit(n.Event.SEEK_END,{params:t})}},cancelSeek:function(t){this.flags.isJoined&&this.flags.isSeeking&&(this.flags.isSeeking=!1,this.chronos.seek.stop(),this.monitor&&this.monitor.skipNextTick())},fireEvent:function(t,e,r,i){var s=i||{};s.name=t||"",s.dimensions=e||{},s.values=r||{},this.emit(n.Event.VIDEO_EVENT,{params:s})}};t.exports=s},5382:(t,e,r)=>{var n=r(8600),i=r(6654),s=r(3183),a=r(1095),o=r(8267),l=r(6686),u=r(6011),c=r(461),h=r(6471),d=n.extend({constructor:function(t){this.flags=new l,this.chronos=new o,this.fireEventsStruct={},this.fireEventsStruct.buffer=[],this.fireEventsStruct.seek=[],this.monitor=null,this.plugin=null,this.player=null,this._isAdsAdapter=null,this.setPlayer(t),this.tag=this.player,i.notice("Adapter "+this.getVersion()+" with Lib "+a+" is ready.")},setPlayer:function(t){this.player&&this.unregisterListeners(),"string"==typeof t&&"undefined"!=typeof document?this.player=document.getElementById(t):this.player=t,this.registerListeners()},registerListeners:function(){},unregisterListeners:function(){},dispose:function(){this.stopMonitor(),this.stopReadyStateMonitor(),this.fireStop(),this.unregisterListeners(),this.player=null,this.tag=null},monitorPlayhead:function(t,e,r){this.stopMonitor();var n=0;t&&(n|=u.Type.BUFFER),e&&(n|=u.Type.SEEK),this.monitor&&this.monitor._timer.isRunning?this.monitor.skipNextTick():this.monitor=new u(this,n,r)},stopMonitor:function(){this.monitor&&this.monitor.stop()},monitorReadyState:function(t){this.stopReadyStateMonitor(),this.stateMonitor=new c(this,t)},startReadyStateMonitor:function(){this.stateMonitor&&this.stateMonitor.start()},stopReadyStateMonitor:function(){this.stateMonitor&&this.stateMonitor.stop()},checkReadyState:function(t,e){try{this.plugin&&this.plugin.getReadyStateMonitorEnabled()&&t&&(t>3&&!this.flags.isSeeking?this.flags.isBuffering?this.fireBufferEnd({},e+"-readyState"):this.flags.isJoined||this.fireJoin({},e+"-readyState"):t<4&&!this.flags.isBuffering&&this.fireBufferBegin({},!1,e+"-readyState",!0))}catch(t){i.error("Can't check readyState property correctly")}},getPlayhead:function(){return null},getDuration:function(){return null},getBitrate:function(){return null},getTotalBytes:function(){return null},getTitle:function(){return null},getResource:function(){return null},getPlayerVersion:function(){return null},getPlayerName:function(){return null},getVersion:function(){return a+"-generic-js"},getVideoObject:function(){return null},fireInit:function(t,e){this.plugin&&this.plugin.fireInit(t,e)},fireStart:function(t,e){if(this.plugin&&this.plugin.backgroundDetector&&this.plugin.backgroundDetector.canBlockStartCalls())return null;this.flags.isStarted||(this.flags.isStarted=!0,this.chronos.total.start(),this.chronos.join.start(),e&&((t=t||{}).triggeredEvents=[e]),this.startReadyStateMonitor(),this.emit(h.Event.START,{params:t}))},fireJoin:function(t,e){this.flags.isJoined||this.flags.isStarted||this._isAds()||!this.plugin||!this.plugin.isInitiated||this.fireStart({},e),this.flags.isStarted&&!this.flags.isJoined&&(this.flags.isStarted=!0,this.monitor&&this.monitor.start(),this.flags.isJoined=!0,this.chronos.join.stop(),e&&((t=t||{}).triggeredEvents=[e]),this.emit(h.Event.JOIN,{params:t}))},firePause:function(t,e){this._discardFalseBuffers(),this.flags.isBuffering&&this.fireBufferEnd(null,"firePauseCall"),this.flags.isJoined&&!this.flags.isPaused&&(this.flags.isPaused=!0,this.chronos.pause.start(),e&&((t=t||{}).triggeredEvents=[e]),this.emit(h.Event.PAUSE,{params:t}))},fireResume:function(t,e){this._discardFalseBuffers(),this.flags.isJoined&&this.flags.isPaused&&(this.flags.isPaused=!1,this.chronos.pause.stop(),this.monitor&&this.monitor.skipNextTick(),e&&((t=t||{}).triggeredEvents=[e]),this.emit(h.Event.RESUME,{params:t}))},fireBufferBegin:function(t,e,r,n){if(n=n||!1,this.flags.isJoined&&!this.flags.isBuffering){if(this.flags.isSeeking){if(!e)return;i.notice("Converting current buffer to seek"),this.chronos.buffer=this.chronos.seek.clone(),this.chronos.seek.reset(),this.flags.isSeeking=!1}else this.chronos.buffer.start();try{this.fireEventsStruct.buffer=[],r?this.fireEventsStruct.buffer.push(r):this.fireEventsStruct.buffer.push("undefinedEvent")}catch(t){}this.flags.isBuffering=!0,this.flags.isVideoStateBuffering=n,this.emit(h.Event.BUFFER_BEGIN,{params:t})}},fireBufferEnd:function(t,e){if(this.flags.isJoined&&this.flags.isBuffering){try{e?this.fireEventsStruct.buffer.push(e):this.fireEventsStruct.buffer.push("undefinedEvent")}catch(t){}(t=t||{}).triggeredEvents=this.fireEventsStruct.buffer,this.cancelBuffer(),this.emit(h.Event.BUFFER_END,{params:t})}},_discardFalseBuffers:function(){try{this.flags.isBuffering&&this.flags.isVideoStateBuffering&&this._getDeltaBufferTime()<=100&&this.cancelBuffer()}catch(t){}},cancelBuffer:function(t){this.flags.isJoined&&this.flags.isBuffering&&(this.flags.isBuffering=!1,this.flags.isVideoStateBuffering=!1,this.chronos.buffer.stop(),this.monitor&&this.monitor.skipNextTick())},_getDeltaBufferTime:function(){return this.chronos&&this.chronos.buffer?this.chronos.buffer.getDeltaTime(!1):0},fireStop:function(t,e){(this._isAds()||this.plugin&&this.plugin._isStopReady())&&(this._isAds()&&this.flags.isStarted||!this._isAds()&&(this.flags.isStarted||this.plugin&&this.plugin.isInitiated))&&(this.stopMonitor(),this.stopReadyStateMonitor(),this.flags.reset(),this.chronos.total.stop(),this.chronos.join.reset(),this.chronos.pause.stop(),this.chronos.buffer.stop(),this.chronos.seek.stop(),e&&((t=t||{}).triggeredEvents=[e]),this.emit(h.Event.STOP,{params:t}),this.chronos.pause.reset(),this.chronos.buffer.reset(),this.chronos.seek.reset(),this.chronos.viewedMax.splice(0,this.chronos.viewedMax.length))},setIsAds:function(t){this._isAdsAdapter=t},_isAds:function(){return this._isAdsAdapter},fireCasted:function(t,e){t||(t={}),t.casted=!0,this.fireStop(t,e)},fireError:function(t,e,r,n,i){var a=s.buildErrorParams(t,e,r,n);a.code&&delete a.code,i&&((a=a||{}).triggeredEvents=[i]);var o=this.plugin?this.plugin.options:{};void 0!==a.errorCode&&o["errors.ignore"]&&o["errors.ignore"].indexOf(a.errorCode.toString())>-1||(this.emit(h.Event.ERROR,{params:a}),void 0!==a.errorCode&&o["errors.fatal"]&&o["errors.fatal"].indexOf(a.errorCode.toString())>-1&&this.fireStop({},i))},fireFatalError:function(t,e,r,n,i){var s=this.plugin?this.plugin.options:{};void 0!==t&&s["errors.ignore"]&&s["errors.ignore"].indexOf(t.toString())>-1||(this.monitor&&this.monitor.stop(),this.fireError(t,e,r,n,i),void 0!==t&&s["errors.nonFatal"]&&s["errors.nonFatal"].indexOf(t.toString())>-1||this.fireStop({},i))}},{Event:h.Event});s.assign(d.prototype,r(7442)),s.assign(d.prototype,r(8590)),t.exports=d},8267:(t,e,r)=>{var n=r(7569),i=r(9777),s=n.extend({constructor:function(){this.reset()},reset:function(){this.join=new i,this.seek=new i,this.pause=new i,this.buffer=new i,this.total=new i,this.viewedMax=[]}});t.exports=s},6686:(t,e,r)=>{var n=r(7569).extend({constructor:function(){this.reset()},reset:function(){this.isStarted=!1,this.isJoined=!1,this.isPaused=!1,this.isSeeking=!1,this.isBuffering=!1,this.isVideoStateBuffering=!1,this.isEnded=!1,this.isStopped=!1,this.lastQuartileSent=0}});t.exports=n},6011:(t,e,r)=>{var n=r(7569),i=r(7664),s=r(9777),a=n.extend({constructor:function(t,e,r){this._adapter=t,this._seekEnabled=e&a.Type.SEEK,this._bufferEnabled=e&a.Type.BUFFER,r=r||800,this._chrono=new s,this._lastPlayhead=0,r>0&&(this._timer=new i(this.progress.bind(this),r))},start:function(){this.stop(),this.canBeUsed()&&this._timer.start()},stop:function(){this._lastPlayhead=0,this._timer&&this._timer.stop()},skipNextTick:function(){this._lastPlayhead=0},progress:function(){var t=this._chrono.stop();this._chrono.start();var e=t*a.kBUFFER_THRESHOLD_RATIO,r=t*a.kSEEK_THRESHOLD_RATIO;this._adapter.getPlayrate&&this._adapter.getPlayrate()&&1!==this._adapter.getPlayrate()&&(e*=this._adapter.getPlayrate(),r*=this._adapter.getPlayrate());var n=this._getPlayhead(),i=1e3*Math.abs(this._lastPlayhead-n);i<e?this._bufferEnabled&&this._lastPlayhead>0&&!this._adapter.flags.isPaused&&!this._adapter.flags.isSeeking&&this._adapter.fireBufferBegin(null,!1,"playheadMonitor"):i>r?this._seekEnabled&&this._lastPlayhead>0&&this._adapter.fireSeekBegin(null,!1,"playheadMonitor"):(this._seekEnabled&&this._adapter.fireSeekEnd(null,"playheadMonitor"),this._bufferEnabled&&this._adapter.fireBufferEnd(null,"playheadMonitor")),this._lastPlayhead=n},canBeUsed:function(){var t=this._adapter.plugin;return!(!t||!t.getPlayheadMonitorEnabled()||!this._seekEnabled&&!this._bufferEnabled||t.getIsLive()&&t.options["content.isLive.noMonitor"])},_getPlayhead:function(){return this._adapter.getPlayhead()}},{Type:{NONE:0,BUFFER:1,SEEK:2},kBUFFER_THRESHOLD_RATIO:.5,kSEEK_THRESHOLD_RATIO:2});t.exports=a},461:(t,e,r)=>{var n=r(7569),i=r(6654),s=n.extend({constructor:function(t,e){this._adapter=t,this._videoElement=t.getVideoObject(),this._startedStateCheck=!1,this._intervalCheckId=null,this._intervalMilliseconds=e||300},start:function(){var t=this._adapter.plugin;t&&t.getReadyStateMonitorEnabled()&&this._videoElement&&!this._startedStateCheck&&(this._intervalCheckId=setInterval(this.checkStateProperty.bind(this),this._intervalMilliseconds),this._startedStateCheck=!0)},stop:function(){try{this._startedStateCheck&&this._intervalCheckId&&clearInterval(this._intervalCheckId),this._intervalCheckId=null,this._startedStateCheck=!1}catch(t){i.error("Produced error stopping the network monitor")}},checkStateProperty:function(t){try{this._videoElement&&this._adapter&&this._videoElement.readyState&&(this._videoElement.readyState>3&&!this._adapter.flags.isSeeking?this._adapter.flags.isBuffering?this.fireBufferEnd({},"stateMonitor"):this._adapter.flags.isJoined||this.fireJoin({},"stateMonitor"):this._videoElement.readyState<4&&!this._adapter.flags.isBuffering&&this.fireBufferBegin({},!1,"stateMonitor",!0))}catch(t){}}});t.exports=s},9777:(t,e,r)=>{var n=r(7569).extend({constructor:function(){this.reset()},reset:function(){this.startTime=0,this.stopTime=0,this.pauseTime=0,this.offset=0},getDeltaTime:function(t){var e=-1,r=(new Date).getTime();if(this.startTime){t&&!this.stopTime&&(this.stopTime=r);var n=this.pauseTime?r-this.pauseTime:0,i=this.stopTime?this.stopTime:r;e=this.offset-n+(i-this.startTime)}return e},start:function(){this.startTime=(new Date).getTime(),this.stopTime=0,this.offset=0},stop:function(){return this.pauseTime&&this.resume(),this.stopTime=(new Date).getTime(),this.startTime?this.offset+(this.stopTime-this.startTime):-1},pause:function(){this.pauseTime=(new Date).getTime()},resume:function(){this.offset-=(new Date).getTime()-this.pauseTime,this.pauseTime=0},clone:function(){var t=new n;return t.startTime=this.startTime,t.stopTime=this.stopTime,t.offset=this.offset,t}});t.exports=n},6596:(t,e,r)=>{var n=r(7569),i=r(6654),s=r(5013),a=r(1935),o=n.extend({constructor:function(t){this.transforms=[],this.pluginRef=t,this._requests=[]},sendRequest:function(t,e,r){t&&("function"==typeof e&&t.on(s.Event.SUCCESS,e,r),this._registerRequest(t))},buildRequest:function(t,e,r,n){var i=new s(t,e,r=r||{});"function"==typeof n&&i.on(s.Event.SUCCESS,n),this._registerRequest(i)},addTransform:function(t){t.parse&&t.isBlocking?(this.transforms.push(t),t.on(a.Event.DONE,this._processRequests.bind(this))):i.warn(t+" is not a valid RequestTransform.")},removeTransform:function(t){var e=this.transforms.indexOf(t);-1!==e?this.transforms.splice(e,1):i.warn("Trying to remove unexisting Transform '"+t+"'.")},_registerRequest:function(t){if(this.pluginRef){var e=this.pluginRef.options;e.authToken&&(t.options.requestHeaders.Authorization=e.authType+" "+e.authToken)}this._requests.push(t),this._processRequests()},_processRequests:function(){var t=this._requests;this._requests=[];for(var e=[];t.length;){var r=t.shift(),n=this._transform(r);n===a.STATE_NO_BLOCKED?(this.pluginRef&&(r.host=this.pluginRef.getHost()),r.send()):n===a.STATE_BLOCKED&&e.push(r)}for(;e.length;)this._requests.push(e.shift())},_transform:function(t){var e=a.STATE_NO_BLOCKED;return this.transforms.forEach((function(r){r.isBlocking(t)?e=a.STATE_BLOCKED:(r.parse(t),r.getState()===a.STATE_OFFLINE&&(e=a.STATE_OFFLINE))})),e}});t.exports=o},5013:(t,e,r)=>{var n=r(7569),i=r(6654),s=r(3183),a=n.extend({constructor:function(t,e,r,n){this.xhr=this.createXHR(),this.host=t||"",this.service=e||"",this.params=r||{},this.options=s.assign({},a.defaultOptions,n),this.retries=0,this.sendPostRequest=!1,this.preparedPostRequest=!1,this.options.cache||this.setParam("timemark",(new Date).getTime())},createXHR:function(){var t={};try{t=XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")}catch(t){i.error(t)}return t},getXHR:function(){return this.xhr},getResponse:function(){return this.xhr.response},getResponseText:function(){return this.xhr.responseText},getResponseHeaders:function(){return this.xhr.getAllResponseHeaders()},getUrl:function(){return this.host+this.service+this.getParamString()},on:function(t,e,r){return this.xhr.addEventListener?this.xhr.addEventListener(t,e.bind(this,this,r)):t===a.Event.SUCCESS&&(this.xhr.onreadystatechange=function(){4===this.xhr.readyState&&e.bind(this,this,r)}.bind(this)),this},off:function(t,e){return this.xhr.removeEventListener(t,e),this},getParamString:function(){try{var t="?";for(var e in this.params){var r=this.params[e];if(null!==r&&"object"==typeof r){var n=JSON.stringify(r);"{}"!==n&&(t+=encodeURIComponent(e)+"="+encodeURIComponent(n)+"&")}else null!=r&&""!==r&&(t+=encodeURIComponent(e)+"="+encodeURIComponent(r)+"&")}return t.slice(0,-1)}catch(t){return i.error(t),""}},getParam:function(t){return this.params[t]},setParam:function(t,e){return this.params[t]=e,this},setBody:function(t){this.body=t},setPostRequest:function(t){this.sendPostRequest=t},getParamsForPostMessages:function(){var t={};try{var e=this.getParam("timemark"),r=this.getParam("code"),n=this.getParam("sessionRoot"),s=this.getParam("sessionId");e&&(t.timemark=e),r&&(t.code=r),n&&(t.sessionRoot=n),s&&(t.sessionId=s)}catch(t){i.error(t)}return t},send:function(){try{try{this.sendPostRequest&&!this.preparedPostRequest&&(this.options.method="POST",this.body=JSON.stringify(this.params),this.params=this.getParamsForPostMessages(),this.preparedPostRequest=!0)}catch(t){}if(this.xhr.open(this.options.method,this.getUrl(),!0),this.options.requestHeaders)for(var t in this.options.requestHeaders)this.options.requestHeaders.hasOwnProperty(t)&&this.xhr.setRequestHeader(t,this.options.requestHeaders[t]);for(var e in this.options.retryAfter>0&&this.options.maxRetries>0&&0===this.retries&&this.on(a.Event.ERROR,function(){if(this.retries>=this.options.maxRetries)i.error('Aborting failed request "'+this.service+'". Max retries reached.');else{i.warn('YBRequest "'+this.service+'" failed. Retry '+(this.retries+1)+" of "+this.options.maxRetries+" in "+this.options.retryAfter+"ms.");try{setTimeout(function(){this.retries+=1,this.send()}.bind(this),this.options.retryAfter)}catch(t){"undefined"!=typeof atv?atv.setTimeout(function(){this.retries+=1,this.send()}.bind(this),this.options.retryAfter):i.error(t)}}}.bind(this)),i.logLevel<=i.Level.VERBOSE&&i.verbose("XHR Req: "+this.getUrl()),a._globalListeners)a._globalListeners[e].forEach(function(t){this.on(e,t)}.bind(this));return this.xhr.send(this.body)}catch(t){i.error(t)}}},{Event:{SUCCESS:"load",LOAD:"load",ERROR:"error",ABORT:"abort"},defaultOptions:{method:"GET",requestHeaders:{},maxRetries:3,retryAfter:5e3,cache:!1},_globalListeners:{},onEvery:function(t,e){a._globalListeners[t]=a._globalListeners[t]||[],a._globalListeners[t].push(e)},offEvery:function(t,e){if(a._globalListeners[t]){var r=a._globalListeners[t].indexOf(e);-1!==r&&a._globalListeners[t].splice(r,1)}}});t.exports=a},4628:(t,e,r)=>{var n=r(1935),i=r(6229),s=n.extend({_services:[i.Service.INIT,i.Service.START,i.Service.OFFLINE_EVENTS],isBlocking:function(t){if(this._isBusy&&null!=t)if(-1!==this._services.indexOf(t.service))this.done();else if(t.service===i.Service.ERROR)return!1;return n.prototype.isBlocking.apply(this,arguments)}});t.exports=s},8548:(t,e,r)=>{var n=r(1935),i=n.extend({constructor:function(t,e){this._sendRequest=!1,this._isBusy=!1,this.plugin=t,this.session=e,this.transformName="Offline"},parse:function(t){t&&this.plugin.offlineStorage&&this.plugin.offlineStorage.addEvent(t.service,t.params)},hasToSend:function(t){return!1},getState:function(){return n.STATE_OFFLINE}});t.exports=i},7897:(t,e,r)=>{var n=r(1935),i=r(3786),s=r(4011),a=r(8233),o=r(2153),l=r(7294),u=r(5269),c=r(6654),h=r(6229),d=n.extend({constructor:function(t){d.__super__.constructor.apply(this,arguments),this._plugin=t,this._realResource=null,this._transportFormat=null,this._initResource=null,this._cdnName=null,this._cdnNodeHost=null,this._cdnNodeTypeString=null,this._cdnNodeType=null,this._responses={},this._isBusy=!1,this.transformName="Resource"},getResource:function(){return this._realResource},_getInitialCdnResource:function(){return this._realResource||this._initResource},getTransportFormat:function(){return this._transportFormat},getCdnName:function(){return this._cdnName},getNodeHost:function(){return this._cdnNodeHost},getNodeTypeString:function(){return this._cdnNodeTypeString},getNodeType:function(){return this._cdnNodeType},init:function(t){t?this._isBusy||(this._isBusy=!0,this._initResource=t,this._parseManifestEnabled=this._plugin.isParseManifest(),this._cdnEnabled=this._plugin.isParseCdnNode(),this._cdnList=this._plugin.getParseCdnNodeList().slice(),s.setBalancerHeaderName(this._plugin.getParseCdnNodeNameHeader(),this._plugin.getParseNodeHeader()),this._setTimeout(),this._parseManifestEnabled?this._isFinalUrl(this._initResource)?(this._realResource=this._initResource,this.done()):this.parseManifest():this._parseCDN()):this.done()},_isFinalUrl:function(t){var e=[".ts",".mp4",".m4s",".cmfv"];for(var r in t=t||"",e){var n=e[r];if(t.lastIndexOf(n)===t.length-n.length)return!0}return!1},_setTimeout:function(){var t=function(){this._isBusy&&(this.done(),c.warn("ResourceTransform has exceeded the maximum execution time (3s) and will be aborted."))}.bind(this);try{this._parseTimeout=setTimeout(t,3e3)}catch(e){"undefined"!=typeof atv?this._parseTimeout=atv.setTimeout(t,3e3):c.error(e)}},parseManifest:function(t,e){var r=this._plugin.options["parse.manifest.auth"],n=[new u(r),new o(r),new i(r)];this._parseManifest(n,t,e||this._initResource)},_parseManifest:function(t,e,r,n){if(t.length>0){var i=t[0];i.shouldExecute(e)?(i.on(l.Event.DONE,function(){this._parseManifest(t.slice(1,t.length),i.getLastManifest(),i.getResource(),i.getTransportFormat()||n)}.bind(this)),i.parse(r,e)):this._parseManifest(t.slice(1,t.length),e,r,n)}else this._transportFormat=n,this._realResource=r,this._parseCDN()},_parseCDN:function(){if(this._plugin.isCdnSwitch())this.switchDetector=new a(this._plugin),this.switchDetector.on(a.Events.DONE,function(t){this._cdnName=t.data,this.done()}.bind(this)),this.switchDetector.on(a.Events.ERROR,function(){this.done()}.bind(this)),this.switchDetector.init();else if(this._cdnEnabled&&this._cdnList.length>0){var t=this._cdnList.shift();if(this.getNodeHost())return;var e=s.create(t);e?(e.on(s.Event.DONE,function(){this._responses=e.getResponses(),this._cdnName=e.getParsedCdnName(),this._cdnNodeHost=e.getParsedNodeHost(),this._cdnNodeTypeString=e.getParsedNodeTypeString(),this._cdnNodeType=e.getParsedNodeType(),this.getNodeHost()?this.done():this._parseCDN()}.bind(this)),e.parse(this._getInitialCdnResource(),this._responses)):this._parseCDN()}else this.done()},parse:function(t){if(t.service===h.Service.START){var e=this._plugin.requestBuilder.lastSent;e.parsedResource=t.params.parsedResource=this.getResource()||t.params.parsedResource,e.transportFormat=t.params.transportFormat=this.getTransportFormat()||t.params.transportFormat,this._cdnEnabled&&(e.cdn=t.params.cdn=t.params.cdn||this.getCdnName(),e.nodeHost=t.params.nodeHost=this.getNodeHost()||t.params.nodeHost,e.nodeType=t.params.nodeType=this.getNodeType()||t.params.nodeType,e.nodeTypeString=t.params.nodeTypeString=this.getNodeTypeString()||t.params.nodeTypeString)}}});t.exports=d},8233:(t,e,r)=>{var n=r(8600),i=r(6654),s=r(5013),a=n.extend({constructor:function(t){this.plugin=t,this.headerName="x-cdn"},init:function(){var t=null;this.plugin&&(t=this.plugin.getAdapter()&&this.plugin.getAdapter().getURLToParse()?this.plugin.getAdapter().getURLToParse():this.plugin.getResource()),this.plugin&&this.plugin.getAdapter()&&this.plugin.getAdapter().flags.isStarted&&this._request(t)},done:function(t){this.emit(a.Events.DONE,t)},error:function(){this.emit(a.Events.ERROR)},_successfulRequest:function(t){setTimeout(this.init.bind(this),1e3*parseInt(this.plugin.options["parse.cdnTTL"]));var e=t.getResponseHeaders().split("\n"),r=null;for(var n in e){var i=e[n],s=i.indexOf(this.headerName);s>-1&&(r=i.substring(s+this.headerName.length+1,i.length-1).replace(" ",""))}this.done(r)},_failedRequest:function(){setTimeout(this.init.bind(this),1e3*parseInt(this.plugin.options["parse.cdnTTL"])),i.warn("CDN switch detection request failed"),this.error()},_request:function(t){var e=new s(t,null,null,{method:"HEAD",cache:!0});e.on(s.Event.SUCCESS,this._successfulRequest.bind(this)),e.on(s.Event.ERROR,this._failedRequest.bind(this)),e.send()}},{Events:{DONE:"done",ERROR:"error"}});t.exports=a},4011:(t,e,r)=>{var n=r(8600),i=r(6654),s=r(3183),a=r(5013),o=n.extend({constructor:function(t){this._options=s.assign({cdnName:null,parsers:[],requestMethod:"HEAD",requestHeaders:{},parseType:function(){return 0}},t),this._responses={}},done:function(){this.emit(o.Event.DONE)},addParser:function(t){return this._options.parsers.push(t),this},setCdnName:function(t){return this._options.cdnName=t,this},setRequestMethod:function(t){return this._options.requestMethod=t,this},setRequestHeader:function(t,e){return this._options.requestHeaders[t]=e,this},setParseType:function(t){return this._options.parseType=t,this},getParsedCdnName:function(){return this._cdnName},getParsedNodeHost:function(){return this._cdnNodeHost},getParsedNodeTypeString:function(){return this._cdnNodeTypeString},getParsedNodeType:function(){return this._cdnNodeType},getResponses:function(){return this._responses},parse:function(t,e){this._responses=e||{};var r=JSON.stringify(this._options.requestHeaders);this._responses[r]?this._parseResponse(this._responses[r]):this._requestResponse(t)},_requestResponse:function(t){var e=JSON.stringify(this._options.requestHeaders),r="{}"!==e,n=new a(t,null,null,{method:this._options.requestMethod,maxRetries:0,requestHeaders:this._options.requestHeaders,cache:!0});n.on(a.Event.SUCCESS,function(t){this._responses[e]=t.getResponseHeaders(),this._parseResponse(this._responses[e])}.bind(this)),n.on(a.Event.ERROR,function(e){r?(this._options.requestHeaders={},this._requestResponse(t)):this.done()}.bind(this)),n.send()},_parseResponse:function(t){this._options.parsers.forEach(function(e){if("string"==typeof e.headerName)this._parseHeaderResponse(t,e,e.headerName);else if(Array.isArray(e.headerName))for(var r=0,n=e.headerName.length;r<n;r++){var i=e.headerName[r];"string"==typeof i&&this._parseHeaderResponse(t,e,i)}}.bind(this)),this.done()},_parseHeaderResponse:function(t,e,r){r&&(r=r?r.toLowerCase():"",t.split("\n").forEach(function(t){var n=t.indexOf(":");-1!==n&&t.slice(0,n).toLowerCase()===r&&this._executeParser(e,t.slice(n+1))}.bind(this)))},_executeParser:function(t,e){try{var r=t.regex.exec(e.trim());if(null!==r)switch(this._options.cdnName&&(this._cdnName=this._options.cdnName),t.element){case o.ElementType.HOST:this._cdnNodeHost=r[1];break;case o.ElementType.TYPE:this._cdnNodeTypeString=r[1],this._cdnNodeType=this._options.parseType(this._cdnNodeTypeString);break;case o.ElementType.HOST_AND_TYPE:this._cdnNodeHost=r[1],this._cdnNodeTypeString=r[2],this._cdnNodeType=this._options.parseType(this._cdnNodeTypeString);break;case o.ElementType.TYPE_AND_HOST:this._cdnNodeTypeString=r[1],this._cdnNodeType=this._options.parseType(this._cdnNodeTypeString),this._cdnNodeHost=r[2];break;case o.ElementType.NAME:this._cdnName=r[1].toUpperCase()}}catch(t){i.warn("CDN parsing for "+this._options.cdnName+" could not parse header value "+e)}},shouldExecute:function(){return!0}},{Event:{DONE:"done"},ElementType:{HOST:"host",TYPE:"type",HOST_AND_TYPE:"host+type",TYPE_AND_HOST:"type+host",NAME:"name"},_cdnConfigs:{},setBalancerHeaderName:function(t,e){o._cdnConfigs.Balancer.parsers[0].headerName=t,o._cdnConfigs.Balancer.parsers[1].headerName=e},create:function(t){if(o._cdnConfigs[t])return new o(o._cdnConfigs[t]);i.warn("Tried to create an unexisting CdnParser named "+t)},add:function(t,e){o._cdnConfigs[t]=e}});o.add("Level3",r(4659)),o.add("Cloudfront",r(536)),o.add("Akamai",r(7977)),o.add("Highwinds",r(6415)),o.add("Fastly",r(966)),o.add("Telefonica",r(1559)),o.add("Amazon",r(7988)),o.add("Edgecast",r(9031)),o.add("Balancer",r(8666)),o.add("NosOtt",r(3072)),t.exports=o},7977:t=>{t.exports={cdnName:"AKAMAI",parsers:[{element:"type+host",headerName:"X-Cache",regex:/(.+)\sfrom.+AkamaiGHost\/(.+)\).+/},{element:"host",headerName:"akamai-mon-iucid-del",regex:/(.*)/},{element:"type",headerName:"akamai-cache-status",regex:/(.+)\sfrom\schild/}],requestHeaders:{Pragma:"akamai-x-cache-on"},parseType:function(t){var e=t.toLowerCase();return-1!==e.indexOf("hit")?1:-1!==e.indexOf("miss")?2:0}}},7988:t=>{t.exports={cdnName:"AMAZON",parsers:[{element:"host",headerName:"x-amz-cf-pop",regex:/(.+)/},{element:"type",headerName:"x-cache",regex:/(.+)\sfrom.+/}],parseType:function(t){return-1!==t.toLowerCase().indexOf("hit")?1:-1!==t.toLowerCase().indexOf("miss")?2:0}}},8666:t=>{t.exports={parsers:[{element:"name",headerName:null,regex:/(.+)/},{element:"host",headerName:null,regex:/(.+)/}]}},536:t=>{t.exports={cdnName:"CLOUDFRT",parsers:[{element:"host",headerName:"X-Amz-Cf-Id",regex:/(.+)/},{element:"type",headerName:"X-Cache",regex:/(\S+)\s.+/}],parseType:function(t){switch(t){case"Hit":return 1;case"Miss":return 2;default:return 0}}}},9031:t=>{t.exports={cdnName:"EDGECAST",parsers:[{element:"host",headerName:"Server",regex:/\((.+)\/.+\)/},{element:"type",headerName:"X-Cache",regex:/(.+)/}],parseType:function(t){return"HIT"===t?1:2}}},966:t=>{t.exports={cdnName:"FASTLY",parsers:[{element:"host",headerName:"X-Served-By",regex:/([^,\s]+)$/},{element:"type",headerName:"X-Cache",regex:/([^,\s]+)$/}],parseType:function(t){switch(t){case"HIT":return 1;case"MISS":return 2;default:return 0}}}},6415:t=>{t.exports={cdnName:"HIGHNEGR",parsers:[{element:"host+type",headerName:"X-HW",regex:/.+,[0-9]+\.(.+)\.(.+)/}],parseType:function(t){switch(t){case"c":case"x":return 1;default:return 2}}}},4659:t=>{t.exports={cdnName:"LEVEL3",parsers:[{element:"host+type",headerName:"X-WR-Diag",regex:/Host:(.+)\sType:(.+)/}],requestHeaders:{"X-WR-Diag":"host"},parseType:function(t){if(t){if(0===t.indexOf("TCP_HIT")||0===t.indexOf("TCP_MEM_HIT")||0===t.indexOf("TCP_IMS_HIT"))return 1;if(0===t.indexOf("TCP_MISS"))return 2}return 0}}},3072:t=>{t.exports={cdnName:"NOSOTT",parsers:[{element:"host",headerName:"X-NOS-Server",regex:/(.+)/},{element:"type",headerName:"X-Cache",regex:/(.*)/}],parseType:function(t){switch(t){case"Hit":return 1;case"Miss":return 2;default:return 0}}}},1559:t=>{t.exports={cdnName:"TELEFO",parsers:[{element:"host+type",headerName:"x-tcdn",regex:/Host:(.+)\sType:(.+)/}],requestHeaders:{"x-tcdn":"host"},parseType:function(t){if(t){if(-1!==t.indexOf("p")||-1!==t.indexOf("c"))return 1;if(-1!==t.indexOf("i")||-1!==t.indexOf("m"))return 2}return 0}}},2153:(t,e,r)=>{var n=r(5013),i=r(7294),s=r(6654),a=r(6860),o=i.extend({parse:function(t,e){if(e)this.parseLocation(e,t);else{var r=new n(t,null,null,{cache:!0,requestHeaders:this._headers});r.on(n.Event.SUCCESS,function(e){this.parseLocation(e,t)}.bind(this)),r.on(n.Event.ERROR,function(t){this.done()}.bind(this)),r.send()}},parseLocation:function(t,e){this.iterations--;var r=new RegExp(/<Location>([\s\S]+)<\/Location>/);try{this._lastManifest=t;var n=t.getResponseText(),i=r.exec(n);if(i&&i[1])var a=this._htmlDecode(i[1].replace("\n",""));a&&a!==e&&this.iterations>0?this.parse(a):this.parseFinalResource(n,e)}catch(t){s.warn("Dash parse failed"),this.done()}},_htmlDecode:function(t){if("undefined"!=typeof document&&"function"==typeof document.createElement){var e=document.createElement("textarea");return e.innerHTML=t,e.childNodes&&e.childNodes.length?e.childNodes[0].nodeValue:t}return t},parseFinalResource:function(t,e){var r=new RegExp(/<BaseURL>[\r\n]*(.*?)[\r\n]*<\/BaseURL>/),n=new RegExp(/<SegmentURL[\s\S]*media="([^"]+)/),i=new RegExp(/<SegmentTemplate[\s\S]*media="([^"]+)/),a=null;try{a=r.exec(t)||i.exec(t)||n.exec(t),this._getManifestMetadata(t),a&&a[1]&&this._isFullUrl(a[1])?a[1].indexOf('"')>0?this._realResource=a[1].substr(0,a[1].indexOf('"')).replace("\n",""):this._realResource=a[1].replace("\n",""):this._realResource=e}catch(t){s.warn("Dash manifest parse failed")}this.done()},_getManifestMetadata:function(t){try{var e=new RegExp(/<AdaptationSet[\s\S]*mimeType="video\/([^"]+)/).exec(t),r=null;switch(e[1]){case"mp4":case"m4s":r=a.MP4;break;case"mp2t":r=a.MPEG2;break;case"cmfv":r=a.CMF}this._transportFormat=r}catch(t){s.warn("Couldnt find the transport format")}},_isFullUrl:function(t){return-1!==t.indexOf("http")},shouldExecute:function(t){var e=!0;return t&&(e=-1!==t.getResponseText().indexOf("<MPD")),e}});t.exports=o},3786:(t,e,r)=>{var n=r(5013),i=r(7294),s=r(6654),a=r(6860),o=i.extend({parse:function(t,e,r){r=r||"";var i=null;try{i=/((\S*?)(\.m3u8|\.m3u|\.ts|\.m4s|\.mp4|\.cmfv|\.m4a)((\?|;)\S*|\n|\r|$))/i.exec(t.replaceAll(",URI=","\n").replaceAll('"',"").replaceAll(",","\n"))}catch(t){s.warn("Parse HLS Regex failed",t),this.done()}if(null!==i){var o=i[1].trim(),l="",u=r.lastIndexOf("/");if(0!==o.indexOf("http")&&-1!==u){if("/"===o[0]&&"/"!==o[1]){var c=r.indexOf("/")+1;c+=r.substr(c,r.length).indexOf("/")+1,c+=r.substr(c,r.length).indexOf("/"),o=r.slice(0,c)+o}else o=r.slice(0,u)+"/"+o;l=r.slice(0,u)+"/"}if(".m3u8"===i[3]||".m3u"===i[3])if(e)this._parseWithManifest(e,l,i);else{var h=new n(o,null,null,{cache:!0,requestHeaders:this._headers});h.on(n.Event.SUCCESS,function(t){this._parseWithManifest(t,l,i)}.bind(this)),h.on(n.Event.ERROR,function(t){this.done()}.bind(this)),h.send()}else{switch(i[3]){case".mp4":case".m4s":case".m4a":this._transportFormat=a.MP4;break;case".ts":this._transportFormat=a.MPEG2;break;case".cmfv":this._transportFormat=a.CMF}this._realResource=o,this.done()}}else this.done()},_parseWithManifest:function(t,e,r){this._lastManifest=t,this.parse(t.getResponseText(),null,e+r[2])},shouldExecute:function(t){var e=!0;return t&&(e=-1!==t.getResponseText().indexOf("#EXTM3U")),e}});t.exports=o},5269:(t,e,r)=>{var n=r(5013),i=r(7294).extend({parse:function(t,e){if(e)this._parseWithManifest(e);else{this._realResource=t;var r=new n(t,null,null,{cache:!0,requestHeaders:this._headers});r.on(n.Event.SUCCESS,function(t){this._parseWithManifest(t)}.bind(this)),r.on(n.Event.ERROR,function(t){this.done()}.bind(this)),r.send()}},_parseWithManifest:function(t){this._lastManifest=t;var e=t.getResponseHeaders(),r=!1;t&&t.xhr&&t.xhr.responseURL&&t.xhr.responseURL!==this._realResource?(this._realResource=t.xhr.responseURL,this.parse(this._realResource),r=!0):e.split("\n").forEach(function(t){t.startsWith("Location:")&&(this._realResource=t.slice(10),this.parse(this._realResource),r=!0)}.bind(this)),r||this.done()}});t.exports=i},7294:(t,e,r)=>{var n=r(8600).extend({constructor:function(t){this._realResource=null,this._lastManifest=null,this._transportFormat=null,this.iterations=3,this._headers=t},done:function(){this.iterations=3,this.emit(n.Event.DONE)},parse:function(t,e){},getResource:function(){return this._realResource},getTransportFormat:function(){return this._transportFormat},getLastManifest:function(){return this._lastManifest},shouldExecute:function(t){return!0}},{Event:{DONE:"done"}});t.exports=n},1935:(t,e,r)=>{var n=r(8600).extend({constructor:function(){this._isBusy=!0,this._sendRequest=!0,this.transformName="Transform"},parse:function(t){},isBlocking:function(t){return this._isBusy},done:function(){this._isBusy=!1,this.emit(n.Event.DONE)},hasToSend:function(t){return this._sendRequest},getState:function(){return this._sendRequest?this._isBusy?this.STATE_BLOCKED:this.STATE_NO_BLOCKED:this.STATE_OFFLINE}},{STATE_OFFLINE:2,STATE_BLOCKED:1,STATE_NO_BLOCKED:0,Event:{DONE:"done"}});t.exports=n},6e3:(t,e,r)=>{var n=r(5013),i=r(1935),s=r(6654),a=r(3183),o=r(6229),l=i.extend({constructor:function(t,e){i.prototype.constructor.apply(this,arguments),this.response={},this._viewIndex=(new Date).getTime(),this._session=e,this._httpSecure=t.options["app.https"],this._plugin=t,this.transformName="View"},init:function(){if(this._plugin.options&&this._plugin.options.offline)return this.response.host="OFFLINE",this.response.code="OFFLINE",this.response.pingTime=60,this.response.beatTime=60,this.done(),null;if(this._plugin.storage.isEnabled()&&(new Date).getTime()<this._plugin.sessionExpire+(Number(this._plugin.getDataTime())||0)&&this._plugin.getStoredData())return this.setData(this._plugin.getStoredData()),null;var t=o.Service.DATA,e={outputformat:"json"};null!==(e=this._plugin.requestBuilder.buildParams(e,t))&&(s.notice(t+" "+e.system),"nicetest"===e.system&&s.error("No accountCode has been set. Please set your accountCode inside plugin's options."),new n(this._plugin.getHost(),t,e).on(n.Event.SUCCESS,this._receiveData.bind(this)).on(n.Event.ERROR,this._failedData.bind(this)).send())},setData:function(t){try{var e=JSON.parse(t);this._plugin.options["parse.fdsResponseHost"]&&(t=t.replace(e.q.h,this._plugin.options["parse.fdsResponseHost"](e.q.h)),e=JSON.parse(t)),this.response.msg=t,this.response.host=a.addProtocol(e.q.h,this._httpSecure),this.response.code=e.q.c,this.response.pingTime=e.q.pt||5,this.response.beatTime=e.q.i&&e.q.i.bt||30,this.response.sessionExpire=e.q.i&&e.q.i.exp||300,this._plugin.storage.setLocal("sessionExpire",this.response.sessionExpire),this.done()}catch(t){s.error("Fastdata response is invalid.")}},_receiveData:function(t,e){var r=t.getResponse();this.setData(r)},_failedData:function(t,e){s.error("Fastdata request has failed.")},nextView:function(){return this._viewIndex=(new Date).getTime(),this.getViewCode()},getViewCode:function(){return this.response.code+"_"+this._viewIndex},getSession:function(){return this._session},setSession:function(t){this._session=t},setHost:function(t){this.response.host=t},parse:function(t){t.host=t.host||this.response.host,t.params.system=this._plugin.getAccountCode(),t.params.sessionRoot=t.params.sessionRoot||this.getSession(),-1!==l.EventList.PingTime.indexOf(t.service)&&(t.params.pingTime=t.params.pingTime||this.response.pingTime),-1===l.EventList.Infinity.indexOf(t.service)?t.params.code=t.params.code||this.getViewCode():t.params.sessionId=t.params.sessionRoot,-1!==l.EventList.CreateView.indexOf(t.service)&&(this._plugin.infinity.infinityStarted||this._plugin.storage.isEnabled()&&this._plugin.storage.getLocal("infinityStarted"))&&(t.params.parentId=t.params.sessionRoot,t.params.navContext=t.params.navContext||this._plugin.getContext())}},{EventList:{CreateView:[o.Service.START,o.Service.INIT,o.Service.ERROR],Infinity:[o.Service.NAV,o.Service.SESSION_START,o.Service.SESSION_STOP,o.Service.EVENT,o.Service.BEAT],PingTime:[o.Service.START,o.Service.PING]}});t.exports=l},1090:(t,e,r)=>{var n=r(1935).extend({isBlocking:function(t){return!t.params.sessionId}});t.exports=n},6229:(t,e,r)=>{var n=r(2628),i=r(6471),s={AdPosition:n,ManifestError:r(1142),RequestMethod:r(3551),Service:r(8619),WillSendEvent:r(7238),AdInsertionType:r(9840),Adapter:i};t.exports=s},9840:t=>{t.exports={ClientSide:"csai",ServerSide:"ssai"}},2628:t=>{t.exports={Preroll:"pre",Midroll:"mid",Postroll:"post"}},6471:(t,e,r)=>{var n={Event:r(2078)};t.exports=n},2078:t=>{t.exports={START:"start",JOIN:"join",PAUSE:"pause",RESUME:"resume",SEEK_BEGIN:"seek-begin",SEEK_END:"seek-end",BUFFER_BEGIN:"buffer-begin",BUFFER_END:"buffer-end",ERROR:"error",STOP:"stop",CLICK:"click",MANIFEST:"manifest",PODSTART:"break-start",PODSTOP:"break-stop",QUARTILE:"quartile",VIDEO_EVENT:"video-event"}},1142:t=>{t.exports={NO_RESPONSE:"NO_RESPONSE",EMPTY:"EMPTY_RESPONSE",WRONG:"WRONG_RESPONSE"}},3551:t=>{t.exports={GET:"get",POST:"post"}},8619:t=>{t.exports={DATA:"/data",INIT:"/init",START:"/start",JOIN:"/joinTime",PAUSE:"/pause",RESUME:"/resume",SEEK:"/seek",BUFFER:"/bufferUnderrun",ERROR:"/error",STOP:"/stop",PING:"/ping",VIDEO_EVENT:"/infinity/video/event",AD_INIT:"/adInit",AD_START:"/adStart",AD_JOIN:"/adJoin",AD_PAUSE:"/adPause",AD_RESUME:"/adResume",AD_BUFFER:"/adBufferUnderrun",AD_STOP:"/adStop",AD_CLICK:"/adClick",AD_ERROR:"/adError",AD_MANIFEST:"/adManifest",AD_POD_START:"/adBreakStart",AD_POD_STOP:"/adBreakStop",AD_QUARTILE:"/adQuartile",EVENT:"/infinity/session/event",SESSION_START:"/infinity/session/start",SESSION_STOP:"/infinity/session/stop",NAV:"/infinity/session/nav",BEAT:"/infinity/session/beat",OFFLINE_EVENTS:"/offlineEvents"}},8747:t=>{t.exports={HDS:"HDS",HLS:"HLS",MSS:"MSS",DASH:"DASH",RTMP:"RTMP",RTP:"RTP",RTSP:"RTSP",DVB:"DVB",DVBC:"DVB-C",DVBT:"DVB-T",DVBT2:"DVB-T2",MULTICAST:"MULTICAST"}},6860:t=>{t.exports={MP4:"MP4",MPEG2:"TS",CMF:"CMF"}},7238:t=>{t.exports={WILL_SEND_INIT:"will-send-init",WILL_SEND_START:"will-send-start",WILL_SEND_JOIN:"will-send-join",WILL_SEND_PAUSE:"will-send-pause",WILL_SEND_RESUME:"will-send-resume",WILL_SEND_SEEK:"will-send-seek",WILL_SEND_BUFFER:"will-send-buffer",WILL_SEND_ERROR:"will-send-error",WILL_SEND_FATAL_ERROR:"will-send-fatal-error",WILL_SEND_STOP:"will-send-stop",WILL_SEND_PING:"will-send-ping",WILL_SEND_VIDEO_EVENT:"will-send-video-event",WILL_SEND_AD_START:"will-send-ad-start",WILL_SEND_AD_JOIN:"will-send-ad-join",WILL_SEND_AD_PAUSE:"will-send-ad-pause",WILL_SEND_AD_RESUME:"will-send-ad-resume",WILL_SEND_AD_BUFFER:"will-send-ad-buffer",WILL_SEND_AD_STOP:"will-send-ad-stop",WILL_SEND_AD_CLICK:"will-send-ad-click",WILL_SEND_AD_ERROR:"will-send-ad-error",WILL_SEND_AD_MANIFEST:"will-send-ad-manifest",WILL_SEND_AD_POD_START:"will-send-ad-break-start",WILL_SEND_AD_POD_STOP:"will-send-ad-break-stop",WILL_SEND_AD_QUARTILE:"will-send-ad-quartile",WILL_SEND_SESSION_START:"will-send-session-start",WILL_SEND_SESSION_STOP:"will-send-session-stop",WILL_SEND_NAV:"will-send-nav",WILL_SEND_BEAT:"will-send-beat",WILL_SEND_EVENT:"will-send-event",WILL_SEND_OFFLINE_EVENTS:"will-send-offline-events"}},4085:(t,e,r)=>{var n=r(7569).extend({constructor:function(t){this.plugin=t,this.isInBackground=!1,this.listenerReference=this._visibilityListener.bind(this),this._reset()},startDetection:function(){this.isBackgroundDetectorStarted||"undefined"==typeof document||(this.isBackgroundDetectorStarted=!0,document.addEventListener("visibilitychange",this.listenerReference))},stopDetection:function(){this.isBackgroundDetectorStarted&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.listenerReference),this._reset())},_reset:function(){this.isBackgroundDetectorStarted=!1},_visibilityListener:function(t){if("undefined"!=typeof document){var e=this._getSettings();"hidden"===document.visibilityState?this._toBackground(e):"visible"===document.visibilityState&&this._toForeground(e)}},_toBackground:function(t){if(this.isInBackground=!0,this.plugin&&this.plugin._adsAdapter&&this.plugin._adsAdapter.stopChronoView(),"string"==typeof t){switch(t){case"stop":this._fireStop();break;case"pause":this._firePause()}if(this.plugin.infinity.infinityStarted){this.lastBeatTime=(new Date).getTime();var e=this.plugin._beat.chrono.startTime?this.lastBeatTime-this.plugin._beat.chrono.startTime:0;this.plugin._sendBeat(e),this.plugin._beat.stop()}}},_toForeground:function(t){if(this.isInBackground=!1,this.plugin&&this.plugin._adsAdapter&&this.plugin._adsAdapter.startChronoView(),"string"==typeof t&&t&&this.plugin.infinity.infinityStarted){var e=(new Date).getTime();e-this.lastBeatTime<this.plugin.sessionExpire?(this.plugin._sendBeat(e-this.lastBeatTime),this.plugin._beat.start()):this.plugin.infinity.newSession()}},_getSettings:function(){return"string"==typeof this.plugin.options["background.settings"]&&this.plugin.options["background.settings"]?this.plugin.options["background.settings"]:this.plugin.deviceDetector.isSmartTV()?this.plugin.options["background.settings.tv"]:this.plugin.deviceDetector.isDesktop()?this.plugin.options["background.settings.desktop"]:this.plugin.deviceDetector.isAndroid()?this.plugin.options["background.settings.android"]:this.plugin.deviceDetector.isIphone()?this.plugin.options["background.settings.iOS"]:this.plugin.deviceDetector.isPlayStation()?this.plugin.options["background.settings.playstation"]:void 0},_firePause:function(){this._fireX("firePause")},_fireStop:function(){this._fireX("fireStop"),this.plugin.fireStop()},_fireX:function(t){this.adsAdapter=this.plugin.getAdsAdapter(),this.adsAdapter&&this.adsAdapter[t](),this.contentAdapter=this.plugin.getAdapter(),this.contentAdapter&&this.contentAdapter[t]()},canBlockStartCalls:function(){return this.isInBackground&&!0===this.plugin.options["background.enabled"]&&this._getSettings()}});t.exports=n},7416:(t,e,r)=>{var n=r(7569).extend({constructor:function(){"undefined"!=typeof navigator&&navigator.userAgent&&(this._isSmartTVDevice=navigator.userAgent.toLowerCase().match(/smarttv/)||navigator.userAgent.toLowerCase().match(/smart-tv/)||navigator.userAgent.toLowerCase().match(/appletv/)||navigator.userAgent.toLowerCase().match(/apple tv/),this._isPlaystationDevice=null!==navigator.userAgent.match(/PlayStation/),this._isIphoneDevice=null!==navigator.userAgent.match(/iPhone|iPad|iPod/i),this._isAndroidDevice=null!==navigator.userAgent.match(/Android/),this._isSmartphoneDevice=!this._isSmartTVDevice&&!this._isPlaystationDevice&&(this._isIphoneDevice||this._isAndroidDevice),this._isDesktopDevice=!this._isSmartphoneDevice&&!this._isSmartTVDevice&&!this._isPlaystationDevice)},isIphone:function(){return this._isIphoneDevice},isAndroid:function(){return this._isAndroidDevice},isSmartphone:function(){return this._isSmartphoneDevice},isDesktop:function(){return this._isDesktopDevice},isSmartTV:function(){return this._isSmartTVDevice},isPlayStation:function(){return this._isPlaystationDevice}});t.exports=n},409:(t,e,r)=>{var n=r(7569).extend({constructor:function(t){this.pluginref=t,this.listenerReference=this._changeListener.bind(this),this.loadReference=this._loadListener.bind(this),this.isEnabled=!1,this.pageHeight=0,this.maxHeight=0,this.startDetection()},startDetection:function(){this.isEnabled||"undefined"==typeof window||"function"!=typeof window.addEventListener||(window.addEventListener("scroll",this.listenerReference),window.addEventListener("resize",this.listenerReference),window.addEventListener("load",this.loadReference),this.isEnabled=!0)},stopDetection:function(){this.isEnabled&&"undefined"!=typeof window&&"function"==typeof window.removeEventListener&&(window.removeEventListener("scroll",this.listenerReference),window.removeEventListener("resize",this.listenerReference),window.removeEventListener("load",this.loadReference),this.isEnabled=!1)},getScrollDepth:function(){var t=null;return this.maxHeight&&this.pageHeight&&(t=Math.min(Math.trunc(this.maxHeight/this.pageHeight*100),100)),t},_loadListener:function(){if("undefined"!=typeof document){var t=document.documentElement;t&&(this.pageHeight=Math.round(t.scrollHeight,t.clientHeight,t.offsetHeight),this.maxHeight=window.innerHeight,this._updateCompletionRate())}},_changeListener:function(){if(this.pageHeight){var t=this.maxHeight;this.maxHeight=Math.max(this.maxHeight,window.pageYOffset+window.innerHeight),t!==this.maxHeight&&this._updateCompletionRate()}var e=this.pluginref.getAdsAdapter();e&&e.flags.isStarted&&(e.getIsVisible()?e.startChronoView():e.stopChronoView())},_updateCompletionRate:function(){setTimeout(function(){this.pluginref.storage.setSession("pageScrollDepth",this.getScrollDepth())}.bind(this),3e3)}});t.exports=n},8030:(t,e,r)=>{var n=r(7569).extend({constructor:function(t){this.plugin=t},getAllData:function(){var t=this.getNonRandomData();return t.timestamp=this.getTimestamp(),t},getNonRandomData:function(){var t={};return t.userAgent=this.getUserAgent(),t.threads=this.getVirtualCores(),t.language=this.getLanguage(),t.langList=this.getAvailableLanguages(),t.resolution=this.getResolution(),t.colorDepth=this.getColorDepth(),t.deviceMemory=this.getMemory(),t.touchscreen=this.getTouchscreen(),t.localStorage=this.getLocalStorage(),t.sessionStorage=this.getSessionStorage(),t.cookiesAvailable=this.getCookiesAvailable(),t.flashAvailable=this.getHasFlash(),t.timeZone=this.getTimeZone(),t.plugins=this.getPluginList(),t},getUserAgent:function(){return this._getNavigatorValue("userAgent")},getVirtualCores:function(){return this._getNavigatorValue("hardwareConcurrency")},getLanguage:function(){return this._getNavigatorValue("language")},getAvailableLanguages:function(){return this._getNavigatorValue("languages")},getResolution:function(){var t=null;try{this._getNavigatorValue("screen")&&(t=navigator.screen.width.toString()+navigator.screen.height.toString())}catch(t){}return t},getColorDepth:function(){var t=null;try{this._getNavigatorValue("screen")&&(t=navigator.screen.colorDepth)}catch(t){}return t},getMemory:function(){return this._getNavigatorValue("deviceMemory")},getTouchscreen:function(){return this._getNavigatorValue("maxTouchPoints")||!1},getLocalStorage:function(){var t=!1;try{t="undefined"!=typeof localStorage}catch(t){}return t},getSessionStorage:function(){var t=!1;try{t="undefined"!=typeof sessionStorage}catch(t){}return t},getCookiesAvailable:function(){return this._getNavigatorValue("cookieEnabled")||!1},getHasFlash:function(){var t=!1;try{var e=this._getNavigatorValue("plugins");t=e&&"object"==typeof e["Shockwave Flash"]||"undefined"!=typeof window&&window.ActiveXObject&&!1!==new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(t){}return t},getPluginList:function(){var t=null;try{var e=this._getNavigatorValue("plugins");if(e&&0!==e.length){for(var r="",n=0;n<navigator.plugins.length;n++)r+=navigator.plugins[n].description+" "+navigator.plugins[n].filename+" "+navigator.plugins[n].name+" ";t=r}}catch(t){}return t},getTimeZone:function(){var t=null;try{t=(new Date).getTimezoneOffset().toString()}catch(t){}return t},getTimestamp:function(){return(new Date).getTime()},_navigatorCheck:function(){return"undefined"!=typeof navigator},_getNavigatorValue:function(t){var e=null;try{this._navigatorCheck()&&(e=navigator[t])}catch(t){}return e}});t.exports=n},2836:(t,e,r)=>{var n=r(8030),i=r(7569),s=r(7025),a=i.extend({constructor:function(t){this.plugin=t,this.dataExtractor=new n,this.key=this.getPreviousKey()},generateHashKey:function(){if(!this.key){var t=this.dataExtractor.getAllData();this.key=this._hashFunction(t),this.plugin.storage.setLocal("youboraDeviceUUID",this.key)}},getKey:function(){return this.key||this.generateHashKey(),this.key},_hashFunction:function(t){var e=t;return"string"!=typeof t&&(e=JSON.stringify(t)),s(e)},_reset:function(){this.key=void 0},getPreviousKey:function(){return this.plugin.storage.getLocal("youboraDeviceUUID")}});t.exports=a},7025:t=>{t.exports=function(t){function e(t,e){return t<<e|t>>>32-e}function r(t,e){var r,n,i,s,a;return i=2147483648&t,s=2147483648&e,a=(1073741823&t)+(1073741823&e),(r=1073741824&t)&(n=1073741824&e)?2147483648^a^i^s:r|n?1073741824&a?3221225472^a^i^s:1073741824^a^i^s:a^i^s}function n(t,n,i,s,a,o,l){return t=r(t,r(r(function(t,e,r){return t&e|~t&r}(n,i,s),a),l)),r(e(t,o),n)}function i(t,n,i,s,a,o,l){return t=r(t,r(r(function(t,e,r){return t&r|e&~r}(n,i,s),a),l)),r(e(t,o),n)}function s(t,n,i,s,a,o,l){return t=r(t,r(r(function(t,e,r){return t^e^r}(n,i,s),a),l)),r(e(t,o),n)}function a(t,n,i,s,a,o,l){return t=r(t,r(r(function(t,e,r){return e^(t|~r)}(n,i,s),a),l)),r(e(t,o),n)}function o(t){var e,r="",n="";for(e=0;e<=3;e++)r+=(n="0"+(t>>>8*e&255).toString(16)).substr(n.length-2,2);return r}var l,u,c,h,d,f,p,g,v,m=Array();for(m=function(t){for(var e,r=t.length,n=r+8,i=16*((n-n%64)/64+1),s=Array(i-1),a=0,o=0;o<r;)a=o%4*8,s[e=(o-o%4)/4]=s[e]|t.charCodeAt(o)<<a,o++;return a=o%4*8,s[e=(o-o%4)/4]=s[e]|128<<a,s[i-2]=r<<3,s[i-1]=r>>>29,s}(t=function(t){t=t.replace(/rn/g,"n");for(var e="",r=0;r<t.length;r++){var n=t.charCodeAt(r);n<128?e+=String.fromCharCode(n):n>127&&n<2048?(e+=String.fromCharCode(n>>6|192),e+=String.fromCharCode(63&n|128)):(e+=String.fromCharCode(n>>12|224),e+=String.fromCharCode(n>>6&63|128),e+=String.fromCharCode(63&n|128))}return e}(t)),f=1732584193,p=4023233417,g=2562383102,v=271733878,l=0;l<m.length;l+=16)u=f,c=p,h=g,d=v,f=n(f,p,g,v,m[l+0],7,3614090360),v=n(v,f,p,g,m[l+1],12,3905402710),g=n(g,v,f,p,m[l+2],17,606105819),p=n(p,g,v,f,m[l+3],22,3250441966),f=n(f,p,g,v,m[l+4],7,4118548399),v=n(v,f,p,g,m[l+5],12,1200080426),g=n(g,v,f,p,m[l+6],17,2821735955),p=n(p,g,v,f,m[l+7],22,4249261313),f=n(f,p,g,v,m[l+8],7,1770035416),v=n(v,f,p,g,m[l+9],12,2336552879),g=n(g,v,f,p,m[l+10],17,4294925233),p=n(p,g,v,f,m[l+11],22,2304563134),f=n(f,p,g,v,m[l+12],7,1804603682),v=n(v,f,p,g,m[l+13],12,4254626195),g=n(g,v,f,p,m[l+14],17,2792965006),f=i(f,p=n(p,g,v,f,m[l+15],22,1236535329),g,v,m[l+1],5,4129170786),v=i(v,f,p,g,m[l+6],9,3225465664),g=i(g,v,f,p,m[l+11],14,643717713),p=i(p,g,v,f,m[l+0],20,3921069994),f=i(f,p,g,v,m[l+5],5,3593408605),v=i(v,f,p,g,m[l+10],9,38016083),g=i(g,v,f,p,m[l+15],14,3634488961),p=i(p,g,v,f,m[l+4],20,3889429448),f=i(f,p,g,v,m[l+9],5,568446438),v=i(v,f,p,g,m[l+14],9,3275163606),g=i(g,v,f,p,m[l+3],14,4107603335),p=i(p,g,v,f,m[l+8],20,1163531501),f=i(f,p,g,v,m[l+13],5,2850285829),v=i(v,f,p,g,m[l+2],9,4243563512),g=i(g,v,f,p,m[l+7],14,1735328473),f=s(f,p=i(p,g,v,f,m[l+12],20,2368359562),g,v,m[l+5],4,4294588738),v=s(v,f,p,g,m[l+8],11,2272392833),g=s(g,v,f,p,m[l+11],16,1839030562),p=s(p,g,v,f,m[l+14],23,4259657740),f=s(f,p,g,v,m[l+1],4,2763975236),v=s(v,f,p,g,m[l+4],11,1272893353),g=s(g,v,f,p,m[l+7],16,4139469664),p=s(p,g,v,f,m[l+10],23,3200236656),f=s(f,p,g,v,m[l+13],4,681279174),v=s(v,f,p,g,m[l+0],11,3936430074),g=s(g,v,f,p,m[l+3],16,3572445317),p=s(p,g,v,f,m[l+6],23,76029189),f=s(f,p,g,v,m[l+9],4,3654602809),v=s(v,f,p,g,m[l+12],11,3873151461),g=s(g,v,f,p,m[l+15],16,530742520),f=a(f,p=s(p,g,v,f,m[l+2],23,3299628645),g,v,m[l+0],6,4096336452),v=a(v,f,p,g,m[l+7],10,1126891415),g=a(g,v,f,p,m[l+14],15,2878612391),p=a(p,g,v,f,m[l+5],21,4237533241),f=a(f,p,g,v,m[l+12],6,1700485571),v=a(v,f,p,g,m[l+3],10,2399980690),g=a(g,v,f,p,m[l+10],15,4293915773),p=a(p,g,v,f,m[l+1],21,2240044497),f=a(f,p,g,v,m[l+8],6,1873313359),v=a(v,f,p,g,m[l+15],10,4264355552),g=a(g,v,f,p,m[l+6],15,2734768916),p=a(p,g,v,f,m[l+13],21,1309151649),f=a(f,p,g,v,m[l+4],6,4149444226),v=a(v,f,p,g,m[l+11],10,3174756917),g=a(g,v,f,p,m[l+2],15,718787259),p=a(p,g,v,f,m[l+9],21,3951481745),f=r(f,u),p=r(p,c),g=r(g,h),v=r(v,d);return(o(f)+o(p)+o(g)+o(v)).toLowerCase()}},8600:(t,e,r)=>{var n=r(7569),i=r(8436),s=n.extend({on:function(t,e){if(this._listeners=this._listeners||{},"function"==typeof e)return this._listeners[t]=this._listeners[t]||[],this._listeners[t].push(e),this},off:function(t,e){if(this._listeners=this._listeners||{},this._listeners[t]){var r=this._listeners[t].indexOf(e);-1!==r&&this._listeners[t].splice(r,1)}return this},emit:function(t,e){return this._listeners=this._listeners||{},e=e||{},i(this._listeners[t])&&this._listeners[t].forEach(this._eachCallback.bind(this,t,e)),i(this._listeners["*"])&&this._listeners["*"].forEach(this._eachCallback.bind(this,t,e)),this},_eachCallback:function(t,e,r){"function"==typeof r&&r({type:t,data:e,target:this})}});t.exports=s},3194:(t,e,r)=>{var n=r(8600),i=r(6596),s=r(1090),a=r(3183),o=n.extend({constructor:function(t){this._plugin=t,this.infinityStopped=!1,this.infinityStarted=!1},andBeyond:function(){o.prototype.begin.apply(this,arguments)},begin:function(t,e){(e=e||!1)&&(this._plugin.storage.removeStorages("infinityStarted"),this._plugin.storage.removeStorages("data"),this._plugin.restartViewTransform()),this._comm=new i(this._plugin),this._comm.addTransform(this._plugin.viewTransform),this._comm.addTransform(new s(this._plugin)),this._plugin&&this._plugin.storage&&"function"==typeof this._plugin.storage.getLocal&&(this._registeredProperties=this._plugin.storage.getLocal("inifnityRegisteredProperties")),this.infinityStopped||!this.infinityStarted?this.fireSessionStart(t):(this.fireNav(t),this._sendExtraBeat())},_setLastActive:function(){this._firstActive||(this._firstActive=this.getFirstActive()),this._plugin.storage.setStorages("lastactive",(new Date).getTime())},getFirstActive:function(){return Number(this._plugin.getLastActive())||0},getComm:function(){return this._comm},fireSessionStart:function(t){this.infinityStopped&&(this._plugin.restartViewTransform(),this._comm=new i(this._plugin),this._comm.addTransform(this._plugin.viewTransform),this._comm.addTransform(new s(this._plugin)),this.infinityStopped=!1),this.infinityStarted||(this._plugin.storage.setLocal("infinityStarted","true"),this.infinityStarted=!0,this.emit(o.Event.SESSION_START,this._getParamsJson(t,null,null,!0,!0)),this._setLastActive())},fireSessionStop:function(t){this.infinityStarted&&(this.infinityStopped=!0,this.infinityStarted=!1,this._plugin.storage.removeStorages("infinityStarted"),this.emit(o.Event.SESSION_STOP,t),this._plugin.storage.removeStorages("data"),this._plugin.storage.removeStorages("session"),this._plugin.storage.removeStorages("lastactive"))},newSession:function(t,e){this.isActive()&&(this.infinityStarted?this.fireSessionStop():(this._plugin.storage.removeStorages("infinityStarted"),this._plugin.storage.removeStorages("data"),this._comm&&this._comm.removeTransform(this._plugin.viewTransform),this._plugin.restartViewTransform(),this._comm&&this._comm.addTransform(this._plugin.viewTransform))),this._plugin.setOptions(t),this.begin(e)},fireNav:function(t){this.isActive()&&(this.infinityStarted=!0,this.emit(o.Event.NAV,this._getParamsJson(t,null,null,!0)))},_sendExtraBeat:function(){if(this._plugin&&this._plugin._beat){var t=(new Date).getTime(),e=this._plugin._beat.chrono.startTime?t-this._plugin._beat.chrono.startTime:0;this._plugin._sendBeat(e),this._plugin._beat.chrono.startTime=t}this._setLastActive()},fireEvent:function(t,e,r,n){if(this.infinityStarted){var i=this._getParamsJson(e,r,t);a.assign(i.params,n||{}),this.emit(o.Event.EVENT,i),this._setLastActive()}},register:function(t,e){this._registeredProperties={dimensions:t,values:e},this._plugin.storage.setLocal("inifnityRegisteredProperties",JSON.stringify(this._registeredProperties))},registerOnce:function(t,e){this._registeredProperties||this.register(t,e)},unregister:function(){this._registeredProperties=null,this._plugin.storage.removeLocal("inifnityRegisteredProperties")},_getParamsJson:function(t,e,r,n,i){var s={};if(r&&(s.name=r),s.dimensions=t||{},s.values=e||{},this._registeredProperties){for(var a in this._registeredProperties.dimensions)s.dimensions[a]=this._registeredProperties.dimensions[a];for(var o in this._registeredProperties.values)s.values[o]=this._registeredProperties.values[o]}var l={params:s};return n&&(l.params.dimensions.page&&(l.params.page=l.params.dimensions.page,delete l.params.dimensions.page),l.params.dimensions.route&&(l.params.route=l.params.dimensions.route,delete l.params.dimensions.route),i||delete l.params.dimensions,delete l.params.values),l},isActive:function(){var t=this._plugin.storage.getLocal("infinityStarted");if(this.infinityStarted||t&&"false"!==t)return!0;var e=(new Date).getTime();return Number(this._plugin.getLastActive())+this._plugin.sessionExpire>e}},{Event:{NAV:"nav",SESSION_START:"sessionStart",SESSION_STOP:"sessionStop",BEAT:"beat",EVENT:"event"}});t.exports=o},6654:(t,e,r)=>{var n=r(8600),i=r(8436),s={_emitter:new n,on:function(){s._emitter.on.apply(s._emitter,arguments)},off:function(){s._emitter.off.apply(s._emitter,arguments)},emit:function(){s._emitter.emit.apply(s._emitter,arguments)},Level:{SILENT:6,ERROR:5,WARNING:4,NOTICE:3,DEBUG:2,VERBOSE:1},Event:{LOG:"log"},logLevel:5,plainLogs:!1,report:function(t,e,r){if("undefined"!=typeof console&&console.log&&"undefined"!=typeof document){r=r||"darkcyan";var n,a={5:"e",4:"w",3:"n",2:"d",1:"v"}[e=e||s.Level.NOTICE],o="[Youbora]"+s._getCurrentTime()+" "+a+":";this.emit("log",{level:e,msg:t,prefix:o}),s.logLevel<=e&&(s.plainLogs||document.documentMode?s._plainReport(t,o):(n=e===s.Level.ERROR&&console.error?console.error:e===s.Level.WARNING&&console.warn?console.warn:e===s.Level.DEBUG&&console.debug?console.debug:console.log,o="%c"+o,i(t)?(t.splice(0,0,o,"color: "+r),n.apply(console,t)):n.call(console,o,"color: "+r,t)))}},_getCurrentTime:function(){var t=new Date;return"["+("0"+t.getDate()).slice(-2)+":"+("0"+t.getMinutes()).slice(-2)+":"+("0"+t.getSeconds()).slice(-2)+"."+("00"+t.getMilliseconds()).slice(-3)+"]"},_plainReport:function(t,e){if(t instanceof Array)for(var r in t)s._plainReport(t[r],e);else"string"==typeof t?console.log(e+" "+t):(console.log(e+" <next line>"),console.log(t))},error:function(){s.report([].slice.call(arguments),s.Level.ERROR,"darkred")},warn:function(){s.report([].slice.call(arguments),s.Level.WARNING,"darkorange")},notice:function(){s.report([].slice.call(arguments),s.Level.NOTICE,"darkgreen")},debug:function(){s.report([].slice.call(arguments),s.Level.DEBUG,"indigo")},verbose:function(){s.report([].slice.call(arguments),s.Level.VERBOSE,"navy")},loadLevelFromUrl:function(){"undefined"!=typeof window&&window.location&&this._parseLevelFromUrl(window.location.search)},_parseLevelFromUrl:function(t){if(t){var e=/\?.*&*youbora-debug=(.+)/i.exec(t);null!==e&&(s.logLevel=e[1]),null!==/\?.*&*youbora-debug=plain/i.exec(t)&&(s.plainLogs=!0)}}};t.exports=s},5429:t=>{t.exports=function(t){if(null==t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),r=1;r<arguments.length;r++){var n=arguments[r];if(null!=n)for(var i in n)n.hasOwnProperty(i)&&(e[i]=n[i])}return e}},3501:t=>{var e=function(){};t.exports=function(t){if(arguments.length>1)throw Error("Second argument not supported");if(null===t)throw Error("Cannot set a null [[Prototype]]");if("object"!=typeof t)throw TypeError("Argument must be an object");return e.prototype=t,new e}},8436:t=>{t.exports=function(t){return"[object Array]"===Object.prototype.toString.call(t)}},7981:(t,e,r)=>{var n=r(7569),i=r(7709),s=n.extend({constructor:function(t){if(this.infinity=t.infinity,this.timeObject=null,this.playerSetup=null,this.perfObject=null,this.myTimesObject={},"undefined"!=typeof window&&"function"==typeof window.addEventListener&&(window.addEventListener("load",this._windowLoaded.bind(this)),window.performance&&window.performance.timing)){try{"function"==typeof window.performance.getEntriesByType&&(this.perfObject=window.performance)}catch(t){}this.timeObject=window.performance.timing}try{if("function"==typeof PerformanceObserver){var e=new PerformanceObserver(function(t,e){var r=t.getEntries();this.myTimesObject.largestContentfulPaint=r[r.length-1].renderTime}.bind(this));PerformanceObserver.supportedEntryTypes.indexOf("largest-contentful-paint")>-1&&e.observe({entryTypes:["largest-contentful-paint"]})}}catch(t){}},_windowLoaded:function(){this.myTimesObject.onLoad=(new Date).getTime(),this._getEnoughFPS(),setTimeout(this._fireLoadTimesEvent.bind(this),1e3)},_fireLoadTimesEvent:function(){this._getLastMetrics(),this.infinity.fireEvent("loadTimes",{},this._getAllValues())},_getAllValues:function(){var t={PageLoadTime:this.getPageLoadTime(),DNSTime:this.getDnsTime(),TCPTime:this.getTcpTime(),HandshakeTime:this.getHandshakeTime(),DomReadyTime:this.getDomReadyTime(),BackendTime:this.getBackendTime(),FrontendTime:this.getFrontendTime(),VisualReady:this.getTimeToVisuallyReady(),TimeToInteractive:this.getTimeToInteractive(),JsTime:this.getJSTime(),CssTime:this.getCSSTime(),ImageTime:this.getImageTime(),FontTime:this.getFontTime(),AvgReqLatency:this.getAvgReqLatency(),MaxReqLatency:this.getMaxReqLatency(),FirstPaint:this.getFirstPaint(),FirstContentfulPaint:this.getFirstContentfulPaint(),LargestContentfulPaint:this.getLargestContentfulPaint(),SpeedIndex:this.getSpeedIndex()};for(var e in t)null===t[e]||void 0===t[e]||t[e]<0?delete t[e]:t[e]=Math.round(t[e]);return t},getPageLoadTime:function(){var t=null;return this.timeObject&&(t=this.timeObject.loadEventEnd-this.timeObject.navigationStart),t},getPlayerStartupTime:function(){var t=null;return this.timeObject&&this.playerSetup&&(t=this.playerSetup-this.timeObject.navigationStart),t},getDnsTime:function(){var t=null;return this.timeObject&&(t=this.timeObject.domainLookupEnd-this.timeObject.domainLookupStart),t},getTcpTime:function(){var t=null;return this.timeObject&&(t=this.timeObject.connectEnd-this.timeObject.connectStart),t},getHandshakeTime:function(){var t=null;return this.timeObject&&this.timeObject.secureConnectionStart&&(t=this.timeObject.connectEnd-this.timeObject.secureConnectionStart),t},getDomReadyTime:function(){var t=null;return this.timeObject&&(t=this.timeObject.domComplete-this.timeObject.navigationStart),t},getBackendTime:function(){var t=null;return this.timeObject&&(t=this.timeObject.responseStart-this.timeObject.navigationStart),t},getFrontendTime:function(){var t=null;return this.timeObject&&(t=this.myTimesObject.onLoad-this.timeObject.responseStart),t},getTimeToVisuallyReady:function(){var t=this.myTimesObject.firstPaint||0;return this.timeObject?Math.max(t,this.timeObject.domContentLoadedEventEnd-this.timeObject.navigationStart||0):t||null},getTimeToInteractive:function(){if(this.myTimesObject.fps&&this.getTimeToVisuallyReady())return Math.max(this.myTimesObject.fps,this.getTimeToVisuallyReady());setTimeout(function(){this.getTimeToInteractive()}.bind(this),500)},getJSTime:function(){return this._getXTime("script")},getCSSTime:function(){return this._getXTime("css")},getImageTime:function(){return this._getXTime("img")},getFontTime:function(){return this._getXTime("css",[".woff",".otf",".ttf"])},getAvgReqLatency:function(){try{if(this.perfObject&&"function"==typeof this.perfObject.getEntriesByType){var t=0,e=0,r=this.perfObject.getEntriesByType("resource");for(var n in r)r[n].requestStart&&r[n].responseStart&&(e+=r[n].responseStart-r[n].requestStart),t++;return e/t}}catch(t){}return null},getFirstPaint:function(){return this.myTimesObject?this.myTimesObject.firstPaint:null},getFirstContentfulPaint:function(){return this.myTimesObject?this.myTimesObject.firstContentfulPaint:null},getLargestContentfulPaint:function(){return this.myTimesObject?this.myTimesObject.largestContentfulPaint:null},getMaxReqLatency:function(){try{if(this.perfObject&&"function"==typeof this.perfObject.getEntriesByType){var t=this.perfObject.getEntriesByType("resource"),e=0;for(var r in t)t[r].requestStart&&t[r].responseStart&&(e=Math.max(e,t[r].responseStart-t[r].requestStart));return e}}catch(t){}return null},getSpeedIndex:function(){var t=null;if("undefined"!=typeof window&&window.performance&&"function"==typeof window.performance.getEntriesByType)try{t=i()}catch(t){}return t},_getXTime:function(t,e){var r=0;try{if(this.perfObject&&"function"==typeof this.perfObject.getEntriesByType){var n=this.perfObject.getEntriesByType("resource");for(var i in n)if(n[i].initiatorType===t)if(e){var s=!1;for(var a in e)n[i].name.indexOf(e[a]>0)&&(s=!0);s&&(r+=n[i].duration)}else r+=n[i].duration}}catch(t){}return Math.round(r)||null},_getLastMetrics:function(){var t=null,e=null;try{if(this.perfObject&&"function"==typeof this.perfObject.getEntriesByType){var r=this.perfObject.getEntriesByType("paint");for(var n in r)"first-paint"===r[n].name?t=r[n].startTime:"first-contentful-paint"===r[n].name&&(e=r[n].startTime)}}catch(t){}!t&&this.timeObject&&(t=this.timeObject.msFirstPaint-this.timeObject.navigationStart),this.myTimesObject.firstPaint=t,this.myTimesObject.firstContentfulPaint=e,this.getTimeToInteractive()},_getEnoughFPS:function(){if(!this.timeObject||"undefined"==typeof window)return!0;var t=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(){};this.preFPS=(new Date).getTime(),t(function(){var t=(new Date).getTime();t<this.preFPS+50?this.myTimesObject.fps=t-this.timeObject.navigationStart:setTimeout(function(){return this._getEnoughFPS()}.bind(this),50)}.bind(this))},setPlayerSetupTime:function(){this.playerSetup=this.playerSetup||(new Date).getTime()}});t.exports=s},449:(t,e,r)=>{var n=r(7569).extend({getCdnTraffic:function(){var t=null;if("undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.cdn)t=CdnBalancerStats.cdn.totalDownloadedBytes;else if("undefined"!=typeof Streamroot)t=this._getStreamrootPeerObject("cdn",!1)||this._getStreamrootInstanceObject("cdnDownload");else if("undefined"!=typeof peer5&&peer5.getStats)t=peer5.getStats().totalHttpDownloaded;else if("undefined"!=typeof teltoo&&teltoo.getStats){var e=teltoo.getStats();t=e.totalReceivedBytes-e.p2pReceivedBytes}return t},getMultiCdnInfo:function(){var t=null;if("undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.cdn&&CdnBalancerStats.cdn.cdns){var e=CdnBalancerStats.p2p;t={P2P:{downloaded_bytes:e.downloadedBytes,uploaded_bytes:e.uploadedBytes,downloaded_chunks:e.downloadedSegments,uploaded_chunks:e.uploadedSegments,errors:e.failedRequests?e.failedRequests.total:0,missed_downloaded_chunks:e.failedRequests?e.failedRequests.absent:0,timeout_errors:e.failedRequests?e.failedRequests.timeout:0,other_errors:e.failedRequests?e.failedRequests.error:0,late_uploaded_chunks:e.discardedUploadedSegments,late_uploaded_bytes:e.discardedUploadedBytes,late_downloaded_bytes:e.discardedDownloadedBytes,time:e.downloadMillis,active_peers:e.activePeers,peers:e.totalPeers}},CdnBalancerStats.cdn.cdns.forEach((function(e){t[e.name]={downloaded_bytes:e.bytes,downloaded_chunks:e.chunks,errors:e.failures,time:e.downloadMillis}}))}return t},getSegmentDuration:function(){return"undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.segmentDuration?CdnBalancerStats.segmentDuration:null},getBalancerResponseId:function(){return"undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.cdn?CdnBalancerStats.cdn.responseUUID:null},getP2PTraffic:function(){var t=null;return"undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.p2p?t=CdnBalancerStats.p2p.downloadedBytes:"undefined"!=typeof Streamroot?t=this._getStreamrootPeerObject("p2p",!0)||this._getStreamrootInstanceObject("dnaDownload"):"undefined"!=typeof peer5&&peer5.getStats?t=peer5.getStats().totalP2PDownloaded:"undefined"!=typeof teltoo&&teltoo.getStats&&(t=teltoo.getStats().p2pReceivedBytes),t},getUploadTraffic:function(){var t=null;return"undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.p2p?t=CdnBalancerStats.p2p.uploadedBytes:"undefined"!=typeof Streamroot?t=this._getStreamrootPeerObject("upload",!0)||this._getStreamrootInstanceObject("dnaUpload"):"undefined"!=typeof peer5&&peer5.getStats&&(t=peer5.getStats().totalP2PUploaded),t},getIsP2PEnabled:function(){var t=!1;if("undefined"!=typeof CdnBalancerStats&&CdnBalancerStats.p2p)t=CdnBalancerStats.p2p.downloadEnabled;else if("undefined"!=typeof Streamroot)if(Streamroot.p2pAvailable&&Streamroot.peerAgents)for(var e in Streamroot.peerAgents)t=t||Streamroot.peerAgents[e].isP2PEnabled;else Streamroot.instances&&Streamroot.instances.forEach((function(e){t=t||e.dnaDownloadEnabled||e.dnaUploadEnabled}));else"undefined"!=typeof peer5&&peer5.isEnabled?t=peer5.isEnabled():"undefined"!=typeof teltoo&&(t=!0);return t},_getStreamrootPeerObject:function(t,e){var r=null;if(Streamroot.p2pAvailable&&Streamroot.peerAgents)for(var n in Streamroot.peerAgents){var i=Streamroot.peerAgents[n];!i.stats||e&&!i.isP2PEnabled||(r+=i.stats[t])}return r},_getStreamrootInstanceObject:function(t){var e=null;return Streamroot.instances&&Streamroot.instances.forEach((function(r){r.stats&&r.stats.currentContent&&(e+=r.stats.currentContent[t])})),e}});t.exports=n},7709:t=>{var e=function(t){var r,n,i=(t=t||window).document,s=function(e){var r=!1;if(e.getBoundingClientRect){var n=e.getBoundingClientRect();(r={top:Math.max(n.top,0),left:Math.max(n.left,0),bottom:Math.min(n.bottom,t.innerHeight||i.documentElement.clientHeight),right:Math.min(n.right,t.innerWidth||i.documentElement.clientWidth)}).bottom<=r.top||r.right<=r.left?r=!1:r.area=(r.bottom-r.top)*(r.right-r.left)}return r},a=function(t,e){if(e){var r=s(t);r&&o.push({url:e,area:r.area,rect:r})}},o=[],l=[];try{var u=t.performance.timing.navigationStart;!function(){for(var r=i.getElementsByTagName("*"),n=/url\(.*(http.*)\)/gi,l=0;l<r.length;l++){var u=r[l],c=t.getComputedStyle(u);if("IMG"===u.tagName&&a(u,u.src),c["background-image"]){n.lastIndex=0;var h=n.exec(c["background-image"]);h&&h.length>1&&a(u,h[1].replace('"',""))}if("IFRAME"===u.tagName)try{var d=s(u);if(d){var f=e(u.contentWindow);f&&o.push({tm:f,area:d.area,rect:d})}}catch(t){}}}(),function(){for(var e={},r=t.performance.getEntriesByType("resource"),n=0;n<r.length;n++)e[r[n].name]=r[n].responseEnd;for(var i=0;i<o.length;i++)"tm"in o[i]||(o[i].tm=void 0!==e[o[i].url]?e[o[i].url]:0)}(),function(){"msFirstPaint"in t.performance.timing&&(r=t.performance.timing.msFirstPaint-u);for(var e=t.performance.getEntriesByType("paint"),n=0;n<e.length;n++)"first-paint"===e[n].name&&(r=e[n].startTime);if(void 0===r||r<0||r>12e4){r=t.performance.timing.responseStart-u;for(var s={},a=i.getElementsByTagName("head")[0].children,o=0;o<a.length;o++){var l=a[o];"SCRIPT"===l.tagName&&l.src&&!l.async&&(s[l.src]=!0),"LINK"===l.tagName&&"stylesheet"===l.rel&&l.href&&(s[l.href]=!0)}for(var c=t.performance.getEntriesByType("resource"),h=!1,d=0;d<c.length;d++)if(h||!s[c[d].name]||"script"!==c[d].initiatorType&&"link"!==c[d].initiatorType)h=!0;else{var f=c[d].responseEnd;(void 0===r||f>r)&&(r=f)}}r=Math.max(r,0)}(),function(){for(var e={0:0},n=0,s=0;s<o.length;s++){var a=r;"tm"in o[s]&&o[s].tm>r&&(a=o[s].tm),void 0===e[a]&&(e[a]=0),e[a]+=o[s].area,n+=o[s].area}var u=Math.max(i.documentElement.clientWidth,t.innerWidth||0)*Math.max(i.documentElement.clientHeight,t.innerHeight||0);if(u>0&&(u=.1*Math.max(u-n,0),void 0===e[r]&&(e[r]=0),e[r]+=u,n+=u),n){for(var c in e)e.hasOwnProperty(c)&&l.push({tm:c,area:e[c]});l.sort((function(t,e){return t.tm-e.tm}));for(var h=0,d=0;d<l.length;d++)h+=l[d].area,l[d].progress=h/n}}(),function(){if(l.length){n=0;for(var t=0,e=0,i=0;i<l.length;i++){var s=l[i].tm-t;s>0&&e<1&&(n+=(1-e)*s),t=l[i].tm,e=l[i].progress}}else n=r}()}catch(t){}return n};t.exports=e},7569:(t,e,r)=>{var n=r(5429),i=r(3501),s=function(){};s.prototype={constructor:function(){}},s.extend=function(t,e){var r,s=this;return r=t&&t.hasOwnProperty("constructor")?t.constructor:function(){return s.apply(this,arguments)},n(r,s,e),r.prototype=i(s.prototype),t&&n(r.prototype,t),r.prototype.constructor=r,r.__super__=s.prototype,r},t.exports=s},7432:(t,e,r)=>{var n=r(7569),i=r(6654),s=n.extend({exists:function(t){return s.Dictionary.hasOwnProperty(t)},getNewName:function(t){var e=s.Dictionary[t];return i.warn('The option "'+t+'" is deprecated, use "'+e+'" instead'),e}},{Dictionary:{httpSecure:"app.https",username:"user.name",anonymousUser:"user.anonymousId",obfuscateIp:"user.obfuscateIp",userType:"user.type","content.title2":"content.program","background.settings.iphone":"background.settings.iOS","parse.hls":"parse.manifest","parse.dash":"parse.manifest","parse.locationHeader":"parse.manifest","extraparam.1":"content.customDimension.1","extraparam.2":"content.customDimension.2","extraparam.3":"content.customDimension.3","extraparam.4":"content.customDimension.4","extraparam.5":"content.customDimension.5","extraparam.6":"content.customDimension.6","extraparam.7":"content.customDimension.7","extraparam.8":"content.customDimension.8","extraparam.9":"content.customDimension.9","extraparam.10":"content.customDimension.10","extraparam.11":"content.customDimension.11","extraparam.12":"content.customDimension.12","extraparam.13":"content.customDimension.13","extraparam.14":"content.customDimension.14","extraparam.15":"content.customDimension.15","extraparam.16":"content.customDimension.16","extraparam.17":"content.customDimension.17","extraparam.18":"content.customDimension.18","extraparam.19":"content.customDimension.19","extraparam.20":"content.customDimension.20","ad.extraparam.1":"ad.customDimension.1","ad.extraparam.2":"ad.customDimension.2","ad.extraparam.3":"ad.customDimension.3","ad.extraparam.4":"ad.customDimension.4","ad.extraparam.5":"ad.customDimension.5","ad.extraparam.6":"ad.customDimension.6","ad.extraparam.7":"ad.customDimension.7","ad.extraparam.8":"ad.customDimension.8","ad.extraparam.9":"ad.customDimension.9","ad.extraparam.10":"ad.customDimension.10"}});t.exports=s},9055:(t,e,r)=>{var n=r(7569),i=r(9062),s=n.extend({constructor:function(){this.storage=new i("youboraOffline",!0),this.actualView=null,this.viewList=[],this.givenIds=[],this._getOldViewList()},_newView:function(){var t=this._getValidId();this.storage.setLocal(t,""),this.viewList.push(t),this.storage.setLocal("views",this.viewList),this.actualView=t},addEvent:function(t,e){if("/start"===t&&this._newView(),"/init"===t)return null;if(!this.actualView)return null;var r='{"request":"'+t.slice(1)+'",';for(var n in r+='"unixtime":'+Date.now()+",",e){if(void 0===e[n])break;r+='"'+n+'":',"code"===n?r+='"CODE_PLACEHOLDER",':"sessionId"===n?r+='"SESSION_PLACEHOLDER",':"sessionRoot"===n?r+='"ROOT_PLACEHOLDER",':"string"==typeof e[n]?r+='"'+e[n]+'",':"object"==typeof e[n]?r+='"'+JSON.stringify(e[n]).replace(/"/g,'\\"')+'",':r+=e[n]+","}r=r.slice(0,-1),r+="}";var i=this.storage.getLocal(this.actualView);""!==i&&(i+=","),this.storage.setLocal(this.actualView,i+r)},getView:function(){if(this.viewList.length>this.givenIds.length)for(var t=0;;){var e=this.viewList[t];if(this.givenIds.indexOf(e)<0)return this.givenIds.push(e),["["+this.storage.getLocal(e)+"]",e];t++}return[null,null]},removeView:function(t){this.storage.removeLocal(t);var e=this.viewList.indexOf(t);-1!==e&&this.viewList.splice(e,1),-1!==(e=this.givenIds.indexOf(t))&&this.givenIds.splice(e,1),this.storage.setLocal("views",this.viewList.toString()),t===this.actualView&&(this.actualView=null)},_getOldViewList:function(){var t="";this.storage.getLocal("views")?t=this.storage.getLocal("views"):this.storage.setLocal("views",""),""===t?this.viewList=[]:"function"==typeof t.split&&(this.viewList=t.split(","))},_getValidId:function(){var t=Math.floor(1e8*Math.random()).toString();return this.viewList.indexOf(t)>=0?this._getValidId():t},sent:function(){this.givenIds=[]}});t.exports=s},8041:(t,e,r)=>{var n=r(7569),i=r(7432),s=r(6654),a=r(6860),o=r(8747),l=r(3551),u=n.extend({constructor:function(t){this.enabled=!0,this.host="a-fds.youborafds01.com",this.accountCode="nicetest",this.authToken=null,this.authType="Bearer",this.preventZombieViews=!0,this.offline=!1,this.referer=null,this.referral=null,this.disableCookies=!0,this.forceCookies=!1,this.disableStorage=!1,this["user.email"]=null,this["user.type"]=null,this["user.name"]=null,this["user.obfuscateIp"]=!1,this["user.anonymousId"]=null,this["user.privacyProtocol"]=null,this["parse.manifest"]=!1,this["parse.manifest.auth"]={},this["parse.cdnNameHeader"]=["x-cdn-forward"],this["parse.cdnNodeHeader"]="",this["parse.cdnNode"]=!1,this["parse.cdnNode.list"]=["Akamai","Amazon","Cloudfront","Level3","Fastly","Highwinds","Telefonica","Edgecast","NosOtt"],this["parse.fdsResponseHost"]=null,this["parse.cdnSwitchHeader"]=!1,this["parse.cdnTTL"]=60,this["network.ip"]=null,this["network.isp"]=null,this["network.connectionType"]=null,this["device.id"]=null,this["device.code"]=null,this["device.model"]=null,this["device.brand"]=null,this["device.type"]=null,this["device.name"]=null,this["device.osName"]=null,this["device.osVersion"]=null,this["device.browserName"]=null,this["device.browserVersion"]=null,this["device.browserType"]=null,this["device.browserEngine"]=null,this["device.EDID"]=null,this["device.isAnonymous"]=!1,this["content.transactionCode"]=null,this["content.resource"]=null,this["content.isLive"]=null,this["content.isLive.noSeek"]=!1,this["content.isLive.noMonitor"]=!1,this["content.title"]=null,this["content.program"]=null,this["content.duration"]=null,this["content.fps"]=null,this["content.segmentDuration"]=null,this["content.bitrate"]=null,this["content.totalBytes"]=null,this["content.sendTotalBytes"]=!1,this["content.throughput"]=null,this["content.rendition"]=null,this["content.cdn"]=null,this["content.cdnNode"]=null,this["content.cdnType"]=null,this["content.metadata"]={},this["content.metrics"]={},this["content.streamingProtocol"]=null,this["content.transportFormat"]=null,this["content.package"]=null,this["content.saga"]=null,this["content.tvShow"]=null,this["content.season"]=null,this["content.episodeTitle"]=null,this["content.channel"]=null,this["content.id"]=null,this["content.imdbId"]=null,this["content.gracenoteId"]=null,this["content.type"]=null,this["content.genre"]=null,this["content.language"]=null,this["content.autodetect.language"]=!0,this["content.subtitles"]=null,this["content.autodetect.subtitles"]=!0,this["content.contractedResolution"]=null,this["content.cost"]=null,this["content.price"]=null,this["content.playbackType"]=null,this["content.drm"]=null,this["content.encoding.videoCodec"]=null,this["content.encoding.audioCodec"]=null,this["content.encoding.codecSettings"]=null,this["content.encoding.codecProfile"]=null,this["content.encoding.containerFormat"]=null,this["ad.metadata"]={},this["ad.campaign"]=null,this["ad.creativeId"]=null,this["ad.provider"]=null,this["ad.resource"]=null,this["ad.title"]=null,this["ad.duration"]=null,this["ad.expectedPattern"]=null,this["ad.givenAds"]=null,this["ad.breaksTime"]=null,this["ad.expectedBreaks"]=null,this["ad.givenBreaks"]=null,this["ad.ignore"]=!1,this["ad.blockerDetected"]=null,this["app.name"]=null,this["app.releaseVersion"]=null,this["app.https"]=!1,this["background.enabled"]=!0,this["background.settings"]=null,this["background.settings.android"]="stop",this["background.settings.iOS"]="stop",this["background.settings.desktop"]=null,this["background.settings.tv"]="stop",this["background.settings.playstation"]="stop",this["smartswitch.configCode"]=null,this["smartswitch.groupCode"]=null,this["smartswitch.contractCode"]=null,this["content.customDimensions"]={},this["content.customDimension.1"]=null,this["content.customDimension.2"]=null,this["content.customDimension.3"]=null,this["content.customDimension.4"]=null,this["content.customDimension.5"]=null,this["content.customDimension.6"]=null,this["content.customDimension.7"]=null,this["content.customDimension.8"]=null,this["content.customDimension.9"]=null,this["content.customDimension.10"]=null,this["content.customDimension.11"]=null,this["content.customDimension.12"]=null,this["content.customDimension.13"]=null,this["content.customDimension.14"]=null,this["content.customDimension.15"]=null,this["content.customDimension.16"]=null,this["content.customDimension.17"]=null,this["content.customDimension.18"]=null,this["content.customDimension.19"]=null,this["content.customDimension.20"]=null,this["ad.customDimension.1"]=null,this["ad.customDimension.2"]=null,this["ad.customDimension.3"]=null,this["ad.customDimension.4"]=null,this["ad.customDimension.5"]=null,this["ad.customDimension.6"]=null,this["ad.customDimension.7"]=null,this["ad.customDimension.8"]=null,this["ad.customDimension.9"]=null,this["ad.customDimension.10"]=null,this.forceInit=!1,this["session.metrics"]={},this["session.context"]=!1,this["errors.fatal"]=[],this["errors.nonFatal"]=[],this["errors.ignore"]=[],this.linkedViewId=null,this.waitForMetadata=!1,this.pendingMetadata=[],this.method=l.GET,this["playhead.monitor"]=!0,this["readyState.monitor"]=!0,this.setOptions(t)},setOptions:function(t,e){var r=!1;if(void 0===e){e=this,r=!0;var n=new i}if(void 0!==t)for(var a in t){var o=!1,l=null;r&&(this.hasOwnProperty(a)||(n.exists(a)?(l=n.getNewName(a),o=!0):s.warn('The option "'+a+'" does not exist, so it cannot be set'))),"object"!=typeof e[a]||null===e[a]||Array.isArray(e[a])||"parse.cdnNode.list"!==a?o?e[l]=t[a]:e[a]=t[a]:this.setOptions(t[a],e[a])}},setExtraParams:function(t){if("object"==typeof t&&t.length){for(t.length>=20&&(t=t.slice(0,20));t.length<20;)t.push(null);t.forEach(function(t,e){this["content.customDimension."+(e+1).toString()]=t}.bind(this))}},setCustomDimensions:function(){u.prototype.setExtraParams.apply(this,arguments)},setAdExtraParams:function(t){if("object"==typeof t&&t.length){for(t.length>=10&&(t=t.slice(0,10));t.length<10;)t.push(null);t.forEach(function(t,e){this["ad.customDimension."+(e+1).toString()]=t}.bind(this))}},setAdCustomDimensions:function(){u.prototype.setAdExtraParams.apply(this,arguments)}},{StreamingProtocol:o,TransportFormat:a,RequestMethod:l});t.exports=u},1754:(t,e,r)=>{var n=r(6654),i=r(3183),s=r(6229),a={getAdPlayerVersion:function(){return this._safeGetterAdsAdapter("getPlayerVersion")||""},getAdPosition:function(){var t=s.AdPosition.Preroll;if(this._adsAdapter)try{var e=this._adsAdapter.getPosition();s.AdPosition.Preroll!==e&&s.AdPosition.Midroll!==e&&s.AdPosition.Postroll!==e||(t=e)}catch(t){n.warn("An error occured while calling getAdPosition",t)}return!t&&this._adapter&&(t=this._adapter.flags.isJoined?s.AdPosition.Midroll:s.AdPosition.Preroll),t},getAdNumber:function(){return this.requestBuilder.lastSent.adNumber||0},getAdNumberInBreak:function(){return this.requestBuilder.lastSent.adNumberInBreak||0},getBreakNumber:function(){return this.requestBuilder.lastSent.breakNumber||0},getAdPlayhead:function(){var t=this._safeGetterAdsAdapter("getPlayhead");return i.parseNumber(t,0)},getAdDuration:function(){var t=this._safeGetterAdsAdapter("getDuration","ad.duration");return i.parseNumber(t,0)},getAdBitrate:function(){var t=this._safeGetterAdsAdapter("getBitrate");return t&&-1!==t||(t=this.getWebkitAdBitrate()),i.parseNumber(t,-1)},getWebkitAdBitrate:function(){if(this._adsAdapter&&this._adsAdapter.tag&&this._adsAdapter.tag.webkitVideoDecodedByteCount){var t=this._adsAdapter.tag.webkitVideoDecodedByteCount;if(this._lastWebkitAdBitrate){var e=this._adsAdapter.tag.webkitVideoDecodedByteCount-this._lastWebkitAdBitrate;t=Math.round(e/this.viewTransform.response.pingTime*8)}return this._lastWebkitAdBitrate=this._adsAdapter.tag.webkitVideoDecodedByteCount,0!==t?t:-1}},getAdTitle:function(){return this._safeGetterAdsAdapter("getTitle","ad.title")},getAdResource:function(){return this._safeGetterAdsAdapter("getResource","ad.resource")},getAdCampaign:function(){return this._safeGetterAdsAdapter("getCampaign","ad.campaign")},getAdCreativeId:function(){return this._safeGetterAdsAdapter("getCreativeId","ad.creativeId")},getAdProvider:function(){return this._safeGetterAdsAdapter("getProvider","ad.provider")},getAdAdapterVersion:function(){return this._safeGetterAdsAdapter("getVersion")},getAdMetadata:function(){return this.options["ad.metadata"]},getAdInsertionType:function(){return this._safeGetterAdsAdapter("getAdInsertionType")},getGivenBreaks:function(){return this._safeGetterAdsAdapter("getGivenBreaks","ad.givenBreaks")},getExpectedBreaks:function(){var t=null,e=this.options["ad.expectedBreaks"],r=this.options["ad.expectedPattern"];if(e)t=e;else if(r)t=0,t=r.pre?r.pre.length:0,t+=r.mid?r.mid.length:0,t+=r.post?r.post.length:0;else if(this._adsAdapter)try{t=this._adsAdapter.getExpectedBreaks()}catch(t){n.warn("An error occured while calling expectedBreaks",t)}return t},getExpectedPattern:function(){return this._safeGetterAdsAdapter("getExpectedPattern","ad.expectedPattern")},getBreaksTime:function(){return this._safeGetterAdsAdapter("getBreaksTime","ad.breaksTime")},getGivenAds:function(){return this._safeGetterAdsAdapter("getGivenAds","ad.givenAds")},getExpectedAds:function(){var t=null;try{if(this._adsAdapter){var e=this.options["ad.expectedPattern"];if(e&&this.getAdPosition()){var r=[];if(e.pre&&(r=r.concat(e.pre)),e.mid&&(r=r.concat(e.mid)),e.post&&(r=r.concat(e.post)),r.length>0){var i=this.requestBuilder.lastSent.breakNumber;i>r.length&&(i=r.length),t=r[i-1]}}else t=this._adsAdapter.getExpectedAds()}}catch(t){n.warn("An error occured while calling expectedAds",t)}return t},getAdsExpected:function(){var t=null;try{t=this.getExpectedPattern()||this.getGivenAds()||!1}catch(t){n.warn("An error occured while calling givenAds or expectedPattern",t)}return t},getAdJoinDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.join.getDeltaTime(!1):-1},getAdBufferDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.buffer.getDeltaTime(!1):-1},getAdPauseDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.pause.getDeltaTime(!1):0},getAdTotalDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.total.getDeltaTime(!1):-1},getAdViewedDuration:function(){return this._getTimeMaxOrAcum(!0)},getAdViewability:function(){return this._getTimeMaxOrAcum()},_getTimeMaxOrAcum:function(t){var e=0;return this._adsAdapter&&this._adsAdapter.chronos.viewedMax.forEach((function(r){t?e+=r.getDeltaTime(!1):e=Math.max(r.getDeltaTime(!1),e)})),e},getAudioEnabled:function(){return this._safeGetterAdsAdapter("getAudioEnabled")},getIsSkippable:function(){return this._safeGetterAdsAdapter("getIsSkippable")},getIsFullscreen:function(){return this._safeGetterAdsAdapter("getIsFullscreen")},_safeGetterAdsAdapter:function(t,e){var r=null;if(e&&this.options[e])r=this.options[e];else try{this._adsAdapter&&"function"==typeof this._adsAdapter[t]&&(r=this._adsAdapter[t]())}catch(e){n.warn("An error occured while calling "+t,e)}return r}};t.exports=a},9020:(t,e,r)=>{var n=r(6654),i=r(6229),s=r(5382),a=r(3183),o={getAdsAdapter:function(){return this._adsAdapter},setAdsAdapter:function(t){if(t.plugin)n.warn("Adapters can only be added to a single plugin");else for(var e in this.removeAdsAdapter(),t.plugin=this,this._adsAdapter=t,t.setIsAds(!0),this.adsAdapterListeners={},this.adsAdapterListeners[s.Event.START]=this._adStartListener.bind(this),this.adsAdapterListeners[s.Event.JOIN]=this._adJoinListener.bind(this),this.adsAdapterListeners[s.Event.PAUSE]=this._adPauseListener.bind(this),this.adsAdapterListeners[s.Event.RESUME]=this._adResumeListener.bind(this),this.adsAdapterListeners[s.Event.BUFFER_BEGIN]=this._adBufferBeginListener.bind(this),this.adsAdapterListeners[s.Event.BUFFER_END]=this._adBufferEndListener.bind(this),this.adsAdapterListeners[s.Event.STOP]=this._adStopListener.bind(this),this.adsAdapterListeners[s.Event.ERROR]=this._adErrorListener.bind(this),this.adsAdapterListeners[s.Event.CLICK]=this._adClickListener.bind(this),this.adsAdapterListeners[s.Event.MANIFEST]=this._adManifestListener.bind(this),this.adsAdapterListeners[s.Event.PODSTART]=this._adBreakStartListener.bind(this),this.adsAdapterListeners[s.Event.PODSTOP]=this._adBreakStopListener.bind(this),this.adsAdapterListeners[s.Event.QUARTILE]=this._adQuartileListener.bind(this),this.adsAdapterListeners)this._adsAdapter.on(e,this.adsAdapterListeners[e])},removeAdsAdapter:function(){if(this._adsAdapter){if(this._adsAdapter.dispose(),this._adsAdapter.plugin=null,this.adsAdapterListeners){for(var t in this.adsAdapterListeners)this._adsAdapter.off(t,this.adsAdapterListeners[t]);delete this.adsAdapterListeners}this.resizeScrollDetector.stopDetection(),this._adsAdapter=null}},_adStartListener:function(t){this._adapter?(this._adapter.fireBufferEnd(null,"adStartListener"),this._adapter.fireSeekEnd(null,"adStartListener"),this.isInitiated||this._adapter.flags.isStarted||this._adapter.fireStart(),this._adapter.flags.isPaused&&this._adapter.chronos.pause.reset()):this.fireInit(),this._adsAdapter&&(this._adsAdapter.chronos.viewedMax=[]);var e=t.data.params||{};e.adNumber=this.requestBuilder.getNewAdNumber(),(this.getAdResource()||this.getAdTitle())&&"number"==typeof this.getAdDuration()?(this.adStartSent=!0,this._adsAdapter.fireManifest(),this._adsAdapter.fireBreakStart(),e.adNumberInBreak=this.requestBuilder.getNewAdNumberInBreak(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_START,i.Service.AD_START,e)):(this.adInitSent=!0,e.adNumberInBreak=this.requestBuilder.getNewAdNumberInBreak(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_INIT,i.Service.AD_INIT,e))},_adJoinListener:function(t){var e={};a.assign(e,t.data.params||{}),this.adInitSent&&!this.adStartSent&&(this._adsAdapter.fireManifest(),this._adsAdapter.fireBreakStart(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_START,i.Service.AD_START,e)),this._adsAdapter.startChronoView(),this.adConnected&&(this._adsAdapter.chronos.join.startTime=this.adConnectedTime,this._adsAdapter.chronos.total.startTime=this.adConnectedTime,this.adConnectedTime=0,this.adConnected=!1),e=t.data.params||{},this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_JOIN,i.Service.AD_JOIN,e),this.adInitSent=!1,this.adStartSent=!1},_adPauseListener:function(t){var e=t.data.params||{};this._adsAdapter.stopChronoView(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_PAUSE,i.Service.AD_PAUSE,e)},_adResumeListener:function(t){var e=t.data.params||{};this._adsAdapter.startChronoView(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_RESUME,i.Service.AD_RESUME,e)},_adBufferBeginListener:function(t){n.notice("Ad Buffer Begin"),this._adsAdapter.stopChronoView(),this._adsAdapter&&this._adsAdapter.flags.isPaused&&this._adsAdapter.chronos.pause.reset()},_adBufferEndListener:function(t){var e=t.data.params||{};this._adsAdapter.startChronoView(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_BUFFER,i.Service.AD_BUFFER,e)},_adStopListener:function(t){this._adsAdapter.stopChronoView(),this._adsAdapter.flags.reset(),this._totalPrerollsTime=(this._totalPrerollsTime||0)+this._adsAdapter.chronos.total.getDeltaTime();var e=t.data.params||{};if(e.position=this.requestBuilder.lastSent.position,this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_STOP,i.Service.AD_STOP,e),this.requestBuilder.lastSent.position===i.AdPosition.Postroll){var r=this.options["ad.expectedPattern"];this.playedPostrolls++,(this.requestBuilder.lastSent.givenAds&&this.requestBuilder.lastSent.givenAds<=this.playedPostrolls||!this.requestBuilder.lastSent.givenAds&&r&&r.post&&r.post[0]&&r.post[0]<=this.playedPostrolls)&&this.fireStop()}this.adConnected=!0,this.adConnectedTime=(new Date).getTime()},_adErrorListener:function(t){var e=t.data.params||{};return!this._adapter||this._adapter.flags.isStarted||this.isInitiated?this._blockAdError(t.data.params)?null:(this._adsAdapter&&(this._adsAdapter.fireManifest(),this._adsAdapter.fireBreakStart()),this._adsAdapter&&this._adsAdapter.flags.isStarted||(e.adNumber=this.requestBuilder.getNewAdNumber(),e.adNumberInBreak=this.requestBuilder.getNewAdNumberInBreak()),this.isBreakStarted||(e.breakNumber=this.requestBuilder.getNewBreakNumber()),void this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_ERROR,i.Service.AD_ERROR,e)):(this._savedAdError=t,null)},_adSavedError:function(){this._savedAdError&&(this._adErrorListener(this._savedAdError),this._savedAdError=null)},_adSavedManifest:function(){this._savedAdManifest&&(this._adManifestListener(this._savedAdManifest),this._savedAdManifest=null)},_blockAdError:function(t){var e=Date.now();return this._lastAdErrorParams&&this._lastAdErrorParams.errorCode===t.errorCode&&this._lastAdErrorParams.msg===t.msg&&this._lastAdErrorParams.adCreativeId===this.getAdCreativeId()&&this._lastAdErrorTime+5e3>e?(this._lastAdErrorTime=e,!0):(this._lastAdErrorTime=e,this._lastAdErrorParams=t,!1)},_adClickListener:function(t){var e=t.data.params||{};this._adsAdapter.stopChronoView(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_CLICK,i.Service.AD_CLICK,e)},_adManifestListener:function(t){if(!this.isAdsManifestSent){if(this._adapter&&!this._adapter.flags.isStarted&&!this.isInitiated)return this._savedAdManifest=t,null;var e=t.data.params||{};this.isAdsManifestSent=!0,this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_MANIFEST,i.Service.AD_MANIFEST,e)}},_adBreakStartListener:function(t){if(!this.isBreakStarted){this.isBreakStarted=!0,this._adapter&&this._adapter.firePause();var e=t.data.params||{};e.breakNumber=this.requestBuilder.getNewBreakNumber(),this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_POD_START,i.Service.AD_POD_START,e),this.adConnected=!1}},_adBreakStopListener:function(t){if(this.isBreakStarted){this.isBreakStarted=!1;var e=t.data.params||{};e.position=this.requestBuilder.lastSent.position,this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_POD_STOP,i.Service.AD_POD_STOP,e),this.adConnected=!1,this._adapter&&this._adapter.fireResume()}},_adQuartileListener:function(t){var e=t.data.params||{};e.quartile&&this._sendAdEventIfAllowed(i.WillSendEvent.WILL_SEND_AD_QUARTILE,i.Service.AD_QUARTILE,e)},_sendAdEventIfAllowed:function(t,e,r){this.options["ad.ignore"]||this._send(t,e,r),n.notice(e)}};t.exports=o},5006:(t,e,r)=>{var n=r(6654),i=r(3183),s=r(1095),a=r(6860),o=r(8747),l={getPlayhead:function(){var t=this._safeGetterAdapter("getPlayhead");return i.parseNumber(t,0)},getPlayrate:function(){var t=0;if(this._adapter&&this._adapter.flags&&!this._adapter.flags.isPaused)try{t=this._adapter.getPlayrate()}catch(t){n.warn("An error occured while calling getPlayrate",t)}return t},getFramesPerSecond:function(){return this._safeGetterAdapter("getFramesPerSecond","content.fps")},getSegmentDuration:function(){return this.hybridNetwork.getSegmentDuration()||this._safeGetterAdapter("getSegmentDuration","content.segmentDuration")},getDroppedFrames:function(){var t=this._safeGetterAdapter("getDroppedFrames");return t||(t=this.getWebkitDroppedFrames()),i.parseNumber(t,0)},getWebkitDroppedFrames:function(){return this._adapter&&this._adapter.tag&&this._adapter.tag.webkitDroppedFrameCount?this._adapter.tag.webkitDroppedFrameCount:null},getDuration:function(){var t=this._safeGetterAdapter("getDuration","content.duration")||null;return i.parseNumber(Math.round(t),null)},getBitrate:function(){var t=this._safeGetterAdapter("getBitrate","content.bitrate");return t&&-1!==t||(t=this.getWebkitBitrate()),i.parseNumber(t,-1)},getTotalBytes:function(){return this.options["content.sendTotalBytes"]?this._safeGetterAdapter("getTotalBytes","content.totalBytes"):null},getWebkitBitrate:function(){if(this._adapter&&this._adapter.tag&&this._adapter.tag.webkitVideoDecodedByteCount){var t=this._adapter.tag.webkitVideoDecodedByteCount;if(this._lastWebkitBitrate){var e=this._adapter.tag.webkitVideoDecodedByteCount-this._lastWebkitBitrate;t=Math.round(e/this.viewTransform.response.pingTime*8)}return this._lastWebkitBitrate=this._adapter.tag.webkitVideoDecodedByteCount,0!==t?t:-1}},getThroughput:function(){var t=this._safeGetterAdapter("getThroughput","content.throughput");return i.parseNumber(t,-1)},getRendition:function(){return this._safeGetterAdapter("getRendition","content.rendition")},getTitle:function(){return this._safeGetterAdapter("getTitle","content.title")},getTitle2:function(){return this._safeGetterAdapter("getTitle2","content.program")},getIsLive:function(){var t=this.options["content.isLive"];return t||!1===t||(t=this._safeGetterAdapter("getIsLive")||!1),t},getResource:function(){return this._safeGetterAdapter("getResource","content.resource")},getParsedResource:function(){var t=null;return this.resourceTransform.isBlocking()||(t=this.resourceTransform.getResource()),(t=t||this._safeGetterAdapter("getURLToParse"))===this.getResource()?null:t},getTransactionCode:function(){return this.options["content.transactionCode"]},getMetadata:function(){return this.options["content.metadata"]},getPlayerVersion:function(){return this._safeGetterAdapter("getPlayerVersion")||""},getPlayerName:function(){return this._safeGetterAdapter("getPlayerName")||""},getCdn:function(){var t=null;return this.resourceTransform.isBlocking()||(t=this.resourceTransform.getCdnName()),t||this.options["content.cdn"]},getPluginVersion:function(){var t=this.getAdapterVersion();return t||(t=s+"-adapterless-js"),t},getLibVersion:function(){return s},getAdapterVersion:function(){return this._safeGetterAdapter("getVersion")},getCdnTraffic:function(){return this._safeGetterAdapter("getCdnTraffic")||this.hybridNetwork.getCdnTraffic()},getMultiCdnInfo:function(){return this.hybridNetwork.getMultiCdnInfo()},getBalancerResponseId:function(){return this.hybridNetwork.getBalancerResponseId()},getP2PTraffic:function(){return this._safeGetterAdapter("getP2PTraffic")||this.hybridNetwork.getP2PTraffic()},getUploadTraffic:function(){return this._safeGetterAdapter("getUploadTraffic")||this.hybridNetwork.getUploadTraffic()},getIsP2PEnabled:function(){return this._safeGetterAdapter("getIsP2PEnabled")||this.hybridNetwork.getIsP2PEnabled()},getStreamingProtocol:function(){var t=this.options["content.streamingProtocol"];if(t)for(var e in o)if(o[e]===t)return t;return null},getTransportFormat:function(){var t=this.options["content.transportFormat"];if(t||!this.options["parse.manifest"]||this.resourceTransform.isBlocking()||(t=this.resourceTransform.getTransportFormat()),t)for(var e in a)if(a[e]===t)return t;return null},getHouseholdId:function(){return this._safeGetterAdapter("getHouseholdId")},getLatency:function(){return this.getIsLive()?this._safeGetterAdapter("getLatency"):null},getPacketLoss:function(){return this._safeGetterAdapter("getPacketLoss")},getPacketSent:function(){return this._safeGetterAdapter("getPacketSent")},getVideoMetrics:function(){return i.getMetricsFrom(this._adapter?this._adapter.getMetrics():null,this.options["content.metrics"])},getPlayerStartupTime:function(){return this.browserLoadTimes.getPlayerStartupTime()},getJoinDuration:function(){return this._adapter?this._adapter.chronos.join.getDeltaTime(!1):-1},getBufferDuration:function(){return this._adapter?this._adapter.chronos.buffer.getDeltaTime(!1):-1},getSeekDuration:function(){return this._adapter?this._adapter.chronos.seek.getDeltaTime(!1):-1},getPauseDuration:function(){return this._adapter?this._adapter.chronos.pause.getDeltaTime(!1):0},getPackage:function(){return this.options["content.package"]},getSaga:function(){return this.options["content.saga"]},getTvShow:function(){return this.options["content.tvShow"]},getSeason:function(){return this.options["content.season"]},getEpisodeTitle:function(){return this.options["content.episodeTitle"]},getChannel:function(){return this.options["content.channel"]},getID:function(){return this.options["content.id"]},getImdbId:function(){return this.options["content.imdbId"]},getGracenoteID:function(){return this.options["content.gracenoteId"]},getType:function(){return this.options["content.type"]},getGenre:function(){return this.options["content.genre"]},getVideoLanguage:function(){return this.options["content.language"]},getSubtitles:function(){return this.options["content.subtitles"]},getContractedResolution:function(){return this.options["content.contractedResolution"]},getCost:function(){return this.options["content.cost"]},getPrice:function(){return this.options["content.price"]},getPlaybackType:function(){var t=this.options["content.playbackType"];if(!t){var e=this.options["content.isLive"];"boolean"!=typeof e&&(e=this._safeGetterAdapter("getIsLive")),"boolean"==typeof e&&(t=e?"Live":"VoD")}return t},getDRM:function(){return this.options["content.drm"]},getVideoCodec:function(){return this._safeGetterAdapter("getVideoCodec","content.encoding.videoCodec")},getAudioCodec:function(){return this._safeGetterAdapter("getAudioCodec","content.encoding.audioCodec")},getCodecSettings:function(){return this.options["content.encoding.codecSettings"]},getCodecProfile:function(){return this.options["content.encoding.codecProfile"]},getContainerFormat:function(){return this.options["content.encoding.containerFormat"]},getLinkedViewId:function(){return this.options.linkedViewId},_safeGetterAdapter:function(t,e){var r=null;if(e&&this.options[e])r=this.options[e];else try{this._adapter&&"function"==typeof this._adapter[t]&&(r=this._adapter[t]())}catch(e){n.warn("An error occured while calling "+t,e)}return r}};t.exports=l},8702:(t,e,r)=>{var n=r(6654),i=r(6229),s=r(3183),a=r(5382),o={setAdapter:function(t){if(this.browserLoadTimes&&this.browserLoadTimes.setPlayerSetupTime(),t.plugin)n.warn("Adapters can only be added to a single plugin");else for(var e in this.removeAdapter(),this._adapter=t,t.plugin=this,t.setIsAds(!1),this.contentAdapterListeners={},this.contentAdapterListeners[a.Event.START]=this._startListener.bind(this),this.contentAdapterListeners[a.Event.JOIN]=this._joinListener.bind(this),this.contentAdapterListeners[a.Event.PAUSE]=this._pauseListener.bind(this),this.contentAdapterListeners[a.Event.RESUME]=this._resumeListener.bind(this),this.contentAdapterListeners[a.Event.SEEK_BEGIN]=this._seekBufferBeginListener.bind(this),this.contentAdapterListeners[a.Event.SEEK_END]=this._seekEndListener.bind(this),this.contentAdapterListeners[a.Event.BUFFER_BEGIN]=this._seekBufferBeginListener.bind(this),this.contentAdapterListeners[a.Event.BUFFER_END]=this._bufferEndListener.bind(this),this.contentAdapterListeners[a.Event.ERROR]=this._errorListener.bind(this),this.contentAdapterListeners[a.Event.STOP]=this._stopListener.bind(this),this.contentAdapterListeners[a.Event.VIDEO_EVENT]=this._videoEventListener.bind(this),this.contentAdapterListeners)this._adapter.on(e,this.contentAdapterListeners[e])},getAdapter:function(){return this._adapter},removeAdapter:function(){if(this._adapter){if(this._adapter.dispose(),this._adapter.plugin=null,this.contentAdapterListeners){for(var t in this.contentAdapterListeners)this._adapter.off(t,this.contentAdapterListeners[t]);delete this.contentAdapterListeners}this._adapter=null}},_startListener:function(t){this.isInitiated?0!==this.initChrono.startTime&&(this._adapter.chronos.join.startTime=this.initChrono.startTime):(this.viewTransform.nextView(),this._initComm(),this._startPings());try{if(this._adapter&&this.resourceTransform){var e=this._getResourceForTransform();this.resourceTransform.init(e)}}catch(t){}var r=t.data.params||{},s=this.getResource()&&"boolean"==typeof this.getIsLive()&&(this.getIsLive()||"number"==typeof this.getDuration()&&this.getDuration()>0)&&this.getTitle();(s=!this.options.forceInit&&s&&this._isExtraMetadataReady())&&!this.isInitiated?(this._send(i.WillSendEvent.WILL_SEND_START,i.Service.START,r),this._adSavedError(),this._adSavedManifest(),n.notice(i.Service.START+" "+(r.title||r.mediaResource)),this.isStarted=!0):this.isInitiated||(this.isInitiated=!0,this._adapter.chronos.join.start(),this._send(i.WillSendEvent.WILL_SEND_INIT,i.Service.INIT,r),this._adSavedError(),this._adSavedManifest(),n.notice(i.Service.INIT+" "+(r.title||r.mediaResource)))},_retryStart:function(t){this._isExtraMetadataReady()&&(this._send(i.WillSendEvent.WILL_SEND_START,i.Service.START,{}),this.startDelayed=!1)},_joinListener:function(t){var e={};s.assign(e,t.data.params||{}),this._adsAdapter&&this._adsAdapter.flags.isStarted?(this._adapter.monitor&&this._adapter.monitor.stop(),this._adapter.flags.isJoined=!1,this._adapter.chronos.join.stopTime=0):(this._adapter&&(this._adapter.chronos.join.startTime=Math.min(this._adapter.chronos.join.startTime+(this._totalPrerollsTime||0),(new Date).getTime()),this._totalPrerollsTime=0),this.isInitiated&&!this.isStarted&&(this._isExtraMetadataReady()?this._send(i.WillSendEvent.WILL_SEND_START,i.Service.START,e):this.startDelayed=!0,this._adSavedError(),this._adSavedManifest(),n.notice(i.Service.START+" "+(e.title||e.mediaResource)),this.isStarted=!0),e=t.data.params||{},this._adsAdapter&&this.isBreakStarted&&this._adsAdapter.fireBreakStop(),this._send(i.WillSendEvent.WILL_SEND_JOIN,i.Service.JOIN,e),n.notice(i.Service.JOIN+" "+e.joinDuration+"ms"))},_pauseListener:function(t){this._adapter&&(this._adapter.flags.isBuffering||this._adapter.flags.isSeeking||this._adsAdapter&&this._adsAdapter.flags.isStarted)&&this._adapter.chronos.pause.reset();var e=t.data.params||{};this._send(i.WillSendEvent.WILL_SEND_PAUSE,i.Service.PAUSE,e),n.notice(i.Service.PAUSE+" at "+e.playhead+"s")},_resumeListener:function(t){this._adsAdapter&&this.isBreakStarted&&!this._adsAdapter.flags.isStarted&&this._adsAdapter.fireBreakStop();var e=t.data.params||{};this._send(i.WillSendEvent.WILL_SEND_RESUME,i.Service.RESUME,e),n.notice(i.Service.RESUME+" "+e.pauseDuration+"ms"),this._adapter.chronos.pause.reset()},_seekBufferBeginListener:function(t){this._adapter&&this._adapter.flags.isPaused&&this._adapter.chronos.pause.reset(),t.type&&t.type.includes("buffer")?n.notice(t.type+", eventsTriggered: "+this._adapter.fireEventsStruct.buffer):n.notice(t.type+", eventsTriggered: "+this._adapter.fireEventsStruct.seek)},_seekEndListener:function(t){var e=t.data.params||{};this._send(i.WillSendEvent.WILL_SEND_SEEK,i.Service.SEEK,e),n.notice(i.Service.SEEK+" to "+e.playhead+" in "+e.seekDuration+"ms"+(e.triggeredEvents?", eventsTriggered: "+e.triggeredEvents:""))},_bufferEndListener:function(t){var e=t.data.params||{};this._send(i.WillSendEvent.WILL_SEND_BUFFER,i.Service.BUFFER,e),n.notice(i.Service.BUFFER+" to "+e.playhead+" in "+e.bufferDuration+"ms"+(e.triggeredEvents?", eventsTriggered: "+e.triggeredEvents:""))},_errorListener:function(t){this._blockError(t.data.params)||(this.fireError(t.data.params||{}),this._adSavedError(),this._adSavedManifest())},_blockError:function(t){var e=Date.now();return this._lastErrorParams&&this._lastErrorParams.errorCode===t.errorCode&&this._lastErrorParams.msg===t.msg&&this._lastErrorTime+5e3>e?(this._lastErrorTime=e,!0):(this._lastErrorTime=e,this._lastErrorParams=t,!1)},_stopListener:function(t){this.fireStop(t.data.params||{})},_isStopReady:function(t){var e=!1;if(!this.requestBuilder.lastSent.live&&this._adsAdapter&&this._adapter&&(!this._adapter.getPlayhead()||this._adapter.getPlayhead()>=this.requestBuilder.lastSent.mediaDuration-1)){var r=0,n=this.options["ad.expectedPattern"];if(n&&n.post&&n.post[0])r=n.post[0];else if(this.requestBuilder.lastSent.breaksTime){if(this.requestBuilder.lastSent.position===i.AdPosition.Postroll&&(r=this.requestBuilder.lastSent.givenAds),!r&&this.requestBuilder.lastSent.breaksTime){var s=this.requestBuilder.lastSent.breaksTime;s.length>0&&this.requestBuilder.lastSent.mediaDuration&&Math.round(s[s.length-1])+1>=this.requestBuilder.lastSent.mediaDuration&&(r=1)}}else e=!0;r<=this.playedPostrolls&&(e=!0)}else e=!0;return e},_videoEventListener:function(t){this._send(i.WillSendEvent.WILL_SEND_VIDEO_EVENT,i.Service.VIDEO_EVENT,t.data.params)},_isExtraMetadataReady:function(t){if(!this.options.waitForMetadata||this.options.pendingMetadata.length<1)return!0;var e=this.requestBuilder.getGetters();return this.options.pendingMetadata.map(function(t){if(e.hasOwnProperty(t))return!!this[e[t]]()}.bind(this)).indexOf(!1)<0}};t.exports=o},7064:(t,e,r)=>{var n=r(6654),i=r(3183),s=r(6229),a=r(1935),o={fireInit:function(t,e){this.isInitiated||(!this.getAdapter()||this.getAdapter()&&!this.getAdapter().flags.isStarted)&&(this.viewTransform.nextView(),this._initComm(),this._startPings(),this.initChrono.start(),this.isInitiated=!0,t=t||{},e&&(t.triggeredEvents=[e]),this._send(s.WillSendEvent.WILL_SEND_INIT,s.Service.INIT,t),this._adSavedError(),this._adSavedManifest(),n.notice(s.Service.INIT+" "+(t.title||t.mediaResource)))},fireError:function(t,e,r,a){this.fireInit();var o=i.buildErrorParams(t,e,r,a);o.code&&delete o.code,this._send(s.WillSendEvent.WILL_SEND_ERROR,s.Service.ERROR,o),this._adSavedError(),this._adSavedManifest(),n.notice(s.Service.ERROR+" "+o.errorLevel+" "+o.errorCode),"fatal"===o.errorLevel&&this.fireStop()},fireFatalError:function(t,e,r,n){this.fireError(t,e,r,n),this.fireStop()},fireStop:function(t){if(this.isInitiated||this.isStarted){this._adapter&&(this._adapter.flags.isStopped=!0,this._adapter.monitor&&this._adapter.monitor.stop()),this._adsAdapter&&this.isBreakStarted&&(this._adsAdapter.fireStop(),this._adsAdapter.fireBreakStop()),t=t||{},this._send(s.WillSendEvent.WILL_SEND_STOP,s.Service.STOP,t);var e=this._adapter?this._adapter.chronos:null;e&&(e.total.stop(),e.join.reset(),e.pause.reset(),e.buffer.reset(),e.seek.reset()),n.notice(s.Service.STOP+" at "+t.playhead+"s"),this._reset()}},fireOfflineEvents:function(t){this.options&&!this.options.offline?this.isInitiated||this._adapter&&this._adapter.flags.isStarted||this._adsAdapter&&this._adsAdapter.flags.isStarted?n.error("Adapters have to be stopped"):(this._offlineParams=t,this.viewTransform.response.code&&this.viewTransform.response.host?this._generateAndSendOffline():(this.offlineReference=this._generateAndSendOffline.bind(this),this.viewTransform.on(a.Event.DONE,this.offlineReference))):n.error("To send offline events, offline option must be disabled")},_generateAndSendOffline:function(){if(this.options.disableStorage)return null;var t=this._offlineParams;for(this._initComm();;){var e=this.requestBuilder.buildBody(s.Service.OFFLINE_EVENTS).viewJson;if(null===e[0])break;var r=this.viewTransform.nextView(),n=e[0].replace(/CODE_PLACEHOLDER/g,r.toString()).replace(/,"sessionId":"SESSION_PLACEHOLDER"/g,"").replace(/,"sessionRoot":"ROOT_PLACEHOLDER"/g,"");this._send(s.WillSendEvent.WILL_SEND_OFFLINE_EVENTS,s.Service.OFFLINE_EVENTS,t,n,"POST",function(t,e){this.offlineStorage.removeView(e.offlineId)}.bind(this),{offlineId:e[1]})}this.offlineStorage.sent(),this._offlineParams=null}};t.exports=o},2693:(t,e,r)=>{var n=r(3183),i=r(1095),s=r(3551),a={getHost:function(){var t=this.options.host;return this.viewTransform&&this.viewTransform.response&&this.viewTransform.response.host&&(t=this.viewTransform.response.host),n.addProtocol(n.stripProtocol(t),this.options["app.https"])},getUserType:function(){return this.options["user.type"]},isParseManifest:function(){return this.options["parse.manifest"]},isParseCdnNode:function(){return this.options["parse.cdnNode"]},isCdnSwitch:function(){return this.options["parse.cdnSwitchHeader"]},getParseCdnNodeList:function(){return this.options["parse.cdnNode.list"]},getParseCdnNodeNameHeader:function(){return this.options["parse.cdnNameHeader"]},getParseNodeHeader:function(){return this.options["parse.cdnNodeHeader"]},getObfuscateIp:function(){return this.options["user.obfuscateIp"]},getPrivacyProtocol:function(){var t=this.options["user.privacyProtocol"];return"string"==typeof t&&(t=t.toLowerCase()),"optin"===t||"optout"===t?t:null},getCustomDimensions:function(){var t=this.options["content.customDimensions"];return"object"==typeof t?t:null},getExtraparam1:function(){return this.options["content.customDimension.1"]},getExtraparam2:function(){return this.options["content.customDimension.2"]},getExtraparam3:function(){return this.options["content.customDimension.3"]},getExtraparam4:function(){return this.options["content.customDimension.4"]},getExtraparam5:function(){return this.options["content.customDimension.5"]},getExtraparam6:function(){return this.options["content.customDimension.6"]},getExtraparam7:function(){return this.options["content.customDimension.7"]},getExtraparam8:function(){return this.options["content.customDimension.8"]},getExtraparam9:function(){return this.options["content.customDimension.9"]},getExtraparam10:function(){return this.options["content.customDimension.10"]},getExtraparam11:function(){return this.options["content.customDimension.11"]},getExtraparam12:function(){return this.options["content.customDimension.12"]},getExtraparam13:function(){return this.options["content.customDimension.13"]},getExtraparam14:function(){return this.options["content.customDimension.14"]},getExtraparam15:function(){return this.options["content.customDimension.15"]},getExtraparam16:function(){return this.options["content.customDimension.16"]},getExtraparam17:function(){return this.options["content.customDimension.17"]},getExtraparam18:function(){return this.options["content.customDimension.18"]},getExtraparam19:function(){return this.options["content.customDimension.19"]},getExtraparam20:function(){return this.options["content.customDimension.20"]},getAdExtraparam1:function(){return this.options["ad.customDimension.1"]},getAdExtraparam2:function(){return this.options["ad.customDimension.2"]},getAdExtraparam3:function(){return this.options["ad.customDimension.3"]},getAdExtraparam4:function(){return this.options["ad.customDimension.4"]},getAdExtraparam5:function(){return this.options["ad.customDimension.5"]},getAdExtraparam6:function(){return this.options["ad.customDimension.6"]},getAdExtraparam7:function(){return this.options["ad.customDimension.7"]},getAdExtraparam8:function(){return this.options["ad.customDimension.8"]},getAdExtraparam9:function(){return this.options["ad.customDimension.9"]},getAdExtraparam10:function(){return this.options["ad.customDimension.10"]},getPluginInfo:function(){return{lib:i,adapter:this.getAdapterVersion(),adAdapter:this.getAdAdapterVersion()}},getIp:function(){return this.options["network.ip"]},getIsp:function(){return this.options["network.isp"]},getConnectionType:function(){return this.options["network.connectionType"]},getDeviceInfo:function(){var t={};return this.getDeviceCode()&&(t.deviceCode=this.getDeviceCode()),this.getModel()&&(t.model=this.getModel()),this.getBrand()&&(t.brand=this.getBrand()),this.getDeviceType()&&(t.deviceType=this.getDeviceType()),this.getDeviceName()&&(t.deviceName=this.getDeviceName()),this.getOsName()&&(t.osName=this.getOsName()),this.getOsVersion()&&(t.osVersion=this.getOsVersion()),this.getBrowserName()&&(t.browserName=this.getBrowserName()),this.getBrowserVersion()&&(t.browserVersion=this.getBrowserVersion()),this.getBrowserType()&&(t.browserType=this.getBrowserType()),this.getBrowserEngine()&&(t.browserEngine=this.getBrowserEngine()),t!=={}?t:null},getEDID:function(){var t=this.options["device.EDID"];return t?t.toString():null},getDeviceCode:function(){return this.options["device.code"]},getModel:function(){return this.options["device.model"]},getBrand:function(){return this.options["device.brand"]},getDeviceType:function(){return this.options["device.type"]},getDeviceName:function(){return this.options["device.name"]},getOsName:function(){return this.options["device.osName"]},getOsVersion:function(){return this.options["device.osVersion"]},getBrowserName:function(){return this.options["device.browserName"]},getBrowserVersion:function(){return this.options["device.browserVersion"]},getBrowserType:function(){return this.options["device.browserType"]},getBrowserEngine:function(){return this.options["device.browserEngine"]},getAccountCode:function(){return this.options.accountCode},getUsername:function(){return this.options["user.name"]},getAnonymousUser:function(){return this.options["user.anonymousId"]},getEmail:function(){return this.options["user.email"]},getReferer:function(){var t=this.options.referer||"";return!t&&"undefined"!=typeof window&&window.location&&(t=window.location.href),t},getReferral:function(){var t=this.options.referral||"";return t||"undefined"==typeof document||(t=document.referrer),t},getLanguage:function(){var t=null;return"undefined"!=typeof navigator&&(t=navigator.language),t},getScreenResolution:function(){var t=null;try{if(window&&window.screen){var e=window.devicePixelRatio||1;t=window.screen.width*e+"x"+window.screen.height*e}}catch(t){}return t},getNodeHost:function(){return this.options["content.cdnNode"]||this.resourceTransform.getNodeHost()},getNodeType:function(){return this.options["content.cdnType"]||this.resourceTransform.getNodeType()},getNodeTypeString:function(){return this.resourceTransform.getNodeTypeString()},getRequestNumber:function(){return Math.random()},getOfflineView:function(){var t=null;return this.offlineStorage&&(t=this.offlineStorage.getView()),t},getDeviceUUID:function(){var t=null;return this.options["device.isAnonymous"]||(t=this.options["device.id"]||this.uuidGenerator.getKey()),t},getSmartswitchConfigCode:function(){return this.options["smartswitch.configCode"]},getSmartswitchGroupCode:function(){return this.options["smartswitch.groupCode"]},getSmartswitchContractCode:function(){return this.options["smartswitch.contractCode"]},getAppName:function(){return this.options["app.name"]},getAppReleaseVersion:function(){return this.options["app.releaseVersion"]},getIsBlocked:function(){return this.options["ad.blockerDetected"]},isMethodPostEnabled:function(){return this.options.method&&this.options.method.toLowerCase()===s.POST},getPlayheadMonitorEnabled:function(){return this.options["playhead.monitor"]},getReadyStateMonitorEnabled:function(){return this.options["readyState.monitor"]}};t.exports=a},6844:(t,e,r)=>{var n=r(3183),i={getContext:function(){return"Default"},getScrollDepth:function(){var t=this.storage.getSession("pageScrollDepth");return this.storage.removeSession("pageScrollDepth"),t},getSession:function(){var t=this.storage.getStorages("session");if("undefined"===t&&(t=void 0),!t){var e=this.getStoredData();if(e)try{t=JSON.parse(e).q.c}catch(t){}}return t},getStorageHost:function(){var t=null,e=this.getStoredData();if(e)try{t=JSON.parse(e).q.h}catch(t){}return t?n.addProtocol(t,this.options["app.https"]):t},getStoredData:function(){return this.storage.getStorages("data")},getDataTime:function(){return this.storage.getStorages("dataTime")},getLastActive:function(){return this.storage.getStorages("lastactive")},setStoredData:function(t){this.storage.setStorages("data",t)},setSession:function(t){this.storage.setStorages("session",t)},setDataTime:function(t){this.storage.setStorages("dataTime",t)},setLastActive:function(t){this.storage.setStorages("lastactive",t)},getPageName:function(){if("undefined"!=typeof document&&document.title)return document.title},getPageLoadTime:function(){return this.browserLoadTimes.getPageLoadTime()},getIsSessionExpired:function(){var t=(new Date).getTime();return!this.getSession()||this.infinity.getFirstActive()<t-this.sessionExpire},getIsDataExpired:function(){var t=(new Date).getTime();return!this.storage.isEnabled()||!this.getStoredData()||this.infinity.getFirstActive()<t-this.sessionExpire}};t.exports=i},4849:(t,e,r)=>{var n=r(6229),i=r(6654),s=r(5013),a=r(3183),o=r(3194),l={_initInfinity:function(){this.infinity.on(o.Event.NAV,this._navListener.bind(this)),this.infinity.on(o.Event.SESSION_START,this._sessionStartListener.bind(this)),this.infinity.on(o.Event.SESSION_STOP,this._sessionStopListener.bind(this)),this.infinity.on(o.Event.EVENT,this._eventListener.bind(this))},_sendInfinity:function(t,e,r){var n={params:r=this.requestBuilder.buildParams(r,e),plugin:this,adapter:this.getAdapter(),adsAdapter:this.getAdsAdapter()};if(this.emit(t,n),this.infinity._comm&&null!==r&&this.options.enabled){this.lastServeiceSent=e;var i=new s(null,e,r);this.isMethodPostEnabled()&&i.setPostRequest(!0),this.infinity._comm.sendRequest(i)}},_navListener:function(t){var e=t.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_NAV,n.Service.NAV,e),this._beat.isRunning||this._beat.start(),i.notice(n.Service.NAV+" "+e.route)},_sessionStartListener:function(t){var e=t.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_SESSION_START,n.Service.SESSION_START,e),this._beat.isRunning||this._beat.start(),i.notice(n.Service.SESSION_START+" "+e.route)},_sessionStopListener:function(t){var e=t.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_SESSION_STOP,n.Service.SESSION_STOP,e),this._beat.isRunning&&this._beat.stop(),i.notice(n.Service.SESSION_STOP+" "+e.route)},_eventListener:function(t){var e=t.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_EVENT,n.Service.EVENT,e),i.notice(n.Service.EVENT+" "+e.name)},_sendBeat:function(t){var e={diffTime:t};this._sendInfinity(n.WillSendEvent.WILL_SEND_BEAT,n.Service.BEAT,e),this.infinity&&this.infinity._setLastActive(),i.verbose(n.Service.BEAT)},getSessionMetrics:function(){return a.getMetricsFrom(this.options["session.metrics"])}};t.exports=l},9332:(t,e,r)=>{var n=r(6654),i=r(6229),s={_startPings:function(){this._ping.isRunning||this._ping.start()},_stopPings:function(){this._ping.stop()},_sendPing:function(t){var e={diffTime:t,entities:this.requestBuilder.getChangedEntities()};this._adapter&&(e=this._adapter.flags.isPaused?this.requestBuilder.fetchParams(e,["pauseDuration"]):this.requestBuilder.fetchParams(e,["bitrate","throughput","fps"]),this._adapter.flags.isJoined&&(e=this.requestBuilder.fetchParams(e,["playhead"])),this._adapter.flags.isBuffering&&(e=this.requestBuilder.fetchParams(e,["bufferDuration"])),this._adapter.flags.isSeeking&&(e=this.requestBuilder.fetchParams(e,["seekDuration"]))),this._adsAdapter&&!this.options["ad.ignore"]&&(this._adsAdapter.flags.isStarted&&(e=this.requestBuilder.fetchParams(e,["adPlayhead","adViewedDuration","adViewability"]),e=this._adsAdapter.flags.isPaused?this.requestBuilder.fetchParams(e,["adPauseDuration"]):this.requestBuilder.fetchParams(e,["adBitrate"])),this._adsAdapter.flags.isBuffering&&(e=this.requestBuilder.fetchParams(e,["adBufferDuration"]))),this._send(i.WillSendEvent.WILL_SEND_PING,i.Service.PING,e),this.startDelayed&&this._retryStart(),n.verbose(i.Service.PING)}};t.exports=s},9699:(t,e,r)=>{var n=r(8600),i=r(7664),s=r(9777),a=r(6229),o=r(3183),l=r(5013),u=r(6596),c=r(4628),h=r(6e3),d=r(7897),f=r(8548),p=r(8041),g=r(9062),v=r(9055),m=r(6856),y=r(3194),E=r(449),S=r(7981),b=r(4085),T=r(7416),_=r(409),A=r(2836),L=n.extend({constructor:function(t,e,r){"string"!=typeof e||r||(r=e,e=null),this.storage=new g,this.uuidGenerator=new A(this),this.infinity=new y(this),this.isInitiated=!1,this.isAdsManifestSent=!1,this.playedPostrolls=0,this.isBreakStarted=!1,this.initChrono=new s,this.options=new p(t),this.storage=new g(null,this.options.disableCookies,this.options.forceCookies,this.options.disableStorage),this.options.disableStorage||(this.offlineStorage=new v),this._adapter=null,this._adsAdapter=null,this._ping=new i(this._sendPing.bind(this),5e3),this._beat=new i(this._sendBeat.bind(this),3e4),this._refreshData=new i(this._checkOldData.bind(this),36e5),this._refreshData.start(),this.sessionExpire=1e3*Number(this.storage.getLocal("sessionExpire"))||18e4,this.requestBuilder=new m(this),this.resourceTransform=new d(this),this.lastEventTime=null,this.restartViewTransform(r),this._initInfinity(),this.hybridNetwork=new E,this.browserLoadTimes=new S(this),this.deviceDetector=new T,this.backgroundDetector=new b(this),this.resizeScrollDetector=new _(this),this.options["background.enabled"]&&this.backgroundDetector.startDetection(),e&&this.setAdapter(e)},_checkOldData:function(){this._adapter&&this._adapter.flags.isStarted||this.infinity.infinityStarted||this.restartViewTransform()},restartViewTransform:function(t){this.viewTransform=new h(this),this.viewTransform.on(h.Event.DONE,this._receiveData.bind(this)),t?this.viewTransform.setData(t):this.getIsDataExpired()||!this.getStorageHost()||this.storage.getLocal("accCode")!==this.options.accountCode&&this.storage.getSession("accCode")!==this.options.accountCode?(this.storage.removeStorages("data"),this.storage.removeStorages("session"),this.storage.removeLocal("infinityStarted"),this.viewTransform.init()):this.viewTransform.setData(this.getStoredData())},_receiveData:function(t){this._ping.interval=1e3*t.target.response.pingTime,this._beat.interval=1e3*t.target.response.beatTime,this.sessionExpire=1e3*t.target.response.sessionExpire,this.storage.setStorages("data",t.target.response.msg),this.storage.setStorages("dataTime",(new Date).getTime()),this.storage.setStorages("accCode",this.options.accountCode),this.getIsSessionExpired()?(this.viewTransform.setSession(this.viewTransform.response.code),this.storage.setStorages("session",this.viewTransform.response.code),this.storage.setStorages("host",this.viewTransform.response.host)):(this.viewTransform.setSession(this.getSession()),this.viewTransform.setHost(this.getStorageHost()))},_reset:function(){this._stopPings(),this.resourceTransform=new d(this),this._adapter&&this._adapter.flags.reset(),this.isInitiated=!1,this.isStarted=!1,this.startDelayed=!1,this.isAdsManifestSent=!1,this.initChrono.reset(),this._totalPrerollsTime=0,this.requestBuilder.lastSent.breakNumber=0,this.requestBuilder.lastSent.adNumber=0,this._savedAdManifest=null,this._savedAdError=null,this.playedPostrolls=0,this.isBreakStarted=!1},_send:function(t,e,r,n,i,s,o){var u=(new Date).getTime();this.options.preventZombieViews&&this.lastEventTime&&u>this.lastEventTime+6e5&&this.viewTransform.nextView(),this.lastEventTime=e===a.Service.STOP?null:u,r=this.requestBuilder.buildParams(r,e),this.getIsLive()&&(r.mediaDuration=this.options["content.duration"],r.playhead=void 0);var c={params:r,plugin:this,adapter:this.getAdapter(),adsAdapter:this.getAdsAdapter()};if(this.emit(t,c),this._comm&&(null!==r||void 0!==i)&&this.options.enabled){this.lastServeiceSent=e;var h={};void 0!==i&&"GET"!==i&&(h.method=i);var d=new l(null,e,r,h);n&&d.setBody(n),this.isMethodPostEnabled()&&d.setPostRequest(!0),this._comm.sendRequest(d,s,o)}},_initComm:function(){var t=this._getResourceForTransform();this.resourceTransform.init(t),this._comm=new u,this._comm.addTransform(new c),this._comm.addTransform(this.viewTransform),this.options&&this.options.offline?this._comm.addTransform(new f(this)):this._comm.addTransform(this.resourceTransform)},_getResourceForTransform:function(){var t=this.getResource();return this._adapter&&this._adapter.getURLToParse()&&(t=this._adapter.getURLToParse()),t},getComm:function(){return this._comm},setOptions:function(t){t&&(this.options.setOptions(t),"boolean"==typeof t["background.enabled"]&&(t["background.enabled"]?this.backgroundDetector.startDetection():this.backgroundDetector.stopDetection()))},getFastDataConfig:function(){return this.viewTransform.response.msg},disable:function(){this.setOptions({enabled:!1})},enable:function(){this.setOptions({enabled:!0})}},{Event:a.WillSendEvent});o.assign(L.prototype,r(8702)),o.assign(L.prototype,r(2693)),o.assign(L.prototype,r(5006)),o.assign(L.prototype,r(9020)),o.assign(L.prototype,r(1754)),o.assign(L.prototype,r(9332)),o.assign(L.prototype,r(7064)),o.assign(L.prototype,r(4849)),o.assign(L.prototype,r(6844)),t.exports=L},6856:(t,e,r)=>{var n=r(7569),i=r(6654),s=["accountCode","username","anonymousUser","rendition","deviceInfo","player","title","title2","live","segmentDuration","mediaDuration","mediaResource","parsedResource","transactionCode","properties","cdn","playerVersion","param1","param2","param3","param4","param5","param6","param7","param8","param9","param10","param11","param12","param13","param14","param15","param16","param17","param18","param19","param20","dimensions","playerStartupTime","obfuscateIp","privacyProtocol","p2pEnabled","pluginVersion","pluginInfo","isp","connectionType","ip","referer","userType","streamingProtocol","transportFormat","householdId","adsBlocked","adsExpected","deviceUUID","smartswitchConfigCode","smartswitchGroupCode","smartswitchContractCode","libVersion","nodeHost","nodeType","appName","appReleaseVersion","package","saga","tvshow","season","titleEpisode","channel","imdbID","gracenoteID","contentType","genre","contentLanguage","subtitles","cost","price","playbackType","email","drm","videoCodec","audioCodec","codecSettings","codecProfile","containerFormat","contentId","contractedResolution","linkedViewId","edid","cdnBalancerResponseUUID","triggeredEvents"],a=["player","playhead","adTitle","position","adDuration","adCampaign","adCreativeId","adProvider","adResource","adPlayerVersion","adProperties","adAdapterVersion","adInsertionType","extraparam1","extraparam2","extraparam3","extraparam4","extraparam5","extraparam6","extraparam7","extraparam8","extraparam9","extraparam10","fullscreen","audio","skippable","adNumber","adNumberInBreak","breakNumber"],o=n.extend({constructor:function(t){this._plugin=t,this._adNumber=0,this._adNumberInBreak=0,this.lastSent={}},fetchParams:function(t,e,r){t=t||{},e=e||[];for(var n=0;n<e.length;n++){var s=e[n];if(!t[s]){var a=o.getters[s];if(this._plugin[a]){var l=this._plugin[a]();null===l||r&&this.lastSent[s]===l||(t[s]=l,this.lastSent[s]=l)}else i.warn("Trying to call undefined getter "+s+":"+a)}}return t},getGetters:function(){return o.getters},buildBody:function(t){return this.fetchParams(null,o.bodyParams[t],!1)},buildParams:function(t,e){return t=t||{},this.fetchParams(t,o.params[e],!1),this.fetchParams(t,o.differentParams[e],!0),t},getNewAdNumber:function(){var t=this.lastSent.adNumber;return t&&this.lastSent.position===this._plugin.getAdPosition()?t+=1:t=1,this.lastSent.adNumber=t,t},getNewAdNumberInBreak:function(){return this._adNumberInBreak++,this.lastSent.adNumberInBreak=this._adNumberInBreak,this._adNumberInBreak},getNewBreakNumber:function(){var t=1;return this._adNumberInBreak=0,this.lastSent.breakNumber&&(t=this.lastSent.breakNumber+1),this.lastSent.breakNumber=t,t},getChangedEntities:function(){return this.fetchParams({},o.differentParams.entities,!0)}},{params:{"/data":["system","pluginVersion","requestNumber","username"],"/init":s,"/start":s,"/joinTime":["joinDuration","playhead","bitrate","triggeredEvents"],"/pause":["playhead","triggeredEvents"],"/resume":["pauseDuration","playhead","triggeredEvents"],"/seek":["seekDuration","playhead","triggeredEvents"],"/bufferUnderrun":["bufferDuration","playhead","triggeredEvents"],"/error":["player","playhead","triggeredEvents"].concat(s),"/stop":["bitrate","totalBytes","playhead","pauseDuration","metrics","cdnDownloadedTraffic","multiCdnInfo","p2pDownloadedTraffic","uploadTraffic","triggeredEvents"],"/infinity/video/event":[],"/adInit":a,"/adStart":a,"/adJoin":["playhead","position","adJoinDuration","adPlayhead","adNumber","adNumberInBreak","breakNumber"],"/adPause":["playhead","position","adPlayhead","adNumber","adNumberInBreak","breakNumber"],"/adResume":["playhead","position","adPlayhead","adPauseDuration","adNumber","adNumberInBreak","breakNumber"],"/adBufferUnderrun":["playhead","position","adPlayhead","adBufferDuration","adNumber","adNumberInBreak","breakNumber"],"/adStop":["playhead","position","adPlayhead","adBitrate","adTotalDuration","pauseDuration","adViewedDuration","adViewability","adNumber","adNumberInBreak","breakNumber"],"/adClick":["playhead","position","adPlayhead","adNumber","adNumberInBreak","breakNumber"],"/adError":["playhead"].concat(a),"/adManifest":["givenBreaks","expectedBreaks","expectedPattern","breaksTime"],"/adBreakStart":["position","givenAds","expectedAds","breakNumber","adInsertionType"],"/adBreakStop":["position","breakNumber"],"/adQuartile":["position","adViewedDuration","adViewability","adNumber","adNumberInBreak","breakNumber"],"/ping":["droppedFrames","playrate","cdnDownloadedTraffic","multiCdnInfo","p2pDownloadedTraffic","uploadTraffic","latency","packetLoss","packetSent","metrics","totalBytes","segmentDuration"],"/infinity/session/start":["accountCode","username","userType","anonymousUser","route","page","referer","referral","screenResolution","language","deviceInfo","adsBlocked","deviceUUID","libVersion","appName","appReleaseVersion","isp","connectionType","ip","obfuscateIp","privacyProtocol","dimensions","param1","param2","param3","param4","param5","param6","param7","param8","param9","param10","param11","param12","param13","param14","param15","param16","param17","param18","param19","param20","edid"],"/infinity/session/stop":["sessionMetrics"],"/infinity/session/nav":["route","page","scrollDepth"],"/infinity/session/beat":["sessionMetrics"],"/infinity/session/event":["accountCode"],"/offlineEvents":{}},bodyParams:{"/offlineEvents":["viewJson"]},differentParams:{entities:["rendition","title","title2","param1","param2","param3","param4","param5","param6","param7","param8","param9","param10","param11","param12","param13","param14","param15","param16","param17","param18","param19","param20","cdn","nodeHost","nodeType","nodeTypeString","subtitles","contentLanguage","contentId"]},getters:{requestNumber:"getRequestNumber",playhead:"getPlayhead",playrate:"getPlayrate",fps:"getFramesPerSecond",segmentDuration:"getSegmentDuration",droppedFrames:"getDroppedFrames",mediaDuration:"getDuration",bitrate:"getBitrate",totalBytes:"getTotalBytes",throughput:"getThroughput",rendition:"getRendition",title:"getTitle",title2:"getTitle2",live:"getIsLive",mediaResource:"getResource",parsedResource:"getParsedResource",transactionCode:"getTransactionCode",properties:"getMetadata",playerVersion:"getPlayerVersion",player:"getPlayerName",cdn:"getCdn",pluginVersion:"getPluginVersion",libVersion:"getLibVersion",userType:"getUserType",streamingProtocol:"getStreamingProtocol",transportFormat:"getTransportFormat",obfuscateIp:"getObfuscateIp",privacyProtocol:"getPrivacyProtocol",householdId:"getHouseholdId",latency:"getLatency",packetLoss:"getPacketLoss",packetSent:"getPacketSent",metrics:"getVideoMetrics",dimensions:"getCustomDimensions",param1:"getExtraparam1",param2:"getExtraparam2",param3:"getExtraparam3",param4:"getExtraparam4",param5:"getExtraparam5",param6:"getExtraparam6",param7:"getExtraparam7",param8:"getExtraparam8",param9:"getExtraparam9",param10:"getExtraparam10",param11:"getExtraparam11",param12:"getExtraparam12",param13:"getExtraparam13",param14:"getExtraparam14",param15:"getExtraparam15",param16:"getExtraparam16",param17:"getExtraparam17",param18:"getExtraparam18",param19:"getExtraparam19",param20:"getExtraparam20",extraparam1:"getAdExtraparam1",extraparam2:"getAdExtraparam2",extraparam3:"getAdExtraparam3",extraparam4:"getAdExtraparam4",extraparam5:"getAdExtraparam5",extraparam6:"getAdExtraparam6",extraparam7:"getAdExtraparam7",extraparam8:"getAdExtraparam8",extraparam9:"getAdExtraparam9",extraparam10:"getAdExtraparam10",position:"getAdPosition",adNumber:"getAdNumber",adNumberInBreak:"getAdNumberInBreak",breakNumber:"getBreakNumber",adPlayhead:"getAdPlayhead",adDuration:"getAdDuration",adCampaign:"getAdCampaign",adCreativeId:"getAdCreativeId",adBitrate:"getAdBitrate",adTitle:"getAdTitle",adResource:"getAdResource",adPlayerVersion:"getAdPlayerVersion",adProperties:"getAdMetadata",adAdapterVersion:"getAdAdapterVersion",givenBreaks:"getGivenBreaks",expectedBreaks:"getExpectedBreaks",expectedPattern:"getExpectedPattern",breaksTime:"getBreaksTime",givenAds:"getGivenAds",expectedAds:"getExpectedAds",adsExpected:"getAdsExpected",adViewedDuration:"getAdViewedDuration",adViewability:"getAdViewability",fullscreen:"getIsFullscreen",audio:"getAudioEnabled",skippable:"getIsSkippable",adProvider:"getAdProvider",adInsertionType:"getAdInsertionType",pluginInfo:"getPluginInfo",isp:"getIsp",connectionType:"getConnectionType",ip:"getIp",deviceInfo:"getDeviceInfo",edid:"getEDID",system:"getAccountCode",accountCode:"getAccountCode",username:"getUsername",anonymousUser:"getAnonymousUser",joinDuration:"getJoinDuration",bufferDuration:"getBufferDuration",seekDuration:"getSeekDuration",pauseDuration:"getPauseDuration",adJoinDuration:"getAdJoinDuration",adBufferDuration:"getAdBufferDuration",adPauseDuration:"getAdPauseDuration",adTotalDuration:"getAdTotalDuration",referer:"getReferer",referral:"getReferral",language:"getLanguage",screenResolution:"getScreenResolution",nodeHost:"getNodeHost",nodeType:"getNodeType",nodeTypeString:"getNodeTypeString",route:"getReferer",page:"getPageName",playerStartupTime:"getPlayerStartupTime",pageLoadTime:"getPageLoadTime",cdnDownloadedTraffic:"getCdnTraffic",multiCdnInfo:"getMultiCdnInfo",p2pDownloadedTraffic:"getP2PTraffic",p2pEnabled:"getIsP2PEnabled",uploadTraffic:"getUploadTraffic",cdnBalancerResponseUUID:"getBalancerResponseId",viewJson:"getOfflineView",deviceUUID:"getDeviceUUID",sessionMetrics:"getSessionMetrics",scrollDepth:"getScrollDepth",adsBlocked:"getIsBlocked",linkedViewId:"getLinkedViewId",smartswitchConfigCode:"getSmartswitchConfigCode",smartswitchGroupCode:"getSmartswitchGroupCode",smartswitchContractCode:"getSmartswitchContractCode",appName:"getAppName",appReleaseVersion:"getAppReleaseVersion",package:"getPackage",saga:"getSaga",tvshow:"getTvShow",season:"getSeason",titleEpisode:"getEpisodeTitle",channel:"getChannel",drm:"getDRM",videoCodec:"getVideoCodec",audioCodec:"getAudioCodec",codecSettings:"getCodecSettings",codecProfile:"getCodecProfile",containerFormat:"getContainerFormat",contentId:"getID",imdbID:"getImdbId",gracenoteID:"getGracenoteID",contentType:"getType",genre:"getGenre",contentLanguage:"getVideoLanguage",subtitles:"getSubtitles",contractedResolution:"getContractedResolution",cost:"getCost",price:"getPrice",playbackType:"getPlaybackType",email:"getEmail"}});t.exports=o},9062:(t,e,r)=>{var n=r(7569),i=r(6654),s=n.extend({constructor:function(t,e,r,n){this.prefix=t||"youbora",this.disableCookies=e,this.forceCookies=r,this.disabled=n},isEnabled:function(){if(this.disabled)return!1;var t=!0;if(!this.forceCookies)try{localStorage.setItem(this.prefix+".test","true"),localStorage.removeItem(this.prefix+".test")}catch(e){t=!1}return t},setLocal:function(t,e){if(this.disabled)return null;var r=null;try{r=!this.forceCookies&&("undefined"!=typeof localStorage&&localStorage||this.disableCookies)?localStorage.setItem(this.prefix+"."+t,e):this._setCookie(this.prefix+".local."+t,e)}catch(t){i.error("Youbora Infinity needs localStorage or cookies, not supported by your browser.")}return r},getLocal:function(t){return this.disabled?null:this._localGetRemove("getItem","_getCookie",t)},removeLocal:function(t){return this.disabled?null:this._localGetRemove("removeItem","_removeCookie",t)},_localGetRemove:function(t,e,r){var n=null;try{n=!this.forceCookies&&("undefined"!=typeof localStorage&&localStorage||this.disableCookies)?localStorage[t](this.prefix+"."+r):this[e](this.prefix+".local."+r)}catch(t){i.error("Youbora Infinity needs localStorage or cookies, not supported by your browser.")}return n},setSession:function(t,e){if(this.disabled)return null;var r=null;try{r=!this.forceCookies&&("undefined"!=typeof sessionStorage&&sessionStorage||this.disableCookies)?sessionStorage.setItem(this.prefix+"."+t,e):this._setCookie(this.prefix+".session."+t,e)}catch(t){i.error("Youbora Infinity needs sessionStorage or cookies, not supported by your browser.")}return r},getSession:function(t){return this.disabled?null:this._sessionGetRemove("getItem","_getCookie",t)},removeSession:function(t){return this.disabled?null:this._sessionGetRemove("removeItem","_removeCookie",t)},_sessionGetRemove:function(t,e,r){var n=null;try{n=!this.forceCookies&&("undefined"!=typeof sessionStorage&&sessionStorage||this.disableCookies)?sessionStorage[t](this.prefix+"."+r):this[e](this.prefix+".session."+r)}catch(t){i.error("Youbora Infinity needs sessionStorage or cookies, not supported by your browser.")}return n},getStorages:function(t){return this.getSession(t)||this.getLocal(t)},setStorages:function(t,e){this.setSession(t,e),this.setLocal(t,e)},removeStorages:function(t){this.removeSession(t),this.removeLocal(t)},_setCookie:function(t,e){if("undefined"!=typeof document){var r=";";"undefined"!=typeof location&&(r+="domain="+location.host.split(".").reverse().splice(0,2).reverse().join(".")+";path=/;"),document.cookie=t+"="+e+r}},_getCookie:function(t){if("undefined"!=typeof document)for(var e=t+"=",r=decodeURIComponent(document.cookie).split(";"),n=0;n<r.length;n++){for(var i=r[n];" "===i.charAt(0);)i=i.substring(1);if(0===i.indexOf(e))return i.substring(e.length,i.length)}return null},_removeCookie:function(t){this._setCookie(t,"")}});t.exports=s},3014:t=>{t.exports=function(){Function.prototype.bind=Function.prototype.bind||function(t){var e=Array.prototype.slice,r=this,n=e.call(arguments,1);function i(){var i=r.prototype&&this instanceof r;return r.apply(!i&&t||this,n.concat(e.call(arguments)))}return i.prototype=r.prototype,i},Array.prototype.forEach=Array.prototype.forEach||function(t,e){if("function"!=typeof t)throw new TypeError(t+" is not a function!");for(var r=this.length,n=0;n<r;n++)t.call(e,this[n],n,this)},Math.trunc=Math.trunc||function(t){return isNaN(t)?NaN:t>0?Math.floor(t):Math.ceil(t)}}},7664:(t,e,r)=>{var n=r(7569),i=r(9777),s=n.extend({constructor:function(t,e){this.callback=t,this.interval=e||5e3,this.isRunning=!1,this._timer=null,this.chrono=new i},start:function(){this.isRunning||(this.isRunning=!0,this._setTick())},stop:function(){if(this.isRunning=!1,this._timer)try{clearTimeout(this._timer),this._timer=null}catch(t){"undefined"!=typeof atv&&(atv.clearTimeout(this._timer),this._timer=null)}},_setTick:function(){if(this.isRunning){this.chrono.start();try{this._timer=setTimeout(function(){this.callback(this.chrono.stop()),this._setTick()}.bind(this),this.interval)}catch(t){"undefined"!=typeof atv&&(this._timer=atv.setTimeout(function(){this.callback(this.chrono.stop()),this._setTick()}.bind(this),this.interval))}}}});t.exports=s},3183:(t,e,r)=>{var n=r(6654),i={stripProtocol:function(t){var e=t;try{e=t.replace(/^(.*?:\/\/|\/\/)/i,"")}catch(t){n.warn(t)}return e},addProtocol:function(t,e){var r="http://localhost/";try{r="http://"+t,e||"undefined"!=typeof window&&0===window.location.protocol.indexOf("https")?r="https://"+t:"undefined"!=typeof window&&0===window.location.protocol.indexOf("http")&&(r="//"+t)}catch(t){n.warn(t)}return r},parseNumber:function(t,e){return!isNaN(t)&&t>=0&&t!==1/0&&t!==-1/0&&null!=t?t:e},logAllEvents:function(t,e,r){try{if(n.logLevel<=n.Level.DEBUG){r=r||function(t){n.debug("Event: "+t.type)};var i=["canplay","buffering","waiting","ended","play","playing","pause","resume","error","abort","seek","seeking","seeked","stalled","dispose","loadeddata","loadstart"];e&&(null===e[0]?(e.shift(),i=e):i=i.concat(e));for(var s=0;s<i.length;s++)"function"==typeof t?t.call(window,i[s],r):t.on?t.on(i[s],r):t.addEventListener&&t.addEventListener(i[s],r)}}catch(t){n.error(t)}},buildRenditionString:function(t,e,r){1===arguments.length&&(r=t,t=null,e=null);var n=null;return t&&e&&(n=t+"x"+e),"number"==typeof r&&!isNaN(r)&&r>=1&&(n?n+="@":n="",n+=r<1e3?Math.round(r)+"bps":r<1e6?(r=Math.round(r/1e3))+"Kbps":(r=Math.round(r/1e4)/100)+"Mbps"),n},buildErrorParams:function(t,e,r,n){var i={};return"object"==typeof t&&null!==t?i=t:(i.errorCode=t||"FAILURE",i.msg=e||i.errorCode,i.errorMetadata=r,i.errorLevel=n),i},calculateAdViewability:function(t,e){var r=!0;if("undefined"!=typeof window&&t&&"function"==typeof t.getBoundingClientRect){var n=t.getBoundingClientRect();if(n.top>=window.innerHeight||n.bottom<=0||n.right<=0||n.left>=window.innerWidth)r=!1;else{var i=Math.trunc(n.height*n.width),s=n.top>0?n.top:0,a=n.bottom>window.innerHeight?window.innerHeight:n.bottom,o=n.left>0?n.left:0;r=((n.right>window.innerWidth?window.innerWidth:n.right)-o)*(a-s)*100>i*(e||50)}}return r},getMetricsFrom:function(t,e){var r=t||e;for(var n in r)if("object"!=typeof r[n]||!r[n].value){var i={};i.value=r[n],r[n]=i}return r},assign:r(5429),isArray:r(8436)};t.exports=i},1095:(t,e,r)=>{t.exports=r(2598).version},3823:(t,e,r)=>{var n=i,i={noConflict:function(){return i=n,this}};i.VERSION=r(1095),i.polyfills=r(3014),i.polyfills(),i.Object=r(7569),i.Emitter=r(8600),i.Log=r(6654),i.Log.loadLevelFromUrl(),i.Util=r(3183),i.HybridNetwork=r(449),i.Chrono=r(9777),i.Timer=r(7664),i.Constants=r(6229),i.Request=r(5013),i.Communication=r(6596),i.Transform=r(1935),i.ViewTransform=r(6e3),i.ResourceTransform=r(7897),i.CdnParser=r(4011),i.HlsParser=r(3786),i.DashParser=r(2153),i.OfflineParser=r(8548),i.LocationheaderParser=r(5269),i.Options=r(8041),i.Plugin=r(9699),i.Storage=r(9062),i.RequestBuilder=r(6856),i.PlayheadMonitor=r(6011),i.Adapter=r(5382),i.adapters={},i.Infinity=r(3194),i.BackgroundDetector=r(4085),i.DeviceDetector=r(7416),i.UUIDGenerator=r(2836),i.registerAdapter=function(t,e){this.adapters[t]=e}.bind(i),i.unregisterAdapter=function(t){this.adapters[t]=null}.bind(i),t.exports=i},2480:()=>{},8121:t=>{"use strict";t.exports=JSON.parse('{"name":"hlsjs","type":"adapter","tech":"js","author":"Jesus Lopez","version":"6.8.8","built":"2023-03-17","repo":"https://bitbucket.org/npaw/hlsjs-adapter-js","libVersion":"^6.8.34","features":{"buffer":"native","seek":"native","error":true,"stop":true,"pause":true,"resume":true,"getters":["getPlayhead","getPlayrate","getDroppedFrames","getDuration","getBitrate","getRendition","getIsLive","getResource","getPlayerVersion","getLatency"]},"ads":[]}')},2598:t=>{"use strict";t.exports={version:"6.8.48"}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}r.amdD=function(){throw new Error("define cannot be used indirect")},r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{"use strict";r(6266),r(990),r(4160),r(6197),r(3568),r(8051),r(8250),r(5434),r(4952),r(6337),r(2928),r.g._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),r.g._babelPolyfill=!0})(),(()=>{"use strict";var t=r(4001),e=r.n(t);function n(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var i,s,a,o,l,u={exports:{}};i=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,a=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,u.exports=l={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var n=l.parseURL(t);if(!n)throw new Error("Error trying to parse base URL.");return n.path=l.normalizePath(n.path),l.buildURLFromParts(n)}var i=l.parseURL(e);if(!i)throw new Error("Error trying to parse relative URL.");if(i.scheme)return r.alwaysNormalize?(i.path=l.normalizePath(i.path),l.buildURLFromParts(i)):e;var a=l.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var o=s.exec(a.path);a.netLoc=o[1],a.path=o[2]}a.netLoc&&!a.path&&(a.path="/");var u={scheme:a.scheme,netLoc:i.netLoc,path:null,params:i.params,query:i.query,fragment:i.fragment};if(!i.netLoc&&(u.netLoc=a.netLoc,"/"!==i.path[0]))if(i.path){var c=a.path,h=c.substring(0,c.lastIndexOf("/")+1)+i.path;u.path=l.normalizePath(h)}else u.path=a.path,i.params||(u.params=a.params,i.query||(u.query=a.query));return null===u.path&&(u.path=r.alwaysNormalize?l.normalizePath(i.path):i.path),l.buildURLFromParts(u)},parseURL:function(t){var e=i.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(a,"");t.length!==(t=t.replace(o,"")).length;);return t.split("").reverse().join("")},buildURLFromParts:function(t){return t.scheme+t.netLoc+t.path+t.params+t.query+t.fragment}};var c=u.exports;function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){var n,i,s;n=t,i=e,s=r[e],(i=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(i))in n?Object.defineProperty(n,i,{value:s,enumerable:!0,configurable:!0,writable:!0}):n[i]=s})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function f(){return f=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},f.apply(this,arguments)}const p=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},g=Number.isSafeInteger||function(t){return"number"==typeof t&&Math.abs(t)<=v},v=Number.MAX_SAFE_INTEGER||9007199254740991;let m=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.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",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.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t}({}),y=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}({}),E=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}({});const S=function(){},b={trace:S,debug:S,log:S,warn:S,info:S,error:S};let T=b;const _=T,A=/^(\d+)x(\d+)$/,L=/(.+?)=(".*?"|.*?)(?:,|$)/g;class w{constructor(t){"string"==typeof t&&(t=w.parseAttrList(t)),f(this,t)}get clientAttrs(){return Object.keys(this).filter((t=>"X-"===t.substring(0,2)))}decimalInteger(t){const e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}hexadecimalInteger(t){if(this[t]){let e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;const r=new Uint8Array(e.length/2);for(let t=0;t<e.length/2;t++)r[t]=parseInt(e.slice(2*t,2*t+2),16);return r}return null}hexadecimalIntegerAsNumber(t){const e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}decimalFloatingPoint(t){return parseFloat(this[t])}optionalFloat(t,e){const r=this[t];return r?parseFloat(r):e}enumeratedString(t){return this[t]}bool(t){return"YES"===this[t]}decimalResolution(t){const e=A.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}static parseAttrList(t){let e;const r={};for(L.lastIndex=0;null!==(e=L.exec(t));){let t=e[2];0===t.indexOf('"')&&t.lastIndexOf('"')===t.length-1&&(t=t.slice(1,-1)),r[e[1].trim()]=t}return r}}function R(t){return"SCTE35-OUT"===t||"SCTE35-IN"===t}class k{constructor(t,e){if(this.attr=void 0,this._startDate=void 0,this._endDate=void 0,this._badValueForSameId=void 0,e){const r=e.attr;for(const e in r)if(Object.prototype.hasOwnProperty.call(t,e)&&t[e]!==r[e]){_.warn(`DATERANGE tag attribute: "${e}" does not match for tags with ID: "${t.ID}"`),this._badValueForSameId=e;break}t=f(new w({}),r,t)}if(this.attr=t,this._startDate=new Date(t["START-DATE"]),"END-DATE"in this.attr){const t=new Date(this.attr["END-DATE"]);p(t.getTime())&&(this._endDate=t)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get startDate(){return this._startDate}get endDate(){if(this._endDate)return this._endDate;const t=this.duration;return null!==t?new Date(this._startDate.getTime()+1e3*t):null}get duration(){if("DURATION"in this.attr){const t=this.attr.decimalFloatingPoint("DURATION");if(p(t))return t}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isValid(){return!!this.id&&!this._badValueForSameId&&p(this.startDate.getTime())&&(null===this.duration||this.duration>=0)&&(!this.endOnNext||!!this.class)}}class D{constructor(){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}}}var I="audio",P="video",O="audiovideo";class C{constructor(t){this._byteRange=null,this._url=null,this.baseurl=void 0,this.relurl=void 0,this.elementaryStreams={[I]:null,[P]:null,[O]:null},this.baseurl=t}setByteRange(t,e){const r=t.split("@",2);let n;n=1===r.length?(null==e?void 0:e.byteRangeEndOffset)||0:parseInt(r[1]),this._byteRange=[n,parseInt(r[0])+n]}get byteRange(){return this._byteRange?this._byteRange:[]}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=c.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(t){this._url=t}}class x extends C{constructor(t,e){super(e),this._decryptdata=null,this.rawProgramDateTime=null,this.programDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.stats=new D,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=t}get decryptdata(){const{levelkeys:t}=this;if(!t&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkeys&&!this.levelkeys.NONE){const t=this.levelkeys.identity;if(t)this._decryptdata=t.getDecryptData(this.sn);else{const t=Object.keys(this.levelkeys);if(1===t.length)return this._decryptdata=this.levelkeys[t[0]].getDecryptData(this.sn)}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(null===this.programDateTime)return null;if(!p(this.programDateTime))return null;const t=p(this.duration)?this.duration:0;return this.programDateTime+1e3*t}get encrypted(){var t;if(null!=(t=this._decryptdata)&&t.encrypted)return!0;if(this.levelkeys){const t=Object.keys(this.levelkeys),e=t.length;if(e>1||1===e&&this.levelkeys[t[0]].encrypted)return!0}return!1}setKeyFormat(t){if(this.levelkeys){const e=this.levelkeys[t];e&&!this._decryptdata&&(this._decryptdata=e.getDecryptData(this.sn))}}abortRequests(){var t,e;null==(t=this.loader)||t.abort(),null==(e=this.keyLoader)||e.abort()}setElementaryStreamInfo(t,e,r,n,i,s=!1){const{elementaryStreams:a}=this,o=a[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,r),o.startDTS=Math.min(o.startDTS,n),o.endDTS=Math.max(o.endDTS,i)):a[t]={startPTS:e,endPTS:r,startDTS:n,endDTS:i,partial:s}}clearElementaryStreamInfo(){const{elementaryStreams:t}=this;t[I]=null,t[P]=null,t[O]=null}}class M extends C{constructor(t,e,r,n,i){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.stats=new D,this.duration=t.decimalFloatingPoint("DURATION"),this.gap=t.bool("GAP"),this.independent=t.bool("INDEPENDENT"),this.relurl=t.enumeratedString("URI"),this.fragment=e,this.index=n;const s=t.enumeratedString("BYTERANGE");s&&this.setByteRange(s,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:t}=this;return!!(t.audio||t.video||t.audiovideo)}}class F{constructor(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}reloaded(t){if(!t)return this.advanced=!0,void(this.updated=!0);const e=this.lastPartSn-t.lastPartSn,r=this.lastPartIndex-t.lastPartIndex;this.updated=this.endSN!==t.endSN||!!r||!!e||!this.live,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}get hasProgramDateTime(){return!!this.fragments.length&&p(this.fragments[this.fragments.length-1].programDateTime)}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||10}get drift(){const t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){var t;return null!=(t=this.fragments)&&t.length?this.fragments[this.fragments.length-1].end:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].index:-1}get lastPartSn(){var t;return null!=(t=this.partList)&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}function N(t){return Uint8Array.from(atob(t),(t=>t.charCodeAt(0)))}function B(t){return Uint8Array.from(unescape(encodeURIComponent(t)),(t=>t.charCodeAt(0)))}const U="undefined"!=typeof self?self:void 0;var j={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},H="org.w3.clearkey",G="com.apple.streamingkeydelivery",V="com.microsoft.playready",K="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";function $(t){switch(t){case G:return j.FAIRPLAY;case V:return j.PLAYREADY;case K:return j.WIDEVINE;case H:return j.CLEARKEY}}var W="edef8ba979d64acea3c827dcd51d21ed";function q(t){return t===W?j.WIDEVINE:"9a04f07998404286ab92e65be0885f95"===t?j.PLAYREADY:"1077efecc0b24d02ace33c1e52e2fb4b"===t||"e2719d58a985b3c9781ab030af78d30e"===t?j.CLEARKEY:void 0}function Y(t){switch(t){case j.FAIRPLAY:return G;case j.PLAYREADY:return V;case j.WIDEVINE:return K;case j.CLEARKEY:return H}}function z(t){const{drmSystems:e,widevineLicenseUrl:r}=t,n=e?[j.FAIRPLAY,j.WIDEVINE,j.PLAYREADY,j.CLEARKEY].filter((t=>!!e[t])):[];return!n[j.WIDEVINE]&&r&&n.push(j.WIDEVINE),n}const X=null!=U&&null!=(J=U.navigator)&&J.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null;var J;function Q(t,e,r){return Uint8Array.prototype.slice?t.slice(e,r):new Uint8Array(Array.prototype.slice.call(t,e,r))}const Z=(t,e)=>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,tt=(t,e)=>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,et=(t,e)=>{const r=e;let n=0;for(;Z(t,e);)n+=10,n+=rt(t,e+6),tt(t,e+10)&&(n+=10),e+=n;if(n>0)return t.subarray(r,r+n)},rt=(t,e)=>{let 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],r},nt=(t,e)=>Z(t,e)&&rt(t,e+6)+10<=t.length-e,it=t=>{const e=ot(t);for(let t=0;t<e.length;t++){const r=e[t];if(st(r))return dt(r)}},st=t=>t&&"PRIV"===t.key&&"com.apple.streaming.transportStreamTimestamp"===t.info,at=t=>{const e=String.fromCharCode(t[0],t[1],t[2],t[3]),r=rt(t,4);return{type:e,size:r,data:t.subarray(10,10+r)}},ot=t=>{let e=0;const r=[];for(;Z(t,e);){const n=rt(t,e+6);e+=10;const i=e+n;for(;e+8<i;){const n=at(t.subarray(e)),i=lt(n);i&&r.push(i),e+=n.size+10}tt(t,e)&&(e+=10)}return r},lt=t=>"PRIV"===t.type?ut(t):"W"===t.type[0]?ht(t):ct(t),ut=t=>{if(t.size<2)return;const e=ft(t.data,!0),r=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:r.buffer}},ct=t=>{if(t.size<2)return;if("TXXX"===t.type){let e=1;const r=ft(t.data.subarray(e),!0);e+=r.length+1;const n=ft(t.data.subarray(e));return{key:t.type,info:r,data:n}}const e=ft(t.data.subarray(1));return{key:t.type,data:e}},ht=t=>{if("WXXX"===t.type){if(t.size<2)return;let e=1;const r=ft(t.data.subarray(e),!0);e+=r.length+1;const n=ft(t.data.subarray(e));return{key:t.type,info:r,data:n}}const e=ft(t.data);return{key:t.type,data:e}},dt=t=>{if(8===t.data.byteLength){const e=new Uint8Array(t.data),r=1&e[3];let n=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return n/=45,r&&(n+=47721858.84),Math.round(n)}},ft=(t,e=!1)=>{const r=gt();if(r){const n=r.decode(t);if(e){const t=n.indexOf("\0");return-1!==t?n.substring(0,t):n}return n.replace(/\0/g,"")}const n=t.length;let i,s,a,o="",l=0;for(;l<n;){if(i=t[l++],0===i&&e)return o;if(0!==i&&3!==i)switch(i>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(i);break;case 12:case 13:s=t[l++],o+=String.fromCharCode((31&i)<<6|63&s);break;case 14:s=t[l++],a=t[l++],o+=String.fromCharCode((15&i)<<12|(63&s)<<6|(63&a)<<0)}}return o};let pt;function gt(){if(!navigator.userAgent.includes("PlayStation 4"))return pt||void 0===self.TextDecoder||(pt=new self.TextDecoder("utf-8")),pt}const vt=function(t){let e="";for(let r=0;r<t.length;r++){let n=t[r].toString(16);n.length<2&&(n="0"+n),e+=n}return e},mt=Math.pow(2,32)-1,yt=[].push,Et={video:1,audio:2,id3:3,text:4};function St(t){return String.fromCharCode.apply(null,t)}function bt(t,e){const r=t[e]<<8|t[e+1];return r<0?65536+r:r}function Tt(t,e){const r=At(t,e);return r<0?4294967296+r:r}function _t(t,e){let r=Tt(t,e);return r*=Math.pow(2,32),r+=Tt(t,e+4),r}function At(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function Lt(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 wt(t,e){const r=[];if(!e.length)return r;const n=t.byteLength;for(let i=0;i<n;){const s=Tt(t,i),a=s>1?i+s:n;if(St(t.subarray(i+4,i+8))===e[0])if(1===e.length)r.push(t.subarray(i+8,a));else{const n=wt(t.subarray(i+8,a),e.slice(1));n.length&&yt.apply(r,n)}i=a}return r}function Rt(t){const e=[],r=t[0];let n=8;const i=Tt(t,n);n+=4;let s=0,a=0;0===r?(s=Tt(t,n),a=Tt(t,n+4),n+=8):(s=_t(t,n),a=_t(t,n+8),n+=16),n+=2;let o=t.length+a;const l=bt(t,n);n+=2;for(let r=0;r<l;r++){let r=n;const s=Tt(t,r);r+=4;const a=2147483647&s;if(1==(2147483648&s)>>>31)return _.warn("SIDX has hierarchical references (not supported)"),null;const l=Tt(t,r);r+=4,e.push({referenceSize:a,subsegmentDuration:l,info:{duration:l/i,start:o,end:o+a-1}}),o+=a,r+=4,n=r}return{earliestPresentationTime:s,timescale:i,version:r,referencesCount:l,references:e}}function kt(t){const e=[],r=wt(t,["moov","trak"]);for(let t=0;t<r.length;t++){const n=r[t],i=wt(n,["tkhd"])[0];if(i){let t=i[0];const r=Tt(i,0===t?12:20),s=wt(n,["mdia","mdhd"])[0];if(s){t=s[0];const i=Tt(s,0===t?12:20),a=wt(n,["mdia","hdlr"])[0];if(a){const t=St(a.subarray(8,12)),s={soun:I,vide:P}[t];if(s){const t=Dt(wt(n,["mdia","minf","stbl","stsd"])[0]);e[r]={timescale:i,type:s},e[s]=d({timescale:i,id:r},t)}}}}}return wt(t,["moov","mvex","trex"]).forEach((t=>{const r=Tt(t,4),n=e[r];n&&(n.default={duration:Tt(t,12),flags:Tt(t,20)})})),e}function Dt(t){const e=t.subarray(8),r=e.subarray(86),n=St(e.subarray(4,8));let i=n;const s="enca"===n||"encv"===n;if(s){const t=wt(e,[n])[0];wt(t.subarray("enca"===n?28:78),["sinf"]).forEach((t=>{const e=wt(t,["schm"])[0];if(e){const r=St(e.subarray(4,8));if("cbcs"===r||"cenc"===r){const e=wt(t,["frma"])[0];e&&(i=St(e))}}}))}switch(i){case"avc1":case"avc2":case"avc3":case"avc4":{const t=wt(r,["avcC"])[0];i+="."+Pt(t[1])+Pt(t[2])+Pt(t[3]);break}case"mp4a":{const t=wt(e,[n])[0],r=wt(t.subarray(28),["esds"])[0];if(r&&r.length>12){let t=4;if(3!==r[t++])break;t=It(r,t),t+=2;const e=r[t++];if(128&e&&(t+=2),64&e&&(t+=r[t++]),4!==r[t++])break;t=It(r,t);const n=r[t++];if(64!==n)break;if(i+="."+Pt(n),t+=12,5!==r[t++])break;t=It(r,t);const s=r[t++];let a=(248&s)>>3;31===a&&(a+=1+((7&s)<<3)+((224&r[t])>>5)),i+="."+a}break}case"hvc1":case"hev1":{const t=wt(r,["hvcC"])[0],e=t[1],n=["","A","B","C"][e>>6],s=31&e,a=Tt(t,2),o=(32&e)>>5?"H":"L",l=t[12],u=t.subarray(6,12);i+="."+n+s,i+="."+a.toString(16).toUpperCase(),i+="."+o+l;let c="";for(let t=u.length;t--;){const e=u[t];(e||c)&&(c="."+e.toString(16).toUpperCase()+c)}i+=c;break}case"dvh1":case"dvhe":{const t=wt(r,["dvcC"])[0],e=t[2]>>1&127,n=t[2]<<5&32|t[3]>>3&31;i+="."+Ot(e)+"."+Ot(n);break}case"vp09":{const t=wt(r,["vpcC"])[0],e=t[4],n=t[5],s=t[6]>>4&15;i+="."+Ot(e)+"."+Ot(n)+"."+Ot(s);break}case"av01":{const t=wt(r,["av1C"])[0],e=t[1]>>>5,n=31&t[1],s=t[2]>>>7?"H":"M",a=(64&t[2])>>6,o=(32&t[2])>>5,l=2===e&&a?o?12:10:a?10:8,u=(16&t[2])>>4,c=(8&t[2])>>3,h=(4&t[2])>>2,d=3&t[2],f=1,p=1,g=1,v=0;i+="."+e+"."+Ot(n)+s+"."+Ot(l)+"."+u+"."+c+h+d+"."+Ot(f)+"."+Ot(p)+"."+Ot(g)+"."+v;break}}return{codec:i,encrypted:s}}function It(t,e){const r=e+5;for(;128&t[e++]&&e<r;);return e}function Pt(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function Ot(t){return(t<10?"0":"")+t}function Ct(t){const e=wt(t,["schm"])[0];if(e){const r=St(e.subarray(4,8));if("cbcs"===r||"cenc"===r)return wt(t,["schi","tenc"])[0]}return null}function xt(t){const e=Tt(t,0);let r=8;1&e&&(r+=4),4&e&&(r+=4);let n=0;const i=Tt(t,4);for(let s=0;s<i;s++)256&e&&(n+=Tt(t,r),r+=4),512&e&&(r+=4),1024&e&&(r+=4),2048&e&&(r+=4);return n}function Mt(t,e){const r=new Uint8Array(t.length+e.length);return r.set(t),r.set(e,t.length),r}function Ft(t,e){const r=[],n=e.samples,i=e.timescale,s=e.id;let a=!1;return wt(n,["moof"]).map((o=>{const l=o.byteOffset-8;wt(o,["traf"]).map((o=>{const u=wt(o,["tfdt"]).map((t=>{const e=t[0];let r=Tt(t,4);return 1===e&&(r*=Math.pow(2,32),r+=Tt(t,8)),r/i}))[0];return void 0!==u&&(t=u),wt(o,["tfhd"]).map((u=>{const c=Tt(u,4),h=16777215&Tt(u,0);let d=0;const f=0!=(16&h);let p=0;const g=0!=(32&h);let v=8;c===s&&(0!=(1&h)&&(v+=8),0!=(2&h)&&(v+=4),0!=(8&h)&&(d=Tt(u,v),v+=4),f&&(p=Tt(u,v),v+=4),g&&(v+=4),"video"===e.type&&(a=function(t){if(!t)return!1;const e=t.indexOf("."),r=e<0?t:t.substring(0,e);return"hvc1"===r||"hev1"===r||"dvh1"===r||"dvhe"===r}(e.codec)),wt(o,["trun"]).map((s=>{const o=s[0],u=16777215&Tt(s,0),c=0!=(1&u);let h=0;const f=0!=(4&u),g=0!=(256&u);let v=0;const m=0!=(512&u);let y=0;const E=0!=(1024&u),S=0!=(2048&u);let b=0;const T=Tt(s,4);let _=8;c&&(h=Tt(s,_),_+=4),f&&(_+=4);let A=h+l;for(let l=0;l<T;l++){if(g?(v=Tt(s,_),_+=4):v=d,m?(y=Tt(s,_),_+=4):y=p,E&&(_+=4),S&&(b=0===o?Tt(s,_):At(s,_),_+=4),e.type===P){let e=0;for(;e<y;){const s=Tt(n,A);A+=4,Nt(a,n[A])&&Bt(n.subarray(A,A+s),a?2:1,t+b/i,r),A+=s,e+=s+4}}t+=v/i}})))}))}))})),r}function Nt(t,e){if(t){const t=e>>1&63;return 39===t||40===t}return 6==(31&e)}function Bt(t,e,r,n){const i=Ut(t);let s=0;s+=e;let a=0,o=0,l=0;for(;s<i.length;){a=0;do{if(s>=i.length)break;l=i[s++],a+=l}while(255===l);o=0;do{if(s>=i.length)break;l=i[s++],o+=l}while(255===l);const t=i.length-s;let e=s;if(o<t)s+=o;else if(o>t){_.error(`Malformed SEI payload. ${o} is too small, only ${t} bytes left to parse.`);break}if(4===a){if(181===i[e++]){const t=bt(i,e);if(e+=2,49===t){const t=Tt(i,e);if(e+=4,1195456820===t){const t=i[e++];if(3===t){const s=i[e++],o=64&s,l=o?2+3*(31&s):0,u=new Uint8Array(l);if(o){u[0]=s;for(let t=1;t<l;t++)u[t]=i[e++]}n.push({type:t,payloadType:a,pts:r,bytes:u})}}}}}else if(5===a&&o>16){const t=[];for(let r=0;r<16;r++){const n=i[e++].toString(16);t.push(1==n.length?"0"+n:n),3!==r&&5!==r&&7!==r&&9!==r||t.push("-")}const s=o-16,l=new Uint8Array(s);for(let t=0;t<s;t++)l[t]=i[e++];n.push({payloadType:a,pts:r,uuid:t.join(""),userData:ft(l),userDataBytes:l})}}}function Ut(t){const e=t.byteLength,r=[];let n=1;for(;n<e-2;)0===t[n]&&0===t[n+1]&&3===t[n+2]?(r.push(n+2),n+=2):n++;if(0===r.length)return t;const i=e-r.length,s=new Uint8Array(i);let a=0;for(n=0;n<i;a++,n++)a===r[0]&&(a++,r.shift()),s[n]=t[a];return s}function jt(t){const e=t.getUint32(0),r=t.byteOffset,n=t.byteLength;if(n<e)return{offset:r,size:n};if(1886614376!==t.getUint32(4))return{offset:r,size:e};const i=t.getUint32(8)>>>24;if(0!==i&&1!==i)return{offset:r,size:e};const s=t.buffer,a=vt(new Uint8Array(s,r+12,16)),o=t.getUint32(28);let l=null,u=null;if(0===i){if(e-32<o||o<22)return{offset:r,size:e};u=new Uint8Array(s,r+32,o)}else if(1===i){if(!o||n<r+32+16*o+16)return{offset:r,size:e};l=[];for(let t=0;t<o;t++)l.push(new Uint8Array(s,r+32+16*t,16))}return{version:i,systemId:a,kids:l,data:u,offset:r,size:e}}let Ht={};class Gt{static clearKeyUriToKeyIdMap(){Ht={}}constructor(t,e,r,n=[1],i=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=n,this.iv=i,this.encrypted=!!t&&"NONE"!==t,this.isCommonEncryption=this.encrypted&&"AES-128"!==t}isSupported(){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 G:case K:case V:case H:return-1!==["ISO-23001-7","SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)}}return!1}getDecryptData(t){if(!this.encrypted||!this.uri)return null;if("AES-128"===this.method&&this.uri&&!this.iv){"number"!=typeof t&&("AES-128"!==this.method||this.iv||_.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),t=0);const e=function(t){const e=new Uint8Array(16);for(let r=12;r<16;r++)e[r]=t>>8*(15-r)&255;return e}(t);return new Gt(this.method,this.uri,"identity",this.keyFormatVersions,e)}const e=function(t){const e=t.split(":");let r=null;if("data"===e[0]&&2===e.length){const t=e[1].split(";"),n=t[t.length-1].split(",");if(2===n.length){const e="base64"===n[0],i=n[1];e?(t.splice(-1,1),r=N(i)):r=function(t){const e=B(t).subarray(0,16),r=new Uint8Array(16);return r.set(e,16-e.length),r}(i)}}return r}(this.uri);if(e)switch(this.keyFormat){case K:this.pssh=e,e.length>=22&&(this.keyId=e.subarray(e.length-22,e.length-6));break;case V:{const t=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=function(t,e,r){if(16!==t.byteLength)throw new RangeError("Invalid system id");let n,i,s;if(e){n=1,i=new Uint8Array(16*e.length);for(let t=0;t<e.length;t++){const r=e[t];if(16!==r.byteLength)throw new RangeError("Invalid key");i.set(r,16*t)}}else n=0,i=new Uint8Array;n>0?(s=new Uint8Array(4),e.length>0&&new DataView(s.buffer).setUint32(0,e.length,!1)):s=new Uint8Array;const a=new Uint8Array(4);return r&&r.byteLength>0&&new DataView(a.buffer).setUint32(0,r.byteLength,!1),function(t,...e){const r=e.length;let n=8,i=r;for(;i--;)n+=e[i].byteLength;const s=new Uint8Array(n);for(s[0]=n>>24&255,s[1]=n>>16&255,s[2]=n>>8&255,s[3]=255&n,s.set(t,4),i=0,n=8;i<r;i++)s.set(e[i],n),n+=e[i].byteLength;return s}([112,115,115,104],new Uint8Array([n,0,0,0]),t,s,i,a,r||new Uint8Array)}(t,null,e);const r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),n=String.fromCharCode.apply(null,Array.from(r)),i=n.substring(n.indexOf("<"),n.length),s=(new DOMParser).parseFromString(i,"text/xml").getElementsByTagName("KID")[0];if(s){const t=s.childNodes[0]?s.childNodes[0].nodeValue:s.getAttribute("VALUE");if(t){const e=N(t).subarray(0,16);!function(t){const e=function(t,e,r){const n=t[e];t[e]=t[r],t[r]=n};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}(e),this.keyId=e}}break}default:{let t=e.subarray(0,16);if(16!==t.length){const e=new Uint8Array(16);e.set(t,16-t.length),t=e}this.keyId=t;break}}if(!this.keyId||16!==this.keyId.byteLength){let t=Ht[this.uri];if(!t){const e=Object.keys(Ht).length%Number.MAX_SAFE_INTEGER;t=new Uint8Array(16),new DataView(t.buffer,12,4).setUint32(0,e),Ht[this.uri]=t}this.keyId=t}return this}}const Vt=/\{\$([a-zA-Z0-9-_]+)\}/g;function Kt(t){return Vt.test(t)}function $t(t,e,r){if(null!==t.variableList||t.hasVariableRefs)for(let n=r.length;n--;){const i=r[n],s=e[i];s&&(e[i]=Wt(t,s))}}function Wt(t,e){if(null!==t.variableList||t.hasVariableRefs){const r=t.variableList;return e.replace(Vt,(e=>{const n=e.substring(2,e.length-1),i=null==r?void 0:r[n];return void 0===i?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${n}"`)),e):i}))}return e}function qt(t,e,r){let n,i,s=t.variableList;if(s||(t.variableList=s={}),"QUERYPARAM"in e){n=e.QUERYPARAM;try{const t=new self.URL(r).searchParams;if(!t.has(n))throw new Error(`"${n}" does not match any query parameter in URI: "${r}"`);i=t.get(n)}catch(e){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${e.message}`))}}else n=e.NAME,i=e.VALUE;n in s?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${n}"`)):s[n]=i||""}function Yt(t,e,r){const n=e.IMPORT;if(r&&n in r){let e=t.variableList;e||(t.variableList=e={}),e[n]=r[n]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${n}"`))}function zt(t=!0){if("undefined"!=typeof self)return(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}const Xt={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function Jt(t,e,r=!0){return!t.split(",").some((t=>!Qt(t,e,r)))}function Qt(t,e,r=!0){var n;const i=zt(r);return null!=(n=null==i?void 0:i.isTypeSupported(Zt(t,e)))&&n}function Zt(t,e){return`${e}/mp4;codecs="${t}"`}function te(t){if(t){const e=t.substring(0,4);return Xt.video[e]}return 2}function ee(t){return t.split(",").reduce(((t,e)=>{const r=Xt.video[e];return r?(2*r+t)/(t?3:2):(Xt.audio[e]+t)/(t?2:1)}),0)}const re={},ne=/flac|opus/i;function ie(t,e=!0){return t.replace(ne,(t=>function(t,e=!0){if(re[t])return re[t];const r={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"]}[t];for(let n=0;n<r.length;n++)if(Qt(r[n],"audio",e))return re[t]=r[n],r[n];return t}(t.toLowerCase(),e)))}function se(t,e){return t&&"mp4a"!==t?t:e?e.split(",")[0]:e}const ae=/#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,oe=/#EXT-X-MEDIA:(.*)/g,le=/^#EXT(?:INF|-X-TARGETDURATION):/m,ue=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#EXT-X-BYTERANGE:*(.+)/.source,/#EXT-X-PROGRAM-DATE-TIME:(.+)/.source,/#.*/.source].join("|"),"g"),ce=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|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class he{static findGroup(t,e){for(let r=0;r<t.length;r++){const n=t[r];if(n.id===e)return n}}static resolve(t,e){return c.buildAbsoluteURL(e,t,{alwaysNormalize:!0})}static isMediaPlaylist(t){return le.test(t)}static parseMasterPlaylist(t,e){const r={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:Kt(t)},n=[];let i;for(ae.lastIndex=0;null!=(i=ae.exec(t));)if(i[1]){var s;const t=new w(i[1]);$t(r,t,["CODECS","SUPPLEMENTAL-CODECS","ALLOWED-CPC","PATHWAY-ID","STABLE-VARIANT-ID","AUDIO","VIDEO","SUBTITLES","CLOSED-CAPTIONS","NAME"]);const a=Wt(r,i[2]),o={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:he.resolve(a,e)},l=t.decimalResolution("RESOLUTION");l&&(o.width=l.width,o.height=l.height),pe(t.CODECS,o),null!=(s=o.unknownCodecs)&&s.length||n.push(o),r.levels.push(o)}else if(i[3]){const t=i[3],n=i[4];switch(t){case"SESSION-DATA":{const t=new w(n);$t(r,t,["DATA-ID","LANGUAGE","VALUE","URI"]);const e=t["DATA-ID"];e&&(null===r.sessionData&&(r.sessionData={}),r.sessionData[e]=t);break}case"SESSION-KEY":{const t=de(n,e,r);t.encrypted&&t.isSupported()?(null===r.sessionKeys&&(r.sessionKeys=[]),r.sessionKeys.push(t)):_.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${n}"`);break}case"DEFINE":{const t=new w(n);$t(r,t,["NAME","VALUE","QUERYPARAM"]),qt(r,t,e)}break;case"CONTENT-STEERING":{const t=new w(n);$t(r,t,["SERVER-URI","PATHWAY-ID"]),r.contentSteering={uri:he.resolve(t["SERVER-URI"],e),pathwayId:t["PATHWAY-ID"]||"."};break}case"START":r.startTimeOffset=fe(n)}}const a=n.length>0&&n.length<r.levels.length;return r.levels=a?n:r.levels,0===r.levels.length&&(r.playlistParsingError=new Error("no levels found in manifest")),r}static parseMasterPlaylistMedia(t,e,r){let n;const i={},s=r.levels,a={AUDIO:s.map((t=>({id:t.attrs.AUDIO,audioCodec:t.audioCodec}))),SUBTITLES:s.map((t=>({id:t.attrs.SUBTITLES,textCodec:t.textCodec}))),"CLOSED-CAPTIONS":[]};let o=0;for(oe.lastIndex=0;null!==(n=oe.exec(t));){const t=new w(n[1]),s=t.TYPE;if(s){const n=a[s],l=i[s]||[];i[s]=l,$t(r,t,["URI","GROUP-ID","LANGUAGE","ASSOC-LANGUAGE","STABLE-RENDITION-ID","NAME","INSTREAM-ID","CHARACTERISTICS","CHANNELS"]);const u=t.LANGUAGE,c=t["ASSOC-LANGUAGE"],h=t.CHANNELS,d=t.CHARACTERISTICS,f=t["INSTREAM-ID"],p={attrs:t,bitrate:0,id:o++,groupId:t["GROUP-ID"]||"",name:t.NAME||u||"",type:s,default:t.bool("DEFAULT"),autoselect:t.bool("AUTOSELECT"),forced:t.bool("FORCED"),lang:u,url:t.URI?he.resolve(t.URI,e):""};if(c&&(p.assocLang=c),h&&(p.channels=h),d&&(p.characteristics=d),f&&(p.instreamId=f),null!=n&&n.length){const t=he.findGroup(n,p.groupId)||n[0];ge(p,t,"audioCodec"),ge(p,t,"textCodec")}l.push(p)}}return i}static parseLevelPlaylist(t,e,r,n,i,s){const a=new F(e),o=a.fragments;let l,u,c,h=null,d=0,g=0,v=0,m=0,y=null,E=new x(n,e),S=-1,b=!1,T=null;for(ue.lastIndex=0,a.m3u8=t,a.hasVariableRefs=Kt(t);null!==(l=ue.exec(t));){b&&(b=!1,E=new x(n,e),E.start=v,E.sn=d,E.cc=m,E.level=r,h&&(E.initSegment=h,E.rawProgramDateTime=h.rawProgramDateTime,h.rawProgramDateTime=null,T&&(E.setByteRange(T),T=null)));const t=l[1];if(t){E.duration=parseFloat(t);const e=(" "+l[2]).slice(1);E.title=e||null,E.tagList.push(e?["INF",t,e]:["INF",t])}else if(l[3]){if(p(E.duration)){E.start=v,c&&ye(E,c,a),E.sn=d,E.level=r,E.cc=m,o.push(E);const t=(" "+l[3]).slice(1);E.relurl=Wt(a,t),ve(E,y),y=E,v+=E.duration,d++,g=0,b=!0}}else if(l[4]){const t=(" "+l[4]).slice(1);y?E.setByteRange(t,y):E.setByteRange(t)}else if(l[5])E.rawProgramDateTime=(" "+l[5]).slice(1),E.tagList.push(["PROGRAM-DATE-TIME",E.rawProgramDateTime]),-1===S&&(S=o.length);else{if(l=l[0].match(ce),!l){_.warn("No matches on slow regex match for level playlist!");continue}for(u=1;u<l.length&&void 0===l[u];u++);const t=(" "+l[u]).slice(1),i=(" "+l[u+1]).slice(1),v=l[u+2]?(" "+l[u+2]).slice(1):"";switch(t){case"PLAYLIST-TYPE":a.type=i.toUpperCase();break;case"MEDIA-SEQUENCE":d=a.startSN=parseInt(i);break;case"SKIP":{const t=new w(i);$t(a,t,["RECENTLY-REMOVED-DATERANGES"]);const e=t.decimalInteger("SKIPPED-SEGMENTS");if(p(e)){a.skippedSegments=e;for(let t=e;t--;)o.unshift(null);d+=e}const r=t.enumeratedString("RECENTLY-REMOVED-DATERANGES");r&&(a.recentlyRemovedDateranges=r.split("\t"));break}case"TARGETDURATION":a.targetduration=Math.max(parseInt(i),1);break;case"VERSION":a.version=parseInt(i);break;case"INDEPENDENT-SEGMENTS":case"EXTM3U":break;case"ENDLIST":a.live=!1;break;case"#":(i||v)&&E.tagList.push(v?[i,v]:[i]);break;case"DISCONTINUITY":m++,E.tagList.push(["DIS"]);break;case"GAP":E.gap=!0,E.tagList.push([t]);break;case"BITRATE":E.tagList.push([t,i]);break;case"DATERANGE":{const t=new w(i);$t(a,t,["ID","CLASS","START-DATE","END-DATE","SCTE35-CMD","SCTE35-OUT","SCTE35-IN"]),$t(a,t,t.clientAttrs);const e=new k(t,a.dateRanges[t.ID]);e.isValid||a.skippedSegments?a.dateRanges[e.id]=e:_.warn(`Ignoring invalid DATERANGE tag: "${i}"`),E.tagList.push(["EXT-X-DATERANGE",i]);break}case"DEFINE":{const t=new w(i);$t(a,t,["NAME","VALUE","IMPORT","QUERYPARAM"]),"IMPORT"in t?Yt(a,t,s):qt(a,t,e)}break;case"DISCONTINUITY-SEQUENCE":m=parseInt(i);break;case"KEY":{const t=de(i,e,a);if(t.isSupported()){if("NONE"===t.method){c=void 0;break}c||(c={}),c[t.keyFormat]&&(c=f({},c)),c[t.keyFormat]=t}else _.warn(`[Keys] Ignoring invalid EXT-X-KEY tag: "${i}"`);break}case"START":a.startTimeOffset=fe(i);break;case"MAP":{const t=new w(i);if($t(a,t,["BYTERANGE","URI"]),E.duration){const i=new x(n,e);me(i,t,r,c),h=i,E.initSegment=h,h.rawProgramDateTime&&!E.rawProgramDateTime&&(E.rawProgramDateTime=h.rawProgramDateTime)}else{const e=E.byteRangeEndOffset;if(e){const t=E.byteRangeStartOffset;T=`${e-t}@${t}`}else T=null;me(E,t,r,c),h=E,b=!0}break}case"SERVER-CONTROL":{const t=new w(i);a.canBlockReload=t.bool("CAN-BLOCK-RELOAD"),a.canSkipUntil=t.optionalFloat("CAN-SKIP-UNTIL",0),a.canSkipDateRanges=a.canSkipUntil>0&&t.bool("CAN-SKIP-DATERANGES"),a.partHoldBack=t.optionalFloat("PART-HOLD-BACK",0),a.holdBack=t.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{const t=new w(i);a.partTarget=t.decimalFloatingPoint("PART-TARGET");break}case"PART":{let t=a.partList;t||(t=a.partList=[]);const r=g>0?t[t.length-1]:void 0,n=g++,s=new w(i);$t(a,s,["BYTERANGE","URI"]);const o=new M(s,E,e,n,r);t.push(o),E.duration+=o.duration;break}case"PRELOAD-HINT":{const t=new w(i);$t(a,t,["URI"]),a.preloadHint=t;break}case"RENDITION-REPORT":{const t=new w(i);$t(a,t,["URI"]),a.renditionReports=a.renditionReports||[],a.renditionReports.push(t);break}default:_.warn(`line parsed but not handled: ${l}`)}}}y&&!y.relurl?(o.pop(),v-=y.duration,a.partList&&(a.fragmentHint=y)):a.partList&&(ve(E,y),E.cc=m,a.fragmentHint=E,c&&ye(E,c,a));const A=o.length,L=o[0],R=o[A-1];if(v+=a.skippedSegments*a.targetduration,v>0&&A&&R){a.averagetargetduration=v/A;const t=R.sn;a.endSN="initSegment"!==t?t:0,a.live||(R.endList=!0),L&&(a.startCC=L.cc)}else a.endSN=0,a.startCC=0;return a.fragmentHint&&(v+=a.fragmentHint.duration),a.totalduration=v,a.endCC=m,S>0&&function(t,e){let r=t[e];for(let n=e;n--;){const e=t[n];if(!e)return;e.programDateTime=r.programDateTime-1e3*e.duration,r=e}}(o,S),a}}function de(t,e,r){var n,i;const s=new w(t);$t(r,s,["KEYFORMAT","KEYFORMATVERSIONS","URI","IV","URI"]);const a=null!=(n=s.METHOD)?n:"",o=s.URI,l=s.hexadecimalInteger("IV"),u=s.KEYFORMATVERSIONS,c=null!=(i=s.KEYFORMAT)?i:"identity";o&&s.IV&&!l&&_.error(`Invalid IV: ${s.IV}`);const h=o?he.resolve(o,e):"",d=(u||"1").split("/").map(Number).filter(Number.isFinite);return new Gt(a,h,c,d,l)}function fe(t){const e=new w(t).decimalFloatingPoint("TIME-OFFSET");return p(e)?e:null}function pe(t,e){let r=(t||"").split(/[ ,]+/).filter((t=>t));["video","audio","text"].forEach((t=>{const n=r.filter((e=>function(t,e){const r=Xt[e];return!!r&&!!r[t.slice(0,4)]}(e,t)));n.length&&(e[`${t}Codec`]=n.join(","),r=r.filter((t=>-1===n.indexOf(t))))})),e.unknownCodecs=r}function ge(t,e,r){const n=e[r];n&&(t[r]=n)}function ve(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),p(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function me(t,e,r,n){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=r,t.sn="initSegment",n&&(t.levelkeys=n),t.initSegment=null}function ye(t,e,r){t.levelkeys=e;const{encryptedFragments:n}=r;n.length&&n[n.length-1].levelkeys===e||!Object.keys(e).some((t=>e[t].isCommonEncryption))||n.push(t)}var Ee="manifest",Se="level",be="audioTrack",Te="subtitleTrack",_e="main",Ae="audio",Le="subtitle";function we(t){const{type:e}=t;switch(e){case be:return Ae;case Te:return Le;default:return _e}}function Re(t,e){let r=t.url;return void 0!==r&&0!==r.indexOf("data:")||(r=e.url),r}class ke{constructor(t){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.hls=t,this.registerListeners()}startLoad(t){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:t}=this;t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.LEVEL_LOADING,this.onLevelLoading,this),t.on(m.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(m.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}unregisterListeners(){const{hls:t}=this;t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.LEVEL_LOADING,this.onLevelLoading,this),t.off(m.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(m.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)}createInternalLoader(t){const e=this.hls.config,r=e.pLoader,n=e.loader,i=new(r||n)(e);return this.loaders[t.type]=i,i}getInternalLoader(t){return this.loaders[t.type]}resetInternalLoader(t){this.loaders[t]&&delete this.loaders[t]}destroyInternalLoaders(){for(const t in this.loaders){const e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(t,e){const{url:r}=e;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Ee,url:r,deliveryDirectives:null})}onLevelLoading(t,e){const{id:r,level:n,pathwayId:i,url:s,deliveryDirectives:a}=e;this.load({id:r,level:n,pathwayId:i,responseType:"text",type:Se,url:s,deliveryDirectives:a})}onAudioTrackLoading(t,e){const{id:r,groupId:n,url:i,deliveryDirectives:s}=e;this.load({id:r,groupId:n,level:null,responseType:"text",type:be,url:i,deliveryDirectives:s})}onSubtitleTrackLoading(t,e){const{id:r,groupId:n,url:i,deliveryDirectives:s}=e;this.load({id:r,groupId:n,level:null,responseType:"text",type:Te,url:i,deliveryDirectives:s})}load(t){var e;const r=this.hls.config;let n,i=this.getInternalLoader(t);if(i){const e=i.context;if(e&&e.url===t.url&&e.level===t.level)return void _.trace("[playlist-loader]: playlist request ongoing");_.log(`[playlist-loader]: aborting previous loader for type: ${t.type}`),i.abort()}if(n=t.type===Ee?r.manifestLoadPolicy.default:f({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),i=this.createInternalLoader(t),p(null==(e=t.deliveryDirectives)?void 0:e.part)){let e;if(t.type===Se&&null!==t.level?e=this.hls.levels[t.level].details:t.type===be&&null!==t.id?e=this.hls.audioTracks[t.id].details:t.type===Te&&null!==t.id&&(e=this.hls.subtitleTracks[t.id].details),e){const t=e.partTarget,r=e.targetduration;if(t&&r){const e=1e3*Math.max(3*t,.8*r);n=f({},n,{maxTimeToFirstByteMs:Math.min(e,n.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(e,n.maxTimeToFirstByteMs)})}}}const s=n.errorRetry||n.timeoutRetry||{},a={loadPolicy:n,timeout:n.maxLoadTimeMs,maxRetry:s.maxNumRetry||0,retryDelay:s.retryDelayMs||0,maxRetryDelay:s.maxRetryDelayMs||0},o={onSuccess:(t,e,r,n)=>{const i=this.getInternalLoader(r);this.resetInternalLoader(r.type);const s=t.data;0===s.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),he.isMediaPlaylist(s)?this.handleTrackOrLevelPlaylist(t,e,r,n||null,i):this.handleMasterPlaylist(t,e,r,n)):this.handleManifestParsingError(t,r,new Error("no EXTM3U delimiter"),n||null,e)},onError:(t,e,r,n)=>{this.handleNetworkError(e,r,!1,t,n)},onTimeout:(t,e,r)=>{this.handleNetworkError(e,r,!0,void 0,t)}};i.load(t,a,o)}handleMasterPlaylist(t,e,r,n){const i=this.hls,s=t.data,a=Re(t,r),o=he.parseMasterPlaylist(s,a);if(o.playlistParsingError)return void this.handleManifestParsingError(t,r,o.playlistParsingError,n,e);const{contentSteering:l,levels:u,sessionData:c,sessionKeys:h,startTimeOffset:d,variableList:f}=o;this.variableList=f;const{AUDIO:p=[],SUBTITLES:g,"CLOSED-CAPTIONS":v}=he.parseMasterPlaylistMedia(s,a,o);p.length&&(p.some((t=>!t.url))||!u[0].audioCodec||u[0].attrs.AUDIO||(_.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new w({}),bitrate:0,url:""}))),i.trigger(m.MANIFEST_LOADED,{levels:u,audioTracks:p,subtitles:g,captions:v,contentSteering:l,url:a,stats:e,networkDetails:n,sessionData:c,sessionKeys:h,startTimeOffset:d,variableList:f})}handleTrackOrLevelPlaylist(t,e,r,n,i){const s=this.hls,{id:a,level:o,type:l}=r,u=Re(t,r),c=p(o)?o:p(a)?a:0,h=we(r),d=he.parseLevelPlaylist(t.data,u,c,h,0,this.variableList);if(l===Ee){const t={attrs:new w({}),bitrate:0,details:d,name:"",url:u};s.trigger(m.MANIFEST_LOADED,{levels:[t],audioTracks:[],url:u,stats:e,networkDetails:n,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}e.parsing.end=performance.now(),r.levelDetails=d,this.handlePlaylistLoaded(d,t,e,r,n,i)}handleManifestParsingError(t,e,r,n,i){this.hls.trigger(m.ERROR,{type:y.NETWORK_ERROR,details:E.MANIFEST_PARSING_ERROR,fatal:e.type===Ee,url:t.url,err:r,error:r,reason:r.message,response:t,context:e,networkDetails:n,stats:i})}handleNetworkError(t,e,r=!1,n,i){let s=`A network ${r?"timeout":"error"+(n?" (status "+n.code+")":"")} occurred while loading ${t.type}`;t.type===Se?s+=`: ${t.level} id: ${t.id}`:t.type!==be&&t.type!==Te||(s+=` id: ${t.id} group-id: "${t.groupId}"`);const a=new Error(s);_.warn(`[playlist-loader]: ${s}`);let o=E.UNKNOWN,l=!1;const u=this.getInternalLoader(t);switch(t.type){case Ee:o=r?E.MANIFEST_LOAD_TIMEOUT:E.MANIFEST_LOAD_ERROR,l=!0;break;case Se:o=r?E.LEVEL_LOAD_TIMEOUT:E.LEVEL_LOAD_ERROR,l=!1;break;case be:o=r?E.AUDIO_TRACK_LOAD_TIMEOUT:E.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case Te:o=r?E.SUBTITLE_TRACK_LOAD_TIMEOUT:E.SUBTITLE_LOAD_ERROR,l=!1}u&&this.resetInternalLoader(t.type);const c={type:y.NETWORK_ERROR,details:o,fatal:l,url:t.url,loader:u,context:t,error:a,networkDetails:e,stats:i};if(n){const r=(null==e?void 0:e.url)||t.url;c.response=d({url:r,data:void 0},n)}this.hls.trigger(m.ERROR,c)}handlePlaylistLoaded(t,e,r,n,i,s){const a=this.hls,{type:o,level:l,id:u,groupId:c,deliveryDirectives:h}=n,d=Re(e,n),f=we(n),p="number"==typeof n.level&&f===_e?l:void 0;if(!t.fragments.length){const t=new Error("No Segments found in Playlist");return void a.trigger(m.ERROR,{type:y.NETWORK_ERROR,details:E.LEVEL_EMPTY_ERROR,fatal:!1,url:d,error:t,reason:t.message,response:e,context:n,level:p,parent:f,networkDetails:i,stats:r})}t.targetduration||(t.playlistParsingError=new Error("Missing Target Duration"));const g=t.playlistParsingError;if(g)a.trigger(m.ERROR,{type:y.NETWORK_ERROR,details:E.LEVEL_PARSING_ERROR,fatal:!1,url:d,error:g,reason:g.message,response:e,context:n,level:p,parent:f,networkDetails:i,stats:r});else switch(t.live&&s&&(s.getCacheAge&&(t.ageHeader=s.getCacheAge()||0),s.getCacheAge&&!isNaN(t.ageHeader)||(t.ageHeader=0)),o){case Ee:case Se:a.trigger(m.LEVEL_LOADED,{details:t,level:p||0,id:u||0,stats:r,networkDetails:i,deliveryDirectives:h});break;case be:a.trigger(m.AUDIO_TRACK_LOADED,{details:t,id:u||0,groupId:c||"",stats:r,networkDetails:i,deliveryDirectives:h});break;case Te:a.trigger(m.SUBTITLE_TRACK_LOADED,{details:t,id:u||0,groupId:c||"",stats:r,networkDetails:i,deliveryDirectives:h})}}}function De(t,e){let r;try{r=new Event("addtrack")}catch(t){r=document.createEvent("Event"),r.initEvent("addtrack",!1,!1)}r.track=t,e.dispatchEvent(r)}function Ie(t,e){const 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){_.debug(`[texttrack-utils]: ${r}`);try{const r=new self.TextTrackCue(e.startTime,e.endTime,e.text);r.id=e.id,t.addCue(r)}catch(t){_.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${t}`)}}"disabled"===r&&(t.mode=r)}function Pe(t){const e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(let e=t.cues.length;e--;)t.removeCue(t.cues[e]);"disabled"===e&&(t.mode=e)}function Oe(t,e,r,n){const i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues&&t.cues.length>0){const i=function(t,e,r){const n=[],i=function(t,e){if(e<t[0].startTime)return 0;const r=t.length-1;if(e>t[r].endTime)return-1;let n=0,i=r;for(;n<=i;){const s=Math.floor((i+n)/2);if(e<t[s].startTime)i=s-1;else{if(!(e>t[s].startTime&&n<r))return s;n=s+1}}return t[n].startTime-e<e-t[i].startTime?n:i}(t,e);if(i>-1)for(let s=i,a=t.length;s<a;s++){const i=t[s];if(i.startTime>=e&&i.endTime<=r)n.push(i);else if(i.startTime>r)return n}return n}(t.cues,e,r);for(let e=0;e<i.length;e++)n&&!n(i[e])||t.removeCue(i[e])}"disabled"===i&&(t.mode=i)}function Ce(t){const e=[];for(let r=0;r<t.length;r++){const n=t[r];"subtitles"!==n.kind&&"captions"!==n.kind||!n.label||e.push(t[r])}return e}var xe="org.id3",Me="https://aomedia.org/emsg/ID3";function Fe(){if("undefined"!=typeof self)return self.VTTCue||self.TextTrackCue}function Ne(t,e,r,n,i){let s=new t(e,r,"");try{s.value=n,i&&(s.type=i)}catch(a){s=new t(e,r,JSON.stringify(i?d({type:i},n):n))}return s}const Be=(()=>{const t=Fe();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch(t){return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();function Ue(t,e){return t.getTime()/1e3-e}class je{constructor(t){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=t,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=null}_registerListeners(){const{hls:t}=this;t.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(m.LEVEL_UPDATED,this.onLevelUpdated,this)}_unregisterListeners(){const{hls:t}=this;t.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),t.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(m.LEVEL_UPDATED,this.onLevelUpdated,this)}onMediaAttached(t,e){this.media=e.media}onMediaDetaching(){this.id3Track&&(Pe(this.id3Track),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(t){const e=this.getID3Track(t.textTracks);return e.mode="hidden",e}getID3Track(t){if(this.media){for(let e=0;e<t.length;e++){const r=t[e];if("metadata"===r.kind&&"id3"===r.label)return De(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(t,e){if(!this.media)return;const{hls:{config:{enableEmsgMetadataCues:r,enableID3MetadataCues:n}}}=this;if(!r&&!n)return;const{samples:i}=e;this.id3Track||(this.id3Track=this.createTrack(this.media));const s=Fe();if(s)for(let t=0;t<i.length;t++){const e=i[t].type;if(e===Me&&!r||!n)continue;const a=ot(i[t].data);if(a){const r=i[t].pts;let n=r+i[t].duration;n>Be&&(n=Be),n-r<=0&&(n=r+.25);for(let t=0;t<a.length;t++){const i=a[t];if(!st(i)){this.updateId3CueEnds(r,e);const t=Ne(s,r,n,i,e);t&&this.id3Track.addCue(t)}}}}}updateId3CueEnds(t,e){var r;const n=null==(r=this.id3Track)?void 0:r.cues;if(n)for(let r=n.length;r--;){const i=n[r];i.type===e&&i.startTime<t&&i.endTime===Be&&(i.endTime=t)}}onBufferFlushing(t,{startOffset:e,endOffset:r,type:n}){const{id3Track:i,hls:s}=this;if(!s)return;const{config:{enableEmsgMetadataCues:a,enableID3MetadataCues:o}}=s;if(i&&(a||o)){let t;t="audio"===n?t=>t.type===xe&&o:"video"===n?t=>t.type===Me&&a:t=>t.type===xe&&o||t.type===Me&&a,Oe(i,e,r,t)}}onLevelUpdated(t,{details:e}){if(!this.media||!e.hasProgramDateTime||!this.hls.config.enableDateRangeMetadataCues)return;const{dateRangeCuesAppended:r,id3Track:n}=this,{dateRanges:i}=e,s=Object.keys(i);if(n){const t=Object.keys(r).filter((t=>!s.includes(t)));for(let e=t.length;e--;){const i=t[e];Object.keys(r[i].cues).forEach((t=>{n.removeCue(r[i].cues[t])})),delete r[i]}}const a=e.fragments[e.fragments.length-1];if(0===s.length||!p(null==a?void 0:a.programDateTime))return;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=a.programDateTime/1e3-a.start,l=Fe();for(let t=0;t<s.length;t++){const e=s[t],n=i[e],a=Ue(n.startDate,o),h=r[e],d=(null==h?void 0:h.cues)||{};let f=(null==h?void 0:h.durationKnown)||!1,p=Be;const g=n.endDate;if(g)p=Ue(g,o),f=!0;else if(n.endOnNext&&!f){const t=s.reduce(((t,e)=>{if(e!==n.id){const r=i[e];if(r.class===n.class&&r.startDate>n.startDate&&(!t||n.startDate<t.startDate))return r}return t}),null);t&&(p=Ue(t.startDate,o),f=!0)}const v=Object.keys(n.attr);for(let t=0;t<v.length;t++){const r=v[t];if("ID"===(c=r)||"CLASS"===c||"START-DATE"===c||"DURATION"===c||"END-DATE"===c||"END-ON-NEXT"===c)continue;const i=d[r];if(i)f&&!h.durationKnown&&(i.endTime=p);else if(l){let t=n.attr[r];R(r)&&(u=t,t=Uint8Array.from(u.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer);const i=Ne(l,a,p,{key:r,data:t},"com.apple.quicktime.HLS");i&&(i.id=e,this.id3Track.addCue(i),d[r]=i)}}r[e]={cues:d,dateRange:n,durationKnown:f}}var u,c}}class He{constructor(t){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=()=>this.timeupdate(),this.hls=t,this.config=t.config,this.registerListeners()}get latency(){return this._latency||0}get maxLatency(){const{config:t,levelDetails:e}=this;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}get targetLatency(){const{levelDetails:t}=this;if(null===t)return null;const{holdBack:e,partHoldBack:r,targetduration:n}=t,{liveSyncDuration:i,liveSyncDurationCount:s,lowLatencyMode:a}=this.config,o=this.hls.userConfig;let l=a&&r||e;(o.liveSyncDuration||o.liveSyncDurationCount||0===l)&&(l=void 0!==i?i:s*n);const u=n;return l+Math.min(1*this.stallCount,u)}get liveSyncPosition(){const t=this.estimateLiveEdge(),e=this.targetLatency,r=this.levelDetails;if(null===t||null===e||null===r)return null;const n=r.edge,i=t-e-this.edgeStalled,s=n-r.totalduration,a=n-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(s,i),a)}get drift(){const{levelDetails:t}=this;return null===t?1:t.drift}get edgeStalled(){const{levelDetails:t}=this;if(null===t)return 0;const e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}get forwardBufferLength(){const{media:t,levelDetails:e}=this;if(!t||!e)return 0;const r=t.buffered.length;return(r?t.buffered.end(r-1):e.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.levelDetails=null,this.hls=this.timeupdateHandler=null}registerListeners(){this.hls.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.on(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.on(m.ERROR,this.onError,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),this.hls.off(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),this.hls.off(m.ERROR,this.onError,this)}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("timeupdate",this.timeupdateHandler)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.timeupdateHandler),this.media=null)}onManifestLoading(){this.levelDetails=null,this._latency=null,this.stallCount=0}onLevelUpdated(t,{details:e}){this.levelDetails=e,e.advanced&&this.timeupdate(),!e.live&&this.media&&this.media.removeEventListener("timeupdate",this.timeupdateHandler)}onError(t,e){var r;e.details===E.BUFFER_STALLED_ERROR&&(this.stallCount++,null!=(r=this.levelDetails)&&r.live&&_.warn("[playback-rate-controller]: Stall detected, adjusting target latency"))}timeupdate(){const{media:t,levelDetails:e}=this;if(!t||!e)return;this.currentTime=t.currentTime;const r=this.computeLatency();if(null===r)return;this._latency=r;const{lowLatencyMode:n,maxLiveSyncPlaybackRate:i}=this.config;if(!n||1===i||!e.live)return;const s=this.targetLatency;if(null===s)return;const a=r-s;if(a<Math.min(this.maxLatency,s+e.targetduration)&&a>.05&&this.forwardBufferLength>1){const e=Math.min(2,Math.max(1,i)),r=Math.round(2/(1+Math.exp(-.75*a-this.edgeStalled))*20)/20;t.playbackRate=Math.min(e,Math.max(1,r))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}estimateLiveEdge(){const{levelDetails:t}=this;return null===t?null:t.edge+t.age}computeLatency(){const t=this.estimateLiveEdge();return null===t?null:t-this.currentTime}}const Ge=["NONE","TYPE-0","TYPE-1",null],Ve=["SDR","PQ","HLG"];function Ke(t){const{canSkipUntil:e,canSkipDateRanges:r,age:n}=t;return e&&n<e/2?r?"v2":"YES":""}class $e{constructor(t,e,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=t,this.part=e,this.skip=r}addDirectives(t){const 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}}class We{constructor(t){this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[t.url],this._attrs=[t.attrs],this.bitrate=t.bitrate,t.details&&(this.details=t.details),this.id=t.id||0,this.name=t.name,this.width=t.width||0,this.height=t.height||0,this.frameRate=t.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=t.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=t.audioCodec,this.videoCodec=t.videoCodec,this.codecSet=[t.videoCodec,t.audioCodec].filter((t=>!!t)).map((t=>t.substring(0,4))).join(","),this.addGroupId("audio",t.attrs.AUDIO),this.addGroupId("text",t.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(t){return qe(this._audioGroups,t)}hasSubtitleGroup(t){return qe(this._subtitleGroups,t)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(t,e){if(e)if("audio"===t){let t=this._audioGroups;t||(t=this._audioGroups=[]),-1===t.indexOf(e)&&t.push(e)}else if("text"===t){let t=this._subtitleGroups;t||(t=this._subtitleGroups=[]),-1===t.indexOf(e)&&t.push(e)}}get urlId(){return 0}set urlId(t){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var t;return null==(t=this.audioGroups)?void 0:t[0]}get textGroupId(){var t;return null==(t=this.subtitleGroups)?void 0:t[0]}addFallback(){}}function qe(t,e){return!(!e||!t)&&-1!==t.indexOf(e)}function Ye(t,e){const r=e.startPTS;if(p(r)){let n,i=0;e.sn>t.sn?(i=r-t.start,n=t):(i=t.start-r,n=e),n.duration!==i&&(n.duration=i)}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 ze(t,e,r,n,i,s){n-r<=0&&(_.warn("Fragment should have a positive duration",e),n=r+e.duration,s=i+e.duration);let a=r,o=n;const l=e.startPTS,u=e.endPTS;if(p(l)){const t=Math.abs(l-r);p(e.deltaPTS)?e.deltaPTS=Math.max(t,e.deltaPTS):e.deltaPTS=t,a=Math.max(r,l),r=Math.min(r,l),i=Math.min(i,e.startDTS),o=Math.min(n,u),n=Math.max(n,u),s=Math.max(s,e.endDTS)}const c=r-e.start;0!==e.start&&(e.start=r),e.duration=n-e.start,e.startPTS=r,e.maxStartPTS=a,e.startDTS=i,e.endPTS=n,e.minEndPTS=o,e.endDTS=s;const h=e.sn;if(!t||h<t.startSN||h>t.endSN)return 0;let d;const f=h-t.startSN,g=t.fragments;for(g[f]=e,d=f;d>0;d--)Ye(g[d],g[d-1]);for(d=f;d<g.length-1;d++)Ye(g[d],g[d+1]);return t.fragmentHint&&Ye(g[g.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,c}function Xe(t,e){const r=e.startSN+e.skippedSegments-t.startSN,n=t.fragments;r<0||r>=n.length||Je(e,n[r].start)}function Je(t,e){if(e){const r=t.fragments;for(let n=t.skippedSegments;n<r.length;n++)r[n].start+=e;t.fragmentHint&&(t.fragmentHint.start+=e)}}function Qe(t,e,r){var n;return null!=t&&t.details?Ze(null==(n=t.details)?void 0:n.partList,e,r):null}function Ze(t,e,r){if(t)for(let n=t.length;n--;){const i=t[n];if(i.index===r&&i.fragment.sn===e)return i}return null}function tr(t){t.forEach(((t,e)=>{const{details:r}=t;null!=r&&r.fragments&&r.fragments.forEach((t=>{t.level=e}))}))}function er(t){switch(t.details){case E.FRAG_LOAD_TIMEOUT:case E.KEY_LOAD_TIMEOUT:case E.LEVEL_LOAD_TIMEOUT:case E.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function rr(t,e){const r=er(e);return t.default[(r?"timeout":"error")+"Retry"]}function nr(t,e){const r="linear"===t.backoff?1:Math.pow(2,e);return Math.min(r*t.retryDelayMs,t.maxRetryDelayMs)}function ir(t){return d(d({},t),{errorRetry:null,timeoutRetry:null})}function sr(t,e,r,n){if(!t)return!1;const i=null==n?void 0:n.code,s=e<t.maxNumRetry&&(function(t){return 0===t&&!1===navigator.onLine||!!t&&(t<400||t>499)}(i)||!!r);return t.shouldRetry?t.shouldRetry(t,e,r,n,s):s}const ar=function(t,e){let r=0,n=t.length-1,i=null,s=null;for(;r<=n;){i=(r+n)/2|0,s=t[i];const a=e(s);if(a>0)r=i+1;else{if(!(a<0))return s;n=i-1}}return null};function or(t,e,r=0,n=0,i=.005){let s=null;if(t){s=e[t.sn-e[0].sn+1]||null;const n=t.endDTS-r;n>0&&n<15e-7&&(r+=15e-7)}else 0===r&&0===e[0].start&&(s=e[0]);if(s&&((!t||t.level===s.level)&&0===lr(r,n,s)||function(t,e,r){if(e&&0===e.start&&e.level<t.level&&(e.endPTS||0)>0){const n=e.tagList.reduce(((t,e)=>("INF"===e[0]&&(t+=parseFloat(e[1])),t)),r);return t.start<=n}return!1}(s,t,Math.min(i,n))))return s;const a=ar(e,lr.bind(null,r,n));return!a||a===t&&s?s:a}function lr(t=0,e=0,r){if(r.start<=t&&r.start+r.duration>t)return 0;const n=Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return r.start+r.duration-n<=t?1:r.start-n>t&&r.start?-1:0}function ur(t,e,r){const n=1e3*Math.min(e,r.duration+(r.deltaPTS?r.deltaPTS:0));return(r.endProgramDateTime||0)-n>t}class cr{constructor(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=_.log.bind(_,`${e}:`),this.warn=_.warn.bind(_,`${e}:`),this.hls=t}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){-1!==this.timer&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.requestScheduled=-1,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(t,e,r){const n=null==e?void 0:e.renditionReports;if(n){let i=-1;for(let r=0;r<n.length;r++){const s=n[r];let a;try{a=new self.URL(s.URI,e.url).href}catch(t){_.warn(`Could not construct new URL for Rendition Report: ${t}`),a=s.URI||""}if(a===t){i=r;break}a===t.substring(0,a.length)&&(i=r)}if(-1!==i){const t=n[i],s=parseInt(t["LAST-MSN"])||(null==e?void 0:e.lastPartSn);let a=parseInt(t["LAST-PART"])||(null==e?void 0:e.lastPartIndex);if(this.hls.config.lowLatencyMode){const t=Math.min(e.age-e.partTarget,e.targetduration);a>=0&&t>e.partTarget&&(a+=1)}const o=r&&Ke(r);return new $e(s,a>=0?a:void 0,o)}}}loadPlaylist(t){-1===this.requestScheduled&&(this.requestScheduled=self.performance.now())}shouldLoadPlaylist(t){return this.canLoad&&!!t&&!!t.url&&(!t.details||t.details.live)}shouldReloadPlaylist(t){return-1===this.timer&&-1===this.requestScheduled&&this.shouldLoadPlaylist(t)}playlistLoaded(t,e,r){const{details:n,stats:i}=e,s=self.performance.now(),a=i.loading.first?Math.max(0,s-i.loading.first):0;if(n.advancedDateTime=Date.now()-a,n.live||null!=r&&r.live){if(n.reloaded(r),r&&this.log(`live playlist ${t} ${n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:n.updated?"UPDATED":"MISSED"}`),r&&n.fragments.length>0&&function(t,e){let r=null;const n=t.fragments;for(let t=n.length-1;t>=0;t--){const e=n[t].initSegment;if(e){r=e;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let i,s=0;if(function(t,e,r){const n=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,s=(t.fragmentHint?1:0)+(n?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,a=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let t=i;t<=s;t++){const i=l[a+t];let s=o[t];n&&!s&&t<n&&(s=e.fragments[t]=i),i&&s&&r(i,s)}}(t,e,((t,n)=>{t.relurl&&(s=t.cc-n.cc),p(t.startPTS)&&p(t.endPTS)&&(n.start=n.startPTS=t.startPTS,n.startDTS=t.startDTS,n.maxStartPTS=t.maxStartPTS,n.endPTS=t.endPTS,n.endDTS=t.endDTS,n.minEndPTS=t.minEndPTS,n.duration=t.endPTS-t.startPTS,n.duration&&(i=n),e.PTSKnown=e.alignedSliding=!0),n.elementaryStreams=t.elementaryStreams,n.loader=t.loader,n.stats=t.stats,t.initSegment&&(n.initSegment=t.initSegment,r=t.initSegment)})),r&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((t=>{var e;!t||t.initSegment&&t.initSegment.relurl!==(null==(e=r)?void 0:e.relurl)||(t.initSegment=r)})),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some((t=>!t)),e.deltaUpdateFailed){_.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let t=e.skippedSegments;t--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=function(t,e,r){const n=f({},t);return r&&r.forEach((t=>{delete n[t]})),Object.keys(e).forEach((t=>{const r=new k(e[t].attr,n[t]);r.isValid?n[t]=r:_.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${JSON.stringify(e[t].attr)}"`)})),n}(t.dateRanges,e.dateRanges,e.recentlyRemovedDateranges));const a=e.fragments;if(s){_.warn("discontinuity sliding from playlist, take drift into account");for(let t=0;t<a.length;t++)a[t].cc+=s}e.skippedSegments&&(e.startCC=e.fragments[0].cc),function(t,e,r){if(t&&e){let n=0;for(let i=0,s=t.length;i<=s;i++){const s=t[i],a=e[i+n];s&&a&&s.index===a.index&&s.fragment.sn===a.fragment.sn?r(s,a):n--}}}(t.partList,e.partList,((t,e)=>{e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),i?ze(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS):Xe(t,e),a.length&&(e.totalduration=e.edge-a[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const o=e.advancedDateTime;if(e.advanced&&o){const t=e.edge;e.driftStart||(e.driftStartTime=o,e.driftStart=t),e.driftEndTime=o,e.driftEnd=t}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}(r,n),!this.canLoad||!n.live)return;let a,o,l;if(n.canBlockReload&&n.endSN&&n.advanced){const t=this.hls.config.lowLatencyMode,i=n.lastPartSn,s=n.endSN,u=n.lastPartIndex,c=i===s;-1!==u?(o=c?s+1:i,l=c?t?0:u:u+1):o=s+1;const h=n.age,d=h+n.ageHeader;let f=Math.min(d-n.partTarget,1.5*n.targetduration);if(f>0){if(r&&f>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${f} with playlist age: ${n.age}`),f=0;else{const t=Math.floor(f/n.targetduration);o+=t,void 0!==l&&(l+=Math.round(f%n.targetduration/n.partTarget)),this.log(`CDN Tune-in age: ${n.ageHeader}s last advanced ${h.toFixed(2)}s goal: ${f} skip sn ${t} to part ${l}`)}n.tuneInGoal=f}if(a=this.getDeliveryDirectives(n,e.deliveryDirectives,o,l),t||!c)return void this.loadPlaylist(a)}else(n.canBlockReload||n.canSkipUntil)&&(a=this.getDeliveryDirectives(n,e.deliveryDirectives,o,l));const u=this.hls.mainForwardBufferInfo,c=u?u.end-u.len:0,h=function(t,e=1/0){let r=1e3*t.targetduration;if(t.updated){const n=t.fragments,i=4;if(n.length&&r*i>e){const t=1e3*n[n.length-1].duration;t<r&&(r=t)}}else r/=2;return Math.round(r)}(n,1e3*(n.edge-c));n.updated&&s>this.requestScheduled+h&&(this.requestScheduled=i.loading.start),void 0!==o&&n.canBlockReload?this.requestScheduled=i.loading.first+h-(1e3*n.partTarget||1e3):-1===this.requestScheduled||this.requestScheduled+h<s?this.requestScheduled=s:this.requestScheduled-s<=0&&(this.requestScheduled+=h);let d=this.requestScheduled-s;d=Math.max(0,d),this.log(`reload live playlist ${t} in ${Math.round(d)} ms`),this.timer=self.setTimeout((()=>this.loadPlaylist(a)),d)}else this.clearTimer()}getDeliveryDirectives(t,e,r,n){let i=Ke(t);return null!=e&&e.skip&&t.deltaUpdateFailed&&(r=e.msn,n=e.part,i=""),new $e(r,n,i)}checkRetry(t){const e=t.details,r=er(t),n=t.errorAction,{action:i,retryCount:s=0,retryConfig:a}=n||{},o=!!n&&!!a&&(5===i||!n.resolved&&2===i);if(o){var l;if(this.requestScheduled=-1,s>=a.maxNumRetry)return!1;if(r&&null!=(l=t.context)&&l.deliveryDirectives)this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${e}" without delivery-directives`),this.loadPlaylist();else{const t=nr(a,s);this.timer=self.setTimeout((()=>this.loadPlaylist()),t),this.warn(`Retrying playlist loading ${s+1}/${a.maxNumRetry} after "${e}" in ${t}ms`)}t.levelRetry=!0,n.resolved=!0}return o}}class hr{constructor(t,e=0,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}sample(t,e){const r=Math.pow(this.alpha_,t);this.estimate_=e*(1-r)+r*this.estimate_,this.totalWeight_+=t}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_}}class dr{constructor(t,e,r,n=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 hr(t),this.fast_=new hr(e),this.defaultTTFB_=n,this.ttfb_=new hr(t)}update(t,e){const{slow_:r,fast_:n,ttfb_:i}=this;r.halfLife!==t&&(this.slow_=new hr(t,r.getEstimate(),r.getTotalWeight())),n.halfLife!==e&&(this.fast_=new hr(e,n.getEstimate(),n.getTotalWeight())),i.halfLife!==t&&(this.ttfb_=new hr(t,i.getEstimate(),i.getTotalWeight()))}sample(t,e){const r=(t=Math.max(t,this.minDelayMs_))/1e3,n=8*e/r;this.fast_.sample(r,n),this.slow_.sample(r,n)}sampleTTFB(t){const e=t/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(e,2)/2);this.ttfb_.sample(r,Math.max(t,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}destroy(){}}const fr={supported:!0,configurations:[],decodingInfoResults:[{supported:!0,powerEfficient:!0,smooth:!0}]},pr={};function gr(t,e,r,n,i,s){const a=t.audioCodec?t.audioGroups:null,o=null==s?void 0:s.audioCodec,l=null==s?void 0:s.channels,u=l?parseInt(l):o?1/0:2;let c=null;if(null!=a&&a.length)try{c=1===a.length&&a[0]?e.groups[a[0]].channels:a.reduce(((t,r)=>{if(r){const n=e.groups[r];if(!n)throw new Error(`Audio track group ${r} not found`);Object.keys(n.channels).forEach((e=>{t[e]=(t[e]||0)+n.channels[e]}))}return t}),{2:0})}catch(t){return!0}return void 0!==t.videoCodec&&(t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(n,30)||"SDR"!==t.videoRange&&t.videoRange!==r||t.bitrate>Math.max(i,8e6))||!!c&&p(u)&&Object.keys(c).some((t=>parseInt(t)>u))}function vr(t,e,r){const n=t.videoCodec,i=t.audioCodec;if(!n||!i||!r)return Promise.resolve(fr);const s={width:t.width,height:t.height,bitrate:Math.ceil(Math.max(.9*t.bitrate,t.averageBitrate)),framerate:t.frameRate||30},a=t.videoRange;"SDR"!==a&&(s.transferFunction=a.toLowerCase());const o=n.split(",").map((t=>({type:"media-source",video:d(d({},s),{},{contentType:Zt(t,"video")})})));return i&&t.audioGroups&&t.audioGroups.forEach((t=>{var r;t&&(null==(r=e.groups[t])||r.tracks.forEach((e=>{if(e.groupId===t){const t=e.channels||"",r=parseFloat(t);p(r)&&r>2&&o.push.apply(o,i.split(",").map((t=>({type:"media-source",audio:{contentType:Zt(t,"audio"),channels:""+r}}))))}})))})),Promise.all(o.map((t=>{const e=function(t){const{audio:e,video:r}=t,n=r||e;if(n){const t=n.contentType.split('"')[1];if(r)return`r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${t}_${Math.ceil(r.bitrate/1e5)}`;if(e)return`c${e.channels}${e.spatialRendering?"s":"n"}_${t}`}return""}(t);return pr[e]||(pr[e]=r.decodingInfo(t))}))).then((t=>({supported:!t.some((t=>!t.supported)),configurations:o,decodingInfoResults:t}))).catch((t=>({supported:!1,configurations:o,decodingInfoResults:[],error:t})))}function mr(t,e){_.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function yr(t,e,r){if("attrs"in t){const r=e.indexOf(t);if(-1!==r)return r}for(let n=0;n<e.length;n++)if(Er(t,e[n],r))return n;return-1}function Er(t,e,r){const{groupId:n,name:i,lang:s,assocLang:a,characteristics:o,default:l}=t,u=t.forced;return(void 0===n||e.groupId===n)&&(void 0===i||e.name===i)&&(void 0===s||e.lang===s)&&(void 0===s||e.assocLang===a)&&(void 0===l||e.default===l)&&(void 0===u||e.forced===u)&&(void 0===o||function(t,e=""){const r=t.split(","),n=e.split(",");return r.length===n.length&&!r.some((t=>-1===n.indexOf(t)))}(o,e.characteristics))&&(void 0===r||r(t,e))}function Sr(t,e){const{audioCodec:r,channels:n}=t;return!(void 0!==r&&(e.audioCodec||"").substring(0,4)!==r.substring(0,4)||void 0!==n&&n!==(e.channels||"2"))}function br(t,e,r){for(let n=e;n>-1;n--)if(r(t[n]))return n;for(let n=e+1;n<t.length;n++)if(r(t[n]))return n;return-1}class Tr{constructor(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(t){return!this._tickInterval&&(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,t),!0)}clearInterval(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)}clearNextTick(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)}tick(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}var _r="NOT_LOADED",Ar="APPENDING",Lr="PARTIAL",wr="OK";class Rr{constructor(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()}_registerListeners(){const{hls:t}=this;t.on(m.BUFFER_APPENDED,this.onBufferAppended,this),t.on(m.FRAG_BUFFERED,this.onFragBuffered,this),t.on(m.FRAG_LOADED,this.onFragLoaded,this)}_unregisterListeners(){const{hls:t}=this;t.off(m.BUFFER_APPENDED,this.onBufferAppended,this),t.off(m.FRAG_BUFFERED,this.onFragBuffered,this),t.off(m.FRAG_LOADED,this.onFragLoaded,this)}destroy(){this._unregisterListeners(),this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(t,e){const r=this.activePartLists[e];if(r)for(let e=r.length;e--;){const n=r[e];if(!n)break;const i=n.end;if(n.start<=t&&null!==i&&t<=i)return n}return this.getBufferedFrag(t,e)}getBufferedFrag(t,e){const{fragments:r}=this,n=Object.keys(r);for(let i=n.length;i--;){const s=r[n[i]];if((null==s?void 0:s.body.type)===e&&s.buffered){const e=s.body;if(e.start<=t&&t<=e.end)return e}}return null}detectEvictedFragments(t,e,r,n){this.timeRanges&&(this.timeRanges[t]=e);const i=(null==n?void 0:n.fragment.sn)||-1;Object.keys(this.fragments).forEach((n=>{const s=this.fragments[n];if(!s)return;if(i>=s.body.sn)return;if(!s.buffered&&!s.loaded)return void(s.body.type===r&&this.removeFragment(s.body));const a=s.range[t];a&&a.time.some((t=>{const r=!this.isTimeBuffered(t.startPTS,t.endPTS,e);return r&&this.removeFragment(s.body),r}))}))}detectPartialFragments(t){const e=this.timeRanges,{frag:r,part:n}=t;if(!e||"initSegment"===r.sn)return;const i=Dr(r),s=this.fragments[i];if(!s||s.buffered&&r.gap)return;const a=!r.relurl;Object.keys(e).forEach((t=>{const i=r.elementaryStreams[t];if(!i)return;const o=e[t],l=a||!0===i.partial;s.range[t]=this.getBufferedTimes(r,n,l,o)})),s.loaded=null,Object.keys(s.range).length?(s.buffered=!0,(s.body.endList=r.endList||s.body.endList)&&(this.endListFragments[s.body.type]=s),kr(s)||this.removeParts(r.sn-1,r.type)):this.removeFragment(s.body)}removeParts(t,e){const r=this.activePartLists[e];r&&(this.activePartLists[e]=r.filter((e=>e.fragment.sn>=t)))}fragBuffered(t,e){const r=Dr(t);let n=this.fragments[r];!n&&e&&(n=this.fragments[r]={body:t,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},t.gap&&(this.hasGaps=!0)),n&&(n.loaded=null,n.buffered=!0)}getBufferedTimes(t,e,r,n){const i={time:[],partial:r},s=t.start,a=t.end,o=t.minEndPTS||a,l=t.maxStartPTS||s;for(let t=0;t<n.length;t++){const e=n.start(t)-this.bufferPadding,r=n.end(t)+this.bufferPadding;if(l>=e&&o<=r){i.time.push({startPTS:Math.max(s,n.start(t)),endPTS:Math.min(a,n.end(t))});break}if(s<r&&a>e){const e=Math.max(s,n.start(t)),r=Math.min(a,n.end(t));r>e&&(i.partial=!0,i.time.push({startPTS:e,endPTS:r}))}else if(a<=e)break}return i}getPartialFragment(t){let e,r,n,i=null,s=0;const{bufferPadding:a,fragments:o}=this;return Object.keys(o).forEach((l=>{const u=o[l];u&&kr(u)&&(r=u.body.start-a,n=u.body.end+a,t>=r&&t<=n&&(e=Math.min(t-r,n-t),s<=e&&(i=u.body,s=e)))})),i}isEndListAppended(t){const e=this.endListFragments[t];return void 0!==e&&(e.buffered||kr(e))}getState(t){const e=Dr(t),r=this.fragments[e];return r?r.buffered?kr(r)?Lr:wr:Ar:_r}isTimeBuffered(t,e,r){let n,i;for(let s=0;s<r.length;s++){if(n=r.start(s)-this.bufferPadding,i=r.end(s)+this.bufferPadding,t>=n&&e<=i)return!0;if(e<=n)return!1}return!1}onFragLoaded(t,e){const{frag:r,part:n}=e;if("initSegment"===r.sn||r.bitrateTest)return;const i=n?null:e,s=Dr(r);this.fragments[s]={body:r,appendedPTS:null,loaded:i,buffered:!1,range:Object.create(null)}}onBufferAppended(t,e){const{frag:r,part:n,timeRanges:i}=e;if("initSegment"===r.sn)return;const s=r.type;if(n){let t=this.activePartLists[s];t||(this.activePartLists[s]=t=[]),t.push(n)}this.timeRanges=i,Object.keys(i).forEach((t=>{const e=i[t];this.detectEvictedFragments(t,e,s,n)}))}onFragBuffered(t,e){this.detectPartialFragments(e)}hasFragment(t){const e=Dr(t);return!!this.fragments[e]}hasParts(t){var e;return!(null==(e=this.activePartLists[t])||!e.length)}removeFragmentsInRange(t,e,r,n,i){n&&!this.hasGaps||Object.keys(this.fragments).forEach((s=>{const a=this.fragments[s];if(!a)return;const o=a.body;o.type!==r||n&&!o.gap||o.start<e&&o.end>t&&(a.buffered||i)&&this.removeFragment(o)}))}removeFragment(t){const e=Dr(t);t.stats.loaded=0,t.clearElementaryStreamInfo();const r=this.activePartLists[t.type];if(r){const e=t.sn;this.activePartLists[t.type]=r.filter((t=>t.fragment.sn!==e))}delete this.fragments[e],t.endList&&delete this.endListFragments[t.type]}removeAllFragments(){this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1}}function kr(t){var e,r,n;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==(n=t.range.audiovideo)?void 0:n.partial))}function Dr(t){return`${t.type}_${t.level}_${t.sn}`}const Ir={length:0,start:()=>0,end:()=>0};class Pr{static isBuffered(t,e){try{if(t){const r=Pr.getBuffered(t);for(let t=0;t<r.length;t++)if(e>=r.start(t)&&e<=r.end(t))return!0}}catch(t){}return!1}static bufferInfo(t,e,r){try{if(t){const n=Pr.getBuffered(t),i=[];let s;for(s=0;s<n.length;s++)i.push({start:n.start(s),end:n.end(s)});return this.bufferedInfo(i,e,r)}}catch(t){}return{len:0,start:e,end:e,nextStart:void 0}}static bufferedInfo(t,e,r){e=Math.max(0,e),t.sort((function(t,e){return t.start-e.start||e.end-t.end}));let n=[];if(r)for(let e=0;e<t.length;e++){const i=n.length;if(i){const s=n[i-1].end;t[e].start-s<r?t[e].end>s&&(n[i-1].end=t[e].end):n.push(t[e])}else n.push(t[e])}else n=t;let i,s=0,a=e,o=e;for(let t=0;t<n.length;t++){const l=n[t].start,u=n[t].end;if(e+r>=l&&e<u)a=l,o=u,s=o-e;else if(e+r<l){i=l;break}}return{len:s,start:a||0,end:o||0,nextStart:i}}static getBuffered(t){try{return t.buffered}catch(t){return _.log("failed to get media.buffered",t),Ir}}}class Or{constructor(t,e,r,n=0,i=-1,s=!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=n,this.part=i,this.partial=s}}function Cr(t,e){for(let n=0,i=t.length;n<i;n++){var r;if((null==(r=t[n])?void 0:r.cc)===e)return t[n]}return null}function xr(t,e){if(t){const r=t.start+e;t.start=t.startPTS=r,t.endPTS=r+t.duration}}function Mr(t,e){const r=e.fragments;for(let e=0,n=r.length;e<n;e++)xr(r[e],t);e.fragmentHint&&xr(e.fragmentHint,t),e.alignedSliding=!0}function Fr(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const r=t.fragments,n=e.fragments;if(!r.length||!n.length)return;let i,s;const a=Math.min(e.endCC,t.endCC);e.startCC<a&&t.startCC<a&&(i=Cr(n,a),s=Cr(r,a)),i&&s||(i=n[Math.floor(n.length/2)],s=Cr(r,i.cc)||r[Math.floor(r.length/2)]);const o=i.programDateTime,l=s.programDateTime;o&&l&&Mr((l-o)/1e3-(s.start-i.start),t)}const Nr=Math.pow(2,17);class Br{constructor(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(t,e){const r=t.url;if(!r)return Promise.reject(new Hr({type:y.NETWORK_ERROR,details:E.FRAG_LOAD_ERROR,fatal:!1,frag:t,error:new Error("Fragment does not have a "+(r?"part list":"url")),networkDetails:null}));this.abort();const n=this.config,i=n.fLoader,s=n.loader;return new Promise(((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap){if(t.tagList.some((t=>"GAP"===t[0])))return void o(jr(t));t.gap=!1}const l=this.loader=t.loader=i?new i(n):new s(n),u=Ur(t),c=ir(n.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:"initSegment"===t.sn?1/0:Nr};t.stats=l.stats,l.load(u,h,{onSuccess:(e,r,n,i)=>{this.resetLoader(t,l);let s=e.data;n.resetIV&&t.decryptdata&&(t.decryptdata.iv=new Uint8Array(s.slice(0,16)),s=s.slice(16)),a({frag:t,part:null,payload:s,networkDetails:i})},onError:(e,n,i,s)=>{this.resetLoader(t,l),o(new Hr({type:y.NETWORK_ERROR,details:E.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:d({url:r,data:void 0},e),error:new Error(`HTTP Error ${e.code} ${e.text}`),networkDetails:i,stats:s}))},onAbort:(e,r,n)=>{this.resetLoader(t,l),o(new Hr({type:y.NETWORK_ERROR,details:E.INTERNAL_ABORTED,fatal:!1,frag:t,error:new Error("Aborted"),networkDetails:n,stats:e}))},onTimeout:(e,r,n)=>{this.resetLoader(t,l),o(new Hr({type:y.NETWORK_ERROR,details:E.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:n,stats:e}))},onProgress:(r,n,i,s)=>{e&&e({frag:t,part:null,payload:i,networkDetails:s})}})}))}loadPart(t,e,r){this.abort();const n=this.config,i=n.fLoader,s=n.loader;return new Promise(((a,o)=>{if(this.loader&&this.loader.destroy(),t.gap||e.gap)return void o(jr(t,e));const l=this.loader=t.loader=i?new i(n):new s(n),u=Ur(t,e),c=ir(n.fragLoadPolicy.default),h={loadPolicy:c,timeout:c.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:Nr};e.stats=l.stats,l.load(u,h,{onSuccess:(n,i,s,o)=>{this.resetLoader(t,l),this.updateStatsFromPart(t,e);const u={frag:t,part:e,payload:n.data,networkDetails:o};r(u),a(u)},onError:(r,n,i,s)=>{this.resetLoader(t,l),o(new Hr({type:y.NETWORK_ERROR,details:E.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:d({url:u.url,data:void 0},r),error:new Error(`HTTP Error ${r.code} ${r.text}`),networkDetails:i,stats:s}))},onAbort:(r,n,i)=>{t.stats.aborted=e.stats.aborted,this.resetLoader(t,l),o(new Hr({type:y.NETWORK_ERROR,details:E.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,error:new Error("Aborted"),networkDetails:i,stats:r}))},onTimeout:(r,n,i)=>{this.resetLoader(t,l),o(new Hr({type:y.NETWORK_ERROR,details:E.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,error:new Error(`Timeout after ${h.timeout}ms`),networkDetails:i,stats:r}))}})}))}updateStatsFromPart(t,e){const r=t.stats,n=e.stats,i=n.total;if(r.loaded+=n.loaded,i){const n=Math.round(t.duration/e.duration),s=Math.min(Math.round(r.loaded/i),n),a=(n-s)*Math.round(r.loaded/s);r.total=r.loaded+a}else r.total=Math.max(r.loaded,r.total);const s=r.loading,a=n.loading;s.start?s.first+=a.first-a.start:(s.start=a.start,s.first=a.first),s.end=a.end}resetLoader(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()}}function Ur(t,e=null){const r=e||t,n={frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},i=r.byteRangeStartOffset,s=r.byteRangeEndOffset;if(p(i)&&p(s)){var a;let e=i,r=s;if("initSegment"===t.sn&&"AES-128"===(null==(a=t.decryptdata)?void 0:a.method)){const t=s-i;t%16&&(r=s+(16-t%16)),0!==i&&(n.resetIV=!0,e=i-16)}n.rangeStart=e,n.rangeEnd=r}return n}function jr(t,e){const r=new Error(`GAP ${t.gap?"tag":"attribute"} found`),n={type:y.MEDIA_ERROR,details:E.FRAG_GAP,fatal:!1,frag:t,error:r,networkDetails:null};return e&&(n.part=e),(e||t).stats.aborted=!0,new Hr(n)}class Hr extends Error{constructor(t){super(t.error.message),this.data=void 0,this.data=t}}class Gr{constructor(t,e){this.subtle=void 0,this.aesIV=void 0,this.subtle=t,this.aesIV=e}decrypt(t,e){return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},e,t)}}class Vr{constructor(t,e){this.subtle=void 0,this.key=void 0,this.subtle=t,this.key=e}expandKey(){return this.subtle.importKey("raw",this.key,{name:"AES-CBC"},!1,["encrypt","decrypt"])}}class Kr{constructor(){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()}uint8ArrayToUint32Array_(t){const e=new DataView(t),r=new Uint32Array(4);for(let t=0;t<4;t++)r[t]=e.getUint32(4*t);return r}initTable(){const t=this.sBox,e=this.invSBox,r=this.subMix,n=r[0],i=r[1],s=r[2],a=r[3],o=this.invSubMix,l=o[0],u=o[1],c=o[2],h=o[3],d=new Uint32Array(256);let f=0,p=0,g=0;for(g=0;g<256;g++)d[g]=g<128?g<<1:g<<1^283;for(g=0;g<256;g++){let r=p^p<<1^p<<2^p<<3^p<<4;r=r>>>8^255&r^99,t[f]=r,e[r]=f;const o=d[f],g=d[o],v=d[g];let m=257*d[r]^16843008*r;n[f]=m<<24|m>>>8,i[f]=m<<16|m>>>16,s[f]=m<<8|m>>>24,a[f]=m,m=16843009*v^65537*g^257*o^16843008*f,l[r]=m<<24|m>>>8,u[r]=m<<16|m>>>16,c[r]=m<<8|m>>>24,h[r]=m,f?(f=o^d[d[d[v^o]]],p^=d[d[p]]):f=p=1}}expandKey(t){const e=this.uint8ArrayToUint32Array_(t);let r=!0,n=0;for(;n<e.length&&r;)r=e[n]===this.key[n],n++;if(r)return;this.key=e;const i=this.keySize=e.length;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);const s=this.ksRows=4*(i+6+1);let a,o;const l=this.keySchedule=new Uint32Array(s),u=this.invKeySchedule=new Uint32Array(s),c=this.sBox,h=this.rcon,d=this.invSubMix,f=d[0],p=d[1],g=d[2],v=d[3];let m,y;for(a=0;a<s;a++)a<i?m=l[a]=e[a]:(y=m,a%i==0?(y=y<<8|y>>>24,y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y],y^=h[a/i|0]<<24):i>6&&a%i==4&&(y=c[y>>>24]<<24|c[y>>>16&255]<<16|c[y>>>8&255]<<8|c[255&y]),l[a]=m=(l[a-i]^y)>>>0);for(o=0;o<s;o++)a=s-o,y=3&o?l[a]:l[a-4],u[o]=o<4||a<=4?y:f[c[y>>>24]]^p[c[y>>>16&255]]^g[c[y>>>8&255]]^v[c[255&y]],u[o]=u[o]>>>0}networkToHostOrderSwap(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}decrypt(t,e,r){const n=this.keySize+6,i=this.invKeySchedule,s=this.invSBox,a=this.invSubMix,o=a[0],l=a[1],u=a[2],c=a[3],h=this.uint8ArrayToUint32Array_(r);let d=h[0],f=h[1],p=h[2],g=h[3];const v=new Int32Array(t),m=new Int32Array(v.length);let y,E,S,b,T,_,A,L,w,R,k,D,I,P;const O=this.networkToHostOrderSwap;for(;e<v.length;){for(w=O(v[e]),R=O(v[e+1]),k=O(v[e+2]),D=O(v[e+3]),T=w^i[0],_=D^i[1],A=k^i[2],L=R^i[3],I=4,P=1;P<n;P++)y=o[T>>>24]^l[_>>16&255]^u[A>>8&255]^c[255&L]^i[I],E=o[_>>>24]^l[A>>16&255]^u[L>>8&255]^c[255&T]^i[I+1],S=o[A>>>24]^l[L>>16&255]^u[T>>8&255]^c[255&_]^i[I+2],b=o[L>>>24]^l[T>>16&255]^u[_>>8&255]^c[255&A]^i[I+3],T=y,_=E,A=S,L=b,I+=4;y=s[T>>>24]<<24^s[_>>16&255]<<16^s[A>>8&255]<<8^s[255&L]^i[I],E=s[_>>>24]<<24^s[A>>16&255]<<16^s[L>>8&255]<<8^s[255&T]^i[I+1],S=s[A>>>24]<<24^s[L>>16&255]<<16^s[T>>8&255]<<8^s[255&_]^i[I+2],b=s[L>>>24]<<24^s[T>>16&255]<<16^s[_>>8&255]<<8^s[255&A]^i[I+3],m[e]=O(y^d),m[e+1]=O(b^f),m[e+2]=O(S^p),m[e+3]=O(E^g),d=w,f=R,p=k,g=D,e+=4}return m.buffer}}class $r{constructor(t,{removePKCS7Padding:e=!0}={}){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=e,e)try{const t=self.crypto;t&&(this.subtle=t.subtle||t.webkitSubtle)}catch(t){}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:t,remainderData:e}=this;if(!t||e)return this.reset(),null;const r=new Uint8Array(t);return this.reset(),this.removePKCS7Padding?function(t){const e=t.byteLength,r=e&&new DataView(t.buffer).getUint8(e-1);return r?Q(t,0,e-r):t}(r):r}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(t,e,r){return this.useSoftware?new Promise(((n,i)=>{this.softwareDecrypt(new Uint8Array(t),e,r);const s=this.flush();s?n(s.buffer):i(new Error("[softwareDecrypt] Failed to decrypt data"))})):this.webCryptoDecrypt(new Uint8Array(t),e,r)}softwareDecrypt(t,e,r){const{currentIV:n,currentResult:i,remainderData:s}=this;this.logOnce("JS AES decrypt"),s&&(t=Mt(s,t),this.remainderData=null);const a=this.getValidChunk(t);if(!a.length)return null;n&&(r=n);let o=this.softwareDecrypter;o||(o=this.softwareDecrypter=new Kr),o.expandKey(e);const l=i;return this.currentResult=o.decrypt(a.buffer,0,r),this.currentIV=Q(a,-16).buffer,l||null}webCryptoDecrypt(t,e,r){if(this.key!==e||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(t,e,r));this.key=e,this.fastAesKey=new Vr(this.subtle,e)}return this.fastAesKey.expandKey().then((e=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new Gr(this.subtle,new Uint8Array(r)).decrypt(t.buffer,e)):Promise.reject(new Error("web crypto not initialized")))).catch((n=>(_.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${n.name}: ${n.message}`),this.onWebCryptoError(t,e,r))))}onWebCryptoError(t,e,r){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(t,e,r);const n=this.flush();if(n)return n.buffer;throw new Error("WebCrypto and softwareDecrypt: failed to decrypt data")}getValidChunk(t){let e=t;const r=t.length-t.length%16;return r!==t.length&&(e=Q(t,0,r),this.remainderData=Q(t,r)),e}logOnce(t){this.logEnabled&&(_.log(`[decrypter]: ${t}`),this.logEnabled=!1)}}const Wr="STOPPED",qr="IDLE",Yr="KEY_LOADING",zr="FRAG_LOADING",Xr="FRAG_LOADING_WAITING_RETRY",Jr="WAITING_TRACK",Qr="PARSING",Zr="PARSED",tn="ENDED",en="ERROR",rn="WAITING_INIT_PTS",nn="WAITING_LEVEL";class sn extends Tr{constructor(t,e,r,n,i){super(),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Wr,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.loadedmetadata=!1,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.onvseeking=null,this.onvended=null,this.logPrefix="",this.log=void 0,this.warn=void 0,this.playlistType=i,this.logPrefix=n,this.log=_.log.bind(_,`${n}:`),this.warn=_.warn.bind(_,`${n}:`),this.hls=t,this.fragmentLoader=new Br(t.config),this.keyLoader=r,this.fragmentTracker=e,this.config=t.config,this.decrypter=new $r(t.config),t.on(m.MANIFEST_LOADED,this.onManifestLoaded,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(t){}stopLoad(){this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const 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=Wr}_streamEnded(t,e){if(e.live||t.nextStart||!t.end||!this.media)return!1;const r=e.partList;if(null!=r&&r.length){const t=r[r.length-1];return Pr.isBuffered(this.media,t.start+t.duration/2)}const n=e.fragments[e.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(n)}getLevelDetails(){var t;if(this.levels&&null!==this.levelLastLoaded)return null==(t=this.levelLastLoaded)?void 0:t.details}onMediaAttached(t,e){const 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);const n=this.config;this.levels&&n.autoStartLoad&&this.state===Wr&&this.startLoad(n.startPosition)}onMediaDetaching(){const 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()}onMediaSeeking(){const{config:t,fragCurrent:e,media:r,mediaBuffer:n,state:i}=this,s=r?r.currentTime:0,a=Pr.bufferInfo(n||r,s,t.maxBufferHole);if(this.log(`media seeking to ${p(s)?s.toFixed(3):s}, state: ${i}`),this.state===tn)this.resetLoadingState();else if(e){const r=t.maxFragLookUpTolerance,n=e.start-r,i=e.start+e.duration+r;if(!a.len||i<a.start||n>a.end){const t=s>i;(s<n||t)&&(t&&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(s,1/0,this.playlistType,!0),this.lastCurrentTime=s),this.loadedmetadata||a.len||(this.nextLoadPosition=this.startPosition=s),this.tickImmediate()}onMediaEnded(){this.startPosition=this.lastCurrentTime=0}onManifestLoaded(t,e){this.startTimeOffset=e.startTimeOffset,this.initPTS=[]}onHandlerDestroying(){this.hls.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),this.stopLoad(),super.onHandlerDestroying(),this.hls=null}onHandlerDestroyed(){this.state=Wr,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,super.onHandlerDestroyed()}loadFragment(t,e,r){this._loadFragForPlayback(t,e,r)}_loadFragForPlayback(t,e,r){this._doFragLoad(t,e,r,(e=>{if(this.fragContextChanged(t))return this.warn(`Fragment ${t.sn}${e.part?" p: "+e.part.index:""} of level ${t.level} was dropped during download.`),void this.fragmentTracker.removeFragment(t);t.stats.chunkCount++,this._handleFragmentLoadProgress(e)})).then((e=>{if(!e)return;const r=this.state;this.fragContextChanged(t)?(r===zr||!this.fragCurrent&&r===Qr)&&(this.fragmentTracker.removeFragment(t),this.state=qr):("payload"in e&&(this.log(`Loaded fragment ${t.sn} of level ${t.level}`),this.hls.trigger(m.FRAG_LOADED,e)),this._handleFragmentLoadComplete(e))})).catch((e=>{this.state!==Wr&&this.state!==en&&(this.warn(`Frag error: ${(null==e?void 0:e.message)||e}`),this.resetFragmentLoading(t))}))}clearTrackerIfNeeded(t){var e;const{fragmentTracker:r}=this;if(r.getState(t)===Ar){const e=t.type,n=this.getFwdBufferInfo(this.mediaBuffer,e),i=Math.max(t.duration,n?n.len:this.config.maxBufferLength),s=this.backtrackFragment;(1==(s?t.sn-s.sn:0)||this.reduceMaxBufferLength(i,t.duration))&&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)===Lr&&r.removeFragment(t))}checkLiveUpdate(t){if(t.updated&&!t.live){const e=t.fragments[t.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type})}t.fragments[0]||(t.deltaUpdateFailed=!0)}flushMainBuffer(t,e,r=null){if(!(t-e))return;const n={startOffset:t,endOffset:e,type:r};this.hls.trigger(m.BUFFER_FLUSHING,n)}_loadInitSegment(t,e){this._doFragLoad(t,e).then((e=>{if(!e||this.fragContextChanged(t)||!this.levels)throw new Error("init load aborted");return e})).then((e=>{const{hls:r}=this,{payload:n}=e,i=t.decryptdata;if(n&&n.byteLength>0&&null!=i&&i.key&&i.iv&&"AES-128"===i.method){const s=self.performance.now();return this.decrypter.decrypt(new Uint8Array(n),i.key.buffer,i.iv.buffer).catch((e=>{throw r.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_DECRYPT_ERROR,fatal:!1,error:e,reason:e.message,frag:t}),e})).then((n=>{const i=self.performance.now();return r.trigger(m.FRAG_DECRYPTED,{frag:t,payload:n,stats:{tstart:s,tdecrypt:i}}),e.payload=n,this.completeInitSegmentLoad(e)}))}return this.completeInitSegmentLoad(e)})).catch((e=>{this.state!==Wr&&this.state!==en&&(this.warn(e),this.resetFragmentLoading(t))}))}completeInitSegmentLoad(t){const{levels:e}=this;if(!e)throw new Error("init load aborted, missing levels");const r=t.frag.stats;this.state=qr,t.frag.data=new Uint8Array(t.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}fragContextChanged(t){const{fragCurrent:e}=this;return!t||!e||t.sn!==e.sn||t.level!==e.level}fragBufferedComplete(t,e){var r,n,i,s;const a=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${t.type} sn: ${t.sn}${e?" part: "+e.index:""} of ${this.playlistType===_e?"level":"track"} ${t.level} (frag:[${(null!=(r=t.startPTS)?r:NaN).toFixed(3)}-${(null!=(n=t.endPTS)?n:NaN).toFixed(3)}] > buffer:${a?function(t){let e="";const r=t.length;for(let n=0;n<r;n++)e+=`[${t.start(n).toFixed(3)}-${t.end(n).toFixed(3)}]`;return e}(Pr.getBuffered(a)):"(detached)"})`),"initSegment"!==t.sn){var o;if(t.type!==Le){const e=t.elementaryStreams;if(!Object.keys(e).some((t=>!!e[t])))return void(this.state=qr)}const e=null==(o=this.levels)?void 0:o[t.level];null!=e&&e.fragmentError&&(this.log(`Resetting level fragment error count of ${e.fragmentError} on frag buffered`),e.fragmentError=0)}this.state=qr,a&&(!this.loadedmetadata&&t.type==_e&&a.buffered.length&&(null==(i=this.fragCurrent)?void 0:i.sn)===(null==(s=this.fragPrevious)?void 0:s.sn)&&(this.loadedmetadata=!0,this.seekToStartPos()),this.tick())}seekToStartPos(){}_handleFragmentLoadComplete(t){const{transmuxer:e}=this;if(!e)return;const{frag:r,part:n,partsLoaded:i}=t,s=!i||0===i.length||i.some((t=>!t)),a=new Or(r.level,r.sn,r.stats.chunkCount+1,0,n?n.index:-1,!s);e.flush(a)}_handleFragmentLoadProgress(t){}_doFragLoad(t,e,r=null,n){var i;const s=null==e?void 0:e.details;if(!this.levels||!s)throw new Error(`frag load aborted, missing level${s?"":" detail"}s`);let a=null;if(!t.encrypted||null!=(i=t.decryptdata)&&i.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=Yr,this.fragCurrent=t,a=this.keyLoader.load(t).then((t=>{if(!this.fragContextChanged(t.frag))return this.hls.trigger(m.KEY_LOADED,t),this.state===Yr&&(this.state=qr),t})),this.hls.trigger(m.KEY_LOADING,{frag:t}),null===this.fragCurrent&&(a=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){const i=s.partList;if(i&&n){r>t.end&&s.fragmentHint&&(t=s.fragmentHint);const o=this.getNextPart(i,t,r);if(o>-1){const l=i[o];let u;return this.log(`Loading part sn: ${t.sn} p: ${l.index} cc: ${t.cc} of playlist [${s.startSN}-${s.endSN}] parts [0-${o}-${i.length-1}] ${"[stream-controller]"===this.logPrefix?"level":"track"}: ${t.level}, target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=l.start+l.duration,this.state=zr,u=a?a.then((r=>!r||this.fragContextChanged(r.frag)?null:this.doFragPartsLoad(t,l,e,n))).catch((t=>this.handleFragLoadError(t))):this.doFragPartsLoad(t,l,e,n).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(m.FRAG_LOADING,{frag:t,part:l,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):u}if(!t.url||this.loadedEndOfParts(i,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))}`),p(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=zr;const o=this.config.progressive;let l;return l=o&&a?a.then((e=>!e||this.fragContextChanged(null==e?void 0:e.frag)?null:this.fragmentLoader.load(t,n))).catch((t=>this.handleFragLoadError(t))):Promise.all([this.fragmentLoader.load(t,o?n:void 0),a]).then((([t])=>(!o&&t&&n&&n(t),t))).catch((t=>this.handleFragLoadError(t))),this.hls.trigger(m.FRAG_LOADING,{frag:t,targetBufferTime:r}),null===this.fragCurrent?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):l}doFragPartsLoad(t,e,r,n){return new Promise(((i,s)=>{var a;const o=[],l=null==(a=r.details)?void 0:a.partList,u=e=>{this.fragmentLoader.loadPart(t,e,n).then((n=>{o[e.index]=n;const s=n.part;this.hls.trigger(m.FRAG_LOADED,n);const a=Qe(r,t.sn,e.index+1)||Ze(l,t.sn,e.index+1);if(!a)return i({frag:t,part:s,partsLoaded:o});u(a)})).catch(s)};u(e)}))}handleFragLoadError(t){if("data"in t){const e=t.data;t.data&&e.details===E.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(m.ERROR,e)}else this.hls.trigger(m.ERROR,{type:y.OTHER_ERROR,details:E.INTERNAL_EXCEPTION,err:t,error:t,fatal:!0});return null}_handleTransmuxerFlush(t){const e=this.getCurrentContext(t);if(!e||this.state!==Qr)return void(this.fragCurrent||this.state===Wr||this.state===en||(this.state=qr));const{frag:r,part:n,level:i}=e,s=self.performance.now();r.stats.parsing.end=s,n&&(n.stats.parsing.end=s),this.updateLevelTiming(r,n,i,t.partial)}getCurrentContext(t){const{levels:e,fragCurrent:r}=this,{level:n,sn:i,part:s}=t;if(null==e||!e[n])return this.warn(`Levels object was unset while buffering fragment ${i} of level ${n}. The current chunk will not be buffered.`),null;const a=e[n],o=s>-1?Qe(a,i,s):null,l=o?o.fragment:function(t,e,r){if(null==t||!t.details)return null;const n=t.details;let i=n.fragments[e-n.startSN];return i||(i=n.fragmentHint,i&&i.sn===e?i:e<n.startSN&&r&&r.sn===e?r:null)}(a,i,r);return l?(r&&r!==l&&(l.stats=r.stats),{frag:l,part:o,level:a}):null}bufferFragmentData(t,e,r,n,i){var s;if(!t||this.state!==Qr)return;const{data1:a,data2:o}=t;let l=a;if(a&&o&&(l=Mt(a,o)),null==(s=l)||!s.length)return;const u={type:t.type,frag:e,part:r,chunkMeta:n,parent:e.type,data:l};if(this.hls.trigger(m.BUFFER_APPENDING,u),t.dropped&&t.independent&&!r){if(i)return;this.flushBufferGap(e)}}flushBufferGap(t){const e=this.media;if(!e)return;if(!Pr.isBuffered(e,e.currentTime))return void this.flushMainBuffer(0,t.start);const r=e.currentTime,n=Pr.bufferInfo(e,r,0),i=t.duration,s=Math.min(2*this.config.maxFragLookUpTolerance,.25*i),a=Math.max(Math.min(t.start-s,n.end-s),r+s);t.start-a>s&&this.flushMainBuffer(a,t.start)}getFwdBufferInfo(t,e){const r=this.getLoadPosition();return p(r)?this.getFwdBufferInfoAtPos(t,r,e):null}getFwdBufferInfoAtPos(t,e,r){const{config:{maxBufferHole:n}}=this,i=Pr.bufferInfo(t,e,n);if(0===i.len&&void 0!==i.nextStart){const s=this.fragmentTracker.getBufferedFrag(e,r);if(s&&i.nextStart<s.end)return Pr.bufferInfo(t,e,Math.max(i.nextStart,n))}return i}getMaxBufferLength(t){const{config:e}=this;let r;return r=t?Math.max(8*e.maxBufferSize/t,e.maxBufferLength):e.maxBufferLength,Math.min(r,e.maxMaxBufferLength)}reduceMaxBufferLength(t,e){const r=this.config,n=Math.max(Math.min(t-e,r.maxBufferLength),e),i=Math.max(t-3*e,r.maxMaxBufferLength/2,n);return i>=n&&(r.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0)}getAppendedFrag(t,e=_e){const r=this.fragmentTracker.getAppendedFrag(t,_e);return r&&"fragment"in r?r.fragment:r}getNextFragment(t,e){const r=e.fragments,n=r.length;if(!n)return null;const{config:i}=this,s=r[0].start;let a;if(e.live){const o=i.initialLiveManifestSize;if(n<o)return this.warn(`Not enough fragments to start playback (have: ${n}, need: ${o})`),null;(!e.PTSKnown&&!this.startFragRequested&&-1===this.startPosition||t<s)&&(a=this.getInitialLiveFragment(e,r),this.startPosition=this.nextLoadPosition=a?this.hls.liveSyncPosition||a.start:t)}else t<=s&&(a=r[0]);if(!a){const r=i.lowLatencyMode?e.partEnd:e.fragmentEnd;a=this.getFragmentAtPosition(t,r,e)}return this.mapToInitFragWhenRequired(a)}isLoopLoading(t,e){const r=this.fragmentTracker.getState(t);return(r===wr||r===Lr&&!!t.gap)&&this.nextLoadPosition>e}getNextFragmentLoopLoading(t,e,r,n,i){const s=t.gap,a=this.getNextFragment(this.nextLoadPosition,e);if(null===a)return a;if(t=a,s&&t&&!t.gap&&r.nextStart){const e=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,n);if(null!==e&&r.len+e.len>=i)return this.log(`buffer full after gaps in "${n}" playlist starting at sn: ${t.sn}`),null}return t}mapToInitFragWhenRequired(t){return null==t||!t.initSegment||null!=t&&t.initSegment.data||this.bitrateTest?t:t.initSegment}getNextPart(t,e,r){let n=-1,i=!1,s=!0;for(let a=0,o=t.length;a<o;a++){const o=t[a];if(s=s&&!o.independent,n>-1&&r<o.start)break;const l=o.loaded;l?n=-1:(i||o.independent||s)&&o.fragment===e&&(n=a),i=l}return n}loadedEndOfParts(t,e){const r=t[t.length-1];return r&&e>r.start&&r.loaded}getInitialLiveFragment(t,e){const r=this.fragPrevious;let n=null;if(r){if(t.hasProgramDateTime&&(this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`),n=function(t,e,r){if(null===e||!Array.isArray(t)||!t.length||!p(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(let n=0;n<t.length;++n){const i=t[n];if(ur(e,r,i))return i}return null}(e,r.endProgramDateTime,this.config.maxFragLookUpTolerance)),!n){const i=r.sn+1;if(i>=t.startSN&&i<=t.endSN){const s=e[i-t.startSN];r.cc===s.cc&&(n=s,this.log(`Live playlist, switching playlist, load frag with next SN: ${n.sn}`))}n||(n=function(t,e){return ar(t,(t=>t.cc<e?1:t.cc>e?-1:0))}(e,r.cc),n&&this.log(`Live playlist, switching playlist, load frag with same CC: ${n.sn}`))}}else{const e=this.hls.liveSyncPosition;null!==e&&(n=this.getFragmentAtPosition(e,this.bitrateTest?t.fragmentEnd:t.edge,t))}return n}getFragmentAtPosition(t,e,r){const{config:n}=this;let{fragPrevious:i}=this,{fragments:s,endSN:a}=r;const{fragmentHint:o}=r,{maxFragLookUpTolerance:l}=n,u=r.partList,c=!!(n.lowLatencyMode&&null!=u&&u.length&&o);let h;if(c&&o&&!this.bitrateTest&&(s=s.concat(o),a=o.sn),h=t<e?or(i,s,t,t>e-l?0:l):s[s.length-1],h){const t=h.sn-r.startSN,e=this.fragmentTracker.getState(h);if((e===wr||e===Lr&&h.gap)&&(i=h),i&&h.sn===i.sn&&(!c||u[0].fragment.sn>h.sn)&&i&&h.level===i.level){const e=s[t+1];h=h.sn<a&&this.fragmentTracker.getState(e)!==wr?e:null}}return h}synchronizeToLiveEdge(t){const{config:e,media:r}=this;if(!r)return;const n=this.hls.liveSyncPosition,i=r.currentTime,s=t.fragments[0].start,a=t.edge,o=i>=s-e.maxFragLookUpTolerance&&i<=a;if(null!==n&&r.duration>n&&(i<n||!o)){const s=void 0!==e.liveMaxLatencyDuration?e.liveMaxLatencyDuration:e.liveMaxLatencyDurationCount*t.targetduration;(!o&&r.readyState<4||i<a-s)&&(this.loadedmetadata||(this.nextLoadPosition=n),r.readyState&&(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${a}, reset currentTime to : ${n.toFixed(3)}`),r.currentTime=n))}}alignPlaylists(t,e,r){const n=t.fragments.length;if(!n)return this.warn("No fragments in live playlist"),0;const i=t.fragments[0].start,s=!e,a=t.alignedSliding&&p(i);if(s||!a&&!i){const{fragPrevious:i}=this;!function(t,e,r){e&&(function(t,e,r){if(function(t,e,r){return!(!e||!(r.endCC>r.startCC||t&&t.cc<r.startCC))}(t,r,e)){const t=function(t,e){const r=t.fragments,n=e.fragments;if(!n.length||!r.length)return void _.log("No fragments to align");const i=Cr(r,n[0].cc);if(i&&(!i||i.startPTS))return i;_.log("No frag in previous level to align on")}(r,e);t&&p(t.start)&&(_.log(`Adjusting PTS using last level due to CC increase within current level ${e.url}`),Mr(t.start,e))}}(t,r,e),!r.alignedSliding&&e&&Fr(r,e),r.alignedSliding||!e||r.skippedSegments||Xe(e,r))}(i,r,t);const s=t.fragments[0].start;return this.log(`Live playlist sliding: ${s.toFixed(2)} start-sn: ${e?e.startSN:"na"}->${t.startSN} prev-sn: ${i?i.sn:"na"} fragments: ${n}`),s}return i}waitForCdnTuneIn(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)}setStartPosition(t,e){let r=this.startPosition;if(r<e&&(r=-1),-1===r||-1===this.lastCurrentTime){const n=null!==this.startTimeOffset,i=n?this.startTimeOffset:t.startTimeOffset;null!==i&&p(i)?(r=e+i,i<0&&(r+=t.totalduration),r=Math.min(Math.max(e,r),e+t.totalduration),this.log(`Start time offset ${i} found in ${n?"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}getLoadPosition(){const{media:t}=this;let e=0;return this.loadedmetadata&&t?e=t.currentTime:this.nextLoadPosition&&(e=this.nextLoadPosition),e}handleFragLoadAborted(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))}resetFragmentLoading(t){this.fragCurrent&&(this.fragContextChanged(t)||this.state===Xr)||(this.state=qr)}onFragmentOrKeyLoadError(t,e){if(e.chunkMeta&&!e.frag){const t=this.getCurrentContext(e.chunkMeta);t&&(e.frag=t.frag)}const r=e.frag;if(!r||r.type!==t||!this.levels)return;var n;if(this.fragContextChanged(r))return void this.warn(`Frag load error must match current frag to retry ${r.url} > ${null==(n=this.fragCurrent)?void 0:n.url}`);const i=e.details===E.FRAG_GAP;i&&this.fragmentTracker.fragBuffered(r,!0);const s=e.errorAction,{action:a,retryCount:o=0,retryConfig:l}=s||{};if(s&&5===a&&l){this.resetStartWhenNotLoaded(this.levelLastLoaded);const n=nr(l,o);this.warn(`Fragment ${r.sn} of ${t} ${r.level} errored with ${e.details}, retrying loading ${o+1}/${l.maxNumRetry} in ${n}ms`),s.resolved=!0,this.retryDate=self.performance.now()+n,this.state=Xr}else if(l&&s){if(this.resetFragmentErrors(t),!(o<l.maxNumRetry))return void _.warn(`${e.details} reached or exceeded max retry (${o})`);i||3===a||(s.resolved=!0)}else 2===(null==s?void 0:s.action)?this.state=nn:this.state=en;this.tickImmediate()}reduceLengthAndFlushBuffer(t){if(this.state===Qr||this.state===Zr){const e=t.frag,r=t.parent,n=this.getFwdBufferInfo(this.mediaBuffer,r),i=n&&n.len>.5;i&&this.reduceMaxBufferLength(n.len,(null==e?void 0:e.duration)||10);const s=!i;return s&&this.warn(`Buffer full error while media.currentTime is not buffered, flush ${r} buffer`),e&&(this.fragmentTracker.removeFragment(e),this.nextLoadPosition=e.start),this.resetLoadingState(),s}return!1}resetFragmentErrors(t){t===Ae&&(this.fragCurrent=null),this.loadedmetadata||(this.startFragRequested=!1),this.state!==Wr&&(this.state=qr)}afterBufferFlushed(t,e,r){if(!t)return;const n=Pr.getBuffered(t);this.fragmentTracker.detectEvictedFragments(e,n,r),this.state===tn&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state=qr}resetStartWhenNotLoaded(t){if(!this.loadedmetadata){this.startFragRequested=!1;const e=t?t.details:null;null!=e&&e.live?(this.startPosition=-1,this.setStartPosition(e,0),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(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(this.levelLastLoaded),this.resetLoadingState()}removeUnbufferedFrags(t=0){this.fragmentTracker.removeFragmentsInRange(t,1/0,this.playlistType,!1,!0)}updateLevelTiming(t,e,r,n){var i;const s=r.details;if(s){if(!Object.keys(t.elementaryStreams).reduce(((e,i)=>{const a=t.elementaryStreams[i];if(a){const o=a.endPTS-a.startPTS;if(o<=0)return this.warn(`Could not parse fragment ${t.sn} ${i} duration reliably (${o})`),e||!1;const l=n?0:ze(s,t,a.startPTS,a.endPTS,a.startDTS,a.endDTS);return this.hls.trigger(m.LEVEL_PTS_UPDATED,{details:s,level:r,drift:l,type:i,frag:t,start:a.startPTS,end:a.endPTS}),!0}return e}),!1)&&null===(null==(i=this.transmuxer)?void 0:i.error)){const e=new Error(`Found no media in fragment ${t.sn} of level ${t.level} resetting transmuxer to fallback to playlist timing`);if(0===r.fragmentError&&(r.fragmentError++,t.gap=!0,this.fragmentTracker.removeFragment(t),this.fragmentTracker.fragBuffered(t,!0)),this.warn(e.message),this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_PARSING_ERROR,fatal:!1,error:e,frag:t,reason:`Found no media in msn ${t.sn} of level "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}this.state=Zr,this.hls.trigger(m.FRAG_PARSED,{frag:t,part:e})}else this.warn("level.details undefined")}resetTransmuxer(){this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null)}recoverWorkerError(t){"demuxerWorker"===t.event&&(this.fragmentTracker.removeAllFragments(),this.resetTransmuxer(),this.resetStartWhenNotLoaded(this.levelLastLoaded),this.resetLoadingState())}set state(t){const e=this._state;e!==t&&(this._state=t,this.log(`${e}->${t}`))}get state(){return this._state}}class an{constructor(){this.chunks=[],this.dataLength=0}push(t){this.chunks.push(t),this.dataLength+=t.length}flush(){const{chunks:t,dataLength:e}=this;let r;return t.length?(r=1===t.length?t[0]:function(t,e){const r=new Uint8Array(e);let n=0;for(let e=0;e<t.length;e++){const i=t[e];r.set(i,n),n+=i.length}return r}(t,e),this.reset(),r):new Uint8Array(0)}reset(){this.chunks.length=0,this.dataLength=0}}function on(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class ln{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(t,e,r,n){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(t){this.initPTS=t,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(t,e){return!1}appendFrame(t,e,r){}demux(t,e){this.cachedData&&(t=Mt(this.cachedData,t),this.cachedData=null);let r,n=et(t,0),i=n?n.length:0;const s=this._audioTrack,a=this._id3Track,o=n?it(n):void 0,l=t.length;for((null===this.basePTS||0===this.frameIndex&&p(o))&&(this.basePTS=un(o,e,this.initPTS),this.lastPTS=this.basePTS),null===this.lastPTS&&(this.lastPTS=this.basePTS),n&&n.length>0&&a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:xe,duration:Number.POSITIVE_INFINITY});i<l;){if(this.canParse(t,i)){const e=this.appendFrame(s,t,i);e?(this.frameIndex++,this.lastPTS=e.sample.pts,i+=e.length,r=i):i=l}else nt(t,i)?(n=et(t,i),a.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:n,type:xe,duration:Number.POSITIVE_INFINITY}),i+=n.length,r=i):i++;if(i===l&&r!==l){const e=Q(t,r);this.cachedData?this.cachedData=Mt(this.cachedData,e):this.cachedData=e}}return{audioTrack:s,videoTrack:on(),id3Track:a,textTrack:on()}}demuxSampleAes(t,e,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(t){const e=this.cachedData;return e&&(this.cachedData=null,this.demux(e,0)),{audioTrack:this._audioTrack,videoTrack:on(),id3Track:this._id3Track,textTrack:on()}}destroy(){}}const un=(t,e,r)=>p(t)?90*t:9e4*e+(r?9e4*r.baseTime/r.timescale:0);function cn(t,e){return 255===t[e]&&240==(246&t[e+1])}function hn(t,e){return 1&t[e+1]?7:9}function dn(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function fn(t,e){return e+1<t.length&&cn(t,e)}function pn(t,e){if(fn(t,e)){const r=hn(t,e);if(e+r>=t.length)return!1;const n=dn(t,e);if(n<=r)return!1;const i=e+n;return i===t.length||fn(t,i)}return!1}function gn(t,e,r,n,i){if(!t.samplerate){const s=function(t,e,r,n){let i,s,a,o;const l=navigator.userAgent.toLowerCase(),u=n,c=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];i=1+((192&e[r+2])>>>6);const h=(60&e[r+2])>>>2;if(!(h>c.length-1))return a=(1&e[r+2])<<2,a|=(192&e[r+3])>>>6,_.log(`manifest codec:${n}, ADTS type:${i}, samplingIndex:${h}`),/firefox/i.test(l)?h>=6?(i=5,o=new Array(4),s=h-3):(i=2,o=new Array(2),s=h):-1!==l.indexOf("android")?(i=2,o=new Array(2),s=h):(i=5,o=new Array(4),n&&(-1!==n.indexOf("mp4a.40.29")||-1!==n.indexOf("mp4a.40.5"))||!n&&h>=6?s=h-3:((n&&-1!==n.indexOf("mp4a.40.2")&&(h>=6&&1===a||/vivaldi/i.test(l))||!n&&1===a)&&(i=2,o=new Array(2)),s=h)),o[0]=i<<3,o[0]|=(14&h)>>1,o[1]|=(1&h)<<7,o[1]|=a<<3,5===i&&(o[1]|=(14&s)>>1,o[2]=(1&s)<<7,o[2]|=8,o[3]=0),{config:o,samplerate:c[h],channelCount:a,codec:"mp4a.40."+i,manifestCodec:u};{const e=new Error(`invalid ADTS sampling index:${h}`);t.emit(m.ERROR,m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_PARSING_ERROR,fatal:!0,error:e,reason:e.message})}}(e,r,n,i);if(!s)return;t.config=s.config,t.samplerate=s.samplerate,t.channelCount=s.channelCount,t.codec=s.codec,t.manifestCodec=s.manifestCodec,_.log(`parsed codec:${t.codec}, rate:${s.samplerate}, channels:${s.channelCount}`)}}function vn(t){return 9216e4/t}function mn(t,e,r,n,i){const s=n+i*vn(t.samplerate),a=function(t,e){const r=hn(t,e);if(e+r<=t.length){const n=dn(t,e)-r;if(n>0)return{headerLength:r,frameLength:n}}}(e,r);let o;if(a){const{frameLength:n,headerLength:i}=a,l=i+n,u=Math.max(0,r+l-e.length);u?(o=new Uint8Array(l-i),o.set(e.subarray(r+i,e.length),0)):o=e.subarray(r+i,r+l);const c={unit:o,pts:s};return u||t.samples.push(c),{sample:c,length:l,missing:u}}const l=e.length-r;return o=new Uint8Array(l),o.set(e.subarray(r,e.length),0),{sample:{unit:o,pts:s},length:l,missing:-1}}let yn=null;const En=[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],Sn=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],bn=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],Tn=[0,1,1,4];function _n(t,e,r,n,i){if(r+24>e.length)return;const s=An(e,r);if(s&&r+s.frameLength<=e.length){const a=n+i*(9e4*s.samplesPerFrame/s.sampleRate),o={unit:e.subarray(r,r+s.frameLength),pts:a,dts:a};return t.config=[],t.channelCount=s.channelCount,t.samplerate=s.sampleRate,t.samples.push(o),{sample:o,length:s.frameLength,missing:0}}}function An(t,e){const r=t[e+1]>>3&3,n=t[e+1]>>1&3,i=t[e+2]>>4&15,s=t[e+2]>>2&3;if(1!==r&&0!==i&&15!==i&&3!==s){const a=t[e+2]>>1&1,o=t[e+3]>>6,l=1e3*En[14*(3===r?3-n:3===n?3:4)+i-1],u=Sn[3*(3===r?0:2===r?1:2)+s],c=3===o?1:2,h=bn[r][n],d=Tn[n],f=8*h*d,p=Math.floor(h*l/u+a)*d;if(null===yn){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);yn=t?parseInt(t[1]):0}return!!yn&&yn<=87&&2===n&&l>=224e3&&0===o&&(t[e+3]=128|t[e+3]),{sampleRate:u,channelCount:c,frameLength:p,samplesPerFrame:f}}}function Ln(t,e){return 255===t[e]&&224==(224&t[e+1])&&0!=(6&t[e+1])}function wn(t,e){return e+1<t.length&&Ln(t,e)}function Rn(t,e){if(e+1<t.length&&Ln(t,e)){const r=4,n=An(t,e);let i=r;null!=n&&n.frameLength&&(i=n.frameLength);const s=e+i;return s===t.length||wn(t,s)}return!1}const kn=/\/emsg[-/]ID3/i,Dn=(t,e)=>{let r=0,n=5;e+=n;const i=new Uint32Array(1),s=new Uint32Array(1),a=new Uint8Array(1);for(;n>0;){a[0]=t[e];const o=Math.min(n,8),l=8-o;s[0]=4278190080>>>24+l<<l,i[0]=(a[0]&s[0])>>l,r=r?r<<o|i[0]:i[0],e+=1,n-=o}return r};function In(t,e,r,n,i){if(r+8>e.length)return-1;if(11!==e[r]||119!==e[r+1])return-1;const s=e[r+4]>>6;if(s>=3)return-1;const a=[48e3,44100,32e3][s],o=63&e[r+4],l=2*[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][3*o+s];if(r+l>e.length)return-1;const u=e[r+6]>>5;let c=0;2===u?c+=2:(1&u&&1!==u&&(c+=2),4&u&&(c+=2));const h=(e[r+6]<<8|e[r+7])>>12-c&1,d=[2,1,2,3,3,4,4,5][u]+h,f=e[r+5]>>3,p=7&e[r+5],g=new Uint8Array([s<<6|f<<1|p>>2,(3&p)<<6|u<<3|h<<2|o>>4,o<<4&224]),v=n+i*(1536/a*9e4),m=e.subarray(r,r+l);return t.config=g,t.channelCount=d,t.samplerate=a,t.samples.push({unit:m,pts:v}),l}class Pn{constructor(){this.VideoSample=null}createVideoSample(t,e,r,n){return{key:t,frame:!1,pts:e,dts:r,units:[],debug:n,length:0}}getLastNalUnit(t){var e;let r,n=this.VideoSample;if(n&&0!==n.units.length||(n=t[t.length-1]),null!=(e=n)&&e.units){const t=n.units;r=t[t.length-1]}return r}pushAccessUnit(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){const r=e.samples,n=r.length;if(!n)return void e.dropped++;{const e=r[n-1];t.pts=e.pts,t.dts=e.dts}}e.samples.push(t)}t.debug.length&&_.log(t.pts+"/"+t.dts+":"+t.debug)}}class On{constructor(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}loadWord(){const t=this.data,e=this.bytesAvailable,r=t.byteLength-e,n=new Uint8Array(4),i=Math.min(4,e);if(0===i)throw new Error("no bytes available");n.set(t.subarray(r,r+i)),this.word=new DataView(n.buffer).getUint32(0),this.bitsAvailable=8*i,this.bytesAvailable-=i}skipBits(t){let e;t=Math.min(t,8*this.bytesAvailable+this.bitsAvailable),this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(e=(t-=this.bitsAvailable)>>3,t-=e<<3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}readBits(t){let e=Math.min(this.bitsAvailable,t);const r=this.word>>>32-e;if(t>32&&_.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,e>0&&this.bitsAvailable?r<<e|this.readBits(e):r}skipLZ(){let 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()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const t=this.skipLZ();return this.readBits(t+1)-1}readEG(){const t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}readBoolean(){return 1===this.readBits(1)}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}skipScalingList(t){let e,r=8,n=8;for(let i=0;i<t;i++)0!==n&&(e=this.readEG(),n=(r+e+256)%256),r=0===n?r:n}readSPS(){let t,e,r,n=0,i=0,s=0,a=0;const o=this.readUByte.bind(this),l=this.readBits.bind(this),u=this.readUEG.bind(this),c=this.readBoolean.bind(this),h=this.skipBits.bind(this),d=this.skipEG.bind(this),f=this.skipUEG.bind(this),p=this.skipScalingList.bind(this);o();const g=o();if(l(5),h(3),o(),f(),100===g||110===g||122===g||244===g||44===g||83===g||86===g||118===g||128===g){const t=u();if(3===t&&h(1),f(),f(),h(1),c())for(e=3!==t?8:12,r=0;r<e;r++)c()&&p(r<6?16:64)}f();const v=u();if(0===v)u();else if(1===v)for(h(1),d(),d(),t=u(),r=0;r<t;r++)d();f(),h(1);const m=u(),y=u(),E=l(1);0===E&&h(1),h(1),c()&&(n=u(),i=u(),s=u(),a=u());let S=[1,1];if(c()&&c())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*(m+1)-2*n-2*i),height:(2-E)*(y+1)*16-(E?2:4)*(s+a),pixelRatio:S}}readSliceType(){return this.readUByte(),this.readUEG(),this.readUEG()}}class Cn extends Pn{parseAVCPES(t,e,r,n,i){const s=this.parseAVCNALu(t,r.data);let a,o=this.VideoSample,l=!1;r.data=null,o&&s.length&&!t.audFound&&(this.pushAccessUnit(o,t),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"")),s.forEach((n=>{var s;switch(n.type){case 1:{let e=!1;a=!0;const i=n.data;if(l&&i.length>4){const t=new On(i).readSliceType();2!==t&&4!==t&&7!==t&&9!==t||(e=!0)}var u;e&&null!=(u=o)&&u.frame&&!o.key&&(this.pushAccessUnit(o,t),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.frame=!0,o.key=e;break}case 5:a=!0,null!=(s=o)&&s.frame&&!o.key&&(this.pushAccessUnit(o,t),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts,"")),o.key=!0,o.frame=!0;break;case 6:a=!0,Bt(n.data,1,r.pts,e.samples);break;case 7:{var c,h;a=!0,l=!0;const e=n.data,r=new On(e).readSPS();if(!t.sps||t.width!==r.width||t.height!==r.height||(null==(c=t.pixelRatio)?void 0:c[0])!==r.pixelRatio[0]||(null==(h=t.pixelRatio)?void 0:h[1])!==r.pixelRatio[1]){t.width=r.width,t.height=r.height,t.pixelRatio=r.pixelRatio,t.sps=[e],t.duration=i;const n=e.subarray(1,4);let s="avc1.";for(let t=0;t<3;t++){let e=n[t].toString(16);e.length<2&&(e="0"+e),s+=e}t.codec=s}break}case 8:a=!0,t.pps=[n.data];break;case 9:a=!0,t.audFound=!0,o&&this.pushAccessUnit(o,t),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts,"");break;case 12:a=!0;break;default:a=!1,o&&(o.debug+="unknown NAL "+n.type+" ")}o&&a&&o.units.push(n)})),n&&o&&(this.pushAccessUnit(o,t),this.VideoSample=null)}parseAVCNALu(t,e){const r=e.byteLength;let n=t.naluState||0;const i=n,s=[];let a,o,l,u=0,c=-1,h=0;for(-1===n&&(c=0,h=31&e[0],n=0,u=1);u<r;)if(a=e[u++],n)if(1!==n)if(a)if(1===a){if(o=u-n-1,c>=0){const t={data:e.subarray(c,o),type:h};s.push(t)}else{const r=this.getLastNalUnit(t.samples);r&&(i&&u<=4-i&&r.state&&(r.data=r.data.subarray(0,r.data.byteLength-i)),o>0&&(r.data=Mt(r.data,e.subarray(0,o)),r.state=0))}u<r?(l=31&e[u],c=u,h=l,n=0):n=-1}else n=0;else n=3;else n=a?0:2;else n=a?0:1;if(c>=0&&n>=0){const t={data:e.subarray(c,r),type:h,state:n};s.push(t)}if(0===s.length){const r=this.getLastNalUnit(t.samples);r&&(r.data=Mt(r.data,e))}return t.naluState=n,s}}class xn{constructor(t,e,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new $r(e,{removePKCS7Padding:!1})}decryptBuffer(t){return this.decrypter.decrypt(t,this.keyData.key.buffer,this.keyData.iv.buffer)}decryptAacSample(t,e,r){const n=t[e].unit;if(n.length<=16)return;const i=n.subarray(16,n.length-n.length%16),s=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(s).then((i=>{const s=new Uint8Array(i);n.set(s,16),this.decrypter.isSync()||this.decryptAacSamples(t,e+1,r)}))}decryptAacSamples(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}}getAvcEncryptedData(t){const e=16*Math.floor((t.length-48)/160)+16,r=new Int8Array(e);let n=0;for(let e=32;e<t.length-16;e+=160,n+=16)r.set(t.subarray(e,e+16),n);return r}getAvcDecryptedUnit(t,e){const r=new Uint8Array(e);let n=0;for(let e=32;e<t.length-16;e+=160,n+=16)t.set(r.subarray(n,n+16),e);return t}decryptAvcSample(t,e,r,n,i){const s=Ut(i.data),a=this.getAvcEncryptedData(s);this.decryptBuffer(a.buffer).then((a=>{i.data=this.getAvcDecryptedUnit(s,a),this.decrypter.isSync()||this.decryptAvcSamples(t,e,r+1,n)}))}decryptAvcSamples(t,e,r,n){if(t instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;e++,r=0){if(e>=t.length)return void n();const i=t[e].units;for(;!(r>=i.length);r++){const s=i[r];if(!(s.data.length<=48||1!==s.type&&5!==s.type||(this.decryptAvcSample(t,e,r,n,s),this.decrypter.isSync())))return}}}}const Mn=188;class Fn{constructor(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._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.videoParser=new Cn}static probe(t){const e=Fn.syncOffset(t);return e>0&&_.warn(`MPEG2-TS detected but first sync word found @ offset ${e}`),-1!==e}static syncOffset(t){const e=t.length;let r=Math.min(940,e-Mn)+1,n=0;for(;n<r;){let i=!1,s=-1,a=0;for(let o=n;o<e;o+=Mn){if(71!==t[o]||e-o!==Mn&&71!==t[o+Mn]){if(a)return-1;break}if(a++,-1===s&&(s=o,0!==s&&(r=Math.min(s+18612,t.length-Mn)+1)),i||(i=0===Nn(t,o)),i&&a>1&&(0===s&&a>2||o+Mn>r))return s}n++}return-1}static createTrack(t,e){return{container:"video"===t||"audio"===t?"video/mp2t":void 0,type:t,id:Et[t],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:"audio"===t?e:void 0}}resetInitSegment(t,e,r,n){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Fn.createTrack("video"),this._audioTrack=Fn.createTrack("audio",n),this._id3Track=Fn.createTrack("id3"),this._txtTrack=Fn.createTrack("text"),this._audioTrack.segmentCodec="aac",this.aacOverFlow=null,this.remainderData=null,this.audioCodec=e,this.videoCodec=r,this._duration=n}resetTimeStamp(){}resetContiguity(){const{_audioTrack:t,_videoTrack:e,_id3Track:r}=this;t&&(t.pesData=null),e&&(e.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(t,e,r=!1,n=!1){let i;r||(this.sampleAes=null);const s=this._videoTrack,a=this._audioTrack,o=this._id3Track,l=this._txtTrack;let u=s.pid,c=s.pesData,h=a.pid,d=o.pid,f=a.pesData,p=o.pesData,g=null,v=this.pmtParsed,m=this._pmtId,y=t.length;if(this.remainderData&&(y=(t=Mt(this.remainderData,t)).length,this.remainderData=null),y<Mn&&!n)return this.remainderData=t,{audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};const E=Math.max(0,Fn.syncOffset(t));y-=(y-E)%Mn,y<t.byteLength&&!n&&(this.remainderData=new Uint8Array(t.buffer,y,t.buffer.byteLength-y));let S=0;for(let e=E;e<y;e+=Mn)if(71===t[e]){const n=!!(64&t[e+1]),y=Nn(t,e);let S;if((48&t[e+3])>>4>1){if(S=e+5+t[e+4],S===e+Mn)continue}else S=e+4;switch(y){case u:n&&(c&&(i=Gn(c))&&this.videoParser.parseAVCPES(s,l,i,!1,this._duration),c={data:[],size:0}),c&&(c.data.push(t.subarray(S,e+Mn)),c.size+=e+Mn-S);break;case h:if(n){if(f&&(i=Gn(f)))switch(a.segmentCodec){case"aac":this.parseAACPES(a,i);break;case"mp3":this.parseMPEGPES(a,i);break;case"ac3":this.parseAC3PES(a,i)}f={data:[],size:0}}f&&(f.data.push(t.subarray(S,e+Mn)),f.size+=e+Mn-S);break;case d:n&&(p&&(i=Gn(p))&&this.parseID3PES(o,i),p={data:[],size:0}),p&&(p.data.push(t.subarray(S,e+Mn)),p.size+=e+Mn-S);break;case 0:n&&(S+=t[S]+1),m=this._pmtId=Bn(t,S);break;case m:{n&&(S+=t[S]+1);const i=Un(t,S,this.typeSupported,r,this.observer);u=i.videoPid,u>0&&(s.pid=u,s.segmentCodec=i.segmentVideoCodec),h=i.audioPid,h>0&&(a.pid=h,a.segmentCodec=i.segmentAudioCodec),d=i.id3Pid,d>0&&(o.pid=d),null===g||v||(_.warn(`MPEG-TS PMT found at ${e} after unknown PID '${g}'. Backtracking to sync byte @${E} to parse all TS packets.`),g=null,e=E-188),v=this.pmtParsed=!0;break}case 17:case 8191:break;default:g=y}}else S++;S>0&&jn(this.observer,new Error(`Found ${S} TS packet/s that do not start with 0x47`)),s.pesData=c,a.pesData=f,o.pesData=p;const b={audioTrack:a,videoTrack:s,id3Track:o,textTrack:l};return n&&this.extractRemainingSamples(b),b}flush(){const{remainderData:t}=this;let e;return this.remainderData=null,e=t?this.demux(t,-1,!1,!0):{videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(e),this.sampleAes?this.decrypt(e,this.sampleAes):e}extractRemainingSamples(t){const{audioTrack:e,videoTrack:r,id3Track:n,textTrack:i}=t,s=r.pesData,a=e.pesData,o=n.pesData;let l;if(s&&(l=Gn(s))?(this.videoParser.parseAVCPES(r,i,l,!0,this._duration),r.pesData=null):r.pesData=s,a&&(l=Gn(a))){switch(e.segmentCodec){case"aac":this.parseAACPES(e,l);break;case"mp3":this.parseMPEGPES(e,l);break;case"ac3":this.parseAC3PES(e,l)}e.pesData=null}else null!=a&&a.size&&_.log("last AAC PES packet truncated,might overlap between fragments"),e.pesData=a;o&&(l=Gn(o))?(this.parseID3PES(n,l),n.pesData=null):n.pesData=o}demuxSampleAes(t,e,r){const n=this.demux(t,r,!0,!this.config.progressive),i=this.sampleAes=new xn(this.observer,this.config,e);return this.decrypt(n,i)}decrypt(t,e){return new Promise((r=>{const{audioTrack:n,videoTrack:i}=t;n.samples&&"aac"===n.segmentCodec?e.decryptAacSamples(n.samples,0,(()=>{i.samples?e.decryptAvcSamples(i.samples,0,0,(()=>{r(t)})):r(t)})):i.samples&&e.decryptAvcSamples(i.samples,0,0,(()=>{r(t)}))}))}destroy(){this._duration=0}parseAACPES(t,e){let r=0;const n=this.aacOverFlow;let i,s,a,o=e.data;if(n){this.aacOverFlow=null;const e=n.missing,i=n.sample.unit.byteLength;if(-1===e)o=Mt(n.sample.unit,o);else{const s=i-e;n.sample.unit.set(o.subarray(0,e),s),t.samples.push(n.sample),r=n.missing}}for(i=r,s=o.length;i<s-1&&!fn(o,i);i++);if(i!==r){let t;const e=i<s-1;if(t=e?`AAC PES did not start with ADTS header,offset:${i}`:"No ADTS header found in AAC PES",jn(this.observer,new Error(t),e),!e)return}if(gn(t,this.observer,o,i,this.audioCodec),void 0!==e.pts)a=e.pts;else{if(!n)return void _.warn("[tsdemuxer]: AAC PES unknown PTS");{const e=vn(t.samplerate);a=n.sample.pts+e}}let l,u=0;for(;i<s;){if(l=mn(t,o,i,a,u),i+=l.length,l.missing){this.aacOverFlow=l;break}for(u++;i<s-1&&!fn(o,i);i++);}}parseMPEGPES(t,e){const r=e.data,n=r.length;let i=0,s=0;const a=e.pts;if(void 0!==a)for(;s<n;)if(wn(r,s)){const e=_n(t,r,s,a,i);if(!e)break;s+=e.length,i++}else s++;else _.warn("[tsdemuxer]: MPEG PES unknown PTS")}parseAC3PES(t,e){{const r=e.data,n=e.pts;if(void 0===n)return void _.warn("[tsdemuxer]: AC3 PES unknown PTS");const i=r.length;let s,a=0,o=0;for(;o<i&&(s=In(t,r,o,n,a++))>0;)o+=s}}parseID3PES(t,e){if(void 0===e.pts)return void _.warn("[tsdemuxer]: ID3 PES unknown PTS");const r=f({},e,{type:this._videoTrack?Me:xe,duration:Number.POSITIVE_INFINITY});t.samples.push(r)}}function Nn(t,e){return((31&t[e+1])<<8)+t[e+2]}function Bn(t,e){return(31&t[e+10])<<8|t[e+11]}function Un(t,e,r,n,i){const s={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},a=e+3+((15&t[e+1])<<8|t[e+2])-4;for(e+=12+((15&t[e+10])<<8|t[e+11]);e<a;){const a=Nn(t,e),o=(15&t[e+3])<<8|t[e+4];switch(t[e]){case 207:if(!n){Hn("ADTS AAC");break}case 15:-1===s.audioPid&&(s.audioPid=a);break;case 21:-1===s.id3Pid&&(s.id3Pid=a);break;case 219:if(!n){Hn("H.264");break}case 27:-1===s.videoPid&&(s.videoPid=a,s.segmentVideoCodec="avc");break;case 3:case 4:r.mpeg||r.mp3?-1===s.audioPid&&(s.audioPid=a,s.segmentAudioCodec="mp3"):_.log("MPEG audio found, not supported in this browser");break;case 193:if(!n){Hn("AC-3");break}case 129:r.ac3?-1===s.audioPid&&(s.audioPid=a,s.segmentAudioCodec="ac3"):_.log("AC-3 audio found, not supported in this browser");break;case 6:if(-1===s.audioPid&&o>0){let n=e+5,i=o;for(;i>2;){106===t[n]&&(!0!==r.ac3?_.log("AC-3 audio found, not supported in this browser for now"):(s.audioPid=a,s.segmentAudioCodec="ac3"));const e=t[n+1]+2;n+=e,i-=e}}break;case 194:case 135:return jn(i,new Error("Unsupported EC-3 in M2TS found")),s;case 36:return jn(i,new Error("Unsupported HEVC in M2TS found")),s}e+=o+5}return s}function jn(t,e,r){_.warn(`parsing error: ${e.message}`),t.emit(m.ERROR,m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,error:e,reason:e.message})}function Hn(t){_.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function Gn(t){let e,r,n,i,s,a=0;const o=t.data;if(!t||0===t.size)return null;for(;o[0].length<19&&o.length>1;)o[0]=Mt(o[0],o[1]),o.splice(1,1);if(e=o[0],1===(e[0]<<16)+(e[1]<<8)+e[2]){if(r=(e[4]<<8)+e[5],r&&r>t.size-6)return null;const l=e[7];192&l&&(i=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&l?(s=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,i-s>54e5&&(_.warn(`${Math.round((i-s)/9e4)}s delta between PTS and DTS, align them`),i=s)):s=i),n=e[8];let u=n+9;if(t.size<=u)return null;t.size-=u;const c=new Uint8Array(t.size);for(let t=0,r=o.length;t<r;t++){e=o[t];let r=e.byteLength;if(u){if(u>r){u-=r;continue}e=e.subarray(u),r-=u,u=0}c.set(e,a),a+=r}return r&&(r-=n+3),{data:c,pts:i,dts:s,len:r}}return null}class Vn{static getSilentFrame(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])}}}const Kn=Math.pow(2,32)-1;class $n{static init(){let t;for(t in $n.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},$n.types)$n.types.hasOwnProperty(t)&&($n.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);const e=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=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]);$n.HDLR_TYPES={video:e,audio:r};const n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);$n.STTS=$n.STSC=$n.STCO=i,$n.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),$n.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),$n.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),$n.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const s=new Uint8Array([105,115,111,109]),a=new Uint8Array([97,118,99,49]),o=new Uint8Array([0,0,0,1]);$n.FTYP=$n.box($n.types.ftyp,s,o,s,a),$n.DINF=$n.box($n.types.dinf,$n.box($n.types.dref,n))}static box(t,...e){let r=8,n=e.length;const i=n;for(;n--;)r+=e[n].byteLength;const s=new Uint8Array(r);for(s[0]=r>>24&255,s[1]=r>>16&255,s[2]=r>>8&255,s[3]=255&r,s.set(t,4),n=0,r=8;n<i;n++)s.set(e[n],r),r+=e[n].byteLength;return s}static hdlr(t){return $n.box($n.types.hdlr,$n.HDLR_TYPES[t])}static mdat(t){return $n.box($n.types.mdat,t)}static mdhd(t,e){e*=t;const r=Math.floor(e/(Kn+1)),n=Math.floor(e%(Kn+1));return $n.box($n.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))}static mdia(t){return $n.box($n.types.mdia,$n.mdhd(t.timescale,t.duration),$n.hdlr(t.type),$n.minf(t))}static mfhd(t){return $n.box($n.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}static minf(t){return"audio"===t.type?$n.box($n.types.minf,$n.box($n.types.smhd,$n.SMHD),$n.DINF,$n.stbl(t)):$n.box($n.types.minf,$n.box($n.types.vmhd,$n.VMHD),$n.DINF,$n.stbl(t))}static moof(t,e,r){return $n.box($n.types.moof,$n.mfhd(t),$n.traf(r,e))}static moov(t){let e=t.length;const r=[];for(;e--;)r[e]=$n.trak(t[e]);return $n.box.apply(null,[$n.types.moov,$n.mvhd(t[0].timescale,t[0].duration)].concat(r).concat($n.mvex(t)))}static mvex(t){let e=t.length;const r=[];for(;e--;)r[e]=$n.trex(t[e]);return $n.box.apply(null,[$n.types.mvex,...r])}static mvhd(t,e){e*=t;const r=Math.floor(e/(Kn+1)),n=Math.floor(e%(Kn+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,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 $n.box($n.types.mvhd,i)}static sdtp(t){const e=t.samples||[],r=new Uint8Array(4+e.length);let n,i;for(n=0;n<e.length;n++)i=e[n].flags,r[n+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return $n.box($n.types.sdtp,r)}static stbl(t){return $n.box($n.types.stbl,$n.stsd(t),$n.box($n.types.stts,$n.STTS),$n.box($n.types.stsc,$n.STSC),$n.box($n.types.stsz,$n.STSZ),$n.box($n.types.stco,$n.STCO))}static avc1(t){let e,r,n,i=[],s=[];for(e=0;e<t.sps.length;e++)r=t.sps[e],n=r.byteLength,i.push(n>>>8&255),i.push(255&n),i=i.concat(Array.prototype.slice.call(r));for(e=0;e<t.pps.length;e++)r=t.pps[e],n=r.byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(r));const a=$n.box($n.types.avcC,new Uint8Array([1,i[3],i[4],i[5],255,224|t.sps.length].concat(i).concat([t.pps.length]).concat(s))),o=t.width,l=t.height,u=t.pixelRatio[0],c=t.pixelRatio[1];return $n.box($n.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,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]),a,$n.box($n.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),$n.box($n.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,255&u,c>>24,c>>16&255,c>>8&255,255&c])))}static esds(t){const 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]))}static audioStsd(t){const e=t.samplerate;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,e>>8&255,255&e,0,0])}static mp4a(t){return $n.box($n.types.mp4a,$n.audioStsd(t),$n.box($n.types.esds,$n.esds(t)))}static mp3(t){return $n.box($n.types[".mp3"],$n.audioStsd(t))}static ac3(t){return $n.box($n.types["ac-3"],$n.audioStsd(t),$n.box($n.types.dac3,t.config))}static stsd(t){return"audio"===t.type?"mp3"===t.segmentCodec&&"mp3"===t.codec?$n.box($n.types.stsd,$n.STSD,$n.mp3(t)):"ac3"===t.segmentCodec?$n.box($n.types.stsd,$n.STSD,$n.ac3(t)):$n.box($n.types.stsd,$n.STSD,$n.mp4a(t)):$n.box($n.types.stsd,$n.STSD,$n.avc1(t))}static tkhd(t){const e=t.id,r=t.duration*t.timescale,n=t.width,i=t.height,s=Math.floor(r/(Kn+1)),a=Math.floor(r%(Kn+1));return $n.box($n.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,0,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,a>>24,a>>16&255,a>>8&255,255&a,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,i>>8&255,255&i,0,0]))}static traf(t,e){const r=$n.sdtp(t),n=t.id,i=Math.floor(e/(Kn+1)),s=Math.floor(e%(Kn+1));return $n.box($n.types.traf,$n.box($n.types.tfhd,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),$n.box($n.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,s>>24,s>>16&255,s>>8&255,255&s])),$n.trun(t,r.length+16+20+8+16+8+8),r)}static trak(t){return t.duration=t.duration||4294967295,$n.box($n.types.trak,$n.tkhd(t),$n.mdia(t))}static trex(t){const e=t.id;return $n.box($n.types.trex,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(t,e){const r=t.samples||[],n=r.length,i=12+16*n,s=new Uint8Array(i);let a,o,l,u,c,h;for(e+=8+i,s.set(["video"===t.type?1:0,0,15,1,n>>>24&255,n>>>16&255,n>>>8&255,255&n,e>>>24&255,e>>>16&255,e>>>8&255,255&e],0),a=0;a<n;a++)o=r[a],l=o.duration,u=o.size,c=o.flags,h=o.cts,s.set([l>>>24&255,l>>>16&255,l>>>8&255,255&l,u>>>24&255,u>>>16&255,u>>>8&255,255&u,c.isLeading<<2|c.dependsOn,c.isDependedOn<<6|c.hasRedundancy<<4|c.paddingValue<<1|c.isNonSync,61440&c.degradPrio,15&c.degradPrio,h>>>24&255,h>>>16&255,h>>>8&255,255&h],12+16*a);return $n.box($n.types.trun,s)}static initSegment(t){$n.types||$n.init();const e=$n.moov(t);return Mt($n.FTYP,e)}}$n.types=void 0,$n.HDLR_TYPES=void 0,$n.STTS=void 0,$n.STSC=void 0,$n.STCO=void 0,$n.STSZ=void 0,$n.VMHD=void 0,$n.SMHD=void 0,$n.STSD=void 0,$n.FTYP=void 0,$n.DINF=void 0;function Wn(t,e,r=1,n=!1){const i=t*e*r;return n?Math.round(i):i}function qn(t,e=!1){return Wn(t,1e3,1/9e4,e)}let Yn,zn=null,Xn=null;class Jn{constructor(t,e,r,n=""){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.videoTrackConfig=void 0,this.observer=t,this.config=e,this.typeSupported=r,this.ISGenerated=!1,null===zn){const t=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);zn=t?parseInt(t[1]):0}if(null===Xn){const t=navigator.userAgent.match(/Safari\/(\d+)/i);Xn=t?parseInt(t[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(t){_.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t}resetNextTimestamp(){_.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){_.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(t){let e=!1;const r=t.reduce(((t,r)=>{const n=r.pts-t;return n<-4294967296?(e=!0,Qn(t,r.pts)):n>0?t:r.pts}),t[0].pts);return e&&_.debug("PTS rollover detected"),r}remux(t,e,r,n,i,s,a,o){let l,u,c,h,d,f,p=i,g=i;const v=t.pid>-1,m=e.pid>-1,y=e.samples.length,E=t.samples.length>0,S=a&&y>0||y>1;if((!v||E)&&(!m||S)||this.ISGenerated||a){if(this.ISGenerated){var b,T,A,L;const t=this.videoTrackConfig;!t||e.width===t.width&&e.height===t.height&&(null==(b=e.pixelRatio)?void 0:b[0])===(null==(T=t.pixelRatio)?void 0:T[0])&&(null==(A=e.pixelRatio)?void 0:A[1])===(null==(L=t.pixelRatio)?void 0:L[1])||this.resetInitSegment()}else c=this.generateIS(t,e,i,s);const r=this.isVideoContiguous;let n,a=-1;if(S&&(a=function(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}(e.samples),!r&&this.config.forceKeyFrameOnDiscontinuity))if(f=!0,a>0){_.warn(`[mp4-remuxer]: Dropped ${a} out of ${y} video samples due to a missing keyframe`);const t=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(a),e.dropped+=a,g+=(e.samples[0].pts-t)/e.inputTimeScale,n=g}else-1===a&&(_.warn(`[mp4-remuxer]: No keyframe found out of ${y} video samples`),f=!1);if(this.ISGenerated){if(E&&S){const r=this.getVideoStartPts(e.samples),n=(Qn(t.samples[0].pts,r)-r)/e.inputTimeScale;p+=Math.max(0,n),g+=Math.max(0,-n)}if(E){if(t.samplerate||(_.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),c=this.generateIS(t,e,i,s)),u=this.remuxAudio(t,p,this.isAudioContiguous,s,m||S||o===Ae?g:void 0),S){const n=u?u.endPTS-u.startPTS:0;e.inputTimeScale||(_.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),c=this.generateIS(t,e,i,s)),l=this.remuxVideo(e,g,r,n)}}else S&&(l=this.remuxVideo(e,g,r,0));l&&(l.firstKeyFrame=a,l.independent=-1!==a,l.firstKeyFramePTS=n)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(d=Zn(r,i,this._initPTS,this._initDTS)),n.samples.length&&(h=ti(n,i,this._initPTS))),{audio:u,video:l,initSegment:c,independent:f,text:h,id3:d}}generateIS(t,e,r,n){const i=t.samples,s=e.samples,a=this.typeSupported,o={},l=this._initPTS;let u,c,h,d=!l||n,f="audio/mp4";if(d&&(u=c=1/0),t.config&&i.length){switch(t.timescale=t.samplerate,t.segmentCodec){case"mp3":a.mpeg?(f="audio/mpeg",t.codec=""):a.mp3&&(t.codec="mp3");break;case"ac3":t.codec="ac-3"}o.audio={id:"audio",container:f,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&a.mpeg?new Uint8Array(0):$n.initSegment([t]),metadata:{channelCount:t.channelCount}},d&&(h=t.inputTimeScale,l&&h===l.timescale?d=!1:u=c=i[0].pts-Math.round(h*r))}if(e.sps&&e.pps&&s.length){if(e.timescale=e.inputTimeScale,o.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:$n.initSegment([e]),metadata:{width:e.width,height:e.height}},d)if(h=e.inputTimeScale,l&&h===l.timescale)d=!1;else{const t=this.getVideoStartPts(s),e=Math.round(h*r);c=Math.min(c,Qn(s[0].dts,t)-e),u=Math.min(u,t-e)}this.videoTrackConfig={width:e.width,height:e.height,pixelRatio:e.pixelRatio}}if(Object.keys(o).length)return this.ISGenerated=!0,d?(this._initPTS={baseTime:u,timescale:h},this._initDTS={baseTime:c,timescale:h}):u=h=void 0,{tracks:o,initPTS:u,timescale:h}}remuxVideo(t,e,r,n){const i=t.inputTimeScale,s=t.samples,a=[],o=s.length,l=this._initPTS;let u,c,h=this.nextAvcDts,d=8,p=this.videoSampleDuration,g=Number.POSITIVE_INFINITY,v=Number.NEGATIVE_INFINITY,S=!1;if(!r||null===h){const t=e*i,n=s[0].pts-Qn(s[0].dts,s[0].pts);zn&&null!==h&&Math.abs(t-n-h)<15e3?r=!0:h=t-n}const b=l.baseTime*i/l.timescale;for(let t=0;t<o;t++){const e=s[t];e.pts=Qn(e.pts-b,h),e.dts=Qn(e.dts-b,h),e.dts<s[t>0?t-1:t].dts&&(S=!0)}S&&s.sort((function(t,e){const r=t.dts-e.dts,n=t.pts-e.pts;return r||n})),u=s[0].dts,c=s[s.length-1].dts;const T=c-u,A=T?Math.round(T/(o-1)):p||t.inputTimeScale/30;if(r){const t=u-h,r=t>A,n=t<-1;if((r||n)&&(r?_.warn(`AVC: ${qn(t,!0)} ms (${t}dts) hole between fragments detected at ${e.toFixed(3)}`):_.warn(`AVC: ${qn(-t,!0)} ms (${t}dts) overlapping between fragments detected at ${e.toFixed(3)}`),!n||h>=s[0].pts||zn)){u=h;const e=s[0].pts-t;if(r)s[0].dts=u,s[0].pts=e;else for(let r=0;r<s.length&&!(s[r].dts>e);r++)s[r].dts-=t,s[r].pts-=t;_.log(`Video: Initial PTS/DTS adjusted: ${qn(e,!0)}/${qn(u,!0)}, delta: ${qn(t,!0)} ms`)}}u=Math.max(0,u);let L=0,w=0,R=u;for(let t=0;t<o;t++){const e=s[t],r=e.units,n=r.length;let i=0;for(let t=0;t<n;t++)i+=r[t].data.length;w+=i,L+=n,e.length=i,e.dts<R?(e.dts=R,R+=A/4|0||1):R=e.dts,g=Math.min(e.pts,g),v=Math.max(e.pts,v)}c=s[o-1].dts;const k=w+4*L+8;let D;try{D=new Uint8Array(k)}catch(t){return void this.observer.emit(m.ERROR,m.ERROR,{type:y.MUX_ERROR,details:E.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:k,reason:`fail allocating video mdat ${k}`})}const I=new DataView(D.buffer);I.setUint32(0,k),D.set($n.types.mdat,4);let P=!1,O=Number.POSITIVE_INFINITY,C=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,M=Number.NEGATIVE_INFINITY;for(let t=0;t<o;t++){const e=s[t],r=e.units;let l,u=0;for(let t=0,e=r.length;t<e;t++){const e=r[t],n=e.data,i=e.data.byteLength;I.setUint32(d,i),d+=4,D.set(n,d),d+=i,u+=4+i}if(t<o-1)p=s[t+1].dts-e.dts,l=s[t+1].pts-e.pts;else{const r=this.config,a=t>0?e.dts-s[t-1].dts:A;if(l=t>0?e.pts-s[t-1].pts:A,r.stretchShortVideoTrack&&null!==this.nextAudioPts){const t=Math.floor(r.maxBufferHole*i),s=(n?g+n*i:this.nextAudioPts)-e.pts;s>t?(p=s-a,p<0?p=a:P=!0,_.log(`[mp4-remuxer]: It is approximately ${s/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=a}else p=a}const c=Math.round(e.pts-e.dts);O=Math.min(O,p),x=Math.max(x,p),C=Math.min(C,l),M=Math.max(M,l),a.push(new ei(e.key,p,u,c))}if(a.length)if(zn){if(zn<70){const t=a[0].flags;t.dependsOn=2,t.isNonSync=0}}else if(Xn&&M-C<x-O&&A/x<.025&&0===a[0].cts){_.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let t=u;for(let e=0,r=a.length;e<r;e++){const n=t+a[e].duration,i=t+a[e].cts;if(e<r-1){const t=n+a[e+1].cts;a[e].duration=t-i}else a[e].duration=e?a[e-1].duration:A;a[e].cts=0,t=n}}p=P||!p?A:p,this.nextAvcDts=h=c+p,this.videoSampleDuration=p,this.isVideoContiguous=!0;const F={data1:$n.moof(t.sequenceNumber++,u,f({},t,{samples:a})),data2:D,startPTS:g/i,endPTS:(v+p)/i,startDTS:u/i,endDTS:h/i,type:"video",hasAudio:!1,hasVideo:!0,nb:a.length,dropped:t.dropped};return t.samples=[],t.dropped=0,F}getSamplesPerFrame(t){switch(t.segmentCodec){case"mp3":return 1152;case"ac3":return 1536;default:return 1024}}remuxAudio(t,e,r,n,i){const s=t.inputTimeScale,a=s/(t.samplerate?t.samplerate:s),o=this.getSamplesPerFrame(t),l=o*a,u=this._initPTS,c="mp3"===t.segmentCodec&&this.typeSupported.mpeg,h=[],d=void 0!==i;let p=t.samples,g=c?0:8,v=this.nextAudioPts||-1;const S=e*s,b=u.baseTime*s/u.timescale;if(this.isAudioContiguous=r=r||p.length&&v>0&&(n&&Math.abs(S-v)<9e3||Math.abs(Qn(p[0].pts-b,S)-v)<20*l),p.forEach((function(t){t.pts=Qn(t.pts-b,S)})),!r||v<0){if(p=p.filter((t=>t.pts>=0)),!p.length)return;v=0===i?0:n&&!d?Math.max(0,S):p[0].pts}if("aac"===t.segmentCodec){const e=this.config.maxAudioFramesDrift;for(let r=0,n=v;r<p.length;r++){const i=p[r],a=i.pts,o=a-n,u=Math.abs(1e3*o/s);if(o<=-e*l&&d)0===r&&(_.warn(`Audio frame @ ${(a/s).toFixed(3)}s overlaps nextAudioPts by ${Math.round(1e3*o/s)} ms.`),this.nextAudioPts=v=n=a);else if(o>=e*l&&u<1e4&&d){let e=Math.round(o/l);n=a-e*l,n<0&&(e--,n+=l),0===r&&(this.nextAudioPts=v=n),_.warn(`[mp4-remuxer]: Injecting ${e} audio frame @ ${(n/s).toFixed(3)}s due to ${Math.round(1e3*o/s)} ms gap.`);for(let s=0;s<e;s++){const e=Math.max(n,0);let s=Vn.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);s||(_.log("[mp4-remuxer]: Unable to get silent frame for given audio codec; duplicating last frame instead."),s=i.unit.subarray()),p.splice(r,0,{unit:s,pts:e}),n+=l,r++}}i.pts=n,n+=l}}let T,A=null,L=null,w=0,R=p.length;for(;R--;)w+=p[R].unit.byteLength;for(let e=0,n=p.length;e<n;e++){const n=p[e],i=n.unit;let s=n.pts;if(null!==L)h[e-1].duration=Math.round((s-L)/a);else{if(r&&"aac"===t.segmentCodec&&(s=v),A=s,!(w>0))return;w+=g;try{T=new Uint8Array(w)}catch(t){return void this.observer.emit(m.ERROR,m.ERROR,{type:y.MUX_ERROR,details:E.REMUX_ALLOC_ERROR,fatal:!1,error:t,bytes:w,reason:`fail allocating audio mdat ${w}`})}c||(new DataView(T.buffer).setUint32(0,w),T.set($n.types.mdat,4))}T.set(i,g);const l=i.byteLength;g+=l,h.push(new ei(!0,o,l,0)),L=s}const k=h.length;if(!k)return;const D=h[h.length-1];this.nextAudioPts=v=L+a*D.duration;const I=c?new Uint8Array(0):$n.moof(t.sequenceNumber++,A/a,f({},t,{samples:h}));t.samples=[];const P=A/s,O=v/s,C={data1:I,data2:T,startPTS:P,endPTS:O,startDTS:P,endDTS:O,type:"audio",hasAudio:!0,hasVideo:!1,nb:k};return this.isAudioContiguous=!0,C}remuxEmptyAudio(t,e,r,n){const i=t.inputTimeScale,s=i/(t.samplerate?t.samplerate:i),a=this.nextAudioPts,o=this._initDTS,l=9e4*o.baseTime/o.timescale,u=(null!==a?a:n.startDTS*i)+l,c=n.endDTS*i+l,h=1024*s,d=Math.ceil((c-u)/h),f=Vn.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(_.warn("[mp4-remuxer]: remux empty Audio"),!f)return void _.trace("[mp4-remuxer]: Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec");const p=[];for(let t=0;t<d;t++){const e=u+t*h;p.push({unit:f,pts:e,dts:e})}return t.samples=p,this.remuxAudio(t,e,r,!1)}}function Qn(t,e){let r;if(null===e)return t;for(r=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=r;return t}function Zn(t,e,r,n){const i=t.samples.length;if(!i)return;const s=t.inputTimeScale;for(let a=0;a<i;a++){const i=t.samples[a];i.pts=Qn(i.pts-r.baseTime*s/r.timescale,e*s)/s,i.dts=Qn(i.dts-n.baseTime*s/n.timescale,e*s)/s}const a=t.samples;return t.samples=[],{samples:a}}function ti(t,e,r){const n=t.samples.length;if(!n)return;const i=t.inputTimeScale;for(let s=0;s<n;s++){const n=t.samples[s];n.pts=Qn(n.pts-r.baseTime*i/r.timescale,e*i)/i}t.samples.sort(((t,e)=>t.pts-e.pts));const s=t.samples;return t.samples=[],{samples:s}}class ei{constructor(t,e,r,n){this.size=void 0,this.duration=void 0,this.cts=void 0,this.flags=void 0,this.duration=e,this.size=r,this.cts=n,this.flags={isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}function ri(t,e){const r=null==t?void 0:t.codec;if(r&&r.length>4)return r;if(e===I){if("ec-3"===r||"ac-3"===r||"alac"===r)return r;if("fLaC"===r||"Opus"===r)return ie(r,!1);const t="mp4a.40.5";return _.info(`Parsed audio codec "${r}" or audio object type not handled. Using "${t}"`),t}return _.warn(`Unhandled video codec "${r}"`),"hvc1"===r||"hev1"===r?"hvc1.1.6.L120.90":"av01"===r?"av01.0.04M.08":"avc1.42e01e"}try{Yn=self.performance.now.bind(self.performance)}catch(t){_.debug("Unable to use Performance API on this environment"),Yn=null==U?void 0:U.Date.now}const ni=[{demux:class{constructor(t,e){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=e}resetTimeStamp(){}resetInitSegment(t,e,r,n){const i=this.videoTrack=on("video",1),s=this.audioTrack=on("audio",1),a=this.txtTrack=on("text",1);if(this.id3Track=on("id3",1),this.timeOffset=0,null==t||!t.byteLength)return;const o=kt(t);if(o.video){const{id:t,timescale:e,codec:r}=o.video;i.id=t,i.timescale=a.timescale=e,i.codec=r}if(o.audio){const{id:t,timescale:e,codec:r}=o.audio;s.id=t,s.timescale=e,s.codec=r}a.id=Et.text,i.sampleDuration=0,i.duration=s.duration=n}resetContiguity(){this.remainderData=null}static probe(t){return function(t){const e=t.byteLength;for(let r=0;r<e;){const n=Tt(t,r);if(n>8&&109===t[r+4]&&111===t[r+5]&&111===t[r+6]&&102===t[r+7])return!0;r=n>1?r+n:e}return!1}(t)}demux(t,e){this.timeOffset=e;let r=t;const n=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Mt(this.remainderData,t));const e=function(t){const e={valid:null,remainder:null},r=wt(t,["moof"]);if(r.length<2)return e.remainder=t,e;const n=r[r.length-1];return e.valid=Q(t,0,n.byteOffset-8),e.remainder=Q(t,n.byteOffset-8),e}(r);this.remainderData=e.remainder,n.samples=e.valid||new Uint8Array}else n.samples=r;const s=this.extractID3Track(n,e);return i.samples=Ft(e,n),{videoTrack:n,audioTrack:this.audioTrack,id3Track:s,textTrack:this.txtTrack}}flush(){const t=this.timeOffset,e=this.videoTrack,r=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;const n=this.extractID3Track(e,this.timeOffset);return r.samples=Ft(t,e),{videoTrack:e,audioTrack:on(),id3Track:n,textTrack:on()}}extractID3Track(t,e){const r=this.id3Track;if(t.samples.length){const n=wt(t.samples,["emsg"]);n&&n.forEach((t=>{const n=function(t){const e=t[0];let r="",n="",i=0,s=0,a=0,o=0,l=0,u=0;if(0===e){for(;"\0"!==St(t.subarray(u,u+1));)r+=St(t.subarray(u,u+1)),u+=1;for(r+=St(t.subarray(u,u+1)),u+=1;"\0"!==St(t.subarray(u,u+1));)n+=St(t.subarray(u,u+1)),u+=1;n+=St(t.subarray(u,u+1)),u+=1,i=Tt(t,12),s=Tt(t,16),o=Tt(t,20),l=Tt(t,24),u=28}else if(1===e){u+=4,i=Tt(t,u),u+=4;const e=Tt(t,u);u+=4;const s=Tt(t,u);for(u+=4,a=2**32*e+s,g(a)||(a=Number.MAX_SAFE_INTEGER,_.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=Tt(t,u),u+=4,l=Tt(t,u),u+=4;"\0"!==St(t.subarray(u,u+1));)r+=St(t.subarray(u,u+1)),u+=1;for(r+=St(t.subarray(u,u+1)),u+=1;"\0"!==St(t.subarray(u,u+1));)n+=St(t.subarray(u,u+1)),u+=1;n+=St(t.subarray(u,u+1)),u+=1}return{schemeIdUri:r,value:n,timeScale:i,presentationTime:a,presentationTimeDelta:s,eventDuration:o,id:l,payload:t.subarray(u,t.byteLength)}}(t);if(kn.test(n.schemeIdUri)){const t=p(n.presentationTime)?n.presentationTime/n.timeScale:e+n.presentationTimeDelta/n.timeScale;let i=4294967295===n.eventDuration?Number.POSITIVE_INFINITY:n.eventDuration/n.timeScale;i<=.001&&(i=Number.POSITIVE_INFINITY);const s=n.payload;r.samples.push({data:s,len:s.byteLength,dts:t,pts:t,type:Me,duration:i})}}))}return r}demuxSampleAes(t,e,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){}},remux:class{constructor(){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}destroy(){}resetTimeStamp(t){this.initPTS=t,this.lastEndTime=null}resetNextTimestamp(){this.lastEndTime=null}resetInitSegment(t,e,r,n){this.audioCodec=e,this.videoCodec=r,this.generateInitSegment(function(t,e){if(!t||!e)return t;const r=e.keyId;return r&&e.isCommonEncryption&&wt(t,["moov","trak"]).forEach((t=>{const e=wt(t,["mdia","minf","stbl","stsd"])[0].subarray(8);let n=wt(e,["enca"]);const i=n.length>0;i||(n=wt(e,["encv"])),n.forEach((t=>{wt(i?t.subarray(28):t.subarray(78),["sinf"]).forEach((t=>{const e=Ct(t);if(e){const t=e.subarray(8,24);t.some((t=>0!==t))||(_.log(`[eme] Patching keyId in 'enc${i?"a":"v"}>sinf>>tenc' box: ${vt(t)} -> ${vt(r)}`),e.set(r,8))}}))}))})),t}(t,n)),this.emitInitSegment=!0}generateInitSegment(t){let{audioCodec:e,videoCodec:r}=this;if(null==t||!t.byteLength)return this.initTracks=void 0,void(this.initData=void 0);const n=this.initData=kt(t);n.audio&&(e=ri(n.audio,I)),n.video&&(r=ri(n.video,P));const i={};n.audio&&n.video?i.audiovideo={container:"video/mp4",codec:e+","+r,initSegment:t,id:"main"}:n.audio?i.audio={container:"audio/mp4",codec:e,initSegment:t,id:"audio"}:n.video?i.video={container:"video/mp4",codec:r,initSegment:t,id:"main"}:_.warn("[passthrough-remuxer.ts]: initSegment does not contain moov or trak boxes."),this.initTracks=i}remux(t,e,r,n,i,s){var a,o;let{initPTS:l,lastEndTime:u}=this;const c={audio:void 0,video:void 0,text:n,id3:r,initSegment:void 0};p(u)||(u=this.lastEndTime=i||0);const h=e.samples;if(null==h||!h.length)return c;const d={initPTS:void 0,timescale:1};let f=this.initData;if(null!=(a=f)&&a.length||(this.generateInitSegment(h),f=this.initData),null==(o=f)||!o.length)return _.warn("[passthrough-remuxer.ts]: Failed to generate initSegment."),c;this.emitInitSegment&&(d.tracks=this.initTracks,this.emitInitSegment=!1);const g=function(t,e){let r=0,n=0,i=0;const s=wt(t,["moof","traf"]);for(let t=0;t<s.length;t++){const a=s[t],o=wt(a,["tfhd"])[0],l=e[Tt(o,4)];if(!l)continue;const u=l.default,c=Tt(o,0)|(null==u?void 0:u.flags);let h=null==u?void 0:u.duration;8&c&&(h=Tt(o,2&c?12:8));const d=l.timescale||9e4,f=wt(a,["trun"]);for(let t=0;t<f.length;t++)r=xt(f[t]),!r&&h&&(r=h*Tt(f[t],4)),l.type===P?n+=r/d:l.type===I&&(i+=r/d)}if(0===n&&0===i){let e=1/0,r=0,n=0;const i=wt(t,["sidx"]);for(let t=0;t<i.length;t++){const s=Rt(i[t]);if(null!=s&&s.references){e=Math.min(e,s.earliestPresentationTime/s.timescale);const t=s.references.reduce(((t,e)=>t+e.info.duration||0),0);r=Math.max(r,t+s.earliestPresentationTime/s.timescale),n=r-e}}if(n&&p(n))return n}return n||i}(h,f),v=function(t,e){return wt(e,["moof","traf"]).reduce(((e,r)=>{const n=wt(r,["tfdt"])[0],i=n[0],s=wt(r,["tfhd"]).reduce(((e,r)=>{const s=Tt(r,4),a=t[s];if(a){let t=Tt(n,4);if(1===i){if(t===mt)return _.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"),e;t*=mt+1,t+=Tt(n,8)}const r=t/(a.timescale||9e4);if(p(r)&&(null===e||r<e))return r}return e}),null);return null!==s&&p(s)&&(null===e||s<e)?s:e}),null)}(f,h),m=null===v?i:v;(function(t,e,r,n){if(null===t)return!0;const i=Math.max(n,1),s=e-t.baseTime/t.timescale;return Math.abs(s-r)>i}(l,m,i,g)||d.timescale!==l.timescale&&s)&&(d.initPTS=m-i,l&&1===l.timescale&&_.warn("Adjusting initPTS by "+(d.initPTS-l.baseTime)),this.initPTS=l={baseTime:d.initPTS,timescale:1});const y=t?m-l.baseTime/l.timescale:u,E=y+g;!function(t,e,r){wt(e,["moof","traf"]).forEach((e=>{wt(e,["tfhd"]).forEach((n=>{const i=Tt(n,4),s=t[i];if(!s)return;const a=s.timescale||9e4;wt(e,["tfdt"]).forEach((t=>{const e=t[0],n=r*a;if(n){let r=Tt(t,4);if(0===e)r-=n,r=Math.max(r,0),Lt(t,4,r);else{r*=Math.pow(2,32),r+=Tt(t,8),r-=n,r=Math.max(r,0);const e=Math.floor(r/(mt+1)),i=Math.floor(r%(mt+1));Lt(t,4,e),Lt(t,8,i)}}}))}))}))}(f,h,l.baseTime/l.timescale),g>0?this.lastEndTime=E:(_.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const S=!!f.audio,b=!!f.video;let T="";S&&(T+="audio"),b&&(T+="video");const A={data1:h,startPTS:y,startDTS:y,endPTS:E,endDTS:E,type:T,hasAudio:S,hasVideo:b,nb:1,dropped:0};return c.audio="audio"===A.type?A:void 0,c.video="audio"!==A.type?A:void 0,c.initSegment=d,c.id3=Zn(r,i,l,l),n.samples.length&&(c.text=ti(n,i,l)),c}}},{demux:Fn,remux:Jn},{demux:class extends ln{constructor(t,e){super(),this.observer=void 0,this.config=void 0,this.observer=t,this.config=e}resetInitSegment(t,e,r,n){super.resetInitSegment(t,e,r,n),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=et(t,0);let r=(null==e?void 0:e.length)||0;if(Rn(t,r))return!1;for(let e=t.length;r<e;r++)if(pn(t,r))return _.log("ADTS sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return function(t,e){return e+5<t.length}(t,e)&&cn(t,e)&&dn(t,e)<=t.length-e}(t,e)}appendFrame(t,e,r){gn(t,this.observer,e,r,t.manifestCodec);const n=mn(t,e,r,this.basePTS,this.frameIndex);if(n&&0===n.missing)return n}},remux:Jn},{demux:class extends ln{resetInitSegment(t,e,r,n){super.resetInitSegment(t,e,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}}static probe(t){if(!t)return!1;const e=et(t,0);let r=(null==e?void 0:e.length)||0;if(e&&11===t[r]&&119===t[r+1]&&void 0!==it(e)&&Dn(t,r)<=16)return!1;for(let e=t.length;r<e;r++)if(Rn(t,r))return _.log("MPEG Audio sync word found !"),!0;return!1}canParse(t,e){return function(t,e){return Ln(t,e)&&4<=t.length-e}(t,e)}appendFrame(t,e,r){if(null!==this.basePTS)return _n(t,e,r,this.basePTS,this.frameIndex)}},remux:Jn}];ni.splice(2,0,{demux:class extends ln{constructor(t){super(),this.observer=void 0,this.observer=t}resetInitSegment(t,e,r,n){super.resetInitSegment(t,e,r,n),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:e,duration:n,inputTimeScale:9e4,dropped:0}}canParse(t,e){return e+64<t.length}appendFrame(t,e,r){const n=In(t,e,r,this.basePTS,this.frameIndex);if(-1!==n)return{sample:t.samples[t.samples.length-1],length:n,missing:0}}static probe(t){if(!t)return!1;const e=et(t,0);if(!e)return!1;const r=e.length;return 11===t[r]&&119===t[r+1]&&void 0!==it(e)&&Dn(t,r)<16}},remux:Jn});class ii{constructor(t,e,r,n,i){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=n,this.id=i}configure(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()}push(t,e,r,n){const i=r.transmuxing;i.executeStart=Yn();let s=new Uint8Array(t);const{currentTransmuxState:a,transmuxConfig:o}=this;n&&(this.currentTransmuxState=n);const{contiguous:l,discontinuity:u,trackSwitch:c,accurateTimeOffset:h,timeOffset:d,initSegmentChange:f}=n||a,{audioCodec:p,videoCodec:g,defaultInitPts:v,duration:S,initSegmentData:b}=o,T=function(t,e){let r=null;return t.byteLength>0&&null!=(null==e?void 0:e.key)&&null!==e.iv&&null!=e.method&&(r=e),r}(s,e);if(T&&"AES-128"===T.method){const t=this.getDecrypter();if(!t.isSync())return this.decryptionPromise=t.webCryptoDecrypt(s,T.key.buffer,T.iv.buffer).then((t=>{const e=this.push(t,null,r);return this.decryptionPromise=null,e})),this.decryptionPromise;{let e=t.softwareDecrypt(s,T.key.buffer,T.iv.buffer);if(r.part>-1&&(e=t.flush()),!e)return i.executeEnd=Yn(),si(r);s=new Uint8Array(e)}}const A=this.needsProbing(u,c);if(A){const t=this.configureTransmuxer(s);if(t)return _.warn(`[transmuxer] ${t.message}`),this.observer.emit(m.ERROR,m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_PARSING_ERROR,fatal:!1,error:t,reason:t.message}),i.executeEnd=Yn(),si(r)}(u||c||f||A)&&this.resetInitSegment(b,p,g,S,e),(u||f||A)&&this.resetInitialTimestamp(v),l||this.resetContiguity();const L=this.transmux(s,T,d,h,r),w=this.currentTransmuxState;return w.contiguous=!0,w.discontinuity=!1,w.trackSwitch=!1,i.executeEnd=Yn(),L}flush(t){const e=t.transmuxing;e.executeStart=Yn();const{decrypter:r,currentTransmuxState:n,decryptionPromise:i}=this;if(i)return i.then((()=>this.flush(t)));const s=[],{timeOffset:a}=n;if(r){const e=r.flush();e&&s.push(this.push(e,null,t))}const{demuxer:o,remuxer:l}=this;if(!o||!l)return e.executeEnd=Yn(),[si(t)];const u=o.flush(a);return ai(u)?u.then((e=>(this.flushRemux(s,e,t),s))):(this.flushRemux(s,u,t),s)}flushRemux(t,e,r){const{audioTrack:n,videoTrack:i,id3Track:s,textTrack:a}=e,{accurateTimeOffset:o,timeOffset:l}=this.currentTransmuxState;_.log(`[transmuxer.ts]: Flushed fragment ${r.sn}${r.part>-1?" p: "+r.part:""} of level ${r.level}`);const u=this.remuxer.remux(n,i,s,a,l,o,!0,this.id);t.push({remuxResult:u,chunkMeta:r}),r.transmuxing.executeEnd=Yn()}resetInitialTimestamp(t){const{demuxer:e,remuxer:r}=this;e&&r&&(e.resetTimeStamp(t),r.resetTimeStamp(t))}resetContiguity(){const{demuxer:t,remuxer:e}=this;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())}resetInitSegment(t,e,r,n,i){const{demuxer:s,remuxer:a}=this;s&&a&&(s.resetInitSegment(t,e,r,n),a.resetInitSegment(t,e,r,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(t,e,r,n,i){let s;return s=e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,r,n,i):this.transmuxUnencrypted(t,r,n,i),s}transmuxUnencrypted(t,e,r,n){const{audioTrack:i,videoTrack:s,id3Track:a,textTrack:o}=this.demuxer.demux(t,e,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,s,a,o,e,r,!1,this.id),chunkMeta:n}}transmuxSampleAes(t,e,r,n,i){return this.demuxer.demuxSampleAes(t,e,r).then((t=>({remuxResult:this.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,r,n,!1,this.id),chunkMeta:i})))}configureTransmuxer(t){const{config:e,observer:r,typeSupported:n,vendor:i}=this;let s;for(let e=0,r=ni.length;e<r;e++){var a;if(null!=(a=ni[e].demux)&&a.probe(t)){s=ni[e];break}}if(!s)return new Error("Failed to find demuxer by probing fragment data");const o=this.demuxer,l=this.remuxer,u=s.remux,c=s.demux;l&&l instanceof u||(this.remuxer=new u(r,e,n,i)),o&&o instanceof c||(this.demuxer=new c(r,e,n),this.probe=c.probe)}needsProbing(t,e){return!this.demuxer||!this.remuxer||t||e}getDecrypter(){let t=this.decrypter;return t||(t=this.decrypter=new $r(this.config)),t}}const si=t=>({remuxResult:{},chunkMeta:t});function ai(t){return"then"in t&&t.then instanceof Function}class oi{constructor(t,e,r,n,i){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=n,this.defaultInitPts=i||null}}class li{constructor(t,e,r,n,i,s){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=n,this.timeOffset=i,this.initSegmentChange=s}}var ui={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function i(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function s(t,e,n,s,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var o=new i(n,s||t,a),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 a(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function o(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),o.prototype.eventNames=function(){var t,n,i=[];if(0===this._eventsCount)return i;for(n in t=this._events)e.call(t,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},o.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,a=new Array(s);i<s;i++)a[i]=n[i].fn;return a},o.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},o.prototype.emit=function(t,e,n,i,s,a){var o=r?r+t:t;if(!this._events[o])return!1;var l,u,c=this._events[o],h=arguments.length;if(c.fn){switch(c.once&&this.removeListener(t,c.fn,void 0,!0),h){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,e),!0;case 3:return c.fn.call(c.context,e,n),!0;case 4:return c.fn.call(c.context,e,n,i),!0;case 5:return c.fn.call(c.context,e,n,i,s),!0;case 6:return c.fn.call(c.context,e,n,i,s,a),!0}for(u=1,l=new Array(h-1);u<h;u++)l[u-1]=arguments[u];c.fn.apply(c.context,l)}else{var d,f=c.length;for(u=0;u<f;u++)switch(c[u].once&&this.removeListener(t,c[u].fn,void 0,!0),h){case 1:c[u].fn.call(c[u].context);break;case 2:c[u].fn.call(c[u].context,e);break;case 3:c[u].fn.call(c[u].context,e,n);break;case 4:c[u].fn.call(c[u].context,e,n,i);break;default:if(!l)for(d=1,l=new Array(h-1);d<h;d++)l[d-1]=arguments[d];c[u].fn.apply(c[u].context,l)}}return!0},o.prototype.on=function(t,e,r){return s(this,t,e,r,!1)},o.prototype.once=function(t,e,r){return s(this,t,e,r,!0)},o.prototype.removeListener=function(t,e,n,i){var s=r?r+t:t;if(!this._events[s])return this;if(!e)return a(this,s),this;var o=this._events[s];if(o.fn)o.fn!==e||i&&!o.once||n&&o.context!==n||a(this,s);else{for(var l=0,u=[],c=o.length;l<c;l++)(o[l].fn!==e||i&&!o[l].once||n&&o[l].context!==n)&&u.push(o[l]);u.length?this._events[s]=1===u.length?u[0]:u:a(this,s)}return this},o.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&a(this,e)):(this._events=new n,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}(ui);var ci=n(ui.exports);class hi{constructor(t,e,r,n){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;const i=t.config;this.hls=t,this.id=e,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=r,this.onFlush=n;const s=(t,e)=>{(e=e||{}).frag=this.frag,e.id=this.id,t===m.ERROR&&(this.error=e.error),this.hls.trigger(t,e)};this.observer=new ci,this.observer.on(m.FRAG_DECRYPTED,s),this.observer.on(m.ERROR,s);const a=zt(i.preferManagedMediaSource)||{isTypeSupported:()=>!1},o={mpeg:a.isTypeSupported("audio/mpeg"),mp3:a.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:a.isTypeSupported('audio/mp4; codecs="ac-3"')};if(!this.useWorker||"undefined"==typeof Worker||!i.workerPath&&"function"!=typeof __HLS_WORKER_BUNDLE__)this.transmuxer=new ii(this.observer,o,i,"",e);else try{i.workerPath?(_.log(`loading Web Worker ${i.workerPath} for "${e}"`),this.workerContext=function(t){const e=new self.URL(t,self.location.href).href;return{worker:new self.Worker(e),scriptURL:e}}(i.workerPath)):(_.log(`injecting Web Worker for "${e}"`),this.workerContext=function(){const t=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),e=self.URL.createObjectURL(t);return{worker:new self.Worker(e),objectURL:e}}()),this.onwmsg=t=>this.onWorkerMessage(t);const{worker:t}=this.workerContext;t.addEventListener("message",this.onwmsg),t.onerror=t=>{const r=new Error(`${t.message}  (${t.filename}:${t.lineno})`);i.enableWorker=!1,_.warn(`Error in "${e}" Web Worker, fallback to inline`),this.hls.trigger(m.ERROR,{type:y.OTHER_ERROR,details:E.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:r})},t.postMessage({cmd:"init",typeSupported:o,vendor:"",id:e,config:JSON.stringify(i)})}catch(t){_.warn(`Error setting up "${e}" Web Worker, fallback to inline`,t),this.resetWorker(),this.error=null,this.transmuxer=new ii(this.observer,o,i,"",e)}}resetWorker(){if(this.workerContext){const{worker:t,objectURL:e}=this.workerContext;e&&self.URL.revokeObjectURL(e),t.removeEventListener("message",this.onwmsg),t.onerror=null,t.terminate(),this.workerContext=null}}destroy(){if(this.workerContext)this.resetWorker(),this.onwmsg=void 0;else{const t=this.transmuxer;t&&(t.destroy(),this.transmuxer=null)}const t=this.observer;t&&t.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null}push(t,e,r,n,i,s,a,o,l,u){var c,h;l.transmuxing.start=self.performance.now();const{transmuxer:d}=this,f=s?s.start:i.start,p=i.decryptdata,g=this.frag,v=!(g&&i.cc===g.cc),m=!(g&&l.level===g.level),y=g?l.sn-g.sn:-1,E=this.part?l.part-this.part.index:-1,S=0===y&&l.id>1&&l.id===(null==g?void 0:g.stats.chunkCount),b=!m&&(1===y||0===y&&(1===E||S&&E<=0)),T=self.performance.now();(m||y||0===i.stats.parsing.start)&&(i.stats.parsing.start=T),!s||!E&&b||(s.stats.parsing.start=T);const A=!(g&&(null==(c=i.initSegment)?void 0:c.url)===(null==(h=g.initSegment)?void 0:h.url)),L=new li(v,b,o,m,f,A);if(!b||v||A){_.log(`[transmuxer-interface, ${i.type}]: Starting new transmux session for sn: ${l.sn} p: ${l.part} level: ${l.level} id: ${l.id}\n        discontinuity: ${v}\n        trackSwitch: ${m}\n        contiguous: ${b}\n        accurateTimeOffset: ${o}\n        timeOffset: ${f}\n        initSegmentChange: ${A}`);const t=new oi(r,n,e,a,u);this.configureTransmuxer(t)}if(this.frag=i,this.part=s,this.workerContext)this.workerContext.worker.postMessage({cmd:"demux",data:t,decryptdata:p,chunkMeta:l,state:L},t instanceof ArrayBuffer?[t]:[]);else if(d){const e=d.push(t,p,l,L);ai(e)?(d.async=!0,e.then((t=>{this.handleTransmuxComplete(t)})).catch((t=>{this.transmuxerError(t,l,"transmuxer-interface push error")}))):(d.async=!1,this.handleTransmuxComplete(e))}}flush(t){t.transmuxing.start=self.performance.now();const{transmuxer:e}=this;if(this.workerContext)this.workerContext.worker.postMessage({cmd:"flush",chunkMeta:t});else if(e){let r=e.flush(t);ai(r)||e.async?(ai(r)||(r=Promise.resolve(r)),r.then((e=>{this.handleFlushResult(e,t)})).catch((e=>{this.transmuxerError(e,t,"transmuxer-interface flush error")}))):this.handleFlushResult(r,t)}}transmuxerError(t,e,r){this.hls&&(this.error=t,this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_PARSING_ERROR,chunkMeta:e,frag:this.frag||void 0,fatal:!1,error:t,err:t,reason:r}))}handleFlushResult(t,e){t.forEach((t=>{this.handleTransmuxComplete(t)})),this.onFlush(e)}onWorkerMessage(t){const e=t.data;if(null==e||!e.event)return void _.warn("worker message received with no "+(e?"event name":"data"));const r=this.hls;if(this.hls)switch(e.event){case"init":{var n;const t=null==(n=this.workerContext)?void 0:n.objectURL;t&&self.URL.revokeObjectURL(t);break}case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":_[e.data.logType]&&_[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)}}configureTransmuxer(t){const{transmuxer:e}=this;this.workerContext?this.workerContext.worker.postMessage({cmd:"configure",config:t}):e&&e.configure(t)}handleTransmuxComplete(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)}}function di(t,e){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!fi(t[r].attrs,e[r].attrs))return!1;return!0}function fi(t,e,r){const n=t["STABLE-RENDITION-ID"];return n&&!r?n===e["STABLE-RENDITION-ID"]:!(r||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some((r=>t[r]!==e[r]))}function pi(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}class gi{constructor(t){this.buffered=void 0;const e=(e,r,n)=>{if((r>>>=0)>n-1)throw new DOMException(`Failed to execute '${e}' on 'TimeRanges': The index provided (${r}) is greater than the maximum bound (${n})`);return t[r][e]};this.buffered={get length(){return t.length},end:r=>e("end",r,t.length),start:r=>e("start",r,t.length)}}}class vi{constructor(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}append(t,e,r){const n=this.queues[e];n.push(t),1!==n.length||r||this.executeNext(e)}insertAbort(t,e){this.queues[e].unshift(t),this.executeNext(e)}appendBlocker(t){let e;const r=new Promise((t=>{e=t})),n={execute:e,onStart:()=>{},onComplete:()=>{},onError:()=>{}};return this.append(n,t),r}executeNext(t){const e=this.queues[t];if(e.length){const r=e[0];try{r.execute()}catch(e){_.warn(`[buffer-operation-queue]: Exception executing "${t}" SourceBuffer operation: ${e}`),r.onError(e);const n=this.buffers[t];null!=n&&n.updating||this.shiftAndExecuteNext(t)}}}shiftAndExecuteNext(t){this.queues[t].shift(),this.executeNext(t)}current(t){return this.queues[t][0]}}const mi=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/;function yi(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach((e=>{t.removeChild(e)}))}const Ei={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},Si=t=>String.fromCharCode(Ei[t]||t),bi=15,Ti=100,_i={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},Ai={17:2,18:4,21:6,22:8,23:10,19:13,20:15},Li={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},wi={25:2,26:4,29:6,30:8,31:10,27:13,28:15},Ri=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class ki{constructor(){this.time=null,this.verboseLevel=0}log(t,e){if(this.verboseLevel>=t){const r="function"==typeof e?e():e;_.log(`${this.time} [${t}] ${r}`)}}}const Di=function(t){const e=[];for(let r=0;r<t.length;r++)e.push(t[r].toString(16));return e};class Ii{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(t){const e=["foreground","underline","italics","background","flash"];for(let r=0;r<e.length;r++){const n=e[r];t.hasOwnProperty(n)&&(this[n]=t[n])}}isDefault(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}equals(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}copy(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class Pi{constructor(){this.uchar=" ",this.penState=new Ii}reset(){this.uchar=" ",this.penState.reset()}setChar(t,e){this.uchar=t,this.penState.copy(e)}setPenState(t){this.penState.copy(t)}equals(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}copy(t){this.uchar=t.uchar,this.penState.copy(t.penState)}isEmpty(){return" "===this.uchar&&this.penState.isDefault()}}class Oi{constructor(t){this.chars=[],this.pos=0,this.currPenState=new Ii,this.cueStartTime=null,this.logger=void 0;for(let t=0;t<Ti;t++)this.chars.push(new Pi);this.logger=t}equals(t){for(let e=0;e<Ti;e++)if(!this.chars[e].equals(t.chars[e]))return!1;return!0}copy(t){for(let e=0;e<Ti;e++)this.chars[e].copy(t.chars[e])}isEmpty(){let t=!0;for(let e=0;e<Ti;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}setCursor(t){this.pos!==t&&(this.pos=t),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>Ti&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Ti)}moveCursor(t){const e=this.pos+t;if(t>1)for(let t=this.pos+1;t<e+1;t++)this.chars[t].setPenState(this.currPenState);this.setCursor(e)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(t){t>=144&&this.backSpace();const e=Si(t);this.pos>=Ti?this.logger.log(0,(()=>"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!")):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))}clearFromPos(t){let e;for(e=t;e<Ti;e++)this.chars[e].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const t=[];let e=!0;for(let r=0;r<Ti;r++){const n=this.chars[r].uchar;" "!==n&&(e=!1),t.push(n)}return e?"":t.join("")}setPenStyles(t){this.currPenState.setStyles(t),this.chars[this.pos].setPenState(this.currPenState)}}class Ci{constructor(t){this.rows=[],this.currRow=14,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let e=0;e<bi;e++)this.rows.push(new Oi(t));this.logger=t}reset(){for(let t=0;t<bi;t++)this.rows[t].clear();this.currRow=14}equals(t){let e=!0;for(let r=0;r<bi;r++)if(!this.rows[r].equals(t.rows[r])){e=!1;break}return e}copy(t){for(let e=0;e<bi;e++)this.rows[e].copy(t.rows[e])}isEmpty(){let t=!0;for(let e=0;e<bi;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(t){this.rows[this.currRow].insertChar(t)}setPen(t){this.rows[this.currRow].setPenStyles(t)}moveCursor(t){this.rows[this.currRow].moveCursor(t)}setCursor(t){this.logger.log(2,"setCursor: "+t),this.rows[this.currRow].setCursor(t)}setPAC(t){this.logger.log(2,(()=>"pacData = "+JSON.stringify(t)));let e=t.row-1;if(this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==e){for(let t=0;t<bi;t++)this.rows[t].clear();const t=this.currRow+1-this.nrRollUpRows,r=this.lastOutputScreen;if(r){const n=r.rows[t].cueStartTime,i=this.logger.time;if(null!==n&&null!==i&&n<i)for(let n=0;n<this.nrRollUpRows;n++)this.rows[e-this.nrRollUpRows+n+1].copy(r.rows[t+n])}}this.currRow=e;const r=this.rows[this.currRow];if(null!==t.indent){const e=t.indent,n=Math.max(e-1,0);r.setCursor(t.indent),t.color=r.chars[n].penState.foreground}const n={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(n)}setBkgData(t){this.logger.log(2,(()=>"bkgData = "+JSON.stringify(t))),this.backSpace(),this.setPen(t),this.insertChar(32)}setRollUpRows(t){this.nrRollUpRows=t}rollUp(){if(null===this.nrRollUpRows)return void this.logger.log(3,"roll_up but nrRollUpRows not set yet");this.logger.log(1,(()=>this.getDisplayText()));const t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),this.logger.log(2,"Rolling up")}getDisplayText(t){t=t||!1;const e=[];let r="",n=-1;for(let r=0;r<bi;r++){const i=this.rows[r].getTextString();i&&(n=r+1,t?e.push("Row "+n+": '"+i+"'"):e.push(i.trim()))}return e.length>0&&(r=t?"["+e.join(" | ")+"]":e.join("\n")),r}getTextAndFormat(){return this.rows}}class xi{constructor(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 Ci(r),this.nonDisplayedMemory=new Ci(r),this.lastOutputScreen=new Ci(r),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){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}getHandler(){return this.outputFilter}setHandler(t){this.outputFilter=t}setPAC(t){this.writeScreen.setPAC(t)}setBkgData(t){this.writeScreen.setBkgData(t)}setMode(t){t!==this.mode&&(this.mode=t,this.logger.log(2,(()=>"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)}insertChars(t){for(let e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);const e=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,(()=>e+": "+this.writeScreen.getDisplayText(!0))),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(this.logger.log(1,(()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0))),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(t){this.logger.log(2,"RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),"MODE_POP-ON"===this.mode){const t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,(()=>"DISP: "+this.displayedMemory.getDisplayText()))}this.outputDataUpdate(!0)}ccTO(t){this.logger.log(2,"TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}ccMIDROW(t){const e={flash:!1};if(e.underline=t%2==1,e.italics=t>=46,e.italics)e.foreground="white";else{const r=Math.floor(t/2)-16,n=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=n[r]}this.logger.log(2,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)}outputDataUpdate(t=!1){const 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))}cueSplitAtTime(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}class Mi{constructor(t,e,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory={a:null,b:null},this.logger=void 0;const n=this.logger=new ki;this.channels=[null,new xi(t,e,n),new xi(t+1,r,n)]}getHandler(t){return this.channels[t].getHandler()}setHandler(t,e){this.channels[t].setHandler(e)}addData(t,e){this.logger.time=t;for(let t=0;t<e.length;t+=2){const r=127&e[t],n=127&e[t+1];let i=!1,s=null;if(0===r&&0===n)continue;this.logger.log(3,(()=>"["+Di([e[t],e[t+1]])+"] -> ("+Di([r,n])+")"));const a=this.cmdHistory;if(r>=16&&r<=31){if(Ni(r,n,a)){Fi(null,null,a),this.logger.log(3,(()=>"Repeated command ("+Di([r,n])+") is dropped"));continue}Fi(r,n,this.cmdHistory),i=this.parseCmd(r,n),i||(i=this.parseMidrow(r,n)),i||(i=this.parsePAC(r,n)),i||(i=this.parseBackgroundAttributes(r,n))}else Fi(null,null,a);if(!i&&(s=this.parseChars(r,n),s)){const t=this.currentChannel;t&&t>0?this.channels[t].insertChars(s):this.logger.log(2,"No channel found yet. TEXT-MODE?")}i||s||this.logger.log(2,(()=>"Couldn't parse cleaned data "+Di([r,n])+" orig: "+Di([e[t],e[t+1]])))}}parseCmd(t,e){if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;const r=20===t||21===t||23===t?1:2,n=this.channels[r];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),this.currentChannel=r,!0}parseMidrow(t,e){let r=0;if((17===t||25===t)&&e>=32&&e<=47){if(r=17===t?1:2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const n=this.channels[r];return!!n&&(n.ccMIDROW(e),this.logger.log(3,(()=>"MIDROW ("+Di([t,e])+")")),!0)}return!1}parsePAC(t,e){let r;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;const n=t<=23?1:2;r=e>=64&&e<=95?1===n?_i[t]:Li[t]:1===n?Ai[t]:wi[t];const i=this.channels[n];return!!i&&(i.setPAC(this.interpretPAC(r,e)),this.currentChannel=n,!0)}interpretPAC(t,e){let r;const n={color:null,italics:!1,indent:null,underline:!1,row:t};return r=e>95?e-96:e-64,n.underline=1==(1&r),r<=13?n.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(n.italics=!0,n.color="white"):n.indent=4*Math.floor((r-16)/2),n}parseChars(t,e){let r,n=null,i=null;if(t>=25?(r=2,i=t-8):(r=1,i=t),i>=17&&i<=19){let t;t=17===i?e+80:18===i?e+112:e+144,this.logger.log(2,(()=>"Special char '"+Si(t)+"' in channel "+r)),n=[t]}else t>=32&&t<=127&&(n=0===e?[t]:[t,e]);return n&&this.logger.log(3,(()=>"Char codes =  "+Di(n).join(","))),n}parseBackgroundAttributes(t,e){if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;let r;const n={};16===t||24===t?(r=Math.floor((e-32)/2),n.background=Ri[r],e%2==1&&(n.background=n.background+"_semi")):45===e?n.background="transparent":(n.foreground="black",47===e&&(n.underline=!0));const i=t<=23?1:2;return this.channels[i].setBkgData(n),!0}reset(){for(let t=0;t<Object.keys(this.channels).length;t++){const e=this.channels[t];e&&e.reset()}Fi(null,null,this.cmdHistory)}cueSplitAtTime(t){for(let e=0;e<this.channels.length;e++){const r=this.channels[e];r&&r.cueSplitAtTime(t)}}}function Fi(t,e,r){r.a=t,r.b=e}function Ni(t,e,r){return r.a===t&&r.b===e}class Bi{constructor(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}dispatchCue(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(t,e,r){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}var Ui=function(){if(null!=U&&U.VTTCue)return self.VTTCue;const 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;const r=e.toLowerCase();return!!~t.indexOf(r)&&r}function n(t){return r(e,t)}function i(t,...e){let r=1;for(;r<arguments.length;r++){const e=arguments[r];for(const r in e)t[r]=e[r]}return t}function s(e,s,a){const o=this,l={enumerable:!0};o.hasBeenReset=!1;let u="",c=!1,h=e,d=s,f=a,p=null,g="",v=!0,m="auto",y="start",E=50,S="middle",b=50,T="middle";Object.defineProperty(o,"id",i({},l,{get:function(){return u},set:function(t){u=""+t}})),Object.defineProperty(o,"pauseOnExit",i({},l,{get:function(){return c},set:function(t){c=!!t}})),Object.defineProperty(o,"startTime",i({},l,{get:function(){return h},set:function(t){if("number"!=typeof t)throw new TypeError("Start time must be set to a number.");h=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"endTime",i({},l,{get:function(){return d},set:function(t){if("number"!=typeof t)throw new TypeError("End time must be set to a number.");d=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"text",i({},l,{get:function(){return f},set:function(t){f=""+t,this.hasBeenReset=!0}})),Object.defineProperty(o,"region",i({},l,{get:function(){return p},set:function(t){p=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"vertical",i({},l,{get:function(){return g},set:function(e){const n=function(e){return r(t,e)}(e);if(!1===n)throw new SyntaxError("An invalid or illegal string was specified.");g=n,this.hasBeenReset=!0}})),Object.defineProperty(o,"snapToLines",i({},l,{get:function(){return v},set:function(t){v=!!t,this.hasBeenReset=!0}})),Object.defineProperty(o,"line",i({},l,{get:function(){return m},set:function(t){if("number"!=typeof t&&"auto"!==t)throw new SyntaxError("An invalid number or illegal string was specified.");m=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"lineAlign",i({},l,{get:function(){return y},set:function(t){const e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");y=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"position",i({},l,{get:function(){return E},set:function(t){if(t<0||t>100)throw new Error("Position must be between 0 and 100.");E=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",i({},l,{get:function(){return S},set:function(t){const e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");S=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",i({},l,{get:function(){return b},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");b=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",i({},l,{get:function(){return T},set:function(t){const e=n(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");T=e,this.hasBeenReset=!0}})),o.displayState=void 0}return s.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},s}();class ji{decode(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))}}function Hi(t){function e(t,e,r,n){return 3600*(0|t)+60*(0|e)+(0|r)+parseFloat(n||0)}const 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}class Gi{constructor(){this.values=Object.create(null)}set(t,e){this.get(t)||""===e||(this.values[t]=e)}get(t,e,r){return r?this.has(t)?this.values[t]:e[r]:this.has(t)?this.values[t]:e}has(t){return t in this.values}alt(t,e,r){for(let n=0;n<r.length;++n)if(e===r[n]){this.set(t,e);break}}integer(t,e){/^-?\d+$/.test(e)&&this.set(t,parseInt(e,10))}percent(t,e){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(e)){const r=parseFloat(e);if(r>=0&&r<=100)return this.set(t,r),!0}return!1}}function Vi(t,e,r,n){const i=n?t.split(n):[t];for(const t in i){if("string"!=typeof i[t])continue;const n=i[t].split(r);2===n.length&&e(n[0],n[1])}}const Ki=new Ui(0,0,""),$i="middle"===Ki.align?"middle":"center";function Wi(t,e,r){const n=t;function i(){const e=Hi(t);if(null===e)throw new Error("Malformed timestamp: "+n);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function s(){t=t.replace(/^\s+/,"")}if(s(),e.startTime=i(),s(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+n);t=t.slice(3),s(),e.endTime=i(),s(),function(t,e){const n=new Gi;Vi(t,(function(t,e){let i;switch(t){case"region":for(let i=r.length-1;i>=0;i--)if(r[i].id===e){n.set(t,r[i].region);break}break;case"vertical":n.alt(t,e,["rl","lr"]);break;case"line":i=e.split(","),n.integer(t,i[0]),n.percent(t,i[0])&&n.set("snapToLines",!1),n.alt(t,i[0],["auto"]),2===i.length&&n.alt("lineAlign",i[1],["start",$i,"end"]);break;case"position":i=e.split(","),n.percent(t,i[0]),2===i.length&&n.alt("positionAlign",i[1],["start",$i,"end","line-left","line-right","auto"]);break;case"size":n.percent(t,e);break;case"align":n.alt(t,e,["start",$i,"end","left","right"])}}),/:/,/\s/),e.region=n.get("region",null),e.vertical=n.get("vertical","");let i=n.get("line","auto");"auto"===i&&-1===Ki.line&&(i=-1),e.line=i,e.lineAlign=n.get("lineAlign","start"),e.snapToLines=n.get("snapToLines",!0),e.size=n.get("size",100),e.align=n.get("align",$i);let s=n.get("position","auto");"auto"===s&&50===Ki.position&&(s="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=s}(t,e)}function qi(t){return t.replace(/<br(?: \/)?>/gi,"\n")}class Yi{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new ji,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(t){const e=this;function r(){let t=e.buffer,r=0;for(t=qi(t);r<t.length&&"\r"!==t[r]&&"\n"!==t[r];)++r;const n=t.slice(0,r);return"\r"===t[r]&&++r,"\n"===t[r]&&++r,e.buffer=t.slice(r),n}t&&(e.buffer+=e.decoder.decode(t,{stream:!0}));try{let t="";if("INITIAL"===e.state){if(!/\r\n|\n/.test(e.buffer))return this;t=r();const n=t.match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(null==n||!n[0])throw new Error("Malformed WebVTT signature.");e.state="HEADER"}let n=!1;for(;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(n?n=!1:t=r(),e.state){case"HEADER":/:/.test(t)?Vi(t,(function(t,e){}),/:/):t||(e.state="ID");continue;case"NOTE":t||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(t)){e.state="NOTE";break}if(!t)continue;if(e.cue=new Ui(0,0,""),e.state="CUE",-1===t.indexOf("--\x3e")){e.cue.id=t;continue}case"CUE":if(!e.cue){e.state="BADCUE";continue}try{Wi(t,e.cue,e.regionList)}catch(t){e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":{const r=-1!==t.indexOf("--\x3e");if(!t||r&&(n=!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+=t}continue;case"BADCUE":t||(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}flush(){const 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}}const zi=/\r\n|\n\r|\n|\r/g,Xi=function(t,e,r=0){return t.slice(r,r+e.length)===e},Ji=function(t){let e=5381,r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return(e>>>0).toString()};function Qi(t,e,r){return Ji(t.toString())+Ji(e.toString())+Ji(r)}const Zi="stpp.ttml.im1t",ts=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,es=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,rs={left:"start",center:"center",right:"end",start:"start",end:"end"};function ns(t,e,r,n){const i=wt(new Uint8Array(t),["mdat"]);if(0===i.length)return void n(new Error("Could not parse IMSC1 mdat"));const s=i.map((t=>ft(t))),a=function(t,e,r=1,n=!1){return Wn(t,e,1/r,n)}(e.baseTime,1,e.timescale);try{s.forEach((t=>r(function(t,e){const r=(new DOMParser).parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!r)throw new Error("Invalid ttml");const n={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},i=Object.keys(n).reduce(((t,e)=>(t[e]=r.getAttribute(`ttp:${e}`)||n[e],t)),{}),s="preserve"!==r.getAttribute("xml:space"),a=ss(is(r,"styling","style")),o=ss(is(r,"layout","region")),l=is(r,"body","[begin]");return[].map.call(l,(t=>{const r=as(t,s);if(!r||!t.hasAttribute("begin"))return null;const n=us(t.getAttribute("begin"),i),l=us(t.getAttribute("dur"),i);let u=us(t.getAttribute("end"),i);if(null===n)throw ls(t);if(null===u){if(null===l)throw ls(t);u=n+l}const c=new Ui(n-e,u-e,r);c.id=Qi(c.startTime,c.endTime,c.text);const h=function(t,e,r){const n="http://www.w3.org/ns/ttml#styling";let i=null;const s=null!=t&&t.hasAttribute("style")?t.getAttribute("style"):null;return s&&r.hasOwnProperty(s)&&(i=r[s]),["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"].reduce(((r,s)=>{const a=os(e,n,s)||os(t,n,s)||os(i,n,s);return a&&(r[s]=a),r}),{})}(o[t.getAttribute("region")],a[t.getAttribute("style")],a),{textAlign:d}=h;if(d){const t=rs[d];t&&(c.lineAlign=t),c.align=d}return f(c,h),c})).filter((t=>null!==t))}(t,a))))}catch(t){n(t)}}function is(t,e,r){const n=t.getElementsByTagName(e)[0];return n?[].slice.call(n.querySelectorAll(r)):[]}function ss(t){return t.reduce(((t,e)=>{const r=e.getAttribute("xml:id");return r&&(t[r]=e),t}),{})}function as(t,e){return[].slice.call(t.childNodes).reduce(((t,r,n)=>{var i;return"br"===r.nodeName&&n?t+"\n":null!=(i=r.childNodes)&&i.length?as(r,e):e?t+r.textContent.trim().replace(/\s+/g," "):t+r.textContent}),"")}function os(t,e,r){return t&&t.hasAttributeNS(e,r)?t.getAttributeNS(e,r):null}function ls(t){return new Error(`Could not parse ttml timestamp ${t}`)}function us(t,e){if(!t)return null;let r=Hi(t);return null===r&&(ts.test(t)?r=function(t,e){const r=ts.exec(t),n=(0|r[4])+(0|r[5])/e.subFrameRate;return 3600*(0|r[1])+60*(0|r[2])+(0|r[3])+n/e.frameRate}(t,e):es.test(t)&&(r=function(t,e){const r=es.exec(t),n=Number(r[1]);switch(r[2]){case"h":return 3600*n;case"m":return 60*n;case"ms":return 1e3*n;case"f":return n/e.frameRate;case"t":return n/e.tickRate}return n}(t,e))),r}function cs(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function hs(t,e){return!!t&&t.kind===cs(e)&&pi(e,t)}class ds{constructor(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()}setStreamController(t){this.streamController=t}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:t}=this;t.on(m.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(m.MANIFEST_PARSED,this.onManifestParsed,this),t.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(m.BUFFER_CODECS,this.onBufferCodecs,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:t}=this;t.off(m.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),t.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(m.MANIFEST_PARSED,this.onManifestParsed,this),t.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(m.BUFFER_CODECS,this.onBufferCodecs,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(t,e){const r=this.hls.levels[e.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(t,e){this.media=e.media instanceof HTMLVideoElement?e.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(t,e){const r=this.hls;this.restrictedLevels=[],this.firstLevel=e.firstLevel,r.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onLevelsUpdated(t,e){this.timer&&p(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(t,e){this.hls.config.capLevelToPlayerSize&&e.video&&this.startCapping()}onMediaDetaching(){this.stopCapping()}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0)return void(this.clientRect=null);const t=this.hls.levels;if(t.length){const e=this.hls,r=this.getMaxLevel(t.length-1);r!==this.autoLevelCapping&&_.log(`Setting autoLevelCapping to ${r}: ${t[r].height}p@${t[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),e.autoLevelCapping=r,e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}}getMaxLevel(t){const e=this.hls.levels;if(!e.length)return-1;const r=e.filter(((e,r)=>this.isLevelAllowed(e)&&r<=t));return this.clientRect=null,ds.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const t=this.media,e={width:0,height:0};if(t){const 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}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(t){}return t}isLevelAllowed(t){return!this.restrictedLevels.some((e=>t.bitrate===e.bitrate&&t.width===e.width&&t.height===e.height))}static getMaxLevelByMediaSize(t,e,r){if(null==t||!t.length)return-1;let n=t.length-1;const i=Math.max(e,r);for(let e=0;e<t.length;e+=1){const r=t[e];if((r.width>=i||r.height>=i)&&(s=r,!(a=t[e+1])||s.width!==a.width||s.height!==a.height)){n=e;break}}var s,a;return n}}const fs="[eme]";class ps{constructor(t){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=ps.CDMCleanupPromise?[ps.CDMCleanupPromise]:[],this.onMediaEncrypted=this._onMediaEncrypted.bind(this),this.onWaitingForKey=this._onWaitingForKey.bind(this),this.debug=_.debug.bind(_,fs),this.log=_.log.bind(_,fs),this.warn=_.warn.bind(_,fs),this.error=_.error.bind(_,fs),this.hls=t,this.config=t.config,this.registerListeners()}destroy(){this.unregisterListeners(),this.onMediaDetached();const 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}registerListeners(){this.hls.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(m.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(m.MANIFEST_LOADED,this.onManifestLoaded,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(m.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(m.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(m.MANIFEST_LOADED,this.onManifestLoaded,this)}getLicenseServerUrl(t){const{drmSystems:e,widevineLicenseUrl:r}=this.config,n=e[t];if(n)return n.licenseUrl;if(t===j.WIDEVINE&&r)return r;throw new Error(`no license server URL configured for key-system "${t}"`)}getServerCertificateUrl(t){const{drmSystems:e}=this.config,r=e[t];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${t}"]`)}attemptKeySystemAccess(t){const e=this.hls.levels,r=(t,e,r)=>!!t&&r.indexOf(t)===e,n=e.map((t=>t.audioCodec)).filter(r),i=e.map((t=>t.videoCodec)).filter(r);return n.length+i.length===0&&i.push("avc1.42e01e"),new Promise(((e,r)=>{const s=t=>{const a=t.shift();this.getMediaKeysPromise(a,n,i).then((t=>e({keySystem:a,mediaKeys:t}))).catch((e=>{t.length?s(t):r(e instanceof gs?e:new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_NO_ACCESS,error:e,fatal:!0},e.message))}))};s(t)}))}requestMediaKeySystemAccess(t,e){const{requestMediaKeySystemAccessFunc:r}=this.config;if("function"!=typeof r){let t=`Configured requestMediaKeySystemAccess is not a function ${r}`;return null===X&&"http:"===self.location.protocol&&(t=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(t))}return r(t,e)}getMediaKeysPromise(t,e,r){const n=function(t,e,r,n){let i;switch(t){case j.FAIRPLAY:i=["cenc","sinf"];break;case j.WIDEVINE:case j.PLAYREADY:i=["cenc"];break;case j.CLEARKEY:i=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return function(t,e,r,n){return[{initDataTypes:t,persistentState:n.persistentState||"optional",distinctiveIdentifier:n.distinctiveIdentifier||"optional",sessionTypes:n.sessionTypes||[n.sessionType||"temporary"],audioCapabilities:e.map((t=>({contentType:`audio/mp4; codecs="${t}"`,robustness:n.audioRobustness||"",encryptionScheme:n.audioEncryptionScheme||null}))),videoCapabilities:r.map((t=>({contentType:`video/mp4; codecs="${t}"`,robustness:n.videoRobustness||"",encryptionScheme:n.videoEncryptionScheme||null})))}]}(i,e,r,n)}(t,e,r,this.config.drmSystemOptions),i=this.keySystemAccessPromises[t];let s=null==i?void 0:i.keySystemAccess;if(!s){this.log(`Requesting encrypted media "${t}" key-system access with config: ${JSON.stringify(n)}`),s=this.requestMediaKeySystemAccess(t,n);const e=this.keySystemAccessPromises[t]={keySystemAccess:s};return s.catch((e=>{this.log(`Failed to obtain access to key-system "${t}": ${e}`)})),s.then((r=>{this.log(`Access for key-system "${r.keySystem}" obtained`);const n=this.fetchServerCertificate(t);return this.log(`Create media-keys for "${t}"`),e.mediaKeys=r.createMediaKeys().then((e=>(this.log(`Media-keys created for "${t}"`),n.then((r=>r?this.setMediaKeysServerCertificate(e,t,r):e))))),e.mediaKeys.catch((e=>{this.error(`Failed to create media-keys for "${t}"}: ${e}`)})),e.mediaKeys}))}return s.then((()=>i.mediaKeys))}createMediaKeySessionContext({decryptdata:t,keySystem:e,mediaKeys:r}){this.log(`Creating key-system session "${e}" keyId: ${vt(t.keyId||[])}`);const n=r.createSession(),i={decryptdata:t,keySystem:e,mediaKeys:r,mediaKeysSession:n,keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(t){const e=t.decryptdata;if(e.pssh){const r=this.createMediaKeySessionContext(t),n=this.getKeyIdString(e),i="cenc";this.keyIdToKeySessionPromise[n]=this.generateRequestWithPreferredKeySession(r,i,e.pssh,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(t)}getKeyIdString(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(null===t.keyId)throw new Error("keyId is null");return vt(t.keyId)}updateKeySession(t,e){var r;const n=t.mediaKeysSession;return this.log(`Updating key-session "${n.sessionId}" for keyID ${vt((null==(r=t.decryptdata)?void 0:r.keyId)||[])}\n      } (data length: ${e?e.byteLength:e})`),n.update(e)}selectKeySystemFormat(t){const 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}getKeyFormatPromise(t){return new Promise(((e,r)=>{const n=z(this.config),i=t.map($).filter((t=>!!t&&-1!==n.indexOf(t)));return this.getKeySystemSelectionPromise(i).then((({keySystem:t})=>{const n=Y(t);n?e(n):r(new Error(`Unable to find format for key-system "${t}"`))})).catch(r)}))}loadKey(t){const e=t.keyInfo.decryptdata,r=this.getKeyIdString(e),n=`(keyId: ${r} format: "${e.keyFormat}" method: ${e.method} uri: ${e.uri})`;this.log(`Starting session for key ${n}`);let i=this.keyIdToKeySessionPromise[r];return i||(i=this.keyIdToKeySessionPromise[r]=this.getKeySystemForKeyPromise(e).then((({keySystem:r,mediaKeys:i})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${t.frag.sn} ${t.frag.type}: ${t.frag.level} using key ${n}`),this.attemptSetMediaKeys(r,i).then((()=>{this.throwIfDestroyed();const t=this.createMediaKeySessionContext({keySystem:r,mediaKeys:i,decryptdata:e});return this.generateRequestWithPreferredKeySession(t,"cenc",e.pssh,"playlist-key")}))))),i.catch((t=>this.handleError(t)))),i}throwIfDestroyed(t="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(t){this.hls&&(this.error(t.message),t instanceof gs?this.hls.trigger(m.ERROR,t.data):this.hls.trigger(m.ERROR,{type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_NO_KEYS,error:t,fatal:!0}))}getKeySystemForKeyPromise(t){const e=this.getKeyIdString(t),r=this.keyIdToKeySessionPromise[e];if(!r){const e=$(t.keyFormat),r=e?[e]:z(this.config);return this.attemptKeySystemAccess(r)}return r}getKeySystemSelectionPromise(t){if(t.length||(t=z(this.config)),0===t.length)throw new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${JSON.stringify({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(t)}_onMediaEncrypted(t){const{initDataType:e,initData:r}=t,n=`"${t.type}" event: init data type: "${e}"`;if(this.debug(n),null===r)return;let i,s;if("sinf"===e&&this.config.drmSystems[j.FAIRPLAY]){const t=St(new Uint8Array(r));try{const e=N(JSON.parse(t).sinf),r=Ct(new Uint8Array(e));if(!r)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");i=r.subarray(8,24),s=j.FAIRPLAY}catch(t){return void this.warn(`${n} Failed to parse sinf: ${t}`)}}else{const t=function(t){const e=[];if(t instanceof ArrayBuffer){const r=t.byteLength;let n=0;for(;n+32<r;){const r=jt(new DataView(t,n));e.push(r),n+=r.size}}return e}(r),e=t.filter((t=>t.systemId===W))[0];if(!e)return void(0===t.length||t.some((t=>!t.systemId))?this.warn(`${n} contains incomplete or invalid pssh data`):this.log(`ignoring ${n} for ${t.map((t=>q(t.systemId))).join(",")} pssh data in favor of playlist keys`));if(s=q(e.systemId),0===e.version&&e.data){const t=e.data.length-22;i=e.data.subarray(t,t+16)}}if(!s||!i)return;const a=vt(i),{keyIdToKeySessionPromise:o,mediaKeySessions:l}=this;let u=o[a];for(let t=0;t<l.length;t++){const n=l[t],s=n.decryptdata;if(!s.keyId)continue;const c=vt(s.keyId);if(a===c||-1!==s.uri.replace(/-/g,"").indexOf(a)){if(u=o[c],s.pssh)break;delete o[c],s.pssh=new Uint8Array(r),s.keyId=i,u=o[a]=u.then((()=>this.generateRequestWithPreferredKeySession(n,e,r,"encrypted-event-key-match")));break}}u||(u=o[a]=this.getKeySystemSelectionPromise([s]).then((({keySystem:t,mediaKeys:n})=>{var s;this.throwIfDestroyed();const o=new Gt("ISO-23001-7",a,null!=(s=Y(t))?s:"");return o.pssh=new Uint8Array(r),o.keyId=i,this.attemptSetMediaKeys(t,n).then((()=>{this.throwIfDestroyed();const i=this.createMediaKeySessionContext({decryptdata:o,keySystem:t,mediaKeys:n});return this.generateRequestWithPreferredKeySession(i,e,r,"encrypted-event-no-match")}))}))),u.catch((t=>this.handleError(t)))}_onWaitingForKey(t){this.log(`"${t.type}" event`)}attemptSetMediaKeys(t,e){const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${t}"`);const n=Promise.all(r).then((()=>{if(!this.media)throw new Error("Attempted to set mediaKeys without media element attached");return this.media.setMediaKeys(e)}));return this.setMediaKeysQueue.push(n),n.then((()=>{this.log(`Media-keys set for "${t}"`),r.push(n),this.setMediaKeysQueue=this.setMediaKeysQueue.filter((t=>-1===r.indexOf(t)))}))}generateRequestWithPreferredKeySession(t,e,r,n){var i,s;const a=null==(i=this.config.drmSystems)||null==(s=i[t.keySystem])?void 0:s.generateRequest;if(a)try{const n=a.call(this.hls,e,r,t);if(!n)throw new Error("Invalid response from configured generateRequest filter");e=n.initDataType,r=t.decryptdata.pssh=n.initData?new Uint8Array(n.initData):null}catch(t){var o;if(this.warn(t.message),null!=(o=this.hls)&&o.config.debug)throw t}if(null===r)return this.log(`Skipping key-session request for "${n}" (no initData)`),Promise.resolve(t);const l=this.getKeyIdString(t.decryptdata);this.log(`Generating key-session request for "${n}": ${l} (init data type: ${e} length: ${r?r.byteLength:null})`);const u=new ci,c=t._onmessage=e=>{const r=t.mediaKeysSession;if(!r)return void u.emit("error",new Error("invalid state"));const{messageType:n,message:i}=e;this.log(`"${n}" message event for session "${r.sessionId}" message size: ${i.byteLength}`),"license-request"===n||"license-renewal"===n?this.renewLicense(t,i).catch((t=>{this.handleError(t),u.emit("error",t)})):"license-release"===n?t.keySystem===j.FAIRPLAY&&(this.updateKeySession(t,B("acknowledged")),this.removeSession(t)):this.warn(`unhandled media key message type "${n}"`)},h=t._onkeystatuseschange=e=>{if(!t.mediaKeysSession)return void u.emit("error",new Error("invalid state"));this.onKeyStatusChange(t);const r=t.keyStatus;u.emit("keyStatus",r),"expired"===r&&(this.warn(`${t.keySystem} expired for key ${l}`),this.renewKeySession(t))};t.mediaKeysSession.addEventListener("message",c),t.mediaKeysSession.addEventListener("keystatuseschange",h);const d=new Promise(((t,e)=>{u.on("error",e),u.on("keyStatus",(r=>{r.startsWith("usable")?t():"output-restricted"===r?e(new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED,fatal:!1},"HDCP level output restricted")):"internal-error"===r?e(new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_STATUS_INTERNAL_ERROR,fatal:!0},`key status changed to "${r}"`)):"expired"===r?e(new Error("key expired while generating request")):this.warn(`unhandled key status change "${r}"`)}))}));return t.mediaKeysSession.generateRequest(e,r).then((()=>{var e;this.log(`Request generated for key-session "${null==(e=t.mediaKeysSession)?void 0:e.sessionId}" keyId: ${l}`)})).catch((t=>{throw new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_NO_SESSION,error:t,fatal:!1},`Error generating key-session request: ${t}`)})).then((()=>d)).catch((e=>{throw u.removeAllListeners(),this.removeSession(t),e})).then((()=>(u.removeAllListeners(),t)))}onKeyStatusChange(t){t.mediaKeysSession.keyStatuses.forEach(((e,r)=>{this.log(`key status change "${e}" for keyStatuses keyId: ${vt("buffer"in r?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(r))} session keyId: ${vt(new Uint8Array(t.decryptdata.keyId||[]))} uri: ${t.decryptdata.uri}`),t.keyStatus=e}))}fetchServerCertificate(t){const e=this.config,r=new(0,e.loader)(e),n=this.getServerCertificateUrl(t);return n?(this.log(`Fetching server certificate for "${t}"`),new Promise(((i,s)=>{const a={responseType:"arraybuffer",url:n},o=e.certLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(t,e,r,n)=>{i(t.data)},onError:(e,r,i,o)=>{s(new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:i,response:d({url:a.url,data:void 0},e)},`"${t}" certificate request failed (${n}). Status: ${e.code} (${e.text})`))},onTimeout:(e,r,i)=>{s(new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:i,response:{url:a.url,data:void 0}},`"${t}" certificate request timed out (${n})`))},onAbort:(t,e,r)=>{s(new Error("aborted"))}};r.load(a,l,u)}))):Promise.resolve()}setMediaKeysServerCertificate(t,e,r){return new Promise(((n,i)=>{t.setServerCertificate(r).then((i=>{this.log(`setServerCertificate ${i?"success":"not supported by CDM"} (${null==r?void 0:r.byteLength}) on "${e}"`),n(t)})).catch((t=>{i(new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:t,fatal:!0},t.message))}))}))}renewLicense(t,e){return this.requestLicense(t,new Uint8Array(e)).then((e=>this.updateKeySession(t,new Uint8Array(e)).catch((t=>{throw new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_SESSION_UPDATE_FAILED,error:t,fatal:!0},t.message)}))))}unpackPlayReadyKeyMessage(t,e){const r=String.fromCharCode.apply(null,new Uint16Array(e.buffer));if(!r.includes("PlayReadyKeyMessage"))return t.setRequestHeader("Content-Type","text/xml; charset=utf-8"),e;const n=(new DOMParser).parseFromString(r,"application/xml"),i=n.querySelectorAll("HttpHeader");if(i.length>0){let e;for(let r=0,n=i.length;r<n;r++){var s,a;e=i[r];const n=null==(s=e.querySelector("name"))?void 0:s.textContent,o=null==(a=e.querySelector("value"))?void 0:a.textContent;n&&o&&t.setRequestHeader(n,o)}}const o=n.querySelector("Challenge"),l=null==o?void 0:o.textContent;if(!l)throw new Error("Cannot find <Challenge> in key message");return B(atob(l))}setupLicenseXHR(t,e,r,n){const i=this.config.licenseXhrSetup;return i?Promise.resolve().then((()=>{if(!r.decryptdata)throw new Error("Key removed");return i.call(this.hls,t,e,r,n)})).catch((s=>{if(!r.decryptdata)throw s;return t.open("POST",e,!0),i.call(this.hls,t,e,r,n)})).then((r=>(t.readyState||t.open("POST",e,!0),{xhr:t,licenseChallenge:r||n}))):(t.open("POST",e,!0),Promise.resolve({xhr:t,licenseChallenge:n}))}requestLicense(t,e){const r=this.config.keyLoadPolicy.default;return new Promise(((n,i)=>{const s=this.getLicenseServerUrl(t.keySystem);this.log(`Sending license request to URL: ${s}`);const a=new XMLHttpRequest;a.responseType="arraybuffer",a.onreadystatechange=()=>{if(!this.hls||!t.mediaKeysSession)return i(new Error("invalid state"));if(4===a.readyState)if(200===a.status){this._requestLicenseFailureCount=0;let e=a.response;this.log(`License received ${e instanceof ArrayBuffer?e.byteLength:e}`);const r=this.config.licenseResponseCallback;if(r)try{e=r.call(this.hls,a,s,t)}catch(t){this.error(t)}n(e)}else{const o=r.errorRetry,l=o?o.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>l||a.status>=400&&a.status<500)i(new gs({type:y.KEY_SYSTEM_ERROR,details:E.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0,networkDetails:a,response:{url:s,data:void 0,code:a.status,text:a.statusText}},`License Request XHR failed (${s}). Status: ${a.status} (${a.statusText})`));else{const r=l-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${r} attempts left`),this.requestLicense(t,e).then(n,i)}}},t.licenseXhr&&t.licenseXhr.readyState!==XMLHttpRequest.DONE&&t.licenseXhr.abort(),t.licenseXhr=a,this.setupLicenseXHR(a,s,t,e).then((({xhr:e,licenseChallenge:r})=>{t.keySystem==j.PLAYREADY&&(r=this.unpackPlayReadyKeyMessage(e,r)),e.send(r)}))}))}onMediaAttached(t,e){if(!this.config.emeEnabled)return;const r=e.media;this.media=r,r.addEventListener("encrypted",this.onMediaEncrypted),r.addEventListener("waitingforkey",this.onWaitingForKey)}onMediaDetached(){const t=this.media,e=this.mediaKeySessions;t&&(t.removeEventListener("encrypted",this.onMediaEncrypted),t.removeEventListener("waitingforkey",this.onWaitingForKey),this.media=null),this._requestLicenseFailureCount=0,this.setMediaKeysQueue=[],this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},Gt.clearKeyUriToKeyIdMap();const r=e.length;ps.CDMCleanupPromise=Promise.all(e.map((t=>this.removeSession(t))).concat(null==t?void 0:t.setMediaKeys(null).catch((t=>{this.log(`Could not clear media keys: ${t}`)})))).then((()=>{r&&(this.log("finished closing key sessions and clearing media keys"),e.length=0)})).catch((t=>{this.log(`Could not close sessions and clear media keys: ${t}`)}))}onManifestLoading(){this.keyFormatPromise=null}onManifestLoaded(t,{sessionKeys:e}){if(e&&this.config.emeEnabled&&!this.keyFormatPromise){const t=e.reduce(((t,e)=>(-1===t.indexOf(e.keyFormat)&&t.push(e.keyFormat),t)),[]);this.log(`Selecting key-system from session-keys ${t.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(t)}}removeSession(t){const{mediaKeysSession:e,licenseXhr:r}=t;if(e){this.log(`Remove licenses and keys and close session ${e.sessionId}`),t._onmessage&&(e.removeEventListener("message",t._onmessage),t._onmessage=void 0),t._onkeystatuseschange&&(e.removeEventListener("keystatuseschange",t._onkeystatuseschange),t._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),t.mediaKeysSession=t.decryptdata=t.licenseXhr=void 0;const n=this.mediaKeySessions.indexOf(t);return n>-1&&this.mediaKeySessions.splice(n,1),e.remove().catch((t=>{this.log(`Could not remove session: ${t}`)})).then((()=>e.close())).catch((t=>{this.log(`Could not close session: ${t}`)}))}}}ps.CDMCleanupPromise=void 0;class gs extends Error{constructor(t,e){super(e),this.data=void 0,t.error||(t.error=new Error(e)),this.data=t,t.err=t.error}}var vs,ms,ys;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(vs||(vs={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(ms||(ms={})),function(t){t.OBJECT="CMCD-Object",t.REQUEST="CMCD-Request",t.SESSION="CMCD-Session",t.STATUS="CMCD-Status"}(ys||(ys={}));const Es={[ys.OBJECT]:["br","d","ot","tb"],[ys.REQUEST]:["bl","dl","mtp","nor","nrr","su"],[ys.SESSION]:["cid","pr","sf","sid","st","v"],[ys.STATUS]:["bs","rtp"]};class Ss{constructor(t,e){this.value=void 0,this.params=void 0,Array.isArray(t)&&(t=t.map((t=>t instanceof Ss?t:new Ss(t)))),this.value=t,this.params=e}}class bs{constructor(t){this.description=void 0,this.description=t}}const Ts="Dict";const _s="Bare Item",As="Boolean",Ls="Byte Sequence",ws="Decimal",Rs="Integer",ks=/[\x00-\x1f\x7f]+/,Ds="Token",Is="Key";function Ps(t,e,r){return function(t,e,r,n){return new Error(`failed to ${t} "${i=e,Array.isArray(i)?JSON.stringify(i):i instanceof Map?"Map{}":i instanceof Set?"Set{}":"object"==typeof i?JSON.stringify(i):String(i)}" as ${r}`,{cause:n});var i}("serialize",t,e,r)}function Os(t){if(function(t){return t<-999999999999999||999999999999999<t}(t))throw Ps(t,Rs);return t.toString()}function Cs(t,e){if(t<0)return-Cs(-t,e);const r=Math.pow(10,e);if(Math.abs(t*r%1-.5)<Number.EPSILON){const e=Math.floor(t*r);return(e%2==0?e:e+1)/r}return Math.round(t*r)/r}function xs(t){const e=Cs(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ps(t,ws);const r=e.toString();return r.includes(".")?r:`${r}.0`}const Ms="String";function Fs(t){const e=(r=t).description||r.toString().slice(7,-1);var r;if(!1===/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e))throw Ps(e,Ds);return e}function Ns(t){switch(typeof t){case"number":if(!p(t))throw Ps(t,_s);return Number.isInteger(t)?Os(t):xs(t);case"string":return function(t){if(ks.test(t))throw Ps(t,Ms);return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}(t);case"symbol":return Fs(t);case"boolean":return function(t){if("boolean"!=typeof t)throw Ps(t,As);return t?"?1":"?0"}(t);case"object":if(t instanceof Date)return function(t){return`@${Os(t.getTime()/1e3)}`}(t);if(t instanceof Uint8Array)return function(t){if(!1===ArrayBuffer.isView(t))throw Ps(t,Ls);return`:${e=t,btoa(String.fromCharCode(...e))}:`;var e}(t);if(t instanceof bs)return Fs(t);default:throw Ps(t,_s)}}function Bs(t){if(!1===/^[a-z*][a-z0-9\-_.*]*$/.test(t))throw Ps(t,Is);return t}function Us(t){return null==t?"":Object.entries(t).map((([t,e])=>!0===e?`;${Bs(t)}`:`;${Bs(t)}=${Ns(e)}`)).join("")}function js(t){return t instanceof Ss?`${Ns(t.value)}${Us(t.params)}`:Ns(t)}const Hs=t=>"ot"===t||"sf"===t||"st"===t,Gs=t=>"number"==typeof t?p(t):null!=t&&""!==t&&!1!==t,Vs=t=>Math.round(t),Ks=t=>100*Vs(t/100),$s={br:Vs,d:Vs,bl:Ks,dl:Ks,mtp:Ks,nor:(t,e)=>(null!=e&&e.baseUrl&&(t=function(t,e){const r=new URL(t),n=new URL(e);if(r.origin!==n.origin)return t;const i=r.pathname.split("/").slice(1),s=n.pathname.split("/").slice(1,-1);for(;i[0]===s[0];)i.shift(),s.shift();for(;s.length;)s.shift(),i.unshift("..");return i.join("/")}(t,e.baseUrl)),encodeURIComponent(t)),rtp:Ks,tb:Vs};function Ws(t,e={}){return t?function(t,e){return function(t,e={whitespace:!0}){if("object"!=typeof t)throw Ps(t,Ts);const r=t instanceof Map?t.entries():Object.entries(t),n=null!=e&&e.whitespace?" ":"";return Array.from(r).map((([t,e])=>{e instanceof Ss==0&&(e=new Ss(e));let r=Bs(t);var n;return!0===e.value?r+=Us(e.params):(r+="=",Array.isArray(e.value)?r+=`(${(n=e).value.map(js).join(" ")})${Us(n.params)}`:r+=js(e)),r})).join(`,${n}`)}(t,e)}(function(t,e){const r={};if(null==t||"object"!=typeof t)return r;const n=Object.keys(t).sort(),i=f({},$s,null==e?void 0:e.formatters),s=null==e?void 0:e.filter;return n.forEach((n=>{if(null!=s&&s(n))return;let a=t[n];const o=i[n];o&&(a=o(a,e)),"v"===n&&1===a||"pr"==n&&1===a||Gs(a)&&(Hs(n)&&"string"==typeof a&&(a=new bs(a)),r[n]=a)})),r}(t,e),f({whitespace:!1},e)):""}const qs=/CMCD=[^&#]+/;function Ys(t,e,r,n){t&&Object.keys(e).forEach((i=>{const s=t.filter((t=>t.groupId===i)).map((t=>{const s=f({},t);return s.details=void 0,s.attrs=new w(s.attrs),s.url=s.attrs.URI=zs(t.url,t.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",r),s.groupId=s.attrs["GROUP-ID"]=e[i],s.attrs["PATHWAY-ID"]=n,s}));t.push(...s)}))}function zs(t,e,r,n){const{HOST:i,PARAMS:s,[r]:a}=n;let o;e&&(o=null==a?void 0:a[e],o&&(t=o));const l=new self.URL(t);return i&&!o&&(l.host=i),s&&Object.keys(s).sort().forEach((t=>{t&&l.searchParams.set(t,s[t])})),l.href}const Xs=/^age:\s*[\d.]+\s*$/im;class Js{constructor(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=null,this.loader=null,this.stats=void 0,this.xhrSetup=t&&t.xhrSetup||null,this.stats=new D,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const 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()))}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(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()}loadInternal(){const{config:t,context:e}=this;if(!t||!e)return;const r=this.loader=new self.XMLHttpRequest,n=this.stats;n.loading.first=0,n.loaded=0,n.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then((()=>{if(this.loader===r&&!this.stats.aborted)return i(r,e.url)})).catch((t=>{if(this.loader===r&&!this.stats.aborted)return r.open("GET",e.url,!0),i(r,e.url)})).then((()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,e,t)})).catch((t=>{this.callbacks.onError({code:r.status,text:t.message},e,r,n)})):this.openAndSendXhr(r,e,t)}openAndSendXhr(t,e,r){t.readyState||t.open("GET",e.url,!0);const n=e.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:s}=r.loadPolicy;if(n)for(const e in n)t.setRequestHeader(e,n[e]);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=i&&p(i)?i:s,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),t.send()}readystatechange(){const{context:t,loader:e,stats:r}=this;if(!t||!e)return;const n=e.readyState,i=this.config;if(!r.aborted&&n>=2&&(0===r.loading.first&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),4===n)){self.clearTimeout(this.requestTimeout),e.onreadystatechange=null,e.onprogress=null;const n=e.status,s="text"!==e.responseType;if(n>=200&&n<300&&(s&&e.response||null!==e.responseText)){r.loading.end=Math.max(self.performance.now(),r.loading.first);const i=s?e.response:e.responseText,a="arraybuffer"===e.responseType?i.byteLength:i.length;if(r.loaded=r.total=a,r.bwEstimate=8e3*r.total/(r.loading.end-r.loading.first),!this.callbacks)return;const o=this.callbacks.onProgress;if(o&&o(r,t,i,e),!this.callbacks)return;const l={url:e.responseURL,data:i,code:n};this.callbacks.onSuccess(l,r,t,e)}else{const s=i.loadPolicy.errorRetry;sr(s,r.retry,!1,{url:t.url,data:void 0,code:n})?this.retry(s):(_.error(`${n} while loading ${t.url}`),this.callbacks.onError({code:n,text:e.statusText},t,e,r))}}}loadtimeout(){if(!this.config)return;const t=this.config.loadPolicy.timeoutRetry;if(sr(t,this.stats.retry,!0))this.retry(t);else{var e;_.warn(`timeout while loading ${null==(e=this.context)?void 0:e.url}`);const t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))}}retry(t){const{context:e,stats:r}=this;this.retryDelay=nr(t,r.retry),r.retry++,_.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${null==e?void 0: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)}loadprogress(t){const e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)}getCacheAge(){let t=null;if(this.loader&&Xs.test(this.loader.getAllResponseHeaders())){const e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.loader&&new RegExp(`^${t}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(t):null}}const Qs=/(\d+)-(\d+)\/(\d+)/;class Zs{constructor(t){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=t.fetchSetup||ta,this.controller=new self.AbortController,this.stats=new D}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var t;this.abortInternal(),null!=(t=this.callbacks)&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(t,e,r){const n=this.stats;if(n.loading.start)throw new Error("Loader can only be used once.");n.loading.start=self.performance.now();const i=function(t,e){const r={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(f({},t.headers))};return t.rangeEnd&&r.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),r}(t,this.controller.signal),s=r.onProgress,a="arraybuffer"===t.responseType,o=a?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:u}=e.loadPolicy;this.context=t,this.config=e,this.callbacks=r,this.request=this.fetchSetup(t,i),self.clearTimeout(this.requestTimeout),e.timeout=l&&p(l)?l:u,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),r.onTimeout(n,t,this.response)}),e.timeout),self.fetch(this.request).then((i=>{this.response=this.loader=i;const o=Math.max(self.performance.now(),n.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=u,this.requestTimeout=self.setTimeout((()=>{this.abortInternal(),r.onTimeout(n,t,this.response)}),u-(o-n.loading.start)),!i.ok){const{status:t,statusText:e}=i;throw new ea(e||"fetch, bad network response",t,i)}return n.loading.first=o,n.total=function(t){const e=t.get("Content-Range");if(e){const t=function(t){const e=Qs.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}(e);if(p(t))return t}const r=t.get("Content-Length");if(r)return parseInt(r)}(i.headers)||n.total,s&&p(e.highWaterMark)?this.loadProgressively(i,n,t,e.highWaterMark,s):a?i.arrayBuffer():"json"===t.responseType?i.json():i.text()})).then((i=>{const a=this.response;if(!a)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),n.loading.end=Math.max(self.performance.now(),n.loading.first);const l=i[o];l&&(n.loaded=n.total=l);const u={url:a.url,data:i,code:a.status};s&&!p(e.highWaterMark)&&s(n,t,i,a),r.onSuccess(u,n,t,a)})).catch((e=>{if(self.clearTimeout(this.requestTimeout),n.aborted)return;const i=e&&e.code||0,s=e?e.message:null;r.onError({code:i,text:s},t,e?e.details:null,n)}))}getCacheAge(){let t=null;if(this.response){const e=this.response.headers.get("age");t=e?parseFloat(e):null}return t}getResponseHeader(t){return this.response?this.response.headers.get(t):null}loadProgressively(t,e,r,n=0,i){const s=new an,a=t.body.getReader(),o=()=>a.read().then((a=>{if(a.done)return s.dataLength&&i(e,r,s.flush(),t),Promise.resolve(new ArrayBuffer(0));const l=a.value,u=l.length;return e.loaded+=u,u<n||s.dataLength?(s.push(l),s.dataLength>=n&&i(e,r,s.flush(),t)):i(e,r,l,t),o()})).catch((()=>Promise.reject()));return o()}}function ta(t,e){return new self.Request(t.url,e)}class ea extends Error{constructor(t,e,r){super(t),this.code=void 0,this.details=void 0,this.code=e,this.details=r}}const ra=/\s/,na={newCue(t,e,r,n){const i=[];let s,a,o,l,u;const c=self.VTTCue||self.TextTrackCue;for(let d=0;d<n.rows.length;d++)if(s=n.rows[d],o=!0,l=0,u="",!s.isEmpty()){var h;for(let t=0;t<s.chars.length;t++)ra.test(s.chars[t].uchar)&&o?l++:(u+=s.chars[t].uchar,o=!1);s.cueStartTime=e,e===r&&(r+=1e-4),l>=16?l--:l++;const n=qi(u.trim()),f=Qi(e,r,n);null!=t&&null!=(h=t.cues)&&h.getCueById(f)||(a=new c(e,r,n),a.id=f,a.line=d+1,a.align="left",a.position=10+Math.min(80,10*Math.floor(8*l/32)),i.push(a))}return t&&i.length&&(i.sort(((t,e)=>"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line)),i.forEach((e=>Ie(t,e)))),i}},ia=d(d({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,maxBufferSize:6e7,maxBufferHole:.1,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,maxFragLookUpTolerance:.25,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:Js,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:class{constructor(t){this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.bwEstimator=void 0,this._abandonRulesCheck=()=>{const{fragCurrent:t,partCurrent:e,hls:r}=this,{autoLevelEnabled:n,media:i}=r;if(!t||!i)return;const s=performance.now(),a=e?e.stats:t.stats,o=e?e.duration:t.duration,l=s-a.loading.start,u=r.minAutoLevel;if(a.aborted||a.loaded&&a.loaded===a.total||t.level<=u)return this.clearTimer(),void(this._nextAutoLevel=-1);if(!n||i.paused||!i.playbackRate||!i.readyState)return;const c=r.mainForwardBufferInfo;if(null===c)return;const h=this.bwEstimator.getEstimateTTFB(),d=Math.abs(i.playbackRate);if(l<=Math.max(h,o/(2*d)*1e3))return;const f=c.len/d,g=a.loading.first?a.loading.first-a.loading.start:-1,v=a.loaded&&g>-1,y=this.getBwEstimate(),E=r.levels,S=E[t.level],b=a.total||Math.max(a.loaded,Math.round(o*S.averageBitrate/8));let T=v?l-g:l;T<1&&v&&(T=Math.min(l,8*a.loaded/y));const A=v?1e3*a.loaded/T:0,L=A?(b-a.loaded)/A:8*b/y+h/1e3;if(L<=f)return;const w=A?8*A:y;let R,k=Number.POSITIVE_INFINITY;for(R=t.level-1;R>u;R--){const t=E[R].maxBitrate;if(k=this.getTimeToLoadFrag(h/1e3,w,o*t,!E[R].details),k<f)break}if(k>=L)return;if(k>10*o)return;r.nextLoadLevel=r.nextAutoLevel=R,v?this.bwEstimator.sample(l-Math.min(h,g),a.loaded):this.bwEstimator.sampleTTFB(l);const D=E[R].maxBitrate;this.getBwEstimate()*this.hls.config.abrBandWidthUpFactor>D&&this.resetEstimator(D),this.clearTimer(),_.warn(`[abr] Fragment ${t.sn}${e?" part "+e.index:""} of level ${t.level} is loading too slowly;\n      Time to underbuffer: ${f.toFixed(3)} s\n      Estimated load time for current fragment: ${L.toFixed(3)} s\n      Estimated load time for down switch fragment: ${k.toFixed(3)} s\n      TTFB estimate: ${0|g} ms\n      Current BW estimate: ${p(y)?0|y:"Unknown"} bps\n      New BW estimate: ${0|this.getBwEstimate()} bps\n      Switching to level ${R} @ ${0|D} bps`),r.trigger(m.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:a})},this.hls=t,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(t){t&&(_.log(`setting initial bwe to ${t}`),this.hls.config.abrEwmaDefaultEstimate=t),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const t=this.hls.config;return new dr(t.abrEwmaSlowVoD,t.abrEwmaFastVoD,t.abrEwmaDefaultEstimate)}registerListeners(){const{hls:t}=this;t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.FRAG_LOADING,this.onFragLoading,this),t.on(m.FRAG_LOADED,this.onFragLoaded,this),t.on(m.FRAG_BUFFERED,this.onFragBuffered,this),t.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(m.LEVEL_LOADED,this.onLevelLoaded,this),t.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t&&(t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.FRAG_LOADING,this.onFragLoading,this),t.off(m.FRAG_LOADED,this.onFragLoaded,this),t.off(m.FRAG_BUFFERED,this.onFragBuffered,this),t.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(m.LEVEL_LOADED,this.onLevelLoaded,this),t.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(m.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),t.off(m.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(t,e){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(t,e){const r=e.frag;var n;this.ignoreFragment(r)||(r.bitrateTest||(this.fragCurrent=r,this.partCurrent=null!=(n=e.part)?n:null),this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100))}onLevelSwitching(t,e){this.clearTimer()}onError(t,e){if(!e.fatal)switch(e.details){case E.BUFFER_ADD_CODEC_ERROR:case E.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case E.FRAG_LOAD_TIMEOUT:{const t=e.frag,{fragCurrent:r,partCurrent:n}=this;if(t&&r&&t.sn===r.sn&&t.level===r.level){const e=performance.now(),r=n?n.stats:t.stats,i=e-r.loading.start,s=r.loading.first?r.loading.first-r.loading.start:-1;if(r.loaded&&s>-1){const t=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(i-Math.min(t,s),r.loaded)}else this.bwEstimator.sampleTTFB(i)}break}}}getTimeToLoadFrag(t,e,r,n){return t+r/e+(n?this.lastLevelLoadSec:0)}onLevelLoaded(t,e){const r=this.hls.config,{loading:n}=e.stats,i=n.end-n.start;p(i)&&(this.lastLevelLoadSec=i/1e3),e.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD)}onFragLoaded(t,{frag:e,part:r}){const n=r?r.stats:e.stats;if(e.type===_e&&this.bwEstimator.sampleTTFB(n.loading.first-n.loading.start),!this.ignoreFragment(e)){if(this.clearTimer(),e.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const t=r?r.duration:e.duration,i=this.hls.levels[e.level],s=(i.loaded?i.loaded.bytes:0)+n.loaded,a=(i.loaded?i.loaded.duration:0)+t;i.loaded={bytes:s,duration:a},i.realBitrate=Math.round(8*s/a)}if(e.bitrateTest){const t={stats:n,frag:e,part:r,id:e.type};this.onFragBuffered(m.FRAG_BUFFERED,t),e.bitrateTest=!1}else this.lastLoadedFragLevel=e.level}}onFragBuffered(t,e){const{frag:r,part:n}=e,i=null!=n&&n.stats.loaded?n.stats:r.stats;if(i.aborted)return;if(this.ignoreFragment(r))return;const s=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(s,i.loaded),i.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=s/1e3:this.bitrateTestDelay=0}ignoreFragment(t){return t.type!==_e||"initSegment"===t.sn}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:t,minAutoLevel:e}=this.hls,r=this.getBwEstimate(),n=this.hls.config.maxStarvationDelay,i=this.findBestLevel(r,e,t,0,n,1,1);if(i>-1)return i;const s=this.hls.firstLevel,a=Math.min(Math.max(s,e),t);return _.warn(`[abr] Could not find best starting auto level. Defaulting to first in playlist ${s} clamped to ${a}`),a}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const t=this.forcedAutoLevel,e=this.bwEstimator.canEstimate(),r=this.lastLoadedFragLevel>-1;if(!(-1===t||e&&r&&this.nextAutoLevelKey!==this.getAutoLevelKey()))return t;const n=e&&r?this.getNextABRAutoLevel():this.firstAutoLevel;if(-1!==t){const e=this.hls.levels;if(e.length>Math.max(t,n)&&e[t].loadError<=e[n].loadError)return t}return this._nextAutoLevel=n,this.nextAutoLevelKey=this.getAutoLevelKey(),n}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:t,partCurrent:e,hls:r}=this,{maxAutoLevel:n,config:i,minAutoLevel:s}=r,a=e?e.duration:t?t.duration:0,o=this.getBwEstimate(),l=this.getStarvationDelay();let u=i.abrBandWidthFactor,c=i.abrBandWidthUpFactor;if(l){const t=this.findBestLevel(o,s,n,l,0,u,c);if(t>=0)return t}let h=a?Math.min(a,i.maxStarvationDelay):i.maxStarvationDelay;if(!l){const t=this.bitrateTestDelay;t&&(h=(a?Math.min(a,i.maxLoadingDelay):i.maxLoadingDelay)-t,_.info(`[abr] bitrate test took ${Math.round(1e3*t)}ms, set first fragment max fetchDuration to ${Math.round(1e3*h)} ms`),u=c=1)}const d=this.findBestLevel(o,s,n,l,h,u,c);if(_.info(`[abr] ${l?"rebuffering expected":"buffer is empty"}, optimal quality level ${d}`),d>-1)return d;const f=r.levels[s],p=r.levels[r.loadLevel];return(null==f?void 0:f.bitrate)<(null==p?void 0:p.bitrate)?s:r.loadLevel}getStarvationDelay(){const t=this.hls,e=t.media;if(!e)return 1/0;const r=e&&0!==e.playbackRate?Math.abs(e.playbackRate):1,n=t.mainForwardBufferInfo;return(n?n.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(t,e,r,n,i,s,a){var o;const l=n+i,u=this.lastLoadedFragLevel,c=-1===u?this.hls.firstLevel:u,{fragCurrent:h,partCurrent:d}=this,{levels:f,allAudioTracks:g,loadLevel:v,config:m}=this.hls;if(1===f.length)return 0;const y=f[c],E=!(null==y||null==(o=y.details)||!o.live),S=-1===v||-1===u;let b,T="SDR",A=(null==y?void 0:y.frameRate)||0;const{audioPreference:L,videoPreference:w}=m,R=this.audioTracksByGroup||(this.audioTracksByGroup=function(t){return t.reduce(((t,e)=>{let r=t.groups[e.groupId];r||(r=t.groups[e.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(e);const n=e.channels||"2";return r.channels[n]=(r.channels[n]||0)+1,r.hasDefault=r.hasDefault||e.default,r.hasAutoSelect=r.hasAutoSelect||e.autoselect,r.hasDefault&&(t.hasDefaultAudio=!0),r.hasAutoSelect&&(t.hasAutoSelectAudio=!0),t}),{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}(g));if(S){if(-1!==this.firstSelection)return this.firstSelection;const n=this.codecTiers||(this.codecTiers=function(t,e,r,n){return t.slice(r,n+1).reduce(((t,r)=>{if(!r.codecSet)return t;const n=r.audioGroups;let i=t[r.codecSet];i||(t[r.codecSet]=i={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!n,fragmentError:0}),i.minBitrate=Math.min(i.minBitrate,r.bitrate);const s=Math.min(r.height,r.width);return i.minHeight=Math.min(i.minHeight,s),i.minFramerate=Math.min(i.minFramerate,r.frameRate),i.maxScore=Math.max(i.maxScore,r.score),i.fragmentError+=r.fragmentError,i.videoRanges[r.videoRange]=(i.videoRanges[r.videoRange]||0)+1,n&&n.forEach((t=>{if(!t)return;const r=e.groups[t];r&&(i.hasDefaultAudio=i.hasDefaultAudio||e.hasDefaultAudio?r.hasDefault:r.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(r.channels).forEach((t=>{i.channels[t]=(i.channels[t]||0)+r.channels[t]})))})),t}),{})}(f,R,e,r)),i=function(t,e,r,n,i){const s=Object.keys(t),a=null==n?void 0:n.channels,o=null==n?void 0:n.audioCodec,l=a&&2===parseInt(a);let u=!0,c=!1,h=1/0,d=1/0,f=1/0,g=0,v=[];const{preferHDR:m,allowedVideoRanges:y}=function(t,e){let r=!1,n=[];return t&&(r="SDR"!==t,n=[t]),e&&(n=e.allowedVideoRanges||Ve.slice(0),r=void 0!==e.preferHDR?e.preferHDR:function(){if("function"==typeof matchMedia){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return!0===t.matches}return!1}(),n=r?n.filter((t=>"SDR"!==t)):["SDR"]),{preferHDR:r,allowedVideoRanges:n}}(e,i);for(let e=s.length;e--;){const r=t[s[e]];u=r.channels[2]>0,h=Math.min(h,r.minHeight),d=Math.min(d,r.minFramerate),f=Math.min(f,r.minBitrate);const n=y.filter((t=>r.videoRanges[t]>0));n.length>0&&(c=!0,v=n)}h=p(h)?h:0,d=p(d)?d:0;const E=Math.max(1080,h),S=Math.max(30,d);return f=p(f)?f:r,r=Math.max(f,r),c||(e=void 0,v=[]),{codecSet:s.reduce(((e,n)=>{const i=t[n];if(n===e)return e;if(i.minBitrate>r)return mr(n,`min bitrate of ${i.minBitrate} > current estimate of ${r}`),e;if(!i.hasDefaultAudio)return mr(n,"no renditions with default or auto-select sound found"),e;if(o&&n.indexOf(o.substring(0,4))%5!=0)return mr(n,`audio codec preference "${o}" not found`),e;if(a&&!l){if(!i.channels[a])return mr(n,`no renditions with ${a} channel sound found (channels options: ${Object.keys(i.channels)})`),e}else if((!o||l)&&u&&0===i.channels[2])return mr(n,"no renditions with stereo sound found"),e;return i.minHeight>E?(mr(n,`min resolution of ${i.minHeight} > maximum of ${E}`),e):i.minFramerate>S?(mr(n,`min framerate of ${i.minFramerate} > maximum of ${S}`),e):v.some((t=>i.videoRanges[t]>0))?i.maxScore<g?(mr(n,`max score of ${i.maxScore} < selected max of ${g}`),e):e&&(ee(n)>=ee(e)||i.fragmentError>t[e].fragmentError)?e:(g=i.maxScore,n):(mr(n,`no variants with VIDEO-RANGE of ${JSON.stringify(v)} found`),e)}),void 0),videoRanges:v,preferHDR:m,minFramerate:d,minBitrate:f}}(n,T,t,L,w),{codecSet:s,videoRanges:a,minFramerate:o,minBitrate:l,preferHDR:u}=i;b=s,T=u?a[a.length-1]:a[0],A=o,t=Math.max(t,l),_.log(`[abr] picked start tier ${JSON.stringify(i)}`)}else b=null==y?void 0:y.codecSet,T=null==y?void 0:y.videoRange;const k=d?d.duration:h?h.duration:0,D=this.bwEstimator.getEstimateTTFB()/1e3,I=[];for(let o=r;o>=e;o--){var P;const e=f[o],h=o>c;if(!e)continue;if(m.useMediaCapabilities&&!e.supportedResult&&!e.supportedPromise){const r=navigator.mediaCapabilities;"function"==typeof(null==r?void 0:r.decodingInfo)&&gr(e,R,T,A,t,L)?(e.supportedPromise=vr(e,R,r),e.supportedPromise.then((t=>{if(!this.hls)return;e.supportedResult=t;const r=this.hls.levels,n=r.indexOf(e);t.error?_.warn(`[abr] MediaCapabilities decodingInfo error: "${t.error}" for level ${n} ${JSON.stringify(t)}`):t.supported||(_.warn(`[abr] Unsupported MediaCapabilities decodingInfo result for level ${n} ${JSON.stringify(t)}`),n>-1&&r.length>1&&(_.log(`[abr] Removing unsupported level ${n}`),this.hls.removeLevel(n)))}))):e.supportedResult=fr}if(b&&e.codecSet!==b||T&&e.videoRange!==T||h&&A>e.frameRate||!h&&A>0&&A<e.frameRate||e.supportedResult&&(null==(P=e.supportedResult.decodingInfoResults)||!P[0].smooth)){I.push(o);continue}const g=e.details,w=(d?null==g?void 0:g.partTarget:null==g?void 0:g.averagetargetduration)||k;let O;O=h?a*t:s*t;const C=k&&n>=2*k&&0===i?f[o].averageBitrate:f[o].maxBitrate,x=this.getTimeToLoadFrag(D,O,C*w,void 0===g);if(O>=C&&(o===u||0===e.loadError&&0===e.fragmentError)&&(x<=D||!p(x)||E&&!this.bitrateTestDelay||x<l)){const t=this.forcedAutoLevel;return o===v||-1!==t&&t===v||(I.length&&_.trace(`[abr] Skipped level(s) ${I.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${f[I[0]].codecs}" ${f[I[0]].videoRange}; not compatible with "${y.codecs}" ${T}`),_.info(`[abr] switch candidate:${c}->${o} adjustedbw(${Math.round(O)})-bitrate=${Math.round(O-C)} ttfb:${D.toFixed(1)} avgDuration:${w.toFixed(1)} maxFetchDuration:${l.toFixed(1)} fetchDuration:${x.toFixed(1)} firstSelection:${S} codecSet:${b} videoRange:${T} hls.loadLevel:${v}`)),S&&(this.firstSelection=o),o}}return-1}set nextAutoLevel(t){const{maxAutoLevel:e,minAutoLevel:r}=this.hls,n=Math.min(Math.max(t,r),e);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}},bufferController:class{constructor(t){this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.appendSource=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this.log=void 0,this.warn=void 0,this.error=void 0,this._onEndStreaming=t=>{this.hls&&this.hls.pauseBuffering()},this._onStartStreaming=t=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=()=>{const{media:t,mediaSource:e}=this;this.log("Media source opened"),t&&(t.removeEventListener("emptied",this._onMediaEmptied),this.updateMediaElementDuration(),this.hls.trigger(m.MEDIA_ATTACHED,{media:t,mediaSource:e})),e&&e.removeEventListener("sourceopen",this._onMediaSourceOpen),this.checkPendingTracks()},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:t,_objectUrl:e}=this;t!==e&&_.error(`Media element src was set while attaching MediaSource (${e} > ${t})`)},this.hls=t;const e="[buffer-controller]";var r;this.appendSource=(r=zt(t.config.preferManagedMediaSource),"undefined"!=typeof self&&r===self.ManagedMediaSource),this.log=_.log.bind(_,e),this.warn=_.warn.bind(_,e),this.error=_.error.bind(_,e),this._initSourceBuffer(),this.registerListeners()}hasSourceTypes(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.hls=null}registerListeners(){const{hls:t}=this;t.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_PARSED,this.onManifestParsed,this),t.on(m.BUFFER_RESET,this.onBufferReset,this),t.on(m.BUFFER_APPENDING,this.onBufferAppending,this),t.on(m.BUFFER_CODECS,this.onBufferCodecs,this),t.on(m.BUFFER_EOS,this.onBufferEos,this),t.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(m.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(m.FRAG_PARSED,this.onFragParsed,this),t.on(m.FRAG_CHANGED,this.onFragChanged,this)}unregisterListeners(){const{hls:t}=this;t.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_PARSED,this.onManifestParsed,this),t.off(m.BUFFER_RESET,this.onBufferReset,this),t.off(m.BUFFER_APPENDING,this.onBufferAppending,this),t.off(m.BUFFER_CODECS,this.onBufferCodecs,this),t.off(m.BUFFER_EOS,this.onBufferEos,this),t.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(m.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(m.FRAG_PARSED,this.onFragParsed,this),t.off(m.FRAG_CHANGED,this.onFragChanged,this)}_initSourceBuffer(){this.sourceBuffer={},this.operationQueue=new vi(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]},this.appendErrors={audio:0,video:0,audiovideo:0},this.lastMpegAudioChunk=null}onManifestLoading(){this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=0,this.details=null}onManifestParsed(t,e){let r=2;(e.audio&&!e.video||!e.altAudio)&&(r=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=r,this.log(`${this.bufferCodecEventsExpected} bufferCodec event(s) expected`)}onMediaAttaching(t,e){const r=this.media=e.media,n=zt(this.appendSource);if(r&&n){var i;const t=this.mediaSource=new n;this.log(`created media source: ${null==(i=t.constructor)?void 0:i.name}`),t.addEventListener("sourceopen",this._onMediaSourceOpen),t.addEventListener("sourceended",this._onMediaSourceEnded),t.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(t.addEventListener("startstreaming",this._onStartStreaming),t.addEventListener("endstreaming",this._onEndStreaming));const e=this._objectUrl=self.URL.createObjectURL(t);if(this.appendSource)try{r.removeAttribute("src");const n=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||n&&t instanceof n,yi(r),function(t,e){const r=self.document.createElement("source");r.type="video/mp4",r.src=e,t.appendChild(r)}(r,e),r.load()}catch(t){r.src=e}else r.src=e;r.addEventListener("emptied",this._onMediaEmptied)}}onMediaDetaching(){const{media:t,mediaSource:e,_objectUrl:r}=this;if(e){if(this.log("media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){this.warn(`onMediaDetaching: ${t.message} while calling endOfStream`)}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.removeEventListener("startstreaming",this._onStartStreaming),e.removeEventListener("endstreaming",this._onEndStreaming)),t&&(t.removeEventListener("emptied",this._onMediaEmptied),r&&self.URL.revokeObjectURL(r),this.mediaSrc===r?(t.removeAttribute("src"),this.appendSource&&yi(t),t.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(m.MEDIA_DETACHED,void 0)}onBufferReset(){this.getSourceBufferTypes().forEach((t=>{this.resetBuffer(t)})),this._initSourceBuffer()}resetBuffer(t){const e=this.sourceBuffer[t];try{var r;e&&(this.removeBufferListeners(t),this.sourceBuffer[t]=void 0,null!=(r=this.mediaSource)&&r.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(e))}catch(e){this.warn(`onBufferReset ${t}`,e)}}onBufferCodecs(t,e){const r=this.getSourceBufferTypes().length,n=Object.keys(e);if(n.forEach((t=>{if(r){const r=this.tracks[t];if(r&&"function"==typeof r.buffer.changeType){var n;const{id:i,codec:s,levelCodec:a,container:o,metadata:l}=e[t],u=se(r.codec,r.levelCodec),c=null==u?void 0:u.replace(mi,"$1");let h=se(s,a);const d=null==(n=h)?void 0:n.replace(mi,"$1");if(h&&c!==d){"audio"===t.slice(0,5)&&(h=ie(h,this.appendSource));const e=`${o};codecs=${h}`;this.appendChangeType(t,e),this.log(`switching codec ${u} to ${h}`),this.tracks[t]={buffer:r.buffer,codec:s,container:o,levelCodec:a,metadata:l,id:i}}}}else this.pendingTracks[t]=e[t]})),r)return;const i=Math.max(this.bufferCodecEventsExpected-1,0);this.bufferCodecEventsExpected!==i&&(this.log(`${i} bufferCodec event(s) expected ${n.join(",")}`),this.bufferCodecEventsExpected=i),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks()}appendChangeType(t,e){const{operationQueue:r}=this,n={execute:()=>{const n=this.sourceBuffer[t];n&&(this.log(`changing ${t} sourceBuffer type to ${e}`),n.changeType(e)),r.shiftAndExecuteNext(t)},onStart:()=>{},onComplete:()=>{},onError:e=>{this.warn(`Failed to change ${t} SourceBuffer type`,e)}};r.append(n,t,!!this.pendingTracks[t])}onBufferAppending(t,e){const{hls:r,operationQueue:n,tracks:i}=this,{data:s,type:a,frag:o,part:l,chunkMeta:u}=e,c=u.buffering[a],h=self.performance.now();c.start=h;const d=o.stats.buffering,f=l?l.stats.buffering:null;0===d.start&&(d.start=h),f&&0===f.start&&(f.start=h);const p=i.audio;let g=!1;"audio"===a&&"audio/mpeg"===(null==p?void 0:p.container)&&(g=!this.lastMpegAudioChunk||1===u.id||this.lastMpegAudioChunk.sn!==u.sn,this.lastMpegAudioChunk=u);const v=o.start,S={execute:()=>{if(c.executeStart=self.performance.now(),g){const t=this.sourceBuffer[a];if(t){const e=v-t.timestampOffset;Math.abs(e)>=.1&&(this.log(`Updating audio SourceBuffer timestampOffset to ${v} (delta: ${e}) sn: ${o.sn})`),t.timestampOffset=v)}}this.appendExecutor(s,a)},onStart:()=>{},onComplete:()=>{const t=self.performance.now();c.executeEnd=c.end=t,0===d.first&&(d.first=t),f&&0===f.first&&(f.first=t);const{sourceBuffer:e}=this,r={};for(const t in e)r[t]=Pr.getBuffered(e[t]);this.appendErrors[a]=0,"audio"===a||"video"===a?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(m.BUFFER_APPENDED,{type:a,frag:o,part:l,chunkMeta:u,parent:o.type,timeRanges:r})},onError:t=>{const e={type:y.MEDIA_ERROR,parent:o.type,details:E.BUFFER_APPEND_ERROR,sourceBufferName:a,frag:o,part:l,chunkMeta:u,error:t,err:t,fatal:!1};if(t.code===DOMException.QUOTA_EXCEEDED_ERR)e.details=E.BUFFER_FULL_ERROR;else{const t=++this.appendErrors[a];e.details=E.BUFFER_APPEND_ERROR,this.warn(`Failed ${t}/${r.config.appendErrorMaxRetry} times to append segment in "${a}" sourceBuffer`),t>=r.config.appendErrorMaxRetry&&(e.fatal=!0)}r.trigger(m.ERROR,e)}};n.append(S,a,!!this.pendingTracks[a])}onBufferFlushing(t,e){const{operationQueue:r}=this,n=t=>({execute:this.removeExecutor.bind(this,t,e.startOffset,e.endOffset),onStart:()=>{},onComplete:()=>{this.hls.trigger(m.BUFFER_FLUSHED,{type:t})},onError:e=>{this.warn(`Failed to remove from ${t} SourceBuffer`,e)}});e.type?r.append(n(e.type),e.type):this.getSourceBufferTypes().forEach((t=>{r.append(n(t),t)}))}onFragParsed(t,e){const{frag:r,part:n}=e,i=[],s=n?n.elementaryStreams:r.elementaryStreams;s[O]?i.push("audiovideo"):(s[I]&&i.push("audio"),s[P]&&i.push("video")),0===i.length&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers((()=>{const t=self.performance.now();r.stats.buffering.end=t,n&&(n.stats.buffering.end=t);const e=n?n.stats:r.stats;this.hls.trigger(m.FRAG_BUFFERED,{frag:r,part:n,stats:e,id:r.type})}),i)}onFragChanged(t,e){this.trimBuffers()}onBufferEos(t,e){this.getSourceBufferTypes().reduce(((t,r)=>{const n=this.sourceBuffer[r];return!n||e.type&&e.type!==r||(n.ending=!0,n.ended||(n.ended=!0,this.log(`${r} sourceBuffer now EOS`))),t&&!(n&&!n.ended)}),!0)&&(this.log("Queueing mediaSource.endOfStream()"),this.blockBuffers((()=>{this.getSourceBufferTypes().forEach((t=>{const e=this.sourceBuffer[t];e&&(e.ending=!1)}));const{mediaSource:t}=this;t&&"open"===t.readyState?(this.log("Calling mediaSource.endOfStream()"),t.endOfStream()):t&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${t.readyState}`)})))}onLevelUpdated(t,{details:e}){e.fragments.length&&(this.details=e,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())}trimBuffers(){const{hls:t,details:e,media:r}=this;if(!r||null===e)return;if(!this.getSourceBufferTypes().length)return;const n=t.config,i=r.currentTime,s=e.levelTargetDuration,a=e.live&&null!==n.liveBackBufferLength?n.liveBackBufferLength:n.backBufferLength;if(p(a)&&a>0){const t=Math.max(a,s),e=Math.floor(i/s)*s-t;this.flushBackBuffer(i,s,e)}if(p(n.frontBufferFlushThreshold)&&n.frontBufferFlushThreshold>0){const t=Math.max(n.maxBufferLength,n.frontBufferFlushThreshold),e=Math.max(t,s),r=Math.floor(i/s)*s+e;this.flushFrontBuffer(i,s,r)}}flushBackBuffer(t,e,r){const{details:n,sourceBuffer:i}=this;this.getSourceBufferTypes().forEach((s=>{const a=i[s];if(a){const i=Pr.getBuffered(a);if(i.length>0&&r>i.start(0)){if(this.hls.trigger(m.BACK_BUFFER_REACHED,{bufferEnd:r}),null!=n&&n.live)this.hls.trigger(m.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(a.ended&&i.end(i.length-1)-t<2*e)return void this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}}))}flushFrontBuffer(t,e,r){const{sourceBuffer:n}=this;this.getSourceBufferTypes().forEach((i=>{const s=n[i];if(s){const n=Pr.getBuffered(s),a=n.length;if(a<2)return;const o=n.start(a-1),l=n.end(a-1);if(r>o||t>=o&&t<=l)return;if(s.ended&&t-l<2*e)return void this.log(`Cannot flush ${i} front buffer while SourceBuffer is in ended state`);this.hls.trigger(m.BUFFER_FLUSHING,{startOffset:o,endOffset:1/0,type:i})}}))}updateMediaElementDuration(){if(!this.details||!this.media||!this.mediaSource||"open"!==this.mediaSource.readyState)return;const{details:t,hls:e,media:r,mediaSource:n}=this,i=t.fragments[0].start+t.totalduration,s=r.duration,a=p(n.duration)?n.duration:0;t.live&&e.config.liveDurationInfinity?(n.duration=1/0,this.updateSeekableRange(t)):(i>a&&i>s||!p(s))&&(this.log(`Updating Media Source duration to ${i.toFixed(3)}`),n.duration=i)}updateSeekableRange(t){const e=this.mediaSource,r=t.fragments;if(r.length&&t.live&&null!=e&&e.setLiveSeekableRange){const n=Math.max(0,r[0].start),i=Math.max(n,n+t.totalduration);this.log(`Media Source duration is set to ${e.duration}. Setting seekable range to ${n}-${i}.`),e.setLiveSeekableRange(n,i)}}checkPendingTracks(){const{bufferCodecEventsExpected:t,operationQueue:e,pendingTracks:r}=this,n=Object.keys(r).length;if(n&&(!t||2===n||"audiovideo"in r)){this.createSourceBuffers(r),this.pendingTracks={};const t=this.getSourceBufferTypes();if(t.length)this.hls.trigger(m.BUFFER_CREATED,{tracks:this.tracks}),t.forEach((t=>{e.executeNext(t)}));else{const t=new Error("could not create source buffer for media codec(s)");this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:t,reason:t.message})}}}createSourceBuffers(t){const{sourceBuffer:e,mediaSource:r}=this;if(!r)throw Error("createSourceBuffers called when mediaSource was null");for(const i in t)if(!e[i]){var n;const s=t[i];if(!s)throw Error(`source buffer exists for track ${i}, however track does not`);let a=-1===(null==(n=s.levelCodec)?void 0:n.indexOf(","))?s.levelCodec:s.codec;a&&"audio"===i.slice(0,5)&&(a=ie(a,this.appendSource));const o=`${s.container};codecs=${a}`;this.log(`creating sourceBuffer(${o})`);try{const t=e[i]=r.addSourceBuffer(o),n=i;this.addBufferListener(n,"updatestart",this._onSBUpdateStart),this.addBufferListener(n,"updateend",this._onSBUpdateEnd),this.addBufferListener(n,"error",this._onSBUpdateError),this.appendSource&&this.addBufferListener(n,"bufferedchange",((t,e)=>{const r=e.removedRanges;null!=r&&r.length&&this.hls.trigger(m.BUFFER_FLUSHED,{type:i})})),this.tracks[i]={buffer:t,codec:a,container:s.container,levelCodec:s.levelCodec,metadata:s.metadata,id:s.id}}catch(t){this.error(`error while trying to add sourceBuffer: ${t.message}`),this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,sourceBufferName:i,mimeType:o})}}}get mediaSrc(){var t,e;const r=(null==(t=this.media)||null==(e=t.querySelector)?void 0:e.call(t,"source"))||this.media;return null==r?void 0:r.src}_onSBUpdateStart(t){const{operationQueue:e}=this;e.current(t).onStart()}_onSBUpdateEnd(t){var e;if("closed"===(null==(e=this.mediaSource)?void 0:e.readyState))return void this.resetBuffer(t);const{operationQueue:r}=this;r.current(t).onComplete(),r.shiftAndExecuteNext(t)}_onSBUpdateError(t,e){var r;const n=new Error(`${t} SourceBuffer error. MediaSource readyState: ${null==(r=this.mediaSource)?void 0:r.readyState}`);this.error(`${n}`,e),this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_APPENDING_ERROR,sourceBufferName:t,error:n,fatal:!1});const i=this.operationQueue.current(t);i&&i.onError(n)}removeExecutor(t,e,r){const{media:n,mediaSource:i,operationQueue:s,sourceBuffer:a}=this,o=a[t];if(!n||!i||!o)return this.warn(`Attempting to remove from the ${t} SourceBuffer, but it does not exist`),void s.shiftAndExecuteNext(t);const l=p(n.duration)?n.duration:1/0,u=p(i.duration)?i.duration:1/0,c=Math.max(0,e),h=Math.min(r,l,u);h>c&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${c},${h}] from the ${t} SourceBuffer`),o.remove(c,h)):s.shiftAndExecuteNext(t)}appendExecutor(t,e){const r=this.sourceBuffer[e];if(r)r.ended=!1,r.appendBuffer(t);else if(!this.pendingTracks[e])throw new Error(`Attempting to append to the ${e} SourceBuffer, but it does not exist`)}blockBuffers(t,e=this.getSourceBufferTypes()){if(!e.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(t);const{operationQueue:r}=this,n=e.map((t=>r.appendBlocker(t)));Promise.all(n).then((()=>{t(),e.forEach((t=>{const e=this.sourceBuffer[t];null!=e&&e.updating||r.shiftAndExecuteNext(t)}))}))}getSourceBufferTypes(){return Object.keys(this.sourceBuffer)}addBufferListener(t,e,r){const n=this.sourceBuffer[t];if(!n)return;const i=r.bind(this,t);this.listeners[t].push({event:e,listener:i}),n.addEventListener(e,i)}removeBufferListeners(t){const e=this.sourceBuffer[t];e&&this.listeners[t].forEach((t=>{e.removeEventListener(t.event,t.listener)}))}},capLevelController:ds,errorController:class{constructor(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=_.log.bind(_,"[info]:"),this.warn=_.warn.bind(_,"[warning]:"),this.error=_.error.bind(_,"[error]:"),this.registerListeners()}registerListeners(){const t=this.hls;t.on(m.ERROR,this.onError,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const t=this.hls;t&&(t.off(m.ERROR,this.onError,this),t.off(m.ERROR,this.onErrorOut,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null,this.penalizedRenditions={}}startLoad(t){}stopLoad(){this.playlistError=0}getVariantLevelIndex(t){return(null==t?void 0:t.type)===_e?t.level:this.hls.loadLevel}onManifestLoading(){this.playlistError=0,this.penalizedRenditions={}}onLevelUpdated(){this.playlistError=0}onError(t,e){var r,n;if(e.fatal)return;const i=this.hls,s=e.context;switch(e.details){case E.FRAG_LOAD_ERROR:case E.FRAG_LOAD_TIMEOUT:case E.KEY_LOAD_ERROR:case E.KEY_LOAD_TIMEOUT:return void(e.errorAction=this.getFragRetryOrSwitchAction(e));case E.FRAG_PARSING_ERROR:if(null!=(r=e.frag)&&r.gap)return void(e.errorAction={action:0,flags:0});case E.FRAG_GAP:case E.FRAG_DECRYPT_ERROR:return e.errorAction=this.getFragRetryOrSwitchAction(e),void(e.errorAction.action=2);case E.LEVEL_EMPTY_ERROR:case E.LEVEL_PARSING_ERROR:{var a,o;const t=e.parent===_e?e.level:i.loadLevel;e.details===E.LEVEL_EMPTY_ERROR&&null!=(a=e.context)&&null!=(o=a.levelDetails)&&o.live?e.errorAction=this.getPlaylistRetryOrSwitchAction(e,t):(e.levelRetry=!1,e.errorAction=this.getLevelSwitchAction(e,t))}return;case E.LEVEL_LOAD_ERROR:case E.LEVEL_LOAD_TIMEOUT:return void("number"==typeof(null==s?void 0:s.level)&&(e.errorAction=this.getPlaylistRetryOrSwitchAction(e,s.level)));case E.AUDIO_TRACK_LOAD_ERROR:case E.AUDIO_TRACK_LOAD_TIMEOUT:case E.SUBTITLE_LOAD_ERROR:case E.SUBTITLE_TRACK_LOAD_TIMEOUT:if(s){const t=i.levels[i.loadLevel];if(t&&(s.type===be&&t.hasAudioGroup(s.groupId)||s.type===Te&&t.hasSubtitleGroup(s.groupId)))return e.errorAction=this.getPlaylistRetryOrSwitchAction(e,i.loadLevel),e.errorAction.action=2,void(e.errorAction.flags=1)}return;case E.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:{const t=i.levels[i.loadLevel],r=null==t?void 0:t.attrs["HDCP-LEVEL"];r?e.errorAction={action:2,flags:2,hdcpLevel:r}:this.keySystemError(e)}return;case E.BUFFER_ADD_CODEC_ERROR:case E.REMUX_ALLOC_ERROR:case E.BUFFER_APPEND_ERROR:return void(e.errorAction=this.getLevelSwitchAction(e,null!=(n=e.level)?n:i.loadLevel));case E.INTERNAL_EXCEPTION:case E.BUFFER_APPENDING_ERROR:case E.BUFFER_FULL_ERROR:case E.LEVEL_SWITCH_ERROR:case E.BUFFER_STALLED_ERROR:case E.BUFFER_SEEK_OVER_HOLE:case E.BUFFER_NUDGE_ON_STALL:return void(e.errorAction={action:0,flags:0})}e.type===y.KEY_SYSTEM_ERROR&&this.keySystemError(e)}keySystemError(t){const e=this.getVariantLevelIndex(t.frag);t.levelRetry=!1,t.errorAction=this.getLevelSwitchAction(t,e)}getPlaylistRetryOrSwitchAction(t,e){const r=rr(this.hls.config.playlistLoadPolicy,t),n=this.playlistError++;if(sr(r,n,er(t),t.response))return{action:5,flags:0,retryConfig:r,retryCount:n};const i=this.getLevelSwitchAction(t,e);return r&&(i.retryConfig=r,i.retryCount=n),i}getFragRetryOrSwitchAction(t){const e=this.hls,r=this.getVariantLevelIndex(t.frag),n=e.levels[r],{fragLoadPolicy:i,keyLoadPolicy:s}=e.config,a=rr(t.details.startsWith("key")?s:i,t),o=e.levels.reduce(((t,e)=>t+e.fragmentError),0);if(n&&(t.details!==E.FRAG_GAP&&n.fragmentError++,sr(a,o,er(t),t.response)))return{action:5,flags:0,retryConfig:a,retryCount:o};const l=this.getLevelSwitchAction(t,r);return a&&(l.retryConfig=a,l.retryCount=o),l}getLevelSwitchAction(t,e){const r=this.hls;null==e&&(e=r.loadLevel);const n=this.hls.levels[e];if(n){var i,s;const e=t.details;n.loadError++,e===E.BUFFER_APPEND_ERROR&&n.fragmentError++;let l=-1;const{levels:u,loadLevel:c,minAutoLevel:h,maxAutoLevel:d}=r;r.autoLevelEnabled||(r.loadLevel=-1);const f=null==(i=t.frag)?void 0:i.type,p=(f===Ae&&e===E.FRAG_PARSING_ERROR||"audio"===t.sourceBufferName&&(e===E.BUFFER_ADD_CODEC_ERROR||e===E.BUFFER_APPEND_ERROR))&&u.some((({audioCodec:t})=>n.audioCodec!==t)),g="video"===t.sourceBufferName&&(e===E.BUFFER_ADD_CODEC_ERROR||e===E.BUFFER_APPEND_ERROR)&&u.some((({codecSet:t,audioCodec:e})=>n.codecSet!==t&&n.audioCodec===e)),{type:v,groupId:m}=null!=(s=t.context)?s:{};for(let r=u.length;r--;){const i=(r+c)%u.length;if(i!==c&&i>=h&&i<=d&&0===u[i].loadError){var a,o;const r=u[i];if(e===E.FRAG_GAP&&f===_e&&t.frag){const e=u[i].details;if(e){const r=or(t.frag,e.fragments,t.frag.start);if(null!=r&&r.gap)continue}}else{if(v===be&&r.hasAudioGroup(m)||v===Te&&r.hasSubtitleGroup(m))continue;if(f===Ae&&null!=(a=n.audioGroups)&&a.some((t=>r.hasAudioGroup(t)))||f===Le&&null!=(o=n.subtitleGroups)&&o.some((t=>r.hasSubtitleGroup(t)))||p&&n.audioCodec===r.audioCodec||!p&&n.audioCodec!==r.audioCodec||g&&n.codecSet===r.codecSet)continue}l=i;break}}if(l>-1&&r.loadLevel!==l)return t.levelRetry=!0,this.playlistError=0,{action:2,flags:0,nextAutoLevel:l}}return{action:2,flags:1}}onErrorOut(t,e){var r;switch(null==(r=e.errorAction)?void 0:r.action){case 0:break;case 2:this.sendAlternateToPenaltyBox(e),e.errorAction.resolved||e.details===E.FRAG_GAP?/MediaSource readyState: ended/.test(e.error.message)&&(this.warn(`MediaSource ended after "${e.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError()):e.fatal=!0}e.fatal&&this.hls.stopLoad()}sendAlternateToPenaltyBox(t){const e=this.hls,r=t.errorAction;if(!r)return;const{flags:n,hdcpLevel:i,nextAutoLevel:s}=r;switch(n){case 0:this.switchLevel(t,s);break;case 2:i&&(e.maxHdcpLevel=Ge[Ge.indexOf(i)-1],r.resolved=!0),this.warn(`Restricting playback to HDCP-LEVEL of "${e.maxHdcpLevel}" or lower`)}r.resolved||this.switchLevel(t,s)}switchLevel(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)}},fpsController:class{constructor(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()}setStreamController(t){this.streamController=t}registerListeners(){this.hls.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this)}unregisterListeners(){this.hls.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(t,e){const r=this.hls.config;if(r.capLevelOnFPSDrop){const t=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=t,t&&"function"==typeof t.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}checkFPS(t,e,r){const n=performance.now();if(e){if(this.lastTime){const t=n-this.lastTime,i=r-this.lastDroppedFrames,s=e-this.lastDecodedFrames,a=1e3*i/t,o=this.hls;if(o.trigger(m.FPS_DROP,{currentDropped:i,currentDecoded:s,totalDroppedFrames:r}),a>0&&i>o.config.fpsDroppedMonitoringThreshold*s){let t=o.currentLevel;_.warn("drop FPS ratio greater than max allowed value for currentLevel: "+t),t>0&&(-1===o.autoLevelCapping||o.autoLevelCapping>=t)&&(t-=1,o.trigger(m.FPS_DROP_LEVEL_CAPPING,{level:t,droppedLevel:o.currentLevel}),o.autoLevelCapping=t,this.streamController.nextLevelSwitch())}}this.lastTime=n,this.lastDroppedFrames=r,this.lastDecodedFrames=e}}checkFPSInterval(){const t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){const e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)}},stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:X,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableID3MetadataCues:!0,useMediaCapabilities:!0,certLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null}},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},{cueHandler:na,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:class extends sn{constructor(t,e,r){super(t,e,r,"[subtitle-stream-controller]",Le),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}_registerListeners(){const{hls:t}=this;t.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.LEVEL_LOADED,this.onLevelLoaded,this),t.on(m.ERROR,this.onError,this),t.on(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.on(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(m.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.LEVEL_LOADED,this.onLevelLoaded,this),t.off(m.ERROR,this.onError,this),t.off(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(m.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),t.off(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(m.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),t.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(m.FRAG_BUFFERED,this.onFragBuffered,this)}startLoad(t){this.stopLoad(),this.state=qr,this.setInterval(500),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}onManifestLoading(){this.mainDetails=null,this.fragmentTracker.removeAllFragments()}onMediaDetaching(){this.tracksBuffered=[],super.onMediaDetaching()}onLevelLoaded(t,e){this.mainDetails=e.details}onSubtitleFragProcessed(t,e){const{frag:r,success:n}=e;if(this.fragPrevious=r,this.state=qr,!n)return;const i=this.tracksBuffered[this.currentTrackId];if(!i)return;let s;const a=r.start;for(let t=0;t<i.length;t++)if(a>=i[t].start&&a<=i[t].end){s=i[t];break}const o=r.start+r.duration;s?s.end=o:(s={start:a,end:o},i.push(s)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null)}onBufferFlushing(t,e){const{startOffset:r,endOffset:n}=e;if(0===r&&n!==Number.POSITIVE_INFINITY){const t=n-1;if(t<=0)return;e.endOffsetSubtitles=Math.max(0,t),this.tracksBuffered.forEach((e=>{for(let r=0;r<e.length;)if(e[r].end<=t)e.shift();else{if(!(e[r].start<t))break;e[r].start=t,r++}})),this.fragmentTracker.removeFragmentsInRange(r,t,Le)}}onFragBuffered(t,e){var r;this.loadedmetadata||e.frag.type!==_e||null!=(r=this.media)&&r.buffered.length&&(this.loadedmetadata=!0)}onError(t,e){const r=e.frag;(null==r?void 0:r.type)===Le&&(e.details===E.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Wr&&(this.state=qr))}onSubtitleTracksUpdated(t,{subtitleTracks:e}){this.levels&&di(this.levels,e)?this.levels=e.map((t=>new We(t))):(this.tracksBuffered=[],this.levels=e.map((t=>{const e=new We(t);return this.tracksBuffered[e.id]=[],e})),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Le),this.fragPrevious=null,this.mediaBuffer=null)}onSubtitleTrackSwitch(t,e){var r;if(this.currentTrackId=e.id,null==(r=this.levels)||!r.length||-1===this.currentTrackId)return void this.clearInterval();const n=this.levels[this.currentTrackId];null!=n&&n.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,n&&this.setInterval(500)}onSubtitleTrackLoaded(t,e){var r;const{currentTrackId:n,levels:i}=this,{details:s,id:a}=e;if(!i)return void this.warn(`Subtitle tracks were reset while loading level ${a}`);const o=i[a];if(a>=i.length||!o)return;this.log(`Subtitle track ${a} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""},duration:${s.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let l=0;if(s.live||null!=(r=o.details)&&r.live){const t=this.mainDetails;if(s.deltaUpdateFailed||!t)return;const e=t.fragments[0];var u;o.details?(l=this.alignPlaylists(s,o.details,null==(u=this.levelLastLoaded)?void 0:u.details),0===l&&e&&(l=e.start,Je(s,l))):s.hasProgramDateTime&&t.hasProgramDateTime?(Fr(s,t),l=s.fragments[0].start):e&&(l=e.start,Je(s,l))}o.details=s,this.levelLastLoaded=o,a===n&&(this.startFragRequested||!this.mainDetails&&s.live||this.setStartPosition(this.mainDetails||s,l),this.tick(),s.live&&!this.fragCurrent&&this.media&&this.state===qr)&&(or(null,s.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),o.details=void 0))}_handleFragmentLoadComplete(t){const{frag:e,payload:r}=t,n=e.decryptdata,i=this.hls;if(!this.fragContextChanged(e)&&r&&r.byteLength>0&&null!=n&&n.key&&n.iv&&"AES-128"===n.method){const t=performance.now();this.decrypter.decrypt(new Uint8Array(r),n.key.buffer,n.iv.buffer).catch((t=>{throw i.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.FRAG_DECRYPT_ERROR,fatal:!1,error:t,reason:t.message,frag:e}),t})).then((r=>{const n=performance.now();i.trigger(m.FRAG_DECRYPTED,{frag:e,payload:r,stats:{tstart:t,tdecrypt:n}})})).catch((t=>{this.warn(`${t.name}: ${t.message}`),this.state=qr}))}}doTick(){if(this.media){if(this.state===qr){const{currentTrackId:t,levels:e}=this,r=null==e?void 0:e[t];if(!r||!e.length||!r.details)return;const{config:n}=this,i=this.getLoadPosition(),s=Pr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,n.maxBufferHole),{end:a,len:o}=s,l=this.getFwdBufferInfo(this.media,_e),u=r.details;if(o>this.getMaxBufferLength(null==l?void 0:l.len)+u.levelTargetDuration)return;const c=u.fragments,h=c.length,d=u.edge;let f=null;const p=this.fragPrevious;if(a<d){const t=n.maxFragLookUpTolerance,e=a>d-t?0:t;f=or(p,c,Math.max(c[0].start,a),e),!f&&p&&p.start<c[0].start&&(f=c[0])}else f=c[h-1];if(!f)return;if(f=this.mapToInitFragWhenRequired(f),"initSegment"!==f.sn){const t=c[f.sn-u.startSN-1];t&&t.cc===f.cc&&this.fragmentTracker.getState(t)===_r&&(f=t)}this.fragmentTracker.getState(f)===_r&&this.loadFragment(f,r,a)}}else this.state=qr}getMaxBufferLength(t){const e=super.getMaxBufferLength();return t?Math.max(e,t):e}loadFragment(t,e,r){this.fragCurrent=t,"initSegment"===t.sn?this._loadInitSegment(t,e):(this.startFragRequested=!0,super.loadFragment(t,e,r))}get mediaBufferTimeRanges(){return new gi(this.tracksBuffered[this.currentTrackId]||[])}},subtitleTrackController:class extends cr{constructor(t){super(t,"[subtitle-track-controller]"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let t=null;const e=Ce(this.media.textTracks);for(let r=0;r<e.length;r++)if("hidden"===e[r].mode)t=e[r];else if("showing"===e[r].mode){t=e[r];break}const r=this.findTrackForTextTrack(t);this.subtitleTrack!==r&&this.setSubtitleTrack(r)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(t){this._subtitleDisplay=t,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:t}=this;t.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_PARSED,this.onManifestParsed,this),t.on(m.LEVEL_LOADING,this.onLevelLoading,this),t.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_PARSED,this.onManifestParsed,this),t.off(m.LEVEL_LOADING,this.onLevelLoading,this),t.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(m.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),t.off(m.ERROR,this.onError,this)}onMediaAttached(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))}pollTrackChange(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,t)}onMediaDetaching(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),Ce(this.media.textTracks).forEach((t=>{Pe(t)})),this.subtitleTrack=-1,this.media=null)}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.subtitleTracks}onSubtitleTrackLoaded(t,e){const{id:r,groupId:n,details:i}=e,s=this.tracksInGroup[r];if(!s||s.groupId!==n)return void this.warn(`Subtitle track with id:${r} and group:${n} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=e.details,this.log(`Subtitle track ${r} "${s.name}" lang:${s.lang} group:${n} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const r=e.subtitleGroups||null,n=this.groupIds;let i=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&r.some((t=>-1===(null==n?void 0:n.indexOf(t))))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!r||-1!==r.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.subtitlePreference;if(!i&&e){this.selectDefaultTrack=!1;const r=yr(e,t);if(r>-1)i=t[r];else{const t=yr(e,this.tracks);i=this.tracks[t]}}let n=this.findTrackId(i);-1===n&&i&&(n=this.findTrackId(null));const s={subtitleTracks:t};this.log(`Updating subtitle tracks, ${t.length} track(s) found in "${null==r?void 0:r.join(",")}" group-id`),this.hls.trigger(m.SUBTITLE_TRACKS_UPDATED,s),-1!==n&&-1===this.trackId&&this.setSubtitleTrack(n)}else this.shouldReloadPlaylist(i)&&this.setSubtitleTrack(this.trackId)}findTrackId(t){const e=this.tracksInGroup,r=this.selectDefaultTrack;for(let n=0;n<e.length;n++){const i=e[n];if((!r||i.default)&&(r||t)&&(!t||Er(i,t)))return n}if(t){for(let r=0;r<e.length;r++){const n=e[r];if(fi(t.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<e.length;r++){const n=e[r];if(fi(t.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}findTrackForTextTrack(t){if(t){const e=this.tracksInGroup;for(let r=0;r<e.length;r++)if(pi(e[r],t))return r}return-1}onError(t,e){!e.fatal&&e.context&&(e.context.type!==Te||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||this.checkRetry(e))}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(t){this.selectDefaultTrack=!1,this.setSubtitleTrack(t)}setSubtitleOption(t){if(this.hls.config.subtitlePreference=t,t){const e=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,e.length){const r=this.currentTrack;if(r&&Er(t,r))return r;const n=yr(t,this.tracksInGroup);if(n>-1){const t=this.tracksInGroup[n];return this.setSubtitleTrack(n),t}if(r)return null;{const r=yr(t,e);if(r>-1)return e[r]}}}return null}loadPlaylist(t){super.loadPlaylist();const e=this.currentTrack;if(this.shouldLoadPlaylist(e)&&e){const r=e.id,n=e.groupId;let i=e.url;if(t)try{i=t.addDirectives(i)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}this.log(`Loading subtitle playlist for id ${r}`),this.hls.trigger(m.SUBTITLE_TRACK_LOADING,{url:i,id:r,groupId:n,deliveryDirectives:t||null})}}toggleTrackModes(){const{media:t}=this;if(!t)return;const e=Ce(t.textTracks),r=this.currentTrack;let n;if(r&&(n=e.filter((t=>pi(r,t)))[0],n||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(e).forEach((t=>{"disabled"!==t.mode&&t!==n&&(t.mode="disabled")})),n){const t=this.subtitleDisplay?"showing":"hidden";n.mode!==t&&(n.mode=t)}}setSubtitleTrack(t){const e=this.tracksInGroup;if(!this.media)return void(this.queuedDefaultTrack=t);if(t<-1||t>=e.length||!p(t))return void this.warn(`Invalid subtitle track id: ${t}`);this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,n=e[t]||null;if(this.trackId=t,this.currentTrack=n,this.toggleTrackModes(),!n)return void this.hls.trigger(m.SUBTITLE_TRACK_SWITCH,{id:t});const i=!!n.details&&!n.details.live;if(t===this.trackId&&n===r&&i)return;this.log(`Switching to subtitle-track ${t}`+(n?` "${n.name}" lang:${n.lang} group:${n.groupId}`:""));const{id:s,groupId:a="",name:o,type:l,url:u}=n;this.hls.trigger(m.SUBTITLE_TRACK_SWITCH,{id:s,groupId:a,name:o,type:l,url:u});const c=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(c)}},timelineController:class{constructor(t){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this.captionsProperties=void 0,this.hls=t,this.config=t.config,this.Cues=t.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},t.on(m.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.on(m.FRAG_LOADING,this.onFragLoading,this),t.on(m.FRAG_LOADED,this.onFragLoaded,this),t.on(m.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.on(m.FRAG_DECRYPTED,this.onFragDecrypted,this),t.on(m.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(m.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:t}=this;t.off(m.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(m.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),t.off(m.FRAG_LOADING,this.onFragLoading,this),t.off(m.FRAG_LOADED,this.onFragLoaded,this),t.off(m.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),t.off(m.FRAG_DECRYPTED,this.onFragDecrypted,this),t.off(m.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(m.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),t.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){if(this.config.enableCEA708Captions&&(!this.cea608Parser1||!this.cea608Parser2)){const t=new Bi(this,"textTrack1"),e=new Bi(this,"textTrack2"),r=new Bi(this,"textTrack3"),n=new Bi(this,"textTrack4");this.cea608Parser1=new Mi(1,t,e),this.cea608Parser2=new Mi(3,r,n)}}addCues(t,e,r,n,i){let s=!1;for(let t=i.length;t--;){const n=i[t],c=(a=n[0],o=n[1],l=e,u=r,Math.min(o,u)-Math.max(a,l));if(c>=0&&(n[0]=Math.min(n[0],e),n[1]=Math.max(n[1],r),s=!0,c/(r-e)>.5))return}var a,o,l,u;if(s||i.push([e,r]),this.config.renderTextTracksNatively){const i=this.captionsTracks[t];this.Cues.newCue(i,e,r,n)}else{const i=this.Cues.newCue(null,e,r,n);this.hls.trigger(m.CUES_PARSED,{type:"captions",cues:i,track:t})}}onInitPtsFound(t,{frag:e,id:r,initPTS:n,timescale:i}){const{unparsedVttFrags:s}=this;"main"===r&&(this.initPTS[e.cc]={baseTime:n,timescale:i}),s.length&&(this.unparsedVttFrags=[],s.forEach((t=>{this.onFragLoaded(m.FRAG_LOADED,t)})))}getExistingTrack(t,e){const{media:r}=this;if(r)for(let n=0;n<r.textTracks.length;n++){const i=r.textTracks[n];if(hs(i,{name:t,lang:e,attrs:{}}))return i}return null}createCaptionsTrack(t){this.config.renderTextTracksNatively?this.createNativeTrack(t):this.createNonNativeTrack(t)}createNativeTrack(t){if(this.captionsTracks[t])return;const{captionsProperties:e,captionsTracks:r,media:n}=this,{label:i,languageCode:s}=e[t],a=this.getExistingTrack(i,s);if(a)r[t]=a,Pe(r[t]),De(r[t],n);else{const e=this.createTextTrack("captions",i,s);e&&(e[t]=!0,r[t]=e)}}createNonNativeTrack(t){if(this.nonNativeCaptionsTracks[t])return;const e=this.captionsProperties[t];if(!e)return;const r={_id:t,label:e.label,kind:"captions",default:!!e.media&&!!e.media.default,closedCaptions:e.media};this.nonNativeCaptionsTracks[t]=r,this.hls.trigger(m.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[r]})}createTextTrack(t,e,r){const n=this.media;if(n)return n.addTextTrack(t,e,r)}onMediaAttaching(t,e){this.media=e.media,this._cleanTracks()}onMediaDetaching(){const{captionsTracks:t}=this;Object.keys(t).forEach((e=>{Pe(t[e]),delete t[e]})),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs={ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}},this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:t}=this;if(!t)return;const e=t.textTracks;if(e)for(let t=0;t<e.length;t++)Pe(e[t])}onSubtitleTracksUpdated(t,e){const r=e.subtitleTracks||[],n=r.some((t=>t.textCodec===Zi));if(this.config.enableWebVTT||n&&this.config.enableIMSC1){if(di(this.tracks,r))return void(this.tracks=r);if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const t=this.media,e=t?Ce(t.textTracks):null;if(this.tracks.forEach(((t,r)=>{let n;if(e){let r=null;for(let n=0;n<e.length;n++)if(e[n]&&hs(e[n],t)){r=e[n],e[n]=null;break}r&&(n=r)}if(n)Pe(n);else{const e=cs(t);n=this.createTextTrack(e,t.name,t.lang),n&&(n.mode="disabled")}n&&this.textTracks.push(n)})),null!=e&&e.length){const t=e.filter((t=>null!==t)).map((t=>t.label));t.length&&_.warn(`Media element contains unused subtitle tracks: ${t.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const t=this.tracks.map((t=>({label:t.name,kind:t.type.toLowerCase(),default:t.default,subtitleTrack:t})));this.hls.trigger(m.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:t})}}}onManifestLoaded(t,e){this.config.enableCEA708Captions&&e.captions&&e.captions.forEach((t=>{const e=/(?:CC|SERVICE)([1-4])/.exec(t.instreamId);if(!e)return;const r=`textTrack${e[1]}`,n=this.captionsProperties[r];n&&(n.label=t.name,t.lang&&(n.languageCode=t.lang),n.media=t)}))}closedCaptionsForLevel(t){const e=this.hls.levels[t.level];return null==e?void 0:e.attrs["CLOSED-CAPTIONS"]}onFragLoading(t,e){if(this.enabled&&e.frag.type===_e){var r,n;const{cea608Parser1:t,cea608Parser2:i,lastSn:s}=this,{cc:a,sn:o}=e.frag,l=null!=(r=null==(n=e.part)?void 0:n.index)?r:-1;t&&i&&(o!==s+1||o===s&&l!==this.lastPartIndex+1||a!==this.lastCc)&&(t.reset(),i.reset()),this.lastCc=a,this.lastSn=o,this.lastPartIndex=l}}onFragLoaded(t,e){const{frag:r,payload:n}=e;if(r.type===Le)if(n.byteLength){const t=r.decryptdata,i="stats"in e;if(null==t||!t.encrypted||i){const t=this.tracks[r.level],i=this.vttCCs;i[r.cc]||(i[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),t&&t.textCodec===Zi?this._parseIMSC1(r,n):this._parseVTTs(e)}}else this.hls.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(t,e){const r=this.hls;ns(e,this.initPTS[t.cc],(e=>{this._appendCues(e,t.level),r.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:t})}),(e=>{_.log(`Failed to parse IMSC1: ${e}`),r.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:t,error:e})}))}_parseVTTs(t){var e;const{frag:r,payload:n}=t,{initPTS:i,unparsedVttFrags:s}=this,a=i.length-1;if(!i[r.cc]&&-1===a)return void s.push(t);const o=this.hls;!function(t,e,r,n,i,s,a){const o=new Yi,l=ft(new Uint8Array(t)).trim().replace(zi,"\n").split("\n"),u=[],c=e?function(t,e=1){return Wn(t,9e4,1/e)}(e.baseTime,e.timescale):0;let h,d="00:00.000",f=0,g=0,v=!0;o.oncue=function(t){const s=r[n];let a=r.ccOffset;const o=(f-c)/9e4;if(null!=s&&s.new&&(void 0!==g?a=r.ccOffset=s.start:function(t,e,r){let n=t[e],i=t[n.prevCC];if(!i||!i.new&&n.new)return t.ccOffset=t.presentationOffset=n.start,void(n.new=!1);for(;null!=(s=i)&&s.new;){var s;t.ccOffset+=n.start-i.start,n.new=!1,n=i,i=t[n.prevCC]}t.presentationOffset=r}(r,n,o)),o){if(!e)return void(h=new Error("Missing initPTS for VTT MPEGTS"));a=o-r.presentationOffset}const l=t.endTime-t.startTime,d=Qn(9e4*(t.startTime+a-g),9e4*i)/9e4;t.startTime=Math.max(d,0),t.endTime=Math.max(d+l,0);const p=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(p)),t.id||(t.id=Qi(t.startTime,t.endTime,p)),t.endTime>0&&u.push(t)},o.onparsingerror=function(t){h=t},o.onflush=function(){h?a(h):s(u)},l.forEach((t=>{if(v){if(Xi(t,"X-TIMESTAMP-MAP=")){v=!1,t.slice(16).split(",").forEach((t=>{Xi(t,"LOCAL:")?d=t.slice(6):Xi(t,"MPEGTS:")&&(f=parseInt(t.slice(7)))}));try{g=function(t){let e=parseInt(t.slice(-3));const r=parseInt(t.slice(-6,-4)),n=parseInt(t.slice(-9,-7)),i=t.length>9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(p(e)&&p(r)&&p(n)&&p(i)))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${t}`);return e+=1e3*r,e+=6e4*n,e+=36e5*i,e}(d)/1e3}catch(t){h=t}return}""===t&&(v=!1)}o.parse(t+"\n")})),o.flush()}(null!=(e=r.initSegment)&&e.data?Mt(r.initSegment.data,new Uint8Array(n)):n,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,(t=>{this._appendCues(t,r.level),o.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})}),(e=>{const i="Missing initPTS for VTT MPEGTS"===e.message;i?s.push(t):this._fallbackToIMSC1(r,n),_.log(`Failed to parse VTT cue: ${e}`),i&&a>r.cc||o.trigger(m.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:e})}))}_fallbackToIMSC1(t,e){const r=this.tracks[t.level];r.textCodec||ns(e,this.initPTS[t.cc],(()=>{r.textCodec=Zi,this._parseIMSC1(t,e)}),(()=>{r.textCodec="wvtt"}))}_appendCues(t,e){const r=this.hls;if(this.config.renderTextTracksNatively){const r=this.textTracks[e];if(!r||"disabled"===r.mode)return;t.forEach((t=>Ie(r,t)))}else{const n=this.tracks[e];if(!n)return;const i=n.default?"default":"subtitles"+e;r.trigger(m.CUES_PARSED,{type:"subtitles",cues:t,track:i})}}onFragDecrypted(t,e){const{frag:r}=e;r.type===Le&&this.onFragLoaded(m.FRAG_LOADED,e)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(t,e){this.initCea608Parsers();const{cea608Parser1:r,cea608Parser2:n}=this;if(!this.enabled||!r||!n)return;const{frag:i,samples:s}=e;if(i.type!==_e||"NONE"!==this.closedCaptionsForLevel(i))for(let t=0;t<s.length;t++){const e=s[t].bytes;if(e){const i=this.extractCea608Data(e);r.addData(s[t].pts,i[0]),n.addData(s[t].pts,i[1])}}}onBufferFlushing(t,{startOffset:e,endOffset:r,endOffsetSubtitles:n,type:i}){const{media:s}=this;if(s&&!(s.currentTime<r)){if(!i||"video"===i){const{captionsTracks:t}=this;Object.keys(t).forEach((n=>Oe(t[n],e,r)))}if(this.config.renderTextTracksNatively&&0===e&&void 0!==n){const{textTracks:t}=this;Object.keys(t).forEach((r=>Oe(t[r],e,n)))}}}extractCea608Data(t){const e=[[],[]],r=31&t[0];let n=2;for(let i=0;i<r;i++){const r=t[n++],i=127&t[n++],s=127&t[n++];if((0!==i||0!==s)&&0!=(4&r)){const t=3&r;0!==t&&1!==t||(e[t].push(i),e[t].push(s))}}return e}},audioStreamController:class extends sn{constructor(t,e,r){super(t,e,r,"[audio-stream-controller]",Ae),this.videoBuffer=null,this.videoTrackCC=-1,this.waitingVideoCC=-1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this._registerListeners()}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null,this.bufferedTrack=null,this.switchingTrack=null}_registerListeners(){const{hls:t}=this;t.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.LEVEL_LOADED,this.onLevelLoaded,this),t.on(m.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(m.ERROR,this.onError,this),t.on(m.BUFFER_RESET,this.onBufferReset,this),t.on(m.BUFFER_CREATED,this.onBufferCreated,this),t.on(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(m.INIT_PTS_FOUND,this.onInitPtsFound,this),t.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.LEVEL_LOADED,this.onLevelLoaded,this),t.off(m.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),t.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(m.ERROR,this.onError,this),t.off(m.BUFFER_RESET,this.onBufferReset,this),t.off(m.BUFFER_CREATED,this.onBufferCreated,this),t.off(m.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(m.INIT_PTS_FOUND,this.onInitPtsFound,this),t.off(m.FRAG_BUFFERED,this.onFragBuffered,this)}onInitPtsFound(t,{frag:e,id:r,initPTS:n,timescale:i}){if("main"===r){const t=e.cc;this.initPTS[e.cc]={baseTime:n,timescale:i},this.log(`InitPTS for cc: ${t} found from main: ${n}`),this.videoTrackCC=t,this.state===rn&&this.tick()}}startLoad(t){if(!this.levels)return this.startPosition=t,void(this.state=Wr);const 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=qr):(this.loadedmetadata=!1,this.state=Jr),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}doTick(){switch(this.state){case qr:this.doTickIdle();break;case Jr:{var t;const{levels:e,trackId:r}=this,n=null==e||null==(t=e[r])?void 0:t.details;if(n){if(this.waitForCdnTuneIn(n))break;this.state=rn}break}case Xr:{var e;const t=performance.now(),r=this.retryDate;if(!r||t>=r||null!=(e=this.media)&&e.seeking){const{levels:t,trackId:e}=this;this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded((null==t?void 0:t[e])||null),this.state=qr}break}case rn:{const t=this.waitingData;if(t){const{frag:e,part:r,cache:n,complete:i}=t;if(void 0!==this.initPTS[e.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=zr;const t={frag:e,part:r,payload:n.flush(),networkDetails:null};this._handleFragmentLoadProgress(t),i&&super._handleFragmentLoadComplete(t)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log(`Waiting fragment cc (${e.cc}) cancelled because video is at cc ${this.videoTrackCC}`),this.clearWaitingFragment();else{const t=this.getLoadPosition(),r=Pr.bufferInfo(this.mediaBuffer,t,this.config.maxBufferHole);lr(r.end,this.config.maxFragLookUpTolerance,e)<0&&(this.log(`Waiting fragment cc (${e.cc}) @ ${e.start} cancelled because another fragment at ${r.end} is needed`),this.clearWaitingFragment())}}else this.state=qr}}this.onTickEnd()}clearWaitingFragment(){const t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=qr)}resetLoadingState(){this.clearWaitingFragment(),super.resetLoadingState()}onTickEnd(){const{media:t}=this;null!=t&&t.readyState&&(this.lastCurrentTime=t.currentTime)}doTickIdle(){const{hls:t,levels:e,media:r,trackId:n}=this,i=t.config;if(!r&&(this.startFragRequested||!i.startFragPrefetch)||null==e||!e[n])return;const s=e[n],a=s.details;if(!a||a.live&&this.levelLastLoaded!==s||this.waitForCdnTuneIn(a))return void(this.state=Jr);const o=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&o&&(this.bufferFlushed=!1,this.afterBufferFlushed(o,I,Ae));const l=this.getFwdBufferInfo(o,Ae);if(null===l)return;const{bufferedTrack:u,switchingTrack:c}=this;if(!c&&this._streamEnded(l,a))return t.trigger(m.BUFFER_EOS,{type:"audio"}),void(this.state=tn);const h=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,_e),d=l.len,f=this.getMaxBufferLength(null==h?void 0:h.len),p=a.fragments,g=p[0].start;let v=this.flushing?this.getLoadPosition():l.end;if(c&&r){const t=this.getLoadPosition();u&&!fi(c.attrs,u.attrs)&&(v=t),a.PTSKnown&&t<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)}if(d>=f&&!c&&v<p[p.length-1].start)return;let y=this.getNextFragment(v,a),E=!1;if(y&&this.isLoopLoading(y,v)&&(E=!!y.gap,y=this.getNextFragmentLoopLoading(y,a,l,_e,f)),!y)return void(this.bufferFlushed=!0);const S=h&&y.start>h.end+a.targetduration;if(S||(null==h||!h.len)&&l.len){const t=this.getAppendedFrag(y.start,_e);if(null===t)return;if(E||(E=!!t.gap||!!S&&0===h.len),S&&!E||E&&l.nextStart&&l.nextStart<t.end)return}this.loadFragment(y,s,v)}getMaxBufferLength(t){const e=super.getMaxBufferLength();return t?Math.min(Math.max(e,t),this.config.maxMaxBufferLength):e}onMediaDetaching(){this.videoBuffer=null,this.bufferFlushed=this.flushing=!1,super.onMediaDetaching()}onAudioTracksUpdated(t,{audioTracks:e}){this.resetTransmuxer(),this.levels=e.map((t=>new We(t)))}onAudioTrackSwitching(t,e){const r=!!e.url;this.trackId=e.id;const{fragCurrent:n}=this;n&&(n.abortRequests(),this.removeUnbufferedFrags(n.start)),this.resetLoadingState(),r?this.setInterval(100):this.resetTransmuxer(),r?(this.switchingTrack=e,this.state=qr,this.flushAudioIfNeeded(e)):(this.switchingTrack=null,this.bufferedTrack=e,this.state=Wr),this.tick()}onManifestLoading(){this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=this.flushing=!1,this.levels=this.mainDetails=this.waitingData=this.bufferedTrack=this.cachedTrackLoadedData=this.switchingTrack=null,this.startFragRequested=!1,this.trackId=this.videoTrackCC=this.waitingVideoCC=-1}onLevelLoaded(t,e){this.mainDetails=e.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(m.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)}onAudioTrackLoaded(t,e){var r;if(null==this.mainDetails)return void(this.cachedTrackLoadedData=e);const{levels:n}=this,{details:i,id:s}=e;if(!n)return void this.warn(`Audio tracks were reset while loading level ${s}`);this.log(`Audio track ${s} loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const a=n[s];let o=0;if(i.live||null!=(r=a.details)&&r.live){this.checkLiveUpdate(i);const t=this.mainDetails;if(i.deltaUpdateFailed||!t)return;var l;!a.details&&i.hasProgramDateTime&&t.hasProgramDateTime?(Fr(i,t),o=i.fragments[0].start):o=this.alignPlaylists(i,a.details,null==(l=this.levelLastLoaded)?void 0:l.details)}a.details=i,this.levelLastLoaded=a,this.startFragRequested||!this.mainDetails&&i.live||this.setStartPosition(this.mainDetails||i,o),this.state!==Jr||this.waitForCdnTuneIn(i)||(this.state=qr),this.tick()}_handleFragmentLoadProgress(t){var e;const{frag:r,part:n,payload:i}=t,{config:s,trackId:a,levels:o}=this;if(!o)return void this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const l=o[a];if(!l)return void this.warn("Audio track is undefined on fragment load progress");const u=l.details;if(!u)return this.warn("Audio track details undefined on fragment load progress"),void this.removeUnbufferedFrags(r.start);const c=s.defaultAudioCodec||l.audioCodec||"mp4a.40.2";let h=this.transmuxer;h||(h=this.transmuxer=new hi(this.hls,Ae,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const d=this.initPTS[r.cc],f=null==(e=r.initSegment)?void 0:e.data;if(void 0!==d){const t=!1,e=n?n.index:-1,s=-1!==e,a=new Or(r.level,r.sn,r.stats.chunkCount,i.byteLength,e,s);h.push(i,f,c,"",r,n,u.totalduration,t,a,d)}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 ${a}`);const{cache:t}=this.waitingData=this.waitingData||{frag:r,part:n,cache:new an,complete:!1};t.push(new Uint8Array(i)),this.waitingVideoCC=this.videoTrackCC,this.state=rn}}_handleFragmentLoadComplete(t){this.waitingData?this.waitingData.complete=!0:super._handleFragmentLoadComplete(t)}onBufferReset(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1}onBufferCreated(t,e){const r=e.tracks.audio;r&&(this.mediaBuffer=r.buffer||null),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer||null)}onFragBuffered(t,e){const{frag:r,part:n}=e;if(r.type===Ae)if(this.fragContextChanged(r))this.warn(`Fragment ${r.sn}${n?" p: "+n.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);else{if("initSegment"!==r.sn){this.fragPrevious=r;const t=this.switchingTrack;t&&(this.bufferedTrack=t,this.switchingTrack=null,this.hls.trigger(m.AUDIO_TRACK_SWITCHED,d({},t)))}this.fragBufferedComplete(r,n)}else if(!this.loadedmetadata&&r.type===_e){const t=this.videoBuffer||this.media;t&&Pr.getBuffered(t).length&&(this.loadedmetadata=!0)}}onError(t,e){var r;if(e.fatal)this.state=en;else switch(e.details){case E.FRAG_GAP:case E.FRAG_PARSING_ERROR:case E.FRAG_DECRYPT_ERROR:case E.FRAG_LOAD_ERROR:case E.FRAG_LOAD_TIMEOUT:case E.KEY_LOAD_ERROR:case E.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Ae,e);break;case E.AUDIO_TRACK_LOAD_ERROR:case E.AUDIO_TRACK_LOAD_TIMEOUT:case E.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==Jr||(null==(r=e.context)?void 0:r.type)!==be||(this.state=qr);break;case E.BUFFER_APPEND_ERROR:case E.BUFFER_FULL_ERROR:if(!e.parent||"audio"!==e.parent)return;if(e.details===E.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case E.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}onBufferFlushing(t,{type:e}){e!==P&&(this.flushing=!0)}onBufferFlushed(t,{type:e}){if(e!==P){this.flushing=!1,this.bufferFlushed=!0,this.state===tn&&(this.state=qr);const t=this.mediaBuffer||this.media;t&&(this.afterBufferFlushed(t,e,Ae),this.tick())}}_handleTransmuxComplete(t){var e;const r="audio",{hls:n}=this,{remuxResult:i,chunkMeta:s}=t,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:l,level:u}=a,{details:c}=u,{audio:h,text:d,id3:p,initSegment:g}=i;if(!this.fragContextChanged(o)&&c){if(this.state=Qr,this.switchingTrack&&h&&this.completeAudioSwitch(this.switchingTrack),null!=g&&g.tracks){const t=o.initSegment||o;this._bufferInitSegment(u,g.tracks,t,s),n.trigger(m.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:r,tracks:g.tracks})}if(h){const{startPTS:t,endPTS:e,startDTS:r,endDTS:n}=h;l&&(l.elementaryStreams[I]={startPTS:t,endPTS:e,startDTS:r,endDTS:n}),o.setElementaryStreamInfo(I,t,e,r,n),this.bufferFragmentData(h,o,l,s)}if(null!=p&&null!=(e=p.samples)&&e.length){const t=f({id:r,frag:o,details:c},p);n.trigger(m.FRAG_PARSING_METADATA,t)}if(d){const t=f({id:r,frag:o,details:c},d);n.trigger(m.FRAG_PARSING_USERDATA,t)}}else this.fragmentTracker.removeFragment(o)}_bufferInitSegment(t,e,r,n){if(this.state!==Qr)return;e.video&&delete e.video;const i=e.audio;if(!i)return;i.id="audio";const s=t.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${s}/${i.codec}]`),s&&1===s.split(",").length&&(i.levelCodec=s),this.hls.trigger(m.BUFFER_CODECS,e);const a=i.initSegment;if(null!=a&&a.byteLength){const t={type:"audio",frag:r,part:null,chunkMeta:n,parent:r.type,data:a};this.hls.trigger(m.BUFFER_APPENDING,t)}this.tickImmediate()}loadFragment(t,e,r){const n=this.fragmentTracker.getState(t);var i;if(this.fragCurrent=t,this.switchingTrack||n===_r||n===Lr)if("initSegment"===t.sn)this._loadInitSegment(t,e);else if(null!=(i=e.details)&&i.live&&!this.initPTS[t.cc]){this.log(`Waiting for video PTS in continuity counter ${t.cc} of live stream before loading audio fragment ${t.sn} of level ${this.trackId}`),this.state=rn;const r=this.mainDetails;r&&r.fragments[0].start!==e.details.fragments[0].start&&Fr(e.details,r)}else this.startFragRequested=!0,super.loadFragment(t,e,r);else this.clearTrackerIfNeeded(t)}flushAudioIfNeeded(t){const{media:e,bufferedTrack:r}=this,n=null==r?void 0:r.attrs,i=t.attrs;e&&n&&(n.CHANNELS!==i.CHANNELS||r.name!==t.name||r.lang!==t.lang)&&(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null)}completeAudioSwitch(t){const{hls:e}=this;this.flushAudioIfNeeded(t),this.bufferedTrack=t,this.switchingTrack=null,e.trigger(m.AUDIO_TRACK_SWITCHED,d({},t))}},audioTrackController:class extends cr{constructor(t){super(t,"[audio-track-controller]"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:t}=this;t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_PARSED,this.onManifestParsed,this),t.on(m.LEVEL_LOADING,this.onLevelLoading,this),t.on(m.LEVEL_SWITCHING,this.onLevelSwitching,this),t.on(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.on(m.ERROR,this.onError,this)}unregisterListeners(){const{hls:t}=this;t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_PARSED,this.onManifestParsed,this),t.off(m.LEVEL_LOADING,this.onLevelLoading,this),t.off(m.LEVEL_SWITCHING,this.onLevelSwitching,this),t.off(m.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),t.off(m.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(t,e){this.tracks=e.audioTracks||[]}onAudioTrackLoaded(t,e){const{id:r,groupId:n,details:i}=e,s=this.tracksInGroup[r];if(!s||s.groupId!==n)return void this.warn(`Audio track with id:${r} and group:${n} not found in active group ${null==s?void 0:s.groupId}`);const a=s.details;s.details=e.details,this.log(`Audio track ${r} "${s.name}" lang:${s.lang} group:${n} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,e,a)}onLevelLoading(t,e){this.switchLevel(e.level)}onLevelSwitching(t,e){this.switchLevel(e.level)}switchLevel(t){const e=this.hls.levels[t];if(!e)return;const r=e.audioGroups||null,n=this.groupIds;let i=this.currentTrack;if(!r||(null==n?void 0:n.length)!==(null==r?void 0:r.length)||null!=r&&r.some((t=>-1===(null==n?void 0:n.indexOf(t))))){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const t=this.tracks.filter((t=>!r||-1!==r.indexOf(t.groupId)));if(t.length)this.selectDefaultTrack&&!t.some((t=>t.default))&&(this.selectDefaultTrack=!1),t.forEach(((t,e)=>{t.id=e}));else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=t;const e=this.hls.config.audioPreference;if(!i&&e){const r=yr(e,t,Sr);if(r>-1)i=t[r];else{const t=yr(e,this.tracks);i=this.tracks[t]}}let n=this.findTrackId(i);-1===n&&i&&(n=this.findTrackId(null));const a={audioTracks:t};this.log(`Updating audio tracks, ${t.length} track(s) found in group(s): ${null==r?void 0:r.join(",")}`),this.hls.trigger(m.AUDIO_TRACKS_UPDATED,a);const o=this.trackId;if(-1!==n&&-1===o)this.setAudioTrack(n);else if(t.length&&-1===o){var s;const e=new Error(`No audio track selected for current audio group-ID(s): ${null==(s=this.groupIds)?void 0:s.join(",")} track count: ${t.length}`);this.warn(e.message),this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:e})}}else this.shouldReloadPlaylist(i)&&this.setAudioTrack(this.trackId)}onError(t,e){!e.fatal&&e.context&&(e.context.type!==be||e.context.id!==this.trackId||this.groupIds&&-1===this.groupIds.indexOf(e.context.groupId)||(this.requestScheduled=-1,this.checkRetry(e)))}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(t){this.selectDefaultTrack=!1,this.setAudioTrack(t)}setAudioOption(t){const e=this.hls;if(e.config.audioPreference=t,t){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const n=this.currentTrack;if(n&&Er(t,n,Sr))return n;const i=yr(t,this.tracksInGroup,Sr);if(i>-1){const t=this.tracksInGroup[i];return this.setAudioTrack(i),t}if(n){let n=e.loadLevel;-1===n&&(n=e.firstAutoLevel);const i=function(t,e,r,n,i){const s=e[n],a=e.reduce(((t,e,r)=>{const n=e.uri;return(t[n]||(t[n]=[])).push(r),t}),{})[s.uri];a.length>1&&(n=Math.max.apply(Math,a));const o=s.videoRange,l=s.frameRate,u=s.codecSet.substring(0,4),c=br(e,n,(e=>{if(e.videoRange!==o||e.frameRate!==l||e.codecSet.substring(0,4)!==u)return!1;const n=e.audioGroups,s=r.filter((t=>!n||-1!==n.indexOf(t.groupId)));return yr(t,s,i)>-1}));return c>-1?c:br(e,n,(e=>{const n=e.audioGroups,s=r.filter((t=>!n||-1!==n.indexOf(t.groupId)));return yr(t,s,i)>-1}))}(t,e.levels,r,n,Sr);if(-1===i)return null;e.nextLoadLevel=i}if(t.channels||t.audioCodec){const e=yr(t,r);if(e>-1)return r[e]}}}return null}setAudioTrack(t){const e=this.tracksInGroup;if(t<0||t>=e.length)return void this.warn(`Invalid audio track id: ${t}`);this.clearTimer(),this.selectDefaultTrack=!1;const r=this.currentTrack,n=e[t],i=n.details&&!n.details.live;if(t===this.trackId&&n===r&&i)return;if(this.log(`Switching to audio-track ${t} "${n.name}" lang:${n.lang} group:${n.groupId} channels:${n.channels}`),this.trackId=t,this.currentTrack=n,this.hls.trigger(m.AUDIO_TRACK_SWITCHING,d({},n)),i)return;const s=this.switchParams(n.url,null==r?void 0:r.details,n.details);this.loadPlaylist(s)}findTrackId(t){const e=this.tracksInGroup;for(let r=0;r<e.length;r++){const n=e[r];if((!this.selectDefaultTrack||n.default)&&(!t||Er(t,n,Sr)))return r}if(t){const{name:r,lang:n,assocLang:i,characteristics:s,audioCodec:a,channels:o}=t;for(let t=0;t<e.length;t++)if(Er({name:r,lang:n,assocLang:i,characteristics:s,audioCodec:a,channels:o},e[t],Sr))return t;for(let r=0;r<e.length;r++){const n=e[r];if(fi(t.attrs,n.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return r}for(let r=0;r<e.length;r++){const n=e[r];if(fi(t.attrs,n.attrs,["LANGUAGE"]))return r}}return-1}loadPlaylist(t){const e=this.currentTrack;if(this.shouldLoadPlaylist(e)&&e){super.loadPlaylist();const r=e.id,n=e.groupId;let i=e.url;if(t)try{i=t.addDirectives(i)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}this.log(`loading audio-track playlist ${r} "${e.name}" lang:${e.lang} group:${n}`),this.clearTimer(),this.hls.trigger(m.AUDIO_TRACK_LOADING,{url:i,id:r,groupId:n,deliveryDirectives:t||null})}}},emeController:ps,cmcdController:class{constructor(t){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=t=>{try{this.apply(t,{ot:vs.MANIFEST,su:!this.initialized})}catch(t){_.warn("Could not generate manifest CMCD data.",t)}},this.applyFragmentData=t=>{try{const e=t.frag,r=this.hls.levels[e.level],n=this.getObjectType(e),i={d:1e3*e.duration,ot:n};n!==vs.VIDEO&&n!==vs.AUDIO&&n!=vs.MUXED||(i.br=r.bitrate/1e3,i.tb=this.getTopBandwidth(n)/1e3,i.bl=this.getBufferLength(n)),this.apply(t,i)}catch(t){_.warn("Could not generate segment CMCD data.",t)}},this.hls=t;const e=this.config=t.config,{cmcd:r}=e;null!=r&&(e.pLoader=this.createPlaylistLoader(),e.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||function(){try{return crypto.randomUUID()}catch(t){try{const t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)}catch(t){let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const r=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"==t?r:3&r|8).toString(16)}))}}}(),this.cid=r.contentId,this.useHeaders=!0===r.useHeaders,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const t=this.hls;t.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(m.MEDIA_DETACHED,this.onMediaDetached,this),t.on(m.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const t=this.hls;t.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(m.MEDIA_DETACHED,this.onMediaDetached,this),t.off(m.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=null}onMediaAttached(t,e){this.media=e.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(t,e){var r,n;this.audioBuffer=null==(r=e.tracks.audio)?void 0:r.buffer,this.videoBuffer=null==(n=e.tracks.video)?void 0:n.buffer}createData(){var t;return{v:1,sf:ms.HLS,sid:this.sid,cid:this.cid,pr:null==(t=this.media)?void 0:t.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(t,e={}){f(e,this.createData());const r=e.ot===vs.INIT||e.ot===vs.VIDEO||e.ot===vs.MUXED;this.starved&&r&&(e.bs=!0,e.su=!0,this.starved=!1),null==e.su&&(e.su=this.buffering);const{includeKeys:n}=this;var i;n&&(e=Object.keys(e).reduce(((t,r)=>(n.includes(r)&&(t[r]=e[r]),t)),{})),this.useHeaders?(t.headers||(t.headers={}),f(t.headers,function(t,e={}){if(!t)return{};const r=Object.entries(t),n=Object.entries(Es).concat(Object.entries((null==e?void 0:e.customHeaderMap)||{})),i=r.reduce(((t,e)=>{var r;const[i,s]=e,a=(null==(r=n.find((t=>t[1].includes(i))))?void 0:r[0])||ys.REQUEST;return null!=t[a]||(t[a]={}),t[a][i]=s,t}),{});return Object.entries(i).reduce(((t,[r,n])=>(t[r]=Ws(n,e),t)),{})}(e,i))):t.url=function(t,e,r){const n=function(t,e={}){if(!t)return"";const r=Ws(t,e);return`CMCD=${encodeURIComponent(r)}`}(e,r);if(!n)return t;if(qs.test(t))return t.replace(qs,n);const i=t.includes("?")?"&":"?";return`${t}${i}${n}`}(t.url,e)}getObjectType(t){const{type:e}=t;return"subtitle"===e?vs.TIMED_TEXT:"initSegment"===t.sn?vs.INIT:"audio"===e?vs.AUDIO:"main"===e?this.hls.audioTracks.length?vs.VIDEO:vs.MUXED:void 0}getTopBandwidth(t){let e,r=0;const n=this.hls;if(t===vs.AUDIO)e=n.audioTracks;else{const t=n.maxAutoLevel,r=t>-1?t+1:n.levels.length;e=n.levels.slice(0,r)}for(const t of e)t.bitrate>r&&(r=t.bitrate);return r>0?r:NaN}getBufferLength(t){const e=this.hls.media,r=t===vs.AUDIO?this.audioBuffer:this.videoBuffer;return r&&e?1e3*Pr.bufferInfo(r,e.currentTime,this.config.maxBufferHole).len:NaN}createPlaylistLoader(){const{pLoader:t}=this.config,e=this.applyPlaylistData,r=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new r(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,r,n){e(t),this.loader.load(t,r,n)}}}createFragmentLoader(){const{fLoader:t}=this.config,e=this.applyFragmentData,r=t||this.config.loader;return class{constructor(t){this.loader=void 0,this.loader=new r(t)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(t,r,n){e(t),this.loader.load(t,r,n)}}}},contentSteeringController:class{constructor(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=_.log.bind(_,"[content-steering]:"),this.registerListeners()}registerListeners(){const t=this.hls;t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(m.MANIFEST_PARSED,this.onManifestParsed,this),t.on(m.ERROR,this.onError,this)}unregisterListeners(){const t=this.hls;t&&(t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(m.MANIFEST_PARSED,this.onManifestParsed,this),t.off(m.ERROR,this.onError,this))}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const t=1e3*this.timeToLoad-(performance.now()-this.updated);if(t>0)return void this.scheduleRefresh(this.uri,t)}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){-1!==this.reloadTimer&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(t){const e=this.levels;e&&(this.levels=e.filter((e=>e!==t)))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(t,e){const{contentSteering:r}=e;null!==r&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(t,e){this.audioTracks=e.audioTracks,this.subtitleTracks=e.subtitleTracks}onError(t,e){const{errorAction:r}=e;if(2===(null==r?void 0:r.action)&&1===r.flags){const t=this.levels;let n=this.pathwayPriority,i=this.pathwayId;if(e.context){const{groupId:r,pathwayId:n,type:s}=e.context;r&&t?i=this.getPathwayForGroupId(r,s,i):n&&(i=n)}i in this.penalizedPathways||(this.penalizedPathways[i]=performance.now()),!n&&t&&(n=t.reduce(((t,e)=>(-1===t.indexOf(e.pathwayId)&&t.push(e.pathwayId),t)),[])),n&&n.length>1&&(this.updatePathwayPriority(n),r.resolved=this.pathwayId!==i),r.resolved||_.warn(`Could not resolve ${e.details} ("${e.error.message}") with content-steering for Pathway: ${i} levels: ${t?t.length:t} priorities: ${JSON.stringify(n)} penalized: ${JSON.stringify(this.penalizedPathways)}`)}}filterParsedLevels(t){this.levels=t;let e=this.getLevelsForPathway(this.pathwayId);if(0===e.length){const 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}getLevelsForPathway(t){return null===this.levels?[]:this.levels.filter((e=>t===e.pathwayId))}updatePathwayPriority(t){let e;this.pathwayPriority=t;const r=this.penalizedPathways,n=performance.now();Object.keys(r).forEach((t=>{n-r[t]>3e5&&delete r[t]}));for(let n=0;n<t.length;n++){const i=t[n];if(i in r)continue;if(i===this.pathwayId)return;const s=this.hls.nextLoadLevel,a=this.hls.levels[s];if(e=this.getLevelsForPathway(i),e.length>0){this.log(`Setting Pathway to "${i}"`),this.pathwayId=i,tr(e),this.hls.trigger(m.LEVELS_UPDATED,{levels:e});const t=this.hls.levels[s];a&&t&&this.levels&&(t.attrs["STABLE-VARIANT-ID"]!==a.attrs["STABLE-VARIANT-ID"]&&t.bitrate!==a.bitrate&&this.log(`Unstable Pathways change from bitrate ${a.bitrate} to ${t.bitrate}`),this.hls.nextLoadLevel=s);break}}}getPathwayForGroupId(t,e,r){const n=this.getLevelsForPathway(r).concat(this.levels||[]);for(let r=0;r<n.length;r++)if(e===be&&n[r].hasAudioGroup(t)||e===Te&&n[r].hasSubtitleGroup(t))return n[r].pathwayId;return r}clonePathways(t){const e=this.levels;if(!e)return;const r={},n={};t.forEach((t=>{const{ID:i,"BASE-ID":s,"URI-REPLACEMENT":a}=t;if(e.some((t=>t.pathwayId===i)))return;const o=this.getLevelsForPathway(s).map((t=>{const e=new w(t.attrs);e["PATHWAY-ID"]=i;const s=e.AUDIO&&`${e.AUDIO}_clone_${i}`,o=e.SUBTITLES&&`${e.SUBTITLES}_clone_${i}`;s&&(r[e.AUDIO]=s,e.AUDIO=s),o&&(n[e.SUBTITLES]=o,e.SUBTITLES=o);const l=zs(t.uri,e["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",a),u=new We({attrs:e,audioCodec:t.audioCodec,bitrate:t.bitrate,height:t.height,name:t.name,url:l,videoCodec:t.videoCodec,width:t.width});if(t.audioGroups)for(let e=1;e<t.audioGroups.length;e++)u.addGroupId("audio",`${t.audioGroups[e]}_clone_${i}`);if(t.subtitleGroups)for(let e=1;e<t.subtitleGroups.length;e++)u.addGroupId("text",`${t.subtitleGroups[e]}_clone_${i}`);return u}));e.push(...o),Ys(this.audioTracks,r,a,i),Ys(this.subtitleTracks,n,a,i)}))}loadSteeringManifest(t){const e=this.hls.config,r=e.loader;let n;this.loader&&this.loader.destroy(),this.loader=new r(e);try{n=new self.URL(t)}catch(e){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest URI: ${t}`)}if("data:"!==n.protocol){const t=0|(this.hls.bandwidthEstimate||e.abrEwmaDefaultEstimate);n.searchParams.set("_HLS_pathway",this.pathwayId),n.searchParams.set("_HLS_throughput",""+t)}const i={responseType:"json",url:n.href},s=e.steeringManifestLoadPolicy.default,a=s.errorRetry||s.timeoutRetry||{},o={loadPolicy:s,timeout:s.maxLoadTimeMs,maxRetry:a.maxNumRetry||0,retryDelay:a.retryDelayMs||0,maxRetryDelay:a.maxRetryDelayMs||0},l={onSuccess:(t,e,r,i)=>{this.log(`Loaded steering manifest: "${n}"`);const s=t.data;if(1!==s.VERSION)return void this.log(`Steering VERSION ${s.VERSION} not supported!`);this.updated=performance.now(),this.timeToLoad=s.TTL;const{"RELOAD-URI":a,"PATHWAY-CLONES":o,"PATHWAY-PRIORITY":l}=s;if(a)try{this.uri=new self.URL(a,n).href}catch(t){return this.enabled=!1,void this.log(`Failed to parse Steering Manifest RELOAD-URI: ${a}`)}this.scheduleRefresh(this.uri||r.url),o&&this.clonePathways(o);const u={steeringManifest:s,url:n.toString()};this.hls.trigger(m.STEERING_MANIFEST_LOADED,u),l&&this.updatePathwayPriority(l)},onError:(t,e,r,n)=>{if(this.log(`Error loading steering manifest: ${t.code} ${t.text} (${e.url})`),this.stopLoad(),410===t.code)return this.enabled=!1,void this.log(`Steering manifest ${e.url} no longer available`);let i=1e3*this.timeToLoad;if(429!==t.code)this.scheduleRefresh(this.uri||e.url,i);else{const t=this.loader;if("function"==typeof(null==t?void 0:t.getResponseHeader)){const e=t.getResponseHeader("Retry-After");e&&(i=1e3*parseFloat(e))}this.log(`Steering manifest ${e.url} rate limited`)}},onTimeout:(t,e,r)=>{this.log(`Timeout loading steering manifest (${e.url})`),this.scheduleRefresh(this.uri||e.url)}};this.log(`Requesting steering manifest: ${n}`),this.loader.load(i,o,l)}scheduleRefresh(t,e=1e3*this.timeToLoad){this.clearTimeout(),this.reloadTimer=self.setTimeout((()=>{var e;const r=null==(e=this.hls)?void 0:e.media;!r||r.ended?this.scheduleRefresh(t,1e3*this.timeToLoad):this.loadSteeringManifest(t)}),e)}}});function sa(t){return t&&"object"==typeof t?Array.isArray(t)?t.map(sa):Object.keys(t).reduce(((e,r)=>(e[r]=sa(t[r]),e)),{}):t}let aa;class oa extends cr{constructor(t,e){super(t,"[level-controller]"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=e,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_LOADED,this.onManifestLoaded,this),t.on(m.LEVEL_LOADED,this.onLevelLoaded,this),t.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(m.FRAG_BUFFERED,this.onFragBuffered,this),t.on(m.ERROR,this.onError,this)}_unregisterListeners(){const{hls:t}=this;t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_LOADED,this.onManifestLoaded,this),t.off(m.LEVEL_LOADED,this.onLevelLoaded,this),t.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(m.FRAG_BUFFERED,this.onFragBuffered,this),t.off(m.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach((t=>{t.loadError=0,t.fragmentError=0})),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(t,e){this.resetLevels()}onManifestLoaded(t,e){const r=this.hls.config.preferManagedMediaSource,n=[],i={},s={};let a=!1,o=!1,l=!1;e.levels.forEach((t=>{var e,u;const c=t.attrs;let{audioCodec:h,videoCodec:d}=t;-1!==(null==(e=h)?void 0:e.indexOf("mp4a.40.34"))&&(aa||(aa=/chrome|firefox/i.test(navigator.userAgent)),aa&&(t.audioCodec=h=void 0)),h&&(t.audioCodec=h=ie(h,r)),0===(null==(u=d)?void 0:u.indexOf("avc1"))&&(d=t.videoCodec=function(t){const e=t.split(",");for(let t=0;t<e.length;t++){const r=e[t].split(".");if(r.length>2){let n=r.shift()+".";n+=parseInt(r.shift()).toString(16),n+=("000"+parseInt(r.shift()).toString(16)).slice(-4),e[t]=n}}return e.join(",")}(d));const{width:f,height:p,unknownCodecs:g}=t;if(a||(a=!(!f||!p)),o||(o=!!d),l||(l=!!h),null!=g&&g.length||h&&!Jt(h,"audio",r)||d&&!Jt(d,"video",r))return;const{CODECS:v,"FRAME-RATE":m,"HDCP-LEVEL":y,"PATHWAY-ID":E,RESOLUTION:S,"VIDEO-RANGE":b}=c,T=`${E||"."}-${t.bitrate}-${S}-${m}-${v}-${b}-${y}`;if(i[T])if(i[T].uri===t.url||t.attrs["PATHWAY-ID"])i[T].addGroupId("audio",c.AUDIO),i[T].addGroupId("text",c.SUBTITLES);else{const e=s[T]+=1;t.attrs["PATHWAY-ID"]=new Array(e+1).join(".");const r=new We(t);i[T]=r,n.push(r)}else{const e=new We(t);i[T]=e,s[T]=1,n.push(e)}})),this.filterAndSortMediaOptions(n,e,a,o,l)}filterAndSortMediaOptions(t,e,r,n,i){let s=[],a=[],o=t;if((r||n)&&i&&(o=o.filter((({videoCodec:t,videoRange:e,width:r,height:n})=>{return(!!t||!(!r||!n))&&!!(i=e)&&Ve.indexOf(i)>-1;var i}))),0===o.length)return void Promise.resolve().then((()=>{if(this.hls){e.levels.length&&this.warn(`One or more CODECS in variant not supported: ${JSON.stringify(e.levels[0].attrs)}`);const t=new Error("no level with compatible codecs found in manifest");this.hls.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:e.url,error:t,reason:t.message})}}));if(e.audioTracks){const{preferManagedMediaSource:t}=this.hls.config;s=e.audioTracks.filter((e=>!e.audioCodec||Jt(e.audioCodec,"audio",t))),la(s)}e.subtitles&&(a=e.subtitles,la(a));const l=o.slice(0);o.sort(((t,e)=>{if(t.attrs["HDCP-LEVEL"]!==e.attrs["HDCP-LEVEL"])return(t.attrs["HDCP-LEVEL"]||"")>(e.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&t.height!==e.height)return t.height-e.height;if(t.frameRate!==e.frameRate)return t.frameRate-e.frameRate;if(t.videoRange!==e.videoRange)return Ve.indexOf(t.videoRange)-Ve.indexOf(e.videoRange);if(t.videoCodec!==e.videoCodec){const r=te(t.videoCodec),n=te(e.videoCodec);if(r!==n)return n-r}if(t.uri===e.uri&&t.codecSet!==e.codecSet){const r=ee(t.codecSet),n=ee(e.codecSet);if(r!==n)return n-r}return t.averageBitrate!==e.averageBitrate?t.averageBitrate-e.averageBitrate:0}));let u=l[0];if(this.steering&&(o=this.steering.filterParsedLevels(o),o.length!==l.length))for(let t=0;t<l.length;t++)if(l[t].pathwayId===o[0].pathwayId){u=l[t];break}this._levels=o;for(let t=0;t<o.length;t++)if(o[t]===u){var c;this._firstLevel=t;const e=u.bitrate,r=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${o.length} level(s) found, first bitrate: ${e}`),void 0===(null==(c=this.hls.userConfig)?void 0:c.abrEwmaDefaultEstimate)){const t=Math.min(e,this.hls.config.abrEwmaDefaultEstimateMax);t>r&&r===ia.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=t)}break}const h=i&&!n,d={levels:o,audioTracks:s,subtitleTracks:a,sessionData:e.sessionData,sessionKeys:e.sessionKeys,firstLevel:this._firstLevel,stats:e.stats,audio:i,video:n,altAudio:!h&&s.some((t=>!!t.url))};this.hls.trigger(m.MANIFEST_PARSED,d),(this.hls.config.autoStartLoad||this.hls.forceStartLoad)&&this.hls.startLoad(this.hls.config.startPosition)}get levels(){return 0===this._levels.length?null:this._levels}get level(){return this.currentLevelIndex}set level(t){const e=this._levels;if(0===e.length)return;if(t<0||t>=e.length){const r=new Error("invalid level idx"),n=t<0;if(this.hls.trigger(m.ERROR,{type:y.OTHER_ERROR,details:E.LEVEL_SWITCH_ERROR,level:t,fatal:n,error:r,reason:r.message}),n)return;t=Math.min(t,e.length-1)}const r=this.currentLevelIndex,n=this.currentLevel,i=n?n.attrs["PATHWAY-ID"]:void 0,s=e[t],a=s.attrs["PATHWAY-ID"];if(this.currentLevelIndex=t,this.currentLevel=s,r===t&&s.details&&n&&i===a)return;this.log(`Switching to level ${t} (${s.height?s.height+"p ":""}${s.videoRange?s.videoRange+" ":""}${s.codecSet?s.codecSet+" ":""}@${s.bitrate})${a?" with Pathway "+a:""} from level ${r}${i?" with Pathway "+i:""}`);const o={level:t,attrs:s.attrs,details:s.details,bitrate:s.bitrate,averageBitrate:s.averageBitrate,maxBitrate:s.maxBitrate,realBitrate:s.realBitrate,width:s.width,height:s.height,codecSet:s.codecSet,audioCodec:s.audioCodec,videoCodec:s.videoCodec,audioGroups:s.audioGroups,subtitleGroups:s.subtitleGroups,loaded:s.loaded,loadError:s.loadError,fragmentError:s.fragmentError,name:s.name,id:s.id,uri:s.uri,url:s.url,urlId:0,audioGroupIds:s.audioGroupIds,textGroupIds:s.textGroupIds};this.hls.trigger(m.LEVEL_SWITCHING,o);const l=s.details;if(!l||l.live){const t=this.switchParams(s.uri,null==n?void 0:n.details,l);this.loadPlaylist(t)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}get firstLevel(){return this._firstLevel}set firstLevel(t){this._firstLevel=t}get startLevel(){if(void 0===this._startLevel){const t=this.hls.config.startLevel;return void 0!==t?t:this.hls.firstAutoLevel}return this._startLevel}set startLevel(t){this._startLevel=t}onError(t,e){!e.fatal&&e.context&&e.context.type===Se&&e.context.level===this.level&&this.checkRetry(e)}onFragBuffered(t,{frag:e}){if(void 0!==e&&e.type===_e){const t=e.elementaryStreams;if(!Object.keys(t).some((e=>!!t[e])))return;const r=this._levels[e.level];null!=r&&r.loadError&&(this.log(`Resetting level error count of ${r.loadError} on frag buffered`),r.loadError=0)}}onLevelLoaded(t,e){var r;const{level:n,details:i}=e,s=this._levels[n];var a;if(!s)return this.warn(`Invalid level index ${n}`),void(null!=(a=e.deliveryDirectives)&&a.skip&&(i.deltaUpdateFailed=!0));n===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0),this.playlistLoaded(n,e,s.details)):null!=(r=e.deliveryDirectives)&&r.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(t){super.loadPlaylist();const e=this.currentLevelIndex,r=this.currentLevel;if(r&&this.shouldLoadPlaylist(r)){let n=r.uri;if(t)try{n=t.addDirectives(n)}catch(t){this.warn(`Could not construct new URL with HLS Delivery Directives: ${t}`)}const i=r.attrs["PATHWAY-ID"];this.log(`Loading level index ${e}${void 0!==(null==t?void 0:t.msn)?" at sn "+t.msn+" part "+t.part:""} with${i?" Pathway "+i:""} ${n}`),this.clearTimer(),this.hls.trigger(m.LEVEL_LOADING,{url:n,level:e,pathwayId:r.attrs["PATHWAY-ID"],id:0,deliveryDirectives:t||null})}}get nextLoadLevel(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}removeLevel(t){var e;const r=this._levels.filter(((e,r)=>r!==t||(this.steering&&this.steering.removeLevel(e),e===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,e.details&&e.details.fragments.forEach((t=>t.level=-1))),!1)));tr(r),this._levels=r,this.currentLevelIndex>-1&&null!=(e=this.currentLevel)&&e.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.hls.trigger(m.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(t,{levels:e}){this._levels=e}checkMaxAutoUpdated(){const{autoLevelCapping:t,maxAutoLevel:e,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==e&&(this._maxAutoLevel=e,this.hls.trigger(m.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:t,levels:this.levels,maxAutoLevel:e,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function la(t){const e={};t.forEach((t=>{const r=t.groupId||"";t.id=e[r]=e[r]||0,e[r]++}))}class ua{constructor(t){this.config=void 0,this.keyUriToKeyInfo={},this.emeController=null,this.config=t}abort(t){for(const r in this.keyUriToKeyInfo){const n=this.keyUriToKeyInfo[r].loader;if(n){var e;if(t&&t!==(null==(e=n.context)?void 0:e.frag.type))return;n.abort()}}}detach(){for(const t in this.keyUriToKeyInfo){const e=this.keyUriToKeyInfo[t];(e.mediaKeySessionContext||e.decryptdata.isCommonEncryption)&&delete this.keyUriToKeyInfo[t]}}destroy(){this.detach();for(const t in this.keyUriToKeyInfo){const e=this.keyUriToKeyInfo[t].loader;e&&e.destroy()}this.keyUriToKeyInfo={}}createKeyLoadError(t,e=E.KEY_LOAD_ERROR,r,n,i){return new Hr({type:y.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:i,error:r,networkDetails:n})}loadClear(t,e){if(this.emeController&&this.config.emeEnabled){const{sn:r,cc:n}=t;for(let t=0;t<e.length;t++){const i=e[t];if(n<=i.cc&&("initSegment"===r||"initSegment"===i.sn||r<i.sn)){this.emeController.selectKeySystemFormat(i).then((t=>{i.setKeyFormat(t)}));break}}}}load(t){return!t.decryptdata&&t.encrypted&&this.emeController?this.emeController.selectKeySystemFormat(t).then((e=>this.loadInternal(t,e))):this.loadInternal(t)}loadInternal(t,e){var r,n;e&&t.setKeyFormat(e);const i=t.decryptdata;if(!i){const r=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,E.KEY_LOAD_ERROR,r))}const s=i.uri;if(!s)return Promise.reject(this.createKeyLoadError(t,E.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${s}"`)));let a=this.keyUriToKeyInfo[s];if(null!=(r=a)&&r.decryptdata.key)return i.key=a.decryptdata.key,Promise.resolve({frag:t,keyInfo:a});var o;if(null!=(n=a)&&n.keyLoadPromise)switch(null==(o=a.mediaKeySessionContext)?void 0:o.keyStatus){case void 0:case"status-pending":case"usable":case"usable-in-future":return a.keyLoadPromise.then((e=>(i.key=e.keyInfo.decryptdata.key,{frag:t,keyInfo:a})))}switch(a=this.keyUriToKeyInfo[s]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"ISO-23001-7":case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return"identity"===i.keyFormat?this.loadKeyHTTP(a,t):this.loadKeyEME(a,t);case"AES-128":return this.loadKeyHTTP(a,t);default:return Promise.reject(this.createKeyLoadError(t,E.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(t,e){const r={frag:e,keyInfo:t};if(this.emeController&&this.config.emeEnabled){const e=this.emeController.loadKey(r);if(e)return(t.keyLoadPromise=e.then((e=>(t.mediaKeySessionContext=e,r)))).catch((e=>{throw t.keyLoadPromise=null,e}))}return Promise.resolve(r)}loadKeyHTTP(t,e){const r=this.config,n=new(0,r.loader)(r);return e.keyLoader=t.loader=n,t.keyLoadPromise=new Promise(((i,s)=>{const a={keyInfo:t,frag:e,responseType:"arraybuffer",url:t.decryptdata.uri},o=r.keyLoadPolicy.default,l={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},u={onSuccess:(t,e,r,n)=>{const{frag:a,keyInfo:o,url:l}=r;if(!a.decryptdata||o!==this.keyUriToKeyInfo[l])return s(this.createKeyLoadError(a,E.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),n));o.decryptdata.key=a.decryptdata.key=new Uint8Array(t.data),a.keyLoader=null,o.loader=null,i({frag:a,keyInfo:o})},onError:(t,r,n,i)=>{this.resetLoader(r),s(this.createKeyLoadError(e,E.KEY_LOAD_ERROR,new Error(`HTTP Error ${t.code} loading key ${t.text}`),n,d({url:a.url,data:void 0},t)))},onTimeout:(t,r,n)=>{this.resetLoader(r),s(this.createKeyLoadError(e,E.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),n))},onAbort:(t,r,n)=>{this.resetLoader(r),s(this.createKeyLoadError(e,E.INTERNAL_ABORTED,new Error("key loading aborted"),n))}};n.load(a,l,u)}))}resetLoader(t){const{frag:e,keyInfo:r,url:n}=t,i=r.loader;e.keyLoader===i&&(e.keyLoader=null,r.loader=null),delete this.keyUriToKeyInfo[n],i&&i.destroy()}}function ca(){return self.SourceBuffer||self.WebKitSourceBuffer}function ha(){if(!zt())return!1;const t=ca();return!t||t.prototype&&"function"==typeof t.prototype.appendBuffer&&"function"==typeof t.prototype.remove}class da{constructor(t,e,r,n){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=n}destroy(){this.media=null,this.hls=this.fragmentTracker=null}poll(t,e){const{config:r,media:n,stalled:i}=this;if(null===n)return;const{currentTime:s,seeking:a}=n,o=this.seeking&&!a,l=!this.seeking&&a;if(this.seeking=a,s!==t){if(this.moved=!0,a||(this.nudgeRetry=0),null!==i){if(this.stallReported){const t=self.performance.now()-i;_.warn(`playback not stuck anymore @${s}, after ${Math.round(t)}ms`),this.stallReported=!1}this.stalled=null}return}if(l||o)return void(this.stalled=null);if(n.paused&&!a||n.ended||0===n.playbackRate||!Pr.getBuffered(n).length)return void(this.nudgeRetry=0);const u=Pr.bufferInfo(n,s,0),c=u.nextStart||0;if(a){const t=u.len>2,r=!c||e&&e.start<=s||c-s>2&&!this.fragmentTracker.getPartialFragment(s);if(t||r)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var h;if(!(u.len>0||c))return;const t=Math.max(c,u.start||0)-s,e=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,r=(null==e||null==(h=e.details)?void 0:h.live)?2*e.details.targetduration:2,i=this.fragmentTracker.getPartialFragment(s);if(t>0&&(t<=r||i))return void(n.paused||this._trySkipBufferHole(i))}const d=self.performance.now();if(null===i)return void(this.stalled=d);const f=d-i;if(!a&&f>=250&&(this._reportStall(u),!this.media))return;const p=Pr.bufferInfo(n,s,r.maxBufferHole);this._tryFixBufferStall(p,f)}_tryFixBufferStall(t,e){const{config:r,fragmentTracker:n,media:i}=this;if(null===i)return;const s=i.currentTime,a=n.getPartialFragment(s);(!a||!this._trySkipBufferHole(a)&&this.media)&&(t.len>r.maxBufferHole||t.nextStart&&t.nextStart-s<r.maxBufferHole)&&e>1e3*r.highBufferWatchdogPeriod&&(_.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}_reportStall(t){const{hls:e,media:r,stallReported:n}=this;if(!n&&r){this.stallReported=!0;const n=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${JSON.stringify(t)})`);_.warn(n.message),e.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_STALLED_ERROR,fatal:!1,error:n,buffer:t.len})}}_trySkipBufferHole(t){const{config:e,hls:r,media:n}=this;if(null===n)return 0;const i=n.currentTime,s=Pr.bufferInfo(n,i,0),a=i<s.start?s.start:s.nextStart;if(a){const o=s.len<=e.maxBufferHole,l=s.len>0&&s.len<1&&n.readyState<3,u=a-i;if(u>0&&(o||l)){if(u>e.maxBufferHole){const{fragmentTracker:e}=this;let r=!1;if(0===i){const t=e.getAppendedFrag(0,_e);t&&a<t.end&&(r=!0)}if(!r){const r=t||e.getAppendedFrag(i,_e);if(r){let t=!1,n=r.end;for(;n<a;){const r=e.getPartialFragment(n);if(!r){t=!0;break}n+=r.duration}if(t)return 0}}}const s=Math.max(a+.05,i+.1);if(_.warn(`skipping hole, adjusting currentTime from ${i} to ${s}`),this.moved=!0,this.stalled=null,n.currentTime=s,t&&!t.gap){const e=new Error(`fragment loaded with buffer holes, seeking from ${i} to ${s}`);r.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:e,reason:e.message,frag:t})}return s}}return 0}_tryNudgeBuffer(){const{config:t,hls:e,media:r,nudgeRetry:n}=this;if(null===r)return;const i=r.currentTime;if(this.nudgeRetry++,n<t.nudgeMaxRetry){const s=i+(n+1)*t.nudgeOffset,a=new Error(`Nudging 'currentTime' from ${i} to ${s}`);_.warn(a.message),r.currentTime=s,e.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_NUDGE_ON_STALL,error:a,fatal:!1})}else{const r=new Error(`Playhead still not moving while enough data buffered @${i} after ${t.nudgeMaxRetry} nudges`);_.error(r.message),e.trigger(m.ERROR,{type:y.MEDIA_ERROR,details:E.BUFFER_STALLED_ERROR,error:r,fatal:!0})}}}class fa extends sn{constructor(t,e,r){super(t,e,r,"[stream-controller]",_e),this.audioCodecSwap=!1,this.gapController=null,this.level=-1,this._forceStartLoad=!1,this.altAudio=!1,this.audioOnly=!1,this.fragPlaying=null,this.onvplaying=null,this.onvseeked=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this._registerListeners()}_registerListeners(){const{hls:t}=this;t.on(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.on(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(m.MANIFEST_LOADING,this.onManifestLoading,this),t.on(m.MANIFEST_PARSED,this.onManifestParsed,this),t.on(m.LEVEL_LOADING,this.onLevelLoading,this),t.on(m.LEVEL_LOADED,this.onLevelLoaded,this),t.on(m.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.on(m.ERROR,this.onError,this),t.on(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.on(m.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.on(m.BUFFER_CREATED,this.onBufferCreated,this),t.on(m.BUFFER_FLUSHED,this.onBufferFlushed,this),t.on(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.on(m.FRAG_BUFFERED,this.onFragBuffered,this)}_unregisterListeners(){const{hls:t}=this;t.off(m.MEDIA_ATTACHED,this.onMediaAttached,this),t.off(m.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(m.MANIFEST_LOADING,this.onManifestLoading,this),t.off(m.MANIFEST_PARSED,this.onManifestParsed,this),t.off(m.LEVEL_LOADED,this.onLevelLoaded,this),t.off(m.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),t.off(m.ERROR,this.onError,this),t.off(m.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),t.off(m.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),t.off(m.BUFFER_CREATED,this.onBufferCreated,this),t.off(m.BUFFER_FLUSHED,this.onBufferFlushed,this),t.off(m.LEVELS_UPDATED,this.onLevelsUpdated,this),t.off(m.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this._unregisterListeners(),super.onHandlerDestroying()}startLoad(t){if(this.levels){const{lastCurrentTime:e,hls:r}=this;if(this.stopLoad(),this.setInterval(100),this.level=-1,!this.startFragRequested){let t=r.startLevel;-1===t&&(r.config.testBandwidth&&this.levels.length>1?(t=0,this.bitrateTest=!0):t=r.firstAutoLevel),r.nextLoadLevel=t,this.level=r.loadLevel,this.loadedmetadata=!1}e>0&&-1===t&&(this.log(`Override startPosition with lastCurrentTime @${e.toFixed(3)}`),t=e),this.state=qr,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=Wr}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case nn:{const{levels:t,level:e}=this,r=null==t?void 0:t[e],n=null==r?void 0:r.details;if(n&&(!n.live||this.levelLastLoaded===r)){if(this.waitForCdnTuneIn(n))break;this.state=qr;break}if(this.hls.nextLoadLevel!==this.level){this.state=qr;break}break}case Xr:{var t;const e=self.performance.now(),r=this.retryDate;if(!r||e>=r||null!=(t=this.media)&&t.seeking){const{levels:t,level:e}=this,r=null==t?void 0:t[e];this.resetStartWhenNotLoaded(r||null),this.state=qr}}}this.state===qr&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){super.onTickEnd(),this.checkBuffer(),this.checkFragmentChanged()}doTickIdle(){const{hls:t,levelLastLoaded:e,levels:r,media:n}=this;if(null===e||!n&&(this.startFragRequested||!t.config.startFragPrefetch))return;if(this.altAudio&&this.audioOnly)return;const i=t.nextLoadLevel;if(null==r||!r[i])return;const s=r[i],a=this.getMainFwdBufferInfo();if(null===a)return;const o=this.getLevelDetails();if(o&&this._streamEnded(a,o)){const t={};return this.altAudio&&(t.type="video"),this.hls.trigger(m.BUFFER_EOS,t),void(this.state=tn)}t.loadLevel!==i&&-1===t.manualLevel&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=t.nextLoadLevel=i;const l=s.details;if(!l||this.state===nn||l.live&&this.levelLastLoaded!==s)return this.level=i,void(this.state=nn);const u=a.len,c=this.getMaxBufferLength(s.maxBitrate);if(u>=c)return;this.backtrackFragment&&this.backtrackFragment.start>a.end&&(this.backtrackFragment=null);const h=this.backtrackFragment?this.backtrackFragment.start:a.end;let d=this.getNextFragment(h,l);if(this.couldBacktrack&&!this.fragPrevious&&d&&"initSegment"!==d.sn&&this.fragmentTracker.getState(d)!==wr){var f;const t=(null!=(f=this.backtrackFragment)?f:d).sn-l.startSN,e=l.fragments[t-1];e&&d.cc===e.cc&&(d=e,this.fragmentTracker.removeFragment(e))}else this.backtrackFragment&&a.len&&(this.backtrackFragment=null);if(d&&this.isLoopLoading(d,h)){if(!d.gap){const t=this.audioOnly&&!this.altAudio?I:P,e=(t===P?this.videoBuffer:this.mediaBuffer)||this.media;e&&this.afterBufferFlushed(e,t,_e)}d=this.getNextFragmentLoopLoading(d,l,a,_e,c)}d&&(!d.initSegment||d.initSegment.data||this.bitrateTest||(d=d.initSegment),this.loadFragment(d,s,h))}loadFragment(t,e,r){const n=this.fragmentTracker.getState(t);this.fragCurrent=t,n===_r||n===Lr?"initSegment"===t.sn?this._loadInitSegment(t,e):this.bitrateTest?(this.log(`Fragment ${t.sn} of level ${t.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(t,e)):(this.startFragRequested=!0,super.loadFragment(t,e,r)):this.clearTrackerIfNeeded(t)}getBufferedFrag(t){return this.fragmentTracker.getBufferedFrag(t,_e)}followingBufferedFrag(t){return t?this.getBufferedFrag(t.end+.5):null}immediateLevelSwitch(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)}nextLevelSwitch(){const{levels:t,media:e}=this;if(null!=e&&e.readyState){let r;const n=this.getAppendedFrag(e.currentTime);n&&n.start>1&&this.flushMainBuffer(0,n.start-1);const i=this.getLevelDetails();if(null!=i&&i.live){const t=this.getMainFwdBufferInfo();if(!t||t.len<2*i.targetduration)return}if(!e.paused&&t){const e=t[this.hls.nextLoadLevel],n=this.fragLastKbps;r=n&&this.fragCurrent?this.fragCurrent.duration*e.maxBitrate/(1e3*n)+1:0}else r=0;const s=this.getBufferedFrag(e.currentTime+r);if(s){const t=this.followingBufferedFrag(s);if(t){this.abortCurrentFrag();const e=t.maxStartPTS?t.maxStartPTS:t.start,r=t.duration,n=Math.max(s.end,e+Math.min(Math.max(r-this.config.maxFragLookUpTolerance,r*(this.couldBacktrack?.5:.125)),r*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(n,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,t&&(t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.state){case Yr:case zr:case Xr:case Qr:case Zr:this.state=qr}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(t,e){super.flushMainBuffer(t,e,this.altAudio?"video":null)}onMediaAttached(t,e){super.onMediaAttached(t,e);const r=e.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new da(this.config,r,this.fragmentTracker,this.hls)}onMediaDetaching(){const{media:t}=this;t&&this.onvplaying&&this.onvseeked&&(t.removeEventListener("playing",this.onvplaying),t.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),super.onMediaDetaching()}onMediaPlaying(){this.tick()}onMediaSeeked(){const t=this.media,e=t?t.currentTime:null;p(e)&&this.log(`Media seeked to ${e.toFixed(3)}`);const r=this.getMainFwdBufferInfo();null!==r&&0!==r.len?this.tick():this.warn(`Main forward buffer length on "seeked" event ${r?r.len:"empty"})`)}onManifestLoading(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(m.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=this.fragLastKbps=0,this.levels=this.fragPlaying=this.backtrackFragment=this.levelLastLoaded=null,this.altAudio=this.audioOnly=this.startFragRequested=!1}onManifestParsed(t,e){let r=!1,n=!1;e.levels.forEach((t=>{const e=t.audioCodec;e&&(r=r||-1!==e.indexOf("mp4a.40.2"),n=n||-1!==e.indexOf("mp4a.40.5"))})),this.audioCodecSwitch=r&&n&&!function(){var t;const e=ca();return"function"==typeof(null==e||null==(t=e.prototype)?void 0:t.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}onLevelLoading(t,e){const{levels:r}=this;if(!r||this.state!==qr)return;const n=r[e.level];(!n.details||n.details.live&&this.levelLastLoaded!==n||this.waitForCdnTuneIn(n.details))&&(this.state=nn)}onLevelLoaded(t,e){var r;const{levels:n}=this,i=e.level,s=e.details,a=s.totalduration;if(!n)return void this.warn(`Levels were reset while loading level ${i}`);this.log(`Level ${i} loaded [${s.startSN},${s.endSN}]${s.lastPartSn?`[part-${s.lastPartSn}-${s.lastPartIndex}]`:""}, cc [${s.startCC}, ${s.endCC}] duration:${a}`);const o=n[i],l=this.fragCurrent;!l||this.state!==zr&&this.state!==Xr||l.level!==e.level&&l.loader&&this.abortCurrentFrag();let u=0;if(s.live||null!=(r=o.details)&&r.live){var c;if(this.checkLiveUpdate(s),s.deltaUpdateFailed)return;u=this.alignPlaylists(s,o.details,null==(c=this.levelLastLoaded)?void 0:c.details)}if(o.details=s,this.levelLastLoaded=o,this.hls.trigger(m.LEVEL_UPDATED,{details:s,level:i}),this.state===nn){if(this.waitForCdnTuneIn(s))return;this.state=qr}this.startFragRequested?s.live&&this.synchronizeToLiveEdge(s):this.setStartPosition(s,u),this.tick()}_handleFragmentLoadProgress(t){var e;const{frag:r,part:n,payload:i}=t,{levels:s}=this;if(!s)return void this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);const a=s[r.level],o=a.details;if(!o)return this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),void this.fragmentTracker.removeFragment(r);const l=a.videoCodec,u=o.PTSKnown||!o.live,c=null==(e=r.initSegment)?void 0:e.data,h=this._getAudioCodec(a),d=this.transmuxer=this.transmuxer||new hi(this.hls,_e,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),f=n?n.index:-1,p=-1!==f,g=new Or(r.level,r.sn,r.stats.chunkCount,i.byteLength,f,p),v=this.initPTS[r.cc];d.push(i,c,h,l,r,n,o.totalduration,u,g,v)}onAudioTrackSwitching(t,e){const 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;const t=this.fragCurrent;t&&(this.log("Switching to main audio track, cancel main fragment load"),t.abortRequests(),this.fragmentTracker.removeFragment(t)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();const t=this.hls;r&&(t.trigger(m.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null}),this.fragmentTracker.removeAllFragments()),t.trigger(m.AUDIO_TRACK_SWITCHED,e)}}onAudioTrackSwitched(t,e){const r=e.id,n=!!this.hls.audioTracks[r].url;if(n){const t=this.videoBuffer;t&&this.mediaBuffer!==t&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=t)}this.altAudio=n,this.tick()}onBufferCreated(t,e){const r=e.tracks;let n,i,s=!1;for(const t in r){const e=r[t];if("main"===e.id){if(i=t,n=e,"video"===t){const e=r[t];e&&(this.videoBuffer=e.buffer)}}else s=!0}s&&n?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}onFragBuffered(t,e){const{frag:r,part:n}=e;if(r&&r.type!==_e)return;if(this.fragContextChanged(r))return this.warn(`Fragment ${r.sn}${n?" p: "+n.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),void(this.state===Zr&&(this.state=qr));const i=n?n.stats:r.stats;this.fragLastKbps=Math.round(8*i.total/(i.buffering.end-i.loading.first)),"initSegment"!==r.sn&&(this.fragPrevious=r),this.fragBufferedComplete(r,n)}onError(t,e){var r;if(e.fatal)this.state=en;else switch(e.details){case E.FRAG_GAP:case E.FRAG_PARSING_ERROR:case E.FRAG_DECRYPT_ERROR:case E.FRAG_LOAD_ERROR:case E.FRAG_LOAD_TIMEOUT:case E.KEY_LOAD_ERROR:case E.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(_e,e);break;case E.LEVEL_LOAD_ERROR:case E.LEVEL_LOAD_TIMEOUT:case E.LEVEL_PARSING_ERROR:e.levelRetry||this.state!==nn||(null==(r=e.context)?void 0:r.type)!==Se||(this.state=qr);break;case E.BUFFER_APPEND_ERROR:case E.BUFFER_FULL_ERROR:if(!e.parent||"main"!==e.parent)return;if(e.details===E.BUFFER_APPEND_ERROR)return void this.resetLoadingState();this.reduceLengthAndFlushBuffer(e)&&this.flushMainBuffer(0,Number.POSITIVE_INFINITY);break;case E.INTERNAL_EXCEPTION:this.recoverWorkerError(e)}}checkBuffer(){const{media:t,gapController:e}=this;if(t&&e&&t.readyState){if(this.loadedmetadata||!Pr.getBuffered(t).length){const t=this.state!==qr?this.fragCurrent:null;e.poll(this.lastCurrentTime,t)}this.lastCurrentTime=t.currentTime}}onFragLoadEmergencyAborted(){this.state=qr,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()}onBufferFlushed(t,{type:e}){if(e!==I||this.audioOnly&&!this.altAudio){const t=(e===P?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(t,e,_e),this.tick()}}onLevelsUpdated(t,e){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level),this.levels=e.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:t}=this;if(!t)return;const e=t.currentTime;let r=this.startPosition;if(r>=0&&e<r){if(t.seeking)return void this.log(`could not seek to ${r}, already seeking at ${e}`);const n=Pr.getBuffered(t),i=(n.length?n.start(0):0)-r;i>0&&(i<this.config.maxBufferHole||i<this.config.maxFragLookUpTolerance)&&(this.log(`adjusting start position by ${i} to match buffer start`),r+=i,this.startPosition=r),this.log(`seek to target start position ${r} from current time ${e}`),t.currentTime=r}}_getAudioCodec(t){let 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}_loadBitrateTestFrag(t,e){t.bitrateTest=!0,this._doFragLoad(t,e).then((r=>{const{hls:n}=this;if(!r||this.fragContextChanged(t))return;e.fragmentError=0,this.state=qr,this.startFragRequested=!1,this.bitrateTest=!1;const i=t.stats;i.parsing.start=i.parsing.end=i.buffering.start=i.buffering.end=self.performance.now(),n.trigger(m.FRAG_LOADED,r),t.bitrateTest=!1}))}_handleTransmuxComplete(t){var e;const r="main",{hls:n}=this,{remuxResult:i,chunkMeta:s}=t,a=this.getCurrentContext(s);if(!a)return void this.resetWhenMissingContext(s);const{frag:o,part:l,level:u}=a,{video:c,text:h,id3:d,initSegment:f}=i,{details:g}=u,v=this.altAudio?void 0:i.audio;if(this.fragContextChanged(o))this.fragmentTracker.removeFragment(o);else{if(this.state=Qr,f){if(null!=f&&f.tracks){const t=o.initSegment||o;this._bufferInitSegment(u,f.tracks,t,s),n.trigger(m.FRAG_PARSING_INIT_SEGMENT,{frag:t,id:r,tracks:f.tracks})}const t=f.initPTS,e=f.timescale;p(t)&&(this.initPTS[o.cc]={baseTime:t,timescale:e},n.trigger(m.INIT_PTS_FOUND,{frag:o,id:r,initPTS:t,timescale:e}))}if(c&&g&&"initSegment"!==o.sn){const t=g.fragments[o.sn-1-g.startSN],e=o.sn===g.startSN,r=!t||o.cc>t.cc;if(!1!==i.independent){const{startPTS:t,endPTS:n,startDTS:i,endDTS:a}=c;if(l)l.elementaryStreams[c.type]={startPTS:t,endPTS:n,startDTS:i,endDTS:a};else if(c.firstKeyFrame&&c.independent&&1===s.id&&!r&&(this.couldBacktrack=!0),c.dropped&&c.independent){const i=this.getMainFwdBufferInfo(),s=(i?i.end:this.getLoadPosition())+this.config.maxBufferHole,l=c.firstKeyFramePTS?c.firstKeyFramePTS:t;if(!e&&s<l-this.config.maxBufferHole&&!r)return void this.backtrack(o);r&&(o.gap=!0),o.setElementaryStreamInfo(c.type,o.start,n,o.start,a,!0)}else e&&t>2&&(o.gap=!0);o.setElementaryStreamInfo(c.type,t,n,i,a),this.backtrackFragment&&(this.backtrackFragment=o),this.bufferFragmentData(c,o,l,s,e||r)}else{if(!e&&!r)return void this.backtrack(o);o.gap=!0}}if(v){const{startPTS:t,endPTS:e,startDTS:r,endDTS:n}=v;l&&(l.elementaryStreams[I]={startPTS:t,endPTS:e,startDTS:r,endDTS:n}),o.setElementaryStreamInfo(I,t,e,r,n),this.bufferFragmentData(v,o,l,s)}if(g&&null!=d&&null!=(e=d.samples)&&e.length){const t={id:r,frag:o,details:g,samples:d.samples};n.trigger(m.FRAG_PARSING_METADATA,t)}if(g&&h){const t={id:r,frag:o,details:g,samples:h.samples};n.trigger(m.FRAG_PARSING_USERDATA,t)}}}_bufferInitSegment(t,e,r,n){if(this.state!==Qr)return;this.audioOnly=!!e.audio&&!e.video,this.altAudio&&!this.audioOnly&&delete e.audio;const{audio:i,video:s,audiovideo:a}=e;if(i){let e=t.audioCodec;const r=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){e&&(e=-1!==e.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5");const t=i.metadata;t&&"channelCount"in t&&1!==(t.channelCount||1)&&-1===r.indexOf("firefox")&&(e="mp4a.40.5")}e&&-1!==e.indexOf("mp4a.40.5")&&-1!==r.indexOf("android")&&"audio/mpeg"!==i.container&&(e="mp4a.40.2",this.log(`Android: force audio codec to ${e}`)),t.audioCodec&&t.audioCodec!==e&&this.log(`Swapping manifest audio codec "${t.audioCodec}" for "${e}"`),i.levelCodec=e,i.id="main",this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${e||""}/${t.audioCodec||""}/${i.codec}]`)}s&&(s.levelCodec=t.videoCodec,s.id="main",this.log(`Init video buffer, container:${s.container}, codecs[level/parsed]=[${t.videoCodec||""}/${s.codec}]`)),a&&this.log(`Init audiovideo buffer, container:${a.container}, codecs[level/parsed]=[${t.codecs}/${a.codec}]`),this.hls.trigger(m.BUFFER_CODECS,e),Object.keys(e).forEach((t=>{const i=e[t].initSegment;null!=i&&i.byteLength&&this.hls.trigger(m.BUFFER_APPENDING,{type:t,data:i,frag:r,part:null,chunkMeta:n,parent:r.type})})),this.tickImmediate()}getMainFwdBufferInfo(){return this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,_e)}backtrack(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=qr}checkFragmentChanged(){const t=this.media;let e=null;if(t&&t.readyState>1&&!1===t.seeking){const r=t.currentTime;if(Pr.isBuffered(t,r)?e=this.getAppendedFrag(r):Pr.isBuffered(t,r+.1)&&(e=this.getAppendedFrag(r+.1)),e){this.backtrackFragment=null;const t=this.fragPlaying,r=e.level;t&&e.sn===t.sn&&t.level===r||(this.fragPlaying=e,this.hls.trigger(m.FRAG_CHANGED,{frag:e}),t&&t.level===r||this.hls.trigger(m.LEVEL_SWITCHED,{level:r}))}}}get nextLevel(){const t=this.nextBufferedFrag;return t?t.level:-1}get currentFrag(){const t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}get currentProgramDateTime(){const t=this.media;if(t){const e=t.currentTime,r=this.currentFrag;if(r&&p(e)&&p(r.programDateTime)){const t=r.programDateTime+1e3*(e-r.start);return new Date(t)}}return null}get currentLevel(){const t=this.currentFrag;return t?t.level:-1}get nextBufferedFrag(){const t=this.currentFrag;return t?this.followingBufferedFrag(t):null}get forceStartLoad(){return this._forceStartLoad}}class pa{static get version(){return"1.5.17"}static isMSESupported(){return ha()}static isSupported(){return function(){if(!ha())return!1;const t=zt();return"function"==typeof(null==t?void 0:t.isTypeSupported)&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some((e=>t.isTypeSupported(Zt(e,"video"))))||["mp4a.40.2","fLaC"].some((e=>t.isTypeSupported(Zt(e,"audio")))))}()}static getMediaSource(){return zt()}static get Events(){return m}static get ErrorTypes(){return y}static get ErrorDetails(){return E}static get DefaultConfig(){return pa.defaultConfig?pa.defaultConfig:ia}static set DefaultConfig(t){pa.defaultConfig=t}constructor(t={}){this.config=void 0,this.userConfig=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this.started=!1,this._emitter=new ci,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this.url=null,this.triggeringException=void 0,function(t,e){if("object"==typeof console&&!0===t||"object"==typeof t){!function(t,...e){e.forEach((function(e){T[e]=t[e]?t[e].bind(t):function(t){const e=self.console[t];return e?e.bind(self.console,`[${t}] >`):S}(e)}))}(t,"debug","log","info","warn","error");try{T.log('Debug logs enabled for "Hls instance" in hls.js version 1.5.17')}catch(t){T=b}}else T=b}(t.debug||!1);const e=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"');const r=sa(t),n=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return["manifest","level","frag"].forEach((t=>{const i=`${"level"===t?"playlist":t}LoadPolicy`,s=void 0===e[i],a=[];n.forEach((n=>{const o=`${t}Loading${n}`,l=e[o];if(void 0!==l&&s){a.push(o);const t=r[i].default;switch(e[i]={default:t},n){case"TimeOut":t.maxLoadTimeMs=l,t.maxTimeToFirstByteMs=l;break;case"MaxRetry":t.errorRetry.maxNumRetry=l,t.timeoutRetry.maxNumRetry=l;break;case"RetryDelay":t.errorRetry.retryDelayMs=l,t.timeoutRetry.retryDelayMs=l;break;case"MaxRetryTimeout":t.errorRetry.maxRetryDelayMs=l,t.timeoutRetry.maxRetryDelayMs=l}}})),a.length&&_.warn(`hls.js config: "${a.join('", "')}" setting(s) are deprecated, use "${i}": ${JSON.stringify(e[i])}`)})),d(d({},r),e)}(pa.DefaultConfig,t);this.userConfig=t,e.progressive&&function(t){const e=t.loader;e!==Zs&&e!==Js?(_.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=Zs,t.progressive=!0,t.enableSoftwareAES=!0,_.log("[config]: Progressive streaming enabled, using FetchLoader"))}(e);const{abrController:r,bufferController:n,capLevelController:i,errorController:s,fpsController:a}=e,o=new s(this),l=this.abrController=new r(this),u=this.bufferController=new n(this),c=this.capLevelController=new i(this),h=new a(this),f=new ke(this),p=new je(this),g=e.contentSteeringController,v=g?new g(this):null,y=this.levelController=new oa(this,v),E=new Rr(this),A=new ua(this.config),L=this.streamController=new fa(this,E,A);c.setStreamController(L),h.setStreamController(L);const w=[f,y,L];v&&w.splice(1,0,v),this.networkControllers=w;const R=[l,u,c,h,p,E];this.audioTrackController=this.createController(e.audioTrackController,w);const k=e.audioStreamController;k&&w.push(new k(this,E,A)),this.subtitleTrackController=this.createController(e.subtitleTrackController,w);const D=e.subtitleStreamController;D&&w.push(new D(this,E,A)),this.createController(e.timelineController,R),A.emeController=this.emeController=this.createController(e.emeController,R),this.cmcdController=this.createController(e.cmcdController,R),this.latencyController=this.createController(He,R),this.coreComponents=R,w.push(o);const I=o.onErrorOut;"function"==typeof I&&this.on(m.ERROR,I,o)}createController(t,e){if(t){const r=new t(this);return e&&e.push(r),r}return null}on(t,e,r=this){this._emitter.on(t,e,r)}once(t,e,r=this){this._emitter.once(t,e,r)}removeAllListeners(t){this._emitter.removeAllListeners(t)}off(t,e,r=this,n){this._emitter.off(t,e,r,n)}listeners(t){return this._emitter.listeners(t)}emit(t,e,r){return this._emitter.emit(t,e,r)}trigger(t,e){if(this.config.debug)return this.emit(t,t,e);try{return this.emit(t,t,e)}catch(e){if(_.error("An internal error happened while handling event "+t+'. Error message: "'+e.message+'". Here is a stacktrace:',e),!this.triggeringException){this.triggeringException=!0;const r=t===m.ERROR;this.trigger(m.ERROR,{type:y.OTHER_ERROR,details:E.INTERNAL_EXCEPTION,fatal:r,event:t,error:e}),this.triggeringException=!1}}return!1}listenerCount(t){return this._emitter.listenerCount(t)}destroy(){_.log("destroy"),this.trigger(m.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this.url=null,this.networkControllers.forEach((t=>t.destroy())),this.networkControllers.length=0,this.coreComponents.forEach((t=>t.destroy())),this.coreComponents.length=0;const t=this.config;t.xhrSetup=t.fetchSetup=void 0,this.userConfig=null}attachMedia(t){_.log("attachMedia"),this._media=t,this.trigger(m.MEDIA_ATTACHING,{media:t})}detachMedia(){_.log("detachMedia"),this.trigger(m.MEDIA_DETACHING,void 0),this._media=null}loadSource(t){this.stopLoad();const e=this.media,r=this.url,n=this.url=c.buildAbsoluteURL(self.location.href,t,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,_.log(`loadSource:${n}`),e&&r&&(r!==n||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(e)),this.trigger(m.MANIFEST_LOADING,{url:t})}startLoad(t=-1){_.log(`startLoad(${t})`),this.started=!0,this.networkControllers.forEach((e=>{e.startLoad(t)}))}stopLoad(){_.log("stopLoad"),this.started=!1,this.networkControllers.forEach((t=>{t.stopLoad()}))}resumeBuffering(){this.started&&this.networkControllers.forEach((t=>{"fragmentLoader"in t&&t.startLoad(-1)}))}pauseBuffering(){this.networkControllers.forEach((t=>{"fragmentLoader"in t&&t.stopLoad()}))}swapAudioCodec(){_.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){_.log("recoverMediaError");const t=this._media;this.detachMedia(),t&&this.attachMedia(t)}removeLevel(t){this.levelController.removeLevel(t)}get levels(){return this.levelController.levels||[]}get currentLevel(){return this.streamController.currentLevel}set currentLevel(t){_.log(`set currentLevel:${t}`),this.levelController.manualLevel=t,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(t){_.log(`set nextLevel:${t}`),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(t){_.log(`set loadLevel:${t}`),this.levelController.manualLevel=t}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(t){this.levelController.nextLoadLevel=t}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(t){_.log(`set firstLevel:${t}`),this.levelController.firstLevel=t}get startLevel(){const t=this.levelController.startLevel;return-1===t&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:t}set startLevel(t){_.log(`set startLevel:${t}`),-1!==t&&(t=Math.max(t,this.minAutoLevel)),this.levelController.startLevel=t}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(t){const e=!!t;e!==this.config.capLevelToPlayerSize&&(e?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=e)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimate():NaN}set bandwidthEstimate(t){this.abrController.resetEstimator(t)}get ttfbEstimate(){const{bwEstimator:t}=this.abrController;return t?t.getEstimateTTFB():NaN}set autoLevelCapping(t){this._autoLevelCapping!==t&&(_.log(`set autoLevelCapping:${t}`),this._autoLevelCapping=t,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(t){(function(t){return Ge.indexOf(t)>-1})(t)&&this._maxHdcpLevel!==t&&(this._maxHdcpLevel=t,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return-1===this.levelController.manualLevel}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:t,config:{minAutoBitrate:e}}=this;if(!t)return 0;const r=t.length;for(let n=0;n<r;n++)if(t[n].maxBitrate>=e)return n;return 0}get maxAutoLevel(){const{levels:t,autoLevelCapping:e,maxHdcpLevel:r}=this;let n;if(n=-1===e&&null!=t&&t.length?t.length-1:e,r)for(let e=n;e--;){const n=t[e].attrs["HDCP-LEVEL"];if(n&&n<=r)return e}return n}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(t){this.abrController.nextAutoLevel=t}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}setAudioOption(t){var e;return null==(e=this.audioTrackController)?void 0:e.setAudioOption(t)}setSubtitleOption(t){var e;return null==(e=this.subtitleTrackController)||e.setSubtitleOption(t),null}get allAudioTracks(){const t=this.audioTrackController;return t?t.allAudioTracks:[]}get audioTracks(){const t=this.audioTrackController;return t?t.audioTracks:[]}get audioTrack(){const t=this.audioTrackController;return t?t.audioTrack:-1}set audioTrack(t){const e=this.audioTrackController;e&&(e.audioTrack=t)}get allSubtitleTracks(){const t=this.subtitleTrackController;return t?t.allSubtitleTracks:[]}get subtitleTracks(){const t=this.subtitleTrackController;return t?t.subtitleTracks:[]}get subtitleTrack(){const t=this.subtitleTrackController;return t?t.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(t){const e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}get subtitleDisplay(){const t=this.subtitleTrackController;return!!t&&t.subtitleDisplay}set subtitleDisplay(t){const e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(t){this.config.lowLatencyMode=t}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}}pa.defaultConfig=void 0;var ga=r(7563);function va(t,e){return function(){return t.apply(e,arguments)}}const{toString:ma}=Object.prototype,{getPrototypeOf:ya}=Object,Ea=(Sa=Object.create(null),t=>{const e=ma.call(t);return Sa[e]||(Sa[e]=e.slice(8,-1).toLowerCase())});var Sa;const ba=t=>(t=t.toLowerCase(),e=>Ea(e)===t),Ta=t=>e=>typeof e===t,{isArray:_a}=Array,Aa=Ta("undefined"),La=ba("ArrayBuffer"),wa=Ta("string"),Ra=Ta("function"),ka=Ta("number"),Da=t=>null!==t&&"object"==typeof t,Ia=t=>{if("object"!==Ea(t))return!1;const e=ya(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},Pa=ba("Date"),Oa=ba("File"),Ca=ba("Blob"),xa=ba("FileList"),Ma=ba("URLSearchParams");function Fa(t,e,{allOwnKeys:r=!1}={}){if(null==t)return;let n,i;if("object"!=typeof t&&(t=[t]),_a(t))for(n=0,i=t.length;n<i;n++)e.call(null,t[n],n,t);else{const i=r?Object.getOwnPropertyNames(t):Object.keys(t),s=i.length;let a;for(n=0;n<s;n++)a=i[n],e.call(null,t[a],a,t)}}function Na(t,e){e=e.toLowerCase();const r=Object.keys(t);let n,i=r.length;for(;i-- >0;)if(n=r[i],e===n.toLowerCase())return n;return null}const Ba="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ua=t=>!Aa(t)&&t!==Ba,ja=(Ha="undefined"!=typeof Uint8Array&&ya(Uint8Array),t=>Ha&&t instanceof Ha);var Ha;const Ga=ba("HTMLFormElement"),Va=(({hasOwnProperty:t})=>(e,r)=>t.call(e,r))(Object.prototype),Ka=ba("RegExp"),$a=(t,e)=>{const r=Object.getOwnPropertyDescriptors(t),n={};Fa(r,((r,i)=>{let s;!1!==(s=e(r,i,t))&&(n[i]=s||r)})),Object.defineProperties(t,n)},Wa="abcdefghijklmnopqrstuvwxyz",qa="0123456789",Ya={DIGIT:qa,ALPHA:Wa,ALPHA_DIGIT:Wa+Wa.toUpperCase()+qa},za=ba("AsyncFunction"),Xa={isArray:_a,isArrayBuffer:La,isBuffer:function(t){return null!==t&&!Aa(t)&&null!==t.constructor&&!Aa(t.constructor)&&Ra(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Ra(t.append)&&("formdata"===(e=Ea(t))||"object"===e&&Ra(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&La(t.buffer),e},isString:wa,isNumber:ka,isBoolean:t=>!0===t||!1===t,isObject:Da,isPlainObject:Ia,isUndefined:Aa,isDate:Pa,isFile:Oa,isBlob:Ca,isRegExp:Ka,isFunction:Ra,isStream:t=>Da(t)&&Ra(t.pipe),isURLSearchParams:Ma,isTypedArray:ja,isFileList:xa,forEach:Fa,merge:function t(){const{caseless:e}=Ua(this)&&this||{},r={},n=(n,i)=>{const s=e&&Na(r,i)||i;Ia(r[s])&&Ia(n)?r[s]=t(r[s],n):Ia(n)?r[s]=t({},n):_a(n)?r[s]=n.slice():r[s]=n};for(let t=0,e=arguments.length;t<e;t++)arguments[t]&&Fa(arguments[t],n);return r},extend:(t,e,r,{allOwnKeys:n}={})=>(Fa(e,((e,n)=>{r&&Ra(e)?t[n]=va(e,r):t[n]=e}),{allOwnKeys:n}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,r,n)=>{t.prototype=Object.create(e.prototype,n),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),r&&Object.assign(t.prototype,r)},toFlatObject:(t,e,r,n)=>{let i,s,a;const o={};if(e=e||{},null==t)return e;do{for(i=Object.getOwnPropertyNames(t),s=i.length;s-- >0;)a=i[s],n&&!n(a,t,e)||o[a]||(e[a]=t[a],o[a]=!0);t=!1!==r&&ya(t)}while(t&&(!r||r(t,e))&&t!==Object.prototype);return e},kindOf:Ea,kindOfTest:ba,endsWith:(t,e,r)=>{t=String(t),(void 0===r||r>t.length)&&(r=t.length),r-=e.length;const n=t.indexOf(e,r);return-1!==n&&n===r},toArray:t=>{if(!t)return null;if(_a(t))return t;let e=t.length;if(!ka(e))return null;const r=new Array(e);for(;e-- >0;)r[e]=t[e];return r},forEachEntry:(t,e)=>{const r=(t&&t[Symbol.iterator]).call(t);let n;for(;(n=r.next())&&!n.done;){const r=n.value;e.call(t,r[0],r[1])}},matchAll:(t,e)=>{let r;const n=[];for(;null!==(r=t.exec(e));)n.push(r);return n},isHTMLForm:Ga,hasOwnProperty:Va,hasOwnProp:Va,reduceDescriptors:$a,freezeMethods:t=>{$a(t,((e,r)=>{if(Ra(t)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=t[r];Ra(n)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(t,e)=>{const r={},n=t=>{t.forEach((t=>{r[t]=!0}))};return _a(t)?n(t):n(String(t).split(e)),r},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,r){return e.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Na,global:Ba,isContextDefined:Ua,ALPHABET:Ya,generateString:(t=16,e=Ya.ALPHA_DIGIT)=>{let r="";const{length:n}=e;for(;t--;)r+=e[Math.random()*n|0];return r},isSpecCompliantForm:function(t){return!!(t&&Ra(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),r=(t,n)=>{if(Da(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[n]=t;const i=_a(t)?[]:{};return Fa(t,((t,e)=>{const s=r(t,n+1);!Aa(s)&&(i[e]=s)})),e[n]=void 0,i}}return t};return r(t,0)},isAsyncFn:za,isThenable:t=>t&&(Da(t)||Ra(t))&&Ra(t.then)&&Ra(t.catch)};function Ja(t,e,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}Xa.inherits(Ja,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:Xa.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const Qa=Ja.prototype,Za={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{Za[t]={value:t}})),Object.defineProperties(Ja,Za),Object.defineProperty(Qa,"isAxiosError",{value:!0}),Ja.from=(t,e,r,n,i,s)=>{const a=Object.create(Qa);return Xa.toFlatObject(t,a,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),Ja.call(a,t.message,e,r,n,i),a.cause=t,a.name=t.name,s&&Object.assign(a,s),a};const to=Ja;function eo(t){return Xa.isPlainObject(t)||Xa.isArray(t)}function ro(t){return Xa.endsWith(t,"[]")?t.slice(0,-2):t}function no(t,e,r){return t?t.concat(e).map((function(t,e){return t=ro(t),!r&&e?"["+t+"]":t})).join(r?".":""):e}const io=Xa.toFlatObject(Xa,{},null,(function(t){return/^is[A-Z]/.test(t)})),so=function(t,e,r){if(!Xa.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const n=(r=Xa.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!Xa.isUndefined(e[t])}))).metaTokens,i=r.visitor||u,s=r.dots,a=r.indexes,o=(r.Blob||"undefined"!=typeof Blob&&Blob)&&Xa.isSpecCompliantForm(e);if(!Xa.isFunction(i))throw new TypeError("visitor must be a function");function l(t){if(null===t)return"";if(Xa.isDate(t))return t.toISOString();if(!o&&Xa.isBlob(t))throw new to("Blob is not supported. Use a Buffer instead.");return Xa.isArrayBuffer(t)||Xa.isTypedArray(t)?o&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function u(t,r,i){let o=t;if(t&&!i&&"object"==typeof t)if(Xa.endsWith(r,"{}"))r=n?r:r.slice(0,-2),t=JSON.stringify(t);else if(Xa.isArray(t)&&function(t){return Xa.isArray(t)&&!t.some(eo)}(t)||(Xa.isFileList(t)||Xa.endsWith(r,"[]"))&&(o=Xa.toArray(t)))return r=ro(r),o.forEach((function(t,n){!Xa.isUndefined(t)&&null!==t&&e.append(!0===a?no([r],n,s):null===a?r:r+"[]",l(t))})),!1;return!!eo(t)||(e.append(no(i,r,s),l(t)),!1)}const c=[],h=Object.assign(io,{defaultVisitor:u,convertValue:l,isVisitable:eo});if(!Xa.isObject(t))throw new TypeError("data must be an object");return function t(r,n){if(!Xa.isUndefined(r)){if(-1!==c.indexOf(r))throw Error("Circular reference detected in "+n.join("."));c.push(r),Xa.forEach(r,(function(r,s){!0===(!(Xa.isUndefined(r)||null===r)&&i.call(e,r,Xa.isString(s)?s.trim():s,n,h))&&t(r,n?n.concat(s):[s])})),c.pop()}}(t),e};function ao(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function oo(t,e){this._pairs=[],t&&so(t,this,e)}const lo=oo.prototype;lo.append=function(t,e){this._pairs.push([t,e])},lo.toString=function(t){const e=t?function(e){return t.call(this,e,ao)}:ao;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};const uo=oo;function co(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ho(t,e,r){if(!e)return t;const n=r&&r.encode||co,i=r&&r.serialize;let s;if(s=i?i(e,r):Xa.isURLSearchParams(e)?e.toString():new uo(e,r).toString(n),s){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+s}return t}const fo=class{constructor(){this.handlers=[]}use(t,e,r){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){Xa.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},po={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},go={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:uo,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},isStandardBrowserEnv:(()=>{let t;return("undefined"==typeof navigator||"ReactNative"!==(t=navigator.product)&&"NativeScript"!==t&&"NS"!==t)&&"undefined"!=typeof window&&"undefined"!=typeof document})(),isStandardBrowserWebWorkerEnv:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,protocols:["http","https","file","blob","url","data"]},vo=function(t){function e(t,r,n,i){let s=t[i++];const a=Number.isFinite(+s),o=i>=t.length;return s=!s&&Xa.isArray(n)?n.length:s,o?(Xa.hasOwnProp(n,s)?n[s]=[n[s],r]:n[s]=r,!a):(n[s]&&Xa.isObject(n[s])||(n[s]=[]),e(t,r,n[s],i)&&Xa.isArray(n[s])&&(n[s]=function(t){const e={},r=Object.keys(t);let n;const i=r.length;let s;for(n=0;n<i;n++)s=r[n],e[s]=t[s];return e}(n[s])),!a)}if(Xa.isFormData(t)&&Xa.isFunction(t.entries)){const r={};return Xa.forEachEntry(t,((t,n)=>{e(function(t){return Xa.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),n,r,0)})),r}return null},mo={transitional:po,adapter:go.isNode?"http":"xhr",transformRequest:[function(t,e){const r=e.getContentType()||"",n=r.indexOf("application/json")>-1,i=Xa.isObject(t);if(i&&Xa.isHTMLForm(t)&&(t=new FormData(t)),Xa.isFormData(t))return n&&n?JSON.stringify(vo(t)):t;if(Xa.isArrayBuffer(t)||Xa.isBuffer(t)||Xa.isStream(t)||Xa.isFile(t)||Xa.isBlob(t))return t;if(Xa.isArrayBufferView(t))return t.buffer;if(Xa.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let s;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return so(t,new go.classes.URLSearchParams,Object.assign({visitor:function(t,e,r,n){return go.isNode&&Xa.isBuffer(t)?(this.append(e,t.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((s=Xa.isFileList(t))||r.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return so(s?{"files[]":t}:t,e&&new e,this.formSerializer)}}return i||n?(e.setContentType("application/json",!1),function(t,e,r){if(Xa.isString(t))try{return(0,JSON.parse)(t),Xa.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||mo.transitional,r=e&&e.forcedJSONParsing,n="json"===this.responseType;if(t&&Xa.isString(t)&&(r&&!this.responseType||n)){const r=!(e&&e.silentJSONParsing)&&n;try{return JSON.parse(t)}catch(t){if(r){if("SyntaxError"===t.name)throw to.from(t,to.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:go.classes.FormData,Blob:go.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};Xa.forEach(["delete","get","head","post","put","patch"],(t=>{mo.headers[t]={}}));const yo=mo,Eo=Xa.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),So=Symbol("internals");function bo(t){return t&&String(t).trim().toLowerCase()}function To(t){return!1===t||null==t?t:Xa.isArray(t)?t.map(To):String(t)}function _o(t,e,r,n,i){return Xa.isFunction(n)?n.call(this,e,r):(i&&(e=r),Xa.isString(e)?Xa.isString(n)?-1!==e.indexOf(n):Xa.isRegExp(n)?n.test(e):void 0:void 0)}class Ao{constructor(t){t&&this.set(t)}set(t,e,r){const n=this;function i(t,e,r){const i=bo(e);if(!i)throw new Error("header name must be a non-empty string");const s=Xa.findKey(n,i);(!s||void 0===n[s]||!0===r||void 0===r&&!1!==n[s])&&(n[s||e]=To(t))}const s=(t,e)=>Xa.forEach(t,((t,r)=>i(t,r,e)));return Xa.isPlainObject(t)||t instanceof this.constructor?s(t,e):Xa.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?s((t=>{const e={};let r,n,i;return t&&t.split("\n").forEach((function(t){i=t.indexOf(":"),r=t.substring(0,i).trim().toLowerCase(),n=t.substring(i+1).trim(),!r||e[r]&&Eo[r]||("set-cookie"===r?e[r]?e[r].push(n):e[r]=[n]:e[r]=e[r]?e[r]+", "+n:n)})),e})(t),e):null!=t&&i(e,t,r),this}get(t,e){if(t=bo(t)){const r=Xa.findKey(this,t);if(r){const t=this[r];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(t);)e[n[1]]=n[2];return e}(t);if(Xa.isFunction(e))return e.call(this,t,r);if(Xa.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=bo(t)){const r=Xa.findKey(this,t);return!(!r||void 0===this[r]||e&&!_o(0,this[r],r,e))}return!1}delete(t,e){const r=this;let n=!1;function i(t){if(t=bo(t)){const i=Xa.findKey(r,t);!i||e&&!_o(0,r[i],i,e)||(delete r[i],n=!0)}}return Xa.isArray(t)?t.forEach(i):i(t),n}clear(t){const e=Object.keys(this);let r=e.length,n=!1;for(;r--;){const i=e[r];t&&!_o(0,this[i],i,t,!0)||(delete this[i],n=!0)}return n}normalize(t){const e=this,r={};return Xa.forEach(this,((n,i)=>{const s=Xa.findKey(r,i);if(s)return e[s]=To(n),void delete e[i];const a=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,r)=>e.toUpperCase()+r))}(i):String(i).trim();a!==i&&delete e[i],e[a]=To(n),r[a]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return Xa.forEach(this,((r,n)=>{null!=r&&!1!==r&&(e[n]=t&&Xa.isArray(r)?r.join(", "):r)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const r=new this(t);return e.forEach((t=>r.set(t))),r}static accessor(t){const e=(this[So]=this[So]={accessors:{}}).accessors,r=this.prototype;function n(t){const n=bo(t);e[n]||(function(t,e){const r=Xa.toCamelCase(" "+e);["get","set","has"].forEach((n=>{Object.defineProperty(t,n+r,{value:function(t,r,i){return this[n].call(this,e,t,r,i)},configurable:!0})}))}(r,t),e[n]=!0)}return Xa.isArray(t)?t.forEach(n):n(t),this}}Ao.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),Xa.reduceDescriptors(Ao.prototype,(({value:t},e)=>{let r=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[r]=t}}})),Xa.freezeMethods(Ao);const Lo=Ao;function wo(t,e){const r=this||yo,n=e||r,i=Lo.from(n.headers);let s=n.data;return Xa.forEach(t,(function(t){s=t.call(r,s,i.normalize(),e?e.status:void 0)})),i.normalize(),s}function Ro(t){return!(!t||!t.__CANCEL__)}function ko(t,e,r){to.call(this,null==t?"canceled":t,to.ERR_CANCELED,e,r),this.name="CanceledError"}Xa.inherits(ko,to,{__CANCEL__:!0});const Do=ko,Io=go.isStandardBrowserEnv?{write:function(t,e,r,n,i,s){const a=[];a.push(t+"="+encodeURIComponent(e)),Xa.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),Xa.isString(n)&&a.push("path="+n),Xa.isString(i)&&a.push("domain="+i),!0===s&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}};function Po(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}const Oo=go.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let r;function n(r){let n=r;return t&&(e.setAttribute("href",n),n=e.href),e.setAttribute("href",n),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return r=n(window.location.href),function(t){const e=Xa.isString(t)?n(t):t;return e.protocol===r.protocol&&e.host===r.host}}():function(){return!0};function Co(t,e){let r=0;const n=function(t,e){t=t||10;const r=new Array(t),n=new Array(t);let i,s=0,a=0;return e=void 0!==e?e:1e3,function(o){const l=Date.now(),u=n[a];i||(i=l),r[s]=o,n[s]=l;let c=a,h=0;for(;c!==s;)h+=r[c++],c%=t;if(s=(s+1)%t,s===a&&(a=(a+1)%t),l-i<e)return;const d=u&&l-u;return d?Math.round(1e3*h/d):void 0}}(50,250);return i=>{const s=i.loaded,a=i.lengthComputable?i.total:void 0,o=s-r,l=n(o);r=s;const u={loaded:s,total:a,progress:a?s/a:void 0,bytes:o,rate:l||void 0,estimated:l&&a&&s<=a?(a-s)/l:void 0,event:i};u[e?"download":"upload"]=!0,t(u)}}const xo={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,r){let n=t.data;const i=Lo.from(t.headers).normalize(),s=t.responseType;let a;function o(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}Xa.isFormData(n)&&(go.isStandardBrowserEnv||go.isStandardBrowserWebWorkerEnv?i.setContentType(!1):i.setContentType("multipart/form-data;",!1));let l=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",r=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";i.set("Authorization","Basic "+btoa(e+":"+r))}const u=Po(t.baseURL,t.url);function c(){if(!l)return;const n=Lo.from("getAllResponseHeaders"in l&&l.getAllResponseHeaders());!function(t,e,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?e(new to("Request failed with status code "+r.status,[to.ERR_BAD_REQUEST,to.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):t(r)}((function(t){e(t),o()}),(function(t){r(t),o()}),{data:s&&"text"!==s&&"json"!==s?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:n,config:t,request:l}),l=null}if(l.open(t.method.toUpperCase(),ho(u,t.params,t.paramsSerializer),!0),l.timeout=t.timeout,"onloadend"in l?l.onloadend=c:l.onreadystatechange=function(){l&&4===l.readyState&&(0!==l.status||l.responseURL&&0===l.responseURL.indexOf("file:"))&&setTimeout(c)},l.onabort=function(){l&&(r(new to("Request aborted",to.ECONNABORTED,t,l)),l=null)},l.onerror=function(){r(new to("Network Error",to.ERR_NETWORK,t,l)),l=null},l.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const n=t.transitional||po;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),r(new to(e,n.clarifyTimeoutError?to.ETIMEDOUT:to.ECONNABORTED,t,l)),l=null},go.isStandardBrowserEnv){const e=(t.withCredentials||Oo(u))&&t.xsrfCookieName&&Io.read(t.xsrfCookieName);e&&i.set(t.xsrfHeaderName,e)}void 0===n&&i.setContentType(null),"setRequestHeader"in l&&Xa.forEach(i.toJSON(),(function(t,e){l.setRequestHeader(e,t)})),Xa.isUndefined(t.withCredentials)||(l.withCredentials=!!t.withCredentials),s&&"json"!==s&&(l.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&l.addEventListener("progress",Co(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&l.upload&&l.upload.addEventListener("progress",Co(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=e=>{l&&(r(!e||e.type?new Do(null,t,l):e),l.abort(),l=null)},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));const h=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(u);h&&-1===go.protocols.indexOf(h)?r(new to("Unsupported protocol "+h+":",to.ERR_BAD_REQUEST,t)):l.send(n||null)}))}};Xa.forEach(xo,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const Mo=t=>{t=Xa.isArray(t)?t:[t];const{length:e}=t;let r,n;for(let i=0;i<e&&(r=t[i],!(n=Xa.isString(r)?xo[r.toLowerCase()]:r));i++);if(!n){if(!1===n)throw new to(`Adapter ${r} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Xa.hasOwnProp(xo,r)?`Adapter '${r}' is not available in the build`:`Unknown adapter '${r}'`)}if(!Xa.isFunction(n))throw new TypeError("adapter is not a function");return n};function Fo(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Do(null,t)}function No(t){return Fo(t),t.headers=Lo.from(t.headers),t.data=wo.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),Mo(t.adapter||yo.adapter)(t).then((function(e){return Fo(t),e.data=wo.call(t,t.transformResponse,e),e.headers=Lo.from(e.headers),e}),(function(e){return Ro(e)||(Fo(t),e&&e.response&&(e.response.data=wo.call(t,t.transformResponse,e.response),e.response.headers=Lo.from(e.response.headers))),Promise.reject(e)}))}const Bo=t=>t instanceof Lo?t.toJSON():t;function Uo(t,e){e=e||{};const r={};function n(t,e,r){return Xa.isPlainObject(t)&&Xa.isPlainObject(e)?Xa.merge.call({caseless:r},t,e):Xa.isPlainObject(e)?Xa.merge({},e):Xa.isArray(e)?e.slice():e}function i(t,e,r){return Xa.isUndefined(e)?Xa.isUndefined(t)?void 0:n(void 0,t,r):n(t,e,r)}function s(t,e){if(!Xa.isUndefined(e))return n(void 0,e)}function a(t,e){return Xa.isUndefined(e)?Xa.isUndefined(t)?void 0:n(void 0,t):n(void 0,e)}function o(r,i,s){return s in e?n(r,i):s in t?n(void 0,r):void 0}const l={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:o,headers:(t,e)=>i(Bo(t),Bo(e),!0)};return Xa.forEach(Object.keys(Object.assign({},t,e)),(function(n){const s=l[n]||i,a=s(t[n],e[n],n);Xa.isUndefined(a)&&s!==o||(r[n]=a)})),r}const jo={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{jo[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}}));const Ho={};jo.transitional=function(t,e,r){function n(t,e){return"[Axios v1.5.0] Transitional option '"+t+"'"+e+(r?". "+r:"")}return(r,i,s)=>{if(!1===t)throw new to(n(i," has been removed"+(e?" in "+e:"")),to.ERR_DEPRECATED);return e&&!Ho[i]&&(Ho[i]=!0,console.warn(n(i," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(r,i,s)}};const Go={assertOptions:function(t,e,r){if("object"!=typeof t)throw new to("options must be an object",to.ERR_BAD_OPTION_VALUE);const n=Object.keys(t);let i=n.length;for(;i-- >0;){const s=n[i],a=e[s];if(a){const e=t[s],r=void 0===e||a(e,s,t);if(!0!==r)throw new to("option "+s+" must be "+r,to.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new to("Unknown option "+s,to.ERR_BAD_OPTION)}},validators:jo},Vo=Go.validators;class Ko{constructor(t){this.defaults=t,this.interceptors={request:new fo,response:new fo}}request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Uo(this.defaults,e);const{transitional:r,paramsSerializer:n,headers:i}=e;void 0!==r&&Go.assertOptions(r,{silentJSONParsing:Vo.transitional(Vo.boolean),forcedJSONParsing:Vo.transitional(Vo.boolean),clarifyTimeoutError:Vo.transitional(Vo.boolean)},!1),null!=n&&(Xa.isFunction(n)?e.paramsSerializer={serialize:n}:Go.assertOptions(n,{encode:Vo.function,serialize:Vo.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let s=i&&Xa.merge(i.common,i[e.method]);i&&Xa.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete i[t]})),e.headers=Lo.concat(s,i);const a=[];let o=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(o=o&&t.synchronous,a.unshift(t.fulfilled,t.rejected))}));const l=[];let u;this.interceptors.response.forEach((function(t){l.push(t.fulfilled,t.rejected)}));let c,h=0;if(!o){const t=[No.bind(this),void 0];for(t.unshift.apply(t,a),t.push.apply(t,l),c=t.length,u=Promise.resolve(e);h<c;)u=u.then(t[h++],t[h++]);return u}c=a.length;let d=e;for(h=0;h<c;){const t=a[h++],e=a[h++];try{d=t(d)}catch(t){e.call(this,t);break}}try{u=No.call(this,d)}catch(t){return Promise.reject(t)}for(h=0,c=l.length;h<c;)u=u.then(l[h++],l[h++]);return u}getUri(t){return ho(Po((t=Uo(this.defaults,t)).baseURL,t.url),t.params,t.paramsSerializer)}}Xa.forEach(["delete","get","head","options"],(function(t){Ko.prototype[t]=function(e,r){return this.request(Uo(r||{},{method:t,url:e,data:(r||{}).data}))}})),Xa.forEach(["post","put","patch"],(function(t){function e(e){return function(r,n,i){return this.request(Uo(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Ko.prototype[t]=e(),Ko.prototype[t+"Form"]=e(!0)}));const $o=Ko;class Wo{constructor(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");let e;this.promise=new Promise((function(t){e=t}));const r=this;this.promise.then((t=>{if(!r._listeners)return;let e=r._listeners.length;for(;e-- >0;)r._listeners[e](t);r._listeners=null})),this.promise.then=t=>{let e;const n=new Promise((t=>{r.subscribe(t),e=t})).then(t);return n.cancel=function(){r.unsubscribe(e)},n},t((function(t,n,i){r.reason||(r.reason=new Do(t,n,i),e(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;return{token:new Wo((function(e){t=e})),cancel:t}}}const qo=Wo,Yo={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Yo).forEach((([t,e])=>{Yo[e]=t}));const zo=Yo,Xo=function t(e){const r=new $o(e),n=va($o.prototype.request,r);return Xa.extend(n,$o.prototype,r,{allOwnKeys:!0}),Xa.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return t(Uo(e,r))},n}(yo);Xo.Axios=$o,Xo.CanceledError=Do,Xo.CancelToken=qo,Xo.isCancel=Ro,Xo.VERSION="1.5.0",Xo.toFormData=so,Xo.AxiosError=to,Xo.Cancel=Xo.CanceledError,Xo.all=function(t){return Promise.all(t)},Xo.spread=function(t){return function(e){return t.apply(null,e)}},Xo.isAxiosError=function(t){return Xa.isObject(t)&&!0===t.isAxiosError},Xo.mergeConfig=Uo,Xo.AxiosHeaders=Lo,Xo.formToJSON=t=>vo(Xa.isHTMLForm(t)?new FormData(t):t),Xo.getAdapter=Mo,Xo.HttpStatusCode=zo,Xo.default=Xo;const Jo=Xo,Qo={SP_ERROR:"Sardius Player Error",SP_ERROR_VIDEO_ELEMENT:"An Error Ocurred on the Video Element",SP_ERROR_OTHER:"An Unknown Error was Fired",SP_ERROR_OTHER_FATAL:"A Fatal Error Occurred",SP_ERROR_OTHER_PROTOCOL_LIBRARY:"An internal exception was raised in the streaming protocol library.",SP_ERROR_NETWORK_FATAL:"A fatal network error occurred",SP_ERROR_NETWORK_LOAD_MANIFEST:"A network error occurred while loading the manifest.",SP_ERROR_NETWORK_LOAD_LEVEL:"A network error occurred while loading a quality level.",SP_ERROR_NETWORK_LOAD_AUDIOTRACK:"A network error occurred while loading an audio track.",SP_ERROR_NETWORK_LOAD_FRAGMENT:"A network error occurred while loading a fragment.",SP_ERROR_NETWORK_LOAD_KEY:"A network error occurred while loading a decryption key.",SP_ERROR_MEDIA_FATAL:"Fatal Media Error",SP_ERROR_MEDIA_LOAD_MANIFEST:"Media Error: The manifest load timed out.",SP_ERROR_MEDIA_PARSE_MANIFEST:"A network error occurred while parsing the manifest.",SP_ERROR_MEDIA_EMPTY_MANIFEST:"Manifest Empty",SP_ERROR_MEDIA_MSE_NOT_SUPPORTED:"Media Source Extension API is not supported",SP_ERROR_MEDIA_INCOMPATIBLE_CODEC:"A media error occurred from a codec that was incompatible with the MSE.",SP_ERROR_MEDIA_LOAD_KEY:"A media error occurred because the decryption key load timed out.",SP_ERROR_MEDIA_MEDIAKEYS_NOT_SUPPORTED:"A media error occurred because the mediaKeys API is not supported for key decryption.",SP_ERROR_MEDIA_ADD_BUFFER:"A media error occurred while attempting to add the source buffer.",SP_ERROR_MEDIA_APPEND_BUFFER:"A media error occurred from a failed append to the buffer.",SP_ERROR_MEDIA_FULL_BUFFER:"A media error occurred due to the buffer being full.",SP_ERROR_MEDIA_LOW_BUFFER:"A media error occurred due to low data in the buffer.",SP_ERROR_MEDIA_HOLE_BUFFER:"A media error occurred from a hole in the buffer.",SP_ERROR_MEDIA_STALL_BUFFER:"A media error occurred from a playback stall within the buffer.",SP_ERROR_MEDIA_LOAD_LEVEL:"A media error occurred because the level load timed out.",SP_ERROR_MEDIA_SWITCH_LEVEL:"A media error occurred during a quality level switch.",SP_ERROR_MEDIA_LOAD_AUDIO_TRACK:"A media error occurred because the audio track load timed out.",SP_ERROR_MEDIA_LOAD_FRAGMENT:"A media error occurred because the fragment load timed out.",SP_ERROR_MEDIA_DECRYPT_FRAGMENT:"A media error occurred from a failed fragment decryption.",SP_ERROR_MEDIA_PARSE_FRAGMENT:"A media error occurred from a failed fragment parsing.",SP_ERROR_MEDIA_STALL:"Playback has stalled",SP_ERROR_MEDIA_UPDATE_FRAGMENT_LIST:"A media error occurred while trying to update the fragment list",SP_ERROR_MEDIA_PARSE_TEXT_TRACK:"A media error occurred while parsing a text track",SP_ERROR_MEDIA_LOAD_XLINK:"A media error occurred during x-link loading",SP_ERROR_MUX_FATAL:"A fatal muxing error occurred",SP_ERROR_MUX_ALLOCATION_MEMORY:"An error occurred due to memory allocation failure while re-muxing the media."};function Zo(t){return Zo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(t)}function tl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rl(n.key),n)}}function el(t,e,r){return(e=rl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rl(t){var e=function(t,e){if("object"!==Zo(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Zo(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Zo(e)?e:String(e)}const nl=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),el(this,"plugin",void 0),el(this,"errors",void 0),this.plugin=e,this.errors=Qo}var e,r;return e=t,(r=[{key:"videoElementErrorHandler",value:function(t){this.triggerError("SP_ERROR_VIDEO_ELEMENT",t,"libs/StreamHandler/SardiusErrors -> videoElementErrorHandler");var e="Unknown Error";if(t.currentTarget&&t.currentTarget.error){var r=t.currentTarget.error;switch(r.code){case r.MEDIA_ERR_ABORTED:e="You aborted the video playback";break;case r.MEDIA_ERR_DECODE:e="The video playback was aborted due to a corruption problem or because the video used features your browser did not support";break;case r.MEDIA_ERR_NETWORK:e="A network error caused the video download to fail part-way";break;case r.MEDIA_ERR_SRC_NOT_SUPPORTED:e="The video could not be loaded, either because the server or network failed or because the format is not supported"}console.error(e,r)}}},{key:"triggerError",value:function(t,e,r){this.errors[t]?(this.plugin.player.trigger(t,e,r),this.plugin.player.trigger("SP_ERROR_TRACKER_CONTEXT_MENU",e,r),console.warn("[".concat(t,"] ").concat(this.errors[t]),e)):console.warn("SP_ERROR_INVALID_ERRORCODE: An Invalid Error was fired: ".concat(t),e)}}])&&tl(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();var il=r(7631);function sl(t){return sl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sl(t)}function al(){al=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==sl(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function ol(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ll(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,fl(n.key),n)}}function ul(t,e){return ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ul(t,e)}function cl(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function hl(t){return hl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},hl(t)}function dl(t,e,r){return(e=fl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function fl(t){var e=function(t,e){if("object"!==sl(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==sl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===sl(e)?e:String(e)}function pl(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function gl(){var t;return t=al().mark((function t(e,r){var n,i,s,a,o,l;return al().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n="",!(e&&e.options.asset&&"string"!=typeof e.options.asset&&e.options.asset.assets&&Array.isArray(e.options.asset.assets.video)&&e.options.asset.assets.video[0])){t.next=12;break}if(u=e.options.asset.assets.video,c=1,i=function(t){if(Array.isArray(t))return t}(u)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(u,c)||function(t,e){if(t){if("string"==typeof t)return ol(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)?ol(t,e):void 0}}(u,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),s=i[0],a=s.url,!(n=Array.isArray(a)?a[0]:a||"")){t.next=10;break}return t.next=8,Jo.get(n);case 8:(o=t.sent)&&o.request&&o.request.responseURL&&o.request.responseURL!==n&&e.options.asset&&"string"!=typeof e.options.asset&&e.options.asset.assets.video&&(e.options.asset.assets.video[0].url=o.request.responseURL,null===(l=r.refresh)||void 0===l||l.call(r,!1,void 0,!1));case 10:t.next=13;break;case 12:throw new Error;case 13:case"end":return t.stop()}var u,c}),t)})),gl=function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){pl(s,n,i,a,o,"next",t)}function o(t){pl(s,n,i,a,o,"throw",t)}a(void 0)}))},gl.apply(this,arguments)}var vl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ul(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=hl(n);if(i){var r=hl(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===sl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return cl(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),dl(cl(r=s.call(this,t)),"player",void 0),dl(cl(r),"sardiusHLS",void 0),dl(cl(r),"fatalError",void 0),r.player=t.player,r.sardiusHLS=e,r.fatalError=0,r.sardiusHLS._video.addEventListener("error",(function(t){r.videoElementErrorHandler(t),r.recoverFatalError()})),r.sardiusHLS.hls&&r.sardiusHLS.hls.on(il.Events.ERROR,(function(e,n){(function(t,e){return gl.apply(this,arguments)})(t,r.player).catch((function(){r.handleError(e,n)}))})),r}return e=a,(r=[{key:"recoverFatalError",value:function(){var t,e;0===this.fatalError&&(this.fatalError=Date.now()),this.fatalError>0&&Date.now()-this.fatalError<3e3&&this.sardiusHLS.hls?(this.sardiusHLS.hls.swapAudioCodec(),this.sardiusHLS.hls.recoverMediaError()):null===(t=(e=this.player).refresh)||void 0===t||t.call(e,!1)}},{key:"handleError",value:function(t,e){if(e.fatal)switch(e.type){case il.ErrorTypes.NETWORK_ERROR:this.triggerError("SP_ERROR_NETWORK_FATAL",e,"libs/StreamHandler/SardiusHLS -> handleError"),0===this.fatalError&&this.sardiusHLS.hls?this.sardiusHLS.hls.startLoad():this.recoverFatalError();break;case il.ErrorTypes.MEDIA_ERROR:this.triggerError("SP_ERROR_MEDIA_FATAL",e,"libs/StreamHandler/SardiusHLS -> handleError"),0===this.fatalError&&this.sardiusHLS.hls?this.sardiusHLS.hls.recoverMediaError():this.recoverFatalError();break;default:this.triggerError("SP_ERROR_OTHER_FATAL",e,"libs/StreamHandler/SardiusHLS -> handleError"),this.recoverFatalError()}switch(e.details){case il.ErrorDetails.MANIFEST_LOAD_ERROR:this.triggerError("SP_ERROR_NETWORK_LOAD_MANIFEST",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.LEVEL_LOAD_ERROR:this.triggerError("SP_ERROR_NETWORK_LOAD_LEVEL",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:this.triggerError("SP_ERROR_NETWORK_LOAD_AUDIOTRACK",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.FRAG_LOAD_ERROR:this.triggerError("SP_ERROR_NETWORK_LOAD_FRAGMENT",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.KEY_LOAD_ERROR:this.triggerError("SP_ERROR_NETWORK_LOAD_KEY",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.MANIFEST_LOAD_TIMEOUT:this.triggerError("SP_ERROR_MEDIA_LOAD_MANIFEST",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.triggerError("SP_ERROR_MEDIA_LOAD_LEVEL",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.triggerError("SP_ERROR_MEDIA_LOAD_AUDIO_TRACK",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.FRAG_LOAD_TIMEOUT:this.triggerError("SP_ERROR_MEDIA_LOAD_FRAGMENT",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.KEY_LOAD_TIMEOUT:this.triggerError("SP_ERROR_MEDIA_LOAD_KEY",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR:this.triggerError("SP_ERROR_MEDIA_INCOMPATIBLE_CODEC",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.MANIFEST_PARSING_ERROR:this.triggerError("SP_ERROR_MEDIA_PARSE_MANIFEST",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.FRAG_DECRYPT_ERROR:this.triggerError("SP_ERROR_MEDIA_DECRYPT_FRAGMENT",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.FRAG_PARSING_ERROR:this.triggerError("SP_ERROR_MEDIA_PARSE_FRAGMENT",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.LEVEL_SWITCH_ERROR:this.triggerError("SP_ERROR_MEDIA_SWITCH_LEVEL",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.BUFFER_ADD_CODEC_ERROR:this.triggerError("SP_ERROR_MEDIA_ADD_BUFFER",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.BUFFER_APPEND_ERROR:case il.ErrorDetails.BUFFER_APPENDING_ERROR:this.triggerError("SP_ERROR_MEDIA_APPEND_BUFFER",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.BUFFER_FULL_ERROR:this.triggerError("SP_ERROR_MEDIA_FULL_BUFFER",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.BUFFER_STALLED_ERROR:this.triggerError("SP_ERROR_MEDIA_LOW_BUFFER",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.BUFFER_SEEK_OVER_HOLE:this.triggerError("SP_ERROR_MEDIA_HOLE_BUFFER",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.BUFFER_NUDGE_ON_STALL:this.triggerError("SP_ERROR_MEDIA_STALL_BUFFER",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.REMUX_ALLOC_ERROR:this.triggerError("SP_ERROR_MUX_ALLOCATION_MEMORY",e,"libs/StreamHandler/SardiusHLS -> handleError");break;case il.ErrorDetails.INTERNAL_EXCEPTION:this.triggerError("SP_ERROR_OTHER_PROTOCOL_LIBRARY",e,"libs/StreamHandler/SardiusHLS -> handleError");break;default:this.triggerError("SP_ERROR",e,"libs/StreamHandler/SardiusHLS -> handleError")}}}])&&ll(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(nl);const ml={SP_LIB_READY:"Protocol Library Successfully Initialized",SP_LIB_DESTROY:"Protocol Library Destroying",SP_MEDIA_BEFORE_ATTACH:"Media Attaching to MSE",SP_MEDIA_AFTER_ATTACH:"Media Successfully Attached to MSE",SP_MEDIA_BEFORE_DETACH:"Media Detaching from MSE",SP_MEDIA_AFTER_DETACH:"Media Successfully Detached from MSE",SP_MEDIA_READY:"Media Ready to be Played",SP_MEDIA_FRAME_DROP:"Increased Amount of Dropped Frames Detected",SP_MEDIA_FRAME_DROP_LEVEL_CAP:"ABR Capped Due to Increase Amount of Dropped Frames",SP_MEDIA_START_DECRYPT_KEY:"Decrypt Key Loading",SP_MEDIA_AFTER_DECRYPT_KEY:"Decrypt Key Successfully Loaded",SP_MEDIA_END:"Playback has ended",SP_MEDIA_LOADED_METADATA:"Metadata Loaded",SP_MEDIA_BLOCKED_PLAYBACK:"Playback Not Allowed",SP_MEDIA_PAUSED:"Playback has Paused",SP_MEDIA_PLAY:"Playback has Begun",SP_MEDIA_RESUMED:"Playback has Resumed",SP_MEDIA_PROGRESS:"Playback Progressed",SP_MEDIA_UPDATED_TIME:"Current Time Updated",SP_MEDIA_WAITING:"Waiting for Data Load",SP_MEDIA_RATE_CHANGE:"Playback Rate Change",SP_MEDIA_START_SCRUB:"Scrubbing has Started",SP_MEDIA_DURING_SCRUB:"Scrubbing in Progress",SP_MEDIA_AFTER_SCRUB:"Scrubbing Complete",SP_METRIC_NEW_ADDED:"A New Metric Has been Added",SP_METRIC_CHANGE:"A Metric's state has been changed",SP_METRIC_UPDATED:"A Metric has been updated",SP_METRIC_LIST_CHANGE:"The Overall Metrics have Changed",SP_BUFFER_FOUND_CODEC:"Source Buffer Codec Found",SP_BUFFER_AFTER_ADD:"Source Buffer Successfully Added",SP_BUFFER_STATE_TRANSITION:"Buffer Event: State Change",SP_BUFFER_STATE_READY:"Buffer Event: State Change to Ready",SP_BUFFER_BEFORE_RESET:"Source Buffer Resetting",SP_BUFFER_START_APPEND:"Fragment Appending to Source Buffer",SP_BUFFER_AFTER_APPEND:"Fragment Successfully Appended to Source Buffer",SP_BUFFER_END_STREAM:"All Stream Data is Added to Source Buffer",SP_BUFFER_START_FLUSH:"Source Buffer Flushing",SP_BUFFER_AFTER_FLUSH:"Source Buffer Flushed",SP_MANIFEST_START_LOAD:"Manifest Loading",SP_MANIFEST_AFTER_LOAD:"Manifest Successfully Loaded",SP_MANIFEST_AFTER_PARSE:"Manifest Successfully Parsed",SP_MANIFEST_FUTURE:"Manifest is Valid in Future",SP_MANIFEST_EXPIRED:"Manifest validity time expired",SP_MANIFEST_PERIOD_READY:"Manifest period is ready for playback",SP_MANIFEST_PERIOD_START_SWITCH:"A Manifest Period Switch has Started",SP_MANIFEST_PERIOD_AFTER_SWITCH:"Manifest Period Successfully Switched",SP_LEVEL_START_LOAD:"Video Quality Level Loading",SP_LEVEL_AFTER_LOAD:"Video Quality Level Successfully Loaded",SP_LEVEL_UPDATED_DETAILS:"Video Quality Level Details Updated",SP_LEVEL_UPDATED_PTS:"Video Quality Level PTS Updated",SP_LEVEL_START_SWITCH:"Video Quality Level Switching",SP_LEVEL_AFTER_SWITCH:"Video Quality Level Successfully Switched",SP_FRAGMENT_START_LOAD:"Video Fragment Loading has Started",SP_FRAGMENT_DURING_LOAD:"Video Fragment is Loading",SP_FRAGMENT_AFTER_LOAD:"Video Fragment Successfully Loaded",SP_FRAGMENT_ABORT_LOAD:"Video Fragment Load Aborted due to ABR Switch",SP_FRAGMENT_AFTER_DECRYPT:"Video Fragment Successfully Decrypted",SP_FRAGMENT_FOUND_PTS_INIT:"Initial Video Fragment PTS Found",SP_FRAGMENT_AFTER_PARSE_INIT:"Initial Video Fragment Successfully Parsed",SP_FRAGMENT_AFTER_PARSE:"Video Fragment Successfully Parsed",SP_FRAGMENT_AFTER_PARSE_DATA:"Video Fragment Data and Metadata Successfully Parsed",SP_FRAGMENT_AFTER_PARSE_METADATA:"Video Fragment id3 Data Successfully Parsed",SP_FRAGMENT_AFTER_PARSE_USERDATA:"Video Fragment SEI Text Data Successfully Parsed",SP_FRAGMENT_AFTER_APPEND_BUFFER:"Video Fragment Successfully Appended to Buffer",SP_FRAGMENT_AFTER_CHANGE:"Video Fragment Switched",SP_AUDIO_TRACK_START_LOAD:"Audio Track Loading",SP_AUDIO_TRACK_AFTER_LOAD:"Audio Track Successfully Loaded",SP_AUDIO_TRACK_UPDATED_LIST:"Audio Track List Updated",SP_AUDIO_TRACK_START_SWITCH:"Audio Track Switching",SP_AUDIO_TRACK_AFTER_SWITCH:"Audio Track Successfully Switched",SP_SUB_TRACK_START_LOAD:"Subtitle Track Loading",SP_SUB_TRACK_AFTER_LOAD:"Subtitle Track Successfully Loaded",SP_TEXT_TRACK_FRAGMENT_START_LOAD:"Text Track Fragment Successfully Loaded",SP_SUB_TRACK_FRAGMENT_AFTER_LOAD:"Subtitle Track Fragment Successfully Loaded",SP_TEXT_TRACK_FRAGMENT_RENDERED:"Text Tack Fragment Successfully Rendered",SP_SUB_TRACK_UPDATED_LIST:"Subtitle Track List Updated",SP_SUB_TRACK_START_SWITCH:"Subtitle Track Switching",SP_SUB_TRACK_AFTER_SWITCH:"Subtitle Track Successfully Switched",SP_TEXT_TRACK_CONTAINER_RESIZE:"Text Track Container Resized"};function yl(t){return yl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yl(t)}function El(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bl(n.key),n)}}function Sl(t,e,r){return(e=bl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bl(t){var e=function(t,e){if("object"!==yl(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==yl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===yl(e)?e:String(e)}function Tl(t){return Tl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Tl(t)}function _l(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,kl(n.key),n)}}function Al(t,e){return Al=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Al(t,e)}function Ll(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wl(t){return wl=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},wl(t)}function Rl(t,e,r){return(e=kl(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function kl(t){var e=function(t,e){if("object"!==Tl(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Tl(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Tl(e)?e:String(e)}var Dl=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Al(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=wl(n);if(i){var r=wl(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Tl(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Ll(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),Rl(Ll(r=s.call(this,t)),"sardiusHLS",void 0),Rl(Ll(r),"_duration",void 0),Rl(Ll(r),"playerSettingsHasNudgeOffset",void 0),r.sardiusHLS=e,r.registerEvents(),r.triggerEvent("SP_LIB_READY","libs/StreamHandler/SardiusHLS -> constructor, HLS Event"),r}return e=a,(r=[{key:"registerEvents",value:function(){var t=this;this.sardiusHLS.hls&&(this.sardiusHLS.hls.on(il.Events.MEDIA_ATTACHING,(function(e,r){t.triggerEvent("SP_MEDIA_BEFORE_ATTACH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.MEDIA_ATTACHED,(function(e,r){t.triggerEvent("SP_MEDIA_AFTER_ATTACH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.MEDIA_DETACHING,(function(){t.triggerEvent("SP_MEDIA_BEFORE_DETACH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event")})),this.sardiusHLS.hls.on(il.Events.MEDIA_DETACHED,(function(){t.triggerEvent("SP_MEDIA_AFTER_DETACH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event")})),this.sardiusHLS.hls.on(il.Events.FPS_DROP,(function(e,r){t.triggerEvent("SP_MEDIA_FRAME_DROP","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FPS_DROP_LEVEL_CAPPING,(function(e,r){t.triggerEvent("SP_MEDIA_FRAME_DROP_LEVEL_CAP","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.KEY_LOADING,(function(e,r){t.triggerEvent("SP_MEDIA_START_DECRYPT_KEY","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.KEY_LOADED,(function(e,r){t.triggerEvent("SP_MEDIA_AFTER_DECRYPT_KEY","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.MANIFEST_LOADING,(function(e,r){t.triggerEvent("SP_MANIFEST_START_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.MANIFEST_LOADED,(function(e,r){t.triggerEvent("SP_MANIFEST_AFTER_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.MANIFEST_PARSED,(function(e,r){t.triggerEvent("SP_MANIFEST_AFTER_PARSE","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.LEVEL_SWITCHING,(function(e,r){t.triggerEvent("SP_LEVEL_START_SWITCH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.LEVEL_SWITCHED,(function(e,r){t.triggerEvent("SP_LEVEL_AFTER_SWITCH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.LEVEL_LOADING,(function(e,r){t.triggerEvent("SP_LEVEL_START_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.LEVEL_LOADED,(function(e,r){t.triggerEvent("SP_LEVEL_AFTER_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r),!t.playerSettingsHasNudgeOffset&&t.sardiusHLS.hls&&(t.sardiusHLS.hls.config.nudgeOffset=r.details.targetduration/2),t._duration=r.details.live?1/0:r.details.totalduration})),this.sardiusHLS.hls.on(il.Events.LEVEL_UPDATED,(function(e,r){t.triggerEvent("SP_LEVEL_UPDATED_DETAILS","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",{level:r.level,live:r.details.live})})),this.sardiusHLS.hls.on(il.Events.LEVEL_PTS_UPDATED,(function(e,r){t.triggerEvent("SP_LEVEL_UPDATED_PTS","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.AUDIO_TRACKS_UPDATED,(function(e,r){t.triggerEvent("SP_AUDIO_TRACK_UPDATED_LIST","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.AUDIO_TRACK_SWITCHING,(function(e,r){t.triggerEvent("SP_AUDIO_TRACK_START_SWITCH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.AUDIO_TRACK_SWITCHED,(function(e,r){t.triggerEvent("SP_AUDIO_TRACK_AFTER_SWITCH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.AUDIO_TRACK_LOADING,(function(e,r){t.triggerEvent("SP_AUDIO_TRACK_START_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.AUDIO_TRACK_LOADED,(function(e,r){t.triggerEvent("SP_AUDIO_TRACK_AFTER_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.SUBTITLE_TRACKS_UPDATED,(function(e,r){t.triggerEvent("SP_SUB_TRACK_UPDATED_LIST","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.SUBTITLE_TRACK_SWITCH,(function(e,r){t.triggerEvent("SP_SUB_TRACK_START_SWITCH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.SUBTITLE_TRACK_LOADING,(function(e,r){t.triggerEvent("SP_SUB_TRACK_START_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.SUBTITLE_TRACK_LOADED,(function(e,r){t.triggerEvent("SP_SUB_TRACK_AFTER_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.SUBTITLE_FRAG_PROCESSED,(function(e,r){t.triggerEvent("SP_SUB_TRACK_FRAGMENT_AFTER_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.INIT_PTS_FOUND,(function(e,r){t.triggerEvent("SP_FRAGMENT_FOUND_PTS_INIT","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_LOADING,(function(e,r){t.triggerEvent("SP_FRAGMENT_START_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_LOAD_EMERGENCY_ABORTED,(function(e,r){t.triggerEvent("SP_FRAGMENT_ABORT_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_LOADED,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_LOAD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_DECRYPTED,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_DECRYPT","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_PARSING_INIT_SEGMENT,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_PARSE_INIT","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_PARSING_USERDATA,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_PARSE_USERDATA","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_PARSING_METADATA,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_PARSE_METADATA","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_PARSED,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_PARSE","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_BUFFERED,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_APPEND_BUFFER","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.FRAG_CHANGED,(function(e,r){t.triggerEvent("SP_FRAGMENT_AFTER_CHANGE","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_RESET,(function(){t.triggerEvent("SP_BUFFER_BEFORE_RESET","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event")})),this.sardiusHLS.hls.on(il.Events.BUFFER_CODECS,(function(e,r){t.triggerEvent("SP_BUFFER_FOUND_CODEC","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_CREATED,(function(e,r){t.triggerEvent("SP_BUFFER_AFTER_ADD","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_APPENDING,(function(e,r){t.triggerEvent("SP_BUFFER_START_APPEND","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_APPENDED,(function(e,r){t.triggerEvent("SP_BUFFER_AFTER_APPEND","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_EOS,(function(e,r){t.triggerEvent("SP_BUFFER_END_STREAM","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_FLUSHING,(function(e,r){t.triggerEvent("SP_BUFFER_START_FLUSH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.BUFFER_FLUSHED,(function(e,r){t.triggerEvent("SP_BUFFER_AFTER_FLUSH","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event",r)})),this.sardiusHLS.hls.on(il.Events.DESTROYING,(function(){t.triggerEvent("SP_LIB_DESTROY","libs/StreamHandler/SardiusHLS -> registerEvents, HLS Event")})))}}])&&_l(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Sl(this,"plugin",void 0),Sl(this,"events",void 0),this.plugin=e,this.events=ml}var e,r;return e=t,(r=[{key:"triggerEvent",value:function(t,e,r){this.events[t]?this.plugin.player.trigger(t,r,e):console.warn("SP_ERROR_INVALID_EVENTCODE: An Invalid Event was fired: ".concat(t),r)}}])&&El(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}());function Il(t){return Il="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Il(t)}function Pl(){Pl=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==Il(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function Ol(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||Cl(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Cl(t,e){if(t){if("string"==typeof t)return xl(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)?xl(t,e):void 0}}function xl(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ml(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}var Fl=3e7,Nl=2e6,Bl=30,Ul=60;function jl(t){return Hl.apply(this,arguments)}function Hl(){var t;return t=Pl().mark((function t(e){var r,n,i,s,a,o,l,u,c,h,d,f=arguments;return Pl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=f.length>1&&void 0!==f[1]?f[1]:0,i=(p=(n=e).streamController.levels,function(t){if(Array.isArray(t))return xl(t)}(p)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(p)||Cl(p)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).sort((function(t,e){return e.bitrate-t.bitrate})),s=Ol(i,1),!(a=s[0]).details){t.next=24;break}if(o=a.details.fragments,l=Ol(o,1),u=l[0],c=u.url,h=0,t.prev=9,!c){t.next=14;break}return t.next=13,Jo.head(c).then((function(t){return Number(t.headers["content-length"])}));case 13:h=t.sent;case 14:t.next=18;break;case 16:t.prev=16,t.t0=t.catch(9);case 18:(d=Bl*h)>Fl&&(d=Fl),d>Nl&&d!==n.config.maxBufferSize&&(n.config.maxBufferSize=d),n.config.maxBufferLength=Ul,t.next=27;break;case 24:n.config.maxBufferSize=Fl,n.config.maxBufferLength=Ul,r<5&&(r+=1,n.once("hlsLevelLoaded",(function(){jl(n,r)})));case 27:case"end":return t.stop()}var p}),t,null,[[9,16]])})),Hl=function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){Ml(s,n,i,a,o,"next",t)}function o(t){Ml(s,n,i,a,o,"throw",t)}a(void 0)}))},Hl.apply(this,arguments)}const Gl=jl;function Vl(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const Kl=function(){var t,e=navigator.userAgent,r=e.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[];if(/trident/i.test(r[1]))return{name:"IE",version:(t=/\brv[ :]+(\d+)/g.exec(e)||[])[1]||""};if("Chrome"===r[1]&&null!=(t=e.match(/\bOPR|Edge\/(\d+)/)))return{name:"Opera",version:t[1]};r=r[2]?[r[1],r[2]]:[navigator.appName,navigator.appVersion,"-?"],null!=(t=e.match(/version\/(\d+)/i))&&r.splice(1,1,t[1]);var n,i,s=(i=2,function(t){if(Array.isArray(t))return t}(n=r)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(n,i)||function(t,e){if(t){if("string"==typeof t)return Vl(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)?Vl(t,e):void 0}}(n,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=s[0],o=s[1];return{name:a,version:parseInt(o,10)}},$l=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:navigator,r=t||e.userAgent,n={type:null,ver:null};return-1!==r.indexOf("Windows NT 10.0")&&(n={type:"windows",ver:10}),-1!==r.indexOf("Windows NT 6.3")&&(n={type:"windows",ver:8.1}),-1!==r.indexOf("Windows NT 6.2")&&(n={type:"windows",ver:8}),-1!==r.indexOf("Windows NT 6.1")&&(n={type:"windows",ver:7}),-1!==r.indexOf("Windows NT 6.0")&&(n={type:"windows",ver:6}),-1!==r.indexOf("Windows NT 5.1")&&(n={type:"windows",ver:5}),-1!==r.indexOf("Windows NT 5.0")&&(n={type:"windows",ver:4}),n},Wl=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:navigator,e=-1;if("Microsoft Internet Explorer"===t.appName){var r=t.userAgent;null!=new RegExp("MSIE ([0-9]{1,}[0-9]{0,})").exec(r)&&(e=parseFloat(RegExp.$1))}else if("Netscape"===t.appName){var n=t.userAgent;null!=new RegExp("Trident/.*rv:([0-9]{1,}[0-9]{0,})").exec(n)&&(e=parseFloat(RegExp.$1))}return e};function ql(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Yl(t){var e,r,n=t.match("iPhone OS .._?.?");if(n&&n[0]){var i=n[0].trim().split(" ").pop();if(i){var s=(e=i.split("_").map((function(t){return Number(t)})),r=2,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(e,r)||function(t,e){if(t){if("string"==typeof t)return ql(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)?ql(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),a=s[0],o=s[1];if(a<17)return!1;if(17===a&&(0===o||void 0===o))return!1;if(17===a&&o>0)return!0;if(a>17)return!0}}return!1}const zl=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:navigator,e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")||t.userAgent,r=-1!==e.indexOf("Safari")&&-1===e.indexOf("Chrome"),n=e.indexOf("Edge")>-1,i=e.indexOf(" electron/")>-1,s=(-1!==e.indexOf("iPhone")||-1!==e.indexOf("iPod"))&&!Yl(e),a=Yl(e),o=r&&(-1!==e.indexOf("iPad")||-1!==e.indexOf("Macintosh")&&("ontouchend"in document||navigator.maxTouchPoints>2)),l=s,u=-1!==e.indexOf("cordova"),c=l||n,h=l||o||s||r;return{browser:Kl(),isChrome:e.indexOf("Chrome")>-1,isEdge:n,isExplorer:e.indexOf("MSIE")>-1||null!==e.match(/Trident.*rv:[0-9]*\./),isFirefox:e.indexOf("Firefox")>-1,isSafari:r,isIphone:s,isNewIphone:a,isAppleDevice:h,isIpad:o,isIOS:l,isOpera:-1!==e.indexOf("Opera"),nativeHLS:c,isElectron:i,isCordova:u,isNative:i||u,getInternetExplorerVersion:Wl,os:$l(e),userAgent:e}}();function Xl(){Xl=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==Jl(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function Jl(t){return Jl="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jl(t)}function Ql(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function Zl(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function tu(t){var e,r,n=t;return Array.isArray(n)&&(n=(e=n,r=1,function(t){if(Array.isArray(t))return t}(e)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(e,r)||function(t,e){if(t){if("string"==typeof t)return Zl(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)?Zl(t,e):void 0}}(e,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0]),n||""}function eu(t){return t.indexOf("cloudflarestream.com")>-1||t.indexOf("videodelivery.net")>-1}function ru(){var t;return t=Xl().mark((function t(e,r){var n,i,s,a,o,l,u,c,h,d;return Xl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(i=tu(e)){t.next=6;break}if("object"===Jl(s=r.asset)&&(a=s.assets,o=a.audio,l=a.video,u=a.stream,c=(null==u?void 0:u[0])||(null==l?void 0:l[0])||(null==o?void 0:o[0]),i=tu(null==c?void 0:c.url)),i){t.next=6;break}return t.abrupt("return","unknown");case 6:if(h="",!(0===i.indexOf("https://watch")&&i.indexOf("sardius")>-1)){t.next=12;break}return t.next=10,Jo.get(i);case 10:(d=t.sent).request&&(d.request.responseURL&&(i=d.request.responseURL),h=d.request.response);case 12:if(!(eu(i)||h&&eu(h))){t.next=14;break}return t.abrupt("return","sardiusStream");case 14:if("simlive"!==(null===(n=r.plugins.sardius.asset)||void 0===n?void 0:n.assetType)){t.next=16;break}return t.abrupt("return","simlive");case 16:if(!(i.indexOf("ep.storage.")>-1)){t.next=20;break}if(!(i.indexOf("start=")>-1)){t.next=19;break}return t.abrupt("return","simlive");case 19:return t.abrupt("return","entrypoint");case 20:if(!(i.indexOf("storage.sardius.media")>-1||i.indexOf("storage.alpha.sardius.media")>-1)){t.next=22;break}return t.abrupt("return","sardiusStorage");case 22:return t.abrupt("return","unknown");case 23:case"end":return t.stop()}}),t)})),ru=function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){Ql(s,n,i,a,o,"next",t)}function o(t){Ql(s,n,i,a,o,"throw",t)}a(void 0)}))},ru.apply(this,arguments)}function nu(t){return nu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nu(t)}function iu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,au(n.key),n)}}function su(t,e,r){return(e=au(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function au(t){var e=function(t,e){if("object"!==nu(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==nu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===nu(e)?e:String(e)}var ou=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),su(this,"hls",void 0),su(this,"plugin",void 0),su(this,"source",void 0),su(this,"tech",void 0),su(this,"playerManager",void 0),su(this,"errors",void 0),su(this,"events",void 0),su(this,"playerSettingsHasNudgeOffset",void 0),su(this,"_video",void 0),su(this,"on",void 0),su(this,"lib",void 0),su(this,"setToId",void 0),su(this,"overrideHasRun",void 0),su(this,"targetSkipTime",void 0),su(this,"stuckTime",void 0),su(this,"alreadyListenWaiting",void 0),this.plugin=e,this._video=this.plugin.videoEl,this.overrideHasRun=!1,this.targetSkipTime=0,this.alreadyListenWaiting=!1,this.stuckTime=0,this.setToId=-1}var r,n;return r=t,n=[{key:"init",value:function(){(pa.isSupported()||zl.nativeHLS||zl.isNewIphone)&&this.registerHLS()}},{key:"canHandleHlsSource",value:function(t){return zl.isIphone||!t.type||t.type.toLowerCase().indexOf("mp3")>0||t.type.toLowerCase().indexOf("mp4")>0||"audio/mpeg"===t.type?"":zl.isIpad||zl.isNewIphone?"maybe":zl.isEdge||zl.isSafari||/^application\/x-mpegURL$/i.test(t.type)?"probably":/\.m3u8/i.test(t.src||"")?"maybe":""}},{key:"handleHlsSource",value:function(t,e){return e.hlsProvider&&e.hlsProvider.dispose(),e.hlsProvider=this.provider(t,e),e.hlsProvider}},{key:"registerHLS",value:function(){var t,e=videojs.getTech("Html5");null==e||null===(t=e.registerSourceHandler)||void 0===t||t.call(e,{canHandleSource:this.canHandleHlsSource,handleSource:this.handleHlsSource.bind(this)},0)}},{key:"flushBuffer",value:function(){var t,e,r;null!==(t=this.playerManager)&&void 0!==t&&null!==(e=t.plugin.streamHandler.lib)&&void 0!==e&&e.hls&&(null===(r=this.playerManager.plugin.streamHandler.lib)||void 0===r||r.hls.streamController.flushMainBuffer(0,1/0))}},{key:"getMidrangeBitrate",value:function(){try{var t=this.plugin.options.asset;if("object"===nu(t)&&Array.isArray(t.assets.video)){var e=t.assets.video,r=e.filter((function(t){return"number"==typeof t.bitrate?(t.bitrate||0)>=1:0})).sort((function(t,e){return"number"==typeof t.bitrate&&"number"==typeof e.bitrate?(e.bitrate||0)-(t.bitrate||0):0})),n=(e||[]).length;if(2===n&&"number"==typeof r[1].bitrate)return r[1].bitrate;if(n>2){var i=r[Math.ceil(n/2)].bitrate;if("number"==typeof i)return i}}return 0}catch(t){return console.warn("Could not determine an initial bitrate. Starting with no minimum. This is not an error, it will just start with the default bitrate. Message: ".concat(t)),0}}},{key:"flushOnScrub",value:function(){var t=this;this.on("seeked",(function(){var e,r;return null===(e=t.playerManager)||void 0===e||null===(r=e.plugin.streamHandler.lib)||void 0===r?void 0:r.flushBuffer}))}},{key:"hlsSetup",value:function(){var t,e,r=this;null===(t=this.getHlsLibrary())||void 0===t||t.attachMedia(this._video),this.errors=new vl(this.plugin,this),this.events=new Dl(this.plugin,this),this.plugin.options.flushOnScrub&&this.plugin.player.one("play",this.flushOnScrub),this.plugin.options.flushOnLowBuffer&&this.plugin.player.on("SP_ERROR_MEDIA_LOW_BUFFER",this.flushBuffer),this.plugin.options.flushOnBufferStall&&this.plugin.player.on("SP_ERROR_MEDIA_STALL_BUFFER",this.flushBuffer),this.plugin.player.on("seeked",(function(t){r.plugin.player.trigger("preventBackBufferScrub",t,"SardiusHLS_Class > hlsSetup > seeked event")})),null===(e=this.getHlsLibrary())||void 0===e||e.once("hlsLevelLoaded",(function(){Gl(r.getHlsLibrary())})),this.plugin.player.on("bitrateSwitched",(function(){var t;null===(t=r.getHlsLibrary())||void 0===t||t.once("hlsLevelLoaded",(function(){Gl(r.getHlsLibrary(),5)}))}))}},{key:"getHlsLibrary",value:function(){var t;return this.hls||(null===(t=this.lib)||void 0===t?void 0:t.hls)}},{key:"hlsInitialize",value:function(){var t,r,n=this,i=this.plugin.options.hlsAdvancedSettings?this.plugin.options.hlsAdvancedSettings:{},s=this.plugin.options.auto||i.autoStartLoad,a=this.plugin.options.plugins&&"object"===nu(this.plugin.options.plugins.sardiusAds)&&Object.keys(this.plugin.options.plugins.sardiusAds).length>0;i.autoStartLoad=s||a||!1,this.playerSettingsHasNudgeOffset=void 0!==i.nudgeOffset,"object"===nu(this.plugin.options.asset)&&this.plugin.options.asset.assets.stream&&(i.liveSyncDuration=90,this.plugin.options.liveDelay&&"simlive"!==this.plugin.options.asset.assetType&&"simliveFeed"!==this.plugin.options.asset.assetType?i.liveSyncDuration=this.plugin.options.liveDelay:!this.plugin.options.simLiveLiveDelay||"simlive"!==this.plugin.options.asset.assetType&&"simliveFeed"!==this.plugin.options.asset.assetType||(i.liveSyncDuration=this.plugin.options.simLiveLiveDelay)),this.plugin.options.startLevel&&(i.startLevel=this.plugin.options.startLevel),this.plugin.options.hlsjsDebug&&(i.debug=!0),i.backBufferLength||(i.backBufferLength=900),i.maxBufferSize=this.plugin.options.maxBufferSize||Fl,this.plugin.options.shift&&(i.shift=this.plugin.options.shift),this.plugin.options.pLoaderDebug&&(i.pLoaderDebug=this.plugin.options.pLoaderDebug),this.plugin.options.harmonizePlaylists&&(i.harmonizePlaylists=this.plugin.options.harmonizePlaylists),i.sardiusUrl=null===(t=this.source)||void 0===t?void 0:t.src,i.playerId=this.plugin.player.id_;var o=null===(r=this.source)||void 0===r?void 0:r.src;if(o&&o.indexOf("?")>=0){var l=ga.parse(o.split("?").pop()||"");"string"==typeof l.shift&&(i.shift=parseInt(l.shift,10)),"string"==typeof l.firstSegment&&(i.firstSegment=parseInt(l.firstSegment,10),i.firstSegmentSetFromUrl=!0),"string"==typeof l.lastSegment&&(i.lastSegment=parseInt(l.lastSegment,10)),l.forceLive&&(i.forceLive=!0)}i.minAutoBitrate=this.getMidrangeBitrate();try{var u,c="boolean"!=typeof this.plugin.player.options_.plugins.sardius?null===(u=this.plugin.player.options_.plugins.sardius)||void 0===u?void 0:u.plugins:void 0,h={apiKey:null==c?void 0:c.system73},d=S73HlsjsWrapper(h);d.wrapPlayerConfig(i),(zl.isSafari||zl.isNewIphone||zl.isIpad||zl.isIphone)&&(i.preferManagedMediaSource=!1),void 0===this.hls||this.dispose(),this.hls=new pa(i),function(t,e){return ru.apply(this,arguments)}("",this.plugin.options).then((function(t){var e,r;null===(e=(r=n.plugin.player).debugLog)||void 0===e||e.call(r,n.plugin.options,t||"none",{debugStringTitle:"SP_SYSTEM73",logType:"warn",source:"SardiusHLS_Class > idStreamType"}),"sardiusStream"===t&&d.p2p.disable()})),this.plugin.player.system73Plugin=d,d.polyNet.featureManager.metricsService.stop(),d.wrapPlayer(this.hls),this.plugin.player.on("play",(function(){d.polyNet.featureManager.metricsService.start()})),this.plugin.player.on("pause",(function(){d.polyNet.featureManager.metricsService.stop()}))}catch(t){var f,p;null===(f=(p=this.plugin.player).debugLog)||void 0===f||f.call(p,this.plugin.options,t.message,{debugStringTitle:"SP_SYSTEM73",logType:"warn",source:"SardiusHLS_Class > hlsInitialize"}),(zl.isSafari||zl.isNewIphone||zl.isIpad||zl.isIphone)&&(i.preferManagedMediaSource=!1),void 0===this.hls||this.dispose(),this.hls=new pa(i)}this.hlsSetup(),!1===i.autoStartLoad&&this.plugin.player.one("play",(function(){var t;null===(t=n.hls)||void 0===t||t.startLoad(-1)})),this.plugin.player.one("canplay",(function(){var t=n.getHlsLibrary();null!=t&&t.levelController.hls&&(t.levelController.hls.config.minAutoBitrate=0)}));try{if(this.plugin.player.youboraplugin){var g=new(e())(this.hls);this.plugin.player.youboraplugin.setAdapter(g)}}catch(t){}}},{key:"dispose",value:function(){var t=this.getHlsLibrary();t&&t.destroy()}},{key:"load",value:function(t){var e=this.getHlsLibrary();e&&e.loadSource(t.src||"")}},{key:"provider",value:function(t,e){return this.source=t,this.tech=e,this.tech.name_="sardiusHLS",this._video=e.el(),this.hlsInitialize(),this.load(t),this}},{key:"setCurrentLevel",value:function(t){var e=this.getHlsLibrary();e&&(e.currentLevel=t)}},{key:"getLevels",value:function(){var t;return null===(t=this.getHlsLibrary())||void 0===t?void 0:t.levels}},{key:"setCurrentAudioTrack",value:function(t){var e=this.getHlsLibrary();e&&(e.audioTrack=t)}},{key:"playerListenWaiting",value:function(){var t=this;this.alreadyListenWaiting||(this.alreadyListenWaiting=!0,this.plugin.player.on("waiting",(function(){0===t.targetSkipTime&&(t.targetSkipTime=t.plugin.player.currentTime()),0===t.stuckTime&&(t.stuckTime=t.plugin.player.currentTime());var e=setInterval((function(){t.targetSkipTime+=5,t.plugin.player.currentTime(t.targetSkipTime),console.debug("[DEBUG LOG]\n","Player stuck at ".concat(t.stuckTime," seconds.\n"),"Skipping to ".concat(t.targetSkipTime," seconds."))}),2500);t.plugin.player.on("timeupdate",(function(){t.plugin.player.currentTime()>t.stuckTime&&(clearInterval(e),t.alreadyListenWaiting=!1,t.stuckTime=0,t.targetSkipTime=0,t.plugin.player.off("waiting"),t.plugin.player.off("timeupdate"))}))})))}},{key:"overrideFetch",value:function(t){if(!this.overrideHasRun){this.overrideHasRun=!0;var e=new ArrayBuffer(0),r=XMLHttpRequest.prototype.send;XMLHttpRequest.prototype.send=function(){this.addEventListener("readystatechange",(function(){404===this.status&&this.responseURL&&(this.responseURL.indexOf(".vtt")>-1?(Object.defineProperty(this,"response",{value:JSON.stringify({data:"WEBVTT\nX-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:0\n"})}),Object.defineProperty(this,"status",{value:200}),Object.defineProperty(this,"statusText",{value:"OK"})):this.responseURL.indexOf(".aac")>-1&&(t.playerListenWaiting(),Object.defineProperty(this,"response",{value:e}),Object.defineProperty(this,"status",{value:200}),Object.defineProperty(this,"statusText",{value:"OK"})))})),r.apply(this,arguments)}}}},{key:"setCurrentTextTrackDelayed",value:function(t,e){var r=this,n=this.getHlsLibrary();n&&(this.plugin.player.options_.overrideFetch&&this.overrideFetch(this),n.subtitleTrack=-1,this.setToId=t,n.subtitleTrack=t,setTimeout((function(){-1!==r.setToId&&(n.subtitleTrack=r.setToId,r.setToId=-1)}),1e3)),this.plugin.player.youbora&&this.plugin.player.youbora({"content.customDimension.1":e||"off","content.subtitles":e||"off"})}},{key:"setCurrentTextTrack",value:function(t,e){this.plugin.player.youbora&&this.plugin.player.youbora({"content.customDimension.1":e||"off","content.subtitles":e||"off"})}},{key:"setTextTrackDisplay",value:function(t){var e=this.getHlsLibrary();e&&(e.subtitleDisplay=t)}}],n&&iu(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),t}();const lu=ou,uu=function(t){var e,r,n={amharic:{isoEquivalent:"amh",multiAssetCode:"AM"},arabic:{isoEquivalent:"ara",multiAssetCode:"AR"},cantonese:{isoEquivalent:"yue",multiAssetCode:"CA"},german:{isoEquivalent:"deu",multiAssetCode:"DE"},english:{isoEquivalent:"eng",multiAssetCode:"EN"},spanish:{isoEquivalent:"spa",multiAssetCode:"ES"},french:{isoEquivalent:"fra",multiAssetCode:"FR"},hindi:{isoEquivalent:"hin",multiAssetCode:"HI"},bahasaIndonesia:{isoEquivalent:"ind",multiAssetCode:"ID"},italian:{isoEquivalent:"ita",multiAssetCode:"IT"},japanese:{isoEquivalent:"jpn",multiAssetCode:"JA"},korean:{isoEquivalent:"kor",multiAssetCode:"KO"},mongolian:{isoEquivalent:"mon",multiAssetCode:"MO"},dutch:{isoEquivalent:"nld",multiAssetCode:"NL"},polish:{isoEquivalent:"pli",multiAssetCode:"PL"},portuguese:{isoEquivalent:"por",multiAssetCode:"PT"},russian:{isoEquivalent:"rus",multiAssetCode:"RU"},thai:{isoEquivalent:"tha",multiAssetCode:"TH"},urdu:{isoEquivalent:"urd",multiAssetCode:"UR"},urdu2:{isoEquivalent:"ur",multiAssetCode:"UR"},vietnamese:{isoEquivalent:"vie",multiAssetCode:"VI"},vietnamese2:{isoEquivalent:"vi",multiAssetCode:"VI"},signLanguage:{isoEquivalent:"sgn",multiAssetCode:"XZ"},chinese:{isoEquivalent:"zho",multiAssetCode:"ZH"},afrikaans:{isoEquivalent:"afr",multiAssetCode:"AF"},albanian:{isoEquivalent:"alb",multiAssetCode:"SQ"},albanian2:{isoEquivalent:"sqi",multiAssetCode:"SQ"},armenian:{isoEquivalent:"arm",multiAssetCode:"HY"},armenian2:{isoEquivalent:"hye",multiAssetCode:"HY"},azerbaijani:{isoEquivalent:"aze",multiAssetCode:"AZ"},bengali:{isoEquivalent:"ben",multiAssetCode:"BN"},bosnian:{isoEquivalent:"bos",multiAssetCode:"BS"},bulgarian:{isoEquivalent:"bul",multiAssetCode:"BL"},burmese:{isoEquivalent:"bur",multiAssetCode:"MY"},burmese2:{isoEquivalent:"mya",multiAssetCode:"MY"},croatian:{isoEquivalent:"hrv",multiAssetCode:"HR"},czech:{isoEquivalent:"cze",multiAssetCode:"CS"},czech2:{isoEquivalent:"ces",multiAssetCode:"CS"},danish:{isoEquivalent:"dan",multiAssetCode:"DA"},estonian:{isoEquivalent:"est",multiAssetCode:"ET"},filipino:{isoEquivalent:"fil",multiAssetCode:"TL"},finnish:{isoEquivalent:"fin",multiAssetCode:"FI"},georgian:{isoEquivalent:"geo",multiAssetCode:"KA"},georgian2:{isoEquivalent:"kat",multiAssetCode:"KA"},greek:{isoEquivalent:"gre",multiAssetCode:"EL"},greek2:{isoEquivalent:"ell",multiAssetCode:"EL"},gujarati:{isoEquivalent:"guj",multiAssetCode:"GU"},hebrew:{isoEquivalent:"heb",multiAssetCode:"HE"},hungarian:{isoEquivalent:"hun",multiAssetCode:"HU"},icelandic:{isoEquivalent:"ice",multiAssetCode:"IS"},icelandic2:{isoEquivalent:"isl",multiAssetCode:"IS"},kannada:{isoEquivalent:"kan",multiAssetCode:"KN"},kazakh:{isoEquivalent:"kaz",multiAssetCode:"KK"},khmerCentral:{isoEquivalent:"khm",multiAssetCode:"KM"},kinyarwanda:{isoEquivalent:"kin",multiAssetCode:"RW"},lao:{isoEquivalent:"lao",multiAssetCode:"LO"},latvian:{isoEquivalent:"lav",multiAssetCode:"LV"},lithuanian:{isoEquivalent:"lit",multiAssetCode:"LT"},macedonian:{isoEquivalent:"mac",multiAssetCode:"MK"},macedonian2:{isoEquivalent:"mkd",multiAssetCode:"MK"},malay:{isoEquivalent:"may",multiAssetCode:"MS"},malay2:{isoEquivalent:"msa",multiAssetCode:"MS"},malayalam:{isoEquivalent:"mal",multiAssetCode:"ML"},maltese:{isoEquivalent:"mlt",multiAssetCode:"MT"},marathi:{isoEquivalent:"mar",multiAssetCode:"MR"},nepali:{isoEquivalent:"nep",multiAssetCode:"NE"},norwegian:{isoEquivalent:"nor",multiAssetCode:"NO"},pashto:{isoEquivalent:"pus",multiAssetCode:"PS"},persian:{isoEquivalent:"per",multiAssetCode:"FA"},persian2:{isoEquivalent:"fas",multiAssetCode:"FA"},romanian:{isoEquivalent:"rum",multiAssetCode:"RO"},romanian2:{isoEquivalent:"ron",multiAssetCode:"RO"},serbian:{isoEquivalent:"srp",multiAssetCode:"SR"},sinhala:{isoEquivalent:"sin",multiAssetCode:"SI"},slovak:{isoEquivalent:"slo",multiAssetCode:"SK"},slovak2:{isoEquivalent:"slk",multiAssetCode:"SK"},slovenian:{isoEquivalent:"slv",multiAssetCode:"SL"},somali:{isoEquivalent:"som",multiAssetCode:"SO"},swahili:{isoEquivalent:"swa",multiAssetCode:"SW"},swedish:{isoEquivalent:"swe",multiAssetCode:"SV"},tamil:{isoEquivalent:"tam",multiAssetCode:"TA"},telugu:{isoEquivalent:"tel",multiAssetCode:"TE"},turkish:{isoEquivalent:"tur",multiAssetCode:"TR"},ukrainian:{isoEquivalent:"ukr",multiAssetCode:"UK"},uzbek:{isoEquivalent:"uzb",multiAssetCode:"UZ"},assamese:{isoEquivalent:"asm",multiAssetCode:"AS"},catalan:{isoEquivalent:"cat",multiAssetCode:"CAT"},fijian:{isoEquivalent:"fij",multiAssetCode:"FJ"},haitianCreole:{isoEquivalent:"hat",multiAssetCode:"HA"},hmongDew:{isoEquivalent:"hmn",multiAssetCode:"HMN"},igbo:{isoEquivalent:"ibo",multiAssetCode:"IG"},javanese:{isoEquivalent:"jav",multiAssetCode:"JV"},kurdish:{isoEquivalent:"kur",multiAssetCode:"KU"},malagasy:{isoEquivalent:"mlg",multiAssetCode:"MG"},odia:{isoEquivalent:"ori",multiAssetCode:"OR"},samoan:{isoEquivalent:"smo",multiAssetCode:"SM"},tagalog:{isoEquivalent:"tgl",multiAssetCode:"TL"},tigrinya:{isoEquivalent:"tir",multiAssetCode:"TI"},yucatecMaya:{isoEquivalent:"myn",multiAssetCode:"MYN"},hausa:{isoEquivalent:"hau",multiAssetCode:"HAU"}},i={am:n.amharic,amh:n.amharic,ar:n.arabic,ara:n.arabic,ca:n.cantonese,yue:n.cantonese,de:n.german,deu:n.german,en:n.english,eng:n.english,es:n.spanish,spa:n.spanish,fr:n.french,fra:n.french,hi:n.hindi,hin:n.hindi,id:n.bahasaIndonesia,ind:n.bahasaIndonesia,it:n.italian,ita:n.italian,ja:n.japanese,jpn:n.japanese,ko:n.korean,kor:n.korean,mn:n.mongolian,mon:n.mongolian,nl:n.dutch,nld:n.dutch,pl:n.polish,pli:n.polish,pt:n.portuguese,por:n.portuguese,ru:n.russian,rus:n.russian,th:n.thai,tha:n.thai,urd:n.urdu,ur:n.urdu2,vie:n.vietnamese,vi:n.vietnamese2,xz:n.signLanguage,sgn:n.signLanguage,zh:n.chinese,zho:n.chinese,af:n.afrikaans,afr:n.afrikaans,alb:n.albanian,sqi:n.albanian2,sq:n.albanian,arm:n.armenian,hye:n.armenian2,hy:n.armenian,aze:n.azerbaijani,az:n.azerbaijani,be:n.bengali,ben:n.bengali,bs:n.bosnian,bos:n.bosnian,bul:n.bulgarian,bg:n.bulgarian,bur:n.burmese,mya:n.burmese2,my:n.burmese,hrv:n.croatian,hr:n.croatian,cze:n.czech,ces:n.czech2,cs:n.czech,dan:n.danish,da:n.danish,est:n.estonian,et:n.estonian,fil:n.filipino,tl:n.filipino,fin:n.finnish,fi:n.finnish,geo:n.georgian,kat:n.georgian2,ka:n.georgian,gre:n.greek,ell:n.greek2,el:n.greek,guj:n.gujarati,gu:n.gujarati,heb:n.hebrew,he:n.hebrew,hun:n.hungarian,hu:n.hungarian,ice:n.icelandic,is:n.icelandic,isl:n.icelandic2,kan:n.kannada,kn:n.kannada,kaz:n.kazakh,kk:n.kazakh,khm:n.khmerCentral,km:n.khmerCentral,kin:n.kinyarwanda,rw:n.kinyarwanda,lao:n.lao,lo:n.lao,lav:n.latvian,lv:n.latvian,lit:n.lithuanian,lt:n.lithuanian,mac:n.macedonian,mk:n.macedonian,mkd:n.macedonian2,may:n.malay,ms:n.malay,msa:n.malay2,mal:n.malayalam,ml:n.malayalam,mlt:n.maltese,mt:n.maltese,mar:n.marathi,mr:n.marathi,nep:n.nepali,ne:n.nepali,nor:n.norwegian,no:n.norwegian,pus:n.pashto,ps:n.pashto,per:n.persian,fa:n.persian,fas:n.persian2,rum:n.romanian,ro:n.romanian,ron:n.romanian2,srp:n.serbian,sr:n.serbian,sin:n.sinhala,si:n.sinhala,slo:n.slovak,sk:n.slovak,slk:n.slovak2,slv:n.slovenian,sl:n.slovenian,som:n.somali,so:n.somali,swa:n.swahili,sw:n.swahili,swe:n.swedish,sv:n.swedish,tam:n.tamil,ta:n.tamil,tel:n.telugu,te:n.telugu,tur:n.turkish,tu:n.turkish,ukr:n.ukrainian,uk:n.ukrainian,uzb:n.uzbek,uz:n.uzbek,asm:n.assamese,as:n.assamese,cat:n.catalan,fij:n.fijian,fj:n.fijian,hat:n.haitianCreole,ha:n.haitianCreole,hmn:n.hmongDew,ibo:n.igbo,ig:n.igbo,jav:n.javanese,jv:n.javanese,kur:n.kurdish,ku:n.kurdish,mlg:n.malagasy,mg:n.malagasy,ori:n.odia,or:n.odia,smo:n.samoan,sm:n.samoan,tgl:n.tagalog,tir:n.tigrinya,ti:n.tigrinya,myn:n.yucatecMaya,hau:n.hausa},s={isoEquivalent:null===(e=i[t])||void 0===e?void 0:e.isoEquivalent,multiAssetCode:null===(r=i[t])||void 0===r?void 0:r.multiAssetCode};return void 0===i[t]&&console.error("Locale Not Supported: ".concat(t)),s};function cu(t){return cu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},cu(t)}function hu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vu(n.key),n)}}function du(t,e){return du=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},du(t,e)}function fu(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pu(t){return pu=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pu(t)}function gu(t,e,r){return(e=vu(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vu(t){var e=function(t,e){if("object"!==cu(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==cu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===cu(e)?e:String(e)}const mu=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&du(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=pu(n);if(i){var r=pu(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===cu(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return fu(t)}(this,t)});function a(t){var e;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),gu(fu(e=s.call(this,t)),"plugin",void 0),gu(fu(e),"protocol",void 0),gu(fu(e),"isIOS",void 0),e.plugin=t,e.protocol=t.protocol,e.isIOS=zl.isIOS,"hls"===e.protocol?(e.lib=new lu(t),e.lib.init()):e.protocol?console.warn("SP_WARNING: The '".concat(e.protocol,"' streaming protocol is not supported.")):console.warn("SP_WARNING: A streaming protocol has not been specified."),e}return e=a,(r=[{key:"isPlayerAssetWithLanguages",value:function(t){return"object"===cu(t)&&Object.prototype.hasOwnProperty.call(t,"languages")}},{key:"setLocale",value:function(t){var e,r,n=this;this.plugin.options.locale||(this.plugin.options.locale=t);var i=function(){var i,s=n.plugin.player.audioTracksMenu.items,a=n.isIOS?"language":"lang",o=uu(t),l=o.isoEquivalent,u=o.multiAssetCode,c=!1,h=!1,d=!1;if(s)for(var f=0;f<s.length;f+=1){var p,g,v,m,y,E,S,b,T,_,A,L,w;if(((null===(p=s[f].options_)||void 0===p||null===(g=p.data)||void 0===g?void 0:g[a])===t||(null===(v=s[f].options_)||void 0===v||null===(m=v.data)||void 0===m?void 0:m[a])===l)&&(e=f,c=null===(y=r=s[f])||void 0===y||null===(E=y.options_)||void 0===E||null===(S=E.data)||void 0===S?void 0:S.autoselect,h=null===(b=r)||void 0===b||null===(T=b.options_)||void 0===T||null===(_=T.data)||void 0===_?void 0:_.force,d=null===(A=r)||void 0===A||null===(L=A.options_)||void 0===L||null===(w=L.data)||void 0===w?void 0:w.default,c||h||d))break}if(void 0===e)if(console.warn("No Track Was Found for Locale, Checking Lang-Asset:",t),n.isPlayerAssetWithLanguages(n.plugin.options.asset)&&null!==(i=n.plugin.options.asset.languages)&&void 0!==i&&i[u]){var R={code:u,label:u};n.plugin.sourceHandler.switchLanguage(R)}else console.warn("No Lang-Asset Was Found:",t);else n.setCurrentAudioTrack(e),n.plugin.player.audioTracksMenu.setActiveItem(r)};this.isIOS&&this.plugin.player.paused()?this.plugin.player.one("play",(function(){i()})):i()}}])&&hu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(lu);function yu(t){return yu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yu(t)}function Eu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,bu(n.key),n)}}function Su(t,e,r){return(e=bu(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bu(t){var e=function(t,e){if("object"!==yu(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==yu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===yu(e)?e:String(e)}const Tu=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Su(this,"plugin",void 0),Su(this,"sourceHandler",void 0),this.plugin=e,this.sourceHandler=this.plugin.sourceHandler}var e,r;return e=t,(r=[{key:"setSources",value:function(t){var e;null===(e=this.sourceHandler)||void 0===e||e.setSources(t)}}])&&Eu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function _u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Au(t){return Au="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Au(t)}function Lu(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ru(n.key),n)}}function wu(t,e,r){return(e=Ru(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ru(t){var e=function(t,e){if("object"!==Au(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Au(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Au(e)?e:String(e)}var ku=function(){function t(e){var r,n;(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),wu(this,"options",void 0),wu(this,"player",void 0),wu(this,"asset",void 0),wu(this,"isIframe",void 0),this.options=e.options,this.player=e.player,this.asset="object"===Au(this.player.playerManager.plugin.options.asset)?this.player.playerManager.plugin.options.asset:void 0,this.isIframe=this.player.options_.isIframe,this.options.plugins||(this.options.plugins={spMenuBar:{items:[]}}),this.options.plugins.youbora&&this.player.youbora&&this.youbora(),this.player.spThumbnails&&(null===(r=(n=this.player).spThumbnails)||void 0===r||r.call(n))}var e,r;return e=t,r=[{key:"smGetQueryStringValue",value:function(t){return decodeURIComponent(window.location.search.replace(new RegExp("^(?:.*[&\\?]".concat(encodeURIComponent(t).replace(/[.+*]/g,"\\$&"),"(?:\\=([^&]*))?)?.*$"),"i"),"$1"))}},{key:"cleanTitle",value:function(t){var e=t;try{e.indexOf("%")>-1&&(e=decodeURIComponent(e))}catch(t){}return e}},{key:"youbora",value:function(){var t,e,r,n,i=this,s=function(t){var e,r,n={};return decodeURIComponent((null===(e=i.asset)||void 0===e?void 0:e.id)||"").split("?")[1].split("&").forEach((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return _u(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)?_u(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t.split("="),2),r=e[0],i=e[1];n[r]=i})),n[t]||(null===(r=i.asset)||void 0===r?void 0:r.id)||""},a="",o="",l=this.player.playerManager.plugin.options.accountId,u=this.player.playerManager.plugin.options.playerId;if(this.player.options_.techOrder&&"youtube"===this.player.options_.techOrder[0])try{var c,h,d,f=this.player.options_.youtube;void 0!==f&&"boolean"!=typeof f&&(a=(null===(c=f.customVars)||void 0===c?void 0:c.title)||"",o=(null===(h=f.customVars)||void 0===h?void 0:h.id)||"",n=(null===(d=f.customVars)||void 0===d?void 0:d.isLive)||void 0)}catch(t){}else{var p;try{if(this.asset&&this.asset.id&&this.asset.assetType&&("simlive"===this.asset.assetType||"simliveFeed"===this.asset.assetType||"file"===this.asset.assetType))a=s("assetTitle");else{var g,v=null===(g=this.asset)||void 0===g?void 0:g.metadata.title;v&&(a=v)}}catch(t){}try{if(this.asset&&this.asset.id&&this.asset.assetType&&("simlive"===this.asset.assetType||"simliveFeed"===this.asset.assetType||"file"===this.asset.assetType))o=s("assetId");else{var m,y=null===(m=this.asset)||void 0===m?void 0:m.id;y&&(o=y)}}catch(t){}n=void 0!==(null===(p=this.asset)||void 0===p?void 0:p.assets.stream)}var E={accountCode:"boolean"!=typeof this.options.plugins.youbora?null===(t=this.options.plugins.youbora)||void 0===t?void 0:t.accountCode:void 0,"content.isLive":n,"content.title":this.cleanTitle(this.cleanTitle(a)),"content.id":o,"content.customDimension.1":"","content.customDimension.2":l,"content.customDimension.3":u,"content.customDimension.4":o};if(this.asset){var S={accountId:"",assets:{},assetType:"asset",captions:[],id:"",metadata:{categories:[],title:"",originalAsset:{duration:0,metadata:{duration:0},id:"",pid:"",media:{}}}},b=(this.asset.metadata||S.metadata).originalAsset||S.metadata.originalAsset,T=(null==b?void 0:b.metadata)||S.metadata.originalAsset.metadata,_=this.asset.duration||(null==b?void 0:b.duration)||T.duration;Array.isArray(null==b?void 0:b.categories)&&b.categories.length>0&&(E["content.genre"]=b.categories.join(", "));var A=function(t){var e;if(i.asset)switch(t){default:break;case"protocol":E["content.streamingProtocol"]=i.asset[t];break;case"series":E["content.tvShow"]=null==b?void 0:b[t];break;case"episode":E["content.episodeTitle"]=null==b?void 0:b[t];break;case"media":if(null!=b&&b[t]){var r=b[t],n=r.url,s=r.bitrate;E["content.resource"]=Array.isArray(n)?n[0]:n,s&&(E["content.bitrate"]=s)}break;case"captions":case"language":e=i.asset[t],Array.isArray(e)||(E["content.".concat(t)]=e)}};Object.keys(this.asset).forEach(A),b&&Object.keys(b).forEach(A),_&&(E["content.duration"]=_/1e3)}var L,w,R,k,D=this.smGetQueryStringValue("uid")||this.options.uid;""!==D&&void 0!==D&&(E.username=D),this.player.playerManager.plugin.options.siteId&&(E["content.customDimension.5"]=this.player.playerManager.plugin.options.siteId),this.player.playerManager.plugin.options.eventId&&(E["content.customDimension.6"]=this.player.playerManager.plugin.options.eventId),this.player.playerManager.plugin.options.experienceId&&(E["content.customDimension.7"]=this.player.playerManager.plugin.options.experienceId),null!==(e=this.asset)&&void 0!==e&&null!==(r=e.metadata.originalAsset)&&void 0!==r&&r.pid&&(E["content.customDimension.9"]=null===(L=this.asset)||void 0===L||null===(w=L.metadata.originalAsset)||void 0===w?void 0:w.pid),!1===this.options.plugins.youbora?this.options.plugins.youbora=!1:null===(R=(k=this.player).youbora)||void 0===R||R.call(k,E)}}],r&&Lu(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const Du=ku;function Iu(t){return Iu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Iu(t)}function Pu(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const Ou=function(t,e,r,n){var i={},s=e.toLowerCase(),a=t,o=r,l={accountId:"",assetId:"",assetType:"asset",playerId:"",query:{}};if(i[a])return i[a];if(a.indexOf("?")>-1){var u=a.split("?");if(u.length>1){var c=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return Pu(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)?Pu(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(u,2),h=c[0],d=c[1];a=h,l=Nu(u=d)}}var f={};if(a.toLowerCase().indexOf("link.theplatform.com")>=0&&null!=o&&o["link.theplatform.com"]){f=o["link.theplatform.com"];for(var p=!1,g=Object.keys(f),v={},m=0;m<g.length;m+=1){var y=g[m],E=f[y];if("all"===y||zl[y]){v=E;break}}var S={};if(v[s]?S=v[s]:v.all&&(S=v.all),S.delete){p=!0;for(var b=0;b<S.delete.length;b+=1)delete l[S.delete[b]]}if(S.add){p=!0;for(var T=Object.keys(S.add),_=0;_<T.length;_+=1){var A=T[_],L=S.add[A];l[A]=L}}a+="?".concat(Fu(l));var w=!1;if(S.clientside&&(p=!0,w=!0),p)if(w){var R=a.split("&");if(zl.isSafari)for(var k=0;k<R.length;k+=1)"formats=MP3"===R[k]&&(a=window.SARDIUSENDPOINT.includes("players.sardius.media")?"//players.sardius.media/redirect?url=https:".concat(encodeURIComponent(a)):"".concat(window.SARDIUSENDPOINT.split("players")[0],"players/redirect?url=https:").concat(encodeURIComponent(a)));var D=new XMLHttpRequest;D.onreadystatechange=function(){if(4===this.readyState&&200===this.status){for(var t=this.responseText.match(/src(=|:)"([^"]+)/gi)||[],e={mp3:[],mp4:[],m3u:[]},r=0;r<t.length;r+=1)a=(a=(a=t[r].replace(/src(=|:)/gi,"")).replace(/\\|"/gi,"")).replace(/http:\/\/|https:\/\//gi,"//"),zl.isNative&&(a="https:".concat(a)),a.indexOf("akamai")>=0&&(a=a.replace(/\&amp\;/g,"%26")),/.*\.(mp3|mp4|m3u8).*/gi.test(a)&&(/.*\.mp3.*/gi.test(a)?e.mp3.push(a):/.*\.mp4.*/gi.test(a)&&!/.*\.m3u.*/gi.test(a)?e.mp4.push(a):/.*\.m3u.*/gi.test(a)&&e.m3u.push(a));if(s.indexOf("mp3")>=0&&e.mp3.length>0)return void n({src:e.mp3[0],type:"audio/mp3"});if(s.indexOf("mp4")>=0&&e.mp4.length>0)return void n({src:e.mp4[0],type:"video/mp4"});if(e.m3u.length>0)return void n({src:e.m3u[0],type:"application/x-mpegURL"});if(e.mp4.length>0)return void n({src:e.mp4[0],type:"video/mp4"});if(e.mp3.length>0)return void n({src:e.mp3[0],type:"audio/mp3"});n()}else 4===this.readyState&&n()},D.open("GET",a,!0),D.send(null)}else n({src:a,type:s});else n()}else n()},Cu=function(t){return JSON.parse(t)},xu=function(t,e){Jo.get(t).then((function(t){var r=t.data;try{e(Cu(r))}catch(t){e(r)}})).catch((function(t){var r;e(null,null===(r=t.response)||void 0===r?void 0:r.status)}))};function Mu(t){return Mu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mu(t)}const Fu=function(t){for(var e=[],r=Object.keys(t),n=0;n<r.length;n+=1){var i=r[n],s=t[i];s&&"object"!==Mu(s)&&e.push("".concat(encodeURIComponent(i),"=").concat(encodeURIComponent(s)))}return e.join("&")},Nu=function(t){var e=t;return e.indexOf("?")>=0&&(e=e.split("?").pop()),JSON.parse('{"'.concat(decodeURI(e).replace(/"/g,'\\"').replace(/&/g,'","').replace(/=/g,'":"'),'"}'))};function Bu(t){return Bu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bu(t)}function Uu(){Uu=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==Bu(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function ju(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function Hu(){var t;return t=Uu().mark((function t(e){var r,n,i,s;return Uu().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r="",n=e.url,r="".concat(i=void 0===n?"":n,"?refreshAsset=true"),i.includes("https:")||(r=r.includes("localhost:3000")?"http:".concat(r):"https:".concat(r)),t.next=6,Jo.get(r);case 6:return s=t.sent,t.abrupt("return",s.data);case 8:case"end":return t.stop()}}),t)})),Hu=function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){ju(s,n,i,a,o,"next",t)}function o(t){ju(s,n,i,a,o,"throw",t)}a(void 0)}))},Hu.apply(this,arguments)}const Gu=function(t){return Hu.apply(this,arguments)},Vu=function(t,e){var r=t,n=r.toLowerCase().replace(/[^a-z0-9]+/gi,"");return e&&void 0!==e[n]&&(r=e[n]),r},Ku=function(t){return zl.isNative?t:t.replace(/^https?:\/\//i,"//")};function $u(t){return $u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$u(t)}const Wu=function(t){return null!=t&&"object"===$u(t)};var qu=r(5194),Yu=r.n(qu),zu=r(1354),Xu=r.n(zu),Ju=zu.AES.decrypt;var Qu=r(6486);function Zu(t){return Zu="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zu(t)}function tc(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function ec(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?tc(Object(r),!0).forEach((function(e){rc(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):tc(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function rc(t,e,r){return(e=function(t){var e=function(t,e){if("object"!==Zu(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Zu(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Zu(e)?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function nc(t,e){var r,n=(r=t.type||"",["audio/mp3","audio/aac","audio/mpeg"].includes(r)),i=function(t){return"application/x-mpegURL"===t||"application/dash+xml"===t}(t.type||""),s=void 0===t.width&&void 0===t.height||0===t.width&&0===t.height,a=!0;(function(t){try{var e=t.options_.plugins.sardius;if(Wu(e)){var r=e.asset;return!0===e.doAudioOnlyCheck&&void 0!==r&&"string"!=typeof r&&Array.isArray(r.assets.video)&&r.assets.video.length>0&&r.assets.video.length<2&&void 0!==r.assets.video[0].qualityLabel&&"auto"===r.assets.video[0].qualityLabel.toLowerCase()}return!1}catch(t){return!1}}(e)||function(t){try{var e=t.options_.plugins.sardius;if(Wu(e)){var r,n,i=e.asset;return!0===e.doAudioOnlyCheck&&Array.isArray(null==i||null===(r=i.assets.stream)||void 0===r?void 0:r[0].playlist)&&0===(null==i||null===(n=i.assets.stream)||void 0===n?void 0:n[0].playlist.filter((function(t){var e;return-1===(null===(e=t.qualityLabel)||void 0===e?void 0:e.toLowerCase().indexOf("auto"))&&-1===t.qualityLabel.toLowerCase().indexOf("audio")})).length)}return!1}catch(t){return!1}}(e))&&(a=!1),!a||n||i&&s?e.addClass("show-audio-poster"):e.removeClass("show-audio-poster")}const ic=function(t){function e(e){if(e.options&&e.options.end>e.options.start&&e.src&&e.src.indexOf("akamaihd.net/i")>0){var r="?";e.src.indexOf("?")>=0&&(r="&"),e.url&&e.url.indexOf("start="),r+="start=".concat(e.options.start,"&end=").concat(e.options.end),e.src+=r}nc(e,t);var n=t.options_.plugins.sardius;Wu(n)&&n.doAudioOnlyCheck&&t.on("bitrateSwitched",(function(e,r){nc(r,t)})),t.src(ec(ec({},e),{},{src:e.src||""}))}t.source=function(r){if(void 0===r)return t.src();var n=(0,Qu.get)(t,"options_.redirects");if(!zl.isEdge||n&&n["link.theplatform.com"]&&n["link.theplatform.com"].isEdge||(n||(n={}),(0,Qu.set)(n["link.theplatform.com"],"all",{add:{format:"smil"},clientside:!0})),r.src&&r.type&&t.options_.redirects){var i=r.src,s=r.type,a=t.options_.redirects;Ou(i,s,a,(function(n){t.playerManager.plugin.options.usehttps&&i.indexOf("https")<0&&(r.src="https:".concat(r.src)),n&&(r.src=n.src,r.type=n.type),e(r)}))}else e(r)}};function sc(t){return sc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sc(t)}function ac(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,lc(n.key),n)}}function oc(t,e,r){return(e=lc(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function lc(t){var e=function(t,e){if("object"!==sc(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==sc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===sc(e)?e:String(e)}var uc=function(){function t(e,r){var n,i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),oc(this,"sourceHandler",void 0),oc(this,"plugin",void 0),oc(this,"retrySeconds",void 0),oc(this,"nextRetry",void 0),oc(this,"retryCount",void 0),oc(this,"reDownload",void 0),oc(this,"endpoint",void 0),oc(this,"url",void 0),oc(this,"playlist",void 0),oc(this,"manifest",void 0),oc(this,"isLive",void 0),this.sourceHandler=e,this.plugin=r,this.retrySeconds=10,this.nextRetry=this.retrySeconds,this.retryCount=0,this.reDownload=!1,this.endpoint="string"!=typeof this.sourceHandler.options.asset?"".concat((null===(n=this.sourceHandler.options.asset)||void 0===n?void 0:n.url)||"","/playlist"):"",this.sourceHandler.plugin.player.on("stream-offline",(function(){try{var t,e;"string"!=typeof i.sourceHandler.options.asset&&(i.url=null===(t=i.sourceHandler.options.asset)||void 0===t||null===(e=t.assets.stream)||void 0===e?void 0:e[0].url,i.retry())}catch(t){i.plugin.player.error({code:"STREAM_OFFLINE",message:"This live stream is currently OFFLINE, please stay tuned as the stream will automatically load once it is live.",source:"libs/SourceHandler/OfflineHandler -> constructor > Stream Offline"})}}))}var e,r;return e=t,r=[{key:"retry",value:function(){var t=this;this.handle().then((function(e){"string"!=typeof t.sourceHandler.options.asset&&t.sourceHandler.options.asset&&t.sourceHandler.options.asset.assets.stream&&(t.sourceHandler.options.asset.assets.stream[0].playlist=e),"string"!=typeof t.sourceHandler.plugin.options.asset&&t.sourceHandler.plugin.options.asset&&t.sourceHandler.plugin.options.asset.assets.stream&&(t.sourceHandler.plugin.options.asset.assets.stream[0].playlist=e),t.sourceHandler.init(t.plugin)})).catch((function(){t.plugin.player.error({code:4,message:"",source:"libs/SourceHandler/OfflineHandler -> retry > handle.catch"})})),this.plugin.player.error({code:"STREAM_OFFLINE",message:"This live stream is currently OFFLINE, please stay tuned as the stream will automatically load once it is live.",source:"libs/SourceHandler/OfflineHandler -> retry > Stream Offline"})}},{key:"_isLive",value:function(){var t=this;return new Promise((function(e,r){t.isLive?t._isUpdated().then(e).catch(r):t.reDownload?xu(t.url||"",(function(n){n&&(t.isLive=!0,t.manifest=n,t._isUpdated().then(e).catch(r)),r()})):xu(t.url||"",(function(e){e&&(t.reDownload=!0),r()}))}))}},{key:"_isUpdated",value:function(){var t=this;return new Promise((function(e,r){var n={manifest:t.manifest,url:t.url},i=function(t){var e,r=t,n=36;if("object"===Iu(r)&&(r=JSON.stringify(r)),0===r.length)return n;for(e=0;e<r.length;e+=1)n=(n<<541)-n+(r.charCodeAt(e)+50),n|=0;return n}(n);!function(t,e,r){Jo.post(t,e).then((function(t){var e=t.data;try{r("string"==typeof e?Cu(e):e)}catch(t){"string"!=typeof e&&r(e)}})).catch((function(t){var e;r(null,null===(e=t.response)||void 0===e?void 0:e.status)}))}("".concat(t.endpoint,"/").concat(i),n,(function(n,i){if(i)r();else try{n&&n.length>0?(t.playlist=n,e(n)):r()}catch(t){r()}}))}))}},{key:"_checkUrl",value:function(t){var e=this;this.playlist?t(this.playlist):setTimeout((function(){e.nextRetry-=1,0===e.nextRetry?e._isLive().then((function(e){t(e)})).catch((function(){e.nextRetry=e.retrySeconds,e.retryCount+=1,e._checkUrl(t)})):e._checkUrl(t)}),1e3)}},{key:"handle",value:function(){var t=this;return new Promise((function(e){t._checkUrl((function(t){e(t)}))}))}}],r&&ac(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const cc=uc,hc=function(t){return t.toUpperCase()};function dc(){dc=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==mc(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function fc(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function pc(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){fc(s,n,i,a,o,"next",t)}function o(t){fc(s,n,i,a,o,"throw",t)}a(void 0)}))}}function gc(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return vc(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)?vc(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function vc(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function mc(t){return mc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mc(t)}function yc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Sc(n.key),n)}}function Ec(t,e,r){return(e=Sc(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Sc(t){var e=function(t,e){if("object"!==mc(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==mc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===mc(e)?e:String(e)}const bc=function(){function t(e){var r=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Ec(this,"plugin",void 0),Ec(this,"protocol",void 0),Ec(this,"sources",void 0),Ec(this,"languages",void 0),Ec(this,"language",void 0),Ec(this,"defaultSrc",void 0),Ec(this,"attachedMenuItems",void 0),Ec(this,"options",void 0),Ec(this,"autoLoaded",void 0),Ec(this,"forcedLastAsset",void 0),Ec(this,"captions",void 0),Ec(this,"offlineHandler",void 0),Ec(this,"labels",void 0),Ec(this,"currentSource",void 0),ic(e.player),this.attachedMenuItems={},this.autoLoaded=!1,this.captions=[],this.defaultSrc={src:""},this.forcedLastAsset=!1,this.language=!1,this.languages={},this.options=e.options,this.plugin=e,this.protocol=e.protocol,this.sources={accountId:"",assetType:"asset",assets:{},captions:[],id:"",metadata:{categories:[],title:""}},this.offlineHandler=new cc(this,e),e.player.ready((function(){r.ready(e)}))}var e,r;return e=t,r=[{key:"init",value:function(t){var e=this;ic(t.player),this.plugin=t,this.protocol=t.protocol,this.sources={accountId:"",assetType:"asset",assets:{},captions:[],id:"",metadata:{categories:[],title:""}},this.languages={},this.language=!1,this.defaultSrc={src:""},this.attachedMenuItems={},this.forcedLastAsset=!1,this.autoLoaded=!1,this.options=t.options,this.captions=[],this.offlineHandler=new cc(this,t),t.player.ready((function(){e.ready(t)}))}},{key:"ready",value:function(t){var e=this;"object"===mc(this.options.asset)&&this.setSources(this.options.asset),this.labels=this.options.labels,t.player.trigger("settingsMenu-menuLabels",this.options.labels,"libs/SourceHandler/index -> ready"),t.player.on("preventBackBufferScrub",(function(){e.preventBackBufferScrub()}))}},{key:"preventBackBufferScrub",value:function(){var t;if(this.plugin.player.playerManager.plugin.options.asset.isLive&&null!==(t=this.plugin.player.playerManager.plugin.streamHandler.lib)&&void 0!==t&&t.hls)try{var e=this.plugin.player.playerManager.plugin.options,r=e.dvrLength;if(e.preventBackBufferScrub){var n,i=this.plugin.player.playerManager.plugin.streamHandler.lib.hls,s=i.currentLevel,a=null===(n=i.levels[s])||void 0===n?void 0:n.details;if(a){var o=a.totalduration,l=Math.round(this.plugin.player.duration()-(r||o))+120;l<0?l=0:l>this.plugin.player.duration()&&(l=this.plugin.player.duration()),this.plugin.player.currentTime()<l&&this.forcePlay(l)}}}catch(t){console.warn("SP_ERROR: Failed to prevent back buffer scrub.",t)}}},{key:"isStreamingProtocol",value:function(t){return/^application\/x-mpegURL*/gi.test(t.type||"")||/^application\/dash\+xml*/gi.test(t.type||"")}},{key:"setSources",value:function(t){var e,r;if("object"===mc(t)){if(void 0!==t.id&&(this.sources.id=t.id),void 0===t.assets?this.sources=t:this.sources=Object.assign(this.sources,function(t,e){var r={accountId:t.accountId,assets:t.assets,assetType:t.assetType,captions:t.captions,id:t.id,metadata:t.metadata},n=0;if(t.assets.video){r.video=[];for(var i=0;i<t.assets.video.length;i+=1){var s=t.assets.video[i];-1===s.bitrate&&(r.stream={src:Ku(Array.isArray(s.url)?s.url[0]:s.url||""),type:s.fileType||""}),r.video.push({id:"".concat(n),selected:s.selected||void 0===s.selected&&0===n,label:s.qualityLabel,bitrate:s.bitrate,height:s.height,width:s.width,src:Ku(Array.isArray(s.url)?s.url[0]:s.url||""),type:s.fileType,options:s.options}),n+=1}}if(t.assets.stream){var a,o=t.assets.stream[0].fileType;r.video||(r.video=[]);for(var l=(null===(a=t.assets.stream[0].playlist)||void 0===a?void 0:a.length)||0,u=0;u<l;u+=1){var c,h=null===(c=t.assets.stream[0].playlist)||void 0===c?void 0:c[u];h&&(-1===h.bitrate&&(r.stream={src:Ku(Array.isArray(h.url)?h.url[0]:h.url||""),type:o||""}),r.video.push({id:"".concat(n),selected:!0===h.selected||void 0===h.selected&&0===n,label:h.qualityLabel,bitrate:h.bitrate,height:h.height,width:h.width,src:Ku(Array.isArray(h.url)?h.url[0]:h.url||""),type:o,options:h.options}),n+=1)}}if(t.assets.audio){r.video||(r.video=[]),r.audio||(r.audio=[]);for(var d=function(){var i=t.assets.audio[f],s={id:"".concat(n),selected:i.selected||void 0===i.selected&&0===n,label:i.qualityLabel||"",bitrate:i.bitrate,height:0,width:0,src:Ku(Array.isArray(i.url)?i.url[0]:i.url||""),type:i.fileType,options:i.options};r.audio.push(s),e||(r.video=r.video.filter((function(t){return t.label!==s.label&&t.bitrate!==s.bitrate}))),n+=1},f=0;f<t.assets.audio.length;f+=1)d()}return r}(t,this.plugin.player.controlBar.settingsMenuLegacy)),"string"!=typeof t&&t.language){this.language=hc(t.language);var n=t.languages;void 0!==n&&(this.languages=n)}if(t.assets&&t.assets.filmstrip&&this.plugin.player.trigger("setThumbnails",{url:t.assets.filmstrip},"libs/SourceHandler/index -> setSources"),(void 0===this.sources.video||this.sources.video.length<=0)&&(void 0===this.sources.audio||this.sources.audio.length<=0))try{var i,s;("object"===mc(this.options.asset)&&(null===(i=this.options.asset.assets.stream)||void 0===i||null===(s=i[0].playlist)||void 0===s?void 0:s.length)||0)<=0&&this.plugin.player.trigger("stream-offline",void 0,"libs/SourceHandler/index -> setSources")}catch(t){this.plugin.player.error({code:3,message:"This Live Stream is Currently Offline",source:"libs/SourceHandler/index -> setSources > Offline"})}else this.captions=t.captions,this.defaultSrc=(null===(e=this.sources.video)||void 0===e?void 0:e[0])||(null===(r=this.sources.audio)||void 0===r?void 0:r[0])||{src:""},this.playSrc(this.defaultSrc),this.plugin.player.trigger("settingsMenu-SourceHandler-change",this,"libs/SourceHandler/index -> setSources")}else this.plugin.player.error({code:-1,message:"No Content Found",source:"libs/SourceHandler/index -> setSources > No content"})}},{key:"playAtTime",value:function(t){var e,r,n=this;null===(e=this.plugin.player.play())||void 0===e||null===(r=e.then((function(){n.plugin.player.currentTime(t)})))||void 0===r||r.catch((function(){}))}},{key:"forcePlay",value:function(t){var e,r=this,n=t;n||(n=0),this.plugin.player.currentTime(n),this.plugin.player.pause(),null===(e=this.plugin.player.play())||void 0===e||e.catch((function(){})),this.plugin.player.one("loadedmetadata",(function(){r.playAtTime(n)}))}},{key:"playSrc",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.src){if(t.src.indexOf("storage.sardius.media")>-1||t.src.indexOf("storage.alpha.sardius.media")>-1)try{if("object"===mc(this.plugin.player.options_.plugins.sardius)){var r=this.plugin.player.options_.plugins.sardius,n=r.feedId,i=r.clipStart,s=r.clipDuration,a="";if(n&&(a+="&feedId=".concat(n)),i&&(a+="&clipStart=".concat(i)),s&&(a+="&clipDuration=".concat(s)),a=a.replace(/^&/,"")){var o=t.src.indexOf("?")>-1?"&":"?";t.src="".concat(t.src).concat(o).concat(a)}}}catch(e){console.warn("[Parsing Error]: Couldn't parse url for adding feed id for analytics.",t.src)}try{if(this.plugin.player.youbora){var l=gc(t.src.split("?"),2)[1],u=l?Object.fromEntries(new URLSearchParams(l).entries()):{},c=Object.keys(u).sort().reduce((function(t,e){return t[e]=u[e],t}),{}),h=Object.entries(c).map((function(t){var e=gc(t,2),r=e[0],n=e[1];return"".concat(r,":").concat(n)})).join(","),d=u.trackingId;"object"===mc(this.plugin.player.options_.plugins.sardius)&&(d=this.plugin.player.options_.plugins.sardius.trackingId);var f=d||h;f&&this.plugin.player.youbora({"content.customDimension.8":f})}}catch(e){console.debug("[ANALYTICS_WARNING]: Couldn't record query string for this source: ".concat(t.src))}}var p=this.plugin.player.currentTime();this.autoLoaded=-1===t.bitrate&&this.isStreamingProtocol(t),this.currentSource=t,this.plugin.player.source(t),e&&this.forcePlay(p)}},{key:"switchLanguage",value:function(t){var e="object"===mc(t)&&t.code===this.language,r="object"===mc(this.languages)&&Object.keys(this.languages).length>1;if("string"==typeof t.code&&(this.language=t.code),!e&&r){var n,i;this.options.plugins.youbora&&this.plugin.player.youbora&&(null===(n=(i=this.plugin.player).youbora)||void 0===n||n.call(i,{"content.language":t.code}));var s=this.plugin.player.currentTime();if("string"==typeof t.code){var a=hc(t.code),o=this.languages[a];o&&this.setSources(o)}zl.isIOS?this.plugin.player.play():this.forcePlay(s)}}},{key:"switchBitrate",value:function(t){var e=this,r=this.plugin.player.currentTime();if(this.isStreamingProtocol(t)&&!zl.isIOS)this.switchLevel(t);else{if(t.src&&!t.src.includes("/")){var n=this.plugin.player.currentSrc(),i=n.substring(0,n.lastIndexOf("/")+1);t.src=i+t.src}this.playSrc(t,!0)}this.plugin.player.one("bitrateSwitched",(function(){e.plugin.player.currentTime(r)})),this.forcePlay(r)}},{key:"switchAudioTrack",value:function(t){var e,r,n=this,i=this.plugin.player.currentTime();this.plugin.streamHandler.setCurrentAudioTrack(t),this.plugin.player.one("SP_AUDIO_TRACK_AFTER_SWITCH",(function(){n.plugin.player.currentTime(i)}));var s,a,o=null===(e=this.plugin.streamHandler.lib)||void 0===e||null===(r=e.hls)||void 0===r?void 0:r.allAudioTracks[t];o&&this.options.plugins.youbora&&this.plugin.player.youbora&&(null===(s=(a=this.plugin.player).youbora)||void 0===s||s.call(a,{"content.language":o.lang})),this.forcePlay(i)}},{key:"getBitrateFromSource",value:function(t){var e=parseInt("".concat(t.bitrate),10)||0;if(e<=0)return{level:-1,bitrate:-1};for(var r,n=!1,i=!1,s=-1,a=this.plugin.streamHandler.getLevels()||[],o=0;o<a.length;o+=1){var l=a[o],u=Math.abs(parseInt("".concat(a[o].bitrate),10)-e);if(!(t.width!==l.width&&t.height!==l.height||void 0===t.width&&void 0===t.height))return{level:o,bitrate:l.bitrate};u<=3e4&&(s>u||-1===s)&&(i=a[o].bitrate,n=o,r=l,s=u)}return{level:n,bitrate:i,levelData:r}}},{key:"switchLevel",value:function(t){var e=this,r=[],n=this.plugin.player.currentTime();if(!this.autoLoaded){if(-1!==this.defaultSrc.bitrate)return this.playSrc(t,!0),void this.forcePlay(n);this.playSrc(this.defaultSrc,!0),this.forcePlay(n),r.push(new Promise((function(t){e.plugin.player.one("loadedmetadata",t)}))),r.push(new Promise((function(t){e.plugin.player.one("SP_MANIFEST_AFTER_PARSE",t)})))}Promise.all(r).then(pc(dc().mark((function r(){var i,s,a,o,l,u,c,h,d,f;return dc().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(i=e.getBitrateFromSource(t),s=!1,i.levelData&&Array.isArray(i.levelData.url)?i.levelData.url.forEach((function(e){"string"==typeof e&&t.src&&e.indexOf(t.src)>-1&&(s=!0)})):s=!0,s?(o=i.level,a=o):i.level=t,"number"==typeof a){r.next=19;break}if(!t.src||t.src.includes("//")){r.next=16;break}if("object"===mc(e.plugin.options.asset)&&(e.plugin.options.asset.assets.video?u=e.plugin.options.asset.assets.video[0].url:e.plugin.options.asset.assets.stream&&(u=null===(c=e.plugin.options.asset.assets.stream[0].playlist)||void 0===c?void 0:c[0].url)),!("string"==typeof u&&(null===(l=u)||void 0===l?void 0:l.indexOf("watch.sardius.media"))>-1)){r.next=12;break}return r.next=10,Jo.get(u);case 10:d=r.sent,null!==(h=d.request)&&void 0!==h&&h.responseURL&&(u=d.request.responseURL);case 12:if("string"==typeof u){r.next=14;break}throw new Error("Level Url Not Found");case 14:f=u.substring(0,u.lastIndexOf("/")),t.src="".concat(f,"/").concat(t.src);case 16:return e.playSrc(t,!0),e.forcePlay(n),r.abrupt("return");case 19:e.currentSource=t,e.plugin.streamHandler.setCurrentLevel(a),e.plugin.player.one("SP_LEVEL_AFTER_SWITCH",(function(){e.plugin.player.currentTime(n)}));case 22:case"end":return r.stop()}}),r)}))))}}],r&&yc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();function Tc(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function _c(t){return _c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_c(t)}function Ac(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,wc(n.key),n)}}function Lc(t,e,r){return(e=wc(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wc(t){var e=function(t,e){if("object"!==_c(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==_c(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===_c(e)?e:String(e)}var Rc=function(){function t(e,r){var n=this;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),Lc(this,"options",void 0),Lc(this,"player",void 0),Lc(this,"VERSION",void 0),Lc(this,"playerEl",void 0),Lc(this,"videoEl",void 0),Lc(this,"protocol",void 0),Lc(this,"streamHandler",void 0),Lc(this,"sourceHandler",void 0),this.player=r,this.options=e,"object"===_c(e.asset)&&e.asset.protocol){var i=e.asset.protocol;this.protocol=i}this.playerEl=r.el();var s,a,o=(s=Array.from(this.playerEl.getElementsByTagName("video")),a=1,function(t){if(Array.isArray(t))return t}(s)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(s,a)||function(t,e){if(t){if("string"==typeof t)return Tc(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)?Tc(t,e):void 0}}(s,a)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];this.videoEl=o,this.VERSION="__VERSION__",this.init(),this.libs(),this.player.ready((function(){n.ready()})),this.player.on("seeked",(function(){n.seekToLive()})),this.player.one("play",(function(){n.seekToLive()}))}var e,r;return e=t,(r=[{key:"init",value:function(){this.videoEl.setAttribute("crossorigin","anonymous")}},{key:"seekToLive",value:function(){var t=this;if(zl.isIOS)var e=0,r=setInterval((function(){e>10&&clearInterval(r),e+=1;var n=document.querySelectorAll("video"),i=document.createElement("video");Array.from(n).forEach((function(e){e&&e.id&&t.player&&"function"==typeof t.player.id&&e.id.indexOf(t.player.id())>-1&&(i=e)})),null!==i&&i.src&&(clearInterval(r),i.duration===1/0&&i.currentTime<=5&&(i.currentTime=3154e4))}),100)}},{key:"libs",value:function(){this.player.options_.youtube||(this.streamHandler=new mu(this)),this.player.playerManager=new Tu(this),this.player.options_.youtube||(this.sourceHandler=new bc(this)),this.options.uid=this.player.options_.uid||"",new Du(this)}},{key:"ready",value:function(){this.player.addClass("vjs-sardius")}}])&&Ac(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();var kc=r(8259),Dc=r.n(kc);function Ic(t){return Ic="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ic(t)}function Pc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Nc(n.key),n)}}function Oc(){return Oc="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Mc(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Oc.apply(this,arguments)}function Cc(t,e){return Cc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cc(t,e)}function xc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Mc(t){return Mc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mc(t)}function Fc(t,e,r){return(e=Nc(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Nc(t){var e=function(t,e){if("object"!==Ic(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Ic(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Ic(e)?e:String(e)}var Bc=videojs,Uc=Bc.getComponent("Component"),jc=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cc(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Mc(n);if(i){var r=Mc(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ic(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return xc(t)}(this,t)});function a(t,e){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),Fc(xc(r=s.call(this,t,e)),"player",void 0),Fc(xc(r),"isDvr",void 0),Fc(xc(r),"isLive",void 0),Fc(xc(r),"isSimLive",void 0),Fc(xc(r),"isIOS",void 0),Fc(xc(r),"isNoDvrPlayer",void 0),Fc(xc(r),"liveDelay",void 0),Fc(xc(r),"simLiveLiveDelay",void 0),Fc(xc(r),"rewindDuration",void 0),Fc(xc(r),"isAd",void 0),Fc(xc(r),"liveScrubEvent",void 0),Fc(xc(r),"remotePlayback",void 0),r.isDvr=!1,r.player=function(){return t},r.isLive=!1,r.isSimLive=!1,r.isIOS=zl.isIOS,r.isNoDvrPlayer=!1,r.liveDelay=90,r.simLiveLiveDelay=60,r.rewindDuration=30,r.isAd=!1,e.playerOptions&&e.playerOptions.plugins&&"object"===Ic(e.playerOptions.plugins.sardius)&&e.playerOptions.plugins.sardius.asset&&e.playerOptions.plugins.sardius.asset.isLive&&(r.isLive=e.playerOptions.plugins.sardius.asset.isLive),e.playerOptions&&e.playerOptions.plugins&&"object"===Ic(e.playerOptions.plugins.sardius)&&e.playerOptions.plugins.sardius.asset&&("simlive"===e.playerOptions.plugins.sardius.asset.assetType||"simliveFeed"===e.playerOptions.plugins.sardius.asset.assetType)&&(r.isSimLive=!0),t.playerManager&&t.playerManager.plugin&&t.playerManager.plugin.options&&t.playerManager.plugin.options.liveDelay&&(r.liveDelay=t.playerManager.plugin.options.liveDelay,r.simLiveLiveDelay=t.playerManager.plugin.options.simLiveLiveDelay||r.simLiveLiveDelay),e.playerOptions&&e.playerOptions.plugins&&"object"===Ic(e.playerOptions.plugins.sardius)&&e.playerOptions.plugins.sardius.rewindDuration&&(r.rewindDuration=parseInt("".concat(e.playerOptions.plugins.sardius.rewindDuration))),r.hide(),r.on(t,"SP_LEVEL_UPDATED_PTS",r.updateShowing),r.one(t,"SP_LEVEL_UPDATED_PTS",(function(e,n){n.details&&(n.details.totalduration<r.liveDelay&&(r.liveDelay=n.details.totalduration-10,r.isSimLive&&r.handleSimLiveLiveDelay(n.details.totalduration)),n.details.live&&(r.liveScrubEvent=r.on(t,"seeked",r.preventScrubToLive)))})),e.playerOptions&&e.playerOptions.plugins&&"object"===Ic(e.playerOptions.plugins.sardius)&&"noDvr"===e.playerOptions.plugins.sardius.playerId?(r.isNoDvrPlayer=!0,t.one("playing",(function(){r.isLive&&(r.updateShowing("",{details:{live:!0}}),r.isDvr&&r.handleClick(),t.on("play",(function(){r.isLive&&r.isDvr&&r.handleClick()})))})),t.on("playing",(function(){r.isLive&&r.isDvr&&r.updateShowing("",{details:{live:!0}})}))):t.one("playing",(function(){r.isLive&&(r.updateShowing("",{details:{live:!0}}),r.isDvr&&r.handleClick())})),!r.isLive&&(r.contentEl()&&(r.contentEl().classList.remove("sp-live-button-enabled"),r.contentEl().classList.remove("sp-live-button-disabled"),r.contentEl().classList.add("sp-live-button-back"),r.contentEl().innerHTML="".concat(r.rewindDuration)),r.isIOS)){var n,i,o=((null===(n=r.player().controlBar)||void 0===n?void 0:n.progressControl)||{}).childNameIndex_;o&&o.SeekBar&&o.SeekBar.childNameIndex_&&o.SeekBar.childNameIndex_.PlayProgressBar&&o.SeekBar.childNameIndex_.PlayProgressBar.el_&&(i=r.player().controlBar.progressControl.childNameIndex_.SeekBar.childNameIndex_.PlayProgressBar.el_),i&&i.classList.contains("sp-live-control")&&i.classList.remove("sp-live-control"),r.player().remotePlayback||r.show()}return r}return e=a,(r=[{key:"handleSimLiveLiveDelay",value:function(t){t<this.simLiveLiveDelay&&(this.liveDelay=Math.min(2*t,this.simLiveLiveDelay))}},{key:"preventScrubToLive",value:function(){this.player().duration()-this.player().currentTime()<this.liveDelay/2-1&&!this.player().remotePlayback?zl.isSafari||this.player().currentTime(this.player().duration()-this.liveDelay/2):this.updateShowing("",{details:{live:!0}})}},{key:"createEl",value:function(){var t=Oc(Mc(a.prototype),"createEl",this).call(this,"div");return t.classList.add("vjs-live-control","sp-live-toggle"),this.contentEl_=document.createElement("div"),this.contentEl_.classList.add("sp-live-button"),this.contentEl_.innerHTML="LIVE",t.appendChild(this.contentEl_),t}},{key:"updateShowing",value:function(t,e){var r;this.isSimLive&&e&&e.details&&e.details.totalduration&&this.handleSimLiveLiveDelay(e.details.totalduration),this.isLive&&e&&e.details&&!e.details.live&&this.player().off("seeking",this.preventScrubToLive),e&&e.details&&(this.isLive=null!==(r=e.details.live)&&void 0!==r&&r);var n=this.player().duration();if(!(n<=30||this.isAd)){var i,s=n-this.player().currentTime(),a=this.player().controlBar.progressControl.childNameIndex_;a&&a.SeekBar&&a.SeekBar.childNameIndex_&&a.SeekBar.childNameIndex_.PlayProgressBar&&a.SeekBar.childNameIndex_.PlayProgressBar.el_&&(i=a.SeekBar.childNameIndex_.PlayProgressBar.el_),this.isLive?(s<=this.liveDelay||this.isSimLive&&this.liveDelay<this.simLiveLiveDelay?(this.isDvr=!1,this.contentEl_&&(this.contentEl_.classList.add("sp-live-button-enabled"),this.contentEl_.classList.remove("sp-live-button-disabled"),this.contentEl_.classList.remove("sp-live-button-back"),this.contentEl_.innerHTML="LIVE"),i&&i.classList.add("sp-live-control")):(this.isNoDvrPlayer&&s>=3*this.liveDelay&&this.handleClick(),this.isDvr=!0,i&&i.classList.contains("sp-live-control")&&i.classList.remove("sp-live-control"),this.contentEl_&&(this.contentEl_.innerHTML="LIVE",this.contentEl_.classList.remove("sp-live-button-enabled"),this.contentEl_.classList.add("sp-live-button-disabled"),this.contentEl_.classList.remove("sp-live-button-back"))),this.player().remotePlayback||this.show()):(i&&i.classList.contains("sp-live-control")&&i.classList.remove("sp-live-control"),this.contentEl_&&(this.contentEl_.classList.remove("sp-live-button-enabled"),this.contentEl_.classList.remove("sp-live-button-disabled"),this.contentEl_.classList.add("sp-live-button-back"),this.contentEl_.innerHTML="".concat(this.rewindDuration)),this.player().remotePlayback||this.show())}}},{key:"handleClick",value:function(){if(!this.isAd)if(this.isLive&&this.isDvr&&!this.remotePlayback&&this.player().hasStarted())this.player().currentTime(this.player().duration()-(this.liveDelay-this.liveDelay/2)),this.updateShowing("",{details:{live:!0}});else if(!this.isLive){var t=this.player().currentTime()-this.rewindDuration;t>=0&&this.player().currentTime(t)}}}])&&Pc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Bc.getComponent("Button"));Uc.registerComponent("LiveToggle",jc);const Hc=function(t){return t instanceof HTMLElement};function Gc(t){return Gc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Gc(t)}function Vc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yc(n.key),n)}}function Kc(t,e){return Kc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kc(t,e)}function $c(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Wc(t){return Wc=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wc(t)}function qc(t,e,r){return(e=Yc(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yc(t){var e=function(t,e){if("object"!==Gc(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Gc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Gc(e)?e:String(e)}const zc=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kc(t,e)}(a,videojs.getComponent("MenuItem"));var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Wc(n);if(i){var r=Wc(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Gc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return $c(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),qc($c(r=s.call(this,t,e)),"player",void 0),qc($c(r),"options",void 0),qc($c(r),"passedPlayer",void 0),qc($c(r),"passedOptions",void 0),r.passedPlayer=t,r.passedOptions=e,r.player=function(){return r.passedPlayer},r.options=function(){return r.passedOptions},r.init(),r}return e=a,(r=[{key:"init",value:function(){try{var t,e,r=this.options(),n=(null===(t=r.data)||void 0===t?void 0:t.label)||(null===(e=r.data)||void 0===e?void 0:e.name);this.el().id="".concat(null==n?void 0:n.replace(/[()\s]+/g,""),"-").concat(this.player().id())}catch(t){console.warn("SP_MENU_WARNING: No Label Was Specified for this Item",this),console.warn(t),this.el().id="sp-menu-item-".concat(Math.floor(1e4*Math.random()))}try{var i=this.options().classes;if(!i)throw new Error("No classes");this.addClass(i)}catch(t){console.warn("SP_MENU_WARNING: No Classes Were Specified for this Item",this),console.warn(t)}this.options().isActive&&this.selected(!0)}},{key:"active",value:function(t){t?this.selected(!0):this.selected(!1)}},{key:"handleClick",value:function(){try{var t=this.options().callback;try{var e=this.options().data;e&&(null==t||t(e,this))}catch(t){console.error("SP_MENU_ERROR: Something Went Wrong With the Item Callback",this),console.error(t)}}catch(t){console.error("SP_MENU_ERROR: This Item Does Not Have A Callback Function",this),console.error(t)}}}])&&Vc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}();function Xc(t){return Xc="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xc(t)}function Jc(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,rh(n.key),n)}}function Qc(t,e){return Qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Qc(t,e)}function Zc(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function th(t){return th=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},th(t)}function eh(t,e,r){return(e=rh(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function rh(t){var e=function(t,e){if("object"!==Xc(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Xc(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Xc(e)?e:String(e)}const nh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Qc(t,e)}(a,videojs.getComponent("Menu"));var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=th(n);if(i){var r=th(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Xc(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Zc(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),eh(Zc(r=s.call(this,t,e)),"player",void 0),eh(Zc(r),"options",void 0),eh(Zc(r),"menu",void 0),eh(Zc(r),"parentEl",void 0),eh(Zc(r),"items",void 0),eh(Zc(r),"passedPlayer",void 0),eh(Zc(r),"passedOptions",void 0),r.passedOptions=e,r.passedPlayer=t,r.player=function(){return r.passedPlayer},r.options=function(){return r.passedOptions},r.items=[],r}return e=a,r=[{key:"sortOrder",value:function(t,e){return"number"==typeof t&&"number"==typeof e?e-t:"object"===Xc(e)&&"object"===Xc(t)&&"number"==typeof e.order&&"number"==typeof t.order?(e.order||0)-(t.order||0):0}},{key:"addItems",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.items.map((function(t){return t.options_.label})),n=[];t.forEach((function(t){-1===r.indexOf(t.label)&&n.push(t)}));var i=this.options().minItems;if(void 0===i&&(i=1),i<=n.length){e||this.clearGroup(),n.sort(this.sortOrder);for(var s=0;s<n.length;s+=1)if(n[s].error)console.warn("SP_MENU_WARNING: This item was unable to be added to ".concat(this.options().id),n[s]);else{var a=new zc(this.player(),n[s]);this.items.push(a),this.addItem(a)}this.options().id&&(this.contentEl().id="".concat(this.options().id,"-").concat(this.player().id())),this.contentEl().classList.remove("vjs-menu-content"),this.menu?this.menu.contentEl().insertBefore(this.contentEl(),this.menu.contentEl().childNodes[0]):this.player().el().appendChild(this.el()),this.parentEl&&this.parentEl.show()}this.items=this.items.filter((function(t,e,r){return e===r.findIndex((function(e){return e.options_.label===t.options_.label}))}))}},{key:"setActiveItem",value:function(t){for(var e=0;e<this.items.length;e+=1)this.items[e].selected(!1);t&&t.selected(!0)}},{key:"clearGroup",value:function(){for(;this.contentEl().firstChild;){var t=this.contentEl().firstChild;null!==t&&this.contentEl().removeChild(t)}}}],r&&Jc(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}();function ih(t){return ih="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ih(t)}function sh(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,hh(n.key),n)}}function ah(){return ah="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=uh(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},ah.apply(this,arguments)}function oh(t,e){return oh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},oh(t,e)}function lh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function uh(t){return uh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},uh(t)}function ch(t,e,r){return(e=hh(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function hh(t){var e=function(t,e){if("object"!==ih(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==ih(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===ih(e)?e:String(e)}const dh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&oh(t,e)}(a,videojs.getComponent("MenuButton"));var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=uh(n);if(i){var r=uh(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===ih(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return lh(t)}(this,t)});function a(t,e,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),ch(lh(n=s.call(this,t,e)),"player",void 0),ch(lh(n),"options",void 0),ch(lh(n),"parentEl",void 0),ch(lh(n),"passedPlayer",void 0),ch(lh(n),"passedOptions",void 0),ch(lh(n),"onClick",void 0),n.passedOptions=e,n.passedPlayer=t,n.player=function(){return n.passedPlayer},n.options=function(){return n.passedOptions},n.onClick=r,n.parentEl||(n.parentEl=void 0),n.el().addEventListener("touchstart",(function(t){var e,r=t.target;null!=r&&null!==(e=r.classList)&&void 0!==e&&e.contains("vjs-menu-button")&&n.handleTouch()})),n.player().ready((function(){var t=n.el();t&&t.classList&&t.classList.contains("sp-menuBar-button")&&(t.classList.add("sp-menu-closed"),t.addEventListener("mouseup",(function(t){var e,r=t.target;null!=r&&null!==(e=r.classList)&&void 0!==e&&e.contains("vjs-menu-button")&&n.handleTouch()})))})),n}return e=a,r=[{key:"show",value:function(){ah(uh(a.prototype),"show",this).call(this),this.el().classList.contains("vjs-icon-captions")&&this.player().trigger("captionsButtonShowing",void 0,"libs/Menu/index -> show")}},{key:"addGroup",value:function(t){var e=new nh(this.player(),t);return e.menu=this.menu,e.parentEl=this,t.id||(t.id="sp-menu-group-".concat(Math.floor(1e4*Math.random()))),e.el().id=t.id,t.classes&&(t.classes.indexOf(" ")>-1?t.classes.split(" ").forEach((function(t){e.contentEl().classList.add(t)})):e.contentEl().classList.add(t.classes)),e}},{key:"toggleMenuBarControls",value:function(){var t=this.player().el();if(t){var e=t.querySelector("#".concat(this.player().id(),"_menuBar "));if(e){var r=e.querySelectorAll(":scope > .vjs-control");Array.from(r).forEach((function(t){t.classList.remove("sp-menu-opened"),t.classList.add("sp-menu-closed")}))}}}},{key:"handleTouch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"function"==typeof this.onClick&&this.onClick();var r=this.menu.el();!0!==e&&this.el().classList.add("sp-ios-remove-hover");var n=document.getElementsByClassName("vjs-menu");if(this.toggleMenuBarControls(),Hc(r)&&"block"!==r.style.display&&"mouseout"!==(null==t?void 0:t.type)){for(var i=0;i<n.length;i+=1){var s=n[i];if(Hc(s)){s.style.display="none";try{n[i]=s}catch(t){}}}var a=this.menu.el();Hc(a)&&(a.style.display="block"),this.el().classList.add("sp-menu-opened"),this.el().classList.remove("sp-menu-closed")}else if("mouseout"===(null==t?void 0:t.type))for(var o=0;o<n.length;o+=1){var l=n[o];Hc(l)&&(l.style.display="none",n[o]=l)}else{var u=this.menu.el();Hc(u)&&(u.style.display="none"),this.el().classList.add("sp-menu-closed"),this.el().classList.remove("sp-menu-opened")}}}],r&&sh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}();function fh(t){return fh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},fh(t)}function ph(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function gh(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ph(Object(r),!0).forEach((function(e){Sh(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ph(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function vh(t,e){return vh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},vh(t,e)}function mh(t,e){if(e&&("object"===fh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return yh(t)}function yh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Eh(t){return Eh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Eh(t)}function Sh(t,e,r){return(e=bh(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function bh(t){var e=function(t,e){if("object"!==fh(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==fh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===fh(e)?e:String(e)}var Th=videojs,_h=Th.getComponent("Component"),Ah=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&vh(t,e)}(s,t);var e,r,n,i=(r=s,n=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}}(),function(){var t,e=Eh(r);if(n){var i=Eh(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return mh(this,t)});function s(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),Sh(yh(r=i.call(this,t,e)),"isIOS",void 0),Sh(yh(r),"isOpen",void 0),Sh(yh(r),"menu",void 0),Sh(yh(r),"isTouchOnly",void 0),r.player=function(){return t};var n,a,o,l=new dh(t,e);r.isIOS=!1,r.isOpen=!1,r.menu=l,r.isTouchOnly=window.matchMedia("(pointer: coarse)").matches,l.menuButton_&&l.menuButton_.el_&&(l.menuButton_.el_.style.pointerEvents="none"),l.addClass("sp-icon-cog"),l.addClass("vjs-icon-cog"),l.addClass("sp-icon-settingsMenu"),l.hide(),zl.isIOS&&(r.isIOS=!0,"string"!=typeof t.playerManager.plugin.options.asset&&void 0!==(null===(n=t.playerManager.plugin.options.asset)||void 0===n?void 0:n.assets.stream)&&l.addClass("sp-menu-ios-live"));var u=function(t){var e=t,r=e.toLowerCase().replace(/[^a-z0-9]+/gi,"");return o&&void 0!==o[r]&&(e=o[r]),e},c=l.addGroup({classes:"sp-bitrate sp-menuBar-menu",id:"sp-bitrate",minItems:2});t.bitratesMenu=c;var h=function(){var e=[],n=[];if(a&&a.sources&&a.sources.video){for(var i=0;i<a.sources.video.length;i+=1){var s=a.sources.video[i],o=s.bitrate;if(void 0!==o&&"string"!=typeof o&&o<1&&(o=1/0),e.indexOf(s.label)<0){var h=u(s.label||"");e.push(s.label),n.push({classes:"sp-menu-item",label:h,order:o,selectable:!0,isActive:0===i,data:s,callback:function(e,n){if(!n.isSelected_){c.setActiveItem(n),a.switchBitrate(gh(gh({},e),{},{currentTime:r.player().currentTime()})),t.trigger("bitrateSwitched",gh(gh({},e),{},{currentTime:r.player().currentTime()}),"plugins/SettingsMenu -> setBitrates > menu item callback"),t.playerManager.plugin.options.audioOnlyToggledOn=!1;var i=document.getElementsByClassName("sp-menuBar-button");Array.from(i).forEach((function(t){t.classList.remove("sp-audioOnlyToggledOn")}))}}})}}c.addItems(n)}n.length<=1&&l.hide()};return t.on("settingsMenu-menuLabels",(function(e,r){(o=r)&&(t.trigger("showQualityMenu",void 0,"plugins/SettingsMenu -> constructor > on(settingsMenu-menuLabels) > menu item callback"),l.show(),h())})),t.on("settingsMenu-SourceHandler-change",(function(e,r){(a=r)&&(t.trigger("showQualityMenu",void 0,"plugins/SettingsMenu -> constructor > on(settingsMenu-SourceHandler-change) > menu item callback"),l.show(),h())})),zl.isIOS||t.ready((function(){var t=l.el();t.addEventListener("mouseover",(function(t){l.handleTouch(t,!0)})),t.addEventListener("mouseout",(function(t){l.handleTouch(t,!0)}))})),mh(r,l)}return e=s,Object.defineProperty(e,"prototype",{writable:!1}),e}(Th.getComponent("Button"));function Lh(t){return Lh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Lh(t)}function wh(t){return function(t){if(Array.isArray(t))return Rh(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Rh(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)?Rh(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function kh(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Dh(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?kh(Object(r),!0).forEach((function(e){xh(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):kh(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Ih(t,e){return Ih=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Ih(t,e)}function Ph(t,e){if(e&&("object"===Lh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Oh(t)}function Oh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ch(t){return Ch=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ch(t)}function xh(t,e,r){return(e=Mh(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Mh(t){var e=function(t,e){if("object"!==Lh(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Lh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Lh(e)?e:String(e)}_h.registerComponent("settingsMenu",Ah);var Fh=videojs.getComponent("Component"),Nh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ih(t,e)}(s,t);var e,r,n,i=(r=s,n=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}}(),function(){var t,e=Ch(r);if(n){var i=Ch(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return Ph(this,t)});function s(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),xh(Oh(r=i.call(this,t,e)),"player",void 0),xh(Oh(r),"options",void 0),xh(Oh(r),"isIOS",void 0),xh(Oh(r),"isOpen",void 0),xh(Oh(r),"menu",void 0),xh(Oh(r),"isTouchOnly",void 0),r.player=function(){return t},r.options=function(){return e};var n,a,o,l=new dh(t,e);r.isIOS=!1,r.isOpen=!1,r.menu=l,r.isTouchOnly=window.matchMedia("(pointer: coarse)").matches,l.menuButton_&&l.menuButton_.el_&&(l.menuButton_.el_.style.pointerEvents="none"),l.addClass("vjs-icon-cog"),zl.isIOS&&(r.isIOS=!0,"string"!=typeof t.playerManager.plugin.options.asset&&void 0!==(null===(n=t.playerManager.plugin.options.asset)||void 0===n?void 0:n.assets.stream)&&l.addClass("sp-menu-ios-live"));var u=function(t){var e=t,r=e.toLowerCase().replace(/[^a-z0-9]+/gi,"");return void 0!==o[r]&&(e=o[r]),e},c=function(t){if(t.length>1&&r.isTouchOnly&&r.player().controlBar.settingsMenuLegacy){for(var e=r.player().controlBar.settingsMenuLegacy.children_[1].contentEl_.childNodes,n=0;n<e.length;n+=1)e[n].classList.contains("sp-bitrate")&&e[n].classList.add("sp-bitrate-touch");r.player().controlBar.settingsMenuLegacy.children_[1].contentEl_.classList.add("sp-menu-content-touch"),r.isIOS||(r.player().controlBar.settingsMenuLegacy.children_[1].contentEl_.style.left="-8em")}},h=l.addGroup({classes:"sp-language",id:"sp-language",minItems:2}),d=zl.isIOS||zl.isNewIphone;d&&!r.player().playerManager.plugin.options.showBitrates&&h.contentEl().classList.add("sp-no-bitrates");var f=l.addGroup({classes:"sp-language",id:"sp-audio-tracks",minItems:2});d&&!r.player().playerManager.plugin.options.showBitrates&&f.contentEl().classList.add("sp-no-bitrates");var p=l.addGroup({classes:"sp-bitrate",id:"sp-bitrate",minItems:2});t.audioTracksMenu=f,t.bitratesMenu=p;var g=function(){var e=[];r.isIOS?t.one("canplay",(function(){var r=t.audioTracks();r.addEventListener("change",(function(){t.trigger("SP_AUDIO_TRACK_AFTER_SWITCH",void 0,"plugins/SettingsMenuLegacy -> setAudioTracks > isIOS > one(canplay)")}));var n=t.playerManager.plugin.options.locale||"en",i=0;if(r.length>1){for(var s=[],o=function(o){var l=r.length-o,c=uu(n).isoEquivalent,h=r[o].language;c!==h&&n!==h||(i=o),e.indexOf(r[o].label)<0&&(e.push(r[o].label),s.push({classes:"sp-menu-item",label:u(r[o].label),id:"".concat(o),selectable:!0,order:l,isActive:!1,data:r[o],callback:function(e,r){r.isSelected_||(f.setActiveItem(r),a.switchAudioTrack(o),t.trigger("audioTrackSwitched",e,"plugins/SettingsMenuLegacy -> setAudioTracks > isIOS > menu item callback"))}}))},l=0;l<r.length;l+=1)o(l);f.addItems(s);try{f.setActiveItem(f.items[i])}catch(t){console.warn("Couldn't set starting audio track:",t)}a.switchAudioTrack(i),c(s)}})):t.on("SP_LIB_READY",(function(){var n;null!==(n=a.plugin.streamHandler.lib)&&void 0!==n&&n.hls&&t.on("SP_AUDIO_TRACK_UPDATED_LIST",(function(n,i){var s,o=i.audioTracks;o.forEach((function(t,e){var r,n=((null===(r=t.url)||void 0===r?void 0:r.split("/").pop())||"").replace(/.m3u8$/,"");n&&("und"===i.audioTracks[e].lang&&(i.audioTracks[e].lang=n),"und"===i.audioTracks[e].name&&(i.audioTracks[e].name=n),i.audioTracks[e].attrs&&("und"===i.audioTracks[e].attrs.name&&(i.audioTracks[e].attrs.name=n),"und"===i.audioTracks[e].attrs.language&&(i.audioTracks[e].attrs.language=n)))}));for(var l=[],h=function(r){var n,i=o.length-r;n=!0===o[r].default||0===r,o[r].name&&e.indexOf(o[r].name)<0&&(e.push(o[r].name),l.push({classes:"sp-menu-item",label:u(o[r].name),id:"".concat(r),selectable:!0,order:i,isActive:n,data:Dh(Dh({},o[r]),{},{id:"".concat(o[r].id)}),callback:function(e,n){n.isSelected_||(f.setActiveItem(n),a.switchAudioTrack(r),t.trigger("audioTrackSwitched",e,"plugins/SettingsMenuLegacy -> setAudioTracks > menu item callback"))}}))},d=0;d<o.length;d+=1)h(d);if(f.addItems(l),c(l),null!==(s=r.options().playerOptions)&&void 0!==s&&s.bitmovinMultiAudioOutputFix&&l.length>1){var p=!1;l.forEach((function(t,e){var r;null!==(r=t.data)&&void 0!==r&&r.default&&!p?(l[e].isActive=!1,f.setActiveItem(f.items[e]),a.switchAudioTrack(e),p=!0):l[e].isActive=!1})),p||(l[0].isActive=!1,f.setActiveItem(f.items[0]),a.switchAudioTrack(0))}}))}))},v=function(){var e=[],r=[];if(a.sources&&a.sources.video){var n=a.sources.video;a.sources.audio&&(n=[].concat(wh(n),wh(a.sources.audio)));for(var i=0;i<n.length;i+=1){var s=n[i],o=s.bitrate;if(void 0!==o&&"string"!=typeof o&&o<1&&(o=1/0),e.indexOf(s.label)<0){var l=u(s.label||"");e.push(s.label),r.push({classes:"sp-menu-item",label:l,order:o,selectable:!0,isActive:0===i,data:s,callback:function(e,r){r.isSelected_||(p.setActiveItem(r),a.switchBitrate(e),t.trigger("bitrateSwitched",e,"plugins/SettingsMenuLegacy -> setBitrates > menu item callback"))}})}}p.addItems(r)}},m=function(){var e=[];if(a&&a.languages){for(var r=Object.keys(a.languages),n=0;n<r.length;n+=1){var i=r[n],s={code:i,label:i};e.push({classes:"sp-menu-item",label:u(i),order:n,selectable:!0,id:i,isActive:i===a.language,data:s,callback:function(e,r){h.setActiveItem(r),a.switchLanguage(e),t.trigger("languageSwitched",e,"plugins/SettingsMenuLegacy -> setLanguages > menu item callback")}})}h.addItems(e),c(e)}},y=function(){var t=f&&f.items&&Array.isArray(f.items)?f.items.length:0,e=h&&h.items&&Array.isArray(h.items)?h.items.length:0,r=p&&p.items&&Array.isArray(p.items)?p.items.length:0;t>1||e>1||r>1?l.show():l.hide()};return t.on("settingsMenu-menuLabels",(function(t,e){o=e,a&&(d&&!r.player().playerManager.plugin.options.showBitrates||v(),m(),g(),y())})),t.on("settingsMenu-SourceHandler-change",(function(t,e){a=e,o&&(d&&!r.player().playerManager.plugin.options.showBitrates||v(),m(),g(),y())})),Ph(r,l)}return e=s,Object.defineProperty(e,"prototype",{writable:!1}),e}(Fh);function Bh(t){return Bh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bh(t)}function Uh(t,e){return Uh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Uh(t,e)}function jh(t,e){if(e&&("object"===Bh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Hh(t)}function Hh(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Gh(t){return Gh=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Gh(t)}function Vh(t,e,r){return(e=Kh(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Kh(t){var e=function(t,e){if("object"!==Bh(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Bh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Bh(e)?e:String(e)}Fh.registerComponent("settingsMenuLegacy",Nh);var $h=videojs,Wh=$h.getComponent("Component"),qh=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Uh(t,e)}(s,t);var e,r,n,i=(r=s,n=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}}(),function(){var t,e=Gh(r);if(n){var i=Gh(this).constructor;t=Reflect.construct(e,arguments,i)}else t=e.apply(this,arguments);return jh(this,t)});function s(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,s),Vh(Hh(r=i.call(this,t,e)),"player",void 0),Vh(Hh(r),"isIOS",void 0),Vh(Hh(r),"isOpen",void 0),Vh(Hh(r),"menu",void 0),Vh(Hh(r),"isTouchOnly",void 0),r.player=function(){return t};var n,a,o,l=new dh(t,e);r.isIOS=!1,r.isOpen=!1,r.menu=l,r.isTouchOnly=window.matchMedia("(pointer: coarse)").matches,l.menuButton_&&l.menuButton_.el_&&(l.menuButton_.el_.style.pointerEvents="none"),l.addClass("sp-icon-languages"),zl.isIOS&&(r.isIOS=!0,"string"!=typeof t.playerManager.plugin.options.asset&&void 0!==(null===(n=t.playerManager.plugin.options.asset)||void 0===n?void 0:n.assets.stream)&&l.addClass("sp-menu-ios-live"));var u=l.addGroup({classes:"sp-language sp-menuBar-menu",id:"sp-language",minItems:2});zl.isIOS&&!r.player().playerManager.plugin.options.showBitrates&&u.contentEl().classList.add("sp-no-bitrates");var c=function(){var e,n,i,s=[];if(a&&a.languages){for(var c=Object.keys(a.languages),h=0;h<c.length;h+=1){var d=c[h],f={code:d,label:d};s.push({classes:"sp-menu-item",label:(e=d,n=void 0,void 0,n=e,i=n.toLowerCase().replace(/[^a-z0-9]+/gi,""),o&&void 0!==o[i]&&(n=o[i]),n),order:h,selectable:!0,id:d,isActive:d===a.language,data:f,callback:function(e,r){u.setActiveItem(r),a.switchLanguage(e),t.trigger("languageSwitched",e,"plugins/LanguagesMenu -> setLanguages > menu item callback"),t.playerManager.plugin.options.audioOnlyToggledOn=!1;var n=document.getElementsByClassName("sp-icon-cog");Array.from(n).forEach((function(t){t.classList.remove("sp-audioOnlyToggledOn")}))}})}u.addItems(s),function(t){if(t.length>1&&r.isTouchOnly&&r.player().controlBar.settingsMenu){for(var e=r.player().controlBar,n=e.settingsMenu.children_[1].contentEl_.childNodes,i=0;i<n.length;i+=1)n[i].classList.contains("sp-bitrate")&&n[i].classList.add("sp-bitrate-touch");e.settingsMenu.children_[1].contentEl_.classList.add("sp-menu-content-touch"),r.isIOS||(e.settingsMenu.children_[1].contentEl_.style.left="-8em")}}(s),s.length<=1&&l.hide()}};return t.on("settingsMenu-menuLabels",(function(t,e){o=e,a&&c()})),t.on("settingsMenu-SourceHandler-change",(function(t,e){a=e,o&&c()})),t.ready((function(){var t=l.el();t.addEventListener("mouseover",(function(t){l.handleTouch(t,!0)})),t.addEventListener("mouseout",(function(t){l.handleTouch(t,!0)}))})),jh(r,l)}return e=s,Object.defineProperty(e,"prototype",{writable:!1}),e}($h.getComponent("Button"));function Yh(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function zh(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Xh(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?zh(Object(r),!0).forEach((function(e){nd(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):zh(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Jh(t){return Jh="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jh(t)}function Qh(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,id(n.key),n)}}function Zh(t,e){return Zh=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Zh(t,e)}function td(t,e){if(e&&("object"===Jh(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return ed(t)}function ed(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function rd(t){return rd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},rd(t)}function nd(t,e,r){return(e=id(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function id(t){var e=function(t,e){if("object"!==Jh(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Jh(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Jh(e)?e:String(e)}Wh.registerComponent("languagesMenu",qh);var sd=videojs,ad=sd.getComponent("Component"),od=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Zh(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=rd(n);if(i){var r=rd(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return td(this,t)});function a(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),nd(ed(r=s.call(this,t,e)),"player",void 0),nd(ed(r),"asset",void 0),nd(ed(r),"isPlaybackWireless",void 0),nd(ed(r),"isIOS",void 0),nd(ed(r),"isOpen",void 0),nd(ed(r),"menu",void 0),nd(ed(r),"isTouchOnly",void 0),nd(ed(r),"audioTracksFound",void 0),nd(ed(r),"sourceHandler",void 0),nd(ed(r),"previousBitrate",void 0),r.player=function(){return t};var n=t.playerManager.plugin.options.asset;"object"===Jh(n)&&(r.asset=n);var i,o,l,u=new dh(t,e,(function(){return r.handleClick(ed(r))}));r.isIOS=!1,r.isOpen=!1,r.menu=u,r.isTouchOnly=window.matchMedia("(pointer: coarse)").matches,r.audioTracksFound=0,u.menuButton_&&u.menuButton_.el_&&(u.menuButton_.el_.style.pointerEvents="none"),u.addClass("sp-icon-audioTracks"),u.addClass("".concat(r.player().id_,"_sp-icon-audioTracks")),zl.isIOS&&(r.isIOS=!0,"string"!=typeof t.playerManager.plugin.options.asset&&void 0!==(null===(i=t.playerManager.plugin.options.asset)||void 0===i?void 0:i.assets.stream)&&u.addClass("sp-menu-ios-live"));var c=function(t){if(t.length>1&&r.isTouchOnly&&r.player().controlBar.settingsMenu){for(var e=r.player().controlBar,n=e.settingsMenu.children_[1].contentEl_.childNodes,i=0;i<n.length;i+=1)n[i].classList.contains("sp-bitrate")&&n[i].classList.add("sp-bitrate-touch");e.settingsMenu.children_[1].contentEl_.classList.add("sp-menu-content-touch"),r.isIOS||(e.settingsMenu.children_[1].contentEl_.style.left="-8em")}},h=u.addGroup({classes:"sp-audio sp-menuBar-menu",id:"sp-audio-tracks",minItems:2});t.audioTracksMenu=h,zl.isIOS&&!r.player().playerManager.plugin.options.showBitrates&&h.contentEl().classList.add("sp-no-bitrates");var d=function(){var e=[];r.isIOS?t.one("loadedmetadata",(function(){var r=t.audioTracks();if(r.addEventListener("change",(function(){t.trigger("SP_AUDIO_TRACK_AFTER_SWITCH",void 0,"plugins/AudioTrackMenu -> constructor > setAudioTracks > one(loadedmetadata)")})),r.length>1){for(var n=[],i=function(i){var s,a=r.length-i;s=!0===r[i].enabled||0===i,e.indexOf(r[i].label)<0&&(e.push(r[i].label),n.push({classes:"sp-menu-item",label:Vu(r[i].label,l),id:"".concat(i),selectable:!0,order:a,isActive:s,data:r[i],callback:function(e,r){r.isSelected_||(h.setActiveItem(r),o.switchAudioTrack(i),t.trigger("audioTrackSwitched",e,"plugins/AudioTrackMenu -> constructor > setAudioTracks > menu item callback"))}}))},s=0;s<r.length;s+=1)i(s);h.addItems(n),c(n)}})):t.on("SP_LIB_READY",(function(){var r;null!==(r=o.plugin.streamHandler.lib)&&void 0!==r&&r.hls&&t.on("SP_AUDIO_TRACK_UPDATED_LIST",(function(r,n){for(var i=n.audioTracks,s=[],a=function(r){var n,a=i.length-r;n=!0===i[r].default||0===r,e.indexOf(i[r].name)<0&&(e.push(i[r].name),s.push({classes:"sp-menu-item",label:Vu(i[r].name,l),id:"".concat(r),selectable:!0,order:a,isActive:n,data:Xh(Xh({},i[r]),{},{id:"".concat(i[r].id)}),callback:function(e,n){n.isSelected_||(h.setActiveItem(n),o.switchAudioTrack(r),t.trigger("audioTrackSwitched",e,"plugins/AudioTrackMenu -> constructor > setAudioTracks > on(SP_LIB_READY) > on(SP_AUDIO_TRACK_UPDATED_LIST) > menu item callback"))}}))},u=0;u<i.length;u+=1)a(u);h.addItems(s),c(s)}))}))},f=function(){var e=[],n=[];if(o&&o.sources&&o.sources.audio){r.audioTracksFound+=o.sources.audio.length;for(var i=0;i<o.sources.audio.length;i+=1){var s=o.sources.audio[i],a=s.bitrate;if(void 0!==a&&"string"!=typeof a&&a<1&&(a=1/0),e.indexOf(s.label)<0){var u=Vu(s.label||"",l);e.push(s.label),n.push({classes:"sp-menu-item",label:u,order:a,selectable:!0,isActive:0===i,data:s,callback:function(e,r){r.isSelected_||(h.setActiveItem(r),o.switchBitrate(e),t.trigger("bitrateSwitched",e,"plugins/AudioTrackMenu -> constructor > setBitrates > menu item callback"))}})}}h.addItems(n)}},p=function(t){u.handleTouch(t,!0)},g=function(){if(r.audioTracksFound>1){var t=u.el();t.removeEventListener("mouseover",p),t.removeEventListener("mouseout",p),t.addEventListener("mouseover",p),t.addEventListener("mouseout",p)}};return t.on("settingsMenu-menuLabels",(function(t,e){l=e,o&&(zl.isIOS&&!r.player().playerManager.plugin.options.showBitrates||f(),d()),g()})),t.on("settingsMenu-SourceHandler-change",(function(t,e){o=e,r.sourceHandler=o,l&&(zl.isIOS&&!r.player().playerManager.plugin.options.showBitrates||f(),d()),g()})),t.ready((function(){r.audioTracksFound<1?r.menu.hide():1===r.audioTracksFound&&(r.menu.el().className+=" sp-singleAudioTrack")})),td(r,u)}return e=a,(r=[{key:"handleClick",value:function(){var t,e,r,n,i,s,a,o,l,u,c=this,h=0;if("function"==typeof(null===(t=this.sourceHandler)||void 0===t||null===(e=t.currentSource)||void 0===e?void 0:e.height)?h=this.sourceHandler.currentSource.height():null!==(r=this.sourceHandler)&&void 0!==r&&null!==(n=r.currentSource)&&void 0!==n&&n.height&&(h=this.sourceHandler.currentSource.height),(h>0||-1===(null===(i=this.sourceHandler)||void 0===i||null===(s=i.currentSource)||void 0===s?void 0:s.bitrate))&&(this.previousBitrate=Xh({},null===(a=this.sourceHandler)||void 0===a?void 0:a.currentSource)),this.audioTracksFound<=1&&!this.player().playerManager.plugin.options.audioOnlyToggledOn){var d,f,p=(l=(null===(d=this.sourceHandler)||void 0===d?void 0:d.sources.audio)||[],u=1,function(t){if(Array.isArray(t))return t}(l)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(l,u)||function(t,e){if(t){if("string"==typeof t)return Yh(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)?Yh(t,e):void 0}}(l,u)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];this.player().playerManager.plugin.options.audioOnlyToggledOn=!0;var g=document.querySelector(".".concat(this.player().id_,"_sp-icon-audioTracks"));null==g||g.classList.add("sp-audioOnlyToggledOn"),null===(f=this.sourceHandler)||void 0===f||f.switchBitrate(Xh(Xh({},p),{},{currentTime:this.player().currentTime()})),this.player().trigger("bitrateSwitched",Xh(Xh({},p),{},{currentTime:this.player().currentTime()}),"plugins/AudioTrackMenu -> constructor > handleClick");var v=this.player().el();if(v){var m=v.querySelector(".sp-bigAudioText");if(m)m.className="sp-bigAudioText";else{var y=document.createElement("div");y.className="sp-bigAudioText",y.innerHTML=(o='\n  <div class="sp-bigAudioMessage">\n    Audio Only Mode Enabled\n  </div>\n',void 0!==this.previousBitrate&&(o+='\n  <p class="sp-bigAudioAction">\n    Click here to resume video\n  </p>'),o),this.previousBitrate&&y.addEventListener("click",(function(){var t;null===(t=c.sourceHandler)||void 0===t||t.switchBitrate(Xh(Xh({},c.previousBitrate),{},{currentTime:c.player().currentTime()})),c.player().trigger("bitrateSwitched",Xh(Xh({},c.previousBitrate),{},{currentTime:c.player().currentTime()}),"plugins/AudioTrackMenu -> constructor > handleClick > bigTextElement event listener"),null==g||g.classList.remove("sp-audioOnlyToggledOn"),null==g||g.classList.add("sp-menu-closed"),null==g||g.classList.remove("sp-menu-opened"),c.player().playerManager.plugin.options.audioOnlyToggledOn=!1,y.className="sp-bigAudioText sp-bigAudioHidden"})),v.append(y)}}}}}])&&Qh(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(sd.getComponent("Button"));function ld(t){return ld="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ld(t)}function ud(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,gd(n.key),n)}}function cd(){return cd="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=fd(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},cd.apply(this,arguments)}function hd(t,e){return hd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},hd(t,e)}function dd(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function fd(t){return fd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},fd(t)}function pd(t,e,r){return(e=gd(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function gd(t){var e=function(t,e){if("object"!==ld(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==ld(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===ld(e)?e:String(e)}ad.registerComponent("audioTrackMenu",od);var vd=videojs,md=vd.getComponent("Component"),yd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&hd(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=fd(n);if(i){var r=fd(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===ld(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return dd(t)}(this,t)});function a(t,e){var r;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),pd(dd(r=s.call(this,t,e)),"player",void 0),pd(dd(r),"playerDiv",void 0),pd(dd(r),"isFS",void 0),pd(dd(r),"scrollTo",void 0),pd(dd(r),"originalStyles",null),r.player=function(){return t},r.playerDiv=r.player().el(),r.isFS=!1,window.attachEvent)window.attachEvent("onload",r.init());else if(window.onload){var n=window.onload;window.onload=function(t){n(t),r.init()}}else window.onload=r.init;return r}return e=a,(r=[{key:"init",value:function(){var t=this;window.addEventListener("popstate",(function(){if(document.body.className.indexOf("ios-fs-body")>=0){t.isFS=!1,t.exitFullscreenSetStyles();var e=t.player().controlBar.IOSFullscreen.el();e.classList.remove("vjs-icon-fullscreen-exit"),e.classList.add("vjs-fullscreen-control")}})),window.addEventListener("orientationchange",(function(){setTimeout((function(){t.enterFullscreenSetStyles()}),100)}))}},{key:"createEl",value:function(){var t=cd(fd(a.prototype),"createEl",this).call(this,"div");return t.classList.add("vjs-fullscreen-control"),t}},{key:"handleClick",value:function(){this.player().trigger("sp-ios-fullscreenchange",void 0,"plugins/IOSFullscreen -> handleClick"),this.isFS?this.exitFullscreen():this.enterFullscreen()}},{key:"enterFullscreen",value:function(){this.enterFullscreenSetStyles();var t=this.player().controlBar.IOSFullscreen.el();t.classList.add("vjs-icon-fullscreen-exit"),t.classList.remove("vjs-fullscreen-control"),this.isFS=!0}},{key:"exitFullscreen",value:function(){this.exitFullscreenSetStyles();var t=this.player().controlBar.IOSFullscreen.el();t.classList.remove("vjs-icon-fullscreen-exit"),t.classList.add("vjs-fullscreen-control"),this.isFS=!1}},{key:"enterFullscreenSetStyles",value:function(){this.scrollTo=window.pageYOffset;var t=window.getComputedStyle(this.playerDiv);this.originalStyles={position:t.position,top:t.top,left:t.left,width:t.width,height:t.height,zIndex:t.zIndex,backgroundColor:t.backgroundColor};var e=this.playerDiv;e.style.position="fixed",e.style.top="0",e.style.left="0",e.style.width="100vw",e.style.height="100vh",e.style.zIndex="9999",e.style.backgroundColor="#000",document.body.style.overflow="hidden",document.body.style.position="fixed",document.body.style.width="100%",document.body.style.height="100%",this.playerDiv.classList.add("ios-fs"),document.body.classList.add("ios-fs-body"),document.getElementsByTagName("html")[0].classList.add("ios-fs-html")}},{key:"exitFullscreenSetStyles",value:function(){if(this.originalStyles){var t=this.playerDiv;t.style.position=this.originalStyles.position,t.style.top=this.originalStyles.top,t.style.left=this.originalStyles.left,t.style.width=this.originalStyles.width,t.style.height=this.originalStyles.height,t.style.zIndex=this.originalStyles.zIndex,t.style.backgroundColor=this.originalStyles.backgroundColor}document.body.style.overflow="",document.body.style.position="",document.body.style.width="",document.body.style.height="",this.playerDiv.classList.remove("ios-fs"),document.body.classList.remove("ios-fs-body"),document.getElementsByTagName("html")[0].classList.remove("ios-fs-html"),window.scrollTo(0,this.scrollTo||0)}}])&&ud(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(vd.getComponent("Button"));function Ed(t){return Ed="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ed(t)}function Sd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ld(n.key),n)}}function bd(){return bd="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Ad(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},bd.apply(this,arguments)}function Td(t,e){return Td=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Td(t,e)}function _d(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ad(t){return Ad=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Ad(t)}function Ld(t){var e=function(t,e){if("object"!==Ed(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Ed(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Ed(e)?e:String(e)}md.registerComponent("IOSFullscreen",yd);var wd=videojs,Rd=wd.getComponent("Component"),kd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Td(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Ad(n);if(i){var r=Ad(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ed(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _d(t)}(this,t)});function a(t,e){var r,n,i,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),n=_d(r=s.call(this,t,e)),o=void 0,(i=Ld(i="player"))in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o,r.player=function(){return t};var l=r.player().options_.plugins;if(l){var u,c=l.sardius;c&&"boolean"!=typeof c&&null!==(u=c.asset)&&void 0!==u&&u.isLive&&r.hide()}return r}return e=a,(r=[{key:"createEl",value:function(){var t=bd(Ad(a.prototype),"createEl",this).call(this,"div");return t.classList.add("vjs-forwardSkip-control","vjs-control"),t}},{key:"handleClick",value:function(){this.player().currentTime(this.player().currentTime()+30)}}])&&Sd(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(wd.getComponent("Button"));function Dd(t){return Dd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Dd(t)}function Id(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,(i=n.key,s=void 0,s=function(t,e){if("object"!==Dd(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Dd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(i),"symbol"===Dd(s)?s:String(s)),n)}var i,s}function Pd(){return Pd="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Cd(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Pd.apply(this,arguments)}function Od(t,e){return Od=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Od(t,e)}function Cd(t){return Cd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Cd(t)}Rd.registerComponent("ForwardSkip",kd);var xd=videojs,Md=xd.getComponent("Component"),Fd=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Od(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Cd(n);if(i){var r=Cd(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Dd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(this,t)});function a(t,e){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),s.call(this,t,e)}return e=a,(r=[{key:"createEl",value:function(){var t=Pd(Cd(a.prototype),"createEl",this).call(this,"div");return t.classList.add("vjs-backwardSkip-control","vjs-control"),t}},{key:"handleClick",value:function(){this.player().currentTime(this.player().currentTime()-30)}}])&&Id(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(xd.getComponent("Button"));function Nd(t){return Nd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nd(t)}Md.registerComponent("BackwardSkip",Fd),videojs.registerPlugin("spAutoplay",(function(){var t,e,r=this,n=r.options_;if("object"===Nd(n.plugins.sardius)){var i=n.plugins.sardius;t=i.auto,e=i.background}var s=zl.isExplorer;if(t&&"boolean"==typeof t&&n.techOrder&&"youtube"!==n.techOrder[0]){var a=document.createElement("button");a.innerHTML="Click Here For Sound",a.classList.add("sp-autoplay"),a.style.display="none";var o=document.createElement("div");if(o.classList.add("vjs-icon-volume-mute","sp-autoplay-icon"),a.appendChild(o),a.onclick=function(){r.muted(!1),a.style.display="none"},!e){var l=document.getElementById(r.id_||"");l&&l.appendChild(a)}var u=function(){var t,e;r.muted(!0),r.one("volumechange",(function(){r.one("volumechange",(function(){r.muted()||(a.style.display="none")}))})),s?(null===(t=r.play())||void 0===t||t.catch((function(){})),a.style.display="initial"):(a.style.display="initial",null===(e=r.play())||void 0===e||e.catch((function(){a.style.display="none",r.muted(!1)})))};r.one("loadedmetadata",(function(){var t;s?u():null===(t=r.play())||void 0===t||t.catch((function(){u()}))}))}}));var Bd=r(9947),Ud=r.n(Bd);function jd(t){return jd="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jd(t)}function Hd(){Hd=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==jd(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function Gd(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function Vd(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){Gd(s,n,i,a,o,"next",t)}function o(t){Gd(s,n,i,a,o,"throw",t)}a(void 0)}))}}function Kd(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Qd(n.key),n)}}function Wd(){return Wd="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Xd(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Wd.apply(this,arguments)}function qd(t,e){return qd=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},qd(t,e)}function Yd(t,e){if(e&&("object"===jd(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return zd(t)}function zd(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Xd(t){return Xd=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Xd(t)}function Jd(t,e,r){return(e=Qd(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Qd(t){var e=function(t,e){if("object"!==jd(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==jd(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===jd(e)?e:String(e)}var Zd=videojs,tf=Zd.getComponent("Component"),ef=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&qd(t,e)}(l,t);var e,r,n,i,s,a,o=(s=l,a=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}}(),function(){var t,e=Xd(s);if(a){var r=Xd(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return Yd(this,t)});function l(t,e){var r,n,i,s,a;if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),Jd(zd(a=o.call(this,t,e)),"player",void 0),Jd(zd(a),"asset",void 0),Jd(zd(a),"videoEl",void 0),Jd(zd(a),"videoElHasListener",void 0),Jd(zd(a),"isPlaybackWireless",void 0),Jd(zd(a),"passedOptions",void 0),"youtube"===(null===(r=t.options_.techOrder)||void 0===r?void 0:r[0]))return a.hide(),Yd(a);if(!zl.isAppleDevice)return a.hide(),Yd(a);if(a.passedOptions=e,a.player=function(){return t},!t.playerManager.plugin.options.asset||"string"==typeof t.playerManager.plugin.options.asset)throw new Error("Error building airplay.");a.asset=t.playerManager.plugin.options.asset;var u,c,h=(u=Array.from(a.player().el().getElementsByTagName("video")),c=1,function(t){if(Array.isArray(t))return t}(u)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(u,c)||function(t,e){if(t){if("string"==typeof t)return Kd(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)?Kd(t,e):void 0}}(u,c)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];return(zl.isIphone||zl.isNewIphone)&&h.setAttribute("playsinline","false"),a.videoEl=h,a.videoElHasListener=!1,a.hide(),a.init(),zl.isNewIphone&&null!==(n=e.playerOptions)&&void 0!==n&&null!==(i=n.controlBar)&&void 0!==i&&null!==(s=i.children)&&void 0!==s&&s.includes("airplay")&&!window.ManagedMediaSource&&a.player().one("ready",(function(){try{a.videoEl.playsInline=null;var t=a.player().src().replace(/^[https:]*?\/\//,"https://"),e=document.createElement("source");e.src=t,a.videoEl.appendChild(e)}catch(t){console.warn("SP_WARNING: Couldn't append source for airplay.")}})),a}return e=l,r=[{key:"init",value:function(){var t=this;window.WebKitPlaybackTargetAvailabilityEvent&&(this.createListener(),this.videoEl.addEventListener("webkitplaybacktargetavailabilitychanged",(function(e){t.handleButtonDisplay(e)})))}},{key:"createEl",value:function(){var t=Wd(Xd(l.prototype),"createEl",this).call(this,"div");return t.classList.add("sp-airplay"),t.title="Send To Airplay",t.title="Send To Airplay",t.insertAdjacentHTML("beforeend",Ud()),t}},{key:"handleButtonDisplay",value:function(t){this.show()}},{key:"handleLiveStyles",value:function(t){zl.isIOS||(this.player().controlBar.progressControl[t]("sp-progress-bar-disabled"),this.player().controlBar.LiveDisplay[t]("sp-ios-live-display"),this.player().controlBar.LiveToggle[t]("vjs-hidden"))}},{key:"handleAirplayStyles",value:function(){var t=this.isPlaybackWireless?"addClass":"removeClass";this.player().controlBar[t]("sp-remote-control-bar"),this.player().controlBar.settingsMenuLegacy[t]("vjs-hidden"),this.asset.isLive&&this.handleLiveStyles(t)}},{key:"handleHlsSourceOn",value:(i=Vd(Hd().mark((function t(){var e,r,n,i,s=this;return Hd().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=this.player().paused(),null===(e=this.player().playerManager.plugin.streamHandler.lib)||void 0===e||null===(r=e.hls)||void 0===r||r.detachMedia(),this.videoEl.src=this.player().src(),null===(n=this.player().play())||void 0===n||n.catch((function(){var t;i||null===(t=s.player().play())||void 0===t||t.catch((function(){}))})),i&&this.player().pause();case 5:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"handleHlsSourceOff",value:function(){var t,e,r;null===(t=this.player().playerManager.plugin.streamHandler.lib)||void 0===t||null===(e=t.hls)||void 0===e||e.attachMedia(this.videoEl),null===(r=this.player().play())||void 0===r||r.catch((function(){}))}},{key:"handleHlsSwitch",value:function(){this.isPlaybackWireless?this.handleHlsSourceOn():this.handleHlsSourceOff()}},{key:"handleWirelessPlaybackSwitch",value:function(){"hls"!==this.asset.protocol||zl.isIOS||this.handleHlsSwitch()}},{key:"handleWirelessPlaybackChange",value:function(){var t=this;this.videoElHasListener=!1,this.isPlaybackWireless!==this.videoEl.webkitCurrentPlaybackTargetIsWireless&&(this.isPlaybackWireless=this.videoEl.webkitCurrentPlaybackTargetIsWireless,this.handleWirelessPlaybackSwitch(),this.handleAirplayStyles()),setTimeout((function(){t.createListener()}),10)}},{key:"createListener",value:function(){this.videoElHasListener||(this.videoElHasListener=!0,this.videoEl.addEventListener("webkitcurrentplaybacktargetiswirelesschanged",this.handleWirelessPlaybackChange.bind(this),{once:!0}))}},{key:"handleClick",value:(n=Vd(Hd().mark((function t(){var e,r,n,i,s=this;return Hd().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e=jd(this.player().playerManager.plugin.options.asset),!this.asset.akamaiEdgeAuth||this.isPlaybackWireless){t.next=11;break}if("object"!==jd(e)){t.next=7;break}return t.next=5,Gu(e);case 5:(r=t.sent)&&(this.asset=r);case 7:this.player().one("settingsMenu-SourceHandler-change",(function(){var t,e;null===(t=s.player().play())||void 0===t||null===(e=t.then((function(){var t,e;null===(t=(e=s.videoEl).webkitShowPlaybackTargetPicker)||void 0===t||t.call(e)})))||void 0===e||e.catch((function(){var t,e;s.player().paused()&&(null===(t=s.player().play())||void 0===t||null===(e=t.then((function(){var t,e;null===(t=(e=s.videoEl).webkitShowPlaybackTargetPicker)||void 0===t||t.call(e)})))||void 0===e||e.catch((function(){})))}))})),this.player().playerManager.plugin.sourceHandler.setSources(this.asset),t.next=12;break;case 11:null===(n=(i=this.videoEl).webkitShowPlaybackTargetPicker)||void 0===n||n.call(i);case 12:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})}],r&&$d(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),l}(Zd.getComponent("Button"));function rf(t){return rf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},rf(t)}function nf(){nf=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==rf(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function sf(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function af(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return of(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)?of(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function of(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function lf(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,pf(n.key),n)}}function uf(){return uf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=df(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},uf.apply(this,arguments)}function cf(t,e){return cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},cf(t,e)}function hf(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function df(t){return df=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},df(t)}function ff(t,e,r){return(e=pf(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pf(t){var e=function(t,e){if("object"!==rf(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==rf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===rf(e)?e:String(e)}tf.registerComponent("airplay",ef);var gf=videojs,vf=gf.getComponent("Component"),mf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&cf(t,e)}(l,t);var e,r,n,i,s,a,o=(s=l,a=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}}(),function(){var t,e=df(s);if(a){var r=df(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===rf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return hf(t)}(this,t)});function l(t,e){var r,n,i;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,l),ff(hf(i=o.call(this,t,e)),"player",void 0),ff(hf(i),"options",void 0),ff(hf(i),"videoEl",void 0),ff(hf(i),"muted",void 0),ff(hf(i),"playerState",void 0),ff(hf(i),"asset",void 0),ff(hf(i),"remotePlayerController",void 0),ff(hf(i),"remotePlayer",void 0),ff(hf(i),"statusElement",void 0),ff(hf(i),"titleText",void 0),ff(hf(i),"statusText",void 0),ff(hf(i),"castSession",void 0),i.player=function(){return t},i.options=function(){return e};var s=af(Array.from(i.player().el().getElementsByTagName("video")),1)[0];return i.videoEl=s,"youtube"!==(null===(r=i.options().playerOptions)||void 0===r||null===(n=r.techOrder)||void 0===n?void 0:n[0])&&(i.player().ready((function(){i.init()})),i.muted=i.player().muted(),i.getCastFramework(),i.hide(),i.playerState="LOCAL"),i}return e=l,r=[{key:"getCastFramework",value:function(){if(void 0===window.cast){var t=document.createElement("script");t.type="text/javascript",t.src="https://www.gstatic.com/cv/js/sender/v1/cast_sender.js?loadCastFramework=1",this.player().el().append(t)}}},{key:"handleRemoteIsPausedChanged",value:function(){var t,e;document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&(null!==(e=this.remotePlayer)&&void 0!==e&&e.isPaused?this.statusText&&(this.statusText.innerHTML="Chromecast is Paused"):this.statusText&&(this.statusText.innerHTML="Chromecast is Playing"))}},{key:"handleRemoteCurrentTimeChanged",value:function(){var t;this.player().currentTime((null===(t=this.remotePlayer)||void 0===t?void 0:t.currentTime)||1)}},{key:"handleRemotePlayerStateChanged",value:function(){var t,e;if(document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||""))switch(null===(e=this.remotePlayer)||void 0===e?void 0:e.playerState){default:break;case"IDLE":this.statusText&&(this.statusText.innerHTML="Chromecast is Idle"),this.playerState="IDLE",this.player().pause();break;case"BUFFERING":this.statusText&&(this.statusText.innerHTML="Chromecast is Buffering"),this.playerState="BUFFERING",this.player().pause();break;case"PAUSED":"WAITING"!==this.playerState&&(this.statusText&&(this.statusText.innerHTML="Chromecast is Paused"),this.player().pause(),this.playerState="PAUSED");break;case"PLAYING":var r;if("WAITING"===this.playerState)null===(r=this.remotePlayerController)||void 0===r||r.playOrPause();else if(this.statusText&&(this.statusText.innerHTML="Chromecast is Playing"),"PLAYING"!==this.playerState){var n,i,s=Math.abs(Math.round(1e3*this.player().currentTime())-Math.round((null===(n=this.remotePlayer)||void 0===n?void 0:n.currentTime)||1e3));s>750&&(console.warn("Scrubbing Local Player: Difference Exceeded Limit",s),this.handleRemoteCurrentTimeChanged()),null===(i=this.player().play())||void 0===i||i.catch((function(){})),this.playerState="PLAYING"}}}},{key:"handleLocalPlay",value:function(){var t,e;this.player().remotePlayback&&document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&(this.playerState=this.player().paused()?"PAUSED":"PLAYING",null===(e=this.remotePlayerController)||void 0===e||e.playOrPause())}},{key:"handleLocalSeek",value:function(){var t,e;this.player().remotePlayback&&document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&(this.remotePlayer&&(this.remotePlayer.currentTime=this.player().currentTime()),null===(e=this.remotePlayerController)||void 0===e||e.seek())}},{key:"handleLocalWait",value:function(){var t,e,r;this.player().remotePlayback&&document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&(this.playerState="WAITING",null!==(e=this.remotePlayer)&&void 0!==e&&e.isPaused||null===(r=this.remotePlayerController)||void 0===r||r.playOrPause(),this.statusText&&(this.statusText.innerHTML="Chromecast is Waiting"),this.player().one("playing",this.handleLocalPlay.bind(this)))}},{key:"handleLocalEnd",value:function(){var t;document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&this.castSession&&this.castSession.endSession(!0)}},{key:"handleLocalRefresh",value:function(){var t;document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&this.castSession&&this.castSession.endSession(!0)}},{key:"handleBrowserTabClose",value:function(){var t;document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&this.castSession&&this.castSession.endSession(!0)}},{key:"addLocalHandlers",value:function(){var t,e;this.player().controlBar.playToggle.on("click",this.handleLocalPlay.bind(this)),null===(t=this.player().posterImage)||void 0===t||t.on("click",this.handleLocalPlay.bind(this)),this.player().controlBar.progressControl.on("click",this.handleLocalSeek.bind(this)),null===(e=this.player().controlBar.progressControl.seekBar)||void 0===e||e.mouseTimeDisplay.on("click",this.handleLocalSeek.bind(this)),this.player().on("waiting",this.handleLocalWait.bind(this)),this.player().on("SP_REFRESH",this.handleLocalRefresh.bind(this)),this.player().on("ended",this.handleLocalEnd.bind(this)),window.addEventListener("beforeunload",this.handleBrowserTabClose.bind(this))}},{key:"updateControlRack",value:function(t){var e="remote"===t?"addClass":"removeClass";this.player().controlBar.LiveToggle[e]("vjs-hidden"),this.player().controlBar.volumePanel[e]("vjs-hidden"),this.player().controlBar.settingsMenu[e]("vjs-hidden"),this.player().controlBar[e]("sp-remote-control-bar")}},{key:"addRemoteHandlers",value:function(){var t,e;null===(t=this.remotePlayerController)||void 0===t||t.addEventListener(window.cast.framework.RemotePlayerEventType.IS_PAUSED_CHANGED,this.handleRemoteIsPausedChanged.bind(this)),null===(e=this.remotePlayerController)||void 0===e||e.addEventListener(window.cast.framework.RemotePlayerEventType.PLAYER_STATE_CHANGED,this.handleRemotePlayerStateChanged.bind(this))}},{key:"setupRemotePlayer",value:(n=nf().mark((function t(){var e,r,n,i,s,a,o,l,u,c,h,d,f,p,g,v,m,y,E,S,b,T,_;return nf().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.player().remotePlayback=!0,c=(null===(e=this.asset)||void 0===e?void 0:e.metadata)||{},h=c.title,this.castSession=window.cast.framework.CastContext.getInstance().getCurrentSession(),d=null!==(r=this.asset)&&void 0!==r&&r.isLive?"stream":"video",f=(null===(n=this.asset)||void 0===n?void 0:n.assets[d])||[],p=af(f,1),g=p[0].url,Array.isArray(g)&&(v=af(g,1),g=v[0]),"simlive"!==(null===(i=this.asset)||void 0===i?void 0:i.assetType)&&"simliveFeed"!==(null===(s=this.asset)||void 0===s?void 0:s.assetType)||(g=decodeURIComponent(g||"")),m=(null===(a=this.asset)||void 0===a?void 0:a.assets[d])||[],y=af(m,1),E=y[0].fileType,S=new window.chrome.cast.media.MediaInfo(g||"",E||""),null!==(o=this.asset)&&void 0!==o&&o.isLive&&(S.streamType=window.chrome.cast.media.StreamType.LIVE,S.duration=-1),".ts"===(null===(l=this.asset)||void 0===l?void 0:l.segmentType)?(S.hlsSegmentFormat=window.chrome.cast.media.HlsSegmentFormat.TS,S.hlsVideoSegmentFormat=window.chrome.cast.media.HlsVideoSegmentFormat.MPEG2_TS):".m4s"===(null===(u=this.asset)||void 0===u?void 0:u.segmentType)&&(S.hlsSegmentFormat=window.chrome.cast.media.HlsSegmentFormat.FMP4,S.hlsVideoSegmentFormat=window.chrome.cast.media.HlsVideoSegmentFormat.FMP4),S.metadata=new window.chrome.cast.media.GenericMediaMetadata,S.metadata.metadataType=window.chrome.cast.media.MetadataType.GENERIC,S.metadata.title=h||"",S.metadata.images=[{url:this.player().poster_||""}],b=new window.chrome.cast.media.LoadRequest(S),t.prev=16,this.titleText&&(this.titleText.innerHTML="Connecting to Chromecast..."),this.player().pause(),t.next=21,null===(T=this.castSession)||void 0===T?void 0:T.loadMedia(b);case 21:this.player().addClass("sp-playback-chromecast"),this.titleText&&(this.titleText.innerHTML="Playing Remotely On Chromecast"),this.updateControlRack("remote"),this.muted=this.player().muted(),this.player().muted(!0),this.remotePlayer&&(this.remotePlayer.currentTime=this.player().currentTime()),null===(_=this.remotePlayerController)||void 0===_||_.seek(),t.next=33;break;case 30:t.prev=30,t.t0=t.catch(16),this.titleText&&(this.titleText.innerHTML="A Problem Ocurred Connecting to Chromecast");case 33:case"end":return t.stop()}}),t,this,[[16,30]])})),i=function(){var t=this,e=arguments;return new Promise((function(r,i){var s=n.apply(t,e);function a(t){sf(s,r,i,a,o,"next",t)}function o(t){sf(s,r,i,a,o,"throw",t)}a(void 0)}))},function(){return i.apply(this,arguments)})},{key:"setupLocalPlayer",value:function(){this.player().removeClass("sp-playback-chromecast"),this.player().muted(this.muted||!1),this.updateControlRack("local"),this.player().remotePlayback=!1,this.playerState="LOCAL",this.player().ended()||this.player().play()}},{key:"switchPlayer",value:function(){var t,e;window.cast&&window.cast.framework&&document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&(null!==(e=this.remotePlayer)&&void 0!==e&&e.isConnected?(this.player().hasStarted()?this.player().pause():this.player().hasStarted(!0),this.setupRemotePlayer()):this.player().remotePlayback&&this.setupLocalPlayer())}},{key:"addStatusElement",value:function(){this.statusElement=document.createElement("div"),this.titleText=document.createElement("p"),this.titleText.classList.add("sp-chromecast-status-title"),this.statusElement.insertAdjacentElement("afterbegin",this.titleText),this.statusElement.classList.add("sp-chromecast-status"),this.statusText=document.createElement("p"),this.statusElement.insertAdjacentElement("beforeend",this.statusText),this.player().el().appendChild(this.statusElement)}},{key:"handleCastStateChange",value:function(){var t;document.getElementById((null===(t=this.remotePlayer)||void 0===t?void 0:t.id)||"")&&("NOT_CONNECTED"===window.cast.framework.CastContext.getInstance().getCastState()?this.show():window.cast.framework.CastContext.getInstance().getCastState())}},{key:"setupCastPlayerApi",value:function(){var t,e,r;window.sp_chromecast_available=!0;var n={receiverApplicationId:window.chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID,autoJoinPolicy:window.chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED};window.cast.framework.CastContext.getInstance().setOptions(n),this.remotePlayer=new window.cast.framework.RemotePlayer,this.remotePlayer&&(this.remotePlayer.id=this.player().id()),this.remotePlayerController=new window.cast.framework.RemotePlayerController(this.remotePlayer),null===(t=this.remotePlayerController)||void 0===t||t.addEventListener(window.cast.framework.RemotePlayerEventType.IS_CONNECTED_CHANGED,this.switchPlayer.bind(this)),this.addRemoteHandlers(),this.addLocalHandlers(),this.handleCastStateChange(),null===(e=(r=window.cast.framework.CastContext.getInstance()).addEventListener)||void 0===e||e.call(r,window.cast.framework.CastContextEventType.CAST_STATE_CHANGED,this.handleCastStateChange.bind(this))}},{key:"init",value:function(){var t=this;this.addStatusElement();var e=this.player().playerManager.plugin.options.asset;"string"!=typeof e&&(this.asset=e),window.__onGCastApiAvailable=function(e){e&&t.setupCastPlayerApi.bind(t)()},void 0!==window.cast&&window.cast&&window.cast.framework&&this.setupCastPlayerApi.bind(this)()}},{key:"createEl",value:function(){var t,e,r=uf(df(l.prototype),"createEl",this).call(this,"div");return"youtube"===(null===(t=this.options().playerOptions)||void 0===t||null===(e=t.techOrder)||void 0===e?void 0:e[0])||(r.classList.add("sp-chromecast"),r.title="Send To Chromecast",r.insertAdjacentHTML("beforeend",'<google-cast-launcher id="castbutton"></google-cast-launcher>')),r}}],r&&lf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),l}(gf.getComponent("Button"));function yf(t){return yf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yf(t)}function Ef(t){return Ef="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ef(t)}function Sf(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Lf(n.key),n)}}function bf(){return bf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Af(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},bf.apply(this,arguments)}function Tf(t,e){return Tf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Tf(t,e)}function _f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Af(t){return Af=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Af(t)}function Lf(t){var e=function(t,e){if("object"!==Ef(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Ef(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Ef(e)?e:String(e)}vf.registerComponent("chromecast",mf),videojs.registerPlugin("spMetadata",(function(){var t,e=this;if("object"==yf(e.options_.plugins.sardius)){var r=e.options_.plugins.sardius.asset;r&&(t=r)}e.one("loadedmetadata",(function(){var r=document.createElement("div");r.classList.add("sp-metadata");var n=document.createElement("div");n.classList.add("sp-metadata-title"),n.innerHTML=t.metadata.title,r.appendChild(n);var i=document.createElement("div");i.classList.add("sp-metadata-bio");var s=[];t.metadata.bios&&Array.isArray(t.metadata.bios.speakers)&&(s=t.metadata.bios.speakers),i.innerHTML=s.join(", "),r.appendChild(i);var a=document.getElementById(e.id_||"");a&&a.appendChild(r)}))}));var wf=videojs,Rf=wf.getComponent("Component"),kf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Tf(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Af(n);if(i){var r=Af(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Ef(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _f(t)}(this,t)});function a(t,e){var r,n,i,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),n=_f(r=s.call(this,t,e)),o=void 0,(i=Lf(i="player"))in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o,r.player=function(){return t};var l=r.player().options_.plugins;if(l){var u=l.sardius;u&&"boolean"!=typeof u&&"function"!=typeof u.MiniPlayerCallback&&r.hide()}return r}return e=a,(r=[{key:"createEl",value:function(){var t=bf(Af(a.prototype),"createEl",this).call(this,"div");return t.classList.add("vjs-miniPlayer-control","vjs-control"),t}},{key:"handleClick",value:function(){var t,e=this.player().options_.plugins.sardius;"object"===Ef(e)&&(null===(t=e.MiniPlayerCallback)||void 0===t||t.call(e,{}))}}])&&Sf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(wf.getComponent("Button"));function Df(t){return Df="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Df(t)}function If(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Pf(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ff(n.key),n)}}function Of(){return Of="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Mf(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Of.apply(this,arguments)}function Cf(t,e){return Cf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Cf(t,e)}function xf(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Mf(t){return Mf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Mf(t)}function Ff(t){var e=function(t,e){if("object"!==Df(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Df(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Df(e)?e:String(e)}Rf.registerComponent("MiniPlayer",kf);var Nf=videojs,Bf=Nf.getComponent("Component"),Uf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Cf(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Mf(n);if(i){var r=Mf(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Df(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return xf(t)}(this,t)});function a(t,e){var r,n,i,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),n=xf(r=s.call(this,t,e)),o=void 0,(i=Ff(i="player"))in n?Object.defineProperty(n,i,{value:o,enumerable:!0,configurable:!0,writable:!0}):n[i]=o,r.player=function(){return t};var l=r.player().options_.plugins;if(l){var u=l.sardius;u&&"boolean"!=typeof u&&"function"!=typeof u.TheaterModeCallback&&(r.hide(),t.one("loadedmetadata",(function(){var t,e,n=document.getElementById(r.player().id_||"");if(n){var i=(t=Array.from(n.querySelectorAll(".vjs-control-bar")),e=1,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return If(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)?If(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];i&&i.classList.add("smTheaterModeDisabled")}})))}return r}return e=a,(r=[{key:"createEl",value:function(){var t=Of(Mf(a.prototype),"createEl",this).call(this,"div");return t.classList.add("vjs-theaterMode-control","vjs-control","theater-mode-is-off"),t}},{key:"handleClick",value:function(){var t,e,r=this.player().controlBar.TheaterMode.el(),n=this.player().options_.plugins.sardius;"object"===Df(n)&&(r.className.indexOf("theater-mode-is-off")>-1?(null===(t=n.TheaterModeCallback)||void 0===t||t.call(n,{visible:!0,action:"open"}),r.classList.remove("theater-mode-is-off"),r.classList.add("theater-mode-is-on")):(null===(e=n.TheaterModeCallback)||void 0===e||e.call(n,{visible:!1,action:"close"}),r.classList.remove("theater-mode-is-on"),r.classList.add("theater-mode-is-off")))}}])&&Pf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Nf.getComponent("Button"));function jf(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Hf(t){return Hf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Hf(t)}function Gf(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Yf(n.key),n)}}function Vf(){return Vf="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Wf(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Vf.apply(this,arguments)}function Kf(t,e){return Kf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Kf(t,e)}function $f(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Wf(t){return Wf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Wf(t)}function qf(t,e,r){return(e=Yf(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Yf(t){var e=function(t,e){if("object"!==Hf(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Hf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Hf(e)?e:String(e)}Bf.registerComponent("TheaterMode",Uf);var zf=videojs,Xf=zf.getComponent("Component"),Jf=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Kf(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Wf(n);if(i){var r=Wf(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Hf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return $f(t)}(this,t)});function a(t,e){var r;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),qf($f(r=s.call(this,t,e)),"player",void 0),qf($f(r),"options",void 0),qf($f(r),"feedIndex",void 0),r.player=function(){return t},r.options=function(){return e},r.hide();var n=r.player().playerManager.plugin.options.asset;if(n&&"string"!=typeof n){if("feed"===n.assetType){var i=r.options().playerOptions;if(i){var o=i.plugins;if(o){var l=o.sardius;if(l&&"object"===Hf(l)){var u,c=(null===(u=l.plugins)||void 0===u?void 0:u.FeedSettings)||{},h=c.feedIndex,d=c.feedTotalAssets;r.feedIndex=h,(h||0)<(d||0)&&r.show()}}}}t.one("loadedmetadata",(function(){var t,e,n=document.getElementById(r.player().id_||"");if(n){var i=(t=Array.from(n.querySelectorAll(".vjs-control-bar")),e=1,function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return jf(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)?jf(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())[0];i&&i.classList.add("smFeedPlayer")}}))}return r}return e=a,(r=[{key:"createEl",value:function(){var t=Vf(Wf(a.prototype),"createEl",this).call(this,"div");return t.classList.add("sp-next","vjs-control"),t}},{key:"handleClick",value:function(){var t=this.player().playerManager.plugin.options.plugins.FeedSettings;if(t){var e,r,n=t.playerHost,i=t.accountId,s=t.playerId,a=t.feedId,o=t.feedIndex;null===(e=(r=this.player()).nextAsset)||void 0===e||e.call(r,"//".concat(n,"/players/").concat(i,"/").concat(s,"/feed/").concat(a,"?item=").concat((o||0)+1))}}}])&&Gf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(zf.getComponent("Button"));function Qf(t){return Qf="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Qf(t)}function Zf(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,sp(n.key),n)}}function tp(){return tp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=np(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},tp.apply(this,arguments)}function ep(t,e){return ep=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},ep(t,e)}function rp(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function np(t){return np=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},np(t)}function ip(t,e,r){return(e=sp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function sp(t){var e=function(t,e){if("object"!==Qf(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Qf(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Qf(e)?e:String(e)}Xf.registerComponent("NextButton",Jf);var ap=videojs,op=ap.getComponent("Component"),lp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&ep(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=np(n);if(i){var r=np(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Qf(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return rp(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),ip(rp(r=s.call(this,t,e)),"player",void 0),ip(rp(r),"toggleButtonId",void 0),ip(rp(r),"state",void 0),ip(rp(r),"menuBarItems",void 0),ip(rp(r),"menuContentEl",void 0),ip(rp(r),"menuBarEl",void 0),ip(rp(r),"toggleButton",void 0),r.player=function(){return t},r.toggleButtonId="".concat(r.player().id_||"","_menuBarToggle"),r.state="closed",r.menuBarItems=Array.isArray(r.player().playerManager.plugin.options.plugins.spMenuBar.items)?r.player().playerManager.plugin.options.plugins.spMenuBar.items:[],r.hide(),r.player().ready((function(){r.init()})),r.menuBarItems.length>1&&r.show(),r.player().on("captionsButtonShowing",(function(){r.hideOverflow()})),r.player().on("showQualityMenu",(function(){r.hideOverflow()})),r.player().one("play",(function(){r.hideOverflow()})),r}return e=a,(r=[{key:"init",value:function(){var t,e=this;this.addClass("sp-menu-bar"),this.addClass("sp-menu-bar-closed"),this.el().id="".concat(this.player().id_,"_menuBarWrapper"),this.menuContentEl=document.createElement("div"),this.menuContentEl.className="sp-menu-content",this.menuContentEl.id="".concat(this.player().id_,"_menuBar"),null===(t=this.menuBarEl)||void 0===t||t.appendChild(this.menuContentEl),this.menuBarItems.length>0&&this.menuBarItems.forEach((function(t){var r=t,n=e.player().controlBar[r];if(n){var i,s=n.el_;s.className="".concat(s.className," sp-menuBar-button"),null===(i=e.menuContentEl)||void 0===i||i.appendChild(s)}else console.warn('Cannot add "'.concat(t,'" plugin to the Menu Bar: The Sardius Player Plugin "').concat(t,'" does not exist'))})),zl.isIOS||(this.toggleButton=document.createElement("div"),this.toggleButton.className="sp-menu-bar-toggle-button",this.toggleButton.id=this.toggleButtonId,this.menuContentEl.appendChild(this.toggleButton)),this.menuBarEl&&(this.menuBarEl=this.player().controlBar.el().removeChild(this.menuBarEl),this.player().el().appendChild(this.menuBarEl)),this.player().on("bitrateSwitched",(function(t,r){var n=void 0!==r?r.currentTime:void 0;if(void 0!==n){try{var i=e.player().options_.plugins;if(i){var s,a=i.sardius;a&&"boolean"!=typeof a&&null!==(s=a.asset)&&void 0!==s&&s.isLive&&(n-=10)}}catch(t){}n<0&&(n=0);try{e.player().playerManager.plugin.videoEl.currentTime=n}catch(t){}var o=1,l=setInterval((function(){if(o+=1,n&&e.player().currentTime()<n&&n>0)try{e.player().playerManager.plugin.videoEl.currentTime=n}catch(t){}o>5&&clearInterval(l)}),1e3)}}))}},{key:"createEl",value:function(){var t=tp(np(a.prototype),"createEl",this).call(this,"div");return this.menuBarEl=t,t}},{key:"showAll",value:function(){this.state="open",this.removeClass("sp-menu-bar-closed"),this.addClass("sp-menu-bar-open");var t=this.el();if(t){var e=t.querySelector("#".concat(this.player().id_,"_menuBar "));if(e){var r=e.querySelectorAll(":scope > .vjs-control");Array.from(r).forEach((function(t){t.classList.remove("sp-hidden")}))}}}},{key:"hideOverflow",value:function(){if(zl.isIOS)this.showAll();else{var t=[],e=this.el();if(e){var r=e.querySelector("#".concat(this.player().id_,"_menuBar "));if(r){var n=r.querySelectorAll(":scope > .vjs-control");n&&Array.from(n).forEach((function(e){e.classList.contains("vjs-hidden")||t.push(e)}))}}for(var i=2;i<t.length;i+=1)t[i].classList.add("sp-hidden");var s=document.querySelector("#".concat(this.player().id(),"_menuBarToggle"));s&&t.length<=2?s.classList.add("sp-hidden"):s&&s.classList.contains("sp-hidden")&&s.classList.remove("sp-hidden"),"open"===this.state&&(this.state="closed",this.removeClass("sp-menu-bar-open"),this.addClass("sp-menu-bar-closed"))}}},{key:"handleClick",value:function(t){t.target&&t.target.id===this.toggleButtonId&&("closed"===this.state?this.showAll():"open"===this.state&&this.hideOverflow())}}])&&Zf(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(ap.getComponent("Button"));function up(t){return up="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},up(t)}function cp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,vp(n.key),n)}}function hp(){return hp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=pp(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},hp.apply(this,arguments)}function dp(t,e){return dp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},dp(t,e)}function fp(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function pp(t){return pp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},pp(t)}function gp(t,e,r){return(e=vp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function vp(t){var e=function(t,e){if("object"!==up(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==up(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===up(e)?e:String(e)}op.registerComponent("spMenuBar",lp);var mp=videojs,yp=mp.getComponent("Component"),Ep=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&dp(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=pp(n);if(i){var r=pp(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===up(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return fp(t)}(this,t)});function a(t,e){var r,n,i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),gp(fp(i=s.call(this,t,e)),"player",void 0),gp(fp(i),"options",void 0),gp(fp(i),"logoSettings",void 0),i.player=function(){return t},i.options=function(){return e},i.logoSettings=i.player().playerManager.plugin.options.plugins.logo?i.player().playerManager.plugin.options.plugins.logo:{},"youtube"!==(null===(r=i.options().playerOptions)||void 0===r||null===(n=r.techOrder)||void 0===n?void 0:n[0])&&(i.hide(),i.player().ready((function(){i.handlePosition()}))),i}return e=a,(r=[{key:"createEl",value:function(){var t,e,r=hp(pp(a.prototype),"createEl",this).call(this,"div");if("youtube"===(null===(t=this.options().playerOptions)||void 0===t||null===(e=t.techOrder)||void 0===e?void 0:e[0]))return r;r.classList.add("sp-logo"),r.style.zIndex="2";var n=this.player().playerManager.plugin.options.plugins.logo;if(void 0===n)return r.classList.add("vjs-hidden"),r;switch(n.title&&(r.title=n.title),n.type){default:break;case"svg":r.insertAdjacentHTML("beforeend",n.content||"");break;case"img":r.insertAdjacentHTML("beforeend","<img src=".concat(n.content," />"))}return n.url&&(r.classList.add("sp-logo-link"),r.children.length>2&&r.children[2].classList.add("sp-logo-link-content")),r}},{key:"moveElementToPlayer",value:function(){var t=this.player().controlBar.el().removeChild(this.el());this.player().el().appendChild(t)}},{key:"handlePosition",value:function(){var t;"topLeft"===(null===(t=this.logoSettings)||void 0===t?void 0:t.position)?(this.moveElementToPlayer(),this.addClass("sp-logo-top"),this.addClass("sp-logo-left"),this.show()):(this.addClass("sp-logo-bottom"),this.addClass("sp-logo-left"),this.show())}},{key:"handleClick",value:function(){var t;null!==(t=this.logoSettings)&&void 0!==t&&t.url&&(this.player().userActive()||this.player().paused())&&window.open(this.logoSettings.url,"target_blank")}}])&&cp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(mp.getComponent("Button"));function Sp(t){return Sp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Sp(t)}function bp(){bp=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==Sp(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function Tp(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function _p(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){Tp(s,n,i,a,o,"next",t)}function o(t){Tp(s,n,i,a,o,"throw",t)}a(void 0)}))}}function Ap(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Ip(n.key),n)}}function Lp(){return Lp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=kp(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Lp.apply(this,arguments)}function wp(t,e){return wp=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},wp(t,e)}function Rp(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function kp(t){return kp=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},kp(t)}function Dp(t,e,r){return(e=Ip(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ip(t){var e=function(t,e){if("object"!==Sp(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Sp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Sp(e)?e:String(e)}yp.registerComponent("logo",Ep);var Pp=videojs,Op=Pp.getComponent("Component"),Cp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&wp(t,e)}(a,t);var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=kp(n);if(i){var r=kp(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===Sp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Rp(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),Dp(Rp(r=s.call(this,t,e)),"player",void 0),Dp(Rp(r),"options",void 0),Dp(Rp(r),"logoSettings",void 0),r.player=function(){return t},r.options=function(){return e},r.hide(),r.player().one("ready",_p(bp().mark((function t(){var e,n,i,s,a,o,l,u,c,h,d,f,p,g,v,m;return bp().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("boolean"==typeof(s=null===(e=r.options().playerOptions)||void 0===e||null===(n=e.plugins)||void 0===n?void 0:n.sardius)||void 0===s||null===(i=r.options().playerOptions)||void 0===i||!i.checkDolby){t.next=7;break}return m=(null==s||null===(a=s.asset)||void 0===a||null===(o=a.assets.stream)||void 0===o||null===(l=o[0])||void 0===l?void 0:l.url)||(null==s||null===(u=s.asset)||void 0===u||null===(c=u.assets.video)||void 0===c||null===(h=c[0])||void 0===h?void 0:h.url)||(null==s||null===(d=s.asset)||void 0===d||null===(f=d.assets.audio)||void 0===f||null===(p=f[0])||void 0===p?void 0:p.url),t.next=5,Jo.get("".concat(window.SARDIUSENDPOINT.indexOf("localhost")>-1?"http":"https","://").concat(window.SARDIUSENDPOINT,"dolby?url=").concat(encodeURIComponent("".concat(m)))).then((function(t){return t.data}));case 5:t.sent&&"youtube"!==(null===(g=r.options().playerOptions)||void 0===g||null===(v=g.techOrder)||void 0===v?void 0:v[0])&&r.moveElementToPlayer();case 7:case"end":return t.stop()}}),t)})))),r}return e=a,(r=[{key:"hide",value:function(){Lp(kp(a.prototype),"hide",this).call(this),Array.from(this.el().children).forEach((function(t){"IMG"===t.nodeName&&(t.style.display="none")}))}},{key:"show",value:function(){Lp(kp(a.prototype),"show",this).call(this),Array.from(this.el().children).forEach((function(t){"IMG"===t.nodeName&&(t.style.display="unset")}))}},{key:"createEl",value:function(){var t,e,r=Lp(kp(a.prototype),"createEl",this).call(this,"div");return r.style.zIndex="2","youtube"===(null===(t=this.options().playerOptions)||void 0===t||null===(e=t.techOrder)||void 0===e?void 0:e[0])||(r.classList.add("sp-dolbyIcon"),r.insertAdjacentHTML("beforeend","<img src=https://storage.sardius.media/D405e204616AF07/archives/6A457187B5C2C61758Ed5B0B3400/static/cD002B/C58E66CB16F0.png />")),r}},{key:"moveElementToPlayer",value:function(){var t;null===(t=this.el().parentElement)||void 0===t||t.removeChild(this.el()),this.player().el().appendChild(this.el()),this.show()}}])&&Ap(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}(Pp.getComponent("Button"));function xp(t){return xp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xp(t)}function Mp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Hp(n.key),n)}}function Fp(){return Fp="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=Up(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},Fp.apply(this,arguments)}function Np(t,e){return Np=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},Np(t,e)}function Bp(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Up(t){return Up=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Up(t)}function jp(t,e,r){return(e=Hp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Hp(t){var e=function(t,e){if("object"!==xp(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==xp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===xp(e)?e:String(e)}Op.registerComponent("dolbyIcon",Cp);const Gp=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Np(t,e)}(a,videojs.getComponent("Button"));var e,r,n,i,s=(n=a,i=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}}(),function(){var t,e=Up(n);if(i){var r=Up(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return function(t,e){if(e&&("object"===xp(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return Bp(t)}(this,t)});function a(t,e){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,a),jp(Bp(r=s.call(this,t,e)),"contentEl_",void 0),jp(Bp(r),"callback",void 0),r.contentEl_=void 0,r.callback=void 0,r}return e=a,(r=[{key:"createEl",value:function(){var t=Fp(Up(a.prototype),"createEl",this).call(this,"div");return this.contentEl_=document.createElement("div"),t.appendChild(this.contentEl_),t}},{key:"label",value:function(t){this.contentEl_&&(this.contentEl_.innerHTML=t)}},{key:"onClick",value:function(t){this.callback=t}},{key:"handleClick",value:function(){this.callback&&this.callback(this)}}])&&Mp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),a}();function Vp(t){return Vp="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vp(t)}function Kp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,Wp(n.key),n)}}function $p(t,e,r){return(e=Wp(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Wp(t){var e=function(t,e){if("object"!==Vp(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==Vp(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===Vp(e)?e:String(e)}var qp=videojs,Yp=qp.getComponent("Component");const zp=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),$p(this,"libs",void 0),$p(this,"menus",void 0),$p(this,"plugins",void 0),this.libs={MenuMaker:dh,GroupMaker:nh,ButtonMaker:Gp,Component:Yp},this.menus=[],this.plugins=[]}var e,r;return e=t,r=[{key:"menu",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};Yp.registerComponent(t,e),this.menus.push({name:t,options:r})}},{key:"button",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.menu(t,e,r)}},{key:"plugin",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};try{qp.registerPlugin(t,e),this.plugins.push({name:t,options:r})}catch(t){}}}],r&&Kp(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}(),Xp=["asset","assetUID","feed","file","guid","iframe","js","lao","pid","resi","rpid","simlive","simliveFeed","token","yt"];function Jp(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}const Qp=function(t){var e,r=function(t){if(Array.isArray(t))return Jp(t)}(e=t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return Jp(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)?Jp(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),n=r.indexOf("settingsMenu");return-1!==n&&(r.includes("settingsMenuLegacy")?r.splice(n,1):r.splice(n,1,"settingsMenuLegacy")),r.filter((function(t){return"settingsMenu"!==t}))};function Zp(){Zp=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",a=i.asyncIterator||"@@asyncIterator",o=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function u(t,e,r,i){var s=e&&e.prototype instanceof d?e:d,a=Object.create(s.prototype),o=new L(i||[]);return n(a,"_invoke",{value:b(t,r,o)}),a}function c(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var h={};function d(){}function f(){}function p(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,m=v&&v(v(w([])));m&&m!==e&&r.call(m,s)&&(g=m);var y=p.prototype=d.prototype=Object.create(g);function E(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function S(t,e){function i(n,s,a,o){var l=c(t[n],t,s);if("throw"!==l.type){var u=l.arg,h=u.value;return h&&"object"==lg(h)&&r.call(h,"__await")?e.resolve(h.__await).then((function(t){i("next",t,a,o)}),(function(t){i("throw",t,a,o)})):e.resolve(h).then((function(t){u.value=t,a(u)}),(function(t){return i("throw",t,a,o)}))}o(l.arg)}var s;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){i(t,r,e,n)}))}return s=s?s.then(n,n):n()}})}function b(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=T(a,r);if(o){if(o===h)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var l=c(t,e,r);if("normal"===l.type){if(n=r.done?"completed":"suspendedYield",l.arg===h)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(n="completed",r.method="throw",r.arg=l.arg)}}}function T(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,T(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),h;var i=c(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,h;var s=i.arg;return s?s.done?(e[t.resultName]=s.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,h):s:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,h)}function _(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(_,this),this.reset(!0)}function w(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:R}}function R(){return{value:void 0,done:!0}}return f.prototype=p,n(y,"constructor",{value:p,configurable:!0}),n(p,"constructor",{value:f,configurable:!0}),f.displayName=l(p,o,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,p):(t.__proto__=p,l(t,o,"GeneratorFunction")),t.prototype=Object.create(y),t},t.awrap=function(t){return{__await:t}},E(S.prototype),l(S.prototype,a,(function(){return this})),t.AsyncIterator=S,t.async=function(e,r,n,i,s){void 0===s&&(s=Promise);var a=new S(u(e,r,n,i),s);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(y),l(y,o,"Generator"),l(y,s,(function(){return this})),l(y,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},t.values=w,L.prototype={constructor:L,reset:function(t){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(A),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],a=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var o=r.call(s,"catchLoc"),l=r.call(s,"finallyLoc");if(o&&l){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(o){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var s=i;break}}s&&("break"===t||"continue"===t)&&s.tryLoc<=e&&e<=s.finallyLoc&&(s=null);var a=s?s.completion:{};return a.type=t,a.arg=e,s?(this.method="next",this.next=s.finallyLoc,h):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),h},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:w(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),h}},t}function tg(t,e,r,n,i,s,a){try{var o=t[s](a),l=o.value}catch(t){return void r(t)}o.done?e(l):Promise.resolve(l).then(n,i)}function eg(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function rg(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?eg(Object(r),!0).forEach((function(e){ag(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):eg(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function ng(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],l=!0,u=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){u=!0,i=t}finally{try{if(!l&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw i}}return o}}(t,e)||function(t,e){if(t){if("string"==typeof t)return ig(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)?ig(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ig(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function sg(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,og(n.key),n)}}function ag(t,e,r){return(e=og(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function og(t){var e=function(t,e){if("object"!==lg(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,"string");if("object"!==lg(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===lg(e)?e:String(e)}function lg(t){return lg="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},lg(t)}function ug(t,e,r){var n,i=r.hash,s=r.logType,a=void 0===s?"debug":s,o=r.debugStringTitle,l=r.source,u=void 0===l?"unknown, probably videojs native trigger":l;if(!0===t.debug||"object"===lg(null===(n=t.plugins)||void 0===n?void 0:n.sardius)&&t.plugins.sardius.debug){var c="object"===lg(e)?e.data||e.target||e.message:i,h="object"===lg(e)?e.event||e.type||e.code:e;console[a]("[".concat(a.toUpperCase()," ").concat(o||"LOG","]\n"),"Source: ".concat(u,"\n"),"number"==typeof h?"Code:":"Event:","".concat(h||"Debug Event","\n"),c?"Data:":"",c||"")}}function cg(t){var e=Ju(t,"sardius!").toString(Xu().enc.Utf8);return Yu().unpack(e)}var hg=function(){function t(e,r,n,i){var s,a,o,l,u;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),ag(this,"originalHTML",void 0),ag(this,"parent",void 0),ag(this,"elementId",void 0),ag(this,"callback",void 0),ag(this,"isIframe",void 0),ag(this,"playerSettings",void 0),ag(this,"endpoint",void 0),ag(this,"assetId",void 0),ag(this,"assetType",void 0),ag(this,"refreshCount",void 0),ag(this,"hardRefreshCap",void 0),ag(this,"player",void 0),ag(this,"auto",void 0),ag(this,"streamHandler",void 0),ag(this,"sourceHandler",void 0),ag(this,"debugLog",ug.bind(this)),this.playerSettings="string"==typeof r?cg(r):r;var c={playerElementId:"clientSidePlayer",accountId:(null===(s=this.playerSettings.options)||void 0===s?void 0:s.accountId)||"",assetId:(null===(a=this.playerSettings.options)||void 0===a?void 0:a.assetId)||"",playerId:(null===(o=this.playerSettings.options)||void 0===o?void 0:o.playerId)||"",assetType:(null===(l=this.playerSettings.options)||void 0===l?void 0:l.assetType)||"asset",query:(null===(u=this.playerSettings.options)||void 0===u?void 0:u.query)||{}};this.elementId="player_".concat(Math.floor(1e5*Math.random()));var h,d,f=Hc(e)?e:document.getElementById(e);if(!f)throw new Error("".concat(e," is not a valid ID or DOM Element"));if("VIDEO"!==f.tagName&&(f.innerHTML="<video playsinline id=".concat(this.elementId,' class="video-js vjs-16-9 sp-playerContainer">\n      <p class=vjs-no-js>To view this video please enable JavaScript, and consider upgrading to a web browser that\n      <a href=http://videojs.com/html5-video-support target=_blank>supports HTML5 video</a></p></video>')),zl.isIOS&&this.playerSettings.disableIosSpinner&&f.classList.add("ios"),this.originalHTML=f.innerHTML,this.parent="string"==typeof e?document.getElementById(e)||document.createElement("div"):e,this.callback=n,this.isIframe="string"==typeof r,this.endpoint=window.SARDIUSENDPOINT,this.assetId="",this.assetType="",this.refreshCount=this.refreshCount||0,this.hardRefreshCap=i||0,this.playerSettings.endpoint&&(this.endpoint=this.playerSettings.endpoint),this.playerSettings.url){if(this.playerSettings.url.indexOf("?")>=0){c=Nu(this.playerSettings.url);var p=ng(this.playerSettings.url.split("?"),1)[0];this.playerSettings.url=p}var g=this.playerSettings.url.split("/");this.assetId=g.pop()||"";var v=g.pop()||"";this.assetType=this.isValidAssetType(v)?v:"","token"===this.assetType&&(this.assetId="token")}else if(this.endpoint)if(this.playerSettings.type&&this.playerSettings.id)this.playerSettings.url="".concat(this.endpoint+this.playerSettings.type,"/").concat(this.playerSettings.id),this.assetId=this.playerSettings.id;else if("string"==typeof this.playerSettings.asset)this.playerSettings.url="".concat(this.endpoint,"asset/").concat(this.playerSettings.asset),this.assetId=this.playerSettings.asset;else if(this.playerSettings.assetUID)this.playerSettings.url="".concat(this.endpoint,"assetUID/").concat(this.playerSettings.assetUID),"string"==typeof this.playerSettings.asset&&(this.assetId=this.playerSettings.asset||"");else if(this.playerSettings.feed)this.playerSettings.url="".concat(this.endpoint,"feed/").concat(this.playerSettings.feed),"string"==typeof this.playerSettings.asset&&(this.assetId=this.playerSettings.asset||"");else if(this.playerSettings.simlive)this.playerSettings.url="".concat(this.endpoint,"simlive/").concat(this.playerSettings.simlive),"string"==typeof this.playerSettings.asset&&(this.assetId=this.playerSettings.asset||"");else if(this.playerSettings.simliveFeed)this.playerSettings.url="".concat(this.endpoint,"simliveFeed/").concat(this.playerSettings.simliveFeed),"string"==typeof this.playerSettings.asset&&(this.assetId=this.playerSettings.asset||"");else if(this.playerSettings.guid)this.playerSettings.url="".concat(this.endpoint,"guid/").concat(this.playerSettings.guid),this.assetId=this.playerSettings.guid;else if(this.playerSettings.pid)this.playerSettings.url="".concat(this.endpoint,"pid/").concat(this.playerSettings.pid),this.assetId=this.playerSettings.pid;else if(this.playerSettings.rpid)this.playerSettings.url="".concat(this.endpoint,"rpid/").concat(this.playerSettings.rpid),this.assetId=this.playerSettings.rpid;else if(this.playerSettings.yt)this.playerSettings.url="".concat(this.endpoint,"yt/").concat(this.playerSettings.yt),this.assetId=this.playerSettings.yt;else if(this.playerSettings.lao)this.playerSettings.url="".concat(this.endpoint,"lao/").concat(this.playerSettings.lao),this.assetId=this.playerSettings.lao;else if(this.playerSettings.resi)this.playerSettings.url="".concat(this.endpoint,"resi/").concat(this.playerSettings.resi),this.assetId=this.playerSettings.resi;else if(this.playerSettings.hls)this.playerSettings.url="".concat(this.endpoint,"hls/").concat(encodeURIComponent(this.playerSettings.hls)),this.assetId=this.playerSettings.hls;else if(this.playerSettings.dash)this.playerSettings.url="".concat(this.endpoint,"dash/").concat(encodeURIComponent(this.playerSettings.dash)),this.assetId=this.playerSettings.dash;else if(this.playerSettings.token)this.playerSettings.url="".concat(this.endpoint,"token/").concat(this.playerSettings.token),this.assetId="token";else if(!this.playerSettings||"object"!==lg(this.playerSettings))throw new Error("Please Provide a Media Asset per the Sardius Player Specifications.");void 0!==this.playerSettings.options&&(c=Object.assign(this.playerSettings.options,c)),this.playerSettings.url?(this.playerSettings&&this.playerSettings.options&&this.playerSettings.options.cypress&&(this.playerSettings.url.includes("https:")||this.playerSettings.url.includes("http:")||(this.playerSettings.url="https:".concat(this.playerSettings.url))),c.template="ajax",null!==(h=this.playerSettings.plugins)&&void 0!==h&&h.MiniPlayer&&(c.MiniPlayer=!0),null!==(d=this.playerSettings.plugins)&&void 0!==d&&d.TheaterMode&&(c.TheaterMode=!0),this.playerSettings.url+="?".concat(Fu(c)),this.setAsset(this.assetId,this.playerSettings.url)):"object"===lg(this.playerSettings)?this.build(this.playerSettings):this.build({accountId:"",plugins:{spMenuBar:{items:[]}},setup:{controlBar:{children:[],volumePanel:{}}},controlBar:{children:[],volumePanel:{}}})}var e,r,n,i;return e=t,r=[{key:"isValidAssetType",value:function(t){return Xp.includes(t)}},{key:"beforeBuild",value:function(t){var e,r,n,i=(0,Qu.cloneDeep)(t);return zl.isIOS||zl.isNewIphone||(i.html5?i.html5.nativeTextTracks=!1:i.html5={nativeTextTracks:!1}),this.playerSettings.options&&(this.playerSettings=rg(rg({},this.playerSettings.options),this.playerSettings)),i=this.addDynamicPlugins(i),this.playerSettings.pluginSettings&&(i=this.addPluginSettings(i)),this.playerSettings.metadata&&(i=this.addMetadata(i)),"boolean"!=typeof(null===(e=i.plugins)||void 0===e?void 0:e.sardius)&&null!==(r=i.plugins)&&void 0!==r&&null!==(n=r.sardius)&&void 0!==n&&n.asset&&(zl.isIOS||zl.isNewIphone)&&(i.plugins.sardius.nativeiOSFullscreen||i.controlBar.children.splice(i.controlBar.children.findIndex((function(t){return"FullscreenToggle"===t})),1,"IOSFullscreen"),void 0!==i.plugins.sardius.asset.assets.stream&&(i=this.buildIosControlRack(i))),i}},{key:"build",value:function(t){var e,r,n,i,s,a,o,l,u,c,h,d,f=this;this.debugLog(t,{data:zl},{source:"sardiusPlayer -> build"});var p=this.beforeBuild(t);(0,Qu.set)(p,"plugins.sardius.version","3.4.16");var g=document.getElementById(this.elementId);"boolean"!=typeof(null===(e=p.plugins)||void 0===e?void 0:e.sardius)&&null!==(r=p.plugins)&&void 0!==r&&null!==(n=r.sardius)&&void 0!==n&&n.iOSNativePlayer&&g&&(g.playsInline=!1),p.autoplay&&((this.auto||void 0===this.auto)&&(this.auto=!0,p.plugins&&p.plugins.sardius&&"boolean"!=typeof p.plugins.sardius&&(p.plugins.sardius.auto=!0)),delete p.autoplay),p.isIframe=this.isIframe,Array.isArray(p.techOrder)&&0===p.techOrder.length&&delete p.techOrder;var v,m=(null===(i=p.plugins.sardius)||void 0===i||null===(s=i.asset)||void 0===s?void 0:s.assets)||{},y=m.redirectUrl,E=m.stream,S=m.video,b=m.audio,T=!1,_=!1,A=!1;if(null!=E&&E[0]?(v=ng(E,1)[0].url,T=!0):null!=S&&S[0]?(v=ng(S,1)[0].url,_=!0):null!=b&&b[0]&&(v=ng(b,1)[0].url,A=!0),null!==(a=p.plugins.sardius)&&void 0!==a&&null!==(o=a.plugins)&&void 0!==o&&o.system73&&null!==(l=p.plugins.sardius.asset)&&void 0!==l&&l.assets.redirectUrl){if(T&&E&&Array.isArray(E[0].playlist)){var L=E[0].playlist.findIndex((function(t){return"Auto"===t.qualityLabel}));L>-1&&(p.plugins.sardius.asset.assets.stream[0].playlist[L].url=y)}else if(_){var w=p.plugins.sardius.asset.assets.video.findIndex((function(t){return"Auto"===t.qualityLabel}));w>-1&&(p.plugins.sardius.asset.assets.video[w].url=y)}else A&&(p.plugins.sardius.asset.assets.audio[0].url=y);v&&Jo.head(v)}if(p.controlBar.children=Qp(p.controlBar.children),p.nativeControlsForTouch=!1,zl.isNewIphone&&p.controlBar.children.includes("airplay")&&window.MediaSource&&delete window.ManagedMediaSource,this.player=videojs(this.elementId,p),this.player.debugLog=ug.bind(this.player),this.player.on("webkitendfullscreen",(function(){f.player.trigger("playerresize"),f.player.paused()?(f.player.controlBar.removeClass("vjs-playing"),f.player.controlBar.addClass("vjs-paused")):(f.player.controlBar.removeClass("vjs-paused"),f.player.controlBar.addClass("vjs-playing"))})),this.player.options_.uid=p.uid,!this.player)throw new Error("Failed to create player.");this.player.one("loadedmetadata",(function(){var t,e,r;if(null!==(t=f.player)&&void 0!==t&&t.playerManager.plugin.options.locale){var n=f.player.playerManager.plugin.options.locale;f.player.playerManager.plugin.streamHandler.setLocale(n)}null===(e=f.player)||void 0===e||null===(r=e.markers)||void 0===r||r.add([])})),this.player.on("play",(function(){g&&(g.style.zIndex="1")})),this.player.vjsTrigger=this.player.trigger,this.player.trigger=function(t,e,r){var n,i;return ug(f.playerSettings,t,{source:r,hash:e}),null===(n=f.player)||void 0===n||null===(i=n.vjsTrigger)||void 0===i?void 0:i.call(n,t,e)},this.player.vjsError=this.player.error,this.player.error=function(t){var e,r,n=t;return n&&(-2===n.code&&(n.message="A media timeout error occurred. The media is corrupt or does not exist."),ug(f.playerSettings,t,{logType:"error",source:t.source})),null===(e=f.player)||void 0===e||null===(r=e.vjsError)||void 0===r?void 0:r.call(e,n)},this.player.on("error",(function(){var t,e=null===(t=f.player)||void 0===t?void 0:t.error();!e||2!==e.code&&-2!==e.code&&3!==e.code&&4!==e.code||f.refresh(!0,void 0,void 0)})),this.player.refresh=function(t,e,r){f.refresh(t,e,r)},this.player.delete=function(){f.delete()},this.player.nextAsset=this.nextAsset;try{var R,k;this.streamHandler=null===(R=this.player)||void 0===R?void 0:R.playerManager.plugin.streamHandler,this.sourceHandler=null===(k=this.player)||void 0===k?void 0:k.playerManager.plugin.sourceHandler}catch(t){}if("boolean"!=typeof(null===(u=p.plugins)||void 0===u?void 0:u.sardius)&&"string"==typeof(null===(c=p.plugins)||void 0===c||null===(h=c.sardius)||void 0===h?void 0:h.bitrate)&&this.handleBitrate(),this.handleIosStyling(),this.player.controlBar.settingsMenu)try{this.player.controlBar.settingsMenu.el_.childNodes[0].remove()}catch(t){}this.player.controlBar.closedCaptions&&this.player.controlBar.closedCaptions.el_.childNodes[0].remove(),"youtube"===(null===(d=p.techOrder)||void 0===d?void 0:d[0])&&(this.player.removeClass("vjs-controls-disabled"),this.player.on("playing",(function(){var t;null===(t=f.player)||void 0===t||t.addClass("vjs-controls-disabled")}))),!0===p.muted&&this.player.muted(!0),this.player.one("play",(function(){if(document.getElementsByClassName("sp-bitrate").length+document.getElementsByClassName("sp-language").length===0){var t=document.getElementsByClassName("sp-icon-cog");if(t){var e=ng(Array.from(t),1)[0];e&&e.classList.add("vjs-hidden")}}})),this.player.getAsset=this.getAsset,this.player.setAsset=this.setAsset,this.player.delete=this.delete}},{key:"buildIosControlRack",value:function(t){var e=t;function r(t){t>-1&&e.controlBar.children.splice(t,1)}return r(e.controlBar.children.findIndex((function(t){return"currentTimeDisplay"===t}))),r(e.controlBar.children.findIndex((function(t){return"LiveToggle"===t}))),e}},{key:"addMetadata",value:function(t){for(var e=t,r=Object.keys(this.playerSettings.metadata),n=0;n<r.length;n+=1){var i=r[n];switch(i){case"isLive":case"title":case"assetId":case"categories":case"bios":(0,Qu.set)(e,"plugins.sardius.asset.".concat(i),(0,Qu.get)(this,"playerSettings.metadata.".concat(i)))}}return e}},{key:"addPluginSettings",value:function(t){var e,r,n,i=t;if(this.playerSettings.pluginSettings&&"boolean"!=typeof(null===(e=i.plugins)||void 0===e?void 0:e.sardius)&&null!==(r=i.plugins)&&void 0!==r&&r.sardius){var s,a;if(null!==(s=this.playerSettings.pluginSettings)&&void 0!==s&&s.TheaterModeCallback&&(i.plugins.sardius.TheaterModeCallback=this.playerSettings.pluginSettings.TheaterModeCallback),this.playerSettings.pluginSettings.MiniPlayerCallback&&(i.plugins.sardius.MiniPlayerCallback=this.playerSettings.pluginSettings.MiniPlayerCallback),this.playerSettings.pluginSettings.siteId&&(i.plugins.sardius.siteId=this.playerSettings.pluginSettings.siteId),this.playerSettings.pluginSettings.eventId&&(i.plugins.sardius.eventId=this.playerSettings.pluginSettings.eventId),this.playerSettings.pluginSettings.experienceId&&(i.plugins.sardius.experienceId=this.playerSettings.pluginSettings.experienceId),this.playerSettings.pluginSettings.uid&&(i.uid=this.playerSettings.pluginSettings.uid),this.playerSettings.pluginSettings.affiliate&&(i.plugins.sardius.affiliate=this.playerSettings.pluginSettings.affiliate),this.playerSettings.pluginSettings.locale&&(i.plugins.sardius.locale=this.playerSettings.pluginSettings.locale),this.playerSettings.pluginSettings.usehttps&&(i.plugins.sardius.usehttps=this.playerSettings.pluginSettings.usehttps),i.plugins.sardius.plugins&&this.playerSettings.pluginSettings.MiniPlayer){i.plugins.sardius.plugins.MiniPlayer=!0;var o=i.controlBar.children.findIndex((function(t){return"FullscreenToggle"===t}));i.controlBar.children.splice(o,0,"MiniPlayer")}if(i.plugins.sardius.plugins&&this.playerSettings.pluginSettings.TheaterMode){i.plugins.sardius.plugins.TheaterMode=!0;var l=i.controlBar.children.findIndex((function(t){return"FullscreenToggle"===t}));i.controlBar.children.splice(l,0,"TheaterMode")}this.playerSettings.pluginSettings.bitrate&&(i.plugins.sardius.bitrate="".concat(this.playerSettings.pluginSettings.bitrate)),"boolean"==typeof this.playerSettings.pluginSettings.pLoader&&(i.plugins.sardius.pLoader=this.playerSettings.pluginSettings.pLoader),this.playerSettings.pluginSettings.locationId&&Array.isArray(this.playerSettings.pluginSettings.locationId)&&null!==(a=i.plugins.sardius.plugins)&&void 0!==a&&a.locations&&(i.plugins.sardius.plugins.locations.ids?this.playerSettings.pluginSettings.locationId.forEach((function(t){var e,r,n,s,a,o,l,u,c;"boolean"!=typeof(null===(e=i.plugins)||void 0===e?void 0:e.sardius)&&"boolean"!=typeof(null===(r=i.plugins)||void 0===r||null===(n=r.sardius)||void 0===n||null===(s=n.plugins)||void 0===s?void 0:s.locations)&&(null===(a=i.plugins)||void 0===a||null===(o=a.sardius)||void 0===o||null===(l=o.plugins)||void 0===l||null===(u=l.locations)||void 0===u||null===(c=u.ids)||void 0===c||c.push(t))})):i.plugins.sardius.plugins.locations.ids=this.playerSettings.pluginSettings.locationId)}return this.playerSettings&&this.playerSettings.options&&this.playerSettings.options.loop&&(i.loop="true"===this.playerSettings.options.loop),null!==(n=this.playerSettings.pluginSettings)&&void 0!==n&&n.locationId&&!Array.isArray(this.playerSettings.pluginSettings.locationId)&&console.error("Location IDs Must Be Passed as an Array:",this.playerSettings.pluginSettings.locationId),i}},{key:"addDynamicPlugins",value:function(t){for(var e=t,r=window.sardius,n=r.menus,i=r.plugins,s=0;s<n.length;s+=1){var a=n[s],o=void 0,l=!0;"string"==typeof a?o=a:(o=a.name,a.options&&(l=a.options)),e.controlBar&&e.controlBar.children.indexOf(o)<0&&(e.controlBar.children.push(o),e.controlBar[o]=l)}for(var u=Object.assign(i,this.playerSettings.plugins),c=0;c<u.length;c+=1){var h=u[c],d=void 0,f=!0;"string"==typeof h?d=h:(d=h.name,h.options&&(f=h.options)),(0,Qu.set)(e,"plugins.".concat(d),f)}return e}},{key:"handleBitrate",value:function(){var t,e=this;null===(t=this.player)||void 0===t||t.one("canplay",(function(){var t,r,n,i,s,a,o,l,u=null===(t=e.player)||void 0===t?void 0:t.bitratesMenu.items;if("lowest"===(null===(r=e.player)||void 0===r?void 0:r.playerManager.plugin.options.bitrate))null==u||u.forEach((function(t){var e,r,n,i,s,a,l,u,c,h,d=0;"function"==typeof(null===(e=t.options_)||void 0===e||null===(r=e.data)||void 0===r?void 0:r.height)?d=t.options_.data.height():null!==(n=t.options_)&&void 0!==n&&null!==(i=n.data)&&void 0!==i&&i.height&&(d=t.options_.data.height),(o&&void 0!==(null===(s=t.options_)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.height)&&null!==t.options_.data.height&&d>0&&t.options_.data.height<((null===(l=o.options_)||void 0===l||null===(u=l.data)||void 0===u?void 0:u.height)||0)||void 0===o&&"number"==typeof(null===(c=t.options_)||void 0===c||null===(h=c.data)||void 0===h?void 0:h.height)&&t.options_.data.height>0)&&(o=t)})),void 0!==o&&null!==(a=o.options_)&&void 0!==a&&a.data&&(e.sourceHandler.switchBitrate(o.options_.data),null===(l=e.player)||void 0===l||l.bitratesMenu.setActiveItem(o));else if("heighest"===(null===(n=e.player)||void 0===n?void 0:n.playerManager.plugin.options.bitrate)){var c,h,d,f;null==u||u.forEach((function(t){var e,r,n,i,s,a,o,l,u,c,d=0;"function"==typeof(null===(e=t.options_)||void 0===e||null===(r=e.data)||void 0===r?void 0:r.height)?d=t.options_.data.height():null!==(n=t.options_)&&void 0!==n&&null!==(i=n.data)&&void 0!==i&&i.height&&(d=t.options_.data.height),(h&&void 0!==(null===(s=t.options_)||void 0===s||null===(a=s.data)||void 0===a?void 0:a.height)&&null!==t.options_.data.height&&d>0&&t.options_.data.height>((null===(o=h.options_)||void 0===o||null===(l=o.data)||void 0===l?void 0:l.height)||0)||void 0===h&&"number"==typeof(null===(u=t.options_)||void 0===u||null===(c=u.data)||void 0===c?void 0:c.height)&&t.options_.data.height>0)&&(h=t)})),void 0!==h&&null!==(c=h.options_)&&void 0!==c&&c.data&&(null===(d=e.sourceHandler)||void 0===d||d.switchBitrate(h.options_.data),null===(f=e.player)||void 0===f||f.bitratesMenu.setActiveItem(h))}else"audio"===(null===(i=e.player)||void 0===i?void 0:i.playerManager.plugin.options.bitrate)?null==u||u.forEach((function(t){var r,n,i,s,a;void 0===(null===(r=t.options_)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.height)&&null!==(i=t.options_)&&void 0!==i&&i.data&&(null===(s=e.sourceHandler)||void 0===s||s.switchBitrate(t.options_.data),null===(a=e.player)||void 0===a||a.bitratesMenu.setActiveItem(t))})):"undefined"!==(null===(s=e.player)||void 0===s?void 0:s.playerManager.plugin.options.bitrate)&&(null==u||u.forEach((function(t){var r,n,i,s,a;void 0!==(null===(r=t.options_)||void 0===r||null===(n=r.data)||void 0===n?void 0:n.height)&&(null===(i=e.player)||void 0===i?void 0:i.playerManager.plugin.options.bitrate)===t.options_.label&&(null===(s=e.sourceHandler)||void 0===s||s.switchBitrate(t.options_.data),null===(a=e.player)||void 0===a||a.bitratesMenu.setActiveItem(t))})))}))}},{key:"handleIosStyling",value:function(){var t;if("object"===lg(null===(t=this.player)||void 0===t?void 0:t.playerManager.plugin.options.asset)&&zl.isIOS){var e,r,n;void 0!==((null===(e=this.player)||void 0===e?void 0:e.playerManager.plugin.options.asset)||{}).assets.stream&&(null===(n=this.player)||void 0===n||n.controlBar.progressControl.addClass("sp-progress-bar-disabled")),null===(r=this.player)||void 0===r||r.controlBar.playToggle.addClass("sp-ios-remove-hover");for(var i=document.getElementsByClassName("vjs-control"),s=0;s<i.length;s+=1)i[s].classList.add("sp-ios-remove-hover")}}},{key:"getAsset",value:function(t,e){return new Promise((function(t,r){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===this.readyState){if([200,400,404,475].includes(this.status)){var e=this.responseText;try{e=cg(e)}catch(t){try{e=Cu(e)}catch(t){}}return 200===this.status?t(e):t({content:e,status:this.status})}return console.error("An Error Occurred Getting the Asset",this),r(new Error("An Error Occurred Getting the Asset"))}},n.open("GET",e,!0),n.send()}))}},{key:"isSettingsObject",value:function(t){return"string"!=typeof t&&"object"===lg(t)&&void 0===t.content&&void 0===t.status}},{key:"setAsset",value:function(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;this.getAsset(t,e).then((function(i){var s="",a=200;if("string"==typeof i||r.isSettingsObject(i)?s=i:"object"!==lg(i)||"string"!=typeof i.content&&"object"!==lg(i.content)||(s=i.content,a=i.status),"string"==typeof s&&0===s.indexOf("<!DOCTYPE html>")&&r.parent?r.parent.innerHTML=s:(r.parent.innerHTML=r.originalHTML,"object"===lg(s)&&r.build(s),r.callback&&r.callback(r.player)),475===a){var o=30;if(n<20)var l=setInterval((function(){o>0&&(o-=1),o<0&&(o=0);var i=document.getElementById("clientSidePlayer-sp-reload-timer");i&&(i.innerHTML=o<=0?"Checking...":"Checking again in ".concat(o," seconds.")),o<=0&&(clearInterval(l),n+=1,r.setAsset(t,e,n))}),1e3);else{var u=document.getElementById("clientSidePlayer-sp-reload-timer");u&&(u.innerHTML="Please refresh to check the stream status.")}}})).catch((function(t){console.warn("An Error Occurred While Getting the Asset",t),r.callback&&r.callback(null,t)}))}},{key:"nextAsset",value:(n=Zp().mark((function t(e){var r,n;return Zp().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null===(r=this.player)||void 0===r||null===(n=r.refresh)||void 0===n||n.call(r,!1,e);case 1:case"end":return t.stop()}}),t,this)})),i=function(){var t=this,e=arguments;return new Promise((function(r,i){var s=n.apply(t,e);function a(t){tg(s,r,i,a,o,"next",t)}function o(t){tg(s,r,i,a,o,"throw",t)}a(void 0)}))},function(t){return i.apply(this,arguments)})},{key:"currentTime",value:function(t){return t&&this.player?(this.player.playerManager.plugin.videoEl.currentTime=t,t):(null===(e=this.player)||void 0===e?void 0:e.currentTime())||0;var e}},{key:"refresh",value:function(t,e,r){var n;if(this.hardRefreshCap||(this.hardRefreshCap=0),this.hardRefreshCap+=1,this.refreshCount||(this.refreshCount=0),this.playerSettings.disableRefresh||this.hardRefreshCap>5)null===(n=this.player)||void 0===n||n.play();else if(this.refreshCount<=4){var i;null===(i=this.player)||void 0===i||i.trigger("SP_REFRESH",void 0,"window/sardiusPlayer -> refresh");var s=!1===r?this.currentTime():this.currentTime()+10;console.warn("SP_REFRESH: Refreshing player ".concat(this.elementId));var a=rg(rg({},this.playerSettings),{},{autoplay:!0});e&&(a.url=e),this.deleteHls(),this.delete(),this.constructor(this.parent,a,this.callback,this.hardRefreshCap),t&&(this.refreshCount+=1),this.currentTime(s)}else console.warn("SP_REFRESH: Stopping After 5 Refresh Attempts ".concat(this.elementId))}},{key:"delete",value:function(){var t;null===(t=this.player)||void 0===t||t.dispose()}},{key:"deleteHls",value:function(){var t,e,r;null!==(t=this.player)&&void 0!==t&&null!==(e=t.playerManager.plugin.streamHandler.lib)&&void 0!==e&&e.hls&&(null===(r=this.player)||void 0===r||r.playerManager.plugin.streamHandler.lib.hls.destroy())}}],r&&sg(e.prototype,r),Object.defineProperty(e,"prototype",{writable:!1}),t}();const dg=hg;window.sardius=new zp,window.sardiusPlayer=function(t,e,r){return new dg(t,e,r)},window.Promise||(window.Promise=Dc()),videojs.registerPlugin("sardius",(function(t){return new Rc(t,this)}))})()})();/*File: bundle.js*/!function(e){var t={};function n(s){if(t[s])return t[s].exports;var o=t[s]={i:s,l:!1,exports:{}};return e[s].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(s,o,function(t){return e[t]}.bind(null,o));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(2)},function(e,t,n){},function(e,t,n){"use strict";n.r(t);n(1);var s=function(e,t){var n=new XMLHttpRequest;n.onreadystatechange=function(){if(4===this.readyState&&200===this.status){var e=this.responseText;try{e=JSON.parse(e)}catch(e){}t(e)}4===this.readyState&&200!==this.status&&t(null,this.status)},n.open("GET",e,!0),n.send()},o=function(){var e=document.createElement("DIV");e.id="sp-thumbnail-holder",e.classList.add("sp-thumbnail-holder");var t=document.createElement("IMG");return t.id="sp-thumbnail",t.classList.add("sp-thumbnail"),e.appendChild(t),document.getElementsByClassName("vjs-mouse-display")[0]?document.getElementsByClassName("vjs-mouse-display")[0].appendChild(e):document.getElementsByClassName("vjs-progress-holder")[0].appendChild(e),{thumbnailWrapper:e,thumbnailElement:t}},a=function(e,t,n){var s=t,o=e.find((function(e){return e.percentage>=n}));try{s.src=o.src}catch(e){}},r=function(e){return document.getElementsByClassName("vjs-mouse-display")[0]?parseInt(document.getElementsByClassName("vjs-mouse-display")[0].style.left,10)/document.getElementsByClassName("vjs-progress-holder")[0].getBoundingClientRect().width*100:(e.touches[0].clientX-document.getElementsByClassName("vjs-progress-holder")[0].getBoundingClientRect().x)/document.getElementsByClassName("vjs-progress-holder")[0].getBoundingClientRect().width*100},i=function(e,t){var n=e,s=o(),i=s.thumbnailWrapper,u=s.thumbnailElement,l=t.controlBar.progressControl;!t.playerManager.plugin.options.asset.assets.stream&&t.playerManager.plugin.options.asset.assets.video&&t.playerManager.plugin.options.asset.assets.video[0].options&&(t.playerManager.plugin.options.asset.assets.video[0].options.start||t.playerManager.plugin.options.asset.assets.video[0].options.end)||(l.on("mousemove",(function(){a(n,u,r())})),l.on("touchmove",(function(e){var t=r(e);a(n,u,t),i.classList.add("sp-thumbails-touch"),i.style.display="block",i.style.left="".concat(t,"%")})),l.on("touchend",(function(){i.style.display="none"})))};sardius.plugin("spThumbnails",(function(){var e=this;e.on("setThumbnails",(function(t,n){s(n.url,(function(t){if(t){for(var n=[],s=t.endTime/t.imageCount,o=t.endTime/1e3,a=0;a<t.thumbnails.length;a+=1){var r=s*a/1e3/o*100;n.push({percentage:r,src:t.thumbnails[a]})}i(n,e)}}))}))}))}]);/*File: bundle.js*/!function(e){var i={};function t(o){if(i[o])return i[o].exports;var n=i[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,t),n.l=!0,n.exports}t.m=e,t.c=i,t.d=function(e,i,o){t.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:o})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,i){if(1&i&&(e=t(e)),8&i)return e;if(4&i&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(t.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&i&&"string"!=typeof e)for(var n in e)t.d(o,n,function(i){return e[i]}.bind(null,n));return o},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},t.p="",t(t.s=1)}([function(e,i,t){var o;!function(n,r){"use strict";var a="model",s="name",l="type",c="vendor",u="version",b="mobile",d="tablet",p="smarttv",h=function(e){for(var i={},t=0;t<e.length;t++)i[e[t].toUpperCase()]=e[t];return i},m=function(e,i){return"string"==typeof e&&-1!==w(i).indexOf(w(e))},w=function(e){return e.toLowerCase()},f=function(e,i){if("string"==typeof e)return e=e.replace(/^\s\s*/,""),void 0===i?e:e.substring(0,350)},y=function(e,i){for(var t,o,n,r,a,s,l=0;l<i.length&&!a;){var c=i[l],u=i[l+1];for(t=o=0;t<c.length&&!a&&c[t];)if(a=c[t++].exec(e))for(n=0;n<u.length;n++)s=a[++o],"object"==typeof(r=u[n])&&r.length>0?2===r.length?"function"==typeof r[1]?this[r[0]]=r[1].call(this,s):this[r[0]]=r[1]:3===r.length?"function"!=typeof r[1]||r[1].exec&&r[1].test?this[r[0]]=s?s.replace(r[1],r[2]):void 0:this[r[0]]=s?r[1].call(this,s,r[2]):void 0:4===r.length&&(this[r[0]]=s?r[3].call(this,s.replace(r[1],r[2])):void 0):this[r]=s||void 0;l+=2}},v=function(e,i){for(var t in i)if("object"==typeof i[t]&&i[t].length>0){for(var o=0;o<i[t].length;o++)if(m(i[t][o],e))return"?"===t?void 0:t}else if(m(i[t],e))return"?"===t?void 0:t;return e},g={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},k={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[u,[s,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[u,[s,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[s,u],[/opios[\/ ]+([\w\.]+)/i],[u,[s,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[u,[s,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[s,u],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[u,[s,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[u,[s,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[u,[s,"WeChat"]],[/konqueror\/([\w\.]+)/i],[u,[s,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[u,[s,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[u,[s,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[s,/(.+)/,"$1 Secure Browser"],u],[/\bfocus\/([\w\.]+)/i],[u,[s,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[u,[s,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[u,[s,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[u,[s,"Dolphin"]],[/coast\/([\w\.]+)/i],[u,[s,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[u,[s,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[u,[s,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[s,"360 Browser"]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[s,/(.+)/,"$1 Browser"],u],[/(comodo_dragon)\/([\w\.]+)/i],[[s,/_/g," "],u],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[s,u],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[s],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[s,"Facebook"],u],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[s,u],[/\bgsa\/([\w\.]+) .*safari\//i],[u,[s,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[u,[s,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[u,[s,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[s,"Chrome WebView"],u],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[u,[s,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[s,u],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[u,[s,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[u,s],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[s,[u,v,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[s,u],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[s,"Netscape"],u],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[u,[s,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[s,u],[/(cobalt)\/([\w\.]+)/i],[s,[u,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",w]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[["architecture","arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/windows (ce|mobile); ppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[["architecture",/ower/,"",w]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[["architecture",w]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[a,[c,"Samsung"],[l,d]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[a,[c,"Samsung"],[l,b]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[a,[c,"Apple"],[l,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[c,"Apple"],[l,d]],[/(macintosh);/i],[a,[c,"Apple"]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[a,[c,"Sharp"],[l,b]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[a,[c,"Huawei"],[l,d]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[a,[c,"Huawei"],[l,b]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[a,/_/g," "],[c,"Xiaomi"],[l,b]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[a,/_/g," "],[c,"Xiaomi"],[l,d]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[a,[c,"OPPO"],[l,b]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[a,[c,"Vivo"],[l,b]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[a,[c,"Realme"],[l,b]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[a,[c,"Motorola"],[l,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[a,[c,"Motorola"],[l,d]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[a,[c,"LG"],[l,d]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[a,[c,"LG"],[l,b]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[a,[c,"Lenovo"],[l,d]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[a,/_/g," "],[c,"Nokia"],[l,b]],[/(pixel c)\b/i],[a,[c,"Google"],[l,d]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[a,[c,"Google"],[l,b]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[c,"Sony"],[l,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[a,"Xperia Tablet"],[c,"Sony"],[l,d]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[a,[c,"OnePlus"],[l,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[a,[c,"Amazon"],[l,d]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[a,/(.+)/g,"Fire Phone $1"],[c,"Amazon"],[l,b]],[/(playbook);[-\w\),; ]+(rim)/i],[a,c,[l,d]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[a,[c,"BlackBerry"],[l,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[a,[c,"ASUS"],[l,d]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[a,[c,"ASUS"],[l,b]],[/(nexus 9)/i],[a,[c,"HTC"],[l,d]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[a,/_/g," "],[l,b]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[a,[c,"Acer"],[l,d]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[a,[c,"Meizu"],[l,b]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[c,a,[l,b]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[c,a,[l,d]],[/(surface duo)/i],[a,[c,"Microsoft"],[l,d]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[a,[c,"Fairphone"],[l,b]],[/(u304aa)/i],[a,[c,"AT&T"],[l,b]],[/\bsie-(\w*)/i],[a,[c,"Siemens"],[l,b]],[/\b(rct\w+) b/i],[a,[c,"RCA"],[l,d]],[/\b(venue[\d ]{2,7}) b/i],[a,[c,"Dell"],[l,d]],[/\b(q(?:mv|ta)\w+) b/i],[a,[c,"Verizon"],[l,d]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[a,[c,"Barnes & Noble"],[l,d]],[/\b(tm\d{3}\w+) b/i],[a,[c,"NuVision"],[l,d]],[/\b(k88) b/i],[a,[c,"ZTE"],[l,d]],[/\b(nx\d{3}j) b/i],[a,[c,"ZTE"],[l,b]],[/\b(gen\d{3}) b.+49h/i],[a,[c,"Swiss"],[l,b]],[/\b(zur\d{3}) b/i],[a,[c,"Swiss"],[l,d]],[/\b((zeki)?tb.*\b) b/i],[a,[c,"Zeki"],[l,d]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[c,"Dragon Touch"],a,[l,d]],[/\b(ns-?\w{0,9}) b/i],[a,[c,"Insignia"],[l,d]],[/\b((nxa|next)-?\w{0,9}) b/i],[a,[c,"NextBook"],[l,d]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[c,"Voice"],a,[l,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[c,"LvTel"],a,[l,b]],[/\b(ph-1) /i],[a,[c,"Essential"],[l,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[a,[c,"Envizen"],[l,d]],[/\b(trio[-\w\. ]+) b/i],[a,[c,"MachSpeed"],[l,d]],[/\btu_(1491) b/i],[a,[c,"Rotor"],[l,d]],[/(shield[\w ]+) b/i],[a,[c,"Nvidia"],[l,d]],[/(sprint) (\w+)/i],[c,a,[l,b]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[c,"Microsoft"],[l,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[c,"Zebra"],[l,d]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[c,"Zebra"],[l,b]],[/smart-tv.+(samsung)/i],[c,[l,p]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[c,"Samsung"],[l,p]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,"LG"],[l,p]],[/(apple) ?tv/i],[c,[a,"Apple TV"],[l,p]],[/crkey/i],[[a,"Chromecast"],[c,"Google"],[l,p]],[/droid.+aft(\w)( bui|\))/i],[a,[c,"Amazon"],[l,p]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[a,[c,"Sharp"],[l,p]],[/(bravia[\w ]+)( bui|\))/i],[a,[c,"Sony"],[l,p]],[/(mitv-\w{5}) bui/i],[a,[c,"Xiaomi"],[l,p]],[/Hbbtv.*(technisat) (.*);/i],[c,a,[l,p]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[c,f],[a,f],[l,p]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,p]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[c,a,[l,"console"]],[/droid.+; (shield) bui/i],[a,[c,"Nvidia"],[l,"console"]],[/(playstation [345portablevi]+)/i],[a,[c,"Sony"],[l,"console"]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[a,[c,"Microsoft"],[l,"console"]],[/((pebble))app/i],[c,a,[l,"wearable"]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[a,[c,"Apple"],[l,"wearable"]],[/droid.+; (glass) \d/i],[a,[c,"Google"],[l,"wearable"]],[/droid.+; (wt63?0{2,3})\)/i],[a,[c,"Zebra"],[l,"wearable"]],[/(quest( 2| pro)?)/i],[a,[c,"Facebook"],[l,"wearable"]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[l,"embedded"]],[/(aeobc)\b/i],[a,[c,"Amazon"],[l,"embedded"]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[a,[l,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[a,[l,d]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,d]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,b]],[/(android[-\w\. ]{0,9});.+buil/i],[a,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[u,[s,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[u,[s,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[s,u],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[u,s]],os:[[/microsoft (windows) (vista|xp)/i],[s,u],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[s,[u,v,g]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[s,"Windows"],[u,v,g]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/ios;fbsv\/([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[u,/_/g,"."],[s,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[s,"Mac OS"],[u,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[u,s],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[s,u],[/\(bb(10);/i],[u,[s,"BlackBerry"]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[u,[s,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[u,[s,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[u,[s,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[u,[s,"watchOS"]],[/crkey\/([\d\.]+)/i],[u,[s,"Chromecast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[s,"Chromium OS"],u],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[s,u],[/(sunos) ?([\w\.\d]*)/i],[[s,"Solaris"],u],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[s,u]]},x=function(e,i){if("object"==typeof e&&(i=e,e=void 0),!(this instanceof x))return new x(e,i).getResult();var t=void 0!==n&&n.navigator?n.navigator:void 0,o=e||(t&&t.userAgent?t.userAgent:""),r=t&&t.userAgentData?t.userAgentData:void 0,c=i?function(e,i){var t={};for(var o in e)i[o]&&i[o].length%2==0?t[o]=i[o].concat(e[o]):t[o]=e[o];return t}(k,i):k,p=t&&t.userAgent==o;return this.getBrowser=function(){var e,i={};return i[s]=void 0,i[u]=void 0,y.call(i,o,c.browser),i.major="string"==typeof(e=i[u])?e.replace(/[^\d\.]/g,"").split(".")[0]:void 0,p&&t&&t.brave&&"function"==typeof t.brave.isBrave&&(i[s]="Brave"),i},this.getCPU=function(){var e={architecture:void 0};return y.call(e,o,c.cpu),e},this.getDevice=function(){var e={vendor:void 0,model:void 0,type:void 0};return y.call(e,o,c.device),p&&!e[l]&&r&&r.mobile&&(e[l]=b),p&&"Macintosh"==e[a]&&t&&void 0!==t.standalone&&t.maxTouchPoints&&t.maxTouchPoints>2&&(e[a]="iPad",e[l]=d),e},this.getEngine=function(){var e={name:void 0,version:void 0};return y.call(e,o,c.engine),e},this.getOS=function(){var e={name:void 0,version:void 0};return y.call(e,o,c.os),p&&!e[s]&&r&&"Unknown"!=r.platform&&(e[s]=r.platform.replace(/chrome os/i,"Chromium OS").replace(/macos/i,"Mac OS")),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return o},this.setUA=function(e){return o="string"==typeof e&&e.length>350?f(e,350):e,this},this.setUA(o),this};x.VERSION="0.7.35",x.BROWSER=h([s,u,"major"]),x.CPU=h(["architecture"]),x.DEVICE=h([a,c,l,"console",b,p,d,"wearable","embedded"]),x.ENGINE=x.OS=h([s,u]),void 0!==i?(void 0!==e&&e.exports&&(i=e.exports=x),i.UAParser=x):t(3)?void 0===(o=function(){return x}.call(i,t,i,e))||(e.exports=o):void 0!==n&&(n.UAParser=x);var S=void 0!==n&&(n.jQuery||n.Zepto);if(S&&!S.ua){var M=new x;S.ua=M.getResult(),S.ua.get=function(){return M.getUA()},S.ua.set=function(e){M.setUA(e);var i=M.getResult();for(var t in i)S.ua[t]=i[t]}}}("object"==typeof window?window:this)},function(e,i,t){e.exports=t(4)},function(e,i,t){},function(e,i){(function(i){e.exports=i}).call(this,{})},function(e,i,t){"use strict";t.r(i);t(2);var o=function(e){var i="";try{i+="".concat(e.playerManager.plugin.options.version)}catch(e){}return[{classes:"sp-context-menu-label",label:i,order:0,selectable:!0,isActive:!1,data:{label:"powered-by-sardius-media"},callback:function(){window.open("//sardius.media")}}]},n=t(0),r=t.n(n);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,i){for(var t=0;t<i.length;t++){var o=i[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(n=o.key,r=void 0,r=function(e,i){if("object"!==a(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,i||"default");if("object"!==a(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(n,"string"),"symbol"===a(r)?r:String(r)),o)}var n,r}var l=function(){function e(i,t){!function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.player=i,this.options=t,this.title="",this.asset="",this.uid="",this.playerId="",this.playerVersion="",this.url=window.location.href,this.parser=new r.a,this.uaInformation=this.parser.getResult(),this.errors=[],this.init(),this.errorRecorder()}var i,t,o;return i=e,(t=[{key:"init",value:function(){try{void 0!==this.player.playerManager.plugin.options.asset.id?this.asset=this.player.playerManager.plugin.options.asset.id:this.asset="Unknown Asset ID"}catch(e){this.asset="Unknown Asset ID"}try{void 0!==this.player.playerManager.plugin.options.asset.metadata.title?this.title=this.player.playerManager.plugin.options.asset.metadata.title:this.title="Unknown Title for Asset: ".concat(this.asset)}catch(e){this.title="Unknown Title for Asset: ".concat(this.asset)}try{void 0!==this.player.playerManager.plugin.options.uid?this.uid=this.player.playerManager.plugin.options.uid:this.uid="No user ID is available."}catch(e){this.uid="No user ID is available."}try{void 0!==this.player.playerManager.plugin.options.playerId?this.playerId=this.player.playerManager.plugin.options.playerId:this.playerId="Player ID is unavailable."}catch(e){this.playerId="Player ID is unavailable."}try{void 0!==this.player.playerManager.plugin.options.version?this.playerVersion=this.player.playerManager.plugin.options.version:this.playerVersion="Player Version is unavailable."}catch(e){this.playerVersion="Player Version is unavailable."}}},{key:"errorRecorder",value:function(){var e=this;this.player.on("SP_LIB_READY",(function(){e.player.on("error",(function(){var i=e.player.error();e.errors.push(i)})),e.player.on("SP_ERROR_TRACKER_CONTEXT_MENU",(function(i,t){for(var o={},n=Object.keys(t),r=0;r<n.length;r+=1)switch(n[r]){case"type":o.Type=t[n[r]];break;case"details":o.Details=t[n[r]];break;case"fatal":o.Fatal=t[n[r]];break;case"reason":o.Reason=t[n[r]];break;case"frag":o["Fragment Information"]=JSON.stringify(t[n[r]]);break;case"level":o["Level Information"]=JSON.stringify(t[n[r]]);break;case"url":o.URL=t[n[r]];break;case"err":o["Error Information"]=JSON.stringify(t[n[r]]);break;case"event":o["Error Event Information"]=JSON.stringify(t[n[r]]);break;case"mimeType":o["Mime Type"]=t[n[r]];break;case"response":o.Response=JSON.stringify(t[n[r]]);break;case"context":o.Context=JSON.stringify(t[n[r]]);break;case"loader":o.Loader=JSON.stringify(t[n[r]]);break;case"buffer":o.Buffer=t[n[r]];break;case"mediaType":o["Media Type"]=t[n[r]];break;default:o.Other=JSON.stringify(t[t[n[r]]])||t[n[r]]}e.errors.push(o)}))}))}},{key:"buildItems",value:function(){var e=[],i=[],t={};try{e=this.options.userInformation.include||[]}catch(r){}try{i=this.options.userInformation.exclude||[]}catch(r){}var o={url:"URL: ".concat(this.url||"Uknown URL"),uid:"User ID: ".concat(this.uid),playerId:"Sardius Player ID: ".concat(this.playerId),playerVersion:"Sardius Player Version: ".concat(this.playerVersion),title:"Media Title: ".concat(this.title),asset:"Media Asset ID: ".concat(this.asset),os:"Operating System: ".concat(this.uaInformation.os.name||"Unknown Operating System Name"," ").concat(this.uaInformation.os.version||"Unknown Operating System Version"),browser:"Browser: ".concat(this.uaInformation.browser.name||"Unknown Browser Name"," ").concat(this.uaInformation.browser.version||"Unknown Browser Version"),browserEngine:"Browser Engine: ".concat(this.uaInformation.engine.name||"Unknown Browser Engine Name"," ").concat(this.uaInformation.engine.version||"Unknown Browser Engine Version"),deviceModel:"Device Model: ".concat(this.uaInformation.device.model||"Unknown Device Model"),deviceType:"Device Type: ".concat(this.uaInformation.device.type||"Unknown Device Type"),deviceVendor:"Device Vendor: ".concat(this.uaInformation.device.vendor||"Unknown Device Vendor"),cpu:"CPU Information: ".concat(this.uaInformation.cpu.architecture||"Unknown CPU Information"),ua:"Full User Agent: ".concat(this.uaInformation.ua),errors:"Errors:"};if(e.length>0)for(var n=0;n<e.length;n+=1)t[e[n]]=o[e[n]];else if(i.length>0){t=o;for(var r=0;r<i.length;r+=1)delete t[i[r]]}else t=o;return t}},{key:"buildString",value:function(e,i){for(var t="",o=this.buildItems(),n=Object.keys(o),r=0;r<n.length;r+=1)if("errors"===n[r])if(0===this.errors.length)t+="".concat(o[n[r]]," No Errors Were Recorded").concat(e);else{t+="".concat(o[n[r]]).concat(e);for(var a=0;a<this.errors.length;a+=1){t+="".concat(e,"Error Number: ").concat(a+1).concat(e);for(var s=Object.keys(this.errors[a]),l=0;l<s.length;l+=1)t+=i?"".concat(s[l],": ").concat(encodeURIComponent(this.errors[a][s[l]])).concat(e):"".concat(s[l],": ").concat(this.errors[a][s[l]]).concat(e)}}else t+=i?"".concat(encodeURIComponent(o[n[r]])).concat(e):"".concat(o[n[r]]).concat(e);return t}},{key:"forCopy",value:function(){return this.buildString("\n",!1)}},{key:"forEmail",value:function(){return this.buildString("%0D%0A",!0)}}])&&s(i.prototype,t),o&&s(i,o),Object.defineProperty(i,"prototype",{writable:!1}),e}();function c(e,i){return function(e){if(Array.isArray(e))return e}(e)||function(e,i){var t=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var o,n,r,a,s=[],l=!0,c=!1;try{if(r=(t=t.call(e)).next,0===i){if(Object(t)!==t)return;l=!1}else for(;!(l=(o=r.call(t)).done)&&(s.push(o.value),s.length!==i);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=t.return&&(a=t.return(),Object(a)!==a))return}finally{if(c)throw n}}return s}}(e,i)||function(e,i){if(!e)return;if("string"==typeof e)return u(e,i);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(e);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return u(e,i)}(e,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(e,i){(null==i||i>e.length)&&(i=e.length);for(var t=0,o=new Array(i);t<i;t++)o[t]=e[t];return o}function b(e,i,t,o,n){var r=document.createElement("textarea");r.style.opacity=0,e.el().appendChild(r),r.value=i,r.select();try{document.execCommand("copy")?(r.remove(),t.innerHTML="Success!",o.on("hide-spContextMenu",(function(){t.innerHTML=n}))):(r.remove(),t.innerHTML="Information Failed to Copy\nPlease Try Again")}catch(e){}}var d={supportEmail:function(e,i,t){var o=new l(e,i),n=o.title,r={email:"support@sardius.media",subject:"I'm Having Trouble Viewing ".concat(n),title:n,label:"Trouble Viewing? Email Support Here"};return{classes:"sp-context-menu-item",label:r.label,order:t,selectable:!1,isActive:!1,data:{label:"support-email"},callback:function(){var e=function(){var e,t=o.forEmail(),n=Object.keys(i),a="";e=i.userInformation&&i.userInformation.header?"%0D%0A%0D%0A".concat(i.userInformation.header,"%0D%0A").concat(t):"%0D%0A%0D%0A".concat("My Viewing, Device, and Error Information:","%0D%0A").concat(t),i.subject||(a+="subject=".concat(r.subject,"&")),i.body||(a+="&body=".concat(e));for(var s=0;s<n.length;s+=1)switch(r[n[s]]=i[n[s]],n[s]){case"label":r.label=i[n[s]];break;case"cc":a+="cc=".concat(i[n[s]],"&");break;case"bcc":a+="bcc=".concat(i[n[s]],"&");break;case"subject":a+="subject=".concat(i[n[s]],"&");break;case"body":a+="body=".concat(i[n[s]],"%0D%0A").concat(e,"&")}return"mailto:".concat(r.email,"?").concat(a)}();window.location.href=e}}},copyUserInformation:function(e,i,t){var o=new l(e,i),n=i.label||"Copy Troubleshooting Information";return{classes:"sp-context-menu-item",label:n,order:t,selectable:!1,isActive:!1,data:{label:"copy-user-info"},callback:function(i,t){return function(e,i,t,o,n){var r=n.forCopy(),a=c(i.el().childNodes,1)[0];navigator.clipboard?navigator.clipboard.writeText(r).then((function(){a.innerHTML="Success!",t.on("hide-spContextMenu",(function(){a.innerHTML=o}))})).catch((function(){b(i,r,a,t,o)})):b(i,r,a,t,o)}(0,t,e,n,o)}}}};function p(e){return(p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function h(e,i){for(var t=0;t<i.length;t++){var o=i[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,(n=o.key,r=void 0,r=function(e,i){if("object"!==p(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var o=t.call(e,i||"default");if("object"!==p(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===i?String:Number)(e)}(n,"string"),"symbol"===p(r)?r:String(r)),o)}var n,r}var m=function(){function e(i,t){!function(e,i){if(!(e instanceof i))throw new TypeError("Cannot call a class as a function")}(this,e),this.player=i,this.options=t,this.menu=new sardius.libs.GroupMaker(i,{id:"spContextMenu"}),this.isShowing=!1,this.items=this.buildItems(),this.init()}var i,t,n;return i=e,(t=[{key:"init",value:function(){this.menu.addClass("sp-context-menu"),this.menu.hide(),this.menu.addItems(this.items),document.getElementById("powered-by-sardius-media-".concat(this.player.id())).insertAdjacentHTML("afterbegin",'<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 475.21 163.41"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M168.77,119.12a26.18,26.18,0,0,0-4.44-5.68q-.87-.9-3.58-3.16A26.18,26.18,0,0,1,157.3,107a11.32,11.32,0,0,1-3-7.19,7.29,7.29,0,0,1,.9-3.78,3.55,3.55,0,0,1,3.25-1.89,3.79,3.79,0,0,1,3.08,1.27,8.94,8.94,0,0,1,1.81,4.93L170.74,99A14.76,14.76,0,0,0,169,93a10.59,10.59,0,0,0-3.72-4,13.07,13.07,0,0,0-7.11-1.85A11.78,11.78,0,0,0,151,89.32q-4.72,3.62-4.73,10.65a15.5,15.5,0,0,0,1.73,7.24,29.43,29.43,0,0,0,5.47,6.71l6.9,6.54a9.47,9.47,0,0,1,2.92,6.38,6.21,6.21,0,0,1-.78,3.41,4.81,4.81,0,0,1-4.07,2.51,4,4,0,0,1-3.21-1.44q-1.89-2-2.38-6.53l-7.4.53a20.29,20.29,0,0,0,1.71,7.3,12.61,12.61,0,0,0,4,5,12.2,12.2,0,0,0,7.57,2.26,14.66,14.66,0,0,0,4.31-.57,10.1,10.1,0,0,0,5.35-3.66,14.57,14.57,0,0,0,2.79-9.21,14.19,14.19,0,0,0-1.15-4.93A21.38,21.38,0,0,0,168.77,119.12Z" transform="translate(-37.03 -25.94)"/><path class="cls-1" d="M184.35,87.8l-8.76,51.5h8.09l1.89-11.84h8.11l1.81,11.84h8.17L195,87.8Zm2.42,32.1,2.88-20.31,2.87,20.31Z" transform="translate(-37.03 -25.94)"/><path class="cls-1" d="M234.65,107.57v-7.48c0-3.73-.89-6.63-2.67-8.72q-3-3.57-9.54-3.57H210.2v51.5H218V119.9h5.18l4.71,19.4h8.4l-5.75-22.49A12,12,0,0,0,234.65,107.57Zm-7.56.16a4.35,4.35,0,0,1-1.3,3.17,4.26,4.26,0,0,1-3.14,1.31H218V95.73h4.69q4.44,0,4.44,4.48Z" transform="translate(-37.03 -25.94)"/><path class="cls-1" d="M255.12,87.75H242.91V139.3h12.21a11.69,11.69,0,0,0,8.63-3.62,12,12,0,0,0,3.58-8.71V100a11.93,11.93,0,0,0-3.56-8.67A11.67,11.67,0,0,0,255.12,87.75Zm4.64,39.38a4.42,4.42,0,0,1-1.27,3.15,4.14,4.14,0,0,1-3.12,1.33h-4.69V95.69h4.69a4.22,4.22,0,0,1,3.1,1.31,4.36,4.36,0,0,1,1.29,3.17Z" transform="translate(-37.03 -25.94)"/><rect class="cls-1" x="237.12" y="61.86" width="7.77" height="51.5"/><path class="cls-1" d="M305.34,127.54a4.46,4.46,0,0,1-7.6,3.15,4.27,4.27,0,0,1-1.32-3.15V87.8h-7.6v39.82a12.21,12.21,0,0,0,12.29,12.25,12,12,0,0,0,8.71-3.53,11.72,11.72,0,0,0,3.62-8.72V87.8h-8.1Z" transform="translate(-37.03 -25.94)"/><path class="cls-1" d="M343.2,119.12a26.18,26.18,0,0,0-4.44-5.68q-.87-.9-3.58-3.16a26.18,26.18,0,0,1-3.45-3.29,11.32,11.32,0,0,1-3-7.19,7.29,7.29,0,0,1,.9-3.78,3.56,3.56,0,0,1,3.25-1.89,3.79,3.79,0,0,1,3.08,1.27,8.94,8.94,0,0,1,1.81,4.93L345.17,99a14.92,14.92,0,0,0-1.7-6,10.74,10.74,0,0,0-3.72-4,13.12,13.12,0,0,0-7.11-1.85,11.79,11.79,0,0,0-7.24,2.18q-4.72,3.62-4.73,10.65a15.5,15.5,0,0,0,1.73,7.24,29.43,29.43,0,0,0,5.47,6.71l6.9,6.54a9.47,9.47,0,0,1,2.92,6.38,6.21,6.21,0,0,1-.78,3.41,4.8,4.8,0,0,1-4.07,2.51,4,4,0,0,1-3.21-1.44q-1.89-2-2.38-6.53l-7.4.53a20.29,20.29,0,0,0,1.71,7.3,12.61,12.61,0,0,0,4,5,12.22,12.22,0,0,0,7.57,2.26,14.66,14.66,0,0,0,4.31-.57,10.1,10.1,0,0,0,5.35-3.66,14.51,14.51,0,0,0,2.79-9.21,14.19,14.19,0,0,0-1.15-4.93A21.38,21.38,0,0,0,343.2,119.12Z" transform="translate(-37.03 -25.94)"/><polygon class="cls-1" points="342.93 98.84 335.69 61.81 324.54 61.81 324.54 113.36 332.31 113.36 332.31 81.05 339.83 113.36 346.07 113.36 352.81 80.97 352.81 113.36 360.58 113.36 360.58 61.81 349.87 61.81 342.93 98.84"/><polygon class="cls-1" points="367.53 113.36 389.64 113.36 389.64 105.55 375.3 105.55 375.3 91.49 385.78 91.49 385.78 83.68 375.3 83.68 375.3 69.62 389.64 69.62 389.64 61.81 367.53 61.81 367.53 113.36"/><path class="cls-1" d="M444.22,87.75H432V139.3h12.2a11.69,11.69,0,0,0,8.63-3.62,11.93,11.93,0,0,0,3.58-8.71V100a12,12,0,0,0-3.55-8.67A11.71,11.71,0,0,0,444.22,87.75Zm4.65,39.38a4.43,4.43,0,0,1-1.28,3.15,4.14,4.14,0,0,1-3.12,1.33h-4.69V95.69h4.69a4.2,4.2,0,0,1,3.1,1.31,4.33,4.33,0,0,1,1.3,3.17Z" transform="translate(-37.03 -25.94)"/><rect class="cls-1" x="426.22" y="61.86" width="7.77" height="51.5"/><path class="cls-1" d="M486.27,87.8l-8.76,51.5h8.09l1.89-11.84h8.11l1.82,11.84h8.17L497,87.8Zm2.42,32.1,2.88-20.31,2.88,20.31Z" transform="translate(-37.03 -25.94)"/><polygon class="cls-1" points="67.21 33.28 46.88 33.28 29.5 80.17 67.21 33.28"/><polygon class="cls-1" points="27.54 85.8 37.68 118.92 66.41 37.47 44.17 65.12 27.54 85.8"/><polygon class="cls-1" points="35.98 136.35 36.6 122.24 30.33 101.75 25.9 87.27 2.6 105.43 5.13 130.01 16.01 132.7 35.92 137.62 35.98 136.35"/><polygon class="cls-1" points="74.99 29.45 76.18 29.08 67.14 27.29 69.71 31.1 74.99 29.45"/><polygon class="cls-1" points="74.24 36.23 89.52 53.04 80.17 29.93 71.09 32.77 74.24 36.23"/><polygon class="cls-1" points="70.48 38.28 72.06 90.18 92 59.45 92.01 59.19 91.69 58.4 82.38 48.16 70.38 34.96 70.48 38.28"/><polygon class="cls-1" points="29.06 75.61 45.18 32.12 43.87 0 5.32 63.42 26.03 83.79 29.06 75.61"/><polygon class="cls-1" points="68.46 37.66 65.19 46.94 38.6 122.31 38.21 131.11 37.94 137.22 61.73 125.15 70.16 93.3 68.46 37.66"/><polygon class="cls-1" points="66.68 114.26 63.61 125.89 67.18 146.33 89.07 119.31 91.8 63.42 72.09 93.82 66.68 114.26"/><polygon class="cls-1" points="37.79 139.54 34.47 163.41 65.48 148.24 61.83 127.34 37.79 139.54"/><path class="cls-1" d="M104.45,57.22l-3.06-4.54-.09,0a1.45,1.45,0,0,1-1-.63L82.91,26.13l1.27,31.09Z" transform="translate(-37.03 -25.94)"/><polygon class="cls-1" points="2.39 103.05 24.91 85.5 4.41 65.33 0 75.4 2.39 103.05"/><polygon class="cls-1" points="35.75 139.64 7.26 132.6 32.55 162.7 35.75 139.64"/><rect class="cls-1" x="55.3" y="82.66" width="60.17" transform="matrix(0.63, -0.78, 0.78, 0.63, -69.57, 71.46)"/><polygon class="cls-1" points="66.41 37.47 66.41 37.47 44.17 65.12 66.41 37.47"/><rect class="cls-1" x="69.64" y="110.98" height="34.64" transform="translate(-107.35 60.88) rotate(-45)"/><polygon class="cls-1" points="25.9 87.27 25.9 87.27 30.33 101.75 25.9 87.27"/><polygon class="cls-1" points="65.19 46.94 38.6 122.31 38.6 122.31 65.19 46.94"/><polygon class="cls-1" points="74.99 29.45 76.18 29.08 76.18 29.08 74.99 29.45"/><polygon class="cls-1" points="74.24 36.23 71.09 32.77 80.17 29.93 80.16 29.93 71.09 32.77 74.24 36.23"/><polygon class="cls-1" points="82.38 48.16 70.38 34.96 70.38 34.96 70.38 34.96 82.38 48.16"/><rect class="cls-1" x="102.98" y="118.69" height="32.95" transform="translate(-86.61 34.38) rotate(-26.57)"/><polygon class="cls-1" points="66.68 114.26 63.61 125.89 67.18 146.33 67.18 146.33 63.61 125.89 66.68 114.26"/><rect class="cls-1" x="100.86" y="104.56" width="36.23" transform="translate(-70.53 121.53) rotate(-57.03)"/><path class="cls-1" d="M500.52,83.53a5.91,5.91,0,0,1,5.89-5.89,5.59,5.59,0,0,1,4.12,1.73,6,6,0,0,1,0,8.35,5.57,5.57,0,0,1-4.13,1.72,5.66,5.66,0,0,1-4.16-1.73A5.72,5.72,0,0,1,500.52,83.53Zm10.36,0a4.67,4.67,0,0,0-1.32-3.35,4.28,4.28,0,0,0-6.31,0,4.9,4.9,0,0,0,0,6.68,4.34,4.34,0,0,0,6.33,0A4.66,4.66,0,0,0,510.88,83.56Zm-5.49.7V87H504V80.42a13,13,0,0,1,2.09-.19,4,4,0,0,1,2.15.45,1.65,1.65,0,0,1,.68,1.49,1.51,1.51,0,0,1-1.26,1.52v0q.88.17,1,1.59a7.31,7.31,0,0,0,.34,1.63h-1.41a5.58,5.58,0,0,1-.4-1.7,1.08,1.08,0,0,0-1.23-1Zm0-3v1.88H506c1,0,1.44-.31,1.44-.94s-.45-1-1.34-1A5.36,5.36,0,0,0,505.39,81.31Z" transform="translate(-37.03 -25.94)"/></svg>')}},{key:"buildItems",value:function(){for(var e=[],i=o(this.player),t=0;t<i.length;t+=1)e.push(i[t]);var n=i.length;if(this.options&&"boolean"!=typeof this.options)for(var r=Object.keys(this.options),a=0;a<r.length;a+=1)this.options[r[a]].order&&(n=this.options[r[a]].order+i.length),e.push(d[r[a]](this.player,this.options[r[a]],n)),n+=1;return e}},{key:"disablePlayerControls",value:function(){this.player.controls(!1),this.player.el().classList.remove("vjs-controls-disabled"),this.player.el().classList.add("vjs-controls-enabled"),this.player.bigPlayButton.el().style.pointerEvents="none",this.player.controlBar.el().style.pointerEvents="none"}},{key:"enablePlayerControls",value:function(){this.player.controls(!0),this.player.el().classList.remove("vjs-controls-disabled"),this.player.el().classList.add("vjs-controls-enabled"),this.player.bigPlayButton.el().style.pointerEvents="initial",this.player.controlBar.el().style.pointerEvents="initial"}},{key:"setMenuPosition",value:function(e){this.menu.show();var i=this.player.el().getBoundingClientRect();i.bottom-this.menu.el().getBoundingClientRect().height<e.y?(this.menu.el().style.bottom=0,this.menu.el().style.top=""):(this.menu.el().style.bottom="",this.menu.el().style.top="".concat(e.y-i.y,"px")),i.right-this.menu.el().getBoundingClientRect().width<e.x?(this.menu.el().style.left="",this.menu.el().style.right=0):(this.menu.el().style.left="".concat(e.x-i.x,"px"),this.menu.el().style.right="")}},{key:"hideMenu",value:function(){this.isShowing=!1,this.menu.hide(),this.enablePlayerControls(),this.player.trigger("hide-spContextMenu")}},{key:"showMenu",value:function(e){this.isShowing=!0,e.preventDefault(),this.disablePlayerControls(),this.setMenuPosition(e)}},{key:"handleShowMenu",value:function(e){this.isShowing?this.hideMenu():this.showMenu(e)}}])&&h(i.prototype,t),n&&h(i,n),Object.defineProperty(i,"prototype",{writable:!1}),e}();sardius.plugin("spContextMenu",(function(){if(this.options_.plugins.sardius.asset){var e=this,i={};try{i=e.playerManager.plugin.options.plugins.contextMenu}catch(t){console.warn("SP_PLUGIN_CONTEXTMENU: A problem occured getting the plugin settings",e.playerManager.plugin.options.plugins.contextMenu),i=!0}var t=new m(e,i);e.on("loadstart",(function(){var i=e.el_.children;window.onkeyup=function(e){27===e.keyCode&&t.hideMenu()},document.onclick=function(){t.isShowing&&t.hideMenu()},document.oncontextmenu=function(){t.isShowing&&t.hideMenu()};var o=function(e,i){e.addEventListener("contextmenu",(function(e){e.stopPropagation(),i?(e.sourceCapabilities&&!e.sourceCapabilities.firesTouchEvents||void 0===e.sourceCapabilities)&&t.handleShowMenu(e):t.handleShowMenu(e)})),e.addEventListener("click",(function(){t.hideMenu()})),e.addEventListener("touchstart",(function(){t.hideMenu()}))};o(e.el_);for(var n=0;n<i.length;n+=1)i[n].classList.contains("vjs-control-bar")?o(i[n],!0):o(i[n])}))}}))}]);/*File: Youtube.min.js*/(function(root,factory){if(typeof exports==="object"&&typeof module!=="undefined"){var videojs=require("video.js");module.exports=factory(videojs.default||videojs)}else if(typeof define==="function"&&define.amd){define(["videojs"],function(videojs){return root.Youtube=factory(videojs)})}else{root.Youtube=factory(root.videojs)}})(this,function(videojs){"use strict";var _isOnMobile=videojs.browser.IS_IOS||videojs.browser.IS_NATIVE_ANDROID;var Tech=videojs.getTech("Tech");var Youtube=videojs.extend(Tech,{constructor:function(options,ready){Tech.call(this,options,ready);this.setPoster(options.poster);this.setSrc(this.options_.source,true);this.setTimeout(function(){if(this.el_){this.el_.parentNode.className+=" vjs-youtube";if(_isOnMobile){this.el_.parentNode.className+=" vjs-youtube-mobile"}if(Youtube.isApiReady){this.initYTPlayer()}else{Youtube.apiReadyQueue.push(this)}}}.bind(this))},dispose:function(){if(this.ytPlayer){if(this.ytPlayer.stopVideo){this.ytPlayer.stopVideo()}if(this.ytPlayer.destroy){this.ytPlayer.destroy()}}else{var index=Youtube.apiReadyQueue.indexOf(this);if(index!==-1){Youtube.apiReadyQueue.splice(index,1)}}this.ytPlayer=null;this.el_.parentNode.className=this.el_.parentNode.className.replace(" vjs-youtube","").replace(" vjs-youtube-mobile","");this.el_.parentNode.removeChild(this.el_);Tech.prototype.dispose.call(this)},createEl:function(){var div=document.createElement("div");div.setAttribute("id",this.options_.techId);div.setAttribute("style","width:100%;height:100%;top:0;left:0;position:absolute");div.setAttribute("class","vjs-tech");var divWrapper=document.createElement("div");divWrapper.appendChild(div);if(!_isOnMobile&&!this.options_.ytControls){var divBlocker=document.createElement("div");divBlocker.setAttribute("class","vjs-iframe-blocker");divBlocker.setAttribute("style","position:absolute;top:0;left:0;width:100%;height:100%");divBlocker.onclick=function(){this.pause()}.bind(this);divWrapper.appendChild(divBlocker)}return divWrapper},initYTPlayer:function(){var playerVars={controls:0,modestbranding:1,rel:0,showinfo:0,loop:this.options_.loop?1:0};if(typeof this.options_.autohide!=="undefined"){playerVars.autohide=this.options_.autohide}if(typeof this.options_["cc_load_policy"]!=="undefined"){playerVars["cc_load_policy"]=this.options_["cc_load_policy"]}if(typeof this.options_.ytControls!=="undefined"){playerVars.controls=this.options_.ytControls}if(typeof this.options_.disablekb!=="undefined"){playerVars.disablekb=this.options_.disablekb}if(typeof this.options_.color!=="undefined"){playerVars.color=this.options_.color}if(!playerVars.controls){playerVars.fs=0}else if(typeof this.options_.fs!=="undefined"){playerVars.fs=this.options_.fs}if(this.options_.source.src.indexOf("end=")!==-1){var srcEndTime=this.options_.source.src.match(/end=([0-9]*)/);this.options_.end=parseInt(srcEndTime[1])}if(typeof this.options_.end!=="undefined"){playerVars.end=this.options_.end}if(typeof this.options_.hl!=="undefined"){playerVars.hl=this.options_.hl}else if(typeof this.options_.language!=="undefined"){playerVars.hl=this.options_.language.substr(0,2)}if(typeof this.options_["iv_load_policy"]!=="undefined"){playerVars["iv_load_policy"]=this.options_["iv_load_policy"]}if(typeof this.options_.list!=="undefined"){playerVars.list=this.options_.list}else if(this.url&&typeof this.url.listId!=="undefined"){playerVars.list=this.url.listId}if(typeof this.options_.listType!=="undefined"){playerVars.listType=this.options_.listType}if(typeof this.options_.modestbranding!=="undefined"){playerVars.modestbranding=this.options_.modestbranding}if(typeof this.options_.playlist!=="undefined"){playerVars.playlist=this.options_.playlist}if(typeof this.options_.playsinline!=="undefined"){playerVars.playsinline=this.options_.playsinline}if(typeof this.options_.rel!=="undefined"){playerVars.rel=this.options_.rel}if(typeof this.options_.showinfo!=="undefined"){playerVars.showinfo=this.options_.showinfo}if(this.options_.source.src.indexOf("start=")!==-1){var srcStartTime=this.options_.source.src.match(/start=([0-9]*)/);this.options_.start=parseInt(srcStartTime[1])}if(typeof this.options_.start!=="undefined"){playerVars.start=this.options_.start}if(typeof this.options_.theme!=="undefined"){playerVars.theme=this.options_.theme}if(typeof this.options_.customVars!=="undefined"){var customVars=this.options_.customVars;Object.keys(customVars).forEach(function(key){playerVars[key]=customVars[key]})}this.activeVideoId=this.url?this.url.videoId:null;this.activeList=playerVars.list;var playerConfig={videoId:this.activeVideoId,playerVars:playerVars,events:{onReady:this.onPlayerReady.bind(this),onPlaybackQualityChange:this.onPlayerPlaybackQualityChange.bind(this),onPlaybackRateChange:this.onPlayerPlaybackRateChange.bind(this),onStateChange:this.onPlayerStateChange.bind(this),onVolumeChange:this.onPlayerVolumeChange.bind(this),onError:this.onPlayerError.bind(this)}};if(typeof this.options_.enablePrivacyEnhancedMode!=="undefined"&&this.options_.enablePrivacyEnhancedMode){playerConfig.host="https://www.youtube-nocookie.com"}this.ytPlayer=new YT.Player(this.options_.techId,playerConfig)},onPlayerReady:function(){if(this.options_.muted){this.ytPlayer.mute()}var playbackRates=this.ytPlayer.getAvailablePlaybackRates();if(playbackRates.length>1){this.featuresPlaybackRate=true}this.playerReady_=true;this.triggerReady();if(this.playOnReady){this.play()}else if(this.cueOnReady){this.cueVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId}},onPlayerPlaybackQualityChange:function(){},onPlayerPlaybackRateChange:function(){this.trigger("ratechange")},onPlayerStateChange:function(e){var state=e.data;if(state===this.lastState||this.errorNumber){return}this.lastState=state;switch(state){case-1:this.trigger("loadstart");this.trigger("loadedmetadata");this.trigger("durationchange");this.trigger("ratechange");break;case YT.PlayerState.ENDED:this.trigger("ended");break;case YT.PlayerState.PLAYING:this.trigger("timeupdate");this.trigger("durationchange");this.trigger("playing");this.trigger("play");if(this.isSeeking){this.onSeeked()}break;case YT.PlayerState.PAUSED:this.trigger("canplay");if(this.isSeeking){this.onSeeked()}else{this.trigger("pause")}break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate");this.player_.trigger("waiting");break}},onPlayerVolumeChange:function(){this.trigger("volumechange")},onPlayerError:function(e){this.errorNumber=e.data;this.trigger("pause");this.trigger("error")},error:function(){var code=1e3+this.errorNumber;switch(this.errorNumber){case 5:return{code:code,message:"Error while trying to play the video"};case 2:case 100:return{code:code,message:"Unable to find the video"};case 101:case 150:return{code:code,message:"Playback on other Websites has been disabled by the video owner."}}return{code:code,message:"YouTube unknown error ("+this.errorNumber+")"}},loadVideoById_:function(id){var options={videoId:id};if(this.options_.start){options.startSeconds=this.options_.start}if(this.options_.end){options.endEnd=this.options_.end}this.ytPlayer.loadVideoById(options)},cueVideoById_:function(id){var options={videoId:id};if(this.options_.start){options.startSeconds=this.options_.start}if(this.options_.end){options.endEnd=this.options_.end}this.ytPlayer.cueVideoById(options)},src:function(src){if(src){this.setSrc({src:src})}return this.source},poster:function(){if(_isOnMobile){return null}return this.poster_},setPoster:function(poster){this.poster_=poster},setSrc:function(source){if(!source||!source.src){return}delete this.errorNumber;this.source=source;this.url=Youtube.parseUrl(source.src);if(!this.options_.poster){if(this.url.videoId){this.poster_="https://img.youtube.com/vi/"+this.url.videoId+"/0.jpg";this.trigger("posterchange");this.checkHighResPoster()}}if(this.options_.autoplay&&!_isOnMobile){if(this.isReady_){this.play()}else{this.playOnReady=true}}else if(this.activeVideoId!==this.url.videoId){if(this.isReady_){this.cueVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId}else{this.cueOnReady=true}}},autoplay:function(){return this.options_.autoplay},setAutoplay:function(val){this.options_.autoplay=val},loop:function(){return this.options_.loop},setLoop:function(val){this.options_.loop=val},play:function(){if(!this.url||!this.url.videoId){return}this.wasPausedBeforeSeek=false;if(this.isReady_){if(this.url.listId){if(this.activeList===this.url.listId){this.ytPlayer.playVideo()}else{this.ytPlayer.loadPlaylist(this.url.listId);this.activeList=this.url.listId}}if(this.activeVideoId===this.url.videoId){this.ytPlayer.playVideo()}else{this.loadVideoById_(this.url.videoId);this.activeVideoId=this.url.videoId}}else{this.trigger("waiting");this.playOnReady=true}},pause:function(){if(this.ytPlayer){this.ytPlayer.pauseVideo()}},paused:function(){return this.ytPlayer?this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING:true},currentTime:function(){return this.ytPlayer?this.ytPlayer.getCurrentTime():0},setCurrentTime:function(seconds){if(this.lastState===YT.PlayerState.PAUSED){this.timeBeforeSeek=this.currentTime()}if(!this.isSeeking){this.wasPausedBeforeSeek=this.paused()}this.ytPlayer.seekTo(seconds,true);this.trigger("timeupdate");this.trigger("seeking");this.isSeeking=true;if(this.lastState===YT.PlayerState.PAUSED&&this.timeBeforeSeek!==seconds){clearInterval(this.checkSeekedInPauseInterval);this.checkSeekedInPauseInterval=setInterval(function(){if(this.lastState!==YT.PlayerState.PAUSED||!this.isSeeking){clearInterval(this.checkSeekedInPauseInterval)}else if(this.currentTime()!==this.timeBeforeSeek){this.trigger("timeupdate");this.onSeeked()}}.bind(this),250)}},seeking:function(){return this.isSeeking},seekable:function(){if(!this.ytPlayer){return videojs.createTimeRange()}return videojs.createTimeRange(0,this.ytPlayer.getDuration())},onSeeked:function(){clearInterval(this.checkSeekedInPauseInterval);this.isSeeking=false;if(this.wasPausedBeforeSeek){this.pause()}this.trigger("seeked")},playbackRate:function(){return this.ytPlayer?this.ytPlayer.getPlaybackRate():1},setPlaybackRate:function(suggestedRate){if(!this.ytPlayer){return}this.ytPlayer.setPlaybackRate(suggestedRate)},duration:function(){return this.ytPlayer?this.ytPlayer.getDuration():0},currentSrc:function(){return this.source&&this.source.src},ended:function(){return this.ytPlayer?this.lastState===YT.PlayerState.ENDED:false},volume:function(){return this.ytPlayer?this.ytPlayer.getVolume()/100:1},setVolume:function(percentAsDecimal){if(!this.ytPlayer){return}this.ytPlayer.setVolume(percentAsDecimal*100)},muted:function(){return this.ytPlayer?this.ytPlayer.isMuted():false},setMuted:function(mute){if(!this.ytPlayer){return}else{this.muted(true)}if(mute){this.ytPlayer.mute()}else{this.ytPlayer.unMute()}this.setTimeout(function(){this.trigger("volumechange")},50)},buffered:function(){if(!this.ytPlayer||!this.ytPlayer.getVideoLoadedFraction){return videojs.createTimeRange()}var bufferedEnd=this.ytPlayer.getVideoLoadedFraction()*this.ytPlayer.getDuration();return videojs.createTimeRange(0,bufferedEnd)},preload:function(){},load:function(){},reset:function(){},networkState:function(){if(!this.ytPlayer){return 0}switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 3:return 2;default:return 1}},readyState:function(){if(!this.ytPlayer){return 0}switch(this.ytPlayer.getPlayerState()){case-1:return 0;case 5:return 1;case 3:return 2;default:return 4}},supportsFullScreen:function(){return document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled},checkHighResPoster:function(){var uri="https://img.youtube.com/vi/"+this.url.videoId+"/maxresdefault.jpg";try{var image=new Image;image.onload=function(){if("naturalHeight"in image){if(image.naturalHeight<=90||image.naturalWidth<=120){return}}else if(image.height<=90||image.width<=120){return}this.poster_=uri;this.trigger("posterchange")}.bind(this);image.onerror=function(){};image.src=uri}catch(e){}}});Youtube.isSupported=function(){return true};Youtube.canPlaySource=function(e){return Youtube.canPlayType(e.type)};Youtube.canPlayType=function(e){return e==="video/youtube"};Youtube.parseUrl=function(url){var result={videoId:null};var regex=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/;var match=url.match(regex);if(match&&match[2].length===11){result.videoId=match[2]}var regPlaylist=/[?&]list=([^#\&\?]+)/;match=url.match(regPlaylist);if(match&&match[1]){result.listId=match[1]}return result};function apiLoaded(){YT.ready(function(){Youtube.isApiReady=true;for(var i=0;i<Youtube.apiReadyQueue.length;++i){Youtube.apiReadyQueue[i].initYTPlayer()}})}function loadScript(src,callback){var loaded=false;var tag=document.createElement("script");var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag);tag.onload=function(){if(!loaded){loaded=true;callback()}};tag.onreadystatechange=function(){if(!loaded&&(this.readyState==="complete"||this.readyState==="loaded")){loaded=true;callback()}};tag.src=src}function injectCss(){var css=".vjs-youtube .vjs-iframe-blocker { display: none; }"+".vjs-youtube.vjs-user-inactive .vjs-iframe-blocker { display: block; }"+".vjs-youtube .vjs-poster { background-size: cover; }"+".vjs-youtube-mobile .vjs-big-play-button { display: none; }";var head=document.head||document.getElementsByTagName("head")[0];var style=document.createElement("style");style.type="text/css";if(style.styleSheet){style.styleSheet.cssText=css}else{style.appendChild(document.createTextNode(css))}head.appendChild(style)}Youtube.apiReadyQueue=[];if(typeof document!=="undefined"){loadScript("https://www.youtube.com/iframe_api",apiLoaded);injectCss()}if(typeof videojs.registerTech!=="undefined"){videojs.registerTech("Youtube",Youtube)}else{videojs.registerComponent("Youtube",Youtube)}});/*File: sp.min.js*//*!
 * @license MIT
 * youbora-adapter-videojs 6.7.7
 * Copyright NicePopleAtWork <http://nicepeopleatwork.com/>
 * @author Jesus Lopez
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.youbora=t():e.youbora=t()}(window,(function(){return function(e){var t={};function i(n){if(t[n])return t[n].exports;var s=t[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)i.d(n,s,function(t){return e[t]}.bind(null,s));return n},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(i.s=35)}([function(e,t,i){var n=i(19),s=i(38),r=function(){};r.prototype={constructor:function(){}},r.extend=function(e,t){var i,r=this;return i=e&&e.hasOwnProperty("constructor")?e.constructor:function(){return r.apply(this,arguments)},n(i,r,t),i.prototype=s(r.prototype),e&&n(i.prototype,e),i.prototype.constructor=i,i.__super__=r.prototype,i},e.exports=r},function(e,t,i){var n=i(6),s=i(13),r={_emitter:new n,on:function(){r._emitter.on.apply(r._emitter,arguments)},off:function(){r._emitter.off.apply(r._emitter,arguments)},emit:function(){r._emitter.emit.apply(r._emitter,arguments)},Level:{SILENT:6,ERROR:5,WARNING:4,NOTICE:3,DEBUG:2,VERBOSE:1},Event:{LOG:"log"},logLevel:5,plainLogs:!1,report:function(e,t,i){if("undefined"!=typeof console&&console.log&&"undefined"!=typeof document){i=i||"darkcyan";var n,a={5:"e",4:"w",3:"n",2:"d",1:"v"}[t=t||r.Level.NOTICE],o="[Youbora]"+r._getCurrentTime()+" "+a+":";if(this.emit("log",{level:t,msg:e,prefix:o}),r.logLevel<=t)if(r.plainLogs||document.documentMode)r._plainReport(e,o);else n=t===r.Level.ERROR&&console.error?console.error:t===r.Level.WARNING&&console.warn?console.warn:t===r.Level.DEBUG&&console.debug?console.debug:console.log,o="%c"+o,s(e)?(e.splice(0,0,o,"color: "+i),n.apply(console,e)):n.call(console,o,"color: "+i,e)}},_getCurrentTime:function(){var e=new Date;return"["+("0"+e.getDate()).slice(-2)+":"+("0"+e.getMinutes()).slice(-2)+":"+("0"+e.getSeconds()).slice(-2)+"."+("00"+e.getMilliseconds()).slice(-3)+"]"},_plainReport:function(e,t){if(e instanceof Array)for(var i in e)r._plainReport(e[i],t);else"string"==typeof e?console.log(t+" "+e):(console.log(t+" <next line>"),console.log(e))},error:function(){r.report([].slice.call(arguments),r.Level.ERROR,"darkred")},warn:function(){r.report([].slice.call(arguments),r.Level.WARNING,"darkorange")},notice:function(){r.report([].slice.call(arguments),r.Level.NOTICE,"darkgreen")},debug:function(){r.report([].slice.call(arguments),r.Level.DEBUG,"indigo")},verbose:function(){r.report([].slice.call(arguments),r.Level.VERBOSE,"navy")},loadLevelFromUrl:function(){"undefined"!=typeof window&&window.location&&this._parseLevelFromUrl(window.location.search)},_parseLevelFromUrl:function(e){if(e){var t=/\?.*&*youbora-debug=(.+)/i.exec(e);null!==t&&(r.logLevel=t[1]),null!==/\?.*&*youbora-debug=plain/i.exec(e)&&(r.plainLogs=!0)}}};e.exports=r},function(e,t,i){var n=i(1),s={stripProtocol:function(e){var t=e;try{t=e.replace(/^(.*?:\/\/|\/\/)/i,"")}catch(e){n.warn(e)}return t},addProtocol:function(e,t){var i="http://localhost/";try{i="http://"+e,t||"undefined"!=typeof window&&0===window.location.protocol.indexOf("https")?i="https://"+e:"undefined"!=typeof window&&0===window.location.protocol.indexOf("http")&&(i="//"+e)}catch(e){n.warn(e)}return i},parseNumber:function(e,t){return!isNaN(e)&&e>=0&&e!==1/0&&e!==-1/0&&null!=e?e:t},logAllEvents:function(e,t,i){try{if(n.logLevel<=n.Level.DEBUG){i=i||function(e){n.debug("Event: "+e.type)};var s=["canplay","buffering","waiting","ended","play","playing","pause","resume","error","abort","seek","seeking","seeked","stalled","dispose","loadeddata","loadstart"];t&&(null===t[0]?(t.shift(),s=t):s=s.concat(t));for(var r=0;r<s.length;r++)"function"==typeof e?e.call(window,s[r],i):e.on?e.on(s[r],i):e.addEventListener&&e.addEventListener(s[r],i)}}catch(e){n.error(e)}},buildRenditionString:function(e,t,i){1===arguments.length&&(i=e,e=null,t=null);var n="";return e&&t&&(n=e+"x"+t),"number"!=typeof i||isNaN(i)||i<1?n:(n&&(n+="@"),(n+=i<1e3?Math.round(i)+"bps":i<1e6?(i=Math.round(i/1e3))+"Kbps":(i=Math.round(i/1e4)/100)+"Mbps")||null)},buildErrorParams:function(e,t,i,n){var s={};return"object"==typeof e?s=e:(s.errorCode=e||"FAILURE",s.msg=t||s.errorCode,s.errorMetadata=i,s.errorLevel=n),s},calculateAdViewability:function(e,t){var i=!0;if("undefined"!=typeof window&&e){var n=e.getBoundingClientRect();if(n.top>=window.innerHeight||n.bottom<=0||n.right<=0||n.left>=window.innerWidth)i=!1;else{var s=Math.trunc(n.height*n.width),r=n.top>0?n.top:0,a=n.bottom>window.innerHeight?window.innerHeight:n.bottom,o=n.left>0?n.left:0;i=100*(((n.right>window.innerWidth?window.innerWidth:n.right)-o)*(a-r))>s*(t||50)}}return i},getMetricsFrom:function(e,t){var i=e||t;for(var n in i)if("object"!=typeof i[n]||!i[n].value){var s={};s.value=i[n],i[n]=s}return i},assign:i(19),isArray:i(13)};e.exports=s},function(e,t,i){var n=s,s={noConflict:function(){return s=n,this}};s.VERSION=i(9),s.polyfills=i(37),s.polyfills(),s.Object=i(0),s.Emitter=i(6),s.Log=i(1),s.Log.loadLevelFromUrl(),s.Util=i(2),s.HybridNetwork=i(20),s.Chrono=i(8),s.Timer=i(14),s.Constants=i(4),s.Request=i(5),s.Communication=i(15),s.Transform=i(7),s.ViewTransform=i(22),s.ResourceTransform=i(23),s.CdnParser=i(25),s.HlsParser=i(24),s.DashParser=i(26),s.OfflineParser=i(28),s.LocationheaderParser=i(27),s.Options=i(29),s.Plugin=i(51),s.Storage=i(16),s.RequestBuilder=i(30),s.PlayheadMonitor=i(34),s.Adapter=i(18),s.adapters={},s.Infinity=i(17),s.BackgroundDetector=i(31),s.DeviceDetector=i(32),s.UUIDGenerator=i(33),s.registerAdapter=function(e,t){this.adapters[e]=t}.bind(s),s.unregisterAdapter=function(e){this.adapters[e]=null}.bind(s),e.exports=s},function(e,t,i){var n=i(21),s=i(10),r={AdPosition:n,ManifestError:i(21),Service:i(40),WillSendEvent:i(41),Adapter:s};e.exports=r},function(e,t,i){var n=i(0),s=i(1),r=i(2),a=n.extend({constructor:function(e,t,i,n){this.xhr=this.createXHR(),this.host=e||"",this.service=t||"",this.params=i||{},this.options=r.assign({},a.defaultOptions,n),this.retries=0,this.options.cache||this.setParam("timemark",(new Date).getTime())},createXHR:function(){var e={};try{e=XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP")}catch(e){s.error(e)}return e},getXHR:function(){return this.xhr},getResponse:function(){return this.xhr.response},getResponseText:function(){return this.xhr.responseText},getResponseHeaders:function(){return this.xhr.getAllResponseHeaders()},getUrl:function(){return this.host+this.service+this.getParamString()},on:function(e,t,i){return this.xhr.addEventListener?this.xhr.addEventListener(e,t.bind(this,this,i)):e===a.Event.SUCCESS&&(this.xhr.onreadystatechange=function(){4===this.xhr.readyState&&t.bind(this,this,i)}.bind(this)),this},off:function(e,t){return this.xhr.removeEventListener(e,t),this},getParamString:function(){try{var e="?";for(var t in this.params){var i=this.params[t];if(null!==i&&"object"==typeof i){var n=JSON.stringify(i);"{}"!==n&&(e+=encodeURIComponent(t)+"="+encodeURIComponent(n)+"&")}else null!=i&&""!==i&&(e+=encodeURIComponent(t)+"="+encodeURIComponent(i)+"&")}return e.slice(0,-1)}catch(e){return s.error(e),""}},getParam:function(e){return this.params[e]},setParam:function(e,t){return this.params[e]=t,this},setBody:function(e){this.body=e},send:function(){try{if(this.xhr.open(this.options.method,this.getUrl(),!0),this.options.requestHeaders)for(var e in this.options.requestHeaders)this.options.requestHeaders.hasOwnProperty(e)&&this.xhr.setRequestHeader(e,this.options.requestHeaders[e]);if(this.options.retryAfter>0&&this.options.maxRetries>0){0===this.retries&&this.on(a.Event.ERROR,function(){if(this.retries>=this.options.maxRetries)s.error('Aborting failed request "'+this.service+'". Max retries reached.');else{s.warn('YBRequest "'+this.service+'" failed. Retry '+(this.retries+1)+" of "+this.options.maxRetries+" in "+this.options.retryAfter+"ms.");try{setTimeout(function(){this.retries+=1,this.send()}.bind(this),this.options.retryAfter)}catch(e){"undefined"!=typeof atv?atv.setTimeout(function(){this.retries+=1,this.send()}.bind(this),this.options.retryAfter):s.error(e)}}}.bind(this))}for(var t in s.logLevel<=s.Level.VERBOSE&&s.verbose("XHR Req: "+this.getUrl()),a._globalListeners)a._globalListeners[t].forEach(function(e){this.on(t,e)}.bind(this));return this.xhr.send(this.body)}catch(e){s.error(e)}}},{Event:{SUCCESS:"load",LOAD:"load",ERROR:"error",ABORT:"abort"},defaultOptions:{method:"GET",requestHeaders:{},maxRetries:3,retryAfter:5e3,cache:!1},_globalListeners:{},onEvery:function(e,t){a._globalListeners[e]=a._globalListeners[e]||[],a._globalListeners[e].push(t)},offEvery:function(e,t){if(a._globalListeners[e]){var i=a._globalListeners[e].indexOf(t);-1!==i&&a._globalListeners[e].splice(i,1)}}});e.exports=a},function(e,t,i){var n=i(0),s=i(13),r=n.extend({on:function(e,t){if(this._listeners=this._listeners||{},"function"==typeof t)return this._listeners[e]=this._listeners[e]||[],this._listeners[e].push(t),this},off:function(e,t){if(this._listeners=this._listeners||{},this._listeners[e]){var i=this._listeners[e].indexOf(t);-1!==i&&this._listeners[e].splice(i,1)}return this},emit:function(e,t){return this._listeners=this._listeners||{},t=t||{},s(this._listeners[e])&&this._listeners[e].forEach(this._eachCallback.bind(this,e,t)),s(this._listeners["*"])&&this._listeners["*"].forEach(this._eachCallback.bind(this,e,t)),this},_eachCallback:function(e,t,i){"function"==typeof i&&i({type:e,data:t,target:this})}});e.exports=r},function(e,t,i){var n=i(6).extend({constructor:function(){this._isBusy=!0,this._sendRequest=!0,this.transformName="Transform"},parse:function(e){},isBlocking:function(e){return this._isBusy},done:function(){this._isBusy=!1,this.emit(n.Event.DONE)},hasToSend:function(e){return this._sendRequest},getState:function(){return this._sendRequest?this._isBusy?this.STATE_BLOCKED:this.STATE_NO_BLOCKED:this.STATE_OFFLINE}},{STATE_OFFLINE:2,STATE_BLOCKED:1,STATE_NO_BLOCKED:0,Event:{DONE:"done"}});e.exports=n},function(e,t,i){var n=i(0).extend({constructor:function(){this.reset()},reset:function(){this.startTime=0,this.stopTime=0,this.pauseTime=0,this.offset=0},getDeltaTime:function(e){var t=-1,i=(new Date).getTime();if(this.startTime){e&&!this.stopTime&&(this.stopTime=i);var n=this.pauseTime?i-this.pauseTime:0,s=this.stopTime?this.stopTime:i;t=this.offset-n+(s-this.startTime)}return t},start:function(){this.startTime=(new Date).getTime(),this.stopTime=0,this.offset=0},stop:function(){return this.pauseTime&&this.resume(),this.stopTime=(new Date).getTime(),this.startTime?this.offset+(this.stopTime-this.startTime):-1},pause:function(){this.pauseTime=(new Date).getTime()},resume:function(){this.offset-=(new Date).getTime()-this.pauseTime,this.pauseTime=0},clone:function(){var e=new n;return e.startTime=this.startTime,e.stopTime=this.stopTime,e.offset=this.offset,e}});e.exports=n},function(e,t,i){e.exports=i(36).version},function(e,t,i){var n={Event:i(39)};e.exports=n},function(e,t,i){var n=i(6).extend({constructor:function(){this._realResource=null,this._lastManifest=null},done:function(){this.emit(n.Event.DONE)},parse:function(e,t){},getResource:function(){return this._realResource},getLastManifest:function(){return this._lastManifest},shouldExecute:function(e){return!0}},{Event:{DONE:"done"}});e.exports=n},function(e){e.exports=JSON.parse('{"name":"videojs","type":"adapter","tech":"js","author":"Jesus Lopez","version":"6.7.7","built":"2020-05-26","repo":"https://bitbucket.org/npaw/videojs-adapter-js.git","libVersion":"^6.7.6","features":{"buffer":"monitor","seek":"native","error":true,"stop":true,"pause":true,"resume":true,"getters":["getPlayhead","getPlayrate","getDuration","getBitrate","getRendition","getTitle","getIsLive","getResource","getPlayerVersion"]},"ads":[{"buffer":"monitor","seek":"monitor","error":true,"stop":true,"pause":true,"resume":true,"getters":["getPlayhead","getDuration","getTitle","getResource","getPosition","getGivenBreaks","getBreaksTime","getGivenAds","getIsVisible","getAudioEnabled","getIsSkippable","getIsFullscreen","getCreativeId"],"filename":"bcove-freewheel.js"},{"buffer":"monitor","seek":"monitor","error":true,"stop":true,"pause":true,"resume":true,"getters":["getPlayhead","getDuration","getBitrate","getTitle","getResource","getPlayerVersion","getPosition","getGivenBreaks","getBreaksTime","getGivenAds","getIsVisible","getAudioEnabled","getIsSkippable","getIsFullscreen","getCreativeId"],"filename":"bcove-ima.js"},{"buffer":"monitor","seek":"monitor","error":true,"stop":true,"pause":false,"resume":false,"getters":[],"filename":"generic.js"},{"buffer":"monitor","seek":"monitor","error":true,"stop":true,"pause":true,"resume":true,"getters":["getPlayhead","getDuration","getTitle","getIsLive","getResource","getPlayerVersion","getPosition","getGivenBreaks","getBreaksTime","getGivenAds","getIsVisible","getAudioEnabled","getIsSkippable","getIsFullscreen"],"filename":"ima.js"},{"buffer":"monitor","seek":"monitor","error":true,"stop":true,"pause":true,"resume":true,"getters":["getPlayhead","getDuration","getResource","getPosition"],"filename":"onceux.js"}]}')},function(e,t){e.exports=function(e){return"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,i){var n=i(0),s=i(8),r=n.extend({constructor:function(e,t){this.callback=e,this.interval=t||5e3,this.isRunning=!1,this._timer=null,this.chrono=new s},start:function(){this.isRunning||(this.isRunning=!0,this._setTick())},stop:function(){if(this.isRunning=!1,this._timer)try{clearTimeout(this._timer)}catch(e){"undefined"!=typeof atv&&atv.clearTimeout(this._timer)}},_setTick:function(){this.chrono.start();try{this._timer=setTimeout(function(){this.callback(this.chrono.stop()),this._setTick()}.bind(this),this.interval)}catch(e){"undefined"!=typeof atv&&(this._timer=atv.setTimeout(function(){this.callback(this.chrono.stop()),this._setTick()}.bind(this),this.interval))}}});e.exports=r},function(e,t,i){var n=i(0),s=i(1),r=i(5),a=i(7),o=n.extend({constructor:function(e){this.transforms=[],this.pluginRef=e,this._requests=[]},sendRequest:function(e,t,i){e&&("function"==typeof t&&e.on(r.Event.SUCCESS,t,i),this._registerRequest(e))},buildRequest:function(e,t,i,n){var s=new r(e,t,i=i||{});"function"==typeof n&&s.on(r.Event.SUCCESS,n),this._registerRequest(s)},addTransform:function(e){e.parse&&e.isBlocking?(this.transforms.push(e),e.on(a.Event.DONE,this._processRequests.bind(this))):s.warn(e+" is not a valid RequestTransform.")},removeTransform:function(e){var t=this.transforms.indexOf(e);-1!==t?this.transforms.splice(t,1):s.warn("Trying to remove unexisting Transform '"+e+"'.")},_registerRequest:function(e){this._requests.push(e),this._processRequests()},_processRequests:function(){var e=this._requests;this._requests=[];for(var t=[];e.length;){var i=e.shift(),n=this._transform(i);n===a.STATE_NO_BLOCKED?(this.pluginRef&&(i.host=this.pluginRef.getHost()),i.send()):n===a.STATE_BLOCKED&&t.push(i)}for(;t.length;)this._requests.push(t.shift())},_transform:function(e){var t=a.STATE_NO_BLOCKED;return this.transforms.forEach((function(i){i.isBlocking(e)?t=a.STATE_BLOCKED:(i.parse(e),i.getState()===a.STATE_OFFLINE&&(t=a.STATE_OFFLINE))})),t}});e.exports=o},function(e,t,i){var n=i(0),s=i(1),r=n.extend({constructor:function(e,t){this.prefix=e||"youbora",this.disableCookies=t},setLocal:function(e,t){var i=null;try{"undefined"!=typeof localStorage&&localStorage?i=localStorage.setItem(this.prefix+"."+e,t):this.disableCookies||(i=this._setCookie(this.prefix+"."+e,t))}catch(e){s.error("Youbora Infinity needs localStorage or cookies, not supported by your browser.")}return i},isEnabled:function(){var e=!0;if(this.disableCookies)try{localStorage.setItem(this.prefix+".test","true"),localStorage.removeItem(this.prefix+".test")}catch(t){e=!1}return e},getLocal:function(e){return this._localGetRemove("getItem","_getCookie",e)},removeLocal:function(e){return this._localGetRemove("removeItem","_removeCookie",e)},_localGetRemove:function(e,t,i){var n=null;try{"undefined"!=typeof localStorage&&localStorage?n=localStorage[e](this.prefix+"."+i):this.disableCookies||(n=this[t](this.prefix+"."+i))}catch(e){s.error("Youbora Infinity needs localStorage or cookies, not supported by your browser.")}return n},setSession:function(e,t){var i=null;try{"undefined"!=typeof sessionStorage&&sessionStorage?i=sessionStorage.setItem(this.prefix+"."+e,t):this.disableCookies||(i=this._setCookie(this.prefix+".session."+e,t))}catch(e){s.error("Youbora Infinity needs sessionStorage or cookies, not supported by your browser.")}return i},getSession:function(e){return this._sessionGetRemove("getItem","_getCookie",e)},removeSession:function(e){return this._sessionGetRemove("removeItem","_removeCookie",e)},_sessionGetRemove:function(e,t,i){var n=null;try{"undefined"!=typeof sessionStorage&&sessionStorage?n=sessionStorage[e](this.prefix+"."+i):this.disableCookies||(n=this[t](this.prefix+".session."+i))}catch(e){s.error("Youbora Infinity needs sessionStorage or cookies, not supported by your browser.")}return n},getStorages:function(e){return this.getSession(e)||this.getLocal(e)},setStorages:function(e,t){this.setSession(e,t),this.setLocal(e,t)},removeStorages:function(e){this.removeSession(e),this.removeLocal(e)},_setCookie:function(e,t){"undefined"!=typeof document&&(document.cookie=e+"="+t+";")},_getCookie:function(e){if("undefined"!=typeof document)for(var t=e+"=",i=decodeURIComponent(document.cookie).split(";"),n=0;n<i.length;n++){for(var s=i[n];" "===s.charAt(0);)s=s.substring(1);if(0===s.indexOf(t))return s.substring(t.length,s.length)}return null},_removeCookie:function(e){"undefined"!=typeof document&&(document.cookie=e+"=;expires=Thu, 01 Jan 1970 00:00:01 GMT;")}});e.exports=r},function(e,t,i){var n=i(6),s=i(15),r=i(54),a=n.extend({constructor:function(e){this._plugin=e},andBeyond:function(){a.prototype.begin.apply(this,arguments)},begin:function(e){this._comm=new s(this._plugin),this._comm.addTransform(this._plugin.viewTransform),this._comm.addTransform(new r(this._plugin)),this._plugin&&this._plugin.storage&&"function"==typeof this._plugin.storage.getLocal&&(this._registeredProperties=this._plugin.storage.getLocal("inifnityRegisteredProperties")),!this._plugin.getIsSessionExpired()&&this._plugin.storage.getLocal("infinityStarted")?(this.fireNav(e),this._sendExtraBeat()):this.fireSessionStart(e)},_generateNewContext:function(){var e=null;try{e=btoa((new Date).getTime())}catch(t){e="Default"}this._plugin.storage.setSession("context",e)},_setLastActive:function(){this._firstActive||(this._firstActive=this.getFirstActive()),this._plugin.storage.setStorages("lastactive",(new Date).getTime())},getFirstActive:function(){return Number(this._plugin.getLastActive())||0},getComm:function(){return this._comm},fireSessionStart:function(e){this._plugin.storage.setLocal("infinityStarted","true"),this._plugin.storage.removeLocal("infinityStopped"),this.infinityStarted=!0,this.infinityStopped=!1,this._generateNewContext(),this.emit(a.Event.SESSION_START,this._getParamsJson(e,null,null,!0,!0)),this._setLastActive()},fireSessionStop:function(e){this.infinityStopped=!0,this.emit(a.Event.SESSION_STOP,e),this._plugin.storage.removeStorages("data"),this._plugin.storage.removeStorages("session"),this._plugin.storage.removeStorages("lastactive")},newSession:function(e,t){this.fireSessionStop(),this._plugin.storage.removeLocal("data"),this._plugin.setOptions(e),this._plugin.restartViewTransform(),this.fireSessionStart(t)},fireNav:function(e){this.isActive()&&(this._plugin.getContext()||this._generateNewContext(),this.emit(a.Event.NAV,this._getParamsJson(e,null,null,!0)))},_sendExtraBeat:function(){var e=(new Date).getTime();if(this._plugin&&this._plugin._beat){var t=this._plugin._beat.chrono.startTime?e-this._plugin._beat.chrono.startTime:0;this._plugin._sendBeat(t),this._plugin._beat.chrono.startTime=e}this._setLastActive()},fireEvent:function(e,t,i){this.emit(a.Event.EVENT,this._getParamsJson(t,i,e)),this._setLastActive()},register:function(e,t){this._registeredProperties={dimensions:e,values:t},this._plugin.storage.setLocal("inifnityRegisteredProperties",JSON.stringify(this._registeredProperties))},registerOnce:function(e,t){this._registeredProperties||this.register(e,t)},unregister:function(){this._registeredProperties=null,this._plugin.storage.removeLocal("inifnityRegisteredProperties")},_getParamsJson:function(e,t,i,n,s){var r={};if(i&&(r.name=i),r.dimensions=e||{},r.values=t||{},this._registeredProperties){for(var a in this._registeredProperties.dimensions)r.dimensions[a]=this._registeredProperties.dimensions[a];for(var o in this._registeredProperties.values)r.values[o]=this._registeredProperties.values[o]}var d={params:r};return n&&(d.params.dimensions.page&&(d.params.page=d.params.dimensions.page,delete d.params.dimensions.page),d.params.dimensions.route&&(d.params.route=d.params.dimensions.route,delete d.params.dimensions.route),s||delete d.params.dimensions,delete d.params.values),d},isActive:function(){var e=(new Date).getTime();return null!=this._plugin.storage.getLocal("infinityStarted")&&!this._plugin.storage.getLocal("infinityStopped")||Number(this._plugin.getLastActive())+this._plugin.sessionExpire>e}},{Event:{NAV:"nav",SESSION_START:"sessionStart",SESSION_STOP:"sessionStop",BEAT:"beat",EVENT:"event"}});e.exports=a},function(e,t,i){var n=i(6),s=i(1),r=i(2),a=i(9),o=i(62),d=i(63),h=i(34),u=i(10),c=n.extend({constructor:function(e){this.flags=new d,this.chronos=new o,this.monitor=null,this.plugin=null,this.player=null,this._isAdsAdapter=null,this.setPlayer(e),this.tag=this.player,s.notice("Adapter "+this.getVersion()+" with Lib "+a+" is ready.")},setPlayer:function(e){this.player&&this.unregisterListeners(),"string"==typeof e&&"undefined"!=typeof document?this.player=document.getElementById(e):this.player=e,this.registerListeners()},registerListeners:function(){},unregisterListeners:function(){},dispose:function(){this.monitor&&this.monitor.stop(),this.fireStop(),this.unregisterListeners(),this.player=null,this.tag=null},monitorPlayhead:function(e,t,i){this.stopMonitor();var n=0;e&&(n|=h.Type.BUFFER),t&&(n|=h.Type.SEEK),this.monitor&&this.monitor._timer.isRunning?this.monitor.skipNextTick():this.monitor=new h(this,n,i)},stopMonitor:function(){this.monitor&&this.monitor.stop()},getPlayhead:function(){return null},getDuration:function(){return null},getBitrate:function(){return null},getTotalBytes:function(){return null},getTitle:function(){return null},getResource:function(){return null},getPlayerVersion:function(){return null},getPlayerName:function(){return null},getVersion:function(){return a+"-generic-js"},fireInit:function(e){this.plugin&&this.plugin.fireInit()},fireStart:function(e){if(this.plugin&&this.plugin.backgroundDetector&&this.plugin.backgroundDetector.canBlockStartCalls())return null;this.flags.isStarted||(this.flags.isStarted=!0,this.chronos.total.start(),this.chronos.join.start(),this.emit(u.Event.START,{params:e}))},fireJoin:function(e){this.flags.isJoined||this.flags.isStarted||this._isAds()||!this.plugin||!this.plugin.isInitiated||this.fireStart(),this.flags.isStarted&&!this.flags.isJoined&&(this.flags.isStarted=!0,this.monitor&&this.monitor.start(),this.flags.isJoined=!0,this.chronos.join.stop(),this.emit(u.Event.JOIN,{params:e}))},firePause:function(e){this.flags.isBuffering&&this.fireBufferEnd(),this.flags.isJoined&&!this.flags.isPaused&&(this.flags.isPaused=!0,this.chronos.pause.start(),this.emit(u.Event.PAUSE,{params:e}))},fireResume:function(e){this.flags.isJoined&&this.flags.isPaused&&(this.flags.isPaused=!1,this.chronos.pause.stop(),this.monitor&&this.monitor.skipNextTick(),this.emit(u.Event.RESUME,{params:e}))},fireBufferBegin:function(e,t){if(this.flags.isJoined&&!this.flags.isBuffering){if(this.flags.isSeeking){if(!t)return;s.notice("Converting current buffer to seek"),this.chronos.buffer=this.chronos.seek.clone(),this.chronos.seek.reset(),this.flags.isSeeking=!1}else this.chronos.buffer.start();this.flags.isBuffering=!0,this.emit(u.Event.BUFFER_BEGIN,{params:e})}},fireBufferEnd:function(e){this.flags.isJoined&&this.flags.isBuffering&&(this.cancelBuffer(),this.emit(u.Event.BUFFER_END,{params:e}))},cancelBuffer:function(e){this.flags.isJoined&&this.flags.isBuffering&&(this.flags.isBuffering=!1,this.chronos.buffer.stop(),this.monitor&&this.monitor.skipNextTick())},fireStop:function(e){(this._isAds()||this.plugin&&this.plugin._isStopReady())&&(this._isAds()&&this.flags.isStarted||!this._isAds()&&(this.flags.isStarted||this.plugin&&this.plugin.isInitiated))&&(this.monitor&&this.monitor.stop(),this.flags.reset(),this.chronos.total.stop(),this.chronos.join.reset(),this.chronos.pause.stop(),this.chronos.buffer.stop(),this.chronos.seek.stop(),this.emit(u.Event.STOP,{params:e}),this.chronos.pause.reset(),this.chronos.buffer.reset(),this.chronos.seek.reset(),this.chronos.viewedMax.splice(0,this.chronos.viewedMax.length))},setIsAds:function(e){this._isAdsAdapter=e},_isAds:function(){return this._isAdsAdapter},fireCasted:function(e){e||(e={}),e.casted=!0,this.fireStop(e)},fireError:function(e,t,i,n){var s=r.buildErrorParams(e,t,i,n);s.code&&delete s.code,this.emit(u.Event.ERROR,{params:s})},fireFatalError:function(e,t,i,n){this.monitor&&this.monitor.stop(),this.fireError(e,t,i,n),this.fireStop()}},{Event:u.Event});r.assign(c.prototype,i(64)),r.assign(c.prototype,i(65)),e.exports=c},function(e,t){e.exports=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 s in n)n.hasOwnProperty(s)&&(t[s]=n[s])}return t}},function(e,t,i){var n=i(0).extend({getCdnTraffic:function(){var e=null;if("undefined"!=typeof Streamroot)e=this._getStreamrootPeerObject("cdn",!1)||this._getStreamrootInstanceObject("cdnDownload");else if("undefined"!=typeof peer5&&peer5.getStats)e=peer5.getStats().totalHttpDownloaded;else if("undefined"!=typeof teltoo&&teltoo.getStats){var t=teltoo.getStats();e=t.totalReceivedBytes-t.p2pReceivedBytes}return e},getP2PTraffic:function(){var e=null;return"undefined"!=typeof Streamroot?e=this._getStreamrootPeerObject("p2p",!0)||this._getStreamrootInstanceObject("dnaDownload"):"undefined"!=typeof peer5&&peer5.getStats?e=peer5.getStats().totalP2PDownloaded:"undefined"!=typeof teltoo&&teltoo.getStats&&(e=teltoo.getStats().p2pReceivedBytes),e},getUploadTraffic:function(){var e=null;return"undefined"!=typeof Streamroot?e=this._getStreamrootPeerObject("upload",!0)||this._getStreamrootInstanceObject("dnaUpload"):"undefined"!=typeof peer5&&peer5.getStats&&(e=peer5.getStats().totalP2PUploaded),e},getIsP2PEnabled:function(){var e=!1;if("undefined"!=typeof Streamroot)if(Streamroot.p2pAvailable&&Streamroot.peerAgents)for(var t in Streamroot.peerAgents)e=e||Streamroot.peerAgents[t].isP2PEnabled;else Streamroot.instances&&Streamroot.instances.forEach((function(t){e=e||t.dnaDownloadEnabled||t.dnaUploadEnabled}));else"undefined"!=typeof peer5&&peer5.isEnabled?e=peer5.isEnabled():"undefined"!=typeof teltoo&&(e=!0);return e},_getStreamrootPeerObject:function(e,t){var i=null;if(Streamroot.p2pAvailable&&Streamroot.peerAgents)for(var n in Streamroot.peerAgents){var s=Streamroot.peerAgents[n];!s.stats||t&&!s.isP2PEnabled||(i+=s.stats[e])}return i},_getStreamrootInstanceObject:function(e){var t=null;return Streamroot.instances&&Streamroot.instances.forEach((function(i){i.stats&&i.stats.currentContent&&(t+=i.stats.currentContent[e])})),t}});e.exports=n},function(e,t){e.exports={Preroll:"pre",Midroll:"mid",Postroll:"post"}},function(e,t,i){var n=i(5),s=i(7),r=i(1),a=i(2),o=i(4),d=s.extend({constructor:function(e,t){s.prototype.constructor.apply(this,arguments),this.response={},this._viewIndex=(new Date).getTime(),this._session=t,this._httpSecure=e.options["app.https"],this._plugin=e,this.transformName="View"},init:function(){if(this._plugin.options&&this._plugin.options.offline)return this.response.host="OFFLINE",this.response.code="OFFLINE",this.response.pingTime=60,this.response.beatTime=60,this.done(),null;if(this._plugin.storage.isEnabled()&&((new Date).getTime()<this._plugin.sessionExpire+(Number(this._plugin.getDataTime())||0)&&this._plugin.getStoredData()))return this.setData(this._plugin.getStoredData()),null;var e=o.Service.DATA,t={outputformat:"json"};null!==(t=this._plugin.requestBuilder.buildParams(t,e))&&(r.notice(e+" "+t.system),"nicetest"===t.system&&r.error("No accountCode has been set. Please set your accountCode inside plugin's options."),new n(this._plugin.getHost(),e,t).on(n.Event.SUCCESS,this._receiveData.bind(this)).on(n.Event.ERROR,this._failedData.bind(this)).send())},setData:function(e){try{var t=JSON.parse(e);this._plugin.options["parse.fdsResponseHost"]&&(e=e.replace(t.q.h,this._plugin.options["parse.fdsResponseHost"](t.q.h)),t=JSON.parse(e)),this.response.msg=e,this.response.host=a.addProtocol(t.q.h,this._httpSecure),this.response.code=t.q.c,this.response.pingTime=t.q.pt||5,this.response.beatTime=t.q.i&&t.q.i.bt||30,this.response.sessionExpire=t.q.i&&t.q.i.exp||300,this._plugin.storage.setLocal("sessionExpire",this.response.sessionExpire),this.done()}catch(e){r.error("Fastdata response is invalid.")}},_receiveData:function(e,t){var i=e.getResponse();this.setData(i)},_failedData:function(e,t){r.error("Fastdata request has failed.")},nextView:function(){return this._viewIndex=(new Date).getTime(),this.getViewCode()},getViewCode:function(){return this.response.code+"_"+this._viewIndex},getSession:function(){return this._session},setSession:function(e){this._session=e},parse:function(e){e.host=e.host||this.response.host,e.params.system=this._plugin.getAccountCode(),e.params.sessionRoot=e.params.sessionRoot||this.getSession(),-1!==d.EventList.PingTime.indexOf(e.service)&&(e.params.pingTime=e.params.pingTime||this.response.pingTime),-1===d.EventList.Infinity.indexOf(e.service)?e.params.code=e.params.code||this.getViewCode():e.params.sessionId=e.params.sessionRoot,-1!==d.EventList.CreateView.indexOf(e.service)&&(this._plugin.infinity.infinityStarted||this._plugin.storage.isEnabled()&&this._plugin.storage.getLocal("infinityStarted"))&&(e.params.parentId=e.params.sessionRoot,e.params.navContext=e.params.navContext||this._plugin.getContext())}},{EventList:{CreateView:[o.Service.START,o.Service.INIT,o.Service.ERROR],Infinity:[o.Service.NAV,o.Service.SESSION_START,o.Service.SESSION_STOP,o.Service.EVENT,o.Service.BEAT],PingTime:[o.Service.START,o.Service.PING]}});e.exports=d},function(e,t,i){var n=i(7),s=i(24),r=i(25),a=i(26),o=i(11),d=i(27),h=i(1),u=i(4),c=n.extend({constructor:function(e){c.__super__.constructor.apply(this,arguments),this.isDone=!1,this._plugin=e,this._realResource=null,this._initResource=null,this._cdnName=null,this._cdnNodeHost=null,this._cdnNodeTypeString=null,this._cdnNodeType=null,this._responses={},this._isBusy=!1,this.transformName="Resource"},getResource:function(){var e=this._realResource;return this._plugin&&this._plugin.options&&this._plugin.options["content.resource"]&&!this._plugin.options["parse.manifest"]&&(e=this._plugin.options["content.resource"]),e},getCdnName:function(){return this._cdnName},getNodeHost:function(){return this._cdnNodeHost},getNodeTypeString:function(){return this._cdnNodeTypeString},getNodeType:function(){return this._cdnNodeType},init:function(e){this._isBusy||this.isDone||(this._isBusy=!0,this._initResource=e,this._parseManifestEnabled=this._plugin.isParseManifest(),this._cdnEnabled=this._plugin.isParseCdnNode(),this._cdnList=this._plugin.getParseCdnNodeList().slice(),this._cdnNameHeader=this._plugin.getParseCdnNodeNameHeader(),r.setBalancerHeaderName(this._cdnNameHeader),this._setTimeout(),this._parseManifestEnabled?this.parseManifest():this._parseCDN())},done:function(){this.isDone=!1,n.prototype.done.apply(this,arguments)},_setTimeout:function(){try{this._parseTimeout=setTimeout(function(){this._isBusy&&(this.done(),h.warn("ResourceTransform has exceded the maximum execution time (3s) and will be aborted."))}.bind(this),3e3)}catch(e){"undefined"!=typeof atv?this._parseTimeout=atv.setTimeout(function(){this._isBusy&&(this.done(),h.warn("ResourceTransform has exceded the maximum execution time (3s) and will be aborted."))}.bind(this),3e3):h.error(e)}},parseManifest:function(e,t){var i=[new d,new a,new s];this._parseManifest(i,e,t||this._initResource)},_parseManifest:function(e,t,i){if(e.length>0){var n=e[0];n.shouldExecute(t)?(n.on(o.Event.DONE,function(){this._parseManifest(e.slice(1,e.length),n.getLastManifest(),n.getResource())}.bind(this)),n.parse(i,t)):this._parseManifest(e.slice(1,e.length),t,i)}else this._realResource=i,this._parseCDN()},_parseCDN:function(){if(this._cdnEnabled&&this._cdnList.length>0){var e=this._cdnList.shift();if(this.getNodeHost())return;var t=r.create(e);t?(t.on(r.Event.DONE,function(){this._responses=t.getResponses(),this._cdnName=t.getParsedCdnName(),this._cdnNodeHost=t.getParsedNodeHost(),this._cdnNodeTypeString=t.getParsedNodeTypeString(),this._cdnNodeType=t.getParsedNodeType(),this.getNodeHost()?this.done():this._parseCDN()}.bind(this)),t.parse(this.getResource(),this._responses)):this._parseCDN()}else this.done()},parse:function(e){if(e.service===u.Service.START){var t=this._plugin.requestBuilder.lastSent;t.parsedResource=e.params.parsedResource=this.getResource(),this._cdnEnabled&&(t.cdn=e.params.cdn=e.params.cdn||this.getCdnName(),t.nodeHost=e.params.nodeHost=this.getNodeHost(),t.nodeType=e.params.nodeType=this.getNodeType(),t.nodeTypeString=e.params.nodeTypeString=this.getNodeTypeString())}}});e.exports=c},function(e,t,i){var n=i(5),s=i(11),r=i(1),a=s.extend({parse:function(e,t,i){i=i||"";try{var s=/((\S*?)(\.m3u8|\.m3u|\.ts|\.mp4)((\?|;)\S*|\n|\r|$))/i.exec(e)}catch(e){r.warn("Parse HLS Regex failed",e),this.done()}if(null!==s){var a=s[1].trim(),o="",d=i.lastIndexOf("/");if(0!==a.indexOf("http")&&-1!==d&&(a=i.slice(0,d)+"/"+a,o=i.slice(0,d)+"/"),".m3u8"===s[3]||".m3u"===s[3])if(t)this._parseWithManifest(t,o,s);else{var h=new n(a,null,null,{cache:!0});h.on(n.Event.SUCCESS,function(e){this._parseWithManifest(e,o,s)}.bind(this)),h.on(n.Event.ERROR,function(e){this.done()}.bind(this)),h.send()}else this._realResource=a,this.done()}else this.done()},_parseWithManifest:function(e,t,i){this._lastManifest=e,this.parse(e.getResponseText(),null,t+i[2])},shouldExecute:function(e){var t=!0;e&&(t=-1!==e.getResponseText().indexOf("#EXTM3U"));return t}});e.exports=a},function(e,t,i){var n=i(6),s=i(1),r=i(2),a=i(5),o=n.extend({constructor:function(e){this._options=r.assign({cdnName:null,parsers:[],requestMethod:"HEAD",requestHeaders:{},parseType:function(){return 0}},e),this._responses={}},done:function(){this.emit(o.Event.DONE)},addParser:function(e){return this._options.parsers.push(e),this},setCdnName:function(e){return this._options.cdnName=e,this},setRequestMethod:function(e){return this._options.requestMethod=e,this},setRequestHeader:function(e,t){return this._options.requestHeaders[e]=t,this},setParseType:function(e){return this._options.parseType=e,this},getParsedCdnName:function(){return this._cdnName},getParsedNodeHost:function(){return this._cdnNodeHost},getParsedNodeTypeString:function(){return this._cdnNodeTypeString},getParsedNodeType:function(){return this._cdnNodeType},getResponses:function(){return this._responses},parse:function(e,t){this._responses=t||{};var i=JSON.stringify(this._options.requestHeaders);this._responses[i]?this._parseResponse(this._responses[i]):this._requestResponse(e)},_requestResponse:function(e){var t=JSON.stringify(this._options.requestHeaders),i=new a(e,null,null,{method:this._options.requestMethod,maxRetries:0,requestHeaders:this._options.requestHeaders});i.on(a.Event.SUCCESS,function(e){this._responses[t]=e.getResponseHeaders(),this._parseResponse(this._responses[t])}.bind(this)),i.on(a.Event.ERROR,function(e){this.done()}.bind(this)),i.send()},_parseResponse:function(e){this._options.parsers.forEach(function(t){e.split("\n").forEach(function(e){var i=e.indexOf(":");-1!==i&&(e.slice(0,i)===t.headerName&&this._executeParser(t,e.slice(i+1)))}.bind(this))}.bind(this)),this.done()},_executeParser:function(e,t){try{var i=e.regex.exec(t.trim());if(null!==i)switch(this._options.cdnName&&(this._cdnName=this._options.cdnName),e.element){case o.ElementType.HOST:this._cdnNodeHost=i[1];break;case o.ElementType.TYPE:this._cdnNodeTypeString=i[1],this._cdnNodeType=this._options.parseType(this._cdnNodeTypeString);break;case o.ElementType.HOST_AND_TYPE:this._cdnNodeHost=i[1],this._cdnNodeTypeString=i[2],this._cdnNodeType=this._options.parseType(this._cdnNodeTypeString);break;case o.ElementType.TYPE_AND_HOST:this._cdnNodeTypeString=i[1],this._cdnNodeType=this._options.parseType(this._cdnNodeTypeString),this._cdnNodeHost=i[2];break;case o.ElementType.NAME:this._cdnName=i[1].toUpperCase()}}catch(e){s.warn("CDN parsing for "+this._options.cdnName+" could not parse header value "+t)}},shouldExecute:function(){return!0}},{Event:{DONE:"done"},ElementType:{HOST:"host",TYPE:"type",HOST_AND_TYPE:"host+type",TYPE_AND_HOST:"type+host",NAME:"name"},_cdnConfigs:{},setBalancerHeaderName:function(e){o._cdnConfigs.Balancer.parsers[0].headerName=e},create:function(e){if(o._cdnConfigs[e])return new o(o._cdnConfigs[e]);s.warn("Tried to create an unexisting CdnParser named "+e)},add:function(e,t){o._cdnConfigs[e]=t}});o.add("Level3",i(42)),o.add("Cloudfront",i(43)),o.add("Akamai",i(44)),o.add("Highwinds",i(45)),o.add("Fastly",i(46)),o.add("Telefonica",i(47)),o.add("Amazon",i(48)),o.add("Balancer",i(49)),e.exports=o},function(e,t,i){var n=i(5),s=i(11),r=i(1),a=s.extend({parse:function(e,t){if(t)this.parseLocation(t,e);else{var i=new n(e,null,null,{cache:!0});i.on(n.Event.SUCCESS,function(t){this.parseLocation(t,e)}.bind(this)),i.on(n.Event.ERROR,function(e){this.done()}.bind(this)),i.send()}},parseLocation:function(e,t){var i=new RegExp(/.*<Location>([\s\S]+)<\/Location>.*/);try{this._lastManifest=e;var n=e.getResponseText(),s=i.exec(n);s&&s[1]?this.parse(s[1].replace("\n","")):this.parseFinalResource(n,t)}catch(e){r.warn("Dash parse failed"),this.done()}},parseFinalResource:function(e,t){var i=new RegExp(/[\s\S]*<BaseURL>([\s\S]+)<\/BaseURL>[\s\S]*/),n=new RegExp(/[\s\S]*<SegmentURL[\s\S]*media="([^"]+)[\s\S]*/),s=new RegExp(/[\s\S]*<SegmentTemplate[\s\S]*media="([^"]+)[\s\S]*/),a=null;try{(a=i.exec(e)||s.exec(e)||n.exec(e))&&a[1]&&this._isFullUrl(a[1])?a[1].indexOf('"')>0?this._realResource=a[1].substr(0,a[1].indexOf('"')).replace("\n",""):this._realResource=a[1].replace("\n",""):this._realResource=t}catch(e){r.warn("Dash manifest parse failed")}this.done()},_isFullUrl:function(e){return-1!==e.indexOf("http")},shouldExecute:function(e){var t=!0;e&&(t=-1!==e.getResponseText().indexOf("<MPD "));return t}});e.exports=a},function(e,t,i){var n=i(5),s=i(11).extend({parse:function(e,t){if(t)this._parseWithManifest(t);else{this._realResource=e;var i=new n(e,null,null,{cache:!0});i.on(n.Event.SUCCESS,function(e){this._parseWithManifest(e)}.bind(this)),i.on(n.Event.ERROR,function(e){this.done()}.bind(this)),i.send()}},_parseWithManifest:function(e){this._lastManifest=e;var t=e.getResponseHeaders(),i=!1;t.split("\n").forEach(function(e){e.startsWith("Location:")&&(this._realResource=e.slice(10),this.parse(this._realResource),i=!0)}.bind(this)),i||this.done()}});e.exports=s},function(e,t,i){var n=i(7),s=n.extend({constructor:function(e,t){this._sendRequest=!1,this._isBusy=!1,this.plugin=e,this.session=t,this.transformName="Offline"},parse:function(e){e&&this.plugin.offlineStorage.addEvent(e.service,e.params)},hasToSend:function(e){return!1},getState:function(){return n.STATE_OFFLINE}});e.exports=s},function(e,t,i){var n=i(0),s=i(50),r=i(1),a=n.extend({constructor:function(e){this.enabled=!0,this.host="a-fds.youborafds01.com",this.accountCode="nicetest",this.preventZombieViews=!0,this.offline=!1,this.referer=null,this.disableCookies=!0,this["user.email"]=null,this["user.type"]=null,this["user.name"]=null,this["user.obfuscateIp"]=!1,this["user.anonymousId"]=null,this["parse.manifest"]=!1,this["parse.cdnNameHeader"]="x-cdn-forward",this["parse.cdnNode"]=!1,this["parse.cdnNode.list"]=["Akamai","Amazon","Cloudfront","Level3","Fastly","Highwinds","Telefonica"],this["parse.fdsResponseHost"]=null,this["network.ip"]=null,this["network.isp"]=null,this["network.connectionType"]=null,this["device.code"]=null,this["device.model"]=null,this["device.brand"]=null,this["device.type"]=null,this["device.name"]=null,this["device.osName"]=null,this["device.osVersion"]=null,this["device.browserName"]=null,this["device.browserVersion"]=null,this["device.browserType"]=null,this["device.browserEngine"]=null,this["device.isAnonymous"]=!1,this["content.transactionCode"]=null,this["content.resource"]=null,this["content.isLive"]=null,this["content.isLive.noSeek"]=!1,this["content.title"]=null,this["content.program"]=null,this["content.duration"]=null,this["content.fps"]=null,this["content.bitrate"]=null,this["content.totalBytes"]=null,this["content.sendTotalBytes"]=!1,this["content.throughput"]=null,this["content.rendition"]=null,this["content.cdn"]=null,this["content.cdnNode"]=null,this["content.cdnType"]=null,this["content.metadata"]={},this["content.metrics"]={},this["content.streamingProtocol"]=null,this["content.package"]=null,this["content.saga"]=null,this["content.tvShow"]=null,this["content.season"]=null,this["content.episodeTitle"]=null,this["content.channel"]=null,this["content.id"]=null,this["content.imdbId"]=null,this["content.gracenoteId"]=null,this["content.type"]=null,this["content.genre"]=null,this["content.language"]=null,this["content.subtitles"]=null,this["content.contractedResolution"]=null,this["content.cost"]=null,this["content.price"]=null,this["content.playbackType"]=null,this["content.drm"]=null,this["content.encoding.videoCodec"]=null,this["content.encoding.audioCodec"]=null,this["content.encoding.codecSettings"]=null,this["content.encoding.codecProfile"]=null,this["content.encoding.containerFormat"]=null,this["ad.metadata"]={},this["ad.campaign"]=null,this["ad.creativeId"]=null,this["ad.provider"]=null,this["ad.resource"]=null,this["ad.title"]=null,this["ad.expectedPattern"]=null,this["ad.givenAds"]=null,this["ad.breaksTime"]=null,this["ad.expectedBreaks"]=null,this["ad.givenBreaks"]=null,this["ad.ignore"]=!1,this["ad.blockDetection"]=!1,this["app.name"]=null,this["app.releaseVersion"]=null,this["app.https"]=!1,this["background.enabled"]=!0,this["background.settings"]=null,this["background.settings.android"]="stop",this["background.settings.iOS"]="stop",this["background.settings.desktop"]=null,this["background.settings.tv"]="stop",this["background.settings.playstation"]="stop",this["smartswitch.configCode"]=null,this["smartswitch.groupCode"]=null,this["smartswitch.contractCode"]=null,this["content.customDimension.1"]=null,this["content.customDimension.2"]=null,this["content.customDimension.3"]=null,this["content.customDimension.4"]=null,this["content.customDimension.5"]=null,this["content.customDimension.6"]=null,this["content.customDimension.7"]=null,this["content.customDimension.8"]=null,this["content.customDimension.9"]=null,this["content.customDimension.10"]=null,this["content.customDimension.11"]=null,this["content.customDimension.12"]=null,this["content.customDimension.13"]=null,this["content.customDimension.14"]=null,this["content.customDimension.15"]=null,this["content.customDimension.16"]=null,this["content.customDimension.17"]=null,this["content.customDimension.18"]=null,this["content.customDimension.19"]=null,this["content.customDimension.20"]=null,this["ad.customDimension.1"]=null,this["ad.customDimension.2"]=null,this["ad.customDimension.3"]=null,this["ad.customDimension.4"]=null,this["ad.customDimension.5"]=null,this["ad.customDimension.6"]=null,this["ad.customDimension.7"]=null,this["ad.customDimension.8"]=null,this["ad.customDimension.9"]=null,this["ad.customDimension.10"]=null,this.forceInit=!1,this["session.metrics"]={},this["session.context"]=!1,this.waitForMetadata=!1,this.pendingMetadata=[],this.setOptions(e)},setOptions:function(e,t){var i=!1;if(void 0===t){t=this,i=!0;var n=new s}if(void 0!==e)for(var a in e){var o=!1,d=null;i&&(this.hasOwnProperty(a)||(n.exists(a)?(d=n.getNewName(a),o=!0):r.warn('The option "'+a+'" does not exist, so it cannot be set'))),"object"!=typeof t[a]||null===t[a]||Array.isArray(t[a])||"parse.cdnNode.list"!==a?o?t[d]=e[a]:t[a]=e[a]:this.setOptions(e[a],t[a])}},setExtraParams:function(e){if("object"==typeof e&&e.length){for(e.length>=20&&(e=e.slice(0,20));e.length<20;)e.push(null);e.forEach(function(e,t){this["content.customDimension."+(t+1).toString()]=e}.bind(this))}},setCustomDimensions:function(){a.prototype.setExtraParams.apply(this,arguments)},setAdExtraParams:function(e){if("object"==typeof e&&e.length){for(e.length>=10&&(e=e.slice(0,10));e.length<10;)e.push(null);e.forEach(function(e,t){this["ad.customDimension."+(t+1).toString()]=e}.bind(this))}},setAdCustomDimensions:function(){a.prototype.setAdExtraParams.apply(this,arguments)}},{StreamingProtocol:{HDS:"HDS",HLS:"HLS",MSS:"MSS",DASH:"DASH",RTMP:"RTMP",RTP:"RTP",RTSP:"RTSP"}});e.exports=a},function(e,t,i){var n=i(0),s=i(1),r=["accountCode","username","anonymousUser","rendition","deviceInfo","player","title","title2","live","mediaDuration","mediaResource","parsedResource","transactionCode","properties","cdn","playerVersion","param1","param2","param3","param4","param5","param6","param7","param8","param9","param10","param11","param12","param13","param14","param15","param16","param17","param18","param19","param20","playerStartupTime","obfuscateIp","p2pEnabled","pluginVersion","pluginInfo","isp","connectionType","ip","referer","userType","streamingProtocol","householdId","adsBlocked","adsExpected","deviceUUID","smartswitchConfigCode","smartswitchGroupCode","smartswitchContractCode","libVersion","nodeHost","nodeType","appName","appReleaseVersion","package","saga","tvshow","season","titleEpisode","channel","imdbID","gracenoteID","contentType","genre","contentLanguage","subtitles","cost","price","playbackType","email","drm","videoCodec","audioCodec","codecSettings","codecProfile","containerFormat","contentId","contractedResolution"],a=["playhead","adTitle","position","adDuration","adCampaign","adCreativeId","adProvider","adResource","adPlayerVersion","adProperties","adAdapterVersion","extraparam1","extraparam2","extraparam3","extraparam4","extraparam5","extraparam6","extraparam7","extraparam8","extraparam9","extraparam10","fullscreen","audio","skippable","adNumber","breakNumber"],o=n.extend({constructor:function(e){this._plugin=e,this._adNumber=0,this.lastSent={}},fetchParams:function(e,t,i){e=e||{},t=t||[];for(var n=0;n<t.length;n++){var r=t[n];if(!e[r]){var a=o.getters[r];if(this._plugin[a]){var d=this._plugin[a]();null===d||i&&this.lastSent[r]===d||(e[r]=d,this.lastSent[r]=d)}else s.warn("Trying to call undefined getter "+r+":"+a)}}return e},getGetters:function(){return o.getters},buildBody:function(e){return this.fetchParams(null,o.bodyParams[e],!1)},buildParams:function(e,t){return e=e||{},this.fetchParams(e,o.params[t],!1),this.fetchParams(e,o.differentParams[t],!0),e},getNewAdNumber:function(){var e=this.lastSent.adNumber;return e&&this.lastSent.position===this._plugin.getAdPosition()?e+=1:e=1,this.lastSent.adNumber=e,e},getNewBreakNumber:function(){var e=1;return this.lastSent.breakNumber&&(e=this.lastSent.breakNumber+1),this.lastSent.breakNumber=e,e},getChangedEntities:function(){return this.fetchParams({},o.differentParams.entities,!0)}},{params:{"/data":["system","pluginVersion","requestNumber","username"],"/init":r,"/start":r,"/joinTime":["joinDuration","playhead"],"/pause":["playhead"],"/resume":["pauseDuration","playhead"],"/seek":["seekDuration","playhead"],"/bufferUnderrun":["bufferDuration","playhead"],"/error":["player"].concat(r),"/stop":["bitrate","totalBytes","playhead","pauseDuration"],"/infinity/video/event":[],"/adInit":a,"/adStart":a,"/adJoin":["playhead","position","adJoinDuration","adPlayhead","adNumber","breakNumber"],"/adPause":["playhead","position","adPlayhead","adNumber","breakNumber"],"/adResume":["playhead","position","adPlayhead","adPauseDuration","adNumber","breakNumber"],"/adBufferUnderrun":["playhead","position","adPlayhead","adBufferDuration","adNumber","breakNumber"],"/adStop":["playhead","position","adPlayhead","adBitrate","adTotalDuration","pauseDuration","adViewedDuration","adViewability","adNumber","breakNumber"],"/adClick":["playhead","position","adPlayhead","adNumber","breakNumber"],"/adError":a,"/adManifest":["givenBreaks","expectedBreaks","expectedPattern","breaksTime"],"/adBreakStart":["position","givenAds","expectedAds","breakNumber"],"/adBreakStop":["position","breakNumber"],"/adQuartile":["position","adViewedDuration","adViewability","adNumber","breakNumber"],"/ping":["droppedFrames","playrate","cdnDownloadedTraffic","p2pDownloadedTraffic","uploadTraffic","latency","packetLoss","packetSent","metrics","totalBytes"],"/infinity/session/start":["accountCode","username","anonymousUser","navContext","route","page","referer","referral","language","deviceInfo","adsBlocked","deviceUUID","libVersion","appName","appReleaseVersion"],"/infinity/session/stop":[],"/infinity/session/nav":["navContext","route","page"],"/infinity/session/beat":["sessionMetrics"],"/infinity/session/event":["accountCode","navContext"],"/offlineEvents":{}},bodyParams:{"/offlineEvents":["viewJson"]},differentParams:{entities:["rendition","title","title2","param1","param2","param3","param4","param5","param6","param7","param8","param9","param10","param11","param12","param13","param14","param15","param16","param17","param18","param19","param20","cdn","nodeHost","nodeType","nodeTypeString","subtitles","contentLanguage"]},getters:{requestNumber:"getRequestNumber",playhead:"getPlayhead",playrate:"getPlayrate",fps:"getFramesPerSecond",droppedFrames:"getDroppedFrames",mediaDuration:"getDuration",bitrate:"getBitrate",totalBytes:"getTotalBytes",throughput:"getThroughput",rendition:"getRendition",title:"getTitle",title2:"getTitle2",live:"getIsLive",mediaResource:"getResource",parsedResource:"getParsedResource",transactionCode:"getTransactionCode",properties:"getMetadata",playerVersion:"getPlayerVersion",player:"getPlayerName",cdn:"getCdn",pluginVersion:"getPluginVersion",libVersion:"getLibVersion",userType:"getUserType",streamingProtocol:"getStreamingProtocol",obfuscateIp:"getObfuscateIp",householdId:"getHouseholdId",latency:"getLatency",packetLoss:"getPacketLoss",packetSent:"getPacketSent",metrics:"getVideoMetrics",param1:"getExtraparam1",param2:"getExtraparam2",param3:"getExtraparam3",param4:"getExtraparam4",param5:"getExtraparam5",param6:"getExtraparam6",param7:"getExtraparam7",param8:"getExtraparam8",param9:"getExtraparam9",param10:"getExtraparam10",param11:"getExtraparam11",param12:"getExtraparam12",param13:"getExtraparam13",param14:"getExtraparam14",param15:"getExtraparam15",param16:"getExtraparam16",param17:"getExtraparam17",param18:"getExtraparam18",param19:"getExtraparam19",param20:"getExtraparam20",extraparam1:"getAdExtraparam1",extraparam2:"getAdExtraparam2",extraparam3:"getAdExtraparam3",extraparam4:"getAdExtraparam4",extraparam5:"getAdExtraparam5",extraparam6:"getAdExtraparam6",extraparam7:"getAdExtraparam7",extraparam8:"getAdExtraparam8",extraparam9:"getAdExtraparam9",extraparam10:"getAdExtraparam10",position:"getAdPosition",adNumber:"getAdNumber",breakNumber:"getBreakNumber",adPlayhead:"getAdPlayhead",adDuration:"getAdDuration",adCampaign:"getAdCampaign",adCreativeId:"getAdCreativeId",adBitrate:"getAdBitrate",adTitle:"getAdTitle",adResource:"getAdResource",adPlayerVersion:"getAdPlayerVersion",adProperties:"getAdMetadata",adAdapterVersion:"getAdAdapterVersion",givenBreaks:"getGivenBreaks",expectedBreaks:"getExpectedBreaks",expectedPattern:"getExpectedPattern",breaksTime:"getBreaksTime",givenAds:"getGivenAds",expectedAds:"getExpectedAds",adsExpected:"getAdsExpected",adViewedDuration:"getAdViewedDuration",adViewability:"getAdViewability",fullscreen:"getIsFullscreen",audio:"getAudioEnabled",skippable:"getIsSkippable",adProvider:"getAdProvider",pluginInfo:"getPluginInfo",isp:"getIsp",connectionType:"getConnectionType",ip:"getIp",deviceInfo:"getDeviceInfo",system:"getAccountCode",accountCode:"getAccountCode",username:"getUsername",anonymousUser:"getAnonymousUser",joinDuration:"getJoinDuration",bufferDuration:"getBufferDuration",seekDuration:"getSeekDuration",pauseDuration:"getPauseDuration",adJoinDuration:"getAdJoinDuration",adBufferDuration:"getAdBufferDuration",adPauseDuration:"getAdPauseDuration",adTotalDuration:"getAdTotalDuration",referer:"getReferer",referral:"getReferral",language:"getLanguage",nodeHost:"getNodeHost",nodeType:"getNodeType",nodeTypeString:"getNodeTypeString",route:"getReferer",navContext:"getContext",page:"getPageName",playerStartupTime:"getPlayerStartupTime",pageLoadTime:"getPageLoadTime",cdnDownloadedTraffic:"getCdnTraffic",p2pDownloadedTraffic:"getP2PTraffic",p2pEnabled:"getIsP2PEnabled",uploadTraffic:"getUploadTraffic",viewJson:"getOfflineView",deviceUUID:"getDeviceUUID",sessionMetrics:"getSessionMetrics",adsBlocked:"getIsBlocked",smartswitchConfigCode:"getSmartswitchConfigCode",smartswitchGroupCode:"getSmartswitchGroupCode",smartswitchContractCode:"getSmartswitchContractCode",appName:"getAppName",appReleaseVersion:"getAppReleaseVersion",package:"getPackage",saga:"getSaga",tvshow:"getTvShow",season:"getSeason",titleEpisode:"getEpisodeTitle",channel:"getChannel",drm:"getDRM",videoCodec:"getVideoCodec",audioCodec:"getAudioCodec",codecSettings:"getCodecSettings",codecProfile:"getCodecProfile",containerFormat:"getContainerFormat",contentId:"getID",imdbID:"getImdbId",gracenoteID:"getGracenoteID",contentType:"getType",genre:"getGenre",contentLanguage:"getVideoLanguage",subtitles:"getSubtitles",contractedResolution:"getContractedResolution",cost:"getCost",price:"getPrice",playbackType:"getPlaybackType",email:"getEmail"}});e.exports=o},function(e,t,i){var n=i(0).extend({constructor:function(e){this.plugin=e,this.isInBackground=!1,this.listenerReference=this._visibilityListener.bind(this),this._reset()},startDetection:function(){this.isBackgroundDetectorStarted||"undefined"==typeof document||(this.isBackgroundDetectorStarted=!0,document.addEventListener("visibilitychange",this.listenerReference))},stopDetection:function(){this.isBackgroundDetectorStarted&&"undefined"!=typeof document&&(document.removeEventListener("visibilitychange",this.listenerReference),this._reset())},_reset:function(){this.isBackgroundDetectorStarted=!1},_visibilityListener:function(e){if("undefined"!=typeof document){var t=this._getSettings();"hidden"===document.visibilityState?this._toBackground(t):"visible"===document.visibilityState&&this._toForeground(t)}},_toBackground:function(e){if(this.isInBackground=!0,this.plugin&&this.plugin._adsAdapter&&this.plugin._adsAdapter.stopChronoView(),"string"==typeof e){switch(e){case"stop":this._fireStop();break;case"pause":this._firePause()}if(null!=this.plugin.storage.getLocal("infinityStarted")&&!this.plugin.storage.getLocal("infinityStopped")){this.lastBeatTime=(new Date).getTime();var t=this.plugin._beat.chrono.startTime?this.lastBeatTime-this.plugin._beat.chrono.startTime:0;this.plugin._sendBeat(t),this.plugin._beat.stop()}}},_toForeground:function(e){if(this.isInBackground=!1,this.plugin&&this.plugin._adsAdapter&&this.plugin._adsAdapter.startChronoView(),"string"==typeof e&&e&&null!=this.plugin.storage.getLocal("infinityStarted")&&!this.plugin.storage.getLocal("infinityStopped")){var t=(new Date).getTime();t-this.lastBeatTime<this.plugin.sessionExpire?(this.plugin._sendBeat(t-this.lastBeatTime),this.plugin._beat.start()):(this.plugin.restartViewTransform(),this.plugin.infinity.begin())}},_getSettings:function(){return"string"==typeof this.plugin.options["background.settings"]&&this.plugin.options["background.settings"]?this.plugin.options["background.settings"]:this.plugin.deviceDetector.isSmartTV()?this.plugin.options["background.settings.tv"]:this.plugin.deviceDetector.isDesktop()?this.plugin.options["background.settings.desktop"]:this.plugin.deviceDetector.isAndroid()?this.plugin.options["background.settings.android"]:this.plugin.deviceDetector.isIphone()?this.plugin.options["background.settings.iOS"]:this.plugin.deviceDetector.isPlayStation()?this.plugin.options["background.settings.playstation"]:void 0},_firePause:function(){this._fireX("firePause")},_fireStop:function(){this._fireX("fireStop"),this.plugin.fireStop()},_fireX:function(e){this.adsAdapter=this.plugin.getAdsAdapter(),this.adsAdapter&&this.adsAdapter[e](),this.contentAdapter=this.plugin.getAdapter(),this.contentAdapter&&this.contentAdapter[e]()},canBlockStartCalls:function(){return this.isInBackground&&!0===this.plugin.options["background.enabled"]&&this._getSettings()}});e.exports=n},function(e,t,i){var n=i(0).extend({constructor:function(){"undefined"!=typeof navigator&&navigator.userAgent&&(this._isSmartTVDevice=navigator.userAgent.toLowerCase().match(/smarttv/)||navigator.userAgent.toLowerCase().match(/smart-tv/)||navigator.userAgent.toLowerCase().match(/appletv/)||navigator.userAgent.toLowerCase().match(/apple tv/),this._isPlaystationDevice=null!==navigator.userAgent.match(/PlayStation/),this._isIphoneDevice=null!==navigator.userAgent.match(/iPhone|iPad|iPod/i),this._isAndroidDevice=null!==navigator.userAgent.match(/Android/),this._isSmartphoneDevice=!this._isSmartTVDevice&&!this._isPlaystationDevice&&(this._isIphoneDevice||this._isAndroidDevice),this._isDesktopDevice=!this._isSmartphoneDevice&&!this._isSmartTVDevice&&!this._isPlaystationDevice)},isIphone:function(){return this._isIphoneDevice},isAndroid:function(){return this._isAndroidDevice},isSmartphone:function(){return this._isSmartphoneDevice},isDesktop:function(){return this._isDesktopDevice},isSmartTV:function(){return this._isSmartTVDevice},isPlayStation:function(){return this._isPlaystationDevice}});e.exports=n},function(e,t,i){var n=i(59),s=i(0),r=i(60),a=s.extend({constructor:function(e){this.plugin=e,this.dataExtractor=new n,this.key=this.getPreviousKey()},generateHashKey:function(){if(!this.key){var e=this.dataExtractor.getAllData();this.key=this._hashFunction(e),this.plugin.storage.setLocal("youboraDeviceUUID",this.key)}},getKey:function(){return this.key||this.generateHashKey(),this.key},_hashFunction:function(e){var t=e;return"string"!=typeof e&&(t=JSON.stringify(e)),r(t)},_reset:function(){this.key=void 0},getPreviousKey:function(){return this.plugin.storage.getLocal("youboraDeviceUUID")}});e.exports=a},function(e,t,i){var n=i(0),s=i(14),r=i(8),a=n.extend({constructor:function(e,t,i){this._adapter=e,this._seekEnabled=t&a.Type.SEEK,this._bufferEnabled=t&a.Type.BUFFER,i=i||800,this._chrono=new r,this._lastPlayhead=0,i>0&&(this._timer=new s(this.progress.bind(this),i))},start:function(){this.stop(),this._timer.start()},stop:function(){this._lastPlayhead=0,this._timer&&this._timer.stop()},skipNextTick:function(){this._lastPlayhead=0},progress:function(){var e=this._chrono.stop();this._chrono.start();var t=e*a.kBUFFER_THRESHOLD_RATIO,i=e*a.kSEEK_THRESHOLD_RATIO;this._adapter.getPlayrate&&this._adapter.getPlayrate()&&1!==this._adapter.getPlayrate()&&(t*=this._adapter.getPlayrate(),i*=this._adapter.getPlayrate());var n=this._getPlayhead(),s=1e3*Math.abs(this._lastPlayhead-n);s<t?this._bufferEnabled&&this._lastPlayhead>0&&!this._adapter.flags.isPaused&&!this._adapter.flags.isSeeking&&this._adapter.fireBufferBegin(null,!1):s>i?this._seekEnabled&&this._lastPlayhead>0&&this._adapter.fireSeekBegin(null,!1):(this._seekEnabled&&this._adapter.fireSeekEnd(),this._bufferEnabled&&this._adapter.fireBufferEnd()),this._lastPlayhead=n},_getPlayhead:function(){return this._adapter.getPlayhead()}},{Type:{NONE:0,BUFFER:1,SEEK:2},kBUFFER_THRESHOLD_RATIO:.5,kSEEK_THRESHOLD_RATIO:2});e.exports=a},function(e,t,i){var n=i(3);i(74),i(84)(n),e.exports=n},function(e){e.exports=JSON.parse('{"name":"youboralib","type":"lib","tech":"js","author":"Jordi Aguilar","version":"6.7.6","built":"2020-04-27","repo":"https://bitbucket.org/npaw/lib-plugin-js.git"}')},function(e,t){e.exports=function(){Function.prototype.bind=Function.prototype.bind||function(e){var t=Array.prototype.slice,i=this,n=t.call(arguments,1);function s(){var s=i.prototype&&this instanceof i;return i.apply(!s&&e||this,n.concat(t.call(arguments)))}return s.prototype=i.prototype,s},Array.prototype.forEach=Array.prototype.forEach||function(e,t){if("function"!=typeof e)throw new TypeError(e+" is not a function!");for(var i=this.length,n=0;n<i;n++)e.call(t,this[n],n,this)},Math.trunc=Math.trunc||function(e){return isNaN(e)?NaN:e>0?Math.floor(e):Math.ceil(e)}}},function(e,t){var i=function(){};e.exports=function(e){if(arguments.length>1)throw Error("Second argument not supported");if(null===e)throw Error("Cannot set a null [[Prototype]]");if("object"!=typeof e)throw TypeError("Argument must be an object");return i.prototype=e,new i}},function(e,t){e.exports={START:"start",JOIN:"join",PAUSE:"pause",RESUME:"resume",SEEK_BEGIN:"seek-begin",SEEK_END:"seek-end",BUFFER_BEGIN:"buffer-begin",BUFFER_END:"buffer-end",ERROR:"error",STOP:"stop",CLICK:"click",MANIFEST:"manifest",PODSTART:"break-start",PODSTOP:"break-stop",QUARTILE:"quartile",VIDEO_EVENT:"video-event"}},function(e,t){e.exports={DATA:"/data",INIT:"/init",START:"/start",JOIN:"/joinTime",PAUSE:"/pause",RESUME:"/resume",SEEK:"/seek",BUFFER:"/bufferUnderrun",ERROR:"/error",STOP:"/stop",PING:"/ping",VIDEO_EVENT:"/infinity/video/event",AD_INIT:"/adInit",AD_START:"/adStart",AD_JOIN:"/adJoin",AD_PAUSE:"/adPause",AD_RESUME:"/adResume",AD_BUFFER:"/adBufferUnderrun",AD_STOP:"/adStop",AD_CLICK:"/adClick",AD_ERROR:"/adError",AD_MANIFEST:"/adManifest",AD_POD_START:"/adBreakStart",AD_POD_STOP:"/adBreakStop",AD_QUARTILE:"/adQuartile",EVENT:"/infinity/session/event",SESSION_START:"/infinity/session/start",SESSION_STOP:"/infinity/session/stop",NAV:"/infinity/session/nav",BEAT:"/infinity/session/beat",OFFLINE_EVENTS:"/offlineEvents"}},function(e,t){e.exports={WILL_SEND_INIT:"will-send-init",WILL_SEND_START:"will-send-start",WILL_SEND_JOIN:"will-send-join",WILL_SEND_PAUSE:"will-send-pause",WILL_SEND_RESUME:"will-send-resume",WILL_SEND_SEEK:"will-send-seek",WILL_SEND_BUFFER:"will-send-buffer",WILL_SEND_ERROR:"will-send-error",WILL_SEND_FATAL_ERROR:"will-send-fatal-error",WILL_SEND_STOP:"will-send-stop",WILL_SEND_PING:"will-send-ping",WILL_SEND_VIDEO_EVENT:"will-send-video-event",WILL_SEND_AD_START:"will-send-ad-start",WILL_SEND_AD_JOIN:"will-send-ad-join",WILL_SEND_AD_PAUSE:"will-send-ad-pause",WILL_SEND_AD_RESUME:"will-send-ad-resume",WILL_SEND_AD_BUFFER:"will-send-ad-buffer",WILL_SEND_AD_STOP:"will-send-ad-stop",WILL_SEND_AD_CLICK:"will-send-ad-click",WILL_SEND_AD_ERROR:"will-send-ad-error",WILL_SEND_AD_MANIFEST:"will-send-ad-manifest",WILL_SEND_AD_POD_START:"will-send-ad-break-start",WILL_SEND_AD_POD_STOP:"will-send-ad-break-stop",WILL_SEND_AD_QUARTILE:"will-send-ad-quartile",WILL_SEND_SESSION_START:"will-send-session-start",WILL_SEND_SESSION_STOP:"will-send-session-stop",WILL_SEND_NAV:"will-send-nav",WILL_SEND_BEAT:"will-send-beat",WILL_SEND_EVENT:"will-send-event",WILL_SEND_OFFLINE_EVENTS:"will-send-offline-events"}},function(e,t){e.exports={cdnName:"LEVEL3",parsers:[{element:"host+type",headerName:"X-WR-Diag",regex:/Host:(.+)\sType:(.+)/}],requestHeaders:{"X-WR-Diag":"host"},parseType:function(e){if(e){if(0===e.indexOf("TCP_HIT")||0===e.indexOf("TCP_MEM_HIT")||0===e.indexOf("TCP_IMS_HIT"))return 1;if(0===e.indexOf("TCP_MISS"))return 2}return 0}}},function(e,t){e.exports={cdnName:"CLOUDFRT",parsers:[{element:"host",headerName:"X-Amz-Cf-Id",regex:/(.+)/},{element:"type",headerName:"X-Cache",regex:/(\S+)\s.+/}],parseType:function(e){switch(e){case"Hit":return 1;case"Miss":return 2;default:return 0}}}},function(e,t){e.exports={cdnName:"AKAMAI",requestMethod:"GET",parsers:[{element:"type+host",headerName:"X-Cache",regex:/(.+)\sfrom.+AkamaiGHost\/(.+)\).+/}],requestHeaders:{Pragma:"akamai-x-cache-on"},parseType:function(e){return-1!==e.indexOf("HIT")?1:-1!==e.indexOf("MISS")?2:0}}},function(e,t){e.exports={cdnName:"HIGHNEGR",parsers:[{element:"host+type",headerName:"X-HW",regex:/.+,[0-9]+\.(.+)\.(.+)/}],parseType:function(e){switch(e){case"c":case"x":return 1;default:return 2}}}},function(e,t){e.exports={cdnName:"FASTLY",parsers:[{element:"host",headerName:"X-Served-By",regex:/([^,\s]+)$/},{element:"type",headerName:"X-Cache",regex:/([^,\s]+)$/}],parseType:function(e){switch(e){case"HIT":return 1;case"MISS":return 2;default:return 0}}}},function(e,t){e.exports={cdnName:"TELEFO",parsers:[{element:"host+type",headerName:"x-tcdn",regex:/Host:(.+)\sType:(.+)/}],requestHeaders:{"x-tcdn":"host"},parseType:function(e){if(e){if(-1!==e.indexOf("p")||-1!==e.indexOf("c"))return 1;if(-1!==e.indexOf("i")||-1!==e.indexOf("m"))return 2}return 0}}},function(e,t){e.exports={cdnName:"AMAZON",parsers:[{element:"host",headerName:"x-amz-cf-pop",regex:/(.+)/},{element:"type",headerName:"x-cache",regex:/(.+)\sfrom.+/}],parseType:function(e){return-1!==e.toLowerCase().indexOf("hit")?1:-1!==e.toLowerCase().indexOf("miss")?2:0}}},function(e,t){e.exports={parsers:[{element:"name",headerName:null,regex:/(.+)/}]}},function(e,t,i){var n=i(0),s=i(1),r=n.extend({exists:function(e){return r.Dictionary.hasOwnProperty(e)},getNewName:function(e){var t=r.Dictionary[e];return s.warn('The option "'+e+'" is deprecated, use "'+t+'" instead'),t}},{Dictionary:{httpSecure:"app.https",username:"user.name",anonymousUser:"user.anonymousId",obfuscateIp:"user.obfuscateIp",userType:"user.type","content.title2":"content.program","background.settings.iphone":"background.settings.iOS","parse.hls":"parse.manifest","parse.dash":"parse.manifest","parse.locationHeader":"parse.manifest","extraparam.1":"content.customDimension.1","extraparam.2":"content.customDimension.2","extraparam.3":"content.customDimension.3","extraparam.4":"content.customDimension.4","extraparam.5":"content.customDimension.5","extraparam.6":"content.customDimension.6","extraparam.7":"content.customDimension.7","extraparam.8":"content.customDimension.8","extraparam.9":"content.customDimension.9","extraparam.10":"content.customDimension.10","extraparam.11":"content.customDimension.11","extraparam.12":"content.customDimension.12","extraparam.13":"content.customDimension.13","extraparam.14":"content.customDimension.14","extraparam.15":"content.customDimension.15","extraparam.16":"content.customDimension.16","extraparam.17":"content.customDimension.17","extraparam.18":"content.customDimension.18","extraparam.19":"content.customDimension.19","extraparam.20":"content.customDimension.20","ad.extraparam.1":"ad.customDimension.1","ad.extraparam.2":"ad.customDimension.2","ad.extraparam.3":"ad.customDimension.3","ad.extraparam.4":"ad.customDimension.4","ad.extraparam.5":"ad.customDimension.5","ad.extraparam.6":"ad.customDimension.6","ad.extraparam.7":"ad.customDimension.7","ad.extraparam.8":"ad.customDimension.8","ad.extraparam.9":"ad.customDimension.9","ad.extraparam.10":"ad.customDimension.10"}});e.exports=r},function(e,t,i){var n=i(6),s=i(14),r=i(8),a=i(4),o=i(2),d=i(5),h=i(15),u=i(52),c=i(22),l=i(23),p=i(28),f=i(29),g=i(16),m=i(53),v=i(30),_=i(17),S=i(20),y=i(55),E=i(31),A=i(32),T=i(57),b=i(58),L=i(33),P=n.extend({constructor:function(e,t){this.storage=new g,this.uuidGenerator=new L(this),this.infinity=new _(this),this.isInitiated=!1,this.isAdsManifestSent=!1,this.playedPostrolls=0,this.isBreakStarted=!1,this.initChrono=new r,this.options=new f(e),this.storage=new g(null,this.options.disableCookies),this.offlineStorage=new m,this._adapter=null,this._adsAdapter=null,this._ping=new s(this._sendPing.bind(this),5e3),this._beat=new s(this._sendBeat.bind(this),3e4),this._refreshData=new s(this._checkOldData.bind(this),36e5),this._refreshData.start(),this.sessionExpire=1e3*Number(this.storage.getLocal("sessionExpire"))||3e5,this.requestBuilder=new v(this),this.resourceTransform=new l(this),this.lastEventTime=null,this.restartViewTransform(),this._initInfinity(),this.hybridNetwork=new S,this.browserLoadTimes=new y(this),this.deviceDetector=new A,this.backgroundDetector=new E(this),this.resizeScrollDetector=new b(this),this.options["background.enabled"]&&this.backgroundDetector.startDetection(),this.options["ad.blockDetection"]&&(this.blockDetector=new T(this)),t&&this.setAdapter(t)},_checkOldData:function(){this._adapter&&this._adapter.flags.isStarted||this.infinity.infinityStarted&&!this.infinity.infinityStopped||this.restartViewTransform()},restartViewTransform:function(e){this.viewTransform=new c(this),this.viewTransform.on(c.Event.DONE,this._receiveData.bind(this)),e?this.viewTransform.setData(e):this.getIsDataExpired()||this.storage.getLocal("accCode")!==this.options.accountCode&&this.storage.getSession("accCode")!==this.options.accountCode?(this.storage.removeStorages("data"),this.storage.removeStorages("session"),this.storage.removeLocal("infinityStarted"),this.storage.removeLocal("infinityStopped"),this.viewTransform.init()):this.viewTransform.setData(this.getStoredData())},_receiveData:function(e){this._ping.interval=1e3*e.target.response.pingTime,this._beat.interval=1e3*e.target.response.beatTime,this.sessionExpire=1e3*e.target.response.sessionExpire,this.storage.setStorages("data",e.target.response.msg),this.storage.setStorages("dataTime",(new Date).getTime()),this.storage.setStorages("accCode",this.options.accountCode),this.getIsSessionExpired()?(this.viewTransform.setSession(this.viewTransform.response.code),this.storage.setStorages("session",this.viewTransform.response.code)):this.viewTransform.setSession(this.getSession())},_reset:function(){this._stopPings(),this.resourceTransform=new l(this),this._adapter&&this._adapter.flags.reset(),this.isInitiated=!1,this.isStarted=!1,this.startDelayed=!1,this.isAdsManifestSent=!1,this.initChrono.reset(),this._totalPrerollsTime=0,this.requestBuilder.lastSent.breakNumber=0,this.requestBuilder.lastSent.adNumber=0,this._savedAdManifest=null,this._savedAdError=null,this.playedPostrolls=0,this.isBreakStarted=!1},_send:function(e,t,i,n,s,r,o){var h=(new Date).getTime();this.options.preventZombieViews&&this.lastEventTime&&h>this.lastEventTime+6e5&&this.viewTransform.nextView(),this.lastEventTime=t===a.Service.STOP?null:h,i=this.requestBuilder.buildParams(i,t),this.getIsLive()&&(i.mediaDuration=void 0,i.playhead=void 0);var u={params:i,plugin:this,adapter:this.getAdapter(),adsAdapter:this.getAdsAdapter()};if(this.emit(e,u),this._comm&&(null!==i||void 0!==s)&&this.options.enabled){this.lastServeiceSent=t;var c={};void 0!==s&&"GET"!==s&&(c.method=s);var l=new d(null,t,i,c);n&&l.setBody(n),this._comm.sendRequest(l,r,o)}},_initComm:function(){this.resourceTransform.init(this.getResource()),this._comm=new h,this._comm.addTransform(new u),this._comm.addTransform(this.viewTransform),this.options&&this.options.offline?this._comm.addTransform(new p(this)):this._comm.addTransform(this.resourceTransform)},getComm:function(){return this._comm},setOptions:function(e){e&&(this.options.setOptions(e),"boolean"==typeof e["background.enabled"]&&(e["background.enabled"]?this.backgroundDetector.startDetection():this.backgroundDetector.stopDetection()))},disable:function(){this.setOptions({enabled:!1})},enable:function(){this.setOptions({enabled:!0})}},{Event:a.WillSendEvent});o.assign(P.prototype,i(61)),o.assign(P.prototype,i(66)),o.assign(P.prototype,i(67)),o.assign(P.prototype,i(68)),o.assign(P.prototype,i(69)),o.assign(P.prototype,i(70)),o.assign(P.prototype,i(71)),o.assign(P.prototype,i(72)),o.assign(P.prototype,i(73)),e.exports=P},function(e,t,i){var n=i(7),s=i(4),r=n.extend({_services:[s.Service.INIT,s.Service.START,s.Service.OFFLINE_EVENTS],isBlocking:function(e){if(this._isBusy&&null!=e)if(-1!==this._services.indexOf(e.service))this.done();else if(e.service===s.Service.ERROR)return!1;return n.prototype.isBlocking.apply(this,arguments)}});e.exports=r},function(e,t,i){var n=i(0),s=i(16),r=n.extend({constructor:function(){this.storage=new s("youboraOffline",!0),this.actualView=null,this.viewList=[],this.givenIds=[],this._getOldViewList()},_newView:function(){var e=this._getValidId();this.storage.setLocal(e,""),this.viewList.push(e),this.storage.setLocal("views",this.viewList),this.actualView=e},addEvent:function(e,t){if("/start"===e&&this._newView(),"/init"===e)return null;if(!this.actualView)return null;var i='{"request":"'+e.slice(1)+'",';for(var n in i+='"unixtime":'+Date.now()+",",t){if(void 0===t[n])break;i+='"'+n+'":',"code"===n?i+='"CODE_PLACEHOLDER",':"sessionId"===n?i+='"SESSION_PLACEHOLDER",':"sessionRoot"===n?i+='"ROOT_PLACEHOLDER",':"string"==typeof t[n]?i+='"'+t[n]+'",':"object"==typeof t[n]?i+='"'+JSON.stringify(t[n]).replace(/"/g,'\\"')+'",':i+=t[n]+","}i=i.slice(0,-1),i+="}";var s=this.storage.getLocal(this.actualView);""!==s&&(s+=","),this.storage.setLocal(this.actualView,s+i)},getView:function(){if(this.viewList.length>this.givenIds.length)for(var e=0;;){var t=this.viewList[e];if(!this.givenIds.includes(t))return this.givenIds.push(t),["["+this.storage.getLocal(t)+"]",t];e++}return[null,null]},removeView:function(e){this.storage.removeLocal(e);var t=this.viewList.indexOf(e);-1!==t&&this.viewList.splice(t,1),-1!==(t=this.givenIds.indexOf(e))&&this.givenIds.splice(t,1),this.storage.setLocal("views",this.viewList.toString()),e===this.actualView&&(this.actualView=null)},_getOldViewList:function(){var e="";this.storage.getLocal("views")?e=this.storage.getLocal("views"):this.storage.setLocal("views",""),""===e?this.viewList=[]:"function"==typeof e.split&&(this.viewList=e.split(","))},_getValidId:function(){var e=Math.floor(1e8*Math.random()).toString();return this.viewList.indexOf(e)>=0?this._getValidId():e},sent:function(){this.givenIds=[]}});e.exports=r},function(e,t,i){var n=i(7).extend({isBlocking:function(e){return!e.params.sessionId}});e.exports=n},function(e,t,i){var n=i(0),s=i(56),r=n.extend({constructor:function(e){this.infinity=e.infinity,this.timeObject=null,this.playerSetup=null,this.perfObject=null,this.myTimesObject={},"undefined"!=typeof window&&(window.addEventListener("load",this._windowLoaded.bind(this)),window.performance&&window.performance.timing&&(this.perfObject=window.performance,this.timeObject=window.performance.timing))},_windowLoaded:function(){this.myTimesObject.onLoad=(new Date).getTime(),this._getEnoughFPS(),setTimeout(this._fireLoadTimesEvent.bind(this),200)},_fireLoadTimesEvent:function(){this._getLastMetrics(),this.infinity.fireEvent("loadTimes",{},this._getAllValues())},_getAllValues:function(){var e={PageLoadTime:this.getPageLoadTime(),DNSTime:this.getDnsTime(),TCPTime:this.getTcpTime(),HandshakeTime:this.getHandshakeTime(),DomReadyTime:this.getDomReadyTime(),BackendTime:this.getBackendTime(),FrontendTime:this.getFrontenddTime(),VisualReady:this.getTimeToVisuallyReady(),TimeToInteractive:this.getTimeToInteractive(),JsTime:this.getJSTime(),CssTime:this.getCSSTime(),ImageTime:this.getImageTime(),FontTime:this.getFontTime(),AvgReqLatency:this.getAvgReqLatency(),MaxReqLatency:this.getMaxReqLatency(),SpeedIndex:this.getSpeedIndex()};for(var t in e)null!==e[t]&&void 0!==e[t]||delete e[t];return e},getPageLoadTime:function(){var e=null;return this.timeObject&&(e=this.timeObject.loadEventEnd-this.timeObject.navigationStart),e},getPlayerStartupTime:function(){var e=null;return this.timeObject&&this.playerSetup&&(e=this.playerSetup-this.timeObject.navigationStart),e},getDnsTime:function(){var e=null;return this.timeObject&&(e=this.timeObject.domainLookupEnd-this.timeObject.domainLookupStart),e},getTcpTime:function(){var e=null;return this.timeObject&&(e=this.timeObject.connectEnd-this.timeObject.connectStart),e},getHandshakeTime:function(){var e=null;return this.timeObject&&this.timeObject.secureConnectionStart&&(e=this.timeObject.connectEnd-this.timeObject.secureConnectionStart),e},getDomReadyTime:function(){var e=null;return this.timeObject&&(e=this.timeObject.domComplete-this.timeObject.navigationStart),e},getBackendTime:function(){var e=null;return this.timeObject&&(e=this.timeObject.responseStart-this.timeObject.navigationStart),e},getFrontenddTime:function(){var e=null;return this.timeObject&&(e=this.myTimesObject.onLoad-this.timeObject.responseStart),e},getTimeToVisuallyReady:function(){var e=this.myTimesObject.firstPaint||0;return this.timeObject?Math.max(e,this.timeObject.domContentLoadedEventEnd-this.timeObject.navigationStart||0):e||null},getTimeToInteractive:function(){if(this.myTimesObject.fps&&this.getTimeToVisuallyReady())return Math.max(this.myTimesObject.fps,this.getTimeToVisuallyReady());setTimeout(function(){this.getTimeToInteractive()}.bind(this),500)},getJSTime:function(){return this._getXTime("script")},getCSSTime:function(){return this._getXTime("css")},getImageTime:function(){return this._getXTime("img")},getFontTime:function(){return this._getXTime("css",[".woff",".otf",".ttf"])},getAvgReqLatency:function(){if(this.perfObject){var e=this.perfObject.getEntriesByType("resource"),t=0,i=0;for(var n in e)e[n].requestStart&&e[n].responseStart&&(t+=e[n].responseStart-e[n].requestStart),i++;return t/i}return null},getMaxReqLatency:function(){if(this.perfObject){var e=this.perfObject.getEntriesByType("resource"),t=0;for(var i in e)e[i].requestStart&&e[i].responseStart&&(t=Math.max(t,e[i].responseStart-e[i].requestStart));return t}return null},getSpeedIndex:function(){var e=null;if("undefined"!=typeof window&&window.performance)try{e=s()}catch(e){}return e},_getXTime:function(e,t){var i=0;if(this.perfObject){var n=this.perfObject.getEntriesByType("resource");for(var s in n)if(n[s].initiatorType===e)if(t){var r=!1;for(var a in t)n[s].name.indexOf(t[a]>0)&&(r=!0);r&&(i+=n[s].duration)}else i+=n[s].duration}return i||null},_getLastMetrics:function(){var e=null;!(e=this._getXTime("paint",["first-paint"]))&&this.timeObject&&(e=this.timeObject.msFirstPaint-this.timeObject.navigationStart),this.myTimesObject.firstPaint=e,this.getTimeToInteractive()},_getEnoughFPS:function(){if(!this.timeObject||"undefined"==typeof window)return!0;var e=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||function(){};this.preFPS=(new Date).getTime(),e(function(){var e=(new Date).getTime();e<this.preFPS+50?this.myTimesObject.fps=e-this.timeObject.navigationStart:setTimeout(function(){return this._getEnoughFPS()}.bind(this),50)}.bind(this))},setPlayerSetupTime:function(){this.playerSetup=this.playerSetup||(new Date).getTime()}});e.exports=r},function(e,t){var i=function(e){var t,n,s=(e=e||window).document,r=function(t){var i=!1;if(t.getBoundingClientRect){var n=t.getBoundingClientRect();(i={top:Math.max(n.top,0),left:Math.max(n.left,0),bottom:Math.min(n.bottom,e.innerHeight||s.documentElement.clientHeight),right:Math.min(n.right,e.innerWidth||s.documentElement.clientWidth)}).bottom<=i.top||i.right<=i.left?i=!1:i.area=(i.bottom-i.top)*(i.right-i.left)}return i},a=function(e,t){if(t){var i=r(e);i&&o.push({url:t,area:i.area,rect:i})}},o=[],d=[],h=.1;try{var u=e.performance.timing.navigationStart;!function(){for(var t=s.getElementsByTagName("*"),n=/url\(.*(http.*)\)/gi,d=0;d<t.length;d++){var h=t[d],u=e.getComputedStyle(h);if("IMG"===h.tagName&&a(h,h.src),u["background-image"]){n.lastIndex=0;var c=n.exec(u["background-image"]);c&&c.length>1&&a(h,c[1].replace('"',""))}if("IFRAME"===h.tagName)try{var l=r(h);if(l){var p=i(h.contentWindow);p&&o.push({tm:p,area:l.area,rect:l})}}catch(e){}}}(),function(){for(var t={},i=e.performance.getEntriesByType("resource"),n=0;n<i.length;n++)t[i[n].name]=i[n].responseEnd;for(var s=0;s<o.length;s++)"tm"in o[s]||(o[s].tm=void 0!==t[o[s].url]?t[o[s].url]:0)}(),function(){if("msFirstPaint"in e.performance.timing&&(t=e.performance.timing.msFirstPaint-u),"chrome"in e&&"loadTimes"in e.chrome){var i=e.chrome.loadTimes();if("firstPaintTime"in i&&i.firstPaintTime>0){var n=i.startLoadTime;"requestTime"in i&&(n=i.requestTime),i.firstPaintTime>=n&&(t=1e3*(i.firstPaintTime-n))}}if(void 0===t||t<0||t>12e4){t=e.performance.timing.responseStart-u;for(var r={},a=s.getElementsByTagName("head")[0].children,o=0;o<a.length;o++){var d=a[o];"SCRIPT"===d.tagName&&d.src&&!d.async&&(r[d.src]=!0),"LINK"===d.tagName&&"stylesheet"===d.rel&&d.href&&(r[d.href]=!0)}for(var h=e.performance.getEntriesByType("resource"),c=!1,l=0;l<h.length;l++)if(c||!r[h[l].name]||"script"!==h[l].initiatorType&&"link"!==h[l].initiatorType)c=!0;else{var p=h[l].responseEnd;(void 0===t||p>t)&&(t=p)}}t=Math.max(t,0)}(),function(){for(var i={0:0},n=0,r=0;r<o.length;r++){var a=t;"tm"in o[r]&&o[r].tm>t&&(a=o[r].tm),void 0===i[a]&&(i[a]=0),i[a]+=o[r].area,n+=o[r].area}var u=Math.max(s.documentElement.clientWidth,e.innerWidth||0)*Math.max(s.documentElement.clientHeight,e.innerHeight||0);if(u>0&&(u=Math.max(u-n,0)*h,void 0===i[t]&&(i[t]=0),i[t]+=u,n+=u),n){for(var c in i)i.hasOwnProperty(c)&&d.push({tm:c,area:i[c]});d.sort((function(e,t){return e.tm-t.tm}));for(var l=0,p=0;p<d.length;p++)l+=d[p].area,d[p].progress=l/n}}(),function(){if(d.length){n=0;for(var e=0,i=0,s=0;s<d.length;s++){var r=d[s].tm-e;r>0&&i<1&&(n+=(1-i)*r),e=d[s].tm,i=d[s].progress}}else n=t}()}catch(e){}return n};e.exports=i},function(e,t,i){var n=i(0),s=i(2),r=i(5),a=n.extend({constructor:function(e){this.isBlocked=!0;try{if(this.xhr=r.prototype.createXHR(),this.xhr.addEventListener){var t=s.addProtocol("ww.zxcvwwds.com/ww/wwds/-imwwge-wwd_wwds.html",e.options["app.https"]);this.xhr.open("GET",t.replace(/ww/g,"a"),!0),this.xhr.addEventListener("load",function(){this.isBlocked=!1}.bind(this)),this.xhr.send()}}catch(e){}}});e.exports=a},function(e,t,i){var n=i(0).extend({constructor:function(e){this.pluginref=e,this.listenerReference=this._changeListener.bind(this),this.isEnabled=!1},startDetection:function(){this.isEnabled||"undefined"==typeof window||(window.addEventListener("scroll",this.listenerReference),window.addEventListener("resize",this.listenerReference),this.isEnabled=!0)},stopDetection:function(){this.isEnabled&&"undefined"!=typeof window&&(window.removeEventListener("scroll",this.listenerReference),window.removeEventListener("resize",this.listenerReference),this.isEnabled=!1)},_changeListener:function(){var e=this.pluginref.getAdsAdapter();e&&e.flags.isStarted&&(e.getIsVisible()?e.startChronoView():e.stopChronoView())}});e.exports=n},function(e,t,i){var n=i(0).extend({constructor:function(e){this.plugin=e},getAllData:function(){var e=this.getNonRandomData();return e.timestamp=this.getTimestamp(),e},getNonRandomData:function(){var e={};return e.userAgent=this.getUserAgent(),e.threads=this.getVirtualCores(),e.language=this.getLanguage(),e.langList=this.getAvailableLanguages(),e.resolution=this.getResolution(),e.colorDepth=this.getColorDepth(),e.deviceMemory=this.getMemory(),e.touchscreen=this.getTouchscreen(),e.localStorage=this.getLocalStorage(),e.sessionStorage=this.getSessionStorage(),e.cookiesAvailable=this.getCookiesAvailable(),e.flashAvailable=this.getHasFlash(),e.timeZone=this.getTimeZone(),e.plugins=this.getPluginList(),e},getUserAgent:function(){return this._getNavigatorValue("userAgent")},getVirtualCores:function(){return this._getNavigatorValue("hardwareConcurrency")},getLanguage:function(){return this._getNavigatorValue("language")},getAvailableLanguages:function(){return this._getNavigatorValue("languages")},getResolution:function(){var e=null;try{this._getNavigatorValue("screen")&&(e=navigator.screen.width.toString()+navigator.screen.height.toString())}catch(e){}return e},getColorDepth:function(){var e=null;try{this._getNavigatorValue("screen")&&(e=navigator.screen.colorDepth)}catch(e){}return e},getMemory:function(){return this._getNavigatorValue("deviceMemory")},getTouchscreen:function(){return this._getNavigatorValue("maxTouchPoints")||!1},getLocalStorage:function(){var e=!1;try{e="undefined"!=typeof localStorage}catch(e){}return e},getSessionStorage:function(){var e=!1;try{e="undefined"!=typeof sessionStorage}catch(e){}return e},getCookiesAvailable:function(){return this._getNavigatorValue("cookieEnabled")||!1},getHasFlash:function(){var e=!1;try{var t=this._getNavigatorValue("plugins");e=t&&"object"==typeof t["Shockwave Flash"]||"undefined"!=typeof window&&window.ActiveXObject&&!1!==new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(e){}return e},getPluginList:function(){var e=null;try{var t=this._getNavigatorValue("plugins");if(t&&0!==t.length){for(var i="",n=0;n<navigator.plugins.length;n++)i+=navigator.plugins[n].description+" "+navigator.plugins[n].filename+" "+navigator.plugins[n].name+" ";e=i}}catch(e){}return e},getTimeZone:function(){var e=null;try{e=(new Date).getTimezoneOffset().toString()}catch(e){}return e},getTimestamp:function(){return(new Date).getTime()},_navigatorCheck:function(){return"undefined"!=typeof navigator},_getNavigatorValue:function(e){var t=null;try{this._navigatorCheck()&&(t=navigator[e])}catch(e){}return t}});e.exports=n},function(e,t){e.exports=function(e){function t(e,t){return e<<t|e>>>32-t}function i(e,t){var i,n,s,r,a;return s=2147483648&e,r=2147483648&t,a=(1073741823&e)+(1073741823&t),(i=1073741824&e)&(n=1073741824&t)?2147483648^a^s^r:i|n?1073741824&a?3221225472^a^s^r:1073741824^a^s^r:a^s^r}function n(e,n,s,r,a,o,d){return e=i(e,i(i(function(e,t,i){return e&t|~e&i}(n,s,r),a),d)),i(t(e,o),n)}function s(e,n,s,r,a,o,d){return e=i(e,i(i(function(e,t,i){return e&i|t&~i}(n,s,r),a),d)),i(t(e,o),n)}function r(e,n,s,r,a,o,d){return e=i(e,i(i(function(e,t,i){return e^t^i}(n,s,r),a),d)),i(t(e,o),n)}function a(e,n,s,r,a,o,d){return e=i(e,i(i(function(e,t,i){return t^(e|~i)}(n,s,r),a),d)),i(t(e,o),n)}function o(e){var t,i="",n="";for(t=0;t<=3;t++)i+=(n="0"+(e>>>8*t&255).toString(16)).substr(n.length-2,2);return i}var d,h,u,c,l,p,f,g,m,v=Array();for(v=function(e){for(var t,i=e.length,n=i+8,s=16*((n-n%64)/64+1),r=Array(s-1),a=0,o=0;o<i;)a=o%4*8,r[t=(o-o%4)/4]=r[t]|e.charCodeAt(o)<<a,o++;return a=o%4*8,r[t=(o-o%4)/4]=r[t]|128<<a,r[s-2]=i<<3,r[s-1]=i>>>29,r}(e=function(e){e=e.replace(/rn/g,"n");for(var t="",i=0;i<e.length;i++){var n=e.charCodeAt(i);n<128?t+=String.fromCharCode(n):n>127&&n<2048?(t+=String.fromCharCode(n>>6|192),t+=String.fromCharCode(63&n|128)):(t+=String.fromCharCode(n>>12|224),t+=String.fromCharCode(n>>6&63|128),t+=String.fromCharCode(63&n|128))}return t}(e)),p=1732584193,f=4023233417,g=2562383102,m=271733878,d=0;d<v.length;d+=16)h=p,u=f,c=g,l=m,p=n(p,f,g,m,v[d+0],7,3614090360),m=n(m,p,f,g,v[d+1],12,3905402710),g=n(g,m,p,f,v[d+2],17,606105819),f=n(f,g,m,p,v[d+3],22,3250441966),p=n(p,f,g,m,v[d+4],7,4118548399),m=n(m,p,f,g,v[d+5],12,1200080426),g=n(g,m,p,f,v[d+6],17,2821735955),f=n(f,g,m,p,v[d+7],22,4249261313),p=n(p,f,g,m,v[d+8],7,1770035416),m=n(m,p,f,g,v[d+9],12,2336552879),g=n(g,m,p,f,v[d+10],17,4294925233),f=n(f,g,m,p,v[d+11],22,2304563134),p=n(p,f,g,m,v[d+12],7,1804603682),m=n(m,p,f,g,v[d+13],12,4254626195),g=n(g,m,p,f,v[d+14],17,2792965006),p=s(p,f=n(f,g,m,p,v[d+15],22,1236535329),g,m,v[d+1],5,4129170786),m=s(m,p,f,g,v[d+6],9,3225465664),g=s(g,m,p,f,v[d+11],14,643717713),f=s(f,g,m,p,v[d+0],20,3921069994),p=s(p,f,g,m,v[d+5],5,3593408605),m=s(m,p,f,g,v[d+10],9,38016083),g=s(g,m,p,f,v[d+15],14,3634488961),f=s(f,g,m,p,v[d+4],20,3889429448),p=s(p,f,g,m,v[d+9],5,568446438),m=s(m,p,f,g,v[d+14],9,3275163606),g=s(g,m,p,f,v[d+3],14,4107603335),f=s(f,g,m,p,v[d+8],20,1163531501),p=s(p,f,g,m,v[d+13],5,2850285829),m=s(m,p,f,g,v[d+2],9,4243563512),g=s(g,m,p,f,v[d+7],14,1735328473),p=r(p,f=s(f,g,m,p,v[d+12],20,2368359562),g,m,v[d+5],4,4294588738),m=r(m,p,f,g,v[d+8],11,2272392833),g=r(g,m,p,f,v[d+11],16,1839030562),f=r(f,g,m,p,v[d+14],23,4259657740),p=r(p,f,g,m,v[d+1],4,2763975236),m=r(m,p,f,g,v[d+4],11,1272893353),g=r(g,m,p,f,v[d+7],16,4139469664),f=r(f,g,m,p,v[d+10],23,3200236656),p=r(p,f,g,m,v[d+13],4,681279174),m=r(m,p,f,g,v[d+0],11,3936430074),g=r(g,m,p,f,v[d+3],16,3572445317),f=r(f,g,m,p,v[d+6],23,76029189),p=r(p,f,g,m,v[d+9],4,3654602809),m=r(m,p,f,g,v[d+12],11,3873151461),g=r(g,m,p,f,v[d+15],16,530742520),p=a(p,f=r(f,g,m,p,v[d+2],23,3299628645),g,m,v[d+0],6,4096336452),m=a(m,p,f,g,v[d+7],10,1126891415),g=a(g,m,p,f,v[d+14],15,2878612391),f=a(f,g,m,p,v[d+5],21,4237533241),p=a(p,f,g,m,v[d+12],6,1700485571),m=a(m,p,f,g,v[d+3],10,2399980690),g=a(g,m,p,f,v[d+10],15,4293915773),f=a(f,g,m,p,v[d+1],21,2240044497),p=a(p,f,g,m,v[d+8],6,1873313359),m=a(m,p,f,g,v[d+15],10,4264355552),g=a(g,m,p,f,v[d+6],15,2734768916),f=a(f,g,m,p,v[d+13],21,1309151649),p=a(p,f,g,m,v[d+4],6,4149444226),m=a(m,p,f,g,v[d+11],10,3174756917),g=a(g,m,p,f,v[d+2],15,718787259),f=a(f,g,m,p,v[d+9],21,3951481745),p=i(p,h),f=i(f,u),g=i(g,c),m=i(m,l);return(o(p)+o(f)+o(g)+o(m)).toLowerCase()}},function(e,t,i){var n=i(1),s=i(4),r=i(18),a={setAdapter:function(e){if(this.browserLoadTimes&&this.browserLoadTimes.setPlayerSetupTime(),e.plugin)n.warn("Adapters can only be added to a single plugin");else for(var t in this.removeAdapter(),this._adapter=e,e.plugin=this,e.setIsAds(!1),this.contentAdapterListeners={},this.contentAdapterListeners[r.Event.START]=this._startListener.bind(this),this.contentAdapterListeners[r.Event.JOIN]=this._joinListener.bind(this),this.contentAdapterListeners[r.Event.PAUSE]=this._pauseListener.bind(this),this.contentAdapterListeners[r.Event.RESUME]=this._resumeListener.bind(this),this.contentAdapterListeners[r.Event.SEEK_BEGIN]=this._seekBufferBeginListener.bind(this),this.contentAdapterListeners[r.Event.SEEK_END]=this._seekEndListener.bind(this),this.contentAdapterListeners[r.Event.BUFFER_BEGIN]=this._seekBufferBeginListener.bind(this),this.contentAdapterListeners[r.Event.BUFFER_END]=this._bufferEndListener.bind(this),this.contentAdapterListeners[r.Event.ERROR]=this._errorListener.bind(this),this.contentAdapterListeners[r.Event.STOP]=this._stopListener.bind(this),this.contentAdapterListeners[r.Event.VIDEO_EVENT]=this._videoEventListener.bind(this),this.contentAdapterListeners)this._adapter.on(t,this.contentAdapterListeners[t])},getAdapter:function(){return this._adapter},removeAdapter:function(){if(this._adapter){if(this._adapter.dispose(),this._adapter.plugin=null,this.contentAdapterListeners){for(var e in this.contentAdapterListeners)this._adapter.off(e,this.contentAdapterListeners[e]);delete this.contentAdapterListeners}this._adapter=null}},_startListener:function(e){this.isInitiated?0!==this.initChrono.startTime&&(this._adapter.chronos.join.startTime=this.initChrono.startTime):(this.viewTransform.nextView(),this._initComm(),this._startPings());var t=e.data.params||{},i=this.getResource()&&"boolean"==typeof this.getIsLive()&&(this.getIsLive()||"number"==typeof this.getDuration()&&this.getDuration()>0)&&this.getTitle();(i=!this.options.forceInit&&(i&&this._isExtraMetadataReady()))&&!this.isInitiated?(this._send(s.WillSendEvent.WILL_SEND_START,s.Service.START,t),this._adSavedError(),this._adSavedManifest(),n.notice(s.Service.START+" "+(t.title||t.mediaResource)),this.isStarted=!0):this.isInitiated||(this.isInitiated=!0,this._adapter.chronos.join.start(),this._send(s.WillSendEvent.WILL_SEND_INIT,s.Service.INIT,t),this._adSavedError(),this._adSavedManifest(),n.notice(s.Service.INIT+" "+(t.title||t.mediaResource)))},_retryStart:function(e){this._isExtraMetadataReady()&&(this._send(s.WillSendEvent.WILL_SEND_START,s.Service.START,{}),this.startDelayed=!1)},_joinListener:function(e){var t=e.data.params||{};this._adsAdapter&&this._adsAdapter.flags.isStarted?(this._adapter.monitor&&this._adapter.monitor.stop(),this._adapter.flags.isJoined=!1,this._adapter.chronos.join.stopTime=0):(this._adsAdapter&&(this._adapter.chronos.join.startTime=Math.min(this._adapter.chronos.join.startTime+(this._totalPrerollsTime||0),(new Date).getTime()),this._totalPrerollsTime=0),this.isInitiated&&!this.isStarted&&(this._isExtraMetadataReady()?this._send(s.WillSendEvent.WILL_SEND_START,s.Service.START,t):this.startDelayed=!0,this._adSavedError(),this._adSavedManifest(),n.notice(s.Service.START+" "+(t.title||t.mediaResource)),this.isStarted=!0),t=e.data.params||{},this._adsAdapter&&this.isBreakStarted&&this._adsAdapter.fireBreakStop(),this._send(s.WillSendEvent.WILL_SEND_JOIN,s.Service.JOIN,t),n.notice(s.Service.JOIN+" "+t.joinDuration+"ms"))},_pauseListener:function(e){this._adapter&&(this._adapter.flags.isBuffering||this._adapter.flags.isSeeking||this._adsAdapter&&this._adsAdapter.flags.isStarted)&&this._adapter.chronos.pause.reset();var t=e.data.params||{};this._send(s.WillSendEvent.WILL_SEND_PAUSE,s.Service.PAUSE,t),n.notice(s.Service.PAUSE+" at "+t.playhead+"s")},_resumeListener:function(e){this._adsAdapter&&this.isBreakStarted&&!this._adsAdapter.flags.isStarted&&this._adsAdapter.fireBreakStop();var t=e.data.params||{};this._send(s.WillSendEvent.WILL_SEND_RESUME,s.Service.RESUME,t),n.notice(s.Service.RESUME+" "+t.pauseDuration+"ms"),this._adapter.chronos.pause.reset()},_seekEndListener:function(e){var t=e.data.params||{};this._send(s.WillSendEvent.WILL_SEND_SEEK,s.Service.SEEK,t),n.notice(s.Service.SEEK+" to "+t.playhead+" in "+t.seekDuration+"ms")},_seekBufferBeginListener:function(e){this._adapter&&this._adapter.flags.isPaused&&this._adapter.chronos.pause.reset(),n.notice(e.type)},_bufferEndListener:function(e){var t=e.data.params||{};this._send(s.WillSendEvent.WILL_SEND_BUFFER,s.Service.BUFFER,t),n.notice(s.Service.BUFFER+" to "+t.playhead+" in "+t.bufferDuration+"ms")},_errorListener:function(e){this._blockError(e.data.params)||(this.fireError(e.data.params||{}),this._adSavedError(),this._adSavedManifest())},_blockError:function(e){var t=Date.now();return!!this._lastErrorParams&&(this._lastErrorParams.errorCode===e.errorCode&&this._lastErrorParams.msg===e.msg)&&this._lastErrorTime+5e3>t?(this._lastErrorTime=t,!0):(this._lastErrorTime=t,this._lastErrorParams=e,!1)},_stopListener:function(e){this.fireStop(e.data.params||{})},_isStopReady:function(e){var t=!0;return this.isAdsManifestSent&&this.options["ad.expectedPattern"]&&this.options["ad.expectedPattern"].post&&this.options["ad.expectedPattern"].post[0]>this.playedPostrolls&&(t=!1),t},_videoEventListener:function(e){this._send(s.WillSendEvent.WILL_SEND_VIDEO_EVENT,s.Service.VIDEO_EVENT,e.data.params)},_isExtraMetadataReady:function(e){if(!this.options.waitForMetadata||this.options.pendingMetadata.length<1)return!0;var t=this.requestBuilder.getGetters();return this.options.pendingMetadata.map(function(e){if(t.hasOwnProperty(e))return!!this[t[e]]()}.bind(this)).indexOf(!1)<0}};e.exports=a},function(e,t,i){var n=i(0),s=i(8),r=n.extend({constructor:function(){this.reset()},reset:function(){this.join=new s,this.seek=new s,this.pause=new s,this.buffer=new s,this.total=new s,this.viewedMax=[]}});e.exports=r},function(e,t,i){var n=i(0).extend({constructor:function(){this.reset()},reset:function(){this.isStarted=!1,this.isJoined=!1,this.isPaused=!1,this.isSeeking=!1,this.isBuffering=!1,this.isEnded=!1,this.isStopped=!1,this.lastQuartileSent=0}});e.exports=n},function(e,t,i){var n=i(10),s=i(8),r={getPosition:function(){return null},getGivenBreaks:function(){return null},getExpectedBreaks:function(){return null},getExpectedPattern:function(){return null},getBreaksTime:function(){return null},getGivenAds:function(){return null},getExpectedAds:function(){return null},getIsVisible:function(){return!0},getAudioEnabled:function(){return null},getIsSkippable:function(){return null},getIsFullscreen:function(){return null},getCampaign:function(){return null},getCreativeId:function(){return null},getProvider:function(){return null},fireClick:function(e){"string"==typeof e&&(e={url:e}),this.emit(n.Event.CLICK,{params:e})},fireQuartile:function(e){this.flags.isStarted&&"number"==typeof e&&e>this.flags.lastQuartileSent&&e<4&&(this.flags.lastQuartileSent++,this.emit(n.Event.QUARTILE,{params:{quartile:e}}))},startChronoView:function(){if(this.getIsVisible()&&!this.plugin.backgroundDetector.isInBackground){var e=this.chronos.viewedMax;0!==e.length&&0===e[e.length-1].stopTime||(e.push(new s),e[e.length-1].start())}},stopChronoView:function(){var e=this.chronos.viewedMax;e[0]&&e.length>0&&0===e[e.length-1].stopTime&&e[e.length-1].stop()},fireManifest:function(e,t){var i={params:e};"string"==typeof e&&(i={params:{errorType:e,errorMessage:t}}),this.emit(n.Event.MANIFEST,i)},fireSkip:function(e){void 0===e&&(e={}),e.skipped=!0,this.fireStop(e)},fireBreakStart:function(e){this.emit(n.Event.PODSTART,{params:e})},fireBreakStop:function(e){this.emit(n.Event.PODSTOP,{params:e})}};e.exports=r},function(e,t,i){var n=i(10),s=i(1),r={getPlayrate:function(){return this.flags.isPaused?0:1},getFramesPerSecond:function(){return null},getDroppedFrames:function(){return null},getThroughput:function(){return null},getRendition:function(){return null},getTitle2:function(){return null},getIsLive:function(){return null},getCdnTraffic:function(){return null},getP2PTraffic:function(){return null},getUploadTraffic:function(){return null},getIsP2PEnabled:function(){return null},getHouseholdId:function(){return null},getLatency:function(){return null},getPacketLoss:function(){return null},getPacketSent:function(){return null},getMetrics:function(){return null},getAudioCodec:function(){return null},getVideoCodec:function(){return null},fireSeekBegin:function(e,t){if(this.plugin&&this.plugin.getIsLive()&&this.plugin.options["content.isLive.noSeek"])return null;if(this.flags.isJoined&&!this.flags.isSeeking){if(this.flags.isBuffering){if(!1===t)return;s.notice("Converting current buffer to seek"),this.chronos.seek=this.chronos.buffer.clone(),this.chronos.buffer.reset(),this.flags.isBuffering=!1}else this.chronos.seek.start();this.flags.isSeeking=!0,this.emit(n.Event.SEEK_BEGIN,{params:e})}},fireSeekEnd:function(e){if(this.plugin&&this.plugin.getIsLive()&&this.plugin.options["content.isLive.noSeek"])return null;this.flags.isJoined&&this.flags.isSeeking&&(this.cancelSeek(),this.emit(n.Event.SEEK_END,{params:e}))},cancelSeek:function(e){this.flags.isJoined&&this.flags.isSeeking&&(this.flags.isSeeking=!1,this.chronos.seek.stop(),this.monitor&&this.monitor.skipNextTick())},fireEvent:function(e,t,i){var s={};s.name=e||"",s.dimensions=t||{},s.values=i||{},this.emit(n.Event.VIDEO_EVENT,{params:s})}};e.exports=r},function(e,t,i){var n=i(2),s=i(9),r={getHost:function(){var e=this.options.host;return this.viewTransform&&this.viewTransform.response&&this.viewTransform.response.host&&(e=this.viewTransform.response.host),n.addProtocol(n.stripProtocol(e),this.options["app.https"])},getUserType:function(){return this.options["user.type"]},isParseManifest:function(){return this.options["parse.manifest"]},isParseCdnNode:function(){return this.options["parse.cdnNode"]},getParseCdnNodeList:function(){return this.options["parse.cdnNode.list"]},getParseCdnNodeNameHeader:function(){return this.options["parse.cdnNameHeader"]},getObfuscateIp:function(){return this.options["user.obfuscateIp"]},getExtraparam1:function(){return this.options["content.customDimension.1"]},getExtraparam2:function(){return this.options["content.customDimension.2"]},getExtraparam3:function(){return this.options["content.customDimension.3"]},getExtraparam4:function(){return this.options["content.customDimension.4"]},getExtraparam5:function(){return this.options["content.customDimension.5"]},getExtraparam6:function(){return this.options["content.customDimension.6"]},getExtraparam7:function(){return this.options["content.customDimension.7"]},getExtraparam8:function(){return this.options["content.customDimension.8"]},getExtraparam9:function(){return this.options["content.customDimension.9"]},getExtraparam10:function(){return this.options["content.customDimension.10"]},getExtraparam11:function(){return this.options["content.customDimension.11"]},getExtraparam12:function(){return this.options["content.customDimension.12"]},getExtraparam13:function(){return this.options["content.customDimension.13"]},getExtraparam14:function(){return this.options["content.customDimension.14"]},getExtraparam15:function(){return this.options["content.customDimension.15"]},getExtraparam16:function(){return this.options["content.customDimension.16"]},getExtraparam17:function(){return this.options["content.customDimension.17"]},getExtraparam18:function(){return this.options["content.customDimension.18"]},getExtraparam19:function(){return this.options["content.customDimension.19"]},getExtraparam20:function(){return this.options["content.customDimension.20"]},getAdExtraparam1:function(){return this.options["ad.customDimension.1"]},getAdExtraparam2:function(){return this.options["ad.customDimension.2"]},getAdExtraparam3:function(){return this.options["ad.customDimension.3"]},getAdExtraparam4:function(){return this.options["ad.customDimension.4"]},getAdExtraparam5:function(){return this.options["ad.customDimension.5"]},getAdExtraparam6:function(){return this.options["ad.customDimension.6"]},getAdExtraparam7:function(){return this.options["ad.customDimension.7"]},getAdExtraparam8:function(){return this.options["ad.customDimension.8"]},getAdExtraparam9:function(){return this.options["ad.customDimension.9"]},getAdExtraparam10:function(){return this.options["ad.customDimension.10"]},getPluginInfo:function(){return{lib:s,adapter:this.getAdapterVersion(),adAdapter:this.getAdAdapterVersion()}},getIp:function(){return this.options["network.ip"]},getIsp:function(){return this.options["network.isp"]},getConnectionType:function(){return this.options["network.connectionType"]},getDeviceInfo:function(){var e={};return this.getDeviceCode()&&(e.deviceCode=this.getDeviceCode()),this.getModel()&&(e.model=this.getModel()),this.getBrand()&&(e.brand=this.getBrand()),this.getDeviceType()&&(e.deviceType=this.getDeviceType()),this.getDeviceName()&&(e.deviceName=this.getDeviceName()),this.getOsName()&&(e.osName=this.getOsName()),this.getOsVersion()&&(e.osVersion=this.getOsVersion()),this.getBrowserName()&&(e.browserName=this.getBrowserName()),this.getBrowserVersion()&&(e.browserVersion=this.getBrowserVersion()),this.getBrowserType()&&(e.browserType=this.getBrowserType()),this.getBrowserEngine()&&(e.browserEngine=this.getBrowserEngine()),e!=={}?e:null},getDeviceCode:function(){return this.options["device.code"]},getModel:function(){return this.options["device.model"]},getBrand:function(){return this.options["device.brand"]},getDeviceType:function(){return this.options["device.type"]},getDeviceName:function(){return this.options["device.name"]},getOsName:function(){return this.options["device.osName"]},getOsVersion:function(){return this.options["device.osVersion"]},getBrowserName:function(){return this.options["device.browserName"]},getBrowserVersion:function(){return this.options["device.browserVersion"]},getBrowserType:function(){return this.options["device.browserType"]},getBrowserEngine:function(){return this.options["device.browserEngine"]},getAccountCode:function(){return this.options.accountCode},getUsername:function(){return this.options["user.name"]},getAnonymousUser:function(){return this.options["user.anonymousId"]},getEmail:function(){return this.options["user.email"]},getReferer:function(){var e=this.options.referrer||"";return"undefined"!=typeof window&&window.location&&(e=window.location.href),e},getReferral:function(){var e=null;return"undefined"!=typeof window&&window.document&&(e=window.document.referrer),e},getLanguage:function(){var e=null;return"undefined"!=typeof navigator&&(e=navigator.language),e},getNodeHost:function(){return this.options["content.cdnNode"]||this.resourceTransform.getNodeHost()},getNodeType:function(){return this.options["content.cdnType"]||this.resourceTransform.getNodeType()},getNodeTypeString:function(){return this.resourceTransform.getNodeTypeString()},getRequestNumber:function(){return Math.random()},getOfflineView:function(){return this.offlineStorage.getView()},getDeviceUUID:function(){var e=null;return this.options["device.isAnonymous"]||(e=this.uuidGenerator.getKey()),e},getSmartswitchConfigCode:function(){return this.options["smartswitch.configCode"]},getSmartswitchGroupCode:function(){return this.options["smartswitch.groupCode"]},getSmartswitchContractCode:function(){return this.options["smartswitch.contractCode"]},getAppName:function(){return this.options["app.name"]},getAppReleaseVersion:function(){return this.options["app.releaseVersion"]},getIsBlocked:function(){return this.blockDetector?this.blockDetector.isBlocked:null}};e.exports=r},function(e,t,i){var n=i(1),s=i(2),r=i(9),a={getPlayhead:function(){var e=this._safeGetterAdapter("getPlayhead");return s.parseNumber(e,0)},getPlayrate:function(){var e=0;if(this._adapter&&this._adapter.flags&&!this._adapter.flags.isPaused)try{e=this._adapter.getPlayrate()}catch(e){n.warn("An error occured while calling getPlayrate",e)}return e},getFramesPerSecond:function(){return this._safeGetterAdapter("getFramesPerSecond","content.fps")},getDroppedFrames:function(){var e=this._safeGetterAdapter("getDroppedFrames");return e||(e=this.getWebkitDroppedFrames()),s.parseNumber(e,0)},getWebkitDroppedFrames:function(){return this._adapter&&this._adapter.tag&&this._adapter.tag.webkitDroppedFrameCount?this._adapter.tag.webkitDroppedFrameCount:null},getDuration:function(){var e=this._safeGetterAdapter("getDuration","content.duration")||null;return s.parseNumber(Math.round(e),null)},getBitrate:function(){var e=this._safeGetterAdapter("getBitrate","content.bitrate");return e&&-1!==e||(e=this.getWebkitBitrate()),s.parseNumber(e,-1)},getTotalBytes:function(){return this.options["content.sendTotalBytes"]?this._safeGetterAdapter("getTotalBytes","content.totalBytes"):null},getWebkitBitrate:function(){if(this._adapter&&this._adapter.tag&&this._adapter.tag.webkitVideoDecodedByteCount){var e=this._adapter.tag.webkitVideoDecodedByteCount;if(this._lastWebkitBitrate){var t=this._adapter.tag.webkitVideoDecodedByteCount-this._lastWebkitBitrate;e=Math.round(t/this.viewTransform.response.pingTime*8)}return this._lastWebkitBitrate=this._adapter.tag.webkitVideoDecodedByteCount,0!==e?e:-1}},getThroughput:function(){var e=this._safeGetterAdapter("getThroughput","content.throughput");return s.parseNumber(e,-1)},getRendition:function(){return this._safeGetterAdapter("getRendition","content.rendition")},getTitle:function(){return this._safeGetterAdapter("getTitle","content.title")},getTitle2:function(){return this._safeGetterAdapter("getTitle2","content.program")},getIsLive:function(){var e=this.options["content.isLive"];return e||!1===e||(e=this._safeGetterAdapter("getIsLive")||!1),e},getResource:function(){return this._safeGetterAdapter("getResource","content.resource")},getParsedResource:function(){var e=null;return!this.resourceTransform.isBlocking()&&this.resourceTransform.isDone&&(e=this.resourceTransform.getResource()),e===this.getResource()?null:e},getTransactionCode:function(){return this.options["content.transactionCode"]},getMetadata:function(){return this.options["content.metadata"]},getPlayerVersion:function(){return this._safeGetterAdapter("getPlayerVersion")||""},getPlayerName:function(){return this._safeGetterAdapter("getPlayerName")||""},getCdn:function(){var e=null;return this.resourceTransform.isBlocking()||(e=this.resourceTransform.getCdnName()),e||this.options["content.cdn"]},getPluginVersion:function(){var e=this.getAdapterVersion();return e||(e=r+"-adapterless-js"),e},getLibVersion:function(){return r},getAdapterVersion:function(){return this._safeGetterAdapter("getVersion")},getCdnTraffic:function(){return this._safeGetterAdapter("getCdnTraffic")||this.hybridNetwork.getCdnTraffic()},getP2PTraffic:function(){return this._safeGetterAdapter("getP2PTraffic")||this.hybridNetwork.getP2PTraffic()},getUploadTraffic:function(){return this._safeGetterAdapter("getUploadTraffic")||this.hybridNetwork.getUploadTraffic()},getIsP2PEnabled:function(){return this._safeGetterAdapter("getIsP2PEnabled")||this.hybridNetwork.getIsP2PEnabled()},getStreamingProtocol:function(){return this.options["content.streamingProtocol"]},getHouseholdId:function(){return this._safeGetterAdapter("getHouseholdId")},getLatency:function(){return this._safeGetterAdapter("getLatency")},getPacketLoss:function(){return this._safeGetterAdapter("getPacketLoss")},getPacketSent:function(){return this._safeGetterAdapter("getPacketSent")},getVideoMetrics:function(){return s.getMetricsFrom(this._adapter?this._adapter.getMetrics():null,this.options["content.metrics"])},getPlayerStartupTime:function(){return this.browserLoadTimes.getPlayerStartupTime()},getJoinDuration:function(){return this._adapter?this._adapter.chronos.join.getDeltaTime(!1):-1},getBufferDuration:function(){return this._adapter?this._adapter.chronos.buffer.getDeltaTime(!1):-1},getSeekDuration:function(){return this._adapter?this._adapter.chronos.seek.getDeltaTime(!1):-1},getPauseDuration:function(){return this._adapter?this._adapter.chronos.pause.getDeltaTime(!1):0},getPackage:function(){return this.options["content.package"]},getSaga:function(){return this.options["content.saga"]},getTvShow:function(){return this.options["content.tvShow"]},getSeason:function(){return this.options["content.season"]},getEpisodeTitle:function(){return this.options["content.episodeTitle"]},getChannel:function(){return this.options["content.channel"]},getID:function(){return this.options["content.id"]},getImdbId:function(){return this.options["content.imdbId"]},getGracenoteID:function(){return this.options["content.gracenoteId"]},getType:function(){return this.options["content.type"]},getGenre:function(){return this.options["content.genre"]},getVideoLanguage:function(){return this.options["content.language"]},getSubtitles:function(){return this.options["content.subtitles"]},getContractedResolution:function(){return this.options["content.contractedResolution"]},getCost:function(){return this.options["content.cost"]},getPrice:function(){return this.options["content.price"]},getPlaybackType:function(){return this.options["content.playbackType"]?this.options["content.playbackType"]:this.getIsLive()?"Live":"VoD"},getDRM:function(){return this.options["content.drm"]},getVideoCodec:function(){return this._safeGetterAdapter("getVideoCodec","content.encoding.videoCodec")},getAudioCodec:function(){return this._safeGetterAdapter("getAudioCodec","content.encoding.audioCodec")},getCodecSettings:function(){return this.options["content.encoding.codecSettings"]},getCodecProfile:function(){return this.options["content.encoding.codecProfile"]},getContainerFormat:function(){return this.options["content.encoding.containerFormat"]},_safeGetterAdapter:function(e,t){var i=null;if(t&&this.options[t])i=this.options[t];else try{this._adapter&&"function"==typeof this._adapter[e]&&(i=this._adapter[e]())}catch(t){n.warn("An error occured while calling "+e,t)}return i}};e.exports=a},function(e,t,i){var n=i(1),s=i(4),r=i(18),a={getAdsAdapter:function(){return this._adsAdapter},setAdsAdapter:function(e){if(e.plugin)n.warn("Adapters can only be added to a single plugin");else{for(var t in this.removeAdsAdapter(),e.plugin=this,this._adsAdapter=e,e.setIsAds(!0),this.adsAdapterListeners={},this.adsAdapterListeners[r.Event.START]=this._adStartListener.bind(this),this.adsAdapterListeners[r.Event.JOIN]=this._adJoinListener.bind(this),this.adsAdapterListeners[r.Event.PAUSE]=this._adPauseListener.bind(this),this.adsAdapterListeners[r.Event.RESUME]=this._adResumeListener.bind(this),this.adsAdapterListeners[r.Event.BUFFER_BEGIN]=this._adBufferBeginListener.bind(this),this.adsAdapterListeners[r.Event.BUFFER_END]=this._adBufferEndListener.bind(this),this.adsAdapterListeners[r.Event.STOP]=this._adStopListener.bind(this),this.adsAdapterListeners[r.Event.ERROR]=this._adErrorListener.bind(this),this.adsAdapterListeners[r.Event.CLICK]=this._adClickListener.bind(this),this.adsAdapterListeners[r.Event.MANIFEST]=this._adManifestListener.bind(this),this.adsAdapterListeners[r.Event.PODSTART]=this._adBreakStartListener.bind(this),this.adsAdapterListeners[r.Event.PODSTOP]=this._adBreakStopListener.bind(this),this.adsAdapterListeners[r.Event.QUARTILE]=this._adQuartileListener.bind(this),this.adsAdapterListeners)this._adsAdapter.on(t,this.adsAdapterListeners[t]);this.resizeScrollDetector.startDetection()}},removeAdsAdapter:function(){if(this._adsAdapter){if(this._adsAdapter.dispose(),this._adsAdapter.plugin=null,this.adsAdapterListeners){for(var e in this.adsAdapterListeners)this._adsAdapter.off(e,this.adsAdapterListeners[e]);delete this.adsAdapterListeners}this.resizeScrollDetector.stopDetection(),this._adsAdapter=null}},_adStartListener:function(e){this._adapter?(this._adapter.fireBufferEnd(),this._adapter.fireSeekEnd(),this.isInitiated||this._adapter.flags.isStarted||this._adapter.fireStart(),this._adapter.flags.isPaused&&this._adapter.chronos.pause.reset()):this.fireInit(),this._adsAdapter&&(this._adsAdapter.fireManifest(),this._adsAdapter.fireBreakStart(),this._adsAdapter.chronos.viewedMax=[]);var t=e.data.params||{};t.adNumber=this.requestBuilder.getNewAdNumber(),(this.getAdResource()||this.getAdTitle())&&"number"==typeof this.getAdDuration()?(this.adStartSent=!0,this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_START,s.Service.AD_START,t)):(this.adInitSent=!0,this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_INIT,s.Service.AD_INIT,t))},_adJoinListener:function(e){var t=e.data.params||{};this.adInitSent&&!this.adStartSent&&this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_START,s.Service.AD_START,t),this._adsAdapter.startChronoView(),this.adConnected&&(this._adsAdapter.chronos.join.startTime=this.adConnectedTime,this._adsAdapter.chronos.total.startTime=this.adConnectedTime,this.adConnectedTime=0,this.adConnected=!1),this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_JOIN,s.Service.AD_JOIN,t),this.adInitSent=!1,this.adStartSent=!1},_adPauseListener:function(e){var t=e.data.params||{};this._adsAdapter.stopChronoView(),this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_PAUSE,s.Service.AD_PAUSE,t)},_adResumeListener:function(e){var t=e.data.params||{};this._adsAdapter.startChronoView(),this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_RESUME,s.Service.AD_RESUME,t)},_adBufferBeginListener:function(e){n.notice("Ad Buffer Begin"),this._adsAdapter.stopChronoView(),this._adsAdapter&&this._adsAdapter.flags.isPaused&&this._adsAdapter.chronos.pause.reset()},_adBufferEndListener:function(e){var t=e.data.params||{};this._adsAdapter.startChronoView(),this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_BUFFER,s.Service.AD_BUFFER,t)},_adStopListener:function(e){this._adsAdapter.stopChronoView(),this._adsAdapter.flags.reset(),this._totalPrerollsTime=(this._totalPrerollsTime||0)+this._adsAdapter.chronos.total.getDeltaTime();var t=e.data.params||{};t.position=this.requestBuilder.lastSent.position,t.position===s.AdPosition.Postroll&&this.playedPostrolls++,this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_STOP,s.Service.AD_STOP,t),this.options["ad.expectedPattern"]&&this.options["ad.expectedPattern"].post&&this.options["ad.expectedPattern"].post[0]===this.playedPostrolls&&t.position===s.AdPosition.Postroll&&this.fireStop(),this.adConnected=!0,this.adConnectedTime=(new Date).getTime()},_adErrorListener:function(e){var t=e.data.params||{};return!this._adapter||this._adapter.flags.isStarted||this.isInitiated?this._blockAdError(e.data.params)?null:(this._adsAdapter&&(this._adsAdapter.fireManifest(),this._adsAdapter.fireBreakStart()),this._adsAdapter&&this._adsAdapter.flags.isStarted||(t.adNumber=this.requestBuilder.getNewAdNumber()),this.isBreakStarted||(t.breakNumber=this.requestBuilder.getNewBreakNumber()),void this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_ERROR,s.Service.AD_ERROR,t)):(this._savedAdError=e,null)},_adSavedError:function(){this._savedAdError&&(this._adErrorListener(this._savedAdError),this._savedAdError=null)},_adSavedManifest:function(){this._savedAdManifest&&(this._adManifestListener(this._savedAdManifest),this._savedAdManifest=null)},_blockAdError:function(e){var t=Date.now();return!!this._lastAdErrorParams&&(this._lastAdErrorParams.errorCode===e.errorCode&&this._lastAdErrorParams.msg===e.msg)&&this._lastAdErrorTime+5e3>t?(this._lastAdErrorTime=t,!0):(this._lastAdErrorTime=t,this._lastAdErrorParams=e,!1)},_adClickListener:function(e){var t=e.data.params||{};this._adsAdapter.stopChronoView(),this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_CLICK,s.Service.AD_CLICK,t)},_adManifestListener:function(e){if(!this.isAdsManifestSent){if(this._adapter&&!this._adapter.flags.isStarted&&!this.isInitiated)return this._savedAdManifest=e,null;var t=e.data.params||{};this.isAdsManifestSent=!0,this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_MANIFEST,s.Service.AD_MANIFEST,t)}},_adBreakStartListener:function(e){if(!this.isBreakStarted){this.isBreakStarted=!0;var t=e.data.params||{};t.breakNumber=this.requestBuilder.getNewBreakNumber(),this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_POD_START,s.Service.AD_POD_START,t),this.adConnected=!1}},_adBreakStopListener:function(e){if(this.isBreakStarted){this.isBreakStarted=!1;var t=e.data.params||{};t.position=this.requestBuilder.lastSent.position,this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_POD_STOP,s.Service.AD_POD_STOP,t),this.adConnected=!1}},_adQuartileListener:function(e){var t=e.data.params||{};t.quartile&&this._sendAdEventIfAllowed(s.WillSendEvent.WILL_SEND_AD_QUARTILE,s.Service.AD_QUARTILE,t)},_sendAdEventIfAllowed:function(e,t,i){this.options["ad.ignore"]||this._send(e,t,i),n.notice(t)}};e.exports=a},function(e,t,i){var n=i(1),s=i(2),r=i(4),a={getAdPlayerVersion:function(){return this._safeGetterAdsAdapter("getPlayerVersion")||""},getAdPosition:function(){var e=r.AdPosition.Preroll;if(this._adsAdapter)try{var t=this._adsAdapter.getPosition();r.AdPosition.Preroll!==t&&r.AdPosition.Midroll!==t&&r.AdPosition.Postroll!==t||(e=t)}catch(e){n.warn("An error occured while calling getAdPosition",e)}return!e&&this._adapter&&(e=this._adapter.flags.isJoined?r.AdPosition.Midroll:r.AdPosition.Preroll),e},getAdNumber:function(){return this.requestBuilder.lastSent.adNumber||0},getBreakNumber:function(){return this.requestBuilder.lastSent.breakNumber||0},getAdPlayhead:function(){var e=this._safeGetterAdsAdapter("getPlayhead");return s.parseNumber(e,0)},getAdDuration:function(){var e=this._safeGetterAdsAdapter("getDuration");return s.parseNumber(e,0)},getAdBitrate:function(){var e=this._safeGetterAdsAdapter("getBitrate");return e&&-1!==e||(e=this.getWebkitAdBitrate()),s.parseNumber(e,-1)},getWebkitAdBitrate:function(){if(this._adsAdapter&&this._adsAdapter.tag&&this._adsAdapter.tag.webkitVideoDecodedByteCount){var e=this._adsAdapter.tag.webkitVideoDecodedByteCount;if(this._lastWebkitAdBitrate){var t=this._adsAdapter.tag.webkitVideoDecodedByteCount-this._lastWebkitAdBitrate;e=Math.round(t/this.viewTransform.response.pingTime*8)}return this._lastWebkitAdBitrate=this._adsAdapter.tag.webkitVideoDecodedByteCount,0!==e?e:-1}},getAdTitle:function(){return this._safeGetterAdsAdapter("getTitle","ad.title")},getAdResource:function(){return this._safeGetterAdsAdapter("getResource","ad.resource")},getAdCampaign:function(){return this._safeGetterAdsAdapter("getCampaign","ad.campaign")},getAdCreativeId:function(){return this._safeGetterAdsAdapter("getCreativeId","ad.creativeId")},getAdProvider:function(){return this._safeGetterAdsAdapter("getProvider","ad.provider")},getAdAdapterVersion:function(){return this._safeGetterAdsAdapter("getVersion")},getAdMetadata:function(){return this.options["ad.metadata"]},getGivenBreaks:function(){return this._safeGetterAdsAdapter("getGivenBreaks","ad.givenBreaks")},getExpectedBreaks:function(){var e=null;if(this.options["ad.expectedBreaks"])e=this.options["ad.expectedBreaks"];else if(this.options["ad.expectedPattern"])e=0,e=this.options["ad.expectedPattern"].pre?this.options["ad.expectedPattern"].pre.length:0,e+=this.options["ad.expectedPattern"].mid?this.options["ad.expectedPattern"].mid.length:0,e+=this.options["ad.expectedPattern"].post?this.options["ad.expectedPattern"].post.length:0;else if(this._adsAdapter)try{e=this._adsAdapter.getExpectedBreaks()}catch(e){n.warn("An error occured while calling expectedBreaks",e)}return e},getExpectedPattern:function(){return this._safeGetterAdsAdapter("getExpectedPattern","ad.expectedPattern")},getBreaksTime:function(){return this._safeGetterAdsAdapter("getBreaksTime","ad.breaksTime")},getGivenAds:function(){return this._safeGetterAdsAdapter("getGivenAds","getBreaksTime")},getExpectedAds:function(){var e=null;try{if(this._adsAdapter)if(this.options["ad.expectedPattern"]&&this.getAdPosition()){var t=[];if(this.options["ad.expectedPattern"].pre&&(t=t.concat(this.options["ad.expectedPattern"].pre)),this.options["ad.expectedPattern"].mid&&(t=t.concat(this.options["ad.expectedPattern"].mid)),this.options["ad.expectedPattern"].post&&(t=t.concat(this.options["ad.expectedPattern"].post)),t.length>0){var i=this.requestBuilder.lastSent.breakNumber;i>t.length&&(i=t.length),e=t[i-1]}}else e=this._adsAdapter.getExpectedAds()}catch(e){n.warn("An error occured while calling expectedAds",e)}return e},getAdsExpected:function(){var e=null;try{e=this.getExpectedPattern()||this.getGivenAds()||!1}catch(e){n.warn("An error occured while calling givenAds or expectedPattern",e)}return e},getAdJoinDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.join.getDeltaTime(!1):-1},getAdBufferDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.buffer.getDeltaTime(!1):-1},getAdPauseDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.pause.getDeltaTime(!1):0},getAdTotalDuration:function(){return this._adsAdapter?this._adsAdapter.chronos.total.getDeltaTime(!1):-1},getAdViewedDuration:function(){return this._getTimeMaxOrAcum(!0)},getAdViewability:function(){return this._getTimeMaxOrAcum()},_getTimeMaxOrAcum:function(e){var t=0;return this._adsAdapter&&this._adsAdapter.chronos.viewedMax.forEach((function(i){e?t+=i.getDeltaTime(!1):t=Math.max(i.getDeltaTime(!1),t)})),t},getAudioEnabled:function(){return this._safeGetterAdsAdapter("getAudioEnabled")},getIsSkippable:function(){return this._safeGetterAdsAdapter("getIsSkippable")},getIsFullscreen:function(){return this._safeGetterAdsAdapter("getIsFullscreen")},_safeGetterAdsAdapter:function(e,t){var i=null;if(t&&this.options[t])i=this.options[t];else try{this._adsAdapter&&"function"==typeof this._adsAdapter[e]&&(i=this._adsAdapter[e]())}catch(t){n.warn("An error occured while calling "+e,t)}return i}};e.exports=a},function(e,t,i){var n=i(1),s=i(4),r={_startPings:function(){this._ping.isRunning||this._ping.start()},_stopPings:function(){this._ping.stop()},_sendPing:function(e){var t={diffTime:e,entities:this.requestBuilder.getChangedEntities()};this._adapter&&(t=this._adapter.flags.isPaused?this.requestBuilder.fetchParams(t,["pauseDuration"]):this.requestBuilder.fetchParams(t,["bitrate","throughput","fps"]),this._adapter.flags.isJoined&&(t=this.requestBuilder.fetchParams(t,["playhead"])),this._adapter.flags.isBuffering&&(t=this.requestBuilder.fetchParams(t,["bufferDuration"])),this._adapter.flags.isSeeking&&(t=this.requestBuilder.fetchParams(t,["seekDuration"])),this._adsAdapter&&!this.options["ad.ignore"]&&(this._adsAdapter.flags.isStarted&&(t=this.requestBuilder.fetchParams(t,["adPlayhead","adViewedDuration","adViewability"]),t=this._adsAdapter.flags.isPaused?this.requestBuilder.fetchParams(t,["adPauseDuration"]):this.requestBuilder.fetchParams(t,["adBitrate"])),this._adsAdapter.flags.isBuffering&&(t=this.requestBuilder.fetchParams(t,["adBufferDuration"])))),this._send(s.WillSendEvent.WILL_SEND_PING,s.Service.PING,t),this.startDelayed&&this._retryStart(),n.verbose(s.Service.PING)}};e.exports=r},function(e,t,i){var n=i(1),s=i(2),r=i(4),a=i(7),o={fireInit:function(e){this.isInitiated||(!this.getAdapter()||this.getAdapter()&&!this.getAdapter().flags.isStarted)&&(this.viewTransform.nextView(),this._initComm(),this._startPings(),this.initChrono.start(),this.isInitiated=!0,e=e||{},this._send(r.WillSendEvent.WILL_SEND_INIT,r.Service.INIT,e),this._adSavedError(),this._adSavedManifest(),n.notice(r.Service.INIT+" "+(e.title||e.mediaResource)))},fireError:function(e,t,i,a){this.fireInit();var o=s.buildErrorParams(e,t,i,a);o.code&&delete o.code,this._send(r.WillSendEvent.WILL_SEND_ERROR,r.Service.ERROR,o),this._adSavedError(),this._adSavedManifest(),n.notice(r.Service.ERROR+" "+o.errorLevel+" "+o.errorCode),"fatal"===o.errorLevel&&this.fireStop()},fireFatalError:function(e,t,i,n){this.fireError(e,t,i,n),this.fireStop()},fireStop:function(e){(this.isInitiated||this.isStarted)&&(this._adapter&&(this._adapter.flags.isStopped=!0,this._adapter.monitor&&this._adapter.monitor.stop()),this._adsAdapter&&this.isBreakStarted&&this._adsAdapter.fireBreakStop(),e=e||{},this._send(r.WillSendEvent.WILL_SEND_STOP,r.Service.STOP,e),n.notice(r.Service.STOP+" at "+e.playhead+"s"),this._reset())},fireOfflineEvents:function(e){this.options&&!this.options.offline?this.isInitiated||this._adapter&&this._adapter.flags.isStarted||this._adsAdapter&&this._adsAdapter.flags.isStarted?n.error("Adapters have to be stopped"):(this._offlineParams=e,this.viewTransform.response.code&&this.viewTransform.response.host?this._generateAndSendOffline():(this.offlineReference=this._generateAndSendOffline.bind(this),this.viewTransform.on(a.Event.DONE,this.offlineReference))):n.error("To send offline events, offline option must be disabled")},_generateAndSendOffline:function(){var e=this._offlineParams;for(this._initComm();;){var t=this.requestBuilder.buildBody(r.Service.OFFLINE_EVENTS).viewJson;if(null===t[0])break;var i=this.viewTransform.nextView(),n=t[0].replace(/CODE_PLACEHOLDER/g,i.toString()).replace(/,"sessionId":"SESSION_PLACEHOLDER"/g,"").replace(/,"sessionRoot":"ROOT_PLACEHOLDER"/g,"");this._send(r.WillSendEvent.WILL_SEND_OFFLINE_EVENTS,r.Service.OFFLINE_EVENTS,e,n,"POST",function(e,t){this.offlineStorage.removeView(t.offlineId)}.bind(this),{offlineId:t[1]})}this.offlineStorage.sent(),this._offlineParams=null}};e.exports=o},function(e,t,i){var n=i(4),s=i(1),r=i(5),a=i(2),o=i(17),d={_initInfinity:function(){this.infinity.on(o.Event.NAV,this._navListener.bind(this)),this.infinity.on(o.Event.SESSION_START,this._sessionStartListener.bind(this)),this.infinity.on(o.Event.SESSION_STOP,this._sessionStopListener.bind(this)),this.infinity.on(o.Event.EVENT,this._eventListener.bind(this))},_sendInfinity:function(e,t,i){var n={params:i=this.requestBuilder.buildParams(i,t),plugin:this,adapter:this.getAdapter(),adsAdapter:this.getAdsAdapter()};this.emit(e,n),this.infinity._comm&&null!==i&&this.options.enabled&&(this.lastServeiceSent=t,this.infinity._comm.sendRequest(new r(null,t,i)))},_navListener:function(e){var t=e.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_NAV,n.Service.NAV,t),this._beat.isRunning||this._beat.start(),s.notice(n.Service.NAV+" "+t.route)},_sessionStartListener:function(e){var t=e.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_SESSION_START,n.Service.SESSION_START,t),this._beat.isRunning||this._beat.start(),s.notice(n.Service.SESSION_START+" "+t.route)},_sessionStopListener:function(e){var t=e.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_SESSION_STOP,n.Service.SESSION_STOP,t),this._beat.isRunning&&this._beat.stop(),s.notice(n.Service.SESSION_STOP+" "+t.route)},_eventListener:function(e){var t=e.data.params||{};this._sendInfinity(n.WillSendEvent.WILL_SEND_EVENT,n.Service.EVENT,t),s.notice(n.Service.EVENT+" "+t.name)},_sendBeat:function(e){var t={diffTime:e};this._sendInfinity(n.WillSendEvent.WILL_SEND_BEAT,n.Service.BEAT,t),this.infinity&&this.infinity._setLastActive(),s.verbose(n.Service.BEAT)},getSessionMetrics:function(){return a.getMetricsFrom(this.options["session.metrics"])}};e.exports=d},function(e,t){var i={getContext:function(){var e="Default";return this.options["session.context"]&&(e=this.storage.getSession("context")),e},getSession:function(){return this.storage.getStorages("session")},getStoredData:function(){return this.storage.getStorages("data")},getDataTime:function(){return this.storage.getStorages("dataTime")},getLastActive:function(){return this.storage.getStorages("lastactive")},setStoredData:function(e){this.storage.setStorages("data",e)},setSession:function(e){this.storage.setStorages("session",e)},setDataTime:function(e){this.storage.setStorages("dataTime",e)},setLastActive:function(e){this.storage.setStorages("lastactive",e)},getPageName:function(){if("undefined"!=typeof document&&document.title)return document.title},getPageLoadTime:function(){return this.browserLoadTimes.getPageLoadTime()},getIsSessionExpired:function(){var e=(new Date).getTime();return!this.getSession()||this.infinity.getFirstActive()<e-this.sessionExpire},getIsDataExpired:function(){var e=(new Date).getTime();return!this.storage.isEnabled()||!this.getStoredData()||this.infinity.getFirstActive()<e-this.sessionExpire}};e.exports=i},function(e,t,i){var n=i(3),s=i(12),r=n.Adapter.extend({getVersion:function(){return s.version+"-"+s.name+"-"+s.tech},getTitle:function(){var e=null;return this.player.mediainfo&&(e=this.player.mediainfo.name),e},getPlayhead:function(){var e=this.player.currentTime();return this.plugin._adsAdapter&&this.plugin._adsAdapter.flags.isStarted&&(e=this.lastPlayhead||e),e},getIsLive:function(){var e=null;return this.player.mediainfo&&(e=!0,"number"==typeof this.player.mediainfo.duration&&(e=this.player.mediainfo.duration<1)),e},getDuration:function(){var e=this.player.duration();return this.player.mediainfo&&void 0!==this.player.mediainfo.duration&&(e=this.player.mediainfo.duration),e},getResource:function(){var e=null,t=this.getUsedTech();return t&&t.getResource&&(e=t.getResource(this)),e||(e=this.player.currentSrc()),e},getBitrate:function(){var e=null,t=this.getUsedTech();return t&&t.getBitrate&&(e=t.getBitrate(this)),e},getRendition:function(){var e=null,t=this.getUsedTech();return t&&t.getRendition&&(e=t.getRendition(this)),e},getTotalBytes:function(){var e=null,t=this.getUsedTech();return t&&t.getTotalBytes&&(e=t.getTotalBytes(this)),e},getPlayerName:function(){var e="videojs";return r.ContribHlsTech.isUsed(this)?e+="-hls":r.HlsJsTech.isUsed(this)?e+="-hlsjs":r.ShakaTech.isUsed(this)?e+="-shaka":r.DashShakaTech.isUsed(this)&&(e+="-dash-shaka"),r.ImaAdsAdapter.isUsed(this)?e+="-ima":r.OnceUXAdsAdapter.isUsed(this)?this.pluginName+="-oux":this.player.FreeWheelPlugin&&(e+="-fw"),this.player.mediainfo&&(e+="-bcove"),e},getPlayerVersion:function(){var e=null;return"undefined"!=typeof videojs&&(e=videojs.VERSION),e},getPlayrate:function(){return this.player.playbackRate()},getTech:function(){return this.player.tech({IWillNotUseThisInPlugins:!0})},getUsedTech:function(){var e=null;return r.ContribHlsTech.isUsed(this)?e=r.ContribHlsTech:r.HlsJsTech.isUsed(this)?e=r.HlsJsTech:r.ShakaTech.isUsed(this)?e=r.ShakaTech:r.DashShakaTech.isUsed(this)&&(e=r.DashShakaTech),e},registerListeners:function(){this.monitorPlayhead(!0,!1),this.acumBytes=0,this.ignoreList=[],this.fatalList=[],this.nonFatalList=[],this.references={loadstart:this.loadstartListener.bind(this),adsready:this.loadAdsAdapter.bind(this),play:this.playListener.bind(this),timeupdate:this.timeupdateListener.bind(this),pause:this.pauseListener.bind(this),playing:this.playingListener.bind(this),ended:this.conditionalStop.bind(this),dispose:this.conditionalStop.bind(this),seeking:this.seekingListener.bind(this),seeked:this.seekedListener.bind(this),error:this.errorListener.bind(this),adserror:this.aderrorListener.bind(this),adsEnded:this.adsEndedListener.bind(this),texttrackchange:this.textListener.bind(this)},this.player&&Object.keys(this.references).forEach(function(e){this.player.on(e,this.references[e])}.bind(this)),setTimeout(this.loadAdsAdapter.bind(this),50)},unregisterListeners:function(){this.monitor&&this.monitor.stop(),this.player&&this.references&&(Object.keys(this.references).forEach(function(e){this.player.off(e,this.references[e])}.bind(this)),delete this.references)},textListener:function(e){if(this.player.textTracks)for(var t=this.player.textTracks(),i=t.length,n=0;n<i;++n)t[n]&&"showing"===t[n].mode&&(this.plugin.options["content.subtitles"]=t[n].label||t[n].language)},aderrorListener:function(e){this.loadAdsAdapter(),this.plugin.getAdsAdapter()&&this.plugin.getAdsAdapter().adPlayerErrorListener&&this.plugin.getAdsAdapter().adPlayerErrorListener(e)},loadstartListener:function(e){this.loadAdsAdapter(),n.Log.notice("Player detected "+this.getPlayerName())},playListener:function(e){this.flags.isStarted?this.lastSrc&&this.lastSrc!==this.getResource()&&(this.fireStop(),this.acumBytesFunc(),this.lastPlayhead=void 0,this._startEvent(),this.lastSrc=this.getResource()):(this.lastSrc=this.getResource(),this._startEvent())},_startEvent:function(e){this.loadAdsAdapter(),this.fireStart(),this.flags.isJoined||(this.joinPolling||(this.joinPolling=new n.Timer(this._jointimePolling.bind(this),500)),this.joinPolling.start())},_jointimePolling:function(e){this.plugin.getAdsAdapter()&&this.plugin.getAdsAdapter().flags.isStarted||(0!==this.lastPlayhead&&"number"==typeof this.lastPlayhead&&this.lastPlayhead!==this.getPlayhead()&&(this.fireJoin(),this.joinPolling&&this.joinPolling.stop()),this.lastPlayhead=this.getPlayhead())},timeupdateListener:function(e){this.getPlayhead()>.1&&(this.fireJoin(),this.joinPolling&&this.joinPolling.stop(),!this.flags.isPaused&&this.lastSeekPlayhead&&this.lastSeekPlayhead!==this.getPlayhead()&&(this.fireSeekEnd(),this.lastSeekPlayhead=!1)),this.flags.isJoined||(void 0===this.lastPlayhead&&(this.lastPlayhead=this.getPlayhead()),this.lastPlayhead!==this.getPlayhead()&&(this.fireStart(),this.fireJoin(),this.joinPolling&&this.joinPolling.stop(),this.lastPlayhead=void 0)),this.plugin._adsAdapter&&!this.plugin._adsAdapter.flags.isStarted&&(this.lastPlayhead=this.getPlayhead())},pauseListener:function(e){this.firePause()},playingListener:function(e){this._startEvent(),this.fireResume(),this.getPlayhead()<1&&this.fireSeekEnd()},conditionalStop:function(e){this.plugin&&(this.adsEnded=!1,this.fireStop(),this.acumBytesFunc(),this.lastPlayhead=void 0)},adsEndedListener:function(e){this.adsEnded=!0,this.plugin.requestBuilder.lastSent.adPosition===n.Constants.AdPosition.Postroll&&(this.plugin.fireStop(),this.acumBytesFunc(),this.lastPlayhead=void 0)},seekingListener:function(e){this.fireSeekBegin({},!1)},seekedListener:function(e){this.lastSeekPlayhead=this.getPlayhead()},errorListener:function(e){var t=!1,i=!1,n=null,s=null;this.player.error&&this.player.error()&&(n=Number(this.player.error().code),s=this.player.error().message,(2===n||4===n||n<0)&&(i=!0)),null!==n&&(this.ignoreList.includes(n)&&(t=!0),!i&&this.fatalList.includes(n)?i=!0:i&&this.nonFatalList.includes(n)&&(i=!1)),t||(i?(this.fireFatalError(n,s),this.acumBytesFunc(),this.lastPlayhead=void 0,this.crashed=!0):this.fireError(n,s))},loadAdsAdapter:function(){if(null===this.plugin.getAdsAdapter()||this.plugin.getAdsAdapter().isGeneric){var e=null;r.ImaAdsAdapter.isUsed(this)?e=new r.ImaAdsAdapter(this.player):r.OnceUXAdsAdapter.isUsed(this)?e=new r.OnceUXAdsAdapter(this.player):r.BcoveImaAdsAdapter.isUsed(this)?e=new r.BcoveImaAdsAdapter(this.player):r.BcoveFreewheelAdsAdapter.isUsed(this)?e=new r.BcoveFreewheelAdsAdapter(this.player):null===this.plugin.getAdsAdapter()&&(e=new r.GenericAdsAdapter(this.player)),e&&this.plugin.setAdsAdapter(e)}else this.plugin.getAdsAdapter().registerImaEvents&&this.plugin.getAdsAdapter().registerImaEvents()},acumBytesFunc:function(){this.acumBytes+=this.getTotalBytes()||0},errorModifyer:function(e,t,i){this.fatalList=e||[],this.nonFatalList=t||[],this.ignoreList=i||[]}},{GenericAdsAdapter:i(75),BcoveImaAdsAdapter:i(76),BcoveFreewheelAdsAdapter:i(77),ImaAdsAdapter:i(78),OnceUXAdsAdapter:i(79),ContribHlsTech:i(80),HlsJsTech:i(81),ShakaTech:i(82),DashShakaTech:i(83)});n.adapters.Videojs=r,e.exports=n.adapters.Videojs},function(e,t,i){var n=i(3),s=i(12),r=n.Adapter.extend({isGeneric:!0,getVersion:function(){return s.version+"-videojs-ads"},registerListeners:function(){this.references={adstart:this.adStartListener.bind(this),adend:this.adEndListener.bind(this),adskip:this.adSkipListener.bind(this),adserror:this.errorListener.bind(this),"ads-click":this.clickListener.bind(this)},this.player&&Object.keys(this.references).forEach(function(e){this.player.on(e,this.references[e])}.bind(this))},unregisterListeners:function(){this.player&&this.references&&(Object.keys(this.references).forEach(function(e){this.player.off(e,this.references[e])}.bind(this)),delete this.references)},adStartListener:function(e){this.fireStart(),this.fireJoin()},adEndListener:function(e){this.fireStop()},adSkipListener:function(e){this.fireSkip()},errorListener:function(e){this.fireError()},clickListener:function(e){this.fireClick()}});e.exports=r},function(e,t,i){var n=i(3),s=n.Adapter.extend({getVersion:function(){var e=null;return"undefined"!=typeof google&&google.ima&&(e="bcove-ima "+google.ima.VERSION),e},getPlayhead:function(){var e=this.plugin.getAdapter().player;return this.player.ima3&&this.player.ima3&&this.player.ima3.adPlayer&&(e=this.player.ima3.adPlayer),e.currentTime()},getDuration:function(){var e=null;if(this.player.ads&&this.player.ads.ad&&this.player.ads.ad.duration)e=this.player.ads.ad.duration;else{var t=this.plugin.player;this.player.ima3&&(t=this.player.ima3.adPlayer),e=t&&t.duration?t.duration():null}return e},getPosition:function(){var e=n.Constants.AdPosition.Midroll;if(this.player.ads&&this.player.ads.ad)switch(this.player.ads.ad.type){case"PREROLL":e=n.Constants.AdPosition.Preroll;break;case"MIDROLL":e=n.Constants.AdPosition.Midroll;break;case"POSTROLL":e=n.Constants.AdPosition.Postroll}else this.plugin._adapter.getPlayhead()>=this.plugin._adapter.getDuration()&&(e=n.Constants.AdPosition.Postroll);return this.plugin._adapter.flags.isJoined||(e=n.Constants.AdPosition.Preroll),e},getResource:function(){var e="unknown";return this.player.ima3&&(e=this.player.ima3.currentAd.getMediaUrl()),e},getTitle:function(){var e=null;return this.player.ima3&&this.player.ima3.currentAd&&(e=this.player.ima3.currentAd.getTitle()),e},getPlayerVersion:function(){var e=null;return this.player.ima3&&(e=this.player.ima3.VERSION),e},getGivenBreaks:function(){var e=null;return this.player.ima3&&(e=this.player.ima3.adsManager.getCuePoints().length),e},getBreaksTime:function(){var e=null;if(this.player.ima3){var t=this.player.ima3.adsManager.getCuePoints();for(var i in t)(!t[i]&&0!==t[i]||-1===t[i])&&(t[i]=this.plugin._adapter.getDuration());e=t}return e},getGivenAds:function(){var e=null;return this.player.ima3&&this.player.ima3.currentAd&&this.player.ima3.currentAd.getAdPodInfo()&&(e=this.player.ima3.currentAd.getAdPodInfo().getTotalAds()),e},getAudioEnabled:function(){return!this.player.muted()&&!!this.player.volume()},getIsSkippable:function(){var e=!1;return this.player.ima3&&(e=this.player.ima3.currentAd&&this.player.ima3.currentAd.isSkippable()),e},getIsFullscreen:function(){var e=null;if(this.plugin.deviceDetector.isIphone())e=!this.plugin.deviceDetector.isInBackground;else{var t=null;this.player.ima3&&(t=this.player.ima3.el),e=!!t&&(window.innerHeight<=t.clientHeight+30&&window.innerWidth<=t.clientWidth+30)}return e},getIsVisible:function(){var e=null;return this.plugin.deviceDetector.isIphone()?e=!this.plugin.deviceDetector.isInBackground:this.player.ima3&&(e=n.Util.calculateAdViewability(this.player.ima3.el)),e},getBitrate:function(){var e=-1;return this.player.ima3&&this.player.ima3.currentAd&&this.player.ima3.currentAd.getVastMediaBitrate()&&(e=this.player.ima3.currentAd.getVastMediaBitrate()),e},getCreativeId:function(){var e=null;return this.player.ima3&&this.player.ima3.currentAd?e=this.player.ima3.currentAd.getCreativeAdId()||this.player.ima3.currentAd.getCreativeId():this.titles&&(e=this.titles[(this.plugin.requestBuilder.lastSent.adNumber||1)-1]._creativeId),e},registerListeners:function(){this.monitorPlayhead(!0,!1),this.references={"ima3-started":this.startJoinListener.bind(this),"ima3-paused":this.pausedListener.bind(this),"ima3-resumed":this.resumedListener.bind(this),"ima3-complete":this.adEndedListener.bind(this),"ima3-skipped":this.skippedListener.bind(this),"ima3-ad-error":this.errorListener.bind(this),"ads-pod-ended":this.podEndListener.bind(this),"ads-click":this.clickListener.bind(this),"ads-first-quartile":this.firstQuartileListener.bind(this),"ads-midpoint":this.secondQuartileListener.bind(this),"ads-third-quartile":this.thirdQuartileListener.bind(this)},this.player&&Object.keys(this.references).forEach(function(e){this.player.on(e,this.references[e])}.bind(this))},startJoinListener:function(e){this.plugin._adapter&&this.plugin._adapter.firePause(),this.fireStart(),this.fireJoin()},pausedListener:function(e){this.firePause()},resumedListener:function(e){this.fireResume()},skippedListener:function(e){this.fireSkip(),this.plugin._adapter&&this.plugin._adapter.fireResume()},adEndedListener:function(e){var t=this.plugin.requestBuilder.lastSent.adPosition===n.Constants.AdPosition.Preroll?0:this.plugin._adapter.lastPlayhead;this.fireStop({playhead:t,adPlayhead:this.getDuration()})},errorListener:function(e){if(this.player.ima3)if(e.getError&&e.getError()){var t=e.getError();this.fireError(t.getCode(),t.getMessage())}else this.fireError()},clickListener:function(e){if(this.player.ima3){var t=null;this.player.ima3.currentAd&&this.player.ima3.currentAd.g&&(t=this.player.ima3.currentAd.g.clickThroughUrl),this.fireClick(t)}},firstQuartileListener:function(e){this.fireQuartile(1)},secondQuartileListener:function(e){this.fireQuartile(2)},thirdQuartileListener:function(e){this.fireQuartile(3)},podEndListener:function(e){this.fireBreakStop()},unregisterListeners:function(){this.monitor&&this.monitor.stop(),this.player&&this.references&&(Object.keys(this.references).forEach((function(e){this.player.off(e,this.references[e])})).bind(this),this.references={})},adPlayerErrorListener:function(e){var t=e.data.AdError;[1012,1005,301,402,302].indexOf(t.getErrorCode())>=0?this.fireManifest(n.Constants.ManifestError.NO_RESPONSE,t.getMessage()):[1007,1009,303].indexOf(t.getErrorCode())>=0?this.fireManifest(n.Constants.ManifestError.EMPTY,t.getMessage()):[403,100,503,101,102].indexOf(t.getErrorCode())>=0?this.fireManifest(n.Constants.ManifestError.WRONG,t.getMessage()):this.fireError(t.getErrorCode(),t.getMessage())}},{isUsed:function(e){return"undefined"!=typeof google&&e.player.ima3&&e.player.ads}});e.exports=s},function(e,t,i){var n=i(3),s=n.Adapter.extend({getVersion:function(){var e="unknown";return this.player.FreeWheelPlugin.getVersion?e="bcove-fw "+this.player.FreeWheelPlugin.getVersion():this.player.FreeWheelPlugin.VERSION&&(e="bcove-ssai "+this.player.FreeWheelPlugin.VERSION),e},getDuration:function(){var e=null;if(this.player.ads&&this.player.ads.ad&&this.player.ads.ad.duration)e=this.player.ads.ad.duration;else{var t=this.plugin.player;if(this.player.FreeWheelPlugin){var i=this.player.FreeWheelPlugin.tech;this.player.FreeWheelPlugin[i].adPlayer&&(t=this.player.FreeWheelPlugin[i].adPlayer)}t&&t.duration&&(e=t.duration())}return e},getPosition:function(){var e=n.Constants.AdPosition.Midroll;if(this.player.ads&&this.player.ads.ad)switch(this.player.ads.ad.type){case"PREROLL":e=n.Constants.AdPosition.Preroll;break;case"MIDROLL":e=n.Constants.AdPosition.Midroll;break;case"POSTROLL":e=n.Constants.AdPosition.Postroll}else this.plugin._adapter.flags.isJoined?this.plugin._adapter.getPlayhead()>=this.plugin._adapter.getDuration()&&(e=n.Constants.AdPosition.Postroll):e=n.Constants.AdPosition.Preroll;return e},getResource:function(){var e=null;if(this.slot){var t=this.slot.getAdInstances();if(t){var i=(this.plugin.requestBuilder.lastSent.adNumber||1)-1;if(t[i]&&t[i].getActiveCreativeRendition){var n=t[i].getActiveCreativeRendition();if(n&&n.getPrimaryCreativeRenditionAsset){var s=n.getPrimaryCreativeRenditionAsset();s&&s.getUrl&&s.getUrl()&&(e=s.getUrl())}n&&n.getWrapperUrl&&!e&&(e=n.getWrapperUrl())}}}return e||"unknown"},getTitle:function(){var e=null;return this.player.FreeWheelPlugin.adsManager&&this.player.FreeWheelPlugin.adsManager.getCurrentAd()&&this.player.FreeWheelPlugin.adsManager.getCurrentAd().getTitle()?e=this.player.FreeWheelPlugin.adsManager.getCurrentAd().getTitle():this.titles&&(e=this.titles[(this.plugin.requestBuilder.lastSent.adNumber||1)-1]._adId),e},getPlayhead:function(){var e=this.plugin.getAdapter().player;return this.player.FreeWheelPlugin.adPlayer&&(e=this.player.FreeWheelPlugin.adPlayer),e.currentTime()},getGivenBreaks:function(){var e=this.player.FreeWheelPlugin.tech,t=this.player.FreeWheelPlugin[e]._adContext._adResponse.getTemporalSlots(),i=0;for(var n in t){var s=t[n];if(s.getAdCount()>0){var r=s.getAdInstances();for(var a in r)if("video"===r[a]._creativeRenditions[0]._baseUnit){i++;break}}}return i},getBreaksTime:function(){var e=this.player.FreeWheelPlugin[this.player.FreeWheelPlugin.tech]._adContext._adResponse.getTemporalSlots(),t=[];for(var i in e){var n=e[i];if(n.getAdCount()>0){var s=n.getAdInstances();for(var r in s)if("video"===s[r]._creativeRenditions[0]._baseUnit){this.plugin.getDuration()&&n.getTimePosition()>this.plugin.getDuration()?t.push(this.plugin.getDuration()):t.push(n.getTimePosition());break}}}return t.sort()},getGivenAds:function(){var e=this.player.FreeWheelPlugin.tech;return this.player.FreeWheelPlugin[e]._currentSlot.getAdCount()},getAudioEnabled:function(){return!this.player.muted()&&!!this.player.volume()},getIsSkippable:function(){return!1},getIsFullscreen:function(){var e=null;if(this.plugin.deviceDetector.isIphone())e=!this.plugin.deviceDetector.isInBackground;else{var t,i=this.player.FreeWheelPlugin.tech;e=!!(t=this.player.FreeWheelPlugin[i]._video)&&(window.innerHeight<=t.clientHeight+30&&window.innerWidth<=t.clientWidth+30)}return e},getIsVisible:function(){var e=null;if(this.plugin.deviceDetector.isIphone())e=!this.plugin.deviceDetector.isInBackground;else{if(!this.contentPlayer){var t=this.player.FreeWheelPlugin.tech;for(var i in this.player.FreeWheelPlugin[t]){var s=this.player.FreeWheelPlugin[t][i];if(s.videoHeight&&s.clientHeight){this.contentPlayer=s;break}}}e=n.Util.calculateAdViewability(this.contentPlayer)}return e},getCreativeId:function(){var e=null;return this.titles&&(e=this.titles[(this.plugin.requestBuilder.lastSent.adNumber||1)-1]._creativeId),e},registerListeners:function(){if(this.monitorPlayhead(!0,!1),this.references={"ads-ad-started":this.startJoinListener.bind(this),"ads-pause":this.pausedListener.bind(this),"ads-play":this.resumedListener.bind(this),"ads-ad-ended":this.adEndedListener.bind(this),"ads-pod-ended":this.podEndListener.bind(this),"ads-first-quartile":this.firstQuartileListener.bind(this),"ads-midpoint":this.secondQuartileListener.bind(this),"ads-third-quartile":this.thirdQuartileListener.bind(this)},"undefined"!=typeof tv){var e=this.player.FreeWheelPlugin[this.player.FreeWheelPlugin.tech]._adContext;for(var t in this.events=tv.freewheel.SDK,this.fwreferences={},this.fwreferences[this.events.EVENT_AD]=this.logListener.bind(this),this.fwreferences[this.events.EVENT_SLOT_STARTED]=this.slotListener.bind(this),this.fwreferences[this.events.EVENT_ERROR]=this.errorFwListener.bind(this),this.manifestNoResponse=[this.events.ERROR_SECURITY,this.events.ERROR_TIMEOUT],this.manifestNoResponse)this.fwreferences[t]=this.noResponseManifestListener.bind(this);for(var i in this.manifestEmpty=[this.events.ERROR_NO_AD_AVAILABLE,this.events.ERROR_VAST_NO_AD],this.manifestEmpty)this.fwreferences[i]=this.manifestEmptyListener.bind(this);for(var n in this.manifestWrong=[this.events.ERROR_VAST_VERSION_NOT_SUPPORTED,this.events.ERROR_VAST_WRAPPER_LIMIT_REACH,this.events.ERROR_VAST_XML_PARSING,this.events.ERROR_PARSE],this.manifestWrong)this.fwreferences[n]=this.manifestWrongListener.bind(this);this.player&&Object.keys(this.fwreferences).forEach(function(t){e.addEventListener(t,this.fwreferences[t])}.bind(this))}this.player&&Object.keys(this.references).forEach(function(e){this.player.on(e,this.references[e])}.bind(this))},logListener:function(e){if(e.errorCode||e.errorInfo||e.errorModule)this.errorFwListener(e);else switch(e.subType){case this.events.EVENT_AD_SKIPPED:this.skippedListener(e);break;case this.events.EVENT_SLOT_STARTED:this.slotListener(e);break;case this.events.EVENT_AD_CLICK:this.clickFwListener(e)}},skippedListener:function(e){this.fireSkip(),this.plugin._adapter&&this.plugin._adapter.fireResume()},noResponseManifestListener:function(e){this.fireManifest(n.Constants.ManifestError.NO_RESPONSE,"No response")},manifestEmptyListener:function(e){this.fireManifest(n.Constants.ManifestError.EMPTY,"Empty manifest")},manifestWrongListener:function(e){this.fireManifest(n.Constants.ManifestError.WRONG,"Wrong manifest format")},slotListener:function(e){this.slot=e.slot,e&&e.slot&&e.slot.getAdInstances&&(this.titles=e.slot.getAdInstances())},startJoinListener:function(e){this.plugin._adapter&&this.plugin._adapter.firePause(),this.fireStart(),this.fireJoin()},pausedListener:function(e){this.firePause()},resumedListener:function(e){this.fireResume()},adEndedListener:function(e){var t=this.plugin.requestBuilder.lastSent.adPosition===n.Constants.AdPosition.Preroll?0:this.plugin._adapter.lastPlayhead;this.fireStop({playhead:t,adPlayhead:this.getDuration()})},errorFwListener:function(e){this.fireError(e.errorCode||e.subType,e.errorInfo),this.fireStop()},clickFwListener:function(e){var t=e.adInstance.getEventCallbackUrls(this.events.EVENT_AD_CLICK,this.events.EVENT_TYPE_CLICK)[0];this.fireClick(t)},firstQuartileListener:function(e){this.fireQuartile(1)},secondQuartileListener:function(e){this.fireQuartile(2)},thirdQuartileListener:function(e){this.fireQuartile(3)},podEndListener:function(e){this.fireBreakStop()},unregisterListeners:function(){this.monitor&&this.monitor.stop(),this.player&&this.references&&(Object.keys(this.references).forEach((function(e){this.player.off(e,this.references[e])})).bind(this),this.references={})}},{isUsed:function(e){return e.player.ads&&e.player.FreeWheelPlugin}});e.exports=s},function(e,t,i){var n=i(3),s=i(12),r=n.Adapter.extend({getVersion:function(){return s.version+"-videojs-ima-ads"},getDuration:function(){return this.ima.getAdsManager()&&null!==this.ima.getAdsManager().getCurrentAd()&&(this.duration=this.ima.getAdsManager().getCurrentAd().getDuration()),this.duration},getResource:function(){var e=null,t=this.ima.getAdsManager();return t&&(e=t.getCurrentAd().getMediaUrl()),e},getTitle:function(){var e=null,t=this.ima.getAdsManager();return t&&(e=t.getCurrentAd().getTitle()),e},getPlayhead:function(){var e=null,t=this.ima.getAdsManager();return t&&(e=this.getDuration()-t.getRemainingTime()),e},getPlayerVersion:function(){return"IMA"+google.ima.VERSION+"; contrib-ads "+this.player.ads.VERSION},getPosition:function(){var e=n.Constants.AdPosition.Preroll;return this.plugin._adapter.flags.isJoined&&(!this.plugin.getIsLive()&&this.plugin._adapter.getDuration()-1<this.plugin._adapter.getPlayhead()?e=n.Constants.AdPosition.Postroll:this.plugin._adapter.getPlayhead()>1&&(e=n.Constants.AdPosition.Midroll)),e},getGivenBreaks:function(){var e=null;return this.cuepoints&&(e=this.cuepoints.length),e},getBreaksTime:function(){return this.cuepoints},getGivenAds:function(){return this.totalAds},getAudioEnabled:function(){return!this.ima.adMuted},getIsSkippable:function(){return this.isSkippable},getIsFullscreen:function(){var e=!1,t=this.ima.adDisplayContainer;for(var i in t)t[i]&&t[i].width&&t[i].height&&window.innerHeight&&window.innerWidth&&t[i].width&&t[i].height&&(e=window.innerHeight<=t[i].height+30&&window.innerWidth<=t[i].width+30);return e},getIsVisible:function(){return n.Util.calculateAdViewability(this.ima.adContainerDiv)},registerListeners:function(){this.monitorPlayhead(!0,!1);var e=google.ima.AdEvent.Type;this.references={},this.references[e.AD_METADATA]=this.metadataListener.bind(this),this.references[e.LOADED]=this.loadedListener.bind(this),this.references[e.CONTENT_PAUSE_REQUESTED]=this.contentPauseRequestedListener.bind(this),this.references[e.STARTED]=this.startedListener.bind(this),this.references[e.PAUSED]=this.pausedListener.bind(this),this.references[e.RESUMED]=this.resumedListener.bind(this),this.references[e.COMPLETE]=this.completeListener.bind(this),this.references[e.SKIPPED]=this.skippedListener.bind(this),this.references[e.CLICK]=this.clickListener.bind(this),this.references[google.ima.AdErrorEvent.Type.AD_ERROR]=this.errorListener.bind(this),this.references[e.ALL_ADS_COMPLETED]=this.adsEndedListener.bind(this),this.references[e.FIRST_QUARTILE]=this.firstQuartileListener.bind(this),this.references[e.MIDPOINT]=this.secondQuartileListener.bind(this),this.references[e.THIRD_QUARTILE]=this.thirdQuartileListener.bind(this),this.playerReferences={adend:this.adEndedListener.bind(this),adstart:this.startedListener.bind(this),adskip:this.skippedListener.bind(this),adserror:this.errorListener.bind(this),"ads-click":this.clickListener.bind(this)},this.player&&(this.registerImaEvents(),Object.keys(this.playerReferences).forEach(function(e){this.player.on(e,this.playerReferences[e])}.bind(this)))},registerImaEvents:function(){this.player.ima.addEventListener?this.ima=this.player.ima:this.player.ima.sdkImpl&&this.player.ima.sdkImpl.addEventListener&&(this.ima=this.player.ima.sdkImpl),this.ima&&Object.keys(this.references).forEach(function(e){this.ima.addEventListener(e,this.references[e])}.bind(this))},metadataListener:function(e){this.cuepoints=e.getAdCuePoints().getCuePoints().slice(),this.plugin._adapter&&this.cuepoints.forEach(function(e,t){-1!==this.cuepoints[t]&&null!=this.cuepoints[t]&&void 0!==this.cuepoints[t]||(this.cuepoints[t]=this.plugin._adapter.getDuration())}.bind(this))},loadedListener:function(e){this.isSkippable=e.getAdData().skippable,this.totalAds=e.getAdData().adPodInfo.totalAds,this.fireInit()},contentPauseRequestedListener:function(e){this.fireInit()},startedListener:function(e){this.fireStart(),this.fireJoin()},pausedListener:function(e){this.firePause()},resumedListener:function(e){this.fireResume()},completeListener:function(e){this.fireStop()},skippedListener:function(e){this.fireSkip()},adEndedListener:function(e){this.fireStop()},errorListener:function(e){var t=e.getError();this.fireError(t.getCode(),t.getMessage())},clickListener:function(e){var t=null;try{if(e&&"function"==typeof e.getAd&&e.getAd().g&&e.getAd().g.clickThroughUrl){var i=e.getAd().g.clickThroughUrl;t=i.substring(i.indexOf("adurl=")).replace("adurl=","")}}catch(e){n.Log.notice("Couldnt get adclick url")}this.fireClick(t)},adsEndedListener:function(e){this.plugin.getAdapter().adsEnded=!0,this.fireStop(),this.plugin.requestBuilder.lastSent.adPosition===n.Constants.AdPosition.Postroll&&this.plugin.fireStop()},firstQuartileListener:function(e){this.fireQuartile(1)},secondQuartileListener:function(e){this.fireQuartile(2)},thirdQuartileListener:function(e){this.fireQuartile(3)},unregisterListeners:function(){this.monitor&&this.monitor.stop(),this.player&&this.ima&&this.references&&this.playerReferences&&(Object.keys(this.references).forEach(function(e){this.ima.removeEventListener(e,this.references[e])}.bind(this)),Object.keys(this.playerReferences).forEach(function(e){this.player.off(e,this.playerReferences[e])}.bind(this))),delete this.references,delete this.playerReferences},adPlayerErrorListener:function(e){var t=e.data.AdError;[1012,1005,301,402,302].indexOf(t.getErrorCode())>=0?this.fireManifest(n.Constants.ManifestError.NO_RESPONSE,t.getMessage()):[1007,1009,303].indexOf(t.getErrorCode())>=0?this.fireManifest(n.Constants.ManifestError.EMPTY,t.getMessage()):[403,100,503,101,102].indexOf(t.getErrorCode())>=0?this.fireManifest(n.Constants.ManifestError.WRONG,t.getMessage()):this.fireError(t.getErrorCode(),t.getMessage())}},{isUsed:function(e){return"undefined"!=typeof google&&e.player.ima}});e.exports=r},function(e,t,i){var n=i(3),s=i(12),r=n.Adapter.extend({getVersion:function(){return s.version+"-videojs-onceux-ads"},getResource:function(){return this.player.ads.contentSrc},getPlayhead:function(){return this.player.onceux.currentTime()},getDuration:function(){return this.player.onceux.duration()},getPosition:function(){var e=n.Constants.AdPosition.Preroll;return this.plugin.getAdapter().flags.isJoined&&(e=this.plugin.getAdapter().getPlayhead()<=this.plugin.getAdapter().getDuration()?n.Constants.AdPosition.Midroll:n.Constants.AdPosition.Postroll),e},registerListeners:function(){n.Util.logAllEvents(this.player,[null,"onceux-ads-complete","onceux-adroll-start","onceux-adroll-complete","onceux-linearad-start","onceux-linearad-impression","onceux-linearad-complete","onceux-linearad-skipped","onceux-linearad-pause","onceux-linearad-resume","onceux-companionad-creativeView","adserror","ads-click"]),this.monitorPlayhead(!0,!1),this.references={"onceux-linearad-start":this.startedListener.bind(this),"onceux-linearad-pause":this.pausedListener.bind(this),"onceux-linearad-resume":this.resumedListener.bind(this),"onceux-linearad-complete":this.completeListener.bind(this),"onceux-linearad-skipped":this.skippedListener.bind(this),adserror:this.errorListener.bind(this),"ads-click":this.clickListener.bind(this)},Object.keys(this.references).forEach(function(e){this.player.on(e,this.references[e])}.bind(this))},unregisterListeners:function(){this.monitor&&this.monitor.stop(),this.player&&this.references&&(Object.keys(this.references).forEach(function(e){this.player.off(e,this.references[e])}.bind(this)),delete this.references)},startedListener:function(e){this.fireStart(),this.fireJoin()},pausedListener:function(e){this.firePause()},resumedListener:function(e){this.fireResume()},completeListener:function(e){this.fireStop({adPlayhead:this.getDuration()})},skippedListener:function(e){this.fireSkip()},errorListener:function(e){this.fireError()},clickListener:function(e){this.fireClick()}},{isUsed:function(e){return e.player.onceux}});e.exports=r},function(e,t,i){var n=i(3);e.exports={isUsed:function(e){return!!e.getTech().hls},getBitrate:function(e){var t=null,i=e.getTech().hls.playlists.media();if(e.player.qualityLevels){var n=e.player.qualityLevels(),s=n[n.selectedIndex];s&&(t=s.bitrate)}return!t&&i&&i.attributes&&(t=i.attributes.BANDWIDTH),t},getRendition:function(e){var t=null,i=e.getTech().hls.playlists.media();if(e.player.qualityLevels){var s=e.player.qualityLevels(),r=s[s.selectedIndex];r&&(t=n.Util.buildRenditionString(r.width,r.height,r.bitrate))}else if(i&&i.attributes){var a=i.attributes;a.RESOLUTION?t=n.Util.buildRenditionString(a.RESOLUTION.width,a.RESOLUTION.height,a.BANDWIDTH):a.BANDWIDTH?t=n.Util.buildRenditionString(a.BANDWIDTH):a.NAME&&(t=a.NAME)}return t},getTotalBytes:function(e){var t=e.getTech().hls,i=t.bytesReceived;return!i&&t.stats&&(i=t.stats.mediaBytesTransferred-e.acumBytes),i}}},function(e,t,i){var n=i(3);e.exports={isUsed:function(e){return!!e.getTech().hls_},getResource:function(e){var t=null;return e.getTech().hls_&&e.getTech().hls_.url?t=e.getTech().hls_.url:e.getTech().hls&&e.getTech().hls.source_&&(t=e.getTech().hls.source_.src),t},getBitrate:function(e){var t=null,i=e.getTech().hls_.currentLevel;if(void 0!==i&&-1!==i&&e.getTech().hls_.levels){var n=e.getTech().hls_.levels[i];n&&n.bitrate&&(t=n.bitrate)}return t},getRendition:function(e){var t=null,i=e.getTech().hls_.currentLevel;if(void 0!==i&&-1!==i&&e.getTech().hls_.levels){var s=e.getTech().hls_.levels[i];s&&(t=n.Util.buildRenditionString(s.width,s.height,s.bitrate))}return t}}},function(e,t,i){var n=i(3);e.exports={isUsed:function(e){return!!e.getTech().shakaPlayer},getResource:function(e){return e.getTech().shakaPlayer.getManifestUri()},getBitrate:function(e){return e.getTech().shakaPlayer.getStats().streamBandwidth},getRendition:function(e){var t=e.getTech().shakaPlayer,i=t.getStats(),s=n.Util.buildRenditionString(i.width,i.height,i.streamBandwidth),r=t.getVariantTracks();for(var a in r){var o=r[a];if(o.active&&"video"===o.type){s=n.Util.buildRenditionString(o.width,o.height,o.bandwidth);break}}return s}}},function(e,t,i){var n=i(3);e.exports={isUsed:function(e){return e.player.dash&&e.player.dash.shakaPlayer},getResource:function(e){return e.player.dash.shakaPlayer.getManifestUri()},getBitrate:function(e){return e.player.dash.shakaPlayer.getStats().streamBandwidth},getRendition:function(e){var t=e.player.dash.shakaPlayer,i=t.getStats(),s=n.Util.buildRenditionString(i.width,i.height,i.streamBandwidth),r=t.getVariantTracks();for(var a in r){var o=r[a];o.active&&"video"===o.type&&(s=n.Util.buildRenditionString(o.width,o.height,o.bandwidth))}return s}}},function(e,t){e.exports=function(e){"undefined"!=typeof videojs&&(videojs.registerPlugin||videojs.plugin)("youbora",(function(t){void 0===this.youboraplugin?this.youboraplugin=new e.Plugin(t,new e.adapters.Videojs(this)):this.youboraplugin.setOptions(t),t&&(t.fatalErrors||t.nonFatalErrors||t.ignoreErrors)&&this.youboraplugin.getAdapter().errorModifyer(t.fatalErrors,t.nonFatalErrors,t.ignoreErrors)}))}}])}));
//# sourceMappingURL=sp.min.js.map/*File: closed-captions.min.js*/!function(e){var t={};function n(Q){if(t[Q])return t[Q].exports;var F=t[Q]={i:Q,l:!1,exports:{}};return e[Q].call(F.exports,F,F.exports,n),F.l=!0,F.exports}n.m=e,n.c=t,n.d=function(e,t,Q){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:Q})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var Q=Object.create(null);if(n.r(Q),Object.defineProperty(Q,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var F in e)n.d(Q,F,function(t){return e[t]}.bind(null,F));return Q},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){e.exports=n(1)},function(module,__webpack_exports__,__webpack_require__){"use strict";eval('// ESM COMPAT FLAG\n__webpack_require__.r(__webpack_exports__);\n\n// CONCATENATED MODULE: ./src/helpers/isIOS.ts\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\nfunction isNewIOS() {\n  var _navigator = navigator,\n    userAgent = _navigator.userAgent;\n  var iphoneAgentMatches = userAgent.match(\'iPhone OS .._?.?\');\n  if (iphoneAgentMatches && iphoneAgentMatches[0]) {\n    var iOSVersion = iphoneAgentMatches[0].trim().split(\' \').pop();\n    if (iOSVersion) {\n      var _iOSVersion$split$map = iOSVersion.split(\'_\').map(function (stringNum) {\n          return Number(stringNum);\n        }),\n        _iOSVersion$split$map2 = _slicedToArray(_iOSVersion$split$map, 2),\n        majorVersion = _iOSVersion$split$map2[0],\n        minorVersion = _iOSVersion$split$map2[1];\n      if (majorVersion < 17) {\n        return false;\n      }\n      if (majorVersion === 17 && (minorVersion === 0 || minorVersion === undefined)) {\n        return false;\n      }\n      if (majorVersion === 17 && minorVersion > 0) {\n        return true;\n      }\n      if (majorVersion > 17) {\n        return true;\n      }\n    }\n  }\n  return false;\n}\nfunction isIOS() {\n  // in the new \'iPad OS\' the UA mirrors the desktop, so we have to check for Mac and then if\n  // we\'re using a touch screen. This is work until Apple comes out with a touch screen laptop :|\n  var _navigator2 = navigator,\n    userAgent = _navigator2.userAgent;\n  // const isIpad =\n  //   userAgent.indexOf(\'iPad\') !== -1 ||\n  //   (userAgent.indexOf(\'Macintosh\') !== -1 && \'ontouchend\' in document);\n\n  var isIphone = userAgent.indexOf(\'iPhone\') !== -1 || userAgent.indexOf(\'iPod\') !== -1;\n\n  // const isIos = isIphone || isIpad;\n\n  // iPad now handles captions like a desktop browser\n  return isIphone;\n}\n/* harmony default export */ var helpers_isIOS = (isIOS);\n// CONCATENATED MODULE: ./src/helpers/getCaptionOptions.ts\nfunction _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }\n\nfunction getCaptionOptions(options) {\n  var _options$playerOption, _options$playerOption2, _options$playerOption3;\n  var defaultOptions = {};\n  var captionOptions = (options === null || options === void 0 ? void 0 : (_options$playerOption = options.playerOptions) === null || _options$playerOption === void 0 ? void 0 : (_options$playerOption2 = _options$playerOption.plugins) === null || _options$playerOption2 === void 0 ? void 0 : (_options$playerOption3 = _options$playerOption2.sardius) === null || _options$playerOption3 === void 0 ? void 0 : _options$playerOption3.captionOptions) || defaultOptions;\n  if (helpers_isIOS()) {\n    captionOptions = _objectSpread(_objectSpread({}, captionOptions), captionOptions.iOS || defaultOptions);\n  }\n  return captionOptions;\n}\n/* harmony default export */ var helpers_getCaptionOptions = (getCaptionOptions);\n// CONCATENATED MODULE: ./src/helpers/overrideTrackSettings.ts\n\n\n// TODO: Figure out types on this file\n\nfunction overrideTrackSettings(allTracks, options) {\n  var captionOptions = helpers_getCaptionOptions(options);\n  Array.from(allTracks).forEach(function (track) {\n    if (track.cues) {\n      var cues = Array.from(track.cues);\n      cues.forEach(function (cue) {\n        if (captionOptions) {\n          [\'align\', \'line\', \'position\', \'size\', \'snapToLines\'].forEach(function (key) {\n            var useKey = key;\n            if (captionOptions[useKey] !== undefined) {\n              // @ts-ignore\n              cue[key] = captionOptions[useKey];\n            }\n          });\n        }\n      });\n    }\n  });\n  return allTracks;\n}\n/* harmony default export */ var helpers_overrideTrackSettings = (overrideTrackSettings);\n// CONCATENATED MODULE: ./src/eventHandlers/progressOverrideCaptionSettings.ts\n\nfunction progressOverrideCaptionSettings(_ref) {\n  var player = _ref.player,\n    options = _ref.options;\n  player.on(\'progress\', function () {\n    var videos = player.el().getElementsByTagName(\'video\');\n    if (videos && videos[0]) {\n      var allTracks = videos[0].textTracks;\n      helpers_overrideTrackSettings(Array.from(allTracks), options);\n    }\n  });\n}\n/* harmony default export */ var eventHandlers_progressOverrideCaptionSettings = (progressOverrideCaptionSettings);\n// CONCATENATED MODULE: ./src/helpers/getMenuLabel.ts\n// use player specific labels if available\nfunction getMenuLabel(_ref) {\n  var _sourceHandler$option;\n  var label = _ref.label,\n    sourceHandler = _ref.sourceHandler;\n  var defaultLabel = label;\n\n  // if the label we have is either empty or is an undefined value, set the label to \'captions\'\n  // this default label can be overridden via player controls\n  if (defaultLabel === \'\' || typeof defaultLabel === \'undefined\') {\n    defaultLabel = \'captions\';\n  }\n\n  // get our player\'s labels\n  var menuLabels = sourceHandler === null || sourceHandler === void 0 ? void 0 : (_sourceHandler$option = sourceHandler.options) === null || _sourceHandler$option === void 0 ? void 0 : _sourceHandler$option.labels;\n  var cleanLabel = defaultLabel.toLowerCase().replace(/[^a-z0-9]+/gi, \'\');\n\n  // swap labels if we have one from the player settings\n  if (typeof (menuLabels === null || menuLabels === void 0 ? void 0 : menuLabels[cleanLabel]) !== \'undefined\') {\n    defaultLabel = menuLabels[cleanLabel];\n  }\n  if (cleanLabel === \'id3\') {\n    defaultLabel = \'\';\n  }\n  return defaultLabel;\n}\n/* harmony default export */ var helpers_getMenuLabel = (getMenuLabel);\n// CONCATENATED MODULE: ./src/helpers/isFirefox.ts\nfunction isFirefox() {\n  var _navigator = navigator,\n    userAgent = _navigator.userAgent;\n  var isFirefox = userAgent.toLowerCase().indexOf(\'firefox\') !== -1;\n  return isFirefox;\n}\n/* harmony default export */ var helpers_isFirefox = (isFirefox);\n// CONCATENATED MODULE: ./src/helpers/setCaptions.ts\nfunction setCaptions_typeof(obj) { "@babel/helpers - typeof"; return setCaptions_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, setCaptions_typeof(obj); }\nfunction _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == setCaptions_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a \'" + methodName + "\' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }\n\n\n\n\n// function to setup vtt text tracks delivered with an asset from the OVP\nfunction setCaptions(_x) {\n  return _setCaptions.apply(this, arguments);\n}\nfunction _setCaptions() {\n  _setCaptions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {\n    var player, sourceHandler, captions, options, items, _loop, i;\n    return _regeneratorRuntime().wrap(function _callee$(_context2) {\n      while (1) {\n        switch (_context2.prev = _context2.next) {\n          case 0:\n            player = _ref.player, sourceHandler = _ref.sourceHandler, captions = _ref.captions, options = _ref.options, items = _ref.items;\n            if (!sourceHandler.captions) {\n              _context2.next = 9;\n              break;\n            }\n            _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop(i) {\n              var _remoteCaptionTrack$l, _remoteCaptionTrack$l2;\n              var remoteCaptionTrack, remoteTrack;\n              return _regeneratorRuntime().wrap(function _loop$(_context) {\n                while (1) {\n                  switch (_context.prev = _context.next) {\n                    case 0:\n                      remoteCaptionTrack = sourceHandler.captions[i]; // set up a remote text track to add to this player\n                      remoteTrack = {\n                        kind: \'captions\',\n                        label: helpers_getMenuLabel({\n                          label: remoteCaptionTrack.label,\n                          sourceHandler: sourceHandler\n                        }),\n                        srclang: (_remoteCaptionTrack$l = remoteCaptionTrack.label) === null || _remoteCaptionTrack$l === void 0 ? void 0 : (_remoteCaptionTrack$l2 = _remoteCaptionTrack$l.toLowerCase) === null || _remoteCaptionTrack$l2 === void 0 ? void 0 : _remoteCaptionTrack$l2.call(_remoteCaptionTrack$l),\n                        src: remoteCaptionTrack.file\n                      }; // add to player\n                      player.addRemoteTextTrack(remoteTrack, true);\n\n                      // record the id for use in track switching\n                      remoteCaptionTrack.id = i;\n                      items.push({\n                        classes: \'sp-menu-item\',\n                        label: helpers_getMenuLabel({\n                          label: remoteCaptionTrack.label,\n                          sourceHandler: sourceHandler\n                        }),\n                        selectable: true,\n                        isActive: false,\n                        id: "".concat(i),\n                        data: remoteCaptionTrack,\n                        // Working sidecar captions\n                        callback: function callback(data, button) {\n                          var _sourceHandler$plugin2;\n                          var iOS = helpers_isIOS();\n                          var isSelected_ = button.isSelected_;\n                          /*\n                            For remote text tracks we need to manage both the text tracks as a \'whole\' and each\n                            individual text track. So when we turn on/off a track we have to turn on/off text\n                            tracks and then turn on/off that specific track. This is managed through the attr.\n                            \'mode\' which can have these values: showing, disabled, hidden. For our use case we\n                            just show and disable.\n                          */\n                          var videoElement = player.el().querySelector(\'video\');\n                          if (videoElement) {\n                            var tracks = videoElement.querySelectorAll(\'track\');\n                            if (tracks) {\n                              Array.from(tracks).forEach(function (track) {\n                                if (helpers_isFirefox()) {\n                                  // Firefox requires disabling the track before removing, otherwise it will continue rendering the final frame\n                                  var textTrack = track.track;\n                                  if (textTrack) {\n                                    textTrack.mode = \'disabled\';\n                                  }\n                                }\n                                track.remove();\n                              });\n                            }\n                          }\n\n                          // if the button is selected, the user is turning off the captions/subs\n                          if (isSelected_) {\n                            var _sourceHandler$plugin;\n                            if (iOS) {\n                              data.mode = \'hidden\';\n                              player.textTracks().mode = \'hidden\';\n                              var idIndex = Number(button.options_.id);\n                              if (idIndex) {\n                                try {\n                                  player.textTracks()[idIndex].mode = \'hidden\';\n                                } catch (e) {\n                                  /*  */\n                                }\n                              }\n                            }\n                            captions.setActiveItem(undefined);\n                            player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n                            (_sourceHandler$plugin = sourceHandler.plugin) === null || _sourceHandler$plugin === void 0 ? void 0 : _sourceHandler$plugin.streamHandler.setCurrentTextTrack(-1, \'\');\n                            return;\n                          }\n                          if (videoElement) {\n                            var newTrack = document.createElement(\'track\');\n                            newTrack.src = data.url;\n                            newTrack.label = data.label;\n                            newTrack.kind = \'captions\';\n                            newTrack.srclang = \'en\';\n                            newTrack["default"] = true;\n                            if (helpers_isFirefox()) {\n                              // Explicitly set the mode to \'showing\' for Firefox to be happy\n                              if (newTrack.track) {\n                                newTrack.track.mode = \'showing\';\n                              }\n                            }\n                            videoElement.append(newTrack);\n                            setTimeout(function () {\n                              helpers_overrideTrackSettings([newTrack.track], options);\n                            }, 100);\n                          }\n                          if (iOS) {\n                            // since we\'re turning on this track, we need to make sure showing tracks are\n                            // disabled\n                            for (var t = 0; t < player.textTracks().length; t += 1) {\n                              if (player.textTracks()[t].mode === \'showing\') {\n                                try {\n                                  player.textTracks()[t].mode = \'hidden\';\n                                } catch (e) {\n                                  /*  */\n                                }\n                              }\n                            }\n\n                            // turn on tracks\n                            player.textTracks().mode = \'showing\';\n                            // turn on this track\n                            var _idIndex = Number(button.options_.id);\n                            if (_idIndex) {\n                              try {\n                                player.textTracks()[_idIndex].mode = \'showing\';\n                              } catch (e) {\n                                /*  */\n                              }\n                            }\n                            data.mode = \'showing\';\n                          }\n\n                          // set button to active\n                          captions.setActiveItem(button);\n                          player.trigger(\'SP_CAPTIONS_SUBS_ON\');\n                          (_sourceHandler$plugin2 = sourceHandler.plugin) === null || _sourceHandler$plugin2 === void 0 ? void 0 : _sourceHandler$plugin2.streamHandler.setCurrentTextTrack(i, data.label);\n                        }\n                      });\n                      _context.next = 7;\n                      return new Promise(function (f) {\n                        setTimeout(function () {\n                          captions.addItems(items, true);\n                          f(\'\');\n                        }, 100);\n                      });\n                    case 7:\n                    case "end":\n                      return _context.stop();\n                  }\n                }\n              }, _loop);\n            });\n            i = 0;\n          case 4:\n            if (!(i < sourceHandler.captions.length)) {\n              _context2.next = 9;\n              break;\n            }\n            return _context2.delegateYield(_loop(i), "t0", 6);\n          case 6:\n            i += 1;\n            _context2.next = 4;\n            break;\n          case 9:\n          case "end":\n            return _context2.stop();\n        }\n      }\n    }, _callee);\n  }));\n  return _setCaptions.apply(this, arguments);\n}\n/* harmony default export */ var helpers_setCaptions = (setCaptions);\n// CONCATENATED MODULE: ./src/helpers/getValueFromKey.ts\nfunction getValueFromKey_typeof(obj) { "@babel/helpers - typeof"; return getValueFromKey_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, getValueFromKey_typeof(obj); }\n/* Using type any to be able to check any object for any value */\n\nfunction getValueFromKey(object, keyName) {\n  var returnValue = undefined;\n  if (typeof object === \'undefined\') {\n    return returnValue;\n  }\n  if (getValueFromKey_typeof(object) === \'object\' && object[keyName]) {\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n    returnValue = object[keyName];\n  } else if (object.data && object.data[keyName]) {\n    // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n    returnValue = object.data[keyName];\n  }\n  return returnValue;\n}\n/* harmony default export */ var helpers_getValueFromKey = (getValueFromKey);\n// CONCATENATED MODULE: ./src/eventHandlers/SP_SUB_TRACK_UPDATED_LIST.ts\n\n\n\nfunction SP_SUB_TRACK_UPDATED_LIST(_ref) {\n  var player = _ref.player,\n    sourceHandler = _ref.sourceHandler,\n    captions = _ref.captions,\n    items = _ref.items;\n  /* \n    if a manifest has tracks in it, we can get those tracks when\n    the \'SP_TEXT_TRACK_UPDATED_LIST\' event fires\n    this event only fires if there are manifest tracks present and\n    will not fire for captions or if there are no tracks\n  */\n  player.on(\'SP_SUB_TRACK_UPDATED_LIST\', function (event, trackList) {\n    var subTracks = trackList.subtitleTracks;\n    var _loop = function _loop(i) {\n      var _subTracks$i, _subTracks$i2, _subTracks$i3;\n      var active = ((_subTracks$i = subTracks[i]) === null || _subTracks$i === void 0 ? void 0 : _subTracks$i["default"]) === true || ((_subTracks$i2 = subTracks[i]) === null || _subTracks$i2 === void 0 ? void 0 : _subTracks$i2.forced) === true || ((_subTracks$i3 = subTracks[i]) === null || _subTracks$i3 === void 0 ? void 0 : _subTracks$i3.autoselect) === true;\n      if (active) {\n        sourceHandler.plugin.streamHandler.setTextTrackDisplay(true);\n        sourceHandler.plugin.streamHandler.setCurrentTextTrack(i, subTracks[i].language);\n      }\n      items.push({\n        classes: \'sp-menu-item\',\n        label: helpers_getMenuLabel({\n          label: helpers_getValueFromKey(subTracks[i], \'label\') || helpers_getValueFromKey(subTracks[i], \'name\'),\n          sourceHandler: sourceHandler\n        }),\n        id: "subs_".concat(i),\n        order: subTracks.length - i,\n        isActive: active,\n        selectable: true,\n        data: subTracks[i],\n        // Working inline captions\n        callback: function callback(data, button) {\n          var isSelected_ = button.isSelected_;\n          // if user is turning the track off, set tracks to -1 and turn the display off\n          sourceHandler.plugin.streamHandler.setCurrentTextTrack(-1, \'\');\n          captions.setActiveItem(undefined);\n          sourceHandler.plugin.streamHandler.setTextTrackDisplay(false);\n          player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n\n          // make sure any other showing tracks are turned off\n          for (var t = 0; t < items.length; t += 1) {\n            var _items$t$data;\n            if (((_items$t$data = items[t].data) === null || _items$t$data === void 0 ? void 0 : _items$t$data.mode) !== \'disabled\') {\n              if (!items[t].data) {\n                items[t].data = {};\n              }\n              items[t].data.mode = \'disabled\';\n            }\n          }\n          if (!isSelected_) {\n            // turn on the display\n            sourceHandler.plugin.streamHandler.setTextTrackDisplay(true);\n            // turn on selected track\n            sourceHandler.plugin.streamHandler.setCurrentTextTrackDelayed(i, data.language);\n            // set button active\n            captions.setActiveItem(button);\n            if (helpers_isFirefox()) {\n              // Set mode to \'showing\' for Firefox\n              data.mode = \'showing\';\n            }\n            player.trigger(\'hlsSubtitleTrackUpdated\', data);\n            player.trigger(\'SP_CAPTIONS_SUBS_ON\');\n          }\n        }\n      });\n    };\n    for (var i = 0; i < ((subTracks === null || subTracks === void 0 ? void 0 : subTracks.length) || 0); i += 1) {\n      _loop(i);\n    }\n    captions.addItems(items);\n  });\n}\n/* harmony default export */ var eventHandlers_SP_SUB_TRACK_UPDATED_LIST = (SP_SUB_TRACK_UPDATED_LIST);\n// CONCATENATED MODULE: ./src/eventHandlers/SP_FRAGMENT_AFTER_CHANGE.ts\n\n\n\nfunction SP_FRAGMENT_AFTER_CHANGE(_ref) {\n  var player = _ref.player,\n    sourceHandler = _ref.sourceHandler,\n    captions = _ref.captions,\n    items = _ref.items;\n  /*\n    For in-band captions, we\'ll need to check for tracks as the player loads in fragments\n    if a fragment has captions, that text track will be added to the player. We check\n    the player for tracks with each new fragment.\n  */\n  player.on(\'SP_FRAGMENT_AFTER_CHANGE\', function () {\n    // get the text tracks list which will be added by hls.js to\n    // the videos text tracks after they are detected when a frag is decoded\n    var allTracks = player.el().getElementsByTagName(\'video\')[0].textTracks;\n\n    // here we are going to filter all the tracks that are available to get only\n    // the in-band captions tracks\n    var captionTracks = Array.from(allTracks).filter(function (track) {\n      return helpers_getValueFromKey(track, \'kind\') === \'captions\';\n    });\n\n    // go through the items we currently have and see if there are any captions items added\n    var captionsInMenu = items.filter(function (track) {\n      if (helpers_getValueFromKey(track, \'kind\') === \'captions\') {\n        return true;\n      }\n      return false;\n    });\n\n    /*\n      Mozilla defines a unique track as the combination of label, language, and kind\n      https://developer.mozilla.org/en-US/docs/Web/HTML/Element/track\n      here we are always dealing with kind of captions (as filtered for above)\n      so we\'re going to check to see if we already have a track by matching\n      label and language. We\'re doing this be looping through the captions tracks\n      added to the video and then checking against the captions that we have added to\n      the menu already.\n    */\n\n    var newCaptionsTracks = [];\n    /* Inline overrides */\n    captionTracks.forEach(function (track) {\n      if (captionsInMenu.length > 0) {\n        var captionAdded = false;\n        for (var c = 0; c < captionsInMenu.length; c += 1) {\n          if (captionsInMenu[c] && captionsInMenu[c].data && helpers_getValueFromKey(captionsInMenu[c], \'label\') === helpers_getValueFromKey(track, \'label\') && helpers_getValueFromKey(captionsInMenu[c], \'language\') === helpers_getValueFromKey(track, \'language\')) {\n            captionAdded = true;\n          }\n        }\n        if (!captionAdded) {\n          newCaptionsTracks.push(track);\n        }\n      } else {\n        newCaptionsTracks.push(track);\n      }\n    });\n\n    /*\n      Make sure we have the the closed captions icon on the DOM\n      This code to check for and handle the visibility of the CC\n      button is to handle some edge case or client case that I (Dan) don\'t really\n      remember. I\'m going to leave in place during updates 06/2022.\n    */\n    if (player.controlBar && player.controlBar[\'closedCaptions\'] && player.controlBar[\'closedCaptions\'].el_) {\n      // get the cc plugin el\n      var closedCaptionsElement = player.controlBar[\'closedCaptions\'].el_;\n\n      // check for the vjs-hidden class to see if the element is showing or not\n      var isElementHidden = closedCaptionsElement.classList.contains(\'vjs-hidden\');\n\n      // if the menu is showing and we don\'t have any tracks, then hide it\n      if (captions.items && captions.items.length === 0 && isElementHidden === false) {\n        closedCaptionsElement.classList.add(\'vjs-hidden\');\n      }\n\n      // if we\'ve found some new captions tracks, then add them\n      if (newCaptionsTracks.length !== 0) {\n        var _loop = function _loop(i) {\n          var sortOrder = newCaptionsTracks.length - i;\n\n          // Always show english captions first\n          if (helpers_getValueFromKey(newCaptionsTracks[i], \'language\') === \'en\') {\n            sortOrder = items.length + 1;\n          }\n          items.push({\n            classes: \'sp-menu-item\',\n            label: helpers_getMenuLabel({\n              label: helpers_getValueFromKey(newCaptionsTracks[i], \'name\') || helpers_getValueFromKey(newCaptionsTracks[i], \'label\'),\n              sourceHandler: sourceHandler\n            }),\n            id: "captions_".concat(i),\n            order: sortOrder,\n            isActive: false,\n            selectable: true,\n            data: newCaptionsTracks[i],\n            // Working, add captions found during playback\n            callback: function callback(data, button) {\n              var isSelected_ = button.isSelected_;\n              // If a user is turning off a caption, set it to disabled\n              if (isSelected_) {\n                newCaptionsTracks[i].mode = \'disabled\';\n                captions.setActiveItem(undefined);\n                player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n                sourceHandler.plugin.streamHandler.setCurrentTextTrack(-1, \'\');\n                return;\n              }\n\n              // Make sure any other showing tracks are turned off\n              for (var t = 0; t < items.length; t += 1) {\n                var _items$t$data;\n                if (typeof ((_items$t$data = items[t].data) === null || _items$t$data === void 0 ? void 0 : _items$t$data.mode) !== \'undefined\') {\n                  items[t].data.mode = \'disabled\';\n                }\n              }\n\n              // Turn on this caption\n              newCaptionsTracks[i].mode = \'showing\';\n              // Turn on the text track display and subs track\n              sourceHandler.plugin.streamHandler.setCurrentTextTrack(i, data.language);\n              sourceHandler.plugin.streamHandler.setTextTrackDisplay(true);\n              // Set button as active\n              captions.setActiveItem(button);\n              if (helpers_isFirefox()) {\n                // Set mode to \'showing\' for Firefox\n                data.mode = \'showing\';\n              }\n              player.trigger(\'hlsCaptionsUpdated\', data);\n              player.trigger(\'SP_CAPTIONS_SUBS_ON\');\n            }\n          });\n        };\n        for (var i = 0; i < newCaptionsTracks.length; i += 1) {\n          _loop(i);\n        }\n        captions.addItems(items);\n      }\n      // TODO: Decide if Closed Captions Button Should display/remove dynamically\n      // else if (tracks.length === 0 && isElementHidden === false) {\n      //   closedCaptionsElement.classList.add(\'vjs-hidden\');\n      // }\n    } else {\n      throw new Error(\'SP_ERROR: The Closed Captions Plugin Element Was Not Found\');\n    }\n  });\n}\n/* harmony default export */ var eventHandlers_SP_FRAGMENT_AFTER_CHANGE = (SP_FRAGMENT_AFTER_CHANGE);\n// CONCATENATED MODULE: ./src/eventHandlers/SP_LIB_READY.ts\n\n\n// Function to setup captions/subs that are delivered either as tracks in a master manifest\n// or delivered in-band via CEA 608/708 captions standard\nfunction SP_LIB_READY(_ref) {\n  var player = _ref.player,\n    sourceHandler = _ref.sourceHandler,\n    captions = _ref.captions,\n    items = _ref.items;\n  // For everything else, we can use hls.js to get the tracks for us\n  // Wait for the streaming library to be ready\n  player.on(\'SP_LIB_READY\', function () {\n    // We\'re only supporting captions for HLS assets currently\n    if (sourceHandler.plugin.streamHandler.lib.hls) {\n      // Turn on the text track display, we do this so that we can start with all tracks off\n      sourceHandler.plugin.streamHandler.setTextTrackDisplay(true);\n\n      // Turn off all tracks\n      sourceHandler.plugin.streamHandler.setCurrentTextTrack(-1, \'\');\n\n      // Turn the display back off\n      sourceHandler.plugin.streamHandler.setTextTrackDisplay(false);\n\n      // Inline/embedded captions found at the start\n      eventHandlers_SP_SUB_TRACK_UPDATED_LIST({\n        player: player,\n        sourceHandler: sourceHandler,\n        captions: captions,\n        items: items\n      });\n      // Inline/embedded captions found during playback\n      eventHandlers_SP_FRAGMENT_AFTER_CHANGE({\n        player: player,\n        sourceHandler: sourceHandler,\n        captions: captions,\n        items: items\n      });\n    }\n  });\n}\n/* harmony default export */ var eventHandlers_SP_LIB_READY = (SP_LIB_READY);\n// CONCATENATED MODULE: ./src/eventHandlers/iOSSetup.ts\nfunction iOSSetup_typeof(obj) { "@babel/helpers - typeof"; return iOSSetup_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, iOSSetup_typeof(obj); }\nfunction iOSSetup_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction iOSSetup_objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? iOSSetup_ownKeys(Object(source), !0).forEach(function (key) { iOSSetup_defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : iOSSetup_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction iOSSetup_defineProperty(obj, key, value) { key = iOSSetup_toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction iOSSetup_toPropertyKey(arg) { var key = iOSSetup_toPrimitive(arg, "string"); return iOSSetup_typeof(key) === "symbol" ? key : String(key); }\nfunction iOSSetup_toPrimitive(input, hint) { if (iOSSetup_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (iOSSetup_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }\n\nfunction iOSSetup(_ref) {\n  var player = _ref.player,\n    sourceHandler = _ref.sourceHandler,\n    captions = _ref.captions,\n    items = _ref.items;\n  player.on(\'sp-ios-fullscreenchange\', function () {\n    var textTracks = player.textTracks();\n    if (textTracks.length > 0) {\n      var _captions$items;\n      var activeIndex = -1;\n      for (var i = 0; i < textTracks.length; i += 1) {\n        if (textTracks[i].mode === \'showing\') {\n          activeIndex = i;\n        }\n      }\n      if (activeIndex === -1) {\n        captions.setActiveItem(undefined);\n      }\n      var button = (_captions$items = captions.items) === null || _captions$items === void 0 ? void 0 : _captions$items[activeIndex];\n      captions.setActiveItem(button);\n    }\n  });\n  player.one(\'loadedmetadata\', function () {\n    captions.setActiveItem(undefined);\n    player.textTracks().mode = \'hidden\';\n    Array.from(player.textTracks()).forEach(function (track) {\n      track.mode = \'hidden\';\n    });\n    player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n  });\n  player.on(\'IOS_CAPTIONS_SYNC\', function () {\n    setTimeout(function () {\n      var textTracks = Array.from(player.textTracks());\n      items.reverse().filter(function (item, index, self) {\n        return index === self.findIndex(function (a) {\n          return a.label === item.label;\n        });\n      }).forEach(function (item) {\n        if (item.isActive === false) {\n          if (item.data) {\n            item.data.mode = \'hidden\';\n          }\n          textTracks.forEach(function (textTrack) {\n            if (item.label === textTrack.label) {\n              textTrack.mode = \'hidden\';\n            }\n          });\n        } else {\n          if (item.data) {\n            item.data.mode = \'showing\';\n          }\n          textTracks.forEach(function (textTrack) {\n            if (item.label === textTrack.label) {\n              textTrack.mode = \'showing\';\n            }\n          });\n        }\n      });\n    }, 5);\n  });\n\n  // Run once to disable captions on startup\n  player.one(\'progress\', function () {\n    captions.setActiveItem(undefined);\n    player.textTracks().mode = \'hidden\';\n    Array.from(player.textTracks()).forEach(function (track) {\n      track.mode = \'hidden\';\n    });\n    player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n\n    // Run again to make sure any delayed actions don\'t start them up again when we don\'t want them to\n    player.one(\'progress\', function () {\n      captions.setActiveItem(undefined);\n      player.textTracks().mode = \'hidden\';\n      Array.from(player.textTracks()).forEach(function (track) {\n        track.mode = \'hidden\';\n      });\n      player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n      player.on(\'progress\', function () {\n        // get the tracks that have been added to the player via native player\n        var textTracks = Array.from(player.textTracks());\n\n        // if we have tracks, add them to the menu group\n        if (textTracks.length > 0) {\n          for (var i = 0; i < textTracks.length; i += 1) {\n            // tracks start out \'disabled\' by default, in order to read what\'s in the track\n            // it must be turned on. \'hidden\' turns the track \'on\' but doesn\'t show it\n            if (textTracks[i].mode === \'disabled\') {\n              textTracks[i].mode = \'hidden\';\n            }\n            var active = player.textTracks()[i].mode === \'showing\';\n            // there are several tracks \'kinds\',\n            // we\'re only going to add caption and subtitle tracks\n            // check to see if the track has any active cues, if it does then add\n            items.push({\n              classes: \'sp-menu-item\',\n              label: helpers_getMenuLabel({\n                label: textTracks[i].label || textTracks[i].name || textTracks[i].language,\n                sourceHandler: sourceHandler\n              }),\n              id: "".concat(i),\n              order: textTracks.length - i,\n              isActive: active,\n              selectable: true,\n              data: iOSSetup_objectSpread(iOSSetup_objectSpread({}, textTracks[i]), {}, {\n                id: "".concat(i)\n              }),\n              callback: function callback(data, button) {\n                var isSelected_ = button.isSelected_;\n                /*\n                  For remote text tracks we need to manage both the text tracks as a \'whole\' and\n                  each individual text track. So when we turn on/off a track we have to turn\n                  on/off text tracks and then turn on/off that specific track. This is managed\n                  through the parameter \'mode\' which can have these values: \n                  showing, disabled, hidden.\n                  For our use case we just show and hidden.\n                */\n\n                // since we\'re turning on this track, we need to make sure showing tracks are disabled\n                captions.setActiveItem(undefined);\n                Array.from(player.textTracks()).forEach(function (_, index) {\n                  player.textTracks()[index].mode = \'hidden\';\n                });\n\n                // if the button is selected, the user is turning off the captions/subs\n                if (isSelected_) {\n                  data.mode = \'hidden\';\n                  player.textTracks().mode = \'hidden\';\n                  player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n                  Array.from(player.textTracks()).forEach(function (track) {\n                    track.mode = \'hidden\';\n                  });\n                  try {\n                    // @ts-ignore\n                    if (player.youbora) {\n                      // @ts-ignore\n                      // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n                      player.youbora({\n                        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n                        \'content.customDimension.1\': \'off\',\n                        // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n                        \'content.subtitles\': \'off\'\n                      });\n                    }\n                  } catch (e) {\n                    /*  */\n                  }\n                  player.trigger(\'IOS_CAPTIONS_SYNC\');\n                  return;\n                }\n\n                // set button to active\n                captions.setActiveItem(button);\n\n                // turn on tracks\n                player.textTracks().mode = \'showing\';\n\n                // turn on this track\n                var idIndex = Number(button.options_.id);\n                if (idIndex !== undefined) {\n                  player.textTracks()[idIndex].mode = \'showing\';\n                }\n                data.mode = \'showing\';\n                try {\n                  // @ts-ignore\n                  if (player.youbora) {\n                    // @ts-ignore\n                    // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n                    player.youbora({\n                      // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n                      \'content.customDimension.1\': player.textTracks()[idIndex].language || player.textTracks()[idIndex].label,\n                      // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n                      \'content.subtitles\': player.textTracks()[idIndex].language || player.textTracks()[idIndex].label\n                    });\n                  }\n                } catch (e) {\n                  /*  */\n                }\n              }\n            });\n          }\n          items = items.filter(function (item, index, self) {\n            return index === self.findIndex(function (a) {\n              return a.label === item.label;\n            });\n          });\n          captions.addItems(items, true);\n        }\n      });\n    });\n  });\n  player.one(\'play\', function () {\n    captions.setActiveItem(undefined);\n    player.textTracks().mode = \'hidden\';\n    Array.from(player.textTracks()).forEach(function (track) {\n      track.mode = \'hidden\';\n    });\n    player.trigger(\'SP_CAPTIONS_SUBS_OFF\');\n  });\n}\n/* harmony default export */ var eventHandlers_iOSSetup = (iOSSetup);\n// CONCATENATED MODULE: ./src/eventHandlers/initialize.ts\nfunction initialize_typeof(obj) { "@babel/helpers - typeof"; return initialize_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, initialize_typeof(obj); }\nfunction initialize_regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ initialize_regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == initialize_typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a \'" + methodName + "\' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction initialize_asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction initialize_asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { initialize_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { initialize_asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }\n\n\n\n\nfunction initialize(_ref) {\n  var player = _ref.player,\n    menu = _ref.menu,\n    captions = _ref.captions,\n    options = _ref.options;\n  player.on(\'settingsMenu-SourceHandler-change\', /*#__PURE__*/function () {\n    var _ref2 = initialize_asyncToGenerator( /*#__PURE__*/initialize_regeneratorRuntime().mark(function _callee(event, sourceHandler) {\n      var _menuElement$style;\n      var menuElement, display, items;\n      return initialize_regeneratorRuntime().wrap(function _callee$(_context) {\n        while (1) {\n          switch (_context.prev = _context.next) {\n            case 0:\n              // eslint-disable-next-line no-console\n              console.debug(\'[CAPTIONS]: Captions loading...\');\n\n              // Set active item to undefined when changing multi-language captions\n              captions.setActiveItem(undefined);\n              menuElement = menu.el();\n              display = menuElement === null || menuElement === void 0 ? void 0 : (_menuElement$style = menuElement.style) === null || _menuElement$style === void 0 ? void 0 : _menuElement$style.display;\n              try {\n                menuElement.style.display = \'none\';\n              } catch (e) {\n                /*  */\n              }\n              items = []; // Set up sidecar captions\n              _context.next = 8;\n              return helpers_setCaptions({\n                player: player,\n                sourceHandler: sourceHandler,\n                captions: captions,\n                items: items,\n                options: options\n              });\n            case 8:\n              try {\n                menuElement.style.display = display || \'block\';\n              } catch (e) {\n                /*  */\n              }\n\n              // eslint-disable-next-line no-console\n              console.debug(\'[CAPTIONS]: Captions loaded.\');\n              if (helpers_isIOS()) {\n                // Set inline/embedded up for iOS. Sidecar overrides inline/embedded\n                eventHandlers_iOSSetup({\n                  player: player,\n                  sourceHandler: sourceHandler,\n                  captions: captions,\n                  items: items\n                });\n              } else {\n                // Set up listeners for inline/embedded captions. Sidecar overrides inline/embedded\n                eventHandlers_SP_LIB_READY({\n                  player: player,\n                  sourceHandler: sourceHandler,\n                  captions: captions,\n                  items: items\n                });\n              }\n            case 11:\n            case "end":\n              return _context.stop();\n          }\n        }\n      }, _callee);\n    }));\n    return function (_x, _x2) {\n      return _ref2.apply(this, arguments);\n    };\n  }());\n  player.ready(function () {\n    if (!player.controlBar.settingsMenuLegacy) {\n      // Handle mouse over and out events\n      var thisElement = menu.el();\n      thisElement.addEventListener(\'mouseover\', function (event) {\n        menu.handleTouch(event, true);\n      });\n      thisElement.addEventListener(\'mouseout\', function (event) {\n        menu.handleTouch(event, true);\n      });\n    }\n  });\n}\n/* harmony default export */ var eventHandlers_initialize = (initialize);\n// CONCATENATED MODULE: ./src/helpers/addCustomPlayerStyles.ts\n\nfunction addCustomPlayerStyles(_ref) {\n  var player = _ref.player,\n    options = _ref.options;\n  /*\n  ------------------------------------------------------\n  Add defaults for ::cue styles from player settings\n  ------------------------------------------------------\n  */\n  var captionOptions = helpers_getCaptionOptions(options);\n  var cueStyle = captionOptions.cueStyle,\n    regionStyle = captionOptions.regionStyle;\n  var styleElement = document.createElement(\'style\');\n  styleElement.textContent = "";\n  if (cueStyle) {\n    styleElement.textContent += "#".concat(player.id(), " video::cue {").concat(cueStyle, "}");\n  }\n  if (regionStyle) {\n    styleElement.textContent += "#".concat(player.id(), " video::cue-region {").concat(regionStyle, "}");\n  }\n  document.head.appendChild(styleElement);\n}\n/* harmony default export */ var helpers_addCustomPlayerStyles = (addCustomPlayerStyles);\n// CONCATENATED MODULE: ./src/closedCaptions.ts\n\n\n\nfunction closedCaptions(player, options) {\n  helpers_addCustomPlayerStyles({\n    player: player,\n    options: options\n  });\n\n  /*\n  ------------------------------------------------------\n  set up sardius menu\n  ------------------------------------------------------\n  */\n\n  var menu = new sardius.libs.MenuMaker(player, options);\n\n  // add class for the cc icon\n  menu.addClass(\'vjs-icon-captions\');\n\n  // add our group to the menu\n  var captions = menu.addGroup({\n    classes: \'sp-captions\',\n    id: \'sp-captions\',\n    title: \'Closed Captions\',\n    minItems: 1\n  });\n  eventHandlers_progressOverrideCaptionSettings({\n    player: player,\n    options: options\n  });\n  eventHandlers_initialize({\n    player: player,\n    menu: menu,\n    captions: captions,\n    options: options\n  });\n  return menu;\n}\n/* harmony default export */ var src_closedCaptions = (closedCaptions);\n// CONCATENATED MODULE: ./src/index.ts\n\nvar VJS = videojs;\nvar Component = VJS.getComponent(\'Component\');\nvar ClosedCaptions = VJS.extend(Component, {\n  constructor: src_closedCaptions\n});\nsardius.menu(\'closedCaptions\', ClosedCaptions);\n/* harmony default export */ var src = __webpack_exports__["default"] = (ClosedCaptions);//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9zcmMvaGVscGVycy9pc0lPUy50cz80M2Q1Iiwid2VicGFjazovLy8uL3NyYy9oZWxwZXJzL2dldENhcHRpb25PcHRpb25zLnRzP2U1MjkiLCJ3ZWJwYWNrOi8vLy4vc3JjL2hlbHBlcnMvb3ZlcnJpZGVUcmFja1NldHRpbmdzLnRzP2RiYzciLCJ3ZWJwYWNrOi8vLy4vc3JjL2V2ZW50SGFuZGxlcnMvcHJvZ3Jlc3NPdmVycmlkZUNhcHRpb25TZXR0aW5ncy50cz8wZDZkIiwid2VicGFjazovLy8uL3NyYy9oZWxwZXJzL2dldE1lbnVMYWJlbC50cz9lOGE1Iiwid2VicGFjazovLy8uL3NyYy9oZWxwZXJzL2lzRmlyZWZveC50cz8xMTkxIiwid2VicGFjazovLy8uL3NyYy9oZWxwZXJzL3NldENhcHRpb25zLnRzP2M1MmEiLCJ3ZWJwYWNrOi8vLy4vc3JjL2hlbHBlcnMvZ2V0VmFsdWVGcm9tS2V5LnRzP2I0OGQiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V2ZW50SGFuZGxlcnMvU1BfU1VCX1RSQUNLX1VQREFURURfTElTVC50cz9jNjhmIiwid2VicGFjazovLy8uL3NyYy9ldmVudEhhbmRsZXJzL1NQX0ZSQUdNRU5UX0FGVEVSX0NIQU5HRS50cz9hZDdkIiwid2VicGFjazovLy8uL3NyYy9ldmVudEhhbmRsZXJzL1NQX0xJQl9SRUFEWS50cz9lZmNjIiwid2VicGFjazovLy8uL3NyYy9ldmVudEhhbmRsZXJzL2lPU1NldHVwLnRzPzYyNGIiLCJ3ZWJwYWNrOi8vLy4vc3JjL2V2ZW50SGFuZGxlcnMvaW5pdGlhbGl6ZS50cz9iZGQyIiwid2VicGFjazovLy8uL3NyYy9oZWxwZXJzL2FkZEN1c3RvbVBsYXllclN0eWxlcy50cz82OTQ5Iiwid2VicGFjazovLy8uL3NyYy9jbG9zZWRDYXB0aW9ucy50cz85YjBhIiwid2VicGFjazovLy8uL3NyYy9pbmRleC50cz9mZmI0Il0sIm5hbWVzIjpbImlzTmV3SU9TIiwibmF2aWdhdG9yIiwidXNlckFnZW50IiwiaXBob25lQWdlbnRNYXRjaGVzIiwibWF0Y2giLCJpT1NWZXJzaW9uIiwidHJpbSIsInNwbGl0IiwicG9wIiwibWFwIiwic3RyaW5nTnVtIiwiTnVtYmVyIiwibWFqb3JWZXJzaW9uIiwibWlub3JWZXJzaW9uIiwidW5kZWZpbmVkIiwiaXNJT1MiLCJpc0lwaG9uZSIsImluZGV4T2YiLCJnZXRDYXB0aW9uT3B0aW9ucyIsIm9wdGlvbnMiLCJkZWZhdWx0T3B0aW9ucyIsImNhcHRpb25PcHRpb25zIiwicGxheWVyT3B0aW9ucyIsInBsdWdpbnMiLCJzYXJkaXVzIiwiaU9TIiwib3ZlcnJpZGVUcmFja1NldHRpbmdzIiwiYWxsVHJhY2tzIiwiQXJyYXkiLCJmcm9tIiwiZm9yRWFjaCIsInRyYWNrIiwiY3VlcyIsImN1ZSIsImtleSIsInVzZUtleSIsInByb2dyZXNzT3ZlcnJpZGVDYXB0aW9uU2V0dGluZ3MiLCJwbGF5ZXIiLCJvbiIsInZpZGVvcyIsImVsIiwiZ2V0RWxlbWVudHNCeVRhZ05hbWUiLCJ0ZXh0VHJhY2tzIiwiZ2V0TWVudUxhYmVsIiwibGFiZWwiLCJzb3VyY2VIYW5kbGVyIiwiZGVmYXVsdExhYmVsIiwibWVudUxhYmVscyIsImxhYmVscyIsImNsZWFuTGFiZWwiLCJ0b0xvd2VyQ2FzZSIsInJlcGxhY2UiLCJpc0ZpcmVmb3giLCJzZXRDYXB0aW9ucyIsImNhcHRpb25zIiwiaXRlbXMiLCJpIiwicmVtb3RlQ2FwdGlvblRyYWNrIiwicmVtb3RlVHJhY2siLCJraW5kIiwic3JjbGFuZyIsInNyYyIsImZpbGUiLCJhZGRSZW1vdGVUZXh0VHJhY2siLCJpZCIsInB1c2giLCJjbGFzc2VzIiwic2VsZWN0YWJsZSIsImlzQWN0aXZlIiwiZGF0YSIsImNhbGxiYWNrIiwiYnV0dG9uIiwiaXNTZWxlY3RlZF8iLCJ2aWRlb0VsZW1lbnQiLCJxdWVyeVNlbGVjdG9yIiwidHJhY2tzIiwicXVlcnlTZWxlY3RvckFsbCIsInRleHRUcmFjayIsIm1vZGUiLCJyZW1vdmUiLCJpZEluZGV4Iiwib3B0aW9uc18iLCJlIiwic2V0QWN0aXZlSXRlbSIsInRyaWdnZXIiLCJwbHVnaW4iLCJzdHJlYW1IYW5kbGVyIiwic2V0Q3VycmVudFRleHRUcmFjayIsIm5ld1RyYWNrIiwiZG9jdW1lbnQiLCJjcmVhdGVFbGVtZW50IiwidXJsIiwiYXBwZW5kIiwic2V0VGltZW91dCIsInQiLCJsZW5ndGgiLCJQcm9taXNlIiwiZiIsImFkZEl0ZW1zIiwiZ2V0VmFsdWVGcm9tS2V5Iiwib2JqZWN0Iiwia2V5TmFtZSIsInJldHVyblZhbHVlIiwiU1BfU1VCX1RSQUNLX1VQREFURURfTElTVCIsImV2ZW50IiwidHJhY2tMaXN0Iiwic3ViVHJhY2tzIiwic3VidGl0bGVUcmFja3MiLCJhY3RpdmUiLCJmb3JjZWQiLCJhdXRvc2VsZWN0Iiwic2V0VGV4dFRyYWNrRGlzcGxheSIsImxhbmd1YWdlIiwib3JkZXIiLCJzZXRDdXJyZW50VGV4dFRyYWNrRGVsYXllZCIsIlNQX0ZSQUdNRU5UX0FGVEVSX0NIQU5HRSIsImNhcHRpb25UcmFja3MiLCJmaWx0ZXIiLCJjYXB0aW9uc0luTWVudSIsIm5ld0NhcHRpb25zVHJhY2tzIiwiY2FwdGlvbkFkZGVkIiwiYyIsImNvbnRyb2xCYXIiLCJlbF8iLCJjbG9zZWRDYXB0aW9uc0VsZW1lbnQiLCJpc0VsZW1lbnRIaWRkZW4iLCJjbGFzc0xpc3QiLCJjb250YWlucyIsImFkZCIsInNvcnRPcmRlciIsIkVycm9yIiwiU1BfTElCX1JFQURZIiwibGliIiwiaGxzIiwiaU9TU2V0dXAiLCJhY3RpdmVJbmRleCIsIm9uZSIsInJldmVyc2UiLCJpdGVtIiwiaW5kZXgiLCJzZWxmIiwiZmluZEluZGV4IiwiYSIsIm5hbWUiLCJfIiwieW91Ym9yYSIsImluaXRpYWxpemUiLCJtZW51IiwiY29uc29sZSIsImRlYnVnIiwibWVudUVsZW1lbnQiLCJkaXNwbGF5Iiwic3R5bGUiLCJyZWFkeSIsInNldHRpbmdzTWVudUxlZ2FjeSIsInRoaXNFbGVtZW50IiwiYWRkRXZlbnRMaXN0ZW5lciIsImhhbmRsZVRvdWNoIiwiYWRkQ3VzdG9tUGxheWVyU3R5bGVzIiwiY3VlU3R5bGUiLCJyZWdpb25TdHlsZSIsInN0eWxlRWxlbWVudCIsInRleHRDb250ZW50IiwiaGVhZCIsImFwcGVuZENoaWxkIiwiY2xvc2VkQ2FwdGlvbnMiLCJsaWJzIiwiTWVudU1ha2VyIiwiYWRkQ2xhc3MiLCJhZGRHcm91cCIsInRpdGxlIiwibWluSXRlbXMiLCJWSlMiLCJ2aWRlb2pzIiwiQ29tcG9uZW50IiwiZ2V0Q29tcG9uZW50IiwiQ2xvc2VkQ2FwdGlvbnMiLCJleHRlbmQiLCJjb25zdHJ1Y3RvciJdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFPLFNBQVNBLFFBQVEsR0FBWTtFQUNsQyxpQkFBc0JDLFNBQVM7SUFBdkJDLFNBQVMsY0FBVEEsU0FBUztFQUNqQixJQUFNQyxrQkFBa0IsR0FBR0QsU0FBUyxDQUFDRSxLQUFLLENBQUMsa0JBQWtCLENBQUM7RUFFOUQsSUFBSUQsa0JBQWtCLElBQUlBLGtCQUFrQixDQUFDLENBQUMsQ0FBQyxFQUFFO0lBQy9DLElBQU1FLFVBQVUsR0FBR0Ysa0JBQWtCLENBQUMsQ0FBQyxDQUFDLENBQ3JDRyxJQUFJLEVBQUUsQ0FDTkMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUNWQyxHQUFHLEVBQVk7SUFFbEIsSUFBSUgsVUFBVSxFQUFFO01BQ2QsNEJBQXFDQSxVQUFVLENBQzVDRSxLQUFLLENBQUMsR0FBRyxDQUFDLENBQ1ZFLEdBQUcsQ0FBQyxVQUFBQyxTQUFTO1VBQUEsT0FBSUMsTUFBTSxDQUFDRCxTQUFTLENBQUM7UUFBQSxFQUFDO1FBQUE7UUFGL0JFLFlBQVk7UUFBRUMsWUFBWTtNQUlqQyxJQUFJRCxZQUFZLEdBQUcsRUFBRSxFQUFFO1FBQ3JCLE9BQU8sS0FBSztNQUNkO01BRUEsSUFDRUEsWUFBWSxLQUFLLEVBQUUsS0FDbEJDLFlBQVksS0FBSyxDQUFDLElBQUlBLFlBQVksS0FBS0MsU0FBUyxDQUFDLEVBQ2xEO1FBQ0EsT0FBTyxLQUFLO01BQ2Q7TUFFQSxJQUFJRixZQUFZLEtBQUssRUFBRSxJQUFJQyxZQUFZLEdBQUcsQ0FBQyxFQUFFO1FBQzNDLE9BQU8sSUFBSTtNQUNiO01BRUEsSUFBSUQsWUFBWSxHQUFHLEVBQUUsRUFBRTtRQUNyQixPQUFPLElBQUk7TUFDYjtJQUNGO0VBQ0Y7RUFFQSxPQUFPLEtBQUs7QUFDZDtBQUVBLFNBQVNHLEtBQUssR0FBWTtFQUN4QjtFQUNBO0VBQ0Esa0JBQXNCZCxTQUFTO0lBQXZCQyxTQUFTLGVBQVRBLFNBQVM7RUFDakI7RUFDQTtFQUNBOztFQUVBLElBQU1jLFFBQVEsR0FDWmQsU0FBUyxDQUFDZSxPQUFPLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDLElBQUlmLFNBQVMsQ0FBQ2UsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsQ0FBQzs7RUFFeEU7O0VBRUE7RUFDQSxPQUFPRCxRQUFRO0FBQ2pCO0FBRWVELHVEQUFLLEU7Ozs7Ozs7O0FDdkRRO0FBRTVCLFNBQVNHLGlCQUFpQixDQUFDQyxPQUErQixFQUFrQjtFQUFBO0VBQzFFLElBQU1DLGNBQThCLEdBQUcsQ0FBQyxDQUFDO0VBRXpDLElBQUlDLGNBQThCLEdBQ2hDLENBQUFGLE9BQU8sYUFBUEEsT0FBTyxnREFBUEEsT0FBTyxDQUFFRyxhQUFhLG9GQUF0QixzQkFBd0JDLE9BQU8scUZBQS9CLHVCQUFpQ0MsT0FBTywyREFBeEMsdUJBQTBDSCxjQUFjLEtBQUlELGNBQWM7RUFFNUUsSUFBSUwsYUFBSyxFQUFFLEVBQUU7SUFDWE0sY0FBYyxtQ0FDVEEsY0FBYyxHQUNiQSxjQUFjLENBQUNJLEdBQUcsSUFBSUwsY0FBYyxDQUN6QztFQUNIO0VBRUEsT0FBT0MsY0FBYztBQUN2QjtBQUVlSCwrRUFBaUIsRTs7QUNsQm9COztBQUVwRDs7QUFFQSxTQUFTUSxxQkFBcUIsQ0FDNUJDLFNBQXNDLEVBQ3RDUixPQUErQixFQUNGO0VBQzdCLElBQU1FLGNBQWMsR0FBR0gseUJBQWlCLENBQUNDLE9BQU8sQ0FBQztFQUVqRFMsS0FBSyxDQUFDQyxJQUFJLENBQUNGLFNBQVMsQ0FBQyxDQUFDRyxPQUFPLENBQUMsVUFBQUMsS0FBSyxFQUFJO0lBQ3JDLElBQUlBLEtBQUssQ0FBQ0MsSUFBSSxFQUFFO01BQ2QsSUFBTUEsSUFBSSxHQUFHSixLQUFLLENBQUNDLElBQUksQ0FBQ0UsS0FBSyxDQUFDQyxJQUFJLENBQUM7TUFDbkNBLElBQUksQ0FBQ0YsT0FBTyxDQUFDLFVBQUFHLEdBQUcsRUFBSTtRQUNsQixJQUFJWixjQUFjLEVBQUU7VUFDbEIsQ0FBQyxPQUFPLEVBQUUsTUFBTSxFQUFFLFVBQVUsRUFBRSxNQUFNLEVBQUUsYUFBYSxDQUFDLENBQUNTLE9BQU8sQ0FBQyxVQUFBSSxHQUFHLEVBQUk7WUFDbEUsSUFBTUMsTUFBTSxHQUFHRCxHQUEyQjtZQUMxQyxJQUFJYixjQUFjLENBQUNjLE1BQU0sQ0FBQyxLQUFLckIsU0FBUyxFQUFFO2NBQ3hDO2NBQ0FtQixHQUFHLENBQUNDLEdBQUcsQ0FBcUIsR0FBR2IsY0FBYyxDQUFDYyxNQUFNLENBQUM7WUFDdkQ7VUFDRixDQUFDLENBQUM7UUFDSjtNQUNGLENBQUMsQ0FBQztJQUNKO0VBQ0YsQ0FBQyxDQUFDO0VBRUYsT0FBT1IsU0FBUztBQUNsQjtBQUVlRCx1RkFBcUIsRTs7QUMvQmlDO0FBUXJFLFNBQVNVLCtCQUErQixPQUFrQztFQUFBLElBQS9CQyxNQUFNLFFBQU5BLE1BQU07SUFBRWxCLE9BQU8sUUFBUEEsT0FBTztFQUN4RGtCLE1BQU0sQ0FBQ0MsRUFBRSxDQUFDLFVBQVUsRUFBRSxZQUFNO0lBQzFCLElBQU1DLE1BQU0sR0FBR0YsTUFBTSxDQUFDRyxFQUFFLEVBQUUsQ0FBQ0Msb0JBQW9CLENBQUMsT0FBTyxDQUFDO0lBQ3hELElBQUlGLE1BQU0sSUFBSUEsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFO01BQ3ZCLElBQU1aLFNBQVMsR0FBR1ksTUFBTSxDQUFDLENBQUMsQ0FBQyxDQUFDRyxVQUFVO01BRXRDaEIsNkJBQXFCLENBQUNFLEtBQUssQ0FBQ0MsSUFBSSxDQUFDRixTQUFTLENBQUMsRUFBRVIsT0FBTyxDQUFDO0lBQ3ZEO0VBQ0YsQ0FBQyxDQUFDO0FBQ0o7QUFFZWlCLGlIQUErQixFOztBQ1o5QztBQUNBLFNBQVNPLFlBQVksT0FBeUM7RUFBQTtFQUFBLElBQXRDQyxLQUFLLFFBQUxBLEtBQUs7SUFBRUMsYUFBYSxRQUFiQSxhQUFhO0VBQzFDLElBQUlDLFlBQVksR0FBR0YsS0FBSzs7RUFFeEI7RUFDQTtFQUNBLElBQUlFLFlBQVksS0FBSyxFQUFFLElBQUksT0FBT0EsWUFBWSxLQUFLLFdBQVcsRUFBRTtJQUM5REEsWUFBWSxHQUFHLFVBQVU7RUFDM0I7O0VBRUE7RUFDQSxJQUFNQyxVQUFVLEdBQUdGLGFBQWEsYUFBYkEsYUFBYSxnREFBYkEsYUFBYSxDQUFFMUIsT0FBTywwREFBdEIsc0JBQXdCNkIsTUFBTTtFQUNqRCxJQUFNQyxVQUFVLEdBQUdILFlBQVksQ0FBQ0ksV0FBVyxFQUFFLENBQUNDLE9BQU8sQ0FBQyxjQUFjLEVBQUUsRUFBRSxDQUFDOztFQUV6RTtFQUNBLElBQUksUUFBT0osVUFBVSxhQUFWQSxVQUFVLHVCQUFWQSxVQUFVLENBQUdFLFVBQVUsQ0FBQyxNQUFLLFdBQVcsRUFBRTtJQUNuREgsWUFBWSxHQUFHQyxVQUFVLENBQUNFLFVBQVUsQ0FBQztFQUN2QztFQUVBLElBQUlBLFVBQVUsS0FBSyxLQUFLLEVBQUU7SUFDeEJILFlBQVksR0FBRyxFQUFFO0VBQ25CO0VBRUEsT0FBT0EsWUFBWTtBQUNyQjtBQUVlSCxxRUFBWSxFOztBQ2pDM0IsU0FBU1MsU0FBUyxHQUFZO0VBQzVCLGlCQUFzQm5ELFNBQVM7SUFBdkJDLFNBQVMsY0FBVEEsU0FBUztFQUVqQixJQUFNa0QsU0FBUyxHQUFHbEQsU0FBUyxDQUFDZ0QsV0FBVyxFQUFFLENBQUNqQyxPQUFPLENBQUMsU0FBUyxDQUFDLEtBQUssQ0FBQyxDQUFDO0VBRW5FLE9BQU9tQyxTQUFTO0FBQ2xCO0FBRWVBLCtEQUFTLEU7OzsrQ0NQeEI7QUFBQTtBQUFBO0FBRDREO0FBQ2xCO0FBU2Q7QUFDUTtBQVVwQztBQUFBLFNBQ2VDLFdBQVc7RUFBQTtBQUFBO0FBQUE7RUFBQSwwRUFBMUI7SUFBQTtJQUFBO01BQUE7UUFBQTtVQUFBO1lBQ0VoQixNQUFNLFFBQU5BLE1BQU0sRUFDTlEsYUFBYSxRQUFiQSxhQUFhLEVBQ2JTLFFBQVEsUUFBUkEsUUFBUSxFQUNSbkMsT0FBTyxRQUFQQSxPQUFPLEVBQ1BvQyxLQUFLLFFBQUxBLEtBQUs7WUFBQSxLQUdEVixhQUFhLENBQUNTLFFBQVE7Y0FBQTtjQUFBO1lBQUE7WUFBQSwrREFDZkUsQ0FBQztjQUFBO2NBQUE7Y0FBQTtnQkFBQTtrQkFBQTtvQkFBQTtzQkFDRkMsa0JBQWtCLEdBQUdaLGFBQWEsQ0FBQ1MsUUFBUSxDQUFDRSxDQUFDLENBQUMsRUFFcEQ7c0JBQ01FLFdBQTZCLEdBQUc7d0JBQ3BDQyxJQUFJLEVBQUUsVUFBVTt3QkFDaEJmLEtBQUssRUFBRUQsb0JBQVksQ0FBQzswQkFDbEJDLEtBQUssRUFBRWEsa0JBQWtCLENBQUNiLEtBQUs7MEJBQy9CQyxhQUFhLEVBQWJBO3dCQUNGLENBQUMsQ0FBQzt3QkFDRmUsT0FBTywyQkFBRUgsa0JBQWtCLENBQUNiLEtBQUssb0ZBQXhCLHNCQUEwQk0sV0FBVywyREFBckMsa0RBQXlDO3dCQUNsRFcsR0FBRyxFQUFFSixrQkFBa0IsQ0FBQ0s7c0JBQzFCLENBQUMsRUFFRDtzQkFDQXpCLE1BQU0sQ0FBQzBCLGtCQUFrQixDQUFDTCxXQUFXLEVBQUUsSUFBSSxDQUFDOztzQkFFNUM7c0JBQ0FELGtCQUFrQixDQUFDTyxFQUFFLEdBQUdSLENBQUM7c0JBRXpCRCxLQUFLLENBQUNVLElBQUksQ0FBQzt3QkFDVEMsT0FBTyxFQUFFLGNBQWM7d0JBQ3ZCdEIsS0FBSyxFQUFFRCxvQkFBWSxDQUFDOzBCQUFFQyxLQUFLLEVBQUVhLGtCQUFrQixDQUFDYixLQUFLOzBCQUFFQyxhQUFhLEVBQWJBO3dCQUFjLENBQUMsQ0FBQzt3QkFDdkVzQixVQUFVLEVBQUUsSUFBSTt3QkFDaEJDLFFBQVEsRUFBRSxLQUFLO3dCQUNmSixFQUFFLFlBQUtSLENBQUMsQ0FBRTt3QkFDVmEsSUFBSSxFQUFFWixrQkFBa0I7d0JBQ3hCO3dCQUNBYSxRQUFRLEVBQUUsa0JBQUNELElBQUksRUFBRUUsTUFBTSxFQUFLOzBCQUFBOzBCQUMxQixJQUFNOUMsR0FBRyxHQUFHVixhQUFLLEVBQUU7MEJBQ25CLElBQVF5RCxXQUFXLEdBQUtELE1BQU0sQ0FBdEJDLFdBQVc7MEJBQ25CO0FBQ1Y7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOzBCQUNVLElBQU1DLFlBQVksR0FBR3BDLE1BQU0sQ0FBQ0csRUFBRSxFQUFFLENBQUNrQyxhQUFhLENBQUMsT0FBTyxDQUFDOzBCQUN2RCxJQUFJRCxZQUFZLEVBQUU7NEJBQ2hCLElBQU1FLE1BQU0sR0FBR0YsWUFBWSxDQUFDRyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUM7NEJBQ3JELElBQUlELE1BQU0sRUFBRTs4QkFDVi9DLEtBQUssQ0FBQ0MsSUFBSSxDQUFDOEMsTUFBTSxDQUFDLENBQUM3QyxPQUFPLENBQUMsVUFBQUMsS0FBSyxFQUFJO2dDQUNsQyxJQUFJcUIsaUJBQVMsRUFBRSxFQUFFO2tDQUNmO2tDQUNBLElBQU15QixTQUFTLEdBQUc5QyxLQUFLLENBQUNBLEtBQUs7a0NBQzdCLElBQUk4QyxTQUFTLEVBQUU7b0NBQ2JBLFNBQVMsQ0FBQ0MsSUFBSSxHQUFHLFVBQVU7a0NBQzdCO2dDQUNGO2dDQUVBL0MsS0FBSyxDQUFDZ0QsTUFBTSxFQUFFOzhCQUNoQixDQUFDLENBQUM7NEJBQ0o7MEJBQ0Y7OzBCQUVBOzBCQUNBLElBQUlQLFdBQVcsRUFBRTs0QkFBQTs0QkFDZixJQUFJL0MsR0FBRyxFQUFFOzhCQUNQNEMsSUFBSSxDQUFDUyxJQUFJLEdBQUcsUUFBUTs4QkFDcEJ6QyxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDb0MsSUFBSSxHQUFHLFFBQVE7OEJBQ25DLElBQU1FLE9BQU8sR0FBR3JFLE1BQU0sQ0FBQzRELE1BQU0sQ0FBQ1UsUUFBUSxDQUFDakIsRUFBRSxDQUFDOzhCQUMxQyxJQUFJZ0IsT0FBTyxFQUFFO2dDQUNYLElBQUk7a0NBQ0YzQyxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDc0MsT0FBTyxDQUFDLENBQUNGLElBQUksR0FBRyxRQUFRO2dDQUM5QyxDQUFDLENBQUMsT0FBT0ksQ0FBQyxFQUFFO2tDQUNWO2dDQUFBOzhCQUVKOzRCQUNGOzRCQUNBNUIsUUFBUSxDQUFDNkIsYUFBYSxDQUFDckUsU0FBUyxDQUFDOzRCQUNqQ3VCLE1BQU0sQ0FBQytDLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQzs0QkFDdEMseUJBQUF2QyxhQUFhLENBQUN3QyxNQUFNLDBEQUFwQixzQkFBc0JDLGFBQWEsQ0FBQ0MsbUJBQW1CLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDOzRCQUMvRDswQkFDRjswQkFFQSxJQUFJZCxZQUFZLEVBQUU7NEJBQ2hCLElBQU1lLFFBQVEsR0FBR0MsUUFBUSxDQUFDQyxhQUFhLENBQUMsT0FBTyxDQUFDOzRCQUNoREYsUUFBUSxDQUFDM0IsR0FBRyxHQUFHUSxJQUFJLENBQUNzQixHQUFHOzRCQUN2QkgsUUFBUSxDQUFDNUMsS0FBSyxHQUFHeUIsSUFBSSxDQUFDekIsS0FBSzs0QkFDM0I0QyxRQUFRLENBQUM3QixJQUFJLEdBQUcsVUFBVTs0QkFDMUI2QixRQUFRLENBQUM1QixPQUFPLEdBQUcsSUFBSTs0QkFDdkI0QixRQUFRLFdBQVEsR0FBRyxJQUFJOzRCQUV2QixJQUFJcEMsaUJBQVMsRUFBRSxFQUFFOzhCQUNmOzhCQUNBLElBQUlvQyxRQUFRLENBQUN6RCxLQUFLLEVBQUU7Z0NBQ2xCeUQsUUFBUSxDQUFDekQsS0FBSyxDQUFDK0MsSUFBSSxHQUFHLFNBQVM7OEJBQ2pDOzRCQUNGOzRCQUVBTCxZQUFZLENBQUNtQixNQUFNLENBQUNKLFFBQVEsQ0FBQzs0QkFDN0JLLFVBQVUsQ0FBQyxZQUFNOzhCQUNmbkUsNkJBQXFCLENBQUMsQ0FBQzhELFFBQVEsQ0FBQ3pELEtBQUssQ0FBQyxFQUFFWixPQUFPLENBQUM7NEJBQ2xELENBQUMsRUFBRSxHQUFHLENBQUM7MEJBQ1Q7MEJBRUEsSUFBSU0sR0FBRyxFQUFFOzRCQUNQOzRCQUNBOzRCQUNBLEtBQUssSUFBSXFFLENBQUMsR0FBRyxDQUFDLEVBQUVBLENBQUMsR0FBR3pELE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUNxRCxNQUFNLEVBQUVELENBQUMsSUFBSSxDQUFDLEVBQUU7OEJBQ3RELElBQUl6RCxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDb0QsQ0FBQyxDQUFDLENBQUNoQixJQUFJLEtBQUssU0FBUyxFQUFFO2dDQUM3QyxJQUFJO2tDQUNGekMsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ29ELENBQUMsQ0FBQyxDQUFDaEIsSUFBSSxHQUFHLFFBQVE7Z0NBQ3hDLENBQUMsQ0FBQyxPQUFPSSxDQUFDLEVBQUU7a0NBQ1Y7Z0NBQUE7OEJBRUo7NEJBQ0Y7OzRCQUVBOzRCQUNBN0MsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ29DLElBQUksR0FBRyxTQUFTOzRCQUNwQzs0QkFDQSxJQUFNRSxRQUFPLEdBQUdyRSxNQUFNLENBQUM0RCxNQUFNLENBQUNVLFFBQVEsQ0FBQ2pCLEVBQUUsQ0FBQzs0QkFDMUMsSUFBSWdCLFFBQU8sRUFBRTs4QkFDWCxJQUFJO2dDQUNGM0MsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ3NDLFFBQU8sQ0FBQyxDQUFDRixJQUFJLEdBQUcsU0FBUzs4QkFDL0MsQ0FBQyxDQUFDLE9BQU9JLENBQUMsRUFBRTtnQ0FDVjs4QkFBQTs0QkFFSjs0QkFDQWIsSUFBSSxDQUFDUyxJQUFJLEdBQUcsU0FBUzswQkFDdkI7OzBCQUVBOzBCQUNBeEIsUUFBUSxDQUFDNkIsYUFBYSxDQUFDWixNQUFNLENBQUM7MEJBQzlCbEMsTUFBTSxDQUFDK0MsT0FBTyxDQUFDLHFCQUFxQixDQUFDOzBCQUNyQywwQkFBQXZDLGFBQWEsQ0FBQ3dDLE1BQU0sMkRBQXBCLHVCQUFzQkMsYUFBYSxDQUFDQyxtQkFBbUIsQ0FDckQvQixDQUFDLEVBQ0RhLElBQUksQ0FBQ3pCLEtBQUssQ0FDWDt3QkFDSDtzQkFDRixDQUFDLENBQUM7c0JBQUM7c0JBQUEsT0FFRyxJQUFJb0QsT0FBTyxDQUFDLFVBQUFDLENBQUMsRUFBSTt3QkFDckJKLFVBQVUsQ0FBQyxZQUFNOzBCQUNmdkMsUUFBUSxDQUFDNEMsUUFBUSxDQUFDM0MsS0FBSyxFQUFFLElBQUksQ0FBQzswQkFDOUIwQyxDQUFDLENBQUMsRUFBRSxDQUFDO3dCQUNQLENBQUMsRUFBRSxHQUFHLENBQUM7c0JBQ1QsQ0FBQyxDQUFDO29CQUFBO29CQUFBO3NCQUFBO2tCQUFBO2dCQUFBO2NBQUE7WUFBQTtZQTNJS3pDLENBQUMsR0FBRyxDQUFDO1VBQUE7WUFBQSxNQUFFQSxDQUFDLEdBQUdYLGFBQWEsQ0FBQ1MsUUFBUSxDQUFDeUMsTUFBTTtjQUFBO2NBQUE7WUFBQTtZQUFBLHFDQUF4Q3ZDLENBQUM7VUFBQTtZQUF5Q0EsQ0FBQyxJQUFJLENBQUM7WUFBQTtZQUFBO1VBQUE7VUFBQTtZQUFBO1FBQUE7TUFBQTtJQUFBO0VBQUEsQ0E4STVEO0VBQUE7QUFBQTtBQUVjSCxtRUFBVyxFOzs7QUM3SzFCOztBQVFBLFNBQVM4QyxlQUFlLENBQUlDLE1BQXFCLEVBQUVDLE9BQWUsRUFBaUI7RUFDakYsSUFBSUMsV0FBVyxHQUFHeEYsU0FBUztFQUUzQixJQUFJLE9BQU9zRixNQUFNLEtBQUssV0FBVyxFQUFFO0lBQ2pDLE9BQU9FLFdBQVc7RUFDcEI7RUFFQSxJQUFJLHVCQUFPRixNQUFNLE1BQUssUUFBUSxJQUFJQSxNQUFNLENBQUNDLE9BQU8sQ0FBQyxFQUFFO0lBQ2pEO0lBQ0FDLFdBQVcsR0FBR0YsTUFBTSxDQUFDQyxPQUFPLENBQUM7RUFDL0IsQ0FBQyxNQUFNLElBQUlELE1BQU0sQ0FBQy9CLElBQUksSUFBSStCLE1BQU0sQ0FBQy9CLElBQUksQ0FBQ2dDLE9BQU8sQ0FBQyxFQUFFO0lBQzlDO0lBQ0FDLFdBQVcsR0FBR0YsTUFBTSxDQUFDL0IsSUFBSSxDQUFDZ0MsT0FBTyxDQUFDO0VBQ3BDO0VBRUEsT0FBT0MsV0FBVztBQUNwQjtBQUVlSCwyRUFBZSxFOztBQzVCcUI7QUFRTTtBQUNaO0FBUzdDLFNBQVNJLHlCQUF5QixPQUtuQjtFQUFBLElBSmJsRSxNQUFNLFFBQU5BLE1BQU07SUFDTlEsYUFBYSxRQUFiQSxhQUFhO0lBQ2JTLFFBQVEsUUFBUkEsUUFBUTtJQUNSQyxLQUFLLFFBQUxBLEtBQUs7RUFFTDtBQUNGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7RUFDRWxCLE1BQU0sQ0FBQ0MsRUFBRSxDQUNQLDJCQUEyQixFQUMzQixVQUFDa0UsS0FBWSxFQUFFQyxTQUFpRCxFQUFLO0lBQ25FLElBQU1DLFNBQVMsR0FBR0QsU0FBUyxDQUFDRSxjQUFjO0lBQUMsMkJBQ2xDbkQsQ0FBQztNQUFBO01BQ1IsSUFBTW9ELE1BQU0sR0FDVixpQkFBQUYsU0FBUyxDQUFDbEQsQ0FBQyxDQUFDLGlEQUFaLHVCQUFxQixNQUFLLElBQUksSUFDOUIsa0JBQUFrRCxTQUFTLENBQUNsRCxDQUFDLENBQUMsa0RBQVosY0FBY3FELE1BQU0sTUFBSyxJQUFJLElBQzdCLGtCQUFBSCxTQUFTLENBQUNsRCxDQUFDLENBQUMsa0RBQVosY0FBY3NELFVBQVUsTUFBSyxJQUFJO01BRW5DLElBQUlGLE1BQU0sRUFBRTtRQUNWL0QsYUFBYSxDQUFDd0MsTUFBTSxDQUFDQyxhQUFhLENBQUN5QixtQkFBbUIsQ0FBQyxJQUFJLENBQUM7UUFDNURsRSxhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQ0MsbUJBQW1CLENBQ3BEL0IsQ0FBQyxFQUNEa0QsU0FBUyxDQUFDbEQsQ0FBQyxDQUFDLENBQUN3RCxRQUFRLENBQ3RCO01BQ0g7TUFFQXpELEtBQUssQ0FBQ1UsSUFBSSxDQUFDO1FBQ1RDLE9BQU8sRUFBRSxjQUFjO1FBQ3ZCdEIsS0FBSyxFQUFFRCxvQkFBWSxDQUFDO1VBQ2xCQyxLQUFLLEVBQ0h1RCx1QkFBZSxDQUNiTyxTQUFTLENBQUNsRCxDQUFDLENBQUMsRUFDWixPQUFPLENBQ1IsSUFDRDJDLHVCQUFlLENBQTJCTyxTQUFTLENBQUNsRCxDQUFDLENBQUMsRUFBRSxNQUFNLENBQUM7VUFDakVYLGFBQWEsRUFBYkE7UUFDRixDQUFDLENBQUM7UUFDRm1CLEVBQUUsaUJBQVVSLENBQUMsQ0FBRTtRQUNmeUQsS0FBSyxFQUFFUCxTQUFTLENBQUNYLE1BQU0sR0FBR3ZDLENBQUM7UUFDM0JZLFFBQVEsRUFBRXdDLE1BQU07UUFDaEJ6QyxVQUFVLEVBQUUsSUFBSTtRQUNoQkUsSUFBSSxFQUFFcUMsU0FBUyxDQUFDbEQsQ0FBQyxDQUFDO1FBQ2xCO1FBQ0FjLFFBQVEsRUFBRSxrQkFBQ0QsSUFBSSxFQUFFRSxNQUFNLEVBQUs7VUFDMUIsSUFBUUMsV0FBVyxHQUFLRCxNQUFNLENBQXRCQyxXQUFXO1VBQ25CO1VBQ0EzQixhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQ0MsbUJBQW1CLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDO1VBQzlEakMsUUFBUSxDQUFDNkIsYUFBYSxDQUFDckUsU0FBUyxDQUFDO1VBQ2pDK0IsYUFBYSxDQUFDd0MsTUFBTSxDQUFDQyxhQUFhLENBQUN5QixtQkFBbUIsQ0FBQyxLQUFLLENBQUM7VUFDN0QxRSxNQUFNLENBQUMrQyxPQUFPLENBQUMsc0JBQXNCLENBQUM7O1VBRXRDO1VBQ0EsS0FBSyxJQUFJVSxDQUFDLEdBQUcsQ0FBQyxFQUFFQSxDQUFDLEdBQUd2QyxLQUFLLENBQUN3QyxNQUFNLEVBQUVELENBQUMsSUFBSSxDQUFDLEVBQUU7WUFBQTtZQUN4QyxJQUFJLGtCQUFBdkMsS0FBSyxDQUFDdUMsQ0FBQyxDQUFDLENBQUN6QixJQUFJLGtEQUFiLGNBQWVTLElBQUksTUFBSyxVQUFVLEVBQUU7Y0FDdEMsSUFBSSxDQUFDdkIsS0FBSyxDQUFDdUMsQ0FBQyxDQUFDLENBQUN6QixJQUFJLEVBQUU7Z0JBQ2xCZCxLQUFLLENBQUN1QyxDQUFDLENBQUMsQ0FBQ3pCLElBQUksR0FBRyxDQUFDLENBQUM7Y0FDcEI7Y0FDQWQsS0FBSyxDQUFDdUMsQ0FBQyxDQUFDLENBQUN6QixJQUFJLENBQUVTLElBQUksR0FBRyxVQUFVO1lBQ2xDO1VBQ0Y7VUFFQSxJQUFJLENBQUNOLFdBQVcsRUFBRTtZQUNoQjtZQUNBM0IsYUFBYSxDQUFDd0MsTUFBTSxDQUFDQyxhQUFhLENBQUN5QixtQkFBbUIsQ0FBQyxJQUFJLENBQUM7WUFDNUQ7WUFDQWxFLGFBQWEsQ0FBQ3dDLE1BQU0sQ0FBQ0MsYUFBYSxDQUFDNEIsMEJBQTBCLENBQzNEMUQsQ0FBQyxFQUNEYSxJQUFJLENBQUMyQyxRQUFRLENBQ2Q7WUFDRDtZQUNBMUQsUUFBUSxDQUFDNkIsYUFBYSxDQUFDWixNQUFNLENBQUM7WUFFOUIsSUFBSW5CLGlCQUFTLEVBQUUsRUFBRTtjQUNmO2NBQ0FpQixJQUFJLENBQUNTLElBQUksR0FBRyxTQUFTO1lBQ3ZCO1lBQ0F6QyxNQUFNLENBQUMrQyxPQUFPLENBQUMseUJBQXlCLEVBQUVmLElBQUksQ0FBQztZQUMvQ2hDLE1BQU0sQ0FBQytDLE9BQU8sQ0FBQyxxQkFBcUIsQ0FBQztVQUN2QztRQUNGO01BQ0YsQ0FBQyxDQUFDO0lBQUM7SUFwRUwsS0FBSyxJQUFJNUIsQ0FBQyxHQUFHLENBQUMsRUFBRUEsQ0FBQyxJQUFJLENBQUFrRCxTQUFTLGFBQVRBLFNBQVMsdUJBQVRBLFNBQVMsQ0FBRVgsTUFBTSxLQUFJLENBQUMsQ0FBQyxFQUFFdkMsQ0FBQyxJQUFJLENBQUMsRUFBRTtNQUFBLE1BQTdDQSxDQUFDO0lBcUVWO0lBRUFGLFFBQVEsQ0FBQzRDLFFBQVEsQ0FBQzNDLEtBQUssQ0FBQztFQUMxQixDQUFDLENBQ0Y7QUFDSDtBQUVlZ0QscUdBQXlCLEU7O0FDOUdXO0FBU007QUFDWjtBQVM3QyxTQUFTWSx3QkFBd0IsT0FLbEI7RUFBQSxJQUpiOUUsTUFBTSxRQUFOQSxNQUFNO0lBQ05RLGFBQWEsUUFBYkEsYUFBYTtJQUNiUyxRQUFRLFFBQVJBLFFBQVE7SUFDUkMsS0FBSyxRQUFMQSxLQUFLO0VBRUw7QUFDRjtBQUNBO0FBQ0E7QUFDQTtFQUNFbEIsTUFBTSxDQUFDQyxFQUFFLENBQUMsMEJBQTBCLEVBQUUsWUFBTTtJQUMxQztJQUNBO0lBQ0EsSUFBTVgsU0FBUyxHQUFHVSxNQUFNLENBQUNHLEVBQUUsRUFBRSxDQUFDQyxvQkFBb0IsQ0FBQyxPQUFPLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FDM0RDLFVBQWtDOztJQUVyQztJQUNBO0lBQ0EsSUFBTTBFLGFBQWEsR0FBR3hGLEtBQUssQ0FBQ0MsSUFBSSxDQUFDRixTQUFTLENBQUMsQ0FBQzBGLE1BQU0sQ0FDaEQsVUFBQXRGLEtBQUs7TUFBQSxPQUFJb0UsdUJBQWUsQ0FBZ0JwRSxLQUFLLEVBQUUsTUFBTSxDQUFDLEtBQUssVUFBVTtJQUFBLEVBQ3RFOztJQUVEO0lBQ0EsSUFBTXVGLGNBQWMsR0FBRy9ELEtBQUssQ0FBQzhELE1BQU0sQ0FBQyxVQUFBdEYsS0FBSyxFQUFJO01BQzNDLElBQUlvRSx1QkFBZSxDQUFnQnBFLEtBQUssRUFBRSxNQUFNLENBQUMsS0FBSyxVQUFVLEVBQUU7UUFDaEUsT0FBTyxJQUFJO01BQ2I7TUFDQSxPQUFPLEtBQUs7SUFDZCxDQUFDLENBQUM7O0lBRUY7QUFDSjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOztJQUVJLElBQU13RixpQkFBcUMsR0FBRyxFQUFFO0lBQ2hEO0lBQ0FILGFBQWEsQ0FBQ3RGLE9BQU8sQ0FBQyxVQUFBQyxLQUFLLEVBQUk7TUFDN0IsSUFBSXVGLGNBQWMsQ0FBQ3ZCLE1BQU0sR0FBRyxDQUFDLEVBQUU7UUFDN0IsSUFBSXlCLFlBQVksR0FBRyxLQUFLO1FBQ3hCLEtBQUssSUFBSUMsQ0FBQyxHQUFHLENBQUMsRUFBRUEsQ0FBQyxHQUFHSCxjQUFjLENBQUN2QixNQUFNLEVBQUUwQixDQUFDLElBQUksQ0FBQyxFQUFFO1VBQ2pELElBQ0VILGNBQWMsQ0FBQ0csQ0FBQyxDQUFDLElBQ2pCSCxjQUFjLENBQUNHLENBQUMsQ0FBQyxDQUFDcEQsSUFBSSxJQUN0QjhCLHVCQUFlLENBQ2JtQixjQUFjLENBQUNHLENBQUMsQ0FBQyxFQUNqQixPQUFPLENBQ1IsS0FBS3RCLHVCQUFlLENBQXdCcEUsS0FBSyxFQUFFLE9BQU8sQ0FBQyxJQUM1RG9FLHVCQUFlLENBQ2JtQixjQUFjLENBQUNHLENBQUMsQ0FBQyxFQUNqQixVQUFVLENBQ1gsS0FBS3RCLHVCQUFlLENBQTJCcEUsS0FBSyxFQUFFLFVBQVUsQ0FBQyxFQUNsRTtZQUNBeUYsWUFBWSxHQUFHLElBQUk7VUFDckI7UUFDRjtRQUNBLElBQUksQ0FBQ0EsWUFBWSxFQUFFO1VBQ2pCRCxpQkFBaUIsQ0FBQ3RELElBQUksQ0FBQ2xDLEtBQUssQ0FBQztRQUMvQjtNQUNGLENBQUMsTUFBTTtRQUNMd0YsaUJBQWlCLENBQUN0RCxJQUFJLENBQUNsQyxLQUFLLENBQUM7TUFDL0I7SUFDRixDQUFDLENBQUM7O0lBRUY7QUFDSjtBQUNBO0FBQ0E7QUFDQTtBQUNBO0lBQ0ksSUFDRU0sTUFBTSxDQUFDcUYsVUFBVSxJQUNqQnJGLE1BQU0sQ0FBQ3FGLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxJQUNuQ3JGLE1BQU0sQ0FBQ3FGLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDQyxHQUFHLEVBQ3ZDO01BQ0E7TUFDQSxJQUFNQyxxQkFBcUIsR0FBR3ZGLE1BQU0sQ0FBQ3FGLFVBQVUsQ0FBQyxnQkFBZ0IsQ0FBQyxDQUFDQyxHQUFHOztNQUVyRTtNQUNBLElBQU1FLGVBQWUsR0FBR0QscUJBQXFCLENBQUNFLFNBQVMsQ0FBQ0MsUUFBUSxDQUM5RCxZQUFZLENBQ2I7O01BRUQ7TUFDQSxJQUNFekUsUUFBUSxDQUFDQyxLQUFLLElBQ2RELFFBQVEsQ0FBQ0MsS0FBSyxDQUFDd0MsTUFBTSxLQUFLLENBQUMsSUFDM0I4QixlQUFlLEtBQUssS0FBSyxFQUN6QjtRQUNBRCxxQkFBcUIsQ0FBQ0UsU0FBUyxDQUFDRSxHQUFHLENBQUMsWUFBWSxDQUFDO01BQ25EOztNQUVBO01BQ0EsSUFBSVQsaUJBQWlCLENBQUN4QixNQUFNLEtBQUssQ0FBQyxFQUFFO1FBQUEsMkJBQ3pCdkMsQ0FBQztVQUNSLElBQUl5RSxTQUFTLEdBQUdWLGlCQUFpQixDQUFDeEIsTUFBTSxHQUFHdkMsQ0FBQzs7VUFFNUM7VUFDQSxJQUNFMkMsdUJBQWUsQ0FDYm9CLGlCQUFpQixDQUFDL0QsQ0FBQyxDQUFDLEVBQ3BCLFVBQVUsQ0FDWCxLQUFLLElBQUksRUFDVjtZQUNBeUUsU0FBUyxHQUFHMUUsS0FBSyxDQUFDd0MsTUFBTSxHQUFHLENBQUM7VUFDOUI7VUFFQXhDLEtBQUssQ0FBQ1UsSUFBSSxDQUFDO1lBQ1RDLE9BQU8sRUFBRSxjQUFjO1lBQ3ZCdEIsS0FBSyxFQUFFRCxvQkFBWSxDQUFDO2NBQ2xCQyxLQUFLLEVBQ0h1RCx1QkFBZSxDQUNib0IsaUJBQWlCLENBQUMvRCxDQUFDLENBQUMsRUFDcEIsTUFBTSxDQUNQLElBQ0QyQyx1QkFBZSxDQUNib0IsaUJBQWlCLENBQUMvRCxDQUFDLENBQUMsRUFDcEIsT0FBTyxDQUNSO2NBQ0hYLGFBQWEsRUFBYkE7WUFDRixDQUFDLENBQUM7WUFDRm1CLEVBQUUscUJBQWNSLENBQUMsQ0FBRTtZQUNuQnlELEtBQUssRUFBRWdCLFNBQVM7WUFDaEI3RCxRQUFRLEVBQUUsS0FBSztZQUNmRCxVQUFVLEVBQUUsSUFBSTtZQUNoQkUsSUFBSSxFQUFFa0QsaUJBQWlCLENBQUMvRCxDQUFDLENBQUM7WUFDMUI7WUFDQWMsUUFBUSxFQUFFLGtCQUFDRCxJQUFJLEVBQUVFLE1BQU0sRUFBSztjQUMxQixJQUFRQyxXQUFXLEdBQUtELE1BQU0sQ0FBdEJDLFdBQVc7Y0FDbkI7Y0FDQSxJQUFJQSxXQUFXLEVBQUU7Z0JBQ2YrQyxpQkFBaUIsQ0FBQy9ELENBQUMsQ0FBQyxDQUFDc0IsSUFBSSxHQUFHLFVBQVU7Z0JBQ3RDeEIsUUFBUSxDQUFDNkIsYUFBYSxDQUFDckUsU0FBUyxDQUFDO2dCQUNqQ3VCLE1BQU0sQ0FBQytDLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQztnQkFDdEN2QyxhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQ0MsbUJBQW1CLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDO2dCQUM5RDtjQUNGOztjQUVBO2NBQ0EsS0FBSyxJQUFJTyxDQUFDLEdBQUcsQ0FBQyxFQUFFQSxDQUFDLEdBQUd2QyxLQUFLLENBQUN3QyxNQUFNLEVBQUVELENBQUMsSUFBSSxDQUFDLEVBQUU7Z0JBQUE7Z0JBQ3hDLElBQUkseUJBQU92QyxLQUFLLENBQUN1QyxDQUFDLENBQUMsQ0FBQ3pCLElBQUksa0RBQWIsY0FBZVMsSUFBSSxNQUFLLFdBQVcsRUFBRTtrQkFDOUN2QixLQUFLLENBQUN1QyxDQUFDLENBQUMsQ0FBQ3pCLElBQUksQ0FBRVMsSUFBSSxHQUFHLFVBQVU7Z0JBQ2xDO2NBQ0Y7O2NBRUE7Y0FDQXlDLGlCQUFpQixDQUFDL0QsQ0FBQyxDQUFDLENBQUNzQixJQUFJLEdBQUcsU0FBUztjQUNyQztjQUNBakMsYUFBYSxDQUFDd0MsTUFBTSxDQUFDQyxhQUFhLENBQUNDLG1CQUFtQixDQUNwRC9CLENBQUMsRUFDRGEsSUFBSSxDQUFDMkMsUUFBUSxDQUNkO2NBQ0RuRSxhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQ3lCLG1CQUFtQixDQUFDLElBQUksQ0FBQztjQUM1RDtjQUNBekQsUUFBUSxDQUFDNkIsYUFBYSxDQUFDWixNQUFNLENBQUM7Y0FFOUIsSUFBSW5CLGlCQUFTLEVBQUUsRUFBRTtnQkFDZjtnQkFDQWlCLElBQUksQ0FBQ1MsSUFBSSxHQUFHLFNBQVM7Y0FDdkI7Y0FDQXpDLE1BQU0sQ0FBQytDLE9BQU8sQ0FBQyxvQkFBb0IsRUFBRWYsSUFBSSxDQUFDO2NBQzFDaEMsTUFBTSxDQUFDK0MsT0FBTyxDQUFDLHFCQUFxQixDQUFDO1lBQ3ZDO1VBQ0YsQ0FBQyxDQUFDO1FBQUM7UUFyRUwsS0FBSyxJQUFJNUIsQ0FBQyxHQUFHLENBQUMsRUFBRUEsQ0FBQyxHQUFHK0QsaUJBQWlCLENBQUN4QixNQUFNLEVBQUV2QyxDQUFDLElBQUksQ0FBQyxFQUFFO1VBQUEsTUFBN0NBLENBQUM7UUFzRVY7UUFFQUYsUUFBUSxDQUFDNEMsUUFBUSxDQUFDM0MsS0FBSyxDQUFDO01BQzFCO01BQ0E7TUFDQTtNQUNBO01BQ0E7SUFDRixDQUFDLE1BQU07TUFDTCxNQUFNLElBQUkyRSxLQUFLLENBQ2IsNERBQTRELENBQzdEO0lBQ0g7RUFDRixDQUFDLENBQUM7QUFDSjtBQUVlZixtR0FBd0IsRTs7QUM3TTZCO0FBQ0Y7QUFlbEU7QUFDQTtBQUNBLFNBQVNnQixZQUFZLE9BS047RUFBQSxJQUpiOUYsTUFBTSxRQUFOQSxNQUFNO0lBQ05RLGFBQWEsUUFBYkEsYUFBYTtJQUNiUyxRQUFRLFFBQVJBLFFBQVE7SUFDUkMsS0FBSyxRQUFMQSxLQUFLO0VBRUw7RUFDQTtFQUNBbEIsTUFBTSxDQUFDQyxFQUFFLENBQUMsY0FBYyxFQUFFLFlBQU07SUFDOUI7SUFDQSxJQUFJTyxhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQzhDLEdBQUcsQ0FBQ0MsR0FBRyxFQUFFO01BQzlDO01BQ0F4RixhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQ3lCLG1CQUFtQixDQUFDLElBQUksQ0FBQzs7TUFFNUQ7TUFDQWxFLGFBQWEsQ0FBQ3dDLE1BQU0sQ0FBQ0MsYUFBYSxDQUFDQyxtQkFBbUIsQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUM7O01BRTlEO01BQ0ExQyxhQUFhLENBQUN3QyxNQUFNLENBQUNDLGFBQWEsQ0FBQ3lCLG1CQUFtQixDQUFDLEtBQUssQ0FBQzs7TUFFN0Q7TUFDQVIsdUNBQXlCLENBQUM7UUFDeEJsRSxNQUFNLEVBQU5BLE1BQU07UUFDTlEsYUFBYSxFQUFiQSxhQUFhO1FBQ2JTLFFBQVEsRUFBUkEsUUFBUTtRQUNSQyxLQUFLLEVBQUxBO01BQ0YsQ0FBQyxDQUFDO01BQ0Y7TUFDQTRELHNDQUF3QixDQUFDO1FBQ3ZCOUUsTUFBTSxFQUFOQSxNQUFNO1FBQ05RLGFBQWEsRUFBYkEsYUFBYTtRQUNiUyxRQUFRLEVBQVJBLFFBQVE7UUFDUkMsS0FBSyxFQUFMQTtNQUNGLENBQUMsQ0FBQztJQUNKO0VBQ0YsQ0FBQyxDQUFDO0FBQ0o7QUFFZTRFLDJFQUFZLEU7Ozs7Ozs7O0FDbER3QjtBQVNuRCxTQUFTRyxRQUFRLE9BQXlEO0VBQUEsSUFBdERqRyxNQUFNLFFBQU5BLE1BQU07SUFBRVEsYUFBYSxRQUFiQSxhQUFhO0lBQUVTLFFBQVEsUUFBUkEsUUFBUTtJQUFFQyxLQUFLLFFBQUxBLEtBQUs7RUFDeERsQixNQUFNLENBQUNDLEVBQUUsQ0FBQyx5QkFBeUIsRUFBRSxZQUFNO0lBQ3pDLElBQU1JLFVBQVUsR0FBR0wsTUFBTSxDQUFDSyxVQUFVLEVBQUU7SUFDdEMsSUFBSUEsVUFBVSxDQUFDcUQsTUFBTSxHQUFHLENBQUMsRUFBRTtNQUFBO01BQ3pCLElBQUl3QyxXQUFXLEdBQUcsQ0FBQyxDQUFDO01BQ3BCLEtBQUssSUFBSS9FLENBQUMsR0FBRyxDQUFDLEVBQUVBLENBQUMsR0FBR2QsVUFBVSxDQUFDcUQsTUFBTSxFQUFFdkMsQ0FBQyxJQUFJLENBQUMsRUFBRTtRQUM3QyxJQUFJZCxVQUFVLENBQUNjLENBQUMsQ0FBQyxDQUFDc0IsSUFBSSxLQUFLLFNBQVMsRUFBRTtVQUNwQ3lELFdBQVcsR0FBRy9FLENBQUM7UUFDakI7TUFDRjtNQUVBLElBQUkrRSxXQUFXLEtBQUssQ0FBQyxDQUFDLEVBQUU7UUFDdEJqRixRQUFRLENBQUM2QixhQUFhLENBQUNyRSxTQUFTLENBQUM7TUFDbkM7TUFFQSxJQUFNeUQsTUFBTSxzQkFBR2pCLFFBQVEsQ0FBQ0MsS0FBSyxvREFBZCxnQkFBaUJnRixXQUFXLENBQUM7TUFFNUNqRixRQUFRLENBQUM2QixhQUFhLENBQUNaLE1BQU0sQ0FBQztJQUNoQztFQUNGLENBQUMsQ0FBQztFQUVGbEMsTUFBTSxDQUFDbUcsR0FBRyxDQUFDLGdCQUFnQixFQUFFLFlBQU07SUFDakNsRixRQUFRLENBQUM2QixhQUFhLENBQUNyRSxTQUFTLENBQUM7SUFDakN1QixNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDb0MsSUFBSSxHQUFHLFFBQVE7SUFDbkNsRCxLQUFLLENBQUNDLElBQUksQ0FBQ1EsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQyxDQUFDWixPQUFPLENBQUMsVUFBQUMsS0FBSyxFQUFJO01BQy9DQSxLQUFLLENBQUMrQyxJQUFJLEdBQUcsUUFBUTtJQUN2QixDQUFDLENBQUM7SUFDRnpDLE1BQU0sQ0FBQytDLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQztFQUN4QyxDQUFDLENBQUM7RUFFRi9DLE1BQU0sQ0FBQ0MsRUFBRSxDQUFDLG1CQUFtQixFQUFFLFlBQU07SUFDbkN1RCxVQUFVLENBQUMsWUFBTTtNQUNqQixJQUFNbkQsVUFBVSxHQUFHZCxLQUFLLENBQUNDLElBQUksQ0FBQ1EsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQztNQUVsRGEsS0FBSyxDQUNGa0YsT0FBTyxFQUFFLENBQ1RwQixNQUFNLENBQ0wsVUFBQ3FCLElBQUksRUFBRUMsS0FBSyxFQUFFQyxJQUFJO1FBQUEsT0FDaEJELEtBQUssS0FBS0MsSUFBSSxDQUFDQyxTQUFTLENBQUMsVUFBQUMsQ0FBQztVQUFBLE9BQUlBLENBQUMsQ0FBQ2xHLEtBQUssS0FBSzhGLElBQUksQ0FBQzlGLEtBQUs7UUFBQSxFQUFDO01BQUEsRUFDeEQsQ0FDQWQsT0FBTyxDQUFDLFVBQUE0RyxJQUFJLEVBQUk7UUFDZixJQUFJQSxJQUFJLENBQUN0RSxRQUFRLEtBQUssS0FBSyxFQUFFO1VBQzNCLElBQUlzRSxJQUFJLENBQUNyRSxJQUFJLEVBQUU7WUFDYnFFLElBQUksQ0FBQ3JFLElBQUksQ0FBQ1MsSUFBSSxHQUFHLFFBQVE7VUFDM0I7VUFDQXBDLFVBQVUsQ0FBQ1osT0FBTyxDQUFDLFVBQUErQyxTQUFTLEVBQUk7WUFDOUIsSUFBSTZELElBQUksQ0FBQzlGLEtBQUssS0FBS2lDLFNBQVMsQ0FBQ2pDLEtBQUssRUFBRTtjQUNsQ2lDLFNBQVMsQ0FBQ0MsSUFBSSxHQUFHLFFBQVE7WUFDM0I7VUFDRixDQUFDLENBQUM7UUFDSixDQUFDLE1BQU07VUFDTCxJQUFJNEQsSUFBSSxDQUFDckUsSUFBSSxFQUFFO1lBQ2JxRSxJQUFJLENBQUNyRSxJQUFJLENBQUNTLElBQUksR0FBRyxTQUFTO1VBQzVCO1VBQ0FwQyxVQUFVLENBQUNaLE9BQU8sQ0FBQyxVQUFBK0MsU0FBUyxFQUFJO1lBQzlCLElBQUk2RCxJQUFJLENBQUM5RixLQUFLLEtBQUtpQyxTQUFTLENBQUNqQyxLQUFLLEVBQUU7Y0FDbENpQyxTQUFTLENBQUNDLElBQUksR0FBRyxTQUFTO1lBQzVCO1VBQ0YsQ0FBQyxDQUFDO1FBQ0Y7TUFDRixDQUFDLENBQUM7SUFDTixDQUFDLEVBQUUsQ0FBQyxDQUFDO0VBQ1AsQ0FBQyxDQUFDOztFQUVGO0VBQ0F6QyxNQUFNLENBQUNtRyxHQUFHLENBQUMsVUFBVSxFQUFFLFlBQU07SUFDM0JsRixRQUFRLENBQUM2QixhQUFhLENBQUNyRSxTQUFTLENBQUM7SUFDakN1QixNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDb0MsSUFBSSxHQUFHLFFBQVE7SUFDbkNsRCxLQUFLLENBQUNDLElBQUksQ0FBQ1EsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQyxDQUFDWixPQUFPLENBQUMsVUFBQUMsS0FBSyxFQUFJO01BQy9DQSxLQUFLLENBQUMrQyxJQUFJLEdBQUcsUUFBUTtJQUN2QixDQUFDLENBQUM7SUFDRnpDLE1BQU0sQ0FBQytDLE9BQU8sQ0FBQyxzQkFBc0IsQ0FBQzs7SUFFdEM7SUFDQS9DLE1BQU0sQ0FBQ21HLEdBQUcsQ0FBQyxVQUFVLEVBQUUsWUFBTTtNQUMzQmxGLFFBQVEsQ0FBQzZCLGFBQWEsQ0FBQ3JFLFNBQVMsQ0FBQztNQUNqQ3VCLE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUNvQyxJQUFJLEdBQUcsUUFBUTtNQUNuQ2xELEtBQUssQ0FBQ0MsSUFBSSxDQUFDUSxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDLENBQUNaLE9BQU8sQ0FBQyxVQUFBQyxLQUFLLEVBQUk7UUFDL0NBLEtBQUssQ0FBQytDLElBQUksR0FBRyxRQUFRO01BQ3ZCLENBQUMsQ0FBQztNQUNGekMsTUFBTSxDQUFDK0MsT0FBTyxDQUFDLHNCQUFzQixDQUFDO01BRXRDL0MsTUFBTSxDQUFDQyxFQUFFLENBQUMsVUFBVSxFQUFFLFlBQU07UUFDMUI7UUFDQSxJQUFNSSxVQUFVLEdBQUdkLEtBQUssQ0FBQ0MsSUFBSSxDQUFDUSxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDOztRQUVsRDtRQUNBLElBQUlBLFVBQVUsQ0FBQ3FELE1BQU0sR0FBRyxDQUFDLEVBQUU7VUFDekIsS0FBSyxJQUFJdkMsQ0FBQyxHQUFHLENBQUMsRUFBRUEsQ0FBQyxHQUFHZCxVQUFVLENBQUNxRCxNQUFNLEVBQUV2QyxDQUFDLElBQUksQ0FBQyxFQUFFO1lBQzdDO1lBQ0E7WUFDQSxJQUFJZCxVQUFVLENBQUNjLENBQUMsQ0FBQyxDQUFDc0IsSUFBSSxLQUFLLFVBQVUsRUFBRTtjQUNyQ3BDLFVBQVUsQ0FBQ2MsQ0FBQyxDQUFDLENBQUNzQixJQUFJLEdBQUcsUUFBUTtZQUMvQjtZQUVBLElBQU04QixNQUFNLEdBQUd2RSxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDYyxDQUFDLENBQUMsQ0FBQ3NCLElBQUksS0FBSyxTQUFTO1lBQ3hEO1lBQ0E7WUFDQTtZQUNBdkIsS0FBSyxDQUFDVSxJQUFJLENBQUM7Y0FDVEMsT0FBTyxFQUFFLGNBQWM7Y0FDdkJ0QixLQUFLLEVBQUVELG9CQUFZLENBQUM7Z0JBQ2xCQyxLQUFLLEVBQ0hGLFVBQVUsQ0FBQ2MsQ0FBQyxDQUFDLENBQUNaLEtBQUssSUFDbkJGLFVBQVUsQ0FBQ2MsQ0FBQyxDQUFDLENBQUN1RixJQUFJLElBQ2xCckcsVUFBVSxDQUFDYyxDQUFDLENBQUMsQ0FBQ3dELFFBQVE7Z0JBQ3hCbkUsYUFBYSxFQUFiQTtjQUNGLENBQUMsQ0FBQztjQUNGbUIsRUFBRSxZQUFLUixDQUFDLENBQUU7Y0FDVnlELEtBQUssRUFBRXZFLFVBQVUsQ0FBQ3FELE1BQU0sR0FBR3ZDLENBQUM7Y0FDNUJZLFFBQVEsRUFBRXdDLE1BQU07Y0FDaEJ6QyxVQUFVLEVBQUUsSUFBSTtjQUNoQkUsSUFBSSxFQUFFLGdEQUFLM0IsVUFBVSxDQUFDYyxDQUFDLENBQUM7Z0JBQUVRLEVBQUUsWUFBS1IsQ0FBQztjQUFFLEVBQUU7Y0FDdENjLFFBQVEsRUFBRSxrQkFBQ0QsSUFBSSxFQUFFRSxNQUFNLEVBQUs7Z0JBQzFCLElBQVFDLFdBQVcsR0FBS0QsTUFBTSxDQUF0QkMsV0FBVztnQkFDbkI7QUFDaEI7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7O2dCQUVnQjtnQkFDQWxCLFFBQVEsQ0FBQzZCLGFBQWEsQ0FBQ3JFLFNBQVMsQ0FBQztnQkFDakNjLEtBQUssQ0FBQ0MsSUFBSSxDQUFDUSxNQUFNLENBQUNLLFVBQVUsRUFBRSxDQUFDLENBQUNaLE9BQU8sQ0FBQyxVQUFDa0gsQ0FBQyxFQUFFTCxLQUFLLEVBQUs7a0JBQ3BEdEcsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ2lHLEtBQUssQ0FBQyxDQUFDN0QsSUFBSSxHQUFHLFFBQVE7Z0JBQzVDLENBQUMsQ0FBQzs7Z0JBRUY7Z0JBQ0EsSUFBSU4sV0FBVyxFQUFFO2tCQUNmSCxJQUFJLENBQUNTLElBQUksR0FBRyxRQUFRO2tCQUNwQnpDLE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUNvQyxJQUFJLEdBQUcsUUFBUTtrQkFDbkN6QyxNQUFNLENBQUMrQyxPQUFPLENBQUMsc0JBQXNCLENBQUM7a0JBQ3RDeEQsS0FBSyxDQUFDQyxJQUFJLENBQUNRLE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUMsQ0FBQ1osT0FBTyxDQUFDLFVBQUFDLEtBQUssRUFBSTtvQkFDL0NBLEtBQUssQ0FBQytDLElBQUksR0FBRyxRQUFRO2tCQUN2QixDQUFDLENBQUM7a0JBRUYsSUFBSTtvQkFDRjtvQkFDQSxJQUFJekMsTUFBTSxDQUFDNEcsT0FBTyxFQUFFO3NCQUNsQjtzQkFDQTtzQkFDQTVHLE1BQU0sQ0FBQzRHLE9BQU8sQ0FBQzt3QkFDYjt3QkFDQSwyQkFBMkIsRUFBRSxLQUFLO3dCQUNsQzt3QkFDQSxtQkFBbUIsRUFBRTtzQkFDdkIsQ0FBQyxDQUFDO29CQUNKO2tCQUNGLENBQUMsQ0FBQyxPQUFPL0QsQ0FBQyxFQUFFO29CQUNWO2tCQUFBO2tCQUdGN0MsTUFBTSxDQUFDK0MsT0FBTyxDQUFDLG1CQUFtQixDQUFDO2tCQUNuQztnQkFDRjs7Z0JBRUE7Z0JBQ0E5QixRQUFRLENBQUM2QixhQUFhLENBQUNaLE1BQU0sQ0FBQzs7Z0JBRTlCO2dCQUNBbEMsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ29DLElBQUksR0FBRyxTQUFTOztnQkFFcEM7Z0JBQ0EsSUFBTUUsT0FBTyxHQUFHckUsTUFBTSxDQUFDNEQsTUFBTSxDQUFDVSxRQUFRLENBQUNqQixFQUFFLENBQUM7Z0JBQzFDLElBQUlnQixPQUFPLEtBQUtsRSxTQUFTLEVBQUU7a0JBQ3pCdUIsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ3NDLE9BQU8sQ0FBQyxDQUFDRixJQUFJLEdBQUcsU0FBUztnQkFDL0M7Z0JBQ0FULElBQUksQ0FBQ1MsSUFBSSxHQUFHLFNBQVM7Z0JBRXJCLElBQUk7a0JBQ0Y7a0JBQ0EsSUFBSXpDLE1BQU0sQ0FBQzRHLE9BQU8sRUFBRTtvQkFDbEI7b0JBQ0E7b0JBQ0E1RyxNQUFNLENBQUM0RyxPQUFPLENBQUM7c0JBQ2I7c0JBQ0EsMkJBQTJCLEVBQ3pCNUcsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ3NDLE9BQU8sQ0FBQyxDQUFDZ0MsUUFBUSxJQUNyQzNFLE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUNzQyxPQUFPLENBQUMsQ0FBQ3BDLEtBQUs7c0JBQ3BDO3NCQUNBLG1CQUFtQixFQUNqQlAsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ3NDLE9BQU8sQ0FBQyxDQUFDZ0MsUUFBUSxJQUNyQzNFLE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUNzQyxPQUFPLENBQUMsQ0FBQ3BDO29CQUNqQyxDQUFDLENBQUM7a0JBQ0o7Z0JBQ0YsQ0FBQyxDQUFDLE9BQU9zQyxDQUFDLEVBQUU7a0JBQ1Y7Z0JBQUE7Y0FFSjtZQUNGLENBQUMsQ0FBQztVQUNKO1VBRUEzQixLQUFLLEdBQUdBLEtBQUssQ0FBQzhELE1BQU0sQ0FDbEIsVUFBQ3FCLElBQUksRUFBRUMsS0FBSyxFQUFFQyxJQUFJO1lBQUEsT0FDaEJELEtBQUssS0FBS0MsSUFBSSxDQUFDQyxTQUFTLENBQUMsVUFBQUMsQ0FBQztjQUFBLE9BQUlBLENBQUMsQ0FBQ2xHLEtBQUssS0FBSzhGLElBQUksQ0FBQzlGLEtBQUs7WUFBQSxFQUFDO1VBQUEsRUFDeEQ7VUFFRFUsUUFBUSxDQUFDNEMsUUFBUSxDQUFDM0MsS0FBSyxFQUFFLElBQUksQ0FBQztRQUNoQztNQUNGLENBQUMsQ0FBQztJQUNKLENBQUMsQ0FBQztFQUNKLENBQUMsQ0FBQztFQUVGbEIsTUFBTSxDQUFDbUcsR0FBRyxDQUFDLE1BQU0sRUFBRSxZQUFNO0lBQ3ZCbEYsUUFBUSxDQUFDNkIsYUFBYSxDQUFDckUsU0FBUyxDQUFDO0lBQ2pDdUIsTUFBTSxDQUFDSyxVQUFVLEVBQUUsQ0FBQ29DLElBQUksR0FBRyxRQUFRO0lBQ25DbEQsS0FBSyxDQUFDQyxJQUFJLENBQUNRLE1BQU0sQ0FBQ0ssVUFBVSxFQUFFLENBQUMsQ0FBQ1osT0FBTyxDQUFDLFVBQUFDLEtBQUssRUFBSTtNQUMvQ0EsS0FBSyxDQUFDK0MsSUFBSSxHQUFHLFFBQVE7SUFDdkIsQ0FBQyxDQUFDO0lBQ0Z6QyxNQUFNLENBQUMrQyxPQUFPLENBQUMsc0JBQXNCLENBQUM7RUFDeEMsQ0FBQyxDQUFDO0FBQ0o7QUFFZWtELG1FQUFRLEU7Ozt5REN0T3ZCO0FBQUE7QUFBQTtBQURpRDtBQUNQO0FBQ1I7QUFDRztBQXVCckMsU0FBU1ksVUFBVSxPQUFrRDtFQUFBLElBQS9DN0csTUFBTSxRQUFOQSxNQUFNO0lBQUU4RyxJQUFJLFFBQUpBLElBQUk7SUFBRTdGLFFBQVEsUUFBUkEsUUFBUTtJQUFFbkMsT0FBTyxRQUFQQSxPQUFPO0VBQ25Ea0IsTUFBTSxDQUFDQyxFQUFFLENBQ1AsbUNBQW1DO0lBQUEsMkZBQ25DLGlCQUFPa0UsS0FBSyxFQUFFM0QsYUFBNEI7TUFBQTtNQUFBO01BQUE7UUFBQTtVQUFBO1lBQUE7Y0FDeEM7Y0FDQXVHLE9BQU8sQ0FBQ0MsS0FBSyxDQUFDLGlDQUFpQyxDQUFDOztjQUVoRDtjQUNBL0YsUUFBUSxDQUFDNkIsYUFBYSxDQUFDckUsU0FBUyxDQUFDO2NBRTNCd0ksV0FBVyxHQUFHSCxJQUFJLENBQUMzRyxFQUFFLEVBQUU7Y0FFdkIrRyxPQUFPLEdBQUdELFdBQVcsYUFBWEEsV0FBVyw2Q0FBWEEsV0FBVyxDQUFFRSxLQUFLLHVEQUFsQixtQkFBb0JELE9BQU87Y0FFM0MsSUFBSTtnQkFDRkQsV0FBVyxDQUFDRSxLQUFLLENBQUNELE9BQU8sR0FBRyxNQUFNO2NBQ3BDLENBQUMsQ0FBQyxPQUFPckUsQ0FBQyxFQUFFO2dCQUNWO2NBQUE7Y0FHSTNCLEtBQXFCLEdBQUcsRUFBRSxFQUNoQztjQUFBO2NBQUEsT0FDTUYsbUJBQVcsQ0FBQztnQkFDaEJoQixNQUFNLEVBQU5BLE1BQU07Z0JBQ05RLGFBQWEsRUFBYkEsYUFBYTtnQkFDYlMsUUFBUSxFQUFSQSxRQUFRO2dCQUNSQyxLQUFLLEVBQUxBLEtBQUs7Z0JBQ0xwQyxPQUFPLEVBQVBBO2NBQ0YsQ0FBQyxDQUFDO1lBQUE7Y0FFRixJQUFJO2dCQUNGbUksV0FBVyxDQUFDRSxLQUFLLENBQUNELE9BQU8sR0FBR0EsT0FBTyxJQUFJLE9BQU87Y0FDaEQsQ0FBQyxDQUFDLE9BQU9yRSxDQUFDLEVBQUU7Z0JBQ1Y7Y0FBQTs7Y0FHRjtjQUNBa0UsT0FBTyxDQUFDQyxLQUFLLENBQUMsOEJBQThCLENBQUM7Y0FFN0MsSUFBSXRJLGFBQUssRUFBRSxFQUFFO2dCQUNYO2dCQUNBdUgsc0JBQVEsQ0FBQztrQkFDUGpHLE1BQU0sRUFBTkEsTUFBTTtrQkFDTlEsYUFBYSxFQUFiQSxhQUFhO2tCQUNiUyxRQUFRLEVBQVJBLFFBQVE7a0JBQ1JDLEtBQUssRUFBTEE7Z0JBQ0YsQ0FBQyxDQUFDO2NBQ0osQ0FBQyxNQUFNO2dCQUNMO2dCQUNBNEUsMEJBQVksQ0FBQztrQkFDWDlGLE1BQU0sRUFBTkEsTUFBTTtrQkFDTlEsYUFBYSxFQUFiQSxhQUFhO2tCQUNiUyxRQUFRLEVBQVJBLFFBQVE7a0JBQ1JDLEtBQUssRUFBTEE7Z0JBQ0YsQ0FBQyxDQUFDO2NBQ0o7WUFBQztZQUFBO2NBQUE7VUFBQTtRQUFBO01BQUE7SUFBQSxDQUNGO0lBQUE7TUFBQTtJQUFBO0VBQUEsSUFDRjtFQUVEbEIsTUFBTSxDQUFDb0gsS0FBSyxDQUFDLFlBQU07SUFDakIsSUFBSSxDQUFDcEgsTUFBTSxDQUFDcUYsVUFBVSxDQUFDZ0Msa0JBQWtCLEVBQUU7TUFDekM7TUFDQSxJQUFNQyxXQUFXLEdBQUdSLElBQUksQ0FBQzNHLEVBQUUsRUFBRTtNQUM3Qm1ILFdBQVcsQ0FBQ0MsZ0JBQWdCLENBQUMsV0FBVyxFQUFFLFVBQUFwRCxLQUFLLEVBQUk7UUFDakQyQyxJQUFJLENBQUNVLFdBQVcsQ0FBQ3JELEtBQUssRUFBRSxJQUFJLENBQUM7TUFDL0IsQ0FBQyxDQUFDO01BQ0ZtRCxXQUFXLENBQUNDLGdCQUFnQixDQUFDLFVBQVUsRUFBRSxVQUFBcEQsS0FBSyxFQUFJO1FBQ2hEMkMsSUFBSSxDQUFDVSxXQUFXLENBQUNyRCxLQUFLLEVBQUUsSUFBSSxDQUFDO01BQy9CLENBQUMsQ0FBQztJQUNKO0VBQ0YsQ0FBQyxDQUFDO0FBQ0o7QUFFZTBDLHVFQUFVLEU7O0FDbkcyQjtBQVNwRCxTQUFTWSxxQkFBcUIsT0FBa0M7RUFBQSxJQUEvQnpILE1BQU0sUUFBTkEsTUFBTTtJQUFFbEIsT0FBTyxRQUFQQSxPQUFPO0VBQzlDO0FBQ0Y7QUFDQTtBQUNBO0FBQ0E7RUFDRSxJQUFNRSxjQUFjLEdBQUdILHlCQUFpQixDQUFDQyxPQUFPLENBQUM7RUFDakQsSUFBUTRJLFFBQVEsR0FBa0IxSSxjQUFjLENBQXhDMEksUUFBUTtJQUFFQyxXQUFXLEdBQUszSSxjQUFjLENBQTlCMkksV0FBVztFQUU3QixJQUFNQyxZQUFZLEdBQUd4RSxRQUFRLENBQUNDLGFBQWEsQ0FBQyxPQUFPLENBQUM7RUFDcER1RSxZQUFZLENBQUNDLFdBQVcsS0FBSztFQUM3QixJQUFJSCxRQUFRLEVBQUU7SUFDWkUsWUFBWSxDQUFDQyxXQUFXLGVBQVE3SCxNQUFNLENBQUMyQixFQUFFLEVBQUUsMEJBQWdCK0YsUUFBUSxNQUFHO0VBQ3hFO0VBQ0EsSUFBSUMsV0FBVyxFQUFFO0lBQ2ZDLFlBQVksQ0FBQ0MsV0FBVyxlQUFRN0gsTUFBTSxDQUFDMkIsRUFBRSxFQUFFLGlDQUF1QmdHLFdBQVcsTUFBRztFQUNsRjtFQUVBdkUsUUFBUSxDQUFDMEUsSUFBSSxDQUFDQyxXQUFXLENBQUNILFlBQVksQ0FBQztBQUN6QztBQUVlSCx1RkFBcUIsRTs7QUM5QjBEO0FBQzFDO0FBQ2dCO0FBUXBFLFNBQVNPLGNBQWMsQ0FDckJoSSxNQUFxQixFQUNyQmxCLE9BQStCLEVBQ3ZCO0VBQ1IySSw2QkFBcUIsQ0FBQztJQUFFekgsTUFBTSxFQUFOQSxNQUFNO0lBQUVsQixPQUFPLEVBQVBBO0VBQVEsQ0FBQyxDQUFDOztFQUUxQztBQUNGO0FBQ0E7QUFDQTtBQUNBOztFQUVFLElBQU1nSSxJQUFZLEdBQUcsSUFBSTNILE9BQU8sQ0FBQzhJLElBQUksQ0FBQ0MsU0FBUyxDQUFDbEksTUFBTSxFQUFFbEIsT0FBTyxDQUFDOztFQUVoRTtFQUNBZ0ksSUFBSSxDQUFDcUIsUUFBUSxDQUFDLG1CQUFtQixDQUFDOztFQUVsQztFQUNBLElBQU1sSCxRQUFRLEdBQUc2RixJQUFJLENBQUNzQixRQUFRLENBQUM7SUFDN0J2RyxPQUFPLEVBQUUsYUFBYTtJQUN0QkYsRUFBRSxFQUFFLGFBQWE7SUFDakIwRyxLQUFLLEVBQUUsaUJBQWlCO0lBQ3hCQyxRQUFRLEVBQUU7RUFDWixDQUFDLENBQUM7RUFFRnZJLDZDQUErQixDQUFDO0lBQUVDLE1BQU0sRUFBTkEsTUFBTTtJQUFFbEIsT0FBTyxFQUFQQTtFQUFRLENBQUMsQ0FBQztFQUNwRCtILHdCQUFVLENBQUM7SUFBRTdHLE1BQU0sRUFBTkEsTUFBTTtJQUFFOEcsSUFBSSxFQUFKQSxJQUFJO0lBQUU3RixRQUFRLEVBQVJBLFFBQVE7SUFBRW5DLE9BQU8sRUFBUEE7RUFBUSxDQUFDLENBQUM7RUFFL0MsT0FBT2dJLElBQUk7QUFDYjtBQUVla0IscUVBQWMsRTs7QUN6Q2lCO0FBSTlDLElBQU1PLEdBQWUsR0FBSUMsT0FBaUM7QUFDMUQsSUFBTUMsU0FBUyxHQUFHRixHQUFHLENBQUNHLFlBQVksQ0FBQyxXQUFXLENBQUM7QUFFL0MsSUFBTUMsY0FBYyxHQUFHSixHQUFHLENBQUNLLE1BQU0sQ0FBQ0gsU0FBUyxFQUFFO0VBQzNDSSxXQUFXLEVBQUViLGtCQUFjQTtBQUM3QixDQUFDLENBQUM7QUFFRjdJLE9BQU8sQ0FBQzJILElBQUksQ0FBd0IsZ0JBQWdCLEVBQUU2QixjQUFjLENBQUM7QUFFdERBLHVGQUFjIiwiZmlsZSI6IjEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgZnVuY3Rpb24gaXNOZXdJT1MoKTogYm9vbGVhbiB7XG4gIGNvbnN0IHsgdXNlckFnZW50IH0gPSBuYXZpZ2F0b3I7XG4gIGNvbnN0IGlwaG9uZUFnZW50TWF0Y2hlcyA9IHVzZXJBZ2VudC5tYXRjaCgnaVBob25lIE9TIC4uXz8uPycpO1xuXG4gIGlmIChpcGhvbmVBZ2VudE1hdGNoZXMgJiYgaXBob25lQWdlbnRNYXRjaGVzWzBdKSB7XG4gICAgY29uc3QgaU9TVmVyc2lvbiA9IGlwaG9uZUFnZW50TWF0Y2hlc1swXVxuICAgICAgLnRyaW0oKVxuICAgICAgLnNwbGl0KCcgJylcbiAgICAgIC5wb3AoKSBhcyBzdHJpbmc7XG5cbiAgICBpZiAoaU9TVmVyc2lvbikge1xuICAgICAgY29uc3QgW21ham9yVmVyc2lvbiwgbWlub3JWZXJzaW9uXSA9IGlPU1ZlcnNpb25cbiAgICAgICAgLnNwbGl0KCdfJylcbiAgICAgICAgLm1hcChzdHJpbmdOdW0gPT4gTnVtYmVyKHN0cmluZ051bSkpO1xuXG4gICAgICBpZiAobWFqb3JWZXJzaW9uIDwgMTcpIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgfVxuXG4gICAgICBpZiAoXG4gICAgICAgIG1ham9yVmVyc2lvbiA9PT0gMTcgJiZcbiAgICAgICAgKG1pbm9yVmVyc2lvbiA9PT0gMCB8fCBtaW5vclZlcnNpb24gPT09IHVuZGVmaW5lZClcbiAgICAgICkge1xuICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICB9XG5cbiAgICAgIGlmIChtYWpvclZlcnNpb24gPT09IDE3ICYmIG1pbm9yVmVyc2lvbiA+IDApIHtcbiAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICB9XG5cbiAgICAgIGlmIChtYWpvclZlcnNpb24gPiAxNykge1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgIH1cbiAgICB9XG4gIH1cblxuICByZXR1cm4gZmFsc2U7XG59XG5cbmZ1bmN0aW9uIGlzSU9TKCk6IGJvb2xlYW4ge1xuICAvLyBpbiB0aGUgbmV3ICdpUGFkIE9TJyB0aGUgVUEgbWlycm9ycyB0aGUgZGVza3RvcCwgc28gd2UgaGF2ZSB0byBjaGVjayBmb3IgTWFjIGFuZCB0aGVuIGlmXG4gIC8vIHdlJ3JlIHVzaW5nIGEgdG91Y2ggc2NyZWVuLiBUaGlzIGlzIHdvcmsgdW50aWwgQXBwbGUgY29tZXMgb3V0IHdpdGggYSB0b3VjaCBzY3JlZW4gbGFwdG9wIDp8XG4gIGNvbnN0IHsgdXNlckFnZW50IH0gPSBuYXZpZ2F0b3I7XG4gIC8vIGNvbnN0IGlzSXBhZCA9XG4gIC8vICAgdXNlckFnZW50LmluZGV4T2YoJ2lQYWQnKSAhPT0gLTEgfHxcbiAgLy8gICAodXNlckFnZW50LmluZGV4T2YoJ01hY2ludG9zaCcpICE9PSAtMSAmJiAnb250b3VjaGVuZCcgaW4gZG9jdW1lbnQpO1xuXG4gIGNvbnN0IGlzSXBob25lID1cbiAgICB1c2VyQWdlbnQuaW5kZXhPZignaVBob25lJykgIT09IC0xIHx8IHVzZXJBZ2VudC5pbmRleE9mKCdpUG9kJykgIT09IC0xO1xuXG4gIC8vIGNvbnN0IGlzSW9zID0gaXNJcGhvbmUgfHwgaXNJcGFkO1xuXG4gIC8vIGlQYWQgbm93IGhhbmRsZXMgY2FwdGlvbnMgbGlrZSBhIGRlc2t0b3AgYnJvd3NlclxuICByZXR1cm4gaXNJcGhvbmU7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGlzSU9TO1xuIiwiaW1wb3J0IHsgU2FyZGl1c0pzUGxheWVyT3B0aW9ucywgQ2FwdGlvbk9wdGlvbnMgfSBmcm9tICdjb21tb24vdHNNb2RlbHMnO1xuaW1wb3J0IGlzSU9TIGZyb20gJy4vaXNJT1MnO1xuXG5mdW5jdGlvbiBnZXRDYXB0aW9uT3B0aW9ucyhvcHRpb25zOiBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zKTogQ2FwdGlvbk9wdGlvbnMge1xuICBjb25zdCBkZWZhdWx0T3B0aW9uczogQ2FwdGlvbk9wdGlvbnMgPSB7fTtcblxuICBsZXQgY2FwdGlvbk9wdGlvbnM6IENhcHRpb25PcHRpb25zID1cbiAgICBvcHRpb25zPy5wbGF5ZXJPcHRpb25zPy5wbHVnaW5zPy5zYXJkaXVzPy5jYXB0aW9uT3B0aW9ucyB8fCBkZWZhdWx0T3B0aW9ucztcblxuICBpZiAoaXNJT1MoKSkge1xuICAgIGNhcHRpb25PcHRpb25zID0ge1xuICAgICAgLi4uY2FwdGlvbk9wdGlvbnMsXG4gICAgICAuLi4oY2FwdGlvbk9wdGlvbnMuaU9TIHx8IGRlZmF1bHRPcHRpb25zKSxcbiAgICB9O1xuICB9XG5cbiAgcmV0dXJuIGNhcHRpb25PcHRpb25zO1xufVxuXG5leHBvcnQgZGVmYXVsdCBnZXRDYXB0aW9uT3B0aW9ucztcbiIsImltcG9ydCB7IENhcHRpb25PcHRpb25zLCBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zIH0gZnJvbSAnY29tbW9uL3RzTW9kZWxzJztcbmltcG9ydCBnZXRDYXB0aW9uT3B0aW9ucyBmcm9tICcuL2dldENhcHRpb25PcHRpb25zJztcblxuLy8gVE9ETzogRmlndXJlIG91dCB0eXBlcyBvbiB0aGlzIGZpbGVcblxuZnVuY3Rpb24gb3ZlcnJpZGVUcmFja1NldHRpbmdzKFxuICBhbGxUcmFja3M6IEhUTUxUcmFja0VsZW1lbnRbJ3RyYWNrJ11bXSxcbiAgb3B0aW9uczogU2FyZGl1c0pzUGxheWVyT3B0aW9ucyxcbik6IEhUTUxUcmFja0VsZW1lbnRbJ3RyYWNrJ11bXSB7XG4gIGNvbnN0IGNhcHRpb25PcHRpb25zID0gZ2V0Q2FwdGlvbk9wdGlvbnMob3B0aW9ucyk7XG5cbiAgQXJyYXkuZnJvbShhbGxUcmFja3MpLmZvckVhY2godHJhY2sgPT4ge1xuICAgIGlmICh0cmFjay5jdWVzKSB7XG4gICAgICBjb25zdCBjdWVzID0gQXJyYXkuZnJvbSh0cmFjay5jdWVzKTtcbiAgICAgIGN1ZXMuZm9yRWFjaChjdWUgPT4ge1xuICAgICAgICBpZiAoY2FwdGlvbk9wdGlvbnMpIHtcbiAgICAgICAgICBbJ2FsaWduJywgJ2xpbmUnLCAncG9zaXRpb24nLCAnc2l6ZScsICdzbmFwVG9MaW5lcyddLmZvckVhY2goa2V5ID0+IHtcbiAgICAgICAgICAgIGNvbnN0IHVzZUtleSA9IGtleSBhcyBrZXlvZiBDYXB0aW9uT3B0aW9ucztcbiAgICAgICAgICAgIGlmIChjYXB0aW9uT3B0aW9uc1t1c2VLZXldICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICBjdWVba2V5IGFzIGtleW9mIHR5cGVvZiBjdWVdID0gY2FwdGlvbk9wdGlvbnNbdXNlS2V5XTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgfVxuICB9KTtcblxuICByZXR1cm4gYWxsVHJhY2tzO1xufVxuXG5leHBvcnQgZGVmYXVsdCBvdmVycmlkZVRyYWNrU2V0dGluZ3M7XG4iLCJpbXBvcnQgb3ZlcnJpZGVUcmFja1NldHRpbmdzIGZyb20gJy4uL2hlbHBlcnMvb3ZlcnJpZGVUcmFja1NldHRpbmdzJztcbmltcG9ydCB7IFNhcmRpdXNKc1BsYXllck9wdGlvbnMsIFZpZGVvSnNQbGF5ZXIgfSBmcm9tICdjb21tb24vdHNNb2RlbHMnO1xuXG5pbnRlcmZhY2UgQXJncyB7XG4gIHBsYXllcjogVmlkZW9Kc1BsYXllcjtcbiAgb3B0aW9uczogU2FyZGl1c0pzUGxheWVyT3B0aW9ucztcbn1cblxuZnVuY3Rpb24gcHJvZ3Jlc3NPdmVycmlkZUNhcHRpb25TZXR0aW5ncyh7IHBsYXllciwgb3B0aW9ucyB9OiBBcmdzKTogdm9pZCB7XG4gIHBsYXllci5vbigncHJvZ3Jlc3MnLCAoKSA9PiB7XG4gICAgY29uc3QgdmlkZW9zID0gcGxheWVyLmVsKCkuZ2V0RWxlbWVudHNCeVRhZ05hbWUoJ3ZpZGVvJyk7XG4gICAgaWYgKHZpZGVvcyAmJiB2aWRlb3NbMF0pIHtcbiAgICAgIGNvbnN0IGFsbFRyYWNrcyA9IHZpZGVvc1swXS50ZXh0VHJhY2tzO1xuXG4gICAgICBvdmVycmlkZVRyYWNrU2V0dGluZ3MoQXJyYXkuZnJvbShhbGxUcmFja3MpLCBvcHRpb25zKTtcbiAgICB9XG4gIH0pO1xufVxuXG5leHBvcnQgZGVmYXVsdCBwcm9ncmVzc092ZXJyaWRlQ2FwdGlvblNldHRpbmdzO1xuIiwiaW1wb3J0IHsgU291cmNlSGFuZGxlciB9IGZyb20gJ2NvbW1vbi90c01vZGVscyc7XG5cbmludGVyZmFjZSBBcmdzIHtcbiAgbGFiZWw/OiBzdHJpbmc7XG4gIHNvdXJjZUhhbmRsZXI/OiBTb3VyY2VIYW5kbGVyO1xufVxuXG4vLyB1c2UgcGxheWVyIHNwZWNpZmljIGxhYmVscyBpZiBhdmFpbGFibGVcbmZ1bmN0aW9uIGdldE1lbnVMYWJlbCh7IGxhYmVsLCBzb3VyY2VIYW5kbGVyIH06IEFyZ3MpOiBzdHJpbmcge1xuICBsZXQgZGVmYXVsdExhYmVsID0gbGFiZWw7XG5cbiAgLy8gaWYgdGhlIGxhYmVsIHdlIGhhdmUgaXMgZWl0aGVyIGVtcHR5IG9yIGlzIGFuIHVuZGVmaW5lZCB2YWx1ZSwgc2V0IHRoZSBsYWJlbCB0byAnY2FwdGlvbnMnXG4gIC8vIHRoaXMgZGVmYXVsdCBsYWJlbCBjYW4gYmUgb3ZlcnJpZGRlbiB2aWEgcGxheWVyIGNvbnRyb2xzXG4gIGlmIChkZWZhdWx0TGFiZWwgPT09ICcnIHx8IHR5cGVvZiBkZWZhdWx0TGFiZWwgPT09ICd1bmRlZmluZWQnKSB7XG4gICAgZGVmYXVsdExhYmVsID0gJ2NhcHRpb25zJztcbiAgfVxuXG4gIC8vIGdldCBvdXIgcGxheWVyJ3MgbGFiZWxzXG4gIGNvbnN0IG1lbnVMYWJlbHMgPSBzb3VyY2VIYW5kbGVyPy5vcHRpb25zPy5sYWJlbHM7XG4gIGNvbnN0IGNsZWFuTGFiZWwgPSBkZWZhdWx0TGFiZWwudG9Mb3dlckNhc2UoKS5yZXBsYWNlKC9bXmEtejAtOV0rL2dpLCAnJyk7XG5cbiAgLy8gc3dhcCBsYWJlbHMgaWYgd2UgaGF2ZSBvbmUgZnJvbSB0aGUgcGxheWVyIHNldHRpbmdzXG4gIGlmICh0eXBlb2YgbWVudUxhYmVscz8uW2NsZWFuTGFiZWxdICE9PSAndW5kZWZpbmVkJykge1xuICAgIGRlZmF1bHRMYWJlbCA9IG1lbnVMYWJlbHNbY2xlYW5MYWJlbF07XG4gIH1cblxuICBpZiAoY2xlYW5MYWJlbCA9PT0gJ2lkMycpIHtcbiAgICBkZWZhdWx0TGFiZWwgPSAnJztcbiAgfVxuXG4gIHJldHVybiBkZWZhdWx0TGFiZWw7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGdldE1lbnVMYWJlbDtcbiIsImZ1bmN0aW9uIGlzRmlyZWZveCgpOiBib29sZWFuIHtcbiAgY29uc3QgeyB1c2VyQWdlbnQgfSA9IG5hdmlnYXRvcjtcblxuICBjb25zdCBpc0ZpcmVmb3ggPSB1c2VyQWdlbnQudG9Mb3dlckNhc2UoKS5pbmRleE9mKCdmaXJlZm94JykgIT09IC0xO1xuXG4gIHJldHVybiBpc0ZpcmVmb3g7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGlzRmlyZWZveDtcbiIsImltcG9ydCBvdmVycmlkZVRyYWNrU2V0dGluZ3MgZnJvbSAnLi9vdmVycmlkZVRyYWNrU2V0dGluZ3MnO1xuaW1wb3J0IGdldE1lbnVMYWJlbCBmcm9tICcuL2dldE1lbnVMYWJlbCc7XG5pbXBvcnQge1xuICBWaWRlb0pzUGxheWVyLFxuICBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zLFxuICBTb3VyY2VIYW5kbGVyLFxuICBTUEdyb3VwLFxuICBTUEl0ZW1PYmplY3QsXG4gIFRleHRUcmFja09wdGlvbnMsXG59IGZyb20gJ2NvbW1vbi90c01vZGVscyc7XG5pbXBvcnQgaXNJT1MgZnJvbSAnLi9pc0lPUyc7XG5pbXBvcnQgaXNGaXJlZm94IGZyb20gJy4vaXNGaXJlZm94JztcblxuaW50ZXJmYWNlIEFyZ3Mge1xuICBwbGF5ZXI6IFZpZGVvSnNQbGF5ZXI7XG4gIHNvdXJjZUhhbmRsZXI6IFNvdXJjZUhhbmRsZXI7XG4gIGNhcHRpb25zOiBTUEdyb3VwO1xuICBvcHRpb25zOiBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zO1xuICBpdGVtczogU1BJdGVtT2JqZWN0W107XG59XG5cbi8vIGZ1bmN0aW9uIHRvIHNldHVwIHZ0dCB0ZXh0IHRyYWNrcyBkZWxpdmVyZWQgd2l0aCBhbiBhc3NldCBmcm9tIHRoZSBPVlBcbmFzeW5jIGZ1bmN0aW9uIHNldENhcHRpb25zKHtcbiAgcGxheWVyLFxuICBzb3VyY2VIYW5kbGVyLFxuICBjYXB0aW9ucyxcbiAgb3B0aW9ucyxcbiAgaXRlbXMsXG59OiBBcmdzKTogUHJvbWlzZTx2b2lkPiB7XG4gIC8vIGNhcHRpb25zIHdpbGwgYmUgc2V0IG9uIHRoZSBhc3NldCwgd2UgY2hlY2sgdG8gc2VlIGlmIHdlIGhhdmUgYW55IGFuZCB0aGVuIHByb2NlZWRcbiAgaWYgKHNvdXJjZUhhbmRsZXIuY2FwdGlvbnMpIHtcbiAgICBmb3IgKGxldCBpID0gMDsgaSA8IHNvdXJjZUhhbmRsZXIuY2FwdGlvbnMubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgIGNvbnN0IHJlbW90ZUNhcHRpb25UcmFjayA9IHNvdXJjZUhhbmRsZXIuY2FwdGlvbnNbaV07XG5cbiAgICAgIC8vIHNldCB1cCBhIHJlbW90ZSB0ZXh0IHRyYWNrIHRvIGFkZCB0byB0aGlzIHBsYXllclxuICAgICAgY29uc3QgcmVtb3RlVHJhY2s6IFRleHRUcmFja09wdGlvbnMgPSB7XG4gICAgICAgIGtpbmQ6ICdjYXB0aW9ucycsXG4gICAgICAgIGxhYmVsOiBnZXRNZW51TGFiZWwoe1xuICAgICAgICAgIGxhYmVsOiByZW1vdGVDYXB0aW9uVHJhY2subGFiZWwsXG4gICAgICAgICAgc291cmNlSGFuZGxlcixcbiAgICAgICAgfSksXG4gICAgICAgIHNyY2xhbmc6IHJlbW90ZUNhcHRpb25UcmFjay5sYWJlbD8udG9Mb3dlckNhc2U/LigpLFxuICAgICAgICBzcmM6IHJlbW90ZUNhcHRpb25UcmFjay5maWxlLFxuICAgICAgfTtcblxuICAgICAgLy8gYWRkIHRvIHBsYXllclxuICAgICAgcGxheWVyLmFkZFJlbW90ZVRleHRUcmFjayhyZW1vdGVUcmFjaywgdHJ1ZSk7XG5cbiAgICAgIC8vIHJlY29yZCB0aGUgaWQgZm9yIHVzZSBpbiB0cmFjayBzd2l0Y2hpbmdcbiAgICAgIHJlbW90ZUNhcHRpb25UcmFjay5pZCA9IGk7XG5cbiAgICAgIGl0ZW1zLnB1c2goe1xuICAgICAgICBjbGFzc2VzOiAnc3AtbWVudS1pdGVtJyxcbiAgICAgICAgbGFiZWw6IGdldE1lbnVMYWJlbCh7IGxhYmVsOiByZW1vdGVDYXB0aW9uVHJhY2subGFiZWwsIHNvdXJjZUhhbmRsZXIgfSksXG4gICAgICAgIHNlbGVjdGFibGU6IHRydWUsXG4gICAgICAgIGlzQWN0aXZlOiBmYWxzZSxcbiAgICAgICAgaWQ6IGAke2l9YCxcbiAgICAgICAgZGF0YTogcmVtb3RlQ2FwdGlvblRyYWNrLFxuICAgICAgICAvLyBXb3JraW5nIHNpZGVjYXIgY2FwdGlvbnNcbiAgICAgICAgY2FsbGJhY2s6IChkYXRhLCBidXR0b24pID0+IHtcbiAgICAgICAgICBjb25zdCBpT1MgPSBpc0lPUygpO1xuICAgICAgICAgIGNvbnN0IHsgaXNTZWxlY3RlZF8gfSA9IGJ1dHRvbjtcbiAgICAgICAgICAvKlxuICAgICAgICAgICAgRm9yIHJlbW90ZSB0ZXh0IHRyYWNrcyB3ZSBuZWVkIHRvIG1hbmFnZSBib3RoIHRoZSB0ZXh0IHRyYWNrcyBhcyBhICd3aG9sZScgYW5kIGVhY2hcbiAgICAgICAgICAgIGluZGl2aWR1YWwgdGV4dCB0cmFjay4gU28gd2hlbiB3ZSB0dXJuIG9uL29mZiBhIHRyYWNrIHdlIGhhdmUgdG8gdHVybiBvbi9vZmYgdGV4dFxuICAgICAgICAgICAgdHJhY2tzIGFuZCB0aGVuIHR1cm4gb24vb2ZmIHRoYXQgc3BlY2lmaWMgdHJhY2suIFRoaXMgaXMgbWFuYWdlZCB0aHJvdWdoIHRoZSBhdHRyLlxuICAgICAgICAgICAgJ21vZGUnIHdoaWNoIGNhbiBoYXZlIHRoZXNlIHZhbHVlczogc2hvd2luZywgZGlzYWJsZWQsIGhpZGRlbi4gRm9yIG91ciB1c2UgY2FzZSB3ZVxuICAgICAgICAgICAganVzdCBzaG93IGFuZCBkaXNhYmxlLlxuICAgICAgICAgICovXG4gICAgICAgICAgY29uc3QgdmlkZW9FbGVtZW50ID0gcGxheWVyLmVsKCkucXVlcnlTZWxlY3RvcigndmlkZW8nKTtcbiAgICAgICAgICBpZiAodmlkZW9FbGVtZW50KSB7XG4gICAgICAgICAgICBjb25zdCB0cmFja3MgPSB2aWRlb0VsZW1lbnQucXVlcnlTZWxlY3RvckFsbCgndHJhY2snKTtcbiAgICAgICAgICAgIGlmICh0cmFja3MpIHtcbiAgICAgICAgICAgICAgQXJyYXkuZnJvbSh0cmFja3MpLmZvckVhY2godHJhY2sgPT4ge1xuICAgICAgICAgICAgICAgIGlmIChpc0ZpcmVmb3goKSkge1xuICAgICAgICAgICAgICAgICAgLy8gRmlyZWZveCByZXF1aXJlcyBkaXNhYmxpbmcgdGhlIHRyYWNrIGJlZm9yZSByZW1vdmluZywgb3RoZXJ3aXNlIGl0IHdpbGwgY29udGludWUgcmVuZGVyaW5nIHRoZSBmaW5hbCBmcmFtZVxuICAgICAgICAgICAgICAgICAgY29uc3QgdGV4dFRyYWNrID0gdHJhY2sudHJhY2s7XG4gICAgICAgICAgICAgICAgICBpZiAodGV4dFRyYWNrKSB7XG4gICAgICAgICAgICAgICAgICAgIHRleHRUcmFjay5tb2RlID0gJ2Rpc2FibGVkJztcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB0cmFjay5yZW1vdmUoKTtcbiAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgLy8gaWYgdGhlIGJ1dHRvbiBpcyBzZWxlY3RlZCwgdGhlIHVzZXIgaXMgdHVybmluZyBvZmYgdGhlIGNhcHRpb25zL3N1YnNcbiAgICAgICAgICBpZiAoaXNTZWxlY3RlZF8pIHtcbiAgICAgICAgICAgIGlmIChpT1MpIHtcbiAgICAgICAgICAgICAgZGF0YS5tb2RlID0gJ2hpZGRlbic7XG4gICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKCkubW9kZSA9ICdoaWRkZW4nO1xuICAgICAgICAgICAgICBjb25zdCBpZEluZGV4ID0gTnVtYmVyKGJ1dHRvbi5vcHRpb25zXy5pZCk7XG4gICAgICAgICAgICAgIGlmIChpZEluZGV4KSB7XG4gICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKClbaWRJbmRleF0ubW9kZSA9ICdoaWRkZW4nO1xuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgIC8qICAqL1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgY2FwdGlvbnMuc2V0QWN0aXZlSXRlbSh1bmRlZmluZWQpO1xuICAgICAgICAgICAgcGxheWVyLnRyaWdnZXIoJ1NQX0NBUFRJT05TX1NVQlNfT0ZGJyk7XG4gICAgICAgICAgICBzb3VyY2VIYW5kbGVyLnBsdWdpbj8uc3RyZWFtSGFuZGxlci5zZXRDdXJyZW50VGV4dFRyYWNrKC0xLCAnJyk7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgfVxuXG4gICAgICAgICAgaWYgKHZpZGVvRWxlbWVudCkge1xuICAgICAgICAgICAgY29uc3QgbmV3VHJhY2sgPSBkb2N1bWVudC5jcmVhdGVFbGVtZW50KCd0cmFjaycpO1xuICAgICAgICAgICAgbmV3VHJhY2suc3JjID0gZGF0YS51cmw7XG4gICAgICAgICAgICBuZXdUcmFjay5sYWJlbCA9IGRhdGEubGFiZWw7XG4gICAgICAgICAgICBuZXdUcmFjay5raW5kID0gJ2NhcHRpb25zJztcbiAgICAgICAgICAgIG5ld1RyYWNrLnNyY2xhbmcgPSAnZW4nO1xuICAgICAgICAgICAgbmV3VHJhY2suZGVmYXVsdCA9IHRydWU7XG5cbiAgICAgICAgICAgIGlmIChpc0ZpcmVmb3goKSkge1xuICAgICAgICAgICAgICAvLyBFeHBsaWNpdGx5IHNldCB0aGUgbW9kZSB0byAnc2hvd2luZycgZm9yIEZpcmVmb3ggdG8gYmUgaGFwcHlcbiAgICAgICAgICAgICAgaWYgKG5ld1RyYWNrLnRyYWNrKSB7XG4gICAgICAgICAgICAgICAgbmV3VHJhY2sudHJhY2subW9kZSA9ICdzaG93aW5nJztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICB2aWRlb0VsZW1lbnQuYXBwZW5kKG5ld1RyYWNrKTtcbiAgICAgICAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgICAgICBvdmVycmlkZVRyYWNrU2V0dGluZ3MoW25ld1RyYWNrLnRyYWNrXSwgb3B0aW9ucyk7XG4gICAgICAgICAgICB9LCAxMDApO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGlmIChpT1MpIHtcbiAgICAgICAgICAgIC8vIHNpbmNlIHdlJ3JlIHR1cm5pbmcgb24gdGhpcyB0cmFjaywgd2UgbmVlZCB0byBtYWtlIHN1cmUgc2hvd2luZyB0cmFja3MgYXJlXG4gICAgICAgICAgICAvLyBkaXNhYmxlZFxuICAgICAgICAgICAgZm9yIChsZXQgdCA9IDA7IHQgPCBwbGF5ZXIudGV4dFRyYWNrcygpLmxlbmd0aDsgdCArPSAxKSB7XG4gICAgICAgICAgICAgIGlmIChwbGF5ZXIudGV4dFRyYWNrcygpW3RdLm1vZGUgPT09ICdzaG93aW5nJykge1xuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICBwbGF5ZXIudGV4dFRyYWNrcygpW3RdLm1vZGUgPSAnaGlkZGVuJztcbiAgICAgICAgICAgICAgICB9IGNhdGNoIChlKSB7XG4gICAgICAgICAgICAgICAgICAvKiAgKi9cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gdHVybiBvbiB0cmFja3NcbiAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKCkubW9kZSA9ICdzaG93aW5nJztcbiAgICAgICAgICAgIC8vIHR1cm4gb24gdGhpcyB0cmFja1xuICAgICAgICAgICAgY29uc3QgaWRJbmRleCA9IE51bWJlcihidXR0b24ub3B0aW9uc18uaWQpO1xuICAgICAgICAgICAgaWYgKGlkSW5kZXgpIHtcbiAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICBwbGF5ZXIudGV4dFRyYWNrcygpW2lkSW5kZXhdLm1vZGUgPSAnc2hvd2luZyc7XG4gICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAvKiAgKi9cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgZGF0YS5tb2RlID0gJ3Nob3dpbmcnO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIC8vIHNldCBidXR0b24gdG8gYWN0aXZlXG4gICAgICAgICAgY2FwdGlvbnMuc2V0QWN0aXZlSXRlbShidXR0b24pO1xuICAgICAgICAgIHBsYXllci50cmlnZ2VyKCdTUF9DQVBUSU9OU19TVUJTX09OJyk7XG4gICAgICAgICAgc291cmNlSGFuZGxlci5wbHVnaW4/LnN0cmVhbUhhbmRsZXIuc2V0Q3VycmVudFRleHRUcmFjayhcbiAgICAgICAgICAgIGksXG4gICAgICAgICAgICBkYXRhLmxhYmVsLFxuICAgICAgICAgICk7XG4gICAgICAgIH0sXG4gICAgICB9KTtcblxuICAgICAgYXdhaXQgbmV3IFByb21pc2UoZiA9PiB7XG4gICAgICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgICAgICAgIGNhcHRpb25zLmFkZEl0ZW1zKGl0ZW1zLCB0cnVlKTtcbiAgICAgICAgICBmKCcnKTtcbiAgICAgICAgfSwgMTAwKTtcbiAgICAgIH0pO1xuICAgIH1cbiAgfVxufVxuXG5leHBvcnQgZGVmYXVsdCBzZXRDYXB0aW9ucztcbiIsImltcG9ydCB7IEtleVZhbHVlQW55IH0gZnJvbSAnY29tbW9uL3RzTW9kZWxzJztcblxuLyogVXNpbmcgdHlwZSBhbnkgdG8gYmUgYWJsZSB0byBjaGVjayBhbnkgb2JqZWN0IGZvciBhbnkgdmFsdWUgKi9cblxuaW50ZXJmYWNlIE9iamVjdFRvQ2hlY2sge1xuICBkYXRhPzogS2V5VmFsdWVBbnk7XG4gIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tZXhwbGljaXQtYW55XG4gIFtrZXk6IHN0cmluZ106IGFueTtcbn1cblxuZnVuY3Rpb24gZ2V0VmFsdWVGcm9tS2V5PFI+KG9iamVjdDogT2JqZWN0VG9DaGVjaywga2V5TmFtZTogc3RyaW5nKTogUiB8IHVuZGVmaW5lZCB7XG4gIGxldCByZXR1cm5WYWx1ZSA9IHVuZGVmaW5lZDtcblxuICBpZiAodHlwZW9mIG9iamVjdCA9PT0gJ3VuZGVmaW5lZCcpIHtcbiAgICByZXR1cm4gcmV0dXJuVmFsdWU7XG4gIH1cblxuICBpZiAodHlwZW9mIG9iamVjdCA9PT0gJ29iamVjdCcgJiYgb2JqZWN0W2tleU5hbWVdKSB7XG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnNhZmUtYXNzaWdubWVudFxuICAgIHJldHVyblZhbHVlID0gb2JqZWN0W2tleU5hbWVdO1xuICB9IGVsc2UgaWYgKG9iamVjdC5kYXRhICYmIG9iamVjdC5kYXRhW2tleU5hbWVdKSB7XG4gICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnNhZmUtYXNzaWdubWVudFxuICAgIHJldHVyblZhbHVlID0gb2JqZWN0LmRhdGFba2V5TmFtZV07XG4gIH1cblxuICByZXR1cm4gcmV0dXJuVmFsdWU7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGdldFZhbHVlRnJvbUtleTtcbiIsImltcG9ydCBnZXRNZW51TGFiZWwgZnJvbSAnLi4vaGVscGVycy9nZXRNZW51TGFiZWwnO1xuaW1wb3J0IHtcbiAgU291cmNlSGFuZGxlcixcbiAgU1BHcm91cCxcbiAgU1BJdGVtT2JqZWN0LFxuICBWaWRlb0pzUGxheWVyLFxuICBTYXJkaXVzVGV4dFRyYWNrLFxufSBmcm9tICdjb21tb24vdHNNb2RlbHMnO1xuaW1wb3J0IGdldFZhbHVlRnJvbUtleSBmcm9tICcuLi9oZWxwZXJzL2dldFZhbHVlRnJvbUtleSc7XG5pbXBvcnQgaXNGaXJlZm94IGZyb20gJy4uL2hlbHBlcnMvaXNGaXJlZm94JztcblxuaW50ZXJmYWNlIEFyZ3Mge1xuICBwbGF5ZXI6IFZpZGVvSnNQbGF5ZXI7XG4gIHNvdXJjZUhhbmRsZXI6IFNvdXJjZUhhbmRsZXI7XG4gIGNhcHRpb25zOiBTUEdyb3VwO1xuICBpdGVtczogU1BJdGVtT2JqZWN0W107XG59XG5cbmZ1bmN0aW9uIFNQX1NVQl9UUkFDS19VUERBVEVEX0xJU1Qoe1xuICBwbGF5ZXIsXG4gIHNvdXJjZUhhbmRsZXIsXG4gIGNhcHRpb25zLFxuICBpdGVtcyxcbn06IEFyZ3MpOiB2b2lkIHtcbiAgLyogXG4gICAgaWYgYSBtYW5pZmVzdCBoYXMgdHJhY2tzIGluIGl0LCB3ZSBjYW4gZ2V0IHRob3NlIHRyYWNrcyB3aGVuXG4gICAgdGhlICdTUF9URVhUX1RSQUNLX1VQREFURURfTElTVCcgZXZlbnQgZmlyZXNcbiAgICB0aGlzIGV2ZW50IG9ubHkgZmlyZXMgaWYgdGhlcmUgYXJlIG1hbmlmZXN0IHRyYWNrcyBwcmVzZW50IGFuZFxuICAgIHdpbGwgbm90IGZpcmUgZm9yIGNhcHRpb25zIG9yIGlmIHRoZXJlIGFyZSBubyB0cmFja3NcbiAgKi9cbiAgcGxheWVyLm9uKFxuICAgICdTUF9TVUJfVFJBQ0tfVVBEQVRFRF9MSVNUJyxcbiAgICAoZXZlbnQ6IEV2ZW50LCB0cmFja0xpc3Q6IHsgc3VidGl0bGVUcmFja3M6IFNhcmRpdXNUZXh0VHJhY2tbXSB9KSA9PiB7XG4gICAgICBjb25zdCBzdWJUcmFja3MgPSB0cmFja0xpc3Quc3VidGl0bGVUcmFja3M7XG4gICAgICBmb3IgKGxldCBpID0gMDsgaSA8IChzdWJUcmFja3M/Lmxlbmd0aCB8fCAwKTsgaSArPSAxKSB7XG4gICAgICAgIGNvbnN0IGFjdGl2ZSA9XG4gICAgICAgICAgc3ViVHJhY2tzW2ldPy5kZWZhdWx0ID09PSB0cnVlIHx8XG4gICAgICAgICAgc3ViVHJhY2tzW2ldPy5mb3JjZWQgPT09IHRydWUgfHxcbiAgICAgICAgICBzdWJUcmFja3NbaV0/LmF1dG9zZWxlY3QgPT09IHRydWU7XG5cbiAgICAgICAgaWYgKGFjdGl2ZSkge1xuICAgICAgICAgIHNvdXJjZUhhbmRsZXIucGx1Z2luLnN0cmVhbUhhbmRsZXIuc2V0VGV4dFRyYWNrRGlzcGxheSh0cnVlKTtcbiAgICAgICAgICBzb3VyY2VIYW5kbGVyLnBsdWdpbi5zdHJlYW1IYW5kbGVyLnNldEN1cnJlbnRUZXh0VHJhY2soXG4gICAgICAgICAgICBpLFxuICAgICAgICAgICAgc3ViVHJhY2tzW2ldLmxhbmd1YWdlLFxuICAgICAgICAgICk7XG4gICAgICAgIH1cblxuICAgICAgICBpdGVtcy5wdXNoKHtcbiAgICAgICAgICBjbGFzc2VzOiAnc3AtbWVudS1pdGVtJyxcbiAgICAgICAgICBsYWJlbDogZ2V0TWVudUxhYmVsKHtcbiAgICAgICAgICAgIGxhYmVsOlxuICAgICAgICAgICAgICBnZXRWYWx1ZUZyb21LZXk8U2FyZGl1c1RleHRUcmFja1snbGFiZWwnXT4oXG4gICAgICAgICAgICAgICAgc3ViVHJhY2tzW2ldLFxuICAgICAgICAgICAgICAgICdsYWJlbCcsXG4gICAgICAgICAgICAgICkgfHxcbiAgICAgICAgICAgICAgZ2V0VmFsdWVGcm9tS2V5PFNhcmRpdXNUZXh0VHJhY2tbJ25hbWUnXT4oc3ViVHJhY2tzW2ldLCAnbmFtZScpLFxuICAgICAgICAgICAgc291cmNlSGFuZGxlcixcbiAgICAgICAgICB9KSxcbiAgICAgICAgICBpZDogYHN1YnNfJHtpfWAsXG4gICAgICAgICAgb3JkZXI6IHN1YlRyYWNrcy5sZW5ndGggLSBpLFxuICAgICAgICAgIGlzQWN0aXZlOiBhY3RpdmUsXG4gICAgICAgICAgc2VsZWN0YWJsZTogdHJ1ZSxcbiAgICAgICAgICBkYXRhOiBzdWJUcmFja3NbaV0sXG4gICAgICAgICAgLy8gV29ya2luZyBpbmxpbmUgY2FwdGlvbnNcbiAgICAgICAgICBjYWxsYmFjazogKGRhdGEsIGJ1dHRvbikgPT4ge1xuICAgICAgICAgICAgY29uc3QgeyBpc1NlbGVjdGVkXyB9ID0gYnV0dG9uO1xuICAgICAgICAgICAgLy8gaWYgdXNlciBpcyB0dXJuaW5nIHRoZSB0cmFjayBvZmYsIHNldCB0cmFja3MgdG8gLTEgYW5kIHR1cm4gdGhlIGRpc3BsYXkgb2ZmXG4gICAgICAgICAgICBzb3VyY2VIYW5kbGVyLnBsdWdpbi5zdHJlYW1IYW5kbGVyLnNldEN1cnJlbnRUZXh0VHJhY2soLTEsICcnKTtcbiAgICAgICAgICAgIGNhcHRpb25zLnNldEFjdGl2ZUl0ZW0odW5kZWZpbmVkKTtcbiAgICAgICAgICAgIHNvdXJjZUhhbmRsZXIucGx1Z2luLnN0cmVhbUhhbmRsZXIuc2V0VGV4dFRyYWNrRGlzcGxheShmYWxzZSk7XG4gICAgICAgICAgICBwbGF5ZXIudHJpZ2dlcignU1BfQ0FQVElPTlNfU1VCU19PRkYnKTtcblxuICAgICAgICAgICAgLy8gbWFrZSBzdXJlIGFueSBvdGhlciBzaG93aW5nIHRyYWNrcyBhcmUgdHVybmVkIG9mZlxuICAgICAgICAgICAgZm9yIChsZXQgdCA9IDA7IHQgPCBpdGVtcy5sZW5ndGg7IHQgKz0gMSkge1xuICAgICAgICAgICAgICBpZiAoaXRlbXNbdF0uZGF0YT8ubW9kZSAhPT0gJ2Rpc2FibGVkJykge1xuICAgICAgICAgICAgICAgIGlmICghaXRlbXNbdF0uZGF0YSkge1xuICAgICAgICAgICAgICAgICAgaXRlbXNbdF0uZGF0YSA9IHt9O1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBpdGVtc1t0XS5kYXRhIS5tb2RlID0gJ2Rpc2FibGVkJztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZiAoIWlzU2VsZWN0ZWRfKSB7XG4gICAgICAgICAgICAgIC8vIHR1cm4gb24gdGhlIGRpc3BsYXlcbiAgICAgICAgICAgICAgc291cmNlSGFuZGxlci5wbHVnaW4uc3RyZWFtSGFuZGxlci5zZXRUZXh0VHJhY2tEaXNwbGF5KHRydWUpO1xuICAgICAgICAgICAgICAvLyB0dXJuIG9uIHNlbGVjdGVkIHRyYWNrXG4gICAgICAgICAgICAgIHNvdXJjZUhhbmRsZXIucGx1Z2luLnN0cmVhbUhhbmRsZXIuc2V0Q3VycmVudFRleHRUcmFja0RlbGF5ZWQoXG4gICAgICAgICAgICAgICAgaSxcbiAgICAgICAgICAgICAgICBkYXRhLmxhbmd1YWdlLFxuICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAvLyBzZXQgYnV0dG9uIGFjdGl2ZVxuICAgICAgICAgICAgICBjYXB0aW9ucy5zZXRBY3RpdmVJdGVtKGJ1dHRvbik7XG5cbiAgICAgICAgICAgICAgaWYgKGlzRmlyZWZveCgpKSB7XG4gICAgICAgICAgICAgICAgLy8gU2V0IG1vZGUgdG8gJ3Nob3dpbmcnIGZvciBGaXJlZm94XG4gICAgICAgICAgICAgICAgZGF0YS5tb2RlID0gJ3Nob3dpbmcnO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHBsYXllci50cmlnZ2VyKCdobHNTdWJ0aXRsZVRyYWNrVXBkYXRlZCcsIGRhdGEpO1xuICAgICAgICAgICAgICBwbGF5ZXIudHJpZ2dlcignU1BfQ0FQVElPTlNfU1VCU19PTicpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0sXG4gICAgICAgIH0pO1xuICAgICAgfVxuXG4gICAgICBjYXB0aW9ucy5hZGRJdGVtcyhpdGVtcyk7XG4gICAgfSxcbiAgKTtcbn1cblxuZXhwb3J0IGRlZmF1bHQgU1BfU1VCX1RSQUNLX1VQREFURURfTElTVDtcbiIsImltcG9ydCBnZXRNZW51TGFiZWwgZnJvbSAnLi4vaGVscGVycy9nZXRNZW51TGFiZWwnO1xuaW1wb3J0IHtcbiAgU291cmNlSGFuZGxlcixcbiAgU1BHcm91cCxcbiAgU1BJdGVtT2JqZWN0LFxuICBWaWRlb0pzUGxheWVyLFxuICBTYXJkaXVzVGV4dFRyYWNrLFxuICBTYXJkaXVzVGV4dFRyYWNrTGlzdCxcbn0gZnJvbSAnY29tbW9uL3RzTW9kZWxzJztcbmltcG9ydCBnZXRWYWx1ZUZyb21LZXkgZnJvbSAnLi4vaGVscGVycy9nZXRWYWx1ZUZyb21LZXknO1xuaW1wb3J0IGlzRmlyZWZveCBmcm9tICcuLi9oZWxwZXJzL2lzRmlyZWZveCc7XG5cbmludGVyZmFjZSBBcmdzIHtcbiAgcGxheWVyOiBWaWRlb0pzUGxheWVyO1xuICBzb3VyY2VIYW5kbGVyOiBTb3VyY2VIYW5kbGVyO1xuICBjYXB0aW9uczogU1BHcm91cDtcbiAgaXRlbXM6IFNQSXRlbU9iamVjdFtdO1xufVxuXG5mdW5jdGlvbiBTUF9GUkFHTUVOVF9BRlRFUl9DSEFOR0Uoe1xuICBwbGF5ZXIsXG4gIHNvdXJjZUhhbmRsZXIsXG4gIGNhcHRpb25zLFxuICBpdGVtcyxcbn06IEFyZ3MpOiB2b2lkIHtcbiAgLypcbiAgICBGb3IgaW4tYmFuZCBjYXB0aW9ucywgd2UnbGwgbmVlZCB0byBjaGVjayBmb3IgdHJhY2tzIGFzIHRoZSBwbGF5ZXIgbG9hZHMgaW4gZnJhZ21lbnRzXG4gICAgaWYgYSBmcmFnbWVudCBoYXMgY2FwdGlvbnMsIHRoYXQgdGV4dCB0cmFjayB3aWxsIGJlIGFkZGVkIHRvIHRoZSBwbGF5ZXIuIFdlIGNoZWNrXG4gICAgdGhlIHBsYXllciBmb3IgdHJhY2tzIHdpdGggZWFjaCBuZXcgZnJhZ21lbnQuXG4gICovXG4gIHBsYXllci5vbignU1BfRlJBR01FTlRfQUZURVJfQ0hBTkdFJywgKCkgPT4ge1xuICAgIC8vIGdldCB0aGUgdGV4dCB0cmFja3MgbGlzdCB3aGljaCB3aWxsIGJlIGFkZGVkIGJ5IGhscy5qcyB0b1xuICAgIC8vIHRoZSB2aWRlb3MgdGV4dCB0cmFja3MgYWZ0ZXIgdGhleSBhcmUgZGV0ZWN0ZWQgd2hlbiBhIGZyYWcgaXMgZGVjb2RlZFxuICAgIGNvbnN0IGFsbFRyYWNrcyA9IHBsYXllci5lbCgpLmdldEVsZW1lbnRzQnlUYWdOYW1lKCd2aWRlbycpWzBdXG4gICAgICAudGV4dFRyYWNrcyBhcyBTYXJkaXVzVGV4dFRyYWNrTGlzdDtcblxuICAgIC8vIGhlcmUgd2UgYXJlIGdvaW5nIHRvIGZpbHRlciBhbGwgdGhlIHRyYWNrcyB0aGF0IGFyZSBhdmFpbGFibGUgdG8gZ2V0IG9ubHlcbiAgICAvLyB0aGUgaW4tYmFuZCBjYXB0aW9ucyB0cmFja3NcbiAgICBjb25zdCBjYXB0aW9uVHJhY2tzID0gQXJyYXkuZnJvbShhbGxUcmFja3MpLmZpbHRlcihcbiAgICAgIHRyYWNrID0+IGdldFZhbHVlRnJvbUtleTxUZXh0VHJhY2tLaW5kPih0cmFjaywgJ2tpbmQnKSA9PT0gJ2NhcHRpb25zJyxcbiAgICApO1xuXG4gICAgLy8gZ28gdGhyb3VnaCB0aGUgaXRlbXMgd2UgY3VycmVudGx5IGhhdmUgYW5kIHNlZSBpZiB0aGVyZSBhcmUgYW55IGNhcHRpb25zIGl0ZW1zIGFkZGVkXG4gICAgY29uc3QgY2FwdGlvbnNJbk1lbnUgPSBpdGVtcy5maWx0ZXIodHJhY2sgPT4ge1xuICAgICAgaWYgKGdldFZhbHVlRnJvbUtleTxUZXh0VHJhY2tLaW5kPih0cmFjaywgJ2tpbmQnKSA9PT0gJ2NhcHRpb25zJykge1xuICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgIH1cbiAgICAgIHJldHVybiBmYWxzZTtcbiAgICB9KTtcblxuICAgIC8qXG4gICAgICBNb3ppbGxhIGRlZmluZXMgYSB1bmlxdWUgdHJhY2sgYXMgdGhlIGNvbWJpbmF0aW9uIG9mIGxhYmVsLCBsYW5ndWFnZSwgYW5kIGtpbmRcbiAgICAgIGh0dHBzOi8vZGV2ZWxvcGVyLm1vemlsbGEub3JnL2VuLVVTL2RvY3MvV2ViL0hUTUwvRWxlbWVudC90cmFja1xuICAgICAgaGVyZSB3ZSBhcmUgYWx3YXlzIGRlYWxpbmcgd2l0aCBraW5kIG9mIGNhcHRpb25zIChhcyBmaWx0ZXJlZCBmb3IgYWJvdmUpXG4gICAgICBzbyB3ZSdyZSBnb2luZyB0byBjaGVjayB0byBzZWUgaWYgd2UgYWxyZWFkeSBoYXZlIGEgdHJhY2sgYnkgbWF0Y2hpbmdcbiAgICAgIGxhYmVsIGFuZCBsYW5ndWFnZS4gV2UncmUgZG9pbmcgdGhpcyBiZSBsb29waW5nIHRocm91Z2ggdGhlIGNhcHRpb25zIHRyYWNrc1xuICAgICAgYWRkZWQgdG8gdGhlIHZpZGVvIGFuZCB0aGVuIGNoZWNraW5nIGFnYWluc3QgdGhlIGNhcHRpb25zIHRoYXQgd2UgaGF2ZSBhZGRlZCB0b1xuICAgICAgdGhlIG1lbnUgYWxyZWFkeS5cbiAgICAqL1xuXG4gICAgY29uc3QgbmV3Q2FwdGlvbnNUcmFja3M6IFNhcmRpdXNUZXh0VHJhY2tbXSA9IFtdO1xuICAgIC8qIElubGluZSBvdmVycmlkZXMgKi9cbiAgICBjYXB0aW9uVHJhY2tzLmZvckVhY2godHJhY2sgPT4ge1xuICAgICAgaWYgKGNhcHRpb25zSW5NZW51Lmxlbmd0aCA+IDApIHtcbiAgICAgICAgbGV0IGNhcHRpb25BZGRlZCA9IGZhbHNlO1xuICAgICAgICBmb3IgKGxldCBjID0gMDsgYyA8IGNhcHRpb25zSW5NZW51Lmxlbmd0aDsgYyArPSAxKSB7XG4gICAgICAgICAgaWYgKFxuICAgICAgICAgICAgY2FwdGlvbnNJbk1lbnVbY10gJiZcbiAgICAgICAgICAgIGNhcHRpb25zSW5NZW51W2NdLmRhdGEgJiZcbiAgICAgICAgICAgIGdldFZhbHVlRnJvbUtleTxTUEl0ZW1PYmplY3RbJ2xhYmVsJ10+KFxuICAgICAgICAgICAgICBjYXB0aW9uc0luTWVudVtjXSxcbiAgICAgICAgICAgICAgJ2xhYmVsJyxcbiAgICAgICAgICAgICkgPT09IGdldFZhbHVlRnJvbUtleTxTUEl0ZW1PYmplY3RbJ2xhYmVsJ10+KHRyYWNrLCAnbGFiZWwnKSAmJlxuICAgICAgICAgICAgZ2V0VmFsdWVGcm9tS2V5PFNQSXRlbU9iamVjdFsnbGFuZ3VhZ2UnXT4oXG4gICAgICAgICAgICAgIGNhcHRpb25zSW5NZW51W2NdLFxuICAgICAgICAgICAgICAnbGFuZ3VhZ2UnLFxuICAgICAgICAgICAgKSA9PT0gZ2V0VmFsdWVGcm9tS2V5PFNQSXRlbU9iamVjdFsnbGFuZ3VhZ2UnXT4odHJhY2ssICdsYW5ndWFnZScpXG4gICAgICAgICAgKSB7XG4gICAgICAgICAgICBjYXB0aW9uQWRkZWQgPSB0cnVlO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgICBpZiAoIWNhcHRpb25BZGRlZCkge1xuICAgICAgICAgIG5ld0NhcHRpb25zVHJhY2tzLnB1c2godHJhY2spO1xuICAgICAgICB9XG4gICAgICB9IGVsc2Uge1xuICAgICAgICBuZXdDYXB0aW9uc1RyYWNrcy5wdXNoKHRyYWNrKTtcbiAgICAgIH1cbiAgICB9KTtcblxuICAgIC8qXG4gICAgICBNYWtlIHN1cmUgd2UgaGF2ZSB0aGUgdGhlIGNsb3NlZCBjYXB0aW9ucyBpY29uIG9uIHRoZSBET01cbiAgICAgIFRoaXMgY29kZSB0byBjaGVjayBmb3IgYW5kIGhhbmRsZSB0aGUgdmlzaWJpbGl0eSBvZiB0aGUgQ0NcbiAgICAgIGJ1dHRvbiBpcyB0byBoYW5kbGUgc29tZSBlZGdlIGNhc2Ugb3IgY2xpZW50IGNhc2UgdGhhdCBJIChEYW4pIGRvbid0IHJlYWxseVxuICAgICAgcmVtZW1iZXIuIEknbSBnb2luZyB0byBsZWF2ZSBpbiBwbGFjZSBkdXJpbmcgdXBkYXRlcyAwNi8yMDIyLlxuICAgICovXG4gICAgaWYgKFxuICAgICAgcGxheWVyLmNvbnRyb2xCYXIgJiZcbiAgICAgIHBsYXllci5jb250cm9sQmFyWydjbG9zZWRDYXB0aW9ucyddICYmXG4gICAgICBwbGF5ZXIuY29udHJvbEJhclsnY2xvc2VkQ2FwdGlvbnMnXS5lbF9cbiAgICApIHtcbiAgICAgIC8vIGdldCB0aGUgY2MgcGx1Z2luIGVsXG4gICAgICBjb25zdCBjbG9zZWRDYXB0aW9uc0VsZW1lbnQgPSBwbGF5ZXIuY29udHJvbEJhclsnY2xvc2VkQ2FwdGlvbnMnXS5lbF87XG5cbiAgICAgIC8vIGNoZWNrIGZvciB0aGUgdmpzLWhpZGRlbiBjbGFzcyB0byBzZWUgaWYgdGhlIGVsZW1lbnQgaXMgc2hvd2luZyBvciBub3RcbiAgICAgIGNvbnN0IGlzRWxlbWVudEhpZGRlbiA9IGNsb3NlZENhcHRpb25zRWxlbWVudC5jbGFzc0xpc3QuY29udGFpbnMoXG4gICAgICAgICd2anMtaGlkZGVuJyxcbiAgICAgICk7XG5cbiAgICAgIC8vIGlmIHRoZSBtZW51IGlzIHNob3dpbmcgYW5kIHdlIGRvbid0IGhhdmUgYW55IHRyYWNrcywgdGhlbiBoaWRlIGl0XG4gICAgICBpZiAoXG4gICAgICAgIGNhcHRpb25zLml0ZW1zICYmXG4gICAgICAgIGNhcHRpb25zLml0ZW1zLmxlbmd0aCA9PT0gMCAmJlxuICAgICAgICBpc0VsZW1lbnRIaWRkZW4gPT09IGZhbHNlXG4gICAgICApIHtcbiAgICAgICAgY2xvc2VkQ2FwdGlvbnNFbGVtZW50LmNsYXNzTGlzdC5hZGQoJ3Zqcy1oaWRkZW4nKTtcbiAgICAgIH1cblxuICAgICAgLy8gaWYgd2UndmUgZm91bmQgc29tZSBuZXcgY2FwdGlvbnMgdHJhY2tzLCB0aGVuIGFkZCB0aGVtXG4gICAgICBpZiAobmV3Q2FwdGlvbnNUcmFja3MubGVuZ3RoICE9PSAwKSB7XG4gICAgICAgIGZvciAobGV0IGkgPSAwOyBpIDwgbmV3Q2FwdGlvbnNUcmFja3MubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICBsZXQgc29ydE9yZGVyID0gbmV3Q2FwdGlvbnNUcmFja3MubGVuZ3RoIC0gaTtcblxuICAgICAgICAgIC8vIEFsd2F5cyBzaG93IGVuZ2xpc2ggY2FwdGlvbnMgZmlyc3RcbiAgICAgICAgICBpZiAoXG4gICAgICAgICAgICBnZXRWYWx1ZUZyb21LZXk8U2FyZGl1c1RleHRUcmFja1snbGFuZ3VhZ2UnXT4oXG4gICAgICAgICAgICAgIG5ld0NhcHRpb25zVHJhY2tzW2ldLFxuICAgICAgICAgICAgICAnbGFuZ3VhZ2UnLFxuICAgICAgICAgICAgKSA9PT0gJ2VuJ1xuICAgICAgICAgICkge1xuICAgICAgICAgICAgc29ydE9yZGVyID0gaXRlbXMubGVuZ3RoICsgMTtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICBpdGVtcy5wdXNoKHtcbiAgICAgICAgICAgIGNsYXNzZXM6ICdzcC1tZW51LWl0ZW0nLFxuICAgICAgICAgICAgbGFiZWw6IGdldE1lbnVMYWJlbCh7XG4gICAgICAgICAgICAgIGxhYmVsOlxuICAgICAgICAgICAgICAgIGdldFZhbHVlRnJvbUtleTxTYXJkaXVzVGV4dFRyYWNrWyduYW1lJ10+KFxuICAgICAgICAgICAgICAgICAgbmV3Q2FwdGlvbnNUcmFja3NbaV0sXG4gICAgICAgICAgICAgICAgICAnbmFtZScsXG4gICAgICAgICAgICAgICAgKSB8fFxuICAgICAgICAgICAgICAgIGdldFZhbHVlRnJvbUtleTxTYXJkaXVzVGV4dFRyYWNrWydsYWJlbCddPihcbiAgICAgICAgICAgICAgICAgIG5ld0NhcHRpb25zVHJhY2tzW2ldLFxuICAgICAgICAgICAgICAgICAgJ2xhYmVsJyxcbiAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICBzb3VyY2VIYW5kbGVyLFxuICAgICAgICAgICAgfSksXG4gICAgICAgICAgICBpZDogYGNhcHRpb25zXyR7aX1gLFxuICAgICAgICAgICAgb3JkZXI6IHNvcnRPcmRlcixcbiAgICAgICAgICAgIGlzQWN0aXZlOiBmYWxzZSxcbiAgICAgICAgICAgIHNlbGVjdGFibGU6IHRydWUsXG4gICAgICAgICAgICBkYXRhOiBuZXdDYXB0aW9uc1RyYWNrc1tpXSxcbiAgICAgICAgICAgIC8vIFdvcmtpbmcsIGFkZCBjYXB0aW9ucyBmb3VuZCBkdXJpbmcgcGxheWJhY2tcbiAgICAgICAgICAgIGNhbGxiYWNrOiAoZGF0YSwgYnV0dG9uKSA9PiB7XG4gICAgICAgICAgICAgIGNvbnN0IHsgaXNTZWxlY3RlZF8gfSA9IGJ1dHRvbjtcbiAgICAgICAgICAgICAgLy8gSWYgYSB1c2VyIGlzIHR1cm5pbmcgb2ZmIGEgY2FwdGlvbiwgc2V0IGl0IHRvIGRpc2FibGVkXG4gICAgICAgICAgICAgIGlmIChpc1NlbGVjdGVkXykge1xuICAgICAgICAgICAgICAgIG5ld0NhcHRpb25zVHJhY2tzW2ldLm1vZGUgPSAnZGlzYWJsZWQnO1xuICAgICAgICAgICAgICAgIGNhcHRpb25zLnNldEFjdGl2ZUl0ZW0odW5kZWZpbmVkKTtcbiAgICAgICAgICAgICAgICBwbGF5ZXIudHJpZ2dlcignU1BfQ0FQVElPTlNfU1VCU19PRkYnKTtcbiAgICAgICAgICAgICAgICBzb3VyY2VIYW5kbGVyLnBsdWdpbi5zdHJlYW1IYW5kbGVyLnNldEN1cnJlbnRUZXh0VHJhY2soLTEsICcnKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAvLyBNYWtlIHN1cmUgYW55IG90aGVyIHNob3dpbmcgdHJhY2tzIGFyZSB0dXJuZWQgb2ZmXG4gICAgICAgICAgICAgIGZvciAobGV0IHQgPSAwOyB0IDwgaXRlbXMubGVuZ3RoOyB0ICs9IDEpIHtcbiAgICAgICAgICAgICAgICBpZiAodHlwZW9mIGl0ZW1zW3RdLmRhdGE/Lm1vZGUgIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAgICAgICAgICAgICBpdGVtc1t0XS5kYXRhIS5tb2RlID0gJ2Rpc2FibGVkJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAvLyBUdXJuIG9uIHRoaXMgY2FwdGlvblxuICAgICAgICAgICAgICBuZXdDYXB0aW9uc1RyYWNrc1tpXS5tb2RlID0gJ3Nob3dpbmcnO1xuICAgICAgICAgICAgICAvLyBUdXJuIG9uIHRoZSB0ZXh0IHRyYWNrIGRpc3BsYXkgYW5kIHN1YnMgdHJhY2tcbiAgICAgICAgICAgICAgc291cmNlSGFuZGxlci5wbHVnaW4uc3RyZWFtSGFuZGxlci5zZXRDdXJyZW50VGV4dFRyYWNrKFxuICAgICAgICAgICAgICAgIGksXG4gICAgICAgICAgICAgICAgZGF0YS5sYW5ndWFnZSxcbiAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgc291cmNlSGFuZGxlci5wbHVnaW4uc3RyZWFtSGFuZGxlci5zZXRUZXh0VHJhY2tEaXNwbGF5KHRydWUpO1xuICAgICAgICAgICAgICAvLyBTZXQgYnV0dG9uIGFzIGFjdGl2ZVxuICAgICAgICAgICAgICBjYXB0aW9ucy5zZXRBY3RpdmVJdGVtKGJ1dHRvbik7XG5cbiAgICAgICAgICAgICAgaWYgKGlzRmlyZWZveCgpKSB7XG4gICAgICAgICAgICAgICAgLy8gU2V0IG1vZGUgdG8gJ3Nob3dpbmcnIGZvciBGaXJlZm94XG4gICAgICAgICAgICAgICAgZGF0YS5tb2RlID0gJ3Nob3dpbmcnO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHBsYXllci50cmlnZ2VyKCdobHNDYXB0aW9uc1VwZGF0ZWQnLCBkYXRhKTtcbiAgICAgICAgICAgICAgcGxheWVyLnRyaWdnZXIoJ1NQX0NBUFRJT05TX1NVQlNfT04nKTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cblxuICAgICAgICBjYXB0aW9ucy5hZGRJdGVtcyhpdGVtcyk7XG4gICAgICB9XG4gICAgICAvLyBUT0RPOiBEZWNpZGUgaWYgQ2xvc2VkIENhcHRpb25zIEJ1dHRvbiBTaG91bGQgZGlzcGxheS9yZW1vdmUgZHluYW1pY2FsbHlcbiAgICAgIC8vIGVsc2UgaWYgKHRyYWNrcy5sZW5ndGggPT09IDAgJiYgaXNFbGVtZW50SGlkZGVuID09PSBmYWxzZSkge1xuICAgICAgLy8gICBjbG9zZWRDYXB0aW9uc0VsZW1lbnQuY2xhc3NMaXN0LmFkZCgndmpzLWhpZGRlbicpO1xuICAgICAgLy8gfVxuICAgIH0gZWxzZSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoXG4gICAgICAgICdTUF9FUlJPUjogVGhlIENsb3NlZCBDYXB0aW9ucyBQbHVnaW4gRWxlbWVudCBXYXMgTm90IEZvdW5kJyxcbiAgICAgICk7XG4gICAgfVxuICB9KTtcbn1cblxuZXhwb3J0IGRlZmF1bHQgU1BfRlJBR01FTlRfQUZURVJfQ0hBTkdFO1xuIiwiaW1wb3J0IFNQX1NVQl9UUkFDS19VUERBVEVEX0xJU1QgZnJvbSAnLi9TUF9TVUJfVFJBQ0tfVVBEQVRFRF9MSVNUJztcbmltcG9ydCBTUF9GUkFHTUVOVF9BRlRFUl9DSEFOR0UgZnJvbSAnLi9TUF9GUkFHTUVOVF9BRlRFUl9DSEFOR0UnO1xuaW1wb3J0IHtcbiAgU291cmNlSGFuZGxlcixcbiAgU1BHcm91cCxcbiAgU1BJdGVtT2JqZWN0LFxuICBWaWRlb0pzUGxheWVyLFxufSBmcm9tICdjb21tb24vdHNNb2RlbHMnO1xuXG5pbnRlcmZhY2UgQXJncyB7XG4gIHBsYXllcjogVmlkZW9Kc1BsYXllcjtcbiAgc291cmNlSGFuZGxlcjogU291cmNlSGFuZGxlcjtcbiAgY2FwdGlvbnM6IFNQR3JvdXA7XG4gIGl0ZW1zOiBTUEl0ZW1PYmplY3RbXTtcbn1cblxuLy8gRnVuY3Rpb24gdG8gc2V0dXAgY2FwdGlvbnMvc3VicyB0aGF0IGFyZSBkZWxpdmVyZWQgZWl0aGVyIGFzIHRyYWNrcyBpbiBhIG1hc3RlciBtYW5pZmVzdFxuLy8gb3IgZGVsaXZlcmVkIGluLWJhbmQgdmlhIENFQSA2MDgvNzA4IGNhcHRpb25zIHN0YW5kYXJkXG5mdW5jdGlvbiBTUF9MSUJfUkVBRFkoe1xuICBwbGF5ZXIsXG4gIHNvdXJjZUhhbmRsZXIsXG4gIGNhcHRpb25zLFxuICBpdGVtcyxcbn06IEFyZ3MpOiB2b2lkIHtcbiAgLy8gRm9yIGV2ZXJ5dGhpbmcgZWxzZSwgd2UgY2FuIHVzZSBobHMuanMgdG8gZ2V0IHRoZSB0cmFja3MgZm9yIHVzXG4gIC8vIFdhaXQgZm9yIHRoZSBzdHJlYW1pbmcgbGlicmFyeSB0byBiZSByZWFkeVxuICBwbGF5ZXIub24oJ1NQX0xJQl9SRUFEWScsICgpID0+IHtcbiAgICAvLyBXZSdyZSBvbmx5IHN1cHBvcnRpbmcgY2FwdGlvbnMgZm9yIEhMUyBhc3NldHMgY3VycmVudGx5XG4gICAgaWYgKHNvdXJjZUhhbmRsZXIucGx1Z2luLnN0cmVhbUhhbmRsZXIubGliLmhscykge1xuICAgICAgLy8gVHVybiBvbiB0aGUgdGV4dCB0cmFjayBkaXNwbGF5LCB3ZSBkbyB0aGlzIHNvIHRoYXQgd2UgY2FuIHN0YXJ0IHdpdGggYWxsIHRyYWNrcyBvZmZcbiAgICAgIHNvdXJjZUhhbmRsZXIucGx1Z2luLnN0cmVhbUhhbmRsZXIuc2V0VGV4dFRyYWNrRGlzcGxheSh0cnVlKTtcblxuICAgICAgLy8gVHVybiBvZmYgYWxsIHRyYWNrc1xuICAgICAgc291cmNlSGFuZGxlci5wbHVnaW4uc3RyZWFtSGFuZGxlci5zZXRDdXJyZW50VGV4dFRyYWNrKC0xLCAnJyk7XG5cbiAgICAgIC8vIFR1cm4gdGhlIGRpc3BsYXkgYmFjayBvZmZcbiAgICAgIHNvdXJjZUhhbmRsZXIucGx1Z2luLnN0cmVhbUhhbmRsZXIuc2V0VGV4dFRyYWNrRGlzcGxheShmYWxzZSk7XG5cbiAgICAgIC8vIElubGluZS9lbWJlZGRlZCBjYXB0aW9ucyBmb3VuZCBhdCB0aGUgc3RhcnRcbiAgICAgIFNQX1NVQl9UUkFDS19VUERBVEVEX0xJU1Qoe1xuICAgICAgICBwbGF5ZXIsXG4gICAgICAgIHNvdXJjZUhhbmRsZXIsXG4gICAgICAgIGNhcHRpb25zLFxuICAgICAgICBpdGVtcyxcbiAgICAgIH0pO1xuICAgICAgLy8gSW5saW5lL2VtYmVkZGVkIGNhcHRpb25zIGZvdW5kIGR1cmluZyBwbGF5YmFja1xuICAgICAgU1BfRlJBR01FTlRfQUZURVJfQ0hBTkdFKHtcbiAgICAgICAgcGxheWVyLFxuICAgICAgICBzb3VyY2VIYW5kbGVyLFxuICAgICAgICBjYXB0aW9ucyxcbiAgICAgICAgaXRlbXMsXG4gICAgICB9KTtcbiAgICB9XG4gIH0pO1xufVxuXG5leHBvcnQgZGVmYXVsdCBTUF9MSUJfUkVBRFk7XG4iLCJpbXBvcnQge1xuICBTb3VyY2VIYW5kbGVyLFxuICBTUEdyb3VwLFxuICBTUEl0ZW1PYmplY3QsXG4gIFZpZGVvSnNQbGF5ZXIsXG59IGZyb20gJ2NvbW1vbi90c01vZGVscyc7XG5pbXBvcnQgZ2V0TWVudUxhYmVsIGZyb20gJy4uL2hlbHBlcnMvZ2V0TWVudUxhYmVsJztcblxuaW50ZXJmYWNlIEFyZ3Mge1xuICBwbGF5ZXI6IFZpZGVvSnNQbGF5ZXI7XG4gIHNvdXJjZUhhbmRsZXI6IFNvdXJjZUhhbmRsZXI7XG4gIGNhcHRpb25zOiBTUEdyb3VwO1xuICBpdGVtczogU1BJdGVtT2JqZWN0W107XG59XG5cbmZ1bmN0aW9uIGlPU1NldHVwKHsgcGxheWVyLCBzb3VyY2VIYW5kbGVyLCBjYXB0aW9ucywgaXRlbXMgfTogQXJncyk6IHZvaWQge1xuICBwbGF5ZXIub24oJ3NwLWlvcy1mdWxsc2NyZWVuY2hhbmdlJywgKCkgPT4ge1xuICAgIGNvbnN0IHRleHRUcmFja3MgPSBwbGF5ZXIudGV4dFRyYWNrcygpO1xuICAgIGlmICh0ZXh0VHJhY2tzLmxlbmd0aCA+IDApIHtcbiAgICAgIGxldCBhY3RpdmVJbmRleCA9IC0xO1xuICAgICAgZm9yIChsZXQgaSA9IDA7IGkgPCB0ZXh0VHJhY2tzLmxlbmd0aDsgaSArPSAxKSB7XG4gICAgICAgIGlmICh0ZXh0VHJhY2tzW2ldLm1vZGUgPT09ICdzaG93aW5nJykge1xuICAgICAgICAgIGFjdGl2ZUluZGV4ID0gaTtcbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICBpZiAoYWN0aXZlSW5kZXggPT09IC0xKSB7XG4gICAgICAgIGNhcHRpb25zLnNldEFjdGl2ZUl0ZW0odW5kZWZpbmVkKTtcbiAgICAgIH1cblxuICAgICAgY29uc3QgYnV0dG9uID0gY2FwdGlvbnMuaXRlbXM/LlthY3RpdmVJbmRleF07XG5cbiAgICAgIGNhcHRpb25zLnNldEFjdGl2ZUl0ZW0oYnV0dG9uKTtcbiAgICB9XG4gIH0pO1xuXG4gIHBsYXllci5vbmUoJ2xvYWRlZG1ldGFkYXRhJywgKCkgPT4ge1xuICAgIGNhcHRpb25zLnNldEFjdGl2ZUl0ZW0odW5kZWZpbmVkKTtcbiAgICBwbGF5ZXIudGV4dFRyYWNrcygpLm1vZGUgPSAnaGlkZGVuJztcbiAgICBBcnJheS5mcm9tKHBsYXllci50ZXh0VHJhY2tzKCkpLmZvckVhY2godHJhY2sgPT4ge1xuICAgICAgdHJhY2subW9kZSA9ICdoaWRkZW4nO1xuICAgIH0pO1xuICAgIHBsYXllci50cmlnZ2VyKCdTUF9DQVBUSU9OU19TVUJTX09GRicpO1xuICB9KTtcblxuICBwbGF5ZXIub24oJ0lPU19DQVBUSU9OU19TWU5DJywgKCkgPT4ge1xuICAgIHNldFRpbWVvdXQoKCkgPT4ge1xuICAgIGNvbnN0IHRleHRUcmFja3MgPSBBcnJheS5mcm9tKHBsYXllci50ZXh0VHJhY2tzKCkpO1xuXG4gICAgaXRlbXNcbiAgICAgIC5yZXZlcnNlKClcbiAgICAgIC5maWx0ZXIoXG4gICAgICAgIChpdGVtLCBpbmRleCwgc2VsZikgPT5cbiAgICAgICAgICBpbmRleCA9PT0gc2VsZi5maW5kSW5kZXgoYSA9PiBhLmxhYmVsID09PSBpdGVtLmxhYmVsKSxcbiAgICAgIClcbiAgICAgIC5mb3JFYWNoKGl0ZW0gPT4ge1xuICAgICAgICBpZiAoaXRlbS5pc0FjdGl2ZSA9PT0gZmFsc2UpIHtcbiAgICAgICAgICBpZiAoaXRlbS5kYXRhKSB7XG4gICAgICAgICAgICBpdGVtLmRhdGEubW9kZSA9ICdoaWRkZW4nO1xuICAgICAgICAgIH1cbiAgICAgICAgICB0ZXh0VHJhY2tzLmZvckVhY2godGV4dFRyYWNrID0+IHtcbiAgICAgICAgICAgIGlmIChpdGVtLmxhYmVsID09PSB0ZXh0VHJhY2subGFiZWwpIHtcbiAgICAgICAgICAgICAgdGV4dFRyYWNrLm1vZGUgPSAnaGlkZGVuJztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9KTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBpZiAoaXRlbS5kYXRhKSB7XG4gICAgICAgICAgICBpdGVtLmRhdGEubW9kZSA9ICdzaG93aW5nJztcbiAgICAgICAgICB9XG4gICAgICAgICAgdGV4dFRyYWNrcy5mb3JFYWNoKHRleHRUcmFjayA9PiB7XG4gICAgICAgICAgICBpZiAoaXRlbS5sYWJlbCA9PT0gdGV4dFRyYWNrLmxhYmVsKSB7XG4gICAgICAgICAgICAgIHRleHRUcmFjay5tb2RlID0gJ3Nob3dpbmcnO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfSwgNSk7XG4gIH0pO1xuXG4gIC8vIFJ1biBvbmNlIHRvIGRpc2FibGUgY2FwdGlvbnMgb24gc3RhcnR1cFxuICBwbGF5ZXIub25lKCdwcm9ncmVzcycsICgpID0+IHtcbiAgICBjYXB0aW9ucy5zZXRBY3RpdmVJdGVtKHVuZGVmaW5lZCk7XG4gICAgcGxheWVyLnRleHRUcmFja3MoKS5tb2RlID0gJ2hpZGRlbic7XG4gICAgQXJyYXkuZnJvbShwbGF5ZXIudGV4dFRyYWNrcygpKS5mb3JFYWNoKHRyYWNrID0+IHtcbiAgICAgIHRyYWNrLm1vZGUgPSAnaGlkZGVuJztcbiAgICB9KTtcbiAgICBwbGF5ZXIudHJpZ2dlcignU1BfQ0FQVElPTlNfU1VCU19PRkYnKTtcblxuICAgIC8vIFJ1biBhZ2FpbiB0byBtYWtlIHN1cmUgYW55IGRlbGF5ZWQgYWN0aW9ucyBkb24ndCBzdGFydCB0aGVtIHVwIGFnYWluIHdoZW4gd2UgZG9uJ3Qgd2FudCB0aGVtIHRvXG4gICAgcGxheWVyLm9uZSgncHJvZ3Jlc3MnLCAoKSA9PiB7XG4gICAgICBjYXB0aW9ucy5zZXRBY3RpdmVJdGVtKHVuZGVmaW5lZCk7XG4gICAgICBwbGF5ZXIudGV4dFRyYWNrcygpLm1vZGUgPSAnaGlkZGVuJztcbiAgICAgIEFycmF5LmZyb20ocGxheWVyLnRleHRUcmFja3MoKSkuZm9yRWFjaCh0cmFjayA9PiB7XG4gICAgICAgIHRyYWNrLm1vZGUgPSAnaGlkZGVuJztcbiAgICAgIH0pO1xuICAgICAgcGxheWVyLnRyaWdnZXIoJ1NQX0NBUFRJT05TX1NVQlNfT0ZGJyk7XG5cbiAgICAgIHBsYXllci5vbigncHJvZ3Jlc3MnLCAoKSA9PiB7XG4gICAgICAgIC8vIGdldCB0aGUgdHJhY2tzIHRoYXQgaGF2ZSBiZWVuIGFkZGVkIHRvIHRoZSBwbGF5ZXIgdmlhIG5hdGl2ZSBwbGF5ZXJcbiAgICAgICAgY29uc3QgdGV4dFRyYWNrcyA9IEFycmF5LmZyb20ocGxheWVyLnRleHRUcmFja3MoKSk7XG5cbiAgICAgICAgLy8gaWYgd2UgaGF2ZSB0cmFja3MsIGFkZCB0aGVtIHRvIHRoZSBtZW51IGdyb3VwXG4gICAgICAgIGlmICh0ZXh0VHJhY2tzLmxlbmd0aCA+IDApIHtcbiAgICAgICAgICBmb3IgKGxldCBpID0gMDsgaSA8IHRleHRUcmFja3MubGVuZ3RoOyBpICs9IDEpIHtcbiAgICAgICAgICAgIC8vIHRyYWNrcyBzdGFydCBvdXQgJ2Rpc2FibGVkJyBieSBkZWZhdWx0LCBpbiBvcmRlciB0byByZWFkIHdoYXQncyBpbiB0aGUgdHJhY2tcbiAgICAgICAgICAgIC8vIGl0IG11c3QgYmUgdHVybmVkIG9uLiAnaGlkZGVuJyB0dXJucyB0aGUgdHJhY2sgJ29uJyBidXQgZG9lc24ndCBzaG93IGl0XG4gICAgICAgICAgICBpZiAodGV4dFRyYWNrc1tpXS5tb2RlID09PSAnZGlzYWJsZWQnKSB7XG4gICAgICAgICAgICAgIHRleHRUcmFja3NbaV0ubW9kZSA9ICdoaWRkZW4nO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBjb25zdCBhY3RpdmUgPSBwbGF5ZXIudGV4dFRyYWNrcygpW2ldLm1vZGUgPT09ICdzaG93aW5nJztcbiAgICAgICAgICAgIC8vIHRoZXJlIGFyZSBzZXZlcmFsIHRyYWNrcyAna2luZHMnLFxuICAgICAgICAgICAgLy8gd2UncmUgb25seSBnb2luZyB0byBhZGQgY2FwdGlvbiBhbmQgc3VidGl0bGUgdHJhY2tzXG4gICAgICAgICAgICAvLyBjaGVjayB0byBzZWUgaWYgdGhlIHRyYWNrIGhhcyBhbnkgYWN0aXZlIGN1ZXMsIGlmIGl0IGRvZXMgdGhlbiBhZGRcbiAgICAgICAgICAgIGl0ZW1zLnB1c2goe1xuICAgICAgICAgICAgICBjbGFzc2VzOiAnc3AtbWVudS1pdGVtJyxcbiAgICAgICAgICAgICAgbGFiZWw6IGdldE1lbnVMYWJlbCh7XG4gICAgICAgICAgICAgICAgbGFiZWw6XG4gICAgICAgICAgICAgICAgICB0ZXh0VHJhY2tzW2ldLmxhYmVsIHx8XG4gICAgICAgICAgICAgICAgICB0ZXh0VHJhY2tzW2ldLm5hbWUgfHxcbiAgICAgICAgICAgICAgICAgIHRleHRUcmFja3NbaV0ubGFuZ3VhZ2UsXG4gICAgICAgICAgICAgICAgc291cmNlSGFuZGxlcixcbiAgICAgICAgICAgICAgfSksXG4gICAgICAgICAgICAgIGlkOiBgJHtpfWAsXG4gICAgICAgICAgICAgIG9yZGVyOiB0ZXh0VHJhY2tzLmxlbmd0aCAtIGksXG4gICAgICAgICAgICAgIGlzQWN0aXZlOiBhY3RpdmUsXG4gICAgICAgICAgICAgIHNlbGVjdGFibGU6IHRydWUsXG4gICAgICAgICAgICAgIGRhdGE6IHsgLi4udGV4dFRyYWNrc1tpXSwgaWQ6IGAke2l9YCB9LFxuICAgICAgICAgICAgICBjYWxsYmFjazogKGRhdGEsIGJ1dHRvbikgPT4ge1xuICAgICAgICAgICAgICAgIGNvbnN0IHsgaXNTZWxlY3RlZF8gfSA9IGJ1dHRvbjtcbiAgICAgICAgICAgICAgICAvKlxuICAgICAgICAgICAgICAgICAgRm9yIHJlbW90ZSB0ZXh0IHRyYWNrcyB3ZSBuZWVkIHRvIG1hbmFnZSBib3RoIHRoZSB0ZXh0IHRyYWNrcyBhcyBhICd3aG9sZScgYW5kXG4gICAgICAgICAgICAgICAgICBlYWNoIGluZGl2aWR1YWwgdGV4dCB0cmFjay4gU28gd2hlbiB3ZSB0dXJuIG9uL29mZiBhIHRyYWNrIHdlIGhhdmUgdG8gdHVyblxuICAgICAgICAgICAgICAgICAgb24vb2ZmIHRleHQgdHJhY2tzIGFuZCB0aGVuIHR1cm4gb24vb2ZmIHRoYXQgc3BlY2lmaWMgdHJhY2suIFRoaXMgaXMgbWFuYWdlZFxuICAgICAgICAgICAgICAgICAgdGhyb3VnaCB0aGUgcGFyYW1ldGVyICdtb2RlJyB3aGljaCBjYW4gaGF2ZSB0aGVzZSB2YWx1ZXM6IFxuICAgICAgICAgICAgICAgICAgc2hvd2luZywgZGlzYWJsZWQsIGhpZGRlbi5cbiAgICAgICAgICAgICAgICAgIEZvciBvdXIgdXNlIGNhc2Ugd2UganVzdCBzaG93IGFuZCBoaWRkZW4uXG4gICAgICAgICAgICAgICAgKi9cblxuICAgICAgICAgICAgICAgIC8vIHNpbmNlIHdlJ3JlIHR1cm5pbmcgb24gdGhpcyB0cmFjaywgd2UgbmVlZCB0byBtYWtlIHN1cmUgc2hvd2luZyB0cmFja3MgYXJlIGRpc2FibGVkXG4gICAgICAgICAgICAgICAgY2FwdGlvbnMuc2V0QWN0aXZlSXRlbSh1bmRlZmluZWQpO1xuICAgICAgICAgICAgICAgIEFycmF5LmZyb20ocGxheWVyLnRleHRUcmFja3MoKSkuZm9yRWFjaCgoXywgaW5kZXgpID0+IHtcbiAgICAgICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKClbaW5kZXhdLm1vZGUgPSAnaGlkZGVuJztcbiAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgIC8vIGlmIHRoZSBidXR0b24gaXMgc2VsZWN0ZWQsIHRoZSB1c2VyIGlzIHR1cm5pbmcgb2ZmIHRoZSBjYXB0aW9ucy9zdWJzXG4gICAgICAgICAgICAgICAgaWYgKGlzU2VsZWN0ZWRfKSB7XG4gICAgICAgICAgICAgICAgICBkYXRhLm1vZGUgPSAnaGlkZGVuJztcbiAgICAgICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKCkubW9kZSA9ICdoaWRkZW4nO1xuICAgICAgICAgICAgICAgICAgcGxheWVyLnRyaWdnZXIoJ1NQX0NBUFRJT05TX1NVQlNfT0ZGJyk7XG4gICAgICAgICAgICAgICAgICBBcnJheS5mcm9tKHBsYXllci50ZXh0VHJhY2tzKCkpLmZvckVhY2godHJhY2sgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0cmFjay5tb2RlID0gJ2hpZGRlbic7XG4gICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgICAgICBpZiAocGxheWVyLnlvdWJvcmEpIHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgICAgICAgICAgLy8gZXNsaW50LWRpc2FibGUtbmV4dC1saW5lIEB0eXBlc2NyaXB0LWVzbGludC9uby11bnNhZmUtY2FsbFxuICAgICAgICAgICAgICAgICAgICAgIHBsYXllci55b3Vib3JhKHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBAdHlwZXNjcmlwdC1lc2xpbnQvbm8tdW5zYWZlLWFzc2lnbm1lbnRcbiAgICAgICAgICAgICAgICAgICAgICAgICdjb250ZW50LmN1c3RvbURpbWVuc2lvbi4xJzogJ29mZicsXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1hc3NpZ25tZW50XG4gICAgICAgICAgICAgICAgICAgICAgICAnY29udGVudC5zdWJ0aXRsZXMnOiAnb2ZmJyxcbiAgICAgICAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfSBjYXRjaCAoZSkge1xuICAgICAgICAgICAgICAgICAgICAvKiAgKi9cbiAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgcGxheWVyLnRyaWdnZXIoJ0lPU19DQVBUSU9OU19TWU5DJyk7XG4gICAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gc2V0IGJ1dHRvbiB0byBhY3RpdmVcbiAgICAgICAgICAgICAgICBjYXB0aW9ucy5zZXRBY3RpdmVJdGVtKGJ1dHRvbik7XG5cbiAgICAgICAgICAgICAgICAvLyB0dXJuIG9uIHRyYWNrc1xuICAgICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKCkubW9kZSA9ICdzaG93aW5nJztcblxuICAgICAgICAgICAgICAgIC8vIHR1cm4gb24gdGhpcyB0cmFja1xuICAgICAgICAgICAgICAgIGNvbnN0IGlkSW5kZXggPSBOdW1iZXIoYnV0dG9uLm9wdGlvbnNfLmlkKTtcbiAgICAgICAgICAgICAgICBpZiAoaWRJbmRleCAhPT0gdW5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICBwbGF5ZXIudGV4dFRyYWNrcygpW2lkSW5kZXhdLm1vZGUgPSAnc2hvd2luZyc7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGRhdGEubW9kZSA9ICdzaG93aW5nJztcblxuICAgICAgICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICAgICAgICBpZiAocGxheWVyLnlvdWJvcmEpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1jYWxsXG4gICAgICAgICAgICAgICAgICAgIHBsYXllci55b3Vib3JhKHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1hc3NpZ25tZW50XG4gICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQuY3VzdG9tRGltZW5zaW9uLjEnOlxuICAgICAgICAgICAgICAgICAgICAgICAgcGxheWVyLnRleHRUcmFja3MoKVtpZEluZGV4XS5sYW5ndWFnZSB8fFxuICAgICAgICAgICAgICAgICAgICAgICAgcGxheWVyLnRleHRUcmFja3MoKVtpZEluZGV4XS5sYWJlbCxcbiAgICAgICAgICAgICAgICAgICAgICAvLyBlc2xpbnQtZGlzYWJsZS1uZXh0LWxpbmUgQHR5cGVzY3JpcHQtZXNsaW50L25vLXVuc2FmZS1hc3NpZ25tZW50XG4gICAgICAgICAgICAgICAgICAgICAgJ2NvbnRlbnQuc3VidGl0bGVzJzpcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKClbaWRJbmRleF0ubGFuZ3VhZ2UgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgIHBsYXllci50ZXh0VHJhY2tzKClbaWRJbmRleF0ubGFiZWwsXG4gICAgICAgICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgICAgICAgICAgIC8qICAqL1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cblxuICAgICAgICAgIGl0ZW1zID0gaXRlbXMuZmlsdGVyKFxuICAgICAgICAgICAgKGl0ZW0sIGluZGV4LCBzZWxmKSA9PlxuICAgICAgICAgICAgICBpbmRleCA9PT0gc2VsZi5maW5kSW5kZXgoYSA9PiBhLmxhYmVsID09PSBpdGVtLmxhYmVsKSxcbiAgICAgICAgICApO1xuXG4gICAgICAgICAgY2FwdGlvbnMuYWRkSXRlbXMoaXRlbXMsIHRydWUpO1xuICAgICAgICB9XG4gICAgICB9KTtcbiAgICB9KTtcbiAgfSk7XG5cbiAgcGxheWVyLm9uZSgncGxheScsICgpID0+IHtcbiAgICBjYXB0aW9ucy5zZXRBY3RpdmVJdGVtKHVuZGVmaW5lZCk7XG4gICAgcGxheWVyLnRleHRUcmFja3MoKS5tb2RlID0gJ2hpZGRlbic7XG4gICAgQXJyYXkuZnJvbShwbGF5ZXIudGV4dFRyYWNrcygpKS5mb3JFYWNoKHRyYWNrID0+IHtcbiAgICAgIHRyYWNrLm1vZGUgPSAnaGlkZGVuJztcbiAgICB9KTtcbiAgICBwbGF5ZXIudHJpZ2dlcignU1BfQ0FQVElPTlNfU1VCU19PRkYnKTtcbiAgfSk7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGlPU1NldHVwO1xuIiwiaW1wb3J0IHNldENhcHRpb25zIGZyb20gJy4uL2hlbHBlcnMvc2V0Q2FwdGlvbnMnO1xuaW1wb3J0IFNQX0xJQl9SRUFEWSBmcm9tICcuL1NQX0xJQl9SRUFEWSc7XG5pbXBvcnQgaU9TU2V0dXAgZnJvbSAnLi9pT1NTZXR1cCc7XG5pbXBvcnQgaXNJT1MgZnJvbSAnLi4vaGVscGVycy9pc0lPUyc7XG5pbXBvcnQge1xuICBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zLFxuICBTb3VyY2VIYW5kbGVyLFxuICBTUEdyb3VwLFxuICBTUEl0ZW1PYmplY3QsXG4gIFNQTWVudSxcbiAgVmlkZW9Kc1BsYXllcixcbn0gZnJvbSAnY29tbW9uL3RzTW9kZWxzJztcblxuLypcbi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuSW5pdCBGdW5jdGlvbnMgb24gUGxheWVyIFJlYWR5XG4tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS1cbiovXG5cbmludGVyZmFjZSBBcmdzIHtcbiAgcGxheWVyOiBWaWRlb0pzUGxheWVyO1xuICBtZW51OiBTUE1lbnU7XG4gIGNhcHRpb25zOiBTUEdyb3VwO1xuICBvcHRpb25zOiBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zO1xufVxuXG5mdW5jdGlvbiBpbml0aWFsaXplKHsgcGxheWVyLCBtZW51LCBjYXB0aW9ucywgb3B0aW9ucyB9OiBBcmdzKTogdm9pZCB7XG4gIHBsYXllci5vbihcbiAgICAnc2V0dGluZ3NNZW51LVNvdXJjZUhhbmRsZXItY2hhbmdlJyxcbiAgICBhc3luYyAoZXZlbnQsIHNvdXJjZUhhbmRsZXI6IFNvdXJjZUhhbmRsZXIpID0+IHtcbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICBjb25zb2xlLmRlYnVnKCdbQ0FQVElPTlNdOiBDYXB0aW9ucyBsb2FkaW5nLi4uJyk7XG5cbiAgICAgIC8vIFNldCBhY3RpdmUgaXRlbSB0byB1bmRlZmluZWQgd2hlbiBjaGFuZ2luZyBtdWx0aS1sYW5ndWFnZSBjYXB0aW9uc1xuICAgICAgY2FwdGlvbnMuc2V0QWN0aXZlSXRlbSh1bmRlZmluZWQpO1xuXG4gICAgICBjb25zdCBtZW51RWxlbWVudCA9IG1lbnUuZWwoKSBhcyBIVE1MRWxlbWVudDtcblxuICAgICAgY29uc3QgZGlzcGxheSA9IG1lbnVFbGVtZW50Py5zdHlsZT8uZGlzcGxheTtcblxuICAgICAgdHJ5IHtcbiAgICAgICAgbWVudUVsZW1lbnQuc3R5bGUuZGlzcGxheSA9ICdub25lJztcbiAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgLyogICovXG4gICAgICB9XG5cbiAgICAgIGNvbnN0IGl0ZW1zOiBTUEl0ZW1PYmplY3RbXSA9IFtdO1xuICAgICAgLy8gU2V0IHVwIHNpZGVjYXIgY2FwdGlvbnNcbiAgICAgIGF3YWl0IHNldENhcHRpb25zKHtcbiAgICAgICAgcGxheWVyLFxuICAgICAgICBzb3VyY2VIYW5kbGVyLFxuICAgICAgICBjYXB0aW9ucyxcbiAgICAgICAgaXRlbXMsXG4gICAgICAgIG9wdGlvbnMsXG4gICAgICB9KTtcblxuICAgICAgdHJ5IHtcbiAgICAgICAgbWVudUVsZW1lbnQuc3R5bGUuZGlzcGxheSA9IGRpc3BsYXkgfHwgJ2Jsb2NrJztcbiAgICAgIH0gY2F0Y2ggKGUpIHtcbiAgICAgICAgLyogICovXG4gICAgICB9XG5cbiAgICAgIC8vIGVzbGludC1kaXNhYmxlLW5leHQtbGluZSBuby1jb25zb2xlXG4gICAgICBjb25zb2xlLmRlYnVnKCdbQ0FQVElPTlNdOiBDYXB0aW9ucyBsb2FkZWQuJyk7XG5cbiAgICAgIGlmIChpc0lPUygpKSB7XG4gICAgICAgIC8vIFNldCBpbmxpbmUvZW1iZWRkZWQgdXAgZm9yIGlPUy4gU2lkZWNhciBvdmVycmlkZXMgaW5saW5lL2VtYmVkZGVkXG4gICAgICAgIGlPU1NldHVwKHtcbiAgICAgICAgICBwbGF5ZXIsXG4gICAgICAgICAgc291cmNlSGFuZGxlcixcbiAgICAgICAgICBjYXB0aW9ucyxcbiAgICAgICAgICBpdGVtcyxcbiAgICAgICAgfSk7XG4gICAgICB9IGVsc2Uge1xuICAgICAgICAvLyBTZXQgdXAgbGlzdGVuZXJzIGZvciBpbmxpbmUvZW1iZWRkZWQgY2FwdGlvbnMuIFNpZGVjYXIgb3ZlcnJpZGVzIGlubGluZS9lbWJlZGRlZFxuICAgICAgICBTUF9MSUJfUkVBRFkoe1xuICAgICAgICAgIHBsYXllcixcbiAgICAgICAgICBzb3VyY2VIYW5kbGVyLFxuICAgICAgICAgIGNhcHRpb25zLFxuICAgICAgICAgIGl0ZW1zLFxuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICB9LFxuICApO1xuXG4gIHBsYXllci5yZWFkeSgoKSA9PiB7XG4gICAgaWYgKCFwbGF5ZXIuY29udHJvbEJhci5zZXR0aW5nc01lbnVMZWdhY3kpIHtcbiAgICAgIC8vIEhhbmRsZSBtb3VzZSBvdmVyIGFuZCBvdXQgZXZlbnRzXG4gICAgICBjb25zdCB0aGlzRWxlbWVudCA9IG1lbnUuZWwoKTtcbiAgICAgIHRoaXNFbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ21vdXNlb3ZlcicsIGV2ZW50ID0+IHtcbiAgICAgICAgbWVudS5oYW5kbGVUb3VjaChldmVudCwgdHJ1ZSk7XG4gICAgICB9KTtcbiAgICAgIHRoaXNFbGVtZW50LmFkZEV2ZW50TGlzdGVuZXIoJ21vdXNlb3V0JywgZXZlbnQgPT4ge1xuICAgICAgICBtZW51LmhhbmRsZVRvdWNoKGV2ZW50LCB0cnVlKTtcbiAgICAgIH0pO1xuICAgIH1cbiAgfSk7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGluaXRpYWxpemU7XG4iLCJpbXBvcnQgZ2V0Q2FwdGlvbk9wdGlvbnMgZnJvbSAnLi9nZXRDYXB0aW9uT3B0aW9ucyc7XG5cbmltcG9ydCB7IFZpZGVvSnNQbGF5ZXIsIFNhcmRpdXNKc1BsYXllck9wdGlvbnMgfSBmcm9tICcuLi9jb21tb24vdHNNb2RlbHMnO1xuXG5pbnRlcmZhY2UgQXJncyB7XG4gIHBsYXllcjogVmlkZW9Kc1BsYXllcjtcbiAgb3B0aW9uczogU2FyZGl1c0pzUGxheWVyT3B0aW9ucztcbn1cblxuZnVuY3Rpb24gYWRkQ3VzdG9tUGxheWVyU3R5bGVzKHsgcGxheWVyLCBvcHRpb25zIH06IEFyZ3MpOiB2b2lkIHtcbiAgLypcbiAgLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tXG4gIEFkZCBkZWZhdWx0cyBmb3IgOjpjdWUgc3R5bGVzIGZyb20gcGxheWVyIHNldHRpbmdzXG4gIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAqL1xuICBjb25zdCBjYXB0aW9uT3B0aW9ucyA9IGdldENhcHRpb25PcHRpb25zKG9wdGlvbnMpO1xuICBjb25zdCB7IGN1ZVN0eWxlLCByZWdpb25TdHlsZSB9ID0gY2FwdGlvbk9wdGlvbnM7XG5cbiAgY29uc3Qgc3R5bGVFbGVtZW50ID0gZG9jdW1lbnQuY3JlYXRlRWxlbWVudCgnc3R5bGUnKTtcbiAgc3R5bGVFbGVtZW50LnRleHRDb250ZW50ID0gYGA7XG4gIGlmIChjdWVTdHlsZSkge1xuICAgIHN0eWxlRWxlbWVudC50ZXh0Q29udGVudCArPSBgIyR7cGxheWVyLmlkKCl9IHZpZGVvOjpjdWUgeyR7Y3VlU3R5bGV9fWA7XG4gIH1cbiAgaWYgKHJlZ2lvblN0eWxlKSB7XG4gICAgc3R5bGVFbGVtZW50LnRleHRDb250ZW50ICs9IGAjJHtwbGF5ZXIuaWQoKX0gdmlkZW86OmN1ZS1yZWdpb24geyR7cmVnaW9uU3R5bGV9fWA7XG4gIH1cblxuICBkb2N1bWVudC5oZWFkLmFwcGVuZENoaWxkKHN0eWxlRWxlbWVudCk7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGFkZEN1c3RvbVBsYXllclN0eWxlcztcbiIsImltcG9ydCBwcm9ncmVzc092ZXJyaWRlQ2FwdGlvblNldHRpbmdzIGZyb20gJy4vZXZlbnRIYW5kbGVycy9wcm9ncmVzc092ZXJyaWRlQ2FwdGlvblNldHRpbmdzJztcbmltcG9ydCBpbml0aWFsaXplIGZyb20gJy4vZXZlbnRIYW5kbGVycy9pbml0aWFsaXplJztcbmltcG9ydCBhZGRDdXN0b21QbGF5ZXJTdHlsZXMgZnJvbSAnLi9oZWxwZXJzL2FkZEN1c3RvbVBsYXllclN0eWxlcyc7XG5cbmltcG9ydCB7XG4gIFZpZGVvSnNQbGF5ZXIsXG4gIFNhcmRpdXNKc1BsYXllck9wdGlvbnMsXG4gIFNQTWVudSxcbn0gZnJvbSAnLi9jb21tb24vdHNNb2RlbHMnO1xuXG5mdW5jdGlvbiBjbG9zZWRDYXB0aW9ucyhcbiAgcGxheWVyOiBWaWRlb0pzUGxheWVyLFxuICBvcHRpb25zOiBTYXJkaXVzSnNQbGF5ZXJPcHRpb25zLFxuKTogU1BNZW51IHtcbiAgYWRkQ3VzdG9tUGxheWVyU3R5bGVzKHsgcGxheWVyLCBvcHRpb25zIH0pO1xuXG4gIC8qXG4gIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICBzZXQgdXAgc2FyZGl1cyBtZW51XG4gIC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLVxuICAqL1xuXG4gIGNvbnN0IG1lbnU6IFNQTWVudSA9IG5ldyBzYXJkaXVzLmxpYnMuTWVudU1ha2VyKHBsYXllciwgb3B0aW9ucyk7XG5cbiAgLy8gYWRkIGNsYXNzIGZvciB0aGUgY2MgaWNvblxuICBtZW51LmFkZENsYXNzKCd2anMtaWNvbi1jYXB0aW9ucycpO1xuXG4gIC8vIGFkZCBvdXIgZ3JvdXAgdG8gdGhlIG1lbnVcbiAgY29uc3QgY2FwdGlvbnMgPSBtZW51LmFkZEdyb3VwKHtcbiAgICBjbGFzc2VzOiAnc3AtY2FwdGlvbnMnLFxuICAgIGlkOiAnc3AtY2FwdGlvbnMnLFxuICAgIHRpdGxlOiAnQ2xvc2VkIENhcHRpb25zJyxcbiAgICBtaW5JdGVtczogMSxcbiAgfSk7XG5cbiAgcHJvZ3Jlc3NPdmVycmlkZUNhcHRpb25TZXR0aW5ncyh7IHBsYXllciwgb3B0aW9ucyB9KTtcbiAgaW5pdGlhbGl6ZSh7IHBsYXllciwgbWVudSwgY2FwdGlvbnMsIG9wdGlvbnMgfSk7XG5cbiAgcmV0dXJuIG1lbnU7XG59XG5cbmV4cG9ydCBkZWZhdWx0IGNsb3NlZENhcHRpb25zO1xuIiwiaW1wb3J0IGNsb3NlZENhcHRpb25zIGZyb20gJy4vY2xvc2VkQ2FwdGlvbnMnO1xuXG5pbXBvcnQgeyBTYXJkaXVzVkpTIH0gZnJvbSAnLi9jb21tb24vdHNNb2RlbHMnO1xuXG5jb25zdCBWSlM6IFNhcmRpdXNWSlMgPSAodmlkZW9qcyBhcyB1bmtub3duKSBhcyBTYXJkaXVzVkpTO1xuY29uc3QgQ29tcG9uZW50ID0gVkpTLmdldENvbXBvbmVudCgnQ29tcG9uZW50Jyk7XG5cbmNvbnN0IENsb3NlZENhcHRpb25zID0gVkpTLmV4dGVuZChDb21wb25lbnQsIHtcbiAgY29uc3RydWN0b3I6IGNsb3NlZENhcHRpb25zLFxufSk7XG5cbnNhcmRpdXMubWVudTx0eXBlb2YgQ2xvc2VkQ2FwdGlvbnM+KCdjbG9zZWRDYXB0aW9ucycsIENsb3NlZENhcHRpb25zKTtcblxuZXhwb3J0IGRlZmF1bHQgQ2xvc2VkQ2FwdGlvbnM7XG4iXSwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///1\n')}]);/*!
 * s73-sdk-hlsjs.js - 4.8.13
 * <www.system73.com>
 *
 * Copyright (C) System73 Europe, SL - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited
 * Proprietary and confidential
 * 2016 - 2025
 */
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("S73HlsjsWrapper",[],e):"object"==typeof exports?exports.S73HlsjsWrapper=e():t.S73HlsjsWrapper=e()}(self,(()=>(()=>{var __webpack_modules__={5923:t=>{"use strict";t.exports=function(t,e){var n=new Array(arguments.length-1),r=0,i=2,s=!0;for(;i<arguments.length;)n[r++]=arguments[i++];return new Promise((function(i,o){n[r]=function(t){if(s)if(s=!1,t)o(t);else{for(var e=new Array(arguments.length-1),n=0;n<e.length;)e[n++]=arguments[n];i.apply(null,e)}};try{t.apply(e||null,n)}catch(t){s&&(s=!1,o(t))}}))}},2741:(t,e)=>{"use strict";var n=e;n.length=function(t){var e=t.length;if(!e)return 0;for(var n=0;--e%4>1&&"="===t.charAt(e);)++n;return Math.ceil(3*t.length)/4-n};for(var r=new Array(64),i=new Array(123),s=0;s<64;)i[r[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;n.encode=function(t,e,n){for(var i,s=null,o=[],a=0,c=0;e<n;){var u=t[e++];switch(c){case 0:o[a++]=r[u>>2],i=(3&u)<<4,c=1;break;case 1:o[a++]=r[i|u>>4],i=(15&u)<<2,c=2;break;case 2:o[a++]=r[i|u>>6],o[a++]=r[63&u],c=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return c&&(o[a++]=r[i],o[a++]=61,1===c&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";n.decode=function(t,e,n){for(var r,s=n,a=0,c=0;c<t.length;){var u=t.charCodeAt(c++);if(61===u&&a>1)break;if(void 0===(u=i[u]))throw Error(o);switch(a){case 0:r=u,a=1;break;case 1:e[n++]=r<<2|(48&u)>>4,r=u,a=2;break;case 2:e[n++]=(15&r)<<4|(60&u)>>2,r=u,a=3;break;case 3:e[n++]=(3&r)<<6|u,a=0}}if(1===a)throw Error(o);return n-s},n.test=function(t){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(t)}},3036:t=>{"use strict";function e(){this._listeners={}}t.exports=e,e.prototype.on=function(t,e,n){return(this._listeners[t]||(this._listeners[t]=[])).push({fn:e,ctx:n||this}),this},e.prototype.off=function(t,e){if(void 0===t)this._listeners={};else if(void 0===e)this._listeners[t]=[];else for(var n=this._listeners[t],r=0;r<n.length;)n[r].fn===e?n.splice(r,1):++r;return this},e.prototype.emit=function(t){var e=this._listeners[t];if(e){for(var n=[],r=1;r<arguments.length;)n.push(arguments[r++]);for(r=0;r<e.length;)e[r].fn.apply(e[r++].ctx,n)}return this}},7760:t=>{"use strict";function e(t){return"undefined"!=typeof Float32Array?function(){var e=new Float32Array([-0]),n=new Uint8Array(e.buffer),r=128===n[3];function i(t,r,i){e[0]=t,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3]}function s(t,r,i){e[0]=t,r[i]=n[3],r[i+1]=n[2],r[i+2]=n[1],r[i+3]=n[0]}function o(t,r){return n[0]=t[r],n[1]=t[r+1],n[2]=t[r+2],n[3]=t[r+3],e[0]}function a(t,r){return n[3]=t[r],n[2]=t[r+1],n[1]=t[r+2],n[0]=t[r+3],e[0]}t.writeFloatLE=r?i:s,t.writeFloatBE=r?s:i,t.readFloatLE=r?o:a,t.readFloatBE=r?a:o}():function(){function e(t,e,n,r){var i=e<0?1:0;if(i&&(e=-e),0===e)t(1/e>0?0:2147483648,n,r);else if(isNaN(e))t(2143289344,n,r);else if(e>34028234663852886e22)t((i<<31|2139095040)>>>0,n,r);else if(e<11754943508222875e-54)t((i<<31|Math.round(e/1401298464324817e-60))>>>0,n,r);else{var s=Math.floor(Math.log(e)/Math.LN2);t((i<<31|s+127<<23|8388607&Math.round(e*Math.pow(2,-s)*8388608))>>>0,n,r)}}function o(t,e,n){var r=t(e,n),i=2*(r>>31)+1,s=r>>>23&255,o=8388607&r;return 255===s?o?NaN:i*(1/0):0===s?1401298464324817e-60*i*o:i*Math.pow(2,s-150)*(o+8388608)}t.writeFloatLE=e.bind(null,n),t.writeFloatBE=e.bind(null,r),t.readFloatLE=o.bind(null,i),t.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var e=new Float64Array([-0]),n=new Uint8Array(e.buffer),r=128===n[7];function i(t,r,i){e[0]=t,r[i]=n[0],r[i+1]=n[1],r[i+2]=n[2],r[i+3]=n[3],r[i+4]=n[4],r[i+5]=n[5],r[i+6]=n[6],r[i+7]=n[7]}function s(t,r,i){e[0]=t,r[i]=n[7],r[i+1]=n[6],r[i+2]=n[5],r[i+3]=n[4],r[i+4]=n[3],r[i+5]=n[2],r[i+6]=n[1],r[i+7]=n[0]}function o(t,r){return n[0]=t[r],n[1]=t[r+1],n[2]=t[r+2],n[3]=t[r+3],n[4]=t[r+4],n[5]=t[r+5],n[6]=t[r+6],n[7]=t[r+7],e[0]}function a(t,r){return n[7]=t[r],n[6]=t[r+1],n[5]=t[r+2],n[4]=t[r+3],n[3]=t[r+4],n[2]=t[r+5],n[1]=t[r+6],n[0]=t[r+7],e[0]}t.writeDoubleLE=r?i:s,t.writeDoubleBE=r?s:i,t.readDoubleLE=r?o:a,t.readDoubleBE=r?a:o}():function(){function e(t,e,n,r,i,s){var o=r<0?1:0;if(o&&(r=-r),0===r)t(0,i,s+e),t(1/r>0?0:2147483648,i,s+n);else if(isNaN(r))t(0,i,s+e),t(2146959360,i,s+n);else if(r>17976931348623157e292)t(0,i,s+e),t((o<<31|2146435072)>>>0,i,s+n);else{var a;if(r<22250738585072014e-324)t((a=r/5e-324)>>>0,i,s+e),t((o<<31|a/4294967296)>>>0,i,s+n);else{var c=Math.floor(Math.log(r)/Math.LN2);1024===c&&(c=1023),t(4503599627370496*(a=r*Math.pow(2,-c))>>>0,i,s+e),t((o<<31|c+1023<<20|1048576*a&1048575)>>>0,i,s+n)}}}function o(t,e,n,r,i){var s=t(r,i+e),o=t(r,i+n),a=2*(o>>31)+1,c=o>>>20&2047,u=4294967296*(1048575&o)+s;return 2047===c?u?NaN:a*(1/0):0===c?5e-324*a*u:a*Math.pow(2,c-1075)*(u+4503599627370496)}t.writeDoubleLE=e.bind(null,n,0,4),t.writeDoubleBE=e.bind(null,r,4,0),t.readDoubleLE=o.bind(null,i,0,4),t.readDoubleBE=o.bind(null,s,4,0)}(),t}function n(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}function r(t,e,n){e[n]=t>>>24,e[n+1]=t>>>16&255,e[n+2]=t>>>8&255,e[n+3]=255&t}function i(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16|t[e+3]<<24)>>>0}function s(t,e){return(t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3])>>>0}t.exports=e(e)},5263:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(t){}return null}module.exports=inquire},3568:t=>{"use strict";t.exports=function(t,e,n){var r=n||8192,i=r>>>1,s=null,o=r;return function(n){if(n<1||n>i)return t(n);o+n>r&&(s=t(r),o=0);var a=e.call(s,o,o+=n);return 7&o&&(o=1+(7|o)),a}}},8397:(t,e)=>{"use strict";var n=e;n.length=function(t){for(var e=0,n=0,r=0;r<t.length;++r)(n=t.charCodeAt(r))<128?e+=1:n<2048?e+=2:55296==(64512&n)&&56320==(64512&t.charCodeAt(r+1))?(++r,e+=4):e+=3;return e},n.read=function(t,e,n){if(n-e<1)return"";for(var r,i=null,s=[],o=0;e<n;)(r=t[e++])<128?s[o++]=r:r>191&&r<224?s[o++]=(31&r)<<6|63&t[e++]:r>239&&r<365?(r=((7&r)<<18|(63&t[e++])<<12|(63&t[e++])<<6|63&t[e++])-65536,s[o++]=55296+(r>>10),s[o++]=56320+(1023&r)):s[o++]=(15&r)<<12|(63&t[e++])<<6|63&t[e++],o>8191&&((i||(i=[])).push(String.fromCharCode.apply(String,s)),o=0);return i?(o&&i.push(String.fromCharCode.apply(String,s.slice(0,o))),i.join("")):String.fromCharCode.apply(String,s.slice(0,o))},n.write=function(t,e,n){for(var r,i,s=n,o=0;o<t.length;++o)(r=t.charCodeAt(o))<128?e[n++]=r:r<2048?(e[n++]=r>>6|192,e[n++]=63&r|128):55296==(64512&r)&&56320==(64512&(i=t.charCodeAt(o+1)))?(r=65536+((1023&r)<<10)+(1023&i),++o,e[n++]=r>>18|240,e[n++]=r>>12&63|128,e[n++]=r>>6&63|128,e[n++]=63&r|128):(e[n++]=r>>12|224,e[n++]=r>>6&63|128,e[n++]=63&r|128);return n-s}},4674:t=>{"use strict";const{AbortController:e,AbortSignal:n}="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0;t.exports=e,t.exports.AbortSignal=n,t.exports.default=e},887:(t,e,n)=>{t.exports=n(2473)},5334:(t,e,n)=>{"use strict";var r=n(1986),i=n(2080),s=n(2713),o=n(2684),a=n(8709),c=n(1094),u=n(2044),l=n(6274),h=n(8111),d=n(3621),p=n(5578),f=n(3035);t.exports=function(t){return new Promise((function(e,n){var g,y=t.data,m=t.headers,b=t.responseType,v=t.withXSRFToken;function w(){t.cancelToken&&t.cancelToken.unsubscribe(g),t.signal&&t.signal.removeEventListener("abort",g)}r.isFormData(y)&&r.isStandardBrowserEnv()&&delete m["Content-Type"];var S=new XMLHttpRequest;if(t.auth){var E=t.auth.username||"",_=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";m.Authorization="Basic "+btoa(E+":"+_)}var C=a(t.baseURL,t.url,t.allowAbsoluteUrls);function T(){if(S){var r="getAllResponseHeaders"in S?c(S.getAllResponseHeaders()):null,s={data:b&&"text"!==b&&"json"!==b?S.response:S.responseText,status:S.status,statusText:S.statusText,headers:r,config:t,request:S};i((function(t){e(t),w()}),(function(t){n(t),w()}),s),S=null}}if(S.open(t.method.toUpperCase(),o(C,t.params,t.paramsSerializer),!0),S.timeout=t.timeout,"onloadend"in S?S.onloadend=T:S.onreadystatechange=function(){S&&4===S.readyState&&(0!==S.status||S.responseURL&&0===S.responseURL.indexOf("file:"))&&setTimeout(T)},S.onabort=function(){S&&(n(new h("Request aborted",h.ECONNABORTED,t,S)),S=null)},S.onerror=function(){n(new h("Network Error",h.ERR_NETWORK,t,S)),S=null},S.ontimeout=function(){var e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",r=t.transitional||l;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(new h(e,r.clarifyTimeoutError?h.ETIMEDOUT:h.ECONNABORTED,t,S)),S=null},r.isStandardBrowserEnv()&&(v&&r.isFunction(v)&&(v=v(t)),v||!1!==v&&u(C))){var I=t.xsrfHeaderName&&t.xsrfCookieName&&s.read(t.xsrfCookieName);I&&(m[t.xsrfHeaderName]=I)}"setRequestHeader"in S&&r.forEach(m,(function(t,e){void 0===y&&"content-type"===e.toLowerCase()?delete m[e]:S.setRequestHeader(e,t)})),r.isUndefined(t.withCredentials)||(S.withCredentials=!!t.withCredentials),b&&"json"!==b&&(S.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&S.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&S.upload&&S.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(g=function(e){S&&(n(!e||e.type?new d(null,t,S):e),S.abort(),S=null)},t.cancelToken&&t.cancelToken.subscribe(g),t.signal&&(t.signal.aborted?g():t.signal.addEventListener("abort",g))),y||!1===y||0===y||""===y||(y=null);var N=p(C);N&&-1===f.protocols.indexOf(N)?n(new h("Unsupported protocol "+N+":",h.ERR_BAD_REQUEST,t)):S.send(y)}))}},2473:(t,e,n)=>{"use strict";var r=n(1986),i=n(7198),s=n(5897),o=n(8961),a=n(1370),c=n(4188);var u=function t(e){var n=new s(e),a=i(s.prototype.request,n);return r.extend(a,s.prototype,n),r.extend(a,n),a.create=function(n){return t(o(e,n))},a}(a);u.Axios=s,u.CanceledError=n(3621),u.CancelToken=n(7277),u.isCancel=n(2810),u.VERSION=n(7473).version,u.toFormData=n(7714),u.AxiosError=n(8111),u.Cancel=u.CanceledError,u.all=function(t){return Promise.all(t)},u.spread=n(7046),u.isAxiosError=n(6377),u.formToJSON=function(t){return c(r.isHTMLForm(t)?new FormData(t):t)},t.exports=u,t.exports.default=u},7277:(t,e,n)=>{"use strict";var r=n(3621);function i(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var e;this.promise=new Promise((function(t){e=t}));var n=this;this.promise.then((function(t){if(n._listeners){for(var e=n._listeners.length;e-- >0;)n._listeners[e](t);n._listeners=null}})),this.promise.then=function(t){var e,r=new Promise((function(t){n.subscribe(t),e=t})).then(t);return r.cancel=function(){n.unsubscribe(e)},r},t((function(t,i,s){n.reason||(n.reason=new r(t,i,s),e(n.reason))}))}i.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},i.prototype.subscribe=function(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]},i.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}},i.source=function(){var t;return{token:new i((function(e){t=e})),cancel:t}},t.exports=i},3621:(t,e,n)=>{"use strict";var r=n(8111);function i(t,e,n){r.call(this,null==t?"canceled":t,r.ERR_CANCELED,e,n),this.name="CanceledError"}n(1986).inherits(i,r,{__CANCEL__:!0}),t.exports=i},2810:t=>{"use strict";t.exports=function(t){return!(!t||!t.__CANCEL__)}},5897:(t,e,n)=>{"use strict";var r=n(1986),i=n(2684),s=n(4185),o=n(608),a=n(8961),c=n(8709),u=n(9499),l=u.validators;function h(t){this.defaults=t,this.interceptors={request:new s,response:new s}}h.prototype.request=function(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},(e=a(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;void 0!==n&&u.assertOptions(n,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var i=e.paramsSerializer;null!=i&&(r.isFunction(i)?e.paramsSerializer={serialize:i}:u.assertOptions(i,{encode:l.function,serialize:l.function},!0));var s=[],c=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(c=c&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));var h,d=[];if(this.interceptors.response.forEach((function(t){d.push(t.fulfilled,t.rejected)})),!c){var p=[o,void 0];for(Array.prototype.unshift.apply(p,s),p=p.concat(d),h=Promise.resolve(e);p.length;)h=h.then(p.shift(),p.shift());return h}for(var f=e;s.length;){var g=s.shift(),y=s.shift();try{f=g(f)}catch(t){y(t);break}}try{h=o(f)}catch(t){return Promise.reject(t)}for(;d.length;)h=h.then(d.shift(),d.shift());return h},h.prototype.getUri=function(t){t=a(this.defaults,t);var e=c(t.baseURL,t.url,t.allowAbsoluteUrls);return i(e,t.params,t.paramsSerializer)},r.forEach(["delete","get","head","options"],(function(t){h.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}})),r.forEach(["post","put","patch"],(function(t){function e(e){return function(n,r,i){return this.request(a(i||{},{method:t,headers:e?{"Content-Type":"multipart/form-data"}:{},url:n,data:r}))}}h.prototype[t]=e(),h.prototype[t+"Form"]=e(!0)})),t.exports=h},8111:(t,e,n)=>{"use strict";var r=n(1986);function i(t,e,n,r,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),n&&(this.config=n),r&&(this.request=r),i&&(this.response=i)}r.inherits(i,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var s=i.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(t){o[t]={value:t}})),Object.defineProperties(i,o),Object.defineProperty(s,"isAxiosError",{value:!0}),i.from=function(t,e,n,o,a,c){var u=Object.create(s);return r.toFlatObject(t,u,(function(t){return t!==Error.prototype})),i.call(u,t.message,e,n,o,a),u.cause=t,u.name=t.name,c&&Object.assign(u,c),u},t.exports=i},4185:(t,e,n)=>{"use strict";var r=n(1986);function i(){this.handlers=[]}i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!n&&n.synchronous,runWhen:n?n.runWhen:null}),this.handlers.length-1},i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)},i.prototype.clear=function(){this.handlers&&(this.handlers=[])},i.prototype.forEach=function(t){r.forEach(this.handlers,(function(e){null!==e&&t(e)}))},t.exports=i},8709:(t,e,n)=>{"use strict";var r=n(8099),i=n(1494);t.exports=function(t,e,n){var s=!r(e);return t&&(s||!1===n)?i(t,e):e}},608:(t,e,n)=>{"use strict";var r=n(1986),i=n(5999),s=n(2810),o=n(1370),a=n(3621),c=n(56);function u(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new a}t.exports=function(t){return u(t),t.headers=t.headers||{},t.data=i.call(t,t.data,t.headers,null,t.transformRequest),c(t.headers,"Accept"),c(t.headers,"Content-Type"),t.headers=r.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),r.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete t.headers[e]})),(t.adapter||o.adapter)(t).then((function(e){return u(t),e.data=i.call(t,e.data,e.headers,e.status,t.transformResponse),e}),(function(e){return s(e)||(u(t),e&&e.response&&(e.response.data=i.call(t,e.response.data,e.response.headers,e.response.status,t.transformResponse))),Promise.reject(e)}))}},8961:(t,e,n)=>{"use strict";var r=n(1986);t.exports=function(t,e){e=e||{};var n={};function i(t,e){return r.isPlainObject(t)&&r.isPlainObject(e)?r.merge(t,e):r.isEmptyObject(e)?r.merge({},t):r.isPlainObject(e)?r.merge({},e):r.isArray(e)?e.slice():e}function s(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(t[n],e[n])}function o(t){if(!r.isUndefined(e[t]))return i(void 0,e[t])}function a(n){return r.isUndefined(e[n])?r.isUndefined(t[n])?void 0:i(void 0,t[n]):i(void 0,e[n])}function c(n){return n in e?i(t[n],e[n]):n in t?i(void 0,t[n]):void 0}var u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c};return r.forEach(Object.keys(t).concat(Object.keys(e)),(function(t){var e=u[t]||s,i=e(t);r.isUndefined(i)&&e!==c||(n[t]=i)})),n}},2080:(t,e,n)=>{"use strict";var r=n(8111);t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(new r("Request failed with status code "+n.status,[r.ERR_BAD_REQUEST,r.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}},5999:(t,e,n)=>{"use strict";var r=n(1986),i=n(1370);t.exports=function(t,e,n,s){var o=this||i;return r.forEach(s,(function(r){t=r.call(o,t,e,n)})),t}},1370:(t,e,n)=>{"use strict";var r=n(8860),i=n(1986),s=n(56),o=n(8111),a=n(6274),c=n(7714),u=n(3367),l=n(3035),h=n(4188),d={"Content-Type":"application/x-www-form-urlencoded"};function p(t,e){!i.isUndefined(t)&&i.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var f,g={transitional:a,adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==r&&"[object process]"===Object.prototype.toString.call(r))&&(f=n(5334)),f),transformRequest:[function(t,e){s(e,"Accept"),s(e,"Content-Type");var n,r=e&&e["Content-Type"]||"",o=r.indexOf("application/json")>-1,a=i.isObject(t);if(a&&i.isHTMLForm(t)&&(t=new FormData(t)),i.isFormData(t))return o?JSON.stringify(h(t)):t;if(i.isArrayBuffer(t)||i.isBuffer(t)||i.isStream(t)||i.isFile(t)||i.isBlob(t))return t;if(i.isArrayBufferView(t))return t.buffer;if(i.isURLSearchParams(t))return p(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();if(a){if(-1!==r.indexOf("application/x-www-form-urlencoded"))return u(t,this.formSerializer).toString();if((n=i.isFileList(t))||r.indexOf("multipart/form-data")>-1){var l=this.env&&this.env.FormData;return c(n?{"files[]":t}:t,l&&new l,this.formSerializer)}}return a||o?(p(e,"application/json"),function(t,e,n){if(i.isString(t))try{return(e||JSON.parse)(t),i.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(n||JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){var e=this.transitional||g.transitional,n=e&&e.forcedJSONParsing,r="json"===this.responseType;if(t&&i.isString(t)&&(n&&!this.responseType||r)){var s=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(s){if("SyntaxError"===t.name)throw o.from(t,o.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:l.classes.FormData,Blob:l.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(t){g.headers[t]={}})),i.forEach(["post","put","patch"],(function(t){g.headers[t]=i.merge(d)})),t.exports=g},6274:t=>{"use strict";t.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},4132:(t,e,n)=>{t.exports=n(9748)},7473:t=>{t.exports={version:"0.30.0"}},2404:(t,e,n)=>{"use strict";var r=n(7714);function i(t){var e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'\(\)~]|%20|%00/g,(function(t){return e[t]}))}function s(t,e){this._pairs=[],t&&r(t,this,e)}var o=s.prototype;o.append=function(t,e){this._pairs.push([t,e])},o.toString=function(t){var e=t?function(e){return t.call(this,e,i)}:i;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")},t.exports=s},7198:t=>{"use strict";t.exports=function(t,e){return function(){return t.apply(e,arguments)}}},2684:(t,e,n)=>{"use strict";var r=n(1986),i=n(2404);function s(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}t.exports=function(t,e,n){if(!e)return t;var o=t.indexOf("#");-1!==o&&(t=t.slice(0,o));var a,c=n&&n.encode||s,u=n&&n.serialize;return(a=u?u(e,n):r.isURLSearchParams(e)?e.toString():new i(e,n).toString(c))&&(t+=(-1===t.indexOf("?")?"?":"&")+a),t}},1494:t=>{"use strict";t.exports=function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}},2713:(t,e,n)=>{"use strict";var r=n(1986);t.exports=r.isStandardBrowserEnv()?{write:function(t,e,n,i,s,o){var a=[];a.push(t+"="+encodeURIComponent(e)),r.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),r.isString(i)&&a.push("path="+i),r.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(t){var e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove:function(t){this.write(t,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},4188:(t,e,n)=>{"use strict";var r=n(1986);t.exports=function(t){function e(t,n,i,s){var o=t[s++];if("__proto__"===o)return!0;var a=Number.isFinite(+o),c=s>=t.length;return o=!o&&r.isArray(i)?i.length:o,c?(r.hasOwnProperty(i,o)?i[o]=[i[o],n]:i[o]=n,!a):(i[o]&&r.isObject(i[o])||(i[o]=[]),e(t,n,i[o],s)&&r.isArray(i[o])&&(i[o]=function(t){var e,n,r={},i=Object.keys(t),s=i.length;for(e=0;e<s;e++)r[n=i[e]]=t[n];return r}(i[o])),!a)}if(r.isFormData(t)&&r.isFunction(t.entries)){var n={};return r.forEachEntry(t,(function(t,i){e(function(t){return r.matchAll(/\w+|\[(\w*)]/g,t).map((function(t){return"[]"===t[0]?"":t[1]||t[0]}))}(t),i,n,0)})),n}return null}},8099:t=>{"use strict";t.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}},6377:(t,e,n)=>{"use strict";var r=n(1986);t.exports=function(t){return r.isObject(t)&&!0===t.isAxiosError}},2044:(t,e,n)=>{"use strict";var r=n(1986);t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},56:(t,e,n)=>{"use strict";var r=n(1986);t.exports=function(t,e){r.forEach(t,(function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])}))}},1094:(t,e,n)=>{"use strict";var r=n(1986),i=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];t.exports=function(t){var e,n,s,o={};return t?(r.forEach(t.split("\n"),(function(t){if(s=t.indexOf(":"),e=r.trim(t.slice(0,s)).toLowerCase(),n=r.trim(t.slice(s+1)),e){if(o[e]&&i.indexOf(e)>=0)return;o[e]="set-cookie"===e?(o[e]?o[e]:[]).concat([n]):o[e]?o[e]+", "+n:n}})),o):o}},5578:t=>{"use strict";t.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}},7046:t=>{"use strict";t.exports=function(t){return function(e){return t.apply(null,e)}}},7714:(t,e,n)=>{"use strict";var r=n(25).Buffer,i=n(1986),s=n(8111),o=n(4132);function a(t){return i.isPlainObject(t)||i.isArray(t)}function c(t){return i.endsWith(t,"[]")?t.slice(0,-2):t}function u(t,e,n){return t?t.concat(e).map((function(t,e){return t=c(t),!n&&e?"["+t+"]":t})).join(n?".":""):e}var l=i.toFlatObject(i,{},null,(function(t){return/^is[A-Z]/.test(t)}));t.exports=function(t,e,n){if(!i.isObject(t))throw new TypeError("target must be an object");e=e||new(o||FormData);var h,d=(n=i.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!i.isUndefined(e[t])}))).metaTokens,p=n.visitor||b,f=n.dots,g=n.indexes,y=(n.Blob||"undefined"!=typeof Blob&&Blob)&&((h=e)&&i.isFunction(h.append)&&"FormData"===h[Symbol.toStringTag]&&h[Symbol.iterator]);if(!i.isFunction(p))throw new TypeError("visitor must be a function");function m(t){if(null===t)return"";if(i.isDate(t))return t.toISOString();if(!y&&i.isBlob(t))throw new s("Blob is not supported. Use a Buffer instead.");return i.isArrayBuffer(t)||i.isTypedArray(t)?y&&"function"==typeof Blob?new Blob([t]):r.from(t):t}function b(t,n,r){var s=t;if(t&&!r&&"object"==typeof t)if(i.endsWith(n,"{}"))n=d?n:n.slice(0,-2),t=JSON.stringify(t);else if(i.isArray(t)&&function(t){return i.isArray(t)&&!t.some(a)}(t)||i.isFileList(t)||i.endsWith(n,"[]")&&(s=i.toArray(t)))return n=c(n),s.forEach((function(t,r){!i.isUndefined(t)&&null!==t&&e.append(!0===g?u([n],r,f):null===g?n:n+"[]",m(t))})),!1;return!!a(t)||(e.append(u(r,n,f),m(t)),!1)}var v=[],w=Object.assign(l,{defaultVisitor:b,convertValue:m,isVisitable:a});if(!i.isObject(t))throw new TypeError("data must be an object");return function t(n,r){if(!i.isUndefined(n)){if(-1!==v.indexOf(n))throw Error("Circular reference detected in "+r.join("."));v.push(n),i.forEach(n,(function(n,s){!0===(!(i.isUndefined(n)||null===n)&&p.call(e,n,i.isString(s)?s.trim():s,r,w))&&t(n,r?r.concat(s):[s])})),v.pop()}}(t),e}},3367:(t,e,n)=>{"use strict";var r=n(1986),i=n(7714),s=n(3035);t.exports=function(t,e){return i(t,new s.classes.URLSearchParams,Object.assign({visitor:function(t,e,n,i){return s.isNode&&r.isBuffer(t)?(this.append(e,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}},9499:(t,e,n)=>{"use strict";var r=n(7473).version,i=n(8111),s={};["object","boolean","number","function","string","symbol"].forEach((function(t,e){s[t]=function(n){return typeof n===t||"a"+(e<1?"n ":" ")+t}}));var o={};s.transitional=function(t,e,n){function s(t,e){return"[Axios v"+r+"] Transitional option '"+t+"'"+e+(n?". "+n:"")}return function(n,r,a){if(!1===t)throw new i(s(r," has been removed"+(e?" in "+e:"")),i.ERR_DEPRECATED);return e&&!o[r]&&(o[r]=!0,console.warn(s(r," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(n,r,a)}},t.exports={assertOptions:function(t,e,n){if("object"!=typeof t)throw new i("options must be an object",i.ERR_BAD_OPTION_VALUE);for(var r=Object.keys(t),s=r.length;s-- >0;){var o=r[s],a=e[o];if(a){var c=t[o],u=void 0===c||a(c,o,t);if(!0!==u)throw new i("option "+o+" must be "+u,i.ERR_BAD_OPTION_VALUE)}else if(!0!==n)throw new i("Unknown option "+o,i.ERR_BAD_OPTION)}},validators:s}},3089:t=>{"use strict";t.exports=FormData},3376:(t,e,n)=>{"use strict";var r=n(2404);t.exports="undefined"!=typeof URLSearchParams?URLSearchParams:r},168:(t,e,n)=>{"use strict";t.exports={isBrowser:!0,classes:{URLSearchParams:n(3376),FormData:n(3089),Blob},protocols:["http","https","file","blob","url","data"]}},3035:(t,e,n)=>{"use strict";t.exports=n(168)},1986:(t,e,n)=>{"use strict";var r,i=n(7198),s=Object.prototype.toString,o=(r=Object.create(null),function(t){var e=s.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())});function a(t){return t=t.toLowerCase(),function(e){return o(e)===t}}function c(t){return Array.isArray(t)}function u(t){return void 0===t}var l=a("ArrayBuffer");function h(t){return"number"==typeof t}function d(t){return null!==t&&"object"==typeof t}function p(t){if("object"!==o(t))return!1;var e=Object.getPrototypeOf(t);return null===e||e===Object.prototype}var f=a("Date"),g=a("File"),y=a("Blob"),m=a("FileList");function b(t){return"[object Function]"===s.call(t)}var v=a("URLSearchParams");function w(t,e){if(null!=t)if("object"!=typeof t&&(t=[t]),c(t))for(var n=0,r=t.length;n<r;n++)e.call(null,t[n],n,t);else for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.call(null,t[i],i,t)}var S,E=(S="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(t){return S&&t instanceof S});var _,C=a("HTMLFormElement"),T=(_=Object.prototype.hasOwnProperty,function(t,e){return _.call(t,e)});t.exports={isArray:c,isArrayBuffer:l,isBuffer:function(t){return null!==t&&!u(t)&&null!==t.constructor&&!u(t.constructor)&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)},isFormData:function(t){var e="[object FormData]";return t&&("function"==typeof FormData&&t instanceof FormData||s.call(t)===e||b(t.toString)&&t.toString()===e)},isArrayBufferView:function(t){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&l(t.buffer)},isString:function(t){return"string"==typeof t},isNumber:h,isObject:d,isPlainObject:p,isEmptyObject:function(t){return t&&0===Object.keys(t).length&&Object.getPrototypeOf(t)===Object.prototype},isUndefined:u,isDate:f,isFile:g,isBlob:y,isFunction:b,isStream:function(t){return d(t)&&b(t.pipe)},isURLSearchParams:v,isStandardBrowserEnv:function(){var t;return("undefined"==typeof navigator||"ReactNative"!==(t=navigator.product)&&"NativeScript"!==t&&"NS"!==t)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:w,merge:function t(){var e={};function n(n,r){p(e[r])&&p(n)?e[r]=t(e[r],n):p(n)?e[r]=t({},n):c(n)?e[r]=n.slice():e[r]=n}for(var r=0,i=arguments.length;r<i;r++)w(arguments[r],n);return e},extend:function(t,e,n){return w(e,(function(e,r){t[r]=n&&"function"==typeof e?i(e,n):e})),t},trim:function(t){return t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(t){return 65279===t.charCodeAt(0)&&(t=t.slice(1)),t},inherits:function(t,e,n,r){t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,n&&Object.assign(t.prototype,n)},toFlatObject:function(t,e,n,r){var i,s,o,a={};if(e=e||{},null==t)return e;do{for(s=(i=Object.getOwnPropertyNames(t)).length;s-- >0;)o=i[s],r&&!r(o,t,e)||a[o]||(e[o]=t[o],a[o]=!0);t=!1!==n&&Object.getPrototypeOf(t)}while(t&&(!n||n(t,e))&&t!==Object.prototype);return e},kindOf:o,kindOfTest:a,endsWith:function(t,e,n){t=String(t),(void 0===n||n>t.length)&&(n=t.length),n-=e.length;var r=t.indexOf(e,n);return-1!==r&&r===n},toArray:function(t){if(!t)return null;if(c(t))return t;var e=t.length;if(!h(e))return null;for(var n=new Array(e);e-- >0;)n[e]=t[e];return n},isTypedArray:E,isFileList:m,forEachEntry:function(t,e){for(var n,r=(t&&t[Symbol.iterator]).call(t);(n=r.next())&&!n.done;){var i=n.value;e.call(t,i[0],i[1])}},matchAll:function(t,e){for(var n,r=[];null!==(n=t.exec(e));)r.push(n);return r},isHTMLForm:C,hasOwnProperty:T}},1448:(t,e)=>{"use strict";e.byteLength=function(t){var e=a(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,s=a(t),o=s[0],c=s[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,o,c)),l=0,h=c>0?o-4:o;for(n=0;n<h;n+=4)e=r[t.charCodeAt(n)]<<18|r[t.charCodeAt(n+1)]<<12|r[t.charCodeAt(n+2)]<<6|r[t.charCodeAt(n+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===c&&(e=r[t.charCodeAt(n)]<<2|r[t.charCodeAt(n+1)]>>4,u[l++]=255&e);1===c&&(e=r[t.charCodeAt(n)]<<10|r[t.charCodeAt(n+1)]<<4|r[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,r=t.length,i=r%3,s=[],o=16383,a=0,u=r-i;a<u;a+=o)s.push(c(t,a,a+o>u?u:a+o));1===i?(e=t[r-1],s.push(n[e>>2]+n[e<<4&63]+"==")):2===i&&(e=(t[r-2]<<8)+t[r-1],s.push(n[e>>10]+n[e>>4&63]+n[e<<2&63]+"="));return s.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0;o<64;++o)n[o]=s[o],r[s.charCodeAt(o)]=o;function a(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,r){for(var i,s,o=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(255&t[a+2]),o.push(n[(s=i)>>18&63]+n[s>>12&63]+n[s>>6&63]+n[63&s]);return o.join("")}r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63},25:(t,e,n)=>{"use strict";
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <https://feross.org>
 * @license  MIT
 */const r=n(1448),i=n(8885),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=c,e.SlowBuffer=function(t){+t!=t&&(t=0);return c.alloc(+t)},e.INSPECT_MAX_BYTES=50;const o=2147483647;function a(t){if(t>o)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,c.prototype),e}function c(t,e,n){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return u(t,e,n)}function u(t,e,n){if("string"==typeof t)return function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!c.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const n=0|g(t,e);let r=a(n);const i=r.write(t,e);i!==n&&(r=r.slice(0,i));return r}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return d(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,n);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,n);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=t.valueOf&&t.valueOf();if(null!=r&&r!==t)return c.from(r,e,n);const i=function(t){if(c.isBuffer(t)){const e=0|f(t.length),n=a(e);return 0===n.length||t.copy(n,0,0,e),n}if(void 0!==t.length)return"number"!=typeof t.length||X(t.length)?a(0):d(t);if("Buffer"===t.type&&Array.isArray(t.data))return d(t.data)}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return c.from(t[Symbol.toPrimitive]("string"),e,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return l(t),a(t<0?0:0|f(t))}function d(t){const e=t.length<0?0:0|f(t.length),n=a(e);for(let r=0;r<e;r+=1)n[r]=255&t[r];return n}function p(t,e,n){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===e&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,e):new Uint8Array(t,e,n),Object.setPrototypeOf(r,c.prototype),r}function f(t){if(t>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|t}function g(t,e){if(c.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const n=t.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return G(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(t).length;default:if(i)return r?-1:G(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,n){let r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return A(this,e,n);case"utf8":case"utf-8":return I(this,e,n);case"ascii":return R(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return T(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}function m(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function b(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),X(n=+n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=c.from(e,r)),c.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){let s,o=1,a=t.length,c=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;o=2,a/=2,c/=2,n/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){let r=-1;for(s=n;s<a;s++)if(u(t,s)===u(e,-1===r?0:s-r)){if(-1===r&&(r=s),s-r+1===c)return r*o}else-1!==r&&(s-=s-r),r=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){let n=!0;for(let r=0;r<c;r++)if(u(t,s+r)!==u(e,r)){n=!1;break}if(n)return s}return-1}function w(t,e,n,r){n=Number(n)||0;const i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;const s=e.length;let o;for(r>s/2&&(r=s/2),o=0;o<r;++o){const r=parseInt(e.substr(2*o,2),16);if(X(r))return o;t[n+o]=r}return o}function S(t,e,n,r){return K(G(e,t.length-n),t,n,r)}function E(t,e,n,r){return K(function(t){const e=[];for(let n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function _(t,e,n,r){return K(z(e),t,n,r)}function C(t,e,n,r){return K(function(t,e){let n,r,i;const s=[];for(let o=0;o<t.length&&!((e-=2)<0);++o)n=t.charCodeAt(o),r=n>>8,i=n%256,s.push(i),s.push(r);return s}(e,t.length-n),t,n,r)}function T(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function I(t,e,n){n=Math.min(t.length,n);const r=[];let i=e;for(;i<n;){const e=t[i];let s=null,o=e>239?4:e>223?3:e>191?2:1;if(i+o<=n){let n,r,a,c;switch(o){case 1:e<128&&(s=e);break;case 2:n=t[i+1],128==(192&n)&&(c=(31&e)<<6|63&n,c>127&&(s=c));break;case 3:n=t[i+1],r=t[i+2],128==(192&n)&&128==(192&r)&&(c=(15&e)<<12|(63&n)<<6|63&r,c>2047&&(c<55296||c>57343)&&(s=c));break;case 4:n=t[i+1],r=t[i+2],a=t[i+3],128==(192&n)&&128==(192&r)&&128==(192&a)&&(c=(15&e)<<18|(63&n)<<12|(63&r)<<6|63&a,c>65535&&c<1114112&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=o}return function(t){const e=t.length;if(e<=N)return String.fromCharCode.apply(String,t);let n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=N));return n}(r)}e.kMaxLength=o,c.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),c.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(t,e,n){return u(t,e,n)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(t,e,n){return function(t,e,n){return l(t),t<=0?a(t):void 0!==e?"string"==typeof n?a(t).fill(e,n):a(t).fill(e):a(t)}(t,e,n)},c.allocUnsafe=function(t){return h(t)},c.allocUnsafeSlow=function(t){return h(t)},c.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==c.prototype},c.compare=function(t,e){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=c.from(e,e.offset,e.byteLength)),!c.isBuffer(t)||!c.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let n=t.length,r=e.length;for(let i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(t){switch(String(t).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}},c.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return c.alloc(0);let n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;const r=c.allocUnsafe(e);let i=0;for(n=0;n<t.length;++n){let e=t[n];if(Y(e,Uint8Array))i+e.length>r.length?(c.isBuffer(e)||(e=c.from(e)),e.copy(r,i)):Uint8Array.prototype.set.call(r,e,i);else{if(!c.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(r,i)}i+=e.length}return r},c.byteLength=g,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)m(this,e,e+1);return this},c.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)m(this,e,e+3),m(this,e+1,e+2);return this},c.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)m(this,e,e+7),m(this,e+1,e+6),m(this,e+2,e+5),m(this,e+3,e+4);return this},c.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?I(this,0,t):y.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(t){if(!c.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===c.compare(this,t)},c.prototype.inspect=function(){let t="";const n=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"},s&&(c.prototype[s]=c.prototype.inspect),c.prototype.compare=function(t,e,n,r,i){if(Y(t,Uint8Array)&&(t=c.from(t,t.offset,t.byteLength)),!c.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;let s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(e>>>=0);const a=Math.min(s,o),u=this.slice(r,i),l=t.slice(e,n);for(let t=0;t<a;++t)if(u[t]!==l[t]){s=u[t],o=l[t];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},c.prototype.indexOf=function(t,e,n){return b(this,t,e,n,!0)},c.prototype.lastIndexOf=function(t,e,n){return b(this,t,e,n,!1)},c.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let s=!1;for(;;)switch(r){case"hex":return w(this,t,e,n);case"utf8":case"utf-8":return S(this,t,e,n);case"ascii":case"latin1":case"binary":return E(this,t,e,n);case"base64":return _(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function R(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function O(t,e,n){let r="";n=Math.min(t.length,n);for(let i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function A(t,e,n){const r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=e;r<n;++r)i+=Z[t[r]];return i}function x(t,e,n){const r=t.slice(e,n);let i="";for(let t=0;t<r.length-1;t+=2)i+=String.fromCharCode(r[t]+256*r[t+1]);return i}function P(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function k(t,e,n,r,i,s){if(!c.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function L(t,e,n,r,i){q(e,r,i,t,n,7);let s=Number(e&BigInt(4294967295));t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s,s>>=8,t[n++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,o>>=8,t[n++]=o,n}function D(t,e,n,r,i){q(e,r,i,t,n,7);let s=Number(e&BigInt(4294967295));t[n+7]=s,s>>=8,t[n+6]=s,s>>=8,t[n+5]=s,s>>=8,t[n+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return t[n+3]=o,o>>=8,t[n+2]=o,o>>=8,t[n+1]=o,o>>=8,t[n]=o,n+8}function M(t,e,n,r,i,s){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function B(t,e,n,r,s){return e=+e,n>>>=0,s||M(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,s){return e=+e,n>>>=0,s||M(t,0,n,8),i.write(t,e,n,r,52,8),n+8}c.prototype.slice=function(t,e){const n=this.length;(t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(e=void 0===e?n:~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),e<t&&(e=t);const r=this.subarray(t,e);return Object.setPrototypeOf(r,c.prototype),r},c.prototype.readUintLE=c.prototype.readUIntLE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],i=1,s=0;for(;++s<e&&(i*=256);)r+=this[t+s]*i;return r},c.prototype.readUintBE=c.prototype.readUIntBE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t+--e],i=1;for(;e>0&&(i*=256);)r+=this[t+--e]*i;return r},c.prototype.readUint8=c.prototype.readUInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),this[t]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]|this[t+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(t,e){return t>>>=0,e||P(t,2,this.length),this[t]<<8|this[t+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},c.prototype.readBigUInt64LE=J((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),c.prototype.readBigUInt64BE=J((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),c.prototype.readIntLE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=this[t],i=1,s=0;for(;++s<e&&(i*=256);)r+=this[t+s]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*e)),r},c.prototype.readIntBE=function(t,e,n){t>>>=0,e>>>=0,n||P(t,e,this.length);let r=e,i=1,s=this[t+--r];for(;r>0&&(i*=256);)s+=this[t+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},c.prototype.readInt8=function(t,e){return t>>>=0,e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},c.prototype.readInt16LE=function(t,e){t>>>=0,e||P(t,2,this.length);const n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(t,e){t>>>=0,e||P(t,2,this.length);const n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},c.prototype.readInt32BE=function(t,e){return t>>>=0,e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},c.prototype.readBigInt64LE=J((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=this[t+4]+256*this[t+5]+65536*this[t+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),c.prototype.readBigInt64BE=J((function(t){H(t>>>=0,"offset");const e=this[t],n=this[t+7];void 0!==e&&void 0!==n||W(t,this.length-8);const r=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+n)})),c.prototype.readFloatLE=function(t,e){return t>>>=0,e||P(t,4,this.length),i.read(this,t,!0,23,4)},c.prototype.readFloatBE=function(t,e){return t>>>=0,e||P(t,4,this.length),i.read(this,t,!1,23,4)},c.prototype.readDoubleLE=function(t,e){return t>>>=0,e||P(t,8,this.length),i.read(this,t,!0,52,8)},c.prototype.readDoubleBE=function(t,e){return t>>>=0,e||P(t,8,this.length),i.read(this,t,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){k(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=1,s=0;for(this[e]=255&t;++s<n&&(i*=256);)this[e+s]=t/i&255;return e+n},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(t,e,n,r){if(t=+t,e>>>=0,n>>>=0,!r){k(this,t,e,n,Math.pow(2,8*n)-1,0)}let i=n-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+n},c.prototype.writeUint8=c.prototype.writeUInt8=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,1,255,0),this[e]=255&t,e+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigUInt64LE=J((function(t){return L(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeBigUInt64BE=J((function(t){return D(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,BigInt(0),BigInt("0xffffffffffffffff"))})),c.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);k(this,t,e,n,r-1,-r)}let i=0,s=1,o=0;for(this[e]=255&t;++i<n&&(s*=256);)t<0&&0===o&&0!==this[e+i-1]&&(o=1),this[e+i]=(t/s|0)-o&255;return e+n},c.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e>>>=0,!r){const r=Math.pow(2,8*n-1);k(this,t,e,n,r-1,-r)}let i=n-1,s=1,o=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===o&&0!==this[e+i+1]&&(o=1),this[e+i]=(t/s|0)-o&255;return e+n},c.prototype.writeInt8=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},c.prototype.writeInt16LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},c.prototype.writeInt16BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},c.prototype.writeInt32LE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},c.prototype.writeInt32BE=function(t,e,n){return t=+t,e>>>=0,n||k(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},c.prototype.writeBigInt64LE=J((function(t){return L(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeBigInt64BE=J((function(t){return D(this,t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),c.prototype.writeFloatLE=function(t,e,n){return B(this,t,e,!0,n)},c.prototype.writeFloatBE=function(t,e,n){return B(this,t,e,!1,n)},c.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},c.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},c.prototype.copy=function(t,e,n,r){if(!c.isBuffer(t))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);const i=r-n;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,n,r):Uint8Array.prototype.set.call(t,this.subarray(n,r),e),i},c.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===t.length){const e=t.charCodeAt(0);("utf8"===r&&e<128||"latin1"===r)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;let i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{const s=c.isBuffer(t)?t:c.from(t,r),o=s.length;if(0===o)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<n-e;++i)this[i+e]=s[i%o]}return this};const j={};function U(t,e,n){j[t]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function $(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function q(t,e,n,r,i,s){if(t>n||t<e){const r="bigint"==typeof e?"n":"";let i;throw i=s>3?0===e||e===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(s+1)}${r}`:`>= -(2${r} ** ${8*(s+1)-1}${r}) and < 2 ** ${8*(s+1)-1}${r}`:`>= ${e}${r} and <= ${n}${r}`,new j.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,n){H(e,"offset"),void 0!==t[e]&&void 0!==t[e+n]||W(e,t.length-(n+1))}(r,i,s)}function H(t,e){if("number"!=typeof t)throw new j.ERR_INVALID_ARG_TYPE(e,"number",t)}function W(t,e,n){if(Math.floor(t)!==t)throw H(t,n),new j.ERR_OUT_OF_RANGE(n||"offset","an integer",t);if(e<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${e}`,t)}U("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),U("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),U("ERR_OUT_OF_RANGE",(function(t,e,n){let r=`The value of "${t}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=$(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=$(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r}),RangeError);const V=/[^+/0-9A-Za-z-_]/g;function G(t,e){let n;e=e||1/0;const r=t.length;let i=null;const s=[];for(let o=0;o<r;++o){if(n=t.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(e-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function z(t){return r.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,n,r){let i;for(i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function X(t){return t!=t}const Z=function(){const t="0123456789abcdef",e=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)e[r+i]=t[n]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Q:t}function Q(){throw new Error("BigInt not supported")}},356:t=>{t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},7780:(t,e)=>{
/*! crc32.js (C) 2014-present SheetJS -- http://sheetjs.com */
var n;n=function(t){t.version="1.2.2";var e=function(){for(var t=0,e=new Array(256),n=0;256!=n;++n)t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=1&(t=n)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1)?-306674912^t>>>1:t>>>1,e[n]=t;return"undefined"!=typeof Int32Array?new Int32Array(e):e}(),n=function(t){var e=0,n=0,r=0,i="undefined"!=typeof Int32Array?new Int32Array(4096):new Array(4096);for(r=0;256!=r;++r)i[r]=t[r];for(r=0;256!=r;++r)for(n=t[r],e=256+r;e<4096;e+=256)n=i[e]=n>>>8^t[255&n];var s=[];for(r=1;16!=r;++r)s[r-1]="undefined"!=typeof Int32Array?i.subarray(256*r,256*r+256):i.slice(256*r,256*r+256);return s}(e),r=n[0],i=n[1],s=n[2],o=n[3],a=n[4],c=n[5],u=n[6],l=n[7],h=n[8],d=n[9],p=n[10],f=n[11],g=n[12],y=n[13],m=n[14];t.table=e,t.bstr=function(t,n){for(var r=~n,i=0,s=t.length;i<s;)r=r>>>8^e[255&(r^t.charCodeAt(i++))];return~r},t.buf=function(t,n){for(var b=~n,v=t.length-15,w=0;w<v;)b=m[t[w++]^255&b]^y[t[w++]^b>>8&255]^g[t[w++]^b>>16&255]^f[t[w++]^b>>>24]^p[t[w++]]^d[t[w++]]^h[t[w++]]^l[t[w++]]^u[t[w++]]^c[t[w++]]^a[t[w++]]^o[t[w++]]^s[t[w++]]^i[t[w++]]^r[t[w++]]^e[t[w++]];for(v+=15;w<v;)b=b>>>8^e[255&(b^t[w++])];return~b},t.str=function(t,n){for(var r=~n,i=0,s=t.length,o=0,a=0;i<s;)(o=t.charCodeAt(i++))<128?r=r>>>8^e[255&(r^o)]:o<2048?r=(r=r>>>8^e[255&(r^(192|o>>6&31))])>>>8^e[255&(r^(128|63&o))]:o>=55296&&o<57344?(o=64+(1023&o),a=1023&t.charCodeAt(i++),r=(r=(r=(r=r>>>8^e[255&(r^(240|o>>8&7))])>>>8^e[255&(r^(128|o>>2&63))])>>>8^e[255&(r^(128|a>>6&15|(3&o)<<4))])>>>8^e[255&(r^(128|63&a))]):r=(r=(r=r>>>8^e[255&(r^(224|o>>12&15))])>>>8^e[255&(r^(128|o>>6&63))])>>>8^e[255&(r^(128|63&o))];return~r}},"undefined"==typeof DO_NOT_EXPORT_CRC?n(e):n({})},5121:t=>{"use strict";var e,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)};e=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var i=Number.isNaN||function(t){return t!=t};function s(){s.init.call(this)}t.exports=s,t.exports.once=function(t,e){return new Promise((function(n,r){function i(n){t.removeListener(e,s),r(n)}function s(){"function"==typeof t.removeListener&&t.removeListener("error",i),n([].slice.call(arguments))}g(t,e,s,{once:!0}),"error"!==e&&function(t,e,n){"function"==typeof t.on&&g(t,"error",e,n)}(t,i,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function c(t){return void 0===t._maxListeners?s.defaultMaxListeners:t._maxListeners}function u(t,e,n,r){var i,s,o,u;if(a(n),void 0===(s=t._events)?(s=t._events=Object.create(null),t._eventsCount=0):(void 0!==s.newListener&&(t.emit("newListener",e,n.listener?n.listener:n),s=t._events),o=s[e]),void 0===o)o=s[e]=n,++t._eventsCount;else if("function"==typeof o?o=s[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=c(t))>0&&o.length>i&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return t}function l(){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 h(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=l.bind(r);return i.listener=n,r.wrapFn=i,i}function d(t,e,n){var r=t._events;if(void 0===r)return[];var i=r[e];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}(i):f(i,i.length)}function p(t){var e=this._events;if(void 0!==e){var n=e[t];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function f(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function g(t,e,n,r){if("function"==typeof t.on)r.once?t.once(e,n):t.on(e,n);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function i(s){r.once&&t.removeEventListener(e,i),n(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");o=t}}),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(t){if("number"!=typeof t||t<0||i(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},s.prototype.getMaxListeners=function(){return c(this)},s.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var i="error"===t,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){var o;if(e.length>0&&(o=e[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[t];if(void 0===c)return!1;if("function"==typeof c)r(c,this,e);else{var u=c.length,l=f(c,u);for(n=0;n<u;++n)r(l[n],this,e)}return!0},s.prototype.addListener=function(t,e){return u(this,t,e,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(t,e){return u(this,t,e,!0)},s.prototype.once=function(t,e){return a(e),this.on(t,h(this,t,e)),this},s.prototype.prependOnceListener=function(t,e){return a(e),this.prependListener(t,h(this,t,e)),this},s.prototype.removeListener=function(t,e){var n,r,i,s,o;if(a(e),void 0===(r=this._events))return this;if(void 0===(n=r[t]))return this;if(n===e||n.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===e||n[s].listener===e){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(n,i),1===n.length&&(r[t]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",t,o||e)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(t){var e,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[t]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=n[t]))this.removeListener(t,e);else if(void 0!==e)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this},s.prototype.listeners=function(t){return d(this,t,!0)},s.prototype.rawListeners=function(t){return d(this,t,!1)},s.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):p.call(t,e)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},9328:(t,e,n)=>{"use strict";const r=n(1e3),i=n(5637),s=n(6358);t.exports={XMLParser:i,XMLValidator:r,XMLBuilder:s}},3080:(t,e)=>{"use strict";const n=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",r="["+n+"]["+(n+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040")+"]*",i=new RegExp("^"+r+"$");e.isExist=function(t){return void 0!==t},e.isEmptyObject=function(t){return 0===Object.keys(t).length},e.merge=function(t,e,n){if(e){const r=Object.keys(e),i=r.length;for(let s=0;s<i;s++)t[r[s]]="strict"===n?[e[r[s]]]:e[r[s]]}},e.getValue=function(t){return e.isExist(t)?t:""},e.isName=function(t){const e=i.exec(t);return!(null==e)},e.getAllMatches=function(t,e){const n=[];let r=e.exec(t);for(;r;){const i=[];i.startIndex=e.lastIndex-r[0].length;const s=r.length;for(let t=0;t<s;t++)i.push(r[t]);n.push(i),r=e.exec(t)}return n},e.nameRegexp=r},1e3:(t,e,n)=>{"use strict";const r=n(3080),i={allowBooleanAttributes:!1,unpairedTags:[]};function s(t){return" "===t||"\t"===t||"\n"===t||"\r"===t}function o(t,e){const n=e;for(;e<t.length;e++)if("?"!=t[e]&&" "!=t[e]);else{const r=t.substr(n,e-n);if(e>5&&"xml"===r)return f("InvalidXml","XML declaration allowed only at the start of the document.",y(t,e));if("?"==t[e]&&">"==t[e+1]){e++;break}}return e}function a(t,e){if(t.length>e+5&&"-"===t[e+1]&&"-"===t[e+2]){for(e+=3;e<t.length;e++)if("-"===t[e]&&"-"===t[e+1]&&">"===t[e+2]){e+=2;break}}else if(t.length>e+8&&"D"===t[e+1]&&"O"===t[e+2]&&"C"===t[e+3]&&"T"===t[e+4]&&"Y"===t[e+5]&&"P"===t[e+6]&&"E"===t[e+7]){let n=1;for(e+=8;e<t.length;e++)if("<"===t[e])n++;else if(">"===t[e]&&(n--,0===n))break}else if(t.length>e+9&&"["===t[e+1]&&"C"===t[e+2]&&"D"===t[e+3]&&"A"===t[e+4]&&"T"===t[e+5]&&"A"===t[e+6]&&"["===t[e+7])for(e+=8;e<t.length;e++)if("]"===t[e]&&"]"===t[e+1]&&">"===t[e+2]){e+=2;break}return e}e.validate=function(t,e){e=Object.assign({},i,e);const n=[];let c=!1,u=!1;"\ufeff"===t[0]&&(t=t.substr(1));for(let i=0;i<t.length;i++)if("<"===t[i]&&"?"===t[i+1]){if(i+=2,i=o(t,i),i.err)return i}else{if("<"!==t[i]){if(s(t[i]))continue;return f("InvalidChar","char '"+t[i]+"' is not expected.",y(t,i))}{let g=i;if(i++,"!"===t[i]){i=a(t,i);continue}{let m=!1;"/"===t[i]&&(m=!0,i++);let b="";for(;i<t.length&&">"!==t[i]&&" "!==t[i]&&"\t"!==t[i]&&"\n"!==t[i]&&"\r"!==t[i];i++)b+=t[i];if(b=b.trim(),"/"===b[b.length-1]&&(b=b.substring(0,b.length-1),i--),h=b,!r.isName(h)){let e;return e=0===b.trim().length?"Invalid space after '<'.":"Tag '"+b+"' is an invalid name.",f("InvalidTag",e,y(t,i))}const v=l(t,i);if(!1===v)return f("InvalidAttr","Attributes for '"+b+"' have open quote.",y(t,i));let w=v.value;if(i=v.index,"/"===w[w.length-1]){const n=i-w.length;w=w.substring(0,w.length-1);const r=d(w,e);if(!0!==r)return f(r.err.code,r.err.msg,y(t,n+r.err.line));c=!0}else if(m){if(!v.tagClosed)return f("InvalidTag","Closing tag '"+b+"' doesn't have proper closing.",y(t,i));if(w.trim().length>0)return f("InvalidTag","Closing tag '"+b+"' can't have attributes or invalid starting.",y(t,g));if(0===n.length)return f("InvalidTag","Closing tag '"+b+"' has not been opened.",y(t,g));{const e=n.pop();if(b!==e.tagName){let n=y(t,e.tagStartPos);return f("InvalidTag","Expected closing tag '"+e.tagName+"' (opened in line "+n.line+", col "+n.col+") instead of closing tag '"+b+"'.",y(t,g))}0==n.length&&(u=!0)}}else{const r=d(w,e);if(!0!==r)return f(r.err.code,r.err.msg,y(t,i-w.length+r.err.line));if(!0===u)return f("InvalidXml","Multiple possible root nodes found.",y(t,i));-1!==e.unpairedTags.indexOf(b)||n.push({tagName:b,tagStartPos:g}),c=!0}for(i++;i<t.length;i++)if("<"===t[i]){if("!"===t[i+1]){i++,i=a(t,i);continue}if("?"!==t[i+1])break;if(i=o(t,++i),i.err)return i}else if("&"===t[i]){const e=p(t,i);if(-1==e)return f("InvalidChar","char '&' is not expected.",y(t,i));i=e}else if(!0===u&&!s(t[i]))return f("InvalidXml","Extra text at the end",y(t,i));"<"===t[i]&&i--}}}var h;return c?1==n.length?f("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",y(t,n[0].tagStartPos)):!(n.length>0)||f("InvalidXml","Invalid '"+JSON.stringify(n.map((t=>t.tagName)),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1}):f("InvalidXml","Start tag expected.",1)};const c='"',u="'";function l(t,e){let n="",r="",i=!1;for(;e<t.length;e++){if(t[e]===c||t[e]===u)""===r?r=t[e]:r!==t[e]||(r="");else if(">"===t[e]&&""===r){i=!0;break}n+=t[e]}return""===r&&{value:n,index:e,tagClosed:i}}const h=new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?","g");function d(t,e){const n=r.getAllMatches(t,h),i={};for(let t=0;t<n.length;t++){if(0===n[t][1].length)return f("InvalidAttr","Attribute '"+n[t][2]+"' has no space in starting.",m(n[t]));if(void 0!==n[t][3]&&void 0===n[t][4])return f("InvalidAttr","Attribute '"+n[t][2]+"' is without value.",m(n[t]));if(void 0===n[t][3]&&!e.allowBooleanAttributes)return f("InvalidAttr","boolean attribute '"+n[t][2]+"' is not allowed.",m(n[t]));const r=n[t][2];if(!g(r))return f("InvalidAttr","Attribute '"+r+"' is an invalid name.",m(n[t]));if(i.hasOwnProperty(r))return f("InvalidAttr","Attribute '"+r+"' is repeated.",m(n[t]));i[r]=1}return!0}function p(t,e){if(";"===t[++e])return-1;if("#"===t[e])return function(t,e){let n=/\d/;for("x"===t[e]&&(e++,n=/[\da-fA-F]/);e<t.length;e++){if(";"===t[e])return e;if(!t[e].match(n))break}return-1}(t,++e);let n=0;for(;e<t.length;e++,n++)if(!(t[e].match(/\w/)&&n<20)){if(";"===t[e])break;return-1}return e}function f(t,e,n){return{err:{code:t,msg:e,line:n.line||n,col:n.col}}}function g(t){return r.isName(t)}function y(t,e){const n=t.substring(0,e).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function m(t){return t.startIndex+t[1].length}},6358:(t,e,n)=>{"use strict";const r=n(2410),i={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:"  ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&amp;"},{regex:new RegExp(">","g"),val:"&gt;"},{regex:new RegExp("<","g"),val:"&lt;"},{regex:new RegExp("'","g"),val:"&apos;"},{regex:new RegExp('"',"g"),val:"&quot;"}],processEntities:!0,stopNodes:[],oneListGroup:!1};function s(t){this.options=Object.assign({},i,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=c),this.processTextOrObjNode=o,this.options.format?(this.indentate=a,this.tagEndChar=">\n",this.newLine="\n"):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}function o(t,e,n){const r=this.j2x(t,n+1);return void 0!==t[this.options.textNodeName]&&1===Object.keys(t).length?this.buildTextValNode(t[this.options.textNodeName],e,r.attrStr,n):this.buildObjectNode(r.val,e,r.attrStr,n)}function a(t){return this.options.indentBy.repeat(t)}function c(t){return!(!t.startsWith(this.options.attributeNamePrefix)||t===this.options.textNodeName)&&t.substr(this.attrPrefixLen)}s.prototype.build=function(t){return this.options.preserveOrder?r(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)},s.prototype.j2x=function(t,e){let n="",r="";for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(void 0===t[i])this.isAttribute(i)&&(r+="");else if(null===t[i])this.isAttribute(i)?r+="":"?"===i[0]?r+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)r+=this.buildTextValNode(t[i],i,"",e);else if("object"!=typeof t[i]){const s=this.isAttribute(i);if(s)n+=this.buildAttrPairStr(s,""+t[i]);else if(i===this.options.textNodeName){let e=this.options.tagValueProcessor(i,""+t[i]);r+=this.replaceEntitiesValue(e)}else r+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){const n=t[i].length;let s="",o="";for(let a=0;a<n;a++){const n=t[i][a];if(void 0===n);else if(null===n)"?"===i[0]?r+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if("object"==typeof n)if(this.options.oneListGroup){const t=this.j2x(n,e+1);s+=t.val,this.options.attributesGroupName&&n.hasOwnProperty(this.options.attributesGroupName)&&(o+=t.attrStr)}else s+=this.processTextOrObjNode(n,i,e);else if(this.options.oneListGroup){let t=this.options.tagValueProcessor(i,n);t=this.replaceEntitiesValue(t),s+=t}else s+=this.buildTextValNode(n,i,"",e)}this.options.oneListGroup&&(s=this.buildObjectNode(s,i,o,e)),r+=s}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const e=Object.keys(t[i]),r=e.length;for(let s=0;s<r;s++)n+=this.buildAttrPairStr(e[s],""+t[i][e[s]])}else r+=this.processTextOrObjNode(t[i],i,e);return{attrStr:n,val:r}},s.prototype.buildAttrPairStr=function(t,e){return e=this.options.attributeValueProcessor(t,""+e),e=this.replaceEntitiesValue(e),this.options.suppressBooleanAttributes&&"true"===e?" "+t:" "+t+'="'+e+'"'},s.prototype.buildObjectNode=function(t,e,n,r){if(""===t)return"?"===e[0]?this.indentate(r)+"<"+e+n+"?"+this.tagEndChar:this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar;{let i="</"+e+this.tagEndChar,s="";return"?"===e[0]&&(s="?",i=""),!n&&""!==n||-1!==t.indexOf("<")?!1!==this.options.commentPropName&&e===this.options.commentPropName&&0===s.length?this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine:this.indentate(r)+"<"+e+n+s+this.tagEndChar+t+this.indentate(r)+i:this.indentate(r)+"<"+e+n+s+">"+t+i}},s.prototype.closeTag=function(t){let e="";return-1!==this.options.unpairedTags.indexOf(t)?this.options.suppressUnpairedNode||(e="/"):e=this.options.suppressEmptyNode?"/":`></${t}`,e},s.prototype.buildTextValNode=function(t,e,n,r){if(!1!==this.options.cdataPropName&&e===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${t}]]>`+this.newLine;if(!1!==this.options.commentPropName&&e===this.options.commentPropName)return this.indentate(r)+`\x3c!--${t}--\x3e`+this.newLine;if("?"===e[0])return this.indentate(r)+"<"+e+n+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),""===i?this.indentate(r)+"<"+e+n+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+n+">"+i+"</"+e+this.tagEndChar}},s.prototype.replaceEntitiesValue=function(t){if(t&&t.length>0&&this.options.processEntities)for(let e=0;e<this.options.entities.length;e++){const n=this.options.entities[e];t=t.replace(n.regex,n.val)}return t},t.exports=s},2410:t=>{function e(t,o,a,c){let u="",l=!1;for(let h=0;h<t.length;h++){const d=t[h],p=n(d);if(void 0===p)continue;let f="";if(f=0===a.length?p:`${a}.${p}`,p===o.textNodeName){let t=d[p];i(f,o)||(t=o.tagValueProcessor(p,t),t=s(t,o)),l&&(u+=c),u+=t,l=!1;continue}if(p===o.cdataPropName){l&&(u+=c),u+=`<![CDATA[${d[p][0][o.textNodeName]}]]>`,l=!1;continue}if(p===o.commentPropName){u+=c+`\x3c!--${d[p][0][o.textNodeName]}--\x3e`,l=!0;continue}if("?"===p[0]){const t=r(d[":@"],o),e="?xml"===p?"":c;let n=d[p][0][o.textNodeName];n=0!==n.length?" "+n:"",u+=e+`<${p}${n}${t}?>`,l=!0;continue}let g=c;""!==g&&(g+=o.indentBy);const y=c+`<${p}${r(d[":@"],o)}`,m=e(d[p],o,f,g);-1!==o.unpairedTags.indexOf(p)?o.suppressUnpairedNode?u+=y+">":u+=y+"/>":m&&0!==m.length||!o.suppressEmptyNode?m&&m.endsWith(">")?u+=y+`>${m}${c}</${p}>`:(u+=y+">",m&&""!==c&&(m.includes("/>")||m.includes("</"))?u+=c+o.indentBy+m+c:u+=m,u+=`</${p}>`):u+=y+"/>",l=!0}return u}function n(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];if(t.hasOwnProperty(r)&&":@"!==r)return r}}function r(t,e){let n="";if(t&&!e.ignoreAttributes)for(let r in t){if(!t.hasOwnProperty(r))continue;let i=e.attributeValueProcessor(r,t[r]);i=s(i,e),!0===i&&e.suppressBooleanAttributes?n+=` ${r.substr(e.attributeNamePrefix.length)}`:n+=` ${r.substr(e.attributeNamePrefix.length)}="${i}"`}return n}function i(t,e){let n=(t=t.substr(0,t.length-e.textNodeName.length-1)).substr(t.lastIndexOf(".")+1);for(let r in e.stopNodes)if(e.stopNodes[r]===t||e.stopNodes[r]==="*."+n)return!0;return!1}function s(t,e){if(t&&t.length>0&&e.processEntities)for(let n=0;n<e.entities.length;n++){const r=e.entities[n];t=t.replace(r.regex,r.val)}return t}t.exports=function(t,n){let r="";return n.format&&n.indentBy.length>0&&(r="\n"),e(t,n,"",r)}},4910:(t,e,n)=>{const r=n(3080);function i(t,e){let n="";for(;e<t.length&&"'"!==t[e]&&'"'!==t[e];e++)n+=t[e];if(n=n.trim(),-1!==n.indexOf(" "))throw new Error("External entites are not supported");const r=t[e++];let i="";for(;e<t.length&&t[e]!==r;e++)i+=t[e];return[n,i,e]}function s(t,e){return"!"===t[e+1]&&"-"===t[e+2]&&"-"===t[e+3]}function o(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"N"===t[e+3]&&"T"===t[e+4]&&"I"===t[e+5]&&"T"===t[e+6]&&"Y"===t[e+7]}function a(t,e){return"!"===t[e+1]&&"E"===t[e+2]&&"L"===t[e+3]&&"E"===t[e+4]&&"M"===t[e+5]&&"E"===t[e+6]&&"N"===t[e+7]&&"T"===t[e+8]}function c(t,e){return"!"===t[e+1]&&"A"===t[e+2]&&"T"===t[e+3]&&"T"===t[e+4]&&"L"===t[e+5]&&"I"===t[e+6]&&"S"===t[e+7]&&"T"===t[e+8]}function u(t,e){return"!"===t[e+1]&&"N"===t[e+2]&&"O"===t[e+3]&&"T"===t[e+4]&&"A"===t[e+5]&&"T"===t[e+6]&&"I"===t[e+7]&&"O"===t[e+8]&&"N"===t[e+9]}function l(t){if(r.isName(t))return t;throw new Error(`Invalid entity name ${t}`)}t.exports=function(t,e){const n={};if("O"!==t[e+3]||"C"!==t[e+4]||"T"!==t[e+5]||"Y"!==t[e+6]||"P"!==t[e+7]||"E"!==t[e+8])throw new Error("Invalid Tag instead of DOCTYPE");{e+=9;let r=1,h=!1,d=!1,p="";for(;e<t.length;e++)if("<"!==t[e]||d)if(">"===t[e]){if(d?"-"===t[e-1]&&"-"===t[e-2]&&(d=!1,r--):r--,0===r)break}else"["===t[e]?h=!0:p+=t[e];else{if(h&&o(t,e))e+=7,[entityName,val,e]=i(t,e+1),-1===val.indexOf("&")&&(n[l(entityName)]={regx:RegExp(`&${entityName};`,"g"),val});else if(h&&a(t,e))e+=8;else if(h&&c(t,e))e+=8;else if(h&&u(t,e))e+=9;else{if(!s)throw new Error("Invalid DOCTYPE");d=!0}r++,p=""}if(0!==r)throw new Error("Unclosed DOCTYPE")}return{entities:n,i:e}}},9214:(t,e)=>{const n={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,n){return t}};e.buildOptions=function(t){return Object.assign({},n,t)},e.defaultOptions=n},8694:(t,e,n)=>{"use strict";const r=n(3080),i=n(8158),s=n(4910),o=n(1337);function a(t){const e=Object.keys(t);for(let n=0;n<e.length;n++){const r=e[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:t[r]}}}function c(t,e,n,r,i,s,o){if(void 0!==t&&(this.options.trimValues&&!r&&(t=t.trim()),t.length>0)){o||(t=this.replaceEntitiesValue(t));const r=this.options.tagValueProcessor(e,t,n,i,s);if(null==r)return t;if(typeof r!=typeof t||r!==t)return r;if(this.options.trimValues)return w(t,this.options.parseTagValue,this.options.numberParseOptions);return t.trim()===t?w(t,this.options.parseTagValue,this.options.numberParseOptions):t}}function u(t){if(this.options.removeNSPrefix){const e=t.split(":"),n="/"===t.charAt(0)?"/":"";if("xmlns"===e[0])return"";2===e.length&&(t=n+e[1])}return t}const l=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");function h(t,e,n){if(!this.options.ignoreAttributes&&"string"==typeof t){const n=r.getAllMatches(t,l),i=n.length,s={};for(let t=0;t<i;t++){const r=this.resolveNameSpace(n[t][1]);let i=n[t][4],o=this.options.attributeNamePrefix+r;if(r.length)if(this.options.transformAttributeName&&(o=this.options.transformAttributeName(o)),"__proto__"===o&&(o="#__proto__"),void 0!==i){this.options.trimValues&&(i=i.trim()),i=this.replaceEntitiesValue(i);const t=this.options.attributeValueProcessor(r,i,e);s[o]=null==t?i:typeof t!=typeof i||t!==i?t:w(i,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[o]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const t={};return t[this.options.attributesGroupName]=s,t}return s}}const d=function(t){t=t.replace(/\r\n?/g,"\n");const e=new i("!xml");let n=e,r="",o="";for(let a=0;a<t.length;a++){if("<"===t[a])if("/"===t[a+1]){const e=m(t,">",a,"Closing Tag is not closed.");let i=t.substring(a+2,e).trim();if(this.options.removeNSPrefix){const t=i.indexOf(":");-1!==t&&(i=i.substr(t+1))}this.options.transformTagName&&(i=this.options.transformTagName(i)),n&&(r=this.saveTextToParentTag(r,n,o));const s=o.substring(o.lastIndexOf(".")+1);if(i&&-1!==this.options.unpairedTags.indexOf(i))throw new Error(`Unpaired tag can not be used as closing tag: </${i}>`);let c=0;s&&-1!==this.options.unpairedTags.indexOf(s)?(c=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):c=o.lastIndexOf("."),o=o.substring(0,c),n=this.tagsNodeStack.pop(),r="",a=e}else if("?"===t[a+1]){let e=b(t,a,!1,"?>");if(!e)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),this.options.ignoreDeclaration&&"?xml"===e.tagName||this.options.ignorePiTags);else{const t=new i(e.tagName);t.add(this.options.textNodeName,""),e.tagName!==e.tagExp&&e.attrExpPresent&&(t[":@"]=this.buildAttributesMap(e.tagExp,o,e.tagName)),this.addChild(n,t,o)}a=e.closeIndex+1}else if("!--"===t.substr(a+1,3)){const e=m(t,"--\x3e",a+4,"Comment is not closed.");if(this.options.commentPropName){const i=t.substring(a+4,e-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:i}])}a=e}else if("!D"===t.substr(a+1,2)){const e=s(t,a);this.docTypeEntities=e.entities,a=e.i}else if("!["===t.substr(a+1,2)){const e=m(t,"]]>",a,"CDATA is not closed.")-2,i=t.substring(a+9,e);r=this.saveTextToParentTag(r,n,o);let s=this.parseTextData(i,n.tagname,o,!0,!1,!0,!0);null==s&&(s=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:i}]):n.add(this.options.textNodeName,s),a=e+2}else{let s=b(t,a,this.options.removeNSPrefix),c=s.tagName;const u=s.rawTagName;let l=s.tagExp,h=s.attrExpPresent,d=s.closeIndex;this.options.transformTagName&&(c=this.options.transformTagName(c)),n&&r&&"!xml"!==n.tagname&&(r=this.saveTextToParentTag(r,n,o,!1));const p=n;if(p&&-1!==this.options.unpairedTags.indexOf(p.tagname)&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),c!==e.tagname&&(o+=o?"."+c:c),this.isItStopNode(this.options.stopNodes,o,c)){let e="";if(l.length>0&&l.lastIndexOf("/")===l.length-1)"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),l=c):l=l.substr(0,l.length-1),a=s.closeIndex;else if(-1!==this.options.unpairedTags.indexOf(c))a=s.closeIndex;else{const n=this.readStopNodeData(t,u,d+1);if(!n)throw new Error(`Unexpected end of ${u}`);a=n.i,e=n.tagContent}const r=new i(c);c!==l&&h&&(r[":@"]=this.buildAttributesMap(l,o,c)),e&&(e=this.parseTextData(e,c,o,!0,h,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),r.add(this.options.textNodeName,e),this.addChild(n,r,o)}else{if(l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===c[c.length-1]?(c=c.substr(0,c.length-1),o=o.substr(0,o.length-1),l=c):l=l.substr(0,l.length-1),this.options.transformTagName&&(c=this.options.transformTagName(c));const t=new i(c);c!==l&&h&&(t[":@"]=this.buildAttributesMap(l,o,c)),this.addChild(n,t,o),o=o.substr(0,o.lastIndexOf("."))}else{const t=new i(c);this.tagsNodeStack.push(n),c!==l&&h&&(t[":@"]=this.buildAttributesMap(l,o,c)),this.addChild(n,t,o),n=t}r="",a=d}}else r+=t[a]}return e.child};function p(t,e,n){const r=this.options.updateTag(e.tagname,n,e[":@"]);!1===r||("string"==typeof r?(e.tagname=r,t.addChild(e)):t.addChild(e))}const f=function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){const n=this.docTypeEntities[e];t=t.replace(n.regx,n.val)}for(let e in this.lastEntities){const n=this.lastEntities[e];t=t.replace(n.regex,n.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){const n=this.htmlEntities[e];t=t.replace(n.regex,n.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t};function g(t,e,n,r){return t&&(void 0===r&&(r=0===Object.keys(e.child).length),void 0!==(t=this.parseTextData(t,e.tagname,n,!1,!!e[":@"]&&0!==Object.keys(e[":@"]).length,r))&&""!==t&&e.add(this.options.textNodeName,t),t=""),t}function y(t,e,n){const r="*."+n;for(const n in t){const i=t[n];if(r===i||e===i)return!0}return!1}function m(t,e,n,r){const i=t.indexOf(e,n);if(-1===i)throw new Error(r);return i+e.length-1}function b(t,e,n){const r=function(t,e){let n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",i="";for(let s=e;s<t.length;s++){let e=t[s];if(n)e===n&&(n="");else if('"'===e||"'"===e)n=e;else if(e===r[0]){if(!r[1])return{data:i,index:s};if(t[s+1]===r[1])return{data:i,index:s}}else"\t"===e&&(e=" ");i+=e}}(t,e+1,arguments.length>3&&void 0!==arguments[3]?arguments[3]:">");if(!r)return;let i=r.data;const s=r.index,o=i.search(/\s/);let a=i,c=!0;-1!==o&&(a=i.substring(0,o),i=i.substring(o+1).trimStart());const u=a;if(n){const t=a.indexOf(":");-1!==t&&(a=a.substr(t+1),c=a!==r.data.substr(t+1))}return{tagName:a,tagExp:i,closeIndex:s,attrExpPresent:c,rawTagName:u}}function v(t,e,n){const r=n;let i=1;for(;n<t.length;n++)if("<"===t[n])if("/"===t[n+1]){const s=m(t,">",n,`${e} is not closed`);if(t.substring(n+2,s).trim()===e&&(i--,0===i))return{tagContent:t.substring(r,n),i:s};n=s}else if("?"===t[n+1]){n=m(t,"?>",n+1,"StopNode is not closed.")}else if("!--"===t.substr(n+1,3)){n=m(t,"--\x3e",n+3,"StopNode is not closed.")}else if("!["===t.substr(n+1,2)){n=m(t,"]]>",n,"StopNode is not closed.")-2}else{const r=b(t,n,">");if(r){(r&&r.tagName)===e&&"/"!==r.tagExp[r.tagExp.length-1]&&i++,n=r.closeIndex}}}function w(t,e,n){if(e&&"string"==typeof t){const e=t.trim();return"true"===e||"false"!==e&&o(t,n)}return r.isExist(t)?t:""}t.exports=class{constructor(t){this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,e)=>String.fromCharCode(Number.parseInt(e,16))}},this.addExternalEntities=a,this.parseXml=d,this.parseTextData=c,this.resolveNameSpace=u,this.buildAttributesMap=h,this.isItStopNode=y,this.replaceEntitiesValue=f,this.readStopNodeData=v,this.saveTextToParentTag=g,this.addChild=p}}},5637:(t,e,n)=>{const{buildOptions:r}=n(9214),i=n(8694),{prettify:s}=n(4767),o=n(1e3);t.exports=class{constructor(t){this.externalEntities={},this.options=r(t)}parse(t,e){if("string"==typeof t);else{if(!t.toString)throw new Error("XML data is accepted in String or Bytes[] form.");t=t.toString()}if(e){!0===e&&(e={});const n=o.validate(t,e);if(!0!==n)throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`)}const n=new i(this.options);n.addExternalEntities(this.externalEntities);const r=n.parseXml(t);return this.options.preserveOrder||void 0===r?r:s(r,this.options)}addEntity(t,e){if(-1!==e.indexOf("&"))throw new Error("Entity value can't have '&'");if(-1!==t.indexOf("&")||-1!==t.indexOf(";"))throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");if("&"===e)throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=e}}},4767:(t,e)=>{"use strict";function n(t,e,o){let a;const c={};for(let u=0;u<t.length;u++){const l=t[u],h=r(l);let d="";if(d=void 0===o?h:o+"."+h,h===e.textNodeName)void 0===a?a=l[h]:a+=""+l[h];else{if(void 0===h)continue;if(l[h]){let t=n(l[h],e,d);const r=s(t,e);l[":@"]?i(t,l[":@"],d,e):1!==Object.keys(t).length||void 0===t[e.textNodeName]||e.alwaysCreateTextNode?0===Object.keys(t).length&&(e.alwaysCreateTextNode?t[e.textNodeName]="":t=""):t=t[e.textNodeName],void 0!==c[h]&&c.hasOwnProperty(h)?(Array.isArray(c[h])||(c[h]=[c[h]]),c[h].push(t)):e.isArray(h,d,r)?c[h]=[t]:c[h]=t}}}return"string"==typeof a?a.length>0&&(c[e.textNodeName]=a):void 0!==a&&(c[e.textNodeName]=a),c}function r(t){const e=Object.keys(t);for(let t=0;t<e.length;t++){const n=e[t];if(":@"!==n)return n}}function i(t,e,n,r){if(e){const i=Object.keys(e),s=i.length;for(let o=0;o<s;o++){const s=i[o];r.isArray(s,n+"."+s,!0,!0)?t[s]=[e[s]]:t[s]=e[s]}}}function s(t,e){const{textNodeName:n}=e,r=Object.keys(t).length;return 0===r||!(1!==r||!t[n]&&"boolean"!=typeof t[n]&&0!==t[n])}e.prettify=function(t,e){return n(t,e)}},8158:t=>{"use strict";t.exports=class{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}},9748:t=>{t.exports="object"==typeof self?self.FormData:window.FormData},2590:(t,e,n)=>{var r,i=n(2590);r="undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:{},t.exports=r},8885:(t,e)=>{
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
e.read=function(t,e,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1,p=t[e+h];for(h+=d,s=p&(1<<-l)-1,p>>=-l,l+=a;l>0;s=256*s+t[e+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;l>0;o=256*o+t[e+h],h+=d,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=u}return(p?-1:1)*o*Math.pow(2,s-r)},e.write=function(t,e,n,r,i,s){var o,a,c,u=8*s-i-1,l=(1<<u)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=l):(o=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-o))<1&&(o--,c*=2),(e+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=l?(a=0,o=l):o+h>=1?(a=(e*c-1)*Math.pow(2,i),o+=h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;t[n+p]=255&o,p+=f,o/=256,u-=8);t[n+p-f]|=128*g}},7256:t=>{"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},3726:(t,e,n)=>{var r=n(9664)(n(6339),"DataView");t.exports=r},7067:(t,e,n)=>{var r=n(1434),i=n(3772),s=n(1679),o=n(643),a=n(6011);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=o,c.prototype.set=a,t.exports=c},8081:(t,e,n)=>{var r=n(2060),i=n(9226),s=n(277),o=n(7673),a=n(1249);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=o,c.prototype.set=a,t.exports=c},3485:(t,e,n)=>{var r=n(9664)(n(6339),"Map");t.exports=r},2839:(t,e,n)=>{var r=n(9934),i=n(9784),s=n(2235),o=n(8215),a=n(7375);function c(t){var e=-1,n=null==t?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=s,c.prototype.has=o,c.prototype.set=a,t.exports=c},5150:(t,e,n)=>{var r=n(9664)(n(6339),"Promise");t.exports=r},5083:(t,e,n)=>{var r=n(9664)(n(6339),"Set");t.exports=r},8105:(t,e,n)=>{var r=n(2839),i=n(2982),s=n(6561);function o(t){var e=-1,n=null==t?0:t.length;for(this.__data__=new r;++e<n;)this.add(t[e])}o.prototype.add=o.prototype.push=i,o.prototype.has=s,t.exports=o},1923:(t,e,n)=>{var r=n(8081),i=n(5762),s=n(4228),o=n(4999),a=n(9243),c=n(339);function u(t){var e=this.__data__=new r(t);this.size=e.size}u.prototype.clear=i,u.prototype.delete=s,u.prototype.get=o,u.prototype.has=a,u.prototype.set=c,t.exports=u},2983:(t,e,n)=>{var r=n(6339).Symbol;t.exports=r},6850:(t,e,n)=>{var r=n(6339).Uint8Array;t.exports=r},8325:(t,e,n)=>{var r=n(9664)(n(6339),"WeakMap");t.exports=r},1095:t=>{t.exports=function(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}},4215:t=>{t.exports=function(t,e,n,r){for(var i=-1,s=null==t?0:t.length;++i<s;){var o=t[i];e(r,o,n(o),t)}return r}},6171:t=>{t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r&&!1!==e(t[n],n,t););return t}},7704:t=>{t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=0,s=[];++n<r;){var o=t[n];e(o,n,t)&&(s[i++]=o)}return s}},6391:(t,e,n)=>{var r=n(7941);t.exports=function(t,e){return!!(null==t?0:t.length)&&r(t,e,0)>-1}},7487:t=>{t.exports=function(t,e,n){for(var r=-1,i=null==t?0:t.length;++r<i;)if(n(e,t[r]))return!0;return!1}},2081:(t,e,n)=>{var r=n(3778),i=n(6478),s=n(2963),o=n(734),a=n(9543),c=n(1621),u=Object.prototype.hasOwnProperty;t.exports=function(t,e){var n=s(t),l=!n&&i(t),h=!n&&!l&&o(t),d=!n&&!l&&!h&&c(t),p=n||l||h||d,f=p?r(t.length,String):[],g=f.length;for(var y in t)!e&&!u.call(t,y)||p&&("length"==y||h&&("offset"==y||"parent"==y)||d&&("buffer"==y||"byteLength"==y||"byteOffset"==y)||a(y,g))||f.push(y);return f}},7326:t=>{t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length,i=Array(r);++n<r;)i[n]=e(t[n],n,t);return i}},2146:t=>{t.exports=function(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}},4616:t=>{t.exports=function(t,e,n,r){var i=-1,s=null==t?0:t.length;for(r&&s&&(n=t[++i]);++i<s;)n=e(n,t[i],i,t);return n}},1870:t=>{t.exports=function(t,e){for(var n=-1,r=null==t?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}},120:t=>{t.exports=function(t){return t.split("")}},9695:t=>{var e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;t.exports=function(t){return t.match(e)||[]}},7251:(t,e,n)=>{var r=n(1826),i=n(2458);t.exports=function(t,e,n){(void 0!==n&&!i(t[e],n)||void 0===n&&!(e in t))&&r(t,e,n)}},1605:(t,e,n)=>{var r=n(1826),i=n(2458),s=Object.prototype.hasOwnProperty;t.exports=function(t,e,n){var o=t[e];s.call(t,e)&&i(o,n)&&(void 0!==n||e in t)||r(t,e,n)}},4703:(t,e,n)=>{var r=n(2458);t.exports=function(t,e){for(var n=t.length;n--;)if(r(t[n][0],e))return n;return-1}},7199:(t,e,n)=>{var r=n(5859);t.exports=function(t,e,n,i){return r(t,(function(t,r,s){e(i,t,n(t),s)})),i}},4815:(t,e,n)=>{var r=n(7713),i=n(9704);t.exports=function(t,e){return t&&r(e,i(e),t)}},1380:(t,e,n)=>{var r=n(7713),i=n(5255);t.exports=function(t,e){return t&&r(e,i(e),t)}},1826:(t,e,n)=>{var r=n(9313);t.exports=function(t,e,n){"__proto__"==e&&r?r(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}},7953:(t,e,n)=>{var r=n(1923),i=n(6171),s=n(1605),o=n(4815),a=n(1380),c=n(4772),u=n(5925),l=n(7637),h=n(5094),d=n(2608),p=n(8367),f=n(4471),g=n(1991),y=n(8249),m=n(1015),b=n(2963),v=n(734),w=n(6596),S=n(3667),E=n(934),_=n(9704),C=n(5255),T="[object Arguments]",I="[object Function]",N="[object Object]",R={};R[T]=R["[object Array]"]=R["[object ArrayBuffer]"]=R["[object DataView]"]=R["[object Boolean]"]=R["[object Date]"]=R["[object Float32Array]"]=R["[object Float64Array]"]=R["[object Int8Array]"]=R["[object Int16Array]"]=R["[object Int32Array]"]=R["[object Map]"]=R["[object Number]"]=R[N]=R["[object RegExp]"]=R["[object Set]"]=R["[object String]"]=R["[object Symbol]"]=R["[object Uint8Array]"]=R["[object Uint8ClampedArray]"]=R["[object Uint16Array]"]=R["[object Uint32Array]"]=!0,R["[object Error]"]=R[I]=R["[object WeakMap]"]=!1,t.exports=function t(e,n,O,A,x,P){var k,L=1&n,D=2&n,M=4&n;if(O&&(k=x?O(e,A,x,P):O(e)),void 0!==k)return k;if(!S(e))return e;var B=b(e);if(B){if(k=g(e),!L)return u(e,k)}else{var F=f(e),j=F==I||"[object GeneratorFunction]"==F;if(v(e))return c(e,L);if(F==N||F==T||j&&!x){if(k=D||j?{}:m(e),!L)return D?h(e,a(k,e)):l(e,o(k,e))}else{if(!R[F])return x?e:{};k=y(e,F,L)}}P||(P=new r);var U=P.get(e);if(U)return U;P.set(e,k),E(e)?e.forEach((function(r){k.add(t(r,n,O,r,e,P))})):w(e)&&e.forEach((function(r,i){k.set(i,t(r,n,O,i,e,P))}));var $=B?void 0:(M?D?p:d:D?C:_)(e);return i($||e,(function(r,i){$&&(r=e[i=r]),s(k,i,t(r,n,O,i,e,P))})),k}},1098:(t,e,n)=>{var r=n(3667),i=Object.create,s=function(){function t(){}return function(e){if(!r(e))return{};if(i)return i(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();t.exports=s},5859:(t,e,n)=>{var r=n(8251),i=n(815)(r);t.exports=i},5333:t=>{t.exports=function(t,e,n,r){for(var i=t.length,s=n+(r?1:-1);r?s--:++s<i;)if(e(t[s],s,t))return s;return-1}},2350:(t,e,n)=>{var r=n(2146),i=n(4753);t.exports=function t(e,n,s,o,a){var c=-1,u=e.length;for(s||(s=i),a||(a=[]);++c<u;){var l=e[c];n>0&&s(l)?n>1?t(l,n-1,s,o,a):r(a,l):o||(a[a.length]=l)}return a}},7963:(t,e,n)=>{var r=n(2727)();t.exports=r},8251:(t,e,n)=>{var r=n(7963),i=n(9704);t.exports=function(t,e){return t&&r(t,e,i)}},576:(t,e,n)=>{var r=n(3315),i=n(6123);t.exports=function(t,e){for(var n=0,s=(e=r(e,t)).length;null!=t&&n<s;)t=t[i(e[n++])];return n&&n==s?t:void 0}},7813:(t,e,n)=>{var r=n(2146),i=n(2963);t.exports=function(t,e,n){var s=e(t);return i(t)?s:r(s,n(t))}},4890:(t,e,n)=>{var r=n(2983),i=n(937),s=n(3388),o=r?r.toStringTag:void 0;t.exports=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":o&&o in Object(t)?i(t):s(t)}},9851:t=>{t.exports=function(t,e){return null!=t&&e in Object(t)}},7941:(t,e,n)=>{var r=n(5333),i=n(8505),s=n(4197);t.exports=function(t,e,n){return e==e?s(t,e,n):r(t,i,n)}},1432:(t,e,n)=>{var r=n(4890),i=n(5116);t.exports=function(t){return i(t)&&"[object Arguments]"==r(t)}},4584:(t,e,n)=>{var r=n(1878),i=n(5116);t.exports=function t(e,n,s,o,a){return e===n||(null==e||null==n||!i(e)&&!i(n)?e!=e&&n!=n:r(e,n,s,o,t,a))}},1878:(t,e,n)=>{var r=n(1923),i=n(929),s=n(1428),o=n(6583),a=n(4471),c=n(2963),u=n(734),l=n(1621),h="[object Arguments]",d="[object Array]",p="[object Object]",f=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,g,y,m){var b=c(t),v=c(e),w=b?d:a(t),S=v?d:a(e),E=(w=w==h?p:w)==p,_=(S=S==h?p:S)==p,C=w==S;if(C&&u(t)){if(!u(e))return!1;b=!0,E=!1}if(C&&!E)return m||(m=new r),b||l(t)?i(t,e,n,g,y,m):s(t,e,w,n,g,y,m);if(!(1&n)){var T=E&&f.call(t,"__wrapped__"),I=_&&f.call(e,"__wrapped__");if(T||I){var N=T?t.value():t,R=I?e.value():e;return m||(m=new r),y(N,R,n,g,m)}}return!!C&&(m||(m=new r),o(t,e,n,g,y,m))}},2454:(t,e,n)=>{var r=n(4471),i=n(5116);t.exports=function(t){return i(t)&&"[object Map]"==r(t)}},2957:(t,e,n)=>{var r=n(1923),i=n(4584);t.exports=function(t,e,n,s){var o=n.length,a=o,c=!s;if(null==t)return!a;for(t=Object(t);o--;){var u=n[o];if(c&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<a;){var l=(u=n[o])[0],h=t[l],d=u[1];if(c&&u[2]){if(void 0===h&&!(l in t))return!1}else{var p=new r;if(s)var f=s(h,d,l,t,e,p);if(!(void 0===f?i(d,h,3,s,p):f))return!1}}return!0}},8505:t=>{t.exports=function(t){return t!=t}},1433:(t,e,n)=>{var r=n(2836),i=n(6934),s=n(3667),o=n(9751),a=/^\[object .+?Constructor\]$/,c=Function.prototype,u=Object.prototype,l=c.toString,h=u.hasOwnProperty,d=RegExp("^"+l.call(h).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=function(t){return!(!s(t)||i(t))&&(r(t)?d:a).test(o(t))}},3363:(t,e,n)=>{var r=n(4890),i=n(5116);t.exports=function(t){return i(t)&&"[object RegExp]"==r(t)}},8516:(t,e,n)=>{var r=n(4471),i=n(5116);t.exports=function(t){return i(t)&&"[object Set]"==r(t)}},5963:(t,e,n)=>{var r=n(4890),i=n(3436),s=n(5116),o={};o["[object Float32Array]"]=o["[object Float64Array]"]=o["[object Int8Array]"]=o["[object Int16Array]"]=o["[object Int32Array]"]=o["[object Uint8Array]"]=o["[object Uint8ClampedArray]"]=o["[object Uint16Array]"]=o["[object Uint32Array]"]=!0,o["[object Arguments]"]=o["[object Array]"]=o["[object ArrayBuffer]"]=o["[object Boolean]"]=o["[object DataView]"]=o["[object Date]"]=o["[object Error]"]=o["[object Function]"]=o["[object Map]"]=o["[object Number]"]=o["[object Object]"]=o["[object RegExp]"]=o["[object Set]"]=o["[object String]"]=o["[object WeakMap]"]=!1,t.exports=function(t){return s(t)&&i(t.length)&&!!o[r(t)]}},7371:(t,e,n)=>{var r=n(725),i=n(9724),s=n(5142),o=n(2963),a=n(3589);t.exports=function(t){return"function"==typeof t?t:null==t?s:"object"==typeof t?o(t)?i(t[0],t[1]):r(t):a(t)}},8314:(t,e,n)=>{var r=n(8421),i=n(8788),s=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return i(t);var e=[];for(var n in Object(t))s.call(t,n)&&"constructor"!=n&&e.push(n);return e}},4845:(t,e,n)=>{var r=n(3667),i=n(8421),s=n(7115),o=Object.prototype.hasOwnProperty;t.exports=function(t){if(!r(t))return s(t);var e=i(t),n=[];for(var a in t)("constructor"!=a||!e&&o.call(t,a))&&n.push(a);return n}},8166:(t,e,n)=>{var r=n(5859),i=n(7404);t.exports=function(t,e){var n=-1,s=i(t)?Array(t.length):[];return r(t,(function(t,r,i){s[++n]=e(t,r,i)})),s}},725:(t,e,n)=>{var r=n(2957),i=n(9874),s=n(2599);t.exports=function(t){var e=i(t);return 1==e.length&&e[0][2]?s(e[0][0],e[0][1]):function(n){return n===t||r(n,t,e)}}},9724:(t,e,n)=>{var r=n(4584),i=n(4590),s=n(3197),o=n(4352),a=n(1334),c=n(2599),u=n(6123);t.exports=function(t,e){return o(t)&&a(e)?c(u(t),e):function(n){var o=i(n,t);return void 0===o&&o===e?s(n,t):r(e,o,3)}}},6167:(t,e,n)=>{var r=n(6851);t.exports=function(t,e){var n=null==t?0:t.length;return n?r(t,e)/n:NaN}},384:(t,e,n)=>{var r=n(1923),i=n(7251),s=n(7963),o=n(1214),a=n(3667),c=n(5255),u=n(3512);t.exports=function t(e,n,l,h,d){e!==n&&s(n,(function(s,c){if(d||(d=new r),a(s))o(e,n,c,l,t,h,d);else{var p=h?h(u(e,c),s,c+"",e,n,d):void 0;void 0===p&&(p=s),i(e,c,p)}}),c)}},1214:(t,e,n)=>{var r=n(7251),i=n(4772),s=n(4675),o=n(5925),a=n(1015),c=n(6478),u=n(2963),l=n(4171),h=n(734),d=n(2836),p=n(3667),f=n(8841),g=n(1621),y=n(3512),m=n(2058);t.exports=function(t,e,n,b,v,w,S){var E=y(t,n),_=y(e,n),C=S.get(_);if(C)r(t,n,C);else{var T=w?w(E,_,n+"",t,e,S):void 0,I=void 0===T;if(I){var N=u(_),R=!N&&h(_),O=!N&&!R&&g(_);T=_,N||R||O?u(E)?T=E:l(E)?T=o(E):R?(I=!1,T=i(_,!0)):O?(I=!1,T=s(_,!0)):T=[]:f(_)||c(_)?(T=E,c(E)?T=m(E):p(E)&&!d(E)||(T=a(_))):I=!1}I&&(S.set(_,T),v(T,_,b,w,S),S.delete(_)),r(t,n,T)}}},1537:(t,e,n)=>{var r=n(7326),i=n(576),s=n(7371),o=n(8166),a=n(7521),c=n(8859),u=n(9420),l=n(5142),h=n(2963);t.exports=function(t,e,n){e=e.length?r(e,(function(t){return h(t)?function(e){return i(e,1===t.length?t[0]:t)}:t})):[l];var d=-1;e=r(e,c(s));var p=o(t,(function(t,n,i){return{criteria:r(e,(function(e){return e(t)})),index:++d,value:t}}));return a(p,(function(t,e){return u(t,e,n)}))}},7923:(t,e,n)=>{var r=n(3282),i=n(3197);t.exports=function(t,e){return r(t,e,(function(e,n){return i(t,n)}))}},3282:(t,e,n)=>{var r=n(576),i=n(3460),s=n(3315);t.exports=function(t,e,n){for(var o=-1,a=e.length,c={};++o<a;){var u=e[o],l=r(t,u);n(l,u)&&i(c,s(u,t),l)}return c}},9219:t=>{t.exports=function(t){return function(e){return null==e?void 0:e[t]}}},1165:(t,e,n)=>{var r=n(576);t.exports=function(t){return function(e){return r(e,t)}}},9166:t=>{t.exports=function(t){return function(e){return null==t?void 0:t[e]}}},2764:(t,e,n)=>{var r=n(3881),i=n(9543),s=Array.prototype.splice;t.exports=function(t,e){for(var n=t?e.length:0,o=n-1;n--;){var a=e[n];if(n==o||a!==c){var c=a;i(a)?s.call(t,a,1):r(t,a)}}return t}},385:t=>{var e=Math.floor,n=Math.random;t.exports=function(t,r){return t+e(n()*(r-t+1))}},7209:t=>{var e=Math.floor;t.exports=function(t,n){var r="";if(!t||n<1||n>9007199254740991)return r;do{n%2&&(r+=t),(n=e(n/2))&&(t+=t)}while(n);return r}},8464:(t,e,n)=>{var r=n(5142),i=n(9187),s=n(5607);t.exports=function(t,e){return s(i(t,e,r),t+"")}},3460:(t,e,n)=>{var r=n(1605),i=n(3315),s=n(9543),o=n(3667),a=n(6123);t.exports=function(t,e,n,c){if(!o(t))return t;for(var u=-1,l=(e=i(e,t)).length,h=l-1,d=t;null!=d&&++u<l;){var p=a(e[u]),f=n;if("__proto__"===p||"constructor"===p||"prototype"===p)return t;if(u!=h){var g=d[p];void 0===(f=c?c(g,p,d):void 0)&&(f=o(g)?g:s(e[u+1])?[]:{})}r(d,p,f),d=d[p]}return t}},9240:(t,e,n)=>{var r=n(796),i=n(9313),s=n(5142),o=i?function(t,e){return i(t,"toString",{configurable:!0,enumerable:!1,value:r(e),writable:!0})}:s;t.exports=o},4310:t=>{t.exports=function(t,e,n){var r=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(n=n>i?i:n)<0&&(n+=i),i=e>n?0:n-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=t[r+e];return s}},7521:t=>{t.exports=function(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}},6851:t=>{t.exports=function(t,e){for(var n,r=-1,i=t.length;++r<i;){var s=e(t[r]);void 0!==s&&(n=void 0===n?s:n+s)}return n}},3778:t=>{t.exports=function(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}},3410:(t,e,n)=>{var r=n(2983),i=n(7326),s=n(2963),o=n(6516),a=r?r.prototype:void 0,c=a?a.toString:void 0;t.exports=function t(e){if("string"==typeof e)return e;if(s(e))return i(e,t)+"";if(o(e))return c?c.call(e):"";var n=e+"";return"0"==n&&1/e==-1/0?"-0":n}},9006:(t,e,n)=>{var r=n(9474),i=/^\s+/;t.exports=function(t){return t?t.slice(0,r(t)+1).replace(i,""):t}},8859:t=>{t.exports=function(t){return function(e){return t(e)}}},8675:(t,e,n)=>{var r=n(8105),i=n(6391),s=n(7487),o=n(3073),a=n(2495),c=n(2209);t.exports=function(t,e,n){var u=-1,l=i,h=t.length,d=!0,p=[],f=p;if(n)d=!1,l=s;else if(h>=200){var g=e?null:a(t);if(g)return c(g);d=!1,l=o,f=new r}else f=e?[]:p;t:for(;++u<h;){var y=t[u],m=e?e(y):y;if(y=n||0!==y?y:0,d&&m==m){for(var b=f.length;b--;)if(f[b]===m)continue t;e&&f.push(m),p.push(y)}else l(f,m,n)||(f!==p&&f.push(m),p.push(y))}return p}},3881:(t,e,n)=>{var r=n(3315),i=n(1672),s=n(1291),o=n(6123);t.exports=function(t,e){return e=r(e,t),null==(t=s(t,e))||delete t[o(i(e))]}},3073:t=>{t.exports=function(t,e){return t.has(e)}},3315:(t,e,n)=>{var r=n(2963),i=n(4352),s=n(5128),o=n(8324);t.exports=function(t,e){return r(t)?t:i(t,e)?[t]:s(o(t))}},4920:(t,e,n)=>{var r=n(4310);t.exports=function(t,e,n){var i=t.length;return n=void 0===n?i:n,!e&&n>=i?t:r(t,e,n)}},8371:(t,e,n)=>{var r=n(6850);t.exports=function(t){var e=new t.constructor(t.byteLength);return new r(e).set(new r(t)),e}},4772:(t,e,n)=>{t=n.nmd(t);var r=n(6339),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,o=s&&s.exports===i?r.Buffer:void 0,a=o?o.allocUnsafe:void 0;t.exports=function(t,e){if(e)return t.slice();var n=t.length,r=a?a(n):new t.constructor(n);return t.copy(r),r}},3835:(t,e,n)=>{var r=n(8371);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}},4664:t=>{var e=/\w*$/;t.exports=function(t){var n=new t.constructor(t.source,e.exec(t));return n.lastIndex=t.lastIndex,n}},1774:(t,e,n)=>{var r=n(2983),i=r?r.prototype:void 0,s=i?i.valueOf:void 0;t.exports=function(t){return s?Object(s.call(t)):{}}},4675:(t,e,n)=>{var r=n(8371);t.exports=function(t,e){var n=e?r(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}},1076:(t,e,n)=>{var r=n(6516);t.exports=function(t,e){if(t!==e){var n=void 0!==t,i=null===t,s=t==t,o=r(t),a=void 0!==e,c=null===e,u=e==e,l=r(e);if(!c&&!l&&!o&&t>e||o&&a&&u&&!c&&!l||i&&a&&u||!n&&u||!s)return 1;if(!i&&!o&&!l&&t<e||l&&n&&s&&!i&&!o||c&&n&&s||!a&&s||!u)return-1}return 0}},9420:(t,e,n)=>{var r=n(1076);t.exports=function(t,e,n){for(var i=-1,s=t.criteria,o=e.criteria,a=s.length,c=n.length;++i<a;){var u=r(s[i],o[i]);if(u)return i>=c?u:u*("desc"==n[i]?-1:1)}return t.index-e.index}},5925:t=>{t.exports=function(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}},7713:(t,e,n)=>{var r=n(1605),i=n(1826);t.exports=function(t,e,n,s){var o=!n;n||(n={});for(var a=-1,c=e.length;++a<c;){var u=e[a],l=s?s(n[u],t[u],u,n,t):void 0;void 0===l&&(l=t[u]),o?i(n,u,l):r(n,u,l)}return n}},7637:(t,e,n)=>{var r=n(7713),i=n(5974);t.exports=function(t,e){return r(t,i(t),e)}},5094:(t,e,n)=>{var r=n(7713),i=n(4737);t.exports=function(t,e){return r(t,i(t),e)}},31:(t,e,n)=>{var r=n(6339)["__core-js_shared__"];t.exports=r},3850:(t,e,n)=>{var r=n(4215),i=n(7199),s=n(7371),o=n(2963);t.exports=function(t,e){return function(n,a){var c=o(n)?r:i,u=e?e():{};return c(n,t,s(a,2),u)}}},461:(t,e,n)=>{var r=n(8464),i=n(6062);t.exports=function(t){return r((function(e,n){var r=-1,s=n.length,o=s>1?n[s-1]:void 0,a=s>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(s--,o):void 0,a&&i(n[0],n[1],a)&&(o=s<3?void 0:o,s=1),e=Object(e);++r<s;){var c=n[r];c&&t(e,c,r,o)}return e}))}},815:(t,e,n)=>{var r=n(7404);t.exports=function(t,e){return function(n,i){if(null==n)return n;if(!r(n))return t(n,i);for(var s=n.length,o=e?s:-1,a=Object(n);(e?o--:++o<s)&&!1!==i(a[o],o,a););return n}}},2727:t=>{t.exports=function(t){return function(e,n,r){for(var i=-1,s=Object(e),o=r(e),a=o.length;a--;){var c=o[t?a:++i];if(!1===n(s[c],c,s))break}return e}}},7325:(t,e,n)=>{var r=n(4920),i=n(4572),s=n(4114),o=n(8324);t.exports=function(t){return function(e){e=o(e);var n=i(e)?s(e):void 0,a=n?n[0]:e.charAt(0),c=n?r(n,1).join(""):e.slice(1);return a[t]()+c}}},2905:(t,e,n)=>{var r=n(4616),i=n(6298),s=n(5019),o=RegExp("['’]","g");t.exports=function(t){return function(e){return r(s(i(e).replace(o,"")),t,"")}}},4176:(t,e,n)=>{var r=n(7371),i=n(7404),s=n(9704);t.exports=function(t){return function(e,n,o){var a=Object(e);if(!i(e)){var c=r(n,3);e=s(e),n=function(t){return c(a[t],t,a)}}var u=t(e,n,o);return u>-1?a[c?e[u]:u]:void 0}}},2495:(t,e,n)=>{var r=n(5083),i=n(2340),s=n(2209),o=r&&1/s(new r([,-0]))[1]==1/0?function(t){return new r(t)}:i;t.exports=o},8252:(t,e,n)=>{var r=n(8841);t.exports=function(t){return r(t)?void 0:t}},4865:(t,e,n)=>{var r=n(9166)({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",Ĳ:"IJ",ĳ:"ij",Œ:"Oe",œ:"oe",ŉ:"'n",ſ:"s"});t.exports=r},9313:(t,e,n)=>{var r=n(9664),i=function(){try{var t=r(Object,"defineProperty");return t({},"",{}),t}catch(t){}}();t.exports=i},929:(t,e,n)=>{var r=n(8105),i=n(1870),s=n(3073);t.exports=function(t,e,n,o,a,c){var u=1&n,l=t.length,h=e.length;if(l!=h&&!(u&&h>l))return!1;var d=c.get(t),p=c.get(e);if(d&&p)return d==e&&p==t;var f=-1,g=!0,y=2&n?new r:void 0;for(c.set(t,e),c.set(e,t);++f<l;){var m=t[f],b=e[f];if(o)var v=u?o(b,m,f,e,t,c):o(m,b,f,t,e,c);if(void 0!==v){if(v)continue;g=!1;break}if(y){if(!i(e,(function(t,e){if(!s(y,e)&&(m===t||a(m,t,n,o,c)))return y.push(e)}))){g=!1;break}}else if(m!==b&&!a(m,b,n,o,c)){g=!1;break}}return c.delete(t),c.delete(e),g}},1428:(t,e,n)=>{var r=n(2983),i=n(6850),s=n(2458),o=n(929),a=n(3595),c=n(2209),u=r?r.prototype:void 0,l=u?u.valueOf:void 0;t.exports=function(t,e,n,r,u,h,d){switch(n){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!h(new i(t),new i(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return s(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var p=a;case"[object Set]":var f=1&r;if(p||(p=c),t.size!=e.size&&!f)return!1;var g=d.get(t);if(g)return g==e;r|=2,d.set(t,e);var y=o(p(t),p(e),r,u,h,d);return d.delete(t),y;case"[object Symbol]":if(l)return l.call(t)==l.call(e)}return!1}},6583:(t,e,n)=>{var r=n(2608),i=Object.prototype.hasOwnProperty;t.exports=function(t,e,n,s,o,a){var c=1&n,u=r(t),l=u.length;if(l!=r(e).length&&!c)return!1;for(var h=l;h--;){var d=u[h];if(!(c?d in e:i.call(e,d)))return!1}var p=a.get(t),f=a.get(e);if(p&&f)return p==e&&f==t;var g=!0;a.set(t,e),a.set(e,t);for(var y=c;++h<l;){var m=t[d=u[h]],b=e[d];if(s)var v=c?s(b,m,d,e,t,a):s(m,b,d,t,e,a);if(!(void 0===v?m===b||o(m,b,n,s,a):v)){g=!1;break}y||(y="constructor"==d)}if(g&&!y){var w=t.constructor,S=e.constructor;w==S||!("constructor"in t)||!("constructor"in e)||"function"==typeof w&&w instanceof w&&"function"==typeof S&&S instanceof S||(g=!1)}return a.delete(t),a.delete(e),g}},2854:(t,e,n)=>{var r=n(6496),i=n(9187),s=n(5607);t.exports=function(t){return s(i(t,void 0,r),t+"")}},7726:(t,e,n)=>{var r=n(2590),i="object"==typeof r&&r&&r.Object===Object&&r;t.exports=i},2608:(t,e,n)=>{var r=n(7813),i=n(5974),s=n(9704);t.exports=function(t){return r(t,s,i)}},8367:(t,e,n)=>{var r=n(7813),i=n(4737),s=n(5255);t.exports=function(t){return r(t,s,i)}},6065:(t,e,n)=>{var r=n(4628);t.exports=function(t,e){var n=t.__data__;return r(e)?n["string"==typeof e?"string":"hash"]:n.map}},9874:(t,e,n)=>{var r=n(1334),i=n(9704);t.exports=function(t){for(var e=i(t),n=e.length;n--;){var s=e[n],o=t[s];e[n]=[s,o,r(o)]}return e}},9664:(t,e,n)=>{var r=n(1433),i=n(3842);t.exports=function(t,e){var n=i(t,e);return r(n)?n:void 0}},2929:(t,e,n)=>{var r=n(1465)(Object.getPrototypeOf,Object);t.exports=r},937:(t,e,n)=>{var r=n(2983),i=Object.prototype,s=i.hasOwnProperty,o=i.toString,a=r?r.toStringTag:void 0;t.exports=function(t){var e=s.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var i=o.call(t);return r&&(e?t[a]=n:delete t[a]),i}},5974:(t,e,n)=>{var r=n(7704),i=n(6567),s=Object.prototype.propertyIsEnumerable,o=Object.getOwnPropertySymbols,a=o?function(t){return null==t?[]:(t=Object(t),r(o(t),(function(e){return s.call(t,e)})))}:i;t.exports=a},4737:(t,e,n)=>{var r=n(2146),i=n(2929),s=n(5974),o=n(6567),a=Object.getOwnPropertySymbols?function(t){for(var e=[];t;)r(e,s(t)),t=i(t);return e}:o;t.exports=a},4471:(t,e,n)=>{var r=n(3726),i=n(3485),s=n(5150),o=n(5083),a=n(8325),c=n(4890),u=n(9751),l="[object Map]",h="[object Promise]",d="[object Set]",p="[object WeakMap]",f="[object DataView]",g=u(r),y=u(i),m=u(s),b=u(o),v=u(a),w=c;(r&&w(new r(new ArrayBuffer(1)))!=f||i&&w(new i)!=l||s&&w(s.resolve())!=h||o&&w(new o)!=d||a&&w(new a)!=p)&&(w=function(t){var e=c(t),n="[object Object]"==e?t.constructor:void 0,r=n?u(n):"";if(r)switch(r){case g:return f;case y:return l;case m:return h;case b:return d;case v:return p}return e}),t.exports=w},3842:t=>{t.exports=function(t,e){return null==t?void 0:t[e]}},8888:(t,e,n)=>{var r=n(3315),i=n(6478),s=n(2963),o=n(9543),a=n(3436),c=n(6123);t.exports=function(t,e,n){for(var u=-1,l=(e=r(e,t)).length,h=!1;++u<l;){var d=c(e[u]);if(!(h=null!=t&&n(t,d)))break;t=t[d]}return h||++u!=l?h:!!(l=null==t?0:t.length)&&a(l)&&o(d,l)&&(s(t)||i(t))}},4572:t=>{var e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");t.exports=function(t){return e.test(t)}},3536:t=>{var e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;t.exports=function(t){return e.test(t)}},1434:(t,e,n)=>{var r=n(1292);t.exports=function(){this.__data__=r?r(null):{},this.size=0}},3772:t=>{t.exports=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}},1679:(t,e,n)=>{var r=n(1292),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;if(r){var n=e[t];return"__lodash_hash_undefined__"===n?void 0:n}return i.call(e,t)?e[t]:void 0}},643:(t,e,n)=>{var r=n(1292),i=Object.prototype.hasOwnProperty;t.exports=function(t){var e=this.__data__;return r?void 0!==e[t]:i.call(e,t)}},6011:(t,e,n)=>{var r=n(1292);t.exports=function(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=r&&void 0===e?"__lodash_hash_undefined__":e,this}},1991:t=>{var e=Object.prototype.hasOwnProperty;t.exports=function(t){var n=t.length,r=new t.constructor(n);return n&&"string"==typeof t[0]&&e.call(t,"index")&&(r.index=t.index,r.input=t.input),r}},8249:(t,e,n)=>{var r=n(8371),i=n(3835),s=n(4664),o=n(1774),a=n(4675);t.exports=function(t,e,n){var c=t.constructor;switch(e){case"[object ArrayBuffer]":return r(t);case"[object Boolean]":case"[object Date]":return new c(+t);case"[object DataView]":return i(t,n);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return a(t,n);case"[object Map]":case"[object Set]":return new c;case"[object Number]":case"[object String]":return new c(t);case"[object RegExp]":return s(t);case"[object Symbol]":return o(t)}}},1015:(t,e,n)=>{var r=n(1098),i=n(2929),s=n(8421);t.exports=function(t){return"function"!=typeof t.constructor||s(t)?{}:r(i(t))}},4753:(t,e,n)=>{var r=n(2983),i=n(6478),s=n(2963),o=r?r.isConcatSpreadable:void 0;t.exports=function(t){return s(t)||i(t)||!!(o&&t&&t[o])}},9543:t=>{var e=/^(?:0|[1-9]\d*)$/;t.exports=function(t,n){var r=typeof t;return!!(n=null==n?9007199254740991:n)&&("number"==r||"symbol"!=r&&e.test(t))&&t>-1&&t%1==0&&t<n}},6062:(t,e,n)=>{var r=n(2458),i=n(7404),s=n(9543),o=n(3667);t.exports=function(t,e,n){if(!o(n))return!1;var a=typeof e;return!!("number"==a?i(n)&&s(e,n.length):"string"==a&&e in n)&&r(n[e],t)}},4352:(t,e,n)=>{var r=n(2963),i=n(6516),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,o=/^\w*$/;t.exports=function(t,e){if(r(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!i(t))||(o.test(t)||!s.test(t)||null!=e&&t in Object(e))}},4628:t=>{t.exports=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}},6934:(t,e,n)=>{var r,i=n(31),s=(r=/[^.]+$/.exec(i&&i.keys&&i.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"";t.exports=function(t){return!!s&&s in t}},8421:t=>{var e=Object.prototype;t.exports=function(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||e)}},1334:(t,e,n)=>{var r=n(3667);t.exports=function(t){return t==t&&!r(t)}},2060:t=>{t.exports=function(){this.__data__=[],this.size=0}},9226:(t,e,n)=>{var r=n(4703),i=Array.prototype.splice;t.exports=function(t){var e=this.__data__,n=r(e,t);return!(n<0)&&(n==e.length-1?e.pop():i.call(e,n,1),--this.size,!0)}},277:(t,e,n)=>{var r=n(4703);t.exports=function(t){var e=this.__data__,n=r(e,t);return n<0?void 0:e[n][1]}},7673:(t,e,n)=>{var r=n(4703);t.exports=function(t){return r(this.__data__,t)>-1}},1249:(t,e,n)=>{var r=n(4703);t.exports=function(t,e){var n=this.__data__,i=r(n,t);return i<0?(++this.size,n.push([t,e])):n[i][1]=e,this}},9934:(t,e,n)=>{var r=n(7067),i=n(8081),s=n(3485);t.exports=function(){this.size=0,this.__data__={hash:new r,map:new(s||i),string:new r}}},9784:(t,e,n)=>{var r=n(6065);t.exports=function(t){var e=r(this,t).delete(t);return this.size-=e?1:0,e}},2235:(t,e,n)=>{var r=n(6065);t.exports=function(t){return r(this,t).get(t)}},8215:(t,e,n)=>{var r=n(6065);t.exports=function(t){return r(this,t).has(t)}},7375:(t,e,n)=>{var r=n(6065);t.exports=function(t,e){var n=r(this,t),i=n.size;return n.set(t,e),this.size+=n.size==i?0:1,this}},3595:t=>{t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t,r){n[++e]=[r,t]})),n}},2599:t=>{t.exports=function(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}},4634:(t,e,n)=>{var r=n(2902);t.exports=function(t){var e=r(t,(function(t){return 500===n.size&&n.clear(),t})),n=e.cache;return e}},1292:(t,e,n)=>{var r=n(9664)(Object,"create");t.exports=r},8788:(t,e,n)=>{var r=n(1465)(Object.keys,Object);t.exports=r},7115:t=>{t.exports=function(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}},2283:(t,e,n)=>{t=n.nmd(t);var r=n(7726),i=e&&!e.nodeType&&e,s=i&&t&&!t.nodeType&&t,o=s&&s.exports===i&&r.process,a=function(){try{var t=s&&s.require&&s.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=a},3388:t=>{var e=Object.prototype.toString;t.exports=function(t){return e.call(t)}},1465:t=>{t.exports=function(t,e){return function(n){return t(e(n))}}},9187:(t,e,n)=>{var r=n(1095),i=Math.max;t.exports=function(t,e,n){return e=i(void 0===e?t.length-1:e,0),function(){for(var s=arguments,o=-1,a=i(s.length-e,0),c=Array(a);++o<a;)c[o]=s[e+o];o=-1;for(var u=Array(e+1);++o<e;)u[o]=s[o];return u[e]=n(c),r(t,this,u)}}},1291:(t,e,n)=>{var r=n(576),i=n(4310);t.exports=function(t,e){return e.length<2?t:r(t,i(e,0,-1))}},6339:(t,e,n)=>{var r=n(7726),i="object"==typeof self&&self&&self.Object===Object&&self,s=r||i||Function("return this")();t.exports=s},3512:t=>{t.exports=function(t,e){if(("constructor"!==e||"function"!=typeof t[e])&&"__proto__"!=e)return t[e]}},2982:t=>{t.exports=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this}},6561:t=>{t.exports=function(t){return this.__data__.has(t)}},2209:t=>{t.exports=function(t){var e=-1,n=Array(t.size);return t.forEach((function(t){n[++e]=t})),n}},5607:(t,e,n)=>{var r=n(9240),i=n(7981)(r);t.exports=i},7981:t=>{var e=Date.now;t.exports=function(t){var n=0,r=0;return function(){var i=e(),s=16-(i-r);if(r=i,s>0){if(++n>=800)return arguments[0]}else n=0;return t.apply(void 0,arguments)}}},5762:(t,e,n)=>{var r=n(8081);t.exports=function(){this.__data__=new r,this.size=0}},4228:t=>{t.exports=function(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}},4999:t=>{t.exports=function(t){return this.__data__.get(t)}},9243:t=>{t.exports=function(t){return this.__data__.has(t)}},339:(t,e,n)=>{var r=n(8081),i=n(3485),s=n(2839);t.exports=function(t,e){var n=this.__data__;if(n instanceof r){var o=n.__data__;if(!i||o.length<199)return o.push([t,e]),this.size=++n.size,this;n=this.__data__=new s(o)}return n.set(t,e),this.size=n.size,this}},4197:t=>{t.exports=function(t,e,n){for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}},4114:(t,e,n)=>{var r=n(120),i=n(4572),s=n(2624);t.exports=function(t){return i(t)?s(t):r(t)}},5128:(t,e,n)=>{var r=n(4634),i=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,s=/\\(\\)?/g,o=r((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(i,(function(t,n,r,i){e.push(r?i.replace(s,"$1"):n||t)})),e}));t.exports=o},6123:(t,e,n)=>{var r=n(6516);t.exports=function(t){if("string"==typeof t||r(t))return t;var e=t+"";return"0"==e&&1/t==-1/0?"-0":e}},9751:t=>{var e=Function.prototype.toString;t.exports=function(t){if(null!=t){try{return e.call(t)}catch(t){}try{return t+""}catch(t){}}return""}},9474:t=>{var e=/\s/;t.exports=function(t){for(var n=t.length;n--&&e.test(t.charAt(n)););return n}},2624:t=>{var e="\\ud800-\\udfff",n="["+e+"]",r="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",i="\\ud83c[\\udffb-\\udfff]",s="[^"+e+"]",o="(?:\\ud83c[\\udde6-\\uddff]){2}",a="[\\ud800-\\udbff][\\udc00-\\udfff]",c="(?:"+r+"|"+i+")"+"?",u="[\\ufe0e\\ufe0f]?",l=u+c+("(?:\\u200d(?:"+[s,o,a].join("|")+")"+u+c+")*"),h="(?:"+[s+r+"?",r,o,a,n].join("|")+")",d=RegExp(i+"(?="+i+")|"+h+l,"g");t.exports=function(t){return t.match(d)||[]}},9927:t=>{var e="\\ud800-\\udfff",n="\\u2700-\\u27bf",r="a-z\\xdf-\\xf6\\xf8-\\xff",i="A-Z\\xc0-\\xd6\\xd8-\\xde",s="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",o="["+s+"]",a="\\d+",c="["+n+"]",u="["+r+"]",l="[^"+e+s+a+n+r+i+"]",h="(?:\\ud83c[\\udde6-\\uddff]){2}",d="[\\ud800-\\udbff][\\udc00-\\udfff]",p="["+i+"]",f="(?:"+u+"|"+l+")",g="(?:"+p+"|"+l+")",y="(?:['’](?:d|ll|m|re|s|t|ve))?",m="(?:['’](?:D|LL|M|RE|S|T|VE))?",b="(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?",v="[\\ufe0e\\ufe0f]?",w=v+b+("(?:\\u200d(?:"+["[^"+e+"]",h,d].join("|")+")"+v+b+")*"),S="(?:"+[c,h,d].join("|")+")"+w,E=RegExp([p+"?"+u+"+"+y+"(?="+[o,p,"$"].join("|")+")",g+"+"+m+"(?="+[o,p+f,"$"].join("|")+")",p+"?"+f+"+"+y,p+"+"+m,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",a,S].join("|"),"g");t.exports=function(t){return t.match(E)||[]}},7885:(t,e,n)=>{var r=n(1605),i=n(7713),s=n(461),o=n(7404),a=n(8421),c=n(9704),u=Object.prototype.hasOwnProperty,l=s((function(t,e){if(a(e)||o(e))i(e,c(e),t);else for(var n in e)u.call(e,n)&&r(t,n,e[n])}));t.exports=l},8692:(t,e,n)=>{var r=n(1962),i=n(2905)((function(t,e,n){return e=e.toLowerCase(),t+(n?r(e):e)}));t.exports=i},1962:(t,e,n)=>{var r=n(8324),i=n(5162);t.exports=function(t){return i(r(t).toLowerCase())}},6401:(t,e,n)=>{var r=n(7953);t.exports=function(t){return r(t,5)}},796:t=>{t.exports=function(t){return function(){return t}}},6298:(t,e,n)=>{var r=n(4865),i=n(8324),s=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,o=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g");t.exports=function(t){return(t=i(t))&&t.replace(s,r).replace(o,"")}},2458:t=>{t.exports=function(t,e){return t===e||t!=t&&e!=e}},5015:(t,e,n)=>{var r=n(4176)(n(4955));t.exports=r},4955:(t,e,n)=>{var r=n(5333),i=n(7371),s=n(1511),o=Math.max;t.exports=function(t,e,n){var a=null==t?0:t.length;if(!a)return-1;var c=null==n?0:s(n);return c<0&&(c=o(a+c,0)),r(t,i(e,3),c)}},6496:(t,e,n)=>{var r=n(2350);t.exports=function(t){return(null==t?0:t.length)?r(t,1):[]}},4590:(t,e,n)=>{var r=n(576);t.exports=function(t,e,n){var i=null==t?void 0:r(t,e);return void 0===i?n:i}},3176:(t,e,n)=>{var r=n(1826),i=n(3850),s=Object.prototype.hasOwnProperty,o=i((function(t,e,n){s.call(t,n)?t[n].push(e):r(t,n,[e])}));t.exports=o},3197:(t,e,n)=>{var r=n(9851),i=n(8888);t.exports=function(t,e){return null!=t&&i(t,e,r)}},5142:t=>{t.exports=function(t){return t}},6478:(t,e,n)=>{var r=n(1432),i=n(5116),s=Object.prototype,o=s.hasOwnProperty,a=s.propertyIsEnumerable,c=r(function(){return arguments}())?r:function(t){return i(t)&&o.call(t,"callee")&&!a.call(t,"callee")};t.exports=c},2963:t=>{var e=Array.isArray;t.exports=e},7404:(t,e,n)=>{var r=n(2836),i=n(3436);t.exports=function(t){return null!=t&&i(t.length)&&!r(t)}},4171:(t,e,n)=>{var r=n(7404),i=n(5116);t.exports=function(t){return i(t)&&r(t)}},734:(t,e,n)=>{t=n.nmd(t);var r=n(6339),i=n(1101),s=e&&!e.nodeType&&e,o=s&&t&&!t.nodeType&&t,a=o&&o.exports===s?r.Buffer:void 0,c=(a?a.isBuffer:void 0)||i;t.exports=c},187:(t,e,n)=>{var r=n(8314),i=n(4471),s=n(6478),o=n(2963),a=n(7404),c=n(734),u=n(8421),l=n(1621),h=Object.prototype.hasOwnProperty;t.exports=function(t){if(null==t)return!0;if(a(t)&&(o(t)||"string"==typeof t||"function"==typeof t.splice||c(t)||l(t)||s(t)))return!t.length;var e=i(t);if("[object Map]"==e||"[object Set]"==e)return!t.size;if(u(t))return!r(t).length;for(var n in t)if(h.call(t,n))return!1;return!0}},702:(t,e,n)=>{var r=n(4584);t.exports=function(t,e){return r(t,e)}},9767:(t,e,n)=>{var r=n(6339).isFinite;t.exports=function(t){return"number"==typeof t&&r(t)}},2836:(t,e,n)=>{var r=n(4890),i=n(3667);t.exports=function(t){if(!i(t))return!1;var e=r(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e}},3436:t=>{t.exports=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991}},6596:(t,e,n)=>{var r=n(2454),i=n(8859),s=n(2283),o=s&&s.isMap,a=o?i(o):r;t.exports=a},577:t=>{t.exports=function(t){return null==t}},3667:t=>{t.exports=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}},5116:t=>{t.exports=function(t){return null!=t&&"object"==typeof t}},8841:(t,e,n)=>{var r=n(4890),i=n(2929),s=n(5116),o=Function.prototype,a=Object.prototype,c=o.toString,u=a.hasOwnProperty,l=c.call(Object);t.exports=function(t){if(!s(t)||"[object Object]"!=r(t))return!1;var e=i(t);if(null===e)return!0;var n=u.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==l}},7037:(t,e,n)=>{var r=n(3363),i=n(8859),s=n(2283),o=s&&s.isRegExp,a=o?i(o):r;t.exports=a},934:(t,e,n)=>{var r=n(8516),i=n(8859),s=n(2283),o=s&&s.isSet,a=o?i(o):r;t.exports=a},5853:(t,e,n)=>{var r=n(4890),i=n(2963),s=n(5116);t.exports=function(t){return"string"==typeof t||!i(t)&&s(t)&&"[object String]"==r(t)}},6516:(t,e,n)=>{var r=n(4890),i=n(5116);t.exports=function(t){return"symbol"==typeof t||i(t)&&"[object Symbol]"==r(t)}},1621:(t,e,n)=>{var r=n(5963),i=n(8859),s=n(2283),o=s&&s.isTypedArray,a=o?i(o):r;t.exports=a},9704:(t,e,n)=>{var r=n(2081),i=n(8314),s=n(7404);t.exports=function(t){return s(t)?r(t):i(t)}},5255:(t,e,n)=>{var r=n(2081),i=n(4845),s=n(7404);t.exports=function(t){return s(t)?r(t,!0):i(t)}},1672:t=>{t.exports=function(t){var e=null==t?0:t.length;return e?t[e-1]:void 0}},7196:(t,e,n)=>{var r=n(7953),i=n(725);t.exports=function(t){return i(r(t,1))}},3553:(t,e,n)=>{var r=n(6167),i=n(5142);t.exports=function(t){return r(t,i)}},2902:(t,e,n)=>{var r=n(2839);function i(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],s=n.cache;if(s.has(i))return s.get(i);var o=t.apply(this,r);return n.cache=s.set(i,o)||s,o};return n.cache=new(i.Cache||r),n}i.Cache=r,t.exports=i},8498:(t,e,n)=>{var r=n(384),i=n(461)((function(t,e,n){r(t,e,n)}));t.exports=i},3214:(t,e,n)=>{var r=n(384),i=n(461)((function(t,e,n,i){r(t,e,n,i)}));t.exports=i},2340:t=>{t.exports=function(){}},6233:(t,e,n)=>{var r=n(7326),i=n(7953),s=n(3881),o=n(3315),a=n(7713),c=n(8252),u=n(2854),l=n(8367),h=u((function(t,e){var n={};if(null==t)return n;var u=!1;e=r(e,(function(e){return e=o(e,t),u||(u=e.length>1),e})),a(t,l(t),n),u&&(n=i(n,7,c));for(var h=e.length;h--;)s(n,e[h]);return n}));t.exports=h},9169:(t,e,n)=>{var r=n(7923),i=n(2854)((function(t,e){return null==t?{}:r(t,e)}));t.exports=i},3589:(t,e,n)=>{var r=n(9219),i=n(1165),s=n(4352),o=n(6123);t.exports=function(t){return s(t)?r(o(t)):i(t)}},7595:(t,e,n)=>{var r=n(385),i=n(6062),s=n(8494),o=parseFloat,a=Math.min,c=Math.random;t.exports=function(t,e,n){if(n&&"boolean"!=typeof n&&i(t,e,n)&&(e=n=void 0),void 0===n&&("boolean"==typeof e?(n=e,e=void 0):"boolean"==typeof t&&(n=t,t=void 0)),void 0===t&&void 0===e?(t=0,e=1):(t=s(t),void 0===e?(e=t,t=0):e=s(e)),t>e){var u=t;t=e,e=u}if(n||t%1||e%1){var l=c();return a(t+l*(e-t+o("1e-"+((l+"").length-1))),e)}return r(t,e)}},5604:(t,e,n)=>{var r=n(7371),i=n(2764);t.exports=function(t,e){var n=[];if(!t||!t.length)return n;var s=-1,o=[],a=t.length;for(e=r(e,3);++s<a;){var c=t[s];e(c,s,t)&&(n.push(c),o.push(s))}return i(t,o),n}},7155:(t,e,n)=>{var r=n(7209),i=n(6062),s=n(1511),o=n(8324);t.exports=function(t,e,n){return e=(n?i(t,e,n):void 0===e)?1:s(e),r(o(t),e)}},4950:(t,e,n)=>{var r=n(2905)((function(t,e,n){return t+(n?"_":"")+e.toLowerCase()}));t.exports=r},689:(t,e,n)=>{var r=n(2350),i=n(1537),s=n(8464),o=n(6062),a=s((function(t,e){if(null==t)return[];var n=e.length;return n>1&&o(t,e[0],e[1])?e=[]:n>2&&o(e[0],e[1],e[2])&&(e=[e[0]]),i(t,r(e,1),[])}));t.exports=a},6567:t=>{t.exports=function(){return[]}},1101:t=>{t.exports=function(){return!1}},8494:(t,e,n)=>{var r=n(1552),i=1/0;t.exports=function(t){return t?(t=r(t))===i||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}},1511:(t,e,n)=>{var r=n(8494);t.exports=function(t){var e=r(t),n=e%1;return e==e?n?e-n:e:0}},1552:(t,e,n)=>{var r=n(9006),i=n(3667),s=n(6516),o=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt;t.exports=function(t){if("number"==typeof t)return t;if(s(t))return NaN;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=r(t);var n=a.test(t);return n||c.test(t)?u(t.slice(2),n?2:8):o.test(t)?NaN:+t}},2058:(t,e,n)=>{var r=n(7713),i=n(5255);t.exports=function(t){return r(t,i(t))}},8324:(t,e,n)=>{var r=n(3410);t.exports=function(t){return null==t?"":r(t)}},1558:(t,e,n)=>{var r=n(6171),i=n(1098),s=n(8251),o=n(7371),a=n(2929),c=n(2963),u=n(734),l=n(2836),h=n(3667),d=n(1621);t.exports=function(t,e,n){var p=c(t),f=p||u(t)||d(t);if(e=o(e,4),null==n){var g=t&&t.constructor;n=f?p?new g:[]:h(t)&&l(g)?i(a(t)):{}}return(f?r:s)(t,(function(t,r,i){return e(n,t,r,i)})),n}},7253:(t,e,n)=>{var r=n(8675);t.exports=function(t){return t&&t.length?r(t):[]}},3977:(t,e,n)=>{var r=n(8675);t.exports=function(t,e){return e="function"==typeof e?e:void 0,t&&t.length?r(t,void 0,e):[]}},4187:(t,e,n)=>{var r=n(3881);t.exports=function(t,e){return null==t||r(t,e)}},2616:(t,e,n)=>{var r=n(7704),i=n(7326),s=n(9219),o=n(3778),a=n(4171),c=Math.max;t.exports=function(t){if(!t||!t.length)return[];var e=0;return t=r(t,(function(t){if(a(t))return e=c(t.length,e),!0})),o(e,(function(e){return i(t,s(e))}))}},5162:(t,e,n)=>{var r=n(7325)("toUpperCase");t.exports=r},5019:(t,e,n)=>{var r=n(9695),i=n(3536),s=n(8324),o=n(9927);t.exports=function(t,e,n){return t=s(t),void 0===(e=n?void 0:e)?i(t)?o(t):r(t):t.match(e)||[]}},1997:(t,e,n)=>{var r=n(8464)(n(2616));t.exports=r},7884:t=>{t.exports=function t(e,n,r){function i(o,a){if(!n[o]){if(!e[o]){if(s)return s(o,!0);throw new Error("Cannot find module '"+o+"'")}a=n[o]={exports:{}},e[o][0].call(a.exports,(function(t){return i(e[o][1][t]||t)}),a,a.exports,t,e,n,r)}return n[o].exports}for(var s=void 0,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(t,e,n){(function(r,i,s,o,a,c,u,l,h){"use strict";var d=t("crypto");function p(t,e){var n;return void 0===(n="passthrough"!==(e=y(t,e)).algorithm?d.createHash(e.algorithm):new v).write&&(n.write=n.update,n.end=n.update),b(e,n).dispatch(t),n.update||n.end(""),n.digest?n.digest("buffer"===e.encoding?void 0:e.encoding):(t=n.read(),"buffer"!==e.encoding?t.toString(e.encoding):t)}(n=e.exports=p).sha1=function(t){return p(t)},n.keys=function(t){return p(t,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},n.MD5=function(t){return p(t,{algorithm:"md5",encoding:"hex"})},n.keysMD5=function(t){return p(t,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var f=d.getHashes?d.getHashes().slice():["sha1","md5"],g=(f.push("passthrough"),["buffer","hex","binary","base64"]);function y(t,e){var n={};if(n.algorithm=(e=e||{}).algorithm||"sha1",n.encoding=e.encoding||"hex",n.excludeValues=!!e.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=!0===e.ignoreUnknown,n.respectType=!1!==e.respectType,n.respectFunctionNames=!1!==e.respectFunctionNames,n.respectFunctionProperties=!1!==e.respectFunctionProperties,n.unorderedArrays=!0===e.unorderedArrays,n.unorderedSets=!1!==e.unorderedSets,n.unorderedObjects=!1!==e.unorderedObjects,n.replacer=e.replacer||void 0,n.excludeKeys=e.excludeKeys||void 0,void 0===t)throw new Error("Object argument required.");for(var r=0;r<f.length;++r)f[r].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=f[r]);if(-1===f.indexOf(n.algorithm))throw new Error('Algorithm "'+n.algorithm+'"  not supported. supported values: '+f.join(", "));if(-1===g.indexOf(n.encoding)&&"passthrough"!==n.algorithm)throw new Error('Encoding "'+n.encoding+'"  not supported. supported values: '+g.join(", "));return n}function m(t){if("function"==typeof t)return null!=/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(t))}function b(t,e,n){function r(t){return e.update?e.update(t,"utf8"):e.write(t,"utf8")}return n=n||[],{dispatch:function(e){return this["_"+(null===(e=t.replacer?t.replacer(e):e)?"null":typeof e)](e)},_object:function(e){var i,o=Object.prototype.toString.call(e),a=/\[object (.*)\]/i.exec(o);if(a=(a=a?a[1]:"unknown:["+o+"]").toLowerCase(),0<=(o=n.indexOf(e)))return this.dispatch("[CIRCULAR:"+o+"]");if(n.push(e),void 0!==s&&s.isBuffer&&s.isBuffer(e))return r("buffer:"),r(e);if("object"===a||"function"===a||"asyncfunction"===a)return o=Object.keys(e),t.unorderedObjects&&(o=o.sort()),!1===t.respectType||m(e)||o.splice(0,0,"prototype","__proto__","constructor"),t.excludeKeys&&(o=o.filter((function(e){return!t.excludeKeys(e)}))),r("object:"+o.length+":"),i=this,o.forEach((function(n){i.dispatch(n),r(":"),t.excludeValues||i.dispatch(e[n]),r(",")}));if(!this["_"+a]){if(t.ignoreUnknown)return r("["+a+"]");throw new Error('Unknown object type "'+a+'"')}this["_"+a](e)},_array:function(e,i){i=void 0!==i?i:!1!==t.unorderedArrays;var s=this;if(r("array:"+e.length+":"),!i||e.length<=1)return e.forEach((function(t){return s.dispatch(t)}));var o=[];return i=e.map((function(e){var r=new v,i=n.slice();return b(t,r,i).dispatch(e),o=o.concat(i.slice(n.length)),r.read().toString()})),n=n.concat(o),i.sort(),this._array(i,!1)},_date:function(t){return r("date:"+t.toJSON())},_symbol:function(t){return r("symbol:"+t.toString())},_error:function(t){return r("error:"+t.toString())},_boolean:function(t){return r("bool:"+t.toString())},_string:function(t){r("string:"+t.length+":"),r(t.toString())},_function:function(e){r("fn:"),m(e)?this.dispatch("[native]"):this.dispatch(e.toString()),!1!==t.respectFunctionNames&&this.dispatch("function-name:"+String(e.name)),t.respectFunctionProperties&&this._object(e)},_number:function(t){return r("number:"+t.toString())},_xml:function(t){return r("xml:"+t.toString())},_null:function(){return r("Null")},_undefined:function(){return r("Undefined")},_regexp:function(t){return r("regex:"+t.toString())},_uint8array:function(t){return r("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint8clampedarray:function(t){return r("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},_int8array:function(t){return r("int8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint16array:function(t){return r("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_int16array:function(t){return r("int16array:"),this.dispatch(Array.prototype.slice.call(t))},_uint32array:function(t){return r("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_int32array:function(t){return r("int32array:"),this.dispatch(Array.prototype.slice.call(t))},_float32array:function(t){return r("float32array:"),this.dispatch(Array.prototype.slice.call(t))},_float64array:function(t){return r("float64array:"),this.dispatch(Array.prototype.slice.call(t))},_arraybuffer:function(t){return r("arraybuffer:"),this.dispatch(new Uint8Array(t))},_url:function(t){return r("url:"+t.toString())},_map:function(e){return r("map:"),e=Array.from(e),this._array(e,!1!==t.unorderedSets)},_set:function(e){return r("set:"),e=Array.from(e),this._array(e,!1!==t.unorderedSets)},_file:function(t){return r("file:"),this.dispatch([t.name,t.size,t.type,t.lastModfied])},_blob:function(){if(t.ignoreUnknown)return r("[blob]");throw Error('Hashing Blob objects is currently not supported\n(see https://github.com/puleos/object-hash/issues/26)\nUse "options.replacer" or "options.ignoreUnknown"\n')},_domwindow:function(){return r("domwindow")},_bigint:function(t){return r("bigint:"+t.toString())},_process:function(){return r("process")},_timer:function(){return r("timer")},_pipe:function(){return r("pipe")},_tcp:function(){return r("tcp")},_udp:function(){return r("udp")},_tty:function(){return r("tty")},_statwatcher:function(){return r("statwatcher")},_securecontext:function(){return r("securecontext")},_connection:function(){return r("connection")},_zlib:function(){return r("zlib")},_context:function(){return r("context")},_nodescript:function(){return r("nodescript")},_httpparser:function(){return r("httpparser")},_dataview:function(){return r("dataview")},_signal:function(){return r("signal")},_fsevent:function(){return r("fsevent")},_tlswrap:function(){return r("tlswrap")}}}function v(){return{buf:"",write:function(t){this.buf+=t},end:function(t){this.buf+=t},read:function(){return this.buf}}}n.writeToStream=function(t,e,n){return void 0===n&&(n=e,e={}),b(e=y(t,e),n).dispatch(t)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(t,e,n){(function(t,e,r,i,s,o,a,c,u){!function(t){"use strict";var e="undefined"!=typeof Uint8Array?Uint8Array:Array,n="+".charCodeAt(0),r="/".charCodeAt(0),i="0".charCodeAt(0),s="a".charCodeAt(0),o="A".charCodeAt(0),a="-".charCodeAt(0),c="_".charCodeAt(0);function u(t){return(t=t.charCodeAt(0))===n||t===a?62:t===r||t===c?63:t<i?-1:t<i+10?t-i+26+26:t<o+26?t-o:t<s+26?t-s+26:void 0}t.toByteArray=function(t){var n,r;if(0<t.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var i=t.length,s=(i="="===t.charAt(i-2)?2:"="===t.charAt(i-1)?1:0,new e(3*t.length/4-i)),o=0<i?t.length-4:t.length,a=0;function c(t){s[a++]=t}for(n=0;n<o;n+=4,0)c((16711680&(r=u(t.charAt(n))<<18|u(t.charAt(n+1))<<12|u(t.charAt(n+2))<<6|u(t.charAt(n+3))))>>16),c((65280&r)>>8),c(255&r);return 2==i?c(255&(r=u(t.charAt(n))<<2|u(t.charAt(n+1))>>4)):1==i&&(c((r=u(t.charAt(n))<<10|u(t.charAt(n+1))<<4|u(t.charAt(n+2))>>2)>>8&255),c(255&r)),s},t.fromByteArray=function(t){var e,n,r,i,s=t.length%3,o="";function a(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,r=t.length-s;e<r;e+=3)o+=a((i=n=(t[e]<<16)+(t[e+1]<<8)+t[e+2])>>18&63)+a(i>>12&63)+a(i>>6&63)+a(63&i);switch(s){case 1:o=(o+=a((n=t[t.length-1])>>2))+a(n<<4&63)+"==";break;case 2:o=(o=(o+=a((n=(t[t.length-2]<<8)+t[t.length-1])>>10))+a(n>>4&63))+a(n<<2&63)+"="}return o}}(void 0===n?this.base64js={}:n)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(t,e,n){(function(e,r,i,s,o,a,c,u,l){var h=t("base64-js"),d=t("ieee754");function i(t,e,n){if(!(this instanceof i))return new i(t,e,n);var r,s,o,a,c=typeof t;if("base64"===e&&"string"==c)for(t=(a=t).trim?a.trim():a.replace(/^\s+|\s+$/g,"");t.length%4!=0;)t+="=";if("number"==c)r=A(t);else if("string"==c)r=i.byteLength(t,e);else{if("object"!=c)throw new Error("First argument needs to be a number, array or string.");r=A(t.length)}if(i._useTypedArrays?s=i._augment(new Uint8Array(r)):((s=this).length=r,s._isBuffer=!0),i._useTypedArrays&&"number"==typeof t.byteLength)s._set(t);else if(x(a=t)||i.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length)for(o=0;o<r;o++)i.isBuffer(t)?s[o]=t.readUInt8(o):s[o]=t[o];else if("string"==c)s.write(t,0,e);else if("number"==c&&!i._useTypedArrays&&!n)for(o=0;o<r;o++)s[o]=0;return s}function p(t,e,n,r){return i._charsWritten=D(function(t){for(var e=[],n=0;n<t.length;n++)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function f(t,e,n,r){return i._charsWritten=D(function(t){for(var e,n,r=[],i=0;i<t.length;i++)e=(n=t.charCodeAt(i))>>8,n%=256,r.push(n),r.push(e);return r}(e),t,n,r)}function g(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;i++)r+=String.fromCharCode(t[i]);return r}function y(t,e,n,r){var i;if(r||(U("boolean"==typeof n,"missing or invalid endian"),U(null!=e,"missing offset"),U(e+1<t.length,"Trying to read beyond buffer length")),!((r=t.length)<=e))return n?(i=t[e],e+1<r&&(i|=t[e+1]<<8)):(i=t[e]<<8,e+1<r&&(i|=t[e+1])),i}function m(t,e,n,r){var i;if(r||(U("boolean"==typeof n,"missing or invalid endian"),U(null!=e,"missing offset"),U(e+3<t.length,"Trying to read beyond buffer length")),!((r=t.length)<=e))return n?(e+2<r&&(i=t[e+2]<<16),e+1<r&&(i|=t[e+1]<<8),i|=t[e],e+3<r&&(i+=t[e+3]<<24>>>0)):(e+1<r&&(i=t[e+1]<<16),e+2<r&&(i|=t[e+2]<<8),e+3<r&&(i|=t[e+3]),i+=t[e]<<24>>>0),i}function b(t,e,n,r){if(r||(U("boolean"==typeof n,"missing or invalid endian"),U(null!=e,"missing offset"),U(e+1<t.length,"Trying to read beyond buffer length")),!(t.length<=e))return 32768&(r=y(t,e,n,!0))?-1*(65535-r+1):r}function v(t,e,n,r){if(r||(U("boolean"==typeof n,"missing or invalid endian"),U(null!=e,"missing offset"),U(e+3<t.length,"Trying to read beyond buffer length")),!(t.length<=e))return 2147483648&(r=m(t,e,n,!0))?-1*(4294967295-r+1):r}function w(t,e,n,r){return r||(U("boolean"==typeof n,"missing or invalid endian"),U(e+3<t.length,"Trying to read beyond buffer length")),d.read(t,e,n,23,4)}function S(t,e,n,r){return r||(U("boolean"==typeof n,"missing or invalid endian"),U(e+7<t.length,"Trying to read beyond buffer length")),d.read(t,e,n,52,8)}function E(t,e,n,r,i){if(i||(U(null!=e,"missing value"),U("boolean"==typeof r,"missing or invalid endian"),U(null!=n,"missing offset"),U(n+1<t.length,"trying to write beyond buffer length"),B(e,65535)),!((i=t.length)<=n))for(var s=0,o=Math.min(i-n,2);s<o;s++)t[n+s]=(e&255<<8*(r?s:1-s))>>>8*(r?s:1-s)}function _(t,e,n,r,i){if(i||(U(null!=e,"missing value"),U("boolean"==typeof r,"missing or invalid endian"),U(null!=n,"missing offset"),U(n+3<t.length,"trying to write beyond buffer length"),B(e,4294967295)),!((i=t.length)<=n))for(var s=0,o=Math.min(i-n,4);s<o;s++)t[n+s]=e>>>8*(r?s:3-s)&255}function C(t,e,n,r,i){i||(U(null!=e,"missing value"),U("boolean"==typeof r,"missing or invalid endian"),U(null!=n,"missing offset"),U(n+1<t.length,"Trying to write beyond buffer length"),F(e,32767,-32768)),t.length<=n||E(t,0<=e?e:65535+e+1,n,r,i)}function T(t,e,n,r,i){i||(U(null!=e,"missing value"),U("boolean"==typeof r,"missing or invalid endian"),U(null!=n,"missing offset"),U(n+3<t.length,"Trying to write beyond buffer length"),F(e,2147483647,-2147483648)),t.length<=n||_(t,0<=e?e:4294967295+e+1,n,r,i)}function I(t,e,n,r,i){i||(U(null!=e,"missing value"),U("boolean"==typeof r,"missing or invalid endian"),U(null!=n,"missing offset"),U(n+3<t.length,"Trying to write beyond buffer length"),j(e,34028234663852886e22,-34028234663852886e22)),t.length<=n||d.write(t,e,n,r,23,4)}function N(t,e,n,r,i){i||(U(null!=e,"missing value"),U("boolean"==typeof r,"missing or invalid endian"),U(null!=n,"missing offset"),U(n+7<t.length,"Trying to write beyond buffer length"),j(e,17976931348623157e292,-17976931348623157e292)),t.length<=n||d.write(t,e,n,r,52,8)}n.Buffer=i,n.SlowBuffer=i,n.INSPECT_MAX_BYTES=50,i.poolSize=8192,i._useTypedArrays=function(){try{var t=new ArrayBuffer(0),e=new Uint8Array(t);return e.foo=function(){return 42},42===e.foo()&&"function"==typeof e.subarray}catch(t){return!1}}(),i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.isBuffer=function(t){return!(null==t||!t._isBuffer)},i.byteLength=function(t,e){var n;switch(t+="",e||"utf8"){case"hex":n=t.length/2;break;case"utf8":case"utf-8":n=k(t).length;break;case"ascii":case"binary":case"raw":n=t.length;break;case"base64":n=L(t).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":n=2*t.length;break;default:throw new Error("Unknown encoding")}return n},i.concat=function(t,e){if(U(x(t),"Usage: Buffer.concat(list, [totalLength])\nlist should be an Array."),0===t.length)return new i(0);if(1===t.length)return t[0];if("number"!=typeof e)for(s=e=0;s<t.length;s++)e+=t[s].length;for(var n=new i(e),r=0,s=0;s<t.length;s++){var o=t[s];o.copy(n,r),r+=o.length}return n},i.prototype.write=function(t,e,n,r){isFinite(e)?isFinite(n)||(r=n,n=void 0):(u=r,r=e,e=n,n=u),e=Number(e)||0;var s,o,a,c,u=this.length-e;switch((!n||u<(n=Number(n)))&&(n=u),r=String(r||"utf8").toLowerCase()){case"hex":s=function(t,e,n,r){n=Number(n)||0;var s=t.length-n;(!r||s<(r=Number(r)))&&(r=s),U((s=e.length)%2==0,"Invalid hex string"),s/2<r&&(r=s/2);for(var o=0;o<r;o++){var a=parseInt(e.substr(2*o,2),16);U(!isNaN(a),"Invalid hex string"),t[n+o]=a}return i._charsWritten=2*o,o}(this,t,e,n);break;case"utf8":case"utf-8":o=this,a=e,c=n,s=i._charsWritten=D(k(t),o,a,c);break;case"ascii":case"binary":s=p(this,t,e,n);break;case"base64":o=this,a=e,c=n,s=i._charsWritten=D(L(t),o,a,c);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":s=f(this,t,e,n);break;default:throw new Error("Unknown encoding")}return s},i.prototype.toString=function(t,e,n){var r,i,s,o,a=this;if(t=String(t||"utf8").toLowerCase(),e=Number(e)||0,(n=void 0!==n?Number(n):a.length)===e)return"";switch(t){case"hex":r=function(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||r<n)&&(n=r);for(var i="",s=e;s<n;s++)i+=P(t[s]);return i}(a,e,n);break;case"utf8":case"utf-8":r=function(t,e,n){var r="",i="";n=Math.min(t.length,n);for(var s=e;s<n;s++)t[s]<=127?(r+=M(i)+String.fromCharCode(t[s]),i=""):i+="%"+t[s].toString(16);return r+M(i)}(a,e,n);break;case"ascii":case"binary":r=g(a,e,n);break;case"base64":i=a,o=n,r=0===(s=e)&&o===i.length?h.fromByteArray(i):h.fromByteArray(i.slice(s,o));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":r=function(t,e,n){for(var r=t.slice(e,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}(a,e,n);break;default:throw new Error("Unknown encoding")}return r},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},i.prototype.copy=function(t,e,n,r){if(e=e||0,(r=r||0===r?r:this.length)!==(n=n||0)&&0!==t.length&&0!==this.length){U(n<=r,"sourceEnd < sourceStart"),U(0<=e&&e<t.length,"targetStart out of bounds"),U(0<=n&&n<this.length,"sourceStart out of bounds"),U(0<=r&&r<=this.length,"sourceEnd out of bounds"),r>this.length&&(r=this.length);var s=(r=t.length-e<r-n?t.length-e+n:r)-n;if(s<100||!i._useTypedArrays)for(var o=0;o<s;o++)t[o+e]=this[o+n];else t._set(this.subarray(n,n+s),e)}},i.prototype.slice=function(t,e){var n=this.length;if(t=O(t,n,0),e=O(e,n,n),i._useTypedArrays)return i._augment(this.subarray(t,e));for(var r=e-t,s=new i(r,void 0,!0),o=0;o<r;o++)s[o]=this[o+t];return s},i.prototype.get=function(t){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(t)},i.prototype.set=function(t,e){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(t,e)},i.prototype.readUInt8=function(t,e){if(e||(U(null!=t,"missing offset"),U(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return this[t]},i.prototype.readUInt16LE=function(t,e){return y(this,t,!0,e)},i.prototype.readUInt16BE=function(t,e){return y(this,t,!1,e)},i.prototype.readUInt32LE=function(t,e){return m(this,t,!0,e)},i.prototype.readUInt32BE=function(t,e){return m(this,t,!1,e)},i.prototype.readInt8=function(t,e){if(e||(U(null!=t,"missing offset"),U(t<this.length,"Trying to read beyond buffer length")),!(t>=this.length))return 128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){return b(this,t,!0,e)},i.prototype.readInt16BE=function(t,e){return b(this,t,!1,e)},i.prototype.readInt32LE=function(t,e){return v(this,t,!0,e)},i.prototype.readInt32BE=function(t,e){return v(this,t,!1,e)},i.prototype.readFloatLE=function(t,e){return w(this,t,!0,e)},i.prototype.readFloatBE=function(t,e){return w(this,t,!1,e)},i.prototype.readDoubleLE=function(t,e){return S(this,t,!0,e)},i.prototype.readDoubleBE=function(t,e){return S(this,t,!1,e)},i.prototype.writeUInt8=function(t,e,n){n||(U(null!=t,"missing value"),U(null!=e,"missing offset"),U(e<this.length,"trying to write beyond buffer length"),B(t,255)),e>=this.length||(this[e]=t)},i.prototype.writeUInt16LE=function(t,e,n){E(this,t,e,!0,n)},i.prototype.writeUInt16BE=function(t,e,n){E(this,t,e,!1,n)},i.prototype.writeUInt32LE=function(t,e,n){_(this,t,e,!0,n)},i.prototype.writeUInt32BE=function(t,e,n){_(this,t,e,!1,n)},i.prototype.writeInt8=function(t,e,n){n||(U(null!=t,"missing value"),U(null!=e,"missing offset"),U(e<this.length,"Trying to write beyond buffer length"),F(t,127,-128)),e>=this.length||(0<=t?this.writeUInt8(t,e,n):this.writeUInt8(255+t+1,e,n))},i.prototype.writeInt16LE=function(t,e,n){C(this,t,e,!0,n)},i.prototype.writeInt16BE=function(t,e,n){C(this,t,e,!1,n)},i.prototype.writeInt32LE=function(t,e,n){T(this,t,e,!0,n)},i.prototype.writeInt32BE=function(t,e,n){T(this,t,e,!1,n)},i.prototype.writeFloatLE=function(t,e,n){I(this,t,e,!0,n)},i.prototype.writeFloatBE=function(t,e,n){I(this,t,e,!1,n)},i.prototype.writeDoubleLE=function(t,e,n){N(this,t,e,!0,n)},i.prototype.writeDoubleBE=function(t,e,n){N(this,t,e,!1,n)},i.prototype.fill=function(t,e,n){if(e=e||0,n=n||this.length,U("number"==typeof(t="string"==typeof(t=t||0)?t.charCodeAt(0):t)&&!isNaN(t),"value is not a number"),U(e<=n,"end < start"),n!==e&&0!==this.length){U(0<=e&&e<this.length,"start out of bounds"),U(0<=n&&n<=this.length,"end out of bounds");for(var r=e;r<n;r++)this[r]=t}},i.prototype.inspect=function(){for(var t=[],e=this.length,r=0;r<e;r++)if(t[r]=P(this[r]),r===n.INSPECT_MAX_BYTES){t[r+1]="...";break}return"<Buffer "+t.join(" ")+">"},i.prototype.toArrayBuffer=function(){if("undefined"==typeof Uint8Array)throw new Error("Buffer.toArrayBuffer not supported in this browser");if(i._useTypedArrays)return new i(this).buffer;for(var t=new Uint8Array(this.length),e=0,n=t.length;e<n;e+=1)t[e]=this[e];return t.buffer};var R=i.prototype;function O(t,e,n){return"number"!=typeof t?n:e<=(t=~~t)?e:0<=t||0<=(t+=e)?t:0}function A(t){return(t=~~Math.ceil(+t))<0?0:t}function x(t){return(Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)})(t)}function P(t){return t<16?"0"+t.toString(16):t.toString(16)}function k(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(t.charCodeAt(n));else for(var i=n,s=(55296<=r&&r<=57343&&n++,encodeURIComponent(t.slice(i,n+1)).substr(1).split("%")),o=0;o<s.length;o++)e.push(parseInt(s[o],16))}return e}function L(t){return h.toByteArray(t)}function D(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);i++)e[i+n]=t[i];return i}function M(t){try{return decodeURIComponent(t)}catch(t){return String.fromCharCode(65533)}}function B(t,e){U("number"==typeof t,"cannot write a non-number as a number"),U(0<=t,"specified a negative value for writing an unsigned value"),U(t<=e,"value is larger than maximum value for type"),U(Math.floor(t)===t,"value has a fractional component")}function F(t,e,n){U("number"==typeof t,"cannot write a non-number as a number"),U(t<=e,"value larger than maximum allowed value"),U(n<=t,"value smaller than minimum allowed value"),U(Math.floor(t)===t,"value has a fractional component")}function j(t,e,n){U("number"==typeof t,"cannot write a non-number as a number"),U(t<=e,"value larger than maximum allowed value"),U(n<=t,"value smaller than minimum allowed value")}function U(t,e){if(!t)throw new Error(e||"Failed assertion")}i._augment=function(t){return t._isBuffer=!0,t._get=t.get,t._set=t.set,t.get=R.get,t.set=R.set,t.write=R.write,t.toString=R.toString,t.toLocaleString=R.toString,t.toJSON=R.toJSON,t.copy=R.copy,t.slice=R.slice,t.readUInt8=R.readUInt8,t.readUInt16LE=R.readUInt16LE,t.readUInt16BE=R.readUInt16BE,t.readUInt32LE=R.readUInt32LE,t.readUInt32BE=R.readUInt32BE,t.readInt8=R.readInt8,t.readInt16LE=R.readInt16LE,t.readInt16BE=R.readInt16BE,t.readInt32LE=R.readInt32LE,t.readInt32BE=R.readInt32BE,t.readFloatLE=R.readFloatLE,t.readFloatBE=R.readFloatBE,t.readDoubleLE=R.readDoubleLE,t.readDoubleBE=R.readDoubleBE,t.writeUInt8=R.writeUInt8,t.writeUInt16LE=R.writeUInt16LE,t.writeUInt16BE=R.writeUInt16BE,t.writeUInt32LE=R.writeUInt32LE,t.writeUInt32BE=R.writeUInt32BE,t.writeInt8=R.writeInt8,t.writeInt16LE=R.writeInt16LE,t.writeInt16BE=R.writeInt16BE,t.writeInt32LE=R.writeInt32LE,t.writeInt32BE=R.writeInt32BE,t.writeFloatLE=R.writeFloatLE,t.writeFloatBE=R.writeFloatBE,t.writeDoubleLE=R.writeDoubleLE,t.writeDoubleBE=R.writeDoubleBE,t.fill=R.fill,t.inspect=R.inspect,t.toArrayBuffer=R.toArrayBuffer,t}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(t,e,n){(function(n,r,i,s,o,a,c,u,l){i=t("buffer").Buffer;var h=4,d=new i(h);d.fill(0),e.exports={hash:function(t,e,n,r){for(var s=e(function(t,e){t.length%h!=0&&(n=t.length+(h-t.length%h),t=i.concat([t,d],n));for(var n,r=[],s=e?t.readInt32BE:t.readInt32LE,o=0;o<t.length;o+=h)r.push(s.call(t,o));return r}(t=i.isBuffer(t)?t:new i(t),r),8*t.length),o=(e=r,new i(n)),a=e?o.writeInt32BE:o.writeInt32LE,c=0;c<s.length;c++)a.call(o,s[c],4*c,!0);return o}}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(t,e,n){(function(e,r,i,s,o,a,c,u,l){i=t("buffer").Buffer;var h=t("./sha"),d=t("./sha256"),p=t("./rng"),f={sha1:h,sha256:d,md5:t("./md5")},g=64,y=new i(g);function m(t,e){var n=f[t=t||"sha1"],r=[];return n||b("algorithm:",t,"is not yet supported"),{update:function(t){return i.isBuffer(t)||(t=new i(t)),r.push(t),t.length,this},digest:function(t){var s=i.concat(r);return s=e?function(t,e,n){i.isBuffer(e)||(e=new i(e)),i.isBuffer(n)||(n=new i(n)),e.length>g?e=t(e):e.length<g&&(e=i.concat([e,y],g));for(var r=new i(g),s=new i(g),o=0;o<g;o++)r[o]=54^e[o],s[o]=92^e[o];return n=t(i.concat([r,n])),t(i.concat([s,n]))}(n,e,s):n(s),r=null,t?s.toString(t):s}}}function b(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}y.fill(0),n.createHash=function(t){return m(t)},n.createHmac=m,n.randomBytes=function(t,e){if(!e||!e.call)return new i(p(t));try{e.call(this,void 0,new i(p(t)))}catch(t){e(t)}};var v,w=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(t){n[t]=function(){b("sorry,",t,"is not implemented yet")}};for(v in w)S(w[v],v)}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(t,e,n){(function(n,r,i,s,o,a,c,u,l){var h=t("./helpers");function d(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,r=-271733879,i=-1732584194,s=271733878,o=0;o<t.length;o+=16){var a=n,c=r,u=i,l=s;n=f(n,r,i,s,t[o+0],7,-680876936),s=f(s,n,r,i,t[o+1],12,-389564586),i=f(i,s,n,r,t[o+2],17,606105819),r=f(r,i,s,n,t[o+3],22,-1044525330),n=f(n,r,i,s,t[o+4],7,-176418897),s=f(s,n,r,i,t[o+5],12,1200080426),i=f(i,s,n,r,t[o+6],17,-1473231341),r=f(r,i,s,n,t[o+7],22,-45705983),n=f(n,r,i,s,t[o+8],7,1770035416),s=f(s,n,r,i,t[o+9],12,-1958414417),i=f(i,s,n,r,t[o+10],17,-42063),r=f(r,i,s,n,t[o+11],22,-1990404162),n=f(n,r,i,s,t[o+12],7,1804603682),s=f(s,n,r,i,t[o+13],12,-40341101),i=f(i,s,n,r,t[o+14],17,-1502002290),n=g(n,r=f(r,i,s,n,t[o+15],22,1236535329),i,s,t[o+1],5,-165796510),s=g(s,n,r,i,t[o+6],9,-1069501632),i=g(i,s,n,r,t[o+11],14,643717713),r=g(r,i,s,n,t[o+0],20,-373897302),n=g(n,r,i,s,t[o+5],5,-701558691),s=g(s,n,r,i,t[o+10],9,38016083),i=g(i,s,n,r,t[o+15],14,-660478335),r=g(r,i,s,n,t[o+4],20,-405537848),n=g(n,r,i,s,t[o+9],5,568446438),s=g(s,n,r,i,t[o+14],9,-1019803690),i=g(i,s,n,r,t[o+3],14,-187363961),r=g(r,i,s,n,t[o+8],20,1163531501),n=g(n,r,i,s,t[o+13],5,-1444681467),s=g(s,n,r,i,t[o+2],9,-51403784),i=g(i,s,n,r,t[o+7],14,1735328473),n=y(n,r=g(r,i,s,n,t[o+12],20,-1926607734),i,s,t[o+5],4,-378558),s=y(s,n,r,i,t[o+8],11,-2022574463),i=y(i,s,n,r,t[o+11],16,1839030562),r=y(r,i,s,n,t[o+14],23,-35309556),n=y(n,r,i,s,t[o+1],4,-1530992060),s=y(s,n,r,i,t[o+4],11,1272893353),i=y(i,s,n,r,t[o+7],16,-155497632),r=y(r,i,s,n,t[o+10],23,-1094730640),n=y(n,r,i,s,t[o+13],4,681279174),s=y(s,n,r,i,t[o+0],11,-358537222),i=y(i,s,n,r,t[o+3],16,-722521979),r=y(r,i,s,n,t[o+6],23,76029189),n=y(n,r,i,s,t[o+9],4,-640364487),s=y(s,n,r,i,t[o+12],11,-421815835),i=y(i,s,n,r,t[o+15],16,530742520),n=m(n,r=y(r,i,s,n,t[o+2],23,-995338651),i,s,t[o+0],6,-198630844),s=m(s,n,r,i,t[o+7],10,1126891415),i=m(i,s,n,r,t[o+14],15,-1416354905),r=m(r,i,s,n,t[o+5],21,-57434055),n=m(n,r,i,s,t[o+12],6,1700485571),s=m(s,n,r,i,t[o+3],10,-1894986606),i=m(i,s,n,r,t[o+10],15,-1051523),r=m(r,i,s,n,t[o+1],21,-2054922799),n=m(n,r,i,s,t[o+8],6,1873313359),s=m(s,n,r,i,t[o+15],10,-30611744),i=m(i,s,n,r,t[o+6],15,-1560198380),r=m(r,i,s,n,t[o+13],21,1309151649),n=m(n,r,i,s,t[o+4],6,-145523070),s=m(s,n,r,i,t[o+11],10,-1120210379),i=m(i,s,n,r,t[o+2],15,718787259),r=m(r,i,s,n,t[o+9],21,-343485551),n=b(n,a),r=b(r,c),i=b(i,u),s=b(s,l)}return Array(n,r,i,s)}function p(t,e,n,r,i,s){return b((e=b(b(e,t),b(r,s)))<<i|e>>>32-i,n)}function f(t,e,n,r,i,s,o){return p(e&n|~e&r,t,e,i,s,o)}function g(t,e,n,r,i,s,o){return p(e&r|n&~r,t,e,i,s,o)}function y(t,e,n,r,i,s,o){return p(e^n^r,t,e,i,s,o)}function m(t,e,n,r,i,s,o){return p(n^(e|~r),t,e,i,s,o)}function b(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}e.exports=function(t){return h.hash(t,d,16)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(t,e,n){(function(t,n,r,i,s,o,a,c,u){var l;e.exports=l||function(t){for(var e,n=new Array(t),r=0;r<t;r++)!(3&r)&&(e=4294967296*Math.random()),n[r]=e>>>((3&r)<<3)&255;return n}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(t,e,n){(function(n,r,i,s,o,a,c,u,l){var h=t("./helpers");function d(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n,r,i,s=Array(80),o=1732584193,a=-271733879,c=-1732584194,u=271733878,l=-1009589776,h=0;h<t.length;h+=16){for(var d=o,g=a,y=c,m=u,b=l,v=0;v<80;v++){s[v]=v<16?t[h+v]:f(s[v-3]^s[v-8]^s[v-14]^s[v-16],1);var w=p(p(f(o,5),(w=a,r=c,i=u,(n=v)<20?w&r|~w&i:!(n<40)&&n<60?w&r|w&i|r&i:w^r^i)),p(p(l,s[v]),(n=v)<20?1518500249:n<40?1859775393:n<60?-1894007588:-899497514));l=u,u=c,c=f(a,30),a=o,o=w}o=p(o,d),a=p(a,g),c=p(c,y),u=p(u,m),l=p(l,b)}return Array(o,a,c,u,l)}function p(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function f(t,e){return t<<e|t>>>32-e}e.exports=function(t){return h.hash(t,d,20,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(t,e,n){(function(n,r,i,s,o,a,c,u,l){function h(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function d(t,e){var n,r=new Array(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),i=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),s=new Array(64);t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var o,a,c=0;c<t.length;c+=16){for(var u=i[0],l=i[1],d=i[2],p=i[3],y=i[4],m=i[5],b=i[6],v=i[7],w=0;w<64;w++)s[w]=w<16?t[w+c]:h(h(h((a=s[w-2],f(a,17)^f(a,19)^g(a,10)),s[w-7]),(a=s[w-15],f(a,7)^f(a,18)^g(a,3))),s[w-16]),n=h(h(h(h(v,f(a=y,6)^f(a,11)^f(a,25)),y&m^~y&b),r[w]),s[w]),o=h(f(o=u,2)^f(o,13)^f(o,22),u&l^u&d^l&d),v=b,b=m,m=y,y=h(p,n),p=d,d=l,l=u,u=h(n,o);i[0]=h(u,i[0]),i[1]=h(l,i[1]),i[2]=h(d,i[2]),i[3]=h(p,i[3]),i[4]=h(y,i[4]),i[5]=h(m,i[5]),i[6]=h(b,i[6]),i[7]=h(v,i[7])}return i}var p=t("./helpers"),f=function(t,e){return t>>>e|t<<32-e},g=function(t,e){return t>>>e};e.exports=function(t){return p.hash(t,d,32,!0)}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(t,e,n){(function(t,e,r,i,s,o,a,c,u){n.read=function(t,e,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,u=c>>1,l=-7,h=n?i-1:0,d=n?-1:1;for(i=t[e+h],h+=d,s=i&(1<<-l)-1,i>>=-l,l+=a;0<l;s=256*s+t[e+h],h+=d,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=r;0<l;o=256*o+t[e+h],h+=d,l-=8);if(0===s)s=1-u;else{if(s===c)return o?NaN:1/0*(i?-1:1);o+=Math.pow(2,r),s-=u}return(i?-1:1)*o*Math.pow(2,s-r)},n.write=function(t,e,n,r,i,s){var o,a,c=8*s-i-1,u=(1<<c)-1,l=u>>1,h=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,p=r?1:-1;for(s=e<0||0===e&&1/e<0?1:0,e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,o=u):(o=Math.floor(Math.log(e)/Math.LN2),e*(r=Math.pow(2,-o))<1&&(o--,r*=2),2<=(e+=1<=o+l?h/r:h*Math.pow(2,1-l))*r&&(o++,r/=2),u<=o+l?(a=0,o=u):1<=o+l?(a=(e*r-1)*Math.pow(2,i),o+=l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),o=0));8<=i;t[n+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,c+=i;0<c;t[n+d]=255&o,d+=p,o/=256,c-=8);t[n+d-p]|=128*s}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(t,e,n){(function(t,n,r,i,s,o,a,c,u){var l,h,d;function p(){}(t=e.exports={}).nextTick=(h="undefined"!=typeof window&&window.setImmediate,d="undefined"!=typeof window&&window.postMessage&&window.addEventListener,h?function(t){return window.setImmediate(t)}:d?(l=[],window.addEventListener("message",(function(t){var e=t.source;e!==window&&null!==e||"process-tick"!==t.data||(t.stopPropagation(),0<l.length&&l.shift()())}),!0),function(t){l.push(t),window.postMessage("process-tick","*")}):function(t){setTimeout(t,0)}),t.title="browser",t.browser=!0,t.env={},t.argv=[],t.on=p,t.addListener=p,t.once=p,t.off=p,t.removeListener=p,t.removeAllListeners=p,t.emit=p,t.binding=function(t){throw new Error("process.binding is not supported")},t.cwd=function(){return"/"},t.chdir=function(t){throw new Error("process.chdir is not supported")}}).call(this,t("lYpoI2"),"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)},8860:t=>{var e,n,r=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{n="function"==typeof clearTimeout?clearTimeout:s}catch(t){n=s}}();var a,c=[],u=!1,l=-1;function h(){u&&a&&(u=!1,a.length?c=a.concat(c):l=-1,c.length&&d())}function d(){if(!u){var t=o(h);u=!0;for(var e=c.length;e;){for(a=c,c=[];++l<e;)a&&a[l].run();l=-1,e=c.length}a=null,u=!1,function(t){if(n===clearTimeout)return clearTimeout(t);if((n===s||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(t);try{return n(t)}catch(e){try{return n.call(null,t)}catch(e){return n.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function f(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),1!==c.length||u||o(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=f,r.addListener=f,r.once=f,r.off=f,r.removeListener=f,r.removeAllListeners=f,r.emit=f,r.prependListener=f,r.prependOnceListener=f,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},3616:(t,e,n)=>{"use strict";t.exports=n(3660)},3660:(t,e,n)=>{"use strict";var r=e;function i(){r.util._configure(),r.Writer._configure(r.BufferWriter),r.Reader._configure(r.BufferReader)}r.build="minimal",r.Writer=n(2371),r.BufferWriter=n(5932),r.Reader=n(8227),r.BufferReader=n(204),r.util=n(1984),r.rpc=n(1737),r.roots=n(1107),r.configure=i,i()},8227:(t,e,n)=>{"use strict";t.exports=c;var r,i=n(1984),s=i.LongBits,o=i.utf8;function a(t,e){return RangeError("index out of range: "+t.pos+" + "+(e||1)+" > "+t.len)}function c(t){this.buf=t,this.pos=0,this.len=t.length}var u,l="undefined"!=typeof Uint8Array?function(t){if(t instanceof Uint8Array||Array.isArray(t))return new c(t);throw Error("illegal buffer")}:function(t){if(Array.isArray(t))return new c(t);throw Error("illegal buffer")},h=function(){return i.Buffer?function(t){return(c.create=function(t){return i.Buffer.isBuffer(t)?new r(t):l(t)})(t)}:l};function d(){var t=new s(0,0),e=0;if(!(this.len-this.pos>4)){for(;e<3;++e){if(this.pos>=this.len)throw a(this);if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t}return t.lo=(t.lo|(127&this.buf[this.pos++])<<7*e)>>>0,t}for(;e<4;++e)if(t.lo=(t.lo|(127&this.buf[this.pos])<<7*e)>>>0,this.buf[this.pos++]<128)return t;if(t.lo=(t.lo|(127&this.buf[this.pos])<<28)>>>0,t.hi=(t.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return t;if(e=0,this.len-this.pos>4){for(;e<5;++e)if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}else for(;e<5;++e){if(this.pos>=this.len)throw a(this);if(t.hi=(t.hi|(127&this.buf[this.pos])<<7*e+3)>>>0,this.buf[this.pos++]<128)return t}throw Error("invalid varint encoding")}function p(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(p(this.buf,this.pos+=4),p(this.buf,this.pos+=4))}c.create=h(),c.prototype._slice=i.Array.prototype.subarray||i.Array.prototype.slice,c.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),c.prototype.int32=function(){return 0|this.uint32()},c.prototype.sint32=function(){var t=this.uint32();return t>>>1^-(1&t)},c.prototype.bool=function(){return 0!==this.uint32()},c.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return p(this.buf,this.pos+=4)},c.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|p(this.buf,this.pos+=4)},c.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var t=i.float.readFloatLE(this.buf,this.pos);return this.pos+=4,t},c.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var t=i.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,t},c.prototype.bytes=function(){var t=this.uint32(),e=this.pos,n=this.pos+t;if(n>this.len)throw a(this,t);if(this.pos+=t,Array.isArray(this.buf))return this.buf.slice(e,n);if(e===n){var r=i.Buffer;return r?r.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,e,n)},c.prototype.string=function(){var t=this.bytes();return o.read(t,0,t.length)},c.prototype.skip=function(t){if("number"==typeof t){if(this.pos+t>this.len)throw a(this,t);this.pos+=t}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},c.prototype.skipType=function(t){switch(t){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(t=7&this.uint32());)this.skipType(t);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+t+" at offset "+this.pos)}return this},c._configure=function(t){r=t,c.create=h(),r._configure();var e=i.Long?"toLong":"toNumber";i.merge(c.prototype,{int64:function(){return d.call(this)[e](!1)},uint64:function(){return d.call(this)[e](!0)},sint64:function(){return d.call(this).zzDecode()[e](!1)},fixed64:function(){return f.call(this)[e](!0)},sfixed64:function(){return f.call(this)[e](!1)}})}},204:(t,e,n)=>{"use strict";t.exports=s;var r=n(8227);(s.prototype=Object.create(r.prototype)).constructor=s;var i=n(1984);function s(t){r.call(this,t)}s._configure=function(){i.Buffer&&(s.prototype._slice=i.Buffer.prototype.slice)},s.prototype.string=function(){var t=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+t,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+t,this.len))},s._configure()},1107:t=>{"use strict";t.exports={}},1737:(t,e,n)=>{"use strict";e.Service=n(8305)},8305:(t,e,n)=>{"use strict";t.exports=i;var r=n(1984);function i(t,e,n){if("function"!=typeof t)throw TypeError("rpcImpl must be a function");r.EventEmitter.call(this),this.rpcImpl=t,this.requestDelimited=Boolean(e),this.responseDelimited=Boolean(n)}(i.prototype=Object.create(r.EventEmitter.prototype)).constructor=i,i.prototype.rpcCall=function t(e,n,i,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return r.asPromise(t,a,e,n,i,s);if(a.rpcImpl)try{return a.rpcImpl(e,n[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(t,n){if(t)return a.emit("error",t,e),o(t);if(null!==n){if(!(n instanceof i))try{n=i[a.responseDelimited?"decodeDelimited":"decode"](n)}catch(t){return a.emit("error",t,e),o(t)}return a.emit("data",n,e),o(null,n)}a.end(!0)}))}catch(t){return a.emit("error",t,e),void setTimeout((function(){o(t)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},i.prototype.end=function(t){return this.rpcImpl&&(t||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},5817:(t,e,n)=>{"use strict";t.exports=i;var r=n(1984);function i(t,e){this.lo=t>>>0,this.hi=e>>>0}var s=i.zero=new i(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=i.zeroHash="\0\0\0\0\0\0\0\0";i.fromNumber=function(t){if(0===t)return s;var e=t<0;e&&(t=-t);var n=t>>>0,r=(t-n)/4294967296>>>0;return e&&(r=~r>>>0,n=~n>>>0,++n>4294967295&&(n=0,++r>4294967295&&(r=0))),new i(n,r)},i.from=function(t){if("number"==typeof t)return i.fromNumber(t);if(r.isString(t)){if(!r.Long)return i.fromNumber(parseInt(t,10));t=r.Long.fromString(t)}return t.low||t.high?new i(t.low>>>0,t.high>>>0):s},i.prototype.toNumber=function(t){if(!t&&this.hi>>>31){var e=1+~this.lo>>>0,n=~this.hi>>>0;return e||(n=n+1>>>0),-(e+4294967296*n)}return this.lo+4294967296*this.hi},i.prototype.toLong=function(t){return r.Long?new r.Long(0|this.lo,0|this.hi,Boolean(t)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(t)}};var a=String.prototype.charCodeAt;i.fromHash=function(t){return t===o?s:new i((a.call(t,0)|a.call(t,1)<<8|a.call(t,2)<<16|a.call(t,3)<<24)>>>0,(a.call(t,4)|a.call(t,5)<<8|a.call(t,6)<<16|a.call(t,7)<<24)>>>0)},i.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},i.prototype.zzEncode=function(){var t=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^t)>>>0,this.lo=(this.lo<<1^t)>>>0,this},i.prototype.zzDecode=function(){var t=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^t)>>>0,this.hi=(this.hi>>>1^t)>>>0,this},i.prototype.length=function(){var t=this.lo,e=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return 0===n?0===e?t<16384?t<128?1:2:t<2097152?3:4:e<16384?e<128?5:6:e<2097152?7:8:n<128?9:10}},1984:function(t,e,n){"use strict";var r=n(2590),i=e;function s(t,e,n){for(var r=Object.keys(e),i=0;i<r.length;++i)void 0!==t[r[i]]&&n||(t[r[i]]=e[r[i]]);return t}function o(t){function e(t,n){if(!(this instanceof e))return new e(t,n);Object.defineProperty(this,"message",{get:function(){return t}}),Error.captureStackTrace?Error.captureStackTrace(this,e):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),n&&s(this,n)}return e.prototype=Object.create(Error.prototype,{constructor:{value:e,writable:!0,enumerable:!1,configurable:!0},name:{get:function(){return t},set:void 0,enumerable:!1,configurable:!0},toString:{value:function(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),e}i.asPromise=n(5923),i.base64=n(2741),i.EventEmitter=n(3036),i.float=n(7760),i.inquire=n(5263),i.utf8=n(8397),i.pool=n(3568),i.LongBits=n(5817),i.isNode=Boolean(void 0!==r&&r&&r.process&&r.process.versions&&r.process.versions.node),i.global=i.isNode&&r||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t},i.isString=function(t){return"string"==typeof t||t instanceof String},i.isObject=function(t){return t&&"object"==typeof t},i.isset=i.isSet=function(t,e){var n=t[e];return!(null==n||!t.hasOwnProperty(e))&&("object"!=typeof n||(Array.isArray(n)?n.length:Object.keys(n).length)>0)},i.Buffer=function(){try{var t=i.inquire("buffer").Buffer;return t.prototype.utf8Write?t:null}catch(t){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(t){return"number"==typeof t?i.Buffer?i._Buffer_allocUnsafe(t):new i.Array(t):i.Buffer?i._Buffer_from(t):"undefined"==typeof Uint8Array?t:new Uint8Array(t)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(t){return t?i.LongBits.from(t).toHash():i.LongBits.zeroHash},i.longFromHash=function(t,e){var n=i.LongBits.fromHash(t);return i.Long?i.Long.fromBits(n.lo,n.hi,e):n.toNumber(Boolean(e))},i.merge=s,i.lcFirst=function(t){return t.charAt(0).toLowerCase()+t.substring(1)},i.newError=o,i.ProtocolError=o("ProtocolError"),i.oneOfGetter=function(t){for(var e={},n=0;n<t.length;++n)e[t[n]]=1;return function(){for(var t=Object.keys(this),n=t.length-1;n>-1;--n)if(1===e[t[n]]&&void 0!==this[t[n]]&&null!==this[t[n]])return t[n]}},i.oneOfSetter=function(t){return function(e){for(var n=0;n<t.length;++n)t[n]!==e&&delete this[t[n]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var t=i.Buffer;t?(i._Buffer_from=t.from!==Uint8Array.from&&t.from||function(e,n){return new t(e,n)},i._Buffer_allocUnsafe=t.allocUnsafe||function(e){return new t(e)}):i._Buffer_from=i._Buffer_allocUnsafe=null}},2371:(t,e,n)=>{"use strict";t.exports=h;var r,i=n(1984),s=i.LongBits,o=i.base64,a=i.utf8;function c(t,e,n){this.fn=t,this.len=e,this.next=void 0,this.val=n}function u(){}function l(t){this.head=t.head,this.tail=t.tail,this.len=t.len,this.next=t.states}function h(){this.len=0,this.head=new c(u,0,0),this.tail=this.head,this.states=null}var d=function(){return i.Buffer?function(){return(h.create=function(){return new r})()}:function(){return new h}};function p(t,e,n){e[n]=255&t}function f(t,e){this.len=t,this.next=void 0,this.val=e}function g(t,e,n){for(;t.hi;)e[n++]=127&t.lo|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[n++]=127&t.lo|128,t.lo=t.lo>>>7;e[n++]=t.lo}function y(t,e,n){e[n]=255&t,e[n+1]=t>>>8&255,e[n+2]=t>>>16&255,e[n+3]=t>>>24}h.create=d(),h.alloc=function(t){return new i.Array(t)},i.Array!==Array&&(h.alloc=i.pool(h.alloc,i.Array.prototype.subarray)),h.prototype._push=function(t,e,n){return this.tail=this.tail.next=new c(t,e,n),this.len+=e,this},f.prototype=Object.create(c.prototype),f.prototype.fn=function(t,e,n){for(;t>127;)e[n++]=127&t|128,t>>>=7;e[n]=t},h.prototype.uint32=function(t){return this.len+=(this.tail=this.tail.next=new f((t>>>=0)<128?1:t<16384?2:t<2097152?3:t<268435456?4:5,t)).len,this},h.prototype.int32=function(t){return t<0?this._push(g,10,s.fromNumber(t)):this.uint32(t)},h.prototype.sint32=function(t){return this.uint32((t<<1^t>>31)>>>0)},h.prototype.uint64=function(t){var e=s.from(t);return this._push(g,e.length(),e)},h.prototype.int64=h.prototype.uint64,h.prototype.sint64=function(t){var e=s.from(t).zzEncode();return this._push(g,e.length(),e)},h.prototype.bool=function(t){return this._push(p,1,t?1:0)},h.prototype.fixed32=function(t){return this._push(y,4,t>>>0)},h.prototype.sfixed32=h.prototype.fixed32,h.prototype.fixed64=function(t){var e=s.from(t);return this._push(y,4,e.lo)._push(y,4,e.hi)},h.prototype.sfixed64=h.prototype.fixed64,h.prototype.float=function(t){return this._push(i.float.writeFloatLE,4,t)},h.prototype.double=function(t){return this._push(i.float.writeDoubleLE,8,t)};var m=i.Array.prototype.set?function(t,e,n){e.set(t,n)}:function(t,e,n){for(var r=0;r<t.length;++r)e[n+r]=t[r]};h.prototype.bytes=function(t){var e=t.length>>>0;if(!e)return this._push(p,1,0);if(i.isString(t)){var n=h.alloc(e=o.length(t));o.decode(t,n,0),t=n}return this.uint32(e)._push(m,e,t)},h.prototype.string=function(t){var e=a.length(t);return e?this.uint32(e)._push(a.write,e,t):this._push(p,1,0)},h.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new c(u,0,0),this.len=0,this},h.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new c(u,0,0),this.len=0),this},h.prototype.ldelim=function(){var t=this.head,e=this.tail,n=this.len;return this.reset().uint32(n),n&&(this.tail.next=t.next,this.tail=e,this.len+=n),this},h.prototype.finish=function(){for(var t=this.head.next,e=this.constructor.alloc(this.len),n=0;t;)t.fn(t.val,e,n),n+=t.len,t=t.next;return e},h._configure=function(t){r=t,h.create=d(),r._configure()}},5932:(t,e,n)=>{"use strict";t.exports=s;var r=n(2371);(s.prototype=Object.create(r.prototype)).constructor=s;var i=n(1984);function s(){r.call(this)}function o(t,e,n){t.length<40?i.utf8.write(t,e,n):e.utf8Write?e.utf8Write(t,n):e.write(t,n)}s._configure=function(){s.alloc=i._Buffer_allocUnsafe,s.writeBytesBuffer=i.Buffer&&i.Buffer.prototype instanceof Uint8Array&&"set"===i.Buffer.prototype.set.name?function(t,e,n){e.set(t,n)}:function(t,e,n){if(t.copy)t.copy(e,n,0,t.length);else for(var r=0;r<t.length;)e[n++]=t[r++]}},s.prototype.bytes=function(t){i.isString(t)&&(t=i._Buffer_from(t,"base64"));var e=t.length>>>0;return this.uint32(e),e&&this._push(s.writeBytesBuffer,e,t),this},s.prototype.string=function(t){var e=i.Buffer.byteLength(t);return this.uint32(e),e&&this._push(o,e,t),this},s._configure()},2352:t=>{"use strict";function e(t,e){return Object.prototype.hasOwnProperty.call(t,e)}t.exports=function(t,n,r,i){n=n||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var o=/\+/g;t=t.split(n);var a=1e3;i&&"number"==typeof i.maxKeys&&(a=i.maxKeys);var c=t.length;a>0&&c>a&&(c=a);for(var u=0;u<c;++u){var l,h,d,p,f=t[u].replace(o,"%20"),g=f.indexOf(r);g>=0?(l=f.substr(0,g),h=f.substr(g+1)):(l=f,h=""),d=decodeURIComponent(l),p=decodeURIComponent(h),e(s,d)?Array.isArray(s[d])?s[d].push(p):s[d]=[s[d],p]:s[d]=p}return s}},3880:t=>{"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,n,r,i){return n=n||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(i){var s=encodeURIComponent(e(i))+r;return Array.isArray(t[i])?t[i].map((function(t){return s+encodeURIComponent(e(t))})).join(n):s+encodeURIComponent(e(t[i]))})).join(n):i?encodeURIComponent(e(i))+r+encodeURIComponent(e(t)):""}},9300:(t,e,n)=>{"use strict";e.decode=e.parse=n(2352),e.encode=e.stringify=n(3880)},978:(t,e)=>{"use strict";var n=Object.prototype.hasOwnProperty;function r(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(t){return null}}function i(t){try{return encodeURIComponent(t)}catch(t){return null}}e.stringify=function(t,e){e=e||"";var r,s,o=[];for(s in"string"!=typeof e&&(e="?"),t)if(n.call(t,s)){if((r=t[s])||null!=r&&!isNaN(r)||(r=""),s=i(s),r=i(r),null===s||null===r)continue;o.push(s+"="+r)}return o.length?e+o.join("&"):""},e.parse=function(t){for(var e,n=/([^=?#&]+)=?([^&]*)/g,i={};e=n.exec(t);){var s=r(e[1]),o=r(e[2]);null===s||null===o||s in i||(i[s]=o)}return i}},754:t=>{"use strict";var e={};function n(t,n,r){r||(r=Error);var i=function(t){var e,r;function i(e,r,i){return t.call(this,function(t,e,r){return"string"==typeof n?n:n(t,e,r)}(e,r,i))||this}return r=t,(e=i).prototype=Object.create(r.prototype),e.prototype.constructor=e,e.__proto__=r,i}(r);i.prototype.name=r.name,i.prototype.code=t,e[t]=i}function r(t,e){if(Array.isArray(t)){var n=t.length;return t=t.map((function(t){return String(t)})),n>2?"one of ".concat(e," ").concat(t.slice(0,n-1).join(", "),", or ")+t[n-1]:2===n?"one of ".concat(e," ").concat(t[0]," or ").concat(t[1]):"of ".concat(e," ").concat(t[0])}return"of ".concat(e," ").concat(String(t))}n("ERR_INVALID_OPT_VALUE",(function(t,e){return'The value "'+e+'" is invalid for option "'+t+'"'}),TypeError),n("ERR_INVALID_ARG_TYPE",(function(t,e,n){var i,s,o,a;if("string"==typeof e&&(s="not ",e.substr(!o||o<0?0:+o,s.length)===s)?(i="must not be",e=e.replace(/^not /,"")):i="must be",function(t,e,n){return(void 0===n||n>t.length)&&(n=t.length),t.substring(n-e.length,n)===e}(t," argument"))a="The ".concat(t," ").concat(i," ").concat(r(e,"type"));else{var c=function(t,e,n){return"number"!=typeof n&&(n=0),!(n+e.length>t.length)&&-1!==t.indexOf(e,n)}(t,".")?"property":"argument";a='The "'.concat(t,'" ').concat(c," ").concat(i," ").concat(r(e,"type"))}return a+=". Received type ".concat(typeof n)}),TypeError),n("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF"),n("ERR_METHOD_NOT_IMPLEMENTED",(function(t){return"The "+t+" method is not implemented"})),n("ERR_STREAM_PREMATURE_CLOSE","Premature close"),n("ERR_STREAM_DESTROYED",(function(t){return"Cannot call "+t+" 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(t){return"Unknown encoding: "+t}),TypeError),n("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event"),t.exports.F=e},8004:(t,e,n)=>{"use strict";var r=n(8860),i=Object.keys||function(t){var e=[];for(var n in t)e.push(n);return e};t.exports=l;var s=n(9306),o=n(1118);n(7256)(l,s);for(var a=i(o.prototype),c=0;c<a.length;c++){var u=a[c];l.prototype[u]||(l.prototype[u]=o.prototype[u])}function l(t){if(!(this instanceof l))return new l(t);s.call(this,t),o.call(this,t),this.allowHalfOpen=!0,t&&(!1===t.readable&&(this.readable=!1),!1===t.writable&&(this.writable=!1),!1===t.allowHalfOpen&&(this.allowHalfOpen=!1,this.once("end",h)))}function h(){this._writableState.ended||r.nextTick(d,this)}function d(t){t.end()}Object.defineProperty(l.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(l.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(l.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(l.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}})},8270:(t,e,n)=>{"use strict";t.exports=i;var r=n(5972);function i(t){if(!(this instanceof i))return new i(t);r.call(this,t)}n(7256)(i,r),i.prototype._transform=function(t,e,n){n(null,t)}},9306:(t,e,n)=>{"use strict";var r,i=n(2590),s=n(8860);t.exports=I,I.ReadableState=T;n(5121).EventEmitter;var o=function(t,e){return t.listeners(e).length},a=n(5331),c=n(25).Buffer,u=i.Uint8Array||function(){};var l,h=n(9838);l=h&&h.debuglog?h.debuglog("stream"):function(){};var d,p,f,g=n(9455),y=n(2682),m=n(8965).getHighWaterMark,b=n(754).F,v=b.ERR_INVALID_ARG_TYPE,w=b.ERR_STREAM_PUSH_AFTER_EOF,S=b.ERR_METHOD_NOT_IMPLEMENTED,E=b.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;n(7256)(I,a);var _=y.errorOrDestroy,C=["error","close","destroy","pause","resume"];function T(t,e,i){r=r||n(8004),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.readableObjectMode),this.highWaterMark=m(this,t,"readableHighWaterMark",i),this.buffer=new g,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!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.destroyed=!1,this.defaultEncoding=t.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,t.encoding&&(d||(d=n(6343).StringDecoder),this.decoder=new d(t.encoding),this.encoding=t.encoding)}function I(t){if(r=r||n(8004),!(this instanceof I))return new I(t);var e=this instanceof r;this._readableState=new T(t,this,e),this.readable=!0,t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy)),a.call(this)}function N(t,e,n,r,i){l("readableAddChunk",e);var s,o=t._readableState;if(null===e)o.reading=!1,function(t,e){if(l("onEofChunk"),e.ended)return;if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,e.sync?x(t):(e.needReadable=!1,e.emittedReadable||(e.emittedReadable=!0,P(t)))}(t,o);else if(i||(s=function(t,e){var n;r=e,c.isBuffer(r)||r instanceof u||"string"==typeof e||void 0===e||t.objectMode||(n=new v("chunk",["string","Buffer","Uint8Array"],e));var r;return n}(o,e)),s)_(t,s);else if(o.objectMode||e&&e.length>0)if("string"==typeof e||o.objectMode||Object.getPrototypeOf(e)===c.prototype||(e=function(t){return c.from(t)}(e)),r)o.endEmitted?_(t,new E):R(t,o,e,!0);else if(o.ended)_(t,new w);else{if(o.destroyed)return!1;o.reading=!1,o.decoder&&!n?(e=o.decoder.write(e),o.objectMode||0!==e.length?R(t,o,e,!1):k(t,o)):R(t,o,e,!1)}else r||(o.reading=!1,k(t,o));return!o.ended&&(o.length<o.highWaterMark||0===o.length)}function R(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(e.awaitDrain=0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&x(t)),k(t,e)}Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),I.prototype.destroy=y.destroy,I.prototype._undestroy=y.undestroy,I.prototype._destroy=function(t,e){e(t)},I.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=c.from(t,e),e=""),n=!0),N(this,t,e,!1,n)},I.prototype.unshift=function(t){return N(this,t,null,!0,!1)},I.prototype.isPaused=function(){return!1===this._readableState.flowing},I.prototype.setEncoding=function(t){d||(d=n(6343).StringDecoder);var e=new d(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;for(var r=this._readableState.buffer.head,i="";null!==r;)i+=e.write(r.data),r=r.next;return this._readableState.buffer.clear(),""!==i&&this._readableState.buffer.push(i),this._readableState.length=i.length,this};var O=1073741824;function A(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=O?t=O:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function x(t){var e=t._readableState;l("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(l("emitReadable",e.flowing),e.emittedReadable=!0,s.nextTick(P,t))}function P(t){var e=t._readableState;l("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,F(t)}function k(t,e){e.readingMore||(e.readingMore=!0,s.nextTick(L,t,e))}function L(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){var n=e.length;if(l("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function D(t){var e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!e.paused?e.flowing=!0:t.listenerCount("data")>0&&t.resume()}function M(t){l("readable nexttick read 0"),t.read(0)}function B(t,e){l("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),F(t),e.flowing&&!e.reading&&t.read(0)}function F(t){var e=t._readableState;for(l("flow",e.flowing);e.flowing&&null!==t.read(););}function j(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n);var n}function U(t){var e=t._readableState;l("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,s.nextTick($,e,t))}function $(t,e){if(l("endReadableNT",t.endEmitted,t.length),!t.endEmitted&&0===t.length&&(t.endEmitted=!0,e.readable=!1,e.emit("end"),t.autoDestroy)){var n=e._writableState;(!n||n.autoDestroy&&n.finished)&&e.destroy()}}function q(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}I.prototype.read=function(t){l("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return l("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?U(this):x(this),null;if(0===(t=A(t,e))&&e.ended)return 0===e.length&&U(this),null;var r,i=e.needReadable;return l("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&l("length less than watermark",i=!0),e.ended||e.reading?l("reading or ended",i=!1):i&&(l("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=A(n,e))),null===(r=t>0?j(t,e):null)?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.awaitDrain=0),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&U(this)),null!==r&&this.emit("data",r),r},I.prototype._read=function(t){_(this,new S("_read()"))},I.prototype.pipe=function(t,e){var n=this,r=this._readableState;switch(r.pipesCount){case 0:r.pipes=t;break;case 1:r.pipes=[r.pipes,t];break;default:r.pipes.push(t)}r.pipesCount+=1,l("pipe count=%d opts=%j",r.pipesCount,e);var i=(!e||!1!==e.end)&&t!==s.stdout&&t!==s.stderr?c:y;function a(e,i){l("onunpipe"),e===n&&i&&!1===i.hasUnpiped&&(i.hasUnpiped=!0,l("cleanup"),t.removeListener("close",f),t.removeListener("finish",g),t.removeListener("drain",u),t.removeListener("error",p),t.removeListener("unpipe",a),n.removeListener("end",c),n.removeListener("end",y),n.removeListener("data",d),h=!0,!r.awaitDrain||t._writableState&&!t._writableState.needDrain||u())}function c(){l("onend"),t.end()}r.endEmitted?s.nextTick(i):n.once("end",i),t.on("unpipe",a);var u=function(t){return function(){var e=t._readableState;l("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&o(t,"data")&&(e.flowing=!0,F(t))}}(n);t.on("drain",u);var h=!1;function d(e){l("ondata");var i=t.write(e);l("dest.write",i),!1===i&&((1===r.pipesCount&&r.pipes===t||r.pipesCount>1&&-1!==q(r.pipes,t))&&!h&&(l("false write response, pause",r.awaitDrain),r.awaitDrain++),n.pause())}function p(e){l("onerror",e),y(),t.removeListener("error",p),0===o(t,"error")&&_(t,e)}function f(){t.removeListener("finish",g),y()}function g(){l("onfinish"),t.removeListener("close",f),y()}function y(){l("unpipe"),n.unpipe(t)}return n.on("data",d),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?Array.isArray(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",p),t.once("close",f),t.once("finish",g),t.emit("pipe",n),r.flowing||(l("pipe resume"),n.resume()),t},I.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,i=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var s=0;s<i;s++)r[s].emit("unpipe",this,{hasUnpiped:!1});return this}var o=q(e.pipes,t);return-1===o||(e.pipes.splice(o,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},I.prototype.on=function(t,e){var n=a.prototype.on.call(this,t,e),r=this._readableState;return"data"===t?(r.readableListening=this.listenerCount("readable")>0,!1!==r.flowing&&this.resume()):"readable"===t&&(r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.flowing=!1,r.emittedReadable=!1,l("on readable",r.length,r.reading),r.length?x(this):r.reading||s.nextTick(M,this))),n},I.prototype.addListener=I.prototype.on,I.prototype.removeListener=function(t,e){var n=a.prototype.removeListener.call(this,t,e);return"readable"===t&&s.nextTick(D,this),n},I.prototype.removeAllListeners=function(t){var e=a.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||s.nextTick(D,this),e},I.prototype.resume=function(){var t=this._readableState;return t.flowing||(l("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,s.nextTick(B,t,e))}(this,t)),t.paused=!1,this},I.prototype.pause=function(){return l("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(l("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this},I.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var i in t.on("end",(function(){if(l("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(i){(l("wrapped data"),n.decoder&&(i=n.decoder.write(i)),n.objectMode&&null==i)||(n.objectMode||i&&i.length)&&(e.push(i)||(r=!0,t.pause()))})),t)void 0===this[i]&&"function"==typeof t[i]&&(this[i]=function(e){return function(){return t[e].apply(t,arguments)}}(i));for(var s=0;s<C.length;s++)t.on(C[s],this.emit.bind(this,C[s]));return this._read=function(e){l("wrapped _read",e),r&&(r=!1,t.resume())},this},"function"==typeof Symbol&&(I.prototype[Symbol.asyncIterator]=function(){return void 0===p&&(p=n(625)),p(this)}),Object.defineProperty(I.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),Object.defineProperty(I.prototype,"readableBuffer",{enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}}),Object.defineProperty(I.prototype,"readableFlowing",{enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}}),I._fromList=j,Object.defineProperty(I.prototype,"readableLength",{enumerable:!1,get:function(){return this._readableState.length}}),"function"==typeof Symbol&&(I.from=function(t,e){return void 0===f&&(f=n(7635)),f(I,t,e)})},5972:(t,e,n)=>{"use strict";t.exports=l;var r=n(754).F,i=r.ERR_METHOD_NOT_IMPLEMENTED,s=r.ERR_MULTIPLE_CALLBACK,o=r.ERR_TRANSFORM_ALREADY_TRANSFORMING,a=r.ERR_TRANSFORM_WITH_LENGTH_0,c=n(8004);function u(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(null===r)return this.emit("error",new s);n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var i=this._readableState;i.reading=!1,(i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}function l(t){if(!(this instanceof l))return new l(t);c.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function h(){var t=this;"function"!=typeof this._flush||this._readableState.destroyed?d(this,null,null):this._flush((function(e,n){d(t,e,n)}))}function d(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new a;if(t._transformState.transforming)throw new o;return t.push(null)}n(7256)(l,c),l.prototype.push=function(t,e){return this._transformState.needTransform=!1,c.prototype.push.call(this,t,e)},l.prototype._transform=function(t,e,n){n(new i("_transform()"))},l.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var i=this._readableState;(r.needTransform||i.needReadable||i.length<i.highWaterMark)&&this._read(i.highWaterMark)}},l.prototype._read=function(t){var e=this._transformState;null===e.writechunk||e.transforming?e.needTransform=!0:(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform))},l.prototype._destroy=function(t,e){c.prototype._destroy.call(this,t,(function(t){e(t)}))}},1118:(t,e,n)=>{"use strict";var r,i=n(2590),s=n(8860);function o(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;t.entry=null;for(;r;){var i=r.callback;e.pendingcb--,i(n),r=r.next}e.corkedRequestsFree.next=t}(e,t)}}t.exports=I,I.WritableState=T;var a={deprecate:n(7873)},c=n(5331),u=n(25).Buffer,l=i.Uint8Array||function(){};var h,d=n(2682),p=n(8965).getHighWaterMark,f=n(754).F,g=f.ERR_INVALID_ARG_TYPE,y=f.ERR_METHOD_NOT_IMPLEMENTED,m=f.ERR_MULTIPLE_CALLBACK,b=f.ERR_STREAM_CANNOT_PIPE,v=f.ERR_STREAM_DESTROYED,w=f.ERR_STREAM_NULL_VALUES,S=f.ERR_STREAM_WRITE_AFTER_END,E=f.ERR_UNKNOWN_ENCODING,_=d.errorOrDestroy;function C(){}function T(t,e,i){r=r||n(8004),t=t||{},"boolean"!=typeof i&&(i=e instanceof r),this.objectMode=!!t.objectMode,i&&(this.objectMode=this.objectMode||!!t.writableObjectMode),this.highWaterMark=p(this,t,"writableHighWaterMark",i),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var a=!1===t.decodeStrings;this.decodeStrings=!a,this.defaultEncoding=t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,i=n.writecb;if("function"!=typeof i)throw new m;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,i){--e.pendingcb,n?(s.nextTick(i,r),s.nextTick(P,t,e),t._writableState.errorEmitted=!0,_(t,r)):(i(r),t._writableState.errorEmitted=!0,_(t,r),P(t,e))}(t,n,r,e,i);else{var o=A(n)||t.destroyed;o||n.corked||n.bufferProcessing||!n.bufferedRequest||O(t,n),r?s.nextTick(R,t,n,o,i):R(t,n,o,i)}}(e,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!1!==t.emitClose,this.autoDestroy=!!t.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new o(this)}function I(t){var e=this instanceof(r=r||n(8004));if(!e&&!h.call(I,this))return new I(t);this._writableState=new T(t,this,e),this.writable=!0,t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final)),c.call(this)}function N(t,e,n,r,i,s,o){e.writelen=r,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new v("write")):n?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function R(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),P(t,e)}function O(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,i=new Array(r),s=e.corkedRequestsFree;s.entry=n;for(var a=0,c=!0;n;)i[a]=n,n.isBuf||(c=!1),n=n.next,a+=1;i.allBuffers=c,N(t,e,!0,e.length,i,"",s.finish),e.pendingcb++,e.lastBufferedRequest=null,s.next?(e.corkedRequestsFree=s.next,s.next=null):e.corkedRequestsFree=new o(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,l=n.encoding,h=n.callback;if(N(t,e,!1,e.objectMode?1:u.length,u,l,h),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function A(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function x(t,e){t._final((function(n){e.pendingcb--,n&&_(t,n),e.prefinished=!0,t.emit("prefinish"),P(t,e)}))}function P(t,e){var n=A(e);if(n&&(function(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.pendingcb++,e.finalCalled=!0,s.nextTick(x,t,e)))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"),e.autoDestroy))){var r=t._readableState;(!r||r.autoDestroy&&r.endEmitted)&&t.destroy()}return n}n(7256)(I,c),T.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(T.prototype,"buffer",{get:a.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(I,Symbol.hasInstance,{value:function(t){return!!h.call(this,t)||this===I&&(t&&t._writableState instanceof T)}})):h=function(t){return t instanceof this},I.prototype.pipe=function(){_(this,new b)},I.prototype.write=function(t,e,n){var r,i=this._writableState,o=!1,a=!i.objectMode&&(r=t,u.isBuffer(r)||r instanceof l);return a&&!u.isBuffer(t)&&(t=function(t){return u.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=i.defaultEncoding),"function"!=typeof n&&(n=C),i.ending?function(t,e){var n=new S;_(t,n),s.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var i;return null===n?i=new w:"string"==typeof n||e.objectMode||(i=new g("chunk",["string","Buffer"],n)),!i||(_(t,i),s.nextTick(r,i),!1)}(this,i,t,n))&&(i.pendingcb++,o=function(t,e,n,r,i,s){if(!n){var o=function(t,e,n){t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=u.from(e,n));return e}(e,r,i);r!==o&&(n=!0,i="buffer",r=o)}var a=e.objectMode?1:r.length;e.length+=a;var c=e.length<e.highWaterMark;c||(e.needDrain=!0);if(e.writing||e.corked){var l=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:i,isBuf:n,callback:s,next:null},l?l.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else N(t,e,!1,a,r,i,s);return c}(this,i,a,t,e,n)),o},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.bufferProcessing||!t.bufferedRequest||O(this,t))},I.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new E(t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(I.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}}),Object.defineProperty(I.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),I.prototype._write=function(t,e,n){n(new y("_write()"))},I.prototype._writev=null,I.prototype.end=function(t,e,n){var r=this._writableState;return"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||function(t,e,n){e.ending=!0,P(t,e),n&&(e.finished?s.nextTick(n):t.once("finish",n));e.ended=!0,t.writable=!1}(this,r,n),this},Object.defineProperty(I.prototype,"writableLength",{enumerable:!1,get:function(){return this._writableState.length}}),Object.defineProperty(I.prototype,"destroyed",{enumerable:!1,get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),I.prototype.destroy=d.destroy,I.prototype._undestroy=d.undestroy,I.prototype._destroy=function(t,e){e(t)}},625:(t,e,n)=>{"use strict";var r,i=n(8860);function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}var o=n(1600),a=Symbol("lastResolve"),c=Symbol("lastReject"),u=Symbol("error"),l=Symbol("ended"),h=Symbol("lastPromise"),d=Symbol("handlePromise"),p=Symbol("stream");function f(t,e){return{value:t,done:e}}function g(t){var e=t[a];if(null!==e){var n=t[p].read();null!==n&&(t[h]=null,t[a]=null,t[c]=null,e(f(n,!1)))}}function y(t){i.nextTick(g,t)}var m=Object.getPrototypeOf((function(){})),b=Object.setPrototypeOf((s(r={get stream(){return this[p]},next:function(){var t=this,e=this[u];if(null!==e)return Promise.reject(e);if(this[l])return Promise.resolve(f(void 0,!0));if(this[p].destroyed)return new Promise((function(e,n){i.nextTick((function(){t[u]?n(t[u]):e(f(void 0,!0))}))}));var n,r=this[h];if(r)n=new Promise(function(t,e){return function(n,r){t.then((function(){e[l]?n(f(void 0,!0)):e[d](n,r)}),r)}}(r,this));else{var s=this[p].read();if(null!==s)return Promise.resolve(f(s,!1));n=new Promise(this[d])}return this[h]=n,n}},Symbol.asyncIterator,(function(){return this})),s(r,"return",(function(){var t=this;return new Promise((function(e,n){t[p].destroy(null,(function(t){t?n(t):e(f(void 0,!0))}))}))})),r),m);t.exports=function(t){var e,n=Object.create(b,(s(e={},p,{value:t,writable:!0}),s(e,a,{value:null,writable:!0}),s(e,c,{value:null,writable:!0}),s(e,u,{value:null,writable:!0}),s(e,l,{value:t._readableState.endEmitted,writable:!0}),s(e,d,{value:function(t,e){var r=n[p].read();r?(n[h]=null,n[a]=null,n[c]=null,t(f(r,!1))):(n[a]=t,n[c]=e)},writable:!0}),e));return n[h]=null,o(t,(function(t){if(t&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code){var e=n[c];return null!==e&&(n[h]=null,n[a]=null,n[c]=null,e(t)),void(n[u]=t)}var r=n[a];null!==r&&(n[h]=null,n[a]=null,n[c]=null,r(f(void 0,!0))),n[l]=!0})),t.on("readable",y.bind(null,n)),n}},9455:(t,e,n)=>{"use strict";function r(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function i(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var o=n(25).Buffer,a=n(5340).inspect,c=a&&a.custom||"inspect";t.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}var e,n,u;return e=t,n=[{key:"push",value:function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}},{key:"unshift",value:function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}},{key:"shift",value:function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n}},{key:"concat",value:function(t){if(0===this.length)return o.alloc(0);for(var e,n,r,i=o.allocUnsafe(t>>>0),s=this.head,a=0;s;)e=s.data,n=i,r=a,o.prototype.copy.call(e,n,r),a+=s.data.length,s=s.next;return i}},{key:"consume",value:function(t,e){var n;return t<this.head.data.length?(n=this.head.data.slice(0,t),this.head.data=this.head.data.slice(t)):n=t===this.head.data.length?this.shift():e?this._getString(t):this._getBuffer(t),n}},{key:"first",value:function(){return this.head.data}},{key:"_getString",value:function(t){var e=this.head,n=1,r=e.data;for(t-=r.length;e=e.next;){var i=e.data,s=t>i.length?i.length:t;if(s===i.length?r+=i:r+=i.slice(0,t),0==(t-=s)){s===i.length?(++n,e.next?this.head=e.next:this.head=this.tail=null):(this.head=e,e.data=i.slice(s));break}++n}return this.length-=n,r}},{key:"_getBuffer",value:function(t){var e=o.allocUnsafe(t),n=this.head,r=1;for(n.data.copy(e),t-=n.data.length;n=n.next;){var i=n.data,s=t>i.length?i.length:t;if(i.copy(e,e.length-t,0,s),0==(t-=s)){s===i.length?(++r,n.next?this.head=n.next:this.head=this.tail=null):(this.head=n,n.data=i.slice(s));break}++r}return this.length-=r,e}},{key:c,value:function(t,e){return a(this,function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?r(Object(n),!0).forEach((function(e){i(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e,{depth:0,customInspect:!1}))}}],n&&s(e.prototype,n),u&&s(e,u),t}()},2682:(t,e,n)=>{"use strict";var r=n(8860);function i(t,e){o(t,e),s(t)}function s(t){t._writableState&&!t._writableState.emitClose||t._readableState&&!t._readableState.emitClose||t.emit("close")}function o(t,e){t.emit("error",e)}t.exports={destroy:function(t,e){var n=this,a=this._readableState&&this._readableState.destroyed,c=this._writableState&&this._writableState.destroyed;return a||c?(e?e(t):t&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,r.nextTick(o,this,t)):r.nextTick(o,this,t)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?n._writableState?n._writableState.errorEmitted?r.nextTick(s,n):(n._writableState.errorEmitted=!0,r.nextTick(i,n,t)):r.nextTick(i,n,t):e?(r.nextTick(s,n),e(t)):r.nextTick(s,n)})),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(t,e){var n=t._readableState,r=t._writableState;n&&n.autoDestroy||r&&r.autoDestroy?t.destroy(e):t.emit("error",e)}}},1600:(t,e,n)=>{"use strict";var r=n(754).F.ERR_STREAM_PREMATURE_CLOSE;function i(){}t.exports=function t(e,n,s){if("function"==typeof n)return t(e,null,n);n||(n={}),s=function(t){var e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}}(s||i);var o=n.readable||!1!==n.readable&&e.readable,a=n.writable||!1!==n.writable&&e.writable,c=function(){e.writable||l()},u=e._writableState&&e._writableState.finished,l=function(){a=!1,u=!0,o||s.call(e)},h=e._readableState&&e._readableState.endEmitted,d=function(){o=!1,h=!0,a||s.call(e)},p=function(t){s.call(e,t)},f=function(){var t;return o&&!h?(e._readableState&&e._readableState.ended||(t=new r),s.call(e,t)):a&&!u?(e._writableState&&e._writableState.ended||(t=new r),s.call(e,t)):void 0},g=function(){e.req.on("finish",l)};return!function(t){return t.setHeader&&"function"==typeof t.abort}(e)?a&&!e._writableState&&(e.on("end",c),e.on("close",c)):(e.on("complete",l),e.on("abort",f),e.req?g():e.on("request",g)),e.on("end",d),e.on("finish",l),!1!==n.error&&e.on("error",p),e.on("close",f),function(){e.removeListener("complete",l),e.removeListener("abort",f),e.removeListener("request",g),e.req&&e.req.removeListener("finish",l),e.removeListener("end",c),e.removeListener("close",c),e.removeListener("finish",l),e.removeListener("end",d),e.removeListener("error",p),e.removeListener("close",f)}}},7635:t=>{t.exports=function(){throw new Error("Readable.from is not available in the browser")}},8060:(t,e,n)=>{"use strict";var r;var i=n(754).F,s=i.ERR_MISSING_ARGS,o=i.ERR_STREAM_DESTROYED;function a(t){if(t)throw t}function c(t){t()}function u(t,e){return t.pipe(e)}t.exports=function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];var l,h=function(t){return t.length?"function"!=typeof t[t.length-1]?a:t.pop():a}(e);if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new s("streams");var d=e.map((function(t,i){var s=i<e.length-1;return function(t,e,i,s){s=function(t){var e=!1;return function(){e||(e=!0,t.apply(void 0,arguments))}}(s);var a=!1;t.on("close",(function(){a=!0})),void 0===r&&(r=n(1600)),r(t,{readable:e,writable:i},(function(t){if(t)return s(t);a=!0,s()}));var c=!1;return function(e){if(!a&&!c)return c=!0,function(t){return t.setHeader&&"function"==typeof t.abort}(t)?t.abort():"function"==typeof t.destroy?t.destroy():void s(e||new o("pipe"))}}(t,s,i>0,(function(t){l||(l=t),t&&d.forEach(c),s||(d.forEach(c),h(l))}))}));return e.reduce(u)}},8965:(t,e,n)=>{"use strict";var r=n(754).F.ERR_INVALID_OPT_VALUE;t.exports={getHighWaterMark:function(t,e,n,i){var s=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,i,n);if(null!=s){if(!isFinite(s)||Math.floor(s)!==s||s<0)throw new r(i?n:"highWaterMark",s);return Math.floor(s)}return t.objectMode?16:16384}}},5331:(t,e,n)=>{t.exports=n(5121).EventEmitter},7541:(t,e,n)=>{(e=t.exports=n(9306)).Stream=e,e.Readable=e,e.Writable=n(1118),e.Duplex=n(8004),e.Transform=n(5972),e.PassThrough=n(8270),e.finished=n(1600),e.pipeline=n(8060)},4305:t=>{"use strict";t.exports=function(t,e){if(e=e.split(":")[0],!(t=+t))return!1;switch(e){case"http":case"ws":return 80!==t;case"https":case"wss":return 443!==t;case"ftp":return 21!==t;case"gopher":return 70!==t;case"file":return!1}return 0!==t}},2934:(t,e,n)=>{var r=n(2590),i=n(1523),s=n(3799),o=n(5576),a=n(356),c=n(8189),u=e;u.request=function(t,e){t="string"==typeof t?c.parse(t):o(t);var n=-1===r.location.protocol.search(/^https?:$/)?"http:":"",s=t.protocol||n,a=t.hostname||t.host,u=t.port,l=t.path||"/";a&&-1!==a.indexOf(":")&&(a="["+a+"]"),t.url=(a?s+"//"+a:"")+(u?":"+u:"")+l,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var h=new i(t);return e&&h.on("response",e),h},u.get=function(t,e){var n=u.request(t,e);return n.end(),n},u.ClientRequest=i,u.IncomingMessage=s.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=a,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]},6086:(t,e,n)=>{var r,i=n(2590);function s(){if(void 0!==r)return r;if(i.XMLHttpRequest){r=new i.XMLHttpRequest;try{r.open("GET",i.XDomainRequest?"/":"https://example.com")}catch(t){r=null}}else r=null;return r}function o(t){var e=s();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(t){}return!1}function a(t){return"function"==typeof t}e.fetch=a(i.fetch)&&a(i.ReadableStream),e.writableStream=a(i.WritableStream),e.abortController=a(i.AbortController),e.arraybuffer=e.fetch||o("arraybuffer"),e.msstream=!e.fetch&&o("ms-stream"),e.mozchunkedarraybuffer=!e.fetch&&o("moz-chunked-arraybuffer"),e.overrideMimeType=e.fetch||!!s()&&a(s().overrideMimeType),r=null},1523:(t,e,n)=>{var r=n(25).Buffer,i=n(2590),s=n(8860),o=n(6086),a=n(7256),c=n(3799),u=n(7541),l=c.IncomingMessage,h=c.readyStates;var d=t.exports=function(t){var e,n=this;u.Writable.call(n),n._opts=t,n._body=[],n._headers={},t.auth&&n.setHeader("Authorization","Basic "+r.from(t.auth).toString("base64")),Object.keys(t.headers).forEach((function(e){n.setHeader(e,t.headers[e])}));var i=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!o.abortController)i=!1,e=!0;else if("prefer-streaming"===t.mode)e=!1;else if("allow-wrong-content-type"===t.mode)e=!o.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");e=!0}n._mode=function(t,e){return o.fetch&&e?"fetch":o.mozchunkedarraybuffer?"moz-chunked-arraybuffer":o.msstream?"ms-stream":o.arraybuffer&&t?"arraybuffer":"text"}(e,i),n._fetchTimer=null,n._socketTimeout=null,n._socketTimer=null,n.on("finish",(function(){n._onFinish()}))};a(d,u.Writable),d.prototype.setHeader=function(t,e){var n=t.toLowerCase();-1===p.indexOf(n)&&(this._headers[n]={name:t,value:e})},d.prototype.getHeader=function(t){var e=this._headers[t.toLowerCase()];return e?e.value:null},d.prototype.removeHeader=function(t){delete this._headers[t.toLowerCase()]},d.prototype._onFinish=function(){var t=this;if(!t._destroyed){var e=t._opts;"timeout"in e&&0!==e.timeout&&t.setTimeout(e.timeout);var n=t._headers,r=null;"GET"!==e.method&&"HEAD"!==e.method&&(r=new Blob(t._body,{type:(n["content-type"]||{}).value||""}));var a=[];if(Object.keys(n).forEach((function(t){var e=n[t].name,r=n[t].value;Array.isArray(r)?r.forEach((function(t){a.push([e,t])})):a.push([e,r])})),"fetch"===t._mode){var c=null;if(o.abortController){var u=new AbortController;c=u.signal,t._fetchAbortController=u,"requestTimeout"in e&&0!==e.requestTimeout&&(t._fetchTimer=i.setTimeout((function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()}),e.requestTimeout))}i.fetch(t._opts.url,{method:t._opts.method,headers:a,body:r||void 0,mode:"cors",credentials:e.withCredentials?"include":"same-origin",signal:c}).then((function(e){t._fetchResponse=e,t._resetTimers(!1),t._connect()}),(function(e){t._resetTimers(!0),t._destroyed||t.emit("error",e)}))}else{var l=t._xhr=new i.XMLHttpRequest;try{l.open(t._opts.method,t._opts.url,!0)}catch(e){return void s.nextTick((function(){t.emit("error",e)}))}"responseType"in l&&(l.responseType=t._mode),"withCredentials"in l&&(l.withCredentials=!!e.withCredentials),"text"===t._mode&&"overrideMimeType"in l&&l.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in e&&(l.timeout=e.requestTimeout,l.ontimeout=function(){t.emit("requestTimeout")}),a.forEach((function(t){l.setRequestHeader(t[0],t[1])})),t._response=null,l.onreadystatechange=function(){switch(l.readyState){case h.LOADING:case h.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(l.onprogress=function(){t._onXHRProgress()}),l.onerror=function(){t._destroyed||(t._resetTimers(!0),t.emit("error",new Error("XHR error")))};try{l.send(r)}catch(e){return void s.nextTick((function(){t.emit("error",e)}))}}}},d.prototype._onXHRProgress=function(){var t=this;t._resetTimers(!1),function(t){try{var e=t.status;return null!==e&&0!==e}catch(t){return!1}}(t._xhr)&&!t._destroyed&&(t._response||t._connect(),t._response._onXHRProgress(t._resetTimers.bind(t)))},d.prototype._connect=function(){var t=this;t._destroyed||(t._response=new l(t._xhr,t._fetchResponse,t._mode,t._resetTimers.bind(t)),t._response.on("error",(function(e){t.emit("error",e)})),t.emit("response",t._response))},d.prototype._write=function(t,e,n){this._body.push(t),n()},d.prototype._resetTimers=function(t){var e=this;i.clearTimeout(e._socketTimer),e._socketTimer=null,t?(i.clearTimeout(e._fetchTimer),e._fetchTimer=null):e._socketTimeout&&(e._socketTimer=i.setTimeout((function(){e.emit("timeout")}),e._socketTimeout))},d.prototype.abort=d.prototype.destroy=function(t){var e=this;e._destroyed=!0,e._resetTimers(!0),e._response&&(e._response._destroyed=!0),e._xhr?e._xhr.abort():e._fetchAbortController&&e._fetchAbortController.abort(),t&&e.emit("error",t)},d.prototype.end=function(t,e,n){"function"==typeof t&&(n=t,t=void 0),u.Writable.prototype.end.call(this,t,e,n)},d.prototype.setTimeout=function(t,e){var n=this;e&&n.once("timeout",e),n._socketTimeout=t,n._resetTimers(!1)},d.prototype.flushHeaders=function(){},d.prototype.setNoDelay=function(){},d.prototype.setSocketKeepAlive=function(){};var p=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","via"]},3799:(t,e,n)=>{var r=n(8860),i=n(25).Buffer,s=n(2590),o=n(6086),a=n(7256),c=n(7541),u=e.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},l=e.IncomingMessage=function(t,e,n,s){var a=this;if(c.Readable.call(a),a._mode=n,a.headers={},a.rawHeaders=[],a.trailers={},a.rawTrailers=[],a.on("end",(function(){r.nextTick((function(){a.emit("close")}))})),"fetch"===n){if(a._fetchResponse=e,a.url=e.url,a.statusCode=e.status,a.statusMessage=e.statusText,e.headers.forEach((function(t,e){a.headers[e.toLowerCase()]=t,a.rawHeaders.push(e,t)})),o.writableStream){var u=new WritableStream({write:function(t){return s(!1),new Promise((function(e,n){a._destroyed?n():a.push(i.from(t))?e():a._resumeFetch=e}))},close:function(){s(!0),a._destroyed||a.push(null)},abort:function(t){s(!0),a._destroyed||a.emit("error",t)}});try{return void e.body.pipeTo(u).catch((function(t){s(!0),a._destroyed||a.emit("error",t)}))}catch(t){}}var l=e.body.getReader();!function t(){l.read().then((function(e){a._destroyed||(s(e.done),e.done?a.push(null):(a.push(i.from(e.value)),t()))})).catch((function(t){s(!0),a._destroyed||a.emit("error",t)}))}()}else{if(a._xhr=t,a._pos=0,a.url=t.responseURL,a.statusCode=t.status,a.statusMessage=t.statusText,t.getAllResponseHeaders().split(/\r?\n/).forEach((function(t){var e=t.match(/^([^:]+):\s*(.*)/);if(e){var n=e[1].toLowerCase();"set-cookie"===n?(void 0===a.headers[n]&&(a.headers[n]=[]),a.headers[n].push(e[2])):void 0!==a.headers[n]?a.headers[n]+=", "+e[2]:a.headers[n]=e[2],a.rawHeaders.push(e[1],e[2])}})),a._charset="x-user-defined",!o.overrideMimeType){var h=a.rawHeaders["mime-type"];if(h){var d=h.match(/;\s*charset=([^;])(;|$)/);d&&(a._charset=d[1].toLowerCase())}a._charset||(a._charset="utf-8")}}};a(l,c.Readable),l.prototype._read=function(){var t=this._resumeFetch;t&&(this._resumeFetch=null,t())},l.prototype._onXHRProgress=function(t){var e=this,n=e._xhr,r=null;switch(e._mode){case"text":if((r=n.responseText).length>e._pos){var o=r.substr(e._pos);if("x-user-defined"===e._charset){for(var a=i.alloc(o.length),c=0;c<o.length;c++)a[c]=255&o.charCodeAt(c);e.push(a)}else e.push(o,e._charset);e._pos=r.length}break;case"arraybuffer":if(n.readyState!==u.DONE||!n.response)break;r=n.response,e.push(i.from(new Uint8Array(r)));break;case"moz-chunked-arraybuffer":if(r=n.response,n.readyState!==u.LOADING||!r)break;e.push(i.from(new Uint8Array(r)));break;case"ms-stream":if(r=n.response,n.readyState!==u.LOADING)break;var l=new s.MSStreamReader;l.onprogress=function(){l.result.byteLength>e._pos&&(e.push(i.from(new Uint8Array(l.result.slice(e._pos)))),e._pos=l.result.byteLength)},l.onload=function(){t(!0),e.push(null)},l.readAsArrayBuffer(r)}e._xhr.readyState===u.DONE&&"ms-stream"!==e._mode&&(t(!0),e.push(null))}},6343:(t,e,n)=>{"use strict";var r=n(6085).Buffer,i=r.isEncoding||function(t){switch((t=""+t)&&t.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 s(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){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 t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===i||!i(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=c,this.end=u,e=4;break;case"utf8":this.fillLast=a,e=4;break;case"base64":this.text=l,this.end=h,e=3;break;default:return this.write=d,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function o(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function a(t){var e=this.lastTotal-this.lastNeed,n=function(t,e){if(128!=(192&e[0]))return t.lastNeed=0,"�";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"�";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"�"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function c(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function u(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function l(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function h(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function d(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}e.StringDecoder=s,s.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},s.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"�":e},s.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var i=o(e[r]);if(i>=0)return i>0&&(t.lastNeed=i-1),i;if(--r<n||-2===i)return 0;if(i=o(e[r]),i>=0)return i>0&&(t.lastNeed=i-2),i;if(--r<n||-2===i)return 0;if(i=o(e[r]),i>=0)return i>0&&(2===i?i=0:t.lastNeed=i-3),i;return 0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},s.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},6085:(t,e,n)=>{
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
var r=n(25),i=r.Buffer;function s(t,e){for(var n in t)e[n]=t[n]}function o(t,e,n){return i(t,e,n)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?t.exports=r:(s(r,e),e.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return i(t,e,n)},o.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=i(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},o.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return i(t)},o.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},1337:t=>{const e=/^[-+]?0x[a-fA-F0-9]+$/,n=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);const r={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};t.exports=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(i=Object.assign({},r,i),!t||"string"!=typeof t)return t;let s=t.trim();if(void 0!==i.skipLike&&i.skipLike.test(s))return t;if(i.hex&&e.test(s))return Number.parseInt(s,16);{const e=n.exec(s);if(e){const n=e[1],r=e[2];let o=function(t){if(t&&-1!==t.indexOf("."))return"."===(t=t.replace(/0+$/,""))?t="0":"."===t[0]?t="0"+t:"."===t[t.length-1]&&(t=t.substr(0,t.length-1)),t;return t}(e[3]);const a=e[4]||e[6];if(!i.leadingZeros&&r.length>0&&n&&"."!==s[2])return t;if(!i.leadingZeros&&r.length>0&&!n&&"."!==s[1])return t;{const e=Number(s),c=""+e;return-1!==c.search(/[eE]/)||a?i.eNotation?e:t:-1!==s.indexOf(".")?"0"===c&&""===o||c===o||n&&c==="-"+o?e:t:r?o===c||n+o===c?e:t:s===c||s===n+c?e:t}}return t}}},450:(t,e,n)=>{"use strict";var r=n(2590),i=n(4305),s=n(978),o=/^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,a=/[\n\r\t]/g,c=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,u=/:\d+$/,l=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i,h=/^[a-zA-Z]:/;function d(t){return(t||"").toString().replace(o,"")}var p=[["#","hash"],["?","query"],function(t,e){return y(e.protocol)?t.replace(/\\/g,"/"):t},["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d*)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],f={hash:1,query:1};function g(t){var e,n=("undefined"!=typeof window?window:void 0!==r?r:"undefined"!=typeof self?self:{}).location||{},i={},s=typeof(t=t||n);if("blob:"===t.protocol)i=new b(unescape(t.pathname),{});else if("string"===s)for(e in i=new b(t,{}),f)delete i[e];else if("object"===s){for(e in t)e in f||(i[e]=t[e]);void 0===i.slashes&&(i.slashes=c.test(t.href))}return i}function y(t){return"file:"===t||"ftp:"===t||"http:"===t||"https:"===t||"ws:"===t||"wss:"===t}function m(t,e){t=(t=d(t)).replace(a,""),e=e||{};var n,r=l.exec(t),i=r[1]?r[1].toLowerCase():"",s=!!r[2],o=!!r[3],c=0;return s?o?(n=r[2]+r[3]+r[4],c=r[2].length+r[3].length):(n=r[2]+r[4],c=r[2].length):o?(n=r[3]+r[4],c=r[3].length):n=r[4],"file:"===i?c>=2&&(n=n.slice(2)):y(i)?n=r[4]:i?s&&(n=n.slice(2)):c>=2&&y(e.protocol)&&(n=r[4]),{protocol:i,slashes:s||y(i),slashesCount:c,rest:n}}function b(t,e,n){if(t=(t=d(t)).replace(a,""),!(this instanceof b))return new b(t,e,n);var r,o,c,u,l,f,v=p.slice(),w=typeof e,S=this,E=0;for("object"!==w&&"string"!==w&&(n=e,e=null),n&&"function"!=typeof n&&(n=s.parse),r=!(o=m(t||"",e=g(e))).protocol&&!o.slashes,S.slashes=o.slashes||r&&e.slashes,S.protocol=o.protocol||e.protocol||"",t=o.rest,("file:"===o.protocol&&(2!==o.slashesCount||h.test(t))||!o.slashes&&(o.protocol||o.slashesCount<2||!y(S.protocol)))&&(v[3]=[/(.*)/,"pathname"]);E<v.length;E++)"function"!=typeof(u=v[E])?(c=u[0],f=u[1],c!=c?S[f]=t:"string"==typeof c?~(l="@"===c?t.lastIndexOf(c):t.indexOf(c))&&("number"==typeof u[2]?(S[f]=t.slice(0,l),t=t.slice(l+u[2])):(S[f]=t.slice(l),t=t.slice(0,l))):(l=c.exec(t))&&(S[f]=l[1],t=t.slice(0,l.index)),S[f]=S[f]||r&&u[3]&&e[f]||"",u[4]&&(S[f]=S[f].toLowerCase())):t=u(t,S);n&&(S.query=n(S.query)),r&&e.slashes&&"/"!==S.pathname.charAt(0)&&(""!==S.pathname||""!==e.pathname)&&(S.pathname=function(t,e){if(""===t)return e;for(var n=(e||"/").split("/").slice(0,-1).concat(t.split("/")),r=n.length,i=n[r-1],s=!1,o=0;r--;)"."===n[r]?n.splice(r,1):".."===n[r]?(n.splice(r,1),o++):o&&(0===r&&(s=!0),n.splice(r,1),o--);return s&&n.unshift(""),"."!==i&&".."!==i||n.push(""),n.join("/")}(S.pathname,e.pathname)),"/"!==S.pathname.charAt(0)&&y(S.protocol)&&(S.pathname="/"+S.pathname),i(S.port,S.protocol)||(S.host=S.hostname,S.port=""),S.username=S.password="",S.auth&&(~(l=S.auth.indexOf(":"))?(S.username=S.auth.slice(0,l),S.username=encodeURIComponent(decodeURIComponent(S.username)),S.password=S.auth.slice(l+1),S.password=encodeURIComponent(decodeURIComponent(S.password))):S.username=encodeURIComponent(decodeURIComponent(S.auth)),S.auth=S.password?S.username+":"+S.password:S.username),S.origin="file:"!==S.protocol&&y(S.protocol)&&S.host?S.protocol+"//"+S.host:"null",S.href=S.toString()}b.prototype={set:function(t,e,n){var r=this;switch(t){case"query":"string"==typeof e&&e.length&&(e=(n||s.parse)(e)),r[t]=e;break;case"port":r[t]=e,i(e,r.protocol)?e&&(r.host=r.hostname+":"+e):(r.host=r.hostname,r[t]="");break;case"hostname":r[t]=e,r.port&&(e+=":"+r.port),r.host=e;break;case"host":r[t]=e,u.test(e)?(e=e.split(":"),r.port=e.pop(),r.hostname=e.join(":")):(r.hostname=e,r.port="");break;case"protocol":r.protocol=e.toLowerCase(),r.slashes=!n;break;case"pathname":case"hash":if(e){var o="pathname"===t?"/":"#";r[t]=e.charAt(0)!==o?o+e:e}else r[t]=e;break;case"username":case"password":r[t]=encodeURIComponent(e);break;case"auth":var a=e.indexOf(":");~a?(r.username=e.slice(0,a),r.username=encodeURIComponent(decodeURIComponent(r.username)),r.password=e.slice(a+1),r.password=encodeURIComponent(decodeURIComponent(r.password))):r.username=encodeURIComponent(decodeURIComponent(e))}for(var c=0;c<p.length;c++){var l=p[c];l[4]&&(r[l[1]]=r[l[1]].toLowerCase())}return r.auth=r.password?r.username+":"+r.password:r.username,r.origin="file:"!==r.protocol&&y(r.protocol)&&r.host?r.protocol+"//"+r.host:"null",r.href=r.toString(),r},toString:function(t){t&&"function"==typeof t||(t=s.stringify);var e,n=this,r=n.host,i=n.protocol;i&&":"!==i.charAt(i.length-1)&&(i+=":");var o=i+(n.protocol&&n.slashes||y(n.protocol)?"//":"");return n.username?(o+=n.username,n.password&&(o+=":"+n.password),o+="@"):n.password?(o+=":"+n.password,o+="@"):"file:"!==n.protocol&&y(n.protocol)&&!r&&"/"!==n.pathname&&(o+="@"),(":"===r[r.length-1]||u.test(n.hostname)&&!n.port)&&(r+=":"),o+=r+n.pathname,(e="object"==typeof n.query?t(n.query):n.query)&&(o+="?"!==e.charAt(0)?"?"+e:e),n.hash&&(o+=n.hash),o}},b.extractProtocol=m,b.location=g,b.trimLeft=d,b.qs=s,t.exports=b},7204:function(t){var e,n,r,i,s;e=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,n=/^(?=([^\/?#]*))\1([^]*)$/,r=/(?:\/|^)\.(?=\/)/g,i=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,s={buildAbsoluteURL:function(t,e,r){if(r=r||{},t=t.trim(),!(e=e.trim())){if(!r.alwaysNormalize)return t;var i=s.parseURL(t);if(!i)throw new Error("Error trying to parse base URL.");return i.path=s.normalizePath(i.path),s.buildURLFromParts(i)}var o=s.parseURL(e);if(!o)throw new Error("Error trying to parse relative URL.");if(o.scheme)return r.alwaysNormalize?(o.path=s.normalizePath(o.path),s.buildURLFromParts(o)):e;var a=s.parseURL(t);if(!a)throw new Error("Error trying to parse base URL.");if(!a.netLoc&&a.path&&"/"!==a.path[0]){var c=n.exec(a.path);a.netLoc=c[1],a.path=c[2]}a.netLoc&&!a.path&&(a.path="/");var u={scheme:a.scheme,netLoc:o.netLoc,path:null,params:o.params,query:o.query,fragment:o.fragment};if(!o.netLoc&&(u.netLoc=a.netLoc,"/"!==o.path[0]))if(o.path){var l=a.path,h=l.substring(0,l.lastIndexOf("/")+1)+o.path;u.path=s.normalizePath(h)}else u.path=a.path,o.params||(u.params=a.params,o.query||(u.query=a.query));return null===u.path&&(u.path=r.alwaysNormalize?s.normalizePath(o.path):o.path),s.buildURLFromParts(u)},parseURL:function(t){var n=e.exec(t);return n?{scheme:n[1]||"",netLoc:n[2]||"",path:n[3]||"",params:n[4]||"",query:n[5]||"",fragment:n[6]||""}:null},normalizePath:function(t){for(t=t.split("").reverse().join("").replace(r,"");t.length!==(t=t.replace(i,"")).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},3228:function(t,e,n){t=n.nmd(t);var r,i=n(2590);!function(){e&&e.nodeType,t&&t.nodeType;var s="object"==typeof i&&i;s.global!==s&&s.window!==s&&s.self;var o,a=2147483647,c=36,u=/^xn--/,l=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,d={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,f=String.fromCharCode;function g(t){throw RangeError(d[t])}function y(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function m(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+y((t=t.replace(h,".")).split("."),e).join(".")}function b(t){for(var e,n,r=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(n=t.charCodeAt(i++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--):r.push(e);return r}function v(t){return y(t,(function(t){var e="";return t>65535&&(e+=f((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=f(t)})).join("")}function w(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function S(t,e,n){var r=0;for(t=n?p(t/700):t>>1,t+=p(t/e);t>455;r+=c)t=p(t/35);return p(r+36*t/(t+38))}function E(t){var e,n,r,i,s,o,u,l,h,d,f,y=[],m=t.length,b=0,w=128,E=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&g("not-basic"),y.push(t.charCodeAt(r));for(i=n>0?n+1:0;i<m;){for(s=b,o=1,u=c;i>=m&&g("invalid-input"),((l=(f=t.charCodeAt(i++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:c)>=c||l>p((a-b)/o))&&g("overflow"),b+=l*o,!(l<(h=u<=E?1:u>=E+26?26:u-E));u+=c)o>p(a/(d=c-h))&&g("overflow"),o*=d;E=S(b-s,e=y.length+1,0==s),p(b/e)>a-w&&g("overflow"),w+=p(b/e),b%=e,y.splice(b++,0,w)}return v(y)}function _(t){var e,n,r,i,s,o,u,l,h,d,y,m,v,E,_,C=[];for(m=(t=b(t)).length,e=128,n=0,s=72,o=0;o<m;++o)(y=t[o])<128&&C.push(f(y));for(r=i=C.length,i&&C.push("-");r<m;){for(u=a,o=0;o<m;++o)(y=t[o])>=e&&y<u&&(u=y);for(u-e>p((a-n)/(v=r+1))&&g("overflow"),n+=(u-e)*v,e=u,o=0;o<m;++o)if((y=t[o])<e&&++n>a&&g("overflow"),y==e){for(l=n,h=c;!(l<(d=h<=s?1:h>=s+26?26:h-s));h+=c)_=l-d,E=c-d,C.push(f(w(d+_%E,0))),l=p(_/E);C.push(f(w(l,0))),s=S(n,v,r==i),n=0,++r}++n,++e}return C.join("")}o={version:"1.3.2",ucs2:{decode:b,encode:v},decode:E,encode:_,toASCII:function(t){return m(t,(function(t){return l.test(t)?"xn--"+_(t):t}))},toUnicode:function(t){return m(t,(function(t){return u.test(t)?E(t.slice(4).toLowerCase()):t}))}},void 0===(r=function(){return o}.call(e,n,e,t))||(t.exports=r)}()},8189:(t,e,n)=>{"use strict";var r=n(3228),i=n(1686);function s(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}e.parse=v,e.resolve=function(t,e){return v(t,!1,!0).resolve(e)},e.resolveObject=function(t,e){return t?v(t,!1,!0).resolveObject(e):e},e.format=function(t){i.isString(t)&&(t=v(t));return t instanceof s?t.format():s.prototype.format.call(t)},e.Url=s;var o=/^([a-z0-9.+-]+:)/i,a=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(u),h=["%","/","?",";","#"].concat(l),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,f=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},y={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=n(9300);function v(t,e,n){if(t&&i.isObject(t)&&t instanceof s)return t;var r=new s;return r.parse(t,e,n),r}s.prototype.parse=function(t,e,n){if(!i.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var s=t.indexOf("?"),a=-1!==s&&s<t.indexOf("#")?"?":"#",u=t.split(a);u[0]=u[0].replace(/\\/g,"/");var v=t=u.join(a);if(v=v.trim(),!n&&1===t.split("#").length){var w=c.exec(v);if(w)return this.path=v,this.href=v,this.pathname=w[1],w[2]?(this.search=w[2],this.query=e?b.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var S=o.exec(v);if(S){var E=(S=S[0]).toLowerCase();this.protocol=E,v=v.substr(S.length)}if(n||S||v.match(/^\/\/[^@\/]+@[^@\/]+/)){var _="//"===v.substr(0,2);!_||S&&y[S]||(v=v.substr(2),this.slashes=!0)}if(!y[S]&&(_||S&&!m[S])){for(var C,T,I=-1,N=0;N<d.length;N++){-1!==(R=v.indexOf(d[N]))&&(-1===I||R<I)&&(I=R)}-1!==(T=-1===I?v.lastIndexOf("@"):v.lastIndexOf("@",I))&&(C=v.slice(0,T),v=v.slice(T+1),this.auth=decodeURIComponent(C)),I=-1;for(N=0;N<h.length;N++){var R;-1!==(R=v.indexOf(h[N]))&&(-1===I||R<I)&&(I=R)}-1===I&&(I=v.length),this.host=v.slice(0,I),v=v.slice(I),this.parseHost(),this.hostname=this.hostname||"";var O="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!O)for(var A=this.hostname.split(/\./),x=(N=0,A.length);N<x;N++){var P=A[N];if(P&&!P.match(p)){for(var k="",L=0,D=P.length;L<D;L++)P.charCodeAt(L)>127?k+="x":k+=P[L];if(!k.match(p)){var M=A.slice(0,N),B=A.slice(N+1),F=P.match(f);F&&(M.push(F[1]),B.unshift(F[2])),B.length&&(v="/"+B.join(".")+v),this.hostname=M.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var j=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+j,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==v[0]&&(v="/"+v))}if(!g[E])for(N=0,x=l.length;N<x;N++){var $=l[N];if(-1!==v.indexOf($)){var q=encodeURIComponent($);q===$&&(q=escape($)),v=v.split($).join(q)}}var H=v.indexOf("#");-1!==H&&(this.hash=v.substr(H),v=v.slice(0,H));var W=v.indexOf("?");if(-1!==W?(this.search=v.substr(W),this.query=v.substr(W+1),e&&(this.query=b.parse(this.query)),v=v.slice(0,W)):e&&(this.search="",this.query={}),v&&(this.pathname=v),m[E]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){j=this.pathname||"";var V=this.search||"";this.path=j+V}return this.href=this.format(),this},s.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",s=!1,o="";this.host?s=t+this.host:this.hostname&&(s=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(s+=":"+this.port)),this.query&&i.isObject(this.query)&&Object.keys(this.query).length&&(o=b.stringify(this.query));var a=this.search||o&&"?"+o||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||m[e])&&!1!==s?(s="//"+(s||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):s||(s=""),r&&"#"!==r.charAt(0)&&(r="#"+r),a&&"?"!==a.charAt(0)&&(a="?"+a),e+s+(n=n.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(a=a.replace("#","%23"))+r},s.prototype.resolve=function(t){return this.resolveObject(v(t,!1,!0)).format()},s.prototype.resolveObject=function(t){if(i.isString(t)){var e=new s;e.parse(t,!1,!0),t=e}for(var n=new s,r=Object.keys(this),o=0;o<r.length;o++){var a=r[o];n[a]=this[a]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var c=Object.keys(t),u=0;u<c.length;u++){var l=c[u];"protocol"!==l&&(n[l]=t[l])}return m[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!m[t.protocol]){for(var h=Object.keys(t),d=0;d<h.length;d++){var p=h[d];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||y[t.protocol])n.pathname=t.pathname;else{for(var f=(t.pathname||"").split("/");f.length&&!(t.host=f.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==f[0]&&f.unshift(""),f.length<2&&f.unshift(""),n.pathname=f.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var g=n.pathname||"",b=n.search||"";n.path=g+b}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var v=n.pathname&&"/"===n.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),S=w||v||n.host&&t.pathname,E=S,_=n.pathname&&n.pathname.split("/")||[],C=(f=t.pathname&&t.pathname.split("/")||[],n.protocol&&!m[n.protocol]);if(C&&(n.hostname="",n.port=null,n.host&&(""===_[0]?_[0]=n.host:_.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===f[0]?f[0]=t.host:f.unshift(t.host)),t.host=null),S=S&&(""===f[0]||""===_[0])),w)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,_=f;else if(f.length)_||(_=[]),_.pop(),_=_.concat(f),n.search=t.search,n.query=t.query;else if(!i.isNullOrUndefined(t.search)){if(C)n.hostname=n.host=_.shift(),(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift());return n.search=t.search,n.query=t.query,i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n}if(!_.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var T=_.slice(-1)[0],I=(n.host||t.host||_.length>1)&&("."===T||".."===T)||""===T,N=0,R=_.length;R>=0;R--)"."===(T=_[R])?_.splice(R,1):".."===T?(_.splice(R,1),N++):N&&(_.splice(R,1),N--);if(!S&&!E)for(;N--;N)_.unshift("..");!S||""===_[0]||_[0]&&"/"===_[0].charAt(0)||_.unshift(""),I&&"/"!==_.join("/").substr(-1)&&_.push("");var O,A=""===_[0]||_[0]&&"/"===_[0].charAt(0);C&&(n.hostname=n.host=A?"":_.length?_.shift():"",(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift()));return(S=S||n.host&&_.length)&&!A&&_.unshift(""),_.length?n.pathname=_.join("/"):(n.pathname=null,n.path=null),i.isNull(n.pathname)&&i.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},s.prototype.parseHost=function(){var t=this.host,e=a.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},1686:t=>{"use strict";t.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},7873:(t,e,n)=>{var r=n(2590);function i(t){try{if(!r.localStorage)return!1}catch(t){return!1}var e=r.localStorage[t];return null!=e&&"true"===String(e).toLowerCase()}t.exports=function(t,e){if(i("noDeprecation"))return t;var n=!1;return function(){if(!n){if(i("throwDeprecation"))throw new Error(e);i("traceDeprecation")?console.trace(e):console.warn(e),n=!0}return t.apply(this,arguments)}}},928:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){(0,r.default)(t),(e=(0,i.default)(e,o)).allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1));!0===e.allow_wildcard&&0===t.indexOf("*.")&&(t=t.substring(2));var n=t.split("."),s=n[n.length-1];if(e.require_tld){if(n.length<2)return!1;if(!/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(s))return!1;if(/\s/.test(s))return!1}if(!e.allow_numeric_tld&&/^\d+$/.test(s))return!1;return n.every((function(t){return!(t.length>63)&&(!!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(t)&&(!/[\uff01-\uff5e]/.test(t)&&(!/^-|-$/.test(t)&&!(!e.allow_underscores&&/_/.test(t)))))}))};var r=s(n(6013)),i=s(n(3272));function s(t){return t&&t.__esModule?t:{default:t}}var o={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_numeric_tld:!1,allow_wildcard:!1};t.exports=e.default,t.exports.default=e.default},7410:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if((0,i.default)(e),!(n=String(n)))return t(e,4)||t(e,6);if("4"===n){return!!a.test(e)&&e.split(".").sort((function(t,e){return t-e}))[3]<=255}if("6"===n)return!!u.test(e);return!1};var r,i=(r=n(6013))&&r.__esModule?r:{default:r};var s="(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",o="(".concat(s,"[.]){3}").concat(s),a=new RegExp("^".concat(o,"$")),c="(?:[0-9a-fA-F]{1,4})",u=new RegExp("^("+"(?:".concat(c,":){7}(?:").concat(c,"|:)|")+"(?:".concat(c,":){6}(?:").concat(o,"|:").concat(c,"|:)|")+"(?:".concat(c,":){5}(?::").concat(o,"|(:").concat(c,"){1,2}|:)|")+"(?:".concat(c,":){4}(?:(:").concat(c,"){0,1}:").concat(o,"|(:").concat(c,"){1,3}|:)|")+"(?:".concat(c,":){3}(?:(:").concat(c,"){0,2}:").concat(o,"|(:").concat(c,"){1,4}|:)|")+"(?:".concat(c,":){2}(?:(:").concat(c,"){0,3}:").concat(o,"|(:").concat(c,"){1,5}|:)|")+"(?:".concat(c,":){1}(?:(:").concat(c,"){0,4}:").concat(o,"|(:").concat(c,"){1,6}|:)|")+"(?::((?::".concat(c,"){0,5}:").concat(o,"|(?::").concat(c,"){1,7}|:))")+")(%[0-9a-zA-Z-.:]{1,})?$");t.exports=e.default,t.exports.default=e.default},538:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e){if((0,r.default)(t),!t||/[\s<>]/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;if((e=(0,o.default)(e,u)).validate_length&&t.length>=2083)return!1;if(!e.allow_fragments&&t.includes("#"))return!1;if(!e.allow_query_components&&(t.includes("?")||t.includes("&")))return!1;var n,a,d,p,f,g,y,m;if(y=t.split("#"),t=y.shift(),y=t.split("?"),t=y.shift(),(y=t.split("://")).length>1){if(n=y.shift().toLowerCase(),e.require_valid_protocol&&-1===e.protocols.indexOf(n))return!1}else{if(e.require_protocol)return!1;if("//"===t.substr(0,2)){if(!e.allow_protocol_relative_urls)return!1;y[0]=t.substr(2)}}if(""===(t=y.join("://")))return!1;if(y=t.split("/"),""===(t=y.shift())&&!e.require_host)return!0;if((y=t.split("@")).length>1){if(e.disallow_auth)return!1;if(""===y[0])return!1;if((a=y.shift()).indexOf(":")>=0&&a.split(":").length>2)return!1;var b=a.split(":"),v=(_=2,function(t){if(Array.isArray(t))return t}(E=b)||function(t,e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t)){var n=[],r=!0,i=!1,s=void 0;try{for(var o,a=t[Symbol.iterator]();!(r=(o=a.next()).done)&&(n.push(o.value),!e||n.length!==e);r=!0);}catch(t){i=!0,s=t}finally{try{r||null==a.return||a.return()}finally{if(i)throw s}}return n}}(E,_)||function(t,e){if(t){if("string"==typeof t)return c(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(t,e):void 0}}(E,_)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),w=v[0],S=v[1];if(""===w&&""===S)return!1}var E,_;p=y.join("@"),g=null,m=null;var C=p.match(l);C?(d="",m=C[1],g=C[2]||null):(d=(y=p.split(":")).shift(),y.length&&(g=y.join(":")));if(null!==g&&g.length>0){if(f=parseInt(g,10),!/^[0-9]+$/.test(g)||f<=0||f>65535)return!1}else if(e.require_port)return!1;if(e.host_whitelist)return h(d,e.host_whitelist);if(!((0,s.default)(d)||(0,i.default)(d,e)||m&&(0,s.default)(m,6)))return!1;if(d=d||m,e.host_blacklist&&h(d,e.host_blacklist))return!1;return!0};var r=a(n(6013)),i=a(n(928)),s=a(n(7410)),o=a(n(3272));function a(t){return t&&t.__esModule?t:{default:t}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var u={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0},l=/^\[([^\]]+)\](?::([0-9]+))?$/;function h(t,e){for(var n=0;n<e.length;n++){var r=e[n];if(t===r||(i=r,"[object RegExp]"===Object.prototype.toString.call(i)&&r.test(t)))return!0}var i;return!1}t.exports=e.default,t.exports.default=e.default},6013:(t,e)=>{"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t){if(!("string"==typeof t||t instanceof String)){var e=n(t);throw null===t?e="null":"object"===e&&(e=t.constructor.name),new TypeError("Expected a string but received a ".concat(e))}},t.exports=e.default,t.exports.default=e.default},3272:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1?arguments[1]:void 0;for(var n in e)void 0===t[n]&&(t[n]=e[n]);return t},t.exports=e.default,t.exports.default=e.default},5576:t=>{t.exports=function(){for(var t={},n=0;n<arguments.length;n++){var r=arguments[n];for(var i in r)e.call(r,i)&&(t[i]=r[i])}return t};var e=Object.prototype.hasOwnProperty},718:(t,e,n)=>{"use strict";const{AbortError:r,codes:i}=n(4226),s=n(1577),{ERR_INVALID_ARG_TYPE:o}=i;t.exports.addAbortSignal=function(e,n){if(((t,e)=>{if("object"!=typeof t||!("aborted"in t))throw new o(e,"AbortSignal",t)})(e,"signal"),!(r=n)||"function"!=typeof r.pipe)throw new o("stream","stream.Stream",n);var r;return t.exports.addAbortSignalNoValidate(e,n)},t.exports.addAbortSignalNoValidate=function(t,e){if("object"!=typeof t||!("aborted"in t))return e;const n=()=>{e.destroy(new r(void 0,{cause:t.reason}))};return t.aborted?n():(t.addEventListener("abort",n),s(e,(()=>t.removeEventListener("abort",n)))),e}},7150:(t,e,n)=>{"use strict";const{StringPrototypeSlice:r,SymbolIterator:i,TypedArrayPrototypeSet:s,Uint8Array:o}=n(1117),{Buffer:a}=n(25),{inspect:c}=n(7757);t.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){const e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length}unshift(t){const e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length}shift(){if(0===this.length)return;const t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(0===this.length)return"";let e=this.head,n=""+e.data;for(;null!==(e=e.next);)n+=t+e.data;return n}concat(t){if(0===this.length)return a.alloc(0);const e=a.allocUnsafe(t>>>0);let n=this.head,r=0;for(;n;)s(e,n.data,r),r+=n.data.length,n=n.next;return e}consume(t,e){const n=this.head.data;if(t<n.length){const e=n.slice(0,t);return this.head.data=n.slice(t),e}return t===n.length?this.shift():e?this._getString(t):this._getBuffer(t)}first(){return this.head.data}*[i](){for(let t=this.head;t;t=t.next)yield t.data}_getString(t){let e="",n=this.head,i=0;do{const s=n.data;if(!(t>s.length)){t===s.length?(e+=s,++i,n.next?this.head=n.next:this.head=this.tail=null):(e+=r(s,0,t),this.head=n,n.data=r(s,t));break}e+=s,t-=s.length,++i}while(null!==(n=n.next));return this.length-=i,e}_getBuffer(t){const e=a.allocUnsafe(t),n=t;let r=this.head,i=0;do{const a=r.data;if(!(t>a.length)){t===a.length?(s(e,a,n-t),++i,r.next?this.head=r.next:this.head=this.tail=null):(s(e,new o(a.buffer,a.byteOffset,t),n-t),this.head=r,r.data=a.slice(t));break}s(e,a,n-t),t-=a.length,++i}while(null!==(r=r.next));return this.length-=i,e}[Symbol.for("nodejs.util.inspect.custom")](t,e){return c(this,{...e,depth:0,customInspect:!1})}}},6893:(t,e,n)=>{"use strict";const{pipeline:r}=n(5675),i=n(5763),{destroyer:s}=n(8883),{isNodeStream:o,isReadable:a,isWritable:c}=n(52),{AbortError:u,codes:{ERR_INVALID_ARG_VALUE:l,ERR_MISSING_ARGS:h}}=n(4226);t.exports=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];if(0===e.length)throw new h("streams");if(1===e.length)return i.from(e[0]);const d=[...e];if("function"==typeof e[0]&&(e[0]=i.from(e[0])),"function"==typeof e[e.length-1]){const t=e.length-1;e[t]=i.from(e[t])}for(let t=0;t<e.length;++t)if(o(e[t])){if(t<e.length-1&&!a(e[t]))throw new l(`streams[${t}]`,d[t],"must be readable");if(t>0&&!c(e[t]))throw new l(`streams[${t}]`,d[t],"must be writable")}let p,f,g,y,m;const b=e[0],v=r(e,(function(t){const e=y;y=null,e?e(t):t?m.destroy(t):S||w||m.destroy()})),w=!!c(b),S=!!a(v);return m=new i({writableObjectMode:!(null==b||!b.writableObjectMode),readableObjectMode:!(null==v||!v.writableObjectMode),writable:w,readable:S}),w&&(m._write=function(t,e,n){b.write(t,e)?n():p=n},m._final=function(t){b.end(),f=t},b.on("drain",(function(){if(p){const t=p;p=null,t()}})),v.on("finish",(function(){if(f){const t=f;f=null,t()}}))),S&&(v.on("readable",(function(){if(g){const t=g;g=null,t()}})),v.on("end",(function(){m.push(null)})),m._read=function(){for(;;){const t=v.read();if(null===t)return void(g=m._read);if(!m.push(t))return}}),m._destroy=function(t,e){t||null===y||(t=new u),g=null,p=null,f=null,null===y?e(t):(y=e,s(v,t))},m}},8883:(t,e,n)=>{"use strict";const r=n(8860),{aggregateTwoErrors:i,codes:{ERR_MULTIPLE_CALLBACK:s},AbortError:o}=n(4226),{Symbol:a}=n(1117),{kDestroyed:c,isDestroyed:u,isFinished:l,isServerRequest:h}=n(52),d=a("kDestroy"),p=a("kConstruct");function f(t,e,n){t&&(t.stack,e&&!e.errored&&(e.errored=t),n&&!n.errored&&(n.errored=t))}function g(t,e,n){let i=!1;function s(e){if(i)return;i=!0;const s=t._readableState,o=t._writableState;f(e,o,s),o&&(o.closed=!0),s&&(s.closed=!0),"function"==typeof n&&n(e),e?r.nextTick(y,t,e):r.nextTick(m,t)}try{t._destroy(e||null,s)}catch(e){s(e)}}function y(t,e){b(t,e),m(t)}function m(t){const e=t._readableState,n=t._writableState;n&&(n.closeEmitted=!0),e&&(e.closeEmitted=!0),(n&&n.emitClose||e&&e.emitClose)&&t.emit("close")}function b(t,e){const n=t._readableState,r=t._writableState;r&&r.errorEmitted||n&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),t.emit("error",e))}function v(t,e,n){const i=t._readableState,s=t._writableState;if(s&&s.destroyed||i&&i.destroyed)return this;i&&i.autoDestroy||s&&s.autoDestroy?t.destroy(e):e&&(e.stack,s&&!s.errored&&(s.errored=e),i&&!i.errored&&(i.errored=e),n?r.nextTick(b,t,e):b(t,e))}function w(t){let e=!1;function n(n){if(e)return void v(t,null!=n?n:new s);e=!0;const i=t._readableState,o=t._writableState,a=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),a.destroyed?t.emit(d,n):n?v(t,n,!0):r.nextTick(S,t)}try{t._construct(n)}catch(t){n(t)}}function S(t){t.emit(p)}function E(t){return t&&t.setHeader&&"function"==typeof t.abort}function _(t){t.emit("close")}function C(t,e){t.emit("error",e),r.nextTick(_,t)}t.exports={construct:function(t,e){if("function"!=typeof t._construct)return;const n=t._readableState,i=t._writableState;n&&(n.constructed=!1),i&&(i.constructed=!1),t.once(p,e),t.listenerCount(p)>1||r.nextTick(w,t)},destroyer:function(t,e){t&&!u(t)&&(e||l(t)||(e=new o),h(t)?(t.socket=null,t.destroy(e)):E(t)?t.abort():E(t.req)?t.req.abort():"function"==typeof t.destroy?t.destroy(e):"function"==typeof t.close?t.close():e?r.nextTick(C,t,e):r.nextTick(_,t),t.destroyed||(t[c]=!0))},destroy:function(t,e){const n=this._readableState,r=this._writableState,s=r||n;return r&&r.destroyed||n&&n.destroyed?("function"==typeof e&&e(),this):(f(t,r,n),r&&(r.destroyed=!0),n&&(n.destroyed=!0),s.constructed?g(this,t,e):this.once(d,(function(n){g(this,i(n,t),e)})),this)},undestroy:function(){const t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=!1===t.readable,t.endEmitted=!1===t.readable),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=!1===e.writable,e.ending=!1===e.writable,e.finished=!1===e.writable)},errorOrDestroy:v}},5763:(t,e,n)=>{"use strict";const{ObjectDefineProperties:r,ObjectGetOwnPropertyDescriptor:i,ObjectKeys:s,ObjectSetPrototypeOf:o}=n(1117);t.exports=u;const a=n(609),c=n(9185);o(u.prototype,a.prototype),o(u,a);{const t=s(c.prototype);for(let e=0;e<t.length;e++){const n=t[e];u.prototype[n]||(u.prototype[n]=c.prototype[n])}}function u(t){if(!(this instanceof u))return new u(t);a.call(this,t),c.call(this,t),t?(this.allowHalfOpen=!1!==t.allowHalfOpen,!1===t.readable&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===t.writable&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}let l,h;function d(){return void 0===l&&(l={}),l}r(u.prototype,{writable:{__proto__:null,...i(c.prototype,"writable")},writableHighWaterMark:{__proto__:null,...i(c.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...i(c.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...i(c.prototype,"writableBuffer")},writableLength:{__proto__:null,...i(c.prototype,"writableLength")},writableFinished:{__proto__:null,...i(c.prototype,"writableFinished")},writableCorked:{__proto__:null,...i(c.prototype,"writableCorked")},writableEnded:{__proto__:null,...i(c.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...i(c.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed&&this._writableState.destroyed)},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}}),u.fromWeb=function(t,e){return d().newStreamDuplexFromReadableWritablePair(t,e)},u.toWeb=function(t){return d().newReadableWritablePairFromDuplex(t)},u.from=function(t){return h||(h=n(3310)),h(t,"body")}},3310:(t,e,n)=>{const r=n(8860),i=n(25),{isReadable:s,isWritable:o,isIterable:a,isNodeStream:c,isReadableNodeStream:u,isWritableNodeStream:l,isDuplexNodeStream:h}=n(52),d=n(1577),{AbortError:p,codes:{ERR_INVALID_ARG_TYPE:f,ERR_INVALID_RETURN_VALUE:g}}=n(4226),{destroyer:y}=n(8883),m=n(5763),b=n(609),{createDeferredPromise:v}=n(7757),w=n(7809),S=globalThis.Blob||i.Blob,E=void 0!==S?function(t){return t instanceof S}:function(t){return!1},_=globalThis.AbortController||n(4674).AbortController,{FunctionPrototypeCall:C}=n(1117);class T extends m{constructor(t){super(t),!1===(null==t?void 0:t.readable)&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),!1===(null==t?void 0:t.writable)&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}function I(t){const e=t.readable&&"function"!=typeof t.readable.read?b.wrap(t.readable):t.readable,n=t.writable;let r,i,a,c,u,l=!!s(e),h=!!o(n);function f(t){const e=c;c=null,e?e(t):t?u.destroy(t):l||h||u.destroy()}return u=new T({readableObjectMode:!(null==e||!e.readableObjectMode),writableObjectMode:!(null==n||!n.writableObjectMode),readable:l,writable:h}),h&&(d(n,(t=>{h=!1,t&&y(e,t),f(t)})),u._write=function(t,e,i){n.write(t,e)?i():r=i},u._final=function(t){n.end(),i=t},n.on("drain",(function(){if(r){const t=r;r=null,t()}})),n.on("finish",(function(){if(i){const t=i;i=null,t()}}))),l&&(d(e,(t=>{l=!1,t&&y(e,t),f(t)})),e.on("readable",(function(){if(a){const t=a;a=null,t()}})),e.on("end",(function(){u.push(null)})),u._read=function(){for(;;){const t=e.read();if(null===t)return void(a=u._read);if(!u.push(t))return}}),u._destroy=function(t,s){t||null===c||(t=new p),a=null,r=null,i=null,null===c?s(t):(c=s,y(n,t),y(e,t))},u}t.exports=function t(e,n){if(h(e))return e;if(u(e))return I({readable:e});if(l(e))return I({writable:e});if(c(e))return I({writable:!1,readable:!1});if("function"==typeof e){const{value:t,write:i,final:s,destroy:o}=function(t){let{promise:e,resolve:n}=v();const i=new _,s=i.signal,o=t(async function*(){for(;;){const t=e;e=null;const{chunk:i,done:o,cb:a}=await t;if(r.nextTick(a),o)return;if(s.aborted)throw new p(void 0,{cause:s.reason});({promise:e,resolve:n}=v()),yield i}}(),{signal:s});return{value:o,write(t,e,r){const i=n;n=null,i({chunk:t,done:!1,cb:r})},final(t){const e=n;n=null,e({done:!0,cb:t})},destroy(t,e){i.abort(),e(t)}}}(e);if(a(t))return w(T,t,{objectMode:!0,write:i,final:s,destroy:o});const c=null==t?void 0:t.then;if("function"==typeof c){let e;const n=C(c,t,(t=>{if(null!=t)throw new g("nully","body",t)}),(t=>{y(e,t)}));return e=new T({objectMode:!0,readable:!1,write:i,final(t){s((async()=>{try{await n,r.nextTick(t,null)}catch(e){r.nextTick(t,e)}}))},destroy:o})}throw new g("Iterable, AsyncIterable or AsyncFunction",n,t)}if(E(e))return t(e.arrayBuffer());if(a(e))return w(T,e,{objectMode:!0,writable:!1});if("object"==typeof(null==e?void 0:e.writable)||"object"==typeof(null==e?void 0:e.readable)){return I({readable:null!=e&&e.readable?u(null==e?void 0:e.readable)?null==e?void 0:e.readable:t(e.readable):void 0,writable:null!=e&&e.writable?l(null==e?void 0:e.writable)?null==e?void 0:e.writable:t(e.writable):void 0})}const i=null==e?void 0:e.then;if("function"==typeof i){let t;return C(i,e,(e=>{null!=e&&t.push(e),t.push(null)}),(e=>{y(t,e)})),t=new T({objectMode:!0,writable:!1,read(){}})}throw new f(n,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)}},1577:(t,e,n)=>{const r=n(8860),{AbortError:i,codes:s}=n(4226),{ERR_INVALID_ARG_TYPE:o,ERR_STREAM_PREMATURE_CLOSE:a}=s,{kEmptyObject:c,once:u}=n(7757),{validateAbortSignal:l,validateFunction:h,validateObject:d}=n(5636),{Promise:p}=n(1117),{isClosed:f,isReadable:g,isReadableNodeStream:y,isReadableFinished:m,isReadableErrored:b,isWritable:v,isWritableNodeStream:w,isWritableFinished:S,isWritableErrored:E,isNodeStream:_,willEmitClose:C}=n(52);const T=()=>{};function I(t,e,n){var s,p;2===arguments.length?(n=e,e=c):null==e?e=c:d(e,"options"),h(n,"callback"),l(e.signal,"options.signal"),n=u(n);const I=null!==(s=e.readable)&&void 0!==s?s:y(t),N=null!==(p=e.writable)&&void 0!==p?p:w(t);if(!_(t))throw new o("stream","Stream",t);const R=t._writableState,O=t._readableState,A=()=>{t.writable||k()};let x=C(t)&&y(t)===I&&w(t)===N,P=S(t,!1);const k=()=>{P=!0,t.destroyed&&(x=!1),(!x||t.readable&&!I)&&(I&&!L||n.call(t))};let L=m(t,!1);const D=()=>{L=!0,t.destroyed&&(x=!1),(!x||t.writable&&!N)&&(N&&!P||n.call(t))},M=e=>{n.call(t,e)};let B=f(t);const F=()=>{B=!0;const e=E(t)||b(t);return e&&"boolean"!=typeof e?n.call(t,e):I&&!L&&y(t,!0)&&!m(t,!1)?n.call(t,new a):!N||P||S(t,!1)?void n.call(t):n.call(t,new a)},j=()=>{t.req.on("finish",k)};!function(t){return t.setHeader&&"function"==typeof t.abort}(t)?N&&!R&&(t.on("end",A),t.on("close",A)):(t.on("complete",k),x||t.on("abort",F),t.req?j():t.on("request",j)),x||"boolean"!=typeof t.aborted||t.on("aborted",F),t.on("end",D),t.on("finish",k),!1!==e.error&&t.on("error",M),t.on("close",F),B?r.nextTick(F):null!=R&&R.errorEmitted||null!=O&&O.errorEmitted?x||r.nextTick(F):(I||x&&!g(t)||!P&&!1!==v(t))&&(N||x&&!v(t)||!L&&!1!==g(t))?O&&t.req&&t.aborted&&r.nextTick(F):r.nextTick(F);const U=()=>{n=T,t.removeListener("aborted",F),t.removeListener("complete",k),t.removeListener("abort",F),t.removeListener("request",j),t.req&&t.req.removeListener("finish",k),t.removeListener("end",A),t.removeListener("close",A),t.removeListener("finish",k),t.removeListener("end",D),t.removeListener("error",M),t.removeListener("close",F)};if(e.signal&&!B){const s=()=>{const r=n;U(),r.call(t,new i(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)r.nextTick(s);else{const r=n;n=u((function(){e.signal.removeEventListener("abort",s);for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];r.apply(t,i)})),e.signal.addEventListener("abort",s)}}return U}t.exports=I,t.exports.finished=function(t,e){return new p(((n,r)=>{I(t,e,(t=>{t?r(t):n()}))}))}},7809:(t,e,n)=>{"use strict";const r=n(8860),{PromisePrototypeThen:i,SymbolAsyncIterator:s,SymbolIterator:o}=n(1117),{Buffer:a}=n(25),{ERR_INVALID_ARG_TYPE:c,ERR_STREAM_NULL_VALUES:u}=n(4226).codes;t.exports=function(t,e,n){let l,h;if("string"==typeof e||e instanceof a)return new t({objectMode:!0,...n,read(){this.push(e),this.push(null)}});if(e&&e[s])h=!0,l=e[s]();else{if(!e||!e[o])throw new c("iterable",["Iterable"],e);h=!1,l=e[o]()}const d=new t({objectMode:!0,highWaterMark:1,...n});let p=!1;return d._read=function(){p||(p=!0,async function(){for(;;){try{const{value:t,done:e}=h?await l.next():l.next();if(e)d.push(null);else{const e=t&&"function"==typeof t.then?await t:t;if(null===e)throw p=!1,new u;if(d.push(e))continue;p=!1}}catch(t){d.destroy(t)}break}}())},d._destroy=function(t,e){i(async function(t){const e=null!=t,n="function"==typeof l.throw;if(e&&n){const{value:e,done:n}=await l.throw(t);if(await e,n)return}if("function"==typeof l.return){const{value:t}=await l.return();await t}}(t),(()=>r.nextTick(e,t)),(n=>r.nextTick(e,n||t)))},d}},98:(t,e,n)=>{"use strict";const{ArrayIsArray:r,ObjectSetPrototypeOf:i}=n(1117),{EventEmitter:s}=n(5121);function o(t){s.call(this,t)}function a(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?r(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}i(o.prototype,s.prototype),i(o,s),o.prototype.pipe=function(t,e){const n=this;function r(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",r),t.on("drain",i),t._isStdio||e&&!1===e.end||(n.on("end",c),n.on("close",u));let o=!1;function c(){o||(o=!0,t.end())}function u(){o||(o=!0,"function"==typeof t.destroy&&t.destroy())}function l(t){h(),0===s.listenerCount(this,"error")&&this.emit("error",t)}function h(){n.removeListener("data",r),t.removeListener("drain",i),n.removeListener("end",c),n.removeListener("close",u),n.removeListener("error",l),t.removeListener("error",l),n.removeListener("end",h),n.removeListener("close",h),t.removeListener("close",h)}return a(n,"error",l),a(t,"error",l),n.on("end",h),n.on("close",h),t.on("close",h),t.emit("pipe",n),t},t.exports={Stream:o,prependListener:a}},7048:(t,e,n)=>{"use strict";const r=globalThis.AbortController||n(4674).AbortController,{codes:{ERR_INVALID_ARG_TYPE:i,ERR_MISSING_ARGS:s,ERR_OUT_OF_RANGE:o},AbortError:a}=n(4226),{validateAbortSignal:c,validateInteger:u,validateObject:l}=n(5636),h=n(1117).Symbol("kWeak"),{finished:d}=n(1577),{ArrayPrototypePush:p,MathFloor:f,Number:g,NumberIsNaN:y,Promise:m,PromiseReject:b,PromisePrototypeThen:v,Symbol:w}=n(1117),S=w("kEmpty"),E=w("kEof");function _(t,e){if("function"!=typeof t)throw new i("fn",["Function","AsyncFunction"],t);null!=e&&l(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal");let n=1;return null!=(null==e?void 0:e.concurrency)&&(n=f(e.concurrency)),u(n,"concurrency",1),async function*(){var i,s;const o=new r,c=this,u=[],l=o.signal,h={signal:l},d=()=>o.abort();let p,f;null!=e&&null!==(i=e.signal)&&void 0!==i&&i.aborted&&d(),null==e||null===(s=e.signal)||void 0===s||s.addEventListener("abort",d);let g=!1;function y(){g=!0}!async function(){try{for await(let e of c){var r;if(g)return;if(l.aborted)throw new a;try{e=t(e,h)}catch(t){e=b(t)}e!==S&&("function"==typeof(null===(r=e)||void 0===r?void 0:r.catch)&&e.catch(y),u.push(e),p&&(p(),p=null),!g&&u.length&&u.length>=n&&await new m((t=>{f=t})))}u.push(E)}catch(t){const e=b(t);v(e,void 0,y),u.push(e)}finally{var i;g=!0,p&&(p(),p=null),null==e||null===(i=e.signal)||void 0===i||i.removeEventListener("abort",d)}}();try{for(;;){for(;u.length>0;){const t=await u[0];if(t===E)return;if(l.aborted)throw new a;t!==S&&(yield t),u.shift(),f&&(f(),f=null)}await new m((t=>{p=t}))}}finally{o.abort(),g=!0,f&&(f(),f=null)}}.call(this)}async function C(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;for await(const n of T.call(this,t,e))return!0;return!1}function T(t,e){if("function"!=typeof t)throw new i("fn",["Function","AsyncFunction"],t);return _.call(this,(async function(e,n){return await t(e,n)?e:S}),e)}class I extends s{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}function N(t){if(t=g(t),y(t))return 0;if(t<0)throw new o("number",">= 0",t);return t}t.exports.streamReturningOperators={asIndexedPairs:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:void 0;return null!=t&&l(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal"),async function*(){let e=0;for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new a({cause:t.signal.reason});yield[e++,r]}}.call(this)},drop:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return null!=e&&l(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal"),t=N(t),async function*(){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new a;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new a;t--<=0&&(yield n)}}.call(this)},filter:T,flatMap:function(t,e){const n=_.call(this,t,e);return async function*(){for await(const t of n)yield*t}.call(this)},map:_,take:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return null!=e&&l(e,"options"),null!=(null==e?void 0:e.signal)&&c(e.signal,"options.signal"),t=N(t),async function*(){var n;if(null!=e&&null!==(n=e.signal)&&void 0!==n&&n.aborted)throw new a;for await(const n of this){var r;if(null!=e&&null!==(r=e.signal)&&void 0!==r&&r.aborted)throw new a;if(!(t-- >0))return;yield n}}.call(this)}},t.exports.promiseReturningOperators={every:async function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if("function"!=typeof t)throw new i("fn",["Function","AsyncFunction"],t);return!await C.call(this,(async function(){return!await t(...arguments)}),e)},forEach:async function(t,e){if("function"!=typeof t)throw new i("fn",["Function","AsyncFunction"],t);for await(const n of _.call(this,(async function(e,n){return await t(e,n),S}),e));},reduce:async function(t,e,n){var s;if("function"!=typeof t)throw new i("reducer",["Function","AsyncFunction"],t);null!=n&&l(n,"options"),null!=(null==n?void 0:n.signal)&&c(n.signal,"options.signal");let o=arguments.length>1;if(null!=n&&null!==(s=n.signal)&&void 0!==s&&s.aborted){const t=new a(void 0,{cause:n.signal.reason});throw this.once("error",(()=>{})),await d(this.destroy(t)),t}const u=new r,p=u.signal;if(null!=n&&n.signal){const t={once:!0,[h]:this};n.signal.addEventListener("abort",(()=>u.abort()),t)}let f=!1;try{for await(const r of this){var g;if(f=!0,null!=n&&null!==(g=n.signal)&&void 0!==g&&g.aborted)throw new a;o?e=await t(e,r,{signal:p}):(e=r,o=!0)}if(!f&&!o)throw new I}finally{u.abort()}return e},toArray:async function(t){null!=t&&l(t,"options"),null!=(null==t?void 0:t.signal)&&c(t.signal,"options.signal");const e=[];for await(const r of this){var n;if(null!=t&&null!==(n=t.signal)&&void 0!==n&&n.aborted)throw new a(void 0,{cause:t.signal.reason});p(e,r)}return e},some:C,find:async function(t,e){for await(const n of T.call(this,t,e))return n}}},9887:(t,e,n)=>{"use strict";const{ObjectSetPrototypeOf:r}=n(1117);t.exports=s;const i=n(5253);function s(t){if(!(this instanceof s))return new s(t);i.call(this,t)}r(s.prototype,i.prototype),r(s,i),s.prototype._transform=function(t,e,n){n(null,t)}},5675:(t,e,n)=>{const r=n(8860),{ArrayIsArray:i,Promise:s,SymbolAsyncIterator:o}=n(1117),a=n(1577),{once:c}=n(7757),u=n(8883),l=n(5763),{aggregateTwoErrors:h,codes:{ERR_INVALID_ARG_TYPE:d,ERR_INVALID_RETURN_VALUE:p,ERR_MISSING_ARGS:f,ERR_STREAM_DESTROYED:g,ERR_STREAM_PREMATURE_CLOSE:y},AbortError:m}=n(4226),{validateFunction:b,validateAbortSignal:v}=n(5636),{isIterable:w,isReadable:S,isReadableNodeStream:E,isNodeStream:_}=n(52),C=globalThis.AbortController||n(4674).AbortController;let T,I;function N(t,e,n){let r=!1;t.on("close",(()=>{r=!0}));return{destroy:e=>{r||(r=!0,u.destroyer(t,e||new g("pipe")))},cleanup:a(t,{readable:e,writable:n},(t=>{r=!t}))}}function R(t){if(w(t))return t;if(E(t))return async function*(t){I||(I=n(609));yield*I.prototype[o].call(t)}(t);throw new d("val",["Readable","Iterable","AsyncIterable"],t)}async function O(t,e,n,r){let i,{end:o}=r,c=null;const u=t=>{if(t&&(i=t),c){const t=c;c=null,t()}},l=()=>new s(((t,e)=>{i?e(i):c=()=>{i?e(i):t()}}));e.on("drain",u);const d=a(e,{readable:!1},u);try{e.writableNeedDrain&&await l();for await(const n of t)e.write(n)||await l();o&&e.end(),await l(),n()}catch(t){n(i!==t?h(i,t):t)}finally{d(),e.off("drain",u)}}function A(t,e,s){if(1===t.length&&i(t[0])&&(t=t[0]),t.length<2)throw new f("streams");const o=new C,a=o.signal,c=null==s?void 0:s.signal,u=[];function h(){k(new m)}let g,y;v(c,"options.signal"),null==c||c.addEventListener("abort",h);const b=[];let I,A=0;function P(t){k(t,0==--A)}function k(t,n){if(!t||g&&"ERR_STREAM_PREMATURE_CLOSE"!==g.code||(g=t),g||n){for(;b.length;)b.shift()(g);null==c||c.removeEventListener("abort",h),o.abort(),n&&(g||u.forEach((t=>t())),r.nextTick(e,g,y))}}for(let M=0;M<t.length;M++){const B=t[M],F=M<t.length-1,j=M>0,U=F||!1!==(null==s?void 0:s.end),$=M===t.length-1;if(_(B)){if(U){const{destroy:q,cleanup:H}=N(B,F,j);b.push(q),S(B)&&$&&u.push(H)}function L(t){t&&"AbortError"!==t.name&&"ERR_STREAM_PREMATURE_CLOSE"!==t.code&&P(t)}B.on("error",L),S(B)&&$&&u.push((()=>{B.removeListener("error",L)}))}if(0===M)if("function"==typeof B){if(I=B({signal:a}),!w(I))throw new p("Iterable, AsyncIterable or Stream","source",I)}else I=w(B)||E(B)?B:l.from(B);else if("function"==typeof B)if(I=R(I),I=B(I,{signal:a}),F){if(!w(I,!0))throw new p("AsyncIterable",`transform[${M-1}]`,I)}else{var D;T||(T=n(9887));const W=new T({objectMode:!0}),V=null===(D=I)||void 0===D?void 0:D.then;if("function"==typeof V)A++,V.call(I,(t=>{y=t,null!=t&&W.write(t),U&&W.end(),r.nextTick(P)}),(t=>{W.destroy(t),r.nextTick(P,t)}));else{if(!w(I,!0))throw new p("AsyncIterable or Promise","destination",I);A++,O(I,W,P,{end:U})}I=W;const{destroy:G,cleanup:z}=N(I,!1,!0);b.push(G),$&&u.push(z)}else if(_(B)){if(E(I)){A+=2;const K=x(I,B,P,{end:U});S(B)&&$&&u.push(K)}else{if(!w(I))throw new d("val",["Readable","Iterable","AsyncIterable"],I);A++,O(I,B,P,{end:U})}I=B}else I=l.from(B)}return(null!=a&&a.aborted||null!=c&&c.aborted)&&r.nextTick(h),I}function x(t,e,n,r){let{end:i}=r,s=!1;return e.on("close",(()=>{s||n(new y)})),t.pipe(e,{end:i}),i?t.once("end",(()=>{s=!0,e.end()})):n(),a(t,{readable:!0,writable:!1},(e=>{const r=t._readableState;e&&"ERR_STREAM_PREMATURE_CLOSE"===e.code&&r&&r.ended&&!r.errored&&!r.errorEmitted?t.once("end",n).once("error",n):n(e)})),a(e,{readable:!1,writable:!0},n)}t.exports={pipelineImpl:A,pipeline:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return A(e,c(function(t){return b(t[t.length-1],"streams[stream.length - 1]"),t.pop()}(e)))}}},609:(t,e,n)=>{const r=n(8860),{ArrayPrototypeIndexOf:i,NumberIsInteger:s,NumberIsNaN:o,NumberParseInt:a,ObjectDefineProperties:c,ObjectKeys:u,ObjectSetPrototypeOf:l,Promise:h,SafeSet:d,SymbolAsyncIterator:p,Symbol:f}=n(1117);t.exports=j,j.ReadableState=F;const{EventEmitter:g}=n(5121),{Stream:y,prependListener:m}=n(98),{Buffer:b}=n(25),{addAbortSignal:v}=n(718),w=n(1577);let S=n(7757).debuglog("stream",(t=>{S=t}));const E=n(7150),_=n(8883),{getHighWaterMark:C,getDefaultHighWaterMark:T}=n(6604),{aggregateTwoErrors:I,codes:{ERR_INVALID_ARG_TYPE:N,ERR_METHOD_NOT_IMPLEMENTED:R,ERR_OUT_OF_RANGE:O,ERR_STREAM_PUSH_AFTER_EOF:A,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:x}}=n(4226),{validateObject:P}=n(5636),k=f("kPaused"),{StringDecoder:L}=n(6343),D=n(7809);l(j.prototype,y.prototype),l(j,y);const M=()=>{},{errorOrDestroy:B}=_;function F(t,e,r){"boolean"!=typeof r&&(r=e instanceof n(5763)),this.objectMode=!(!t||!t.objectMode),r&&(this.objectMode=this.objectMode||!(!t||!t.readableObjectMode)),this.highWaterMark=t?C(this,t,"readableHighWaterMark",r):T(!1),this.buffer=new E,this.length=0,this.pipes=[],this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.constructed=!0,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this[k]=null,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.destroyed=!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.multiAwaitDrain=!1,this.readingMore=!1,this.dataEmitted=!1,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new L(t.encoding),this.encoding=t.encoding)}function j(t){if(!(this instanceof j))return new j(t);const e=this instanceof n(5763);this._readableState=new F(t,this,e),t&&("function"==typeof t.read&&(this._read=t.read),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&!e&&v(t.signal,this)),y.call(this,t),_.construct(this,(()=>{this._readableState.needReadable&&V(this,this._readableState)}))}function U(t,e,n,r){S("readableAddChunk",e);const i=t._readableState;let s;if(i.objectMode||("string"==typeof e?(n=n||i.defaultEncoding,i.encoding!==n&&(r&&i.encoding?e=b.from(e,n).toString(i.encoding):(e=b.from(e,n),n=""))):e instanceof b?n="":y._isUint8Array(e)?(e=y._uint8ArrayToBuffer(e),n=""):null!=e&&(s=new N("chunk",["string","Buffer","Uint8Array"],e))),s)B(t,s);else if(null===e)i.reading=!1,function(t,e){if(S("onEofChunk"),e.ended)return;if(e.decoder){const t=e.decoder.end();t&&t.length&&(e.buffer.push(t),e.length+=e.objectMode?1:t.length)}e.ended=!0,e.sync?H(t):(e.needReadable=!1,e.emittedReadable=!0,W(t))}(t,i);else if(i.objectMode||e&&e.length>0)if(r)if(i.endEmitted)B(t,new x);else{if(i.destroyed||i.errored)return!1;$(t,i,e,!0)}else if(i.ended)B(t,new A);else{if(i.destroyed||i.errored)return!1;i.reading=!1,i.decoder&&!n?(e=i.decoder.write(e),i.objectMode||0!==e.length?$(t,i,e,!1):V(t,i)):$(t,i,e,!1)}else r||(i.reading=!1,V(t,i));return!i.ended&&(i.length<i.highWaterMark||0===i.length)}function $(t,e,n,r){e.flowing&&0===e.length&&!e.sync&&t.listenerCount("data")>0?(e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",n)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&H(t)),V(t,e)}j.prototype.destroy=_.destroy,j.prototype._undestroy=_.undestroy,j.prototype._destroy=function(t,e){e(t)},j.prototype[g.captureRejectionSymbol]=function(t){this.destroy(t)},j.prototype.push=function(t,e){return U(this,t,e,!1)},j.prototype.unshift=function(t,e){return U(this,t,e,!0)},j.prototype.isPaused=function(){const t=this._readableState;return!0===t[k]||!1===t.flowing},j.prototype.setEncoding=function(t){const e=new L(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;const n=this._readableState.buffer;let r="";for(const t of n)r+=e.write(t);return n.clear(),""!==r&&n.push(r),this._readableState.length=r.length,this};function q(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:o(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}function H(t){const e=t._readableState;S("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(S("emitReadable",e.flowing),e.emittedReadable=!0,r.nextTick(W,t))}function W(t){const e=t._readableState;S("emitReadable_",e.destroyed,e.length,e.ended),e.destroyed||e.errored||!e.length&&!e.ended||(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,X(t)}function V(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,r.nextTick(G,t,e))}function G(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&0===e.length);){const n=e.length;if(S("maybeReadMore read 0"),t.read(0),n===e.length)break}e.readingMore=!1}function z(t){const e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&!1===e[k]?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function K(t){S("readable nexttick read 0"),t.read(0)}function Y(t,e){S("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),X(t),e.flowing&&!e.reading&&t.read(0)}function X(t){const e=t._readableState;for(S("flow",e.flowing);e.flowing&&null!==t.read(););}function Z(t,e){"function"!=typeof t.read&&(t=j.wrap(t,{objectMode:!0}));const n=async function*(t,e){let n,r=M;function i(e){this===t?(r(),r=M):r=e}t.on("readable",i);const s=w(t,{writable:!1},(t=>{n=t?I(n,t):null,r(),r=M}));try{for(;;){const e=t.destroyed?null:t.read();if(null!==e)yield e;else{if(n)throw n;if(null===n)return;await new h(i)}}}catch(t){throw n=I(n,t),n}finally{!n&&!1===(null==e?void 0:e.destroyOnReturn)||void 0!==n&&!t._readableState.autoDestroy?(t.off("readable",i),s()):_.destroyer(t,null)}}(t,e);return n.stream=t,n}function J(t,e){if(0===e.length)return null;let n;return e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.first():e.buffer.concat(e.length),e.buffer.clear()):n=e.buffer.consume(t,e.decoder),n}function Q(t){const e=t._readableState;S("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,r.nextTick(tt,e,t))}function tt(t,e){if(S("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&0===t.length)if(t.endEmitted=!0,e.emit("end"),e.writable&&!1===e.allowHalfOpen)r.nextTick(et,e);else if(t.autoDestroy){const t=e._writableState;(!t||t.autoDestroy&&(t.finished||!1===t.writable))&&e.destroy()}}function et(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}let nt;function rt(){return void 0===nt&&(nt={}),nt}j.prototype.read=function(t){S("read",t),void 0===t?t=NaN:s(t)||(t=a(t,10));const e=this._readableState,n=t;if(t>e.highWaterMark&&(e.highWaterMark=function(t){if(t>1073741824)throw new O("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,++t}(t)),0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&((0!==e.highWaterMark?e.length>=e.highWaterMark:e.length>0)||e.ended))return S("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?Q(this):H(this),null;if(0===(t=q(t,e))&&e.ended)return 0===e.length&&Q(this),null;let r,i=e.needReadable;if(S("need readable",i),(0===e.length||e.length-t<e.highWaterMark)&&(i=!0,S("length less than watermark",i)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)i=!1,S("reading, ended or constructing",i);else if(i){S("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0);try{this._read(e.highWaterMark)}catch(t){B(this,t)}e.sync=!1,e.reading||(t=q(n,e))}return r=t>0?J(t,e):null,null===r?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&Q(this)),null===r||e.errorEmitted||e.closeEmitted||(e.dataEmitted=!0,this.emit("data",r)),r},j.prototype._read=function(t){throw new R("_read()")},j.prototype.pipe=function(t,e){const n=this,i=this._readableState;1===i.pipes.length&&(i.multiAwaitDrain||(i.multiAwaitDrain=!0,i.awaitDrainWriters=new d(i.awaitDrainWriters?[i.awaitDrainWriters]:[]))),i.pipes.push(t),S("pipe count=%d opts=%j",i.pipes.length,e);const s=(!e||!1!==e.end)&&t!==r.stdout&&t!==r.stderr?a:y;function o(e,r){S("onunpipe"),e===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,function(){S("cleanup"),t.removeListener("close",f),t.removeListener("finish",g),c&&t.removeListener("drain",c);t.removeListener("error",p),t.removeListener("unpipe",o),n.removeListener("end",a),n.removeListener("end",y),n.removeListener("data",h),u=!0,c&&i.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&c()}())}function a(){S("onend"),t.end()}let c;i.endEmitted?r.nextTick(s):n.once("end",s),t.on("unpipe",o);let u=!1;function l(){u||(1===i.pipes.length&&i.pipes[0]===t?(S("false write response, pause",0),i.awaitDrainWriters=t,i.multiAwaitDrain=!1):i.pipes.length>1&&i.pipes.includes(t)&&(S("false write response, pause",i.awaitDrainWriters.size),i.awaitDrainWriters.add(t)),n.pause()),c||(c=function(t,e){return function(){const n=t._readableState;n.awaitDrainWriters===e?(S("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(S("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),n.awaitDrainWriters&&0!==n.awaitDrainWriters.size||!t.listenerCount("data")||t.resume()}}(n,t),t.on("drain",c))}function h(e){S("ondata");const n=t.write(e);S("dest.write",n),!1===n&&l()}function p(e){if(S("onerror",e),y(),t.removeListener("error",p),0===t.listenerCount("error")){const n=t._writableState||t._readableState;n&&!n.errorEmitted?B(t,e):t.emit("error",e)}}function f(){t.removeListener("finish",g),y()}function g(){S("onfinish"),t.removeListener("close",f),y()}function y(){S("unpipe"),n.unpipe(t)}return n.on("data",h),m(t,"error",p),t.once("close",f),t.once("finish",g),t.emit("pipe",n),!0===t.writableNeedDrain?i.flowing&&l():i.flowing||(S("pipe resume"),n.resume()),t},j.prototype.unpipe=function(t){const e=this._readableState;if(0===e.pipes.length)return this;if(!t){const t=e.pipes;e.pipes=[],this.pause();for(let e=0;e<t.length;e++)t[e].emit("unpipe",this,{hasUnpiped:!1});return this}const n=i(e.pipes,t);return-1===n||(e.pipes.splice(n,1),0===e.pipes.length&&this.pause(),t.emit("unpipe",this,{hasUnpiped:!1})),this},j.prototype.on=function(t,e){const n=y.prototype.on.call(this,t,e),i=this._readableState;return"data"===t?(i.readableListening=this.listenerCount("readable")>0,!1!==i.flowing&&this.resume()):"readable"===t&&(i.endEmitted||i.readableListening||(i.readableListening=i.needReadable=!0,i.flowing=!1,i.emittedReadable=!1,S("on readable",i.length,i.reading),i.length?H(this):i.reading||r.nextTick(K,this))),n},j.prototype.addListener=j.prototype.on,j.prototype.removeListener=function(t,e){const n=y.prototype.removeListener.call(this,t,e);return"readable"===t&&r.nextTick(z,this),n},j.prototype.off=j.prototype.removeListener,j.prototype.removeAllListeners=function(t){const e=y.prototype.removeAllListeners.apply(this,arguments);return"readable"!==t&&void 0!==t||r.nextTick(z,this),e},j.prototype.resume=function(){const t=this._readableState;return t.flowing||(S("resume"),t.flowing=!t.readableListening,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,r.nextTick(Y,t,e))}(this,t)),t[k]=!1,this},j.prototype.pause=function(){return S("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(S("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[k]=!0,this},j.prototype.wrap=function(t){let e=!1;t.on("data",(n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())})),t.on("end",(()=>{this.push(null)})),t.on("error",(t=>{B(this,t)})),t.on("close",(()=>{this.destroy()})),t.on("destroy",(()=>{this.destroy()})),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};const n=u(t);for(let e=1;e<n.length;e++){const r=n[e];void 0===this[r]&&"function"==typeof t[r]&&(this[r]=t[r].bind(t))}return this},j.prototype[p]=function(){return Z(this)},j.prototype.iterator=function(t){return void 0!==t&&P(t,"options"),Z(this,t)},c(j.prototype,{readable:{__proto__:null,get(){const t=this._readableState;return!(!t||!1===t.readable||t.destroyed||t.errorEmitted||t.endEmitted)},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._readableState.readable||!this._readableState.destroyed&&!this._readableState.errored||this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.objectMode}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return!!this._readableState&&this._readableState.closed}},destroyed:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.destroyed},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return!!this._readableState&&this._readableState.endEmitted}}}),c(F.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return!1!==this[k]},set(t){this[k]=!!t}}}),j._fromList=J,j.from=function(t,e){return D(j,t,e)},j.fromWeb=function(t,e){return rt().newStreamReadableFromReadableStream(t,e)},j.toWeb=function(t,e){return rt().newReadableStreamFromStreamReadable(t,e)},j.wrap=function(t,e){var n,r;return new j({objectMode:null===(n=null!==(r=t.readableObjectMode)&&void 0!==r?r:t.objectMode)||void 0===n||n,...e,destroy(e,n){_.destroyer(t,e),n(e)}}).wrap(t)}},6604:(t,e,n)=>{"use strict";const{MathFloor:r,NumberIsInteger:i}=n(1117),{ERR_INVALID_ARG_VALUE:s}=n(4226).codes;function o(t){return t?16:16384}t.exports={getHighWaterMark:function(t,e,n,a){const c=function(t,e,n){return null!=t.highWaterMark?t.highWaterMark:e?t[n]:null}(e,a,n);if(null!=c){if(!i(c)||c<0){throw new s(a?`options.${n}`:"options.highWaterMark",c)}return r(c)}return o(t.objectMode)},getDefaultHighWaterMark:o}},5253:(t,e,n)=>{"use strict";const{ObjectSetPrototypeOf:r,Symbol:i}=n(1117);t.exports=u;const{ERR_METHOD_NOT_IMPLEMENTED:s}=n(4226).codes,o=n(5763),{getHighWaterMark:a}=n(6604);r(u.prototype,o.prototype),r(u,o);const c=i("kCallback");function u(t){if(!(this instanceof u))return new u(t);const e=t?a(this,t,"readableHighWaterMark",!0):null;0===e&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),o.call(this,t),this._readableState.sync=!1,this[c]=null,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",h)}function l(t){"function"!=typeof this._flush||this.destroyed?(this.push(null),t&&t()):this._flush(((e,n)=>{e?t?t(e):this.destroy(e):(null!=n&&this.push(n),this.push(null),t&&t())}))}function h(){this._final!==l&&l.call(this)}u.prototype._final=l,u.prototype._transform=function(t,e,n){throw new s("_transform()")},u.prototype._write=function(t,e,n){const r=this._readableState,i=this._writableState,s=r.length;this._transform(t,e,((t,e)=>{t?n(t):(null!=e&&this.push(e),i.ended||s===r.length||r.length<r.highWaterMark?n():this[c]=n)}))},u.prototype._read=function(){if(this[c]){const t=this[c];this[c]=null,t()}}},52:(t,e,n)=>{"use strict";const{Symbol:r,SymbolAsyncIterator:i,SymbolIterator:s}=n(1117),o=r("kDestroyed"),a=r("kIsErrored"),c=r("kIsReadable"),u=r("kIsDisturbed");function l(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var n;return!(!t||"function"!=typeof t.pipe||"function"!=typeof t.on||e&&("function"!=typeof t.pause||"function"!=typeof t.resume)||t._writableState&&!1===(null===(n=t._readableState)||void 0===n?void 0:n.readable)||t._writableState&&!t._readableState)}function h(t){var e;return!(!t||"function"!=typeof t.write||"function"!=typeof t.on||t._readableState&&!1===(null===(e=t._writableState)||void 0===e?void 0:e.writable))}function d(t){return t&&(t._readableState||t._writableState||"function"==typeof t.write&&"function"==typeof t.on||"function"==typeof t.pipe&&"function"==typeof t.on)}function p(t){if(!d(t))return null;const e=t._writableState,n=t._readableState,r=e||n;return!!(t.destroyed||t[o]||null!=r&&r.destroyed)}function f(t){if(!h(t))return null;if(!0===t.writableEnded)return!0;const e=t._writableState;return(null==e||!e.errored)&&("boolean"!=typeof(null==e?void 0:e.ended)?null:e.ended)}function g(t,e){if(!l(t))return null;const n=t._readableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.endEmitted)?null:!!(n.endEmitted||!1===e&&!0===n.ended&&0===n.length))}function y(t){return t&&null!=t[c]?t[c]:"boolean"!=typeof(null==t?void 0:t.readable)?null:!p(t)&&(l(t)&&t.readable&&!g(t))}function m(t){return"boolean"!=typeof(null==t?void 0:t.writable)?null:!p(t)&&(h(t)&&t.writable&&!f(t))}function b(t){return"boolean"==typeof t._closed&&"boolean"==typeof t._defaultKeepAlive&&"boolean"==typeof t._removedConnection&&"boolean"==typeof t._removedContLen}function v(t){return"boolean"==typeof t._sent100&&b(t)}t.exports={kDestroyed:o,isDisturbed:function(t){var e;return!(!t||!(null!==(e=t[u])&&void 0!==e?e:t.readableDidRead||t.readableAborted))},kIsDisturbed:u,isErrored:function(t){var e,n,r,i,s,o,c,u,l,h;return!(!t||!(null!==(e=null!==(n=null!==(r=null!==(i=null!==(s=null!==(o=t[a])&&void 0!==o?o:t.readableErrored)&&void 0!==s?s:t.writableErrored)&&void 0!==i?i:null===(c=t._readableState)||void 0===c?void 0:c.errorEmitted)&&void 0!==r?r:null===(u=t._writableState)||void 0===u?void 0:u.errorEmitted)&&void 0!==n?n:null===(l=t._readableState)||void 0===l?void 0:l.errored)&&void 0!==e?e:null===(h=t._writableState)||void 0===h?void 0:h.errored))},kIsErrored:a,isReadable:y,kIsReadable:c,isClosed:function(t){if(!d(t))return null;if("boolean"==typeof t.closed)return t.closed;const e=t._writableState,n=t._readableState;return"boolean"==typeof(null==e?void 0:e.closed)||"boolean"==typeof(null==n?void 0:n.closed)?(null==e?void 0:e.closed)||(null==n?void 0:n.closed):"boolean"==typeof t._closed&&b(t)?t._closed:null},isDestroyed:p,isDuplexNodeStream:function(t){return!(!t||"function"!=typeof t.pipe||!t._readableState||"function"!=typeof t.on||"function"!=typeof t.write)},isFinished:function(t,e){return d(t)?!!p(t)||(!1===(null==e?void 0:e.readable)||!y(t))&&(!1===(null==e?void 0:e.writable)||!m(t)):null},isIterable:function(t,e){return null!=t&&(!0===e?"function"==typeof t[i]:!1===e?"function"==typeof t[s]:"function"==typeof t[i]||"function"==typeof t[s])},isReadableNodeStream:l,isReadableEnded:function(t){if(!l(t))return null;if(!0===t.readableEnded)return!0;const e=t._readableState;return!(!e||e.errored)&&("boolean"!=typeof(null==e?void 0:e.ended)?null:e.ended)},isReadableFinished:g,isReadableErrored:function(t){var e,n;return d(t)?t.readableErrored?t.readableErrored:null!==(e=null===(n=t._readableState)||void 0===n?void 0:n.errored)&&void 0!==e?e:null:null},isNodeStream:d,isWritable:m,isWritableNodeStream:h,isWritableEnded:f,isWritableFinished:function(t,e){if(!h(t))return null;if(!0===t.writableFinished)return!0;const n=t._writableState;return(null==n||!n.errored)&&("boolean"!=typeof(null==n?void 0:n.finished)?null:!!(n.finished||!1===e&&!0===n.ended&&0===n.length))},isWritableErrored:function(t){var e,n;return d(t)?t.writableErrored?t.writableErrored:null!==(e=null===(n=t._writableState)||void 0===n?void 0:n.errored)&&void 0!==e?e:null:null},isServerRequest:function(t){var e;return"boolean"==typeof t._consuming&&"boolean"==typeof t._dumped&&void 0===(null===(e=t.req)||void 0===e?void 0:e.upgradeOrConnect)},isServerResponse:v,willEmitClose:function(t){if(!d(t))return null;const e=t._writableState,n=t._readableState,r=e||n;return!r&&v(t)||!!(r&&r.autoDestroy&&r.emitClose&&!1===r.closed)}}},9185:(t,e,n)=>{const r=n(8860),{ArrayPrototypeSlice:i,Error:s,FunctionPrototypeSymbolHasInstance:o,ObjectDefineProperty:a,ObjectDefineProperties:c,ObjectSetPrototypeOf:u,StringPrototypeToLowerCase:l,Symbol:h,SymbolHasInstance:d}=n(1117);t.exports=L,L.WritableState=P;const{EventEmitter:p}=n(5121),f=n(98).Stream,{Buffer:g}=n(25),y=n(8883),{addAbortSignal:m}=n(718),{getHighWaterMark:b,getDefaultHighWaterMark:v}=n(6604),{ERR_INVALID_ARG_TYPE:w,ERR_METHOD_NOT_IMPLEMENTED:S,ERR_MULTIPLE_CALLBACK:E,ERR_STREAM_CANNOT_PIPE:_,ERR_STREAM_DESTROYED:C,ERR_STREAM_ALREADY_FINISHED:T,ERR_STREAM_NULL_VALUES:I,ERR_STREAM_WRITE_AFTER_END:N,ERR_UNKNOWN_ENCODING:R}=n(4226).codes,{errorOrDestroy:O}=y;function A(){}u(L.prototype,f.prototype),u(L,f);const x=h("kOnFinished");function P(t,e,r){"boolean"!=typeof r&&(r=e instanceof n(5763)),this.objectMode=!(!t||!t.objectMode),r&&(this.objectMode=this.objectMode||!(!t||!t.writableObjectMode)),this.highWaterMark=t?b(this,t,"writableHighWaterMark",r):v(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const i=!(!t||!1!==t.decodeStrings);this.decodeStrings=!i,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=F.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,k(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||!1!==t.emitClose,this.autoDestroy=!t||!1!==t.autoDestroy,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[x]=[]}function k(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}function L(t){const e=this instanceof n(5763);if(!e&&!o(L,this))return new L(t);this._writableState=new P(t,this,e),t&&("function"==typeof t.write&&(this._write=t.write),"function"==typeof t.writev&&(this._writev=t.writev),"function"==typeof t.destroy&&(this._destroy=t.destroy),"function"==typeof t.final&&(this._final=t.final),"function"==typeof t.construct&&(this._construct=t.construct),t.signal&&m(t.signal,this)),f.call(this,t),y.construct(this,(()=>{const t=this._writableState;t.writing||q(this,t),V(this,t)}))}function D(t,e,n,i){const s=t._writableState;if("function"==typeof n)i=n,n=s.defaultEncoding;else{if(n){if("buffer"!==n&&!g.isEncoding(n))throw new R(n)}else n=s.defaultEncoding;"function"!=typeof i&&(i=A)}if(null===e)throw new I;if(!s.objectMode)if("string"==typeof e)!1!==s.decodeStrings&&(e=g.from(e,n),n="buffer");else if(e instanceof g)n="buffer";else{if(!f._isUint8Array(e))throw new w("chunk",["string","Buffer","Uint8Array"],e);e=f._uint8ArrayToBuffer(e),n="buffer"}let o;return s.ending?o=new N:s.destroyed&&(o=new C("write")),o?(r.nextTick(i,o),O(t,o,!0),o):(s.pendingcb++,function(t,e,n,r,i){const s=e.objectMode?1:n.length;e.length+=s;const o=e.length<e.highWaterMark;o||(e.needDrain=!0);e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:n,encoding:r,callback:i}),e.allBuffers&&"buffer"!==r&&(e.allBuffers=!1),e.allNoop&&i!==A&&(e.allNoop=!1)):(e.writelen=s,e.writecb=i,e.writing=!0,e.sync=!0,t._write(n,r,e.onwrite),e.sync=!1);return o&&!e.errored&&!e.destroyed}(t,s,e,n,i))}function M(t,e,n,r,i,s,o){e.writelen=r,e.writecb=o,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new C("write")):n?t._writev(i,e.onwrite):t._write(i,s,e.onwrite),e.sync=!1}function B(t,e,n,r){--e.pendingcb,r(n),$(e),O(t,n)}function F(t,e){const n=t._writableState,i=n.sync,s=n.writecb;"function"==typeof s?(n.writing=!1,n.writecb=null,n.length-=n.writelen,n.writelen=0,e?(e.stack,n.errored||(n.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),i?r.nextTick(B,t,n,e,s):B(t,n,e,s)):(n.buffered.length>n.bufferedIndex&&q(t,n),i?null!==n.afterWriteTickInfo&&n.afterWriteTickInfo.cb===s?n.afterWriteTickInfo.count++:(n.afterWriteTickInfo={count:1,cb:s,stream:t,state:n},r.nextTick(j,n.afterWriteTickInfo)):U(t,n,1,s))):O(t,new E)}function j(t){let{stream:e,state:n,count:r,cb:i}=t;return n.afterWriteTickInfo=null,U(e,n,r,i)}function U(t,e,n,r){for(!e.ending&&!t.destroyed&&0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));n-- >0;)e.pendingcb--,r();e.destroyed&&$(e),V(t,e)}function $(t){if(t.writing)return;for(let n=t.bufferedIndex;n<t.buffered.length;++n){var e;const{chunk:r,callback:i}=t.buffered[n],s=t.objectMode?1:r.length;t.length-=s,i(null!==(e=t.errored)&&void 0!==e?e:new C("write"))}const n=t[x].splice(0);for(let e=0;e<n.length;e++){var r;n[e](null!==(r=t.errored)&&void 0!==r?r:new C("end"))}k(t)}function q(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;const{buffered:n,bufferedIndex:r,objectMode:s}=e,o=n.length-r;if(!o)return;let a=r;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;const r=e.allNoop?A:t=>{for(let e=a;e<n.length;++e)n[e].callback(t)},s=e.allNoop&&0===a?n:i(n,a);s.allBuffers=e.allBuffers,M(t,e,!0,e.length,s,"",r),k(e)}else{do{const{chunk:r,encoding:i,callback:o}=n[a];n[a++]=null;M(t,e,!1,s?1:r.length,r,i,o)}while(a<n.length&&!e.writing);a===n.length?k(e):a>256?(n.splice(0,a),e.bufferedIndex=0):e.bufferedIndex=a}e.bufferProcessing=!1}function H(t){return t.ending&&!t.destroyed&&t.constructed&&0===t.length&&!t.errored&&0===t.buffered.length&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function W(t,e){e.prefinished||e.finalCalled||("function"!=typeof t._final||e.destroyed?(e.prefinished=!0,t.emit("prefinish")):(e.finalCalled=!0,function(t,e){let n=!1;function i(i){if(n)O(t,null!=i?i:E());else if(n=!0,e.pendingcb--,i){const n=e[x].splice(0);for(let t=0;t<n.length;t++)n[t](i);O(t,i,e.sync)}else H(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,r.nextTick(G,t,e))}e.sync=!0,e.pendingcb++;try{t._final(i)}catch(t){i(t)}e.sync=!1}(t,e)))}function V(t,e,n){H(e)&&(W(t,e),0===e.pendingcb&&(n?(e.pendingcb++,r.nextTick(((t,e)=>{H(e)?G(t,e):e.pendingcb--}),t,e)):H(e)&&(e.pendingcb++,G(t,e))))}function G(t,e){e.pendingcb--,e.finished=!0;const n=e[x].splice(0);for(let t=0;t<n.length;t++)n[t]();if(t.emit("finish"),e.autoDestroy){const e=t._readableState;(!e||e.autoDestroy&&(e.endEmitted||!1===e.readable))&&t.destroy()}}P.prototype.getBuffer=function(){return i(this.buffered,this.bufferedIndex)},a(P.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}}),a(L,d,{__proto__:null,value:function(t){return!!o(this,t)||this===L&&(t&&t._writableState instanceof P)}}),L.prototype.pipe=function(){O(this,new _)},L.prototype.write=function(t,e,n){return!0===D(this,t,e,n)},L.prototype.cork=function(){this._writableState.corked++},L.prototype.uncork=function(){const t=this._writableState;t.corked&&(t.corked--,t.writing||q(this,t))},L.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=l(t)),!g.isEncoding(t))throw new R(t);return this._writableState.defaultEncoding=t,this},L.prototype._write=function(t,e,n){if(!this._writev)throw new S("_write()");this._writev([{chunk:t,encoding:e}],n)},L.prototype._writev=null,L.prototype.end=function(t,e,n){const i=this._writableState;let o;if("function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t){const n=D(this,t,e);n instanceof s&&(o=n)}return i.corked&&(i.corked=1,this.uncork()),o||(i.errored||i.ending?i.finished?o=new T("end"):i.destroyed&&(o=new C("end")):(i.ending=!0,V(this,i,!0),i.ended=!0)),"function"==typeof n&&(o||i.finished?r.nextTick(n,o):i[x].push(n)),this},c(L.prototype,{closed:{__proto__:null,get(){return!!this._writableState&&this._writableState.closed}},destroyed:{__proto__:null,get(){return!!this._writableState&&this._writableState.destroyed},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){const t=this._writableState;return!(!t||!1===t.writable||t.destroyed||t.errored||t.ending||t.ended)},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return!!this._writableState&&this._writableState.finished}},writableObjectMode:{__proto__:null,get(){return!!this._writableState&&this._writableState.objectMode}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return!!this._writableState&&this._writableState.ending}},writableNeedDrain:{__proto__:null,get(){const t=this._writableState;return!!t&&(!t.destroyed&&!t.ending&&t.needDrain)}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!(!1===this._writableState.writable||!this._writableState.destroyed&&!this._writableState.errored||this._writableState.finished)}}});const z=y.destroy;let K;function Y(){return void 0===K&&(K={}),K}L.prototype.destroy=function(t,e){const n=this._writableState;return!n.destroyed&&(n.bufferedIndex<n.buffered.length||n[x].length)&&r.nextTick($,n),z.call(this,t,e),this},L.prototype._undestroy=y.undestroy,L.prototype._destroy=function(t,e){e(t)},L.prototype[p.captureRejectionSymbol]=function(t){this.destroy(t)},L.fromWeb=function(t,e){return Y().newStreamWritableFromWritableStream(t,e)},L.toWeb=function(t){return Y().newWritableStreamFromStreamWritable(t)}},5636:(t,e,n)=>{"use strict";const{ArrayIsArray:r,ArrayPrototypeIncludes:i,ArrayPrototypeJoin:s,ArrayPrototypeMap:o,NumberIsInteger:a,NumberIsNaN:c,NumberMAX_SAFE_INTEGER:u,NumberMIN_SAFE_INTEGER:l,NumberParseInt:h,ObjectPrototypeHasOwnProperty:d,RegExpPrototypeExec:p,String:f,StringPrototypeToUpperCase:g,StringPrototypeTrim:y}=n(1117),{hideStackFrames:m,codes:{ERR_SOCKET_BAD_PORT:b,ERR_INVALID_ARG_TYPE:v,ERR_INVALID_ARG_VALUE:w,ERR_OUT_OF_RANGE:S,ERR_UNKNOWN_SIGNAL:E}}=n(4226),{normalizeEncoding:_}=n(7757),{isAsyncFunction:C,isArrayBufferView:T}=n(7757).types,I={};const N=/^[0-7]+$/;const R=m((function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:u;if("number"!=typeof t)throw new v(e,"number",t);if(!a(t))throw new S(e,"an integer",t);if(t<n||t>r)throw new S(e,`>= ${n} && <= ${r}`,t)})),O=m((function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-2147483648,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2147483647;if("number"!=typeof t)throw new v(e,"number",t);if(!a(t))throw new S(e,"an integer",t);if(t<n||t>r)throw new S(e,`>= ${n} && <= ${r}`,t)})),A=m((function(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("number"!=typeof t)throw new v(e,"number",t);if(!a(t))throw new S(e,"an integer",t);const r=n?1:0,i=4294967295;if(t<r||t>i)throw new S(e,`>= ${r} && <= ${i}`,t)}));function x(t,e){if("string"!=typeof t)throw new v(e,"string",t)}const P=m(((t,e,n)=>{if(!i(n,t)){const r=s(o(n,(t=>"string"==typeof t?`'${t}'`:f(t))),", ");throw new w(e,t,"must be one of: "+r)}}));function k(t,e,n){return null!=t&&d(t,e)?t[e]:n}const L=m((function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const i=k(n,"allowArray",!1),s=k(n,"allowFunction",!1);if(!k(n,"nullable",!1)&&null===t||!i&&r(t)||"object"!=typeof t&&(!s||"function"!=typeof t))throw new v(e,"Object",t)})),D=m((function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!r(t))throw new v(e,"Array",t);if(t.length<n){throw new w(e,t,`must be longer than ${n}`)}}));const M=m((function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"buffer";if(!T(t))throw new v(e,["Buffer","TypedArray","DataView"],t)}));const B=m(((t,e)=>{if(void 0!==t&&(null===t||"object"!=typeof t||!("aborted"in t)))throw new v(e,"AbortSignal",t)})),F=m(((t,e)=>{if("function"!=typeof t)throw new v(e,"Function",t)})),j=m(((t,e)=>{if("function"!=typeof t||C(t))throw new v(e,"Function",t)})),U=m(((t,e)=>{if(void 0!==t)throw new v(e,"undefined",t)}));t.exports={isInt32:function(t){return t===(0|t)},isUint32:function(t){return t===t>>>0},parseFileMode:function(t,e,n){if(void 0===t&&(t=n),"string"==typeof t){if(null===p(N,t))throw new w(e,t,"must be a 32-bit unsigned integer or an octal string");t=h(t,8)}return A(t,e),t},validateArray:D,validateBoolean:function(t,e){if("boolean"!=typeof t)throw new v(e,"boolean",t)},validateBuffer:M,validateEncoding:function(t,e){const n=_(e),r=t.length;if("hex"===n&&r%2!=0)throw new w("encoding",e,`is invalid for data of length ${r}`)},validateFunction:F,validateInt32:O,validateInteger:R,validateNumber:function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("number"!=typeof t)throw new v(e,"number",t);if(null!=n&&t<n||null!=r&&t>r||(null!=n||null!=r)&&c(t))throw new S(e,`${null!=n?`>= ${n}`:""}${null!=n&&null!=r?" && ":""}${null!=r?`<= ${r}`:""}`,t)},validateObject:L,validateOneOf:P,validatePlainFunction:j,validatePort:function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Port",n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if("number"!=typeof t&&"string"!=typeof t||"string"==typeof t&&0===y(t).length||+t!=+t>>>0||t>65535||0===t&&!n)throw new b(e,t,n);return 0|t},validateSignalName:function(t){if(x(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"signal"),void 0===I[t]){if(void 0!==I[g(t)])throw new E(t+" (signals must use all capital letters)");throw new E(t)}},validateString:x,validateUint32:A,validateUndefined:U,validateUnion:function(t,e,n){if(!i(n,t))throw new v(e,`('${s(n,"|")}')`,t)},validateAbortSignal:B}},1549:(t,e,n)=>{"use strict";const r=n(437),i=n(2606),s=r.Readable.destroy;t.exports=r.Readable,t.exports._uint8ArrayToBuffer=r._uint8ArrayToBuffer,t.exports._isUint8Array=r._isUint8Array,t.exports.isDisturbed=r.isDisturbed,t.exports.isErrored=r.isErrored,t.exports.isReadable=r.isReadable,t.exports.Readable=r.Readable,t.exports.Writable=r.Writable,t.exports.Duplex=r.Duplex,t.exports.Transform=r.Transform,t.exports.PassThrough=r.PassThrough,t.exports.addAbortSignal=r.addAbortSignal,t.exports.finished=r.finished,t.exports.destroy=r.destroy,t.exports.destroy=s,t.exports.pipeline=r.pipeline,t.exports.compose=r.compose,Object.defineProperty(r,"promises",{configurable:!0,enumerable:!0,get:()=>i}),t.exports.Stream=r.Stream,t.exports.default=t.exports},4226:(t,e,n)=>{"use strict";const{format:r,inspect:i,AggregateError:s}=n(7757),o=globalThis.AggregateError||s,a=Symbol("kIsNodeError"),c=["string","function","number","object","Function","Object","boolean","bigint","symbol"],u=/^([A-Z][a-z0-9]*)+$/,l={};function h(t,e){if(!t)throw new l.ERR_INTERNAL_ASSERTION(e)}function d(t){let e="",n=t.length;const r="-"===t[0]?1:0;for(;n>=r+4;n-=3)e=`_${t.slice(n-3,n)}${e}`;return`${t.slice(0,n)}${e}`}function p(t,e,n){n||(n=Error);class i extends n{constructor(){for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];super(function(t,e,n){if("function"==typeof e)return h(e.length<=n.length,`Code: ${t}; The provided arguments length (${n.length}) does not match the required ones (${e.length}).`),e(...n);const i=(e.match(/%[dfijoOs]/g)||[]).length;return h(i===n.length,`Code: ${t}; The provided arguments length (${n.length}) does not match the required ones (${i}).`),0===n.length?e:r(e,...n)}(t,e,i))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(i.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),i.prototype.code=t,i.prototype[a]=!0,l[t]=i}function f(t){const e="__node_internal_"+t.name;return Object.defineProperty(t,"name",{value:e}),t}class g extends Error{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The operation was aborted",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(void 0!==e&&"object"!=typeof e)throw new l.ERR_INVALID_ARG_TYPE("options","Object",e);super(t,e),this.code="ABORT_ERR",this.name="AbortError"}}p("ERR_ASSERTION","%s",Error),p("ERR_INVALID_ARG_TYPE",((t,e,n)=>{h("string"==typeof t,"'name' must be a string"),Array.isArray(e)||(e=[e]);let r="The ";t.endsWith(" argument")?r+=`${t} `:r+=`"${t}" ${t.includes(".")?"property":"argument"} `,r+="must be ";const s=[],o=[],a=[];for(const t of e)h("string"==typeof t,"All expected entries have to be of type string"),c.includes(t)?s.push(t.toLowerCase()):u.test(t)?o.push(t):(h("object"!==t,'The value "object" should be written as "Object"'),a.push(t));if(o.length>0){const t=s.indexOf("object");-1!==t&&(s.splice(s,t,1),o.push("Object"))}if(s.length>0){switch(s.length){case 1:r+=`of type ${s[0]}`;break;case 2:r+=`one of type ${s[0]} or ${s[1]}`;break;default:{const t=s.pop();r+=`one of type ${s.join(", ")}, or ${t}`}}(o.length>0||a.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const t=o.pop();r+=`an instance of ${o.join(", ")}, or ${t}`}}a.length>0&&(r+=" or ")}switch(a.length){case 0:break;case 1:a[0].toLowerCase()!==a[0]&&(r+="an "),r+=`${a[0]}`;break;case 2:r+=`one of ${a[0]} or ${a[1]}`;break;default:{const t=a.pop();r+=`one of ${a.join(", ")}, or ${t}`}}if(null==n)r+=`. Received ${n}`;else if("function"==typeof n&&n.name)r+=`. Received function ${n.name}`;else if("object"==typeof n){var l;if(null!==(l=n.constructor)&&void 0!==l&&l.name)r+=`. Received an instance of ${n.constructor.name}`;else{r+=`. Received ${i(n,{depth:-1})}`}}else{let t=i(n,{colors:!1});t.length>25&&(t=`${t.slice(0,25)}...`),r+=`. Received type ${typeof n} (${t})`}return r}),TypeError),p("ERR_INVALID_ARG_VALUE",(function(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"is invalid",r=i(e);r.length>128&&(r=r.slice(0,128)+"...");return`The ${t.includes(".")?"property":"argument"} '${t}' ${n}. Received ${r}`}),TypeError),p("ERR_INVALID_RETURN_VALUE",((t,e,n)=>{var r;return`Expected ${t} to be returned from the "${e}" function but got ${null!=n&&null!==(r=n.constructor)&&void 0!==r&&r.name?`instance of ${n.constructor.name}`:"type "+typeof n}.`}),TypeError),p("ERR_MISSING_ARGS",(function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];let r;h(e.length>0,"At least one arg needs to be specified");const i=e.length;switch(e=(Array.isArray(e)?e:[e]).map((t=>`"${t}"`)).join(" or "),i){case 1:r+=`The ${e[0]} argument`;break;case 2:r+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const t=e.pop();r+=`The ${e.join(", ")}, and ${t} arguments`}}return`${r} must be specified`}),TypeError),p("ERR_OUT_OF_RANGE",((t,e,n)=>{let r;return h(e,'Missing "range" argument'),Number.isInteger(n)&&Math.abs(n)>2**32?r=d(String(n)):"bigint"==typeof n?(r=String(n),(n>2n**32n||n<-(2n**32n))&&(r=d(r)),r+="n"):r=i(n),`The value of "${t}" is out of range. It must be ${e}. Received ${r}`}),RangeError),p("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),p("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),p("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),p("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),p("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),p("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),p("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),p("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),p("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),p("ERR_STREAM_WRITE_AFTER_END","write after end",Error),p("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),t.exports={AbortError:g,aggregateTwoErrors:f((function(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;const n=new o([e,t],e.message);return n.code=e.code,n}return t||e})),hideStackFrames:f,codes:l}},1117:t=>{"use strict";t.exports={ArrayIsArray:t=>Array.isArray(t),ArrayPrototypeIncludes:(t,e)=>t.includes(e),ArrayPrototypeIndexOf:(t,e)=>t.indexOf(e),ArrayPrototypeJoin:(t,e)=>t.join(e),ArrayPrototypeMap:(t,e)=>t.map(e),ArrayPrototypePop:(t,e)=>t.pop(e),ArrayPrototypePush:(t,e)=>t.push(e),ArrayPrototypeSlice:(t,e,n)=>t.slice(e,n),Error,FunctionPrototypeCall(t,e){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return t.call(e,...r)},FunctionPrototypeSymbolHasInstance:(t,e)=>Function.prototype[Symbol.hasInstance].call(t,e),MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties:(t,e)=>Object.defineProperties(t,e),ObjectDefineProperty:(t,e,n)=>Object.defineProperty(t,e,n),ObjectGetOwnPropertyDescriptor:(t,e)=>Object.getOwnPropertyDescriptor(t,e),ObjectKeys:t=>Object.keys(t),ObjectSetPrototypeOf:(t,e)=>Object.setPrototypeOf(t,e),Promise,PromisePrototypeCatch:(t,e)=>t.catch(e),PromisePrototypeThen:(t,e,n)=>t.then(e,n),PromiseReject:t=>Promise.reject(t),ReflectApply:Reflect.apply,RegExpPrototypeTest:(t,e)=>t.test(e),SafeSet:Set,String,StringPrototypeSlice:(t,e,n)=>t.slice(e,n),StringPrototypeToLowerCase:t=>t.toLowerCase(),StringPrototypeToUpperCase:t=>t.toUpperCase(),StringPrototypeTrim:t=>t.trim(),Symbol,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,TypedArrayPrototypeSet:(t,e,n)=>t.set(e,n),Uint8Array}},7757:(t,e,n)=>{"use strict";const r=n(25),i=Object.getPrototypeOf((async function(){})).constructor,s=globalThis.Blob||r.Blob,o=void 0!==s?function(t){return t instanceof s}:function(t){return!1};class a extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError("Expected input to be an Array, got "+typeof t);let e="";for(let n=0;n<t.length;n++)e+=`    ${t[n].stack}\n`;super(e),this.name="AggregateError",this.errors=t}}t.exports={AggregateError:a,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(){if(!e){e=!0;for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t.apply(this,r)}}},createDeferredPromise:function(){let t,e;return{promise:new Promise(((n,r)=>{t=n,e=r})),resolve:t,reject:e}},promisify:t=>new Promise(((e,n)=>{t((function(t){if(t)return n(t);for(var r=arguments.length,i=new Array(r>1?r-1:0),s=1;s<r;s++)i[s-1]=arguments[s];return e(...i)}))})),debuglog:()=>function(){},format(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return t.replace(/%([sdifj])/g,(function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];let[i,s]=e;const o=n.shift();if("f"===s)return o.toFixed(6);if("j"===s)return JSON.stringify(o);if("s"===s&&"object"==typeof o){return`${o.constructor!==Object?o.constructor.name:""} {}`.trim()}return o.toString()}))},inspect(t){switch(typeof t){case"string":if(t.includes("'")){if(!t.includes('"'))return`"${t}"`;if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction:t=>t instanceof i,isArrayBufferView:t=>ArrayBuffer.isView(t)},isBlob:o},t.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")},437:(t,e,n)=>{const{Buffer:r}=n(25),{ObjectDefineProperty:i,ObjectKeys:s,ReflectApply:o}=n(1117),{promisify:{custom:a}}=n(7757),{streamReturningOperators:c,promiseReturningOperators:u}=n(7048),{codes:{ERR_ILLEGAL_CONSTRUCTOR:l}}=n(4226),h=n(6893),{pipeline:d}=n(5675),{destroyer:p}=n(8883),f=n(1577),g=n(2606),y=n(52),m=t.exports=n(98).Stream;m.isDisturbed=y.isDisturbed,m.isErrored=y.isErrored,m.isReadable=y.isReadable,m.Readable=n(609);for(const w of s(c)){const S=c[w];function b(){if(new.target)throw l();for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return m.Readable.from(o(S,this,e))}i(b,"name",{__proto__:null,value:S.name}),i(b,"length",{__proto__:null,value:S.length}),i(m.Readable.prototype,w,{__proto__:null,value:b,enumerable:!1,configurable:!0,writable:!0})}for(const E of s(u)){const _=u[E];function b(){if(new.target)throw l();for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return o(_,this,e)}i(b,"name",{__proto__:null,value:_.name}),i(b,"length",{__proto__:null,value:_.length}),i(m.Readable.prototype,E,{__proto__:null,value:b,enumerable:!1,configurable:!0,writable:!0})}m.Writable=n(9185),m.Duplex=n(5763),m.Transform=n(5253),m.PassThrough=n(9887),m.pipeline=d;const{addAbortSignal:v}=n(718);m.addAbortSignal=v,m.finished=f,m.destroy=p,m.compose=h,i(m,"promises",{__proto__:null,configurable:!0,enumerable:!0,get:()=>g}),i(d,a,{__proto__:null,enumerable:!0,get:()=>g.pipeline}),i(f,a,{__proto__:null,enumerable:!0,get:()=>g.finished}),m.Stream=m,m._isUint8Array=function(t){return t instanceof Uint8Array},m._uint8ArrayToBuffer=function(t){return r.from(t.buffer,t.byteOffset,t.byteLength)}},2606:(t,e,n)=>{"use strict";const{ArrayPrototypePop:r,Promise:i}=n(1117),{isIterable:s,isNodeStream:o}=n(52),{pipelineImpl:a}=n(5675),{finished:c}=n(1577);t.exports={finished:c,pipeline:function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new i(((t,n)=>{let i,c;const u=e[e.length-1];if(u&&"object"==typeof u&&!o(u)&&!s(u)){const t=r(e);i=t.signal,c=t.end}a(e,((e,r)=>{e?n(e):t(r)}),{signal:i,end:c})}))}}},2115:function(t,e,n){var r;!function(i,s){"use strict";var o="function",a="undefined",c="object",u="string",l="model",h="name",d="type",p="vendor",f="version",g="architecture",y="console",m="mobile",b="tablet",v="smarttv",w="wearable",S="embedded",E="Amazon",_="Apple",C="ASUS",T="BlackBerry",I="Browser",N="Chrome",R="Firefox",O="Google",A="Huawei",x="LG",P="Microsoft",k="Motorola",L="Opera",D="Samsung",M="Sharp",B="Sony",F="Xiaomi",j="Zebra",U="Facebook",$=function(t){for(var e={},n=0;n<t.length;n++)e[t[n].toUpperCase()]=t[n];return e},q=function(t,e){return typeof t===u&&-1!==H(e).indexOf(H(t))},H=function(t){return t.toLowerCase()},W=function(t,e){if(typeof t===u)return t=t.replace(/^\s\s*/,""),typeof e===a?t:t.substring(0,350)},V=function(t,e){for(var n,r,i,a,u,l,h=0;h<e.length&&!u;){var d=e[h],p=e[h+1];for(n=r=0;n<d.length&&!u;)if(u=d[n++].exec(t))for(i=0;i<p.length;i++)l=u[++r],typeof(a=p[i])===c&&a.length>0?2===a.length?typeof a[1]==o?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==o||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):s:this[a[0]]=l?a[1].call(this,l,a[2]):s:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):s):this[a]=l||s;h+=2}},G=function(t,e){for(var n in e)if(typeof e[n]===c&&e[n].length>0){for(var r=0;r<e[n].length;r++)if(q(e[n][r],t))return"?"===n?s:n}else if(q(e[n],t))return"?"===n?s:n;return t},z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[f,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[f,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,f],[/opios[\/ ]+([\w\.]+)/i],[f,[h,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[f,[h,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[h,f],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[f,[h,"UC"+I]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[f,[h,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[f,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[f,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[f,[h,"IE"]],[/yabrowser\/([\w\.]+)/i],[f,[h,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+I],f],[/\bfocus\/([\w\.]+)/i],[f,[h,R+" Focus"]],[/\bopt\/([\w\.]+)/i],[f,[h,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[f,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[f,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[f,[h,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[f,[h,"MIUI "+I]],[/fxios\/([-\w\.]+)/i],[f,[h,R]],[/\bqihu|(qi?ho?o?|360)browser/i],[[h,"360 "+I]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1 "+I],f],[/(comodo_dragon)\/([\w\.]+)/i],[[h,/_/g," "],f],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[h,f],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,U],f],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[h,f],[/\bgsa\/([\w\.]+) .*safari\//i],[f,[h,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[f,[h,N+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,N+" WebView"],f],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[f,[h,"Android "+I]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,f],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[f,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[f,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[f,G,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[h,f],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],f],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[f,[h,R+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[h,f],[/(cobalt)\/([\w\.]+)/i],[h,[f,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[g,"amd64"]],[/(ia32(?=;))/i],[[g,H]],[/((?:i[346]|x)86)[;\)]/i],[[g,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[g,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[g,"armhf"]],[/windows (ce|mobile); ppc;/i],[[g,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[g,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[g,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[g,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[p,D],[d,b]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[l,[p,D],[d,m]],[/\((ip(?:hone|od)[\w ]*);/i],[l,[p,_],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[p,_],[d,b]],[/(macintosh);/i],[l,[p,_]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[l,[p,A],[d,b]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[p,A],[d,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[l,/_/g," "],[p,F],[d,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[l,/_/g," "],[p,F],[d,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[p,"OPPO"],[d,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[p,"Vivo"],[d,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[l,[p,"Realme"],[d,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[p,k],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[p,k],[d,b]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[p,x],[d,b]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[p,x],[d,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[l,[p,"Lenovo"],[d,b]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[l,/_/g," "],[p,"Nokia"],[d,m]],[/(pixel c)\b/i],[l,[p,O],[d,b]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[p,O],[d,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[p,B],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[p,B],[d,b]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[p,"OnePlus"],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[p,E],[d,b]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[p,E],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[l,p,[d,b]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[p,T],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[p,C],[d,b]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[p,C],[d,m]],[/(nexus 9)/i],[l,[p,"HTC"],[d,b]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[l,/_/g," "],[d,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[p,"Acer"],[d,b]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[p,"Meizu"],[d,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[p,M],[d,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,l,[d,m]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,l,[d,b]],[/(surface duo)/i],[l,[p,P],[d,b]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[p,"Fairphone"],[d,m]],[/(u304aa)/i],[l,[p,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[l,[p,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[l,[p,"RCA"],[d,b]],[/\b(venue[\d ]{2,7}) b/i],[l,[p,"Dell"],[d,b]],[/\b(q(?:mv|ta)\w+) b/i],[l,[p,"Verizon"],[d,b]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[p,"Barnes & Noble"],[d,b]],[/\b(tm\d{3}\w+) b/i],[l,[p,"NuVision"],[d,b]],[/\b(k88) b/i],[l,[p,"ZTE"],[d,b]],[/\b(nx\d{3}j) b/i],[l,[p,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[l,[p,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[l,[p,"Swiss"],[d,b]],[/\b((zeki)?tb.*\b) b/i],[l,[p,"Zeki"],[d,b]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],l,[d,b]],[/\b(ns-?\w{0,9}) b/i],[l,[p,"Insignia"],[d,b]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[p,"NextBook"],[d,b]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],l,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],l,[d,m]],[/\b(ph-1) /i],[l,[p,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[p,"Envizen"],[d,b]],[/\b(trio[-\w\. ]+) b/i],[l,[p,"MachSpeed"],[d,b]],[/\btu_(1491) b/i],[l,[p,"Rotor"],[d,b]],[/(shield[\w ]+) b/i],[l,[p,"Nvidia"],[d,b]],[/(sprint) (\w+)/i],[p,l,[d,m]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[p,P],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[p,j],[d,b]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[p,j],[d,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,l,[d,y]],[/droid.+; (shield) bui/i],[l,[p,"Nvidia"],[d,y]],[/(playstation [345portablevi]+)/i],[l,[p,B],[d,y]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[p,P],[d,y]],[/smart-tv.+(samsung)/i],[p,[d,v]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[p,D],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,x],[d,v]],[/(apple) ?tv/i],[p,[l,_+" TV"],[d,v]],[/crkey/i],[[l,N+"cast"],[p,O],[d,v]],[/droid.+aft(\w)( bui|\))/i],[l,[p,E],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[p,M],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[l,[p,B],[d,v]],[/(mitv-\w{5}) bui/i],[l,[p,F],[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[p,W],[l,W],[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/((pebble))app/i],[p,l,[d,w]],[/droid.+; (glass) \d/i],[l,[p,O],[d,w]],[/droid.+; (wt63?0{2,3})\)/i],[l,[p,j],[d,w]],[/(quest( 2)?)/i],[l,[p,U],[d,w]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[l,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,b]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,b]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/(android[-\w\. ]{0,9});.+buil/i],[l,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[f,[h,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[f,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[h,f],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[f,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,f],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[h,[f,G,z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[h,"Windows"],[f,G,z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[f,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,"Mac OS"],[f,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[f,h],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[h,f],[/\(bb(10);/i],[f,[h,T]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[f,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[f,[h,R+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[f,[h,"webOS"]],[/crkey\/([\d\.]+)/i],[f,[h,N+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[h,"Chromium OS"],f],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,f],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],f],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[h,f]]},Y=function(t,e){if(typeof t===c&&(e=t,t=s),!(this instanceof Y))return new Y(t,e).getResult();var n=t||(typeof i!==a&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=e?function(t,e){var n={};for(var r in t)e[r]&&e[r].length%2==0?n[r]=e[r].concat(t[r]):n[r]=t[r];return n}(K,e):K;return this.getBrowser=function(){var t,e={};return e[h]=s,e[f]=s,V.call(e,n,r.browser),e.major=typeof(t=e.version)===u?t.replace(/[^\d\.]/g,"").split(".")[0]:s,e},this.getCPU=function(){var t={};return t[g]=s,V.call(t,n,r.cpu),t},this.getDevice=function(){var t={};return t[p]=s,t[l]=s,t[d]=s,V.call(t,n,r.device),t},this.getEngine=function(){var t={};return t[h]=s,t[f]=s,V.call(t,n,r.engine),t},this.getOS=function(){var t={};return t[h]=s,t[f]=s,V.call(t,n,r.os),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(t){return n=typeof t===u&&t.length>350?W(t,350):t,this},this.setUA(n),this};Y.VERSION="1.0.33",Y.BROWSER=$([h,f,"major"]),Y.CPU=$([g]),Y.DEVICE=$([l,p,d,y,m,v,b,w,S]),Y.ENGINE=Y.OS=$([h,f]),typeof e!==a?(t.exports&&(e=t.exports=Y),e.UAParser=Y):n.amdO?(r=function(){return Y}.call(e,n,e,t))===s||(t.exports=r):typeof i!==a&&(i.UAParser=Y);var X=typeof i!==a&&(i.jQuery||i.Zepto);if(X&&!X.ua){var Z=new Y;X.ua=Z.getResult(),X.ua.get=function(){return Z.getUA()},X.ua.set=function(t){Z.setUA(t);var e=Z.getResult();for(var n in e)X.ua[n]=e[n]}}}("object"==typeof window?window:this)},5512:t=>{"use strict";t.exports=function(t,e,n,r){var i=self||window;try{try{var s;try{s=new i.Blob([t])}catch(e){(s=new(i.BlobBuilder||i.WebKitBlobBuilder||i.MozBlobBuilder||i.MSBlobBuilder)).append(t),s=s.getBlob()}var o=i.URL||i.webkitURL,a=o.createObjectURL(s),c=new i[e](a,n);return o.revokeObjectURL(a),c}catch(r){return new i[e]("data:application/javascript,".concat(encodeURIComponent(t)),n)}}catch(t){if(!r)throw Error("Inline worker is not supported");return new i[e](r,n)}}},5340:()=>{},9838:()=>{}},__webpack_module_cache__={};function __webpack_require__(t){var e=__webpack_module_cache__[t];if(void 0!==e)return e.exports;var n=__webpack_module_cache__[t]={id:t,loaded:!1,exports:{}};return __webpack_modules__[t].call(n.exports,n,n.exports,__webpack_require__),n.loaded=!0,n.exports}__webpack_require__.amdO={},__webpack_require__.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return __webpack_require__.d(e,{a:e}),e},__webpack_require__.d=(t,e)=>{for(var n in e)__webpack_require__.o(e,n)&&!__webpack_require__.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),__webpack_require__.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),__webpack_require__.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{var t;__webpack_require__.g.importScripts&&(t=__webpack_require__.g.location+"");var e=__webpack_require__.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var n=e.getElementsByTagName("script");if(n.length)for(var r=n.length-1;r>-1&&(!t||!/^http(s?):/.test(t));)t=n[r--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),__webpack_require__.p=t})();var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>bc});class t{aborted=!1;loaded=0;retry=0;total=0;chunkCount=0;bwEstimate=0;trequest=0;tfirst=0;tload=0;tparsed=0;loading={start:0,first:0,end:0};parsing={start:0,end:0};buffering={start:0,first:0,end:0}}class e{logger;polyNetGet;polyNetSubscription;hlsjsConfig;stats;requestTimeout;retryTimeout;context;callbacks;config;retryDelay;constructor(t){let{polyNetLoaderConfig:e,hlsjsConfig:n}=t;this.polyNetGet=e.polyNetGet,this.logger=e.logger,this.hlsjsConfig=n}destroy(){this.destroyInternal(),this.callbacks=null,this.config=null}setMaxRetry(t){if(this.context.frag)t.maxRetry=this.hlsjsConfig.fragLoadingMaxRetry;else switch(this.context.type){case"level":t.maxRetry=this.hlsjsConfig.levelLoadingMaxRetry;break;case"manifest":t.maxRetry=this.hlsjsConfig.manifestLoadingMaxRetry}}getResponseHeader(){return null}getCacheAge(){return null}destroyInternal(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];window.clearTimeout(this.requestTimeout),window.clearTimeout(this.retryTimeout),this.polyNetSubscription?.closed||this.polyNetSubscription?.unsubscribe(),t&&(this.logger.warn(`Aborting content: ${this.context.url}`),this.stats.aborted=!0),this.requestTimeout=null,this.retryTimeout=null,this.polyNetSubscription=null}abort(){this.destroyInternal(!0),this.callbacks?.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.polyNetSubscription)}load(e,n,r){this.context=e,this.setMaxRetry(n),this.config=n,this.callbacks=r,this.stats=new t,this.stats.loading.start=this.stats.trequest=performance.now(),this.stats.retry=0,this.retryDelay=n.retryDelay,e.frag&&(e.frag.stats=this.stats),this.logger.trace(`Request url ${this.context.url}`),this.loadInternal()}loadInternal(){this.stats.loading.first=this.stats.tfirst=0,this.stats.loaded=0,this.stats.aborted=!1,this.requestTimeout=window.setTimeout(this.loadTimeout.bind(this),this.config.timeout);let t={};this.context.rangeEnd&&(t.Range=`bytes=${this.context.rangeStart}-${this.context.rangeEnd}`),this.polyNetSubscription=this.polyNetGet({url:this.context.url,context:this.context,responseType:this.context.responseType,headers:t}).subscribe({next:t=>this.loadContent(t),error:t=>this.loadError(t)})}loadContent(t){if(this.stats.aborted)return;if(window.clearTimeout(this.requestTimeout),0===this.stats.loading.first&&(this.stats.loading.first=this.stats.tfirst=Math.max(performance.now(),this.stats.loading.start)),!t.completed)return;this.stats.loading.end=this.stats.tload=Math.max(performance.now(),this.stats.loading.first),this.stats.loaded=this.stats.total=t.contentLoaded;const e=Math.round(this.stats.loading.end-this.stats.loading.start);this.logger.trace(`Completed content: ${this.context.url}, took: ${e} ms`);const n=t.contentData;this.callbacks.onProgress&&this.callbacks.onProgress(this.stats,this.context,n,this.polyNetSubscription);let r={url:t.url,data:n};this.callbacks.onSuccess(r,this.stats,this.context,this.polyNetSubscription)}loadError(t){if(!this.stats.aborted)if(window.clearTimeout(this.requestTimeout),this.stats.retry<this.config.maxRetry)this.logger.warn(`${t.errorReason} while loading ${this.context.url}, retrying in ${this.retryDelay} ms...`),this.destroyInternal(t.aborted),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,this.config.maxRetryDelay)||1,this.stats.retry++;else{this.logger.warn(`${t.errorReason} while loading ${this.context.url}, maxRetry reached.`);const e={code:t.errorCode,text:t.errorReason};this.callbacks?.onError(e,this.context,this.polyNetSubscription)}}loadTimeout(){this.logger.warn(`Timeout content: ${this.context.url}`),this.destroyInternal(!0),this.callbacks?.onTimeout(this.stats,this.context,this.polyNetSubscription)}}var n=__webpack_require__(7885),r=__webpack_require__.n(n),i=__webpack_require__(8692),s=__webpack_require__.n(i),o=__webpack_require__(6401),a=__webpack_require__.n(o),c=__webpack_require__(5015),u=__webpack_require__.n(c),l=__webpack_require__(3176),h=__webpack_require__.n(l),d=__webpack_require__(187),p=__webpack_require__.n(d),f=__webpack_require__(702),g=__webpack_require__.n(f),y=__webpack_require__(9767),m=__webpack_require__.n(y),b=__webpack_require__(2836),v=__webpack_require__.n(b),w=__webpack_require__(577),S=__webpack_require__.n(w),E=__webpack_require__(3667),_=__webpack_require__.n(E),C=__webpack_require__(7037),T=__webpack_require__.n(C),I=__webpack_require__(5853),N=__webpack_require__.n(I),R=__webpack_require__(7196),O=__webpack_require__.n(R),A=__webpack_require__(3553),x=__webpack_require__.n(A),P=__webpack_require__(8498),k=__webpack_require__.n(P),L=__webpack_require__(3214),D=__webpack_require__.n(L),M=__webpack_require__(6233),B=__webpack_require__.n(M),F=__webpack_require__(9169),j=__webpack_require__.n(F),U=__webpack_require__(7595),$=__webpack_require__.n(U),q=__webpack_require__(5604),H=__webpack_require__.n(q),W=__webpack_require__(7155),V=__webpack_require__.n(W),G=__webpack_require__(4950),z=__webpack_require__.n(G),K=__webpack_require__(689),Y=__webpack_require__.n(K),X=__webpack_require__(1558),Z=__webpack_require__.n(X),J=__webpack_require__(7253),Q=__webpack_require__.n(J),tt=__webpack_require__(3977),et=__webpack_require__.n(tt),nt=__webpack_require__(4187),rt=__webpack_require__.n(nt),it=__webpack_require__(1997),st=__webpack_require__.n(it);const ot={assign:r(),camelCase:s(),cloneDeep:a(),find:u(),groupBy:h(),isEmpty:p(),isEqual:g(),isFinite:m(),isFunction:v(),isNil:S(),isObject:_(),isRegExp:T(),isString:N(),matches:O(),mean:x(),merge:k(),mergeWith:D(),omit:B(),pick:j(),random:$(),remove:H(),repeat:V(),snakeCase:z(),sortBy:Y(),transform:Z(),uniq:Q(),uniqWith:et(),unset:rt(),waitFor:function(t){return new Promise((e=>{setTimeout(e,t)}))},zip:st()};class at extends Error{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:at.Codes.UNKNOWN_ERROR,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:at.NAME;super(),this.errCode=e,this.name=n,this.message=`[${this.name}] ${t} ${this.errCode}`,Error.captureStackTrace&&Error.captureStackTrace(this,at)}}at.NAME="ApplicationError",function(t){let e;!function(t){t.UNKNOWN_ERROR="UNKNOWN ERROR",t.NULL_OR_UNDEFINED="NULL OR UNDEFINED",t.TYPE_ERROR="TYPE ERROR",t.WEB_WORKER_ERROR="WEB_WORKER ERROR",t.NOT_VALID_REPRESENTATION="NOT VALID REPRESENTATION",t.DATACHANNEL_NOT_FOUND="NO DATACHANNEL",t.DATACHANNEL_NOT_OPEN="NOT OPEN DATACHANNEL",t.CONTENT_CACHE_EXISTING="CONTENT CACHE EXISTING",t.CONTENT_CACHE_NOT_FOUND="CONTENT CACHE NOT FOUND",t.CONTENT_CACHE_SIZE_EXCEEDED="CONTENT CACHE SIZE EXCEEDED"}(e=t.Codes||(t.Codes={}))}(at||(at={}));class ct extends at{constructor(){super("Check your API Key. If problem persists, contact support at support@system73.com.",-600,ct.NAME)}}ct.NAME="InvalidApiKeyBase64Format";class ut extends at{constructor(){super("Check your API Key. If problem persists, contact support at support@system73.com.",-601,ut.NAME)}}ut.NAME="InvalidApiKeyJSONFormat";class lt extends at{constructor(){super(`Check your API Key. Detail: ${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"No detail"}. If problem persists, contact support at support@system73.com.`,-602,lt.NAME)}}lt.NAME="InvalidApiKeyProperties";class ht extends at{constructor(){super(`The PolyNet SDK has failed to build. Detail: ${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"No detail"}. If problem persists, contact support at support@system73.com.`,-603,ht.NAME)}}ht.NAME="InternalBuildError";class dt extends at{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"The PolyNet SDK has failed and raised an exception. If problem persists, contact support at support@system73.com.",-700,dt.NAME)}static throw(t,e){t.error(new dt(e))}}dt.NAME="PolyNetInternalError";class pt extends at{constructor(){super(`The PolyNet SDK is not compatible with the Tracker. Tracker code: ${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"No detail"}. This may happen in transitions to newer versions. If problem persists, contact support at support@system73.com.`,-701,pt.NAME)}static throw(t,e){t.error(new pt(e))}}pt.NAME="UnsupportedTracker";class ft extends at{constructor(){super(`Error communicating with Tracker. Detail: ${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"No detail"}. If problem persists, contact support at support@system73.com.`,-702,ft.NAME)}static throw(t,e){t.error(new ft(e))}}ft.NAME="UnreachableTracker";class gt extends at{constructor(){super(`Error communicating with Tracker metrics endpoint. Detail: ${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"No detail"}. If problem persists, contact support at support@system73.com.`,-703,gt.NAME)}static throw(t,e){t.error(new gt(e))}}gt.NAME="UnreachableTrackerMetricsEndpoint";class yt extends at{constructor(){super("The Api Key is revoked from Tracker. Please, contact support at support@system73.com.",-704,yt.NAME)}static throw(t){t.error(new yt)}}yt.NAME="RevokedApiKey";class mt extends at{constructor(){super(`PolyNet connection rejected. Detail: ${arguments.length>0&&void 0!==arguments[0]?arguments[0]:"No detail"}. If problem persists, contact support at support@system73.com.`,-705,mt.NAME)}static throw(t,e){t.error(new mt(e))}}mt.NAME="ConcurrencyLimitationsReached";class bt extends at{constructor(){super("The content steering API Key is revoked. Please, contact support at support@system73.com.",-706,bt.NAME)}static throw(t){t.error(new bt)}}bt.NAME="RevokedCSToken";class vt{constructor(){this.handlers={},this.eventQueue=[]}emitAsync(t,e){this.eventQueue.push({event:t,payload:e}),Promise.resolve().then((()=>{const{event:t,payload:e}=this.eventQueue.shift();this.emit(t,e)}))}emit(t,e){if((e=e||{}).hasOwnProperty("event")||e.hasOwnProperty("result"))throw new at("'event' or 'result' are reserved words for event dispatching");e.event=t;const n=this.handlers;if(!t||!n[t]||0===n[t].length)return e;const r=n[t];for(let t=0,n=r.length;t<n;t++){const n=r[t];if(n.target&&e.target!==n.target)continue;const i=n.listener.call(n.scope,e);i&&(e.result=i)}return e}on(t,e){let{target:n,scope:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{target:null,scope:null};const i=this.handlers;if(!t)throw new at("event type cannot be null or undefined",at.Codes.NULL_OR_UNDEFINED);if(!e||"function"!=typeof e)throw new at("listener must be a function: "+e,at.Codes.TYPE_ERROR);if(this.getHandlerIndex(t,e,r,n)>=0)return;i[t]=i[t]||[];const s={listener:e,scope:r,target:n};i[t]=i[t].slice(0),i[t].push(s)}once(t,e){let{target:n,scope:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{target:null,scope:null};const i=s=>{this.off(t,i,{scope:r,target:n}),e.call(r,s)};this.on(t,i,{scope:r,target:n});const s=this.getHandlerIndex(t,i,r,n);this.handlers[t][s].once=e}off(t,e){let{scope:n,target:r}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{scope:null,target:null};const i=this.handlers;if(!t||!e||!i[t])return;const s=this.getHandlerIndex(t,e,n,r);s<0||(i[t]=i[t].slice(0),i[t].splice(s,1))}offAll(){let{scope:t,target:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{scope:null,target:null};const n=this.handlers;for(const r of Object.keys(n))n[r].forEach((n=>{const i=r;this.off(i,n.listener,{scope:t,target:e})}))}getHandlerIndex(t,e,n,r){return this.handlers[t]?this.handlers[t].findIndex((t=>!(t.listener!==e&&t.once!==e||n&&n!==t.scope||r&&r!==t.target))):-1}}var wt=__webpack_require__(7884);class St{static debug(){console.debug(...arguments)}static info(){console.info(...arguments)}static warn(){console.warn(...arguments)}static error(){console.error(...arguments)}}class Et{static destroyContext(t){const e=Et.SINGLETON_CONTEXTS.get(t);e&&(function(t){const e=[];return t.forEach((t=>e.push(t))),e}(e).reverse().forEach((t=>{try{t.destroy()}catch(t){St.error(t)}})),Et.removeContext(t))}static removeContext(t){Et.SINGLETON_CONTEXTS.delete(t)}static getSingletonInstance(t,e){const n=Et.SINGLETON_CONTEXTS.get(t);return n?n.get(wt.sha1(e)):null}static setSingletonInstance(t,e,n){let r=Et.SINGLETON_CONTEXTS.get(t);r||(r=new Map,Et.SINGLETON_CONTEXTS.set(t,r)),r.set(wt.sha1(e),n)}static getSingletonFactory(t){const e=e=>{let n;return void 0===e&&(e={}),{getInstance:function(){if(n||(n=Et.getSingletonInstance(e,t)),!n){for(var r=arguments.length,i=new Array(r),s=0;s<r;s++)i[s]=arguments[s];n=Et.instance(e,t,i),Et.setSingletonInstance(e,t,n)}return n}}};return Et.initFactoryProperties(t,e),e}static getInstanceFactory(t){const e=e=>(void 0===e&&(e={}),{createInstance:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];return Et.instance(e,t,r)}});return Et.initFactoryProperties(t,e),e}static instance(t,e,n){const r={construct:(e,n,r)=>new class extends e{constructor(){super(...arguments)}get context(){return t}}(...n[0])};return new new Proxy(e,r)(n)}static initFactoryProperties(t,e){for(const[n,r]of Object.entries(t))-1!==n.indexOf("polyNetFactory")&&(e[n]=r);e.polyNetFactoryClass=t}}Et.SINGLETON_CONTEXTS=new Map;class _t extends vt{destroy(){this.offAll()}}_t.polyNetFactoryName="EventBus";const Ct=Et.getSingletonFactory(_t);class Tt{get context(){return this._context}set context(t){this._context=t}start(){}stop(){}destroy(){}}var It,Nt;!function(t){t[t.OFF=0]="OFF",t[t.ERROR=1]="ERROR",t[t.WARN=2]="WARN",t[t.INFO=3]="INFO",t[t.DEBUG=4]="DEBUG",t[t.TRACE=5]="TRACE"}(It||(It={})),function(t){t.OFF="OFF",t.BASIC="BASIC"}(Nt||(Nt={}));class Rt extends Tt{setup(t,e){this.loggerSettings=t||this.loggerSettings,this.setupConsole(e)}get(t){return(this.loggerSettings||{})[t]}setupConsole(t){const e=this.get("console");if(!ot.isNil(t)&&!ot.isNil(e))switch(typeof t){case"string":t=t.toUpperCase(),e.level=It[t]?t:It[It.OFF];break;case"boolean":e.level=t?It[It.DEBUG]:It[It.OFF];break;case"number":e.level=It[t]?It[t]:It[It.OFF]}}}Rt.polyNetFactoryName="LoggerSettings";const Ot=Et.getSingletonFactory(Rt);class At extends Tt{constructor(t,e){super(),this.name=t,this.messageBuffer=new Map,this.loggers=[],this.appenders=[],e&&(this.appenders=this.appenders.concat(e.appenders))}getLogger(t){let e=this.loggers.find(ot.matches({name:t}));return e||(e=new At(t,this),e.context=this.context,this.loggers.push(e)),e}trace(t,e){this.log(It.TRACE,t,e)}debug(t,e){this.log(It.DEBUG,t,e)}info(t,e){this.log(It.INFO,t,e)}warn(t,e){this.log(It.WARN,t,e)}error(t,e){this.log(It.ERROR,t,e)}logEvery(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:It.DEBUG,i=arguments.length>4?arguments[4]:void 0;this.messageBuffer.get(e)&&this.messageBuffer.get(e)%t!=0||this.log(r,n,i),this.messageBuffer.set(e,this.messageBuffer.get(e)?this.messageBuffer.get(e)+1:1)}logOnce(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:It.DEBUG,r=arguments.length>3?arguments[3]:void 0;this.messageBuffer.get(t)||(this.log(n,e,r),this.messageBuffer.set(t,!0))}logWhenChange(t,e){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:It.DEBUG,r=arguments.length>3?arguments[3]:void 0;this.messageBuffer.get(t)!==e&&this.log(n,e,r),this.messageBuffer.set(t,e)}integration(t,e){this.log(It.INFO,t,e)}log(t,e,n){const r=new Date;n&&n instanceof Error&&n.stack&&(e=`${e}\n${n.stack}`);for(const n of this.appenders)n.log(this,t,r,e)}registerAppender(t){ot.isNil(t)||(this.appenders.push(t),this.loggers.forEach((e=>e.registerAppender(t))))}}At.polyNetFactoryName="Logger";const xt=Et.getSingletonFactory(At);class Pt extends Tt{constructor(t){if(super(),!ot.isString(t)||ot.isEmpty(t))throw new TypeError(`ID ${t} is not a valid string`);this.id=t,this._settings=Ot(this.context).getInstance()}get settings(){return this._settings.get(this.id)}isLevelEnabled(t){const e=It[this.settings.level.toUpperCase()];return!ot.isNil(e)&&e>=t}}class kt extends Pt{constructor(t){super(t)}log(t,e,n,r){if(!this.isLevelEnabled(e)&&e!==It.ERROR)return;const i=this.getLog(e);i&&i(`${this.formatDate(n)} ${It[e].toUpperCase()} ${t.name} ${r}`)}getLog(t){switch(t){case It.TRACE:case It.DEBUG:return St.debug;case It.INFO:return St.info;case It.WARN:return St.warn;case It.ERROR:return St.error}}formatDate(t){return t.toISOString().slice(11).substring(0,12)}}kt.polyNetFactoryName="LoggerConsoleAppender";const Lt=Et.getInstanceFactory(kt);var Dt=__webpack_require__(887),Mt=__webpack_require__.n(Dt),Bt=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class Ft extends Pt{constructor(t,e){super(t),this.queue=[],this.messageId=0,this.metadataProvider=null!=e?e:{}}destroy(){this.stopSending(),this.queue=null}log(t,e,n,r){if(!this.queue||!this.settings)return void St.warn(`Attempted to log message after destruction: ${r}`);if(!this.isEnabled)return this.stopSending(),void(this.queue=[]);if(!this.isLevelEnabled(e))return;this.queue.length>=this.settings.maxQueueSize&&this.queue.shift();const{deviceId:i,nodeId:s,platform:o,sessionId:a,channelId:c}=this.metadataProvider;this.queue.push({deviceId:i,logger:t.name,messageId:""+this.messageId++,msgData:{},channelId:c,nodeId:s,platform:o,sessionId:a,severity:It[e],text:r,timestamp:n.toISOString()}),this.isRunning||this.schedule(ot.random(0,this.settings.postTimeout))}get isEnabled(){var t,e;return!!(null===(t=this.settings)||void 0===t?void 0:t.enabled)&&!!(null===(e=this.settings)||void 0===e?void 0:e.url)}get isRunning(){return!ot.isNil(this.timer)}get authConfig(){var t,e;const n=null===(t=this.settings)||void 0===t?void 0:t.auth;if(!(null==n?void 0:n.enabled))return;return(null===(e=n.type)||void 0===e?void 0:e.toUpperCase())===Nt.BASIC?Object.assign({},n.basic):void 0}stopSending(){clearTimeout(this.timer),this.timer=null}schedule(t){this.timer=setTimeout((()=>this.send()),t)}send(){return Bt(this,void 0,void 0,(function*(){const t=this.settings.batchSize;for(;this.queue.length>=t;){const e=this.queue.splice(0,t);yield this.sendBatch(e)}this.schedule(this.settings.postTimeout)}))}sendBatch(t){return Bt(this,void 0,void 0,(function*(){const e=this.authConfig,n=e?{auth:e}:void 0;let r=0,i=yield Ft.postBatch(this.settings.url,t,n);for(;!i&&r<this.settings.maxRetries;)yield ot.waitFor(this.settings.retryTimeout),i=yield Ft.postBatch(this.settings.url,t,n),r++}))}static postBatch(t,e,n){return Bt(this,void 0,void 0,(function*(){try{return yield Mt().post(t,e,n),!0}catch(t){return t.response?St.warn(`Error sending log to server. Status: ${t.response.status}: ${t.response.data}`):St.warn(`Error sending log to server: «${t.message}»`),!1}}))}}Ft.polyNetFactoryName="LoggerHttpAppender";const jt=Et.getInstanceFactory(Ft);class Ut{static sentTrackerMessage(t){return`⬆️ Sent: ${t}`}static receivedTrackerMessage(t){return`⬇️ Received: ${JSON.stringify(t)}`}static sentContentRequest(t,e,n){return`${Ut.sentP2PBegin(t)} ContentRequest, contentId: ${e}, duration: ${n}`}static sentContentResponseStart(t,e,n,r){return`${Ut.sentP2PBegin(t)} ContentResponseStart, contentId: ${e}, contentLength: ${n}, duration: ${r}`}static sentContentResponseEnd(t,e,n,r,i){return`${Ut.sentP2PBegin(t)} ContentResponseEnd, contentId: ${e}, contentLength: ${n}, chunksAmount: ${r}, crc32: ${i}`}static sentLoopCheck(t,e){return`${Ut.sentP2PBegin(t)} LoopCheck, nodeId: ${e}`}static sentTakeControl(t){return`${Ut.sentP2PBegin(t)} TakeControl`}static receivedPeerMessage(t,e){return`${Ut.receivedP2PBegin(t)} ${e}`}static receivedContentRequest(t,e,n){return`${Ut.receivedP2PBegin(t)} ContentRequest, contentId: ${e}, duration: ${n}`}static receivedContentResponseStart(t,e,n,r){return`${Ut.receivedP2PBegin(t)} ContentResponseStart, contentId: ${e}, contentLength: ${n}, duration: ${r}`}static receivedContentResponseProgress(t,e,n){return`${Ut.receivedP2PBegin(t)} ContentResponseProgress, contentId: ${e}, chunkId: ${n}`}static receivedContentResponseEnd(t,e,n,r,i){return`${Ut.receivedP2PBegin(t)} ContentResponseEnd, contentId: ${e}, contentLength: ${n}, chunksAmount: ${r}, crc32: ${i}`}static receivedLoopCheck(t,e){return`${Ut.receivedP2PBegin(t)} LoopCheck, nodeId: ${e}`}static receivedTakeControl(t){return`${Ut.receivedP2PBegin(t)} TakeControl`}static requestCreatedFromPlayer(t){return`➕PLAYER Did create request for URL: ${t}`}static requestCreated(t,e){return`➕Did create request for URL: ${t}${Ut.printContentId(t,e)}`}static requestHit(t,e){return`Requested: ✅ Hit for contentId: ${t}, URL: ${Ut.toShortURL(e)}`}static requestMiss(t,e){return`Requested: ❎️ Miss for contentId: ${t}, URL: ${Ut.toShortURL(e)}`}static noShareableRequest(t,e){return`Requested: Non-shareable content URL: ${Ut.toShortURL(e)}${Ut.printContentId(e,t)}`}static requestingCDN(t,e){return`Requesting to CDN, URL: ${Ut.toShortURL(t)} ${Ut.printContentId(t,e)}`}static completeContentShareable(t,e,n){return`Complete: Content with URL: ${Ut.toShortURL(e)}, crc32: ${n}${Ut.printContentId(e,t)}`}static completeContentNonShareable(t){return`Complete: Non-shareable content with URL: ${Ut.toShortURL(t)}`}static printCache(t){return`Cache: [${t.join(",")}]`}static finishedRequest(t,e,n,r,i,s,o){const a=(i-n)/1e3,c=(r-n)/1e3,u=(i-r)/1e3;return`✔️Did finish request for URL: ${Ut.toShortURL(t)}, source: ${"HTTP"===e?"CDN":"P2P"}, total: ${a.toFixed(Ut.MAX_DECIMALS)}, lag: ${c.toFixed(Ut.MAX_DECIMALS)}, streamed: ${u.toFixed(Ut.MAX_DECIMALS)} ${Ut.printContentId(t,s)},`+(o?` duration: ${o}`:"")}static bufferHealthEnabled(){return"💙 Player buffer health countermeasure is enabled."}static bufferHealthStable(t,e,n){return`💚 Player buffer health stable. ${Math.round(t)} ms. | ${e} ms. | ${e+n} ms. (current | threshold | threshold + delta)`}static bufferHealthCriticalP2P(t,e,n){return`💔 Player buffer health critical when 🔻 inbound P2P. Repairing... ${Math.round(t)} ms. | ${e} ms. | ${e+n} ms. (current | threshold | threshold + delta)`}static bufferHealthCriticalCDN(t,e,n){return`💔 ️Player buffer health critical when inbound CDN. ${Math.round(t)} ms. | ${e} ms. | ${e+n} ms. (current | threshold | threshold + delta)`}static printPlaylist(t,e){return`Playlist, URL: ${Ut.toShortURL(t)}\n${e}`}static printHlsMediaPlaylistSummary(t,e,n,r,i){return`HLS media playlist summary, URL: ${Ut.toShortURL(t)}, target duration: ${e}, size: ${n}, media sequences: ${r}-${i}`}static representationsUpdated(t){return`♻️ ️Representations updated, total of ${t}`}static representationChanged(t,e){return`♻️️ ️Representation did change, representationId: ${t}, URL: ${Ut.toShortURL(e)}`}static newBufferThreshold(t,e,n){return`New buffer health threshold: ${t/1e3}, delta: ${e/1e3}, next segment duration: ${n/1e3}`}static liveWindowChanged(t){return`New live window: ${t}`}static initialTimerFires(){return"🔥 Initial connection timer fires. Releasing blocked requests."}static closingTrackerConnection(){return"Closing tracker connection..."}static startingTrackerConnection(){return"Connecting to tracker..."}static scheduledRetryTrackerConnection(t){return`Scheduled retry connection in ${Math.round(t/1e3)} seconds.`}static NATTypeFound(t){return`NAT type found: ${t}`}static ICEConnectionState(t,e,n){return`♦️ ICE connection state changed to ${t} with connectionId: ${e} nodeId: ${n}`}static ICEGatheringState(t,e,n){return`♦️ ICE gathering state changed to ${t} with connectionId: ${e} nodeId: ${n}`}static dataChannelState(t,e,n){return`♦️ WebRTC ${t=(t||"").toUpperCase()+(t?" ":"")}Data channel state changed to ${e} nodeId: ${n}`}static dataChannelPeerOpen(t,e){return`♦ Peer connection did open with connectionId: ${t} nodeId: ${e}`}static dataChannelIsReady(t){return`♦️ P2P connection is READY. Data transfer may start for nodeId: ${t}`}static multiPeerOpeningType(t){return"♦ InboundP2P opening type: "+(t?"sequential":"concurrent")}static openAdditionalConnections(t){return`♦ ${t} will open additional connections`}static metricsComputed(t){return`x10 metrics did compute, last: ${JSON.stringify(t,null,4)}`}static beaconMetrics(t){const e=t=>t?t.substring(t.length-5):"?".repeat(5);return`☸️ Beacon: ${e(t.inboundNodeId)} => ${e(t.nodeId)} - ${t.source} - ${t.representationId} - ${t.bitrate} - BFR ${t.bufferFillingRate} - BH ${t.playerBufferHealth} ${t.gapsInfo}`}static receivedFeatureFlags(t){return`Received feature flags: ${JSON.stringify(t,null,4)}`}static repeatingRequest(t){return`Repeating request with contentId: ${t}`}static waitingToRepeatRequest(t){return`Waiting to repeat request with contentId: ${t}`}static diffBetweenClocks(t){return"New diff between clocks: "+t/1e3}static fetchingMediaPlaylist(){return"Fetching media playlist, trigger: contentCannotBeSatisfied'"}static alreadyFetching(){return"Cannot fetch media playlist because is already fetching"}static autoFetching(t){return`AutoFetching segment URL: ${Ut.toShortURL(t)}`}static vodMode(){return"VoD"}static outsideWindow(){return"Live - Outside DVR window"}static insideWindow(){return"Live - Inside DVR window"}static estimatorStarted(t){return`Estimator started with capacity: ${t}`}static capacityChange(t,e,n){return`Capacity: ${t} -> ${e}. ${n}`}static cdnLowBfr(t){return`CDN with low BFR: ${t}`}static cdnEnoughCapacity(){return"CDN with no children, enough capacity"}static newAttempt(){return"Trying with a new attempt"}static noMoreAttempts(){return"No more attempts allowed"}static waitAttempt(){return"Waiting for a new attempt"}static increaseCapacity(t){return`Increase. Outbound BFRs median = ${t}`}static increaseCapacityBySensor(){return"Increased by sensor"}static decreaseCapacity(t){return`Decrease. Outbound BFRs median = ${t}`}static decreaseCapacityChildLost(t){return`Decrease after a lost child. Reason: ${t}`}static keepCapacity(t){return`Keep. Outbound BFRs median = ${t}`}static adaptCapacity(t,e){return`Adapt for bitrate: ${t} -> ${e}`}static adaptCapacityNewRepresentation(t,e){return`Adapt for bitrate: ${t} -> ${e}. New representation`}static reuseCapacity(){return"Reuse former capacity"}static restartCapacityNewRepresentation(){return"Restart. New representation"}static zeroCapacityNewRepresentation(){return"Zero. New representation"}static sensingStart(t,e){return`Sensing starts, target: ${t}, to cork: ${e} bits.`}static sensingEnded(t){return`Sensing ended, detected BFR: ${t}`}static uncorkingOutbounds(){return"Sensing cork done, uncorking..."}static sensingTimeout(){return"🔥 Sensing timeout."}static overflowBytesSent(){return"Overflow in bytes sent value."}static invalidSensingResult(){return"Invalid sensing result."}static fetchingHostList(){return"🔥 Fetching host list."}static pickingHostForRetrievingContent(t){return`Picking host ${t} for retrieving content.`}static pickingOriginalHostAsFallback(t){return`Picking original host as fallback: ${t}`}static allHostsBanned(){return"All hosts has been banned"}static addHostToBannedList(t){return`Adding host to banned list: ${t}`}static unbanningHost(t){return`Unbanning host ${t}`}static newHostList(t){return`New host list: [${t.join(",")}]`}static errorFetchingResourceWithResponse(t,e,n){return`Error fetching resource from CDN: ${t} - Status: ${e}: ${n}`}static errorFetchingResourceNoResponse(t,e){return`Error fetching resource from CDN: ${t} - Error: «${e}»`}static version(t){return`Version ${t}`}static systemInfo(t,e){return`${t.name} v${t.version} running on ${e.name} ${e.version}`}static trackerURL(t){return`Tracker URL: ${t}`}static trackerMetricsURL(t){return`Tracker metrics URL: ${t}`}static stunURL(t){return`Stun URL: ${t}`}static channelIdentifier(t){return`Channel identifier: ${t}`}static trackerClosed(){return"Connection to the Tracker was unexpectedly closed."}static connectedTo(t,e,n){return`Connected to ${t} ${e.toLowerCase()} with nodeId: ${n}`}static disconnectedFrom(t,e,n){return`Disconnected from ${t} ${e.toLowerCase()} with nodeId: ${n}`}static trackerCDN(t){return`Connected successfully to the Tracker, with nodeId: ${t} Will fetch from CDN.`}static trackerP2P(t,e){return`Connected successfully to the Tracker, with nodeId: ${t} Will fetch from P2P (parent nodeId: ${e})`}static moveCDN(){return"Node is moving, Will fetch from CDN"}static moveP2P(t){return`Node is moving. Will fetch from P2P (parent nodeId: ${t})`}static printContentId(t,e){return e&&t!==e?`, contentId: ${e}`:""}static toShortURL(t){if(!t)return;const e=t.split("/");return((t=e[e.length-1]).length>Ut.MAX_URL_LENGTH?"...":"")+t.slice(-Ut.MAX_URL_LENGTH)}static sentP2PBegin(t){return`nodeId: ${t} 🔺 Sent:`}static receivedP2PBegin(t){return`nodeId: ${t} 🔻 Received:`}static logContentStatsForBfr(t){let{id:e,representationId:n,origin:r,duration:i,timeFirst:s,timeResponse:o,retries:a}=t;return`(${e}|${n}|${r}|${i/1e3}|#${a}|${s/1e3}|${o/1e3})`}static logContentCacheForBfr(t){let{id:e,representationId:n,origin:r,duration:i,firstTimeFirst:s,timeFirst:o,timeResponse:a,discardedTime:c,retries:u}=t,l=`(${e}|${n}|${r}|${i/1e3}|#${u}`;return l+=`|${s/1e3}|${o/1e3}|${a/1e3}|${c/1e3}`,l+=")",l}static genericErrorFetchingSteeringManifest(t){return`Error fetching the steering manifest from ${t}`}static fetchingSteeringManifest(){return"☸️ Fetching content steering manifest."}static contentSteeringManifestResponse(t){return`☸️ Content steering manifest response: ${t}`}static replacedUrlByPathMatching(t,e){return`☸️ Replace base url in content from: ${t} to cdn: ${e} by matching paths`}static replacedUrlByHostname(t,e){return`☸️ Replace base url in content from: ${t} to cdn: ${e} by hostname`}static reportBufferFillingRate(t,e,n){return`💉 Debug BFR: Report ${e} BFR ${t} ${n?"forced zero":""}`}static updateBufferFillingRateCalculationOnRequests(t,e,n,r,i,s,o,a){return`💉 Debug BFR: Update ${n} BFR ${e} -> ${t}, on requests, division ${r} / ${i} (elapsed ${o/1e3} - ${s/1e3}), contents: [ ${a.join(", ")} ]`}static updateBufferFillingRateCalculationOnThroughput(t,e,n,r,i,s,o){return`💉 Debug BFR: Update ${n} BFR ${e} -> ${t}, on throughput, division ${r} / ${i} (actual bitrate = ${8*s} / ${o/1e3}), data: ${JSON.stringify({bitrate:i,nloaded:s,tdelta:o})}`}static clearBufferFillingRate(t,e){return`💉 Debug BFR: Clear ${e} BFR ${t}`}static printCacheForDebugBfr(t){return"💉 Debug BFR: Cache: "+t.filter((t=>t.isCacheable&&t.isFinished)).map((t=>this.logContentCacheForBfr(t))).join(", ")}static tecaLostParentBfr(t,e,n){const r=e[e.length-1];return`💉 Debug BFR: Lost parent ---\x3e ${t}, Hist inboundBfr: ${JSON.stringify(e)}, medianInboundBfr: ${n}, Last inboundBfr: ${r}`}static tecaLostChildBfr(t,e,n){const r=e[e.length-1];return`💉 Debug BFR: Lost child ---\x3e ${t}, Hist outboundBfr: ${JSON.stringify(e)}, medianOutboundBfr: ${n}, Last outboundBfr: ${r}`}static tecaHistoricalBfrs(t,e,n,r){return`💉 Debug BFR: TECA historical arrays: Hist inbound BFRs (length ${t}, unique ${e}), hist outbound BFRs (length ${n}, unique ${r})`}}var $t;Ut.MAX_DECIMALS=4,Ut.MAX_URL_LENGTH=40,function(t){t.SETTINGS_CHANGED="SETTINGS_CHANGED",t.POLYNET_DATA_CHANGED="POLYNET_DATA_CHANGED",t.POLYNET_STATE_CHANGED="POLYNET_STATE_CHANGED",t.POLYNET_MODE_CHANGED="POLYNET_MODE_CHANGED",t.METRICS_MESSAGE="METRICS_MESSAGE",t.COUNTERMEASURE_TRACKER_RESPONSE_TIMEOUT="COUNTERMEASURE_TRACKER_RESPONSE_TIMEOUT",t.REQUEST_NO_RECOVERY="REQUEST_NO_RECOVERY",t.REQUEST_CONNECT="REQUEST_CONNECT",t.LOG_REQUEST_REPAIR="LOG_REQUEST_REPAIR",t.REQUEST_REPAIR="REQUEST_REPAIR",t.WS_OPEN="WS_OPEN",t.WS_ERROR="WS_ERROR",t.WS_CLOSE="WS_CLOSE",t.WS_MESSAGE="WS_MESSAGE",t.CONNECTION_WEB_RTC_DATA_CHANNEL_OPEN="CONNECTION_WEB_RTC_DATA_CHANNEL_OPEN",t.CONNECTION_WEB_RTC_CLOSED="CONNECTION_WEB_RTC_CLOSED",t.LOOP_CHECK_MESSAGE_RECEIVED="LOOP_CHECK_MESSAGE_RECEIVED",t.CONTENT_CACHE_CONTENT_CREATED="CONTENT_CACHE_CONTENT_CREATED",t.CONTENT_CACHE_CONTENT_UPDATED="CONTENT_CACHE_CONTENT_UPDATED",t.CONTENT_CACHE_CONTENT_ERROR="CONTENT_CACHE_CONTENT_ERROR",t.CONTENT_CACHE_CONTENT_REMOVED="CONTENT_CACHE_CONTENT_REMOVED",t.CONTENT_CACHE_RETRY_NEEDED="CONTENT_CACHE_RETRY_NEEDED",t.DATA_CHANNEL_CREATED="DATA_CHANNEL_CREATED",t.DATA_CHANNEL_STATE_CHANGED="DATA_CHANNEL_STATE_CHANGED",t.DATA_CHANNEL_REMOVED="DATA_CHANNEL_REMOVED",t.DATA_CHANNEL_CONNECTED="DATA_CHANNEL_CONNECTED",t.DATA_CHANNEL_CONNECTING_TIMEOUT="DATA_CHANNEL_CONNECTING_TIMEOUT",t.DATA_CHANNEL_STILL_ALIVE_TIMEOUT="DATA_CHANNEL_STILL_ALIVE_TIMEOUT",t.BROWSER_STATS_CONNECTION_TYPE_CHANGED="BROWSER_STATS_CONNECTION_TYPE_CHANGED",t.CONTENT_URL_MISSING="CONTENT_URL_MISSING",t.MANIFEST_INFO_MISSING="MANIFEST_INFO_MISSING",t.COLLECT_POLYNET_STATS="COLLECT_POLYNET_STATS",t.COLLECT_NETWORK_STATS="COLLECT_NETWORK_STATS",t.COLLECT_STREAMING_STATS="COLLECT_STREAMING_STATS",t.COLLECT_DATA_CHANNEL_STATS="COLLECT_DATA_CHANNEL_STATS",t.COLLECT_MSS_STATS="COLLECT_MSS_STATS",t.COLLECT_CS_STATS="COLLECT_CS_STATS",t.COLLECT_VIDEO_STATS="COLLECT_VIDEO_STATS",t.COLLECT_PLATFORM_STATS="COLLECT_PLATFORM_STATS",t.STREAM_INFO="STREAM_INFO",t.REPRESENTATION_CHANGE="REPRESENTATION_CHANGE"}($t||($t={}));var qt=__webpack_require__(25).Buffer;const Ht="function"==typeof atob,Wt="function"==typeof qt,Vt="function"==typeof TextDecoder?new TextDecoder:void 0,Gt=("function"==typeof TextEncoder&&new TextEncoder,Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=")),zt=(t=>{let e={};return t.forEach(((t,n)=>e[t]=n)),e})(Gt),Kt=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,Yt=String.fromCharCode.bind(String),Xt="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(t,e=t=>t)=>new Uint8Array(Array.prototype.slice.call(t,0).map(e)),Zt=t=>t.replace(/[^A-Za-z0-9\+\/]/g,""),Jt=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,Qt=t=>{switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return Yt(55296+(e>>>10))+Yt(56320+(1023&e));case 3:return Yt((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return Yt((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},te=t=>t.replace(Jt,Qt),ee=t=>{if(t=t.replace(/\s+/g,""),!Kt.test(t))throw new TypeError("malformed base64.");t+="==".slice(2-(3&t.length));let e,n,r,i="";for(let s=0;s<t.length;)e=zt[t.charAt(s++)]<<18|zt[t.charAt(s++)]<<12|(n=zt[t.charAt(s++)])<<6|(r=zt[t.charAt(s++)]),i+=64===n?Yt(e>>16&255):64===r?Yt(e>>16&255,e>>8&255):Yt(e>>16&255,e>>8&255,255&e);return i},ne=Ht?t=>atob(Zt(t)):Wt?t=>qt.from(t,"base64").toString("binary"):ee,re=Wt?t=>Xt(qt.from(t,"base64")):t=>Xt(ne(t),(t=>t.charCodeAt(0))),ie=Wt?t=>qt.from(t,"base64").toString("utf8"):Vt?t=>Vt.decode(re(t)):t=>te(ne(t)),se=t=>Zt(t.replace(/[-_]/g,(t=>"-"==t?"+":"/"))),oe=t=>ie(se(t)),ae=oe,ce=t=>{if("string"!=typeof t)return!1;const e=t.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},ue=6e4;var le,he;!function(t){t.ALWAYS="ALWAYS",t.NEVER="NEVER",t.ONLY_ON_LAN="ONLY_ON_LAN"}(le||(le={})),function(t){t.OFF="off",t.DOWN_SPEED="down_speed",t.DURATION="duration"}(he||(he={}));var de,pe,fe=new(function(){function t(){this.instances=[]}return t.prototype.get=function(t){var e=this.instances.find((function(e){return e.type===t}));return e||(e={type:t,object:new t},this.instances.push(e)),e.object},t}());function ge(t){if(de)try{var e=de.get(t);if(e)return e;if(!pe||!pe.fallback)return e}catch(t){if(!pe||!pe.fallbackOnErrors)throw t}return fe.get(t)}var ye=function(){function t(t,e,n){void 0===n&&(n=!1),this.target=t,this.name=e,this.async=n}return Object.defineProperty(t.prototype,"instance",{get:function(){return ge(this.target)},enumerable:!1,configurable:!0}),t}(),me=function(t){this.groups=[],this.each=!1,this.context=void 0,this.type=t.type,this.target=t.target,this.propertyName=t.propertyName,this.constraints=t.constraints,this.constraintCls=t.constraintCls,this.validationTypeOptions=t.validationTypeOptions,t.validationOptions&&(this.message=t.validationOptions.message,this.groups=t.validationOptions.groups,this.always=t.validationOptions.always,this.each=t.validationOptions.each,this.context=t.validationOptions.context)},be=function(){function t(){}return t.isValid=function(t){var e=this;return"isValid"!==t&&"getMessage"!==t&&-1!==Object.keys(this).map((function(t){return e[t]})).indexOf(t)},t.CUSTOM_VALIDATION="customValidation",t.NESTED_VALIDATION="nestedValidation",t.PROMISE_VALIDATION="promiseValidation",t.CONDITIONAL_VALIDATION="conditionalValidation",t.WHITELIST="whitelistValidation",t.IS_DEFINED="isDefined",t}(),ve=function(){function t(){}return t.prototype.transform=function(t){var e=[];return Object.keys(t.properties).forEach((function(n){t.properties[n].forEach((function(r){var i={message:r.message,groups:r.groups,always:r.always,each:r.each},s={type:r.type,target:t.name,propertyName:n,constraints:r.constraints,validationTypeOptions:r.options,validationOptions:i};e.push(new me(s))}))})),e},t}(),we=__webpack_require__(2590);function Se(){return"undefined"!=typeof globalThis?globalThis:void 0!==we?we:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0}var Ee=function(){function t(){this.validationMetadatas=[],this.constraintMetadatas=[]}return Object.defineProperty(t.prototype,"hasValidationMetaData",{get:function(){return!!this.validationMetadatas.length},enumerable:!1,configurable:!0}),t.prototype.addValidationSchema=function(t){var e=this;(new ve).transform(t).forEach((function(t){return e.addValidationMetadata(t)}))},t.prototype.addValidationMetadata=function(t){this.validationMetadatas.push(t)},t.prototype.addConstraintMetadata=function(t){this.constraintMetadatas.push(t)},t.prototype.groupByPropertyName=function(t){var e={};return t.forEach((function(t){e[t.propertyName]||(e[t.propertyName]=[]),e[t.propertyName].push(t)})),e},t.prototype.getTargetValidationMetadatas=function(t,e,n,r,i){var s=function(t){return void 0!==t.always?t.always:(!t.groups||!t.groups.length)&&n},o=function(t){return!(!r||i&&i.length||!t.groups||!t.groups.length)},a=this.validationMetadatas.filter((function(n){return(n.target===t||n.target===e)&&(!!s(n)||!o(n)&&(!(i&&i.length>0)||n.groups&&!!n.groups.find((function(t){return-1!==i.indexOf(t)}))))})),c=this.validationMetadatas.filter((function(e){return"string"!=typeof e.target&&(e.target!==t&&((!(e.target instanceof Function)||t.prototype instanceof e.target)&&(!!s(e)||!o(e)&&(!(i&&i.length>0)||e.groups&&!!e.groups.find((function(t){return-1!==i.indexOf(t)}))))))})).filter((function(t){return!a.find((function(e){return e.propertyName===t.propertyName&&e.type===t.type}))}));return a.concat(c)},t.prototype.getTargetValidatorConstraints=function(t){return this.constraintMetadatas.filter((function(e){return e.target===t}))},t}();function _e(){var t=Se();return t.classValidatorMetadataStorage||(t.classValidatorMetadataStorage=new Ee),t.classValidatorMetadataStorage}function Ce(t){var e;if(t.validator instanceof Function){if(e=t.validator,ge(Ee).getTargetValidatorConstraints(t.validator).length>1)throw"More than one implementation of ValidatorConstraintInterface found for validator on: ".concat(t.target.name,":").concat(t.propertyName)}else{var n=t.validator;e=function(){function t(){}return t.prototype.validate=function(t,e){return n.validate(t,e)},t.prototype.defaultMessage=function(t){return n.defaultMessage?n.defaultMessage(t):""},t}(),_e().addConstraintMetadata(new ye(e,t.name,t.async))}var r={type:t.name&&be.isValid(t.name)?t.name:be.CUSTOM_VALIDATION,target:t.target,propertyName:t.propertyName,validationOptions:t.options,constraintCls:e,constraints:t.constraints};_e().addValidationMetadata(new me(r))}var Te=function(){function t(){}return t.prototype.toString=function(t,e,n){var r=this;void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===n&&(n="");var i=t?"[1m":"",s=t?"[22m":"",o=function(t){return" - property ".concat(i).concat(n).concat(t).concat(s," has failed the following constraints: ").concat(i).concat(Object.keys(r.constraints).join(", ")).concat(s," \n")};if(e){var a=Number.isInteger(+this.property)?"[".concat(this.property,"]"):"".concat(n?".":"").concat(this.property);return this.constraints?o(a):this.children?this.children.map((function(e){return e.toString(t,!0,"".concat(n).concat(a))})).join(""):""}return"An instance of ".concat(i).concat(this.target?this.target.constructor.name:"an object").concat(s," has failed the validation:\n")+(this.constraints?o(this.property):"")+(this.children?this.children.map((function(e){return e.toString(t,!0,r.property)})).join(""):"")},t}();var Ie=function(){function t(){}return t.replaceMessageSpecialTokens=function(t,e){var n;return t instanceof Function?n=t(e):"string"==typeof t&&(n=t),n&&Array.isArray(e.constraints)&&e.constraints.forEach((function(t,e){n=n.replace(new RegExp("\\$constraint".concat(e+1),"g"),function(t){return Array.isArray(t)?t.join(", "):"".concat(t)}(t))})),n&&void 0!==e.value&&null!==e.value&&"string"==typeof e.value&&(n=n.replace(/\$value/g,e.value)),n&&(n=n.replace(/\$property/g,e.property)),n&&(n=n.replace(/\$target/g,e.targetName)),n},t}();function Ne(t){return null!==t&&"object"==typeof t&&"function"==typeof t.then}var Re,Oe=function(){function t(t,e){this.validator=t,this.validatorOptions=e,this.awaitingPromises=[],this.ignoreAsyncValidations=!1,this.metadataStorage=_e()}return t.prototype.execute=function(t,e,n){var r,i=this;this.metadataStorage.hasValidationMetaData||!0!==(null===(r=this.validatorOptions)||void 0===r?void 0:r.enableDebugMessages)||console.warn("No metadata found. There is more than once class-validator version installed probably. You need to flatten your dependencies.");var s=this.validatorOptions?this.validatorOptions.groups:void 0,o=this.validatorOptions&&this.validatorOptions.strictGroups||!1,a=this.validatorOptions&&this.validatorOptions.always||!1,c=this.metadataStorage.getTargetValidationMetadatas(t.constructor,e,a,o,s),u=this.metadataStorage.groupByPropertyName(c);if(this.validatorOptions&&this.validatorOptions.forbidUnknownValues&&!c.length){var l=new Te;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(l.target=t),l.value=void 0,l.property=void 0,l.children=[],l.constraints={unknownValue:"an unknown value was passed to the validate function"},void n.push(l)}this.validatorOptions&&this.validatorOptions.whitelist&&this.whitelist(t,u,n),Object.keys(u).forEach((function(e){var r=t[e],s=u[e].filter((function(t){return t.type===be.IS_DEFINED})),o=u[e].filter((function(t){return t.type!==be.IS_DEFINED&&t.type!==be.WHITELIST}));r instanceof Promise&&o.find((function(t){return t.type===be.PROMISE_VALIDATION}))?i.awaitingPromises.push(r.then((function(r){i.performValidations(t,r,e,s,o,n)}))):i.performValidations(t,r,e,s,o,n)}))},t.prototype.whitelist=function(t,e,n){var r=this,i=[];Object.keys(t).forEach((function(t){e[t]&&0!==e[t].length||i.push(t)})),i.length>0&&(this.validatorOptions&&this.validatorOptions.forbidNonWhitelisted?i.forEach((function(e){var i,s=r.generateValidationError(t,t[e],e);s.constraints=((i={})[be.WHITELIST]="property ".concat(e," should not exist"),i),s.children=void 0,n.push(s)})):i.forEach((function(e){return delete t[e]})))},t.prototype.stripEmptyErrors=function(t){var e=this;return t.filter((function(t){if(t.children&&(t.children=e.stripEmptyErrors(t.children)),0===Object.keys(t.constraints).length){if(0===t.children.length)return!1;delete t.constraints}return!0}))},t.prototype.performValidations=function(t,e,n,r,i,s){var o=i.filter((function(t){return t.type===be.CUSTOM_VALIDATION})),a=i.filter((function(t){return t.type===be.NESTED_VALIDATION})),c=i.filter((function(t){return t.type===be.CONDITIONAL_VALIDATION})),u=this.generateValidationError(t,e,n);s.push(u),this.conditionalValidations(t,e,c)&&(this.customValidations(t,e,r,u),this.mapContexts(t,e,r,u),void 0===e&&this.validatorOptions&&!0===this.validatorOptions.skipUndefinedProperties||null===e&&this.validatorOptions&&!0===this.validatorOptions.skipNullProperties||null==e&&this.validatorOptions&&!0===this.validatorOptions.skipMissingProperties||(this.customValidations(t,e,o,u),this.nestedValidations(e,a,u.children),this.mapContexts(t,e,i,u),this.mapContexts(t,e,o,u)))},t.prototype.generateValidationError=function(t,e,n){var r=new Te;return this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.target&&!0!==this.validatorOptions.validationError.target||(r.target=t),this.validatorOptions&&this.validatorOptions.validationError&&void 0!==this.validatorOptions.validationError.value&&!0!==this.validatorOptions.validationError.value||(r.value=e),r.property=n,r.children=[],r.constraints={},r},t.prototype.conditionalValidations=function(t,e,n){return n.map((function(n){return n.constraints[0](t,e)})).reduce((function(t,e){return t&&e}),!0)},t.prototype.customValidations=function(t,e,n,r){var i=this;n.forEach((function(n){i.metadataStorage.getTargetValidatorConstraints(n.constraintCls).forEach((function(s){if(!(s.async&&i.ignoreAsyncValidations||i.validatorOptions&&i.validatorOptions.stopAtFirstError&&Object.keys(r.constraints||{}).length>0)){var o={targetName:t.constructor?t.constructor.name:void 0,property:n.propertyName,object:t,value:e,constraints:n.constraints};if(n.each&&(Array.isArray(e)||e instanceof Set||e instanceof Map)){var a=function(t){return t instanceof Map?Array.from(t.values()):Array.isArray(t)?t:Array.from(t)}(e).map((function(t){return s.instance.validate(t,o)}));if(a.some((function(t){return Ne(t)}))){var c=a.map((function(t){return Ne(t)?t:Promise.resolve(t)})),u=Promise.all(c).then((function(o){var a=o.every((function(t){return t}));if(!a){var c=i.createValidationError(t,e,n,s),u=c[0],l=c[1];r.constraints[u]=l,n.context&&(r.contexts||(r.contexts={}),r.contexts[u]=Object.assign(r.contexts[u]||{},n.context))}}));i.awaitingPromises.push(u)}else{var l=a.every((function(t){return t}));if(!l){var h=i.createValidationError(t,e,n,s);g=h[0],y=h[1];r.constraints[g]=y}}}else{var d=s.instance.validate(e,o);if(Ne(d)){var p=d.then((function(o){if(!o){var a=i.createValidationError(t,e,n,s),c=a[0],u=a[1];r.constraints[c]=u,n.context&&(r.contexts||(r.contexts={}),r.contexts[c]=Object.assign(r.contexts[c]||{},n.context))}}));i.awaitingPromises.push(p)}else if(!d){var f=i.createValidationError(t,e,n,s),g=f[0],y=f[1];r.constraints[g]=y}}}}))}))},t.prototype.nestedValidations=function(t,e,n){var r=this;void 0!==t&&e.forEach((function(i){var s;if(i.type===be.NESTED_VALIDATION||i.type===be.PROMISE_VALIDATION)if(Array.isArray(t)||t instanceof Set||t instanceof Map)(t instanceof Set?Array.from(t):t).forEach((function(i,s){r.performValidations(t,i,s.toString(),[],e,n)}));else if(t instanceof Object){var o="string"==typeof i.target?i.target:i.target.name;r.execute(t,o,n)}else{var a=new Te;a.value=t,a.property=i.propertyName,a.target=i.target;var c=r.createValidationError(i.target,t,i),u=c[0],l=c[1];a.constraints=((s={})[u]=l,s),n.push(a)}}))},t.prototype.mapContexts=function(t,e,n,r){var i=this;return n.forEach((function(t){if(t.context){var e=void 0;if(t.type===be.CUSTOM_VALIDATION)e=i.metadataStorage.getTargetValidatorConstraints(t.constraintCls)[0];var n=i.getConstraintType(t,e);r.constraints[n]&&(r.contexts||(r.contexts={}),r.contexts[n]=Object.assign(r.contexts[n]||{},t.context))}}))},t.prototype.createValidationError=function(t,e,n,r){var i=t.constructor?t.constructor.name:void 0,s=this.getConstraintType(n,r),o={targetName:i,property:n.propertyName,object:t,value:e,constraints:n.constraints},a=n.message||"";return n.message||this.validatorOptions&&(!this.validatorOptions||this.validatorOptions.dismissDefaultMessages)||r&&r.instance.defaultMessage instanceof Function&&(a=r.instance.defaultMessage(o)),[s,Ie.replaceMessageSpecialTokens(a,o)]},t.prototype.getConstraintType=function(t,e){return e&&e.name?e.name:t.type},t}(),Ae=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))},xe=function(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}},Pe=function(){function t(){}return t.prototype.validate=function(t,e,n){return this.coreValidate(t,e,n)},t.prototype.validateOrReject=function(t,e,n){return Ae(this,void 0,void 0,(function(){var r;return xe(this,(function(i){switch(i.label){case 0:return[4,this.coreValidate(t,e,n)];case 1:return(r=i.sent()).length?[2,Promise.reject(r)]:[2]}}))}))},t.prototype.validateSync=function(t,e,n){var r="string"==typeof t?e:t,i="string"==typeof t?t:void 0,s=new Oe(this,"string"==typeof t?n:e);s.ignoreAsyncValidations=!0;var o=[];return s.execute(r,i,o),s.stripEmptyErrors(o)},t.prototype.coreValidate=function(t,e,n){var r="string"==typeof t?e:t,i="string"==typeof t?t:void 0,s=new Oe(this,"string"==typeof t?n:e),o=[];return s.execute(r,i,o),Promise.all(s.awaitingPromises).then((function(){return s.stripEmptyErrors(o)}))},t}();function ke(t,e,n){return"string"==typeof t?ge(Pe).validateSync(t,e,n):ge(Pe).validateSync(t,e)}function Le(t,e,n){const r=t=>ot.isFinite(t)||Math.abs(t)===1/0;if(!r(t))throw new TypeError(`@InRange: Invalid minimum value: ${t}`);if(!r(e))throw new TypeError(`@InRange: Invalid maximum value: ${e}`);return t>e&&([t,e]=[e,t]),(r,i)=>{Ce({name:"InRange",options:n,propertyName:i,target:r.constructor,validator:{validate:n=>ot.isFinite(n)&&n>=t&&n<=e}})}}function De(t){return Le(0,Number.MAX_SAFE_INTEGER,t)}function Me(t){return(e,n)=>{Ce({name:"IsFunction",options:t,propertyName:n,target:e.constructor,validator:{validate:ot.isFunction}})}}function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ignoreCase:!1},n=arguments.length>2?arguments[2]:void 0;const r=Object.keys(t).filter((t=>isNaN(Number(t)))),i=(null==e?void 0:e.ignoreCase)?t=>ot.isString(t)&&r.some((e=>e.toUpperCase()===t.toUpperCase())):t=>r.includes(t);return(t,e)=>{Ce({name:"IsEnumKey",options:n,propertyName:e,target:t.constructor,validator:{validate:i}})}}function Fe(t,e){return function(n){var r=e&&e.each?"each value in ":"";return t(r,n)}}function je(t,e){return function(n,r){Ce({name:t.name,target:n.constructor,propertyName:r,options:e,constraints:t.constraints,validator:t.validator})}}!function(t){t.validate=ke}(Re||(Re={}));var Ue=be.IS_DEFINED;function $e(t){return je({name:Ue,validator:{validate:function(t){return function(t){return null!=t}(t)},defaultMessage:Fe((function(t){return t+"$property should not be null or undefined"}),t)}},t)}function qe(t){return je({name:"isString",validator:{validate:function(t,e){return function(t){return t instanceof String||"string"==typeof t}(t)},defaultMessage:Fe((function(t){return t+"$property must be a string"}),t)}},t)}var He=__webpack_require__(538),We=__webpack_require__.n(He);function Ve(t,e){return je({name:"isUrl",constraints:[t],validator:{validate:function(t,e){return function(t,e){return"string"==typeof t&&We()(t,e)}(t,e.constraints[0])},defaultMessage:Fe((function(t){return t+"$property must be an URL address"}),e)}},e)}function Ge(t){return je({name:"isArray",validator:{validate:function(t,e){return function(t){return Array.isArray(t)}(t)},defaultMessage:Fe((function(t){return t+"$property must be an array"}),t)}},t)}function ze(t){return je({name:"isBoolean",validator:{validate:function(t,e){return function(t){return t instanceof Boolean||"boolean"==typeof t}(t)},defaultMessage:Fe((function(t){return t+"$property must be a boolean value"}),t)}},t)}var Ke=function(){return Ke=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},Ke.apply(this,arguments)};function Ye(t){var e=Ke({},t),n=e.each?"each value in ":"";return e.message=e.message||n+"nested property $property must be either object or array",function(t,n){var r={type:be.NESTED_VALIDATION,target:t.constructor,propertyName:n,validationOptions:e};_e().addValidationMetadata(new me(r))}}function Xe(t,e){return je({name:"isEnum",constraints:[t],validator:{validate:function(t,e){return function(t,e){return Object.keys(e).map((function(t){return e[t]})).indexOf(t)>=0}(t,e.constraints[0])},defaultMessage:Fe((function(t){return t+"$property must be a valid enum value"}),e)}},e)}var Ze,Je,Qe=function(t,e,n,r){var i,s=arguments.length,o=s<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,r);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(o=(s<3?i(o):s>3?i(e,n,o):i(e,n))||o);return s>3&&o&&Object.defineProperty(e,n,o),o};class tn{}Qe([$e(),qe()],tn.prototype,"hashedKey",void 0),Qe([$e(),Ve({protocols:["http","https"],require_tld:!1,require_protocol:!0})],tn.prototype,"metricSinkUrl",void 0),Qe([$e(),Ve({protocols:["ws","wss"],require_tld:!1,require_protocol:!0})],tn.prototype,"signalServerUrl",void 0),Qe([$e(),Ge()],tn.prototype,"stunServerUrl",void 0);class en{constructor(){this.level=It[It.OFF]}}Qe([Be(It,{ignoreCase:!0})],en.prototype,"level",void 0);class nn extends en{}class rn{constructor(){this.username=void 0,this.password=void 0}}Qe([qe()],rn.prototype,"username",void 0),Qe([qe()],rn.prototype,"password",void 0);class sn{constructor(){this.enabled=!1,this.type=Nt.OFF,this.basic=new rn}}Qe([ze()],sn.prototype,"enabled",void 0),Qe([Be(Nt,{ignoreCase:!0})],sn.prototype,"type",void 0),Qe([Ye()],sn.prototype,"basic",void 0);class on extends en{constructor(){super(...arguments),this.batchSize=50,this.enabled=!1,this.maxQueueSize=1e3,this.maxRetries=3,this.postTimeout=1e3,this.retryTimeout=5e3,this.url=void 0,this.auth=new sn}}Qe([Le(1,Number.MAX_SAFE_INTEGER)],on.prototype,"batchSize",void 0),Qe([ze()],on.prototype,"enabled",void 0),Qe([Le(1,Number.MAX_SAFE_INTEGER)],on.prototype,"maxQueueSize",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],on.prototype,"maxRetries",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],on.prototype,"postTimeout",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],on.prototype,"retryTimeout",void 0),Qe([qe()],on.prototype,"url",void 0),Qe([Ye()],on.prototype,"auth",void 0);class an{constructor(){this.console=new nn,this.http=new on,this.remote=new on}}Qe([Ye()],an.prototype,"console",void 0),Qe([Ye()],an.prototype,"http",void 0),Qe([Ye()],an.prototype,"remote",void 0);class cn{constructor(){this.minPercentReady=.75,this.sctpInterAsnCount=1,this.sctpIntraAsnCount=1,this.sctpLanCount=1,this.singleConnectionTimeout=700}}Qe([Le(0,1)],cn.prototype,"minPercentReady",void 0),Qe([Le(1,Number.MAX_SAFE_INTEGER)],cn.prototype,"sctpInterAsnCount",void 0),Qe([Le(1,Number.MAX_SAFE_INTEGER)],cn.prototype,"sctpIntraAsnCount",void 0),Qe([Le(1,Number.MAX_SAFE_INTEGER)],cn.prototype,"sctpLanCount",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],cn.prototype,"singleConnectionTimeout",void 0);class un{constructor(){this.sequentialDetectionThreshold=6,this.sequentialInjectionAmount=10}}Qe([Le(0,Number.MAX_SAFE_INTEGER)],un.prototype,"sequentialDetectionThreshold",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],un.prototype,"sequentialInjectionAmount",void 0);class ln{constructor(){this.exponentialBase=1.5,this.maxBackoffTimeout=2,this.timeoutJitterRatio=.5}}Qe([Le(0,Number.MAX_SAFE_INTEGER)],ln.prototype,"exponentialBase",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],ln.prototype,"maxBackoffTimeout",void 0),Qe([Le(0,1)],ln.prototype,"timeoutJitterRatio",void 0);class hn{constructor(){this.initialFlip=.2,this.flip=.1,this.representation=.3,this.decrease=.4,this.increase=.5,this.sensing=.6,this.keep=.7}}Qe([Le(0,1)],hn.prototype,"initialFlip",void 0),Qe([Le(0,1)],hn.prototype,"flip",void 0),Qe([Le(0,1)],hn.prototype,"representation",void 0),Qe([Le(0,1)],hn.prototype,"decrease",void 0),Qe([Le(0,1)],hn.prototype,"increase",void 0),Qe([Le(0,1)],hn.prototype,"sensing",void 0),Qe([Le(0,1)],hn.prototype,"keep",void 0);class dn{constructor(){this.enableTeca=!0,this.enableSensing=!0,this.bfrHistoryUniqueDesiredValues=3,this.usePrecedenceModifiers=!0,this.capacityEstimationInterval=1e3,this.maxTimeWithoutSensing=6e3,this.initialFlipRatio=.5,this.bfrTimesToIncrease=3.6,this.bfrTimesToDecrease=3.6,this.maxAttemptsToExitZeroCapacity=5,this.sensingTimeout=6e3,this.sensingIncreaseFactor=4,this.minimalRequiredSensedCapacities=3,this.minimalRequiredIncreaseSensedCapacities=2,this.capacityModifiers=new hn,this.checkOutboundBfrBeforeSensing=!1}}Qe([ze()],dn.prototype,"enableTeca",void 0),Qe([ze()],dn.prototype,"enableSensing",void 0),Qe([De()],dn.prototype,"bfrHistoryUniqueDesiredValues",void 0),Qe([ze()],dn.prototype,"usePrecedenceModifiers",void 0),Qe([De()],dn.prototype,"capacityEstimationInterval",void 0),Qe([De()],dn.prototype,"maxTimeWithoutSensing",void 0),Qe([De()],dn.prototype,"periodicSensingInterval",void 0),Qe([De()],dn.prototype,"initialFlipRatio",void 0),Qe([De()],dn.prototype,"bfrTimesToIncrease",void 0),Qe([De()],dn.prototype,"bfrTimesToDecrease",void 0),Qe([De()],dn.prototype,"maxAttemptsToExitZeroCapacity",void 0),Qe([De()],dn.prototype,"sensingTimeout",void 0),Qe([De()],dn.prototype,"sensingIncreaseFactor",void 0),Qe([De()],dn.prototype,"minimalRequiredSensedCapacities",void 0),Qe([De()],dn.prototype,"minimalRequiredIncreaseSensedCapacities",void 0),Qe([Ye()],dn.prototype,"capacityModifiers",void 0),Qe([ze()],dn.prototype,"checkOutboundBfrBeforeSensing",void 0);class pn{}Qe([Ve({protocols:["http","https"],require_tld:!1,require_protocol:!0})],pn.prototype,"url",void 0),Qe([qe(),je({name:"isNotEmpty",validator:{validate:function(t,e){return function(t){return""!==t&&null!=t}(t)},defaultMessage:Fe((function(t){return t+"$property should not be empty"}),Ze)}},Ze)],pn.prototype,"authToken",void 0);class fn{constructor(){this.maxRetries=1,this.banTimeout=3e5}}Qe([De()],fn.prototype,"maxRetries",void 0),Qe([De()],fn.prototype,"banTimeout",void 0);class gn{constructor(){this.enableMss=!0,this.targetHosts=["c.s73cdn.net"],this.apiRefreshInterval=6e4,this.banConfig=new fn,this.ns1Config=new pn}}Qe([ze()],gn.prototype,"enableMss",void 0),Qe([Ge()],gn.prototype,"targetHosts",void 0),Qe([De()],gn.prototype,"apiRefreshInterval",void 0),Qe([Ye()],gn.prototype,"banConfig",void 0),Qe([Ye()],gn.prototype,"ns1Config",void 0);class yn{constructor(){this.enableCs=!0,this.isRevoked=!1}}Qe([ze()],yn.prototype,"enableCs",void 0),Qe([ze()],yn.prototype,"isRevoked",void 0);class mn{constructor(){this.regex=/^http[s]?:\/\/(.*\/[\w\W]+\.m3u[8]?|.*\/[\w\W]+\.mpd)[?]?/}}Qe([(t,e)=>{Ce({name:"IsRegExp",options:Je,propertyName:e,target:t.constructor,validator:{validate:t=>t instanceof RegExp}})}],mn.prototype,"regex",void 0);class bn{constructor(){this.enableSinglePc=!1,this.rtcConnectionHighWaterMark=0,this.peerBufferedAmountLowThreshold=16384,this.peerHighWaterMark=1048576,this.peerInactivityTimeout=12e4}}Qe([ze()],bn.prototype,"enableSinglePc",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],bn.prototype,"rtcConnectionHighWaterMark",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],bn.prototype,"peerBufferedAmountLowThreshold",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],bn.prototype,"peerHighWaterMark",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],bn.prototype,"peerInactivityTimeout",void 0);class vn{constructor(){this.blacklistedFragmentUrlRegex=void 0,this.fragmentUrlSnRegex=void 0,this.fragmentUrlSubcontentRegex=void 0}}Qe([qe()],vn.prototype,"blacklistedFragmentUrlRegex",void 0),Qe([qe()],vn.prototype,"fragmentUrlSnRegex",void 0),Qe([qe()],vn.prototype,"fragmentUrlSubcontentRegex",void 0);class wn{constructor(){this.enabled=!0,this.forceMerge=!1,this.nloaded=2e5,this.tdelta=200}}Qe([ze()],wn.prototype,"enabled",void 0),Qe([ze()],wn.prototype,"forceMerge",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],wn.prototype,"nloaded",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],wn.prototype,"tdelta",void 0);const Sn=()=>{};class En extends Tt{constructor(){super(...arguments),this.apiKey=new tn,this.bufferHealthDelta=1e3,this.bufferHealthThreshold=8e3,this.bufferHealthPeriod=1e3,this.bufferHealthThresholdRatio=.25,this.channelId="default channel",this.debug=It.OFF,this.defaultContentDuration=void 0,this.enableEstimatedBitrate=!1,this.enablePullOnce=!1,this.logger=new an,this.loopCheckerTtl=100,this.liveCacheDuration=ue,this.maxCacheDuration=ue,this.maxConcurrentPeerNegotiation=100,this.maxOutbound=40,this.metricsPeriod=1e3,this.multiPeer=new cn,this.natTraversal=new un,this.nextSegmentDurationFactor=1,this.onMetrics=Sn,this.transformRequest=Sn,this.playerContentThrottlingMode=he.OFF,this.pushProtocol=!0,this.initialBurstPush=!1,this.reconnectRetryRange=new ln,this.sdkFeatureFlags="",this.sharingContent=le.ONLY_ON_LAN,this.teca=new dn,this.timeoutP2PConnection=999999e3,this.trackerResponseTimeoutPeriod=2e4,this.withCredentials=!1,this.mss=new gn,this.analytics=new mn,this.cs=new yn,this.contentSteeringEndpoint="",this.enableInboundChecks=!1,this.enableTimeoutP2PConnection=!1,this.rtcConnection=new bn,this.slowParentDurationFactor=.8,this.bfrZero=!0,this.bfrCompletion=!0,this.bfrOutlierFilter=new wn,this.hlsParser=new vn,this.customDimension1="",this.customDimension2="",this.customDimension3="",this.p2pAllowDvr=!0,this.p2pAllowVod=!0,this.safeCacheRangePtsTolerance=1.5,this.overrideCustomDimensionWithVodDvrStats=!1,this.kickMismatchedVodDvrChildren=!1}}function _n(t){return ot.isObject(t)&&!Array.isArray(t)&&!ot.isFunction(t)&&!ot.isRegExp(t)}function Cn(t){const e=(n,r,i)=>{_n(r)&&(r=ot.transform(r,e,{})),Array.isArray(r)&&(r=ot.transform(r,e,[])),n[i=t(i).replace(/p_2_p/g,"p2p").replace(/p2P/g,"p2p").replace(/v_/g,"v")]=r};return t=>ot.transform(t,e)}Qe([$e(),Ye()],En.prototype,"apiKey",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"bufferHealthDelta",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"bufferHealthThreshold",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"bufferHealthPeriod",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"bufferHealthThresholdRatio",void 0),Qe([qe()],En.prototype,"channelId",void 0),Qe([function(t){return function(e,n){var r={type:be.WHITELIST,target:e.constructor,propertyName:n,validationOptions:t};_e().addValidationMetadata(new me(r))}}()],En.prototype,"debug",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"defaultContentDuration",void 0),Qe([ze()],En.prototype,"enableEstimatedBitrate",void 0),Qe([ze()],En.prototype,"enablePullOnce",void 0),Qe([Ye()],En.prototype,"logger",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"loopCheckerTtl",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"liveCacheDuration",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"maxCacheDuration",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"maxConcurrentPeerNegotiation",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"maxOutbound",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"metricsPeriod",void 0),Qe([Ye()],En.prototype,"multiPeer",void 0),Qe([Ye()],En.prototype,"natTraversal",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"nextSegmentDurationFactor",void 0),Qe([Me()],En.prototype,"onMetrics",void 0),Qe([Me()],En.prototype,"transformRequest",void 0),Qe([Xe(he)],En.prototype,"playerContentThrottlingMode",void 0),Qe([ze()],En.prototype,"pushProtocol",void 0),Qe([ze()],En.prototype,"initialBurstPush",void 0),Qe([Ye()],En.prototype,"reconnectRetryRange",void 0),Qe([qe()],En.prototype,"sdkFeatureFlags",void 0),Qe([Xe(le)],En.prototype,"sharingContent",void 0),Qe([Ye()],En.prototype,"teca",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"timeoutP2PConnection",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"trackerResponseTimeoutPeriod",void 0),Qe([ze()],En.prototype,"withCredentials",void 0),Qe([Ye()],En.prototype,"mss",void 0),Qe([Ye()],En.prototype,"analytics",void 0),Qe([Ye()],En.prototype,"cs",void 0),Qe([qe()],En.prototype,"contentSteeringEndpoint",void 0),Qe([ze()],En.prototype,"enableInboundChecks",void 0),Qe([ze()],En.prototype,"enableTimeoutP2PConnection",void 0),Qe([Ye()],En.prototype,"rtcConnection",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"slowParentDurationFactor",void 0),Qe([ze()],En.prototype,"bfrZero",void 0),Qe([ze()],En.prototype,"bfrCompletion",void 0),Qe([Ye()],En.prototype,"bfrOutlierFilter",void 0),Qe([Ye()],En.prototype,"hlsParser",void 0),Qe([qe()],En.prototype,"customDimension1",void 0),Qe([qe()],En.prototype,"customDimension2",void 0),Qe([qe()],En.prototype,"customDimension3",void 0),Qe([ze()],En.prototype,"p2pAllowDvr",void 0),Qe([ze()],En.prototype,"p2pAllowVod",void 0),Qe([Le(0,Number.MAX_SAFE_INTEGER)],En.prototype,"safeCacheRangePtsTolerance",void 0),Qe([ze()],En.prototype,"overrideCustomDimensionWithVodDvrStats",void 0),Qe([ze()],En.prototype,"kickMismatchedVodDvrChildren",void 0);const Tn=Cn(ot.camelCase),In=Cn(ot.snakeCase),Nn=["apiKey","mss"];class Rn extends En{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.loggerSettings=Ot(this.context).getInstance(),this.loggerSettings.setup(this.logger,this.debug),this.log=xt(this.context).getInstance().getLogger(Rn.polyNetFactoryName)}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.eventBus=null}setup(t){const e=this.buildValidSettings(t);if(ot.isEmpty(e))return;const n=this.differenceObjects(this,e);ot.merge(this,n),this.loggerSettings.setup(this.logger,this.debug),this.eventBus.emit($t.SETTINGS_CHANGED,{diffSettings:n,receivedSettings:e,target:this})}get isValidApiKey(){return ot.isEmpty(Re.validate(this.apiKey,{forbidNonWhitelisted:!0,skipUndefinedProperties:!0,whitelist:!0}))}buildValidSettings(t){let e=ot.cloneDeep(t);e=Rn.parseRequired(e),e=Rn.normalizeSettings(e);const n=Rn.validateSettings(e);return this.removeInvalidSettings(e,n),this.filterOutEmptySettings(e)}static validateSettings(t){return Re.validate(ot.merge(new En,t),{forbidNonWhitelisted:!0,skipUndefinedProperties:!0,whitelist:!0})}removeInvalidSettings(t,e){const n=(e,r)=>{r.forEach((r=>{const{children:i,constraints:s,property:o,value:a}=r,c=(null==s?void 0:s.nestedValidation)?e:[...e,o];(null==i?void 0:i.length)?n(c,i):((null==s?void 0:s.whitelistValidation)?this.log.trace(`Unknown setting ${c.join(".")}`):this.log.trace(`Setting ${c.join(".")} has invalid value ${JSON.stringify(a)}`),ot.unset(t,c))}))};n([],e)}filterOutEmptySettings(t){return ot.transform(t,(function t(e,n,r){_n(n)?(n=ot.transform(n,t,{}),ot.isEmpty(n)||(e[r]=n)):void 0!==n&&(e[r]=n)}),{})}differenceObjects(t,e){return ot.transform(e,((e,n,r)=>{if(_n(n)){const i=this.differenceObjects(t[r],n);ot.isEmpty(i)||(e[r]=i)}else ot.isEqual(n,t[r])||(e[r]=n)}),{})}static parseRequired(t){return Nn.forEach((e=>{ot.isNil(t[e])||((t,e)=>{if(!ce(e[t]))return e;const n=ae(e[t]);try{e[t]=JSON.parse(n)}catch(t){return e}})(e,t)})),t}static normalizeSettings(t){return Tn(t)}}Rn.polyNetFactoryName="Settings",function(t){t.DEFAULT_MAX_CACHE_DURATION=ue,t.SharingContent=le}(Rn||(Rn={}));const On=Et.getSingletonFactory(Rn),An={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let xn;const Pn=new Uint8Array(16);function kn(){if(!xn&&(xn="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!xn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return xn(Pn)}const Ln=[];for(let t=0;t<256;++t)Ln.push((t+256).toString(16).slice(1));function Dn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(Ln[t[e+0]]+Ln[t[e+1]]+Ln[t[e+2]]+Ln[t[e+3]]+"-"+Ln[t[e+4]]+Ln[t[e+5]]+"-"+Ln[t[e+6]]+Ln[t[e+7]]+"-"+Ln[t[e+8]]+Ln[t[e+9]]+"-"+Ln[t[e+10]]+Ln[t[e+11]]+Ln[t[e+12]]+Ln[t[e+13]]+Ln[t[e+14]]+Ln[t[e+15]]).toLowerCase()}const Mn=function(t,e,n){if(An.randomUUID&&!e&&!t)return An.randomUUID();const r=(t=t||{}).random||(t.rng||kn)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(let t=0;t<16;++t)e[n+t]=r[t];return e}return Dn(r)};class Bn{static getShortId(t){return t.substring(t.length-5)}static generateUUID(){return Mn()}static setCookie(t,e,n){const r=new Date;r.setTime(r.getTime()+24*n*60*60*1e3);const i=r.toUTCString();document.cookie=`${t}=${e};expires=${i};path=/;sameSite=lax;`}static getCookie(t){const e=t+"=",n=document.cookie.split(";");for(let t of n){for(;" "===t.charAt(0);)t=t.substring(1);if(0===t.indexOf(e))return t.substring(e.length,t.length)}return""}static isAllowedToShare(t,e){switch(t){case Rn.SharingContent.NEVER:return!1;case Rn.SharingContent.ALWAYS:return!0;case Rn.SharingContent.ONLY_ON_LAN:return"cellular"!==e}return!0}}const Fn="device_id";class jn extends Tt{constructor(){super(),this._state=jn.States.DISCONNECTED,this._mode=jn.Modes.REPAIRING,this._enabled=!0,this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("PolyNet"),this.data={deviceId:jn.generateDeviceID(),maskedStreamUri:null,nodeId:null,representationId:null,sessionId:jn.generateSessionID(),streamId:null,streamUri:null}}destroy(){this.eventBus=null,this.logger=null,this.data=null}clearRepresentation(){const t={representationId:void 0,nodeId:void 0,streamUri:void 0,maskedStreamUri:void 0,streamId:void 0};this.update(t)}get deviceId(){return this.data.deviceId}get sessionId(){return this.data.sessionId}get nodeId(){return this.data.nodeId}get nodeIdShort(){return this.nodeId?Bn.getShortId(this.nodeId):null}get mode(){return this._mode}get state(){return this._state}get representationId(){return this.data.representationId}get streamId(){return this.data.streamId}get streamUri(){return this.data.streamUri}get maskedStreamUri(){return this.data.maskedStreamUri}updateAbility(t){this._enabled=t}updateMode(t){const e=this.mode;this._mode=t,this.logger.trace(`${jn.Modes[e]} -> ${jn.Modes[this.mode]}`),this.eventBus.emit($t.POLYNET_MODE_CHANGED,{target:this,oldMode:e,newMode:t})}updateState(t){if(t===this.state)return;const e=this.state;this._state=t,this.logger.trace(`State changed: ${jn.States[e]} -> ${jn.States[this.state]}`),this.eventBus.emit($t.POLYNET_STATE_CHANGED,{target:this,oldState:e,newState:t})}update(t){const e=this.data,n=ot.assign({},this.data,t);this.data=n,this.eventBus.emit($t.POLYNET_DATA_CHANGED,{target:this,newData:n,oldData:e})}static generateSessionID(){return Bn.generateUUID()}static generateDeviceID(){let t=Bn.getCookie(Fn);return t||(t=Bn.generateUUID()),Bn.setCookie(Fn,t,3650),t}isInState(t){return t===this._state}isInMode(t){return this._mode===t}get isEnabled(){return this._enabled}get isConnected(){return this.isInState(jn.States.CONNECTED)||this.isJoined}get isJoined(){return this.isInState(jn.States.JOINED)}get isInRepair(){return this.isInMode(jn.Modes.REPAIRING)}get isDisconnected(){return this.isInState(jn.States.DISCONNECTED)}get isInNoRecovery(){return this.isInState(jn.States.NO_RECOVERY)}}jn.polyNetFactoryName="PolyNet",function(t){let e,n;!function(t){t[t.NO_RECOVERY=0]="NO_RECOVERY",t[t.DISCONNECTED=1]="DISCONNECTED",t[t.CONNECTED=2]="CONNECTED",t[t.JOINED=3]="JOINED"}(e=t.States||(t.States={})),function(t){t[t.DEFAULT=0]="DEFAULT",t[t.REPAIRING=1]="REPAIRING"}(n=t.Modes||(t.Modes={}))}(jn||(jn={}));const Un=Et.getSingletonFactory(jn);var $n=__webpack_require__(2590),qn=__webpack_require__.n($n),Hn=__webpack_require__(2115),Wn=__webpack_require__.n(Hn);const Vn='video/mp4; codecs="avc1.42E01E,mp4a.40.2"';class Gn extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("PlatformStats"),this.eventBus=Ct(this.context).getInstance(),this.stats={connectionType:void 0,isAnyMediaSourceApiSupported:void 0,isWebRTCSupported:void 0,location:void 0,os:{name:void 0,version:void 0},browser:{name:void 0,version:void 0},player:{name:void 0,version:void 0}},this.handleConnectionChangeEvent=this.handleConnectionChangeEvent.bind(this)}destroy(){this.stopDetectionConnectionChanges(),this.logger=null,this.eventBus=null}start(){this.eventBus.on($t.COLLECT_PLATFORM_STATS,this.handleCollectStatsEvent,{scope:this}),this.startDetectionConnectionChanges();const{os:t,browser:e}=Gn.getOSAndBrowser();this.stats.os=t,this.stats.browser=e,this.stats.connectionType=Gn.getConnectionType(),this.stats.isAnyMediaSourceApiSupported=Gn.isAnyMediaSourceApiSupported(),this.stats.isWebRTCSupported=Gn.isWebRTCSupported()&&Gn.isWebRTCDataChannelSupported(),this.stats.location=Gn.getLocationHref()}get location(){return this.stats.location}get connectionType(){return this.stats.connectionType}get isAnyMediaSourceApiSupported(){return this.stats.isAnyMediaSourceApiSupported}get isWebRTCSupported(){return this.stats.isWebRTCSupported}get os(){return this.stats.os}get browser(){return this.stats.browser}get player(){return this.stats.player}static getOSAndBrowser(){function t(t){if(!ot.isNil(t)&&!ot.isEmpty(t))return t.replace(/\s+/g,"_").replace(/,/g,".").toLowerCase()}const e=new(Wn())(qn().navigator.userAgent).getResult();return{os:{name:t(e.os.name),version:t(e.os.version)},browser:{name:t(e.browser.name),version:t(e.browser.version)}}}static isAnyMediaSourceApiSupported(){return Gn.isManagedMediaSourceExtensionSupported()||Gn.isMediaSourceExtensionSupported()}static isMediaSourceExtensionSupported(){var t,e;const n=qn().MediaSource||qn().WebKitMediaSource,r=qn().SourceBuffer||qn().WebKitSourceBuffer,i=n&&ot.isFunction(n.isTypeSupported)&&n.isTypeSupported(Vn),s=!r||ot.isFunction(null===(t=r.prototype)||void 0===t?void 0:t.appendBuffer)&&ot.isFunction(null===(e=r.prototype)||void 0===e?void 0:e.remove);return!!i&&!!s}static isManagedMediaSourceExtensionSupported(){const t=qn().ManagedMediaSource;return t&&ot.isFunction(t.isTypeSupported)&&t.isTypeSupported(Vn)}static isWebRTCSupported(){return!!qn().RTCPeerConnection}static isWebRTCDataChannelSupported(){var t;return ot.isFunction(null===(t=qn().RTCPeerConnection)||void 0===t?void 0:t.prototype.createDataChannel)}static getConnectionType(){const t=Gn.getConnection();return(null==t?void 0:t.type)||"unknown"}startDetectionConnectionChanges(){const t=Gn.getConnection();if(!t)return void this.logger.trace("Connection interface not available");const e=Gn.getConnectionTypeChangedEventName(t);t.addEventListener(e,this.handleConnectionChangeEvent),this.logger.trace(`Listening to on '${e}' events`)}stopDetectionConnectionChanges(){const t=Gn.getConnection();if(!t)return;const e=Gn.getConnectionTypeChangedEventName(t);t.removeEventListener(e,this.handleConnectionChangeEvent)}handleConnectionChangeEvent(t){const e=Gn.getConnectionType();e!=this.stats.connectionType&&(this.stats.connectionType=e,this.logger.trace(`Browser connection type changed from '${this.stats.connectionType}' to '${e}'`),this.eventBus.emit($t.BROWSER_STATS_CONNECTION_TYPE_CHANGED,{target:this,type:this.stats.connectionType}))}static getConnection(){return qn().navigator.connection||qn().navigator.mozConnection||qn().navigator.webkitConnection}static getConnectionTypeChangedEventName(t){return"onchange"in t?"change":"typechange"}static getLocationHref(){return qn().location.href}handleCollectStatsEvent(t){if(!t)return;const e=ot.omit(t,["event"]);ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){return"player"===n?ot.isNil(null==t?void 0:t.version)&&!ot.isNil(null==e?void 0:e.version)?e:t:e}}Gn.polyNetFactoryName="PlatformStats";const zn=Et.getSingletonFactory(Gn);var Kn=__webpack_require__(1549);const Yn=Number.MAX_SAFE_INTEGER;class Xn extends Kn.Duplex{constructor(t){const e=(null==t?void 0:t.highWaterMark)||Yn;super(Object.assign(Object.assign({objectMode:!0},t),{highWaterMark:e,readableHighWaterMark:e,writableHighWaterMark:e}))}get context(){return this._context}set context(t){this._context=t}start(){}stop(){}}var Zn=__webpack_require__(2934),Jn=__webpack_require__.n(Zn),Qn=__webpack_require__(8189);class tr{static toString(t){return(new TextDecoder).decode(t)}static nodeBufferToArrayBuffer(t){return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}static concat(){return tr.join(...arguments).buffer}static sliceEvery(t,e){const n=t.byteLength,r=[];for(let i=0;i<n;i+=e)r.push(t.slice(i,i+e));return r}static toArrayBuffer(t){if(t.length===t.buffer.byteLength)return t.buffer;const e=new ArrayBuffer(t.length);return new Uint8Array(e).set(t),e}static join(){let t=0;for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];for(const e of n)t+=e.byteLength;const i=new Uint8Array(t);let s=0;for(const t of n)i.set(new Uint8Array(t),s),s+=t.byteLength;return i}static copy(t){return t.slice(0)}}var er=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class nr extends Xn{constructor(t){super(Object.assign(Object.assign({},t),{objectMode:!0})),this._connected=!1}static get isSupported(){return!0}get connected(){return this._connected}configure(t){}startConnection(){this._connected=!0,this.emit("open")}getStats(){return er(this,void 0,void 0,(function*(){}))}_read(t){}_write(t,e,n){const r={timeRequest:performance.now(),timeFirst:0,timeResponse:0},i=this.createHttpStreamRequest(t,r);this.push({type:"content-response-start",id:t.id,url:t.url,representationId:t.representationId,request:i}),n()}_destroy(){}signal(t){}get transport(){return"http"}get count(){return 1}createHttpStreamRequest(t,e){const n=(0,Qn.parse)(t.url),r=Jn().request(Object.assign(Object.assign({},t),n),(n=>{if(!function(t){return t.statusCode>=200&&t.statusCode<=399}(n))return void this.handleOnError(t,e,n.statusCode);let r=0;const i=n.headers["content-length"],s=!!i&&isFinite(i)&&!!parseInt(i),o=s?parseInt(i):null;n.on("data",(i=>{const a=tr.nodeBufferToArrayBuffer(i);r+=a.byteLength,this.handleOnProgress(t,e,{headers:n.headers,chunk:a,lengthComputable:s,loaded:r,total:o})})),n.on("end",(()=>{this.handleOnComplete(t,e,{headers:n.headers,responseUrl:n.url})}))}));return t.data&&r.write(new Uint8Array(t.data)),r.end(),r.on("error",(n=>{this.handleOnError(t,e,n)})),{abort:()=>r.abort(),request:r}}handleOnProgress(t,e,n){0===e.timeFirst&&(e.timeFirst=Math.max(performance.now(),e.timeRequest)),this.push(Object.assign(Object.assign({},t),{chunk:n.chunk||void 0,url:t.url,lengthComputable:!!n.lengthComputable,loaded:n.loaded,total:n.total,headers:n.headers,type:"content-response-progress"}))}handleOnComplete(t,e,n){var r;e.timeResponse=Math.max(performance.now(),e.timeFirst),this.push(Object.assign(Object.assign({},t),{response:n.data||void 0,headers:n.headers,stats:e,type:"content-response-end",url:t.url,responseUrl:(null===(r=n.request)||void 0===r?void 0:r.responseURL)||n.responseUrl}))}handleOnError(t,e,n){this.emit("error",Object.assign(Object.assign({},t),{msg:n,url:t.url}))}}const rr=Et.getInstanceFactory(nr);var ir=__webpack_require__(25).Buffer,sr=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class or extends Kn.Duplex{constructor(t){const e=(null==t?void 0:t.highWaterMark)||1048576;super({allowHalfOpen:!1,highWaterMark:e,readableHighWaterMark:e,writableHighWaterMark:e}),this.lastHighWaterMarkReached=null,this.writeCount=0,this.writeAmount=0,this.bufferBeaconTimer=null,this.lastActivityTimestamp=null,this.settings=On(this.context).getInstance(),this.highWaterMark=e,this.pendingCandidates=[],this._connected=!1}static get isSupported(){return!!window.RTCPeerConnection&&!!window.RTCPeerConnection.prototype.createDataChannel}static get isTrickleIceSupported(){return!!RTCPeerConnection.prototype.addIceCandidate}get context(){return this._context}set context(t){this._context=t}start(){}stop(){}get connected(){return this._connected&&this.rtcDataChannel&&"open"===this.rtcDataChannel.readyState}get bufferedAmount(){return this.rtcDataChannel.bufferedAmount}configure(t){const{rtcConfiguration:e,ordered:n,trickle:r,iceCompleteTimeout:i}=t;this.ordered=n,this.trickle=r,this.iceCompleteTimeout=i,this.rtcConfiguration=e}startConnection(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return sr(this,void 0,void 0,(function*(){if(this.initiator=t,this.rtcPeerConnection=new window.RTCPeerConnection(this.rtcConfiguration),this.rtcPeerConnection.oniceconnectionstatechange=()=>this.onIceStateChange(),this.rtcPeerConnection.onicegatheringstatechange=()=>this.onIceStateChange(),this.rtcPeerConnection.ondatachannel=t=>this.onDataChannel(t),this.rtcPeerConnection.onicecandidate=t=>this.onIceCandidate(t),this.once("rtc_ice_complete",(()=>this.onIceComplete())),this.iceCompleteTimeout){const t=setTimeout((()=>{this.emit("rtc_ice_complete"),clearTimeout(t)}),this.iceCompleteTimeout)}this.initiator&&(this.createDataChannel(),yield this.emitOffer())}))}emitOffer(){return sr(this,void 0,void 0,(function*(){try{const t=yield this.rtcPeerConnection.createOffer({iceRestart:!0});yield this.rtcPeerConnection.setLocalDescription(t),this.trickle&&this.emit("signal",{type:"offer",sdp:t.sdp})}catch(t){this.destroy(t)}}))}signal(t){return sr(this,void 0,void 0,(function*(){if(!this.connected)try{yield this._signal(t)}catch(t){this.destroy(t)}}))}getStats(){return sr(this,void 0,void 0,(function*(){const t=yield this.rtcPeerConnection.getStats();for(const e of t.values())if("transport"===e.type)return e}))}_signal(t){return sr(this,void 0,void 0,(function*(){switch(t.type){case"offer":yield this.addRemote(t);const e=yield this.rtcPeerConnection.createAnswer();yield this.rtcPeerConnection.setLocalDescription(e),this.trickle&&this.emit("signal",{type:"answer",sdp:e.sdp});break;case"answer":yield this.addRemote(t);break;case"candidate":this.rtcPeerConnection.remoteDescription?yield this.addCandidate(t.candidate):this.pendingCandidates.push(t.candidate)}}))}addCandidate(t){return sr(this,void 0,void 0,(function*(){yield this.rtcPeerConnection.addIceCandidate(new window.RTCIceCandidate(t))}))}addRemote(t){return sr(this,void 0,void 0,(function*(){yield this.rtcPeerConnection.setRemoteDescription(new window.RTCSessionDescription(t));for(const t of this.pendingCandidates)yield this.addCandidate(new window.RTCIceCandidate(t));this.pendingCandidates=[]}))}_read(t){}_write(t,e,n){if(this.destroyed)return n(new Error("cannot write after peer is destroyed"));this.connected?(this.bufferBeaconTimer||(this.bufferBeaconTimer=setInterval((()=>{if(null!==this.lastActivityTimestamp){performance.now()-this.lastActivityTimestamp>this.settings.rtcConnection.peerInactivityTimeout&&this.destroy(new Error("Inactivity timed out"))}const t=this.rtcDataChannel.bufferedAmount;t>0&&this.emit("sctp_buffer_beacon",{buffered:t})}),2e3)),this.internalWrite(t,n)):(this.currentChunk=t,this.currentCb=n)}send(t){this.rtcDataChannel.send(t)}internalWrite(t,e){try{this.lastActivityTimestamp=performance.now(),this.rtcDataChannel.send(t),++this.writeCount,this.writeAmount+=t.length,this.writeCount%100==0&&this.emit("sctp_write_beacon",{count:this.writeCount,amount:this.writeAmount,bufferedAmount:this.rtcDataChannel.bufferedAmount})}catch(t){return this.emit("stcp_error",t),e(t)}if(!(this.rtcDataChannel.bufferedAmount>this.highWaterMark))return e();null==this.lastHighWaterMarkReached&&(this.emit("sctp_high_watermark_reached",{buffered:this.rtcDataChannel.bufferedAmount}),this.lastHighWaterMarkReached=performance.now()),this.currentCb=e}writePending(){this.currentChunk&&this.currentCb&&(this.internalWrite(this.currentChunk,this.currentCb),this.currentChunk=null,this.currentCb=null)}_destroy(t,e){if(clearInterval(this.bufferBeaconTimer),this._connected=!1,this.rtcPeerConnection){if(this.rtcDataChannel){this.rtcDataChannel.onmessage=null,this.rtcDataChannel.onopen=null,this.rtcDataChannel.onerror=null,this.rtcDataChannel.onclose=null;try{this.rtcDataChannel.close()}catch(t){this.emit("stcp_error",t)}this.rtcDataChannel=null}this.rtcPeerConnection.ondatachannel=null,this.rtcPeerConnection.onconnectionstatechange=null,this.rtcPeerConnection.onsignalingstatechange=null,this.rtcPeerConnection.onnegotiationneeded=null,this.rtcPeerConnection.onicecandidate=null,this.rtcPeerConnection.oniceconnectionstatechange=null,this.rtcPeerConnection.onicegatheringstatechange=null;try{this.rtcPeerConnection.close()}catch(t){this.emit("stcp_error",t)}return this.rtcPeerConnection=null,e(t)}}onIceComplete(){if(this.trickle)return;const t=this.rtcPeerConnection.localDescription.sdp;this.emit("signal",{type:this.initiator?"offer":"answer",sdp:t})}onIceStateChange(){switch(this.trickle||"complete"!==this.rtcPeerConnection.iceGatheringState||this.emit("rtc_ice_complete"),this.rtcPeerConnection.iceConnectionState){case"failed":this.destroy(new Error("ICE Connection failed"));break;case"closed":case"disconnected":this.destroy()}}onIceCandidate(t){if(!this.trickle)return void(t.candidate||this.emit("rtc_ice_complete"));if(!t.candidate)return this.emit("signal",{type:"candidate",candidate:"",sdpMid:"",sdpMLineIndex:-1}),void this.emit("rtc_ice_complete");const{candidate:e,sdpMid:n,sdpMLineIndex:r}=t.candidate;this.emit("signal",{type:"candidate",candidate:e,sdpMid:n,sdpMLineIndex:r})}onDataChannel(t){this.rtcDataChannel=t.channel,this.setupDataChannel(this.rtcDataChannel),this.writePending()}createDataChannel(){this.rtcDataChannel=this.rtcPeerConnection.createDataChannel("RTCDataChannel",{ordered:this.ordered}),this.setupDataChannel(this.rtcDataChannel)}setupDataChannel(t){"number"==typeof t.bufferedAmountLowThreshold&&(t.bufferedAmountLowThreshold=this.settings.rtcConnection.peerBufferedAmountLowThreshold),t.binaryType="arraybuffer",t.onbufferedamountlow=()=>this.onBufferedAmountLowDataChannel(),t.onmessage=t=>this.onMessageDataChannel(t),t.onopen=()=>this.onOpenDataChannel(),t.onerror=()=>this.onErrorDataChannel(),t.onclose=()=>this.onCloseDataChannel()}onMessageDataChannel(t){if(this.destroyed)return;this.lastActivityTimestamp=performance.now();let e=t.data;e instanceof ArrayBuffer&&(e=ir.from(e)),this.push(e)}onBufferedAmountLowDataChannel(){if(null!==this.lastHighWaterMarkReached&&(this.lastHighWaterMarkReached=null),!this.destroyed&&this.currentCb){const t=this.currentCb;return this.currentCb=null,t()}}onOpenDataChannel(){this._connected=!0,this.writePending(),this.emit("open")}onErrorDataChannel(){this.destroy()}onCloseDataChannel(){this.destroy()}}const ar=Et.getInstanceFactory(or);var cr=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class ur extends Xn{constructor(t){super(Object.assign(Object.assign({},t),{objectMode:!1})),this.currentPeerIndex=0,this.settings=On(this.context).getInstance(),this.peerPool=[]}static get isSctpSupported(){return or.isSupported}static get isTrickleIceSupported(){return or.isTrickleIceSupported}get connected(){return this.peerPool.some((t=>t.peer.connected))}get transport(){return this._transport}get count(){return this.connectedPeers.length}get connectedPeers(){return this.peerPool.filter((t=>{let{peer:e}=t;return e.connected}))}configure(t,e){this._transport=t,this.peerConfig=e}startConnection(){let t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.findPeerById(n)||("sctp"===this.transport&&(t=ar(this.context).createInstance({highWaterMark:this.settings.rtcConnection.peerHighWaterMark})),t.configure(this.peerConfig),t.on("open",(()=>{this.writePending(),this.emit("open",{connectionId:n})})),t.on("signal",(t=>{this.emit("signal",Object.assign(Object.assign({},t),{connectionId:n}))})),t.on("rtc_ice_complete",(()=>{this.emit("rtc_ice_complete",{connectionId:n})})),t.on("data",(t=>{this.push(t)})),t.on("close",(()=>{this.emit("close",{connectionId:n})})),t.on("error",(t=>{this.emit("error",t)})),t.on("stcp_error",(t=>{this.emit("sctp_debug_event",{type:"send_error",message:t.message})})),t.on("sctp_high_watermark_reached",(t=>{t.type="high_watermark_reached",this.emit("sctp_debug_event",t)})),t.on("sctp_buffer_drained",(t=>{t.type="send_buffer_drained",this.emit("sctp_debug_event",t)})),t.on("sctp_write_beacon",(t=>{t.type="sctp_write_beacon",this.emit("sctp_debug_event",t)})),t.on("sctp_buffer_beacon",(t=>{t.type="sctp_buffer_beacon",this.emit("sctp_debug_event",t)})),t.startConnection(e),this.peerPool.push({connectionId:n,peer:t}))}signal(t){const e=t.connectionId||0,n=this.findPeerById(e);n&&n.signal(t)}getStats(){return Promise.all(this.connectedPeers.map((t=>cr(this,void 0,void 0,(function*(){const e=yield t.peer.getStats();return{connectionId:t.connectionId,stats:e}})))))}_destroy(t,e){for(const{peer:t}of this.peerPool)t.destroy();this.peerPool=[],e(t)}writePending(){this.currentChunk&&this.currentCb&&(this.internalWrite(this.currentChunk,this.currentCb),this.currentChunk=null,this.currentCb=null)}internalWrite(t,e){var n,r;const i=this.connectedPeers[this.currentPeerIndex];1===(null===(n=this.peerConfig)||void 0===n?void 0:n.count)&&this.settings.rtcConnection.enableSinglePc?this.currentPeerIndex=0:this.currentPeerIndex=(this.currentPeerIndex+1)%this.connectedPeers.length,null===(r=null==i?void 0:i.peer)||void 0===r||r.write(t),e()}_write(t,e,n){return cr(this,void 0,void 0,(function*(){if(0===this.connectedPeers.length)return this.currentChunk=t,void(this.currentCb=n);this.internalWrite(t,n)}))}_read(t){return cr(this,void 0,void 0,(function*(){}))}findPeerById(t){var e;return null===(e=this.peerPool.find((e=>e.connectionId===t)))||void 0===e?void 0:e.peer}}const lr=Et.getInstanceFactory(ur);var hr=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class dr extends Xn{constructor(){super(),this.settings=On(this.context).getInstance()}get connected(){var t,e;return null!==(e=null===(t=this.transportConnection)||void 0===t?void 0:t.connected)&&void 0!==e&&e}get transport(){return this._transport}get count(){var t,e;return null!==(e=null===(t=this.transportConnection)||void 0===t?void 0:t.count)&&void 0!==e?e:0}get writableBuffer(){var t;return null===(t=this.transportConnection)||void 0===t?void 0:t._writableState.getBuffer()}get writableBufferSize(){if(this.transportConnection)return this.transportConnection._writableState.objectMode?this.writableBuffer.length:this.writableBuffer.reduce(((t,e)=>t+e.chunk.byteLength),0)}cork(){var t;null===(t=this.transportConnection)||void 0===t||t.cork()}uncork(){var t;null===(t=this.transportConnection)||void 0===t||t.uncork()}static isTransportSupported(t){switch(t){case"http":return nr.isSupported;case"sctp":return ur.isSctpSupported}return!1}static get isTrickleIceSupported(){return ur.isTrickleIceSupported}signal(t){this.transportConnection.signal(t)}configure(t,e){if(!this.transportConnection&&["http","sctp"].includes(t)){switch(this._transport=t,this._transport){case"http":this.transportConnection=rr(this.context).createInstance();break;case"sctp":this.transportConnection=lr(this.context).createInstance({highWaterMark:this.settings.rtcConnection.rtcConnectionHighWaterMark})}this.transportConnection.on("open",(t=>{this.emit("open",t)})),this.transportConnection.on("signal",(t=>{this.emit("signal",Object.assign(Object.assign({},t),{origin:"local"}))})),this.transportConnection.on("rtc_ice_complete",(t=>{this.emit("rtc_ice_complete",t)})),this.transportConnection.on("data",(t=>{this.push(t)})),this.transportConnection.on("close",(t=>{this.emit("close",t)})),this.transportConnection.on("error",(t=>{this.emit("error",t)})),this.transportConnection.on("sctp_debug_event",(t=>{this.emit("sctp_debug_event",t)})),this.transportConnection.configure(t,e)}}startConnection(t,e){var n;null===(n=this.transportConnection)||void 0===n||n.startConnection(t,e)}getStats(){var t;return hr(this,void 0,void 0,(function*(){return null===(t=this.transportConnection)||void 0===t?void 0:t.getStats()}))}_read(t){}_write(t,e,n){this.transportConnection.write(t),n()}_destroy(){var t;null===(t=this.transportConnection)||void 0===t||t.destroy()}}const pr=Et.getInstanceFactory(dr);var fr,gr;!function(t){let e;!function(t){t.UNKNOWN="unknown",t.NON_SYMMETRIC="non_symmetric",t.SYMMETRIC="symmetric",t.SEQUENTIAL="sequential"}(e=t.Type||(t.Type={}))}(fr||(fr={})),function(t){t.parseCandidate=function(t){const e=0===t.indexOf("a=candidate:")?12:10,n=t.substring(e).split(" "),r={component:n[1],foundation:n[0],ip:n[4],isReflexive:!1,port:Number(n[5]),priority:Number(n[3]),protocol:n[2].toLowerCase()};for(let t=6;t<n.length;t+=2){const e=n[t],i=n[t+1];switch(e){case"typ":r.type=i,r.isReflexive="srflx"===r.type;break;case"raddr":r.relatedAddress=i;break;case"rport":r.relatedPort=Number(i);break;case"tcptype":r.tcpType=i;break;case"network-cost":r.networkCost=Number(i)}}return r},t.composePriority=function(t,e,n){return t<<24|e<<8|255&-n},t.decomposePriority=function(t){return{componentId:255&-t,localPreference:t>>8&65535,typePreference:t>>24}}}(gr||(gr={}));class yr extends Tt{constructor(){super(),this._type=fr.Type.UNKNOWN,this.logger=xt(this.context).getInstance().getLogger("NatStats"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.platformStats=zn(this.context).getInstance()}start(){this.eventBus.on($t.BROWSER_STATS_CONNECTION_TYPE_CHANGED,this.handleBrowserStatsConnectionTypeChangedEvent,{scope:this}),this.detectNat()}get type(){return this._type}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.closePeerConnection(),this.logger=null,this.eventBus=null,this.settings=null}closePeerConnection(){var t,e;null===(t=this.connection)||void 0===t||t.removeAllListeners(),null===(e=this.connection)||void 0===e||e.destroy(),this.connection=null}detectNat(){if(null!=this.connection&&this.closePeerConnection(),!this.platformStats.isWebRTCSupported)return void this.logger.trace("Cannot detect NAT: WebRTC is not supported");const t=ot.uniq(this.settings.apiKey.stunServerUrl).map((t=>({urls:t})));t.length<2&&this.logger.warn("Need at least 2 different STUNs"),this.logger.trace("Detecting NAT"),this.candidates=[],this.connection=pr(this.context).createInstance(),this.connection.configure("sctp",{rtcConfiguration:{iceServers:t},trickle:!0}),this.connection.on("signal",(t=>{if(ot.isNil(this.connection)||ot.isNil(this.settings))return;const{candidate:e}=t;this.addCandidate(e);const n=this.calculateNatType();this.updateNatType(n)})),this.connection.on("rtc_ice_complete",(()=>{this.logger.trace("NAT discovery completed"),this.closePeerConnection()})),this.connection.on("error",(t=>{this.logger.error(`Error detected while detecting NAT: ${t.message}`)})),this.connection.on("close",(()=>{this.closePeerConnection()})),this.connection.startConnection()}addCandidate(t){if(ot.isNil(t)||""===t)return;this.logger.trace(`ICE candidate: ${t}`);const e=gr.parseCandidate(t);e.isReflexive&&this.candidates.push(e)}calculateNatType(){function t(t,e){return Object.values(ot.groupBy(t,e))}const e=[];for(const n of t(this.candidates,"ip"))for(const r of t(n,"relatedPort")){const t=r.map((t=>{let{networkCost:e}=t;return e||1e3})),n=Math.min(...t)||1e3;this.isNonSymmetricNat(r)?e.push({nat:fr.Type.NON_SYMMETRIC,cost:n}):this.isSequentialNat(r)?e.push({nat:fr.Type.SEQUENTIAL,cost:n}):e.push({nat:fr.Type.SYMMETRIC,cost:n})}const n=Math.min(...e.map((t=>{let{cost:e}=t;return e}))),r=e.find((t=>{let{cost:e}=t;return e===n}));return(null==r?void 0:r.nat)||fr.Type.UNKNOWN}isNonSymmetricNat(t){return 0!==t.length&&!(t.length>1&&!function(t){const e=t[0].port;return t.every((t=>t.port===e))}(t))}isSequentialNat(t){const e=this.settings.natTraversal.sequentialDetectionThreshold;let n=t.map((t=>{let{port:e}=t;return e}));n=ot.sortBy(n);for(let t=0;t<n.length-1;++t){const r=n[t+1]-n[t];if(r>0&&r<=e)return this.logger.trace(`Port delta: ${n[t+1]} - ${n[t]} = ${r} <= ${e}`),!0}return!1}updateNatType(t){this._type=t,this.logger.debug(Ut.NATTypeFound(this._type))}handleBrowserStatsConnectionTypeChangedEvent(){this.detectNat()}}yr.polyNetFactoryName="NatStats";const mr=Et.getSingletonFactory(yr);class br extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.stats={rtt:[]}}get rtt(){return this.stats.rtt}start(){this.eventBus.on($t.COLLECT_NETWORK_STATS,this.handleCollectStatsEvent,{scope:this})}handleCollectStatsEvent(t){if(!t)return;const e=ot.omit(t,["event"]);ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){return"rtt"===n?(t.push(e),t):e}clean(){this.stats.rtt=[]}}br.polyNetFactoryName="NetworkStats";const vr=Et.getSingletonFactory(br);class wr extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.stats={contentRequestResponseTimes:[],joinRequestTime:void 0,joinResponseTime:void 0,sessionId:void 0,state:void 0,mode:void 0,tecaCapacity:void 0,sdkVersion:void 0,revokedStatus:void 0}}start(){this.eventBus.on($t.COLLECT_POLYNET_STATS,this.handleCollectStatsEvent,{scope:this}),this.eventBus.on($t.POLYNET_STATE_CHANGED,this.handlePolyNetStateChangeEvent,{scope:this}),this.eventBus.on($t.POLYNET_DATA_CHANGED,this.handlePolyNetDataChangeEvent,{scope:this}),this.eventBus.on($t.POLYNET_MODE_CHANGED,this.handlePolyNetModeChangeEvent,{scope:this})}get contentRequestResponseTimes(){return this.stats.contentRequestResponseTimes}get joinResponseTime(){return this.stats.joinResponseTime}get joinRequestTime(){return this.stats.joinRequestTime}get sessionId(){return this.stats.sessionId||this.polyNet.sessionId}get state(){return this.stats.state||this.polyNet.state}get mode(){return this.stats.mode||this.polyNet.mode}get tecaCapacity(){return this.stats.tecaCapacity}get sdkVersion(){return"4.8.13"}get revokedStatus(){return this.stats.revokedStatus}clean(){return Object.assign(this.stats,{contentRequestResponseTimes:[]})}handleCollectStatsEvent(t){if(!t)return;const e=ot.omit(t,["event"]);ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){switch(n){case"contentRequestResponseTimes":return t.push(e),t;case"revokedStatus":return this.updateRevokedStatus(e),this.stats.revokedStatus;default:return e}}updateRevokedStatus(t){const e=t;e&&(this.stats.revokedStatus>=e||(this.stats.revokedStatus=e))}handlePolyNetStateChangeEvent(t){t.newState&&Object.assign(this.stats,{state:t.newState})}handlePolyNetDataChangeEvent(t){t.newData&&Object.assign(this.stats,Object.assign({},t.newData))}handlePolyNetModeChangeEvent(t){t.newMode&&Object.assign(this.stats,{state:t.newMode})}}wr.polyNetFactoryName="PolyNetStats",function(t){let e;!function(t){t[t.NOT_ALLOWED=150]="NOT_ALLOWED",t[t.PROTOCOL_NOT_SUPPORTED=100]="PROTOCOL_NOT_SUPPORTED",t[t.MAX_USERS_PER_API_KEY=50]="MAX_USERS_PER_API_KEY",t[t.OUT_OF_LIVE_WINDOW=10]="OUT_OF_LIVE_WINDOW"}(e=t.RevokedStatus||(t.RevokedStatus={}))}(wr||(wr={}));const Sr=Et.getSingletonFactory(wr);class Er extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.estimatedBitrateByRepresentation=new Map,this.stats={bitrate:void 0,estimatedBitrate:void 0,parsedBitrate:void 0,maskedStreamUri:void 0,streamUri:void 0,playerUri:void 0,representationId:void 0,streamState:void 0,isLive:void 0,isInsideLiveWindow:void 0,isMonoBitrate:void 0,streamInfo:void 0,findBitrate:void 0}}start(){this.eventBus.on($t.COLLECT_STREAMING_STATS,this.handleCollectStatsEvent,{scope:this}),this.eventBus.on($t.STREAM_INFO,this.handleStreamInfoEvent,{scope:this})}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.stats=null}get maskedStreamUri(){var t,e,n;return"live"===this.streamState?null!==(t=this.polyNet.maskedStreamUri)&&void 0!==t?t:"no-media-uri":null!==(n=null!==(e=this.polyNet.maskedStreamUri)&&void 0!==e?e:((t,e)=>{if(ot.isNil(t)||ot.isNil(e))return;const n=e.exec(t);return ot.isNil(n)||n&&n.length<2?void 0:n.slice(1).join("")})(this.stats.streamUri,this.settings.analytics.regex))&&void 0!==n?n:"no-media-uri"}get streamUri(){return this.stats.streamUri}get playerUri(){return this.stats.playerUri}get streamState(){return ot.isNil(this.stats.isLive)||ot.isNil(this.stats.isInsideLiveWindow)?"unknown":this.stats.isLive&&this.stats.isInsideLiveWindow?"live":this.stats.isLive&&!this.stats.isInsideLiveWindow?"dvr":this.stats.isLive?"unknown":"vod"}get bitrate(){const t=this.parsedBitrate,e=this.estimatedBitrate;return t||e}get representationId(){return this.stats.representationId}get parsedBitrate(){if(ot.isFinite(this.stats.bitrate))return Number(this.stats.bitrate)}get estimatedBitrate(){if(this.stats.representationId)return this.estimatedBitrateByRepresentation.get(this.stats.representationId)}get isMonoBitrate(){return"monobitrate"===this.stats.representationId}get streamInfo(){return this.stats.streamInfo}findBitrate(t){var e,n;const r=null===(n=null===(e=this.stats.streamInfo)||void 0===e?void 0:e.manifest)||void 0===n?void 0:n.levels,i=null==r?void 0:r.find((e=>{let{id:n}=e;return n===t}));return null==i?void 0:i.bitrate}handleCollectStatsEvent(t){const{stats:e}=t;ot.isEmpty(e)||ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){if("estimatedBitrate"===n){const{representationId:n,bitrate:r}=e;return this.updateEstimatedBitrate(n,r),t}return e}updateEstimatedBitrate(t,e){if(!t||!e)return;const n=this.estimatedBitrateByRepresentation.get(t),r=n?Math.max(n,e):e;this.estimatedBitrateByRepresentation.set(t,r)}handleStreamInfoEvent(t){this.stats.streamInfo=null==t?void 0:t.streamInfo}}Er.polyNetFactoryName="StreamingStats";const _r=Et.getSingletonFactory(Er);class Cr extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.stats={dataChannels:[],dataChannelsNotEstablished:[],peeringType:void 0}}start(){this.eventBus.on($t.COLLECT_DATA_CHANNEL_STATS,this.handleCollectStatsEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_CREATED,this.handleDataChannelCreateEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_STATE_CHANGED,this.handleDataChannelStateChangedEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_REMOVED,this.handleDataChannelRemoveEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_CONNECTING_TIMEOUT,this.handleDataChannelTimeoutEvent,{scope:this})}get dataChannels(){return this.stats.dataChannels}get dataChannelsNotEstablished(){return this.stats.dataChannelsNotEstablished}get peeringType(){return this.stats.peeringType}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.eventBus=null}handleCollectStatsEvent(t){if(!t)return;const e=ot.omit(t,["event"]);ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){switch(n){case"peeringType":default:return e;case"bufferFillingRate":return this.updateDataChannelBufferFillingRate(t,e),t}}handleDataChannelCreateEvent(t){if(!t.dataChannel)return;const{nodeId:e,direction:n,state:r,type:i}=t.dataChannel;this.stats.dataChannels.push({nodeId:e,direction:n,state:r,type:i})}handleDataChannelStateChangedEvent(t){if(!t.dataChannel)return;const{nodeId:e,direction:n,state:r,type:i}=t.dataChannel,s=this.stats.dataChannels.find(ot.matches({nodeId:e}));s&&Object.assign(s,{nodeId:e,direction:n,state:r,type:i})}handleDataChannelRemoveEvent(t){if(!t.dataChannel)return;const{nodeId:e}=t.dataChannel;ot.remove(this.stats.dataChannels,{nodeId:e})}handleDataChannelTimeoutEvent(t){const e=t.dataChannel;e&&e.isInbound&&e.isWebRTC&&this.stats.dataChannelsNotEstablished.push(e.identifier)}updateDataChannelBufferFillingRate(t,e){const{nodeId:n,bufferFillingRate:r}=e,i=this.stats.dataChannels.find(ot.matches({nodeId:n}));if(i)return i.bufferFillingRate=r,t}clean(){return Object.assign(this.stats,{dataChannelsNotEstablished:[]})}}Cr.polyNetFactoryName="DataChannelStats";const Tr=Et.getSingletonFactory(Cr);class Ir extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.stats={resourceId:void 0,pathwayName:void 0,pathwayPriority:[],responseCdn:void 0}}start(){this.eventBus.on($t.COLLECT_CS_STATS,this.handleCollectStatsEvent,{scope:this})}get resourceId(){return this.stats.resourceId}get pathwayName(){return this.stats.pathwayName}get pathwayPriority(){return this.stats.pathwayPriority}get responseCdn(){return this.stats.responseCdn}handleCollectStatsEvent(t){if(!t)return;const e=ot.omit(t,["event"]);ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){switch(n){case"resourceId":return this.stats.resourceId=Number(e),this.stats.resourceId;case"pathwayName":return this.stats.pathwayName=e,this.stats.pathwayName;case"pathwayPriority":return this.stats.pathwayPriority=e,this.stats.pathwayPriority;case"responseCdn":return this.stats.responseCdn=e,this.stats.responseCdn;default:return t}}}Ir.polyNetFactoryName="ContentSteeringStats";const Nr=Et.getSingletonFactory(Ir);class Rr extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.stats={currentHost:void 0,responseCdn:void 0}}start(){this.eventBus.on($t.COLLECT_MSS_STATS,this.handleCollectStatsEvent,{scope:this})}get currentHost(){return this.stats.currentHost}get responseCdn(){return this.stats.responseCdn}handleCollectStatsEvent(t){if(!t)return;const e=ot.omit(t,["event"]);ot.mergeWith(this.stats,e,((t,e,n)=>this.updateStats(t,e,n)))}updateStats(t,e,n){switch(n){case"currentHost":return this.stats.currentHost=e,this.stats.currentHost;case"responseCdn":return this.stats.responseCdn=e,this.stats.responseCdn;default:return t}}}Rr.polyNetFactoryName="MssStats";const Or=Et.getSingletonFactory(Rr);var Ar=function(t,e){return Ar=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])},Ar(t,e)};function xr(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}Ar(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function Pr(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))}function kr(t,e){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=e.call(t,o)}catch(t){s=[6,t],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}Object.create;function Lr(t){var e="function"==typeof Symbol&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Dr(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,s=n.call(t),o=[];try{for(;(void 0===e||e-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}function Mr(t,e,n){if(n||2===arguments.length)for(var r,i=0,s=e.length;i<s;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))}function Br(t){return this instanceof Br?(this.v=t,this):new Br(t)}function Fr(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(t,e||[]),s=[];return r={},o("next"),o("throw"),o("return"),r[Symbol.asyncIterator]=function(){return this},r;function o(t){i[t]&&(r[t]=function(e){return new Promise((function(n,r){s.push([t,e,n,r])>1||a(t,e)}))})}function a(t,e){try{(n=i[t](e)).value instanceof Br?Promise.resolve(n.value.v).then(c,u):l(s[0][2],n)}catch(t){l(s[0][3],t)}var n}function c(t){a("next",t)}function u(t){a("throw",t)}function l(t,e){t(e),s.shift(),s.length&&a(s[0][0],s[0][1])}}function jr(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,n=t[Symbol.asyncIterator];return n?n.call(t):(t=Lr(t),e={},r("next"),r("throw"),r("return"),e[Symbol.asyncIterator]=function(){return this},e);function r(n){e[n]=t[n]&&function(e){return new Promise((function(r,i){(function(t,e,n,r){Promise.resolve(r).then((function(e){t({value:e,done:n})}),e)})(r,i,(e=t[n](e)).done,e.value)}))}}}Object.create;function Ur(t){return"function"==typeof t}function $r(t){var e=t((function(t){Error.call(t),t.stack=(new Error).stack}));return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e,e}var qr=$r((function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n  "):"",this.name="UnsubscriptionError",this.errors=e}}));function Hr(t,e){if(t){var n=t.indexOf(e);0<=n&&t.splice(n,1)}}var Wr=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return t.prototype.unsubscribe=function(){var t,e,n,r,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var o=Lr(s),a=o.next();!a.done;a=o.next()){a.value.remove(this)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}else s.remove(this);var c=this.initialTeardown;if(Ur(c))try{c()}catch(t){i=t instanceof qr?t.errors:[t]}var u=this._finalizers;if(u){this._finalizers=null;try{for(var l=Lr(u),h=l.next();!h.done;h=l.next()){var d=h.value;try{zr(d)}catch(t){i=null!=i?i:[],t instanceof qr?i=Mr(Mr([],Dr(i)),Dr(t.errors)):i.push(t)}}}catch(t){n={error:t}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}if(i)throw new qr(i)}},t.prototype.add=function(e){var n;if(e&&e!==this)if(this.closed)zr(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&Hr(e,t)},t.prototype.remove=function(e){var n=this._finalizers;n&&Hr(n,e),e instanceof t&&e._removeParent(this)},t.EMPTY=function(){var e=new t;return e.closed=!0,e}(),t}(),Vr=Wr.EMPTY;function Gr(t){return t instanceof Wr||t&&"closed"in t&&Ur(t.remove)&&Ur(t.add)&&Ur(t.unsubscribe)}function zr(t){Ur(t)?t():t.unsubscribe()}var Kr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Yr={setTimeout:function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=Yr.delegate;return(null==i?void 0:i.setTimeout)?i.setTimeout.apply(i,Mr([t,e],Dr(n))):setTimeout.apply(void 0,Mr([t,e],Dr(n)))},clearTimeout:function(t){var e=Yr.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function Xr(t){Yr.setTimeout((function(){var e=Kr.onUnhandledError;if(!e)throw t;e(t)}))}function Zr(){}var Jr=Qr("C",void 0,void 0);function Qr(t,e,n){return{kind:t,value:e,error:n}}var ti=null;function ei(t){if(Kr.useDeprecatedSynchronousErrorHandling){var e=!ti;if(e&&(ti={errorThrown:!1,error:null}),t(),e){var n=ti,r=n.errorThrown,i=n.error;if(ti=null,r)throw i}}else t()}var ni=function(t){function e(e){var n=t.call(this)||this;return n.isStopped=!1,e?(n.destination=e,Gr(e)&&e.add(n)):n.destination=ui,n}return xr(e,t),e.create=function(t,e,n){return new oi(t,e,n)},e.prototype.next=function(t){this.isStopped?ci(function(t){return Qr("N",t,void 0)}(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?ci(Qr("E",void 0,t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?ci(Jr,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(Wr),ri=Function.prototype.bind;function ii(t,e){return ri.call(t,e)}var si=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){ai(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){ai(t)}else ai(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){ai(t)}},t}(),oi=function(t){function e(e,n,r){var i,s,o=t.call(this)||this;Ur(e)||!e?i={next:null!=e?e:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:o&&Kr.useDeprecatedNextContext?((s=Object.create(e)).unsubscribe=function(){return o.unsubscribe()},i={next:e.next&&ii(e.next,s),error:e.error&&ii(e.error,s),complete:e.complete&&ii(e.complete,s)}):i=e;return o.destination=new si(i),o}return xr(e,t),e}(ni);function ai(t){var e;Kr.useDeprecatedSynchronousErrorHandling?(e=t,Kr.useDeprecatedSynchronousErrorHandling&&ti&&(ti.errorThrown=!0,ti.error=e)):Xr(t)}function ci(t,e){var n=Kr.onStoppedNotification;n&&Yr.setTimeout((function(){return n(t,e)}))}var ui={closed:!0,next:Zr,error:function(t){throw t},complete:Zr},li="function"==typeof Symbol&&Symbol.observable||"@@observable";function hi(t){return t}function di(t){return 0===t.length?hi:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)}}var pi=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var r,i=this,s=(r=t)&&r instanceof ni||function(t){return t&&Ur(t.next)&&Ur(t.error)&&Ur(t.complete)}(r)&&Gr(r)?t:new oi(t,e,n);return ei((function(){var t=i,e=t.operator,n=t.source;s.add(e?e.call(s,n):n?i._subscribe(s):i._trySubscribe(s))})),s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=fi(e))((function(e,r){var i=new oi({next:function(e){try{t(e)}catch(t){r(t),i.unsubscribe()}},error:r,complete:e});n.subscribe(i)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[li]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return di(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=fi(t))((function(t,n){var r;e.subscribe((function(t){return r=t}),(function(t){return n(t)}),(function(){return t(r)}))}))},t.create=function(e){return new t(e)},t}();function fi(t){var e;return null!==(e=null!=t?t:Kr.Promise)&&void 0!==e?e:Promise}var gi=$r((function(t){return function(){t(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),yi=function(t){function e(){var e=t.call(this)||this;return e.closed=!1,e.currentObservers=null,e.observers=[],e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return xr(e,t),e.prototype.lift=function(t){var e=new mi(this,this);return e.operator=t,e},e.prototype._throwIfClosed=function(){if(this.closed)throw new gi},e.prototype.next=function(t){var e=this;ei((function(){var n,r;if(e._throwIfClosed(),!e.isStopped){e.currentObservers||(e.currentObservers=Array.from(e.observers));try{for(var i=Lr(e.currentObservers),s=i.next();!s.done;s=i.next()){s.value.next(t)}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},e.prototype.error=function(t){var e=this;ei((function(){if(e._throwIfClosed(),!e.isStopped){e.hasError=e.isStopped=!0,e.thrownError=t;for(var n=e.observers;n.length;)n.shift().error(t)}}))},e.prototype.complete=function(){var t=this;ei((function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var e=t.observers;e.length;)e.shift().complete()}}))},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return(null===(t=this.observers)||void 0===t?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(e){return this._throwIfClosed(),t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var e=this,n=this,r=n.hasError,i=n.isStopped,s=n.observers;return r||i?Vr:(this.currentObservers=null,s.push(t),new Wr((function(){e.currentObservers=null,Hr(s,t)})))},e.prototype._checkFinalizedStatuses=function(t){var e=this,n=e.hasError,r=e.thrownError,i=e.isStopped;n?t.error(r):i&&t.complete()},e.prototype.asObservable=function(){var t=new pi;return t.source=this,t},e.create=function(t,e){return new mi(t,e)},e}(pi),mi=function(t){function e(e,n){var r=t.call(this)||this;return r.destination=e,r.source=n,r}return xr(e,t),e.prototype.next=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.next)||void 0===n||n.call(e,t)},e.prototype.error=function(t){var e,n;null===(n=null===(e=this.destination)||void 0===e?void 0:e.error)||void 0===n||n.call(e,t)},e.prototype.complete=function(){var t,e;null===(e=null===(t=this.destination)||void 0===t?void 0:t.complete)||void 0===e||e.call(t)},e.prototype._subscribe=function(t){var e,n;return null!==(n=null===(e=this.source)||void 0===e?void 0:e.subscribe(t))&&void 0!==n?n:Vr},e}(yi);function bi(t){return function(e){if(function(t){return Ur(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}function vi(t,e,n,r,i){return new wi(t,e,n,r,i)}var wi=function(t){function e(e,n,r,i,s,o){var a=t.call(this,e)||this;return a.onFinalize=s,a.shouldUnsubscribe=o,a._next=n?function(t){try{n(t)}catch(t){e.error(t)}}:t.prototype._next,a._error=i?function(t){try{i(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,a._complete=r?function(){try{r()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,a}return xr(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;t.prototype.unsubscribe.call(this),!n&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(ni);function Si(t,e){return bi((function(n,r){var i=0;n.subscribe(vi(r,(function(n){r.next(t.call(e,n,i++))})))}))}var Ei=function(t){return t&&"number"==typeof t.length&&"function"!=typeof t};function _i(t){return Ur(null==t?void 0:t.then)}function Ci(t){return Ur(t[li])}function Ti(t){return Symbol.asyncIterator&&Ur(null==t?void 0:t[Symbol.asyncIterator])}function Ii(t){return new TypeError("You provided "+(null!==t&&"object"==typeof t?"an invalid object":"'"+t+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var Ni="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Ri(t){return Ur(null==t?void 0:t[Ni])}function Oi(t){return Fr(this,arguments,(function(){var e,n,r;return kr(this,(function(i){switch(i.label){case 0:e=t.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,Br(e.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,Br(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,Br(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return e.releaseLock(),[7];case 10:return[2]}}))}))}function Ai(t){return Ur(null==t?void 0:t.getReader)}function xi(t){if(t instanceof pi)return t;if(null!=t){if(Ci(t))return i=t,new pi((function(t){var e=i[li]();if(Ur(e.subscribe))return e.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Ei(t))return r=t,new pi((function(t){for(var e=0;e<r.length&&!t.closed;e++)t.next(r[e]);t.complete()}));if(_i(t))return n=t,new pi((function(t){n.then((function(e){t.closed||(t.next(e),t.complete())}),(function(e){return t.error(e)})).then(null,Xr)}));if(Ti(t))return Pi(t);if(Ri(t))return e=t,new pi((function(t){var n,r;try{for(var i=Lr(e),s=i.next();!s.done;s=i.next()){var o=s.value;if(t.next(o),t.closed)return}}catch(t){n={error:t}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.complete()}));if(Ai(t))return Pi(Oi(t))}var e,n,r,i;throw Ii(t)}function Pi(t){return new pi((function(e){(function(t,e){var n,r,i,s;return Pr(this,void 0,void 0,(function(){var o,a;return kr(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),n=jr(t),c.label=1;case 1:return[4,n.next()];case 2:if((r=c.sent()).done)return[3,4];if(o=r.value,e.next(o),e.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=c.sent(),i={error:a},[3,11];case 6:return c.trys.push([6,,9,10]),r&&!r.done&&(s=n.return)?[4,s.call(n)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}}))}))})(t,e).catch((function(t){return e.error(t)}))}))}function ki(t,e,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var s=e.schedule((function(){n(),i?t.add(this.schedule(null,r)):this.unsubscribe()}),r);if(t.add(s),!i)return s}function Li(t,e,n){return void 0===n&&(n=1/0),Ur(e)?Li((function(n,r){return Si((function(t,i){return e(n,t,r,i)}))(xi(t(n,r)))}),n):("number"==typeof e&&(n=e),bi((function(e,r){return function(t,e,n,r,i,s,o,a){var c=[],u=0,l=0,h=!1,d=function(){!h||c.length||u||e.complete()},p=function(t){return u<r?f(t):c.push(t)},f=function(t){s&&e.next(t),u++;var a=!1;xi(n(t,l++)).subscribe(vi(e,(function(t){null==i||i(t),s?p(t):e.next(t)}),(function(){a=!0}),void 0,(function(){if(a)try{u--;for(var t=function(){var t=c.shift();o?ki(e,o,(function(){return f(t)})):f(t)};c.length&&u<r;)t();d()}catch(t){e.error(t)}})))};return t.subscribe(vi(e,p,(function(){h=!0,d()}))),function(){null==a||a()}}(e,r,t,n)})))}var Di=new pi((function(t){return t.complete()}));function Mi(t){return t[t.length-1]}function Bi(t){return(e=Mi(t))&&Ur(e.schedule)?t.pop():void 0;var e}function Fi(t,e){return void 0===e&&(e=0),bi((function(n,r){n.subscribe(vi(r,(function(n){return ki(r,t,(function(){return r.next(n)}),e)}),(function(){return ki(r,t,(function(){return r.complete()}),e)}),(function(n){return ki(r,t,(function(){return r.error(n)}),e)})))}))}function ji(t,e){return void 0===e&&(e=0),bi((function(n,r){r.add(t.schedule((function(){return n.subscribe(r)}),e))}))}function Ui(t,e){if(!t)throw new Error("Iterable cannot be null");return new pi((function(n){ki(n,e,(function(){var r=t[Symbol.asyncIterator]();ki(n,e,(function(){r.next().then((function(t){t.done?n.complete():n.next(t.value)}))}),0,!0)}))}))}function $i(t,e){if(null!=t){if(Ci(t))return function(t,e){return xi(t).pipe(ji(e),Fi(e))}(t,e);if(Ei(t))return function(t,e){return new pi((function(n){var r=0;return e.schedule((function(){r===t.length?n.complete():(n.next(t[r++]),n.closed||this.schedule())}))}))}(t,e);if(_i(t))return function(t,e){return xi(t).pipe(ji(e),Fi(e))}(t,e);if(Ti(t))return Ui(t,e);if(Ri(t))return function(t,e){return new pi((function(n){var r;return ki(n,e,(function(){r=t[Ni](),ki(n,e,(function(){var t,e,i;try{e=(t=r.next()).value,i=t.done}catch(t){return void n.error(t)}i?n.complete():n.next(e)}),0,!0)})),function(){return Ur(null==r?void 0:r.return)&&r.return()}}))}(t,e);if(Ai(t))return function(t,e){return Ui(Oi(t),e)}(t,e)}throw Ii(t)}function qi(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=Bi(t),r=function(t,e){return"number"==typeof Mi(t)?t.pop():e}(t,1/0),i=t;return i.length?1===i.length?xi(i[0]):function(t){return void 0===t&&(t=1/0),Li(hi,t)}(r)(function(t,e){return e?$i(t,e):xi(t)}(i,n)):Di}var Hi=__webpack_require__(7780);class Wi{static b64DecodeUnicode(t){return decodeURIComponent(atob(t).split("").map((t=>"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2))).join(""))}static numberToUInt32(t){return t>>>0}static ab2str(t){let e="";const n=new Uint8Array(t);for(let t=0;t<n.length;t++)e+=String.fromCharCode(n[t]);return e}static str2ab(t){const e=new ArrayBuffer(t.length),n=new Uint8Array(e);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return e}}class Vi{static crc32FromArrayBuffer(t){const e=Hi.buf(new Uint8Array(t));return Wi.numberToUInt32(e)}static crc32FromString(t){const e=Hi.str(t);return Wi.numberToUInt32(e)}}var Gi={now:function(){return(Gi.delegate||Date).now()},delegate:void 0},zi=function(t){function e(e,n,r){void 0===e&&(e=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Gi);var i=t.call(this)||this;return i._bufferSize=e,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,e),i._windowTime=Math.max(1,n),i}return xr(e,t),e.prototype.next=function(e){var n=this,r=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,o=n._timestampProvider,a=n._windowTime;r||(i.push(e),!s&&i.push(o.now()+a)),this._trimBuffer(),t.prototype.next.call(this,e)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var e=this._innerSubscribe(t),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!t.closed;i+=n?1:2)t.next(r[i]);return this._checkFinalizedStatuses(t),e},e.prototype._trimBuffer=function(){var t=this,e=t._bufferSize,n=t._timestampProvider,r=t._buffer,i=t._infiniteTimeWindow,s=(i?1:2)*e;if(e<1/0&&s<r.length&&r.splice(0,r.length-s),!i){for(var o=n.now(),a=0,c=1;c<r.length&&r[c]<=o;c+=2)a=c;a&&r.splice(0,a+1)}},e}(yi);class Ki{constructor(){this.chunksMap=new Map,this.chunksList=[],this._subject=new zi}get byteLength(){return this.chunksList.reduce(((t,e)=>t+e.data.byteLength),0)}get receivedChunksSummary(){return[...this.chunksMap.keys()].sort(((t,e)=>t-e)).reduce(((t,e)=>{if(0===t.length)t.push([e,null]);else{const n=t[t.length-1];null===n[1]&&n[0]+1===e||n[1]+1===e?n[1]=e:t.push([e,null])}return t}),[]).map((t=>null==t[1]?[t[0]]:t))}get subject(){return this._subject}close(){this._subject.complete()}get size(){return this.chunksMap.size}get(t){return this.chunksMap.get(t)}set(t,e){if(this.chunksMap.has(t))return;const n={id:t,data:e};return this.chunksMap.set(n.id,n.data),this.chunksList.push(n),this._subject.next(n),n}clear(){this.chunksMap.clear(),this.chunksList.splice(0)}get chunks(){return this.chunksList}rebuild(){if(0===this.size)return new ArrayBuffer(0);const t=this.chunks.slice().sort(((t,e)=>t.id-e.id)).map((t=>{let{data:e}=t;return e}));return tr.concat(...t)}[Symbol.iterator](){let t=0;const e=this.chunksList;return{next:()=>t<e.length?{done:!1,value:e[t++]}:{done:!0,value:null}}}}class Yi{constructor(t,e,n){this.state=Yi.State.PROGRESS,this.cachePolicy=Yi.Policy.CACHEABLE,this._contentLength=null,this.discardedData=0,this.discardedTime=0,this.unsafe=!1,this.droppedChunks=0,this.id=t.id,this.representationId=t.representationId,this.cachePolicy=t.cachePolicy,this.duration=t.duration,this.origin=e.origin,this.dataChannelId=e.dataChannelId,this.bitrate=e.bitrate,this.options=t,this._timeRequest=performance.now(),this.chunks=new Ki,this.requested=!1,this.external=!1,this.aborted=!1,this.retries=0,this.errorSubject=new yi,this.seq=++Yi.instanceCtr,this.logger=xt(n).getInstance().getLogger(`ContentCache-${this.seq}`)}get url(){return this.options.url}set url(t){this.options.url=t}get contentLength(){return this._contentLength}set contentLength(t){this._contentLength!=t&&(null==this._contentLength?this.logger.trace(`contentLength initial ${t} ${this.toString()}.`):this.logger.trace(`contentLength changed ${this._contentLength} -> ${t} ${this.toString()}.`)),this._contentLength=t}get contentData(){return this.isFinished&&(ot.isNil(this._contentData)||0===this._contentData.byteLength)&&(this._contentData=this.chunks.rebuild()),this._contentData}set contentData(t){this._contentData=t}destroy(){var t;this.state!==Yi.State.FINISH&&this.logger.debug(`unfinished but destroyed with ${this.chunks.size} chunks of data ${this.toString()}`),this._contentData=null,null===(t=this.chunks)||void 0===t||t.clear(),this.chunks=null}get isCacheable(){return this.cachePolicy===Yi.Policy.CACHEABLE}get isFinished(){return this.state===Yi.State.FINISH}get isInProgress(){return this.state===Yi.State.PROGRESS}get hasError(){return this.state===Yi.State.ERROR}get isAborted(){return this.aborted}get duration(){return this._duration}set duration(t){t&&(this._duration=t)}get isResourceFromCdn(){return this.origin===Yi.Origin.HTTP}get isResourceFromP2P(){return this.origin===Yi.Origin.WEB_RTC}get timeRequest(){return this._timeRequest}get timeFirst(){return this._timeFirst}get timeResponse(){return this._timeResponse}get chunksLength(){return this.chunks.size}get expectedChunksLength(){if(null==this._contentLength)return null;let t=Math.floor(this._contentLength/Yi.CHUNK_SIZE);return this._contentLength%Yi.CHUNK_SIZE!=0&&++t,t}get loaded(){return this.contentData?this.contentData.byteLength:this.chunks.byteLength}get crc32(){var t;if(!ot.isNil(this.contentData))return(null===(t=this.contentData)||void 0===t?void 0:t.byteLength)?Vi.crc32FromArrayBuffer(this.contentData):Vi.crc32FromString(this.contentData)}checkRemoteFinish(){return!ot.isNil(this.chunksLength)&&!ot.isNil(this.expectedChunksLength)&&this.chunksLength===this.expectedChunksLength}get asObservable(){return qi(this.chunks.subject,this.errorSubject).pipe((t=t=>t.id,bi((function(n,r){var i=new Set;n.subscribe(vi(r,(function(e){var n=t?t(e):e;i.has(n)||(i.add(n),r.next(e))}))),null==e||e.subscribe(vi(r,(function(){return i.clear()}),Zr))}))));var t,e}error(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.logger.trace(`error, ${null!=t?t:"aborted"} ${this.toString()}`),this.state=Yi.State.ERROR,this.aborted=t,this.errorSubject.error(new Error(`Content error. ${null!=t?t:" Aborted"}`))}reset(){this._timeFirst&&(this.discardedTime=performance.now()-this._timeFirst),this._timeFirst=null,this.requested=!1}finish(){let t=this.logger.trace,e="";if(this.droppedChunks>0){t=this.logger.debug;e+=` dropped ${Math.round(this.droppedChunks/this.expectedChunksLength*100)}% chunks`}this._timeResponse=performance.now();const n=this._timeResponse-this._firstTimeFirst,r=Math.round(n/this.duration*100);r>100&&(t=this.logger.debug,e+=` took ${r}% duration`),t.call(this.logger,`finished${e} ${this.toString()}`),this.state=Yi.State.FINISH,this.contentLength=this.contentData.byteLength,this.chunks.close(),this.errorSubject.complete()}setChunk(t,e){var n;if(this.setTimeFirst(),Number(this.id)>0&&!this.chunks.get(t)){const t=this.expectedChunksLength?Math.floor(.25*this.expectedChunksLength):100;this.chunks.size%t==0&&this.logger.trace(`milestone ${this.chunks.size}/${null!==(n=this.expectedChunksLength)&&void 0!==n?n:"unknown"} ${this.toString()}`)}if(this.chunks.get(t))return++this.droppedChunks,void(this.discardedData+=e.byteLength);this.chunks.set(t,e)}get firstTimeFirst(){return this._firstTimeFirst}setTimeFirst(){ot.isNil(this._timeFirst)&&(this._timeFirst=performance.now()),ot.isNil(this._firstTimeFirst)&&(this._firstTimeFirst=this._timeFirst)}toString(){return`seq: ${this.seq}, contentId: ${this.id}, representationId: ${this.representationId}, chunksCount: ${this.expectedChunksLength}, chunks: ${JSON.stringify(this.chunks.receivedChunksSummary)}`}}Yi.CHUNK_SIZE=16367,Yi.instanceCtr=0,function(t){let e,n,r;!function(t){t.HTTP="HTTP",t.WEB_RTC="WebRTC"}(e=t.Origin||(t.Origin={})),function(t){t.CACHEABLE="CACHEABLE",t.NO_CACHEABLE="NO_CACHEABLE"}(n=t.Policy||(t.Policy={})),function(t){t.PROGRESS="PROGRESS",t.FINISH="FINISH",t.ERROR="ERROR"}(r=t.State||(t.State={}))}(Yi||(Yi={}));class Xi{constructor(){this.data=new Map,this.data.set("http",new Map),this.data.set("webrtc",new Map),this.historicalData=new Map}shift(){this.historicalData=this.data,this.data=new Map,this.data.set("http",new Map),this.data.set("webrtc",new Map)}addLoadedBytes(t,e,n){var r;if(ot.isNil(t)||ot.isEmpty(t)||!ot.isFinite(e)||!ot.isFinite(n)||n<=0)return;const i=`${e}`,s=this.data.get(t);if(!s)return;s.has(i)||s.set(i,{bitrate:e,nloaded:0,tstart:void 0,tend:void 0,tdelta:0});const o=performance.now(),a=s.get(i);a.nloaded+=n,null!==(r=a.tstart)&&void 0!==r||(a.tstart=o),a.tend=o,a.tdelta=a.tend-a.tstart}getLastStatsFromSource(t){const e=this.getStats(t,this.data);if(ot.isNil(e))return[];if(0===this.historicalData.size)return[e];const n=this.getStats(t,this.historicalData);return ot.isNil(n)||e.bitrate!==n.bitrate?[e]:[e,n]}getStats(t,e){if(!e.has(t))return;return[...e.get(t).entries()].map((t=>{let[e,n]=t;return Object.assign({bitrate:Number(e)},n)})).filter((t=>{let{bitrate:e,nloaded:n,tdelta:r}=t;return ot.isFinite(e)&&r>0&&n>0})).sort(((t,e)=>e.tend-t.tend))[0]}}function Zi(t){return Ji(t)||t.hasError||t.isFinished}function Ji(t){const{isFinished:e,loaded:n,timeFirst:r,timeResponse:i}=t;return e&&ot.isFinite(r)&&ot.isFinite(i)&&ot.isFinite(n)}function Qi(t){return t.isCacheable}function ts(t){const{timeFirst:e,timeResponse:n}=t;return Qi(t)&&Ji(t)&&e<n}const es=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.reporter="zero",this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("ContentStats"),this.settings=On(this.context).getInstance(),this.downloadCounters=new Xi,this.stats={source:"http",bufferFillingRate:0,bfrHttp:0,bfrWebRTC:0,contents:[],downSpeed:void 0,throughputHttp:0,throughputWebRTC:0}}start(){this.eventBus.on($t.POLYNET_MODE_CHANGED,this.handlePolyNetModeChangeEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_CREATED,this.handleDataChannelEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_STATE_CHANGED,this.handleDataChannelEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_REMOVED,this.handleDataChannelEvent,{scope:this}),this.eventBus.on($t.CONTENT_CACHE_CONTENT_CREATED,this.handleContentCacheEvent,{scope:this}),this.eventBus.on($t.CONTENT_CACHE_CONTENT_UPDATED,this.handleContentCacheEvent,{scope:this}),this.eventBus.on($t.CONTENT_CACHE_CONTENT_ERROR,this.handleContentCacheEvent,{scope:this})}clean(){this.stats.contents=this.stats.contents.filter((t=>!Zi(t))),this.stats.throughputWebRTC=0,this.stats.throughputHttp=0,this.downloadCounters.shift()}cleanP2P(t){this.stats.contents=this.stats.contents.filter((e=>!(e.origin===Yi.Origin.WEB_RTC&&e.dataChannelId!==t)))}get bufferFillingRate(){var t=this;const e=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return t.oldBfr!==e&&(t.settings.bfrZero?t.logger.trace(Ut.reportBufferFillingRate(e,t.reporter.toUpperCase(),t.forceZero)):t.logger.trace(Ut.reportBufferFillingRate(e,n.toUpperCase(),!1))),t.oldBfr=e};if(this.forceZero&&this.settings.bfrZero)return e(0);if(this.settings.bfrCompletion?(this.hasValidContentsByOrigin(Yi.Origin.HTTP)&&(this.stats.bfrHttp=this.computeBfrByOriginOnRequests(Yi.Origin.HTTP)),this.hasValidContentsByOrigin(Yi.Origin.WEB_RTC)&&(this.stats.bfrWebRTC=this.computeBfrByOriginOnRequests(Yi.Origin.WEB_RTC))):(this.stats.bfrHttp=this.computeBfrByOriginOnThroughput(Yi.Origin.HTTP),this.stats.bfrWebRTC=this.computeBfrByOriginOnThroughput(Yi.Origin.WEB_RTC)),this.settings.bfrZero)switch(this.reporter){case"zero":return e(0);case"http":return e(this.stats.bfrHttp);case"webrtc":return e(this.stats.bfrWebRTC)}else switch(this.stats.source){case"http":return e(this.stats.bfrHttp,this.stats.source);case"webrtc":return e(this.stats.bfrWebRTC,this.stats.source)}}get bfrHttp(){return this.stats.bfrHttp}get bfrWebRTC(){return this.stats.bfrWebRTC}get source(){return this.stats.source}get throughputHttp(){return this.stats.throughputHttp}get throughputWebRTC(){return this.stats.throughputWebRTC}get contents(){return this.stats.contents}get downSpeed(){return this.hasValidContents&&(this.stats.downSpeed=this.computeDownSpeed()),this.stats.downSpeed}handlePolyNetModeChangeEvent(t){const e=t.newMode;this.forceZero=e===jn.Modes.REPAIRING}handleDataChannelEvent(t){const e=t.dataChannel;if(e.isInbound)if(e.isHttp)this.reporter="http";else{if(!e.isWebRTC||!e.isClosed)return e.isWebRTC&&e.isConnecting?(this.cleanP2P(e.identifier),this.reporter="zero",void(this.settings.bfrZero&&(this.stats.bfrWebRTC=0,this.logger.trace(Ut.clearBufferFillingRate(this.stats.bfrWebRTC,this.reporter.toUpperCase()))))):void(e.isWebRTC&&e.isConnected&&(this.reporter="webrtc"));this.reporter="http"}}handleContentCacheEvent(t){const e=t.contentCache;if(ot.isNil(e.id)||ot.isNil(e.origin))return;let n=ot.find(this.stats.contents,{id:e.id});if(ot.isNil(n)&&(n={id:e.id,dataChannelId:e.dataChannelId,isCacheable:e.isCacheable,isFinished:e.isFinished,hasError:e.hasError,contentLength:0,contentResponseTime:null,duration:0,loaded:0,origin:e.origin,representationId:e.representationId,timeFirst:void 0,timeRequest:void 0,timeResponse:void 0,retries:0,originalCache:void 0},this.stats.contents.push(n)),e.isCacheable&&(this.settings.bfrCompletion?e.isFinished&&(this.stats.source=e.isResourceFromCdn?"http":"webrtc"):this.stats.source=e.isResourceFromCdn?"http":"webrtc"),this.sumDeltaDownload(e,n),n.origin=e.origin,n.isCacheable=e.isCacheable,n.duration=e.duration,n.timeRequest=e.timeRequest,n.timeResponse=e.timeResponse,n.timeFirst=e.timeFirst,n.contentLength=e.contentLength,n.loaded=e.loaded||0,n.isFinished=e.isFinished,n.hasError=e.hasError,n.retries=e.retries,n.originalCache=e,e.isCacheable&&e.isFinished){const t=this.stats.contents.filter((t=>t.isCacheable)).map((t=>`${`${t.id}`}:${`${t.origin}`}:finished?${`${Zi(t)}`}`));this.logger.trace(`Current content stats: [ ${t.join(" , ")} ]`)}}get completedCacheableContents(){return this.stats.contents.filter((t=>Qi(t)&&Ji(t)))}completedCacheableContentsByOrigin(t){return this.stats.contents.filter((e=>Qi(e)&&Ji(e)&&function(t,e){return t.origin===e}(e,t)))}get hasValidContents(){return!ot.isEmpty(this.completedCacheableContents.filter(ts))}hasValidContentsByOrigin(t){return!ot.isEmpty(this.completedCacheableContentsByOrigin(t).filter(ts))}get minTimeFirst(){return this.completedCacheableContents.reduce(((t,e)=>Math.min(t,e.timeFirst)),Number.POSITIVE_INFINITY)}get maxTimeResponse(){return this.completedCacheableContents.reduce(((t,e)=>Math.max(t,e.timeResponse)),Number.NEGATIVE_INFINITY)}computeBfrByOriginOnRequests(t){const e=this.settings.defaultContentDuration,n=t===Yi.Origin.HTTP?this.stats.bfrHttp:this.stats.bfrWebRTC,r=[],i=t=>t.duration||e,s=this.completedCacheableContents.map((e=>(t===Yi.Origin.HTTP?e.origin===Yi.Origin.WEB_RTC&&e.retries>0&&(e.origin=Yi.Origin.HTTP):t===Yi.Origin.WEB_RTC&&e.origin===Yi.Origin.WEB_RTC&&e.retries>0&&(e.contentLength=e.originalCache.discardedData,e.timeRequest=e.originalCache.discardedTime),e))).filter((e=>e.origin===t&&e.contentLength>0&&i(e))).map((t=>(r.push(Ut.logContentStatsForBfr(t)),t))).map((t=>i(t)/1e3)).reduce(((t,e)=>t+e),0),o=this.maxTimeResponse,a=this.minTimeFirst,c=(o-a)/1e3,u=s/c;return u!==n&&this.logger.trace(Ut.updateBufferFillingRateCalculationOnRequests(u,n,t,s,c,a,o,r)),u}computeBfrByOriginOnThroughput(t){const e=t===Yi.Origin.HTTP?this.stats.bfrHttp:this.stats.bfrWebRTC,n=t===Yi.Origin.HTTP?"http":"webrtc",r=this.downloadCounters.getLastStatsFromSource(n);if(ot.isNil(r)||ot.isEmpty(r))return e;const i=this.isBfrOutlier(n,r[0].nloaded,r[0].tdelta,{nloaded:this.settings.bfrOutlierFilter.nloaded,tdelta:this.settings.bfrOutlierFilter.tdelta}),{bfr:s,actualBitrate:o,bitrate:a,tdelta:c,nloaded:u}=this.computeBfrFromStats(r,i);return!ot.isFinite(s)||s<=0?e:(this.logger.trace(Ut.updateBufferFillingRateCalculationOnThroughput(s,e,t,o,a,u,c)),s)}computeDownSpeed(){const t=this.completedCacheableContents.map((t=>.008*t.loaded)).reduce(((t,e)=>t+e),0),e=.001*(this.maxTimeResponse-this.minTimeFirst);return e<=0?this.stats.downSpeed:this.stats.downSpeed=t/e}computeBfrFromStats(t,e){let n,r,i,s,o;if(this.settings.bfrOutlierFilter.enabled)if(e){if(t.length<2)return{};s=t.reduce(((t,e)=>{let{tdelta:n}=e;return t+n}),0),o=t.reduce(((t,e)=>{let{nloaded:n}=e;return t+n}),0)}else this.settings.bfrOutlierFilter.forceMerge?(s=t.reduce(((t,e)=>{let{tdelta:n}=e;return t+n}),0),o=t.reduce(((t,e)=>{let{nloaded:n}=e;return t+n}),0)):({tdelta:s,nloaded:o}=t[0]);else({tdelta:s,nloaded:o}=t[0]);return i=t[0].bitrate,r=8*o/(.001*s),n=r/i,{bfr:n,actualBitrate:r,bitrate:i,tdelta:s,nloaded:o}}isBfrOutlier(t,e,n,r){return!("http"===t||!e||!n)&&(n<r.tdelta||e<r.nloaded)}sumDeltaDownload(t,e){if(function(t){return/\.mpd|\.m3u/.test(t)}(t.url))return;const n=t.loaded||0,r=n>e.loaded?n-e.loaded:0;if(t.isCacheable){const e=t.isResourceFromCdn?"http":"webrtc";this.downloadCounters.addLoadedBytes(e,t.bitrate,r)}t.isResourceFromCdn&&(this.stats.throughputHttp+=r),t.isResourceFromP2P&&(this.stats.throughputWebRTC+=r)}});var ns=__webpack_require__(5121),rs=__webpack_require__.n(ns);class is extends(rs()){constructor(t){super(),this.htmlVideoElement=t,this.handleVideoElementEvents()}get currentTime(){return this.htmlVideoElement.currentTime}matchVideoElement(t){return this.htmlVideoElement===t}get currentBufferEnd(){const t=this.currentTime,e=this.htmlVideoElement.buffered;for(let n=0,r=e.length;n<r;n++){const r=e.start(n),i=e.end(n);if(r<=t&&t<i)return i}}get isPlaying(){return this.htmlVideoElement.currentTime>0&&!this.htmlVideoElement.paused&&!this.htmlVideoElement.ended&&this.htmlVideoElement.readyState>2}get isPaused(){return this.htmlVideoElement.currentTime>0&&this.htmlVideoElement.paused&&!this.htmlVideoElement.ended&&this.htmlVideoElement.readyState>2}get isSeeking(){return this.htmlVideoElement.seeking}get hasMetadata(){return this.htmlVideoElement.readyState>=1}get droppedFrames(){if(ot.isFunction(this.htmlVideoElement.getVideoPlaybackQuality))return this.htmlVideoElement.getVideoPlaybackQuality().droppedVideoFrames;const t="webkitDroppedFrameCount";return t in this.htmlVideoElement?this.htmlVideoElement[t]:0}get bufferHealthAfterGap(){const t=this.htmlVideoElement.buffered,e=this.htmlVideoElement.currentTime;let n=0;for(let r=0;r<t.length;r++)ot.isFinite(t.end(r))&&e<t.start(r)&&(n+=t.end(r)-t.start(r));return n}get bufferHealth(){const t=this.currentTime,e=this.currentBufferEnd;if(ot.isNil(e)||!ot.isFinite(e)||ot.isNil(t)||!ot.isFinite(t))return 0;if(t>e)return 0;return 1e3*(e-t+this.bufferHealthAfterGap)}getGapsInfo(){const t=this.htmlVideoElement;if(!t)return;const e=t.currentTime,n=t.buffered;let r=[];for(let t=0,i=n.length;t<i;t++)if(n.start(t)<=e&&e<n.end(t))r.push(`[${e} - ${n.end(t)}]`);else if(e<n.end(t)){const i=t>0?n.end(t-1):e;r.push(`[gap ${n.start(t)-i}]`),r.push(`[${n.start(t)} - ${n.end(t)}]`)}return 0!==r.length?r.join(" "):void 0}get viewport(){return{height:ot.isFinite(this.htmlVideoElement.clientHeight)?this.htmlVideoElement.clientHeight:void 0,width:ot.isFinite(this.htmlVideoElement.clientWidth)?this.htmlVideoElement.clientWidth:void 0}}get resolution(){const t=this.htmlVideoElement.videoHeight,e=this.htmlVideoElement.videoWidth;return{height:ot.isFinite(t)&&t>0?t:void 0,width:ot.isFinite(e)&&e>0?e:void 0}}handleVideoElementEvents(){this.unknownEmitter=()=>this.emit("state","unknown"),this.pauseEmitter=()=>this.isPaused&&this.emit("state","pause"),this.playListener=()=>!this.hasMetadata&&this.emit("state","starting"),this.playingListener=()=>this.emit("state","playing"),this.progressListener=()=>this.isPlaying&&!this.isSeeking&&this.emit("state","playing"),this.waitingListener=()=>this.hasMetadata&&this.emit("state","buffering"),this.htmlVideoElement.addEventListener("ended",this.unknownEmitter),this.htmlVideoElement.addEventListener("error",this.unknownEmitter),this.htmlVideoElement.addEventListener("pause",this.pauseEmitter),this.htmlVideoElement.addEventListener("play",this.playListener),this.htmlVideoElement.addEventListener("playing",this.playingListener),this.htmlVideoElement.addEventListener("progress",this.progressListener),this.htmlVideoElement.addEventListener("seeked",this.pauseEmitter),this.htmlVideoElement.addEventListener("waiting",this.waitingListener)}removeAllListeners(t){return super.removeAllListeners(t),this.htmlVideoElement.removeEventListener("ended",this.unknownEmitter),this.htmlVideoElement.removeEventListener("error",this.unknownEmitter),this.htmlVideoElement.removeEventListener("loadstart",this.unknownEmitter),this.htmlVideoElement.removeEventListener("pause",this.pauseEmitter),this.htmlVideoElement.removeEventListener("play",this.playListener),this.htmlVideoElement.removeEventListener("playing",this.playingListener),this.htmlVideoElement.removeEventListener("progress",this.progressListener),this.htmlVideoElement.removeEventListener("seeked",this.pauseEmitter),this.htmlVideoElement.removeEventListener("waiting",this.waitingListener),this.unknownEmitter=void 0,this.pauseEmitter=void 0,this.playListener=void 0,this.playingListener=void 0,this.progressListener=void 0,this.waitingListener=void 0,this}}class ss{constructor(){this.times=new Map,this.reset()}reset(){this._state="unknown",this.lastStateTime=performance.now(),this.times.clear()}get state(){return this._state}set state(t){this._state!==t&&(this.times.set(this._state,this.getStateTime(this._state)),this._state=t,this.lastStateTime=performance.now())}get canWarmStart(){return"unknown"===this._state&&!this.startingTime}warmStart(){this.canWarmStart&&(this.times.set("starting",this.getStateTime("unknown")),this.state="playing")}get startingTime(){return this.getStateTime("starting")}get seekingTime(){return this.getStateTime("seeking")}get bufferingTime(){return this.getStateTime("buffering")}get playingTime(){return this.getStateTime("playing")}get pauseTime(){return this.getStateTime("pause")}getStateTime(t){var e;const n=null!==(e=this.times.get(t))&&void 0!==e?e:0,r=performance.now()-this.lastStateTime;return Math.round(this._state===t?n+r:n)}}const os=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("PlaybackStats"),this.eventBus=Ct(this.context).getInstance(),this.playerStateTimes=new ss,this.startTime=performance.now(),this.currentDroppedFrames=0,this.stats={bufferHealth:void 0,bufferingEvents:0,bufferingTime:void 0,droppedFrames:void 0,gapsInfo:void 0,pauseTime:void 0,playingTime:void 0,resolution:{height:void 0,width:void 0},seekingTime:void 0,startingTime:void 0,state:void 0,timeToFirstFrame:void 0,viewport:{height:void 0,width:void 0}}}start(){this.eventBus.on($t.COLLECT_VIDEO_STATS,this.handleCollectStatsEvent,{scope:this})}destroy(){var t;null===(t=this._videoElement)||void 0===t||t.removeAllListeners(),this._videoElement=null}reset(){this.playerStateTimes.reset(),this.stats.bufferingEvents=0}get videoElement(){return ot.isNil(this._videoElement)?(this.checkForVideoElement(),this._videoElement):this._videoElement}get bufferHealth(){return this.videoElement?this.videoElement.bufferHealth:0}get gapsInfo(){if(this.videoElement)return this.videoElement.getGapsInfo()}get droppedFrames(){var t;const e=null===(t=this.videoElement)||void 0===t?void 0:t.droppedFrames;if(ot.isNil(e))return 0;e<this.currentDroppedFrames&&(this.currentDroppedFrames=e);const n=e-this.currentDroppedFrames;return this.currentDroppedFrames=e,n}get resolution(){var t;const e=null===(t=this.videoElement)||void 0===t?void 0:t.resolution;return ot.isNil(e)?{height:void 0,width:void 0}:e}get state(){return this.playerStateTimes.state}get timeToFirstFrame(){return this.stats.timeToFirstFrame}get bufferingEvents(){return this.stats.bufferingEvents}get viewport(){var t;const e=null===(t=this.videoElement)||void 0===t?void 0:t.viewport;return ot.isNil(e)?{height:void 0,width:void 0}:e}get startingTime(){return this.playerStateTimes.startingTime}get seekingTime(){return this.playerStateTimes.seekingTime}get bufferingTime(){return this.playerStateTimes.bufferingTime}get playingTime(){return this.playerStateTimes.playingTime}get pauseTime(){return this.playerStateTimes.pauseTime}handleVideoEvents(){const t=t=>{"playing"===t&&ot.isNil(this.stats.timeToFirstFrame)&&(this.stats.timeToFirstFrame=performance.now()-this.startTime),"playing"===t&&this.playerStateTimes.canWarmStart&&this.playerStateTimes.warmStart(),"buffering"===t&&this.stats.bufferingEvents++,this.playerStateTimes.state=t};this.videoElement.isPlaying&&t("playing"),this.videoElement.on("state",t)}handleCollectStatsEvent(t){const{videoElementReader:e}=t;this.videoElementReader=e,this.checkForVideoElement()}checkForVideoElement(){const t=ot.isNil(this.videoElementReader)?void 0:this.videoElementReader();if(!(ot.isNil(t)||this._videoElement&&this._videoElement.matchVideoElement(t))){try{this._videoElement=new is(t),this.logger.trace("Registered new video player element")}catch(t){return void this.logger.error(`Setting up an incorrect HTMLVideoElement, error: ${t}`)}this.handleVideoEvents()}}});class as extends Tt{constructor(){super(),this.started=!1,this.initTime=performance.now(),this.polyNetStats=Sr(this.context).getInstance(),this.platformStats=zn(this.context).getInstance(),this.natStats=mr(this.context).getInstance(),this.networkStats=vr(this.context).getInstance(),this.streamingStats=_r(this.context).getInstance(),this.dataChannelStats=Tr(this.context).getInstance(),this.contentSteeringStats=Nr(this.context).getInstance(),this.mssStats=Or(this.context).getInstance(),this.contentStats=es(this.context).getInstance(),this.playbackStats=os(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.start()}start(){this.started||(this.started=!0,this.polyNetStats.start(),this.platformStats.start(),this.natStats.start(),this.networkStats.start(),this.streamingStats.start(),this.dataChannelStats.start(),this.contentSteeringStats.start(),this.mssStats.start(),this.contentStats.start(),this.playbackStats.start(),this.eventBus.on($t.REPRESENTATION_CHANGE,this.handleRepresentationChange,{scope:this}))}destroy(){var t,e,n,r,i,s;null===(t=this.platformStats)||void 0===t||t.destroy(),null===(e=this.natStats)||void 0===e||e.destroy(),null===(n=this.streamingStats)||void 0===n||n.destroy(),null===(r=this.dataChannelStats)||void 0===r||r.destroy(),null===(i=this.contentStats)||void 0===i||i.destroy(),null===(s=this.playbackStats)||void 0===s||s.destroy(),this.platformStats=null,this.natStats=null,this.streamingStats=null,this.dataChannelStats=null,this.contentSteeringStats=null,this.mssStats=null,this.contentStats=null,this.playbackStats=null}clean(){this.polyNetStats.clean(),this.networkStats.clean(),this.dataChannelStats.clean(),this.contentStats.clean()}reset(){this.playbackStats.reset()}get aliveTime(){return Math.round(performance.now()-this.initTime)}get polyNet(){return this.polyNetStats}get platform(){return this.platformStats}get stream(){return this.streamingStats}get network(){return this.networkStats}get nat(){return this.natStats}get datachannel(){return this.dataChannelStats}get contentSteering(){return this.contentSteeringStats}get mss(){return this.mssStats}get content(){return this.contentStats}get playback(){return this.playbackStats}handleRepresentationChange(t){const{sameStreamUri:e}=t;e||this.reset()}}as.polyNetFactoryName="Stats";const cs=Et.getSingletonFactory(as);var us,ls,hs;!function(t){t.TIMEOUT="TIMEOUT",t.INTERVAL="INTERVAL"}(us||(us={}));class ds{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:us.TIMEOUT;this.id=t,this.period=e,this.type=n}get timerInfo(){return{id:this.id,period:this.period,type:this.type}}get observable(){switch(this.type){case us.INTERVAL:return this.interval();case us.TIMEOUT:return this.timeout()}}timeout(){return new pi((t=>{const e=setTimeout((()=>{t.next({id:this.id,counter:0}),t.complete()}),this.period);return()=>clearTimeout(e)}))}interval(){return new pi((t=>{let e=0;const n=()=>{t.next({id:this.id,counter:e}),e=(e+1)%Number.MAX_SAFE_INTEGER,r=setTimeout(n,this.period)};let r=setTimeout((()=>{n()}),this.period);return()=>clearTimeout(r)}))}}class ps{constructor(){}createTimer(t,e,n){return new ds(t,e,n).observable}createTimeout(t,e){return this.createTimer(t,e,us.TIMEOUT)}createInterval(t,e){return this.createTimer(t,e,us.INTERVAL)}}!function(t){t.START="START",t.STOP="STOP",t.DESTROY="DESTROY"}(ls||(ls={})),function(t){t.FIRED="FIRED",t.COMPLETED="COMPLETED",t.REMOVED="REMOVED",t.ERROR="ERROR"}(hs||(hs={}));var fs=__webpack_require__(5512),gs=__webpack_require__.n(fs);function ys(){return gs()('/*!\n * 638.66407897e6277d46b21b.worker.js - 4.8.13\n * <www.system73.com>\n *\n * Copyright (C) System73 Europe, SL - All Rights Reserved\n * Unauthorized copying of this file, via any medium is strictly prohibited\n * Proprietary and confidential\n * 2016 - 2025\n */(()=>{"use strict";var t,r;!function(t){t.START="START",t.STOP="STOP",t.DESTROY="DESTROY"}(t||(t={})),function(t){t.FIRED="FIRED",t.COMPLETED="COMPLETED",t.REMOVED="REMOVED",t.ERROR="ERROR"}(r||(r={}));var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])},e(t,r)};function n(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}Object.create;function o(t){var r="function"==typeof Symbol&&Symbol.iterator,e=r&&t[r],n=0;if(e)return e.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(r?"Object is not iterable.":"Symbol.iterator is not defined.")}function i(t,r){var e="function"==typeof Symbol&&t[Symbol.iterator];if(!e)return t;var n,o,i=e.call(t),s=[];try{for(;(void 0===r||r-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(e=i.return)&&e.call(i)}finally{if(o)throw o.error}}return s}function s(t,r,e){if(e||2===arguments.length)for(var n,o=0,i=r.length;o<i;o++)!n&&o in r||(n||(n=Array.prototype.slice.call(r,0,o)),n[o]=r[o]);return t.concat(n||Array.prototype.slice.call(r))}Object.create;function u(t){return"function"==typeof t}var c,a=((c=function(t){return function(r){t(this),this.message=r?r.length+" errors occurred during unsubscription:\\n"+r.map((function(t,r){return r+1+") "+t.toString()})).join("\\n  "):"",this.name="UnsubscriptionError",this.errors=r}}((function(t){Error.call(t),t.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),c.prototype.constructor=c,c);function l(t,r){if(t){var e=t.indexOf(r);0<=e&&t.splice(e,1)}}var p=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var r;return t.prototype.unsubscribe=function(){var t,r,e,n,c;if(!this.closed){this.closed=!0;var l=this._parentage;if(l)if(this._parentage=null,Array.isArray(l))try{for(var p=o(l),f=p.next();!f.done;f=p.next()){f.value.remove(this)}}catch(r){t={error:r}}finally{try{f&&!f.done&&(r=p.return)&&r.call(p)}finally{if(t)throw t.error}}else l.remove(this);var d=this.initialTeardown;if(u(d))try{d()}catch(t){c=t instanceof a?t.errors:[t]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=o(v),b=y.next();!b.done;b=y.next()){var m=b.value;try{h(m)}catch(t){c=null!=c?c:[],t instanceof a?c=s(s([],i(c)),i(t.errors)):c.push(t)}}}catch(t){e={error:t}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(e)throw e.error}}}if(c)throw new a(c)}},t.prototype.add=function(r){var e;if(r&&r!==this)if(this.closed)h(r);else{if(r instanceof t){if(r.closed||r._hasParent(this))return;r._addParent(this)}(this._finalizers=null!==(e=this._finalizers)&&void 0!==e?e:[]).push(r)}},t.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},t.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},t.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&l(r,t)},t.prototype.remove=function(r){var e=this._finalizers;e&&l(e,r),r instanceof t&&r._removeParent(this)},t.EMPTY=((r=new t).closed=!0,r),t}();p.EMPTY;function f(t){return t instanceof p||t&&"closed"in t&&u(t.remove)&&u(t.add)&&u(t.unsubscribe)}function h(t){u(t)?t():t.unsubscribe()}var d={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},v={setTimeout:function(t,r){for(var e=[],n=2;n<arguments.length;n++)e[n-2]=arguments[n];var o=v.delegate;return(null==o?void 0:o.setTimeout)?o.setTimeout.apply(o,s([t,r],i(e))):setTimeout.apply(void 0,s([t,r],i(e)))},clearTimeout:function(t){var r=v.delegate;return((null==r?void 0:r.clearTimeout)||clearTimeout)(t)},delegate:void 0};function y(){}var b=m("C",void 0,void 0);function m(t,r,e){return{kind:t,value:r,error:e}}var T=null;var E=function(t){function r(r){var e=t.call(this)||this;return e.isStopped=!1,r?(e.destination=r,f(r)&&r.add(e)):e.destination=R,e}return n(r,t),r.create=function(t,r,e){return new S(t,r,e)},r.prototype.next=function(t){this.isStopped?x(function(t){return m("N",t,void 0)}(t),this):this._next(t)},r.prototype.error=function(t){this.isStopped?x(m("E",void 0,t),this):(this.isStopped=!0,this._error(t))},r.prototype.complete=function(){this.isStopped?x(b,this):(this.isStopped=!0,this._complete())},r.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},r.prototype._next=function(t){this.destination.next(t)},r.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},r.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},r}(p),_=Function.prototype.bind;function w(t,r){return _.call(t,r)}var g=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(t){O(t)}},t.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(t){O(t)}else O(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){O(t)}},t}(),S=function(t){function r(r,e,n){var o,i,s=t.call(this)||this;u(r)||!r?o={next:null!=r?r:void 0,error:null!=e?e:void 0,complete:null!=n?n:void 0}:s&&d.useDeprecatedNextContext?((i=Object.create(r)).unsubscribe=function(){return s.unsubscribe()},o={next:r.next&&w(r.next,i),error:r.error&&w(r.error,i),complete:r.complete&&w(r.complete,i)}):o=r;return s.destination=new g(o),s}return n(r,t),r}(E);function O(t){var r;d.useDeprecatedSynchronousErrorHandling?(r=t,d.useDeprecatedSynchronousErrorHandling&&T&&(T.errorThrown=!0,T.error=r)):function(t){v.setTimeout((function(){var r=d.onUnhandledError;if(!r)throw t;r(t)}))}(t)}function x(t,r){var e=d.onStoppedNotification;e&&v.setTimeout((function(){return e(t,r)}))}var R={closed:!0,next:y,error:function(t){throw t},complete:y},P="function"==typeof Symbol&&Symbol.observable||"@@observable";function A(t){return t}function D(t){return 0===t.length?A:1===t.length?t[0]:function(r){return t.reduce((function(t,r){return r(t)}),r)}}var M,I=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(r){var e=new t;return e.source=this,e.operator=r,e},t.prototype.subscribe=function(t,r,e){var n,o=this,i=(n=t)&&n instanceof E||function(t){return t&&u(t.next)&&u(t.error)&&u(t.complete)}(n)&&f(n)?t:new S(t,r,e);return function(t){if(d.useDeprecatedSynchronousErrorHandling){var r=!T;if(r&&(T={errorThrown:!1,error:null}),t(),r){var e=T,n=e.errorThrown,o=e.error;if(T=null,n)throw o}}else t()}((function(){var t=o,r=t.operator,e=t.source;i.add(r?r.call(i,e):e?o._subscribe(i):o._trySubscribe(i))})),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},t.prototype.forEach=function(t,r){var e=this;return new(r=k(r))((function(r,n){var o=new S({next:function(r){try{t(r)}catch(t){n(t),o.unsubscribe()}},error:n,complete:r});e.subscribe(o)}))},t.prototype._subscribe=function(t){var r;return null===(r=this.source)||void 0===r?void 0:r.subscribe(t)},t.prototype[P]=function(){return this},t.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return D(t)(this)},t.prototype.toPromise=function(t){var r=this;return new(t=k(t))((function(t,e){var n;r.subscribe((function(t){return n=t}),(function(t){return e(t)}),(function(){return t(n)}))}))},t.create=function(r){return new t(r)},t}();function k(t){var r;return null!==(r=null!=t?t:d.Promise)&&void 0!==r?r:Promise}!function(t){t.TIMEOUT="TIMEOUT",t.INTERVAL="INTERVAL"}(M||(M={}));class C{constructor(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:M.TIMEOUT;this.id=t,this.period=r,this.type=e}get timerInfo(){return{id:this.id,period:this.period,type:this.type}}get observable(){switch(this.type){case M.INTERVAL:return this.interval();case M.TIMEOUT:return this.timeout()}}timeout(){return new I((t=>{const r=setTimeout((()=>{t.next({id:this.id,counter:0}),t.complete()}),this.period);return()=>clearTimeout(r)}))}interval(){return new I((t=>{let r=0;const e=()=>{t.next({id:this.id,counter:r}),r=(r+1)%Number.MAX_SAFE_INTEGER,n=setTimeout(e,this.period)};let n=setTimeout((()=>{e()}),this.period);return()=>clearTimeout(n)}))}}class N{constructor(t){this.store=new Map,this.workerEnv=t,this.workerEnv.onmessage=t=>this.handleMessages(t)}sendFired(t,e,n){this.workerEnv.postMessage({command:r.FIRED,counter:e,id:t,period:n})}sendCompleted(t){this.workerEnv.postMessage({command:r.COMPLETED,id:t})}handleMessages(r){let e;if(!r.data)return;const{id:n,period:o,type:i,command:s}=r.data;let u;switch(s){case t.START:u=new C(n,o,i),e=u.observable.subscribe({complete:()=>{this.store.delete(n),this.sendCompleted(n)},next:t=>{this.sendFired(u.id,t.counter,u.period)}}),this.store.set(n,e);break;case t.STOP:e=this.store.get(n),e&&(this.sendCompleted(n),e.unsubscribe(),this.store.delete(n));break;case t.DESTROY:for(const t of this.store.values())t.unsubscribe();this.store.clear(),this.workerEnv.close()}}static createTimer(t){return new N(t)}}N.createTimer(self)})();',"Worker",void 0,__webpack_require__.p+"638.66407897e6277d46b21b.worker.js")}class ms{constructor(){try{this.firingHandlers=new Map,this.worker=new ys,this.worker.onmessage=t=>this.handleWorkerMessage(t)}catch(t){throw new at("Unable to start the webworker for timers",at.Codes.WEB_WORKER_ERROR)}}createTimer(t,e,n){if(!this.worker)throw new at("Unable to user webworker for timers",at.Codes.WEB_WORKER_ERROR);const r=new pi((e=>(this.firingHandlers.set(t,{observer:e,firingTime:(new Date).getTime()}),()=>{this.worker.postMessage({id:t,command:ls.STOP})})));return this.worker.postMessage({id:t,command:ls.START,period:e,type:n}),r}createTimeout(t,e){return this.createTimer(t,e,us.TIMEOUT)}createInterval(t,e){return this.createTimer(t,e,us.INTERVAL)}clear(){this.worker&&this.worker.postMessage({command:ls.DESTROY})}handleWorkerMessage(t){if(!t.data)return;const{command:e,id:n,counter:r,period:i}=t.data,s=this.firingHandlers.get(n);if(!s)return;const{observer:o,firingTime:a}=s;if(!o)return;let c;switch(e){case hs.FIRED:c=(new Date).getTime(),a?c-a>=.9*i&&o.next({id:n,counter:r}):o.next({id:n,counter:r}),s.firingTime=c;break;case hs.COMPLETED:this.firingHandlers.delete(n),o.complete()}}}class bs extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("TimerService"),this.startWorker(),this.timerNativeCollection=new ps,this.counter=0,this.store=new Map}destroy(){this.store.clear(),this.logger=null,this.timerWorkerCollection&&this.timerWorkerCollection.clear()}createTimeout(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.createTimer(t,e,n,us.TIMEOUT)}createInterval(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return this.createTimer(t,e,n,us.INTERVAL)}createTimer(t,e,n,r){if("number"!=typeof e||e<0)throw new at(`Timer - Invalid period: ${e}`);const i=`${this.counter}`;let s;return this.counter=(this.counter+1)%Number.MAX_SAFE_INTEGER,s=n?this.createWorkerizedTimer(t,i,e,r):this.createNativeTimer(t,i,e,r),new pi((t=>{const e=this.store,n=s.subscribe({complete:()=>{e.delete(i),t.complete()},next:e=>{t.next(e)}});return()=>{n.unsubscribe(),this.store.delete(i)}}))}startWorker(){try{this.timerWorkerCollection=new ms}catch(t){t instanceof at&&this.logger.trace("Unable to start the webworker, falling to native timers")}}createNativeTimer(t,e,n,r){const i=this.timerNativeCollection.createTimer(e,n,r);return this.store.set(e,{name:t,worker:!1,id:e,period:n,type:r}),i}createWorkerizedTimer(t,e,n,r){if(!this.timerWorkerCollection)return this.createNativeTimer(t,e,n,r);try{const i=this.timerWorkerCollection.createTimer(e,n,r);return this.store.set(e,{name:t,worker:!0,id:e,period:n,type:r}),i}catch(i){return this.createNativeTimer(t,e,n,r)}}}bs.polyNetFactoryName="TimerService";const vs=Et.getSingletonFactory(bs);class ws extends Tt{constructor(){super(),this.timerService=vs(this.context).getInstance()}setTimeout(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=this.timerService.createTimeout(t,e,r);this.subscription=i.subscribe({next:()=>{n()}})}setInterval(t,e,n){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=this.timerService.createInterval(t,e,r);this.subscription=i.subscribe({next:()=>{n()}})}cancel(){this.subscription&&this.subscription.unsubscribe()}get isRunning(){return this.subscription&&!this.subscription.closed}}ws.polyNetFactoryName="Timer";const Ss=Et.getInstanceFactory(ws);class Es extends Tt{constructor(){super(),this.logger=null,this.eventBus=null,this.settings=null,this.responseTimeout=null,this.logger=xt(this.context).getInstance().getLogger("ResponseTimer"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.responseTimeout=Ss(this.context).createInstance()}schedule(t){const e=this.settings.trackerResponseTimeoutPeriod;ot.isNil(e)||e<=0||(this.cancel(),this.responseTimeout.setTimeout(Es.polyNetFactoryName,e,(()=>{this.logger.warn(`Triggered timeout for tracker response due to the request took more than ${e} ms`),this.eventBus.emit($t.COUNTERMEASURE_TRACKER_RESPONSE_TIMEOUT,{target:this,request:t})})))}cancel(){this.responseTimeout.cancel()}destroy(){this.eventBus&&this.eventBus.offAll({scope:this}),this.cancel(),this.logger=null,this.eventBus=null,this.settings=null,this.responseTimeout=null}}Es.polyNetFactoryName="ResponseTimer";const _s=Et.getSingletonFactory(Es);var Cs;!function(t){let e,n;!function(t){t.HANDSHAKE_REQUEST="polynet_handshake_request",t.HANDSHAKE_RESPONSE="polynet_handshake_response",t.CHANGE_SETTINGS_INSTRUCTION="polynet_change_settings_instruction",t.JOIN_REQUEST="polynet_join_request",t.JOIN_RESPONSE="polynet_join_response",t.MOVE_INSTRUCTION="polynet_move_instruction",t.PEER_TO_PEER="p2p"}(e=t.MessageType||(t.MessageType={})),function(t){t[t.HANDSHAKE_RESPONSE_NOT_SUPPORTED=401]="HANDSHAKE_RESPONSE_NOT_SUPPORTED",t[t.HANDSHAKE_RESPONSE_OK=201]="HANDSHAKE_RESPONSE_OK",t[t.JOIN_RESPONSE_OK=200]="JOIN_RESPONSE_OK",t[t.DATA_CHANNEL_NOT_AVAILABLE=503]="DATA_CHANNEL_NOT_AVAILABLE"}(n=t.StatusCode||(t.StatusCode={}))}(Cs||(Cs={}));var Ts=__webpack_require__(3616);const Is=Ts.Reader,Ns=Ts.Writer,Rs=Ts.util,Os=Ts.roots.default||(Ts.roots.default={}),As=Os.system73=(()=>{const t={};return t.protocol=function(){const t={};return t.p2p=function(){const t={};return t.ContentRequest=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.contentId="",t.prototype.duration=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(10).string(t.contentId),null!=t.duration&&Object.hasOwnProperty.call(t,"duration")&&e.uint32(16).uint32(t.duration),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.ContentRequest;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.contentId=t.string();break;case 2:r.duration=t.uint32();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("contentId"))throw Rs.ProtocolError("missing required 'contentId'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.ContentRequest"},t}(),t.ContentAborted=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.contentId="",t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(10).string(t.contentId),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.ContentAborted;t.pos<n;){var i=t.uint32();if(i>>>3==1)r.contentId=t.string();else t.skipType(7&i)}if(!r.hasOwnProperty("contentId"))throw Rs.ProtocolError("missing required 'contentId'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.ContentAborted"},t}(),t.ContentResponseStart=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.contentId="",t.prototype.contentLength=0,t.prototype.chunksAmount=0,t.prototype.duration=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(10).string(t.contentId),null!=t.contentLength&&Object.hasOwnProperty.call(t,"contentLength")&&e.uint32(16).uint32(t.contentLength),null!=t.chunksAmount&&Object.hasOwnProperty.call(t,"chunksAmount")&&e.uint32(24).uint32(t.chunksAmount),null!=t.duration&&Object.hasOwnProperty.call(t,"duration")&&e.uint32(32).uint32(t.duration),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.ContentResponseStart;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.contentId=t.string();break;case 2:r.contentLength=t.uint32();break;case 3:r.chunksAmount=t.uint32();break;case 4:r.duration=t.uint32();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("contentId"))throw Rs.ProtocolError("missing required 'contentId'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.ContentResponseStart"},t}(),t.ContentResponseProgress=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.contentId="",t.prototype.chunkId=0,t.prototype.chunkData=Rs.newBuffer([]),t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(10).string(t.contentId),e.uint32(16).uint32(t.chunkId),e.uint32(26).bytes(t.chunkData),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.ContentResponseProgress;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.contentId=t.string();break;case 2:r.chunkId=t.uint32();break;case 3:r.chunkData=t.bytes();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("contentId"))throw Rs.ProtocolError("missing required 'contentId'",{instance:r});if(!r.hasOwnProperty("chunkId"))throw Rs.ProtocolError("missing required 'chunkId'",{instance:r});if(!r.hasOwnProperty("chunkData"))throw Rs.ProtocolError("missing required 'chunkData'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.ContentResponseProgress"},t}(),t.ContentResponseEnd=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.contentId="",t.prototype.contentLength=0,t.prototype.chunksAmount=0,t.prototype.crc32=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(10).string(t.contentId),e.uint32(16).uint32(t.contentLength),e.uint32(24).uint32(t.chunksAmount),e.uint32(32).uint32(t.crc32),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.ContentResponseEnd;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.contentId=t.string();break;case 2:r.contentLength=t.uint32();break;case 3:r.chunksAmount=t.uint32();break;case 4:r.crc32=t.uint32();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("contentId"))throw Rs.ProtocolError("missing required 'contentId'",{instance:r});if(!r.hasOwnProperty("contentLength"))throw Rs.ProtocolError("missing required 'contentLength'",{instance:r});if(!r.hasOwnProperty("chunksAmount"))throw Rs.ProtocolError("missing required 'chunksAmount'",{instance:r});if(!r.hasOwnProperty("crc32"))throw Rs.ProtocolError("missing required 'crc32'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.ContentResponseEnd"},t}(),t.Ping=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=Ns.create()),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.Ping;t.pos<n;){var i=t.uint32();t.skipType(7&i)}return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.Ping"},t}(),t.Pong=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=Ns.create()),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.Pong;t.pos<n;){var i=t.uint32();t.skipType(7&i)}return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.Pong"},t}(),t.StillAliveRequest=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.correlationId=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(8).uint32(t.correlationId),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.StillAliveRequest;t.pos<n;){var i=t.uint32();if(i>>>3==1)r.correlationId=t.uint32();else t.skipType(7&i)}if(!r.hasOwnProperty("correlationId"))throw Rs.ProtocolError("missing required 'correlationId'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.StillAliveRequest"},t}(),t.StillAliveResponse=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.correlationId=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(8).uint32(t.correlationId),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.StillAliveResponse;t.pos<n;){var i=t.uint32();if(i>>>3==1)r.correlationId=t.uint32();else t.skipType(7&i)}if(!r.hasOwnProperty("correlationId"))throw Rs.ProtocolError("missing required 'correlationId'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.StillAliveResponse"},t}(),t.Metrics=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.representationBufferFillingRate=0,t.prototype.aggregateBufferFillingRate=0,t.encode=function(t,e){return e||(e=Ns.create()),null!=t.representationBufferFillingRate&&Object.hasOwnProperty.call(t,"representationBufferFillingRate")&&e.uint32(13).float(t.representationBufferFillingRate),null!=t.aggregateBufferFillingRate&&Object.hasOwnProperty.call(t,"aggregateBufferFillingRate")&&e.uint32(21).float(t.aggregateBufferFillingRate),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.Metrics;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.representationBufferFillingRate=t.float();break;case 2:r.aggregateBufferFillingRate=t.float();break;default:t.skipType(7&i)}}return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.Metrics"},t}(),t.LoopCheck=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.nodeId="",t.prototype.correlationId="",t.prototype.finalCountdown=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(10).string(t.nodeId),e.uint32(18).string(t.correlationId),e.uint32(24).uint32(t.finalCountdown),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.LoopCheck;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.nodeId=t.string();break;case 2:r.correlationId=t.string();break;case 3:r.finalCountdown=t.uint32();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("nodeId"))throw Rs.ProtocolError("missing required 'nodeId'",{instance:r});if(!r.hasOwnProperty("correlationId"))throw Rs.ProtocolError("missing required 'correlationId'",{instance:r});if(!r.hasOwnProperty("finalCountdown"))throw Rs.ProtocolError("missing required 'finalCountdown'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.LoopCheck"},t}(),t.SignalingSDP=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.id=0,t.prototype.sdp="",t.prototype.sdpType="",t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(8).uint32(t.id),e.uint32(18).string(t.sdp),e.uint32(26).string(t.sdpType),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.SignalingSDP;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.id=t.uint32();break;case 2:r.sdp=t.string();break;case 3:r.sdpType=t.string();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("id"))throw Rs.ProtocolError("missing required 'id'",{instance:r});if(!r.hasOwnProperty("sdp"))throw Rs.ProtocolError("missing required 'sdp'",{instance:r});if(!r.hasOwnProperty("sdpType"))throw Rs.ProtocolError("missing required 'sdpType'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.SignalingSDP"},t}(),t.SignalingQUIC=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.id=0,t.prototype.sdpType="",t.prototype.key="",t.prototype.params="",t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(8).uint32(t.id),e.uint32(18).string(t.sdpType),null!=t.key&&Object.hasOwnProperty.call(t,"key")&&e.uint32(26).string(t.key),null!=t.params&&Object.hasOwnProperty.call(t,"params")&&e.uint32(34).string(t.params),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.SignalingQUIC;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.id=t.uint32();break;case 2:r.sdpType=t.string();break;case 3:r.key=t.string();break;case 4:r.params=t.string();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("id"))throw Rs.ProtocolError("missing required 'id'",{instance:r});if(!r.hasOwnProperty("sdpType"))throw Rs.ProtocolError("missing required 'sdpType'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.SignalingQUIC"},t}(),t.SignalingCandidate=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.id=0,t.prototype.candidateSdp="",t.prototype.sdpMid="",t.prototype.sdpMLineIndex=0,t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(8).uint32(t.id),e.uint32(18).string(t.candidateSdp),e.uint32(26).string(t.sdpMid),e.uint32(32).int32(t.sdpMLineIndex),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.SignalingCandidate;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.id=t.uint32();break;case 2:r.candidateSdp=t.string();break;case 3:r.sdpMid=t.string();break;case 4:r.sdpMLineIndex=t.int32();break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("id"))throw Rs.ProtocolError("missing required 'id'",{instance:r});if(!r.hasOwnProperty("candidateSdp"))throw Rs.ProtocolError("missing required 'candidateSdp'",{instance:r});if(!r.hasOwnProperty("sdpMid"))throw Rs.ProtocolError("missing required 'sdpMid'",{instance:r});if(!r.hasOwnProperty("sdpMLineIndex"))throw Rs.ProtocolError("missing required 'sdpMLineIndex'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.SignalingCandidate"},t}(),t.SignalingTakeControl=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=Ns.create()),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.SignalingTakeControl;t.pos<n;){var i=t.uint32();t.skipType(7&i)}return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.SignalingTakeControl"},t}(),t.Message=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}let e;return t.prototype.type=1,t.prototype.ping=null,t.prototype.pong=null,t.prototype.contentRequest=null,t.prototype.contentResponseStart=null,t.prototype.contentResponseProgress=null,t.prototype.contentResponseEnd=null,t.prototype.contentAborted=null,t.prototype.stillAliveRequest=null,t.prototype.stillAliveResponse=null,t.prototype.metrics=null,t.prototype.loopCheck=null,t.prototype.signalingSDP=null,t.prototype.signalingCandidate=null,t.prototype.signalingQUIC=null,t.prototype.signalingTakeControl=null,Object.defineProperty(t.prototype,"message",{get:Rs.oneOfGetter(e=["ping","pong","contentRequest","contentResponseStart","contentResponseProgress","contentResponseEnd","contentAborted","stillAliveRequest","stillAliveResponse","metrics","loopCheck","signalingSDP","signalingCandidate","signalingQUIC","signalingTakeControl"]),set:Rs.oneOfSetter(e)}),t.encode=function(t,e){return e||(e=Ns.create()),e.uint32(8).int32(t.type),null!=t.ping&&Object.hasOwnProperty.call(t,"ping")&&Os.system73.protocol.p2p.Ping.encode(t.ping,e.uint32(18).fork()).ldelim(),null!=t.pong&&Object.hasOwnProperty.call(t,"pong")&&Os.system73.protocol.p2p.Pong.encode(t.pong,e.uint32(26).fork()).ldelim(),null!=t.contentRequest&&Object.hasOwnProperty.call(t,"contentRequest")&&Os.system73.protocol.p2p.ContentRequest.encode(t.contentRequest,e.uint32(34).fork()).ldelim(),null!=t.contentResponseStart&&Object.hasOwnProperty.call(t,"contentResponseStart")&&Os.system73.protocol.p2p.ContentResponseStart.encode(t.contentResponseStart,e.uint32(42).fork()).ldelim(),null!=t.contentResponseProgress&&Object.hasOwnProperty.call(t,"contentResponseProgress")&&Os.system73.protocol.p2p.ContentResponseProgress.encode(t.contentResponseProgress,e.uint32(50).fork()).ldelim(),null!=t.contentResponseEnd&&Object.hasOwnProperty.call(t,"contentResponseEnd")&&Os.system73.protocol.p2p.ContentResponseEnd.encode(t.contentResponseEnd,e.uint32(58).fork()).ldelim(),null!=t.contentAborted&&Object.hasOwnProperty.call(t,"contentAborted")&&Os.system73.protocol.p2p.ContentAborted.encode(t.contentAborted,e.uint32(66).fork()).ldelim(),null!=t.stillAliveRequest&&Object.hasOwnProperty.call(t,"stillAliveRequest")&&Os.system73.protocol.p2p.StillAliveRequest.encode(t.stillAliveRequest,e.uint32(90).fork()).ldelim(),null!=t.stillAliveResponse&&Object.hasOwnProperty.call(t,"stillAliveResponse")&&Os.system73.protocol.p2p.StillAliveResponse.encode(t.stillAliveResponse,e.uint32(98).fork()).ldelim(),null!=t.metrics&&Object.hasOwnProperty.call(t,"metrics")&&Os.system73.protocol.p2p.Metrics.encode(t.metrics,e.uint32(106).fork()).ldelim(),null!=t.loopCheck&&Object.hasOwnProperty.call(t,"loopCheck")&&Os.system73.protocol.p2p.LoopCheck.encode(t.loopCheck,e.uint32(114).fork()).ldelim(),null!=t.signalingSDP&&Object.hasOwnProperty.call(t,"signalingSDP")&&Os.system73.protocol.p2p.SignalingSDP.encode(t.signalingSDP,e.uint32(122).fork()).ldelim(),null!=t.signalingCandidate&&Object.hasOwnProperty.call(t,"signalingCandidate")&&Os.system73.protocol.p2p.SignalingCandidate.encode(t.signalingCandidate,e.uint32(130).fork()).ldelim(),null!=t.signalingQUIC&&Object.hasOwnProperty.call(t,"signalingQUIC")&&Os.system73.protocol.p2p.SignalingQUIC.encode(t.signalingQUIC,e.uint32(138).fork()).ldelim(),null!=t.signalingTakeControl&&Object.hasOwnProperty.call(t,"signalingTakeControl")&&Os.system73.protocol.p2p.SignalingTakeControl.encode(t.signalingTakeControl,e.uint32(146).fork()).ldelim(),e},t.decode=function(t,e){t instanceof Is||(t=Is.create(t));for(var n=void 0===e?t.len:t.pos+e,r=new Os.system73.protocol.p2p.Message;t.pos<n;){var i=t.uint32();switch(i>>>3){case 1:r.type=t.int32();break;case 2:r.ping=Os.system73.protocol.p2p.Ping.decode(t,t.uint32());break;case 3:r.pong=Os.system73.protocol.p2p.Pong.decode(t,t.uint32());break;case 4:r.contentRequest=Os.system73.protocol.p2p.ContentRequest.decode(t,t.uint32());break;case 5:r.contentResponseStart=Os.system73.protocol.p2p.ContentResponseStart.decode(t,t.uint32());break;case 6:r.contentResponseProgress=Os.system73.protocol.p2p.ContentResponseProgress.decode(t,t.uint32());break;case 7:r.contentResponseEnd=Os.system73.protocol.p2p.ContentResponseEnd.decode(t,t.uint32());break;case 8:r.contentAborted=Os.system73.protocol.p2p.ContentAborted.decode(t,t.uint32());break;case 11:r.stillAliveRequest=Os.system73.protocol.p2p.StillAliveRequest.decode(t,t.uint32());break;case 12:r.stillAliveResponse=Os.system73.protocol.p2p.StillAliveResponse.decode(t,t.uint32());break;case 13:r.metrics=Os.system73.protocol.p2p.Metrics.decode(t,t.uint32());break;case 14:r.loopCheck=Os.system73.protocol.p2p.LoopCheck.decode(t,t.uint32());break;case 15:r.signalingSDP=Os.system73.protocol.p2p.SignalingSDP.decode(t,t.uint32());break;case 16:r.signalingCandidate=Os.system73.protocol.p2p.SignalingCandidate.decode(t,t.uint32());break;case 17:r.signalingQUIC=Os.system73.protocol.p2p.SignalingQUIC.decode(t,t.uint32());break;case 18:r.signalingTakeControl=Os.system73.protocol.p2p.SignalingTakeControl.decode(t,t.uint32());break;default:t.skipType(7&i)}}if(!r.hasOwnProperty("type"))throw Rs.ProtocolError("missing required 'type'",{instance:r});return r},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/system73.protocol.p2p.Message"},t.Type=function(){const t={},e=Object.create(t);return e[t[1]="PING"]=1,e[t[2]="PONG"]=2,e[t[3]="CONTENT_REQUEST"]=3,e[t[4]="CONTENT_RESPONSE_START"]=4,e[t[5]="CONTENT_RESPONSE_PROGRESS"]=5,e[t[6]="CONTENT_RESPONSE_END"]=6,e[t[7]="CONTENT_ABORTED"]=7,e[t[10]="STILL_ALIVE_REQUEST"]=10,e[t[11]="STILL_ALIVE_RESPONSE"]=11,e[t[12]="METRICS"]=12,e[t[13]="LOOP_CHECK"]=13,e[t[14]="SIGNALING_SDP"]=14,e[t[15]="SIGNALING_CANDIDATE"]=15,e[t[16]="SIGNALING_QUIC"]=16,e[t[17]="SIGNALING_TAKE_CONTROL"]=17,e}(),t}(),t}(),t}(),t})();var xs=As.protocol.p2p;class Ps extends dr{get needEncoding(){return"sctp"===this.transport}configure(t,e){super.configure(t,e)}_write(t,e,n){if(this.needEncoding)try{const r=Ps.encodeMessage(t),i=xs.Message.encode(r).finish();super._write(i,e,n)}catch(t){n(t)}else super._write(t,e,n)}push(t){if(this.needEncoding){const e=Ps.decodeMessage(t);return super.push(e)}return super.push(t)}static decodeMessage(t){function e(t,e){const n=null==t?void 0:t.contentId;return ot.isNil(n)?Object.assign(Object.assign({},t),{type:e}):Object.assign(Object.assign({},t),{contentId:Number(n),type:e})}const n=xs.Message.decode(t);switch(n.type){case xs.Message.Type.CONTENT_REQUEST:return e(n.contentRequest,"content-request");case xs.Message.Type.CONTENT_RESPONSE_START:return e(n.contentResponseStart,"content-response-start");case xs.Message.Type.CONTENT_RESPONSE_PROGRESS:return e(n.contentResponseProgress,"content-response-progress");case xs.Message.Type.CONTENT_RESPONSE_END:return e(n.contentResponseEnd,"content-response-end");case xs.Message.Type.CONTENT_ABORTED:return e(n.contentAborted,"content-aborted");case xs.Message.Type.PING:return e(n.ping,"ping");case xs.Message.Type.PONG:return e(n.pong,"pong");case xs.Message.Type.STILL_ALIVE_REQUEST:return e(n.stillAliveRequest,"still-alive-request");case xs.Message.Type.STILL_ALIVE_RESPONSE:return e(n.stillAliveResponse,"still-alive-response");case xs.Message.Type.METRICS:return e(n.metrics,"metrics");case xs.Message.Type.LOOP_CHECK:return e(n.loopCheck,"loop-check");case xs.Message.Type.SIGNALING_SDP:return e(n.signalingSDP,"signaling-sdp");case xs.Message.Type.SIGNALING_CANDIDATE:return e(n.signalingCandidate,"signaling-candidate");case xs.Message.Type.SIGNALING_TAKE_CONTROL:return e(n.signalingTakeControl,"signaling-take-control");default:throw new Error(`Unsupported type: ${t.type}`)}}static encodeMessage(t){function e(t){const e=null==t?void 0:t.contentId;return ot.isNil(e)?t:Object.assign(Object.assign({},t),{contentId:String(e)})}const n=new xs.Message;switch(t.type){case"content-request":n.type=xs.Message.Type.CONTENT_REQUEST,n.contentRequest=e(t);break;case"metrics":n.type=xs.Message.Type.METRICS,n.metrics=e(t);break;case"ping":n.type=xs.Message.Type.PING,n.ping=e(t);break;case"pong":n.type=xs.Message.Type.PONG,n.pong=e(t);break;case"still-alive-response":n.type=xs.Message.Type.STILL_ALIVE_RESPONSE,n.stillAliveResponse=e(t);break;case"still-alive-request":n.type=xs.Message.Type.STILL_ALIVE_REQUEST,n.stillAliveRequest=e(t);break;case"content-aborted":n.type=xs.Message.Type.CONTENT_ABORTED,n.contentAborted=e(t);break;case"content-response-start":n.type=xs.Message.Type.CONTENT_RESPONSE_START,n.contentResponseStart=e(t);break;case"content-response-progress":n.type=xs.Message.Type.CONTENT_RESPONSE_PROGRESS,n.contentResponseProgress=e(t);break;case"content-response-end":n.type=xs.Message.Type.CONTENT_RESPONSE_END,n.contentResponseEnd=e(t);break;case"loop-check":n.type=xs.Message.Type.LOOP_CHECK,n.loopCheck=e(t);break;case"signaling-sdp":n.type=xs.Message.Type.SIGNALING_SDP,n.signalingSDP=e(t);break;case"signaling-candidate":n.type=xs.Message.Type.SIGNALING_CANDIDATE,n.signalingCandidate=e(t);break;case"signaling-take-control":n.type=xs.Message.Type.SIGNALING_TAKE_CONTROL,n.signalingTakeControl=e(t);break;default:throw new Error(`Unsupported type: ${t.type}`)}return n}}const ks=Et.getInstanceFactory(Ps);var Ls=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class Ds extends Tt{constructor(t){let{identifier:e,direction:n,type:r}=t;super(),this.type=Ds.Type.HTTP,this.identifier=e,this.direction=n,this.type=r,this.state=Ds.State.CONNECTING;const[i,s]=this.identifier.split(":");this.nodeId=this.isInbound?i:s,this.nodeIdShort=Bn.getShortId(this.nodeId),this.connection=ks(this.context).createInstance()}destroy(){var t,e,n,r;return Ls(this,void 0,void 0,(function*(){this.isClosed||this.eventBus&&(this.eventBus.offAll({scope:this}),this.updateState(Ds.State.CLOSED),yield null===(t=this.protocol)||void 0===t?void 0:t.dispose(),this.protocol&&this.eventBus.offAll({target:this.protocol,scope:this}),null===(e=this.eventBus)||void 0===e||e.offAll({target:this,scope:this}),null===(n=this.protocol)||void 0===n||n.destroy(),null===(r=this.connection)||void 0===r||r.destroy(),this.protocol=null,this.connection=null,this.eventBus=null)}))}updateState(t){const e=this.state;this.state=t,this.eventBus.emit($t.DATA_CHANNEL_STATE_CHANGED,{target:this,dataChannel:this,oldState:e,newState:this.state})}write(t){var e;try{this.connection.write(t)}catch(t){null===(e=this.logger)||void 0===e||e.warn(t.stack)}}get isInbound(){return this.direction===Ds.Direction.INBOUND}get isOutbound(){return this.direction===Ds.Direction.OUTBOUND}get isHttp(){return this.type===Ds.Type.HTTP}get isWebRTC(){return this.type===Ds.Type.WEB_RTC}get isConnected(){return this.state===Ds.State.CONNECTED}get isConnecting(){return this.state===Ds.State.CONNECTING}get isClosed(){return this.state===Ds.State.CLOSED}get connectionTransport(){return this.connection.transport}get connectionCount(){return this.connection.count}get writableBufferSize(){return this.connection.writableBufferSize}cork(){var t;null===(t=this.connection)||void 0===t||t.cork()}uncork(){var t;null===(t=this.connection)||void 0===t||t.uncork()}getStats(){var t;return Ls(this,void 0,void 0,(function*(){return null===(t=this.connection)||void 0===t?void 0:t.getStats()}))}}!function(t){let e,n,r,i;!function(t){t.INBOUND="INBOUND",t.OUTBOUND="OUTBOUND"}(e=t.Direction||(t.Direction={})),function(t){t.CONNECTING="CONNECTING",t.CONNECTED="CONNECTED",t.CLOSED="CLOSED"}(n=t.State||(t.State={})),function(t){t.HTTP="HTTP",t.WEB_RTC="WebRTC"}(r=t.Type||(t.Type={})),function(t){t.LAN="LAN",t.INTRA_ASN="IntraASN",t.INTER_ASN="InterASN"}(i=t.PeeringType||(t.PeeringType={}))}(Ds||(Ds={}));class Ms extends Tt{constructor(){super(),this.store=[]}destroy(){this.store=[]}add(t){return this.store.push(t),t}remove(t){const e=this.store.findIndex(ot.matches({identifier:t.identifier}));if(e<0)return;return this.store.splice(e,1)[0]}findByQuery(t){return this.store.find(ot.matches(t))}findAllByQuery(t){return this.store.filter(ot.matches(t))}[Symbol.iterator](){let t=0;const e=this.store;return{next:()=>t<e.length?{done:!1,value:e[t++]}:{done:!0,value:null}}}}Ms.polyNetFactoryName="DataChannelCollection";const Bs=Et.getInstanceFactory(Ms);class Fs{constructor(t){this.nextId=0,this.chunks=[],this.maxChunkSize=t}push(t){this.buffer=this.buffer?tr.concat(this.buffer,t):tr.copy(t),this.flush()}shift(){return this.chunks.shift()}finish(){this.flush(),this.buffer&&(this.pushChunk(new Uint8Array(this.buffer)),this.buffer=null)}flush(){if(!this.buffer)return;let t=null;for(const e of tr.sliceEvery(this.buffer,this.maxChunkSize))e.byteLength<this.maxChunkSize?t=e:this.pushChunk(new Uint8Array(e));this.buffer=t}pushChunk(t){const e=this.nextId++;this.chunks.push({id:e,data:t})}}class js{constructor(){this._live=void 0}get isLive(){return void 0!==this._live?this._live:this.streamType?"LIVE"===this.streamType||"EVENT"===this.streamType:void 0}set isLive(t){this._live=t}}const Us=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.stream=new js}});class $s{static resolveStreamInfo(t,e,n){const r=Us(t).getInstance().stream,i=r.manifest;if(!i)return null;const s=i.findLevelById(e);if(!s)return null;const o=s.findFragmentById(n);return o?{stream:r,manifest:i,level:s,fragment:o}:null}static getRelativeOriginTime(t){var e,n,r;const i=null===(e=t.fragment)||void 0===e?void 0:e.presentationTime;if(null===(n=t.stream)||void 0===n?void 0:n.isLive){return(i-(Date.now()-(null===(r=t.manifest)||void 0===r?void 0:r.startTime)))/1e3}return i/1e3}}const qs=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("ContentCacheService"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.cacheableStore=[],this.noCacheableStore=[],this.eventBus.on($t.STREAM_INFO,this.handleStreamInfoEvent,{scope:this}),this.eventBus.on($t.LOG_REQUEST_REPAIR,this.logIncompleteContents,{scope:this})}destroy(){this.flush(),this.eventBus.offAll({scope:this})}flush(){this.logger.trace("Flush Content Cache - Flushing cache"),this.cacheableStore.forEach((t=>t.destroy())),this.cacheableStore=[]}createContentCache(t){const e=this.selectStore(t);if(this.findFullIdIndex(e,{representationId:t.representationId,id:t.id})>=0)throw new at(`contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} already cached`,at.Codes.CONTENT_CACHE_EXISTING);e.push(t),this.trimStoreIfNecessary(),this.logger.trace(`Create Content Cache - contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} cached with ${t.isFinished?"completed":"NO completed"}`);const n=e.map((t=>`${`cacheSeq${t.seq}`}:${`retries${t.retries}`}:${`"${t.representationId}"`}:${t.isCacheable?t.id:`"${t.url}"`}:${t.origin}:${`[#${t.chunksLength}]`}${""+(t.unsafe?":unsafe":"")}`));this.logger.trace(`Cache ${t.isCacheable?"CACHEABLE":"NO_CACHEABLE"}: [ ${n.join(" , ")} ]`),this.eventBus.emit($t.CONTENT_CACHE_CONTENT_CREATED,{target:t,contentCache:t});const r=[];for(const n of e)if(n.isCacheable&&n.representationId==t.representationId){const t=$s.resolveStreamInfo(this.context,n.representationId,n.id);if(t){const e=$s.getRelativeOriginTime(t);r.push([e,e+t.fragment.duration/1e3])}}if(r.length>0){r.sort(((t,e)=>t[0]-e[0]));let t=r.reduce(((t,e)=>{if(0===t.length)t.push(e);else{const n=t[t.length-1];Math.abs(e[0]-n[1])<1.5?n[1]=e[1]:t.push(e)}return t}),[]);this.lastCacheableStorePtsRanges=t}}updateContentCache(t){const e=this.selectStore(t),n=this.findFullIdIndex(e,{representationId:t.representationId,id:t.id});if(n<0)throw new at(`contentId: ${t.id} not found`,at.Codes.CONTENT_CACHE_NOT_FOUND);e[n]=t,this.eventBus.emit($t.CONTENT_CACHE_CONTENT_UPDATED,{target:t,contentCache:t})}errorContentCache(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2?arguments[2]:void 0;if(t){if("p2p-closed"===n||"p2p-abort"===n)return this.logger.trace(`Error content cache: contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} - representationId: ${t.representationId}, reason: ${n} - Retrying without removing content`),t.reset(),void this.eventBus.emit($t.CONTENT_CACHE_RETRY_NEEDED,{target:t,contentCache:t});this.logger.warn(`Abort Content Cache - Aborted contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} - representationId: ${t.representationId}`),t.error(e),this.eventBus.emit($t.CONTENT_CACHE_CONTENT_ERROR,{target:t,contentCache:t,reason:n}),this.removeContentCache(t)}}finishContentCache(t){const e=this.selectStore(t),n=this.findFullIdIndex(e,{representationId:t.representationId,id:t.id});if(n<0)throw new at(`contentId: ${t.id} not found`,at.Codes.CONTENT_CACHE_NOT_FOUND);if(t.isCacheable&&!t.duration&&this.logger.trace(`contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} complete but duration ${t.duration}`),t.finish(),e[n]=t,this.eventBus.emit($t.CONTENT_CACHE_CONTENT_UPDATED,{target:t,contentCache:t}),t.isCacheable)return this.logger.debug(Ut.completeContentShareable(t.id,t.url,t.crc32)),this.logger.debug(Ut.printCache(e.map((t=>t.isCacheable?`${JSON.stringify({id:t.id.toString(),reprId:t.representationId})}`:t.url)))),void(this.settings.bfrCompletion&&this.logger.trace(Ut.printCacheForDebugBfr(e)));this.logger.debug(Ut.completeContentNonShareable(t.url)),t.isCacheable||this.removeContentCache(t)}removeContentCache(t){const e=this.selectStore(t),n=this.findFullIdIndex(e,{representationId:t.representationId,id:t.id});if(n<0)throw new at(`contentId: ${t.id} not found`,at.Codes.CONTENT_CACHE_NOT_FOUND);this.logger.trace(`Remove Content Cache - Removed contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} from cache`),e.splice(n,1),t.destroy(),this.eventBus.emit($t.CONTENT_CACHE_CONTENT_REMOVED,{target:t,contentCache:t})}findOneContentCacheByUrl(t){return[...this.cacheableStore,...this.noCacheableStore].find(ot.matches({url:t}))}findOneContentCacheById(t){return[...this.cacheableStore,...this.noCacheableStore].find(ot.matches({id:t}))}findOneContentCacheByFullId(t){let{representationId:e,id:n}=t;return[...this.cacheableStore,...this.noCacheableStore].find(ot.matches({representationId:e,id:n}))}findOneContentCacheByQuery(t){return[...this.cacheableStore,...this.noCacheableStore].find(ot.matches(t))}findAllContentCache(){return[...this.cacheableStore,...this.noCacheableStore]}findAllContentCacheByQuery(t){return[...this.cacheableStore,...this.noCacheableStore].filter(ot.matches(t))}countAllCacheable(){return this.findAllCacheable().length}findAllCacheable(){return this.cacheableStore}findAllCacheableByQuery(t){return this.cacheableStore.filter(ot.matches(t))}selectStore(t){return t.isCacheable?this.cacheableStore:this.noCacheableStore}findFullIdIndex(t,e){let{representationId:n,id:r}=e;return t.findIndex(ot.matches({representationId:n,id:r}))}computeCompletedDuration(t,e){return t.reduce(((t,n)=>n.isFinished?t+(n.duration||e||0):t),0)}trimStoreIfNecessary(){const t=this.settings.defaultContentDuration,e=this.settings.liveCacheDuration,n=this.findAllContentCacheByQuery({cachePolicy:Yi.Policy.CACHEABLE});let r=this.computeCompletedDuration(n,t);for(;r>e;){const e=n.shift();e.isFinished&&(e.duration?r-=e.duration:t?r-=t:this.logger.warn(`Cannot compute duration for complete contentId: ${e.id} - cacheSeq: ${e.seq} - retries: ${e.retries}`)),this.removeContentCache(e)}}handleStreamInfoEvent(t){var e;const{streamInfo:n}=t;(null==n?void 0:n.fragment)&&"VIDEO"===(null===(e=null==n?void 0:n.level)||void 0===e?void 0:e.mediaType)&&(this.lastPlayerRequestRelTime=$s.getRelativeOriginTime(n),this.updateSafeCacheRange());const r=(t=>{var e,n;return this.settings.defaultContentDuration||(null===(e=null==t?void 0:t.level)||void 0===e?void 0:e.targetDuration)||(null===(n=null==t?void 0:t.fragment)||void 0===n?void 0:n.duration)})(n),i=((t,e)=>{var n,r,i;if(!(null===(n=t.level)||void 0===n?void 0:n.targetDuration)||!(null===(r=t.level)||void 0===r?void 0:r.fragments))return this.settings.liveCacheDuration;const{fragments:s}=t.level,o=s.reduce(((t,n)=>t+(n.duration||e||0)),(null===(i=s[0])||void 0===i?void 0:i.duration)||e||0);return Math.min(o,this.settings.maxCacheDuration||Rn.DEFAULT_MAX_CACHE_DURATION)})(n,r);this.settings.defaultContentDuration===r&&this.settings.liveCacheDuration===i||this.settings.setup({defaultContentDuration:r,liveCacheDuration:i})}updateSafeCacheRange(){const t=this.lastPlayerRequestRelTime,e=this.lastCacheableStorePtsRanges;if(null!=e){let n=e.find((e=>t>=e[0]&&t<=e[1]));const r=this.settings.safeCacheRangePtsTolerance;r>0&&!n&&(n=e.find((e=>e[0]-t>r||t-e[1]<r))),n&&(this.safeCacheRange=n,this.settings.overrideCustomDimensionWithVodDvrStats&&this.settings.setup({customDimension1:n[0].toString(),customDimension2:n[1].toString(),customDimension3:t.toString()}))}}logIncompleteContents(){const t=this.findAllCacheable().filter((t=>!t.isFinished));if(0===t.length)return;const e=t.map((t=>`${`cacheSeq${t.seq}`}:${`retries${t.retries}`}:${`"${t.representationId}"`}:${t.isCacheable?t.id:`"${t.url}"`}:${t.origin}:${`[#${t.chunksLength}]`}`));this.logger.trace(`💔 Player buffer health critical: Incomplete contents: [ ${e.join(" , ")} ]`)}});class Hs extends Tt{constructor(t){super(),this.dataChannel=t,this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`HttpProtocol-Inbound-${this.dataChannel.nodeIdShort}`),this.contentCacheService=qs(this.context).getInstance(),this.streamingStats=_r(this.context).getInstance(),this.requests=new Map}dispose(){if(this.requests.size>0)return new Promise((t=>{this.completeDispose=t}))}destroy(){this.requests.clear(),this.eventBus.offAll({scope:this}),this.logger=null,this.eventBus=null,this.contentCacheService=null,this.dataChannel=null}destroyIfIsDestroying(){this.completeDispose&&0===this.requests.size&&this.completeDispose()}start(){this.eventBus.on($t.CONTENT_CACHE_CONTENT_ERROR,this.handleContentCacheContentAbortedEvent,{scope:this})}requestContent(t){let e=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id});e||(e=this.createContentCache(t)),this.logger.trace(`Content requested: contentId: ${e.id} - representationId: ${e.representationId} - ${e.url} - cacheSeq: ${e.seq} - retries: ${e.retries}`),e.requested=!0,t.external&&(e.external=!0),e.duration=t.duration}handleConnectionHttpData(t){switch(t.type){case"content-response-start":this.handleConnectionHttpRequestStartedEvent(t);break;case"content-response-progress":this.handleConnectionHttpRequestProgressEvent(t);break;case"content-response-end":this.handleConnectionHttpRequestCompletedEvent(t)}}hasRequest(t,e){return this.requests.has(this.getKey(t,e))}handleConnectionHttpRequestStartedEvent(t){this.logger.trace(`Content started: contentId: ${t.id} - representationId: ${t.representationId} - ${t.url}`),this.requests.set(this.getKey(t.id,t.representationId),Object.assign(Object.assign({},t),{generator:new Fs(Yi.CHUNK_SIZE)}))}handleConnectionHttpRequestProgressEvent(t){const e=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id});if(e){if(e.url=t.url,t.lengthComputable&&(e.contentLength=t.total),t.headers&&(e.headers=t.headers),t.chunk){const{generator:n}=this.requests.get(this.getKey(e.id,e.representationId));n.push(t.chunk),this.setChunks(n,e)}this.contentCacheService.updateContentCache(e)}}handleConnectionHttpRequestCompletedEvent(t){const e=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id});if(!e)return;e.responseUrl=t.responseUrl,this.logger.trace(`Content completed: contentId: ${e.id} - representationId: ${e.representationId} - ${e.url} - cacheSeq: ${e.seq} - retries: ${e.retries}`);const{generator:n}=this.requests.get(this.getKey(e.id,e.representationId));t.headers&&(e.headers=t.headers),n.finish(),this.setChunks(n,e),this.contentCacheService.finishContentCache(e),this.requests.delete(this.getKey(t.id,t.representationId)),this.destroyIfIsDestroying()}handleConnectionHttpRequestErrorEvent(t){this.logger.warn(`Content error: contentId: ${t.id} - representationId: ${t.representationId} - ${t.url}`);const e=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id});this.contentCacheService.errorContentCache(e,!1,"http-error"),this.requests.delete(this.getKey(t.id,t.representationId)),this.destroyIfIsDestroying()}handleContentCacheContentAbortedEvent(t){const e=t.contentCache,n=this.requests.get(this.getKey(e.id,e.representationId));if(n){const{id:t,url:r,representationId:i}=n;r===e.url&&t===e.id&&i===e.representationId&&(this.logger.trace(`Aborting the HTTP request for content contentId: ${n.id} - representationId: ${n.representationId} - ${n.url}`),n.request.abort(),this.requests.delete(this.getKey(e.id,e.representationId)),this.destroyIfIsDestroying())}}createContentCache(t){t.cachePolicy||(t.cachePolicy=Yi.Policy.CACHEABLE);const e=new Yi(t,{origin:Yi.Origin.HTTP,dataChannelId:this.dataChannel.identifier,bitrate:this.streamingStats.findBitrate(t.representationId)||this.streamingStats.bitrate},this.context);return this.contentCacheService.createContentCache(e),e}getKey(t,e){return`${t}:${e}`}setChunks(t,e){for(let n=t.shift();n;n=t.shift())e.setChunk(n.id,n.data)}}Hs.polyNetFactoryName="HttpProtocol";const Ws=Et.getInstanceFactory(Hs);const Vs=Et.getInstanceFactory(class extends Ds{constructor(t){super(Object.assign(Object.assign({},t),{type:Ds.Type.HTTP})),this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`DataChannelHttp-${this.nodeIdShort}`),this.protocol=Ws(this.context).createInstance(this),this.connection.on("open",(()=>{this.handleConnectionHttpStartedEvent()})),this.connection.on("data",(t=>{this.protocol.handleConnectionHttpData(t)})),this.connection.on("error",(t=>{this.protocol.handleConnectionHttpRequestErrorEvent(t)}))}get peeringType(){}set peeringType(t){}start(){this.logger.trace("Connecting"),this.updateState(Ds.State.CONNECTING),this.connection.configure("http"),this.connection.startConnection()}requestContent(t){t.url?(this.logger.debug(Ut.requestingCDN(t.url,t.id)),this.protocol.requestContent(t),this.protocol.hasRequest(t.id,t.representationId)||this.connection.write(t)):this.eventBus.emit($t.CONTENT_URL_MISSING,{target:this,options:t})}handleConnectionHttpStartedEvent(){this.logger.trace("Ready"),this.updateState(Ds.State.CONNECTED),this.protocol.start(),this.eventBus.emit($t.DATA_CHANNEL_CONNECTED,{target:this,dataChannel:this})}});class Gs extends Tt{constructor(t){super(),this.logger=xt(this.context).getInstance().getLogger(`DataChannelWebRTC-${t.nodeIdShort}-LoopChecker`),this.eventBus=Ct(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.dataChannel=t,this.correlationId=Mn()}destroy(){this.eventBus&&(this.eventBus.offAll({scope:this}),this.logger=null,this.eventBus=null,this.dataChannel=null,this.polyNet=null,this.correlationId=null)}start(){this.eventBus&&(this.settings.loopCheckerTtl&&this.settings.enableInboundChecks?this.dataChannel.isInbound?(this.eventBus.on($t.LOOP_CHECK_MESSAGE_RECEIVED,this.handleLoopCheckMessageEvent,{scope:this}),this.sendLoopCheckMessage({correlationId:this.correlationId,finalCountdown:this.settings.loopCheckerTtl,nodeId:this.polyNet.nodeId,type:"loop-check"})):this.logger.trace("Not an inbound WebRTC data channel"):this.logger.trace("Loop Check disabled"))}handleLoopCheckMessageEvent(t){const{correlationId:e,finalCountdown:n,nodeId:r}=t;this.logger.trace(`Received Loop Check message from nodeId: ${r} with correlationId: ${e} and countdown: ${n}`),0!==this.dataChannel.connectionCount?this.polyNet.nodeId===r?(this.logger.trace(`It is from this peer (nodeId: ${r}). Check loop - expected correlationId: ${this.correlationId}`),this.correlationId===e&&this.eventBus.emit($t.REQUEST_REPAIR,{reason:`A loop has been found at nodeId: ${this.polyNet.nodeIdShort}`})):n>0&&(this.logger.trace(`Forwarding Loop Check message to nodeId: ${this.dataChannel.nodeIdShort}`),this.sendLoopCheckMessage({correlationId:e,finalCountdown:n-1,nodeId:r,type:"loop-check"})):this.logger.trace(`Ignoring incoming Loop Check message from nodeId: ${r} - Reason: Inbound connection not yet open`)}sendLoopCheckMessage(t){this.dataChannel.write(t),this.logger.debug(Ut.sentLoopCheck(this.dataChannel.nodeIdShort,t.nodeId))}}Gs.polyNetFactoryName="LoopChecker";const zs=Et.getInstanceFactory(Gs);class Ks extends Tt{constructor(t){super(),this.dataChannel=t,this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`DataChannelWebRTC-${this.dataChannel.nodeIdShort}-PeerMetric`)}start(){this.eventBus.on($t.METRICS_MESSAGE,(t=>this.handleMetricsEvent(t)),{scope:this})}destroy(){this.eventBus.offAll({scope:this})}handleMetricsMessage(t){this.eventBus.emit($t.COLLECT_DATA_CHANNEL_STATS,{bufferFillingRate:{bufferFillingRate:t.aggregateBufferFillingRate,nodeId:this.dataChannel.nodeId}}),this.logger.trace(`Received metrics message with aggregateBufferFillingRate: ${t.aggregateBufferFillingRate}`)}handleMetricsEvent(t){const{aggregateBufferFillingRate:e}=t.metrics;if(!ot.isNil(this.lastSent)&&Math.abs(e-this.lastSent)<1e-4)return;this.lastSent=e;const n={aggregateBufferFillingRate:e,type:"metrics"};this.dataChannel.write(n)}}Ks.polyNetFactoryName="PeerMetrics";const Ys=Et.getInstanceFactory(Ks);class Xs{constructor(){this.usedPorts=new Set}generate(t,e,n){function r(t,e,n){return t.replace(a,e).replace(l,`${c} ${n}`)}function i(t){return`${e} ${c} ${t}`}const s=[],o=t.split(" "),a=Number(o[3]),c=o[4],u=Number(o[5]),l=`${c} ${u}`,{typePreference:h,localPreference:d,componentId:p}=gr.decomposePriority(a);this.usedPorts.has(i(u))||(this.usedPorts.add(i(u)),s.push(t));let f=u+n,g=d-1;for(let e=1;e<=n;++e){if(!this.usedPorts.has(i(f))){this.usedPorts.add(i(f));const e=gr.composePriority(h,g,p);s.push(r(t,e,f))}--g,--f}return s}}class Zs extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("ReconnectScheduler"),this.eventBus=Ct(this.context).getInstance(),this.reconnectTimer=Ss(this.context).createInstance(),this.settings=On(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.retries=0}get isTimerRunning(){return this.reconnectTimer.isRunning}start(){this.eventBus.on($t.WS_OPEN,this.handleWebSocketConnect,{scope:this}),this.eventBus.on($t.WS_CLOSE,this.handleWebSocketDisconnect,{scope:this}),this.eventBus.on($t.WS_ERROR,this.handleWebSocketDisconnect,{scope:this})}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.destroyTimeout(),this.eventBus=null,this.reconnectTimer=null}createTimeout(t){this.reconnectTimer.setTimeout("Reconnect-scheduler",t,(()=>{this.logger.trace("Retrying to connect"),this.eventBus.emit($t.REQUEST_CONNECT,{target:this})}))}destroyTimeout(){var t;null===(t=this.reconnectTimer)||void 0===t||t.cancel()}startScheduler(){if(this.isTimerRunning)return;let t;const e=1e3*this.settings.reconnectRetryRange.maxBackoffTimeout,n=1e3*Math.pow(this.settings.reconnectRetryRange.exponentialBase,this.retries);0===this.retries?t=0:(t=Math.min(e,n),t*=ot.random(this.settings.reconnectRetryRange.timeoutJitterRatio,1)),this.logger.debug(Ut.scheduledRetryTrackerConnection(t)),this.createTimeout(t),n<=e&&this.retries++}stopScheduler(){this.logger.trace("Disabling ReconnectScheduler"),this.destroyTimeout(),this.retries=0}handleWebSocketDisconnect(){this.polyNet.isInNoRecovery||this.startScheduler()}handleWebSocketConnect(){this.stopScheduler()}}Zs.polyNetFactoryName="ReconnectScheduler";const Js=Et.getInstanceFactory(Zs);const Qs=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("WebSocketManager"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.reconnectScheduler=Js(this.context).createInstance(),this.handleOpenEvent=this.handleOpenEvent.bind(this),this.handleErrorEvent=this.handleErrorEvent.bind(this),this.handleCloseEvent=this.handleCloseEvent.bind(this),this.handleMessageEvent=this.handleMessageEvent.bind(this)}start(){this.reconnectScheduler.start()}destroy(){this.disconnect(),this.reconnectScheduler.destroy(),this.logger=null,this.eventBus=null,this.webSocket=null}connect(t){if(!this.webSocket)try{this.logger.trace(`WS ${t} - Opening`),this.webSocket=new WebSocket(`${t}?authorization=${this.settings.apiKey.hashedKey}`),this.webSocket.addEventListener("open",this.handleOpenEvent),this.webSocket.addEventListener("error",this.handleErrorEvent),this.webSocket.addEventListener("close",this.handleCloseEvent),this.webSocket.addEventListener("message",this.handleMessageEvent)}catch(t){this.closeWebSocket(9999,t.message)}}disconnect(){this.webSocket&&(this.webSocket.removeEventListener("open",this.handleOpenEvent),this.webSocket.removeEventListener("error",this.handleErrorEvent),this.webSocket.removeEventListener("close",this.handleCloseEvent),this.webSocket.removeEventListener("message",this.handleMessageEvent),this.webSocket.readyState!==WebSocket.CONNECTING&&this.webSocket.readyState!==WebSocket.OPEN||this.webSocket.close(),this.webSocket=null)}send(t){const e=In(t),n=JSON.stringify(e);this.webSocket&&this.webSocket.readyState===WebSocket.OPEN?(this.logger.debug(Ut.sentTrackerMessage(n)),this.webSocket.send(n)):this.logger.trace(`Sending message in a closed WS: ${n}`)}handleOpenEvent(){this.logger.trace(`WS ${this.webSocket.url} - Opened`),this.eventBus.emit($t.WS_OPEN,{target:this})}handleErrorEvent(){dt.throw(this.logger,`WS ${this.webSocket.url} - Error`),this.eventBus.emit($t.WS_ERROR,{target:this})}handleCloseEvent(t){this.closeWebSocket(t.code,t.reason)}handleMessageEvent(t){const e=this.parse(t.data);ot.isNil(e)?this.logger.warn(`Unable to parse message: ${t.data}`):(this.logger.debug(Ut.receivedTrackerMessage(e)),this.eventBus.emit($t.WS_MESSAGE,{target:this,message:e}))}closeWebSocket(t,e){var n;switch(this.logger.trace(`WS ${null===(n=this.webSocket)||void 0===n?void 0:n.url} - Closed. Code: ${t} Reason: ${e}`),this.disconnect(),t){case 1e3:break;case 4429:mt.throw(this.logger,`${e}`),this.eventBus.emit($t.COLLECT_POLYNET_STATS,{revokedStatus:wr.RevokedStatus.MAX_USERS_PER_API_KEY});break;default:ft.throw(this.logger,`Code: ${t} - Reason: ${e}.`)}this.eventBus.emit($t.WS_CLOSE,{target:this})}parse(t){try{return Tn(JSON.parse(t))}catch(t){return}}});class to extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("Signaler"),this.dataChannelService=_o(this.context).getInstance(),this.websocket=Qs(this.context).getInstance()}startSignalingForDataChannel(t){t.isInbound&&t.isWebRTC&&this.sendHandShakeRequest(t)}destroy(){this.eventBus.offAll({scope:this}),this.eventBus=null,this.polyNet=null,this.logger=null,this.dataChannelService=null}getConnectionsCount(t){let e;switch(t.peeringType){case Ds.PeeringType.LAN:e=this.settings.multiPeer.sctpLanCount;break;case Ds.PeeringType.INTRA_ASN:e=this.settings.multiPeer.sctpIntraAsnCount;break;case Ds.PeeringType.INTER_ASN:e=this.settings.multiPeer.sctpInterAsnCount}return this.logger.trace(`Using connections count: ${e}`),e}canUseSequentialOpening(){return this.stats.nat.type===fr.Type.SEQUENTIAL}handleSignalingMessage(t){const e=this.dataChannelService.findByNodeId(t.from);if(e)switch(t.payload.messageType){case to.Messages.HANDSHAKE_REQUEST:this.handleHandshakeRequestMessage(e,t.payload);break;case to.Messages.HANDSHAKE_RESPONSE:this.handleHandshakeResponseMessage(e,t.payload);break;case to.Messages.KICK:this.handleKickMessage(e,t.payload);break;case to.Messages.SDP:case to.Messages.ICE_CANDIDATE:this.handleWsSignalingMessage(e,t.payload)}}sendHandShakeRequest(t){t.useSequentialOpening=this.canUseSequentialOpening(),t.connectionsCount=this.getConnectionsCount(t),t.useTrickle=this.canUseTrickleIce(),this.sendWSMessageToPeer(t.nodeId,{messageType:to.Messages.HANDSHAKE_REQUEST,representationId:this.polyNet.representationId,streamId:this.polyNet.streamId,supportedProtocols:[bo.PROTOCOL_VERSION],useSequentialOpening:t.useSequentialOpening,useTrickle:t.useTrickle,peeringType:t.peeringType,connectionsCount:t.connectionsCount})}sendHanshakeResponseOk(t,e){t.useSequentialOpening=!!e.useSequentialOpening||this.canUseSequentialOpening(),t.useTrickle=!!e.useTrickle,t.connectionsCount=e.connectionsCount,t.peeringType=e.peeringType;const n={messageType:to.Messages.HANDSHAKE_RESPONSE,protocol:bo.PROTOCOL_VERSION,statusCode:to.StatusCodes.OK,statusMessage:"Everything OK.",useSequentialOpening:t.useSequentialOpening,useTrickle:t.useTrickle};this.sendWSMessageToPeer(t.nodeId,n)}sendHandshakeResponseError(t,e){const n={messageType:to.Messages.HANDSHAKE_RESPONSE,statusCode:to.StatusCodes.ERROR,statusMessage:`Unsupported protocols: ${e.supportedProtocols}`};this.sendWSMessageToPeer(t.nodeId,n)}handleHandshakeRequestMessage(t,e){this.logger.trace("Processing handshake request");!(e.supportedProtocols||[]).includes(bo.PROTOCOL_VERSION)||ot.isNil(e.peeringType)||ot.isNil(e.connectionsCount)?this.sendHandshakeResponseError(t,e):this.sendHanshakeResponseOk(t,e)}handleHandshakeResponseMessage(t,e){if(this.logger.trace("Processing handshake response"),e.statusCode!==to.StatusCodes.OK)return this.logger.error(`Error during handshaking process: ${e.statusMessage}`),void this.dataChannelService.removeDataChannel(t);t.useSequentialOpening=!!e.useSequentialOpening||this.canUseSequentialOpening(),t.useTrickle=!!e.useTrickle,t.openMasterConnection()}handleWsSignalingMessage(t,e){t.openMasterConnection(),t.handleWsSignalingMessage(e)}handleKickMessage(t,e){this.logger.trace(`Received kick message with reason: ${e.reasonMessage}. Closing DataChannel`),this.dataChannelService.removeDataChannel(t)}canUseTrickleIce(){return So.isTrickleIceSupported}sendWSMessageToPeer(t,e){this.websocket.send({from:this.polyNet.nodeId,messageType:Cs.MessageType.PEER_TO_PEER,payload:e,to:t})}}to.polyNetFactoryName="Signaler",function(t){let e,n;!function(t){t.HANDSHAKE_REQUEST="handshake-request",t.HANDSHAKE_RESPONSE="handshake-response",t.SDP="sdp",t.ICE_CANDIDATE="ice-candidate",t.KICK="kick"}(e=t.Messages||(t.Messages={})),function(t){t.OK="OK",t.ERROR="ERROR"}(n=t.StatusCodes||(t.StatusCodes={}))}(to||(to={}));const eo=Et.getInstanceFactory(to),no=/[0-9a-f-]+.local/g;class ro extends Tt{constructor(t){super(),this.logger=xt(this.context).getInstance().getLogger(`PeerSignaler-${t.isInbound?"Inbound":"Outbound"}-${t.nodeIdShort}`),this.settings=On(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.websocket=Qs(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.dataChannel=t,this.candidateGenerator=new Xs}handleWsSignalingMessage(t){"sdp"!==t.messageType?"ice-candidate"!==t.messageType||this.dataChannel.signal({candidate:{candidate:t.candidateSdp,sdpMLineIndex:t.sdpMLineIndex,sdpMid:t.sdpMid},connectionId:t.id,type:"candidate"}):this.dataChannel.signal({type:t.sdpType,sdp:t.sdp,connectionId:t.id})}handleSignalingMessage(t){switch(t.id&&this.dataChannel.handleRemoteMasterOpening(t.id),t.type){case"signaling-sdp":this.dataChannel.signal({type:t.sdpType,sdp:t.sdp,connectionId:t.id});break;case"signaling-candidate":this.dataChannel.signal({candidate:{candidate:t.candidateSdp,sdpMLineIndex:t.sdpMLineIndex,sdpMid:t.sdpMid},connectionId:t.id,type:"candidate"});break;case"signaling-take-control":this.logger.debug(Ut.receivedTakeControl(this.dataChannel.nodeIdShort)),this.dataChannel.takeControl()}}handleSignalingEvent(t){if("candidate"!==t.type)return void this.sendSignalingMessage(t);if(""===t.candidate)return;const e=gr.parseCandidate(t.candidate),{type:n}=e;"host"===n?this.injectForMDNS(t,e):"srflx"===n&&this.stats.nat.type===fr.Type.SEQUENTIAL?this.injectForNATTraversal(t):this.sendSignalingMessage(t)}sendSignalingTakeControlMessage(){this.logger.debug(Ut.sentTakeControl(this.dataChannel.nodeIdShort)),this.dataChannel.write({type:"signaling-take-control"})}injectForNATTraversal(t){const{connectionId:e}=t;this.candidateGenerator.generate(t.candidate,e,this.settings.natTraversal.sequentialInjectionAmount).forEach((e=>this.sendSignalingMessage(Object.assign(Object.assign({},t),{candidate:e}))))}injectForMDNS(t,e){let{candidate:n}=t;const{priority:r,type:i}=e;"host"===i&&n.match(no)&&(n=n.replace(r,1),this.sendSignalingMessage(Object.assign(Object.assign({},t),{candidate:n.replace(no,"224.0.0.251")}))),this.sendSignalingMessage(Object.assign(Object.assign({},t),{candidate:n}))}sendSignalingMessage(t){t.connectionId<2?this.sendWebSocketSignaling(t):this.sendWebrtcSignalingMessage(t)}sendWebrtcSignalingMessage(t){if("sctp"===this.dataChannel.connectionTransport){const e="offer"===t.type||"answer"===t.type?"signaling-sdp":"signaling-candidate";this.dataChannel.write(Object.assign(Object.assign({candidateSdp:t.candidate},t),{id:t.connectionId,sdpType:t.type,type:e}))}}sendWebSocketSignaling(t){const e=this.dataChannel;switch(t.type){case"candidate":const{candidate:n,sdpMid:r,sdpMLineIndex:i,connectionId:s}=t;this.sendWSMessageToPeer(e.nodeId,{candidateSdp:n,messageType:to.Messages.ICE_CANDIDATE,id:s,sdpMLineIndex:i,sdpMid:r});break;case"answer":case"offer":t.sdp&&this.sendWSMessageToPeer(e.nodeId,{sdpType:t.type,id:t.connectionId,sdp:t.sdp,messageType:to.Messages.SDP})}}sendWSMessageToPeer(t,e){this.websocket.send({from:this.polyNet.nodeId,messageType:Cs.MessageType.PEER_TO_PEER,payload:e,to:t})}}ro.polyNetFactoryName="PeerSignaler";const io=Et.getInstanceFactory(ro);class so extends Tt{constructor(t){super(),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.dataChannel=t}start(){this.scheduleNextPing(0)}destroy(){this.eventBus&&(this.eventBus.offAll({scope:this}),this.cancelNextPing(),this.eventBus=null,this.lastPingTime=null)}handlePingPongMessage(t){switch(t.type){case"ping":this.sendPong();break;case"pong":this.dataChannel.isInbound&&this.handlePong()}}sendPong(){this.dataChannel.isOutbound&&this.dataChannel.write({type:"pong"})}handlePong(){if(!this.lastPingTime)return;const t=performance.now()-this.lastPingTime||void 0;this.lastPingTime=null,t&&this.eventBus.emit($t.COLLECT_NETWORK_STATS,{target:this,rtt:t});const e=this.settings.metricsPeriod/2;e&&this.scheduleNextPing(e)}sendPing(){this.dataChannel.isInbound&&(this.cancelNextPing(),this.dataChannel.write({type:"ping"}),this.lastPingTime=performance.now())}scheduleNextPing(t){this.sendNextPingTimeout||(this.sendNextPingTimeout=window.setTimeout((()=>this.sendPing()),t))}cancelNextPing(){clearTimeout(this.sendNextPingTimeout),this.sendNextPingTimeout=null}}so.polyNetFactoryName="RTTCalculator";const oo=Et.getInstanceFactory(so);class ao extends Tt{constructor(t){super(),this.correlationId=0,this.alive=!1,this.dataChannel=t,this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`DataChannelWebRTC-${this.dataChannel.nodeIdShort}-StillAlive`),this.stillAliveTimer=Ss(this.context).createInstance()}destroy(){this.eventBus.offAll({scope:this}),this.stillAliveTimer.cancel(),this.correlationId=0,this.logger=null,this.dataChannel=null}start(){this.sendStillAliveRequest(),this.scheduleStillAliveTimeout()}markAsAlive(){this.alive=!0}handleStillAliveMessage(t){switch(t.type){case"still-alive-request":this.handleStillAliveRequest(t);break;case"still-alive-response":this.handleStillAliveResponse(t)}}handleStillAliveRequest(t){this.logger.trace(`Received Still Alive REQUEST message with correlationID: "${t.correlationId}"`),this.sendStillAliveResponse(t.correlationId)}handleStillAliveResponse(t){const{correlationId:e}=t;this.logger.trace(`Received Still Alive RESPONSE message with correlationID: "${e}"`),e===this.correlationId?this.markAsAlive():this.logger.warn(`Received wrong correlationId: ${e}, ignoring message`)}checkIsAlive(){this.alive?(this.sendStillAliveRequest(),this.scheduleStillAliveTimeout()):this.triggerDataChannelTimeout(this.correlationId)}get stillAlivePeriod(){return 15e3}scheduleStillAliveTimeout(){this.stillAliveTimer.cancel(),this.stillAliveTimer.setTimeout("Still-Alive-Timer",this.stillAlivePeriod,(()=>this.checkIsAlive()))}triggerDataChannelTimeout(t){this.logger.trace(`Still alive response message with correlationId = "${t}" not received. Closing data channel`),this.eventBus.emit($t.DATA_CHANNEL_STILL_ALIVE_TIMEOUT,{target:this.dataChannel,dataChannel:this.dataChannel})}sendStillAliveRequest(){this.logger.trace(`Sending Still Alive REQUEST message with to: ${this.dataChannel.isInbound?"INBOUND":"OUTBOUND"}:${this.dataChannel.nodeIdShort}`),this.alive=!1,this.dataChannel.write({correlationId:++this.correlationId,type:"still-alive-request"})}sendStillAliveResponse(t){this.logger.trace(`Sending Still Alive RESPONSE message with correlationID: "${t}"`),this.dataChannel.write({correlationId:t,type:"still-alive-response"})}}ao.polyNetFactoryName="StillAlive";const co=Et.getInstanceFactory(ao);const uo=Et.getInstanceFactory(class extends Tt{constructor(t){super(),this.id=t,this.contentCacheService=qs(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`ContentAbortManager-${t}`),this.settings=On(this.context).getInstance(),this.timers=new Map}destroy(){super.destroy(),this.timers.forEach((t=>clearTimeout(t))),this.timers.clear()}armAbortTimer(t){const e=this.getKey(t.options);if(this.timers.has(e))return;const n=t.options.duration||t.duration||1e4;if(n){const r=setTimeout((()=>{this.logger.trace(`Aborting slow P2P transfer from nodeId: ${this.id}, contentId: ${t.id} - cacheSeq: ${null==t?void 0:t.seq} - retries: ${t.retries}.`),this.contentCacheService.errorContentCache(t,!0,"p2p-abort")}),Math.round(n*this.settings.slowParentDurationFactor));this.timers.set(e,r)}}delete(t){const e=this.getKey(t.options);if(!this.timers.has(e))return;const n=this.timers.get(e);clearTimeout(n),this.timers.delete(e)}getKey(t){return`${t.id}:${t.representationId}`}});var lo=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]])}return n};const ho=Et.getInstanceFactory(class extends Tt{constructor(t){super(),this.dataChannel=t,this.logger=xt(this.context).getInstance().getLogger(`ContentClient-${t.nodeIdShort}`),this.eventBus=Ct(this.context).getInstance(),this.contentCacheService=qs(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.streamingStats=_r(this.context).getInstance(),this.contentAbortManager=uo(this.context).createInstance(t.nodeIdShort)}destroy(){var t;this.eventBus.offAll({scope:this}),this.contentAbortManager.destroy(),null===(t=this.contentCacheService)||void 0===t||t.findAllContentCache().filter((t=>t.dataChannelId===this.dataChannel.identifier&&!t.isFinished)).forEach((t=>{this.contentCacheService.errorContentCache(t,!0,"p2p-closed")})),this.contentCacheService=null}requestContent(t){let e=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id});e||(e=this.createContentCache(t)),e.requested=!0,t.external&&(e.external=!0),e.duration=t.duration;const n={contentId:t.id,duration:e.duration,type:"content-request"};this.logger.trace(`Requesting contentId: ${t.id} - cacheSeq: ${e.seq} - retries: ${e.retries} from nodeId: ${this.dataChannel.nodeIdShort}`),this.logger.debug(Ut.sentContentRequest(this.dataChannel.nodeIdShort,n.contentId,n.duration)),this.dataChannel.write(n),this.contentAbortManager.armAbortTimer(e)}createContentCache(t){t.cachePolicy||(t.cachePolicy=Yi.Policy.CACHEABLE),t.representationId||(t.representationId=this.polyNet.representationId);const e=new Yi(t,{origin:Yi.Origin.WEB_RTC,dataChannelId:this.dataChannel.identifier,bitrate:this.streamingStats.findBitrate(t.representationId)||this.streamingStats.bitrate},this.context);return this.contentCacheService.createContentCache(e),e}handleContentMessage(t){switch(t.type){case"content-response-start":case"content-response-progress":case"content-response-end":return void this.handleContentResponse(t);case"content-aborted":return void this.handleContentAborted(t)}}handleContentResponse(t){const{contentId:e}=t,n=lo(t,["contentId"]);let r=this.contentCacheService.findOneContentCacheByFullId({representationId:this.polyNet.representationId,id:e});this.logContentResponse(t),!r&&this.settings.pushProtocol&&(this.logger.trace(`Received pushed contentId: ${e} from nodeId: ${this.dataChannel.nodeIdShort}`),r=this.createContentCache(Object.assign({id:e},n)),r.external=!0,this.contentAbortManager.armAbortTimer(r)),r?(null==r?void 0:r.isFinished)?this.logger.logOnce(`${e}`,`Received already completed content from nodeId: ${this.dataChannel.nodeIdShort}, contentId: ${e} - cacheSeq: ${null==r?void 0:r.seq} - retries: ${r.retries}.`,It.TRACE):this.updateContentCache(r,t):this.logger.trace(`Received unexpected contentId: ${e} from nodeId: ${this.dataChannel.nodeIdShort}. Is push enabled? = ${this.settings.pushProtocol}`)}logContentResponse(t){"content-response-start"===t.type&&this.logger.debug(Ut.receivedContentResponseStart(this.dataChannel.nodeIdShort,t.contentId,t.contentLength,t.duration)),"content-response-end"===t.type&&this.logger.debug(Ut.receivedContentResponseEnd(this.dataChannel.nodeIdShort,t.contentId,t.contentLength,t.chunksAmount,t.crc32))}handleContentAborted(t){this.logger.debug(Ut.receivedPeerMessage(this.dataChannel.nodeIdShort,JSON.stringify(t)));const e=this.contentCacheService.findOneContentCacheByFullId({representationId:this.polyNet.representationId,id:t.contentId});this.contentCacheService.errorContentCache(e,!0,"p2p-abort"),this.contentAbortManager.delete(e)}updateContentCache(t,e){"content-response-start"===e.type&&(t.contentLength=e.contentLength,t.duration=e.duration),"content-response-progress"===e.type&&t.setChunk(e.chunkId,e.chunkData),"content-response-end"===e.type&&(t.contentLength=e.contentLength,t.expectedCrc32=e.crc32,t.expectedChunksLength!=e.chunksAmount&&this.logger.warn(`Mismatched chunksAmount: ${e.chunksAmount} - expected: ${t.expectedChunksLength} - contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries}.`)),this.contentCacheService.updateContentCache(t),t.checkRemoteFinish()&&(this.logger.trace(`contentId: ${t.id} from nodeId: ${this.dataChannel.nodeIdShort} - cacheSeq: ${t.seq} - retries: ${t.retries} - End`),this.contentCacheService.finishContentCache(t),this.contentAbortManager.delete(t))}});const po=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("ContentRequestService"),this.eventBus=Ct(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.contentCacheService=qs(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance(),this.eventBus.on($t.CONTENT_CACHE_RETRY_NEEDED,this.handleContentCacheRetryNeeded,{scope:this})}destroy(){this.eventBus.offAll({scope:this}),this.polyNet=null,this.contentCacheService=null,this.dataChannelService=null}getDataChannelForRequest(t){let e=this.dataChannelService.findFirstConnectedInbound();return(this.needHttpDataChannel(t)||ot.isNil(e))&&(e=this.dataChannelService.getHttpDataChannel()),e}requestToDataChannel(t){const e=this.getDataChannelForRequest(t);t.retry&&this.logger.trace(`Selected datachannel ${e.isHttp?"CDN":"P2P"} to retry content request: contentId: ${t.id} - representationId: ${t.representationId} - URL: ${t.url}`),e.requestContent(t)}needHttpDataChannel(t){const e=t.retry;return t.cachePolicy===Yi.Policy.NO_CACHEABLE||this.polyNet.isInRepair||e}request(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id});return t.cachePolicy===Yi.Policy.NO_CACHEABLE&&this.logger.debug(Ut.noShareableRequest(t.id,t.url)),n?(n.duration=t.duration,n.isCacheable&&(this.logger.debug(Ut.requestHit(n.id,n.url)),t.external&&(n.external=!0)),!n.isCacheable||n.isFinished||n.requested&&!e||!n.external?this.logger.trace(`contentId: ${t.id} - cacheSeq: ${n.seq} - retries: ${n.retries} - duration: ${n.duration} - Ignored - isFinished: ${n.isFinished} - isRequested: ${n.requested} - isExternal: ${n.external}`):(this.logger.trace(`contentId: ${t.id} - cacheSeq: ${n.seq} - retries: ${n.retries} - duration: ${n.duration} - CACHED incomplete content - Escalating to inbound`),n.retries>0&&(n.origin=this.getDataChannelForRequest(t).isHttp?Yi.Origin.HTTP:Yi.Origin.WEB_RTC),this.requestToDataChannel(t)),n):(t.cachePolicy===Yi.Policy.CACHEABLE&&this.logger.debug(Ut.requestMiss(t.id,t.url)),this.requestToDataChannel(t),n=this.contentCacheService.findOneContentCacheByFullId({representationId:t.representationId,id:t.id}),this.logger.trace(`contentId: ${t.id} - cacheSeq: ${null==n?void 0:n.seq} - retries: ${null==n?void 0:n.retries} - duration: ${null==n?void 0:n.duration} - NOT CACHED - Starting anew`),n)}handleContentCacheRetryNeeded(t){const e=t.contentCache;e&&this.retryRequest(e)}retryRequest(t){try{++t.retries,this.logger.trace(`Retrying content request transparently #${t.retries}: contentId: ${t.id} - cacheSeq: ${null==t?void 0:t.seq} - retries: ${t.retries} - representationId: ${t.representationId} - URL: ${t.url}`),setTimeout((()=>{try{t.options.retry=!0,this.request(t.options)}catch(e){this.logger.error(`Error in retry: contentId: ${null==t?void 0:t.id} - cacheSeq: ${null==t?void 0:t.seq} - retries: ${t.retries} - representationId: ${null==t?void 0:t.representationId}:${e.message}`,e)}}))}catch(e){this.logger.error(`Error in retry: contentId: ${null==t?void 0:t.id} - cacheSeq: ${null==t?void 0:t.seq} - retries: ${t.retries} - representationId: ${null==t?void 0:t.representationId}:${e.message}`,e)}}});const fo=Et.getInstanceFactory(class extends Tt{constructor(t,e){let{representationId:n,contentId:r,url:i}=e;super(),this.queuedChunks=0,this.logger=xt(this.context).getInstance().getLogger(`ContentResponseGenerator-${t.nodeIdShort}`),this.eventBus=Ct(this.context).getInstance(),this.contentRequestService=po(this.context).getInstance(),this.dataChannel=t,this.representationId=n,this.contentId=r,this.url=i,this.nodeIdShort=t.nodeIdShort}start(){}destroy(){this.stop(),this.logger=null,this.dataChannel=null,this.representationId=null,this.contentId=null,this.timeStart=null,this.timeEnd=null,this.contentResponseStartMessageCreated=null,this.sendReject=null,this.sendResolver=null}unsubscribe(){var t;this.eventBus.offAll({scope:this}),null===(t=this.subscription)||void 0===t||t.unsubscribe()}stop(){super.stop(),this.succeed()}sendContent(){return new Promise(((t,e)=>{this.sendResolver=t,this.sendReject=e,this.start(),this.contentCache=this.contentRequestService.request({representationId:this.representationId,id:this.contentId,url:this.url,responseType:"arraybuffer",external:!0}),this.contentCache?this.contentCache.unsafe?this.fail(new Error("Unsafe Content Cache requested")):this.generateMessages(this.contentCache):this.fail(new Error("ContentCache not created synchronously"))}))}generateMessages(t){this.subscription=t.asObservable.subscribe({next:e=>{this.generateContentResponseMessages(t,e)},error:e=>{this.abortContentResponseMessages(t,e)},complete:()=>{this.sendEnd(t),this.succeed()}})}succeed(){var t;this.unsubscribe(),null===(t=this.sendResolver)||void 0===t||t.call(this)}fail(t){var e;this.unsubscribe(),null===(e=this.sendReject)||void 0===e||e.call(this,t)}abortContentResponseMessages(t,e){this.sendAbortContentResponse(t),this.fail(e)}sendAbortContentResponse(t){const e={contentId:t.id,type:"content-aborted"};this.dataChannel.write(e)}generateContentResponseMessages(t,e){this.contentResponseStartMessageCreated||this.generateContentResponseStartMessage(t),e&&this.generateContentResponseProgressMessage(t,e)}sendEnd(t){!this.contentResponseEndMessageCreated&&t.isFinished&&this.generateContentResponseEndMessage(t)}generateContentResponseProgressMessage(t,e){var n;const r={chunkData:e.data,chunkId:e.id,contentId:t.id,type:"content-response-progress"};++this.queuedChunks,this.queuedChunks%100==0&&this.logger.trace(`${this.queuedChunks} chunks sent - contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} - representationId: ${t.representationId}`),null===(n=this.dataChannel)||void 0===n||n.write(r)}generateContentResponseStartMessage(t){var e;this.contentResponseStartMessageCreated=!0,this.logger.trace(`Start sending contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} - representationId: ${t.representationId}`),this.timeStart=performance.now();const n={chunksAmount:t.chunksLength,contentId:t.id,contentLength:t.contentLength||void 0,duration:t.duration||void 0,type:"content-response-start"};this.logger.debug(Ut.sentContentResponseStart(this.dataChannel.nodeIdShort,n.contentId,n.contentLength,n.duration)),null===(e=this.dataChannel)||void 0===e||e.write(n)}generateContentResponseEndMessage(t){var e;this.contentResponseEndMessageCreated=!0;const n={chunksAmount:t.chunksLength,contentId:t.id,contentLength:t.contentLength,crc32:t.crc32,type:"content-response-end"};this.logger.debug(Ut.sentContentResponseEnd(this.dataChannel.nodeIdShort,n.contentId,n.contentLength,n.chunksAmount,n.crc32)),null===(e=this.dataChannel)||void 0===e||e.write(n),this.timeEnd=performance.now(),this.logger.trace(`Finished sending ${this.queuedChunks} chunks contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} - representationId: ${t.representationId} in ${this.timeEnd-this.timeStart} ms`)}});var go=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};const yo=Et.getInstanceFactory(class extends Tt{constructor(t){super(),this.maxRequestedContentId=0,this.dataChannel=t,this.logger=xt(this.context).getInstance().getLogger(`ContentServer-${t.nodeIdShort}`),this.eventBus=Ct(this.context).getInstance(),this.contentCacheService=qs(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.initContentSent()}initContentSent(){this.contentSent=new Map}start(){this.eventBus.on($t.CONTENT_CACHE_CONTENT_CREATED,this.handleContentCacheEvent,{scope:this}),this.eventBus.on($t.CONTENT_CACHE_CONTENT_UPDATED,this.handleContentCacheEvent,{scope:this})}destroy(){this.contentSent.forEach((t=>{null==t||t.destroy()})),this.contentSent.clear(),this.contentSent=null,this.eventBus.offAll({scope:this})}handleContentRequestMessage(t){return go(this,void 0,void 0,(function*(){this.logger.debug(Ut.receivedContentRequest(this.dataChannel.nodeIdShort,t.contentId,t.duration));const e=this.polyNet.representationId,n=t.contentId;if(this.settings.kickMismatchedVodDvrChildren&&"live"!=this.stats.stream.streamState){const t=$s.resolveStreamInfo(this.context,e,n);if(!t)return this.dataChannelService.removeDataChannel(this.dataChannel),void this.logger.debug(`kicked ${this.dataChannel.nodeIdShort} requested segment not in parent manifest yet`);if(this.contentCacheService.safeCacheRange){const e=this.contentCacheService.safeCacheRange,n=$s.getRelativeOriginTime(t);if(n<e[0]||n>e[1])return this.dataChannelService.removeDataChannel(this.dataChannel),void this.logger.debug(`kicked ${this.dataChannel.nodeIdShort} requested outside of safe cache range ${n} - ${JSON.stringify(e)}`)}}const r=parseInt(n);r>this.maxRequestedContentId&&(this.maxRequestedContentId=r),yield this.sendContent(e,n),this.firstRequestReceived||(this.initialPushFrom(e,n),this.firstRequestReceived=!0)}))}sendContent(t,e,n){var r,i,s;return go(this,void 0,void 0,(function*(){const o=this.getKey(t,e);if(!this.contentSent)return void this.logger.trace(`Ignore send content contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort}, because was destroyed`);if(null===(r=this.contentSent)||void 0===r?void 0:r.has(o))return void this.logger.trace(`Ignore send content contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort}, because ALREADY sending`);const a=fo(this.context).createInstance(this.dataChannel,{representationId:t,contentId:e,url:n});this.logger.trace(`Sending content contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort}`);try{this.contentSent.set(o,a),yield a.sendContent(),null===(i=this.contentSent)||void 0===i||i.delete(o),this.logger.trace(`Done send content contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort}`)}catch(n){this.logger.trace(`Failed send content contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort} - reason: ${n}`),null===(s=this.contentSent)||void 0===s||s.delete(o)}finally{this.logger.trace(`Clearing responder for contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort}`),null==a||a.destroy()}}))}initialPushFrom(t,e){this.settings.pushProtocol&&this.settings.initialBurstPush&&(this.logger.trace(`Pushing initial burst: Contents AFTER contentId: ${e} - representationId: ${t} to nodeId: ${this.dataChannel.nodeIdShort}`),this.contentCacheService.findAllCacheable().filter((e=>e.representationId===t)).filter((t=>!t.unsafe)).filter((t=>Number(t.id)>Number(e))).sort(((t,e)=>Number(t.id)-Number(e.id))).forEach((n=>go(this,void 0,void 0,(function*(){this.logger.trace(`Pushing content contentId: ${e} - representationId: ${t} - cacheSeq: ${n.seq} - retries: ${n.retries} to nodeId: ${this.dataChannel.nodeIdShort}`),yield this.sendContent(t,n.id)})))))}handleContentCacheEvent(t){return go(this,void 0,void 0,(function*(){const e=t.contentCache;if(!e.isCacheable||!this.settings.pushProtocol||!this.firstRequestReceived)return;if("number"==typeof e.id&&e.id<this.maxRequestedContentId)return;const n=this.getKey(e.representationId,e.id),r=this.contentSent.get(n);ot.isNil(r)?yield this.sendContent(e.representationId,e.id,e.url):e.external=!0}))}getKey(t,e){return`${t}:${e}`}});const mo=Et.getInstanceFactory(class extends Tt{constructor(t){super(),this.dataChannel=t,this.eventBus=Ct(this.context).getInstance(),this.contentClient=ho(this.context).createInstance(this.dataChannel),this.contentServer=yo(this.context).createInstance(this.dataChannel)}start(){this.contentClient.start(),this.contentServer.start()}destroy(){this.eventBus.offAll({scope:this}),this.contentClient.destroy(),this.contentServer.destroy(),this.contentClient=null,this.contentServer=null}requestContent(t){this.contentClient.requestContent(t)}handleContentMessage(t){switch(t.type){case"content-request":return void this.contentServer.handleContentRequestMessage(t);case"content-response-start":case"content-response-progress":case"content-response-end":case"content-aborted":return void this.contentClient.handleContentMessage(t)}}});class bo extends Tt{constructor(t){super(),this.logger=xt(this.context).getInstance().getLogger(`WebRTCProtocol-${t.isInbound?"Inbound":"Outbound"}-${t.nodeIdShort}`),this.eventBus=Ct(this.context).getInstance(),this.contentManager=mo(this.context).createInstance(t),this.rttCalculator=oo(this.context).createInstance(t),this.stillAlive=co(this.context).createInstance(t),this.metrics=Ys(this.context).createInstance(t),this.signaling=io(this.context).createInstance(t),t.isInbound&&(this.loopChecker=zs(this.context).createInstance(t)),this.dataChannel=t}preStart(){this.dataChannel.isInbound&&this.loopChecker&&this.loopChecker.start()}start(){this.dataChannel.isOutbound?(this.contentManager.start(),this.stillAlive.start()):(this.rttCalculator.start(),this.metrics.start())}dispose(){}destroy(){var t,e,n,r,i;null===(t=this.rttCalculator)||void 0===t||t.destroy(),null===(e=this.stillAlive)||void 0===e||e.destroy(),null===(n=this.metrics)||void 0===n||n.destroy(),null===(r=this.loopChecker)||void 0===r||r.destroy(),null===(i=this.contentManager)||void 0===i||i.destroy(),this.dataChannel=null,this.rttCalculator=null,this.stillAlive=null,this.loopChecker=null}requestContent(t){this.contentManager.requestContent(t)}sendSignalingTakeControl(){this.signaling.sendSignalingTakeControlMessage()}handleSignalingEvent(t){this.signaling.handleSignalingEvent(t)}handleWsSignalingMessage(t){this.signaling.handleWsSignalingMessage(t)}handleConnectionWebRTCMessageEvent(t){switch(this.stillAlive.markAsAlive(),t.type){case"signaling-sdp":case"signaling-candidate":case"signaling-take-control":return void this.signaling.handleSignalingMessage(t);case"content-request":case"content-response-start":case"content-response-progress":case"content-response-end":case"content-aborted":return void this.contentManager.handleContentMessage(t);case"ping":case"pong":this.rttCalculator.handlePingPongMessage(t);break;case"still-alive-request":case"still-alive-response":this.stillAlive.handleStillAliveMessage(t);break;case"metrics":this.metrics.handleMetricsMessage(t);break;case"loop-check":this.handleLoopCheckMessage(t)}}handleLoopCheckMessage(t){this.logger.debug(Ut.receivedLoopCheck(this.dataChannel.nodeIdShort,t.nodeId)),this.dataChannel.isInbound?this.logger.trace(`Ignoring LoopCheck coming from INBOUND nodeId: ${this.dataChannel.nodeIdShort}`):this.eventBus.emit($t.LOOP_CHECK_MESSAGE_RECEIVED,{correlationId:t.correlationId,finalCountdown:t.finalCountdown,nodeId:t.nodeId})}}bo.polyNetFactoryName="WebRTCProtocol",bo.PROTOCOL_VERSION=7;const vo=Et.getInstanceFactory(bo);var wo=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class So extends Ds{constructor(t){super(Object.assign(Object.assign({},t),{type:Ds.Type.WEB_RTC})),this.useSequentialOpening=!1,this.useTrickle=!0,this.nextConnectionId=0,this.masterInitialized=!1,this.signalingConnectionId=void 0,this.settings=On(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`DataChannelWebRTC-${this.nodeIdShort}`),this.connectedPeers=new Set,this._isReady=!1,this.protocol=vo(this.context).createInstance(this),this.connection.on("open",(t=>{let{connectionId:e}=t;this.connectedPeers.add(e),this.logger.debug(Ut.dataChannelPeerOpen(e,this.nodeIdShort)),this.isInbound&&this.handleMasterOpening(e),this.didTakeControl&&this.useSequentialOpening&&e>1&&this.startConnectionSequential(e+1),this.checkReady()})),this.connection.on("signal",(t=>{this.protocol.handleSignalingEvent(t)})),this.connection.on("data",(t=>{this.protocol.handleConnectionWebRTCMessageEvent(t)})),this.connection.on("close",(t=>{let{connectionId:e}=t;this.connectedPeers.has(e)?(this.logger.trace(`Connection WebRTC closed for nodeId: ${this.identifier}`),this.eventBus.emit($t.CONNECTION_WEB_RTC_CLOSED,{target:this,dataChannel:this})):e<2&&this.logger.trace(`Signaling connectionId: ${e} closed for nodeId: ${this.identifier}`)})),this.connection.on("error",(t=>{this.logger.warn(`Connection WebRTC failed for nodeId: ${this.identifier} - reason: ${t.message}`)})),this.connection.on("sctp_debug_event",(t=>{let e=`${t.type}`;delete t.type;for(const n in t)e+=` - ${n}: ${t[n]}`;this.logger.trace(`nodeId: ${this.nodeIdShort} - ${e}`)})),this.scheduleTimerForDataChannelCreation()}handleRemoteMasterOpening(t){!ot.isNil(this.signalingConnectionId)||this.isInbound||t<2||(this.signalingConnectionId=0,this.logger.debug(Ut.openAdditionalConnections("Inbound")))}handleMasterOpening(t){!ot.isNil(this.signalingConnectionId)||t>1||(this.protocol.preStart(),this.signalingConnectionId=t,0===t?(this.logger.debug(Ut.openAdditionalConnections("Inbound")),this.openMultiPeerConnections()):1===t&&(this.logger.debug(Ut.openAdditionalConnections("Outbound")),this.protocol.sendSignalingTakeControl()))}get didTakeControl(){return this.isInbound&&0===this.signalingConnectionId||this.isOutbound&&1===this.signalingConnectionId}get minConnectedPeersCount(){return Math.ceil(this.connectionsCount*this.settings.multiPeer.minPercentReady)||1}get connectedPeersCount(){return this.connectedPeers.size}get peeringType(){return this._peeringType}set peeringType(t){switch(t){case Ds.PeeringType.LAN:case Ds.PeeringType.INTRA_ASN:case Ds.PeeringType.INTER_ASN:this._peeringType=t;break;default:this._peeringType=Ds.PeeringType.INTER_ASN}}handleWsSignalingMessage(t){this.protocol.handleWsSignalingMessage(t)}takeControl(){this.signalingConnectionId=1,this.logger.debug(Ut.openAdditionalConnections("Outbound")),this.openMultiPeerConnections()}signal(t){this.startConnection(!1,t.connectionId),this.connection.signal(t)}start(){this.updateState(Ds.State.CONNECTING)}updateState(t){this.logger.debug(Ut.dataChannelState(this.connection.transport,t,this.nodeIdShort)),super.updateState(t)}destroy(){const t=Object.create(null,{destroy:{get:()=>super.destroy}});return wo(this,void 0,void 0,(function*(){this.connection.removeAllListeners(),this.cancelTimerForDataChannelCreation(),yield t.destroy.call(this)}))}static get isTrickleIceSupported(){return dr.isTrickleIceSupported}checkReady(){this.connectedPeersCount<this.minConnectedPeersCount||this._isReady||(this._isReady=!0,this.logger.debug(Ut.dataChannelIsReady(this.nodeIdShort)),this.handleConnectionWebRTCChannelOpenEvent())}startConnection(t,e){var n,r;null===(n=this.connection)||void 0===n||n.configure("sctp",{ordered:!0,rtcConfiguration:{iceServers:this.settings.apiKey.stunServerUrl.map((t=>({urls:t})))},trickle:this.useTrickle,count:this.connectionsCount}),null===(r=this.connection)||void 0===r||r.startConnection(t,e)}startConnectionConcurrent(t){for(let e=t;e<this.connectionsCount;e++)this.startConnection(!0,e)}startConnectionSequential(t){if(this.nextConnectionId>=this.connectionsCount)return;if(t!==this.nextConnectionId)return;if(t<2)return;(t=>{0!==this.settings.multiPeer.singleConnectionTimeout&&window.setTimeout((()=>{this.isClosed||this.connectedPeers.has(t)||(this.logger.trace(`Timeout of WebRTC nodeId: ${this.identifier} connectionId: ${t} `),this.startConnectionSequential(t+1))}),this.settings.multiPeer.singleConnectionTimeout)})(t),this.startConnection(!0,t),this.nextConnectionId++}openMasterConnection(){if(this.masterInitialized)return;this.masterInitialized=!0;const t=this.isInbound?0:1;this.startConnection(!0,t)}openMultiPeerConnections(){this.logger.debug(Ut.multiPeerOpeningType(this.useSequentialOpening)),this.useSequentialOpening?(this.nextConnectionId=2,this.startConnectionSequential(2)):this.startConnectionConcurrent(2)}scheduleTimerForDataChannelCreation(){var t;const e=null===(t=this.settings)||void 0===t?void 0:t.timeoutP2PConnection;ot.isNil(e)||e<=0||this.creationTimeout||(this.logger.trace(`Scheduling Timeout for WebRTC data channel nodeId: ${this.nodeIdShort}`),this.creationTimeout=window.setTimeout((()=>{this.logger.trace(`Triggered Timeout WebRTC data channel nodeId: ${this.nodeIdShort} -> Reporting`),this.cancelTimerForDataChannelCreation(),this.eventBus.emit($t.DATA_CHANNEL_CONNECTING_TIMEOUT,{target:this,dataChannel:this})}),e))}cancelTimerForDataChannelCreation(){this.creationTimeout&&(this.logger.trace(`Canceling Timeout for WebRTC data channel nodeId: ${this.nodeIdShort}`),window.clearTimeout(this.creationTimeout),this.creationTimeout=null)}requestContent(t){this.protocol.requestContent(t)}handleConnectionWebRTCChannelOpenEvent(){this.cancelTimerForDataChannelCreation(),this.updateState(Ds.State.CONNECTED),this.protocol.start(),this.eventBus.emit($t.DATA_CHANNEL_CONNECTED,{target:this,dataChannel:this})}}So.polyNetFactoryName="DataChannelWebRTC",So.SUPPORTED_PROTOCOLS_VERSION=[bo.PROTOCOL_VERSION];const Eo=Et.getInstanceFactory(So);const _o=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("DataChannelService"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.store=Bs(this.context).createInstance(),this.createFallback()}destroy(){for(const t of this.store)t.destroy();this.store.destroy()}getHttpDataChannel(){return this.fallbackDataChannel}isCollector(){return!this.findOneByQuery({direction:Ds.Direction.INBOUND,type:Ds.Type.WEB_RTC})}hasConnectedWebRTCInbounds(){return this.findAllByQuery({direction:Ds.Direction.INBOUND,type:Ds.Type.WEB_RTC,state:Ds.State.CONNECTED}).length>0}hasOutbounds(){return this.findAllOutbound().length>0}createDataChannel(t){return this.store.add(t),this.eventBus.emit($t.DATA_CHANNEL_CREATED,{target:t,dataChannel:t}),t}removeDataChannel(t){const e=this.store.remove(t);if(e)return this.logger.trace(`Remove DataChannel - Removing datachannel nodeId: ${t.nodeIdShort}`),t.destroy(),this.eventBus.emit($t.DATA_CHANNEL_REMOVED,{target:t,dataChannel:t}),e;this.logger.trace(`Remove DataChannel - DataChannel nodeId: ${t.nodeIdShort} not found`)}findAllByDirection(t){return this.findAllByQuery({direction:t})}findAllInbound(){return this.findAllByDirection(Ds.Direction.INBOUND)}findAllOutbound(){return this.findAllByDirection(Ds.Direction.OUTBOUND).filter((t=>t.isConnecting||t.isConnected))}findAllConnectingOutbounds(){return this.findAllByQuery({direction:Ds.Direction.OUTBOUND,state:Ds.State.CONNECTING})}findByNodeId(t){return this.store.findByQuery({nodeId:t})}findByIdentifier(t){return this.store.findByQuery({identifier:t})}findByReverseIdentifier(t){if(t)return t=t.split(":").reverse().join(":"),this.findByIdentifier(t)}findFirstInbound(){return this.findAllInbound()[0]}findFirstInboundWebRTC(){return this.findAllByQuery({direction:Ds.Direction.INBOUND,type:Ds.Type.WEB_RTC})[0]}findFirstConnectedInbound(){return this.store.findAllByQuery({direction:Ds.Direction.INBOUND,state:Ds.State.CONNECTED})[0]}findFirstConnectedInboundWebRTC(){return this.findAllByQuery({direction:Ds.Direction.INBOUND,type:Ds.Type.WEB_RTC,state:Ds.State.CONNECTED})[0]}findOneByQuery(t){return this.store.findByQuery(t)}findAllByQuery(t){return this.store.findAllByQuery(t)}countAllOutbounds(){return this.findAllOutbound().length}countAllConnectingOutbounds(){return this.findAllConnectingOutbounds().length}createDataChannelWebRTC(t,e){const n=t=>{(t.event!==$t.DATA_CHANNEL_CONNECTING_TIMEOUT||this.settings.enableTimeoutP2PConnection)&&this.removeDataChannel(r)},r=Eo(this.context).createInstance({identifier:t,direction:e});return this.createDataChannel(r),this.eventBus.on($t.CONNECTION_WEB_RTC_CLOSED,n,{scope:this,target:r}),this.eventBus.on($t.DATA_CHANNEL_CONNECTING_TIMEOUT,n,{scope:this,target:r}),this.eventBus.on($t.DATA_CHANNEL_STILL_ALIVE_TIMEOUT,n,{scope:this,target:r}),r.start(),r}createFallback(){const t={direction:Ds.Direction.INBOUND,identifier:"HTTP"};this.fallbackDataChannel=Vs(this.context).createInstance(t),this.fallbackDataChannel.start()}});class Co extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("BufferHealthChecker"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.bufferHealthTimer=Ss(this.context).createInstance(),this.eventBus.on($t.SETTINGS_CHANGED,this.handleSettingsChanged,{scope:this}),this.eventBus.on($t.STREAM_INFO,this.handleStreamInfo,{scope:this})}start(){this.scheduleTimerForBufferHealth()}destroy(){this.eventBus&&(this.eventBus.offAll({scope:this}),this.bufferHealthTimer.cancel(),this.logger=null,this.eventBus=null,this.settings=null,this.dataChannelService=null,this.stats=null,this.bufferHealthTimer=null)}scheduleTimerForBufferHealth(){var t;if(!this.bufferHealthTimer)return;this.bufferHealthTimer.isRunning&&this.bufferHealthTimer.cancel();const e=null===(t=this.settings)||void 0===t?void 0:t.bufferHealthPeriod;!ot.isFinite(e)||e<=0||(this.logger.debug(Ut.bufferHealthEnabled()),this.bufferHealthTimer.setInterval("BufferHealthChecker",e,(()=>this.checkBufferHealth()),!0))}checkBufferHealth(){var t,e,n;const r=null===(t=this.stats)||void 0===t?void 0:t.playback.bufferHealth,i=null===(e=this.settings)||void 0===e?void 0:e.bufferHealthThreshold,s=null===(n=this.settings)||void 0===n?void 0:n.bufferHealthDelta;return[r,i,s].every(ot.isFinite)?this.polyNet.isInRepair&&r>=i+s?(this.polyNet.updateMode(jn.Modes.DEFAULT),void this.logger.debug(Ut.bufferHealthStable(r,i,s))):!this.polyNet.isInRepair&&r<i?(this.polyNet.updateMode(jn.Modes.REPAIRING),void this.goCritical(r,i,s)):void 0:(this.logger.warn("The buffer health value has not been set, setting repair"),void this.polyNet.updateMode(jn.Modes.REPAIRING))}goCritical(t,e,n){const r=this.dataChannelService.findFirstConnectedInboundWebRTC();r?(this.logger.debug(Ut.bufferHealthCriticalP2P(t,e,n)),this.requestRepair(e,t,r)):this.logger.logWhenChange("bufferHealthCritical",Ut.bufferHealthCriticalCDN(t,e,n))}requestRepair(t,e,n){this.eventBus.emit($t.LOG_REQUEST_REPAIR,{target:this}),this.eventBus.emit($t.REQUEST_REPAIR,{bufferHealth:e,bufferHealthThreshold:t,dataChannel:n,reason:`Low buffer health: ${e.toFixed(4)} / ${t.toFixed(4)}`,target:this})}handleSettingsChanged(t){var e;void 0!==(null!==(e=null==t?void 0:t.diffSettings)&&void 0!==e?e:{}).bufferHealthPeriod&&this.scheduleTimerForBufferHealth()}handleStreamInfo(t){if(!this.settings)return;const{streamInfo:e}=t;if(!e.fragment)return;const n=e.fragment.duration;if(!n)return;const r=Math.round(this.settings.nextSegmentDurationFactor*n),i=Math.round(this.settings.bufferHealthThresholdRatio*r);this.settings.bufferHealthThreshold===r&&this.settings.bufferHealthDelta===i||(this.logger.logWhenChange("newBufferThreshold",Ut.newBufferThreshold(r,i,n)),this.settings.setup({bufferHealthDelta:i,bufferHealthThreshold:r}))}}Co.polyNetFactoryName="BufferHealthChecker";const To=Et.getInstanceFactory(Co);class Io extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("MessageValidator"),this.polyNet=Un(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance()}destroy(){this.logger=null,this.polyNet=null,this.settings=null,this.stats=null,this.dataChannelService=null}checkPeerToPeerHandshake(t){let e;return e=this.checkSharingContent(),e.error?e:(e=this.checkStreamID(t),e.error?e:(e=this.checkRepresentationID(t),e.error?e:(e=this.checkMaxOutboundConnections(),e.error||(e=this.checkMaxConcurrentPeerNegotiations(),e.error),e)))}isPeerToPeerMessageForCurrentNode(t){return this.polyNet.nodeId===t.to}checkSharingContent(){const t=this.settings.sharingContent,e=this.stats.platform.connectionType;return Bn.isAllowedToShare(t,e)?{error:!1}:"cellular"===e?this.createKickMessage(Io.ErrorMessages.SharingContentCellular):this.createKickMessage(Io.ErrorMessages.SharingContentNever)}isPeerToPeerHandshake(t){return t.payload.messageType===to.Messages.HANDSHAKE_REQUEST}isValidPeerToPeerMessageType(t){return!!t.payload&&Object.values(to.Messages).includes(t.payload.messageType)}checkStreamID(t){return t.payload.streamId!==this.polyNet.streamId?this.createKickMessage(Io.ErrorMessages.StreamIDNotSupported):{error:!1}}checkRepresentationID(t){return t.payload.representationId!==this.polyNet.representationId?this.createKickMessage(Io.ErrorMessages.RepresentationNotSupported):{error:!1}}checkMaxOutboundConnections(){const t=this.settings.maxOutbound;return this.dataChannelService.countAllOutbounds()>=t?this.createKickMessage(`${Io.ErrorMessages.MaxChildren}: ${t}`):{error:!1}}checkMaxConcurrentPeerNegotiations(){const t=this.settings.maxConcurrentPeerNegotiation;return this.dataChannelService.countAllConnectingOutbounds()>=t?this.createKickMessage(`${Io.ErrorMessages.MaxConcurrentNegotiations}: ${t}`):{error:!1}}createKickMessage(t,e){return this.logger.warn(`${t} -> Sending KICK message`),{error:!0,message:t,messageType:to.Messages.KICK,timeout:e}}}Io.polyNetFactoryName="MessageValidator",function(t){let e;!function(t){t.LoopDetected="Loop detected",t.MaxChildren="Maximum children reached",t.MaxConcurrentNegotiations="Maximum concurrent peer negotiations reached",t.RepresentationNotSupported="Representation not supported",t.SharingContentCellular="Not allowed outbound data channels on cellular network",t.SharingContentNever="Sharing content disabled by settings",t.StreamIDNotSupported="StreamId not supported"}(e=t.ErrorMessages||(t.ErrorMessages={}))}(Io||(Io={}));const No=Et.getInstanceFactory(Io);var Ro=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class Oo extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("CapacitySensor"),this.dataChannelService=_o(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.timer=Ss(this.context).createInstance(),this.statsTimer=Ss(this.context).createInstance(),this.sensingTimeoutTimer=Ss(this.context).createInstance(),this.sensingOutbounds=[],this.cancellationToken=new vt,this.running=!1}destroy(){this.stop(),this.stats=null,this.dataChannelService=null,this.settings=null,this.timer=null,this.statsTimer=null,this.sensingOutbounds=null,this.cancellationToken=null}stop(){this.timer&&(this.running=!1,this.timer.cancel(),this.statsTimer.cancel(),this.sensingTimeoutTimer.cancel(),this.uncorkOutbounds(),this.sensingOutbounds=[],this.cancellationToken.emit("cancel",{}),this.cancellationToken.offAll())}get isRunning(){return this.running}getBitsToSend(t){if(!ot.isNil(this.stats.stream.bitrate))return this.stats.stream.bitrate*t*this.settings.teca.sensingIncreaseFactor*this.settings.teca.bfrTimesToIncrease*Oo.STATS_TIME_WINDOW/1e3}estimateCapacity(t){this.running=!0;const e=this.getBitsToSend(t);return ot.isNil(e)?(this.running=!1,Promise.resolve(void 0)):(this.logger.debug(Ut.sensingStart(t,e)),this.sensingOutbounds=this.getOutbounds(),ot.isNil(this.sensingOutbounds)||ot.isEmpty(this.sensingOutbounds)?(this.running=!1,Promise.reject("Empty outbound list")):new Promise(((t,n)=>Ro(this,void 0,void 0,(function*(){this.sensingTimeoutTimer.setTimeout("SensingTimeout",this.settings.teca.sensingTimeout,(()=>{this.logger.warn(Ut.sensingTimeout()),this.stop(),n("Sensing timeout")})),this.corkOutbounds(),this.waitForSendBuffered(e).then((e=>{const n=this.processStats(e.reports);this.sensingTimeoutTimer.cancel(),this.logger.debug(Ut.sensingEnded(n)),t(n)})).catch((t=>(this.stop(),this.logger.warn(Ut.invalidSensingResult()),n(t)))).finally((()=>{this.startTime=void 0,this.running=!1}));try{yield this.waitForAccumulateBuffer(e),this.timer.cancel()}catch(t){return this.stop(),this.logger.warn(Ut.invalidSensingResult()),n(t)}this.startTime=(new Date).getTime(),this.logger.debug(Ut.uncorkingOutbounds()),this.uncorkOutbounds()})))))}waitForAccumulateBuffer(t){return new Promise(((e,n)=>{if(ot.isEmpty(this.sensingOutbounds))return n("Unable to get buffered data");this.cancellationToken.on("cancel",(()=>(this.timer.cancel(),n("Cancelled")))),this.timer.setInterval("SensingBuffer",10,(()=>{var r;const i=8*(null===(r=this.sensingOutbounds)||void 0===r?void 0:r.reduce(((t,e)=>(null==e?void 0:e.writableBufferSize)+t),0));return ot.isFinite(i)?i>=t?(this.timer.cancel(),e()):void 0:(this.timer.cancel(),n("Invalid buffer size"))}))}))}static diffStats(t,e){return ot.zip(t,e).map((t=>{const[e,n]=t;return{bitsSentDelta:8*(e.bytesSent-n.bytesSent),connectionId:e.connectionId,diff:e.timestamp-n.timestamp,nodeId:e.nodeId,timestamp:e.timestamp}}))}waitForSendBuffered(t){return new Promise(((e,n)=>{let r;this.cancellationToken.on("cancel",(()=>(this.statsTimer.cancel(),n("Cancelled"))));const i=[];this.statsTimer.setInterval("SensingStats",Oo.STATS_TIME_WINDOW,(()=>Ro(this,void 0,void 0,(function*(){var s;let o;try{o=yield this.getProcessedStats()}catch(t){return null===(s=this.statsTimer)||void 0===s||s.cancel(),n("Unable to get WebRTC stats")}if(ot.isNil(o))return;if(ot.isNil(r))return void(r=o);let a=Oo.diffStats(o,r);if(a.some((t=>t.bitsSentDelta<0||!ot.isFinite(t.bitsSentDelta))))return this.logger.warn(Ut.overflowBytesSent()),this.statsTimer.cancel(),n("Overflow in bytes send value");r=o,a=a.filter((t=>!ot.isNil(this.startTime)&&t.timestamp>=this.startTime));let c=i.reduce(((t,e)=>t+e.bitsSentDelta),0);for(const n of a)if(c+=n.bitsSentDelta,i.push(n),c>=t)return this.statsTimer.cancel(),e({bitsSent:c,startTime:this.startTime,reports:i})}))),!0)}))}processStats(t){const e=new Map;for(const n of t){const t=Math.floor(n.timestamp/Oo.STATS_TIME_WINDOW)*Oo.STATS_TIME_WINDOW;ot.isNil(e.get(t))&&e.set(t,0),e.set(t,e.get(t)+n.bitsSentDelta)}let n,r,i=Array.from(e.entries()).map((t=>({timestamp:t[0],bitsSent:t[1]})));i=ot.sortBy(i,"timestamp");let s=0;const o=this.getNumberOfPeerConnections();for(const t of i)t.bitsSent/o>=Oo.MIN_BITS_SENT_THRESHOLD&&(s+=t.bitsSent,ot.isNil(n)&&(n=t.timestamp),r=t.timestamp);if(n-=Oo.STATS_TIME_WINDOW,ot.isNil(r)||ot.isNil(this.stats.stream.bitrate))return void this.logger.warn(Ut.invalidSensingResult());return s/((r-n)/1e3)/this.stats.stream.bitrate}getProcessedStats(){return Ro(this,void 0,void 0,(function*(){let t=yield Promise.all(this.sensingOutbounds.map((t=>Ro(this,void 0,void 0,(function*(){const e=yield t.getStats();if(e)return e.map((e=>({bytesSent:e.stats.bytesSent,connectionId:e.connectionId,nodeId:t.nodeId,timestamp:e.stats.timestamp})))})))));return t=t.filter((t=>!ot.isNil(t))),t.flat()}))}corkOutbounds(){this.sensingOutbounds.forEach((t=>null==t?void 0:t.cork()))}uncorkOutbounds(){this.sensingOutbounds.forEach((t=>null==t?void 0:t.uncork()))}getNumberOfPeerConnections(){return this.sensingOutbounds.reduce(((t,e)=>t+((null==e?void 0:e.connectionCount)||0)),0)}getOutbounds(){return[...this.dataChannelService.findAllOutbound()]}}Oo.polyNetFactoryName="CapacitySensor",Oo.STATS_TIME_WINDOW=50,Oo.MIN_BITS_SENT_THRESHOLD=3125;const Ao=Et.getInstanceFactory(Oo);function xo(t){return t.filter(((e,n)=>e!==t[n-1]))}function Po(t){const e=ot.sortBy(t);if(0===e.length)return;const n=e.length/2;return e.length%2==0?(e[n]+e[n-1])/2:e[Math.floor(n)]}class ko{constructor(t){this._array=[],this.maxUniqueValues=t}get asArray(){return this._array}get length(){return this._array.length}get uniqueCount(){return new Set(this._array).size}get median(){return Po(xo(this.asArray))}clear(){this._array.splice(0)}filter(t){return this._array.filter(t)}push(){return this._array.push(...arguments),this.uniqueValuesSieve(),this._array.length}uniqueValuesSieve(){for(;this.uniqueCount>this.maxUniqueValues&&this._array.length>0;)this._array.shift()}*[Symbol.iterator](){yield*this._array}}class Lo{constructor(t){this._array=[],this.maxUniqueValues=t}get asArray(){return this._array}get length(){return this._array.length}get bfrs(){return this._array.map((t=>Array.from(t.values()).reduce(((t,e)=>t+e),0)))}get median(){return Po(xo(this.bfrs))}clear(){this._array.splice(0)}filter(t){return this._array.filter(t)}push(t){return this._array.push(t),this.uniqueValuesSieve(),this._array.length}uniqueValuesSieve(){for(;this.uniqueCount>this.maxUniqueValues&&this._array.length>0;)this._array.shift()}get uniqueCount(){return ot.uniqWith(this._array,ot.isEqual).length}}class Do{constructor(){this.representations=new Map}get(t){return this.representations.get(t)}set(t,e){const n=this.representations.get(t)||{};this.representations.set(t,ot.merge(n,e,{representationId:t}))}filter(t){const e=[];return this.representations.forEach((n=>{t(n)&&e.push(n)})),e}}const Mo=Et.getInstanceFactory(class extends Tt{constructor(){super(),this.settings=On(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance(),this.historicalInboundBfrs=new ko(this.settings.teca.bfrHistoryUniqueDesiredValues),this.historicalMapOutboundBfr=new Lo(this.settings.teca.bfrHistoryUniqueDesiredValues),this.historicalSensedCapacities=new ko(this.settings.teca.minimalRequiredSensedCapacities),this.representations=new Do}get capacity(){return this._capacity}set capacity(t){this._lastCapacity=this._capacity,this._capacity=t}get capacityInt(){return Math.floor(this.capacity)}get lastCapacity(){return this._lastCapacity}get capacityDidChange(){return this._lastCapacity!==this._capacity}addInboundBfr(t){this.historicalInboundBfrs.push(t)}addOutboundBfr(t){this.historicalMapOutboundBfr.push(t)}addSensedCapacity(t){this.historicalSensedCapacities.push(t)}get medianInboundBfr(){return this.historicalInboundBfrs.median}get medianOutboundBfr(){return this.historicalMapOutboundBfr.median}get countUniqueInboundBfrs(){return this.historicalInboundBfrs.uniqueCount}get countUniqueOutboundBfrs(){return this.historicalMapOutboundBfr.uniqueCount}get isInboundBfrValid(){return this.historicalInboundBfrs.uniqueCount>=this.settings.teca.bfrHistoryUniqueDesiredValues}get isOutboundBfrValid(){return this.historicalMapOutboundBfr.uniqueCount>=this.settings.teca.bfrHistoryUniqueDesiredValues}get countInboundBfrs(){return this.historicalInboundBfrs.length}get countOutboundBfrs(){return this.historicalMapOutboundBfr.length}get allInboundBfrs(){return this.historicalInboundBfrs.asArray}get allOutboundBfrs(){return this.historicalMapOutboundBfr.asArray}getOutboundBfrsFromChild(t){return this.historicalMapOutboundBfr.asArray.map((e=>e.get(t))).filter((t=>ot.isFinite(t)))}get countSensedCapacities(){return this.historicalSensedCapacities.length}get totalIncreaseCandidates(){return this.historicalSensedCapacities.filter((t=>t>=this.settings.teca.bfrTimesToIncrease)).length}clearInboundBfr(){this.historicalInboundBfrs.clear()}clearOutboundBfr(){this.historicalMapOutboundBfr.clear()}clearSensedCapacities(){this.historicalSensedCapacities.clear()}setLastSensingNow(){this.timeSinceLastSensing=(new Date).getTime()}clearLastSensingTime(){this.timeSinceLastSensing=void 0}getRepresentationInfo(t){return this.representations.get(t)}updateRepresentationInfo(t,e){this.representations.set(t,e)}refreshLastCapacity(){this._lastCapacity=this._capacity}getRepresentationsLowerThan(t){return this.representations.filter((e=>e.bitrate<t))}getRepresentationsHigherThan(t){return this.representations.filter((e=>e.bitrate>t))}adaptCapacityToBitrate(t){return Math.floor(this.capacityInt*this.lastBitrate/t)}mustRepresentationNotBeEligible(t){return(ot.isNil(t)||t.isEligibleToCapacityZero!==this.isEligibleToCapacityZero)&&!this.isEligibleToCapacityZero}mustRepresentationIncreaseAttempts(t){return ot.isNil(t)||t.attemptsToExitCapacityZero!==this.attemptsToExitCapacityZero}mayAdaptCapacityToBitrate(t){return!this.isEligibleToCapacityZero&&!t.isEligibleToCapacityZero&&this.capacity>1&&!ot.isNil(this.lastBitrate)}someHigherRepresentationsNotEligible(t){return this.getRepresentationsHigherThan(t).some((t=>!t.isEligibleToCapacityZero))}getMaxAttemptsOfLowerRepresentations(t){const e=this.getRepresentationsLowerThan(t).map((t=>t.attemptsToExitCapacityZero));return Math.max(0,...e)}reset(){this.currentBfr=void 0,this.attemptsToExitCapacityZero=0,this.timeSinceLastSensing=void 0,this.resetHistorical(),this.totalSensingSinceLastCapacityChange=0,this.hasChildrenExitedDueToLowBfr=!1,this.isEligibleToCapacityZero=!0,this.targetCapacity=void 0,this.resetModifiers()}resetModifiers(){const t=this.settings.teca.usePrecedenceModifiers?1:0;this.capacityInitialFlipModifier=t*this.settings.teca.capacityModifiers.initialFlip,this.capacityFlipModifier=t*this.settings.teca.capacityModifiers.flip,this.capacityRepresentationModifier=t*this.settings.teca.capacityModifiers.representation,this.capacitySensingModifier=t*this.settings.teca.capacityModifiers.sensing,this.capacityIncreaseModifier=t*this.settings.teca.capacityModifiers.increase,this.capacityDecreaseModifier=t*this.settings.teca.capacityModifiers.decrease,this.capacityKeepModifier=t*this.settings.teca.capacityModifiers.keep}resetHistorical(){this.clearInboundBfr(),this.clearOutboundBfr(),this.clearSensedCapacities(),this.historicalInboundBfrs.maxUniqueValues=this.settings.teca.bfrHistoryUniqueDesiredValues,this.historicalMapOutboundBfr.maxUniqueValues=this.settings.teca.bfrHistoryUniqueDesiredValues,this.historicalSensedCapacities.maxUniqueValues=this.settings.teca.minimalRequiredSensedCapacities}addExtraAttemptsToExitCapacityZero(){this.attemptsToExitCapacityZero=Math.max(-1,this.attemptsToExitCapacityZero-1)}updateAttemptsToExitCapacityZero(){this.isEligibleToCapacityZero&&this.attemptsToExitCapacityZero++,this.clearInboundBfr(),this.clearOutboundBfr()}clearTotalSensing(){this.totalSensingSinceLastCapacityChange=0,this.clearSensedCapacities()}get isCollectorWithLowBfr(){return!this.dataChannelService.hasConnectedWebRTCInbounds()&&this.currentBfr<this.settings.teca.bfrTimesToDecrease}get mayGoZeroCapacity(){return this.attemptsToExitCapacityZero>=this.settings.teca.maxAttemptsToExitZeroCapacity&&this.isEligibleToCapacityZero}hasLostChildren(t){return this.hasChildrenExitedDueToLowBfr&&this.capacityInt>0&&0===t}mayIncreaseWithChildren(t,e){return this.capacityInt<=e&&t/this.settings.teca.bfrTimesToIncrease>=this.capacityInt+1}mayDecreaseWithChildren(t,e){return this.isInboundBfrValid&&this.medianInboundBfr>this.settings.teca.bfrTimesToDecrease&&t<this.settings.teca.bfrTimesToDecrease*Math.min(this.capacityInt,e)}needCapacitySensing(t,e){const n=(new Date).getTime(),r=this.totalSensingSinceLastCapacityChange*this.settings.teca.capacityEstimationInterval,i=!this.timeSinceLastSensing||n-this.timeSinceLastSensing>Math.min(r,this.settings.teca.maxTimeWithoutSensing),s=t>this.settings.teca.bfrTimesToDecrease*this.capacityInt;return this.settings.teca.enableSensing&&i&&(s||!this.settings.teca.checkOutboundBfrBeforeSensing)&&this.capacityInt===e}needPeriodicCapacitySensing(t){const e=(new Date).getTime(),n=this.settings.teca.periodicSensingInterval&&(!this.timeSinceLastSensing||e-this.timeSinceLastSensing>this.settings.teca.periodicSensingInterval);return this.settings.teca.enableSensing&&n&&t>0}get didChildrenExitDueToLowBfr(){return(0===this.countOutboundBfrs||this.medianOutboundBfr<this.settings.teca.bfrTimesToDecrease)&&this.isEligibleToCapacityZero&&0!==this.capacityInt}get logReasonChildrenLostOnRepresentationChange(){const t={countInboundBfrs:this.countInboundBfrs,hasChildrenExitedDueToLowBfr:this.hasChildrenExitedDueToLowBfr,medianOutboundBfr:this.medianOutboundBfr,isEligibleToCapacityZero:this.isEligibleToCapacityZero};return`Representation change. State & flags: ${JSON.stringify(t)}`}logReasonChildrenLostOnComputeCapacity(t){const e={hasChildrenExitedDueToLowBfr:this.hasChildrenExitedDueToLowBfr,outboundCount:t};return`Compute capacity. State & flags: ${JSON.stringify(e)}`}});class Bo extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("CapacityEstimator"),this.eventBus=Ct(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.timer=Ss(this.context).createInstance(),this.capacitySensor=Ao(this.context).createInstance(),this.state=Mo(this.context).createInstance(),this.handleContentCacheCreatedEvent=this.handleContentCacheCreatedEvent.bind(this),this.invalidateCapacity()}get isSensorRunning(){return this.capacitySensor.isRunning||this.onHoldSensor}start(){this.eventBus.on($t.METRICS_MESSAGE,(t=>this.handleMetricsMessage(t)),{scope:this}),this.eventBus.on($t.DATA_CHANNEL_CREATED,(t=>this.handleDataChannelEvent(t)),{scope:this}),this.eventBus.on($t.DATA_CHANNEL_STATE_CHANGED,(t=>this.handleDataChannelEvent(t)),{scope:this}),this.eventBus.on($t.SETTINGS_CHANGED,(t=>this.handleSettingsChangedEvent(t)),{scope:this}),this.setUpAndSchedule()}destroy(){this.eventBus.offAll({scope:this}),this.stop(),this.capacitySensor.destroy(),this.state.destroy()}reset(){this.stop(),this.setUpAndSchedule()}setUpAndSchedule(){this.settings.teca.enableTeca?(this.state.reset(),this.initialCapacity(),this.logger.debug(Ut.estimatorStarted(this.state.capacity)),this.schedule()):this.invalidateCapacity()}schedule(){this.timer.setInterval("Capacity Estimation",this.settings.teca.capacityEstimationInterval,(()=>this.computeCapacity()))}stop(){this.timer.cancel(),this.cancelSensor()}primeCapacitySensing(){this.cancelSensor(),this.state.targetCapacity=this.state.capacityInt+1,this.onHoldSensor=!0,this.eventBus.on($t.CONTENT_CACHE_CONTENT_CREATED,this.handleContentCacheCreatedEvent,{scope:this})}computeCapacity(){if(ot.isNil(this.stats.stream.bitrate))return;if(this.isSensorRunning)return;if(this.state.mayGoZeroCapacity)return this.zeroCapacity(),this.logCapacity(Ut.noMoreAttempts()),void this.updateRepresentationInfo();const{medianOutboundBfr:t,outboundCount:e,valid:n}=this.computeOutboundBfrAndOutboundCount();if(!ot.isNil(this.state.currentBfr)){if(this.state.hasLostChildren(e)){const t=this.state.logReasonChildrenLostOnComputeCapacity(e);return this.decreaseCapacity(this.state.capacityInt-1),this.logCapacity(Ut.decreaseCapacityChildLost(t)),this.state.hasChildrenExitedDueToLowBfr=!1,void this.updateRepresentationInfo()}if(this.state.isCollectorWithLowBfr)this.logCapacity(Ut.cdnLowBfr(this.state.currentBfr));else if(0===e||0===this.state.capacityInt)if(this.state.capacity<1)if(this.state.isInboundBfrValid)if(this.state.mayGoZeroCapacity)this.zeroCapacity(),this.logCapacity(Ut.noMoreAttempts());else{let t=1;this.increaseFlipCapacity(t),this.logCapacity(Ut.newAttempt())}else this.zeroCapacity(),this.logCapacity(Ut.waitAttempt());else this.logCapacity(Ut.cdnEnoughCapacity());else e>0&&n&&(this.state.needPeriodicCapacitySensing(e)?this.primeCapacitySensing():this.state.mayIncreaseWithChildren(t,e)?(this.increaseCapacity(this.state.capacityInt+1),this.logCapacity(Ut.increaseCapacity(t))):this.state.mayDecreaseWithChildren(t,e)?(this.decreaseCapacity(Math.min(this.state.capacityInt,e)-1),this.logCapacity(Ut.decreaseCapacity(t))):this.state.needCapacitySensing(t,e)?this.primeCapacitySensing():(this.keepCapacity(this.state.capacityInt),this.logCapacity(Ut.keepCapacity(t))));this.updateRepresentationInfo()}}updateRepresentationInfo(){if(ot.isNil(this.stats.stream.bitrate))return;const t=this.state.lastRepresentationId,e=this.state.lastBitrate,n=this.state.getRepresentationInfo(t);this.state.mustRepresentationNotBeEligible(n)&&this.state.getRepresentationsLowerThan(e).forEach((t=>t.isEligibleToCapacityZero=!1)),this.state.mustRepresentationIncreaseAttempts(n)&&this.state.getRepresentationsHigherThan(e).forEach((t=>t.attemptsToExitCapacityZero++)),this.state.updateRepresentationInfo(t,{attemptsToExitCapacityZero:this.state.attemptsToExitCapacityZero,bitrate:e,capacity:this.state.capacity,isEligibleToCapacityZero:this.state.isEligibleToCapacityZero}),this.state.lastBitrate=e,this.state.lastRepresentationId=t}representationChanged(){if(!this.settings.teca.enableTeca||ot.isNil(this.stats.stream.bitrate))return;const t=t=>this.setCapacity(Math.floor(t)+this.state.capacityRepresentationModifier);this.stop();const e=this.stats.stream.representationId,n=this.stats.stream.bitrate,r=this.state.getRepresentationInfo(e);if(this.state.lastBitrate>this.stats.stream.bitrate&&this.state.didChildrenExitDueToLowBfr&&(this.state.countInboundBfrs>0||this.state.hasChildrenExitedDueToLowBfr)){const t=this.state.logReasonChildrenLostOnRepresentationChange;this.decreaseCapacity(this.state.capacityInt-1),this.logCapacity(Ut.decreaseCapacityChildLost(t)),this.state.hasChildrenExitedDueToLowBfr=!1,this.updateRepresentationInfo()}if(ot.isNil(r))this.state.isEligibleToCapacityZero=!this.state.someHigherRepresentationsNotEligible(n),this.state.attemptsToExitCapacityZero=this.state.getMaxAttemptsOfLowerRepresentations(n),this.state.isEligibleToCapacityZero||ot.isNil(this.state.lastBitrate)?this.state.attemptsToExitCapacityZero>this.settings.teca.maxAttemptsToExitZeroCapacity?(t(0),this.logCapacity(Ut.zeroCapacityNewRepresentation())):(this.initialCapacity(),this.logCapacity(Ut.restartCapacityNewRepresentation())):(t(this.state.adaptCapacityToBitrate(n)),this.logCapacity(Ut.adaptCapacityNewRepresentation(this.state.lastBitrate,n)));else{if(this.state.mayAdaptCapacityToBitrate(r)){const e=this.state.adaptCapacityToBitrate(n);t(e<1?r.capacity:e),this.logCapacity(Ut.adaptCapacity(this.state.lastBitrate,n))}else t(r.capacity),this.logCapacity(Ut.reuseCapacity());this.state.isEligibleToCapacityZero=r.isEligibleToCapacityZero,this.state.attemptsToExitCapacityZero=r.attemptsToExitCapacityZero}this.state.clearSensedCapacities(),this.state.clearInboundBfr(),this.state.clearOutboundBfr(),this.state.updateRepresentationInfo(e,{attemptsToExitCapacityZero:this.state.attemptsToExitCapacityZero,bitrate:n,capacity:this.state.capacity,isEligibleToCapacityZero:this.state.isEligibleToCapacityZero}),this.state.lastBitrate=n,this.state.lastRepresentationId=e,this.schedule()}setCapacity(t){this.state.capacity=t,this.eventBus.emit($t.COLLECT_POLYNET_STATS,{tecaCapacity:this.state.capacity})}initialCapacity(){const t=(()=>Math.random()>this.settings.teca.initialFlipRatio)();this.setCapacity((t?1:0)+this.state.capacityInitialFlipModifier),t||this.state.addExtraAttemptsToExitCapacityZero(),this.state.lastBitrate=this.stats.stream.bitrate,this.state.lastRepresentationId=this.stats.stream.representationId,this.updateRepresentationInfo()}invalidateCapacity(){this.setCapacity(-1)}decreaseCapacity(t){const e=Math.max(t,0);0===Math.floor(e)&&this.state.updateAttemptsToExitCapacityZero(),this.setCapacity(e+this.state.capacityDecreaseModifier),this.state.clearTotalSensing()}increaseCapacity(t){this.setCapacity(t+this.state.capacityIncreaseModifier),this.state.clearTotalSensing()}increaseFlipCapacity(t){this.setCapacity(t+this.state.capacityFlipModifier),this.state.clearTotalSensing()}increaseCapacitySensing(t){this.setCapacity(t+this.state.capacitySensingModifier),this.state.clearTotalSensing()}keepCapacity(t){this.setCapacity(t+this.state.capacityKeepModifier)}zeroCapacity(){this.setCapacity(0)}logCapacity(t){this.state.capacityDidChange&&(this.logger.debug(Ut.capacityChange(this.state.lastCapacity,this.state.capacity,t)),this.state.refreshLastCapacity())}estimateWithSensors(t){this.state.setLastSensingNow(),this.capacitySensor.estimateCapacity(t).then((e=>{if(ot.isNil(e)||!ot.isFinite(e))return;const n=e/t;this.state.addSensedCapacity(n);this.state.totalIncreaseCandidates>=this.settings.teca.minimalRequiredIncreaseSensedCapacities&&(this.state.clearSensedCapacities(),this.increaseCapacitySensing(this.state.capacityInt+1),this.logCapacity(Ut.increaseCapacityBySensor())),this.state.totalSensingSinceLastCapacityChange+=1,this.state.clearInboundBfr(),this.state.clearOutboundBfr(),this.onHoldSensor=!1})).catch((t=>{this.state.clearInboundBfr(),this.state.clearOutboundBfr(),this.state.clearLastSensingTime(),this.logger.warn(`Unable to finish sensing process due to: ${t}`),this.onHoldSensor=!1}))}computeOutboundBfrAndOutboundCount(){const t=this.getOutboundFromStats(),e=t.reduce(((t,e)=>t+e.bufferFillingRate),0);let n=new Map;for(const e of t){const{nodeId:t,bufferFillingRate:r}=e;n.set(t,r)}return e>this.settings.teca.bfrTimesToDecrease&&(this.state.isEligibleToCapacityZero=!1),e>0&&this.state.addOutboundBfr(n),{medianOutboundBfr:this.state.medianOutboundBfr,outboundCount:t.length,valid:this.state.isOutboundBfrValid}}getOutboundFromStats(){return this.stats.datachannel.dataChannels.filter((t=>t.direction===Ds.Direction.OUTBOUND&&t.bufferFillingRate>0))}handleMetricsMessage(t){var e;const n=null===(e=null==t?void 0:t.metrics)||void 0===e?void 0:e.representationBufferFillingRate;!ot.isFinite(n)||n<=0||(this.state.currentBfr=n,this.state.addInboundBfr(n))}handleDataChannelEvent(t){const e=t=>{let{dataChannel:e,oldState:n}=t;return(null==e?void 0:e.isClosed)&&(null==e?void 0:e.isWebRTC)&&n===Ds.State.CONNECTED},n=t.dataChannel,r=t.oldState;ot.isNil(n)||(n.isInbound?(e(t)&&this.logger.trace(Ut.tecaLostParentBfr(n.nodeId,this.state.allInboundBfrs,this.state.medianInboundBfr)),this.state.clearInboundBfr()):n.isOutbound&&(n.isClosed&&this.state.didChildrenExitDueToLowBfr&&r===Ds.State.CONNECTED&&(this.state.hasChildrenExitedDueToLowBfr=!0),e(t)&&this.logger.trace(Ut.tecaLostChildBfr(n.nodeId,this.state.getOutboundBfrsFromChild(n.nodeId),this.state.medianOutboundBfr)),this.state.clearOutboundBfr()),this.cancelSensor())}handleSettingsChangedEvent(t){const e=null==t?void 0:t.diffSettings;ot.isNil(null==e?void 0:e.teca)||this.reset()}handleContentCacheCreatedEvent(t){const e=null==t?void 0:t.contentCache;!ot.isNil(e)&&e.isCacheable&&(this.eventBus.off($t.CONTENT_CACHE_CONTENT_CREATED,this.handleContentCacheCreatedEvent,{scope:this}),this.estimateWithSensors(this.state.targetCapacity))}cancelSensor(){this.capacitySensor.stop(),this.state.clearLastSensingTime(),this.eventBus.off($t.CONTENT_CACHE_CONTENT_CREATED,this.handleContentCacheCreatedEvent,{scope:this}),this.onHoldSensor=!1}}Bo.polyNetFactoryName="CapacityEstimator";const Fo=Et.getInstanceFactory(Bo),jo=[Cs.MessageType.JOIN_RESPONSE],Uo=0;class $o extends Tt{constructor(){super(),this.sequence=0,this.logger=xt(this.context).getInstance().getLogger("TrackerV5"),this.eventBus=Ct(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance(),this.webSocket=Qs(this.context).getInstance(),this.responseTimer=_s(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.bufferHealthChecker=To(this.context).createInstance(),this.messageValidator=No(this.context).createInstance(),this.polyNet=Un(this.context).getInstance(),this.signaler=eo(this.context).createInstance(),this.capacityEstimator=Fo(this.context).createInstance()}start(){this.eventBus.on($t.WS_MESSAGE,this.handleTrackerWebSocketMessageEvent,{scope:this}),this.eventBus.on($t.REQUEST_REPAIR,this.handleRequestRepair,{scope:this}),this.eventBus.on($t.COUNTERMEASURE_TRACKER_RESPONSE_TIMEOUT,this.handleCountermeasureTrackerResponseTimeoutEvent,{scope:this}),this.eventBus.on($t.DATA_CHANNEL_STATE_CHANGED,this.handleDataChannelStateChangedEvent,{scope:this}),this.eventBus.on($t.SETTINGS_CHANGED,this.handleSettingsChangedEvent,{scope:this}),this.bufferHealthChecker.start(),this.capacityEstimator.start()}destroy(){var t;this.eventBus&&(this.requestLeave(),this.eventBus.offAll({scope:this}),this.polyNet.clearRepresentation(),this.messageValidator.destroy(),this.bufferHealthChecker.destroy(),this.signaler.destroy(),this.capacityEstimator.destroy(),this.logger=null,this.eventBus=null,this.dataChannelService=null,this.webSocket=null,this.stats=null,this.messageValidator=null,this.signaler=null,this.cancelTimerForTrackerResponseTimeout(),null===(t=this.responseTimer)||void 0===t||t.cancel(),this.responseTimer=null)}requestJoin(t,e){const n=ot.isNil(this.polyNet.representationId)||ot.isNil(e),r=ot.isNil(this.polyNet.streamUri)||ot.isNil(t),i=n||r,s=!n&&e!==this.polyNet.representationId,o=!r&&t!==this.polyNet.streamUri,a=s||o;a&&this.logger.trace(`Representation did change, representationId: ${e}, cache flushing is required`),(a||i)&&this.requestInternalJoin(t,e,a)}requestInternalJoin(t,e){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.polyNet.isJoined&&this.requestLeave(),n&&this.capacityEstimator.representationChanged(),this.polyNet.update({representationId:e,streamUri:t}),this.polyNet.state!==jn.States.CONNECTED)return this.logger.trace(`Request Join - Incorrect polyNet state ${this.polyNet.state}`);this.logger.debug(Ut.representationChanged(e,t)),this.sendPolyNetJoinRequest(t,e)}requestLeave(){this.polyNet.updateState(jn.States.CONNECTED),this.cancelTimerForTrackerResponseTimeout(),this.closeOutBoundDataChannels(),this.closeInboundDataChannels()}closeOutBoundDataChannels(){this.dataChannelService.findAllOutbound().forEach((t=>{this.removeDataChannel(t)}))}closeInboundDataChannels(){this.dataChannelService.findAllInbound().forEach((t=>{this.removeDataChannel(t)}))}closeDataChannelAndReverse(t){const e=this.dataChannelService.findByIdentifier(t);e&&this.removeDataChannel(e);const n=this.dataChannelService.findByReverseIdentifier(t);n&&this.removeDataChannel(n)}handleDataChannelStateChangedEvent(t){const{state:e,type:n,direction:r,nodeIdShort:i}=t.dataChannel;switch(e){case Ds.State.CONNECTED:this.logger.integration(Ut.connectedTo(n,r,i));break;case Ds.State.CLOSED:this.logger.integration(Ut.disconnectedFrom(n,r,i))}}createDataChannelWebRTCInbound(t){const e=this.dataChannelService.createDataChannelWebRTC(t,Ds.Direction.INBOUND);return this.eventBus.on($t.DATA_CHANNEL_REMOVED,this.handleInboundDataChannelRemoved,{target:e,scope:this}),e}createDataChannelWebRTCOutbound(t){return this.dataChannelService.createDataChannelWebRTC(`${t.to}:${t.from}`,Ds.Direction.OUTBOUND)}handleSettingsChangedEvent(t){const{diffSettings:e}=t;if(ot.isNil(e.sharingContent))return;this.messageValidator.checkSharingContent().error&&this.requestLeave()}checkSequence(t){return!jo.includes(t.messageType)||[this.sequence,Uo].includes(t.sequence)}handleTrackerWebSocketMessageEvent(t){const e=t.message;if(this.checkSequence(e))switch(e.messageType){case Cs.MessageType.JOIN_RESPONSE:this.handleTrackerJoinResponseMessage(e);break;case Cs.MessageType.MOVE_INSTRUCTION:this.handlePolyNetMoveInstructionMessage(e);break;case Cs.MessageType.PEER_TO_PEER:this.handlePolyNetPeerToPeerMessage(e);break;case Cs.MessageType.CHANGE_SETTINGS_INSTRUCTION:this.handleSettingsMessage(e);break;default:this.logger.trace(`Unsupported message type: ${e.messageType}`)}else this.logger.trace(`Ignoring message due to sequence mismatch. Expected sequence: ${this.sequence}`)}handleSettingsMessage(t){if(!t.settings)return;const{settings:e}=t;this.settings.setup(e)}handleTrackerJoinResponseMessage(t){this.eventBus.emit($t.COLLECT_POLYNET_STATS,{joinResponseTime:performance.now()}),this.cancelTimerForTrackerResponseTimeout();const[e,n]=t.dataChannelId.split(":");t.statusCode===Cs.StatusCode.JOIN_RESPONSE_OK&&("cdn"===t.source?this.logger.integration(Ut.trackerCDN(n)):this.logger.integration(Ut.trackerP2P(n,e)),this.storeJoinResponseData(t),this.moveNodeToNewParent(t.source,t.dataChannelId,t.peeringType))}handlePolyNetMoveInstructionMessage(t){this.moveNodeToNewParent(t.source,t.dataChannelId,t.peeringType)}handlePolyNetPeerToPeerMessage(t){if(this.messageValidator.isPeerToPeerMessageForCurrentNode(t))if(this.messageValidator.isValidPeerToPeerMessageType(t)){if(this.messageValidator.isPeerToPeerHandshake(t)){const e=this.messageValidator.checkPeerToPeerHandshake(t);if(e.error)return void this.sendKickMessage(t.from,e.message);const n=this.dataChannelService.findOneByQuery({nodeId:t.from});n&&this.removeDataChannel(n),this.createDataChannelWebRTCOutbound(t)}this.signaler.handleSignalingMessage(t)}else this.logger.trace(`Unsupported message type: ${t.payload.messageType}`);else this.logger.trace(`Ignoring received message for another nodeId: ${t.to} - ${JSON.stringify(t)}`)}handleInboundDataChannelRemoved(t){const{dataChannel:e}=t;e.isWebRTC&&e.isInbound&&this.logger.trace(`Lost inbound with nodeId: ${e.nodeId}`)}moveNodeToNewParent(t,e,n){const r=()=>this.polyNet.updateState(jn.States.JOINED),i=()=>{this.eventBus.off($t.DATA_CHANNEL_CONNECTED,i,{scope:this}),r()};let s;this.cancelTimerForTrackerResponseTimeout(),this.closeInboundDataChannels(),this.closeDataChannelAndReverse(e),"cdn"===t?(s=this.dataChannelService.getHttpDataChannel(),this.logger.integration(Ut.moveCDN())):(s=this.createDataChannelWebRTCInbound(e),this.logger.integration(Ut.moveP2P(s.nodeId))),s.isConnected?r():this.eventBus.on($t.DATA_CHANNEL_CONNECTED,i,{target:s,scope:this}),s.peeringType=n,this.eventBus.emit($t.COLLECT_DATA_CHANNEL_STATS,{peeringType:s.peeringType}),s.isWebRTC&&this.signaler.startSignalingForDataChannel(s)}handleRequestRepair(t){const{dataChannelId:e}=t;let n;n=e?this.dataChannelService.findByIdentifier(e):this.dataChannelService.findFirstInboundWebRTC(),this.logger.warn(`Repair requested for nodeId: ${null==n?void 0:n.nodeIdShort} due to: ${t.reason}`),(null==n?void 0:n.type)===Ds.Type.WEB_RTC&&(this.removeDataChannel(n),this.handleInboundDataChannelRemoved({dataChannel:n}))}createPolyNetJoinRequest(t,e){return{connectionType:this.stats.platform.connectionType,messageType:Cs.MessageType.JOIN_REQUEST,natType:this.stats.nat.type,receiverProtocols:So.SUPPORTED_PROTOCOLS_VERSION,representationId:e,sequence:++this.sequence,streamUri:t}}sendPolyNetJoinRequest(t,e){const n=this.createPolyNetJoinRequest(t,e);this.eventBus.emit($t.COLLECT_POLYNET_STATS,{joinRequestTime:performance.now()}),this.sendMessageToTracker(n),this.scheduleTimerForTrackerResponseTimeout(n)}trackerSendMessageToPeer(t,e){const n={from:this.polyNet.nodeId,messageType:Cs.MessageType.PEER_TO_PEER,payload:e,to:t};this.sendMessageToTracker(n)}sendKickMessage(t,e){var n;const r={messageType:to.Messages.KICK,reasonMessage:e};null===(n=this.logger)||void 0===n||n.trace(`${e} -> Sending KICK message to nodeId: ${t}`),this.trackerSendMessageToPeer(t,r)}sendMessageToTracker(t){var e;null===(e=this.webSocket)||void 0===e||e.send(t)}storeJoinResponseData(t){if(!t.dataChannelId)return;if(!t.streamId||!t.maskedStreamUri)return;const[,e]=t.dataChannelId.split(":"),n=t.streamId,r=t.maskedStreamUri;this.polyNet.update({maskedStreamUri:r,nodeId:e,streamId:n})}temporaryLeavePolyNet(){this.requestLeave(),this.requestInternalJoin(this.polyNet.streamUri,this.polyNet.representationId)}removeDataChannel(t){this.logger.trace(`Closing DataChannel nodeId: ${t.nodeIdShort}`),this.eventBus.off($t.DATA_CHANNEL_REMOVED,this.handleInboundDataChannelRemoved,{target:t,scope:this}),this.dataChannelService.removeDataChannel(t)}handleCountermeasureTrackerResponseTimeoutEvent(t){const e=t.request;(null==e?void 0:e.statusCode)===Cs.StatusCode.DATA_CHANNEL_NOT_AVAILABLE&&(this.logger.warn(`Rejoin due to a response timeout from ${e.messageType} ${e.statusCode}`),this.temporaryLeavePolyNet())}scheduleTimerForTrackerResponseTimeout(t){this.responseTimer.schedule(t)}cancelTimerForTrackerResponseTimeout(){this.responseTimer.cancel()}}$o.polyNetFactoryName="TrackerV5";const qo=Et.getInstanceFactory($o);class Ho extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance(),this.webSocketManager=Qs(this.context).getInstance(),this.polyNet=Un(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("Tracker"),this.settings=On(this.context).getInstance(),this.responseTimer=_s(this.context).getInstance(),this.stats=cs(this.context).getInstance()}start(){if(!this.isValidPolyNetEnvironment())return this.requestNoRecovery(),void this.logger.warn("This browser does not support PolyNet, going into fallback mode");this.eventBus.on($t.WS_OPEN,this.handleWebSocketManagerOpenEvent,{scope:this}),this.eventBus.on($t.WS_ERROR,this.handleWebSocketManagerErrorEvent,{scope:this}),this.eventBus.on($t.WS_CLOSE,this.handleWebSocketManagerCloseEvent,{scope:this}),this.eventBus.on($t.WS_MESSAGE,this.handleWebSocketManagerMessageEvent,{scope:this}),this.eventBus.on($t.REQUEST_CONNECT,this.handleRequestConnect,{scope:this}),this.eventBus.on($t.REQUEST_NO_RECOVERY,this.handleRequestNoRecovery,{scope:this}),this.eventBus.on($t.COUNTERMEASURE_TRACKER_RESPONSE_TIMEOUT,this.handleCountermeasureTrackerResponseTimeoutEvent,{scope:this}),this.webSocketManager.start()}destroy(){var t,e;this.eventBus&&(this.webSocketManager.disconnect(),this.eventBus.offAll({scope:this}),null===(t=this.versionedTracker)||void 0===t||t.destroy(),this.cancelTimerForTrackerResponseTimeout(),null===(e=this.responseTimer)||void 0===e||e.cancel(),this.responseTimer=null,this.logger=null,this.eventBus=null,this.webSocketManager=null,this.versionedTracker=null)}requestConnect(){if(!this.polyNet.isDisconnected)return this.logger.trace(`Request Connect - Incorrect polyNet state ${this.polyNet.state}`);this.settings.isValidApiKey&&(this.logger.debug(Ut.startingTrackerConnection()),this.startWebSocket())}requestJoin(t,e){var n;null===(n=this.versionedTracker)||void 0===n||n.requestJoin(t,e)}requestDisconnect(){this.logger.debug(Ut.closingTrackerConnection()),this.disconnectWsAndVersionedTracker(),this.polyNet.updateState(jn.States.DISCONNECTED)}requestNoRecovery(){this.disconnectWsAndVersionedTracker(),this.polyNet.updateState(jn.States.NO_RECOVERY)}disconnectWsAndVersionedTracker(){var t;null===(t=this.versionedTracker)||void 0===t||t.destroy(),this.webSocketManager.disconnect()}startWebSocket(){const t=this.settings.apiKey.signalServerUrl;this.webSocketManager.connect(t)}handleWebSocketManagerOpenEvent(){this.sendHandshakeRequest()}handleWebSocketManagerMessageEvent(t){const e=t.message;e.messageType===Cs.MessageType.HANDSHAKE_RESPONSE&&this.handleHandShakeResponseMessage(e)}handleWebSocketManagerErrorEvent(){this.logger.trace("Connection to the Tracker got an error."),this.requestDisconnect()}handleWebSocketManagerCloseEvent(){this.logger.integration(Ut.trackerClosed()),this.requestDisconnect()}handleHandShakeResponseMessage(t){switch(t.statusCode){case Cs.StatusCode.HANDSHAKE_RESPONSE_OK:this.cancelTimerForTrackerResponseTimeout(),this.polyNet.updateState(jn.States.CONNECTED),this.versionedTracker=qo(this.context).createInstance(),this.versionedTracker.start(),this.polyNet.representationId&&this.versionedTracker.requestJoin(this.polyNet.streamUri,this.polyNet.representationId);break;case Cs.StatusCode.HANDSHAKE_RESPONSE_NOT_SUPPORTED:pt.throw(this.logger,`${Cs.StatusCode.HANDSHAKE_RESPONSE_NOT_SUPPORTED}`),this.eventBus.emit($t.COLLECT_POLYNET_STATS,{revokedStatus:wr.RevokedStatus.PROTOCOL_NOT_SUPPORTED}),this.requestNoRecovery();break;default:this.logger.trace(`Unsupported status code: ${t}`)}}sendHandshakeRequest(){const t={messageType:Cs.MessageType.HANDSHAKE_REQUEST,supportedProtocols:Ho.PROTOCOL_VERSIONS};this.sendMessageToTracker(t),this.scheduleTimerForTrackerResponseTimeout(t)}handleRequestConnect(){this.requestConnect()}handleRequestNoRecovery(){this.requestNoRecovery()}sendMessageToTracker(t){var e;this.logger.trace(`Sending message: ${JSON.stringify(t)}`),null===(e=this.webSocketManager)||void 0===e||e.send(t)}handleCountermeasureTrackerResponseTimeoutEvent(t){const e=[Cs.MessageType.HANDSHAKE_REQUEST,Cs.MessageType.JOIN_REQUEST],n=null==t?void 0:t.request;n&&e.includes(n.messageType)&&(this.logger.warn(`Closing WS due to a response timeout from ${n.messageType}`),this.requestDisconnect(),this.eventBus.emit($t.WS_CLOSE,{target:this}))}scheduleTimerForTrackerResponseTimeout(t){this.responseTimer.schedule(t)}cancelTimerForTrackerResponseTimeout(){this.responseTimer.cancel()}isValidPolyNetEnvironment(){return this.stats.platform.isAnyMediaSourceApiSupported&&this.stats.platform.isWebRTCSupported}}Ho.polyNetFactoryName="Tracker",Ho.PROTOCOL_VERSIONS=[5];const Wo=Et.getSingletonFactory(Ho);var Vo=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class Go extends Tt{constructor(){super(),this.polyNet=Un(this.context).getInstance(),this.tracker=Wo(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("ConnectionManager")}destroy(){this.polyNet=null,this.tracker=null,this.eventBus=null,this.logger=null}connectToPolyNet(t,e){return Vo(this,void 0,void 0,(function*(){this.polyNet.isInNoRecovery||(this.polyNet.isDisconnected&&(this.logger.trace("Connecting..."),yield this.connect()),yield this.join(t,e))}))}disconnectFromPolyNet(){return Vo(this,void 0,void 0,(function*(){yield this.disconnect()}))}connect(){return new Promise((t=>{const e=()=>{this.polyNet.state===jn.States.CONNECTED&&(this.eventBus.off($t.POLYNET_STATE_CHANGED,e,{scope:this}),t())};this.polyNet.state>=jn.States.CONNECTED?t():(this.eventBus.on($t.POLYNET_STATE_CHANGED,e,{scope:this}),this.polyNet.isDisconnected&&this.tracker.requestConnect())}))}join(t,e){return new Promise((n=>{const r=()=>{this.polyNet.state===jn.States.JOINED&&(this.eventBus.off($t.POLYNET_STATE_CHANGED,r,{scope:this}),n())};this.eventBus.on($t.POLYNET_STATE_CHANGED,r,{scope:this});try{this.tracker.requestJoin(t,e)}catch(t){dt.throw(this.logger,t)}}))}disconnect(){return new Promise((t=>{const e=()=>{this.polyNet.isDisconnected&&(this.eventBus.off($t.POLYNET_STATE_CHANGED,e,{scope:this}),t())};this.polyNet.state<=jn.States.DISCONNECTED?t():(this.eventBus.on($t.POLYNET_STATE_CHANGED,e,{scope:this}),this.polyNet.state>jn.States.DISCONNECTED&&this.tracker.requestDisconnect())}))}}Go.polyNetFactoryName="ConnectionManager";const zo=Et.getInstanceFactory(Go);var Ko=__webpack_require__(450),Yo=__webpack_require__.n(Ko);class Xo{constructor(t){this.host=t}}class Zo extends Xo{constructor(t){super(t),this.failTime=void 0,this.strikes=0}}var Jo=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class Qo extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("NS1ApiFetcher")}request(t,e){var n;return Jo(this,void 0,void 0,(function*(){const r=yield this.send(t,e);return r&&null!==(n=this.parseData(r.data))&&void 0!==n?n:[]}))}send(t,e){return Jo(this,void 0,void 0,(function*(){try{return yield Mt().get(t,{headers:{"X-NSONE-KEY":e}})}catch(e){e.response?this.logger.error(Ut.errorFetchingResourceWithResponse(t,e.response.status,e.response.data)):this.logger.error(Ut.errorFetchingResourceNoResponse(t,e.message))}}))}parseData(t){var e;return null===(e=null==t?void 0:t.resources)||void 0===e?void 0:e.filter((t=>t.label)).map((t=>{let{label:e}=t;return new Xo(e)}))}}Qo.polyNetFactoryName="NS1ApiFetcher";const ta=Et.getInstanceFactory(Qo);class ea extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("HostList"),this.settings=On(this.context).getInstance(),this.hosts=[],this.failedHosts=[]}get hostnames(){return this.hosts.map((t=>t.host))}get bannedHosts(){return this.failedHosts.filter((t=>this.isBanned(t)))}get areAllBanned(){return this.hosts.length>0&&!this.getFirstNotBanned()}updateHosts(t){const e=t.map((t=>t.host));this.failedHosts=this.failedHosts.filter((t=>e.includes(t.host))),this.hosts=t}banHost(t){let e=this.failedHosts.find((e=>e.host===t));if(!e){const n=this.hosts.find((e=>e.host===t));if(!n)return;e=new Zo(n.host),this.failedHosts.push(e)}e.strikes++,e.failTime=Date.now(),e.strikes===this.settings.mss.banConfig.maxRetries&&this.logger.debug(Ut.addHostToBannedList(e.host)),this.areAllBanned&&this.logger.debug(Ut.allHostsBanned())}getFirstNotBanned(){this.updateBans();const t=this.bannedHosts.map((t=>t.host));return this.hosts.find((e=>!t.includes(e.host)))}isBanned(t){const e=t.failTime+this.settings.mss.banConfig.banTimeout;return t.failTime&&t.strikes>=this.settings.mss.banConfig.maxRetries&&Date.now()<e}updateBans(){this.failedHosts=this.failedHosts.filter((t=>{const e=this.isBanned(t);return!e&&this.logger.debug(Ut.unbanningHost(t.host)),e}))}}ea.polyNetFactoryName="HostList";const na=Et.getInstanceFactory(ea);var ra=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class ia extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("ShieldService"),this.fetchCDNsTimer=Ss(this.context).createInstance(),this.apiFetcher=ta(this.context).createInstance(),this.settings=On(this.context).getInstance(),this.hostList=na(this.context).createInstance(),this.polyNet=Un(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance()}get isMssEnabled(){const t=!this.polyNet.isInNoRecovery&&this.settings.mss.enableMss,e=!ot.isNil(this.settings.mss.ns1Config.url)&&!ot.isNil(this.settings.mss.ns1Config.authToken);return t&&e}start(){this.eventBus.on($t.SETTINGS_CHANGED,(t=>this.handleSettingsChanged(t))),this.scheduleTimer()}stop(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.clearTimer()}destroy(){this.stop(),this.fetchCDNsTimer=null,this.apiFetcher=null,this.polyNet=null,this.eventBus=null}changeHost(t){if(!this.isMssEnabled)return t;let e=t;const n=new(Yo())(t),r=this.hostList.getFirstNotBanned();if(r&&this.settings.mss.targetHosts.includes(n.host)&&(this.logger.logWhenChange("pickingHostForRetrievingContent",Ut.pickingHostForRetrievingContent(r.host)),e=n.set("host",r.host).toString()),!r){const t=new(Yo())(e);this.logger.logWhenChange("pickingHostForRetrievingContent",Ut.pickingOriginalHostAsFallback(t.hostname))}return e}banHost(t){const e=new(Yo())(t);this.hostList.banHost(e.hostname)}scheduleTimer(){var t;return ra(this,void 0,void 0,(function*(){this.isMssEnabled&&(this.fetchCDNsTimer.isRunning&&this.clearTimer(),yield this.fetchCDNs(),null===(t=this.fetchCDNsTimer)||void 0===t||t.setInterval("Timer-Fetch-CDNs",this.settings.mss.apiRefreshInterval,(()=>this.fetchCDNs()),!0))}))}clearTimer(){var t;null===(t=this.fetchCDNsTimer)||void 0===t||t.cancel()}fetchCDNs(){return ra(this,void 0,void 0,(function*(){if(!this.isMssEnabled)return;this.logger.debug(Ut.fetchingHostList());const t=yield this.apiFetcher.request(this.settings.mss.ns1Config.url,this.settings.mss.ns1Config.authToken);this.hostList.updateHosts(t),this.logger.logWhenChange("newHostList",Ut.newHostList(this.hostList.hostnames))}))}handleSettingsChanged(t){ot.isNil(t.diffSettings.mss)||(this.stop(),this.start())}}ia.polyNetFactoryName="ShieldService";const sa=Et.getSingletonFactory(ia),oa=Ts.Writer,aa=Ts.util,ca=Ts.roots.default||(Ts.roots.default={}),ua=ca.s73_metrics=(()=>{const t={};return t.Connection=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=oa.create()),e},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.Connection"},t.Status=function(){const t={},e=Object.create(t);return e[t[0]="NO_PARENT"]=0,e[t[1]="P2P_CONNECTING"]=1,e[t[2]="P2P_CONNECTED"]=2,e[t[3]="P2P_NOT_SUPPORTED"]=3,e[t[4]="PROTOCOL_NOT_SUPPORTED"]=4,e[t[5]="CONTENT_NOT_SUPPORTED"]=5,e[t[6]="NOT_ALLOWED"]=6,e[t[7]="MAX_USERS_PER_KEY_REACHED"]=7,e[t[8]="MEDIA_SOURCE_EXTENSIONS_NOT_SUPPORTED"]=8,e[t[100]="UNKNOWN_STATUS"]=100,e}(),t.Type=function(){const t={},e=Object.create(t);return e[t[0]="UNKNOWN"]=0,e[t[1]="NONE"]=1,e[t[2]="OTHER"]=2,e[t[3]="BLUETOOTH"]=3,e[t[4]="CELLULAR"]=4,e[t[5]="ETHERNET"]=5,e[t[6]="WIFI"]=6,e[t[7]="WIMAX"]=7,e}(),t}(),t.Nat=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=oa.create()),e},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.Nat"},t.Type=function(){const t={},e=Object.create(t);return e[t[0]="UNKNOWN"]=0,e[t[1]="NON_SYMMETRIC"]=1,e[t[2]="SYMMETRIC"]=2,e[t[3]="SEQUENTIAL"]=3,e}(),t}(),t.OperatingSystem=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=oa.create()),e},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.OperatingSystem"},t.Name=function(){const t={},e=Object.create(t);return e[t[0]="UNKNOWN"]=0,e[t[1]="ANDROID"]=1,e[t[2]="IOS"]=2,e[t[3]="LINUX"]=3,e[t[4]="MACOS"]=4,e[t[5]="WINDOWS"]=5,e[t[6]="TVOS"]=6,e}(),t}(),t.Platform=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.encode=function(t,e){return e||(e=oa.create()),e},t.verify=function(t){return"object"!=typeof t||null===t?"object expected":null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.Platform"},t.Name=function(){const t={},e=Object.create(t);return e[t[0]="UNKNOWN"]=0,e[t[1]="ANDROID"]=1,e[t[2]="IOS"]=2,e[t[3]="LINUX"]=3,e[t[4]="MACOS"]=4,e[t[5]="WINDOWS"]=5,e[t[6]="CHROME"]=6,e[t[7]="CHROMIUM"]=7,e[t[8]="EDGE"]=8,e[t[9]="EXPLORER"]=9,e[t[10]="FIREFOX"]=10,e[t[11]="OPERA"]=11,e[t[12]="SAFARI"]=12,e[t[13]="TVOS"]=13,e[t[14]="ANDROID_TV"]=14,e}(),t}(),t.Source=function(){const t={},e=Object.create(t);return e[t[0]="CDN"]=0,e[t[1]="P2P"]=1,e}(),t.InboundProtocol=function(){const t={},e=Object.create(t);return e[t[0]="HTTP"]=0,e[t[1]="SCTP"]=1,e[t[2]="QUIC"]=2,e}(),t.PeeringType=function(){const t={},e=Object.create(t);return e[t[0]="LAN"]=0,e[t[1]="INTRA_ASN"]=1,e[t[2]="INTER_ASN"]=2,e}(),t.UplinkSpeedError=function(){const t={},e=Object.create(t);return e[t[0]="UNKNOWN"]=0,e[t[1]="NOT_READY"]=1,e[t[2]="INVALID_SPEEDY_URL"]=2,e[t[3]="API_RESPONSE_ERROR"]=3,e[t[4]="SPEEDY_INVALID_RESULT"]=4,e[t[5]="CONNECTION_ERROR"]=5,e[t[6]="PROBE_FAILED"]=6,e[t[7]="PROBE_TIMEOUT"]=7,e}(),t.Peer=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.nodeId="",t.prototype.aggregateBufferFillingRate=0,t.prototype.uplinkSpeed=0,t.prototype.outboundConnectionStatus=0,t.encode=function(t,e){return e||(e=oa.create()),e.uint32(10).string(t.nodeId),null!=t.aggregateBufferFillingRate&&Object.hasOwnProperty.call(t,"aggregateBufferFillingRate")&&e.uint32(21).float(t.aggregateBufferFillingRate),null!=t.uplinkSpeed&&Object.hasOwnProperty.call(t,"uplinkSpeed")&&e.uint32(24).uint32(t.uplinkSpeed),null!=t.outboundConnectionStatus&&Object.hasOwnProperty.call(t,"outboundConnectionStatus")&&e.uint32(32).int32(t.outboundConnectionStatus),e},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(!aa.isString(t.nodeId))return"nodeId: string expected";if(null!=t.aggregateBufferFillingRate&&t.hasOwnProperty("aggregateBufferFillingRate")&&"number"!=typeof t.aggregateBufferFillingRate)return"aggregateBufferFillingRate: number expected";if(null!=t.uplinkSpeed&&t.hasOwnProperty("uplinkSpeed")&&!aa.isInteger(t.uplinkSpeed))return"uplinkSpeed: integer expected";if(null!=t.outboundConnectionStatus&&t.hasOwnProperty("outboundConnectionStatus"))switch(t.outboundConnectionStatus){default:return"outboundConnectionStatus: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 100:}return null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.Peer"},t}(),t.Metrics=function(){function t(t){if(this.datachannelWasNotEstablished=[],this.contentRequestResponseTimesCdn=[],this.contentRequestResponseTimesP2p=[],this.contentSteeringPathwayPriority=[],this.peers=[],t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}return t.prototype.nodeId="",t.prototype.deviceId="",t.prototype.channelId="default",t.prototype.representationId="",t.prototype.streamId="",t.prototype.source=0,t.prototype.receiveFromNodeId="",t.prototype.natType=0,t.prototype.connectionStatus=0,t.prototype.connectionType=0,t.prototype.operatingSystemName=0,t.prototype.operatingSystemVersion="",t.prototype.platformName=0,t.prototype.platformVersion="",t.prototype.maskedStreamUri="",t.prototype.bitrate="",t.prototype.peerSettings="",t.prototype.sdkVersion="",t.prototype.datachannelWasNotEstablished=aa.emptyArray,t.prototype.currentHost="",t.prototype.responseCdn="",t.prototype.bufferHealth=0,t.prototype.droppedFramesPerSecond=0,t.prototype.timeToFirstFrame=0,t.prototype.bufferingRatio=0,t.prototype.playbackTime=0,t.prototype.aggregateBufferFillingRate=0,t.prototype.representationBufferFillingRate=0,t.prototype.cdnDownlinkThroughput=0,t.prototype.p2pDownlinkThroughput=0,t.prototype.downlinkSpeed=0,t.prototype.uplinkSpeed=0,t.prototype.roundTripTime=0,t.prototype.interarrivalJitter=0,t.prototype.packetLoss=0,t.prototype.joinResponseTime=0,t.prototype.contentRequestResponseTimesCdn=aa.emptyArray,t.prototype.contentRequestResponseTimesP2p=aa.emptyArray,t.prototype.inboundProtocol=0,t.prototype.inboundConnectionCount=1,t.prototype.inboundThroughputProbe=-1,t.prototype.uplinkCapacity=-1,t.prototype.inboundPeeringType=0,t.prototype.uplinkSpeedError=0,t.prototype.cpuLoad=0,t.prototype.sessionId="",t.prototype.osName="",t.prototype.osVersion="",t.prototype.appName="",t.prototype.appVersion="",t.prototype.browserName="",t.prototype.browserVersion="",t.prototype.playerName="",t.prototype.playerVersion="",t.prototype.hrefLocation="",t.prototype.viewportWidth=0,t.prototype.viewportHeight=0,t.prototype.videoResolutionWidth=0,t.prototype.videoResolutionHeight=0,t.prototype.playerState="",t.prototype.startingTime=0,t.prototype.seekingTime=0,t.prototype.bufferingTime=0,t.prototype.playingTime=0,t.prototype.pauseTime=0,t.prototype.bufferingEvents=0,t.prototype.streamState="",t.prototype.aliveTime=0,t.prototype.contentSteeringEnabled=!1,t.prototype.contentSteeringResourceId=0,t.prototype.contentSteeringPathwayPriority=aa.emptyArray,t.prototype.contentSteeringPathway="",t.prototype.peers=aa.emptyArray,t.prototype.customDimension_1="",t.prototype.customDimension_2="",t.prototype.customDimension_3="",t.encode=function(t,e){if(e||(e=oa.create()),e.uint32(10).string(t.nodeId),e.uint32(18).string(t.deviceId),null!=t.channelId&&Object.hasOwnProperty.call(t,"channelId")&&e.uint32(26).string(t.channelId),e.uint32(34).string(t.representationId),e.uint32(42).string(t.streamId),e.uint32(48).int32(t.source),null!=t.receiveFromNodeId&&Object.hasOwnProperty.call(t,"receiveFromNodeId")&&e.uint32(58).string(t.receiveFromNodeId),e.uint32(64).int32(t.natType),e.uint32(72).int32(t.connectionStatus),e.uint32(80).int32(t.connectionType),e.uint32(88).int32(t.operatingSystemName),e.uint32(98).string(t.operatingSystemVersion),e.uint32(104).int32(t.platformName),e.uint32(114).string(t.platformVersion),e.uint32(130).string(t.maskedStreamUri),null!=t.bitrate&&Object.hasOwnProperty.call(t,"bitrate")&&e.uint32(138).string(t.bitrate),null!=t.peerSettings&&Object.hasOwnProperty.call(t,"peerSettings")&&e.uint32(146).string(t.peerSettings),null!=t.sdkVersion&&Object.hasOwnProperty.call(t,"sdkVersion")&&e.uint32(154).string(t.sdkVersion),null!=t.datachannelWasNotEstablished&&t.datachannelWasNotEstablished.length)for(var n=0;n<t.datachannelWasNotEstablished.length;++n)e.uint32(162).string(t.datachannelWasNotEstablished[n]);if(null!=t.currentHost&&Object.hasOwnProperty.call(t,"currentHost")&&e.uint32(170).string(t.currentHost),null!=t.responseCdn&&Object.hasOwnProperty.call(t,"responseCdn")&&e.uint32(178).string(t.responseCdn),null!=t.bufferHealth&&Object.hasOwnProperty.call(t,"bufferHealth")&&e.uint32(248).int32(t.bufferHealth),null!=t.droppedFramesPerSecond&&Object.hasOwnProperty.call(t,"droppedFramesPerSecond")&&e.uint32(256).uint32(t.droppedFramesPerSecond),null!=t.timeToFirstFrame&&Object.hasOwnProperty.call(t,"timeToFirstFrame")&&e.uint32(264).uint32(t.timeToFirstFrame),null!=t.bufferingRatio&&Object.hasOwnProperty.call(t,"bufferingRatio")&&e.uint32(277).float(t.bufferingRatio),null!=t.playbackTime&&Object.hasOwnProperty.call(t,"playbackTime")&&e.uint32(285).float(t.playbackTime),null!=t.aggregateBufferFillingRate&&Object.hasOwnProperty.call(t,"aggregateBufferFillingRate")&&e.uint32(333).float(t.aggregateBufferFillingRate),null!=t.representationBufferFillingRate&&Object.hasOwnProperty.call(t,"representationBufferFillingRate")&&e.uint32(341).float(t.representationBufferFillingRate),null!=t.cdnDownlinkThroughput&&Object.hasOwnProperty.call(t,"cdnDownlinkThroughput")&&e.uint32(344).uint32(t.cdnDownlinkThroughput),null!=t.p2pDownlinkThroughput&&Object.hasOwnProperty.call(t,"p2pDownlinkThroughput")&&e.uint32(352).uint32(t.p2pDownlinkThroughput),null!=t.downlinkSpeed&&Object.hasOwnProperty.call(t,"downlinkSpeed")&&e.uint32(360).uint32(t.downlinkSpeed),null!=t.uplinkSpeed&&Object.hasOwnProperty.call(t,"uplinkSpeed")&&e.uint32(368).uint32(t.uplinkSpeed),null!=t.roundTripTime&&Object.hasOwnProperty.call(t,"roundTripTime")&&e.uint32(376).uint32(t.roundTripTime),null!=t.interarrivalJitter&&Object.hasOwnProperty.call(t,"interarrivalJitter")&&e.uint32(389).float(t.interarrivalJitter),null!=t.packetLoss&&Object.hasOwnProperty.call(t,"packetLoss")&&e.uint32(392).uint32(t.packetLoss),null!=t.joinResponseTime&&Object.hasOwnProperty.call(t,"joinResponseTime")&&e.uint32(400).uint32(t.joinResponseTime),null!=t.contentRequestResponseTimesCdn&&t.contentRequestResponseTimesCdn.length)for(n=0;n<t.contentRequestResponseTimesCdn.length;++n)e.uint32(408).uint32(t.contentRequestResponseTimesCdn[n]);if(null!=t.contentRequestResponseTimesP2p&&t.contentRequestResponseTimesP2p.length)for(n=0;n<t.contentRequestResponseTimesP2p.length;++n)e.uint32(416).uint32(t.contentRequestResponseTimesP2p[n]);if(null!=t.inboundProtocol&&Object.hasOwnProperty.call(t,"inboundProtocol")&&e.uint32(424).int32(t.inboundProtocol),null!=t.inboundConnectionCount&&Object.hasOwnProperty.call(t,"inboundConnectionCount")&&e.uint32(432).uint32(t.inboundConnectionCount),null!=t.inboundThroughputProbe&&Object.hasOwnProperty.call(t,"inboundThroughputProbe")&&e.uint32(440).int32(t.inboundThroughputProbe),null!=t.uplinkCapacity&&Object.hasOwnProperty.call(t,"uplinkCapacity")&&e.uint32(453).float(t.uplinkCapacity),null!=t.inboundPeeringType&&Object.hasOwnProperty.call(t,"inboundPeeringType")&&e.uint32(464).int32(t.inboundPeeringType),null!=t.uplinkSpeedError&&Object.hasOwnProperty.call(t,"uplinkSpeedError")&&e.uint32(472).int32(t.uplinkSpeedError),null!=t.cpuLoad&&Object.hasOwnProperty.call(t,"cpuLoad")&&e.uint32(488).uint32(t.cpuLoad),null!=t.sessionId&&Object.hasOwnProperty.call(t,"sessionId")&&e.uint32(498).string(t.sessionId),null!=t.osName&&Object.hasOwnProperty.call(t,"osName")&&e.uint32(506).string(t.osName),null!=t.osVersion&&Object.hasOwnProperty.call(t,"osVersion")&&e.uint32(514).string(t.osVersion),null!=t.appName&&Object.hasOwnProperty.call(t,"appName")&&e.uint32(522).string(t.appName),null!=t.appVersion&&Object.hasOwnProperty.call(t,"appVersion")&&e.uint32(530).string(t.appVersion),null!=t.browserName&&Object.hasOwnProperty.call(t,"browserName")&&e.uint32(538).string(t.browserName),null!=t.browserVersion&&Object.hasOwnProperty.call(t,"browserVersion")&&e.uint32(546).string(t.browserVersion),null!=t.playerName&&Object.hasOwnProperty.call(t,"playerName")&&e.uint32(554).string(t.playerName),null!=t.playerVersion&&Object.hasOwnProperty.call(t,"playerVersion")&&e.uint32(562).string(t.playerVersion),null!=t.hrefLocation&&Object.hasOwnProperty.call(t,"hrefLocation")&&e.uint32(570).string(t.hrefLocation),null!=t.viewportWidth&&Object.hasOwnProperty.call(t,"viewportWidth")&&e.uint32(576).uint32(t.viewportWidth),null!=t.viewportHeight&&Object.hasOwnProperty.call(t,"viewportHeight")&&e.uint32(584).uint32(t.viewportHeight),null!=t.videoResolutionWidth&&Object.hasOwnProperty.call(t,"videoResolutionWidth")&&e.uint32(592).uint32(t.videoResolutionWidth),null!=t.videoResolutionHeight&&Object.hasOwnProperty.call(t,"videoResolutionHeight")&&e.uint32(600).uint32(t.videoResolutionHeight),null!=t.playerState&&Object.hasOwnProperty.call(t,"playerState")&&e.uint32(610).string(t.playerState),null!=t.startingTime&&Object.hasOwnProperty.call(t,"startingTime")&&e.uint32(616).uint32(t.startingTime),null!=t.seekingTime&&Object.hasOwnProperty.call(t,"seekingTime")&&e.uint32(624).uint32(t.seekingTime),null!=t.bufferingTime&&Object.hasOwnProperty.call(t,"bufferingTime")&&e.uint32(632).uint32(t.bufferingTime),null!=t.playingTime&&Object.hasOwnProperty.call(t,"playingTime")&&e.uint32(640).uint32(t.playingTime),null!=t.pauseTime&&Object.hasOwnProperty.call(t,"pauseTime")&&e.uint32(648).uint32(t.pauseTime),null!=t.bufferingEvents&&Object.hasOwnProperty.call(t,"bufferingEvents")&&e.uint32(656).uint32(t.bufferingEvents),null!=t.streamState&&Object.hasOwnProperty.call(t,"streamState")&&e.uint32(666).string(t.streamState),null!=t.aliveTime&&Object.hasOwnProperty.call(t,"aliveTime")&&e.uint32(672).uint32(t.aliveTime),null!=t.contentSteeringEnabled&&Object.hasOwnProperty.call(t,"contentSteeringEnabled")&&e.uint32(680).bool(t.contentSteeringEnabled),null!=t.contentSteeringResourceId&&Object.hasOwnProperty.call(t,"contentSteeringResourceId")&&e.uint32(688).uint32(t.contentSteeringResourceId),null!=t.contentSteeringPathwayPriority&&t.contentSteeringPathwayPriority.length)for(n=0;n<t.contentSteeringPathwayPriority.length;++n)e.uint32(698).string(t.contentSteeringPathwayPriority[n]);if(null!=t.contentSteeringPathway&&Object.hasOwnProperty.call(t,"contentSteeringPathway")&&e.uint32(706).string(t.contentSteeringPathway),null!=t.peers&&t.peers.length)for(n=0;n<t.peers.length;++n)ca.s73_metrics.Peer.encode(t.peers[n],e.uint32(810).fork()).ldelim();return null!=t.customDimension_1&&Object.hasOwnProperty.call(t,"customDimension_1")&&e.uint32(826).string(t.customDimension_1),null!=t.customDimension_2&&Object.hasOwnProperty.call(t,"customDimension_2")&&e.uint32(834).string(t.customDimension_2),null!=t.customDimension_3&&Object.hasOwnProperty.call(t,"customDimension_3")&&e.uint32(842).string(t.customDimension_3),e},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(!aa.isString(t.nodeId))return"nodeId: string expected";if(!aa.isString(t.deviceId))return"deviceId: string expected";if(null!=t.channelId&&t.hasOwnProperty("channelId")&&!aa.isString(t.channelId))return"channelId: string expected";if(!aa.isString(t.representationId))return"representationId: string expected";if(!aa.isString(t.streamId))return"streamId: string expected";switch(t.source){default:return"source: enum value expected";case 0:case 1:}if(null!=t.receiveFromNodeId&&t.hasOwnProperty("receiveFromNodeId")&&!aa.isString(t.receiveFromNodeId))return"receiveFromNodeId: string expected";switch(t.natType){default:return"natType: enum value expected";case 0:case 1:case 2:case 3:}switch(t.connectionStatus){default:return"connectionStatus: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 100:}switch(t.connectionType){default:return"connectionType: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:}switch(t.operatingSystemName){default:return"operatingSystemName: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:}if(!aa.isString(t.operatingSystemVersion))return"operatingSystemVersion: string expected";switch(t.platformName){default:return"platformName: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:}if(!aa.isString(t.platformVersion))return"platformVersion: string expected";if(!aa.isString(t.maskedStreamUri))return"maskedStreamUri: string expected";if(null!=t.bitrate&&t.hasOwnProperty("bitrate")&&!aa.isString(t.bitrate))return"bitrate: string expected";if(null!=t.peerSettings&&t.hasOwnProperty("peerSettings")&&!aa.isString(t.peerSettings))return"peerSettings: string expected";if(null!=t.sdkVersion&&t.hasOwnProperty("sdkVersion")&&!aa.isString(t.sdkVersion))return"sdkVersion: string expected";if(null!=t.datachannelWasNotEstablished&&t.hasOwnProperty("datachannelWasNotEstablished")){if(!Array.isArray(t.datachannelWasNotEstablished))return"datachannelWasNotEstablished: array expected";for(var e=0;e<t.datachannelWasNotEstablished.length;++e)if(!aa.isString(t.datachannelWasNotEstablished[e]))return"datachannelWasNotEstablished: string[] expected"}if(null!=t.currentHost&&t.hasOwnProperty("currentHost")&&!aa.isString(t.currentHost))return"currentHost: string expected";if(null!=t.responseCdn&&t.hasOwnProperty("responseCdn")&&!aa.isString(t.responseCdn))return"responseCdn: string expected";if(null!=t.bufferHealth&&t.hasOwnProperty("bufferHealth")&&!aa.isInteger(t.bufferHealth))return"bufferHealth: integer expected";if(null!=t.droppedFramesPerSecond&&t.hasOwnProperty("droppedFramesPerSecond")&&!aa.isInteger(t.droppedFramesPerSecond))return"droppedFramesPerSecond: integer expected";if(null!=t.timeToFirstFrame&&t.hasOwnProperty("timeToFirstFrame")&&!aa.isInteger(t.timeToFirstFrame))return"timeToFirstFrame: integer expected";if(null!=t.bufferingRatio&&t.hasOwnProperty("bufferingRatio")&&"number"!=typeof t.bufferingRatio)return"bufferingRatio: number expected";if(null!=t.playbackTime&&t.hasOwnProperty("playbackTime")&&"number"!=typeof t.playbackTime)return"playbackTime: number expected";if(null!=t.aggregateBufferFillingRate&&t.hasOwnProperty("aggregateBufferFillingRate")&&"number"!=typeof t.aggregateBufferFillingRate)return"aggregateBufferFillingRate: number expected";if(null!=t.representationBufferFillingRate&&t.hasOwnProperty("representationBufferFillingRate")&&"number"!=typeof t.representationBufferFillingRate)return"representationBufferFillingRate: number expected";if(null!=t.cdnDownlinkThroughput&&t.hasOwnProperty("cdnDownlinkThroughput")&&!aa.isInteger(t.cdnDownlinkThroughput))return"cdnDownlinkThroughput: integer expected";if(null!=t.p2pDownlinkThroughput&&t.hasOwnProperty("p2pDownlinkThroughput")&&!aa.isInteger(t.p2pDownlinkThroughput))return"p2pDownlinkThroughput: integer expected";if(null!=t.downlinkSpeed&&t.hasOwnProperty("downlinkSpeed")&&!aa.isInteger(t.downlinkSpeed))return"downlinkSpeed: integer expected";if(null!=t.uplinkSpeed&&t.hasOwnProperty("uplinkSpeed")&&!aa.isInteger(t.uplinkSpeed))return"uplinkSpeed: integer expected";if(null!=t.roundTripTime&&t.hasOwnProperty("roundTripTime")&&!aa.isInteger(t.roundTripTime))return"roundTripTime: integer expected";if(null!=t.interarrivalJitter&&t.hasOwnProperty("interarrivalJitter")&&"number"!=typeof t.interarrivalJitter)return"interarrivalJitter: number expected";if(null!=t.packetLoss&&t.hasOwnProperty("packetLoss")&&!aa.isInteger(t.packetLoss))return"packetLoss: integer expected";if(null!=t.joinResponseTime&&t.hasOwnProperty("joinResponseTime")&&!aa.isInteger(t.joinResponseTime))return"joinResponseTime: integer expected";if(null!=t.contentRequestResponseTimesCdn&&t.hasOwnProperty("contentRequestResponseTimesCdn")){if(!Array.isArray(t.contentRequestResponseTimesCdn))return"contentRequestResponseTimesCdn: array expected";for(e=0;e<t.contentRequestResponseTimesCdn.length;++e)if(!aa.isInteger(t.contentRequestResponseTimesCdn[e]))return"contentRequestResponseTimesCdn: integer[] expected"}if(null!=t.contentRequestResponseTimesP2p&&t.hasOwnProperty("contentRequestResponseTimesP2p")){if(!Array.isArray(t.contentRequestResponseTimesP2p))return"contentRequestResponseTimesP2p: array expected";for(e=0;e<t.contentRequestResponseTimesP2p.length;++e)if(!aa.isInteger(t.contentRequestResponseTimesP2p[e]))return"contentRequestResponseTimesP2p: integer[] expected"}if(null!=t.inboundProtocol&&t.hasOwnProperty("inboundProtocol"))switch(t.inboundProtocol){default:return"inboundProtocol: enum value expected";case 0:case 1:case 2:}if(null!=t.inboundConnectionCount&&t.hasOwnProperty("inboundConnectionCount")&&!aa.isInteger(t.inboundConnectionCount))return"inboundConnectionCount: integer expected";if(null!=t.inboundThroughputProbe&&t.hasOwnProperty("inboundThroughputProbe")&&!aa.isInteger(t.inboundThroughputProbe))return"inboundThroughputProbe: integer expected";if(null!=t.uplinkCapacity&&t.hasOwnProperty("uplinkCapacity")&&"number"!=typeof t.uplinkCapacity)return"uplinkCapacity: number expected";if(null!=t.inboundPeeringType&&t.hasOwnProperty("inboundPeeringType"))switch(t.inboundPeeringType){default:return"inboundPeeringType: enum value expected";case 0:case 1:case 2:}if(null!=t.uplinkSpeedError&&t.hasOwnProperty("uplinkSpeedError"))switch(t.uplinkSpeedError){default:return"uplinkSpeedError: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:}if(null!=t.cpuLoad&&t.hasOwnProperty("cpuLoad")&&!aa.isInteger(t.cpuLoad))return"cpuLoad: integer expected";if(null!=t.sessionId&&t.hasOwnProperty("sessionId")&&!aa.isString(t.sessionId))return"sessionId: string expected";if(null!=t.osName&&t.hasOwnProperty("osName")&&!aa.isString(t.osName))return"osName: string expected";if(null!=t.osVersion&&t.hasOwnProperty("osVersion")&&!aa.isString(t.osVersion))return"osVersion: string expected";if(null!=t.appName&&t.hasOwnProperty("appName")&&!aa.isString(t.appName))return"appName: string expected";if(null!=t.appVersion&&t.hasOwnProperty("appVersion")&&!aa.isString(t.appVersion))return"appVersion: string expected";if(null!=t.browserName&&t.hasOwnProperty("browserName")&&!aa.isString(t.browserName))return"browserName: string expected";if(null!=t.browserVersion&&t.hasOwnProperty("browserVersion")&&!aa.isString(t.browserVersion))return"browserVersion: string expected";if(null!=t.playerName&&t.hasOwnProperty("playerName")&&!aa.isString(t.playerName))return"playerName: string expected";if(null!=t.playerVersion&&t.hasOwnProperty("playerVersion")&&!aa.isString(t.playerVersion))return"playerVersion: string expected";if(null!=t.hrefLocation&&t.hasOwnProperty("hrefLocation")&&!aa.isString(t.hrefLocation))return"hrefLocation: string expected";if(null!=t.viewportWidth&&t.hasOwnProperty("viewportWidth")&&!aa.isInteger(t.viewportWidth))return"viewportWidth: integer expected";if(null!=t.viewportHeight&&t.hasOwnProperty("viewportHeight")&&!aa.isInteger(t.viewportHeight))return"viewportHeight: integer expected";if(null!=t.videoResolutionWidth&&t.hasOwnProperty("videoResolutionWidth")&&!aa.isInteger(t.videoResolutionWidth))return"videoResolutionWidth: integer expected";if(null!=t.videoResolutionHeight&&t.hasOwnProperty("videoResolutionHeight")&&!aa.isInteger(t.videoResolutionHeight))return"videoResolutionHeight: integer expected";if(null!=t.playerState&&t.hasOwnProperty("playerState")&&!aa.isString(t.playerState))return"playerState: string expected";if(null!=t.startingTime&&t.hasOwnProperty("startingTime")&&!aa.isInteger(t.startingTime))return"startingTime: integer expected";if(null!=t.seekingTime&&t.hasOwnProperty("seekingTime")&&!aa.isInteger(t.seekingTime))return"seekingTime: integer expected";if(null!=t.bufferingTime&&t.hasOwnProperty("bufferingTime")&&!aa.isInteger(t.bufferingTime))return"bufferingTime: integer expected";if(null!=t.playingTime&&t.hasOwnProperty("playingTime")&&!aa.isInteger(t.playingTime))return"playingTime: integer expected";if(null!=t.pauseTime&&t.hasOwnProperty("pauseTime")&&!aa.isInteger(t.pauseTime))return"pauseTime: integer expected";if(null!=t.bufferingEvents&&t.hasOwnProperty("bufferingEvents")&&!aa.isInteger(t.bufferingEvents))return"bufferingEvents: integer expected";if(null!=t.streamState&&t.hasOwnProperty("streamState")&&!aa.isString(t.streamState))return"streamState: string expected";if(null!=t.aliveTime&&t.hasOwnProperty("aliveTime")&&!aa.isInteger(t.aliveTime))return"aliveTime: integer expected";if(null!=t.contentSteeringEnabled&&t.hasOwnProperty("contentSteeringEnabled")&&"boolean"!=typeof t.contentSteeringEnabled)return"contentSteeringEnabled: boolean expected";if(null!=t.contentSteeringResourceId&&t.hasOwnProperty("contentSteeringResourceId")&&!aa.isInteger(t.contentSteeringResourceId))return"contentSteeringResourceId: integer expected";if(null!=t.contentSteeringPathwayPriority&&t.hasOwnProperty("contentSteeringPathwayPriority")){if(!Array.isArray(t.contentSteeringPathwayPriority))return"contentSteeringPathwayPriority: array expected";for(e=0;e<t.contentSteeringPathwayPriority.length;++e)if(!aa.isString(t.contentSteeringPathwayPriority[e]))return"contentSteeringPathwayPriority: string[] expected"}if(null!=t.contentSteeringPathway&&t.hasOwnProperty("contentSteeringPathway")&&!aa.isString(t.contentSteeringPathway))return"contentSteeringPathway: string expected";if(null!=t.peers&&t.hasOwnProperty("peers")){if(!Array.isArray(t.peers))return"peers: array expected";for(e=0;e<t.peers.length;++e){var n=ca.s73_metrics.Peer.verify(t.peers[e]);if(n)return"peers."+n}}return null!=t.customDimension_1&&t.hasOwnProperty("customDimension_1")&&!aa.isString(t.customDimension_1)?"customDimension_1: string expected":null!=t.customDimension_2&&t.hasOwnProperty("customDimension_2")&&!aa.isString(t.customDimension_2)?"customDimension_2: string expected":null!=t.customDimension_3&&t.hasOwnProperty("customDimension_3")&&!aa.isString(t.customDimension_3)?"customDimension_3: string expected":null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.Metrics"},t}(),t.Message=function(){function t(t){if(t)for(var e=Object.keys(t),n=0;n<e.length;++n)null!=t[e[n]]&&(this[e[n]]=t[e[n]])}let e;return t.prototype.type=0,t.prototype.metrics=null,Object.defineProperty(t.prototype,"message",{get:aa.oneOfGetter(e=["metrics"]),set:aa.oneOfSetter(e)}),t.encode=function(t,e){return e||(e=oa.create()),e.uint32(8).int32(t.type),null!=t.metrics&&Object.hasOwnProperty.call(t,"metrics")&&ca.s73_metrics.Metrics.encode(t.metrics,e.uint32(18).fork()).ldelim(),e},t.verify=function(t){if("object"!=typeof t||null===t)return"object expected";if(0!==t.type)return"type: enum value expected";if(null!=t.metrics&&t.hasOwnProperty("metrics")){var e=ca.s73_metrics.Metrics.verify(t.metrics);if(e)return"metrics."+e}return null},t.getTypeUrl=function(t){return void 0===t&&(t="type.googleapis.com"),t+"/s73_metrics.Message"},t.Type=function(){const t={},e=Object.create(t);return e[t[0]="METRICS"]=0,e}(),t}(),t})();function la(t){return Math.round(8*t/1e3)}class ha extends Tt{constructor(){super(),this.polyNet=Un(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("Metrics"),this.eventBus=Ct(this.context).getInstance(),this.dataChannelService=_o(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.stats=cs(this.context).getInstance(),this.computeMetricsTimer=Ss(this.context).createInstance(),this.enableBufferingRatio=!1,this.bufferHealthGreaterZeroCounter=0,this.bufferHealthDepletedCounter=0,this.lastPeerSettings={},this.computeMetrics=this.computeMetrics.bind(this)}start(){this.eventBus.on($t.SETTINGS_CHANGED,this.handleSettingsChangedEvent,{scope:this}),this.scheduleComputeMetricsTimer()}stop(){var t,e;null===(t=this.computeMetricsTimer)||void 0===t||t.cancel(),null===(e=this.eventBus)||void 0===e||e.offAll({scope:this})}destroy(){this.stop(),this.computeMetricsTimer=null,this.eventBus=null,this.polyNet=null,this.logger=null,this.stats=null,this.dataChannelService=null}get enabled(){return this.settings.metricsPeriod>0}computeMetrics(){var t,e;if(!this.stats)return;if(!this.enabled)return void this.clearComputeMetricsTimer();const n=this.stats.platform.browser,r=this.stats.platform.os,i=this.stats.platform.connectionType,s=this.computeBufferHealth(),o=this.computeBufferingRatio(s),a=this.computePlaybackTime(o),c=this.stats.playback.resolution,u=this.stats.playback.viewport,l=new ua.Metrics;return l.platformName=this.transformPlatformName(n.name),l.platformVersion=null!==(t=n.version)&&void 0!==t?t:"",l.operatingSystemName=this.transformOperatingSystemName(r.name),l.operatingSystemVersion=null!==(e=r.version)&&void 0!==e?e:"",l.connectionType=this.transformConnectionType(i),l.deviceId=this.polyNet.deviceId,l.channelId=this.extractChannelId(),l.nodeId=this.extractNodeId(),l.source=this.computeSource(),l.receiveFromNodeId=this.computeParentNodeId(),l.droppedFramesPerSecond=this.computeDroppedFrames(),l.bufferHealth=s,l.cdnDownlinkThroughput=this.computeCdnThroughput(),l.p2pDownlinkThroughput=this.computeP2PThroughput(),l.connectionStatus=this.computeParentConnectionStatus(),l.roundTripTime=this.computeRoundTripTime(),l.downlinkSpeed=this.computeDownSpeed(),l.aggregateBufferFillingRate=this.computeBufferFillingRate(),l.representationBufferFillingRate=l.aggregateBufferFillingRate,l.timeToFirstFrame=this.computeTimeToFirstFrame(),l.bufferingRatio=o,l.playbackTime=a,l.joinResponseTime=this.computeJoinResponseTime(),l.natType=this.computeNatType(),l.streamId=this.extractStreamId(),l.maskedStreamUri=this.extractMaskedStreamUri(),l.representationId=this.extractRepresentationId(),l.bitrate=this.computeBitrate(),l.uplinkCapacity=this.computeUplinkCapacity(),l.peers=this.extractPeersMetrics(),l.contentRequestResponseTimesCdn=this.extractCRRTFromHTTP(),l.contentRequestResponseTimesP2p=this.extractCRRTFromP2P(),l.inboundProtocol=this.computeInboundProtocol(),l.inboundConnectionCount=this.computeInboundConnectionCount(),l.inboundPeeringType=this.computeInboundPeeringType(),l.datachannelWasNotEstablished=this.computeDatachannelWasNotEstablished(),l.peerSettings=this.extractPeerSettings(),l.sdkVersion=this.stats.polyNet.sdkVersion,l.currentHost=this.stats.mss.currentHost,l.responseCdn=this.computeResponseCdn(),l.sessionId=this.computeSessionId(),l.osName=this.computeOsName(),l.osVersion=this.computeOsVersion(),l.browserName=this.computeBrowserName(),l.browserVersion=this.computeBrowserVersion(),l.hrefLocation=this.computeLocationHref(),l.playerName=this.computePlayerName(),l.playerVersion=this.computePlayerVersion(),l.videoResolutionWidth=c.width,l.videoResolutionHeight=c.height,l.viewportWidth=u.width,l.viewportHeight=u.height,l.aliveTime=this.computeAliveTime(),l.streamState=this.computeStreamState(),l.playerState=this.computePlayerState(),l.bufferingEvents=this.computeBufferingEvents(),l.startingTime=this.stats.playback.startingTime,l.seekingTime=this.stats.playback.seekingTime,l.bufferingTime=this.stats.playback.bufferingTime,l.playingTime=this.stats.playback.playingTime,l.pauseTime=this.stats.playback.pauseTime,l.contentSteeringEnabled=this.isContentSteeringEnabled,l.contentSteeringResourceId=this.stats.contentSteering.resourceId,l.contentSteeringPathway=this.extractContentSteeringPathway(),l.contentSteeringPathwayPriority=this.extractContentSteeringPathwayPriority(),l.customDimension_1=this.customDimension1,l.customDimension_2=this.customDimension2,l.customDimension_3=this.customDimension3,this.stats.clean(),this.logger.logEvery(10,"metricsComputed",Ut.metricsComputed(ha.stringifyMetrics(l))),this.eventBus.emit($t.METRICS_MESSAGE,{target:this,metrics:l}),l}static stringifyMetrics(t){const e={platformName:ua.Platform.Name[t.platformName],operatingSystemName:ua.OperatingSystem.Name[t.operatingSystemName],connectionType:ua.Connection.Type[t.connectionType],connectionStatus:ua.Connection.Status[t.connectionStatus],natType:ua.Nat.Type[t.natType],inboundProtocol:ua.InboundProtocol[t.inboundProtocol],source:ua.Source[t.source]},n=t.peers.map((t=>Object.assign(Object.assign({},t),{outboundConnectionStatus:ua.Connection.Status[t.outboundConnectionStatus]})));return Object.assign(Object.assign(Object.assign({},t),e),{peers:n})}extractNodeId(){return this.polyNet.nodeId||"no-node-id"}extractChannelId(){return this.settings.channelId}extractStreamId(){return this.polyNet.streamId||"no-stream-id"}extractMaskedStreamUri(){return this.stats.stream.maskedStreamUri}extractRepresentationId(){return this.stats.stream.representationId||"no-representation-id"}computeBitrate(){const t=this.stats.stream.parsedBitrate,e=this.stats.stream.estimatedBitrate,n=this.stats.stream.isMonoBitrate;return this.settings.enableEstimatedBitrate?`${t||e}`:ot.isNil(t)?n?"monobitrate":void 0:`${t}`}computeUplinkCapacity(){if(this.settings.teca.enableTeca)return"buffering"===this.stats.playback.state?0:this.stats.polyNet.tecaCapacity}scheduleComputeMetricsTimer(){this.clearComputeMetricsTimer(),this.enabled&&this.computeMetricsTimer.setInterval("Timer-Metrics",this.settings.metricsPeriod,this.computeMetrics,!0)}clearComputeMetricsTimer(){this.computeMetricsTimer&&this.computeMetricsTimer.cancel()}extractCRRTFromHTTP(){return this.stats.polyNet.contentRequestResponseTimes?this.stats.polyNet.contentRequestResponseTimes.filter((t=>t.origin===Yi.Origin.HTTP)).map((t=>t.contentRequestResponseTime)):[]}extractCRRTFromP2P(){return this.stats.polyNet.contentRequestResponseTimes?this.stats.polyNet.contentRequestResponseTimes.filter((t=>t.origin===Yi.Origin.WEB_RTC)).map((t=>t.contentRequestResponseTime)):[]}computeBufferHealth(){const t=this.stats.playback.bufferHealth;if(!ot.isNil(t))return Math.round(t)}computeBufferingRatio(t){if(!this.enableBufferingRatio){if(!(ot.isFinite(t)&&t>ha.bufferHealthZeroThreshold))return;this.enableBufferingRatio=!0}ot.isFinite(t)&&t>=ha.bufferHealthZeroThreshold?this.bufferHealthGreaterZeroCounter++:this.bufferHealthDepletedCounter++;const e=this.bufferHealthGreaterZeroCounter+this.bufferHealthDepletedCounter;return e>0?this.bufferHealthDepletedCounter/e:void 0}computePlaybackTime(t){if(!ot.isFinite(t))return;const{metricsPeriod:e}=this.settings;return!ot.isFinite(e)||e<=0?void 0:(this.bufferHealthGreaterZeroCounter+this.bufferHealthDepletedCounter)*(e/1e3)}computeDroppedFrames(){return this.stats.playback.droppedFrames}computeTimeToFirstFrame(){const t=this.stats.playback.timeToFirstFrame;return t?Math.floor(t):void 0}computePlayerState(){return this.stats.playback.state}computeBufferingEvents(){return this.stats.playback.bufferingEvents}computeCdnThroughput(){return la(this.stats.content.throughputHttp)}computeP2PThroughput(){return la(this.stats.content.throughputWebRTC)}computeParentNodeId(){const t=this.dataChannelService.findFirstInboundWebRTC();return t?t.nodeId:void 0}computeSource(){return"http"===this.stats.content.source?ua.Source.CDN:ua.Source.P2P}computeParentConnectionStatus(){if(this.polyNet.isConnected){const t=this.dataChannelService.findFirstInboundWebRTC();return t?t.isConnected?ua.Connection.Status.P2P_CONNECTED:ua.Connection.Status.P2P_CONNECTING:ua.Connection.Status.NO_PARENT}if(!this.stats.platform.isWebRTCSupported)return ua.Connection.Status.P2P_NOT_SUPPORTED;if(!this.stats.platform.isAnyMediaSourceApiSupported)return ua.Connection.Status.MEDIA_SOURCE_EXTENSIONS_NOT_SUPPORTED;switch(this.stats.polyNet.revokedStatus){case wr.RevokedStatus.PROTOCOL_NOT_SUPPORTED:return ua.Connection.Status.PROTOCOL_NOT_SUPPORTED;case wr.RevokedStatus.NOT_ALLOWED:return ua.Connection.Status.NOT_ALLOWED;case wr.RevokedStatus.MAX_USERS_PER_API_KEY:return ua.Connection.Status.MAX_USERS_PER_KEY_REACHED;case wr.RevokedStatus.OUT_OF_LIVE_WINDOW:return ua.Connection.Status.CONTENT_NOT_SUPPORTED}return ua.Connection.Status.UNKNOWN_STATUS}computeDownSpeed(){return ot.isNil(this.stats.content.downSpeed)?void 0:Math.round(this.stats.content.downSpeed)}computeRoundTripTime(){const t=Math.round(ot.mean(this.stats.network.rtt));return ot.isFinite(t)?t:void 0}computeBufferFillingRate(){return this.stats.content.bufferFillingRate}computeSessionId(){return this.stats.polyNet.sessionId}computeOsName(){return this.stats.platform.os.name||"unknown"}computeOsVersion(){return this.stats.platform.os.version||"unknown"}computeBrowserName(){return this.stats.platform.browser.name||"unknown"}computeBrowserVersion(){return this.stats.platform.browser.version||"unknown"}computeLocationHref(){return this.stats.platform.location}computePlayerName(){return this.stats.platform.player.name}computePlayerVersion(){return this.stats.platform.player.version}computeAliveTime(){return this.stats.aliveTime}computeStreamState(){return this.stats.stream.streamState}handleSettingsChangedEvent(t){const{diffSettings:e}=t;void 0!==e.metricsPeriod&&this.scheduleComputeMetricsTimer()}computeNatType(){if(!this.stats.nat||!this.stats.nat.type)return ua.Nat.Type.UNKNOWN;switch(this.stats.nat.type){case fr.Type.UNKNOWN:return ua.Nat.Type.UNKNOWN;case fr.Type.SYMMETRIC:return ua.Nat.Type.SYMMETRIC;case fr.Type.NON_SYMMETRIC:return ua.Nat.Type.NON_SYMMETRIC;case fr.Type.SEQUENTIAL:return ua.Nat.Type.SEQUENTIAL}}transformPlatformName(t){switch(t){case"chrome":case"chrome_webview":case"chrome_headless":return ua.Platform.Name.CHROME;case"chromium":return ua.Platform.Name.CHROMIUM;case"edge":return ua.Platform.Name.EDGE;case"ie":case"iemobile":return ua.Platform.Name.EXPLORER;case"firefox":return ua.Platform.Name.FIREFOX;case"opera":case"opera_mini":case"opera_mobi":case"opera_tablet":return ua.Platform.Name.OPERA;case"safari":case"mobile_safari":return ua.Platform.Name.SAFARI;default:return ua.Platform.Name.UNKNOWN}}transformOperatingSystemName(t){switch(t){case"android":return ua.OperatingSystem.Name.ANDROID;case"ios":return ua.OperatingSystem.Name.IOS;case"linux":case"ubuntu":return ua.OperatingSystem.Name.LINUX;case"mac_os":return ua.OperatingSystem.Name.MACOS;case"windows":case"windows_phone":case"windows_mobile":return ua.OperatingSystem.Name.WINDOWS;default:return ua.OperatingSystem.Name.UNKNOWN}}transformConnectionType(t){switch(t){case"bluetooth":return ua.Connection.Type.BLUETOOTH;case"cellular":return ua.Connection.Type.CELLULAR;case"ethernet":return ua.Connection.Type.ETHERNET;case"mixed":case"none":return ua.Connection.Type.NONE;case"other":return ua.Connection.Type.OTHER;case"unknown":return ua.Connection.Type.UNKNOWN;case"wifi":return ua.Connection.Type.WIFI;case"wimax":return ua.Connection.Type.WIMAX;default:return this.logger.trace(`Invalid connection type: '${t}'`),ua.Connection.Type.UNKNOWN}}computeJoinResponseTime(){const t=this.stats.polyNet.joinResponseTime,e=this.stats.polyNet.joinRequestTime;if(!(ot.isNil(e)||ot.isNil(t)||e>t))return Math.round(t-e)}computeInboundProtocol(){const t=this.dataChannelService.findFirstConnectedInbound();if(!t)return ua.InboundProtocol.HTTP;switch(t.connectionTransport){case"http":return ua.InboundProtocol.HTTP;case"sctp":return ua.InboundProtocol.SCTP;default:return}}computeInboundConnectionCount(){const t=this.dataChannelService.findFirstConnectedInbound();return t?t.connectionCount:1}computeInboundPeeringType(){if(this.stats.datachannel.peeringType)switch(this.stats.datachannel.peeringType){case Ds.PeeringType.INTER_ASN:return ua.PeeringType.INTER_ASN;case Ds.PeeringType.INTRA_ASN:return ua.PeeringType.INTRA_ASN;case Ds.PeeringType.LAN:return ua.PeeringType.LAN}}computeDatachannelWasNotEstablished(){return this.stats.datachannel.dataChannelsNotEstablished}get isContentSteeringEnabled(){return this.settings.cs.enableCs&&!this.settings.cs.isRevoked&&!ot.isEmpty(this.settings.contentSteeringEndpoint)}extractContentSteeringPathway(){if(this.isContentSteeringEnabled)return this.stats.contentSteering.pathwayName}extractContentSteeringPathwayPriority(){if(this.isContentSteeringEnabled)return this.stats.contentSteering.pathwayPriority}computeResponseCdn(){let t=this.stats.contentSteering.responseCdn;return ot.isString(t)&&(t=t.trim()),t||void 0}extractPeersMetrics(){return this.stats.datachannel.dataChannels?this.stats.datachannel.dataChannels.filter((t=>t.direction===Ds.Direction.OUTBOUND)).map((t=>{const e=new ua.Peer;return e.nodeId=t.nodeId,e.aggregateBufferFillingRate=t.bufferFillingRate,e.outboundConnectionStatus=t.state===Ds.State.CONNECTED?ua.Connection.Status.P2P_CONNECTED:ua.Connection.Status.P2P_CONNECTING,e})):[]}customSnakeCaseObject(t){return ot.transform(t,(function t(e,n,r){_n(n)&&(n=ot.transform(n,t)),e[r=ot.snakeCase(r||"").replace(/p_2_p/g,"p2p").replace(/v_/g,"v")]=n}))}extractPeerSettings(){const t=this.customSnakeCaseObject(ot.pick(this.settings,ha.reportableSettings));if(!ot.isEqual(this.lastPeerSettings,t))return this.lastPeerSettings=t,JSON.stringify(this.lastPeerSettings)}get customDimension1(){return this.settings.customDimension1||void 0}get customDimension2(){return this.settings.customDimension2||void 0}get customDimension3(){return this.settings.customDimension3||void 0}}ha.bufferHealthZeroThreshold=1e3,ha.reportableSettings=["bufferHealthThresholdRatio","enableEstimatedBitrate","enablePullOnce","loopCheckerTtl","maxConcurrentPeerNegotiation","maxOutbound","multiPeer","natTraversal","nextSegmentDurationFactor","playerContentThrottlingMode","sdkFeatureFlags","timeoutP2PConnection","uploadCapacity","teca"];const da=Et.getInstanceFactory(ha);class pa extends Tt{constructor(){super(),this.accumulatedCdnDownThroughput=0,this.accumulatedP2pDownThroughput=0,this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("PublicMetricsService"),this.stats=cs(this.context).getInstance(),this.settings=On(this.context).getInstance()}start(){this.eventBus.on($t.METRICS_MESSAGE,this.handleMetricMessageEvent,{scope:this})}stop(){this.eventBus.offAll({scope:this})}destroy(){this.stop(),this.eventBus=null,this.settings=null,this.stats=null}handleMetricMessageEvent(t){var e,n;if(!(null==t?void 0:t.metrics))return;const{metrics:r}=t;this.accumulatedCdnDownThroughput+=r.cdnDownlinkThroughput||0,this.accumulatedP2pDownThroughput+=r.p2pDownlinkThroughput||0;const[i]=this.computeInboundMetrics(),s=this.computeOutboundMetrics(),o={accumulatedCdnDownThroughput:this.accumulatedCdnDownThroughput,accumulatedP2pDownThroughput:this.accumulatedP2pDownThroughput,bitrate:r.bitrate,bufferFillingRate:pa.format(r.representationBufferFillingRate),cdnDownThroughput:pa.format(r.cdnDownlinkThroughput),connectionStatus:ot.isNil(r.connectionStatus)?void 0:`${ua.Connection.Status[r.connectionStatus].toLowerCase()}`,date:new Date,deviceId:r.deviceId,downSpeed:pa.format(r.downlinkSpeed),gapsInfo:this.stats.playback.gapsInfo,inboundNodeId:`${i?i.nodeId:pa.CDN_NODE_ID}`,isConnected:[jn.States.CONNECTED,jn.States.JOINED].includes(this.stats.polyNet.state),maskedStreamUri:r.maskedStreamUri,nodeId:r.nodeId,outboundMetrics:s,p2pDownThroughput:pa.format(r.p2pDownlinkThroughput),playerBufferHealth:pa.format(r.bufferHealth),playerTimeToFirstFrame:pa.format(r.timeToFirstFrame),representationId:r.representationId,roundTripTime:pa.format(r.roundTripTime),sessionId:this.stats.polyNet.sessionId,source:ot.isNil(r.source)?void 0:`${ua.Source[r.source].toLowerCase()}`,streamId:r.streamId,streamUri:this.stats.stream.streamUri};null===(n=(e=this.settings).onMetrics)||void 0===n||n.call(e,o),this.logger.trace(Ut.beaconMetrics(o))}computeInboundMetrics(){return this.stats.datachannel.dataChannels?this.stats.datachannel.dataChannels.filter((t=>t.direction===Ds.Direction.INBOUND)).map((t=>({nodeId:`${t.nodeId}`}))):[]}computeOutboundMetrics(){return this.stats.datachannel.dataChannels?this.stats.datachannel.dataChannels.filter((t=>t.direction===Ds.Direction.OUTBOUND)).map((t=>{const e=t.state===Ds.State.CONNECTED?`${ua.Connection.Status[ua.Connection.Status.P2P_CONNECTED]}`:`${ua.Connection.Status[ua.Connection.Status.P2P_CONNECTING]}`;return{bufferFillingRate:pa.format(t.bufferFillingRate),nodeId:`${t.nodeId}`,status:e.toLowerCase()}})):[]}static format(t){return ot.isNil(t)?void 0:t}}pa.CDN_NODE_ID="POI";const fa=Et.getInstanceFactory(pa);var ga=__webpack_require__(25),ya=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class ma extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("MetricsMessageSender"),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance()}start(){this.eventBus.on($t.METRICS_MESSAGE,this.handleMetricsMessageEvent,{scope:this})}stop(){var t;null===(t=this.eventBus)||void 0===t||t.off($t.METRICS_MESSAGE,this.handleMetricsMessageEvent,{scope:this})}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this})}handleMetricsMessageEvent(t){let{metrics:e}=t;return ya(this,void 0,void 0,(function*(){if(!this.settings.apiKey.metricSinkUrl)return void this.logger.logOnce("metricSinkError","PolyNetInternalError: metricSinkUrl not correctly configured",It.ERROR);const t=new ua.Message;let n;t.type=ua.Message.Type.METRICS,t.metrics=this.normalizeMetrics(e);const r=ua.Metrics.verify(t.metrics);if(r)return void dt.throw(this.logger,`Unable to send metrics due to ${r}`);n=ua.Message.encode(t).finish();const i=yield this.send(n);return i&&i.status===ma.FORBIDDEN_STATUS?(this.eventBus.emit($t.COLLECT_POLYNET_STATS,{revokedStatus:wr.RevokedStatus.NOT_ALLOWED}),this.eventBus.emit($t.REQUEST_NO_RECOVERY,{target:this}),this.stop(),void yt.throw(this.logger)):void 0}))}normalizeMetrics(t){const e=(t,n,r)=>{if(_n(n)){const i=ot.transform(n,e,{});ot.isEmpty(n)||(t[r]=i)}else{if(Array.isArray(n)){let i=ot.transform(n,e,[]);return i=i.filter((t=>!ot.isNil(t))),void(t[r]=i)}if("number"==typeof n&&!ot.isFinite(n))return this.logger.warn(`Not valid protobuf value for metrics.${r}, value=${n}`),void(t[r]=void 0);t[r]=n}};return ot.transform(t,e,{})}send(t){var e,n;return ya(this,void 0,void 0,(function*(){const r={Authorization:this.settings.apiKey.hashedKey,"Content-Type":"application/octet-stream"};try{return yield Mt().post(this.settings.apiKey.metricSinkUrl,ga.Buffer.from(t),{headers:r,responseType:"arraybuffer"})}catch(t){return gt.throw(this.logger,`HTTP code: ${(null===(e=t.response)||void 0===e?void 0:e.status)||""} URL: ${this.settings.apiKey.metricSinkUrl}`),null!==(n=t.response)&&void 0!==n?n:void 0}}))}}ma.polyNetFactoryName="MetricsMessageSender",ma.FORBIDDEN_STATUS=403;const ba=Et.getInstanceFactory(ma);class va extends Tt{constructor(){super(),this._enabled=!1,this.metrics=da(this.context).createInstance(),this.publicMetricsService=fa(this.context).createInstance(),this.metricsMessageSender=ba(this.context).createInstance()}start(){this.isEnabled||(this.metricsMessageSender.start(),this.publicMetricsService.start(),this.metrics.start(),this.setEnabled(!0))}stop(){this.metricsMessageSender.stop(),this.publicMetricsService.stop(),this.metrics.stop(),this.setEnabled(!1)}setEnabled(t){this._enabled=t}get isEnabled(){return this._enabled}destroy(){this.stop(),this.publicMetricsService.destroy(),this.metricsMessageSender.destroy(),this.metrics.destroy(),this.publicMetricsService=null,this.metricsMessageSender=null,this.metrics=null}}va.polyNetFactoryName="MetricsService";const wa=Et.getSingletonFactory(va);class Sa extends Tt{constructor(){super(),this.polyNet=Un(this.context).getInstance(),this.metricsService=wa(this.context).getInstance(),this.settings=On(this.context).getInstance()}start(){this.metricsService.start()}destroy(){this.polyNet=null,this.metricsService=null,this.settings=null}enableP2P(){this.metricsService.isEnabled&&this.polyNet.updateAbility(!0)}disableP2P(){this.polyNet.updateAbility(!1)}enableMss(){this.settings.setup({mss:{enableMss:!0}})}disableMss(){this.settings.setup({mss:{enableMss:!1}})}enableCs(){this.settings.setup({cs:{enableCs:!0}})}disableCs(){this.settings.setup({cs:{enableCs:!1}})}}Sa.polyNetFactoryName="FeatureManager";const Ea=Et.getSingletonFactory(Sa);class _a{}class Ca extends EventTarget{constructor(){super(...arguments),this.readyState=0,this.responseText=null}}class Ta{get isInit(){return"init"===this.id}}class Ia{get initFragment(){return this.findFragmentById("init")}update(t){Object.assign(this,t)}findFragmentByUrl(t){if(this.fragments)return this.fragments.findByUrl(t)}findFragmentById(t){if(this.fragments)return this.fragments.findById(t)}}class Na{constructor(){this.levels=[]}findLevelByUrl(t){return this.levels.find((e=>e.url===t))}findLevelById(t){return this.levels.find((e=>e.id===t))}}const Ra=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g;class Oa{static parseAttrList(t){let e;const n={};for(Ra.lastIndex=0,e=Ra.exec(t);null!==e;){let r=e[2];const i='"';0===r.indexOf(i)&&r.lastIndexOf(i)===r.length-1&&(r=r.slice(1,-1)),n[e[1]]=r,e=Ra.exec(t)}return n}}var Aa=__webpack_require__(7204);function xa(t,e){return Aa.buildAbsoluteURL(t,e,{alwaysNormalize:!0})}class Pa extends Array{}const ka={LEVEL_PLAYLIST_REGEX_FAST:new RegExp(/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?|(?!#)(\S+)|#EXT-X-BYTERANGE:*(.+)|#EXT-X-PROGRAM-DATE-TIME:(.+)|#.*/,"g"),LEVEL_PLAYLIST_REGEX_SLOW:/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE): *(\d+))|(?:#EXT-X-(TARGETDURATION): *(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DISCONTINUITY-SEQ)UENCE:(\d+))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(VERSION):(\d+))|(?:#EXT-X-(MAP):(.+))|(?:(#)(.*):(.*))|(?:(#)(.*))(?:.*)\r?\n?/,MASTER_PLAYLIST_MEDIA_REGEX:/#EXT-X-MEDIA:(.*)/g,MASTER_PLAYLIST_REGEX:/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g,RESOLUTION_REGEX:/(\d+)x(\d+)/};class La{parse(t,e,n,r){if(e.indexOf("#EXTM3U")>=0)return t.absType="HLS",e.indexOf("#EXTINF:")>=0?La.parseLevelPlaylist(t,e,n,r):La.parseMasterPlaylist(t,e,n)}static parseMasterPlaylist(t,e,n){function r(t){const e=ka.RESOLUTION_REGEX.exec(t);if(!e)return{width:void 0,height:void 0};const n=Number(e[1]),r=Number(e[2]);return{width:ot.isFinite(n)?n:void 0,height:ot.isFinite(r)?r:void 0}}const i=new Na;let s;for(i.url=n,i.levels=[],ka.MASTER_PLAYLIST_REGEX.lastIndex=0,s=ka.MASTER_PLAYLIST_REGEX.exec(e);null!==s;){const t=new Ia,o=Oa.parseAttrList(s[1]);t.url=xa(n,s[2]),t.bitrate=parseInt(o.BANDWIDTH),t.resolution=r(o.RESOLUTION),t.mediaType="VIDEO",s=ka.MASTER_PLAYLIST_REGEX.exec(e),i.levels.push(t)}const o=ot.sortBy(i.levels,(t=>-t.bitrate));for(let t=0;t<o.length;t++){o[t].id=`${t+1} of ${o.length}`}return La.parseMasterPlaylistMedia(e,n).forEach((t=>i.levels.push(t))),t.manifest=i,t}static parseMasterPlaylistMedia(t,e){var n,r;let i;const s=[];for(ka.MASTER_PLAYLIST_MEDIA_REGEX.lastIndex=0,i=ka.MASTER_PLAYLIST_MEDIA_REGEX.exec(t);null!==i;){const o=Oa.parseAttrList(i[1]),a=new Ia;a.mediaType=o.TYPE,o.URI&&(a.url=xa(e,o.URI)),(o["GROUP-ID"]||o.NAME)&&(a.id=`${null!==(n=o["GROUP-ID"])&&void 0!==n?n:""}${null!==(r=o.NAME)&&void 0!==r?r:""}`),s.push(a),i=ka.MASTER_PLAYLIST_MEDIA_REGEX.exec(t)}return s}static parseLevelPlaylist(t,e,n,r){var i;let s,o=0;s=new Ia,s.url=n;let a,c,u=new Ta;const{blacklistedFragmentUrlRegex:l,fragmentUrlSnRegex:h,fragmentUrlSubcontentRegex:d}=r||{};for(s.fragments=new class extends Pa{findById(t){return this.find((e=>e.id===t))}findByUrl(t){return this.find((e=>e.url===t))}},c=ka.LEVEL_PLAYLIST_REGEX_FAST.exec(e),ka.LEVEL_PLAYLIST_REGEX_FAST.lastIndex=0;null!==c;){const r=c[1];if(r)u.duration=1e3*parseFloat(r);else if(c[3]){if(!isNaN(u.duration)){const t=o++;u.sn=t,s.targetDuration&&(u.presentationTime=t*s.targetDuration);const e=(" "+c[3]).slice(1);if(u.url=xa(n,e),l&&l.test(u.url))u.id="unknown";else if(h){const t=h.exec(u.url);if(t&&t[1]){const e=parseInt(t[1]);if(d){const t=d.exec(u.url);if(t&&t[1]){const n=t[1],r=1e7,i=Math.floor(Number.MAX_SAFE_INTEGER/r),s=Vi.crc32FromString(n)%i;u.id=s*r+e%r}else u.id="unknown"}else u.id=e}else u.id="unknown"}else u.id=t;"unknown"!==u.id&&s.fragments.push(u),u=new Ta}}else{for(c=c[0].match(ka.LEVEL_PLAYLIST_REGEX_SLOW),a=1;a<c.length&&void 0===c[a];a++);const e=(" "+c[a+1]).slice(1);switch(c[a]){case"PLAYLIST-TYPE":const n=e.toUpperCase();switch(n){case"VOD":case"LIVE":case"EVENT":t.streamType=n}break;case"MEDIA-SEQUENCE":o=parseInt(e);break;case"TARGETDURATION":s.targetDuration=1e3*parseFloat(e);break;case"ENDLIST":t.isLive=!1}}c=ka.LEVEL_PLAYLIST_REGEX_FAST.exec(e)}if(t.manifest&&t.manifest.url){const e=t.manifest.findLevelByUrl(s.url);s.mediaType=e.mediaType,e.update(s)}else t.manifest=new Na,s.id="monobitrate",s.mediaType="VIDEO",t.manifest.levels.push(s);if(t.isLive=null===(i=t.isLive)||void 0===i||i,s.targetDuration&&s.fragments.length){const e=s.fragments[s.fragments.length-1];e&&ot.isFinite(e.sn)&&"VIDEO"==s.mediaType&&(t.manifest.startTime=Date.now()-Number(e.sn)*s.targetDuration)}return t}}var Da=__webpack_require__(9328);function Ma(t,e,n,r,i){null!=i&&"number"==typeof i&&(i=Math.round(i));const s={Bandwidth:r,Number:n,RepresentationID:e,Time:i};return t.replace(/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g,((t,e,n,r)=>{if("$$"===t)return"$";const i=s[e];if(null==i)return t;let o;switch("RepresentationID"===e&&n&&(n=void 0),r){case void 0:case"d":case"i":case"u":o=i.toString();break;case"o":o=i.toString(8);break;case"x":o=i.toString(16);break;case"X":o=i.toString(16).toUpperCase();break;default:o=i.toString()}const a=window.parseInt(n,10)||1,c=Math.max(0,a-o.length);return new Array(c+1).join("0")+o}))}function Ba(t){const e=/^PT(?:([1-9][0-9]*)H)?(?:([1-9][0-9]*)M)?(?:([0-9]+(?:\.[0-9]+)?)S)?$/.exec(t);let n=0;return e&&(e[1]&&(n+=36e5*Number.parseInt(e[1])),e[2]&&(n+=6e4*Number.parseInt(e[2])),e[3]&&(n+=1e3*Number.parseFloat(e[3]))),n}class Fa{constructor(){}parse(t,e,n){t.absType="DASH",t.url||(t.url=n);const r=["S","BaseURL"],i=new Da.XMLParser({ignoreAttributes:!1,attributeNamePrefix:"",isArray:t=>-1!==r.indexOf(t)}).parse(e),s=new Na;s.url=i.MPD.Location||n,t.url&&s.url!==n&&(t.url=n),t.streamType="dynamic"===i.MPD.type?"LIVE":"VOD",s.startTime=i.MPD.availabilityStartTime&&new Date(i.MPD.availabilityStartTime).getTime();let o=n;if(i.MPD.BaseURL&&(o=xa(o,function(t){let e="";Array.isArray(t.BaseURL)&&t.BaseURL[0]&&(e=t.BaseURL[0]["#text"]||t.BaseURL[0]);return e}(i.MPD))),i.MPD.Period.BaseURL&&(o=xa(o,i.MPD.Period.BaseURL)),i.MPD.Period.AdaptationSet&&i.MPD.Period.AdaptationSet[Symbol.iterator])for(const t of i.MPD.Period.AdaptationSet){const e=Array.isArray(t.Representation)?t.Representation:[t.Representation];for(const n of e){const e=new Ia;e.id=n.id,e.bitrate=parseInt(n.bandwidth),e.mediaType=Ha(n.mimeType||t.mimeType||t.contentType),e.resolution=Ga(t,n);const r=Ba(i.MPD.Period.start),a=n.SegmentTemplate||t.SegmentTemplate,c=n.SegmentList||t.SegmentList;a&&(e.fragments=Ua(a,e.id,n,o,r)),c&&(e.fragments=ja(c,o,r)),s.levels.push(e)}}return t.manifest=s,t}}function ja(t,e,n){const r=new class extends Pa{findById(t){return this.find((e=>e.id===t))}findByUrl(t){return this.find((e=>e.url===t))}},i=Number(t.timescale),{segmentDuration:s}=qa(t),o=s&&$a(s,i);if(t.SegmentURL){const a=Wa(t);for(let c=0;c<t.SegmentURL.length;c++){const u=t.SegmentURL[c].media,l=new Ta;l.url=xa(e,u),l.id=a+c,l.duration=o,l.presentationTime=Va({segmentNumber:a+c,startNumber:1,segmentDuration:s,segmentTimescale:i})+n,r.push(l)}}return r}function Ua(t,e,n,r,i){return new class extends Pa{findByUrl(e){const s=function(t,e,n,r){const i=t=>t.replace(/[.*+?^{}()|[\]\\]/g,"\\$&"),s=Ma(t.media,e.id,null,e.bandwidth,null),o=xa(r,s),a={N:void 0,T:void 0},c=/\$(RepresentationID|Number|Bandwidth|Time)?(?:%0([0-9]+)([diouxX]))?\$/g;let u=c.exec(s);for(;u;){const t=new RegExp(i(o).replace(u[0],"(\\w+)").replace(/\$\w+\$/g,"\\w+")).exec(n);if(t)switch(u[1]){case"Number":a.N=t[1];break;case"Time":a.T=t[1]}u=c.exec(s)}if(!a.N&&!a.T)return;return a}(t,n,e,r);if(!s)return;let o=s.N?s.N:s.T;o=Number.isNaN(Number.parseInt(o))?o:parseInt(o);const a=Number(t.timescale),c=Wa(t),{segmentDuration:u,segmentPts:l}=qa(t,o,c);let h;u&&(h=$a(u,a));const d=new Ta;return d.url=e,d.id=o,d.duration=h,d.presentationTime=(l?$a(l,a):Va({segmentNumber:o,segmentDuration:u,startNumber:c,segmentTimescale:a}))+i,d}findById(s){const o=Ma(t.media,e,s,n.bandwidth,s),a=Wa(t),c=Number(t.timescale),{segmentDuration:u,segmentPts:l}=qa(t,s,a);let h;u&&(h=$a(u,c));const d=new Ta;return d.url=xa(r,o),d.id=s,d.duration=h,d.presentationTime=(l?$a(l,c):Va({segmentNumber:s,startNumber:a,segmentDuration:u,segmentTimescale:c}))+i,d}}}function $a(t,e){return Math.round(t/(e||1)*1e3)}function qa(t,e,n){if(t.SegmentTimeline&&t.SegmentTimeline.S){const r=t.SegmentTimeline.S,i=new Map,s=new Map;let o=0,a=n;return r.forEach((t=>{t.t&&(o=parseInt(t.t));const e=parseInt(t.d),n=t.r?parseInt(t.r)+1:1;for(let t=0;t<n;t++){const t={segmentDuration:e,segmentPts:o};i.set(o,t),s.set(a,t),o+=e,a++}})),i.get(e)||s.get(e)||{}}return t.duration?{segmentDuration:Number(t.duration)}:{}}function Ha(t){const e=t.toLowerCase();return e.includes("video")?"VIDEO":e.includes("audio")?"AUDIO":"APPLICATION"}function Wa(t){const e=Number.parseInt(t.startNumber);return Number.isFinite(e)?e:1}function Va(t){const{segmentNumber:e,segmentDuration:n,segmentTimescale:r,startNumber:i}=t;return $a((e-i)*n,r)}function Ga(t,e){function n(t){return"number"==typeof t&&isFinite(t)}const r=Number(e.width||t.width),i=Number(e.height||t.height);return{width:n(r)?r:void 0,height:n(i)?i:void 0}}class za{static getStreamInfoFromUrl(t,e){if(!t||!e)return{stream:void 0,manifest:void 0,level:void 0,fragment:void 0};const n=t.manifest;if(!n)return t.url===e?{stream:t,manifest:void 0,level:void 0,fragment:void 0}:{stream:void 0,manifest:void 0,level:void 0,fragment:void 0};if(n.url===e)return{stream:t,manifest:n,level:void 0,fragment:void 0};const r=n.findLevelByUrl(e);if(r)return{stream:t,manifest:n,level:r,fragment:void 0};for(const r of n.levels){const i=r.findFragmentByUrl(e);if(i)return{stream:t,manifest:n,level:r,fragment:i}}return{stream:void 0,manifest:void 0,level:void 0,fragment:void 0}}static updateStreamWithUrl(t,e){const n=this.extractAbsTypeFromUrl(e);t||(t=new js),t.url||(t.url=e,t.absType=n);return!za.getStreamInfoFromUrl(t,e).stream&&n&&((t=new js).url=e,t.absType=n),t}static updateStreamWithContent(t,e,n,r){if("string"!=typeof n)return t;const i=za.getParser(e);return i?i.parse(t,n,e,r):t}static extractAbsTypeFromUrl(t){if(!t)return;const[e]=t.split("?");switch(e.substring(e.lastIndexOf(".")+1)){case"m3u8":case"m3u":return"HLS";case"mpd":return"DASH"}}static getParser(t){if(!t)return;const[e]=t.split("?");switch(e.substring(e.lastIndexOf(".")+1)){case"m3u8":case"m3u":return new La;case"mpd":return new Fa}}}class Ka{}function Ya(t,e,n){if(!n.completed)return;const r=n.status,i=200===n.status,s=i?"OK":"Bad Request",o=n.contentData,a=n.contentLength,c=t.responseType,u=n.url,l=n.headers||{};e.responseText=t.responseText=o,e.byteLength=a,e.responseType=c,e.response=t.response=o,e.ok=i,e.statusCode=e.status=t.status=r,e.statusText=t.statusText=s,e.headers=l,e.url=u,e.data=o}const Xa=Et.getSingletonFactory(class extends Tt{save(t){this.normalized=Tn(t)}get ttl(){var t;return(null===(t=this.normalized)||void 0===t?void 0:t.ttl)||6}get reloadUri(){var t;return null===(t=this.normalized)||void 0===t?void 0:t.reloadUri}get pathwayPriority(){var t;return(null===(t=this.normalized)||void 0===t?void 0:t.pathwayPriority)||[]}get pathwayClones(){return this.normalized.pathwayClones||[]}});var Za=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};const Ja=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.settings=On(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("ManifestService"),this.fetchManifestTimer=Ss(this.context).createInstance(),this.polyNet=Un(this.context).getInstance(),this.manifest=Xa(this.context).getInstance()}start(){this.fetchManifest()}stop(){var t,e;(null===(t=this.fetchManifestTimer)||void 0===t?void 0:t.isRunning)&&(null===(e=this.fetchManifestTimer)||void 0===e||e.cancel())}destroy(){this.stop(),this.fetchManifestTimer=null,this.settings=null,this.eventBus=null,this.logger=null,this.polyNet=null,this.manifest=null}get isEnabled(){return!this.polyNet.isInNoRecovery&&this.settings.cs.enableCs&&!this.settings.cs.isRevoked}fetchManifest(){return Za(this,void 0,void 0,(function*(){if(!this.manifestUrl||!this.isEnabled)return;this.logger.trace(Ut.fetchingSteeringManifest());const t=yield this.fetch(this.manifestUrl);t&&((null==t?void 0:t.data)&&(this.logger.trace(Ut.contentSteeringManifestResponse(JSON.stringify(t.data))),this.manifest.save(t.data),this.eventBus.emit($t.COLLECT_CS_STATS,Object.assign({},this.collectStats()))),this.scheduleNextRequest())}))}fetch(t){var e,n;return Za(this,void 0,void 0,(function*(){try{return yield Mt().get(t,{headers:{accept:"application/json"}})}catch(r){if((null===(e=r.response)||void 0===e?void 0:e.status)>=400&&(null===(n=r.response)||void 0===n?void 0:n.status)<=499)return bt.throw(this.logger),this.settings.setup({cs:{isRevoked:!0}}),void this.stop();this.logger.error(Ut.genericErrorFetchingSteeringManifest(t))}}))}get manifestUrl(){let t=this.manifest.reloadUri?this.manifest.reloadUri:this.settings.contentSteeringEndpoint;if(!t)return;const e=new URLSearchParams(Yo()(t).query);return this.polyNet.deviceId&&e.set("device_id",this.polyNet.deviceId),this.polyNet.nodeId&&e.set("node_id",this.polyNet.nodeId),Yo()(t).set("query",e.toString()).toString()}scheduleNextRequest(){var t;const e=1e3*this.manifest.ttl;null===(t=this.fetchManifestTimer)||void 0===t||t.setTimeout("Timer-Fetch-CS",e,(()=>this.fetchManifest()),!0)}collectStats(){const t=this.manifestUrl;if(!t)return;const e=new URLSearchParams(Yo()(t).query);return{resourceId:Number(e.get("resource_id")),pathwayPriority:[...this.manifest.pathwayPriority]}}});const Qa=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.manifestService=Ja(this.context).getInstance(),this.manifest=Xa(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("ContentSteeringService"),this.settings=On(this.context).getInstance()}start(){this.eventBus.on($t.SETTINGS_CHANGED,(t=>this.handleSettingsChanged(t)),{scope:this}),this.manifestService.isEnabled&&this.manifestService.start()}stop(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.manifestService.stop()}destroy(){super.destroy(),this.stop()}get isEnabled(){return this.settings.cs.enableCs&&!this.settings.cs.isRevoked&&!ot.isEmpty(this.settings.contentSteeringEndpoint)}replaceBaseUrl(t){return this.manifestService.isEnabled&&this.firstCdnHostname?(this.eventBus.emit($t.COLLECT_CS_STATS,{pathwayName:this.firstPathwayId}),this.replaceHostname(t,this.firstCdnHostname)):t}get firstPathwayId(){return this.manifest.pathwayPriority[0]}get firstCdnHostname(){const t=this.firstPathwayId;if(!t)return;const e=this.manifest.pathwayClones.find((e=>e.id===t));return e?e.uriReplacement.host:void 0}replaceHostname(t,e){const n=Yo()(t).set("hostname",e).toString();return this.logger.trace(Ut.replacedUrlByHostname(t,n)),n}handleSettingsChanged(t){var e;ot.isNil(null===(e=t.diffSettings)||void 0===e?void 0:e.cs)||(this.stop(),this.start())}});class tc extends at{constructor(t){let{message:e,url:n="",headers:r={},errorCode:i=500,errorReason:s="",aborted:o=!1}=t;super(e),this.url=n,this.headers=r,this.errorCode=i,this.errorReason=s,this.aborted=o}}class ec extends Tt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"internal";super(),this.id=t,this.logger=xt(this.context).getInstance().getLogger(`PolyNetRequester-${this.id}`),this.settings=On(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.contentCacheService=qs(this.context).getInstance(),this.contentRequestService=po(this.context).getInstance(),this.shieldService=sa(this.context).getInstance(),this.contentSteeringService=Qa(this.context).getInstance(),this.completed=!1}request(t){this.options=t,(ot.isNil(this.options.id)||this.options.cachePolicy!==Yi.Policy.CACHEABLE||!this.options.isLive&&!this.settings.p2pAllowVod)&&(this.options.id=--ec.nonCachableSeq),this.options.withCredentials=this.settings.withCredentials,this.options.external=!0,this.originalHost=new(Yo())(this.options.url).hostname,this.settings.transformRequest(this.options),this.options.url=this.shieldService.changeHost(this.options.url);const e=new(Yo())(this.options.url);return this.eventBus.emit($t.COLLECT_MSS_STATS,{currentHost:e.host}),this.options.url=this.contentSteeringService.replaceBaseUrl(this.options.url),this.stats={timeFirst:void 0,timeRequest:performance.now(),timeResponse:void 0},this.contentCache=this.contentRequestService.request(this.options),this.logger.trace(`Request url: ${this.options.url} - contentId: ${this.options.id} - cacheSeq: ${this.contentCache.seq} - retries: ${this.contentCache.retries}`),new pi((t=>{this.contentCache.asObservable.subscribe({next:()=>{this.emitProgress(t,this.contentCache)},complete:()=>{this.emitComplete(t,this.contentCache)},error:()=>{this.emitError(t,this.contentCache)}})}))}abort(){var t;clearTimeout(this.fetchTimeout),this.fetchTimeout=null,!this.completed&&this.abortCache(),null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.context=null,this.options=null,this.eventBus=null,this.contentCacheService=null,this.contentRequestService=null}abortCache(){if(this.completed)return;this.completed=!0;const t=this.contentCacheService.findOneContentCacheByFullId({representationId:this.options.representationId,id:this.options.id});this.logger.trace(`Abort content cache: contentId: ${t.id} - cacheSeq: ${t.seq} - retries: ${t.retries} - representationId: ${t.representationId} / ${t.url}`),this.contentCacheService.errorContentCache(t,!0,"player-abort")}get isInternal(){return"internal"===this.id}buildResponseFromCache(t){return{completed:!1,contentData:"arraybuffer"===this.options.responseType?t.contentData:tr.toString(t.contentData),contentLength:t.contentLength,contentLoaded:t.loaded,status:200,url:(t=>this.contentSteeringService.isEnabled?t?new(Yo())(t).set("hostname",this.originalHost).toString():void 0:t)(t.responseUrl),headers:t.headers}}computeContentFetchDelay(t,e,n,r){const i=t.end-t.start,s=e.end-e.start,o=ot.isFinite(r)&&r>0?Math.min(r,s):s;return!n||i>=o?{delay:0,downloadDuration:s,fetchDuration:i,expectedTotalDuration:o}:{delay:o-i,downloadDuration:s,fetchDuration:i,expectedTotalDuration:o}}emitProgress(t,e){this.stats.timeFirst||(this.stats.timeFirst=performance.now()),this.reportStatsRequestResponseTime(e);const n=this.buildResponseFromCache(this.contentCache);t.next(n)}emitComplete(t,e){const{duration:n,id:r,isCacheable:i,timeFirst:s,timeResponse:o}=e;this.stats.timeFirst||(this.stats.timeFirst=performance.now());const a=this.settings.playerContentThrottlingMode,c=a!==he.OFF,u=a===he.DURATION?n||this.settings.defaultContentDuration:void 0,{delay:l,fetchDuration:h,downloadDuration:d,expectedTotalDuration:p}=this.computeContentFetchDelay({start:this.stats.timeRequest,end:performance.now()},{start:s,end:o},i,u),f=this.buildResponseFromCache(e);this.reportStatsCdn(e),this.reportStatsEstimatedBitrate(f),this.completed=!0;const g=c?l:0;g>0&&this.logger.trace(`Delaying ${g} ms for contentId: ${r} - cacheSeq: ${e.seq} - retries: ${e.retries}: fetch duration ${h}, download duration ${d}, expected total duration ${p}`),this.fetchTimeout=setTimeout((()=>{f.completed=!0,f.status=200,this.logger.debug(Ut.finishedRequest(f.url,e.origin,this.stats.timeRequest,this.stats.timeFirst,this.stats.timeResponse=performance.now(),r,e.duration)),t.next(f),t.complete()}),g)}emitError(t,e){if(e.isResourceFromCdn&&!e.isAborted&&this.shieldService.banHost(e.url),e.isResourceFromP2P&&!this.isInternal)return void this.logger.trace(`Ignoring error fetching P2P content: ${this.options.url} / contentId: ${this.options.id} - cacheSeq: ${e.seq} - retries: ${e.retries} - Reason: ${e.isAborted?"Aborted":"Internal Error"}`);this.completed=!0,this.logger.trace(`Error fetching: ${this.options.url} / contentId: ${this.options.id} - cacheSeq: ${e.seq} - retries: ${e.retries} - Reason: ${e.isAborted?"Aborted":"Internal Error"}`);const n=new tc({aborted:e.isAborted,errorCode:500,errorReason:e.isAborted?"Aborted":"Internal Error",message:`Error fetching: ${this.options.url} / ${this.options.id}`,url:e.url});t.error(n)}reportStatsRequestResponseTime(t){if(!t.isCacheable||!t.loaded||this.fetchProgressStartTime)return;this.fetchProgressStartTime=performance.now();const e={contentRequestResponseTime:Math.floor(this.fetchProgressStartTime-this.stats.timeRequest),origin:t.origin};this.eventBus.emit($t.COLLECT_POLYNET_STATS,{contentRequestResponseTimes:e})}reportStatsCdn(t){const e=(null==t?void 0:t.headers)&&t.headers["x-cdn"]?t.headers["x-cdn"]:void 0;this.eventBus.emit($t.COLLECT_CS_STATS,{responseCdn:e})}reportStatsEstimatedBitrate(t){const{representationId:e}=this.options;if(!e)return;if(this.options.cachePolicy&&this.options.cachePolicy!==Yi.Policy.CACHEABLE)return;if(!this.options.duration||!t.contentLoaded)return;const n=Math.floor(t.contentLoaded/this.options.duration*8e3);this.eventBus.emit($t.COLLECT_STREAMING_STATS,{stats:{estimatedBitrate:{representationId:e,bitrate:n}}})}}ec.nonCachableSeq=0;const nc=Et.getInstanceFactory(ec);class rc extends Tt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"internal";super(),this.parserConfig=null,this.id=t,this.streamInfoService=Us(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger(`Requester-${this.id}`),this.contentCacheService=qs(this.context).getInstance(),this.eventBus.on($t.SETTINGS_CHANGED,(t=>this.handleSettingsChangedEvent(t)),{scope:this})}handleSettingsChangedEvent(t){const e=null==t?void 0:t.diffSettings;function n(t){if(!t)return null;try{const e=ce(t)?ae(t):null;return e?new RegExp(e):null}catch(t){return null}}ot.isNil(null==e?void 0:e.hlsParser)||(this.parserConfig=function(t){const e=JSON.parse(JSON.stringify(t));for(const t of Object.keys(e))e[t]=n(e[t]);return e}(null==e?void 0:e.hlsParser),this.contentCacheService.findAllCacheable().forEach((t=>{t.unsafe=!0})))}get isInternal(){return"internal"===this.id}get(t){const{streamInfo:e,polyNetOptions:n}=this.getInfoFromOptions(t);this.logger.debug(Ut.requestCreated(n.url,n.id)),this.eventBus.emit($t.STREAM_INFO,{polyNetOptions:n,streamInfo:e});return nc(this.context).createInstance(this.id).request(n).pipe(Si((t=>(t.completed&&this.parseResponses(t)&&this.printPlaylistSummary(e),t))))}parseResponses(t){const e=this.streamInfoService.stream;try{this.streamInfoService.stream=za.updateStreamWithContent(e,t.url,t.contentData,this.parserConfig)}catch(t){this.logger.error(`Error while trying to parse the playlist: ${t}`)}return t.completed&&"string"==typeof t.contentData&&this.logger.logOnce(t.url,Ut.printPlaylist(t.url,t.contentData)),t}printPlaylistSummary(t){var e,n,r;if(!ot.isNil(t.fragment)||ot.isEmpty(null===(e=t.level)||void 0===e?void 0:e.fragments))return;const{fragments:i,targetDuration:s,url:o}=t.level,a=null===(n=i[0])||void 0===n?void 0:n.id,c=null===(r=i[i.length-1])||void 0===r?void 0:r.id;this.logger.debug(Ut.printHlsMediaPlaylistSummary(o,s,i.length,a,c))}getInfoFromOptions(t){const e=function(t){const e=function(t){try{return new(Yo())(t).toString()}catch(e){return t}}(t.url||t.uri);return Object.assign(Object.assign({},t),{url:e})}(t);this.streamInfoService.stream=za.updateStreamWithUrl(this.streamInfoService.stream,e.url);const n=za.getStreamInfoFromUrl(this.streamInfoService.stream,e.url),r=function(t,e){var n,r,i,s,o,a,c;const u=new Ka;u.url=e.url||e.uri,u.method=e.method||"GET",u.data=e.body||e.data,u.headers=e.headers||{};const l=t.fragment&&"VIDEO"===(null===(n=t.level)||void 0===n?void 0:n.mediaType),h=(null===(r=t.fragment)||void 0===r?void 0:r.isInit)||u.headers.Range;return u.cachePolicy=l&&!h?Yi.Policy.CACHEABLE:Yi.Policy.NO_CACHEABLE,u.isLive=null===(i=t.stream)||void 0===i?void 0:i.isLive,u.responseType=e.responseType||(null==t?void 0:t.fragment)&&"arraybuffer",u.id=null===(s=t.fragment)||void 0===s?void 0:s.id,u.representationId="VIDEO"===(null===(o=t.level)||void 0===o?void 0:o.mediaType)&&(null===(a=t.level)||void 0===a?void 0:a.id),u.duration=null===(c=t.fragment)||void 0===c?void 0:c.duration,u}(n,e);return{streamInfo:n,playerOptions:e,polyNetOptions:r}}fetch(t,e){let n;n=t,"string"==typeof t&&(n=Object.assign(Object.assign({},e),{url:t}));const r=this.get(Object.assign(Object.assign({},n),{responseType:n.responseType,url:n.url,headers:n.headers}));return new Promise(((t,e)=>{const i=new _a,s=r.subscribe({complete:()=>t(i),error:t=>{const n=new Response(t.message,{status:400,statusText:"Bad Request"});return e(n)},next:t=>Ya(n,i,t)});n.signal&&(n.signal.onabort=()=>{null==s||s.unsubscribe()})}))}xhr(t,e){const n=new _a,r=Object.assign(Object.assign({},t),{responseType:t.responseType,url:t.url||t.uri}),i=new Ca;let s;return i.abort=()=>null==s?void 0:s.unsubscribe(),i.send=()=>{s=this.get(r).subscribe({complete:()=>{i.readyState=4,i.dispatchEvent(new Event("readystate")),e(null,n)},error:t=>{const n=new Response(t.message,{status:400,statusText:"Bad Request"});return i.readyState=4,i.aborted=t.aborted,e(t,n)},next:t=>Ya(i,n,t)})},i}}rc.polyNetFactoryName="Requester";const ic=Et.getInstanceFactory(rc);var sc=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class oc extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("ContentResolver"),this.eventBus=Ct(this.context).getInstance(),this.requester=ic(this.context).createInstance(),this.contentRequestService=po(this.context).getInstance(),this.streamInfoService=Us(this.context).getInstance()}start(){this.eventBus.on($t.CONTENT_URL_MISSING,this.handleContentUrlMissing,{scope:this}),this.eventBus.on($t.MANIFEST_INFO_MISSING,this.handleManifestInfoMissing,{scope:this})}destroy(){this.eventBus.offAll({scope:this})}handleContentUrlMissing(t){return sc(this,void 0,void 0,(function*(){const{options:e}=t;if(!e)return;const{representationId:n,id:r}=e;if(!ot.isNil(n)&&!ot.isNil(r))try{yield this.resolveFragment(e)}catch(t){this.logger.error(`Unable to resolve URL for contentId: ${r}`)}}))}fetchFragment(t){return sc(this,void 0,void 0,(function*(){t.url?(this.logger.trace(`Fetched contentId: ${t.id} - url: ${t.url}`),yield this.contentRequestService.request(t,!0)):this.logger.trace(`Failed fetching contentId: ${t.id} - url: ${t.url}`)}))}fetchManifest(t){return sc(this,void 0,void 0,(function*(){this.logger.debug(Ut.fetchingMediaPlaylist()),yield this.requester.fetch({url:t.url})}))}fetchLevel(t){return sc(this,void 0,void 0,(function*(){this.logger.debug(Ut.fetchingMediaPlaylist()),yield this.requester.fetch({url:t.url})}))}resolveFragment(t){return sc(this,void 0,void 0,(function*(){const e=t=>this.streamInfoService.stream.manifest.findLevelById(t),n=this.streamInfoService.stream;let r=e(t.representationId);if(r)try{let i=r.findFragmentById(t.id);if(i||(r.url?yield this.fetchLevel(r):yield this.fetchManifest(n),r=e(t.representationId),i=r.findFragmentById(t.id)),!i)return void this.logger.error(`Unable to find fragment with contentId: ${t.id}`);t.url=i.url,t.duration=i.duration,this.logger.trace(`Resolved contentId: ${t.id} - url: ${t.url}`),yield this.fetchFragment(t)}catch(t){this.logger.error(`${t.message}`,t)}}))}handleManifestInfoMissing(t){return sc(this,void 0,void 0,(function*(){const{url:e}=t;e&&(this.logger.debug(`Fetching manifest with URL ${e}`),yield this.requester.fetch({url:e}))}))}}oc.polyNetFactoryName="ContentResolver";const ac=Et.getInstanceFactory(oc);class cc extends Tt{constructor(){super(),this.settings=On(this.context).getInstance(),this.logger=xt(this.context).getInstance().getLogger("Auditor")}updateWindow(t){var e,n,r,i,s;const o=null===(e=t.manifest)||void 0===e?void 0:e.startTime,a=null!==(r=null===(n=t.level)||void 0===n?void 0:n.targetDuration)&&void 0!==r?r:null===(i=t.fragment)||void 0===i?void 0:i.duration;if(!(null===(s=t.stream)||void 0===s?void 0:s.isLive)||ot.isNil(o)||ot.isNil(a))return;const c=this.settings.liveCacheDuration,u=Date.now()-o-a,l=Math.round(c/a);return this.logger.logWhenChange("liveWindowChanged",Ut.liveWindowChanged(l)),u-c}isAuditable(t,e){var n,r;return e.fragment&&!(null===(n=e.fragment)||void 0===n?void 0:n.isInit)&&t.cachePolicy===Yi.Policy.CACHEABLE&&"VIDEO"===(null===(r=e.level)||void 0===r?void 0:r.mediaType)}audit(t){var e,n;const r=this.updateWindow(t);if(!(null===(e=t.stream)||void 0===e?void 0:e.isLive))return this.logger.logWhenChange("auditor",Ut.vodMode()),{p2pAllowed:this.settings.p2pAllowVod,isInsideLiveWindow:!1};const i=null===(n=t.fragment)||void 0===n?void 0:n.presentationTime;return ot.isNil(i)||ot.isNil(r)?(this.logger.logWhenChange("auditor",Ut.insideWindow()),{p2pAllowed:this.settings.p2pAllowDvr,isInsideLiveWindow:!1}):i>r?(this.logger.logWhenChange("auditor",Ut.insideWindow()),{p2pAllowed:!0,isInsideLiveWindow:!0}):(this.logger.logWhenChange("auditor",Ut.outsideWindow()),{p2pAllowed:this.settings.p2pAllowDvr,isInsideLiveWindow:!1})}}cc.polyNetFactoryName="Auditor";const uc=Et.getSingletonFactory(cc);const lc=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.eventBus=Ct(this.context).getInstance()}updateRepresentation(t){if(ot.isNil(this.currentRepresentation))this.currentRepresentation=t;else if(!this.currentRepresentation.equals(t)){const e=this.currentRepresentation.streamUri===t.streamUri;this.eventBus.emit($t.REPRESENTATION_CHANGE,{oldRepresentation:this.currentRepresentation,newRepresentation:t,sameStreamUri:e}),this.currentRepresentation=t}}});class hc{constructor(t,e,n){this.streamUri=t,this.representationId=e,this.bitrate=n}equals(t){return this.streamUri===t.streamUri&&this.representationId===t.representationId}}const dc=Et.getSingletonFactory(class extends Tt{constructor(){super(),this.logger=xt(this.context).getInstance().getLogger("FeaturesFlagsSettings"),this.eventBus=Ct(this.context).getInstance(),this.polyNetSettings=On(this.context).getInstance()}start(){this.eventBus.on($t.SETTINGS_CHANGED,(t=>this.handleSettingsChanged(t)),{scope:this})}destroy(){var t;null===(t=this.eventBus)||void 0===t||t.offAll({scope:this}),this.eventBus=null}setup(t){const e=this.decode(t);this.logger.trace(Ut.receivedFeatureFlags(e)),this.polyNetSettings.setup(e)}decode(t){if(!ot.isString(t)||ot.isEmpty(t))return{};const e=ce(t)?ae(t):t;let n={};try{n=Tn(JSON.parse(e))}catch(t){}return ot.isNil(n.sdkFeatureFlags)?n:{}}handleSettingsChanged(t){var e;const n=null===(e=null==t?void 0:t.diffSettings)||void 0===e?void 0:e.sdkFeatureFlags;ot.isNil(n)||this.setup(n)}});var pc=function(t,e,n,r){return new(n||(n=Promise))((function(i,s){function o(t){try{c(r.next(t))}catch(t){s(t)}}function a(t){try{c(r.throw(t))}catch(t){s(t)}}function c(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(o,a)}c((r=r.apply(t,e||[])).next())}))};class fc extends Tt{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{defaultContext:!0};super(),this.lastAuditableStreamInfo=null,this.context=e,this.polyNet=Un(this.context).getInstance(),this.eventBus=Ct(this.context).getInstance(),this.settings=On(this.context).getInstance(),this.settings.setup(t),this.createLoggers(),this.settings.isValidApiKey?(this.logger.debug(Ut.trackerURL(this.settings.apiKey.signalServerUrl)),this.logger.debug(Ut.trackerMetricsURL(this.settings.apiKey.metricSinkUrl)),this.settings.apiKey.stunServerUrl.forEach((t=>this.logger.debug(Ut.stunURL(t)))),this.logger.debug(Ut.channelIdentifier(this.settings.channelId||""))):this.logger.error("The PolyNet SDK has failed to initialize due to an error in your API Key. If problem persists, contact support at support@system73.com."),this.stats=cs(this.context).getInstance(),this.stats.start(),this.featureManager=Ea(this.context).getInstance(),this.featureManager.start(),this.tracker=Wo(this.context).getInstance(),this.tracker.start(),this.connectionManager=zo(this.context).createInstance(),this.shieldService=sa(this.context).getInstance(),this.shieldService.start(),this.contentSteeringService=Qa(this.context).getInstance(),this.contentSteeringService.start(),this.contentResolver=ac(this.context).createInstance(),this.contentResolver.start(),this.auditor=uc(this.context).getInstance(),this.requester=ic(this.context).createInstance("player"),this.representationService=lc(this.context).getInstance(),this.handleStreamInfoEvent=this.handleStreamInfoEvent.bind(this),this.eventBus.on($t.STREAM_INFO,this.handleStreamInfoEvent,{scope:this}),this.handleSettingsChanged=this.handleSettingsChanged.bind(this),this.eventBus.on($t.SETTINGS_CHANGED,this.handleSettingsChanged,{scope:this}),this.logger.debug(Ut.systemInfo(this.stats.platform.browser,this.stats.platform.os)),this.featureFlags=dc(this.context).getInstance(),this.featureFlags.start(),Object.seal(this)}connectToPolyNet(t,e){return pc(this,void 0,void 0,(function*(){this.polyNet.isEnabled&&(yield this.connectionManager.connectToPolyNet(t,e))}))}disconnectFromPolyNet(){return pc(this,void 0,void 0,(function*(){yield this.connectionManager.disconnectFromPolyNet()}))}get p2p(){return{enable:()=>{this.featureManager.enableP2P()},disable:()=>{this.featureManager.disableP2P(),this.disconnectFromPolyNet()}}}get mss(){return{enable:()=>{this.featureManager.enableMss()},disable:()=>{this.featureManager.disableMss()}}}get contentSteering(){return{enable:()=>{this.featureManager.enableCs()},disable:()=>{this.featureManager.disableCs()}}}get dimensions(){return{setCustomDimension1:t=>this.setCustomDimension1(t),setCustomDimension2:t=>this.setCustomDimension2(t),setCustomDimension3:t=>this.setCustomDimension3(t)}}enable(){this.p2p.enable(),this.contentSteering.enable()}disable(){this.p2p.disable(),this.contentSteering.disable()}destroy(){Et.destroyContext(this.context),this.polyNet=null,this.eventBus=null,this.logger=null,this.tracker=null,this.settings=null,this.featureManager=null,this.stats=null,this.connectionManager=null,this.featureManager=null,this.contentResolver=null,this.auditor=null,this.lastAuditableStreamInfo=null}setup(t){this.settings.setup(t)}set transformRequest(t){this.setup({transformRequest:t})}setCustomDimension1(t){this.setup({customDimension1:this.validateCustomDimensionLength(t)})}setCustomDimension2(t){this.setup({customDimension2:this.validateCustomDimensionLength(t)})}setCustomDimension3(t){this.setup({customDimension3:this.validateCustomDimensionLength(t)})}validateCustomDimensionLength(t){return ot.isString(t)&&t.length>256?(this.logger.warn("Your string is trimmed down to 256 characters"),t.slice(0,256)):t}createLoggers(){this.logger=xt(this.context).getInstance().getLogger("PolyNetSDK");const t=this.polyNet,e={channelId:this.settings.channelId,deviceId:this.polyNet.deviceId,get nodeId(){var e;return null!==(e=t.nodeId)&&void 0!==e?e:void 0},platform:"Web",sessionId:this.polyNet.sessionId},n=xt(this.context).getInstance();n.registerAppender(Lt(this.context).createInstance("console")),n.registerAppender(jt(this.context).createInstance("remote",e)),n.registerAppender(jt(this.context).createInstance("http",e))}get(t){return this.requester.get(t)}fetch(t,e){return this.logger.trace(Ut.requestCreatedFromPlayer(t)),this.requester.fetch(t,e)}xhr(t,e){return this.logger.trace(Ut.requestCreatedFromPlayer(t.url||t.uri)),this.requester.xhr(t,e)}set videoElementReader(t){this.eventBus.emit($t.COLLECT_VIDEO_STATS,{videoElementReader:t})}set playerInfo(t){this.eventBus.emit($t.COLLECT_PLATFORM_STATS,{player:t})}set playerUri(t){this.eventBus.emit($t.COLLECT_STREAMING_STATS,{stats:{playerUri:t}})}reportStreamingStats(t,e,n){const r={isLive:e,isInsideLiveWindow:n,streamUri:null==t?void 0:t.streamUri,representationId:null==t?void 0:t.representationId,bitrate:null==t?void 0:t.bitrate};this.eventBus.emit($t.COLLECT_STREAMING_STATS,{stats:r})}handleStreamInfoEvent(t){var e,n,r;return pc(this,void 0,void 0,(function*(){const{polyNetOptions:i,streamInfo:s}=t;if(!ot.isNil(this.stats.stream.playerUri)&&this.stats.stream.playerUri!==s.stream.url)return void this.eventBus.emit($t.MANIFEST_INFO_MISSING,{url:this.stats.stream.playerUri});if(!this.auditor.isAuditable(i,s))return;this.lastAuditableStreamInfo=t;const{p2pAllowed:o,isInsideLiveWindow:a}=this.auditor.audit(s),c=new hc(null===(e=s.stream)||void 0===e?void 0:e.url,null===(n=s.level)||void 0===n?void 0:n.id,null===(r=s.level)||void 0===r?void 0:r.bitrate);if(this.reportStreamingStats(c,!!s.stream.isLive,a),this.representationService.updateRepresentation(c),!o)return this.eventBus.emit($t.COLLECT_POLYNET_STATS,{revokedStatus:wr.RevokedStatus.OUT_OF_LIVE_WINDOW}),void(yield this.disconnectFromPolyNet());yield this.connectWithRepresentation(c)}))}handleSettingsChanged(t){var e,n;const r=!ot.isNil(null===(e=t.diffSettings)||void 0===e?void 0:e.p2pAllowVod)||!ot.isNil(null===(n=t.diffSettings)||void 0===n?void 0:n.p2pAllowDvr);!ot.isNil(this.lastAuditableStreamInfo)&&r&&this.handleStreamInfoEvent(this.lastAuditableStreamInfo)}connectWithRepresentation(t){return pc(this,void 0,void 0,(function*(){(null==t?void 0:t.streamUri)&&(null==t?void 0:t.representationId)&&(yield this.connectToPolyNet(t.streamUri,t.representationId))}))}}class gc{polyNetConfig;polyNet;playerClass;player;playerConfig;wrapperConfig;constructor(t,e){this.polyNetConfig=t,this.polyNet=new fc(this.polyNetConfig),this.__buildConfig(e)}__buildConfig(t){this.wrapperConfig=k()({},this.__defaultWrapperConfig,t),this.playerClass=this.wrapperConfig.playerClass}get __defaultWrapperConfig(){return{playerClass:void 0}}get p2p(){return this.polyNet.p2p}get mss(){return this.polyNet.mss}get contentSteering(){return this.polyNet.contentSteering}get dimensions(){return this.polyNet.dimensions}enable(){this.polyNet.enable()}disable(){this.polyNet.disable()}wrapPlayerConfig(t){this.playerConfig=t}wrapPlayer(t){this.player=t}destroy(){this.polyNet?.destroy(),this.polyNet=null,this.polyNetConfig=null,this.player=null,this.playerClass=null,this.playerConfig=null}}class yc extends gc{polyNetLoader;constructor(t,n){super(t,n);const r={polyNetGet:t=>this.polyNet.get(t),logger:this.polyNet.logger};this.polyNetLoader=function(t){return new e({polyNetLoaderConfig:r,hlsjsConfig:t})}}wrapPlayerConfig(t){super.wrapPlayerConfig(t);const e=t||{};this.polyNetConfig.withCredentials=e.withCredentials=!!this.polyNetConfig.withCredentials||!!e.withCredentials,this.polyNet.setup({withCredentials:this.polyNetConfig.withCredentials});const{liveSyncDurationCount:n,liveMaxLatencyDurationCount:r}=e;n&&3!==n||r&&r!==1/0||(e.liveSyncDuration=e.liveSyncDuration||24,delete e.liveSyncDurationCount),e.loader=this.polyNetLoader}wrapPlayer(t){super.wrapPlayer(t),t?.config&&this.polyNetLoader&&(t.config.fLoader=t.config.pLoader=t.config.loader=this.polyNetLoader)}}class mc extends yc{constructor(t,e){super(t,{...e,playerClass:e?.Hls}),this.polyNet.playerInfo={name:"hls.js",version:this.playerClass?.version}}get __defaultWrapperConfig(){return{playerClass:window.Hls}}wrapPlayer(t){super.wrapPlayer(t);this.polyNet.videoElementReader=()=>{if(t)return t.media},S()(this.playerClass)&&(this.playerClass=t.constructor,this.polyNet.playerInfo={name:"hls.js",version:this.playerClass?.version}),t.on(this.playerClass.Events.DESTROYING,(()=>{this.destroy()}))}}function bc(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return new mc(...e)}})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));window.SARDIUSENDPOINT="//players.sardius.media/82aD088d0aAbEF4/dotorg/";