var hm=Object.defineProperty;var El=Object.getOwnPropertySymbols;var fm=Object.prototype.hasOwnProperty,pm=Object.prototype.propertyIsEnumerable;var Sl=(i,e,t)=>e in i?hm(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Ia=(i,e)=>{for(var t in e||(e={}))fm.call(e,t)&&Sl(i,t,e[t]);if(El)for(var t of El(e))pm.call(e,t)&&Sl(i,t,e[t]);return i};import{e0 as gn,fm as mm,fn as gm,a as wo,r as Qa,G as rc,af as sc,o as os,h as Lo,fo as _m,k as er,dP as vm,f as Cl,j as Al,aB as Dl,l as ym}from"./index.e8334860.js";var ts;typeof window!="undefined"?ts=window:typeof gn!="undefined"?ts=gn:typeof self!="undefined"?ts=self:ts={};var R=ts,wl=typeof gn!="undefined"?gn:typeof window!="undefined"?window:{},Tm=mm,is;typeof document!="undefined"?is=document:(is=wl["__GLOBAL_DOCUMENT_CACHE@4"],is||(is=wl["__GLOBAL_DOCUMENT_CACHE@4"]=Tm));var J=is,Ja={exports:{}};(function(i,e){function t(l){if(l&&typeof l=="object"){var h=l.which||l.keyCode||l.charCode;h&&(l=h)}if(typeof l=="number")return a[l];var c=String(l),p=r[c.toLowerCase()];if(p)return p;var p=s[c.toLowerCase()];if(p)return p;if(c.length===1)return c.charCodeAt(0)}t.isEventKey=function(h,c){if(h&&typeof h=="object"){var p=h.which||h.keyCode||h.charCode;if(p==null)return!1;if(typeof c=="string"){var _=r[c.toLowerCase()];if(_)return _===p;var _=s[c.toLowerCase()];if(_)return _===p}else if(typeof c=="number")return c===p;return!1}},e=i.exports=t;var r=e.code=e.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},s=e.aliases={windows:91,"\u21E7":16,"\u2325":18,"\u2303":17,"\u2318":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};/*! * Programatically add the following */for(n=97;n<123;n++)r[String.fromCharCode(n)]=n-32;for(var n=48;n<58;n++)r[n-48]=n;for(n=1;n<13;n++)r["f"+n]=n+111;for(n=0;n<10;n++)r["numpad "+n]=n+96;var a=e.names=e.title={};for(n in r)a[r[n]]=n;for(var o in s)r[o]=s[o]})(Ja,Ja.exports);var he=Ja.exports,xm=bm;function bm(i,e){var t,r=null;try{t=JSON.parse(i,e)}catch(s){r=s}return[r,t]}var Io={exports:{}};function ui(){return ui=Object.assign?Object.assign.bind():function(i){for(var e=1;e=400&&s.statusCode<=599){var a=n;if(t)if(wm.TextDecoder){var o=Im(s.headers&&s.headers["content-type"]);try{a=new TextDecoder(o).decode(n)}catch(l){}}else a=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:a});return}e(null,n)}};function Im(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var r=t.split("="),s=r[0],n=r[1];return s.trim()==="charset"?n.trim():e},"utf-8")}var km=Lm,nc=R,Om=Sm,Pm=Cm;qt.httpHandler=km;/** * @license * slighly modified parse-headers 2.0.2 * Copyright (c) 2014 David Björklund * Available under the MIT license * */var Rm=function(e){var t={};return e&&e.trim().split(` `).forEach(function(r){var s=r.indexOf(":"),n=r.slice(0,s).trim().toLowerCase(),a=r.slice(s+1).trim();typeof t[n]=="undefined"?t[n]=a:Array.isArray(t[n])?t[n].push(a):t[n]=[t[n],a]}),t};Io.exports=qt;Io.exports.default=qt;qt.XMLHttpRequest=nc.XMLHttpRequest||Fm;qt.XDomainRequest="withCredentials"in new qt.XMLHttpRequest?qt.XMLHttpRequest:nc.XDomainRequest;Mm(["get","put","post","patch","head","delete"],function(i){qt[i==="delete"?"del":i]=function(e,t,r){return t=ac(e,t,r),t.method=i.toUpperCase(),oc(t)}});function Mm(i,e){for(var t=0;t0&&(C=setTimeout(function(){if(!h){h=!0,o.abort("timeout");var y=new Error("XMLHttpRequest timeout");y.code="ETIMEDOUT",n(y)}},i.timeout)),o.setRequestHeader)for(l in E)E.hasOwnProperty(l)&&o.setRequestHeader(l,E[l]);else if(i.headers&&!Bm(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(o.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(o),o.send(_||null),o}function Nm(i){try{if(i.responseType==="document")return i.responseXML;var e=i.responseXML&&i.responseXML.documentElement.nodeName==="parsererror";if(i.responseType===""&&!e)return i.responseXML}catch(t){}return null}function Fm(){}var uc=Io.exports,lc={exports:{}},Ll=J,ko=Object.create||function(){function i(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=e,new i}}();function yt(i,e){this.name="ParsingError",this.code=i.code,this.message=e||i.message}yt.prototype=ko(Error.prototype);yt.prototype.constructor=yt;yt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function Oo(i){function e(r,s,n,a){return(r|0)*3600+(s|0)*60+(n|0)+(a|0)/1e3}var t=i.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function us(){this.values=ko(null)}us.prototype={set:function(i,e){!this.get(i)&&e!==""&&(this.values[i]=e)},get:function(i,e,t){return t?this.has(i)?this.values[i]:e[t]:this.has(i)?this.values[i]:e},has:function(i){return i in this.values},alt:function(i,e,t){for(var r=0;r=0&&e<=100)?(this.set(i,e),!0):!1}};function rs(i,e,t,r){var s=r?i.split(r):[i];for(var n in s)if(typeof s[n]=="string"){var a=s[n].split(t);if(a.length===2){var o=a[0].trim(),l=a[1].trim();e(o,l)}}}function Um(i,e,t){var r=i;function s(){var o=Oo(i);if(o===null)throw new yt(yt.Errors.BadTimeStamp,"Malformed timestamp: "+r);return i=i.replace(/^[^\sa-zA-Z-]+/,""),o}function n(o,l){var h=new us;rs(o,function(c,p){switch(c){case"region":for(var _=t.length-1;_>=0;_--)if(t[_].id===p){h.set(c,t[_].region);break}break;case"vertical":h.alt(c,p,["rl","lr"]);break;case"line":var E=p.split(","),g=E[0];h.integer(c,g),h.percent(c,g)&&h.set("snapToLines",!1),h.alt(c,g,["auto"]),E.length===2&&h.alt("lineAlign",E[1],["start","center","end"]);break;case"position":E=p.split(","),h.percent(c,E[0]),E.length===2&&h.alt("positionAlign",E[1],["start","center","end"]);break;case"size":h.percent(c,p);break;case"align":h.alt(c,p,["start","center","end","left","right"]);break}},/:/,/\s/),l.region=h.get("region",null),l.vertical=h.get("vertical","");try{l.line=h.get("line","auto")}catch(c){}l.lineAlign=h.get("lineAlign","start"),l.snapToLines=h.get("snapToLines",!0),l.size=h.get("size",100);try{l.align=h.get("align","center")}catch(c){l.align=h.get("align","middle")}try{l.position=h.get("position","auto")}catch(c){l.position=h.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},l.align)}l.positionAlign=h.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},l.align)}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),i.substr(0,3)!=="-->")throw new yt(yt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+r);i=i.substr(3),a(),e.endTime=s(),a(),n(i,e)}var ka=Ll.createElement&&Ll.createElement("textarea"),jm={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},Il={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)"},Vm={v:"title",lang:"lang"},kl={rt:"ruby"};function dc(i,e){function t(){if(!e)return null;function g(C){return e=e.substr(C.length),C}var b=e.match(/^([^<]*)(<[^>]*>?)?/);return g(b[1]?b[1]:b[2])}function r(g){return ka.innerHTML=g,g=ka.textContent,ka.textContent="",g}function s(g,b){return!kl[b.localName]||kl[b.localName]===g.localName}function n(g,b){var C=jm[g];if(!C)return null;var x=i.document.createElement(C),y=Vm[g];return y&&b&&(x[y]=b.trim()),x}for(var a=i.document.createElement("div"),o=a,l,h=[];(l=t())!==null;){if(l[0]==="<"){if(l[1]==="/"){h.length&&h[h.length-1]===l.substr(2).replace(">","")&&(h.pop(),o=o.parentNode);continue}var c=Oo(l.substr(1,l.length-2)),p;if(c){p=i.document.createProcessingInstruction("timestamp",c),o.appendChild(p);continue}var _=l.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!_||(p=n(_[1],_[3]),!p)||!s(o,p))continue;if(_[2]){var E=_[2].split(".");E.forEach(function(g){var b=/^bg_/.test(g),C=b?g.slice(3):g;if(Il.hasOwnProperty(C)){var x=b?"background-color":"color",y=Il[C];p.style[x]=y}}),p.className=E.join(" ")}h.push(_[1]),o.appendChild(p),o=p;continue}o.appendChild(i.document.createTextNode(r(l)))}return a}var Ol=[[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 $m(i){for(var e=0;e=t[0]&&i<=t[1])return!0}return!1}function Hm(i){var e=[],t="",r;if(!i||!i.childNodes)return"ltr";function s(o,l){for(var h=l.childNodes.length-1;h>=0;h--)o.push(l.childNodes[h])}function n(o){if(!o||!o.length)return null;var l=o.pop(),h=l.textContent||l.innerText;if(h){var c=h.match(/^.*(\n|\r)/);return c?(o.length=0,c[0]):h}if(l.tagName==="ruby")return n(o);if(l.childNodes)return s(o,l),n(o)}for(s(e,i);t=n(e);)for(var a=0;a=0&&i.line<=100))return i.line;if(!i.track||!i.track.textTrackList||!i.track.textTrackList.mediaElement)return-1;for(var e=i.track,t=e.textTrackList,r=0,s=0;si.left&&this.topi.top};st.prototype.overlapsAny=function(i){for(var e=0;e=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right};st.prototype.overlapsOppositeAxis=function(i,e){switch(e){case"+x":return this.lefti.right;case"+y":return this.topi.bottom}};st.prototype.intersectPercentage=function(i){var e=Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left)),t=Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top)),r=e*t;return r/(this.height*this.width)};st.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}};st.getSimpleBoxPosition=function(i){var e=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,t=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,r=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i;var s={left:i.left,right:i.right,top:i.top||r,height:i.height||e,bottom:i.bottom||r+(i.height||e),width:i.width||t};return s};function qm(i,e,t,r){function s(C,x){for(var y,D=new st(C),S=1,v=0;vw&&(y=new st(C),S=w),C=new st(D)}return y||D}var n=new st(e),a=e.cue,o=Gm(a),l=[];if(a.snapToLines){var h;switch(a.vertical){case"":l=["+y","-y"],h="height";break;case"rl":l=["+x","-x"],h="width";break;case"lr":l=["-x","+x"],h="width";break}var c=n.lineHeight,p=c*Math.round(o),_=t[h]+c,E=l[0];Math.abs(p)>_&&(p=p<0?-1:1,p*=Math.ceil(_/c)*c),o<0&&(p+=a.vertical===""?t.height:t.width,l=l.reverse()),n.move(E,p)}else{var g=n.lineHeight/t.height*100;switch(a.lineAlign){case"center":o-=g/2;break;case"end":o-=g;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}l=["+y","-x","+x","-y"],n=new st(e)}var b=s(n,l);e.move(b.toCSSCompatValues(t))}function Er(){}Er.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}};Er.convertCueToDOMTree=function(i,e){return!i||!e?null:dc(i,e)};var Wm=.05,zm="sans-serif",Km="1.5%";Er.processCues=function(i,e,t){if(!i||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var r=i.document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=Km,t.appendChild(r);function s(c){for(var p=0;p")===-1){e.cue.id=a;continue}case"CUE":try{Um(a,e.cue,e.regionList)}catch(c){e.reportOrThrowError(c),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var h=a.indexOf("-->")!==-1;if(!a||h&&(l=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=` `),e.cue.text+=a.replace(/\u2028/g,` `).replace(/u2029/g,` `);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(c){e.reportOrThrowError(c),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=` `,i.parse()),i.state==="INITIAL")throw new yt(yt.Errors.BadSignature)}catch(e){i.reportOrThrowError(e)}return i.onflush&&i.onflush(),this}};var Xm=Er,Ym="auto",Qm={"":1,lr:1,rl:1},Jm={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function Zm(i){if(typeof i!="string")return!1;var e=Qm[i.toLowerCase()];return e?i.toLowerCase():!1}function Oa(i){if(typeof i!="string")return!1;var e=Jm[i.toLowerCase()];return e?i.toLowerCase():!1}function cc(i,e,t){this.hasBeenReset=!1;var r="",s=!1,n=i,a=e,o=t,l=null,h="",c=!0,p="auto",_="start",E="auto",g="auto",b=100,C="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(x){r=""+x}},pauseOnExit:{enumerable:!0,get:function(){return s},set:function(x){s=!!x}},startTime:{enumerable:!0,get:function(){return n},set:function(x){if(typeof x!="number")throw new TypeError("Start time must be set to a number.");n=x,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(x){if(typeof x!="number")throw new TypeError("End time must be set to a number.");a=x,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(x){o=""+x,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return l},set:function(x){l=x,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return h},set:function(x){var y=Zm(x);if(y===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");h=y,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return c},set:function(x){c=!!x,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return p},set:function(x){if(typeof x!="number"&&x!==Ym)throw new SyntaxError("Line: an invalid number or illegal string was specified.");p=x,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return _},set:function(x){var y=Oa(x);y?(_=y,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return E},set:function(x){if(x<0||x>100)throw new Error("Position must be between 0 and 100.");E=x,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return g},set:function(x){var y=Oa(x);y?(g=y,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return b},set:function(x){if(x<0||x>100)throw new Error("Size must be between 0 and 100.");b=x,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return C},set:function(x){var y=Oa(x);if(!y)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");C=y,this.hasBeenReset=!0}}}),this.displayState=void 0}cc.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var eg=cc,tg={"":!0,up:!0};function ig(i){if(typeof i!="string")return!1;var e=tg[i.toLowerCase()];return e?i.toLowerCase():!1}function zr(i){return typeof i=="number"&&i>=0&&i<=100}function rg(){var i=100,e=3,t=0,r=100,s=0,n=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return i},set:function(o){if(!zr(o))throw new Error("Width must be between 0 and 100.");i=o}},lines:{enumerable:!0,get:function(){return e},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");e=o}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(o){if(!zr(o))throw new Error("RegionAnchorX must be between 0 and 100.");r=o}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(o){if(!zr(o))throw new Error("RegionAnchorY must be between 0 and 100.");t=o}},viewportAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!zr(o))throw new Error("ViewportAnchorY must be between 0 and 100.");n=o}},viewportAnchorX:{enumerable:!0,get:function(){return s},set:function(o){if(!zr(o))throw new Error("ViewportAnchorX must be between 0 and 100.");s=o}},scroll:{enumerable:!0,get:function(){return a},set:function(o){var l=ig(o);l===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=l}}})}var sg=rg,li=R,ji=lc.exports={WebVTT:Xm,VTTCue:eg,VTTRegion:sg};li.vttjs=ji;li.WebVTT=ji.WebVTT;var ng=ji.VTTCue,ag=ji.VTTRegion,og=li.VTTCue,ug=li.VTTRegion;ji.shim=function(){li.VTTCue=ng,li.VTTRegion=ag};ji.restore=function(){li.VTTCue=og,li.VTTRegion=ug};li.VTTCue||ji.shim();var Pl=lc.exports,hc={exports:{}};(function(i,e){(function(t){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,n=/(?:\/|^)\.(?=\/)/g,a=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,o={buildAbsoluteURL:function(l,h,c){if(c=c||{},l=l.trim(),h=h.trim(),!h){if(!c.alwaysNormalize)return l;var p=o.parseURL(l);if(!p)throw new Error("Error trying to parse base URL.");return p.path=o.normalizePath(p.path),o.buildURLFromParts(p)}var _=o.parseURL(h);if(!_)throw new Error("Error trying to parse relative URL.");if(_.scheme)return c.alwaysNormalize?(_.path=o.normalizePath(_.path),o.buildURLFromParts(_)):h;var E=o.parseURL(l);if(!E)throw new Error("Error trying to parse base URL.");if(!E.netLoc&&E.path&&E.path[0]!=="/"){var g=s.exec(E.path);E.netLoc=g[1],E.path=g[2]}E.netLoc&&!E.path&&(E.path="/");var b={scheme:E.scheme,netLoc:_.netLoc,path:null,params:_.params,query:_.query,fragment:_.fragment};if(!_.netLoc&&(b.netLoc=E.netLoc,_.path[0]!=="/"))if(!_.path)b.path=E.path,_.params||(b.params=E.params,_.query||(b.query=E.query));else{var C=E.path,x=C.substring(0,C.lastIndexOf("/")+1)+_.path;b.path=o.normalizePath(x)}return b.path===null&&(b.path=c.alwaysNormalize?o.normalizePath(_.path):_.path),o.buildURLFromParts(b)},parseURL:function(l){var h=r.exec(l);return h?{scheme:h[1]||"",netLoc:h[2]||"",path:h[3]||"",params:h[4]||"",query:h[5]||"",fragment:h[6]||""}:null},normalizePath:function(l){for(l=l.split("").reverse().join("").replace(n,"");l.length!==(l=l.replace(a,"")).length;);return l.split("").reverse().join("")},buildURLFromParts:function(l){return l.scheme+l.netLoc+l.path+l.params+l.query+l.fragment}};i.exports=o})()})(hc);var vn=hc.exports,Rl="http://example.com",lg=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=R.location&&R.location.href||"");var r=typeof R.URL=="function",s=/^\/\//.test(e),n=!R.location&&!/\/\//i.test(e);if(r?e=new R.URL(e,R.location||Rl):/\/\//i.test(e)||(e=vn.buildAbsoluteURL(R.location&&R.location.href||"",e)),r){var a=new URL(t,e);return n?a.href.slice(Rl.length):s?a.href.slice(a.protocol.length):a.href}return vn.buildAbsoluteURL(e,t)},Po=function(){function i(){this.listeners={}}var e=i.prototype;return e.on=function(r,s){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(s)},e.off=function(r,s){if(!this.listeners[r])return!1;var n=this.listeners[r].indexOf(s);return this.listeners[r]=this.listeners[r].slice(0),this.listeners[r].splice(n,1),n>-1},e.trigger=function(r){var s=this.listeners[r];if(!!s)if(arguments.length===2)for(var n=s.length,a=0;a-1;t=this.buffer.indexOf(` `))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const hg=String.fromCharCode(9),Pa=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},fg=function(){const i="[^=]*",e='"[^"]*"|[^,]*',t="(?:"+i+")=(?:"+e+")";return new RegExp("(?:^|,)("+t+")")},Ct=function(i){const e={};if(!i)return e;const t=i.split(fg());let r=t.length,s;for(;r--;)t[r]!==""&&(s=/([^=]*)=(.*)/.exec(t[r]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),e[s[0]]=s[1]);return e};class pg extends Po{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,r;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,a)=>{const o=a(e);return o===e?n:n.concat([o])},[e]).forEach(n=>{for(let a=0;an),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:r(n),customType:t,segment:s}),!0})}addTagMapper({expression:e,map:t}){const r=s=>e.test(s)?t(s):s;this.tagMappers.push(r)}}const mg=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ii=function(i){const e={};return Object.keys(i).forEach(function(t){e[mg(t)]=i[t]}),e},Ra=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:r}=i;if(!e)return;const s="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=t&&t*3,l=r&&r*2;t&&!e.hasOwnProperty(n)&&(e[n]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[n]{r.uri||!r.parts&&!r.preloadHints||(!r.map&&s&&(r.map=s),!r.key&&n&&(r.key=n),!r.timeline&&typeof c=="number"&&(r.timeline=c),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(g){let b,C;({tag(){({version(){g.version&&(this.manifest.version=g.version)},"allow-cache"(){this.manifest.allowCache=g.allowed,"allowed"in g||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const x={};"length"in g&&(r.byterange=x,x.length=g.length,"offset"in g||(g.offset=p)),"offset"in g&&(r.byterange=x,x.offset=g.offset),p=x.offset+x.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),g.duration>0&&(r.duration=g.duration),g.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=t},key(){if(!g.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(g.attributes.METHOD==="NONE"){n=null;return}if(!g.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(g.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:g.attributes};return}if(g.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:g.attributes.URI};return}if(g.attributes.KEYFORMAT===h){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(g.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(g.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),g.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(g.attributes.KEYID&&g.attributes.KEYID.substring(0,2)==="0x")){this.trigger("warn",{message:"invalid key ID provided for Widevine"});return}this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.widevine.alpha"]={attributes:{schemeIdUri:g.attributes.KEYFORMAT,keyId:g.attributes.KEYID.substring(2)},pssh:fc(g.attributes.URI.split(",")[1])};return}g.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),n={method:g.attributes.METHOD||"AES-128",uri:g.attributes.URI},typeof g.attributes.IV!="undefined"&&(n.iv=g.attributes.IV)},"media-sequence"(){if(!isFinite(g.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+g.number});return}this.manifest.mediaSequence=g.number},"discontinuity-sequence"(){if(!isFinite(g.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+g.number});return}this.manifest.discontinuitySequence=g.number,c=g.number},"playlist-type"(){if(!/VOD|EVENT/.test(g.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+g.playlist});return}this.manifest.playlistType=g.playlistType},map(){s={},g.uri&&(s.uri=g.uri),g.byterange&&(s.byterange=g.byterange),n&&(s.key=n)},"stream-inf"(){if(this.manifest.playlists=t,this.manifest.mediaGroups=this.manifest.mediaGroups||l,!g.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),ui(r.attributes,g.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||l,!(g.attributes&&g.attributes.TYPE&&g.attributes["GROUP-ID"]&&g.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const x=this.manifest.mediaGroups[g.attributes.TYPE];x[g.attributes["GROUP-ID"]]=x[g.attributes["GROUP-ID"]]||{},b=x[g.attributes["GROUP-ID"]],C={default:/yes/i.test(g.attributes.DEFAULT)},C.default?C.autoselect=!0:C.autoselect=/yes/i.test(g.attributes.AUTOSELECT),g.attributes.LANGUAGE&&(C.language=g.attributes.LANGUAGE),g.attributes.URI&&(C.uri=g.attributes.URI),g.attributes["INSTREAM-ID"]&&(C.instreamId=g.attributes["INSTREAM-ID"]),g.attributes.CHARACTERISTICS&&(C.characteristics=g.attributes.CHARACTERISTICS),g.attributes.FORCED&&(C.forced=/yes/i.test(g.attributes.FORCED)),b[g.attributes.NAME]=C},discontinuity(){c+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(t.length)},"program-date-time"(){typeof this.manifest.dateTimeString=="undefined"&&(this.manifest.dateTimeString=g.dateTimeString,this.manifest.dateTimeObject=g.dateTimeObject),r.dateTimeString=g.dateTimeString,r.dateTimeObject=g.dateTimeObject},targetduration(){if(!isFinite(g.duration)||g.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+g.duration});return}this.manifest.targetDuration=g.duration,Ra.call(this,this.manifest)},start(){if(!g.attributes||isNaN(g.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:g.attributes["TIME-OFFSET"],precise:g.attributes.PRECISE}},"cue-out"(){r.cueOut=g.data},"cue-out-cont"(){r.cueOutCont=g.data},"cue-in"(){r.cueIn=g.data},skip(){this.manifest.skip=Ii(g.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",g.attributes,["SKIPPED-SEGMENTS"])},part(){a=!0;const x=this.manifest.segments.length,y=Ii(g.attributes);r.parts=r.parts||[],r.parts.push(y),y.byterange&&(y.byterange.hasOwnProperty("offset")||(y.byterange.offset=_),_=y.byterange.offset+y.byterange.length);const D=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${D} for segment #${x}`,g.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((S,v)=>{S.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${v} lacks required attribute(s): LAST-PART`})})},"server-control"(){const x=this.manifest.serverControl=Ii(g.attributes);x.hasOwnProperty("canBlockReload")||(x.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Ra.call(this,this.manifest),x.canSkipDateranges&&!x.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"(){const x=this.manifest.segments.length,y=Ii(g.attributes),D=y.type&&y.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(y),y.byterange&&(y.byterange.hasOwnProperty("offset")||(y.byterange.offset=D?_:0,D&&(_=y.byterange.offset+y.byterange.length)));const S=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${S} for segment #${x}`,g.attributes,["TYPE","URI"]),!!y.type)for(let v=0;vp&&(c-=p,c-=p,c-=Ke(2))}return Number(c)},Dg=function(e,t){var r=t===void 0?{}:t,s=r.le,n=s===void 0?!1:s;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=Ke(e);for(var a=Sg(e),o=new Uint8Array(new ArrayBuffer(a)),l=0;l=t.length&&h.call(t,function(c,p){var _=l[p]?l[p]&e[a+p]:e[a+p];return c===_})},Nl="http://example.com",Ro=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=R.location&&R.location.href||"");var r=typeof R.URL=="function",s=/^\/\//.test(e),n=!R.location&&!/\/\//i.test(e);if(r?e=new R.URL(e,R.location||Nl):/\/\//i.test(e)||(e=vn.buildAbsoluteURL(R.location&&R.location.href||"",e)),r){var a=new URL(t,e);return n?a.href.slice(Nl.length):s?a.href.slice(a.protocol.length):a.href}return vn.buildAbsoluteURL(e,t)},Lg=function(e,t,r){t.forEach(function(s){for(var n in e.mediaGroups[s])for(var a in e.mediaGroups[s][n]){var o=e.mediaGroups[s][n][a];r(o,s,n,a)}})},bi={},fi={};function Ig(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r=0&&i=0){for(var s=e.length-1;r0},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r]===i)return r}e=e.nodeType==cr?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i];e=e.nodeType==cr?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function kc(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}Es(mt,Ee);Es(mt,Ee.prototype);function _s(i,e){if(e(i))return!0;if(i=i.firstChild)do if(_s(i,e))return!0;while(i=i.nextSibling)}function Ss(){this.ownerDocument=this}function Fg(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===gs.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Oc(i,e,t,r){i&&i._inc++;var s=t.namespaceURI;s===gs.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function No(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var s=e.firstChild,n=0;s;)r[n++]=s,s=s.nextSibling;r.length=n,delete r[r.length]}}}function Pc(i,e){var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,No(i.ownerDocument,i),e}function Ug(i){return i&&(i.nodeType===Ee.DOCUMENT_NODE||i.nodeType===Ee.DOCUMENT_FRAGMENT_NODE||i.nodeType===Ee.ELEMENT_NODE)}function jg(i){return i&&(zt(i)||Fo(i)||ci(i)||i.nodeType===Ee.DOCUMENT_FRAGMENT_NODE||i.nodeType===Ee.COMMENT_NODE||i.nodeType===Ee.PROCESSING_INSTRUCTION_NODE)}function ci(i){return i&&i.nodeType===Ee.DOCUMENT_TYPE_NODE}function zt(i){return i&&i.nodeType===Ee.ELEMENT_NODE}function Fo(i){return i&&i.nodeType===Ee.TEXT_NODE}function $l(i,e){var t=i.childNodes||[];if(Wt(t,zt)||ci(e))return!1;var r=Wt(t,ci);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Hl(i,e){var t=i.childNodes||[];function r(n){return zt(n)&&n!==e}if(Wt(t,r))return!1;var s=Wt(t,ci);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function Vg(i,e,t){if(!Ug(i))throw new Fe(ct,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new Fe(wc,"child not in parent");if(!jg(e)||ci(e)&&i.nodeType!==Ee.DOCUMENT_NODE)throw new Fe(ct,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function $g(i,e,t){var r=i.childNodes||[],s=e.childNodes||[];if(e.nodeType===Ee.DOCUMENT_FRAGMENT_NODE){var n=s.filter(zt);if(n.length>1||Wt(s,Fo))throw new Fe(ct,"More than one element or text in fragment");if(n.length===1&&!$l(i,t))throw new Fe(ct,"Element in fragment can not be inserted before doctype")}if(zt(e)&&!$l(i,t))throw new Fe(ct,"Only one element can be added and only after doctype");if(ci(e)){if(Wt(r,ci))throw new Fe(ct,"Only one doctype is allowed");var a=Wt(r,zt);if(t&&r.indexOf(a)1||Wt(s,Fo))throw new Fe(ct,"More than one element or text in fragment");if(n.length===1&&!Hl(i,t))throw new Fe(ct,"Element in fragment can not be inserted before doctype")}if(zt(e)&&!Hl(i,t))throw new Fe(ct,"Only one element can be added and only after doctype");if(ci(e)){if(Wt(r,function(l){return ci(l)&&l!==t}))throw new Fe(ct,"Only one doctype is allowed");var a=Wt(r,zt);if(t&&r.indexOf(a)0&&_s(t.documentElement,function(s){if(s!==t&&s.nodeType===Mt){var n=s.getAttribute("class");if(n){var a=i===n;if(!a){var o=Fl(n);a=e.every(Mg(o))}a&&r.push(s)}}}),r})},createElement:function(i){var e=new Fi;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new ai;var t=e.attributes=new Tn;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new qn;return i.ownerDocument=this,i.childNodes=new ai,i},createTextNode:function(i){var e=new Uo;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new jo;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new Vo;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new Ho;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new bn;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new $o;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new Fi,r=e.split(":"),s=t.attributes=new Tn;return t.childNodes=new ai,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,s._ownerElement=t,t},createAttributeNS:function(i,e){var t=new bn,r=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,t}};pt(Ss,Ee);function Fi(){this._nsMap={}}Fi.prototype={nodeType:Mt,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===di?this.insertBefore(i,null):Hg(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var r=this.ownerDocument.createAttributeNS(i,e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new hr(this,function(e){var t=[];return _s(e,function(r){r!==e&&r.nodeType==Mt&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new hr(this,function(t){var r=[];return _s(t,function(s){s!==t&&s.nodeType===Mt&&(i==="*"||s.namespaceURI===i)&&(e==="*"||s.localName==e)&&r.push(s)}),r})}};Ss.prototype.getElementsByTagName=Fi.prototype.getElementsByTagName;Ss.prototype.getElementsByTagNameNS=Fi.prototype.getElementsByTagNameNS;pt(Fi,Ee);function bn(){}bn.prototype.nodeType=cr;pt(bn,Ee);function Cs(){}Cs.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(We[ct])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),s=this.data.substring(i+e);t=r+t+s,this.nodeValue=this.data=t,this.length=t.length}};pt(Cs,Ee);function Uo(){}Uo.prototype={nodeName:"#text",nodeType:yn,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};pt(Uo,Cs);function jo(){}jo.prototype={nodeName:"#comment",nodeType:Cc};pt(jo,Cs);function Vo(){}Vo.prototype={nodeName:"#cdata-section",nodeType:bc};pt(Vo,Cs);function Gn(){}Gn.prototype.nodeType=Dc;pt(Gn,Ee);function Mc(){}Mc.prototype.nodeType=Ng;pt(Mc,Ee);function Bc(){}Bc.prototype.nodeType=Bg;pt(Bc,Ee);function $o(){}$o.prototype.nodeType=Ec;pt($o,Ee);function qn(){}qn.prototype.nodeName="#document-fragment";qn.prototype.nodeType=di;pt(qn,Ee);function Ho(){}Ho.prototype.nodeType=Sc;pt(Ho,Ee);function Nc(){}Nc.prototype.serializeToString=function(i,e,t){return Fc.call(i,e,t)};Ee.prototype.toString=Fc;function Fc(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,s=r.prefix,n=r.namespaceURI;if(n&&s==null){var s=r.lookupPrefix(n);if(s==null)var a=[{namespace:n,prefix:null}]}return tr(this,t,i,e,a),t.join("")}function Gl(i,e,t){var r=i.prefix||"",s=i.namespaceURI;if(!s||r==="xml"&&s===gs.XML||s===gs.XMLNS)return!1;for(var n=t.length;n--;){var a=t[n];if(a.prefix===r)return a.namespace!==s}return!0}function Ba(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,kc),'"')}function tr(i,e,t,r,s){if(s||(s=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Mt:var n=i.attributes,a=n.length,x=i.firstChild,o=i.tagName;t=gs.isHTML(i.namespaceURI)||t;var l=o;if(!t&&!i.prefix&&i.namespaceURI){for(var h,c=0;c=0;p--){var _=s[p];if(_.prefix===""&&_.namespace===i.namespaceURI){h=_.namespace;break}}if(h!==i.namespaceURI)for(var p=s.length-1;p>=0;p--){var _=s[p];if(_.namespace===i.namespaceURI){_.prefix&&(l=_.prefix+":"+o);break}}}e.push("<",l);for(var E=0;E"),t&&/^script$/i.test(o))for(;x;)x.data?e.push(x.data):tr(x,e,t,r,s.slice()),x=x.nextSibling;else for(;x;)tr(x,e,t,r,s.slice()),x=x.nextSibling;e.push("")}else e.push("/>");return;case Ac:case di:for(var x=i.firstChild;x;)tr(x,e,t,r,s.slice()),x=x.nextSibling;return;case cr:return Ba(e,i.name,i.value);case yn:return e.push(i.data.replace(/[<&>]/g,kc));case bc:return e.push("");case Cc:return e.push("");case Dc:var y=i.publicId,D=i.systemId;if(e.push("");else if(D&&D!=".")e.push(" SYSTEM ",D,">");else{var S=i.internalSubset;S&&e.push(" [",S,"]"),e.push(">")}return;case Sc:return e.push("");case Ec:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Uc(i,e,t){var r;switch(e.nodeType){case Mt:r=e.cloneNode(!1),r.ownerDocument=i;case di:break;case cr:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var s=e.firstChild;s;)r.appendChild(Uc(i,s,t)),s=s.nextSibling;return r}function eo(i,e,t){var r=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var n=e[s];typeof n!="object"&&n!=r[s]&&(r[s]=n)}switch(e.childNodes&&(r.childNodes=new ai),r.ownerDocument=i,r.nodeType){case Mt:var a=e.attributes,o=r.attributes=new Tn,l=a.length;o._ownerElement=r;for(var h=0;h",lt:"<",quot:'"'}),i.HTML_ENTITIES=e({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:` `,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}),i.entityMap=i.HTML_ENTITIES})(Vc);var Go={},vs=fi.NAMESPACE,to=/[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]/,ql=new RegExp("[\\-\\.0-9"+to.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Wl=new RegExp("^"+to.source+ql.source+"*(?::"+to.source+ql.source+"*)?$"),Kr=0,_i=1,zi=2,Xr=3,Ki=4,Xi=5,Yr=6,sn=7;function fr(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,fr)}fr.prototype=new Error;fr.prototype.name=fr.name;function $c(){}$c.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),Hc(e,e={}),Gg(i,e,t,r,this.errorHandler),r.endDocument()}};function Gg(i,e,t,r,s){function n(q){if(q>65535){q-=65536;var Q=55296+(q>>10),oe=56320+(q&1023);return String.fromCharCode(Q,oe)}else return String.fromCharCode(q)}function a(q){var Q=q.slice(1,-1);return Object.hasOwnProperty.call(t,Q)?t[Q]:Q.charAt(0)==="#"?n(parseInt(Q.substr(1).replace("x","0x"))):(s.error("entity not found:"+q),q)}function o(q){if(q>b){var Q=i.substring(b,q).replace(/&#?\w+;/g,a);_&&l(b),r.characters(Q,0,q-b),b=q}}function l(q,Q){for(;q>=c&&(Q=p.exec(i));)h=Q.index,c=h+Q[0].length,_.lineNumber++;_.columnNumber=q-h+1}for(var h=0,c=0,p=/.*(?:\r\n?|\n)|.*$/g,_=r.locator,E=[{currentNSMap:e}],g={},b=0;;){try{var C=i.indexOf("<",b);if(C<0){if(!i.substr(b).match(/^\s*$/)){var x=r.doc,y=x.createTextNode(i.substr(b));x.appendChild(y),r.currentElement=y}return}switch(C>b&&o(C),i.charAt(C+1)){case"/":var U=i.indexOf(">",C+3),D=i.substring(C+2,U).replace(/[ \t\n\r]+$/g,""),S=E.pop();U<0?(D=i.substring(C+2).replace(/[\s<].*/,""),s.error("end tag name: "+D+" is not complete:"+S.tagName),U=C+1+D.length):D.match(/\sb?b=U:o(Math.max(C,b)+1)}}function zl(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function qg(i,e,t,r,s,n){function a(_,E,g){t.attributeNames.hasOwnProperty(_)&&n.fatalError("Attribute "+_+" redefined"),t.addValue(_,E.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),g)}for(var o,l,h=++e,c=Kr;;){var p=i.charAt(h);switch(p){case"=":if(c===_i)o=i.slice(e,h),c=Xr;else if(c===zi)c=Xr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===Xr||c===_i)if(c===_i&&(n.warning('attribute value must after "="'),o=i.slice(e,h)),e=h+1,h=i.indexOf(p,e),h>0)l=i.slice(e,h),a(o,l,e-1),c=Xi;else throw new Error("attribute value no end '"+p+"' match");else if(c==Ki)l=i.slice(e,h),a(o,l,e),n.warning('attribute "'+o+'" missed start quot('+p+")!!"),e=h+1,c=Xi;else throw new Error('attribute value must after "="');break;case"/":switch(c){case Kr:t.setTagName(i.slice(e,h));case Xi:case Yr:case sn:c=sn,t.closed=!0;case Ki:case _i:break;case zi:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),c==Kr&&t.setTagName(i.slice(e,h)),h;case">":switch(c){case Kr:t.setTagName(i.slice(e,h));case Xi:case Yr:case sn:break;case Ki:case _i:l=i.slice(e,h),l.slice(-1)==="/"&&(t.closed=!0,l=l.slice(0,-1));case zi:c===zi&&(l=o),c==Ki?(n.warning('attribute "'+l+'" missed quot(")!'),a(o,l,e)):((!vs.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+l+'" missed value!! "'+l+'" instead!!'),a(l,l,e));break;case Xr:throw new Error("attribute value missed!!")}return h;case"\x80":p=" ";default:if(p<=" ")switch(c){case Kr:t.setTagName(i.slice(e,h)),c=Yr;break;case _i:o=i.slice(e,h),c=zi;break;case Ki:var l=i.slice(e,h);n.warning('attribute "'+l+'" missed quot(")!!'),a(o,l,e);case Xi:c=Yr;break}else switch(c){case zi:t.tagName,(!vs.isHTML(r[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,c=_i;break;case Xi:n.warning('attribute space is required"'+o+'"!!');case Yr:c=_i,e=h;break;case Xr:c=Ki,e=h;break;case sn:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function Kl(i,e,t){for(var r=i.tagName,s=null,p=i.length;p--;){var n=i[p],a=n.qName,o=n.value,_=a.indexOf(":");if(_>0)var l=n.prefix=a.slice(0,_),h=a.slice(_+1),c=l==="xmlns"&&h;else h=a,l=null,c=a==="xmlns"&&"";n.localName=h,c!==!1&&(s==null&&(s={},Hc(t,t={})),t[c]=s[c]=o,n.uri=vs.XMLNS,e.startPrefixMapping(c,o))}for(var p=i.length;p--;){n=i[p];var l=n.prefix;l&&(l==="xml"&&(n.uri=vs.XML),l!=="xmlns"&&(n.uri=t[l||""]))}var _=r.indexOf(":");_>0?(l=i.prefix=r.slice(0,_),h=i.localName=r.slice(_+1)):(l=null,h=i.localName=r);var E=i.uri=t[l||""];if(e.startElement(E,h,r,i),i.closed){if(e.endElement(E,h,r),s)for(l in s)Object.prototype.hasOwnProperty.call(s,l)&&e.endPrefixMapping(l)}else return i.currentNSMap=t,i.localNSMap=s,!0}function Wg(i,e,t,r,s){if(/^(?:script|textarea)$/i.test(t)){var n=i.indexOf("",e),a=i.substring(e+1,n);if(/[&<]/.test(a))return/^script$/i.test(t)?(s.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,r),s.characters(a,0,a.length),n)}return e+1}function zg(i,e,t,r){var s=r[t];return s==null&&(s=i.lastIndexOf(""),s",e+4);return n>e?(t.comment(i,e+4,n-e-4),n+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var n=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,n-e-9),t.endCDATA(),n+3}var a=Yg(i,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var l=a[1][0],h=!1,c=!1;o>3&&(/^public$/i.test(a[2][0])?(h=a[3][0],c=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var p=a[o-1];return t.startDTD(l,h,c),t.endDTD(),p.index+p[0].length}}return-1}function Xg(i,e,t){var r=i.indexOf("?>",e);if(r){var s=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),r+2):-1}return-1}function Gc(){this.attributeNames={}}Gc.prototype={setTagName:function(i){if(!Wl.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!Wl.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function Yg(i,e){var t,r=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(i);t=s.exec(i);)if(r.push(t),t[1])return r}Go.XMLReader=$c;Go.ParseError=fr;var Qg=fi,Jg=bi,Xl=Vc,qc=Go,Zg=Jg.DOMImplementation,Yl=Qg.NAMESPACE,e_=qc.ParseError,t_=qc.XMLReader;function Wc(i){return i.replace(/\r[\n\u0085]/g,` `).replace(/[\r\u0085\u2028]/g,` `)}function zc(i){this.options=i||{locator:{}}}zc.prototype.parseFromString=function(i,e){var t=this.options,r=new t_,s=t.domBuilder||new As,n=t.errorHandler,a=t.locator,o=t.xmlns||{},l=/\/x?html?$/.test(e),h=l?Xl.HTML_ENTITIES:Xl.XML_ENTITIES;a&&s.setDocumentLocator(a),r.errorHandler=i_(n,s,a),r.domBuilder=t.domBuilder||s,l&&(o[""]=Yl.HTML),o.xml=o.xml||Yl.XML;var c=t.normalizeLineEndings||Wc;return i&&typeof i=="string"?r.parse(c(i),o,h):r.errorHandler.error("invalid doc source"),s.doc};function i_(i,e,t){if(!i){if(e instanceof As)return e;i=e}var r={},s=i instanceof Function;t=t||{};function n(a){var o=i[a];!o&&s&&(o=i.length==2?function(l){i(a,l)}:i),r[a]=o&&function(l){o("[xmldom "+a+"] "+l+io(t))}||function(){}}return n("warning"),n("error"),n("fatalError"),r}function As(){this.cdata=!1}function Yi(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}As.prototype={startDocument:function(){this.doc=new Zg().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,r){var s=this.doc,n=s.createElementNS(i,t||e),a=r.length;nn(this,n),this.currentElement=n,this.locator&&Yi(this.locator,n);for(var o=0;o=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){As.prototype[i]=function(){return null}});function nn(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}Wn.__DOMHandler=As;Wn.normalizeLineEndings=Wc;Wn.DOMParser=zc;var r_=Wn.DOMParser;/*! @name mpd-parser @version 1.2.2 @license Apache-2.0 */const Jl=i=>!!i&&typeof i=="object",qe=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(r=>{Array.isArray(e[r])&&Array.isArray(t[r])?e[r]=e[r].concat(t[r]):Jl(e[r])&&Jl(t[r])?e[r]=qe(e[r],t[r]):e[r]=t[r]}),e),{}),Kc=i=>Object.keys(i).map(e=>i[e]),s_=(i,e)=>{const t=[];for(let r=i;ri.reduce((e,t)=>e.concat(t),[]),Xc=i=>{if(!i.length)return[];const e=[];for(let t=0;ti.reduce((t,r,s)=>(r[e]&&t.push(s),t),[]),a_=(i,e)=>Kc(i.reduce((t,r)=>(r.forEach(s=>{t[e(s)]=s}),t),{}));var mr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const ys=({baseUrl:i="",source:e="",range:t="",indexRange:r=""})=>{const s={uri:e,resolvedUri:Ro(i||"",e)};if(t||r){const a=(t||r).split("-");let o=R.BigInt?R.BigInt(a[0]):parseInt(a[0],10),l=R.BigInt?R.BigInt(a[1]):parseInt(a[1],10);o{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=R.BigInt(i.offset)+R.BigInt(i.length)-R.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},Zl=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),u_={static(i){const{duration:e,timescale:t=1,sourceDuration:r,periodDuration:s}=i,n=Zl(i.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof s=="number"?{start:0,end:s/a}:{start:0,end:r/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:r,timescale:s=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:l=1/0}=i,h=Zl(i.endNumber),c=(e+t)/1e3,p=r+a,E=c+o-p,g=Math.ceil(E*s/n),b=Math.floor((c-p-l)*s/n),C=Math.floor((c-p)*s/n);return{start:Math.max(0,b),end:typeof h=="number"?h:Math.min(g,C)}}},l_=i=>e=>{const{duration:t,timescale:r=1,periodStart:s,startNumber:n=1}=i;return{number:n+e,duration:t/r,timeline:s,time:e*t}},qo=i=>{const{type:e,duration:t,timescale:r=1,periodDuration:s,sourceDuration:n}=i,{start:a,end:o}=u_[e](i),l=s_(a,o).map(l_(i));if(e==="static"){const h=l.length-1,c=typeof s=="number"?s:n;l[h].duration=c-t/r*h}return l},Yc=i=>{const{baseUrl:e,initialization:t={},sourceDuration:r,indexRange:s="",periodStart:n,presentationTime:a,number:o=0,duration:l}=i;if(!e)throw new Error(mr.NO_BASE_URL);const h=ys({baseUrl:e,source:t.sourceURL,range:t.range}),c=ys({baseUrl:e,source:e,indexRange:s});if(c.map=h,l){const p=qo(i);p.length&&(c.duration=p[0].duration,c.timeline=p[0].timeline)}else r&&(c.duration=r,c.timeline=n);return c.presentationTime=a||n,c.number=o,[c]},Wo=(i,e,t)=>{const r=i.sidx.map?i.sidx.map:null,s=i.sidx.duration,n=i.timeline||0,a=i.sidx.byterange,o=a.offset+a.length,l=e.timescale,h=e.references.filter(C=>C.referenceType!==1),c=[],p=i.endList?"static":"dynamic",_=i.sidx.timeline;let E=_,g=i.mediaSequence||0,b;typeof e.firstOffset=="bigint"?b=R.BigInt(o)+e.firstOffset:b=o+e.firstOffset;for(let C=0;Ca_(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),h_=(i,e)=>{for(let t=0;t{let e=[];return Lg(i,d_,(t,r,s,n)=>{e=e.concat(t.playlists||[])}),e},td=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,r)=>{t.number=i.mediaSequence+r})},f_=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:l}){return l===r.timeline});const s=h_(i,r.attributes.NAME);if(!s||r.sidx)return;const n=r.segments[0],a=s.segments.findIndex(function(l){return Math.abs(l.presentationTime-n.presentationTime)s.timeline||s.segments.length&&r.timeline>s.segments[s.segments.length-1].timeline)&&r.discontinuitySequence--;return}s.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),td({playlist:r,mediaSequence:s.segments[a].number})})},p_=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(ed(i)),r=e.playlists.concat(ed(e));return e.timelineStarts=Qc([i.timelineStarts,e.timelineStarts]),f_({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},zn=i=>i&&i.uri+"-"+o_(i.byterange),Na=i=>{const e=i.reduce(function(r,s){return r[s.attributes.baseUrl]||(r[s.attributes.baseUrl]=[]),r[s.attributes.baseUrl].push(s),r},{});let t=[];return Object.values(e).forEach(r=>{const s=Kc(r.reduce((n,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return n[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[o].segments.push(...a.segments)),a.attributes.contentProtection&&(n[o].attributes.contentProtection=a.attributes.contentProtection)):(n[o]=a,n[o].attributes.timelineStarts=[]),n[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(s)}),t.map(r=>(r.discontinuityStarts=n_(r.segments||[],"discontinuity"),r))},zo=(i,e)=>{const t=zn(i.sidx),r=t&&e[t]&&e[t].sidx;return r&&Wo(i,r,i.sidx.resolvedUri),i},m_=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=zo(i[t],e);return i},g_=({attributes:i,segments:e,sidx:t,mediaSequence:r,discontinuitySequence:s,discontinuityStarts:n},a)=>{const o={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,["PROGRAM-ID"]:1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:i.timelineStarts,mediaSequence:r,segments:e};return i.contentProtection&&(o.contentProtection=i.contentProtection),i.serviceLocation&&(o.attributes.serviceLocation=i.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},__=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:r,discontinuitySequence:s})=>{typeof e=="undefined"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const n={NAME:i.id,BANDWIDTH:i.bandwidth,["PROGRAM-ID"]:1};i.codecs&&(n.CODECS=i.codecs);const a={attributes:n,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:r,discontinuitySequence:s,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},v_=(i,e={},t=!1)=>{let r;const s=i.reduce((n,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",l=a.attributes.lang||"";let h=a.attributes.label||"main";if(l&&!a.attributes.label){const p=o?` (${o})`:"";h=`${a.attributes.lang}${p}`}n[h]||(n[h]={language:l,autoselect:!0,default:o==="main",playlists:[],uri:""});const c=zo(g_(a,t),e);return n[h].playlists.push(c),typeof r=="undefined"&&o==="main"&&(r=a,r.default=!0),n},{});if(!r){const n=Object.keys(s)[0];s[n].default=!0}return s},y_=(i,e={})=>i.reduce((t,r)=>{const s=r.attributes.label||r.attributes.lang||"text";return t[s]||(t[s]={language:s,default:!1,autoselect:!1,playlists:[],uri:""}),t[s].playlists.push(zo(__(r),e)),t},{}),T_=i=>i.reduce((e,t)=>(t&&t.forEach(r=>{const{channel:s,language:n}=r;e[n]={autoselect:!1,default:!1,instreamId:s,language:n},r.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[n].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[n]["3D"]=r["3D"])}),e),{}),x_=({attributes:i,segments:e,sidx:t,discontinuityStarts:r})=>{const s={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,["PROGRAM-ID"]:1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:r,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(s.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(s.contentProtection=i.contentProtection),i.serviceLocation&&(s.attributes.serviceLocation=i.serviceLocation),t&&(s.sidx=t),s},b_=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",E_=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",S_=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",C_=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:r}){return r===t.timeline}),t.segments&&t.segments.forEach((r,s)=>{r.number=s})})},id=i=>i?Object.keys(i).reduce((e,t)=>{const r=i[t];return e.concat(r.playlists)},[]):[],A_=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:r={},previousManifest:s,eventStream:n})=>{if(!i.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:l,minimumUpdatePeriod:h}=i[0].attributes,c=Na(i.filter(b_)).map(x_),p=Na(i.filter(E_)),_=Na(i.filter(S_)),E=i.map(S=>S.attributes.captionServices).filter(Boolean),g={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},["CLOSED-CAPTIONS"]:{},SUBTITLES:{}},uri:"",duration:a,playlists:m_(c,r)};h>=0&&(g.minimumUpdatePeriod=h*1e3),e&&(g.locations=e),t&&(g.contentSteering=t),o==="dynamic"&&(g.suggestedPresentationDelay=l),n&&n.length>0&&(g.eventStream=n);const b=g.playlists.length===0,C=p.length?v_(p,r,b):null,x=_.length?y_(_,r):null,y=c.concat(id(C),id(x)),D=y.map(({timelineStarts:S})=>S);return g.timelineStarts=Qc(D),C_(y,g.timelineStarts),C&&(g.mediaGroups.AUDIO.audio=C),x&&(g.mediaGroups.SUBTITLES.subs=x),E.length&&(g.mediaGroups["CLOSED-CAPTIONS"].cc=T_(E)),s?p_({oldManifest:s,newManifest:g}):g},D_=(i,e,t)=>{const{NOW:r,clientOffset:s,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:l=0}=i,h=(r+s)/1e3,c=n+o,_=h+l-c;return Math.ceil((_*a-e)/t)},Jc=(i,e)=>{const{type:t,minimumUpdatePeriod:r=0,media:s="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:l}=i,h=[];let c=-1;for(let p=0;pc&&(c=b);let C;if(g<0){const D=p+1;D===e.length?t==="dynamic"&&r>0&&s.indexOf("$Number$")>0?C=D_(i,c,E):C=(n*a-c)/E:C=(e[D].t-c)/E}else C=g+1;const x=o+h.length+C;let y=o+h.length;for(;y(e,t,r,s)=>{if(e==="$$")return"$";if(typeof i[t]=="undefined")return e;const n=""+i[t];return t==="RepresentationID"||(r?s=parseInt(s,10):s=1,n.length>=s)?n:`${new Array(s-n.length+1).join("0")}${n}`},rd=(i,e)=>i.replace(w_,L_(e)),I_=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?qo(i):Jc(i,e),k_=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=i,s=ys({baseUrl:i.baseUrl,source:rd(r.sourceURL,t),range:r.range});return I_(i,e).map(a=>{t.Number=a.number,t.Time=a.time;const o=rd(i.media||"",t),l=i.timescale||1,h=i.presentationTimeOffset||0,c=i.periodStart+(a.time-h)/l;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:Ro(i.baseUrl||"",o),map:s,number:a.number,presentationTime:c}})},O_=(i,e)=>{const{baseUrl:t,initialization:r={}}=i,s=ys({baseUrl:t,source:r.sourceURL,range:r.range}),n=ys({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=s,n},P_=(i,e)=>{const{duration:t,segmentUrls:r=[],periodStart:s}=i;if(!t&&!e||t&&e)throw new Error(mr.SEGMENT_TIME_UNSPECIFIED);const n=r.map(l=>O_(i,l));let a;return t&&(a=qo(i)),e&&(a=Jc(i,e)),a.map((l,h)=>{if(n[h]){const c=n[h],p=i.timescale||1,_=i.presentationTimeOffset||0;return c.timeline=l.timeline,c.duration=l.duration,c.number=l.number,c.presentationTime=s+(l.time-_)/p,c}}).filter(l=>l)},R_=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=k_,t=qe(i,e.template)):e.base?(r=Yc,t=qe(i,e.base)):e.list&&(r=P_,t=qe(i,e.list));const s={attributes:i};if(!r)return s;const n=r(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else n.length?t.duration=n.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return s.attributes=t,s.segments=n,e.base&&t.indexRange&&(s.sidx=n[0],s.segments=[]),s},M_=i=>i.map(R_),Pe=(i,e)=>Xc(i.childNodes).filter(({tagName:t})=>t===e),Ds=i=>i.textContent.trim(),B_=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),Qi=i=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!o)return 0;const[l,h,c,p,_,E]=o.slice(1);return parseFloat(l||0)*31536e3+parseFloat(h||0)*2592e3+parseFloat(c||0)*86400+parseFloat(p||0)*3600+parseFloat(_||0)*60+parseFloat(E||0)},N_=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),sd={mediaPresentationDuration(i){return Qi(i)},availabilityStartTime(i){return N_(i)/1e3},minimumUpdatePeriod(i){return Qi(i)},suggestedPresentationDelay(i){return Qi(i)},type(i){return i},timeShiftBufferDepth(i){return Qi(i)},start(i){return Qi(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return B_(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?Qi(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},je=i=>i&&i.attributes?Xc(i.attributes).reduce((e,t)=>{const r=sd[t.name]||sd.DEFAULT;return e[t.name]=r(t.value),e},{}):{},F_={"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"},Kn=(i,e)=>e.length?pr(i.map(function(t){return e.map(function(r){const s=Ds(r),n=Ro(t.baseUrl,s),a=qe(je(r),{baseUrl:n});return n!==s&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,Ko=i=>{const e=Pe(i,"SegmentTemplate")[0],t=Pe(i,"SegmentList")[0],r=t&&Pe(t,"SegmentURL").map(p=>qe({tag:"SegmentURL"},je(p))),s=Pe(i,"SegmentBase")[0],n=t||e,a=n&&Pe(n,"SegmentTimeline")[0],o=t||s||e,l=o&&Pe(o,"Initialization")[0],h=e&&je(e);h&&l?h.initialization=l&&je(l):h&&h.initialization&&(h.initialization={sourceURL:h.initialization});const c={template:h,segmentTimeline:a&&Pe(a,"S").map(p=>je(p)),list:t&&qe(je(t),{segmentUrls:r,initialization:je(l)}),base:s&&qe(je(s),{initialization:je(l)})};return Object.keys(c).forEach(p=>{c[p]||delete c[p]}),c},U_=(i,e,t)=>r=>{const s=Pe(r,"BaseURL"),n=Kn(e,s),a=qe(i,je(r)),o=Ko(r);return n.map(l=>({segmentInfo:qe(t,o),attributes:qe(a,l)}))},j_=i=>i.reduce((e,t)=>{const r=je(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const s=F_[r.schemeIdUri];if(s){e[s]={attributes:r};const n=Pe(t,"cenc:pssh")[0];if(n){const a=Ds(n);e[s].pssh=a&&fc(a)}}return e},{}),V_=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{let r,s;return s=t,/^CC\d=/.test(t)?[r,s]=t.split("="):/^CC\d$/.test(t)&&(r=t),{channel:r,language:s}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[s,n=""]=t.split("=");r.channel=s,r.language=t,n.split(",").forEach(a=>{const[o,l]=a.split(":");o==="lang"?r.language=l:o==="er"?r.easyReader=Number(l):o==="war"?r.aspectRatio=Number(l):o==="3D"&&(r["3D"]=Number(l))})}else r.language=t;return r.channel&&(r.channel="SERVICE"+r.channel),r})},$_=i=>pr(Pe(i.node,"EventStream").map(e=>{const t=je(e),r=t.schemeIdUri;return Pe(e,"Event").map(s=>{const n=je(s),a=n.presentationTime||0,o=t.timescale||1,l=n.duration||0,h=a/o+i.attributes.start;return{schemeIdUri:r,value:t.value,id:n.id,start:h,end:h+l/o,messageData:Ds(s)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),H_=(i,e,t)=>r=>{const s=je(r),n=Kn(e,Pe(r,"BaseURL")),a=Pe(r,"Role")[0],o={role:je(a)};let l=qe(i,s,o);const h=Pe(r,"Accessibility")[0],c=V_(je(h));c&&(l=qe(l,{captionServices:c}));const p=Pe(r,"Label")[0];if(p&&p.childNodes.length){const C=p.childNodes[0].nodeValue.trim();l=qe(l,{label:C})}const _=j_(Pe(r,"ContentProtection"));Object.keys(_).length&&(l=qe(l,{contentProtection:_}));const E=Ko(r),g=Pe(r,"Representation"),b=qe(t,E);return pr(g.map(U_(l,n,b)))},G_=(i,e)=>(t,r)=>{const s=Kn(e,Pe(t.node,"BaseURL")),n=qe(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Pe(t.node,"AdaptationSet"),o=Ko(t.node);return pr(a.map(H_(n,s,o)))},q_=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=qe({serverURL:Ds(i[0])},je(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},W_=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,z_=(i,e={})=>{const{manifestUri:t="",NOW:r=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=e,a=Pe(i,"Period");if(!a.length)throw new Error(mr.INVALID_NUMBER_OF_PERIOD);const o=Pe(i,"Location"),l=je(i),h=Kn([{baseUrl:t}],Pe(i,"BaseURL")),c=Pe(i,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=r,l.clientOffset=s,o.length&&(l.locations=o.map(Ds));const p=[];return a.forEach((_,E)=>{const g=je(_),b=p[E-1];g.start=W_({attributes:g,priorPeriodAttributes:b?b.attributes:null,mpdType:l.type}),p.push({node:_,attributes:g})}),{locations:l.locations,contentSteeringInfo:q_(c,n),representationInfo:pr(p.map(G_(l,h))),eventStream:pr(p.map($_))}},Zc=i=>{if(i==="")throw new Error(mr.DASH_EMPTY_MANIFEST);const e=new r_;let t,r;try{t=e.parseFromString(i,"application/xml"),r=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch(s){}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(mr.DASH_INVALID_XML);return r},K_=i=>{const e=Pe(i,"UTCTiming")[0];if(!e)return null;const t=je(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(mr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},X_=(i,e={})=>{const t=z_(Zc(i),e),r=M_(t.representationInfo);return A_({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},Y_=i=>K_(Zc(i));var eh=Math.pow(2,32),Q_=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t0;r+=12,s--)t.references.push({referenceType:(i[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(i[r+8]&128),sapType:(i[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return t},ev=Z_,tv=re([73,68,51]),iv=function(e,t){t===void 0&&(t=0),e=re(e);var r=e[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(r&16)>>4;return n?s+20:s+10},ss=function i(e,t){return t===void 0&&(t=0),e=re(e),e.length-t<10||!Oe(e,tv,{offset:t})?t:(t+=iv(e,t),i(e,t))},ad=function(e){return typeof e=="string"?vc(e):e},rv=function(e){return Array.isArray(e)?e.map(function(t){return ad(t)}):[ad(e)]},sv=function i(e,t,r){r===void 0&&(r=!1),t=rv(t),e=re(e);var s=[];if(!t.length)return s;for(var n=0;n>>0,o=e.subarray(n+4,n+8);if(a===0)break;var l=n+a;if(l>e.length){if(r)break;l=e.length}var h=e.subarray(n+8,l);Oe(o,t[0])&&(t.length===1?s.push(h):s.push.apply(s,i(h,t.slice(1),r))),n=l}return s},an={EBML:re([26,69,223,163]),DocType:re([66,130]),Segment:re([24,83,128,103]),SegmentInfo:re([21,73,169,102]),Tracks:re([22,84,174,107]),Track:re([174]),TrackNumber:re([215]),DefaultDuration:re([35,227,131]),TrackEntry:re([174]),TrackType:re([131]),FlagDefault:re([136]),CodecID:re([134]),CodecPrivate:re([99,162]),VideoTrack:re([224]),AudioTrack:re([225]),Cluster:re([31,67,182,117]),Timestamp:re([231]),TimestampScale:re([42,215,177]),BlockGroup:re([160]),BlockDuration:re([155]),Block:re([161]),SimpleBlock:re([163])},ro=[128,64,32,16,8,4,2,1],nv=function(e){for(var t=1,r=0;r=t.length)return t.length;var s=En(t,r,!1);if(Oe(e.bytes,s.bytes))return r;var n=En(t,r+s.length);return i(e,t,r+n.length+n.value+s.length)},ud=function i(e,t){t=av(t),e=re(e);var r=[];if(!t.length)return r;for(var s=0;se.length?e.length:o+a.value,h=e.subarray(o,l);Oe(t[0],n.bytes)&&(t.length===1?r.push(h):r=r.concat(i(h,t.slice(1))));var c=n.length+a.length+h.length;s+=c}return r},uv=re([0,0,0,1]),lv=re([0,0,1]),dv=re([0,0,3]),cv=function(e){for(var t=[],r=1;r>1&63),r.indexOf(h)!==-1&&(a=n+l),n+=l+(t==="h264"?1:2)}return e.subarray(0,0)},hv=function(e,t,r){return th(e,"h264",t,r)},fv=function(e,t,r){return th(e,"h265",t,r)},it={webm:re([119,101,98,109]),matroska:re([109,97,116,114,111,115,107,97]),flac:re([102,76,97,67]),ogg:re([79,103,103,83]),ac3:re([11,119]),riff:re([82,73,70,70]),avi:re([65,86,73]),wav:re([87,65,86,69]),"3gp":re([102,116,121,112,51,103]),mp4:re([102,116,121,112]),fmp4:re([115,116,121,112]),mov:re([102,116,121,112,113,116]),moov:re([109,111,111,118]),moof:re([109,111,111,102])},gr={aac:function(e){var t=ss(e);return Oe(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=ss(e);return Oe(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=ud(e,[an.EBML,an.DocType])[0];return Oe(t,it.webm)},mkv:function(e){var t=ud(e,[an.EBML,an.DocType])[0];return Oe(t,it.matroska)},mp4:function(e){if(gr["3gp"](e)||gr.mov(e))return!1;if(Oe(e,it.mp4,{offset:4})||Oe(e,it.fmp4,{offset:4})||Oe(e,it.moof,{offset:4})||Oe(e,it.moov,{offset:4}))return!0},mov:function(e){return Oe(e,it.mov,{offset:4})},"3gp":function(e){return Oe(e,it["3gp"],{offset:4})},ac3:function(e){var t=ss(e);return Oe(e,it.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+1880},Yo=9e4,Qo,Jo,Xn,Zo,ih,rh,sh;Qo=function(i){return i*Yo};Jo=function(i,e){return i*e};Xn=function(i){return i/Yo};Zo=function(i,e){return i/e};ih=function(i,e){return Qo(Zo(i,e))};rh=function(i,e){return Jo(Xn(i),e)};sh=function(i,e,t){return Xn(t?i:i-e)};var Sn={ONE_SECOND_IN_TS:Yo,secondsToVideoTs:Qo,secondsToAudioTs:Jo,videoTsToSeconds:Xn,audioTsToSeconds:Zo,audioTsToVideoTs:ih,videoTsToAudioTs:rh,metadataTsToSeconds:sh};/** * @license * Video.js 8.6.0 * Copyright Brightcove, Inc. * Available under Apache License Version 2.0 * * * Includes vtt.js * Available under Apache License Version 2.0 * */var nh="8.6.0";const si={},yi=function(i,e){return si[i]=si[i]||[],e&&(si[i]=si[i].concat(e)),si[i]},gv=function(i,e){yi(i,e)},ah=function(i,e){const t=yi(i).indexOf(e);return t<=-1?!1:(si[i]=si[i].slice(),si[i].splice(t,1),!0)},_v=function(i,e){yi(i,[].concat(e).map(t=>{const r=(...s)=>(ah(i,r),t(...s));return r}))},Cn={prefixed:!0},fn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],ld=fn[0];let ns;for(let i=0;i(r,s,n)=>{const a=e.levels[s],o=new RegExp(`^(${a})$`);let l=i;if(r!=="log"&&n.unshift(r.toUpperCase()+":"),t&&(l=`%c${i}`,n.unshift(t)),n.unshift(l+":"),dt){dt.push([].concat(n));const c=dt.length-1e3;dt.splice(0,c>0?c:0)}if(!R.console)return;let h=R.console[r];!h&&r==="debug"&&(h=R.console.info||R.console.log),!(!h||!a||!o.test(r))&&h[Array.isArray(n)?"apply":"call"](R.console,n)};function no(i,e=":",t=""){let r="info",s;const n=function(...a){s("log",r,a)};return s=vv(i,n,t),n.createLogger=(a,o,l)=>{const h=o!==void 0?o:e,c=l!==void 0?l:t,p=`${i} ${h} ${a}`;return no(p,h,c)},n.createNewLogger=(a,o,l)=>no(a,o,l),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=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);r=a}return r},n.history=()=>dt?[].concat(dt):[],n.history.filter=a=>(dt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),n.history.clear=()=>{dt&&(dt.length=0)},n.history.disable=()=>{dt!==null&&(dt.length=0,dt=null)},n.history.enable=()=>{dt===null&&(dt=[])},n.error=(...a)=>s("error",r,a),n.warn=(...a)=>s("warn",r,a),n.debug=(...a)=>s("debug",r,a),n}const ye=no("VIDEOJS"),oh=ye.createLogger,yv=Object.prototype.toString,uh=function(i){return Xt(i)?Object.keys(i):[]};function nr(i,e){uh(i).forEach(t=>e(i[t],t))}function lh(i,e,t=0){return uh(i).reduce((r,s)=>e(r,i[s],s),t)}function Xt(i){return!!i&&typeof i=="object"}function _r(i){return Xt(i)&&yv.call(i)==="[object Object]"&&i.constructor===Object}function we(...i){const e={};return i.forEach(t=>{!t||nr(t,(r,s)=>{if(!_r(r)){e[s]=r;return}_r(e[s])||(e[s]={}),e[s]=we(e[s],r)})}),e}function dh(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const r=i[t];e.push(r)}return e}function Yn(i,e,t,r=!0){const s=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return s(a),a}};return r&&(n.set=s),Object.defineProperty(i,e,n)}var Tv=Object.freeze({__proto__:null,each:nr,reduce:lh,isObject:Xt,isPlain:_r,merge:we,values:dh,defineLazyProperty:Yn});let eu=!1,ch=null,Yt=!1,hh,fh=!1,ar=!1,or=!1,Qt=!1,tu=null,Qn=null,ph=null,An=!1,Jn=!1,Dn=!1,Zn=!1;const Ts=Boolean(Sr()&&("ontouchstart"in R||R.navigator.maxTouchPoints||R.DocumentTouch&&R.document instanceof R.DocumentTouch)),Ji=R.navigator&&R.navigator.userAgentData;Ji&&(Yt=Ji.platform==="Android",ar=Boolean(Ji.brands.find(i=>i.brand==="Microsoft Edge")),or=Boolean(Ji.brands.find(i=>i.brand==="Chromium")),Qt=!ar&&or,tu=Qn=(Ji.brands.find(i=>i.brand==="Chromium")||{}).version||null,Jn=Ji.platform==="Windows");if(!or){const i=R.navigator&&R.navigator.userAgent||"";eu=/iPod/i.test(i),ch=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Yt=/Android/i.test(i),hh=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);return t&&r?parseFloat(e[1]+"."+e[2]):t||null}(),fh=/Firefox/i.test(i),ar=/Edg/i.test(i),or=/Chrome/i.test(i)||/CriOS/i.test(i),Qt=!ar&&or,tu=Qn=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),ph=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),An=/Safari/i.test(i)&&!Qt&&!Yt&&!ar,Jn=/Windows/i.test(i),Dn=/iPad/i.test(i)||An&&Ts&&!/iPhone/i.test(i),Zn=/iPhone/i.test(i)&&!Dn}const ot=Zn||Dn||eu,ea=(An||ot)&&!Qt;var xv=Object.freeze({__proto__:null,get IS_IPOD(){return eu},get IOS_VERSION(){return ch},get IS_ANDROID(){return Yt},get ANDROID_VERSION(){return hh},get IS_FIREFOX(){return fh},get IS_EDGE(){return ar},get IS_CHROMIUM(){return or},get IS_CHROME(){return Qt},get CHROMIUM_VERSION(){return tu},get CHROME_VERSION(){return Qn},get IE_VERSION(){return ph},get IS_SAFARI(){return An},get IS_WINDOWS(){return Jn},get IS_IPAD(){return Dn},get IS_IPHONE(){return Zn},TOUCH_ENABLED:Ts,IS_IOS:ot,IS_ANY_SAFARI:ea});function dd(i){return typeof i=="string"&&Boolean(i.trim())}function bv(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Sr(){return J===R.document}function Cr(i){return Xt(i)&&i.nodeType===1}function mh(){try{return R.parent!==R.self}catch(i){return!0}}function gh(i){return function(e,t){if(!dd(e))return J[i](null);dd(t)&&(t=J.querySelector(t));const r=Cr(t)?t:J;return r[i]&&r[i](e)}}function me(i="div",e={},t={},r){const s=J.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Ei(s,a):(s[n]!==a||n==="tabIndex")&&(s[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){s.setAttribute(n,t[n])}),r&&iu(s,r),s}function Ei(i,e){return typeof i.textContent=="undefined"?i.innerText=e:i.textContent=e,i}function ao(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function ls(i,e){return bv(e),i.classList.contains(e)}function Bi(i,...e){return i.classList.add(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i}function ta(i,...e){return i?(i.classList.remove(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i):(ye.warn("removeClass was called with an element that doesn't exist"),null)}function _h(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(r=>i.classList.toggle(r,t)),i}function vh(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const r=e[t];r===null||typeof r=="undefined"||r===!1?i.removeAttribute(t):i.setAttribute(t,r===!0?"":r)})}function vi(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const r=i.attributes;for(let s=r.length-1;s>=0;s--){const n=r[s].name;let a=r[s].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function yh(i,e){return i.getAttribute(e)}function vr(i,e,t){i.setAttribute(e,t)}function ia(i,e){i.removeAttribute(e)}function Th(){J.body.focus(),J.onselectstart=function(){return!1}}function xh(){J.onselectstart=function(){return!0}}function yr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(r=>{e[r]!==void 0&&(t[r]=e[r])}),t.height||(t.height=parseFloat(Tr(i,"height"))),t.width||(t.width=parseFloat(Tr(i,"width"))),t}}function xs(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let r=0,s=0;for(;i.offsetParent&&i!==J[Cn.fullscreenElement];)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;return{left:r,top:s,width:e,height:t}}function ra(i,e){const t={x:0,y:0};if(ot){let c=i;for(;c&&c.nodeName.toLowerCase()!=="html";){const p=Tr(c,"transform");if(/^matrix/.test(p)){const _=p.slice(7,-1).split(/,\s/).map(Number);t.x+=_[4],t.y+=_[5]}else if(/^matrix3d/.test(p)){const _=p.slice(9,-1).split(/,\s/).map(Number);t.x+=_[12],t.y+=_[13]}c=c.parentNode}}const r={},s=xs(e.target),n=xs(i),a=n.width,o=n.height;let l=e.offsetY-(n.top-s.top),h=e.offsetX-(n.left-s.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-n.left,l=e.changedTouches[0].pageY+n.top,ot&&(h-=t.x,l-=t.y)),r.y=1-Math.max(0,Math.min(1,l/o)),r.x=Math.max(0,Math.min(1,h/a)),r}function bh(i){return Xt(i)&&i.nodeType===3}function sa(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function Eh(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Cr(e)||bh(e))return e;if(typeof e=="string"&&/\S/.test(e))return J.createTextNode(e)}).filter(e=>e)}function iu(i,e){return Eh(e).forEach(t=>i.appendChild(t)),i}function Sh(i,e){return iu(sa(i),e)}function bs(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const Ti=gh("querySelector"),Ch=gh("querySelectorAll");function Tr(i,e){if(!i||!e)return"";if(typeof R.getComputedStyle=="function"){let t;try{t=R.getComputedStyle(i)}catch(r){return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Ah(i){[...J.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(s=>s.cssText).join(""),r=J.createElement("style");r.textContent=t,i.document.head.appendChild(r)}catch(t){const r=J.createElement("link");r.rel="stylesheet",r.type=e.type,r.media=e.media.mediaText,r.href=e.href,i.document.head.appendChild(r)}})}var Dh=Object.freeze({__proto__:null,isReal:Sr,isEl:Cr,isInFrame:mh,createEl:me,textContent:Ei,prependTo:ao,hasClass:ls,addClass:Bi,removeClass:ta,toggleClass:_h,setAttributes:vh,getAttributes:vi,getAttribute:yh,setAttribute:vr,removeAttribute:ia,blockTextSelection:Th,unblockTextSelection:xh,getBoundingClientRect:yr,findPosition:xs,getPointerPosition:ra,isTextNode:bh,emptyEl:sa,normalizeContent:Eh,appendContent:iu,insertContent:Sh,isSingleLeftClick:bs,$:Ti,$$:Ch,computedStyle:Tr,copyStyleSheetsToWindow:Ah});let wh=!1,oo;const Ev=function(){if(oo.options.autoSetup===!1)return;const i=Array.prototype.slice.call(J.getElementsByTagName("video")),e=Array.prototype.slice.call(J.getElementsByTagName("audio")),t=Array.prototype.slice.call(J.getElementsByTagName("video-js")),r=i.concat(e,t);if(r&&r.length>0)for(let s=0,n=r.length;s-1&&(s={passive:!0}),i.addEventListener(e,r.dispatcher,s)}else i.attachEvent&&i.attachEvent("on"+e,r.dispatcher)}function Qe(i,e,t){if(!nt.has(i))return;const r=nt.get(i);if(!r.handlers)return;if(Array.isArray(e))return ru(Qe,i,e,t);const s=function(a,o){r.handlers[o]=[],cd(a,o)};if(e===void 0){for(const a in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},a)&&s(i,a);return}const n=r.handlers[e];if(!!n){if(!t){s(i,e);return}if(t.guid)for(let a=0;a=e&&(i(...s),t=n)}},kh=function(i,e,t,r=R){let s;const n=()=>{r.clearTimeout(s),s=null},a=function(){const o=this,l=arguments;let h=function(){s=null,h=null,t||i.apply(o,l)};!s&&t&&i.apply(o,l),r.clearTimeout(s),s=r.setTimeout(h,e)};return a.cancel=n,a};var Lv=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:wt,bind_:Le,throttle:Zt,debounce:kh});let Qr;class Lt{on(e,t){const r=this.addEventListener;this.addEventListener=()=>{},xt(this,e,t),this.addEventListener=r}off(e,t){Qe(this,e,t)}one(e,t){const r=this.addEventListener;this.addEventListener=()=>{},aa(this,e,t),this.addEventListener=r}any(e,t){const r=this.addEventListener;this.addEventListener=()=>{},su(this,e,t),this.addEventListener=r}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=na(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ar(this,e)}queueTrigger(e){Qr||(Qr=new Map);const t=e.type||e;let r=Qr.get(this);r||(r=new Map,Qr.set(this,r));const s=r.get(t);r.delete(t),R.clearTimeout(s);const n=R.setTimeout(()=>{r.delete(t),r.size===0&&(r=null,Qr.delete(this)),this.trigger(e)},0);r.set(t,n)}}Lt.prototype.allowedEvents_={};Lt.prototype.addEventListener=Lt.prototype.on;Lt.prototype.removeEventListener=Lt.prototype.off;Lt.prototype.dispatchEvent=Lt.prototype.trigger;const oa=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,oi=i=>i instanceof Lt||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),Iv=(i,e)=>{oi(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},co=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,wn=(i,e,t)=>{if(!i||!i.nodeName&&!oi(i))throw new Error(`Invalid target for ${oa(e)}#${t}; must be a DOM node or evented object.`)},Oh=(i,e,t)=>{if(!co(i))throw new Error(`Invalid event type for ${oa(e)}#${t}; must be a non-empty string or array.`)},Ph=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${oa(e)}#${t}; must be a function.`)},Fa=(i,e,t)=>{const r=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let s,n,a;return r?(s=i.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):[s,n,a]=e,wn(s,i,t),Oh(n,i,t),Ph(a,i,t),a=Le(i,a),{isTargetingSelf:r,target:s,type:n,listener:a}},ki=(i,e,t,r)=>{wn(i,i,e),i.nodeName?wv[e](i,t,r):i[e](t,r)},kv={on(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Fa(this,i,"on");if(ki(t,"on",r,s),!e){const n=()=>this.off(t,r,s);n.guid=s.guid;const a=()=>this.off("dispose",n);a.guid=s.guid,ki(this,"on","dispose",n),ki(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Fa(this,i,"one");if(e)ki(t,"one",r,s);else{const n=(...a)=>{this.off(t,r,n),s.apply(null,a)};n.guid=s.guid,ki(t,"one",r,n)}},any(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Fa(this,i,"any");if(e)ki(t,"any",r,s);else{const n=(...a)=>{this.off(t,r,n),s.apply(null,a)};n.guid=s.guid,ki(t,"any",r,n)}},off(i,e,t){if(!i||co(i))Qe(this.eventBusEl_,i,e);else{const r=i,s=e;wn(r,this,"off"),Oh(s,this,"off"),Ph(t,this,"off"),t=Le(this,t),this.off("dispose",t),r.nodeName?(Qe(r,s,t),Qe(r,"dispose",t)):oi(r)&&(r.off(s,t),r.off("dispose",t))}},trigger(i,e){wn(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!co(t))throw new Error(`Invalid event type for ${oa(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ar(this.eventBusEl_,i,e)}};function nu(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=me("span",{className:"vjs-event-bus"});return Object.assign(i,kv),i.eventedCallbacks&&i.eventedCallbacks.forEach(r=>{r()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(r){r&&nt.has(r)&&nt.delete(r)}),R.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const Ov={state:{},setState(i){typeof i=="function"&&(i=i());let e;return nr(i,(t,r)=>{this.state[r]!==t&&(e=e||{},e[r]={from:this.state[r],to:t}),this.state[r]=t}),e&&oi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Rh(i,e){return Object.assign(i,Ov),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&oi(i)&&i.on("statechanged",i.handleStateChanged),i}const ds=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},Me=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},Mh=function(i,e){return Me(i)===Me(e)};var Pv=Object.freeze({__proto__:null,toLowerCase:ds,toTitleCase:Me,titleCaseEquals:Mh});class z{constructor(e,t,r){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=we({},this.options_),t=this.options_=we(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${Jt()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(s=>this.addClass(s)),["on","off","one","any","trigger"].forEach(s=>{this[s]=void 0}),t.evented!==!1&&(nu(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Rh(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(r),t.reportTouchActivity!==!1&&this.enableTouchActivity()}on(e,t){}off(e,t){}one(e,t){}any(e,t){}trigger(e,t){}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;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}}isDisposed(){return Boolean(this.isDisposed_)}player(){return this.player_}options(e){return e?(this.options_=we(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,r){return me(e,t,r)}localize(e,t,r=e){const s=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[s],o=s&&s.split("-")[0],l=n&&n[o];let h=r;return a&&a[e]?h=a[e]:l&&l[e]&&(h=l[e]),t&&(h=h.replace(/\{(\d+)\}/g,function(c,p){const _=t[p-1];let E=_;return typeof _=="undefined"&&(E=c),E})),h}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(!!e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((r,s)=>r.concat(s),[]);let t=this;for(let r=0;r=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Me(e.name())]=null,this.childNameIndex_[ds(e.name())]=null;const r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,r=a=>{const o=a.name;let l=a.opts;if(t[o]!==void 0&&(l=t[o]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const h=this.addChild(o,l);h&&(this[o]=h)};let s;const n=z.getComponent("Tech");Array.isArray(e)?s=e:s=Object.keys(e),s.concat(Object.keys(this.options_).filter(function(a){return!s.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,l;return typeof a=="string"?(o=a,l=e[o]||this.options_[o]||{}):(o=a.name,l=a),{name:o,opts:l}}).filter(a=>{const o=z.getComponent(a.opts.componentClass||Me(a.name));return o&&!n.isTech(o)}).forEach(r)}}buildCSSClass(){return""}ready(e,t=!1){if(!!e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Ti(e,t||this.contentEl())}$$(e,t){return Ch(e,t||this.contentEl())}hasClass(e){return ls(this.el_,e)}addClass(...e){Bi(this.el_,...e)}removeClass(...e){ta(this.el_,...e)}toggleClass(e,t){_h(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return yh(this.el_,e)}setAttribute(e,t){vr(this.el_,e,t)}removeAttribute(e){ia(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,r){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;const s=this.el_.style[e],n=s.indexOf("px");return parseInt(n!==-1?s.slice(0,n):this.el_["offset"+Me(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Tr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const r=`offset${Me(e)}`;t=this.el_[r]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(he.isEventKey(e,"Tab")||e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const r=10,s=200;let n;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=R.performance.now(),n=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)n=!1;else if(t){const l=o.touches[0].pageX-t.pageX,h=o.touches[0].pageY-t.pageY;Math.sqrt(l*l+h*h)>r&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,n===!0&&R.performance.now()-e{this.setTimeoutIds_.has(r)&&this.setTimeoutIds_.delete(r),e()},t),this.setTimeoutIds_.add(r),r}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),R.clearTimeout(e)),e}setInterval(e,t){e=Le(this,e),this.clearTimersOnDispose_();const r=R.setInterval(e,t);return this.setIntervalIds_.add(r),r}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),R.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Le(this,e),t=R.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){if(this.namedRafs_.has(e))return;this.clearTimersOnDispose_(),t=Le(this,t);const r=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}cancelNamedAnimationFrame(e){!this.namedRafs_.has(e)||(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),R.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((r,s)=>this[t](s))}),this.clearingTimersOnDispose_=!1}))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const r=z.getComponent("Tech"),s=r&&r.isTech(t),n=z===t||z.prototype.isPrototypeOf(t.prototype);if(s||!n){let o;throw s?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=Me(e),z.components_||(z.components_={});const a=z.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,l=Object.keys(o);if(o&&l.length>0&&l.map(h=>o[h]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return z.components_[e]=t,z.components_[ds(e)]=t,t}static getComponent(e){if(!(!e||!z.components_))return z.components_[e]}}z.registerComponent("Component",z);function Rv(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function hd(i,e,t,r){return Rv(i,r,t.length-1),t[r][e]}function Ua(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:hd.bind(null,"start",0,i),end:hd.bind(null,"end",1,i)},R.Symbol&&R.Symbol.iterator&&(e[R.Symbol.iterator]=()=>(i||[]).values()),e}function Kt(i,e){return Array.isArray(i)?Ua(i):i===void 0||e===void 0?Ua():Ua([[i,e]])}const Bh=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),r=Math.floor(i/60%60),s=Math.floor(i/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(s=r=t="-"),s=s>0||a>0?s+":":"",r=((s||n>=10)&&r<10?"0"+r:r)+":",t=t<10?"0"+t:t,s+r+t};let au=Bh;function Nh(i){au=i}function Fh(){au=Bh}function Ui(i,e=i){return au(i,e)}var Mv=Object.freeze({__proto__:null,createTimeRanges:Kt,createTimeRange:Kt,setFormatTime:Nh,resetFormatTime:Fh,formatTime:Ui});function Uh(i,e){let t=0,r,s;if(!e)return 0;(!i||!i.length)&&(i=Kt(0,0));for(let n=0;ne&&(s=e),t+=s-r;return t/e}function at(i){if(i instanceof at)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:Xt(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),this.message||(this.message=at.defaultMessages[this.code]||"")}at.prototype.code=0;at.prototype.message="";at.prototype.status=null;at.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];at.defaultMessages={1:"You aborted the media playback",2:"A network error caused the media download to fail part-way.",3:"The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",4:"The media could not be loaded, either because the server or network failed or because the format is not supported.",5:"The media is encrypted and we do not have the keys to decrypt it."};for(let i=0;i{})}const ho=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,r,s)=>(i[r]&&(t[r]=i[r]),t),{cues:i.cues&&Array.prototype.map.call(i.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},Bv=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,s=>s.track);return Array.prototype.map.call(e,function(s){const n=ho(s.track);return s.src&&(n.src=s.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(s){return t.indexOf(s)===-1}).map(ho))},Nv=function(i,e){return i.forEach(function(t){const r=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(s=>r.addCue(s))}),e.textTracks()};var fd={textTracksToJson:Bv,jsonToTextTracks:Nv,trackToJson_:ho};const ja="vjs-modal-dialog";class Dr extends z{constructor(e,t){super(e,t),this.handleKeyDown_=r=>this.handleKeyDown(r),this.close_=r=>this.close(r),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=me("div",{className:`${ja}-content`},{role:"document"}),this.descEl_=me("p",{className:`${ja}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ei(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${ja} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(!this.opened_){const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger("modalclose"),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let r=this.getChild("closeButton");if(t&&!r){const s=this.contentEl_;this.contentEl_=this.el_,r=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(r,"close",this.close_)}!t&&r&&(this.off(r,"close",this.close_),this.removeChild(r),r.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),r=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,r.removeChild(t),this.empty(),Sh(t,e),this.trigger("modalfill"),s?r.insertBefore(t,s):r.appendChild(t);const n=this.getChild("closeButton");n&&r.appendChild(n.el_)}empty(){this.trigger("beforemodalempty"),sa(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e!="undefined"&&(this.content_=e),this.content_}conditionalFocus_(){const e=J.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(e.stopPropagation(),he.isEventKey(e,"Escape")&&this.closeable()){e.preventDefault(),this.close();return}if(!he.isEventKey(e,"Tab"))return;const t=this.focusableEls_(),r=this.el_.querySelector(":focus");let s;for(let n=0;n(t instanceof R.HTMLAnchorElement||t instanceof R.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof R.HTMLInputElement||t instanceof R.HTMLSelectElement||t instanceof R.HTMLTextAreaElement||t instanceof R.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof R.HTMLIFrameElement||t instanceof R.HTMLObjectElement||t instanceof R.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Dr.prototype.options_={pauseOnOpen:!0,temporary:!0};z.registerComponent("ModalDialog",Dr);class xr extends Lt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t{this.trigger({track:e,type:"labelchange",target:this})},oi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let r=0,s=this.length;r=0;t--)if(e[t].enabled){Va(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Va(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Va(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const $a=function(i,e){for(let t=0;t=0;t--)if(e[t].selected){$a(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t{this.changing_||(this.changing_=!0,$a(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class jh extends xr{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class jv{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,r=e.length;t0&&(R.console&&R.console.groupCollapsed&&R.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),r.forEach(s=>ye.error(s)),R.console&&R.console.groupEnd&&R.console.groupEnd()),t.flush()},gd=function(i,e){const t={uri:i},r=ua(i);r&&(t.cors=r);const s=e.tech_.crossOrigin()==="use-credentials";s&&(t.withCredentials=s),uc(t,Le(this,function(n,a,o){if(n)return ye.error(n,a);e.loaded_=!0,typeof R.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){ye.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return md(o,e)}):md(o,e)}))};class ws extends ou{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=we(e,{kind:Hv[e.kind]||"subtitles",language:e.language||e.srclang||""});let r=pd[t.mode]||"disabled";const s=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(r="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new Ln(this.cues_),a=new Ln(this.activeCues_);let o=!1;this.timeupdateHandler=Le(this,function(h={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const l=()=>{this.stopTracking()};this.tech_.one("dispose",l),r!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return r},set(h){!pd[h]||r!==h&&(r=h,!this.preload_&&r!=="disabled"&&this.cues.length===0&&gd(this.src,this),this.stopTracking(),r!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const h=this.tech_.currentTime(),c=[];for(let p=0,_=this.cues.length;p<_;p++){const E=this.cues[p];E.startTime<=h&&E.endTime>=h&&c.push(E)}if(o=!1,c.length!==this.activeCues_.length)o=!0;else for(let p=0;p{t=hi.LOADED,this.trigger({type:"load",target:this})})}}hi.prototype.allowedEvents_={load:"load"};hi.NONE=0;hi.LOADING=1;hi.LOADED=2;hi.ERROR=3;const Dt={audio:{ListClass:Fv,TrackClass:$h,capitalName:"Audio"},video:{ListClass:Uv,TrackClass:Hh,capitalName:"Video"},text:{ListClass:jh,TrackClass:ws,capitalName:"Text"}};Object.keys(Dt).forEach(function(i){Dt[i].getterName=`${i}Tracks`,Dt[i].privateName=`${i}Tracks_`});const br={remoteText:{ListClass:jh,TrackClass:ws,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:jv,TrackClass:hi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},rt=Object.assign({},Dt,br);br.names=Object.keys(br);Dt.names=Object.keys(Dt);rt.names=[].concat(br.names).concat(Dt.names);function qv(i,e,t,r,s={}){const n=i.textTracks();s.kind=e,t&&(s.label=t),r&&(s.language=r),s.tech=i;const a=new rt.text.TrackClass(s);return n.addTrack(a),a}class fe extends z{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=r=>this.onDurationChange(r),this.trackProgress_=r=>this.trackProgress(r),this.trackCurrentTime_=r=>this.trackCurrentTime(r),this.stopTrackingCurrentTime_=r=>this.stopTrackingCurrentTime(r),this.disposeSourceHandler_=r=>this.disposeSourceHandler(r),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),rt.names.forEach(r=>{const s=rt[r];e&&e[s.getterName]&&(this[s.privateName]=e[s.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(r=>{e[`native${r}Tracks`]===!1&&(this[`featuresNative${r}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new rt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Le(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Kt(0,0)}bufferedPercent(){return Uh(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(Dt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const r=this[`${t}Tracks`]()||[];let s=r.length;for(;s--;){const n=r[s];t==="text"&&this.removeRemoteTextTrack(n),r.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const r=e[t];this.removeRemoteTextTrack(r)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new at(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Kt(0,0):Kt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Dt.names.forEach(e=>{const t=Dt[e],r=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",r),s.addEventListener("addtrack",r),this.on("dispose",()=>{s.removeEventListener("removetrack",r),s.removeEventListener("addtrack",r)})})}addWebVttScript_(){if(!R.WebVTT)if(J.body.contains(this.el())){if(!this.options_["vtt.js"]&&_r(Pl)&&Object.keys(Pl).length>0){this.trigger("vttjsloaded");return}const e=J.createElement("script");e.src=this.options_["vtt.js"]||"https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js",e.onload=()=>{this.trigger("vttjsloaded")},e.onerror=()=>{this.trigger("vttjserror")},this.on("dispose",()=>{e.onload=null,e.onerror=null}),R.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),r=o=>e.addTrack(o.track),s=o=>e.removeTrack(o.track);t.on("addtrack",r),t.on("removetrack",s),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let o=0;othis.autoRemoteTextTracks_.addTrack(r.track)),r}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Jt();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return fe.canPlayType(e.type)}static isTech(e){return e.prototype instanceof fe||e instanceof fe||e===fe}static registerTech(e,t){if(fe.techs_||(fe.techs_={}),!fe.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!fe.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!fe.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Me(e),fe.techs_[e]=t,fe.techs_[ds(e)]=t,e!=="Tech"&&fe.defaultTechOrder_.push(e),t}static getTech(e){if(!!e){if(fe.techs_&&fe.techs_[e])return fe.techs_[e];if(e=Me(e),R&&R.videojs&&R.videojs[e])return ye.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),R.videojs[e]}}}rt.names.forEach(function(i){const e=rt[i];fe.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});fe.prototype.featuresVolumeControl=!0;fe.prototype.featuresMuteControl=!0;fe.prototype.featuresFullscreenResize=!1;fe.prototype.featuresPlaybackRate=!1;fe.prototype.featuresProgressEvents=!1;fe.prototype.featuresSourceset=!1;fe.prototype.featuresTimeupdateEvents=!1;fe.prototype.featuresNativeTextTracks=!1;fe.prototype.featuresVideoFrameCallback=!1;fe.withSourceHandlers=function(i){i.registerSourceHandler=function(t,r){let s=i.sourceHandlers;s||(s=i.sourceHandlers=[]),r===void 0&&(r=s.length),s.splice(r,0,t)},i.canPlayType=function(t){const r=i.sourceHandlers||[];let s;for(let n=0;nOi(e,Ni[e.type],t,i),1)}function Kv(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function Xv(i,e,t){return i.reduceRight(du(t),e[t]())}function Yv(i,e,t,r){return e[t](i.reduce(du(t),r))}function _d(i,e,t,r=null){const s="call"+Me(t),n=i.reduce(du(s),r),a=n===In,o=a?null:e[t](n);return Zv(i,t,o,a),o}const Qv={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},Jv={setCurrentTime:1,setMuted:1,setVolume:1},vd={play:1,pause:1};function du(i){return(e,t)=>e===In?In:t[i]?t[i](e):e}function Zv(i,e,t,r){for(let s=i.length-1;s>=0;s--){const n=i[s];n[e]&&n[e](r,t)}}function ey(i){fo[i.id()]=null}function ty(i,e){const t=fo[i.id()];let r=null;if(t==null)return r=e(i),fo[i.id()]=[[e,r]],r;for(let s=0;s{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(s=>s.src===e);if(t.length)return t[0].type;const r=i.$$("source");for(let s=0;s `;class ny extends z{constructor(e,t,r){const s=we({createEl:!1},t);if(super(e,s,r),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;nthis.handleMouseOver(r),this.handleMouseOut_=r=>this.handleMouseOut(r),this.handleClick_=r=>this.handleClick(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.emitTapEvents(),this.enable()}createEl(e="div",t={},r={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ye.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),r=Object.assign({role:"button"},r),this.tabIndex_=t.tabIndex;const s=me(e,t,r);return this.player_.options_.experimentalSvgIcons||s.appendChild(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=me("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const r=this.localize(e);this.controlText_=e,Ei(this.controlTextEl_,r),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",r)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_!="undefined"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_!="undefined"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){he.isEventKey(e,"Space")||he.isEventKey(e,"Enter")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}z.registerComponent("ClickableComponent",la);class po extends la{constructor(e,t){super(e,t),this.update(),this.update_=r=>this.update(r),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return me("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e=="undefined")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(me("picture",{className:"vjs-poster",tabIndex:-1},{},me("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){!this.player_.controls()||(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?$t(this.player_.play()):this.player_.pause())}}po.prototype.crossorigin=po.prototype.crossOrigin;z.registerComponent("PosterImage",po);const At="#222",Td="#ccc",ay={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 Ha(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Jr(i,e,t){try{i.style[e]=t}catch(r){return}}function xd(i){return i?`${i}px`:""}class oy extends z{constructor(e,t,r){super(e,t,r);const s=a=>this.updateDisplay(a),n=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",s),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Le(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",n),e.on("playerresize",n);const a=R.screen.orientation||R,o=R.screen.orientation?"change":"orientationchange";a.addEventListener(o,n),e.on("dispose",()=>a.removeEventListener(o,n));const l=this.options_.playerOptions.tracks||[];for(let h=0;h.1&&(r>s?n=Math.round((e-t*s)/2):a=Math.round((t-e/s)/2)),Jr(this.el_,"insetInline",xd(n)),Jr(this.el_,"insetBlock",xd(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),r=e.activeCues;let s=r.length;for(;s--;){const n=r[s];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Jr(a.firstChild,"color",Ha(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Jr(a.firstChild,"backgroundColor",Ha(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Jr(a,"backgroundColor",Ha(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${At}, 2px 2px 4px ${At}, 2px 2px 5px ${At}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${At}, 2px 2px ${At}, 3px 3px ${At}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Td}, 0 1px ${Td}, -1px -1px ${At}, 0 -1px ${At}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${At}, 0 0 4px ${At}, 0 0 4px ${At}, 0 0 4px ${At}`)),t.fontPercent&&t.fontPercent!==1){const o=R.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=ay[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof R.WebVTT!="function"||e.every(r=>!r.activeCues))return;const t=[];for(let r=0;rthis.handleMouseDown(r))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&e.clientX&&e.clientY){$t(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const r=this.player_.getChild("controlBar"),s=r&&r.getChild("playToggle");if(!s){this.player_.tech(!0).focus();return}const n=()=>s.focus();cs(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}qh.prototype.controlText_="Play Video";z.registerComponent("BigPlayButton",qh);class ly extends Tt{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){he.isEventKey(e,"Esc")?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}z.registerComponent("CloseButton",ly);class Wh extends Tt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",r=>this.handlePlay(r)),this.on(e,"pause",r=>this.handlePause(r)),t.replay&&this.on(e,"ended",r=>this.handleEnded(r))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?$t(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}Wh.prototype.controlText_="Play";z.registerComponent("PlayToggle",Wh);class wr extends z{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended"],r=>this.updateContent(r)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),r=me("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)}\xA0`},{role:"presentation"});return t.appendChild(r),this.contentEl_=me("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}updateTextNode_(e=0){e=Ui(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,ye.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=J.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}wr.prototype.labelText_="Time";wr.prototype.controlText_="Time";z.registerComponent("TimeDisplay",wr);class cu extends wr{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}cu.prototype.labelText_="Current Time";cu.prototype.controlText_="Current Time";z.registerComponent("CurrentTimeDisplay",cu);class hu extends wr{constructor(e,t){super(e,t);const r=s=>this.updateContent(s);this.on(e,"durationchange",r),this.on(e,"loadstart",r),this.on(e,"loadedmetadata",r)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}hu.prototype.labelText_="Duration";hu.prototype.controlText_="Duration";z.registerComponent("DurationDisplay",hu);class dy extends z{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),r=super.createEl("span",{textContent:"/"});return t.appendChild(r),e.appendChild(t),e}}z.registerComponent("TimeDivider",dy);class fu extends wr{constructor(e,t){super(e,t),this.on(e,"durationchange",r=>this.updateContent(r))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(me("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}fu.prototype.labelText_="Remaining Time";fu.prototype.controlText_="Remaining Time";z.registerComponent("RemainingTimeDisplay",fu);class cy extends z{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",r=>this.updateShowing(r))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=me("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(me("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")}\xA0`})),this.contentEl_.appendChild(J.createTextNode(this.localize("LIVE"))),e.appendChild(this.contentEl_),e}dispose(){this.contentEl_=null,super.dispose()}updateShowing(e){this.player().duration()===1/0?this.show():this.hide()}}z.registerComponent("LiveDisplay",cy);class zh extends Tt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=r=>this.updateLiveEdgeStatus(r),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=me("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}zh.prototype.controlText_="Seek to live, currently playing live";z.registerComponent("SeekToLive",zh);function Ls(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var hy=Object.freeze({__proto__:null,clamp:Ls});class pu extends z{constructor(e,t){super(e,t),this.handleMouseDown_=r=>this.handleMouseDown(r),this.handleMouseUp_=r=>this.handleMouseUp(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.handleClick_=r=>this.handleClick(r),this.handleMouseMove_=r=>this.handleMouseMove(r),this.update_=r=>this.update(r),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},r={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),super.createEl(e,t,r)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Qt&&e.preventDefault(),Th(),this.addClass("vjs-sliding"),this.trigger("slideractive"),this.on(t,"mousemove",this.handleMouseMove_),this.on(t,"mouseup",this.handleMouseUp_),this.on(t,"touchmove",this.handleMouseMove_),this.on(t,"touchend",this.handleMouseUp_),this.handleMouseMove(e,!0)}handleMouseMove(e){}handleMouseUp(e){const t=this.bar.el_.ownerDocument;xh(),this.removeClass("vjs-sliding"),this.trigger("sliderinactive"),this.off(t,"mousemove",this.handleMouseMove_),this.off(t,"mouseup",this.handleMouseUp_),this.off(t,"touchmove",this.handleMouseMove_),this.off(t,"touchend",this.handleMouseUp_),this.update()}update(){if(!this.el_||!this.bar)return;const e=this.getProgress();return e===this.progress_||(this.progress_=e,this.requestNamedAnimationFrame("Slider#update",()=>{const t=this.vertical()?"height":"width";this.bar.el().style[t]=(e*100).toFixed(2)+"%"})),e}getProgress(){return Number(Ls(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=ra(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){he.isEventKey(e,"Left")||he.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepBack()):he.isEventKey(e,"Right")||he.isEventKey(e,"Up")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):super.handleKeyDown(e)}handleClick(e){e.stopPropagation(),e.preventDefault()}vertical(e){if(e===void 0)return this.vertical_||!1;this.vertical_=!!e,this.vertical_?this.addClass("vjs-slider-vertical"):this.addClass("vjs-slider-horizontal")}}z.registerComponent("Slider",pu);const Ga=(i,e)=>Ls(i/e*100,0,100).toFixed(2)+"%";class fy extends z{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",r=>this.update(r))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=me("span",{className:"vjs-control-text"}),r=me("span",{textContent:this.localize("Loaded")}),s=J.createTextNode(": ");return this.percentageEl_=me("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(r),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,r=this.player_.buffered(),s=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,o=Ga(n,s);this.percent_!==o&&(this.el_.style.width=o,Ei(this.percentageEl_,o),this.percent_=o);for(let l=0;lr.length;l--)this.el_.removeChild(a[l-1]);a.length=r.length})}}z.registerComponent("LoadProgressBar",fy);class py extends z{constructor(e,t){super(e,t),this.update=Zt(Le(this,this.update),wt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,r){const s=xs(this.el_),n=yr(this.player_.el()),a=e.width*t;if(!n||!s)return;const o=e.left-n.left+a,l=e.width-a+(n.right-e.right);let h=s.width/2;os.width&&(h=s.width),h=Math.round(h),this.el_.style.right=`-${h}px`,this.write(r)}write(e){Ei(this.el_,e)}updateTime(e,t,r,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),l=o-t*o;n=(l<1?"":"-")+Ui(l,o)}else n=Ui(r,a);this.update(e,t,n),s&&s()})}}z.registerComponent("TimeTooltip",py);class mu extends z{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Zt(Le(this,this.update),wt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const r=this.getChild("timeTooltip");if(!r)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,s)}}mu.prototype.options_={children:[]};!ot&&!Yt&&mu.prototype.options_.children.push("timeTooltip");z.registerComponent("PlayProgressBar",mu);class Kh extends z{constructor(e,t){super(e,t),this.update=Zt(Le(this,this.update),wt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,()=>{this.el_.style.left=`${e.width*t}px`})}}Kh.prototype.options_={children:["timeTooltip"]};z.registerComponent("MouseTimeDisplay",Kh);const un=5,bd=12;class gu extends pu{constructor(e,t){super(e,t),this.setEventHandlers_()}setEventHandlers_(){this.update_=Le(this,this.update),this.update=Zt(this.update_,wt),this.on(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in J&&"visibilityState"in J&&this.on(J,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){J.visibilityState==="hidden"?(this.cancelNamedAnimationFrame("SeekBar#update"),this.cancelNamedAnimationFrame("Slider#update"),this.disableInterval_(e)):(!this.player_.ended()&&!this.player_.paused()&&this.enableInterval_(),this.update())}enableInterval_(){this.updateInterval||(this.updateInterval=this.setInterval(this.update,wt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||!this.updateInterval||(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(J.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const r=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker;let n=this.player_.duration();s&&s.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==r||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Ui(r,n),Ui(n,n)],"{1} of {2}")),this.currentTime_=r,this.duration_=n),this.bar&&this.bar.update(yr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){const e=this.getCurrentTime_();let t;const r=this.player_.liveTracker;return r&&r.isLive()?(t=(e-r.seekableStart())/r.liveWindow(),r.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){!bs(e)||(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!bs(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let r;const s=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())r=s*this.player_.duration(),r===this.player_.duration()&&(r=r-.1);else{if(s>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),o=n.liveCurrentTime();if(r=a+s*n.liveWindow(),r>=o&&(r=o),r<=a&&(r=a+.1),r===1/0)return}this.userSeek_(r)}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");!e||e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");!e||e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?$t(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+un)}stepBack(){this.userSeek_(this.player_.currentTime()-un)}handleAction(e){this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(he.isEventKey(e,"Space")||he.isEventKey(e,"Enter"))e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(he.isEventKey(e,"Home"))e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(he.isEventKey(e,"End"))e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(he(e))){e.preventDefault(),e.stopPropagation();const r=(he.codes[he(e)]-he.codes[0])*10/100;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else he.isEventKey(e,"PgDn")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-un*bd)):he.isEventKey(e,"PgUp")?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+un*bd)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["ended","durationchange","timeupdate"],this.update),this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.update),this.off(this.player_,["playing"],this.enableIntervalHandler_),this.off(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in J&&"visibilityState"in J&&this.off(J,"visibilitychange",this.toggleVisibility_),super.dispose()}}gu.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};!ot&&!Yt&&gu.prototype.options_.children.splice(1,0,"mouseTimeDisplay");z.registerComponent("SeekBar",gu);class Xh extends z{constructor(e,t){super(e,t),this.handleMouseMove=Zt(Le(this,this.handleMouseMove),wt),this.throttledHandleMouseSeek=Zt(Le(this,this.handleMouseSeek),wt),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.handleMouseDownHandler_=r=>this.handleMouseDown(r),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const r=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!r&&!s)return;const n=t.el(),a=xs(n);let o=ra(n,e).x;o=Ls(o,0,1),s&&s.update(a,o),r&&r.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,"mousemove",this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&$t(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,"mousemove",this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,r=this.getChild("seekBar");r&&r.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Xh.prototype.options_={children:["seekBar"]};z.registerComponent("ProgressControl",Xh);class Yh extends Tt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],r=>this.handlePictureInPictureChange(r)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],r=>this.handlePictureInPictureEnabledChange(r)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){J.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in R?this.enable():this.disable()}handlePictureInPictureChange(e){this.player_.isInPictureInPicture()?(this.setIcon("picture-in-picture-exit"),this.controlText("Exit Picture-in-Picture")):(this.setIcon("picture-in-picture-enter"),this.controlText("Picture-in-Picture")),this.handlePictureInPictureEnabledChange()}handleClick(e){this.player_.isInPictureInPicture()?this.player_.exitPictureInPicture():this.player_.requestPictureInPicture()}show(){typeof J.exitPictureInPicture=="function"&&super.show()}}Yh.prototype.controlText_="Picture-in-Picture";z.registerComponent("PictureInPictureToggle",Yh);class Qh extends Tt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",r=>this.handleFullscreenChange(r)),J[e.fsApi_.fullscreenEnabled]===!1&&this.disable()}buildCSSClass(){return`vjs-fullscreen-control ${super.buildCSSClass()}`}handleFullscreenChange(e){this.player_.isFullscreen()?(this.controlText("Exit Fullscreen"),this.setIcon("fullscreen-exit")):(this.controlText("Fullscreen"),this.setIcon("fullscreen-enter"))}handleClick(e){this.player_.isFullscreen()?this.player_.exitFullscreen():this.player_.requestFullscreen()}}Qh.prototype.controlText_="Fullscreen";z.registerComponent("FullscreenToggle",Qh);const my=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class gy extends z{createEl(){const e=super.createEl("div",{className:"vjs-volume-level"});return this.setIcon("circle",e),e.appendChild(super.createEl("span",{className:"vjs-control-text"})),e}}z.registerComponent("VolumeLevel",gy);class _y extends z{constructor(e,t){super(e,t),this.update=Zt(Le(this,this.update),wt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,r,s){if(!r){const n=yr(this.el_),a=yr(this.player_.el()),o=e.width*t;if(!a||!n)return;const l=e.left-a.left+o,h=e.width-o+(a.right-e.right);let c=n.width/2;ln.width&&(c=n.width),this.el_.style.right=`-${c}px`}this.write(`${s}%`)}write(e){Ei(this.el_,e)}updateVolume(e,t,r,s,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,r,s.toFixed(0)),n&&n()})}}z.registerComponent("VolumeLevelTooltip",_y);class Jh extends z{constructor(e,t){super(e,t),this.update=Zt(Le(this,this.update),wt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,r){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,r,s,()=>{r?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}Jh.prototype.options_={children:["volumeLevelTooltip"]};z.registerComponent("MouseVolumeLevelDisplay",Jh);class da extends pu{constructor(e,t){super(e,t),this.on("slideractive",r=>this.updateLastVolume_(r)),this.on(e,"volumechange",r=>this.updateARIAAttributes(r)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){!bs(e)||super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const r=this.el(),s=yr(r),n=this.vertical();let a=ra(r,e);a=n?a.y:a.x,a=Ls(a,0,1),t.update(s,a,n)}!bs(e)||(this.checkMuted(),this.player_.volume(this.calculateDistance(e)))}checkMuted(){this.player_.muted()&&this.player_.muted(!1)}getPercent(){return this.player_.muted()?0:this.player_.volume()}stepForward(){this.checkMuted(),this.player_.volume(this.player_.volume()+.1)}stepBack(){this.checkMuted(),this.player_.volume(this.player_.volume()-.1)}updateARIAAttributes(e){const t=this.player_.muted()?0:this.volumeAsPercentage_();this.el_.setAttribute("aria-valuenow",t),this.el_.setAttribute("aria-valuetext",t+"%")}volumeAsPercentage_(){return Math.round(this.player_.volume()*100)}updateLastVolume_(){const e=this.player_.volume();this.one("sliderinactive",()=>{this.player_.volume()===0&&this.player_.lastVolume_(e)})}}da.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!ot&&!Yt&&da.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");da.prototype.playerEvent="volumechange";z.registerComponent("VolumeBar",da);class Zh extends z{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar=="undefined"||_r(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),my(this,e),this.throttledHandleMouseMove=Zt(Le(this,this.handleMouseMove),wt),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.on("mousedown",r=>this.handleMouseDown(r)),this.on("touchstart",r=>this.handleMouseDown(r)),this.on("mousemove",r=>this.handleMouseMove(r)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}Zh.prototype.options_={children:["volumeBar"]};z.registerComponent("VolumeControl",Zh);const vy=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class ef extends Tt{constructor(e,t){super(e,t),vy(this,e),this.on(e,["loadstart","volumechange"],r=>this.update(r))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),r=this.player_.lastVolume_();if(t===0){const s=r<.1?.1:r;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),ot&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),ta(this.el_,[0,1,2,3].reduce((r,s)=>r+`${s?" ":""}vjs-vol-${s}`,"")),Bi(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}ef.prototype.controlText_="Mute";z.registerComponent("MuteToggle",ef);class tf extends z{constructor(e,t={}){typeof t.inline!="undefined"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl=="undefined"||_r(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=r=>this.handleKeyPress(r),this.on(e,["loadstart"],r=>this.volumePanelState_(r)),this.on(this.muteToggle,"keyup",r=>this.handleKeyPress(r)),this.on(this.volumeControl,"keyup",r=>this.handleVolumeControlKeyUp(r)),this.on("keydown",r=>this.handleKeyPress(r)),this.on("mouseover",r=>this.handleMouseOver(r)),this.on("mouseout",r=>this.handleMouseOut(r)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){he.isEventKey(e,"Esc")&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),xt(J,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),Qe(J,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){he.isEventKey(e,"Esc")&&this.handleMouseOut()}}tf.prototype.options_={children:["muteToggle","volumeControl"]};z.registerComponent("VolumePanel",tf);class yy extends Tt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),r=this.player_.liveTracker,s=r&&r.isLive()?r.seekableEnd():this.player_.duration();let n;t+this.skipTime<=s?n=t+this.skipTime:n=s,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}z.registerComponent("SkipForward",yy);class rf extends Tt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),r=this.player_.liveTracker,s=r&&r.isLive()&&r.seekableStart();let n;s&&t-this.skipTime<=s?n=s:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}rf.prototype.controlText_="Skip Backward";z.registerComponent("SkipBackward",rf);class sf extends z{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",r=>this.handleKeyDown(r)),this.boundHandleBlur_=r=>this.handleBlur(r),this.boundHandleTapClick_=r=>this.handleTapClick(r)}addEventListenerForItem(e){e instanceof z&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof z&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=me(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),xt(t,"click",function(r){r.preventDefault(),r.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||J.activeElement;if(!this.children().some(r=>r.el()===t)){const r=this.menuButton_;r&&r.buttonPressed_&&t!==r.el().firstChild&&r.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const r=t.filter(s=>s.el()===e.target)[0];if(!r)return;r.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){he.isEventKey(e,"Left")||he.isEventKey(e,"Down")?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(he.isEventKey(e,"Right")||he.isEventKey(e,"Up"))&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}z.registerComponent("Menu",sf);class _u extends z{constructor(e,t={}){super(e,t),this.menuButton_=new Tt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const r=Tt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+r,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const s=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),xt(J,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",n=>this.handleMouseLeave(n)),this.on("keydown",n=>this.handleSubmenuKeyDown(n))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new sf(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=me("li",{className:"vjs-menu-title",textContent:Me(this.options_.title),tabIndex:-1}),r=new z(this.player_,{el:t});e.addItem(r)}if(this.items=this.createItems(),this.items)for(let t=0;the.isEventKey(e,t))||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}z.registerComponent("MenuItem",Is);class ks extends Is{constructor(e,t){const r=t.track,s=e.textTracks();t.label=r.label||r.language||"Unknown",t.selected=r.mode==="showing",super(e,t),this.track=r,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const n=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],n),s.addEventListener("change",n),s.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],n),s.removeEventListener("change",n),s.removeEventListener("selectedlanguagechange",a)}),s.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof R.Event!="object")try{o=new R.Event("change")}catch(l){}o||(o=J.createEvent("Event"),o.initEvent("change",!0,!0)),s.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,r=this.player_.textTracks();if(super.handleClick(e),!!r)for(let s=0;s-1&&a.mode==="showing"){r=!1;break}}r!==this.isSelected_&&this.selected(r)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let r=!0;for(let s=0,n=t.length;s-1&&a.mode==="showing"){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}z.registerComponent("OffTextTrackMenuItem",nf);class Lr extends vu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=ks){let r;this.label_&&(r=`${this.label_} off`),e.push(new nf(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let n=0;n-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}z.registerComponent("TextTrackButton",Lr);class af extends Is{constructor(e,t){const r=t.track,s=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=n&&n{this.items.forEach(s=>{s.selected(this.track_.activeCues[0]===s.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const r=e[t];if(r.kind===this.kind_)return r}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Me(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let r=0,s=t.length;r-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(Me(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new bu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,of),e}}Su.prototype.kinds_=["captions","subtitles"];Su.prototype.controlText_="Subtitles";z.registerComponent("SubsCapsButton",Su);class uf extends Is{constructor(e,t){const r=t.track,s=e.audioTracks();t.label=r.label||r.language||"Unknown",t.selected=r.enabled,super(e,t),this.track=r,this.addClass(`vjs-${r.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};s.addEventListener("change",n),this.on("dispose",()=>{s.removeEventListener("change",n)})}createEl(e,t,r){const s=super.createEl(e,t,r),n=s.querySelector(".vjs-menu-item-text");return["main-desc","description"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(me("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let r=0;rthis.update(n))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}Cu.prototype.contentElType="button";z.registerComponent("PlaybackRateMenuItem",Cu);class df extends _u{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",r=>this.updateVisibility(r)),this.on(e,"ratechange",r=>this.updateLabel(r)),this.on(e,"playbackrateschange",r=>this.handlePlaybackRateschange(r))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=me("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let r=e.length-1;r>=0;r--)t.push(new Cu(this.player(),{rate:e[r]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}df.prototype.controlText_="Playback Rate";z.registerComponent("PlaybackRateMenuButton",df);class cf extends z{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},r={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,r)}}z.registerComponent("Spacer",cf);class xy extends cf{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:"\xA0"})}}z.registerComponent("CustomControlSpacer",xy);class hf extends z{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}hf.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};z.registerComponent("ControlBar",hf);class ff extends Dr{constructor(e,t){super(e,t),this.on(e,"error",r=>this.open(r))}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}ff.prototype.options_=Object.assign({},Dr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});z.registerComponent("ErrorDisplay",ff);const qa="vjs-text-track-settings",Ed=["#000","Black"],Sd=["#00F","Blue"],Cd=["#0FF","Cyan"],Ad=["#0F0","Green"],Dd=["#F0F","Magenta"],wd=["#F00","Red"],Ld=["#FFF","White"],Id=["#FF0","Yellow"],Wa=["1","Opaque"],za=["0.5","Semi-Transparent"],kd=["0","Transparent"],Pi={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Ed,Ld,wd,Ad,Sd,Id,Dd,Cd]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Wa,za,kd]},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[Ld,Ed,wd,Ad,Sd,Id,Dd,Cd]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},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:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Wa,za]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[kd,za,Wa]}};Pi.windowColor.options=Pi.backgroundColor.options;function pf(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function by(i,e){const t=i.options[i.options.selectedIndex].value;return pf(t,e)}function Ey(i,e,t){if(!!e){for(let r=0;r{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),nr(Pi,r=>{this.on(this.$(r.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",r="label"){const s=Pi[e],n=s.id.replace("%s",this.id_),a=[t,n].join(" ").trim();return[`<${r} id="${n}" class="${r==="label"?"vjs-label":""}">`,this.localize(s.label),``,`").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['
',``,this.localize("Text"),"",'',this.createElSelect_("color",e),"",'',this.createElSelect_("textOpacity",e),"","
"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['
',``,this.localize("Text Background"),"",'',this.createElSelect_("backgroundColor",e),"",'',this.createElSelect_("backgroundOpacity",e),"","
"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['
',``,this.localize("Caption Area Background"),"",'',this.createElSelect_("windowColor",e),"",'',this.createElSelect_("windowOpacity",e),"","
"].join("")}createElColors_(){return me("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return me("div",{className:"vjs-track-settings-font",innerHTML:['
',this.createElSelect_("fontPercent","","legend"),"
",'
',this.createElSelect_("edgeStyle","","legend"),"
",'
',this.createElSelect_("fontFamily","","legend"),"
"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return me("div",{className:"vjs-track-settings-controls",innerHTML:[`",``].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return lh(Pi,(e,t,r)=>{const s=by(this.$(t.selector),t.parser);return s!==void 0&&(e[r]=s),e},{})}setValues(e){nr(Pi,(t,r)=>{Ey(this.$(t.selector),e[r],t.parser)})}setDefaults(){nr(Pi,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(R.localStorage.getItem(qa))}catch(t){ye.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?R.localStorage.setItem(qa,JSON.stringify(e)):R.localStorage.removeItem(qa)}catch(t){ye.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,t=e&&e.subsCapsButton,r=e&&e.captionsButton;t?t.focus():r&&r.focus()}handleLanguagechange(){this.fill()}}z.registerComponent("TextTrackSettings",Sy);class Cy extends z{constructor(e,t){let r=t.ResizeObserver||R.ResizeObserver;t.ResizeObserver===null&&(r=!1);const s=we({createEl:!r,reportTouchActivity:!1},t);super(e,s),this.ResizeObserver=t.ResizeObserver||R.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=kh(()=>{this.resizeHandler()},100,!1,this),r?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){Qe(this,"resize",n),Qe(this,"unload",a),a=null};xt(this.el_.contentWindow,"unload",a),xt(this.el_.contentWindow,"resize",n)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}z.registerComponent("ResizeManager",Cy);const Ay={trackingThreshold:20,liveTolerance:15};class Dy extends z{constructor(e,t){const r=we(Ay,t,{createEl:!1});super(e,r),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=s=>this.handlePlay(s),this.handleFirstTimeupdate_=s=>this.handleFirstTimeupdate(s),this.handleSeeked_=s=>this.handleSeeked(s),this.seekToLiveEdge_=s=>this.seekToLiveEdge(s),this.reset_(),this.on(this.player_,"durationchange",s=>this.handleDurationchange(s)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(R.performance.now().toFixed(4)),r=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+r;const s=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||s===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,wt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){!this.isTracking()||(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.end(r));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.start(r));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}z.registerComponent("LiveTracker",Dy);class wy extends z{constructor(e,t){super(e,t),this.on("statechanged",r=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:me("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Jt()}`}),description:me("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Jt()}`})},me("div",{className:"vjs-title-bar"},{},dh(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(s=>{const n=this.state[s],a=this.els[s],o=r[s];sa(a),n&&Ei(a,n),t&&(t.removeAttribute(o),n&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}z.registerComponent("TitleBar",wy);const mo=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),r=[];let s="";if(!t.length)return!1;for(let n=0;n{let t={};for(let r=0;rmf([i.el(),R.HTMLMediaElement.prototype,R.Element.prototype,Ly],"innerHTML"),Od=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},r=Iy(i),s=n=>(...a)=>{const o=n.apply(e,a);return mo(i),o};["append","appendChild","insertAdjacentHTML"].forEach(n=>{!e[n]||(t[n]=e[n],e[n]=s(t[n]))}),Object.defineProperty(e,"innerHTML",we(r,{set:s(r.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",r)},i.one("sourceset",e.resetSourceWatch_)},ky=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Vh(R.Element.prototype.getAttribute.call(this,"src")):""},set(i){return R.Element.prototype.setAttribute.call(this,"src",i),i}}),Oy=i=>mf([i.el(),R.HTMLMediaElement.prototype,ky],"src"),Py=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=Oy(i),r=e.setAttribute,s=e.load;Object.defineProperty(e,"src",we(t,{set:n=>{const a=t.set.call(e,n);return i.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const o=r.call(e,n,a);return/src/i.test(n)&&i.triggerSourceset(e.src),o},e.load=()=>{const n=s.call(e);return mo(i)||(i.triggerSourceset(""),Od(i)),n},e.currentSrc?i.triggerSourceset(e.currentSrc):mo(i)||Od(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=s,e.setAttribute=r,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class te extends fe{constructor(e,t){super(e,t);const r=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",r&&(this.el_.currentSrc!==r.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(r):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const o=[];for(;a--;){const l=n[a];l.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(l),this.remoteTextTracks().addTrack(l.track),this.textTracks().addTrack(l.track),!s&&!this.el_.hasAttribute("crossorigin")&&ua(l.src)&&(s=!0)):o.push(l))}for(let l=0;l{t=[];for(let n=0;ne.removeEventListener("change",r));const s=()=>{for(let n=0;n{e.removeEventListener("change",r),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",r),e.addEventListener("change",r),e.removeEventListener("change",s)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const r=e.toLowerCase();this[`${r}TracksListeners_`]&&Object.keys(this[`${r}TracksListeners_`]).forEach(s=>{this.el()[`${r}Tracks`].removeEventListener(s,this[`${r}TracksListeners_`][s])}),this[`featuresNative${e}Tracks`]=!t,this[`${r}TracksListeners_`]=null,this.proxyNativeTracksForType_(r)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Dt[e],r=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!r||!r.addEventListener)return;const n={change:o=>{const l={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(l),e==="text"&&this[br.remoteText.getterName]().trigger(l)},addtrack(o){s.addTrack(o.track)},removetrack(o){s.removeTrack(o.track)}},a=function(){const o=[];for(let l=0;l{const l=n[o];r.addEventListener(o,l),this.on("dispose",h=>r.removeEventListener(o,l))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Dt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const r=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(r,e),te.disposeMediaElement(e),e=r}else{e=J.createElement("video");const r=this.options_.tag&&vi(this.options_.tag),s=we({},r);(!Ts||this.options_.nativeControlsForTouch!==!0)&&delete s.controls,vh(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload!="undefined"&&vr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let r=0;r=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(r){this.trigger(r)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ea?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){ye(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Yt&&Qt&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)$t(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}reset(){te.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,r):super.addTextTrack(e,t,r)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=J.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}addRemoteTextTrack(e,t){const r=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let r=t.length;for(;r--;)(e===t[r]||e===t[r].track)&&this.el().removeChild(t[r])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount!="undefined"&&typeof this.el().webkitDecodedFrameCount!="undefined"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),R.performance&&(e.creationTime=R.performance.now()),e}}Yn(te,"TEST_VID",function(){if(!Sr())return;const i=J.createElement("video"),e=J.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i});te.isSupported=function(){try{te.TEST_VID.volume=.5}catch(i){return!1}return!!(te.TEST_VID&&te.TEST_VID.canPlayType)};te.canPlayType=function(i){return te.TEST_VID.canPlayType(i)};te.canPlaySource=function(i,e){return te.canPlayType(i.type)};te.canControlVolume=function(){try{const i=te.TEST_VID.volume;te.TEST_VID.volume=i/2+.1;const e=i!==te.TEST_VID.volume;return e&&ot?(R.setTimeout(()=>{te&&te.prototype&&(te.prototype.featuresVolumeControl=i!==te.TEST_VID.volume)}),!1):e}catch(i){return!1}};te.canMuteVolume=function(){try{const i=te.TEST_VID.muted;return te.TEST_VID.muted=!i,te.TEST_VID.muted?vr(te.TEST_VID,"muted","muted"):ia(te.TEST_VID,"muted","muted"),i!==te.TEST_VID.muted}catch(i){return!1}};te.canControlPlaybackRate=function(){if(Yt&&Qt&&Qn<58)return!1;try{const i=te.TEST_VID.playbackRate;return te.TEST_VID.playbackRate=i/2+.1,i!==te.TEST_VID.playbackRate}catch(i){return!1}};te.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(J.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(J.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(J.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(J.createElement("audio"),"innerHTML",{get:i,set:i})}catch(i){return!1}return!0};te.supportsNativeTextTracks=function(){return ea||ot&&Qt};te.supportsNativeVideoTracks=function(){return!!(te.TEST_VID&&te.TEST_VID.videoTracks)};te.supportsNativeAudioTracks=function(){return!!(te.TEST_VID&&te.TEST_VID.audioTracks)};te.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([i,e]){Yn(te.prototype,i,()=>te[e](),!0)});te.prototype.featuresVolumeControl=te.canControlVolume();te.prototype.movingMediaElementInDOM=!ot;te.prototype.featuresFullscreenResize=!0;te.prototype.featuresProgressEvents=!0;te.prototype.featuresTimeupdateEvents=!0;te.prototype.featuresVideoFrameCallback=!!(te.TEST_VID&&te.TEST_VID.requestVideoFrameCallback);te.disposeMediaElement=function(i){if(!!i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch(e){}}()}};te.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch(r){}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){te.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){te.prototype["set"+Me(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){te.prototype[i]=function(){return this.el_[i]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){te.prototype["set"+Me(i)]=function(e){this.el_[i]=e}});["pause","load","play"].forEach(function(i){te.prototype[i]=function(){return this.el_[i]()}});fe.withSourceHandlers(te);te.nativeSourceHandler={};te.nativeSourceHandler.canPlayType=function(i){try{return te.TEST_VID.canPlayType(i)}catch(e){return""}};te.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return te.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=lu(i.src);return te.nativeSourceHandler.canPlayType(`video/${t}`)}return""};te.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)};te.nativeSourceHandler.dispose=function(){};te.registerSourceHandler(te.nativeSourceHandler);fe.registerTech("Html5",te);const gf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ka={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},go=["tiny","xsmall","small","medium","large","xlarge","huge"],pn={};go.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;pn[i]=`vjs-layout-${e}`});const Ry={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ie extends z{constructor(e,t,r){if(e.id=e.id||t.id||`vjs_video_${Jt()}`,t=Object.assign(Ie.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,r),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.isFullscreen_=!1,this.log=oh(this.id_),this.fsApi_=Cn,this.isPosterFromTech_=!1,this.queuedCallbacks_=[],this.isReady_=!1,this.hasStarted_=!1,this.userActive_=!1,this.debugEnabled_=!1,this.audioOnlyMode_=!1,this.audioPosterMode_=!1,this.audioOnlyCache_={playerHeight:null,hiddenChildren:[]},!this.options_||!this.options_.techOrder||!this.options_.techOrder.length)throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");if(this.tag=e,this.tagAttributes=e&&vi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ie.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),nu(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(xt(J,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=we(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const o=new R.DOMParser().parseFromString(sy,"image/svg+xml");if(o.querySelector("parsererror"))ye.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const h=o.documentElement;h.style.display="none",this.el_.appendChild(h),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),Ts&&this.addClass("vjs-touch-enabled"),ot||this.addClass("vjs-workinghover"),Ie.players[this.id_]=this;const n=nh.split(".")[0];this.addClass(`vjs-v${n}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),Qe(J,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),Qe(J,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ie.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),ey(this),rt.names.forEach(e=>{const t=rt[e],r=this[t.getterName]();r&&r.off&&r.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const s=this.tag.tagName.toLowerCase()==="video-js";r?t=this.el_=e.parentNode:s||(t=this.el_=super.createEl("div"));const n=vi(e);if(s){for(t=this.el_=e,e=this.tag=J.createElement("video");t.children.length;)e.appendChild(t.firstChild);ls(t,"video-js")||Bi(t,"video-js"),t.appendChild(e),r=this.playerElIngest_=t,Object.keys(t).forEach(o=>{try{e[o]=t[o]}catch(l){}})}if(e.setAttribute("tabindex","-1"),n.tabindex="-1",Qt&&Jn&&(e.setAttribute("role","application"),n.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in n&&delete n.width,"height"in n&&delete n.height,Object.getOwnPropertyNames(n).forEach(function(o){s&&o==="class"||t.setAttribute(o,n[o]),s&&e.setAttribute(o,n[o])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused"),R.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Lh("vjs-styles-dimensions");const o=Ti(".vjs-styles-defaults"),l=Ti("head");l.insertBefore(this.styleEl_,o?o.nextSibling:l.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);const a=e.getElementsByTagName("a");for(let o=0;o{this.on(["playerreset","resize"],this.boundUpdateStyleEl_)})):this.removeClass("vjs-fluid"),this.updateStyleEl_()}fill(e){if(e===void 0)return!!this.fill_;this.fill_=!!e,e?(this.addClass("vjs-fill"),this.fluid(!1)):this.removeClass("vjs-fill")}aspectRatio(e){if(e===void 0)return this.aspectRatio_;if(!/^\d+\:\d+$/.test(e))throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");this.aspectRatio_=e,this.fluid(!0),this.updateStyleEl_()}updateStyleEl_(){if(R.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,l=typeof this.height_=="number"?this.height_:this.options_.height,h=this.tech_&&this.tech_.el();h&&(o>=0&&(h.width=o),l>=0&&(h.height=l));return}let e,t,r,s;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?r=this.aspectRatio_:this.videoWidth()>0?r=this.videoWidth()+":"+this.videoHeight():r="16:9";const n=r.split(":"),a=n[1]/n[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?s="dimensions-"+this.id():s=this.id()+"-dimensions",this.addClass(s),Ih(this.styleEl_,` .${s} { width: ${e}px; height: ${t}px; } .${s}.vjs-fluid:not(.vjs-audio-only-mode) { padding-top: ${a*100}%; } `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=Me(e),s=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(fe.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let n=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(n=!1);const a={source:t,autoplay:n,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};rt.names.forEach(l=>{const h=rt[l];a[h.getterName]=this[h.privateName]}),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[s]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const o=fe.getTech(e);if(!o)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Le(this,this.handleTechReady_),!0),fd.jsonToTextTracks(this.textTracksJson_||[],this.tech_),gf.forEach(l=>{this.on(this.tech_,l,h=>this[`handleTech${Me(l)}_`](h))}),Object.keys(Ka).forEach(l=>{this.on(this.tech_,l,h=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Ka[l]}_`].bind(this),event:h});return}this[`handleTech${Ka[l]}_`](h)})}),this.on(this.tech_,"loadstart",l=>this.handleTechLoadStart_(l)),this.on(this.tech_,"sourceset",l=>this.handleTechSourceset_(l)),this.on(this.tech_,"waiting",l=>this.handleTechWaiting_(l)),this.on(this.tech_,"ended",l=>this.handleTechEnded_(l)),this.on(this.tech_,"seeking",l=>this.handleTechSeeking_(l)),this.on(this.tech_,"play",l=>this.handleTechPlay_(l)),this.on(this.tech_,"pause",l=>this.handleTechPause_(l)),this.on(this.tech_,"durationchange",l=>this.handleTechDurationChange_(l)),this.on(this.tech_,"fullscreenchange",(l,h)=>this.handleTechFullscreenChange_(l,h)),this.on(this.tech_,"fullscreenerror",(l,h)=>this.handleTechFullscreenError_(l,h)),this.on(this.tech_,"enterpictureinpicture",l=>this.handleTechEnterPictureInPicture_(l)),this.on(this.tech_,"leavepictureinpicture",l=>this.handleTechLeavePictureInPicture_(l)),this.on(this.tech_,"error",l=>this.handleTechError_(l)),this.on(this.tech_,"posterchange",l=>this.handleTechPosterChange_(l)),this.on(this.tech_,"textdata",l=>this.handleTechTextData_(l)),this.on(this.tech_,"ratechange",l=>this.handleTechRateChange_(l)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&ao(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){rt.names.forEach(e=>{const t=rt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=fd.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&ye.warn(`Using the tech directly can be dangerous. I hope you know what you're doing. See https://github.com/videojs/video.js/issues/2617 for more info. `),this.tech_}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const s=this.muted();this.muted(!0);const n=()=>{this.muted(s)};this.playTerminatedQueue_.push(n);const a=this.play();if(!!cs(a))return a.catch(o=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),cs(r)&&(r=r.catch(t))):e==="muted"&&!this.muted()?r=t():r=this.play(),!!cs(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,r="";typeof t!="string"&&(t=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!r&&(r=ry(this,t)),this.cache_.source=we({},e,{src:t,type:r});const s=this.cache_.sources.filter(l=>l.src&&l.src===t),n=[],a=this.$$("source"),o=[];for(let l=0;lthis.updateSourceCaches_(n);const r=this.currentSource().src,s=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==r)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],n=>{if(n.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){!this.controls_||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?$t(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),r=>r.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const r=this.el();let s=J[this.fsApi_.fullscreenElement]===r;!s&&r.matches&&(s=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();this.error(e)}handleTechTextData_(){let e=null;arguments.length>1&&(e=arguments[1]),this.trigger("textdata",e)}getCache(){return this.cache_}resetCache_(){this.cache_={currentTime:0,initTime:0,inactivityTimeout:this.options_.inactivityTimeout,duration:NaN,lastVolume:1,lastPlaybackRate:this.defaultPlaybackRate(),media:null,src:"",source:{},sources:[],playbackRates:[],volume:1}}techCall_(e,t){this.ready(function(){if(e in Jv)return Yv(this.middleware_,this.tech_,e,t);if(e in vd)return _d(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(r){throw ye(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in Qv)return Xv(this.middleware_,this.tech_,e);if(e in vd)return _d(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ye(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ye(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ye(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=$t){this.playCallbacks_.push(e);const t=Boolean(!this.changingSrc_&&(this.src()||this.currentSrc())),r=Boolean(ea||ot);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&r&&this.load();return}const s=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),s===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Kt(0,0)}scrubbing(e){if(typeof e=="undefined")return this.scrubbing_;this.scrubbing_=!!e,this.techCall_("setScrubbing",this.scrubbing_),e?this.addClass("vjs-scrubbing"):this.removeClass("vjs-scrubbing")}currentTime(e){if(e===void 0)return this.cache_.currentTime=this.techGet_("currentTime")||0,this.cache_.currentTime;if(e<0&&(e=0),!this.isReady_||this.changingSrc_||!this.tech_||!this.tech_.isReady_){this.cache_.initTime=e,this.off("canplay",this.boundApplyInitTime_),this.one("canplay",this.boundApplyInitTime_);return}this.techCall_("setCurrentTime",e),this.cache_.initTime=0,isFinite(e)&&(this.cache_.currentTime=Number(e))}applyInitTime_(){this.currentTime(this.cache_.initTime)}duration(e){if(e===void 0)return this.cache_.duration!==void 0?this.cache_.duration:NaN;e=parseFloat(e),e<0&&(e=1/0),e!==this.cache_.duration&&(this.cache_.duration=e,e===1/0?this.addClass("vjs-live"):this.removeClass("vjs-live"),isNaN(e)||this.trigger("durationchange"))}remainingTime(){return this.duration()-this.currentTime()}remainingTimeDisplay(){return Math.floor(this.duration())-Math.floor(this.currentTime())}buffered(){let e=this.techGet_("buffered");return(!e||!e.length)&&(e=Kt(0,0)),e}bufferedPercent(){return Uh(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let r=e.end(e.length-1);return r>t&&(r=t),r}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=Boolean(e),this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((r,s)=>{function n(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){n(),r()}function o(h,c){n(),s(c)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const l=t.requestFullscreenHelper_(e);l&&(l.then(n,n),l.then(r,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](t);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,r)=>{function s(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){s(),t()}function a(l,h){s(),r(h)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(s,s),o.then(t,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=J[this.fsApi_.exitFullscreen]();return e&&$t(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=J.documentElement.style.overflow,xt(J,"keydown",this.boundFullWindowOnEscKey_),J.documentElement.style.overflow="hidden",Bi(J.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){he.isEventKey(e,"Esc")&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,Qe(J,"keydown",this.boundFullWindowOnEscKey_),J.documentElement.style.overflow=this.docOrigOverflow,ta(J.body,"vjs-full-window"),this.trigger("exitFullWindow")}disablePictureInPicture(e){if(e===void 0)return this.techGet_("disablePictureInPicture");this.techCall_("setDisablePictureInPicture",e),this.options_.disablePictureInPicture=e,this.trigger("disablepictureinpicturechanged")}isInPictureInPicture(e){if(e!==void 0){this.isInPictureInPicture_=!!e,this.togglePictureInPictureClass_();return}return!!this.isInPictureInPicture_}requestPictureInPicture(){if(this.options_.enableDocumentPictureInPicture&&R.documentPictureInPicture){const e=J.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(me("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),R.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Ah(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger("enterpictureinpicture"),t.addEventListener("pagehide",r=>{const s=r.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in J&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(R.documentPictureInPicture&&R.documentPictureInPicture.window)return R.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in J)return J.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(s=>{const n=s.tagName.toLowerCase();if(s.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return n==="input"?a.indexOf(s.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=a=>he.isEventKey(a,"f"),muteKey:s=a=>he.isEventKey(a,"m"),playPauseKey:n=a=>he.isEventKey(a,"k")||he.isEventKey(a,"Space")}=t;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const a=z.getComponent("FullscreenToggle");J[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),z.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),z.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let r=0,s=this.options_.techOrder;r[o,fe.getTech(o)]).filter(([o,l])=>l?l.isSupported():(ye.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(o,l,h){let c;return o.some(p=>l.some(_=>{if(c=h(p,_),c)return!0})),c};let s;const n=o=>(l,h)=>o(h,l),a=([o,l],h)=>{if(l.canPlaySource(h,this.options_[o.toLowerCase()]))return{source:h,tech:o}};return this.options_.sourceOrder?s=r(e,t,n(a)):s=r(t,e,a),s||!1}handleSrc_(e,t){if(typeof e=="undefined")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Gh(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),zv(this,r[0],(s,n)=>{if(this.middleware_=n,t||(this.cache_.sources=r),this.updateSourceCaches_(s),this.src_(s)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}Kv(n,this.tech_)}),r.length>1){const s=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},n=()=>{this.off("error",s)};this.one("error",s),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",s),this.off("playing",n)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Mh(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();$t(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),oi(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:r,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:n}=r||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),n&&(n.update(),n.loadProgressBar&&n.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t=="undefined"?this.options_.autoplay:t,this.tech_&&this.techCall_("setAutoplay",t)}playsinline(e){return e!==void 0&&(this.techCall_("setPlaysinline",e),this.options_.playsinline=e),this.techGet_("playsinline")}loop(e){if(e!==void 0){this.techCall_("setLoop",e),this.options_.loop=e;return}return this.techGet_("loop")}poster(e){if(e===void 0)return this.poster_;e||(e=""),e!==this.poster_&&(this.poster_=e,this.techCall_("setPoster",e),this.isPosterFromTech_=!1,this.trigger("posterchange"))}handleTechPosterChange_(){if((!this.poster_||this.options_.techCanOverridePoster)&&this.tech_&&this.tech_.poster){const e=this.tech_.poster()||"";e!==this.poster_&&(this.poster_=e,this.isPosterFromTech_=!0,this.trigger("posterchange"))}}controls(e){if(e===void 0)return!!this.controls_;e=!!e,this.controls_!==e&&(this.controls_=e,this.usingNativeControls()&&this.techCall_("setControls",e),this.controls_?(this.removeClass("vjs-controls-disabled"),this.addClass("vjs-controls-enabled"),this.trigger("controlsenabled"),this.usingNativeControls()||this.addTechControlsListeners_()):(this.removeClass("vjs-controls-enabled"),this.addClass("vjs-controls-disabled"),this.trigger("controlsdisabled"),this.usingNativeControls()||this.removeTechControlsListeners_()))}usingNativeControls(e){if(e===void 0)return!!this.usingNativeControls_;e=!!e,this.usingNativeControls_!==e&&(this.usingNativeControls_=e,this.usingNativeControls_?(this.addClass("vjs-using-native-controls"),this.trigger("usingnativecontrols")):(this.removeClass("vjs-using-native-controls"),this.trigger("usingcustomcontrols")))}error(e){if(e===void 0)return this.error_||null;if(yi("beforeerror").forEach(t=>{const r=t(this,e);if(!(Xt(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new at(e),this.addClass("vjs-error"),ye.error(`(CODE:${this.error_.code} ${at.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),yi("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,r;const s=Le(this,this.reportUserActivity),n=function(p){(p.screenX!==t||p.screenY!==r)&&(t=p.screenX,r=p.screenY,s())},a=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},o=function(p){s(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",o),this.on("mouseleave",o);const l=this.getChild("controlBar");l&&!ot&&!Yt&&(l.on("mouseenter",function(p){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),l.on("mouseleave",function(p){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",s),this.on("keyup",s);let h;const c=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(h);const p=this.options_.inactivityTimeout;p<=0||(h=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},p))};this.setInterval(c,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),r=t&&t.currentHeight();e.forEach(s=>{s!==t&&s.el_&&!s.hasClass("vjs-hidden")&&(s.hide(),this.audioOnlyCache_.hiddenChildren.push(s))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.height(r),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,r){if(this.tech_)return this.tech_.addTextTrack(e,t,r)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),oi(this)&&this.trigger("languagechange"))}languages(){return we(Ie.prototype.options_.languages,this.languages_)}toJSON(){const e=we(this.options_),t=e.tracks;e.tracks=[];for(let r=0;r{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let r=0;rthis.addRemoteTextTrack(p,!1)),this.titleBar&&this.titleBar.update({title:c,description:a||s||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),s={src:t,textTracks:r};return e&&(s.poster=e,s.artwork=[{src:s.poster,type:kn(s.poster)}]),s}return we(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},r=vi(e),s=r["data-setup"];if(ls(e,"vjs-fill")&&(r.fill=!0),ls(e,"vjs-fluid")&&(r.fluid=!0),s!==null){const[n,a]=xm(s||"{}");n&&ye.error(n),Object.assign(r,a)}if(Object.assign(t,r),e.hasChildNodes()){const n=e.childNodes;for(let a=0,o=n.length;atypeof t=="number")||(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}rt.names.forEach(function(i){const e=rt[i];Ie.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ie.prototype.crossorigin=Ie.prototype.crossOrigin;Ie.players={};const Zr=R.navigator;Ie.prototype.options_={techOrder:fe.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Zr&&(Zr.languages&&Zr.languages[0]||Zr.userLanguage||Zr.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(i){Ie.prototype[i]=function(){return this.techGet_(i)}});gf.forEach(function(i){Ie.prototype[`handleTech${Me(i)}_`]=function(){return this.trigger(i)}});z.registerComponent("Player",Ie);const On="plugin",ur="activePlugins_",ir={},Pn=i=>ir.hasOwnProperty(i),mn=i=>Pn(i)?ir[i]:void 0,_f=(i,e)=>{i[ur]=i[ur]||{},i[ur][e]=!0},Rn=(i,e,t)=>{const r=(t?"before":"")+"pluginsetup";i.trigger(r,e),i.trigger(r+":"+e.name,e)},My=function(i,e){const t=function(){Rn(this,{name:i,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return _f(this,i),Rn(this,{name:i,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t},Pd=(i,e)=>(e.prototype.name=i,function(...t){Rn(this,{name:i,plugin:e,instance:null},!0);const r=new e(this,...t);return this[i]=()=>r,Rn(this,r.getEventHash()),r});class ft{constructor(e){if(this.constructor===ft)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),nu(this),delete this.trigger,Rh(this,this.constructor.defaultState),_f(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return Ar(this.eventBusEl_,e,this.getEventHash(t))}handleStateChanged(e){}dispose(){const{name:e,player:t}=this;this.trigger("dispose"),this.off(),t.off("dispose",this.dispose),t[ur][e]=!1,this.player=this.state=null,t[e]=Pd(e,ir[e])}static isBasic(e){const t=typeof e=="string"?mn(e):e;return typeof t=="function"&&!ft.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Pn(e))ye.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ie.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return ir[e]=t,e!==On&&(ft.isBasic(t)?Ie.prototype[e]=My(e,t):Ie.prototype[e]=Pd(e,t)),t}static deregisterPlugin(e){if(e===On)throw new Error("Cannot de-register base plugin.");Pn(e)&&(delete ir[e],delete Ie.prototype[e])}static getPlugins(e=Object.keys(ir)){let t;return e.forEach(r=>{const s=mn(r);s&&(t=t||{},t[r]=s)}),t}static getPluginVersion(e){const t=mn(e);return t&&t.VERSION||""}}ft.getPlugin=mn;ft.BASE_PLUGIN_NAME=On;ft.registerPlugin(On,ft);Ie.prototype.usingPlugin=function(i){return!!this[ur]&&this[ur][i]===!0};Ie.prototype.hasPlugin=function(i){return!!Pn(i)};function By(i,e){let t=!1;return function(...r){return t||ye.warn(i),t=!0,e.apply(this,r)}}function Bt(i,e,t,r){return By(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,r)}const vf=i=>i.indexOf("#")===0?i.slice(1):i;function G(i,e,t){let r=G.getPlayer(i);if(r)return e&&ye.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&r.ready(t),r;const s=typeof i=="string"?Ti("#"+vf(i)):i;if(!Cr(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in s?s.getRootNode()instanceof R.ShadowRoot:!1)?s.getRootNode():s.ownerDocument.body;(!s.ownerDocument.defaultView||!a.contains(s))&&ye.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(s.parentNode&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0)),yi("beforesetup").forEach(l=>{const h=l(s,we(e));if(!Xt(h)||Array.isArray(h)){ye.error("please return an object in beforesetup hooks");return}e=we(e,h)});const o=z.getComponent("Player");return r=new o(s,e,t),yi("setup").forEach(l=>l(r)),r}G.hooks_=si;G.hooks=yi;G.hook=gv;G.hookOnce=_v;G.removeHook=ah;if(R.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Sr()){let i=Ti(".vjs-styles-defaults");if(!i){i=Lh("vjs-styles-defaults");const e=Ti("head");e&&e.insertBefore(i,e.firstChild),Ih(i,` .video-js { width: 300px; height: 150px; } .vjs-fluid:not(.vjs-audio-only-mode) { padding-top: 56.25% } `)}}uo(1,G);G.VERSION=nh;G.options=Ie.prototype.options_;G.getPlayers=()=>Ie.players;G.getPlayer=i=>{const e=Ie.players;let t;if(typeof i=="string"){const r=vf(i),s=e[r];if(s)return s;t=Ti("#"+r)}else t=i;if(Cr(t)){const{player:r,playerId:s}=t;if(r||e[s])return r||e[s]}};G.getAllPlayers=()=>Object.keys(Ie.players).map(i=>Ie.players[i]).filter(Boolean);G.players=Ie.players;G.getComponent=z.getComponent;G.registerComponent=(i,e)=>(fe.isTech(e)&&ye.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),z.registerComponent.call(z,i,e));G.getTech=fe.getTech;G.registerTech=fe.registerTech;G.use=Wv;Object.defineProperty(G,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(G.middleware,"TERMINATOR",{value:In,writeable:!1,enumerable:!0});G.browser=xv;G.obj=Tv;G.mergeOptions=Bt(9,"videojs.mergeOptions","videojs.obj.merge",we);G.defineLazyProperty=Bt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Yn);G.bind=Bt(9,"videojs.bind","native Function.prototype.bind",Le);G.registerPlugin=ft.registerPlugin;G.deregisterPlugin=ft.deregisterPlugin;G.plugin=(i,e)=>(ye.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ft.registerPlugin(i,e));G.getPlugins=ft.getPlugins;G.getPlugin=ft.getPlugin;G.getPluginVersion=ft.getPluginVersion;G.addLanguage=function(i,e){return i=(""+i).toLowerCase(),G.options.languages=we(G.options.languages,{[i]:e}),G.options.languages[i]};G.log=ye;G.createLogger=oh;G.time=Mv;G.createTimeRange=Bt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Kt);G.createTimeRanges=Bt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Kt);G.formatTime=Bt(9,"videojs.formatTime","videojs.time.formatTime",Ui);G.setFormatTime=Bt(9,"videojs.setFormatTime","videojs.time.setFormatTime",Nh);G.resetFormatTime=Bt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Fh);G.parseUrl=Bt(9,"videojs.parseUrl","videojs.url.parseUrl",uu);G.isCrossOrigin=Bt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",ua);G.EventTarget=Lt;G.any=su;G.on=xt;G.one=aa;G.off=Qe;G.trigger=Ar;G.xhr=uc;G.TextTrack=ws;G.AudioTrack=$h;G.VideoTrack=Hh;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{G[i]=function(){return ye.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),Dh[i].apply(null,arguments)}});G.computedStyle=Bt(9,"videojs.computedStyle","videojs.dom.computedStyle",Tr);G.dom=Dh;G.fn=Lv;G.num=hy;G.str=Pv;G.url=Gv;/*! @name videojs-contrib-quality-levels @version 4.0.0 @license Apache-2.0 */class Ny{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(r){t.enabled_(r)}}),t}}class Mn extends G.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const r=this.levels_.length;return t=new Ny(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let r=0,s=this.length;rr&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,r=this.length;tr,i.qualityLevels.VERSION=yf,r},Tf=function(i){return Fy(this,G.obj.merge({},i))};G.registerPlugin("qualityLevels",Tf);Tf.VERSION=yf;/*! @name @videojs/http-streaming @version 3.6.0 @license Apache-2.0 */const Rt=lg,Bn=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,Nt=i=>G.log.debug?G.log.debug.bind(G,"VHS:",`${i} >`):function(){};function Se(...i){const e=G.obj||G;return(e.merge||e.mergeOptions).apply(e,i)}function Ye(...i){const e=G.time||G;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function Uy(i){let e="";for(let t=0;t ${s})`}return e||"empty"}const xi=1/30,Ht=xi*3,xf=function(i,e){const t=[];let r;if(i&&i.length)for(r=0;r=e})},ln=function(i,e){return xf(i,function(t){return t-xi>=e})},jy=function(i){if(i.length<2)return Ye();const e=[];for(let t=1;t{const e=[];if(!i||!i.length)return"";for(let t=0;t "+i.end(t));return e.join(", ")},$y=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},Ri=i=>{const e=[];for(let t=0;tn)){if(e>s&&e<=n){t+=n-e;continue}t+=n-s}}return t},Du=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(r){t+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(t+=i.partTargetDuration)}),t},_o=i=>(i.segments||[]).reduce((e,t,r)=>(t.parts?t.parts.forEach(function(s,n){e.push({duration:s.duration,segmentIndex:r,partIndex:n,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:r,partIndex:null,segment:t,part:null}),e),[]),Ef=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},Sf=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let r=(t||[]).reduce((s,n)=>s+(n.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},Cf=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=Ef(e).length>0;return t&&e.serverControl&&e.serverControl.partHoldBack?e.serverControl.partHoldBack:t&&e.partTargetDuration?e.partTargetDuration*3:e.serverControl&&e.serverControl.holdBack?e.serverControl.holdBack:e.targetDuration?e.targetDuration*3:0},Gy=function(i,e){let t=0,r=e-i.mediaSequence,s=i.segments[r];if(s){if(typeof s.start!="undefined")return{result:s.start,precise:!0};if(typeof s.end!="undefined")return{result:s.end-s.duration,precise:!0}}for(;r--;){if(s=i.segments[r],typeof s.end!="undefined")return{result:t+s.end,precise:!0};if(t+=Du(i,s),typeof s.start!="undefined")return{result:t+s.start,precise:!0}}return{result:t,precise:!1}},qy=function(i,e){let t=0,r,s=e-i.mediaSequence;for(;sr&&([t,r]=[r,t]),t<0){for(let n=t;n0)for(let h=l-1;h>=0;h--){const c=o[h];if(a+=c.duration,n){if(a<0)continue}else if(a+xi<=0)continue;return{partIndex:c.partIndex,segmentIndex:c.segmentIndex,startTime:s-hs({defaultDuration:i.targetDuration,durationList:o,startIndex:l,endIndex:h})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(l<0){for(let h=l;h<0;h++)if(a-=i.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};l=0}for(let h=l;h0)continue}else if(a-xi>=0)continue;return{partIndex:c.partIndex,segmentIndex:c.segmentIndex,startTime:s+hs({defaultDuration:i.targetDuration,durationList:o,startIndex:l,endIndex:h})}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},Lf=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},wu=function(i){return i.excludeUntil&&i.excludeUntil===1/0},ca=function(i){const e=Lf(i);return!i.disabled&&!e},Ky=function(i){return i.disabled},Xy=function(i){for(let e=0;e{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(r=>ca(r)?(r.attributes.BANDWIDTH||0)!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),Md=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let r=!1;for(const s in t){for(const n in t[s])if(r=e(t[s][n]),r)break;if(r)break}return!!r},Os=i=>{if(!i||!i.playlists||!i.playlists.length)return Md(i,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;emc(n))||Md(i,n=>Lu(t,n))))return!1}return!0};var ht={liveEdgeDelay:Cf,duration:Df,seekable:Wy,getMediaInfoForTime:zy,isEnabled:ca,isDisabled:Ky,isExcluded:Lf,isIncompatible:wu,playlistEnd:wf,isAes:Xy,hasAttribute:If,estimateSegmentRequestTime:Yy,isLowestEnabledRendition:vo,isAudioOnly:Os,playlistMatch:Lu,segmentDurationWithParts:Du};const{log:kf}=G,Iu=(i,e)=>`${i}-${e}`,Qy=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,Jy=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:s=[],llhls:n})=>{const a=new gg;i&&a.on("warn",i),e&&a.on("info",e),r.forEach(h=>a.addParser(h)),s.forEach(h=>a.addTagMapper(h)),a.push(t),a.end();const o=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(h){o.hasOwnProperty(h)&&delete o[h]}),o.segments&&o.segments.forEach(function(h){["parts","preloadHints"].forEach(function(c){h.hasOwnProperty(c)&&delete h[c]})})),!o.targetDuration){let h=10;o.segments&&o.segments.length&&(h=o.segments.reduce((c,p)=>Math.max(c,p.duration),0)),i&&i(`manifest has no targetDuration defaulting to ${h}`),o.targetDuration=h}const l=Ef(o);if(l.length&&!o.partTargetDuration){const h=l.reduce((c,p)=>Math.max(c,p.duration),0);i&&(i(`manifest has no partTargetDuration defaulting to ${h}`),kf.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=h}return o},Ir=(i,e)=>{!i.mediaGroups||["AUDIO","SUBTITLES"].forEach(t=>{if(!!i.mediaGroups[t])for(const r in i.mediaGroups[t])for(const s in i.mediaGroups[t][r]){const n=i.mediaGroups[t][r][s];e(n,t,r,s)}})},Of=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},Zy=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];Of({playlist:t,id:Iu(e,t.uri)}),t.resolvedUri=Rt(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||kf.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},eT=i=>{Ir(i,e=>{e.uri&&(e.resolvedUri=Rt(i.uri,e.uri))})},tT=(i,e)=>{const t=Iu(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:R.location.href,resolvedUri:R.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return r.playlists[t]=r.playlists[0],r.playlists[e]=r.playlists[0],r},Pf=(i,e,t=Qy)=>{i.uri=e;for(let s=0;s{if(!s.playlists||!s.playlists.length){if(r&&n==="AUDIO"&&!s.uri)for(let l=0;l(s.set(n.id,n),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((r,s)=>{if(!this.processedDateRanges_.has(s)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),t.push(r),!!r.class))if(e[r.class]){const n=e[r.class].push(r);r.classListIndex=n-1}else e[r.class]=[r],r.classListIndex=0});for(const r of t){const s=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&s[r.classListIndex+1]?r.endTime=s[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,s)=>{r.startDate.getTime(){if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let s=e.mediaSequence+e.segments.length;if(r){const n=r.parts||[],a=Sf(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&s--}t._HLS_msn=s}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const r=new R.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){!t.hasOwnProperty(s)||r.searchParams.set(s,t[s])}),i=r.toString()}return i},sT=(i,e)=>{if(!i)return e;const t=Se(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let r=0;r{const r=i.slice(),s=e.slice();t=t||0;const n=[];let a;for(let o=0;o{!i.resolvedUri&&i.uri&&(i.resolvedUri=Rt(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=Rt(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=Rt(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=Rt(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Rt(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Rt(e,t.uri))})},Mf=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let r=0;ri===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,yo=(i,e,t=Bf)=>{const r=Se(i,{}),s=r.playlists[e.id];if(!s||t(s,e))return null;e.segments=Mf(e);const n=Se(s,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,s.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a{Rf(a,n.resolvedUri)});for(let a=0;a{if(!!a.playlists)for(let c=0;c{const t=i.segments||[],r=t[t.length-1],s=r&&r.parts&&r.parts[r.parts.length-1],n=s&&s.duration||r&&r.duration;return e&&n?n*1e3:(i.partTargetDuration||i.targetDuration||10)*500};class sr extends iT{constructor(e,t,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Nt("PlaylistLoader");const{withCredentials:s=!1}=r;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new Bd,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=Rt(this.main.uri,e.uri);this.llhls&&(t=rT(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials},(r,s)=>{if(!!this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,r){const{uri:s,id:n}=t;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2},this.trigger("error")}parseManifest_({url:e,manifestString:t}){return Jy({onwarn:({message:r})=>this.logger_(`m3u8-parser warn for ${e}: ${r}`),oninfo:({message:r})=>this.logger_(`m3u8-parser info for ${e}: ${r}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}haveMetadata({playlistString:e,playlistObject:t,url:r,id:s}){this.request=null,this.state="HAVE_METADATA";const n=t||this.parseManifest_({url:r,manifestString:e});n.lastRequest=Date.now(),Of({playlist:n,uri:r,id:s});const a=yo(this.main,n);this.targetDuration=n.partTargetDuration||n.targetDuration,this.pendingMedia_=null,a?(this.main=a,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(To(this.media(),!!a)),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),R.clearTimeout(this.mediaUpdateTimeout),R.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Bd,this.off()}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e,t){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);if(typeof e=="string"){if(!this.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.main.playlists[e]}if(R.clearTimeout(this.finalRenditionTimeout),t){const a=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=R.setTimeout(this.media.bind(this,e,!1),a);return}const r=this.state,s=!this.media_||e.id!==this.media_.id,n=this.main.playlists[e.id];if(n&&n.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,s&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(To(e,!0)),!!s){if(this.state="SWITCHING_MEDIA",this.request){if(e.resolvedUri===this.request.url)return;this.request.onreadystatechange=null,this.request.abort(),this.request=null}this.media_&&this.trigger("mediachanging"),this.pendingMedia_=e,this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials},(a,o)=>{if(!!this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Bn(e.resolvedUri,o),a)return this.playlistRequestError(this.request,e,r);this.haveMetadata({playlistString:o.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}}pause(){this.mediaUpdateTimeout&&(R.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),this.stopRequest(),this.state==="HAVE_NOTHING"&&(this.started=!1),this.state==="SWITCHING_MEDIA"?this.media_?this.state="HAVE_METADATA":this.state="HAVE_MAIN_MANIFEST":this.state==="HAVE_CURRENT_METADATA"&&(this.state="HAVE_METADATA")}load(e){this.mediaUpdateTimeout&&(R.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const r=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=R.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(R.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=R.setTimeout(()=>{this.mediaUpdateTimeout=null,this.trigger("mediaupdatetimeout"),this.updateMediaUpdateTimeout_(e)},e))}start(){if(this.started=!0,typeof this.src=="object"){this.src.uri||(this.src.uri=R.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials},(e,t)=>{if(!this.request)return;if(this.request=null,e)return this.error={status:t.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:t.responseText,code:2},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.src=Bn(this.src,t);const r=this.parseManifest_({manifestString:t.responseText,url:this.src});this.setupInitialPlaylist(r)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Pf(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=Mf(r),r.segments.forEach(s=>{Rf(s,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||R.location.href;this.main=tT(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}}const{xhr:aT}=G,xo=function(i,e,t,r){const s=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&s&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=s.byteLength||s.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(s||i.responseText)))),r(e,i)},oT=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},uT=(i,e,t,r)=>{!i||!i.size||i.forEach(s=>{s(e,t,r)})},Nf=function(){const i=function e(t,r){t=Se({timeout:45e3},t);const s=e.beforeRequest||G.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||G.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||G.Vhs.xhr._responseCallbackSet;s&&typeof s=="function"&&(G.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s));const o=G.Vhs.xhr.original===!0?aT:G.Vhs.xhr,l=oT(n,t);n.delete(s);const h=o(l||t,function(p,_){return uT(a,h,p,_),xo(h,p,_,r)}),c=h.abort;return h.abort=function(){return h.aborted=!0,c.apply(h,arguments)},h.uri=t.uri,h.requestTime=Date.now(),h};return i.original=!0,i},lT=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=R.BigInt(i.offset)+R.BigInt(i.length)-R.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},bo=function(i){const e={};return i.byterange&&(e.Range=lT(i.byterange)),e},dT=function(i,e){return i.start(e)+"-"+i.end(e)},cT=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},hT=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},Ff=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];_c(r)?e[t]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[t]=r}),e},Nn=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},Uf=function(i){return i.resolvedUri},jf=i=>{const e=Array.prototype.slice.call(i),t=16;let r="",s,n;for(let a=0;ajf(i),pT=i=>{let e="",t;for(t=0;t{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-s;return new Date(e.dateTimeObject.getTime()+n*1e3)},_T=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,vT=(i,e)=>{let t;try{t=new Date(i)}catch(l){return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(to?null:(t>new Date(n)&&(r=s),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:ht.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},yT=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,r;for(let n=0;nt){if(i>t+s.duration*Vf)return null;r=s}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},TT=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch(a){}const s=t.getTime();return(r.getTime()-s)/1e3},xT=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const r=yT(e,i);if(!r)return t({message:"valid programTime was not found"});if(r.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const s={mediaSeconds:e},n=gT(e,r.segment);return n&&(s.programDateTime=n.toISOString()),t(null,s)},$f=({programTime:i,playlist:e,retryCount:t=2,seekTo:r,pauseAfterSeek:s=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i=="undefined"||!e||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!xT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=vT(i,e);if(!o)return a({message:`${i} was not found in the stream`});const l=o.segment,h=TT(l.dateTimeObject,i);if(o.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});r(o.estimatedStart+h),n.one("seeked",()=>{$f({programTime:i,playlist:e,retryCount:t-1,seekTo:r,pauseAfterSeek:s,tech:n,callback:a})});return}const c=l.start+h,p=()=>a(null,n.currentTime());n.one("seeked",p),s&&n.pause(),r(c)},Xa=(i,e)=>{if(i.readyState===4)return e()},ET=(i,e,t)=>{let r=[],s,n=!1;const a=function(c,p,_,E){return p.abort(),n=!0,t(c,p,_,E)},o=function(c,p){if(n)return;if(c)return a(c,p,"",r);const _=p.responseText.substring(r&&r.byteLength||0,p.responseText.length);if(r=wg(r,vc(_,!0)),s=s||ss(r),r.length<10||s&&r.lengtha(c,p,"",r));const E=Xo(r);return E==="ts"&&r.length<188?Xa(p,()=>a(c,p,"",r)):!E&&r.length<376?Xa(p,()=>a(c,p,"",r)):a(null,p,E,r)},h=e({uri:i,beforeSend(c){c.overrideMimeType("text/plain; charset=x-user-defined"),c.addEventListener("progress",function({total:p,loaded:_}){return xo(c,null,{statusCode:c.status},o)})}},function(c,p){return xo(h,c,p,o)});return h},{EventTarget:ST}=G,Nd=function(i,e){if(!Bf(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length))return!1;if(!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t{const s=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${s}`},AT=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:s})=>{const n=X_(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:s});return Pf(n,e,CT),n},DT=(i,e)=>{Ir(i,(t,r,s,n)=>{n in e.mediaGroups[r][s]||delete i.mediaGroups[r][s][n]})},wT=(i,e,t)=>{let r=!0,s=Se(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n{if(n.playlists&&n.playlists.length){const h=n.playlists[0].id,c=yo(s,n.playlists[0],Nd);c&&(s=c,l in s.mediaGroups[a][o]||(s.mediaGroups[a][o][l]=n),s.mediaGroups[a][o][l].playlists[0]=s.playlists[h],r=!1)}}),DT(s,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:s},LT=(i,e)=>(Boolean(!i.map&&!e.map)||Boolean(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,Fd=(i,e)=>{const t={};for(const r in i){const n=i[r].sidx;if(n){const a=zn(n);if(!e[a])break;const o=e[a].sidxInfo;LT(o,n)&&(t[a]=e[a])}}return t},IT=(i,e)=>{let r=Fd(i.playlists,e);return Ir(i,(s,n,a,o)=>{if(s.playlists&&s.playlists.length){const l=s.playlists;r=Se(r,Fd(l,e))}}),r};class Eo extends ST{constructor(e,t,r={},s){super(),this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:n=!1}=r;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Nt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}requestErrored_(e,t,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,t,r){const s=e.sidx&&zn(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){this.mediaRequest_=R.setTimeout(()=>r(!1),0);return}const n=Bn(e.sidx.resolvedUri),a=(o,l)=>{if(this.requestErrored_(o,l,t))return;const h=this.mainPlaylistLoader_.sidxMapping_;let c;try{c=ev(re(l.response).subarray(8))}catch(p){this.requestErrored_(p,l,t);return}return h[s]={sidxInfo:e.sidx,sidx:c},Wo(e,c,e.sidx.resolvedUri),r(!0)};this.request=ET(n,this.vhs_.xhr,(o,l,h,c)=>{if(o)return a(o,l);if(!h||h!=="mp4")return a({status:l.status,message:`Unsupported ${h||"unknown"} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},l);const{offset:p,length:_}=e.sidx.byterange;if(c.length>=_+p)return a(o,{response:c.subarray(p,p+_),status:l.status,uri:l.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",headers:bo({byterange:e.sidx.byterange})},a)})}dispose(){this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},R.clearTimeout(this.minimumUpdatePeriodTimeout_),R.clearTimeout(this.mediaRequest_),R.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}!r||(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,s=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),R.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(R.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){R.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const r=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=R.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){this.mediaRequest_=R.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials},(t,r)=>{if(this.requestErrored_(t,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}const s=r.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=r.responseText,r.responseHeaders&&r.responseHeaders.date?this.mainLoaded_=Date.parse(r.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Bn(this.mainPlaylistLoader_.srcUrl,r),s){this.handleMain_(),this.syncClientServerClock_(()=>e(r,s));return}return e(r,s)})}syncClientServerClock_(e){const t=Y_(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:Rt(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials},(r,s)=>{if(!this.request)return;if(r)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();let n;t.method==="HEAD"?!s.responseHeaders||!s.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(s.responseHeaders.date):n=Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=n-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main;let t=AT({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e});e&&(t=wT(e,t,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=t||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];return r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||t&&t.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(t),Boolean(t)}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(R.clearTimeout(e.minimumUpdatePeriodTimeout_),e.minimumUpdatePeriodTimeout_=null);let t=e.main&&e.main.minimumUpdatePeriod;if(t===0&&(e.media()?t=e.media().targetDuration*1e3:(e.createMupOnMedia_=e.updateMinimumUpdatePeriodTimeout_,e.one("loadedmetadata",e.createMupOnMedia_))),typeof t!="number"||t<=0){t<0&&this.logger_(`found invalid minimumUpdatePeriod of ${t}, not setting a timeout`);return}this.createMUPTimeout_(t)}createMUPTimeout_(e){const t=this.mainPlaylistLoader_;t.minimumUpdatePeriodTimeout_=R.setTimeout(()=>{t.minimumUpdatePeriodTimeout_=null,t.trigger("minimumUpdatePeriod"),t.createMUPTimeout_(e)},e)}refreshXml_(){this.requestMain_((e,t)=>{!t||(this.media_&&(this.media_=this.mainPlaylistLoader_.main.playlists[this.media_.id]),this.mainPlaylistLoader_.sidxMapping_=IT(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==t[e];if(r?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=R.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},To(this.media(),Boolean(r))))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}}var Ge={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};const kT=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t-1):!1},this.trigger=function(d){var m,f,T,A;if(m=u[d],!!m)if(arguments.length===2)for(T=m.length,f=0;f>>1,u.samplingfrequencyindex<<7|u.channelcount<<3,6,1,2]))},c=function(){return o(N.ftyp,$,K,$,q)},w=function(u){return o(N.hdlr,le[u])},p=function(u){return o(N.mdat,u)},v=function(u){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,u.duration>>>24&255,u.duration>>>16&255,u.duration>>>8&255,u.duration&255,85,196,0,0]);return u.samplerate&&(d[12]=u.samplerate>>>24&255,d[13]=u.samplerate>>>16&255,d[14]=u.samplerate>>>8&255,d[15]=u.samplerate&255),o(N.mdhd,d)},S=function(u){return o(N.mdia,v(u),w(u.type),E(u))},_=function(u){return o(N.mfhd,new Uint8Array([0,0,0,0,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255]))},E=function(u){return o(N.minf,u.type==="video"?o(N.vmhd,se):o(N.smhd,pe),l(),O(u))},g=function(u,d){for(var m=[],f=d.length;f--;)m[f]=V(d[f]);return o.apply(null,[N.moof,_(u)].concat(m))},b=function(u){for(var d=u.length,m=[];d--;)m[d]=y(u[d]);return o.apply(null,[N.moov,x(4294967295)].concat(m).concat(C(u)))},C=function(u){for(var d=u.length,m=[];d--;)m[d]=U(u[d]);return o.apply(null,[N.mvex].concat(m))},x=function(u){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(u&4278190080)>>24,(u&16711680)>>16,(u&65280)>>8,u&255,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 o(N.mvhd,d)},L=function(u){var d=u.samples||[],m=new Uint8Array(4+d.length),f,T;for(T=0;T>>8),A.push(f[k].byteLength&255),A=A.concat(Array.prototype.slice.call(f[k]));for(k=0;k>>8),I.push(T[k].byteLength&255),I=I.concat(Array.prototype.slice.call(T[k]));if(P=[N.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,(m.width&65280)>>8,m.width&255,(m.height&65280)>>8,m.height&255,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]),o(N.avcC,new Uint8Array([1,m.profileIdc,m.profileCompatibility,m.levelIdc,255].concat([f.length],A,[T.length],I))),o(N.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],m.sarRatio){var M=m.sarRatio[0],j=m.sarRatio[1];P.push(o(N.pasp,new Uint8Array([(M&4278190080)>>24,(M&16711680)>>16,(M&65280)>>8,M&255,(j&4278190080)>>24,(j&16711680)>>16,(j&65280)>>8,j&255])))}return o.apply(null,P)},d=function(m){return o(N.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(m.channelcount&65280)>>8,m.channelcount&255,(m.samplesize&65280)>>8,m.samplesize&255,0,0,0,0,(m.samplerate&65280)>>8,m.samplerate&255,0,0]),h(m))}}(),D=function(u){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,0,(u.duration&4278190080)>>24,(u.duration&16711680)>>16,(u.duration&65280)>>8,u.duration&255,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,(u.width&65280)>>8,u.width&255,0,0,(u.height&65280)>>8,u.height&255,0,0]);return o(N.tkhd,d)},V=function(u){var d,m,f,T,A,I,k;return d=o(N.tfhd,new Uint8Array([0,0,0,58,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),I=Math.floor(u.baseMediaDecodeTime/a),k=Math.floor(u.baseMediaDecodeTime%a),m=o(N.tfdt,new Uint8Array([1,0,0,0,I>>>24&255,I>>>16&255,I>>>8&255,I&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255])),A=32+20+8+16+8+8,u.type==="audio"?(f=B(u,A),o(N.traf,d,m,f)):(T=L(u),f=B(u,T.length+A),o(N.traf,d,m,f,T))},y=function(u){return u.duration=u.duration||4294967295,o(N.trak,D(u),S(u))},U=function(u){var d=new Uint8Array([0,0,0,0,(u.id&4278190080)>>24,(u.id&16711680)>>16,(u.id&65280)>>8,u.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return u.type!=="video"&&(d[d.length-1]=0),o(N.trex,d)},function(){var u,d,m;m=function(f,T){var A=0,I=0,k=0,P=0;return f.length&&(f[0].duration!==void 0&&(A=1),f[0].size!==void 0&&(I=2),f[0].flags!==void 0&&(k=4),f[0].compositionTimeOffset!==void 0&&(P=8)),[0,0,A|I|k|P,1,(f.length&4278190080)>>>24,(f.length&16711680)>>>16,(f.length&65280)>>>8,f.length&255,(T&4278190080)>>>24,(T&16711680)>>>16,(T&65280)>>>8,T&255]},d=function(f,T){var A,I,k,P,M,j;for(P=f.samples||[],T+=8+12+16*P.length,k=m(P,T),I=new Uint8Array(k.length+P.length*16),I.set(k),A=k.length,j=0;j>>24,I[A++]=(M.duration&16711680)>>>16,I[A++]=(M.duration&65280)>>>8,I[A++]=M.duration&255,I[A++]=(M.size&4278190080)>>>24,I[A++]=(M.size&16711680)>>>16,I[A++]=(M.size&65280)>>>8,I[A++]=M.size&255,I[A++]=M.flags.isLeading<<2|M.flags.dependsOn,I[A++]=M.flags.isDependedOn<<6|M.flags.hasRedundancy<<4|M.flags.paddingValue<<1|M.flags.isNonSyncSample,I[A++]=M.flags.degradationPriority&240<<8,I[A++]=M.flags.degradationPriority&15,I[A++]=(M.compositionTimeOffset&4278190080)>>>24,I[A++]=(M.compositionTimeOffset&16711680)>>>16,I[A++]=(M.compositionTimeOffset&65280)>>>8,I[A++]=M.compositionTimeOffset&255;return o(N.trun,I)},u=function(f,T){var A,I,k,P,M,j;for(P=f.samples||[],T+=8+12+8*P.length,k=m(P,T),A=new Uint8Array(k.length+P.length*8),A.set(k),I=k.length,j=0;j>>24,A[I++]=(M.duration&16711680)>>>16,A[I++]=(M.duration&65280)>>>8,A[I++]=M.duration&255,A[I++]=(M.size&4278190080)>>>24,A[I++]=(M.size&16711680)>>>16,A[I++]=(M.size&65280)>>>8,A[I++]=M.size&255;return o(N.trun,A)},B=function(f,T){return f.type==="audio"?u(f,T):d(f,T)}}();var De={ftyp:c,mdat:p,moof:g,moov:b,initSegment:function(u){var d=c(),m=b(u),f;return f=new Uint8Array(d.byteLength+m.byteLength),f.set(d),f.set(m,d.byteLength),f}},ut=function(u){var d,m,f=[],T=[];for(T.byteLength=0,T.nalCount=0,T.duration=0,f.byteLength=0,d=0;d1&&(d=u.shift(),u.byteLength-=d.byteLength,u.nalCount-=d.nalCount,u[0][0].dts=d.dts,u[0][0].pts=d.pts,u[0][0].duration+=d.duration),u},It=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Ce=function(u,d){var m=It();return m.dataOffset=d,m.compositionTimeOffset=u.pts-u.dts,m.duration=u.duration,m.size=4*u.length,m.size+=u.byteLength,u.keyFrame&&(m.flags.dependsOn=2,m.flags.isNonSyncSample=0),m},ue=function(u,d){var m,f,T,A,I,k=d||0,P=[];for(m=0;mce.ONE_SECOND_IN_TS/2))){for(M=ie()[u.samplerate],M||(M=d[0].data),j=0;j=m?u:(d.minSegmentDts=1/0,u.filter(function(f){return f.dts>=m?(d.minSegmentDts=Math.min(d.minSegmentDts,f.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},$i=function(u){var d,m,f=[];for(d=0;d=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(u),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},ti.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},ti.prototype.addText=function(u){this.rows[this.rowIdx]+=u},ti.prototype.backspace=function(){if(!this.isEmpty()){var u=this.rows[this.rowIdx];this.rows[this.rowIdx]=u.substr(0,u.length-1)}};var Bs=function(u,d,m){this.serviceNum=u,this.text="",this.currentWindow=new ti(-1),this.windows=[],this.stream=m,typeof d=="string"&&this.createTextDecoder(d)};Bs.prototype.init=function(u,d){this.startPts=u;for(var m=0;m<8;m++)this.windows[m]=new ti(m),typeof d=="function"&&(this.windows[m].beforeRowOverflow=d)},Bs.prototype.setCurrentWindow=function(u){this.currentWindow=this.windows[u]},Bs.prototype.createTextDecoder=function(u){if(typeof TextDecoder=="undefined")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(u)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+u+" encoding. "+d})}};var Ae=function(u){u=u||{},Ae.prototype.init.call(this);var d=this,m=u.captionServices||{},f={},T;Object.keys(m).forEach(A=>{T=m[A],/^SERVICE/.test(A)&&(f[A]=T.encoding)}),this.serviceEncodings=f,this.current708Packet=null,this.services={},this.push=function(A){A.type===3?(d.new708Packet(),d.add708Bytes(A)):(d.current708Packet===null&&d.new708Packet(),d.add708Bytes(A))}};Ae.prototype=new ha,Ae.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ae.prototype.add708Bytes=function(u){var d=u.ccData,m=d>>>8,f=d&255;this.current708Packet.ptsVals.push(u.pts),this.current708Packet.data.push(m),this.current708Packet.data.push(f)},Ae.prototype.push708Packet=function(){var u=this.current708Packet,d=u.data,m=null,f=null,T=0,A=d[T++];for(u.seq=A>>6,u.sizeCode=A&63;T>5,f=A&31,m===7&&f>0&&(A=d[T++],m=A),this.pushServiceBlock(m,T,f),f>0&&(T+=f-1)},Ae.prototype.pushServiceBlock=function(u,d,m){var f,T=d,A=this.current708Packet.data,I=this.services[u];for(I||(I=this.initService(u,T));T>5,A.rowLock=(f&16)>>4,A.columnLock=(f&8)>>3,A.priority=f&7,f=m[++u],A.relativePositioning=(f&128)>>7,A.anchorVertical=f&127,f=m[++u],A.anchorHorizontal=f,f=m[++u],A.anchorPoint=(f&240)>>4,A.rowCount=f&15,f=m[++u],A.columnCount=f&63,f=m[++u],A.windowStyle=(f&56)>>3,A.penStyle=f&7,A.virtualRowCount=A.rowCount+1,u},Ae.prototype.setWindowAttributes=function(u,d){var m=this.current708Packet.data,f=m[u],T=d.currentWindow.winAttr;return f=m[++u],T.fillOpacity=(f&192)>>6,T.fillRed=(f&48)>>4,T.fillGreen=(f&12)>>2,T.fillBlue=f&3,f=m[++u],T.borderType=(f&192)>>6,T.borderRed=(f&48)>>4,T.borderGreen=(f&12)>>2,T.borderBlue=f&3,f=m[++u],T.borderType+=(f&128)>>5,T.wordWrap=(f&64)>>6,T.printDirection=(f&48)>>4,T.scrollDirection=(f&12)>>2,T.justify=f&3,f=m[++u],T.effectSpeed=(f&240)>>4,T.effectDirection=(f&12)>>2,T.displayEffect=f&3,u},Ae.prototype.flushDisplayed=function(u,d){for(var m=[],f=0;f<8;f++)d.windows[f].visible&&!d.windows[f].isEmpty()&&m.push(d.windows[f].getText());d.endPts=u,d.text=m.join(` `),this.pushCaption(d),d.startPts=u},Ae.prototype.pushCaption=function(u){u.text!==""&&(this.trigger("data",{startPts:u.startPts,endPts:u.endPts,text:u.text,stream:"cc708_"+u.serviceNum}),u.text="",u.startPts=u.endPts)},Ae.prototype.displayWindows=function(u,d){var m=this.current708Packet.data,f=m[++u],T=this.getPts(u);this.flushDisplayed(T,d);for(var A=0;A<8;A++)f&1<>4,T.offset=(f&12)>>2,T.penSize=f&3,f=m[++u],T.italics=(f&128)>>7,T.underline=(f&64)>>6,T.edgeType=(f&56)>>3,T.fontStyle=f&7,u},Ae.prototype.setPenColor=function(u,d){var m=this.current708Packet.data,f=m[u],T=d.currentWindow.penColor;return f=m[++u],T.fgOpacity=(f&192)>>6,T.fgRed=(f&48)>>4,T.fgGreen=(f&12)>>2,T.fgBlue=f&3,f=m[++u],T.bgOpacity=(f&192)>>6,T.bgRed=(f&48)>>4,T.bgGreen=(f&12)>>2,T.bgBlue=f&3,f=m[++u],T.edgeRed=(f&48)>>4,T.edgeGreen=(f&12)>>2,T.edgeBlue=f&3,u},Ae.prototype.setPenLocation=function(u,d){var m=this.current708Packet.data,f=m[u],T=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,f=m[++u],T.row=f&15,f=m[++u],T.column=f&63,u},Ae.prototype.reset=function(u,d){var m=this.getPts(u);return this.flushDisplayed(m,d),this.initService(d.serviceNum,u)};var Ip={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},Ns=function(u){return u===null?"":(u=Ip[u]||u,String.fromCharCode(u))},Fs=14,kp=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ci=function(){for(var u=[],d=Fs+1;d--;)u.push({text:"",indent:0,offset:0});return u},ke=function(u,d){ke.prototype.init.call(this),this.field_=u||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(m){var f,T,A,I,k;if(f=m.ccData&32639,f===this.lastControlCode_){this.lastControlCode_=null;return}if((f&61440)===4096?this.lastControlCode_=f:f!==this.PADDING_&&(this.lastControlCode_=null),A=f>>>8,I=f&255,f!==this.PADDING_)if(f===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(f===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(m.pts),this.flushDisplayed(m.pts),T=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=T,this.startPts_=m.pts;else if(f===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(m.pts);else if(f===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(m.pts);else if(f===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(m.pts);else if(f===this.CARRIAGE_RETURN_)this.clearFormatting(m.pts),this.flushDisplayed(m.pts),this.shiftRowsUp_(),this.startPts_=m.pts;else if(f===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(f===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(m.pts),this.displayed_=Ci();else if(f===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ci();else if(f===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(m.pts),this.displayed_=Ci()),this.mode_="paintOn",this.startPts_=m.pts;else if(this.isSpecialCharacter(A,I))A=(A&3)<<8,k=Ns(A|I),this[this.mode_](m.pts,k),this.column_++;else if(this.isExtCharacter(A,I))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),A=(A&3)<<8,k=Ns(A|I),this[this.mode_](m.pts,k),this.column_++;else if(this.isMidRowCode(A,I))this.clearFormatting(m.pts),this[this.mode_](m.pts," "),this.column_++,(I&14)===14&&this.addFormatting(m.pts,["i"]),(I&1)===1&&this.addFormatting(m.pts,["u"]);else if(this.isOffsetControlCode(A,I)){const M=I&3;this.nonDisplayed_[this.row_].offset=M,this.column_+=M}else if(this.isPAC(A,I)){var P=kp.indexOf(f&7968);if(this.mode_==="rollUp"&&(P-this.rollUpRows_+1<0&&(P=this.rollUpRows_-1),this.setRollUp(m.pts,P)),P!==this.row_&&(this.clearFormatting(m.pts),this.row_=P),I&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(m.pts,["u"]),(f&16)===16){const M=(f&14)>>1;this.column_=M*4,this.nonDisplayed_[this.row_].indent+=M}this.isColorPAC(I)&&(I&14)===14&&this.addFormatting(m.pts,["i"])}else this.isNormalChar(A)&&(I===0&&(I=null),k=Ns(A),k+=Ns(I),this[this.mode_](m.pts,k),this.column_+=k.length)}};ke.prototype=new ha,ke.prototype.flushDisplayed=function(u){const d=f=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+f+"."})},m=[];this.displayed_.forEach((f,T)=>{if(f&&f.text&&f.text.length){try{f.text=f.text.trim()}catch(A){d(T)}f.text.length&&m.push({text:f.text,line:T+1,position:10+Math.min(70,f.indent*10)+f.offset*2.5})}else f==null&&d(T)}),m.length&&this.trigger("data",{startPts:this.startPts_,endPts:u,content:m,stream:this.name_})},ke.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ci(),this.nonDisplayed_=Ci(),this.lastControlCode_=null,this.column_=0,this.row_=Fs,this.rollUpRows_=2,this.formatting_=[]},ke.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},ke.prototype.isSpecialCharacter=function(u,d){return u===this.EXT_&&d>=48&&d<=63},ke.prototype.isExtCharacter=function(u,d){return(u===this.EXT_+1||u===this.EXT_+2)&&d>=32&&d<=63},ke.prototype.isMidRowCode=function(u,d){return u===this.EXT_&&d>=32&&d<=47},ke.prototype.isOffsetControlCode=function(u,d){return u===this.OFFSET_&&d>=33&&d<=35},ke.prototype.isPAC=function(u,d){return u>=this.BASE_&&u=64&&d<=127},ke.prototype.isColorPAC=function(u){return u>=64&&u<=79||u>=96&&u<=127},ke.prototype.isNormalChar=function(u){return u>=32&&u<=127},ke.prototype.setRollUp=function(u,d){if(this.mode_!=="rollUp"&&(this.row_=Fs,this.mode_="rollUp",this.flushDisplayed(u),this.nonDisplayed_=Ci(),this.displayed_=Ci()),d!==void 0&&d!==this.row_)for(var m=0;m"},"");this[this.mode_](u,m)},ke.prototype.clearFormatting=function(u){if(!!this.formatting_.length){var d=this.formatting_.reverse().reduce(function(m,f){return m+""},"");this.formatting_=[],this[this.mode_](u,d)}},ke.prototype.popOn=function(u,d){var m=this.nonDisplayed_[this.row_].text;m+=d,this.nonDisplayed_[this.row_].text=m},ke.prototype.rollUp=function(u,d){var m=this.displayed_[this.row_].text;m+=d,this.displayed_[this.row_].text=m},ke.prototype.shiftRowsUp_=function(){var u;for(u=0;ud&&(m=-1);Math.abs(d-u)>Rp;)u+=m*Pp;return u},pa=function(u){var d,m;pa.prototype.init.call(this),this.type_=u||Bu,this.push=function(f){this.type_!==Bu&&f.type!==this.type_||(m===void 0&&(m=f.dts),f.dts=fa(f.dts,m),f.pts=fa(f.pts,m),d=f.dts,this.trigger("data",f))},this.flush=function(){m=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){m=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};pa.prototype=new Op;var Nu={TimestampRolloverStream:pa,handleRollover:fa},Mp=(u,d,m)=>{if(!u)return-1;for(var f=m;f";u.data[0]===Vs.Utf8&&(m=js(u.data,0,d),!(m<0)&&(u.mimeType=Br(u.data,d,m),d=m+1,u.pictureType=u.data[d],d++,f=js(u.data,0,d),!(f<0)&&(u.description=Mr(u.data,d,f),d=f+1,u.mimeType===T?u.url=Br(u.data,d,u.data.length):u.pictureData=u.data.subarray(d,u.data.length))))},"T*":function(u){u.data[0]===Vs.Utf8&&(u.value=Mr(u.data,1,u.data.length).replace(/\0*$/,""),u.values=u.value.split("\0"))},TXXX:function(u){var d;u.data[0]===Vs.Utf8&&(d=js(u.data,0,1),d!==-1&&(u.description=Mr(u.data,1,d),u.value=Mr(u.data,d+1,u.data.length).replace(/\0*$/,""),u.data=u.value))},"W*":function(u){u.url=Br(u.data,0,u.data.length).replace(/\0.*$/,"")},WXXX:function(u){var d;u.data[0]===Vs.Utf8&&(d=js(u.data,0,1),d!==-1&&(u.description=Mr(u.data,1,d),u.url=Br(u.data,d+1,u.data.length).replace(/\0.*$/,"")))},PRIV:function(u){var d;for(d=0;d>>2;ne*=4,ne+=X[7]&3,j.timeStamp=ne,k.pts===void 0&&k.dts===void 0&&(k.pts=j.timeStamp,k.dts=j.timeStamp),this.trigger("timestamp",j)}k.frames.push(j),P+=10,P+=M}while(P>>4>1&&(I+=T[I]+1),A.pid===0)A.type="pat",u(T.subarray(I),A),this.trigger("data",A);else if(A.pid===this.pmtPid)for(A.type="pmt",u(T.subarray(I),A),this.trigger("data",A);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([T,I,A]):this.processPes_(T,I,A)},this.processPes_=function(T,A,I){I.pid===this.programMapTable.video?I.streamType=Ot.H264_STREAM_TYPE:I.pid===this.programMapTable.audio?I.streamType=Ot.ADTS_STREAM_TYPE:I.streamType=this.programMapTable["timed-metadata"][I.pid],I.type="pes",I.data=T.subarray(A),this.trigger("data",I)}},Ur.prototype=new ma,Ur.STREAM_TYPES={h264:27,adts:15},Gs=function(){var u=this,d=!1,m={data:[],size:0},f={data:[],size:0},T={data:[],size:0},A,I=function(P,M){var j;const H=P[0]<<16|P[1]<<8|P[2];M.data=new Uint8Array,H===1&&(M.packetLength=6+(P[4]<<8|P[5]),M.dataAlignmentIndicator=(P[6]&4)!==0,j=P[7],j&192&&(M.pts=(P[9]&14)<<27|(P[10]&255)<<20|(P[11]&254)<<12|(P[12]&255)<<5|(P[13]&254)>>>3,M.pts*=4,M.pts+=(P[13]&6)>>>1,M.dts=M.pts,j&64&&(M.dts=(P[14]&14)<<27|(P[15]&255)<<20|(P[16]&254)<<12|(P[17]&255)<<5|(P[18]&254)>>>3,M.dts*=4,M.dts+=(P[18]&6)>>>1)),M.data=P.subarray(9+P[8]))},k=function(P,M,j){var H=new Uint8Array(P.size),ee={type:M},X=0,ne=0,de=!1,$e;if(!(!P.data.length||P.size<9)){for(ee.trackId=P.data[0].pid,X=0;X>5,P=((d[T+6]&3)+1)*1024,M=P*Gp/Vu[(d[T+2]&60)>>>2],d.byteLength-T>>6&3)+1,channelcount:(d[T+2]&1)<<2|(d[T+3]&192)>>>6,samplerate:Vu[(d[T+2]&60)>>>2],samplingfrequencyindex:(d[T+2]&60)>>>2,samplesize:16,data:d.subarray(T+7+I,T+A)}),m++,T+=A}typeof j=="number"&&(this.skipWarn_(j,T),j=null),d=d.subarray(T)}},this.flush=function(){m=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},qs.prototype=new Hp;var qp=qs,$u;$u=function(u){var d=u.byteLength,m=0,f=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+f},this.loadWord=function(){var T=u.byteLength-d,A=new Uint8Array(4),I=Math.min(4,d);if(I===0)throw new Error("no bytes available");A.set(u.subarray(T,T+I)),m=new DataView(A.buffer).getUint32(0),f=I*8,d-=I},this.skipBits=function(T){var A;f>T?(m<<=T,f-=T):(T-=f,A=Math.floor(T/8),T-=A*8,d-=A,this.loadWord(),m<<=T,f-=T)},this.readBits=function(T){var A=Math.min(f,T),I=m>>>32-A;return f-=A,f>0?m<<=A:d>0&&this.loadWord(),A=T-A,A>0?I<>>T)!==0)return m<<=T,f-=T,T;return this.loadWord(),T+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var T=this.skipLeadingZeros();return this.readBits(T+1)-1},this.readExpGolomb=function(){var T=this.readUnsignedExpGolomb();return 1&T?1+T>>>1:-1*(T>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Wp=$u,Hu=t,zp=Wp,Ws,jr,Gu;jr=function(){var u=0,d,m;jr.prototype.init.call(this),this.push=function(f){var T;m?(T=new Uint8Array(m.byteLength+f.data.byteLength),T.set(m),T.set(f.data,m.byteLength),m=T):m=f.data;for(var A=m.byteLength;u3&&this.trigger("data",m.subarray(u+3)),m=null,u=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},jr.prototype=new Hu,Gu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Ws=function(){var u=new jr,d,m,f,T,A,I,k;Ws.prototype.init.call(this),d=this,this.push=function(P){P.type==="video"&&(m=P.trackId,f=P.pts,T=P.dts,u.push(P))},u.on("data",function(P){var M={trackId:m,pts:f,dts:T,data:P,nalUnitTypeCode:P[0]&31};switch(M.nalUnitTypeCode){case 5:M.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:M.nalUnitType="sei_rbsp",M.escapedRBSP=A(P.subarray(1));break;case 7:M.nalUnitType="seq_parameter_set_rbsp",M.escapedRBSP=A(P.subarray(1)),M.config=I(M.escapedRBSP);break;case 8:M.nalUnitType="pic_parameter_set_rbsp";break;case 9:M.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",M)}),u.on("done",function(){d.trigger("done")}),u.on("partialdone",function(){d.trigger("partialdone")}),u.on("reset",function(){d.trigger("reset")}),u.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){u.flush()},this.partialFlush=function(){u.partialFlush()},this.reset=function(){u.reset()},this.endTimeline=function(){u.endTimeline()},k=function(P,M){var j=8,H=8,ee,X;for(ee=0;ee>4;return m=m>=0?m:0,T?m+20:m+10},Wu=function(u,d){return u.length-d<10||u[d]!=="I".charCodeAt(0)||u[d+1]!=="D".charCodeAt(0)||u[d+2]!=="3".charCodeAt(0)?d:(d+=qu(u,d),Wu(u,d))},Yp=function(u){var d=Wu(u,0);return u.length>=d+2&&(u[d]&255)===255&&(u[d+1]&240)===240&&(u[d+1]&22)===16},zu=function(u){return u[0]<<21|u[1]<<14|u[2]<<7|u[3]},Qp=function(u,d,m){var f,T="";for(f=d;f>5,f=u[d+4]<<3,T=u[d+3]&3<<11;return T|f|m},e0=function(u,d){return u[d]==="I".charCodeAt(0)&&u[d+1]==="D".charCodeAt(0)&&u[d+2]==="3".charCodeAt(0)?"timed-metadata":u[d]&!0&&(u[d+1]&240)===240?"audio":null},t0=function(u){for(var d=0;d+5>>2]}return null},i0=function(u){var d,m,f,T;d=10,u[5]&64&&(d+=4,d+=zu(u.subarray(10,14)));do{if(m=zu(u.subarray(d+4,d+8)),m<1)return null;if(T=String.fromCharCode(u[d],u[d+1],u[d+2],u[d+3]),T==="PRIV"){f=u.subarray(d+10,d+m+10);for(var A=0;A>>2;return P*=4,P+=k[7]&3,P}break}}d+=10,d+=m}while(d=3;){if(u[T]==="I".charCodeAt(0)&&u[T+1]==="D".charCodeAt(0)&&u[T+2]==="3".charCodeAt(0)){if(u.length-T<10||(f=Ku.parseId3TagSize(u,T),T+f>u.length))break;I={type:"timed-metadata",data:u.subarray(T,T+f)},this.trigger("data",I),T+=f;continue}else if((u[T]&255)===255&&(u[T+1]&240)===240){if(u.length-T<7||(f=Ku.parseAdtsSize(u,T),T+f>u.length))break;k={type:"audio",data:u.subarray(T,T+f),pts:d,dts:d},this.trigger("data",k),T+=f;continue}T++}A=u.length-T,A>0?u=u.subarray(T):u=new Uint8Array},this.reset=function(){u=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){u=new Uint8Array,this.trigger("endedtimeline")}},zs.prototype=new r0;var s0=zs,n0=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],a0=n0,o0=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],u0=o0,Ks=t,Vr=De,$r=kt,Xs=Rr,Pt=bp,ii=$p,Ys=Y,Xu=qp,l0=Kp.H264Stream,d0=s0,c0=ya.isLikelyAacData,h0=Y.ONE_SECOND_IN_TS,Ta=a0,xa=u0,Hr,Gi,Qs,Ai,f0=function(u,d){d.stream=u,this.trigger("log",d)},Yu=function(u,d){for(var m=Object.keys(d),f=0;f=-M&&H<=P&&(!ee||j>H)&&(ee=ne,j=H)));return ee?ee.gop:null},this.alignGopsAtStart_=function(k){var P,M,j,H,ee,X,ne,de;for(ee=k.byteLength,X=k.nalCount,ne=k.duration,P=M=0;Pj.pts){P++;continue}M++,ee-=H.byteLength,X-=H.nalCount,ne-=H.duration}return M===0?k:M===k.length?null:(de=k.slice(M),de.byteLength=ee,de.duration=ne,de.nalCount=X,de.pts=de[0].pts,de.dts=de[0].dts,de)},this.alignGopsAtEnd_=function(k){var P,M,j,H,ee,X;for(P=T.length-1,M=k.length-1,ee=null,X=!1;P>=0&&M>=0;){if(j=T[P],H=k[M],j.pts===H.pts){X=!0;break}if(j.pts>H.pts){P--;continue}P===T.length-1&&(ee=M),M--}if(!X&&ee===null)return null;var ne;if(X?ne=M:ne=ee,ne===0)return k;var de=k.slice(ne),$e=de.reduce(function(St,wi){return St.byteLength+=wi.byteLength,St.duration+=wi.duration,St.nalCount+=wi.nalCount,St},{byteLength:0,duration:0,nalCount:0});return de.byteLength=$e.byteLength,de.duration=$e.duration,de.nalCount=$e.nalCount,de.pts=de[0].pts,de.dts=de[0].dts,de},this.alignGopsWith=function(k){T=k}},Hr.prototype=new Ks,Ai=function(u,d){this.numberOfTracks=0,this.metadataStream=d,u=u||{},typeof u.remux!="undefined"?this.remuxTracks=!!u.remux:this.remuxTracks=!0,typeof u.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=u.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ai.prototype.init.call(this),this.push=function(m){if(m.content||m.text)return this.pendingCaptions.push(m);if(m.frames)return this.pendingMetadata.push(m);this.pendingTracks.push(m.track),this.pendingBytes+=m.boxes.byteLength,m.track.type==="video"&&(this.videoTrack=m.track,this.pendingBoxes.push(m.boxes)),m.track.type==="audio"&&(this.audioTrack=m.track,this.pendingBoxes.unshift(m.boxes))}},Ai.prototype=new Ks,Ai.prototype.flush=function(u){var d=0,m={captions:[],captionStreams:{},metadata:[],info:{}},f,T,A,I=0,k;if(this.pendingTracks.length=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(I=this.videoTrack.timelineStartInfo.pts,xa.forEach(function(P){m.info[P]=this.videoTrack[P]},this)):this.audioTrack&&(I=this.audioTrack.timelineStartInfo.pts,Ta.forEach(function(P){m.info[P]=this.audioTrack[P]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?m.type=this.pendingTracks[0].type:m.type="combined",this.emittedTracks+=this.pendingTracks.length,A=Vr.initSegment(this.pendingTracks),m.initSegment=new Uint8Array(A.byteLength),m.initSegment.set(A),m.data=new Uint8Array(this.pendingBytes),k=0;k=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ai.prototype.setRemux=function(u){this.remuxTracks=u},Qs=function(u){var d=this,m=!0,f,T;Qs.prototype.init.call(this),u=u||{},this.baseMediaDecodeTime=u.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="aac",A.metadataStream=new ii.MetadataStream,A.aacStream=new d0,A.audioTimestampRolloverStream=new ii.TimestampRolloverStream("audio"),A.timedMetadataTimestampRolloverStream=new ii.TimestampRolloverStream("timed-metadata"),A.adtsStream=new Xu,A.coalesceStream=new Ai(u,A.metadataStream),A.headOfPipeline=A.aacStream,A.aacStream.pipe(A.audioTimestampRolloverStream).pipe(A.adtsStream),A.aacStream.pipe(A.timedMetadataTimestampRolloverStream).pipe(A.metadataStream).pipe(A.coalesceStream),A.metadataStream.on("timestamp",function(I){A.aacStream.setTimestamp(I.timeStamp)}),A.aacStream.on("data",function(I){I.type!=="timed-metadata"&&I.type!=="audio"||A.audioSegmentStream||(T=T||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Gi(T,u),A.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream),d.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!f}))}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Yu(this,A)},this.setupTsPipeline=function(){var A={};this.transmuxPipeline_=A,A.type="ts",A.metadataStream=new ii.MetadataStream,A.packetStream=new ii.TransportPacketStream,A.parseStream=new ii.TransportParseStream,A.elementaryStream=new ii.ElementaryStream,A.timestampRolloverStream=new ii.TimestampRolloverStream,A.adtsStream=new Xu,A.h264Stream=new l0,A.captionStream=new ii.CaptionStream(u),A.coalesceStream=new Ai(u,A.metadataStream),A.headOfPipeline=A.packetStream,A.packetStream.pipe(A.parseStream).pipe(A.elementaryStream).pipe(A.timestampRolloverStream),A.timestampRolloverStream.pipe(A.h264Stream),A.timestampRolloverStream.pipe(A.adtsStream),A.timestampRolloverStream.pipe(A.metadataStream).pipe(A.coalesceStream),A.h264Stream.pipe(A.captionStream).pipe(A.coalesceStream),A.elementaryStream.on("data",function(I){var k;if(I.type==="metadata"){for(k=I.tracks.length;k--;)!f&&I.tracks[k].type==="video"?(f=I.tracks[k],f.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!T&&I.tracks[k].type==="audio"&&(T=I.tracks[k],T.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);f&&!A.videoSegmentStream&&(A.coalesceStream.numberOfTracks++,A.videoSegmentStream=new Hr(f,u),A.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),A.videoSegmentStream.on("timelineStartInfo",function(P){T&&!u.keepOriginalTimestamps&&(T.timelineStartInfo=P,A.audioSegmentStream.setEarliestDts(P.dts-d.baseMediaDecodeTime))}),A.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),A.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),A.videoSegmentStream.on("baseMediaDecodeTime",function(P){T&&A.audioSegmentStream.setVideoBaseMediaDecodeTime(P)}),A.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),A.h264Stream.pipe(A.videoSegmentStream).pipe(A.coalesceStream)),T&&!A.audioSegmentStream&&(A.coalesceStream.numberOfTracks++,A.audioSegmentStream=new Gi(T,u),A.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),A.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),A.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),A.adtsStream.pipe(A.audioSegmentStream).pipe(A.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!T,hasVideo:!!f})}}),A.coalesceStream.on("data",this.trigger.bind(this,"data")),A.coalesceStream.on("id3Frame",function(I){I.dispatchType=A.metadataStream.dispatchType,d.trigger("id3Frame",I)}),A.coalesceStream.on("caption",this.trigger.bind(this,"caption")),A.coalesceStream.on("done",this.trigger.bind(this,"done")),Yu(this,A)},this.setBaseMediaDecodeTime=function(A){var I=this.transmuxPipeline_;u.keepOriginalTimestamps||(this.baseMediaDecodeTime=A),T&&(T.timelineStartInfo.dts=void 0,T.timelineStartInfo.pts=void 0,Pt.clearDtsInfo(T),I.audioTimestampRolloverStream&&I.audioTimestampRolloverStream.discontinuity()),f&&(I.videoSegmentStream&&(I.videoSegmentStream.gopCache_=[]),f.timelineStartInfo.dts=void 0,f.timelineStartInfo.pts=void 0,Pt.clearDtsInfo(f),I.captionStream.reset()),I.timestampRolloverStream&&I.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(A){T&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(A)},this.setRemux=function(A){var I=this.transmuxPipeline_;u.remux=A,I&&I.coalesceStream&&I.coalesceStream.setRemux(A)},this.alignGopsWith=function(A){f&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(A)},this.getLogTrigger_=function(A){var I=this;return function(k){k.stream=A,I.trigger("log",k)}},this.push=function(A){if(m){var I=c0(A);I&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!I&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),m=!1}this.transmuxPipeline_.headOfPipeline.push(A)},this.flush=function(){m=!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()}},Qs.prototype=new Ks;var p0={Transmuxer:Qs,VideoSegmentStream:Hr,AudioSegmentStream:Gi,AUDIO_PROPERTIES:Ta,VIDEO_PROPERTIES:xa,generateSegmentTimingInfo:ba},m0=function(u){return u>>>0},g0=function(u){return("00"+u.toString(16)).slice(-2)},Js={toUnsigned:m0,toHexString:g0},_0=function(u){var d="";return d+=String.fromCharCode(u[0]),d+=String.fromCharCode(u[1]),d+=String.fromCharCode(u[2]),d+=String.fromCharCode(u[3]),d},Ju=_0,v0=Js.toUnsigned,y0=Ju,Zu=function(u,d){var m=[],f,T,A,I,k;if(!d.length)return null;for(f=0;f1?f+T:u.byteLength,A===d[0]&&(d.length===1?m.push(u.subarray(f+8,I)):(k=Zu(u.subarray(f+8,I),d.slice(1)),k.length&&(m=m.concat(k)))),f=I;return m},el=Zu,T0=Js.toUnsigned,x0=n.getUint64,b0=function(u){var d={version:u[0],flags:new Uint8Array(u.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=x0(u.subarray(4)):d.baseMediaDecodeTime=T0(u[4]<<24|u[5]<<16|u[6]<<8|u[7]),d},tl=b0,E0=function(u){return{isLeading:(u[0]&12)>>>2,dependsOn:u[0]&3,isDependedOn:(u[1]&192)>>>6,hasRedundancy:(u[1]&48)>>>4,paddingValue:(u[1]&14)>>>1,isNonSyncSample:u[1]&1,degradationPriority:u[2]<<8|u[3]}},S0=E0,il=S0,C0=function(u){var d={version:u[0],flags:new Uint8Array(u.subarray(1,4)),samples:[]},m=new DataView(u.buffer,u.byteOffset,u.byteLength),f=d.flags[2]&1,T=d.flags[2]&4,A=d.flags[1]&1,I=d.flags[1]&2,k=d.flags[1]&4,P=d.flags[1]&8,M=m.getUint32(4),j=8,H;for(f&&(d.dataOffset=m.getInt32(j),j+=4),T&&M&&(H={flags:il(u.subarray(j,j+4))},j+=4,A&&(H.duration=m.getUint32(j),j+=4),I&&(H.size=m.getUint32(j),j+=4),P&&(d.version===1?H.compositionTimeOffset=m.getInt32(j):H.compositionTimeOffset=m.getUint32(j),j+=4),d.samples.push(H),M--);M--;)H={},A&&(H.duration=m.getUint32(j),j+=4),I&&(H.size=m.getUint32(j),j+=4),k&&(H.flags=il(u.subarray(j,j+4)),j+=4),P&&(d.version===1?H.compositionTimeOffset=m.getInt32(j):H.compositionTimeOffset=m.getUint32(j),j+=4),d.samples.push(H);return d},rl=C0,A0=function(u){var d=new DataView(u.buffer,u.byteOffset,u.byteLength),m={version:u[0],flags:new Uint8Array(u.subarray(1,4)),trackId:d.getUint32(4)},f=m.flags[2]&1,T=m.flags[2]&2,A=m.flags[2]&8,I=m.flags[2]&16,k=m.flags[2]&32,P=m.flags[0]&65536,M=m.flags[0]&131072,j;return j=8,f&&(j+=4,m.baseDataOffset=d.getUint32(12),j+=4),T&&(m.sampleDescriptionIndex=d.getUint32(j),j+=4),A&&(m.defaultSampleDuration=d.getUint32(j),j+=4),I&&(m.defaultSampleSize=d.getUint32(j),j+=4),k&&(m.defaultSampleFlags=d.getUint32(j)),P&&(m.durationIsEmpty=!0),!f&&M&&(m.baseDataOffsetIsMoof=!0),m},sl=A0,Gr;typeof window!="undefined"?Gr=window:typeof i!="undefined"?Gr=i:typeof self!="undefined"?Gr=self:Gr={};var nl=Gr,D0=Ru.discardEmulationPreventionBytes,w0=Mu.CaptionStream,qr=el,L0=tl,I0=rl,k0=sl,al=nl,O0=function(u,d){for(var m=u,f=0;f0?L0(ee[0]).baseMediaDecodeTime:0,ne=qr(P,["trun"]),de,$e;d===H&&ne.length>0&&(de=R0(ne,X,j),$e=P0(k,de,H),T[H]||(T[H]={seiNals:[],logs:[]}),T[H].seiNals=T[H].seiNals.concat($e.seiNals),T[H].logs=T[H].logs.concat($e.logs))}),T},B0=function(u,d,m){var f;if(d===null)return null;f=M0(u,d);var T=f[d]||{};return{seiNals:T.seiNals,logs:T.logs,timescale:m}},N0=function(){var u=!1,d,m,f,T,A,I;this.isInitialized=function(){return u},this.init=function(k){d=new w0,u=!0,I=k?k.isPartial:!1,d.on("data",function(P){P.startTime=P.startPts/T,P.endTime=P.endPts/T,A.captions.push(P),A.captionStreams[P.stream]=!0}),d.on("log",function(P){A.logs.push(P)})},this.isNewInit=function(k,P){return k&&k.length===0||P&&typeof P=="object"&&Object.keys(P).length===0?!1:f!==k[0]||T!==P[f]},this.parse=function(k,P,M){var j;if(this.isInitialized()){if(!P||!M)return null;if(this.isNewInit(P,M))f=P[0],T=M[f];else if(f===null||!T)return m.push(k),null}else return null;for(;m.length>0;){var H=m.shift();this.parse(H,P,M)}return j=B0(k,f,T),j&&j.logs&&(A.logs=A.logs.concat(j.logs)),j===null||!j.seiNals?A.logs.length?{logs:A.logs,captions:[],captionStreams:[]}:null:(this.pushNals(j.seiNals),this.flushStream(),A)},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(P){d.push(P)})},this.flushStream=function(){if(!this.isInitialized())return null;I?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){A.captions=[],A.captionStreams={},A.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){m=[],f=null,T=null,A?this.clearParsedCaptions():A={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},F0=N0,U0=function(u){for(var d=0,m=String.fromCharCode(u[d]),f="";m!=="\0";)f+=m,d++,m=String.fromCharCode(u[d]);return f+=m,f},j0={uint8ToCString:U0},Zs=j0.uint8ToCString,V0=n.getUint64,$0=function(u){var d=4,m=u[0],f,T,A,I,k,P,M,j;if(m===0){f=Zs(u.subarray(d)),d+=f.length,T=Zs(u.subarray(d)),d+=T.length;var H=new DataView(u.buffer);A=H.getUint32(d),d+=4,k=H.getUint32(d),d+=4,P=H.getUint32(d),d+=4,M=H.getUint32(d),d+=4}else if(m===1){var H=new DataView(u.buffer);A=H.getUint32(d),d+=4,I=V0(u.subarray(d)),d+=8,P=H.getUint32(d),d+=4,M=H.getUint32(d),d+=4,f=Zs(u.subarray(d)),d+=f.length,T=Zs(u.subarray(d)),d+=T.length}j=new Uint8Array(u.subarray(d,u.byteLength));var ee={scheme_id_uri:f,value:T,timescale:A||1,presentation_time:I,presentation_time_delta:k,event_duration:P,id:M,message_data:j};return G0(m,ee)?ee:void 0},H0=function(u,d,m,f){return u||u===0?u/d:f+m/d},G0=function(u,d){var m=d.scheme_id_uri!=="\0",f=u===0&&ol(d.presentation_time_delta)&&m,T=u===1&&ol(d.presentation_time)&&m;return!(u>1)&&f||T},ol=function(u){return u!==void 0||u!==null},q0={parseEmsgBox:$0,scaleTime:H0},en=Js.toUnsigned,Wr=Js.toHexString,Be=el,qi=Ju,Ea=q0,W0=sl,z0=rl,K0=tl,X0=n.getUint64,ul,ll,dl,cl,hl,Sa,fl,Ca=nl,Y0=Uu.parseId3Frames;ul=function(u){var d={},m=Be(u,["moov","trak"]);return m.reduce(function(f,T){var A,I,k,P,M;return A=Be(T,["tkhd"])[0],!A||(I=A[0],k=I===0?12:20,P=en(A[k]<<24|A[k+1]<<16|A[k+2]<<8|A[k+3]),M=Be(T,["mdia","mdhd"])[0],!M)?null:(I=M[0],k=I===0?12:20,f[P]=en(M[k]<<24|M[k+1]<<16|M[k+2]<<8|M[k+3]),f)},d)},ll=function(u,d){var m;m=Be(d,["moof","traf"]);var f=m.reduce(function(T,A){var I=Be(A,["tfhd"])[0],k=en(I[4]<<24|I[5]<<16|I[6]<<8|I[7]),P=u[k]||9e4,M=Be(A,["tfdt"])[0],j=new DataView(M.buffer,M.byteOffset,M.byteLength),H;M[0]===1?H=X0(M.subarray(4,12)):H=j.getUint32(4);let ee;return typeof H=="bigint"?ee=H/Ca.BigInt(P):typeof H=="number"&&!isNaN(H)&&(ee=H/P),ee11?(T.codec+=".",T.codec+=Wr(X[9]),T.codec+=Wr(X[10]),T.codec+=Wr(X[11])):T.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(T.codec)?(X=ee.subarray(28),ne=qi(X.subarray(4,8)),ne==="esds"&&X.length>20&&X[19]!==0?(T.codec+="."+Wr(X[19]),T.codec+="."+Wr(X[20]>>>2&63).replace(/^0/,"")):T.codec="mp4a.40.2"):T.codec=T.codec.toLowerCase())}var de=Be(f,["mdia","mdhd"])[0];de&&(T.timescale=Sa(de)),m.push(T)}),m},fl=function(u,d=0){var m=Be(u,["emsg"]);return m.map(f=>{var T=Ea.parseEmsgBox(new Uint8Array(f)),A=Y0(T.message_data);return{cueTime:Ea.scaleTime(T.presentation_time,T.timescale,T.presentation_time_delta,d),duration:Ea.scaleTime(T.event_duration,T.timescale),frames:A}})};var Aa={findBox:Be,parseType:qi,timescale:ul,startTime:ll,compositionStartTime:dl,videoTrackIds:cl,tracks:hl,getTimescaleFromMediaHeader:Sa,getEmsgID3:fl},Da=Us,pl=function(u){var d=u[1]&31;return d<<=8,d|=u[2],d},tn=function(u){return!!(u[1]&64)},rn=function(u){var d=0;return(u[3]&48)>>>4>1&&(d+=u[4]+1),d},Q0=function(u,d){var m=pl(u);return m===0?"pat":m===d?"pmt":d?"pes":null},J0=function(u){var d=tn(u),m=4+rn(u);return d&&(m+=u[m]+1),(u[m+10]&31)<<8|u[m+11]},Z0=function(u){var d={},m=tn(u),f=4+rn(u);if(m&&(f+=u[f]+1),!!(u[f+5]&1)){var T,A,I;T=(u[f+1]&15)<<8|u[f+2],A=3+T-4,I=(u[f+10]&15)<<8|u[f+11];for(var k=12+I;k=u.byteLength)return null;var f=null,T;return T=u[m+7],T&192&&(f={},f.pts=(u[m+9]&14)<<27|(u[m+10]&255)<<20|(u[m+11]&254)<<12|(u[m+12]&255)<<5|(u[m+13]&254)>>>3,f.pts*=4,f.pts+=(u[m+13]&6)>>>1,f.dts=f.pts,T&64&&(f.dts=(u[m+14]&14)<<27|(u[m+15]&255)<<20|(u[m+16]&254)<<12|(u[m+17]&255)<<5|(u[m+18]&254)>>>3,f.dts*=4,f.dts+=(u[m+18]&6)>>>1)),f},wa=function(u){switch(u){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}},im=function(u){for(var d=4+rn(u),m=u.subarray(d),f=0,T=0,A=!1,I;T3&&(I=wa(m[T+3]&31),I==="slice_layer_without_partitioning_rbsp_idr"&&(A=!0)),A},rm={parseType:Q0,parsePat:J0,parsePmt:Z0,parsePayloadUnitStartIndicator:tn,parsePesType:em,parsePesTime:tm,videoPacketContainsKeyFrame:im},ml=Us,Wi=Nu.handleRollover,be={};be.ts=rm,be.aac=ya;var Di=Y.ONE_SECOND_IN_TS,tt=188,Ut=71,sm=function(u,d){for(var m=0,f=tt,T,A;f=0;){if(u[f]===Ut&&(u[T]===Ut||T===u.byteLength)){switch(A=u.subarray(f,T),I=be.ts.parseType(A,d.pid),I){case"pes":k=be.ts.parsePesType(A,d.table),P=be.ts.parsePayloadUnitStartIndicator(A),k==="audio"&&P&&(M=be.ts.parsePesTime(A),M&&(M.type="audio",m.audio.push(M),j=!0));break}if(j)break;f-=tt,T-=tt;continue}f--,T--}},nm=function(u,d,m){for(var f=0,T=tt,A,I,k,P,M,j,H,ee,X=!1,ne={data:[],size:0};T=0;){if(u[f]===Ut&&u[T]===Ut){switch(A=u.subarray(f,T),I=be.ts.parseType(A,d.pid),I){case"pes":k=be.ts.parsePesType(A,d.table),P=be.ts.parsePayloadUnitStartIndicator(A),k==="video"&&P&&(M=be.ts.parsePesTime(A),M&&(M.type="video",m.video.push(M),X=!0));break}if(X)break;f-=tt,T-=tt;continue}f--,T--}},am=function(u,d){if(u.audio&&u.audio.length){var m=d;(typeof m=="undefined"||isNaN(m))&&(m=u.audio[0].dts),u.audio.forEach(function(A){A.dts=Wi(A.dts,m),A.pts=Wi(A.pts,m),A.dtsTime=A.dts/Di,A.ptsTime=A.pts/Di})}if(u.video&&u.video.length){var f=d;if((typeof f=="undefined"||isNaN(f))&&(f=u.video[0].dts),u.video.forEach(function(A){A.dts=Wi(A.dts,f),A.pts=Wi(A.pts,f),A.dtsTime=A.dts/Di,A.ptsTime=A.pts/Di}),u.firstKeyFrame){var T=u.firstKeyFrame;T.dts=Wi(T.dts,f),T.pts=Wi(T.pts,f),T.dtsTime=T.dts/Di,T.ptsTime=T.pts/Di}}},om=function(u){for(var d=!1,m=0,f=null,T=null,A=0,I=0,k;u.length-I>=3;){var P=be.aac.parseType(u,I);switch(P){case"timed-metadata":if(u.length-I<10){d=!0;break}if(A=be.aac.parseId3TagSize(u,I),A>u.length){d=!0;break}T===null&&(k=u.subarray(I,I+A),T=be.aac.parseAacTimestamp(k)),I+=A;break;case"audio":if(u.length-I<7){d=!0;break}if(A=be.aac.parseAdtsSize(u,I),A>u.length){d=!0;break}f===null&&(k=u.subarray(I,I+A),f=be.aac.parseSampleRate(k)),m++,I+=A;break;default:I++;break}if(d)return null}if(f===null||T===null)return null;var M=Di/f,j={audio:[{type:"audio",dts:T,pts:T},{type:"audio",dts:T+m*1024*M,pts:T+m*1024*M}]};return j},um=function(u){var d={pid:null,table:null},m={};sm(u,d);for(var f in d.table)if(d.table.hasOwnProperty(f)){var T=d.table[f];switch(T){case ml.H264_STREAM_TYPE:m.video=[],nm(u,d,m),m.video.length===0&&delete m.video;break;case ml.ADTS_STREAM_TYPE:m.audio=[],gl(u,d,m),m.audio.length===0&&delete m.audio;break}}return m},lm=function(u,d){var m=be.aac.isLikelyAacData(u),f;return m?f=om(u):f=um(u),!f||!f.audio&&!f.video?null:(am(f,d),f)},dm={inspect:lm,parseAudioPes_:gl};const cm=function(u,d){d.on("data",function(m){const f=m.initSegment;m.initSegment={data:f.buffer,byteOffset:f.byteOffset,byteLength:f.byteLength};const T=m.data;m.data=T.buffer,u.postMessage({action:"data",segment:m,byteOffset:T.byteOffset,byteLength:T.byteLength},[m.data])}),d.on("done",function(m){u.postMessage({action:"done"})}),d.on("gopInfo",function(m){u.postMessage({action:"gopInfo",gopInfo:m})}),d.on("videoSegmentTimingInfo",function(m){const f={start:{decode:Y.videoTsToSeconds(m.start.dts),presentation:Y.videoTsToSeconds(m.start.pts)},end:{decode:Y.videoTsToSeconds(m.end.dts),presentation:Y.videoTsToSeconds(m.end.pts)},baseMediaDecodeTime:Y.videoTsToSeconds(m.baseMediaDecodeTime)};m.prependedContentDuration&&(f.prependedContentDuration=Y.videoTsToSeconds(m.prependedContentDuration)),u.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:f})}),d.on("audioSegmentTimingInfo",function(m){const f={start:{decode:Y.videoTsToSeconds(m.start.dts),presentation:Y.videoTsToSeconds(m.start.pts)},end:{decode:Y.videoTsToSeconds(m.end.dts),presentation:Y.videoTsToSeconds(m.end.pts)},baseMediaDecodeTime:Y.videoTsToSeconds(m.baseMediaDecodeTime)};m.prependedContentDuration&&(f.prependedContentDuration=Y.videoTsToSeconds(m.prependedContentDuration)),u.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:f})}),d.on("id3Frame",function(m){u.postMessage({action:"id3Frame",id3Frame:m})}),d.on("caption",function(m){u.postMessage({action:"caption",caption:m})}),d.on("trackinfo",function(m){u.postMessage({action:"trackinfo",trackInfo:m})}),d.on("audioTimingInfo",function(m){u.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Y.videoTsToSeconds(m.start),end:Y.videoTsToSeconds(m.end)}})}),d.on("videoTimingInfo",function(m){u.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Y.videoTsToSeconds(m.start),end:Y.videoTsToSeconds(m.end)}})}),d.on("log",function(m){u.postMessage({action:"log",log:m})})};class _l{constructor(d,m){this.options=m||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new p0.Transmuxer(this.options),cm(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new F0,this.captionParser.init());const m=new Uint8Array(d.data,d.byteOffset,d.byteLength),f=this.captionParser.parse(m,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:f&&f.captions||[],logs:f&&f.logs||[],data:m.buffer},[m.buffer])}probeMp4StartTime({timescales:d,data:m}){const f=Aa.startTime(d,m);this.self.postMessage({action:"probeMp4StartTime",startTime:f,data:m},[m.buffer])}probeMp4Tracks({data:d}){const m=Aa.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:m,data:d},[d.buffer])}probeEmsgID3({data:d,offset:m}){const f=Aa.getEmsgID3(d,m);this.self.postMessage({action:"probeEmsgID3",id3Frames:f,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:m}){const f=typeof m=="number"&&!isNaN(m)?m*Y.ONE_SECOND_IN_TS:void 0,T=dm.inspect(d,f);let A=null;T&&(A={hasVideo:T.video&&T.video.length===2||!1,hasAudio:T.audio&&T.audio.length===2||!1},A.hasVideo&&(A.videoStart=T.video[0].ptsTime),A.hasAudio&&(A.audioStart=T.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:A,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const m=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(m)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const m=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Y.secondsToVideoTs(m)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(Y.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(u){if(u.data.action==="init"&&u.data.options){this.messageHandlers=new _l(self,u.data.options);return}this.messageHandlers||(this.messageHandlers=new _l(self)),u.data&&u.data.action&&u.data.action!=="init"&&this.messageHandlers[u.data.action]&&this.messageHandlers[u.data.action](u.data)}}));var RT=Gf(PT);const MT=(i,e,t)=>{const{type:r,initSegment:s,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:l,videoFramePtsTime:h}=i.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:o});const c=i.data.segment.boxes||{data:i.data.segment.data},p={type:r,data:new Uint8Array(c.data,c.data.byteOffset,c.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};typeof l!="undefined"&&(p.videoFrameDtsTime=l),typeof h!="undefined"&&(p.videoFramePtsTime=h),t(p)},BT=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},NT=(i,e)=>{e.gopInfo=i.data.gopInfo},zf=i=>{const{transmuxer:e,bytes:t,audioAppendStart:r,gopsToAlignWith:s,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:l,onVideoTimingInfo:h,onVideoSegmentTimingInfo:c,onAudioSegmentTimingInfo:p,onId3:_,onCaptions:E,onDone:g,onEndedTimeline:b,onTransmuxerLog:C,isEndOfTimeline:x}=i,y={buffer:[]};let D=x;const S=v=>{e.currentTransmux===i&&(v.data.action==="data"&&MT(v,y,a),v.data.action==="trackinfo"&&o(v.data.trackInfo),v.data.action==="gopInfo"&&NT(v,y),v.data.action==="audioTimingInfo"&&l(v.data.audioTimingInfo),v.data.action==="videoTimingInfo"&&h(v.data.videoTimingInfo),v.data.action==="videoSegmentTimingInfo"&&c(v.data.videoSegmentTimingInfo),v.data.action==="audioSegmentTimingInfo"&&p(v.data.audioSegmentTimingInfo),v.data.action==="id3Frame"&&_([v.data.id3Frame],v.data.id3Frame.dispatchType),v.data.action==="caption"&&E(v.data.caption),v.data.action==="endedtimeline"&&(D=!1,b()),v.data.action==="log"&&C(v.data.log),v.data.type==="transmuxed"&&(D||(e.onmessage=null,BT({transmuxedData:y,callback:g}),Kf(e))))};if(e.onmessage=S,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(s)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),typeof n!="undefined"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const v=t instanceof ArrayBuffer?t:t.buffer,w=t instanceof ArrayBuffer?0:t.byteOffset;e.postMessage({action:"push",data:v,byteOffset:w,byteLength:t.byteLength},[v])}x&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Kf=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():zf(i.currentTransmux))},Ud=(i,e)=>{i.postMessage({action:e}),Kf(i)},Xf=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Ud(e,i);return}e.transmuxQueue.push(Ud.bind(null,e,i))},FT=i=>{Xf("reset",i)},UT=i=>{Xf("endTimeline",i)},Yf=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,zf(i);return}i.transmuxer.transmuxQueue.push(i)},jT=i=>{const e=new RT;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e};var Ya={reset:FT,endTimeline:UT,transmux:Yf,createTransmuxer:jT};const fs=function(i){const e=i.transmuxer,t=i.endAction||i.action,r=i.callback,s=ui({},i,{endAction:null,transmuxer:null,callback:null}),n=a=>{a.data.action===t&&(e.removeEventListener("message",n),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),r(a.data))};if(e.addEventListener("message",n),i.data){const a=i.data instanceof ArrayBuffer;s.byteOffset=a?0:i.data.byteOffset,s.byteLength=i.data.byteLength;const o=[a?i.data:i.data.buffer];e.postMessage(s,o)}else e.postMessage(s)},Gt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},So=i=>{i.forEach(e=>{e.abort()})},VT=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),$T=i=>{const e=i.target,t=Date.now()-e.requestTime,r={bandwidth:1/0,bytesReceived:0,roundTripTime:t||0};return r.bytesReceived=i.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r},ku=(i,e)=>e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Gt.TIMEOUT,xhr:e}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Gt.ABORTED,xhr:e}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Gt.FAILURE,xhr:e}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Gt.FAILURE,xhr:e}:null,jd=(i,e,t)=>(r,s)=>{const n=s.response,a=ku(r,s);if(a)return t(a,i);if(n.byteLength!==16)return t({status:s.status,message:"Invalid HLS key at URL: "+s.uri,code:Gt.FAILURE,xhr:s},i);const o=new DataView(n),l=new Uint32Array([o.getUint32(0),o.getUint32(4),o.getUint32(8),o.getUint32(12)]);for(let h=0;h{const t=Xo(i.map.bytes);if(t!=="mp4"){const r=i.map.resolvedUri||i.map.uri;return e({internal:!0,message:`Found unsupported ${t||"unknown"} container for initialization segment at URL: ${r}`,code:Gt.FAILURE})}fs({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:r,data:s})=>(i.map.bytes=s,r.forEach(function(n){i.map.tracks=i.map.tracks||{},!i.map.tracks[n.type]&&(i.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[n.id]=n.timescale))}),e(null))})},HT=({segment:i,finishProcessingFn:e})=>(t,r)=>{const s=ku(t,r);if(s)return e(s,i);const n=new Uint8Array(r.response);if(i.map.key)return i.map.encryptedBytes=n,e(null,i);i.map.bytes=n,Qf(i,function(a){if(a)return a.xhr=r,a.status=r.status,e(a,i);e(null,i)})},GT=({segment:i,finishProcessingFn:e,responseType:t})=>(r,s)=>{const n=ku(r,s);if(n)return e(n,i);const a=t==="arraybuffer"||!s.responseText?s.response:kT(s.responseText.substring(i.lastReachedChar||0));return i.stats=VT(s),i.key?i.encryptedBytes=new Uint8Array(a):i.bytes=new Uint8Array(a),e(null,i)},qT=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})=>{const E=i.map&&i.map.tracks||{},g=Boolean(E.audio&&E.video);let b=r.bind(null,i,"audio","start");const C=r.bind(null,i,"audio","end");let x=r.bind(null,i,"video","start");const y=r.bind(null,i,"video","end"),D=()=>Yf({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:g,onData:S=>{S.type=S.type==="combined"?"video":S.type,c(i,S)},onTrackInfo:S=>{t&&(g&&(S.isMuxed=!0),t(i,S))},onAudioTimingInfo:S=>{b&&typeof S.start!="undefined"&&(b(S.start),b=null),C&&typeof S.end!="undefined"&&C(S.end)},onVideoTimingInfo:S=>{x&&typeof S.start!="undefined"&&(x(S.start),x=null),y&&typeof S.end!="undefined"&&y(S.end)},onVideoSegmentTimingInfo:S=>{s(S)},onAudioSegmentTimingInfo:S=>{n(S)},onId3:(S,v)=>{a(i,S,v)},onCaptions:S=>{o(i,[S])},isEndOfTimeline:l,onEndedTimeline:()=>{h()},onTransmuxerLog:_,onDone:S=>{!p||(S.type=S.type==="combined"?"video":S.type,p(null,i,S))}});fs({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:S=>{i.bytes=e=S.data;const v=S.result;v&&(t(i,{hasAudio:v.hasAudio,hasVideo:v.hasVideo,isMuxed:g}),t=null),D()}})},Jf=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})=>{let E=new Uint8Array(e);if(mv(E)){i.isFmp4=!0;const{tracks:g}=i.map,b={isFmp4:!0,hasVideo:!!g.video,hasAudio:!!g.audio};g.audio&&g.audio.codec&&g.audio.codec!=="enca"&&(b.audioCodec=g.audio.codec),g.video&&g.video.codec&&g.video.codec!=="encv"&&(b.videoCodec=g.video.codec),g.video&&g.audio&&(b.isMuxed=!0),t(i,b);const C=(x,y)=>{c(i,{data:E,type:b.hasAudio&&!b.isMuxed?"audio":"video"}),y&&y.length&&a(i,y),x&&x.length&&o(i,x),p(null,i,{})};fs({action:"probeMp4StartTime",timescales:i.map.timescales,data:E,transmuxer:i.transmuxer,callback:({data:x,startTime:y})=>{e=x.buffer,i.bytes=E=x,b.hasAudio&&!b.isMuxed&&r(i,"audio","start",y),b.hasVideo&&r(i,"video","start",y),fs({action:"probeEmsgID3",data:E,transmuxer:i.transmuxer,offset:y,callback:({emsgData:D,id3Frames:S})=>{if(e=D.buffer,i.bytes=E=D,!g.video||!x.byteLength||!i.transmuxer){C(void 0,S);return}fs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:E,timescales:i.map.timescales,trackIds:[g.video.id],callback:v=>{e=v.data.buffer,i.bytes=E=v.data,v.logs.forEach(function(w){_(Se(w,{stream:"mp4CaptionParser"}))}),C(v.captions,S)}})}})}});return}if(!i.transmuxer){p(null,i,{});return}if(typeof i.container=="undefined"&&(i.container=Xo(E)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),p(null,i,{});return}qT({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})},Zf=function({id:i,key:e,encryptedBytes:t,decryptionWorker:r},s){const n=o=>{if(o.data.source===i){r.removeEventListener("message",n);const l=o.data.decrypted;s(new Uint8Array(l.bytes,l.byteOffset,l.byteLength))}};r.addEventListener("message",n);let a;e.bytes.slice?a=e.bytes.slice():a=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(Ff({source:i,encrypted:t,key:a,iv:e.iv}),[t.buffer,a.buffer])},WT=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})=>{Zf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i},E=>{e.bytes=E,Jf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})})},zT=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})=>{let E=0,g=!1;return(b,C)=>{if(!g){if(b)return g=!0,So(i),p(b,C);if(E+=1,E===i.length){const x=function(){if(C.encryptedBytes)return WT({decryptionWorker:e,segment:C,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_});Jf({segment:C,bytes:C.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c,doneFn:p,onTransmuxerLog:_})};if(C.endOfAllRequests=Date.now(),C.map&&C.map.encryptedBytes&&!C.map.bytes)return Zf({decryptionWorker:e,id:C.requestId+"-init",encryptedBytes:C.map.encryptedBytes,key:C.map.key},y=>{C.map.bytes=y,Qf(C,D=>{if(D)return So(i),p(D,C);x()})});x()}}}},KT=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},XT=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:l,endedTimelineFn:h,dataFn:c})=>p=>{if(!p.target.aborted)return i.stats=Se(i.stats,$T(p)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(p,i)},YT=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:r,abortFn:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:c,captionsFn:p,isEndOfTimeline:_,endedTimelineFn:E,dataFn:g,doneFn:b,onTransmuxerLog:C})=>{const x=[],y=zT({activeXhrs:x,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:c,captionsFn:p,isEndOfTimeline:_,endedTimelineFn:E,dataFn:g,doneFn:b,onTransmuxerLog:C});if(r.key&&!r.key.bytes){const L=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&L.push(r.map.key);const O=Se(e,{uri:r.key.resolvedUri,responseType:"arraybuffer"}),F=jd(r,L,y),V=i(O,F);x.push(V)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const U=Se(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer"}),B=jd(r,[r.map.key],y),N=i(U,B);x.push(N)}const O=Se(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:bo(r.map)}),F=HT({segment:r,finishProcessingFn:y}),V=i(O,F);x.push(V)}const D=Se(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:bo(r)}),S=GT({segment:r,finishProcessingFn:y,responseType:D.responseType}),v=i(D,S);v.addEventListener("progress",XT({segment:r,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:h,id3Fn:c,captionsFn:p,isEndOfTimeline:_,endedTimelineFn:E,dataFn:g})),x.push(v);const w={};return x.forEach(L=>{L.addEventListener("loadend",KT({loadendState:w,abortFn:s}))}),()=>So(x)},QT=Nt("CodecUtils"),JT=function(i){const e=i.attributes||{};if(e.CODECS)return jt(e.CODECS)},ep=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},ZT=(i,e)=>{if(!ep(i,e))return!0;const t=e.attributes||{},r=i.mediaGroups.AUDIO[t.AUDIO];for(const s in r)if(!r[s].uri&&!r[s].playlists)return!0;return!1},Fn=function(i){const e={};return i.forEach(({mediaType:t,type:r,details:s})=>{e[t]=e[t]||[],e[t].push(pc(`${r}${s}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){QT(`multiple ${t} codecs found as attributes: ${e[t].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`),e[t]=null;return}e[t]=e[t][0]}),e},Vd=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},ps=function(i,e){const t=e.attributes||{},r=Fn(JT(e)||[]);if(ep(i,e)&&!r.audio&&!ZT(i,e)){const s=Fn(vg(i,t.AUDIO)||[]);s.audio&&(r.audio=s.audio)}return r},dn=Nt("PlaylistSelector"),$d=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},Un=function(i,e){if(!i)return"";const t=R.getComputedStyle(i);return t?t[e]:""},lr=function(i,e){const t=i.slice();i.sort(function(r,s){const n=e(r,s);return n===0?t.indexOf(r)-t.indexOf(s):n})},Ou=function(i,e){let t,r;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||R.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||R.Number.MAX_VALUE,t-r},ex=function(i,e){let t,r;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||R.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||R.Number.MAX_VALUE,t===r&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-r};let tp=function(i,e,t,r,s,n){if(!i)return;const a={bandwidth:e,width:t,height:r,limitRenditionByPlayerDimensions:s};let o=i.playlists;ht.isAudioOnly(i)&&(o=n.getAudioTrackPlaylists_(),a.audioOnly=!0);let l=o.map(v=>{let w;const L=v.attributes&&v.attributes.RESOLUTION&&v.attributes.RESOLUTION.width,O=v.attributes&&v.attributes.RESOLUTION&&v.attributes.RESOLUTION.height;return w=v.attributes&&v.attributes.BANDWIDTH,w=w||R.Number.MAX_VALUE,{bandwidth:w,width:L,height:O,playlist:v}});lr(l,(v,w)=>v.bandwidth-w.bandwidth),l=l.filter(v=>!ht.isIncompatible(v.playlist));let h=l.filter(v=>ht.isEnabled(v.playlist));h.length||(h=l.filter(v=>!ht.isDisabled(v.playlist)));const c=h.filter(v=>v.bandwidth*Ge.BANDWIDTH_VARIANCEv.bandwidth===p.bandwidth)[0];if(s===!1){const v=_||h[0]||l[0];if(v&&v.playlist){let w="sortedPlaylistReps";return _&&(w="bandwidthBestRep"),h[0]&&(w="enabledPlaylistReps"),dn(`choosing ${$d(v)} using ${w} with options`,a),v.playlist}return dn("could not choose a playlist with options",a),null}const E=c.filter(v=>v.width&&v.height);lr(E,(v,w)=>v.width-w.width);const g=E.filter(v=>v.width===t&&v.height===r);p=g[g.length-1];const b=g.filter(v=>v.bandwidth===p.bandwidth)[0];let C,x,y;b||(C=E.filter(v=>v.width>t||v.height>r),x=C.filter(v=>v.width===C[0].width&&v.height===C[0].height),p=x[x.length-1],y=x.filter(v=>v.bandwidth===p.bandwidth)[0]);let D;if(n.leastPixelDiffSelector){const v=E.map(w=>(w.pixelDiff=Math.abs(w.width-t)+Math.abs(w.height-r),w));lr(v,(w,L)=>w.pixelDiff===L.pixelDiff?L.bandwidth-w.bandwidth:w.pixelDiff-L.pixelDiff),D=v[0]}const S=D||y||b||_||h[0]||l[0];if(S&&S.playlist){let v="sortedPlaylistReps";return D?v="leastPixelDiffRep":y?v="resolutionPlusOneRep":b?v="resolutionBestRep":_?v="bandwidthBestRep":h[0]&&(v="enabledPlaylistReps"),dn(`choosing ${$d(S)} using ${v} with options`,a),S.playlist}return dn("could not choose a playlist with options",a),null};const Hd=function(){const i=this.useDevicePixelRatio&&R.devicePixelRatio||1;return tp(this.playlists.main,this.systemBandwidth,parseInt(Un(this.tech_.el(),"width"),10)*i,parseInt(Un(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)},tx=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){const r=this.useDevicePixelRatio&&R.devicePixelRatio||1;return e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),tp(this.playlists.main,e,parseInt(Un(this.tech_.el(),"width"),10)*r,parseInt(Un(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},ix=function(i){const{main:e,currentTime:t,bandwidth:r,duration:s,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:l}=i,h=e.playlists.filter(g=>!ht.isIncompatible(g));let c=h.filter(ht.isEnabled);c.length||(c=h.filter(g=>!ht.isDisabled(g)));const _=c.filter(ht.hasAttribute.bind(null,"BANDWIDTH")).map(g=>{const C=l.getSyncPoint(g,s,o,t)?1:2,y=ht.estimateSegmentRequestTime(n,r,g)*C-a;return{playlist:g,rebufferingImpact:y}}),E=_.filter(g=>g.rebufferingImpact<=0);return lr(E,(g,b)=>Ou(b.playlist,g.playlist)),E.length?E[0]:(lr(_,(g,b)=>g.rebufferingImpact-b.rebufferingImpact),_[0]||null)},rx=function(){const i=this.playlists.main.playlists.filter(ht.isEnabled);return lr(i,(t,r)=>Ou(t,r)),i.filter(t=>!!ps(this.playlists.main,t).video)[0]||null},sx=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(r=>{t.set(r,e),e+=r.byteLength})),t},nx=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let r=t;/^cc708_/.test(t)&&(r="SERVICE"+t.split("_")[1]);const s=e.textTracks().getTrackById(r);if(s)i[t]=s;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,l=!1;const h=n[r];h&&(a=h.label,o=h.language,l=h.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:r,default:l,label:a,language:o},!1).track}}},ax=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const r=R.WebKitDataCue||R.VTTCue;e.forEach(s=>{const n=s.stream;s.content?s.content.forEach(a=>{const o=new r(s.startTime+t,s.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",i[n].addCue(o)}):i[n].addCue(new r(s.startTime+t,s.endTime+t,s.text))})},ox=function(i){Object.defineProperties(i.frame,{id:{get(){return G.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return G.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return G.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},ux=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:r})=>{if(!e)return;const s=R.WebKitDataCue||R.VTTCue,n=i.metadataTrack_;if(!n||(e.forEach(c=>{const p=c.cueTime+t;typeof p!="number"||R.isNaN(p)||p<0||!(p<1/0)||!c.frames||!c.frames.length||c.frames.forEach(_=>{const E=new s(p,p,_.value||_.url||_.data||"");E.frame=_,E.value=_,ox(E),n.addCue(E)})}),!n.cues||!n.cues.length))return;const a=n.cues,o=[];for(let c=0;c{const _=c[p.startTime]||[];return _.push(p),c[p.startTime]=_,c},{}),h=Object.keys(l).sort((c,p)=>Number(c)-Number(p));h.forEach((c,p)=>{const _=l[c],E=isFinite(r)?r:0,g=Number(h[p+1])||E;_.forEach(b=>{b.endTime=g})})},lx={id:"ID",class:"CLASS",startDate:"START-DATE",duration:"DURATION",endDate:"END-DATE",endOnNext:"END-ON-NEXT",plannedDuration:"PLANNED-DURATION",scte35Out:"SCTE35-OUT",scte35In:"SCTE35-IN"},dx=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),cx=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const r=R.WebKitDataCue||R.VTTCue;e.forEach(s=>{for(const n of Object.keys(s)){if(dx.has(n))continue;const a=new r(s.startTime,s.endTime,"");a.id=s.id,a.type="com.apple.quicktime.HLS",a.value={key:lx[n],data:s[n]},(n==="scte35Out"||n==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}s.processDateRange()})},Gd=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,G.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},as=function(i,e,t){let r,s;if(!!t&&!!t.cues)for(r=t.cues.length;r--;)s=t.cues[r],s.startTime>=i&&s.endTime<=e&&t.removeCue(s)},hx=function(i){const e=i.cues;if(!e)return;const t={};for(let r=e.length-1;r>=0;r--){const s=e[r],n=`${s.startTime}-${s.endTime}-${s.text}`;t[n]?i.removeCue(s):t[n]=s}},fx=(i,e,t)=>{if(typeof e=="undefined"||e===null||!i.length)return[];const r=Math.ceil((e-t+3)*Sn.ONE_SECOND_IN_TS);let s;for(s=0;sr);s++);return i.slice(s)},px=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const r=e[0].pts;let s=0;for(s;s=r);s++);return i.slice(0,s).concat(e)},mx=(i,e,t,r)=>{const s=Math.ceil((e-r)*Sn.ONE_SECOND_IN_TS),n=Math.ceil((t-r)*Sn.ONE_SECOND_IN_TS),a=i.slice();let o=i.length;for(;o--&&!(i[o].pts<=n););if(o===-1)return a;let l=o+1;for(;l--&&!(i[l].pts<=s););return l=Math.max(l,0),a.splice(l,o-l+1),a},gx=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),r=Object.keys(e).sort();if(t.length!==r.length)return!1;for(let s=0;st))return n}return r.length===0?0:r[r.length-1]},es=1,vx=500,qd=i=>typeof i=="number"&&isFinite(i),cn=1/60,yx=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.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.":!e.hasVideo&&t.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,Tx=(i,e,t)=>{let r=e-Ge.BACK_BUFFER_LENGTH;i.length&&(r=Math.max(r,i.start(0)));const s=e-t;return Math.min(s,r)},Zi=i=>{const{startOfSegment:e,duration:t,segment:r,part:s,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:l,partIndex:h,timeline:c}=i,p=o.length-1;let _="mediaIndex/partIndex increment";i.getMediaInfoForTime?_=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(_="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(_+=` with independent ${i.independent}`);const E=typeof h=="number",g=i.segment.uri?"segment":"pre-segment",b=E?Sf({preloadSegment:r})-1:0;return`${g} [${n+l}/${n+p}]`+(E?` part [${h}/${b}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(E?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${c}] selected by [${_}] playlist [${a}]`},Wd=i=>`${i}TimingInfo`,zd=(i,e)=>i.length?i.end(i.length-1):e,xx=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:r,calculateTimestampOffsetForEachSegment:s,overrideCheck:n})=>s?zd(r,t):!n&&i===e?null:i{if(e===t)return!1;if(r==="audio"){const n=i.lastTimelineChange({type:"main"});return!n||n.to!==t}if(r==="main"&&s){const n=i.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},bx=i=>{let e=0;return["video","audio"].forEach(function(t){const r=i[`${t}TimingInfo`];if(!r)return;const{start:s,end:n}=r;let a;typeof s=="bigint"||typeof n=="bigint"?a=R.BigInt(n)-R.BigInt(s):typeof s=="number"&&typeof n=="number"&&(a=n-s),typeof a!="undefined"&&a>e&&(e=a)}),typeof e=="bigint"&&ei?Math.round(i)>e+xi:!1,Ex=(i,e)=>{if(e!=="hls")return null;const t=bx({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const r=i.playlist.targetDuration,s=Xd({segmentDuration:t,maxDuration:r*2}),n=Xd({segmentDuration:t,maxDuration:r}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${r}. 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||n?{severity:s?"warn":"info",message:a}:null};class Co extends G.EventTarget{constructor(e,t={}){if(super(),!e)throw new TypeError("Initialization settings are required");if(typeof e.currentTime!="function")throw new TypeError("No currentTime getter specified");if(!e.mediaSource)throw new TypeError("No MediaSource specified");this.bandwidth=e.bandwidth,this.throughput={rate:0,count:0},this.roundTrip=NaN,this.resetStats_(),this.mediaIndex=null,this.partIndex=null,this.hasPlayed_=e.hasPlayed,this.currentTime_=e.currentTime,this.seekable_=e.seekable,this.seeking_=e.seeking,this.duration_=e.duration,this.mediaSource_=e.mediaSource,this.vhs_=e.vhs,this.loaderType_=e.loaderType,this.currentMediaInfo_=void 0,this.startingMediaInfo_=void 0,this.segmentMetadataTrack_=e.segmentMetadataTrack,this.goalBufferLength_=e.goalBufferLength,this.sourceType_=e.sourceType,this.sourceUpdater_=e.sourceUpdater,this.inbandTextTracks_=e.inbandTextTracks,this.state_="INIT",this.timelineChangeController_=e.timelineChangeController,this.shouldSaveSegmentTimingInfo_=!0,this.parse708captions_=e.parse708captions,this.useDtsForTimestampOffset_=e.useDtsForTimestampOffset,this.calculateTimestampOffsetForEachSegment_=e.calculateTimestampOffsetForEachSegment,this.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.pendingSegment_=null,this.xhrOptions_=null,this.pendingSegments_=[],this.audioDisabled_=!1,this.isPendingTimestampOffset_=!1,this.gopBuffer_=[],this.timeMapping_=0,this.safeAppend_=!1,this.appendInitSegment_={audio:!0,video:!0},this.playlistOfLastInitSegment_={audio:null,video:null},this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_={id3:[],caption:[]},this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=null,this.activeInitSegmentId_=null,this.initSegments_={},this.cacheEncryptionKeys_=e.cacheEncryptionKeys,this.keyCache_={},this.decrypter_=e.decrypter,this.syncController_=e.syncController,this.syncPoint_={segmentIndex:0,time:0},this.transmuxer_=this.createTransmuxer_(),this.triggerSyncInfoUpdate_=()=>this.trigger("syncinfoupdate"),this.syncController_.on("syncinfoupdate",this.triggerSyncInfoUpdate_),this.mediaSource_.addEventListener("sourceopen",()=>{this.isEndOfStream_()||(this.ended_=!1)}),this.fetchAtBuffer_=!1,this.replaceSegmentsUntil_=-1,this.logger_=Nt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()&&this.processCallQueue_()}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",()=>{this.hasEnoughInfoToLoad_()&&this.processLoadQueue_(),this.hasEnoughInfoToAppend_()&&this.processCallQueue_()})}createTransmuxer_(){return Ya.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&R.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,R.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e!="undefined"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&Ya.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ye();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:r,isMuxed:s}=e;if(r&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const r=Nn(e);let s=this.initSegments_[r];return t&&!s&&e.bytes&&(this.initSegments_[r]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;const r=Uf(e);let s=this.keyCache_[r];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[r]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(s||e).resolvedUri};return s&&(n.bytes=s.bytes),n}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e)return;const r=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let n=null;if(r&&(r.id?n=r.id:r.uri&&(n=r.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}s&&(s.mediaIndex-=a,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(R.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetLoaderProperties(){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0}}resetEverything(e){this.resetLoaderProperties(),this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.resyncLoader()}resyncLoader(){this.transmuxer_&&Ya.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,r=()=>{},s=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let n=1;const a=()=>{n--,n===0&&r()};(s||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(s||this.loaderType_==="main")&&(this.gopBuffer_=mx(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)as(e,t,this.inbandTextTracks_[o]);as(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&R.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=R.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&R.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=R.setTimeout(this.monitorBufferTick_.bind(this),vx)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();!e||(typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e))}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,r=this.partIndex){if(!t||!this.mediaSource_)return!1;const s=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!s||!s.parts||r+1===s.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=Rd(e)||0,r=Au(e,this.currentTime_()),s=!this.hasPlayed_()&&r>=1,n=r>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||s||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_());const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:Boolean(!this.syncPoint_)};if(o.isSyncRequest)o.mediaIndex=_x(this.currentTimeline_,a,t);else if(this.mediaIndex!==null){const _=a[this.mediaIndex],E=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=_.end?_.end:t,_.parts&&_.parts[E+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=E+1):o.mediaIndex=this.mediaIndex+1}else{const{segmentIndex:_,startTime:E,partIndex:g}=ht.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:this.fetchAtBuffer_?t:this.currentTime_(),startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${t}`:`currentTime ${this.currentTime_()}`,o.mediaIndex=_,o.startOfSegment=E,o.partIndex=g}const l=a[o.mediaIndex];let h=l&&typeof o.partIndex=="number"&&l.parts&&l.parts[o.partIndex];if(!l||typeof o.partIndex=="number"&&!h)return null;typeof o.partIndex!="number"&&l.parts&&(o.partIndex=0,h=l.parts[0]);const c=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&h&&!c&&!h.independent)if(o.partIndex===0){const _=a[o.mediaIndex-1],E=_.parts&&_.parts.length&&_.parts[_.parts.length-1];E&&E.independent&&(o.mediaIndex-=1,o.partIndex=_.parts.length-1,o.independent="previous segment")}else l.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const p=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&p&&!this.seeking_()?null:this.generateSegmentInfo_(o)}generateSegmentInfo_(e){const{independent:t,playlist:r,mediaIndex:s,startOfSegment:n,isSyncRequest:a,partIndex:o,forceTimestampOffset:l,getMediaInfoForTime:h}=e,c=r.segments[s],p=typeof o=="number"&&c.parts[o],_={requestId:"segment-loader-"+Math.random(),uri:p&&p.resolvedUri||c.resolvedUri,mediaIndex:s,partIndex:p?o:null,isSyncRequest:a,startOfSegment:n,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:c.timeline,duration:p&&p.duration||c.duration,segment:c,part:p,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:h,independent:t},E=typeof l!="undefined"?l:this.isPendingTimestampOffset_;_.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:c.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),calculateTimestampOffsetForEachSegment:this.calculateTimestampOffsetForEachSegment_,overrideCheck:E});const g=Rd(this.sourceUpdater_.audioBuffered());return typeof g=="number"&&(_.audioAppendStart=g-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(_.gopsToAlignWith=fx(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),_}timestampOffsetForSegment_(e){return xx(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),r=e.bandwidth,s=this.pendingSegment_.duration,n=ht.estimateSegmentRequestTime(s,r,this.playlist_,e.bytesReceived),a=$y(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const o=ix({main:this.vhs_.playlists.main,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const h=n-a-o.rebufferingImpact;let c=.5;a<=xi&&(c=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||h{n[a.stream]=n[a.stream]||{startTime:1/0,captions:[],endTime:0};const o=n[a.stream];o.startTime=Math.min(o.startTime,a.startTime+s),o.endTime=Math.max(o.endTime,a.endTime+s),o.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:o,endTime:l,captions:h}=n[a],c=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${l} for ${a}`),nx(c,this.vhs_.tech_,a),as(o,l,c[a]),ax({captionArray:h,inbandTextTracks:c,timestampOffset:s})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,r));return}this.addMetadataToTextTrack(r,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!Kd({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:r,hasVideo:s,isMuxed:n}=t;return!(s&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||Kd({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}))}handleData_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(this.callQueue_.length||!this.hasEnoughInfoToAppend_()){this.callQueue_.push(this.handleData_.bind(this,e,t));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[Wd(t.type)].start;else{const s=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&s&&s.hasVideo;let a;n&&(a=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,t.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const s=this.chooseNextRequest_();if(s.mediaIndex!==r.mediaIndex||s.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:r,playlist:s}){if(r){const n=Nn(r);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=n}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r},s){const n=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ri(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ri(a).join(", "));const o=n.length?n.start(0):0,l=n.length?n.end(n.length-1):0,h=a.length?a.start(0):0,c=a.length?a.end(a.length-1):0;if(l-o<=es&&c-h<=es){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${Ri(n).join(", ")}, video buffer: ${Ri(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:r}));const _=this.currentTime_()-es;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${es}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=R.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},es*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:r},s){if(!!s){if(s.code===ip){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error(`${t} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:r,data:s,bytes:n}){if(!n){const a=[s];let o=s.byteLength;r&&(a.unshift(r),o+=r.byteLength),n=sx({bytes:o,segments:a})}this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,r){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,n=`${e}TimingInfo`;s[n]||(s[n]={}),s[n].transmuxerPrependedSeconds=r.prependedContentDuration||0,s[n].transmuxedPresentationStart=r.start.presentation,s[n].transmuxedDecodeStart=r.start.decode,s[n].transmuxedPresentationEnd=r.end.presentation,s[n].transmuxedDecodeEnd=r.end.decode,s[n].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,t){const{type:r,data:s}=t;if(!s||!s.byteLength||r==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:r,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:n,data:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){this.loadQueue_.push(()=>{const t=ui({},e,{forceTimestampOffset:!0});ui(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=r||s&&n;this.logger_(`Requesting ${Zi(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=YT({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:l,stream:h})=>{this.logger_(`${Zi(e)} logged from transmuxer stream ${h} as a ${l}: ${o}`)}})}trimBackBuffer_(e){const t=Tx(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,r=e.part,s={resolvedUri:r?r.resolvedUri:t.resolvedUri,byterange:r?r.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part},n=e.playlist.segments[e.mediaIndex-1];if(n&&n.timeline===t.timeline&&(n.videoTimingInfo?s.baseStartTime=n.videoTimingInfo.transmuxedDecodeEnd:n.audioTimingInfo&&(s.baseStartTime=n.audioTimingInfo.transmuxedDecodeEnd)),t.key){const a=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);s.key=this.segmentKey(t.key),s.key.iv=a}return t.map&&(s.map=this.initSegmentForMap(t.map)),s}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e=this.replaceSegmentsUntil_&&(this.replaceSegmentsUntil_=-1,this.fetchAtBuffer_=!0),this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const r=e.segment,s=e.part,n=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,a=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${Zi(e)}`),this.resetEverything();return}this.mediaIndex!==null&&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_()}recordThroughput_(e){if(e.duratione.toUpperCase())},Sx=["video","audio"],Ao=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},Cx=(i,e)=>{for(let t=0;t{if(e.queue.length===0)return;let t=0,r=e.queue[t];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),dr("audio",e),dr("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Ao(i,e))){if(r.type!==i){if(t=Cx(i,e.queue),t===null)return;r=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=r,r.action(i,e),!r.doneFn){e.queuePending[i]=null,dr(i,e);return}}},sp=(i,e)=>{const t=e[`${i}Buffer`],r=rp(i);!t||(t.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),t.removeEventListener("error",e[`on${r}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},Vt=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,_t={appendBuffer:(i,e,t)=>(r,s)=>{const n=s[`${r}Buffer`];if(!!Vt(s.mediaSource,n)){s.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${r}Buffer`);try{n.appendBuffer(i)}catch(a){s.logger_(`Error with code ${a.code} `+(a.code===ip?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),s.queuePending[r]=null,t(a)}}},remove:(i,e)=>(t,r)=>{const s=r[`${t}Buffer`];if(!!Vt(r.mediaSource,s)){r.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{s.remove(i,e)}catch(n){r.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const r=t[`${e}Buffer`];!Vt(t.mediaSource,r)||(t.logger_(`Setting ${e}timestampOffset to ${i}`),r.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){G.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){G.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(!!Vt(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(r){G.log.warn(`Failed to abort on ${i}Buffer`,r)}}},addSourceBuffer:(i,e)=>t=>{const r=rp(i),s=ms(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",t[`on${r}UpdateEnd_`]),n.addEventListener("error",t[`on${r}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=n},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(sp(i,e),!!Vt(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(r){G.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,r)}}},changeType:i=>(e,t)=>{const r=t[`${e}Buffer`],s=ms(i);!Vt(t.mediaSource,r)||t.codecs[e]!==i&&(t.logger_(`changing ${e}Buffer codec from ${t.codecs[e]} to ${i}`),r.changeType(s),t.codecs[e]=i)}},vt=({type:i,sourceUpdater:e,action:t,doneFn:r,name:s})=>{e.queue.push({type:i,action:t,doneFn:r,name:s}),dr(i,e)},Yd=(i,e)=>t=>{const r=e[`${i}Buffered`](),s=Uy(r);if(e.logger_(`${i} source buffer update end. Buffered: `,s),e.queuePending[i]){const n=e.queuePending[i].doneFn;e.queuePending[i]=null,n&&n(e[`${i}Error_`])}dr(i,e)};class np extends G.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>dr("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Nt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Yd("video",this),this.onAudioUpdateEnd_=Yd("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){vt({type:"mediaSource",sourceUpdater:this,action:_t.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){vt({type:e,sourceUpdater:this,action:_t.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){G.log.error("removeSourceBuffer is not supported!");return}vt({type:"mediaSource",sourceUpdater:this,action:_t.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!G.browser.IS_FIREFOX&&R.MediaSource&&R.MediaSource.prototype&&typeof R.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return R.SourceBuffer&&R.SourceBuffer.prototype&&typeof R.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){G.log.error("changeType is not supported!");return}vt({type:e,sourceUpdater:this,action:_t.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const r=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,r);this.canChangeType()&&this.changeType(t,r)})}appendBuffer(e,t){const{segmentInfo:r,type:s,bytes:n}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${n.length} until video append`);return}const a=t;if(vt({type:s,sourceUpdater:this,action:_t.appendBuffer(n,r||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return Vt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Ye()}videoBuffered(){return Vt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Ye()}buffered(){const e=Vt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Vt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Vy(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ni){vt({type:"mediaSource",sourceUpdater:this,action:_t.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ni){typeof e!="string"&&(e=void 0),vt({type:"mediaSource",sourceUpdater:this,action:_t.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,r=ni){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}vt({type:"audio",sourceUpdater:this,action:_t.remove(e,t),doneFn:r,name:"remove"})}removeVideo(e,t,r=ni){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}vt({type:"video",sourceUpdater:this,action:_t.remove(e,t),doneFn:r,name:"remove"})}updating(){return!!(Ao("audio",this)||Ao("video",this))}audioTimestampOffset(e){return typeof e!="undefined"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(vt({type:"audio",sourceUpdater:this,action:_t.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e!="undefined"&&this.videoBuffer&&this.videoTimestampOffset!==e&&(vt({type:"video",sourceUpdater:this,action:_t.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){!this.audioBuffer||vt({type:"audio",sourceUpdater:this,action:_t.callback(e),name:"callback"})}videoQueueCallback(e){!this.videoBuffer||vt({type:"video",sourceUpdater:this,action:_t.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Sx.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>sp(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Qd=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),Jd=new Uint8Array(` `.split("").map(i=>i.charCodeAt(0)));class Ax extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Dx extends Co{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.loaderType_="subtitle",this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}createTransmuxer_(){return null}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return Ye();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return Ye([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=Nn(e);let s=this.initSegments_[r];if(t&&!s&&e.bytes){const n=Jd.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(Jd,e.bytes.byteLength),this.initSegments_[r]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e=="undefined"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){as(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(!!e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Gt.TIMEOUT&&this.handleTimeout_(),e.code===Gt.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const n=s.segment;if(n.map&&(n.map.bytes=t.map.bytes),s.bytes=t.bytes,typeof R.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}n.requested=!0;try{this.parseVTTCues_(s)}catch(a){this.stopForError({message:a.message});return}if(this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=n.duration,s.cues.forEach(a=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new R.VTTCue(a.startTime,a.endTime,a.text):a)}),hx(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(){}updateTimingInfoEnd_(){}parseVTTCues_(e){let t,r=!1;if(typeof R.WebVTT!="function")throw new Ax;typeof R.TextDecoder=="function"?t=new R.TextDecoder("utf8"):(t=R.WebVTT.StringDecoder(),r=!0);const s=new R.WebVTT.Parser(R,R.vttjs,t);if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=a=>{e.timestampmap=a},s.onparsingerror=a=>{G.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;r&&(a=Qd(a)),s.parse(a)}let n=e.bytes;r&&(n=Qd(n)),s.parse(n),s.flush()}updateTimeMapping_(e,t,r){const s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}const n=e.timestampmap,a=n.MPEGTS/Sn.ONE_SECOND_IN_TS-n.LOCAL+t.mapping;if(e.cues.forEach(o=>{o.startTime+=a,o.endTime+=a}),!r.syncInfo){const o=e.cues[0].startTime,l=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(o,l-s.duration)}}}}const wx=function(i,e){const t=i.cues;for(let r=0;r=s.adStartTime&&e<=s.adEndTime)return s}return null},Lx=function(i,e,t=0){if(!i.segments)return;let r=t,s;for(let n=0;nt!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"ProgramDateTime",run:(i,e,t,r,s)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let n=null,a=null;const o=_o(e);s=s||0;for(let l=0;l{let n=null,a=null;s=s||0;const o=_o(e);for(let l=0;l=E)&&(a=E,n={time:_,segmentIndex:c.segmentIndex,partIndex:c.partIndex})}}return n}},{name:"Discontinuity",run:(i,e,t,r,s)=>{let n=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o=p)&&(a=p,n={time:c.time,segmentIndex:l,partIndex:null})}}}return n}},{name:"Playlist",run:(i,e,t,r,s)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class kx extends G.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={},this.logger_=Nt("SyncController")}getSyncPoint(e,t,r,s){const n=this.runStrategies_(e,t,r,s);return n.length?this.selectSyncPoint_(n,{key:"time",value:s}):null}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const s=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+hs({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,s){const n=[];for(let a=0;aIx){G.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let s=r-1;s>=0;s--){const n=e.segments[s];if(n&&typeof n.start!="undefined"){t.syncInfo={mediaSequence:e.mediaSequence+s,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],r=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const n=s.dateTimeObject;s.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[s.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]=="undefined"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]=="undefined"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,r){const s=e.segment,n=e.part;let a=this.timelines[e.timeline],o,l;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},r&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,l=t.end+a.mapping;else if(a)o=t.start+a.mapping,l=t.end+a.mapping;else return!1;return n&&(n.start=o,n.end=l),(!s.start||ol){let h;o<0?h=r.start-hs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):h=r.end+hs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:h,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class Ox extends G.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.lastTimelineChanges_[e]={type:e,from:t,to:r},delete this.pendingTimelineChanges_[e],this.trigger("timelinechange")),this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Px=qf(Wf(function(){var i=function(){function b(){this.listeners={}}var C=b.prototype;return C.on=function(y,D){this.listeners[y]||(this.listeners[y]=[]),this.listeners[y].push(D)},C.off=function(y,D){if(!this.listeners[y])return!1;var S=this.listeners[y].indexOf(D);return this.listeners[y]=this.listeners[y].slice(0),this.listeners[y].splice(S,1),S>-1},C.trigger=function(y){var D=this.listeners[y];if(!!D)if(arguments.length===2)for(var S=D.length,v=0;v>7)*283)^S]=S;for(v=w=0;!y[v];v^=F||1,w=O[w]||1)for(B=w^w<<1^w<<2^w<<3^w<<4,B=B>>8^B&255^99,y[v]=B,D[B]=v,U=L[V=L[F=L[v]]],$=U*16843009^V*65537^F*257^v*16843008,N=L[B]*257^B*16843008,S=0;S<4;S++)C[S][v]=N=N<<24^N>>>8,x[S][B]=$=$<<24^$>>>8;for(S=0;S<5;S++)C[S]=C[S].slice(0),x[S]=x[S].slice(0);return b};let r=null;class s{constructor(C){r||(r=t()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let x,y,D;const S=this._tables[0][4],v=this._tables[1],w=C.length;let L=1;if(w!==4&&w!==6&&w!==8)throw new Error("Invalid aes key size");const O=C.slice(0),F=[];for(this._key=[O,F],x=w;x<4*w+28;x++)D=O[x-1],(x%w===0||w===8&&x%w===4)&&(D=S[D>>>24]<<24^S[D>>16&255]<<16^S[D>>8&255]<<8^S[D&255],x%w===0&&(D=D<<8^D>>>24^L<<24,L=L<<1^(L>>7)*283)),O[x]=O[x-w]^D;for(y=0;x;y++,x--)D=O[y&3?x:x-4],x<=4||y<4?F[y]=D:F[y]=v[0][S[D>>>24]]^v[1][S[D>>16&255]]^v[2][S[D>>8&255]]^v[3][S[D&255]]}decrypt(C,x,y,D,S,v){const w=this._key[1];let L=C^w[0],O=D^w[1],F=y^w[2],V=x^w[3],U,B,N;const $=w.length/4-2;let K,q=4;const Q=this._tables[1],oe=Q[0],le=Q[1],se=Q[2],pe=Q[3],Te=Q[4];for(K=0;K<$;K++)U=oe[L>>>24]^le[O>>16&255]^se[F>>8&255]^pe[V&255]^w[q],B=oe[O>>>24]^le[F>>16&255]^se[V>>8&255]^pe[L&255]^w[q+1],N=oe[F>>>24]^le[V>>16&255]^se[L>>8&255]^pe[O&255]^w[q+2],V=oe[V>>>24]^le[L>>16&255]^se[O>>8&255]^pe[F&255]^w[q+3],q+=4,L=U,O=B,F=N;for(K=0;K<4;K++)S[(3&-K)+v]=Te[L>>>24]<<24^Te[O>>16&255]<<16^Te[F>>8&255]<<8^Te[V&255]^w[q++],U=L,L=O,O=F,F=V,V=U}}class n extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(C){this.jobs.push(C),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(b){return b<<24|(b&65280)<<8|(b&16711680)>>8|b>>>24},o=function(b,C,x){const y=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>2),D=new s(Array.prototype.slice.call(C)),S=new Uint8Array(b.byteLength),v=new Int32Array(S.buffer);let w,L,O,F,V,U,B,N,$;for(w=x[0],L=x[1],O=x[2],F=x[3],$=0;${const y=b[x];_(y)?C[x]={bytes:y.buffer,byteOffset:y.byteOffset,byteLength:y.byteLength}:C[x]=y}),C};self.onmessage=function(b){const C=b.data,x=new Uint8Array(C.encrypted.bytes,C.encrypted.byteOffset,C.encrypted.byteLength),y=new Uint32Array(C.key.bytes,C.key.byteOffset,C.key.byteLength/4),D=new Uint32Array(C.iv.bytes,C.iv.byteOffset,C.iv.byteLength/4);new l(x,y,D,function(S,v){self.postMessage(g({source:C.source,decrypted:v}),[v.buffer])})}}));var Rx=Gf(Px);const Mx=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},jn=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Do=(i,e)=>{e.activePlaylistLoader=i,i.load()},Bx=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:s}}=e,n=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,l=s.lastGroup_;if(!(a&&l&&a.id===l.id)&&(s.lastGroup_=a,s.lastTrack_=n,jn(t,s),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&r.resetEverything();return}t.resyncLoader(),Do(a.playlistLoader,s)}},Nx=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},Fx=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:s},mediaTypes:{[i]:n}}=e,a=n.activeTrack(),o=n.getActiveGroup(),l=n.activePlaylistLoader,h=n.lastTrack_;if(!(h&&a&&h.id===a.id)&&(n.lastGroup_=o,n.lastTrack_=a,jn(r,n),!!o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;const c=e.vhs.playlistController_,p=c.selectPlaylist();if(c.media()===p)return;n.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),t.pause(),s.resetEverything(),c.fastQualityChange_(p);return}if(i==="AUDIO"){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(l===o.playlistLoader){Do(o.playlistLoader,n);return}r.track&&r.track(a),r.resetEverything(),Do(o.playlistLoader,n)}},Vn={AUDIO:(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r},excludePlaylist:s}=e;jn(t,r);const n=r.activeTrack(),a=r.activeGroup(),o=(a.filter(h=>h.default)[0]||a[0]).id,l=r.tracks[o];if(n===l){s({error:{message:"Problem encountered loading the default audio track."}});return}G.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const h in r.tracks)r.tracks[h].enabled=r.tracks[h]===l;r.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;G.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track."),jn(t,r);const s=r.activeTrack();s&&(s.mode="disabled"),r.onTrackChanged()}},ec={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:s,segmentLoaders:{[i]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,s),(!r.paused()||a.endList&&r.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),r.paused()||n.load()}),e.on("error",Vn[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:s,segmentLoaders:{[i]:n},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();n.playlist(o,s),n.track(a.activeTrack()),(!r.paused()||o.endList&&r.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),r.paused()||n.load()}),e.on("error",Vn[i](i,t))}},Ux={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[i]:{groups:o,tracks:l,logger_:h}},mainPlaylistLoader:c}=e,p=Os(c.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},p&&(a[i].main.default.playlists=c.main.playlists));for(const _ in a[i]){o[_]||(o[_]=[]);for(const E in a[i][_]){let g=a[i][_][E],b;if(p?(h(`AUDIO group '${_}' label '${E}' is a main playlist`),g.isMainPlaylist=!0,b=null):r==="vhs-json"&&g.playlists?b=new sr(g.playlists[0],t,n):g.resolvedUri?b=new sr(g.resolvedUri,t,n):g.playlists&&r==="dash"?b=new Eo(g.playlists[0],t,n,c):b=null,g=Se({id:E,playlistLoader:b},g),ec[i](i,g.playlistLoader,e),o[_].push(g),typeof l[E]=="undefined"){const C=new G.AudioTrack({id:E,kind:Mx(g),enabled:!1,language:g.language,default:g.default,label:E});l[E]=C}}}s.on("error",Vn[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:s,segmentLoaders:{[i]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[i]:{groups:l,tracks:h}},mainPlaylistLoader:c}=e;for(const p in o[i]){l[p]||(l[p]=[]);for(const _ in o[i][p]){if(!r.options_.useForcedSubtitles&&o[i][p][_].forced)continue;let E=o[i][p][_],g;if(s==="hls")g=new sr(E.resolvedUri,r,a);else if(s==="dash"){if(!E.playlists.filter(C=>C.excludeUntil!==1/0).length)return;g=new Eo(E.playlists[0],r,a,c)}else s==="vhs-json"&&(g=new sr(E.playlists?E.playlists[0]:E.resolvedUri,r,a));if(E=Se({id:_,playlistLoader:g},E),ec[i](i,E.playlistLoader,e),l[p].push(E),typeof h[_]=="undefined"){const b=t.addRemoteTextTrack({id:_,kind:"subtitles",default:E.default&&E.autoselect,language:E.language,label:_},!1).track;h[_]=b}}}n.on("error",Vn[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:s,tracks:n}}}=e;for(const a in r[i]){s[a]||(s[a]=[]);for(const o in r[i][a]){const l=r[i][a][o];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const h=t.options_.vhs&&t.options_.vhs.captionServices||{};let c={label:o,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(h[c.instreamId]&&(c=Se(c,h[c.instreamId])),c.default===void 0&&delete c.default,s[a].push(Se({id:o},l)),typeof n[o]=="undefined"){const p=t.addRemoteTextTrack({id:c.instreamId,kind:"captions",default:c.default,language:c.language,label:c.label},!1).track;n[o]=p}}}}},ap=(i,e)=>{for(let t=0;tt=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:s}}}=e,n=r.media();if(!n)return null;let a=null;n.attributes[i]&&(a=s[n.attributes[i]]);const o=Object.keys(s);if(!a)if(i==="AUDIO"&&o.length>1&&Os(e.main))for(let l=0;ll.id===t.id)[0]||null},Vx={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].enabled)return t[r];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].mode==="showing"||t[r].mode==="hidden")return t[r];return null}},$x=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},Hx=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(h=>{Ux[h](h,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:s,segmentLoaders:{["AUDIO"]:n,main:a}}=i;["AUDIO","SUBTITLES"].forEach(h=>{e[h].activeGroup=jx(h,i),e[h].activeTrack=Vx[h](h,i),e[h].onGroupChanged=Bx(h,i),e[h].onGroupChanging=Nx(h,i),e[h].onTrackChanged=Fx(h,i),e[h].getActiveGroup=$x(h,i)});const o=e.AUDIO.activeGroup();if(o){const h=(o.filter(p=>p.default)[0]||o[0]).id;e.AUDIO.tracks[h].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanging())});const l=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",l),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{r.audioTracks().removeEventListener("change",l),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const h in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[h])},Gx=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ni,activeTrack:ni,getActiveGroup:ni,onGroupChanged:ni,onTrackChanged:ni,lastTrack_:null,logger_:Nt(`MediaGroups[${e}]`)}}),i},qx=10;let ri;const Wx=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],zx=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},Kx=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:l}){if(!r)return G.log.warn("We received no playlist to switch to. Please check your stream."),!1;const h=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return l(`${h} as current playlist is not set`),!0;if(r.id===i.id)return!1;const c=Boolean(rr(e,t).length);if(!i.endList)return!c&&typeof i.partTargetDuration=="number"?(l(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${h} as current playlist is live`),!0);const p=Au(e,t),_=o?Ge.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ge.MAX_BUFFER_LOW_WATER_LINE;if(a<_)return l(`${h} as duration < max low water line (${a} < ${_})`),!0;const E=r.attributes.BANDWIDTH,g=i.attributes.BANDWIDTH;if(Eg)&&p>=s){let b=`${h} as forwardBuffer >= bufferLowWaterLine (${p} >= ${s})`;return o&&(b+=` and next bandwidth > current bandwidth (${E} > ${g})`),l(b),!0}return l(`not ${h} as no switching criteria met`),!1};class Xx extends G.EventTarget{constructor(e){super();const{src:t,withCredentials:r,tech:s,bandwidth:n,externVhs:a,useCueTags:o,playlistExclusionDuration:l,enableLowInitialPlaylist:h,sourceType:c,cacheEncryptionKeys:p,bufferBasedABR:_,leastPixelDiffSelector:E,captionServices:g}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:b}=e;(b===null||typeof b=="undefined")&&(b=1/0),ri=a,this.bufferBasedABR=Boolean(_),this.leastPixelDiffSelector=Boolean(E),this.withCredentials=r,this.tech_=s,this.vhs_=s.vhs,this.sourceType_=c,this.useCueTags_=o,this.playlistExclusionDuration=l,this.maxPlaylistRetries=b,this.enableLowInitialPlaylist=h,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:b,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Gx(),this.mediaSource=new R.MediaSource,this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.seekable_=Ye(),this.hasPlayed_=!1,this.syncController_=new kx(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Rx,this.sourceUpdater_=new np(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Ox;const C={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,calculateTimestampOffsetForEachSegment:e.calculateTimestampOffsetForEachSegment,captionServices:g,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:n,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:p,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new Eo(t,this.vhs_,Se(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new sr(t,this.vhs_,Se(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Co(Se(C,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Co(Se(C,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Dx(Se(C,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((y,D)=>{function S(){s.off("vttjserror",v),y()}function v(){s.off("vttjsloaded",S),D()}s.one("vttjsloaded",S),s.one("vttjserror",v),s.addWebVttScript_()})}),e),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Wx.forEach(y=>{this[y+"_"]=zx.bind(this,y)}),this.logger_=Nt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const x=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(x,()=>{const y=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-y,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const s=this.media(),n=s&&(s.id||s.uri),a=e.id||e.uri;n&&n!==a&&(this.logger_(`switch media ${n} -> ${a} from ${t}`),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})),this.mainPlaylistLoader_.media(e,r)}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=R.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(R.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const r=e.mediaGroups.AUDIO,s=Object.keys(r);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const o=r.main||s.length&&r[s[0]];for(const l in o)if(o[l].default){n={label:l};break}}if(!n)return t;const a=[];for(const o in r)if(r[o][n.label]){const l=r[o][n.label];if(l.playlists&&l.playlists.length)a.push.apply(a,l.playlists);else if(l.uri)a.push(l);else if(e.playlists.length)for(let h=0;h{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;vo(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),Hx({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;vo(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();if(e.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const r=e.mediaGroups||{};let s=!0;const n=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const o in r.AUDIO[a])r.AUDIO[a][o].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),ri.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(r.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return Kx({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.mainSegmentLoader_.on("earlyabort",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:qx}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();!t||this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()})}mediaSecondsLoaded_(){return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded+this.mainSegmentLoader_.mediaSecondsLoaded)}load(){this.mainSegmentLoader_.load(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.load(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.load()}fastQualityChange_(e=this.selectPlaylist()){if(e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.resetMainLoaderReplaceSegments()}resetMainLoaderReplaceSegments(){const e=this.tech_.buffered(),t=e.end(e.length-1);this.mainSegmentLoader_.replaceSegmentsUntil=t,this.mainSegmentLoader_.resetLoaderProperties(),this.mainSegmentLoader_.resetLoader()}play(){if(this.setupFirstPlay())return;this.tech_.ended()&&this.tech_.setCurrentTime(0),this.hasPlayed_&&this.load();const e=this.tech_.seekable();if(this.tech_.duration()===1/0&&this.tech_.currentTime(){})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}!e||(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const s=ri.Playlist.playlistEnd(e,r),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return s-n<=Ht;const o=a.end(a.length-1);return o-n<=Ht&&s-o<=Ht}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,n=s.filter(ca),a=n.length===1&&n[0]===e;if(s.length===1&&r!==1/0)return G.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){let E=!1;s.forEach(g=>{if(g===e)return;const b=g.excludeUntil;typeof b!="undefined"&&b!==1/0&&(E=!0,delete g.excludeUntil)}),E&&(G.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+r*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const l=this.selectPlaylist();if(!l){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const h=t.internal?this.logger_:G.log.warn,c=t.message?" "+t.message:"";h(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${c} Switching to playlist ${l.id}.`),l.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),l.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const p=l.targetDuration/2*1e3||5*1e3,_=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=p;return this.switchMedia_(l,"exclude",a||_)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],s=e==="all";(s||e==="main")&&r.push(this.mainPlaylistLoader_);const n=[];(s||e==="audio")&&n.push("AUDIO"),(s||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&r.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&r.push(o)}),r.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=rr(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.resetEverything(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.resetEverything(),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:ri.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}onSyncInfoUpdate_(){let e;if(!this.mainPlaylistLoader_)return;let t=this.mainPlaylistLoader_.media();if(!t)return;let r=this.syncController_.getExpiredTime(t,this.duration());if(r===null)return;const s=this.mainPlaylistLoader_.main,n=ri.Playlist.seekable(t,r,ri.Playlist.liveEdgeDelay(s,t));if(n.length===0||this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.mediaTypes_.AUDIO.activePlaylistLoader.media(),r=this.syncController_.getExpiredTime(t,this.duration()),r===null||(e=ri.Playlist.seekable(t,r,ri.Playlist.liveEdgeDelay(s,t)),e.length===0)))return;let a,o;this.seekable_&&this.seekable_.length&&(a=this.seekable_.end(0),o=this.seekable_.start(0)),e?e.start(0)>n.end(0)||n.start(0)>e.end(0)?this.seekable_=n:this.seekable_=Ye([[e.start(0)>n.start(0)?e.start(0):n.start(0),e.end(0)0&&(r=Math.max(r,t.end(t.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const r in t)t[r].forEach(s=>{s.playlistLoader&&s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=ps(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=r.video||e.main.videoCodec||Tg),e.main.isMuxed&&(s.video+=`,${r.audio||e.main.audioCodec||Bl}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||Bl,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(h,c)=>h?hn(c):Ma(c),o={};let l;if(["video","audio"].forEach(function(h){if(s.hasOwnProperty(h)&&!a(e[h].isFmp4,s[h])){const c=e[h].isFmp4?"browser":"muxer";o[c]=o[c]||[],o[c].push(s[h]),h==="audio"&&(l=c)}}),n&&l&&t.attributes.AUDIO){const h=t.attributes.AUDIO;this.main().playlists.forEach(c=>{(c.attributes&&c.attributes.AUDIO)===h&&c!==t&&(c.excludeUntil=1/0)}),this.logger_(`excluding audio group ${h} as ${l} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){const h=Object.keys(o).reduce((c,p)=>(c&&(c+=", "),c+=`${p} does not support codec(s): "${o[p].join(",")}"`,c),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:h},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const h=[];if(["video","audio"].forEach(c=>{const p=(jt(this.sourceUpdater_.codecs[c]||"")[0]||{}).type,_=(jt(s[c]||"")[0]||{}).type;p&&_&&p.toLowerCase()!==_.toLowerCase()&&h.push(`"${this.sourceUpdater_.codecs[c]}" -> "${s[c]}"`)}),h.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${h.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const s=e[r];if(t.indexOf(s.id)!==-1)return;t.push(s.id);const n=ps(this.main,s),a=[];n.audio&&!Ma(n.audio)&&!hn(n.audio)&&a.push(`audio codec ${n.audio}`),n.video&&!Ma(n.video)&&!hn(n.video)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,s=Fn(jt(e)),n=Vd(s),a=s.video&&jt(s.video)[0]||null,o=s.audio&&jt(s.audio)[0]||null;Object.keys(r).forEach(l=>{const h=r[l];if(t.indexOf(h.id)!==-1||h.excludeUntil===1/0)return;t.push(h.id);const c=[],p=ps(this.mainPlaylistLoader_.main,h),_=Vd(p);if(!(!p.audio&&!p.video)){if(_!==n&&c.push(`codec count "${_}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const E=p.video&&jt(p.video)[0]||null,g=p.audio&&jt(p.audio)[0]||null;E&&a&&E.type.toLowerCase()!==a.type.toLowerCase()&&c.push(`video codec "${E.type}" !== "${a.type}"`),g&&o&&g.type.toLowerCase()!==o.type.toLowerCase()&&c.push(`audio codec "${g.type}" !== "${o.type}"`)}c.length&&(h.excludeUntil=1/0,this.logger_(`excluding ${h.id}: ${c.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),Lx(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Ge.GOAL_BUFFER_LENGTH,r=Ge.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,Ge.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Ge.BUFFER_LOW_WATER_LINE,r=Ge.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,Ge.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Ge.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?n:s)}bufferHighWaterLine(){return Ge.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Gd(this.inbandTextTracks_,"com.apple.streaming",this.tech_),cx({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Gd(this.inbandTextTracks_,e,this.tech_),ux({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:r})}}const Yx=(i,e,t)=>r=>{const s=i.main.playlists[e],n=wu(s),a=ca(s);return typeof r=="undefined"?a:(r?delete s.disabled:s.disabled=!0,r!==a&&!n&&(t(),r?i.trigger("renditionenabled"):i.trigger("renditiondisabled")),r)};class Qx{constructor(e,t,r){const{playlistController_:s}=e,n=s.fastQualityChange_.bind(s);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=ps(s.main(),t),this.playlist=t,this.id=r,this.enabled=Yx(e.playlists,t.id,n)}}const Jx=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=Os(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!wu(r)).map((r,s)=>new Qx(i,r,r.id)):[]}},tc=["seeking","seeked","pause","playing","error"];class Zx{constructor(e){this.playlistController_=e.playlistController,this.tech_=e.tech,this.seekable=e.seekable,this.allowSeeksWithinUnsafeLiveWindow=e.allowSeeksWithinUnsafeLiveWindow,this.liveRangeSafeTimeDelta=e.liveRangeSafeTimeDelta,this.media=e.media,this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Nt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],l={};o.forEach(c=>{l[c]={reset:()=>this.resetSegmentDownloads_(c),updateend:()=>this.checkSegmentDownloads_(c)},a[`${c}SegmentLoader_`].on("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].on("playlistupdate",l[c].reset),this.tech_.on(["seeked","seeking"],l[c].reset)});const h=c=>{["main","audio"].forEach(p=>{a[`${p}SegmentLoader_`][c]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),h("off"))},this.clearSeekingAppendCheck_=()=>h("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),h("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(tc,n),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(tc,n),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(c=>{a[`${c}SegmentLoader_`].off("appendsdone",l[c].updateend),a[`${c}SegmentLoader_`].off("playlistupdate",l[c].reset),this.tech_.off(["seeked","seeking"],l[c].reset)}),this.checkCurrentTimeTimeout_&&R.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&R.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=R.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,r=t[`${e}SegmentLoader_`],s=r.buffered_(),n=Hy(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,n){this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:r.playlist_&&r.playlist_.id,buffered:Ri(s)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+Ht>=t.end(t.length-1)))return this.techWaiting_();this.consecutiveUpdates>=5&&e===this.lastRecordedTime?(this.consecutiveUpdates++,this.waiting_()):e===this.lastRecordedTime?this.consecutiveUpdates++:(this.consecutiveUpdates=0,this.lastRecordedTime=e)}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),r=this.tech_.currentTime(),s=this.afterSeekableWindow_(t,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(s&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,r)){const g=t.start(0);n=g+(g===t.end(0)?0:Ht)}if(typeof n!="undefined")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${bf(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,h=a.videoBuffer?a.videoBuffered():null,c=this.media(),p=c.partTargetDuration?c.partTargetDuration:(c.targetDuration-xi)*2,_=[l,h];for(let g=0;g<_.length;g++){if(!_[g])continue;if(Au(_[g],r) ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=ln(s,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+Ht;const a=!r.endList,o=typeof r.partTargetDuration=="number";return a&&(o||s)&&(n=e.end(e.length-1)+r.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t2)return{start:n,end:a}}return null}}const e2={errorInterval:30,getSource(i){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(t)}},op=function(i,e){let t=0,r=0;const s=Se(e2,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){r&&i.currentTime(r)},a=function(c){c!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",n),i.src(c),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},o=function(){if(Date.now()-t{Object.defineProperty(Re,i,{get(){return G.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Ge[i]},set(e){if(G.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){G.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Ge[i]=e}})});const lp="videojs-vhs",dp=function(i,e){const t=e.media();let r=-1;for(let s=0;s{i.addQualityLevel(t)}),dp(i,e.playlists)};Re.canPlaySource=function(){return G.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const o2=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=Fn(jt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const s=ms(r.video),n=ms(r.audio),a={};for(const o in i)a[o]={},n&&(a[o].audioContentType=n),s&&(a[o].videoContentType=s),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof i[o]=="string"&&(a[o].url=i[o]);return Se(i,a)},u2=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const s=e.reduce((n,a)=>{const o=r.contentProtection[a];return o&&o.pssh&&(n[a]={pssh:o.pssh}),n},{});return Object.keys(s).length&&t.push(s),t},[]),l2=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const s=t?r.concat([t]):r,n=u2(s,Object.keys(e)),a=[],o=[];return n.forEach(l=>{o.push(new Promise((h,c)=>{i.tech_.one("keysessioncreated",h)})),a.push(new Promise((h,c)=>{i.eme.initializeMediaKeys({keySystems:l},p=>{if(p){c(p);return}h()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},d2=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const s=o2(e,t,r);return s?(i.currentSource().keySystems=s,s&&!i.eme?(G.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},cp=()=>{if(!R.localStorage)return null;const i=R.localStorage.getItem(lp);if(!i)return null;try{return JSON.parse(i)}catch(e){return null}},c2=i=>{if(!R.localStorage)return!1;let e=cp();e=e?Se(e,i):i;try{R.localStorage.setItem(lp,JSON.stringify(e))}catch(t){return!1}return e},h2=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,hp=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},fp=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},pp=(i,e)=>{!i._requestCallbackSet||(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},mp=(i,e)=>{!i._responseCallbackSet||(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};Re.supportsNativeHls=function(){if(!J||!J.createElement)return!1;const i=J.createElement("video");return G.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(i.canPlayType(t))}):!1}();Re.supportsNativeDash=function(){return!J||!J.createElement||!G.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(J.createElement("video").canPlayType("application/dash+xml"))}();Re.supportsTypeNatively=i=>i==="hls"?Re.supportsNativeHls:i==="dash"?Re.supportsNativeDash:!1;Re.isSupported=function(){return G.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Re.xhr.onRequest=function(i){hp(Re.xhr,i)};Re.xhr.onResponse=function(i){fp(Re.xhr,i)};Re.xhr.offRequest=function(i){pp(Re.xhr,i)};Re.xhr.offResponse=function(i){mp(Re.xhr,i)};const f2=G.getComponent("Component");class gp extends f2{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=Nt("VhsHandler"),t.options_&&t.options_.playerId){const s=G.getPlayer(t.options_.playerId);this.player_=s}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(J,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],s=>{const n=J.fullscreenElement||J.webkitFullscreenElement||J.mozFullScreenElement||J.msFullscreenElement;n&&n.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(){if(this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage!="undefined"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.calculateTimestampOffsetForEachSegment=this.options_.calculateTimestampOffsetForEachSegment||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const e=cp();e&&e.bandwidth&&(this.options_.bandwidth=e.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),e&&e.throughput&&(this.options_.throughput=e.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ge.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ge.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","calculateTimestampOffsetForEachSegment","exactManifestTimings","leastPixelDiffSelector"].forEach(e=>{typeof this.source_[e]!="undefined"&&(this.options_[e]=this.source_[e])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=h2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Re,this.options_.sourceType=gc(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.playlistController_=new Xx(this.options_);const r=Se({liveRangeSafeTimeDelta:Ht},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Zx(r),this.playlistController_.on("error",()=>{const n=G.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),n.error(a)});const s=this.options_.bufferBasedABR?Re.movingAverageBandwidthSelector(.55):Re.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=Re.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(n){this.playlistController_.selectPlaylist=n.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(n){this.playlistController_.mainSegmentLoader_.throughput.rate=n,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let n=this.playlistController_.mainSegmentLoader_.bandwidth;const a=R.navigator.connection||R.navigator.mozConnection||R.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=o&&n>=o?n=Math.max(n,l):n=l}return n},set(n){this.playlistController_.mainSegmentLoader_.bandwidth=n,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const n=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(n+a))},set(){G.log.error('The "systemBandwidth" property is read-only')}}}),this.options_.bandwidth&&(this.bandwidth=this.options_.bandwidth),this.options_.throughput&&(this.throughput=this.options_.throughput),Object.defineProperties(this.stats,{bandwidth:{get:()=>this.bandwidth||0,enumerable:!0},mediaRequests:{get:()=>this.playlistController_.mediaRequests_()||0,enumerable:!0},mediaRequestsAborted:{get:()=>this.playlistController_.mediaRequestsAborted_()||0,enumerable:!0},mediaRequestsTimedout:{get:()=>this.playlistController_.mediaRequestsTimedout_()||0,enumerable:!0},mediaRequestsErrored:{get:()=>this.playlistController_.mediaRequestsErrored_()||0,enumerable:!0},mediaTransferDuration:{get:()=>this.playlistController_.mediaTransferDuration_()||0,enumerable:!0},mediaBytesTransferred:{get:()=>this.playlistController_.mediaBytesTransferred_()||0,enumerable:!0},mediaSecondsLoaded:{get:()=>this.playlistController_.mediaSecondsLoaded_()||0,enumerable:!0},mediaAppends:{get:()=>this.playlistController_.mediaAppends_()||0,enumerable:!0},mainAppendsToLoadedData:{get:()=>this.playlistController_.mainAppendsToLoadedData_()||0,enumerable:!0},audioAppendsToLoadedData:{get:()=>this.playlistController_.audioAppendsToLoadedData_()||0,enumerable:!0},appendsToLoadedData:{get:()=>this.playlistController_.appendsToLoadedData_()||0,enumerable:!0},timeToLoadedData:{get:()=>this.playlistController_.timeToLoadedData_()||0,enumerable:!0},buffered:{get:()=>Ri(this.tech_.buffered()),enumerable:!0},currentTime:{get:()=>this.tech_.currentTime(),enumerable:!0},currentSource:{get:()=>this.tech_.currentSource_,enumerable:!0},currentTech:{get:()=>this.tech_.name_,enumerable:!0},duration:{get:()=>this.tech_.duration(),enumerable:!0},main:{get:()=>this.playlists.main,enumerable:!0},playerDimensions:{get:()=>this.tech_.currentDimensions(),enumerable:!0},seekable:{get:()=>Ri(this.tech_.seekable()),enumerable:!0},timestamp:{get:()=>Date.now(),enumerable:!0},videoPlaybackQuality:{get:()=>this.tech_.getVideoPlaybackQuality(),enumerable:!0}}),this.tech_.one("canplay",this.playlistController_.setupFirstPlay.bind(this.playlistController_)),this.tech_.on("bandwidthupdate",()=>{this.options_.useBandwidthFromLocalStorage&&c2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Jx(this)}),this.playlistController_.sourceUpdater_.on("createdsourcebuffers",()=>{this.setupEme_()}),this.on(this.playlistController_,"progress",function(){this.tech_.trigger("progress")}),this.on(this.playlistController_,"firstplay",function(){this.ignoreNextSeekingEvent_=!0}),this.setupQualityLevels_(),this.tech_.el()&&(this.mediaSourceUrl_=R.URL.createObjectURL(this.playlistController_.mediaSource),this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),l2({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=d2({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{if(r.status!=="output-restricted")return;const s=this.playlistController_.main();if(!s||!s.playlists)return;const n=[];s.playlists.forEach(a=>{a&&a.attributes&&a.attributes.RESOLUTION&&a.attributes.RESOLUTION.height>=720&&(!a.excludeUntil||a.excludeUntil<1/0)&&(a.excludeUntil=1/0,n.push(a))}),n.length&&(G.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.',...n),this.playlistController_.mainSegmentLoader_.resetEverything(),this.playlistController_.fastQualityChange_())}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=G.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{a2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{dp(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":up,"mux.js":i2,"mpd-parser":r2,"m3u8-parser":s2,"aes-decrypter":n2}}version(){return this.constructor.version()}canChangeType(){return np.canChangeType()}play(){this.playlistController_.play()}setCurrentTime(e){this.playlistController_.setCurrentTime(e)}duration(){return this.playlistController_.duration()}seekable(){return this.playlistController_.seekable()}dispose(){this.playbackWatcher_&&this.playbackWatcher_.dispose(),this.playlistController_&&this.playlistController_.dispose(),this.qualityLevels_&&this.qualityLevels_.dispose(),this.tech_&&this.tech_.vhs&&delete this.tech_.vhs,this.mediaSourceUrl_&&R.URL.revokeObjectURL&&(R.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return bT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,s=2){return $f({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{hp(this.xhr,e)},this.xhr.onResponse=e=>{fp(this.xhr,e)},this.xhr.offRequest=e=>{pp(this.xhr,e)},this.xhr.offResponse=e=>{mp(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}}const $n={name:"videojs-http-streaming",VERSION:up,canHandleSource(i,e={}){const t=Se(G.options,e);return $n.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=Se(G.options,t);return e.vhs=new gp(i,e,r),e.vhs.xhr=Nf(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=gc(i);if(!t)return"";const r=$n.getOverrideNative(e);return!Re.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(G.browser.IS_ANY_SAFARI||G.browser.IS_IOS),{overrideNative:r=t}=e;return r}},p2=()=>hn("avc1.4d400d,mp4a.40.2");p2()&&G.getTech("Html5").registerSourceHandler($n,0);G.VhsHandler=gp;G.VhsSourceHandler=$n;G.Vhs=Re;G.use||G.registerComponent("Vhs",Re);G.options.vhs=G.options.vhs||{};(!G.getPlugin||!G.getPlugin("reloadSourceOnError"))&&G.registerPlugin("reloadSourceOnError",t2);const m2=wo({__name:"m3up",props:{url:{type:String,default:""}},setup(i){const e=i,t=Qa(null),r=Qa(null);rc(()=>{s()});function s(){const n=e.url;n&&(r.value=G(t.value,{controls:!1,autoplay:!0,muted:!0,width:"100%",height:"100%",sources:[{src:n,type:"application/x-mpegURL"}]}),r.value&&r.value.on("play",()=>{}))}return sc(()=>{var n;r.value&&((n=r.value)==null||n.dispose())}),(n,a)=>(os(),Lo("video",{ref_key:"videoRef",ref:t,class:"w-full h-full myvideo",autoplay:"",controls:""},null,512))}});var _p={exports:{}};(function(i,e){(function(r,s){i.exports=s()})(self,function(){return function(){var t={"./node_modules/es6-promise/dist/es6-promise.js":function(a,o,l){/*! * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE * @version v4.2.8+1e68dce6 */(function(h,c){a.exports=c()})(this,function(){function h(W){var Z=typeof W;return W!==null&&(Z==="object"||Z==="function")}function c(W){return typeof W=="function"}var p=void 0;Array.isArray?p=Array.isArray:p=function(W){return Object.prototype.toString.call(W)==="[object Array]"};var _=p,E=0,g=void 0,b=void 0,C=function(Z,Y){N[E]=Z,N[E+1]=Y,E+=2,E===2&&(b?b($):q())};function x(W){b=W}function y(W){C=W}var D=typeof window!="undefined"?window:void 0,S=D||{},v=S.MutationObserver||S.WebKitMutationObserver,w=typeof self=="undefined"&&typeof process!="undefined"&&{}.toString.call(process)==="[object process]",L=typeof Uint8ClampedArray!="undefined"&&typeof importScripts!="undefined"&&typeof MessageChannel!="undefined";function O(){return function(){return process.nextTick($)}}function F(){return typeof g!="undefined"?function(){g($)}:B()}function V(){var W=0,Z=new v($),Y=document.createTextNode("");return Z.observe(Y,{characterData:!0}),function(){Y.data=W=++W%2}}function U(){var W=new MessageChannel;return W.port1.onmessage=$,function(){return W.port2.postMessage(0)}}function B(){var W=setTimeout;return function(){return W($,1)}}var N=new Array(1e3);function $(){for(var W=0;W0&&(Q=N[0]),Q instanceof Error)throw Q;var oe=new Error("Unhandled error."+(Q?" ("+Q.message+")":""));throw oe.context=Q,oe}var le=q[B];if(le===void 0)return!1;if(typeof le=="function")l(le,this,N);else for(var se=le.length,pe=v(le,se),$=0;$0&&Q.length>K&&!Q.warned){Q.warned=!0;var oe=new Error("Possible EventEmitter memory leak detected. "+Q.length+" "+String(B)+" listeners added. Use emitter.setMaxListeners() to increase limit");oe.name="MaxListenersExceededWarning",oe.emitter=U,oe.type=B,oe.count=Q.length,c(oe)}return U}_.prototype.addListener=function(B,N){return C(this,B,N,!1)},_.prototype.on=_.prototype.addListener,_.prototype.prependListener=function(B,N){return C(this,B,N,!0)};function x(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function y(U,B,N){var $={fired:!1,wrapFn:void 0,target:U,type:B,listener:N},K=x.bind($);return K.listener=N,$.wrapFn=K,K}_.prototype.once=function(B,N){return g(N),this.on(B,y(this,B,N)),this},_.prototype.prependOnceListener=function(B,N){return g(N),this.prependListener(B,y(this,B,N)),this},_.prototype.removeListener=function(B,N){var $,K,q,Q,oe;if(g(N),K=this._events,K===void 0)return this;if($=K[B],$===void 0)return this;if($===N||$.listener===N)--this._eventsCount===0?this._events=Object.create(null):(delete K[B],K.removeListener&&this.emit("removeListener",B,$.listener||N));else if(typeof $!="function"){for(q=-1,Q=$.length-1;Q>=0;Q--)if($[Q]===N||$[Q].listener===N){oe=$[Q].listener,q=Q;break}if(q<0)return this;q===0?$.shift():w($,q),$.length===1&&(K[B]=$[0]),K.removeListener!==void 0&&this.emit("removeListener",B,oe||N)}return this},_.prototype.off=_.prototype.removeListener,_.prototype.removeAllListeners=function(B){var N,$,K;if($=this._events,$===void 0)return this;if($.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):$[B]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete $[B]),this;if(arguments.length===0){var q=Object.keys($),Q;for(K=0;K=0;K--)this.removeListener(B,N[K]);return this};function D(U,B,N){var $=U._events;if($===void 0)return[];var K=$[B];return K===void 0?[]:typeof K=="function"?N?[K.listener||K]:[K]:N?L(K):v(K,K.length)}_.prototype.listeners=function(B){return D(this,B,!0)},_.prototype.rawListeners=function(B){return D(this,B,!1)},_.listenerCount=function(U,B){return typeof U.listenerCount=="function"?U.listenerCount(B):S.call(U,B)},_.prototype.listenerCount=S;function S(U){var B=this._events;if(B!==void 0){var N=B[U];if(typeof N=="function")return 1;if(N!==void 0)return N.length}return 0}_.prototype.eventNames=function(){return this._eventsCount>0?h(this._events):[]};function v(U,B){for(var N=new Array(B),$=0;$0},!1)}function C(x,y){for(var D={main:[y]},S={main:[]},v={main:{}};b(D);)for(var w=Object.keys(D),L=0;L=p[b]&&_0&&g[0].originalDts=b[y].dts&&gb[x].lastSample.originalDts&&g=b[x].lastSample.originalDts&&(x===b.length-1||x0&&(y=this._searchNearestSegmentBefore(C.originalBeginDts)+1),this._lastAppendLocation=y,this._list.splice(y,0,C)},E.prototype.getLastSegmentBefore=function(g){var b=this._searchNearestSegmentBefore(g);return b>=0?this._list[b]:null},E.prototype.getLastSampleBefore=function(g){var b=this.getLastSegmentBefore(g);return b!=null?b.lastSample:null},E.prototype.getLastSyncPointBefore=function(g){for(var b=this._searchNearestSegmentBefore(g),C=this._list[b].syncPoints;C.length===0&&b>0;)b--,C=this._list[b].syncPoints;return C.length>0?C[C.length-1]:null},E}()},"./src/core/mse-controller.js":function(a,o,l){l.r(o);var h=l("./node_modules/events/events.js"),c=l.n(h),p=l("./src/utils/logger.js"),_=l("./src/utils/browser.js"),E=l("./src/core/mse-events.js"),g=l("./src/core/media-segment-info.js"),b=l("./src/utils/exception.js"),C=function(){function x(y){this.TAG="MSEController",this._config=y,this._emitter=new(c()),this._config.isLive&&this._config.autoCleanupSourceBuffer==null&&(this._config.autoCleanupSourceBuffer=!0),this.e={onSourceOpen:this._onSourceOpen.bind(this),onSourceEnded:this._onSourceEnded.bind(this),onSourceClose:this._onSourceClose.bind(this),onSourceBufferError:this._onSourceBufferError.bind(this),onSourceBufferUpdateEnd:this._onSourceBufferUpdateEnd.bind(this)},this._mediaSource=null,this._mediaSourceObjectURL=null,this._mediaElement=null,this._isBufferFull=!1,this._hasPendingEos=!1,this._requireSetMediaDuration=!1,this._pendingMediaDuration=0,this._pendingSourceBufferInit=[],this._mimeTypes={video:null,audio:null},this._sourceBuffers={video:null,audio:null},this._lastInitSegments={video:null,audio:null},this._pendingSegments={video:[],audio:[]},this._pendingRemoveRanges={video:[],audio:[]},this._idrList=new g.IDRSampleList}return x.prototype.destroy=function(){(this._mediaElement||this._mediaSource)&&this.detachMediaElement(),this.e=null,this._emitter.removeAllListeners(),this._emitter=null},x.prototype.on=function(y,D){this._emitter.addListener(y,D)},x.prototype.off=function(y,D){this._emitter.removeListener(y,D)},x.prototype.attachMediaElement=function(y){if(this._mediaSource)throw new b.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");var D=this._mediaSource=new window.MediaSource;D.addEventListener("sourceopen",this.e.onSourceOpen),D.addEventListener("sourceended",this.e.onSourceEnded),D.addEventListener("sourceclose",this.e.onSourceClose),this._mediaElement=y,this._mediaSourceObjectURL=window.URL.createObjectURL(this._mediaSource),y.src=this._mediaSourceObjectURL},x.prototype.detachMediaElement=function(){if(this._mediaSource){var y=this._mediaSource;for(var D in this._sourceBuffers){var S=this._pendingSegments[D];S.splice(0,S.length),this._pendingSegments[D]=null,this._pendingRemoveRanges[D]=null,this._lastInitSegments[D]=null;var v=this._sourceBuffers[D];if(v){if(y.readyState!=="closed"){try{y.removeSourceBuffer(v)}catch(w){p.default.e(this.TAG,w.message)}v.removeEventListener("error",this.e.onSourceBufferError),v.removeEventListener("updateend",this.e.onSourceBufferUpdateEnd)}this._mimeTypes[D]=null,this._sourceBuffers[D]=null}}if(y.readyState==="open")try{y.endOfStream()}catch(w){p.default.e(this.TAG,w.message)}y.removeEventListener("sourceopen",this.e.onSourceOpen),y.removeEventListener("sourceended",this.e.onSourceEnded),y.removeEventListener("sourceclose",this.e.onSourceClose),this._pendingSourceBufferInit=[],this._isBufferFull=!1,this._idrList.clear(),this._mediaSource=null}this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src"),this._mediaElement=null),this._mediaSourceObjectURL&&(window.URL.revokeObjectURL(this._mediaSourceObjectURL),this._mediaSourceObjectURL=null)},x.prototype.appendInitSegment=function(y,D){if(!this._mediaSource||this._mediaSource.readyState!=="open"){this._pendingSourceBufferInit.push(y),this._pendingSegments[y.type].push(y);return}var S=y,v=""+S.container;S.codec&&S.codec.length>0&&(v+=";codecs="+S.codec);var w=!1;if(p.default.v(this.TAG,"Received Initialization Segment, mimeType: "+v),this._lastInitSegments[S.type]=S,v!==this._mimeTypes[S.type]){if(this._mimeTypes[S.type])p.default.v(this.TAG,"Notice: "+S.type+" mimeType changed, origin: "+this._mimeTypes[S.type]+", target: "+v);else{w=!0;try{var L=this._sourceBuffers[S.type]=this._mediaSource.addSourceBuffer(v);L.addEventListener("error",this.e.onSourceBufferError),L.addEventListener("updateend",this.e.onSourceBufferUpdateEnd)}catch(O){p.default.e(this.TAG,O.message),this._emitter.emit(E.default.ERROR,{code:O.code,msg:O.message});return}}this._mimeTypes[S.type]=v}D||this._pendingSegments[S.type].push(S),w||this._sourceBuffers[S.type]&&!this._sourceBuffers[S.type].updating&&this._doAppendSegments(),_.default.safari&&S.container==="audio/mpeg"&&S.mediaDuration>0&&(this._requireSetMediaDuration=!0,this._pendingMediaDuration=S.mediaDuration/1e3,this._updateMediaSourceDuration())},x.prototype.appendMediaSegment=function(y){var D=y;this._pendingSegments[D.type].push(D),this._config.autoCleanupSourceBuffer&&this._needCleanupSourceBuffer()&&this._doCleanupSourceBuffer();var S=this._sourceBuffers[D.type];S&&!S.updating&&!this._hasPendingRemoveRanges()&&this._doAppendSegments()},x.prototype.seek=function(y){for(var D in this._sourceBuffers)if(!!this._sourceBuffers[D]){var S=this._sourceBuffers[D];if(this._mediaSource.readyState==="open")try{S.abort()}catch(V){p.default.e(this.TAG,V.message)}this._idrList.clear();var v=this._pendingSegments[D];if(v.splice(0,v.length),this._mediaSource.readyState!=="closed"){for(var w=0;w=1&&y-v.start(0)>=this._config.autoCleanupMaxBackwardDuration)return!0}}return!1},x.prototype._doCleanupSourceBuffer=function(){var y=this._mediaElement.currentTime;for(var D in this._sourceBuffers){var S=this._sourceBuffers[D];if(S){for(var v=S.buffered,w=!1,L=0;L=this._config.autoCleanupMaxBackwardDuration){w=!0;var V=y-this._config.autoCleanupMinBackwardDuration;this._pendingRemoveRanges[D].push({start:O,end:V})}}else F0&&(isNaN(D)||S>D)&&(p.default.v(this.TAG,"Update MediaSource duration from "+D+" to "+S),this._mediaSource.duration=S),this._requireSetMediaDuration=!1,this._pendingMediaDuration=0}},x.prototype._doRemoveRanges=function(){for(var y in this._pendingRemoveRanges)if(!(!this._sourceBuffers[y]||this._sourceBuffers[y].updating))for(var D=this._sourceBuffers[y],S=this._pendingRemoveRanges[y];S.length&&!D.updating;){var v=S.shift();D.remove(v.start,v.end)}},x.prototype._doAppendSegments=function(){var y=this._pendingSegments;for(var D in y)if(!(!this._sourceBuffers[D]||this._sourceBuffers[D].updating)&&y[D].length>0){var S=y[D].shift();if(S.timestampOffset){var v=this._sourceBuffers[D].timestampOffset,w=S.timestampOffset/1e3,L=Math.abs(v-w);L>.1&&(p.default.v(this.TAG,"Update MPEG audio timestampOffset from "+v+" to "+w),this._sourceBuffers[D].timestampOffset=w),delete S.timestampOffset}if(!S.data||S.data.byteLength===0)continue;try{this._sourceBuffers[D].appendBuffer(S.data),this._isBufferFull=!1,D==="video"&&S.hasOwnProperty("info")&&this._idrList.appendArray(S.info.syncPoints)}catch(O){this._pendingSegments[D].unshift(S),O.code===22?(this._isBufferFull||this._emitter.emit(E.default.BUFFER_FULL),this._isBufferFull=!0):(p.default.e(this.TAG,O.message),this._emitter.emit(E.default.ERROR,{code:O.code,msg:O.message}))}}},x.prototype._onSourceOpen=function(){if(p.default.v(this.TAG,"MediaSource onSourceOpen"),this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._pendingSourceBufferInit.length>0)for(var y=this._pendingSourceBufferInit;y.length;){var D=y.shift();this.appendInitSegment(D,!0)}this._hasPendingSegments()&&this._doAppendSegments(),this._emitter.emit(E.default.SOURCE_OPEN)},x.prototype._onSourceEnded=function(){p.default.v(this.TAG,"MediaSource onSourceEnded")},x.prototype._onSourceClose=function(){p.default.v(this.TAG,"MediaSource onSourceClose"),this._mediaSource&&this.e!=null&&(this._mediaSource.removeEventListener("sourceopen",this.e.onSourceOpen),this._mediaSource.removeEventListener("sourceended",this.e.onSourceEnded),this._mediaSource.removeEventListener("sourceclose",this.e.onSourceClose))},x.prototype._hasPendingSegments=function(){var y=this._pendingSegments;return y.video.length>0||y.audio.length>0},x.prototype._hasPendingRemoveRanges=function(){var y=this._pendingRemoveRanges;return y.video.length>0||y.audio.length>0},x.prototype._onSourceBufferUpdateEnd=function(){this._requireSetMediaDuration?this._updateMediaSourceDuration():this._hasPendingRemoveRanges()?this._doRemoveRanges():this._hasPendingSegments()?this._doAppendSegments():this._hasPendingEos&&this.endOfStream(),this._emitter.emit(E.default.UPDATE_END)},x.prototype._onSourceBufferError=function(y){p.default.e(this.TAG,"SourceBuffer Error: "+y)},x}();o.default=C},"./src/core/mse-events.js":function(a,o,l){l.r(o);var h={ERROR:"error",SOURCE_OPEN:"source_open",UPDATE_END:"update_end",BUFFER_FULL:"buffer_full"};o.default=h},"./src/core/transmuxer.js":function(a,o,l){l.r(o);var h=l("./node_modules/events/events.js"),c=l.n(h),p=l("./node_modules/webworkify-webpack/index.js"),_=l.n(p),E=l("./src/utils/logger.js"),g=l("./src/utils/logging-control.js"),b=l("./src/core/transmuxing-controller.js"),C=l("./src/core/transmuxing-events.js"),x=l("./src/core/media-info.js"),y=function(){function D(S,v){if(this.TAG="Transmuxer",this._emitter=new(c()),v.enableWorker&&typeof Worker!="undefined")try{this._worker=_()("./src/core/transmuxing-worker.js"),this._workerDestroying=!1,this._worker.addEventListener("message",this._onWorkerMessage.bind(this)),this._worker.postMessage({cmd:"init",param:[S,v]}),this.e={onLoggingConfigChanged:this._onLoggingConfigChanged.bind(this)},g.default.registerListener(this.e.onLoggingConfigChanged),this._worker.postMessage({cmd:"logging_config",param:g.default.getConfig()})}catch(L){E.default.e(this.TAG,"Error while initialize transmuxing worker, fallback to inline transmuxing"),this._worker=null,this._controller=new b.default(S,v)}else this._controller=new b.default(S,v);if(this._controller){var w=this._controller;w.on(C.default.IO_ERROR,this._onIOError.bind(this)),w.on(C.default.DEMUX_ERROR,this._onDemuxError.bind(this)),w.on(C.default.INIT_SEGMENT,this._onInitSegment.bind(this)),w.on(C.default.MEDIA_SEGMENT,this._onMediaSegment.bind(this)),w.on(C.default.LOADING_COMPLETE,this._onLoadingComplete.bind(this)),w.on(C.default.RECOVERED_EARLY_EOF,this._onRecoveredEarlyEof.bind(this)),w.on(C.default.MEDIA_INFO,this._onMediaInfo.bind(this)),w.on(C.default.METADATA_ARRIVED,this._onMetaDataArrived.bind(this)),w.on(C.default.SCRIPTDATA_ARRIVED,this._onScriptDataArrived.bind(this)),w.on(C.default.STATISTICS_INFO,this._onStatisticsInfo.bind(this)),w.on(C.default.RECOMMEND_SEEKPOINT,this._onRecommendSeekpoint.bind(this))}}return D.prototype.destroy=function(){this._worker?this._workerDestroying||(this._workerDestroying=!0,this._worker.postMessage({cmd:"destroy"}),g.default.removeListener(this.e.onLoggingConfigChanged),this.e=null):(this._controller.destroy(),this._controller=null),this._emitter.removeAllListeners(),this._emitter=null},D.prototype.on=function(S,v){this._emitter.addListener(S,v)},D.prototype.off=function(S,v){this._emitter.removeListener(S,v)},D.prototype.hasWorker=function(){return this._worker!=null},D.prototype.open=function(){this._worker?this._worker.postMessage({cmd:"start"}):this._controller.start()},D.prototype.close=function(){this._worker?this._worker.postMessage({cmd:"stop"}):this._controller.stop()},D.prototype.seek=function(S){this._worker?this._worker.postMessage({cmd:"seek",param:S}):this._controller.seek(S)},D.prototype.pause=function(){this._worker?this._worker.postMessage({cmd:"pause"}):this._controller.pause()},D.prototype.resume=function(){this._worker?this._worker.postMessage({cmd:"resume"}):this._controller.resume()},D.prototype._onInitSegment=function(S,v){var w=this;Promise.resolve().then(function(){w._emitter.emit(C.default.INIT_SEGMENT,S,v)})},D.prototype._onMediaSegment=function(S,v){var w=this;Promise.resolve().then(function(){w._emitter.emit(C.default.MEDIA_SEGMENT,S,v)})},D.prototype._onLoadingComplete=function(){var S=this;Promise.resolve().then(function(){S._emitter.emit(C.default.LOADING_COMPLETE)})},D.prototype._onRecoveredEarlyEof=function(){var S=this;Promise.resolve().then(function(){S._emitter.emit(C.default.RECOVERED_EARLY_EOF)})},D.prototype._onMediaInfo=function(S){var v=this;Promise.resolve().then(function(){v._emitter.emit(C.default.MEDIA_INFO,S)})},D.prototype._onMetaDataArrived=function(S){var v=this;Promise.resolve().then(function(){v._emitter.emit(C.default.METADATA_ARRIVED,S)})},D.prototype._onScriptDataArrived=function(S){var v=this;Promise.resolve().then(function(){v._emitter.emit(C.default.SCRIPTDATA_ARRIVED,S)})},D.prototype._onStatisticsInfo=function(S){var v=this;Promise.resolve().then(function(){v._emitter.emit(C.default.STATISTICS_INFO,S)})},D.prototype._onIOError=function(S,v){var w=this;Promise.resolve().then(function(){w._emitter.emit(C.default.IO_ERROR,S,v)})},D.prototype._onDemuxError=function(S,v){var w=this;Promise.resolve().then(function(){w._emitter.emit(C.default.DEMUX_ERROR,S,v)})},D.prototype._onRecommendSeekpoint=function(S){var v=this;Promise.resolve().then(function(){v._emitter.emit(C.default.RECOMMEND_SEEKPOINT,S)})},D.prototype._onLoggingConfigChanged=function(S){this._worker&&this._worker.postMessage({cmd:"logging_config",param:S})},D.prototype._onWorkerMessage=function(S){var v=S.data,w=v.data;if(v.msg==="destroyed"||this._workerDestroying){this._workerDestroying=!1,this._worker.terminate(),this._worker=null;return}switch(v.msg){case C.default.INIT_SEGMENT:case C.default.MEDIA_SEGMENT:this._emitter.emit(v.msg,w.type,w.data);break;case C.default.LOADING_COMPLETE:case C.default.RECOVERED_EARLY_EOF:this._emitter.emit(v.msg);break;case C.default.MEDIA_INFO:Object.setPrototypeOf(w,x.default.prototype),this._emitter.emit(v.msg,w);break;case C.default.METADATA_ARRIVED:case C.default.SCRIPTDATA_ARRIVED:case C.default.STATISTICS_INFO:this._emitter.emit(v.msg,w);break;case C.default.IO_ERROR:case C.default.DEMUX_ERROR:this._emitter.emit(v.msg,w.type,w.info);break;case C.default.RECOMMEND_SEEKPOINT:this._emitter.emit(v.msg,w);break;case"logcat_callback":E.default.emitter.emit("log",w.type,w.logcat);break}},D}();o.default=y},"./src/core/transmuxing-controller.js":function(a,o,l){l.r(o);var h=l("./node_modules/events/events.js"),c=l.n(h),p=l("./src/utils/logger.js"),_=l("./src/utils/browser.js"),E=l("./src/core/media-info.js"),g=l("./src/demux/flv-demuxer.js"),b=l("./src/remux/mp4-remuxer.js"),C=l("./src/demux/demux-errors.js"),x=l("./src/io/io-controller.js"),y=l("./src/core/transmuxing-events.js"),D=function(){function S(v,w){this.TAG="TransmuxingController",this._emitter=new(c()),this._config=w,v.segments||(v.segments=[{duration:v.duration,filesize:v.filesize,url:v.url}]),typeof v.cors!="boolean"&&(v.cors=!0),typeof v.withCredentials!="boolean"&&(v.withCredentials=!1),this._mediaDataSource=v,this._currentSegmentIndex=0;var L=0;this._mediaDataSource.segments.forEach(function(O){O.timestampBase=L,L+=O.duration,O.cors=v.cors,O.withCredentials=v.withCredentials,w.referrerPolicy&&(O.referrerPolicy=w.referrerPolicy)}),!isNaN(L)&&this._mediaDataSource.duration!==L&&(this._mediaDataSource.duration=L),this._mediaInfo=null,this._demuxer=null,this._remuxer=null,this._ioctl=null,this._pendingSeekTime=null,this._pendingResolveSeekPoint=null,this._statisticsReporter=null}return S.prototype.destroy=function(){this._mediaInfo=null,this._mediaDataSource=null,this._statisticsReporter&&this._disableStatisticsReporter(),this._ioctl&&(this._ioctl.destroy(),this._ioctl=null),this._demuxer&&(this._demuxer.destroy(),this._demuxer=null),this._remuxer&&(this._remuxer.destroy(),this._remuxer=null),this._emitter.removeAllListeners(),this._emitter=null},S.prototype.on=function(v,w){this._emitter.addListener(v,w)},S.prototype.off=function(v,w){this._emitter.removeListener(v,w)},S.prototype.start=function(){this._loadSegment(0),this._enableStatisticsReporter()},S.prototype._loadSegment=function(v,w){this._currentSegmentIndex=v;var L=this._mediaDataSource.segments[v],O=this._ioctl=new x.default(L,this._config,v);O.onError=this._onIOException.bind(this),O.onSeeked=this._onIOSeeked.bind(this),O.onComplete=this._onIOComplete.bind(this),O.onRedirect=this._onIORedirect.bind(this),O.onRecoveredEarlyEof=this._onIORecoveredEarlyEof.bind(this),w?this._demuxer.bindDataSource(this._ioctl):O.onDataArrival=this._onInitChunkArrival.bind(this),O.open(w)},S.prototype.stop=function(){this._internalAbort(),this._disableStatisticsReporter()},S.prototype._internalAbort=function(){this._ioctl&&(this._ioctl.destroy(),this._ioctl=null)},S.prototype.pause=function(){this._ioctl&&this._ioctl.isWorking()&&(this._ioctl.pause(),this._disableStatisticsReporter())},S.prototype.resume=function(){this._ioctl&&this._ioctl.isPaused()&&(this._ioctl.resume(),this._enableStatisticsReporter())},S.prototype.seek=function(v){if(!(this._mediaInfo==null||!this._mediaInfo.isSeekable())){var w=this._searchSegmentIndexContains(v);if(w===this._currentSegmentIndex){var L=this._mediaInfo.segments[w];if(L==null)this._pendingSeekTime=v;else{var O=L.getNearestKeyframe(v);this._remuxer.seek(O.milliseconds),this._ioctl.seek(O.fileposition),this._pendingResolveSeekPoint=O.milliseconds}}else{var F=this._mediaInfo.segments[w];if(F==null)this._pendingSeekTime=v,this._internalAbort(),this._remuxer.seek(),this._remuxer.insertDiscontinuity(),this._loadSegment(w);else{var O=F.getNearestKeyframe(v);this._internalAbort(),this._remuxer.seek(v),this._remuxer.insertDiscontinuity(),this._demuxer.resetMediaInfo(),this._demuxer.timestampBase=this._mediaDataSource.segments[w].timestampBase,this._loadSegment(w,O.fileposition),this._pendingResolveSeekPoint=O.milliseconds,this._reportSegmentMediaInfo(w)}}this._enableStatisticsReporter()}},S.prototype._searchSegmentIndexContains=function(v){for(var w=this._mediaDataSource.segments,L=w.length-1,O=0;O0)this._demuxer.bindDataSource(this._ioctl),this._demuxer.timestampBase=this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase,F=this._demuxer.parseChunks(v,w);else if((O=g.default.probe(v)).match){this._demuxer=new g.default(O,this._config),this._remuxer||(this._remuxer=new b.default(this._config));var V=this._mediaDataSource;V.duration!=null&&!isNaN(V.duration)&&(this._demuxer.overridedDuration=V.duration),typeof V.hasAudio=="boolean"&&(this._demuxer.overridedHasAudio=V.hasAudio),typeof V.hasVideo=="boolean"&&(this._demuxer.overridedHasVideo=V.hasVideo),this._demuxer.timestampBase=V.segments[this._currentSegmentIndex].timestampBase,this._demuxer.onError=this._onDemuxException.bind(this),this._demuxer.onMediaInfo=this._onMediaInfo.bind(this),this._demuxer.onMetaDataArrived=this._onMetaDataArrived.bind(this),this._demuxer.onScriptDataArrived=this._onScriptDataArrived.bind(this),this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl)),this._remuxer.onInitSegment=this._onRemuxerInitSegmentArrival.bind(this),this._remuxer.onMediaSegment=this._onRemuxerMediaSegmentArrival.bind(this),F=this._demuxer.parseChunks(v,w)}else O=null,p.default.e(this.TAG,"Non-FLV, Unsupported media type!"),Promise.resolve().then(function(){L._internalAbort()}),this._emitter.emit(y.default.DEMUX_ERROR,C.default.FORMAT_UNSUPPORTED,"Non-FLV, Unsupported media type"),F=0;return F},S.prototype._onMediaInfo=function(v){var w=this;this._mediaInfo==null&&(this._mediaInfo=Object.assign({},v),this._mediaInfo.keyframesIndex=null,this._mediaInfo.segments=[],this._mediaInfo.segmentCount=this._mediaDataSource.segments.length,Object.setPrototypeOf(this._mediaInfo,E.default.prototype));var L=Object.assign({},v);Object.setPrototypeOf(L,E.default.prototype),this._mediaInfo.segments[this._currentSegmentIndex]=L,this._reportSegmentMediaInfo(this._currentSegmentIndex),this._pendingSeekTime!=null&&Promise.resolve().then(function(){var O=w._pendingSeekTime;w._pendingSeekTime=null,w.seek(O)})},S.prototype._onMetaDataArrived=function(v){this._emitter.emit(y.default.METADATA_ARRIVED,v)},S.prototype._onScriptDataArrived=function(v){this._emitter.emit(y.default.SCRIPTDATA_ARRIVED,v)},S.prototype._onIOSeeked=function(){this._remuxer.insertDiscontinuity()},S.prototype._onIOComplete=function(v){var w=v,L=w+1;L0&&L[0].originalDts===O&&(O=L[0].pts),this._emitter.emit(y.default.RECOMMEND_SEEKPOINT,O)}},S.prototype._enableStatisticsReporter=function(){this._statisticsReporter==null&&(this._statisticsReporter=self.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval))},S.prototype._disableStatisticsReporter=function(){this._statisticsReporter&&(self.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},S.prototype._reportSegmentMediaInfo=function(v){var w=this._mediaInfo.segments[v],L=Object.assign({},w);L.duration=this._mediaInfo.duration,L.segmentCount=this._mediaInfo.segmentCount,delete L.segments,delete L.keyframesIndex,this._emitter.emit(y.default.MEDIA_INFO,L)},S.prototype._reportStatisticsInfo=function(){var v={};v.url=this._ioctl.currentURL,v.hasRedirect=this._ioctl.hasRedirect,v.hasRedirect&&(v.redirectedURL=this._ioctl.currentRedirectedURL),v.speed=this._ioctl.currentSpeed,v.loaderType=this._ioctl.loaderType,v.currentSegmentIndex=this._currentSegmentIndex,v.totalSegmentCount=this._mediaDataSource.segments.length,this._emitter.emit(y.default.STATISTICS_INFO,v)},S}();o.default=D},"./src/core/transmuxing-events.js":function(a,o,l){l.r(o);var h={IO_ERROR:"io_error",DEMUX_ERROR:"demux_error",INIT_SEGMENT:"init_segment",MEDIA_SEGMENT:"media_segment",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info",RECOMMEND_SEEKPOINT:"recommend_seekpoint"};o.default=h},"./src/core/transmuxing-worker.js":function(a,o,l){l.r(o);var h=l("./src/utils/logging-control.js"),c=l("./src/utils/polyfill.js"),p=l("./src/core/transmuxing-controller.js"),_=l("./src/core/transmuxing-events.js"),E=function(g){var b=null,C=B.bind(this);c.default.install(),g.addEventListener("message",function(N){switch(N.data.cmd){case"init":b=new p.default(N.data.param[0],N.data.param[1]),b.on(_.default.IO_ERROR,F.bind(this)),b.on(_.default.DEMUX_ERROR,V.bind(this)),b.on(_.default.INIT_SEGMENT,x.bind(this)),b.on(_.default.MEDIA_SEGMENT,y.bind(this)),b.on(_.default.LOADING_COMPLETE,D.bind(this)),b.on(_.default.RECOVERED_EARLY_EOF,S.bind(this)),b.on(_.default.MEDIA_INFO,v.bind(this)),b.on(_.default.METADATA_ARRIVED,w.bind(this)),b.on(_.default.SCRIPTDATA_ARRIVED,L.bind(this)),b.on(_.default.STATISTICS_INFO,O.bind(this)),b.on(_.default.RECOMMEND_SEEKPOINT,U.bind(this));break;case"destroy":b&&(b.destroy(),b=null),g.postMessage({msg:"destroyed"});break;case"start":b.start();break;case"stop":b.stop();break;case"seek":b.seek(N.data.param);break;case"pause":b.pause();break;case"resume":b.resume();break;case"logging_config":{var $=N.data.param;h.default.applyConfig($),$.enableCallback===!0?h.default.addLogListener(C):h.default.removeLogListener(C);break}}});function x(N,$){var K={msg:_.default.INIT_SEGMENT,data:{type:N,data:$}};g.postMessage(K,[$.data])}function y(N,$){var K={msg:_.default.MEDIA_SEGMENT,data:{type:N,data:$}};g.postMessage(K,[$.data])}function D(){var N={msg:_.default.LOADING_COMPLETE};g.postMessage(N)}function S(){var N={msg:_.default.RECOVERED_EARLY_EOF};g.postMessage(N)}function v(N){var $={msg:_.default.MEDIA_INFO,data:N};g.postMessage($)}function w(N){var $={msg:_.default.METADATA_ARRIVED,data:N};g.postMessage($)}function L(N){var $={msg:_.default.SCRIPTDATA_ARRIVED,data:N};g.postMessage($)}function O(N){var $={msg:_.default.STATISTICS_INFO,data:N};g.postMessage($)}function F(N,$){g.postMessage({msg:_.default.IO_ERROR,data:{type:N,info:$}})}function V(N,$){g.postMessage({msg:_.default.DEMUX_ERROR,data:{type:N,info:$}})}function U(N){g.postMessage({msg:_.default.RECOMMEND_SEEKPOINT,data:N})}function B(N,$){g.postMessage({msg:"logcat_callback",data:{type:N,logcat:$}})}};o.default=E},"./src/demux/amf-parser.js":function(a,o,l){l.r(o);var h=l("./src/utils/logger.js"),c=l("./src/utils/utf8-conv.js"),p=l("./src/utils/exception.js"),_=function(){var g=new ArrayBuffer(2);return new DataView(g).setInt16(0,256,!0),new Int16Array(g)[0]===256}(),E=function(){function g(){}return g.parseScriptData=function(b,C,x){var y={};try{var D=g.parseValue(b,C,x),S=g.parseValue(b,C+D.size,x-D.size);y[D.data]=S.data}catch(v){h.default.e("AMF",v.toString())}return y},g.parseObject=function(b,C,x){if(x<3)throw new p.IllegalStateException("Data not enough when parse ScriptDataObject");var y=g.parseString(b,C,x),D=g.parseValue(b,C+y.size,x-y.size),S=D.objectEnd;return{data:{name:y.data,value:D.data},size:y.size+D.size,objectEnd:S}},g.parseVariable=function(b,C,x){return g.parseObject(b,C,x)},g.parseString=function(b,C,x){if(x<2)throw new p.IllegalStateException("Data not enough when parse String");var y=new DataView(b,C,x),D=y.getUint16(0,!_),S;return D>0?S=(0,c.default)(new Uint8Array(b,C+2,D)):S="",{data:S,size:2+D}},g.parseLongString=function(b,C,x){if(x<4)throw new p.IllegalStateException("Data not enough when parse LongString");var y=new DataView(b,C,x),D=y.getUint32(0,!_),S;return D>0?S=(0,c.default)(new Uint8Array(b,C+4,D)):S="",{data:S,size:4+D}},g.parseDate=function(b,C,x){if(x<10)throw new p.IllegalStateException("Data size invalid when parse Date");var y=new DataView(b,C,x),D=y.getFloat64(0,!_),S=y.getInt16(8,!_);return D+=S*60*1e3,{data:new Date(D),size:8+2}},g.parseValue=function(b,C,x){if(x<1)throw new p.IllegalStateException("Data not enough when parse Value");var y=new DataView(b,C,x),D=1,S=y.getUint8(0),v,w=!1;try{switch(S){case 0:v=y.getFloat64(1,!_),D+=8;break;case 1:{var L=y.getUint8(1);v=!!L,D+=1;break}case 2:{var O=g.parseString(b,C+1,x-1);v=O.data,D+=O.size;break}case 3:{v={};var F=0;for((y.getUint32(x-4,!_)&16777215)===9&&(F=3);D32)throw new h.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");if(_<=this._current_word_bits_left){var E=this._current_word>>>32-_;return this._current_word<<=_,this._current_word_bits_left-=_,E}var g=this._current_word_bits_left?this._current_word:0;g=g>>>32-this._current_word_bits_left;var b=_-this._current_word_bits_left;this._fillCurrentWord();var C=Math.min(b,this._current_word_bits_left),x=this._current_word>>>32-C;return this._current_word<<=C,this._current_word_bits_left-=C,g=g<>>_)!==0)return this._current_word<<=_,this._current_word_bits_left-=_,_;return this._fillCurrentWord(),_+this._skipLeadingZero()},p.prototype.readUEG=function(){var _=this._skipLeadingZero();return this.readBits(_+1)-1},p.prototype.readSEG=function(){var _=this.readUEG();return _&1?_+1>>>1:-1*(_>>>1)},p}();o.default=c},"./src/demux/flv-demuxer.js":function(a,o,l){l.r(o);var h=l("./src/utils/logger.js"),c=l("./src/demux/amf-parser.js"),p=l("./src/demux/sps-parser.js"),_=l("./src/demux/demux-errors.js"),E=l("./src/core/media-info.js"),g=l("./src/utils/exception.js");function b(x,y){return x[y]<<24|x[y+1]<<16|x[y+2]<<8|x[y+3]}var C=function(){function x(y,D){this.TAG="FLVDemuxer",this._config=D,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null,this._dataOffset=y.dataOffset,this._firstParse=!0,this._dispatch=!1,this._hasAudio=y.hasAudioTrack,this._hasVideo=y.hasVideoTrack,this._hasAudioFlagOverrided=!1,this._hasVideoFlagOverrided=!1,this._audioInitialMetadataDispatched=!1,this._videoInitialMetadataDispatched=!1,this._mediaInfo=new E.default,this._mediaInfo.hasAudio=this._hasAudio,this._mediaInfo.hasVideo=this._hasVideo,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._naluLengthSize=4,this._timestampBase=0,this._timescale=1e3,this._duration=0,this._durationOverrided=!1,this._referenceFrameRate={fixed:!0,fps:23.976,fps_num:23976,fps_den:1e3},this._flvSoundRateTable=[5500,11025,22050,44100,48e3],this._mpegSamplingRates=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],this._mpegAudioV10SampleRateTable=[44100,48e3,32e3,0],this._mpegAudioV20SampleRateTable=[22050,24e3,16e3,0],this._mpegAudioV25SampleRateTable=[11025,12e3,8e3,0],this._mpegAudioL1BitRateTable=[0,32,64,96,128,160,192,224,256,288,320,352,384,416,448,-1],this._mpegAudioL2BitRateTable=[0,32,48,56,64,80,96,112,128,160,192,224,256,320,384,-1],this._mpegAudioL3BitRateTable=[0,32,40,48,56,64,80,96,112,128,160,192,224,256,320,-1],this._videoTrack={type:"video",id:1,sequenceNumber:0,samples:[],length:0},this._audioTrack={type:"audio",id:2,sequenceNumber:0,samples:[],length:0},this._littleEndian=function(){var S=new ArrayBuffer(2);return new DataView(S).setInt16(0,256,!0),new Int16Array(S)[0]===256}()}return x.prototype.destroy=function(){this._mediaInfo=null,this._metadata=null,this._audioMetadata=null,this._videoMetadata=null,this._videoTrack=null,this._audioTrack=null,this._onError=null,this._onMediaInfo=null,this._onMetaDataArrived=null,this._onScriptDataArrived=null,this._onTrackMetadata=null,this._onDataAvailable=null},x.probe=function(y){var D=new Uint8Array(y),S={match:!1};if(D[0]!==70||D[1]!==76||D[2]!==86||D[3]!==1)return S;var v=(D[4]&4)>>>2!==0,w=(D[4]&1)!==0,L=b(D,5);return L<9?S:{match:!0,consumed:L,dataOffset:L,hasAudioTrack:v,hasVideoTrack:w}},x.prototype.bindDataSource=function(y){return y.onDataArrival=this.parseChunks.bind(this),this},Object.defineProperty(x.prototype,"onTrackMetadata",{get:function(){return this._onTrackMetadata},set:function(y){this._onTrackMetadata=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onMediaInfo",{get:function(){return this._onMediaInfo},set:function(y){this._onMediaInfo=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onMetaDataArrived",{get:function(){return this._onMetaDataArrived},set:function(y){this._onMetaDataArrived=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onScriptDataArrived",{get:function(){return this._onScriptDataArrived},set:function(y){this._onScriptDataArrived=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onError",{get:function(){return this._onError},set:function(y){this._onError=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"onDataAvailable",{get:function(){return this._onDataAvailable},set:function(y){this._onDataAvailable=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"timestampBase",{get:function(){return this._timestampBase},set:function(y){this._timestampBase=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"overridedDuration",{get:function(){return this._duration},set:function(y){this._durationOverrided=!0,this._duration=y,this._mediaInfo.duration=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"overridedHasAudio",{set:function(y){this._hasAudioFlagOverrided=!0,this._hasAudio=y,this._mediaInfo.hasAudio=y},enumerable:!1,configurable:!0}),Object.defineProperty(x.prototype,"overridedHasVideo",{set:function(y){this._hasVideoFlagOverrided=!0,this._hasVideo=y,this._mediaInfo.hasVideo=y},enumerable:!1,configurable:!0}),x.prototype.resetMediaInfo=function(){this._mediaInfo=new E.default},x.prototype._isInitialMetadataDispatched=function(){return this._hasAudio&&this._hasVideo?this._audioInitialMetadataDispatched&&this._videoInitialMetadataDispatched:this._hasAudio&&!this._hasVideo?this._audioInitialMetadataDispatched:!this._hasAudio&&this._hasVideo?this._videoInitialMetadataDispatched:!1},x.prototype.parseChunks=function(y,D){if(!this._onError||!this._onMediaInfo||!this._onTrackMetadata||!this._onDataAvailable)throw new g.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");var S=0,v=this._littleEndian;if(D===0)if(y.byteLength>13){var w=x.probe(y);S=w.dataOffset}else return 0;if(this._firstParse){this._firstParse=!1,D+S!==this._dataOffset&&h.default.w(this.TAG,"First time parsing but chunk byteStart invalid!");var L=new DataView(y,S),O=L.getUint32(0,!v);O!==0&&h.default.w(this.TAG,"PrevTagSize0 !== 0 !!!"),S+=4}for(;Sy.byteLength)break;var F=L.getUint8(0),V=L.getUint32(0,!v)&16777215;if(S+11+V+4>y.byteLength)break;if(F!==8&&F!==9&&F!==18){h.default.w(this.TAG,"Unsupported tag type "+F+", skipped"),S+=11+V+4;continue}var U=L.getUint8(4),B=L.getUint8(5),N=L.getUint8(6),$=L.getUint8(7),K=N|B<<8|U<<16|$<<24,q=L.getUint32(7,!v)&16777215;q!==0&&h.default.w(this.TAG,"Meet tag which has StreamID != 0!");var Q=S+11;switch(F){case 8:this._parseAudioData(y,Q,V,K);break;case 9:this._parseVideoData(y,Q,V,K,D+S);break;case 18:this._parseScriptData(y,Q,V);break}var oe=L.getUint32(11+V,!v);oe!==11+V&&h.default.w(this.TAG,"Invalid PrevTagSize "+oe),S+=11+V+4}return this._isInitialMetadataDispatched()&&this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack),S},x.prototype._parseScriptData=function(y,D,S){var v=c.default.parseScriptData(y,D,S);if(v.hasOwnProperty("onMetaData")){if(v.onMetaData==null||typeof v.onMetaData!="object"){h.default.w(this.TAG,"Invalid onMetaData structure!");return}this._metadata&&h.default.w(this.TAG,"Found another onMetaData tag!"),this._metadata=v;var w=this._metadata.onMetaData;if(this._onMetaDataArrived&&this._onMetaDataArrived(Object.assign({},w)),typeof w.hasAudio=="boolean"&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=w.hasAudio,this._mediaInfo.hasAudio=this._hasAudio),typeof w.hasVideo=="boolean"&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=w.hasVideo,this._mediaInfo.hasVideo=this._hasVideo),typeof w.audiodatarate=="number"&&(this._mediaInfo.audioDataRate=w.audiodatarate),typeof w.videodatarate=="number"&&(this._mediaInfo.videoDataRate=w.videodatarate),typeof w.width=="number"&&(this._mediaInfo.width=w.width),typeof w.height=="number"&&(this._mediaInfo.height=w.height),typeof w.duration=="number"){if(!this._durationOverrided){var L=Math.floor(w.duration*this._timescale);this._duration=L,this._mediaInfo.duration=L}}else this._mediaInfo.duration=0;if(typeof w.framerate=="number"){var O=Math.floor(w.framerate*1e3);if(O>0){var F=O/1e3;this._referenceFrameRate.fixed=!0,this._referenceFrameRate.fps=F,this._referenceFrameRate.fps_num=O,this._referenceFrameRate.fps_den=1e3,this._mediaInfo.fps=F}}if(typeof w.keyframes=="object"){this._mediaInfo.hasKeyframesIndex=!0;var V=w.keyframes;this._mediaInfo.keyframesIndex=this._parseKeyframesIndex(V),w.keyframes=null}else this._mediaInfo.hasKeyframesIndex=!1;this._dispatch=!1,this._mediaInfo.metadata=w,h.default.v(this.TAG,"Parsed onMetaData"),this._mediaInfo.isComplete()&&this._onMediaInfo(this._mediaInfo)}Object.keys(v).length>0&&this._onScriptDataArrived&&this._onScriptDataArrived(Object.assign({},v))},x.prototype._parseKeyframesIndex=function(y){for(var D=[],S=[],v=1;v>>4;if(O!==2&&O!==10){this._onError(_.default.CODEC_UNSUPPORTED,"Flv: Unsupported audio codec idx: "+O);return}var F=0,V=(L&12)>>>2;if(V>=0&&V<=4)F=this._flvSoundRateTable[V];else{this._onError(_.default.FORMAT_ERROR,"Flv: Invalid audio sample rate idx: "+V);return}var U=L&1,B=this._audioMetadata,N=this._audioTrack;if(B||(this._hasAudio===!1&&this._hasAudioFlagOverrided===!1&&(this._hasAudio=!0,this._mediaInfo.hasAudio=!0),B=this._audioMetadata={},B.type="audio",B.id=N.id,B.timescale=this._timescale,B.duration=this._duration,B.audioSampleRate=F,B.channelCount=U===0?1:2),O===10){var $=this._parseAACAudioData(y,D+1,S-1);if($==null)return;if($.packetType===0){B.config&&h.default.w(this.TAG,"Found another AudioSpecificConfig!");var K=$.data;B.audioSampleRate=K.samplingRate,B.channelCount=K.channelCount,B.codec=K.codec,B.originalCodec=K.originalCodec,B.config=K.config,B.refSampleDuration=1024/B.audioSampleRate*B.timescale,h.default.v(this.TAG,"Parsed AudioSpecificConfig"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._audioInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("audio",B);var q=this._mediaInfo;q.audioCodec=B.originalCodec,q.audioSampleRate=B.audioSampleRate,q.audioChannelCount=B.channelCount,q.hasVideo?q.videoCodec!=null&&(q.mimeType='video/x-flv; codecs="'+q.videoCodec+","+q.audioCodec+'"'):q.mimeType='video/x-flv; codecs="'+q.audioCodec+'"',q.isComplete()&&this._onMediaInfo(q)}else if($.packetType===1){var Q=this._timestampBase+v,oe={unit:$.data,length:$.data.byteLength,dts:Q,pts:Q};N.samples.push(oe),N.length+=$.data.length}else h.default.e(this.TAG,"Flv: Unsupported AAC data type "+$.packetType)}else if(O===2){if(!B.codec){var K=this._parseMP3AudioData(y,D+1,S-1,!0);if(K==null)return;B.audioSampleRate=K.samplingRate,B.channelCount=K.channelCount,B.codec=K.codec,B.originalCodec=K.originalCodec,B.refSampleDuration=1152/B.audioSampleRate*B.timescale,h.default.v(this.TAG,"Parsed MPEG Audio Frame Header"),this._audioInitialMetadataDispatched=!0,this._onTrackMetadata("audio",B);var q=this._mediaInfo;q.audioCodec=B.codec,q.audioSampleRate=B.audioSampleRate,q.audioChannelCount=B.channelCount,q.audioDataRate=K.bitRate,q.hasVideo?q.videoCodec!=null&&(q.mimeType='video/x-flv; codecs="'+q.videoCodec+","+q.audioCodec+'"'):q.mimeType='video/x-flv; codecs="'+q.audioCodec+'"',q.isComplete()&&this._onMediaInfo(q)}var le=this._parseMP3AudioData(y,D+1,S-1,!1);if(le==null)return;var Q=this._timestampBase+v,se={unit:le,length:le.byteLength,dts:Q,pts:Q};N.samples.push(se),N.length+=le.length}}},x.prototype._parseAACAudioData=function(y,D,S){if(S<=1){h.default.w(this.TAG,"Flv: Invalid AAC packet, missing AACPacketType or/and Data!");return}var v={},w=new Uint8Array(y,D,S);return v.packetType=w[0],w[0]===0?v.data=this._parseAACAudioSpecificConfig(y,D+1,S-1):v.data=w.subarray(1),v},x.prototype._parseAACAudioSpecificConfig=function(y,D,S){var v=new Uint8Array(y,D,S),w=null,L=0,O=0,F=0,V=null;if(L=O=v[0]>>>3,F=(v[0]&7)<<1|v[1]>>>7,F<0||F>=this._mpegSamplingRates.length){this._onError(_.default.FORMAT_ERROR,"Flv: AAC invalid sampling frequency index!");return}var U=this._mpegSamplingRates[F],B=(v[1]&120)>>>3;if(B<0||B>=8){this._onError(_.default.FORMAT_ERROR,"Flv: AAC invalid channel configuration");return}L===5&&(V=(v[1]&7)<<1|v[2]>>>7,(v[2]&124)>>>2);var N=self.navigator.userAgent.toLowerCase();return N.indexOf("firefox")!==-1?F>=6?(L=5,w=new Array(4),V=F-3):(L=2,w=new Array(2),V=F):N.indexOf("android")!==-1?(L=2,w=new Array(2),V=F):(L=5,V=F,w=new Array(4),F>=6?V=F-3:B===1&&(L=2,w=new Array(2),V=F)),w[0]=L<<3,w[0]|=(F&15)>>>1,w[1]=(F&15)<<7,w[1]|=(B&15)<<3,L===5&&(w[1]|=(V&15)>>>1,w[2]=(V&1)<<7,w[2]|=2<<2,w[3]=0),{config:w,samplingRate:U,channelCount:B,codec:"mp4a.40."+L,originalCodec:"mp4a.40."+O}},x.prototype._parseMP3AudioData=function(y,D,S,v){if(S<4){h.default.w(this.TAG,"Flv: Invalid MP3 packet, header missing!");return}this._littleEndian;var w=new Uint8Array(y,D,S),L=null;if(v){if(w[0]!==255)return;var O=w[1]>>>3&3,F=(w[1]&6)>>1,V=(w[2]&240)>>>4,U=(w[2]&12)>>>2,B=w[3]>>>6&3,N=B!==3?2:1,$=0,K=0,q="mp3";switch(O){case 0:$=this._mpegAudioV25SampleRateTable[U];break;case 2:$=this._mpegAudioV20SampleRateTable[U];break;case 3:$=this._mpegAudioV10SampleRateTable[U];break}switch(F){case 1:V>>4,F=L&15;if(F!==7){this._onError(_.default.CODEC_UNSUPPORTED,"Flv: Unsupported codec in video frame: "+F);return}this._parseAVCVideoPacket(y,D+1,S-1,v,w,O)}},x.prototype._parseAVCVideoPacket=function(y,D,S,v,w,L){if(S<4){h.default.w(this.TAG,"Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");return}var O=this._littleEndian,F=new DataView(y,D,S),V=F.getUint8(0),U=F.getUint32(0,!O)&16777215,B=U<<8>>8;if(V===0)this._parseAVCDecoderConfigurationRecord(y,D+4,S-4);else if(V===1)this._parseAVCVideoData(y,D+4,S-4,v,w,L,B);else if(V!==2){this._onError(_.default.FORMAT_ERROR,"Flv: Invalid video packet type "+V);return}},x.prototype._parseAVCDecoderConfigurationRecord=function(y,D,S){if(S<7){h.default.w(this.TAG,"Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");return}var v=this._videoMetadata,w=this._videoTrack,L=this._littleEndian,O=new DataView(y,D,S);v?typeof v.avcc!="undefined"&&h.default.w(this.TAG,"Found another AVCDecoderConfigurationRecord!"):(this._hasVideo===!1&&this._hasVideoFlagOverrided===!1&&(this._hasVideo=!0,this._mediaInfo.hasVideo=!0),v=this._videoMetadata={},v.type="video",v.id=w.id,v.timescale=this._timescale,v.duration=this._duration);var F=O.getUint8(0),V=O.getUint8(1);if(O.getUint8(2),O.getUint8(3),F!==1||V===0){this._onError(_.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord");return}if(this._naluLengthSize=(O.getUint8(4)&3)+1,this._naluLengthSize!==3&&this._naluLengthSize!==4){this._onError(_.default.FORMAT_ERROR,"Flv: Strange NaluLengthSizeMinusOne: "+(this._naluLengthSize-1));return}var U=O.getUint8(5)&31;if(U===0){this._onError(_.default.FORMAT_ERROR,"Flv: Invalid AVCDecoderConfigurationRecord: No SPS");return}else U>1&&h.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: SPS Count = "+U);for(var B=6,N=0;N1&&h.default.w(this.TAG,"Flv: Strange AVCDecoderConfigurationRecord: PPS Count = "+_e);B++;for(var N=0;N<_e;N++){var $=O.getUint16(B,!L);B+=2,$!==0&&(B+=$)}v.avcc=new Uint8Array(S),v.avcc.set(new Uint8Array(y,D,S),0),h.default.v(this.TAG,"Parsed AVCDecoderConfigurationRecord"),this._isInitialMetadataDispatched()?this._dispatch&&(this._audioTrack.length||this._videoTrack.length)&&this._onDataAvailable(this._audioTrack,this._videoTrack):this._videoInitialMetadataDispatched=!0,this._dispatch=!1,this._onTrackMetadata("video",v)},x.prototype._parseAVCVideoData=function(y,D,S,v,w,L,O){for(var F=this._littleEndian,V=new DataView(y,D,S),U=[],B=0,N=0,$=this._naluLengthSize,K=this._timestampBase+v,q=L===1;N=S){h.default.w(this.TAG,"Malformed Nalu near timestamp "+K+", offset = "+N+", dataSize = "+S);break}var Q=V.getUint32(N,!F);if($===3&&(Q>>>=8),Q>S-$){h.default.w(this.TAG,"Malformed Nalus near timestamp "+K+", NaluSize > DataSize!");return}var oe=V.getUint8(N+$)&31;oe===5&&(q=!0);var le=new Uint8Array(y,D+N,$+Q),se={type:oe,data:le};U.push(se),B+=le.byteLength,N+=$+Q}if(U.length){var pe=this._videoTrack,Te={units:U,length:B,isKeyframe:q,dts:K,cts:O,pts:K+O};q&&(Te.fileposition=w),pe.samples.push(Te),pe.length+=B}},x}();o.default=C},"./src/demux/sps-parser.js":function(a,o,l){l.r(o);var h=l("./src/demux/exp-golomb.js"),c=function(){function p(){}return p._ebsp2rbsp=function(_){for(var E=_,g=E.byteLength,b=new Uint8Array(g),C=0,x=0;x=2&&E[x]===3&&E[x-1]===0&&E[x-2]===0||(b[C]=E[x],C++);return new Uint8Array(b.buffer,0,C)},p.parseSPS=function(_){var E=p._ebsp2rbsp(_),g=new h.default(E);g.readByte();var b=g.readByte();g.readByte();var C=g.readByte();g.readUEG();var x=p.getProfileString(b),y=p.getLevelString(C),D=1,S=420,v=[0,420,422,444],w=8;if((b===100||b===110||b===122||b===244||b===44||b===83||b===86||b===118||b===128||b===138||b===144)&&(D=g.readUEG(),D===3&&g.readBits(1),D<=3&&(S=v[D]),w=g.readUEG()+8,g.readUEG(),g.readBits(1),g.readBool()))for(var L=D!==3?8:12,O=0;O0&&De<16?(se=ut[De-1],pe=Ve[De-1]):De===255&&(se=g.readByte()<<8|g.readByte(),pe=g.readByte()<<8|g.readByte())}if(g.readBool()&&g.readBool(),g.readBool()&&(g.readBits(4),g.readBool()&&g.readBits(24)),g.readBool()&&(g.readUEG(),g.readUEG()),g.readBool()){var Ze=g.readBits(32),It=g.readBits(32);ae=g.readBool(),_e=It,gt=Ze*2,Te=_e/gt}}var Ce=1;(se!==1||pe!==1)&&(Ce=se/pe);var ue=0,et=0;if(D===0)ue=1,et=2-$;else{var bt=D===3?1:2,ei=D===1?2:1;ue=bt,et=ei*(2-$)}var kt=(B+1)*16,ze=(2-$)*((N+1)*16);kt-=(K+q)*ue,ze-=(Q+oe)*et;var Ft=Math.ceil(kt*Ce);return g.destroy(),g=null,{profile_string:x,level_string:y,bit_depth:w,ref_frames:U,chroma_format:S,chroma_format_string:p.getChromaFormatString(S),frame_rate:{fixed:ae,fps:Te,fps_den:gt,fps_num:_e},sar_ratio:{width:se,height:pe},codec_size:{width:kt,height:ze},present_size:{width:Ft,height:ze}}},p._skipScalingList=function(_,E){for(var g=8,b=8,C=0,x=0;x=15048,x=h.default.msedge?C:!0;return self.fetch&&self.ReadableStream&&x}catch(y){return!1}},b.prototype.destroy=function(){this.isWorking()&&this.abort(),g.prototype.destroy.call(this)},b.prototype.open=function(C,x){var y=this;this._dataSource=C,this._range=x;var D=C.url;this._config.reuseRedirectedURL&&C.redirectedURL!=null&&(D=C.redirectedURL);var S=this._seekHandler.getConfig(D,x),v=new self.Headers;if(typeof S.headers=="object"){var w=S.headers;for(var L in w)w.hasOwnProperty(L)&&v.append(L,w[L])}var O={method:"GET",headers:v,mode:"cors",cache:"default",referrerPolicy:"no-referrer-when-downgrade"};if(typeof this._config.headers=="object")for(var L in this._config.headers)v.append(L,this._config.headers[L]);C.cors===!1&&(O.mode="same-origin"),C.withCredentials&&(O.credentials="include"),C.referrerPolicy&&(O.referrerPolicy=C.referrerPolicy),self.AbortController&&(this._abortController=new self.AbortController,O.signal=this._abortController.signal),this._status=c.LoaderStatus.kConnecting,self.fetch(S.url,O).then(function(F){if(y._requestAbort){y._status=c.LoaderStatus.kIdle,F.body.cancel();return}if(F.ok&&F.status>=200&&F.status<=299){if(F.url!==S.url&&y._onURLRedirect){var V=y._seekHandler.removeURLParameters(F.url);y._onURLRedirect(V)}var U=F.headers.get("Content-Length");return U!=null&&(y._contentLength=parseInt(U),y._contentLength!==0&&y._onContentLengthKnown&&y._onContentLengthKnown(y._contentLength)),y._pump.call(y,F.body.getReader())}else if(y._status=c.LoaderStatus.kError,y._onError)y._onError(c.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:F.status,msg:F.statusText});else throw new p.RuntimeException("FetchStreamLoader: Http code invalid, "+F.status+" "+F.statusText)}).catch(function(F){if(!(y._abortController&&y._abortController.signal.aborted))if(y._status=c.LoaderStatus.kError,y._onError)y._onError(c.LoaderErrors.EXCEPTION,{code:-1,msg:F.message});else throw F})},b.prototype.abort=function(){if(this._requestAbort=!0,(this._status!==c.LoaderStatus.kBuffering||!h.default.chrome)&&this._abortController)try{this._abortController.abort()}catch(C){}},b.prototype._pump=function(C){var x=this;return C.read().then(function(y){if(y.done)if(x._contentLength!==null&&x._receivedLength0&&(this._stashInitialSize=w.stashInitialSize),this._stashUsed=0,this._stashSize=this._stashInitialSize,this._bufferSize=1024*1024*3,this._stashBuffer=new ArrayBuffer(this._bufferSize),this._stashByteStart=0,this._enableStash=!0,w.enableStashBuffer===!1&&(this._enableStash=!1),this._loader=null,this._loaderClass=null,this._seekHandler=null,this._dataSource=v,this._isWebSocketURL=/wss?:\/\/(.+?)/.test(v.url),this._refTotalLength=v.filesize?v.filesize:null,this._totalLength=this._refTotalLength,this._fullRequestFlag=!1,this._currentRange=null,this._redirectedURL=null,this._speedNormalized=0,this._speedSampler=new c.default,this._speedNormalizeList=[64,128,256,384,512,768,1024,1536,2048,3072,4096],this._isEarlyEofReconnecting=!1,this._paused=!1,this._resumeFrom=0,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._selectSeekHandler(),this._selectLoader(),this._createLoader()}return S.prototype.destroy=function(){this._loader.isWorking()&&this._loader.abort(),this._loader.destroy(),this._loader=null,this._loaderClass=null,this._dataSource=null,this._stashBuffer=null,this._stashUsed=this._stashSize=this._bufferSize=this._stashByteStart=0,this._currentRange=null,this._speedSampler=null,this._isEarlyEofReconnecting=!1,this._onDataArrival=null,this._onSeeked=null,this._onError=null,this._onComplete=null,this._onRedirect=null,this._onRecoveredEarlyEof=null,this._extraData=null},S.prototype.isWorking=function(){return this._loader&&this._loader.isWorking()&&!this._paused},S.prototype.isPaused=function(){return this._paused},Object.defineProperty(S.prototype,"status",{get:function(){return this._loader.status},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"extraData",{get:function(){return this._extraData},set:function(v){this._extraData=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onDataArrival",{get:function(){return this._onDataArrival},set:function(v){this._onDataArrival=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onSeeked",{get:function(){return this._onSeeked},set:function(v){this._onSeeked=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onError",{get:function(){return this._onError},set:function(v){this._onError=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onComplete",{get:function(){return this._onComplete},set:function(v){this._onComplete=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onRedirect",{get:function(){return this._onRedirect},set:function(v){this._onRedirect=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"onRecoveredEarlyEof",{get:function(){return this._onRecoveredEarlyEof},set:function(v){this._onRecoveredEarlyEof=v},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"currentURL",{get:function(){return this._dataSource.url},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"hasRedirect",{get:function(){return this._redirectedURL!=null||this._dataSource.redirectedURL!=null},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"currentRedirectedURL",{get:function(){return this._redirectedURL||this._dataSource.redirectedURL},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"currentSpeed",{get:function(){return this._loaderClass===g.default?this._loader.currentSpeed:this._speedSampler.lastSecondKBps},enumerable:!1,configurable:!0}),Object.defineProperty(S.prototype,"loaderType",{get:function(){return this._loader.type},enumerable:!1,configurable:!0}),S.prototype._selectSeekHandler=function(){var v=this._config;if(v.seekType==="range")this._seekHandler=new C.default(this._config.rangeLoadZeroStart);else if(v.seekType==="param"){var w=v.seekParamStart||"bstart",L=v.seekParamEnd||"bend";this._seekHandler=new x.default(w,L)}else if(v.seekType==="custom"){if(typeof v.customSeekHandler!="function")throw new y.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");this._seekHandler=new v.customSeekHandler}else throw new y.InvalidArgumentException("Invalid seekType in config: "+v.seekType)},S.prototype._selectLoader=function(){if(this._config.customLoader!=null)this._loaderClass=this._config.customLoader;else if(this._isWebSocketURL)this._loaderClass=b.default;else if(_.default.isSupported())this._loaderClass=_.default;else if(E.default.isSupported())this._loaderClass=E.default;else if(g.default.isSupported())this._loaderClass=g.default;else throw new y.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!")},S.prototype._createLoader=function(){this._loader=new this._loaderClass(this._seekHandler,this._config),this._loader.needStashBuffer===!1&&(this._enableStash=!1),this._loader.onContentLengthKnown=this._onContentLengthKnown.bind(this),this._loader.onURLRedirect=this._onURLRedirect.bind(this),this._loader.onDataArrival=this._onLoaderChunkArrival.bind(this),this._loader.onComplete=this._onLoaderComplete.bind(this),this._loader.onError=this._onLoaderError.bind(this)},S.prototype.open=function(v){this._currentRange={from:0,to:-1},v&&(this._currentRange.from=v),this._speedSampler.reset(),v||(this._fullRequestFlag=!0),this._loader.open(this._dataSource,Object.assign({},this._currentRange))},S.prototype.abort=function(){this._loader.abort(),this._paused&&(this._paused=!1,this._resumeFrom=0)},S.prototype.pause=function(){this.isWorking()&&(this._loader.abort(),this._stashUsed!==0?(this._resumeFrom=this._stashByteStart,this._currentRange.to=this._stashByteStart-1):this._resumeFrom=this._currentRange.to+1,this._stashUsed=0,this._stashByteStart=0,this._paused=!0)},S.prototype.resume=function(){if(this._paused){this._paused=!1;var v=this._resumeFrom;this._resumeFrom=0,this._internalSeek(v,!0)}},S.prototype.seek=function(v){this._paused=!1,this._stashUsed=0,this._stashByteStart=0,this._internalSeek(v,!0)},S.prototype._internalSeek=function(v,w){this._loader.isWorking()&&this._loader.abort(),this._flushStashBuffer(w),this._loader.destroy(),this._loader=null;var L={from:v,to:-1};this._currentRange={from:L.from,to:-1},this._speedSampler.reset(),this._stashSize=this._stashInitialSize,this._createLoader(),this._loader.open(this._dataSource,L),this._onSeeked&&this._onSeeked()},S.prototype.updateUrl=function(v){if(!v||typeof v!="string"||v.length===0)throw new y.InvalidArgumentException("Url must be a non-empty string!");this._dataSource.url=v},S.prototype._expandBuffer=function(v){for(var w=this._stashSize;w+1024*1024*10){var O=new Uint8Array(this._stashBuffer,0,this._stashUsed),F=new Uint8Array(L,0,w);F.set(O,0)}this._stashBuffer=L,this._bufferSize=w}},S.prototype._normalizeSpeed=function(v){var w=this._speedNormalizeList,L=w.length-1,O=0,F=0,V=L;if(v=w[O]&&v=512&&v<=1024?w=Math.floor(v*1.5):w=v*2,w>8192&&(w=8192);var L=w*1024+1024*1024*1;this._bufferSize0){var $=this._stashBuffer.slice(0,this._stashUsed),V=this._dispatchChunks($,this._stashByteStart);if(V<$.byteLength){if(V>0){var N=new Uint8Array($,V);B.set(N,0),this._stashUsed=N.byteLength,this._stashByteStart+=V}}else this._stashUsed=0,this._stashByteStart+=V;this._stashUsed+v.byteLength>this._bufferSize&&(this._expandBuffer(this._stashUsed+v.byteLength),B=new Uint8Array(this._stashBuffer,0,this._bufferSize)),B.set(new Uint8Array(v),this._stashUsed),this._stashUsed+=v.byteLength}else{var V=this._dispatchChunks(v,w);if(Vthis._bufferSize&&(this._expandBuffer(U),B=new Uint8Array(this._stashBuffer,0,this._bufferSize)),B.set(new Uint8Array(v,V),0),this._stashUsed+=U,this._stashByteStart=w+V}}}else if(this._stashUsed===0){var V=this._dispatchChunks(v,w);if(Vthis._bufferSize&&this._expandBuffer(U);var B=new Uint8Array(this._stashBuffer,0,this._bufferSize);B.set(new Uint8Array(v,V),0),this._stashUsed+=U,this._stashByteStart=w+V}}else{this._stashUsed+v.byteLength>this._bufferSize&&this._expandBuffer(this._stashUsed+v.byteLength);var B=new Uint8Array(this._stashBuffer,0,this._bufferSize);B.set(new Uint8Array(v),this._stashUsed),this._stashUsed+=v.byteLength;var V=this._dispatchChunks(this._stashBuffer.slice(0,this._stashUsed),this._stashByteStart);if(V0){var N=new Uint8Array(this._stashBuffer,V);B.set(N,0)}this._stashUsed-=V,this._stashByteStart+=V}}},S.prototype._flushStashBuffer=function(v){if(this._stashUsed>0){var w=this._stashBuffer.slice(0,this._stashUsed),L=this._dispatchChunks(w,this._stashByteStart),O=w.byteLength-L;if(L0){var F=new Uint8Array(this._stashBuffer,0,this._bufferSize),V=new Uint8Array(w,L);F.set(V,0),this._stashUsed=V.byteLength,this._stashByteStart+=L}return 0}return this._stashUsed=0,this._stashByteStart=0,O}return 0},S.prototype._onLoaderComplete=function(v,w){this._flushStashBuffer(!0),this._onComplete&&this._onComplete(this._extraData)},S.prototype._onLoaderError=function(v,w){switch(h.default.e(this.TAG,"Loader error, code = "+w.code+", msg = "+w.msg),this._flushStashBuffer(!1),this._isEarlyEofReconnecting&&(this._isEarlyEofReconnecting=!1,v=p.LoaderErrors.UNRECOVERABLE_EARLY_EOF),v){case p.LoaderErrors.EARLY_EOF:{if(!this._config.isLive&&this._totalLength){var L=this._currentRange.to+1;L0)for(var C=E.split("&"),x=0;x0;y[0]!==this._startName&&y[0]!==this._endName&&(D&&(b+="&"),b+=C[x])}return b.length===0?_:_+"?"+b},c}();o.default=h},"./src/io/range-seek-handler.js":function(a,o,l){l.r(o);var h=function(){function c(p){this._zeroStart=p||!1}return c.prototype.getConfig=function(p,_){var E={};if(_.from!==0||_.to!==-1){var g=void 0;_.to!==-1?g="bytes="+_.from.toString()+"-"+_.to.toString():g="bytes="+_.from.toString()+"-",E.Range=g}else this._zeroStart&&(E.Range="bytes=0-");return{url:p,headers:E}},c.prototype.removeURLParameters=function(p){return p},c}();o.default=h},"./src/io/speed-sampler.js":function(a,o,l){l.r(o);var h=function(){function c(){this._firstCheckpoint=0,this._lastCheckpoint=0,this._intervalBytes=0,this._totalBytes=0,this._lastSecondBytes=0,self.performance&&self.performance.now?this._now=self.performance.now.bind(self.performance):this._now=Date.now}return c.prototype.reset=function(){this._firstCheckpoint=this._lastCheckpoint=0,this._totalBytes=this._intervalBytes=0,this._lastSecondBytes=0},c.prototype.addBytes=function(p){this._firstCheckpoint===0?(this._firstCheckpoint=this._now(),this._lastCheckpoint=this._firstCheckpoint,this._intervalBytes+=p,this._totalBytes+=p):this._now()-this._lastCheckpoint<1e3?(this._intervalBytes+=p,this._totalBytes+=p):(this._lastSecondBytes=this._intervalBytes,this._intervalBytes=p,this._totalBytes+=p,this._lastCheckpoint=this._now())},Object.defineProperty(c.prototype,"currentKBps",{get:function(){this.addBytes(0);var p=(this._now()-this._lastCheckpoint)/1e3;return p==0&&(p=1),this._intervalBytes/p/1024},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"lastSecondKBps",{get:function(){return this.addBytes(0),this._lastSecondBytes!==0?this._lastSecondBytes/1024:this._now()-this._lastCheckpoint>=500?this.currentKBps:0},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"averageKBps",{get:function(){var p=(this._now()-this._firstCheckpoint)/1e3;return this._totalBytes/p/1024},enumerable:!1,configurable:!0}),c}();o.default=h},"./src/io/websocket-loader.js":function(a,o,l){l.r(o);var h=l("./src/io/loader.js"),c=l("./src/utils/exception.js"),p=function(){var E=function(g,b){return E=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,x){C.__proto__=x}||function(C,x){for(var y in x)Object.prototype.hasOwnProperty.call(x,y)&&(C[y]=x[y])},E(g,b)};return function(g,b){if(typeof b!="function"&&b!==null)throw new TypeError("Class extends value "+String(b)+" is not a constructor or null");E(g,b);function C(){this.constructor=g}g.prototype=b===null?Object.create(b):(C.prototype=b.prototype,new C)}}(),_=function(E){p(g,E);function g(){var b=E.call(this,"websocket-loader")||this;return b.TAG="WebSocketLoader",b._needStash=!0,b._ws=null,b._requestAbort=!1,b._receivedLength=0,b}return g.isSupported=function(){try{return typeof self.WebSocket!="undefined"}catch(b){return!1}},g.prototype.destroy=function(){this._ws&&this.abort(),E.prototype.destroy.call(this)},g.prototype.open=function(b){try{var C=this._ws=new self.WebSocket(b.url);C.binaryType="arraybuffer",C.onopen=this._onWebSocketOpen.bind(this),C.onclose=this._onWebSocketClose.bind(this),C.onmessage=this._onWebSocketMessage.bind(this),C.onerror=this._onWebSocketError.bind(this),this._status=h.LoaderStatus.kConnecting}catch(y){this._status=h.LoaderStatus.kError;var x={code:y.code,msg:y.message};if(this._onError)this._onError(h.LoaderErrors.EXCEPTION,x);else throw new c.RuntimeException(x.msg)}},g.prototype.abort=function(){var b=this._ws;b&&(b.readyState===0||b.readyState===1)&&(this._requestAbort=!0,b.close()),this._ws=null,this._status=h.LoaderStatus.kComplete},g.prototype._onWebSocketOpen=function(b){this._status=h.LoaderStatus.kBuffering},g.prototype._onWebSocketClose=function(b){if(this._requestAbort===!0){this._requestAbort=!1;return}this._status=h.LoaderStatus.kComplete,this._onComplete&&this._onComplete(0,this._receivedLength-1)},g.prototype._onWebSocketMessage=function(b){var C=this;if(b.data instanceof ArrayBuffer)this._dispatchArrayBuffer(b.data);else if(b.data instanceof Blob){var x=new FileReader;x.onload=function(){C._dispatchArrayBuffer(x.result)},x.readAsArrayBuffer(b.data)}else{this._status=h.LoaderStatus.kError;var y={code:-1,msg:"Unsupported WebSocket message type: "+b.data.constructor.name};if(this._onError)this._onError(h.LoaderErrors.EXCEPTION,y);else throw new c.RuntimeException(y.msg)}},g.prototype._dispatchArrayBuffer=function(b){var C=b,x=this._receivedLength;this._receivedLength+=C.byteLength,this._onDataArrival&&this._onDataArrival(C,x,this._receivedLength)},g.prototype._onWebSocketError=function(b){this._status=h.LoaderStatus.kError;var C={code:b.code,msg:b.message};if(this._onError)this._onError(h.LoaderErrors.EXCEPTION,C);else throw new c.RuntimeException(C.msg)},g}(h.BaseLoader);o.default=_},"./src/io/xhr-moz-chunked-loader.js":function(a,o,l){l.r(o);var h=l("./src/utils/logger.js"),c=l("./src/io/loader.js"),p=l("./src/utils/exception.js"),_=function(){var g=function(b,C){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,y){x.__proto__=y}||function(x,y){for(var D in y)Object.prototype.hasOwnProperty.call(y,D)&&(x[D]=y[D])},g(b,C)};return function(b,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");g(b,C);function x(){this.constructor=b}b.prototype=C===null?Object.create(C):(x.prototype=C.prototype,new x)}}(),E=function(g){_(b,g);function b(C,x){var y=g.call(this,"xhr-moz-chunked-loader")||this;return y.TAG="MozChunkedLoader",y._seekHandler=C,y._config=x,y._needStash=!0,y._xhr=null,y._requestAbort=!1,y._contentLength=null,y._receivedLength=0,y}return b.isSupported=function(){try{var C=new XMLHttpRequest;return C.open("GET","https://example.com",!0),C.responseType="moz-chunked-arraybuffer",C.responseType==="moz-chunked-arraybuffer"}catch(x){return h.default.w("MozChunkedLoader",x.message),!1}},b.prototype.destroy=function(){this.isWorking()&&this.abort(),this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onloadend=null,this._xhr.onerror=null,this._xhr=null),g.prototype.destroy.call(this)},b.prototype.open=function(C,x){this._dataSource=C,this._range=x;var y=C.url;this._config.reuseRedirectedURL&&C.redirectedURL!=null&&(y=C.redirectedURL);var D=this._seekHandler.getConfig(y,x);this._requestURL=D.url;var S=this._xhr=new XMLHttpRequest;if(S.open("GET",D.url,!0),S.responseType="moz-chunked-arraybuffer",S.onreadystatechange=this._onReadyStateChange.bind(this),S.onprogress=this._onProgress.bind(this),S.onloadend=this._onLoadEnd.bind(this),S.onerror=this._onXhrError.bind(this),C.withCredentials&&(S.withCredentials=!0),typeof D.headers=="object"){var v=D.headers;for(var w in v)v.hasOwnProperty(w)&&S.setRequestHeader(w,v[w])}if(typeof this._config.headers=="object"){var v=this._config.headers;for(var w in v)v.hasOwnProperty(w)&&S.setRequestHeader(w,v[w])}this._status=c.LoaderStatus.kConnecting,S.send()},b.prototype.abort=function(){this._requestAbort=!0,this._xhr&&this._xhr.abort(),this._status=c.LoaderStatus.kComplete},b.prototype._onReadyStateChange=function(C){var x=C.target;if(x.readyState===2){if(x.responseURL!=null&&x.responseURL!==this._requestURL&&this._onURLRedirect){var y=this._seekHandler.removeURLParameters(x.responseURL);this._onURLRedirect(y)}if(x.status!==0&&(x.status<200||x.status>299))if(this._status=c.LoaderStatus.kError,this._onError)this._onError(c.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:x.status,msg:x.statusText});else throw new p.RuntimeException("MozChunkedLoader: Http code invalid, "+x.status+" "+x.statusText);else this._status=c.LoaderStatus.kBuffering}},b.prototype._onProgress=function(C){if(this._status!==c.LoaderStatus.kError){this._contentLength===null&&C.total!==null&&C.total!==0&&(this._contentLength=C.total,this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength));var x=C.target.response,y=this._range.from+this._receivedLength;this._receivedLength+=x.byteLength,this._onDataArrival&&this._onDataArrival(x,y,this._receivedLength)}},b.prototype._onLoadEnd=function(C){if(this._requestAbort===!0){this._requestAbort=!1;return}else if(this._status===c.LoaderStatus.kError)return;this._status=c.LoaderStatus.kComplete,this._onComplete&&this._onComplete(this._range.from,this._range.from+this._receivedLength-1)},b.prototype._onXhrError=function(C){this._status=c.LoaderStatus.kError;var x=0,y=null;if(this._contentLength&&C.loaded=this._contentLength&&(D=this._range.from+this._contentLength-1),this._currentRequestRange={from:y,to:D},this._internalOpen(this._dataSource,this._currentRequestRange)},C.prototype._internalOpen=function(x,y){this._lastTimeLoaded=0;var D=x.url;this._config.reuseRedirectedURL&&(this._currentRedirectedURL!=null?D=this._currentRedirectedURL:x.redirectedURL!=null&&(D=x.redirectedURL));var S=this._seekHandler.getConfig(D,y);this._currentRequestURL=S.url;var v=this._xhr=new XMLHttpRequest;if(v.open("GET",S.url,!0),v.responseType="arraybuffer",v.onreadystatechange=this._onReadyStateChange.bind(this),v.onprogress=this._onProgress.bind(this),v.onload=this._onLoad.bind(this),v.onerror=this._onXhrError.bind(this),x.withCredentials&&(v.withCredentials=!0),typeof S.headers=="object"){var w=S.headers;for(var L in w)w.hasOwnProperty(L)&&v.setRequestHeader(L,w[L])}if(typeof this._config.headers=="object"){var w=this._config.headers;for(var L in w)w.hasOwnProperty(L)&&v.setRequestHeader(L,w[L])}v.send()},C.prototype.abort=function(){this._requestAbort=!0,this._internalAbort(),this._status=p.LoaderStatus.kComplete},C.prototype._internalAbort=function(){this._xhr&&(this._xhr.onreadystatechange=null,this._xhr.onprogress=null,this._xhr.onload=null,this._xhr.onerror=null,this._xhr.abort(),this._xhr=null)},C.prototype._onReadyStateChange=function(x){var y=x.target;if(y.readyState===2){if(y.responseURL!=null){var D=this._seekHandler.removeURLParameters(y.responseURL);y.responseURL!==this._currentRequestURL&&D!==this._currentRedirectedURL&&(this._currentRedirectedURL=D,this._onURLRedirect&&this._onURLRedirect(D))}if(y.status>=200&&y.status<=299){if(this._waitForTotalLength)return;this._status=p.LoaderStatus.kBuffering}else if(this._status=p.LoaderStatus.kError,this._onError)this._onError(p.LoaderErrors.HTTP_STATUS_CODE_INVALID,{code:y.status,msg:y.statusText});else throw new _.RuntimeException("RangeLoader: Http code invalid, "+y.status+" "+y.statusText)}},C.prototype._onProgress=function(x){if(this._status!==p.LoaderStatus.kError){if(this._contentLength===null){var y=!1;if(this._waitForTotalLength){this._waitForTotalLength=!1,this._totalLengthReceived=!0,y=!0;var D=x.total;this._internalAbort(),D!=null&D!==0&&(this._totalLength=D)}if(this._range.to===-1?this._contentLength=this._totalLength-this._range.from:this._contentLength=this._range.to-this._range.from+1,y){this._openSubRange();return}this._onContentLengthKnown&&this._onContentLengthKnown(this._contentLength)}var S=x.loaded-this._lastTimeLoaded;this._lastTimeLoaded=x.loaded,this._speedSampler.addBytes(S)}},C.prototype._normalizeSpeed=function(x){var y=this._chunkSizeKBList,D=y.length-1,S=0,v=0,w=D;if(x=y[S]&&x=3&&(y=this._speedSampler.currentKBps)),y!==0){var D=this._normalizeSpeed(y);this._currentSpeedNormalized!==D&&(this._currentSpeedNormalized=D,this._currentChunkSizeKB=D)}var S=x.target.response,v=this._range.from+this._receivedLength;this._receivedLength+=S.byteLength;var w=!1;this._contentLength!=null&&this._receivedLength0&&this._receivedLength0&&(this._requestSetTime=!0,this._mediaElement.currentTime=0),this._transmuxer=new g.default(this._mediaDataSource,this._config),this._transmuxer.on(b.default.INIT_SEGMENT,function(O,F){L._msectl.appendInitSegment(F)}),this._transmuxer.on(b.default.MEDIA_SEGMENT,function(O,F){if(L._msectl.appendMediaSegment(F),L._config.lazyLoad&&!L._config.isLive){var V=L._mediaElement.currentTime;F.info.endDts>=(V+L._config.lazyLoadMaxDuration)*1e3&&L._progressChecker==null&&(p.default.v(L.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),L._suspendTransmuxer())}}),this._transmuxer.on(b.default.LOADING_COMPLETE,function(){L._msectl.endOfStream(),L._emitter.emit(E.default.LOADING_COMPLETE)}),this._transmuxer.on(b.default.RECOVERED_EARLY_EOF,function(){L._emitter.emit(E.default.RECOVERED_EARLY_EOF)}),this._transmuxer.on(b.default.IO_ERROR,function(O,F){L._emitter.emit(E.default.ERROR,y.ErrorTypes.NETWORK_ERROR,O,F)}),this._transmuxer.on(b.default.DEMUX_ERROR,function(O,F){L._emitter.emit(E.default.ERROR,y.ErrorTypes.MEDIA_ERROR,O,{code:-1,msg:F})}),this._transmuxer.on(b.default.MEDIA_INFO,function(O){L._mediaInfo=O,L._emitter.emit(E.default.MEDIA_INFO,Object.assign({},O))}),this._transmuxer.on(b.default.METADATA_ARRIVED,function(O){L._emitter.emit(E.default.METADATA_ARRIVED,O)}),this._transmuxer.on(b.default.SCRIPTDATA_ARRIVED,function(O){L._emitter.emit(E.default.SCRIPTDATA_ARRIVED,O)}),this._transmuxer.on(b.default.STATISTICS_INFO,function(O){L._statisticsInfo=L._fillStatisticsInfo(O),L._emitter.emit(E.default.STATISTICS_INFO,Object.assign({},L._statisticsInfo))}),this._transmuxer.on(b.default.RECOMMEND_SEEKPOINT,function(O){L._mediaElement&&!L._config.accurateSeek&&(L._requestSetTime=!0,L._mediaElement.currentTime=O/1e3)}),this._transmuxer.open()}},w.prototype.unload=function(){this._mediaElement&&this._mediaElement.pause(),this._msectl&&this._msectl.seek(0),this._transmuxer&&(this._transmuxer.close(),this._transmuxer.destroy(),this._transmuxer=null)},w.prototype.play=function(){return this._mediaElement.play()},w.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(w.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(L){this._mediaElement.volume=L},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(L){this._mediaElement.muted=L},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(L){this._mediaElement?this._internalSeek(L):this._pendingSeekTime=L},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"mediaInfo",{get:function(){return Object.assign({},this._mediaInfo)},enumerable:!1,configurable:!0}),Object.defineProperty(w.prototype,"statisticsInfo",{get:function(){return this._statisticsInfo==null&&(this._statisticsInfo={}),this._statisticsInfo=this._fillStatisticsInfo(this._statisticsInfo),Object.assign({},this._statisticsInfo)},enumerable:!1,configurable:!0}),w.prototype._fillStatisticsInfo=function(L){if(L.playerType=this._type,!(this._mediaElement instanceof HTMLVideoElement))return L;var O=!0,F=0,V=0;if(this._mediaElement.getVideoPlaybackQuality){var U=this._mediaElement.getVideoPlaybackQuality();F=U.totalVideoFrames,V=U.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(F=this._mediaElement.webkitDecodedFrameCount,V=this._mediaElement.webkitDroppedFrameCount):O=!1;return O&&(L.decodedFrames=F,L.droppedFrames=V),L},w.prototype._onmseUpdateEnd=function(){if(!(!this._config.lazyLoad||this._config.isLive)){for(var L=this._mediaElement.buffered,O=this._mediaElement.currentTime,F=0,V=0;V=O+this._config.lazyLoadMaxDuration&&this._progressChecker==null&&(p.default.v(this.TAG,"Maximum buffering duration exceeded, suspend transmuxing task"),this._suspendTransmuxer())}},w.prototype._onmseBufferFull=function(){p.default.v(this.TAG,"MSE SourceBuffer is full, suspend transmuxing task"),this._progressChecker==null&&this._suspendTransmuxer()},w.prototype._suspendTransmuxer=function(){this._transmuxer&&(this._transmuxer.pause(),this._progressChecker==null&&(this._progressChecker=window.setInterval(this._checkProgressAndResume.bind(this),1e3)))},w.prototype._checkProgressAndResume=function(){for(var L=this._mediaElement.currentTime,O=this._mediaElement.buffered,F=!1,V=0;V=U&&L=B-this._config.lazyLoadRecoverDuration&&(F=!0);break}}F&&(window.clearInterval(this._progressChecker),this._progressChecker=null,F&&(p.default.v(this.TAG,"Continue loading from paused position"),this._transmuxer.resume()))},w.prototype._isTimepointBuffered=function(L){for(var O=this._mediaElement.buffered,F=0;F=V&&L0){var U=this._mediaElement.buffered.start(0);(U<1&&L0&&O.currentTime0){var V=F.start(0);if(V<1&&O0&&(this._mediaElement.currentTime=0),this._mediaElement.preload="auto",this._mediaElement.load(),this._statisticsReporter=window.setInterval(this._reportStatisticsInfo.bind(this),this._config.statisticsInfoReportInterval)},b.prototype.unload=function(){this._mediaElement&&(this._mediaElement.src="",this._mediaElement.removeAttribute("src")),this._statisticsReporter!=null&&(window.clearInterval(this._statisticsReporter),this._statisticsReporter=null)},b.prototype.play=function(){return this._mediaElement.play()},b.prototype.pause=function(){this._mediaElement.pause()},Object.defineProperty(b.prototype,"type",{get:function(){return this._type},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"buffered",{get:function(){return this._mediaElement.buffered},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"duration",{get:function(){return this._mediaElement.duration},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"volume",{get:function(){return this._mediaElement.volume},set:function(C){this._mediaElement.volume=C},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"muted",{get:function(){return this._mediaElement.muted},set:function(C){this._mediaElement.muted=C},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentTime",{get:function(){return this._mediaElement?this._mediaElement.currentTime:0},set:function(C){this._mediaElement?this._mediaElement.currentTime=C:this._pendingSeekTime=C},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"mediaInfo",{get:function(){var C=this._mediaElement instanceof HTMLAudioElement?"audio/":"video/",x={mimeType:C+this._mediaDataSource.type};return this._mediaElement&&(x.duration=Math.floor(this._mediaElement.duration*1e3),this._mediaElement instanceof HTMLVideoElement&&(x.width=this._mediaElement.videoWidth,x.height=this._mediaElement.videoHeight)),x},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"statisticsInfo",{get:function(){var C={playerType:this._type,url:this._mediaDataSource.url};if(!(this._mediaElement instanceof HTMLVideoElement))return C;var x=!0,y=0,D=0;if(this._mediaElement.getVideoPlaybackQuality){var S=this._mediaElement.getVideoPlaybackQuality();y=S.totalVideoFrames,D=S.droppedVideoFrames}else this._mediaElement.webkitDecodedFrameCount!=null?(y=this._mediaElement.webkitDecodedFrameCount,D=this._mediaElement.webkitDroppedFrameCount):x=!1;return x&&(C.decodedFrames=y,C.droppedFrames=D),C},enumerable:!1,configurable:!0}),b.prototype._onvLoadedMetadata=function(C){this._pendingSeekTime!=null&&(this._mediaElement.currentTime=this._pendingSeekTime,this._pendingSeekTime=null),this._emitter.emit(p.default.MEDIA_INFO,this.mediaInfo)},b.prototype._reportStatisticsInfo=function(){this._emitter.emit(p.default.STATISTICS_INFO,this.statisticsInfo)},b}();o.default=g},"./src/player/player-errors.js":function(a,o,l){l.r(o),l.d(o,{ErrorTypes:function(){return p},ErrorDetails:function(){return _}});var h=l("./src/io/loader.js"),c=l("./src/demux/demux-errors.js"),p={NETWORK_ERROR:"NetworkError",MEDIA_ERROR:"MediaError",OTHER_ERROR:"OtherError"},_={NETWORK_EXCEPTION:h.LoaderErrors.EXCEPTION,NETWORK_STATUS_CODE_INVALID:h.LoaderErrors.HTTP_STATUS_CODE_INVALID,NETWORK_TIMEOUT:h.LoaderErrors.CONNECTING_TIMEOUT,NETWORK_UNRECOVERABLE_EARLY_EOF:h.LoaderErrors.UNRECOVERABLE_EARLY_EOF,MEDIA_MSE_ERROR:"MediaMSEError",MEDIA_FORMAT_ERROR:c.default.FORMAT_ERROR,MEDIA_FORMAT_UNSUPPORTED:c.default.FORMAT_UNSUPPORTED,MEDIA_CODEC_UNSUPPORTED:c.default.CODEC_UNSUPPORTED}},"./src/player/player-events.js":function(a,o,l){l.r(o);var h={ERROR:"error",LOADING_COMPLETE:"loading_complete",RECOVERED_EARLY_EOF:"recovered_early_eof",MEDIA_INFO:"media_info",METADATA_ARRIVED:"metadata_arrived",SCRIPTDATA_ARRIVED:"scriptdata_arrived",STATISTICS_INFO:"statistics_info"};o.default=h},"./src/remux/aac-silent.js":function(a,o,l){l.r(o);var h=function(){function c(){}return c.getSilentFrame=function(p,_){if(p==="mp4a.40.2"){if(_===1)return new Uint8Array([0,200,0,128,35,128]);if(_===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(_===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(_===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(_===5)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)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)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)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)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}return null},c}();o.default=h},"./src/remux/mp4-generator.js":function(a,o,l){l.r(o);var h=function(){function c(){}return c.init=function(){c.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[],".mp3":[]};for(var p in c.types)c.types.hasOwnProperty(p)&&(c.types[p]=[p.charCodeAt(0),p.charCodeAt(1),p.charCodeAt(2),p.charCodeAt(3)]);var _=c.constants={};_.FTYP=new Uint8Array([105,115,111,109,0,0,0,1,105,115,111,109,97,118,99,49]),_.STSD_PREFIX=new Uint8Array([0,0,0,0,0,0,0,1]),_.STTS=new Uint8Array([0,0,0,0,0,0,0,0]),_.STSC=_.STCO=_.STTS,_.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),_.HDLR_VIDEO=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),_.HDLR_AUDIO=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]),_.DREF=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),_.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])},c.box=function(p){for(var _=8,E=null,g=Array.prototype.slice.call(arguments,1),b=g.length,C=0;C>>24&255,E[1]=_>>>16&255,E[2]=_>>>8&255,E[3]=_&255,E.set(p,4);for(var x=8,C=0;C>>24&255,p>>>16&255,p>>>8&255,p&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255,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]))},c.trak=function(p){return c.box(c.types.trak,c.tkhd(p),c.mdia(p))},c.tkhd=function(p){var _=p.id,E=p.duration,g=p.presentWidth,b=p.presentHeight;return c.box(c.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,_>>>24&255,_>>>16&255,_>>>8&255,_&255,0,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,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,g>>>8&255,g&255,0,0,b>>>8&255,b&255,0,0]))},c.mdia=function(p){return c.box(c.types.mdia,c.mdhd(p),c.hdlr(p),c.minf(p))},c.mdhd=function(p){var _=p.timescale,E=p.duration;return c.box(c.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,_>>>24&255,_>>>16&255,_>>>8&255,_&255,E>>>24&255,E>>>16&255,E>>>8&255,E&255,85,196,0,0]))},c.hdlr=function(p){var _=null;return p.type==="audio"?_=c.constants.HDLR_AUDIO:_=c.constants.HDLR_VIDEO,c.box(c.types.hdlr,_)},c.minf=function(p){var _=null;return p.type==="audio"?_=c.box(c.types.smhd,c.constants.SMHD):_=c.box(c.types.vmhd,c.constants.VMHD),c.box(c.types.minf,_,c.dinf(),c.stbl(p))},c.dinf=function(){var p=c.box(c.types.dinf,c.box(c.types.dref,c.constants.DREF));return p},c.stbl=function(p){var _=c.box(c.types.stbl,c.stsd(p),c.box(c.types.stts,c.constants.STTS),c.box(c.types.stsc,c.constants.STSC),c.box(c.types.stsz,c.constants.STSZ),c.box(c.types.stco,c.constants.STCO));return _},c.stsd=function(p){return p.type==="audio"?p.codec==="mp3"?c.box(c.types.stsd,c.constants.STSD_PREFIX,c.mp3(p)):c.box(c.types.stsd,c.constants.STSD_PREFIX,c.mp4a(p)):c.box(c.types.stsd,c.constants.STSD_PREFIX,c.avc1(p))},c.mp3=function(p){var _=p.channelCount,E=p.audioSampleRate,g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,_,0,16,0,0,0,0,E>>>8&255,E&255,0,0]);return c.box(c.types[".mp3"],g)},c.mp4a=function(p){var _=p.channelCount,E=p.audioSampleRate,g=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,_,0,16,0,0,0,0,E>>>8&255,E&255,0,0]);return c.box(c.types.mp4a,g,c.esds(p))},c.esds=function(p){var _=p.config||[],E=_.length,g=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(_).concat([6,1,2]));return c.box(c.types.esds,g)},c.avc1=function(p){var _=p.avcc,E=p.codecWidth,g=p.codecHeight,b=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,E>>>8&255,E&255,g>>>8&255,g&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,10,120,113,113,47,102,108,118,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,255,255]);return c.box(c.types.avc1,b,c.box(c.types.avcC,_))},c.mvex=function(p){return c.box(c.types.mvex,c.trex(p))},c.trex=function(p){var _=p.id,E=new Uint8Array([0,0,0,0,_>>>24&255,_>>>16&255,_>>>8&255,_&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return c.box(c.types.trex,E)},c.moof=function(p,_){return c.box(c.types.moof,c.mfhd(p.sequenceNumber),c.traf(p,_))},c.mfhd=function(p){var _=new Uint8Array([0,0,0,0,p>>>24&255,p>>>16&255,p>>>8&255,p&255]);return c.box(c.types.mfhd,_)},c.traf=function(p,_){var E=p.id,g=c.box(c.types.tfhd,new Uint8Array([0,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255])),b=c.box(c.types.tfdt,new Uint8Array([0,0,0,0,_>>>24&255,_>>>16&255,_>>>8&255,_&255])),C=c.sdtp(p),x=c.trun(p,C.byteLength+16+16+8+16+8+8);return c.box(c.types.traf,g,b,x,C)},c.sdtp=function(p){for(var _=p.samples||[],E=_.length,g=new Uint8Array(4+E),b=0;b>>24&255,g>>>16&255,g>>>8&255,g&255,_>>>24&255,_>>>16&255,_>>>8&255,_&255],0);for(var x=0;x>>24&255,y>>>16&255,y>>>8&255,y&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255,S.isLeading<<2|S.dependsOn,S.isDependedOn<<6|S.hasRedundancy<<4|S.isNonSync,0,0,v>>>24&255,v>>>16&255,v>>>8&255,v&255],12+16*x)}return c.box(c.types.trun,C)},c.mdat=function(p){return c.box(c.types.mdat,p)},c}();h.init(),o.default=h},"./src/remux/mp4-remuxer.js":function(a,o,l){l.r(o);var h=l("./src/utils/logger.js"),c=l("./src/remux/mp4-generator.js"),p=l("./src/remux/aac-silent.js"),_=l("./src/utils/browser.js"),E=l("./src/core/media-segment-info.js"),g=l("./src/utils/exception.js"),b=function(){function C(x){this.TAG="MP4Remuxer",this._config=x,this._isLive=x.isLive===!0,this._dtsBase=-1,this._dtsBaseInited=!1,this._audioDtsBase=1/0,this._videoDtsBase=1/0,this._audioNextDts=void 0,this._videoNextDts=void 0,this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList=new E.MediaSegmentInfoList("audio"),this._videoSegmentInfoList=new E.MediaSegmentInfoList("video"),this._onInitSegment=null,this._onMediaSegment=null,this._forceFirstIDR=!!(_.default.chrome&&(_.default.version.major<50||_.default.version.major===50&&_.default.version.build<2661)),this._fillSilentAfterSeek=_.default.msedge||_.default.msie,this._mp3UseMpegAudio=!_.default.firefox,this._fillAudioTimestampGap=this._config.fixAudioTimestampGap}return C.prototype.destroy=function(){this._dtsBase=-1,this._dtsBaseInited=!1,this._audioMeta=null,this._videoMeta=null,this._audioSegmentInfoList.clear(),this._audioSegmentInfoList=null,this._videoSegmentInfoList.clear(),this._videoSegmentInfoList=null,this._onInitSegment=null,this._onMediaSegment=null},C.prototype.bindDataSource=function(x){return x.onDataAvailable=this.remux.bind(this),x.onTrackMetadata=this._onTrackMetadataReceived.bind(this),this},Object.defineProperty(C.prototype,"onInitSegment",{get:function(){return this._onInitSegment},set:function(x){this._onInitSegment=x},enumerable:!1,configurable:!0}),Object.defineProperty(C.prototype,"onMediaSegment",{get:function(){return this._onMediaSegment},set:function(x){this._onMediaSegment=x},enumerable:!1,configurable:!0}),C.prototype.insertDiscontinuity=function(){this._audioNextDts=this._videoNextDts=void 0},C.prototype.seek=function(x){this._audioStashedLastSample=null,this._videoStashedLastSample=null,this._videoSegmentInfoList.clear(),this._audioSegmentInfoList.clear()},C.prototype.remux=function(x,y){if(!this._onMediaSegment)throw new g.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");this._dtsBaseInited||this._calculateDtsBase(x,y),this._remuxVideo(y),this._remuxAudio(x)},C.prototype._onTrackMetadataReceived=function(x,y){var D=null,S="mp4",v=y.codec;if(x==="audio")this._audioMeta=y,y.codec==="mp3"&&this._mp3UseMpegAudio?(S="mpeg",v="",D=new Uint8Array):D=c.default.generateInitSegment(y);else if(x==="video")this._videoMeta=y,D=c.default.generateInitSegment(y);else return;if(!this._onInitSegment)throw new g.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");this._onInitSegment(x,{type:x,data:D.buffer,codec:v,container:x+"/"+S,mediaDuration:y.duration})},C.prototype._calculateDtsBase=function(x,y){this._dtsBaseInited||(x.samples&&x.samples.length&&(this._audioDtsBase=x.samples[0].dts),y.samples&&y.samples.length&&(this._videoDtsBase=y.samples[0].dts),this._dtsBase=Math.min(this._audioDtsBase,this._videoDtsBase),this._dtsBaseInited=!0)},C.prototype.flushStashedSamples=function(){var x=this._videoStashedLastSample,y=this._audioStashedLastSample,D={type:"video",id:1,sequenceNumber:0,samples:[],length:0};x!=null&&(D.samples.push(x),D.length=x.length);var S={type:"audio",id:2,sequenceNumber:0,samples:[],length:0};y!=null&&(S.samples.push(y),S.length=y.length),this._videoStashedLastSample=null,this._audioStashedLastSample=null,this._remuxVideo(D,!0),this._remuxAudio(S,!0)},C.prototype._remuxAudio=function(x,y){if(this._audioMeta!=null){var D=x,S=D.samples,v=void 0,w=-1,L=-1,O=this._audioMeta.refSampleDuration,F=this._audioMeta.codec==="mp3"&&this._mp3UseMpegAudio,V=this._dtsBaseInited&&this._audioNextDts===void 0,U=!1;if(!(!S||S.length===0)&&!(S.length===1&&!y)){var B=0,N=null,$=0;F?(B=0,$=D.length):(B=8,$=8+D.length);var K=null;if(S.length>1&&(K=S.pop(),$-=K.length),this._audioStashedLastSample!=null){var q=this._audioStashedLastSample;this._audioStashedLastSample=null,S.unshift(q),$+=q.length}K!=null&&(this._audioStashedLastSample=K);var Q=S[0].dts-this._dtsBase;if(this._audioNextDts)v=Q-this._audioNextDts;else if(this._audioSegmentInfoList.isEmpty())v=0,this._fillSilentAfterSeek&&!this._videoSegmentInfoList.isEmpty()&&this._audioMeta.originalCodec!=="mp3"&&(U=!0);else{var oe=this._audioSegmentInfoList.getLastSampleBefore(Q);if(oe!=null){var le=Q-(oe.originalDts+oe.duration);le<=3&&(le=0);var se=oe.dts+oe.duration+le;v=Q-se}else v=0}if(U){var pe=Q-v,Te=this._videoSegmentInfoList.getLastSegmentBefore(Q);if(Te!=null&&Te.beginDts=et*O&&this._fillAudioTimestampGap&&!_.default.safari){Ze=!0;var bt=Math.floor(v/O);h.default.w(this.TAG,`Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync. `+("originalDts: "+Ve+" ms, curRefDts: "+ue+" ms, ")+("dtsCorrection: "+Math.round(v)+" ms, generate: "+bt+" frames")),_e=Math.floor(ue),Ce=Math.floor(ue+O)-_e;var ae=p.default.getSilentFrame(this._audioMeta.originalCodec,this._audioMeta.channelCount);ae==null&&(h.default.w(this.TAG,"Unable to generate silent frame for "+(this._audioMeta.originalCodec+" with "+this._audioMeta.channelCount+" channels, repeat last frame")),ae=ut),It=[];for(var ei=0;ei=1?Ce=xe[xe.length-1].duration:Ce=Math.floor(O);this._audioNextDts=_e+Ce}w===-1&&(w=_e),xe.push({dts:_e,pts:_e,cts:0,unit:q.unit,size:q.unit.byteLength,duration:Ce,originalDts:Ve,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0}}),Ze&&xe.push.apply(xe,It)}}if(xe.length===0){D.samples=[],D.length=0;return}F?N=new Uint8Array($):(N=new Uint8Array($),N[0]=$>>>24&255,N[1]=$>>>16&255,N[2]=$>>>8&255,N[3]=$&255,N.set(c.default.types.mdat,4));for(var De=0;De1&&(N=S.pop(),B-=N.length),this._videoStashedLastSample!=null){var $=this._videoStashedLastSample;this._videoStashedLastSample=null,S.unshift($),B+=$.length}N!=null&&(this._videoStashedLastSample=N);var K=S[0].dts-this._dtsBase;if(this._videoNextDts)v=K-this._videoNextDts;else if(this._videoSegmentInfoList.isEmpty())v=0;else{var q=this._videoSegmentInfoList.getLastSampleBefore(K);if(q!=null){var Q=K-(q.originalDts+q.duration);Q<=3&&(Q=0);var oe=q.dts+q.duration+Q;v=K-oe}else v=0}for(var le=new E.MediaSegmentInfo,se=[],pe=0;pe=1?De=se[se.length-1].duration:De=Math.floor(this._videoMeta.refSampleDuration);if(ae){var Ve=new E.SampleInfo(_e,xe,De,$.dts,!0);Ve.fileposition=$.fileposition,le.appendSyncPoint(Ve)}se.push({dts:_e,pts:xe,cts:gt,units:$.units,size:$.length,isKeyframe:ae,duration:De,originalDts:Te,flags:{isLeading:0,dependsOn:ae?2:1,isDependedOn:ae?1:0,hasRedundancy:0,isNonSync:ae?0:1}})}U=new Uint8Array(B),U[0]=B>>>24&255,U[1]=B>>>16&255,U[2]=B>>>8&255,U[3]=B&255,U.set(c.default.types.mdat,4);for(var pe=0;pe=0&&/(rv)(?::| )([\w.]+)/.exec(p)||p.indexOf("compatible")<0&&/(firefox)[ \/]([\w.]+)/.exec(p)||[],E=/(ipad)/.exec(p)||/(ipod)/.exec(p)||/(windows phone)/.exec(p)||/(iphone)/.exec(p)||/(kindle)/.exec(p)||/(android)/.exec(p)||/(windows)/.exec(p)||/(mac)/.exec(p)||/(linux)/.exec(p)||/(cros)/.exec(p)||[],g={browser:_[5]||_[3]||_[1]||"",version:_[2]||_[4]||"0",majorVersion:_[4]||_[2]||"0",platform:E[0]||""},b={};if(g.browser){b[g.browser]=!0;var C=g.majorVersion.split(".");b.version={major:parseInt(g.majorVersion,10),string:g.version},C.length>1&&(b.version.minor=parseInt(C[1],10)),C.length>2&&(b.version.build=parseInt(C[2],10))}if(g.platform&&(b[g.platform]=!0),(b.chrome||b.opr||b.safari)&&(b.webkit=!0),b.rv||b.iemobile){b.rv&&delete b.rv;var x="msie";g.browser=x,b[x]=!0}if(b.edge){delete b.edge;var y="msedge";g.browser=y,b[y]=!0}if(b.opr){var D="opera";g.browser=D,b[D]=!0}if(b.safari&&b.android){var S="android";g.browser=S,b[S]=!0}b.name=g.browser,b.platform=g.platform;for(var v in h)h.hasOwnProperty(v)&&delete h[v];Object.assign(h,b)}c(),o.default=h},"./src/utils/exception.js":function(a,o,l){l.r(o),l.d(o,{RuntimeException:function(){return c},IllegalStateException:function(){return p},InvalidArgumentException:function(){return _},NotImplementedException:function(){return E}});var h=function(){var g=function(b,C){return g=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(x,y){x.__proto__=y}||function(x,y){for(var D in y)Object.prototype.hasOwnProperty.call(y,D)&&(x[D]=y[D])},g(b,C)};return function(b,C){if(typeof C!="function"&&C!==null)throw new TypeError("Class extends value "+String(C)+" is not a constructor or null");g(b,C);function x(){this.constructor=b}b.prototype=C===null?Object.create(C):(x.prototype=C.prototype,new x)}}(),c=function(){function g(b){this._message=b}return Object.defineProperty(g.prototype,"name",{get:function(){return"RuntimeException"},enumerable:!1,configurable:!0}),Object.defineProperty(g.prototype,"message",{get:function(){return this._message},enumerable:!1,configurable:!0}),g.prototype.toString=function(){return this.name+": "+this.message},g}(),p=function(g){h(b,g);function b(C){return g.call(this,C)||this}return Object.defineProperty(b.prototype,"name",{get:function(){return"IllegalStateException"},enumerable:!1,configurable:!0}),b}(c),_=function(g){h(b,g);function b(C){return g.call(this,C)||this}return Object.defineProperty(b.prototype,"name",{get:function(){return"InvalidArgumentException"},enumerable:!1,configurable:!0}),b}(c),E=function(g){h(b,g);function b(C){return g.call(this,C)||this}return Object.defineProperty(b.prototype,"name",{get:function(){return"NotImplementedException"},enumerable:!1,configurable:!0}),b}(c)},"./src/utils/logger.js":function(a,o,l){l.r(o);var h=l("./node_modules/events/events.js"),c=l.n(h),p=function(){function _(){}return _.e=function(E,g){(!E||_.FORCE_GLOBAL_TAG)&&(E=_.GLOBAL_TAG);var b="["+E+"] > "+g;_.ENABLE_CALLBACK&&_.emitter.emit("log","error",b),_.ENABLE_ERROR&&(console.error?console.error(b):console.warn&&console.warn(b))},_.i=function(E,g){(!E||_.FORCE_GLOBAL_TAG)&&(E=_.GLOBAL_TAG);var b="["+E+"] > "+g;_.ENABLE_CALLBACK&&_.emitter.emit("log","info",b),!!_.ENABLE_INFO&&console.info&&console.info(b)},_.w=function(E,g){(!E||_.FORCE_GLOBAL_TAG)&&(E=_.GLOBAL_TAG);var b="["+E+"] > "+g;_.ENABLE_CALLBACK&&_.emitter.emit("log","warn",b),!!_.ENABLE_WARN&&console.warn&&console.warn(b)},_.d=function(E,g){(!E||_.FORCE_GLOBAL_TAG)&&(E=_.GLOBAL_TAG);var b="["+E+"] > "+g;_.ENABLE_CALLBACK&&_.emitter.emit("log","debug",b),!!_.ENABLE_DEBUG&&console.debug&&console.debug(b)},_.v=function(E,g){(!E||_.FORCE_GLOBAL_TAG)&&(E=_.GLOBAL_TAG);var b="["+E+"] > "+g;_.ENABLE_CALLBACK&&_.emitter.emit("log","verbose",b),_.ENABLE_VERBOSE},_}();p.GLOBAL_TAG="flv.js",p.FORCE_GLOBAL_TAG=!1,p.ENABLE_ERROR=!0,p.ENABLE_INFO=!0,p.ENABLE_WARN=!0,p.ENABLE_DEBUG=!0,p.ENABLE_VERBOSE=!0,p.ENABLE_CALLBACK=!1,p.emitter=new(c()),o.default=p},"./src/utils/logging-control.js":function(a,o,l){l.r(o);var h=l("./node_modules/events/events.js"),c=l.n(h),p=l("./src/utils/logger.js"),_=function(){function E(){}return Object.defineProperty(E,"forceGlobalTag",{get:function(){return p.default.FORCE_GLOBAL_TAG},set:function(g){p.default.FORCE_GLOBAL_TAG=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"globalTag",{get:function(){return p.default.GLOBAL_TAG},set:function(g){p.default.GLOBAL_TAG=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"enableAll",{get:function(){return p.default.ENABLE_VERBOSE&&p.default.ENABLE_DEBUG&&p.default.ENABLE_INFO&&p.default.ENABLE_WARN&&p.default.ENABLE_ERROR},set:function(g){p.default.ENABLE_VERBOSE=g,p.default.ENABLE_DEBUG=g,p.default.ENABLE_INFO=g,p.default.ENABLE_WARN=g,p.default.ENABLE_ERROR=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"enableDebug",{get:function(){return p.default.ENABLE_DEBUG},set:function(g){p.default.ENABLE_DEBUG=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"enableVerbose",{get:function(){return p.default.ENABLE_VERBOSE},set:function(g){p.default.ENABLE_VERBOSE=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"enableInfo",{get:function(){return p.default.ENABLE_INFO},set:function(g){p.default.ENABLE_INFO=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"enableWarn",{get:function(){return p.default.ENABLE_WARN},set:function(g){p.default.ENABLE_WARN=g,E._notifyChange()},enumerable:!1,configurable:!0}),Object.defineProperty(E,"enableError",{get:function(){return p.default.ENABLE_ERROR},set:function(g){p.default.ENABLE_ERROR=g,E._notifyChange()},enumerable:!1,configurable:!0}),E.getConfig=function(){return{globalTag:p.default.GLOBAL_TAG,forceGlobalTag:p.default.FORCE_GLOBAL_TAG,enableVerbose:p.default.ENABLE_VERBOSE,enableDebug:p.default.ENABLE_DEBUG,enableInfo:p.default.ENABLE_INFO,enableWarn:p.default.ENABLE_WARN,enableError:p.default.ENABLE_ERROR,enableCallback:p.default.ENABLE_CALLBACK}},E.applyConfig=function(g){p.default.GLOBAL_TAG=g.globalTag,p.default.FORCE_GLOBAL_TAG=g.forceGlobalTag,p.default.ENABLE_VERBOSE=g.enableVerbose,p.default.ENABLE_DEBUG=g.enableDebug,p.default.ENABLE_INFO=g.enableInfo,p.default.ENABLE_WARN=g.enableWarn,p.default.ENABLE_ERROR=g.enableError,p.default.ENABLE_CALLBACK=g.enableCallback},E._notifyChange=function(){var g=E.emitter;if(g.listenerCount("change")>0){var b=E.getConfig();g.emit("change",b)}},E.registerListener=function(g){E.emitter.addListener("change",g)},E.removeListener=function(g){E.emitter.removeListener("change",g)},E.addLogListener=function(g){p.default.emitter.addListener("log",g),p.default.emitter.listenerCount("log")>0&&(p.default.ENABLE_CALLBACK=!0,E._notifyChange())},E.removeLogListener=function(g){p.default.emitter.removeListener("log",g),p.default.emitter.listenerCount("log")===0&&(p.default.ENABLE_CALLBACK=!1,E._notifyChange())},E}();_.emitter=new(c()),o.default=_},"./src/utils/polyfill.js":function(a,o,l){l.r(o);var h=function(){function c(){}return c.install=function(){Object.setPrototypeOf=Object.setPrototypeOf||function(p,_){return p.__proto__=_,p},Object.assign=Object.assign||function(p){if(p==null)throw new TypeError("Cannot convert undefined or null to object");for(var _=Object(p),E=1;E=128){_.push(String.fromCharCode(C&65535)),g+=2;continue}}}else if(E[g]<240){if(h(E,g,2)){var C=(E[g]&15)<<12|(E[g+1]&63)<<6|E[g+2]&63;if(C>=2048&&(C&63488)!==55296){_.push(String.fromCharCode(C&65535)),g+=3;continue}}}else if(E[g]<248&&h(E,g,3)){var C=(E[g]&7)<<18|(E[g+1]&63)<<12|(E[g+2]&63)<<6|E[g+3]&63;if(C>65536&&C<1114112){C-=65536,_.push(String.fromCharCode(C>>>10|55296)),_.push(String.fromCharCode(C&1023|56320)),g+=4;continue}}}_.push(String.fromCharCode(65533)),++g}return _.join("")}o.default=c}},r={};function s(a){var o=r[a];if(o!==void 0)return o.exports;var l=r[a]={exports:{}};return t[a].call(l.exports,l,l.exports,s),l.exports}s.m=t,function(){s.n=function(a){var o=a&&a.__esModule?function(){return a.default}:function(){return a};return s.d(o,{a:o}),o}}(),function(){s.d=function(a,o){for(var l in o)s.o(o,l)&&!s.o(a,l)&&Object.defineProperty(a,l,{enumerable:!0,get:o[l]})}}(),function(){s.g=function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch(a){if(typeof window=="object")return window}}()}(),function(){s.o=function(a,o){return Object.prototype.hasOwnProperty.call(a,o)}}(),function(){s.r=function(a){typeof Symbol!="undefined"&&Symbol.toStringTag&&Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(a,"__esModule",{value:!0})}}();var n=s("./src/index.js");return n}()})})(_p);var ic=_m(_p.exports);const g2=wo({__name:"flv",props:{url:{type:String,default:""}},setup(i){const e=i,t=Qa(null);let r=null;rc(()=>{s()});function s(){if(!!e.url&&ic.isSupported()){let o=er(t);var a=ic.createPlayer({type:"flv",isLive:!0,url:e.url});a.attachMediaElement(o),a.load(),a.play(),r=a}}function n(){!r||(r==null||r.pause(),r==null||r.unload(),r==null||r.detachMediaElement(),r==null||r.destroy(),r=null)}return sc(()=>{n()}),(a,o)=>(os(),Lo("video",{ref_key:"videoRefF",ref:t,class:"w-full h-full",autoplay:"",controls:"",muted:""},null,512))}}),_2={key:0,class:"w-full h-full"},T2=wo({__name:"index",props:{url:{type:String,default:""}},setup(i){const e=i,t=vm(),r=Cl(()=>Ia(Ia({},er(t)),er(e))),s=Cl(()=>e.url.includes(".m3u8"));return(n,a)=>i.url?(os(),Lo("div",_2,[er(s)?(os(),Al(m2,Dl({key:0},er(r),{url:i.url}),null,16,["url"])):(os(),Al(g2,Dl({key:1},er(r),{url:i.url}),null,16,["url"]))])):ym("",!0)}});export{T2 as _};