jukebox-media-server 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/bin/jukebox-media-server.js +2 -1
- package/dist/client/assets/{Watch-C2gUX-4m.js → Watch-kJkUCvFd.js} +31 -31
- package/dist/client/assets/index-1v1BzSVv.js +56 -0
- package/dist/client/assets/index-FPcl2l8F.css +1 -0
- package/dist/client/assets/workbox-window.prod.es5-BIl4cyR9.js +2 -0
- package/dist/client/index.html +24 -4
- package/dist/client/{images/site.webmanifest → manifest.webmanifest} +9 -6
- package/dist/client/offline.html +107 -0
- package/dist/client/sw.js +1 -0
- package/dist/client/workbox-d3da0cfa.js +1 -0
- package/dist/server/index.js +1258 -39
- package/drizzle/0001_steady_puma.sql +65 -65
- package/drizzle/0002_sloppy_betty_ross.sql +8 -8
- package/drizzle/0003_public_speedball.sql +42 -0
- package/drizzle/0004_motionless_bug.sql +13 -0
- package/drizzle/meta/0002_snapshot.json +591 -591
- package/drizzle/meta/0003_snapshot.json +804 -0
- package/drizzle/meta/0004_snapshot.json +880 -0
- package/drizzle/meta/_journal.json +41 -27
- package/package.json +32 -2
- package/dist/client/assets/index-D_um8N7Q.js +0 -52
- package/dist/client/assets/index-DfXUcX5G.css +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{c as Zt,r as Te,a as dn,g as yr,b as dm,j as ue,P as hm,u as fm,d as pm,e as Qs,L as mm,B as gm,f as _m}from"./index-D_um8N7Q.js";const ym=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],Tm=Zt("list",ym);const vm=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],bm=Zt("maximize",vm);const xm=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Sm=Zt("pause",xm);const Em=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Cm=Zt("rotate-ccw",Em);const wm=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Am=Zt("rotate-cw",wm);const Dm=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],km=Zt("volume-1",Dm);const Im=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],Pm=Zt("volume-2",Im);const Lm=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Om=Zt("volume-x",Lm);const Rm=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]],Nm=Zt("volume",Rm);const Mm=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Bm=Zt("x",Mm),Ic=["shift","alt","meta","mod","ctrl","control"],Fm={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Ei(s){return(Fm[s.trim()]||s.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function Pc(s){return Ic.includes(s)}function ma(s,e=","){return s.toLowerCase().split(e)}function ga(s,e="+",t=">",i=!1,r,n){let a=[],u=!1;s=s.trim(),s.includes(t)?(u=!0,a=s.toLocaleLowerCase().split(t).map(g=>Ei(g))):a=s.toLocaleLowerCase().split(e).map(g=>Ei(g));const c={alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod"),useKey:i},f=a.filter(g=>!Ic.includes(g));return{...c,keys:f,description:r,isSequence:u,hotkey:s,metadata:n}}typeof document<"u"&&(document.addEventListener("keydown",s=>{s.code!==void 0&&Lc([Ei(s.code)])}),document.addEventListener("keyup",s=>{s.code!==void 0&&Oc([Ei(s.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{ai.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{ai.clear()},0)}));const ai=new Set;function Co(s){return Array.isArray(s)}function Um(s,e=","){return(Co(s)?s:s.split(e)).every(t=>ai.has(t.trim().toLowerCase()))}function Lc(s){const e=Array.isArray(s)?s:[s];ai.has("meta")&&ai.forEach(t=>{Pc(t)||ai.delete(t.toLowerCase())}),e.forEach(t=>{ai.add(t.toLowerCase())})}function Oc(s){const e=Array.isArray(s)?s:[s];s==="meta"?ai.clear():e.forEach(t=>{ai.delete(t.toLowerCase())})}function jm(s,e,t){(typeof t=="function"&&t(s,e)||t===!0)&&s.preventDefault()}function qm(s,e,t){return typeof t=="function"?t(s,e):t===!0||t===void 0}const $m=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function Vm(s){return Rc(s,$m)}function Rc(s,e=!1){const{target:t,composed:i}=s;let r,n;return Hm(t)&&i?(r=s.composedPath()[0]&&s.composedPath()[0].tagName,n=s.composedPath()[0]&&s.composedPath()[0].role):(r=t&&t.tagName,n=t&&t.role),Co(e)?!!(r&&e&&e.some(a=>a.toLowerCase()===r.toLowerCase()||a===n)):!!(r&&e&&e)}function Hm(s){return!!s.tagName&&!s.tagName.startsWith("-")&&s.tagName.includes("-")}function zm(s,e){return s.length===0&&e?!1:e?s.some(t=>e.includes(t))||s.includes("*"):!0}const Gm=(s,e,t=!1)=>{const{alt:i,meta:r,mod:n,shift:a,ctrl:u,keys:c,useKey:f}=e,{code:g,key:_,ctrlKey:A,metaKey:S,shiftKey:O,altKey:T}=s,I=Ei(g);if(f&&c?.length===1&&c.includes(_.toLowerCase()))return!0;if(!c?.includes(I)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(I))return!1;if(!t){if(i!==T&&I!=="alt"||a!==O&&I!=="shift")return!1;if(n){if(!S&&!A)return!1}else if(r!==S&&I!=="meta"&&I!=="os"||u!==A&&I!=="ctrl"&&I!=="control")return!1}return c&&c.length===1&&c.includes(I)?!0:c&&c.length>0?c.includes(I)?Um(c):!1:!c||c.length===0},Wm=Te.createContext(void 0),Xm=()=>Te.useContext(Wm);function Nc(s,e){return s&&e&&typeof s=="object"&&typeof e=="object"?Object.keys(s).length===Object.keys(e).length&&Object.keys(s).reduce((t,i)=>t&&Nc(s[i],e[i]),!0):s===e}const Km=Te.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),Ym=()=>Te.useContext(Km);function Qm(s){const e=Te.useRef(void 0);return Nc(e.current,s)||(e.current=s),e.current}const Zu=s=>{s.stopPropagation(),s.preventDefault(),s.stopImmediatePropagation()},Jm=typeof window<"u"?Te.useLayoutEffect:Te.useEffect;function Zr(s,e,t,i){const r=Te.useRef(null),n=Te.useRef(!1),a=Array.isArray(t)?Array.isArray(i)?void 0:i:t,u=Co(s)?s.join(a?.delimiter):s,c=Array.isArray(t)?t:Array.isArray(i)?i:void 0,f=Te.useCallback(e,c??[]),g=Te.useRef(f);c?g.current=f:g.current=e;const _=Qm(a),{activeScopes:A}=Ym(),S=Xm();return Jm(()=>{if(_?.enabled===!1||!zm(A,_?.scopes))return;let O=[],T;const I=(U,j=!1)=>{if(!(Vm(U)&&!Rc(U,_?.enableOnFormTags))){if(r.current!==null){const M=r.current.getRootNode();if((M instanceof Document||M instanceof ShadowRoot)&&M.activeElement!==r.current&&!r.current.contains(M.activeElement)){Zu(U);return}}U.target?.isContentEditable&&!_?.enableOnContentEditable||ma(u,_?.delimiter).forEach(M=>{if(M.includes(_?.splitKey??"+")&&M.includes(_?.sequenceSplitKey??">")){console.warn(`Hotkey ${M} contains both ${_?.splitKey??"+"} and ${_?.sequenceSplitKey??">"} which is not supported.`);return}const L=ga(M,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata);if(L.isSequence){T=setTimeout(()=>{O=[]},_?.sequenceTimeoutMs??1e3);const $=L.useKey?U.key:Ei(U.code);if(Pc($.toLowerCase()))return;O.push($);const v=L.keys?.[O.length-1];if($!==v){O=[],T&&clearTimeout(T);return}O.length===L.keys?.length&&(g.current(U,L),T&&clearTimeout(T),O=[])}else if(Gm(U,L,_?.ignoreModifiers)||L.keys?.includes("*")){if(_?.ignoreEventWhen?.(U)||j&&n.current)return;if(jm(U,L,_?.preventDefault),!qm(U,L,_?.enabled)){Zu(U);return}g.current(U,L),j||(n.current=!0)}})}},F=U=>{U.code!==void 0&&(Lc(Ei(U.code)),(_?.keydown===void 0&&_?.keyup!==!0||_?.keydown)&&I(U))},N=U=>{U.code!==void 0&&(Oc(Ei(U.code)),n.current=!1,_?.keyup&&I(U,!0))},R=r.current||a?.document||document;return R.addEventListener("keyup",N,a?.eventListenerOptions),R.addEventListener("keydown",F,a?.eventListenerOptions),S&&ma(u,_?.delimiter).forEach(U=>{S.addHotkey(ga(U,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),()=>{R.removeEventListener("keyup",N,a?.eventListenerOptions),R.removeEventListener("keydown",F,a?.eventListenerOptions),S&&ma(u,_?.delimiter).forEach(U=>{S.removeHotkey(ga(U,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),O=[],T&&clearTimeout(T)}},[u,_,A]),r}var _a,el;function Ln(){if(el)return _a;el=1;var s;return typeof window<"u"?s=window:typeof dn<"u"?s=dn:typeof self<"u"?s=self:s={},_a=s,_a}var Zm=Ln();const D=yr(Zm),eg={},tg=Object.freeze(Object.defineProperty({__proto__:null,default:eg},Symbol.toStringTag,{value:"Module"})),ig=dm(tg);var ya,tl;function Mc(){if(tl)return ya;tl=1;var s=typeof dn<"u"?dn:typeof window<"u"?window:{},e=ig,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),ya=t,ya}var sg=Mc();const re=yr(sg);var en={exports:{}},Ta={exports:{}},il;function rg(){return il||(il=1,(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s.exports.__esModule=!0,s.exports.default=s.exports,e.apply(null,arguments)}s.exports=e,s.exports.__esModule=!0,s.exports.default=s.exports})(Ta)),Ta.exports}var va,sl;function ng(){if(sl)return va;sl=1,va=e;var s=Object.prototype.toString;function e(t){if(!t)return!1;var i=s.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return va}var ba,rl;function ag(){if(rl)return ba;rl=1;function s(r,n){var a=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(a)return(a=a.call(r)).next.bind(a);if(Array.isArray(r)||(a=e(r))||n){a&&(r=a);var u=0;return function(){return u>=r.length?{done:!0}:{done:!1,value:r[u++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(r,n){if(r){if(typeof r=="string")return t(r,n);var a=Object.prototype.toString.call(r).slice(8,-1);if(a==="Object"&&r.constructor&&(a=r.constructor.name),a==="Map"||a==="Set")return Array.from(r);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(r,n)}}function t(r,n){(n==null||n>r.length)&&(n=r.length);for(var a=0,u=new Array(n);a<n;a++)u[a]=r[a];return u}var i=(function(){function r(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var n=r.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},n.addInterceptor=function(u,
|
|
3
|
-
`).forEach(function(I){var F=I.indexOf(":"),N=I.slice(0,F).trim().toLowerCase(),R=I.slice(F+1).trim();typeof T[N]>"u"?T[N]=R:Array.isArray(T[N])?T[N].push(R):T[N]=[T[N],R]}),T};en.exports=f,en.exports.default=f,f.XMLHttpRequest=s.XMLHttpRequest||A,f.XDomainRequest="withCredentials"in new f.XMLHttpRequest?f.XMLHttpRequest:s.XDomainRequest,a(["get","put","post","patch","head","delete"],function(S){f[S==="delete"?"del":S]=function(O,T,I){return T=c(O,T,I),T.method=S.toUpperCase(),g(T)}});function a(S,O){for(var T=0;T<S.length;T++)O(S[T])}function u(S){for(var O in S)if(S.hasOwnProperty(O))return!1;return!0}function c(S,O,T){var I=S;return t(O)?(T=O,typeof S=="string"&&(I={uri:S})):I=e({},O,{uri:S}),I.callback=T,I}function f(S,O,T){return O=c(S,O,T),g(O)}function g(S){if(typeof S.callback>"u")throw new Error("callback argument missing");if(S.requestType&&f.requestInterceptorsStorage.getIsEnabled()){var O={uri:S.uri||S.url,headers:S.headers||{},body:S.body,metadata:S.metadata||{},retry:S.retry,timeout:S.timeout},T=f.requestInterceptorsStorage.execute(S.requestType,O);S.uri=T.uri,S.headers=T.headers,S.body=T.body,S.metadata=T.metadata,S.retry=T.retry,S.timeout=T.timeout}var I=!1,F=function(Z,J,ee){I||(I=!0,S.callback(Z,J,ee))};function N(){M.readyState===4&&!f.responseInterceptorsStorage.getIsEnabled()&&setTimeout(j,0)}function R(){var X=void 0;if(M.response?X=M.response:X=M.responseText||_(M),Q)try{X=JSON.parse(X)}catch{}return X}function U(X){if(clearTimeout(se),clearTimeout(S.retryTimeout),X instanceof Error||(X=new Error(""+(X||"Unknown XMLHttpRequest Error"))),X.statusCode=0,!$&&f.retryManager.getIsEnabled()&&S.retry&&S.retry.shouldRetry()){S.retryTimeout=setTimeout(function(){S.retry.moveToNextAttempt(),S.xhr=M,g(S)},S.retry.getCurrentFuzzedDelay());return}if(S.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var Z={headers:te.headers||{},body:te.body,responseUrl:M.responseURL,responseType:M.responseType},J=f.responseInterceptorsStorage.execute(S.requestType,Z);te.body=J.body,te.headers=J.headers}return F(X,te)}function j(){if(!$){var X;clearTimeout(se),clearTimeout(S.retryTimeout),S.useXDR&&M.status===void 0?X=200:X=M.status===1223?204:M.status;var Z=te,J=null;if(X!==0?(Z={body:R(),statusCode:X,method:E,headers:{},url:v,rawRequest:M},M.getAllResponseHeaders&&(Z.headers=n(M.getAllResponseHeaders()))):J=new Error("Internal XMLHttpRequest Error"),S.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var ee={headers:Z.headers||{},body:Z.body,responseUrl:M.responseURL,responseType:M.responseType},ie=f.responseInterceptorsStorage.execute(S.requestType,ee);Z.body=ie.body,Z.headers=ie.headers}return F(J,Z,Z.body)}}var M=S.xhr||null;M||(S.cors||S.useXDR?M=new f.XDomainRequest:M=new f.XMLHttpRequest);var L,$,v=M.url=S.uri||S.url,E=M.method=S.method||"GET",V=S.body||S.data,G=M.headers=S.headers||{},z=!!S.sync,Q=!1,se,te={body:void 0,headers:{},statusCode:0,method:E,url:v,rawRequest:M};if("json"in S&&S.json!==!1&&(Q=!0,G.accept||G.Accept||(G.Accept="application/json"),E!=="GET"&&E!=="HEAD"&&(G["content-type"]||G["Content-Type"]||(G["Content-Type"]="application/json"),V=JSON.stringify(S.json===!0?V:S.json))),M.onreadystatechange=N,M.onload=j,M.onerror=U,M.onprogress=function(){},M.onabort=function(){$=!0,clearTimeout(S.retryTimeout)},M.ontimeout=U,M.open(E,v,!z,S.username,S.password),z||(M.withCredentials=!!S.withCredentials),!z&&S.timeout>0&&(se=setTimeout(function(){if(!$){$=!0,M.abort("timeout");var X=new Error("XMLHttpRequest timeout");X.code="ETIMEDOUT",U(X)}},S.timeout)),M.setRequestHeader)for(L in G)G.hasOwnProperty(L)&&M.setRequestHeader(L,G[L]);else if(S.headers&&!u(S.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in S&&(M.responseType=S.responseType),"beforeSend"in S&&typeof S.beforeSend=="function"&&S.beforeSend(M),M.send(V||null),M}function _(S){try{if(S.responseType==="document")return S.responseXML;var O=S.responseXML&&S.responseXML.documentElement.nodeName==="parsererror";if(S.responseType===""&&!O)return S.responseXML}catch{}return null}function A(){}return en.exports}var cg=lg();const Bc=yr(cg);var Ea={exports:{}},Ca,ul;function dg(){if(ul)return Ca;ul=1;var s=Mc(),e=Object.create||(function(){function v(){}return function(E){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return v.prototype=E,new v}})();function t(v,E){this.name="ParsingError",this.code=v.code,this.message=E||v.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(v){function E(G,z,Q,se){return(G|0)*3600+(z|0)*60+(Q|0)+(se|0)/1e3}var V=v.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return V?V[3]?E(V[1],V[2],V[3].replace(":",""),V[4]):V[1]>59?E(V[1],V[2],0,V[4]):E(0,V[1],V[2],V[4]):null}function r(){this.values=e(null)}r.prototype={set:function(v,E){!this.get(v)&&E!==""&&(this.values[v]=E)},get:function(v,E,V){return V?this.has(v)?this.values[v]:E[V]:this.has(v)?this.values[v]:E},has:function(v){return v in this.values},alt:function(v,E,V){for(var G=0;G<V.length;++G)if(E===V[G]){this.set(v,E);break}},integer:function(v,E){/^-?\d+$/.test(E)&&this.set(v,parseInt(E,10))},percent:function(v,E){return E.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(E=parseFloat(E),E>=0&&E<=100)?(this.set(v,E),!0):!1}};function n(v,E,V,G){var z=G?v.split(G):[v];for(var Q in z)if(typeof z[Q]=="string"){var se=z[Q].split(V);if(se.length===2){var te=se[0].trim(),X=se[1].trim();E(te,X)}}}function a(v,E,V){var G=v;function z(){var te=i(v);if(te===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+G);return v=v.replace(/^[^\sa-zA-Z-]+/,""),te}function Q(te,X){var Z=new r;n(te,function(J,ee){switch(J){case"region":for(var ie=V.length-1;ie>=0;ie--)if(V[ie].id===ee){Z.set(J,V[ie].region);break}break;case"vertical":Z.alt(J,ee,["rl","lr"]);break;case"line":var pe=ee.split(","),ge=pe[0];Z.integer(J,ge),Z.percent(J,ge)&&Z.set("snapToLines",!1),Z.alt(J,ge,["auto"]),pe.length===2&&Z.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=ee.split(","),Z.percent(J,pe[0]),pe.length===2&&Z.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":Z.percent(J,ee);break;case"align":Z.alt(J,ee,["start","center","end","left","right"]);break}},/:/,/\s/),X.region=Z.get("region",null),X.vertical=Z.get("vertical","");try{X.line=Z.get("line","auto")}catch{}X.lineAlign=Z.get("lineAlign","start"),X.snapToLines=Z.get("snapToLines",!0),X.size=Z.get("size",100);try{X.align=Z.get("align","center")}catch{X.align=Z.get("align","middle")}try{X.position=Z.get("position","auto")}catch{X.position=Z.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},X.align)}X.positionAlign=Z.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},X.align)}function se(){v=v.replace(/^\s+/,"")}if(se(),E.startTime=z(),se(),v.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+G);v=v.substr(3),se(),E.endTime=z(),se(),Q(v,E)}var u=s.createElement&&s.createElement("textarea"),c={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},f={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)"},g={v:"title",lang:"lang"},_={rt:"ruby"};function A(v,E){function V(){if(!E)return null;function ge(fe){return E=E.substr(fe.length),fe}var ye=E.match(/^([^<]*)(<[^>]*>?)?/);return ge(ye[1]?ye[1]:ye[2])}function G(ge){return u.innerHTML=ge,ge=u.textContent,u.textContent="",ge}function z(ge,ye){return!_[ye.localName]||_[ye.localName]===ge.localName}function Q(ge,ye){var fe=c[ge];if(!fe)return null;var Qe=v.document.createElement(fe),et=g[ge];return et&&ye&&(Qe[et]=ye.trim()),Qe}for(var se=v.document.createElement("div"),te=se,X,Z=[];(X=V())!==null;){if(X[0]==="<"){if(X[1]==="/"){Z.length&&Z[Z.length-1]===X.substr(2).replace(">","")&&(Z.pop(),te=te.parentNode);continue}var J=i(X.substr(1,X.length-2)),ee;if(J){ee=v.document.createProcessingInstruction("timestamp",J),te.appendChild(ee);continue}var ie=X.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!ie||(ee=Q(ie[1],ie[3]),!ee)||!z(te,ee))continue;if(ie[2]){var pe=ie[2].split(".");pe.forEach(function(ge){var ye=/^bg_/.test(ge),fe=ye?ge.slice(3):ge;if(f.hasOwnProperty(fe)){var Qe=ye?"background-color":"color",et=f[fe];ee.style[Qe]=et}}),ee.className=pe.join(" ")}Z.push(ie[1]),te.appendChild(ee),te=ee;continue}te.appendChild(v.document.createTextNode(G(X)))}return se}var S=[[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 O(v){for(var E=0;E<S.length;E++){var V=S[E];if(v>=V[0]&&v<=V[1])return!0}return!1}function T(v){var E=[],V="",G;if(!v||!v.childNodes)return"ltr";function z(te,X){for(var Z=X.childNodes.length-1;Z>=0;Z--)te.push(X.childNodes[Z])}function Q(te){if(!te||!te.length)return null;var X=te.pop(),Z=X.textContent||X.innerText;if(Z){var J=Z.match(/^.*(\n|\r)/);return J?(te.length=0,J[0]):Z}if(X.tagName==="ruby")return Q(te);if(X.childNodes)return z(te,X),Q(te)}for(z(E,v);V=Q(E);)for(var se=0;se<V.length;se++)if(G=V.charCodeAt(se),O(G))return"rtl";return"ltr"}function I(v){if(typeof v.line=="number"&&(v.snapToLines||v.line>=0&&v.line<=100))return v.line;if(!v.track||!v.track.textTrackList||!v.track.textTrackList.mediaElement)return-1;for(var E=v.track,V=E.textTrackList,G=0,z=0;z<V.length&&V[z]!==E;z++)V[z].mode==="showing"&&G++;return++G*-1}function F(){}F.prototype.applyStyles=function(v,E){E=E||this.div;for(var V in v)v.hasOwnProperty(V)&&(E.style[V]=v[V])},F.prototype.formatStyle=function(v,E){return v===0?0:v+E};function N(v,E,V){F.call(this),this.cue=E,this.cueDiv=A(v,E.text);var G={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:E.vertical===""?"horizontal-tb":E.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(G,this.cueDiv),this.div=v.document.createElement("div"),G={direction:T(this.cueDiv),writingMode:E.vertical===""?"horizontal-tb":E.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:E.align==="middle"?"center":E.align,font:V.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(G),this.div.appendChild(this.cueDiv);var z=0;switch(E.positionAlign){case"start":case"line-left":z=E.position;break;case"center":z=E.position-E.size/2;break;case"end":case"line-right":z=E.position-E.size;break}E.vertical===""?this.applyStyles({left:this.formatStyle(z,"%"),width:this.formatStyle(E.size,"%")}):this.applyStyles({top:this.formatStyle(z,"%"),height:this.formatStyle(E.size,"%")}),this.move=function(Q){this.applyStyles({top:this.formatStyle(Q.top,"px"),bottom:this.formatStyle(Q.bottom,"px"),left:this.formatStyle(Q.left,"px"),right:this.formatStyle(Q.right,"px"),height:this.formatStyle(Q.height,"px"),width:this.formatStyle(Q.width,"px")})}}N.prototype=e(F.prototype),N.prototype.constructor=N;function R(v){var E,V,G,z;if(v.div){V=v.div.offsetHeight,G=v.div.offsetWidth,z=v.div.offsetTop;var Q=(Q=v.div.childNodes)&&(Q=Q[0])&&Q.getClientRects&&Q.getClientRects();v=v.div.getBoundingClientRect(),E=Q?Math.max(Q[0]&&Q[0].height||0,v.height/Q.length):0}this.left=v.left,this.right=v.right,this.top=v.top||z,this.height=v.height||V,this.bottom=v.bottom||z+(v.height||V),this.width=v.width||G,this.lineHeight=E!==void 0?E:v.lineHeight}R.prototype.move=function(v,E){switch(E=E!==void 0?E:this.lineHeight,v){case"+x":this.left+=E,this.right+=E;break;case"-x":this.left-=E,this.right-=E;break;case"+y":this.top+=E,this.bottom+=E;break;case"-y":this.top-=E,this.bottom-=E;break}},R.prototype.overlaps=function(v){return this.left<v.right&&this.right>v.left&&this.top<v.bottom&&this.bottom>v.top},R.prototype.overlapsAny=function(v){for(var E=0;E<v.length;E++)if(this.overlaps(v[E]))return!0;return!1},R.prototype.within=function(v){return this.top>=v.top&&this.bottom<=v.bottom&&this.left>=v.left&&this.right<=v.right},R.prototype.overlapsOppositeAxis=function(v,E){switch(E){case"+x":return this.left<v.left;case"-x":return this.right>v.right;case"+y":return this.top<v.top;case"-y":return this.bottom>v.bottom}},R.prototype.intersectPercentage=function(v){var E=Math.max(0,Math.min(this.right,v.right)-Math.max(this.left,v.left)),V=Math.max(0,Math.min(this.bottom,v.bottom)-Math.max(this.top,v.top)),G=E*V;return G/(this.height*this.width)},R.prototype.toCSSCompatValues=function(v){return{top:this.top-v.top,bottom:v.bottom-this.bottom,left:this.left-v.left,right:v.right-this.right,height:this.height,width:this.width}},R.getSimpleBoxPosition=function(v){var E=v.div?v.div.offsetHeight:v.tagName?v.offsetHeight:0,V=v.div?v.div.offsetWidth:v.tagName?v.offsetWidth:0,G=v.div?v.div.offsetTop:v.tagName?v.offsetTop:0;v=v.div?v.div.getBoundingClientRect():v.tagName?v.getBoundingClientRect():v;var z={left:v.left,right:v.right,top:v.top||G,height:v.height||E,bottom:v.bottom||G+(v.height||E),width:v.width||V};return z};function U(v,E,V,G){function z(fe,Qe){for(var et,Ve=new R(fe),tt=1,St=0;St<Qe.length;St++){for(;fe.overlapsOppositeAxis(V,Qe[St])||fe.within(V)&&fe.overlapsAny(G);)fe.move(Qe[St]);if(fe.within(V))return fe;var Je=fe.intersectPercentage(V);tt>Je&&(et=new R(fe),tt=Je),fe=new R(Ve)}return et||Ve}var Q=new R(E),se=E.cue,te=I(se),X=[];if(se.snapToLines){var Z;switch(se.vertical){case"":X=["+y","-y"],Z="height";break;case"rl":X=["+x","-x"],Z="width";break;case"lr":X=["-x","+x"],Z="width";break}var J=Q.lineHeight,ee=J*Math.round(te),ie=V[Z]+J,pe=X[0];Math.abs(ee)>ie&&(ee=ee<0?-1:1,ee*=Math.ceil(ie/J)*J),te<0&&(ee+=se.vertical===""?V.height:V.width,X=X.reverse()),Q.move(pe,ee)}else{var ge=Q.lineHeight/V.height*100;switch(se.lineAlign){case"center":te-=ge/2;break;case"end":te-=ge;break}switch(se.vertical){case"":E.applyStyles({top:E.formatStyle(te,"%")});break;case"rl":E.applyStyles({left:E.formatStyle(te,"%")});break;case"lr":E.applyStyles({right:E.formatStyle(te,"%")});break}X=["+y","-x","+x","-y"],Q=new R(E)}var ye=z(Q,X);E.move(ye.toCSSCompatValues(V))}function j(){}j.StringDecoder=function(){return{decode:function(v){if(!v)return"";if(typeof v!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(v))}}},j.convertCueToDOMTree=function(v,E){return!v||!E?null:A(v,E)};var M=.05,L="sans-serif",$="1.5%";return j.processCues=function(v,E,V){if(!v||!E||!V)return null;for(;V.firstChild;)V.removeChild(V.firstChild);var G=v.document.createElement("div");G.style.position="absolute",G.style.left="0",G.style.right="0",G.style.top="0",G.style.bottom="0",G.style.margin=$,V.appendChild(G);function z(J){for(var ee=0;ee<J.length;ee++)if(J[ee].hasBeenReset||!J[ee].displayState)return!0;return!1}if(!z(E)){for(var Q=0;Q<E.length;Q++)G.appendChild(E[Q].displayState);return}var se=[],te=R.getSimpleBoxPosition(G),X=Math.round(te.height*M*100)/100,Z={font:X+"px "+L};(function(){for(var J,ee,ie=0;ie<E.length;ie++)ee=E[ie],J=new N(v,ee,Z),G.appendChild(J.div),U(v,J,te,se),ee.displayState=J.div,se.push(R.getSimpleBoxPosition(J))})()},j.Parser=function(v,E,V){V||(V=E,E={}),E||(E={}),this.window=v,this.vttjs=E,this.state="INITIAL",this.buffer="",this.decoder=V||new TextDecoder("utf8"),this.regionList=[]},j.Parser.prototype={reportOrThrowError:function(v){if(v instanceof t)this.onparsingerror&&this.onparsingerror(v);else throw v},parse:function(v){var E=this;v&&(E.buffer+=E.decoder.decode(v,{stream:!0}));function V(){for(var J=E.buffer,ee=0;ee<J.length&&J[ee]!=="\r"&&J[ee]!==`
|
|
4
|
-
`;)++
|
|
5
|
-
`&&++
|
|
1
|
+
import{c as qt,r as le,j as ee,R as Em,C as Cm,a as Do,b as wm,X as Fc,T as Am,P as Dm,O as km,d as hn,g as Tr,e as Im,t as Ja,f as Pm,h as Lm,B as Za,u as ss,i as Om,k as Rm,l as Nm,L as Mm,m as sl,n as rl}from"./index-1v1BzSVv.js";const Bm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Fm=qt("arrow-left",Bm);const Um=[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]],jm=qt("cast",Um);const qm=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],$m=qt("list",qm);const Vm=[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]],Hm=qt("maximize",Vm);const zm=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],Gm=qt("pause",zm);const Wm=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],Xm=qt("rotate-ccw",Wm);const Km=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ym=qt("rotate-cw",Km);const Qm=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]],Uc=qt("volume-1",Qm);const Jm=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],jc=qt("volume-2",Jm);const Zm=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],qc=qt("volume-x",Zm);const eg=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]],$c=qt("volume",eg),Vc=["shift","alt","meta","mod","ctrl","control"],tg={esc:"escape",return:"enter",left:"arrowleft",right:"arrowright",up:"arrowup",down:"arrowdown",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function Ei(s){return(tg[s.trim()]||s.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function Hc(s){return Vc.includes(s)}function ga(s,e=","){return s.toLowerCase().split(e)}function _a(s,e="+",t=">",i=!1,r,n){let a=[],u=!1;s=s.trim(),s.includes(t)?(u=!0,a=s.toLocaleLowerCase().split(t).map(g=>Ei(g))):a=s.toLocaleLowerCase().split(e).map(g=>Ei(g));const l={alt:a.includes("alt"),ctrl:a.includes("ctrl")||a.includes("control"),shift:a.includes("shift"),meta:a.includes("meta"),mod:a.includes("mod"),useKey:i},f=a.filter(g=>!Vc.includes(g));return{...l,keys:f,description:r,isSequence:u,hotkey:s,metadata:n}}typeof document<"u"&&(document.addEventListener("keydown",s=>{s.code!==void 0&&zc([Ei(s.code)])}),document.addEventListener("keyup",s=>{s.code!==void 0&&Gc([Ei(s.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{ui.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{ui.clear()},0)}));const ui=new Set;function ko(s){return Array.isArray(s)}function ig(s,e=","){return(ko(s)?s:s.split(e)).every(t=>ui.has(t.trim().toLowerCase()))}function zc(s){const e=Array.isArray(s)?s:[s];ui.has("meta")&&ui.forEach(t=>{Hc(t)||ui.delete(t.toLowerCase())}),e.forEach(t=>{ui.add(t.toLowerCase())})}function Gc(s){const e=Array.isArray(s)?s:[s];s==="meta"?ui.clear():e.forEach(t=>{ui.delete(t.toLowerCase())})}function sg(s,e,t){(typeof t=="function"&&t(s,e)||t===!0)&&s.preventDefault()}function rg(s,e,t){return typeof t=="function"?t(s,e):t===!0||t===void 0}const ng=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function ag(s){return Wc(s,ng)}function Wc(s,e=!1){const{target:t,composed:i}=s;let r,n;return og(t)&&i?(r=s.composedPath()[0]&&s.composedPath()[0].tagName,n=s.composedPath()[0]&&s.composedPath()[0].role):(r=t&&t.tagName,n=t&&t.role),ko(e)?!!(r&&e&&e.some(a=>a.toLowerCase()===r.toLowerCase()||a===n)):!!(r&&e&&e)}function og(s){return!!s.tagName&&!s.tagName.startsWith("-")&&s.tagName.includes("-")}function ug(s,e){return s.length===0&&e?!1:e?s.some(t=>e.includes(t))||s.includes("*"):!0}const lg=(s,e,t=!1)=>{const{alt:i,meta:r,mod:n,shift:a,ctrl:u,keys:l,useKey:f}=e,{code:g,key:_,ctrlKey:A,metaKey:x,shiftKey:L,altKey:T}=s,I=Ei(g);if(f&&l?.length===1&&l.includes(_.toLowerCase()))return!0;if(!l?.includes(I)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(I))return!1;if(!t){if(i!==T&&I!=="alt"||a!==L&&I!=="shift")return!1;if(n){if(!x&&!A)return!1}else if(r!==x&&I!=="meta"&&I!=="os"||u!==A&&I!=="ctrl"&&I!=="control")return!1}return l&&l.length===1&&l.includes(I)?!0:l&&l.length>0?l.includes(I)?ig(l):!1:!l||l.length===0},cg=le.createContext(void 0),dg=()=>le.useContext(cg);function Xc(s,e){return s&&e&&typeof s=="object"&&typeof e=="object"?Object.keys(s).length===Object.keys(e).length&&Object.keys(s).reduce((t,i)=>t&&Xc(s[i],e[i]),!0):s===e}const hg=le.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),fg=()=>le.useContext(hg);function pg(s){const e=le.useRef(void 0);return Xc(e.current,s)||(e.current=s),e.current}const nl=s=>{s.stopPropagation(),s.preventDefault(),s.stopImmediatePropagation()},mg=typeof window<"u"?le.useLayoutEffect:le.useEffect;function Zi(s,e,t,i){const r=le.useRef(null),n=le.useRef(!1),a=Array.isArray(t)?Array.isArray(i)?void 0:i:t,u=ko(s)?s.join(a?.delimiter):s,l=Array.isArray(t)?t:Array.isArray(i)?i:void 0,f=le.useCallback(e,l??[]),g=le.useRef(f);l?g.current=f:g.current=e;const _=pg(a),{activeScopes:A}=fg(),x=dg();return mg(()=>{if(_?.enabled===!1||!ug(A,_?.scopes))return;let L=[],T;const I=(j,F=!1)=>{if(!(ag(j)&&!Wc(j,_?.enableOnFormTags))){if(r.current!==null){const U=r.current.getRootNode();if((U instanceof Document||U instanceof ShadowRoot)&&U.activeElement!==r.current&&!r.current.contains(U.activeElement)){nl(j);return}}j.target?.isContentEditable&&!_?.enableOnContentEditable||ga(u,_?.delimiter).forEach(U=>{if(U.includes(_?.splitKey??"+")&&U.includes(_?.sequenceSplitKey??">")){console.warn(`Hotkey ${U} contains both ${_?.splitKey??"+"} and ${_?.sequenceSplitKey??">"} which is not supported.`);return}const R=_a(U,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata);if(R.isSequence){T=setTimeout(()=>{L=[]},_?.sequenceTimeoutMs??1e3);const H=R.useKey?j.key:Ei(j.code);if(Hc(H.toLowerCase()))return;L.push(H);const v=R.keys?.[L.length-1];if(H!==v){L=[],T&&clearTimeout(T);return}L.length===R.keys?.length&&(g.current(j,R),T&&clearTimeout(T),L=[])}else if(lg(j,R,_?.ignoreModifiers)||R.keys?.includes("*")){if(_?.ignoreEventWhen?.(j)||F&&n.current)return;if(sg(j,R,_?.preventDefault),!rg(j,R,_?.enabled)){nl(j);return}g.current(j,R),F||(n.current=!0)}})}},M=j=>{j.code!==void 0&&(zc(Ei(j.code)),(_?.keydown===void 0&&_?.keyup!==!0||_?.keydown)&&I(j))},N=j=>{j.code!==void 0&&(Gc(Ei(j.code)),n.current=!1,_?.keyup&&I(j,!0))},O=r.current||a?.document||document;return O.addEventListener("keyup",N,a?.eventListenerOptions),O.addEventListener("keydown",M,a?.eventListenerOptions),x&&ga(u,_?.delimiter).forEach(j=>{x.addHotkey(_a(j,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),()=>{O.removeEventListener("keyup",N,a?.eventListenerOptions),O.removeEventListener("keydown",M,a?.eventListenerOptions),x&&ga(u,_?.delimiter).forEach(j=>{x.removeHotkey(_a(j,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),L=[],T&&clearTimeout(T)}},[u,_,A]),r}function gg({...s}){return ee.jsx(Em,{"data-slot":"sheet",...s})}function _g({...s}){return ee.jsx(Dm,{"data-slot":"sheet-portal",...s})}function yg({className:s,...e}){return ee.jsx(km,{className:Do("fixed inset-0 z-50 bg-black/60 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",s),"data-slot":"sheet-overlay",...e})}function Tg({children:s,className:e,hideCloseButton:t,side:i="right",...r}){const n={bottom:"inset-x-0 bottom-0 h-auto max-h-[90vh] border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom rounded-t-xl",left:"inset-y-0 left-0 h-full w-3/4 max-w-sm border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",right:"inset-y-0 right-0 h-full w-3/4 max-w-sm border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",top:"inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top"};return ee.jsxs(_g,{children:[ee.jsx(yg,{}),ee.jsxs(Cm,{className:Do("fixed z-50 flex flex-col bg-background shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-200 data-[state=open]:duration-300",n[i],e),"data-slot":"sheet-content",...r,children:[s,!t&&ee.jsx(wm,{"aria-label":"Close",className:"absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none min-h-11 min-w-11 flex items-center justify-center",children:ee.jsx(Fc,{className:"size-5"})})]})]})}function vg({className:s,...e}){return ee.jsx(Am,{className:Do("text-base font-semibold",s),"data-slot":"sheet-title",...e})}var ya,al;function On(){if(al)return ya;al=1;var s;return typeof window<"u"?s=window:typeof hn<"u"?s=hn:typeof self<"u"?s=self:s={},ya=s,ya}var bg=On();const D=Tr(bg),xg={},Sg=Object.freeze(Object.defineProperty({__proto__:null,default:xg},Symbol.toStringTag,{value:"Module"})),Eg=Im(Sg);var Ta,ol;function Kc(){if(ol)return Ta;ol=1;var s=typeof hn<"u"?hn:typeof window<"u"?window:{},e=Eg,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Ta=t,Ta}var Cg=Kc();const re=Tr(Cg);var en={exports:{}},va={exports:{}},ul;function wg(){return ul||(ul=1,(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s.exports.__esModule=!0,s.exports.default=s.exports,e.apply(null,arguments)}s.exports=e,s.exports.__esModule=!0,s.exports.default=s.exports})(va)),va.exports}var ba,ll;function Ag(){if(ll)return ba;ll=1,ba=e;var s=Object.prototype.toString;function e(t){if(!t)return!1;var i=s.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return ba}var xa,cl;function Dg(){if(cl)return xa;cl=1;function s(r,n){var a=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(a)return(a=a.call(r)).next.bind(a);if(Array.isArray(r)||(a=e(r))||n){a&&(r=a);var u=0;return function(){return u>=r.length?{done:!0}:{done:!1,value:r[u++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(r,n){if(r){if(typeof r=="string")return t(r,n);var a=Object.prototype.toString.call(r).slice(8,-1);if(a==="Object"&&r.constructor&&(a=r.constructor.name),a==="Map"||a==="Set")return Array.from(r);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(r,n)}}function t(r,n){(n==null||n>r.length)&&(n=r.length);for(var a=0,u=new Array(n);a<n;a++)u[a]=r[a];return u}var i=(function(){function r(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var n=r.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},n.addInterceptor=function(u,l){this.typeToInterceptorsMap_.has(u)||this.typeToInterceptorsMap_.set(u,new Set);var f=this.typeToInterceptorsMap_.get(u);return f.has(l)?!1:(f.add(l),!0)},n.removeInterceptor=function(u,l){var f=this.typeToInterceptorsMap_.get(u);return f&&f.has(l)?(f.delete(l),!0):!1},n.clearInterceptorsByType=function(u){var l=this.typeToInterceptorsMap_.get(u);return l?(this.typeToInterceptorsMap_.delete(u),this.typeToInterceptorsMap_.set(u,new Set),!0):!1},n.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},n.getForType=function(u){return this.typeToInterceptorsMap_.get(u)||new Set},n.execute=function(u,l){for(var f=this.getForType(u),g=s(f),_;!(_=g()).done;){var A=_.value;try{l=A(l)}catch{}}return l},r})();return xa=i,xa}var Sa,dl;function kg(){if(dl)return Sa;dl=1;var s=(function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var i=t.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},i.getMaxAttempts=function(){return this.maxAttempts_},i.setMaxAttempts=function(n){this.maxAttempts_=n},i.getDelayFactor=function(){return this.delayFactor_},i.setDelayFactor=function(n){this.delayFactor_=n},i.getFuzzFactor=function(){return this.fuzzFactor_},i.setFuzzFactor=function(n){this.fuzzFactor_=n},i.getInitialDelay=function(){return this.initialDelay_},i.setInitialDelay=function(n){this.initialDelay_=n},i.createRetry=function(n){var a=n===void 0?{}:n,u=a.maxAttempts,l=a.delayFactor,f=a.fuzzFactor,g=a.initialDelay;return new e({maxAttempts:u||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:f||this.fuzzFactor_,initialDelay:g||this.initialDelay_})},t})(),e=(function(){function t(r){this.maxAttempts_=r.maxAttempts,this.delayFactor_=r.delayFactor,this.fuzzFactor_=r.fuzzFactor,this.currentDelay_=r.initialDelay,this.currentAttempt_=1}var i=t.prototype;return i.moveToNextAttempt=function(){this.currentAttempt_++;var n=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+n},i.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},i.getCurrentDelay=function(){return this.currentDelay_},i.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},i.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},i.getCurrentFuzzedDelay=function(){var n=this.getCurrentMinPossibleDelay(),a=this.getCurrentMaxPossibleDelay();return n+Math.random()*(a-n)},t})();return Sa=s,Sa}var Ea,hl;function Ig(){if(hl)return Ea;hl=1;var s=On(),e=function(r,n){return n===void 0&&(n=!1),function(a,u,l){if(a){r(a);return}if(u.statusCode>=400&&u.statusCode<=599){var f=l;if(n)if(s.TextDecoder){var g=t(u.headers&&u.headers["content-type"]);try{f=new TextDecoder(g).decode(l)}catch{}}else f=String.fromCharCode.apply(null,new Uint8Array(l));r({cause:f});return}r(null,l)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(r,n){var a=n.split("="),u=a[0],l=a[1];return u.trim()==="charset"?l.trim():r},"utf-8")}return Ea=e,Ea}var fl;function Pg(){if(fl)return en.exports;fl=1;var s=On(),e=wg(),t=Ag(),i=Dg(),r=kg();f.httpHandler=Ig(),f.requestInterceptorsStorage=new i,f.responseInterceptorsStorage=new i,f.retryManager=new r;var n=function(L){var T={};return L&&L.trim().split(`
|
|
3
|
+
`).forEach(function(I){var M=I.indexOf(":"),N=I.slice(0,M).trim().toLowerCase(),O=I.slice(M+1).trim();typeof T[N]>"u"?T[N]=O:Array.isArray(T[N])?T[N].push(O):T[N]=[T[N],O]}),T};en.exports=f,en.exports.default=f,f.XMLHttpRequest=s.XMLHttpRequest||A,f.XDomainRequest="withCredentials"in new f.XMLHttpRequest?f.XMLHttpRequest:s.XDomainRequest,a(["get","put","post","patch","head","delete"],function(x){f[x==="delete"?"del":x]=function(L,T,I){return T=l(L,T,I),T.method=x.toUpperCase(),g(T)}});function a(x,L){for(var T=0;T<x.length;T++)L(x[T])}function u(x){for(var L in x)if(x.hasOwnProperty(L))return!1;return!0}function l(x,L,T){var I=x;return t(L)?(T=L,typeof x=="string"&&(I={uri:x})):I=e({},L,{uri:x}),I.callback=T,I}function f(x,L,T){return L=l(x,L,T),g(L)}function g(x){if(typeof x.callback>"u")throw new Error("callback argument missing");if(x.requestType&&f.requestInterceptorsStorage.getIsEnabled()){var L={uri:x.uri||x.url,headers:x.headers||{},body:x.body,metadata:x.metadata||{},retry:x.retry,timeout:x.timeout},T=f.requestInterceptorsStorage.execute(x.requestType,L);x.uri=T.uri,x.headers=T.headers,x.body=T.body,x.metadata=T.metadata,x.retry=T.retry,x.timeout=T.timeout}var I=!1,M=function(te,X,Z){I||(I=!0,x.callback(te,X,Z))};function N(){U.readyState===4&&!f.responseInterceptorsStorage.getIsEnabled()&&setTimeout(F,0)}function O(){var Y=void 0;if(U.response?Y=U.response:Y=U.responseText||_(U),J)try{Y=JSON.parse(Y)}catch{}return Y}function j(Y){if(clearTimeout(se),clearTimeout(x.retryTimeout),Y instanceof Error||(Y=new Error(""+(Y||"Unknown XMLHttpRequest Error"))),Y.statusCode=0,!H&&f.retryManager.getIsEnabled()&&x.retry&&x.retry.shouldRetry()){x.retryTimeout=setTimeout(function(){x.retry.moveToNextAttempt(),x.xhr=U,g(x)},x.retry.getCurrentFuzzedDelay());return}if(x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var te={headers:ne.headers||{},body:ne.body,responseUrl:U.responseURL,responseType:U.responseType},X=f.responseInterceptorsStorage.execute(x.requestType,te);ne.body=X.body,ne.headers=X.headers}return M(Y,ne)}function F(){if(!H){var Y;clearTimeout(se),clearTimeout(x.retryTimeout),x.useXDR&&U.status===void 0?Y=200:Y=U.status===1223?204:U.status;var te=ne,X=null;if(Y!==0?(te={body:O(),statusCode:Y,method:E,headers:{},url:v,rawRequest:U},U.getAllResponseHeaders&&(te.headers=n(U.getAllResponseHeaders()))):X=new Error("Internal XMLHttpRequest Error"),x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var Z={headers:te.headers||{},body:te.body,responseUrl:U.responseURL,responseType:U.responseType},ie=f.responseInterceptorsStorage.execute(x.requestType,Z);te.body=ie.body,te.headers=ie.headers}return M(X,te,te.body)}}var U=x.xhr||null;U||(x.cors||x.useXDR?U=new f.XDomainRequest:U=new f.XMLHttpRequest);var R,H,v=U.url=x.uri||x.url,E=U.method=x.method||"GET",$=x.body||x.data,G=U.headers=x.headers||{},V=!!x.sync,J=!1,se,ne={body:void 0,headers:{},statusCode:0,method:E,url:v,rawRequest:U};if("json"in x&&x.json!==!1&&(J=!0,G.accept||G.Accept||(G.Accept="application/json"),E!=="GET"&&E!=="HEAD"&&(G["content-type"]||G["Content-Type"]||(G["Content-Type"]="application/json"),$=JSON.stringify(x.json===!0?$:x.json))),U.onreadystatechange=N,U.onload=F,U.onerror=j,U.onprogress=function(){},U.onabort=function(){H=!0,clearTimeout(x.retryTimeout)},U.ontimeout=j,U.open(E,v,!V,x.username,x.password),V||(U.withCredentials=!!x.withCredentials),!V&&x.timeout>0&&(se=setTimeout(function(){if(!H){H=!0,U.abort("timeout");var Y=new Error("XMLHttpRequest timeout");Y.code="ETIMEDOUT",j(Y)}},x.timeout)),U.setRequestHeader)for(R in G)G.hasOwnProperty(R)&&U.setRequestHeader(R,G[R]);else if(x.headers&&!u(x.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in x&&(U.responseType=x.responseType),"beforeSend"in x&&typeof x.beforeSend=="function"&&x.beforeSend(U),U.send($||null),U}function _(x){try{if(x.responseType==="document")return x.responseXML;var L=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!L)return x.responseXML}catch{}return null}function A(){}return en.exports}var Lg=Pg();const Yc=Tr(Lg);var Ca={exports:{}},wa,pl;function Og(){if(pl)return wa;pl=1;var s=Kc(),e=Object.create||(function(){function v(){}return function(E){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return v.prototype=E,new v}})();function t(v,E){this.name="ParsingError",this.code=v.code,this.message=E||v.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(v){function E(G,V,J,se){return(G|0)*3600+(V|0)*60+(J|0)+(se|0)/1e3}var $=v.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return $?$[3]?E($[1],$[2],$[3].replace(":",""),$[4]):$[1]>59?E($[1],$[2],0,$[4]):E(0,$[1],$[2],$[4]):null}function r(){this.values=e(null)}r.prototype={set:function(v,E){!this.get(v)&&E!==""&&(this.values[v]=E)},get:function(v,E,$){return $?this.has(v)?this.values[v]:E[$]:this.has(v)?this.values[v]:E},has:function(v){return v in this.values},alt:function(v,E,$){for(var G=0;G<$.length;++G)if(E===$[G]){this.set(v,E);break}},integer:function(v,E){/^-?\d+$/.test(E)&&this.set(v,parseInt(E,10))},percent:function(v,E){return E.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(E=parseFloat(E),E>=0&&E<=100)?(this.set(v,E),!0):!1}};function n(v,E,$,G){var V=G?v.split(G):[v];for(var J in V)if(typeof V[J]=="string"){var se=V[J].split($);if(se.length===2){var ne=se[0].trim(),Y=se[1].trim();E(ne,Y)}}}function a(v,E,$){var G=v;function V(){var ne=i(v);if(ne===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+G);return v=v.replace(/^[^\sa-zA-Z-]+/,""),ne}function J(ne,Y){var te=new r;n(ne,function(X,Z){switch(X){case"region":for(var ie=$.length-1;ie>=0;ie--)if($[ie].id===Z){te.set(X,$[ie].region);break}break;case"vertical":te.alt(X,Z,["rl","lr"]);break;case"line":var pe=Z.split(","),ge=pe[0];te.integer(X,ge),te.percent(X,ge)&&te.set("snapToLines",!1),te.alt(X,ge,["auto"]),pe.length===2&&te.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=Z.split(","),te.percent(X,pe[0]),pe.length===2&&te.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":te.percent(X,Z);break;case"align":te.alt(X,Z,["start","center","end","left","right"]);break}},/:/,/\s/),Y.region=te.get("region",null),Y.vertical=te.get("vertical","");try{Y.line=te.get("line","auto")}catch{}Y.lineAlign=te.get("lineAlign","start"),Y.snapToLines=te.get("snapToLines",!0),Y.size=te.get("size",100);try{Y.align=te.get("align","center")}catch{Y.align=te.get("align","middle")}try{Y.position=te.get("position","auto")}catch{Y.position=te.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},Y.align)}Y.positionAlign=te.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},Y.align)}function se(){v=v.replace(/^\s+/,"")}if(se(),E.startTime=V(),se(),v.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+G);v=v.substr(3),se(),E.endTime=V(),se(),J(v,E)}var u=s.createElement&&s.createElement("textarea"),l={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},f={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)"},g={v:"title",lang:"lang"},_={rt:"ruby"};function A(v,E){function $(){if(!E)return null;function ge(ce){return E=E.substr(ce.length),ce}var _e=E.match(/^([^<]*)(<[^>]*>?)?/);return ge(_e[1]?_e[1]:_e[2])}function G(ge){return u.innerHTML=ge,ge=u.textContent,u.textContent="",ge}function V(ge,_e){return!_[_e.localName]||_[_e.localName]===ge.localName}function J(ge,_e){var ce=l[ge];if(!ce)return null;var We=v.document.createElement(ce),Ye=g[ge];return Ye&&_e&&(We[Ye]=_e.trim()),We}for(var se=v.document.createElement("div"),ne=se,Y,te=[];(Y=$())!==null;){if(Y[0]==="<"){if(Y[1]==="/"){te.length&&te[te.length-1]===Y.substr(2).replace(">","")&&(te.pop(),ne=ne.parentNode);continue}var X=i(Y.substr(1,Y.length-2)),Z;if(X){Z=v.document.createProcessingInstruction("timestamp",X),ne.appendChild(Z);continue}var ie=Y.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!ie||(Z=J(ie[1],ie[3]),!Z)||!V(ne,Z))continue;if(ie[2]){var pe=ie[2].split(".");pe.forEach(function(ge){var _e=/^bg_/.test(ge),ce=_e?ge.slice(3):ge;if(f.hasOwnProperty(ce)){var We=_e?"background-color":"color",Ye=f[ce];Z.style[We]=Ye}}),Z.className=pe.join(" ")}te.push(ie[1]),ne.appendChild(Z),ne=Z;continue}ne.appendChild(v.document.createTextNode(G(Y)))}return se}var x=[[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 L(v){for(var E=0;E<x.length;E++){var $=x[E];if(v>=$[0]&&v<=$[1])return!0}return!1}function T(v){var E=[],$="",G;if(!v||!v.childNodes)return"ltr";function V(ne,Y){for(var te=Y.childNodes.length-1;te>=0;te--)ne.push(Y.childNodes[te])}function J(ne){if(!ne||!ne.length)return null;var Y=ne.pop(),te=Y.textContent||Y.innerText;if(te){var X=te.match(/^.*(\n|\r)/);return X?(ne.length=0,X[0]):te}if(Y.tagName==="ruby")return J(ne);if(Y.childNodes)return V(ne,Y),J(ne)}for(V(E,v);$=J(E);)for(var se=0;se<$.length;se++)if(G=$.charCodeAt(se),L(G))return"rtl";return"ltr"}function I(v){if(typeof v.line=="number"&&(v.snapToLines||v.line>=0&&v.line<=100))return v.line;if(!v.track||!v.track.textTrackList||!v.track.textTrackList.mediaElement)return-1;for(var E=v.track,$=E.textTrackList,G=0,V=0;V<$.length&&$[V]!==E;V++)$[V].mode==="showing"&&G++;return++G*-1}function M(){}M.prototype.applyStyles=function(v,E){E=E||this.div;for(var $ in v)v.hasOwnProperty($)&&(E.style[$]=v[$])},M.prototype.formatStyle=function(v,E){return v===0?0:v+E};function N(v,E,$){M.call(this),this.cue=E,this.cueDiv=A(v,E.text);var G={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:E.vertical===""?"horizontal-tb":E.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(G,this.cueDiv),this.div=v.document.createElement("div"),G={direction:T(this.cueDiv),writingMode:E.vertical===""?"horizontal-tb":E.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:E.align==="middle"?"center":E.align,font:$.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(G),this.div.appendChild(this.cueDiv);var V=0;switch(E.positionAlign){case"start":case"line-left":V=E.position;break;case"center":V=E.position-E.size/2;break;case"end":case"line-right":V=E.position-E.size;break}E.vertical===""?this.applyStyles({left:this.formatStyle(V,"%"),width:this.formatStyle(E.size,"%")}):this.applyStyles({top:this.formatStyle(V,"%"),height:this.formatStyle(E.size,"%")}),this.move=function(J){this.applyStyles({top:this.formatStyle(J.top,"px"),bottom:this.formatStyle(J.bottom,"px"),left:this.formatStyle(J.left,"px"),right:this.formatStyle(J.right,"px"),height:this.formatStyle(J.height,"px"),width:this.formatStyle(J.width,"px")})}}N.prototype=e(M.prototype),N.prototype.constructor=N;function O(v){var E,$,G,V;if(v.div){$=v.div.offsetHeight,G=v.div.offsetWidth,V=v.div.offsetTop;var J=(J=v.div.childNodes)&&(J=J[0])&&J.getClientRects&&J.getClientRects();v=v.div.getBoundingClientRect(),E=J?Math.max(J[0]&&J[0].height||0,v.height/J.length):0}this.left=v.left,this.right=v.right,this.top=v.top||V,this.height=v.height||$,this.bottom=v.bottom||V+(v.height||$),this.width=v.width||G,this.lineHeight=E!==void 0?E:v.lineHeight}O.prototype.move=function(v,E){switch(E=E!==void 0?E:this.lineHeight,v){case"+x":this.left+=E,this.right+=E;break;case"-x":this.left-=E,this.right-=E;break;case"+y":this.top+=E,this.bottom+=E;break;case"-y":this.top-=E,this.bottom-=E;break}},O.prototype.overlaps=function(v){return this.left<v.right&&this.right>v.left&&this.top<v.bottom&&this.bottom>v.top},O.prototype.overlapsAny=function(v){for(var E=0;E<v.length;E++)if(this.overlaps(v[E]))return!0;return!1},O.prototype.within=function(v){return this.top>=v.top&&this.bottom<=v.bottom&&this.left>=v.left&&this.right<=v.right},O.prototype.overlapsOppositeAxis=function(v,E){switch(E){case"+x":return this.left<v.left;case"-x":return this.right>v.right;case"+y":return this.top<v.top;case"-y":return this.bottom>v.bottom}},O.prototype.intersectPercentage=function(v){var E=Math.max(0,Math.min(this.right,v.right)-Math.max(this.left,v.left)),$=Math.max(0,Math.min(this.bottom,v.bottom)-Math.max(this.top,v.top)),G=E*$;return G/(this.height*this.width)},O.prototype.toCSSCompatValues=function(v){return{top:this.top-v.top,bottom:v.bottom-this.bottom,left:this.left-v.left,right:v.right-this.right,height:this.height,width:this.width}},O.getSimpleBoxPosition=function(v){var E=v.div?v.div.offsetHeight:v.tagName?v.offsetHeight:0,$=v.div?v.div.offsetWidth:v.tagName?v.offsetWidth:0,G=v.div?v.div.offsetTop:v.tagName?v.offsetTop:0;v=v.div?v.div.getBoundingClientRect():v.tagName?v.getBoundingClientRect():v;var V={left:v.left,right:v.right,top:v.top||G,height:v.height||E,bottom:v.bottom||G+(v.height||E),width:v.width||$};return V};function j(v,E,$,G){function V(ce,We){for(var Ye,Ue=new O(ce),Qe=1,pt=0;pt<We.length;pt++){for(;ce.overlapsOppositeAxis($,We[pt])||ce.within($)&&ce.overlapsAny(G);)ce.move(We[pt]);if(ce.within($))return ce;var Xe=ce.intersectPercentage($);Qe>Xe&&(Ye=new O(ce),Qe=Xe),ce=new O(Ue)}return Ye||Ue}var J=new O(E),se=E.cue,ne=I(se),Y=[];if(se.snapToLines){var te;switch(se.vertical){case"":Y=["+y","-y"],te="height";break;case"rl":Y=["+x","-x"],te="width";break;case"lr":Y=["-x","+x"],te="width";break}var X=J.lineHeight,Z=X*Math.round(ne),ie=$[te]+X,pe=Y[0];Math.abs(Z)>ie&&(Z=Z<0?-1:1,Z*=Math.ceil(ie/X)*X),ne<0&&(Z+=se.vertical===""?$.height:$.width,Y=Y.reverse()),J.move(pe,Z)}else{var ge=J.lineHeight/$.height*100;switch(se.lineAlign){case"center":ne-=ge/2;break;case"end":ne-=ge;break}switch(se.vertical){case"":E.applyStyles({top:E.formatStyle(ne,"%")});break;case"rl":E.applyStyles({left:E.formatStyle(ne,"%")});break;case"lr":E.applyStyles({right:E.formatStyle(ne,"%")});break}Y=["+y","-x","+x","-y"],J=new O(E)}var _e=V(J,Y);E.move(_e.toCSSCompatValues($))}function F(){}F.StringDecoder=function(){return{decode:function(v){if(!v)return"";if(typeof v!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(v))}}},F.convertCueToDOMTree=function(v,E){return!v||!E?null:A(v,E)};var U=.05,R="sans-serif",H="1.5%";return F.processCues=function(v,E,$){if(!v||!E||!$)return null;for(;$.firstChild;)$.removeChild($.firstChild);var G=v.document.createElement("div");G.style.position="absolute",G.style.left="0",G.style.right="0",G.style.top="0",G.style.bottom="0",G.style.margin=H,$.appendChild(G);function V(X){for(var Z=0;Z<X.length;Z++)if(X[Z].hasBeenReset||!X[Z].displayState)return!0;return!1}if(!V(E)){for(var J=0;J<E.length;J++)G.appendChild(E[J].displayState);return}var se=[],ne=O.getSimpleBoxPosition(G),Y=Math.round(ne.height*U*100)/100,te={font:Y+"px "+R};(function(){for(var X,Z,ie=0;ie<E.length;ie++)Z=E[ie],X=new N(v,Z,te),G.appendChild(X.div),j(v,X,ne,se),Z.displayState=X.div,se.push(O.getSimpleBoxPosition(X))})()},F.Parser=function(v,E,$){$||($=E,E={}),E||(E={}),this.window=v,this.vttjs=E,this.state="INITIAL",this.buffer="",this.decoder=$||new TextDecoder("utf8"),this.regionList=[]},F.Parser.prototype={reportOrThrowError:function(v){if(v instanceof t)this.onparsingerror&&this.onparsingerror(v);else throw v},parse:function(v){var E=this;v&&(E.buffer+=E.decoder.decode(v,{stream:!0}));function $(){for(var X=E.buffer,Z=0;Z<X.length&&X[Z]!=="\r"&&X[Z]!==`
|
|
4
|
+
`;)++Z;var ie=X.substr(0,Z);return X[Z]==="\r"&&++Z,X[Z]===`
|
|
5
|
+
`&&++Z,E.buffer=X.substr(Z),ie}function G(X){var Z=new r;if(n(X,function(pe,ge){switch(pe){case"id":Z.set(pe,ge);break;case"width":Z.percent(pe,ge);break;case"lines":Z.integer(pe,ge);break;case"regionanchor":case"viewportanchor":var _e=ge.split(",");if(_e.length!==2)break;var ce=new r;if(ce.percent("x",_e[0]),ce.percent("y",_e[1]),!ce.has("x")||!ce.has("y"))break;Z.set(pe+"X",ce.get("x")),Z.set(pe+"Y",ce.get("y"));break;case"scroll":Z.alt(pe,ge,["up"]);break}},/=/,/\s/),Z.has("id")){var ie=new(E.vttjs.VTTRegion||E.window.VTTRegion);ie.width=Z.get("width",100),ie.lines=Z.get("lines",3),ie.regionAnchorX=Z.get("regionanchorX",0),ie.regionAnchorY=Z.get("regionanchorY",100),ie.viewportAnchorX=Z.get("viewportanchorX",0),ie.viewportAnchorY=Z.get("viewportanchorY",100),ie.scroll=Z.get("scroll",""),E.onregion&&E.onregion(ie),E.regionList.push({id:Z.get("id"),region:ie})}}function V(X){var Z=new r;n(X,function(ie,pe){switch(ie){case"MPEGT":Z.integer(ie+"S",pe);break;case"LOCA":Z.set(ie+"L",i(pe));break}},/[^\d]:/,/,/),E.ontimestampmap&&E.ontimestampmap({MPEGTS:Z.get("MPEGTS"),LOCAL:Z.get("LOCAL")})}function J(X){X.match(/X-TIMESTAMP-MAP/)?n(X,function(Z,ie){Z==="X-TIMESTAMP-MAP"&&V(ie)},/=/):n(X,function(Z,ie){Z==="Region"&&G(ie)},/:/)}try{var se;if(E.state==="INITIAL"){if(!/\r\n|\n/.test(E.buffer))return this;se=$();var ne=se.match(/^WEBVTT([ \t].*)?$/);if(!ne||!ne[0])throw new t(t.Errors.BadSignature);E.state="HEADER"}for(var Y=!1;E.buffer;){if(!/\r\n|\n/.test(E.buffer))return this;switch(Y?Y=!1:se=$(),E.state){case"HEADER":/:/.test(se)?J(se):se||(E.state="ID");continue;case"NOTE":se||(E.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(se)){E.state="NOTE";break}if(!se)continue;E.cue=new(E.vttjs.VTTCue||E.window.VTTCue)(0,0,"");try{E.cue.align="center"}catch{E.cue.align="middle"}if(E.state="CUE",se.indexOf("-->")===-1){E.cue.id=se;continue}case"CUE":try{a(se,E.cue,E.regionList)}catch(X){E.reportOrThrowError(X),E.cue=null,E.state="BADCUE";continue}E.state="CUETEXT";continue;case"CUETEXT":var te=se.indexOf("-->")!==-1;if(!se||te&&(Y=!0)){E.oncue&&E.oncue(E.cue),E.cue=null,E.state="ID";continue}E.cue.text&&(E.cue.text+=`
|
|
6
6
|
`),E.cue.text+=se.replace(/\u2028/g,`
|
|
7
7
|
`).replace(/u2029/g,`
|
|
8
|
-
`);continue;case"BADCUE":se||(E.state="ID");continue}}}catch(
|
|
8
|
+
`);continue;case"BADCUE":se||(E.state="ID");continue}}}catch(X){E.reportOrThrowError(X),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 v=this;try{if(v.buffer+=v.decoder.decode(),(v.cue||v.state==="HEADER")&&(v.buffer+=`
|
|
9
9
|
|
|
10
|
-
`,v.parse()),v.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(E){v.reportOrThrowError(E)}return v.onflush&&v.onflush(),this}},
|
|
10
|
+
`,v.parse()),v.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(E){v.reportOrThrowError(E)}return v.onflush&&v.onflush(),this}},wa=F,wa}var Aa,ml;function Rg(){if(ml)return Aa;ml=1;var s="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(a){if(typeof a!="string")return!1;var u=e[a.toLowerCase()];return u?a.toLowerCase():!1}function r(a){if(typeof a!="string")return!1;var u=t[a.toLowerCase()];return u?a.toLowerCase():!1}function n(a,u,l){this.hasBeenReset=!1;var f="",g=!1,_=a,A=u,x=l,L=null,T="",I=!0,M="auto",N="start",O="auto",j="auto",F=100,U="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return f},set:function(R){f=""+R}},pauseOnExit:{enumerable:!0,get:function(){return g},set:function(R){g=!!R}},startTime:{enumerable:!0,get:function(){return _},set:function(R){if(typeof R!="number")throw new TypeError("Start time must be set to a number.");_=R,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return A},set:function(R){if(typeof R!="number")throw new TypeError("End time must be set to a number.");A=R,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return x},set:function(R){x=""+R,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return L},set:function(R){L=R,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return T},set:function(R){var H=i(R);if(H===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");T=H,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return I},set:function(R){I=!!R,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return M},set:function(R){if(typeof R!="number"&&R!==s)throw new SyntaxError("Line: an invalid number or illegal string was specified.");M=R,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return N},set:function(R){var H=r(R);H?(N=H,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return O},set:function(R){if(R<0||R>100)throw new Error("Position must be between 0 and 100.");O=R,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return j},set:function(R){var H=r(R);H?(j=H,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return F},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");F=R,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return U},set:function(R){var H=r(R);if(!H)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");U=H,this.hasBeenReset=!0}}}),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Aa=n,Aa}var Da,gl;function Ng(){if(gl)return Da;gl=1;var s={"":!0,up:!0};function e(r){if(typeof r!="string")return!1;var n=s[r.toLowerCase()];return n?r.toLowerCase():!1}function t(r){return typeof r=="number"&&r>=0&&r<=100}function i(){var r=100,n=3,a=0,u=100,l=0,f=100,g="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return r},set:function(_){if(!t(_))throw new Error("Width must be between 0 and 100.");r=_}},lines:{enumerable:!0,get:function(){return n},set:function(_){if(typeof _!="number")throw new TypeError("Lines must be set to a number.");n=_}},regionAnchorY:{enumerable:!0,get:function(){return u},set:function(_){if(!t(_))throw new Error("RegionAnchorX must be between 0 and 100.");u=_}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(_){if(!t(_))throw new Error("RegionAnchorY must be between 0 and 100.");a=_}},viewportAnchorY:{enumerable:!0,get:function(){return f},set:function(_){if(!t(_))throw new Error("ViewportAnchorY must be between 0 and 100.");f=_}},viewportAnchorX:{enumerable:!0,get:function(){return l},set:function(_){if(!t(_))throw new Error("ViewportAnchorX must be between 0 and 100.");l=_}},scroll:{enumerable:!0,get:function(){return g},set:function(_){var A=e(_);A===!1?console.warn("Scroll: an invalid or illegal string was specified."):g=A}}})}return Da=i,Da}var _l;function Mg(){if(_l)return Ca.exports;_l=1;var s=On(),e=Ca.exports={WebVTT:Og(),VTTCue:Rg(),VTTRegion:Ng()};s.vttjs=e,s.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,r=s.VTTCue,n=s.VTTRegion;return e.shim=function(){s.VTTCue=t,s.VTTRegion=i},e.restore=function(){s.VTTCue=r,s.VTTRegion=n},s.VTTCue||e.shim(),Ca.exports}var Bg=Mg();const yl=Tr(Bg);function Ge(){return Ge=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},Ge.apply(null,arguments)}var Tl="https://example.com",Rn=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=D.location&&D.location.href||"");var i=/^\/\//.test(e),r=!D.location&&!/\/\//i.test(e);e=new D.URL(e,D.location||Tl);var n=new URL(t,e);return r?n.href.slice(Tl.length):i?n.href.slice(n.protocol.length):n.href},Io=(function(){function s(){this.listeners={}}var e=s.prototype;return e.on=function(i,r){this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(r)},e.off=function(i,r){if(!this.listeners[i])return!1;var n=this.listeners[i].indexOf(r);return this.listeners[i]=this.listeners[i].slice(0),this.listeners[i].splice(n,1),n>-1},e.trigger=function(i){var r=this.listeners[i];if(r)if(arguments.length===2)for(var n=r.length,a=0;a<n;++a)r[a].call(this,arguments[1]);else for(var u=Array.prototype.slice.call(arguments,1),l=r.length,f=0;f<l;++f)r[f].apply(this,u)},e.dispose=function(){this.listeners={}},e.pipe=function(i){this.on("data",function(r){i.push(r)})},s})(),Fg=function(e){return D.atob?D.atob(e):Buffer.from(e,"base64").toString("binary")};function Qc(s){for(var e=Fg(s),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class Ug extends Io{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
11
11
|
`);t>-1;t=this.buffer.indexOf(`
|
|
12
|
-
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const yg=" ",Da=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},Tg=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},ut=function(s){const e={};if(!s)return e;const t=s.split(Tg());let i=t.length,r;for(;i--;)t[i]!==""&&(r=/([^=]*)=(.*)/.exec(t[i]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),e[r[0]]=r[1]);return e},pl=s=>{const e=s.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class vg extends wo{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;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 u=a(e);return u===e?n:n.concat([u])},[e]).forEach(n=>{for(let a=0;a<this.customParsers.length;a++)if(this.customParsers[a].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){i=$e(Da(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(i={type:"tag",tagType:"map"},t[1]){const a=ut(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=Da(a.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=ut(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=pl(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=ut(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=ut(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=ut(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=ut(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(yg)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=ut(t[1]),["DURATION"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["INDEPENDENT","GAP"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Da(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=ut(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=ut(t[1]),["PART-TARGET"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=ut(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(i.attributes.hasOwnProperty(a)){i.attributes[a]=parseInt(i.attributes[a],10);const u=a==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[u]=i.attributes[a],delete i.attributes[a]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=ut(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseInt(i.attributes[a],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=ut(t[1]),["ID","CLASS"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=String(i.attributes[u]))}),["START-DATE","END-DATE"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=new Date(i.attributes[u]))}),["DURATION","PLANNED-DURATION"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["END-ON-NEXT"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/i.test(i.attributes[u]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=i.attributes[u].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const u in i.attributes){if(!a.test(u))continue;const c=/[0-9A-Fa-f]{6}/g.test(i.attributes[u]),f=/^\d+(\.\d+)?$/.test(i.attributes[u]);i.attributes[u]=c?i.attributes[u].toString(16):f?parseFloat(i.attributes[u]):String(i.attributes[u])}this.trigger("data",i);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){i={type:"tag",tagType:"content-steering"},i.attributes=ut(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=ut(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=pl(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){i={type:"tag",tagType:"define"},i.attributes=ut(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:r}){typeof i!="function"&&(i=n=>n),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:i(n),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const i=r=>e.test(r)?t(r):r;this.tagMappers.push(i)}}const bg=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),yi=function(s){const e={};return Object.keys(s).forEach(function(t){e[bg(t)]=s[t]}),e},ka=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:i}=s;if(!e)return;const r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",u=t&&t*3,c=i&&i*2;t&&!e.hasOwnProperty(n)&&(e[n]=u,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${u}).`})),u&&e[n]<u&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${u})`}),e[n]=u),i&&!e.hasOwnProperty(a)&&(e[a]=i*3,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),i&&e[a]<c&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${c}).`}),e[a]=c)};class xg extends wo{constructor(e={}){super(),this.lineStream=new _g,this.parseStream=new vg,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,i=[];let r={},n,a,u=!1;const c=function(){},f={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},g="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let A=0,S=0;const O={};this.on("end",()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&n&&(r.map=n),!r.key&&a&&(r.key=a),!r.timeline&&typeof _=="number"&&(r.timeline=_),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(T){let I,F;if(t.manifest.definitions){for(const N in t.manifest.definitions)if(T.uri&&(T.uri=T.uri.replace(`{$${N}}`,t.manifest.definitions[N])),T.attributes)for(const R in T.attributes)typeof T.attributes[R]=="string"&&(T.attributes[R]=T.attributes[R].replace(`{$${N}}`,t.manifest.definitions[N]))}({tag(){({version(){T.version&&(this.manifest.version=T.version)},"allow-cache"(){this.manifest.allowCache=T.allowed,"allowed"in T||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const N={};"length"in T&&(r.byterange=N,N.length=T.length,"offset"in T||(T.offset=A)),"offset"in T&&(r.byterange=N,N.offset=T.offset),A=N.offset+N.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"})),T.title&&(r.title=T.title),T.duration>0&&(r.duration=T.duration),T.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!T.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(T.attributes.METHOD==="NONE"){a=null;return}if(!T.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(T.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:T.attributes};return}if(T.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:T.attributes.URI};return}if(T.attributes.KEYFORMAT===g){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(T.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(T.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),T.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(T.attributes.KEYID&&T.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:T.attributes.KEYFORMAT,keyId:T.attributes.KEYID.substring(2)},pssh:Fc(T.attributes.URI.split(",")[1])};return}T.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:T.attributes.METHOD||"AES-128",uri:T.attributes.URI},typeof T.attributes.IV<"u"&&(a.iv=T.attributes.IV)},"media-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+T.number});return}this.manifest.mediaSequence=T.number},"discontinuity-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+T.number});return}this.manifest.discontinuitySequence=T.number,_=T.number},"playlist-type"(){if(!/VOD|EVENT/.test(T.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+T.playlist});return}this.manifest.playlistType=T.playlistType},map(){n={},T.uri&&(n.uri=T.uri),T.byterange&&(n.byterange=T.byterange),a&&(n.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||f,!T.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),$e(r.attributes,T.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||f,!(T.attributes&&T.attributes.TYPE&&T.attributes["GROUP-ID"]&&T.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const N=this.manifest.mediaGroups[T.attributes.TYPE];N[T.attributes["GROUP-ID"]]=N[T.attributes["GROUP-ID"]]||{},I=N[T.attributes["GROUP-ID"]],F={default:/yes/i.test(T.attributes.DEFAULT)},F.default?F.autoselect=!0:F.autoselect=/yes/i.test(T.attributes.AUTOSELECT),T.attributes.LANGUAGE&&(F.language=T.attributes.LANGUAGE),T.attributes.URI&&(F.uri=T.attributes.URI),T.attributes["INSTREAM-ID"]&&(F.instreamId=T.attributes["INSTREAM-ID"]),T.attributes.CHARACTERISTICS&&(F.characteristics=T.attributes.CHARACTERISTICS),T.attributes.FORCED&&(F.forced=/yes/i.test(T.attributes.FORCED)),I[T.attributes.NAME]=F},discontinuity(){_+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=T.dateTimeString,this.manifest.dateTimeObject=T.dateTimeObject),r.dateTimeString=T.dateTimeString,r.dateTimeObject=T.dateTimeObject;const{lastProgramDateTime:N}=this;this.lastProgramDateTime=new Date(T.dateTimeString).getTime(),N===null&&this.manifest.segments.reduceRight((R,U)=>(U.programDateTime=R-U.duration*1e3,U.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(T.duration)||T.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+T.duration});return}this.manifest.targetDuration=T.duration,ka.call(this,this.manifest)},start(){if(!T.attributes||isNaN(T.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:T.attributes["TIME-OFFSET"],precise:T.attributes.PRECISE}},"cue-out"(){r.cueOut=T.data},"cue-out-cont"(){r.cueOutCont=T.data},"cue-in"(){r.cueIn=T.data},skip(){this.manifest.skip=yi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const N=this.manifest.segments.length,R=yi(T.attributes);r.parts=r.parts||[],r.parts.push(R),R.byterange&&(R.byterange.hasOwnProperty("offset")||(R.byterange.offset=S),S=R.byterange.offset+R.byterange.length);const U=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${U} for segment #${N}`,T.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((j,M)=>{j.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${M} lacks required attribute(s): LAST-PART`})})},"server-control"(){const N=this.manifest.serverControl=yi(T.attributes);N.hasOwnProperty("canBlockReload")||(N.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),ka.call(this,this.manifest),N.canSkipDateranges&&!N.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 N=this.manifest.segments.length,R=yi(T.attributes),U=R.type&&R.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(R),R.byterange&&(R.byterange.hasOwnProperty("offset")||(R.byterange.offset=U?S:0,U&&(S=R.byterange.offset+R.byterange.length)));const j=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${j} for segment #${N}`,T.attributes,["TYPE","URI"]),!!R.type)for(let M=0;M<r.preloadHints.length-1;M++){const L=r.preloadHints[M];L.type&&L.type===R.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${j} for segment #${N} has the same TYPE ${R.type} as preload hint #${M}`})}},"rendition-report"(){const N=yi(T.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(N);const R=this.manifest.renditionReports.length-1,U=["LAST-MSN","URI"];u&&U.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${R}`,T.attributes,U)},"part-inf"(){this.manifest.partInf=yi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",T.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),ka.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(yi(T.attributes));const N=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${N}`,T.attributes,["ID","START-DATE"]);const R=this.manifest.dateRanges[N];R.endDate&&R.startDate&&new Date(R.endDate)<new Date(R.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),R.duration&&R.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),R.plannedDuration&&R.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const U=!!R.endOnNext;if(U&&!R.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),U&&(R.duration||R.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),R.duration&&R.endDate){const M=R.startDate.getTime()+R.duration*1e3;this.manifest.dateRanges[N].endDate=new Date(M)}if(!O[R.id])O[R.id]=R;else{for(const M in O[R.id])if(R[M]&&JSON.stringify(O[R.id][M])!==JSON.stringify(R[M])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const j=this.manifest.dateRanges.findIndex(M=>M.id===R.id);this.manifest.dateRanges[j]=$e(this.manifest.dateRanges[j],R),O[R.id]=$e(O[R.id],R),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=yi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",T.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const N=(R,U)=>{if(R in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${R}`});return}this.manifest.definitions[R]=U};if("QUERYPARAM"in T.attributes){if("NAME"in T.attributes||"IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const R=this.params.get(T.attributes.QUERYPARAM);if(!R){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${T.attributes.QUERYPARAM}`});return}N(T.attributes.QUERYPARAM,decodeURIComponent(R));return}if("NAME"in T.attributes){if("IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in T.attributes)||typeof T.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${T.attributes.NAME}`});return}N(T.attributes.NAME,T.attributes.VALUE);return}if("IMPORT"in T.attributes){if(!this.mainDefinitions[T.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${T.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}N(T.attributes.IMPORT,this.mainDefinitions[T.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:T.attributes,uri:T.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",T.attributes,["BANDWIDTH","URI"])}}[T.tagType]||c).call(t)},uri(){r.uri=T.uri,i.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),a&&(r.key=a),r.timeline=_,n&&(r.map=n),S=0,this.lastProgramDateTime!==null&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=r.duration*1e3),r={}},comment(){},custom(){T.segment?(r.custom=r.custom||{},r.custom[T.customType]=T.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[T.customType]=T.data)}})[T.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,i){const r=[];i.forEach(function(n){t.hasOwnProperty(n)||r.push(n)}),r.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${r.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
13
|
-
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var qi={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},Sg=["video","audio","text"],ml=["Video","Audio","Text"],Uc=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,r){var n=("00"+Number(i).toString(16)).slice(-2),a=("00"+Number(r).toString(16)).slice(-2);return"avc1."+n+"00"+a})},Ht=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(r){r=r.trim();var n;Sg.forEach(function(a){var u=qi[a].exec(r.toLowerCase());if(!(!u||u.length<=1)){n=a;var c=r.substring(0,u[1].length),f=r.replace(c,"");i.push({type:c,details:f,mediaType:a})}}),n||i.push({type:r,details:"",mediaType:"unknown"})}),i},Eg=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var r in i){var n=i[r];if(n.default&&n.playlists)return Ht(n.playlists[0].attributes.CODECS)}return null},jc=function(e){return e===void 0&&(e=""),qi.audio.test(e.trim().toLowerCase())},Cg=function(e){return e===void 0&&(e=""),qi.text.test(e.trim().toLowerCase())},ps=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return Uc(n.trim())}),i="video";t.length===1&&jc(t[0])?i="audio":t.length===1&&Cg(t[0])&&(i="application");var r="mp4";return t.every(function(n){return qi.mp4.test(n)})?r="mp4":t.every(function(n){return qi.webm.test(n)})?r="webm":t.every(function(n){return qi.ogg.test(n)})&&(r="ogg"),i+"/"+r+';codecs="'+e+'"'}},or=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),D.MediaSource&&D.MediaSource.isTypeSupported&&D.MediaSource.isTypeSupported(ps(e))||t&&D.ManagedMediaSource&&D.ManagedMediaSource.isTypeSupported&&D.ManagedMediaSource.isTypeSupported(ps(e))||!1},Ia=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<ml.length;i++){var r=ml[i];if(qi["muxer"+r].test(t))return!0}return!1})},gl="mp4a.40.2",wg="avc1.4d400d",Ag=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Dg=/^application\/dash\+xml/i,qc=function(e){return Ag.test(e)?"hls":Dg.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},kg=function(e){return e.toString(2).length},Ig=function(e){return Math.ceil(kg(e)/8)},$c=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Pg=function(e){return $c(e)},ce=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!Pg(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ze=D.BigInt||Number,Qa=[Ze("0x1"),Ze("0x100"),Ze("0x10000"),Ze("0x1000000"),Ze("0x100000000"),Ze("0x10000000000"),Ze("0x1000000000000"),Ze("0x100000000000000"),Ze("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var Lg=function(e,t){var i=t===void 0?{}:t,r=i.signed,n=r===void 0?!1:r,a=i.le,u=a===void 0?!1:a;e=ce(e);var c=u?"reduce":"reduceRight",f=e[c]?e[c]:Array.prototype[c],g=f.call(e,function(A,S,O){var T=u?O:Math.abs(O+1-e.length);return A+Ze(S)*Qa[T]},Ze(0));if(n){var _=Qa[e.length]/Ze(2)-Ze(1);g=Ze(g),g>_&&(g-=_,g-=_,g-=Ze(2))}return Number(g)},Og=function(e,t){var i={},r=i.le,n=r===void 0?!1:r;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=Ze(e);for(var a=Ig(e),u=new Uint8Array(new ArrayBuffer(a)),c=0;c<a;c++){var f=n?c:Math.abs(c+1-u.length);u[f]=Number(e/Qa[c]&Ze(255)),e<0&&(u[f]=Math.abs(~u[f]),u[f]-=c===0?1:2)}return u},Vc=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i},Rg=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(u){return u&&(u.byteLength||u.length)&&typeof u!="string"}),t.length<=1)return ce(t[0]);var r=t.reduce(function(u,c,f){return u+(c.byteLength||c.length)},0),n=new Uint8Array(r),a=0;return t.forEach(function(u){u=ce(u),n.set(u,a),a+=u.byteLength}),n},Ne=function(e,t,i){var r=i===void 0?{}:i,n=r.offset,a=n===void 0?0:n,u=r.mask,c=u===void 0?[]:u;e=ce(e),t=ce(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(g,_){var A=c[_]?c[_]&e[a+_]:e[a+_];return g===A})},Ng=function(e,t,i){t.forEach(function(r){for(var n in e.mediaGroups[r])for(var a in e.mediaGroups[r][n]){var u=e.mediaGroups[r][n][a];i(u,r,n,a)}})},Js={},si={},Ni={},_l;function Rn(){if(_l)return Ni;_l=1;function s(n,a,u){if(u===void 0&&(u=Array.prototype),n&&typeof u.find=="function")return u.find.call(n,a);for(var c=0;c<n.length;c++)if(Object.prototype.hasOwnProperty.call(n,c)){var f=n[c];if(a.call(void 0,f,c,n))return f}}function e(n,a){return a===void 0&&(a=Object),a&&typeof a.freeze=="function"?a.freeze(n):n}function t(n,a){if(n===null||typeof n!="object")throw new TypeError("target is not an object");for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(n[u]=a[u]);return n}var i=e({HTML:"text/html",isHTML:function(n){return n===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return Ni.assign=t,Ni.find=s,Ni.freeze=e,Ni.MIME_TYPE=i,Ni.NAMESPACE=r,Ni}var yl;function Hc(){if(yl)return si;yl=1;var s=Rn(),e=s.find,t=s.NAMESPACE;function i(y){return y!==""}function r(y){return y?y.split(/[\t\n\f\r ]+/).filter(i):[]}function n(y,b){return y.hasOwnProperty(b)||(y[b]=!0),y}function a(y){if(!y)return[];var b=r(y);return Object.keys(b.reduce(n,{}))}function u(y){return function(b){return y&&y.indexOf(b)!==-1}}function c(y,b){for(var P in y)Object.prototype.hasOwnProperty.call(y,P)&&(b[P]=y[P])}function f(y,b){var P=y.prototype;if(!(P instanceof b)){let H=function(){};H.prototype=b.prototype,H=new H,c(P,H),y.prototype=P=H}P.constructor!=y&&(typeof y!="function"&&console.error("unknown Class:"+y),P.constructor=y)}var g={},_=g.ELEMENT_NODE=1,A=g.ATTRIBUTE_NODE=2,S=g.TEXT_NODE=3,O=g.CDATA_SECTION_NODE=4,T=g.ENTITY_REFERENCE_NODE=5,I=g.ENTITY_NODE=6,F=g.PROCESSING_INSTRUCTION_NODE=7,N=g.COMMENT_NODE=8,R=g.DOCUMENT_NODE=9,U=g.DOCUMENT_TYPE_NODE=10,j=g.DOCUMENT_FRAGMENT_NODE=11,M=g.NOTATION_NODE=12,L={},$={};L.INDEX_SIZE_ERR=($[1]="Index size error",1),L.DOMSTRING_SIZE_ERR=($[2]="DOMString size error",2);var v=L.HIERARCHY_REQUEST_ERR=($[3]="Hierarchy request error",3);L.WRONG_DOCUMENT_ERR=($[4]="Wrong document",4),L.INVALID_CHARACTER_ERR=($[5]="Invalid character",5),L.NO_DATA_ALLOWED_ERR=($[6]="No data allowed",6),L.NO_MODIFICATION_ALLOWED_ERR=($[7]="No modification allowed",7);var E=L.NOT_FOUND_ERR=($[8]="Not found",8);L.NOT_SUPPORTED_ERR=($[9]="Not supported",9);var V=L.INUSE_ATTRIBUTE_ERR=($[10]="Attribute in use",10);L.INVALID_STATE_ERR=($[11]="Invalid state",11),L.SYNTAX_ERR=($[12]="Syntax error",12),L.INVALID_MODIFICATION_ERR=($[13]="Invalid modification",13),L.NAMESPACE_ERR=($[14]="Invalid namespace",14),L.INVALID_ACCESS_ERR=($[15]="Invalid access",15);function G(y,b){if(b instanceof Error)var P=b;else P=this,Error.call(this,$[y]),this.message=$[y],Error.captureStackTrace&&Error.captureStackTrace(this,G);return P.code=y,b&&(this.message=this.message+": "+b),P}G.prototype=Error.prototype,c(L,G);function z(){}z.prototype={length:0,item:function(y){return y>=0&&y<this.length?this[y]:null},toString:function(y,b){for(var P=[],H=0;H<this.length;H++)pi(this[H],P,y,b);return P.join("")},filter:function(y){return Array.prototype.filter.call(this,y)},indexOf:function(y){return Array.prototype.indexOf.call(this,y)}};function Q(y,b){this._node=y,this._refresh=b,se(this)}function se(y){var b=y._node._inc||y._node.ownerDocument._inc;if(y._inc!==b){var P=y._refresh(y._node);if(Dr(y,"length",P.length),!y.$$length||P.length<y.$$length)for(var H=P.length;H in y;H++)Object.prototype.hasOwnProperty.call(y,H)&&delete y[H];c(P,y),y._inc=b}}Q.prototype.item=function(y){return se(this),this[y]||null},f(Q,z);function te(){}function X(y,b){for(var P=y.length;P--;)if(y[P]===b)return P}function Z(y,b,P,H){if(H?b[X(b,H)]=P:b[b.length++]=P,y){P.ownerElement=y;var ne=y.ownerDocument;ne&&(H&&Qe(ne,y,H),fe(ne,y,P))}}function J(y,b,P){var H=X(b,P);if(H>=0){for(var ne=b.length-1;H<ne;)b[H]=b[++H];if(b.length=ne,y){var he=y.ownerDocument;he&&(Qe(he,y,P),P.ownerElement=null)}}else throw new G(E,new Error(y.tagName+"@"+P))}te.prototype={length:0,item:z.prototype.item,getNamedItem:function(y){for(var b=this.length;b--;){var P=this[b];if(P.nodeName==y)return P}},setNamedItem:function(y){var b=y.ownerElement;if(b&&b!=this._ownerElement)throw new G(V);var P=this.getNamedItem(y.nodeName);return Z(this._ownerElement,this,y,P),P},setNamedItemNS:function(y){var b=y.ownerElement,P;if(b&&b!=this._ownerElement)throw new G(V);return P=this.getNamedItemNS(y.namespaceURI,y.localName),Z(this._ownerElement,this,y,P),P},removeNamedItem:function(y){var b=this.getNamedItem(y);return J(this._ownerElement,this,b),b},removeNamedItemNS:function(y,b){var P=this.getNamedItemNS(y,b);return J(this._ownerElement,this,P),P},getNamedItemNS:function(y,b){for(var P=this.length;P--;){var H=this[P];if(H.localName==b&&H.namespaceURI==y)return H}return null}};function ee(){}ee.prototype={hasFeature:function(y,b){return!0},createDocument:function(y,b,P){var H=new ye;if(H.implementation=this,H.childNodes=new z,H.doctype=P||null,P&&H.appendChild(P),b){var ne=H.createElementNS(y,b);H.appendChild(ne)}return H},createDocumentType:function(y,b,P){var H=new fi;return H.name=y,H.nodeName=y,H.publicId=b||"",H.systemId=P||"",H}};function ie(){}ie.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(y,b){return Et(this,y,b)},replaceChild:function(y,b){Et(this,y,b,gt),b&&this.removeChild(b)},removeChild:function(y){return Ve(this,y)},appendChild:function(y){return this.insertBefore(y,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(y){return Rs(this.ownerDocument||this,this,y)},normalize:function(){for(var y=this.firstChild;y;){var b=y.nextSibling;b&&b.nodeType==S&&y.nodeType==S?(this.removeChild(b),y.appendData(b.data)):(y.normalize(),y=b)}},isSupported:function(y,b){return this.ownerDocument.implementation.hasFeature(y,b)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(y){for(var b=this;b;){var P=b._nsMap;if(P){for(var H in P)if(Object.prototype.hasOwnProperty.call(P,H)&&P[H]===y)return H}b=b.nodeType==A?b.ownerDocument:b.parentNode}return null},lookupNamespaceURI:function(y){for(var b=this;b;){var P=b._nsMap;if(P&&Object.prototype.hasOwnProperty.call(P,y))return P[y];b=b.nodeType==A?b.ownerDocument:b.parentNode}return null},isDefaultNamespace:function(y){var b=this.lookupPrefix(y);return b==null}};function pe(y){return y=="<"&&"<"||y==">"&&">"||y=="&"&&"&"||y=='"'&&"""||"&#"+y.charCodeAt()+";"}c(g,ie),c(g,ie.prototype);function ge(y,b){if(b(y))return!0;if(y=y.firstChild)do if(ge(y,b))return!0;while(y=y.nextSibling)}function ye(){this.ownerDocument=this}function fe(y,b,P){y&&y._inc++;var H=P.namespaceURI;H===t.XMLNS&&(b._nsMap[P.prefix?P.localName:""]=P.value)}function Qe(y,b,P,H){y&&y._inc++;var ne=P.namespaceURI;ne===t.XMLNS&&delete b._nsMap[P.prefix?P.localName:""]}function et(y,b,P){if(y&&y._inc){y._inc++;var H=b.childNodes;if(P)H[H.length++]=P;else{for(var ne=b.firstChild,he=0;ne;)H[he++]=ne,ne=ne.nextSibling;H.length=he,delete H[H.length]}}}function Ve(y,b){var P=b.previousSibling,H=b.nextSibling;return P?P.nextSibling=H:y.firstChild=H,H?H.previousSibling=P:y.lastChild=P,b.parentNode=null,b.previousSibling=null,b.nextSibling=null,et(y.ownerDocument,y),b}function tt(y){return y&&(y.nodeType===ie.DOCUMENT_NODE||y.nodeType===ie.DOCUMENT_FRAGMENT_NODE||y.nodeType===ie.ELEMENT_NODE)}function St(y){return y&&(at(y)||li(y)||Je(y)||y.nodeType===ie.DOCUMENT_FRAGMENT_NODE||y.nodeType===ie.COMMENT_NODE||y.nodeType===ie.PROCESSING_INSTRUCTION_NODE)}function Je(y){return y&&y.nodeType===ie.DOCUMENT_TYPE_NODE}function at(y){return y&&y.nodeType===ie.ELEMENT_NODE}function li(y){return y&&y.nodeType===ie.TEXT_NODE}function Ge(y,b){var P=y.childNodes||[];if(e(P,at)||Je(b))return!1;var H=e(P,Je);return!(b&&H&&P.indexOf(H)>P.indexOf(b))}function ci(y,b){var P=y.childNodes||[];function H(he){return at(he)&&he!==b}if(e(P,H))return!1;var ne=e(P,Je);return!(b&&ne&&P.indexOf(ne)>P.indexOf(b))}function ze(y,b,P){if(!tt(y))throw new G(v,"Unexpected parent node type "+y.nodeType);if(P&&P.parentNode!==y)throw new G(E,"child not in parent");if(!St(b)||Je(b)&&y.nodeType!==ie.DOCUMENT_NODE)throw new G(v,"Unexpected node type "+b.nodeType+" for parent node type "+y.nodeType)}function Xi(y,b,P){var H=y.childNodes||[],ne=b.childNodes||[];if(b.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var he=ne.filter(at);if(he.length>1||e(ne,li))throw new G(v,"More than one element or text in fragment");if(he.length===1&&!Ge(y,P))throw new G(v,"Element in fragment can not be inserted before doctype")}if(at(b)&&!Ge(y,P))throw new G(v,"Only one element can be added and only after doctype");if(Je(b)){if(e(H,Je))throw new G(v,"Only one doctype is allowed");var De=e(H,at);if(P&&H.indexOf(De)<H.indexOf(P))throw new G(v,"Doctype can only be inserted before an element");if(!P&&De)throw new G(v,"Doctype can not be appended since element is present")}}function gt(y,b,P){var H=y.childNodes||[],ne=b.childNodes||[];if(b.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var he=ne.filter(at);if(he.length>1||e(ne,li))throw new G(v,"More than one element or text in fragment");if(he.length===1&&!ci(y,P))throw new G(v,"Element in fragment can not be inserted before doctype")}if(at(b)&&!ci(y,P))throw new G(v,"Only one element can be added and only after doctype");if(Je(b)){if(e(H,function(_t){return Je(_t)&&_t!==P}))throw new G(v,"Only one doctype is allowed");var De=e(H,at);if(P&&H.indexOf(De)<H.indexOf(P))throw new G(v,"Doctype can only be inserted before an element")}}function Et(y,b,P,H){ze(y,b,P),y.nodeType===ie.DOCUMENT_NODE&&(H||Xi)(y,b,P);var ne=b.parentNode;if(ne&&ne.removeChild(b),b.nodeType===j){var he=b.firstChild;if(he==null)return b;var De=b.lastChild}else he=De=b;var it=P?P.previousSibling:y.lastChild;he.previousSibling=it,De.nextSibling=P,it?it.nextSibling=he:y.firstChild=he,P==null?y.lastChild=De:P.previousSibling=De;do{he.parentNode=y;var _t=y.ownerDocument||y;be(he,_t)}while(he!==De&&(he=he.nextSibling));return et(y.ownerDocument||y,y),b.nodeType==j&&(b.firstChild=b.lastChild=null),b}function be(y,b){if(y.ownerDocument!==b){if(y.ownerDocument=b,y.nodeType===_&&y.attributes)for(var P=0;P<y.attributes.length;P++){var H=y.attributes.item(P);H&&(H.ownerDocument=b)}for(var ne=y.firstChild;ne;)be(ne,b),ne=ne.nextSibling}}function Pe(y,b){b.parentNode&&b.parentNode.removeChild(b),b.parentNode=y,b.previousSibling=y.lastChild,b.nextSibling=null,b.previousSibling?b.previousSibling.nextSibling=b:y.firstChild=b,y.lastChild=b,et(y.ownerDocument,y,b);var P=y.ownerDocument||y;return be(b,P),b}ye.prototype={nodeName:"#document",nodeType:R,doctype:null,documentElement:null,_inc:1,insertBefore:function(y,b){if(y.nodeType==j){for(var P=y.firstChild;P;){var H=P.nextSibling;this.insertBefore(P,b),P=H}return y}return Et(this,y,b),be(y,this),this.documentElement===null&&y.nodeType===_&&(this.documentElement=y),y},removeChild:function(y){return this.documentElement==y&&(this.documentElement=null),Ve(this,y)},replaceChild:function(y,b){Et(this,y,b,gt),be(y,this),b&&this.removeChild(b),at(y)&&(this.documentElement=y)},importNode:function(y,b){return Ar(this,y,b)},getElementById:function(y){var b=null;return ge(this.documentElement,function(P){if(P.nodeType==_&&P.getAttribute("id")==y)return b=P,!0}),b},getElementsByClassName:function(y){var b=a(y);return new Q(this,function(P){var H=[];return b.length>0&&ge(P.documentElement,function(ne){if(ne!==P&&ne.nodeType===_){var he=ne.getAttribute("class");if(he){var De=y===he;if(!De){var it=a(he);De=b.every(u(it))}De&&H.push(ne)}}}),H})},createElement:function(y){var b=new Oe;b.ownerDocument=this,b.nodeName=y,b.tagName=y,b.localName=y,b.childNodes=new z;var P=b.attributes=new te;return P._ownerElement=b,b},createDocumentFragment:function(){var y=new Se;return y.ownerDocument=this,y.childNodes=new z,y},createTextNode:function(y){var b=new Di;return b.ownerDocument=this,b.appendData(y),b},createComment:function(y){var b=new ki;return b.ownerDocument=this,b.appendData(y),b},createCDATASection:function(y){var b=new hi;return b.ownerDocument=this,b.appendData(y),b},createProcessingInstruction:function(y,b){var P=new Ls;return P.ownerDocument=this,P.tagName=P.nodeName=P.target=y,P.nodeValue=P.data=b,P},createAttribute:function(y){var b=new di;return b.ownerDocument=this,b.name=y,b.nodeName=y,b.localName=y,b.specified=!0,b},createEntityReference:function(y){var b=new Ki;return b.ownerDocument=this,b.nodeName=y,b},createElementNS:function(y,b){var P=new Oe,H=b.split(":"),ne=P.attributes=new te;return P.childNodes=new z,P.ownerDocument=this,P.nodeName=b,P.tagName=b,P.namespaceURI=y,H.length==2?(P.prefix=H[0],P.localName=H[1]):P.localName=b,ne._ownerElement=P,P},createAttributeNS:function(y,b){var P=new di,H=b.split(":");return P.ownerDocument=this,P.nodeName=b,P.name=b,P.namespaceURI=y,P.specified=!0,H.length==2?(P.prefix=H[0],P.localName=H[1]):P.localName=b,P}},f(ye,ie);function Oe(){this._nsMap={}}Oe.prototype={nodeType:_,hasAttribute:function(y){return this.getAttributeNode(y)!=null},getAttribute:function(y){var b=this.getAttributeNode(y);return b&&b.value||""},getAttributeNode:function(y){return this.attributes.getNamedItem(y)},setAttribute:function(y,b){var P=this.ownerDocument.createAttribute(y);P.value=P.nodeValue=""+b,this.setAttributeNode(P)},removeAttribute:function(y){var b=this.getAttributeNode(y);b&&this.removeAttributeNode(b)},appendChild:function(y){return y.nodeType===j?this.insertBefore(y,null):Pe(this,y)},setAttributeNode:function(y){return this.attributes.setNamedItem(y)},setAttributeNodeNS:function(y){return this.attributes.setNamedItemNS(y)},removeAttributeNode:function(y){return this.attributes.removeNamedItem(y.nodeName)},removeAttributeNS:function(y,b){var P=this.getAttributeNodeNS(y,b);P&&this.removeAttributeNode(P)},hasAttributeNS:function(y,b){return this.getAttributeNodeNS(y,b)!=null},getAttributeNS:function(y,b){var P=this.getAttributeNodeNS(y,b);return P&&P.value||""},setAttributeNS:function(y,b,P){var H=this.ownerDocument.createAttributeNS(y,b);H.value=H.nodeValue=""+P,this.setAttributeNode(H)},getAttributeNodeNS:function(y,b){return this.attributes.getNamedItemNS(y,b)},getElementsByTagName:function(y){return new Q(this,function(b){var P=[];return ge(b,function(H){H!==b&&H.nodeType==_&&(y==="*"||H.tagName==y)&&P.push(H)}),P})},getElementsByTagNameNS:function(y,b){return new Q(this,function(P){var H=[];return ge(P,function(ne){ne!==P&&ne.nodeType===_&&(y==="*"||ne.namespaceURI===y)&&(b==="*"||ne.localName==b)&&H.push(ne)}),H})}},ye.prototype.getElementsByTagName=Oe.prototype.getElementsByTagName,ye.prototype.getElementsByTagNameNS=Oe.prototype.getElementsByTagNameNS,f(Oe,ie);function di(){}di.prototype.nodeType=A,f(di,ie);function ei(){}ei.prototype={data:"",substringData:function(y,b){return this.data.substring(y,y+b)},appendData:function(y){y=this.data+y,this.nodeValue=this.data=y,this.length=y.length},insertData:function(y,b){this.replaceData(y,0,b)},appendChild:function(y){throw new Error($[v])},deleteData:function(y,b){this.replaceData(y,b,"")},replaceData:function(y,b,P){var H=this.data.substring(0,y),ne=this.data.substring(y+b);P=H+P+ne,this.nodeValue=this.data=P,this.length=P.length}},f(ei,ie);function Di(){}Di.prototype={nodeName:"#text",nodeType:S,splitText:function(y){var b=this.data,P=b.substring(y);b=b.substring(0,y),this.data=this.nodeValue=b,this.length=b.length;var H=this.ownerDocument.createTextNode(P);return this.parentNode&&this.parentNode.insertBefore(H,this.nextSibling),H}},f(Di,ei);function ki(){}ki.prototype={nodeName:"#comment",nodeType:N},f(ki,ei);function hi(){}hi.prototype={nodeName:"#cdata-section",nodeType:O},f(hi,ei);function fi(){}fi.prototype.nodeType=U,f(fi,ie);function Is(){}Is.prototype.nodeType=M,f(Is,ie);function Ps(){}Ps.prototype.nodeType=I,f(Ps,ie);function Ki(){}Ki.prototype.nodeType=T,f(Ki,ie);function Se(){}Se.prototype.nodeName="#document-fragment",Se.prototype.nodeType=j,f(Se,ie);function Ls(){}Ls.prototype.nodeType=F,f(Ls,ie);function Ii(){}Ii.prototype.serializeToString=function(y,b,P){return Cr.call(y,b,P)},ie.prototype.toString=Cr;function Cr(y,b){var P=[],H=this.nodeType==9&&this.documentElement||this,ne=H.prefix,he=H.namespaceURI;if(he&&ne==null){var ne=H.lookupPrefix(he);if(ne==null)var De=[{namespace:he,prefix:null}]}return pi(this,P,y,b,De),P.join("")}function wr(y,b,P){var H=y.prefix||"",ne=y.namespaceURI;if(!ne||H==="xml"&&ne===t.XML||ne===t.XMLNS)return!1;for(var he=P.length;he--;){var De=P[he];if(De.prefix===H)return De.namespace!==ne}return!0}function Os(y,b,P){y.push(" ",b,'="',P.replace(/[<>&"\t\n\r]/g,pe),'"')}function pi(y,b,P,H,ne){if(ne||(ne=[]),H)if(y=H(y),y){if(typeof y=="string"){b.push(y);return}}else return;switch(y.nodeType){case _:var he=y.attributes,De=he.length,ke=y.firstChild,it=y.tagName;P=t.isHTML(y.namespaceURI)||P;var _t=it;if(!P&&!y.prefix&&y.namespaceURI){for(var jt,Ct=0;Ct<he.length;Ct++)if(he.item(Ct).name==="xmlns"){jt=he.item(Ct).value;break}if(!jt)for(var Ot=ne.length-1;Ot>=0;Ot--){var wt=ne[Ot];if(wt.prefix===""&&wt.namespace===y.namespaceURI){jt=wt.namespace;break}}if(jt!==y.namespaceURI)for(var Ot=ne.length-1;Ot>=0;Ot--){var wt=ne[Ot];if(wt.namespace===y.namespaceURI){wt.prefix&&(_t=wt.prefix+":"+it);break}}}b.push("<",_t);for(var Ue=0;Ue<De;Ue++){var At=he.item(Ue);At.prefix=="xmlns"?ne.push({prefix:At.localName,namespace:At.value}):At.nodeName=="xmlns"&&ne.push({prefix:"",namespace:At.value})}for(var Ue=0;Ue<De;Ue++){var At=he.item(Ue);if(wr(At,P,ne)){var ti=At.prefix||"",qt=At.namespaceURI;Os(b,ti?"xmlns:"+ti:"xmlns",qt),ne.push({prefix:ti,namespace:qt})}pi(At,b,P,H,ne)}if(it===_t&&wr(y,P,ne)){var ti=y.prefix||"",qt=y.namespaceURI;Os(b,ti?"xmlns:"+ti:"xmlns",qt),ne.push({prefix:ti,namespace:qt})}if(ke||P&&!/^(?:meta|link|img|br|hr|input)$/i.test(it)){if(b.push(">"),P&&/^script$/i.test(it))for(;ke;)ke.data?b.push(ke.data):pi(ke,b,P,H,ne.slice()),ke=ke.nextSibling;else for(;ke;)pi(ke,b,P,H,ne.slice()),ke=ke.nextSibling;b.push("</",_t,">")}else b.push("/>");return;case R:case j:for(var ke=y.firstChild;ke;)pi(ke,b,P,H,ne.slice()),ke=ke.nextSibling;return;case A:return Os(b,y.name,y.value);case S:return b.push(y.data.replace(/[<&>]/g,pe));case O:return b.push("<![CDATA[",y.data,"]]>");case N:return b.push("<!--",y.data,"-->");case U:var Pi=y.publicId,xe=y.systemId;if(b.push("<!DOCTYPE ",y.name),Pi)b.push(" PUBLIC ",Pi),xe&&xe!="."&&b.push(" ",xe),b.push(">");else if(xe&&xe!=".")b.push(" SYSTEM ",xe,">");else{var kr=y.internalSubset;kr&&b.push(" [",kr,"]"),b.push(">")}return;case F:return b.push("<?",y.target," ",y.data,"?>");case T:return b.push("&",y.nodeName,";");default:b.push("??",y.nodeName)}}function Ar(y,b,P){var H;switch(b.nodeType){case _:H=b.cloneNode(!1),H.ownerDocument=y;case j:break;case A:P=!0;break}if(H||(H=b.cloneNode(!1)),H.ownerDocument=y,H.parentNode=null,P)for(var ne=b.firstChild;ne;)H.appendChild(Ar(y,ne,P)),ne=ne.nextSibling;return H}function Rs(y,b,P){var H=new b.constructor;for(var ne in b)if(Object.prototype.hasOwnProperty.call(b,ne)){var he=b[ne];typeof he!="object"&&he!=H[ne]&&(H[ne]=he)}switch(b.childNodes&&(H.childNodes=new z),H.ownerDocument=y,H.nodeType){case _:var De=b.attributes,it=H.attributes=new te,_t=De.length;it._ownerElement=H;for(var jt=0;jt<_t;jt++)H.setAttributeNode(Rs(y,De.item(jt),!0));break;case A:P=!0}if(P)for(var Ct=b.firstChild;Ct;)H.appendChild(Rs(y,Ct,P)),Ct=Ct.nextSibling;return H}function Dr(y,b,P){y[b]=P}try{if(Object.defineProperty){let y=function(b){switch(b.nodeType){case _:case j:var P=[];for(b=b.firstChild;b;)b.nodeType!==7&&b.nodeType!==8&&P.push(y(b)),b=b.nextSibling;return P.join("");default:return b.nodeValue}};Object.defineProperty(Q.prototype,"length",{get:function(){return se(this),this.$$length}}),Object.defineProperty(ie.prototype,"textContent",{get:function(){return y(this)},set:function(b){switch(this.nodeType){case _:case j:for(;this.firstChild;)this.removeChild(this.firstChild);(b||String(b))&&this.appendChild(this.ownerDocument.createTextNode(b));break;default:this.data=b,this.value=b,this.nodeValue=b}}}),Dr=function(b,P,H){b["$$"+P]=H}}}catch{}return si.DocumentType=fi,si.DOMException=G,si.DOMImplementation=ee,si.Element=Oe,si.Node=ie,si.NodeList=z,si.XMLSerializer=Ii,si}var Zs={},Pa={},Tl;function Mg(){return Tl||(Tl=1,(function(s){var e=Rn().freeze;s.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
14
|
-
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),s.entityMap=s.HTML_ENTITIES})(Pa)),Pa}var tn={},vl;function Bg(){if(vl)return tn;vl=1;var s=Rn().NAMESPACE,e=/[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]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),r=0,n=1,a=2,u=3,c=4,f=5,g=6,_=7;function A(v,E){this.message=v,this.locator=E,Error.captureStackTrace&&Error.captureStackTrace(this,A)}A.prototype=new Error,A.prototype.name=A.name;function S(){}S.prototype={parse:function(v,E,V){var G=this.domBuilder;G.startDocument(),U(E,E={}),O(v,E,V,G,this.errorHandler),G.endDocument()}};function O(v,E,V,G,z){function Q(Pe){if(Pe>65535){Pe-=65536;var Oe=55296+(Pe>>10),di=56320+(Pe&1023);return String.fromCharCode(Oe,di)}else return String.fromCharCode(Pe)}function se(Pe){var Oe=Pe.slice(1,-1);return Object.hasOwnProperty.call(V,Oe)?V[Oe]:Oe.charAt(0)==="#"?Q(parseInt(Oe.substr(1).replace("x","0x"))):(z.error("entity not found:"+Pe),Pe)}function te(Pe){if(Pe>ye){var Oe=v.substring(ye,Pe).replace(/&#?\w+;/g,se);ie&&X(ye),G.characters(Oe,0,Pe-ye),ye=Pe}}function X(Pe,Oe){for(;Pe>=J&&(Oe=ee.exec(v));)Z=Oe.index,J=Z+Oe[0].length,ie.lineNumber++;ie.columnNumber=Pe-Z+1}for(var Z=0,J=0,ee=/.*(?:\r\n?|\n)|.*$/g,ie=G.locator,pe=[{currentNSMap:E}],ge={},ye=0;;){try{var fe=v.indexOf("<",ye);if(fe<0){if(!v.substr(ye).match(/^\s*$/)){var Qe=G.doc,et=Qe.createTextNode(v.substr(ye));Qe.appendChild(et),G.currentElement=et}return}switch(fe>ye&&te(fe),v.charAt(fe+1)){case"/":var ze=v.indexOf(">",fe+3),Ve=v.substring(fe+2,ze).replace(/[ \t\n\r]+$/g,""),tt=pe.pop();ze<0?(Ve=v.substring(fe+2).replace(/[\s<].*/,""),z.error("end tag name: "+Ve+" is not complete:"+tt.tagName),ze=fe+1+Ve.length):Ve.match(/\s</)&&(Ve=Ve.replace(/[\s<].*/,""),z.error("end tag name: "+Ve+" maybe not complete"),ze=fe+1+Ve.length);var St=tt.localNSMap,Je=tt.tagName==Ve,at=Je||tt.tagName&&tt.tagName.toLowerCase()==Ve.toLowerCase();if(at){if(G.endElement(tt.uri,tt.localName,Ve),St)for(var li in St)Object.prototype.hasOwnProperty.call(St,li)&&G.endPrefixMapping(li);Je||z.fatalError("end tag name: "+Ve+" is not match the current start tagName:"+tt.tagName)}else pe.push(tt);ze++;break;case"?":ie&&X(fe),ze=M(v,fe,G);break;case"!":ie&&X(fe),ze=j(v,fe,G,z);break;default:ie&&X(fe);var Ge=new L,ci=pe[pe.length-1].currentNSMap,ze=I(v,fe,Ge,ci,se,z),Xi=Ge.length;if(!Ge.closed&&R(v,ze,Ge.tagName,ge)&&(Ge.closed=!0,V.nbsp||z.warning("unclosed xml attribute")),ie&&Xi){for(var gt=T(ie,{}),Et=0;Et<Xi;Et++){var be=Ge[Et];X(be.offset),be.locator=T(ie,{})}G.locator=gt,F(Ge,G,ci)&&pe.push(Ge),G.locator=ie}else F(Ge,G,ci)&&pe.push(Ge);s.isHTML(Ge.uri)&&!Ge.closed?ze=N(v,ze,Ge.tagName,se,G):ze++}}catch(Pe){if(Pe instanceof A)throw Pe;z.error("element parse error: "+Pe),ze=-1}ze>ye?ye=ze:te(Math.max(fe,ye)+1)}}function T(v,E){return E.lineNumber=v.lineNumber,E.columnNumber=v.columnNumber,E}function I(v,E,V,G,z,Q){function se(ie,pe,ge){V.attributeNames.hasOwnProperty(ie)&&Q.fatalError("Attribute "+ie+" redefined"),V.addValue(ie,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,z),ge)}for(var te,X,Z=++E,J=r;;){var ee=v.charAt(Z);switch(ee){case"=":if(J===n)te=v.slice(E,Z),J=u;else if(J===a)J=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(J===u||J===n)if(J===n&&(Q.warning('attribute value must after "="'),te=v.slice(E,Z)),E=Z+1,Z=v.indexOf(ee,E),Z>0)X=v.slice(E,Z),se(te,X,E-1),J=f;else throw new Error("attribute value no end '"+ee+"' match");else if(J==c)X=v.slice(E,Z),se(te,X,E),Q.warning('attribute "'+te+'" missed start quot('+ee+")!!"),E=Z+1,J=f;else throw new Error('attribute value must after "="');break;case"/":switch(J){case r:V.setTagName(v.slice(E,Z));case f:case g:case _:J=_,V.closed=!0;case c:case n:break;case a:V.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return Q.error("unexpected end of input"),J==r&&V.setTagName(v.slice(E,Z)),Z;case">":switch(J){case r:V.setTagName(v.slice(E,Z));case f:case g:case _:break;case c:case n:X=v.slice(E,Z),X.slice(-1)==="/"&&(V.closed=!0,X=X.slice(0,-1));case a:J===a&&(X=te),J==c?(Q.warning('attribute "'+X+'" missed quot(")!'),se(te,X,E)):((!s.isHTML(G[""])||!X.match(/^(?:disabled|checked|selected)$/i))&&Q.warning('attribute "'+X+'" missed value!! "'+X+'" instead!!'),se(X,X,E));break;case u:throw new Error("attribute value missed!!")}return Z;case"":ee=" ";default:if(ee<=" ")switch(J){case r:V.setTagName(v.slice(E,Z)),J=g;break;case n:te=v.slice(E,Z),J=a;break;case c:var X=v.slice(E,Z);Q.warning('attribute "'+X+'" missed quot(")!!'),se(te,X,E);case f:J=g;break}else switch(J){case a:V.tagName,(!s.isHTML(G[""])||!te.match(/^(?:disabled|checked|selected)$/i))&&Q.warning('attribute "'+te+'" missed value!! "'+te+'" instead2!!'),se(te,te,E),E=Z,J=n;break;case f:Q.warning('attribute space is required"'+te+'"!!');case g:J=n,E=Z;break;case u:J=c,E=Z;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}Z++}}function F(v,E,V){for(var G=v.tagName,z=null,ee=v.length;ee--;){var Q=v[ee],se=Q.qName,te=Q.value,ie=se.indexOf(":");if(ie>0)var X=Q.prefix=se.slice(0,ie),Z=se.slice(ie+1),J=X==="xmlns"&&Z;else Z=se,X=null,J=se==="xmlns"&&"";Q.localName=Z,J!==!1&&(z==null&&(z={},U(V,V={})),V[J]=z[J]=te,Q.uri=s.XMLNS,E.startPrefixMapping(J,te))}for(var ee=v.length;ee--;){Q=v[ee];var X=Q.prefix;X&&(X==="xml"&&(Q.uri=s.XML),X!=="xmlns"&&(Q.uri=V[X||""]))}var ie=G.indexOf(":");ie>0?(X=v.prefix=G.slice(0,ie),Z=v.localName=G.slice(ie+1)):(X=null,Z=v.localName=G);var pe=v.uri=V[X||""];if(E.startElement(pe,Z,G,v),v.closed){if(E.endElement(pe,Z,G),z)for(X in z)Object.prototype.hasOwnProperty.call(z,X)&&E.endPrefixMapping(X)}else return v.currentNSMap=V,v.localNSMap=z,!0}function N(v,E,V,G,z){if(/^(?:script|textarea)$/i.test(V)){var Q=v.indexOf("</"+V+">",E),se=v.substring(E+1,Q);if(/[&<]/.test(se))return/^script$/i.test(V)?(z.characters(se,0,se.length),Q):(se=se.replace(/&#?\w+;/g,G),z.characters(se,0,se.length),Q)}return E+1}function R(v,E,V,G){var z=G[V];return z==null&&(z=v.lastIndexOf("</"+V+">"),z<E&&(z=v.lastIndexOf("</"+V)),G[V]=z),z<E}function U(v,E){for(var V in v)Object.prototype.hasOwnProperty.call(v,V)&&(E[V]=v[V])}function j(v,E,V,G){var z=v.charAt(E+2);switch(z){case"-":if(v.charAt(E+3)==="-"){var Q=v.indexOf("-->",E+4);return Q>E?(V.comment(v,E+4,Q-E-4),Q+3):(G.error("Unclosed comment"),-1)}else return-1;default:if(v.substr(E+3,6)=="CDATA["){var Q=v.indexOf("]]>",E+9);return V.startCDATA(),V.characters(v,E+9,Q-E-9),V.endCDATA(),Q+3}var se=$(v,E),te=se.length;if(te>1&&/!doctype/i.test(se[0][0])){var X=se[1][0],Z=!1,J=!1;te>3&&(/^public$/i.test(se[2][0])?(Z=se[3][0],J=te>4&&se[4][0]):/^system$/i.test(se[2][0])&&(J=se[3][0]));var ee=se[te-1];return V.startDTD(X,Z,J),V.endDTD(),ee.index+ee[0].length}}return-1}function M(v,E,V){var G=v.indexOf("?>",E);if(G){var z=v.substring(E,G).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return z?(z[0].length,V.processingInstruction(z[1],z[2]),G+2):-1}return-1}function L(){this.attributeNames={}}L.prototype={setTagName:function(v){if(!i.test(v))throw new Error("invalid tagName:"+v);this.tagName=v},addValue:function(v,E,V){if(!i.test(v))throw new Error("invalid attribute:"+v);this.attributeNames[v]=this.length,this[this.length++]={qName:v,value:E,offset:V}},length:0,getLocalName:function(v){return this[v].localName},getLocator:function(v){return this[v].locator},getQName:function(v){return this[v].qName},getURI:function(v){return this[v].uri},getValue:function(v){return this[v].value}};function $(v,E){var V,G=[],z=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(z.lastIndex=E,z.exec(v);V=z.exec(v);)if(G.push(V),V[1])return G}return tn.XMLReader=S,tn.ParseError=A,tn}var bl;function Fg(){if(bl)return Zs;bl=1;var s=Rn(),e=Hc(),t=Mg(),i=Bg(),r=e.DOMImplementation,n=s.NAMESPACE,a=i.ParseError,u=i.XMLReader;function c(I){return I.replace(/\r[\n\u0085]/g,`
|
|
12
|
+
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const jg=" ",ka=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},qg=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},ct=function(s){const e={};if(!s)return e;const t=s.split(qg());let i=t.length,r;for(;i--;)t[i]!==""&&(r=/([^=]*)=(.*)/.exec(t[i]).slice(1),r[0]=r[0].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^\s+|\s+$/g,""),r[1]=r[1].replace(/^['"](.*)['"]$/g,"$1"),e[r[0]]=r[1]);return e},vl=s=>{const e=s.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class $g extends Io{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;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 u=a(e);return u===e?n:n.concat([u])},[e]).forEach(n=>{for(let a=0;a<this.customParsers.length;a++)if(this.customParsers[a].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){i=Ge(ka(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(i={type:"tag",tagType:"map"},t[1]){const a=ct(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=ka(a.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=ct(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=vl(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=ct(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=ct(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=ct(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=ct(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(jg)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=ct(t[1]),["DURATION"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["INDEPENDENT","GAP"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=ka(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=ct(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=ct(t[1]),["PART-TARGET"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=ct(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(i.attributes.hasOwnProperty(a)){i.attributes[a]=parseInt(i.attributes[a],10);const u=a==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[u]=i.attributes[a],delete i.attributes[a]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=ct(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseInt(i.attributes[a],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=ct(t[1]),["ID","CLASS"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=String(i.attributes[u]))}),["START-DATE","END-DATE"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=new Date(i.attributes[u]))}),["DURATION","PLANNED-DURATION"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["END-ON-NEXT"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/i.test(i.attributes[u]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=i.attributes[u].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const u in i.attributes){if(!a.test(u))continue;const l=/[0-9A-Fa-f]{6}/g.test(i.attributes[u]),f=/^\d+(\.\d+)?$/.test(i.attributes[u]);i.attributes[u]=l?i.attributes[u].toString(16):f?parseFloat(i.attributes[u]):String(i.attributes[u])}this.trigger("data",i);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){i={type:"tag",tagType:"content-steering"},i.attributes=ct(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=ct(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=vl(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){i={type:"tag",tagType:"define"},i.attributes=ct(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:r}){typeof i!="function"&&(i=n=>n),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:i(n),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const i=r=>e.test(r)?t(r):r;this.tagMappers.push(i)}}const Vg=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),yi=function(s){const e={};return Object.keys(s).forEach(function(t){e[Vg(t)]=s[t]}),e},Ia=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:i}=s;if(!e)return;const r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",u=t&&t*3,l=i&&i*2;t&&!e.hasOwnProperty(n)&&(e[n]=u,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${u}).`})),u&&e[n]<u&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${u})`}),e[n]=u),i&&!e.hasOwnProperty(a)&&(e[a]=i*3,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),i&&e[a]<l&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${l}).`}),e[a]=l)};class Hg extends Io{constructor(e={}){super(),this.lineStream=new Ug,this.parseStream=new $g,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,i=[];let r={},n,a,u=!1;const l=function(){},f={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},g="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let A=0,x=0;const L={};this.on("end",()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&n&&(r.map=n),!r.key&&a&&(r.key=a),!r.timeline&&typeof _=="number"&&(r.timeline=_),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(T){let I,M;if(t.manifest.definitions){for(const N in t.manifest.definitions)if(T.uri&&(T.uri=T.uri.replace(`{$${N}}`,t.manifest.definitions[N])),T.attributes)for(const O in T.attributes)typeof T.attributes[O]=="string"&&(T.attributes[O]=T.attributes[O].replace(`{$${N}}`,t.manifest.definitions[N]))}({tag(){({version(){T.version&&(this.manifest.version=T.version)},"allow-cache"(){this.manifest.allowCache=T.allowed,"allowed"in T||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const N={};"length"in T&&(r.byterange=N,N.length=T.length,"offset"in T||(T.offset=A)),"offset"in T&&(r.byterange=N,N.offset=T.offset),A=N.offset+N.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"})),T.title&&(r.title=T.title),T.duration>0&&(r.duration=T.duration),T.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!T.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(T.attributes.METHOD==="NONE"){a=null;return}if(!T.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(T.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:T.attributes};return}if(T.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:T.attributes.URI};return}if(T.attributes.KEYFORMAT===g){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(T.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(T.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),T.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(T.attributes.KEYID&&T.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:T.attributes.KEYFORMAT,keyId:T.attributes.KEYID.substring(2)},pssh:Qc(T.attributes.URI.split(",")[1])};return}T.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:T.attributes.METHOD||"AES-128",uri:T.attributes.URI},typeof T.attributes.IV<"u"&&(a.iv=T.attributes.IV)},"media-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+T.number});return}this.manifest.mediaSequence=T.number},"discontinuity-sequence"(){if(!isFinite(T.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+T.number});return}this.manifest.discontinuitySequence=T.number,_=T.number},"playlist-type"(){if(!/VOD|EVENT/.test(T.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+T.playlist});return}this.manifest.playlistType=T.playlistType},map(){n={},T.uri&&(n.uri=T.uri),T.byterange&&(n.byterange=T.byterange),a&&(n.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||f,!T.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),Ge(r.attributes,T.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||f,!(T.attributes&&T.attributes.TYPE&&T.attributes["GROUP-ID"]&&T.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const N=this.manifest.mediaGroups[T.attributes.TYPE];N[T.attributes["GROUP-ID"]]=N[T.attributes["GROUP-ID"]]||{},I=N[T.attributes["GROUP-ID"]],M={default:/yes/i.test(T.attributes.DEFAULT)},M.default?M.autoselect=!0:M.autoselect=/yes/i.test(T.attributes.AUTOSELECT),T.attributes.LANGUAGE&&(M.language=T.attributes.LANGUAGE),T.attributes.URI&&(M.uri=T.attributes.URI),T.attributes["INSTREAM-ID"]&&(M.instreamId=T.attributes["INSTREAM-ID"]),T.attributes.CHARACTERISTICS&&(M.characteristics=T.attributes.CHARACTERISTICS),T.attributes.FORCED&&(M.forced=/yes/i.test(T.attributes.FORCED)),I[T.attributes.NAME]=M},discontinuity(){_+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=T.dateTimeString,this.manifest.dateTimeObject=T.dateTimeObject),r.dateTimeString=T.dateTimeString,r.dateTimeObject=T.dateTimeObject;const{lastProgramDateTime:N}=this;this.lastProgramDateTime=new Date(T.dateTimeString).getTime(),N===null&&this.manifest.segments.reduceRight((O,j)=>(j.programDateTime=O-j.duration*1e3,j.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(T.duration)||T.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+T.duration});return}this.manifest.targetDuration=T.duration,Ia.call(this,this.manifest)},start(){if(!T.attributes||isNaN(T.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:T.attributes["TIME-OFFSET"],precise:T.attributes.PRECISE}},"cue-out"(){r.cueOut=T.data},"cue-out-cont"(){r.cueOutCont=T.data},"cue-in"(){r.cueIn=T.data},skip(){this.manifest.skip=yi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const N=this.manifest.segments.length,O=yi(T.attributes);r.parts=r.parts||[],r.parts.push(O),O.byterange&&(O.byterange.hasOwnProperty("offset")||(O.byterange.offset=x),x=O.byterange.offset+O.byterange.length);const j=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${j} for segment #${N}`,T.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((F,U)=>{F.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${U} lacks required attribute(s): LAST-PART`})})},"server-control"(){const N=this.manifest.serverControl=yi(T.attributes);N.hasOwnProperty("canBlockReload")||(N.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Ia.call(this,this.manifest),N.canSkipDateranges&&!N.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 N=this.manifest.segments.length,O=yi(T.attributes),j=O.type&&O.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(O),O.byterange&&(O.byterange.hasOwnProperty("offset")||(O.byterange.offset=j?x:0,j&&(x=O.byterange.offset+O.byterange.length)));const F=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${F} for segment #${N}`,T.attributes,["TYPE","URI"]),!!O.type)for(let U=0;U<r.preloadHints.length-1;U++){const R=r.preloadHints[U];R.type&&R.type===O.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${F} for segment #${N} has the same TYPE ${O.type} as preload hint #${U}`})}},"rendition-report"(){const N=yi(T.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(N);const O=this.manifest.renditionReports.length-1,j=["LAST-MSN","URI"];u&&j.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${O}`,T.attributes,j)},"part-inf"(){this.manifest.partInf=yi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",T.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Ia.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(yi(T.attributes));const N=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${N}`,T.attributes,["ID","START-DATE"]);const O=this.manifest.dateRanges[N];O.endDate&&O.startDate&&new Date(O.endDate)<new Date(O.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),O.duration&&O.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),O.plannedDuration&&O.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const j=!!O.endOnNext;if(j&&!O.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),j&&(O.duration||O.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),O.duration&&O.endDate){const U=O.startDate.getTime()+O.duration*1e3;this.manifest.dateRanges[N].endDate=new Date(U)}if(!L[O.id])L[O.id]=O;else{for(const U in L[O.id])if(O[U]&&JSON.stringify(L[O.id][U])!==JSON.stringify(O[U])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const F=this.manifest.dateRanges.findIndex(U=>U.id===O.id);this.manifest.dateRanges[F]=Ge(this.manifest.dateRanges[F],O),L[O.id]=Ge(L[O.id],O),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=yi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",T.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const N=(O,j)=>{if(O in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${O}`});return}this.manifest.definitions[O]=j};if("QUERYPARAM"in T.attributes){if("NAME"in T.attributes||"IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const O=this.params.get(T.attributes.QUERYPARAM);if(!O){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${T.attributes.QUERYPARAM}`});return}N(T.attributes.QUERYPARAM,decodeURIComponent(O));return}if("NAME"in T.attributes){if("IMPORT"in T.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in T.attributes)||typeof T.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${T.attributes.NAME}`});return}N(T.attributes.NAME,T.attributes.VALUE);return}if("IMPORT"in T.attributes){if(!this.mainDefinitions[T.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${T.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}N(T.attributes.IMPORT,this.mainDefinitions[T.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:T.attributes,uri:T.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",T.attributes,["BANDWIDTH","URI"])}}[T.tagType]||l).call(t)},uri(){r.uri=T.uri,i.push(r),this.manifest.targetDuration&&!("duration"in r)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),r.duration=this.manifest.targetDuration),a&&(r.key=a),r.timeline=_,n&&(r.map=n),x=0,this.lastProgramDateTime!==null&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=r.duration*1e3),r={}},comment(){},custom(){T.segment?(r.custom=r.custom||{},r.custom[T.customType]=T.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[T.customType]=T.data)}})[T.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,i){const r=[];i.forEach(function(n){t.hasOwnProperty(n)||r.push(n)}),r.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${r.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
13
|
+
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var $i={mp4:/^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,webm:/^(vp0?[89]|av0?1|opus|vorbis)/,ogg:/^(vp0?[89]|theora|flac|opus|vorbis)/,video:/^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,audio:/^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,text:/^(stpp.ttml.im1t)/,muxerVideo:/^(avc0?1)/,muxerAudio:/^(mp4a)/,muxerText:/a^/},zg=["video","audio","text"],bl=["Video","Audio","Text"],Jc=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,r){var n=("00"+Number(i).toString(16)).slice(-2),a=("00"+Number(r).toString(16)).slice(-2);return"avc1."+n+"00"+a})},Wt=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(r){r=r.trim();var n;zg.forEach(function(a){var u=$i[a].exec(r.toLowerCase());if(!(!u||u.length<=1)){n=a;var l=r.substring(0,u[1].length),f=r.replace(l,"");i.push({type:l,details:f,mediaType:a})}}),n||i.push({type:r,details:"",mediaType:"unknown"})}),i},Gg=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var r in i){var n=i[r];if(n.default&&n.playlists)return Wt(n.playlists[0].attributes.CODECS)}return null},Zc=function(e){return e===void 0&&(e=""),$i.audio.test(e.trim().toLowerCase())},Wg=function(e){return e===void 0&&(e=""),$i.text.test(e.trim().toLowerCase())},gs=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return Jc(n.trim())}),i="video";t.length===1&&Zc(t[0])?i="audio":t.length===1&&Wg(t[0])&&(i="application");var r="mp4";return t.every(function(n){return $i.mp4.test(n)})?r="mp4":t.every(function(n){return $i.webm.test(n)})?r="webm":t.every(function(n){return $i.ogg.test(n)})&&(r="ogg"),i+"/"+r+';codecs="'+e+'"'}},ur=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),D.MediaSource&&D.MediaSource.isTypeSupported&&D.MediaSource.isTypeSupported(gs(e))||t&&D.ManagedMediaSource&&D.ManagedMediaSource.isTypeSupported&&D.ManagedMediaSource.isTypeSupported(gs(e))||!1},Pa=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<bl.length;i++){var r=bl[i];if($i["muxer"+r].test(t))return!0}return!1})},xl="mp4a.40.2",Xg="avc1.4d400d",Kg=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Yg=/^application\/dash\+xml/i,ed=function(e){return Kg.test(e)?"hls":Yg.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},Qg=function(e){return e.toString(2).length},Jg=function(e){return Math.ceil(Qg(e)/8)},td=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Zg=function(e){return td(e)},he=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!Zg(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},st=D.BigInt||Number,eo=[st("0x1"),st("0x100"),st("0x10000"),st("0x1000000"),st("0x100000000"),st("0x10000000000"),st("0x1000000000000"),st("0x100000000000000"),st("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var e0=function(e,t){var i=t===void 0?{}:t,r=i.signed,n=r===void 0?!1:r,a=i.le,u=a===void 0?!1:a;e=he(e);var l=u?"reduce":"reduceRight",f=e[l]?e[l]:Array.prototype[l],g=f.call(e,function(A,x,L){var T=u?L:Math.abs(L+1-e.length);return A+st(x)*eo[T]},st(0));if(n){var _=eo[e.length]/st(2)-st(1);g=st(g),g>_&&(g-=_,g-=_,g-=st(2))}return Number(g)},t0=function(e,t){var i={},r=i.le,n=r===void 0?!1:r;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=st(e);for(var a=Jg(e),u=new Uint8Array(new ArrayBuffer(a)),l=0;l<a;l++){var f=n?l:Math.abs(l+1-u.length);u[f]=Number(e/eo[l]&st(255)),e<0&&(u[f]=Math.abs(~u[f]),u[f]-=l===0?1:2)}return u},id=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),r=0;r<e.length;r++)i[r]=e.charCodeAt(r);return i},i0=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(u){return u&&(u.byteLength||u.length)&&typeof u!="string"}),t.length<=1)return he(t[0]);var r=t.reduce(function(u,l,f){return u+(l.byteLength||l.length)},0),n=new Uint8Array(r),a=0;return t.forEach(function(u){u=he(u),n.set(u,a),a+=u.byteLength}),n},Be=function(e,t,i){var r=i===void 0?{}:i,n=r.offset,a=n===void 0?0:n,u=r.mask,l=u===void 0?[]:u;e=he(e),t=he(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(g,_){var A=l[_]?l[_]&e[a+_]:e[a+_];return g===A})},s0=function(e,t,i){t.forEach(function(r){for(var n in e.mediaGroups[r])for(var a in e.mediaGroups[r][n]){var u=e.mediaGroups[r][n][a];i(u,r,n,a)}})},Zs={},ni={},Mi={},Sl;function Nn(){if(Sl)return Mi;Sl=1;function s(n,a,u){if(u===void 0&&(u=Array.prototype),n&&typeof u.find=="function")return u.find.call(n,a);for(var l=0;l<n.length;l++)if(Object.prototype.hasOwnProperty.call(n,l)){var f=n[l];if(a.call(void 0,f,l,n))return f}}function e(n,a){return a===void 0&&(a=Object),a&&typeof a.freeze=="function"?a.freeze(n):n}function t(n,a){if(n===null||typeof n!="object")throw new TypeError("target is not an object");for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&(n[u]=a[u]);return n}var i=e({HTML:"text/html",isHTML:function(n){return n===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),r=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===r.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return Mi.assign=t,Mi.find=s,Mi.freeze=e,Mi.MIME_TYPE=i,Mi.NAMESPACE=r,Mi}var El;function sd(){if(El)return ni;El=1;var s=Nn(),e=s.find,t=s.NAMESPACE;function i(y){return y!==""}function r(y){return y?y.split(/[\t\n\f\r ]+/).filter(i):[]}function n(y,b){return y.hasOwnProperty(b)||(y[b]=!0),y}function a(y){if(!y)return[];var b=r(y);return Object.keys(b.reduce(n,{}))}function u(y){return function(b){return y&&y.indexOf(b)!==-1}}function l(y,b){for(var P in y)Object.prototype.hasOwnProperty.call(y,P)&&(b[P]=y[P])}function f(y,b){var P=y.prototype;if(!(P instanceof b)){let z=function(){};z.prototype=b.prototype,z=new z,l(P,z),y.prototype=P=z}P.constructor!=y&&(typeof y!="function"&&console.error("unknown Class:"+y),P.constructor=y)}var g={},_=g.ELEMENT_NODE=1,A=g.ATTRIBUTE_NODE=2,x=g.TEXT_NODE=3,L=g.CDATA_SECTION_NODE=4,T=g.ENTITY_REFERENCE_NODE=5,I=g.ENTITY_NODE=6,M=g.PROCESSING_INSTRUCTION_NODE=7,N=g.COMMENT_NODE=8,O=g.DOCUMENT_NODE=9,j=g.DOCUMENT_TYPE_NODE=10,F=g.DOCUMENT_FRAGMENT_NODE=11,U=g.NOTATION_NODE=12,R={},H={};R.INDEX_SIZE_ERR=(H[1]="Index size error",1),R.DOMSTRING_SIZE_ERR=(H[2]="DOMString size error",2);var v=R.HIERARCHY_REQUEST_ERR=(H[3]="Hierarchy request error",3);R.WRONG_DOCUMENT_ERR=(H[4]="Wrong document",4),R.INVALID_CHARACTER_ERR=(H[5]="Invalid character",5),R.NO_DATA_ALLOWED_ERR=(H[6]="No data allowed",6),R.NO_MODIFICATION_ALLOWED_ERR=(H[7]="No modification allowed",7);var E=R.NOT_FOUND_ERR=(H[8]="Not found",8);R.NOT_SUPPORTED_ERR=(H[9]="Not supported",9);var $=R.INUSE_ATTRIBUTE_ERR=(H[10]="Attribute in use",10);R.INVALID_STATE_ERR=(H[11]="Invalid state",11),R.SYNTAX_ERR=(H[12]="Syntax error",12),R.INVALID_MODIFICATION_ERR=(H[13]="Invalid modification",13),R.NAMESPACE_ERR=(H[14]="Invalid namespace",14),R.INVALID_ACCESS_ERR=(H[15]="Invalid access",15);function G(y,b){if(b instanceof Error)var P=b;else P=this,Error.call(this,H[y]),this.message=H[y],Error.captureStackTrace&&Error.captureStackTrace(this,G);return P.code=y,b&&(this.message=this.message+": "+b),P}G.prototype=Error.prototype,l(R,G);function V(){}V.prototype={length:0,item:function(y){return y>=0&&y<this.length?this[y]:null},toString:function(y,b){for(var P=[],z=0;z<this.length;z++)pi(this[z],P,y,b);return P.join("")},filter:function(y){return Array.prototype.filter.call(this,y)},indexOf:function(y){return Array.prototype.indexOf.call(this,y)}};function J(y,b){this._node=y,this._refresh=b,se(this)}function se(y){var b=y._node._inc||y._node.ownerDocument._inc;if(y._inc!==b){var P=y._refresh(y._node);if(kr(y,"length",P.length),!y.$$length||P.length<y.$$length)for(var z=P.length;z in y;z++)Object.prototype.hasOwnProperty.call(y,z)&&delete y[z];l(P,y),y._inc=b}}J.prototype.item=function(y){return se(this),this[y]||null},f(J,V);function ne(){}function Y(y,b){for(var P=y.length;P--;)if(y[P]===b)return P}function te(y,b,P,z){if(z?b[Y(b,z)]=P:b[b.length++]=P,y){P.ownerElement=y;var ae=y.ownerDocument;ae&&(z&&We(ae,y,z),ce(ae,y,P))}}function X(y,b,P){var z=Y(b,P);if(z>=0){for(var ae=b.length-1;z<ae;)b[z]=b[++z];if(b.length=ae,y){var me=y.ownerDocument;me&&(We(me,y,P),P.ownerElement=null)}}else throw new G(E,new Error(y.tagName+"@"+P))}ne.prototype={length:0,item:V.prototype.item,getNamedItem:function(y){for(var b=this.length;b--;){var P=this[b];if(P.nodeName==y)return P}},setNamedItem:function(y){var b=y.ownerElement;if(b&&b!=this._ownerElement)throw new G($);var P=this.getNamedItem(y.nodeName);return te(this._ownerElement,this,y,P),P},setNamedItemNS:function(y){var b=y.ownerElement,P;if(b&&b!=this._ownerElement)throw new G($);return P=this.getNamedItemNS(y.namespaceURI,y.localName),te(this._ownerElement,this,y,P),P},removeNamedItem:function(y){var b=this.getNamedItem(y);return X(this._ownerElement,this,b),b},removeNamedItemNS:function(y,b){var P=this.getNamedItemNS(y,b);return X(this._ownerElement,this,P),P},getNamedItemNS:function(y,b){for(var P=this.length;P--;){var z=this[P];if(z.localName==b&&z.namespaceURI==y)return z}return null}};function Z(){}Z.prototype={hasFeature:function(y,b){return!0},createDocument:function(y,b,P){var z=new _e;if(z.implementation=this,z.childNodes=new V,z.doctype=P||null,P&&z.appendChild(P),b){var ae=z.createElementNS(y,b);z.appendChild(ae)}return z},createDocumentType:function(y,b,P){var z=new fi;return z.name=y,z.nodeName=y,z.publicId=b||"",z.systemId=P||"",z}};function ie(){}ie.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(y,b){return wt(this,y,b)},replaceChild:function(y,b){wt(this,y,b,Tt),b&&this.removeChild(b)},removeChild:function(y){return Ue(this,y)},appendChild:function(y){return this.insertBefore(y,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(y){return Ms(this.ownerDocument||this,this,y)},normalize:function(){for(var y=this.firstChild;y;){var b=y.nextSibling;b&&b.nodeType==x&&y.nodeType==x?(this.removeChild(b),y.appendData(b.data)):(y.normalize(),y=b)}},isSupported:function(y,b){return this.ownerDocument.implementation.hasFeature(y,b)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(y){for(var b=this;b;){var P=b._nsMap;if(P){for(var z in P)if(Object.prototype.hasOwnProperty.call(P,z)&&P[z]===y)return z}b=b.nodeType==A?b.ownerDocument:b.parentNode}return null},lookupNamespaceURI:function(y){for(var b=this;b;){var P=b._nsMap;if(P&&Object.prototype.hasOwnProperty.call(P,y))return P[y];b=b.nodeType==A?b.ownerDocument:b.parentNode}return null},isDefaultNamespace:function(y){var b=this.lookupPrefix(y);return b==null}};function pe(y){return y=="<"&&"<"||y==">"&&">"||y=="&"&&"&"||y=='"'&&"""||"&#"+y.charCodeAt()+";"}l(g,ie),l(g,ie.prototype);function ge(y,b){if(b(y))return!0;if(y=y.firstChild)do if(ge(y,b))return!0;while(y=y.nextSibling)}function _e(){this.ownerDocument=this}function ce(y,b,P){y&&y._inc++;var z=P.namespaceURI;z===t.XMLNS&&(b._nsMap[P.prefix?P.localName:""]=P.value)}function We(y,b,P,z){y&&y._inc++;var ae=P.namespaceURI;ae===t.XMLNS&&delete b._nsMap[P.prefix?P.localName:""]}function Ye(y,b,P){if(y&&y._inc){y._inc++;var z=b.childNodes;if(P)z[z.length++]=P;else{for(var ae=b.firstChild,me=0;ae;)z[me++]=ae,ae=ae.nextSibling;z.length=me,delete z[z.length]}}}function Ue(y,b){var P=b.previousSibling,z=b.nextSibling;return P?P.nextSibling=z:y.firstChild=z,z?z.previousSibling=P:y.lastChild=P,b.parentNode=null,b.previousSibling=null,b.nextSibling=null,Ye(y.ownerDocument,y),b}function Qe(y){return y&&(y.nodeType===ie.DOCUMENT_NODE||y.nodeType===ie.DOCUMENT_FRAGMENT_NODE||y.nodeType===ie.ELEMENT_NODE)}function pt(y){return y&&(it(y)||xe(y)||Xe(y)||y.nodeType===ie.DOCUMENT_FRAGMENT_NODE||y.nodeType===ie.COMMENT_NODE||y.nodeType===ie.PROCESSING_INSTRUCTION_NODE)}function Xe(y){return y&&y.nodeType===ie.DOCUMENT_TYPE_NODE}function it(y){return y&&y.nodeType===ie.ELEMENT_NODE}function xe(y){return y&&y.nodeType===ie.TEXT_NODE}function Se(y,b){var P=y.childNodes||[];if(e(P,it)||Xe(b))return!1;var z=e(P,Xe);return!(b&&z&&P.indexOf(z)>P.indexOf(b))}function rt(y,b){var P=y.childNodes||[];function z(me){return it(me)&&me!==b}if(e(P,z))return!1;var ae=e(P,Xe);return!(b&&ae&&P.indexOf(ae)>P.indexOf(b))}function $e(y,b,P){if(!Qe(y))throw new G(v,"Unexpected parent node type "+y.nodeType);if(P&&P.parentNode!==y)throw new G(E,"child not in parent");if(!pt(b)||Xe(b)&&y.nodeType!==ie.DOCUMENT_NODE)throw new G(v,"Unexpected node type "+b.nodeType+" for parent node type "+y.nodeType)}function Di(y,b,P){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var me=ae.filter(it);if(me.length>1||e(ae,xe))throw new G(v,"More than one element or text in fragment");if(me.length===1&&!Se(y,P))throw new G(v,"Element in fragment can not be inserted before doctype")}if(it(b)&&!Se(y,P))throw new G(v,"Only one element can be added and only after doctype");if(Xe(b)){if(e(z,Xe))throw new G(v,"Only one doctype is allowed");var Ie=e(z,it);if(P&&z.indexOf(Ie)<z.indexOf(P))throw new G(v,"Doctype can only be inserted before an element");if(!P&&Ie)throw new G(v,"Doctype can not be appended since element is present")}}function Tt(y,b,P){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===ie.DOCUMENT_FRAGMENT_NODE){var me=ae.filter(it);if(me.length>1||e(ae,xe))throw new G(v,"More than one element or text in fragment");if(me.length===1&&!rt(y,P))throw new G(v,"Element in fragment can not be inserted before doctype")}if(it(b)&&!rt(y,P))throw new G(v,"Only one element can be added and only after doctype");if(Xe(b)){if(e(z,function(vt){return Xe(vt)&&vt!==P}))throw new G(v,"Only one doctype is allowed");var Ie=e(z,it);if(P&&z.indexOf(Ie)<z.indexOf(P))throw new G(v,"Doctype can only be inserted before an element")}}function wt(y,b,P,z){$e(y,b,P),y.nodeType===ie.DOCUMENT_NODE&&(z||Di)(y,b,P);var ae=b.parentNode;if(ae&&ae.removeChild(b),b.nodeType===F){var me=b.firstChild;if(me==null)return b;var Ie=b.lastChild}else me=Ie=b;var nt=P?P.previousSibling:y.lastChild;me.previousSibling=nt,Ie.nextSibling=P,nt?nt.nextSibling=me:y.firstChild=me,P==null?y.lastChild=Ie:P.previousSibling=Ie;do{me.parentNode=y;var vt=y.ownerDocument||y;be(me,vt)}while(me!==Ie&&(me=me.nextSibling));return Ye(y.ownerDocument||y,y),b.nodeType==F&&(b.firstChild=b.lastChild=null),b}function be(y,b){if(y.ownerDocument!==b){if(y.ownerDocument=b,y.nodeType===_&&y.attributes)for(var P=0;P<y.attributes.length;P++){var z=y.attributes.item(P);z&&(z.ownerDocument=b)}for(var ae=y.firstChild;ae;)be(ae,b),ae=ae.nextSibling}}function Oe(y,b){b.parentNode&&b.parentNode.removeChild(b),b.parentNode=y,b.previousSibling=y.lastChild,b.nextSibling=null,b.previousSibling?b.previousSibling.nextSibling=b:y.firstChild=b,y.lastChild=b,Ye(y.ownerDocument,y,b);var P=y.ownerDocument||y;return be(b,P),b}_e.prototype={nodeName:"#document",nodeType:O,doctype:null,documentElement:null,_inc:1,insertBefore:function(y,b){if(y.nodeType==F){for(var P=y.firstChild;P;){var z=P.nextSibling;this.insertBefore(P,b),P=z}return y}return wt(this,y,b),be(y,this),this.documentElement===null&&y.nodeType===_&&(this.documentElement=y),y},removeChild:function(y){return this.documentElement==y&&(this.documentElement=null),Ue(this,y)},replaceChild:function(y,b){wt(this,y,b,Tt),be(y,this),b&&this.removeChild(b),it(y)&&(this.documentElement=y)},importNode:function(y,b){return Dr(this,y,b)},getElementById:function(y){var b=null;return ge(this.documentElement,function(P){if(P.nodeType==_&&P.getAttribute("id")==y)return b=P,!0}),b},getElementsByClassName:function(y){var b=a(y);return new J(this,function(P){var z=[];return b.length>0&&ge(P.documentElement,function(ae){if(ae!==P&&ae.nodeType===_){var me=ae.getAttribute("class");if(me){var Ie=y===me;if(!Ie){var nt=a(me);Ie=b.every(u(nt))}Ie&&z.push(ae)}}}),z})},createElement:function(y){var b=new Ne;b.ownerDocument=this,b.nodeName=y,b.tagName=y,b.localName=y,b.childNodes=new V;var P=b.attributes=new ne;return P._ownerElement=b,b},createDocumentFragment:function(){var y=new Ce;return y.ownerDocument=this,y.childNodes=new V,y},createTextNode:function(y){var b=new ki;return b.ownerDocument=this,b.appendData(y),b},createComment:function(y){var b=new Ii;return b.ownerDocument=this,b.appendData(y),b},createCDATASection:function(y){var b=new hi;return b.ownerDocument=this,b.appendData(y),b},createProcessingInstruction:function(y,b){var P=new Rs;return P.ownerDocument=this,P.tagName=P.nodeName=P.target=y,P.nodeValue=P.data=b,P},createAttribute:function(y){var b=new di;return b.ownerDocument=this,b.name=y,b.nodeName=y,b.localName=y,b.specified=!0,b},createEntityReference:function(y){var b=new Ki;return b.ownerDocument=this,b.nodeName=y,b},createElementNS:function(y,b){var P=new Ne,z=b.split(":"),ae=P.attributes=new ne;return P.childNodes=new V,P.ownerDocument=this,P.nodeName=b,P.tagName=b,P.namespaceURI=y,z.length==2?(P.prefix=z[0],P.localName=z[1]):P.localName=b,ae._ownerElement=P,P},createAttributeNS:function(y,b){var P=new di,z=b.split(":");return P.ownerDocument=this,P.nodeName=b,P.name=b,P.namespaceURI=y,P.specified=!0,z.length==2?(P.prefix=z[0],P.localName=z[1]):P.localName=b,P}},f(_e,ie);function Ne(){this._nsMap={}}Ne.prototype={nodeType:_,hasAttribute:function(y){return this.getAttributeNode(y)!=null},getAttribute:function(y){var b=this.getAttributeNode(y);return b&&b.value||""},getAttributeNode:function(y){return this.attributes.getNamedItem(y)},setAttribute:function(y,b){var P=this.ownerDocument.createAttribute(y);P.value=P.nodeValue=""+b,this.setAttributeNode(P)},removeAttribute:function(y){var b=this.getAttributeNode(y);b&&this.removeAttributeNode(b)},appendChild:function(y){return y.nodeType===F?this.insertBefore(y,null):Oe(this,y)},setAttributeNode:function(y){return this.attributes.setNamedItem(y)},setAttributeNodeNS:function(y){return this.attributes.setNamedItemNS(y)},removeAttributeNode:function(y){return this.attributes.removeNamedItem(y.nodeName)},removeAttributeNS:function(y,b){var P=this.getAttributeNodeNS(y,b);P&&this.removeAttributeNode(P)},hasAttributeNS:function(y,b){return this.getAttributeNodeNS(y,b)!=null},getAttributeNS:function(y,b){var P=this.getAttributeNodeNS(y,b);return P&&P.value||""},setAttributeNS:function(y,b,P){var z=this.ownerDocument.createAttributeNS(y,b);z.value=z.nodeValue=""+P,this.setAttributeNode(z)},getAttributeNodeNS:function(y,b){return this.attributes.getNamedItemNS(y,b)},getElementsByTagName:function(y){return new J(this,function(b){var P=[];return ge(b,function(z){z!==b&&z.nodeType==_&&(y==="*"||z.tagName==y)&&P.push(z)}),P})},getElementsByTagNameNS:function(y,b){return new J(this,function(P){var z=[];return ge(P,function(ae){ae!==P&&ae.nodeType===_&&(y==="*"||ae.namespaceURI===y)&&(b==="*"||ae.localName==b)&&z.push(ae)}),z})}},_e.prototype.getElementsByTagName=Ne.prototype.getElementsByTagName,_e.prototype.getElementsByTagNameNS=Ne.prototype.getElementsByTagNameNS,f(Ne,ie);function di(){}di.prototype.nodeType=A,f(di,ie);function ii(){}ii.prototype={data:"",substringData:function(y,b){return this.data.substring(y,y+b)},appendData:function(y){y=this.data+y,this.nodeValue=this.data=y,this.length=y.length},insertData:function(y,b){this.replaceData(y,0,b)},appendChild:function(y){throw new Error(H[v])},deleteData:function(y,b){this.replaceData(y,b,"")},replaceData:function(y,b,P){var z=this.data.substring(0,y),ae=this.data.substring(y+b);P=z+P+ae,this.nodeValue=this.data=P,this.length=P.length}},f(ii,ie);function ki(){}ki.prototype={nodeName:"#text",nodeType:x,splitText:function(y){var b=this.data,P=b.substring(y);b=b.substring(0,y),this.data=this.nodeValue=b,this.length=b.length;var z=this.ownerDocument.createTextNode(P);return this.parentNode&&this.parentNode.insertBefore(z,this.nextSibling),z}},f(ki,ii);function Ii(){}Ii.prototype={nodeName:"#comment",nodeType:N},f(Ii,ii);function hi(){}hi.prototype={nodeName:"#cdata-section",nodeType:L},f(hi,ii);function fi(){}fi.prototype.nodeType=j,f(fi,ie);function Ls(){}Ls.prototype.nodeType=U,f(Ls,ie);function Os(){}Os.prototype.nodeType=I,f(Os,ie);function Ki(){}Ki.prototype.nodeType=T,f(Ki,ie);function Ce(){}Ce.prototype.nodeName="#document-fragment",Ce.prototype.nodeType=F,f(Ce,ie);function Rs(){}Rs.prototype.nodeType=M,f(Rs,ie);function Pi(){}Pi.prototype.serializeToString=function(y,b,P){return wr.call(y,b,P)},ie.prototype.toString=wr;function wr(y,b){var P=[],z=this.nodeType==9&&this.documentElement||this,ae=z.prefix,me=z.namespaceURI;if(me&&ae==null){var ae=z.lookupPrefix(me);if(ae==null)var Ie=[{namespace:me,prefix:null}]}return pi(this,P,y,b,Ie),P.join("")}function Ar(y,b,P){var z=y.prefix||"",ae=y.namespaceURI;if(!ae||z==="xml"&&ae===t.XML||ae===t.XMLNS)return!1;for(var me=P.length;me--;){var Ie=P[me];if(Ie.prefix===z)return Ie.namespace!==ae}return!0}function Ns(y,b,P){y.push(" ",b,'="',P.replace(/[<>&"\t\n\r]/g,pe),'"')}function pi(y,b,P,z,ae){if(ae||(ae=[]),z)if(y=z(y),y){if(typeof y=="string"){b.push(y);return}}else return;switch(y.nodeType){case _:var me=y.attributes,Ie=me.length,Pe=y.firstChild,nt=y.tagName;P=t.isHTML(y.namespaceURI)||P;var vt=nt;if(!P&&!y.prefix&&y.namespaceURI){for(var Vt,At=0;At<me.length;At++)if(me.item(At).name==="xmlns"){Vt=me.item(At).value;break}if(!Vt)for(var Nt=ae.length-1;Nt>=0;Nt--){var Dt=ae[Nt];if(Dt.prefix===""&&Dt.namespace===y.namespaceURI){Vt=Dt.namespace;break}}if(Vt!==y.namespaceURI)for(var Nt=ae.length-1;Nt>=0;Nt--){var Dt=ae[Nt];if(Dt.namespace===y.namespaceURI){Dt.prefix&&(vt=Dt.prefix+":"+nt);break}}}b.push("<",vt);for(var Ve=0;Ve<Ie;Ve++){var kt=me.item(Ve);kt.prefix=="xmlns"?ae.push({prefix:kt.localName,namespace:kt.value}):kt.nodeName=="xmlns"&&ae.push({prefix:"",namespace:kt.value})}for(var Ve=0;Ve<Ie;Ve++){var kt=me.item(Ve);if(Ar(kt,P,ae)){var si=kt.prefix||"",Ht=kt.namespaceURI;Ns(b,si?"xmlns:"+si:"xmlns",Ht),ae.push({prefix:si,namespace:Ht})}pi(kt,b,P,z,ae)}if(nt===vt&&Ar(y,P,ae)){var si=y.prefix||"",Ht=y.namespaceURI;Ns(b,si?"xmlns:"+si:"xmlns",Ht),ae.push({prefix:si,namespace:Ht})}if(Pe||P&&!/^(?:meta|link|img|br|hr|input)$/i.test(nt)){if(b.push(">"),P&&/^script$/i.test(nt))for(;Pe;)Pe.data?b.push(Pe.data):pi(Pe,b,P,z,ae.slice()),Pe=Pe.nextSibling;else for(;Pe;)pi(Pe,b,P,z,ae.slice()),Pe=Pe.nextSibling;b.push("</",vt,">")}else b.push("/>");return;case O:case F:for(var Pe=y.firstChild;Pe;)pi(Pe,b,P,z,ae.slice()),Pe=Pe.nextSibling;return;case A:return Ns(b,y.name,y.value);case x:return b.push(y.data.replace(/[<&>]/g,pe));case L:return b.push("<![CDATA[",y.data,"]]>");case N:return b.push("<!--",y.data,"-->");case j:var Li=y.publicId,Ee=y.systemId;if(b.push("<!DOCTYPE ",y.name),Li)b.push(" PUBLIC ",Li),Ee&&Ee!="."&&b.push(" ",Ee),b.push(">");else if(Ee&&Ee!=".")b.push(" SYSTEM ",Ee,">");else{var Ir=y.internalSubset;Ir&&b.push(" [",Ir,"]"),b.push(">")}return;case M:return b.push("<?",y.target," ",y.data,"?>");case T:return b.push("&",y.nodeName,";");default:b.push("??",y.nodeName)}}function Dr(y,b,P){var z;switch(b.nodeType){case _:z=b.cloneNode(!1),z.ownerDocument=y;case F:break;case A:P=!0;break}if(z||(z=b.cloneNode(!1)),z.ownerDocument=y,z.parentNode=null,P)for(var ae=b.firstChild;ae;)z.appendChild(Dr(y,ae,P)),ae=ae.nextSibling;return z}function Ms(y,b,P){var z=new b.constructor;for(var ae in b)if(Object.prototype.hasOwnProperty.call(b,ae)){var me=b[ae];typeof me!="object"&&me!=z[ae]&&(z[ae]=me)}switch(b.childNodes&&(z.childNodes=new V),z.ownerDocument=y,z.nodeType){case _:var Ie=b.attributes,nt=z.attributes=new ne,vt=Ie.length;nt._ownerElement=z;for(var Vt=0;Vt<vt;Vt++)z.setAttributeNode(Ms(y,Ie.item(Vt),!0));break;case A:P=!0}if(P)for(var At=b.firstChild;At;)z.appendChild(Ms(y,At,P)),At=At.nextSibling;return z}function kr(y,b,P){y[b]=P}try{if(Object.defineProperty){let y=function(b){switch(b.nodeType){case _:case F:var P=[];for(b=b.firstChild;b;)b.nodeType!==7&&b.nodeType!==8&&P.push(y(b)),b=b.nextSibling;return P.join("");default:return b.nodeValue}};Object.defineProperty(J.prototype,"length",{get:function(){return se(this),this.$$length}}),Object.defineProperty(ie.prototype,"textContent",{get:function(){return y(this)},set:function(b){switch(this.nodeType){case _:case F:for(;this.firstChild;)this.removeChild(this.firstChild);(b||String(b))&&this.appendChild(this.ownerDocument.createTextNode(b));break;default:this.data=b,this.value=b,this.nodeValue=b}}}),kr=function(b,P,z){b["$$"+P]=z}}}catch{}return ni.DocumentType=fi,ni.DOMException=G,ni.DOMImplementation=Z,ni.Element=Ne,ni.Node=ie,ni.NodeList=V,ni.XMLSerializer=Pi,ni}var er={},La={},Cl;function r0(){return Cl||(Cl=1,(function(s){var e=Nn().freeze;s.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),s.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
14
|
+
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),s.entityMap=s.HTML_ENTITIES})(La)),La}var tn={},wl;function n0(){if(wl)return tn;wl=1;var s=Nn().NAMESPACE,e=/[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]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),r=0,n=1,a=2,u=3,l=4,f=5,g=6,_=7;function A(v,E){this.message=v,this.locator=E,Error.captureStackTrace&&Error.captureStackTrace(this,A)}A.prototype=new Error,A.prototype.name=A.name;function x(){}x.prototype={parse:function(v,E,$){var G=this.domBuilder;G.startDocument(),j(E,E={}),L(v,E,$,G,this.errorHandler),G.endDocument()}};function L(v,E,$,G,V){function J(Oe){if(Oe>65535){Oe-=65536;var Ne=55296+(Oe>>10),di=56320+(Oe&1023);return String.fromCharCode(Ne,di)}else return String.fromCharCode(Oe)}function se(Oe){var Ne=Oe.slice(1,-1);return Object.hasOwnProperty.call($,Ne)?$[Ne]:Ne.charAt(0)==="#"?J(parseInt(Ne.substr(1).replace("x","0x"))):(V.error("entity not found:"+Oe),Oe)}function ne(Oe){if(Oe>_e){var Ne=v.substring(_e,Oe).replace(/&#?\w+;/g,se);ie&&Y(_e),G.characters(Ne,0,Oe-_e),_e=Oe}}function Y(Oe,Ne){for(;Oe>=X&&(Ne=Z.exec(v));)te=Ne.index,X=te+Ne[0].length,ie.lineNumber++;ie.columnNumber=Oe-te+1}for(var te=0,X=0,Z=/.*(?:\r\n?|\n)|.*$/g,ie=G.locator,pe=[{currentNSMap:E}],ge={},_e=0;;){try{var ce=v.indexOf("<",_e);if(ce<0){if(!v.substr(_e).match(/^\s*$/)){var We=G.doc,Ye=We.createTextNode(v.substr(_e));We.appendChild(Ye),G.currentElement=Ye}return}switch(ce>_e&&ne(ce),v.charAt(ce+1)){case"/":var $e=v.indexOf(">",ce+3),Ue=v.substring(ce+2,$e).replace(/[ \t\n\r]+$/g,""),Qe=pe.pop();$e<0?(Ue=v.substring(ce+2).replace(/[\s<].*/,""),V.error("end tag name: "+Ue+" is not complete:"+Qe.tagName),$e=ce+1+Ue.length):Ue.match(/\s</)&&(Ue=Ue.replace(/[\s<].*/,""),V.error("end tag name: "+Ue+" maybe not complete"),$e=ce+1+Ue.length);var pt=Qe.localNSMap,Xe=Qe.tagName==Ue,it=Xe||Qe.tagName&&Qe.tagName.toLowerCase()==Ue.toLowerCase();if(it){if(G.endElement(Qe.uri,Qe.localName,Ue),pt)for(var xe in pt)Object.prototype.hasOwnProperty.call(pt,xe)&&G.endPrefixMapping(xe);Xe||V.fatalError("end tag name: "+Ue+" is not match the current start tagName:"+Qe.tagName)}else pe.push(Qe);$e++;break;case"?":ie&&Y(ce),$e=U(v,ce,G);break;case"!":ie&&Y(ce),$e=F(v,ce,G,V);break;default:ie&&Y(ce);var Se=new R,rt=pe[pe.length-1].currentNSMap,$e=I(v,ce,Se,rt,se,V),Di=Se.length;if(!Se.closed&&O(v,$e,Se.tagName,ge)&&(Se.closed=!0,$.nbsp||V.warning("unclosed xml attribute")),ie&&Di){for(var Tt=T(ie,{}),wt=0;wt<Di;wt++){var be=Se[wt];Y(be.offset),be.locator=T(ie,{})}G.locator=Tt,M(Se,G,rt)&&pe.push(Se),G.locator=ie}else M(Se,G,rt)&&pe.push(Se);s.isHTML(Se.uri)&&!Se.closed?$e=N(v,$e,Se.tagName,se,G):$e++}}catch(Oe){if(Oe instanceof A)throw Oe;V.error("element parse error: "+Oe),$e=-1}$e>_e?_e=$e:ne(Math.max(ce,_e)+1)}}function T(v,E){return E.lineNumber=v.lineNumber,E.columnNumber=v.columnNumber,E}function I(v,E,$,G,V,J){function se(ie,pe,ge){$.attributeNames.hasOwnProperty(ie)&&J.fatalError("Attribute "+ie+" redefined"),$.addValue(ie,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,V),ge)}for(var ne,Y,te=++E,X=r;;){var Z=v.charAt(te);switch(Z){case"=":if(X===n)ne=v.slice(E,te),X=u;else if(X===a)X=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(X===u||X===n)if(X===n&&(J.warning('attribute value must after "="'),ne=v.slice(E,te)),E=te+1,te=v.indexOf(Z,E),te>0)Y=v.slice(E,te),se(ne,Y,E-1),X=f;else throw new Error("attribute value no end '"+Z+"' match");else if(X==l)Y=v.slice(E,te),se(ne,Y,E),J.warning('attribute "'+ne+'" missed start quot('+Z+")!!"),E=te+1,X=f;else throw new Error('attribute value must after "="');break;case"/":switch(X){case r:$.setTagName(v.slice(E,te));case f:case g:case _:X=_,$.closed=!0;case l:case n:break;case a:$.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return J.error("unexpected end of input"),X==r&&$.setTagName(v.slice(E,te)),te;case">":switch(X){case r:$.setTagName(v.slice(E,te));case f:case g:case _:break;case l:case n:Y=v.slice(E,te),Y.slice(-1)==="/"&&($.closed=!0,Y=Y.slice(0,-1));case a:X===a&&(Y=ne),X==l?(J.warning('attribute "'+Y+'" missed quot(")!'),se(ne,Y,E)):((!s.isHTML(G[""])||!Y.match(/^(?:disabled|checked|selected)$/i))&&J.warning('attribute "'+Y+'" missed value!! "'+Y+'" instead!!'),se(Y,Y,E));break;case u:throw new Error("attribute value missed!!")}return te;case"":Z=" ";default:if(Z<=" ")switch(X){case r:$.setTagName(v.slice(E,te)),X=g;break;case n:ne=v.slice(E,te),X=a;break;case l:var Y=v.slice(E,te);J.warning('attribute "'+Y+'" missed quot(")!!'),se(ne,Y,E);case f:X=g;break}else switch(X){case a:$.tagName,(!s.isHTML(G[""])||!ne.match(/^(?:disabled|checked|selected)$/i))&&J.warning('attribute "'+ne+'" missed value!! "'+ne+'" instead2!!'),se(ne,ne,E),E=te,X=n;break;case f:J.warning('attribute space is required"'+ne+'"!!');case g:X=n,E=te;break;case u:X=l,E=te;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}te++}}function M(v,E,$){for(var G=v.tagName,V=null,Z=v.length;Z--;){var J=v[Z],se=J.qName,ne=J.value,ie=se.indexOf(":");if(ie>0)var Y=J.prefix=se.slice(0,ie),te=se.slice(ie+1),X=Y==="xmlns"&&te;else te=se,Y=null,X=se==="xmlns"&&"";J.localName=te,X!==!1&&(V==null&&(V={},j($,$={})),$[X]=V[X]=ne,J.uri=s.XMLNS,E.startPrefixMapping(X,ne))}for(var Z=v.length;Z--;){J=v[Z];var Y=J.prefix;Y&&(Y==="xml"&&(J.uri=s.XML),Y!=="xmlns"&&(J.uri=$[Y||""]))}var ie=G.indexOf(":");ie>0?(Y=v.prefix=G.slice(0,ie),te=v.localName=G.slice(ie+1)):(Y=null,te=v.localName=G);var pe=v.uri=$[Y||""];if(E.startElement(pe,te,G,v),v.closed){if(E.endElement(pe,te,G),V)for(Y in V)Object.prototype.hasOwnProperty.call(V,Y)&&E.endPrefixMapping(Y)}else return v.currentNSMap=$,v.localNSMap=V,!0}function N(v,E,$,G,V){if(/^(?:script|textarea)$/i.test($)){var J=v.indexOf("</"+$+">",E),se=v.substring(E+1,J);if(/[&<]/.test(se))return/^script$/i.test($)?(V.characters(se,0,se.length),J):(se=se.replace(/&#?\w+;/g,G),V.characters(se,0,se.length),J)}return E+1}function O(v,E,$,G){var V=G[$];return V==null&&(V=v.lastIndexOf("</"+$+">"),V<E&&(V=v.lastIndexOf("</"+$)),G[$]=V),V<E}function j(v,E){for(var $ in v)Object.prototype.hasOwnProperty.call(v,$)&&(E[$]=v[$])}function F(v,E,$,G){var V=v.charAt(E+2);switch(V){case"-":if(v.charAt(E+3)==="-"){var J=v.indexOf("-->",E+4);return J>E?($.comment(v,E+4,J-E-4),J+3):(G.error("Unclosed comment"),-1)}else return-1;default:if(v.substr(E+3,6)=="CDATA["){var J=v.indexOf("]]>",E+9);return $.startCDATA(),$.characters(v,E+9,J-E-9),$.endCDATA(),J+3}var se=H(v,E),ne=se.length;if(ne>1&&/!doctype/i.test(se[0][0])){var Y=se[1][0],te=!1,X=!1;ne>3&&(/^public$/i.test(se[2][0])?(te=se[3][0],X=ne>4&&se[4][0]):/^system$/i.test(se[2][0])&&(X=se[3][0]));var Z=se[ne-1];return $.startDTD(Y,te,X),$.endDTD(),Z.index+Z[0].length}}return-1}function U(v,E,$){var G=v.indexOf("?>",E);if(G){var V=v.substring(E,G).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return V?(V[0].length,$.processingInstruction(V[1],V[2]),G+2):-1}return-1}function R(){this.attributeNames={}}R.prototype={setTagName:function(v){if(!i.test(v))throw new Error("invalid tagName:"+v);this.tagName=v},addValue:function(v,E,$){if(!i.test(v))throw new Error("invalid attribute:"+v);this.attributeNames[v]=this.length,this[this.length++]={qName:v,value:E,offset:$}},length:0,getLocalName:function(v){return this[v].localName},getLocator:function(v){return this[v].locator},getQName:function(v){return this[v].qName},getURI:function(v){return this[v].uri},getValue:function(v){return this[v].value}};function H(v,E){var $,G=[],V=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(V.lastIndex=E,V.exec(v);$=V.exec(v);)if(G.push($),$[1])return G}return tn.XMLReader=x,tn.ParseError=A,tn}var Al;function a0(){if(Al)return er;Al=1;var s=Nn(),e=sd(),t=r0(),i=n0(),r=e.DOMImplementation,n=s.NAMESPACE,a=i.ParseError,u=i.XMLReader;function l(I){return I.replace(/\r[\n\u0085]/g,`
|
|
15
15
|
`).replace(/[\r\u0085\u2028]/g,`
|
|
16
|
-
`)}function f(I){this.options=I||{locator:{}}}f.prototype.parseFromString=function(I,
|
|
17
|
-
@`+(I.systemId||"")+"#[line:"+I.lineNumber+",col:"+I.columnNumber+"]"}function O(I,F,N){return typeof I=="string"?I.substr(F,N):I.length>=F+N||F?new java.lang.String(I,F,N)+"":I}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(I){_.prototype[I]=function(){return null}});function T(I,F){I.currentElement?I.currentElement.appendChild(F):I.doc.appendChild(F)}return Zs.__DOMHandler=_,Zs.normalizeLineEndings=c,Zs.DOMParser=f,Zs}var xl;function Ug(){if(xl)return Js;xl=1;var s=Hc();return Js.DOMImplementation=s.DOMImplementation,Js.XMLSerializer=s.XMLSerializer,Js.DOMParser=Fg().DOMParser,Js}var jg=Ug();const Sl=s=>!!s&&typeof s=="object",Ke=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):Sl(e[i])&&Sl(t[i])?e[i]=Ke(e[i],t[i]):e[i]=t[i]}),e),{}),zc=s=>Object.keys(s).map(e=>s[e]),qg=(s,e)=>{const t=[];for(let i=s;i<e;i++)t.push(i);return t},ms=s=>s.reduce((e,t)=>e.concat(t),[]),Gc=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},$g=(s,e)=>s.reduce((t,i,r)=>(i[e]&&t.push(r),t),[]),Vg=(s,e)=>zc(s.reduce((t,i)=>(i.forEach(r=>{t[e(r)]=r}),t),{}));var gs={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const fr=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const r={uri:e,resolvedUri:On(s||"",e)};if(t||i){const a=(t||i).split("-");let u=D.BigInt?D.BigInt(a[0]):parseInt(a[0],10),c=D.BigInt?D.BigInt(a[1]):parseInt(a[1],10);u<Number.MAX_SAFE_INTEGER&&typeof u=="bigint"&&(u=Number(u)),c<Number.MAX_SAFE_INTEGER&&typeof c=="bigint"&&(c=Number(c));let f;typeof c=="bigint"||typeof u=="bigint"?f=D.BigInt(c)-D.BigInt(u)+D.BigInt(1):f=c-u+1,typeof f=="bigint"&&f<Number.MAX_SAFE_INTEGER&&(f=Number(f)),r.byterange={length:f,offset:u}}return r},Hg=s=>{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=D.BigInt(s.offset)+D.BigInt(s.length)-D.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},El=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),zg={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:r}=s,n=El(s.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:i/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:u=0,timeShiftBufferDepth:c=1/0}=s,f=El(s.endNumber),g=(e+t)/1e3,_=i+a,S=g+u-_,O=Math.ceil(S*r/n),T=Math.floor((g-_-c)*r/n),I=Math.floor((g-_)*r/n);return{start:Math.max(0,T),end:typeof f=="number"?f:Math.min(O,I)}}},Gg=s=>e=>{const{duration:t,timescale:i=1,periodStart:r,startNumber:n=1}=s;return{number:n+e,duration:t/i,timeline:r,time:e*t}},Ao=s=>{const{type:e,duration:t,timescale:i=1,periodDuration:r,sourceDuration:n}=s,{start:a,end:u}=zg[e](s),c=qg(a,u).map(Gg(s));if(e==="static"){const f=c.length-1,g=typeof r=="number"?r:n;c[f].duration=g-t/i*f}return c},Wc=s=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:r="",periodStart:n,presentationTime:a,number:u=0,duration:c}=s;if(!e)throw new Error(gs.NO_BASE_URL);const f=fr({baseUrl:e,source:t.sourceURL,range:t.range}),g=fr({baseUrl:e,source:e,indexRange:r});if(g.map=f,c){const _=Ao(s);_.length&&(g.duration=_[0].duration,g.timeline=_[0].timeline)}else i&&(g.duration=i,g.timeline=n);return g.presentationTime=a||n,g.number=u,[g]},Do=(s,e,t)=>{const i=s.sidx.map?s.sidx.map:null,r=s.sidx.duration,n=s.timeline||0,a=s.sidx.byterange,u=a.offset+a.length,c=e.timescale,f=e.references.filter(I=>I.referenceType!==1),g=[],_=s.endList?"static":"dynamic",A=s.sidx.timeline;let S=A,O=s.mediaSequence||0,T;typeof e.firstOffset=="bigint"?T=D.BigInt(u)+e.firstOffset:T=u+e.firstOffset;for(let I=0;I<f.length;I++){const F=e.references[I],N=F.referencedSize,R=F.subsegmentDuration;let U;typeof T=="bigint"?U=T+D.BigInt(N)-D.BigInt(1):U=T+N-1;const j=`${T}-${U}`,L=Wc({baseUrl:t,timescale:c,timeline:n,periodStart:A,presentationTime:S,number:O,duration:R,sourceDuration:r,indexRange:j,type:_})[0];i&&(L.map=i),g.push(L),typeof T=="bigint"?T+=D.BigInt(N):T+=N,S+=R/c,O++}return s.segments=g,s},Wg=["AUDIO","SUBTITLES"],Xg=1/60,Xc=s=>Vg(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),Kg=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Cl=s=>{let e=[];return Ng(s,Wg,(t,i,r,n)=>{e=e.concat(t.playlists||[])}),e},wl=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},Yg=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:c}){return c===i.timeline});const r=Kg(s,i.attributes.NAME);if(!r||i.sidx)return;const n=i.segments[0],a=r.segments.findIndex(function(c){return Math.abs(c.presentationTime-n.presentationTime)<Xg});if(a===-1){wl({playlist:i,mediaSequence:r.mediaSequence+r.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!r.segments.length&&i.timeline>r.timeline||r.segments.length&&i.timeline>r.segments[r.segments.length-1].timeline)&&i.discontinuitySequence--;return}r.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),wl({playlist:i,mediaSequence:r.segments[a].number})})},Qg=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Cl(s)),i=e.playlists.concat(Cl(e));return e.timelineStarts=Xc([s.timelineStarts,e.timelineStarts]),Yg({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Nn=s=>s&&s.uri+"-"+Hg(s.byterange),La=s=>{const e=s.reduce(function(i,r){return i[r.attributes.baseUrl]||(i[r.attributes.baseUrl]=[]),i[r.attributes.baseUrl].push(r),i},{});let t=[];return Object.values(e).forEach(i=>{const r=zc(i.reduce((n,a)=>{const u=a.attributes.id+(a.attributes.lang||"");return n[u]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[u].segments.push(...a.segments)),a.attributes.contentProtection&&(n[u].attributes.contentProtection=a.attributes.contentProtection)):(n[u]=a,n[u].attributes.timelineStarts=[]),n[u].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(r)}),t.map(i=>(i.discontinuityStarts=$g(i.segments||[],"discontinuity"),i))},ko=(s,e)=>{const t=Nn(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&Do(s,i,s.sidx.resolvedUri),s},Jg=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=ko(s[t],e);return s},Zg=({attributes:s,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:r,discontinuityStarts:n},a)=>{const u={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:s.timelineStarts,mediaSequence:i,segments:e};return s.contentProtection&&(u.contentProtection=s.contentProtection),s.serviceLocation&&(u.attributes.serviceLocation=s.serviceLocation),t&&(u.sidx=t),a&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u},e0=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:r})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const n={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(n.CODECS=s.codecs);const a={attributes:n,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:i,discontinuitySequence:r,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},t0=(s,e={},t=!1)=>{let i;const r=s.reduce((n,a)=>{const u=a.attributes.role&&a.attributes.role.value||"",c=a.attributes.lang||"";let f=a.attributes.label||"main";if(c&&!a.attributes.label){const _=u?` (${u})`:"";f=`${a.attributes.lang}${_}`}n[f]||(n[f]={language:c,autoselect:!0,default:u==="main",playlists:[],uri:""});const g=ko(Zg(a,t),e);return n[f].playlists.push(g),typeof i>"u"&&u==="main"&&(i=a,i.default=!0),n},{});if(!i){const n=Object.keys(r)[0];r[n].default=!0}return r},i0=(s,e={})=>s.reduce((t,i)=>{const r=i.attributes.label||i.attributes.lang||"text",n=i.attributes.lang||"und";return t[r]||(t[r]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[r].playlists.push(ko(e0(i),e)),t},{}),s0=s=>s.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:r,language:n}=i;e[n]={autoselect:!1,default:!1,instreamId:r,language:n},i.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[n].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[n]["3D"]=i["3D"])}),e),{}),r0=({attributes:s,segments:e,sidx:t,discontinuityStarts:i})=>{const r={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:i,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(r.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(r.contentProtection=s.contentProtection),s.serviceLocation&&(r.attributes.serviceLocation=s.serviceLocation),t&&(r.sidx=t),r},n0=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",a0=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",o0=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",u0=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,r)=>{i.number=r})})},Al=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],l0=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:r,eventStream:n})=>{if(!s.length)return{};const{sourceDuration:a,type:u,suggestedPresentationDelay:c,minimumUpdatePeriod:f}=s[0].attributes,g=La(s.filter(n0)).map(r0),_=La(s.filter(a0)),A=La(s.filter(o0)),S=s.map(U=>U.attributes.captionServices).filter(Boolean),O={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:Jg(g,i)};f>=0&&(O.minimumUpdatePeriod=f*1e3),e&&(O.locations=e),t&&(O.contentSteering=t),u==="dynamic"&&(O.suggestedPresentationDelay=c),n&&n.length>0&&(O.eventStream=n);const T=O.playlists.length===0,I=_.length?t0(_,i,T):null,F=A.length?i0(A,i):null,N=g.concat(Al(I),Al(F)),R=N.map(({timelineStarts:U})=>U);return O.timelineStarts=Xc(R),u0(N,O.timelineStarts),I&&(O.mediaGroups.AUDIO.audio=I),F&&(O.mediaGroups.SUBTITLES.subs=F),S.length&&(O.mediaGroups["CLOSED-CAPTIONS"].cc=s0(S)),r?Qg({oldManifest:r,newManifest:O}):O},c0=(s,e,t)=>{const{NOW:i,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:u=0,minimumUpdatePeriod:c=0}=s,f=(i+r)/1e3,g=n+u,A=f+c-g;return Math.ceil((A*a-e)/t)},Kc=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:u=1,periodStart:c}=s,f=[];let g=-1;for(let _=0;_<e.length;_++){const A=e[_],S=A.d,O=A.r||0,T=A.t||0;g<0&&(g=T),T&&T>g&&(g=T);let I;if(O<0){const R=_+1;R===e.length?t==="dynamic"&&i>0&&r.indexOf("$Number$")>0?I=c0(s,g,S):I=(n*a-g)/S:I=(e[R].t-g)/S}else I=O+1;const F=u+f.length+I;let N=u+f.length;for(;N<F;)f.push({number:N,duration:S/a,time:g,timeline:c}),g+=S,N++}return f},d0=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,h0=s=>(e,t,i,r)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const n=""+s[t];return t==="RepresentationID"||(i?r=parseInt(r,10):r=1,n.length>=r)?n:`${new Array(r-n.length+1).join("0")}${n}`},Dl=(s,e)=>s.replace(d0,h0(e)),f0=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Ao(s):Kc(s,e),p0=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,r=fr({baseUrl:s.baseUrl,source:Dl(i.sourceURL,t),range:i.range});return f0(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const u=Dl(s.media||"",t),c=s.timescale||1,f=s.presentationTimeOffset||0,g=s.periodStart+(a.time-f)/c;return{uri:u,timeline:a.timeline,duration:a.duration,resolvedUri:On(s.baseUrl||"",u),map:r,number:a.number,presentationTime:g}})},m0=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,r=fr({baseUrl:t,source:i.sourceURL,range:i.range}),n=fr({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=r,n},g0=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(gs.SEGMENT_TIME_UNSPECIFIED);const n=i.map(c=>m0(s,c));let a;return t&&(a=Ao(s)),e&&(a=Kc(s,e)),a.map((c,f)=>{if(n[f]){const g=n[f],_=s.timescale||1,A=s.presentationTimeOffset||0;return g.timeline=c.timeline,g.duration=c.duration,g.number=c.number,g.presentationTime=r+(c.time-A)/_,g}}).filter(c=>c)},_0=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=p0,t=Ke(s,e.template)):e.base?(i=Wc,t=Ke(s,e.base)):e.list&&(i=g0,t=Ke(s,e.list));const r={attributes:s};if(!i)return r;const n=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:u=1}=t;t.duration=a/u}else n.length?t.duration=n.reduce((a,u)=>Math.max(a,Math.ceil(u.duration)),0):t.duration=0;return r.attributes=t,r.segments=n,e.base&&t.indexRange&&(r.sidx=n[0],r.segments=[]),r},y0=s=>s.map(_0),Me=(s,e)=>Gc(s.childNodes).filter(({tagName:t})=>t===e),Tr=s=>s.textContent.trim(),T0=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),Zi=s=>{const u=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!u)return 0;const[c,f,g,_,A,S]=u.slice(1);return parseFloat(c||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(g||0)*86400+parseFloat(_||0)*3600+parseFloat(A||0)*60+parseFloat(S||0)},v0=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),kl={mediaPresentationDuration(s){return Zi(s)},availabilityStartTime(s){return v0(s)/1e3},minimumUpdatePeriod(s){return Zi(s)},suggestedPresentationDelay(s){return Zi(s)},type(s){return s},timeShiftBufferDepth(s){return Zi(s)},start(s){return Zi(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return T0(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?Zi(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},He=s=>s&&s.attributes?Gc(s.attributes).reduce((e,t)=>{const i=kl[t.name]||kl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},b0={"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","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Mn=(s,e)=>e.length?ms(s.map(function(t){return e.map(function(i){const r=Tr(i),n=On(t.baseUrl,r),a=Ke(He(i),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,Io=s=>{const e=Me(s,"SegmentTemplate")[0],t=Me(s,"SegmentList")[0],i=t&&Me(t,"SegmentURL").map(_=>Ke({tag:"SegmentURL"},He(_))),r=Me(s,"SegmentBase")[0],n=t||e,a=n&&Me(n,"SegmentTimeline")[0],u=t||r||e,c=u&&Me(u,"Initialization")[0],f=e&&He(e);f&&c?f.initialization=c&&He(c):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const g={template:f,segmentTimeline:a&&Me(a,"S").map(_=>He(_)),list:t&&Ke(He(t),{segmentUrls:i,initialization:He(c)}),base:r&&Ke(He(r),{initialization:He(c)})};return Object.keys(g).forEach(_=>{g[_]||delete g[_]}),g},x0=(s,e,t)=>i=>{const r=Me(i,"BaseURL"),n=Mn(e,r),a=Ke(s,He(i)),u=Io(i);return n.map(c=>({segmentInfo:Ke(t,u),attributes:Ke(a,c)}))},S0=s=>s.reduce((e,t)=>{const i=He(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const r=b0[i.schemeIdUri];if(r){e[r]={attributes:i};const n=Me(t,"cenc:pssh")[0];if(n){const a=Tr(n);e[r].pssh=a&&Fc(a)}}return e},{}),E0=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{let i,r;return r=t,/^CC\d=/.test(t)?[i,r]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:r}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[r,n=""]=t.split("=");i.channel=r,i.language=t,n.split(",").forEach(a=>{const[u,c]=a.split(":");u==="lang"?i.language=c:u==="er"?i.easyReader=Number(c):u==="war"?i.aspectRatio=Number(c):u==="3D"&&(i["3D"]=Number(c))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},C0=s=>ms(Me(s.node,"EventStream").map(e=>{const t=He(e),i=t.schemeIdUri;return Me(e,"Event").map(r=>{const n=He(r),a=n.presentationTime||0,u=t.timescale||1,c=n.duration||0,f=a/u+s.attributes.start;return{schemeIdUri:i,value:t.value,id:n.id,start:f,end:f+c/u,messageData:Tr(r)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),w0=(s,e,t)=>i=>{const r=He(i),n=Mn(e,Me(i,"BaseURL")),a=Me(i,"Role")[0],u={role:He(a)};let c=Ke(s,r,u);const f=Me(i,"Accessibility")[0],g=E0(He(f));g&&(c=Ke(c,{captionServices:g}));const _=Me(i,"Label")[0];if(_&&_.childNodes.length){const I=_.childNodes[0].nodeValue.trim();c=Ke(c,{label:I})}const A=S0(Me(i,"ContentProtection"));Object.keys(A).length&&(c=Ke(c,{contentProtection:A}));const S=Io(i),O=Me(i,"Representation"),T=Ke(t,S);return ms(O.map(x0(c,n,T)))},A0=(s,e)=>(t,i)=>{const r=Mn(e,Me(t.node,"BaseURL")),n=Ke(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Me(t.node,"AdaptationSet"),u=Io(t.node);return ms(a.map(w0(n,r,u)))},D0=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const t=Ke({serverURL:Tr(s[0])},He(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},k0=({attributes:s,priorPeriodAttributes:e,mpdType:t})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,I0=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=Me(s,"Period");if(!a.length)throw new Error(gs.INVALID_NUMBER_OF_PERIOD);const u=Me(s,"Location"),c=He(s),f=Mn([{baseUrl:t}],Me(s,"BaseURL")),g=Me(s,"ContentSteering");c.type=c.type||"static",c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=i,c.clientOffset=r,u.length&&(c.locations=u.map(Tr));const _=[];return a.forEach((A,S)=>{const O=He(A),T=_[S-1];O.start=k0({attributes:O,priorPeriodAttributes:T?T.attributes:null,mpdType:c.type}),_.push({node:A,attributes:O})}),{locations:c.locations,contentSteeringInfo:D0(g,n),representationInfo:ms(_.map(A0(c,f))),eventStream:ms(_.map(C0))}},Yc=s=>{if(s==="")throw new Error(gs.DASH_EMPTY_MANIFEST);const e=new jg.DOMParser;let t,i;try{t=e.parseFromString(s,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(gs.DASH_INVALID_XML);return i},P0=s=>{const e=Me(s,"UTCTiming")[0];if(!e)return null;const t=He(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(gs.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},L0=(s,e={})=>{const t=I0(Yc(s),e),i=y0(t.representationInfo);return l0({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},O0=s=>P0(Yc(s));var Oa,Il;function R0(){if(Il)return Oa;Il=1;var s=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),r;return i.getBigUint64?(r=i.getBigUint64(0),r<Number.MAX_SAFE_INTEGER?Number(r):r):i.getUint32(0)*s+i.getUint32(4)};return Oa={getUint64:e,MAX_UINT32:s},Oa}var Ra,Pl;function N0(){if(Pl)return Ra;Pl=1;var s=R0().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},n=12;r.version===0?(r.earliestPresentationTime=i.getUint32(n),r.firstOffset=i.getUint32(n+4),n+=8):(r.earliestPresentationTime=s(t.subarray(n)),r.firstOffset=s(t.subarray(n+8)),n+=16),n+=2;var a=i.getUint16(n);for(n+=2;a>0;n+=12,a--)r.references.push({referenceType:(t[n]&128)>>>7,referencedSize:i.getUint32(n)&2147483647,subsegmentDuration:i.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:i.getUint32(n+8)&268435455});return r};return Ra=e,Ra}var M0=N0();const B0=yr(M0);var F0=ce([73,68,51]),U0=function(e,t){t===void 0&&(t=0),e=ce(e);var i=e[t+5],r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(i&16)>>4;return n?r+20:r+10},rr=function s(e,t){return t===void 0&&(t=0),e=ce(e),e.length-t<10||!Ne(e,F0,{offset:t})?t:(t+=U0(e,t),s(e,t))},Ll=function(e){return typeof e=="string"?Vc(e):e},j0=function(e){return Array.isArray(e)?e.map(function(t){return Ll(t)}):[Ll(e)]},q0=function s(e,t,i){i===void 0&&(i=!1),t=j0(t),e=ce(e);var r=[];if(!t.length)return r;for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,u=e.subarray(n+4,n+8);if(a===0)break;var c=n+a;if(c>e.length){if(i)break;c=e.length}var f=e.subarray(n+8,c);Ne(u,t[0])&&(t.length===1?r.push(f):r.push.apply(r,s(f,t.slice(1),i))),n=c}return r},sn={EBML:ce([26,69,223,163]),DocType:ce([66,130]),Segment:ce([24,83,128,103]),SegmentInfo:ce([21,73,169,102]),Tracks:ce([22,84,174,107]),Track:ce([174]),TrackNumber:ce([215]),DefaultDuration:ce([35,227,131]),TrackEntry:ce([174]),TrackType:ce([131]),FlagDefault:ce([136]),CodecID:ce([134]),CodecPrivate:ce([99,162]),VideoTrack:ce([224]),AudioTrack:ce([225]),Cluster:ce([31,67,182,117]),Timestamp:ce([231]),TimestampScale:ce([42,215,177]),BlockGroup:ce([160]),BlockDuration:ce([155]),Block:ce([161]),SimpleBlock:ce([163])},Ja=[128,64,32,16,8,4,2,1],$0=function(e){for(var t=1,i=0;i<Ja.length&&!(e&Ja[i]);i++)t++;return t},hn=function(e,t,i,r){i===void 0&&(i=!0),r===void 0&&(r=!1);var n=$0(e[t]),a=e.subarray(t,t+n);return i&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=Ja[n-1]),{length:n,value:Lg(a,{signed:r}),bytes:a}},Ol=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?Og(e):e},V0=function(e){return Array.isArray(e)?e.map(function(t){return Ol(t)}):[Ol(e)]},H0=function s(e,t,i){if(i>=t.length)return t.length;var r=hn(t,i,!1);if(Ne(e.bytes,r.bytes))return i;var n=hn(t,i+r.length);return s(e,t,i+n.length+n.value+r.length)},Rl=function s(e,t){t=V0(t),e=ce(e);var i=[];if(!t.length)return i;for(var r=0;r<e.length;){var n=hn(e,r,!1),a=hn(e,r+n.length),u=r+n.length+a.length;a.value===127&&(a.value=H0(n,e,u),a.value!==e.length&&(a.value-=u));var c=u+a.value>e.length?e.length:u+a.value,f=e.subarray(u,c);Ne(t[0],n.bytes)&&(t.length===1?i.push(f):i=i.concat(s(f,t.slice(1))));var g=n.length+a.length+f.length;r+=g}return i},z0=ce([0,0,0,1]),G0=ce([0,0,1]),W0=ce([0,0,3]),X0=function(e){for(var t=[],i=1;i<e.length-2;)Ne(e.subarray(i,i+3),W0)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var r=e.length-t.length,n=new Uint8Array(r),a=0;for(i=0;i<r;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=e[a];return n},Qc=function(e,t,i,r){e=ce(e),i=[].concat(i);for(var n=0,a,u=0;n<e.length&&(u<r||a);){var c=void 0;if(Ne(e.subarray(n),z0)?c=4:Ne(e.subarray(n),G0)&&(c=3),!c){n++;continue}if(u++,a)return X0(e.subarray(a,n));var f=void 0;t==="h264"?f=e[n+c]&31:t==="h265"&&(f=e[n+c]>>1&63),i.indexOf(f)!==-1&&(a=n+c),n+=c+(t==="h264"?1:2)}return e.subarray(0,0)},K0=function(e,t,i){return Qc(e,"h264",t,i)},Y0=function(e,t,i){return Qc(e,"h265",t,i)},lt={webm:ce([119,101,98,109]),matroska:ce([109,97,116,114,111,115,107,97]),flac:ce([102,76,97,67]),ogg:ce([79,103,103,83]),ac3:ce([11,119]),riff:ce([82,73,70,70]),avi:ce([65,86,73]),wav:ce([87,65,86,69]),"3gp":ce([102,116,121,112,51,103]),mp4:ce([102,116,121,112]),fmp4:ce([115,116,121,112]),mov:ce([102,116,121,112,113,116]),moov:ce([109,111,111,118]),moof:ce([109,111,111,102])},_s={aac:function(e){var t=rr(e);return Ne(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=rr(e);return Ne(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Rl(e,[sn.EBML,sn.DocType])[0];return Ne(t,lt.webm)},mkv:function(e){var t=Rl(e,[sn.EBML,sn.DocType])[0];return Ne(t,lt.matroska)},mp4:function(e){if(_s["3gp"](e)||_s.mov(e))return!1;if(Ne(e,lt.mp4,{offset:4})||Ne(e,lt.fmp4,{offset:4})||Ne(e,lt.moof,{offset:4})||Ne(e,lt.moov,{offset:4}))return!0},mov:function(e){return Ne(e,lt.mov,{offset:4})},"3gp":function(e){return Ne(e,lt["3gp"],{offset:4})},ac3:function(e){var t=rr(e);return Ne(e,lt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=rr(e);return Ne(e,lt.flac,{offset:t})},ogg:function(e){return Ne(e,lt.ogg)},avi:function(e){return Ne(e,lt.riff)&&Ne(e,lt.avi,{offset:8})},wav:function(e){return Ne(e,lt.riff)&&Ne(e,lt.wav,{offset:8})},h264:function(e){return K0(e,7,3).length},h265:function(e){return Y0(e,[32,33],3).length}},Za=Object.keys(_s).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);Za.forEach(function(s){var e=_s[s];_s[s]=function(t){return e(ce(t))}});var Q0=_s,Po=function(e){e=ce(e);for(var t=0;t<Za.length;t++){var i=Za[t];if(Q0[i](e))return i}return""},J0=function(e){return q0(e,["moof"]).length>0},Na,Nl;function Z0(){if(Nl)return Na;Nl=1;var s=9e4,e,t,i,r,n,a,u;return e=function(c){return c*s},t=function(c,f){return c*f},i=function(c){return c/s},r=function(c,f){return c/f},n=function(c,f){return e(r(c,f))},a=function(c,f){return t(i(c),f)},u=function(c,f,g){return i(g?c:c-f)},Na={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:r,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:u},Na}var Ui=Z0();var eo="8.23.4";const ri={},Ci=function(s,e){return ri[s]=ri[s]||[],e&&(ri[s]=ri[s].concat(e)),ri[s]},e_=function(s,e){Ci(s,e)},Jc=function(s,e){const t=Ci(s).indexOf(e);return t<=-1?!1:(ri[s]=ri[s].slice(),ri[s].splice(t,1),!0)},t_=function(s,e){Ci(s,[].concat(e).map(t=>{const i=(...r)=>(Jc(s,i),t(...r));return i}))},fn={prefixed:!0},un=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Ml=un[0];let nr;for(let s=0;s<un.length;s++)if(un[s][1]in re){nr=un[s];break}if(nr){for(let s=0;s<nr.length;s++)fn[Ml[s]]=nr[s];fn.prefixed=nr[0]!==Ml[0]}let ht=[];const i_=(s,e,t)=>(i,r,n)=>{const a=e.levels[r],u=new RegExp(`^(${a})$`);let c=s;if(i!=="log"&&n.unshift(i.toUpperCase()+":"),t&&(c=`%c${s}`,n.unshift(t)),n.unshift(c+":"),ht){ht.push([].concat(n));const g=ht.length-1e3;ht.splice(0,g>0?g:0)}if(!D.console)return;let f=D.console[i];!f&&i==="debug"&&(f=D.console.info||D.console.log),!(!f||!a||!u.test(i))&&f[Array.isArray(n)?"apply":"call"](D.console,n)};function to(s,e=":",t=""){let i="info",r;function n(...a){r("log",i,a)}return r=i_(s,n,t),n.createLogger=(a,u,c)=>{const f=u!==void 0?u:e,g=c!==void 0?c:t,_=`${s} ${f} ${a}`;return to(_,f,g)},n.createNewLogger=(a,u,c)=>to(a,u,c),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},n.history=()=>ht?[].concat(ht):[],n.history.filter=a=>(ht||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),n.history.clear=()=>{ht&&(ht.length=0)},n.history.disable=()=>{ht!==null&&(ht.length=0,ht=null)},n.history.enable=()=>{ht===null&&(ht=[])},n.error=(...a)=>r("error",i,a),n.warn=(...a)=>r("warn",i,a),n.debug=(...a)=>r("debug",i,a),n}const ve=to("VIDEOJS"),Zc=ve.createLogger,s_=Object.prototype.toString,ed=function(s){return Yt(s)?Object.keys(s):[]};function ns(s,e){ed(s).forEach(t=>e(s[t],t))}function td(s,e,t=0){return ed(s).reduce((i,r)=>e(i,s[r],r),t)}function Yt(s){return!!s&&typeof s=="object"}function ys(s){return Yt(s)&&s_.call(s)==="[object Object]"&&s.constructor===Object}function Ae(...s){const e={};return s.forEach(t=>{t&&ns(t,(i,r)=>{if(!ys(i)){e[r]=i;return}ys(e[r])||(e[r]={}),e[r]=Ae(e[r],i)})}),e}function id(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function Bn(s,e,t,i=!0){const r=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return r(a),a}};return i&&(n.set=r),Object.defineProperty(s,e,n)}var r_=Object.freeze({__proto__:null,each:ns,reduce:td,isObject:Yt,isPlain:ys,merge:Ae,values:id,defineLazyProperty:Bn});let Lo=!1,sd=null,Ft=!1,rd,nd=!1,as=!1,os=!1,Qt=!1,Oo=null,Fn=null;const n_=!!(D.cast&&D.cast.framework&&D.cast.framework.CastReceiverContext);let ad=null,pn=!1,Un=!1,mn=!1,jn=!1,gn=!1,_n=!1,yn=!1;const pr=!!(Ss()&&("ontouchstart"in D||D.navigator.maxTouchPoints||D.DocumentTouch&&D.document instanceof D.DocumentTouch)),Ti=D.navigator&&D.navigator.userAgentData;Ti&&Ti.platform&&Ti.brands&&(Ft=Ti.platform==="Android",as=!!Ti.brands.find(s=>s.brand==="Microsoft Edge"),os=!!Ti.brands.find(s=>s.brand==="Chromium"),Qt=!as&&os,Oo=Fn=(Ti.brands.find(s=>s.brand==="Chromium")||{}).version||null,Un=Ti.platform==="Windows");if(!os){const s=D.navigator&&D.navigator.userAgent||"";Lo=/iPod/i.test(s),sd=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),Ft=/Android/i.test(s),rd=(function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),nd=/Firefox/i.test(s),as=/Edg/i.test(s),os=/Chrome/i.test(s)||/CriOS/i.test(s),Qt=!as&&os,Oo=Fn=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),ad=(function(){const e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)&&(t=11),t})(),gn=/Tizen/i.test(s),_n=/Web0S/i.test(s),yn=gn||_n,pn=/Safari/i.test(s)&&!Qt&&!Ft&&!as&&!yn,Un=/Windows/i.test(s),mn=/iPad/i.test(s)||pn&&pr&&!/iPhone/i.test(s),jn=/iPhone/i.test(s)&&!mn}const st=jn||mn||Lo,qn=(pn||st)&&!Qt;var od=Object.freeze({__proto__:null,get IS_IPOD(){return Lo},get IOS_VERSION(){return sd},get IS_ANDROID(){return Ft},get ANDROID_VERSION(){return rd},get IS_FIREFOX(){return nd},get IS_EDGE(){return as},get IS_CHROMIUM(){return os},get IS_CHROME(){return Qt},get CHROMIUM_VERSION(){return Oo},get CHROME_VERSION(){return Fn},IS_CHROMECAST_RECEIVER:n_,get IE_VERSION(){return ad},get IS_SAFARI(){return pn},get IS_WINDOWS(){return Un},get IS_IPAD(){return mn},get IS_IPHONE(){return jn},get IS_TIZEN(){return gn},get IS_WEBOS(){return _n},get IS_SMART_TV(){return yn},TOUCH_ENABLED:pr,IS_IOS:st,IS_ANY_SAFARI:qn});function Bl(s){return typeof s=="string"&&!!s.trim()}function a_(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Ss(){return re===D.document}function Es(s){return Yt(s)&&s.nodeType===1}function ud(){try{return D.parent!==D.self}catch{return!0}}function ld(s){return function(e,t){if(!Bl(e))return re[s](null);Bl(t)&&(t=re.querySelector(t));const i=Es(t)?t:re;return i[s]&&i[s](e)}}function de(s="div",e={},t={},i){const r=re.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Ai(r,a):(r[n]!==a||n==="tabIndex")&&(r[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){r.setAttribute(n,t[n])}),i&&Ro(r,i),r}function Ai(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function io(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function ur(s,e){return a_(e),s.classList.contains(e)}function $i(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function $n(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(ve.warn("removeClass was called with an element that doesn't exist"),null)}function cd(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function dd(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?s.removeAttribute(t):s.setAttribute(t,i===!0?"":i)})}function xi(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const i=s.attributes;for(let r=i.length-1;r>=0;r--){const n=i[r].name;let a=i[r].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function hd(s,e){return s.getAttribute(e)}function Ts(s,e,t){s.setAttribute(e,t)}function Vn(s,e){s.removeAttribute(e)}function fd(){re.body.focus(),re.onselectstart=function(){return!1}}function pd(){re.onselectstart=function(){return!0}}function vs(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(bs(s,"height"))),t.width||(t.width=parseFloat(bs(s,"width"))),t}}function mr(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let i=0,r=0;for(;s.offsetParent&&s!==re[fn.fullscreenElement];)i+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:i,top:r,width:e,height:t}}function Hn(s,e){const t={x:0,y:0};if(st){let g=s;for(;g&&g.nodeName.toLowerCase()!=="html";){const _=bs(g,"transform");if(/^matrix/.test(_)){const A=_.slice(7,-1).split(/,\s/).map(Number);t.x+=A[4],t.y+=A[5]}else if(/^matrix3d/.test(_)){const A=_.slice(9,-1).split(/,\s/).map(Number);t.x+=A[12],t.y+=A[13]}if(g.assignedSlot&&g.assignedSlot.parentElement&&D.WebKitCSSMatrix){const A=D.getComputedStyle(g.assignedSlot.parentElement).transform,S=new D.WebKitCSSMatrix(A);t.x+=S.m41,t.y+=S.m42}g=g.parentNode||g.host}}const i={},r=mr(e.target),n=mr(s),a=n.width,u=n.height;let c=e.offsetY-(n.top-r.top),f=e.offsetX-(n.left-r.left);return e.changedTouches&&(f=e.changedTouches[0].pageX-n.left,c=e.changedTouches[0].pageY+n.top,st&&(f-=t.x,c-=t.y)),i.y=1-Math.max(0,Math.min(1,c/u)),i.x=Math.max(0,Math.min(1,f/a)),i}function md(s){return Yt(s)&&s.nodeType===3}function zn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function gd(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),Es(e)||md(e))return e;if(typeof e=="string"&&/\S/.test(e))return re.createTextNode(e)}).filter(e=>e)}function Ro(s,e){return gd(e).forEach(t=>s.appendChild(t)),s}function _d(s,e){return Ro(zn(s),e)}function gr(s){return s.button===void 0&&s.buttons===void 0||s.button===0&&s.buttons===void 0||s.type==="mouseup"&&s.button===0&&s.buttons===0||s.type==="mousedown"&&s.button===0&&s.buttons===0?!0:!(s.button!==0||s.buttons!==1)}const wi=ld("querySelector"),yd=ld("querySelectorAll");function bs(s,e){if(!s||!e)return"";if(typeof D.getComputedStyle=="function"){let t;try{t=D.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Td(s){[...re.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),i=re.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=re.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var vd=Object.freeze({__proto__:null,isReal:Ss,isEl:Es,isInFrame:ud,createEl:de,textContent:Ai,prependTo:io,hasClass:ur,addClass:$i,removeClass:$n,toggleClass:cd,setAttributes:dd,getAttributes:xi,getAttribute:hd,setAttribute:Ts,removeAttribute:Vn,blockTextSelection:fd,unblockTextSelection:pd,getBoundingClientRect:vs,findPosition:mr,getPointerPosition:Hn,isTextNode:md,emptyEl:zn,normalizeContent:gd,appendContent:Ro,insertContent:_d,isSingleLeftClick:gr,$:wi,$$:yd,computedStyle:bs,copyStyleSheetsToWindow:Td});let bd=!1,so;const o_=function(){if(so.options.autoSetup===!1)return;const s=Array.prototype.slice.call(re.getElementsByTagName("video")),e=Array.prototype.slice.call(re.getElementsByTagName("audio")),t=Array.prototype.slice.call(re.getElementsByTagName("video-js")),i=s.concat(e,t);if(i&&i.length>0)for(let r=0,n=i.length;r<n;r++){const a=i[r];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&so(a);else{ro(1);break}}else bd||ro(1)};function ro(s,e){Ss()&&(e&&(so=e),D.setTimeout(o_,s))}function no(){bd=!0,D.removeEventListener("load",no)}Ss()&&(re.readyState==="complete"?no():D.addEventListener("load",no));const xd=function(s){const e=re.createElement("style");return e.className=s,e},Sd=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var dt=new WeakMap;const u_=3;let l_=u_;function It(){return l_++}function Fl(s,e){if(!dt.has(s))return;const t=dt.get(s);t.handlers[e].length===0&&(delete t.handlers[e],s.removeEventListener?s.removeEventListener(e,t.dispatcher,!1):s.detachEvent&&s.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&dt.delete(s)}function No(s,e,t,i){t.forEach(function(r){s(e,r,i)})}function Gn(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const i=s||D.event;s={};const r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const n in i)r.includes(n)||n==="returnValue"&&i.preventDefault||(s[n]=i[n]);if(s.target||(s.target=s.srcElement||re),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){i.preventDefault&&i.preventDefault(),s.returnValue=!1,i.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),s.cancelBubble=!0,i.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const n=re.documentElement,a=re.body;s.pageX=s.clientX+(n&&n.scrollLeft||a&&a.scrollLeft||0)-(n&&n.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(n&&n.scrollTop||a&&a.scrollTop||0)-(n&&n.clientTop||a&&a.clientTop||0)}s.which=s.charCode||s.keyCode,s.button!==null&&s.button!==void 0&&(s.button=s.button&1?0:s.button&4?1:s.button&2?2:0)}return s.fixed_=!0,s}let rn;const c_=function(){if(typeof rn!="boolean"){rn=!1;try{const s=Object.defineProperty({},"passive",{get(){rn=!0}});D.addEventListener("test",null,s),D.removeEventListener("test",null,s)}catch{}}return rn},d_=["touchstart","touchmove"];function bt(s,e,t){if(Array.isArray(e))return No(bt,s,e,t);dt.has(s)||dt.set(s,{});const i=dt.get(s);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=It()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(r,n){if(i.disabled)return;r=Gn(r);const a=i.handlers[r.type];if(a){const u=a.slice(0);for(let c=0,f=u.length;c<f&&!r.isImmediatePropagationStopped();c++)try{u[c].call(s,r,n)}catch(g){ve.error(g)}}}),i.handlers[e].length===1)if(s.addEventListener){let r=!1;c_()&&d_.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,i.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function rt(s,e,t){if(!dt.has(s))return;const i=dt.get(s);if(!i.handlers)return;if(Array.isArray(e))return No(rt,s,e,t);const r=function(a,u){i.handlers[u]=[],Fl(a,u)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&r(s,a);return}const n=i.handlers[e];if(n){if(!t){r(s,e);return}if(t.guid)for(let a=0;a<n.length;a++)n[a].guid===t.guid&&n.splice(a--,1);Fl(s,e)}}function Cs(s,e,t){const i=dt.has(s)?dt.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Gn(e),i.dispatcher&&i.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)Cs.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){dt.has(e.target)||dt.set(e.target,{});const n=dt.get(e.target);e.target[e.type]&&(n.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),n.disabled=!1)}return!e.defaultPrevented}function Wn(s,e,t){if(Array.isArray(e))return No(Wn,s,e,t);const i=function(){rt(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||It(),bt(s,e,i)}function Mo(s,e,t){const i=function(){rt(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||It(),bt(s,e,i)}var h_=Object.freeze({__proto__:null,fixEvent:Gn,on:bt,off:rt,trigger:Cs,one:Wn,any:Mo});const Pt=30,Ie=function(s,e,t){e.guid||(e.guid=It());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},Jt=function(s,e){let t=D.performance.now();return function(...r){const n=D.performance.now();n-t>=e&&(s(...r),t=n)}},Ed=function(s,e,t,i=D){let r;const n=()=>{i.clearTimeout(r),r=null},a=function(){const u=this,c=arguments;let f=function(){r=null,f=null,t||s.apply(u,c)};!r&&t&&s.apply(u,c),i.clearTimeout(r),r=i.setTimeout(f,e)};return a.cancel=n,a};var f_=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Pt,bind_:Ie,throttle:Jt,debounce:Ed});let er;class xt{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},bt(this,e,t),this.addEventListener=i}off(e,t){rt(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Wn(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Mo(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Gn(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Cs(this,e)}queueTrigger(e){er||(er=new Map);const t=e.type||e;let i=er.get(this);i||(i=new Map,er.set(this,i));const r=i.get(t);i.delete(t),D.clearTimeout(r);const n=D.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,er.delete(this)),this.trigger(e)},0);i.set(t,n)}}xt.prototype.allowedEvents_={};xt.prototype.addEventListener=xt.prototype.on;xt.prototype.removeEventListener=xt.prototype.off;xt.prototype.dispatchEvent=xt.prototype.trigger;const Xn=s=>typeof s.name=="function"?s.name():typeof s.name=="string"?s.name:s.name_?s.name_:s.constructor&&s.constructor.name?s.constructor.name:typeof s,oi=s=>s instanceof xt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),p_=(s,e)=>{oi(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},ao=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,Tn=(s,e,t)=>{if(!s||!s.nodeName&&!oi(s))throw new Error(`Invalid target for ${Xn(e)}#${t}; must be a DOM node or evented object.`)},Cd=(s,e,t)=>{if(!ao(s))throw new Error(`Invalid event type for ${Xn(e)}#${t}; must be a non-empty string or array.`)},wd=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Xn(e)}#${t}; must be a function.`)},Ma=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let r,n,a;return i?(r=s.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(r=e[0],n=e[1],a=e[2]),Tn(r,s,t),Cd(n,s,t),wd(a,s,t),a=Ie(s,a),{isTargetingSelf:i,target:r,type:n,listener:a}},Mi=(s,e,t,i)=>{Tn(s,s,e),s.nodeName?h_[e](s,t,i):s[e](t,i)},m_={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ma(this,s,"on");if(Mi(t,"on",i,r),!e){const n=()=>this.off(t,i,r);n.guid=r.guid;const a=()=>this.off("dispose",n);a.guid=r.guid,Mi(this,"on","dispose",n),Mi(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ma(this,s,"one");if(e)Mi(t,"one",i,r);else{const n=(...a)=>{this.off(t,i,n),r.apply(null,a)};n.guid=r.guid,Mi(t,"one",i,n)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ma(this,s,"any");if(e)Mi(t,"any",i,r);else{const n=(...a)=>{this.off(t,i,n),r.apply(null,a)};n.guid=r.guid,Mi(t,"any",i,n)}},off(s,e,t){if(!s||ao(s))rt(this.eventBusEl_,s,e);else{const i=s,r=e;Tn(i,this,"off"),Cd(r,this,"off"),wd(t,this,"off"),t=Ie(this,t),this.off("dispose",t),i.nodeName?(rt(i,r,t),rt(i,"dispose",t)):oi(i)&&(i.off(r,t),i.off("dispose",t))}},trigger(s,e){Tn(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!ao(t))throw new Error(`Invalid event type for ${Xn(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Cs(this.eventBusEl_,s,e)}};function Bo(s,e={}){const{eventBusKey:t}=e;if(t){if(!s[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);s.eventBusEl_=s[t]}else s.eventBusEl_=de("span",{className:"vjs-event-bus"});return Object.assign(s,m_),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&dt.has(i)&&dt.delete(i)}),D.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const g_={state:{},setState(s){typeof s=="function"&&(s=s());let e;return ns(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&oi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Ad(s,e){return Object.assign(s,g_),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&oi(s)&&s.on("statechanged",s.handleStateChanged),s}const lr=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},je=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Dd=function(s,e){return je(s)===je(e)};var __=Object.freeze({__proto__:null,toLowerCase:lr,toTitleCase:je,titleCaseEquals:Dd});class K{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ae({},this.options_),t=this.options_=Ae(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${It()}`}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(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),t.evented!==!1&&(Bo(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Ad(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(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}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!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Ae(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return de(e,t,i)}localize(e,t,i=e){const r=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[r],u=r&&r.split("-")[0],c=n&&n[u];let f=i;return a&&a[e]?f=a[e]:c&&c[e]&&(f=c[e]),t&&(f=f.replace(/\{(\d+)\}/g,function(g,_){const A=t[_-1];let S=A;return typeof A>"u"&&(S=g),S})),f}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((i,r)=>i.concat(r),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",r=de("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=re.createElementNS(i,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=re.createElementNS(i,"use");return n.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),r.appendChild(n),this.iconIsSet_?t.replaceChild(r,t.querySelector(".vjs-icon-placeholder")):t.appendChild(r),this.iconIsSet_=!0,r}addChild(e,t={},i=this.children_.length){let r,n;if(typeof e=="string"){n=je(e);const a=t.componentClass||n;t.name=n;const u=K.getComponent(a);if(!u)throw new Error(`Component ${a} does not exist`);if(typeof u!="function")return null;r=new u(this.player_||this,t)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(i,0,r),r.parentComponent_=this,typeof r.id=="function"&&(this.childIndex_[r.id()]=r),n=n||r.name&&je(r.name()),n&&(this.childNameIndex_[n]=r,this.childNameIndex_[lr(n)]=r),typeof r.el=="function"&&r.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_:Es(this.children_[i+1])&&(a=this.children_[i+1])),this.contentEl().insertBefore(r.el(),a)}return r}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let r=this.children_.length-1;r>=0;r--)if(this.children_[r]===e){t=!0,this.children_.splice(r,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[je(e.name())]=null,this.childNameIndex_[lr(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const u=a.name;let c=a.opts;if(t[u]!==void 0&&(c=t[u]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const f=this.addChild(u,c);f&&(this[u]=f)};let r;const n=K.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(u){return typeof u=="string"?a===u:a===u.name})})).map(a=>{let u,c;return typeof a=="string"?(u=a,c=e[u]||this.options_[u]||{}):(u=a.name,c=a),{name:u,opts:c}}).filter(a=>{const u=K.getComponent(a.opts.componentClass||je(a.name));return u&&!n.isTech(u)}).forEach(i)}}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 wi(e,t||this.contentEl())}$$(e,t){return yd(e,t||this.contentEl())}hasClass(e){return ur(this.el_,e)}addClass(...e){$i(this.el_,...e)}removeClass(...e){$n(this.el_,...e)}toggleClass(e,t){cd(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 hd(this.el_,e)}setAttribute(e,t){Ts(this.el_,e,t)}removeAttribute(e){Vn(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){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",i||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],n=r.indexOf("px");return parseInt(n!==-1?r.slice(0,n):this.el_["offset"+je(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=bs(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${je(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,r=200;let n;this.on("touchstart",function(u){u.touches.length===1&&(t={pageX:u.touches[0].pageX,pageY:u.touches[0].pageY},e=D.performance.now(),n=!0)}),this.on("touchmove",function(u){if(u.touches.length>1)n=!1;else if(t){const c=u.touches[0].pageX-t.pageX,f=u.touches[0].pageY-t.pageY;Math.sqrt(c*c+f*f)>i&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(u){t=null,n===!0&&D.performance.now()-e<r&&(u.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ie(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(r){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=Ie(this,e),this.clearTimersOnDispose_(),i=D.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),D.clearTimeout(e)),e}setInterval(e,t){e=Ie(this,e),this.clearTimersOnDispose_();const i=D.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),D.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Ie(this,e),t=D.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Ie(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),D.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((i,r)=>this[t](r))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(n){const a=D.getComputedStyle(n,null),u=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(u)}function i(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||D.getComputedStyle(n).height==="0px"||D.getComputedStyle(n).width==="0px")}function r(n){if(n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const a={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(a.x<0||a.x>(re.documentElement.clientWidth||D.innerWidth)||a.y<0||a.y>(re.documentElement.clientHeight||D.innerHeight))return!1;let u=re.elementFromPoint(a.x,a.y);for(;u;){if(u===n)return!0;if(u.parentNode)u=u.parentNode;else return!1}}return e||(e=this.el()),!!(r(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=K.getComponent("Tech"),r=i&&i.isTech(t),n=K===t||K.prototype.isPrototypeOf(t.prototype);if(r||!n){let u;throw r?u="techs must be registered using Tech.registerTech()":u="must be a Component subclass",new Error(`Illegal component, "${e}"; ${u}.`)}e=je(e),K.components_||(K.components_={});const a=K.getComponent("Player");if(e==="Player"&&a&&a.players){const u=a.players,c=Object.keys(u);if(u&&c.length>0){for(let f=0;f<c.length;f++)if(u[c[f]]!==null)throw new Error("Can not register Player component after player has been created.")}}return K.components_[e]=t,K.components_[lr(e)]=t,t}static getComponent(e){if(!(!e||!K.components_))return K.components_[e]}}K.registerComponent("Component",K);function y_(s,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${s}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function Ul(s,e,t,i){return y_(s,i,t.length-1),t[i][e]}function Ba(s){let e;return s===void 0||s.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:s.length,start:Ul.bind(null,"start",0,s),end:Ul.bind(null,"end",1,s)},D.Symbol&&D.Symbol.iterator&&(e[D.Symbol.iterator]=()=>(s||[]).values()),e}function Bt(s,e){return Array.isArray(s)?Ba(s):s===void 0||e===void 0?Ba():Ba([[s,e]])}const kd=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),i=Math.floor(s/60%60),r=Math.floor(s/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(r=i=t="-"),r=r>0||a>0?r+":":"",i=((r||n>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,r+i+t};let Fo=kd;function Id(s){Fo=s}function Pd(){Fo=kd}function Gi(s,e=s){return Fo(s,e)}var T_=Object.freeze({__proto__:null,createTimeRanges:Bt,createTimeRange:Bt,setFormatTime:Id,resetFormatTime:Pd,formatTime:Gi});function Ld(s,e){let t=0,i,r;if(!e)return 0;(!s||!s.length)&&(s=Bt(0,0));for(let n=0;n<s.length;n++)i=s.start(n),r=s.end(n),r>e&&(r=e),t+=r-i;return t/e}function Fe(s){if(s instanceof Fe)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:Yt(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=Fe.defaultMessages[this.code]||"")}Fe.prototype.code=0;Fe.prototype.message="";Fe.prototype.status=null;Fe.prototype.metadata=null;Fe.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Fe.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."};Fe.MEDIA_ERR_CUSTOM=0;Fe.prototype.MEDIA_ERR_CUSTOM=0;Fe.MEDIA_ERR_ABORTED=1;Fe.prototype.MEDIA_ERR_ABORTED=1;Fe.MEDIA_ERR_NETWORK=2;Fe.prototype.MEDIA_ERR_NETWORK=2;Fe.MEDIA_ERR_DECODE=3;Fe.prototype.MEDIA_ERR_DECODE=3;Fe.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Fe.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Fe.MEDIA_ERR_ENCRYPTED=5;Fe.prototype.MEDIA_ERR_ENCRYPTED=5;function cr(s){return s!=null&&typeof s.then=="function"}function Gt(s){cr(s)&&s.then(null,e=>{})}const oo=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,r)=>(s[i]&&(t[i]=s[i]),t),{cues:s.cues&&Array.prototype.map.call(s.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},v_=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const n=oo(r.track);return r.src&&(n.src=r.src),n}).concat(Array.prototype.filter.call(s.textTracks(),function(r){return t.indexOf(r)===-1}).map(oo))},b_=function(s,e){return s.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(r=>i.addCue(r))}),e.textTracks()};var uo={textTracksToJson:v_,jsonToTextTracks:b_,trackToJson:oo};const Fa="vjs-modal-dialog";class ws extends K{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=de("div",{className:`${Fa}-content`},{role:"document"}),this.descEl_=de("p",{className:`${Fa}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ai(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","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Fa} 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_){this.options_.fillAlways&&this.fill();return}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({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const r=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),_d(t,e),this.trigger("modalfill"),r?i.insertBefore(t,r):i.appendChild(t);const n=this.getChild("closeButton");n&&i.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),zn(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=re.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(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let r;for(let n=0;n<t.length;n++)if(i===t[n]){r=n;break}re.activeElement===this.el_&&(r=0),e.shiftKey&&r===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&r===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof D.HTMLAnchorElement||t instanceof D.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof D.HTMLInputElement||t instanceof D.HTMLSelectElement||t instanceof D.HTMLTextAreaElement||t instanceof D.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof D.HTMLIFrameElement||t instanceof D.HTMLObjectElement||t instanceof D.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}ws.prototype.options_={pauseOnOpen:!0,temporary:!0};K.registerComponent("ModalDialog",ws);class Wi extends xt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},oi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,r=this.length;i<r;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,r=this.length;i<r;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}Wi.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in Wi.prototype.allowedEvents_)Wi.prototype["on"+s]=null;const Ua=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].enabled=!1)};class Od extends Wi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Ua(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Ua(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Ua(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 ja=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].selected=!1)};class Rd extends Wi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){ja(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&ja(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,ja(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 Uo extends Wi{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_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class x_{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,r=this.trackElements_.length;i<r;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class vn{constructor(e){vn.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const r=e.length;this.cues_=e,this.length_=e.length;const n=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<r)for(i=t;i<r;i++)n.call(this,i)}getCueById(e){let t=null;for(let i=0,r=this.length;i<r;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}const S_={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},E_={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},C_={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},jl={disabled:"disabled",hidden:"hidden",showing:"showing"};class jo extends xt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+It(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(r){r!==i&&(i=r,this.trigger("labelchange"))}})}}const qo=function(s){return new URL(s,re.baseURI)},Nd=function(s){return new URL(s,re.baseURI).href},$o=function(s){if(typeof s=="string"){const t=s.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},Kn=function(s,e=D.location){return qo(s).origin!==e.origin};var w_=Object.freeze({__proto__:null,parseUrl:qo,getAbsoluteURL:Nd,getFileExtension:$o,isCrossOrigin:Kn});const ql=function(s,e){const t=new D.WebVTT.Parser(D,D.vttjs,D.WebVTT.StringDecoder()),i=[];t.oncue=function(r){e.addCue(r)},t.onparsingerror=function(r){i.push(r)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),i.length>0&&(D.console&&D.console.groupCollapsed&&D.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(r=>ve.error(r)),D.console&&D.console.groupEnd&&D.console.groupEnd()),t.flush()},$l=function(s,e){const t={uri:s},i=Kn(s);i&&(t.cors=i);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Bc(t,Ie(this,function(n,a,u){if(n)return ve.error(n,a);e.loaded_=!0,typeof D.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){ve.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return ql(u,e)}):ql(u,e)}))};class vr extends jo{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ae(e,{kind:C_[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=jl[t.mode]||"disabled";const r=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new vn(this.cues_),a=new vn(this.activeCues_);let u=!1;this.timeupdateHandler=Ie(this,function(f={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return i},set(f){jl[f]&&i!==f&&(i=f,!this.preload_&&i!=="disabled"&&this.cues.length===0&&$l(this.src,this),this.stopTracking(),i!=="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 f=this.tech_.currentTime(),g=[];for(let _=0,A=this.cues.length;_<A;_++){const S=this.cues[_];S.startTime<=f&&S.endTime>=f&&g.push(S)}if(u=!1,g.length!==this.activeCues_.length)u=!0;else for(let _=0;_<g.length;_++)this.activeCues_.indexOf(g[_])===-1&&(u=!0);return this.activeCues_=g,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&$l(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new D.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const r in e)r in t||(t[r]=e[r]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let r=0;r<i.length;r++)i[r]!==this&&i[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}toJSON(){return uo.trackToJson(this)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}vr.prototype.allowedEvents_={cuechange:"cuechange"};class Md extends jo{constructor(e={}){const t=Ae(e,{kind:E_[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(r){typeof r!="boolean"||r===i||(i=r,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Bd extends jo{constructor(e={}){const t=Ae(e,{kind:S_[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(r){typeof r!="boolean"||r===i||(i=r,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class ui extends xt{constructor(e={}){super();let t;const i=new vr(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=ui.NONE,i.addEventListener("loadeddata",()=>{t=ui.LOADED,this.trigger({type:"load",target:this})})}}ui.prototype.allowedEvents_={load:"load"};ui.NONE=0;ui.LOADING=1;ui.LOADED=2;ui.ERROR=3;const kt={audio:{ListClass:Od,TrackClass:Md,capitalName:"Audio"},video:{ListClass:Rd,TrackClass:Bd,capitalName:"Video"},text:{ListClass:Uo,TrackClass:vr,capitalName:"Text"}};Object.keys(kt).forEach(function(s){kt[s].getterName=`${s}Tracks`,kt[s].privateName=`${s}Tracks_`});const xs={remoteText:{ListClass:Uo,TrackClass:vr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:x_,TrackClass:ui,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ct=Object.assign({},kt,xs);xs.names=Object.keys(xs);kt.names=Object.keys(kt);ct.names=[].concat(xs.names).concat(kt.names);function A_(s,e,t,i,r={}){const n=s.textTracks();r.kind=e,t&&(r.label=t),i&&(r.language=i),r.tech=s;const a=new ct.text.TrackClass(r);return n.addTrack(a),a}class me extends K{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),ct.names.forEach(i=>{const r=ct[i];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}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 ct.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(Ie(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 Bt(0,0)}bufferedPercent(){return Ld(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(kt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let r=i.length;for(;r--;){const n=i[r];t==="text"&&this.removeRemoteTextTrack(n),i.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Fe(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Bt(0,0):Bt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){kt.names.forEach(e=>{const t=kt[e],i=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),this.on("dispose",()=>{r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!D.WebVTT)if(re.body.contains(this.el())){if(!this.options_["vtt.js"]&&ys(hl)&&Object.keys(hl).length>0){this.trigger("vttjsloaded");return}const e=re.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}),D.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=u=>e.addTrack(u.track),r=u=>e.removeTrack(u.track);t.on("addtrack",i),t.on("removetrack",r),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let u=0;u<e.length;u++){const c=e[u];c.removeEventListener("cuechange",n),c.mode==="showing"&&c.addEventListener("cuechange",n)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",r),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let u=0;u<e.length;u++)e[u].removeEventListener("cuechange",n)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return A_(this,e,t,i)}createRemoteTextTrack(e){const t=Ae(e,{tech:this});return new xs.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}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=It();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 me.canPlayType(e.type)}static isTech(e){return e.prototype instanceof me||e instanceof me||e===me}static registerTech(e,t){if(me.techs_||(me.techs_={}),!me.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!me.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!me.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=je(e),me.techs_[e]=t,me.techs_[lr(e)]=t,e!=="Tech"&&me.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(me.techs_&&me.techs_[e])return me.techs_[e];if(e=je(e),D&&D.videojs&&D.videojs[e])return ve.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),D.videojs[e]}}}ct.names.forEach(function(s){const e=ct[s];me.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});me.prototype.featuresVolumeControl=!0;me.prototype.featuresMuteControl=!0;me.prototype.featuresFullscreenResize=!1;me.prototype.featuresPlaybackRate=!1;me.prototype.featuresProgressEvents=!1;me.prototype.featuresSourceset=!1;me.prototype.featuresTimeupdateEvents=!1;me.prototype.featuresNativeTextTracks=!1;me.prototype.featuresVideoFrameCallback=!1;me.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let r=s.sourceHandlers;r||(r=s.sourceHandlers=[]),i===void 0&&(i=r.length),r.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let r;for(let n=0;n<i.length;n++)if(r=i[n].canPlayType(t),r)return r;return""},s.selectSourceHandler=function(t,i){const r=s.sourceHandlers||[];let n;for(let a=0;a<r.length;a++)if(n=r[a].canHandleSource(t,i),n)return r[a];return null},s.canPlaySource=function(t,i){const r=s.selectSourceHandler(t,i);return r?r.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(t){let i=s.selectSourceHandler(t,this.options_);i||(s.nativeSourceHandler?i=s.nativeSourceHandler:ve.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==s.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},s.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};K.registerComponent("Tech",me);me.registerTech("Tech",me);me.defaultTechOrder_=[];const Vi={},bn={},xn={};function D_(s,e){Vi[s]=Vi[s]||[],Vi[s].push(e)}function k_(s,e,t){s.setTimeout(()=>Bi(e,Vi[e.type],t,s),1)}function I_(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function P_(s,e,t){return s.reduceRight(Vo(t),e[t]())}function L_(s,e,t,i){return e[t](s.reduce(Vo(t),i))}function Vl(s,e,t,i=null){const r="call"+je(t),n=s.reduce(Vo(r),i),a=n===xn,u=a?null:e[t](n);return N_(s,t,u,a),u}const O_={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},R_={setCurrentTime:1,setMuted:1,setVolume:1},Hl={play:1,pause:1};function Vo(s){return(e,t)=>e===xn?xn:t[s]?t[s](e):e}function N_(s,e,t,i){for(let r=s.length-1;r>=0;r--){const n=s[r];n[e]&&n[e](i,t)}}function M_(s){bn.hasOwnProperty(s.id())&&delete bn[s.id()]}function B_(s,e){const t=bn[s.id()];let i=null;if(t==null)return i=e(s),bn[s.id()]=[[e,i]],i;for(let r=0;r<t.length;r++){const[n,a]=t[r];n===e&&(i=a)}return i===null&&(i=e(s),t.push([e,i])),i}function Bi(s={},e=[],t,i,r=[],n=!1){const[a,...u]=e;if(typeof a=="string")Bi(s,Vi[a],t,i,r,n);else if(a){const c=B_(i,a);if(!c.setSource)return r.push(c),Bi(s,u,t,i,r,n);c.setSource(Object.assign({},s),function(f,g){if(f)return Bi(s,u,t,i,r,n);r.push(c),Bi(g,s.type===g.type?u:Vi[g.type],t,i,r,n)})}else u.length?Bi(s,u,t,i,r,n):n?t(s,r):Bi(s,Vi["*"],t,i,r,!0)}const F_={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},Sn=function(s=""){const e=$o(s);return F_[e.toLowerCase()]||""},U_=(s,e)=>{if(!e)return"";if(s.cache_.source.src===e&&s.cache_.source.type)return s.cache_.source.type;const t=s.cache_.sources.filter(r=>r.src===e);if(t.length)return t[0].type;const i=s.$$("source");for(let r=0;r<i.length;r++){const n=i[r];if(n.type&&n.src&&n.src===e)return n.type}return Sn(e)},Fd=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=Fd(t),Array.isArray(t)?e=e.concat(t):Yt(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[zl({src:s})]:Yt(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[zl(s)]:s=[];return s};function zl(s){if(!s.type){const e=Sn(s.src);e&&(s.type=e)}return s}var j_=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
16
|
+
`)}function f(I){this.options=I||{locator:{}}}f.prototype.parseFromString=function(I,M){var N=this.options,O=new u,j=N.domBuilder||new _,F=N.errorHandler,U=N.locator,R=N.xmlns||{},H=/\/x?html?$/.test(M),v=H?t.HTML_ENTITIES:t.XML_ENTITIES;U&&j.setDocumentLocator(U),O.errorHandler=g(F,j,U),O.domBuilder=N.domBuilder||j,H&&(R[""]=n.HTML),R.xml=R.xml||n.XML;var E=N.normalizeLineEndings||l;return I&&typeof I=="string"?O.parse(E(I),R,v):O.errorHandler.error("invalid doc source"),j.doc};function g(I,M,N){if(!I){if(M instanceof _)return M;I=M}var O={},j=I instanceof Function;N=N||{};function F(U){var R=I[U];!R&&j&&(R=I.length==2?function(H){I(U,H)}:I),O[U]=R&&function(H){R("[xmldom "+U+"] "+H+x(N))}||function(){}}return F("warning"),F("error"),F("fatalError"),O}function _(){this.cdata=!1}function A(I,M){M.lineNumber=I.lineNumber,M.columnNumber=I.columnNumber}_.prototype={startDocument:function(){this.doc=new r().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(I,M,N,O){var j=this.doc,F=j.createElementNS(I,N||M),U=O.length;T(this,F),this.currentElement=F,this.locator&&A(this.locator,F);for(var R=0;R<U;R++){var I=O.getURI(R),H=O.getValue(R),N=O.getQName(R),v=j.createAttributeNS(I,N);this.locator&&A(O.getLocator(R),v),v.value=v.nodeValue=H,F.setAttributeNode(v)}},endElement:function(I,M,N){var O=this.currentElement;O.tagName,this.currentElement=O.parentNode},startPrefixMapping:function(I,M){},endPrefixMapping:function(I){},processingInstruction:function(I,M){var N=this.doc.createProcessingInstruction(I,M);this.locator&&A(this.locator,N),T(this,N)},ignorableWhitespace:function(I,M,N){},characters:function(I,M,N){if(I=L.apply(this,arguments),I){if(this.cdata)var O=this.doc.createCDATASection(I);else var O=this.doc.createTextNode(I);this.currentElement?this.currentElement.appendChild(O):/^\s*$/.test(I)&&this.doc.appendChild(O),this.locator&&A(this.locator,O)}},skippedEntity:function(I){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(I){(this.locator=I)&&(I.lineNumber=0)},comment:function(I,M,N){I=L.apply(this,arguments);var O=this.doc.createComment(I);this.locator&&A(this.locator,O),T(this,O)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(I,M,N){var O=this.doc.implementation;if(O&&O.createDocumentType){var j=O.createDocumentType(I,M,N);this.locator&&A(this.locator,j),T(this,j),this.doc.doctype=j}},warning:function(I){console.warn("[xmldom warning] "+I,x(this.locator))},error:function(I){console.error("[xmldom error] "+I,x(this.locator))},fatalError:function(I){throw new a(I,this.locator)}};function x(I){if(I)return`
|
|
17
|
+
@`+(I.systemId||"")+"#[line:"+I.lineNumber+",col:"+I.columnNumber+"]"}function L(I,M,N){return typeof I=="string"?I.substr(M,N):I.length>=M+N||M?new java.lang.String(I,M,N)+"":I}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(I){_.prototype[I]=function(){return null}});function T(I,M){I.currentElement?I.currentElement.appendChild(M):I.doc.appendChild(M)}return er.__DOMHandler=_,er.normalizeLineEndings=l,er.DOMParser=f,er}var Dl;function o0(){if(Dl)return Zs;Dl=1;var s=sd();return Zs.DOMImplementation=s.DOMImplementation,Zs.XMLSerializer=s.XMLSerializer,Zs.DOMParser=a0().DOMParser,Zs}var u0=o0();const kl=s=>!!s&&typeof s=="object",et=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):kl(e[i])&&kl(t[i])?e[i]=et(e[i],t[i]):e[i]=t[i]}),e),{}),rd=s=>Object.keys(s).map(e=>s[e]),l0=(s,e)=>{const t=[];for(let i=s;i<e;i++)t.push(i);return t},_s=s=>s.reduce((e,t)=>e.concat(t),[]),nd=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},c0=(s,e)=>s.reduce((t,i,r)=>(i[e]&&t.push(r),t),[]),d0=(s,e)=>rd(s.reduce((t,i)=>(i.forEach(r=>{t[e(r)]=r}),t),{}));var ys={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const pr=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const r={uri:e,resolvedUri:Rn(s||"",e)};if(t||i){const a=(t||i).split("-");let u=D.BigInt?D.BigInt(a[0]):parseInt(a[0],10),l=D.BigInt?D.BigInt(a[1]):parseInt(a[1],10);u<Number.MAX_SAFE_INTEGER&&typeof u=="bigint"&&(u=Number(u)),l<Number.MAX_SAFE_INTEGER&&typeof l=="bigint"&&(l=Number(l));let f;typeof l=="bigint"||typeof u=="bigint"?f=D.BigInt(l)-D.BigInt(u)+D.BigInt(1):f=l-u+1,typeof f=="bigint"&&f<Number.MAX_SAFE_INTEGER&&(f=Number(f)),r.byterange={length:f,offset:u}}return r},h0=s=>{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=D.BigInt(s.offset)+D.BigInt(s.length)-D.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},Il=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),f0={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:r}=s,n=Il(s.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:i/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:r=1,duration:n,periodStart:a=0,minimumUpdatePeriod:u=0,timeShiftBufferDepth:l=1/0}=s,f=Il(s.endNumber),g=(e+t)/1e3,_=i+a,x=g+u-_,L=Math.ceil(x*r/n),T=Math.floor((g-_-l)*r/n),I=Math.floor((g-_)*r/n);return{start:Math.max(0,T),end:typeof f=="number"?f:Math.min(L,I)}}},p0=s=>e=>{const{duration:t,timescale:i=1,periodStart:r,startNumber:n=1}=s;return{number:n+e,duration:t/i,timeline:r,time:e*t}},Po=s=>{const{type:e,duration:t,timescale:i=1,periodDuration:r,sourceDuration:n}=s,{start:a,end:u}=f0[e](s),l=l0(a,u).map(p0(s));if(e==="static"){const f=l.length-1,g=typeof r=="number"?r:n;l[f].duration=g-t/i*f}return l},ad=s=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:r="",periodStart:n,presentationTime:a,number:u=0,duration:l}=s;if(!e)throw new Error(ys.NO_BASE_URL);const f=pr({baseUrl:e,source:t.sourceURL,range:t.range}),g=pr({baseUrl:e,source:e,indexRange:r});if(g.map=f,l){const _=Po(s);_.length&&(g.duration=_[0].duration,g.timeline=_[0].timeline)}else i&&(g.duration=i,g.timeline=n);return g.presentationTime=a||n,g.number=u,[g]},Lo=(s,e,t)=>{const i=s.sidx.map?s.sidx.map:null,r=s.sidx.duration,n=s.timeline||0,a=s.sidx.byterange,u=a.offset+a.length,l=e.timescale,f=e.references.filter(I=>I.referenceType!==1),g=[],_=s.endList?"static":"dynamic",A=s.sidx.timeline;let x=A,L=s.mediaSequence||0,T;typeof e.firstOffset=="bigint"?T=D.BigInt(u)+e.firstOffset:T=u+e.firstOffset;for(let I=0;I<f.length;I++){const M=e.references[I],N=M.referencedSize,O=M.subsegmentDuration;let j;typeof T=="bigint"?j=T+D.BigInt(N)-D.BigInt(1):j=T+N-1;const F=`${T}-${j}`,R=ad({baseUrl:t,timescale:l,timeline:n,periodStart:A,presentationTime:x,number:L,duration:O,sourceDuration:r,indexRange:F,type:_})[0];i&&(R.map=i),g.push(R),typeof T=="bigint"?T+=D.BigInt(N):T+=N,x+=O/l,L++}return s.segments=g,s},m0=["AUDIO","SUBTITLES"],g0=1/60,od=s=>d0(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),_0=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Pl=s=>{let e=[];return s0(s,m0,(t,i,r,n)=>{e=e.concat(t.playlists||[])}),e},Ll=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},y0=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:l}){return l===i.timeline});const r=_0(s,i.attributes.NAME);if(!r||i.sidx)return;const n=i.segments[0],a=r.segments.findIndex(function(l){return Math.abs(l.presentationTime-n.presentationTime)<g0});if(a===-1){Ll({playlist:i,mediaSequence:r.mediaSequence+r.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!r.segments.length&&i.timeline>r.timeline||r.segments.length&&i.timeline>r.segments[r.segments.length-1].timeline)&&i.discontinuitySequence--;return}r.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),Ll({playlist:i,mediaSequence:r.segments[a].number})})},T0=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Pl(s)),i=e.playlists.concat(Pl(e));return e.timelineStarts=od([s.timelineStarts,e.timelineStarts]),y0({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Mn=s=>s&&s.uri+"-"+h0(s.byterange),Oa=s=>{const e=s.reduce(function(i,r){return i[r.attributes.baseUrl]||(i[r.attributes.baseUrl]=[]),i[r.attributes.baseUrl].push(r),i},{});let t=[];return Object.values(e).forEach(i=>{const r=rd(i.reduce((n,a)=>{const u=a.attributes.id+(a.attributes.lang||"");return n[u]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[u].segments.push(...a.segments)),a.attributes.contentProtection&&(n[u].attributes.contentProtection=a.attributes.contentProtection)):(n[u]=a,n[u].attributes.timelineStarts=[]),n[u].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(r)}),t.map(i=>(i.discontinuityStarts=c0(i.segments||[],"discontinuity"),i))},Oo=(s,e)=>{const t=Mn(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&Lo(s,i,s.sidx.resolvedUri),s},v0=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Oo(s[t],e);return s},b0=({attributes:s,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:r,discontinuityStarts:n},a)=>{const u={attributes:{NAME:s.id,BANDWIDTH:s.bandwidth,CODECS:s.codecs,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuitySequence:r,discontinuityStarts:n,timelineStarts:s.timelineStarts,mediaSequence:i,segments:e};return s.contentProtection&&(u.contentProtection=s.contentProtection),s.serviceLocation&&(u.attributes.serviceLocation=s.serviceLocation),t&&(u.sidx=t),a&&(u.attributes.AUDIO="audio",u.attributes.SUBTITLES="subs"),u},x0=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:r})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const n={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(n.CODECS=s.codecs);const a={attributes:n,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:i,discontinuitySequence:r,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},S0=(s,e={},t=!1)=>{let i;const r=s.reduce((n,a)=>{const u=a.attributes.role&&a.attributes.role.value||"",l=a.attributes.lang||"";let f=a.attributes.label||"main";if(l&&!a.attributes.label){const _=u?` (${u})`:"";f=`${a.attributes.lang}${_}`}n[f]||(n[f]={language:l,autoselect:!0,default:u==="main",playlists:[],uri:""});const g=Oo(b0(a,t),e);return n[f].playlists.push(g),typeof i>"u"&&u==="main"&&(i=a,i.default=!0),n},{});if(!i){const n=Object.keys(r)[0];r[n].default=!0}return r},E0=(s,e={})=>s.reduce((t,i)=>{const r=i.attributes.label||i.attributes.lang||"text",n=i.attributes.lang||"und";return t[r]||(t[r]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[r].playlists.push(Oo(x0(i),e)),t},{}),C0=s=>s.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:r,language:n}=i;e[n]={autoselect:!1,default:!1,instreamId:r,language:n},i.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[n].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[n]["3D"]=i["3D"])}),e),{}),w0=({attributes:s,segments:e,sidx:t,discontinuityStarts:i})=>{const r={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:i,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(r.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(r.contentProtection=s.contentProtection),s.serviceLocation&&(r.attributes.serviceLocation=s.serviceLocation),t&&(r.sidx=t),r},A0=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",D0=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",k0=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",I0=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,r)=>{i.number=r})})},Ol=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],P0=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:r,eventStream:n})=>{if(!s.length)return{};const{sourceDuration:a,type:u,suggestedPresentationDelay:l,minimumUpdatePeriod:f}=s[0].attributes,g=Oa(s.filter(A0)).map(w0),_=Oa(s.filter(D0)),A=Oa(s.filter(k0)),x=s.map(j=>j.attributes.captionServices).filter(Boolean),L={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:v0(g,i)};f>=0&&(L.minimumUpdatePeriod=f*1e3),e&&(L.locations=e),t&&(L.contentSteering=t),u==="dynamic"&&(L.suggestedPresentationDelay=l),n&&n.length>0&&(L.eventStream=n);const T=L.playlists.length===0,I=_.length?S0(_,i,T):null,M=A.length?E0(A,i):null,N=g.concat(Ol(I),Ol(M)),O=N.map(({timelineStarts:j})=>j);return L.timelineStarts=od(O),I0(N,L.timelineStarts),I&&(L.mediaGroups.AUDIO.audio=I),M&&(L.mediaGroups.SUBTITLES.subs=M),x.length&&(L.mediaGroups["CLOSED-CAPTIONS"].cc=C0(x)),r?T0({oldManifest:r,newManifest:L}):L},L0=(s,e,t)=>{const{NOW:i,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:u=0,minimumUpdatePeriod:l=0}=s,f=(i+r)/1e3,g=n+u,A=f+l-g;return Math.ceil((A*a-e)/t)},ud=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:u=1,periodStart:l}=s,f=[];let g=-1;for(let _=0;_<e.length;_++){const A=e[_],x=A.d,L=A.r||0,T=A.t||0;g<0&&(g=T),T&&T>g&&(g=T);let I;if(L<0){const O=_+1;O===e.length?t==="dynamic"&&i>0&&r.indexOf("$Number$")>0?I=L0(s,g,x):I=(n*a-g)/x:I=(e[O].t-g)/x}else I=L+1;const M=u+f.length+I;let N=u+f.length;for(;N<M;)f.push({number:N,duration:x/a,time:g,timeline:l}),g+=x,N++}return f},O0=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,R0=s=>(e,t,i,r)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const n=""+s[t];return t==="RepresentationID"||(i?r=parseInt(r,10):r=1,n.length>=r)?n:`${new Array(r-n.length+1).join("0")}${n}`},Rl=(s,e)=>s.replace(O0,R0(e)),N0=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Po(s):ud(s,e),M0=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,r=pr({baseUrl:s.baseUrl,source:Rl(i.sourceURL,t),range:i.range});return N0(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const u=Rl(s.media||"",t),l=s.timescale||1,f=s.presentationTimeOffset||0,g=s.periodStart+(a.time-f)/l;return{uri:u,timeline:a.timeline,duration:a.duration,resolvedUri:Rn(s.baseUrl||"",u),map:r,number:a.number,presentationTime:g}})},B0=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,r=pr({baseUrl:t,source:i.sourceURL,range:i.range}),n=pr({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=r,n},F0=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(ys.SEGMENT_TIME_UNSPECIFIED);const n=i.map(l=>B0(s,l));let a;return t&&(a=Po(s)),e&&(a=ud(s,e)),a.map((l,f)=>{if(n[f]){const g=n[f],_=s.timescale||1,A=s.presentationTimeOffset||0;return g.timeline=l.timeline,g.duration=l.duration,g.number=l.number,g.presentationTime=r+(l.time-A)/_,g}}).filter(l=>l)},U0=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=M0,t=et(s,e.template)):e.base?(i=ad,t=et(s,e.base)):e.list&&(i=F0,t=et(s,e.list));const r={attributes:s};if(!i)return r;const n=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:u=1}=t;t.duration=a/u}else n.length?t.duration=n.reduce((a,u)=>Math.max(a,Math.ceil(u.duration)),0):t.duration=0;return r.attributes=t,r.segments=n,e.base&&t.indexRange&&(r.sidx=n[0],r.segments=[]),r},j0=s=>s.map(U0),Fe=(s,e)=>nd(s.childNodes).filter(({tagName:t})=>t===e),vr=s=>s.textContent.trim(),q0=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),es=s=>{const u=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!u)return 0;const[l,f,g,_,A,x]=u.slice(1);return parseFloat(l||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(g||0)*86400+parseFloat(_||0)*3600+parseFloat(A||0)*60+parseFloat(x||0)},$0=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),Nl={mediaPresentationDuration(s){return es(s)},availabilityStartTime(s){return $0(s)/1e3},minimumUpdatePeriod(s){return es(s)},suggestedPresentationDelay(s){return es(s)},type(s){return s},timeShiftBufferDepth(s){return es(s)},start(s){return es(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return q0(s)},startNumber(s){return parseInt(s,10)},timescale(s){return parseInt(s,10)},presentationTimeOffset(s){return parseInt(s,10)},duration(s){const e=parseInt(s,10);return isNaN(e)?es(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},Ke=s=>s&&s.attributes?nd(s.attributes).reduce((e,t)=>{const i=Nl[t.name]||Nl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},V0={"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","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Bn=(s,e)=>e.length?_s(s.map(function(t){return e.map(function(i){const r=vr(i),n=Rn(t.baseUrl,r),a=et(Ke(i),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,Ro=s=>{const e=Fe(s,"SegmentTemplate")[0],t=Fe(s,"SegmentList")[0],i=t&&Fe(t,"SegmentURL").map(_=>et({tag:"SegmentURL"},Ke(_))),r=Fe(s,"SegmentBase")[0],n=t||e,a=n&&Fe(n,"SegmentTimeline")[0],u=t||r||e,l=u&&Fe(u,"Initialization")[0],f=e&&Ke(e);f&&l?f.initialization=l&&Ke(l):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const g={template:f,segmentTimeline:a&&Fe(a,"S").map(_=>Ke(_)),list:t&&et(Ke(t),{segmentUrls:i,initialization:Ke(l)}),base:r&&et(Ke(r),{initialization:Ke(l)})};return Object.keys(g).forEach(_=>{g[_]||delete g[_]}),g},H0=(s,e,t)=>i=>{const r=Fe(i,"BaseURL"),n=Bn(e,r),a=et(s,Ke(i)),u=Ro(i);return n.map(l=>({segmentInfo:et(t,u),attributes:et(a,l)}))},z0=s=>s.reduce((e,t)=>{const i=Ke(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const r=V0[i.schemeIdUri];if(r){e[r]={attributes:i};const n=Fe(t,"cenc:pssh")[0];if(n){const a=vr(n);e[r].pssh=a&&Qc(a)}}return e},{}),G0=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{let i,r;return r=t,/^CC\d=/.test(t)?[i,r]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:r}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[r,n=""]=t.split("=");i.channel=r,i.language=t,n.split(",").forEach(a=>{const[u,l]=a.split(":");u==="lang"?i.language=l:u==="er"?i.easyReader=Number(l):u==="war"?i.aspectRatio=Number(l):u==="3D"&&(i["3D"]=Number(l))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},W0=s=>_s(Fe(s.node,"EventStream").map(e=>{const t=Ke(e),i=t.schemeIdUri;return Fe(e,"Event").map(r=>{const n=Ke(r),a=n.presentationTime||0,u=t.timescale||1,l=n.duration||0,f=a/u+s.attributes.start;return{schemeIdUri:i,value:t.value,id:n.id,start:f,end:f+l/u,messageData:vr(r)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),X0=(s,e,t)=>i=>{const r=Ke(i),n=Bn(e,Fe(i,"BaseURL")),a=Fe(i,"Role")[0],u={role:Ke(a)};let l=et(s,r,u);const f=Fe(i,"Accessibility")[0],g=G0(Ke(f));g&&(l=et(l,{captionServices:g}));const _=Fe(i,"Label")[0];if(_&&_.childNodes.length){const I=_.childNodes[0].nodeValue.trim();l=et(l,{label:I})}const A=z0(Fe(i,"ContentProtection"));Object.keys(A).length&&(l=et(l,{contentProtection:A}));const x=Ro(i),L=Fe(i,"Representation"),T=et(t,x);return _s(L.map(H0(l,n,T)))},K0=(s,e)=>(t,i)=>{const r=Bn(e,Fe(t.node,"BaseURL")),n=et(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Fe(t.node,"AdaptationSet"),u=Ro(t.node);return _s(a.map(X0(n,r,u)))},Y0=(s,e)=>{if(s.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!s.length)return null;const t=et({serverURL:vr(s[0])},Ke(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},Q0=({attributes:s,priorPeriodAttributes:e,mpdType:t})=>typeof s.start=="number"?s.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,J0=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=Fe(s,"Period");if(!a.length)throw new Error(ys.INVALID_NUMBER_OF_PERIOD);const u=Fe(s,"Location"),l=Ke(s),f=Bn([{baseUrl:t}],Fe(s,"BaseURL")),g=Fe(s,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=i,l.clientOffset=r,u.length&&(l.locations=u.map(vr));const _=[];return a.forEach((A,x)=>{const L=Ke(A),T=_[x-1];L.start=Q0({attributes:L,priorPeriodAttributes:T?T.attributes:null,mpdType:l.type}),_.push({node:A,attributes:L})}),{locations:l.locations,contentSteeringInfo:Y0(g,n),representationInfo:_s(_.map(K0(l,f))),eventStream:_s(_.map(W0))}},ld=s=>{if(s==="")throw new Error(ys.DASH_EMPTY_MANIFEST);const e=new u0.DOMParser;let t,i;try{t=e.parseFromString(s,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(ys.DASH_INVALID_XML);return i},Z0=s=>{const e=Fe(s,"UTCTiming")[0];if(!e)return null;const t=Ke(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(ys.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},e_=(s,e={})=>{const t=J0(ld(s),e),i=j0(t.representationInfo);return P0({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},t_=s=>Z0(ld(s));var Ra,Ml;function i_(){if(Ml)return Ra;Ml=1;var s=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),r;return i.getBigUint64?(r=i.getBigUint64(0),r<Number.MAX_SAFE_INTEGER?Number(r):r):i.getUint32(0)*s+i.getUint32(4)};return Ra={getUint64:e,MAX_UINT32:s},Ra}var Na,Bl;function s_(){if(Bl)return Na;Bl=1;var s=i_().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},n=12;r.version===0?(r.earliestPresentationTime=i.getUint32(n),r.firstOffset=i.getUint32(n+4),n+=8):(r.earliestPresentationTime=s(t.subarray(n)),r.firstOffset=s(t.subarray(n+8)),n+=16),n+=2;var a=i.getUint16(n);for(n+=2;a>0;n+=12,a--)r.references.push({referenceType:(t[n]&128)>>>7,referencedSize:i.getUint32(n)&2147483647,subsegmentDuration:i.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:i.getUint32(n+8)&268435455});return r};return Na=e,Na}var r_=s_();const n_=Tr(r_);var a_=he([73,68,51]),o_=function(e,t){t===void 0&&(t=0),e=he(e);var i=e[t+5],r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(i&16)>>4;return n?r+20:r+10},nr=function s(e,t){return t===void 0&&(t=0),e=he(e),e.length-t<10||!Be(e,a_,{offset:t})?t:(t+=o_(e,t),s(e,t))},Fl=function(e){return typeof e=="string"?id(e):e},u_=function(e){return Array.isArray(e)?e.map(function(t){return Fl(t)}):[Fl(e)]},l_=function s(e,t,i){i===void 0&&(i=!1),t=u_(t),e=he(e);var r=[];if(!t.length)return r;for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,u=e.subarray(n+4,n+8);if(a===0)break;var l=n+a;if(l>e.length){if(i)break;l=e.length}var f=e.subarray(n+8,l);Be(u,t[0])&&(t.length===1?r.push(f):r.push.apply(r,s(f,t.slice(1),i))),n=l}return r},sn={EBML:he([26,69,223,163]),DocType:he([66,130]),Segment:he([24,83,128,103]),SegmentInfo:he([21,73,169,102]),Tracks:he([22,84,174,107]),Track:he([174]),TrackNumber:he([215]),DefaultDuration:he([35,227,131]),TrackEntry:he([174]),TrackType:he([131]),FlagDefault:he([136]),CodecID:he([134]),CodecPrivate:he([99,162]),VideoTrack:he([224]),AudioTrack:he([225]),Cluster:he([31,67,182,117]),Timestamp:he([231]),TimestampScale:he([42,215,177]),BlockGroup:he([160]),BlockDuration:he([155]),Block:he([161]),SimpleBlock:he([163])},to=[128,64,32,16,8,4,2,1],c_=function(e){for(var t=1,i=0;i<to.length&&!(e&to[i]);i++)t++;return t},fn=function(e,t,i,r){i===void 0&&(i=!0),r===void 0&&(r=!1);var n=c_(e[t]),a=e.subarray(t,t+n);return i&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=to[n-1]),{length:n,value:e0(a,{signed:r}),bytes:a}},Ul=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?t0(e):e},d_=function(e){return Array.isArray(e)?e.map(function(t){return Ul(t)}):[Ul(e)]},h_=function s(e,t,i){if(i>=t.length)return t.length;var r=fn(t,i,!1);if(Be(e.bytes,r.bytes))return i;var n=fn(t,i+r.length);return s(e,t,i+n.length+n.value+r.length)},jl=function s(e,t){t=d_(t),e=he(e);var i=[];if(!t.length)return i;for(var r=0;r<e.length;){var n=fn(e,r,!1),a=fn(e,r+n.length),u=r+n.length+a.length;a.value===127&&(a.value=h_(n,e,u),a.value!==e.length&&(a.value-=u));var l=u+a.value>e.length?e.length:u+a.value,f=e.subarray(u,l);Be(t[0],n.bytes)&&(t.length===1?i.push(f):i=i.concat(s(f,t.slice(1))));var g=n.length+a.length+f.length;r+=g}return i},f_=he([0,0,0,1]),p_=he([0,0,1]),m_=he([0,0,3]),g_=function(e){for(var t=[],i=1;i<e.length-2;)Be(e.subarray(i,i+3),m_)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var r=e.length-t.length,n=new Uint8Array(r),a=0;for(i=0;i<r;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=e[a];return n},cd=function(e,t,i,r){e=he(e),i=[].concat(i);for(var n=0,a,u=0;n<e.length&&(u<r||a);){var l=void 0;if(Be(e.subarray(n),f_)?l=4:Be(e.subarray(n),p_)&&(l=3),!l){n++;continue}if(u++,a)return g_(e.subarray(a,n));var f=void 0;t==="h264"?f=e[n+l]&31:t==="h265"&&(f=e[n+l]>>1&63),i.indexOf(f)!==-1&&(a=n+l),n+=l+(t==="h264"?1:2)}return e.subarray(0,0)},__=function(e,t,i){return cd(e,"h264",t,i)},y_=function(e,t,i){return cd(e,"h265",t,i)},dt={webm:he([119,101,98,109]),matroska:he([109,97,116,114,111,115,107,97]),flac:he([102,76,97,67]),ogg:he([79,103,103,83]),ac3:he([11,119]),riff:he([82,73,70,70]),avi:he([65,86,73]),wav:he([87,65,86,69]),"3gp":he([102,116,121,112,51,103]),mp4:he([102,116,121,112]),fmp4:he([115,116,121,112]),mov:he([102,116,121,112,113,116]),moov:he([109,111,111,118]),moof:he([109,111,111,102])},Ts={aac:function(e){var t=nr(e);return Be(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=nr(e);return Be(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=jl(e,[sn.EBML,sn.DocType])[0];return Be(t,dt.webm)},mkv:function(e){var t=jl(e,[sn.EBML,sn.DocType])[0];return Be(t,dt.matroska)},mp4:function(e){if(Ts["3gp"](e)||Ts.mov(e))return!1;if(Be(e,dt.mp4,{offset:4})||Be(e,dt.fmp4,{offset:4})||Be(e,dt.moof,{offset:4})||Be(e,dt.moov,{offset:4}))return!0},mov:function(e){return Be(e,dt.mov,{offset:4})},"3gp":function(e){return Be(e,dt["3gp"],{offset:4})},ac3:function(e){var t=nr(e);return Be(e,dt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=nr(e);return Be(e,dt.flac,{offset:t})},ogg:function(e){return Be(e,dt.ogg)},avi:function(e){return Be(e,dt.riff)&&Be(e,dt.avi,{offset:8})},wav:function(e){return Be(e,dt.riff)&&Be(e,dt.wav,{offset:8})},h264:function(e){return __(e,7,3).length},h265:function(e){return y_(e,[32,33],3).length}},io=Object.keys(Ts).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);io.forEach(function(s){var e=Ts[s];Ts[s]=function(t){return e(he(t))}});var T_=Ts,No=function(e){e=he(e);for(var t=0;t<io.length;t++){var i=io[t];if(T_[i](e))return i}return""},v_=function(e){return l_(e,["moof"]).length>0},Ma,ql;function b_(){if(ql)return Ma;ql=1;var s=9e4,e,t,i,r,n,a,u;return e=function(l){return l*s},t=function(l,f){return l*f},i=function(l){return l/s},r=function(l,f){return l/f},n=function(l,f){return e(r(l,f))},a=function(l,f){return t(i(l),f)},u=function(l,f,g){return i(g?l:l-f)},Ma={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:r,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:u},Ma}var ji=b_();var so="8.23.4";const ai={},Ci=function(s,e){return ai[s]=ai[s]||[],e&&(ai[s]=ai[s].concat(e)),ai[s]},x_=function(s,e){Ci(s,e)},dd=function(s,e){const t=Ci(s).indexOf(e);return t<=-1?!1:(ai[s]=ai[s].slice(),ai[s].splice(t,1),!0)},S_=function(s,e){Ci(s,[].concat(e).map(t=>{const i=(...r)=>(dd(s,i),t(...r));return i}))},pn={prefixed:!0},ln=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],$l=ln[0];let ar;for(let s=0;s<ln.length;s++)if(ln[s][1]in re){ar=ln[s];break}if(ar){for(let s=0;s<ar.length;s++)pn[$l[s]]=ar[s];pn.prefixed=ar[0]!==$l[0]}let mt=[];const E_=(s,e,t)=>(i,r,n)=>{const a=e.levels[r],u=new RegExp(`^(${a})$`);let l=s;if(i!=="log"&&n.unshift(i.toUpperCase()+":"),t&&(l=`%c${s}`,n.unshift(t)),n.unshift(l+":"),mt){mt.push([].concat(n));const g=mt.length-1e3;mt.splice(0,g>0?g:0)}if(!D.console)return;let f=D.console[i];!f&&i==="debug"&&(f=D.console.info||D.console.log),!(!f||!a||!u.test(i))&&f[Array.isArray(n)?"apply":"call"](D.console,n)};function ro(s,e=":",t=""){let i="info",r;function n(...a){r("log",i,a)}return r=E_(s,n,t),n.createLogger=(a,u,l)=>{const f=u!==void 0?u:e,g=l!==void 0?l:t,_=`${s} ${f} ${a}`;return ro(_,f,g)},n.createNewLogger=(a,u,l)=>ro(a,u,l),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},n.history=()=>mt?[].concat(mt):[],n.history.filter=a=>(mt||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),n.history.clear=()=>{mt&&(mt.length=0)},n.history.disable=()=>{mt!==null&&(mt.length=0,mt=null)},n.history.enable=()=>{mt===null&&(mt=[])},n.error=(...a)=>r("error",i,a),n.warn=(...a)=>r("warn",i,a),n.debug=(...a)=>r("debug",i,a),n}const ve=ro("VIDEOJS"),hd=ve.createLogger,C_=Object.prototype.toString,fd=function(s){return Zt(s)?Object.keys(s):[]};function os(s,e){fd(s).forEach(t=>e(s[t],t))}function pd(s,e,t=0){return fd(s).reduce((i,r)=>e(i,s[r],r),t)}function Zt(s){return!!s&&typeof s=="object"}function vs(s){return Zt(s)&&C_.call(s)==="[object Object]"&&s.constructor===Object}function ke(...s){const e={};return s.forEach(t=>{t&&os(t,(i,r)=>{if(!vs(i)){e[r]=i;return}vs(e[r])||(e[r]={}),e[r]=ke(e[r],i)})}),e}function md(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function Fn(s,e,t,i=!0){const r=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return r(a),a}};return i&&(n.set=r),Object.defineProperty(s,e,n)}var w_=Object.freeze({__proto__:null,each:os,reduce:pd,isObject:Zt,isPlain:vs,merge:ke,values:md,defineLazyProperty:Fn});let Mo=!1,gd=null,jt=!1,_d,yd=!1,us=!1,ls=!1,ei=!1,Bo=null,Un=null;const A_=!!(D.cast&&D.cast.framework&&D.cast.framework.CastReceiverContext);let Td=null,mn=!1,jn=!1,gn=!1,qn=!1,_n=!1,yn=!1,Tn=!1;const mr=!!(Cs()&&("ontouchstart"in D||D.navigator.maxTouchPoints||D.DocumentTouch&&D.document instanceof D.DocumentTouch)),Ti=D.navigator&&D.navigator.userAgentData;Ti&&Ti.platform&&Ti.brands&&(jt=Ti.platform==="Android",us=!!Ti.brands.find(s=>s.brand==="Microsoft Edge"),ls=!!Ti.brands.find(s=>s.brand==="Chromium"),ei=!us&&ls,Bo=Un=(Ti.brands.find(s=>s.brand==="Chromium")||{}).version||null,jn=Ti.platform==="Windows");if(!ls){const s=D.navigator&&D.navigator.userAgent||"";Mo=/iPod/i.test(s),gd=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),jt=/Android/i.test(s),_d=(function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null})(),yd=/Firefox/i.test(s),us=/Edg/i.test(s),ls=/Chrome/i.test(s)||/CriOS/i.test(s),ei=!us&&ls,Bo=Un=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),Td=(function(){const e=/MSIE\s(\d+)\.\d/.exec(s);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(s)&&/rv:11.0/.test(s)&&(t=11),t})(),_n=/Tizen/i.test(s),yn=/Web0S/i.test(s),Tn=_n||yn,mn=/Safari/i.test(s)&&!ei&&!jt&&!us&&!Tn,jn=/Windows/i.test(s),gn=/iPad/i.test(s)||mn&&mr&&!/iPhone/i.test(s),qn=/iPhone/i.test(s)&&!gn}const at=qn||gn||Mo,$n=(mn||at)&&!ei;var vd=Object.freeze({__proto__:null,get IS_IPOD(){return Mo},get IOS_VERSION(){return gd},get IS_ANDROID(){return jt},get ANDROID_VERSION(){return _d},get IS_FIREFOX(){return yd},get IS_EDGE(){return us},get IS_CHROMIUM(){return ls},get IS_CHROME(){return ei},get CHROMIUM_VERSION(){return Bo},get CHROME_VERSION(){return Un},IS_CHROMECAST_RECEIVER:A_,get IE_VERSION(){return Td},get IS_SAFARI(){return mn},get IS_WINDOWS(){return jn},get IS_IPAD(){return gn},get IS_IPHONE(){return qn},get IS_TIZEN(){return _n},get IS_WEBOS(){return yn},get IS_SMART_TV(){return Tn},TOUCH_ENABLED:mr,IS_IOS:at,IS_ANY_SAFARI:$n});function Vl(s){return typeof s=="string"&&!!s.trim()}function D_(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Cs(){return re===D.document}function ws(s){return Zt(s)&&s.nodeType===1}function bd(){try{return D.parent!==D.self}catch{return!0}}function xd(s){return function(e,t){if(!Vl(e))return re[s](null);Vl(t)&&(t=re.querySelector(t));const i=ws(t)?t:re;return i[s]&&i[s](e)}}function fe(s="div",e={},t={},i){const r=re.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Ai(r,a):(r[n]!==a||n==="tabIndex")&&(r[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){r.setAttribute(n,t[n])}),i&&Fo(r,i),r}function Ai(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function no(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function lr(s,e){return D_(e),s.classList.contains(e)}function Vi(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function Vn(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(ve.warn("removeClass was called with an element that doesn't exist"),null)}function Sd(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function Ed(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?s.removeAttribute(t):s.setAttribute(t,i===!0?"":i)})}function xi(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const i=s.attributes;for(let r=i.length-1;r>=0;r--){const n=i[r].name;let a=i[r].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function Cd(s,e){return s.getAttribute(e)}function bs(s,e,t){s.setAttribute(e,t)}function Hn(s,e){s.removeAttribute(e)}function wd(){re.body.focus(),re.onselectstart=function(){return!1}}function Ad(){re.onselectstart=function(){return!0}}function xs(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Ss(s,"height"))),t.width||(t.width=parseFloat(Ss(s,"width"))),t}}function gr(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let i=0,r=0;for(;s.offsetParent&&s!==re[pn.fullscreenElement];)i+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:i,top:r,width:e,height:t}}function zn(s,e){const t={x:0,y:0};if(at){let g=s;for(;g&&g.nodeName.toLowerCase()!=="html";){const _=Ss(g,"transform");if(/^matrix/.test(_)){const A=_.slice(7,-1).split(/,\s/).map(Number);t.x+=A[4],t.y+=A[5]}else if(/^matrix3d/.test(_)){const A=_.slice(9,-1).split(/,\s/).map(Number);t.x+=A[12],t.y+=A[13]}if(g.assignedSlot&&g.assignedSlot.parentElement&&D.WebKitCSSMatrix){const A=D.getComputedStyle(g.assignedSlot.parentElement).transform,x=new D.WebKitCSSMatrix(A);t.x+=x.m41,t.y+=x.m42}g=g.parentNode||g.host}}const i={},r=gr(e.target),n=gr(s),a=n.width,u=n.height;let l=e.offsetY-(n.top-r.top),f=e.offsetX-(n.left-r.left);return e.changedTouches&&(f=e.changedTouches[0].pageX-n.left,l=e.changedTouches[0].pageY+n.top,at&&(f-=t.x,l-=t.y)),i.y=1-Math.max(0,Math.min(1,l/u)),i.x=Math.max(0,Math.min(1,f/a)),i}function Dd(s){return Zt(s)&&s.nodeType===3}function Gn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function kd(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),ws(e)||Dd(e))return e;if(typeof e=="string"&&/\S/.test(e))return re.createTextNode(e)}).filter(e=>e)}function Fo(s,e){return kd(e).forEach(t=>s.appendChild(t)),s}function Id(s,e){return Fo(Gn(s),e)}function _r(s){return s.button===void 0&&s.buttons===void 0||s.button===0&&s.buttons===void 0||s.type==="mouseup"&&s.button===0&&s.buttons===0||s.type==="mousedown"&&s.button===0&&s.buttons===0?!0:!(s.button!==0||s.buttons!==1)}const wi=xd("querySelector"),Pd=xd("querySelectorAll");function Ss(s,e){if(!s||!e)return"";if(typeof D.getComputedStyle=="function"){let t;try{t=D.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Ld(s){[...re.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),i=re.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=re.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var Od=Object.freeze({__proto__:null,isReal:Cs,isEl:ws,isInFrame:bd,createEl:fe,textContent:Ai,prependTo:no,hasClass:lr,addClass:Vi,removeClass:Vn,toggleClass:Sd,setAttributes:Ed,getAttributes:xi,getAttribute:Cd,setAttribute:bs,removeAttribute:Hn,blockTextSelection:wd,unblockTextSelection:Ad,getBoundingClientRect:xs,findPosition:gr,getPointerPosition:zn,isTextNode:Dd,emptyEl:Gn,normalizeContent:kd,appendContent:Fo,insertContent:Id,isSingleLeftClick:_r,$:wi,$$:Pd,computedStyle:Ss,copyStyleSheetsToWindow:Ld});let Rd=!1,ao;const k_=function(){if(ao.options.autoSetup===!1)return;const s=Array.prototype.slice.call(re.getElementsByTagName("video")),e=Array.prototype.slice.call(re.getElementsByTagName("audio")),t=Array.prototype.slice.call(re.getElementsByTagName("video-js")),i=s.concat(e,t);if(i&&i.length>0)for(let r=0,n=i.length;r<n;r++){const a=i[r];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&ao(a);else{oo(1);break}}else Rd||oo(1)};function oo(s,e){Cs()&&(e&&(ao=e),D.setTimeout(k_,s))}function uo(){Rd=!0,D.removeEventListener("load",uo)}Cs()&&(re.readyState==="complete"?uo():D.addEventListener("load",uo));const Nd=function(s){const e=re.createElement("style");return e.className=s,e},Md=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var ft=new WeakMap;const I_=3;let P_=I_;function Lt(){return P_++}function Hl(s,e){if(!ft.has(s))return;const t=ft.get(s);t.handlers[e].length===0&&(delete t.handlers[e],s.removeEventListener?s.removeEventListener(e,t.dispatcher,!1):s.detachEvent&&s.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&ft.delete(s)}function Uo(s,e,t,i){t.forEach(function(r){s(e,r,i)})}function Wn(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const i=s||D.event;s={};const r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const n in i)r.includes(n)||n==="returnValue"&&i.preventDefault||(s[n]=i[n]);if(s.target||(s.target=s.srcElement||re),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){i.preventDefault&&i.preventDefault(),s.returnValue=!1,i.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),s.cancelBubble=!0,i.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const n=re.documentElement,a=re.body;s.pageX=s.clientX+(n&&n.scrollLeft||a&&a.scrollLeft||0)-(n&&n.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(n&&n.scrollTop||a&&a.scrollTop||0)-(n&&n.clientTop||a&&a.clientTop||0)}s.which=s.charCode||s.keyCode,s.button!==null&&s.button!==void 0&&(s.button=s.button&1?0:s.button&4?1:s.button&2?2:0)}return s.fixed_=!0,s}let rn;const L_=function(){if(typeof rn!="boolean"){rn=!1;try{const s=Object.defineProperty({},"passive",{get(){rn=!0}});D.addEventListener("test",null,s),D.removeEventListener("test",null,s)}catch{}}return rn},O_=["touchstart","touchmove"];function Et(s,e,t){if(Array.isArray(e))return Uo(Et,s,e,t);ft.has(s)||ft.set(s,{});const i=ft.get(s);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=Lt()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(r,n){if(i.disabled)return;r=Wn(r);const a=i.handlers[r.type];if(a){const u=a.slice(0);for(let l=0,f=u.length;l<f&&!r.isImmediatePropagationStopped();l++)try{u[l].call(s,r,n)}catch(g){ve.error(g)}}}),i.handlers[e].length===1)if(s.addEventListener){let r=!1;L_()&&O_.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,i.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function ot(s,e,t){if(!ft.has(s))return;const i=ft.get(s);if(!i.handlers)return;if(Array.isArray(e))return Uo(ot,s,e,t);const r=function(a,u){i.handlers[u]=[],Hl(a,u)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&r(s,a);return}const n=i.handlers[e];if(n){if(!t){r(s,e);return}if(t.guid)for(let a=0;a<n.length;a++)n[a].guid===t.guid&&n.splice(a--,1);Hl(s,e)}}function As(s,e,t){const i=ft.has(s)?ft.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Wn(e),i.dispatcher&&i.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)As.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){ft.has(e.target)||ft.set(e.target,{});const n=ft.get(e.target);e.target[e.type]&&(n.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),n.disabled=!1)}return!e.defaultPrevented}function Xn(s,e,t){if(Array.isArray(e))return Uo(Xn,s,e,t);const i=function(){ot(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Lt(),Et(s,e,i)}function jo(s,e,t){const i=function(){ot(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Lt(),Et(s,e,i)}var R_=Object.freeze({__proto__:null,fixEvent:Wn,on:Et,off:ot,trigger:As,one:Xn,any:jo});const Ot=30,Le=function(s,e,t){e.guid||(e.guid=Lt());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},ti=function(s,e){let t=D.performance.now();return function(...r){const n=D.performance.now();n-t>=e&&(s(...r),t=n)}},Bd=function(s,e,t,i=D){let r;const n=()=>{i.clearTimeout(r),r=null},a=function(){const u=this,l=arguments;let f=function(){r=null,f=null,t||s.apply(u,l)};!r&&t&&s.apply(u,l),i.clearTimeout(r),r=i.setTimeout(f,e)};return a.cancel=n,a};var N_=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ot,bind_:Le,throttle:ti,debounce:Bd});let tr;class Ct{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Et(this,e,t),this.addEventListener=i}off(e,t){ot(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Xn(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},jo(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Wn(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),As(this,e)}queueTrigger(e){tr||(tr=new Map);const t=e.type||e;let i=tr.get(this);i||(i=new Map,tr.set(this,i));const r=i.get(t);i.delete(t),D.clearTimeout(r);const n=D.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,tr.delete(this)),this.trigger(e)},0);i.set(t,n)}}Ct.prototype.allowedEvents_={};Ct.prototype.addEventListener=Ct.prototype.on;Ct.prototype.removeEventListener=Ct.prototype.off;Ct.prototype.dispatchEvent=Ct.prototype.trigger;const Kn=s=>typeof s.name=="function"?s.name():typeof s.name=="string"?s.name:s.name_?s.name_:s.constructor&&s.constructor.name?s.constructor.name:typeof s,li=s=>s instanceof Ct||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),M_=(s,e)=>{li(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},lo=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,vn=(s,e,t)=>{if(!s||!s.nodeName&&!li(s))throw new Error(`Invalid target for ${Kn(e)}#${t}; must be a DOM node or evented object.`)},Fd=(s,e,t)=>{if(!lo(s))throw new Error(`Invalid event type for ${Kn(e)}#${t}; must be a non-empty string or array.`)},Ud=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Kn(e)}#${t}; must be a function.`)},Ba=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let r,n,a;return i?(r=s.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(r=e[0],n=e[1],a=e[2]),vn(r,s,t),Fd(n,s,t),Ud(a,s,t),a=Le(s,a),{isTargetingSelf:i,target:r,type:n,listener:a}},Bi=(s,e,t,i)=>{vn(s,s,e),s.nodeName?R_[e](s,t,i):s[e](t,i)},B_={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ba(this,s,"on");if(Bi(t,"on",i,r),!e){const n=()=>this.off(t,i,r);n.guid=r.guid;const a=()=>this.off("dispose",n);a.guid=r.guid,Bi(this,"on","dispose",n),Bi(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ba(this,s,"one");if(e)Bi(t,"one",i,r);else{const n=(...a)=>{this.off(t,i,n),r.apply(null,a)};n.guid=r.guid,Bi(t,"one",i,n)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ba(this,s,"any");if(e)Bi(t,"any",i,r);else{const n=(...a)=>{this.off(t,i,n),r.apply(null,a)};n.guid=r.guid,Bi(t,"any",i,n)}},off(s,e,t){if(!s||lo(s))ot(this.eventBusEl_,s,e);else{const i=s,r=e;vn(i,this,"off"),Fd(r,this,"off"),Ud(t,this,"off"),t=Le(this,t),this.off("dispose",t),i.nodeName?(ot(i,r,t),ot(i,"dispose",t)):li(i)&&(i.off(r,t),i.off("dispose",t))}},trigger(s,e){vn(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!lo(t))throw new Error(`Invalid event type for ${Kn(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return As(this.eventBusEl_,s,e)}};function qo(s,e={}){const{eventBusKey:t}=e;if(t){if(!s[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);s.eventBusEl_=s[t]}else s.eventBusEl_=fe("span",{className:"vjs-event-bus"});return Object.assign(s,B_),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&ft.has(i)&&ft.delete(i)}),D.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const F_={state:{},setState(s){typeof s=="function"&&(s=s());let e;return os(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&li(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function jd(s,e){return Object.assign(s,F_),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&li(s)&&s.on("statechanged",s.handleStateChanged),s}const cr=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},He=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},qd=function(s,e){return He(s)===He(e)};var U_=Object.freeze({__proto__:null,toLowerCase:cr,toTitleCase:He,titleCaseEquals:qd});class K{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=ke({},this.options_),t=this.options_=ke(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${Lt()}`}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(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),t.evented!==!1&&(qo(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),jd(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(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}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!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=ke(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return fe(e,t,i)}localize(e,t,i=e){const r=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[r],u=r&&r.split("-")[0],l=n&&n[u];let f=i;return a&&a[e]?f=a[e]:l&&l[e]&&(f=l[e]),t&&(f=f.replace(/\{(\d+)\}/g,function(g,_){const A=t[_-1];let x=A;return typeof A>"u"&&(x=g),x})),f}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((i,r)=>i.concat(r),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",r=fe("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=re.createElementNS(i,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=re.createElementNS(i,"use");return n.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),r.appendChild(n),this.iconIsSet_?t.replaceChild(r,t.querySelector(".vjs-icon-placeholder")):t.appendChild(r),this.iconIsSet_=!0,r}addChild(e,t={},i=this.children_.length){let r,n;if(typeof e=="string"){n=He(e);const a=t.componentClass||n;t.name=n;const u=K.getComponent(a);if(!u)throw new Error(`Component ${a} does not exist`);if(typeof u!="function")return null;r=new u(this.player_||this,t)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(i,0,r),r.parentComponent_=this,typeof r.id=="function"&&(this.childIndex_[r.id()]=r),n=n||r.name&&He(r.name()),n&&(this.childNameIndex_[n]=r,this.childNameIndex_[cr(n)]=r),typeof r.el=="function"&&r.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_:ws(this.children_[i+1])&&(a=this.children_[i+1])),this.contentEl().insertBefore(r.el(),a)}return r}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let r=this.children_.length-1;r>=0;r--)if(this.children_[r]===e){t=!0,this.children_.splice(r,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[He(e.name())]=null,this.childNameIndex_[cr(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const u=a.name;let l=a.opts;if(t[u]!==void 0&&(l=t[u]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const f=this.addChild(u,l);f&&(this[u]=f)};let r;const n=K.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(u){return typeof u=="string"?a===u:a===u.name})})).map(a=>{let u,l;return typeof a=="string"?(u=a,l=e[u]||this.options_[u]||{}):(u=a.name,l=a),{name:u,opts:l}}).filter(a=>{const u=K.getComponent(a.opts.componentClass||He(a.name));return u&&!n.isTech(u)}).forEach(i)}}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 wi(e,t||this.contentEl())}$$(e,t){return Pd(e,t||this.contentEl())}hasClass(e){return lr(this.el_,e)}addClass(...e){Vi(this.el_,...e)}removeClass(...e){Vn(this.el_,...e)}toggleClass(e,t){Sd(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 Cd(this.el_,e)}setAttribute(e,t){bs(this.el_,e,t)}removeAttribute(e){Hn(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){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",i||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],n=r.indexOf("px");return parseInt(n!==-1?r.slice(0,n):this.el_["offset"+He(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Ss(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${He(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,r=200;let n;this.on("touchstart",function(u){u.touches.length===1&&(t={pageX:u.touches[0].pageX,pageY:u.touches[0].pageY},e=D.performance.now(),n=!0)}),this.on("touchmove",function(u){if(u.touches.length>1)n=!1;else if(t){const l=u.touches[0].pageX-t.pageX,f=u.touches[0].pageY-t.pageY;Math.sqrt(l*l+f*f)>i&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(u){t=null,n===!0&&D.performance.now()-e<r&&(u.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Le(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(r){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=Le(this,e),this.clearTimersOnDispose_(),i=D.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),D.clearTimeout(e)),e}setInterval(e,t){e=Le(this,e),this.clearTimersOnDispose_();const i=D.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),D.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Le(this,e),t=D.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Le(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),D.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((i,r)=>this[t](r))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(n){const a=D.getComputedStyle(n,null),u=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(u)}function i(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||D.getComputedStyle(n).height==="0px"||D.getComputedStyle(n).width==="0px")}function r(n){if(n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const a={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(a.x<0||a.x>(re.documentElement.clientWidth||D.innerWidth)||a.y<0||a.y>(re.documentElement.clientHeight||D.innerHeight))return!1;let u=re.elementFromPoint(a.x,a.y);for(;u;){if(u===n)return!0;if(u.parentNode)u=u.parentNode;else return!1}}return e||(e=this.el()),!!(r(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=K.getComponent("Tech"),r=i&&i.isTech(t),n=K===t||K.prototype.isPrototypeOf(t.prototype);if(r||!n){let u;throw r?u="techs must be registered using Tech.registerTech()":u="must be a Component subclass",new Error(`Illegal component, "${e}"; ${u}.`)}e=He(e),K.components_||(K.components_={});const a=K.getComponent("Player");if(e==="Player"&&a&&a.players){const u=a.players,l=Object.keys(u);if(u&&l.length>0){for(let f=0;f<l.length;f++)if(u[l[f]]!==null)throw new Error("Can not register Player component after player has been created.")}}return K.components_[e]=t,K.components_[cr(e)]=t,t}static getComponent(e){if(!(!e||!K.components_))return K.components_[e]}}K.registerComponent("Component",K);function j_(s,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${s}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function zl(s,e,t,i){return j_(s,i,t.length-1),t[i][e]}function Fa(s){let e;return s===void 0||s.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:s.length,start:zl.bind(null,"start",0,s),end:zl.bind(null,"end",1,s)},D.Symbol&&D.Symbol.iterator&&(e[D.Symbol.iterator]=()=>(s||[]).values()),e}function Ut(s,e){return Array.isArray(s)?Fa(s):s===void 0||e===void 0?Fa():Fa([[s,e]])}const $d=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),i=Math.floor(s/60%60),r=Math.floor(s/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(r=i=t="-"),r=r>0||a>0?r+":":"",i=((r||n>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,r+i+t};let $o=$d;function Vd(s){$o=s}function Hd(){$o=$d}function Wi(s,e=s){return $o(s,e)}var q_=Object.freeze({__proto__:null,createTimeRanges:Ut,createTimeRange:Ut,setFormatTime:Vd,resetFormatTime:Hd,formatTime:Wi});function zd(s,e){let t=0,i,r;if(!e)return 0;(!s||!s.length)&&(s=Ut(0,0));for(let n=0;n<s.length;n++)i=s.start(n),r=s.end(n),r>e&&(r=e),t+=r-i;return t/e}function qe(s){if(s instanceof qe)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:Zt(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=qe.defaultMessages[this.code]||"")}qe.prototype.code=0;qe.prototype.message="";qe.prototype.status=null;qe.prototype.metadata=null;qe.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];qe.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."};qe.MEDIA_ERR_CUSTOM=0;qe.prototype.MEDIA_ERR_CUSTOM=0;qe.MEDIA_ERR_ABORTED=1;qe.prototype.MEDIA_ERR_ABORTED=1;qe.MEDIA_ERR_NETWORK=2;qe.prototype.MEDIA_ERR_NETWORK=2;qe.MEDIA_ERR_DECODE=3;qe.prototype.MEDIA_ERR_DECODE=3;qe.MEDIA_ERR_SRC_NOT_SUPPORTED=4;qe.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;qe.MEDIA_ERR_ENCRYPTED=5;qe.prototype.MEDIA_ERR_ENCRYPTED=5;function dr(s){return s!=null&&typeof s.then=="function"}function Kt(s){dr(s)&&s.then(null,e=>{})}const co=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,r)=>(s[i]&&(t[i]=s[i]),t),{cues:s.cues&&Array.prototype.map.call(s.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},$_=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,r=>r.track);return Array.prototype.map.call(e,function(r){const n=co(r.track);return r.src&&(n.src=r.src),n}).concat(Array.prototype.filter.call(s.textTracks(),function(r){return t.indexOf(r)===-1}).map(co))},V_=function(s,e){return s.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(r=>i.addCue(r))}),e.textTracks()};var ho={textTracksToJson:$_,jsonToTextTracks:V_,trackToJson:co};const Ua="vjs-modal-dialog";class Ds extends K{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=fe("div",{className:`${Ua}-content`},{role:"document"}),this.descEl_=fe("p",{className:`${Ua}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ai(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","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Ua} 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_){this.options_.fillAlways&&this.fill();return}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({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const r=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Id(t,e),this.trigger("modalfill"),r?i.insertBefore(t,r):i.appendChild(t);const n=this.getChild("closeButton");n&&i.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Gn(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=re.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(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let r;for(let n=0;n<t.length;n++)if(i===t[n]){r=n;break}re.activeElement===this.el_&&(r=0),e.shiftKey&&r===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&r===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof D.HTMLAnchorElement||t instanceof D.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof D.HTMLInputElement||t instanceof D.HTMLSelectElement||t instanceof D.HTMLTextAreaElement||t instanceof D.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof D.HTMLIFrameElement||t instanceof D.HTMLObjectElement||t instanceof D.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Ds.prototype.options_={pauseOnOpen:!0,temporary:!0};K.registerComponent("ModalDialog",Ds);class Xi extends Ct{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},li(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,r=this.length;i<r;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,r=this.length;i<r;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}Xi.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in Xi.prototype.allowedEvents_)Xi.prototype["on"+s]=null;const ja=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].enabled=!1)};class Gd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){ja(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&ja(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,ja(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 qa=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].selected=!1)};class Wd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){qa(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&qa(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,qa(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 Vo extends Xi{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_))}toJSON(){return this.tracks_.map(e=>e.toJSON())}}class H_{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,r=this.trackElements_.length;i<r;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class bn{constructor(e){bn.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const r=e.length;this.cues_=e,this.length_=e.length;const n=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<r)for(i=t;i<r;i++)n.call(this,i)}getCueById(e){let t=null;for(let i=0,r=this.length;i<r;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}const z_={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},G_={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},W_={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Gl={disabled:"disabled",hidden:"hidden",showing:"showing"};class Ho extends Ct{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Lt(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(r){r!==i&&(i=r,this.trigger("labelchange"))}})}}const zo=function(s){return new URL(s,re.baseURI)},Xd=function(s){return new URL(s,re.baseURI).href},Go=function(s){if(typeof s=="string"){const t=s.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},Yn=function(s,e=D.location){return zo(s).origin!==e.origin};var X_=Object.freeze({__proto__:null,parseUrl:zo,getAbsoluteURL:Xd,getFileExtension:Go,isCrossOrigin:Yn});const Wl=function(s,e){const t=new D.WebVTT.Parser(D,D.vttjs,D.WebVTT.StringDecoder()),i=[];t.oncue=function(r){e.addCue(r)},t.onparsingerror=function(r){i.push(r)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),i.length>0&&(D.console&&D.console.groupCollapsed&&D.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(r=>ve.error(r)),D.console&&D.console.groupEnd&&D.console.groupEnd()),t.flush()},Xl=function(s,e){const t={uri:s},i=Yn(s);i&&(t.cors=i);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Yc(t,Le(this,function(n,a,u){if(n)return ve.error(n,a);e.loaded_=!0,typeof D.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){ve.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Wl(u,e)}):Wl(u,e)}))};class br extends Ho{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=ke(e,{kind:W_[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=Gl[t.mode]||"disabled";const r=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new bn(this.cues_),a=new bn(this.activeCues_);let u=!1;this.timeupdateHandler=Le(this,function(f={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,u&&(this.trigger("cuechange"),u=!1),f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const l=()=>{this.stopTracking()};this.tech_.one("dispose",l),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return i},set(f){Gl[f]&&i!==f&&(i=f,!this.preload_&&i!=="disabled"&&this.cues.length===0&&Xl(this.src,this),this.stopTracking(),i!=="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 f=this.tech_.currentTime(),g=[];for(let _=0,A=this.cues.length;_<A;_++){const x=this.cues[_];x.startTime<=f&&x.endTime>=f&&g.push(x)}if(u=!1,g.length!==this.activeCues_.length)u=!0;else for(let _=0;_<g.length;_++)this.activeCues_.indexOf(g[_])===-1&&(u=!0);return this.activeCues_=g,a.setCues_(this.activeCues_),a},set(){}}}),t.src?(this.src=t.src,this.preload_||(this.loaded_=!0),(this.preload_||t.kind!=="subtitles"&&t.kind!=="captions")&&Xl(this.src,this)):this.loaded_=!0}startTracking(){this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler),this.tech_.on("timeupdate",this.timeupdateHandler)}stopTracking(){this.rvf_&&(this.tech_.cancelVideoFrameCallback(this.rvf_),this.rvf_=void 0),this.tech_.off("timeupdate",this.timeupdateHandler)}addCue(e){let t=e;if(!("getCueAsHTML"in t)){t=new D.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const r in e)r in t||(t[r]=e[r]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let r=0;r<i.length;r++)i[r]!==this&&i[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}toJSON(){return ho.trackToJson(this)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}br.prototype.allowedEvents_={cuechange:"cuechange"};class Kd extends Ho{constructor(e={}){const t=ke(e,{kind:G_[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(r){typeof r!="boolean"||r===i||(i=r,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Yd extends Ho{constructor(e={}){const t=ke(e,{kind:z_[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(r){typeof r!="boolean"||r===i||(i=r,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class ci extends Ct{constructor(e={}){super();let t;const i=new br(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=ci.NONE,i.addEventListener("loadeddata",()=>{t=ci.LOADED,this.trigger({type:"load",target:this})})}}ci.prototype.allowedEvents_={load:"load"};ci.NONE=0;ci.LOADING=1;ci.LOADED=2;ci.ERROR=3;const Pt={audio:{ListClass:Gd,TrackClass:Kd,capitalName:"Audio"},video:{ListClass:Wd,TrackClass:Yd,capitalName:"Video"},text:{ListClass:Vo,TrackClass:br,capitalName:"Text"}};Object.keys(Pt).forEach(function(s){Pt[s].getterName=`${s}Tracks`,Pt[s].privateName=`${s}Tracks_`});const Es={remoteText:{ListClass:Vo,TrackClass:br,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:H_,TrackClass:ci,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ht=Object.assign({},Pt,Es);Es.names=Object.keys(Es);Pt.names=Object.keys(Pt);ht.names=[].concat(Es.names).concat(Pt.names);function K_(s,e,t,i,r={}){const n=s.textTracks();r.kind=e,t&&(r.label=t),i&&(r.language=i),r.tech=s;const a=new ht.text.TrackClass(r);return n.addTrack(a),a}class ye extends K{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),ht.names.forEach(i=>{const r=ht[i];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}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 ht.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 Ut(0,0)}bufferedPercent(){return zd(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(Pt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let r=i.length;for(;r--;){const n=i[r];t==="text"&&this.removeRemoteTextTrack(n),i.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new qe(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ut(0,0):Ut()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Pt.names.forEach(e=>{const t=Pt[e],i=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),this.on("dispose",()=>{r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!D.WebVTT)if(re.body.contains(this.el())){if(!this.options_["vtt.js"]&&vs(yl)&&Object.keys(yl).length>0){this.trigger("vttjsloaded");return}const e=re.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}),D.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=u=>e.addTrack(u.track),r=u=>e.removeTrack(u.track);t.on("addtrack",i),t.on("removetrack",r),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let u=0;u<e.length;u++){const l=e[u];l.removeEventListener("cuechange",n),l.mode==="showing"&&l.addEventListener("cuechange",n)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",r),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let u=0;u<e.length;u++)e[u].removeEventListener("cuechange",n)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return K_(this,e,t,i)}createRemoteTextTrack(e){const t=ke(e,{tech:this});return new Es.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}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=Lt();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 ye.canPlayType(e.type)}static isTech(e){return e.prototype instanceof ye||e instanceof ye||e===ye}static registerTech(e,t){if(ye.techs_||(ye.techs_={}),!ye.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!ye.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!ye.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=He(e),ye.techs_[e]=t,ye.techs_[cr(e)]=t,e!=="Tech"&&ye.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(ye.techs_&&ye.techs_[e])return ye.techs_[e];if(e=He(e),D&&D.videojs&&D.videojs[e])return ve.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),D.videojs[e]}}}ht.names.forEach(function(s){const e=ht[s];ye.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});ye.prototype.featuresVolumeControl=!0;ye.prototype.featuresMuteControl=!0;ye.prototype.featuresFullscreenResize=!1;ye.prototype.featuresPlaybackRate=!1;ye.prototype.featuresProgressEvents=!1;ye.prototype.featuresSourceset=!1;ye.prototype.featuresTimeupdateEvents=!1;ye.prototype.featuresNativeTextTracks=!1;ye.prototype.featuresVideoFrameCallback=!1;ye.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let r=s.sourceHandlers;r||(r=s.sourceHandlers=[]),i===void 0&&(i=r.length),r.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let r;for(let n=0;n<i.length;n++)if(r=i[n].canPlayType(t),r)return r;return""},s.selectSourceHandler=function(t,i){const r=s.sourceHandlers||[];let n;for(let a=0;a<r.length;a++)if(n=r[a].canHandleSource(t,i),n)return r[a];return null},s.canPlaySource=function(t,i){const r=s.selectSourceHandler(t,i);return r?r.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(t){let i=s.selectSourceHandler(t,this.options_);i||(s.nativeSourceHandler?i=s.nativeSourceHandler:ve.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==s.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},s.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};K.registerComponent("Tech",ye);ye.registerTech("Tech",ye);ye.defaultTechOrder_=[];const Hi={},xn={},Sn={};function Y_(s,e){Hi[s]=Hi[s]||[],Hi[s].push(e)}function Q_(s,e,t){s.setTimeout(()=>Fi(e,Hi[e.type],t,s),1)}function J_(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function Z_(s,e,t){return s.reduceRight(Wo(t),e[t]())}function ey(s,e,t,i){return e[t](s.reduce(Wo(t),i))}function Kl(s,e,t,i=null){const r="call"+He(t),n=s.reduce(Wo(r),i),a=n===Sn,u=a?null:e[t](n);return sy(s,t,u,a),u}const ty={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},iy={setCurrentTime:1,setMuted:1,setVolume:1},Yl={play:1,pause:1};function Wo(s){return(e,t)=>e===Sn?Sn:t[s]?t[s](e):e}function sy(s,e,t,i){for(let r=s.length-1;r>=0;r--){const n=s[r];n[e]&&n[e](i,t)}}function ry(s){xn.hasOwnProperty(s.id())&&delete xn[s.id()]}function ny(s,e){const t=xn[s.id()];let i=null;if(t==null)return i=e(s),xn[s.id()]=[[e,i]],i;for(let r=0;r<t.length;r++){const[n,a]=t[r];n===e&&(i=a)}return i===null&&(i=e(s),t.push([e,i])),i}function Fi(s={},e=[],t,i,r=[],n=!1){const[a,...u]=e;if(typeof a=="string")Fi(s,Hi[a],t,i,r,n);else if(a){const l=ny(i,a);if(!l.setSource)return r.push(l),Fi(s,u,t,i,r,n);l.setSource(Object.assign({},s),function(f,g){if(f)return Fi(s,u,t,i,r,n);r.push(l),Fi(g,s.type===g.type?u:Hi[g.type],t,i,r,n)})}else u.length?Fi(s,u,t,i,r,n):n?t(s,r):Fi(s,Hi["*"],t,i,r,!0)}const ay={opus:"video/ogg",ogv:"video/ogg",mp4:"video/mp4",mov:"video/mp4",m4v:"video/mp4",mkv:"video/x-matroska",m4a:"audio/mp4",mp3:"audio/mpeg",aac:"audio/aac",caf:"audio/x-caf",flac:"audio/flac",oga:"audio/ogg",wav:"audio/wav",m3u8:"application/x-mpegURL",mpd:"application/dash+xml",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",svg:"image/svg+xml",webp:"image/webp"},En=function(s=""){const e=Go(s);return ay[e.toLowerCase()]||""},oy=(s,e)=>{if(!e)return"";if(s.cache_.source.src===e&&s.cache_.source.type)return s.cache_.source.type;const t=s.cache_.sources.filter(r=>r.src===e);if(t.length)return t[0].type;const i=s.$$("source");for(let r=0;r<i.length;r++){const n=i[r];if(n.type&&n.src&&n.src===e)return n.type}return En(e)},Qd=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=Qd(t),Array.isArray(t)?e=e.concat(t):Zt(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Ql({src:s})]:Zt(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[Ql(s)]:s=[];return s};function Ql(s){if(!s.type){const e=En(s.src);e&&(s.type=e)}return s}var uy=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
18
18
|
<defs>
|
|
19
19
|
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
20
20
|
<path d="M16 10v28l22-14z"></path>
|
|
@@ -156,8 +156,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
156
156
|
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
|
157
157
|
</symbol>
|
|
158
158
|
</defs>
|
|
159
|
-
</svg>`;const Gl=gn?10009:_n?461:8,es={codes:{play:415,pause:19,ff:417,rw:412,back:Gl},names:{415:"play",19:"pause",417:"ff",412:"rw",[Gl]:"back"},isEventKey(s,e){return e=e.toLowerCase(),!!(this.names[s.keyCode]&&this.names[s.keyCode]===e)},getEventName(s){if(this.names[s.keyCode])return this.names[s.keyCode];if(this.codes[s.code]){const e=this.codes[s.code];return this.names[e]}return null}},Wl=5;class q_ extends xt{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(es.isEventKey(t,"play")||es.isEventKey(t,"pause")||es.isEventKey(t,"ff")||es.isEventKey(t,"rw")){t.preventDefault();const i=es.getEventName(t);this.performMediaAction_(i)}else es.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+Wl);break;case"rw":this.userSeek_(this.player_.currentTime()-Wl);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const r=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(r&&r.name()==="CloseButton"?this.refocusComponent():(this.pause(),r&&r.el()&&(this.lastFocusedComponent_=r)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(r){for(const n of r)n.hasOwnProperty("el_")&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())&&t.push(n),n.hasOwnProperty("children_")&&n.children_.length>0&&i(n.children_)}return e.children_.forEach(r=>{if(r.hasOwnProperty("el_"))if(r.getIsFocusable&&r.getIsAvailableToBeFocused&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())){t.push(r);return}else r.hasOwnProperty("children_")&&r.children_.length>0?i(r.children_):r.hasOwnProperty("items")&&r.items.length>0?i(r.items):this.findSuitableDOMChild(r)&&t.push(r);if(r.name_==="ErrorDisplay"&&r.opened_){const n=r.el_.querySelector(".vjs-errors-ok-button-container");n&&n.querySelectorAll("button").forEach((u,c)=>{t.push({name:()=>"ModalButton"+(c+1),el:()=>u,getPositions:()=>{const f=u.getBoundingClientRect(),g={x:f.x,y:f.y,width:f.width,height:f.height,top:f.top,right:f.right,bottom:f.bottom,left:f.left},_={x:f.left+f.width/2,y:f.top+f.height/2,width:0,height:0,top:f.top+f.height/2,right:f.left+f.width/2,bottom:f.top+f.height/2,left:f.left+f.width/2};return{boundingClientRect:g,center:_}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:f=>!0,focus:()=>u.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let r=0;r<i.children.length;r++){const n=i.children[r],a=t(n);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),r=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),n=this.findBestCandidate_(i.center,r,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let r=1/0,n=null;for(const a of t){const u=a.getPositions().center,c=this.calculateDistance_(e,u,i);c<r&&(r=c,n=a)}return n}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const r=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);let a;switch(i){case"right":case"left":a=r+n*100;break;case"up":a=n*2+r*.5;break;case"down":a=n*5+r;break;default:a=r+n}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class $_ extends K{constructor(e,t,i){const r=Ae({createEl:!1},t);if(super(e,r,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const u=je(a[n]);let c=me.getTech(u);if(u||(c=K.getComponent(u)),c&&c.isSupported()){e.loadTech_(u);break}}else e.src(t.playerOptions.sources)}}K.registerComponent("MediaLoader",$_);class Yn extends K{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ve.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const r=de(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(de("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=de("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 i=this.localize(e);this.controlText_=e,Ai(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&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_<"u"&&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){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}K.registerComponent("ClickableComponent",Yn);class lo extends Yn{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return de("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")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(de("picture",{className:"vjs-poster",tabIndex:-1},{},de("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()?Gt(this.player_.play()):this.player_.pause())}}lo.prototype.crossorigin=lo.prototype.crossOrigin;K.registerComponent("PosterImage",lo);const Dt="#222",Xl="#ccc",V_={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 qa(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; 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 Vt(s,e,t){try{s.style[e]=t}catch{return}}function Kl(s){return s?`${s}px`:""}class H_ extends K{constructor(e,t,i){super(e,t,i);const r=a=>this.updateDisplay(a),n=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",r),e.on("userinactive",r),e.on("texttrackchange",r),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Ie(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",n),e.on("playerresize",n);const a=D.screen.orientation||D,u=D.screen.orientation?"change":"orientationchange";a.addEventListener(u,n),e.on("dispose",()=>a.removeEventListener(u,n));const c=this.options_.playerOptions.tracks||[];for(let f=0;f<c.length;f++)this.player_.addRemoteTextTrack(c[f],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let r,n,a;for(let u=0;u<t.length;u++){const c=t[u];i&&i.enabled&&i.language&&i.language===c.language&&c.kind in e?c.kind===i.kind?a=c:a||(a=c):i&&!i.enabled?(a=null,r=null,n=null):c.default&&(c.kind==="descriptions"&&!r?r=c:c.kind in e&&!n&&(n=c))}a?a.mode="showing":n?n.mode="showing":r&&(r.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof D.WebVTT=="function"&&D.WebVTT.processCues(D,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let u=0;u<e.length;++u){const c=e[u];c.mode==="showing"&&a.push(c)}this.updateForTrack(a);return}let i=null,r=null,n=e.length;for(;n--;){const a=e[n];a.mode==="showing"&&(a.kind==="descriptions"?i=a:r=a)}if(r?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(r)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!D.CSS.supports("inset","10px")){const a=this.el_,u=a.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,f=this.player_.el_.getBoundingClientRect().height;a.style="",Vt(a,"position","relative"),Vt(a,"height",f-c+"px"),Vt(a,"top","unset"),yn?Vt(a,"bottom",f+"px"):Vt(a,"bottom","0px"),u.length>0&&u.forEach(g=>{if(g.style.inset){const _=g.style.inset.split(" ");_.length===3&&Object.assign(g.style,{top:_[0],right:_[1],bottom:_[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!D.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,r=this.player_.videoWidth()/this.player_.videoHeight();let n=0,a=0;Math.abs(i-r)>.1&&(i>r?n=Math.round((e-t*r)/2):a=Math.round((t-e/r)/2)),Vt(this.el_,"insetInline",Kl(n)),Vt(this.el_,"insetBlock",Kl(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let r=i.length;for(;r--;){const n=i[r];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Vt(a.firstChild,"color",qa(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Vt(a.firstChild,"backgroundColor",qa(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Vt(a,"backgroundColor",qa(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Dt}, 2px 2px 4px ${Dt}, 2px 2px 5px ${Dt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Dt}, 2px 2px ${Dt}, 3px 3px ${Dt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Xl}, 0 1px ${Xl}, -1px -1px ${Dt}, 0 -1px ${Dt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Dt}, 0 0 4px ${Dt}, 0 0 4px ${Dt}, 0 0 4px ${Dt}`)),t.fontPercent&&t.fontPercent!==1){const u=D.parseFloat(a.style.fontSize);a.style.fontSize=u*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=V_[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof D.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const r=e[i];for(let n=0;n<r.activeCues.length;++n)t.push(r.activeCues[n])}D.WebVTT.processCues(D,t,this.el_);for(let i=0;i<e.length;++i){const r=e[i];for(let n=0;n<r.activeCues.length;++n){const a=r.activeCues[n].displayState;$i(a,"vjs-text-track-cue","vjs-text-track-cue-"+(r.language?r.language:i)),r.language&&Ts(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}K.registerComponent("TextTrackDisplay",H_);class z_ extends K{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=de("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),r=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(i),r}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}K.registerComponent("LoadingSpinner",z_);class nt extends Yn{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const r=de(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(de("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const i=this.constructor.name;return ve.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),K.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}K.registerComponent("Button",nt);class Ud extends nt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Gt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),r=i&&i.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const n=()=>r.focus();cr(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Ud.prototype.controlText_="Play Video";K.registerComponent("BigPlayButton",Ud);class G_ extends nt{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){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}K.registerComponent("CloseButton",G_);class jd extends nt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Gt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.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))}}jd.prototype.controlText_="Play";K.registerComponent("PlayToggle",jd);class As extends K{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=de("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=de("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Gi(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,ve.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_=re.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}As.prototype.labelText_="Time";As.prototype.controlText_="Time";K.registerComponent("TimeDisplay",As);class Ho extends As{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Ho.prototype.labelText_="Current Time";Ho.prototype.controlText_="Current Time";K.registerComponent("CurrentTimeDisplay",Ho);class zo extends As{constructor(e,t){super(e,t);const i=r=>this.updateContent(r);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}zo.prototype.labelText_="Duration";zo.prototype.controlText_="Duration";K.registerComponent("DurationDisplay",zo);class W_ extends K{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}K.registerComponent("TimeDivider",W_);class Go extends As{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(de("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)}}Go.prototype.labelText_="Remaining Time";Go.prototype.controlText_="Remaining Time";K.registerComponent("RemainingTimeDisplay",Go);class X_ extends K{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=de("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(de("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(re.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()}}K.registerComponent("LiveDisplay",X_);class qd extends nt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),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_=de("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()}}qd.prototype.controlText_="Seek to live, currently playing live";K.registerComponent("SeekToLive",qd);function br(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var K_=Object.freeze({__proto__:null,clamp:br});class Wo extends K{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),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={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!Qt&&e.preventDefault(),fd(),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;pd(),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(br(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Hn(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,r=t&&t.horizontalSeek;i?r&&e.key==="ArrowLeft"||!r&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r&&e.key==="ArrowRight"||!r&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(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")}}K.registerComponent("Slider",Wo);const $a=(s,e)=>br(s/e*100,0,100).toFixed(2)+"%";class Y_ extends K{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=de("span",{className:"vjs-control-text"}),i=de("span",{textContent:this.localize("Loaded")}),r=re.createTextNode(": ");return this.percentageEl_=de("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(r),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,i=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,u=$a(n,r);this.percent_!==u&&(this.el_.style.width=u,Ai(this.percentageEl_,u),this.percent_=u);for(let c=0;c<i.length;c++){const f=i.start(c),g=i.end(c);let _=a[c];_||(_=this.el_.appendChild(de()),a[c]=_),!(_.dataset.start===f&&_.dataset.end===g)&&(_.dataset.start=f,_.dataset.end=g,_.style.left=$a(f,n),_.style.width=$a(g-f,n))}for(let c=a.length;c>i.length;c--)this.el_.removeChild(a[c-1]);a.length=i.length})}}K.registerComponent("LoadProgressBar",Y_);class Q_ extends K{constructor(e,t){super(e,t),this.update=Jt(Ie(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const r=mr(this.el_),n=vs(this.player_.el()),a=e.width*t;if(!n||!r)return;let u=e.left-n.left+a,c=e.width-a+(n.right-e.right);c||(c=e.width-a,u=a);let f=r.width/2;u<f?f+=f-u:c<f&&(f=c),f<0?f=0:f>r.width&&(f=r.width),f=Math.round(f),this.el_.style.right=`-${f}px`,this.write(i)}write(e){Ai(this.el_,e)}updateTime(e,t,i,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const u=this.player_.liveTracker.liveWindow(),c=u-t*u;n=(c<1?"":"-")+Gi(c,u)}else n=Gi(i,a);this.update(e,t,n),r&&r()})}}K.registerComponent("TimeTooltip",Q_);class Xo extends K{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Jt(Ie(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const r=this.getChild("timeTooltip");if(!r)return;const n=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}Xo.prototype.options_={children:[]};!st&&!Ft&&Xo.prototype.options_.children.push("timeTooltip");K.registerComponent("PlayProgressBar",Xo);class $d extends K{constructor(e,t){super(e,t),this.update=Jt(Ie(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}$d.prototype.options_={children:["timeTooltip"]};K.registerComponent("MouseTimeDisplay",$d);class Qn extends Wo{constructor(e,t){t=Ae(Qn.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(st||Ft)||e.options_.disableSeekWhileScrubbingOnSTV;(!st&&!Ft||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Ie(this,this.update),this.update=Jt(this.update_,Pt),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],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 re&&"visibilityState"in re&&this.on(re,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){re.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,Pt))}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(re.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let n=this.player_.duration();r&&r.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Gi(i,n),Gi(n,n)],"{1} of {2}")),this.currentTime_=i,this.duration_=n),this.bar&&this.bar.update(vs(this.el()),this.getProgress(),e)}),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()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){gr(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!gr(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const r=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())i=r*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(r>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),u=n.liveCurrentTime();if(i=a+r*n.liveWindow(),i>=u&&(i=u),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}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.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Gt(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],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 re&&"visibilityState"in re&&this.off(re,"visibilitychange",this.toggleVisibility_),super.dispose()}}Qn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};K.registerComponent("SeekBar",Qn);class Vd extends K{constructor(e,t){super(e,t),this.handleMouseMove=Jt(Ie(this,this.handleMouseMove),Pt),this.throttledHandleMouseSeek=Jt(Ie(this,this.handleMouseSeek),Pt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!i&&!r)return;const n=t.el(),a=mr(n);let u=Hn(n,e).x;u=br(u,0,1),r&&r.update(a,u),i&&i.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","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Gt(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],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,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Vd.prototype.options_={children:["seekBar"]};K.registerComponent("ProgressControl",Vd);class Hd extends nt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),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(){re.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in D?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 re.exitPictureInPicture=="function"&&super.show()}}Hd.prototype.controlText_="Picture-in-Picture";K.registerComponent("PictureInPictureToggle",Hd);class zd extends nt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),re[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()}}zd.prototype.controlText_="Fullscreen";K.registerComponent("FullscreenToggle",zd);const J_=function(s,e){e.tech_&&!e.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class Z_ extends K{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}}K.registerComponent("VolumeLevel",Z_);class ey extends K{constructor(e,t){super(e,t),this.update=Jt(Ie(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,r){if(!i){const n=vs(this.el_),a=vs(this.player_.el()),u=e.width*t;if(!a||!n)return;const c=e.left-a.left+u,f=e.width-u+(a.right-e.right);let g=n.width/2;c<g?g+=g-c:f<g&&(g=f),g<0?g=0:g>n.width&&(g=n.width),this.el_.style.right=`-${g}px`}this.write(`${r}%`)}write(e){Ai(this.el_,e)}updateVolume(e,t,i,r,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,r.toFixed(0)),n&&n()})}}K.registerComponent("VolumeLevelTooltip",ey);class Gd extends K{constructor(e,t){super(e,t),this.update=Jt(Ie(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}Gd.prototype.options_={children:["volumeLevelTooltip"]};K.registerComponent("MouseVolumeLevelDisplay",Gd);class Jn extends Wo{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),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){gr(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),r=vs(i),n=this.vertical();let a=Hn(i,e);a=n?a.y:a.x,a=br(a,0,1),t.update(r,a,n)}gr(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)})}}Jn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!st&&!Ft&&Jn.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Jn.prototype.playerEvent="volumechange";K.registerComponent("VolumeBar",Jn);let Wd=class extends K{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||ys(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),J_(this,e),this.throttledHandleMouseMove=Jt(Ie(this,this.handleMouseMove),Pt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),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)}};Wd.prototype.options_={children:["volumeBar"]};K.registerComponent("VolumeControl",Wd);const ty=function(s,e){e.tech_&&!e.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class Xd extends nt{constructor(e,t){super(e,t),ty(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const r=i<.1?.1:i;this.player_.volume(r),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"),st&&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),$n(this.el_,[0,1,2,3].reduce((i,r)=>i+`${r?" ":""}vjs-vol-${r}`,"")),$i(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}Xd.prototype.controlText_="Mute";K.registerComponent("MuteToggle",Xd);class Kd extends K{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||ys(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),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){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),bt(re,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),rt(re,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Kd.prototype.options_={children:["muteToggle","volumeControl"]};K.registerComponent("VolumePanel",Kd);class Yd extends nt{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.toLocaleString(e.language())])),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(),i=this.player_.liveTracker,r=i&&i.isLive()?i.seekableEnd():this.player_.duration();let n;t+this.skipTime<=r?n=t+this.skipTime:n=r,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Yd.prototype.controlText_="Skip Forward";K.registerComponent("SkipForward",Yd);class Qd extends nt{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.toLocaleString(e.language())])),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(),i=this.player_.liveTracker,r=i&&i.isLive()&&i.seekableStart();let n;r&&t-this.skipTime<=r?n=r:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Qd.prototype.controlText_="Skip Backward";K.registerComponent("SkipBackward",Qd);class Jd extends K{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof K&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof K&&(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_=de(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_),bt(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||re.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(r=>r.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(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())}}K.registerComponent("Menu",Jd);class Ko extends K{constructor(e,t={}){super(e,t),this.menuButton_=new nt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=nt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),bt(re,"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 Jd(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=de("li",{className:"vjs-menu-title",textContent:je(this.options_.title),tabIndex:-1}),i=new K(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=nt.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),rt(re,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),st&&ud())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}K.registerComponent("MenuButton",Ko);class Yo extends Ko{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const r=Ie(this,this.update);i.addEventListener("removetrack",r),i.addEventListener("addtrack",r),i.addEventListener("labelchange",r),this.player_.on("ready",r),this.player_.on("dispose",function(){i.removeEventListener("removetrack",r),i.removeEventListener("addtrack",r),i.removeEventListener("labelchange",r)})}}K.registerComponent("TrackButton",Yo);class xr extends Yn{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const r=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),n=de("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?r.appendChild(n):r.replaceChild(n,r.querySelector(".vjs-icon-placeholder")),r}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||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))}}K.registerComponent("MenuItem",xr);class Sr extends xr{constructor(e,t){const i=t.track,r=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const n=(...u)=>{this.handleTracksChange.apply(this,u)},a=(...u)=>{this.handleSelectedLanguageChange.apply(this,u)};if(e.on(["loadstart","texttrackchange"],n),r.addEventListener("change",n),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],n),r.removeEventListener("change",n),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let u;this.on(["tap","click"],function(){if(typeof D.Event!="object")try{u=new D.Event("change")}catch{}u||(u=re.createEvent("Event"),u.initEvent("change",!0,!0)),r.dispatchEvent(u)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let r=0;r<i.length;r++){const n=i[r];this.kinds.indexOf(n.kind)!==-1&&(n===t?n.mode!=="showing"&&(n.mode="showing"):n.mode!=="disabled"&&(n.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}K.registerComponent("TextTrackMenuItem",Sr);class Zd extends Sr{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let r=0,n=t.length;r<n;r++){const a=t[r];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let r=0,n=t.length;r<n;r++){const a=t[r];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}K.registerComponent("OffTextTrackMenuItem",Zd);class Ds extends Yo{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Sr){let i;this.label_&&(i=`${this.label_} off`),e.push(new Zd(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let n=0;n<r.length;n++){const a=r[n];if(this.kinds_.indexOf(a.kind)>-1){const u=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});u.addClass(`vjs-${a.kind}-menu-item`),e.push(u)}}return e}}K.registerComponent("TextTrackButton",Ds);class eh extends xr{constructor(e,t){const i=t.track,r=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=n&&n<r.endTime,super(e,t),this.track=i,this.cue=r}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}K.registerComponent("ChaptersTrackMenuItem",eh);class Qo extends Ds{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(r=>{r.selected(this.track_.activeCues[0]===r.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 i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(je(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 i=0,r=t.length;i<r;i++){const n=t[i],a=new eh(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}Qo.prototype.kind_="chapters";Qo.prototype.controlText_="Chapters";K.registerComponent("ChaptersButton",Qo);class Jo extends Ds{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const r=e.textTracks(),n=Ie(this,this.handleTracksChange);r.addEventListener("change",n),this.on("dispose",function(){r.removeEventListener("change",n)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let r=0,n=t.length;r<n;r++){const a=t[r];if(a.kind!==this.kind_&&a.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Jo.prototype.kind_="descriptions";Jo.prototype.controlText_="Descriptions";K.registerComponent("DescriptionsButton",Jo);class Zo extends Ds{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Zo.prototype.kind_="subtitles";Zo.prototype.controlText_="Subtitles";K.registerComponent("SubtitlesButton",Zo);class eu extends Sr{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}K.registerComponent("CaptionSettingsMenuItem",eu);class tu extends Ds{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new eu(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}tu.prototype.kind_="captions";tu.prototype.controlText_="Captions";K.registerComponent("CaptionsButton",tu);class th extends Sr{createEl(e,t,i){const r=super.createEl(e,t,i),n=r.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",r):n.appendChild(de("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(de("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}K.registerComponent("SubsCapsMenuItem",th);class iu extends Ds{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(je(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 eu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,th),e}}iu.prototype.kinds_=["captions","subtitles"];iu.prototype.controlText_="Subtitles";K.registerComponent("SubsCapsButton",iu);class ih extends xr{constructor(e,t){const i=t.track,r=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",n),this.on("dispose",()=>{r.removeEventListener("change",n)})}createEl(e,t,i){const r=super.createEl(e,t,i),n=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(de("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(de("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const r=t[i];r!==this.track&&(r.enabled=r===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}K.registerComponent("AudioTrackMenuItem",ih);class sh extends Yo{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const r=t[i];e.push(new ih(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}sh.prototype.controlText_="Audio Track";K.registerComponent("AudioTrackButton",sh);class su extends xr{constructor(e,t){const i=t.rate,r=parseFloat(i,10);t.label=i,t.selected=r===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=r,this.on(e,"ratechange",n=>this.update(n))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}su.prototype.contentElType="button";K.registerComponent("PlaybackRateMenuItem",su);class rh extends Ko{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=de("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 i=e.length-1;i>=0;i--)t.push(new su(this.player(),{rate:e[i]+"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")}}rh.prototype.controlText_="Playback Rate";K.registerComponent("PlaybackRateMenuButton",rh);class nh extends K{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}K.registerComponent("Spacer",nh);class iy extends nh{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}K.registerComponent("CustomControlSpacer",iy);class ah extends K{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}ah.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};K.registerComponent("ControlBar",ah);class oh extends ws{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}oh.prototype.options_=Object.assign({},ws.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});K.registerComponent("ErrorDisplay",oh);class uh extends K{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),de("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${It()}`)+"-"+t[1].replace(/\W+/g,""),r=de("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),r}))}}K.registerComponent("TextTrackSelect",uh);class Hi extends K{constructor(e,t={}){super(e,t);const i=de("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const r=this.options_.selects;for(const n of r){const a=this.options_.selectConfigs[n],u=a.className,c=a.id.replace("%s",this.options_.id_);let f=null;const g=`vjs_select_${It()}`;if(this.options_.type==="colors"){f=de("span",{className:u});const A=de("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});A.setAttribute("for",g),f.appendChild(A)}const _=new uh(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:g,labelId:c});this.addChild(_),this.options_.type==="colors"&&(f.appendChild(_.el()),this.el().appendChild(f))}}createEl(){return de("fieldset",{className:this.options_.className})}}K.registerComponent("TextTrackFieldset",Hi);class lh extends K{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,r=new Hi(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const n=new Hi(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new Hi(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return de("div",{className:"vjs-track-settings-colors"})}}K.registerComponent("TextTrackSettingsColors",lh);class ch extends K{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,r=new Hi(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const n=new Hi(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new Hi(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return de("div",{className:"vjs-track-settings-font"})}}K.registerComponent("TextTrackSettingsFont",ch);class dh extends K{constructor(e,t={}){super(e,t);const i=new nt(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const r=this.localize("Done"),n=new nt(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=r,this.addChild(n)}createEl(){return de("div",{className:"vjs-track-settings-controls"})}}K.registerComponent("TrackSettingsControls",dh);const Va="vjs-text-track-settings",Yl=["#000","Black"],Ql=["#00F","Blue"],Jl=["#0FF","Cyan"],Zl=["#0F0","Green"],ec=["#F0F","Magenta"],tc=["#F00","Red"],ic=["#FFF","White"],sc=["#FF0","Yellow"],Ha=["1","Opaque"],za=["0.5","Semi-Transparent"],rc=["0","Transparent"],Si={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Yl,ic,tc,Zl,Ql,sc,ec,Jl],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Ha,za,rc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[ic,Yl,tc,Zl,Ql,sc,ec,Jl],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",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:"",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:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[Ha,za],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[rc,za,Ha],className:"vjs-window-opacity vjs-opacity"}};Si.windowColor.options=Si.backgroundColor.options;function hh(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function sy(s,e){const t=s.options[s.options.selectedIndex].value;return hh(t,e)}function ry(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(hh(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class ny extends ws{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=de("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new lh(e,{textTrackComponentid:this.id_,selectConfigs:Si,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new ch(e,{textTrackComponentid:this.id_,selectConfigs:Si,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const r=new dh(e);this.addChild(r)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),ns(Si,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}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 td(Si,(e,t,i)=>{const r=sy(this.$(t.selector),t.parser);return r!==void 0&&(e[i]=r),e},{})}setValues(e){ns(Si,(t,i)=>{ry(this.$(t.selector),e[i],t.parser)})}setDefaults(){ns(Si,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(D.localStorage.getItem(Va))}catch(t){ve.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?D.localStorage.setItem(Va,JSON.stringify(e)):D.localStorage.removeItem(Va)}catch(t){ve.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}K.registerComponent("TextTrackSettings",ny);class ay extends K{constructor(e,t){let i=t.ResizeObserver||D.ResizeObserver;t.ResizeObserver===null&&(i=!1);const r=Ae({createEl:!i,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||D.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Ed(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){rt(this,"resize",n),rt(this,"unload",a),a=null};bt(this.el_.contentWindow,"unload",a),bt(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()}}K.registerComponent("ResizeManager",ay);const oy={trackingThreshold:20,liveTolerance:15};class uy extends K{constructor(e,t){const i=Ae(oy,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(D.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const r=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===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_,Pt),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 i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){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()}}K.registerComponent("LiveTracker",uy);class ly extends K{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:de("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${It()}`}),description:de("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${It()}`})},de("div",{className:"vjs-title-bar"},{},id(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const n=this.state[r],a=this.els[r],u=i[r];zn(a),n&&Ai(a,n),t&&(t.removeAttribute(u),n&&t.setAttribute(u,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}}K.registerComponent("TitleBar",ly);const cy={initialDisplay:4e3,position:[],takeFocus:!1};class dy extends nt{constructor(e,t){t=Ae(cy,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=de("button",{},{type:"button",class:this.buildCSSClass()},de("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}K.registerComponent("TransientButton",dy);const co=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),i=[];let r="";if(!t.length)return!1;for(let n=0;n<t.length;n++){const a=t[n].src;a&&i.indexOf(a)===-1&&i.push(a)}return i.length?(i.length===1&&(r=i[0]),s.triggerSourceset(r),!0):!1},hy=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=re.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=re.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",D.Element.prototype.appendChild.call(this,t),this.innerHTML}}),fh=(s,e)=>{let t={};for(let i=0;i<s.length&&(t=Object.getOwnPropertyDescriptor(s[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},fy=s=>fh([s.el(),D.HTMLMediaElement.prototype,D.Element.prototype,hy],"innerHTML"),nc=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=fy(s),r=n=>(...a)=>{const u=n.apply(e,a);return co(s),u};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=r(t[n]))}),Object.defineProperty(e,"innerHTML",Ae(i,{set:r(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},py=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Nd(D.Element.prototype.getAttribute.call(this,"src")):""},set(s){return D.Element.prototype.setAttribute.call(this,"src",s),s}}),my=s=>fh([s.el(),D.HTMLMediaElement.prototype,py],"src"),gy=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=my(s),i=e.setAttribute,r=e.load;Object.defineProperty(e,"src",Ae(t,{set:n=>{const a=t.set.call(e,n);return s.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const u=i.call(e,n,a);return/src/i.test(n)&&s.triggerSourceset(e.src),u},e.load=()=>{const n=r.call(e);return co(s)||(s.triggerSourceset(""),nc(s)),n},e.currentSrc?s.triggerSourceset(e.currentSrc):co(s)||nc(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class oe extends me{constructor(e,t){super(e,t);const i=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const u=[];for(;a--;){const c=n[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!r&&!this.el_.hasAttribute("crossorigin")&&Kn(c.src)&&(r=!0)):u.push(c))}for(let c=0;c<u.length;c++)this.el_.removeChild(u[c])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&r&&ve.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
160
|
-
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(pr||jn)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),oe.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){gy(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let n=0;n<e.length;n++){const a=e[n];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const r=()=>{for(let n=0;n<t.length;n++){const a=t[n];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(r=>{this.el()[`${i}Tracks`].removeEventListener(r,this[`${i}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=kt[e],i=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const n={change:u=>{const c={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(c),e==="text"&&this[xs.remoteText.getterName]().trigger(c)},addtrack(u){r.addTrack(u.track)},removetrack(u){r.removeTrack(u.track)}},a=function(){const u=[];for(let c=0;c<r.length;c++){let f=!1;for(let g=0;g<i.length;g++)if(i[g]===r[c]){f=!0;break}f||u.push(r[c])}for(;u.length;)r.removeTrack(u.shift())};this[t.getterName+"Listeners_"]=n,Object.keys(n).forEach(u=>{const c=n[u];i.addEventListener(u,c),this.on("dispose",f=>i.removeEventListener(u,c))}),this.on("loadstart",a),this.on("dispose",u=>this.off("loadstart",a))}proxyNativeTracks_(){kt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),oe.disposeMediaElement(e),e=i}else{e=re.createElement("video");const i=this.options_.tag&&xi(this.options_.tag),r=Ae({},i);(!pr||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,dd(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Ts(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const r=t[i],n=this.options_[r];typeof n<"u"&&(n?Ts(e,r,r):Vn(e,r),e[r]=n)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const r=function(){i=!0};this.on("loadstart",r);const n=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",n),this.ready(function(){this.off("loadstart",r),this.off("loadedmetadata",n),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&qn?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){ve(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Ft&&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)Gt(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)}addSourceElement(e,t){if(!e)return ve.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const r=de("source",{},i);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return ve.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return ve.warn(`No matching source element found with src: ${e}`),!1}reset(){oe.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=re.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 i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),D.performance&&(e.creationTime=D.performance.now()),e}}Bn(oe,"TEST_VID",function(){if(!Ss())return;const s=re.createElement("video"),e=re.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});oe.isSupported=function(){try{oe.TEST_VID.volume=.5}catch{return!1}return!!(oe.TEST_VID&&oe.TEST_VID.canPlayType)};oe.canPlayType=function(s){return oe.TEST_VID.canPlayType(s)};oe.canPlaySource=function(s,e){return oe.canPlayType(s.type)};oe.canControlVolume=function(){try{const s=oe.TEST_VID.volume;oe.TEST_VID.volume=s/2+.1;const e=s!==oe.TEST_VID.volume;return e&&st?(D.setTimeout(()=>{oe&&oe.prototype&&(oe.prototype.featuresVolumeControl=s!==oe.TEST_VID.volume)}),!1):e}catch{return!1}};oe.canMuteVolume=function(){try{const s=oe.TEST_VID.muted;return oe.TEST_VID.muted=!s,oe.TEST_VID.muted?Ts(oe.TEST_VID,"muted","muted"):Vn(oe.TEST_VID,"muted","muted"),s!==oe.TEST_VID.muted}catch{return!1}};oe.canControlPlaybackRate=function(){if(Ft&&Qt&&Fn<58)return!1;try{const s=oe.TEST_VID.playbackRate;return oe.TEST_VID.playbackRate=s/2+.1,s!==oe.TEST_VID.playbackRate}catch{return!1}};oe.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(re.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(re.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(re.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(re.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};oe.supportsNativeTextTracks=function(){return qn||st&&Qt};oe.supportsNativeVideoTracks=function(){return!!(oe.TEST_VID&&oe.TEST_VID.videoTracks)};oe.supportsNativeAudioTracks=function(){return!!(oe.TEST_VID&&oe.TEST_VID.audioTracks)};oe.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([s,e]){Bn(oe.prototype,s,()=>oe[e](),!0)});oe.prototype.featuresVolumeControl=oe.canControlVolume();oe.prototype.movingMediaElementInDOM=!st;oe.prototype.featuresFullscreenResize=!0;oe.prototype.featuresProgressEvents=!0;oe.prototype.featuresTimeupdateEvents=!0;oe.prototype.featuresVideoFrameCallback=!!(oe.TEST_VID&&oe.TEST_VID.requestVideoFrameCallback);oe.disposeMediaElement=function(s){if(s){for(s.parentNode&&s.parentNode.removeChild(s);s.hasChildNodes();)s.removeChild(s.firstChild);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()}};oe.resetMediaElement=function(s){if(!s)return;const e=s.querySelectorAll("source");let t=e.length;for(;t--;)s.removeChild(e[t]);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(s){oe.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){oe.prototype["set"+je(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){oe.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){oe.prototype["set"+je(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){oe.prototype[s]=function(){return this.el_[s]()}});me.withSourceHandlers(oe);oe.nativeSourceHandler={};oe.nativeSourceHandler.canPlayType=function(s){try{return oe.TEST_VID.canPlayType(s)}catch{return""}};oe.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return oe.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=$o(s.src);return oe.nativeSourceHandler.canPlayType(`video/${t}`)}return""};oe.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};oe.nativeSourceHandler.dispose=function(){};oe.registerSourceHandler(oe.nativeSourceHandler);me.registerTech("Html5",oe);const ph=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ga={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},ho=["tiny","xsmall","small","medium","large","xlarge","huge"],ln={};ho.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;ln[s]=`vjs-layout-${e}`});const _y={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ee extends K{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${It()}`,t=Object.assign(Ee.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,i),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.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Zc(this.id_),this.fsApi_=fn,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_={controlBarHeight:null,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&&xi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(u){a[u.toLowerCase()]=t.languages[u]}),this.languages_=a}else this.languages_=Ee.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(),Bo(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(bt(re,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Ae(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const u=new D.DOMParser().parseFromString(j_,"image/svg+xml");if(u.querySelector("parsererror"))ve.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const f=u.documentElement;f.style.display="none",this.el_.appendChild(f),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"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new q_(this),this.addClass("vjs-spatial-navigation-enabled")),pr&&this.addClass("vjs-touch-enabled"),st||this.addClass("vjs-workinghover"),Ee.players[this.id_]=this;const n=eo.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"),rt(re,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),rt(re,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ee.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),M_(this),ct.names.forEach(e=>{const t=ct[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const n=xi(e);if(r){for(t=this.el_=e,e=this.tag=re.createElement("video");t.children.length;)e.appendChild(t.firstChild);ur(t,"video-js")||$i(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),n.tabindex="-1",Qt&&Un&&(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(c){r&&c==="class"||t.setAttribute(c,n[c]),r&&e.setAttribute(c,n[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(c=>od[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),D.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=xd("vjs-styles-dimensions");const c=wi(".vjs-styles-defaults"),f=wi("head");f.insertBefore(this.styleEl_,c?c.nextSibling:f.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 u=e.getElementsByTagName("a");for(let c=0;c<u.length;c++){const f=u.item(c);$i(f,"vjs-hidden"),f.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),io(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){ve.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){ve.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,oi(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),p_(this,()=>{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(D.VIDEOJS_NO_DYNAMIC_STYLE===!0){const u=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,f=this.tech_&&this.tech_.el();f&&(u>=0&&(f.width=u),c>=0&&(f.height=c));return}let e,t,i,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const n=i.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())?r="dimensions-"+this.id():r=this.id()+"-dimensions",this.addClass(r),Sd(this.styleEl_,`
|
|
159
|
+
</svg>`;const Jl=_n?10009:yn?461:8,ts={codes:{play:415,pause:19,ff:417,rw:412,back:Jl},names:{415:"play",19:"pause",417:"ff",412:"rw",[Jl]:"back"},isEventKey(s,e){return e=e.toLowerCase(),!!(this.names[s.keyCode]&&this.names[s.keyCode]===e)},getEventName(s){if(this.names[s.keyCode])return this.names[s.keyCode];if(this.codes[s.code]){const e=this.codes[s.code];return this.names[e]}return null}},Zl=5;class ly extends Ct{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(ts.isEventKey(t,"play")||ts.isEventKey(t,"pause")||ts.isEventKey(t,"ff")||ts.isEventKey(t,"rw")){t.preventDefault();const i=ts.getEventName(t);this.performMediaAction_(i)}else ts.isEventKey(t,"Back")&&e.target&&typeof e.target.closeable=="function"&&e.target.closeable()&&(t.preventDefault(),e.target.close())}performMediaAction_(e){if(this.player_)switch(e){case"play":this.player_.paused()&&this.player_.play();break;case"pause":this.player_.paused()||this.player_.pause();break;case"ff":this.userSeek_(this.player_.currentTime()+Zl);break;case"rw":this.userSeek_(this.player_.currentTime()-Zl);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const r=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(r&&r.name()==="CloseButton"?this.refocusComponent():(this.pause(),r&&r.el()&&(this.lastFocusedComponent_=r)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(r){for(const n of r)n.hasOwnProperty("el_")&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())&&t.push(n),n.hasOwnProperty("children_")&&n.children_.length>0&&i(n.children_)}return e.children_.forEach(r=>{if(r.hasOwnProperty("el_"))if(r.getIsFocusable&&r.getIsAvailableToBeFocused&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())){t.push(r);return}else r.hasOwnProperty("children_")&&r.children_.length>0?i(r.children_):r.hasOwnProperty("items")&&r.items.length>0?i(r.items):this.findSuitableDOMChild(r)&&t.push(r);if(r.name_==="ErrorDisplay"&&r.opened_){const n=r.el_.querySelector(".vjs-errors-ok-button-container");n&&n.querySelectorAll("button").forEach((u,l)=>{t.push({name:()=>"ModalButton"+(l+1),el:()=>u,getPositions:()=>{const f=u.getBoundingClientRect(),g={x:f.x,y:f.y,width:f.width,height:f.height,top:f.top,right:f.right,bottom:f.bottom,left:f.left},_={x:f.left+f.width/2,y:f.top+f.height/2,width:0,height:0,top:f.top+f.height/2,right:f.left+f.width/2,bottom:f.top+f.height/2,left:f.left+f.width/2};return{boundingClientRect:g,center:_}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:f=>!0,focus:()=>u.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let r=0;r<i.children.length;r++){const n=i.children[r],a=t(n);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),r=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),n=this.findBestCandidate_(i.center,r,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let r=1/0,n=null;for(const a of t){const u=a.getPositions().center,l=this.calculateDistance_(e,u,i);l<r&&(r=l,n=a)}return n}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const r=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);let a;switch(i){case"right":case"left":a=r+n*100;break;case"up":a=n*2+r*.5;break;case"down":a=n*5+r;break;default:a=r+n}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class cy extends K{constructor(e,t,i){const r=ke({createEl:!1},t);if(super(e,r,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const u=He(a[n]);let l=ye.getTech(u);if(u||(l=K.getComponent(u)),l&&l.isSupported()){e.loadTech_(u);break}}else e.src(t.playerOptions.sources)}}K.registerComponent("MediaLoader",cy);class Qn extends K{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ve.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const r=fe(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=fe("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 i=this.localize(e);this.controlText_=e,Ai(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&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_<"u"&&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){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}K.registerComponent("ClickableComponent",Qn);class fo extends Qn{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return fe("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")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(fe("picture",{className:"vjs-poster",tabIndex:-1},{},fe("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()?Kt(this.player_.play()):this.player_.pause())}}fo.prototype.crossorigin=fo.prototype.crossOrigin;K.registerComponent("PosterImage",fo);const It="#222",ec="#ccc",dy={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 $a(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; 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 Gt(s,e,t){try{s.style[e]=t}catch{return}}function tc(s){return s?`${s}px`:""}class hy extends K{constructor(e,t,i){super(e,t,i);const r=a=>this.updateDisplay(a),n=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("useractive",r),e.on("userinactive",r),e.on("texttrackchange",r),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=D.screen.orientation||D,u=D.screen.orientation?"change":"orientationchange";a.addEventListener(u,n),e.on("dispose",()=>a.removeEventListener(u,n));const l=this.options_.playerOptions.tracks||[];for(let f=0;f<l.length;f++)this.player_.addRemoteTextTrack(l[f],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let r,n,a;for(let u=0;u<t.length;u++){const l=t[u];i&&i.enabled&&i.language&&i.language===l.language&&l.kind in e?l.kind===i.kind?a=l:a||(a=l):i&&!i.enabled?(a=null,r=null,n=null):l.default&&(l.kind==="descriptions"&&!r?r=l:l.kind in e&&!n&&(n=l))}a?a.mode="showing":n?n.mode="showing":r&&(r.mode="showing")}toggleDisplay(){this.player_.tech_&&this.player_.tech_.featuresNativeTextTracks?this.hide():this.show()}createEl(){return super.createEl("div",{className:"vjs-text-track-display"},{translate:"yes","aria-live":"off","aria-atomic":"true"})}clearDisplay(){typeof D.WebVTT=="function"&&D.WebVTT.processCues(D,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let u=0;u<e.length;++u){const l=e[u];l.mode==="showing"&&a.push(l)}this.updateForTrack(a);return}let i=null,r=null,n=e.length;for(;n--;){const a=e[n];a.mode==="showing"&&(a.kind==="descriptions"?i=a:r=a)}if(r?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(r)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!D.CSS.supports("inset","10px")){const a=this.el_,u=a.querySelectorAll(".vjs-text-track-cue"),l=this.player_.controlBar.el_.getBoundingClientRect().height,f=this.player_.el_.getBoundingClientRect().height;a.style="",Gt(a,"position","relative"),Gt(a,"height",f-l+"px"),Gt(a,"top","unset"),Tn?Gt(a,"bottom",f+"px"):Gt(a,"bottom","0px"),u.length>0&&u.forEach(g=>{if(g.style.inset){const _=g.style.inset.split(" ");_.length===3&&Object.assign(g.style,{top:_[0],right:_[1],bottom:_[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!D.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,r=this.player_.videoWidth()/this.player_.videoHeight();let n=0,a=0;Math.abs(i-r)>.1&&(i>r?n=Math.round((e-t*r)/2):a=Math.round((t-e/r)/2)),Gt(this.el_,"insetInline",tc(n)),Gt(this.el_,"insetBlock",tc(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let r=i.length;for(;r--;){const n=i[r];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Gt(a.firstChild,"color",$a(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Gt(a.firstChild,"backgroundColor",$a(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Gt(a,"backgroundColor",$a(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${It}, 2px 2px 4px ${It}, 2px 2px 5px ${It}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${It}, 2px 2px ${It}, 3px 3px ${It}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${ec}, 0 1px ${ec}, -1px -1px ${It}, 0 -1px ${It}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${It}, 0 0 4px ${It}, 0 0 4px ${It}, 0 0 4px ${It}`)),t.fontPercent&&t.fontPercent!==1){const u=D.parseFloat(a.style.fontSize);a.style.fontSize=u*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=dy[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof D.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const r=e[i];for(let n=0;n<r.activeCues.length;++n)t.push(r.activeCues[n])}D.WebVTT.processCues(D,t,this.el_);for(let i=0;i<e.length;++i){const r=e[i];for(let n=0;n<r.activeCues.length;++n){const a=r.activeCues[n].displayState;Vi(a,"vjs-text-track-cue","vjs-text-track-cue-"+(r.language?r.language:i)),r.language&&bs(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}K.registerComponent("TextTrackDisplay",hy);class fy extends K{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=fe("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),r=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(i),r}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}K.registerComponent("LoadingSpinner",fy);class ut extends Qn{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const r=fe(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const i=this.constructor.name;return ve.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),K.prototype.addChild.call(this,e,t)}enable(){super.enable(),this.el_.removeAttribute("disabled")}disable(){super.disable(),this.el_.setAttribute("disabled","disabled")}handleKeyDown(e){if(e.key===" "||e.key==="Enter"){e.stopPropagation();return}super.handleKeyDown(e)}}K.registerComponent("Button",ut);class Jd extends ut{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Kt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),r=i&&i.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const n=()=>r.focus();dr(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Jd.prototype.controlText_="Play Video";K.registerComponent("BigPlayButton",Jd);class py extends ut{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){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}K.registerComponent("CloseButton",py);class Zd extends ut{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Kt(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))}}Zd.prototype.controlText_="Play";K.registerComponent("PlayToggle",Zd);class ks extends K{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=fe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=fe("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Wi(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,ve.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_=re.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}ks.prototype.labelText_="Time";ks.prototype.controlText_="Time";K.registerComponent("TimeDisplay",ks);class Xo extends ks{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():e&&e.target&&typeof e.target.pendingSeekTime=="function"?t=e.target.pendingSeekTime():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Xo.prototype.labelText_="Current Time";Xo.prototype.controlText_="Current Time";K.registerComponent("CurrentTimeDisplay",Xo);class Ko extends ks{constructor(e,t){super(e,t);const i=r=>this.updateContent(r);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Ko.prototype.labelText_="Duration";Ko.prototype.controlText_="Duration";K.registerComponent("DurationDisplay",Ko);class my extends K{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}K.registerComponent("TimeDivider",my);class Yo extends ks{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(fe("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)}}Yo.prototype.labelText_="Remaining Time";Yo.prototype.controlText_="Remaining Time";K.registerComponent("RemainingTimeDisplay",Yo);class gy extends K{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=fe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(fe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(re.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()}}K.registerComponent("LiveDisplay",gy);class eh extends ut{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),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_=fe("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()}}eh.prototype.controlText_="Seek to live, currently playing live";K.registerComponent("SeekToLive",eh);function xr(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var _y=Object.freeze({__proto__:null,clamp:xr});class Qo extends K{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),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={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ei&&e.preventDefault(),wd(),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;Ad(),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(xr(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=zn(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,r=t&&t.horizontalSeek;i?r&&e.key==="ArrowLeft"||!r&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):r&&e.key==="ArrowRight"||!r&&e.key==="ArrowUp"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(this.pendingSeekTime()&&(this.pendingSeekTime(null),this.userSeek_(this.player_.currentTime())),super.handleKeyDown(e)):e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):e.key==="ArrowUp"||e.key==="ArrowRight"?(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")}}K.registerComponent("Slider",Qo);const Va=(s,e)=>xr(s/e*100,0,100).toFixed(2)+"%";class yy extends K{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=fe("span",{className:"vjs-control-text"}),i=fe("span",{textContent:this.localize("Loaded")}),r=re.createTextNode(": ");return this.percentageEl_=fe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(r),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,i=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,u=Va(n,r);this.percent_!==u&&(this.el_.style.width=u,Ai(this.percentageEl_,u),this.percent_=u);for(let l=0;l<i.length;l++){const f=i.start(l),g=i.end(l);let _=a[l];_||(_=this.el_.appendChild(fe()),a[l]=_),!(_.dataset.start===f&&_.dataset.end===g)&&(_.dataset.start=f,_.dataset.end=g,_.style.left=Va(f,n),_.style.width=Va(g-f,n))}for(let l=a.length;l>i.length;l--)this.el_.removeChild(a[l-1]);a.length=i.length})}}K.registerComponent("LoadProgressBar",yy);class Ty extends K{constructor(e,t){super(e,t),this.update=ti(Le(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const r=gr(this.el_),n=xs(this.player_.el()),a=e.width*t;if(!n||!r)return;let u=e.left-n.left+a,l=e.width-a+(n.right-e.right);l||(l=e.width-a,u=a);let f=r.width/2;u<f?f+=f-u:l<f&&(f=l),f<0?f=0:f>r.width&&(f=r.width),f=Math.round(f),this.el_.style.right=`-${f}px`,this.write(i)}write(e){Ai(this.el_,e)}updateTime(e,t,i,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const u=this.player_.liveTracker.liveWindow(),l=u-t*u;n=(l<1?"":"-")+Wi(l,u)}else n=Wi(i,a);this.update(e,t,n),r&&r()})}}K.registerComponent("TimeTooltip",Ty);class Jo extends K{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ti(Le(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const r=this.getChild("timeTooltip");if(!r)return;const n=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}Jo.prototype.options_={children:[]};!at&&!jt&&Jo.prototype.options_.children.push("timeTooltip");K.registerComponent("PlayProgressBar",Jo);class th extends K{constructor(e,t){super(e,t),this.update=ti(Le(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}th.prototype.options_={children:["timeTooltip"]};K.registerComponent("MouseTimeDisplay",th);class Jn extends Qo{constructor(e,t){t=ke(Jn.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(at||jt)||e.options_.disableSeekWhileScrubbingOnSTV;(!at&&!jt||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Le(this,this.update),this.update=ti(this.update_,Ot),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],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 re&&"visibilityState"in re&&this.on(re,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){re.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,Ot))}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(re.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let n=this.player_.duration();r&&r.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Wi(i,n),Wi(n,n)],"{1} of {2}")),this.currentTime_=i,this.duration_=n),this.bar&&this.bar.update(xs(this.el()),this.getProgress(),e)}),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()}pendingSeekTime(e){if(e!==void 0)if(e!==null){const t=this.player_.duration();this.pendingSeekTime_=Math.max(0,Math.min(e,t))}else this.pendingSeekTime_=null;return this.pendingSeekTime_}getPercent(){if(this.pendingSeekTime()!==null)return this.pendingSeekTime()/this.player_.duration();const e=this.getCurrentTime_();let t;const i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){_r(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!_r(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const r=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())i=r*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(r>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),u=n.liveCurrentTime();if(i=a+r*n.liveWindow(),i>=u&&(i=u),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbing_?this.pendingSeekTime(i):this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}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.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Kt(this.player_.play()):this.update_()}handlePendingSeek_(e){this.player_.paused()||this.player_.pause();const t=this.pendingSeekTime()!==null?this.pendingSeekTime():this.player_.currentTime();this.pendingSeekTime(t+e),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}stepForward(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(this.options().stepSeconds):this.userSeek_(this.player_.currentTime()+this.options().stepSeconds)}stepBack(){this.shouldDisableSeekWhileScrubbing_?this.handlePendingSeek_(-this.options().stepSeconds):this.userSeek_(this.player_.currentTime()-this.options().stepSeconds)}handleAction(e){this.pendingSeekTime()!==null&&(this.userSeek_(this.pendingSeekTime()),this.pendingSeekTime(null)),this.player_.paused()?this.player_.play():this.player_.pause()}handleKeyDown(e){const t=this.player_.liveTracker;if(e.key===" "||e.key==="Enter")e.preventDefault(),e.stopPropagation(),this.handleAction(e);else if(e.key==="Home")e.preventDefault(),e.stopPropagation(),this.userSeek_(0);else if(e.key==="End")e.preventDefault(),e.stopPropagation(),t&&t.isLive()?this.userSeek_(t.liveCurrentTime()):this.userSeek_(this.player_.duration());else if(/^[0-9]$/.test(e.key)){e.preventDefault(),e.stopPropagation();const i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-this.options().stepSeconds*this.options().pageMultiplier)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+this.options().stepSeconds*this.options().pageMultiplier)):super.handleKeyDown(e)}dispose(){this.disableInterval_(),this.off(this.player_,["durationchange","timeupdate"],this.update),this.off(this.player_,["ended"],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 re&&"visibilityState"in re&&this.off(re,"visibilitychange",this.toggleVisibility_),super.dispose()}}Jn.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};K.registerComponent("SeekBar",Jn);class ih extends K{constructor(e,t){super(e,t),this.handleMouseMove=ti(Le(this,this.handleMouseMove),Ot),this.throttledHandleMouseSeek=ti(Le(this,this.handleMouseSeek),Ot),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!i&&!r)return;const n=t.el(),a=gr(n);let u=zn(n,e).x;u=xr(u,0,1),r&&r.update(a,u),i&&i.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","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Kt(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","touchmove"],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,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}ih.prototype.options_={children:["seekBar"]};K.registerComponent("ProgressControl",ih);class sh extends ut{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),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(){re.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in D?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 re.exitPictureInPicture=="function"&&super.show()}}sh.prototype.controlText_="Picture-in-Picture";K.registerComponent("PictureInPictureToggle",sh);class rh extends ut{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),re[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()}}rh.prototype.controlText_="Fullscreen";K.registerComponent("FullscreenToggle",rh);const vy=function(s,e){e.tech_&&!e.tech_.featuresVolumeControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class by extends K{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}}K.registerComponent("VolumeLevel",by);class xy extends K{constructor(e,t){super(e,t),this.update=ti(Le(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,r){if(!i){const n=xs(this.el_),a=xs(this.player_.el()),u=e.width*t;if(!a||!n)return;const l=e.left-a.left+u,f=e.width-u+(a.right-e.right);let g=n.width/2;l<g?g+=g-l:f<g&&(g=f),g<0?g=0:g>n.width&&(g=n.width),this.el_.style.right=`-${g}px`}this.write(`${r}%`)}write(e){Ai(this.el_,e)}updateVolume(e,t,i,r,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,r.toFixed(0)),n&&n()})}}K.registerComponent("VolumeLevelTooltip",xy);class nh extends K{constructor(e,t){super(e,t),this.update=ti(Le(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}nh.prototype.options_={children:["volumeLevelTooltip"]};K.registerComponent("MouseVolumeLevelDisplay",nh);class Zn extends Qo{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),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){_r(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),r=xs(i),n=this.vertical();let a=zn(i,e);a=n?a.y:a.x,a=xr(a,0,1),t.update(r,a,n)}_r(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)})}}Zn.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!at&&!jt&&Zn.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Zn.prototype.playerEvent="volumechange";K.registerComponent("VolumeBar",Zn);let ah=class extends K{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||vs(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),vy(this,e),this.throttledHandleMouseMove=ti(Le(this,this.handleMouseMove),Ot),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),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)}};ah.prototype.options_={children:["volumeBar"]};K.registerComponent("VolumeControl",ah);const Sy=function(s,e){e.tech_&&!e.tech_.featuresMuteControl&&s.addClass("vjs-hidden"),s.on(e,"loadstart",function(){e.tech_.featuresMuteControl?s.removeClass("vjs-hidden"):s.addClass("vjs-hidden")})};class oh extends ut{constructor(e,t){super(e,t),Sy(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const r=i<.1?.1:i;this.player_.volume(r),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"),at&&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),Vn(this.el_,[0,1,2,3].reduce((i,r)=>i+`${r?" ":""}vjs-vol-${r}`,"")),Vi(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}oh.prototype.controlText_="Mute";K.registerComponent("MuteToggle",oh);class uh extends K{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||vs(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),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){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),Et(re,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ot(re,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}uh.prototype.options_={children:["muteToggle","volumeControl"]};K.registerComponent("VolumePanel",uh);class lh extends ut{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.toLocaleString(e.language())])),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(),i=this.player_.liveTracker,r=i&&i.isLive()?i.seekableEnd():this.player_.duration();let n;t+this.skipTime<=r?n=t+this.skipTime:n=r,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}lh.prototype.controlText_="Skip Forward";K.registerComponent("SkipForward",lh);class ch extends ut{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.toLocaleString(e.language())])),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(),i=this.player_.liveTracker,r=i&&i.isLive()&&i.seekableStart();let n;r&&t-this.skipTime<=r?n=r:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}ch.prototype.controlText_="Skip Backward";K.registerComponent("SkipBackward",ch);class dh extends K{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof K&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof K&&(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_=fe(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_),Et(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||re.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(r=>r.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(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())}}K.registerComponent("Menu",dh);class Zo extends K{constructor(e,t={}){super(e,t),this.menuButton_=new ut(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=ut.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Et(re,"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 dh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=fe("li",{className:"vjs-menu-title",textContent:He(this.options_.title),tabIndex:-1}),i=new K(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=ut.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),ot(re,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),at&&bd())return;this.menu.focus()}}unpressButton(){this.enabled_&&(this.buttonPressed_=!1,this.menu.unlockShowing(),this.menu.hide(),this.menuButton_.el_.setAttribute("aria-expanded","false"))}disable(){this.unpressButton(),this.enabled_=!1,this.addClass("vjs-disabled"),this.menuButton_.disable()}enable(){this.enabled_=!0,this.removeClass("vjs-disabled"),this.menuButton_.enable()}}K.registerComponent("MenuButton",Zo);class eu extends Zo{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const r=Le(this,this.update);i.addEventListener("removetrack",r),i.addEventListener("addtrack",r),i.addEventListener("labelchange",r),this.player_.on("ready",r),this.player_.on("dispose",function(){i.removeEventListener("removetrack",r),i.removeEventListener("addtrack",r),i.removeEventListener("labelchange",r)})}}K.registerComponent("TrackButton",eu);class Sr extends Qn{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const r=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),n=fe("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?r.appendChild(n):r.replaceChild(n,r.querySelector(".vjs-icon-placeholder")),r}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||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))}}K.registerComponent("MenuItem",Sr);class Er extends Sr{constructor(e,t){const i=t.track,r=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const n=(...u)=>{this.handleTracksChange.apply(this,u)},a=(...u)=>{this.handleSelectedLanguageChange.apply(this,u)};if(e.on(["loadstart","texttrackchange"],n),r.addEventListener("change",n),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],n),r.removeEventListener("change",n),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let u;this.on(["tap","click"],function(){if(typeof D.Event!="object")try{u=new D.Event("change")}catch{}u||(u=re.createEvent("Event"),u.initEvent("change",!0,!0)),r.dispatchEvent(u)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let r=0;r<i.length;r++){const n=i[r];this.kinds.indexOf(n.kind)!==-1&&(n===t?n.mode!=="showing"&&(n.mode="showing"):n.mode!=="disabled"&&(n.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}K.registerComponent("TextTrackMenuItem",Er);class hh extends Er{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let r=0,n=t.length;r<n;r++){const a=t[r];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let r=0,n=t.length;r<n;r++){const a=t[r];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}K.registerComponent("OffTextTrackMenuItem",hh);class Is extends eu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Er){let i;this.label_&&(i=`${this.label_} off`),e.push(new hh(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let n=0;n<r.length;n++){const a=r[n];if(this.kinds_.indexOf(a.kind)>-1){const u=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});u.addClass(`vjs-${a.kind}-menu-item`),e.push(u)}}return e}}K.registerComponent("TextTrackButton",Is);class fh extends Sr{constructor(e,t){const i=t.track,r=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=n&&n<r.endTime,super(e,t),this.track=i,this.cue=r}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}K.registerComponent("ChaptersTrackMenuItem",fh);class tu extends Is{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(r=>{r.selected(this.track_.activeCues[0]===r.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 i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(He(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 i=0,r=t.length;i<r;i++){const n=t[i],a=new fh(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}tu.prototype.kind_="chapters";tu.prototype.controlText_="Chapters";K.registerComponent("ChaptersButton",tu);class iu extends Is{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const r=e.textTracks(),n=Le(this,this.handleTracksChange);r.addEventListener("change",n),this.on("dispose",function(){r.removeEventListener("change",n)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let r=0,n=t.length;r<n;r++){const a=t[r];if(a.kind!==this.kind_&&a.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}iu.prototype.kind_="descriptions";iu.prototype.controlText_="Descriptions";K.registerComponent("DescriptionsButton",iu);class su extends Is{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}su.prototype.kind_="subtitles";su.prototype.controlText_="Subtitles";K.registerComponent("SubtitlesButton",su);class ru extends Er{constructor(e,t){t.track={player:e,kind:t.kind,label:t.kind+" settings",selectable:!1,default:!1,mode:"disabled"},t.selectable=!1,t.name="CaptionSettingsMenuItem",super(e,t),this.addClass("vjs-texttrack-settings"),this.controlText(", opens "+t.kind+" settings dialog")}handleClick(e){this.player().getChild("textTrackSettings").open()}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.kind+" settings"),super.handleLanguagechange()}}K.registerComponent("CaptionSettingsMenuItem",ru);class nu extends Is{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new ru(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}nu.prototype.kind_="captions";nu.prototype.controlText_="Captions";K.registerComponent("CaptionsButton",nu);class ph extends Er{createEl(e,t,i){const r=super.createEl(e,t,i),n=r.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",r):n.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(fe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}K.registerComponent("SubsCapsMenuItem",ph);class au extends Is{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(He(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 ru(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,ph),e}}au.prototype.kinds_=["captions","subtitles"];au.prototype.controlText_="Subtitles";K.registerComponent("SubsCapsButton",au);class mh extends Sr{constructor(e,t){const i=t.track,r=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",n),this.on("dispose",()=>{r.removeEventListener("change",n)})}createEl(e,t,i){const r=super.createEl(e,t,i),n=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(fe("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const r=t[i];r!==this.track&&(r.enabled=r===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}K.registerComponent("AudioTrackMenuItem",mh);class gh extends eu{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const r=t[i];e.push(new mh(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}gh.prototype.controlText_="Audio Track";K.registerComponent("AudioTrackButton",gh);class ou extends Sr{constructor(e,t){const i=t.rate,r=parseFloat(i,10);t.label=i,t.selected=r===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=r,this.on(e,"ratechange",n=>this.update(n))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}ou.prototype.contentElType="button";K.registerComponent("PlaybackRateMenuItem",ou);class _h extends Zo{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=fe("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 i=e.length-1;i>=0;i--)t.push(new ou(this.player(),{rate:e[i]+"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")}}_h.prototype.controlText_="Playback Rate";K.registerComponent("PlaybackRateMenuButton",_h);class yh extends K{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}K.registerComponent("Spacer",yh);class Ey extends yh{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}K.registerComponent("CustomControlSpacer",Ey);class Th extends K{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Th.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};K.registerComponent("ControlBar",Th);class vh extends Ds{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}vh.prototype.options_=Object.assign({},Ds.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});K.registerComponent("ErrorDisplay",vh);class bh extends K{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),fe("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Lt()}`)+"-"+t[1].replace(/\W+/g,""),r=fe("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),r}))}}K.registerComponent("TextTrackSelect",bh);class zi extends K{constructor(e,t={}){super(e,t);const i=fe("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const r=this.options_.selects;for(const n of r){const a=this.options_.selectConfigs[n],u=a.className,l=a.id.replace("%s",this.options_.id_);let f=null;const g=`vjs_select_${Lt()}`;if(this.options_.type==="colors"){f=fe("span",{className:u});const A=fe("label",{id:l,className:"vjs-label",textContent:this.localize(a.label)});A.setAttribute("for",g),f.appendChild(A)}const _=new bh(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:g,labelId:l});this.addChild(_),this.options_.type==="colors"&&(f.appendChild(_.el()),this.el().appendChild(f))}}createEl(){return fe("fieldset",{className:this.options_.className})}}K.registerComponent("TextTrackFieldset",zi);class xh extends K{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,r=new zi(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const n=new zi(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new zi(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return fe("div",{className:"vjs-track-settings-colors"})}}K.registerComponent("TextTrackSettingsColors",xh);class Sh extends K{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,r=new zi(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const n=new zi(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new zi(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return fe("div",{className:"vjs-track-settings-font"})}}K.registerComponent("TextTrackSettingsFont",Sh);class Eh extends K{constructor(e,t={}){super(e,t);const i=new ut(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const r=this.localize("Done"),n=new ut(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=r,this.addChild(n)}createEl(){return fe("div",{className:"vjs-track-settings-controls"})}}K.registerComponent("TrackSettingsControls",Eh);const Ha="vjs-text-track-settings",ic=["#000","Black"],sc=["#00F","Blue"],rc=["#0FF","Cyan"],nc=["#0F0","Green"],ac=["#F0F","Magenta"],oc=["#F00","Red"],uc=["#FFF","White"],lc=["#FF0","Yellow"],za=["1","Opaque"],Ga=["0.5","Semi-Transparent"],cc=["0","Transparent"],Si={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ic,uc,oc,nc,sc,lc,ac,rc],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[za,Ga,cc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[uc,ic,oc,nc,sc,lc,ac,rc],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",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:"",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:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[za,Ga],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[cc,Ga,za],className:"vjs-window-opacity vjs-opacity"}};Si.windowColor.options=Si.backgroundColor.options;function Ch(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function Cy(s,e){const t=s.options[s.options.selectedIndex].value;return Ch(t,e)}function wy(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(Ch(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Ay extends Ds{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=fe("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new xh(e,{textTrackComponentid:this.id_,selectConfigs:Si,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new Sh(e,{textTrackComponentid:this.id_,selectConfigs:Si,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const r=new Eh(e);this.addChild(r)}bindFunctionsToSelectsAndButtons(){this.on(this.$(".vjs-done-button"),["click","tap"],()=>{this.saveSettings(),this.close()}),this.on(this.$(".vjs-default-button"),["click","tap"],()=>{this.setDefaults(),this.updateDisplay()}),os(Si,e=>{this.on(this.$(e.selector),"change",this.updateDisplay)})}dispose(){this.endDialog=null,super.dispose()}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 pd(Si,(e,t,i)=>{const r=Cy(this.$(t.selector),t.parser);return r!==void 0&&(e[i]=r),e},{})}setValues(e){os(Si,(t,i)=>{wy(this.$(t.selector),e[i],t.parser)})}setDefaults(){os(Si,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(D.localStorage.getItem(Ha))}catch(t){ve.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?D.localStorage.setItem(Ha,JSON.stringify(e)):D.localStorage.removeItem(Ha)}catch(t){ve.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}K.registerComponent("TextTrackSettings",Ay);class Dy extends K{constructor(e,t){let i=t.ResizeObserver||D.ResizeObserver;t.ResizeObserver===null&&(i=!1);const r=ke({createEl:!i,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||D.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Bd(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){ot(this,"resize",n),ot(this,"unload",a),a=null};Et(this.el_.contentWindow,"unload",a),Et(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()}}K.registerComponent("ResizeManager",Dy);const ky={trackingThreshold:20,liveTolerance:15};class Iy extends K{constructor(e,t){const i=ke(ky,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(D.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const r=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===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_,Ot),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 i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){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()}}K.registerComponent("LiveTracker",Iy);class Py extends K{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:fe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Lt()}`}),description:fe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Lt()}`})},fe("div",{className:"vjs-title-bar"},{},md(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const n=this.state[r],a=this.els[r],u=i[r];Gn(a),n&&Ai(a,n),t&&(t.removeAttribute(u),n&&t.setAttribute(u,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}}K.registerComponent("TitleBar",Py);const Ly={initialDisplay:4e3,position:[],takeFocus:!1};class Oy extends ut{constructor(e,t){t=ke(Ly,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=fe("button",{},{type:"button",class:this.buildCSSClass()},fe("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}K.registerComponent("TransientButton",Oy);const po=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),i=[];let r="";if(!t.length)return!1;for(let n=0;n<t.length;n++){const a=t[n].src;a&&i.indexOf(a)===-1&&i.push(a)}return i.length?(i.length===1&&(r=i[0]),s.triggerSourceset(r),!0):!1},Ry=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=re.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=re.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",D.Element.prototype.appendChild.call(this,t),this.innerHTML}}),wh=(s,e)=>{let t={};for(let i=0;i<s.length&&(t=Object.getOwnPropertyDescriptor(s[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},Ny=s=>wh([s.el(),D.HTMLMediaElement.prototype,D.Element.prototype,Ry],"innerHTML"),dc=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=Ny(s),r=n=>(...a)=>{const u=n.apply(e,a);return po(s),u};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=r(t[n]))}),Object.defineProperty(e,"innerHTML",ke(i,{set:r(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},My=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Xd(D.Element.prototype.getAttribute.call(this,"src")):""},set(s){return D.Element.prototype.setAttribute.call(this,"src",s),s}}),By=s=>wh([s.el(),D.HTMLMediaElement.prototype,My],"src"),Fy=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=By(s),i=e.setAttribute,r=e.load;Object.defineProperty(e,"src",ke(t,{set:n=>{const a=t.set.call(e,n);return s.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const u=i.call(e,n,a);return/src/i.test(n)&&s.triggerSourceset(e.src),u},e.load=()=>{const n=r.call(e);return po(s)||(s.triggerSourceset(""),dc(s)),n},e.currentSrc?s.triggerSourceset(e.currentSrc):po(s)||dc(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class ue extends ye{constructor(e,t){super(e,t);const i=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const u=[];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),!r&&!this.el_.hasAttribute("crossorigin")&&Yn(l.src)&&(r=!0)):u.push(l))}for(let l=0;l<u.length;l++)this.el_.removeChild(u[l])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&r&&ve.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
160
|
+
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(mr||qn)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),ue.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Fy(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let n=0;n<e.length;n++){const a=e[n];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const r=()=>{for(let n=0;n<t.length;n++){const a=t[n];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(r=>{this.el()[`${i}Tracks`].removeEventListener(r,this[`${i}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Pt[e],i=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const n={change:u=>{const l={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(l),e==="text"&&this[Es.remoteText.getterName]().trigger(l)},addtrack(u){r.addTrack(u.track)},removetrack(u){r.removeTrack(u.track)}},a=function(){const u=[];for(let l=0;l<r.length;l++){let f=!1;for(let g=0;g<i.length;g++)if(i[g]===r[l]){f=!0;break}f||u.push(r[l])}for(;u.length;)r.removeTrack(u.shift())};this[t.getterName+"Listeners_"]=n,Object.keys(n).forEach(u=>{const l=n[u];i.addEventListener(u,l),this.on("dispose",f=>i.removeEventListener(u,l))}),this.on("loadstart",a),this.on("dispose",u=>this.off("loadstart",a))}proxyNativeTracks_(){Pt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),ue.disposeMediaElement(e),e=i}else{e=re.createElement("video");const i=this.options_.tag&&xi(this.options_.tag),r=ke({},i);(!mr||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Ed(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&bs(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const r=t[i],n=this.options_[r];typeof n<"u"&&(n?bs(e,r,r):Hn(e,r),e[r]=n)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const r=function(){i=!0};this.on("loadstart",r);const n=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",n),this.ready(function(){this.off("loadstart",r),this.off("loadedmetadata",n),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&$n?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){ve(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&jt&&ei&&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)Kt(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)}addSourceElement(e,t){if(!e)return ve.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const r=fe("source",{},i);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return ve.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return ve.warn(`No matching source element found with src: ${e}`),!1}reset(){ue.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=re.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 i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),D.performance&&(e.creationTime=D.performance.now()),e}}Fn(ue,"TEST_VID",function(){if(!Cs())return;const s=re.createElement("video"),e=re.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});ue.isSupported=function(){try{ue.TEST_VID.volume=.5}catch{return!1}return!!(ue.TEST_VID&&ue.TEST_VID.canPlayType)};ue.canPlayType=function(s){return ue.TEST_VID.canPlayType(s)};ue.canPlaySource=function(s,e){return ue.canPlayType(s.type)};ue.canControlVolume=function(){try{const s=ue.TEST_VID.volume;ue.TEST_VID.volume=s/2+.1;const e=s!==ue.TEST_VID.volume;return e&&at?(D.setTimeout(()=>{ue&&ue.prototype&&(ue.prototype.featuresVolumeControl=s!==ue.TEST_VID.volume)}),!1):e}catch{return!1}};ue.canMuteVolume=function(){try{const s=ue.TEST_VID.muted;return ue.TEST_VID.muted=!s,ue.TEST_VID.muted?bs(ue.TEST_VID,"muted","muted"):Hn(ue.TEST_VID,"muted","muted"),s!==ue.TEST_VID.muted}catch{return!1}};ue.canControlPlaybackRate=function(){if(jt&&ei&&Un<58)return!1;try{const s=ue.TEST_VID.playbackRate;return ue.TEST_VID.playbackRate=s/2+.1,s!==ue.TEST_VID.playbackRate}catch{return!1}};ue.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(re.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(re.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(re.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(re.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};ue.supportsNativeTextTracks=function(){return $n||at&&ei};ue.supportsNativeVideoTracks=function(){return!!(ue.TEST_VID&&ue.TEST_VID.videoTracks)};ue.supportsNativeAudioTracks=function(){return!!(ue.TEST_VID&&ue.TEST_VID.audioTracks)};ue.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([s,e]){Fn(ue.prototype,s,()=>ue[e](),!0)});ue.prototype.featuresVolumeControl=ue.canControlVolume();ue.prototype.movingMediaElementInDOM=!at;ue.prototype.featuresFullscreenResize=!0;ue.prototype.featuresProgressEvents=!0;ue.prototype.featuresTimeupdateEvents=!0;ue.prototype.featuresVideoFrameCallback=!!(ue.TEST_VID&&ue.TEST_VID.requestVideoFrameCallback);ue.disposeMediaElement=function(s){if(s){for(s.parentNode&&s.parentNode.removeChild(s);s.hasChildNodes();)s.removeChild(s.firstChild);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()}};ue.resetMediaElement=function(s){if(!s)return;const e=s.querySelectorAll("source");let t=e.length;for(;t--;)s.removeChild(e[t]);s.removeAttribute("src"),typeof s.load=="function"&&(function(){try{s.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(s){ue.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){ue.prototype["set"+He(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){ue.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){ue.prototype["set"+He(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){ue.prototype[s]=function(){return this.el_[s]()}});ye.withSourceHandlers(ue);ue.nativeSourceHandler={};ue.nativeSourceHandler.canPlayType=function(s){try{return ue.TEST_VID.canPlayType(s)}catch{return""}};ue.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return ue.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=Go(s.src);return ue.nativeSourceHandler.canPlayType(`video/${t}`)}return""};ue.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};ue.nativeSourceHandler.dispose=function(){};ue.registerSourceHandler(ue.nativeSourceHandler);ye.registerTech("Html5",ue);const Ah=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Wa={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},mo=["tiny","xsmall","small","medium","large","xlarge","huge"],cn={};mo.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;cn[s]=`vjs-layout-${e}`});const Uy={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class we extends K{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Lt()}`,t=Object.assign(we.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,i),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.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=hd(this.id_),this.fsApi_=pn,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_={controlBarHeight:null,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&&xi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(u){a[u.toLowerCase()]=t.languages[u]}),this.languages_=a}else this.languages_=we.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(),qo(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Et(re,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=ke(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const u=new D.DOMParser().parseFromString(uy,"image/svg+xml");if(u.querySelector("parsererror"))ve.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const f=u.documentElement;f.style.display="none",this.el_.appendChild(f),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"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new ly(this),this.addClass("vjs-spatial-navigation-enabled")),mr&&this.addClass("vjs-touch-enabled"),at||this.addClass("vjs-workinghover"),we.players[this.id_]=this;const n=so.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"),ot(re,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ot(re,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),we.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),ry(this),ht.names.forEach(e=>{const t=ht[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const n=xi(e);if(r){for(t=this.el_=e,e=this.tag=re.createElement("video");t.children.length;)e.appendChild(t.firstChild);lr(t,"video-js")||Vi(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(l=>{try{e[l]=t[l]}catch{}})}e.setAttribute("tabindex","-1"),n.tabindex="-1",ei&&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(l){r&&l==="class"||t.setAttribute(l,n[l]),r&&e.setAttribute(l,n[l])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(l=>vd[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),D.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Nd("vjs-styles-dimensions");const l=wi(".vjs-styles-defaults"),f=wi("head");f.insertBefore(this.styleEl_,l?l.nextSibling:f.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 u=e.getElementsByTagName("a");for(let l=0;l<u.length;l++){const f=u.item(l);Vi(f,"vjs-hidden"),f.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),no(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){ve.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){ve.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,li(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),M_(this,()=>{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(D.VIDEOJS_NO_DYNAMIC_STYLE===!0){const u=typeof this.width_=="number"?this.width_:this.options_.width,l=typeof this.height_=="number"?this.height_:this.options_.height,f=this.tech_&&this.tech_.el();f&&(u>=0&&(f.width=u),l>=0&&(f.height=l));return}let e,t,i,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const n=i.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())?r="dimensions-"+this.id():r=this.id()+"-dimensions",this.addClass(r),Md(this.styleEl_,`
|
|
161
161
|
.${r} {
|
|
162
162
|
width: ${e}px;
|
|
163
163
|
height: ${t}px;
|
|
@@ -166,9 +166,9 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati
|
|
|
166
166
|
.${r}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
167
167
|
padding-top: ${a*100}%;
|
|
168
168
|
}
|
|
169
|
-
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=
|
|
169
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=He(e),r=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(ye.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,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()}_${r}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};ht.names.forEach(l=>{const f=ht[l];a[f.getterName]=this[f.privateName]}),Object.assign(a,this.options_[i]),Object.assign(a,this.options_[r]),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 u=ye.getTech(e);if(!u)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new u(a),this.tech_.ready(Le(this,this.handleTechReady_),!0),ho.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Ah.forEach(l=>{this.on(this.tech_,l,f=>this[`handleTech${He(l)}_`](f))}),Object.keys(Wa).forEach(l=>{this.on(this.tech_,l,f=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Wa[l]}_`].bind(this),event:f});return}this[`handleTech${Wa[l]}_`](f)})}),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,f)=>this.handleTechFullscreenChange_(l,f)),this.on(this.tech_,"fullscreenerror",(l,f)=>this.handleTechFullscreenError_(l,f)),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()&&(i!=="Html5"||!this.tag)&&no(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){ht.names.forEach(e=>{const t=ht[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=ho.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&&ve.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
170
170
|
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
171
|
-
`),this.tech_}version(){return{"video.js":eo}}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 r=this.muted();this.muted(!0);const n=()=>{this.muted(r)};this.playTerminatedQueue_.push(n);const a=this.play();if(cr(a))return a.catch(u=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${u||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),cr(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!cr(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=U_(this,t)),this.cache_.source=Ae({},e,{src:t,type:i});const r=this.cache_.sources.filter(c=>c.src&&c.src===t),n=[],a=this.$$("source"),u=[];for(let c=0;c<a.length;c++){const f=xi(a[c]);n.push(f),f.src&&f.src===t&&u.push(f.src)}u.length&&!r.length?this.cache_.sources=n:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=n=>this.updateSourceCaches_(n);const i=this.currentSource().src,r=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(t=()=>{}),t(r),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()?Gt(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.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.isInPictureInPicture()&&!re.pictureInPictureElement?this.exitPictureInPicture():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 i=this.el();let r=re[this.fsApi_.fullscreenElement]===i;!r&&i.matches&&(r=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}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();e&&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 R_)return L_(this.middleware_,this.tech_,e,t);if(e in Hl)return Vl(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw ve(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in O_)return P_(this.middleware_,this.tech_,e);if(e in Hl)return Vl(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ve(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ve(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ve(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Gt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(qn||st);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&&i&&this.load();return}const r=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}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(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Bt(0,0)}scrubbing(e){if(typeof e>"u")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=Bt(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Bt(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return Ld(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}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_=!!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((i,r)=>{function n(){t.off("fullscreenerror",u),t.off("fullscreenchange",a)}function a(){n(),i()}function u(f,g){n(),r(g)}t.one("fullscreenchange",a),t.one("fullscreenerror",u);const c=t.requestFullscreenHelper_(e);c&&(c.then(n,n),c.then(i,r))})}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 i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){r(),t()}function a(c,f){r(),i(f)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const u=e.exitFullscreenHelper_();u&&(u.then(r,r),u.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=re[this.fsApi_.exitFullscreen]();return e&&Gt(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=re.documentElement.style.overflow,bt(re,"keydown",this.boundFullWindowOnEscKey_),re.documentElement.style.overflow="hidden",$i(re.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,rt(re,"keydown",this.boundFullWindowOnEscKey_),re.documentElement.style.overflow=this.docOrigOverflow,$n(re.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&&D.documentPictureInPicture){const e=re.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(de("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),D.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Td(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({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const r=i.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in re&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(D.documentPictureInPicture&&D.documentPictureInPicture.window)return D.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in re)return re.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(r=>{const n=r.tagName.toLowerCase();if(r.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return n==="input"?a.indexOf(r.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:i=a=>e.key.toLowerCase()==="f",muteKey:r=a=>e.key.toLowerCase()==="m",playPauseKey:n=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=K.getComponent("FullscreenToggle");re[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),K.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),K.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,r=this.options_.techOrder;i<r.length;i++){const n=r[i];let a=me.getTech(n);if(a||(a=K.getComponent(n)),!a){ve.error(`The "${n}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(u=>[u,me.getTech(u)]).filter(([u,c])=>c?c.isSupported():(ve.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,c,f){let g;return u.some(_=>c.some(A=>{if(g=f(_,A),g)return!0})),g};let r;const n=u=>(c,f)=>u(f,c),a=([u,c],f)=>{if(c.canPlaySource(f,this.options_[u.toLowerCase()]))return{source:f,tech:u}};return this.options_.sourceOrder?r=i(e,t,n(a)):r=i(t,e,a),r||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Fd(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),k_(this,i[0],(r,n)=>{if(this.middleware_=n,t||(this.cache_.sources=i),this.updateSourceCaches_(r),this.src_(r)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}I_(n,this.tech_)}),i.length>1){const r=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},n=()=>{this.off("error",r)};this.one("error",r),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",n)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Dd(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}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}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();Gt(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),oi(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:n}=i||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.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>"u"?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(Ci("beforeerror").forEach(t=>{const i=t(this,e);if(!(Yt(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),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 Fe(e),this.addClass("vjs-error"),ve.error(`(CODE:${this.error_.code} ${Fe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Ci("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,i;const r=Ie(this,this.reportUserActivity),n=function(_){(_.screenX!==t||_.screenY!==i)&&(t=_.screenX,i=_.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},u=function(_){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",u),this.on("mouseleave",u);const c=this.getChild("controlBar");c&&!st&&!Ft&&(c.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let f;const g=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(f);const _=this.options_.inactivityTimeout;_<=0||(f=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},_))};this.setInterval(g,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_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(r=>{r!==t&&r.el_&&!r.hasClass("vjs-hidden")&&(r.hide(),this.audioOnlyCache_.hiddenChildren.push(r))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),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,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{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 Ae(Ee.prototype.options_.languages,this.languages_)}toJSON(){const e=Ae(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let r=t[i];r=Ae(r),r.player=void 0,e.tracks[i]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new ws(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<ho.length;i++){const r=ho[i],n=this.breakpoints_[r];if(t<=n){if(e===r)return;e&&this.removeClass(ln[e]),this.addClass(ln[r]),this.breakpoint_=r;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},_y,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return ln[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=Ae(e);const{artist:r,artwork:n,description:a,poster:u,src:c,textTracks:f,title:g}=this.cache_.media;!n&&u&&(this.cache_.media.artwork=[{src:u,type:Sn(u)}]),i&&this.crossOrigin(i),c&&this.src(c),u&&this.poster(u),Array.isArray(f)&&f.forEach(_=>this.addRemoteTextTrack(_,!1)),this.titleBar&&this.titleBar.update({title:g,description:a||r||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),r={src:t,textTracks:i};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:Sn(r.poster)}]),r}return Ae(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=xi(e),r=i["data-setup"];if(ur(e,"vjs-fill")&&(i.fill=!0),ur(e,"vjs-fluid")&&(i.fluid=!0),r!==null)try{Object.assign(i,JSON.parse(r||"{}"))}catch(n){ve.error("data-setup",n)}if(Object.assign(t,i),e.hasChildNodes()){const n=e.childNodes;for(let a=0,u=n.length;a<u;a++){const c=n[a],f=c.nodeName.toLowerCase();f==="source"?t.sources.push(xi(c)):f==="track"&&t.tracks.push(xi(c))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}Ee.prototype.videoTracks=()=>{};Ee.prototype.audioTracks=()=>{};Ee.prototype.textTracks=()=>{};Ee.prototype.remoteTextTracks=()=>{};Ee.prototype.remoteTextTrackEls=()=>{};ct.names.forEach(function(s){const e=ct[s];Ee.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ee.prototype.crossorigin=Ee.prototype.crossOrigin;Ee.players={};const tr=D.navigator;Ee.prototype.options_={techOrder:me.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:tr&&(tr.languages&&tr.languages[0]||tr.userLanguage||tr.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,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};ph.forEach(function(s){Ee.prototype[`handleTech${je(s)}_`]=function(){return this.trigger(s)}});K.registerComponent("Player",Ee);const En="plugin",us="activePlugins_",is={},Cn=s=>is.hasOwnProperty(s),cn=s=>Cn(s)?is[s]:void 0,mh=(s,e)=>{s[us]=s[us]||{},s[us][e]=!0},wn=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},yy=function(s,e){const t=function(){wn(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return mh(this,s),wn(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},ac=(s,e)=>(e.prototype.name=s,function(...t){wn(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,wn(this,i.getEventHash()),i});class mt{constructor(e){if(this.constructor===mt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Bo(this),delete this.trigger,Ad(this,this.constructor.defaultState),mh(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 Cs(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[us][e]=!1,this.player=this.state=null,t[e]=ac(e,is[e])}static isBasic(e){const t=typeof e=="string"?cn(e):e;return typeof t=="function"&&!mt.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(Cn(e))ve.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ee.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 is[e]=t,e!==En&&(mt.isBasic(t)?Ee.prototype[e]=yy(e,t):Ee.prototype[e]=ac(e,t)),t}static deregisterPlugin(e){if(e===En)throw new Error("Cannot de-register base plugin.");Cn(e)&&(delete is[e],delete Ee.prototype[e])}static getPlugins(e=Object.keys(is)){let t;return e.forEach(i=>{const r=cn(i);r&&(t=t||{},t[i]=r)}),t}static getPluginVersion(e){const t=cn(e);return t&&t.VERSION||""}}mt.getPlugin=cn;mt.BASE_PLUGIN_NAME=En;mt.registerPlugin(En,mt);Ee.prototype.usingPlugin=function(s){return!!this[us]&&this[us][s]===!0};Ee.prototype.hasPlugin=function(s){return!!Cn(s)};function Ty(s,e){let t=!1;return function(...i){return t||ve.warn(s),t=!0,e.apply(this,i)}}function Ut(s,e,t,i){return Ty(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var vy={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const gh=s=>s.indexOf("#")===0?s.slice(1):s;function q(s,e,t){let i=q.getPlayer(s);if(i)return e&&ve.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const r=typeof s=="string"?wi("#"+gh(s)):s;if(!Es(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in r?r.getRootNode()instanceof D.ShadowRoot:!1)?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!a.contains(r))&&ve.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Ci("beforesetup").forEach(c=>{const f=c(r,Ae(e));if(!Yt(f)||Array.isArray(f)){ve.error("please return an object in beforesetup hooks");return}e=Ae(e,f)});const u=K.getComponent("Player");return i=new u(r,e,t),Ci("setup").forEach(c=>c(i)),i}q.hooks_=ri;q.hooks=Ci;q.hook=e_;q.hookOnce=t_;q.removeHook=Jc;if(D.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Ss()){let s=wi(".vjs-styles-defaults");if(!s){s=xd("vjs-styles-defaults");const e=wi("head");e&&e.insertBefore(s,e.firstChild),Sd(s,`
|
|
171
|
+
`),this.tech_}version(){return{"video.js":so}}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 r=this.muted();this.muted(!0);const n=()=>{this.muted(r)};this.playTerminatedQueue_.push(n);const a=this.play();if(dr(a))return a.catch(u=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${u||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),dr(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!dr(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=oy(this,t)),this.cache_.source=ke({},e,{src:t,type:i});const r=this.cache_.sources.filter(l=>l.src&&l.src===t),n=[],a=this.$$("source"),u=[];for(let l=0;l<a.length;l++){const f=xi(a[l]);n.push(f),f.src&&f.src===t&&u.push(f.src)}u.length&&!r.length?this.cache_.sources=n:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=n=>this.updateSourceCaches_(n);const i=this.currentSource().src,r=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==i)&&(t=()=>{}),t(r),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()?Kt(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.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.isInPictureInPicture()&&!re.pictureInPictureElement?this.exitPictureInPicture():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 i=this.el();let r=re[this.fsApi_.fullscreenElement]===i;!r&&i.matches&&(r=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(r)}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();e&&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 iy)return ey(this.middleware_,this.tech_,e,t);if(e in Yl)return Kl(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw ve(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in ty)return Z_(this.middleware_,this.tech_,e);if(e in Yl)return Kl(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ve(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ve(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ve(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Kt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!($n||at);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&&i&&this.load();return}const r=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}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(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ut(0,0)}scrubbing(e){if(typeof e>"u")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=Ut(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ut(0,0)),e}seeking(){return this.techGet_("seeking")}ended(){return this.techGet_("ended")}networkState(){return this.techGet_("networkState")}readyState(){return this.techGet_("readyState")}bufferedPercent(){return zd(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}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_=!!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((i,r)=>{function n(){t.off("fullscreenerror",u),t.off("fullscreenchange",a)}function a(){n(),i()}function u(f,g){n(),r(g)}t.one("fullscreenchange",a),t.one("fullscreenerror",u);const l=t.requestFullscreenHelper_(e);l&&(l.then(n,n),l.then(i,r))})}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 i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){r(),t()}function a(l,f){r(),i(f)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const u=e.exitFullscreenHelper_();u&&(u.then(r,r),u.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=re[this.fsApi_.exitFullscreen]();return e&&Kt(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=re.documentElement.style.overflow,Et(re,"keydown",this.boundFullWindowOnEscKey_),re.documentElement.style.overflow="hidden",Vi(re.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,ot(re,"keydown",this.boundFullWindowOnEscKey_),re.documentElement.style.overflow=this.docOrigOverflow,Vn(re.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&&D.documentPictureInPicture){const e=re.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(fe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),D.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Ld(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({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const r=i.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in re&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(D.documentPictureInPicture&&D.documentPictureInPicture.window)return D.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in re)return re.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(r=>{const n=r.tagName.toLowerCase();if(r.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return n==="input"?a.indexOf(r.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:i=a=>e.key.toLowerCase()==="f",muteKey:r=a=>e.key.toLowerCase()==="m",playPauseKey:n=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=K.getComponent("FullscreenToggle");re[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),K.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),K.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,r=this.options_.techOrder;i<r.length;i++){const n=r[i];let a=ye.getTech(n);if(a||(a=K.getComponent(n)),!a){ve.error(`The "${n}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(u=>[u,ye.getTech(u)]).filter(([u,l])=>l?l.isSupported():(ve.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,l,f){let g;return u.some(_=>l.some(A=>{if(g=f(_,A),g)return!0})),g};let r;const n=u=>(l,f)=>u(f,l),a=([u,l],f)=>{if(l.canPlaySource(f,this.options_[u.toLowerCase()]))return{source:f,tech:u}};return this.options_.sourceOrder?r=i(e,t,n(a)):r=i(t,e,a),r||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Qd(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),Q_(this,i[0],(r,n)=>{if(this.middleware_=n,t||(this.cache_.sources=i),this.updateSourceCaches_(r),this.src_(r)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}J_(n,this.tech_)}),i.length>1){const r=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},n=()=>{this.off("error",r)};this.one("error",r),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",n)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?qd(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}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}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();Kt(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),li(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:n}=i||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.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>"u"?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(Ci("beforeerror").forEach(t=>{const i=t(this,e);if(!(Zt(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),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 qe(e),this.addClass("vjs-error"),ve.error(`(CODE:${this.error_.code} ${qe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Ci("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,i;const r=Le(this,this.reportUserActivity),n=function(_){(_.screenX!==t||_.screenY!==i)&&(t=_.screenX,i=_.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},u=function(_){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",u),this.on("mouseleave",u);const l=this.getChild("controlBar");l&&!at&&!jt&&(l.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),l.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let f;const g=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(f);const _=this.options_.inactivityTimeout;_<=0||(f=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},_))};this.setInterval(g,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_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(r=>{r!==t&&r.el_&&!r.hasClass("vjs-hidden")&&(r.hide(),this.audioOnlyCache_.hiddenChildren.push(r))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),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,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{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(),li(this)&&this.trigger("languagechange"))}languages(){return ke(we.prototype.options_.languages,this.languages_)}toJSON(){const e=ke(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let r=t[i];r=ke(r),r.player=void 0,e.tracks[i]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Ds(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<mo.length;i++){const r=mo[i],n=this.breakpoints_[r];if(t<=n){if(e===r)return;e&&this.removeClass(cn[e]),this.addClass(cn[r]),this.breakpoint_=r;break}}}removeCurrentBreakpoint_(){const e=this.currentBreakpointClass();this.breakpoint_="",e&&this.removeClass(e)}breakpoints(e){return e===void 0?Object.assign(this.breakpoints_):(this.breakpoint_="",this.breakpoints_=Object.assign({},Uy,e),this.updateCurrentBreakpoint_(),Object.assign(this.breakpoints_))}responsive(e){if(e===void 0)return this.responsive_;e=!!e;const t=this.responsive_;if(e!==t)return this.responsive_=e,e?(this.on("playerresize",this.boundUpdateCurrentBreakpoint_),this.updateCurrentBreakpoint_()):(this.off("playerresize",this.boundUpdateCurrentBreakpoint_),this.removeCurrentBreakpoint_()),e}currentBreakpoint(){return this.breakpoint_}currentBreakpointClass(){return cn[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=ke(e);const{artist:r,artwork:n,description:a,poster:u,src:l,textTracks:f,title:g}=this.cache_.media;!n&&u&&(this.cache_.media.artwork=[{src:u,type:En(u)}]),i&&this.crossOrigin(i),l&&this.src(l),u&&this.poster(u),Array.isArray(f)&&f.forEach(_=>this.addRemoteTextTrack(_,!1)),this.titleBar&&this.titleBar.update({title:g,description:a||r||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),r={src:t,textTracks:i};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:En(r.poster)}]),r}return ke(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=xi(e),r=i["data-setup"];if(lr(e,"vjs-fill")&&(i.fill=!0),lr(e,"vjs-fluid")&&(i.fluid=!0),r!==null)try{Object.assign(i,JSON.parse(r||"{}"))}catch(n){ve.error("data-setup",n)}if(Object.assign(t,i),e.hasChildNodes()){const n=e.childNodes;for(let a=0,u=n.length;a<u;a++){const l=n[a],f=l.nodeName.toLowerCase();f==="source"?t.sources.push(xi(l)):f==="track"&&t.tracks.push(xi(l))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}we.prototype.videoTracks=()=>{};we.prototype.audioTracks=()=>{};we.prototype.textTracks=()=>{};we.prototype.remoteTextTracks=()=>{};we.prototype.remoteTextTrackEls=()=>{};ht.names.forEach(function(s){const e=ht[s];we.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});we.prototype.crossorigin=we.prototype.crossOrigin;we.players={};const ir=D.navigator;we.prototype.options_={techOrder:ye.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:ir&&(ir.languages&&ir.languages[0]||ir.userLanguage||ir.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,spatialNavigation:{enabled:!1,horizontalSeek:!1},enableSmoothSeeking:!1,disableSeekWhileScrubbingOnMobile:!1,disableSeekWhileScrubbingOnSTV:!1};Ah.forEach(function(s){we.prototype[`handleTech${He(s)}_`]=function(){return this.trigger(s)}});K.registerComponent("Player",we);const Cn="plugin",cs="activePlugins_",rs={},wn=s=>rs.hasOwnProperty(s),dn=s=>wn(s)?rs[s]:void 0,Dh=(s,e)=>{s[cs]=s[cs]||{},s[cs][e]=!0},An=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},jy=function(s,e){const t=function(){An(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return Dh(this,s),An(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},hc=(s,e)=>(e.prototype.name=s,function(...t){An(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,An(this,i.getEventHash()),i});class yt{constructor(e){if(this.constructor===yt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),qo(this),delete this.trigger,jd(this,this.constructor.defaultState),Dh(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 As(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[cs][e]=!1,this.player=this.state=null,t[e]=hc(e,rs[e])}static isBasic(e){const t=typeof e=="string"?dn(e):e;return typeof t=="function"&&!yt.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(wn(e))ve.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(we.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 rs[e]=t,e!==Cn&&(yt.isBasic(t)?we.prototype[e]=jy(e,t):we.prototype[e]=hc(e,t)),t}static deregisterPlugin(e){if(e===Cn)throw new Error("Cannot de-register base plugin.");wn(e)&&(delete rs[e],delete we.prototype[e])}static getPlugins(e=Object.keys(rs)){let t;return e.forEach(i=>{const r=dn(i);r&&(t=t||{},t[i]=r)}),t}static getPluginVersion(e){const t=dn(e);return t&&t.VERSION||""}}yt.getPlugin=dn;yt.BASE_PLUGIN_NAME=Cn;yt.registerPlugin(Cn,yt);we.prototype.usingPlugin=function(s){return!!this[cs]&&this[cs][s]===!0};we.prototype.hasPlugin=function(s){return!!wn(s)};function qy(s,e){let t=!1;return function(...i){return t||ve.warn(s),t=!0,e.apply(this,i)}}function $t(s,e,t,i){return qy(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var $y={NetworkBadStatus:"networkbadstatus",NetworkRequestFailed:"networkrequestfailed",NetworkRequestAborted:"networkrequestaborted",NetworkRequestTimeout:"networkrequesttimeout",NetworkBodyParserFailed:"networkbodyparserfailed",StreamingHlsPlaylistParserError:"streaminghlsplaylistparsererror",StreamingDashManifestParserError:"streamingdashmanifestparsererror",StreamingContentSteeringParserError:"streamingcontentsteeringparsererror",StreamingVttParserError:"streamingvttparsererror",StreamingFailedToSelectNextSegment:"streamingfailedtoselectnextsegment",StreamingFailedToDecryptSegment:"streamingfailedtodecryptsegment",StreamingFailedToTransmuxSegment:"streamingfailedtotransmuxsegment",StreamingFailedToAppendSegment:"streamingfailedtoappendsegment",StreamingCodecsChangeError:"streamingcodecschangeerror"};const kh=s=>s.indexOf("#")===0?s.slice(1):s;function q(s,e,t){let i=q.getPlayer(s);if(i)return e&&ve.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const r=typeof s=="string"?wi("#"+kh(s)):s;if(!ws(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in r?r.getRootNode()instanceof D.ShadowRoot:!1)?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!a.contains(r))&&ve.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),Ci("beforesetup").forEach(l=>{const f=l(r,ke(e));if(!Zt(f)||Array.isArray(f)){ve.error("please return an object in beforesetup hooks");return}e=ke(e,f)});const u=K.getComponent("Player");return i=new u(r,e,t),Ci("setup").forEach(l=>l(i)),i}q.hooks_=ai;q.hooks=Ci;q.hook=x_;q.hookOnce=S_;q.removeHook=dd;if(D.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Cs()){let s=wi(".vjs-styles-defaults");if(!s){s=Nd("vjs-styles-defaults");const e=wi("head");e&&e.insertBefore(s,e.firstChild),Md(s,`
|
|
172
172
|
.video-js {
|
|
173
173
|
width: 300px;
|
|
174
174
|
height: 150px;
|
|
@@ -177,27 +177,27 @@ See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
|
177
177
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
178
178
|
padding-top: 56.25%
|
|
179
179
|
}
|
|
180
|
-
`)}}
|
|
180
|
+
`)}}oo(1,q);q.VERSION=so;q.options=we.prototype.options_;q.getPlayers=()=>we.players;q.getPlayer=s=>{const e=we.players;let t;if(typeof s=="string"){const i=kh(s),r=e[i];if(r)return r;t=wi("#"+i)}else t=s;if(ws(t)){const{player:i,playerId:r}=t;if(i||e[r])return i||e[r]}};q.getAllPlayers=()=>Object.keys(we.players).map(s=>we.players[s]).filter(Boolean);q.players=we.players;q.getComponent=K.getComponent;q.registerComponent=(s,e)=>(ye.isTech(e)&&ve.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),K.registerComponent.call(K,s,e));q.getTech=ye.getTech;q.registerTech=ye.registerTech;q.use=Y_;Object.defineProperty(q,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(q.middleware,"TERMINATOR",{value:Sn,writeable:!1,enumerable:!0});q.browser=vd;q.obj=w_;q.mergeOptions=$t(9,"videojs.mergeOptions","videojs.obj.merge",ke);q.defineLazyProperty=$t(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Fn);q.bind=$t(9,"videojs.bind","native Function.prototype.bind",Le);q.registerPlugin=yt.registerPlugin;q.deregisterPlugin=yt.deregisterPlugin;q.plugin=(s,e)=>(ve.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),yt.registerPlugin(s,e));q.getPlugins=yt.getPlugins;q.getPlugin=yt.getPlugin;q.getPluginVersion=yt.getPluginVersion;q.addLanguage=function(s,e){return s=(""+s).toLowerCase(),q.options.languages=ke(q.options.languages,{[s]:e}),q.options.languages[s]};q.log=ve;q.createLogger=hd;q.time=q_;q.createTimeRange=$t(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ut);q.createTimeRanges=$t(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ut);q.formatTime=$t(9,"videojs.formatTime","videojs.time.formatTime",Wi);q.setFormatTime=$t(9,"videojs.setFormatTime","videojs.time.setFormatTime",Vd);q.resetFormatTime=$t(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Hd);q.parseUrl=$t(9,"videojs.parseUrl","videojs.url.parseUrl",zo);q.isCrossOrigin=$t(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Yn);q.EventTarget=Ct;q.any=jo;q.on=Et;q.one=Xn;q.off=ot;q.trigger=As;q.xhr=Yc;q.TrackList=Xi;q.TextTrack=br;q.TextTrackList=Vo;q.AudioTrack=Kd;q.AudioTrackList=Gd;q.VideoTrack=Yd;q.VideoTrackList=Wd;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{q[s]=function(){return ve.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Od[s].apply(null,arguments)}});q.computedStyle=$t(9,"videojs.computedStyle","videojs.dom.computedStyle",Ss);q.dom=Od;q.fn=N_;q.num=_y;q.str=U_;q.url=X_;q.Error=$y;class Vy{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(i){t.enabled_(i)}}),t}}class Dn extends q.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 i=this.levels_.length;return t=new Vy(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,r=this.length;i<r;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const r=this[t];if(r.id===e)return r}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Dn.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const s in Dn.prototype.allowedEvents_)Dn.prototype["on"+s]=null;var Ih="4.1.0";const Hy=function(s,e){const t=s.qualityLevels,i=new Dn,r=function(){i.dispose(),s.qualityLevels=t,s.off("dispose",r)};return s.on("dispose",r),s.qualityLevels=()=>i,s.qualityLevels.VERSION=Ih,i},Ph=function(s){return Hy(this,q.obj.merge({},s))};q.registerPlugin("qualityLevels",Ph);Ph.VERSION=Ih;const gt=Rn,kn=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,Rt=s=>q.log.debug?q.log.debug.bind(q,"VHS:",`${s} >`):function(){};function Ae(...s){const e=q.obj||q;return(e.merge||e.mergeOptions).apply(e,s)}function tt(...s){const e=q.time||q;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function zy(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
181
181
|
`;for(let t=0;t<s.length;t++){const i=s.start(t),r=s.end(t);e+=`${i} --> ${r}. Duration (${r-i})
|
|
182
|
-
`}return e}const Wt=1/30,Xt=Wt*3,Th=function(s,e){const t=[];let i;if(s&&s.length)for(i=0;i<s.length;i++)e(s.start(i),s.end(i))&&t.push([s.start(i),s.end(i)]);return Ye(t)},ss=function(s,e){return Th(s,function(t,i){return t-Xt<=e&&i+Xt>=e})},nn=function(s,e){return Th(s,function(t){return t-Wt>=e})},Ey=function(s){if(s.length<2)return Ye();const e=[];for(let t=1;t<s.length;t++){const i=s.end(t-1),r=s.start(t);e.push([i,r])}return Ye(e)},Cy=function(s,e){let t=null,i=null,r=0;const n=[],a=[];if(!s||!s.length||!e||!e.length)return Ye();let u=s.length;for(;u--;)n.push({time:s.start(u),type:"start"}),n.push({time:s.end(u),type:"end"});for(u=e.length;u--;)n.push({time:e.start(u),type:"start"}),n.push({time:e.end(u),type:"end"});for(n.sort(function(c,f){return c.time-f.time}),u=0;u<n.length;u++)n[u].type==="start"?(r++,r===2&&(t=n[u].time)):n[u].type==="end"&&(r--,r===1&&(i=n[u].time)),t!==null&&i!==null&&(a.push([t,i]),t=null,i=null);return Ye(a)},vh=s=>{const e=[];if(!s||!s.length)return"";for(let t=0;t<s.length;t++)e.push(s.start(t)+" => "+s.end(t));return e.join(", ")},wy=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},ji=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},Ay=function(s,e){if(s===e)return!1;if(!s&&e||!e&&s||s.length!==e.length)return!0;for(let t=0;t<s.length;t++)if(s.start(t)!==e.start(t)||s.end(t)!==e.end(t))return!0;return!1},Wa=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},ru=function(s,e){let t=0;if(!s||!s.length)return t;for(let i=0;i<s.length;i++){const r=s.start(i),n=s.end(i);if(!(e>n)){if(e>r&&e<=n){t+=n-e;continue}t+=n-r}}return t},nu=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=s.partTargetDuration)}),t},fo=s=>(s.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(r,n){e.push({duration:r.duration,segmentIndex:i,partIndex:n,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),bh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},xh=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let i=(t||[]).reduce((r,n)=>r+(n.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},Sh=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=bh(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},Dy=function(s,e){let t=0,i=e-s.mediaSequence,r=s.segments[i];if(r){if(typeof r.start<"u")return{result:r.start,precise:!0};if(typeof r.end<"u")return{result:r.end-r.duration,precise:!0}}for(;i--;){if(r=s.segments[i],typeof r.end<"u")return{result:t+r.end,precise:!0};if(t+=nu(s,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},ky=function(s,e){let t=0,i,r=e-s.mediaSequence;for(;r<s.segments.length;r++){if(i=s.segments[r],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=nu(s,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},Eh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=Dy(s,e);if(i.precise)return i.result;const r=ky(s,e);return r.precise?r.result:i.result+t},Ch=function(s,e,t){if(!s)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return D.Infinity}return Eh(s,e,t)},dr=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:i}){let r=0;if(t>i&&([t,i]=[i,t]),t<0){for(let n=t;n<Math.min(0,i);n++)r+=s;t=0}for(let n=t;n<i;n++)r+=e[n].duration;return r},wh=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return Ch(s);if(e===null)return null;e=e||0;let r=Eh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Sh(null,s),r-=i),Math.max(0,r)},Iy=function(s,e,t){const r=e||0;let n=wh(s,e,!0,t);return n===null?Ye():(n<r&&(n=r),Ye(r,n))},Py=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:r,exactManifestTimings:n}){let a=e-r;const u=fo(s);let c=0;for(let f=0;f<u.length;f++){const g=u[f];if(t===g.segmentIndex&&!(typeof i=="number"&&typeof g.partIndex=="number"&&i!==g.partIndex)){c=f;break}}if(a<0){if(c>0)for(let f=c-1;f>=0;f--){const g=u[f];if(a+=g.duration,n){if(a<0)continue}else if(a+Wt<=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:r-dr({defaultDuration:s.targetDuration,durationList:u,startIndex:c,endIndex:f})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e}}if(c<0){for(let f=c;f<0;f++)if(a-=s.targetDuration,a<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e};c=0}for(let f=c;f<u.length;f++){const g=u[f];a-=g.duration;const _=g.duration>Wt,A=a===0,S=_&&a+Wt>=0;if(!((A||S)&&f!==u.length-1)){if(n){if(a>0)continue}else if(a-Wt>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:r+dr({defaultDuration:s.targetDuration,durationList:u,startIndex:c,endIndex:f})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:e}},Ah=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},au=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Zn=function(s){const e=Ah(s);return!s.disabled&&!e},Ly=function(s){return s.disabled},Oy=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},Dh=function(s,e){return e.attributes&&e.attributes[s]},Ry=function(s,e,t,i=0){return Dh("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-i*8)/e:NaN},po=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>Zn(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},ou=(s,e)=>!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),oc=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let i=!1;for(const r in t){for(const n in t[r])if(i=e(t[r][n]),i)break;if(i)break}return!!i},Er=s=>{if(!s||!s.playlists||!s.playlists.length)return oc(s,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(n=>jc(n))||oc(s,n=>ou(t,n))))return!1}return!0};var pt={liveEdgeDelay:Sh,duration:Ch,seekable:Iy,getMediaInfoForTime:Py,isEnabled:Zn,isDisabled:Ly,isExcluded:Ah,isIncompatible:au,playlistEnd:wh,isAes:Oy,hasAttribute:Dh,estimateSegmentRequestTime:Ry,isLowestEnabledRendition:po,isAudioOnly:Er,playlistMatch:ou,segmentDurationWithParts:nu};const{log:kh}=q,ls=(s,e)=>`${s}-${e}`,Ih=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,Ny=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:r=[],llhls:n})=>{const a=new xg;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(f=>a.addParser(f)),r.forEach(f=>a.addTagMapper(f)),a.push(t),a.end();const u=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(f){u.hasOwnProperty(f)&&delete u[f]}),u.segments&&u.segments.forEach(function(f){["parts","preloadHints"].forEach(function(g){f.hasOwnProperty(g)&&delete f[g]})})),!u.targetDuration){let f=10;u.segments&&u.segments.length&&(f=u.segments.reduce((g,_)=>Math.max(g,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${f}`}),u.targetDuration=f}const c=bh(u);if(c.length&&!u.partTargetDuration){const f=c.reduce((g,_)=>Math.max(g,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${f}`}),kh.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.")),u.partTargetDuration=f}return u},ks=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const i in s.mediaGroups[t])for(const r in s.mediaGroups[t][i]){const n=s.mediaGroups[t][i][r];e(n,t,i,r)}})},Ph=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},My=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];Ph({playlist:t,id:ls(e,t.uri)}),t.resolvedUri=ft(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||kh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},By=s=>{ks(s,e=>{e.uri&&(e.resolvedUri=ft(s.uri,e.uri))})},Fy=(s,e)=>{const t=ls(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:D.location.href,resolvedUri:D.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},Lh=(s,e,t=Ih)=>{s.uri=e;for(let r=0;r<s.playlists.length;r++)if(!s.playlists[r].uri){const n=`placeholder-uri-${r}`;s.playlists[r].uri=n}const i=Er(s);ks(s,(r,n,a,u)=>{if(!r.playlists||!r.playlists.length){if(i&&n==="AUDIO"&&!r.uri)for(let c=0;c<s.playlists.length;c++){const f=s.playlists[c];if(f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===a)return}r.playlists=[$e({},r)]}r.playlists.forEach(function(c,f){const g=t(n,a,u,c),_=ls(f,g);c.uri?c.resolvedUri=c.resolvedUri||ft(s.uri,c.uri):(c.uri=f===0?g:_,c.resolvedUri=c.uri),c.id=c.id||_,c.attributes=c.attributes||{},s.playlists[c.id]=c,s.playlists[c.uri]=c})}),My(s),By(s)};class uc{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((r,n)=>(r.set(n.id,n),r),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((i,r)=>{if(!this.processedDateRanges_.has(r)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const n=e[i.class].push(i);i.classListIndex=n-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const r=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&r[i.classListIndex+1]?i.endTime=r[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,r)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(r)})}}const Oh=22,zi=({requestType:s,request:e,error:t,parseFailure:i})=>{const r=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},u=r&&!n||i;if(t&&n)a.error=$e({},t),a.errorType=q.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=q.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=q.Error.NetworkRequestTimeout;else if(u){const c=i?q.Error.NetworkBodyParserFailed:q.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},Uy=Lt("CodecUtils"),Rh=function(s){const e=s.attributes||{};if(e.CODECS)return Ht(e.CODECS)},Nh=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},jy=(s,e)=>{if(!Nh(s,e))return!0;const t=e.attributes||{},i=s.mediaGroups.AUDIO[t.AUDIO];for(const r in i)if(!i[r].uri&&!i[r].playlists)return!0;return!1},_r=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:r})=>{e[t]=e[t]||[],e[t].push(Uc(`${i}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){Uy(`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},lc=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},hr=function(s,e){const t=e.attributes||{},i=_r(Rh(e)||[]);if(Nh(s,e)&&!i.audio&&!jy(s,e)){const r=_r(Eg(s,t.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},{EventTarget:qy}=q,$y=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let r=e.mediaSequence+e.segments.length;if(i){const n=i.parts||[],a=xh(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&r--}t._HLS_msn=r}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new D.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){t.hasOwnProperty(r)&&i.searchParams.set(r,t[r])}),s=i.toString()}return s},Vy=(s,e)=>{if(!s)return e;const t=Ce(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i<e.parts.length;i++)s.parts&&s.parts[i]&&(t.parts[i]=Ce(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},Hy=(s,e,t)=>{const i=s.slice(),r=e.slice();t=t||0;const n=[];let a;for(let u=0;u<r.length;u++){const c=i[u+t],f=r[u];c?(a=c.map||a,n.push(Vy(c,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},Mh=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=ft(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=ft(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=ft(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=ft(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=ft(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=ft(e,t.uri))})},Bh=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},Fh=(s,e)=>s===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,mo=(s,e,t=Fh)=>{const i=Ce(s,{}),r=i.playlists[e.id];if(!r||t(r,e))return null;e.segments=Bh(e);const n=Ce(r,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}n.segments=Hy(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}n.segments.forEach(a=>{Mh(a,n.resolvedUri)});for(let a=0;a<i.playlists.length;a++)i.playlists[a].id===e.id&&(i.playlists[a]=n);return i.playlists[e.id]=n,i.playlists[e.uri]=n,ks(s,(a,u,c,f)=>{if(a.playlists)for(let g=0;g<a.playlists.length;g++)e.id===a.playlists[g].id&&(a.playlists[g]=n)}),i},go=(s,e)=>{const t=s.segments||[],i=t[t.length-1],r=i&&i.parts&&i.parts[i.parts.length-1],n=r&&r.duration||i&&i.duration;return e&&n?n*1e3:(s.partTargetDuration||s.targetDuration||10)*500},cc=(s,e,t)=>{if(!s)return;const i=[];return s.forEach(r=>{if(!r.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:u}=r.attributes;i.push({id:r.id,bandwidth:n,resolution:a,codecs:u})}),{type:e,isLive:t,renditions:i}};class rs extends qy{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Lt("PlaylistLoader");const{withCredentials:r=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new uc,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=ft(this.main.uri,e.uri);this.llhls&&(t=$y(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,r)=>{if(this.request){if(i)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,i){const{uri:r,id:n}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:zi({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=Ny({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});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:q.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const r=i.attributes||{},{width:n,height:a}=r.RESOLUTION||{};if(n&&a)return!0;const u=Rh(i)||[];return!!_r(u).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:r}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),Ph({playlist:a,uri:i,id:r});const u=mo(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,u?(this.main=u,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(go(this.media(),!!u)),n.parsedPlaylist=cc(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),D.clearTimeout(this.mediaUpdateTimeout),D.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new uc,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(D.clearTimeout(this.finalRenditionTimeout),t){const u=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=D.setTimeout(this.media.bind(this,e,!1),u);return}const i=this.state,r=!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,r&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(go(e,!0)),!r)return;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;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(u,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Dn(e.resolvedUri,c),u)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(D.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&&(D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=D.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=D.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=D.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:zi({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Dn(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=cc(r.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),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,Lh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=Bh(i),i.segments.forEach(r=>{Mh(r,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||D.location.href;this.main=Fy(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,r=e.ID;let n=i.playlists.length;for(;n--;){const a=i.playlists[n];if(a.attributes["PATHWAY-ID"]===r){const u=a.resolvedUri,c=a.id;if(t){const f=this.createCloneURI_(a.resolvedUri,e),g=ls(r,f),_=this.createCloneAttributes_(r,a.attributes),A=this.createClonePlaylist_(a,g,e,_);i.playlists[n]=A,i.playlists[g]=A,i.playlists[f]=A}else i.playlists.splice(n,1);delete i.playlists[c],delete i.playlists[u]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!i.mediaGroups[n]||!i.mediaGroups[n][r])){for(const a in i.mediaGroups[n])if(a===r){for(const u in i.mediaGroups[n][a])i.mediaGroups[n][a][u].playlists.forEach((f,g)=>{const _=i.playlists[f.id],A=_.id,S=_.resolvedUri;delete i.playlists[A],delete i.playlists[S]});delete i.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,r=i.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=ls(e.ID,n),u=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,u);i.playlists[r]=c,i.playlists[a]=c,i.playlists[n]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!r.mediaGroups[n]||r.mediaGroups[n][t]))for(const a in r.mediaGroups[n]){if(a===i)r.mediaGroups[n][t]={};else continue;for(const u in r.mediaGroups[n][a]){const c=r.mediaGroups[n][a][u];r.mediaGroups[n][t][u]=$e({},c);const f=r.mediaGroups[n][t][u],g=this.createCloneURI_(c.resolvedUri,e);f.resolvedUri=g,f.uri=g,f.playlists=[],c.playlists.forEach((_,A)=>{const S=r.playlists[_.id],O=Ih(n,t,u),T=ls(t,O);if(S&&!r.playlists[T]){const I=this.createClonePlaylist_(S,T,e),F=I.resolvedUri;r.playlists[T]=I,r.playlists[F]=I}f.playlists[A]=this.createClonePlaylist_(_,T,e)})}}})}createClonePlaylist_(e,t,i,r){const n=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),Ce(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(r))i.searchParams.set(n,r[n]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(i[r]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const r=e.contentProtection[i].attributes.keyId;t.add(r.toLowerCase())}return t}}const _o=function(s,e,t,i){const r=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&r&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=r.byteLength||r.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(r||s.responseText)))),i(e,s)},zy=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},Gy=(s,e,t,i)=>{!s||!s.size||s.forEach(r=>{r(e,t,i)})},Uh=function(){const s=function e(t,i){t=Ce({timeout:45e3},t);const r=e.beforeRequest||q.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||q.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||q.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(q.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(r));const u=q.Vhs.xhr.original===!0?q.xhr:q.Vhs.xhr,c=zy(n,t);n.delete(r);const f=u(c||t,function(_,A){return Gy(a,f,_,A),_o(f,_,A,i)}),g=f.abort;return f.abort=function(){return f.aborted=!0,g.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return s.original=!0,s},Wy=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=D.BigInt(s.offset)+D.BigInt(s.length)-D.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},yo=function(s){const e={};return s.byterange&&(e.Range=Wy(s.byterange)),e},Xy=function(s,e){return s.start(e)+"-"+s.end(e)},Ky=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Yy=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},jh=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];$c(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},kn=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},qh=function(s){return s.resolvedUri},$h=s=>{const e=Array.prototype.slice.call(s),t=16;let i="",r,n;for(let a=0;a<e.length/t;a++)r=e.slice(a*t,a*t+t).map(Ky).join(""),n=e.slice(a*t,a*t+t).map(Yy).join(""),i+=r+" "+n+`
|
|
183
|
-
`;return i},Qy=({bytes:s})=>$h(s),Jy=s=>{let e="",t;for(t=0;t<s.length;t++)e+=Xy(s,t)+" ";return e};var Zy=Object.freeze({__proto__:null,createTransferableMessage:jh,initSegmentId:kn,segmentKeyId:qh,hexDump:$h,tagDump:Qy,textRanges:Jy});const Vh=.25,eT=(s,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+t,n=s-r;return new Date(e.dateTimeObject.getTime()+n*1e3)},tT=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,iT=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(t<new Date(i.dateTimeObject))return null;for(let c=0;c<e.segments.length-1;c++){i=e.segments[c];const f=new Date(e.segments[c+1].dateTimeObject);if(t<f)break}const r=e.segments[e.segments.length-1],n=r.dateTimeObject,a=r.videoTimingInfo?tT(r.videoTimingInfo):r.duration+r.duration*Vh,u=new Date(n.getTime()+a*1e3);return t>u?null:(t>new Date(n)&&(i=r),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:pt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},sT=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let n=0;n<e.segments.length&&(i=e.segments[n],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(s<=t));n++);const r=e.segments[e.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<s)return null;if(s>t){if(s>t+r.duration*Vh)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},rT=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const r=t.getTime();return(i.getTime()-r)/1e3},nT=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e<s.segments.length;e++)if(!s.segments[e].dateTimeObject)return!1;return!0},aT=({playlist:s,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=sT(e,s);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const r={mediaSeconds:e},n=eT(e,i.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},Hh=({programTime:s,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:r=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!i)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(!nT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=iT(s,e);if(!u)return a({message:`${s} was not found in the stream`});const c=u.segment,f=rT(c.dateTimeObject,s);if(u.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});i(u.estimatedStart+f),n.one("seeked",()=>{Hh({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:r,tech:n,callback:a})});return}const g=c.start+f,_=()=>a(null,n.currentTime());n.one("seeked",_),r&&n.pause(),i(g)},Xa=(s,e)=>{if(s.readyState===4)return e()},oT=(s,e,t,i)=>{let r=[],n,a=!1;const u=function(_,A,S,O){return A.abort(),a=!0,t(_,A,S,O)},c=function(_,A){if(a)return;if(_)return _.metadata=zi({requestType:i,request:A,error:_}),u(_,A,"",r);const S=A.responseText.substring(r&&r.byteLength||0,A.responseText.length);if(r=Rg(r,Vc(S,!0)),n=n||rr(r),r.length<10||n&&r.length<n+2)return Xa(A,()=>u(_,A,"",r));const O=Po(r);return O==="ts"&&r.length<188?Xa(A,()=>u(_,A,"",r)):!O&&r.length<376?Xa(A,()=>u(_,A,"",r)):u(null,A,O,r)},g=e({uri:s,beforeSend(_){_.overrideMimeType("text/plain; charset=x-user-defined"),_.addEventListener("progress",function({total:A,loaded:S}){return _o(_,null,{statusCode:_.status},c)})}},function(_,A){return _o(g,_,A,c)});return g},{EventTarget:uT}=q,dc=function(s,e){if(!Fh(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t<s.segments.length;t++){const i=s.segments[t],r=e.segments[t];if(i.uri!==r.uri)return!1;if(!i.byterange&&!r.byterange)continue;const n=i.byterange,a=r.byterange;if(n&&!a||!n&&a||n.offset!==a.offset||n.length!==a.length)return!1}return!0},lT=(s,e,t,i)=>{const r=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},cT=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:r})=>{const n=L0(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:r});return Lh(n,e,lT),n},dT=(s,e)=>{ks(s,(t,i,r,n)=>{(!e.mediaGroups[i][r]||!(n in e.mediaGroups[i][r]))&&delete s.mediaGroups[i][r][n]})},hT=(s,e,t)=>{let i=!0,r=Ce(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){const a=e.playlists[n];if(a.sidx){const c=Nn(a.sidx);t&&t[c]&&t[c].sidx&&Do(a,t[c].sidx,a.sidx.resolvedUri)}const u=mo(r,a,dc);u&&(r=u,i=!1)}return ks(e,(n,a,u,c)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,g=mo(r,n.playlists[0],dc);g&&(r=g,c in r.mediaGroups[a][u]||(r.mediaGroups[a][u][c]=n),r.mediaGroups[a][u][c].playlists[0]=r.playlists[f],i=!1)}}),dT(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:r},fT=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,hc=(s,e)=>{const t={};for(const i in s){const n=s[i].sidx;if(n){const a=Nn(n);if(!e[a])break;const u=e[a].sidxInfo;fT(u,n)&&(t[a]=e[a])}}return t},pT=(s,e)=>{let i=hc(s.playlists,e);return ks(s,(r,n,a,u)=>{if(r.playlists&&r.playlists.length){const c=r.playlists;i=Ce(i,hc(c,e))}}),i};class To extends uT{constructor(e,t,i={},r){super(),this.isPaused_=!0,this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:n=!1}=i;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=i.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_=Lt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){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,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const r=e.sidx&&Nn(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=D.setTimeout(()=>i(!1),0);return}const n=Dn(e.sidx.resolvedUri),a=(c,f)=>{if(this.requestErrored_(c,f,t))return;const g=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=f;let A;try{A=B0(ce(f.response).subarray(8))}catch(S){S.metadata=zi({requestType:_,request:f,parseFailure:!0}),this.requestErrored_(S,f,t);return}return g[r]={sidxInfo:e.sidx,sidx:A},Do(e,A,e.sidx.resolvedUri),i(!0)},u="dash-sidx";this.request=oT(n,this.vhs_.xhr,(c,f,g,_)=>{if(c)return a(c,f);if(!g||g!=="mp4"){const O=g||"unknown";return a({status:f.status,message:`Unsupported ${O} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:A,length:S}=e.sidx.byterange;if(_.length>=S+A)return a(c,{response:_.subarray(A,A+S),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:yo({byterange:e.sidx.byterange})},a)},u)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},D.clearTimeout(this.minimumUpdatePeriodTimeout_),D.clearTimeout(this.mediaRequest_),D.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 i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,r=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,D.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(D.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=D.setTimeout(()=>this.load(),i);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_){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=D.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,r)=>{if(i){const{requestType:a}=r;i.metadata=zi({requestType:a,request:r,error:i})}if(this.requestErrored_(i,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const n=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=Dn(this.mainPlaylistLoader_.srcUrl,r),n){this.handleMain_(),this.syncClientServerClock_(()=>e(r,n));return}return e(r,n)})}syncClientServerClock_(e){const t=O0(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:ft(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,r)=>{if(!this.request)return;if(i){const{requestType:a}=r;return this.error.metadata=zi({requestType:a,request:r,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;t.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(r.responseHeaders.date):n=Date.parse(r.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_(){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=cT({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(n){this.error=n,this.error.metadata={errorType:q.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(i=hT(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:n,endList:a}=i,u=[];i.playlists.forEach(f=>{u.push({id:f.id,bandwidth:f.attributes.BANDWIDTH,resolution:f.attributes.RESOLUTION,codecs:f.attributes.CODECS})});const c={duration:n,isLive:!a,renditions:u};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(D.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_=D.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_=pT(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{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,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=D.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},go(this.media(),!!i)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const r=e.contentProtection[i].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var Xe={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 mT=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let t=0;t<s.length;t++)e[t]=s.charCodeAt(t);return e.buffer},zh=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},gT=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(s),URL.createObjectURL(t.getBlob())}},Gh=function(s){return function(){const e=gT(s),t=zh(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},Wh=function(s){return`var browserWorkerPolyFill = ${zh.toString()};
|
|
182
|
+
`}return e}const Yt=1/30,Qt=Yt*3,Lh=function(s,e){const t=[];let i;if(s&&s.length)for(i=0;i<s.length;i++)e(s.start(i),s.end(i))&&t.push([s.start(i),s.end(i)]);return tt(t)},ns=function(s,e){return Lh(s,function(t,i){return t-Qt<=e&&i+Qt>=e})},nn=function(s,e){return Lh(s,function(t){return t-Yt>=e})},Gy=function(s){if(s.length<2)return tt();const e=[];for(let t=1;t<s.length;t++){const i=s.end(t-1),r=s.start(t);e.push([i,r])}return tt(e)},Wy=function(s,e){let t=null,i=null,r=0;const n=[],a=[];if(!s||!s.length||!e||!e.length)return tt();let u=s.length;for(;u--;)n.push({time:s.start(u),type:"start"}),n.push({time:s.end(u),type:"end"});for(u=e.length;u--;)n.push({time:e.start(u),type:"start"}),n.push({time:e.end(u),type:"end"});for(n.sort(function(l,f){return l.time-f.time}),u=0;u<n.length;u++)n[u].type==="start"?(r++,r===2&&(t=n[u].time)):n[u].type==="end"&&(r--,r===1&&(i=n[u].time)),t!==null&&i!==null&&(a.push([t,i]),t=null,i=null);return tt(a)},Oh=s=>{const e=[];if(!s||!s.length)return"";for(let t=0;t<s.length;t++)e.push(s.start(t)+" => "+s.end(t));return e.join(", ")},Xy=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},qi=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},Ky=function(s,e){if(s===e)return!1;if(!s&&e||!e&&s||s.length!==e.length)return!0;for(let t=0;t<s.length;t++)if(s.start(t)!==e.start(t)||s.end(t)!==e.end(t))return!0;return!1},Xa=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},uu=function(s,e){let t=0;if(!s||!s.length)return t;for(let i=0;i<s.length;i++){const r=s.start(i),n=s.end(i);if(!(e>n)){if(e>r&&e<=n){t+=n-e;continue}t+=n-r}}return t},lu=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=s.partTargetDuration)}),t},go=s=>(s.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(r,n){e.push({duration:r.duration,segmentIndex:i,partIndex:n,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),Rh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Nh=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let i=(t||[]).reduce((r,n)=>r+(n.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},Mh=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Rh(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},Yy=function(s,e){let t=0,i=e-s.mediaSequence,r=s.segments[i];if(r){if(typeof r.start<"u")return{result:r.start,precise:!0};if(typeof r.end<"u")return{result:r.end-r.duration,precise:!0}}for(;i--;){if(r=s.segments[i],typeof r.end<"u")return{result:t+r.end,precise:!0};if(t+=lu(s,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},Qy=function(s,e){let t=0,i,r=e-s.mediaSequence;for(;r<s.segments.length;r++){if(i=s.segments[r],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=lu(s,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},Bh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=Yy(s,e);if(i.precise)return i.result;const r=Qy(s,e);return r.precise?r.result:i.result+t},Fh=function(s,e,t){if(!s)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(s.totalDuration)return s.totalDuration;if(!s.endList)return D.Infinity}return Bh(s,e,t)},hr=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:i}){let r=0;if(t>i&&([t,i]=[i,t]),t<0){for(let n=t;n<Math.min(0,i);n++)r+=s;t=0}for(let n=t;n<i;n++)r+=e[n].duration;return r},Uh=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return Fh(s);if(e===null)return null;e=e||0;let r=Bh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Mh(null,s),r-=i),Math.max(0,r)},Jy=function(s,e,t){const r=e||0;let n=Uh(s,e,!0,t);return n===null?tt():(n<r&&(n=r),tt(r,n))},Zy=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:r,exactManifestTimings:n}){let a=e-r;const u=go(s);let l=0;for(let f=0;f<u.length;f++){const g=u[f];if(t===g.segmentIndex&&!(typeof i=="number"&&typeof g.partIndex=="number"&&i!==g.partIndex)){l=f;break}}if(a<0){if(l>0)for(let f=l-1;f>=0;f--){const g=u[f];if(a+=g.duration,n){if(a<0)continue}else if(a+Yt<=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:r-hr({defaultDuration:s.targetDuration,durationList:u,startIndex:l,endIndex:f})}}return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e}}if(l<0){for(let f=l;f<0;f++)if(a-=s.targetDuration,a<0)return{partIndex:u[0]&&u[0].partIndex||null,segmentIndex:u[0]&&u[0].segmentIndex||0,startTime:e};l=0}for(let f=l;f<u.length;f++){const g=u[f];a-=g.duration;const _=g.duration>Yt,A=a===0,x=_&&a+Yt>=0;if(!((A||x)&&f!==u.length-1)){if(n){if(a>0)continue}else if(a-Yt>=0)continue;return{partIndex:g.partIndex,segmentIndex:g.segmentIndex,startTime:r+hr({defaultDuration:s.targetDuration,durationList:u,startIndex:l,endIndex:f})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:e}},jh=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},cu=function(s){return s.excludeUntil&&s.excludeUntil===1/0},ea=function(s){const e=jh(s);return!s.disabled&&!e},eT=function(s){return s.disabled},tT=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},qh=function(s,e){return e.attributes&&e.attributes[s]},iT=function(s,e,t,i=0){return qh("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-i*8)/e:NaN},_o=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>ea(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},du=(s,e)=>!s&&!e||!s&&e||s&&!e?!1:!!(s===e||s.id&&e.id&&s.id===e.id||s.resolvedUri&&e.resolvedUri&&s.resolvedUri===e.resolvedUri||s.uri&&e.uri&&s.uri===e.uri),fc=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let i=!1;for(const r in t){for(const n in t[r])if(i=e(t[r][n]),i)break;if(i)break}return!!i},Cr=s=>{if(!s||!s.playlists||!s.playlists.length)return fc(s,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(n=>Zc(n))||fc(s,n=>du(t,n))))return!1}return!0};var _t={liveEdgeDelay:Mh,duration:Fh,seekable:Jy,getMediaInfoForTime:Zy,isEnabled:ea,isDisabled:eT,isExcluded:jh,isIncompatible:cu,playlistEnd:Uh,isAes:tT,hasAttribute:qh,estimateSegmentRequestTime:iT,isLowestEnabledRendition:_o,isAudioOnly:Cr,playlistMatch:du,segmentDurationWithParts:lu};const{log:$h}=q,ds=(s,e)=>`${s}-${e}`,Vh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,sT=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:r=[],llhls:n})=>{const a=new Hg;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(f=>a.addParser(f)),r.forEach(f=>a.addTagMapper(f)),a.push(t),a.end();const u=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(f){u.hasOwnProperty(f)&&delete u[f]}),u.segments&&u.segments.forEach(function(f){["parts","preloadHints"].forEach(function(g){f.hasOwnProperty(g)&&delete f[g]})})),!u.targetDuration){let f=10;u.segments&&u.segments.length&&(f=u.segments.reduce((g,_)=>Math.max(g,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${f}`}),u.targetDuration=f}const l=Rh(u);if(l.length&&!u.partTargetDuration){const f=l.reduce((g,_)=>Math.max(g,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${f}`}),$h.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.")),u.partTargetDuration=f}return u},Ps=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const i in s.mediaGroups[t])for(const r in s.mediaGroups[t][i]){const n=s.mediaGroups[t][i][r];e(n,t,i,r)}})},Hh=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},rT=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];Hh({playlist:t,id:ds(e,t.uri)}),t.resolvedUri=gt(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||$h.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},nT=s=>{Ps(s,e=>{e.uri&&(e.resolvedUri=gt(s.uri,e.uri))})},aT=(s,e)=>{const t=ds(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:D.location.href,resolvedUri:D.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},zh=(s,e,t=Vh)=>{s.uri=e;for(let r=0;r<s.playlists.length;r++)if(!s.playlists[r].uri){const n=`placeholder-uri-${r}`;s.playlists[r].uri=n}const i=Cr(s);Ps(s,(r,n,a,u)=>{if(!r.playlists||!r.playlists.length){if(i&&n==="AUDIO"&&!r.uri)for(let l=0;l<s.playlists.length;l++){const f=s.playlists[l];if(f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===a)return}r.playlists=[Ge({},r)]}r.playlists.forEach(function(l,f){const g=t(n,a,u,l),_=ds(f,g);l.uri?l.resolvedUri=l.resolvedUri||gt(s.uri,l.uri):(l.uri=f===0?g:_,l.resolvedUri=l.uri),l.id=l.id||_,l.attributes=l.attributes||{},s.playlists[l.id]=l,s.playlists[l.uri]=l})}),rT(s),nT(s)};class pc{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((r,n)=>(r.set(n.id,n),r),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((i,r)=>{if(!this.processedDateRanges_.has(r)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const n=e[i.class].push(i);i.classListIndex=n-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const r=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&r[i.classListIndex+1]?i.endTime=r[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,r)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(r)})}}const Gh=22,Gi=({requestType:s,request:e,error:t,parseFailure:i})=>{const r=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},u=r&&!n||i;if(t&&n)a.error=Ge({},t),a.errorType=q.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=q.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=q.Error.NetworkRequestTimeout;else if(u){const l=i?q.Error.NetworkBodyParserFailed:q.Error.NetworkBadStatus;a.errorType=l,a.status=e.status,a.headers=e.headers}return a},oT=Rt("CodecUtils"),Wh=function(s){const e=s.attributes||{};if(e.CODECS)return Wt(e.CODECS)},Xh=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},uT=(s,e)=>{if(!Xh(s,e))return!0;const t=e.attributes||{},i=s.mediaGroups.AUDIO[t.AUDIO];for(const r in i)if(!i[r].uri&&!i[r].playlists)return!0;return!1},yr=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:r})=>{e[t]=e[t]||[],e[t].push(Jc(`${i}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){oT(`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},mc=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},fr=function(s,e){const t=e.attributes||{},i=yr(Wh(e)||[]);if(Xh(s,e)&&!i.audio&&!uT(s,e)){const r=yr(Gg(s,t.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},{EventTarget:lT}=q,cT=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let r=e.mediaSequence+e.segments.length;if(i){const n=i.parts||[],a=Nh(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&r--}t._HLS_msn=r}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new D.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){t.hasOwnProperty(r)&&i.searchParams.set(r,t[r])}),s=i.toString()}return s},dT=(s,e)=>{if(!s)return e;const t=Ae(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i<e.parts.length;i++)s.parts&&s.parts[i]&&(t.parts[i]=Ae(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},hT=(s,e,t)=>{const i=s.slice(),r=e.slice();t=t||0;const n=[];let a;for(let u=0;u<r.length;u++){const l=i[u+t],f=r[u];l?(a=l.map||a,n.push(dT(l,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},Kh=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=gt(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=gt(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=gt(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=gt(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=gt(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=gt(e,t.uri))})},Yh=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},Qh=(s,e)=>s===e||s.segments&&e.segments&&s.segments.length===e.segments.length&&s.endList===e.endList&&s.mediaSequence===e.mediaSequence&&s.preloadSegment===e.preloadSegment,yo=(s,e,t=Qh)=>{const i=Ae(s,{}),r=i.playlists[e.id];if(!r||t(r,e))return null;e.segments=Yh(e);const n=Ae(r,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}n.segments=hT(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}n.segments.forEach(a=>{Kh(a,n.resolvedUri)});for(let a=0;a<i.playlists.length;a++)i.playlists[a].id===e.id&&(i.playlists[a]=n);return i.playlists[e.id]=n,i.playlists[e.uri]=n,Ps(s,(a,u,l,f)=>{if(a.playlists)for(let g=0;g<a.playlists.length;g++)e.id===a.playlists[g].id&&(a.playlists[g]=n)}),i},To=(s,e)=>{const t=s.segments||[],i=t[t.length-1],r=i&&i.parts&&i.parts[i.parts.length-1],n=r&&r.duration||i&&i.duration;return e&&n?n*1e3:(s.partTargetDuration||s.targetDuration||10)*500},gc=(s,e,t)=>{if(!s)return;const i=[];return s.forEach(r=>{if(!r.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:u}=r.attributes;i.push({id:r.id,bandwidth:n,resolution:a,codecs:u})}),{type:e,isLive:t,renditions:i}};class as extends lT{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Rt("PlaylistLoader");const{withCredentials:r=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new pc,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=gt(this.main.uri,e.uri);this.llhls&&(t=cT(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,r)=>{if(this.request){if(i)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,i){const{uri:r,id:n}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:Gi({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{const i=sT({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});return!i.playlists||!i.playlists.length||this.excludeAudioOnlyVariants(i.playlists),i}catch(i){this.error=i,this.error.metadata={errorType:q.Error.StreamingHlsPlaylistParserError,error:i}}}excludeAudioOnlyVariants(e){const t=i=>{const r=i.attributes||{},{width:n,height:a}=r.RESOLUTION||{};if(n&&a)return!0;const u=Wh(i)||[];return!!yr(u).video};e.some(t)&&e.forEach(i=>{t(i)||(i.excludeUntil=1/0)})}haveMetadata({playlistString:e,playlistObject:t,url:i,id:r}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),Hh({playlist:a,uri:i,id:r});const u=yo(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,u?(this.main=u,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(To(this.media(),!!u)),n.parsedPlaylist=gc(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),D.clearTimeout(this.mediaUpdateTimeout),D.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new pc,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(D.clearTimeout(this.finalRenditionTimeout),t){const u=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=D.setTimeout(this.media.bind(this,e,!1),u);return}const i=this.state,r=!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,r&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(To(e,!0)),!r)return;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;const a={playlistInfo:{type:"media",uri:e.uri}};this.trigger({type:"playlistrequeststart",metadata:a}),this.request=this.vhs_.xhr({uri:e.resolvedUri,withCredentials:this.withCredentials,requestType:"hls-playlist"},(u,l)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=kn(e.resolvedUri,l),u)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:l.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(D.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&&(D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=D.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=D.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=D.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:Gi({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=kn(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=gc(r.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),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,zh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=Yh(i),i.segments.forEach(r=>{Kh(r,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||D.location.href;this.main=aT(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,r=e.ID;let n=i.playlists.length;for(;n--;){const a=i.playlists[n];if(a.attributes["PATHWAY-ID"]===r){const u=a.resolvedUri,l=a.id;if(t){const f=this.createCloneURI_(a.resolvedUri,e),g=ds(r,f),_=this.createCloneAttributes_(r,a.attributes),A=this.createClonePlaylist_(a,g,e,_);i.playlists[n]=A,i.playlists[g]=A,i.playlists[f]=A}else i.playlists.splice(n,1);delete i.playlists[l],delete i.playlists[u]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!i.mediaGroups[n]||!i.mediaGroups[n][r])){for(const a in i.mediaGroups[n])if(a===r){for(const u in i.mediaGroups[n][a])i.mediaGroups[n][a][u].playlists.forEach((f,g)=>{const _=i.playlists[f.id],A=_.id,x=_.resolvedUri;delete i.playlists[A],delete i.playlists[x]});delete i.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,r=i.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=ds(e.ID,n),u=this.createCloneAttributes_(e.ID,t.attributes),l=this.createClonePlaylist_(t,a,e,u);i.playlists[r]=l,i.playlists[a]=l,i.playlists[n]=l,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!r.mediaGroups[n]||r.mediaGroups[n][t]))for(const a in r.mediaGroups[n]){if(a===i)r.mediaGroups[n][t]={};else continue;for(const u in r.mediaGroups[n][a]){const l=r.mediaGroups[n][a][u];r.mediaGroups[n][t][u]=Ge({},l);const f=r.mediaGroups[n][t][u],g=this.createCloneURI_(l.resolvedUri,e);f.resolvedUri=g,f.uri=g,f.playlists=[],l.playlists.forEach((_,A)=>{const x=r.playlists[_.id],L=Vh(n,t,u),T=ds(t,L);if(x&&!r.playlists[T]){const I=this.createClonePlaylist_(x,T,e),M=I.resolvedUri;r.playlists[T]=I,r.playlists[M]=I}f.playlists[A]=this.createClonePlaylist_(_,T,e)})}}})}createClonePlaylist_(e,t,i,r){const n=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),Ae(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(r))i.searchParams.set(n,r[n]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(i[r]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const r=e.contentProtection[i].attributes.keyId;t.add(r.toLowerCase())}return t}}const vo=function(s,e,t,i){const r=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&r&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=r.byteLength||r.length,s.bandwidth||(s.bandwidth=Math.floor(s.bytesReceived/s.roundTripTime*8*1e3))),t.headers&&(s.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(s.timedout=!0),!e&&!s.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(s&&(r||s.responseText)))),i(e,s)},fT=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},pT=(s,e,t,i)=>{!s||!s.size||s.forEach(r=>{r(e,t,i)})},Jh=function(){const s=function e(t,i){t=Ae({timeout:45e3},t);const r=e.beforeRequest||q.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||q.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||q.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(q.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(r));const u=q.Vhs.xhr.original===!0?q.xhr:q.Vhs.xhr,l=fT(n,t);n.delete(r);const f=u(l||t,function(_,A){return pT(a,f,_,A),vo(f,_,A,i)}),g=f.abort;return f.abort=function(){return f.aborted=!0,g.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return s.original=!0,s},mT=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=D.BigInt(s.offset)+D.BigInt(s.length)-D.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},bo=function(s){const e={};return s.byterange&&(e.Range=mT(s.byterange)),e},gT=function(s,e){return s.start(e)+"-"+s.end(e)},_T=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},yT=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},Zh=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];td(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},In=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},ef=function(s){return s.resolvedUri},tf=s=>{const e=Array.prototype.slice.call(s),t=16;let i="",r,n;for(let a=0;a<e.length/t;a++)r=e.slice(a*t,a*t+t).map(_T).join(""),n=e.slice(a*t,a*t+t).map(yT).join(""),i+=r+" "+n+`
|
|
183
|
+
`;return i},TT=({bytes:s})=>tf(s),vT=s=>{let e="",t;for(t=0;t<s.length;t++)e+=gT(s,t)+" ";return e};var bT=Object.freeze({__proto__:null,createTransferableMessage:Zh,initSegmentId:In,segmentKeyId:ef,hexDump:tf,tagDump:TT,textRanges:vT});const sf=.25,xT=(s,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,r=e.videoTimingInfo.transmuxedPresentationStart+t,n=s-r;return new Date(e.dateTimeObject.getTime()+n*1e3)},ST=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,ET=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(t<new Date(i.dateTimeObject))return null;for(let l=0;l<e.segments.length-1;l++){i=e.segments[l];const f=new Date(e.segments[l+1].dateTimeObject);if(t<f)break}const r=e.segments[e.segments.length-1],n=r.dateTimeObject,a=r.videoTimingInfo?ST(r.videoTimingInfo):r.duration+r.duration*sf,u=new Date(n.getTime()+a*1e3);return t>u?null:(t>new Date(n)&&(i=r),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:_t.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},CT=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let n=0;n<e.segments.length&&(i=e.segments[n],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(s<=t));n++);const r=e.segments[e.segments.length-1];if(r.videoTimingInfo&&r.videoTimingInfo.transmuxedPresentationEnd<s)return null;if(s>t){if(s>t+r.duration*sf)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},wT=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const r=t.getTime();return(i.getTime()-r)/1e3},AT=s=>{if(!s.segments||s.segments.length===0)return!1;for(let e=0;e<s.segments.length;e++)if(!s.segments[e].dateTimeObject)return!1;return!0},DT=({playlist:s,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=CT(e,s);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const r={mediaSeconds:e},n=xT(e,i.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},rf=({programTime:s,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:r=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!i)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(!AT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=ET(s,e);if(!u)return a({message:`${s} was not found in the stream`});const l=u.segment,f=wT(l.dateTimeObject,s);if(u.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});i(u.estimatedStart+f),n.one("seeked",()=>{rf({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:r,tech:n,callback:a})});return}const g=l.start+f,_=()=>a(null,n.currentTime());n.one("seeked",_),r&&n.pause(),i(g)},Ka=(s,e)=>{if(s.readyState===4)return e()},kT=(s,e,t,i)=>{let r=[],n,a=!1;const u=function(_,A,x,L){return A.abort(),a=!0,t(_,A,x,L)},l=function(_,A){if(a)return;if(_)return _.metadata=Gi({requestType:i,request:A,error:_}),u(_,A,"",r);const x=A.responseText.substring(r&&r.byteLength||0,A.responseText.length);if(r=i0(r,id(x,!0)),n=n||nr(r),r.length<10||n&&r.length<n+2)return Ka(A,()=>u(_,A,"",r));const L=No(r);return L==="ts"&&r.length<188?Ka(A,()=>u(_,A,"",r)):!L&&r.length<376?Ka(A,()=>u(_,A,"",r)):u(null,A,L,r)},g=e({uri:s,beforeSend(_){_.overrideMimeType("text/plain; charset=x-user-defined"),_.addEventListener("progress",function({total:A,loaded:x}){return vo(_,null,{statusCode:_.status},l)})}},function(_,A){return vo(g,_,A,l)});return g},{EventTarget:IT}=q,_c=function(s,e){if(!Qh(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t<s.segments.length;t++){const i=s.segments[t],r=e.segments[t];if(i.uri!==r.uri)return!1;if(!i.byterange&&!r.byterange)continue;const n=i.byterange,a=r.byterange;if(n&&!a||!n&&a||n.offset!==a.offset||n.length!==a.length)return!1}return!0},PT=(s,e,t,i)=>{const r=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},LT=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:r})=>{const n=e_(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:r});return zh(n,e,PT),n},OT=(s,e)=>{Ps(s,(t,i,r,n)=>{(!e.mediaGroups[i][r]||!(n in e.mediaGroups[i][r]))&&delete s.mediaGroups[i][r][n]})},RT=(s,e,t)=>{let i=!0,r=Ae(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){const a=e.playlists[n];if(a.sidx){const l=Mn(a.sidx);t&&t[l]&&t[l].sidx&&Lo(a,t[l].sidx,a.sidx.resolvedUri)}const u=yo(r,a,_c);u&&(r=u,i=!1)}return Ps(e,(n,a,u,l)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,g=yo(r,n.playlists[0],_c);g&&(r=g,l in r.mediaGroups[a][u]||(r.mediaGroups[a][u][l]=n),r.mediaGroups[a][u][l].playlists[0]=r.playlists[f],i=!1)}}),OT(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:r},NT=(s,e)=>(!s.map&&!e.map||!!(s.map&&e.map&&s.map.byterange.offset===e.map.byterange.offset&&s.map.byterange.length===e.map.byterange.length))&&s.uri===e.uri&&s.byterange.offset===e.byterange.offset&&s.byterange.length===e.byterange.length,yc=(s,e)=>{const t={};for(const i in s){const n=s[i].sidx;if(n){const a=Mn(n);if(!e[a])break;const u=e[a].sidxInfo;NT(u,n)&&(t[a]=e[a])}}return t},MT=(s,e)=>{let i=yc(s.playlists,e);return Ps(s,(r,n,a,u)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;i=Ae(i,yc(l,e))}}),i};class xo extends IT{constructor(e,t,i={},r){super(),this.isPaused_=!0,this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:n=!1}=i;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=i.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_=Rt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){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,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const r=e.sidx&&Mn(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=D.setTimeout(()=>i(!1),0);return}const n=kn(e.sidx.resolvedUri),a=(l,f)=>{if(this.requestErrored_(l,f,t))return;const g=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=f;let A;try{A=n_(he(f.response).subarray(8))}catch(x){x.metadata=Gi({requestType:_,request:f,parseFailure:!0}),this.requestErrored_(x,f,t);return}return g[r]={sidxInfo:e.sidx,sidx:A},Lo(e,A,e.sidx.resolvedUri),i(!0)},u="dash-sidx";this.request=kT(n,this.vhs_.xhr,(l,f,g,_)=>{if(l)return a(l,f);if(!g||g!=="mp4"){const L=g||"unknown";return a({status:f.status,message:`Unsupported ${L} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:A,length:x}=e.sidx.byterange;if(_.length>=x+A)return a(l,{response:_.subarray(A,A+x),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:bo({byterange:e.sidx.byterange})},a)},u)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},D.clearTimeout(this.minimumUpdatePeriodTimeout_),D.clearTimeout(this.mediaRequest_),D.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 i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,r=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,D.clearTimeout(this.mediaRequest_),this.mediaRequest_=null,this.refreshMedia_(t.id),e==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}pause(){this.isPaused_=!0,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.stopRequest(),D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(D.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,D.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=D.setTimeout(()=>this.load(),i);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_){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=D.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,r)=>{if(i){const{requestType:a}=r;i.metadata=Gi({requestType:a,request:r,error:i})}if(this.requestErrored_(i,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const n=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=kn(this.mainPlaylistLoader_.srcUrl,r),n){this.handleMain_(),this.syncClientServerClock_(()=>e(r,n));return}return e(r,n)})}syncClientServerClock_(e){const t=t_(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:gt(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,r)=>{if(!this.request)return;if(i){const{requestType:a}=r;return this.error.metadata=Gi({requestType:a,request:r,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;t.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(r.responseHeaders.date):n=Date.parse(r.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_(){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=LT({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(n){this.error=n,this.error.metadata={errorType:q.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(i=RT(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:n,endList:a}=i,u=[];i.playlists.forEach(f=>{u.push({id:f.id,bandwidth:f.attributes.BANDWIDTH,resolution:f.attributes.RESOLUTION,codecs:f.attributes.CODECS})});const l={duration:n,isLive:!a,renditions:u};t.parsedManifest=l,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(D.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_=D.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_=MT(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{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,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=D.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},To(this.media(),!!i)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const r=e.contentProtection[i].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var Ze={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 BT=s=>{const e=new Uint8Array(new ArrayBuffer(s.length));for(let t=0;t<s.length;t++)e[t]=s.charCodeAt(t);return e.buffer},nf=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},FT=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(s),URL.createObjectURL(t.getBlob())}},af=function(s){return function(){const e=FT(s),t=nf(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},of=function(s){return`var browserWorkerPolyFill = ${nf.toString()};
|
|
184
184
|
browserWorkerPolyFill(self);
|
|
185
|
-
`+s},Xh=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},_T=Wh(Xh(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(l,h){o[l]||(o[l]=[]),o[l]=o[l].concat(h)},this.off=function(l,h){var d;return o[l]?(d=o[l].indexOf(h),o[l]=o[l].slice(),o[l].splice(d,1),d>-1):!1},this.trigger=function(l){var h,d,p,m;if(h=o[l],!!h)if(arguments.length===2)for(p=h.length,d=0;d<p;++d)h[d].call(this,arguments[1]);else{for(m=[],d=arguments.length,d=1;d<arguments.length;++d)m.push(arguments[d]);for(p=h.length,d=0;d<p;++d)h[d].apply(this,m)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(l){o.push(l)}),this.on("done",function(l){o.flush(l)}),this.on("partialdone",function(l){o.partialFlush(l)}),this.on("endedtimeline",function(l){o.endTimeline(l)}),this.on("reset",function(l){o.reset(l)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,i=Math.pow(2,32),r=function(o){var l=new DataView(o.buffer,o.byteOffset,o.byteLength),h;return l.getBigUint64?(h=l.getBigUint64(0),h<Number.MAX_SAFE_INTEGER?Number(h):h):l.getUint32(0)*i+l.getUint32(4)},n={getUint64:r,MAX_UINT32:i},a=n.MAX_UINT32,u,c,f,g,_,A,S,O,T,I,F,N,R,U,j,M,L,$,v,E,V,G,z,Q,se,te,X,Z,J,ee,ie,pe,ge,ye,fe,Qe;(function(){var o;if(z={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in z)z.hasOwnProperty(o)&&(z[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);Q=new Uint8Array([105,115,111,109]),te=new Uint8Array([97,118,99,49]),se=new Uint8Array([0,0,0,1]),X=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]),Z=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]),J={video:X,audio:Z},pe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ie=new Uint8Array([0,0,0,0,0,0,0,0]),ge=new Uint8Array([0,0,0,0,0,0,0,0]),ye=ge,fe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Qe=ge,ee=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),u=function(o){var l=[],h=0,d,p,m;for(d=1;d<arguments.length;d++)l.push(arguments[d]);for(d=l.length;d--;)h+=l[d].byteLength;for(p=new Uint8Array(h+8),m=new DataView(p.buffer,p.byteOffset,p.byteLength),m.setUint32(0,p.byteLength),p.set(o,4),d=0,h=8;d<l.length;d++)p.set(l[d],h),h+=l[d].byteLength;return p},c=function(){return u(z.dinf,u(z.dref,pe))},f=function(o){return u(z.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},g=function(){return u(z.ftyp,Q,se,Q,te)},M=function(o){return u(z.hdlr,J[o])},_=function(o){return u(z.mdat,o)},j=function(o){var l=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(l[12]=o.samplerate>>>24&255,l[13]=o.samplerate>>>16&255,l[14]=o.samplerate>>>8&255,l[15]=o.samplerate&255),u(z.mdhd,l)},U=function(o){return u(z.mdia,j(o),M(o.type),S(o))},A=function(o){return u(z.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},S=function(o){return u(z.minf,o.type==="video"?u(z.vmhd,ee):u(z.smhd,ie),c(),$(o))},O=function(o,l){for(var h=[],d=l.length;d--;)h[d]=E(l[d]);return u.apply(null,[z.moof,A(o)].concat(h))},T=function(o){for(var l=o.length,h=[];l--;)h[l]=N(o[l]);return u.apply(null,[z.moov,F(4294967295)].concat(h).concat(I(o)))},I=function(o){for(var l=o.length,h=[];l--;)h[l]=V(o[l]);return u.apply(null,[z.mvex].concat(h))},F=function(o){var l=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&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 u(z.mvhd,l)},L=function(o){var l=o.samples||[],h=new Uint8Array(4+l.length),d,p;for(p=0;p<l.length;p++)d=l[p].flags,h[p+4]=d.dependsOn<<4|d.isDependedOn<<2|d.hasRedundancy;return u(z.sdtp,h)},$=function(o){return u(z.stbl,v(o),u(z.stts,Qe),u(z.stsc,ye),u(z.stsz,fe),u(z.stco,ge))},(function(){var o,l;v=function(h){return u(z.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),h.type==="video"?o(h):l(h))},o=function(h){var d=h.sps||[],p=h.pps||[],m=[],x=[],C,w;for(C=0;C<d.length;C++)m.push((d[C].byteLength&65280)>>>8),m.push(d[C].byteLength&255),m=m.concat(Array.prototype.slice.call(d[C]));for(C=0;C<p.length;C++)x.push((p[C].byteLength&65280)>>>8),x.push(p[C].byteLength&255),x=x.concat(Array.prototype.slice.call(p[C]));if(w=[z.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,(h.width&65280)>>8,h.width&255,(h.height&65280)>>8,h.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]),u(z.avcC,new Uint8Array([1,h.profileIdc,h.profileCompatibility,h.levelIdc,255].concat([d.length],m,[p.length],x))),u(z.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],h.sarRatio){var k=h.sarRatio[0],B=h.sarRatio[1];w.push(u(z.pasp,new Uint8Array([(k&4278190080)>>24,(k&16711680)>>16,(k&65280)>>8,k&255,(B&4278190080)>>24,(B&16711680)>>16,(B&65280)>>8,B&255])))}return u.apply(null,w)},l=function(h){return u(z.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(h.channelcount&65280)>>8,h.channelcount&255,(h.samplesize&65280)>>8,h.samplesize&255,0,0,0,0,(h.samplerate&65280)>>8,h.samplerate&255,0,0]),f(h))}})(),R=function(o){var l=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.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,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return u(z.tkhd,l)},E=function(o){var l,h,d,p,m,x,C;return l=u(z.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),x=Math.floor(o.baseMediaDecodeTime/a),C=Math.floor(o.baseMediaDecodeTime%a),h=u(z.tfdt,new Uint8Array([1,0,0,0,x>>>24&255,x>>>16&255,x>>>8&255,x&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255])),m=92,o.type==="audio"?(d=G(o,m),u(z.traf,l,h,d)):(p=L(o),d=G(o,p.length+m),u(z.traf,l,h,d,p))},N=function(o){return o.duration=o.duration||4294967295,u(z.trak,R(o),U(o))},V=function(o){var l=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(l[l.length-1]=0),u(z.trex,l)},(function(){var o,l,h;h=function(d,p){var m=0,x=0,C=0,w=0;return d.length&&(d[0].duration!==void 0&&(m=1),d[0].size!==void 0&&(x=2),d[0].flags!==void 0&&(C=4),d[0].compositionTimeOffset!==void 0&&(w=8)),[0,0,m|x|C|w,1,(d.length&4278190080)>>>24,(d.length&16711680)>>>16,(d.length&65280)>>>8,d.length&255,(p&4278190080)>>>24,(p&16711680)>>>16,(p&65280)>>>8,p&255]},l=function(d,p){var m,x,C,w,k,B;for(w=d.samples||[],p+=20+16*w.length,C=h(w,p),x=new Uint8Array(C.length+w.length*16),x.set(C),m=C.length,B=0;B<w.length;B++)k=w[B],x[m++]=(k.duration&4278190080)>>>24,x[m++]=(k.duration&16711680)>>>16,x[m++]=(k.duration&65280)>>>8,x[m++]=k.duration&255,x[m++]=(k.size&4278190080)>>>24,x[m++]=(k.size&16711680)>>>16,x[m++]=(k.size&65280)>>>8,x[m++]=k.size&255,x[m++]=k.flags.isLeading<<2|k.flags.dependsOn,x[m++]=k.flags.isDependedOn<<6|k.flags.hasRedundancy<<4|k.flags.paddingValue<<1|k.flags.isNonSyncSample,x[m++]=k.flags.degradationPriority&61440,x[m++]=k.flags.degradationPriority&15,x[m++]=(k.compositionTimeOffset&4278190080)>>>24,x[m++]=(k.compositionTimeOffset&16711680)>>>16,x[m++]=(k.compositionTimeOffset&65280)>>>8,x[m++]=k.compositionTimeOffset&255;return u(z.trun,x)},o=function(d,p){var m,x,C,w,k,B;for(w=d.samples||[],p+=20+8*w.length,C=h(w,p),m=new Uint8Array(C.length+w.length*8),m.set(C),x=C.length,B=0;B<w.length;B++)k=w[B],m[x++]=(k.duration&4278190080)>>>24,m[x++]=(k.duration&16711680)>>>16,m[x++]=(k.duration&65280)>>>8,m[x++]=k.duration&255,m[x++]=(k.size&4278190080)>>>24,m[x++]=(k.size&16711680)>>>16,m[x++]=(k.size&65280)>>>8,m[x++]=k.size&255;return u(z.trun,m)},G=function(d,p){return d.type==="audio"?o(d,p):l(d,p)}})();var et={ftyp:g,mdat:_,moof:O,moov:T,initSegment:function(o){var l=g(),h=T(o),d;return d=new Uint8Array(l.byteLength+h.byteLength),d.set(l),d.set(h,l.byteLength),d}},Ve=function(o){var l,h,d=[],p=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,d.byteLength=0,l=0;l<o.length;l++)h=o[l],h.nalUnitType==="access_unit_delimiter_rbsp"?(d.length&&(d.duration=h.dts-d.dts,p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d)),d=[h],d.byteLength=h.data.byteLength,d.pts=h.pts,d.dts=h.dts):(h.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(d.keyFrame=!0),d.duration=h.dts-d.dts,d.byteLength+=h.data.byteLength,d.push(h));return p.length&&(!d.duration||d.duration<=0)&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d),p},tt=function(o){var l,h,d=[],p=[];for(d.byteLength=0,d.nalCount=0,d.duration=0,d.pts=o[0].pts,d.dts=o[0].dts,p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=o[0].pts,p.dts=o[0].dts,l=0;l<o.length;l++)h=o[l],h.keyFrame?(d.length&&(p.push(d),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration),d=[h],d.nalCount=h.length,d.byteLength=h.byteLength,d.pts=h.pts,d.dts=h.dts,d.duration=h.duration):(d.duration+=h.duration,d.nalCount+=h.length,d.byteLength+=h.byteLength,d.push(h));return p.length&&d.duration<=0&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration,p.push(d),p},St=function(o){var l;return!o[0][0].keyFrame&&o.length>1&&(l=o.shift(),o.byteLength-=l.byteLength,o.nalCount-=l.nalCount,o[0][0].dts=l.dts,o[0][0].pts=l.pts,o[0][0].duration+=l.duration),o},Je=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},at=function(o,l){var h=Je();return h.dataOffset=l,h.compositionTimeOffset=o.pts-o.dts,h.duration=o.duration,h.size=4*o.length,h.size+=o.byteLength,o.keyFrame&&(h.flags.dependsOn=2,h.flags.isNonSyncSample=0),h},li=function(o,l){var h,d,p,m,x,C=l||0,w=[];for(h=0;h<o.length;h++)for(m=o[h],d=0;d<m.length;d++)x=m[d],p=at(x,C),C+=p.size,w.push(p);return w},Ge=function(o){var l,h,d,p,m,x,C=0,w=o.byteLength,k=o.nalCount,B=w+4*k,W=new Uint8Array(B),ae=new DataView(W.buffer);for(l=0;l<o.length;l++)for(p=o[l],h=0;h<p.length;h++)for(m=p[h],d=0;d<m.length;d++)x=m[d],ae.setUint32(C,x.data.byteLength),C+=4,W.set(x.data,C),C+=x.data.byteLength;return W},ci=function(o,l){var h,d=l||0,p=[];return h=at(o,d),p.push(h),p},ze=function(o){var l,h,d=0,p=o.byteLength,m=o.length,x=p+4*m,C=new Uint8Array(x),w=new DataView(C.buffer);for(l=0;l<o.length;l++)h=o[l],w.setUint32(d,h.data.byteLength),d+=4,C.set(h.data,d),d+=h.data.byteLength;return C},Xi={groupNalsIntoFrames:Ve,groupFramesIntoGops:tt,extendFirstKeyFrame:St,generateSampleTable:li,concatenateNalData:Ge,generateSampleTableForFrame:ci,concatenateNalDataForFrame:ze},gt=[33,16,5,32,164,27],Et=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],be=function(o){for(var l=[];o--;)l.push(0);return l},Pe=function(o){return Object.keys(o).reduce(function(l,h){return l[h]=new Uint8Array(o[h].reduce(function(d,p){return d.concat(p)},[])),l},{})},Oe,di=function(){if(!Oe){var o={96e3:[gt,[227,64],be(154),[56]],88200:[gt,[231],be(170),[56]],64e3:[gt,[248,192],be(240),[56]],48e3:[gt,[255,192],be(268),[55,148,128],be(54),[112]],44100:[gt,[255,192],be(268),[55,163,128],be(84),[112]],32e3:[gt,[255,192],be(268),[55,234],be(226),[112]],24e3:[gt,[255,192],be(268),[55,255,128],be(268),[111,112],be(126),[224]],16e3:[gt,[255,192],be(268),[55,255,128],be(268),[111,255],be(269),[223,108],be(195),[1,192]],12e3:[Et,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,253,128],be(259),[56]],11025:[Et,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,255,192],be(268),[55,175,128],be(108),[112]],8e3:[Et,be(268),[3,121,16],be(47),[7]]};Oe=Pe(o)}return Oe},ei=9e4,Di,ki,hi,fi,Is,Ps,Ki;Di=function(o){return o*ei},ki=function(o,l){return o*l},hi=function(o){return o/ei},fi=function(o,l){return o/l},Is=function(o,l){return Di(fi(o,l))},Ps=function(o,l){return ki(hi(o),l)},Ki=function(o,l,h){return hi(h?o:o-l)};var Se={ONE_SECOND_IN_TS:ei,secondsToVideoTs:Di,secondsToAudioTs:ki,videoTsToSeconds:hi,audioTsToSeconds:fi,audioTsToVideoTs:Is,videoTsToAudioTs:Ps,metadataTsToSeconds:Ki},Ls=di,Ii=Se,Cr=function(o){var l,h,d=0;for(l=0;l<o.length;l++)h=o[l],d+=h.data.byteLength;return d},wr=function(o,l,h,d){var p,m=0,x=0,C=0,w=0,k,B,W;if(l.length&&(p=Ii.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),m=Math.ceil(Ii.ONE_SECOND_IN_TS/(o.samplerate/1024)),h&&d&&(x=p-Math.max(h,d),C=Math.floor(x/m),w=C*m),!(C<1||w>Ii.ONE_SECOND_IN_TS/2))){for(k=Ls()[o.samplerate],k||(k=l[0].data),B=0;B<C;B++)W=l[0],l.splice(0,0,{data:k,dts:W.dts-m,pts:W.pts-m});return o.baseMediaDecodeTime-=Math.floor(Ii.videoTsToAudioTs(w,o.samplerate)),w}},Os=function(o,l,h){return l.minSegmentDts>=h?o:(l.minSegmentDts=1/0,o.filter(function(d){return d.dts>=h?(l.minSegmentDts=Math.min(l.minSegmentDts,d.dts),l.minSegmentPts=l.minSegmentDts,!0):!1}))},pi=function(o){var l,h,d=[];for(l=0;l<o.length;l++)h=o[l],d.push({size:h.data.byteLength,duration:1024});return d},Ar=function(o){var l,h,d=0,p=new Uint8Array(Cr(o));for(l=0;l<o.length;l++)h=o[l],p.set(h.data,d),d+=h.data.byteLength;return p},Rs={prefixWithSilence:wr,trimAdtsFramesByEarliestDts:Os,generateSampleTable:pi,concatenateFrameData:Ar},Dr=Se.ONE_SECOND_IN_TS,y=function(o,l){typeof l.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=l.pts),o.minSegmentPts===void 0?o.minSegmentPts=l.pts:o.minSegmentPts=Math.min(o.minSegmentPts,l.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=l.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,l.pts)),typeof l.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=l.dts),o.minSegmentDts===void 0?o.minSegmentDts=l.dts:o.minSegmentDts=Math.min(o.minSegmentDts,l.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=l.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,l.dts))},b=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},P=function(o,l){var h,d,p=o.minSegmentDts;return l||(p-=o.timelineStartInfo.dts),h=o.timelineStartInfo.baseMediaDecodeTime,h+=p,h=Math.max(0,h),o.type==="audio"&&(d=o.samplerate/Dr,h*=d,h=Math.floor(h)),h},H={clearDtsInfo:b,calculateTrackBaseMediaDecodeTime:P,collectDtsInfo:y},ne=4,he=128,De=function(o){for(var l=0,h={payloadType:-1,payloadSize:0},d=0,p=0;l<o.byteLength&&o[l]!==he;){for(;o[l]===255;)d+=255,l++;for(d+=o[l++];o[l]===255;)p+=255,l++;if(p+=o[l++],!h.payload&&d===ne){var m=String.fromCharCode(o[l+3],o[l+4],o[l+5],o[l+6]);if(m==="GA94"){h.payloadType=d,h.payloadSize=p,h.payload=o.subarray(l,l+p);break}else h.payload=void 0}l+=p,d=0,p=0}return h},it=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},_t=function(o,l){var h=[],d,p,m,x;if(!(l[0]&64))return h;for(p=l[0]&31,d=0;d<p;d++)m=d*3,x={type:l[m+2]&3,pts:o},l[m+2]&4&&(x.ccData=l[m+3]<<8|l[m+4],h.push(x));return h},jt=function(o){for(var l=o.byteLength,h=[],d=1,p,m;d<l-2;)o[d]===0&&o[d+1]===0&&o[d+2]===3?(h.push(d+2),d+=2):d++;if(h.length===0)return o;p=l-h.length,m=new Uint8Array(p);var x=0;for(d=0;d<p;x++,d++)x===h[0]&&(x++,h.shift()),m[d]=o[x];return m},Ct={parseSei:De,parseUserData:it,parseCaptionPackets:_t,discardEmulationPreventionBytes:jt,USER_DATA_REGISTERED_ITU_T_T35:ne},Ot=t,wt=Ct,Ue=function(o){o=o||{},Ue.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Re(0,0),new Re(0,1),new Re(1,0),new Re(1,1)],this.parse708captions_&&(this.cc708Stream_=new xe({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(l){l.on("data",this.trigger.bind(this,"data")),l.on("partialdone",this.trigger.bind(this,"partialdone")),l.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Ue.prototype=new Ot,Ue.prototype.push=function(o){var l,h,d;if(o.nalUnitType==="sei_rbsp"&&(l=wt.parseSei(o.escapedRBSP),!!l.payload&&l.payloadType===wt.USER_DATA_REGISTERED_ITU_T_T35&&(h=wt.parseUserData(l),!!h))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}d=wt.parseCaptionPackets(o.pts,h),this.captionPackets_=this.captionPackets_.concat(d),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},Ue.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(l){return o==="flush"?l.flush():l.partialFlush()},this)},Ue.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(l,h){l.presortIndex=h}),this.captionPackets_.sort(function(l,h){return l.pts===h.pts?l.presortIndex-h.presortIndex:l.pts-h.pts}),this.captionPackets_.forEach(function(l){l.type<2?this.dispatchCea608Packet(l):this.dispatchCea708Packet(l)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},Ue.prototype.flush=function(){return this.flushStream("flush")},Ue.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ue.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},Ue.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},Ue.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},Ue.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},Ue.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},Ue.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var At={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},ti=function(o){var l=At[o]||o;return o&4096&&o===l?"":String.fromCharCode(l)},qt=function(o){return 32<=o&&o<=127||160<=o&&o<=255},ke=function(o){this.windowNum=o,this.reset()};ke.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},ke.prototype.getText=function(){return this.rows.join(`
|
|
186
|
-
`)},
|
|
185
|
+
`+s},uf=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},UT=of(uf(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(c,h){o[c]||(o[c]=[]),o[c]=o[c].concat(h)},this.off=function(c,h){var d;return o[c]?(d=o[c].indexOf(h),o[c]=o[c].slice(),o[c].splice(d,1),d>-1):!1},this.trigger=function(c){var h,d,p,m;if(h=o[c],!!h)if(arguments.length===2)for(p=h.length,d=0;d<p;++d)h[d].call(this,arguments[1]);else{for(m=[],d=arguments.length,d=1;d<arguments.length;++d)m.push(arguments[d]);for(p=h.length,d=0;d<p;++d)h[d].apply(this,m)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(c){o.push(c)}),this.on("done",function(c){o.flush(c)}),this.on("partialdone",function(c){o.partialFlush(c)}),this.on("endedtimeline",function(c){o.endTimeline(c)}),this.on("reset",function(c){o.reset(c)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,i=Math.pow(2,32),r=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),h;return c.getBigUint64?(h=c.getBigUint64(0),h<Number.MAX_SAFE_INTEGER?Number(h):h):c.getUint32(0)*i+c.getUint32(4)},n={getUint64:r,MAX_UINT32:i},a=n.MAX_UINT32,u,l,f,g,_,A,x,L,T,I,M,N,O,j,F,U,R,H,v,E,$,G,V,J,se,ne,Y,te,X,Z,ie,pe,ge,_e,ce,We;(function(){var o;if(V={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in V)V.hasOwnProperty(o)&&(V[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);J=new Uint8Array([105,115,111,109]),ne=new Uint8Array([97,118,99,49]),se=new Uint8Array([0,0,0,1]),Y=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]),te=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]),X={video:Y,audio:te},pe=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ie=new Uint8Array([0,0,0,0,0,0,0,0]),ge=new Uint8Array([0,0,0,0,0,0,0,0]),_e=ge,ce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),We=ge,Z=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),u=function(o){var c=[],h=0,d,p,m;for(d=1;d<arguments.length;d++)c.push(arguments[d]);for(d=c.length;d--;)h+=c[d].byteLength;for(p=new Uint8Array(h+8),m=new DataView(p.buffer,p.byteOffset,p.byteLength),m.setUint32(0,p.byteLength),p.set(o,4),d=0,h=8;d<c.length;d++)p.set(c[d],h),h+=c[d].byteLength;return p},l=function(){return u(V.dinf,u(V.dref,pe))},f=function(o){return u(V.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},g=function(){return u(V.ftyp,J,se,J,ne)},U=function(o){return u(V.hdlr,X[o])},_=function(o){return u(V.mdat,o)},F=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(c[12]=o.samplerate>>>24&255,c[13]=o.samplerate>>>16&255,c[14]=o.samplerate>>>8&255,c[15]=o.samplerate&255),u(V.mdhd,c)},j=function(o){return u(V.mdia,F(o),U(o.type),x(o))},A=function(o){return u(V.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},x=function(o){return u(V.minf,o.type==="video"?u(V.vmhd,Z):u(V.smhd,ie),l(),H(o))},L=function(o,c){for(var h=[],d=c.length;d--;)h[d]=E(c[d]);return u.apply(null,[V.moof,A(o)].concat(h))},T=function(o){for(var c=o.length,h=[];c--;)h[c]=N(o[c]);return u.apply(null,[V.moov,M(4294967295)].concat(h).concat(I(o)))},I=function(o){for(var c=o.length,h=[];c--;)h[c]=$(o[c]);return u.apply(null,[V.mvex].concat(h))},M=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&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 u(V.mvhd,c)},R=function(o){var c=o.samples||[],h=new Uint8Array(4+c.length),d,p;for(p=0;p<c.length;p++)d=c[p].flags,h[p+4]=d.dependsOn<<4|d.isDependedOn<<2|d.hasRedundancy;return u(V.sdtp,h)},H=function(o){return u(V.stbl,v(o),u(V.stts,We),u(V.stsc,_e),u(V.stsz,ce),u(V.stco,ge))},(function(){var o,c;v=function(h){return u(V.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),h.type==="video"?o(h):c(h))},o=function(h){var d=h.sps||[],p=h.pps||[],m=[],S=[],C,w;for(C=0;C<d.length;C++)m.push((d[C].byteLength&65280)>>>8),m.push(d[C].byteLength&255),m=m.concat(Array.prototype.slice.call(d[C]));for(C=0;C<p.length;C++)S.push((p[C].byteLength&65280)>>>8),S.push(p[C].byteLength&255),S=S.concat(Array.prototype.slice.call(p[C]));if(w=[V.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,(h.width&65280)>>8,h.width&255,(h.height&65280)>>8,h.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]),u(V.avcC,new Uint8Array([1,h.profileIdc,h.profileCompatibility,h.levelIdc,255].concat([d.length],m,[p.length],S))),u(V.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],h.sarRatio){var k=h.sarRatio[0],B=h.sarRatio[1];w.push(u(V.pasp,new Uint8Array([(k&4278190080)>>24,(k&16711680)>>16,(k&65280)>>8,k&255,(B&4278190080)>>24,(B&16711680)>>16,(B&65280)>>8,B&255])))}return u.apply(null,w)},c=function(h){return u(V.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(h.channelcount&65280)>>8,h.channelcount&255,(h.samplesize&65280)>>8,h.samplesize&255,0,0,0,0,(h.samplerate&65280)>>8,h.samplerate&255,0,0]),f(h))}})(),O=function(o){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.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,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return u(V.tkhd,c)},E=function(o){var c,h,d,p,m,S,C;return c=u(V.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),S=Math.floor(o.baseMediaDecodeTime/a),C=Math.floor(o.baseMediaDecodeTime%a),h=u(V.tfdt,new Uint8Array([1,0,0,0,S>>>24&255,S>>>16&255,S>>>8&255,S&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255])),m=92,o.type==="audio"?(d=G(o,m),u(V.traf,c,h,d)):(p=R(o),d=G(o,p.length+m),u(V.traf,c,h,d,p))},N=function(o){return o.duration=o.duration||4294967295,u(V.trak,O(o),j(o))},$=function(o){var c=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(c[c.length-1]=0),u(V.trex,c)},(function(){var o,c,h;h=function(d,p){var m=0,S=0,C=0,w=0;return d.length&&(d[0].duration!==void 0&&(m=1),d[0].size!==void 0&&(S=2),d[0].flags!==void 0&&(C=4),d[0].compositionTimeOffset!==void 0&&(w=8)),[0,0,m|S|C|w,1,(d.length&4278190080)>>>24,(d.length&16711680)>>>16,(d.length&65280)>>>8,d.length&255,(p&4278190080)>>>24,(p&16711680)>>>16,(p&65280)>>>8,p&255]},c=function(d,p){var m,S,C,w,k,B;for(w=d.samples||[],p+=20+16*w.length,C=h(w,p),S=new Uint8Array(C.length+w.length*16),S.set(C),m=C.length,B=0;B<w.length;B++)k=w[B],S[m++]=(k.duration&4278190080)>>>24,S[m++]=(k.duration&16711680)>>>16,S[m++]=(k.duration&65280)>>>8,S[m++]=k.duration&255,S[m++]=(k.size&4278190080)>>>24,S[m++]=(k.size&16711680)>>>16,S[m++]=(k.size&65280)>>>8,S[m++]=k.size&255,S[m++]=k.flags.isLeading<<2|k.flags.dependsOn,S[m++]=k.flags.isDependedOn<<6|k.flags.hasRedundancy<<4|k.flags.paddingValue<<1|k.flags.isNonSyncSample,S[m++]=k.flags.degradationPriority&61440,S[m++]=k.flags.degradationPriority&15,S[m++]=(k.compositionTimeOffset&4278190080)>>>24,S[m++]=(k.compositionTimeOffset&16711680)>>>16,S[m++]=(k.compositionTimeOffset&65280)>>>8,S[m++]=k.compositionTimeOffset&255;return u(V.trun,S)},o=function(d,p){var m,S,C,w,k,B;for(w=d.samples||[],p+=20+8*w.length,C=h(w,p),m=new Uint8Array(C.length+w.length*8),m.set(C),S=C.length,B=0;B<w.length;B++)k=w[B],m[S++]=(k.duration&4278190080)>>>24,m[S++]=(k.duration&16711680)>>>16,m[S++]=(k.duration&65280)>>>8,m[S++]=k.duration&255,m[S++]=(k.size&4278190080)>>>24,m[S++]=(k.size&16711680)>>>16,m[S++]=(k.size&65280)>>>8,m[S++]=k.size&255;return u(V.trun,m)},G=function(d,p){return d.type==="audio"?o(d,p):c(d,p)}})();var Ye={ftyp:g,mdat:_,moof:L,moov:T,initSegment:function(o){var c=g(),h=T(o),d;return d=new Uint8Array(c.byteLength+h.byteLength),d.set(c),d.set(h,c.byteLength),d}},Ue=function(o){var c,h,d=[],p=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,d.byteLength=0,c=0;c<o.length;c++)h=o[c],h.nalUnitType==="access_unit_delimiter_rbsp"?(d.length&&(d.duration=h.dts-d.dts,p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d)),d=[h],d.byteLength=h.data.byteLength,d.pts=h.pts,d.dts=h.dts):(h.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(d.keyFrame=!0),d.duration=h.dts-d.dts,d.byteLength+=h.data.byteLength,d.push(h));return p.length&&(!d.duration||d.duration<=0)&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d),p},Qe=function(o){var c,h,d=[],p=[];for(d.byteLength=0,d.nalCount=0,d.duration=0,d.pts=o[0].pts,d.dts=o[0].dts,p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=o[0].pts,p.dts=o[0].dts,c=0;c<o.length;c++)h=o[c],h.keyFrame?(d.length&&(p.push(d),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration),d=[h],d.nalCount=h.length,d.byteLength=h.byteLength,d.pts=h.pts,d.dts=h.dts,d.duration=h.duration):(d.duration+=h.duration,d.nalCount+=h.length,d.byteLength+=h.byteLength,d.push(h));return p.length&&d.duration<=0&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration,p.push(d),p},pt=function(o){var c;return!o[0][0].keyFrame&&o.length>1&&(c=o.shift(),o.byteLength-=c.byteLength,o.nalCount-=c.nalCount,o[0][0].dts=c.dts,o[0][0].pts=c.pts,o[0][0].duration+=c.duration),o},Xe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},it=function(o,c){var h=Xe();return h.dataOffset=c,h.compositionTimeOffset=o.pts-o.dts,h.duration=o.duration,h.size=4*o.length,h.size+=o.byteLength,o.keyFrame&&(h.flags.dependsOn=2,h.flags.isNonSyncSample=0),h},xe=function(o,c){var h,d,p,m,S,C=c||0,w=[];for(h=0;h<o.length;h++)for(m=o[h],d=0;d<m.length;d++)S=m[d],p=it(S,C),C+=p.size,w.push(p);return w},Se=function(o){var c,h,d,p,m,S,C=0,w=o.byteLength,k=o.nalCount,B=w+4*k,W=new Uint8Array(B),oe=new DataView(W.buffer);for(c=0;c<o.length;c++)for(p=o[c],h=0;h<p.length;h++)for(m=p[h],d=0;d<m.length;d++)S=m[d],oe.setUint32(C,S.data.byteLength),C+=4,W.set(S.data,C),C+=S.data.byteLength;return W},rt=function(o,c){var h,d=c||0,p=[];return h=it(o,d),p.push(h),p},$e=function(o){var c,h,d=0,p=o.byteLength,m=o.length,S=p+4*m,C=new Uint8Array(S),w=new DataView(C.buffer);for(c=0;c<o.length;c++)h=o[c],w.setUint32(d,h.data.byteLength),d+=4,C.set(h.data,d),d+=h.data.byteLength;return C},Di={groupNalsIntoFrames:Ue,groupFramesIntoGops:Qe,extendFirstKeyFrame:pt,generateSampleTable:xe,concatenateNalData:Se,generateSampleTableForFrame:rt,concatenateNalDataForFrame:$e},Tt=[33,16,5,32,164,27],wt=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],be=function(o){for(var c=[];o--;)c.push(0);return c},Oe=function(o){return Object.keys(o).reduce(function(c,h){return c[h]=new Uint8Array(o[h].reduce(function(d,p){return d.concat(p)},[])),c},{})},Ne,di=function(){if(!Ne){var o={96e3:[Tt,[227,64],be(154),[56]],88200:[Tt,[231],be(170),[56]],64e3:[Tt,[248,192],be(240),[56]],48e3:[Tt,[255,192],be(268),[55,148,128],be(54),[112]],44100:[Tt,[255,192],be(268),[55,163,128],be(84),[112]],32e3:[Tt,[255,192],be(268),[55,234],be(226),[112]],24e3:[Tt,[255,192],be(268),[55,255,128],be(268),[111,112],be(126),[224]],16e3:[Tt,[255,192],be(268),[55,255,128],be(268),[111,255],be(269),[223,108],be(195),[1,192]],12e3:[wt,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,253,128],be(259),[56]],11025:[wt,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,255,192],be(268),[55,175,128],be(108),[112]],8e3:[wt,be(268),[3,121,16],be(47),[7]]};Ne=Oe(o)}return Ne},ii=9e4,ki,Ii,hi,fi,Ls,Os,Ki;ki=function(o){return o*ii},Ii=function(o,c){return o*c},hi=function(o){return o/ii},fi=function(o,c){return o/c},Ls=function(o,c){return ki(fi(o,c))},Os=function(o,c){return Ii(hi(o),c)},Ki=function(o,c,h){return hi(h?o:o-c)};var Ce={ONE_SECOND_IN_TS:ii,secondsToVideoTs:ki,secondsToAudioTs:Ii,videoTsToSeconds:hi,audioTsToSeconds:fi,audioTsToVideoTs:Ls,videoTsToAudioTs:Os,metadataTsToSeconds:Ki},Rs=di,Pi=Ce,wr=function(o){var c,h,d=0;for(c=0;c<o.length;c++)h=o[c],d+=h.data.byteLength;return d},Ar=function(o,c,h,d){var p,m=0,S=0,C=0,w=0,k,B,W;if(c.length&&(p=Pi.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),m=Math.ceil(Pi.ONE_SECOND_IN_TS/(o.samplerate/1024)),h&&d&&(S=p-Math.max(h,d),C=Math.floor(S/m),w=C*m),!(C<1||w>Pi.ONE_SECOND_IN_TS/2))){for(k=Rs()[o.samplerate],k||(k=c[0].data),B=0;B<C;B++)W=c[0],c.splice(0,0,{data:k,dts:W.dts-m,pts:W.pts-m});return o.baseMediaDecodeTime-=Math.floor(Pi.videoTsToAudioTs(w,o.samplerate)),w}},Ns=function(o,c,h){return c.minSegmentDts>=h?o:(c.minSegmentDts=1/0,o.filter(function(d){return d.dts>=h?(c.minSegmentDts=Math.min(c.minSegmentDts,d.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},pi=function(o){var c,h,d=[];for(c=0;c<o.length;c++)h=o[c],d.push({size:h.data.byteLength,duration:1024});return d},Dr=function(o){var c,h,d=0,p=new Uint8Array(wr(o));for(c=0;c<o.length;c++)h=o[c],p.set(h.data,d),d+=h.data.byteLength;return p},Ms={prefixWithSilence:Ar,trimAdtsFramesByEarliestDts:Ns,generateSampleTable:pi,concatenateFrameData:Dr},kr=Ce.ONE_SECOND_IN_TS,y=function(o,c){typeof c.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=c.pts),o.minSegmentPts===void 0?o.minSegmentPts=c.pts:o.minSegmentPts=Math.min(o.minSegmentPts,c.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=c.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=c.dts),o.minSegmentDts===void 0?o.minSegmentDts=c.dts:o.minSegmentDts=Math.min(o.minSegmentDts,c.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=c.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,c.dts))},b=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},P=function(o,c){var h,d,p=o.minSegmentDts;return c||(p-=o.timelineStartInfo.dts),h=o.timelineStartInfo.baseMediaDecodeTime,h+=p,h=Math.max(0,h),o.type==="audio"&&(d=o.samplerate/kr,h*=d,h=Math.floor(h)),h},z={clearDtsInfo:b,calculateTrackBaseMediaDecodeTime:P,collectDtsInfo:y},ae=4,me=128,Ie=function(o){for(var c=0,h={payloadType:-1,payloadSize:0},d=0,p=0;c<o.byteLength&&o[c]!==me;){for(;o[c]===255;)d+=255,c++;for(d+=o[c++];o[c]===255;)p+=255,c++;if(p+=o[c++],!h.payload&&d===ae){var m=String.fromCharCode(o[c+3],o[c+4],o[c+5],o[c+6]);if(m==="GA94"){h.payloadType=d,h.payloadSize=p,h.payload=o.subarray(c,c+p);break}else h.payload=void 0}c+=p,d=0,p=0}return h},nt=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},vt=function(o,c){var h=[],d,p,m,S;if(!(c[0]&64))return h;for(p=c[0]&31,d=0;d<p;d++)m=d*3,S={type:c[m+2]&3,pts:o},c[m+2]&4&&(S.ccData=c[m+3]<<8|c[m+4],h.push(S));return h},Vt=function(o){for(var c=o.byteLength,h=[],d=1,p,m;d<c-2;)o[d]===0&&o[d+1]===0&&o[d+2]===3?(h.push(d+2),d+=2):d++;if(h.length===0)return o;p=c-h.length,m=new Uint8Array(p);var S=0;for(d=0;d<p;S++,d++)S===h[0]&&(S++,h.shift()),m[d]=o[S];return m},At={parseSei:Ie,parseUserData:nt,parseCaptionPackets:vt,discardEmulationPreventionBytes:Vt,USER_DATA_REGISTERED_ITU_T_T35:ae},Nt=t,Dt=At,Ve=function(o){o=o||{},Ve.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Me(0,0),new Me(0,1),new Me(1,0),new Me(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ee({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Ve.prototype=new Nt,Ve.prototype.push=function(o){var c,h,d;if(o.nalUnitType==="sei_rbsp"&&(c=Dt.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===Dt.USER_DATA_REGISTERED_ITU_T_T35&&(h=Dt.parseUserData(c),!!h))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}d=Dt.parseCaptionPackets(o.pts,h),this.captionPackets_=this.captionPackets_.concat(d),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},Ve.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},Ve.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(c,h){c.presortIndex=h}),this.captionPackets_.sort(function(c,h){return c.pts===h.pts?c.presortIndex-h.presortIndex:c.pts-h.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},Ve.prototype.flush=function(){return this.flushStream("flush")},Ve.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ve.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},Ve.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},Ve.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},Ve.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},Ve.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},Ve.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var kt={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},si=function(o){var c=kt[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},Ht=function(o){return 32<=o&&o<=127||160<=o&&o<=255},Pe=function(o){this.windowNum=o,this.reset()};Pe.prototype.reset=function(){this.clearText(),this.pendingNewLine=!1,this.winAttr={},this.penAttr={},this.penLoc={},this.penColor={},this.visible=0,this.rowLock=0,this.columnLock=0,this.priority=0,this.relativePositioning=0,this.anchorVertical=0,this.anchorHorizontal=0,this.anchorPoint=0,this.rowCount=1,this.virtualRowCount=this.rowCount+1,this.columnCount=41,this.windowStyle=0,this.penStyle=0},Pe.prototype.getText=function(){return this.rows.join(`
|
|
186
|
+
`)},Pe.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Pe.prototype.newLine=function(o){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(o),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},Pe.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Pe.prototype.addText=function(o){this.rows[this.rowIdx]+=o},Pe.prototype.backspace=function(){if(!this.isEmpty()){var o=this.rows[this.rowIdx];this.rows[this.rowIdx]=o.substr(0,o.length-1)}};var Li=function(o,c,h){this.serviceNum=o,this.text="",this.currentWindow=new Pe(-1),this.windows=[],this.stream=h,typeof c=="string"&&this.createTextDecoder(c)};Li.prototype.init=function(o,c){this.startPts=o;for(var h=0;h<8;h++)this.windows[h]=new Pe(h),typeof c=="function"&&(this.windows[h].beforeRowOverflow=c)},Li.prototype.setCurrentWindow=function(o){this.currentWindow=this.windows[o]},Li.prototype.createTextDecoder=function(o){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(o)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+o+" encoding. "+c})}};var Ee=function(o){o=o||{},Ee.prototype.init.call(this);var c=this,h=o.captionServices||{},d={},p;Object.keys(h).forEach(m=>{p=h[m],/^SERVICE/.test(m)&&(d[m]=p.encoding)}),this.serviceEncodings=d,this.current708Packet=null,this.services={},this.push=function(m){m.type===3?(c.new708Packet(),c.add708Bytes(m)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(m))}};Ee.prototype=new Nt,Ee.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ee.prototype.add708Bytes=function(o){var c=o.ccData,h=c>>>8,d=c&255;this.current708Packet.ptsVals.push(o.pts),this.current708Packet.data.push(h),this.current708Packet.data.push(d)},Ee.prototype.push708Packet=function(){var o=this.current708Packet,c=o.data,h=null,d=null,p=0,m=c[p++];for(o.seq=m>>6,o.sizeCode=m&63;p<c.length;p++)m=c[p++],h=m>>5,d=m&31,h===7&&d>0&&(m=c[p++],h=m),this.pushServiceBlock(h,p,d),d>0&&(p+=d-1)},Ee.prototype.pushServiceBlock=function(o,c,h){var d,p=c,m=this.current708Packet.data,S=this.services[o];for(S||(S=this.initService(o,p));p<c+h&&p<m.length;p++)d=m[p],Ht(d)?p=this.handleText(p,S):d===24?p=this.multiByteCharacter(p,S):d===16?p=this.extendedCommands(p,S):128<=d&&d<=135?p=this.setCurrentWindow(p,S):152<=d&&d<=159?p=this.defineWindow(p,S):d===136?p=this.clearWindows(p,S):d===140?p=this.deleteWindows(p,S):d===137?p=this.displayWindows(p,S):d===138?p=this.hideWindows(p,S):d===139?p=this.toggleWindows(p,S):d===151?p=this.setWindowAttributes(p,S):d===144?p=this.setPenAttributes(p,S):d===145?p=this.setPenColor(p,S):d===146?p=this.setPenLocation(p,S):d===143?S=this.reset(p,S):d===8?S.currentWindow.backspace():d===12?S.currentWindow.clearText():d===13?S.currentWindow.pendingNewLine=!0:d===14?S.currentWindow.clearText():d===141&&p++},Ee.prototype.extendedCommands=function(o,c){var h=this.current708Packet.data,d=h[++o];return Ht(d)&&(o=this.handleText(o,c,{isExtended:!0})),o},Ee.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},Ee.prototype.initService=function(o,c){var d="SERVICE"+o,h=this,d,p;return d in this.serviceEncodings&&(p=this.serviceEncodings[d]),this.services[o]=new Li(o,p,h),this.services[o].init(this.getPts(c),function(m){h.flushDisplayed(m,h.services[o])}),this.services[o]},Ee.prototype.handleText=function(o,c,h){var d=h&&h.isExtended,p=h&&h.isMultiByte,m=this.current708Packet.data,S=d?4096:0,C=m[o],w=m[o+1],k=c.currentWindow,B,W;function oe(Q){return Q.map(de=>("0"+(de&255).toString(16)).slice(-2)).join("")}if(p?(W=[C,w],o++):W=[C],c.textDecoder_&&!d)B=c.textDecoder_.decode(new Uint8Array(W));else if(p){const Q=oe(W);B=String.fromCharCode(parseInt(Q,16))}else B=si(S|C);return k.pendingNewLine&&!k.isEmpty()&&k.newLine(this.getPts(o)),k.pendingNewLine=!1,k.addText(B),o},Ee.prototype.multiByteCharacter=function(o,c){var h=this.current708Packet.data,d=h[o+1],p=h[o+2];return Ht(d)&&Ht(p)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},Ee.prototype.setCurrentWindow=function(o,c){var h=this.current708Packet.data,d=h[o],p=d&7;return c.setCurrentWindow(p),o},Ee.prototype.defineWindow=function(o,c){var h=this.current708Packet.data,d=h[o],p=d&7;c.setCurrentWindow(p);var m=c.currentWindow;return d=h[++o],m.visible=(d&32)>>5,m.rowLock=(d&16)>>4,m.columnLock=(d&8)>>3,m.priority=d&7,d=h[++o],m.relativePositioning=(d&128)>>7,m.anchorVertical=d&127,d=h[++o],m.anchorHorizontal=d,d=h[++o],m.anchorPoint=(d&240)>>4,m.rowCount=d&15,d=h[++o],m.columnCount=d&63,d=h[++o],m.windowStyle=(d&56)>>3,m.penStyle=d&7,m.virtualRowCount=m.rowCount+1,o},Ee.prototype.setWindowAttributes=function(o,c){var h=this.current708Packet.data,d=h[o],p=c.currentWindow.winAttr;return d=h[++o],p.fillOpacity=(d&192)>>6,p.fillRed=(d&48)>>4,p.fillGreen=(d&12)>>2,p.fillBlue=d&3,d=h[++o],p.borderType=(d&192)>>6,p.borderRed=(d&48)>>4,p.borderGreen=(d&12)>>2,p.borderBlue=d&3,d=h[++o],p.borderType+=(d&128)>>5,p.wordWrap=(d&64)>>6,p.printDirection=(d&48)>>4,p.scrollDirection=(d&12)>>2,p.justify=d&3,d=h[++o],p.effectSpeed=(d&240)>>4,p.effectDirection=(d&12)>>2,p.displayEffect=d&3,o},Ee.prototype.flushDisplayed=function(o,c){for(var h=[],d=0;d<8;d++)c.windows[d].visible&&!c.windows[d].isEmpty()&&h.push(c.windows[d].getText());c.endPts=o,c.text=h.join(`
|
|
187
187
|
|
|
188
|
-
`),this.pushCaption(l),l.startPts=o},xe.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},xe.prototype.displayWindows=function(o,l){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,l);for(var m=0;m<8;m++)d&1<<m&&(l.windows[m].visible=1);return o},xe.prototype.hideWindows=function(o,l){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,l);for(var m=0;m<8;m++)d&1<<m&&(l.windows[m].visible=0);return o},xe.prototype.toggleWindows=function(o,l){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,l);for(var m=0;m<8;m++)d&1<<m&&(l.windows[m].visible^=1);return o},xe.prototype.clearWindows=function(o,l){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,l);for(var m=0;m<8;m++)d&1<<m&&l.windows[m].clearText();return o},xe.prototype.deleteWindows=function(o,l){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,l);for(var m=0;m<8;m++)d&1<<m&&l.windows[m].reset();return o},xe.prototype.setPenAttributes=function(o,l){var h=this.current708Packet.data,d=h[o],p=l.currentWindow.penAttr;return d=h[++o],p.textTag=(d&240)>>4,p.offset=(d&12)>>2,p.penSize=d&3,d=h[++o],p.italics=(d&128)>>7,p.underline=(d&64)>>6,p.edgeType=(d&56)>>3,p.fontStyle=d&7,o},xe.prototype.setPenColor=function(o,l){var h=this.current708Packet.data,d=h[o],p=l.currentWindow.penColor;return d=h[++o],p.fgOpacity=(d&192)>>6,p.fgRed=(d&48)>>4,p.fgGreen=(d&12)>>2,p.fgBlue=d&3,d=h[++o],p.bgOpacity=(d&192)>>6,p.bgRed=(d&48)>>4,p.bgGreen=(d&12)>>2,p.bgBlue=d&3,d=h[++o],p.edgeRed=(d&48)>>4,p.edgeGreen=(d&12)>>2,p.edgeBlue=d&3,o},xe.prototype.setPenLocation=function(o,l){var h=this.current708Packet.data,d=h[o],p=l.currentWindow.penLoc;return l.currentWindow.pendingNewLine=!0,d=h[++o],p.row=d&15,d=h[++o],p.column=d&63,o},xe.prototype.reset=function(o,l){var h=this.getPts(o);return this.flushDisplayed(h,l),this.initService(l.serviceNum,o)};var kr={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},Ir=function(o){return o===null?"":(o=kr[o]||o,String.fromCharCode(o))},Pr=14,Sf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Li=function(){for(var o=[],l=Pr+1;l--;)o.push({text:"",indent:0,offset:0});return o},Re=function(o,l){Re.prototype.init.call(this),this.field_=o||0,this.dataChannel_=l||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(h){var d,p,m,x,C;if(d=h.ccData&32639,d===this.lastControlCode_){this.lastControlCode_=null;return}if((d&61440)===4096?this.lastControlCode_=d:d!==this.PADDING_&&(this.lastControlCode_=null),m=d>>>8,x=d&255,d!==this.PADDING_)if(d===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(d===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(h.pts),this.flushDisplayed(h.pts),p=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=p,this.startPts_=h.pts;else if(d===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(h.pts);else if(d===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(h.pts);else if(d===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(h.pts);else if(d===this.CARRIAGE_RETURN_)this.clearFormatting(h.pts),this.flushDisplayed(h.pts),this.shiftRowsUp_(),this.startPts_=h.pts;else if(d===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(d===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(h.pts),this.displayed_=Li();else if(d===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Li();else if(d===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(h.pts),this.displayed_=Li()),this.mode_="paintOn",this.startPts_=h.pts;else if(this.isSpecialCharacter(m,x))m=(m&3)<<8,C=Ir(m|x),this[this.mode_](h.pts,C),this.column_++;else if(this.isExtCharacter(m,x))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),m=(m&3)<<8,C=Ir(m|x),this[this.mode_](h.pts,C),this.column_++;else if(this.isMidRowCode(m,x))this.clearFormatting(h.pts),this[this.mode_](h.pts," "),this.column_++,(x&14)===14&&this.addFormatting(h.pts,["i"]),(x&1)===1&&this.addFormatting(h.pts,["u"]);else if(this.isOffsetControlCode(m,x)){const k=x&3;this.nonDisplayed_[this.row_].offset=k,this.column_+=k}else if(this.isPAC(m,x)){var w=Sf.indexOf(d&7968);if(this.mode_==="rollUp"&&(w-this.rollUpRows_+1<0&&(w=this.rollUpRows_-1),this.setRollUp(h.pts,w)),w!==this.row_&&w>=0&&w<=14&&(this.clearFormatting(h.pts),this.row_=w),x&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(h.pts,["u"]),(d&16)===16){const k=(d&14)>>1;this.column_=k*4,this.nonDisplayed_[this.row_].indent+=k}this.isColorPAC(x)&&(x&14)===14&&this.addFormatting(h.pts,["i"])}else this.isNormalChar(m)&&(x===0&&(x=null),C=Ir(m),C+=Ir(x),this[this.mode_](h.pts,C),this.column_+=C.length)}};Re.prototype=new Ot,Re.prototype.flushDisplayed=function(o){const l=d=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+d+"."})},h=[];this.displayed_.forEach((d,p)=>{if(d&&d.text&&d.text.length){try{d.text=d.text.trim()}catch{l(p)}d.text.length&&h.push({text:d.text,line:p+1,position:10+Math.min(70,d.indent*10)+d.offset*2.5})}else d==null&&l(p)}),h.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:h,stream:this.name_})},Re.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Li(),this.nonDisplayed_=Li(),this.lastControlCode_=null,this.column_=0,this.row_=Pr,this.rollUpRows_=2,this.formatting_=[]},Re.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},Re.prototype.isSpecialCharacter=function(o,l){return o===this.EXT_&&l>=48&&l<=63},Re.prototype.isExtCharacter=function(o,l){return(o===this.EXT_+1||o===this.EXT_+2)&&l>=32&&l<=63},Re.prototype.isMidRowCode=function(o,l){return o===this.EXT_&&l>=32&&l<=47},Re.prototype.isOffsetControlCode=function(o,l){return o===this.OFFSET_&&l>=33&&l<=35},Re.prototype.isPAC=function(o,l){return o>=this.BASE_&&o<this.BASE_+8&&l>=64&&l<=127},Re.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Re.prototype.isNormalChar=function(o){return o>=32&&o<=127},Re.prototype.setRollUp=function(o,l){if(this.mode_!=="rollUp"&&(this.row_=Pr,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=Li(),this.displayed_=Li()),l!==void 0&&l!==this.row_)for(var h=0;h<this.rollUpRows_;h++)this.displayed_[l-h]=this.displayed_[this.row_-h],this.displayed_[this.row_-h]={text:"",indent:0,offset:0};l===void 0&&(l=this.row_),this.topRow_=l-this.rollUpRows_+1},Re.prototype.addFormatting=function(o,l){this.formatting_=this.formatting_.concat(l);var h=l.reduce(function(d,p){return d+"<"+p+">"},"");this[this.mode_](o,h)},Re.prototype.clearFormatting=function(o){if(this.formatting_.length){var l=this.formatting_.reverse().reduce(function(h,d){return h+"</"+d+">"},"");this.formatting_=[],this[this.mode_](o,l)}},Re.prototype.popOn=function(o,l){var h=this.nonDisplayed_[this.row_].text;h+=l,this.nonDisplayed_[this.row_].text=h},Re.prototype.rollUp=function(o,l){var h=this.displayed_[this.row_].text;h+=l,this.displayed_[this.row_].text=h},Re.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<Pr+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Re.prototype.paintOn=function(o,l){var h=this.displayed_[this.row_].text;h+=l,this.displayed_[this.row_].text=h};var cu={CaptionStream:Ue,Cea608Stream:Re,Cea708Stream:xe},Lr={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ef=t,Cf=8589934592,wf=4294967296,du="shared",ea=function(o,l){var h=1;for(o>l&&(h=-1);Math.abs(l-o)>wf;)o+=h*Cf;return o},ta=function(o){var l,h;ta.prototype.init.call(this),this.type_=o||du,this.push=function(d){if(d.type==="metadata"){this.trigger("data",d);return}this.type_!==du&&d.type!==this.type_||(h===void 0&&(h=d.dts),d.dts=ea(d.dts,h),d.pts=ea(d.pts,h),l=d.dts,this.trigger("data",d))},this.flush=function(){h=l,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){h=void 0,l=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ta.prototype=new Ef;var hu={TimestampRolloverStream:ta,handleRollover:ea},Af=(o,l,h)=>{if(!o)return-1;for(var d=h;d<o.length;d++)if(o[d]===l)return d;return-1},Df={typedArrayIndexOf:Af},Or=Df.typedArrayIndexOf,Rr={Utf8:3},fu=function(o,l,h){var d,p="";for(d=l;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},Ns=function(o,l,h){return decodeURIComponent(fu(o,l,h))},Ms=function(o,l,h){return unescape(fu(o,l,h))},Bs=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Fs={APIC:function(o){var l=1,h,d,p="-->";o.data[0]===Rr.Utf8&&(h=Or(o.data,0,l),!(h<0)&&(o.mimeType=Ms(o.data,l,h),l=h+1,o.pictureType=o.data[l],l++,d=Or(o.data,0,l),!(d<0)&&(o.description=Ns(o.data,l,d),l=d+1,o.mimeType===p?o.url=Ms(o.data,l,o.data.length):o.pictureData=o.data.subarray(l,o.data.length))))},"T*":function(o){o.data[0]===Rr.Utf8&&(o.value=Ns(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var l;o.data[0]===Rr.Utf8&&(l=Or(o.data,0,1),l!==-1&&(o.description=Ns(o.data,1,l),o.value=Ns(o.data,l+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=Ms(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var l;o.data[0]===Rr.Utf8&&(l=Or(o.data,0,1),l!==-1&&(o.description=Ns(o.data,1,l),o.url=Ms(o.data,l+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var l;for(l=0;l<o.data.length;l++)if(o.data[l]===0){o.owner=Ms(o.data,0,l);break}o.privateData=o.data.subarray(l+1),o.data=o.privateData}},kf=function(o){var l,h,d=10,p=0,m=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){p=Bs(o.subarray(6,10)),p+=10;var x=o[5]&64;x&&(d+=4,d+=Bs(o.subarray(10,14)),p-=Bs(o.subarray(16,20)));do{if(l=Bs(o.subarray(d+4,d+8)),l<1)break;h=String.fromCharCode(o[d],o[d+1],o[d+2],o[d+3]);var C={id:h,data:o.subarray(d+10,d+l+10)};C.key=C.id,Fs[C.id]?Fs[C.id](C):C.id[0]==="T"?Fs["T*"](C):C.id[0]==="W"&&Fs["W*"](C),m.push(C),d+=10,d+=l}while(d<p);return m}},pu={parseId3Frames:kf,parseSyncSafeInteger:Bs,frameParsers:Fs},If=t,Pf=Lr,mi=pu,Nr;Nr=function(o){var l={descriptor:o&&o.descriptor},h=0,d=[],p=0,m;if(Nr.prototype.init.call(this),this.dispatchType=Pf.METADATA_STREAM_TYPE.toString(16),l.descriptor)for(m=0;m<l.descriptor.length;m++)this.dispatchType+=("00"+l.descriptor[m].toString(16)).slice(-2);this.push=function(x){var C,w,k,B,W,ae;if(x.type==="timed-metadata"){if(x.dataAlignmentIndicator&&(p=0,d.length=0),d.length===0&&(x.data.length<10||x.data[0]!==73||x.data[1]!==68||x.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(d.push(x),p+=x.data.byteLength,d.length===1&&(h=mi.parseSyncSafeInteger(x.data.subarray(6,10)),h+=10),!(p<h)){for(C={data:new Uint8Array(h),frames:[],pts:d[0].pts,dts:d[0].dts},W=0;W<h;)C.data.set(d[0].data.subarray(0,h-W),W),W+=d[0].data.byteLength,p-=d[0].data.byteLength,d.shift();w=10,C.data[5]&64&&(w+=4,w+=mi.parseSyncSafeInteger(C.data.subarray(10,14)),h-=mi.parseSyncSafeInteger(C.data.subarray(16,20)));do{if(k=mi.parseSyncSafeInteger(C.data.subarray(w+4,w+8)),k<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(ae=String.fromCharCode(C.data[w],C.data[w+1],C.data[w+2],C.data[w+3]),B={id:ae,data:C.data.subarray(w+10,w+k+10)},B.key=B.id,mi.frameParsers[B.id]?mi.frameParsers[B.id](B):B.id[0]==="T"?mi.frameParsers["T*"](B):B.id[0]==="W"&&mi.frameParsers["W*"](B),B.owner==="com.apple.streaming.transportStreamTimestamp"){var Y=B.data,le=(Y[3]&1)<<30|Y[4]<<22|Y[5]<<14|Y[6]<<6|Y[7]>>>2;le*=4,le+=Y[7]&3,B.timeStamp=le,C.pts===void 0&&C.dts===void 0&&(C.pts=B.timeStamp,C.dts=B.timeStamp),this.trigger("timestamp",B)}C.frames.push(B),w+=10,w+=k}while(w<h);this.trigger("data",C)}}}},Nr.prototype=new If;var Lf=Nr,ia=t,sa=cu,Rt=Lr,Of=hu.TimestampRolloverStream,Mr,Us,Br,Yi=188,ra=71;Mr=function(){var o=new Uint8Array(Yi),l=0;Mr.prototype.init.call(this),this.push=function(h){var d=0,p=Yi,m;for(l?(m=new Uint8Array(h.byteLength+l),m.set(o.subarray(0,l)),m.set(h,l),l=0):m=h;p<m.byteLength;){if(m[d]===ra&&m[p]===ra){this.trigger("data",m.subarray(d,p)),d+=Yi,p+=Yi;continue}d++,p++}d<m.byteLength&&(o.set(m.subarray(d),0),l=m.byteLength-d)},this.flush=function(){l===Yi&&o[0]===ra&&(this.trigger("data",o),l=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){l=0,this.trigger("reset")}},Mr.prototype=new ia,Us=function(){var o,l,h,d;Us.prototype.init.call(this),d=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(p,m){var x=0;m.payloadUnitStartIndicator&&(x+=p[x]+1),m.type==="pat"?l(p.subarray(x),m):h(p.subarray(x),m)},l=function(p,m){m.section_number=p[7],m.last_section_number=p[8],d.pmtPid=(p[10]&31)<<8|p[11],m.pmtPid=d.pmtPid},h=function(p,m){var x,C,w,k;if(p[5]&1){for(d.programMapTable={video:null,audio:null,"timed-metadata":{}},x=(p[1]&15)<<8|p[2],C=3+x-4,w=(p[10]&15)<<8|p[11],k=12+w;k<C;){var B=p[k],W=(p[k+1]&31)<<8|p[k+2];B===Rt.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=W:B===Rt.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=W:B===Rt.METADATA_STREAM_TYPE&&(d.programMapTable["timed-metadata"][W]=B),k+=((p[k+3]&15)<<8|p[k+4])+5}m.programMapTable=d.programMapTable}},this.push=function(p){var m={},x=4;if(m.payloadUnitStartIndicator=!!(p[1]&64),m.pid=p[1]&31,m.pid<<=8,m.pid|=p[2],(p[3]&48)>>>4>1&&(x+=p[x]+1),m.pid===0)m.type="pat",o(p.subarray(x),m),this.trigger("data",m);else if(m.pid===this.pmtPid)for(m.type="pmt",o(p.subarray(x),m),this.trigger("data",m);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([p,x,m]):this.processPes_(p,x,m)},this.processPes_=function(p,m,x){x.pid===this.programMapTable.video?x.streamType=Rt.H264_STREAM_TYPE:x.pid===this.programMapTable.audio?x.streamType=Rt.ADTS_STREAM_TYPE:x.streamType=this.programMapTable["timed-metadata"][x.pid],x.type="pes",x.data=p.subarray(m),this.trigger("data",x)}},Us.prototype=new ia,Us.STREAM_TYPES={h264:27,adts:15},Br=function(){var o=this,l=!1,h={data:[],size:0},d={data:[],size:0},p={data:[],size:0},m,x=function(w,k){var B;const W=w[0]<<16|w[1]<<8|w[2];k.data=new Uint8Array,W===1&&(k.packetLength=6+(w[4]<<8|w[5]),k.dataAlignmentIndicator=(w[6]&4)!==0,B=w[7],B&192&&(k.pts=(w[9]&14)<<27|(w[10]&255)<<20|(w[11]&254)<<12|(w[12]&255)<<5|(w[13]&254)>>>3,k.pts*=4,k.pts+=(w[13]&6)>>>1,k.dts=k.pts,B&64&&(k.dts=(w[14]&14)<<27|(w[15]&255)<<20|(w[16]&254)<<12|(w[17]&255)<<5|(w[18]&254)>>>3,k.dts*=4,k.dts+=(w[18]&6)>>>1)),k.data=w.subarray(9+w[8]))},C=function(w,k,B){var W=new Uint8Array(w.size),ae={type:k},Y=0,le=0,_e=!1,We;if(!(!w.data.length||w.size<9)){for(ae.trackId=w.data[0].pid,Y=0;Y<w.data.length;Y++)We=w.data[Y],W.set(We.data,le),le+=We.data.byteLength;x(W,ae),_e=k==="video"||ae.packetLength<=w.size,(B||_e)&&(w.size=0,w.data.length=0),_e&&o.trigger("data",ae)}};Br.prototype.init.call(this),this.push=function(w){({pat:function(){},pes:function(){var k,B;switch(w.streamType){case Rt.H264_STREAM_TYPE:k=h,B="video";break;case Rt.ADTS_STREAM_TYPE:k=d,B="audio";break;case Rt.METADATA_STREAM_TYPE:k=p,B="timed-metadata";break;default:return}w.payloadUnitStartIndicator&&C(k,B,!0),k.data.push(w),k.size+=w.data.byteLength},pmt:function(){var k={type:"metadata",tracks:[]};m=w.programMapTable,m.video!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),l=!0,o.trigger("data",k)}})[w.type]()},this.reset=function(){h.size=0,h.data.length=0,d.size=0,d.data.length=0,this.trigger("reset")},this.flushStreams_=function(){C(h,"video"),C(d,"audio"),C(p,"timed-metadata")},this.flush=function(){if(!l&&m){var w={type:"metadata",tracks:[]};m.video!==null&&w.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&w.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),o.trigger("data",w)}l=!1,this.flushStreams_(),this.trigger("done")}},Br.prototype=new ia;var mu={PAT_PID:0,MP2T_PACKET_LENGTH:Yi,TransportPacketStream:Mr,TransportParseStream:Us,ElementaryStream:Br,TimestampRolloverStream:Of,CaptionStream:sa.CaptionStream,Cea608Stream:sa.Cea608Stream,Cea708Stream:sa.Cea708Stream,MetadataStream:Lf};for(var na in Rt)Rt.hasOwnProperty(na)&&(mu[na]=Rt[na]);var Rf=mu,Nf=t,Mf=Se.ONE_SECOND_IN_TS,Fr,gu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Fr=function(o){var l,h=0;Fr.prototype.init.call(this),this.skipWarn_=function(d,p){this.trigger("log",{level:"warn",message:`adts skiping bytes ${d} to ${p} in frame ${h} outside syncword`})},this.push=function(d){var p=0,m,x,C,w,k;if(o||(h=0),d.type==="audio"){l&&l.length?(C=l,l=new Uint8Array(C.byteLength+d.data.byteLength),l.set(C),l.set(d.data,C.byteLength)):l=d.data;for(var B;p+7<l.length;){if(l[p]!==255||(l[p+1]&246)!==240){typeof B!="number"&&(B=p),p++;continue}if(typeof B=="number"&&(this.skipWarn_(B,p),B=null),x=(~l[p+1]&1)*2,m=(l[p+3]&3)<<11|l[p+4]<<3|(l[p+5]&224)>>5,w=((l[p+6]&3)+1)*1024,k=w*Mf/gu[(l[p+2]&60)>>>2],l.byteLength-p<m)break;this.trigger("data",{pts:d.pts+h*k,dts:d.dts+h*k,sampleCount:w,audioobjecttype:(l[p+2]>>>6&3)+1,channelcount:(l[p+2]&1)<<2|(l[p+3]&192)>>>6,samplerate:gu[(l[p+2]&60)>>>2],samplingfrequencyindex:(l[p+2]&60)>>>2,samplesize:16,data:l.subarray(p+7+x,p+m)}),h++,p+=m}typeof B=="number"&&(this.skipWarn_(B,p),B=null),l=l.subarray(p)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){l=void 0,this.trigger("reset")},this.endTimeline=function(){l=void 0,this.trigger("endedtimeline")}},Fr.prototype=new Nf;var Bf=Fr,_u;_u=function(o){var l=o.byteLength,h=0,d=0;this.length=function(){return 8*l},this.bitsAvailable=function(){return 8*l+d},this.loadWord=function(){var p=o.byteLength-l,m=new Uint8Array(4),x=Math.min(4,l);if(x===0)throw new Error("no bytes available");m.set(o.subarray(p,p+x)),h=new DataView(m.buffer).getUint32(0),d=x*8,l-=x},this.skipBits=function(p){var m;d>p?(h<<=p,d-=p):(p-=d,m=Math.floor(p/8),p-=m*8,l-=m,this.loadWord(),h<<=p,d-=p)},this.readBits=function(p){var m=Math.min(d,p),x=h>>>32-m;return d-=m,d>0?h<<=m:l>0&&this.loadWord(),m=p-m,m>0?x<<m|this.readBits(m):x},this.skipLeadingZeros=function(){var p;for(p=0;p<d;++p)if((h&2147483648>>>p)!==0)return h<<=p,d-=p,p;return this.loadWord(),p+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var p=this.skipLeadingZeros();return this.readBits(p+1)-1},this.readExpGolomb=function(){var p=this.readUnsignedExpGolomb();return 1&p?1+p>>>1:-1*(p>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Ff=_u,yu=t,Uf=Ff,Ur,jr,Tu;jr=function(){var o=0,l,h;jr.prototype.init.call(this),this.push=function(d){var p;h?(p=new Uint8Array(h.byteLength+d.data.byteLength),p.set(h),p.set(d.data,h.byteLength),h=p):h=d.data;for(var m=h.byteLength;o<m-3;o++)if(h[o+2]===1){l=o+5;break}for(;l<m;)switch(h[l]){case 0:if(h[l-1]!==0){l+=2;break}else if(h[l-2]!==0){l++;break}o+3!==l-2&&this.trigger("data",h.subarray(o+3,l-2));do l++;while(h[l]!==1&&l<m);o=l-2,l+=3;break;case 1:if(h[l-1]!==0||h[l-2]!==0){l+=3;break}this.trigger("data",h.subarray(o+3,l-2)),o=l-2,l+=3;break;default:l+=3;break}h=h.subarray(o),l-=o,o=0},this.reset=function(){h=null,o=0,this.trigger("reset")},this.flush=function(){h&&h.byteLength>3&&this.trigger("data",h.subarray(o+3)),h=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},jr.prototype=new yu,Tu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Ur=function(){var o=new jr,l,h,d,p,m,x,C;Ur.prototype.init.call(this),l=this,this.push=function(w){w.type==="video"&&(h=w.trackId,d=w.pts,p=w.dts,o.push(w))},o.on("data",function(w){var k={trackId:h,pts:d,dts:p,data:w,nalUnitTypeCode:w[0]&31};switch(k.nalUnitTypeCode){case 5:k.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:k.nalUnitType="sei_rbsp",k.escapedRBSP=m(w.subarray(1));break;case 7:k.nalUnitType="seq_parameter_set_rbsp",k.escapedRBSP=m(w.subarray(1)),k.config=x(k.escapedRBSP);break;case 8:k.nalUnitType="pic_parameter_set_rbsp";break;case 9:k.nalUnitType="access_unit_delimiter_rbsp";break}l.trigger("data",k)}),o.on("done",function(){l.trigger("done")}),o.on("partialdone",function(){l.trigger("partialdone")}),o.on("reset",function(){l.trigger("reset")}),o.on("endedtimeline",function(){l.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},C=function(w,k){var B=8,W=8,ae,Y;for(ae=0;ae<w;ae++)W!==0&&(Y=k.readExpGolomb(),W=(B+Y+256)%256),B=W===0?B:W},m=function(w){for(var k=w.byteLength,B=[],W=1,ae,Y;W<k-2;)w[W]===0&&w[W+1]===0&&w[W+2]===3?(B.push(W+2),W+=2):W++;if(B.length===0)return w;ae=k-B.length,Y=new Uint8Array(ae);var le=0;for(W=0;W<ae;le++,W++)le===B[0]&&(le++,B.shift()),Y[W]=w[le];return Y},x=function(w){var k=0,B=0,W=0,ae=0,Y,le,_e,We,yt,_i,Gs,Ws,Xs,Ks,Jr,Le=[1,1],Ys,Mt;if(Y=new Uf(w),le=Y.readUnsignedByte(),We=Y.readUnsignedByte(),_e=Y.readUnsignedByte(),Y.skipUnsignedExpGolomb(),Tu[le]&&(yt=Y.readUnsignedExpGolomb(),yt===3&&Y.skipBits(1),Y.skipUnsignedExpGolomb(),Y.skipUnsignedExpGolomb(),Y.skipBits(1),Y.readBoolean()))for(Jr=yt!==3?8:12,Mt=0;Mt<Jr;Mt++)Y.readBoolean()&&(Mt<6?C(16,Y):C(64,Y));if(Y.skipUnsignedExpGolomb(),_i=Y.readUnsignedExpGolomb(),_i===0)Y.readUnsignedExpGolomb();else if(_i===1)for(Y.skipBits(1),Y.skipExpGolomb(),Y.skipExpGolomb(),Gs=Y.readUnsignedExpGolomb(),Mt=0;Mt<Gs;Mt++)Y.skipExpGolomb();if(Y.skipUnsignedExpGolomb(),Y.skipBits(1),Ws=Y.readUnsignedExpGolomb(),Xs=Y.readUnsignedExpGolomb(),Ks=Y.readBits(1),Ks===0&&Y.skipBits(1),Y.skipBits(1),Y.readBoolean()&&(k=Y.readUnsignedExpGolomb(),B=Y.readUnsignedExpGolomb(),W=Y.readUnsignedExpGolomb(),ae=Y.readUnsignedExpGolomb()),Y.readBoolean()&&Y.readBoolean()){switch(Ys=Y.readUnsignedByte(),Ys){case 1:Le=[1,1];break;case 2:Le=[12,11];break;case 3:Le=[10,11];break;case 4:Le=[16,11];break;case 5:Le=[40,33];break;case 6:Le=[24,11];break;case 7:Le=[20,11];break;case 8:Le=[32,11];break;case 9:Le=[80,33];break;case 10:Le=[18,11];break;case 11:Le=[15,11];break;case 12:Le=[64,33];break;case 13:Le=[160,99];break;case 14:Le=[4,3];break;case 15:Le=[3,2];break;case 16:Le=[2,1];break;case 255:{Le=[Y.readUnsignedByte()<<8|Y.readUnsignedByte(),Y.readUnsignedByte()<<8|Y.readUnsignedByte()];break}}Le&&Le[0]/Le[1]}return{profileIdc:le,levelIdc:_e,profileCompatibility:We,width:(Ws+1)*16-k*2-B*2,height:(2-Ks)*(Xs+1)*16-W*2-ae*2,sarRatio:Le}}},Ur.prototype=new yu;var jf={H264Stream:Ur},qf=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],vu=function(o,l){var h=o[l+6]<<21|o[l+7]<<14|o[l+8]<<7|o[l+9],d=o[l+5],p=(d&16)>>4;return h=h>=0?h:0,p?h+20:h+10},bu=function(o,l){return o.length-l<10||o[l]!==73||o[l+1]!==68||o[l+2]!==51?l:(l+=vu(o,l),bu(o,l))},$f=function(o){var l=bu(o,0);return o.length>=l+2&&(o[l]&255)===255&&(o[l+1]&240)===240&&(o[l+1]&22)===16},xu=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Vf=function(o,l,h){var d,p="";for(d=l;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},Hf=function(o,l,h){return unescape(Vf(o,l,h))},zf=function(o,l){var h=(o[l+5]&224)>>5,d=o[l+4]<<3,p=o[l+3]&6144;return p|d|h},Gf=function(o,l){return o[l]===73&&o[l+1]===68&&o[l+2]===51?"timed-metadata":o[l]&!0&&(o[l+1]&240)===240?"audio":null},Wf=function(o){for(var l=0;l+5<o.length;){if(o[l]!==255||(o[l+1]&246)!==240){l++;continue}return qf[(o[l+2]&60)>>>2]}return null},Xf=function(o){var l,h,d,p;l=10,o[5]&64&&(l+=4,l+=xu(o.subarray(10,14)));do{if(h=xu(o.subarray(l+4,l+8)),h<1)return null;if(p=String.fromCharCode(o[l],o[l+1],o[l+2],o[l+3]),p==="PRIV"){d=o.subarray(l+10,l+h+10);for(var m=0;m<d.byteLength;m++)if(d[m]===0){var x=Hf(d,0,m);if(x==="com.apple.streaming.transportStreamTimestamp"){var C=d.subarray(m+1),w=(C[3]&1)<<30|C[4]<<22|C[5]<<14|C[6]<<6|C[7]>>>2;return w*=4,w+=C[7]&3,w}break}}l+=10,l+=h}while(l<o.byteLength);return null},aa={isLikelyAacData:$f,parseId3TagSize:vu,parseAdtsSize:zf,parseType:Gf,parseSampleRate:Wf,parseAacTimestamp:Xf},Kf=t,Su=aa,qr;qr=function(){var o=new Uint8Array,l=0;qr.prototype.init.call(this),this.setTimestamp=function(h){l=h},this.push=function(h){var d=0,p=0,m,x,C,w;for(o.length?(w=o.length,o=new Uint8Array(h.byteLength+w),o.set(o.subarray(0,w)),o.set(h,w)):o=h;o.length-p>=3;){if(o[p]===73&&o[p+1]===68&&o[p+2]===51){if(o.length-p<10||(d=Su.parseId3TagSize(o,p),p+d>o.length))break;x={type:"timed-metadata",data:o.subarray(p,p+d)},this.trigger("data",x),p+=d;continue}else if((o[p]&255)===255&&(o[p+1]&240)===240){if(o.length-p<7||(d=Su.parseAdtsSize(o,p),p+d>o.length))break;C={type:"audio",data:o.subarray(p,p+d),pts:l,dts:l},this.trigger("data",C),p+=d;continue}p++}m=o.length-p,m>0?o=o.subarray(p):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},qr.prototype=new Kf;var Yf=qr,Qf=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Jf=Qf,Zf=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],ep=Zf,$r=t,js=et,qs=Xi,Vr=Rs,Nt=H,ii=Rf,Hr=Se,Eu=Bf,tp=jf.H264Stream,ip=Yf,sp=aa.isLikelyAacData,rp=Se.ONE_SECOND_IN_TS,Cu=Jf,wu=ep,zr,$s,Gr,Oi,np=function(o,l){l.stream=o,this.trigger("log",l)},Au=function(o,l){for(var h=Object.keys(l),d=0;d<h.length;d++){var p=h[d];p==="headOfPipeline"||!l[p].on||l[p].on("log",np.bind(o,p))}},Du=function(o,l){var h;if(o.length!==l.length)return!1;for(h=0;h<o.length;h++)if(o[h]!==l[h])return!1;return!0},ku=function(o,l,h,d,p,m){var x=h-l,C=d-l,w=p-h;return{start:{dts:o,pts:o+x},end:{dts:o+C,pts:o+w},prependedContentDuration:m,baseMediaDecodeTime:o}};$s=function(o,l){var h=[],d,p=0,m=0,x=1/0;l=l||{},d=l.firstSequenceNumber||0,$s.prototype.init.call(this),this.push=function(C){Nt.collectDtsInfo(o,C),o&&Cu.forEach(function(w){o[w]=C[w]}),h.push(C)},this.setEarliestDts=function(C){p=C},this.setVideoBaseMediaDecodeTime=function(C){x=C},this.setAudioAppendStart=function(C){m=C},this.flush=function(){var C,w,k,B,W,ae,Y;if(h.length===0){this.trigger("done","AudioSegmentStream");return}C=Vr.trimAdtsFramesByEarliestDts(h,o,p),o.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(o,l.keepOriginalTimestamps),Y=Vr.prefixWithSilence(o,C,m,x),o.samples=Vr.generateSampleTable(C),k=js.mdat(Vr.concatenateFrameData(C)),h=[],w=js.moof(d,[o]),B=new Uint8Array(w.byteLength+k.byteLength),d++,B.set(w),B.set(k,w.byteLength),Nt.clearDtsInfo(o),W=Math.ceil(rp*1024/o.samplerate),C.length&&(ae=C.length*W,this.trigger("segmentTimingInfo",ku(Hr.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),C[0].dts,C[0].pts,C[0].dts+ae,C[0].pts+ae,Y||0)),this.trigger("timingInfo",{start:C[0].pts,end:C[0].pts+ae})),this.trigger("data",{track:o,boxes:B}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Nt.clearDtsInfo(o),h=[],this.trigger("reset")}},$s.prototype=new $r,zr=function(o,l){var h,d=[],p=[],m,x;l=l||{},h=l.firstSequenceNumber||0,zr.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(C){Nt.collectDtsInfo(o,C),C.nalUnitType==="seq_parameter_set_rbsp"&&!m&&(m=C.config,o.sps=[C.data],wu.forEach(function(w){o[w]=m[w]},this)),C.nalUnitType==="pic_parameter_set_rbsp"&&!x&&(x=C.data,o.pps=[C.data]),d.push(C)},this.flush=function(){for(var C,w,k,B,W,ae,Y=0,le,_e;d.length&&d[0].nalUnitType!=="access_unit_delimiter_rbsp";)d.shift();if(d.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(C=qs.groupNalsIntoFrames(d),k=qs.groupFramesIntoGops(C),k[0][0].keyFrame||(w=this.getGopForFusion_(d[0],o),w?(Y=w.duration,k.unshift(w),k.byteLength+=w.byteLength,k.nalCount+=w.nalCount,k.pts=w.pts,k.dts=w.dts,k.duration+=w.duration):k=qs.extendFirstKeyFrame(k)),p.length){var We;if(l.alignGopsAtEnd?We=this.alignGopsAtEnd_(k):We=this.alignGopsAtStart_(k),!We){this.gopCache_.unshift({gop:k.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),d=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Nt.clearDtsInfo(o),k=We}Nt.collectDtsInfo(o,k),o.samples=qs.generateSampleTable(k),W=js.mdat(qs.concatenateNalData(k)),o.baseMediaDecodeTime=Nt.calculateTrackBaseMediaDecodeTime(o,l.keepOriginalTimestamps),this.trigger("processedGopsInfo",k.map(function(yt){return{pts:yt.pts,dts:yt.dts,byteLength:yt.byteLength}})),le=k[0],_e=k[k.length-1],this.trigger("segmentTimingInfo",ku(o.baseMediaDecodeTime,le.dts,le.pts,_e.dts+_e.duration,_e.pts+_e.duration,Y)),this.trigger("timingInfo",{start:k[0].pts,end:k[k.length-1].pts+k[k.length-1].duration}),this.gopCache_.unshift({gop:k.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),d=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),B=js.moof(h,[o]),ae=new Uint8Array(B.byteLength+W.byteLength),h++,ae.set(B),ae.set(W,B.byteLength),this.trigger("data",{track:o,boxes:ae}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),d=[],this.gopCache_.length=0,p.length=0,this.trigger("reset")},this.resetStream_=function(){Nt.clearDtsInfo(o),m=void 0,x=void 0},this.getGopForFusion_=function(C){var w=45e3,k=1/0,B,W,ae,Y,le;for(le=0;le<this.gopCache_.length;le++)Y=this.gopCache_[le],ae=Y.gop,!(!(o.pps&&Du(o.pps[0],Y.pps[0]))||!(o.sps&&Du(o.sps[0],Y.sps[0])))&&(ae.dts<o.timelineStartInfo.dts||(B=C.dts-ae.dts-ae.duration,B>=-1e4&&B<=w&&(!W||k>B)&&(W=Y,k=B)));return W?W.gop:null},this.alignGopsAtStart_=function(C){var w,k,B,W,ae,Y,le,_e;for(ae=C.byteLength,Y=C.nalCount,le=C.duration,w=k=0;w<p.length&&k<C.length&&(B=p[w],W=C[k],B.pts!==W.pts);){if(W.pts>B.pts){w++;continue}k++,ae-=W.byteLength,Y-=W.nalCount,le-=W.duration}return k===0?C:k===C.length?null:(_e=C.slice(k),_e.byteLength=ae,_e.duration=le,_e.nalCount=Y,_e.pts=_e[0].pts,_e.dts=_e[0].dts,_e)},this.alignGopsAtEnd_=function(C){var w,k,B,W,ae,Y;for(w=p.length-1,k=C.length-1,ae=null,Y=!1;w>=0&&k>=0;){if(B=p[w],W=C[k],B.pts===W.pts){Y=!0;break}if(B.pts>W.pts){w--;continue}w===p.length-1&&(ae=k),k--}if(!Y&&ae===null)return null;var le;if(Y?le=k:le=ae,le===0)return C;var _e=C.slice(le),We=_e.reduce(function(yt,_i){return yt.byteLength+=_i.byteLength,yt.duration+=_i.duration,yt.nalCount+=_i.nalCount,yt},{byteLength:0,duration:0,nalCount:0});return _e.byteLength=We.byteLength,_e.duration=We.duration,_e.nalCount=We.nalCount,_e.pts=_e[0].pts,_e.dts=_e[0].dts,_e},this.alignGopsWith=function(C){p=C}},zr.prototype=new $r,Oi=function(o,l){this.numberOfTracks=0,this.metadataStream=l,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Oi.prototype.init.call(this),this.push=function(h){if(h.content||h.text)return this.pendingCaptions.push(h);if(h.frames)return this.pendingMetadata.push(h);this.pendingTracks.push(h.track),this.pendingBytes+=h.boxes.byteLength,h.track.type==="video"&&(this.videoTrack=h.track,this.pendingBoxes.push(h.boxes)),h.track.type==="audio"&&(this.audioTrack=h.track,this.pendingBoxes.unshift(h.boxes))}},Oi.prototype=new $r,Oi.prototype.flush=function(o){var l=0,h={captions:[],captionStreams:{},metadata:[],info:{}},d,p,m,x=0,C;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(x=this.videoTrack.timelineStartInfo.pts,wu.forEach(function(w){h.info[w]=this.videoTrack[w]},this)):this.audioTrack&&(x=this.audioTrack.timelineStartInfo.pts,Cu.forEach(function(w){h.info[w]=this.audioTrack[w]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,m=js.initSegment(this.pendingTracks),h.initSegment=new Uint8Array(m.byteLength),h.initSegment.set(m),h.data=new Uint8Array(this.pendingBytes),C=0;C<this.pendingBoxes.length;C++)h.data.set(this.pendingBoxes[C],l),l+=this.pendingBoxes[C].byteLength;for(C=0;C<this.pendingCaptions.length;C++)d=this.pendingCaptions[C],d.startTime=Hr.metadataTsToSeconds(d.startPts,x,this.keepOriginalTimestamps),d.endTime=Hr.metadataTsToSeconds(d.endPts,x,this.keepOriginalTimestamps),h.captionStreams[d.stream]=!0,h.captions.push(d);for(C=0;C<this.pendingMetadata.length;C++)p=this.pendingMetadata[C],p.cueTime=Hr.metadataTsToSeconds(p.pts,x,this.keepOriginalTimestamps),h.metadata.push(p);for(h.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",h),C=0;C<h.captions.length;C++)d=h.captions[C],this.trigger("caption",d);for(C=0;C<h.metadata.length;C++)p=h.metadata[C],this.trigger("id3Frame",p)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Oi.prototype.setRemux=function(o){this.remuxTracks=o},Gr=function(o){var l=this,h=!0,d,p;Gr.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="aac",m.metadataStream=new ii.MetadataStream,m.aacStream=new ip,m.audioTimestampRolloverStream=new ii.TimestampRolloverStream("audio"),m.timedMetadataTimestampRolloverStream=new ii.TimestampRolloverStream("timed-metadata"),m.adtsStream=new Eu,m.coalesceStream=new Oi(o,m.metadataStream),m.headOfPipeline=m.aacStream,m.aacStream.pipe(m.audioTimestampRolloverStream).pipe(m.adtsStream),m.aacStream.pipe(m.timedMetadataTimestampRolloverStream).pipe(m.metadataStream).pipe(m.coalesceStream),m.metadataStream.on("timestamp",function(x){m.aacStream.setTimestamp(x.timeStamp)}),m.aacStream.on("data",function(x){x.type!=="timed-metadata"&&x.type!=="audio"||m.audioSegmentStream||(p=p||{timelineStartInfo:{baseMediaDecodeTime:l.baseMediaDecodeTime},codec:"adts",type:"audio"},m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new $s(p,o),m.audioSegmentStream.on("log",l.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",l.trigger.bind(l,"audioTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream),l.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d}))}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),Au(this,m)},this.setupTsPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="ts",m.metadataStream=new ii.MetadataStream,m.packetStream=new ii.TransportPacketStream,m.parseStream=new ii.TransportParseStream,m.elementaryStream=new ii.ElementaryStream,m.timestampRolloverStream=new ii.TimestampRolloverStream,m.adtsStream=new Eu,m.h264Stream=new tp,m.captionStream=new ii.CaptionStream(o),m.coalesceStream=new Oi(o,m.metadataStream),m.headOfPipeline=m.packetStream,m.packetStream.pipe(m.parseStream).pipe(m.elementaryStream).pipe(m.timestampRolloverStream),m.timestampRolloverStream.pipe(m.h264Stream),m.timestampRolloverStream.pipe(m.adtsStream),m.timestampRolloverStream.pipe(m.metadataStream).pipe(m.coalesceStream),m.h264Stream.pipe(m.captionStream).pipe(m.coalesceStream),m.elementaryStream.on("data",function(x){var C;if(x.type==="metadata"){for(C=x.tracks.length;C--;)!d&&x.tracks[C].type==="video"?(d=x.tracks[C],d.timelineStartInfo.baseMediaDecodeTime=l.baseMediaDecodeTime):!p&&x.tracks[C].type==="audio"&&(p=x.tracks[C],p.timelineStartInfo.baseMediaDecodeTime=l.baseMediaDecodeTime);d&&!m.videoSegmentStream&&(m.coalesceStream.numberOfTracks++,m.videoSegmentStream=new zr(d,o),m.videoSegmentStream.on("log",l.getLogTrigger_("videoSegmentStream")),m.videoSegmentStream.on("timelineStartInfo",function(w){p&&!o.keepOriginalTimestamps&&(p.timelineStartInfo=w,m.audioSegmentStream.setEarliestDts(w.dts-l.baseMediaDecodeTime))}),m.videoSegmentStream.on("processedGopsInfo",l.trigger.bind(l,"gopInfo")),m.videoSegmentStream.on("segmentTimingInfo",l.trigger.bind(l,"videoSegmentTimingInfo")),m.videoSegmentStream.on("baseMediaDecodeTime",function(w){p&&m.audioSegmentStream.setVideoBaseMediaDecodeTime(w)}),m.videoSegmentStream.on("timingInfo",l.trigger.bind(l,"videoTimingInfo")),m.h264Stream.pipe(m.videoSegmentStream).pipe(m.coalesceStream)),p&&!m.audioSegmentStream&&(m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new $s(p,o),m.audioSegmentStream.on("log",l.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",l.trigger.bind(l,"audioTimingInfo")),m.audioSegmentStream.on("segmentTimingInfo",l.trigger.bind(l,"audioSegmentTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream)),l.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d})}}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("id3Frame",function(x){x.dispatchType=m.metadataStream.dispatchType,l.trigger("id3Frame",x)}),m.coalesceStream.on("caption",this.trigger.bind(this,"caption")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),Au(this,m)},this.setBaseMediaDecodeTime=function(m){var x=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=m),p&&(p.timelineStartInfo.dts=void 0,p.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(p),x.audioTimestampRolloverStream&&x.audioTimestampRolloverStream.discontinuity()),d&&(x.videoSegmentStream&&(x.videoSegmentStream.gopCache_=[]),d.timelineStartInfo.dts=void 0,d.timelineStartInfo.pts=void 0,Nt.clearDtsInfo(d),x.captionStream.reset()),x.timestampRolloverStream&&x.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(m){p&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(m)},this.setRemux=function(m){var x=this.transmuxPipeline_;o.remux=m,x&&x.coalesceStream&&x.coalesceStream.setRemux(m)},this.alignGopsWith=function(m){d&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(m)},this.getLogTrigger_=function(m){var x=this;return function(C){C.stream=m,x.trigger("log",C)}},this.push=function(m){if(h){var x=sp(m);x&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!x&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),h=!1}this.transmuxPipeline_.headOfPipeline.push(m)},this.flush=function(){h=!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()}},Gr.prototype=new $r;var ap={Transmuxer:Gr},op=function(o){return o>>>0},up=function(o){return("00"+o.toString(16)).slice(-2)},Wr={toUnsigned:op,toHexString:up},lp=function(o){var l="";return l+=String.fromCharCode(o[0]),l+=String.fromCharCode(o[1]),l+=String.fromCharCode(o[2]),l+=String.fromCharCode(o[3]),l},Iu=lp,cp=Wr.toUnsigned,dp=Iu,Pu=function(o,l){var h=[],d,p,m,x,C;if(!l.length)return null;for(d=0;d<o.byteLength;)p=cp(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3]),m=dp(o.subarray(d+4,d+8)),x=p>1?d+p:o.byteLength,m===l[0]&&(l.length===1?h.push(o.subarray(d+8,x)):(C=Pu(o.subarray(d+8,x),l.slice(1)),C.length&&(h=h.concat(C)))),d=x;return h},oa=Pu,hp=Wr.toUnsigned,fp=n.getUint64,pp=function(o){var l={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return l.version===1?l.baseMediaDecodeTime=fp(o.subarray(4)):l.baseMediaDecodeTime=hp(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),l},ua=pp,mp=function(o){var l=new DataView(o.buffer,o.byteOffset,o.byteLength),h={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:l.getUint32(4)},d=h.flags[2]&1,p=h.flags[2]&2,m=h.flags[2]&8,x=h.flags[2]&16,C=h.flags[2]&32,w=h.flags[0]&65536,k=h.flags[0]&131072,B;return B=8,d&&(B+=4,h.baseDataOffset=l.getUint32(12),B+=4),p&&(h.sampleDescriptionIndex=l.getUint32(B),B+=4),m&&(h.defaultSampleDuration=l.getUint32(B),B+=4),x&&(h.defaultSampleSize=l.getUint32(B),B+=4),C&&(h.defaultSampleFlags=l.getUint32(B)),w&&(h.durationIsEmpty=!0),!d&&k&&(h.baseDataOffsetIsMoof=!0),h},Lu=mp,gp=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},_p=gp,Ou=_p,yp=function(o){var l={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},h=new DataView(o.buffer,o.byteOffset,o.byteLength),d=l.flags[2]&1,p=l.flags[2]&4,m=l.flags[1]&1,x=l.flags[1]&2,C=l.flags[1]&4,w=l.flags[1]&8,k=h.getUint32(4),B=8,W;for(d&&(l.dataOffset=h.getInt32(B),B+=4),p&&k&&(W={flags:Ou(o.subarray(B,B+4))},B+=4,m&&(W.duration=h.getUint32(B),B+=4),x&&(W.size=h.getUint32(B),B+=4),w&&(l.version===1?W.compositionTimeOffset=h.getInt32(B):W.compositionTimeOffset=h.getUint32(B),B+=4),l.samples.push(W),k--);k--;)W={},m&&(W.duration=h.getUint32(B),B+=4),x&&(W.size=h.getUint32(B),B+=4),C&&(W.flags=Ou(o.subarray(B,B+4)),B+=4),w&&(l.version===1?W.compositionTimeOffset=h.getInt32(B):W.compositionTimeOffset=h.getUint32(B),B+=4),l.samples.push(W);return l},Ru=yp,Nu={tfdt:ua,trun:Ru},Mu={parseTfdt:Nu.tfdt,parseTrun:Nu.trun},Tp=function(o){for(var l=0,h=String.fromCharCode(o[l]),d="";h!=="\0";)d+=h,l++,h=String.fromCharCode(o[l]);return d+=h,d},vp={uint8ToCString:Tp},Xr=vp.uint8ToCString,bp=n.getUint64,xp=function(o){var l=4,h=o[0],d,p,m,x,C,w,k,B;if(h===0){d=Xr(o.subarray(l)),l+=d.length,p=Xr(o.subarray(l)),l+=p.length;var W=new DataView(o.buffer);m=W.getUint32(l),l+=4,C=W.getUint32(l),l+=4,w=W.getUint32(l),l+=4,k=W.getUint32(l),l+=4}else if(h===1){var W=new DataView(o.buffer);m=W.getUint32(l),l+=4,x=bp(o.subarray(l)),l+=8,w=W.getUint32(l),l+=4,k=W.getUint32(l),l+=4,d=Xr(o.subarray(l)),l+=d.length,p=Xr(o.subarray(l)),l+=p.length}B=new Uint8Array(o.subarray(l,o.byteLength));var ae={scheme_id_uri:d,value:p,timescale:m||1,presentation_time:x,presentation_time_delta:C,event_duration:w,id:k,message_data:B};return Ep(h,ae)?ae:void 0},Sp=function(o,l,h,d){return o||o===0?o/l:d+h/l},Ep=function(o,l){var h=l.scheme_id_uri!=="\0",d=o===0&&Bu(l.presentation_time_delta)&&h,p=o===1&&Bu(l.presentation_time)&&h;return!(o>1)&&d||p},Bu=function(o){return o!==void 0||o!==null},Cp={parseEmsgBox:xp,scaleTime:Sp},Vs;typeof window<"u"?Vs=window:typeof s<"u"?Vs=s:typeof self<"u"?Vs=self:Vs={};var Fu=Vs,Kr=Wr.toUnsigned,Hs=Wr.toHexString,qe=oa,Qi=Iu,la=Cp,wp=Lu,Ap=Ru,Dp=ua,kp=n.getUint64,Uu,ju,qu,$u,Vu,ca,Hu,da=Fu,Ip=pu.parseId3Frames;Uu=function(o){var l={},h=qe(o,["moov","trak"]);return h.reduce(function(d,p){var m,x,C,w,k;return m=qe(p,["tkhd"])[0],!m||(x=m[0],C=x===0?12:20,w=Kr(m[C]<<24|m[C+1]<<16|m[C+2]<<8|m[C+3]),k=qe(p,["mdia","mdhd"])[0],!k)?null:(x=k[0],C=x===0?12:20,d[w]=Kr(k[C]<<24|k[C+1]<<16|k[C+2]<<8|k[C+3]),d)},l)},ju=function(o,l){var h;h=qe(l,["moof","traf"]);var d=h.reduce(function(p,m){var x=qe(m,["tfhd"])[0],C=Kr(x[4]<<24|x[5]<<16|x[6]<<8|x[7]),w=o[C]||9e4,k=qe(m,["tfdt"])[0],B=new DataView(k.buffer,k.byteOffset,k.byteLength),W;k[0]===1?W=kp(k.subarray(4,12)):W=B.getUint32(4);let ae;return typeof W=="bigint"?ae=W/da.BigInt(w):typeof W=="number"&&!isNaN(W)&&(ae=W/w),ae<Number.MAX_SAFE_INTEGER&&(ae=Number(ae)),ae<p&&(p=ae),p},1/0);return typeof d=="bigint"||isFinite(d)?d:0},qu=function(o,l){var h=qe(l,["moof","traf"]),d=0,p=0,m;if(h&&h.length){var x=qe(h[0],["tfhd"])[0],C=qe(h[0],["trun"])[0],w=qe(h[0],["tfdt"])[0];if(x){var k=wp(x);m=k.trackId}if(w){var B=Dp(w);d=B.baseMediaDecodeTime}if(C){var W=Ap(C);W.samples&&W.samples.length&&(p=W.samples[0].compositionTimeOffset||0)}}var ae=o[m]||9e4;typeof d=="bigint"&&(p=da.BigInt(p),ae=da.BigInt(ae));var Y=(d+p)/ae;return typeof Y=="bigint"&&Y<Number.MAX_SAFE_INTEGER&&(Y=Number(Y)),Y},$u=function(o){var l=qe(o,["moov","trak"]),h=[];return l.forEach(function(d){var p=qe(d,["mdia","hdlr"]),m=qe(d,["tkhd"]);p.forEach(function(x,C){var w=Qi(x.subarray(8,12)),k=m[C],B,W,ae;w==="vide"&&(B=new DataView(k.buffer,k.byteOffset,k.byteLength),W=B.getUint8(0),ae=W===0?B.getUint32(12):B.getUint32(20),h.push(ae))})}),h},ca=function(o){var l=o[0],h=l===0?12:20;return Kr(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3])},Vu=function(o){var l=qe(o,["moov","trak"]),h=[];return l.forEach(function(d){var p={},m=qe(d,["tkhd"])[0],x,C;m&&(x=new DataView(m.buffer,m.byteOffset,m.byteLength),C=x.getUint8(0),p.id=C===0?x.getUint32(12):x.getUint32(20));var w=qe(d,["mdia","hdlr"])[0];if(w){var k=Qi(w.subarray(8,12));k==="vide"?p.type="video":k==="soun"?p.type="audio":p.type=k}var B=qe(d,["mdia","minf","stbl","stsd"])[0];if(B){var W=B.subarray(8);p.codec=Qi(W.subarray(4,8));var ae=qe(W,[p.codec])[0],Y,le;ae&&(/^[asm]vc[1-9]$/i.test(p.codec)?(Y=ae.subarray(78),le=Qi(Y.subarray(4,8)),le==="avcC"&&Y.length>11?(p.codec+=".",p.codec+=Hs(Y[9]),p.codec+=Hs(Y[10]),p.codec+=Hs(Y[11])):p.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(p.codec)?(Y=ae.subarray(28),le=Qi(Y.subarray(4,8)),le==="esds"&&Y.length>20&&Y[19]!==0?(p.codec+="."+Hs(Y[19]),p.codec+="."+Hs(Y[20]>>>2&63).replace(/^0/,"")):p.codec="mp4a.40.2"):p.codec=p.codec.toLowerCase())}var _e=qe(d,["mdia","mdhd"])[0];_e&&(p.timescale=ca(_e)),h.push(p)}),h},Hu=function(o,l=0){var h=qe(o,["emsg"]);return h.map(d=>{var p=la.parseEmsgBox(new Uint8Array(d)),m=Ip(p.message_data);return{cueTime:la.scaleTime(p.presentation_time,p.timescale,p.presentation_time_delta,l),duration:la.scaleTime(p.event_duration,p.timescale),frames:m}})};var zs={findBox:qe,parseType:Qi,timescale:Uu,startTime:ju,compositionStartTime:qu,videoTrackIds:$u,tracks:Vu,getTimescaleFromMediaHeader:ca,getEmsgID3:Hu};const{parseTrun:Pp}=Mu,{findBox:zu}=zs;var Gu=Fu,Lp=function(o){var l=zu(o,["moof","traf"]),h=zu(o,["mdat"]),d=[];return h.forEach(function(p,m){var x=l[m];d.push({mdat:p,traf:x})}),d},Op=function(o,l,h){var d=l,p=h.defaultSampleDuration||0,m=h.defaultSampleSize||0,x=h.trackId,C=[];return o.forEach(function(w){var k=Pp(w),B=k.samples;B.forEach(function(W){W.duration===void 0&&(W.duration=p),W.size===void 0&&(W.size=m),W.trackId=x,W.dts=d,W.compositionTimeOffset===void 0&&(W.compositionTimeOffset=0),typeof d=="bigint"?(W.pts=d+Gu.BigInt(W.compositionTimeOffset),d+=Gu.BigInt(W.duration)):(W.pts=d+W.compositionTimeOffset,d+=W.duration)}),C=C.concat(B)}),C},Wu={getMdatTrafPairs:Lp,parseSamples:Op},Rp=Ct.discardEmulationPreventionBytes,Np=cu.CaptionStream,ha=oa,Mp=ua,Bp=Lu,{getMdatTrafPairs:Fp,parseSamples:Up}=Wu,jp=function(o,l){for(var h=o,d=0;d<l.length;d++){var p=l[d];if(h<p.size)return p;h-=p.size}return null},qp=function(o,l,h){var d=new DataView(o.buffer,o.byteOffset,o.byteLength),p={logs:[],seiNals:[]},m,x,C,w;for(x=0;x+4<o.length;x+=C)if(C=d.getUint32(x),x+=4,!(C<=0))switch(o[x]&31){case 6:var k=o.subarray(x+1,x+1+C),B=jp(x,l);if(m={nalUnitType:"sei_rbsp",size:C,data:k,escapedRBSP:Rp(k),trackId:h},B)m.pts=B.pts,m.dts=B.dts,w=B;else if(w)m.pts=w.pts,m.dts=w.dts;else{p.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+x+" for trackId "+h+". See mux.js#223."});break}p.seiNals.push(m);break}return p},$p=function(o,l){var h={},d=Fp(o);return d.forEach(function(p){var m=p.mdat,x=p.traf,C=ha(x,["tfhd"]),w=Bp(C[0]),k=w.trackId,B=ha(x,["tfdt"]),W=B.length>0?Mp(B[0]).baseMediaDecodeTime:0,ae=ha(x,["trun"]),Y,le;l===k&&ae.length>0&&(Y=Up(ae,W,w),le=qp(m,Y,k),h[k]||(h[k]={seiNals:[],logs:[]}),h[k].seiNals=h[k].seiNals.concat(le.seiNals),h[k].logs=h[k].logs.concat(le.logs))}),h},Vp=function(o,l,h){var d;if(l===null)return null;d=$p(o,l);var p=d[l]||{};return{seiNals:p.seiNals,logs:p.logs,timescale:h}},Hp=function(){var o=!1,l,h,d,p,m,x;this.isInitialized=function(){return o},this.init=function(C){l=new Np,o=!0,x=C?C.isPartial:!1,l.on("data",function(w){w.startTime=w.startPts/p,w.endTime=w.endPts/p,m.captions.push(w),m.captionStreams[w.stream]=!0}),l.on("log",function(w){m.logs.push(w)})},this.isNewInit=function(C,w){return C&&C.length===0||w&&typeof w=="object"&&Object.keys(w).length===0?!1:d!==C[0]||p!==w[d]},this.parse=function(C,w,k){var B;if(this.isInitialized()){if(!w||!k)return null;if(this.isNewInit(w,k))d=w[0],p=k[d];else if(d===null||!p)return h.push(C),null}else return null;for(;h.length>0;){var W=h.shift();this.parse(W,w,k)}return B=Vp(C,d,p),B&&B.logs&&(m.logs=m.logs.concat(B.logs)),B===null||!B.seiNals?m.logs.length?{logs:m.logs,captions:[],captionStreams:[]}:null:(this.pushNals(B.seiNals),this.flushStream(),m)},this.pushNals=function(C){if(!this.isInitialized()||!C||C.length===0)return null;C.forEach(function(w){l.push(w)})},this.flushStream=function(){if(!this.isInitialized())return null;x?l.partialFlush():l.flush()},this.clearParsedCaptions=function(){m.captions=[],m.captionStreams={},m.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;l.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){h=[],d=null,p=null,m?this.clearParsedCaptions():m={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},zp=Hp;const{parseTfdt:Gp}=Mu,gi=oa,{getTimescaleFromMediaHeader:Wp}=zs,{parseSamples:Xp,getMdatTrafPairs:Kp}=Wu;var Xu=function(){let o=9e4;this.init=function(l){const h=gi(l,["moov","trak","mdia","mdhd"])[0];h&&(o=Wp(h))},this.parseSegment=function(l){const h=[],d=Kp(l);let p=0;return d.forEach(function(m){const x=m.mdat,C=m.traf,w=gi(C,["tfdt"])[0],k=gi(C,["tfhd"])[0],B=gi(C,["trun"]);if(w&&(p=Gp(w).baseMediaDecodeTime),B.length&&k){const W=Xp(B,p,k);let ae=0;W.forEach(function(Y){const le="utf-8",_e=new TextDecoder(le),We=x.slice(ae,ae+Y.size);if(gi(We,["vtte"])[0]){ae+=Y.size;return}gi(We,["vttc"]).forEach(function(Gs){const Ws=gi(Gs,["payl"])[0],Xs=gi(Gs,["sttg"])[0],Ks=Y.pts/o,Jr=(Y.pts+Y.duration)/o;let Le,Ys;if(Ws)try{Le=_e.decode(Ws)}catch(Mt){console.error(Mt)}if(Xs)try{Ys=_e.decode(Xs)}catch(Mt){console.error(Mt)}Y.duration&&Le&&h.push({cueText:Le,start:Ks,end:Jr,settings:Ys})}),ae+=Y.size})}}),h}},fa=Lr,Ku=function(o){var l=o[1]&31;return l<<=8,l|=o[2],l},Yr=function(o){return!!(o[1]&64)},Qr=function(o){var l=0;return(o[3]&48)>>>4>1&&(l+=o[4]+1),l},Yp=function(o,l){var h=Ku(o);return h===0?"pat":h===l?"pmt":l?"pes":null},Qp=function(o){var l=Yr(o),h=4+Qr(o);return l&&(h+=o[h]+1),(o[h+10]&31)<<8|o[h+11]},Jp=function(o){var l={},h=Yr(o),d=4+Qr(o);if(h&&(d+=o[d]+1),!!(o[d+5]&1)){var p,m,x;p=(o[d+1]&15)<<8|o[d+2],m=3+p-4,x=(o[d+10]&15)<<8|o[d+11];for(var C=12+x;C<m;){var w=d+C;l[(o[w+1]&31)<<8|o[w+2]]=o[w],C+=((o[w+3]&15)<<8|o[w+4])+5}return l}},Zp=function(o,l){var h=Ku(o),d=l[h];switch(d){case fa.H264_STREAM_TYPE:return"video";case fa.ADTS_STREAM_TYPE:return"audio";case fa.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},em=function(o){var l=Yr(o);if(!l)return null;var h=4+Qr(o);if(h>=o.byteLength)return null;var d=null,p;return p=o[h+7],p&192&&(d={},d.pts=(o[h+9]&14)<<27|(o[h+10]&255)<<20|(o[h+11]&254)<<12|(o[h+12]&255)<<5|(o[h+13]&254)>>>3,d.pts*=4,d.pts+=(o[h+13]&6)>>>1,d.dts=d.pts,p&64&&(d.dts=(o[h+14]&14)<<27|(o[h+15]&255)<<20|(o[h+16]&254)<<12|(o[h+17]&255)<<5|(o[h+18]&254)>>>3,d.dts*=4,d.dts+=(o[h+18]&6)>>>1)),d},pa=function(o){switch(o){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}},tm=function(o){for(var l=4+Qr(o),h=o.subarray(l),d=0,p=0,m=!1,x;p<h.byteLength-3;p++)if(h[p+2]===1){d=p+5;break}for(;d<h.byteLength;)switch(h[d]){case 0:if(h[d-1]!==0){d+=2;break}else if(h[d-2]!==0){d++;break}p+3!==d-2&&(x=pa(h[p+3]&31),x==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0));do d++;while(h[d]!==1&&d<h.length);p=d-2,d+=3;break;case 1:if(h[d-1]!==0||h[d-2]!==0){d+=3;break}x=pa(h[p+3]&31),x==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0),p=d-2,d+=3;break;default:d+=3;break}return h=h.subarray(p),d-=p,p=0,h&&h.byteLength>3&&(x=pa(h[p+3]&31),x==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0)),m},im={parseType:Yp,parsePat:Qp,parsePmt:Jp,parsePayloadUnitStartIndicator:Yr,parsePesType:Zp,parsePesTime:em,videoPacketContainsKeyFrame:tm},Yu=Lr,Ji=hu.handleRollover,we={};we.ts=im,we.aac=aa;var Ri=Se.ONE_SECOND_IN_TS,ot=188,$t=71,sm=function(o,l){for(var h=0,d=ot,p,m;d<o.byteLength;){if(o[h]===$t&&o[d]===$t){switch(p=o.subarray(h,d),m=we.ts.parseType(p,l.pid),m){case"pat":l.pid=we.ts.parsePat(p);break;case"pmt":var x=we.ts.parsePmt(p);l.table=l.table||{},Object.keys(x).forEach(function(C){l.table[C]=x[C]});break}h+=ot,d+=ot;continue}h++,d++}},Qu=function(o,l,h){for(var d=0,p=ot,m,x,C,w,k,B=!1;p<=o.byteLength;){if(o[d]===$t&&(o[p]===$t||p===o.byteLength)){if(m=o.subarray(d,p),x=we.ts.parseType(m,l.pid),x==="pes"&&(C=we.ts.parsePesType(m,l.table),w=we.ts.parsePayloadUnitStartIndicator(m),C==="audio"&&w&&(k=we.ts.parsePesTime(m),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d+=ot,p+=ot;continue}d++,p++}for(p=o.byteLength,d=p-ot,B=!1;d>=0;){if(o[d]===$t&&(o[p]===$t||p===o.byteLength)){if(m=o.subarray(d,p),x=we.ts.parseType(m,l.pid),x==="pes"&&(C=we.ts.parsePesType(m,l.table),w=we.ts.parsePayloadUnitStartIndicator(m),C==="audio"&&w&&(k=we.ts.parsePesTime(m),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d-=ot,p-=ot;continue}d--,p--}},rm=function(o,l,h){for(var d=0,p=ot,m,x,C,w,k,B,W,ae,Y=!1,le={data:[],size:0};p<o.byteLength;){if(o[d]===$t&&o[p]===$t){switch(m=o.subarray(d,p),x=we.ts.parseType(m,l.pid),x){case"pes":if(C=we.ts.parsePesType(m,l.table),w=we.ts.parsePayloadUnitStartIndicator(m),C==="video"&&(w&&!Y&&(k=we.ts.parsePesTime(m),k&&(k.type="video",h.video.push(k),Y=!0)),!h.firstKeyFrame)){if(w&&le.size!==0){for(B=new Uint8Array(le.size),W=0;le.data.length;)ae=le.data.shift(),B.set(ae,W),W+=ae.byteLength;if(we.ts.videoPacketContainsKeyFrame(B)){var _e=we.ts.parsePesTime(B);_e?(h.firstKeyFrame=_e,h.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}le.size=0}le.data.push(m),le.size+=m.byteLength}break}if(Y&&h.firstKeyFrame)break;d+=ot,p+=ot;continue}d++,p++}for(p=o.byteLength,d=p-ot,Y=!1;d>=0;){if(o[d]===$t&&o[p]===$t){if(m=o.subarray(d,p),x=we.ts.parseType(m,l.pid),x==="pes"&&(C=we.ts.parsePesType(m,l.table),w=we.ts.parsePayloadUnitStartIndicator(m),C==="video"&&w&&(k=we.ts.parsePesTime(m),k&&(k.type="video",h.video.push(k),Y=!0))),Y)break;d-=ot,p-=ot;continue}d--,p--}},nm=function(o,l){if(o.audio&&o.audio.length){var h=l;(typeof h>"u"||isNaN(h))&&(h=o.audio[0].dts),o.audio.forEach(function(m){m.dts=Ji(m.dts,h),m.pts=Ji(m.pts,h),m.dtsTime=m.dts/Ri,m.ptsTime=m.pts/Ri})}if(o.video&&o.video.length){var d=l;if((typeof d>"u"||isNaN(d))&&(d=o.video[0].dts),o.video.forEach(function(m){m.dts=Ji(m.dts,d),m.pts=Ji(m.pts,d),m.dtsTime=m.dts/Ri,m.ptsTime=m.pts/Ri}),o.firstKeyFrame){var p=o.firstKeyFrame;p.dts=Ji(p.dts,d),p.pts=Ji(p.pts,d),p.dtsTime=p.dts/Ri,p.ptsTime=p.pts/Ri}}},am=function(o){for(var l=!1,h=0,d=null,p=null,m=0,x=0,C;o.length-x>=3;){var w=we.aac.parseType(o,x);switch(w){case"timed-metadata":if(o.length-x<10){l=!0;break}if(m=we.aac.parseId3TagSize(o,x),m>o.length){l=!0;break}p===null&&(C=o.subarray(x,x+m),p=we.aac.parseAacTimestamp(C)),x+=m;break;case"audio":if(o.length-x<7){l=!0;break}if(m=we.aac.parseAdtsSize(o,x),m>o.length){l=!0;break}d===null&&(C=o.subarray(x,x+m),d=we.aac.parseSampleRate(C)),h++,x+=m;break;default:x++;break}if(l)return null}if(d===null||p===null)return null;var k=Ri/d,B={audio:[{type:"audio",dts:p,pts:p},{type:"audio",dts:p+h*1024*k,pts:p+h*1024*k}]};return B},om=function(o){var l={pid:null,table:null},h={};sm(o,l);for(var d in l.table)if(l.table.hasOwnProperty(d)){var p=l.table[d];switch(p){case Yu.H264_STREAM_TYPE:h.video=[],rm(o,l,h),h.video.length===0&&delete h.video;break;case Yu.ADTS_STREAM_TYPE:h.audio=[],Qu(o,l,h),h.audio.length===0&&delete h.audio;break}}return h},um=function(o,l){var h=we.aac.isLikelyAacData(o),d;return h?d=am(o):d=om(o),!d||!d.audio&&!d.video?null:(nm(d,l),d)},lm={inspect:um,parseAudioPes_:Qu};const cm=function(o,l){l.on("data",function(h){const d=h.initSegment;h.initSegment={data:d.buffer,byteOffset:d.byteOffset,byteLength:d.byteLength};const p=h.data;h.data=p.buffer,o.postMessage({action:"data",segment:h,byteOffset:p.byteOffset,byteLength:p.byteLength},[h.data])}),l.on("done",function(h){o.postMessage({action:"done"})}),l.on("gopInfo",function(h){o.postMessage({action:"gopInfo",gopInfo:h})}),l.on("videoSegmentTimingInfo",function(h){const d={start:{decode:Se.videoTsToSeconds(h.start.dts),presentation:Se.videoTsToSeconds(h.start.pts)},end:{decode:Se.videoTsToSeconds(h.end.dts),presentation:Se.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:Se.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=Se.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:d})}),l.on("audioSegmentTimingInfo",function(h){const d={start:{decode:Se.videoTsToSeconds(h.start.dts),presentation:Se.videoTsToSeconds(h.start.pts)},end:{decode:Se.videoTsToSeconds(h.end.dts),presentation:Se.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:Se.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=Se.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:d})}),l.on("id3Frame",function(h){o.postMessage({action:"id3Frame",id3Frame:h})}),l.on("caption",function(h){o.postMessage({action:"caption",caption:h})}),l.on("trackinfo",function(h){o.postMessage({action:"trackinfo",trackInfo:h})}),l.on("audioTimingInfo",function(h){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Se.videoTsToSeconds(h.start),end:Se.videoTsToSeconds(h.end)}})}),l.on("videoTimingInfo",function(h){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Se.videoTsToSeconds(h.start),end:Se.videoTsToSeconds(h.end)}})}),l.on("log",function(h){o.postMessage({action:"log",log:h})})};class Ju{constructor(l,h){this.options=h||{},this.self=l,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new ap.Transmuxer(this.options),cm(this.self,this.transmuxer)}pushMp4Captions(l){this.captionParser||(this.captionParser=new zp,this.captionParser.init());const h=new Uint8Array(l.data,l.byteOffset,l.byteLength),d=this.captionParser.parse(h,l.trackIds,l.timescales);this.self.postMessage({action:"mp4Captions",captions:d&&d.captions||[],logs:d&&d.logs||[],data:h.buffer},[h.buffer])}initMp4WebVttParser(l){this.webVttParser||(this.webVttParser=new Xu);const h=new Uint8Array(l.data,l.byteOffset,l.byteLength);this.webVttParser.init(h)}getMp4WebVttText(l){this.webVttParser||(this.webVttParser=new Xu);const h=new Uint8Array(l.data,l.byteOffset,l.byteLength),d=this.webVttParser.parseSegment(h);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:d||[],data:h.buffer},[h.buffer])}probeMp4StartTime({timescales:l,data:h}){const d=zs.startTime(l,h);this.self.postMessage({action:"probeMp4StartTime",startTime:d,data:h},[h.buffer])}probeMp4Tracks({data:l}){const h=zs.tracks(l);this.self.postMessage({action:"probeMp4Tracks",tracks:h,data:l},[l.buffer])}probeEmsgID3({data:l,offset:h}){const d=zs.getEmsgID3(l,h);this.self.postMessage({action:"probeEmsgID3",id3Frames:d,emsgData:l},[l.buffer])}probeTs({data:l,baseStartTime:h}){const d=typeof h=="number"&&!isNaN(h)?h*Se.ONE_SECOND_IN_TS:void 0,p=lm.inspect(l,d);let m=null;p&&(m={hasVideo:p.video&&p.video.length===2||!1,hasAudio:p.audio&&p.audio.length===2||!1},m.hasVideo&&(m.videoStart=p.video[0].ptsTime),m.hasAudio&&(m.audioStart=p.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:m,data:l},[l.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(l){const h=new Uint8Array(l.data,l.byteOffset,l.byteLength);this.transmuxer.push(h)}reset(){this.transmuxer.reset()}setTimestampOffset(l){const h=l.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Se.secondsToVideoTs(h)))}setAudioAppendStart(l){this.transmuxer.setAudioAppendStart(Math.ceil(Se.secondsToVideoTs(l.appendStart)))}setRemux(l){this.transmuxer.setRemux(l.remux)}flush(l){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(l){this.transmuxer.alignGopsWith(l.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new Ju(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new Ju(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var yT=Gh(_T);const TT=(s,e,t)=>{const{type:i,initSegment:r,captions:n,captionStreams:a,metadata:u,videoFrameDtsTime:c,videoFramePtsTime:f}=s.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:u});const g=s.data.segment.boxes||{data:s.data.segment.data},_={type:i,data:new Uint8Array(g.data,g.data.byteOffset,g.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof c<"u"&&(_.videoFrameDtsTime=c),typeof f<"u"&&(_.videoFramePtsTime=f),t(_)},vT=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},bT=(s,e)=>{e.gopInfo=s.data.gopInfo},Kh=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:u,onAudioTimingInfo:c,onVideoTimingInfo:f,onVideoSegmentTimingInfo:g,onAudioSegmentTimingInfo:_,onId3:A,onCaptions:S,onDone:O,onEndedTimeline:T,onTransmuxerLog:I,isEndOfTimeline:F,segment:N,triggerSegmentEventFn:R}=s,U={buffer:[]};let j=F;const M=$=>{e.currentTransmux===s&&($.data.action==="data"&&TT($,U,a),$.data.action==="trackinfo"&&u($.data.trackInfo),$.data.action==="gopInfo"&&bT($,U),$.data.action==="audioTimingInfo"&&c($.data.audioTimingInfo),$.data.action==="videoTimingInfo"&&f($.data.videoTimingInfo),$.data.action==="videoSegmentTimingInfo"&&g($.data.videoSegmentTimingInfo),$.data.action==="audioSegmentTimingInfo"&&_($.data.audioSegmentTimingInfo),$.data.action==="id3Frame"&&A([$.data.id3Frame],$.data.id3Frame.dispatchType),$.data.action==="caption"&&S($.data.caption),$.data.action==="endedtimeline"&&(j=!1,T()),$.data.action==="log"&&I($.data.log),$.data.type==="transmuxed"&&(j||(e.onmessage=null,vT({transmuxedData:U,callback:O}),Yh(e))))},L=()=>{const $={message:"Received an error message from the transmuxer worker",metadata:{errorType:q.Error.StreamingFailedToTransmuxSegment,segmentInfo:Fi({segment:N})}};O(null,$)};if(e.onmessage=M,e.onerror=L,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof n<"u"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const $=t instanceof ArrayBuffer?t:t.buffer,v=t instanceof ArrayBuffer?0:t.byteOffset;R({type:"segmenttransmuxingstart",segment:N}),e.postMessage({action:"push",data:$,byteOffset:v,byteLength:t.byteLength},[$])}F&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Yh=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():Kh(s.currentTransmux))},fc=(s,e)=>{s.postMessage({action:e}),Yh(s)},Qh=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,fc(e,s);return}e.transmuxQueue.push(fc.bind(null,e,s))},xT=s=>{Qh("reset",s)},ST=s=>{Qh("endTimeline",s)},Jh=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,Kh(s);return}s.transmuxer.transmuxQueue.push(s)},ET=s=>{const e=new yT;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:s}),e};var Ka={reset:xT,endTimeline:ST,transmux:Jh,createTransmuxer:ET};const cs=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,r=$e({},s,{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,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),i(a.data))};if(e.addEventListener("message",n),s.data){const a=s.data instanceof ArrayBuffer;r.byteOffset=a?0:s.data.byteOffset,r.byteLength=s.data.byteLength;const u=[a?s.data:s.data.buffer];e.postMessage(r,u)}else e.postMessage(r)},Kt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Zh="wvtt",vo=s=>{s.forEach(e=>{e.abort()})},CT=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),wT=s=>{const e=s.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=s.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},uu=(s,e)=>{const{requestType:t}=e,i=zi({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Kt.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Kt.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Kt.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Kt.FAILURE,xhr:e,metadata:i}:null},pc=(s,e,t,i)=>(r,n)=>{const a=n.response,u=uu(r,n);if(u)return t(u,s);if(a.byteLength!==16)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Kt.FAILURE,xhr:n},s);const c=new DataView(a),f=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=f;const g={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:s,keyInfo:g}),t(null,s)},AT=(s,e)=>{e===Zh&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},DT=(s,e,t)=>{e===Zh&&cs({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:r})=>{s.bytes=i,t(null,s,{mp4VttCues:r})}})},ef=(s,e)=>{const t=Po(s.map.bytes);if(t!=="mp4"){const i=s.map.resolvedUri||s.map.uri,r=t||"unknown";return e({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${i}`,code:Kt.FAILURE,metadata:{mediaType:r}})}cs({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:i,data:r})=>(s.map.bytes=r,i.forEach(function(n){s.map.tracks=s.map.tracks||{},!s.map.tracks[n.type]&&(s.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[n.id]=n.timescale),n.type==="text"&&AT(s,n.codec))}),e(null))})},kT=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,r)=>{const n=uu(i,r);if(n)return e(n,s);const a=new Uint8Array(r.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,ef(s,function(u){if(u)return u.xhr=r,u.status=r.status,e(u,s);e(null,s)})},IT=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(r,n)=>{const a=uu(r,n);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const u=t==="arraybuffer"||!n.responseText?n.response:mT(n.responseText.substring(s.lastReachedChar||0));return s.stats=CT(n),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},PT=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})=>{const O=s.map&&s.map.tracks||{},T=!!(O.audio&&O.video);let I=i.bind(null,s,"audio","start");const F=i.bind(null,s,"audio","end");let N=i.bind(null,s,"video","start");const R=i.bind(null,s,"video","end"),U=()=>Jh({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:j=>{j.type=j.type==="combined"?"video":j.type,g(s,j)},onTrackInfo:j=>{t&&(T&&(j.isMuxed=!0),t(s,j))},onAudioTimingInfo:j=>{I&&typeof j.start<"u"&&(I(j.start),I=null),F&&typeof j.end<"u"&&F(j.end)},onVideoTimingInfo:j=>{N&&typeof j.start<"u"&&(N(j.start),N=null),R&&typeof j.end<"u"&&R(j.end)},onVideoSegmentTimingInfo:j=>{const M={pts:{start:j.start.presentation,end:j.end.presentation},dts:{start:j.start.decode,end:j.end.decode}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:M}),r(j)},onAudioSegmentTimingInfo:j=>{const M={pts:{start:j.start.pts,end:j.end.pts},dts:{start:j.start.dts,end:j.end.dts}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:M}),n(j)},onId3:(j,M)=>{a(s,j,M)},onCaptions:j=>{u(s,[j])},isEndOfTimeline:c,onEndedTimeline:()=>{f()},onTransmuxerLog:A,onDone:(j,M)=>{_&&(j.type=j.type==="combined"?"video":j.type,S({type:"segmenttransmuxingcomplete",segment:s}),_(M,s,j))},segment:s,triggerSegmentEventFn:S});cs({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:j=>{s.bytes=e=j.data;const M=j.result;M&&(t(s,{hasAudio:M.hasAudio,hasVideo:M.hasVideo,isMuxed:T}),t=null),U()}})},tf=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})=>{let O=new Uint8Array(e);if(J0(O)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){g(s,{data:O,type:"text"}),DT(s,T.text.codec,_);return}const F={isFmp4:!0,hasVideo:!!T.video,hasAudio:!!T.audio};T.audio&&T.audio.codec&&T.audio.codec!=="enca"&&(F.audioCodec=T.audio.codec),T.video&&T.video.codec&&T.video.codec!=="encv"&&(F.videoCodec=T.video.codec),T.video&&T.audio&&(F.isMuxed=!0),t(s,F);const N=(R,U)=>{g(s,{data:O,type:F.hasAudio&&!F.isMuxed?"audio":"video"}),U&&U.length&&a(s,U),R&&R.length&&u(s,R),_(null,s,{})};cs({action:"probeMp4StartTime",timescales:s.map.timescales,data:O,transmuxer:s.transmuxer,callback:({data:R,startTime:U})=>{e=R.buffer,s.bytes=O=R,F.hasAudio&&!F.isMuxed&&i(s,"audio","start",U),F.hasVideo&&i(s,"video","start",U),cs({action:"probeEmsgID3",data:O,transmuxer:s.transmuxer,offset:U,callback:({emsgData:j,id3Frames:M})=>{if(e=j.buffer,s.bytes=O=j,!T.video||!j.byteLength||!s.transmuxer){N(void 0,M);return}cs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:O,timescales:s.map.timescales,trackIds:[T.video.id],callback:L=>{e=L.data.buffer,s.bytes=O=L.data,L.logs.forEach(function($){A(Ce($,{stream:"mp4CaptionParser"}))}),N(L.captions,M)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=Po(O)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}PT({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})},sf=function({id:s,key:e,encryptedBytes:t,decryptionWorker:i,segment:r,doneFn:n},a){const u=f=>{if(f.data.source===s){i.removeEventListener("message",u);const g=f.data.decrypted;a(new Uint8Array(g.bytes,g.byteOffset,g.byteLength))}};i.onerror=()=>{const f="An error occurred in the decryption worker",g=Fi({segment:r}),_={message:f,metadata:{error:new Error(f),errorType:q.Error.StreamingFailedToDecryptSegment,segmentInfo:g,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};n(_,r)},i.addEventListener("message",u);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(jh({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},LT=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})=>{S({type:"segmentdecryptionstart"}),sf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},O=>{e.bytes=O,S({type:"segmentdecryptioncomplete",segment:e}),tf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})})},OT=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})=>{let O=0,T=!1;return(I,F)=>{if(!T){if(I)return T=!0,vo(s),_(I,F);if(O+=1,O===s.length){const N=function(){if(F.encryptedBytes)return LT({decryptionWorker:e,segment:F,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S});tf({segment:F,bytes:F.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:S})};if(F.endOfAllRequests=Date.now(),F.map&&F.map.encryptedBytes&&!F.map.bytes)return S({type:"segmentdecryptionstart",segment:F}),sf({decryptionWorker:e,id:F.requestId+"-init",encryptedBytes:F.map.encryptedBytes,key:F.map.key,segment:F,doneFn:_},R=>{F.map.bytes=R,S({type:"segmentdecryptioncomplete",segment:F}),ef(F,U=>{if(U)return vo(s),_(U,F);N()})});N()}}}},RT=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},NT=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:c,endedTimelineFn:f,dataFn:g})=>_=>{if(!_.target.aborted)return s.stats=Ce(s.stats,wT(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},MT=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:f,id3Fn:g,captionsFn:_,isEndOfTimeline:A,endedTimelineFn:S,dataFn:O,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:F})=>{const N=[],R=OT({activeXhrs:N,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:f,id3Fn:g,captionsFn:_,isEndOfTimeline:A,endedTimelineFn:S,dataFn:O,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:F});if(i.key&&!i.key.bytes){const $=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&$.push(i.map.key);const v=Ce(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),E=pc(i,$,R,F),V={uri:i.key.resolvedUri};F({type:"segmentkeyloadstart",segment:i,keyInfo:V});const G=s(v,E);N.push(G)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const G=Ce(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),z=pc(i,[i.map.key],R,F),Q={uri:i.map.key.resolvedUri};F({type:"segmentkeyloadstart",segment:i,keyInfo:Q});const se=s(G,z);N.push(se)}const v=Ce(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:yo(i.map),requestType:"segment-media-initialization"}),E=kT({segment:i,finishProcessingFn:R,triggerSegmentEventFn:F});F({type:"segmentloadstart",segment:i});const V=s(v,E);N.push(V)}const U=Ce(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:yo(i),requestType:"segment"}),j=IT({segment:i,finishProcessingFn:R,responseType:U.responseType,triggerSegmentEventFn:F});F({type:"segmentloadstart",segment:i});const M=s(U,j);M.addEventListener("progress",NT({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:f,id3Fn:g,captionsFn:_,isEndOfTimeline:A,endedTimelineFn:S,dataFn:O})),N.push(M);const L={};return N.forEach($=>{$.addEventListener("loadend",RT({loadendState:L,abortFn:r}))}),()=>vo(N)},an=Lt("PlaylistSelector"),mc=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},ds=function(s,e){if(!s)return"";const t=D.getComputedStyle(s);return t?t[e]:""},hs=function(s,e){const t=s.slice();s.sort(function(i,r){const n=e(i,r);return n===0?t.indexOf(i)-t.indexOf(r):n})},lu=function(s,e){let t,i;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||D.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||D.Number.MAX_VALUE,t-i},BT=function(s,e){let t,i;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||D.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||D.Number.MAX_VALUE,t===i&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let rf=function(s){const{main:e,bandwidth:t,playerWidth:i,playerHeight:r,playerObjectFit:n,limitRenditionByPlayerDimensions:a,playlistController:u}=s;if(!e)return;const c={bandwidth:t,width:i,height:r,limitRenditionByPlayerDimensions:a};let f=e.playlists;pt.isAudioOnly(e)&&(f=u.getAudioTrackPlaylists_(),c.audioOnly=!0);let g=f.map(L=>{let $;const v=L.attributes&&L.attributes.RESOLUTION&&L.attributes.RESOLUTION.width,E=L.attributes&&L.attributes.RESOLUTION&&L.attributes.RESOLUTION.height;return $=L.attributes&&L.attributes.BANDWIDTH,$=$||D.Number.MAX_VALUE,{bandwidth:$,width:v,height:E,playlist:L}});hs(g,(L,$)=>L.bandwidth-$.bandwidth),g=g.filter(L=>!pt.isIncompatible(L.playlist));let _=g.filter(L=>pt.isEnabled(L.playlist));_.length||(_=g.filter(L=>!pt.isDisabled(L.playlist)));const A=_.filter(L=>L.bandwidth*Xe.BANDWIDTH_VARIANCE<t);let S=A[A.length-1];const O=A.filter(L=>L.bandwidth===S.bandwidth)[0];if(a===!1){const L=O||_[0]||g[0];if(L&&L.playlist){let $="sortedPlaylistReps";return O&&($="bandwidthBestRep"),_[0]&&($="enabledPlaylistReps"),an(`choosing ${mc(L)} using ${$} with options`,c),L.playlist}return an("could not choose a playlist with options",c),null}const T=A.filter(L=>L.width&&L.height);hs(T,(L,$)=>L.width-$.width);const I=T.filter(L=>L.width===i&&L.height===r);S=I[I.length-1];const F=I.filter(L=>L.bandwidth===S.bandwidth)[0];let N,R,U;F||(N=T.filter(L=>n==="cover"?L.width>i&&L.height>r:L.width>i||L.height>r),R=N.filter(L=>L.width===N[0].width&&L.height===N[0].height),S=R[R.length-1],U=R.filter(L=>L.bandwidth===S.bandwidth)[0]);let j;if(u.leastPixelDiffSelector){const L=T.map($=>($.pixelDiff=Math.abs($.width-i)+Math.abs($.height-r),$));hs(L,($,v)=>$.pixelDiff===v.pixelDiff?v.bandwidth-$.bandwidth:$.pixelDiff-v.pixelDiff),j=L[0]}const M=j||U||F||O||_[0]||g[0];if(M&&M.playlist){let L="sortedPlaylistReps";return j?L="leastPixelDiffRep":U?L="resolutionPlusOneRep":F?L="resolutionBestRep":O?L="bandwidthBestRep":_[0]&&(L="enabledPlaylistReps"),an(`choosing ${mc(M)} using ${L} with options`,c),M.playlist}return an("could not choose a playlist with options",c),null};const gc=function(){let s=this.useDevicePixelRatio&&D.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),rf({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(ds(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(ds(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?ds(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},FT=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&D.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),rf({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(ds(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(ds(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?ds(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},UT=function(s){const{main:e,currentTime:t,bandwidth:i,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:u,syncController:c}=s,f=e.playlists.filter(O=>!pt.isIncompatible(O));let g=f.filter(pt.isEnabled);g.length||(g=f.filter(O=>!pt.isDisabled(O)));const A=g.filter(pt.hasAttribute.bind(null,"BANDWIDTH")).map(O=>{const I=c.getSyncPoint(O,r,u,t)?1:2,N=pt.estimateSegmentRequestTime(n,i,O)*I-a;return{playlist:O,rebufferingImpact:N}}),S=A.filter(O=>O.rebufferingImpact<=0);return hs(S,(O,T)=>lu(T.playlist,O.playlist)),S.length?S[0]:(hs(A,(O,T)=>O.rebufferingImpact-T.rebufferingImpact),A[0]||null)},jT=function(){const s=this.playlists.main.playlists.filter(pt.isEnabled);return hs(s,(t,i)=>lu(t,i)),s.filter(t=>!!hr(this.playlists.main,t).video)[0]||null},qT=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function nf(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const $T=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const r=e.textTracks().getTrackById(i);if(r)s[t]=r;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,u=t,c=!1;const f=n[i];f&&(a=f.label,u=f.language,c=f.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:c,label:a,language:u},!1).track}}},VT=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const i=D.WebKitDataCue||D.VTTCue;e.forEach(r=>{const n=r.stream;r.content?r.content.forEach(a=>{const u=new i(r.startTime+t,r.endTime+t,a.text);u.line=a.line,u.align="left",u.position=a.position,u.positionAlign="line-left",s[n].addCue(u)}):s[n].addCue(new i(r.startTime+t,r.endTime+t,r.text))})},HT=function(s){Object.defineProperties(s.frame,{id:{get(){return q.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return q.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return q.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},zT=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const r=D.WebKitDataCue||D.VTTCue,n=s.metadataTrack_;if(!n||(e.forEach(g=>{const _=g.cueTime+t;typeof _!="number"||D.isNaN(_)||_<0||!(_<1/0)||!g.frames||!g.frames.length||g.frames.forEach(A=>{const S=new r(_,_,A.value||A.url||A.data||"");S.frame=A,S.value=A,HT(S),n.addCue(S)})}),!n.cues||!n.cues.length))return;const a=n.cues,u=[];for(let g=0;g<a.length;g++)a[g]&&u.push(a[g]);const c=u.reduce((g,_)=>{const A=g[_.startTime]||[];return A.push(_),g[_.startTime]=A,g},{}),f=Object.keys(c).sort((g,_)=>Number(g)-Number(_));f.forEach((g,_)=>{const A=c[g],S=isFinite(i)?i:g,O=Number(f[_+1])||S;A.forEach(T=>{T.endTime=O})})},GT={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"},WT=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),XT=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const i=D.WebKitDataCue||D.VTTCue;e.forEach(r=>{for(const n of Object.keys(r)){if(WT.has(n))continue;const a=new i(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:GT[n],data:r[n]},(n==="scte35Out"||n==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}r.processDateRange()})},_c=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,q.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},ar=function(s,e,t){let i,r;if(t&&t.cues)for(i=t.cues.length;i--;)r=t.cues[i],r.startTime>=s&&r.endTime<=e&&t.removeCue(r)},KT=function(s){const e=s.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const r=e[i],n=`${r.startTime}-${r.endTime}-${r.text}`;t[n]?s.removeCue(r):t[n]=r}},YT=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const i=Math.ceil((e-t+3)*Ui.ONE_SECOND_IN_TS);let r;for(r=0;r<s.length&&!(s[r].pts>i);r++);return s.slice(r)},QT=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const i=e[0].pts;let r=0;for(r;r<s.length&&!(s[r].pts>=i);r++);return s.slice(0,r).concat(e)},JT=(s,e,t,i)=>{const r=Math.ceil((e-i)*Ui.ONE_SECOND_IN_TS),n=Math.ceil((t-i)*Ui.ONE_SECOND_IN_TS),a=s.slice();let u=s.length;for(;u--&&!(s[u].pts<=n););if(u===-1)return a;let c=u+1;for(;c--&&!(s[c].pts<=r););return c=Math.max(c,0),a.splice(c,u-c+1),a},ZT=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let r=0;r<t.length;r++){const n=t[r];if(n!==i[r]||s[n]!==e[n])return!1}return!0},ev=function(s,e,t){e=e||[];const i=[];let r=0;for(let n=0;n<e.length;n++){const a=e[n];if(s===a.timeline&&(i.push(n),r+=a.duration,r>t))return n}return i.length===0?0:i[i.length-1]},ir=1,tv=500,yc=s=>typeof s=="number"&&isFinite(s),on=1/60,iv=(s,e,t)=>s!=="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,sv=(s,e,t)=>{let i=e-Xe.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const r=e-t;return Math.min(r,i)},ts=s=>{const{startOfSegment:e,duration:t,segment:i,part:r,playlist:{mediaSequence:n,id:a,segments:u=[]},mediaIndex:c,partIndex:f,timeline:g}=s,_=u.length-1;let A="mediaIndex/partIndex increment";s.getMediaInfoForTime?A=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(A+=` with independent ${s.independent}`);const S=typeof f=="number",O=s.segment.uri?"segment":"pre-segment",T=S?xh({preloadSegment:i})-1:0;return`${O} [${n+c}/${n+_}]`+(S?` part [${f}/${T}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(S?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${g}] selected by [${A}] playlist [${a}]`},Tc=s=>`${s}TimingInfo`,rv=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:r})=>!r&&s===e?null:s<e?t:i.length?i.end(i.length-1):t,bo=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:r})=>{if(e===t)return!1;if(i==="audio"){const n=s.lastTimelineChange({type:"main"});return!n||n.to!==t}if(i==="main"&&r){const n=s.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},nv=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),i=e&&t,r=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&r)},av=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},vi=s=>{const e=s.pendingSegment_;if(!e)return;if(bo({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&nv(s.timelineChangeController_)){if(av(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},ov=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:r,end:n}=i;let a;typeof r=="bigint"||typeof n=="bigint"?a=D.BigInt(n)-D.BigInt(r):typeof r=="number"&&typeof n=="number"&&(a=n-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},vc=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+Wt:!1,uv=(s,e)=>{if(e!=="hls")return null;const t=ov({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,r=vc({segmentDuration:t,maxDuration:i*2}),n=vc({segmentDuration:t,maxDuration:i}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return r||n?{severity:r?"warn":"info",message:a}:null},Fi=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),r=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:r,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class xo extends q.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.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!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.logger_=Lt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger($e({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger($e({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():vi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Ka.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_&&D.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),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);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,D.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<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&Ka.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:i,isMuxed:r}=e;if(i&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=kn(e);let r=this.initSegments_[i];return t&&!r&&e.bytes&&(this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,t=!1){if(!e)return null;const i=qh(e);let r=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[i]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(r||e).resolvedUri};return r&&(n.bytes=r.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||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,r=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(i&&(i.id?n=i.id:i.uri&&(n=i.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
188
|
+
`),this.pushCaption(c),c.startPts=o},Ee.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},Ee.prototype.displayWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var m=0;m<8;m++)d&1<<m&&(c.windows[m].visible=1);return o},Ee.prototype.hideWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var m=0;m<8;m++)d&1<<m&&(c.windows[m].visible=0);return o},Ee.prototype.toggleWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var m=0;m<8;m++)d&1<<m&&(c.windows[m].visible^=1);return o},Ee.prototype.clearWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var m=0;m<8;m++)d&1<<m&&c.windows[m].clearText();return o},Ee.prototype.deleteWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var m=0;m<8;m++)d&1<<m&&c.windows[m].reset();return o},Ee.prototype.setPenAttributes=function(o,c){var h=this.current708Packet.data,d=h[o],p=c.currentWindow.penAttr;return d=h[++o],p.textTag=(d&240)>>4,p.offset=(d&12)>>2,p.penSize=d&3,d=h[++o],p.italics=(d&128)>>7,p.underline=(d&64)>>6,p.edgeType=(d&56)>>3,p.fontStyle=d&7,o},Ee.prototype.setPenColor=function(o,c){var h=this.current708Packet.data,d=h[o],p=c.currentWindow.penColor;return d=h[++o],p.fgOpacity=(d&192)>>6,p.fgRed=(d&48)>>4,p.fgGreen=(d&12)>>2,p.fgBlue=d&3,d=h[++o],p.bgOpacity=(d&192)>>6,p.bgRed=(d&48)>>4,p.bgGreen=(d&12)>>2,p.bgBlue=d&3,d=h[++o],p.edgeRed=(d&48)>>4,p.edgeGreen=(d&12)>>2,p.edgeBlue=d&3,o},Ee.prototype.setPenLocation=function(o,c){var h=this.current708Packet.data,d=h[o],p=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,d=h[++o],p.row=d&15,d=h[++o],p.column=d&63,o},Ee.prototype.reset=function(o,c){var h=this.getPts(o);return this.flushDisplayed(h,c),this.initService(c.serviceNum,o)};var Ir={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},Pr=function(o){return o===null?"":(o=Ir[o]||o,String.fromCharCode(o))},Lr=14,Mf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oi=function(){for(var o=[],c=Lr+1;c--;)o.push({text:"",indent:0,offset:0});return o},Me=function(o,c){Me.prototype.init.call(this),this.field_=o||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(h){var d,p,m,S,C;if(d=h.ccData&32639,d===this.lastControlCode_){this.lastControlCode_=null;return}if((d&61440)===4096?this.lastControlCode_=d:d!==this.PADDING_&&(this.lastControlCode_=null),m=d>>>8,S=d&255,d!==this.PADDING_)if(d===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(d===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(h.pts),this.flushDisplayed(h.pts),p=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=p,this.startPts_=h.pts;else if(d===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(h.pts);else if(d===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(h.pts);else if(d===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(h.pts);else if(d===this.CARRIAGE_RETURN_)this.clearFormatting(h.pts),this.flushDisplayed(h.pts),this.shiftRowsUp_(),this.startPts_=h.pts;else if(d===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(d===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(h.pts),this.displayed_=Oi();else if(d===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Oi();else if(d===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(h.pts),this.displayed_=Oi()),this.mode_="paintOn",this.startPts_=h.pts;else if(this.isSpecialCharacter(m,S))m=(m&3)<<8,C=Pr(m|S),this[this.mode_](h.pts,C),this.column_++;else if(this.isExtCharacter(m,S))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),m=(m&3)<<8,C=Pr(m|S),this[this.mode_](h.pts,C),this.column_++;else if(this.isMidRowCode(m,S))this.clearFormatting(h.pts),this[this.mode_](h.pts," "),this.column_++,(S&14)===14&&this.addFormatting(h.pts,["i"]),(S&1)===1&&this.addFormatting(h.pts,["u"]);else if(this.isOffsetControlCode(m,S)){const k=S&3;this.nonDisplayed_[this.row_].offset=k,this.column_+=k}else if(this.isPAC(m,S)){var w=Mf.indexOf(d&7968);if(this.mode_==="rollUp"&&(w-this.rollUpRows_+1<0&&(w=this.rollUpRows_-1),this.setRollUp(h.pts,w)),w!==this.row_&&w>=0&&w<=14&&(this.clearFormatting(h.pts),this.row_=w),S&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(h.pts,["u"]),(d&16)===16){const k=(d&14)>>1;this.column_=k*4,this.nonDisplayed_[this.row_].indent+=k}this.isColorPAC(S)&&(S&14)===14&&this.addFormatting(h.pts,["i"])}else this.isNormalChar(m)&&(S===0&&(S=null),C=Pr(m),C+=Pr(S),this[this.mode_](h.pts,C),this.column_+=C.length)}};Me.prototype=new Nt,Me.prototype.flushDisplayed=function(o){const c=d=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+d+"."})},h=[];this.displayed_.forEach((d,p)=>{if(d&&d.text&&d.text.length){try{d.text=d.text.trim()}catch{c(p)}d.text.length&&h.push({text:d.text,line:p+1,position:10+Math.min(70,d.indent*10)+d.offset*2.5})}else d==null&&c(p)}),h.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:h,stream:this.name_})},Me.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Oi(),this.nonDisplayed_=Oi(),this.lastControlCode_=null,this.column_=0,this.row_=Lr,this.rollUpRows_=2,this.formatting_=[]},Me.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},Me.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Me.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Me.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Me.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Me.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Me.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Me.prototype.isNormalChar=function(o){return o>=32&&o<=127},Me.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=Lr,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=Oi(),this.displayed_=Oi()),c!==void 0&&c!==this.row_)for(var h=0;h<this.rollUpRows_;h++)this.displayed_[c-h]=this.displayed_[this.row_-h],this.displayed_[this.row_-h]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},Me.prototype.addFormatting=function(o,c){this.formatting_=this.formatting_.concat(c);var h=c.reduce(function(d,p){return d+"<"+p+">"},"");this[this.mode_](o,h)},Me.prototype.clearFormatting=function(o){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(h,d){return h+"</"+d+">"},"");this.formatting_=[],this[this.mode_](o,c)}},Me.prototype.popOn=function(o,c){var h=this.nonDisplayed_[this.row_].text;h+=c,this.nonDisplayed_[this.row_].text=h},Me.prototype.rollUp=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h},Me.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<Lr+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Me.prototype.paintOn=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h};var pu={CaptionStream:Ve,Cea608Stream:Me,Cea708Stream:Ee},Or={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Bf=t,Ff=8589934592,Uf=4294967296,mu="shared",ta=function(o,c){var h=1;for(o>c&&(h=-1);Math.abs(c-o)>Uf;)o+=h*Ff;return o},ia=function(o){var c,h;ia.prototype.init.call(this),this.type_=o||mu,this.push=function(d){if(d.type==="metadata"){this.trigger("data",d);return}this.type_!==mu&&d.type!==this.type_||(h===void 0&&(h=d.dts),d.dts=ta(d.dts,h),d.pts=ta(d.pts,h),c=d.dts,this.trigger("data",d))},this.flush=function(){h=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){h=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ia.prototype=new Bf;var gu={TimestampRolloverStream:ia,handleRollover:ta},jf=(o,c,h)=>{if(!o)return-1;for(var d=h;d<o.length;d++)if(o[d]===c)return d;return-1},qf={typedArrayIndexOf:jf},Rr=qf.typedArrayIndexOf,Nr={Utf8:3},_u=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},Bs=function(o,c,h){return decodeURIComponent(_u(o,c,h))},Fs=function(o,c,h){return unescape(_u(o,c,h))},Us=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},js={APIC:function(o){var c=1,h,d,p="-->";o.data[0]===Nr.Utf8&&(h=Rr(o.data,0,c),!(h<0)&&(o.mimeType=Fs(o.data,c,h),c=h+1,o.pictureType=o.data[c],c++,d=Rr(o.data,0,c),!(d<0)&&(o.description=Bs(o.data,c,d),c=d+1,o.mimeType===p?o.url=Fs(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===Nr.Utf8&&(o.value=Bs(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===Nr.Utf8&&(c=Rr(o.data,0,1),c!==-1&&(o.description=Bs(o.data,1,c),o.value=Bs(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=Fs(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===Nr.Utf8&&(c=Rr(o.data,0,1),c!==-1&&(o.description=Bs(o.data,1,c),o.url=Fs(o.data,c+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var c;for(c=0;c<o.data.length;c++)if(o.data[c]===0){o.owner=Fs(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},$f=function(o){var c,h,d=10,p=0,m=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){p=Us(o.subarray(6,10)),p+=10;var S=o[5]&64;S&&(d+=4,d+=Us(o.subarray(10,14)),p-=Us(o.subarray(16,20)));do{if(c=Us(o.subarray(d+4,d+8)),c<1)break;h=String.fromCharCode(o[d],o[d+1],o[d+2],o[d+3]);var C={id:h,data:o.subarray(d+10,d+c+10)};C.key=C.id,js[C.id]?js[C.id](C):C.id[0]==="T"?js["T*"](C):C.id[0]==="W"&&js["W*"](C),m.push(C),d+=10,d+=c}while(d<p);return m}},yu={parseId3Frames:$f,parseSyncSafeInteger:Us,frameParsers:js},Vf=t,Hf=Or,mi=yu,Mr;Mr=function(o){var c={descriptor:o&&o.descriptor},h=0,d=[],p=0,m;if(Mr.prototype.init.call(this),this.dispatchType=Hf.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(m=0;m<c.descriptor.length;m++)this.dispatchType+=("00"+c.descriptor[m].toString(16)).slice(-2);this.push=function(S){var C,w,k,B,W,oe;if(S.type==="timed-metadata"){if(S.dataAlignmentIndicator&&(p=0,d.length=0),d.length===0&&(S.data.length<10||S.data[0]!==73||S.data[1]!==68||S.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(d.push(S),p+=S.data.byteLength,d.length===1&&(h=mi.parseSyncSafeInteger(S.data.subarray(6,10)),h+=10),!(p<h)){for(C={data:new Uint8Array(h),frames:[],pts:d[0].pts,dts:d[0].dts},W=0;W<h;)C.data.set(d[0].data.subarray(0,h-W),W),W+=d[0].data.byteLength,p-=d[0].data.byteLength,d.shift();w=10,C.data[5]&64&&(w+=4,w+=mi.parseSyncSafeInteger(C.data.subarray(10,14)),h-=mi.parseSyncSafeInteger(C.data.subarray(16,20)));do{if(k=mi.parseSyncSafeInteger(C.data.subarray(w+4,w+8)),k<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(oe=String.fromCharCode(C.data[w],C.data[w+1],C.data[w+2],C.data[w+3]),B={id:oe,data:C.data.subarray(w+10,w+k+10)},B.key=B.id,mi.frameParsers[B.id]?mi.frameParsers[B.id](B):B.id[0]==="T"?mi.frameParsers["T*"](B):B.id[0]==="W"&&mi.frameParsers["W*"](B),B.owner==="com.apple.streaming.transportStreamTimestamp"){var Q=B.data,de=(Q[3]&1)<<30|Q[4]<<22|Q[5]<<14|Q[6]<<6|Q[7]>>>2;de*=4,de+=Q[7]&3,B.timeStamp=de,C.pts===void 0&&C.dts===void 0&&(C.pts=B.timeStamp,C.dts=B.timeStamp),this.trigger("timestamp",B)}C.frames.push(B),w+=10,w+=k}while(w<h);this.trigger("data",C)}}}},Mr.prototype=new Vf;var zf=Mr,sa=t,ra=pu,Mt=Or,Gf=gu.TimestampRolloverStream,Br,qs,Fr,Yi=188,na=71;Br=function(){var o=new Uint8Array(Yi),c=0;Br.prototype.init.call(this),this.push=function(h){var d=0,p=Yi,m;for(c?(m=new Uint8Array(h.byteLength+c),m.set(o.subarray(0,c)),m.set(h,c),c=0):m=h;p<m.byteLength;){if(m[d]===na&&m[p]===na){this.trigger("data",m.subarray(d,p)),d+=Yi,p+=Yi;continue}d++,p++}d<m.byteLength&&(o.set(m.subarray(d),0),c=m.byteLength-d)},this.flush=function(){c===Yi&&o[0]===na&&(this.trigger("data",o),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},Br.prototype=new sa,qs=function(){var o,c,h,d;qs.prototype.init.call(this),d=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(p,m){var S=0;m.payloadUnitStartIndicator&&(S+=p[S]+1),m.type==="pat"?c(p.subarray(S),m):h(p.subarray(S),m)},c=function(p,m){m.section_number=p[7],m.last_section_number=p[8],d.pmtPid=(p[10]&31)<<8|p[11],m.pmtPid=d.pmtPid},h=function(p,m){var S,C,w,k;if(p[5]&1){for(d.programMapTable={video:null,audio:null,"timed-metadata":{}},S=(p[1]&15)<<8|p[2],C=3+S-4,w=(p[10]&15)<<8|p[11],k=12+w;k<C;){var B=p[k],W=(p[k+1]&31)<<8|p[k+2];B===Mt.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=W:B===Mt.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=W:B===Mt.METADATA_STREAM_TYPE&&(d.programMapTable["timed-metadata"][W]=B),k+=((p[k+3]&15)<<8|p[k+4])+5}m.programMapTable=d.programMapTable}},this.push=function(p){var m={},S=4;if(m.payloadUnitStartIndicator=!!(p[1]&64),m.pid=p[1]&31,m.pid<<=8,m.pid|=p[2],(p[3]&48)>>>4>1&&(S+=p[S]+1),m.pid===0)m.type="pat",o(p.subarray(S),m),this.trigger("data",m);else if(m.pid===this.pmtPid)for(m.type="pmt",o(p.subarray(S),m),this.trigger("data",m);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([p,S,m]):this.processPes_(p,S,m)},this.processPes_=function(p,m,S){S.pid===this.programMapTable.video?S.streamType=Mt.H264_STREAM_TYPE:S.pid===this.programMapTable.audio?S.streamType=Mt.ADTS_STREAM_TYPE:S.streamType=this.programMapTable["timed-metadata"][S.pid],S.type="pes",S.data=p.subarray(m),this.trigger("data",S)}},qs.prototype=new sa,qs.STREAM_TYPES={h264:27,adts:15},Fr=function(){var o=this,c=!1,h={data:[],size:0},d={data:[],size:0},p={data:[],size:0},m,S=function(w,k){var B;const W=w[0]<<16|w[1]<<8|w[2];k.data=new Uint8Array,W===1&&(k.packetLength=6+(w[4]<<8|w[5]),k.dataAlignmentIndicator=(w[6]&4)!==0,B=w[7],B&192&&(k.pts=(w[9]&14)<<27|(w[10]&255)<<20|(w[11]&254)<<12|(w[12]&255)<<5|(w[13]&254)>>>3,k.pts*=4,k.pts+=(w[13]&6)>>>1,k.dts=k.pts,B&64&&(k.dts=(w[14]&14)<<27|(w[15]&255)<<20|(w[16]&254)<<12|(w[17]&255)<<5|(w[18]&254)>>>3,k.dts*=4,k.dts+=(w[18]&6)>>>1)),k.data=w.subarray(9+w[8]))},C=function(w,k,B){var W=new Uint8Array(w.size),oe={type:k},Q=0,de=0,Te=!1,Je;if(!(!w.data.length||w.size<9)){for(oe.trackId=w.data[0].pid,Q=0;Q<w.data.length;Q++)Je=w.data[Q],W.set(Je.data,de),de+=Je.data.byteLength;S(W,oe),Te=k==="video"||oe.packetLength<=w.size,(B||Te)&&(w.size=0,w.data.length=0),Te&&o.trigger("data",oe)}};Fr.prototype.init.call(this),this.push=function(w){({pat:function(){},pes:function(){var k,B;switch(w.streamType){case Mt.H264_STREAM_TYPE:k=h,B="video";break;case Mt.ADTS_STREAM_TYPE:k=d,B="audio";break;case Mt.METADATA_STREAM_TYPE:k=p,B="timed-metadata";break;default:return}w.payloadUnitStartIndicator&&C(k,B,!0),k.data.push(w),k.size+=w.data.byteLength},pmt:function(){var k={type:"metadata",tracks:[]};m=w.programMapTable,m.video!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),c=!0,o.trigger("data",k)}})[w.type]()},this.reset=function(){h.size=0,h.data.length=0,d.size=0,d.data.length=0,this.trigger("reset")},this.flushStreams_=function(){C(h,"video"),C(d,"audio"),C(p,"timed-metadata")},this.flush=function(){if(!c&&m){var w={type:"metadata",tracks:[]};m.video!==null&&w.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.video,codec:"avc",type:"video"}),m.audio!==null&&w.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+m.audio,codec:"adts",type:"audio"}),o.trigger("data",w)}c=!1,this.flushStreams_(),this.trigger("done")}},Fr.prototype=new sa;var Tu={PAT_PID:0,MP2T_PACKET_LENGTH:Yi,TransportPacketStream:Br,TransportParseStream:qs,ElementaryStream:Fr,TimestampRolloverStream:Gf,CaptionStream:ra.CaptionStream,Cea608Stream:ra.Cea608Stream,Cea708Stream:ra.Cea708Stream,MetadataStream:zf};for(var aa in Mt)Mt.hasOwnProperty(aa)&&(Tu[aa]=Mt[aa]);var Wf=Tu,Xf=t,Kf=Ce.ONE_SECOND_IN_TS,Ur,vu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Ur=function(o){var c,h=0;Ur.prototype.init.call(this),this.skipWarn_=function(d,p){this.trigger("log",{level:"warn",message:`adts skiping bytes ${d} to ${p} in frame ${h} outside syncword`})},this.push=function(d){var p=0,m,S,C,w,k;if(o||(h=0),d.type==="audio"){c&&c.length?(C=c,c=new Uint8Array(C.byteLength+d.data.byteLength),c.set(C),c.set(d.data,C.byteLength)):c=d.data;for(var B;p+7<c.length;){if(c[p]!==255||(c[p+1]&246)!==240){typeof B!="number"&&(B=p),p++;continue}if(typeof B=="number"&&(this.skipWarn_(B,p),B=null),S=(~c[p+1]&1)*2,m=(c[p+3]&3)<<11|c[p+4]<<3|(c[p+5]&224)>>5,w=((c[p+6]&3)+1)*1024,k=w*Kf/vu[(c[p+2]&60)>>>2],c.byteLength-p<m)break;this.trigger("data",{pts:d.pts+h*k,dts:d.dts+h*k,sampleCount:w,audioobjecttype:(c[p+2]>>>6&3)+1,channelcount:(c[p+2]&1)<<2|(c[p+3]&192)>>>6,samplerate:vu[(c[p+2]&60)>>>2],samplingfrequencyindex:(c[p+2]&60)>>>2,samplesize:16,data:c.subarray(p+7+S,p+m)}),h++,p+=m}typeof B=="number"&&(this.skipWarn_(B,p),B=null),c=c.subarray(p)}},this.flush=function(){h=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},Ur.prototype=new Xf;var Yf=Ur,bu;bu=function(o){var c=o.byteLength,h=0,d=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+d},this.loadWord=function(){var p=o.byteLength-c,m=new Uint8Array(4),S=Math.min(4,c);if(S===0)throw new Error("no bytes available");m.set(o.subarray(p,p+S)),h=new DataView(m.buffer).getUint32(0),d=S*8,c-=S},this.skipBits=function(p){var m;d>p?(h<<=p,d-=p):(p-=d,m=Math.floor(p/8),p-=m*8,c-=m,this.loadWord(),h<<=p,d-=p)},this.readBits=function(p){var m=Math.min(d,p),S=h>>>32-m;return d-=m,d>0?h<<=m:c>0&&this.loadWord(),m=p-m,m>0?S<<m|this.readBits(m):S},this.skipLeadingZeros=function(){var p;for(p=0;p<d;++p)if((h&2147483648>>>p)!==0)return h<<=p,d-=p,p;return this.loadWord(),p+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var p=this.skipLeadingZeros();return this.readBits(p+1)-1},this.readExpGolomb=function(){var p=this.readUnsignedExpGolomb();return 1&p?1+p>>>1:-1*(p>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Qf=bu,xu=t,Jf=Qf,jr,qr,Su;qr=function(){var o=0,c,h;qr.prototype.init.call(this),this.push=function(d){var p;h?(p=new Uint8Array(h.byteLength+d.data.byteLength),p.set(h),p.set(d.data,h.byteLength),h=p):h=d.data;for(var m=h.byteLength;o<m-3;o++)if(h[o+2]===1){c=o+5;break}for(;c<m;)switch(h[c]){case 0:if(h[c-1]!==0){c+=2;break}else if(h[c-2]!==0){c++;break}o+3!==c-2&&this.trigger("data",h.subarray(o+3,c-2));do c++;while(h[c]!==1&&c<m);o=c-2,c+=3;break;case 1:if(h[c-1]!==0||h[c-2]!==0){c+=3;break}this.trigger("data",h.subarray(o+3,c-2)),o=c-2,c+=3;break;default:c+=3;break}h=h.subarray(o),c-=o,o=0},this.reset=function(){h=null,o=0,this.trigger("reset")},this.flush=function(){h&&h.byteLength>3&&this.trigger("data",h.subarray(o+3)),h=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},qr.prototype=new xu,Su={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},jr=function(){var o=new qr,c,h,d,p,m,S,C;jr.prototype.init.call(this),c=this,this.push=function(w){w.type==="video"&&(h=w.trackId,d=w.pts,p=w.dts,o.push(w))},o.on("data",function(w){var k={trackId:h,pts:d,dts:p,data:w,nalUnitTypeCode:w[0]&31};switch(k.nalUnitTypeCode){case 5:k.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:k.nalUnitType="sei_rbsp",k.escapedRBSP=m(w.subarray(1));break;case 7:k.nalUnitType="seq_parameter_set_rbsp",k.escapedRBSP=m(w.subarray(1)),k.config=S(k.escapedRBSP);break;case 8:k.nalUnitType="pic_parameter_set_rbsp";break;case 9:k.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",k)}),o.on("done",function(){c.trigger("done")}),o.on("partialdone",function(){c.trigger("partialdone")}),o.on("reset",function(){c.trigger("reset")}),o.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},C=function(w,k){var B=8,W=8,oe,Q;for(oe=0;oe<w;oe++)W!==0&&(Q=k.readExpGolomb(),W=(B+Q+256)%256),B=W===0?B:W},m=function(w){for(var k=w.byteLength,B=[],W=1,oe,Q;W<k-2;)w[W]===0&&w[W+1]===0&&w[W+2]===3?(B.push(W+2),W+=2):W++;if(B.length===0)return w;oe=k-B.length,Q=new Uint8Array(oe);var de=0;for(W=0;W<oe;de++,W++)de===B[0]&&(de++,B.shift()),Q[W]=w[de];return Q},S=function(w){var k=0,B=0,W=0,oe=0,Q,de,Te,Je,bt,_i,Xs,Ks,Ys,Qs,Zr,Re=[1,1],Js,Ft;if(Q=new Jf(w),de=Q.readUnsignedByte(),Je=Q.readUnsignedByte(),Te=Q.readUnsignedByte(),Q.skipUnsignedExpGolomb(),Su[de]&&(bt=Q.readUnsignedExpGolomb(),bt===3&&Q.skipBits(1),Q.skipUnsignedExpGolomb(),Q.skipUnsignedExpGolomb(),Q.skipBits(1),Q.readBoolean()))for(Zr=bt!==3?8:12,Ft=0;Ft<Zr;Ft++)Q.readBoolean()&&(Ft<6?C(16,Q):C(64,Q));if(Q.skipUnsignedExpGolomb(),_i=Q.readUnsignedExpGolomb(),_i===0)Q.readUnsignedExpGolomb();else if(_i===1)for(Q.skipBits(1),Q.skipExpGolomb(),Q.skipExpGolomb(),Xs=Q.readUnsignedExpGolomb(),Ft=0;Ft<Xs;Ft++)Q.skipExpGolomb();if(Q.skipUnsignedExpGolomb(),Q.skipBits(1),Ks=Q.readUnsignedExpGolomb(),Ys=Q.readUnsignedExpGolomb(),Qs=Q.readBits(1),Qs===0&&Q.skipBits(1),Q.skipBits(1),Q.readBoolean()&&(k=Q.readUnsignedExpGolomb(),B=Q.readUnsignedExpGolomb(),W=Q.readUnsignedExpGolomb(),oe=Q.readUnsignedExpGolomb()),Q.readBoolean()&&Q.readBoolean()){switch(Js=Q.readUnsignedByte(),Js){case 1:Re=[1,1];break;case 2:Re=[12,11];break;case 3:Re=[10,11];break;case 4:Re=[16,11];break;case 5:Re=[40,33];break;case 6:Re=[24,11];break;case 7:Re=[20,11];break;case 8:Re=[32,11];break;case 9:Re=[80,33];break;case 10:Re=[18,11];break;case 11:Re=[15,11];break;case 12:Re=[64,33];break;case 13:Re=[160,99];break;case 14:Re=[4,3];break;case 15:Re=[3,2];break;case 16:Re=[2,1];break;case 255:{Re=[Q.readUnsignedByte()<<8|Q.readUnsignedByte(),Q.readUnsignedByte()<<8|Q.readUnsignedByte()];break}}Re&&Re[0]/Re[1]}return{profileIdc:de,levelIdc:Te,profileCompatibility:Je,width:(Ks+1)*16-k*2-B*2,height:(2-Qs)*(Ys+1)*16-W*2-oe*2,sarRatio:Re}}},jr.prototype=new xu;var Zf={H264Stream:jr},ep=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Eu=function(o,c){var h=o[c+6]<<21|o[c+7]<<14|o[c+8]<<7|o[c+9],d=o[c+5],p=(d&16)>>4;return h=h>=0?h:0,p?h+20:h+10},Cu=function(o,c){return o.length-c<10||o[c]!==73||o[c+1]!==68||o[c+2]!==51?c:(c+=Eu(o,c),Cu(o,c))},tp=function(o){var c=Cu(o,0);return o.length>=c+2&&(o[c]&255)===255&&(o[c+1]&240)===240&&(o[c+1]&22)===16},wu=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},ip=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},sp=function(o,c,h){return unescape(ip(o,c,h))},rp=function(o,c){var h=(o[c+5]&224)>>5,d=o[c+4]<<3,p=o[c+3]&6144;return p|d|h},np=function(o,c){return o[c]===73&&o[c+1]===68&&o[c+2]===51?"timed-metadata":o[c]&!0&&(o[c+1]&240)===240?"audio":null},ap=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return ep[(o[c+2]&60)>>>2]}return null},op=function(o){var c,h,d,p;c=10,o[5]&64&&(c+=4,c+=wu(o.subarray(10,14)));do{if(h=wu(o.subarray(c+4,c+8)),h<1)return null;if(p=String.fromCharCode(o[c],o[c+1],o[c+2],o[c+3]),p==="PRIV"){d=o.subarray(c+10,c+h+10);for(var m=0;m<d.byteLength;m++)if(d[m]===0){var S=sp(d,0,m);if(S==="com.apple.streaming.transportStreamTimestamp"){var C=d.subarray(m+1),w=(C[3]&1)<<30|C[4]<<22|C[5]<<14|C[6]<<6|C[7]>>>2;return w*=4,w+=C[7]&3,w}break}}c+=10,c+=h}while(c<o.byteLength);return null},oa={isLikelyAacData:tp,parseId3TagSize:Eu,parseAdtsSize:rp,parseType:np,parseSampleRate:ap,parseAacTimestamp:op},up=t,Au=oa,$r;$r=function(){var o=new Uint8Array,c=0;$r.prototype.init.call(this),this.setTimestamp=function(h){c=h},this.push=function(h){var d=0,p=0,m,S,C,w;for(o.length?(w=o.length,o=new Uint8Array(h.byteLength+w),o.set(o.subarray(0,w)),o.set(h,w)):o=h;o.length-p>=3;){if(o[p]===73&&o[p+1]===68&&o[p+2]===51){if(o.length-p<10||(d=Au.parseId3TagSize(o,p),p+d>o.length))break;S={type:"timed-metadata",data:o.subarray(p,p+d)},this.trigger("data",S),p+=d;continue}else if((o[p]&255)===255&&(o[p+1]&240)===240){if(o.length-p<7||(d=Au.parseAdtsSize(o,p),p+d>o.length))break;C={type:"audio",data:o.subarray(p,p+d),pts:c,dts:c},this.trigger("data",C),p+=d;continue}p++}m=o.length-p,m>0?o=o.subarray(p):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},$r.prototype=new up;var lp=$r,cp=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],dp=cp,hp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],fp=hp,Vr=t,$s=Ye,Vs=Di,Hr=Ms,Bt=z,ri=Wf,zr=Ce,Du=Yf,pp=Zf.H264Stream,mp=lp,gp=oa.isLikelyAacData,_p=Ce.ONE_SECOND_IN_TS,ku=dp,Iu=fp,Gr,Hs,Wr,Ri,yp=function(o,c){c.stream=o,this.trigger("log",c)},Pu=function(o,c){for(var h=Object.keys(c),d=0;d<h.length;d++){var p=h[d];p==="headOfPipeline"||!c[p].on||c[p].on("log",yp.bind(o,p))}},Lu=function(o,c){var h;if(o.length!==c.length)return!1;for(h=0;h<o.length;h++)if(o[h]!==c[h])return!1;return!0},Ou=function(o,c,h,d,p,m){var S=h-c,C=d-c,w=p-h;return{start:{dts:o,pts:o+S},end:{dts:o+C,pts:o+w},prependedContentDuration:m,baseMediaDecodeTime:o}};Hs=function(o,c){var h=[],d,p=0,m=0,S=1/0;c=c||{},d=c.firstSequenceNumber||0,Hs.prototype.init.call(this),this.push=function(C){Bt.collectDtsInfo(o,C),o&&ku.forEach(function(w){o[w]=C[w]}),h.push(C)},this.setEarliestDts=function(C){p=C},this.setVideoBaseMediaDecodeTime=function(C){S=C},this.setAudioAppendStart=function(C){m=C},this.flush=function(){var C,w,k,B,W,oe,Q;if(h.length===0){this.trigger("done","AudioSegmentStream");return}C=Hr.trimAdtsFramesByEarliestDts(h,o,p),o.baseMediaDecodeTime=Bt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),Q=Hr.prefixWithSilence(o,C,m,S),o.samples=Hr.generateSampleTable(C),k=$s.mdat(Hr.concatenateFrameData(C)),h=[],w=$s.moof(d,[o]),B=new Uint8Array(w.byteLength+k.byteLength),d++,B.set(w),B.set(k,w.byteLength),Bt.clearDtsInfo(o),W=Math.ceil(_p*1024/o.samplerate),C.length&&(oe=C.length*W,this.trigger("segmentTimingInfo",Ou(zr.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),C[0].dts,C[0].pts,C[0].dts+oe,C[0].pts+oe,Q||0)),this.trigger("timingInfo",{start:C[0].pts,end:C[0].pts+oe})),this.trigger("data",{track:o,boxes:B}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Bt.clearDtsInfo(o),h=[],this.trigger("reset")}},Hs.prototype=new Vr,Gr=function(o,c){var h,d=[],p=[],m,S;c=c||{},h=c.firstSequenceNumber||0,Gr.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(C){Bt.collectDtsInfo(o,C),C.nalUnitType==="seq_parameter_set_rbsp"&&!m&&(m=C.config,o.sps=[C.data],Iu.forEach(function(w){o[w]=m[w]},this)),C.nalUnitType==="pic_parameter_set_rbsp"&&!S&&(S=C.data,o.pps=[C.data]),d.push(C)},this.flush=function(){for(var C,w,k,B,W,oe,Q=0,de,Te;d.length&&d[0].nalUnitType!=="access_unit_delimiter_rbsp";)d.shift();if(d.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(C=Vs.groupNalsIntoFrames(d),k=Vs.groupFramesIntoGops(C),k[0][0].keyFrame||(w=this.getGopForFusion_(d[0],o),w?(Q=w.duration,k.unshift(w),k.byteLength+=w.byteLength,k.nalCount+=w.nalCount,k.pts=w.pts,k.dts=w.dts,k.duration+=w.duration):k=Vs.extendFirstKeyFrame(k)),p.length){var Je;if(c.alignGopsAtEnd?Je=this.alignGopsAtEnd_(k):Je=this.alignGopsAtStart_(k),!Je){this.gopCache_.unshift({gop:k.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),d=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Bt.clearDtsInfo(o),k=Je}Bt.collectDtsInfo(o,k),o.samples=Vs.generateSampleTable(k),W=$s.mdat(Vs.concatenateNalData(k)),o.baseMediaDecodeTime=Bt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",k.map(function(bt){return{pts:bt.pts,dts:bt.dts,byteLength:bt.byteLength}})),de=k[0],Te=k[k.length-1],this.trigger("segmentTimingInfo",Ou(o.baseMediaDecodeTime,de.dts,de.pts,Te.dts+Te.duration,Te.pts+Te.duration,Q)),this.trigger("timingInfo",{start:k[0].pts,end:k[k.length-1].pts+k[k.length-1].duration}),this.gopCache_.unshift({gop:k.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),d=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),B=$s.moof(h,[o]),oe=new Uint8Array(B.byteLength+W.byteLength),h++,oe.set(B),oe.set(W,B.byteLength),this.trigger("data",{track:o,boxes:oe}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),d=[],this.gopCache_.length=0,p.length=0,this.trigger("reset")},this.resetStream_=function(){Bt.clearDtsInfo(o),m=void 0,S=void 0},this.getGopForFusion_=function(C){var w=45e3,k=1/0,B,W,oe,Q,de;for(de=0;de<this.gopCache_.length;de++)Q=this.gopCache_[de],oe=Q.gop,!(!(o.pps&&Lu(o.pps[0],Q.pps[0]))||!(o.sps&&Lu(o.sps[0],Q.sps[0])))&&(oe.dts<o.timelineStartInfo.dts||(B=C.dts-oe.dts-oe.duration,B>=-1e4&&B<=w&&(!W||k>B)&&(W=Q,k=B)));return W?W.gop:null},this.alignGopsAtStart_=function(C){var w,k,B,W,oe,Q,de,Te;for(oe=C.byteLength,Q=C.nalCount,de=C.duration,w=k=0;w<p.length&&k<C.length&&(B=p[w],W=C[k],B.pts!==W.pts);){if(W.pts>B.pts){w++;continue}k++,oe-=W.byteLength,Q-=W.nalCount,de-=W.duration}return k===0?C:k===C.length?null:(Te=C.slice(k),Te.byteLength=oe,Te.duration=de,Te.nalCount=Q,Te.pts=Te[0].pts,Te.dts=Te[0].dts,Te)},this.alignGopsAtEnd_=function(C){var w,k,B,W,oe,Q;for(w=p.length-1,k=C.length-1,oe=null,Q=!1;w>=0&&k>=0;){if(B=p[w],W=C[k],B.pts===W.pts){Q=!0;break}if(B.pts>W.pts){w--;continue}w===p.length-1&&(oe=k),k--}if(!Q&&oe===null)return null;var de;if(Q?de=k:de=oe,de===0)return C;var Te=C.slice(de),Je=Te.reduce(function(bt,_i){return bt.byteLength+=_i.byteLength,bt.duration+=_i.duration,bt.nalCount+=_i.nalCount,bt},{byteLength:0,duration:0,nalCount:0});return Te.byteLength=Je.byteLength,Te.duration=Je.duration,Te.nalCount=Je.nalCount,Te.pts=Te[0].pts,Te.dts=Te[0].dts,Te},this.alignGopsWith=function(C){p=C}},Gr.prototype=new Vr,Ri=function(o,c){this.numberOfTracks=0,this.metadataStream=c,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ri.prototype.init.call(this),this.push=function(h){if(h.content||h.text)return this.pendingCaptions.push(h);if(h.frames)return this.pendingMetadata.push(h);this.pendingTracks.push(h.track),this.pendingBytes+=h.boxes.byteLength,h.track.type==="video"&&(this.videoTrack=h.track,this.pendingBoxes.push(h.boxes)),h.track.type==="audio"&&(this.audioTrack=h.track,this.pendingBoxes.unshift(h.boxes))}},Ri.prototype=new Vr,Ri.prototype.flush=function(o){var c=0,h={captions:[],captionStreams:{},metadata:[],info:{}},d,p,m,S=0,C;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(S=this.videoTrack.timelineStartInfo.pts,Iu.forEach(function(w){h.info[w]=this.videoTrack[w]},this)):this.audioTrack&&(S=this.audioTrack.timelineStartInfo.pts,ku.forEach(function(w){h.info[w]=this.audioTrack[w]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,m=$s.initSegment(this.pendingTracks),h.initSegment=new Uint8Array(m.byteLength),h.initSegment.set(m),h.data=new Uint8Array(this.pendingBytes),C=0;C<this.pendingBoxes.length;C++)h.data.set(this.pendingBoxes[C],c),c+=this.pendingBoxes[C].byteLength;for(C=0;C<this.pendingCaptions.length;C++)d=this.pendingCaptions[C],d.startTime=zr.metadataTsToSeconds(d.startPts,S,this.keepOriginalTimestamps),d.endTime=zr.metadataTsToSeconds(d.endPts,S,this.keepOriginalTimestamps),h.captionStreams[d.stream]=!0,h.captions.push(d);for(C=0;C<this.pendingMetadata.length;C++)p=this.pendingMetadata[C],p.cueTime=zr.metadataTsToSeconds(p.pts,S,this.keepOriginalTimestamps),h.metadata.push(p);for(h.metadata.dispatchType=this.metadataStream.dispatchType,this.pendingTracks.length=0,this.videoTrack=null,this.pendingBoxes.length=0,this.pendingCaptions.length=0,this.pendingBytes=0,this.pendingMetadata.length=0,this.trigger("data",h),C=0;C<h.captions.length;C++)d=h.captions[C],this.trigger("caption",d);for(C=0;C<h.metadata.length;C++)p=h.metadata[C],this.trigger("id3Frame",p)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ri.prototype.setRemux=function(o){this.remuxTracks=o},Wr=function(o){var c=this,h=!0,d,p;Wr.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="aac",m.metadataStream=new ri.MetadataStream,m.aacStream=new mp,m.audioTimestampRolloverStream=new ri.TimestampRolloverStream("audio"),m.timedMetadataTimestampRolloverStream=new ri.TimestampRolloverStream("timed-metadata"),m.adtsStream=new Du,m.coalesceStream=new Ri(o,m.metadataStream),m.headOfPipeline=m.aacStream,m.aacStream.pipe(m.audioTimestampRolloverStream).pipe(m.adtsStream),m.aacStream.pipe(m.timedMetadataTimestampRolloverStream).pipe(m.metadataStream).pipe(m.coalesceStream),m.metadataStream.on("timestamp",function(S){m.aacStream.setTimestamp(S.timeStamp)}),m.aacStream.on("data",function(S){S.type!=="timed-metadata"&&S.type!=="audio"||m.audioSegmentStream||(p=p||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new Hs(p,o),m.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream),c.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d}))}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),Pu(this,m)},this.setupTsPipeline=function(){var m={};this.transmuxPipeline_=m,m.type="ts",m.metadataStream=new ri.MetadataStream,m.packetStream=new ri.TransportPacketStream,m.parseStream=new ri.TransportParseStream,m.elementaryStream=new ri.ElementaryStream,m.timestampRolloverStream=new ri.TimestampRolloverStream,m.adtsStream=new Du,m.h264Stream=new pp,m.captionStream=new ri.CaptionStream(o),m.coalesceStream=new Ri(o,m.metadataStream),m.headOfPipeline=m.packetStream,m.packetStream.pipe(m.parseStream).pipe(m.elementaryStream).pipe(m.timestampRolloverStream),m.timestampRolloverStream.pipe(m.h264Stream),m.timestampRolloverStream.pipe(m.adtsStream),m.timestampRolloverStream.pipe(m.metadataStream).pipe(m.coalesceStream),m.h264Stream.pipe(m.captionStream).pipe(m.coalesceStream),m.elementaryStream.on("data",function(S){var C;if(S.type==="metadata"){for(C=S.tracks.length;C--;)!d&&S.tracks[C].type==="video"?(d=S.tracks[C],d.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!p&&S.tracks[C].type==="audio"&&(p=S.tracks[C],p.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);d&&!m.videoSegmentStream&&(m.coalesceStream.numberOfTracks++,m.videoSegmentStream=new Gr(d,o),m.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),m.videoSegmentStream.on("timelineStartInfo",function(w){p&&!o.keepOriginalTimestamps&&(p.timelineStartInfo=w,m.audioSegmentStream.setEarliestDts(w.dts-c.baseMediaDecodeTime))}),m.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),m.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),m.videoSegmentStream.on("baseMediaDecodeTime",function(w){p&&m.audioSegmentStream.setVideoBaseMediaDecodeTime(w)}),m.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),m.h264Stream.pipe(m.videoSegmentStream).pipe(m.coalesceStream)),p&&!m.audioSegmentStream&&(m.coalesceStream.numberOfTracks++,m.audioSegmentStream=new Hs(p,o),m.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),m.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),m.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),m.adtsStream.pipe(m.audioSegmentStream).pipe(m.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d})}}),m.coalesceStream.on("data",this.trigger.bind(this,"data")),m.coalesceStream.on("id3Frame",function(S){S.dispatchType=m.metadataStream.dispatchType,c.trigger("id3Frame",S)}),m.coalesceStream.on("caption",this.trigger.bind(this,"caption")),m.coalesceStream.on("done",this.trigger.bind(this,"done")),Pu(this,m)},this.setBaseMediaDecodeTime=function(m){var S=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=m),p&&(p.timelineStartInfo.dts=void 0,p.timelineStartInfo.pts=void 0,Bt.clearDtsInfo(p),S.audioTimestampRolloverStream&&S.audioTimestampRolloverStream.discontinuity()),d&&(S.videoSegmentStream&&(S.videoSegmentStream.gopCache_=[]),d.timelineStartInfo.dts=void 0,d.timelineStartInfo.pts=void 0,Bt.clearDtsInfo(d),S.captionStream.reset()),S.timestampRolloverStream&&S.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(m){p&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(m)},this.setRemux=function(m){var S=this.transmuxPipeline_;o.remux=m,S&&S.coalesceStream&&S.coalesceStream.setRemux(m)},this.alignGopsWith=function(m){d&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(m)},this.getLogTrigger_=function(m){var S=this;return function(C){C.stream=m,S.trigger("log",C)}},this.push=function(m){if(h){var S=gp(m);S&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!S&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),h=!1}this.transmuxPipeline_.headOfPipeline.push(m)},this.flush=function(){h=!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()}},Wr.prototype=new Vr;var Tp={Transmuxer:Wr},vp=function(o){return o>>>0},bp=function(o){return("00"+o.toString(16)).slice(-2)},Xr={toUnsigned:vp,toHexString:bp},xp=function(o){var c="";return c+=String.fromCharCode(o[0]),c+=String.fromCharCode(o[1]),c+=String.fromCharCode(o[2]),c+=String.fromCharCode(o[3]),c},Ru=xp,Sp=Xr.toUnsigned,Ep=Ru,Nu=function(o,c){var h=[],d,p,m,S,C;if(!c.length)return null;for(d=0;d<o.byteLength;)p=Sp(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3]),m=Ep(o.subarray(d+4,d+8)),S=p>1?d+p:o.byteLength,m===c[0]&&(c.length===1?h.push(o.subarray(d+8,S)):(C=Nu(o.subarray(d+8,S),c.slice(1)),C.length&&(h=h.concat(C)))),d=S;return h},ua=Nu,Cp=Xr.toUnsigned,wp=n.getUint64,Ap=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=wp(o.subarray(4)):c.baseMediaDecodeTime=Cp(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},la=Ap,Dp=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),h={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4)},d=h.flags[2]&1,p=h.flags[2]&2,m=h.flags[2]&8,S=h.flags[2]&16,C=h.flags[2]&32,w=h.flags[0]&65536,k=h.flags[0]&131072,B;return B=8,d&&(B+=4,h.baseDataOffset=c.getUint32(12),B+=4),p&&(h.sampleDescriptionIndex=c.getUint32(B),B+=4),m&&(h.defaultSampleDuration=c.getUint32(B),B+=4),S&&(h.defaultSampleSize=c.getUint32(B),B+=4),C&&(h.defaultSampleFlags=c.getUint32(B)),w&&(h.durationIsEmpty=!0),!d&&k&&(h.baseDataOffsetIsMoof=!0),h},Mu=Dp,kp=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},Ip=kp,Bu=Ip,Pp=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},h=new DataView(o.buffer,o.byteOffset,o.byteLength),d=c.flags[2]&1,p=c.flags[2]&4,m=c.flags[1]&1,S=c.flags[1]&2,C=c.flags[1]&4,w=c.flags[1]&8,k=h.getUint32(4),B=8,W;for(d&&(c.dataOffset=h.getInt32(B),B+=4),p&&k&&(W={flags:Bu(o.subarray(B,B+4))},B+=4,m&&(W.duration=h.getUint32(B),B+=4),S&&(W.size=h.getUint32(B),B+=4),w&&(c.version===1?W.compositionTimeOffset=h.getInt32(B):W.compositionTimeOffset=h.getUint32(B),B+=4),c.samples.push(W),k--);k--;)W={},m&&(W.duration=h.getUint32(B),B+=4),S&&(W.size=h.getUint32(B),B+=4),C&&(W.flags=Bu(o.subarray(B,B+4)),B+=4),w&&(c.version===1?W.compositionTimeOffset=h.getInt32(B):W.compositionTimeOffset=h.getUint32(B),B+=4),c.samples.push(W);return c},Fu=Pp,Uu={tfdt:la,trun:Fu},ju={parseTfdt:Uu.tfdt,parseTrun:Uu.trun},Lp=function(o){for(var c=0,h=String.fromCharCode(o[c]),d="";h!=="\0";)d+=h,c++,h=String.fromCharCode(o[c]);return d+=h,d},Op={uint8ToCString:Lp},Kr=Op.uint8ToCString,Rp=n.getUint64,Np=function(o){var c=4,h=o[0],d,p,m,S,C,w,k,B;if(h===0){d=Kr(o.subarray(c)),c+=d.length,p=Kr(o.subarray(c)),c+=p.length;var W=new DataView(o.buffer);m=W.getUint32(c),c+=4,C=W.getUint32(c),c+=4,w=W.getUint32(c),c+=4,k=W.getUint32(c),c+=4}else if(h===1){var W=new DataView(o.buffer);m=W.getUint32(c),c+=4,S=Rp(o.subarray(c)),c+=8,w=W.getUint32(c),c+=4,k=W.getUint32(c),c+=4,d=Kr(o.subarray(c)),c+=d.length,p=Kr(o.subarray(c)),c+=p.length}B=new Uint8Array(o.subarray(c,o.byteLength));var oe={scheme_id_uri:d,value:p,timescale:m||1,presentation_time:S,presentation_time_delta:C,event_duration:w,id:k,message_data:B};return Bp(h,oe)?oe:void 0},Mp=function(o,c,h,d){return o||o===0?o/c:d+h/c},Bp=function(o,c){var h=c.scheme_id_uri!=="\0",d=o===0&&qu(c.presentation_time_delta)&&h,p=o===1&&qu(c.presentation_time)&&h;return!(o>1)&&d||p},qu=function(o){return o!==void 0||o!==null},Fp={parseEmsgBox:Np,scaleTime:Mp},zs;typeof window<"u"?zs=window:typeof s<"u"?zs=s:typeof self<"u"?zs=self:zs={};var $u=zs,Yr=Xr.toUnsigned,Gs=Xr.toHexString,ze=ua,Qi=Ru,ca=Fp,Up=Mu,jp=Fu,qp=la,$p=n.getUint64,Vu,Hu,zu,Gu,Wu,da,Xu,ha=$u,Vp=yu.parseId3Frames;Vu=function(o){var c={},h=ze(o,["moov","trak"]);return h.reduce(function(d,p){var m,S,C,w,k;return m=ze(p,["tkhd"])[0],!m||(S=m[0],C=S===0?12:20,w=Yr(m[C]<<24|m[C+1]<<16|m[C+2]<<8|m[C+3]),k=ze(p,["mdia","mdhd"])[0],!k)?null:(S=k[0],C=S===0?12:20,d[w]=Yr(k[C]<<24|k[C+1]<<16|k[C+2]<<8|k[C+3]),d)},c)},Hu=function(o,c){var h;h=ze(c,["moof","traf"]);var d=h.reduce(function(p,m){var S=ze(m,["tfhd"])[0],C=Yr(S[4]<<24|S[5]<<16|S[6]<<8|S[7]),w=o[C]||9e4,k=ze(m,["tfdt"])[0],B=new DataView(k.buffer,k.byteOffset,k.byteLength),W;k[0]===1?W=$p(k.subarray(4,12)):W=B.getUint32(4);let oe;return typeof W=="bigint"?oe=W/ha.BigInt(w):typeof W=="number"&&!isNaN(W)&&(oe=W/w),oe<Number.MAX_SAFE_INTEGER&&(oe=Number(oe)),oe<p&&(p=oe),p},1/0);return typeof d=="bigint"||isFinite(d)?d:0},zu=function(o,c){var h=ze(c,["moof","traf"]),d=0,p=0,m;if(h&&h.length){var S=ze(h[0],["tfhd"])[0],C=ze(h[0],["trun"])[0],w=ze(h[0],["tfdt"])[0];if(S){var k=Up(S);m=k.trackId}if(w){var B=qp(w);d=B.baseMediaDecodeTime}if(C){var W=jp(C);W.samples&&W.samples.length&&(p=W.samples[0].compositionTimeOffset||0)}}var oe=o[m]||9e4;typeof d=="bigint"&&(p=ha.BigInt(p),oe=ha.BigInt(oe));var Q=(d+p)/oe;return typeof Q=="bigint"&&Q<Number.MAX_SAFE_INTEGER&&(Q=Number(Q)),Q},Gu=function(o){var c=ze(o,["moov","trak"]),h=[];return c.forEach(function(d){var p=ze(d,["mdia","hdlr"]),m=ze(d,["tkhd"]);p.forEach(function(S,C){var w=Qi(S.subarray(8,12)),k=m[C],B,W,oe;w==="vide"&&(B=new DataView(k.buffer,k.byteOffset,k.byteLength),W=B.getUint8(0),oe=W===0?B.getUint32(12):B.getUint32(20),h.push(oe))})}),h},da=function(o){var c=o[0],h=c===0?12:20;return Yr(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3])},Wu=function(o){var c=ze(o,["moov","trak"]),h=[];return c.forEach(function(d){var p={},m=ze(d,["tkhd"])[0],S,C;m&&(S=new DataView(m.buffer,m.byteOffset,m.byteLength),C=S.getUint8(0),p.id=C===0?S.getUint32(12):S.getUint32(20));var w=ze(d,["mdia","hdlr"])[0];if(w){var k=Qi(w.subarray(8,12));k==="vide"?p.type="video":k==="soun"?p.type="audio":p.type=k}var B=ze(d,["mdia","minf","stbl","stsd"])[0];if(B){var W=B.subarray(8);p.codec=Qi(W.subarray(4,8));var oe=ze(W,[p.codec])[0],Q,de;oe&&(/^[asm]vc[1-9]$/i.test(p.codec)?(Q=oe.subarray(78),de=Qi(Q.subarray(4,8)),de==="avcC"&&Q.length>11?(p.codec+=".",p.codec+=Gs(Q[9]),p.codec+=Gs(Q[10]),p.codec+=Gs(Q[11])):p.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(p.codec)?(Q=oe.subarray(28),de=Qi(Q.subarray(4,8)),de==="esds"&&Q.length>20&&Q[19]!==0?(p.codec+="."+Gs(Q[19]),p.codec+="."+Gs(Q[20]>>>2&63).replace(/^0/,"")):p.codec="mp4a.40.2"):p.codec=p.codec.toLowerCase())}var Te=ze(d,["mdia","mdhd"])[0];Te&&(p.timescale=da(Te)),h.push(p)}),h},Xu=function(o,c=0){var h=ze(o,["emsg"]);return h.map(d=>{var p=ca.parseEmsgBox(new Uint8Array(d)),m=Vp(p.message_data);return{cueTime:ca.scaleTime(p.presentation_time,p.timescale,p.presentation_time_delta,c),duration:ca.scaleTime(p.event_duration,p.timescale),frames:m}})};var Ws={findBox:ze,parseType:Qi,timescale:Vu,startTime:Hu,compositionStartTime:zu,videoTrackIds:Gu,tracks:Wu,getTimescaleFromMediaHeader:da,getEmsgID3:Xu};const{parseTrun:Hp}=ju,{findBox:Ku}=Ws;var Yu=$u,zp=function(o){var c=Ku(o,["moof","traf"]),h=Ku(o,["mdat"]),d=[];return h.forEach(function(p,m){var S=c[m];d.push({mdat:p,traf:S})}),d},Gp=function(o,c,h){var d=c,p=h.defaultSampleDuration||0,m=h.defaultSampleSize||0,S=h.trackId,C=[];return o.forEach(function(w){var k=Hp(w),B=k.samples;B.forEach(function(W){W.duration===void 0&&(W.duration=p),W.size===void 0&&(W.size=m),W.trackId=S,W.dts=d,W.compositionTimeOffset===void 0&&(W.compositionTimeOffset=0),typeof d=="bigint"?(W.pts=d+Yu.BigInt(W.compositionTimeOffset),d+=Yu.BigInt(W.duration)):(W.pts=d+W.compositionTimeOffset,d+=W.duration)}),C=C.concat(B)}),C},Qu={getMdatTrafPairs:zp,parseSamples:Gp},Wp=At.discardEmulationPreventionBytes,Xp=pu.CaptionStream,fa=ua,Kp=la,Yp=Mu,{getMdatTrafPairs:Qp,parseSamples:Jp}=Qu,Zp=function(o,c){for(var h=o,d=0;d<c.length;d++){var p=c[d];if(h<p.size)return p;h-=p.size}return null},em=function(o,c,h){var d=new DataView(o.buffer,o.byteOffset,o.byteLength),p={logs:[],seiNals:[]},m,S,C,w;for(S=0;S+4<o.length;S+=C)if(C=d.getUint32(S),S+=4,!(C<=0))switch(o[S]&31){case 6:var k=o.subarray(S+1,S+1+C),B=Zp(S,c);if(m={nalUnitType:"sei_rbsp",size:C,data:k,escapedRBSP:Wp(k),trackId:h},B)m.pts=B.pts,m.dts=B.dts,w=B;else if(w)m.pts=w.pts,m.dts=w.dts;else{p.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+S+" for trackId "+h+". See mux.js#223."});break}p.seiNals.push(m);break}return p},tm=function(o,c){var h={},d=Qp(o);return d.forEach(function(p){var m=p.mdat,S=p.traf,C=fa(S,["tfhd"]),w=Yp(C[0]),k=w.trackId,B=fa(S,["tfdt"]),W=B.length>0?Kp(B[0]).baseMediaDecodeTime:0,oe=fa(S,["trun"]),Q,de;c===k&&oe.length>0&&(Q=Jp(oe,W,w),de=em(m,Q,k),h[k]||(h[k]={seiNals:[],logs:[]}),h[k].seiNals=h[k].seiNals.concat(de.seiNals),h[k].logs=h[k].logs.concat(de.logs))}),h},im=function(o,c,h){var d;if(c===null)return null;d=tm(o,c);var p=d[c]||{};return{seiNals:p.seiNals,logs:p.logs,timescale:h}},sm=function(){var o=!1,c,h,d,p,m,S;this.isInitialized=function(){return o},this.init=function(C){c=new Xp,o=!0,S=C?C.isPartial:!1,c.on("data",function(w){w.startTime=w.startPts/p,w.endTime=w.endPts/p,m.captions.push(w),m.captionStreams[w.stream]=!0}),c.on("log",function(w){m.logs.push(w)})},this.isNewInit=function(C,w){return C&&C.length===0||w&&typeof w=="object"&&Object.keys(w).length===0?!1:d!==C[0]||p!==w[d]},this.parse=function(C,w,k){var B;if(this.isInitialized()){if(!w||!k)return null;if(this.isNewInit(w,k))d=w[0],p=k[d];else if(d===null||!p)return h.push(C),null}else return null;for(;h.length>0;){var W=h.shift();this.parse(W,w,k)}return B=im(C,d,p),B&&B.logs&&(m.logs=m.logs.concat(B.logs)),B===null||!B.seiNals?m.logs.length?{logs:m.logs,captions:[],captionStreams:[]}:null:(this.pushNals(B.seiNals),this.flushStream(),m)},this.pushNals=function(C){if(!this.isInitialized()||!C||C.length===0)return null;C.forEach(function(w){c.push(w)})},this.flushStream=function(){if(!this.isInitialized())return null;S?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){m.captions=[],m.captionStreams={},m.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;c.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){h=[],d=null,p=null,m?this.clearParsedCaptions():m={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},rm=sm;const{parseTfdt:nm}=ju,gi=ua,{getTimescaleFromMediaHeader:am}=Ws,{parseSamples:om,getMdatTrafPairs:um}=Qu;var Ju=function(){let o=9e4;this.init=function(c){const h=gi(c,["moov","trak","mdia","mdhd"])[0];h&&(o=am(h))},this.parseSegment=function(c){const h=[],d=um(c);let p=0;return d.forEach(function(m){const S=m.mdat,C=m.traf,w=gi(C,["tfdt"])[0],k=gi(C,["tfhd"])[0],B=gi(C,["trun"]);if(w&&(p=nm(w).baseMediaDecodeTime),B.length&&k){const W=om(B,p,k);let oe=0;W.forEach(function(Q){const de="utf-8",Te=new TextDecoder(de),Je=S.slice(oe,oe+Q.size);if(gi(Je,["vtte"])[0]){oe+=Q.size;return}gi(Je,["vttc"]).forEach(function(Xs){const Ks=gi(Xs,["payl"])[0],Ys=gi(Xs,["sttg"])[0],Qs=Q.pts/o,Zr=(Q.pts+Q.duration)/o;let Re,Js;if(Ks)try{Re=Te.decode(Ks)}catch(Ft){console.error(Ft)}if(Ys)try{Js=Te.decode(Ys)}catch(Ft){console.error(Ft)}Q.duration&&Re&&h.push({cueText:Re,start:Qs,end:Zr,settings:Js})}),oe+=Q.size})}}),h}},pa=Or,Zu=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},Qr=function(o){return!!(o[1]&64)},Jr=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},lm=function(o,c){var h=Zu(o);return h===0?"pat":h===c?"pmt":c?"pes":null},cm=function(o){var c=Qr(o),h=4+Jr(o);return c&&(h+=o[h]+1),(o[h+10]&31)<<8|o[h+11]},dm=function(o){var c={},h=Qr(o),d=4+Jr(o);if(h&&(d+=o[d]+1),!!(o[d+5]&1)){var p,m,S;p=(o[d+1]&15)<<8|o[d+2],m=3+p-4,S=(o[d+10]&15)<<8|o[d+11];for(var C=12+S;C<m;){var w=d+C;c[(o[w+1]&31)<<8|o[w+2]]=o[w],C+=((o[w+3]&15)<<8|o[w+4])+5}return c}},hm=function(o,c){var h=Zu(o),d=c[h];switch(d){case pa.H264_STREAM_TYPE:return"video";case pa.ADTS_STREAM_TYPE:return"audio";case pa.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},fm=function(o){var c=Qr(o);if(!c)return null;var h=4+Jr(o);if(h>=o.byteLength)return null;var d=null,p;return p=o[h+7],p&192&&(d={},d.pts=(o[h+9]&14)<<27|(o[h+10]&255)<<20|(o[h+11]&254)<<12|(o[h+12]&255)<<5|(o[h+13]&254)>>>3,d.pts*=4,d.pts+=(o[h+13]&6)>>>1,d.dts=d.pts,p&64&&(d.dts=(o[h+14]&14)<<27|(o[h+15]&255)<<20|(o[h+16]&254)<<12|(o[h+17]&255)<<5|(o[h+18]&254)>>>3,d.dts*=4,d.dts+=(o[h+18]&6)>>>1)),d},ma=function(o){switch(o){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}},pm=function(o){for(var c=4+Jr(o),h=o.subarray(c),d=0,p=0,m=!1,S;p<h.byteLength-3;p++)if(h[p+2]===1){d=p+5;break}for(;d<h.byteLength;)switch(h[d]){case 0:if(h[d-1]!==0){d+=2;break}else if(h[d-2]!==0){d++;break}p+3!==d-2&&(S=ma(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0));do d++;while(h[d]!==1&&d<h.length);p=d-2,d+=3;break;case 1:if(h[d-1]!==0||h[d-2]!==0){d+=3;break}S=ma(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0),p=d-2,d+=3;break;default:d+=3;break}return h=h.subarray(p),d-=p,p=0,h&&h.byteLength>3&&(S=ma(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(m=!0)),m},mm={parseType:lm,parsePat:cm,parsePmt:dm,parsePayloadUnitStartIndicator:Qr,parsePesType:hm,parsePesTime:fm,videoPacketContainsKeyFrame:pm},el=Or,Ji=gu.handleRollover,De={};De.ts=mm,De.aac=oa;var Ni=Ce.ONE_SECOND_IN_TS,lt=188,zt=71,gm=function(o,c){for(var h=0,d=lt,p,m;d<o.byteLength;){if(o[h]===zt&&o[d]===zt){switch(p=o.subarray(h,d),m=De.ts.parseType(p,c.pid),m){case"pat":c.pid=De.ts.parsePat(p);break;case"pmt":var S=De.ts.parsePmt(p);c.table=c.table||{},Object.keys(S).forEach(function(C){c.table[C]=S[C]});break}h+=lt,d+=lt;continue}h++,d++}},tl=function(o,c,h){for(var d=0,p=lt,m,S,C,w,k,B=!1;p<=o.byteLength;){if(o[d]===zt&&(o[p]===zt||p===o.byteLength)){if(m=o.subarray(d,p),S=De.ts.parseType(m,c.pid),S==="pes"&&(C=De.ts.parsePesType(m,c.table),w=De.ts.parsePayloadUnitStartIndicator(m),C==="audio"&&w&&(k=De.ts.parsePesTime(m),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d+=lt,p+=lt;continue}d++,p++}for(p=o.byteLength,d=p-lt,B=!1;d>=0;){if(o[d]===zt&&(o[p]===zt||p===o.byteLength)){if(m=o.subarray(d,p),S=De.ts.parseType(m,c.pid),S==="pes"&&(C=De.ts.parsePesType(m,c.table),w=De.ts.parsePayloadUnitStartIndicator(m),C==="audio"&&w&&(k=De.ts.parsePesTime(m),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d-=lt,p-=lt;continue}d--,p--}},_m=function(o,c,h){for(var d=0,p=lt,m,S,C,w,k,B,W,oe,Q=!1,de={data:[],size:0};p<o.byteLength;){if(o[d]===zt&&o[p]===zt){switch(m=o.subarray(d,p),S=De.ts.parseType(m,c.pid),S){case"pes":if(C=De.ts.parsePesType(m,c.table),w=De.ts.parsePayloadUnitStartIndicator(m),C==="video"&&(w&&!Q&&(k=De.ts.parsePesTime(m),k&&(k.type="video",h.video.push(k),Q=!0)),!h.firstKeyFrame)){if(w&&de.size!==0){for(B=new Uint8Array(de.size),W=0;de.data.length;)oe=de.data.shift(),B.set(oe,W),W+=oe.byteLength;if(De.ts.videoPacketContainsKeyFrame(B)){var Te=De.ts.parsePesTime(B);Te?(h.firstKeyFrame=Te,h.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}de.size=0}de.data.push(m),de.size+=m.byteLength}break}if(Q&&h.firstKeyFrame)break;d+=lt,p+=lt;continue}d++,p++}for(p=o.byteLength,d=p-lt,Q=!1;d>=0;){if(o[d]===zt&&o[p]===zt){if(m=o.subarray(d,p),S=De.ts.parseType(m,c.pid),S==="pes"&&(C=De.ts.parsePesType(m,c.table),w=De.ts.parsePayloadUnitStartIndicator(m),C==="video"&&w&&(k=De.ts.parsePesTime(m),k&&(k.type="video",h.video.push(k),Q=!0))),Q)break;d-=lt,p-=lt;continue}d--,p--}},ym=function(o,c){if(o.audio&&o.audio.length){var h=c;(typeof h>"u"||isNaN(h))&&(h=o.audio[0].dts),o.audio.forEach(function(m){m.dts=Ji(m.dts,h),m.pts=Ji(m.pts,h),m.dtsTime=m.dts/Ni,m.ptsTime=m.pts/Ni})}if(o.video&&o.video.length){var d=c;if((typeof d>"u"||isNaN(d))&&(d=o.video[0].dts),o.video.forEach(function(m){m.dts=Ji(m.dts,d),m.pts=Ji(m.pts,d),m.dtsTime=m.dts/Ni,m.ptsTime=m.pts/Ni}),o.firstKeyFrame){var p=o.firstKeyFrame;p.dts=Ji(p.dts,d),p.pts=Ji(p.pts,d),p.dtsTime=p.dts/Ni,p.ptsTime=p.pts/Ni}}},Tm=function(o){for(var c=!1,h=0,d=null,p=null,m=0,S=0,C;o.length-S>=3;){var w=De.aac.parseType(o,S);switch(w){case"timed-metadata":if(o.length-S<10){c=!0;break}if(m=De.aac.parseId3TagSize(o,S),m>o.length){c=!0;break}p===null&&(C=o.subarray(S,S+m),p=De.aac.parseAacTimestamp(C)),S+=m;break;case"audio":if(o.length-S<7){c=!0;break}if(m=De.aac.parseAdtsSize(o,S),m>o.length){c=!0;break}d===null&&(C=o.subarray(S,S+m),d=De.aac.parseSampleRate(C)),h++,S+=m;break;default:S++;break}if(c)return null}if(d===null||p===null)return null;var k=Ni/d,B={audio:[{type:"audio",dts:p,pts:p},{type:"audio",dts:p+h*1024*k,pts:p+h*1024*k}]};return B},vm=function(o){var c={pid:null,table:null},h={};gm(o,c);for(var d in c.table)if(c.table.hasOwnProperty(d)){var p=c.table[d];switch(p){case el.H264_STREAM_TYPE:h.video=[],_m(o,c,h),h.video.length===0&&delete h.video;break;case el.ADTS_STREAM_TYPE:h.audio=[],tl(o,c,h),h.audio.length===0&&delete h.audio;break}}return h},bm=function(o,c){var h=De.aac.isLikelyAacData(o),d;return h?d=Tm(o):d=vm(o),!d||!d.audio&&!d.video?null:(ym(d,c),d)},xm={inspect:bm,parseAudioPes_:tl};const Sm=function(o,c){c.on("data",function(h){const d=h.initSegment;h.initSegment={data:d.buffer,byteOffset:d.byteOffset,byteLength:d.byteLength};const p=h.data;h.data=p.buffer,o.postMessage({action:"data",segment:h,byteOffset:p.byteOffset,byteLength:p.byteLength},[h.data])}),c.on("done",function(h){o.postMessage({action:"done"})}),c.on("gopInfo",function(h){o.postMessage({action:"gopInfo",gopInfo:h})}),c.on("videoSegmentTimingInfo",function(h){const d={start:{decode:Ce.videoTsToSeconds(h.start.dts),presentation:Ce.videoTsToSeconds(h.start.pts)},end:{decode:Ce.videoTsToSeconds(h.end.dts),presentation:Ce.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:Ce.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=Ce.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:d})}),c.on("audioSegmentTimingInfo",function(h){const d={start:{decode:Ce.videoTsToSeconds(h.start.dts),presentation:Ce.videoTsToSeconds(h.start.pts)},end:{decode:Ce.videoTsToSeconds(h.end.dts),presentation:Ce.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:Ce.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=Ce.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:d})}),c.on("id3Frame",function(h){o.postMessage({action:"id3Frame",id3Frame:h})}),c.on("caption",function(h){o.postMessage({action:"caption",caption:h})}),c.on("trackinfo",function(h){o.postMessage({action:"trackinfo",trackInfo:h})}),c.on("audioTimingInfo",function(h){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:Ce.videoTsToSeconds(h.start),end:Ce.videoTsToSeconds(h.end)}})}),c.on("videoTimingInfo",function(h){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Ce.videoTsToSeconds(h.start),end:Ce.videoTsToSeconds(h.end)}})}),c.on("log",function(h){o.postMessage({action:"log",log:h})})};class il{constructor(c,h){this.options=h||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Tp.Transmuxer(this.options),Sm(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new rm,this.captionParser.init());const h=new Uint8Array(c.data,c.byteOffset,c.byteLength),d=this.captionParser.parse(h,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:d&&d.captions||[],logs:d&&d.logs||[],data:h.buffer},[h.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new Ju);const h=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(h)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new Ju);const h=new Uint8Array(c.data,c.byteOffset,c.byteLength),d=this.webVttParser.parseSegment(h);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:d||[],data:h.buffer},[h.buffer])}probeMp4StartTime({timescales:c,data:h}){const d=Ws.startTime(c,h);this.self.postMessage({action:"probeMp4StartTime",startTime:d,data:h},[h.buffer])}probeMp4Tracks({data:c}){const h=Ws.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:h,data:c},[c.buffer])}probeEmsgID3({data:c,offset:h}){const d=Ws.getEmsgID3(c,h);this.self.postMessage({action:"probeEmsgID3",id3Frames:d,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:h}){const d=typeof h=="number"&&!isNaN(h)?h*Ce.ONE_SECOND_IN_TS:void 0,p=xm.inspect(c,d);let m=null;p&&(m={hasVideo:p.video&&p.video.length===2||!1,hasAudio:p.audio&&p.audio.length===2||!1},m.hasVideo&&(m.videoStart=p.video[0].ptsTime),m.hasAudio&&(m.audioStart=p.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:m,data:c},[c.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(c){const h=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(h)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const h=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(Ce.secondsToVideoTs(h)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(Ce.secondsToVideoTs(c.appendStart)))}setRemux(c){this.transmuxer.setRemux(c.remux)}flush(c){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(c){this.transmuxer.alignGopsWith(c.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new il(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new il(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var jT=af(UT);const qT=(s,e,t)=>{const{type:i,initSegment:r,captions:n,captionStreams:a,metadata:u,videoFrameDtsTime:l,videoFramePtsTime:f}=s.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:u});const g=s.data.segment.boxes||{data:s.data.segment.data},_={type:i,data:new Uint8Array(g.data,g.data.byteOffset,g.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof l<"u"&&(_.videoFrameDtsTime=l),typeof f<"u"&&(_.videoFramePtsTime=f),t(_)},$T=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},VT=(s,e)=>{e.gopInfo=s.data.gopInfo},lf=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:u,onAudioTimingInfo:l,onVideoTimingInfo:f,onVideoSegmentTimingInfo:g,onAudioSegmentTimingInfo:_,onId3:A,onCaptions:x,onDone:L,onEndedTimeline:T,onTransmuxerLog:I,isEndOfTimeline:M,segment:N,triggerSegmentEventFn:O}=s,j={buffer:[]};let F=M;const U=H=>{e.currentTransmux===s&&(H.data.action==="data"&&qT(H,j,a),H.data.action==="trackinfo"&&u(H.data.trackInfo),H.data.action==="gopInfo"&&VT(H,j),H.data.action==="audioTimingInfo"&&l(H.data.audioTimingInfo),H.data.action==="videoTimingInfo"&&f(H.data.videoTimingInfo),H.data.action==="videoSegmentTimingInfo"&&g(H.data.videoSegmentTimingInfo),H.data.action==="audioSegmentTimingInfo"&&_(H.data.audioSegmentTimingInfo),H.data.action==="id3Frame"&&A([H.data.id3Frame],H.data.id3Frame.dispatchType),H.data.action==="caption"&&x(H.data.caption),H.data.action==="endedtimeline"&&(F=!1,T()),H.data.action==="log"&&I(H.data.log),H.data.type==="transmuxed"&&(F||(e.onmessage=null,$T({transmuxedData:j,callback:L}),cf(e))))},R=()=>{const H={message:"Received an error message from the transmuxer worker",metadata:{errorType:q.Error.StreamingFailedToTransmuxSegment,segmentInfo:Ui({segment:N})}};L(null,H)};if(e.onmessage=U,e.onerror=R,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof n<"u"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const H=t instanceof ArrayBuffer?t:t.buffer,v=t instanceof ArrayBuffer?0:t.byteOffset;O({type:"segmenttransmuxingstart",segment:N}),e.postMessage({action:"push",data:H,byteOffset:v,byteLength:t.byteLength},[H])}M&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},cf=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():lf(s.currentTransmux))},Tc=(s,e)=>{s.postMessage({action:e}),cf(s)},df=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,Tc(e,s);return}e.transmuxQueue.push(Tc.bind(null,e,s))},HT=s=>{df("reset",s)},zT=s=>{df("endTimeline",s)},hf=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,lf(s);return}s.transmuxer.transmuxQueue.push(s)},GT=s=>{const e=new jT;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:s}),e};var Ya={reset:HT,endTimeline:zT,transmux:hf,createTransmuxer:GT};const hs=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,r=Ge({},s,{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,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),i(a.data))};if(e.addEventListener("message",n),s.data){const a=s.data instanceof ArrayBuffer;r.byteOffset=a?0:s.data.byteOffset,r.byteLength=s.data.byteLength;const u=[a?s.data:s.data.buffer];e.postMessage(r,u)}else e.postMessage(r)},Jt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},ff="wvtt",So=s=>{s.forEach(e=>{e.abort()})},WT=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),XT=s=>{const e=s.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=s.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},hu=(s,e)=>{const{requestType:t}=e,i=Gi({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Jt.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Jt.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Jt.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Jt.FAILURE,xhr:e,metadata:i}:null},vc=(s,e,t,i)=>(r,n)=>{const a=n.response,u=hu(r,n);if(u)return t(u,s);if(a.byteLength!==16)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Jt.FAILURE,xhr:n},s);const l=new DataView(a),f=new Uint32Array([l.getUint32(0),l.getUint32(4),l.getUint32(8),l.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=f;const g={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:s,keyInfo:g}),t(null,s)},KT=(s,e)=>{e===ff&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},YT=(s,e,t)=>{e===ff&&hs({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:r})=>{s.bytes=i,t(null,s,{mp4VttCues:r})}})},pf=(s,e)=>{const t=No(s.map.bytes);if(t!=="mp4"){const i=s.map.resolvedUri||s.map.uri,r=t||"unknown";return e({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${i}`,code:Jt.FAILURE,metadata:{mediaType:r}})}hs({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:i,data:r})=>(s.map.bytes=r,i.forEach(function(n){s.map.tracks=s.map.tracks||{},!s.map.tracks[n.type]&&(s.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[n.id]=n.timescale),n.type==="text"&&KT(s,n.codec))}),e(null))})},QT=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,r)=>{const n=hu(i,r);if(n)return e(n,s);const a=new Uint8Array(r.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,pf(s,function(u){if(u)return u.xhr=r,u.status=r.status,e(u,s);e(null,s)})},JT=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(r,n)=>{const a=hu(r,n);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const u=t==="arraybuffer"||!n.responseText?n.response:BT(n.responseText.substring(s.lastReachedChar||0));return s.stats=WT(n),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},ZT=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})=>{const L=s.map&&s.map.tracks||{},T=!!(L.audio&&L.video);let I=i.bind(null,s,"audio","start");const M=i.bind(null,s,"audio","end");let N=i.bind(null,s,"video","start");const O=i.bind(null,s,"video","end"),j=()=>hf({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:F=>{F.type=F.type==="combined"?"video":F.type,g(s,F)},onTrackInfo:F=>{t&&(T&&(F.isMuxed=!0),t(s,F))},onAudioTimingInfo:F=>{I&&typeof F.start<"u"&&(I(F.start),I=null),M&&typeof F.end<"u"&&M(F.end)},onVideoTimingInfo:F=>{N&&typeof F.start<"u"&&(N(F.start),N=null),O&&typeof F.end<"u"&&O(F.end)},onVideoSegmentTimingInfo:F=>{const U={pts:{start:F.start.presentation,end:F.end.presentation},dts:{start:F.start.decode,end:F.end.decode}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:U}),r(F)},onAudioSegmentTimingInfo:F=>{const U={pts:{start:F.start.pts,end:F.end.pts},dts:{start:F.start.dts,end:F.end.dts}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:U}),n(F)},onId3:(F,U)=>{a(s,F,U)},onCaptions:F=>{u(s,[F])},isEndOfTimeline:l,onEndedTimeline:()=>{f()},onTransmuxerLog:A,onDone:(F,U)=>{_&&(F.type=F.type==="combined"?"video":F.type,x({type:"segmenttransmuxingcomplete",segment:s}),_(U,s,F))},segment:s,triggerSegmentEventFn:x});hs({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:F=>{s.bytes=e=F.data;const U=F.result;U&&(t(s,{hasAudio:U.hasAudio,hasVideo:U.hasVideo,isMuxed:T}),t=null),j()}})},mf=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})=>{let L=new Uint8Array(e);if(v_(L)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){g(s,{data:L,type:"text"}),YT(s,T.text.codec,_);return}const M={isFmp4:!0,hasVideo:!!T.video,hasAudio:!!T.audio};T.audio&&T.audio.codec&&T.audio.codec!=="enca"&&(M.audioCodec=T.audio.codec),T.video&&T.video.codec&&T.video.codec!=="encv"&&(M.videoCodec=T.video.codec),T.video&&T.audio&&(M.isMuxed=!0),t(s,M);const N=(O,j)=>{g(s,{data:L,type:M.hasAudio&&!M.isMuxed?"audio":"video"}),j&&j.length&&a(s,j),O&&O.length&&u(s,O),_(null,s,{})};hs({action:"probeMp4StartTime",timescales:s.map.timescales,data:L,transmuxer:s.transmuxer,callback:({data:O,startTime:j})=>{e=O.buffer,s.bytes=L=O,M.hasAudio&&!M.isMuxed&&i(s,"audio","start",j),M.hasVideo&&i(s,"video","start",j),hs({action:"probeEmsgID3",data:L,transmuxer:s.transmuxer,offset:j,callback:({emsgData:F,id3Frames:U})=>{if(e=F.buffer,s.bytes=L=F,!T.video||!F.byteLength||!s.transmuxer){N(void 0,U);return}hs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:L,timescales:s.map.timescales,trackIds:[T.video.id],callback:R=>{e=R.data.buffer,s.bytes=L=R.data,R.logs.forEach(function(H){A(Ae(H,{stream:"mp4CaptionParser"}))}),N(R.captions,U)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=No(L)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}ZT({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})},gf=function({id:s,key:e,encryptedBytes:t,decryptionWorker:i,segment:r,doneFn:n},a){const u=f=>{if(f.data.source===s){i.removeEventListener("message",u);const g=f.data.decrypted;a(new Uint8Array(g.bytes,g.byteOffset,g.byteLength))}};i.onerror=()=>{const f="An error occurred in the decryption worker",g=Ui({segment:r}),_={message:f,metadata:{error:new Error(f),errorType:q.Error.StreamingFailedToDecryptSegment,segmentInfo:g,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};n(_,r)},i.addEventListener("message",u);let l;e.bytes.slice?l=e.bytes.slice():l=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(Zh({source:s,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},ev=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})=>{x({type:"segmentdecryptionstart"}),gf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},L=>{e.bytes=L,x({type:"segmentdecryptioncomplete",segment:e}),mf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})})},tv=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})=>{let L=0,T=!1;return(I,M)=>{if(!T){if(I)return T=!0,So(s),_(I,M);if(L+=1,L===s.length){const N=function(){if(M.encryptedBytes)return ev({decryptionWorker:e,segment:M,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x});mf({segment:M,bytes:M.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g,doneFn:_,onTransmuxerLog:A,triggerSegmentEventFn:x})};if(M.endOfAllRequests=Date.now(),M.map&&M.map.encryptedBytes&&!M.map.bytes)return x({type:"segmentdecryptionstart",segment:M}),gf({decryptionWorker:e,id:M.requestId+"-init",encryptedBytes:M.map.encryptedBytes,key:M.map.key,segment:M,doneFn:_},O=>{M.map.bytes=O,x({type:"segmentdecryptioncomplete",segment:M}),pf(M,j=>{if(j)return So(s),_(j,M);N()})});N()}}}},iv=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},sv=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:g})=>_=>{if(!_.target.aborted)return s.stats=Ae(s.stats,XT(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},rv=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:g,captionsFn:_,isEndOfTimeline:A,endedTimelineFn:x,dataFn:L,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:M})=>{const N=[],O=tv({activeXhrs:N,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:g,captionsFn:_,isEndOfTimeline:A,endedTimelineFn:x,dataFn:L,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:M});if(i.key&&!i.key.bytes){const H=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&H.push(i.map.key);const v=Ae(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),E=vc(i,H,O,M),$={uri:i.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:$});const G=s(v,E);N.push(G)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const G=Ae(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),V=vc(i,[i.map.key],O,M),J={uri:i.map.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:J});const se=s(G,V);N.push(se)}const v=Ae(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:bo(i.map),requestType:"segment-media-initialization"}),E=QT({segment:i,finishProcessingFn:O,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const $=s(v,E);N.push($)}const j=Ae(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:bo(i),requestType:"segment"}),F=JT({segment:i,finishProcessingFn:O,responseType:j.responseType,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const U=s(j,F);U.addEventListener("progress",sv({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:g,captionsFn:_,isEndOfTimeline:A,endedTimelineFn:x,dataFn:L})),N.push(U);const R={};return N.forEach(H=>{H.addEventListener("loadend",iv({loadendState:R,abortFn:r}))}),()=>So(N)},an=Rt("PlaylistSelector"),bc=function(s){if(!s||!s.playlist)return;const e=s.playlist;return JSON.stringify({id:e.id,bandwidth:s.bandwidth,width:s.width,height:s.height,codecs:e.attributes&&e.attributes.CODECS||""})},fs=function(s,e){if(!s)return"";const t=D.getComputedStyle(s);return t?t[e]:""},ps=function(s,e){const t=s.slice();s.sort(function(i,r){const n=e(i,r);return n===0?t.indexOf(i)-t.indexOf(r):n})},fu=function(s,e){let t,i;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||D.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||D.Number.MAX_VALUE,t-i},nv=function(s,e){let t,i;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||D.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||D.Number.MAX_VALUE,t===i&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let _f=function(s){const{main:e,bandwidth:t,playerWidth:i,playerHeight:r,playerObjectFit:n,limitRenditionByPlayerDimensions:a,playlistController:u}=s;if(!e)return;const l={bandwidth:t,width:i,height:r,limitRenditionByPlayerDimensions:a};let f=e.playlists;_t.isAudioOnly(e)&&(f=u.getAudioTrackPlaylists_(),l.audioOnly=!0);let g=f.map(R=>{let H;const v=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,E=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return H=R.attributes&&R.attributes.BANDWIDTH,H=H||D.Number.MAX_VALUE,{bandwidth:H,width:v,height:E,playlist:R}});ps(g,(R,H)=>R.bandwidth-H.bandwidth),g=g.filter(R=>!_t.isIncompatible(R.playlist));let _=g.filter(R=>_t.isEnabled(R.playlist));_.length||(_=g.filter(R=>!_t.isDisabled(R.playlist)));const A=_.filter(R=>R.bandwidth*Ze.BANDWIDTH_VARIANCE<t);let x=A[A.length-1];const L=A.filter(R=>R.bandwidth===x.bandwidth)[0];if(a===!1){const R=L||_[0]||g[0];if(R&&R.playlist){let H="sortedPlaylistReps";return L&&(H="bandwidthBestRep"),_[0]&&(H="enabledPlaylistReps"),an(`choosing ${bc(R)} using ${H} with options`,l),R.playlist}return an("could not choose a playlist with options",l),null}const T=A.filter(R=>R.width&&R.height);ps(T,(R,H)=>R.width-H.width);const I=T.filter(R=>R.width===i&&R.height===r);x=I[I.length-1];const M=I.filter(R=>R.bandwidth===x.bandwidth)[0];let N,O,j;M||(N=T.filter(R=>n==="cover"?R.width>i&&R.height>r:R.width>i||R.height>r),O=N.filter(R=>R.width===N[0].width&&R.height===N[0].height),x=O[O.length-1],j=O.filter(R=>R.bandwidth===x.bandwidth)[0]);let F;if(u.leastPixelDiffSelector){const R=T.map(H=>(H.pixelDiff=Math.abs(H.width-i)+Math.abs(H.height-r),H));ps(R,(H,v)=>H.pixelDiff===v.pixelDiff?v.bandwidth-H.bandwidth:H.pixelDiff-v.pixelDiff),F=R[0]}const U=F||j||M||L||_[0]||g[0];if(U&&U.playlist){let R="sortedPlaylistReps";return F?R="leastPixelDiffRep":j?R="resolutionPlusOneRep":M?R="resolutionBestRep":L?R="bandwidthBestRep":_[0]&&(R="enabledPlaylistReps"),an(`choosing ${bc(U)} using ${R} with options`,l),U.playlist}return an("could not choose a playlist with options",l),null};const xc=function(){let s=this.useDevicePixelRatio&&D.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),_f({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(fs(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(fs(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?fs(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},av=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&D.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),_f({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(fs(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(fs(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?fs(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},ov=function(s){const{main:e,currentTime:t,bandwidth:i,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:u,syncController:l}=s,f=e.playlists.filter(L=>!_t.isIncompatible(L));let g=f.filter(_t.isEnabled);g.length||(g=f.filter(L=>!_t.isDisabled(L)));const A=g.filter(_t.hasAttribute.bind(null,"BANDWIDTH")).map(L=>{const I=l.getSyncPoint(L,r,u,t)?1:2,N=_t.estimateSegmentRequestTime(n,i,L)*I-a;return{playlist:L,rebufferingImpact:N}}),x=A.filter(L=>L.rebufferingImpact<=0);return ps(x,(L,T)=>fu(T.playlist,L.playlist)),x.length?x[0]:(ps(A,(L,T)=>L.rebufferingImpact-T.rebufferingImpact),A[0]||null)},uv=function(){const s=this.playlists.main.playlists.filter(_t.isEnabled);return ps(s,(t,i)=>fu(t,i)),s.filter(t=>!!fr(this.playlists.main,t).video)[0]||null},lv=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function yf(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const cv=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const r=e.textTracks().getTrackById(i);if(r)s[t]=r;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,u=t,l=!1;const f=n[i];f&&(a=f.label,u=f.language,l=f.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:l,label:a,language:u},!1).track}}},dv=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const i=D.WebKitDataCue||D.VTTCue;e.forEach(r=>{const n=r.stream;r.content?r.content.forEach(a=>{const u=new i(r.startTime+t,r.endTime+t,a.text);u.line=a.line,u.align="left",u.position=a.position,u.positionAlign="line-left",s[n].addCue(u)}):s[n].addCue(new i(r.startTime+t,r.endTime+t,r.text))})},hv=function(s){Object.defineProperties(s.frame,{id:{get(){return q.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return q.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return q.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},fv=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const r=D.WebKitDataCue||D.VTTCue,n=s.metadataTrack_;if(!n||(e.forEach(g=>{const _=g.cueTime+t;typeof _!="number"||D.isNaN(_)||_<0||!(_<1/0)||!g.frames||!g.frames.length||g.frames.forEach(A=>{const x=new r(_,_,A.value||A.url||A.data||"");x.frame=A,x.value=A,hv(x),n.addCue(x)})}),!n.cues||!n.cues.length))return;const a=n.cues,u=[];for(let g=0;g<a.length;g++)a[g]&&u.push(a[g]);const l=u.reduce((g,_)=>{const A=g[_.startTime]||[];return A.push(_),g[_.startTime]=A,g},{}),f=Object.keys(l).sort((g,_)=>Number(g)-Number(_));f.forEach((g,_)=>{const A=l[g],x=isFinite(i)?i:g,L=Number(f[_+1])||x;A.forEach(T=>{T.endTime=L})})},pv={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"},mv=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),gv=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const i=D.WebKitDataCue||D.VTTCue;e.forEach(r=>{for(const n of Object.keys(r)){if(mv.has(n))continue;const a=new i(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:pv[n],data:r[n]},(n==="scte35Out"||n==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}r.processDateRange()})},Sc=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,q.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},or=function(s,e,t){let i,r;if(t&&t.cues)for(i=t.cues.length;i--;)r=t.cues[i],r.startTime>=s&&r.endTime<=e&&t.removeCue(r)},_v=function(s){const e=s.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const r=e[i],n=`${r.startTime}-${r.endTime}-${r.text}`;t[n]?s.removeCue(r):t[n]=r}},yv=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const i=Math.ceil((e-t+3)*ji.ONE_SECOND_IN_TS);let r;for(r=0;r<s.length&&!(s[r].pts>i);r++);return s.slice(r)},Tv=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const i=e[0].pts;let r=0;for(r;r<s.length&&!(s[r].pts>=i);r++);return s.slice(0,r).concat(e)},vv=(s,e,t,i)=>{const r=Math.ceil((e-i)*ji.ONE_SECOND_IN_TS),n=Math.ceil((t-i)*ji.ONE_SECOND_IN_TS),a=s.slice();let u=s.length;for(;u--&&!(s[u].pts<=n););if(u===-1)return a;let l=u+1;for(;l--&&!(s[l].pts<=r););return l=Math.max(l,0),a.splice(l,u-l+1),a},bv=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let r=0;r<t.length;r++){const n=t[r];if(n!==i[r]||s[n]!==e[n])return!1}return!0},xv=function(s,e,t){e=e||[];const i=[];let r=0;for(let n=0;n<e.length;n++){const a=e[n];if(s===a.timeline&&(i.push(n),r+=a.duration,r>t))return n}return i.length===0?0:i[i.length-1]},sr=1,Sv=500,Ec=s=>typeof s=="number"&&isFinite(s),on=1/60,Ev=(s,e,t)=>s!=="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,Cv=(s,e,t)=>{let i=e-Ze.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const r=e-t;return Math.min(r,i)},is=s=>{const{startOfSegment:e,duration:t,segment:i,part:r,playlist:{mediaSequence:n,id:a,segments:u=[]},mediaIndex:l,partIndex:f,timeline:g}=s,_=u.length-1;let A="mediaIndex/partIndex increment";s.getMediaInfoForTime?A=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(A+=` with independent ${s.independent}`);const x=typeof f=="number",L=s.segment.uri?"segment":"pre-segment",T=x?Nh({preloadSegment:i})-1:0;return`${L} [${n+l}/${n+_}]`+(x?` part [${f}/${T}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(x?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${g}] selected by [${A}] playlist [${a}]`},Cc=s=>`${s}TimingInfo`,wv=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:r})=>!r&&s===e?null:s<e?t:i.length?i.end(i.length-1):t,Eo=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:r})=>{if(e===t)return!1;if(i==="audio"){const n=s.lastTimelineChange({type:"main"});return!n||n.to!==t}if(i==="main"&&r){const n=s.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},Av=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),i=e&&t,r=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&r)},Dv=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},vi=s=>{const e=s.pendingSegment_;if(!e)return;if(Eo({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&Av(s.timelineChangeController_)){if(Dv(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},kv=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:r,end:n}=i;let a;typeof r=="bigint"||typeof n=="bigint"?a=D.BigInt(n)-D.BigInt(r):typeof r=="number"&&typeof n=="number"&&(a=n-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},wc=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+Yt:!1,Iv=(s,e)=>{if(e!=="hls")return null;const t=kv({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,r=wc({segmentDuration:t,maxDuration:i*2}),n=wc({segmentDuration:t,maxDuration:i}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return r||n?{severity:r?"warn":"info",message:a}:null},Ui=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),r=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:r,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class Co extends q.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.captionServices_=e.captionServices,this.exactManifestTimings=e.exactManifestTimings,this.addMetadataToTextTrack=e.addMetadataToTextTrack,this.checkBufferTimeout_=null,this.error_=void 0,this.currentTimeline_=-1,this.shouldForceTimestampOffsetAfterResync_=!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.logger_=Rt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Ge({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Ge({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():vi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}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_&&D.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),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);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,D.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<"u"&&(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 tt();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:r}=e;if(i&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=In(e);let r=this.initSegments_[i];return t&&!r&&e.bytes&&(this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),r||e}segmentKey(e,t=!1){if(!e)return null;const i=ef(e);let r=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[i]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(r||e).resolvedUri};return r&&(n.bytes=r.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||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,r=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(i&&(i.id?n=i.id:i.uri&&(n=i.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
189
189
|
currentTime: ${this.currentTime_()}
|
|
190
|
-
bufferedEnd: ${
|
|
191
|
-
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.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-i.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 u=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!u.parts||!u.parts.length||!u.parts[this.partIndex])){const
|
|
190
|
+
bufferedEnd: ${Xa(this.buffered_())}
|
|
191
|
+
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.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-i.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 u=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!u.parts||!u.parts.length||!u.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}r&&(r.mediaIndex-=a,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(D.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&Ya.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},r=!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&&i()};(r||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=vv(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const u in this.inbandTextTracks_)or(e,t,this.inbandTextTracks_[u]);or(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&D.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=D.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&D.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=D.setTimeout(this.monitorBufferTick_.bind(this),Sv)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:Ui({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),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_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const r=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!r||!r.parts||i+1===r.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=Xa(e)||0,i=uu(e,this.currentTime_()),r=!this.hasPlayed_()&&i>=1,n=i>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||r||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const u={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(u.isSyncRequest)u.mediaIndex=xv(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${u.mediaIndex}`);else if(this.mediaIndex!==null){const A=a[this.mediaIndex],x=typeof this.partIndex=="number"?this.partIndex:-1;u.startOfSegment=A.end?A.end:t,A.parts&&A.parts[x+1]?(u.mediaIndex=this.mediaIndex,u.partIndex=x+1):u.mediaIndex=this.mediaIndex+1}else{let A,x,L;const T=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
192
192
|
For TargetTime: ${T}.
|
|
193
193
|
CurrentTime: ${this.currentTime_()}
|
|
194
194
|
BufferedEnd: ${t}
|
|
195
195
|
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
196
|
-
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const I=this.getSyncInfoFromMediaSequenceSync_(T);if(!I){const F="No sync info found while using media sequence sync";return this.error({message:F,metadata:{errorType:q.Error.StreamingFailedToSelectNextSegment,error:new Error(F)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${I.start} --> ${I.end})`),A=I.segmentIndex,S=I.partIndex,O=I.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const I=pt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=I.segmentIndex,S=I.partIndex,O=I.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,u.mediaIndex=A,u.startOfSegment=O,u.partIndex=S,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${u.mediaIndex} `)}const c=a[u.mediaIndex];let f=c&&typeof u.partIndex=="number"&&c.parts&&c.parts[u.partIndex];if(!c||typeof u.partIndex=="number"&&!f)return null;typeof u.partIndex!="number"&&c.parts&&(u.partIndex=0,f=c.parts[0]);const g=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&f&&!g&&!f.independent)if(u.partIndex===0){const A=a[u.mediaIndex-1],S=A.parts&&A.parts.length&&A.parts[A.parts.length-1];S&&S.independent&&(u.mediaIndex-=1,u.partIndex=A.parts.length-1,u.independent="previous segment")}else c.parts[u.partIndex-1].independent&&(u.partIndex-=1,u.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return u.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,u.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(u))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const r=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return r?(r.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),r):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:r,startOfSegment:n,isSyncRequest:a,partIndex:u,forceTimestampOffset:c,getMediaInfoForTime:f}=e,g=i.segments[r],_=typeof u=="number"&&g.parts[u],A={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||g.resolvedUri,mediaIndex:r,partIndex:_?u:null,isSyncRequest:a,startOfSegment:n,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:g.timeline,duration:_&&_.duration||g.duration,segment:g,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:f,independent:t},S=typeof c<"u"?c:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:g.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:S});const O=Wa(this.sourceUpdater_.audioBuffered());return typeof O=="number"&&(A.audioAppendStart=O-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=YT(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return rv(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_(),i=e.bandwidth,r=this.pendingSegment_.duration,n=pt.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=wy(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const u=UT({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!u)return;const f=n-a-u.rebufferingImpact;let g=.5;a<=Wt&&(g=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||f<g)&&(this.bandwidth=u.playlist.attributes.BANDWIDTH*Xe.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${ts(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:r}=t,n={segmentInfo:Fi({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:n}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},ZT(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this))))}handleTimingInfo_(e,t,i,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const n=this.pendingSegment_,a=Tc(t);n[a]=n[a]||{},n[a][i]=r,this.logger_(`timinginfo: ${t} - ${i} - ${r}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const r=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(a=>{n[a.stream]=n[a.stream]||{startTime:1/0,captions:[],endTime:0};const u=n[a.stream];u.startTime=Math.min(u.startTime,a.startTime+r),u.endTime=Math.max(u.endTime,a.endTime+r),u.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:u,endTime:c,captions:f}=n[a],g=this.inbandTextTracks_;this.logger_(`adding cues from ${u} -> ${c} for ${a}`),$T(g,this.vhs_.tech_,a),ar(u,c,g[a]),VT({captionArray:f,inbandTextTracks:g,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,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_()?!bo({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:i,hasVideo:r,isMuxed:n}=t;return!(r&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||bo({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_()){vi(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Tc(t.type)].start;else{const r=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&r&&r.hasVideo;let a;n&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==i.mediaIndex||r.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,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:i,playlist:r}){if(i){const n=kn(i);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=n}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},r){const n=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ji(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ji(a).join(", "));const u=n.length?n.start(0):0,c=n.length?n.end(n.length-1):0,f=a.length?a.start(0):0,g=a.length?a.end(a.length-1):0;if(c-u<=ir&&g-f<=ir){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${ji(n).join(", ")}, video buffer: ${ji(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:i}));const A=this.currentTime_()-ir;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${ir}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=D.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},ir*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},r){if(r){if(r.code===Oh){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:q.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:r,bytes:n}){if(!n){const u=[r];let c=r.byteLength;i&&(u.unshift(i),c+=i.byteLength),n=qT({bytes:c,segments:u})}const a={segmentInfo:Fi({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,n=`${e}TimingInfo`;r[n]||(r[n]={}),r[n].transmuxerPrependedSeconds=i.prependedContentDuration||0,r[n].transmuxedPresentationStart=i.start.presentation,r[n].transmuxedDecodeStart=i.start.decode,r[n].transmuxedPresentationEnd=i.end.presentation,r[n].transmuxedDecodeEnd=i.end.decode,r[n].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:r}=t;if(!r||!r.byteLength||i==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,data:r})}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_()){vi(this),this.loadQueue_.push(()=>{const t=$e({},e,{forceTimestampOffset:!0});$e(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),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||r&&n;this.logger_(`Requesting
|
|
197
|
-
${
|
|
198
|
-
${ts(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=MT({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:u,level:c,stream:f})=>{this.logger_(`${ts(e)} logged from transmuxer stream ${f} as a ${c}: ${u}`)},triggerSegmentEventFn:({type:u,segment:c,keyInfo:f,trackInfo:g,timingInfo:_})=>{const S={segmentInfo:Fi({segment:c})};f&&(S.keyInfo=f),g&&(S.trackInfo=g),_&&(S.timingInfo=_),this.trigger({type:u,metadata:S})}})}trimBackBuffer_(e){const t=sv(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,r=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:r,isMediaInitialization:n},u=e.playlist.segments[e.mediaIndex-1];if(u&&u.timeline===t.timeline&&(u.videoTimingInfo?a.baseStartTime=u.videoTimingInfo.transmuxedDecodeEnd:u.audioTimingInfo&&(a.baseStartTime=u.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<on){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${on}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Kt.ABORTED)return;if(this.pause(),e.code===Kt.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),r.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=QT(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(r)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:r,currentVideoTimestampOffset:n,useVideoTimingInfo:a,videoTimingInfo:u,audioTimingInfo:c}){if(typeof e<"u")return e;if(!a)return c.start;const f=t.segments[i-1];return i===0||!f||typeof f.start>"u"||f.end!==r+n?r:u.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:r,isMuxed:n}=t,a=this.loaderType_==="main"&&r,u=!this.audioDisabled_&&i&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,u&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),u&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=iv(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),r=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const c={segmentInfo:Fi({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:c})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=uv(e,this.sourceType_);if(t&&(t.severity==="warn"?q.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${ts(e)}`);return}this.logger_(`Appended ${ts(e)}`),this.addSegmentMetadataCue_(e),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 i=e.segment,r=e.part,n=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${ts(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.duration<on){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${on}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,r=t.end;if(!yc(i)||!yc(r))return;ar(i,r,this.segmentMetadataTrack_);const n=D.WebKitDataCue||D.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:r},u=JSON.stringify(a),c=new n(i,r,u);c.value=a,this.segmentMetadataTrack_.addCue(c)}}function ni(){}const af=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},lv=["video","audio"],So=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},cv=(s,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===s)return t}return null},fs=(s,e)=>{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),fs("audio",e),fs("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||So(s,e))){if(i.type!==s){if(t=cv(s,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=i,i.action(s,e),!i.doneFn){e.queuePending[s]=null,fs(s,e);return}}},of=(s,e)=>{const t=e[`${s}Buffer`],i=af(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},zt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Tt={appendBuffer:(s,e,t)=>(i,r)=>{const n=r[`${i}Buffer`];if(zt(r.mediaSource,n)){r.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${i}Buffer`);try{n.appendBuffer(s)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===Oh?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),r.queuePending[i]=null,t(a)}}},remove:(s,e)=>(t,i)=>{const r=i[`${t}Buffer`];if(zt(i.mediaSource,r)){i.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{r.remove(s,e)}catch{i.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const i=t[`${e}Buffer`];zt(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),i.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){q.log.warn("Failed to call media source endOfStream",t)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(t){q.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(zt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){q.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=af(s),r=ps(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",t[`on${i}UpdateEnd_`]),n.addEventListener("error",t[`on${i}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=n},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(of(s,e),!!zt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){q.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],r=ps(s);if(!zt(t.mediaSource,i))return;const n=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const c={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:c}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{i.changeType(r),t.codecs[e]=s}catch(f){c.errorType=q.Error.StreamingCodecsChangeError,c.error=f,f.metadata=c,t.error_=f,t.trigger("error"),q.log.warn(`Failed to changeType on ${e}Buffer`,f)}}},vt=({type:s,sourceUpdater:e,action:t,doneFn:i,name:r})=>{e.queue.push({type:s,action:t,doneFn:i,name:r}),fs(s,e)},bc=(s,e)=>t=>{const i=e[`${s}Buffered`](),r=Sy(i);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,r),e.queuePending[s]){const n=e.queuePending[s].doneFn;e.queuePending[s]=null,n&&n(e[`${s}Error_`])}fs(s,e)};class uf extends q.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>fs("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Lt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=bc("video",this),this.onAudioUpdateEnd_=bc("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:Tt.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){vt({type:e,sourceUpdater:this,action:Tt.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){q.log.error("removeSourceBuffer is not supported!");return}vt({type:"mediaSource",sourceUpdater:this,action:Tt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!q.browser.IS_FIREFOX&&D.MediaSource&&D.MediaSource.prototype&&typeof D.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return D.SourceBuffer&&D.SourceBuffer.prototype&&typeof D.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){q.log.error("changeType is not supported!");return}vt({type:e,sourceUpdater:this,action:Tt.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 i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:r,bytes:n}=e;if(this.processedAppend_=!0,r==="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:r,sourceUpdater:this,action:Tt.appendBuffer(n,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const u=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${u.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,u.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return zt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Ye()}videoBuffered(){return zt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Ye()}buffered(){const e=zt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=zt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Cy(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ni){vt({type:"mediaSource",sourceUpdater:this,action:Tt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ni){typeof e!="string"&&(e=void 0),vt({type:"mediaSource",sourceUpdater:this,action:Tt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=ni){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}vt({type:"audio",sourceUpdater:this,action:Tt.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=ni){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}vt({type:"video",sourceUpdater:this,action:Tt.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(So("audio",this)||So("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(vt({type:"audio",sourceUpdater:this,action:Tt.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(vt({type:"video",sourceUpdater:this,action:Tt.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&vt({type:"audio",sourceUpdater:this,action:Tt.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&vt({type:"video",sourceUpdater:this,action:Tt.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),lv.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>of(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const xc=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),dv=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Sc=new Uint8Array(`
|
|
196
|
+
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const I=this.getSyncInfoFromMediaSequenceSync_(T);if(!I){const M="No sync info found while using media sequence sync";return this.error({message:M,metadata:{errorType:q.Error.StreamingFailedToSelectNextSegment,error:new Error(M)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${I.start} --> ${I.end})`),A=I.segmentIndex,x=I.partIndex,L=I.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const I=_t.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=I.segmentIndex,x=I.partIndex,L=I.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,u.mediaIndex=A,u.startOfSegment=L,u.partIndex=x,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${u.mediaIndex} `)}const l=a[u.mediaIndex];let f=l&&typeof u.partIndex=="number"&&l.parts&&l.parts[u.partIndex];if(!l||typeof u.partIndex=="number"&&!f)return null;typeof u.partIndex!="number"&&l.parts&&(u.partIndex=0,f=l.parts[0]);const g=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&f&&!g&&!f.independent)if(u.partIndex===0){const A=a[u.mediaIndex-1],x=A.parts&&A.parts.length&&A.parts[A.parts.length-1];x&&x.independent&&(u.mediaIndex-=1,u.partIndex=A.parts.length-1,u.independent="previous segment")}else l.parts[u.partIndex-1].independent&&(u.partIndex-=1,u.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return u.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,u.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(u))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const r=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return r?(r.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),r):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:r,startOfSegment:n,isSyncRequest:a,partIndex:u,forceTimestampOffset:l,getMediaInfoForTime:f}=e,g=i.segments[r],_=typeof u=="number"&&g.parts[u],A={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||g.resolvedUri,mediaIndex:r,partIndex:_?u:null,isSyncRequest:a,startOfSegment:n,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:g.timeline,duration:_&&_.duration||g.duration,segment:g,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:f,independent:t},x=typeof l<"u"?l:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:g.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:x});const L=Xa(this.sourceUpdater_.audioBuffered());return typeof L=="number"&&(A.audioAppendStart=L-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=yv(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return wv(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_(),i=e.bandwidth,r=this.pendingSegment_.duration,n=_t.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=Xy(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const u=ov({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!u)return;const f=n-a-u.rebufferingImpact;let g=.5;a<=Yt&&(g=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||f<g)&&(this.bandwidth=u.playlist.attributes.BANDWIDTH*Ze.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${is(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:r}=t,n={segmentInfo:Ui({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:n}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},bv(this.currentMediaInfo_,t)||(this.appendInitSegment_={audio:!0,video:!0},this.startingMediaInfo_=t,this.currentMediaInfo_=t,this.logger_("trackinfo update",t),this.trigger("trackinfo")),!this.checkForAbort_(e.requestId)&&(this.pendingSegment_.trackInfo=t,this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this))))}handleTimingInfo_(e,t,i,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const n=this.pendingSegment_,a=Cc(t);n[a]=n[a]||{},n[a][i]=r,this.logger_(`timinginfo: ${t} - ${i} - ${r}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():vi(this)}handleCaptions_(e,t){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(t.length===0){this.logger_("SegmentLoader received no captions from a caption event");return}if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.caption.push(this.handleCaptions_.bind(this,e,t));return}const r=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(a=>{n[a.stream]=n[a.stream]||{startTime:1/0,captions:[],endTime:0};const u=n[a.stream];u.startTime=Math.min(u.startTime,a.startTime+r),u.endTime=Math.max(u.endTime,a.endTime+r),u.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:u,endTime:l,captions:f}=n[a],g=this.inbandTextTracks_;this.logger_(`adding cues from ${u} -> ${l} for ${a}`),cv(g,this.vhs_.tech_,a),or(u,l,g[a]),dv({captionArray:f,inbandTextTracks:g,timestampOffset:r})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,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_()?!Eo({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:i,hasVideo:r,isMuxed:n}=t;return!(r&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||Eo({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_()){vi(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[Cc(t.type)].start;else{const r=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&r&&r.hasVideo;let a;n&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==i.mediaIndex||r.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,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:i,playlist:r}){if(i){const n=In(i);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=n}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},r){const n=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+qi(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+qi(a).join(", "));const u=n.length?n.start(0):0,l=n.length?n.end(n.length-1):0,f=a.length?a.start(0):0,g=a.length?a.end(a.length-1):0;if(l-u<=sr&&g-f<=sr){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${qi(n).join(", ")}, video buffer: ${qi(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:i}));const A=this.currentTime_()-sr;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${sr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=D.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},sr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},r){if(r){if(r.code===Gh){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:q.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:r,bytes:n}){if(!n){const u=[r];let l=r.byteLength;i&&(u.unshift(i),l+=i.byteLength),n=lv({bytes:l,segments:u})}const a={segmentInfo:Ui({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,n=`${e}TimingInfo`;r[n]||(r[n]={}),r[n].transmuxerPrependedSeconds=i.prependedContentDuration||0,r[n].transmuxedPresentationStart=i.start.presentation,r[n].transmuxedDecodeStart=i.start.decode,r[n].transmuxedPresentationEnd=i.end.presentation,r[n].transmuxedDecodeEnd=i.end.decode,r[n].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:r}=t;if(!r||!r.byteLength||i==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,data:r})}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_()){vi(this),this.loadQueue_.push(()=>{const t=Ge({},e,{forceTimestampOffset:!0});Ge(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),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||r&&n;this.logger_(`Requesting
|
|
197
|
+
${yf(e.uri)}
|
|
198
|
+
${is(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=rv({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:u,level:l,stream:f})=>{this.logger_(`${is(e)} logged from transmuxer stream ${f} as a ${l}: ${u}`)},triggerSegmentEventFn:({type:u,segment:l,keyInfo:f,trackInfo:g,timingInfo:_})=>{const x={segmentInfo:Ui({segment:l})};f&&(x.keyInfo=f),g&&(x.trackInfo=g),_&&(x.timingInfo=_),this.trigger({type:u,metadata:x})}})}trimBackBuffer_(e){const t=Cv(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,r=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:r,isMediaInitialization:n},u=e.playlist.segments[e.mediaIndex-1];if(u&&u.timeline===t.timeline&&(u.videoTimingInfo?a.baseStartTime=u.videoTimingInfo.transmuxedDecodeEnd:u.audioTimingInfo&&(a.baseStartTime=u.audioTimingInfo.transmuxedDecodeEnd)),t.key){const l=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=l}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<on){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${on}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Jt.ABORTED)return;if(this.pause(),e.code===Jt.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const r=this.pendingSegment_;this.saveBandwidthRelatedStats_(r.duration,t.stats),r.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=Tv(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(r)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:r,currentVideoTimestampOffset:n,useVideoTimingInfo:a,videoTimingInfo:u,audioTimingInfo:l}){if(typeof e<"u")return e;if(!a)return l.start;const f=t.segments[i-1];return i===0||!f||typeof f.start>"u"||f.end!==r+n?r:u.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:r,isMuxed:n}=t,a=this.loaderType_==="main"&&r,u=!this.audioDisabled_&&i&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,u&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),u&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=Ev(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),r=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;r&&(e.timingInfo.end=typeof r.end=="number"?r.end:r.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const l={segmentInfo:Ui({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:l})}if(!this.pendingSegment_){this.state="READY",this.paused()||this.monitorBuffer_();return}const e=this.pendingSegment_;e.part&&e.part.syncInfo?e.part.syncInfo.markAppended():e.segment.syncInfo&&e.segment.syncInfo.markAppended(),this.updateTimingInfoEnd_(e),this.shouldSaveSegmentTimingInfo_&&this.syncController_.saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:this.loaderType_==="main"});const t=Iv(e,this.sourceType_);if(t&&(t.severity==="warn"?q.log.warn(t.message):this.logger_(t.message)),this.recordThroughput_(e),this.pendingSegment_=null,this.state="READY",e.isSyncRequest&&(this.trigger("syncinfoupdate"),!e.hasAppendedData_)){this.logger_(`Throwing away un-appended sync request ${is(e)}`);return}this.logger_(`Appended ${is(e)}`),this.addSegmentMetadataCue_(e),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 i=e.segment,r=e.part,n=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${is(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.duration<on){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${on}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,r=t.end;if(!Ec(i)||!Ec(r))return;or(i,r,this.segmentMetadataTrack_);const n=D.WebKitDataCue||D.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:r},u=JSON.stringify(a),l=new n(i,r,u);l.value=a,this.segmentMetadataTrack_.addCue(l)}}function oi(){}const Tf=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Pv=["video","audio"],wo=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},Lv=(s,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===s)return t}return null},ms=(s,e)=>{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),ms("audio",e),ms("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||wo(s,e))){if(i.type!==s){if(t=Lv(s,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=i,i.action(s,e),!i.doneFn){e.queuePending[s]=null,ms(s,e);return}}},vf=(s,e)=>{const t=e[`${s}Buffer`],i=Tf(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Xt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,xt={appendBuffer:(s,e,t)=>(i,r)=>{const n=r[`${i}Buffer`];if(Xt(r.mediaSource,n)){r.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${i}Buffer`);try{n.appendBuffer(s)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===Gh?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),r.queuePending[i]=null,t(a)}}},remove:(s,e)=>(t,i)=>{const r=i[`${t}Buffer`];if(Xt(i.mediaSource,r)){i.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{r.remove(s,e)}catch{i.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const i=t[`${e}Buffer`];Xt(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),i.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){q.log.warn("Failed to call media source endOfStream",t)}}},duration:s=>e=>{e.logger_(`Setting mediaSource duration to ${s}`);try{e.mediaSource.duration=s}catch(t){q.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Xt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){q.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=Tf(s),r=gs(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(r);n.addEventListener("updateend",t[`on${i}UpdateEnd_`]),n.addEventListener("error",t[`on${i}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=n},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(vf(s,e),!!Xt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){q.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],r=gs(s);if(!Xt(t.mediaSource,i))return;const n=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const l={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:l}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{i.changeType(r),t.codecs[e]=s}catch(f){l.errorType=q.Error.StreamingCodecsChangeError,l.error=f,f.metadata=l,t.error_=f,t.trigger("error"),q.log.warn(`Failed to changeType on ${e}Buffer`,f)}}},St=({type:s,sourceUpdater:e,action:t,doneFn:i,name:r})=>{e.queue.push({type:s,action:t,doneFn:i,name:r}),ms(s,e)},Ac=(s,e)=>t=>{const i=e[`${s}Buffered`](),r=zy(i);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,r),e.queuePending[s]){const n=e.queuePending[s].doneFn;e.queuePending[s]=null,n&&n(e[`${s}Error_`])}ms(s,e)};class bf extends q.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>ms("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Rt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Ac("video",this),this.onAudioUpdateEnd_=Ac("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){St({type:"mediaSource",sourceUpdater:this,action:xt.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){St({type:e,sourceUpdater:this,action:xt.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){q.log.error("removeSourceBuffer is not supported!");return}St({type:"mediaSource",sourceUpdater:this,action:xt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!q.browser.IS_FIREFOX&&D.MediaSource&&D.MediaSource.prototype&&typeof D.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return D.SourceBuffer&&D.SourceBuffer.prototype&&typeof D.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){q.log.error("changeType is not supported!");return}St({type:e,sourceUpdater:this,action:xt.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 i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:r,bytes:n}=e;if(this.processedAppend_=!0,r==="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(St({type:r,sourceUpdater:this,action:xt.appendBuffer(n,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const u=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${u.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,u.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return Xt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:tt()}videoBuffered(){return Xt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:tt()}buffered(){const e=Xt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Xt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Wy(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=oi){St({type:"mediaSource",sourceUpdater:this,action:xt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=oi){typeof e!="string"&&(e=void 0),St({type:"mediaSource",sourceUpdater:this,action:xt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=oi){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}St({type:"audio",sourceUpdater:this,action:xt.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=oi){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}St({type:"video",sourceUpdater:this,action:xt.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(wo("audio",this)||wo("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(St({type:"audio",sourceUpdater:this,action:xt.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(St({type:"video",sourceUpdater:this,action:xt.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&St({type:"audio",sourceUpdater:this,action:xt.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&St({type:"video",sourceUpdater:this,action:xt.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Pv.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>vf(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Dc=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),Ov=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},kc=new Uint8Array(`
|
|
199
199
|
|
|
200
|
-
`.split("").map(s=>s.charCodeAt(0)));class
|
|
201
|
-
`,a=i,u=t;this.start_=a,e.forEach((
|
|
202
|
-
`,
|
|
203
|
-
`,u++,a=A}),this.end_=a,this.storage_=r,this.diagnostics_=n}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const r=Math.min(...this.storage_.keys());if(e<r){const n=r-e;let a=this.storage_.get(r).segmentSyncInfo.start;for(let u=0;u<n;u++){const c=t[u];a-=c.duration}return a}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Cc extends lf{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const _v=86400,Ya=[{name:"VOD",run:(s,e,t,i,r)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,r,n)=>{const a=s.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const u=a.getSyncInfoForTime(r);return u?{time:u.start,partIndex:u.partIndex,segmentIndex:u.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,r)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let n=null,a=null;const u=fo(e);r=r||0;for(let c=0;c<u.length;c++){const f=e.endList||r===0?c:u.length-(c+1),g=u[f],_=g.segment,A=s.timelineToDatetimeMappings[_.timeline];if(!A||!_.dateTimeObject)continue;let O=_.dateTimeObject.getTime()/1e3+A;if(_.parts&&typeof g.partIndex=="number")for(let I=0;I<g.partIndex;I++)O+=_.parts[I].duration;const T=Math.abs(r-O);if(a!==null&&(T===0||a<T))break;a=T,n={time:O,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return n}},{name:"Segment",run:(s,e,t,i,r)=>{let n=null,a=null;r=r||0;const u=fo(e);for(let c=0;c<u.length;c++){const f=e.endList||r===0?c:u.length-(c+1),g=u[f],_=g.segment,A=g.part&&g.part.start||_&&_.start;if(_.timeline===i&&typeof A<"u"){const S=Math.abs(r-A);if(a!==null&&a<S)break;(!n||a===null||a>=S)&&(a=S,n={time:A,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return n}},{name:"Discontinuity",run:(s,e,t,i,r)=>{let n=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let u=0;u<e.discontinuityStarts.length;u++){const c=e.discontinuityStarts[u],f=e.discontinuitySequence+u+1,g=s.discontinuities[f];if(g){const _=Math.abs(r-g.time);if(a!==null&&a<_)break;(!n||a===null||a>=_)&&(a=_,n={time:g.time,segmentIndex:c,partIndex:null})}}}return n}},{name:"Playlist",run:(s,e,t,i,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class yv extends q.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new lf,i=new Cc(t),r=new Cc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=Lt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,r,n){if(t!==1/0)return Ya.find(({name:c})=>c==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,r,n);if(!a.length)return null;for(const u of a){const{syncPoint:c,strategy:f}=u,{segmentIndex:g,time:_}=c;if(g<0)continue;const A=e.segments[g],S=_,O=S+A.duration;if(this.logger_(`Strategy: ${f}. Current time: ${r}. selected segment: ${g}. Time: [${S} -> ${O}]}`),r>=S&&r<O)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(a,{key:"time",value:r})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const r=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+dr({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,r,n){const a=[];for(let u=0;u<Ya.length;u++){const c=Ya[u],f=c.run(this,e,t,i,r,n);f&&(f.strategy=c.name,a.push({strategy:c.name,syncPoint:f}))}return a}selectSyncPoint_(e,t){let i=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy;for(let a=1;a<e.length;a++){const u=Math.abs(e[a].syncPoint[t.key]-t.value);u<r&&(r=u,i=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>_v){q.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let r=i-1;r>=0;r--){const n=e.segments[r];if(n&&typeof n.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+r,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],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const n=r.dateTimeObject;r.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[r.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const r=e.segment,n=e.part;let a=this.timelines[e.timeline],u,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),u=e.startOfSegment,c=t.end+a.mapping;else if(a)u=t.start+a.mapping,c=t.end+a.mapping;else return!1;return n&&(n.start=u,n.end=c),(!r.start||u<r.start)&&(r.start=u),r.end=c,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let r=0;r<t.discontinuityStarts.length;r++){const n=t.discontinuityStarts[r],a=t.discontinuitySequence+r+1,u=n-e.mediaIndex,c=Math.abs(u);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>c){let f;u<0?f=i.start-dr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):f=i.end+dr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:f,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class Tv extends q.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const r={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const vv=Wh(Xh(function(){var s=(function(){function T(){this.listeners={}}var I=T.prototype;return I.on=function(N,R){this.listeners[N]||(this.listeners[N]=[]),this.listeners[N].push(R)},I.off=function(N,R){if(!this.listeners[N])return!1;var U=this.listeners[N].indexOf(R);return this.listeners[N]=this.listeners[N].slice(0),this.listeners[N].splice(U,1),U>-1},I.trigger=function(N){var R=this.listeners[N];if(R)if(arguments.length===2)for(var U=R.length,j=0;j<U;++j)R[j].call(this,arguments[1]);else for(var M=Array.prototype.slice.call(arguments,1),L=R.length,$=0;$<L;++$)R[$].apply(this,M)},I.dispose=function(){this.listeners={}},I.pipe=function(N){this.on("data",function(R){N.push(R)})},T})();function e(T){return T.subarray(0,T.byteLength-T[T.byteLength-1])}const t=function(){const T=[[[],[],[],[],[]],[[],[],[],[],[]]],I=T[0],F=T[1],N=I[4],R=F[4];let U,j,M;const L=[],$=[];let v,E,V,G,z,Q;for(U=0;U<256;U++)$[(L[U]=U<<1^(U>>7)*283)^U]=U;for(j=M=0;!N[j];j^=v||1,M=$[M]||1)for(G=M^M<<1^M<<2^M<<3^M<<4,G=G>>8^G&255^99,N[j]=G,R[G]=j,V=L[E=L[v=L[j]]],Q=V*16843009^E*65537^v*257^j*16843008,z=L[G]*257^G*16843008,U=0;U<4;U++)I[U][j]=z=z<<24^z>>>8,F[U][G]=Q=Q<<24^Q>>>8;for(U=0;U<5;U++)I[U]=I[U].slice(0),F[U]=F[U].slice(0);return T};let i=null;class r{constructor(I){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let F,N,R;const U=this._tables[0][4],j=this._tables[1],M=I.length;let L=1;if(M!==4&&M!==6&&M!==8)throw new Error("Invalid aes key size");const $=I.slice(0),v=[];for(this._key=[$,v],F=M;F<4*M+28;F++)R=$[F-1],(F%M===0||M===8&&F%M===4)&&(R=U[R>>>24]<<24^U[R>>16&255]<<16^U[R>>8&255]<<8^U[R&255],F%M===0&&(R=R<<8^R>>>24^L<<24,L=L<<1^(L>>7)*283)),$[F]=$[F-M]^R;for(N=0;F;N++,F--)R=$[N&3?F:F-4],F<=4||N<4?v[N]=R:v[N]=j[0][U[R>>>24]]^j[1][U[R>>16&255]]^j[2][U[R>>8&255]]^j[3][U[R&255]]}decrypt(I,F,N,R,U,j){const M=this._key[1];let L=I^M[0],$=R^M[1],v=N^M[2],E=F^M[3],V,G,z;const Q=M.length/4-2;let se,te=4;const X=this._tables[1],Z=X[0],J=X[1],ee=X[2],ie=X[3],pe=X[4];for(se=0;se<Q;se++)V=Z[L>>>24]^J[$>>16&255]^ee[v>>8&255]^ie[E&255]^M[te],G=Z[$>>>24]^J[v>>16&255]^ee[E>>8&255]^ie[L&255]^M[te+1],z=Z[v>>>24]^J[E>>16&255]^ee[L>>8&255]^ie[$&255]^M[te+2],E=Z[E>>>24]^J[L>>16&255]^ee[$>>8&255]^ie[v&255]^M[te+3],te+=4,L=V,$=G,v=z;for(se=0;se<4;se++)U[(3&-se)+j]=pe[L>>>24]<<24^pe[$>>16&255]<<16^pe[v>>8&255]<<8^pe[E&255]^M[te++],V=L,L=$,$=v,v=E,E=V}}class n extends s{constructor(){super(s),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(I){this.jobs.push(I),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(T){return T<<24|(T&65280)<<8|(T&16711680)>>8|T>>>24},u=function(T,I,F){const N=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),R=new r(Array.prototype.slice.call(I)),U=new Uint8Array(T.byteLength),j=new Int32Array(U.buffer);let M,L,$,v,E,V,G,z,Q;for(M=F[0],L=F[1],$=F[2],v=F[3],Q=0;Q<N.length;Q+=4)E=a(N[Q]),V=a(N[Q+1]),G=a(N[Q+2]),z=a(N[Q+3]),R.decrypt(E,V,G,z,j,Q),j[Q]=a(j[Q]^M),j[Q+1]=a(j[Q+1]^L),j[Q+2]=a(j[Q+2]^$),j[Q+3]=a(j[Q+3]^v),M=E,L=V,$=G,v=z;return U};class c{constructor(I,F,N,R){const U=c.STEP,j=new Int32Array(I.buffer),M=new Uint8Array(I.byteLength);let L=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(j.subarray(L,L+U),F,N,M)),L=U;L<j.length;L+=U)N=new Uint32Array([a(j[L-4]),a(j[L-3]),a(j[L-2]),a(j[L-1])]),this.asyncStream_.push(this.decryptChunk_(j.subarray(L,L+U),F,N,M));this.asyncStream_.push(function(){R(null,e(M))})}static get STEP(){return 32e3}decryptChunk_(I,F,N,R){return function(){const U=u(I,F,N);R.set(U,I.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},g;typeof window<"u"?g=window:typeof f<"u"?g=f:typeof self<"u"?g=self:g={};var _=g,A=function(I){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(I):I&&I.buffer instanceof ArrayBuffer},S=_.BigInt||Number;S("0x1"),S("0x100"),S("0x10000"),S("0x1000000"),S("0x100000000"),S("0x10000000000"),S("0x1000000000000"),S("0x100000000000000"),S("0x10000000000000000"),(function(){var T=new Uint16Array([65484]),I=new Uint8Array(T.buffer,T.byteOffset,T.byteLength);return I[0]===255?"big":I[0]===204?"little":"unknown"})();const O=function(T){const I={};return Object.keys(T).forEach(F=>{const N=T[F];A(N)?I[F]={bytes:N.buffer,byteOffset:N.byteOffset,byteLength:N.byteLength}:I[F]=N}),I};self.onmessage=function(T){const I=T.data,F=new Uint8Array(I.encrypted.bytes,I.encrypted.byteOffset,I.encrypted.byteLength),N=new Uint32Array(I.key.bytes,I.key.byteOffset,I.key.byteLength/4),R=new Uint32Array(I.iv.bytes,I.iv.byteOffset,I.iv.byteLength/4);new c(F,N,R,function(U,j){self.postMessage(O({source:I.source,decrypted:j}),[j.buffer])})}}));var bv=Gh(vv);const xv=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},cf=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Eo=(s,e)=>{e.activePlaylistLoader=s,s.load()},Sv=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:i},mediaTypes:{[s]:r}}=e,n=r.activeTrack(),a=r.getActiveGroup(),u=r.activePlaylistLoader,c=r.lastGroup_;if(!(a&&c&&a.id===c.id)&&(r.lastGroup_=a,r.lastTrack_=n,cf(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),Eo(a.playlistLoader,r)}},Ev=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Cv=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:i,main:r},mediaTypes:{[s]:n}}=e,a=n.activeTrack(),u=n.getActiveGroup(),c=n.activePlaylistLoader,f=n.lastTrack_;if(!(f&&a&&f.id===a.id)&&(n.lastGroup_=u,n.lastTrack_=a,cf(i,n),!!u)){if(u.isMainPlaylist){if(!a||!f||a.id===f.id)return;const g=e.vhs.playlistController_,_=g.selectPlaylist();if(g.media()===_)return;n.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),r.resetEverything(),g.fastQualityChange_(_);return}if(s==="AUDIO"){if(!u.playlistLoader){r.setAudio(!0),r.resetEverything();return}i.setAudio(!0),r.setAudio(!1)}if(c===u.playlistLoader){Eo(u.playlistLoader,n);return}i.track&&i.track(a),i.resetEverything(),Eo(u.playlistLoader,n)}},In={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:i}=e,r=t.activeTrack(),n=t.activeGroup(),a=(n.filter(c=>c.default)[0]||n[0]).id,u=t.tracks[a];if(r===u){i({error:{message:"Problem encountered loading the default audio track."}});return}q.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===u;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;q.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},wc={AUDIO:(s,e,t)=>{if(!e)return;const{tech:i,requestOptions:r,segmentLoaders:{[s]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,r),(!i.paused()||a.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),r),i.paused()||n.load()}),e.on("error",In[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:i,requestOptions:r,segmentLoaders:{[s]:n},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const u=e.media();n.playlist(u,r),n.track(a.activeTrack()),(!i.paused()||u.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),r),i.paused()||n.load()}),e.on("error",In[s](s,t))}},wv={AUDIO:(s,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[s]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[s]:{groups:u,tracks:c,logger_:f}},mainPlaylistLoader:g}=e,_=Er(g.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},_&&(a[s].main.default.playlists=g.main.playlists));for(const A in a[s]){u[A]||(u[A]=[]);for(const S in a[s][A]){let O=a[s][A][S],T;if(_?(f(`AUDIO group '${A}' label '${S}' is a main playlist`),O.isMainPlaylist=!0,T=null):i==="vhs-json"&&O.playlists?T=new rs(O.playlists[0],t,n):O.resolvedUri?T=new rs(O.resolvedUri,t,n):O.playlists&&i==="dash"?T=new To(O.playlists[0],t,n,g):T=null,O=Ce({id:S,playlistLoader:T},O),wc[s](s,O.playlistLoader,e),u[A].push(O),typeof c[S]>"u"){const I=new q.AudioTrack({id:S,kind:xv(O),enabled:!1,language:O.language,default:O.default,label:S});c[S]=I}}}r.on("error",In[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:i,sourceType:r,segmentLoaders:{[s]:n},requestOptions:a,main:{mediaGroups:u},mediaTypes:{[s]:{groups:c,tracks:f}},mainPlaylistLoader:g}=e;for(const _ in u[s]){c[_]||(c[_]=[]);for(const A in u[s][_]){if(!i.options_.useForcedSubtitles&&u[s][_][A].forced)continue;let S=u[s][_][A],O;if(r==="hls")O=new rs(S.resolvedUri,i,a);else if(r==="dash"){if(!S.playlists.filter(I=>I.excludeUntil!==1/0).length)return;O=new To(S.playlists[0],i,a,g)}else r==="vhs-json"&&(O=new rs(S.playlists?S.playlists[0]:S.resolvedUri,i,a));if(S=Ce({id:A,playlistLoader:O},S),wc[s](s,S.playlistLoader,e),c[_].push(S),typeof f[A]>"u"){const T=t.addRemoteTextTrack({id:A,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:A},!1).track;f[A]=T}}}n.on("error",In[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[s]:{groups:r,tracks:n}}}=e;for(const a in i[s]){r[a]||(r[a]=[]);for(const u in i[s][a]){const c=i[s][a][u];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const f=t.options_.vhs&&t.options_.vhs.captionServices||{};let g={label:u,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(f[g.instreamId]&&(g=Ce(g,f[g.instreamId])),g.default===void 0&&delete g.default,r[a].push(Ce({id:u},c)),typeof n[u]>"u"){const _=t.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;n[u]=_}}}}},df=(s,e)=>{for(let t=0;t<s.length;t++)if(ou(e,s[t])||s[t].playlists&&df(s[t].playlists,e))return!0;return!1},Av=(s,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[s]:{groups:r}}}=e,n=i.media();if(!n)return null;let a=null;n.attributes[s]&&(a=r[n.attributes[s]]);const u=Object.keys(r);if(!a)if(s==="AUDIO"&&u.length>1&&Er(e.main))for(let c=0;c<u.length;c++){const f=r[u[c]];if(df(f,n)){a=f;break}}else r.main?a=r.main:u.length===1&&(a=r[u[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},Dv={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},kv=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},Iv=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{wv[f](f,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:r,segmentLoaders:{["AUDIO"]:n,main:a}}=s;["AUDIO","SUBTITLES"].forEach(f=>{e[f].activeGroup=Av(f,s),e[f].activeTrack=Dv[f](f,s),e[f].onGroupChanged=Sv(f,s),e[f].onGroupChanging=Ev(f,s),e[f].onTrackChanged=Cv(f,s),e[f].getActiveGroup=kv(f,s)});const u=e.AUDIO.activeGroup();if(u){const f=(u.filter(_=>_.default)[0]||u[0]).id;e.AUDIO.tracks[f].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(f=>e[f].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",c),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{i.audioTracks().removeEventListener("change",c),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const f in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[f])},Pv=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ni,activeTrack:ni,getActiveGroup:ni,onGroupChanged:ni,onTrackChanged:ni,lastTrack_:null,logger_:Lt(`MediaGroups[${e}]`)}}),s};class Ac{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=ft(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class Lv extends q.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Ac,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Lt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=ft(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const f=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${f} seconds.`),this.startTTLTimeout_(parseInt(f,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let u;try{u=JSON.parse(this.request_.responseText)}catch(f){const g={errorType:q.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:g})}this.assignSteeringProperties_(u);const c={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new D.URL(e),i=new D.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(D.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new D.URL(e),i=this.getPathway(),r=this.getBandwidth_();if(i){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,i)}if(r){const n=`_${this.manifestType_}_throughput`;t.searchParams.set(n,r)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=r=>this.excludedSteeringManifestURLs.has(r);if(this.proxyServerUrl_){const r=this.setProxyServerUrl_(e);if(!t(r))return r}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=D.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){D.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Ac}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(ft(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const Ov=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},Rv=10;let bi;const Nv=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Mv=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},Bv=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:u,log:c}){if(!i)return q.log.warn("We received no playlist to switch to. Please check your stream."),!1;const f=`allowing switch ${s&&s.id||"null"} -> ${i.id}`;if(!s)return c(`${f} as current playlist is not set`),!0;if(i.id===s.id)return!1;const g=!!ss(e,t).length;if(!s.endList)return!g&&typeof s.partTargetDuration=="number"?(c(`not ${f} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${f} as current playlist is live`),!0);const _=ru(e,t),A=u?Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Xe.MAX_BUFFER_LOW_WATER_LINE;if(a<A)return c(`${f} as duration < max low water line (${a} < ${A})`),!0;const S=i.attributes.BANDWIDTH,O=s.attributes.BANDWIDTH;if(S<O&&(!u||_<n)){let T=`${f} as next bandwidth < current bandwidth (${S} < ${O})`;return u&&(T+=` and forwardBuffer < bufferHighWaterLine (${_} < ${n})`),c(T),!0}if((!u||S>O)&&_>=r){let T=`${f} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return u&&(T+=` and next bandwidth > current bandwidth (${S} > ${O})`),c(T),!0}return c(`not ${f} as no switching criteria met`),!1};class Fv extends q.EventTarget{constructor(e){super(),this.fastQualityChange_=Ov(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:r,bandwidth:n,externVhs:a,useCueTags:u,playlistExclusionDuration:c,enableLowInitialPlaylist:f,sourceType:g,cacheEncryptionKeys:_,bufferBasedABR:A,leastPixelDiffSelector:S,captionServices:O,experimentalUseMMS:T}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:I}=e;(I===null||typeof I>"u")&&(I=1/0),bi=a,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!S,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=g,this.useCueTags_=u,this.playlistExclusionDuration=c,this.maxPlaylistRetries=I,this.enableLowInitialPlaylist=f,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:I,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Pv(),T&&D.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new D.ManagedMediaSource,this.usingManagedMediaSource_=!0,q.log("Using ManagedMediaSource")):D.MediaSource&&(this.mediaSource=new D.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=Ye(),this.hasPlayed_=!1,this.syncController_=new yv(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new bv,this.sourceUpdater_=new uf(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Tv,this.keyStatusMap_=new Map;const F={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:O,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:_,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new To(t,this.vhs_,Ce(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new rs(t,this.vhs_,Ce(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new xo(Ce(F,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new xo(Ce(F,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new fv(Ce(F,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((U,j)=>{function M(){r.off("vttjserror",L),U()}function L(){r.off("vttjsloaded",M),j()}r.one("vttjsloaded",M),r.one("vttjserror",L),r.addWebVttScript_()})}),e);const N=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new Lv(this.vhs_.xhr,N),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Nv.forEach(U=>{this[U+"_"]=Mv.bind(this,U)}),this.logger_=Lt("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 R=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(R,()=>{const U=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-U,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,i){const r=this.media(),n=r&&(r.id||r.uri),a=e&&(e.id||e.uri);if(n&&n!==a){this.logger_(`switch media ${n} -> ${a} from ${t}`);const u={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:u}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(i&&r){const a=(i.length?i[0].playlists:i.playlists).filter(u=>u.attributes.serviceLocation===r);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=D.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(D.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 i=e.mediaGroups.AUDIO,r=Object.keys(i);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const u=i.main||r.length&&i[r[0]];for(const c in u)if(u[c].default){n={label:c};break}}if(!n)return t;const a=[];for(const u in i)if(i[u][n.label]){const c=i[u][n.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let f=0;f<e.playlists.length;f++){const g=e.playlists[f];g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===u&&a.push(g)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;po(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),Iv({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(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;po(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(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"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger($e({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let r=!0;const n=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const u in i.AUDIO[a])i.AUDIO[a][u].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),bi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(i.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_,i=this.tech_.currentTime(),r=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return Bv({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,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 i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),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.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const r=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{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:Rv}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};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()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,r=>{this.player_.trigger($e({},r))}),this.audioSegmentLoader_.on(i,r=>{this.player_.trigger($e({},r))}),this.subtitleSegmentLoader_.on(i,r=>{this.player_.trigger($e({},r))})})}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()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}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()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let r=i;if(e.start){const n=e.start.timeOffset;n<0?r=Math.max(i+n,t.start(0)):r=Math.min(i,n)}this.trigger("firstplay"),this.tech_.setCurrentTime(r)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}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 i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const r=bi.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-n<=Xt;const u=a.end(a.length-1);return u-n<=Xt&&r-u<=Xt}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,n=r.filter(Zn),a=n.length===1&&n[0]===e;if(r.length===1&&i!==1/0)return q.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){if(this.main().contentSteering){const O=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(O),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(O)},T);return}let S=!1;r.forEach(O=>{if(O===e)return;const T=O.excludeUntil;typeof T<"u"&&T!==1/0&&(S=!0,delete O.excludeUntil)}),S&&(q.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let u;e.playlistErrors_>this.maxPlaylistRetries?u=1/0:u=Date.now()+i*1e3,e.excludeUntil=u,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const f=t.internal?this.logger_:q.log.warn,g=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${g} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=c.targetDuration/2*1e3||5*1e3,A=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=_;return this.switchMedia_(c,"exclude",a||A)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],r=e==="all";(r||e==="main")&&i.push(this.mainPlaylistLoader_);const n=[];(r||e==="audio")&&n.push("AUDIO"),(r||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const u=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;u&&i.push(u)}),["main","audio","subtitle"].forEach(a=>{const u=this[`${a}SegmentLoader_`];u&&(e===a||e==="all")&&i.push(u)}),i.forEach(a=>t.forEach(u=>{typeof a[u]=="function"&&a[u]()}))}setCurrentTime(e){const t=ss(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),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:bi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const r=this.syncController_.getMediaSequenceSync(t);if(r&&r.isReliable){const u=r.start,c=r.end;if(!isFinite(u)||!isFinite(c))return null;const f=bi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),g=Math.max(u,c-f);return Ye([[u,g]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=bi.Playlist.seekable(i,n,bi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),r=e.end(0),n=t.start(0),a=t.end(0);return n>r||i>a?e:Ye([[Math.max(i,n),Math.min(r,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${vh(this.seekable_)}]`);const r={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:r}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const r=this.seekable();if(!r.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<r.end(r.length-1))&&this.sourceUpdater_.setDuration(r.end(r.length-1));return}const t=this.tech_.buffered();let i=bi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(r=>{r.playlistLoader&&r.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_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=hr(this.main(),t),r={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=i.video||e.main.videoCodec||wg),e.main.isMuxed&&(r.video+=`,${i.audio||e.main.audioCodec||gl}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(r.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||gl,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(f,g)=>f?or(g,this.usingManagedMediaSource_):Ia(g),u={};let c;if(["video","audio"].forEach(function(f){if(r.hasOwnProperty(f)&&!a(e[f].isFmp4,r[f])){const g=e[f].isFmp4?"browser":"muxer";u[g]=u[g]||[],u[g].push(r[f]),f==="audio"&&(c=g)}}),n&&c&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(g=>{(g.attributes&&g.attributes.AUDIO)===f&&g!==t&&(g.excludeUntil=1/0)}),this.logger_(`excluding audio group ${f} as ${c} does not support codec(s): "${r.audio}"`)}if(Object.keys(u).length){const f=Object.keys(u).reduce((g,_)=>(g&&(g+=", "),g+=`${_} does not support codec(s): "${u[_].join(",")}"`,g),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:f},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const f=[];if(["video","audio"].forEach(g=>{const _=(Ht(this.sourceUpdater_.codecs[g]||"")[0]||{}).type,A=(Ht(r[g]||"")[0]||{}).type;_&&A&&_.toLowerCase()!==A.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[g]}" -> "${r[g]}"`)}),f.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${f.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}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(i=>{const r=e[i];if(t.indexOf(r.id)!==-1)return;t.push(r.id);const n=hr(this.main,r),a=[];n.audio&&!Ia(n.audio)&&!or(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Ia(n.video)&&!or(n.video,this.usingManagedMediaSource_)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,r=_r(Ht(e)),n=lc(r),a=r.video&&Ht(r.video)[0]||null,u=r.audio&&Ht(r.audio)[0]||null;Object.keys(i).forEach(c=>{const f=i[c];if(t.indexOf(f.id)!==-1||f.excludeUntil===1/0)return;t.push(f.id);const g=[],_=hr(this.mainPlaylistLoader_.main,f),A=lc(_);if(!(!_.audio&&!_.video)){if(A!==n&&g.push(`codec count "${A}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const S=_.video&&Ht(_.video)[0]||null,O=_.audio&&Ht(_.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&g.push(`video codec "${S.type}" !== "${a.type}"`),O&&u&&O.type.toLowerCase()!==u.type.toLowerCase()&&g.push(`audio codec "${O.type}" !== "${u.type}"`)}g.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${g.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),mv(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Xe.GOAL_BUFFER_LENGTH,i=Xe.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Xe.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Xe.BUFFER_LOW_WATER_LINE,i=Xe.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Xe.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Xe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return Xe.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){_c(this.inbandTextTracks_,"com.apple.streaming",this.tech_),XT({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();_c(this.inbandTextTracks_,e,this.tech_),zT({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger($e({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const u of t.playlists){const c=u.attributes.serviceLocation;if(c&&(a.push(c),!n.has(c)))return!0}return!!(!a.length&&n.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,r=new Set;let n=!1;Object.keys(i).forEach(a=>{const u=i[a],c=this.pathwayAttribute_(u),f=c&&e!==c;u.excludeUntil===1/0&&u.lastExcludeReason_==="content-steering"&&!f&&(delete u.excludeUntil,delete u.lastExcludeReason_,n=!0);const _=!u.excludeUntil&&u.excludeUntil!==1/0;!r.has(u.id)&&f&&_&&(r.add(u.id),u.excludeUntil=1/0,u.lastExcludeReason_="content-steering",this.logger_(`excluding ${u.id} for ${u.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const u=this.mediaTypes_[a];if(u.activePlaylistLoader){const c=u.activePlaylistLoader.media_;c&&c.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||r&&r.size){for(const[a,u]of i.entries())r.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(u),this.contentSteeringController_.excludePathway(a));for(const[a,u]of r.entries()){const c=i.get(a);if(!c){t.filter(g=>g.attributes["PATHWAY-ID"]===u["BASE-ID"]).forEach(g=>{this.mainPlaylistLoader_.addClonePathway(u,g)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(c,u)||(this.mainPlaylistLoader_.updateOrDeleteClone(u,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(const n in i)if(i[n]!==r[n])return!1;for(const n in r)if(i[n]!==r[n])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const r=this.mainPlaylistLoader_.getKeyIdSet(i);!r||!r.size||r.forEach(n=>{const a="usable",u=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,c=i.lastExcludeReason_===t&&i.excludeUntil===1/0;u?u&&c&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${n} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const r=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,n=i.excludeUntil===1/0&&i.lastExcludeReason_===t;r&&n&&(delete i.excludeUntil,q.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:dv(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${n} added to the keyStatusMap`),this.keyStatusMap_.set(n,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const Uv=(s,e,t)=>i=>{const r=s.main.playlists[e],n=au(r),a=Zn(r);if(typeof i>"u")return a;i?delete r.disabled:r.disabled=!0;const u={renditionInfo:{id:e,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return i!==a&&!n&&(i?(t(r),s.trigger({type:"renditionenabled",metadata:u})):s.trigger({type:"renditiondisabled",metadata:u})),i};class jv{constructor(e,t,i){const{playlistController_:r}=e,n=r.fastQualityChange_.bind(r);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=hr(r.main(),t),this.playlist=t,this.id=i,this.enabled=Uv(e.playlists,t.id,n)}}const qv=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Er(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!au(i)).map((i,r)=>new jv(s,i,i.id)):[]}},Dc=["seeking","seeked","pause","playing","error"];class $v extends q.EventTarget{constructor(e){super(),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.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Lt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,u=["main","subtitle","audio"],c={};u.forEach(g=>{c[g]={reset:()=>this.resetSegmentDownloads_(g),updateend:()=>this.checkSegmentDownloads_(g)},a[`${g}SegmentLoader_`].on("appendsdone",c[g].updateend),a[`${g}SegmentLoader_`].on("playlistupdate",c[g].reset),this.tech_.on(["seeked","seeking"],c[g].reset)});const f=g=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][g]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),f("off"))},this.clearSeekingAppendCheck_=()=>f("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),f("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Dc,n),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Dc,n),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),u.forEach(g=>{a[`${g}SegmentLoader_`].off("appendsdone",c[g].updateend),a[`${g}SegmentLoader_`].off("playlistupdate",c[g].reset),this.tech_.off(["seeked","seeking"],c[g].reset)}),this.checkCurrentTimeTimeout_&&D.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&D.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=D.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_,i=t[`${e}SegmentLoader_`],r=i.buffered_(),n=Ay(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,n){const a={bufferedRanges:r};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:ji(r)}),!(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+Xt>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(Ye([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),r=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const O=t.start(0);n=O+(O===t.end(0)?0:Xt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${vh(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,u=this.tech_.buffered(),c=a.audioBuffer?a.audioBuffered():null,f=a.videoBuffer?a.videoBuffered():null,g=this.media(),_=g.partTargetDuration?g.partTargetDuration:(g.targetDuration-Wt)*2,A=[c,f];for(let O=0;O<A.length;O++){if(!A[O])continue;if(ru(A[O],i)<_)return!1}const S=nn(u,i);return S.length===0?!1:(n=S.start(0)+Xt,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${i}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=ss(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.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 u=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${u}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(u),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=nn(r,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,i,r=!1){if(!e.length)return!1;let n=e.end(e.length-1)+Xt;const a=!i.endList,u=typeof i.partTargetDuration=="number";return a&&(u||r)&&(n=e.end(e.length-1)+i.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let r;if(e.length&&t.length){const n=ss(e,i-3),a=ss(e,i),u=ss(t,i);u.length&&!a.length&&n.length&&(r={start:n.end(0),end:u.end(0)})}else nn(e,i).length||(r=this.gapFromVideoUnderflow_(e,i));return r?(this.logger_(`Encountered a gap in video from ${r.start} to ${r.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),r=nn(t,i);if(this.resetTimeUpdate_(),r.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+Wt);const n={gapInfo:{from:i,to:r.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:n}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=Ey(e);for(let r=0;r<i.length;r++){const n=i.start(r),a=i.end(r);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}const Vv={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},hf=function(s,e){let t=0,i=0;const r=Ce(Vv,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){i&&s.currentTime(i)},a=function(g){g!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",n),s.src(g),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},u=function(){if(Date.now()-t<r.errorInterval*1e3){s.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!r.getSource||typeof r.getSource!="function"){q.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),r.getSource.call(s,a)},c=function(){s.off("loadedmetadata",n),s.off("error",u),s.off("dispose",c)},f=function(g){c(),hf(s,g)};s.on("error",u),s.on("dispose",c),s.reloadSourceOnError=f},Hv=function(s){hf(this,s)};var ff="3.17.2",zv="7.1.0",Gv="1.3.1",Wv="7.2.0",Xv="4.0.2";const Be={PlaylistLoader:rs,Playlist:pt,utils:Zy,STANDARD_PLAYLIST_SELECTOR:gc,INITIAL_PLAYLIST_SELECTOR:jT,lastBandwidthSelector:gc,movingAverageBandwidthSelector:FT,comparePlaylistBandwidth:lu,comparePlaylistResolution:BT,xhr:Uh()};Object.keys(Xe).forEach(s=>{Object.defineProperty(Be,s,{get(){return q.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Xe[s]},set(e){if(q.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){q.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}Xe[s]=e}})});const pf="videojs-vhs",mf=function(s,e){const t=e.media();let i=-1;for(let r=0;r<s.length;r++)if(s[r].id===t.id){i=r;break}s.selectedIndex_=i,s.trigger({selectedIndex:i,type:"change"})},Kv=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),mf(s,e.playlists)};Be.canPlaySource=function(){return q.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const Yv=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=_r(Ht(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const r=ps(i.video),n=ps(i.audio),a={};for(const u in s)a[u]={},n&&(a[u].audioContentType=n),r&&(a[u].videoContentType=r),e.contentProtection&&e.contentProtection[u]&&e.contentProtection[u].pssh&&(a[u].pssh=e.contentProtection[u].pssh),typeof s[u]=="string"&&(a[u].url=s[u]);return Ce(s,a)},Qv=(s,e)=>s.reduce((t,i)=>{if(!i.contentProtection)return t;const r=e.reduce((n,a)=>{const u=i.contentProtection[a];return u&&u.pssh&&(n[a]={pssh:u.pssh}),n},{});return Object.keys(r).length&&t.push(r),t},[]),Jv=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?i.concat([t]):i,n=Qv(r,Object.keys(e)),a=[],u=[];return n.forEach(c=>{u.push(new Promise((f,g)=>{s.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,g)=>{s.eme.initializeMediaKeys({keySystems:c},_=>{if(_){g(_);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(u)])},Zv=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const r=Yv(e,t,i);return r?(s.currentSource().keySystems=r,r&&!s.eme?(q.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},gf=()=>{if(!D.localStorage)return null;const s=D.localStorage.getItem(pf);if(!s)return null;try{return JSON.parse(s)}catch{return null}},e2=s=>{if(!D.localStorage)return!1;let e=gf();e=e?Ce(e,s):s;try{D.localStorage.setItem(pf,JSON.stringify(e))}catch{return!1}return e},t2=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,_f=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},yf=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Tf=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},vf=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Be.supportsNativeHls=(function(){if(!re||!re.createElement)return!1;const s=re.createElement("video");return q.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(s.canPlayType(t))}):!1})();Be.supportsNativeDash=(function(){return!re||!re.createElement||!q.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(re.createElement("video").canPlayType("application/dash+xml"))})();Be.supportsTypeNatively=s=>s==="hls"?Be.supportsNativeHls:s==="dash"?Be.supportsNativeDash:!1;Be.isSupported=function(){return q.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Be.xhr.onRequest=function(s){_f(Be.xhr,s)};Be.xhr.onResponse=function(s){yf(Be.xhr,s)};Be.xhr.offRequest=function(s){Tf(Be.xhr,s)};Be.xhr.offResponse=function(s){vf(Be.xhr,s)};const i2=q.getComponent("Component");class bf extends i2{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Lt("VhsHandler"),t.options_&&t.options_.playerId){const r=q.getPlayer(t.options_.playerId);this.player_=r}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(re,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const n=re.fullscreenElement||re.webkitFullscreenElement||re.mozFullScreenElement||re.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_(e={}){if(this.options_=Ce(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=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 i=gf();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Xe.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Xe.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=t2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Be,this.options_.sourceType=qc(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new Fv(this.options_);const i=Ce({liveRangeSafeTimeDelta:Xt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new $v(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=q.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 r=this.options_.bufferBasedABR?Be.movingAverageBandwidthSelector(.55):Be.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=Be.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=D.navigator.connection||D.navigator.mozConnection||D.navigator.webkitConnection,u=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=u&&n>=u?n=Math.max(n,c):n=c}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(){q.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:()=>ji(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:()=>ji(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&&e2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{qv(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_=D.URL.createObjectURL(this.playlistController_.mediaSource),(q.browser.IS_ANY_SAFARI||q.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),Jv({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=Zv({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=q.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{Kv(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{mf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":ff,"mux.js":zv,"mpd-parser":Gv,"m3u8-parser":Wv,"aes-decrypter":Xv}}version(){return this.constructor.version()}canChangeType(){return uf.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_&&D.URL.revokeObjectURL&&(D.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return aT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return Hh({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{_f(this.xhr,e)},this.xhr.onResponse=e=>{yf(this.xhr,e)},this.xhr.offRequest=e=>{Tf(this.xhr,e)},this.xhr.offResponse=e=>{vf(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,r=>{this.player_.trigger($e({},r))})}),t.forEach(i=>{this.playbackWatcher_.on(i,r=>{this.player_.trigger($e({},r))})})}}const Pn={name:"videojs-http-streaming",VERSION:ff,canHandleSource(s,e={}){const t=Ce(q.options,e);return!t.vhs.experimentalUseMMS&&!or("avc1.4d400d,mp4a.40.2",!1)?!1:Pn.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=Ce(q.options,t);return e.vhs=new bf(s,e,i),e.vhs.xhr=Uh(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=qc(s);if(!t)return"";const i=Pn.getOverrideNative(e);return!Be.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(q.browser.IS_ANY_SAFARI||q.browser.IS_IOS),{overrideNative:i=t}=e;return i}},s2=()=>or("avc1.4d400d,mp4a.40.2",!0);s2()&&q.getTech("Html5").registerSourceHandler(Pn,0);q.VhsHandler=bf;q.VhsSourceHandler=Pn;q.Vhs=Be;q.use||q.registerComponent("Vhs",Be);q.options.vhs=q.options.vhs||{};(!q.getPlugin||!q.getPlugin("reloadSourceOnError"))&&q.registerPlugin("reloadSourceOnError",Hv);function r2({src:s,poster:e,onReady:t}){const i=Te.useRef(null),r=Te.useRef(null);Te.useEffect(()=>{if(!r.current&&i.current){const a=document.createElement("video-js");a.classList.add("vjs-big-play-centered"),i.current.appendChild(a),r.current=q(a,{controls:!1,autoplay:!0,fill:!0,sources:[{src:s,type:"video/mp4"}],poster:e},()=>{const u=r.current;u&&t?.(u)})}return()=>{r.current&&(r.current.dispose(),r.current=null)}},[s,e,t]);const n=()=>{r.current&&(r.current.paused()?r.current.play():r.current.pause())};return ue.jsx("div",{ref:i,className:"w-full h-full cursor-pointer [&_video]:object-contain",onClick:n})}function n2(s){const e=Math.floor(s/3600),t=Math.floor(s%3600/60),i=Math.floor(s%60);return(e>0?[e,t,i]:[t,i]).map(n=>n.toString().padStart(2,"0")).join(":")}function a2({buffered:s,progress:e,onSeek:t}){const i=Te.useRef(null),r=Math.min(Math.max(s,0),1)*100+"%",n=Math.min(Math.max(e,0),1)*100+"%",a=u=>{if(!i.current||!t)return;const c=i.current.getBoundingClientRect(),f=(u.clientX-c.left)/c.width;t(Math.min(Math.max(f,0),1))};return ue.jsxs("div",{ref:i,className:"relative w-full h-4 cursor-pointer flex items-center",onClick:a,children:[ue.jsxs("div",{className:"w-full h-1 rounded-full bg-white/20 relative overflow-hidden",children:[ue.jsx("div",{className:"h-full bg-white/30 absolute left-0 top-0 z-0",style:{width:r}}),ue.jsx("div",{className:"h-full bg-red-600 absolute left-0 top-0 z-10",style:{width:n}})]}),ue.jsx("div",{className:"bg-red-600 rounded-full size-3 absolute top-1/2 -translate-y-1/2 -translate-x-1/2 z-10",style:{left:n}})]})}const xf="jukebox-volume";function o2(){try{const s=localStorage.getItem(xf);if(s)return JSON.parse(s)}catch{}return{volume:1,muted:!1}}function u2(s,e){try{localStorage.setItem(xf,JSON.stringify({volume:s,muted:e}))}catch{}}function l2({player:s}){const[e,t]=Te.useState(1),[i,r]=Te.useState(!1),n=Te.useRef(null);Te.useEffect(()=>{if(!s)return;const g=o2();t(g.volume),r(g.muted),s.volume(g.volume),s.muted(g.muted);const _=()=>{const A=s.volume()??1,S=s.muted()??!1;t(A),r(S),u2(A,S)};return s.on("volumechange",_),()=>{s.off("volumechange",_)}},[s]);const a=()=>{s&&s.muted(!i)},u=g=>{if(!n.current||!s)return;const _=n.current.getBoundingClientRect(),A=1-(g.clientY-_.top)/_.height,S=Math.min(Math.max(A,0),1);s.volume(S),S>0&&i&&s.muted(!1)},c=()=>i||e===0?ue.jsx(Om,{className:"size-7 text-white"}):e<.33?ue.jsx(Nm,{className:"size-7 text-white"}):e<.66?ue.jsx(km,{className:"size-7 text-white"}):ue.jsx(Pm,{className:"size-7 text-white"}),f=i?0:e*100;return ue.jsxs("div",{className:"relative group",children:[ue.jsx("button",{"aria-label":i?"Unmute":"Mute",className:"p-2 flex justify-center items-center cursor-pointer",onClick:a,children:c()}),ue.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 hidden group-hover:block z-50 pb-2",children:ue.jsx("div",{className:"bg-black/90 rounded-lg p-3 shadow-lg border border-white/20",children:ue.jsxs("div",{ref:n,className:"relative w-2 h-24 bg-white/20 rounded cursor-pointer",onClick:u,children:[ue.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-white rounded",style:{height:`${f}%`}}),ue.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-3 h-3 bg-white rounded-full",style:{bottom:`calc(${f}% - 6px)`}})]})})})]})}const kc=10,c2=1e4;function d2({title:s,player:e,movieId:t,episodeId:i,onToggleEpisodes:r,showEpisodesButton:n}){const[a,u]=Te.useState(!1),[c,f]=Te.useState(0),[g,_]=Te.useState(0),[A,S]=Te.useState(0),O=Te.useRef(0);Te.useEffect(()=>{if(!e)return;const U=()=>u(!0),j=()=>u(!1),M=()=>{const $=e.currentTime()??0,v=e.duration()??0;v>0&&(f($/v),S(v-$))},L=()=>{const $=e.buffered(),v=e.duration()??0;if($&&$.length>0&&v>0){const E=$.end($.length-1);_(E/v)}};return e.on("play",U),e.on("pause",j),e.on("timeupdate",M),e.on("progress",L),u(!e.paused()),()=>{e.off("play",U),e.off("pause",j),e.off("timeupdate",M),e.off("progress",L)}},[e]),Te.useEffect(()=>{if(!e)return;const U=async()=>{if(e.isDisposed())return;const M=e.currentTime()??0,L=e.duration()??0;if(M===O.current)return;O.current=M;const $=i?`/api/progress/episode/${i}`:`/api/progress/${t}`;await fetch($,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:M,duration:L})})},j=setInterval(()=>{U()},c2);return()=>{clearInterval(j),U()}},[e,t,i]);const T=()=>{e&&(e.paused()?e.play():e.pause())},I=()=>{if(!e)return;const U=e.currentTime()??0;e.currentTime(Math.max(0,U-kc))},F=()=>{if(!e)return;const U=e.currentTime()??0,j=e.duration()??0;e.currentTime(Math.min(j,U+kc))},N=()=>{e&&(e.isFullscreen()?e.exitFullscreen():e.requestFullscreen())},R=U=>{if(!e)return;const j=e.duration()??0;e.currentTime(U*j)};return ue.jsxs("div",{className:"px-6 overflow-visible",children:[ue.jsxs("div",{className:"flex items-center gap-4",children:[ue.jsx("div",{className:"flex-1",children:ue.jsx(a2,{buffered:g,progress:c,onSeek:R})}),ue.jsx("span",{className:"text-white text-xs font-mono whitespace-nowrap",children:n2(A)})]}),ue.jsxs("div",{className:"flex justify-between items-center py-4 relative z-10",children:[ue.jsxs("div",{className:"flex gap-2 items-center",children:[ue.jsx(sr,{"aria-label":a?"Pause":"Play",onClick:T,children:a?ue.jsx(Sm,{className:"size-7 hover:scale-125 text-white"}):ue.jsx(hm,{className:"size-7 hover:scale-125 text-white"})}),ue.jsx(sr,{"aria-label":"Skip backward 10 seconds",onClick:I,children:ue.jsx(Cm,{className:"size-7 hover:scale-125 text-white"})}),ue.jsx(sr,{"aria-label":"Skip forward 10 seconds",onClick:F,children:ue.jsx(Am,{className:"size-7 hover:scale-125 text-white"})}),ue.jsx(l2,{player:e})]}),ue.jsx("div",{className:"text-white text-sm truncate",children:s}),ue.jsxs("div",{className:"flex gap-2 items-center",children:[n&&r&&ue.jsx(sr,{"aria-label":"Browse episodes",onClick:r,children:ue.jsx(Tm,{className:"size-7 hover:scale-125 text-white"})}),ue.jsx(sr,{"aria-label":"Toggle fullscreen",onClick:N,children:ue.jsx(bm,{className:"size-7 hover:scale-125 text-white"})})]})]})]})}function sr({"aria-label":s,children:e,onClick:t}){return ue.jsx("button",{"aria-label":s,className:"p-2 flex justify-center items-center cursor-pointer",onClick:t,children:e})}function h2({currentEpisodeId:s,onClose:e,onSelectEpisode:t,onSelectSeason:i,progressMap:r,seasons:n,selectedSeason:a,showTitle:u}){const c=n.find(f=>f.seasonNumber===a);return ue.jsxs("div",{className:"bg-black/95 border-l border-white/10 h-full flex flex-col",children:[ue.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[ue.jsx("span",{className:"text-white text-sm font-medium truncate",children:u}),ue.jsx("button",{"aria-label":"Close episode panel",className:"p-1 text-white/60 hover:text-white cursor-pointer flex-shrink-0 ml-2",onClick:e,children:ue.jsx(Bm,{className:"size-5"})})]}),ue.jsx("div",{className:"flex gap-1 px-4 py-3 border-b border-white/10 flex-wrap",children:n.map(f=>ue.jsxs("button",{className:`px-3 py-1 rounded text-sm font-medium cursor-pointer transition-colors ${f.seasonNumber===a?"bg-white text-black":"text-white/60 hover:text-white hover:bg-white/10"}`,onClick:()=>i(f.seasonNumber),children:["Season ",f.seasonNumber]},f.seasonNumber))}),ue.jsx("div",{className:"flex-1 overflow-y-auto slim-scrollbar",children:c?.episodes.map(f=>{const g=f.id===s,_=r?.[f.id],A=_?.duration?Math.min(_.currentTime/_.duration*100,100):0,S=_?.duration?_.currentTime>=_.duration*.9:!1;return ue.jsxs("button",{className:`w-full text-left px-4 py-3 border-l-2 transition-colors ${g?"bg-white/10 border-red-600":"border-transparent hover:bg-white/5"}`,onClick:()=>t(f),children:[ue.jsxs("div",{className:"text-white/60 text-xs mb-1",children:["E",f.episodeNumber,f.runtime!=null&&` · ${f.runtime}m`,S&&ue.jsx("span",{className:"ml-2 text-white/30",children:"Watched"})]}),ue.jsx("div",{className:`text-sm leading-snug ${S?"text-white/40":"text-white"}`,children:f.title}),A>0&&!S&&ue.jsx("div",{className:"mt-1.5 h-0.5 w-full rounded-full bg-white/10",children:ue.jsx("div",{className:"h-full rounded-full bg-red-600",style:{width:`${A}%`}})})]},f.id)})})]})}async function f2(s){const e=await fetch(`/api/library/movies/${s}`);if(!e.ok)throw new Error("Failed to fetch movie");return await e.json()}async function p2(s){return await(await fetch(`/api/progress/${s}`)).json()}async function m2(s){const e=await fetch(`/api/library/shows/episodes/${s}`);if(!e.ok)throw new Error("Failed to fetch episode");return await e.json()}async function g2(s){const e=await fetch(`/api/library/shows/${s}`);if(!e.ok)throw new Error("Failed to fetch show");return await e.json()}async function _2(s){return await(await fetch(`/api/progress/episode/${s}`)).json()}async function y2(s){const e=await fetch(`/api/progress/episode/show/${s}`);return e.ok?await e.json():{}}const T2=3e3;function S2(){const{id:s}=fm(),t=pm().pathname.startsWith("/watch/episode/"),[i,r]=Te.useState(!0),[n,a]=Te.useState(!1),[u,c]=Te.useState(null),[f,g]=Te.useState(!1),[_,A]=Te.useState(1),S=Te.useRef(!1),O=Te.useRef(null),T=Te.useCallback(()=>{r(!0),O.current&&clearTimeout(O.current),n&&(O.current=setTimeout(()=>{r(!1)},T2))},[n]);Te.useEffect(()=>{if(!u)return;const te=()=>a(!0),X=()=>a(!1);return u.on("play",te),u.on("pause",X),a(!u.paused()),()=>{u.off("play",te),u.off("pause",X)}},[u]),Te.useEffect(()=>(n?T():(r(!0),O.current&&clearTimeout(O.current)),()=>{O.current&&clearTimeout(O.current)}),[n,T]),Zr("*",()=>T()),Zr("space",te=>{te.preventDefault(),u&&(u.paused()?u.play():u.pause())},[u]),Zr("left",()=>{if(!u)return;const te=u.currentTime()??0;u.currentTime(Math.max(0,te-10))},[u]),Zr("right",()=>{if(!u)return;const te=u.currentTime()??0,X=u.duration()??0;u.currentTime(Math.min(X,te+10))},[u]);const{data:I,isLoading:F,error:N}=Qs({queryKey:["movie",s],queryFn:()=>f2(s??""),enabled:!!s&&!t}),{data:R,isLoading:U,error:j}=Qs({queryKey:["episode",s],queryFn:()=>m2(s??""),enabled:!!s&&t}),M=R?.episode,L=R?.show,{data:$}=Qs({queryKey:["show-for-episode",L?.id],queryFn:()=>g2(L?.id??0),enabled:!!L}),{data:v}=Qs({queryKey:["show-progress",L?.id],queryFn:()=>y2(L?.id??0),enabled:!!L}),{data:E}=Qs({queryKey:["progress",t?"episode":"movie",t?M?.id:I?.id],queryFn:()=>t?_2(M?.id??0):p2(I?.id??0),enabled:t?!!M:!!I});Te.useEffect(()=>{M&&A(M.seasonNumber)},[M]),Te.useEffect(()=>{u&&E&&E.currentTime>0&&!S.current&&(S.current=!0,u.currentTime(E.currentTime))},[u,E]),Te.useEffect(()=>{if(!u||!t||!$||!M)return;const te=()=>{const X=$.seasons.find(ee=>ee.seasonNumber===M.seasonNumber);if(!X)return;const Z=X.episodes.findIndex(ee=>ee.id===M.id);let J;Z<X.episodes.length-1?J=X.episodes[Z+1]:J=$.seasons.find(ie=>ie.seasonNumber===M.seasonNumber+1)?.episodes[0],J&&(window.location.href=`/watch/episode/${J.id}`)};return u.on("ended",te),()=>{u.off("ended",te)}},[u,t,$,M]);const V=Te.useCallback(te=>{if(te.id!==M?.id){if(u&&M){const X=u.currentTime()??0,Z=u.duration()??0;fetch(`/api/progress/episode/${M.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:X,duration:Z})})}window.location.href=`/watch/episode/${te.id}`}},[u,M]),G=t?U:F,z=t?j:N;if(G)return ue.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:ue.jsx(mm,{className:"h-8 w-8 animate-spin text-white"})});if(z||(t?!M:!I))return ue.jsxs("div",{className:"min-h-screen bg-black flex flex-col items-center justify-center gap-4",children:[ue.jsx("p",{className:"text-white",children:t?"Episode not found":"Movie not found"}),ue.jsx(gm,{asChild:!0,variant:"outline",children:ue.jsx(_m,{to:"/",children:"Back to Library"})})]});const Q=t?`/api/stream/episode/${M?.id}`:`/api/stream/${I?.id}`,se=t&&M&&L?`${L.title} — S${M.seasonNumber} E${M.episodeNumber} · ${M.title}`:I?.title??"";return ue.jsxs("div",{className:`bg-black w-full h-screen relative ${i?"":"cursor-none"}`,onMouseMove:T,children:[ue.jsx("div",{className:"absolute inset-0",children:ue.jsx(r2,{src:Q,onReady:c})}),t&&f&&$&&M&&ue.jsx("div",{className:"absolute top-0 right-0 bottom-0 w-96 z-20",children:ue.jsx(h2,{currentEpisodeId:M.id,onClose:()=>g(!1),onSelectEpisode:V,onSelectSeason:A,progressMap:v,seasons:$.seasons,selectedSeason:_,showTitle:$.title})}),ue.jsx("div",{className:`absolute bottom-0 left-0 right-0 z-30 bg-gradient-to-t from-black/80 to-transparent pt-16 transition-opacity duration-300 ${i?"opacity-100":"opacity-0 pointer-events-none"}`,children:ue.jsx(d2,{title:se,player:u,movieId:t?void 0:I?.id,episodeId:t?M?.id:void 0,showEpisodesButton:t,onToggleEpisodes:()=>g(te=>!te)})})]})}export{S2 as WatchPage};
|
|
200
|
+
`.split("").map(s=>s.charCodeAt(0)));class Rv extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Nv extends Co{constructor(e,t={}){super(e,t),this.mediaSource_=null,this.subtitlesTrack_=null,this.featuresNativeTextTracks_=e.featuresNativeTextTracks,this.loadVttJs=e.loadVttJs,this.shouldSaveSegmentTimingInfo_=!1}buffered_(){if(!this.subtitlesTrack_||!this.subtitlesTrack_.cues||!this.subtitlesTrack_.cues.length)return tt();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return tt([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=In(e);let r=this.initSegments_[i];if(t&&!r&&e.bytes){const n=kc.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(kc,e.bytes.byteLength),this.initSegments_[i]=r={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return r||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){or(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,i){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===Jt.TIMEOUT&&this.handleTimeout_(),e.code===Jt.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const r=this.pendingSegment_,n=i.mp4VttCues&&i.mp4VttCues.length;n&&(r.mp4VttCues=i.mp4VttCues),this.saveBandwidthRelatedStats_(r.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=r.segment;if(a.map&&(a.map.bytes=t.map.bytes),r.bytes=t.bytes,typeof D.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(r)}catch(u){this.stopForError({message:u.message,metadata:{errorType:q.Error.StreamingVttParserError,error:u}});return}if(n||this.updateTimeMapping_(r,this.syncController_.timelines[r.timeline],this.playlist_),r.cues.length?r.timingInfo={start:r.cues[0].startTime,end:r.cues[r.cues.length-1].endTime}:r.timingInfo={start:r.startOfSegment,end:r.startOfSegment+r.duration},r.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}r.byteLength=r.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,r.cues.forEach(u=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new D.VTTCue(u.startTime,u.endTime,u.text):u)}),_v(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",r=t&&t.type==="text";i&&r&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const r=i.start+t,n=i.end+t,a=new D.VTTCue(r,n,i.cueText);i.settings&&i.settings.split(" ").forEach(u=>{const l=u.split(":"),f=l[0],g=l[1];a[f]=isNaN(g)?g:Number(g)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof D.WebVTT!="function")throw new Rv;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof D.TextDecoder=="function"?t=new D.TextDecoder("utf8"):(t=D.WebVTT.StringDecoder(),i=!0);const r=new D.WebVTT.Parser(D,D.vttjs,t);if(r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=a=>{e.timestampmap=a},r.onparsingerror=a=>{q.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;i&&(a=Dc(a)),r.parse(a)}let n=e.bytes;i&&(n=Dc(n)),r.parse(n),r.flush()}updateTimeMapping_(e,t,i){const r=e.segment;if(!t)return;if(!e.cues.length){r.empty=!0;return}const{MPEGTS:n,LOCAL:a}=e.timestampmap,l=n/ji.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(f=>{const g=f.endTime-f.startTime,_=this.handleRollover_(f.startTime+l,t.time);f.startTime=Math.max(_,0),f.endTime=Math.max(_+g,0)}),!i.syncInfo){const f=e.cues[0].startTime,g=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(f,g-r.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*ji.ONE_SECOND_IN_TS;const r=t*ji.ONE_SECOND_IN_TS;let n;for(r<i?n=-8589934592:n=8589934592;Math.abs(i-r)>4294967296;)i+=n;return i/ji.ONE_SECOND_IN_TS}}const Mv=function(s,e){const t=s.cues;for(let i=0;i<t.length;i++){const r=t[i];if(e>=r.adStartTime&&e<=r.adEndTime)return r}return null},Bv=function(s,e,t=0){if(!s.segments)return;let i=t,r;for(let n=0;n<s.segments.length;n++){const a=s.segments[n];if(r||(r=Mv(e,i+a.duration/2)),r){if("cueIn"in a){r.endTime=i,r.adEndTime=i,i+=a.duration,r=null;continue}if(i<r.endTime){i+=a.duration;continue}r.endTime+=a.duration}else if("cueOut"in a&&(r=new D.VTTCue(i,i+a.duration,a.cueOut),r.adStartTime=i,r.adEndTime=i+parseFloat(a.cueOut),e.addCue(r)),"cueOutCont"in a){const[u,l]=a.cueOutCont.split("/").map(parseFloat);r=new D.VTTCue(i,i+a.duration,""),r.adStartTime=i-u,r.adEndTime=r.adStartTime+l,e.addCue(r)}i+=a.duration}};class Ic{constructor({start:e,end:t,segmentIndex:i,partIndex:r=null,appended:n=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,this.partIndex_=r,this.appended_=n}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class Fv{constructor(e,t=[]){this.segmentSyncInfo_=e,this.partsSyncInfo_=t}get segmentSyncInfo(){return this.segmentSyncInfo_}get partsSyncInfo(){return this.partsSyncInfo_}get hasPartsSyncInfo(){return this.partsSyncInfo_.length>0}resetAppendStatus(){this.segmentSyncInfo_.resetAppendedStatus(),this.partsSyncInfo_.forEach(e=>e.resetAppendedStatus())}}class xf{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:r}=e;if(this.isReliable_=this.isReliablePlaylist_(i,r),!!this.isReliable_)return this.updateStorage_(r,i,this.calculateBaseTime_(i,r,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const r of i)if(r.isInRange(e))return r}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,i){const r=new Map;let n=`
|
|
201
|
+
`,a=i,u=t;this.start_=a,e.forEach((l,f)=>{const g=this.storage_.get(u),_=a,A=_+l.duration,x=!!(g&&g.segmentSyncInfo&&g.segmentSyncInfo.isAppended),L=new Ic({start:_,end:A,appended:x,segmentIndex:f});l.syncInfo=L;let T=a;const I=(l.parts||[]).map((M,N)=>{const O=T,j=T+M.duration,F=!!(g&&g.partsSyncInfo&&g.partsSyncInfo[N]&&g.partsSyncInfo[N].isAppended),U=new Ic({start:O,end:j,appended:F,segmentIndex:f,partIndex:N});return T=j,n+=`Media Sequence: ${u}.${N} | Range: ${O} --> ${j} | Appended: ${F}
|
|
202
|
+
`,M.syncInfo=U,U});r.set(u,new Fv(L,I)),n+=`${yf(l.resolvedUri)} | Media Sequence: ${u} | Range: ${_} --> ${A} | Appended: ${x}
|
|
203
|
+
`,u++,a=A}),this.end_=a,this.storage_=r,this.diagnostics_=n}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const r=Math.min(...this.storage_.keys());if(e<r){const n=r-e;let a=this.storage_.get(r).segmentSyncInfo.start;for(let u=0;u<n;u++){const l=t[u];a-=l.duration}return a}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Pc extends xf{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const Uv=86400,Qa=[{name:"VOD",run:(s,e,t,i,r)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,r,n)=>{const a=s.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const u=a.getSyncInfoForTime(r);return u?{time:u.start,partIndex:u.partIndex,segmentIndex:u.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,r)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let n=null,a=null;const u=go(e);r=r||0;for(let l=0;l<u.length;l++){const f=e.endList||r===0?l:u.length-(l+1),g=u[f],_=g.segment,A=s.timelineToDatetimeMappings[_.timeline];if(!A||!_.dateTimeObject)continue;let L=_.dateTimeObject.getTime()/1e3+A;if(_.parts&&typeof g.partIndex=="number")for(let I=0;I<g.partIndex;I++)L+=_.parts[I].duration;const T=Math.abs(r-L);if(a!==null&&(T===0||a<T))break;a=T,n={time:L,segmentIndex:g.segmentIndex,partIndex:g.partIndex}}return n}},{name:"Segment",run:(s,e,t,i,r)=>{let n=null,a=null;r=r||0;const u=go(e);for(let l=0;l<u.length;l++){const f=e.endList||r===0?l:u.length-(l+1),g=u[f],_=g.segment,A=g.part&&g.part.start||_&&_.start;if(_.timeline===i&&typeof A<"u"){const x=Math.abs(r-A);if(a!==null&&a<x)break;(!n||a===null||a>=x)&&(a=x,n={time:A,segmentIndex:g.segmentIndex,partIndex:g.partIndex})}}return n}},{name:"Discontinuity",run:(s,e,t,i,r)=>{let n=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let u=0;u<e.discontinuityStarts.length;u++){const l=e.discontinuityStarts[u],f=e.discontinuitySequence+u+1,g=s.discontinuities[f];if(g){const _=Math.abs(r-g.time);if(a!==null&&a<_)break;(!n||a===null||a>=_)&&(a=_,n={time:g.time,segmentIndex:l,partIndex:null})}}}return n}},{name:"Playlist",run:(s,e,t,i,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class jv extends q.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new xf,i=new Pc(t),r=new Pc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=Rt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,r,n){if(t!==1/0)return Qa.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,r,n);if(!a.length)return null;for(const u of a){const{syncPoint:l,strategy:f}=u,{segmentIndex:g,time:_}=l;if(g<0)continue;const A=e.segments[g],x=_,L=x+A.duration;if(this.logger_(`Strategy: ${f}. Current time: ${r}. selected segment: ${g}. Time: [${x} -> ${L}]}`),r>=x&&r<L)return this.logger_("Found sync point with exact match: ",l),l}return this.selectSyncPoint_(a,{key:"time",value:r})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const r=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+hr({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,r,n){const a=[];for(let u=0;u<Qa.length;u++){const l=Qa[u],f=l.run(this,e,t,i,r,n);f&&(f.strategy=l.name,a.push({strategy:l.name,syncPoint:f}))}return a}selectSyncPoint_(e,t){let i=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy;for(let a=1;a<e.length;a++){const u=Math.abs(e[a].syncPoint[t.key]-t.value);u<r&&(r=u,i=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>Uv){q.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let r=i-1;r>=0;r--){const n=e.segments[r];if(n&&typeof n.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+r,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],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const n=r.dateTimeObject;r.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[r.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const r=e.segment,n=e.part;let a=this.timelines[e.timeline],u,l;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),u=e.startOfSegment,l=t.end+a.mapping;else if(a)u=t.start+a.mapping,l=t.end+a.mapping;else return!1;return n&&(n.start=u,n.end=l),(!r.start||u<r.start)&&(r.start=u),r.end=l,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let r=0;r<t.discontinuityStarts.length;r++){const n=t.discontinuityStarts[r],a=t.discontinuitySequence+r+1,u=n-e.mediaIndex,l=Math.abs(u);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>l){let f;u<0?f=i.start-hr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):f=i.end+hr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:f,accuracy:l}}}}dispose(){this.trigger("dispose"),this.off()}}class qv extends q.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const r={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const $v=of(uf(function(){var s=(function(){function T(){this.listeners={}}var I=T.prototype;return I.on=function(N,O){this.listeners[N]||(this.listeners[N]=[]),this.listeners[N].push(O)},I.off=function(N,O){if(!this.listeners[N])return!1;var j=this.listeners[N].indexOf(O);return this.listeners[N]=this.listeners[N].slice(0),this.listeners[N].splice(j,1),j>-1},I.trigger=function(N){var O=this.listeners[N];if(O)if(arguments.length===2)for(var j=O.length,F=0;F<j;++F)O[F].call(this,arguments[1]);else for(var U=Array.prototype.slice.call(arguments,1),R=O.length,H=0;H<R;++H)O[H].apply(this,U)},I.dispose=function(){this.listeners={}},I.pipe=function(N){this.on("data",function(O){N.push(O)})},T})();function e(T){return T.subarray(0,T.byteLength-T[T.byteLength-1])}const t=function(){const T=[[[],[],[],[],[]],[[],[],[],[],[]]],I=T[0],M=T[1],N=I[4],O=M[4];let j,F,U;const R=[],H=[];let v,E,$,G,V,J;for(j=0;j<256;j++)H[(R[j]=j<<1^(j>>7)*283)^j]=j;for(F=U=0;!N[F];F^=v||1,U=H[U]||1)for(G=U^U<<1^U<<2^U<<3^U<<4,G=G>>8^G&255^99,N[F]=G,O[G]=F,$=R[E=R[v=R[F]]],J=$*16843009^E*65537^v*257^F*16843008,V=R[G]*257^G*16843008,j=0;j<4;j++)I[j][F]=V=V<<24^V>>>8,M[j][G]=J=J<<24^J>>>8;for(j=0;j<5;j++)I[j]=I[j].slice(0),M[j]=M[j].slice(0);return T};let i=null;class r{constructor(I){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let M,N,O;const j=this._tables[0][4],F=this._tables[1],U=I.length;let R=1;if(U!==4&&U!==6&&U!==8)throw new Error("Invalid aes key size");const H=I.slice(0),v=[];for(this._key=[H,v],M=U;M<4*U+28;M++)O=H[M-1],(M%U===0||U===8&&M%U===4)&&(O=j[O>>>24]<<24^j[O>>16&255]<<16^j[O>>8&255]<<8^j[O&255],M%U===0&&(O=O<<8^O>>>24^R<<24,R=R<<1^(R>>7)*283)),H[M]=H[M-U]^O;for(N=0;M;N++,M--)O=H[N&3?M:M-4],M<=4||N<4?v[N]=O:v[N]=F[0][j[O>>>24]]^F[1][j[O>>16&255]]^F[2][j[O>>8&255]]^F[3][j[O&255]]}decrypt(I,M,N,O,j,F){const U=this._key[1];let R=I^U[0],H=O^U[1],v=N^U[2],E=M^U[3],$,G,V;const J=U.length/4-2;let se,ne=4;const Y=this._tables[1],te=Y[0],X=Y[1],Z=Y[2],ie=Y[3],pe=Y[4];for(se=0;se<J;se++)$=te[R>>>24]^X[H>>16&255]^Z[v>>8&255]^ie[E&255]^U[ne],G=te[H>>>24]^X[v>>16&255]^Z[E>>8&255]^ie[R&255]^U[ne+1],V=te[v>>>24]^X[E>>16&255]^Z[R>>8&255]^ie[H&255]^U[ne+2],E=te[E>>>24]^X[R>>16&255]^Z[H>>8&255]^ie[v&255]^U[ne+3],ne+=4,R=$,H=G,v=V;for(se=0;se<4;se++)j[(3&-se)+F]=pe[R>>>24]<<24^pe[H>>16&255]<<16^pe[v>>8&255]<<8^pe[E&255]^U[ne++],$=R,R=H,H=v,v=E,E=$}}class n extends s{constructor(){super(s),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(I){this.jobs.push(I),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(T){return T<<24|(T&65280)<<8|(T&16711680)>>8|T>>>24},u=function(T,I,M){const N=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),O=new r(Array.prototype.slice.call(I)),j=new Uint8Array(T.byteLength),F=new Int32Array(j.buffer);let U,R,H,v,E,$,G,V,J;for(U=M[0],R=M[1],H=M[2],v=M[3],J=0;J<N.length;J+=4)E=a(N[J]),$=a(N[J+1]),G=a(N[J+2]),V=a(N[J+3]),O.decrypt(E,$,G,V,F,J),F[J]=a(F[J]^U),F[J+1]=a(F[J+1]^R),F[J+2]=a(F[J+2]^H),F[J+3]=a(F[J+3]^v),U=E,R=$,H=G,v=V;return j};class l{constructor(I,M,N,O){const j=l.STEP,F=new Int32Array(I.buffer),U=new Uint8Array(I.byteLength);let R=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(F.subarray(R,R+j),M,N,U)),R=j;R<F.length;R+=j)N=new Uint32Array([a(F[R-4]),a(F[R-3]),a(F[R-2]),a(F[R-1])]),this.asyncStream_.push(this.decryptChunk_(F.subarray(R,R+j),M,N,U));this.asyncStream_.push(function(){O(null,e(U))})}static get STEP(){return 32e3}decryptChunk_(I,M,N,O){return function(){const j=u(I,M,N);O.set(j,I.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},g;typeof window<"u"?g=window:typeof f<"u"?g=f:typeof self<"u"?g=self:g={};var _=g,A=function(I){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(I):I&&I.buffer instanceof ArrayBuffer},x=_.BigInt||Number;x("0x1"),x("0x100"),x("0x10000"),x("0x1000000"),x("0x100000000"),x("0x10000000000"),x("0x1000000000000"),x("0x100000000000000"),x("0x10000000000000000"),(function(){var T=new Uint16Array([65484]),I=new Uint8Array(T.buffer,T.byteOffset,T.byteLength);return I[0]===255?"big":I[0]===204?"little":"unknown"})();const L=function(T){const I={};return Object.keys(T).forEach(M=>{const N=T[M];A(N)?I[M]={bytes:N.buffer,byteOffset:N.byteOffset,byteLength:N.byteLength}:I[M]=N}),I};self.onmessage=function(T){const I=T.data,M=new Uint8Array(I.encrypted.bytes,I.encrypted.byteOffset,I.encrypted.byteLength),N=new Uint32Array(I.key.bytes,I.key.byteOffset,I.key.byteLength/4),O=new Uint32Array(I.iv.bytes,I.iv.byteOffset,I.iv.byteLength/4);new l(M,N,O,function(j,F){self.postMessage(L({source:I.source,decrypted:F}),[F.buffer])})}}));var Vv=af($v);const Hv=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Sf=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Ao=(s,e)=>{e.activePlaylistLoader=s,s.load()},zv=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:i},mediaTypes:{[s]:r}}=e,n=r.activeTrack(),a=r.getActiveGroup(),u=r.activePlaylistLoader,l=r.lastGroup_;if(!(a&&l&&a.id===l.id)&&(r.lastGroup_=a,r.lastTrack_=n,Sf(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),Ao(a.playlistLoader,r)}},Gv=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Wv=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:i,main:r},mediaTypes:{[s]:n}}=e,a=n.activeTrack(),u=n.getActiveGroup(),l=n.activePlaylistLoader,f=n.lastTrack_;if(!(f&&a&&f.id===a.id)&&(n.lastGroup_=u,n.lastTrack_=a,Sf(i,n),!!u)){if(u.isMainPlaylist){if(!a||!f||a.id===f.id)return;const g=e.vhs.playlistController_,_=g.selectPlaylist();if(g.media()===_)return;n.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),r.resetEverything(),g.fastQualityChange_(_);return}if(s==="AUDIO"){if(!u.playlistLoader){r.setAudio(!0),r.resetEverything();return}i.setAudio(!0),r.setAudio(!1)}if(l===u.playlistLoader){Ao(u.playlistLoader,n);return}i.track&&i.track(a),i.resetEverything(),Ao(u.playlistLoader,n)}},Pn={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:i}=e,r=t.activeTrack(),n=t.activeGroup(),a=(n.filter(l=>l.default)[0]||n[0]).id,u=t.tracks[a];if(r===u){i({error:{message:"Problem encountered loading the default audio track."}});return}q.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const l in t.tracks)t.tracks[l].enabled=t.tracks[l]===u;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;q.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},Lc={AUDIO:(s,e,t)=>{if(!e)return;const{tech:i,requestOptions:r,segmentLoaders:{[s]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,r),(!i.paused()||a.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),r),i.paused()||n.load()}),e.on("error",Pn[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:i,requestOptions:r,segmentLoaders:{[s]:n},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const u=e.media();n.playlist(u,r),n.track(a.activeTrack()),(!i.paused()||u.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),r),i.paused()||n.load()}),e.on("error",Pn[s](s,t))}},Xv={AUDIO:(s,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[s]:r},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[s]:{groups:u,tracks:l,logger_:f}},mainPlaylistLoader:g}=e,_=Cr(g.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},_&&(a[s].main.default.playlists=g.main.playlists));for(const A in a[s]){u[A]||(u[A]=[]);for(const x in a[s][A]){let L=a[s][A][x],T;if(_?(f(`AUDIO group '${A}' label '${x}' is a main playlist`),L.isMainPlaylist=!0,T=null):i==="vhs-json"&&L.playlists?T=new as(L.playlists[0],t,n):L.resolvedUri?T=new as(L.resolvedUri,t,n):L.playlists&&i==="dash"?T=new xo(L.playlists[0],t,n,g):T=null,L=Ae({id:x,playlistLoader:T},L),Lc[s](s,L.playlistLoader,e),u[A].push(L),typeof l[x]>"u"){const I=new q.AudioTrack({id:x,kind:Hv(L),enabled:!1,language:L.language,default:L.default,label:x});l[x]=I}}}r.on("error",Pn[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:i,sourceType:r,segmentLoaders:{[s]:n},requestOptions:a,main:{mediaGroups:u},mediaTypes:{[s]:{groups:l,tracks:f}},mainPlaylistLoader:g}=e;for(const _ in u[s]){l[_]||(l[_]=[]);for(const A in u[s][_]){if(!i.options_.useForcedSubtitles&&u[s][_][A].forced)continue;let x=u[s][_][A],L;if(r==="hls")L=new as(x.resolvedUri,i,a);else if(r==="dash"){if(!x.playlists.filter(I=>I.excludeUntil!==1/0).length)return;L=new xo(x.playlists[0],i,a,g)}else r==="vhs-json"&&(L=new as(x.playlists?x.playlists[0]:x.resolvedUri,i,a));if(x=Ae({id:A,playlistLoader:L},x),Lc[s](s,x.playlistLoader,e),l[_].push(x),typeof f[A]>"u"){const T=t.addRemoteTextTrack({id:A,kind:"subtitles",default:x.default&&x.autoselect,language:x.language,label:A},!1).track;f[A]=T}}}n.on("error",Pn[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[s]:{groups:r,tracks:n}}}=e;for(const a in i[s]){r[a]||(r[a]=[]);for(const u in i[s][a]){const l=i[s][a][u];if(!/^(?:CC|SERVICE)/.test(l.instreamId))continue;const f=t.options_.vhs&&t.options_.vhs.captionServices||{};let g={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(f[g.instreamId]&&(g=Ae(g,f[g.instreamId])),g.default===void 0&&delete g.default,r[a].push(Ae({id:u},l)),typeof n[u]>"u"){const _=t.addRemoteTextTrack({id:g.instreamId,kind:"captions",default:g.default,language:g.language,label:g.label},!1).track;n[u]=_}}}}},Ef=(s,e)=>{for(let t=0;t<s.length;t++)if(du(e,s[t])||s[t].playlists&&Ef(s[t].playlists,e))return!0;return!1},Kv=(s,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[s]:{groups:r}}}=e,n=i.media();if(!n)return null;let a=null;n.attributes[s]&&(a=r[n.attributes[s]]);const u=Object.keys(r);if(!a)if(s==="AUDIO"&&u.length>1&&Cr(e.main))for(let l=0;l<u.length;l++){const f=r[u[l]];if(Ef(f,n)){a=f;break}}else r.main?a=r.main:u.length===1&&(a=r[u[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(l=>l.id===t.id)[0]||null},Yv={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},Qv=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},Jv=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{Xv[f](f,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:r,segmentLoaders:{["AUDIO"]:n,main:a}}=s;["AUDIO","SUBTITLES"].forEach(f=>{e[f].activeGroup=Kv(f,s),e[f].activeTrack=Yv[f](f,s),e[f].onGroupChanged=zv(f,s),e[f].onGroupChanging=Gv(f,s),e[f].onTrackChanged=Wv(f,s),e[f].getActiveGroup=Qv(f,s)});const u=e.AUDIO.activeGroup();if(u){const f=(u.filter(_=>_.default)[0]||u[0]).id;e.AUDIO.tracks[f].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(f=>e[f].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanging())});const l=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",l),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{i.audioTracks().removeEventListener("change",l),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const f in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[f])},Zv=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:oi,activeTrack:oi,getActiveGroup:oi,onGroupChanged:oi,onTrackChanged:oi,lastTrack_:null,logger_:Rt(`MediaGroups[${e}]`)}}),s};class Oc{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=gt(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class eb extends q.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Oc,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.currentPathwayClones=new Map,this.nextPathwayClones=new Map,this.excludedSteeringManifestURLs=new Set,this.logger_=Rt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=gt(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const f=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${f} seconds.`),this.startTTLTimeout_(parseInt(f,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let u;try{u=JSON.parse(this.request_.responseText)}catch(f){const g={errorType:q.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:g})}this.assignSteeringProperties_(u);const l={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:l}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new D.URL(e),i=new D.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(D.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new D.URL(e),i=this.getPathway(),r=this.getBandwidth_();if(i){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,i)}if(r){const n=`_${this.manifestType_}_throughput`;t.searchParams.set(n,r)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(r=>{for(const n of r)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=r=>this.excludedSteeringManifestURLs.has(r);if(this.proxyServerUrl_){const r=this.setProxyServerUrl_(e);if(!t(r))return r}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=D.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){D.clearTimeout(this.ttlTimeout_),this.ttlTimeout_=null}abort(){this.request_&&this.request_.abort(),this.request_=null}dispose(){this.off("content-steering"),this.off("error"),this.abort(),this.clearTTLTimeout_(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=null,this.proxyServerUrl_=null,this.manifestType_=null,this.ttlTimeout_=null,this.request_=null,this.excludedSteeringManifestURLs=new Set,this.availablePathways_=new Set,this.steeringManifest=new Oc}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(gt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const tb=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},ib=10;let bi;const sb=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],rb=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},nb=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:u,log:l}){if(!i)return q.log.warn("We received no playlist to switch to. Please check your stream."),!1;const f=`allowing switch ${s&&s.id||"null"} -> ${i.id}`;if(!s)return l(`${f} as current playlist is not set`),!0;if(i.id===s.id)return!1;const g=!!ns(e,t).length;if(!s.endList)return!g&&typeof s.partTargetDuration=="number"?(l(`not ${f} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(l(`${f} as current playlist is live`),!0);const _=uu(e,t),A=u?Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ze.MAX_BUFFER_LOW_WATER_LINE;if(a<A)return l(`${f} as duration < max low water line (${a} < ${A})`),!0;const x=i.attributes.BANDWIDTH,L=s.attributes.BANDWIDTH;if(x<L&&(!u||_<n)){let T=`${f} as next bandwidth < current bandwidth (${x} < ${L})`;return u&&(T+=` and forwardBuffer < bufferHighWaterLine (${_} < ${n})`),l(T),!0}if((!u||x>L)&&_>=r){let T=`${f} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return u&&(T+=` and next bandwidth > current bandwidth (${x} > ${L})`),l(T),!0}return l(`not ${f} as no switching criteria met`),!1};class ab extends q.EventTarget{constructor(e){super(),this.fastQualityChange_=tb(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:r,bandwidth:n,externVhs:a,useCueTags:u,playlistExclusionDuration:l,enableLowInitialPlaylist:f,sourceType:g,cacheEncryptionKeys:_,bufferBasedABR:A,leastPixelDiffSelector:x,captionServices:L,experimentalUseMMS:T}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:I}=e;(I===null||typeof I>"u")&&(I=1/0),bi=a,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!x,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=g,this.useCueTags_=u,this.playlistExclusionDuration=l,this.maxPlaylistRetries=I,this.enableLowInitialPlaylist=f,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:I,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Zv(),T&&D.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new D.ManagedMediaSource,this.usingManagedMediaSource_=!0,q.log("Using ManagedMediaSource")):D.MediaSource&&(this.mediaSource=new D.MediaSource),this.handleDurationChange_=this.handleDurationChange_.bind(this),this.handleSourceOpen_=this.handleSourceOpen_.bind(this),this.handleSourceEnded_=this.handleSourceEnded_.bind(this),this.load=this.load.bind(this),this.pause=this.pause.bind(this),this.mediaSource.addEventListener("durationchange",this.handleDurationChange_),this.mediaSource.addEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.addEventListener("sourceended",this.handleSourceEnded_),this.mediaSource.addEventListener("startstreaming",this.load),this.mediaSource.addEventListener("endstreaming",this.pause),this.seekable_=tt(),this.hasPlayed_=!1,this.syncController_=new jv(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new Vv,this.sourceUpdater_=new bf(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new qv,this.keyStatusMap_=new Map;const M={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:L,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:_,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new xo(t,this.vhs_,Ae(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new as(t,this.vhs_,Ae(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Co(Ae(M,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Co(Ae(M,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Nv(Ae(M,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((j,F)=>{function U(){r.off("vttjserror",R),j()}function R(){r.off("vttjsloaded",U),F()}r.one("vttjsloaded",U),r.one("vttjserror",R),r.addWebVttScript_()})}),e);const N=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new eb(this.vhs_.xhr,N),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),sb.forEach(j=>{this[j+"_"]=rb.bind(this,j)}),this.logger_=Rt("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 O=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(O,()=>{const j=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-j,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,i){const r=this.media(),n=r&&(r.id||r.uri),a=e&&(e.id||e.uri);if(n&&n!==a){this.logger_(`switch media ${n} -> ${a} from ${t}`);const u={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:u}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(i&&r){const a=(i.length?i[0].playlists:i.playlists).filter(u=>u.attributes.serviceLocation===r);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=D.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(D.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 i=e.mediaGroups.AUDIO,r=Object.keys(i);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const u=i.main||r.length&&i[r[0]];for(const l in u)if(u[l].default){n={label:l};break}}if(!n)return t;const a=[];for(const u in i)if(i[u][n.label]){const l=i[u][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 f=0;f<e.playlists.length;f++){const g=e.playlists[f];g.attributes&&g.attributes.AUDIO&&g.attributes.AUDIO===u&&a.push(g)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;_o(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),Jv({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(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;_o(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(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"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(Ge({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let r=!0;const n=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const u in i.AUDIO[a])i.AUDIO[a][u].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),bi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(i.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_,i=this.tech_.currentTime(),r=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return nb({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,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 i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),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.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const r=i.segment.syncInfo.end+.01;this.tech_.setCurrentTime(r)}),this.timelineChangeController_.on("fixBadTimelineChange",()=>{this.logger_("Fix bad timeline change. Restarting al segment loaders..."),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}),this.mainSegmentLoader_.on("earlyabort",i=>{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:ib}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};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()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,r=>{this.player_.trigger(Ge({},r))}),this.audioSegmentLoader_.on(i,r=>{this.player_.trigger(Ge({},r))}),this.subtitleSegmentLoader_.on(i,r=>{this.player_.trigger(Ge({},r))})})}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()}pause(){this.mainSegmentLoader_.pause(),this.mediaTypes_.AUDIO.activePlaylistLoader&&this.audioSegmentLoader_.pause(),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&this.subtitleSegmentLoader_.pause()}fastQualityChange_(e=this.selectPlaylist()){if(e&&e===this.mainPlaylistLoader_.media()){this.logger_("skipping fastQualityChange because new media is same as old");return}this.switchMedia_(e,"fast-quality"),this.waitingForFastQualityPlaylistReceived_=!0}runFastQualitySwitch_(){this.waitingForFastQualityPlaylistReceived_=!1,this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}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()<e.start(0))return this.tech_.setCurrentTime(e.end(e.length-1))}setupFirstPlay(){const e=this.mainPlaylistLoader_.media();if(!e||this.tech_.paused()||this.hasPlayed_)return!1;if(!e.endList||e.start){const t=this.seekable();if(!t.length)return!1;const i=t.end(0);let r=i;if(e.start){const n=e.start.timeOffset;n<0?r=Math.max(i+n,t.start(0)):r=Math.min(i,n)}this.trigger("firstplay"),this.tech_.setCurrentTime(r)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}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 i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const r=bi.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-n<=Qt;const u=a.end(a.length-1);return u-n<=Qt&&r-u<=Qt}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const r=this.mainPlaylistLoader_.main.playlists,n=r.filter(ea),a=n.length===1&&n[0]===e;if(r.length===1&&i!==1/0)return q.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){if(this.main().contentSteering){const L=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(L),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(L)},T);return}let x=!1;r.forEach(L=>{if(L===e)return;const T=L.excludeUntil;typeof T<"u"&&T!==1/0&&(x=!0,delete L.excludeUntil)}),x&&(q.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let u;e.playlistErrors_>this.maxPlaylistRetries?u=1/0:u=Date.now()+i*1e3,e.excludeUntil=u,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 f=t.internal?this.logger_:q.log.warn,g=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${g} 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 _=l.targetDuration/2*1e3||5*1e3,A=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=_;return this.switchMedia_(l,"exclude",a||A)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],r=e==="all";(r||e==="main")&&i.push(this.mainPlaylistLoader_);const n=[];(r||e==="audio")&&n.push("AUDIO"),(r||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const u=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;u&&i.push(u)}),["main","audio","subtitle"].forEach(a=>{const u=this[`${a}SegmentLoader_`];u&&(e===a||e==="all")&&i.push(u)}),i.forEach(a=>t.forEach(u=>{typeof a[u]=="function"&&a[u]()}))}setCurrentTime(e){const t=ns(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),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:bi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const r=this.syncController_.getMediaSequenceSync(t);if(r&&r.isReliable){const u=r.start,l=r.end;if(!isFinite(u)||!isFinite(l))return null;const f=bi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),g=Math.max(u,l-f);return tt([[u,g]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=bi.Playlist.seekable(i,n,bi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),r=e.end(0),n=t.start(0),a=t.end(0);return n>r||i>a?e:tt([[Math.max(i,n),Math.min(r,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Oh(this.seekable_)}]`);const r={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:r}),this.tech_.trigger("seekablechanged")}updateDuration(e){if(this.updateDuration_&&(this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.updateDuration_=null),this.mediaSource.readyState!=="open"){this.updateDuration_=this.updateDuration.bind(this,e),this.mediaSource.addEventListener("sourceopen",this.updateDuration_);return}if(e){const r=this.seekable();if(!r.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<r.end(r.length-1))&&this.sourceUpdater_.setDuration(r.end(r.length-1));return}const t=this.tech_.buffered();let i=bi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(r=>{r.playlistLoader&&r.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_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=fr(this.main(),t),r={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=i.video||e.main.videoCodec||Xg),e.main.isMuxed&&(r.video+=`,${i.audio||e.main.audioCodec||xl}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(r.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||xl,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!r.audio&&!r.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(f,g)=>f?ur(g,this.usingManagedMediaSource_):Pa(g),u={};let l;if(["video","audio"].forEach(function(f){if(r.hasOwnProperty(f)&&!a(e[f].isFmp4,r[f])){const g=e[f].isFmp4?"browser":"muxer";u[g]=u[g]||[],u[g].push(r[f]),f==="audio"&&(l=g)}}),n&&l&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(g=>{(g.attributes&&g.attributes.AUDIO)===f&&g!==t&&(g.excludeUntil=1/0)}),this.logger_(`excluding audio group ${f} as ${l} does not support codec(s): "${r.audio}"`)}if(Object.keys(u).length){const f=Object.keys(u).reduce((g,_)=>(g&&(g+=", "),g+=`${_} does not support codec(s): "${u[_].join(",")}"`,g),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:f},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const f=[];if(["video","audio"].forEach(g=>{const _=(Wt(this.sourceUpdater_.codecs[g]||"")[0]||{}).type,A=(Wt(r[g]||"")[0]||{}).type;_&&A&&_.toLowerCase()!==A.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[g]}" -> "${r[g]}"`)}),f.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${f.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return r}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(i=>{const r=e[i];if(t.indexOf(r.id)!==-1)return;t.push(r.id);const n=fr(this.main,r),a=[];n.audio&&!Pa(n.audio)&&!ur(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Pa(n.video)&&!ur(n.video,this.usingManagedMediaSource_)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,r=yr(Wt(e)),n=mc(r),a=r.video&&Wt(r.video)[0]||null,u=r.audio&&Wt(r.audio)[0]||null;Object.keys(i).forEach(l=>{const f=i[l];if(t.indexOf(f.id)!==-1||f.excludeUntil===1/0)return;t.push(f.id);const g=[],_=fr(this.mainPlaylistLoader_.main,f),A=mc(_);if(!(!_.audio&&!_.video)){if(A!==n&&g.push(`codec count "${A}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const x=_.video&&Wt(_.video)[0]||null,L=_.audio&&Wt(_.audio)[0]||null;x&&a&&x.type.toLowerCase()!==a.type.toLowerCase()&&g.push(`video codec "${x.type}" !== "${a.type}"`),L&&u&&L.type.toLowerCase()!==u.type.toLowerCase()&&g.push(`audio codec "${L.type}" !== "${u.type}"`)}g.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${g.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),Bv(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Ze.GOAL_BUFFER_LENGTH,i=Ze.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Ze.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Ze.BUFFER_LOW_WATER_LINE,i=Ze.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Ze.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return Ze.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Sc(this.inbandTextTracks_,"com.apple.streaming",this.tech_),gv({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Sc(this.inbandTextTracks_,e,this.tech_),fv({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(Ge({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const u of t.playlists){const l=u.attributes.serviceLocation;if(l&&(a.push(l),!n.has(l)))return!0}return!!(!a.length&&n.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,r=new Set;let n=!1;Object.keys(i).forEach(a=>{const u=i[a],l=this.pathwayAttribute_(u),f=l&&e!==l;u.excludeUntil===1/0&&u.lastExcludeReason_==="content-steering"&&!f&&(delete u.excludeUntil,delete u.lastExcludeReason_,n=!0);const _=!u.excludeUntil&&u.excludeUntil!==1/0;!r.has(u.id)&&f&&_&&(r.add(u.id),u.excludeUntil=1/0,u.lastExcludeReason_="content-steering",this.logger_(`excluding ${u.id} for ${u.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const u=this.mediaTypes_[a];if(u.activePlaylistLoader){const l=u.activePlaylistLoader.media_;l&&l.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,r=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||r&&r.size){for(const[a,u]of i.entries())r.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(u),this.contentSteeringController_.excludePathway(a));for(const[a,u]of r.entries()){const l=i.get(a);if(!l){t.filter(g=>g.attributes["PATHWAY-ID"]===u["BASE-ID"]).forEach(g=>{this.mainPlaylistLoader_.addClonePathway(u,g)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(l,u)||(this.mainPlaylistLoader_.updateOrDeleteClone(u,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...r])))}}equalPathwayClones_(e,t){if(e["BASE-ID"]!==t["BASE-ID"]||e.ID!==t.ID||e["URI-REPLACEMENT"].HOST!==t["URI-REPLACEMENT"].HOST)return!1;const i=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(const n in i)if(i[n]!==r[n])return!1;for(const n in r)if(i[n]!==r[n])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const r=this.mainPlaylistLoader_.getKeyIdSet(i);!r||!r.size||r.forEach(n=>{const a="usable",u=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,l=i.lastExcludeReason_===t&&i.excludeUntil===1/0;u?u&&l&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${n} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const r=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,n=i.excludeUntil===1/0&&i.lastExcludeReason_===t;r&&n&&(delete i.excludeUntil,q.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:Ov(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${n} added to the keyStatusMap`),this.keyStatusMap_.set(n,t)}updatePlaylistByKeyStatus(e,t){this.addKeyStatus_(e,t),this.waitingForFastQualityPlaylistReceived_||this.excludeNonUsableThenChangePlaylist_(),this.mainPlaylistLoader_.off("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this)),this.mainPlaylistLoader_.on("loadedplaylist",this.excludeNonUsableThenChangePlaylist_.bind(this))}excludeNonUsableThenChangePlaylist_(){this.excludeNonUsablePlaylistsByKeyId_(),this.fastQualityChange_()}}const ob=(s,e,t)=>i=>{const r=s.main.playlists[e],n=cu(r),a=ea(r);if(typeof i>"u")return a;i?delete r.disabled:r.disabled=!0;const u={renditionInfo:{id:e,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return i!==a&&!n&&(i?(t(r),s.trigger({type:"renditionenabled",metadata:u})):s.trigger({type:"renditiondisabled",metadata:u})),i};class ub{constructor(e,t,i){const{playlistController_:r}=e,n=r.fastQualityChange_.bind(r);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=fr(r.main(),t),this.playlist=t,this.id=i,this.enabled=ob(e.playlists,t.id,n)}}const lb=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Cr(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!cu(i)).map((i,r)=>new ub(s,i,i.id)):[]}},Rc=["seeking","seeked","pause","playing","error"];class cb extends q.EventTarget{constructor(e){super(),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.playedRanges_=[],this.consecutiveUpdates=0,this.lastRecordedTime=null,this.checkCurrentTimeTimeout_=null,this.logger_=Rt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,u=["main","subtitle","audio"],l={};u.forEach(g=>{l[g]={reset:()=>this.resetSegmentDownloads_(g),updateend:()=>this.checkSegmentDownloads_(g)},a[`${g}SegmentLoader_`].on("appendsdone",l[g].updateend),a[`${g}SegmentLoader_`].on("playlistupdate",l[g].reset),this.tech_.on(["seeked","seeking"],l[g].reset)});const f=g=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][g]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),f("off"))},this.clearSeekingAppendCheck_=()=>f("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),f("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Rc,n),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Rc,n),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),u.forEach(g=>{a[`${g}SegmentLoader_`].off("appendsdone",l[g].updateend),a[`${g}SegmentLoader_`].off("playlistupdate",l[g].reset),this.tech_.off(["seeked","seeking"],l[g].reset)}),this.checkCurrentTimeTimeout_&&D.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&D.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=D.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_,i=t[`${e}SegmentLoader_`],r=i.buffered_(),n=Ky(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,n){const a={bufferedRanges:r};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:qi(r)}),!(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+Qt>=t.end(t.length-1)))return this.techWaiting_();if(this.consecutiveUpdates>=5&&e===this.lastRecordedTime)this.consecutiveUpdates++,this.waiting_();else if(e===this.lastRecordedTime)this.consecutiveUpdates++;else{this.playedRanges_.push(tt([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),r=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(r&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const L=t.start(0);n=L+(L===t.end(0)?0:Qt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Oh(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,u=this.tech_.buffered(),l=a.audioBuffer?a.audioBuffered():null,f=a.videoBuffer?a.videoBuffered():null,g=this.media(),_=g.partTargetDuration?g.partTargetDuration:(g.targetDuration-Yt)*2,A=[l,f];for(let L=0;L<A.length;L++){if(!A[L])continue;if(uu(A[L],i)<_)return!1}const x=nn(u,i);return x.length===0?!1:(n=x.start(0)+Qt,this.logger_(`Buffered region starts (${x.start(0)}) just beyond seek point (${i}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=ns(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.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 u=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${u}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(u),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=nn(r,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,i,r=!1){if(!e.length)return!1;let n=e.end(e.length-1)+Qt;const a=!i.endList,u=typeof i.partTargetDuration=="number";return a&&(u||r)&&(n=e.end(e.length-1)+i.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let r;if(e.length&&t.length){const n=ns(e,i-3),a=ns(e,i),u=ns(t,i);u.length&&!a.length&&n.length&&(r={start:n.end(0),end:u.end(0)})}else nn(e,i).length||(r=this.gapFromVideoUnderflow_(e,i));return r?(this.logger_(`Encountered a gap in video from ${r.start} to ${r.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),r=nn(t,i);if(this.resetTimeUpdate_(),r.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+Yt);const n={gapInfo:{from:i,to:r.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:n}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=Gy(e);for(let r=0;r<i.length;r++){const n=i.start(r),a=i.end(r);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}const db={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},Cf=function(s,e){let t=0,i=0;const r=Ae(db,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){i&&s.currentTime(i)},a=function(g){g!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",n),s.src(g),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},u=function(){if(Date.now()-t<r.errorInterval*1e3){s.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!r.getSource||typeof r.getSource!="function"){q.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),r.getSource.call(s,a)},l=function(){s.off("loadedmetadata",n),s.off("error",u),s.off("dispose",l)},f=function(g){l(),Cf(s,g)};s.on("error",u),s.on("dispose",l),s.reloadSourceOnError=f},hb=function(s){Cf(this,s)};var wf="3.17.2",fb="7.1.0",pb="1.3.1",mb="7.2.0",gb="4.0.2";const je={PlaylistLoader:as,Playlist:_t,utils:bT,STANDARD_PLAYLIST_SELECTOR:xc,INITIAL_PLAYLIST_SELECTOR:uv,lastBandwidthSelector:xc,movingAverageBandwidthSelector:av,comparePlaylistBandwidth:fu,comparePlaylistResolution:nv,xhr:Jh()};Object.keys(Ze).forEach(s=>{Object.defineProperty(je,s,{get(){return q.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Ze[s]},set(e){if(q.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){q.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}Ze[s]=e}})});const Af="videojs-vhs",Df=function(s,e){const t=e.media();let i=-1;for(let r=0;r<s.length;r++)if(s[r].id===t.id){i=r;break}s.selectedIndex_=i,s.trigger({selectedIndex:i,type:"change"})},_b=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),Df(s,e.playlists)};je.canPlaySource=function(){return q.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const yb=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=yr(Wt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const r=gs(i.video),n=gs(i.audio),a={};for(const u in s)a[u]={},n&&(a[u].audioContentType=n),r&&(a[u].videoContentType=r),e.contentProtection&&e.contentProtection[u]&&e.contentProtection[u].pssh&&(a[u].pssh=e.contentProtection[u].pssh),typeof s[u]=="string"&&(a[u].url=s[u]);return Ae(s,a)},Tb=(s,e)=>s.reduce((t,i)=>{if(!i.contentProtection)return t;const r=e.reduce((n,a)=>{const u=i.contentProtection[a];return u&&u.pssh&&(n[a]={pssh:u.pssh}),n},{});return Object.keys(r).length&&t.push(r),t},[]),vb=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?i.concat([t]):i,n=Tb(r,Object.keys(e)),a=[],u=[];return n.forEach(l=>{u.push(new Promise((f,g)=>{s.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,g)=>{s.eme.initializeMediaKeys({keySystems:l},_=>{if(_){g(_);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(u)])},bb=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const r=yb(e,t,i);return r?(s.currentSource().keySystems=r,r&&!s.eme?(q.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},kf=()=>{if(!D.localStorage)return null;const s=D.localStorage.getItem(Af);if(!s)return null;try{return JSON.parse(s)}catch{return null}},xb=s=>{if(!D.localStorage)return!1;let e=kf();e=e?Ae(e,s):s;try{D.localStorage.setItem(Af,JSON.stringify(e))}catch{return!1}return e},Sb=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,If=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Pf=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Lf=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Of=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};je.supportsNativeHls=(function(){if(!re||!re.createElement)return!1;const s=re.createElement("video");return q.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(s.canPlayType(t))}):!1})();je.supportsNativeDash=(function(){return!re||!re.createElement||!q.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(re.createElement("video").canPlayType("application/dash+xml"))})();je.supportsTypeNatively=s=>s==="hls"?je.supportsNativeHls:s==="dash"?je.supportsNativeDash:!1;je.isSupported=function(){return q.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};je.xhr.onRequest=function(s){If(je.xhr,s)};je.xhr.onResponse=function(s){Pf(je.xhr,s)};je.xhr.offRequest=function(s){Lf(je.xhr,s)};je.xhr.offResponse=function(s){Of(je.xhr,s)};const Eb=q.getComponent("Component");class Rf extends Eb{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Rt("VhsHandler"),t.options_&&t.options_.playerId){const r=q.getPlayer(t.options_.playerId);this.player_=r}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(re,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const n=re.fullscreenElement||re.webkitFullscreenElement||re.mozFullScreenElement||re.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_(e={}){if(this.options_=Ae(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=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 i=kf();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ze.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ze.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","usePlayerObjectFit","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio,this.usePlayerObjectFit=this.options_.usePlayerObjectFit;const t=this.options_.customPixelRatio;typeof t=="number"&&t>=0&&(this.customPixelRatio=t)}setOptions(e={}){this.setOptions_(e)}src(e,t){if(!e)return;this.setOptions_(),this.options_.src=Sb(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=je,this.options_.sourceType=ed(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new ab(this.options_);const i=Ae({liveRangeSafeTimeDelta:Qt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new cb(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=q.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 r=this.options_.bufferBasedABR?je.movingAverageBandwidthSelector(.55):je.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=je.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=D.navigator.connection||D.navigator.mozConnection||D.navigator.webkitConnection,u=1e7;if(this.options_.useNetworkInformationApi&&a){const l=a.downlink*1e3*1e3;l>=u&&n>=u?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(){q.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:()=>qi(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:()=>qi(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&&xb({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{lb(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_=D.URL.createObjectURL(this.playlistController_.mediaSource),(q.browser.IS_ANY_SAFARI||q.browser.IS_IOS)&&this.options_.overrideNative&&this.options_.sourceType==="hls"&&typeof this.tech_.addSourceElement=="function"?(this.tech_.addSourceElement(this.mediaSourceUrl_),this.tech_.addSourceElement(this.source_.src)):this.tech_.src(this.mediaSourceUrl_))}createKeySessions_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;this.logger_("waiting for EME key session creation"),vb({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=bb({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=q.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{_b(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Df(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":wf,"mux.js":fb,"mpd-parser":pb,"m3u8-parser":mb,"aes-decrypter":gb}}version(){return this.constructor.version()}canChangeType(){return bf.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_&&D.URL.revokeObjectURL&&(D.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return DT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return rf({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{If(this.xhr,e)},this.xhr.onResponse=e=>{Pf(this.xhr,e)},this.xhr.offRequest=e=>{Lf(this.xhr,e)},this.xhr.offResponse=e=>{Of(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,r=>{this.player_.trigger(Ge({},r))})}),t.forEach(i=>{this.playbackWatcher_.on(i,r=>{this.player_.trigger(Ge({},r))})})}}const Ln={name:"videojs-http-streaming",VERSION:wf,canHandleSource(s,e={}){const t=Ae(q.options,e);return!t.vhs.experimentalUseMMS&&!ur("avc1.4d400d,mp4a.40.2",!1)?!1:Ln.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=Ae(q.options,t);return e.vhs=new Rf(s,e,i),e.vhs.xhr=Jh(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=ed(s);if(!t)return"";const i=Ln.getOverrideNative(e);return!je.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(q.browser.IS_ANY_SAFARI||q.browser.IS_IOS),{overrideNative:i=t}=e;return i}},Cb=()=>ur("avc1.4d400d,mp4a.40.2",!0);Cb()&&q.getTech("Html5").registerSourceHandler(Ln,0);q.VhsHandler=Rf;q.VhsSourceHandler=Ln;q.Vhs=je;q.use||q.registerComponent("Vhs",je);q.options.vhs=q.options.vhs||{};(!q.getPlugin||!q.getPlugin("reloadSourceOnError"))&&q.registerPlugin("reloadSourceOnError",hb);function wb(){if(typeof navigator>"u")return!1;const s=navigator.userAgent;return/^((?!chrome|android|crios|fxios).)*safari/i.test(s)}function Ab(){return typeof navigator>"u"?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function Nc(s){if(/\.mkv(\?|$)/i.test(s)&&(wb()||Ab())){const t=s.match(/\/api\/stream\/(?:episode\/)?(\d+)/);if(t){const i=s.includes("/episode/"),r=t[1];return{src:`/api/transcode/${i?`episode-${r}`:`movie-${r}`}/index.m3u8`,type:"application/vnd.apple.mpegurl"}}}return{src:s,type:"video/mp4"}}function Db({src:s,poster:e,onReady:t}){const i=le.useRef(null),r=le.useRef(null),n=le.useRef(t),a=le.useRef(s),u=le.useRef(e);le.useEffect(()=>{n.current=t},[t]),le.useEffect(()=>{if(!i.current)return;const f=document.createElement("video-js");f.classList.add("vjs-big-play-centered"),f.setAttribute("x-webkit-airplay","allow"),f.setAttribute("airplay","allow"),f.setAttribute("playsinline",""),i.current.appendChild(f);const g=q(f,{controls:!1,autoplay:!0,fill:!0,sources:[Nc(a.current)],poster:u.current,html5:{vhs:{overrideNative:!1}}},()=>{g.isDisposed()||n.current?.(g)});return r.current=g,()=>{g.dispose(),r.current=null}},[]),le.useEffect(()=>{const f=r.current;f&&s!==a.current&&f.src(Nc(s))},[s]),le.useEffect(()=>{const f=r.current;!f||e===void 0||e!==u.current&&f.poster(e)},[e]);const l=()=>{r.current&&(r.current.paused()?r.current.play():r.current.pause())};return ee.jsx("div",{ref:i,className:"w-full h-full cursor-pointer [&_video]:object-contain",onClick:l})}function kb(s){const e=Math.floor(s/3600),t=Math.floor(s%3600/60),i=Math.floor(s%60);return(e>0?[e,t,i]:[t,i]).map(n=>n.toString().padStart(2,"0")).join(":")}const un=()=>window;function Ib(s){return/^https?:\/\//i.test(s)?s:`${window.location.origin}${s}`}function Pb({episodeId:s,movieId:e,player:t,streamUrl:i,title:r}){const[n,a]=le.useState({airplayAvailable:!1,chromecastAvailable:!1}),[u,l]=le.useState(!1),f=le.useRef(null),g=le.useRef(null);le.useEffect(()=>{const T=typeof document.querySelector("video")?.webkitShowPlaybackTargetPicker=="function";a(I=>({...I,airplayAvailable:T}))},[t]),le.useEffect(()=>{let L=!1;const T=()=>{if(L)return;const N=un(),O=N.cast?.framework;if(!(!O||!N.chrome?.cast))try{const j=O.CastContext.getInstance(),F=new O.RemotePlayer,U=new O.RemotePlayerController(F);f.current=F,g.current=U;const R=()=>{l(F.isConnected),t&&!F.isConnected&&F.currentTime>0&&(t.currentTime(F.currentTime),t.play())},H=()=>{if(!F.isConnected)return;const v=s?`/api/progress/episode/${s}`:e?`/api/progress/${e}`:null;v&&fetch(v,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:F.currentTime,duration:F.duration})}).catch(()=>{})};U.addEventListener(O.RemotePlayerEventType.IS_CONNECTED_CHANGED,R),U.addEventListener(O.RemotePlayerEventType.CURRENT_TIME_CHANGED,H),a(v=>({...v,chromecastAvailable:!0}))}catch(j){console.warn("Cast framework initialisation failed:",j)}},I=un(),M=I.__onGCastApiAvailable;return I.__onGCastApiAvailable=N=>{M?.(N),N&&T()},I.cast?.framework&&I.chrome?.cast&&T(),()=>{L=!0,g.current,un().cast?.framework}},[t,s,e]);const _=async()=>{const L=un(),T=L.cast?.framework,I=L.chrome;if(!T||!I?.cast){Ja.error("Cast isn't available. Make sure you're using Chrome with a Chromecast on the same network.");return}try{const M=T.CastContext.getInstance();await M.requestSession();const N=M.getCurrentSession();if(!N)return;const O=t?.currentTime()??0,j=Ib(i),F=new I.cast.media.MediaInfo(j,"video/mp4");F.metadata={title:r};const U=new I.cast.media.LoadRequest(F);U.currentTime=O,await N.loadMedia(U),t?.pause()}catch(M){console.warn("Cast session failed:",M),Ja.error("Chromecast couldn't reach Jukebox. Make sure your device is on the same network.")}},A=()=>{const L=document.querySelector("video");L?.webkitShowPlaybackTargetPicker&&L.webkitShowPlaybackTargetPicker()},x=()=>{if(n.airplayAvailable&&n.chromecastAvailable){_();return}if(n.chromecastAvailable){_();return}n.airplayAvailable&&A()};return!n.airplayAvailable&&!n.chromecastAvailable?null:ee.jsx("button",{"aria-label":u?"Stop casting":"Cast",className:"p-2 flex justify-center items-center cursor-pointer",onClick:x,children:ee.jsx(jm,{className:`size-7 hover:scale-125 ${u?"text-blue-400":"text-white"}`})})}function Lb({buffered:s,progress:e,onSeek:t}){const i=le.useRef(null),r=Math.min(Math.max(s,0),1)*100+"%",n=Math.min(Math.max(e,0),1)*100+"%",a=u=>{if(!i.current||!t)return;const l=i.current.getBoundingClientRect(),f=(u.clientX-l.left)/l.width;t(Math.min(Math.max(f,0),1))};return ee.jsxs("div",{ref:i,className:"relative w-full h-4 cursor-pointer flex items-center",onClick:a,children:[ee.jsxs("div",{className:"w-full h-1 rounded-full bg-white/20 relative overflow-hidden",children:[ee.jsx("div",{className:"h-full bg-white/30 absolute left-0 top-0 z-0",style:{width:r}}),ee.jsx("div",{className:"h-full bg-red-600 absolute left-0 top-0 z-10",style:{width:n}})]}),ee.jsx("div",{className:"bg-red-600 rounded-full size-3 absolute top-1/2 -translate-y-1/2 -translate-x-1/2 z-10",style:{left:n}})]})}const Nf="jukebox-volume";function Ob(){try{const s=localStorage.getItem(Nf);if(s)return JSON.parse(s)}catch{}return{volume:1,muted:!1}}function Rb(s,e){try{localStorage.setItem(Nf,JSON.stringify({volume:s,muted:e}))}catch{}}function Nb({player:s}){const[e,t]=le.useState(1),[i,r]=le.useState(!1),n=le.useRef(null);le.useEffect(()=>{if(!s||s.isDisposed())return;const g=Ob();t(g.volume),r(g.muted),s.volume(g.volume),s.muted(g.muted);const _=()=>{const A=s.volume()??1,x=s.muted()??!1;t(A),r(x),Rb(A,x)};return s.on("volumechange",_),()=>{s.isDisposed()||s.off("volumechange",_)}},[s]);const a=()=>{!s||s.isDisposed()||s.muted(!i)},u=g=>{if(!n.current||!s||s.isDisposed())return;const _=n.current.getBoundingClientRect(),A=1-(g.clientY-_.top)/_.height,x=Math.min(Math.max(A,0),1);s.volume(x),x>0&&i&&s.muted(!1)},l=()=>i||e===0?ee.jsx(qc,{className:"size-7 text-white"}):e<.33?ee.jsx($c,{className:"size-7 text-white"}):e<.66?ee.jsx(Uc,{className:"size-7 text-white"}):ee.jsx(jc,{className:"size-7 text-white"}),f=i?0:e*100;return ee.jsxs("div",{className:"relative group",children:[ee.jsx("button",{"aria-label":i?"Unmute":"Mute",className:"p-2 flex justify-center items-center cursor-pointer",onClick:a,children:l()}),ee.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 hidden group-hover:block z-50 pb-2",children:ee.jsx("div",{className:"bg-black/90 rounded-lg p-3 shadow-lg border border-white/20",children:ee.jsxs("div",{ref:n,className:"relative w-2 h-24 bg-white/20 rounded cursor-pointer",onClick:u,children:[ee.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-white rounded",style:{height:`${f}%`}}),ee.jsx("div",{className:"absolute left-1/2 -translate-x-1/2 w-3 h-3 bg-white rounded-full",style:{bottom:`calc(${f}% - 6px)`}})]})})})]})}const Mc=10,Mb=1e4;function Bb({title:s,player:e,movieId:t,episodeId:i,onToggleEpisodes:r,showEpisodesButton:n,streamUrl:a}){const[u,l]=le.useState(!1),[f,g]=le.useState(0),[_,A]=le.useState(0),[x,L]=le.useState(0),T=le.useRef(0);le.useEffect(()=>{if(!e||e.isDisposed())return;const F=()=>l(!0),U=()=>l(!1),R=()=>{const v=e.currentTime()??0,E=e.duration()??0;E>0&&(g(v/E),L(E-v))},H=()=>{const v=e.buffered(),E=e.duration()??0;if(v&&v.length>0&&E>0){const $=v.end(v.length-1);A($/E)}};return e.on("play",F),e.on("pause",U),e.on("timeupdate",R),e.on("progress",H),l(!e.paused()),()=>{e.isDisposed()||(e.off("play",F),e.off("pause",U),e.off("timeupdate",R),e.off("progress",H))}},[e]),le.useEffect(()=>{if(!e)return;const F=async()=>{if(e.isDisposed())return;const R=e.currentTime()??0,H=e.duration()??0;if(R===T.current)return;T.current=R;const v=i?`/api/progress/episode/${i}`:`/api/progress/${t}`;await fetch(v,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:R,duration:H})})},U=setInterval(()=>{F()},Mb);return()=>{clearInterval(U),F()}},[e,t,i]);const I=()=>{e&&(e.paused()?e.play():e.pause())},M=()=>{if(!e)return;const F=e.currentTime()??0;e.currentTime(Math.max(0,F-Mc))},N=()=>{if(!e)return;const F=e.currentTime()??0,U=e.duration()??0;e.currentTime(Math.min(U,F+Mc))},O=()=>{e&&(e.isFullscreen()?e.exitFullscreen():e.requestFullscreen())},j=F=>{if(!e)return;const U=e.duration()??0;e.currentTime(F*U)};return ee.jsxs("div",{className:"px-6 overflow-visible",children:[ee.jsxs("div",{className:"flex items-center gap-4",children:[ee.jsx("div",{className:"flex-1",children:ee.jsx(Lb,{buffered:_,progress:f,onSeek:j})}),ee.jsx("span",{className:"text-white text-xs font-mono whitespace-nowrap",children:kb(x)})]}),ee.jsxs("div",{className:"flex justify-between items-center py-4 relative z-10",children:[ee.jsxs("div",{className:"flex gap-2 items-center",children:[ee.jsx(rr,{"aria-label":u?"Pause":"Play",onClick:I,children:u?ee.jsx(Gm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"}):ee.jsx(Pm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),ee.jsx(rr,{"aria-label":"Skip backward 10 seconds",onClick:M,children:ee.jsx(Xm,{className:"size-7 hover:scale-125 text-white"})}),ee.jsx(rr,{"aria-label":"Skip forward 10 seconds",onClick:N,children:ee.jsx(Ym,{className:"size-7 hover:scale-125 text-white"})}),ee.jsx(Nb,{player:e})]}),ee.jsx("div",{className:"text-white text-sm truncate",children:s}),ee.jsxs("div",{className:"flex gap-2 items-center",children:[a&&ee.jsx(Pb,{episodeId:i,movieId:t,player:e,streamUrl:a,title:s}),n&&r&&ee.jsx(rr,{"aria-label":"Browse episodes",onClick:r,children:ee.jsx($m,{className:"size-7 hover:scale-125 text-white"})}),ee.jsx(rr,{"aria-label":"Toggle fullscreen",onClick:O,children:ee.jsx(Hm,{className:"size-7 hover:scale-125 text-white"})})]})]})]})}function rr({"aria-label":s,children:e,onClick:t}){return ee.jsx("button",{"aria-label":s,className:"p-2 flex justify-center items-center cursor-pointer",onClick:t,children:e})}function Bc({currentEpisodeId:s,onClose:e,onSelectEpisode:t,onSelectSeason:i,progressMap:r,seasons:n,selectedSeason:a,showTitle:u}){const l=n.find(f=>f.seasonNumber===a);return ee.jsxs("div",{className:"bg-black/95 border-l border-white/10 h-full flex flex-col",children:[ee.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[ee.jsx("span",{className:"text-white text-sm font-medium truncate",children:u}),ee.jsx("button",{"aria-label":"Close episode panel",className:"min-h-11 min-w-11 flex items-center justify-center text-white/60 hover:text-white cursor-pointer flex-shrink-0 ml-2",onClick:e,children:ee.jsx(Fc,{className:"size-5"})})]}),ee.jsx("div",{className:"flex gap-1 px-4 py-3 border-b border-white/10 flex-wrap",children:n.map(f=>ee.jsxs("button",{className:`px-3 min-h-11 rounded text-sm font-medium cursor-pointer transition-colors ${f.seasonNumber===a?"bg-white text-black":"text-white/60 hover:text-white hover:bg-white/10"}`,onClick:()=>i(f.seasonNumber),children:["Season ",f.seasonNumber]},f.seasonNumber))}),ee.jsx("div",{className:"flex-1 overflow-y-auto slim-scrollbar",children:l?.episodes.map(f=>{const g=f.id===s,_=r?.[f.id],A=_?.duration?Math.min(_.currentTime/_.duration*100,100):0,x=_?.duration?_.currentTime>=_.duration*.9:!1;return ee.jsxs("button",{className:`w-full text-left px-4 py-3 border-l-2 transition-colors ${g?"bg-white/10 border-red-600":"border-transparent hover:bg-white/5"}`,onClick:()=>{t(f),e()},children:[ee.jsxs("div",{className:"text-white/60 text-xs mb-1",children:["E",f.episodeNumber,f.runtime!=null&&` · ${f.runtime}m`,x&&ee.jsx("span",{className:"ml-2 text-white/30",children:"Watched"})]}),ee.jsx("div",{className:`text-sm leading-snug ${x?"text-white/40":"text-white"}`,children:f.title}),A>0&&!x&&ee.jsx("div",{className:"mt-1.5 h-0.5 w-full rounded-full bg-white/10",children:ee.jsx("div",{className:"h-full rounded-full bg-red-600",style:{width:`${A}%`}})})]},f.id)})})]})}const Fb=9,Ub=1e3;function jb({nextEpisode:s,show:e,onPlayNow:t,onCancel:i,countdownSeconds:r=Fb,isCountingDown:n}){const a=le.useRef(null),u=le.useRef(!1),l=le.useRef(t);le.useEffect(()=>{l.current=t},[t]),le.useEffect(()=>{if(!n){u.current=!1;return}const _=a.current;if(!_)return;const A=_.animate([{transform:"scaleX(0)"},{transform:"scaleX(1)"}],{duration:r*1e3,easing:"linear",fill:"forwards"}),x=setTimeout(()=>{u.current||(u.current=!0,l.current())},r*1e3+Ub);return()=>{A.cancel(),clearTimeout(x)}},[n,r]);const f=le.useMemo(()=>`S${s.seasonNumber} E${s.episodeNumber} · ${s.title}`,[s]),g=()=>{u.current||(u.current=!0,t())};return ee.jsxs("div",{"aria-live":"polite",className:"absolute bottom-24 right-6 z-40 w-80 max-w-[calc(100vw-3rem)] rounded-lg bg-black/85 p-4 shadow-2xl ring-1 ring-white/10 backdrop-blur",role:"dialog",children:[ee.jsxs("div",{className:"flex gap-3",children:[ee.jsx("div",{className:"w-20 flex-shrink-0 overflow-hidden rounded",children:ee.jsx(Lm,{alt:e.title,path:e.posterPath,size:"w185",title:e.title})}),ee.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[ee.jsx("span",{className:"text-xs uppercase tracking-wide text-white/60",children:"Up next"}),ee.jsx("h3",{className:"mt-1 truncate text-sm font-semibold text-white",children:e.title}),ee.jsx("p",{className:"mt-0.5 truncate text-xs text-white/70",children:f})]})]}),ee.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[ee.jsxs(Za,{className:"flex-1 relative overflow-hidden bg-white/15 text-white hover:bg-white/25",onClick:g,size:"sm",children:[ee.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-0 left-0 w-full origin-left bg-white",ref:a,style:{transform:"scaleX(0)"}}),ee.jsx("span",{className:"relative mix-blend-difference",children:"Next episode"})]}),ee.jsx(Za,{className:"flex-1",onClick:i,size:"sm",variant:"outline",children:"Cancel"})]})]})}function qb({muted:s,visible:e,volume:t}){const i=()=>s||t===0?ee.jsx(qc,{className:"size-6 text-white"}):t<.33?ee.jsx($c,{className:"size-6 text-white"}):t<.66?ee.jsx(Uc,{className:"size-6 text-white"}):ee.jsx(jc,{className:"size-6 text-white"}),r=s?0:t*100;return ee.jsx("div",{"aria-hidden":"true",className:`absolute top-8 left-1/2 -translate-x-1/2 z-40 pointer-events-none transition-opacity duration-200 ${e?"opacity-100":"opacity-0"}`,children:ee.jsxs("div",{className:"bg-black/70 rounded-full px-4 py-2 flex items-center gap-3 text-white",children:[i(),ee.jsx("div",{className:"relative w-32 h-1.5 bg-white/25 rounded-full overflow-hidden",children:ee.jsx("div",{className:"absolute top-0 left-0 bottom-0 bg-white rounded-full transition-[width] duration-150",style:{width:`${r}%`}})})]})})}async function $b(s,e){const t=await fetch(`/api/library/shows/${s}/next-episode?afterEpisodeId=${e}`);if(t.status===404)return null;if(!t.ok)throw new Error("Failed to fetch next episode");return await t.json()}function Vb(s,e,t={}){const i=(t.enabled??!0)&&!!s&&!!e;return ss({queryKey:["next-episode",s,e],queryFn:()=>$b(s??0,e??0),enabled:i,retry:!1})}async function Hb(s){const e=await fetch(`/api/library/movies/${s}`);if(!e.ok)throw new Error("Failed to fetch movie");return await e.json()}async function zb(s){return await(await fetch(`/api/progress/${s}`)).json()}async function Gb(s){const e=await fetch(`/api/library/shows/episodes/${s}`);if(!e.ok)throw new Error("Failed to fetch episode");return await e.json()}async function Wb(s){const e=await fetch(`/api/library/shows/${s}`);if(!e.ok)throw new Error("Failed to fetch show");return await e.json()}async function Xb(s){return await(await fetch(`/api/progress/episode/${s}`)).json()}async function Kb(s){const e=await fetch(`/api/progress/episode/show/${s}`);return e.ok?await e.json():{}}const Yb=3e3,Qb=45;function t2(){const{id:s}=Om(),e=Rm(),t=Nm(),i=e.pathname.startsWith("/watch/episode/"),[r,n]=le.useState(!0),[a,u]=le.useState(!1),[l,f]=le.useState(null),[g,_]=le.useState(!1),[A,x]=le.useState(1),[L,T]=le.useState(!1),[I,M]=le.useState(!1),[N,O]=le.useState(!1),[j,F]=le.useState(!1),[U,R]=le.useState(null),H=le.useRef(!1),v=le.useRef(null),E=le.useRef(null),$=le.useCallback(()=>{n(!0),v.current&&clearTimeout(v.current),a&&(v.current=setTimeout(()=>{n(!1)},Yb))},[a]),G=le.useCallback((xe,Se)=>{R({volume:xe,muted:Se}),E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{R(null)},1200)},[]);le.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>u(!0),Se=()=>u(!1);return l.on("play",xe),l.on("pause",Se),u(!l.paused()),()=>{l.isDisposed()||(l.off("play",xe),l.off("pause",Se))}},[l]),le.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>{l.isDisposed()||G(l.volume()??1,l.muted()??!1)};return l.on("volumechange",xe),()=>{l.isDisposed()||l.off("volumechange",xe)}},[l,G]),le.useEffect(()=>()=>{E.current&&clearTimeout(E.current)},[]),le.useEffect(()=>(a?$():(n(!0),v.current&&clearTimeout(v.current)),()=>{v.current&&clearTimeout(v.current)}),[a,$]),Zi("*",()=>$()),Zi("space",xe=>{xe.preventDefault(),l&&(l.paused()?l.play():l.pause())},[l]),Zi("left",()=>{if(!l)return;const xe=l.currentTime()??0;l.currentTime(Math.max(0,xe-10))},[l]),Zi("right",()=>{if(!l)return;const xe=l.currentTime()??0,Se=l.duration()??0;l.currentTime(Math.min(Se,xe+10))},[l]),Zi("up",xe=>{if(xe.preventDefault(),!l||l.isDisposed())return;const Se=l.volume()??1,rt=Math.min(1,Se+.05);l.muted()&&l.muted(!1),l.volume(rt)},[l]),Zi("down",xe=>{if(xe.preventDefault(),!l||l.isDisposed())return;const Se=l.volume()??1,rt=Math.max(0,Se-.05);l.volume(rt)},[l]);const{data:V,isLoading:J,error:se}=ss({queryKey:["movie",s],queryFn:()=>Hb(s??""),enabled:!!s&&!i,placeholderData:rl}),{data:ne,isLoading:Y,error:te}=ss({queryKey:["episode",s],queryFn:()=>Gb(s??""),enabled:!!s&&i,placeholderData:rl}),X=ne?.episode,Z=ne?.show,{data:ie}=ss({queryKey:["show-for-episode",Z?.id],queryFn:()=>Wb(Z?.id??0),enabled:!!Z}),{data:pe}=ss({queryKey:["show-progress",Z?.id],queryFn:()=>Kb(Z?.id??0),enabled:!!Z}),{data:ge}=ss({queryKey:["progress",i?"episode":"movie",i?X?.id:V?.id],queryFn:()=>i?Xb(X?.id??0):zb(V?.id??0),enabled:i?!!X:!!V});le.useEffect(()=>{X&&x(X.seasonNumber)},[X]),le.useEffect(()=>{l&&ge&&ge.currentTime>0&&!H.current&&(H.current=!0,l.currentTime(ge.currentTime))},[l,ge]);const{data:_e}=Vb(Z?.id,X?.id,{enabled:i}),ce=_e?.episode??null,We=_e?.show??null;le.useEffect(()=>{T(!1),M(!1),O(!1),H.current=!1},[X?.id]),le.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>F(!1);return l.on("playing",xe),()=>{l.isDisposed()||l.off("playing",xe)}},[l]);const Ye=le.useCallback(()=>{ce&&(F(!0),t(`/watch/episode/${ce.id}`))},[ce,t]);le.useEffect(()=>{if(!l||l.isDisposed()||!i)return;const xe=()=>{const rt=l.currentTime()??0,$e=l.duration()??0;if($e<=0)return;$e-rt<=Qb&&!L&&ce&&(M(!0),O(!0))},Se=()=>{if(!ce){Ja("You've finished all episodes."),Z&&t(`/shows/${Z.id}`);return}L||(M(!0),O(!0))};return l.on("timeupdate",xe),l.on("ended",Se),()=>{l.isDisposed()||(l.off("timeupdate",xe),l.off("ended",Se))}},[l,i,ce,L,Z,t]);const Ue=le.useCallback(xe=>{if(xe.id!==X?.id){if(l&&X){const Se=l.currentTime()??0,rt=l.duration()??0;fetch(`/api/progress/episode/${X.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:Se,duration:rt})})}F(!0),t(`/watch/episode/${xe.id}`)}},[l,X,t]),Qe=i?Y:J,pt=i?te:se;if(Qe)return ee.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:ee.jsx(Mm,{className:"h-8 w-8 animate-spin text-white"})});if(pt||(i?!X:!V))return ee.jsxs("div",{className:"min-h-screen bg-black flex flex-col items-center justify-center gap-4",children:[ee.jsx("p",{className:"text-white",children:i?"Episode not found":"Movie not found"}),ee.jsx(Za,{asChild:!0,variant:"outline",children:ee.jsx(sl,{to:"/",children:"Back to Library"})})]});const Xe=i?`/api/stream/episode/${X?.id}`:`/api/stream/${V?.id}`,it=i&&X&&Z?`${Z.title} — S${X.seasonNumber} E${X.episodeNumber} · ${X.title}`:V?.title??"";return ee.jsxs("div",{className:`bg-black w-full h-screen relative ${r?"":"cursor-none"}`,onMouseMove:$,children:[ee.jsx("div",{className:"absolute inset-0",children:ee.jsx(Db,{src:Xe,onReady:f})}),ee.jsx("div",{"aria-hidden":"true",className:`absolute inset-0 z-40 bg-black pointer-events-none transition-opacity duration-300 ${j?"opacity-100":"opacity-0"}`}),ee.jsx(qb,{muted:U?.muted??!1,visible:U!==null,volume:U?.volume??0}),i&&I&&ce&&ee.jsx("video",{"aria-hidden":"true",className:"hidden",preload:"auto",src:`/api/stream/episode/${ce.id}`}),i&&I&&ce&&We&&ee.jsx(jb,{isCountingDown:N,nextEpisode:ce,onCancel:()=>{T(!0),M(!1),O(!1)},onPlayNow:Ye,show:We}),i&&ie&&X&&ee.jsxs(ee.Fragment,{children:[ee.jsx("div",{className:`hidden sm:block absolute top-0 right-0 bottom-0 w-96 z-20 ${g?"":"pointer-events-none opacity-0"} transition-opacity duration-200`,children:g&&ee.jsx(Bc,{currentEpisodeId:X.id,onClose:()=>_(!1),onSelectEpisode:Ue,onSelectSeason:x,progressMap:pe,seasons:ie.seasons,selectedSeason:A,showTitle:ie.title})}),ee.jsx(gg,{onOpenChange:_,open:g,children:ee.jsxs(Tg,{className:"sm:hidden h-[85vh] p-0 bg-black/95 border-white/10",hideCloseButton:!0,side:"bottom",children:[ee.jsxs(vg,{className:"sr-only",children:[ie.title," episodes"]}),ee.jsx(Bc,{currentEpisodeId:X.id,onClose:()=>_(!1),onSelectEpisode:Ue,onSelectSeason:x,progressMap:pe,seasons:ie.seasons,selectedSeason:A,showTitle:ie.title})]})})]}),ee.jsx(sl,{"aria-label":"Back to home",className:`absolute top-4 left-4 z-30 flex items-center justify-center size-11 text-white/90 hover:text-white transition-opacity duration-300 ${r?"opacity-100":"opacity-0 pointer-events-none"}`,to:"/",children:ee.jsx(Fm,{className:"size-7"})}),ee.jsx("div",{className:`absolute bottom-0 left-0 right-0 z-30 bg-gradient-to-t from-black/80 to-transparent pt-16 transition-opacity duration-300 ${r?"opacity-100":"opacity-0 pointer-events-none"}`,children:ee.jsx(Bb,{title:it,player:l,movieId:i?void 0:V?.id,episodeId:i?X?.id:void 0,showEpisodesButton:i,streamUrl:Xe,onToggleEpisodes:()=>_(xe=>!xe)})})]})}export{t2 as WatchPage};
|