jukebox-media-server 0.3.0 → 0.4.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 +2 -2
- package/dist/client/assets/{Watch-DNFM488K.js → Watch-DE2orFm6.js} +27 -27
- package/dist/client/assets/{index-BYBYJ0kS.css → index-CLZKF1oG.css} +1 -1
- package/dist/client/assets/index-hOWDqZr2.js +58 -0
- package/dist/client/index.html +2 -2
- package/dist/client/sw.js +1 -1
- package/dist/server/index.js +305 -306
- package/drizzle/0010_metadata_rename.sql +49 -0
- package/drizzle/meta/0009_snapshot.json +1 -1
- package/drizzle/meta/0010_snapshot.json +1059 -0
- package/drizzle/meta/_journal.json +7 -0
- package/package.json +1 -1
- package/dist/client/assets/index-COFfIwFC.js +0 -58
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import{c as wt,r as ue,j as Q,R as Am,C as Dm,a as Nn,b as km,X as jc,T as Im,P as Pm,O as Lm,d as fn,g as vr,e as Om,t as pn,f as Rm,h as Nm,i as Mm,k as Bm,l as Fm,I as qc,m as Um,n as jm,B as to,u as rs,o as qm,p as $m,q as Vm,L as Hm,s as rl,v as nl}from"./index-COFfIwFC.js";const zm=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Gm=wt("arrow-left",zm);const Wm=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],Xm=wt("captions",Wm);const Km=[["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"}]],Ym=wt("cast",Km);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"}]],Jm=wt("list",Qm);const Zm=[["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"}]],eg=wt("maximize",Zm);const tg=[["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"}]],ig=wt("pause",tg);const sg=[["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"}]],rg=wt("rotate-ccw",sg);const ng=[["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"}]],ag=wt("rotate-cw",ng);const og=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],ug=wt("skip-forward",og);const lg=[["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"}]],$c=wt("volume-1",lg);const cg=[["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"}]],Vc=wt("volume-2",cg);const dg=[["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"}]],Hc=wt("volume-x",dg);const hg=[["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"}]],zc=wt("volume",hg),Gc=["shift","alt","meta","mod","ctrl","control"],fg={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 Ci(s){return(fg[s.trim()]||s.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function Wc(s){return Gc.includes(s)}function Ta(s,e=","){return s.toLowerCase().split(e)}function va(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(m=>Ci(m))):a=s.toLocaleLowerCase().split(e).map(m=>Ci(m));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(m=>!Gc.includes(m));return{...l,keys:f,description:r,isSequence:u,hotkey:s,metadata:n}}typeof document<"u"&&(document.addEventListener("keydown",s=>{s.code!==void 0&&Xc([Ci(s.code)])}),document.addEventListener("keyup",s=>{s.code!==void 0&&Kc([Ci(s.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{li.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{li.clear()},0)}));const li=new Set;function Io(s){return Array.isArray(s)}function pg(s,e=","){return(Io(s)?s:s.split(e)).every(t=>li.has(t.trim().toLowerCase()))}function Xc(s){const e=Array.isArray(s)?s:[s];li.has("meta")&&li.forEach(t=>{Wc(t)||li.delete(t.toLowerCase())}),e.forEach(t=>{li.add(t.toLowerCase())})}function Kc(s){const e=Array.isArray(s)?s:[s];s==="meta"?li.clear():e.forEach(t=>{li.delete(t.toLowerCase())})}function mg(s,e,t){(typeof t=="function"&&t(s,e)||t===!0)&&s.preventDefault()}function gg(s,e,t){return typeof t=="function"?t(s,e):t===!0||t===void 0}const _g=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function yg(s){return Yc(s,_g)}function Yc(s,e=!1){const{target:t,composed:i}=s;let r,n;return Tg(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),Io(e)?!!(r&&e&&e.some(a=>a.toLowerCase()===r.toLowerCase()||a===n)):!!(r&&e&&e)}function Tg(s){return!!s.tagName&&!s.tagName.startsWith("-")&&s.tagName.includes("-")}function vg(s,e){return s.length===0&&e?!1:e?s.some(t=>e.includes(t))||s.includes("*"):!0}const bg=(s,e,t=!1)=>{const{alt:i,meta:r,mod:n,shift:a,ctrl:u,keys:l,useKey:f}=e,{code:m,key:_,ctrlKey:w,metaKey:x,shiftKey:P,altKey:T}=s,I=Ci(m);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!==P&&I!=="shift")return!1;if(n){if(!x&&!w)return!1}else if(r!==x&&I!=="meta"&&I!=="os"||u!==w&&I!=="ctrl"&&I!=="control")return!1}return l&&l.length===1&&l.includes(I)?!0:l&&l.length>0?l.includes(I)?pg(l):!1:!l||l.length===0},xg=ue.createContext(void 0),Sg=()=>ue.useContext(xg);function Qc(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&&Qc(s[i],e[i]),!0):s===e}const Eg=ue.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),Cg=()=>ue.useContext(Eg);function wg(s){const e=ue.useRef(void 0);return Qc(e.current,s)||(e.current=s),e.current}const al=s=>{s.stopPropagation(),s.preventDefault(),s.stopImmediatePropagation()},Ag=typeof window<"u"?ue.useLayoutEffect:ue.useEffect;function Zi(s,e,t,i){const r=ue.useRef(null),n=ue.useRef(!1),a=Array.isArray(t)?Array.isArray(i)?void 0:i:t,u=Io(s)?s.join(a?.delimiter):s,l=Array.isArray(t)?t:Array.isArray(i)?i:void 0,f=ue.useCallback(e,l??[]),m=ue.useRef(f);l?m.current=f:m.current=e;const _=wg(a),{activeScopes:w}=Cg(),x=Sg();return Ag(()=>{if(_?.enabled===!1||!vg(w,_?.scopes))return;let P=[],T;const I=(F,j=!1)=>{if(!(yg(F)&&!Yc(F,_?.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)){al(F);return}}F.target?.isContentEditable&&!_?.enableOnContentEditable||Ta(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=va(U,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata);if(R.isSequence){T=setTimeout(()=>{P=[]},_?.sequenceTimeoutMs??1e3);const G=R.useKey?F.key:Ci(F.code);if(Wc(G.toLowerCase()))return;P.push(G);const v=R.keys?.[P.length-1];if(G!==v){P=[],T&&clearTimeout(T);return}P.length===R.keys?.length&&(m.current(F,R),T&&clearTimeout(T),P=[])}else if(bg(F,R,_?.ignoreModifiers)||R.keys?.includes("*")){if(_?.ignoreEventWhen?.(F)||j&&n.current)return;if(mg(F,R,_?.preventDefault),!gg(F,R,_?.enabled)){al(F);return}m.current(F,R),j||(n.current=!0)}})}},M=F=>{F.code!==void 0&&(Xc(Ci(F.code)),(_?.keydown===void 0&&_?.keyup!==!0||_?.keydown)&&I(F))},N=F=>{F.code!==void 0&&(Kc(Ci(F.code)),n.current=!1,_?.keyup&&I(F,!0))},O=r.current||a?.document||document;return O.addEventListener("keyup",N,a?.eventListenerOptions),O.addEventListener("keydown",M,a?.eventListenerOptions),x&&Ta(u,_?.delimiter).forEach(F=>{x.addHotkey(va(F,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),()=>{O.removeEventListener("keyup",N,a?.eventListenerOptions),O.removeEventListener("keydown",M,a?.eventListenerOptions),x&&Ta(u,_?.delimiter).forEach(F=>{x.removeHotkey(va(F,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),P=[],T&&clearTimeout(T)}},[u,_,w]),r}function Dg({...s}){return Q.jsx(Am,{"data-slot":"sheet",...s})}function kg({...s}){return Q.jsx(Pm,{"data-slot":"sheet-portal",...s})}function Ig({className:s,...e}){return Q.jsx(Lm,{className:Nn("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 Pg({children:s,className:e,hideCloseButton:t,overlayClassName:i,side:r="right",...n}){const a={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 Q.jsxs(kg,{children:[Q.jsx(Ig,{className:i}),Q.jsxs(Dm,{className:Nn("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",a[r],e),"data-slot":"sheet-content",...n,children:[s,!t&&Q.jsx(km,{"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:Q.jsx(jc,{className:"size-5"})})]})]})}function Lg({className:s,...e}){return Q.jsx(Im,{className:Nn("text-base font-semibold",s),"data-slot":"sheet-title",...e})}var ba,ol;function Mn(){if(ol)return ba;ol=1;var s;return typeof window<"u"?s=window:typeof fn<"u"?s=fn:typeof self<"u"?s=self:s={},ba=s,ba}var Og=Mn();const D=vr(Og),Rg={},Ng=Object.freeze(Object.defineProperty({__proto__:null,default:Rg},Symbol.toStringTag,{value:"Module"})),Mg=Om(Ng);var xa,ul;function Jc(){if(ul)return xa;ul=1;var s=typeof fn<"u"?fn:typeof window<"u"?window:{},e=Mg,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),xa=t,xa}var Bg=Jc();const ne=vr(Bg);var tn={exports:{}},Sa={exports:{}},ll;function Fg(){return ll||(ll=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})(Sa)),Sa.exports}var Ea,cl;function Ug(){if(cl)return Ea;cl=1,Ea=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 Ea}var Ca,dl;function jg(){if(dl)return Ca;dl=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),m=s(f),_;!(_=m()).done;){var w=_.value;try{l=w(l)}catch{}}return l},r})();return
|
|
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};tn.exports=f,tn.exports.default=f,f.XMLHttpRequest=s.XMLHttpRequest||w,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(P,T,I){return T=l(P,T,I),T.method=x.toUpperCase(),m(T)}});function a(x,P){for(var T=0;T<x.length;T++)P(x[T])}function u(x){for(var P in x)if(x.hasOwnProperty(P))return!1;return!0}function l(x,P,T){var I=x;return t(P)?(T=P,typeof x=="string"&&(I={uri:x})):I=e({},P,{uri:x}),I.callback=T,I}function f(x,P,T){return P=l(x,P,T),m(P)}function m(x){if(typeof x.callback>"u")throw new Error("callback argument missing");if(x.requestType&&f.requestInterceptorsStorage.getIsEnabled()){var P={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,P);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(Z,ee,re){I||(I=!0,x.callback(Z,ee,re))};function N(){U.readyState===4&&!f.responseInterceptorsStorage.getIsEnabled()&&setTimeout(j,0)}function O(){var W=void 0;if(U.response?W=U.response:W=U.responseText||_(U),K)try{W=JSON.parse(W)}catch{}return W}function F(W){if(clearTimeout(te),clearTimeout(x.retryTimeout),W instanceof Error||(W=new Error(""+(W||"Unknown XMLHttpRequest Error"))),W.statusCode=0,!G&&f.retryManager.getIsEnabled()&&x.retry&&x.retry.shouldRetry()){x.retryTimeout=setTimeout(function(){x.retry.moveToNextAttempt(),x.xhr=U,m(x)},x.retry.getCurrentFuzzedDelay());return}if(x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var Z={headers:ie.headers||{},body:ie.body,responseUrl:U.responseURL,responseType:U.responseType},ee=f.responseInterceptorsStorage.execute(x.requestType,Z);ie.body=ee.body,ie.headers=ee.headers}return M(W,ie)}function j(){if(!G){var W;clearTimeout(te),clearTimeout(x.retryTimeout),x.useXDR&&U.status===void 0?W=200:W=U.status===1223?204:U.status;var Z=ie,ee=null;if(W!==0?(Z={body:O(),statusCode:W,method:E,headers:{},url:v,rawRequest:U},U.getAllResponseHeaders&&(Z.headers=n(U.getAllResponseHeaders()))):ee=new Error("Internal XMLHttpRequest Error"),x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var re={headers:Z.headers||{},body:Z.body,responseUrl:U.responseURL,responseType:U.responseType},se=f.responseInterceptorsStorage.execute(x.requestType,re);Z.body=se.body,Z.headers=se.headers}return M(ee,Z,Z.body)}}var U=x.xhr||null;U||(x.cors||x.useXDR?U=new f.XDomainRequest:U=new f.XMLHttpRequest);var R,G,v=U.url=x.uri||x.url,E=U.method=x.method||"GET",V=x.body||x.data,H=U.headers=x.headers||{},q=!!x.sync,K=!1,te,ie={body:void 0,headers:{},statusCode:0,method:E,url:v,rawRequest:U};if("json"in x&&x.json!==!1&&(K=!0,H.accept||H.Accept||(H.Accept="application/json"),E!=="GET"&&E!=="HEAD"&&(H["content-type"]||H["Content-Type"]||(H["Content-Type"]="application/json"),V=JSON.stringify(x.json===!0?V:x.json))),U.onreadystatechange=N,U.onload=j,U.onerror=F,U.onprogress=function(){},U.onabort=function(){G=!0,clearTimeout(x.retryTimeout)},U.ontimeout=F,U.open(E,v,!q,x.username,x.password),q||(U.withCredentials=!!x.withCredentials),!q&&x.timeout>0&&(te=setTimeout(function(){if(!G){G=!0,U.abort("timeout");var W=new Error("XMLHttpRequest timeout");W.code="ETIMEDOUT",F(W)}},x.timeout)),U.setRequestHeader)for(R in H)H.hasOwnProperty(R)&&U.setRequestHeader(R,H[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(V||null),U}function _(x){try{if(x.responseType==="document")return x.responseXML;var P=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!P)return x.responseXML}catch{}return null}function w(){}return tn.exports}var Hg=Vg();const Zc=vr(Hg);var Da={exports:{}},ka,ml;function zg(){if(ml)return ka;ml=1;var s=Jc(),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(H,q,K,te){return(H|0)*3600+(q|0)*60+(K|0)+(te|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 H=0;H<V.length;++H)if(E===V[H]){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,H){var q=H?v.split(H):[v];for(var K in q)if(typeof q[K]=="string"){var te=q[K].split(V);if(te.length===2){var ie=te[0].trim(),W=te[1].trim();E(ie,W)}}}function a(v,E,V){var H=v;function q(){var ie=i(v);if(ie===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+H);return v=v.replace(/^[^\sa-zA-Z-]+/,""),ie}function K(ie,W){var Z=new r;n(ie,function(ee,re){switch(ee){case"region":for(var se=V.length-1;se>=0;se--)if(V[se].id===re){Z.set(ee,V[se].region);break}break;case"vertical":Z.alt(ee,re,["rl","lr"]);break;case"line":var ce=re.split(","),de=ce[0];Z.integer(ee,de),Z.percent(ee,de)&&Z.set("snapToLines",!1),Z.alt(ee,de,["auto"]),ce.length===2&&Z.alt("lineAlign",ce[1],["start","center","end"]);break;case"position":ce=re.split(","),Z.percent(ee,ce[0]),ce.length===2&&Z.alt("positionAlign",ce[1],["start","center","end"]);break;case"size":Z.percent(ee,re);break;case"align":Z.alt(ee,re,["start","center","end","left","right"]);break}},/:/,/\s/),W.region=Z.get("region",null),W.vertical=Z.get("vertical","");try{W.line=Z.get("line","auto")}catch{}W.lineAlign=Z.get("lineAlign","start"),W.snapToLines=Z.get("snapToLines",!0),W.size=Z.get("size",100);try{W.align=Z.get("align","center")}catch{W.align=Z.get("align","middle")}try{W.position=Z.get("position","auto")}catch{W.position=Z.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},W.align)}W.positionAlign=Z.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},W.align)}function te(){v=v.replace(/^\s+/,"")}if(te(),E.startTime=q(),te(),v.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+H);v=v.substr(3),te(),E.endTime=q(),te(),K(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)"},m={v:"title",lang:"lang"},_={rt:"ruby"};function w(v,E){function V(){if(!E)return null;function de(pe){return E=E.substr(pe.length),pe}var _e=E.match(/^([^<]*)(<[^>]*>?)?/);return de(_e[1]?_e[1]:_e[2])}function H(de){return u.innerHTML=de,de=u.textContent,u.textContent="",de}function q(de,_e){return!_[_e.localName]||_[_e.localName]===de.localName}function K(de,_e){var pe=l[de];if(!pe)return null;var $e=v.document.createElement(pe),Je=m[de];return Je&&_e&&($e[Je]=_e.trim()),$e}for(var te=v.document.createElement("div"),ie=te,W,Z=[];(W=V())!==null;){if(W[0]==="<"){if(W[1]==="/"){Z.length&&Z[Z.length-1]===W.substr(2).replace(">","")&&(Z.pop(),ie=ie.parentNode);continue}var ee=i(W.substr(1,W.length-2)),re;if(ee){re=v.document.createProcessingInstruction("timestamp",ee),ie.appendChild(re);continue}var se=W.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!se||(re=K(se[1],se[3]),!re)||!q(ie,re))continue;if(se[2]){var ce=se[2].split(".");ce.forEach(function(de){var _e=/^bg_/.test(de),pe=_e?de.slice(3):de;if(f.hasOwnProperty(pe)){var $e=_e?"background-color":"color",Je=f[pe];re.style[$e]=Je}}),re.className=ce.join(" ")}Z.push(se[1]),ie.appendChild(re),ie=re;continue}ie.appendChild(v.document.createTextNode(H(W)))}return te}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 P(v){for(var E=0;E<x.length;E++){var V=x[E];if(v>=V[0]&&v<=V[1])return!0}return!1}function T(v){var E=[],V="",H;if(!v||!v.childNodes)return"ltr";function q(ie,W){for(var Z=W.childNodes.length-1;Z>=0;Z--)ie.push(W.childNodes[Z])}function K(ie){if(!ie||!ie.length)return null;var W=ie.pop(),Z=W.textContent||W.innerText;if(Z){var ee=Z.match(/^.*(\n|\r)/);return ee?(ie.length=0,ee[0]):Z}if(W.tagName==="ruby")return K(ie);if(W.childNodes)return q(ie,W),K(ie)}for(q(E,v);V=K(E);)for(var te=0;te<V.length;te++)if(H=V.charCodeAt(te),P(H))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,H=0,q=0;q<V.length&&V[q]!==E;q++)V[q].mode==="showing"&&H++;return++H*-1}function M(){}M.prototype.applyStyles=function(v,E){E=E||this.div;for(var V in v)v.hasOwnProperty(V)&&(E.style[V]=v[V])},M.prototype.formatStyle=function(v,E){return v===0?0:v+E};function N(v,E,V){M.call(this),this.cue=E,this.cueDiv=w(v,E.text);var H={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(H,this.cueDiv),this.div=v.document.createElement("div"),H={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(H),this.div.appendChild(this.cueDiv);var q=0;switch(E.positionAlign){case"start":case"line-left":q=E.position;break;case"center":q=E.position-E.size/2;break;case"end":case"line-right":q=E.position-E.size;break}E.vertical===""?this.applyStyles({left:this.formatStyle(q,"%"),width:this.formatStyle(E.size,"%")}):this.applyStyles({top:this.formatStyle(q,"%"),height:this.formatStyle(E.size,"%")}),this.move=function(K){this.applyStyles({top:this.formatStyle(K.top,"px"),bottom:this.formatStyle(K.bottom,"px"),left:this.formatStyle(K.left,"px"),right:this.formatStyle(K.right,"px"),height:this.formatStyle(K.height,"px"),width:this.formatStyle(K.width,"px")})}}N.prototype=e(M.prototype),N.prototype.constructor=N;function O(v){var E,V,H,q;if(v.div){V=v.div.offsetHeight,H=v.div.offsetWidth,q=v.div.offsetTop;var K=(K=v.div.childNodes)&&(K=K[0])&&K.getClientRects&&K.getClientRects();v=v.div.getBoundingClientRect(),E=K?Math.max(K[0]&&K[0].height||0,v.height/K.length):0}this.left=v.left,this.right=v.right,this.top=v.top||q,this.height=v.height||V,this.bottom=v.bottom||q+(v.height||V),this.width=v.width||H,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)),V=Math.max(0,Math.min(this.bottom,v.bottom)-Math.max(this.top,v.top)),H=E*V;return H/(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=v.div?v.div.offsetWidth:v.tagName?v.offsetWidth:0,H=v.div?v.div.offsetTop:v.tagName?v.offsetTop:0;v=v.div?v.div.getBoundingClientRect():v.tagName?v.getBoundingClientRect():v;var q={left:v.left,right:v.right,top:v.top||H,height:v.height||E,bottom:v.bottom||H+(v.height||E),width:v.width||V};return q};function F(v,E,V,H){function q(pe,$e){for(var Je,Ce=new O(pe),Ze=1,ct=0;ct<$e.length;ct++){for(;pe.overlapsOppositeAxis(V,$e[ct])||pe.within(V)&&pe.overlapsAny(H);)pe.move($e[ct]);if(pe.within(V))return pe;var Ye=pe.intersectPercentage(V);Ze>Ye&&(Je=new O(pe),Ze=Ye),pe=new O(Ce)}return Je||Ce}var K=new O(E),te=E.cue,ie=I(te),W=[];if(te.snapToLines){var Z;switch(te.vertical){case"":W=["+y","-y"],Z="height";break;case"rl":W=["+x","-x"],Z="width";break;case"lr":W=["-x","+x"],Z="width";break}var ee=K.lineHeight,re=ee*Math.round(ie),se=V[Z]+ee,ce=W[0];Math.abs(re)>se&&(re=re<0?-1:1,re*=Math.ceil(se/ee)*ee),ie<0&&(re+=te.vertical===""?V.height:V.width,W=W.reverse()),K.move(ce,re)}else{var de=K.lineHeight/V.height*100;switch(te.lineAlign){case"center":ie-=de/2;break;case"end":ie-=de;break}switch(te.vertical){case"":E.applyStyles({top:E.formatStyle(ie,"%")});break;case"rl":E.applyStyles({left:E.formatStyle(ie,"%")});break;case"lr":E.applyStyles({right:E.formatStyle(ie,"%")});break}W=["+y","-x","+x","-y"],K=new O(E)}var _e=q(K,W);E.move(_e.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:w(v,E)};var U=.05,R="sans-serif",G="1.5%";return j.processCues=function(v,E,V){if(!v||!E||!V)return null;for(;V.firstChild;)V.removeChild(V.firstChild);var H=v.document.createElement("div");H.style.position="absolute",H.style.left="0",H.style.right="0",H.style.top="0",H.style.bottom="0",H.style.margin=G,V.appendChild(H);function q(ee){for(var re=0;re<ee.length;re++)if(ee[re].hasBeenReset||!ee[re].displayState)return!0;return!1}if(!q(E)){for(var K=0;K<E.length;K++)H.appendChild(E[K].displayState);return}var te=[],ie=O.getSimpleBoxPosition(H),W=Math.round(ie.height*U*100)/100,Z={font:W+"px "+R};(function(){for(var ee,re,se=0;se<E.length;se++)re=E[se],ee=new N(v,re,Z),H.appendChild(ee.div),F(v,ee,ie,te),re.displayState=ee.div,te.push(O.getSimpleBoxPosition(ee))})()},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 ee=E.buffer,re=0;re<ee.length&&ee[re]!=="\r"&&ee[re]!==`
|
|
1
|
+
import{c as Ot,r as ue,a as fn,g as vr,b as Cm,j as J,t as pn,P as wm,R as Am,T as Dm,d as km,C as Im,I as Uc,e as Pm,f as Lm,X as Om,h as Rm,B as eo,u as rs,i as Nm,k as Mm,l as Bm,L as Fm,m as sl,S as Um,n as jm,o as qm,A as $m,p as rl}from"./index-hOWDqZr2.js";const Vm=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],Hm=Ot("captions",Vm);const zm=[["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"}]],Gm=Ot("cast",zm);const Wm=[["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"}]],Xm=Ot("list",Wm);const Km=[["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"}]],Ym=Ot("maximize",Km);const Qm=[["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"}]],Jm=Ot("pause",Qm);const Zm=[["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"}]],eg=Ot("rotate-ccw",Zm);const tg=[["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"}]],ig=Ot("rotate-cw",tg);const sg=[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]],rg=Ot("skip-forward",sg);const ng=[["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"}]],jc=Ot("volume-1",ng);const ag=[["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"}]],qc=Ot("volume-2",ag);const og=[["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"}]],$c=Ot("volume-x",og);const ug=[["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"}]],Vc=Ot("volume",ug),Hc=["shift","alt","meta","mod","ctrl","control"],lg={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 Ci(s){return(lg[s.trim()]||s.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function zc(s){return Hc.includes(s)}function ya(s,e=","){return s.toLowerCase().split(e)}function Ta(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(m=>Ci(m))):a=s.toLocaleLowerCase().split(e).map(m=>Ci(m));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(m=>!Hc.includes(m));return{...l,keys:f,description:r,isSequence:u,hotkey:s,metadata:n}}typeof document<"u"&&(document.addEventListener("keydown",s=>{s.code!==void 0&&Gc([Ci(s.code)])}),document.addEventListener("keyup",s=>{s.code!==void 0&&Wc([Ci(s.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{li.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{li.clear()},0)}));const li=new Set;function ko(s){return Array.isArray(s)}function cg(s,e=","){return(ko(s)?s:s.split(e)).every(t=>li.has(t.trim().toLowerCase()))}function Gc(s){const e=Array.isArray(s)?s:[s];li.has("meta")&&li.forEach(t=>{zc(t)||li.delete(t.toLowerCase())}),e.forEach(t=>{li.add(t.toLowerCase())})}function Wc(s){const e=Array.isArray(s)?s:[s];s==="meta"?li.clear():e.forEach(t=>{li.delete(t.toLowerCase())})}function dg(s,e,t){(typeof t=="function"&&t(s,e)||t===!0)&&s.preventDefault()}function hg(s,e,t){return typeof t=="function"?t(s,e):t===!0||t===void 0}const fg=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function pg(s){return Xc(s,fg)}function Xc(s,e=!1){const{target:t,composed:i}=s;let r,n;return mg(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 mg(s){return!!s.tagName&&!s.tagName.startsWith("-")&&s.tagName.includes("-")}function gg(s,e){return s.length===0&&e?!1:e?s.some(t=>e.includes(t))||s.includes("*"):!0}const _g=(s,e,t=!1)=>{const{alt:i,meta:r,mod:n,shift:a,ctrl:u,keys:l,useKey:f}=e,{code:m,key:_,ctrlKey:w,metaKey:x,shiftKey:P,altKey:T}=s,I=Ci(m);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!==P&&I!=="shift")return!1;if(n){if(!x&&!w)return!1}else if(r!==x&&I!=="meta"&&I!=="os"||u!==w&&I!=="ctrl"&&I!=="control")return!1}return l&&l.length===1&&l.includes(I)?!0:l&&l.length>0?l.includes(I)?cg(l):!1:!l||l.length===0},yg=ue.createContext(void 0),Tg=()=>ue.useContext(yg);function Kc(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&&Kc(s[i],e[i]),!0):s===e}const vg=ue.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),bg=()=>ue.useContext(vg);function xg(s){const e=ue.useRef(void 0);return Kc(e.current,s)||(e.current=s),e.current}const nl=s=>{s.stopPropagation(),s.preventDefault(),s.stopImmediatePropagation()},Sg=typeof window<"u"?ue.useLayoutEffect:ue.useEffect;function Zi(s,e,t,i){const r=ue.useRef(null),n=ue.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=ue.useCallback(e,l??[]),m=ue.useRef(f);l?m.current=f:m.current=e;const _=xg(a),{activeScopes:w}=bg(),x=Tg();return Sg(()=>{if(_?.enabled===!1||!gg(w,_?.scopes))return;let P=[],T;const I=(F,j=!1)=>{if(!(pg(F)&&!Xc(F,_?.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(F);return}}F.target?.isContentEditable&&!_?.enableOnContentEditable||ya(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=Ta(U,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata);if(R.isSequence){T=setTimeout(()=>{P=[]},_?.sequenceTimeoutMs??1e3);const G=R.useKey?F.key:Ci(F.code);if(zc(G.toLowerCase()))return;P.push(G);const v=R.keys?.[P.length-1];if(G!==v){P=[],T&&clearTimeout(T);return}P.length===R.keys?.length&&(m.current(F,R),T&&clearTimeout(T),P=[])}else if(_g(F,R,_?.ignoreModifiers)||R.keys?.includes("*")){if(_?.ignoreEventWhen?.(F)||j&&n.current)return;if(dg(F,R,_?.preventDefault),!hg(F,R,_?.enabled)){nl(F);return}m.current(F,R),j||(n.current=!0)}})}},M=F=>{F.code!==void 0&&(Gc(Ci(F.code)),(_?.keydown===void 0&&_?.keyup!==!0||_?.keydown)&&I(F))},N=F=>{F.code!==void 0&&(Wc(Ci(F.code)),n.current=!1,_?.keyup&&I(F,!0))},O=r.current||a?.document||document;return O.addEventListener("keyup",N,a?.eventListenerOptions),O.addEventListener("keydown",M,a?.eventListenerOptions),x&&ya(u,_?.delimiter).forEach(F=>{x.addHotkey(Ta(F,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),()=>{O.removeEventListener("keyup",N,a?.eventListenerOptions),O.removeEventListener("keydown",M,a?.eventListenerOptions),x&&ya(u,_?.delimiter).forEach(F=>{x.removeHotkey(Ta(F,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),P=[],T&&clearTimeout(T)}},[u,_,w]),r}var va,al;function Nn(){if(al)return va;al=1;var s;return typeof window<"u"?s=window:typeof fn<"u"?s=fn:typeof self<"u"?s=self:s={},va=s,va}var Eg=Nn();const D=vr(Eg),Cg={},wg=Object.freeze(Object.defineProperty({__proto__:null,default:Cg},Symbol.toStringTag,{value:"Module"})),Ag=Cm(wg);var ba,ol;function Yc(){if(ol)return ba;ol=1;var s=typeof fn<"u"?fn:typeof window<"u"?window:{},e=Ag,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),ba=t,ba}var Dg=Yc();const ne=vr(Dg);var tn={exports:{}},xa={exports:{}},ul;function kg(){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})(xa)),xa.exports}var Sa,ll;function Ig(){if(ll)return Sa;ll=1,Sa=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 Sa}var Ea,cl;function Pg(){if(cl)return Ea;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),m=s(f),_;!(_=m()).done;){var w=_.value;try{l=w(l)}catch{}}return l},r})();return Ea=i,Ea}var Ca,dl;function Lg(){if(dl)return Ca;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,m=a.initialDelay;return new e({maxAttempts:u||this.maxAttempts_,delayFactor:l||this.delayFactor_,fuzzFactor:f||this.fuzzFactor_,initialDelay:m||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 Ca=s,Ca}var wa,hl;function Og(){if(hl)return wa;hl=1;var s=Nn(),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 m=t(u.headers&&u.headers["content-type"]);try{f=new TextDecoder(m).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 wa=e,wa}var fl;function Rg(){if(fl)return tn.exports;fl=1;var s=Nn(),e=kg(),t=Ig(),i=Pg(),r=Lg();f.httpHandler=Og(),f.requestInterceptorsStorage=new i,f.responseInterceptorsStorage=new i,f.retryManager=new r;var n=function(P){var T={};return P&&P.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};tn.exports=f,tn.exports.default=f,f.XMLHttpRequest=s.XMLHttpRequest||w,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(P,T,I){return T=l(P,T,I),T.method=x.toUpperCase(),m(T)}});function a(x,P){for(var T=0;T<x.length;T++)P(x[T])}function u(x){for(var P in x)if(x.hasOwnProperty(P))return!1;return!0}function l(x,P,T){var I=x;return t(P)?(T=P,typeof x=="string"&&(I={uri:x})):I=e({},P,{uri:x}),I.callback=T,I}function f(x,P,T){return P=l(x,P,T),m(P)}function m(x){if(typeof x.callback>"u")throw new Error("callback argument missing");if(x.requestType&&f.requestInterceptorsStorage.getIsEnabled()){var P={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,P);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(Z,ee,re){I||(I=!0,x.callback(Z,ee,re))};function N(){U.readyState===4&&!f.responseInterceptorsStorage.getIsEnabled()&&setTimeout(j,0)}function O(){var W=void 0;if(U.response?W=U.response:W=U.responseText||_(U),K)try{W=JSON.parse(W)}catch{}return W}function F(W){if(clearTimeout(te),clearTimeout(x.retryTimeout),W instanceof Error||(W=new Error(""+(W||"Unknown XMLHttpRequest Error"))),W.statusCode=0,!G&&f.retryManager.getIsEnabled()&&x.retry&&x.retry.shouldRetry()){x.retryTimeout=setTimeout(function(){x.retry.moveToNextAttempt(),x.xhr=U,m(x)},x.retry.getCurrentFuzzedDelay());return}if(x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var Z={headers:ie.headers||{},body:ie.body,responseUrl:U.responseURL,responseType:U.responseType},ee=f.responseInterceptorsStorage.execute(x.requestType,Z);ie.body=ee.body,ie.headers=ee.headers}return M(W,ie)}function j(){if(!G){var W;clearTimeout(te),clearTimeout(x.retryTimeout),x.useXDR&&U.status===void 0?W=200:W=U.status===1223?204:U.status;var Z=ie,ee=null;if(W!==0?(Z={body:O(),statusCode:W,method:E,headers:{},url:v,rawRequest:U},U.getAllResponseHeaders&&(Z.headers=n(U.getAllResponseHeaders()))):ee=new Error("Internal XMLHttpRequest Error"),x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var re={headers:Z.headers||{},body:Z.body,responseUrl:U.responseURL,responseType:U.responseType},se=f.responseInterceptorsStorage.execute(x.requestType,re);Z.body=se.body,Z.headers=se.headers}return M(ee,Z,Z.body)}}var U=x.xhr||null;U||(x.cors||x.useXDR?U=new f.XDomainRequest:U=new f.XMLHttpRequest);var R,G,v=U.url=x.uri||x.url,E=U.method=x.method||"GET",V=x.body||x.data,H=U.headers=x.headers||{},q=!!x.sync,K=!1,te,ie={body:void 0,headers:{},statusCode:0,method:E,url:v,rawRequest:U};if("json"in x&&x.json!==!1&&(K=!0,H.accept||H.Accept||(H.Accept="application/json"),E!=="GET"&&E!=="HEAD"&&(H["content-type"]||H["Content-Type"]||(H["Content-Type"]="application/json"),V=JSON.stringify(x.json===!0?V:x.json))),U.onreadystatechange=N,U.onload=j,U.onerror=F,U.onprogress=function(){},U.onabort=function(){G=!0,clearTimeout(x.retryTimeout)},U.ontimeout=F,U.open(E,v,!q,x.username,x.password),q||(U.withCredentials=!!x.withCredentials),!q&&x.timeout>0&&(te=setTimeout(function(){if(!G){G=!0,U.abort("timeout");var W=new Error("XMLHttpRequest timeout");W.code="ETIMEDOUT",F(W)}},x.timeout)),U.setRequestHeader)for(R in H)H.hasOwnProperty(R)&&U.setRequestHeader(R,H[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(V||null),U}function _(x){try{if(x.responseType==="document")return x.responseXML;var P=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!P)return x.responseXML}catch{}return null}function w(){}return tn.exports}var Ng=Rg();const Qc=vr(Ng);var Aa={exports:{}},Da,pl;function Mg(){if(pl)return Da;pl=1;var s=Yc(),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(H,q,K,te){return(H|0)*3600+(q|0)*60+(K|0)+(te|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 H=0;H<V.length;++H)if(E===V[H]){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,H){var q=H?v.split(H):[v];for(var K in q)if(typeof q[K]=="string"){var te=q[K].split(V);if(te.length===2){var ie=te[0].trim(),W=te[1].trim();E(ie,W)}}}function a(v,E,V){var H=v;function q(){var ie=i(v);if(ie===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+H);return v=v.replace(/^[^\sa-zA-Z-]+/,""),ie}function K(ie,W){var Z=new r;n(ie,function(ee,re){switch(ee){case"region":for(var se=V.length-1;se>=0;se--)if(V[se].id===re){Z.set(ee,V[se].region);break}break;case"vertical":Z.alt(ee,re,["rl","lr"]);break;case"line":var ce=re.split(","),de=ce[0];Z.integer(ee,de),Z.percent(ee,de)&&Z.set("snapToLines",!1),Z.alt(ee,de,["auto"]),ce.length===2&&Z.alt("lineAlign",ce[1],["start","center","end"]);break;case"position":ce=re.split(","),Z.percent(ee,ce[0]),ce.length===2&&Z.alt("positionAlign",ce[1],["start","center","end"]);break;case"size":Z.percent(ee,re);break;case"align":Z.alt(ee,re,["start","center","end","left","right"]);break}},/:/,/\s/),W.region=Z.get("region",null),W.vertical=Z.get("vertical","");try{W.line=Z.get("line","auto")}catch{}W.lineAlign=Z.get("lineAlign","start"),W.snapToLines=Z.get("snapToLines",!0),W.size=Z.get("size",100);try{W.align=Z.get("align","center")}catch{W.align=Z.get("align","middle")}try{W.position=Z.get("position","auto")}catch{W.position=Z.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},W.align)}W.positionAlign=Z.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},W.align)}function te(){v=v.replace(/^\s+/,"")}if(te(),E.startTime=q(),te(),v.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+H);v=v.substr(3),te(),E.endTime=q(),te(),K(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)"},m={v:"title",lang:"lang"},_={rt:"ruby"};function w(v,E){function V(){if(!E)return null;function de(pe){return E=E.substr(pe.length),pe}var _e=E.match(/^([^<]*)(<[^>]*>?)?/);return de(_e[1]?_e[1]:_e[2])}function H(de){return u.innerHTML=de,de=u.textContent,u.textContent="",de}function q(de,_e){return!_[_e.localName]||_[_e.localName]===de.localName}function K(de,_e){var pe=l[de];if(!pe)return null;var $e=v.document.createElement(pe),Je=m[de];return Je&&_e&&($e[Je]=_e.trim()),$e}for(var te=v.document.createElement("div"),ie=te,W,Z=[];(W=V())!==null;){if(W[0]==="<"){if(W[1]==="/"){Z.length&&Z[Z.length-1]===W.substr(2).replace(">","")&&(Z.pop(),ie=ie.parentNode);continue}var ee=i(W.substr(1,W.length-2)),re;if(ee){re=v.document.createProcessingInstruction("timestamp",ee),ie.appendChild(re);continue}var se=W.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!se||(re=K(se[1],se[3]),!re)||!q(ie,re))continue;if(se[2]){var ce=se[2].split(".");ce.forEach(function(de){var _e=/^bg_/.test(de),pe=_e?de.slice(3):de;if(f.hasOwnProperty(pe)){var $e=_e?"background-color":"color",Je=f[pe];re.style[$e]=Je}}),re.className=ce.join(" ")}Z.push(se[1]),ie.appendChild(re),ie=re;continue}ie.appendChild(v.document.createTextNode(H(W)))}return te}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 P(v){for(var E=0;E<x.length;E++){var V=x[E];if(v>=V[0]&&v<=V[1])return!0}return!1}function T(v){var E=[],V="",H;if(!v||!v.childNodes)return"ltr";function q(ie,W){for(var Z=W.childNodes.length-1;Z>=0;Z--)ie.push(W.childNodes[Z])}function K(ie){if(!ie||!ie.length)return null;var W=ie.pop(),Z=W.textContent||W.innerText;if(Z){var ee=Z.match(/^.*(\n|\r)/);return ee?(ie.length=0,ee[0]):Z}if(W.tagName==="ruby")return K(ie);if(W.childNodes)return q(ie,W),K(ie)}for(q(E,v);V=K(E);)for(var te=0;te<V.length;te++)if(H=V.charCodeAt(te),P(H))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,H=0,q=0;q<V.length&&V[q]!==E;q++)V[q].mode==="showing"&&H++;return++H*-1}function M(){}M.prototype.applyStyles=function(v,E){E=E||this.div;for(var V in v)v.hasOwnProperty(V)&&(E.style[V]=v[V])},M.prototype.formatStyle=function(v,E){return v===0?0:v+E};function N(v,E,V){M.call(this),this.cue=E,this.cueDiv=w(v,E.text);var H={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(H,this.cueDiv),this.div=v.document.createElement("div"),H={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(H),this.div.appendChild(this.cueDiv);var q=0;switch(E.positionAlign){case"start":case"line-left":q=E.position;break;case"center":q=E.position-E.size/2;break;case"end":case"line-right":q=E.position-E.size;break}E.vertical===""?this.applyStyles({left:this.formatStyle(q,"%"),width:this.formatStyle(E.size,"%")}):this.applyStyles({top:this.formatStyle(q,"%"),height:this.formatStyle(E.size,"%")}),this.move=function(K){this.applyStyles({top:this.formatStyle(K.top,"px"),bottom:this.formatStyle(K.bottom,"px"),left:this.formatStyle(K.left,"px"),right:this.formatStyle(K.right,"px"),height:this.formatStyle(K.height,"px"),width:this.formatStyle(K.width,"px")})}}N.prototype=e(M.prototype),N.prototype.constructor=N;function O(v){var E,V,H,q;if(v.div){V=v.div.offsetHeight,H=v.div.offsetWidth,q=v.div.offsetTop;var K=(K=v.div.childNodes)&&(K=K[0])&&K.getClientRects&&K.getClientRects();v=v.div.getBoundingClientRect(),E=K?Math.max(K[0]&&K[0].height||0,v.height/K.length):0}this.left=v.left,this.right=v.right,this.top=v.top||q,this.height=v.height||V,this.bottom=v.bottom||q+(v.height||V),this.width=v.width||H,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)),V=Math.max(0,Math.min(this.bottom,v.bottom)-Math.max(this.top,v.top)),H=E*V;return H/(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=v.div?v.div.offsetWidth:v.tagName?v.offsetWidth:0,H=v.div?v.div.offsetTop:v.tagName?v.offsetTop:0;v=v.div?v.div.getBoundingClientRect():v.tagName?v.getBoundingClientRect():v;var q={left:v.left,right:v.right,top:v.top||H,height:v.height||E,bottom:v.bottom||H+(v.height||E),width:v.width||V};return q};function F(v,E,V,H){function q(pe,$e){for(var Je,Ce=new O(pe),Ze=1,ct=0;ct<$e.length;ct++){for(;pe.overlapsOppositeAxis(V,$e[ct])||pe.within(V)&&pe.overlapsAny(H);)pe.move($e[ct]);if(pe.within(V))return pe;var Ye=pe.intersectPercentage(V);Ze>Ye&&(Je=new O(pe),Ze=Ye),pe=new O(Ce)}return Je||Ce}var K=new O(E),te=E.cue,ie=I(te),W=[];if(te.snapToLines){var Z;switch(te.vertical){case"":W=["+y","-y"],Z="height";break;case"rl":W=["+x","-x"],Z="width";break;case"lr":W=["-x","+x"],Z="width";break}var ee=K.lineHeight,re=ee*Math.round(ie),se=V[Z]+ee,ce=W[0];Math.abs(re)>se&&(re=re<0?-1:1,re*=Math.ceil(se/ee)*ee),ie<0&&(re+=te.vertical===""?V.height:V.width,W=W.reverse()),K.move(ce,re)}else{var de=K.lineHeight/V.height*100;switch(te.lineAlign){case"center":ie-=de/2;break;case"end":ie-=de;break}switch(te.vertical){case"":E.applyStyles({top:E.formatStyle(ie,"%")});break;case"rl":E.applyStyles({left:E.formatStyle(ie,"%")});break;case"lr":E.applyStyles({right:E.formatStyle(ie,"%")});break}W=["+y","-x","+x","-y"],K=new O(E)}var _e=q(K,W);E.move(_e.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:w(v,E)};var U=.05,R="sans-serif",G="1.5%";return j.processCues=function(v,E,V){if(!v||!E||!V)return null;for(;V.firstChild;)V.removeChild(V.firstChild);var H=v.document.createElement("div");H.style.position="absolute",H.style.left="0",H.style.right="0",H.style.top="0",H.style.bottom="0",H.style.margin=G,V.appendChild(H);function q(ee){for(var re=0;re<ee.length;re++)if(ee[re].hasBeenReset||!ee[re].displayState)return!0;return!1}if(!q(E)){for(var K=0;K<E.length;K++)H.appendChild(E[K].displayState);return}var te=[],ie=O.getSimpleBoxPosition(H),W=Math.round(ie.height*U*100)/100,Z={font:W+"px "+R};(function(){for(var ee,re,se=0;se<E.length;se++)re=E[se],ee=new N(v,re,Z),H.appendChild(ee.div),F(v,ee,ie,te),re.displayState=ee.div,te.push(O.getSimpleBoxPosition(ee))})()},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 ee=E.buffer,re=0;re<ee.length&&ee[re]!=="\r"&&ee[re]!==`
|
|
4
4
|
`;)++re;var se=ee.substr(0,re);return ee[re]==="\r"&&++re,ee[re]===`
|
|
5
5
|
`&&++re,E.buffer=ee.substr(re),se}function H(ee){var re=new r;if(n(ee,function(ce,de){switch(ce){case"id":re.set(ce,de);break;case"width":re.percent(ce,de);break;case"lines":re.integer(ce,de);break;case"regionanchor":case"viewportanchor":var _e=de.split(",");if(_e.length!==2)break;var pe=new r;if(pe.percent("x",_e[0]),pe.percent("y",_e[1]),!pe.has("x")||!pe.has("y"))break;re.set(ce+"X",pe.get("x")),re.set(ce+"Y",pe.get("y"));break;case"scroll":re.alt(ce,de,["up"]);break}},/=/,/\s/),re.has("id")){var se=new(E.vttjs.VTTRegion||E.window.VTTRegion);se.width=re.get("width",100),se.lines=re.get("lines",3),se.regionAnchorX=re.get("regionanchorX",0),se.regionAnchorY=re.get("regionanchorY",100),se.viewportAnchorX=re.get("viewportanchorX",0),se.viewportAnchorY=re.get("viewportanchorY",100),se.scroll=re.get("scroll",""),E.onregion&&E.onregion(se),E.regionList.push({id:re.get("id"),region:se})}}function q(ee){var re=new r;n(ee,function(se,ce){switch(se){case"MPEGT":re.integer(se+"S",ce);break;case"LOCA":re.set(se+"L",i(ce));break}},/[^\d]:/,/,/),E.ontimestampmap&&E.ontimestampmap({MPEGTS:re.get("MPEGTS"),LOCAL:re.get("LOCAL")})}function K(ee){ee.match(/X-TIMESTAMP-MAP/)?n(ee,function(re,se){re==="X-TIMESTAMP-MAP"&&q(se)},/=/):n(ee,function(re,se){re==="Region"&&H(se)},/:/)}try{var te;if(E.state==="INITIAL"){if(!/\r\n|\n/.test(E.buffer))return this;te=V();var ie=te.match(/^WEBVTT([ \t].*)?$/);if(!ie||!ie[0])throw new t(t.Errors.BadSignature);E.state="HEADER"}for(var W=!1;E.buffer;){if(!/\r\n|\n/.test(E.buffer))return this;switch(W?W=!1:te=V(),E.state){case"HEADER":/:/.test(te)?K(te):te||(E.state="ID");continue;case"NOTE":te||(E.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(te)){E.state="NOTE";break}if(!te)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",te.indexOf("-->")===-1){E.cue.id=te;continue}case"CUE":try{a(te,E.cue,E.regionList)}catch(ee){E.reportOrThrowError(ee),E.cue=null,E.state="BADCUE";continue}E.state="CUETEXT";continue;case"CUETEXT":var Z=te.indexOf("-->")!==-1;if(!te||Z&&(W=!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+=te.replace(/\u2028/g,`
|
|
7
7
|
`).replace(/u2029/g,`
|
|
8
8
|
`);continue;case"BADCUE":te||(E.state="ID");continue}}}catch(ee){E.reportOrThrowError(ee),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}},Da=j,Da}var ka,ml;function Bg(){if(ml)return ka;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="",m=!1,_=a,w=u,x=l,P=null,T="",I=!0,M="auto",N="start",O="auto",F="auto",j=100,U="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return f},set:function(R){f=""+R}},pauseOnExit:{enumerable:!0,get:function(){return m},set:function(R){m=!!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 w},set:function(R){if(typeof R!="number")throw new TypeError("End time must be set to a number.");w=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 P},set:function(R){P=R,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return T},set:function(R){var G=i(R);if(G===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");T=G,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 G=r(R);G?(N=G,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 F},set:function(R){var G=r(R);G?(F=G,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return j},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");j=R,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return U},set:function(R){var G=r(R);if(!G)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");U=G,this.hasBeenReset=!0}}}),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},ka=n,ka}var Ia,gl;function Fg(){if(gl)return Ia;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,m="";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 m},set:function(_){var w=e(_);w===!1?console.warn("Scroll: an invalid or illegal string was specified."):m=w}}})}return Ia=i,Ia}var _l;function Ug(){if(_l)return Aa.exports;_l=1;var s=Nn(),e=Aa.exports={WebVTT:Mg(),VTTCue:Bg(),VTTRegion:Fg()};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(),Aa.exports}var jg=Ug();const yl=vr(jg);function Ke(){return Ke=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},Ke.apply(null,arguments)}var Tl="https://example.com",Mn=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})(),qg=function(e){return D.atob?D.atob(e):Buffer.from(e,"base64").toString("binary")};function Jc(s){for(var e=qg(s),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class $g 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 Jg=" ",La=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},Zg=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},ht=function(s){const e={};if(!s)return e;const t=s.split(Zg());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},bl=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 e0 extends Po{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=Ke(La(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=ht(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=La(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=ht(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=bl(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=ht(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=ht(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=ht(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=ht(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=ht(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=La(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=ht(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=ht(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=ht(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=ht(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=ht(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=ht(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=ht(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=bl(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=ht(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 t0=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ti=function(s){const e={};return Object.keys(s).forEach(function(t){e[t0(t)]=s[t]}),e},Oa=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 i0 extends Po{constructor(e={}){super(),this.lineStream=new Qg,this.parseStream=new e0,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:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let w=0,x=0;const P={};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=w)),"offset"in T&&(r.byterange=N,N.offset=T.offset),w=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===m){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:ed(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={}),Ke(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,F)=>(F.programDateTime=O-F.duration*1e3,F.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,Oa.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=Ti(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const N=this.manifest.segments.length,O=Ti(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 F=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${N}`,T.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((j,U)=>{j.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${U} lacks required attribute(s): LAST-PART`})})},"server-control"(){const N=this.manifest.serverControl=Ti(T.attributes);N.hasOwnProperty("canBlockReload")||(N.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Oa.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=Ti(T.attributes),F=O.type&&O.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(O),O.byterange&&(O.byterange.hasOwnProperty("offset")||(O.byterange.offset=F?x:0,F&&(x=O.byterange.offset+O.byterange.length)));const j=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${j} 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 #${j} for segment #${N} has the same TYPE ${O.type} as preload hint #${U}`})}},"rendition-report"(){const N=Ti(T.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(N);const O=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];u&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${O}`,T.attributes,F)},"part-inf"(){this.manifest.partInf=Ti(T.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",T.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Oa.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Ti(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 F=!!O.endOnNext;if(F&&!O.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(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(!P[O.id])P[O.id]=O;else{for(const U in P[O.id])if(O[U]&&JSON.stringify(P[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 j=this.manifest.dateRanges.findIndex(U=>U.id===O.id);this.manifest.dateRanges[j]=Ke(this.manifest.dateRanges[j],O),P[O.id]=Ke(P[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=Ti(T.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",T.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const N=(O,F)=>{if(O in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${O}`});return}this.manifest.definitions[O]=F};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^/},s0=["video","audio","text"],xl=["Video","Audio","Text"],td=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})},Xt=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(r){r=r.trim();var n;s0.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},r0=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 Xt(n.playlists[0].attributes.CODECS)}return null},id=function(e){return e===void 0&&(e=""),$i.audio.test(e.trim().toLowerCase())},n0=function(e){return e===void 0&&(e=""),$i.text.test(e.trim().toLowerCase())},_s=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return td(n.trim())}),i="video";t.length===1&&id(t[0])?i="audio":t.length===1&&n0(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(_s(e))||t&&D.ManagedMediaSource&&D.ManagedMediaSource.isTypeSupported&&D.ManagedMediaSource.isTypeSupported(_s(e))||!1},Ra=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<xl.length;i++){var r=xl[i];if($i["muxer"+r].test(t))return!0}return!1})},Sl="mp4a.40.2",a0="avc1.4d400d",o0=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,u0=/^application\/dash\+xml/i,sd=function(e){return o0.test(e)?"hls":u0.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},l0=function(e){return e.toString(2).length},c0=function(e){return Math.ceil(l0(e)/8)},rd=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},d0=function(e){return rd(e)},fe=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!d0(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))},nt=D.BigInt||Number,io=[nt("0x1"),nt("0x100"),nt("0x10000"),nt("0x1000000"),nt("0x100000000"),nt("0x10000000000"),nt("0x1000000000000"),nt("0x100000000000000"),nt("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 h0=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=fe(e);var l=u?"reduce":"reduceRight",f=e[l]?e[l]:Array.prototype[l],m=f.call(e,function(w,x,P){var T=u?P:Math.abs(P+1-e.length);return w+nt(x)*io[T]},nt(0));if(n){var _=io[e.length]/nt(2)-nt(1);m=nt(m),m>_&&(m-=_,m-=_,m-=nt(2))}return Number(m)},f0=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=nt(e);for(var a=c0(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/io[l]&nt(255)),e<0&&(u[f]=Math.abs(~u[f]),u[f]-=l===0?1:2)}return u},nd=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},p0=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 fe(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=fe(u),n.set(u,a),a+=u.byteLength}),n},Fe=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=fe(e),t=fe(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(m,_){var w=l[_]?l[_]&e[a+_]:e[a+_];return m===w})},m0=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)}})},er={},ai={},Mi={},El;function Fn(){if(El)return Mi;El=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 Cl;function ad(){if(Cl)return ai;Cl=1;var s=Fn(),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 L in y)Object.prototype.hasOwnProperty.call(y,L)&&(b[L]=y[L])}function f(y,b){var L=y.prototype;if(!(L instanceof b)){let z=function(){};z.prototype=b.prototype,z=new z,l(L,z),y.prototype=L=z}L.constructor!=y&&(typeof y!="function"&&console.error("unknown Class:"+y),L.constructor=y)}var m={},_=m.ELEMENT_NODE=1,w=m.ATTRIBUTE_NODE=2,x=m.TEXT_NODE=3,P=m.CDATA_SECTION_NODE=4,T=m.ENTITY_REFERENCE_NODE=5,I=m.ENTITY_NODE=6,M=m.PROCESSING_INSTRUCTION_NODE=7,N=m.COMMENT_NODE=8,O=m.DOCUMENT_NODE=9,F=m.DOCUMENT_TYPE_NODE=10,j=m.DOCUMENT_FRAGMENT_NODE=11,U=m.NOTATION_NODE=12,R={},G={};R.INDEX_SIZE_ERR=(G[1]="Index size error",1),R.DOMSTRING_SIZE_ERR=(G[2]="DOMString size error",2);var v=R.HIERARCHY_REQUEST_ERR=(G[3]="Hierarchy request error",3);R.WRONG_DOCUMENT_ERR=(G[4]="Wrong document",4),R.INVALID_CHARACTER_ERR=(G[5]="Invalid character",5),R.NO_DATA_ALLOWED_ERR=(G[6]="No data allowed",6),R.NO_MODIFICATION_ALLOWED_ERR=(G[7]="No modification allowed",7);var E=R.NOT_FOUND_ERR=(G[8]="Not found",8);R.NOT_SUPPORTED_ERR=(G[9]="Not supported",9);var V=R.INUSE_ATTRIBUTE_ERR=(G[10]="Attribute in use",10);R.INVALID_STATE_ERR=(G[11]="Invalid state",11),R.SYNTAX_ERR=(G[12]="Syntax error",12),R.INVALID_MODIFICATION_ERR=(G[13]="Invalid modification",13),R.NAMESPACE_ERR=(G[14]="Invalid namespace",14),R.INVALID_ACCESS_ERR=(G[15]="Invalid access",15);function H(y,b){if(b instanceof Error)var L=b;else L=this,Error.call(this,G[y]),this.message=G[y],Error.captureStackTrace&&Error.captureStackTrace(this,H);return L.code=y,b&&(this.message=this.message+": "+b),L}H.prototype=Error.prototype,l(R,H);function q(){}q.prototype={length:0,item:function(y){return y>=0&&y<this.length?this[y]:null},toString:function(y,b){for(var L=[],z=0;z<this.length;z++)mi(this[z],L,y,b);return L.join("")},filter:function(y){return Array.prototype.filter.call(this,y)},indexOf:function(y){return Array.prototype.indexOf.call(this,y)}};function K(y,b){this._node=y,this._refresh=b,te(this)}function te(y){var b=y._node._inc||y._node.ownerDocument._inc;if(y._inc!==b){var L=y._refresh(y._node);if(Ir(y,"length",L.length),!y.$$length||L.length<y.$$length)for(var z=L.length;z in y;z++)Object.prototype.hasOwnProperty.call(y,z)&&delete y[z];l(L,y),y._inc=b}}K.prototype.item=function(y){return te(this),this[y]||null},f(K,q);function ie(){}function W(y,b){for(var L=y.length;L--;)if(y[L]===b)return L}function Z(y,b,L,z){if(z?b[W(b,z)]=L:b[b.length++]=L,y){L.ownerElement=y;var ae=y.ownerDocument;ae&&(z&&$e(ae,y,z),pe(ae,y,L))}}function ee(y,b,L){var z=W(b,L);if(z>=0){for(var ae=b.length-1;z<ae;)b[z]=b[++z];if(b.length=ae,y){var ge=y.ownerDocument;ge&&($e(ge,y,L),L.ownerElement=null)}}else throw new H(E,new Error(y.tagName+"@"+L))}ie.prototype={length:0,item:q.prototype.item,getNamedItem:function(y){for(var b=this.length;b--;){var L=this[b];if(L.nodeName==y)return L}},setNamedItem:function(y){var b=y.ownerElement;if(b&&b!=this._ownerElement)throw new H(V);var L=this.getNamedItem(y.nodeName);return Z(this._ownerElement,this,y,L),L},setNamedItemNS:function(y){var b=y.ownerElement,L;if(b&&b!=this._ownerElement)throw new H(V);return L=this.getNamedItemNS(y.namespaceURI,y.localName),Z(this._ownerElement,this,y,L),L},removeNamedItem:function(y){var b=this.getNamedItem(y);return ee(this._ownerElement,this,b),b},removeNamedItemNS:function(y,b){var L=this.getNamedItemNS(y,b);return ee(this._ownerElement,this,L),L},getNamedItemNS:function(y,b){for(var L=this.length;L--;){var z=this[L];if(z.localName==b&&z.namespaceURI==y)return z}return null}};function re(){}re.prototype={hasFeature:function(y,b){return!0},createDocument:function(y,b,L){var z=new _e;if(z.implementation=this,z.childNodes=new q,z.doctype=L||null,L&&z.appendChild(L),b){var ae=z.createElementNS(y,b);z.appendChild(ae)}return z},createDocumentType:function(y,b,L){var z=new pi;return z.name=y,z.nodeName=y,z.publicId=b||"",z.systemId=L||"",z}};function se(){}se.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 We(this,y,b)},replaceChild:function(y,b){We(this,y,b,Ee),b&&this.removeChild(b)},removeChild:function(y){return Ce(this,y)},appendChild:function(y){return this.insertBefore(y,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(y){return Bs(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 L=b._nsMap;if(L){for(var z in L)if(Object.prototype.hasOwnProperty.call(L,z)&&L[z]===y)return z}b=b.nodeType==w?b.ownerDocument:b.parentNode}return null},lookupNamespaceURI:function(y){for(var b=this;b;){var L=b._nsMap;if(L&&Object.prototype.hasOwnProperty.call(L,y))return L[y];b=b.nodeType==w?b.ownerDocument:b.parentNode}return null},isDefaultNamespace:function(y){var b=this.lookupPrefix(y);return b==null}};function ce(y){return y=="<"&&"<"||y==">"&&">"||y=="&"&&"&"||y=='"'&&"""||"&#"+y.charCodeAt()+";"}l(m,se),l(m,se.prototype);function de(y,b){if(b(y))return!0;if(y=y.firstChild)do if(de(y,b))return!0;while(y=y.nextSibling)}function _e(){this.ownerDocument=this}function pe(y,b,L){y&&y._inc++;var z=L.namespaceURI;z===t.XMLNS&&(b._nsMap[L.prefix?L.localName:""]=L.value)}function $e(y,b,L,z){y&&y._inc++;var ae=L.namespaceURI;ae===t.XMLNS&&delete b._nsMap[L.prefix?L.localName:""]}function Je(y,b,L){if(y&&y._inc){y._inc++;var z=b.childNodes;if(L)z[z.length++]=L;else{for(var ae=b.firstChild,ge=0;ae;)z[ge++]=ae,ae=ae.nextSibling;z.length=ge,delete z[z.length]}}}function Ce(y,b){var L=b.previousSibling,z=b.nextSibling;return L?L.nextSibling=z:y.firstChild=z,z?z.previousSibling=L:y.lastChild=L,b.parentNode=null,b.previousSibling=null,b.nextSibling=null,Je(y.ownerDocument,y),b}function Ze(y){return y&&(y.nodeType===se.DOCUMENT_NODE||y.nodeType===se.DOCUMENT_FRAGMENT_NODE||y.nodeType===se.ELEMENT_NODE)}function ct(y){return y&&(rt(y)||$t(y)||Ye(y)||y.nodeType===se.DOCUMENT_FRAGMENT_NODE||y.nodeType===se.COMMENT_NODE||y.nodeType===se.PROCESSING_INSTRUCTION_NODE)}function Ye(y){return y&&y.nodeType===se.DOCUMENT_TYPE_NODE}function rt(y){return y&&y.nodeType===se.ELEMENT_NODE}function $t(y){return y&&y.nodeType===se.TEXT_NODE}function Ge(y,b){var L=y.childNodes||[];if(e(L,rt)||Ye(b))return!1;var z=e(L,Ye);return!(b&&z&&L.indexOf(z)>L.indexOf(b))}function Vt(y,b){var L=y.childNodes||[];function z(ge){return rt(ge)&&ge!==b}if(e(L,z))return!1;var ae=e(L,Ye);return!(b&&ae&&L.indexOf(ae)>L.indexOf(b))}function Ve(y,b,L){if(!Ze(y))throw new H(v,"Unexpected parent node type "+y.nodeType);if(L&&L.parentNode!==y)throw new H(E,"child not in parent");if(!ct(b)||Ye(b)&&y.nodeType!==se.DOCUMENT_NODE)throw new H(v,"Unexpected node type "+b.nodeType+" for parent node type "+y.nodeType)}function xe(y,b,L){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===se.DOCUMENT_FRAGMENT_NODE){var ge=ae.filter(rt);if(ge.length>1||e(ae,$t))throw new H(v,"More than one element or text in fragment");if(ge.length===1&&!Ge(y,L))throw new H(v,"Element in fragment can not be inserted before doctype")}if(rt(b)&&!Ge(y,L))throw new H(v,"Only one element can be added and only after doctype");if(Ye(b)){if(e(z,Ye))throw new H(v,"Only one doctype is allowed");var Pe=e(z,rt);if(L&&z.indexOf(Pe)<z.indexOf(L))throw new H(v,"Doctype can only be inserted before an element");if(!L&&Pe)throw new H(v,"Doctype can not be appended since element is present")}}function Ee(y,b,L){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===se.DOCUMENT_FRAGMENT_NODE){var ge=ae.filter(rt);if(ge.length>1||e(ae,$t))throw new H(v,"More than one element or text in fragment");if(ge.length===1&&!Vt(y,L))throw new H(v,"Element in fragment can not be inserted before doctype")}if(rt(b)&&!Vt(y,L))throw new H(v,"Only one element can be added and only after doctype");if(Ye(b)){if(e(z,function(vt){return Ye(vt)&&vt!==L}))throw new H(v,"Only one doctype is allowed");var Pe=e(z,rt);if(L&&z.indexOf(Pe)<z.indexOf(L))throw new H(v,"Doctype can only be inserted before an element")}}function We(y,b,L,z){Ve(y,b,L),y.nodeType===se.DOCUMENT_NODE&&(z||xe)(y,b,L);var ae=b.parentNode;if(ae&&ae.removeChild(b),b.nodeType===j){var ge=b.firstChild;if(ge==null)return b;var Pe=b.lastChild}else ge=Pe=b;var at=L?L.previousSibling:y.lastChild;ge.previousSibling=at,Pe.nextSibling=L,at?at.nextSibling=ge:y.firstChild=ge,L==null?y.lastChild=Pe:L.previousSibling=Pe;do{ge.parentNode=y;var vt=y.ownerDocument||y;Te(ge,vt)}while(ge!==Pe&&(ge=ge.nextSibling));return Je(y.ownerDocument||y,y),b.nodeType==j&&(b.firstChild=b.lastChild=null),b}function Te(y,b){if(y.ownerDocument!==b){if(y.ownerDocument=b,y.nodeType===_&&y.attributes)for(var L=0;L<y.attributes.length;L++){var z=y.attributes.item(L);z&&(z.ownerDocument=b)}for(var ae=y.firstChild;ae;)Te(ae,b),ae=ae.nextSibling}}function Le(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,Je(y.ownerDocument,y,b);var L=y.ownerDocument||y;return Te(b,L),b}_e.prototype={nodeName:"#document",nodeType:O,doctype:null,documentElement:null,_inc:1,insertBefore:function(y,b){if(y.nodeType==j){for(var L=y.firstChild;L;){var z=L.nextSibling;this.insertBefore(L,b),L=z}return y}return We(this,y,b),Te(y,this),this.documentElement===null&&y.nodeType===_&&(this.documentElement=y),y},removeChild:function(y){return this.documentElement==y&&(this.documentElement=null),Ce(this,y)},replaceChild:function(y,b){We(this,y,b,Ee),Te(y,this),b&&this.removeChild(b),rt(y)&&(this.documentElement=y)},importNode:function(y,b){return kr(this,y,b)},getElementById:function(y){var b=null;return de(this.documentElement,function(L){if(L.nodeType==_&&L.getAttribute("id")==y)return b=L,!0}),b},getElementsByClassName:function(y){var b=a(y);return new K(this,function(L){var z=[];return b.length>0&&de(L.documentElement,function(ae){if(ae!==L&&ae.nodeType===_){var ge=ae.getAttribute("class");if(ge){var Pe=y===ge;if(!Pe){var at=a(ge);Pe=b.every(u(at))}Pe&&z.push(ae)}}}),z})},createElement:function(y){var b=new Me;b.ownerDocument=this,b.nodeName=y,b.tagName=y,b.localName=y,b.childNodes=new q;var L=b.attributes=new ie;return L._ownerElement=b,b},createDocumentFragment:function(){var y=new we;return y.ownerDocument=this,y.childNodes=new q,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 fi;return b.ownerDocument=this,b.appendData(y),b},createProcessingInstruction:function(y,b){var L=new Ns;return L.ownerDocument=this,L.tagName=L.nodeName=L.target=y,L.nodeValue=L.data=b,L},createAttribute:function(y){var b=new hi;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 L=new Me,z=b.split(":"),ae=L.attributes=new ie;return L.childNodes=new q,L.ownerDocument=this,L.nodeName=b,L.tagName=b,L.namespaceURI=y,z.length==2?(L.prefix=z[0],L.localName=z[1]):L.localName=b,ae._ownerElement=L,L},createAttributeNS:function(y,b){var L=new hi,z=b.split(":");return L.ownerDocument=this,L.nodeName=b,L.name=b,L.namespaceURI=y,L.specified=!0,z.length==2?(L.prefix=z[0],L.localName=z[1]):L.localName=b,L}},f(_e,se);function Me(){this._nsMap={}}Me.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 L=this.ownerDocument.createAttribute(y);L.value=L.nodeValue=""+b,this.setAttributeNode(L)},removeAttribute:function(y){var b=this.getAttributeNode(y);b&&this.removeAttributeNode(b)},appendChild:function(y){return y.nodeType===j?this.insertBefore(y,null):Le(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 L=this.getAttributeNodeNS(y,b);L&&this.removeAttributeNode(L)},hasAttributeNS:function(y,b){return this.getAttributeNodeNS(y,b)!=null},getAttributeNS:function(y,b){var L=this.getAttributeNodeNS(y,b);return L&&L.value||""},setAttributeNS:function(y,b,L){var z=this.ownerDocument.createAttributeNS(y,b);z.value=z.nodeValue=""+L,this.setAttributeNode(z)},getAttributeNodeNS:function(y,b){return this.attributes.getNamedItemNS(y,b)},getElementsByTagName:function(y){return new K(this,function(b){var L=[];return de(b,function(z){z!==b&&z.nodeType==_&&(y==="*"||z.tagName==y)&&L.push(z)}),L})},getElementsByTagNameNS:function(y,b){return new K(this,function(L){var z=[];return de(L,function(ae){ae!==L&&ae.nodeType===_&&(y==="*"||ae.namespaceURI===y)&&(b==="*"||ae.localName==b)&&z.push(ae)}),z})}},_e.prototype.getElementsByTagName=Me.prototype.getElementsByTagName,_e.prototype.getElementsByTagNameNS=Me.prototype.getElementsByTagNameNS,f(Me,se);function hi(){}hi.prototype.nodeType=w,f(hi,se);function si(){}si.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(G[v])},deleteData:function(y,b){this.replaceData(y,b,"")},replaceData:function(y,b,L){var z=this.data.substring(0,y),ae=this.data.substring(y+b);L=z+L+ae,this.nodeValue=this.data=L,this.length=L.length}},f(si,se);function ki(){}ki.prototype={nodeName:"#text",nodeType:x,splitText:function(y){var b=this.data,L=b.substring(y);b=b.substring(0,y),this.data=this.nodeValue=b,this.length=b.length;var z=this.ownerDocument.createTextNode(L);return this.parentNode&&this.parentNode.insertBefore(z,this.nextSibling),z}},f(ki,si);function Ii(){}Ii.prototype={nodeName:"#comment",nodeType:N},f(Ii,si);function fi(){}fi.prototype={nodeName:"#cdata-section",nodeType:P},f(fi,si);function pi(){}pi.prototype.nodeType=F,f(pi,se);function Os(){}Os.prototype.nodeType=U,f(Os,se);function Rs(){}Rs.prototype.nodeType=I,f(Rs,se);function Ki(){}Ki.prototype.nodeType=T,f(Ki,se);function we(){}we.prototype.nodeName="#document-fragment",we.prototype.nodeType=j,f(we,se);function Ns(){}Ns.prototype.nodeType=M,f(Ns,se);function Pi(){}Pi.prototype.serializeToString=function(y,b,L){return Ar.call(y,b,L)},se.prototype.toString=Ar;function Ar(y,b){var L=[],z=this.nodeType==9&&this.documentElement||this,ae=z.prefix,ge=z.namespaceURI;if(ge&&ae==null){var ae=z.lookupPrefix(ge);if(ae==null)var Pe=[{namespace:ge,prefix:null}]}return mi(this,L,y,b,Pe),L.join("")}function Dr(y,b,L){var z=y.prefix||"",ae=y.namespaceURI;if(!ae||z==="xml"&&ae===t.XML||ae===t.XMLNS)return!1;for(var ge=L.length;ge--;){var Pe=L[ge];if(Pe.prefix===z)return Pe.namespace!==ae}return!0}function Ms(y,b,L){y.push(" ",b,'="',L.replace(/[<>&"\t\n\r]/g,ce),'"')}function mi(y,b,L,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 ge=y.attributes,Pe=ge.length,Oe=y.firstChild,at=y.tagName;L=t.isHTML(y.namespaceURI)||L;var vt=at;if(!L&&!y.prefix&&y.namespaceURI){for(var Ht,At=0;At<ge.length;At++)if(ge.item(At).name==="xmlns"){Ht=ge.item(At).value;break}if(!Ht)for(var Nt=ae.length-1;Nt>=0;Nt--){var Dt=ae[Nt];if(Dt.prefix===""&&Dt.namespace===y.namespaceURI){Ht=Dt.namespace;break}}if(Ht!==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+":"+at);break}}}b.push("<",vt);for(var He=0;He<Pe;He++){var kt=ge.item(He);kt.prefix=="xmlns"?ae.push({prefix:kt.localName,namespace:kt.value}):kt.nodeName=="xmlns"&&ae.push({prefix:"",namespace:kt.value})}for(var He=0;He<Pe;He++){var kt=ge.item(He);if(Dr(kt,L,ae)){var ri=kt.prefix||"",zt=kt.namespaceURI;Ms(b,ri?"xmlns:"+ri:"xmlns",zt),ae.push({prefix:ri,namespace:zt})}mi(kt,b,L,z,ae)}if(at===vt&&Dr(y,L,ae)){var ri=y.prefix||"",zt=y.namespaceURI;Ms(b,ri?"xmlns:"+ri:"xmlns",zt),ae.push({prefix:ri,namespace:zt})}if(Oe||L&&!/^(?:meta|link|img|br|hr|input)$/i.test(at)){if(b.push(">"),L&&/^script$/i.test(at))for(;Oe;)Oe.data?b.push(Oe.data):mi(Oe,b,L,z,ae.slice()),Oe=Oe.nextSibling;else for(;Oe;)mi(Oe,b,L,z,ae.slice()),Oe=Oe.nextSibling;b.push("</",vt,">")}else b.push("/>");return;case O:case j:for(var Oe=y.firstChild;Oe;)mi(Oe,b,L,z,ae.slice()),Oe=Oe.nextSibling;return;case w:return Ms(b,y.name,y.value);case x:return b.push(y.data.replace(/[<&>]/g,ce));case P:return b.push("<![CDATA[",y.data,"]]>");case N:return b.push("<!--",y.data,"-->");case F:var Li=y.publicId,Se=y.systemId;if(b.push("<!DOCTYPE ",y.name),Li)b.push(" PUBLIC ",Li),Se&&Se!="."&&b.push(" ",Se),b.push(">");else if(Se&&Se!=".")b.push(" SYSTEM ",Se,">");else{var Pr=y.internalSubset;Pr&&b.push(" [",Pr,"]"),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 kr(y,b,L){var z;switch(b.nodeType){case _:z=b.cloneNode(!1),z.ownerDocument=y;case j:break;case w:L=!0;break}if(z||(z=b.cloneNode(!1)),z.ownerDocument=y,z.parentNode=null,L)for(var ae=b.firstChild;ae;)z.appendChild(kr(y,ae,L)),ae=ae.nextSibling;return z}function Bs(y,b,L){var z=new b.constructor;for(var ae in b)if(Object.prototype.hasOwnProperty.call(b,ae)){var ge=b[ae];typeof ge!="object"&&ge!=z[ae]&&(z[ae]=ge)}switch(b.childNodes&&(z.childNodes=new q),z.ownerDocument=y,z.nodeType){case _:var Pe=b.attributes,at=z.attributes=new ie,vt=Pe.length;at._ownerElement=z;for(var Ht=0;Ht<vt;Ht++)z.setAttributeNode(Bs(y,Pe.item(Ht),!0));break;case w:L=!0}if(L)for(var At=b.firstChild;At;)z.appendChild(Bs(y,At,L)),At=At.nextSibling;return z}function Ir(y,b,L){y[b]=L}try{if(Object.defineProperty){let y=function(b){switch(b.nodeType){case _:case j:var L=[];for(b=b.firstChild;b;)b.nodeType!==7&&b.nodeType!==8&&L.push(y(b)),b=b.nextSibling;return L.join("");default:return b.nodeValue}};Object.defineProperty(K.prototype,"length",{get:function(){return te(this),this.$$length}}),Object.defineProperty(se.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}}}),Ir=function(b,L,z){b["$$"+L]=z}}}catch{}return ai.DocumentType=pi,ai.DOMException=H,ai.DOMImplementation=re,ai.Element=Me,ai.Node=se,ai.NodeList=q,ai.XMLSerializer=Pi,ai}var tr={},Na={},wl;function g0(){return wl||(wl=1,(function(s){var e=Fn().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})(Na)),Na}var sn={},Al;function _0(){if(Al)return sn;Al=1;var s=Fn().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,m=6,_=7;function w(v,E){this.message=v,this.locator=E,Error.captureStackTrace&&Error.captureStackTrace(this,w)}w.prototype=new Error,w.prototype.name=w.name;function x(){}x.prototype={parse:function(v,E,V){var H=this.domBuilder;H.startDocument(),F(E,E={}),P(v,E,V,H,this.errorHandler),H.endDocument()}};function P(v,E,V,H,q){function K(Le){if(Le>65535){Le-=65536;var Me=55296+(Le>>10),hi=56320+(Le&1023);return String.fromCharCode(Me,hi)}else return String.fromCharCode(Le)}function te(Le){var Me=Le.slice(1,-1);return Object.hasOwnProperty.call(V,Me)?V[Me]:Me.charAt(0)==="#"?K(parseInt(Me.substr(1).replace("x","0x"))):(q.error("entity not found:"+Le),Le)}function ie(Le){if(Le>_e){var Me=v.substring(_e,Le).replace(/&#?\w+;/g,te);se&&W(_e),H.characters(Me,0,Le-_e),_e=Le}}function W(Le,Me){for(;Le>=ee&&(Me=re.exec(v));)Z=Me.index,ee=Z+Me[0].length,se.lineNumber++;se.columnNumber=Le-Z+1}for(var Z=0,ee=0,re=/.*(?:\r\n?|\n)|.*$/g,se=H.locator,ce=[{currentNSMap:E}],de={},_e=0;;){try{var pe=v.indexOf("<",_e);if(pe<0){if(!v.substr(_e).match(/^\s*$/)){var $e=H.doc,Je=$e.createTextNode(v.substr(_e));$e.appendChild(Je),H.currentElement=Je}return}switch(pe>_e&&ie(pe),v.charAt(pe+1)){case"/":var Ve=v.indexOf(">",pe+3),Ce=v.substring(pe+2,Ve).replace(/[ \t\n\r]+$/g,""),Ze=ce.pop();Ve<0?(Ce=v.substring(pe+2).replace(/[\s<].*/,""),q.error("end tag name: "+Ce+" is not complete:"+Ze.tagName),Ve=pe+1+Ce.length):Ce.match(/\s</)&&(Ce=Ce.replace(/[\s<].*/,""),q.error("end tag name: "+Ce+" maybe not complete"),Ve=pe+1+Ce.length);var ct=Ze.localNSMap,Ye=Ze.tagName==Ce,rt=Ye||Ze.tagName&&Ze.tagName.toLowerCase()==Ce.toLowerCase();if(rt){if(H.endElement(Ze.uri,Ze.localName,Ce),ct)for(var $t in ct)Object.prototype.hasOwnProperty.call(ct,$t)&&H.endPrefixMapping($t);Ye||q.fatalError("end tag name: "+Ce+" is not match the current start tagName:"+Ze.tagName)}else ce.push(Ze);Ve++;break;case"?":se&&W(pe),Ve=U(v,pe,H);break;case"!":se&&W(pe),Ve=j(v,pe,H,q);break;default:se&&W(pe);var Ge=new R,Vt=ce[ce.length-1].currentNSMap,Ve=I(v,pe,Ge,Vt,te,q),xe=Ge.length;if(!Ge.closed&&O(v,Ve,Ge.tagName,de)&&(Ge.closed=!0,V.nbsp||q.warning("unclosed xml attribute")),se&&xe){for(var Ee=T(se,{}),We=0;We<xe;We++){var Te=Ge[We];W(Te.offset),Te.locator=T(se,{})}H.locator=Ee,M(Ge,H,Vt)&&ce.push(Ge),H.locator=se}else M(Ge,H,Vt)&&ce.push(Ge);s.isHTML(Ge.uri)&&!Ge.closed?Ve=N(v,Ve,Ge.tagName,te,H):Ve++}}catch(Le){if(Le instanceof w)throw Le;q.error("element parse error: "+Le),Ve=-1}Ve>_e?_e=Ve:ie(Math.max(pe,_e)+1)}}function T(v,E){return E.lineNumber=v.lineNumber,E.columnNumber=v.columnNumber,E}function I(v,E,V,H,q,K){function te(se,ce,de){V.attributeNames.hasOwnProperty(se)&&K.fatalError("Attribute "+se+" redefined"),V.addValue(se,ce.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,q),de)}for(var ie,W,Z=++E,ee=r;;){var re=v.charAt(Z);switch(re){case"=":if(ee===n)ie=v.slice(E,Z),ee=u;else if(ee===a)ee=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ee===u||ee===n)if(ee===n&&(K.warning('attribute value must after "="'),ie=v.slice(E,Z)),E=Z+1,Z=v.indexOf(re,E),Z>0)W=v.slice(E,Z),te(ie,W,E-1),ee=f;else throw new Error("attribute value no end '"+re+"' match");else if(ee==l)W=v.slice(E,Z),te(ie,W,E),K.warning('attribute "'+ie+'" missed start quot('+re+")!!"),E=Z+1,ee=f;else throw new Error('attribute value must after "="');break;case"/":switch(ee){case r:V.setTagName(v.slice(E,Z));case f:case m:case _:ee=_,V.closed=!0;case l:case n:break;case a:V.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return K.error("unexpected end of input"),ee==r&&V.setTagName(v.slice(E,Z)),Z;case">":switch(ee){case r:V.setTagName(v.slice(E,Z));case f:case m:case _:break;case l:case n:W=v.slice(E,Z),W.slice(-1)==="/"&&(V.closed=!0,W=W.slice(0,-1));case a:ee===a&&(W=ie),ee==l?(K.warning('attribute "'+W+'" missed quot(")!'),te(ie,W,E)):((!s.isHTML(H[""])||!W.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+W+'" missed value!! "'+W+'" instead!!'),te(W,W,E));break;case u:throw new Error("attribute value missed!!")}return Z;case"":re=" ";default:if(re<=" ")switch(ee){case r:V.setTagName(v.slice(E,Z)),ee=m;break;case n:ie=v.slice(E,Z),ee=a;break;case l:var W=v.slice(E,Z);K.warning('attribute "'+W+'" missed quot(")!!'),te(ie,W,E);case f:ee=m;break}else switch(ee){case a:V.tagName,(!s.isHTML(H[""])||!ie.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+ie+'" missed value!! "'+ie+'" instead2!!'),te(ie,ie,E),E=Z,ee=n;break;case f:K.warning('attribute space is required"'+ie+'"!!');case m:ee=n,E=Z;break;case u:ee=l,E=Z;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}Z++}}function M(v,E,V){for(var H=v.tagName,q=null,re=v.length;re--;){var K=v[re],te=K.qName,ie=K.value,se=te.indexOf(":");if(se>0)var W=K.prefix=te.slice(0,se),Z=te.slice(se+1),ee=W==="xmlns"&&Z;else Z=te,W=null,ee=te==="xmlns"&&"";K.localName=Z,ee!==!1&&(q==null&&(q={},F(V,V={})),V[ee]=q[ee]=ie,K.uri=s.XMLNS,E.startPrefixMapping(ee,ie))}for(var re=v.length;re--;){K=v[re];var W=K.prefix;W&&(W==="xml"&&(K.uri=s.XML),W!=="xmlns"&&(K.uri=V[W||""]))}var se=H.indexOf(":");se>0?(W=v.prefix=H.slice(0,se),Z=v.localName=H.slice(se+1)):(W=null,Z=v.localName=H);var ce=v.uri=V[W||""];if(E.startElement(ce,Z,H,v),v.closed){if(E.endElement(ce,Z,H),q)for(W in q)Object.prototype.hasOwnProperty.call(q,W)&&E.endPrefixMapping(W)}else return v.currentNSMap=V,v.localNSMap=q,!0}function N(v,E,V,H,q){if(/^(?:script|textarea)$/i.test(V)){var K=v.indexOf("</"+V+">",E),te=v.substring(E+1,K);if(/[&<]/.test(te))return/^script$/i.test(V)?(q.characters(te,0,te.length),K):(te=te.replace(/&#?\w+;/g,H),q.characters(te,0,te.length),K)}return E+1}function O(v,E,V,H){var q=H[V];return q==null&&(q=v.lastIndexOf("</"+V+">"),q<E&&(q=v.lastIndexOf("</"+V)),H[V]=q),q<E}function F(v,E){for(var V in v)Object.prototype.hasOwnProperty.call(v,V)&&(E[V]=v[V])}function j(v,E,V,H){var q=v.charAt(E+2);switch(q){case"-":if(v.charAt(E+3)==="-"){var K=v.indexOf("-->",E+4);return K>E?(V.comment(v,E+4,K-E-4),K+3):(H.error("Unclosed comment"),-1)}else return-1;default:if(v.substr(E+3,6)=="CDATA["){var K=v.indexOf("]]>",E+9);return V.startCDATA(),V.characters(v,E+9,K-E-9),V.endCDATA(),K+3}var te=G(v,E),ie=te.length;if(ie>1&&/!doctype/i.test(te[0][0])){var W=te[1][0],Z=!1,ee=!1;ie>3&&(/^public$/i.test(te[2][0])?(Z=te[3][0],ee=ie>4&&te[4][0]):/^system$/i.test(te[2][0])&&(ee=te[3][0]));var re=te[ie-1];return V.startDTD(W,Z,ee),V.endDTD(),re.index+re[0].length}}return-1}function U(v,E,V){var H=v.indexOf("?>",E);if(H){var q=v.substring(E,H).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return q?(q[0].length,V.processingInstruction(q[1],q[2]),H+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,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 G(v,E){var V,H=[],q=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(q.lastIndex=E,q.exec(v);V=q.exec(v);)if(H.push(V),V[1])return H}return sn.XMLReader=x,sn.ParseError=w,sn}var Dl;function y0(){if(Dl)return tr;Dl=1;var s=Fn(),e=ad(),t=g0(),i=_0(),r=e.DOMImplementation,n=s.NAMESPACE,a=i.ParseError,u=i.XMLReader;function l(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 Vg=" ",Pa=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},Hg=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},ht=function(s){const e={};if(!s)return e;const t=s.split(Hg());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 zg 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=Ke(Pa(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=ht(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=Pa(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=ht(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=ht(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=ht(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=ht(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=ht(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(Vg)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=ht(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=Pa(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=ht(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=ht(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=ht(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=ht(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=ht(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=ht(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=ht(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=ht(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 Gg=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ti=function(s){const e={};return Object.keys(s).forEach(function(t){e[Gg(t)]=s[t]}),e},La=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 Wg extends Io{constructor(e={}){super(),this.lineStream=new $g,this.parseStream=new zg,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:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let w=0,x=0;const P={};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=w)),"offset"in T&&(r.byterange=N,N.offset=T.offset),w=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===m){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:Jc(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={}),Ke(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,F)=>(F.programDateTime=O-F.duration*1e3,F.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,La.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=Ti(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const N=this.manifest.segments.length,O=Ti(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 F=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${N}`,T.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((j,U)=>{j.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${U} lacks required attribute(s): LAST-PART`})})},"server-control"(){const N=this.manifest.serverControl=Ti(T.attributes);N.hasOwnProperty("canBlockReload")||(N.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),La.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=Ti(T.attributes),F=O.type&&O.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(O),O.byterange&&(O.byterange.hasOwnProperty("offset")||(O.byterange.offset=F?x:0,F&&(x=O.byterange.offset+O.byterange.length)));const j=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${j} 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 #${j} for segment #${N} has the same TYPE ${O.type} as preload hint #${U}`})}},"rendition-report"(){const N=Ti(T.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(N);const O=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];u&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${O}`,T.attributes,F)},"part-inf"(){this.manifest.partInf=Ti(T.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",T.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),La.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Ti(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 F=!!O.endOnNext;if(F&&!O.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(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(!P[O.id])P[O.id]=O;else{for(const U in P[O.id])if(O[U]&&JSON.stringify(P[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 j=this.manifest.dateRanges.findIndex(U=>U.id===O.id);this.manifest.dateRanges[j]=Ke(this.manifest.dateRanges[j],O),P[O.id]=Ke(P[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=Ti(T.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",T.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const N=(O,F)=>{if(O in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${O}`});return}this.manifest.definitions[O]=F};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^/},Xg=["video","audio","text"],bl=["Video","Audio","Text"],Zc=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})},Xt=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(r){r=r.trim();var n;Xg.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},Kg=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 Xt(n.playlists[0].attributes.CODECS)}return null},ed=function(e){return e===void 0&&(e=""),$i.audio.test(e.trim().toLowerCase())},Yg=function(e){return e===void 0&&(e=""),$i.text.test(e.trim().toLowerCase())},_s=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return Zc(n.trim())}),i="video";t.length===1&&ed(t[0])?i="audio":t.length===1&&Yg(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(_s(e))||t&&D.ManagedMediaSource&&D.ManagedMediaSource.isTypeSupported&&D.ManagedMediaSource.isTypeSupported(_s(e))||!1},Oa=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",Qg="avc1.4d400d",Jg=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Zg=/^application\/dash\+xml/i,td=function(e){return Jg.test(e)?"hls":Zg.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},e0=function(e){return e.toString(2).length},t0=function(e){return Math.ceil(e0(e)/8)},id=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},i0=function(e){return id(e)},fe=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!i0(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))},nt=D.BigInt||Number,to=[nt("0x1"),nt("0x100"),nt("0x10000"),nt("0x1000000"),nt("0x100000000"),nt("0x10000000000"),nt("0x1000000000000"),nt("0x100000000000000"),nt("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 s0=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=fe(e);var l=u?"reduce":"reduceRight",f=e[l]?e[l]:Array.prototype[l],m=f.call(e,function(w,x,P){var T=u?P:Math.abs(P+1-e.length);return w+nt(x)*to[T]},nt(0));if(n){var _=to[e.length]/nt(2)-nt(1);m=nt(m),m>_&&(m-=_,m-=_,m-=nt(2))}return Number(m)},r0=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=nt(e);for(var a=t0(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/to[l]&nt(255)),e<0&&(u[f]=Math.abs(~u[f]),u[f]-=l===0?1:2)}return u},sd=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},n0=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 fe(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=fe(u),n.set(u,a),a+=u.byteLength}),n},Fe=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=fe(e),t=fe(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(m,_){var w=l[_]?l[_]&e[a+_]:e[a+_];return m===w})},a0=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)}})},er={},ai={},Mi={},Sl;function Bn(){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 rd(){if(El)return ai;El=1;var s=Bn(),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 L in y)Object.prototype.hasOwnProperty.call(y,L)&&(b[L]=y[L])}function f(y,b){var L=y.prototype;if(!(L instanceof b)){let z=function(){};z.prototype=b.prototype,z=new z,l(L,z),y.prototype=L=z}L.constructor!=y&&(typeof y!="function"&&console.error("unknown Class:"+y),L.constructor=y)}var m={},_=m.ELEMENT_NODE=1,w=m.ATTRIBUTE_NODE=2,x=m.TEXT_NODE=3,P=m.CDATA_SECTION_NODE=4,T=m.ENTITY_REFERENCE_NODE=5,I=m.ENTITY_NODE=6,M=m.PROCESSING_INSTRUCTION_NODE=7,N=m.COMMENT_NODE=8,O=m.DOCUMENT_NODE=9,F=m.DOCUMENT_TYPE_NODE=10,j=m.DOCUMENT_FRAGMENT_NODE=11,U=m.NOTATION_NODE=12,R={},G={};R.INDEX_SIZE_ERR=(G[1]="Index size error",1),R.DOMSTRING_SIZE_ERR=(G[2]="DOMString size error",2);var v=R.HIERARCHY_REQUEST_ERR=(G[3]="Hierarchy request error",3);R.WRONG_DOCUMENT_ERR=(G[4]="Wrong document",4),R.INVALID_CHARACTER_ERR=(G[5]="Invalid character",5),R.NO_DATA_ALLOWED_ERR=(G[6]="No data allowed",6),R.NO_MODIFICATION_ALLOWED_ERR=(G[7]="No modification allowed",7);var E=R.NOT_FOUND_ERR=(G[8]="Not found",8);R.NOT_SUPPORTED_ERR=(G[9]="Not supported",9);var V=R.INUSE_ATTRIBUTE_ERR=(G[10]="Attribute in use",10);R.INVALID_STATE_ERR=(G[11]="Invalid state",11),R.SYNTAX_ERR=(G[12]="Syntax error",12),R.INVALID_MODIFICATION_ERR=(G[13]="Invalid modification",13),R.NAMESPACE_ERR=(G[14]="Invalid namespace",14),R.INVALID_ACCESS_ERR=(G[15]="Invalid access",15);function H(y,b){if(b instanceof Error)var L=b;else L=this,Error.call(this,G[y]),this.message=G[y],Error.captureStackTrace&&Error.captureStackTrace(this,H);return L.code=y,b&&(this.message=this.message+": "+b),L}H.prototype=Error.prototype,l(R,H);function q(){}q.prototype={length:0,item:function(y){return y>=0&&y<this.length?this[y]:null},toString:function(y,b){for(var L=[],z=0;z<this.length;z++)mi(this[z],L,y,b);return L.join("")},filter:function(y){return Array.prototype.filter.call(this,y)},indexOf:function(y){return Array.prototype.indexOf.call(this,y)}};function K(y,b){this._node=y,this._refresh=b,te(this)}function te(y){var b=y._node._inc||y._node.ownerDocument._inc;if(y._inc!==b){var L=y._refresh(y._node);if(Ir(y,"length",L.length),!y.$$length||L.length<y.$$length)for(var z=L.length;z in y;z++)Object.prototype.hasOwnProperty.call(y,z)&&delete y[z];l(L,y),y._inc=b}}K.prototype.item=function(y){return te(this),this[y]||null},f(K,q);function ie(){}function W(y,b){for(var L=y.length;L--;)if(y[L]===b)return L}function Z(y,b,L,z){if(z?b[W(b,z)]=L:b[b.length++]=L,y){L.ownerElement=y;var ae=y.ownerDocument;ae&&(z&&$e(ae,y,z),pe(ae,y,L))}}function ee(y,b,L){var z=W(b,L);if(z>=0){for(var ae=b.length-1;z<ae;)b[z]=b[++z];if(b.length=ae,y){var ge=y.ownerDocument;ge&&($e(ge,y,L),L.ownerElement=null)}}else throw new H(E,new Error(y.tagName+"@"+L))}ie.prototype={length:0,item:q.prototype.item,getNamedItem:function(y){for(var b=this.length;b--;){var L=this[b];if(L.nodeName==y)return L}},setNamedItem:function(y){var b=y.ownerElement;if(b&&b!=this._ownerElement)throw new H(V);var L=this.getNamedItem(y.nodeName);return Z(this._ownerElement,this,y,L),L},setNamedItemNS:function(y){var b=y.ownerElement,L;if(b&&b!=this._ownerElement)throw new H(V);return L=this.getNamedItemNS(y.namespaceURI,y.localName),Z(this._ownerElement,this,y,L),L},removeNamedItem:function(y){var b=this.getNamedItem(y);return ee(this._ownerElement,this,b),b},removeNamedItemNS:function(y,b){var L=this.getNamedItemNS(y,b);return ee(this._ownerElement,this,L),L},getNamedItemNS:function(y,b){for(var L=this.length;L--;){var z=this[L];if(z.localName==b&&z.namespaceURI==y)return z}return null}};function re(){}re.prototype={hasFeature:function(y,b){return!0},createDocument:function(y,b,L){var z=new _e;if(z.implementation=this,z.childNodes=new q,z.doctype=L||null,L&&z.appendChild(L),b){var ae=z.createElementNS(y,b);z.appendChild(ae)}return z},createDocumentType:function(y,b,L){var z=new pi;return z.name=y,z.nodeName=y,z.publicId=b||"",z.systemId=L||"",z}};function se(){}se.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 We(this,y,b)},replaceChild:function(y,b){We(this,y,b,Ee),b&&this.removeChild(b)},removeChild:function(y){return Ce(this,y)},appendChild:function(y){return this.insertBefore(y,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(y){return Bs(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 L=b._nsMap;if(L){for(var z in L)if(Object.prototype.hasOwnProperty.call(L,z)&&L[z]===y)return z}b=b.nodeType==w?b.ownerDocument:b.parentNode}return null},lookupNamespaceURI:function(y){for(var b=this;b;){var L=b._nsMap;if(L&&Object.prototype.hasOwnProperty.call(L,y))return L[y];b=b.nodeType==w?b.ownerDocument:b.parentNode}return null},isDefaultNamespace:function(y){var b=this.lookupPrefix(y);return b==null}};function ce(y){return y=="<"&&"<"||y==">"&&">"||y=="&"&&"&"||y=='"'&&"""||"&#"+y.charCodeAt()+";"}l(m,se),l(m,se.prototype);function de(y,b){if(b(y))return!0;if(y=y.firstChild)do if(de(y,b))return!0;while(y=y.nextSibling)}function _e(){this.ownerDocument=this}function pe(y,b,L){y&&y._inc++;var z=L.namespaceURI;z===t.XMLNS&&(b._nsMap[L.prefix?L.localName:""]=L.value)}function $e(y,b,L,z){y&&y._inc++;var ae=L.namespaceURI;ae===t.XMLNS&&delete b._nsMap[L.prefix?L.localName:""]}function Je(y,b,L){if(y&&y._inc){y._inc++;var z=b.childNodes;if(L)z[z.length++]=L;else{for(var ae=b.firstChild,ge=0;ae;)z[ge++]=ae,ae=ae.nextSibling;z.length=ge,delete z[z.length]}}}function Ce(y,b){var L=b.previousSibling,z=b.nextSibling;return L?L.nextSibling=z:y.firstChild=z,z?z.previousSibling=L:y.lastChild=L,b.parentNode=null,b.previousSibling=null,b.nextSibling=null,Je(y.ownerDocument,y),b}function Ze(y){return y&&(y.nodeType===se.DOCUMENT_NODE||y.nodeType===se.DOCUMENT_FRAGMENT_NODE||y.nodeType===se.ELEMENT_NODE)}function ct(y){return y&&(rt(y)||$t(y)||Ye(y)||y.nodeType===se.DOCUMENT_FRAGMENT_NODE||y.nodeType===se.COMMENT_NODE||y.nodeType===se.PROCESSING_INSTRUCTION_NODE)}function Ye(y){return y&&y.nodeType===se.DOCUMENT_TYPE_NODE}function rt(y){return y&&y.nodeType===se.ELEMENT_NODE}function $t(y){return y&&y.nodeType===se.TEXT_NODE}function Ge(y,b){var L=y.childNodes||[];if(e(L,rt)||Ye(b))return!1;var z=e(L,Ye);return!(b&&z&&L.indexOf(z)>L.indexOf(b))}function Vt(y,b){var L=y.childNodes||[];function z(ge){return rt(ge)&&ge!==b}if(e(L,z))return!1;var ae=e(L,Ye);return!(b&&ae&&L.indexOf(ae)>L.indexOf(b))}function Ve(y,b,L){if(!Ze(y))throw new H(v,"Unexpected parent node type "+y.nodeType);if(L&&L.parentNode!==y)throw new H(E,"child not in parent");if(!ct(b)||Ye(b)&&y.nodeType!==se.DOCUMENT_NODE)throw new H(v,"Unexpected node type "+b.nodeType+" for parent node type "+y.nodeType)}function xe(y,b,L){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===se.DOCUMENT_FRAGMENT_NODE){var ge=ae.filter(rt);if(ge.length>1||e(ae,$t))throw new H(v,"More than one element or text in fragment");if(ge.length===1&&!Ge(y,L))throw new H(v,"Element in fragment can not be inserted before doctype")}if(rt(b)&&!Ge(y,L))throw new H(v,"Only one element can be added and only after doctype");if(Ye(b)){if(e(z,Ye))throw new H(v,"Only one doctype is allowed");var Pe=e(z,rt);if(L&&z.indexOf(Pe)<z.indexOf(L))throw new H(v,"Doctype can only be inserted before an element");if(!L&&Pe)throw new H(v,"Doctype can not be appended since element is present")}}function Ee(y,b,L){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===se.DOCUMENT_FRAGMENT_NODE){var ge=ae.filter(rt);if(ge.length>1||e(ae,$t))throw new H(v,"More than one element or text in fragment");if(ge.length===1&&!Vt(y,L))throw new H(v,"Element in fragment can not be inserted before doctype")}if(rt(b)&&!Vt(y,L))throw new H(v,"Only one element can be added and only after doctype");if(Ye(b)){if(e(z,function(vt){return Ye(vt)&&vt!==L}))throw new H(v,"Only one doctype is allowed");var Pe=e(z,rt);if(L&&z.indexOf(Pe)<z.indexOf(L))throw new H(v,"Doctype can only be inserted before an element")}}function We(y,b,L,z){Ve(y,b,L),y.nodeType===se.DOCUMENT_NODE&&(z||xe)(y,b,L);var ae=b.parentNode;if(ae&&ae.removeChild(b),b.nodeType===j){var ge=b.firstChild;if(ge==null)return b;var Pe=b.lastChild}else ge=Pe=b;var at=L?L.previousSibling:y.lastChild;ge.previousSibling=at,Pe.nextSibling=L,at?at.nextSibling=ge:y.firstChild=ge,L==null?y.lastChild=Pe:L.previousSibling=Pe;do{ge.parentNode=y;var vt=y.ownerDocument||y;Te(ge,vt)}while(ge!==Pe&&(ge=ge.nextSibling));return Je(y.ownerDocument||y,y),b.nodeType==j&&(b.firstChild=b.lastChild=null),b}function Te(y,b){if(y.ownerDocument!==b){if(y.ownerDocument=b,y.nodeType===_&&y.attributes)for(var L=0;L<y.attributes.length;L++){var z=y.attributes.item(L);z&&(z.ownerDocument=b)}for(var ae=y.firstChild;ae;)Te(ae,b),ae=ae.nextSibling}}function Le(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,Je(y.ownerDocument,y,b);var L=y.ownerDocument||y;return Te(b,L),b}_e.prototype={nodeName:"#document",nodeType:O,doctype:null,documentElement:null,_inc:1,insertBefore:function(y,b){if(y.nodeType==j){for(var L=y.firstChild;L;){var z=L.nextSibling;this.insertBefore(L,b),L=z}return y}return We(this,y,b),Te(y,this),this.documentElement===null&&y.nodeType===_&&(this.documentElement=y),y},removeChild:function(y){return this.documentElement==y&&(this.documentElement=null),Ce(this,y)},replaceChild:function(y,b){We(this,y,b,Ee),Te(y,this),b&&this.removeChild(b),rt(y)&&(this.documentElement=y)},importNode:function(y,b){return kr(this,y,b)},getElementById:function(y){var b=null;return de(this.documentElement,function(L){if(L.nodeType==_&&L.getAttribute("id")==y)return b=L,!0}),b},getElementsByClassName:function(y){var b=a(y);return new K(this,function(L){var z=[];return b.length>0&&de(L.documentElement,function(ae){if(ae!==L&&ae.nodeType===_){var ge=ae.getAttribute("class");if(ge){var Pe=y===ge;if(!Pe){var at=a(ge);Pe=b.every(u(at))}Pe&&z.push(ae)}}}),z})},createElement:function(y){var b=new Me;b.ownerDocument=this,b.nodeName=y,b.tagName=y,b.localName=y,b.childNodes=new q;var L=b.attributes=new ie;return L._ownerElement=b,b},createDocumentFragment:function(){var y=new we;return y.ownerDocument=this,y.childNodes=new q,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 fi;return b.ownerDocument=this,b.appendData(y),b},createProcessingInstruction:function(y,b){var L=new Ns;return L.ownerDocument=this,L.tagName=L.nodeName=L.target=y,L.nodeValue=L.data=b,L},createAttribute:function(y){var b=new hi;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 L=new Me,z=b.split(":"),ae=L.attributes=new ie;return L.childNodes=new q,L.ownerDocument=this,L.nodeName=b,L.tagName=b,L.namespaceURI=y,z.length==2?(L.prefix=z[0],L.localName=z[1]):L.localName=b,ae._ownerElement=L,L},createAttributeNS:function(y,b){var L=new hi,z=b.split(":");return L.ownerDocument=this,L.nodeName=b,L.name=b,L.namespaceURI=y,L.specified=!0,z.length==2?(L.prefix=z[0],L.localName=z[1]):L.localName=b,L}},f(_e,se);function Me(){this._nsMap={}}Me.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 L=this.ownerDocument.createAttribute(y);L.value=L.nodeValue=""+b,this.setAttributeNode(L)},removeAttribute:function(y){var b=this.getAttributeNode(y);b&&this.removeAttributeNode(b)},appendChild:function(y){return y.nodeType===j?this.insertBefore(y,null):Le(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 L=this.getAttributeNodeNS(y,b);L&&this.removeAttributeNode(L)},hasAttributeNS:function(y,b){return this.getAttributeNodeNS(y,b)!=null},getAttributeNS:function(y,b){var L=this.getAttributeNodeNS(y,b);return L&&L.value||""},setAttributeNS:function(y,b,L){var z=this.ownerDocument.createAttributeNS(y,b);z.value=z.nodeValue=""+L,this.setAttributeNode(z)},getAttributeNodeNS:function(y,b){return this.attributes.getNamedItemNS(y,b)},getElementsByTagName:function(y){return new K(this,function(b){var L=[];return de(b,function(z){z!==b&&z.nodeType==_&&(y==="*"||z.tagName==y)&&L.push(z)}),L})},getElementsByTagNameNS:function(y,b){return new K(this,function(L){var z=[];return de(L,function(ae){ae!==L&&ae.nodeType===_&&(y==="*"||ae.namespaceURI===y)&&(b==="*"||ae.localName==b)&&z.push(ae)}),z})}},_e.prototype.getElementsByTagName=Me.prototype.getElementsByTagName,_e.prototype.getElementsByTagNameNS=Me.prototype.getElementsByTagNameNS,f(Me,se);function hi(){}hi.prototype.nodeType=w,f(hi,se);function si(){}si.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(G[v])},deleteData:function(y,b){this.replaceData(y,b,"")},replaceData:function(y,b,L){var z=this.data.substring(0,y),ae=this.data.substring(y+b);L=z+L+ae,this.nodeValue=this.data=L,this.length=L.length}},f(si,se);function ki(){}ki.prototype={nodeName:"#text",nodeType:x,splitText:function(y){var b=this.data,L=b.substring(y);b=b.substring(0,y),this.data=this.nodeValue=b,this.length=b.length;var z=this.ownerDocument.createTextNode(L);return this.parentNode&&this.parentNode.insertBefore(z,this.nextSibling),z}},f(ki,si);function Ii(){}Ii.prototype={nodeName:"#comment",nodeType:N},f(Ii,si);function fi(){}fi.prototype={nodeName:"#cdata-section",nodeType:P},f(fi,si);function pi(){}pi.prototype.nodeType=F,f(pi,se);function Os(){}Os.prototype.nodeType=U,f(Os,se);function Rs(){}Rs.prototype.nodeType=I,f(Rs,se);function Ki(){}Ki.prototype.nodeType=T,f(Ki,se);function we(){}we.prototype.nodeName="#document-fragment",we.prototype.nodeType=j,f(we,se);function Ns(){}Ns.prototype.nodeType=M,f(Ns,se);function Pi(){}Pi.prototype.serializeToString=function(y,b,L){return Ar.call(y,b,L)},se.prototype.toString=Ar;function Ar(y,b){var L=[],z=this.nodeType==9&&this.documentElement||this,ae=z.prefix,ge=z.namespaceURI;if(ge&&ae==null){var ae=z.lookupPrefix(ge);if(ae==null)var Pe=[{namespace:ge,prefix:null}]}return mi(this,L,y,b,Pe),L.join("")}function Dr(y,b,L){var z=y.prefix||"",ae=y.namespaceURI;if(!ae||z==="xml"&&ae===t.XML||ae===t.XMLNS)return!1;for(var ge=L.length;ge--;){var Pe=L[ge];if(Pe.prefix===z)return Pe.namespace!==ae}return!0}function Ms(y,b,L){y.push(" ",b,'="',L.replace(/[<>&"\t\n\r]/g,ce),'"')}function mi(y,b,L,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 ge=y.attributes,Pe=ge.length,Oe=y.firstChild,at=y.tagName;L=t.isHTML(y.namespaceURI)||L;var vt=at;if(!L&&!y.prefix&&y.namespaceURI){for(var Ht,wt=0;wt<ge.length;wt++)if(ge.item(wt).name==="xmlns"){Ht=ge.item(wt).value;break}if(!Ht)for(var Nt=ae.length-1;Nt>=0;Nt--){var At=ae[Nt];if(At.prefix===""&&At.namespace===y.namespaceURI){Ht=At.namespace;break}}if(Ht!==y.namespaceURI)for(var Nt=ae.length-1;Nt>=0;Nt--){var At=ae[Nt];if(At.namespace===y.namespaceURI){At.prefix&&(vt=At.prefix+":"+at);break}}}b.push("<",vt);for(var He=0;He<Pe;He++){var Dt=ge.item(He);Dt.prefix=="xmlns"?ae.push({prefix:Dt.localName,namespace:Dt.value}):Dt.nodeName=="xmlns"&&ae.push({prefix:"",namespace:Dt.value})}for(var He=0;He<Pe;He++){var Dt=ge.item(He);if(Dr(Dt,L,ae)){var ri=Dt.prefix||"",zt=Dt.namespaceURI;Ms(b,ri?"xmlns:"+ri:"xmlns",zt),ae.push({prefix:ri,namespace:zt})}mi(Dt,b,L,z,ae)}if(at===vt&&Dr(y,L,ae)){var ri=y.prefix||"",zt=y.namespaceURI;Ms(b,ri?"xmlns:"+ri:"xmlns",zt),ae.push({prefix:ri,namespace:zt})}if(Oe||L&&!/^(?:meta|link|img|br|hr|input)$/i.test(at)){if(b.push(">"),L&&/^script$/i.test(at))for(;Oe;)Oe.data?b.push(Oe.data):mi(Oe,b,L,z,ae.slice()),Oe=Oe.nextSibling;else for(;Oe;)mi(Oe,b,L,z,ae.slice()),Oe=Oe.nextSibling;b.push("</",vt,">")}else b.push("/>");return;case O:case j:for(var Oe=y.firstChild;Oe;)mi(Oe,b,L,z,ae.slice()),Oe=Oe.nextSibling;return;case w:return Ms(b,y.name,y.value);case x:return b.push(y.data.replace(/[<&>]/g,ce));case P:return b.push("<![CDATA[",y.data,"]]>");case N:return b.push("<!--",y.data,"-->");case F:var Li=y.publicId,Se=y.systemId;if(b.push("<!DOCTYPE ",y.name),Li)b.push(" PUBLIC ",Li),Se&&Se!="."&&b.push(" ",Se),b.push(">");else if(Se&&Se!=".")b.push(" SYSTEM ",Se,">");else{var Pr=y.internalSubset;Pr&&b.push(" [",Pr,"]"),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 kr(y,b,L){var z;switch(b.nodeType){case _:z=b.cloneNode(!1),z.ownerDocument=y;case j:break;case w:L=!0;break}if(z||(z=b.cloneNode(!1)),z.ownerDocument=y,z.parentNode=null,L)for(var ae=b.firstChild;ae;)z.appendChild(kr(y,ae,L)),ae=ae.nextSibling;return z}function Bs(y,b,L){var z=new b.constructor;for(var ae in b)if(Object.prototype.hasOwnProperty.call(b,ae)){var ge=b[ae];typeof ge!="object"&&ge!=z[ae]&&(z[ae]=ge)}switch(b.childNodes&&(z.childNodes=new q),z.ownerDocument=y,z.nodeType){case _:var Pe=b.attributes,at=z.attributes=new ie,vt=Pe.length;at._ownerElement=z;for(var Ht=0;Ht<vt;Ht++)z.setAttributeNode(Bs(y,Pe.item(Ht),!0));break;case w:L=!0}if(L)for(var wt=b.firstChild;wt;)z.appendChild(Bs(y,wt,L)),wt=wt.nextSibling;return z}function Ir(y,b,L){y[b]=L}try{if(Object.defineProperty){let y=function(b){switch(b.nodeType){case _:case j:var L=[];for(b=b.firstChild;b;)b.nodeType!==7&&b.nodeType!==8&&L.push(y(b)),b=b.nextSibling;return L.join("");default:return b.nodeValue}};Object.defineProperty(K.prototype,"length",{get:function(){return te(this),this.$$length}}),Object.defineProperty(se.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}}}),Ir=function(b,L,z){b["$$"+L]=z}}}catch{}return ai.DocumentType=pi,ai.DOMException=H,ai.DOMImplementation=re,ai.Element=Me,ai.Node=se,ai.NodeList=q,ai.XMLSerializer=Pi,ai}var tr={},Ra={},Cl;function o0(){return Cl||(Cl=1,(function(s){var e=Bn().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})(Ra)),Ra}var sn={},wl;function u0(){if(wl)return sn;wl=1;var s=Bn().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,m=6,_=7;function w(v,E){this.message=v,this.locator=E,Error.captureStackTrace&&Error.captureStackTrace(this,w)}w.prototype=new Error,w.prototype.name=w.name;function x(){}x.prototype={parse:function(v,E,V){var H=this.domBuilder;H.startDocument(),F(E,E={}),P(v,E,V,H,this.errorHandler),H.endDocument()}};function P(v,E,V,H,q){function K(Le){if(Le>65535){Le-=65536;var Me=55296+(Le>>10),hi=56320+(Le&1023);return String.fromCharCode(Me,hi)}else return String.fromCharCode(Le)}function te(Le){var Me=Le.slice(1,-1);return Object.hasOwnProperty.call(V,Me)?V[Me]:Me.charAt(0)==="#"?K(parseInt(Me.substr(1).replace("x","0x"))):(q.error("entity not found:"+Le),Le)}function ie(Le){if(Le>_e){var Me=v.substring(_e,Le).replace(/&#?\w+;/g,te);se&&W(_e),H.characters(Me,0,Le-_e),_e=Le}}function W(Le,Me){for(;Le>=ee&&(Me=re.exec(v));)Z=Me.index,ee=Z+Me[0].length,se.lineNumber++;se.columnNumber=Le-Z+1}for(var Z=0,ee=0,re=/.*(?:\r\n?|\n)|.*$/g,se=H.locator,ce=[{currentNSMap:E}],de={},_e=0;;){try{var pe=v.indexOf("<",_e);if(pe<0){if(!v.substr(_e).match(/^\s*$/)){var $e=H.doc,Je=$e.createTextNode(v.substr(_e));$e.appendChild(Je),H.currentElement=Je}return}switch(pe>_e&&ie(pe),v.charAt(pe+1)){case"/":var Ve=v.indexOf(">",pe+3),Ce=v.substring(pe+2,Ve).replace(/[ \t\n\r]+$/g,""),Ze=ce.pop();Ve<0?(Ce=v.substring(pe+2).replace(/[\s<].*/,""),q.error("end tag name: "+Ce+" is not complete:"+Ze.tagName),Ve=pe+1+Ce.length):Ce.match(/\s</)&&(Ce=Ce.replace(/[\s<].*/,""),q.error("end tag name: "+Ce+" maybe not complete"),Ve=pe+1+Ce.length);var ct=Ze.localNSMap,Ye=Ze.tagName==Ce,rt=Ye||Ze.tagName&&Ze.tagName.toLowerCase()==Ce.toLowerCase();if(rt){if(H.endElement(Ze.uri,Ze.localName,Ce),ct)for(var $t in ct)Object.prototype.hasOwnProperty.call(ct,$t)&&H.endPrefixMapping($t);Ye||q.fatalError("end tag name: "+Ce+" is not match the current start tagName:"+Ze.tagName)}else ce.push(Ze);Ve++;break;case"?":se&&W(pe),Ve=U(v,pe,H);break;case"!":se&&W(pe),Ve=j(v,pe,H,q);break;default:se&&W(pe);var Ge=new R,Vt=ce[ce.length-1].currentNSMap,Ve=I(v,pe,Ge,Vt,te,q),xe=Ge.length;if(!Ge.closed&&O(v,Ve,Ge.tagName,de)&&(Ge.closed=!0,V.nbsp||q.warning("unclosed xml attribute")),se&&xe){for(var Ee=T(se,{}),We=0;We<xe;We++){var Te=Ge[We];W(Te.offset),Te.locator=T(se,{})}H.locator=Ee,M(Ge,H,Vt)&&ce.push(Ge),H.locator=se}else M(Ge,H,Vt)&&ce.push(Ge);s.isHTML(Ge.uri)&&!Ge.closed?Ve=N(v,Ve,Ge.tagName,te,H):Ve++}}catch(Le){if(Le instanceof w)throw Le;q.error("element parse error: "+Le),Ve=-1}Ve>_e?_e=Ve:ie(Math.max(pe,_e)+1)}}function T(v,E){return E.lineNumber=v.lineNumber,E.columnNumber=v.columnNumber,E}function I(v,E,V,H,q,K){function te(se,ce,de){V.attributeNames.hasOwnProperty(se)&&K.fatalError("Attribute "+se+" redefined"),V.addValue(se,ce.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,q),de)}for(var ie,W,Z=++E,ee=r;;){var re=v.charAt(Z);switch(re){case"=":if(ee===n)ie=v.slice(E,Z),ee=u;else if(ee===a)ee=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(ee===u||ee===n)if(ee===n&&(K.warning('attribute value must after "="'),ie=v.slice(E,Z)),E=Z+1,Z=v.indexOf(re,E),Z>0)W=v.slice(E,Z),te(ie,W,E-1),ee=f;else throw new Error("attribute value no end '"+re+"' match");else if(ee==l)W=v.slice(E,Z),te(ie,W,E),K.warning('attribute "'+ie+'" missed start quot('+re+")!!"),E=Z+1,ee=f;else throw new Error('attribute value must after "="');break;case"/":switch(ee){case r:V.setTagName(v.slice(E,Z));case f:case m:case _:ee=_,V.closed=!0;case l:case n:break;case a:V.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return K.error("unexpected end of input"),ee==r&&V.setTagName(v.slice(E,Z)),Z;case">":switch(ee){case r:V.setTagName(v.slice(E,Z));case f:case m:case _:break;case l:case n:W=v.slice(E,Z),W.slice(-1)==="/"&&(V.closed=!0,W=W.slice(0,-1));case a:ee===a&&(W=ie),ee==l?(K.warning('attribute "'+W+'" missed quot(")!'),te(ie,W,E)):((!s.isHTML(H[""])||!W.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+W+'" missed value!! "'+W+'" instead!!'),te(W,W,E));break;case u:throw new Error("attribute value missed!!")}return Z;case"":re=" ";default:if(re<=" ")switch(ee){case r:V.setTagName(v.slice(E,Z)),ee=m;break;case n:ie=v.slice(E,Z),ee=a;break;case l:var W=v.slice(E,Z);K.warning('attribute "'+W+'" missed quot(")!!'),te(ie,W,E);case f:ee=m;break}else switch(ee){case a:V.tagName,(!s.isHTML(H[""])||!ie.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+ie+'" missed value!! "'+ie+'" instead2!!'),te(ie,ie,E),E=Z,ee=n;break;case f:K.warning('attribute space is required"'+ie+'"!!');case m:ee=n,E=Z;break;case u:ee=l,E=Z;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}Z++}}function M(v,E,V){for(var H=v.tagName,q=null,re=v.length;re--;){var K=v[re],te=K.qName,ie=K.value,se=te.indexOf(":");if(se>0)var W=K.prefix=te.slice(0,se),Z=te.slice(se+1),ee=W==="xmlns"&&Z;else Z=te,W=null,ee=te==="xmlns"&&"";K.localName=Z,ee!==!1&&(q==null&&(q={},F(V,V={})),V[ee]=q[ee]=ie,K.uri=s.XMLNS,E.startPrefixMapping(ee,ie))}for(var re=v.length;re--;){K=v[re];var W=K.prefix;W&&(W==="xml"&&(K.uri=s.XML),W!=="xmlns"&&(K.uri=V[W||""]))}var se=H.indexOf(":");se>0?(W=v.prefix=H.slice(0,se),Z=v.localName=H.slice(se+1)):(W=null,Z=v.localName=H);var ce=v.uri=V[W||""];if(E.startElement(ce,Z,H,v),v.closed){if(E.endElement(ce,Z,H),q)for(W in q)Object.prototype.hasOwnProperty.call(q,W)&&E.endPrefixMapping(W)}else return v.currentNSMap=V,v.localNSMap=q,!0}function N(v,E,V,H,q){if(/^(?:script|textarea)$/i.test(V)){var K=v.indexOf("</"+V+">",E),te=v.substring(E+1,K);if(/[&<]/.test(te))return/^script$/i.test(V)?(q.characters(te,0,te.length),K):(te=te.replace(/&#?\w+;/g,H),q.characters(te,0,te.length),K)}return E+1}function O(v,E,V,H){var q=H[V];return q==null&&(q=v.lastIndexOf("</"+V+">"),q<E&&(q=v.lastIndexOf("</"+V)),H[V]=q),q<E}function F(v,E){for(var V in v)Object.prototype.hasOwnProperty.call(v,V)&&(E[V]=v[V])}function j(v,E,V,H){var q=v.charAt(E+2);switch(q){case"-":if(v.charAt(E+3)==="-"){var K=v.indexOf("-->",E+4);return K>E?(V.comment(v,E+4,K-E-4),K+3):(H.error("Unclosed comment"),-1)}else return-1;default:if(v.substr(E+3,6)=="CDATA["){var K=v.indexOf("]]>",E+9);return V.startCDATA(),V.characters(v,E+9,K-E-9),V.endCDATA(),K+3}var te=G(v,E),ie=te.length;if(ie>1&&/!doctype/i.test(te[0][0])){var W=te[1][0],Z=!1,ee=!1;ie>3&&(/^public$/i.test(te[2][0])?(Z=te[3][0],ee=ie>4&&te[4][0]):/^system$/i.test(te[2][0])&&(ee=te[3][0]));var re=te[ie-1];return V.startDTD(W,Z,ee),V.endDTD(),re.index+re[0].length}}return-1}function U(v,E,V){var H=v.indexOf("?>",E);if(H){var q=v.substring(E,H).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return q?(q[0].length,V.processingInstruction(q[1],q[2]),H+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,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 G(v,E){var V,H=[],q=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(q.lastIndex=E,q.exec(v);V=q.exec(v);)if(H.push(V),V[1])return H}return sn.XMLReader=x,sn.ParseError=w,sn}var Al;function l0(){if(Al)return tr;Al=1;var s=Bn(),e=rd(),t=o0(),i=u0(),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
16
|
`)}function f(I){this.options=I||{locator:{}}}f.prototype.parseFromString=function(I,M){var N=this.options,O=new u,F=N.domBuilder||new _,j=N.errorHandler,U=N.locator,R=N.xmlns||{},G=/\/x?html?$/.test(M),v=G?t.HTML_ENTITIES:t.XML_ENTITIES;U&&F.setDocumentLocator(U),O.errorHandler=m(j,F,U),O.domBuilder=N.domBuilder||F,G&&(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"),F.doc};function m(I,M,N){if(!I){if(M instanceof _)return M;I=M}var O={},F=I instanceof Function;N=N||{};function j(U){var R=I[U];!R&&F&&(R=I.length==2?function(G){I(U,G)}:I),O[U]=R&&function(G){R("[xmldom "+U+"] "+G+x(N))}||function(){}}return j("warning"),j("error"),j("fatalError"),O}function _(){this.cdata=!1}function w(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 F=this.doc,j=F.createElementNS(I,N||M),U=O.length;T(this,j),this.currentElement=j,this.locator&&w(this.locator,j);for(var R=0;R<U;R++){var I=O.getURI(R),G=O.getValue(R),N=O.getQName(R),v=F.createAttributeNS(I,N);this.locator&&w(O.getLocator(R),v),v.value=v.nodeValue=G,j.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&&w(this.locator,N),T(this,N)},ignorableWhitespace:function(I,M,N){},characters:function(I,M,N){if(I=P.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&&w(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=P.apply(this,arguments);var O=this.doc.createComment(I);this.locator&&w(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 F=O.createDocumentType(I,M,N);this.locator&&w(this.locator,F),T(this,F),this.doc.doctype=F}},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 P(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 tr.__DOMHandler=_,tr.normalizeLineEndings=l,tr.DOMParser=f,tr}var kl;function T0(){if(kl)return er;kl=1;var s=ad();return er.DOMImplementation=s.DOMImplementation,er.XMLSerializer=s.XMLSerializer,er.DOMParser=y0().DOMParser,er}var v0=T0();const Il=s=>!!s&&typeof s=="object",it=(...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]):Il(e[i])&&Il(t[i])?e[i]=it(e[i],t[i]):e[i]=t[i]}),e),{}),od=s=>Object.keys(s).map(e=>s[e]),b0=(s,e)=>{const t=[];for(let i=s;i<e;i++)t.push(i);return t},ys=s=>s.reduce((e,t)=>e.concat(t),[]),ud=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},x0=(s,e)=>s.reduce((t,i,r)=>(i[e]&&t.push(r),t),[]),S0=(s,e)=>od(s.reduce((t,i)=>(i.forEach(r=>{t[e(r)]=r}),t),{}));var Ts={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 mr=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const r={uri:e,resolvedUri:Bn(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},E0=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}`},Pl=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),C0={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:r}=s,n=Pl(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=Pl(s.endNumber),m=(e+t)/1e3,_=i+a,x=m+u-_,P=Math.ceil(x*r/n),T=Math.floor((m-_-l)*r/n),I=Math.floor((m-_)*r/n);return{start:Math.max(0,T),end:typeof f=="number"?f:Math.min(P,I)}}},w0=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}},Lo=s=>{const{type:e,duration:t,timescale:i=1,periodDuration:r,sourceDuration:n}=s,{start:a,end:u}=C0[e](s),l=b0(a,u).map(w0(s));if(e==="static"){const f=l.length-1,m=typeof r=="number"?r:n;l[f].duration=m-t/i*f}return l},ld=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(Ts.NO_BASE_URL);const f=mr({baseUrl:e,source:t.sourceURL,range:t.range}),m=mr({baseUrl:e,source:e,indexRange:r});if(m.map=f,l){const _=Lo(s);_.length&&(m.duration=_[0].duration,m.timeline=_[0].timeline)}else i&&(m.duration=i,m.timeline=n);return m.presentationTime=a||n,m.number=u,[m]},Oo=(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),m=[],_=s.endList?"static":"dynamic",w=s.sidx.timeline;let x=w,P=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 F;typeof T=="bigint"?F=T+D.BigInt(N)-D.BigInt(1):F=T+N-1;const j=`${T}-${F}`,R=ld({baseUrl:t,timescale:l,timeline:n,periodStart:w,presentationTime:x,number:P,duration:O,sourceDuration:r,indexRange:j,type:_})[0];i&&(R.map=i),m.push(R),typeof T=="bigint"?T+=D.BigInt(N):T+=N,x+=O/l,P++}return s.segments=m,s},A0=["AUDIO","SUBTITLES"],D0=1/60,cd=s=>S0(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),k0=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Ll=s=>{let e=[];return m0(s,A0,(t,i,r,n)=>{e=e.concat(t.playlists||[])}),e},Ol=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},I0=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:l}){return l===i.timeline});const r=k0(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)<D0});if(a===-1){Ol({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--),Ol({playlist:i,mediaSequence:r.segments[a].number})})},P0=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Ll(s)),i=e.playlists.concat(Ll(e));return e.timelineStarts=cd([s.timelineStarts,e.timelineStarts]),I0({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Un=s=>s&&s.uri+"-"+E0(s.byterange),Ma=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=od(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=x0(i.segments||[],"discontinuity"),i))},Ro=(s,e)=>{const t=Un(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&Oo(s,i,s.sidx.resolvedUri),s},L0=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Ro(s[t],e);return s},O0=({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},R0=({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},N0=(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 m=Ro(O0(a,t),e);return n[f].playlists.push(m),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},M0=(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(Ro(R0(i),e)),t},{}),B0=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),{}),F0=({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},U0=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",j0=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",q0=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",$0=(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})})},Rl=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],V0=({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,m=Ma(s.filter(U0)).map(F0),_=Ma(s.filter(j0)),w=Ma(s.filter(q0)),x=s.map(F=>F.attributes.captionServices).filter(Boolean),P={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:L0(m,i)};f>=0&&(P.minimumUpdatePeriod=f*1e3),e&&(P.locations=e),t&&(P.contentSteering=t),u==="dynamic"&&(P.suggestedPresentationDelay=l),n&&n.length>0&&(P.eventStream=n);const T=P.playlists.length===0,I=_.length?N0(_,i,T):null,M=w.length?M0(w,i):null,N=m.concat(Rl(I),Rl(M)),O=N.map(({timelineStarts:F})=>F);return P.timelineStarts=cd(O),$0(N,P.timelineStarts),I&&(P.mediaGroups.AUDIO.audio=I),M&&(P.mediaGroups.SUBTITLES.subs=M),x.length&&(P.mediaGroups["CLOSED-CAPTIONS"].cc=B0(x)),r?P0({oldManifest:r,newManifest:P}):P},H0=(s,e,t)=>{const{NOW:i,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:u=0,minimumUpdatePeriod:l=0}=s,f=(i+r)/1e3,m=n+u,w=f+l-m;return Math.ceil((w*a-e)/t)},dd=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:u=1,periodStart:l}=s,f=[];let m=-1;for(let _=0;_<e.length;_++){const w=e[_],x=w.d,P=w.r||0,T=w.t||0;m<0&&(m=T),T&&T>m&&(m=T);let I;if(P<0){const O=_+1;O===e.length?t==="dynamic"&&i>0&&r.indexOf("$Number$")>0?I=H0(s,m,x):I=(n*a-m)/x:I=(e[O].t-m)/x}else I=P+1;const M=u+f.length+I;let N=u+f.length;for(;N<M;)f.push({number:N,duration:x/a,time:m,timeline:l}),m+=x,N++}return f},z0=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,G0=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}`},Nl=(s,e)=>s.replace(z0,G0(e)),W0=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Lo(s):dd(s,e),X0=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,r=mr({baseUrl:s.baseUrl,source:Nl(i.sourceURL,t),range:i.range});return W0(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const u=Nl(s.media||"",t),l=s.timescale||1,f=s.presentationTimeOffset||0,m=s.periodStart+(a.time-f)/l;return{uri:u,timeline:a.timeline,duration:a.duration,resolvedUri:Bn(s.baseUrl||"",u),map:r,number:a.number,presentationTime:m}})},K0=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,r=mr({baseUrl:t,source:i.sourceURL,range:i.range}),n=mr({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=r,n},Y0=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(Ts.SEGMENT_TIME_UNSPECIFIED);const n=i.map(l=>K0(s,l));let a;return t&&(a=Lo(s)),e&&(a=dd(s,e)),a.map((l,f)=>{if(n[f]){const m=n[f],_=s.timescale||1,w=s.presentationTimeOffset||0;return m.timeline=l.timeline,m.duration=l.duration,m.number=l.number,m.presentationTime=r+(l.time-w)/_,m}}).filter(l=>l)},Q0=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=X0,t=it(s,e.template)):e.base?(i=ld,t=it(s,e.base)):e.list&&(i=Y0,t=it(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(Q0),Ue=(s,e)=>ud(s.childNodes).filter(({tagName:t})=>t===e),br=s=>s.textContent.trim(),Z0=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,m,_,w,x]=u.slice(1);return parseFloat(l||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(m||0)*86400+parseFloat(_||0)*3600+parseFloat(w||0)*60+parseFloat(x||0)},e_=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),Ml={mediaPresentationDuration(s){return es(s)},availabilityStartTime(s){return e_(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 Z0(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}},Qe=s=>s&&s.attributes?ud(s.attributes).reduce((e,t)=>{const i=Ml[t.name]||Ml.DEFAULT;return e[t.name]=i(t.value),e},{}):{},t_={"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"},jn=(s,e)=>e.length?ys(s.map(function(t){return e.map(function(i){const r=br(i),n=Bn(t.baseUrl,r),a=it(Qe(i),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,No=s=>{const e=Ue(s,"SegmentTemplate")[0],t=Ue(s,"SegmentList")[0],i=t&&Ue(t,"SegmentURL").map(_=>it({tag:"SegmentURL"},Qe(_))),r=Ue(s,"SegmentBase")[0],n=t||e,a=n&&Ue(n,"SegmentTimeline")[0],u=t||r||e,l=u&&Ue(u,"Initialization")[0],f=e&&Qe(e);f&&l?f.initialization=l&&Qe(l):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const m={template:f,segmentTimeline:a&&Ue(a,"S").map(_=>Qe(_)),list:t&&it(Qe(t),{segmentUrls:i,initialization:Qe(l)}),base:r&&it(Qe(r),{initialization:Qe(l)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},i_=(s,e,t)=>i=>{const r=Ue(i,"BaseURL"),n=jn(e,r),a=it(s,Qe(i)),u=No(i);return n.map(l=>({segmentInfo:it(t,u),attributes:it(a,l)}))},s_=s=>s.reduce((e,t)=>{const i=Qe(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const r=t_[i.schemeIdUri];if(r){e[r]={attributes:i};const n=Ue(t,"cenc:pssh")[0];if(n){const a=br(n);e[r].pssh=a&&ed(a)}}return e},{}),r_=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})},n_=s=>ys(Ue(s.node,"EventStream").map(e=>{const t=Qe(e),i=t.schemeIdUri;return Ue(e,"Event").map(r=>{const n=Qe(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:br(r)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),a_=(s,e,t)=>i=>{const r=Qe(i),n=jn(e,Ue(i,"BaseURL")),a=Ue(i,"Role")[0],u={role:Qe(a)};let l=it(s,r,u);const f=Ue(i,"Accessibility")[0],m=r_(Qe(f));m&&(l=it(l,{captionServices:m}));const _=Ue(i,"Label")[0];if(_&&_.childNodes.length){const I=_.childNodes[0].nodeValue.trim();l=it(l,{label:I})}const w=s_(Ue(i,"ContentProtection"));Object.keys(w).length&&(l=it(l,{contentProtection:w}));const x=No(i),P=Ue(i,"Representation"),T=it(t,x);return ys(P.map(i_(l,n,T)))},o_=(s,e)=>(t,i)=>{const r=jn(e,Ue(t.node,"BaseURL")),n=it(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Ue(t.node,"AdaptationSet"),u=No(t.node);return ys(a.map(a_(n,r,u)))},u_=(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=it({serverURL:br(s[0])},Qe(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},l_=({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,c_=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=Ue(s,"Period");if(!a.length)throw new Error(Ts.INVALID_NUMBER_OF_PERIOD);const u=Ue(s,"Location"),l=Qe(s),f=jn([{baseUrl:t}],Ue(s,"BaseURL")),m=Ue(s,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=i,l.clientOffset=r,u.length&&(l.locations=u.map(br));const _=[];return a.forEach((w,x)=>{const P=Qe(w),T=_[x-1];P.start=l_({attributes:P,priorPeriodAttributes:T?T.attributes:null,mpdType:l.type}),_.push({node:w,attributes:P})}),{locations:l.locations,contentSteeringInfo:u_(m,n),representationInfo:ys(_.map(o_(l,f))),eventStream:ys(_.map(n_))}},hd=s=>{if(s==="")throw new Error(Ts.DASH_EMPTY_MANIFEST);const e=new v0.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(Ts.DASH_INVALID_XML);return i},d_=s=>{const e=Ue(s,"UTCTiming")[0];if(!e)return null;const t=Qe(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(Ts.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},h_=(s,e={})=>{const t=c_(hd(s),e),i=J0(t.representationInfo);return V0({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},f_=s=>d_(hd(s));var Ba,Bl;function p_(){if(Bl)return Ba;Bl=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 Ba={getUint64:e,MAX_UINT32:s},Ba}var Fa,Fl;function m_(){if(Fl)return Fa;Fl=1;var s=p_().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 Fa=e,Fa}var g_=m_();const __=vr(g_);var y_=fe([73,68,51]),T_=function(e,t){t===void 0&&(t=0),e=fe(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=fe(e),e.length-t<10||!Fe(e,y_,{offset:t})?t:(t+=T_(e,t),s(e,t))},Ul=function(e){return typeof e=="string"?nd(e):e},v_=function(e){return Array.isArray(e)?e.map(function(t){return Ul(t)}):[Ul(e)]},b_=function s(e,t,i){i===void 0&&(i=!1),t=v_(t),e=fe(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);Fe(u,t[0])&&(t.length===1?r.push(f):r.push.apply(r,s(f,t.slice(1),i))),n=l}return r},rn={EBML:fe([26,69,223,163]),DocType:fe([66,130]),Segment:fe([24,83,128,103]),SegmentInfo:fe([21,73,169,102]),Tracks:fe([22,84,174,107]),Track:fe([174]),TrackNumber:fe([215]),DefaultDuration:fe([35,227,131]),TrackEntry:fe([174]),TrackType:fe([131]),FlagDefault:fe([136]),CodecID:fe([134]),CodecPrivate:fe([99,162]),VideoTrack:fe([224]),AudioTrack:fe([225]),Cluster:fe([31,67,182,117]),Timestamp:fe([231]),TimestampScale:fe([42,215,177]),BlockGroup:fe([160]),BlockDuration:fe([155]),Block:fe([161]),SimpleBlock:fe([163])},so=[128,64,32,16,8,4,2,1],x_=function(e){for(var t=1,i=0;i<so.length&&!(e&so[i]);i++)t++;return t},mn=function(e,t,i,r){i===void 0&&(i=!0),r===void 0&&(r=!1);var n=x_(e[t]),a=e.subarray(t,t+n);return i&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=so[n-1]),{length:n,value:h0(a,{signed:r}),bytes:a}},jl=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?f0(e):e},S_=function(e){return Array.isArray(e)?e.map(function(t){return jl(t)}):[jl(e)]},E_=function s(e,t,i){if(i>=t.length)return t.length;var r=mn(t,i,!1);if(Fe(e.bytes,r.bytes))return i;var n=mn(t,i+r.length);return s(e,t,i+n.length+n.value+r.length)},ql=function s(e,t){t=S_(t),e=fe(e);var i=[];if(!t.length)return i;for(var r=0;r<e.length;){var n=mn(e,r,!1),a=mn(e,r+n.length),u=r+n.length+a.length;a.value===127&&(a.value=E_(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);Fe(t[0],n.bytes)&&(t.length===1?i.push(f):i=i.concat(s(f,t.slice(1))));var m=n.length+a.length+f.length;r+=m}return i},C_=fe([0,0,0,1]),w_=fe([0,0,1]),A_=fe([0,0,3]),D_=function(e){for(var t=[],i=1;i<e.length-2;)Fe(e.subarray(i,i+3),A_)&&(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},fd=function(e,t,i,r){e=fe(e),i=[].concat(i);for(var n=0,a,u=0;n<e.length&&(u<r||a);){var l=void 0;if(Fe(e.subarray(n),C_)?l=4:Fe(e.subarray(n),w_)&&(l=3),!l){n++;continue}if(u++,a)return D_(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)},k_=function(e,t,i){return fd(e,"h264",t,i)},I_=function(e,t,i){return fd(e,"h265",t,i)},ft={webm:fe([119,101,98,109]),matroska:fe([109,97,116,114,111,115,107,97]),flac:fe([102,76,97,67]),ogg:fe([79,103,103,83]),ac3:fe([11,119]),riff:fe([82,73,70,70]),avi:fe([65,86,73]),wav:fe([87,65,86,69]),"3gp":fe([102,116,121,112,51,103]),mp4:fe([102,116,121,112]),fmp4:fe([115,116,121,112]),mov:fe([102,116,121,112,113,116]),moov:fe([109,111,111,118]),moof:fe([109,111,111,102])},vs={aac:function(e){var t=nr(e);return Fe(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=nr(e);return Fe(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=ql(e,[rn.EBML,rn.DocType])[0];return Fe(t,ft.webm)},mkv:function(e){var t=ql(e,[rn.EBML,rn.DocType])[0];return Fe(t,ft.matroska)},mp4:function(e){if(vs["3gp"](e)||vs.mov(e))return!1;if(Fe(e,ft.mp4,{offset:4})||Fe(e,ft.fmp4,{offset:4})||Fe(e,ft.moof,{offset:4})||Fe(e,ft.moov,{offset:4}))return!0},mov:function(e){return Fe(e,ft.mov,{offset:4})},"3gp":function(e){return Fe(e,ft["3gp"],{offset:4})},ac3:function(e){var t=nr(e);return Fe(e,ft.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 Fe(e,ft.flac,{offset:t})},ogg:function(e){return Fe(e,ft.ogg)},avi:function(e){return Fe(e,ft.riff)&&Fe(e,ft.avi,{offset:8})},wav:function(e){return Fe(e,ft.riff)&&Fe(e,ft.wav,{offset:8})},h264:function(e){return k_(e,7,3).length},h265:function(e){return I_(e,[32,33],3).length}},ro=Object.keys(vs).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);ro.forEach(function(s){var e=vs[s];vs[s]=function(t){return e(fe(t))}});var P_=vs,Mo=function(e){e=fe(e);for(var t=0;t<ro.length;t++){var i=ro[t];if(P_[i](e))return i}return""},L_=function(e){return b_(e,["moof"]).length>0},Ua,$l;function O_(){if($l)return Ua;$l=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,m){return i(m?l:l-f)},Ua={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:r,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:u},Ua}var ji=O_();var no="8.23.4";const oi={},wi=function(s,e){return oi[s]=oi[s]||[],e&&(oi[s]=oi[s].concat(e)),oi[s]},R_=function(s,e){wi(s,e)},pd=function(s,e){const t=wi(s).indexOf(e);return t<=-1?!1:(oi[s]=oi[s].slice(),oi[s].splice(t,1),!0)},N_=function(s,e){wi(s,[].concat(e).map(t=>{const i=(...r)=>(pd(s,i),t(...r));return i}))},gn={prefixed:!0},cn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Vl=cn[0];let ar;for(let s=0;s<cn.length;s++)if(cn[s][1]in ne){ar=cn[s];break}if(ar){for(let s=0;s<ar.length;s++)gn[Vl[s]]=ar[s];gn.prefixed=ar[0]!==Vl[0]}let gt=[];const M_=(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+":"),gt){gt.push([].concat(n));const m=gt.length-1e3;gt.splice(0,m>0?m: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 ao(s,e=":",t=""){let i="info",r;function n(...a){r("log",i,a)}return r=M_(s,n,t),n.createLogger=(a,u,l)=>{const f=u!==void 0?u:e,m=l!==void 0?l:t,_=`${s} ${f} ${a}`;return ao(_,f,m)},n.createNewLogger=(a,u,l)=>ao(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=()=>gt?[].concat(gt):[],n.history.filter=a=>(gt||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),n.history.clear=()=>{gt&&(gt.length=0)},n.history.disable=()=>{gt!==null&&(gt.length=0,gt=null)},n.history.enable=()=>{gt===null&&(gt=[])},n.error=(...a)=>r("error",i,a),n.warn=(...a)=>r("warn",i,a),n.debug=(...a)=>r("debug",i,a),n}const be=ao("VIDEOJS"),md=be.createLogger,B_=Object.prototype.toString,gd=function(s){return ei(s)?Object.keys(s):[]};function us(s,e){gd(s).forEach(t=>e(s[t],t))}function _d(s,e,t=0){return gd(s).reduce((i,r)=>e(i,s[r],r),t)}function ei(s){return!!s&&typeof s=="object"}function bs(s){return ei(s)&&B_.call(s)==="[object Object]"&&s.constructor===Object}function Ie(...s){const e={};return s.forEach(t=>{t&&us(t,(i,r)=>{if(!bs(i)){e[r]=i;return}bs(e[r])||(e[r]={}),e[r]=Ie(e[r],i)})}),e}function yd(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function qn(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 F_=Object.freeze({__proto__:null,each:us,reduce:_d,isObject:ei,isPlain:bs,merge:Ie,values:yd,defineLazyProperty:qn});let Bo=!1,Td=null,jt=!1,vd,bd=!1,ls=!1,cs=!1,ti=!1,Fo=null,$n=null;const U_=!!(D.cast&&D.cast.framework&&D.cast.framework.CastReceiverContext);let xd=null,_n=!1,Vn=!1,yn=!1,Hn=!1,Tn=!1,vn=!1,bn=!1;const gr=!!(ws()&&("ontouchstart"in D||D.navigator.maxTouchPoints||D.DocumentTouch&&D.document instanceof D.DocumentTouch)),vi=D.navigator&&D.navigator.userAgentData;vi&&vi.platform&&vi.brands&&(jt=vi.platform==="Android",ls=!!vi.brands.find(s=>s.brand==="Microsoft Edge"),cs=!!vi.brands.find(s=>s.brand==="Chromium"),ti=!ls&&cs,Fo=$n=(vi.brands.find(s=>s.brand==="Chromium")||{}).version||null,Vn=vi.platform==="Windows");if(!cs){const s=D.navigator&&D.navigator.userAgent||"";Bo=/iPod/i.test(s),Td=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),jt=/Android/i.test(s),vd=(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})(),bd=/Firefox/i.test(s),ls=/Edg/i.test(s),cs=/Chrome/i.test(s)||/CriOS/i.test(s),ti=!ls&&cs,Fo=$n=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),xd=(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})(),Tn=/Tizen/i.test(s),vn=/Web0S/i.test(s),bn=Tn||vn,_n=/Safari/i.test(s)&&!ti&&!jt&&!ls&&!bn,Vn=/Windows/i.test(s),yn=/iPad/i.test(s)||_n&&gr&&!/iPhone/i.test(s),Hn=/iPhone/i.test(s)&&!yn}const ot=Hn||yn||Bo,zn=(_n||ot)&&!ti;var Sd=Object.freeze({__proto__:null,get IS_IPOD(){return Bo},get IOS_VERSION(){return Td},get IS_ANDROID(){return jt},get ANDROID_VERSION(){return vd},get IS_FIREFOX(){return bd},get IS_EDGE(){return ls},get IS_CHROMIUM(){return cs},get IS_CHROME(){return ti},get CHROMIUM_VERSION(){return Fo},get CHROME_VERSION(){return $n},IS_CHROMECAST_RECEIVER:U_,get IE_VERSION(){return xd},get IS_SAFARI(){return _n},get IS_WINDOWS(){return Vn},get IS_IPAD(){return yn},get IS_IPHONE(){return Hn},get IS_TIZEN(){return Tn},get IS_WEBOS(){return vn},get IS_SMART_TV(){return bn},TOUCH_ENABLED:gr,IS_IOS:ot,IS_ANY_SAFARI:zn});function Hl(s){return typeof s=="string"&&!!s.trim()}function j_(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ws(){return ne===D.document}function As(s){return ei(s)&&s.nodeType===1}function Ed(){try{return D.parent!==D.self}catch{return!0}}function Cd(s){return function(e,t){if(!Hl(e))return ne[s](null);Hl(t)&&(t=ne.querySelector(t));const i=As(t)?t:ne;return i[s]&&i[s](e)}}function me(s="div",e={},t={},i){const r=ne.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Di(r,a):(r[n]!==a||n==="tabIndex")&&(r[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){r.setAttribute(n,t[n])}),i&&Uo(r,i),r}function Di(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function oo(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function lr(s,e){return j_(e),s.classList.contains(e)}function Vi(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function Gn(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(be.warn("removeClass was called with an element that doesn't exist"),null)}function wd(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 Ad(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 Si(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 Dd(s,e){return s.getAttribute(e)}function xs(s,e,t){s.setAttribute(e,t)}function Wn(s,e){s.removeAttribute(e)}function kd(){ne.body.focus(),ne.onselectstart=function(){return!1}}function Id(){ne.onselectstart=function(){return!0}}function Ss(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(Es(s,"height"))),t.width||(t.width=parseFloat(Es(s,"width"))),t}}function _r(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!==ne[gn.fullscreenElement];)i+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:i,top:r,width:e,height:t}}function Xn(s,e){const t={x:0,y:0};if(ot){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=Es(m,"transform");if(/^matrix/.test(_)){const w=_.slice(7,-1).split(/,\s/).map(Number);t.x+=w[4],t.y+=w[5]}else if(/^matrix3d/.test(_)){const w=_.slice(9,-1).split(/,\s/).map(Number);t.x+=w[12],t.y+=w[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&D.WebKitCSSMatrix){const w=D.getComputedStyle(m.assignedSlot.parentElement).transform,x=new D.WebKitCSSMatrix(w);t.x+=x.m41,t.y+=x.m42}m=m.parentNode||m.host}}const i={},r=_r(e.target),n=_r(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,ot&&(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 Pd(s){return ei(s)&&s.nodeType===3}function Kn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Ld(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),As(e)||Pd(e))return e;if(typeof e=="string"&&/\S/.test(e))return ne.createTextNode(e)}).filter(e=>e)}function Uo(s,e){return Ld(e).forEach(t=>s.appendChild(t)),s}function Od(s,e){return Uo(Kn(s),e)}function yr(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 Ai=Cd("querySelector"),Rd=Cd("querySelectorAll");function Es(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 Nd(s){[...ne.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),i=ne.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=ne.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var Md=Object.freeze({__proto__:null,isReal:ws,isEl:As,isInFrame:Ed,createEl:me,textContent:Di,prependTo:oo,hasClass:lr,addClass:Vi,removeClass:Gn,toggleClass:wd,setAttributes:Ad,getAttributes:Si,getAttribute:Dd,setAttribute:xs,removeAttribute:Wn,blockTextSelection:kd,unblockTextSelection:Id,getBoundingClientRect:Ss,findPosition:_r,getPointerPosition:Xn,isTextNode:Pd,emptyEl:Kn,normalizeContent:Ld,appendContent:Uo,insertContent:Od,isSingleLeftClick:yr,$:Ai,$$:Rd,computedStyle:Es,copyStyleSheetsToWindow:Nd});let Bd=!1,uo;const q_=function(){if(uo.options.autoSetup===!1)return;const s=Array.prototype.slice.call(ne.getElementsByTagName("video")),e=Array.prototype.slice.call(ne.getElementsByTagName("audio")),t=Array.prototype.slice.call(ne.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&&uo(a);else{lo(1);break}}else Bd||lo(1)};function lo(s,e){ws()&&(e&&(uo=e),D.setTimeout(q_,s))}function co(){Bd=!0,D.removeEventListener("load",co)}ws()&&(ne.readyState==="complete"?co():D.addEventListener("load",co));const Fd=function(s){const e=ne.createElement("style");return e.className=s,e},Ud=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var mt=new WeakMap;const $_=3;let V_=$_;function Lt(){return V_++}function zl(s,e){if(!mt.has(s))return;const t=mt.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&&mt.delete(s)}function jo(s,e,t,i){t.forEach(function(r){s(e,r,i)})}function Yn(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||ne),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=ne.documentElement,a=ne.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 nn;const H_=function(){if(typeof nn!="boolean"){nn=!1;try{const s=Object.defineProperty({},"passive",{get(){nn=!0}});D.addEventListener("test",null,s),D.removeEventListener("test",null,s)}catch{}}return nn},z_=["touchstart","touchmove"];function Et(s,e,t){if(Array.isArray(e))return jo(Et,s,e,t);mt.has(s)||mt.set(s,{});const i=mt.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=Yn(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(m){be.error(m)}}}),i.handlers[e].length===1)if(s.addEventListener){let r=!1;H_()&&z_.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,i.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function ut(s,e,t){if(!mt.has(s))return;const i=mt.get(s);if(!i.handlers)return;if(Array.isArray(e))return jo(ut,s,e,t);const r=function(a,u){i.handlers[u]=[],zl(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);zl(s,e)}}function Ds(s,e,t){const i=mt.has(s)?mt.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Yn(e),i.dispatcher&&i.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)Ds.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){mt.has(e.target)||mt.set(e.target,{});const n=mt.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 Qn(s,e,t){if(Array.isArray(e))return jo(Qn,s,e,t);const i=function(){ut(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Lt(),Et(s,e,i)}function qo(s,e,t){const i=function(){ut(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Lt(),Et(s,e,i)}var G_=Object.freeze({__proto__:null,fixEvent:Yn,on:Et,off:ut,trigger:Ds,one:Qn,any:qo});const Ot=30,Re=function(s,e,t){e.guid||(e.guid=Lt());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},ii=function(s,e){let t=D.performance.now();return function(...r){const n=D.performance.now();n-t>=e&&(s(...r),t=n)}},jd=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 W_=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ot,bind_:Re,throttle:ii,debounce:jd});let ir;class Ct{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Et(this,e,t),this.addEventListener=i}off(e,t){ut(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Qn(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},qo(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Yn(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ds(this,e)}queueTrigger(e){ir||(ir=new Map);const t=e.type||e;let i=ir.get(this);i||(i=new Map,ir.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,ir.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 Jn=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,ci=s=>s instanceof Ct||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),X_=(s,e)=>{ci(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},ho=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,xn=(s,e,t)=>{if(!s||!s.nodeName&&!ci(s))throw new Error(`Invalid target for ${Jn(e)}#${t}; must be a DOM node or evented object.`)},qd=(s,e,t)=>{if(!ho(s))throw new Error(`Invalid event type for ${Jn(e)}#${t}; must be a non-empty string or array.`)},$d=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Jn(e)}#${t}; must be a function.`)},ja=(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]),xn(r,s,t),qd(n,s,t),$d(a,s,t),a=Re(s,a),{isTargetingSelf:i,target:r,type:n,listener:a}},Bi=(s,e,t,i)=>{xn(s,s,e),s.nodeName?G_[e](s,t,i):s[e](t,i)},K_={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=ja(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}=ja(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}=ja(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||ho(s))ut(this.eventBusEl_,s,e);else{const i=s,r=e;xn(i,this,"off"),qd(r,this,"off"),$d(t,this,"off"),t=Re(this,t),this.off("dispose",t),i.nodeName?(ut(i,r,t),ut(i,"dispose",t)):ci(i)&&(i.off(r,t),i.off("dispose",t))}},trigger(s,e){xn(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!ho(t))throw new Error(`Invalid event type for ${Jn(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ds(this.eventBusEl_,s,e)}};function $o(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_=me("span",{className:"vjs-event-bus"});return Object.assign(s,K_),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&mt.has(i)&&mt.delete(i)}),D.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const Y_={state:{},setState(s){typeof s=="function"&&(s=s());let e;return us(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&ci(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Vd(s,e){return Object.assign(s,Y_),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&ci(s)&&s.on("statechanged",s.handleStateChanged),s}const cr=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},ze=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Hd=function(s,e){return ze(s)===ze(e)};var Q_=Object.freeze({__proto__:null,toLowerCase:cr,toTitleCase:ze,titleCaseEquals:Hd});class Y{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ie({},this.options_),t=this.options_=Ie(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&&($o(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Vd(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_=Ie(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return me(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(m,_){const w=t[_-1];let x=w;return typeof w>"u"&&(x=m),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=me("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=ne.createElementNS(i,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=ne.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=ze(e);const a=t.componentClass||n;t.name=n;const u=Y.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&&ze(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_:As(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_[ze(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=Y.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=Y.getComponent(a.opts.componentClass||ze(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 Ai(e,t||this.contentEl())}$$(e,t){return Rd(e,t||this.contentEl())}hasClass(e){return lr(this.el_,e)}addClass(...e){Vi(this.el_,...e)}removeClass(...e){Gn(this.el_,...e)}toggleClass(e,t){wd(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 Dd(this.el_,e)}setAttribute(e,t){xs(this.el_,e,t)}removeAttribute(e){Wn(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"+ze(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Es(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${ze(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=Re(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=Re(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=Re(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=Re(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=Re(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>(ne.documentElement.clientWidth||D.innerWidth)||a.y<0||a.y>(ne.documentElement.clientHeight||D.innerHeight))return!1;let u=ne.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=Y.getComponent("Tech"),r=i&&i.isTech(t),n=Y===t||Y.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=ze(e),Y.components_||(Y.components_={});const a=Y.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 Y.components_[e]=t,Y.components_[cr(e)]=t,t}static getComponent(e){if(!(!e||!Y.components_))return Y.components_[e]}}Y.registerComponent("Component",Y);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 Gl(s,e,t,i){return J_(s,i,t.length-1),t[i][e]}function qa(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:Gl.bind(null,"start",0,s),end:Gl.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)?qa(s):s===void 0||e===void 0?qa():qa([[s,e]])}const zd=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 Vo=zd;function Gd(s){Vo=s}function Wd(){Vo=zd}function Wi(s,e=s){return Vo(s,e)}var Z_=Object.freeze({__proto__:null,createTimeRanges:Ut,createTimeRange:Ut,setFormatTime:Gd,resetFormatTime:Wd,formatTime:Wi});function Xd(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:ei(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 Yt(s){dr(s)&&s.then(null,e=>{})}const fo=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}})})},ey=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=fo(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(fo))},ty=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 po={textTracksToJson:ey,jsonToTextTracks:ty,trackToJson:fo};const $a="vjs-modal-dialog";class ks extends Y{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_=me("div",{className:`${$a}-content`},{role:"document"}),this.descEl_=me("p",{className:`${$a}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Di(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`${$a} 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(),Od(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"),Kn(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=ne.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}ne.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"))}}ks.prototype.options_={pauseOnOpen:!0,temporary:!0};Y.registerComponent("ModalDialog",ks);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})},ci(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 Va=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 Kd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Va(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Va(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Va(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Ha=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 Yd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Ha(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&&Ha(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Ha(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 Ho 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 iy{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 Sn{constructor(e){Sn.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 sy={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},ry={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},ny={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Wl={disabled:"disabled",hidden:"hidden",showing:"showing"};class zo 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 Go=function(s){return new URL(s,ne.baseURI)},Qd=function(s){return new URL(s,ne.baseURI).href},Wo=function(s){if(typeof s=="string"){const t=s.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},Zn=function(s,e=D.location){return Go(s).origin!==e.origin};var ay=Object.freeze({__proto__:null,parseUrl:Go,getAbsoluteURL:Qd,getFileExtension:Wo,isCrossOrigin:Zn});const Xl=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=>be.error(r)),D.console&&D.console.groupEnd&&D.console.groupEnd()),t.flush()},Kl=function(s,e){const t={uri:s},i=Zn(s);i&&(t.cors=i);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Zc(t,Re(this,function(n,a,u){if(n)return be.error(n,a);e.loaded_=!0,typeof D.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){be.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Xl(u,e)}):Xl(u,e)}))};class xr extends zo{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ie(e,{kind:ny[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=Wl[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 Sn(this.cues_),a=new Sn(this.activeCues_);let u=!1;this.timeupdateHandler=Re(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){Wl[f]&&i!==f&&(i=f,!this.preload_&&i!=="disabled"&&this.cues.length===0&&Kl(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(),m=[];for(let _=0,w=this.cues.length;_<w;_++){const x=this.cues[_];x.startTime<=f&&x.endTime>=f&&m.push(x)}if(u=!1,m.length!==this.activeCues_.length)u=!0;else for(let _=0;_<m.length;_++)this.activeCues_.indexOf(m[_])===-1&&(u=!0);return this.activeCues_=m,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")&&Kl(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 po.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}}}}xr.prototype.allowedEvents_={cuechange:"cuechange"};class Jd extends zo{constructor(e={}){const t=Ie(e,{kind:ry[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 Zd extends zo{constructor(e={}){const t=Ie(e,{kind:sy[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 di extends Ct{constructor(e={}){super();let t;const i=new xr(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=di.NONE,i.addEventListener("loadeddata",()=>{t=di.LOADED,this.trigger({type:"load",target:this})})}}di.prototype.allowedEvents_={load:"load"};di.NONE=0;di.LOADING=1;di.LOADED=2;di.ERROR=3;const Pt={audio:{ListClass:Kd,TrackClass:Jd,capitalName:"Audio"},video:{ListClass:Yd,TrackClass:Zd,capitalName:"Video"},text:{ListClass:Ho,TrackClass:xr,capitalName:"Text"}};Object.keys(Pt).forEach(function(s){Pt[s].getterName=`${s}Tracks`,Pt[s].privateName=`${s}Tracks_`});const Cs={remoteText:{ListClass:Ho,TrackClass:xr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:iy,TrackClass:di,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},pt=Object.assign({},Pt,Cs);Cs.names=Object.keys(Cs);Pt.names=Object.keys(Pt);pt.names=[].concat(Cs.names).concat(Pt.names);function oy(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 pt.text.TrackClass(r);return n.addTrack(a),a}class ye extends Y{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}),pt.names.forEach(i=>{const r=pt[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 pt.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(Re(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 Xd(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(ne.body.contains(this.el())){if(!this.options_["vtt.js"]&&bs(Tl)&&Object.keys(Tl).length>0){this.trigger("vttjsloaded");return}const e=ne.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 oy(this,e,t,i)}createRemoteTextTrack(e){const t=Ie(e,{tech:this});return new Cs.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=ze(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=ze(e),D&&D.videojs&&D.videojs[e])return be.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),D.videojs[e]}}}pt.names.forEach(function(s){const e=pt[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:be.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)}};Y.registerComponent("Tech",ye);ye.registerTech("Tech",ye);ye.defaultTechOrder_=[];const Hi={},En={},Cn={};function uy(s,e){Hi[s]=Hi[s]||[],Hi[s].push(e)}function ly(s,e,t){s.setTimeout(()=>Fi(e,Hi[e.type],t,s),1)}function cy(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function dy(s,e,t){return s.reduceRight(Xo(t),e[t]())}function hy(s,e,t,i){return e[t](s.reduce(Xo(t),i))}function Yl(s,e,t,i=null){const r="call"+ze(t),n=s.reduce(Xo(r),i),a=n===Cn,u=a?null:e[t](n);return my(s,t,u,a),u}const fy={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},py={setCurrentTime:1,setMuted:1,setVolume:1},Ql={play:1,pause:1};function Xo(s){return(e,t)=>e===Cn?Cn:t[s]?t[s](e):e}function my(s,e,t,i){for(let r=s.length-1;r>=0;r--){const n=s[r];n[e]&&n[e](i,t)}}function gy(s){En.hasOwnProperty(s.id())&&delete En[s.id()]}function _y(s,e){const t=En[s.id()];let i=null;if(t==null)return i=e(s),En[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=_y(i,a);if(!l.setSource)return r.push(l),Fi(s,u,t,i,r,n);l.setSource(Object.assign({},s),function(f,m){if(f)return Fi(s,u,t,i,r,n);r.push(l),Fi(m,s.type===m.type?u:Hi[m.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 yy={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"},wn=function(s=""){const e=Wo(s);return yy[e.toLowerCase()]||""},Ty=(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 wn(e)},eh=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=eh(t),Array.isArray(t)?e=e.concat(t):ei(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Jl({src:s})]:ei(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[Jl(s)]:s=[];return s};function Jl(s){if(!s.type){const e=wn(s.src);e&&(s.type=e)}return s}var vy=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
17
|
+
@`+(I.systemId||"")+"#[line:"+I.lineNumber+",col:"+I.columnNumber+"]"}function P(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 tr.__DOMHandler=_,tr.normalizeLineEndings=l,tr.DOMParser=f,tr}var Dl;function c0(){if(Dl)return er;Dl=1;var s=rd();return er.DOMImplementation=s.DOMImplementation,er.XMLSerializer=s.XMLSerializer,er.DOMParser=l0().DOMParser,er}var d0=c0();const kl=s=>!!s&&typeof s=="object",it=(...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]=it(e[i],t[i]):e[i]=t[i]}),e),{}),nd=s=>Object.keys(s).map(e=>s[e]),h0=(s,e)=>{const t=[];for(let i=s;i<e;i++)t.push(i);return t},ys=s=>s.reduce((e,t)=>e.concat(t),[]),ad=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},f0=(s,e)=>s.reduce((t,i,r)=>(i[e]&&t.push(r),t),[]),p0=(s,e)=>nd(s.reduce((t,i)=>(i.forEach(r=>{t[e(r)]=r}),t),{}));var Ts={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 mr=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const r={uri:e,resolvedUri:Mn(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},m0=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),g0={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),m=(e+t)/1e3,_=i+a,x=m+u-_,P=Math.ceil(x*r/n),T=Math.floor((m-_-l)*r/n),I=Math.floor((m-_)*r/n);return{start:Math.max(0,T),end:typeof f=="number"?f:Math.min(P,I)}}},_0=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}=g0[e](s),l=h0(a,u).map(_0(s));if(e==="static"){const f=l.length-1,m=typeof r=="number"?r:n;l[f].duration=m-t/i*f}return l},od=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(Ts.NO_BASE_URL);const f=mr({baseUrl:e,source:t.sourceURL,range:t.range}),m=mr({baseUrl:e,source:e,indexRange:r});if(m.map=f,l){const _=Po(s);_.length&&(m.duration=_[0].duration,m.timeline=_[0].timeline)}else i&&(m.duration=i,m.timeline=n);return m.presentationTime=a||n,m.number=u,[m]},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),m=[],_=s.endList?"static":"dynamic",w=s.sidx.timeline;let x=w,P=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 F;typeof T=="bigint"?F=T+D.BigInt(N)-D.BigInt(1):F=T+N-1;const j=`${T}-${F}`,R=od({baseUrl:t,timescale:l,timeline:n,periodStart:w,presentationTime:x,number:P,duration:O,sourceDuration:r,indexRange:j,type:_})[0];i&&(R.map=i),m.push(R),typeof T=="bigint"?T+=D.BigInt(N):T+=N,x+=O/l,P++}return s.segments=m,s},y0=["AUDIO","SUBTITLES"],T0=1/60,ud=s=>p0(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),v0=(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 a0(s,y0,(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})},b0=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:l}){return l===i.timeline});const r=v0(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)<T0});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})})},x0=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Pl(s)),i=e.playlists.concat(Pl(e));return e.timelineStarts=ud([s.timelineStarts,e.timelineStarts]),b0({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Fn=s=>s&&s.uri+"-"+m0(s.byterange),Na=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=nd(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=f0(i.segments||[],"discontinuity"),i))},Oo=(s,e)=>{const t=Fn(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&Lo(s,i,s.sidx.resolvedUri),s},S0=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Oo(s[t],e);return s},E0=({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},C0=({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},w0=(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 m=Oo(E0(a,t),e);return n[f].playlists.push(m),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},A0=(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(C0(i),e)),t},{}),D0=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),{}),k0=({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},I0=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",P0=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",L0=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",O0=(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)},[]):[],R0=({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,m=Na(s.filter(I0)).map(k0),_=Na(s.filter(P0)),w=Na(s.filter(L0)),x=s.map(F=>F.attributes.captionServices).filter(Boolean),P={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:S0(m,i)};f>=0&&(P.minimumUpdatePeriod=f*1e3),e&&(P.locations=e),t&&(P.contentSteering=t),u==="dynamic"&&(P.suggestedPresentationDelay=l),n&&n.length>0&&(P.eventStream=n);const T=P.playlists.length===0,I=_.length?w0(_,i,T):null,M=w.length?A0(w,i):null,N=m.concat(Ol(I),Ol(M)),O=N.map(({timelineStarts:F})=>F);return P.timelineStarts=ud(O),O0(N,P.timelineStarts),I&&(P.mediaGroups.AUDIO.audio=I),M&&(P.mediaGroups.SUBTITLES.subs=M),x.length&&(P.mediaGroups["CLOSED-CAPTIONS"].cc=D0(x)),r?x0({oldManifest:r,newManifest:P}):P},N0=(s,e,t)=>{const{NOW:i,clientOffset:r,availabilityStartTime:n,timescale:a=1,periodStart:u=0,minimumUpdatePeriod:l=0}=s,f=(i+r)/1e3,m=n+u,w=f+l-m;return Math.ceil((w*a-e)/t)},ld=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:r="",sourceDuration:n,timescale:a=1,startNumber:u=1,periodStart:l}=s,f=[];let m=-1;for(let _=0;_<e.length;_++){const w=e[_],x=w.d,P=w.r||0,T=w.t||0;m<0&&(m=T),T&&T>m&&(m=T);let I;if(P<0){const O=_+1;O===e.length?t==="dynamic"&&i>0&&r.indexOf("$Number$")>0?I=N0(s,m,x):I=(n*a-m)/x:I=(e[O].t-m)/x}else I=P+1;const M=u+f.length+I;let N=u+f.length;for(;N<M;)f.push({number:N,duration:x/a,time:m,timeline:l}),m+=x,N++}return f},M0=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,B0=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(M0,B0(e)),F0=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Po(s):ld(s,e),U0=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,r=mr({baseUrl:s.baseUrl,source:Rl(i.sourceURL,t),range:i.range});return F0(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,m=s.periodStart+(a.time-f)/l;return{uri:u,timeline:a.timeline,duration:a.duration,resolvedUri:Mn(s.baseUrl||"",u),map:r,number:a.number,presentationTime:m}})},j0=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,r=mr({baseUrl:t,source:i.sourceURL,range:i.range}),n=mr({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=r,n},q0=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(Ts.SEGMENT_TIME_UNSPECIFIED);const n=i.map(l=>j0(s,l));let a;return t&&(a=Po(s)),e&&(a=ld(s,e)),a.map((l,f)=>{if(n[f]){const m=n[f],_=s.timescale||1,w=s.presentationTimeOffset||0;return m.timeline=l.timeline,m.duration=l.duration,m.number=l.number,m.presentationTime=r+(l.time-w)/_,m}}).filter(l=>l)},$0=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=U0,t=it(s,e.template)):e.base?(i=od,t=it(s,e.base)):e.list&&(i=q0,t=it(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},V0=s=>s.map($0),Ue=(s,e)=>ad(s.childNodes).filter(({tagName:t})=>t===e),br=s=>s.textContent.trim(),H0=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,m,_,w,x]=u.slice(1);return parseFloat(l||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(m||0)*86400+parseFloat(_||0)*3600+parseFloat(w||0)*60+parseFloat(x||0)},z0=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 z0(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 H0(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}},Qe=s=>s&&s.attributes?ad(s.attributes).reduce((e,t)=>{const i=Nl[t.name]||Nl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},G0={"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"},Un=(s,e)=>e.length?ys(s.map(function(t){return e.map(function(i){const r=br(i),n=Mn(t.baseUrl,r),a=it(Qe(i),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,Ro=s=>{const e=Ue(s,"SegmentTemplate")[0],t=Ue(s,"SegmentList")[0],i=t&&Ue(t,"SegmentURL").map(_=>it({tag:"SegmentURL"},Qe(_))),r=Ue(s,"SegmentBase")[0],n=t||e,a=n&&Ue(n,"SegmentTimeline")[0],u=t||r||e,l=u&&Ue(u,"Initialization")[0],f=e&&Qe(e);f&&l?f.initialization=l&&Qe(l):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const m={template:f,segmentTimeline:a&&Ue(a,"S").map(_=>Qe(_)),list:t&&it(Qe(t),{segmentUrls:i,initialization:Qe(l)}),base:r&&it(Qe(r),{initialization:Qe(l)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},W0=(s,e,t)=>i=>{const r=Ue(i,"BaseURL"),n=Un(e,r),a=it(s,Qe(i)),u=Ro(i);return n.map(l=>({segmentInfo:it(t,u),attributes:it(a,l)}))},X0=s=>s.reduce((e,t)=>{const i=Qe(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const r=G0[i.schemeIdUri];if(r){e[r]={attributes:i};const n=Ue(t,"cenc:pssh")[0];if(n){const a=br(n);e[r].pssh=a&&Jc(a)}}return e},{}),K0=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})},Y0=s=>ys(Ue(s.node,"EventStream").map(e=>{const t=Qe(e),i=t.schemeIdUri;return Ue(e,"Event").map(r=>{const n=Qe(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:br(r)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),Q0=(s,e,t)=>i=>{const r=Qe(i),n=Un(e,Ue(i,"BaseURL")),a=Ue(i,"Role")[0],u={role:Qe(a)};let l=it(s,r,u);const f=Ue(i,"Accessibility")[0],m=K0(Qe(f));m&&(l=it(l,{captionServices:m}));const _=Ue(i,"Label")[0];if(_&&_.childNodes.length){const I=_.childNodes[0].nodeValue.trim();l=it(l,{label:I})}const w=X0(Ue(i,"ContentProtection"));Object.keys(w).length&&(l=it(l,{contentProtection:w}));const x=Ro(i),P=Ue(i,"Representation"),T=it(t,x);return ys(P.map(W0(l,n,T)))},J0=(s,e)=>(t,i)=>{const r=Un(e,Ue(t.node,"BaseURL")),n=it(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Ue(t.node,"AdaptationSet"),u=Ro(t.node);return ys(a.map(Q0(n,r,u)))},Z0=(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=it({serverURL:br(s[0])},Qe(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},e_=({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,t_=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=Ue(s,"Period");if(!a.length)throw new Error(Ts.INVALID_NUMBER_OF_PERIOD);const u=Ue(s,"Location"),l=Qe(s),f=Un([{baseUrl:t}],Ue(s,"BaseURL")),m=Ue(s,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=i,l.clientOffset=r,u.length&&(l.locations=u.map(br));const _=[];return a.forEach((w,x)=>{const P=Qe(w),T=_[x-1];P.start=e_({attributes:P,priorPeriodAttributes:T?T.attributes:null,mpdType:l.type}),_.push({node:w,attributes:P})}),{locations:l.locations,contentSteeringInfo:Z0(m,n),representationInfo:ys(_.map(J0(l,f))),eventStream:ys(_.map(Y0))}},cd=s=>{if(s==="")throw new Error(Ts.DASH_EMPTY_MANIFEST);const e=new d0.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(Ts.DASH_INVALID_XML);return i},i_=s=>{const e=Ue(s,"UTCTiming")[0];if(!e)return null;const t=Qe(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(Ts.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},s_=(s,e={})=>{const t=t_(cd(s),e),i=V0(t.representationInfo);return R0({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},r_=s=>i_(cd(s));var Ma,Ml;function n_(){if(Ml)return Ma;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 Ma={getUint64:e,MAX_UINT32:s},Ma}var Ba,Bl;function a_(){if(Bl)return Ba;Bl=1;var s=n_().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 Ba=e,Ba}var o_=a_();const u_=vr(o_);var l_=fe([73,68,51]),c_=function(e,t){t===void 0&&(t=0),e=fe(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=fe(e),e.length-t<10||!Fe(e,l_,{offset:t})?t:(t+=c_(e,t),s(e,t))},Fl=function(e){return typeof e=="string"?sd(e):e},d_=function(e){return Array.isArray(e)?e.map(function(t){return Fl(t)}):[Fl(e)]},h_=function s(e,t,i){i===void 0&&(i=!1),t=d_(t),e=fe(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);Fe(u,t[0])&&(t.length===1?r.push(f):r.push.apply(r,s(f,t.slice(1),i))),n=l}return r},rn={EBML:fe([26,69,223,163]),DocType:fe([66,130]),Segment:fe([24,83,128,103]),SegmentInfo:fe([21,73,169,102]),Tracks:fe([22,84,174,107]),Track:fe([174]),TrackNumber:fe([215]),DefaultDuration:fe([35,227,131]),TrackEntry:fe([174]),TrackType:fe([131]),FlagDefault:fe([136]),CodecID:fe([134]),CodecPrivate:fe([99,162]),VideoTrack:fe([224]),AudioTrack:fe([225]),Cluster:fe([31,67,182,117]),Timestamp:fe([231]),TimestampScale:fe([42,215,177]),BlockGroup:fe([160]),BlockDuration:fe([155]),Block:fe([161]),SimpleBlock:fe([163])},io=[128,64,32,16,8,4,2,1],f_=function(e){for(var t=1,i=0;i<io.length&&!(e&io[i]);i++)t++;return t},mn=function(e,t,i,r){i===void 0&&(i=!0),r===void 0&&(r=!1);var n=f_(e[t]),a=e.subarray(t,t+n);return i&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=io[n-1]),{length:n,value:s0(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"?r0(e):e},p_=function(e){return Array.isArray(e)?e.map(function(t){return Ul(t)}):[Ul(e)]},m_=function s(e,t,i){if(i>=t.length)return t.length;var r=mn(t,i,!1);if(Fe(e.bytes,r.bytes))return i;var n=mn(t,i+r.length);return s(e,t,i+n.length+n.value+r.length)},jl=function s(e,t){t=p_(t),e=fe(e);var i=[];if(!t.length)return i;for(var r=0;r<e.length;){var n=mn(e,r,!1),a=mn(e,r+n.length),u=r+n.length+a.length;a.value===127&&(a.value=m_(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);Fe(t[0],n.bytes)&&(t.length===1?i.push(f):i=i.concat(s(f,t.slice(1))));var m=n.length+a.length+f.length;r+=m}return i},g_=fe([0,0,0,1]),__=fe([0,0,1]),y_=fe([0,0,3]),T_=function(e){for(var t=[],i=1;i<e.length-2;)Fe(e.subarray(i,i+3),y_)&&(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},dd=function(e,t,i,r){e=fe(e),i=[].concat(i);for(var n=0,a,u=0;n<e.length&&(u<r||a);){var l=void 0;if(Fe(e.subarray(n),g_)?l=4:Fe(e.subarray(n),__)&&(l=3),!l){n++;continue}if(u++,a)return T_(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)},v_=function(e,t,i){return dd(e,"h264",t,i)},b_=function(e,t,i){return dd(e,"h265",t,i)},ft={webm:fe([119,101,98,109]),matroska:fe([109,97,116,114,111,115,107,97]),flac:fe([102,76,97,67]),ogg:fe([79,103,103,83]),ac3:fe([11,119]),riff:fe([82,73,70,70]),avi:fe([65,86,73]),wav:fe([87,65,86,69]),"3gp":fe([102,116,121,112,51,103]),mp4:fe([102,116,121,112]),fmp4:fe([115,116,121,112]),mov:fe([102,116,121,112,113,116]),moov:fe([109,111,111,118]),moof:fe([109,111,111,102])},vs={aac:function(e){var t=nr(e);return Fe(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=nr(e);return Fe(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=jl(e,[rn.EBML,rn.DocType])[0];return Fe(t,ft.webm)},mkv:function(e){var t=jl(e,[rn.EBML,rn.DocType])[0];return Fe(t,ft.matroska)},mp4:function(e){if(vs["3gp"](e)||vs.mov(e))return!1;if(Fe(e,ft.mp4,{offset:4})||Fe(e,ft.fmp4,{offset:4})||Fe(e,ft.moof,{offset:4})||Fe(e,ft.moov,{offset:4}))return!0},mov:function(e){return Fe(e,ft.mov,{offset:4})},"3gp":function(e){return Fe(e,ft["3gp"],{offset:4})},ac3:function(e){var t=nr(e);return Fe(e,ft.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 Fe(e,ft.flac,{offset:t})},ogg:function(e){return Fe(e,ft.ogg)},avi:function(e){return Fe(e,ft.riff)&&Fe(e,ft.avi,{offset:8})},wav:function(e){return Fe(e,ft.riff)&&Fe(e,ft.wav,{offset:8})},h264:function(e){return v_(e,7,3).length},h265:function(e){return b_(e,[32,33],3).length}},so=Object.keys(vs).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);so.forEach(function(s){var e=vs[s];vs[s]=function(t){return e(fe(t))}});var x_=vs,No=function(e){e=fe(e);for(var t=0;t<so.length;t++){var i=so[t];if(x_[i](e))return i}return""},S_=function(e){return h_(e,["moof"]).length>0},Fa,ql;function E_(){if(ql)return Fa;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,m){return i(m?l:l-f)},Fa={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:r,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:u},Fa}var ji=E_();var ro="8.23.4";const oi={},wi=function(s,e){return oi[s]=oi[s]||[],e&&(oi[s]=oi[s].concat(e)),oi[s]},C_=function(s,e){wi(s,e)},hd=function(s,e){const t=wi(s).indexOf(e);return t<=-1?!1:(oi[s]=oi[s].slice(),oi[s].splice(t,1),!0)},w_=function(s,e){wi(s,[].concat(e).map(t=>{const i=(...r)=>(hd(s,i),t(...r));return i}))},gn={prefixed:!0},cn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],$l=cn[0];let ar;for(let s=0;s<cn.length;s++)if(cn[s][1]in ne){ar=cn[s];break}if(ar){for(let s=0;s<ar.length;s++)gn[$l[s]]=ar[s];gn.prefixed=ar[0]!==$l[0]}let gt=[];const A_=(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+":"),gt){gt.push([].concat(n));const m=gt.length-1e3;gt.splice(0,m>0?m: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 no(s,e=":",t=""){let i="info",r;function n(...a){r("log",i,a)}return r=A_(s,n,t),n.createLogger=(a,u,l)=>{const f=u!==void 0?u:e,m=l!==void 0?l:t,_=`${s} ${f} ${a}`;return no(_,f,m)},n.createNewLogger=(a,u,l)=>no(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=()=>gt?[].concat(gt):[],n.history.filter=a=>(gt||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),n.history.clear=()=>{gt&&(gt.length=0)},n.history.disable=()=>{gt!==null&&(gt.length=0,gt=null)},n.history.enable=()=>{gt===null&&(gt=[])},n.error=(...a)=>r("error",i,a),n.warn=(...a)=>r("warn",i,a),n.debug=(...a)=>r("debug",i,a),n}const be=no("VIDEOJS"),fd=be.createLogger,D_=Object.prototype.toString,pd=function(s){return ei(s)?Object.keys(s):[]};function us(s,e){pd(s).forEach(t=>e(s[t],t))}function md(s,e,t=0){return pd(s).reduce((i,r)=>e(i,s[r],r),t)}function ei(s){return!!s&&typeof s=="object"}function bs(s){return ei(s)&&D_.call(s)==="[object Object]"&&s.constructor===Object}function Ie(...s){const e={};return s.forEach(t=>{t&&us(t,(i,r)=>{if(!bs(i)){e[r]=i;return}bs(e[r])||(e[r]={}),e[r]=Ie(e[r],i)})}),e}function gd(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function jn(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 k_=Object.freeze({__proto__:null,each:us,reduce:md,isObject:ei,isPlain:bs,merge:Ie,values:gd,defineLazyProperty:jn});let Mo=!1,_d=null,jt=!1,yd,Td=!1,ls=!1,cs=!1,ti=!1,Bo=null,qn=null;const I_=!!(D.cast&&D.cast.framework&&D.cast.framework.CastReceiverContext);let vd=null,_n=!1,$n=!1,yn=!1,Vn=!1,Tn=!1,vn=!1,bn=!1;const gr=!!(ws()&&("ontouchstart"in D||D.navigator.maxTouchPoints||D.DocumentTouch&&D.document instanceof D.DocumentTouch)),vi=D.navigator&&D.navigator.userAgentData;vi&&vi.platform&&vi.brands&&(jt=vi.platform==="Android",ls=!!vi.brands.find(s=>s.brand==="Microsoft Edge"),cs=!!vi.brands.find(s=>s.brand==="Chromium"),ti=!ls&&cs,Bo=qn=(vi.brands.find(s=>s.brand==="Chromium")||{}).version||null,$n=vi.platform==="Windows");if(!cs){const s=D.navigator&&D.navigator.userAgent||"";Mo=/iPod/i.test(s),_d=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),jt=/Android/i.test(s),yd=(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})(),Td=/Firefox/i.test(s),ls=/Edg/i.test(s),cs=/Chrome/i.test(s)||/CriOS/i.test(s),ti=!ls&&cs,Bo=qn=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),vd=(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})(),Tn=/Tizen/i.test(s),vn=/Web0S/i.test(s),bn=Tn||vn,_n=/Safari/i.test(s)&&!ti&&!jt&&!ls&&!bn,$n=/Windows/i.test(s),yn=/iPad/i.test(s)||_n&&gr&&!/iPhone/i.test(s),Vn=/iPhone/i.test(s)&&!yn}const ot=Vn||yn||Mo,Hn=(_n||ot)&&!ti;var bd=Object.freeze({__proto__:null,get IS_IPOD(){return Mo},get IOS_VERSION(){return _d},get IS_ANDROID(){return jt},get ANDROID_VERSION(){return yd},get IS_FIREFOX(){return Td},get IS_EDGE(){return ls},get IS_CHROMIUM(){return cs},get IS_CHROME(){return ti},get CHROMIUM_VERSION(){return Bo},get CHROME_VERSION(){return qn},IS_CHROMECAST_RECEIVER:I_,get IE_VERSION(){return vd},get IS_SAFARI(){return _n},get IS_WINDOWS(){return $n},get IS_IPAD(){return yn},get IS_IPHONE(){return Vn},get IS_TIZEN(){return Tn},get IS_WEBOS(){return vn},get IS_SMART_TV(){return bn},TOUCH_ENABLED:gr,IS_IOS:ot,IS_ANY_SAFARI:Hn});function Vl(s){return typeof s=="string"&&!!s.trim()}function P_(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ws(){return ne===D.document}function As(s){return ei(s)&&s.nodeType===1}function xd(){try{return D.parent!==D.self}catch{return!0}}function Sd(s){return function(e,t){if(!Vl(e))return ne[s](null);Vl(t)&&(t=ne.querySelector(t));const i=As(t)?t:ne;return i[s]&&i[s](e)}}function me(s="div",e={},t={},i){const r=ne.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Di(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 Di(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function ao(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function lr(s,e){return P_(e),s.classList.contains(e)}function Vi(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function zn(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(be.warn("removeClass was called with an element that doesn't exist"),null)}function Ed(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 Cd(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 Si(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 wd(s,e){return s.getAttribute(e)}function xs(s,e,t){s.setAttribute(e,t)}function Gn(s,e){s.removeAttribute(e)}function Ad(){ne.body.focus(),ne.onselectstart=function(){return!1}}function Dd(){ne.onselectstart=function(){return!0}}function Ss(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(Es(s,"height"))),t.width||(t.width=parseFloat(Es(s,"width"))),t}}function _r(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!==ne[gn.fullscreenElement];)i+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:i,top:r,width:e,height:t}}function Wn(s,e){const t={x:0,y:0};if(ot){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=Es(m,"transform");if(/^matrix/.test(_)){const w=_.slice(7,-1).split(/,\s/).map(Number);t.x+=w[4],t.y+=w[5]}else if(/^matrix3d/.test(_)){const w=_.slice(9,-1).split(/,\s/).map(Number);t.x+=w[12],t.y+=w[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&D.WebKitCSSMatrix){const w=D.getComputedStyle(m.assignedSlot.parentElement).transform,x=new D.WebKitCSSMatrix(w);t.x+=x.m41,t.y+=x.m42}m=m.parentNode||m.host}}const i={},r=_r(e.target),n=_r(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,ot&&(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 kd(s){return ei(s)&&s.nodeType===3}function Xn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Id(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),As(e)||kd(e))return e;if(typeof e=="string"&&/\S/.test(e))return ne.createTextNode(e)}).filter(e=>e)}function Fo(s,e){return Id(e).forEach(t=>s.appendChild(t)),s}function Pd(s,e){return Fo(Xn(s),e)}function yr(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 Ai=Sd("querySelector"),Ld=Sd("querySelectorAll");function Es(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 Od(s){[...ne.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),i=ne.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=ne.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var Rd=Object.freeze({__proto__:null,isReal:ws,isEl:As,isInFrame:xd,createEl:me,textContent:Di,prependTo:ao,hasClass:lr,addClass:Vi,removeClass:zn,toggleClass:Ed,setAttributes:Cd,getAttributes:Si,getAttribute:wd,setAttribute:xs,removeAttribute:Gn,blockTextSelection:Ad,unblockTextSelection:Dd,getBoundingClientRect:Ss,findPosition:_r,getPointerPosition:Wn,isTextNode:kd,emptyEl:Xn,normalizeContent:Id,appendContent:Fo,insertContent:Pd,isSingleLeftClick:yr,$:Ai,$$:Ld,computedStyle:Es,copyStyleSheetsToWindow:Od});let Nd=!1,oo;const L_=function(){if(oo.options.autoSetup===!1)return;const s=Array.prototype.slice.call(ne.getElementsByTagName("video")),e=Array.prototype.slice.call(ne.getElementsByTagName("audio")),t=Array.prototype.slice.call(ne.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&&oo(a);else{uo(1);break}}else Nd||uo(1)};function uo(s,e){ws()&&(e&&(oo=e),D.setTimeout(L_,s))}function lo(){Nd=!0,D.removeEventListener("load",lo)}ws()&&(ne.readyState==="complete"?lo():D.addEventListener("load",lo));const Md=function(s){const e=ne.createElement("style");return e.className=s,e},Bd=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var mt=new WeakMap;const O_=3;let R_=O_;function Pt(){return R_++}function Hl(s,e){if(!mt.has(s))return;const t=mt.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&&mt.delete(s)}function Uo(s,e,t,i){t.forEach(function(r){s(e,r,i)})}function Kn(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||ne),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=ne.documentElement,a=ne.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 nn;const N_=function(){if(typeof nn!="boolean"){nn=!1;try{const s=Object.defineProperty({},"passive",{get(){nn=!0}});D.addEventListener("test",null,s),D.removeEventListener("test",null,s)}catch{}}return nn},M_=["touchstart","touchmove"];function Et(s,e,t){if(Array.isArray(e))return Uo(Et,s,e,t);mt.has(s)||mt.set(s,{});const i=mt.get(s);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=Pt()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(r,n){if(i.disabled)return;r=Kn(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(m){be.error(m)}}}),i.handlers[e].length===1)if(s.addEventListener){let r=!1;N_()&&M_.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,i.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function ut(s,e,t){if(!mt.has(s))return;const i=mt.get(s);if(!i.handlers)return;if(Array.isArray(e))return Uo(ut,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 Ds(s,e,t){const i=mt.has(s)?mt.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Kn(e),i.dispatcher&&i.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)Ds.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){mt.has(e.target)||mt.set(e.target,{});const n=mt.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 Yn(s,e,t){if(Array.isArray(e))return Uo(Yn,s,e,t);const i=function(){ut(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Pt(),Et(s,e,i)}function jo(s,e,t){const i=function(){ut(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Pt(),Et(s,e,i)}var B_=Object.freeze({__proto__:null,fixEvent:Kn,on:Et,off:ut,trigger:Ds,one:Yn,any:jo});const Lt=30,Re=function(s,e,t){e.guid||(e.guid=Pt());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},ii=function(s,e){let t=D.performance.now();return function(...r){const n=D.performance.now();n-t>=e&&(s(...r),t=n)}},Fd=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 F_=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Lt,bind_:Re,throttle:ii,debounce:Fd});let ir;class Ct{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Et(this,e,t),this.addEventListener=i}off(e,t){ut(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Yn(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=Kn(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Ds(this,e)}queueTrigger(e){ir||(ir=new Map);const t=e.type||e;let i=ir.get(this);i||(i=new Map,ir.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,ir.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 Qn=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,ci=s=>s instanceof Ct||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),U_=(s,e)=>{ci(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},co=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,xn=(s,e,t)=>{if(!s||!s.nodeName&&!ci(s))throw new Error(`Invalid target for ${Qn(e)}#${t}; must be a DOM node or evented object.`)},Ud=(s,e,t)=>{if(!co(s))throw new Error(`Invalid event type for ${Qn(e)}#${t}; must be a non-empty string or array.`)},jd=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Qn(e)}#${t}; must be a function.`)},Ua=(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]),xn(r,s,t),Ud(n,s,t),jd(a,s,t),a=Re(s,a),{isTargetingSelf:i,target:r,type:n,listener:a}},Bi=(s,e,t,i)=>{xn(s,s,e),s.nodeName?B_[e](s,t,i):s[e](t,i)},j_={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ua(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}=Ua(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}=Ua(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||co(s))ut(this.eventBusEl_,s,e);else{const i=s,r=e;xn(i,this,"off"),Ud(r,this,"off"),jd(t,this,"off"),t=Re(this,t),this.off("dispose",t),i.nodeName?(ut(i,r,t),ut(i,"dispose",t)):ci(i)&&(i.off(r,t),i.off("dispose",t))}},trigger(s,e){xn(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!co(t))throw new Error(`Invalid event type for ${Qn(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Ds(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_=me("span",{className:"vjs-event-bus"});return Object.assign(s,j_),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&mt.has(i)&&mt.delete(i)}),D.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const q_={state:{},setState(s){typeof s=="function"&&(s=s());let e;return us(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&ci(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function qd(s,e){return Object.assign(s,q_),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&ci(s)&&s.on("statechanged",s.handleStateChanged),s}const cr=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},ze=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},$d=function(s,e){return ze(s)===ze(e)};var $_=Object.freeze({__proto__:null,toLowerCase:cr,toTitleCase:ze,titleCaseEquals:$d});class Y{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ie({},this.options_),t=this.options_=Ie(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_${Pt()}`}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)),qd(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_=Ie(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return me(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(m,_){const w=t[_-1];let x=w;return typeof w>"u"&&(x=m),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=me("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=ne.createElementNS(i,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=ne.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=ze(e);const a=t.componentClass||n;t.name=n;const u=Y.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&&ze(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_:As(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_[ze(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=Y.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=Y.getComponent(a.opts.componentClass||ze(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 Ai(e,t||this.contentEl())}$$(e,t){return Ld(e,t||this.contentEl())}hasClass(e){return lr(this.el_,e)}addClass(...e){Vi(this.el_,...e)}removeClass(...e){zn(this.el_,...e)}toggleClass(e,t){Ed(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 wd(this.el_,e)}setAttribute(e,t){xs(this.el_,e,t)}removeAttribute(e){Gn(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"+ze(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Es(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${ze(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=Re(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=Re(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=Re(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=Re(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=Re(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>(ne.documentElement.clientWidth||D.innerWidth)||a.y<0||a.y>(ne.documentElement.clientHeight||D.innerHeight))return!1;let u=ne.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=Y.getComponent("Tech"),r=i&&i.isTech(t),n=Y===t||Y.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=ze(e),Y.components_||(Y.components_={});const a=Y.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 Y.components_[e]=t,Y.components_[cr(e)]=t,t}static getComponent(e){if(!(!e||!Y.components_))return Y.components_[e]}}Y.registerComponent("Component",Y);function V_(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 V_(s,i,t.length-1),t[i][e]}function ja(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)?ja(s):s===void 0||e===void 0?ja():ja([[s,e]])}const Vd=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=Vd;function Hd(s){$o=s}function zd(){$o=Vd}function Wi(s,e=s){return $o(s,e)}var H_=Object.freeze({__proto__:null,createTimeRanges:Ut,createTimeRange:Ut,setFormatTime:Hd,resetFormatTime:zd,formatTime:Wi});function Gd(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:ei(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 Yt(s){dr(s)&&s.then(null,e=>{})}const ho=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}})})},z_=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=ho(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(ho))},G_=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 fo={textTracksToJson:z_,jsonToTextTracks:G_,trackToJson:ho};const qa="vjs-modal-dialog";class ks extends Y{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_=me("div",{className:`${qa}-content`},{role:"document"}),this.descEl_=me("p",{className:`${qa}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Di(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`${qa} 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(),Pd(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"),Xn(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=ne.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}ne.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"))}}ks.prototype.options_={pauseOnOpen:!0,temporary:!0};Y.registerComponent("ModalDialog",ks);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})},ci(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 $a=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 Wd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){$a(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&$a(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,$a(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 Va=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 Xd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Va(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&&Va(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Va(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 W_{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 Sn{constructor(e){Sn.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 X_={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},K_={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Y_={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_"+Pt(),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,ne.baseURI)},Kd=function(s){return new URL(s,ne.baseURI).href},Go=function(s){if(typeof s=="string"){const t=s.split("?")[0].replace(/\/+$/,"").match(/\.([^.\/]+)$/);return t?t[1].toLowerCase():""}return""},Jn=function(s,e=D.location){return zo(s).origin!==e.origin};var Q_=Object.freeze({__proto__:null,parseUrl:zo,getAbsoluteURL:Kd,getFileExtension:Go,isCrossOrigin:Jn});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=>be.error(r)),D.console&&D.console.groupEnd&&D.console.groupEnd()),t.flush()},Xl=function(s,e){const t={uri:s},i=Jn(s);i&&(t.cors=i);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Qc(t,Re(this,function(n,a,u){if(n)return be.error(n,a);e.loaded_=!0,typeof D.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){be.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Wl(u,e)}):Wl(u,e)}))};class xr extends Ho{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ie(e,{kind:Y_[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 Sn(this.cues_),a=new Sn(this.activeCues_);let u=!1;this.timeupdateHandler=Re(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(),m=[];for(let _=0,w=this.cues.length;_<w;_++){const x=this.cues[_];x.startTime<=f&&x.endTime>=f&&m.push(x)}if(u=!1,m.length!==this.activeCues_.length)u=!0;else for(let _=0;_<m.length;_++)this.activeCues_.indexOf(m[_])===-1&&(u=!0);return this.activeCues_=m,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 fo.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}}}}xr.prototype.allowedEvents_={cuechange:"cuechange"};class Yd extends Ho{constructor(e={}){const t=Ie(e,{kind:K_[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 Qd extends Ho{constructor(e={}){const t=Ie(e,{kind:X_[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 di extends Ct{constructor(e={}){super();let t;const i=new xr(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=di.NONE,i.addEventListener("loadeddata",()=>{t=di.LOADED,this.trigger({type:"load",target:this})})}}di.prototype.allowedEvents_={load:"load"};di.NONE=0;di.LOADING=1;di.LOADED=2;di.ERROR=3;const It={audio:{ListClass:Wd,TrackClass:Yd,capitalName:"Audio"},video:{ListClass:Xd,TrackClass:Qd,capitalName:"Video"},text:{ListClass:Vo,TrackClass:xr,capitalName:"Text"}};Object.keys(It).forEach(function(s){It[s].getterName=`${s}Tracks`,It[s].privateName=`${s}Tracks_`});const Cs={remoteText:{ListClass:Vo,TrackClass:xr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:W_,TrackClass:di,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},pt=Object.assign({},It,Cs);Cs.names=Object.keys(Cs);It.names=Object.keys(It);pt.names=[].concat(Cs.names).concat(It.names);function J_(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 pt.text.TrackClass(r);return n.addTrack(a),a}class ye extends Y{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}),pt.names.forEach(i=>{const r=pt[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 pt.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(Re(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 Gd(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(It.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(){It.names.forEach(e=>{const t=It[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(ne.body.contains(this.el())){if(!this.options_["vtt.js"]&&bs(yl)&&Object.keys(yl).length>0){this.trigger("vttjsloaded");return}const e=ne.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 J_(this,e,t,i)}createRemoteTextTrack(e){const t=Ie(e,{tech:this});return new Cs.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=Pt();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=ze(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=ze(e),D&&D.videojs&&D.videojs[e])return be.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),D.videojs[e]}}}pt.names.forEach(function(s){const e=pt[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:be.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)}};Y.registerComponent("Tech",ye);ye.registerTech("Tech",ye);ye.defaultTechOrder_=[];const Hi={},En={},Cn={};function Z_(s,e){Hi[s]=Hi[s]||[],Hi[s].push(e)}function ey(s,e,t){s.setTimeout(()=>Fi(e,Hi[e.type],t,s),1)}function ty(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function iy(s,e,t){return s.reduceRight(Wo(t),e[t]())}function sy(s,e,t,i){return e[t](s.reduce(Wo(t),i))}function Kl(s,e,t,i=null){const r="call"+ze(t),n=s.reduce(Wo(r),i),a=n===Cn,u=a?null:e[t](n);return ay(s,t,u,a),u}const ry={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},ny={setCurrentTime:1,setMuted:1,setVolume:1},Yl={play:1,pause:1};function Wo(s){return(e,t)=>e===Cn?Cn:t[s]?t[s](e):e}function ay(s,e,t,i){for(let r=s.length-1;r>=0;r--){const n=s[r];n[e]&&n[e](i,t)}}function oy(s){En.hasOwnProperty(s.id())&&delete En[s.id()]}function uy(s,e){const t=En[s.id()];let i=null;if(t==null)return i=e(s),En[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=uy(i,a);if(!l.setSource)return r.push(l),Fi(s,u,t,i,r,n);l.setSource(Object.assign({},s),function(f,m){if(f)return Fi(s,u,t,i,r,n);r.push(l),Fi(m,s.type===m.type?u:Hi[m.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 ly={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"},wn=function(s=""){const e=Go(s);return ly[e.toLowerCase()]||""},cy=(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 wn(e)},Jd=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=Jd(t),Array.isArray(t)?e=e.concat(t):ei(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Ql({src:s})]:ei(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[Ql(s)]:s=[];return s};function Ql(s){if(!s.type){const e=wn(s.src);e&&(s.type=e)}return s}var dy=`<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 Zl=Tn?10009:vn?461:8,ts={codes:{play:415,pause:19,ff:417,rw:412,back:Zl},names:{415:"play",19:"pause",417:"ff",412:"rw",[Zl]:"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}},ec=5;class by 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()+ec);break;case"rw":this.userSeek_(this.player_.currentTime()-ec);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(),m={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:m,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 xy extends Y{constructor(e,t,i){const r=Ie({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=ze(a[n]);let l=ye.getTech(u);if(u||(l=Y.getComponent(u)),l&&l.isSupported()){e.loadTech_(u);break}}else e.src(t.playerOptions.sources)}}Y.registerComponent("MediaLoader",xy);class ea extends Y{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"&&be.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=me(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=me("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Di(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)}}Y.registerComponent("ClickableComponent",ea);class mo extends ea{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 me("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(me("picture",{className:"vjs-poster",tabIndex:-1},{},me("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Yt(this.player_.play()):this.player_.pause())}}mo.prototype.crossorigin=mo.prototype.crossOrigin;Y.registerComponent("PosterImage",mo);const It="#222",tc="#ccc",Sy={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 za(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 Wt(s,e,t){try{s.style[e]=t}catch{return}}function ic(s){return s?`${s}px`:""}class Ey extends Y{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(Re(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="",Wt(a,"position","relative"),Wt(a,"height",f-l+"px"),Wt(a,"top","unset"),bn?Wt(a,"bottom",f+"px"):Wt(a,"bottom","0px"),u.length>0&&u.forEach(m=>{if(m.style.inset){const _=m.style.inset.split(" ");_.length===3&&Object.assign(m.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)),Wt(this.el_,"insetInline",ic(n)),Wt(this.el_,"insetBlock",ic(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&&Wt(a.firstChild,"color",za(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Wt(a.firstChild,"backgroundColor",za(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Wt(a,"backgroundColor",za(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 ${tc}, 0 1px ${tc}, -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=Sy[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&&xs(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}Y.registerComponent("TextTrackDisplay",Ey);class Cy extends Y{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=me("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"])}}Y.registerComponent("LoadingSpinner",Cy);class lt extends ea{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const r=me(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const i=this.constructor.name;return be.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),Y.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)}}Y.registerComponent("Button",lt);class th extends lt{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){Yt(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}}th.prototype.controlText_="Play Video";Y.registerComponent("BigPlayButton",th);class wy extends lt{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)}}Y.registerComponent("CloseButton",wy);class ih extends lt{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()?Yt(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))}}ih.prototype.controlText_="Play";Y.registerComponent("PlayToggle",ih);class Is extends Y{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=me("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=me("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,be.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_=ne.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Is.prototype.labelText_="Time";Is.prototype.controlText_="Time";Y.registerComponent("TimeDisplay",Is);class Ko extends Is{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)}}Ko.prototype.labelText_="Current Time";Ko.prototype.controlText_="Current Time";Y.registerComponent("CurrentTimeDisplay",Ko);class Yo extends Is{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)}}Yo.prototype.labelText_="Duration";Yo.prototype.controlText_="Duration";Y.registerComponent("DurationDisplay",Yo);class Ay extends Y{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}}Y.registerComponent("TimeDivider",Ay);class Qo extends Is{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(me("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Qo.prototype.labelText_="Remaining Time";Qo.prototype.controlText_="Remaining Time";Y.registerComponent("RemainingTimeDisplay",Qo);class Dy extends Y{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_=me("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(me("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(ne.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()}}Y.registerComponent("LiveDisplay",Dy);class sh extends lt{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_=me("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}sh.prototype.controlText_="Seek to live, currently playing live";Y.registerComponent("SeekToLive",sh);function Sr(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var ky=Object.freeze({__proto__:null,clamp:Sr});class Jo extends Y{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"&&!ti&&e.preventDefault(),kd(),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;Id(),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(Sr(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Xn(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")}}Y.registerComponent("Slider",Jo);const Ga=(s,e)=>Sr(s/e*100,0,100).toFixed(2)+"%";class Iy extends Y{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=me("span",{className:"vjs-control-text"}),i=me("span",{textContent:this.localize("Loaded")}),r=ne.createTextNode(": ");return this.percentageEl_=me("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=Ga(n,r);this.percent_!==u&&(this.el_.style.width=u,Di(this.percentageEl_,u),this.percent_=u);for(let l=0;l<i.length;l++){const f=i.start(l),m=i.end(l);let _=a[l];_||(_=this.el_.appendChild(me()),a[l]=_),!(_.dataset.start===f&&_.dataset.end===m)&&(_.dataset.start=f,_.dataset.end=m,_.style.left=Ga(f,n),_.style.width=Ga(m-f,n))}for(let l=a.length;l>i.length;l--)this.el_.removeChild(a[l-1]);a.length=i.length})}}Y.registerComponent("LoadProgressBar",Iy);class Py extends Y{constructor(e,t){super(e,t),this.update=ii(Re(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const r=_r(this.el_),n=Ss(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){Di(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()})}}Y.registerComponent("TimeTooltip",Py);class Zo extends Y{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ii(Re(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)}}Zo.prototype.options_={children:[]};!ot&&!jt&&Zo.prototype.options_.children.push("timeTooltip");Y.registerComponent("PlayProgressBar",Zo);class rh extends Y{constructor(e,t){super(e,t),this.update=ii(Re(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`})}}rh.prototype.options_={children:["timeTooltip"]};Y.registerComponent("MouseTimeDisplay",rh);class ta extends Jo{constructor(e,t){t=Ie(ta.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(ot||jt)||e.options_.disableSeekWhileScrubbingOnSTV;(!ot&&!jt||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Re(this,this.update),this.update=ii(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 ne&&"visibilityState"in ne&&this.on(ne,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){ne.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(ne.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(Ss(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){yr(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!yr(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?Yt(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 ne&&"visibilityState"in ne&&this.off(ne,"visibilitychange",this.toggleVisibility_),super.dispose()}}ta.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};Y.registerComponent("SeekBar",ta);class nh extends Y{constructor(e,t){super(e,t),this.handleMouseMove=ii(Re(this,this.handleMouseMove),Ot),this.throttledHandleMouseSeek=ii(Re(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=_r(n);let u=Xn(n,e).x;u=Sr(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&&Yt(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()}}nh.prototype.options_={children:["seekBar"]};Y.registerComponent("ProgressControl",nh);class ah extends lt{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(){ne.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 ne.exitPictureInPicture=="function"&&super.show()}}ah.prototype.controlText_="Picture-in-Picture";Y.registerComponent("PictureInPictureToggle",ah);class oh extends lt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),ne[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()}}oh.prototype.controlText_="Fullscreen";Y.registerComponent("FullscreenToggle",oh);const Ly=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 Oy extends Y{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}}Y.registerComponent("VolumeLevel",Oy);class Ry extends Y{constructor(e,t){super(e,t),this.update=ii(Re(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=Ss(this.el_),a=Ss(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 m=n.width/2;l<m?m+=m-l:f<m&&(m=f),m<0?m=0:m>n.width&&(m=n.width),this.el_.style.right=`-${m}px`}this.write(`${r}%`)}write(e){Di(this.el_,e)}updateVolume(e,t,i,r,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,r.toFixed(0)),n&&n()})}}Y.registerComponent("VolumeLevelTooltip",Ry);class uh extends Y{constructor(e,t){super(e,t),this.update=ii(Re(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`})}}uh.prototype.options_={children:["volumeLevelTooltip"]};Y.registerComponent("MouseVolumeLevelDisplay",uh);class ia extends Jo{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){yr(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),r=Ss(i),n=this.vertical();let a=Xn(i,e);a=n?a.y:a.x,a=Sr(a,0,1),t.update(r,a,n)}yr(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)})}}ia.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!ot&&!jt&&ia.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");ia.prototype.playerEvent="volumechange";Y.registerComponent("VolumeBar",ia);let lh=class extends Y{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||bs(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Ly(this,e),this.throttledHandleMouseMove=ii(Re(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)}};lh.prototype.options_={children:["volumeBar"]};Y.registerComponent("VolumeControl",lh);const Ny=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 ch extends lt{constructor(e,t){super(e,t),Ny(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"),ot&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),Gn(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)}}ch.prototype.controlText_="Mute";Y.registerComponent("MuteToggle",ch);class dh extends Y{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||bs(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(ne,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ut(ne,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}dh.prototype.options_={children:["muteToggle","volumeControl"]};Y.registerComponent("VolumePanel",dh);class hh extends lt{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]))}}hh.prototype.controlText_="Skip Forward";Y.registerComponent("SkipForward",hh);class fh extends lt{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]))}}fh.prototype.controlText_="Skip Backward";Y.registerComponent("SkipBackward",fh);class ph extends Y{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 Y&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Y&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=me(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),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||ne.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())}}Y.registerComponent("Menu",ph);class eu extends Y{constructor(e,t={}){super(e,t),this.menuButton_=new lt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=lt.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(ne,"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 ph(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=me("li",{className:"vjs-menu-title",textContent:ze(this.options_.title),tabIndex:-1}),i=new Y(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=lt.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"),ut(ne,"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"),ot&&Ed())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()}}Y.registerComponent("MenuButton",eu);class tu extends eu{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const r=Re(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)})}}Y.registerComponent("TrackButton",tu);class Er extends ea{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=me("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))}}Y.registerComponent("MenuItem",Er);class Cr extends Er{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=ne.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()}}Y.registerComponent("TextTrackMenuItem",Cr);class mh extends Cr{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()}}Y.registerComponent("OffTextTrackMenuItem",mh);class Ps extends tu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Cr){let i;this.label_&&(i=`${this.label_} off`),e.push(new mh(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}}Y.registerComponent("TextTrackButton",Ps);class gh extends Er{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)}}Y.registerComponent("ChaptersTrackMenuItem",gh);class iu extends Ps{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(ze(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 gh(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}iu.prototype.kind_="chapters";iu.prototype.controlText_="Chapters";Y.registerComponent("ChaptersButton",iu);class su extends Ps{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const r=e.textTracks(),n=Re(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()}`}}su.prototype.kind_="descriptions";su.prototype.controlText_="Descriptions";Y.registerComponent("DescriptionsButton",su);class ru extends Ps{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()}`}}ru.prototype.kind_="subtitles";ru.prototype.controlText_="Subtitles";Y.registerComponent("SubtitlesButton",ru);class nu extends Cr{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()}}Y.registerComponent("CaptionSettingsMenuItem",nu);class au extends Ps{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 nu(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}au.prototype.kind_="captions";au.prototype.controlText_="Captions";Y.registerComponent("CaptionsButton",au);class _h extends Cr{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(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(me("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}Y.registerComponent("SubsCapsMenuItem",_h);class ou extends Ps{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(ze(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 nu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,_h),e}}ou.prototype.kinds_=["captions","subtitles"];ou.prototype.controlText_="Subtitles";Y.registerComponent("SubsCapsButton",ou);class yh extends Er{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(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(me("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)}}Y.registerComponent("AudioTrackMenuItem",yh);class Th extends tu{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 yh(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}Th.prototype.controlText_="Audio Track";Y.registerComponent("AudioTrackButton",Th);class uu extends Er{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)}}uu.prototype.contentElType="button";Y.registerComponent("PlaybackRateMenuItem",uu);class vh extends eu{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_=me("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new uu(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")}}vh.prototype.controlText_="Playback Rate";Y.registerComponent("PlaybackRateMenuButton",vh);class bh extends Y{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Y.registerComponent("Spacer",bh);class My extends bh{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Y.registerComponent("CustomControlSpacer",My);class xh extends Y{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}xh.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};Y.registerComponent("ControlBar",xh);class Sh extends ks{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):""}}Sh.prototype.options_=Object.assign({},ks.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});Y.registerComponent("ErrorDisplay",Sh);class Eh extends Y{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(),me("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=me("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),r}))}}Y.registerComponent("TextTrackSelect",Eh);class zi extends Y{constructor(e,t={}){super(e,t);const i=me("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 m=`vjs_select_${Lt()}`;if(this.options_.type==="colors"){f=me("span",{className:u});const w=me("label",{id:l,className:"vjs-label",textContent:this.localize(a.label)});w.setAttribute("for",m),f.appendChild(w)}const _=new Eh(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:l});this.addChild(_),this.options_.type==="colors"&&(f.appendChild(_.el()),this.el().appendChild(f))}}createEl(){return me("fieldset",{className:this.options_.className})}}Y.registerComponent("TextTrackFieldset",zi);class Ch extends Y{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 me("div",{className:"vjs-track-settings-colors"})}}Y.registerComponent("TextTrackSettingsColors",Ch);class wh extends Y{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 me("div",{className:"vjs-track-settings-font"})}}Y.registerComponent("TextTrackSettingsFont",wh);class Ah extends Y{constructor(e,t={}){super(e,t);const i=new lt(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 lt(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=r,this.addChild(n)}createEl(){return me("div",{className:"vjs-track-settings-controls"})}}Y.registerComponent("TrackSettingsControls",Ah);const Wa="vjs-text-track-settings",sc=["#000","Black"],rc=["#00F","Blue"],nc=["#0FF","Cyan"],ac=["#0F0","Green"],oc=["#F0F","Magenta"],uc=["#F00","Red"],lc=["#FFF","White"],cc=["#FF0","Yellow"],Xa=["1","Opaque"],Ka=["0.5","Semi-Transparent"],dc=["0","Transparent"],Ei={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[sc,lc,uc,ac,rc,cc,oc,nc],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Xa,Ka,dc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[lc,sc,uc,ac,rc,cc,oc,nc],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:[Xa,Ka],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:[dc,Ka,Xa],className:"vjs-window-opacity vjs-opacity"}};Ei.windowColor.options=Ei.backgroundColor.options;function Dh(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function By(s,e){const t=s.options[s.options.selectedIndex].value;return Dh(t,e)}function Fy(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(Dh(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Uy extends ks{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=me("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 Ch(e,{textTrackComponentid:this.id_,selectConfigs:Ei,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new wh(e,{textTrackComponentid:this.id_,selectConfigs:Ei,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const r=new Ah(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()}),us(Ei,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 _d(Ei,(e,t,i)=>{const r=By(this.$(t.selector),t.parser);return r!==void 0&&(e[i]=r),e},{})}setValues(e){us(Ei,(t,i)=>{Fy(this.$(t.selector),e[i],t.parser)})}setDefaults(){us(Ei,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(D.localStorage.getItem(Wa))}catch(t){be.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?D.localStorage.setItem(Wa,JSON.stringify(e)):D.localStorage.removeItem(Wa)}catch(t){be.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}Y.registerComponent("TextTrackSettings",Uy);class jy extends Y{constructor(e,t){let i=t.ResizeObserver||D.ResizeObserver;t.ResizeObserver===null&&(i=!1);const r=Ie({createEl:!i,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||D.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=jd(()=>{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(){ut(this,"resize",n),ut(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()}}Y.registerComponent("ResizeManager",jy);const qy={trackingThreshold:20,liveTolerance:15};class $y extends Y{constructor(e,t){const i=Ie(qy,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()}}Y.registerComponent("LiveTracker",$y);class Vy extends Y{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:me("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Lt()}`}),description:me("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Lt()}`})},me("div",{className:"vjs-title-bar"},{},yd(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];Kn(a),n&&Di(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}}Y.registerComponent("TitleBar",Vy);const Hy={initialDisplay:4e3,position:[],takeFocus:!1};class zy extends lt{constructor(e,t){t=Ie(Hy,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=me("button",{},{type:"button",class:this.buildCSSClass()},me("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()}}Y.registerComponent("TransientButton",zy);const go=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},Gy=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=ne.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=ne.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",D.Element.prototype.appendChild.call(this,t),this.innerHTML}}),kh=(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},Wy=s=>kh([s.el(),D.HTMLMediaElement.prototype,D.Element.prototype,Gy],"innerHTML"),hc=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=Wy(s),r=n=>(...a)=>{const u=n.apply(e,a);return go(s),u};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=r(t[n]))}),Object.defineProperty(e,"innerHTML",Ie(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_)},Xy=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Qd(D.Element.prototype.getAttribute.call(this,"src")):""},set(s){return D.Element.prototype.setAttribute.call(this,"src",s),s}}),Ky=s=>kh([s.el(),D.HTMLMediaElement.prototype,Xy],"src"),Yy=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=Ky(s),i=e.setAttribute,r=e.load;Object.defineProperty(e,"src",Ie(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 go(s)||(s.triggerSourceset(""),hc(s)),n},e.currentSrc?s.triggerSourceset(e.currentSrc):go(s)||hc(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class le 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")&&Zn(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&&be.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_(),(gr||Hn)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),le.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Yy(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[Cs.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 m=0;m<i.length;m++)if(i[m]===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),le.disposeMediaElement(e),e=i}else{e=ne.createElement("video");const i=this.options_.tag&&Si(this.options_.tag),r=Ie({},i);(!gr||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Ad(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&xs(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?xs(e,r,r):Wn(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&&zn?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){be(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&jt&&ti&&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)Yt(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 be.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const r=me("source",{},i);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return be.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 be.warn(`No matching source element found with src: ${e}`),!1}reset(){le.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=ne.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}}qn(le,"TEST_VID",function(){if(!ws())return;const s=ne.createElement("video"),e=ne.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});le.isSupported=function(){try{le.TEST_VID.volume=.5}catch{return!1}return!!(le.TEST_VID&&le.TEST_VID.canPlayType)};le.canPlayType=function(s){return le.TEST_VID.canPlayType(s)};le.canPlaySource=function(s,e){return le.canPlayType(s.type)};le.canControlVolume=function(){try{const s=le.TEST_VID.volume;le.TEST_VID.volume=s/2+.1;const e=s!==le.TEST_VID.volume;return e&&ot?(D.setTimeout(()=>{le&&le.prototype&&(le.prototype.featuresVolumeControl=s!==le.TEST_VID.volume)}),!1):e}catch{return!1}};le.canMuteVolume=function(){try{const s=le.TEST_VID.muted;return le.TEST_VID.muted=!s,le.TEST_VID.muted?xs(le.TEST_VID,"muted","muted"):Wn(le.TEST_VID,"muted","muted"),s!==le.TEST_VID.muted}catch{return!1}};le.canControlPlaybackRate=function(){if(jt&&ti&&$n<58)return!1;try{const s=le.TEST_VID.playbackRate;return le.TEST_VID.playbackRate=s/2+.1,s!==le.TEST_VID.playbackRate}catch{return!1}};le.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(ne.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(ne.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(ne.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(ne.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};le.supportsNativeTextTracks=function(){return zn||ot&&ti};le.supportsNativeVideoTracks=function(){return!!(le.TEST_VID&&le.TEST_VID.videoTracks)};le.supportsNativeAudioTracks=function(){return!!(le.TEST_VID&&le.TEST_VID.audioTracks)};le.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]){qn(le.prototype,s,()=>le[e](),!0)});le.prototype.featuresVolumeControl=le.canControlVolume();le.prototype.movingMediaElementInDOM=!ot;le.prototype.featuresFullscreenResize=!0;le.prototype.featuresProgressEvents=!0;le.prototype.featuresTimeupdateEvents=!0;le.prototype.featuresVideoFrameCallback=!!(le.TEST_VID&&le.TEST_VID.requestVideoFrameCallback);le.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{}})()}};le.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){le.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){le.prototype["set"+ze(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){le.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){le.prototype["set"+ze(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){le.prototype[s]=function(){return this.el_[s]()}});ye.withSourceHandlers(le);le.nativeSourceHandler={};le.nativeSourceHandler.canPlayType=function(s){try{return le.TEST_VID.canPlayType(s)}catch{return""}};le.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return le.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=Wo(s.src);return le.nativeSourceHandler.canPlayType(`video/${t}`)}return""};le.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};le.nativeSourceHandler.dispose=function(){};le.registerSourceHandler(le.nativeSourceHandler);ye.registerTech("Html5",le);const Ih=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ya={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},_o=["tiny","xsmall","small","medium","large","xlarge","huge"],dn={};_o.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;dn[s]=`vjs-layout-${e}`});const Qy={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ae extends Y{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Lt()}`,t=Object.assign(Ae.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=md(this.id_),this.fsApi_=gn,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&&Si(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_=Ae.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(),$o(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Et(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Ie(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(vy,"image/svg+xml");if(u.querySelector("parsererror"))be.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 by(this),this.addClass("vjs-spatial-navigation-enabled")),gr&&this.addClass("vjs-touch-enabled"),ot||this.addClass("vjs-workinghover"),Ae.players[this.id_]=this;const n=no.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"),ut(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ut(ne,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ae.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),gy(this),pt.names.forEach(e=>{const t=pt[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=Si(e);if(r){for(t=this.el_=e,e=this.tag=ne.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",ti&&Vn&&(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=>Sd[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),D.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Fd("vjs-styles-dimensions");const l=Ai(".vjs-styles-defaults"),f=Ai("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),oo(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"){be.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)){be.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,ci(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),X_(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),Ud(this.styleEl_,`
|
|
159
|
+
</svg>`;const Jl=Tn?10009:vn?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 hy 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(),m={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:m,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 fy extends Y{constructor(e,t,i){const r=Ie({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=ze(a[n]);let l=ye.getTech(u);if(u||(l=Y.getComponent(u)),l&&l.isSupported()){e.loadTech_(u);break}}else e.src(t.playerOptions.sources)}}Y.registerComponent("MediaLoader",fy);class Zn extends Y{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"&&be.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=me(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=me("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Di(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)}}Y.registerComponent("ClickableComponent",Zn);class po extends Zn{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 me("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(me("picture",{className:"vjs-poster",tabIndex:-1},{},me("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Yt(this.player_.play()):this.player_.pause())}}po.prototype.crossorigin=po.prototype.crossOrigin;Y.registerComponent("PosterImage",po);const kt="#222",ec="#ccc",py={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function Ha(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 Wt(s,e,t){try{s.style[e]=t}catch{return}}function tc(s){return s?`${s}px`:""}class my extends Y{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(Re(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="",Wt(a,"position","relative"),Wt(a,"height",f-l+"px"),Wt(a,"top","unset"),bn?Wt(a,"bottom",f+"px"):Wt(a,"bottom","0px"),u.length>0&&u.forEach(m=>{if(m.style.inset){const _=m.style.inset.split(" ");_.length===3&&Object.assign(m.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)),Wt(this.el_,"insetInline",tc(n)),Wt(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&&Wt(a.firstChild,"color",Ha(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Wt(a.firstChild,"backgroundColor",Ha(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Wt(a,"backgroundColor",Ha(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${kt}, 2px 2px 4px ${kt}, 2px 2px 5px ${kt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${kt}, 2px 2px ${kt}, 3px 3px ${kt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${ec}, 0 1px ${ec}, -1px -1px ${kt}, 0 -1px ${kt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${kt}, 0 0 4px ${kt}, 0 0 4px ${kt}, 0 0 4px ${kt}`)),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=py[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&&xs(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}Y.registerComponent("TextTrackDisplay",my);class gy extends Y{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=me("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"])}}Y.registerComponent("LoadingSpinner",gy);class lt extends Zn{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const r=me(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const i=this.constructor.name;return be.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),Y.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)}}Y.registerComponent("Button",lt);class Zd extends lt{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){Yt(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}}Zd.prototype.controlText_="Play Video";Y.registerComponent("BigPlayButton",Zd);class _y extends lt{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)}}Y.registerComponent("CloseButton",_y);class eh extends lt{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()?Yt(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))}}eh.prototype.controlText_="Play";Y.registerComponent("PlayToggle",eh);class Is extends Y{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=me("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=me("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,be.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_=ne.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Is.prototype.labelText_="Time";Is.prototype.controlText_="Time";Y.registerComponent("TimeDisplay",Is);class Xo extends Is{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";Y.registerComponent("CurrentTimeDisplay",Xo);class Ko extends Is{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";Y.registerComponent("DurationDisplay",Ko);class yy extends Y{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}}Y.registerComponent("TimeDivider",yy);class Yo extends Is{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(me("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Yo.prototype.labelText_="Remaining Time";Yo.prototype.controlText_="Remaining Time";Y.registerComponent("RemainingTimeDisplay",Yo);class Ty extends Y{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_=me("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(me("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(ne.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()}}Y.registerComponent("LiveDisplay",Ty);class th extends lt{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_=me("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}th.prototype.controlText_="Seek to live, currently playing live";Y.registerComponent("SeekToLive",th);function Sr(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var vy=Object.freeze({__proto__:null,clamp:Sr});class Qo extends Y{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"&&!ti&&e.preventDefault(),Ad(),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;Dd(),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(Sr(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Wn(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")}}Y.registerComponent("Slider",Qo);const za=(s,e)=>Sr(s/e*100,0,100).toFixed(2)+"%";class by extends Y{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=me("span",{className:"vjs-control-text"}),i=me("span",{textContent:this.localize("Loaded")}),r=ne.createTextNode(": ");return this.percentageEl_=me("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=za(n,r);this.percent_!==u&&(this.el_.style.width=u,Di(this.percentageEl_,u),this.percent_=u);for(let l=0;l<i.length;l++){const f=i.start(l),m=i.end(l);let _=a[l];_||(_=this.el_.appendChild(me()),a[l]=_),!(_.dataset.start===f&&_.dataset.end===m)&&(_.dataset.start=f,_.dataset.end=m,_.style.left=za(f,n),_.style.width=za(m-f,n))}for(let l=a.length;l>i.length;l--)this.el_.removeChild(a[l-1]);a.length=i.length})}}Y.registerComponent("LoadProgressBar",by);class xy extends Y{constructor(e,t){super(e,t),this.update=ii(Re(this,this.update),Lt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const r=_r(this.el_),n=Ss(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){Di(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()})}}Y.registerComponent("TimeTooltip",xy);class Jo extends Y{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ii(Re(this,this.update),Lt)}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:[]};!ot&&!jt&&Jo.prototype.options_.children.push("timeTooltip");Y.registerComponent("PlayProgressBar",Jo);class ih extends Y{constructor(e,t){super(e,t),this.update=ii(Re(this,this.update),Lt)}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`})}}ih.prototype.options_={children:["timeTooltip"]};Y.registerComponent("MouseTimeDisplay",ih);class ea extends Qo{constructor(e,t){t=Ie(ea.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(ot||jt)||e.options_.disableSeekWhileScrubbingOnSTV;(!ot&&!jt||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Re(this,this.update),this.update=ii(this.update_,Lt),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 ne&&"visibilityState"in ne&&this.on(ne,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){ne.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,Lt))}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(ne.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(Ss(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){yr(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!yr(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?Yt(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 ne&&"visibilityState"in ne&&this.off(ne,"visibilitychange",this.toggleVisibility_),super.dispose()}}ea.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar",stepSeconds:5,pageMultiplier:12};Y.registerComponent("SeekBar",ea);class sh extends Y{constructor(e,t){super(e,t),this.handleMouseMove=ii(Re(this,this.handleMouseMove),Lt),this.throttledHandleMouseSeek=ii(Re(this,this.handleMouseSeek),Lt),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=_r(n);let u=Wn(n,e).x;u=Sr(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&&Yt(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()}}sh.prototype.options_={children:["seekBar"]};Y.registerComponent("ProgressControl",sh);class rh extends lt{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(){ne.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 ne.exitPictureInPicture=="function"&&super.show()}}rh.prototype.controlText_="Picture-in-Picture";Y.registerComponent("PictureInPictureToggle",rh);class nh extends lt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),ne[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()}}nh.prototype.controlText_="Fullscreen";Y.registerComponent("FullscreenToggle",nh);const Sy=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 Ey extends Y{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}}Y.registerComponent("VolumeLevel",Ey);class Cy extends Y{constructor(e,t){super(e,t),this.update=ii(Re(this,this.update),Lt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,r){if(!i){const n=Ss(this.el_),a=Ss(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 m=n.width/2;l<m?m+=m-l:f<m&&(m=f),m<0?m=0:m>n.width&&(m=n.width),this.el_.style.right=`-${m}px`}this.write(`${r}%`)}write(e){Di(this.el_,e)}updateVolume(e,t,i,r,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,r.toFixed(0)),n&&n()})}}Y.registerComponent("VolumeLevelTooltip",Cy);class ah extends Y{constructor(e,t){super(e,t),this.update=ii(Re(this,this.update),Lt)}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`})}}ah.prototype.options_={children:["volumeLevelTooltip"]};Y.registerComponent("MouseVolumeLevelDisplay",ah);class ta 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){yr(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),r=Ss(i),n=this.vertical();let a=Wn(i,e);a=n?a.y:a.x,a=Sr(a,0,1),t.update(r,a,n)}yr(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)})}}ta.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!ot&&!jt&&ta.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");ta.prototype.playerEvent="volumechange";Y.registerComponent("VolumeBar",ta);let oh=class extends Y{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||bs(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Sy(this,e),this.throttledHandleMouseMove=ii(Re(this,this.handleMouseMove),Lt),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)}};oh.prototype.options_={children:["volumeBar"]};Y.registerComponent("VolumeControl",oh);const wy=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 uh extends lt{constructor(e,t){super(e,t),wy(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"),ot&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),zn(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)}}uh.prototype.controlText_="Mute";Y.registerComponent("MuteToggle",uh);class lh extends Y{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||bs(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(ne,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ut(ne,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}lh.prototype.options_={children:["muteToggle","volumeControl"]};Y.registerComponent("VolumePanel",lh);class ch extends lt{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]))}}ch.prototype.controlText_="Skip Forward";Y.registerComponent("SkipForward",ch);class dh extends lt{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]))}}dh.prototype.controlText_="Skip Backward";Y.registerComponent("SkipBackward",dh);class hh extends Y{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 Y&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof Y&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=me(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),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||ne.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())}}Y.registerComponent("Menu",hh);class Zo extends Y{constructor(e,t={}){super(e,t),this.menuButton_=new lt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=lt.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(ne,"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 hh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=me("li",{className:"vjs-menu-title",textContent:ze(this.options_.title),tabIndex:-1}),i=new Y(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=lt.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"),ut(ne,"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"),ot&&xd())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()}}Y.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=Re(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)})}}Y.registerComponent("TrackButton",eu);class Er extends Zn{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=me("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))}}Y.registerComponent("MenuItem",Er);class Cr extends Er{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=ne.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()}}Y.registerComponent("TextTrackMenuItem",Cr);class fh extends Cr{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()}}Y.registerComponent("OffTextTrackMenuItem",fh);class Ps extends eu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Cr){let i;this.label_&&(i=`${this.label_} off`),e.push(new fh(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}}Y.registerComponent("TextTrackButton",Ps);class ph extends Er{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)}}Y.registerComponent("ChaptersTrackMenuItem",ph);class tu extends Ps{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(ze(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 ph(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}tu.prototype.kind_="chapters";tu.prototype.controlText_="Chapters";Y.registerComponent("ChaptersButton",tu);class iu extends Ps{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const r=e.textTracks(),n=Re(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";Y.registerComponent("DescriptionsButton",iu);class su extends Ps{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";Y.registerComponent("SubtitlesButton",su);class ru extends Cr{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()}}Y.registerComponent("CaptionSettingsMenuItem",ru);class nu extends Ps{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";Y.registerComponent("CaptionsButton",nu);class mh extends Cr{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(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(me("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}Y.registerComponent("SubsCapsMenuItem",mh);class au extends Ps{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(ze(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,mh),e}}au.prototype.kinds_=["captions","subtitles"];au.prototype.controlText_="Subtitles";Y.registerComponent("SubsCapsButton",au);class gh extends Er{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(me("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(me("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)}}Y.registerComponent("AudioTrackMenuItem",gh);class _h 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 gh(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}_h.prototype.controlText_="Audio Track";Y.registerComponent("AudioTrackButton",_h);class ou extends Er{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";Y.registerComponent("PlaybackRateMenuItem",ou);class yh 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_=me("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let 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")}}yh.prototype.controlText_="Playback Rate";Y.registerComponent("PlaybackRateMenuButton",yh);class Th extends Y{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}Y.registerComponent("Spacer",Th);class Ay extends Th{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Y.registerComponent("CustomControlSpacer",Ay);class vh extends Y{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}vh.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};Y.registerComponent("ControlBar",vh);class bh extends ks{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):""}}bh.prototype.options_=Object.assign({},ks.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});Y.registerComponent("ErrorDisplay",bh);class xh extends Y{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(),me("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Pt()}`)+"-"+t[1].replace(/\W+/g,""),r=me("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),r}))}}Y.registerComponent("TextTrackSelect",xh);class zi extends Y{constructor(e,t={}){super(e,t);const i=me("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 m=`vjs_select_${Pt()}`;if(this.options_.type==="colors"){f=me("span",{className:u});const w=me("label",{id:l,className:"vjs-label",textContent:this.localize(a.label)});w.setAttribute("for",m),f.appendChild(w)}const _=new xh(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:l});this.addChild(_),this.options_.type==="colors"&&(f.appendChild(_.el()),this.el().appendChild(f))}}createEl(){return me("fieldset",{className:this.options_.className})}}Y.registerComponent("TextTrackFieldset",zi);class Sh extends Y{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 me("div",{className:"vjs-track-settings-colors"})}}Y.registerComponent("TextTrackSettingsColors",Sh);class Eh extends Y{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 me("div",{className:"vjs-track-settings-font"})}}Y.registerComponent("TextTrackSettingsFont",Eh);class Ch extends Y{constructor(e,t={}){super(e,t);const i=new lt(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 lt(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=r,this.addChild(n)}createEl(){return me("div",{className:"vjs-track-settings-controls"})}}Y.registerComponent("TrackSettingsControls",Ch);const Ga="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"],Wa=["1","Opaque"],Xa=["0.5","Semi-Transparent"],cc=["0","Transparent"],Ei={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:[Wa,Xa,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:[Wa,Xa],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,Xa,Wa],className:"vjs-window-opacity vjs-opacity"}};Ei.windowColor.options=Ei.backgroundColor.options;function wh(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function Dy(s,e){const t=s.options[s.options.selectedIndex].value;return wh(t,e)}function ky(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(wh(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Iy extends ks{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=me("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 Sh(e,{textTrackComponentid:this.id_,selectConfigs:Ei,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new Eh(e,{textTrackComponentid:this.id_,selectConfigs:Ei,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const r=new Ch(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()}),us(Ei,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 md(Ei,(e,t,i)=>{const r=Dy(this.$(t.selector),t.parser);return r!==void 0&&(e[i]=r),e},{})}setValues(e){us(Ei,(t,i)=>{ky(this.$(t.selector),e[i],t.parser)})}setDefaults(){us(Ei,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(D.localStorage.getItem(Ga))}catch(t){be.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?D.localStorage.setItem(Ga,JSON.stringify(e)):D.localStorage.removeItem(Ga)}catch(t){be.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}Y.registerComponent("TextTrackSettings",Iy);class Py extends Y{constructor(e,t){let i=t.ResizeObserver||D.ResizeObserver;t.ResizeObserver===null&&(i=!1);const r=Ie({createEl:!i,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||D.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Fd(()=>{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(){ut(this,"resize",n),ut(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()}}Y.registerComponent("ResizeManager",Py);const Ly={trackingThreshold:20,liveTolerance:15};class Oy extends Y{constructor(e,t){const i=Ie(Ly,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_,Lt),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()}}Y.registerComponent("LiveTracker",Oy);class Ry extends Y{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:me("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Pt()}`}),description:me("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Pt()}`})},me("div",{className:"vjs-title-bar"},{},gd(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];Xn(a),n&&Di(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}}Y.registerComponent("TitleBar",Ry);const Ny={initialDisplay:4e3,position:[],takeFocus:!1};class My extends lt{constructor(e,t){t=Ie(Ny,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=me("button",{},{type:"button",class:this.buildCSSClass()},me("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()}}Y.registerComponent("TransientButton",My);const mo=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},By=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=ne.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=ne.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",D.Element.prototype.appendChild.call(this,t),this.innerHTML}}),Ah=(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=>Ah([s.el(),D.HTMLMediaElement.prototype,D.Element.prototype,By],"innerHTML"),dc=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 mo(s),u};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=r(t[n]))}),Object.defineProperty(e,"innerHTML",Ie(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_)},Uy=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Kd(D.Element.prototype.getAttribute.call(this,"src")):""},set(s){return D.Element.prototype.setAttribute.call(this,"src",s),s}}),jy=s=>Ah([s.el(),D.HTMLMediaElement.prototype,Uy],"src"),qy=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=jy(s),i=e.setAttribute,r=e.load;Object.defineProperty(e,"src",Ie(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 mo(s)||(s.triggerSourceset(""),dc(s)),n},e.currentSrc?s.triggerSourceset(e.currentSrc):mo(s)||dc(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class le 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")&&Jn(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&&be.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_(),(gr||Vn)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),le.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){qy(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=It[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[Cs.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 m=0;m<i.length;m++)if(i[m]===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_(){It.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),le.disposeMediaElement(e),e=i}else{e=ne.createElement("video");const i=this.options_.tag&&Si(this.options_.tag),r=Ie({},i);(!gr||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Cd(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&xs(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?xs(e,r,r):Gn(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&&Hn?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){be(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&jt&&ti&&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)Yt(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 be.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const r=me("source",{},i);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return be.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 be.warn(`No matching source element found with src: ${e}`),!1}reset(){le.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=ne.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}}jn(le,"TEST_VID",function(){if(!ws())return;const s=ne.createElement("video"),e=ne.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});le.isSupported=function(){try{le.TEST_VID.volume=.5}catch{return!1}return!!(le.TEST_VID&&le.TEST_VID.canPlayType)};le.canPlayType=function(s){return le.TEST_VID.canPlayType(s)};le.canPlaySource=function(s,e){return le.canPlayType(s.type)};le.canControlVolume=function(){try{const s=le.TEST_VID.volume;le.TEST_VID.volume=s/2+.1;const e=s!==le.TEST_VID.volume;return e&&ot?(D.setTimeout(()=>{le&&le.prototype&&(le.prototype.featuresVolumeControl=s!==le.TEST_VID.volume)}),!1):e}catch{return!1}};le.canMuteVolume=function(){try{const s=le.TEST_VID.muted;return le.TEST_VID.muted=!s,le.TEST_VID.muted?xs(le.TEST_VID,"muted","muted"):Gn(le.TEST_VID,"muted","muted"),s!==le.TEST_VID.muted}catch{return!1}};le.canControlPlaybackRate=function(){if(jt&&ti&&qn<58)return!1;try{const s=le.TEST_VID.playbackRate;return le.TEST_VID.playbackRate=s/2+.1,s!==le.TEST_VID.playbackRate}catch{return!1}};le.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(ne.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(ne.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(ne.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(ne.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};le.supportsNativeTextTracks=function(){return Hn||ot&&ti};le.supportsNativeVideoTracks=function(){return!!(le.TEST_VID&&le.TEST_VID.videoTracks)};le.supportsNativeAudioTracks=function(){return!!(le.TEST_VID&&le.TEST_VID.audioTracks)};le.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]){jn(le.prototype,s,()=>le[e](),!0)});le.prototype.featuresVolumeControl=le.canControlVolume();le.prototype.movingMediaElementInDOM=!ot;le.prototype.featuresFullscreenResize=!0;le.prototype.featuresProgressEvents=!0;le.prototype.featuresTimeupdateEvents=!0;le.prototype.featuresVideoFrameCallback=!!(le.TEST_VID&&le.TEST_VID.requestVideoFrameCallback);le.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{}})()}};le.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){le.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){le.prototype["set"+ze(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){le.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){le.prototype["set"+ze(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){le.prototype[s]=function(){return this.el_[s]()}});ye.withSourceHandlers(le);le.nativeSourceHandler={};le.nativeSourceHandler.canPlayType=function(s){try{return le.TEST_VID.canPlayType(s)}catch{return""}};le.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return le.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=Go(s.src);return le.nativeSourceHandler.canPlayType(`video/${t}`)}return""};le.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};le.nativeSourceHandler.dispose=function(){};le.registerSourceHandler(le.nativeSourceHandler);ye.registerTech("Html5",le);const Dh=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Ka={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},go=["tiny","xsmall","small","medium","large","xlarge","huge"],dn={};go.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;dn[s]=`vjs-layout-${e}`});const $y={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ae extends Y{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Pt()}`,t=Object.assign(Ae.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=fd(this.id_),this.fsApi_=gn,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&&Si(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_=Ae.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(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Ie(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(dy,"image/svg+xml");if(u.querySelector("parsererror"))be.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 hy(this),this.addClass("vjs-spatial-navigation-enabled")),gr&&this.addClass("vjs-touch-enabled"),ot||this.addClass("vjs-workinghover"),Ae.players[this.id_]=this;const n=ro.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"),ut(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ut(ne,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ae.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),oy(this),pt.names.forEach(e=>{const t=pt[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=Si(e);if(r){for(t=this.el_=e,e=this.tag=ne.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",ti&&$n&&(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=>bd[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),D.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Md("vjs-styles-dimensions");const l=Ai(".vjs-styles-defaults"),f=Ai("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),ao(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"){be.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)){be.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,ci(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),U_(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),Bd(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=ze(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};pt.names.forEach(l=>{const f=pt[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(Re(this,this.handleTechReady_),!0),
|
|
169
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=ze(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};pt.names.forEach(l=>{const f=pt[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(Re(this,this.handleTechReady_),!0),fo.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Dh.forEach(l=>{this.on(this.tech_,l,f=>this[`handleTech${ze(l)}_`](f))}),Object.keys(Ka).forEach(l=>{this.on(this.tech_,l,f=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Ka[l]}_`].bind(this),event:f});return}this[`handleTech${Ka[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)&&ao(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){pt.names.forEach(e=>{const t=pt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=fo.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&&be.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":no}}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=Ty(this,t)),this.cache_.source=Ie({},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=Si(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()?Yt(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()&&!ne.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=ne[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 py)return hy(this.middleware_,this.tech_,e,t);if(e in Ql)return Yl(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw be(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in fy)return dy(this.middleware_,this.tech_,e);if(e in Ql)return Yl(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(be(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(be(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(be(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Yt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(zn||ot);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&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 Xd(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,m){n(),r(m)}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=ne[this.fsApi_.exitFullscreen]();return e&&Yt(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=ne.documentElement.style.overflow,Et(ne,"keydown",this.boundFullWindowOnEscKey_),ne.documentElement.style.overflow="hidden",Vi(ne.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,ut(ne,"keydown",this.boundFullWindowOnEscKey_),ne.documentElement.style.overflow=this.docOrigOverflow,Gn(ne.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=ne.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(me("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),D.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Nd(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 ne&&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 ne)return ne.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=Y.getComponent("FullscreenToggle");ne[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),Y.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Y.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=Y.getComponent(n)),!a){be.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():(be.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,l,f){let m;return u.some(_=>l.some(w=>{if(m=f(_,w),m)return!0})),m};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=eh(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]),ly(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}cy(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?Hd(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();Yt(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}),ci(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(wi("beforeerror").forEach(t=>{const i=t(this,e);if(!(ei(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"),be.error(`(CODE:${this.error_.code} ${qe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),wi("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=Re(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&&!ot&&!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 m=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(m,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(),ci(this)&&this.trigger("languagechange"))}languages(){return Ie(Ae.prototype.options_.languages,this.languages_)}toJSON(){const e=Ie(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let r=t[i];r=Ie(r),r.player=void 0,e.tracks[i]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new ks(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<_o.length;i++){const r=_o[i],n=this.breakpoints_[r];if(t<=n){if(e===r)return;e&&this.removeClass(dn[e]),this.addClass(dn[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({},Qy,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 dn[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=Ie(e);const{artist:r,artwork:n,description:a,poster:u,src:l,textTracks:f,title:m}=this.cache_.media;!n&&u&&(this.cache_.media.artwork=[{src:u,type:wn(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:m,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:wn(r.poster)}]),r}return Ie(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Si(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){be.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(Si(l)):f==="track"&&t.tracks.push(Si(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"))}}Ae.prototype.videoTracks=()=>{};Ae.prototype.audioTracks=()=>{};Ae.prototype.textTracks=()=>{};Ae.prototype.remoteTextTracks=()=>{};Ae.prototype.remoteTextTrackEls=()=>{};pt.names.forEach(function(s){const e=pt[s];Ae.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ae.prototype.crossorigin=Ae.prototype.crossOrigin;Ae.players={};const sr=D.navigator;Ae.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:sr&&(sr.languages&&sr.languages[0]||sr.userLanguage||sr.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};Ih.forEach(function(s){Ae.prototype[`handleTech${ze(s)}_`]=function(){return this.trigger(s)}});Y.registerComponent("Player",Ae);const An="plugin",ds="activePlugins_",ns={},Dn=s=>ns.hasOwnProperty(s),hn=s=>Dn(s)?ns[s]:void 0,Ph=(s,e)=>{s[ds]=s[ds]||{},s[ds][e]=!0},kn=(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(){kn(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return Ph(this,s),kn(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},fc=(s,e)=>(e.prototype.name=s,function(...t){kn(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,kn(this,i.getEventHash()),i});class Tt{constructor(e){if(this.constructor===Tt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),$o(this),delete this.trigger,Vd(this,this.constructor.defaultState),Ph(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 Ds(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[ds][e]=!1,this.player=this.state=null,t[e]=fc(e,ns[e])}static isBasic(e){const t=typeof e=="string"?hn(e):e;return typeof t=="function"&&!Tt.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(Dn(e))be.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ae.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 ns[e]=t,e!==An&&(Tt.isBasic(t)?Ae.prototype[e]=Jy(e,t):Ae.prototype[e]=fc(e,t)),t}static deregisterPlugin(e){if(e===An)throw new Error("Cannot de-register base plugin.");Dn(e)&&(delete ns[e],delete Ae.prototype[e])}static getPlugins(e=Object.keys(ns)){let t;return e.forEach(i=>{const r=hn(i);r&&(t=t||{},t[i]=r)}),t}static getPluginVersion(e){const t=hn(e);return t&&t.VERSION||""}}Tt.getPlugin=hn;Tt.BASE_PLUGIN_NAME=An;Tt.registerPlugin(An,Tt);Ae.prototype.usingPlugin=function(s){return!!this[ds]&&this[ds][s]===!0};Ae.prototype.hasPlugin=function(s){return!!Dn(s)};function Zy(s,e){let t=!1;return function(...i){return t||be.warn(s),t=!0,e.apply(this,i)}}function qt(s,e,t,i){return Zy(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var eT={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 Lh=s=>s.indexOf("#")===0?s.slice(1):s;function $(s,e,t){let i=$.getPlayer(s);if(i)return e&&be.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const r=typeof s=="string"?Ai("#"+Lh(s)):s;if(!As(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))&&be.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)),wi("beforesetup").forEach(l=>{const f=l(r,Ie(e));if(!ei(f)||Array.isArray(f)){be.error("please return an object in beforesetup hooks");return}e=Ie(e,f)});const u=Y.getComponent("Player");return i=new u(r,e,t),wi("setup").forEach(l=>l(i)),i}$.hooks_=oi;$.hooks=wi;$.hook=R_;$.hookOnce=N_;$.removeHook=pd;if(D.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&ws()){let s=Ai(".vjs-styles-defaults");if(!s){s=Fd("vjs-styles-defaults");const e=Ai("head");e&&e.insertBefore(s,e.firstChild),Ud(s,`
|
|
171
|
+
`),this.tech_}version(){return{"video.js":ro}}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=cy(this,t)),this.cache_.source=Ie({},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=Si(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()?Yt(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()&&!ne.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=ne[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 ny)return sy(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 be(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in ry)return iy(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?(be(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(be(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(be(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Yt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(Hn||ot);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&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 Gd(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,m){n(),r(m)}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=ne[this.fsApi_.exitFullscreen]();return e&&Yt(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=ne.documentElement.style.overflow,Et(ne,"keydown",this.boundFullWindowOnEscKey_),ne.documentElement.style.overflow="hidden",Vi(ne.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,ut(ne,"keydown",this.boundFullWindowOnEscKey_),ne.documentElement.style.overflow=this.docOrigOverflow,zn(ne.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=ne.createElement(this.el().tagName);return e.classList=this.el().classList,e.classList.add("vjs-pip-container"),this.posterImage&&e.appendChild(this.posterImage.el().cloneNode(!0)),this.titleBar&&e.appendChild(this.titleBar.el().cloneNode(!0)),e.appendChild(me("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),D.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Od(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 ne&&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 ne)return ne.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=Y.getComponent("FullscreenToggle");ne[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),Y.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),Y.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=Y.getComponent(n)),!a){be.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():(be.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,l,f){let m;return u.some(_=>l.some(w=>{if(m=f(_,w),m)return!0})),m};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=Jd(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]),ey(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}ty(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?$d(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();Yt(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}),ci(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(wi("beforeerror").forEach(t=>{const i=t(this,e);if(!(ei(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"),be.error(`(CODE:${this.error_.code} ${qe.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),wi("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=Re(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&&!ot&&!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 m=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(m,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(),ci(this)&&this.trigger("languagechange"))}languages(){return Ie(Ae.prototype.options_.languages,this.languages_)}toJSON(){const e=Ie(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let r=t[i];r=Ie(r),r.player=void 0,e.tracks[i]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new ks(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<go.length;i++){const r=go[i],n=this.breakpoints_[r];if(t<=n){if(e===r)return;e&&this.removeClass(dn[e]),this.addClass(dn[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 dn[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=Ie(e);const{artist:r,artwork:n,description:a,poster:u,src:l,textTracks:f,title:m}=this.cache_.media;!n&&u&&(this.cache_.media.artwork=[{src:u,type:wn(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:m,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:wn(r.poster)}]),r}return Ie(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Si(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){be.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(Si(l)):f==="track"&&t.tracks.push(Si(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"))}}Ae.prototype.videoTracks=()=>{};Ae.prototype.audioTracks=()=>{};Ae.prototype.textTracks=()=>{};Ae.prototype.remoteTextTracks=()=>{};Ae.prototype.remoteTextTrackEls=()=>{};pt.names.forEach(function(s){const e=pt[s];Ae.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ae.prototype.crossorigin=Ae.prototype.crossOrigin;Ae.players={};const sr=D.navigator;Ae.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:sr&&(sr.languages&&sr.languages[0]||sr.userLanguage||sr.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};Dh.forEach(function(s){Ae.prototype[`handleTech${ze(s)}_`]=function(){return this.trigger(s)}});Y.registerComponent("Player",Ae);const An="plugin",ds="activePlugins_",ns={},Dn=s=>ns.hasOwnProperty(s),hn=s=>Dn(s)?ns[s]:void 0,kh=(s,e)=>{s[ds]=s[ds]||{},s[ds][e]=!0},kn=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},Vy=function(s,e){const t=function(){kn(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return kh(this,s),kn(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){kn(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,kn(this,i.getEventHash()),i});class Tt{constructor(e){if(this.constructor===Tt)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,qd(this,this.constructor.defaultState),kh(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 Ds(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[ds][e]=!1,this.player=this.state=null,t[e]=hc(e,ns[e])}static isBasic(e){const t=typeof e=="string"?hn(e):e;return typeof t=="function"&&!Tt.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(Dn(e))be.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ae.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 ns[e]=t,e!==An&&(Tt.isBasic(t)?Ae.prototype[e]=Vy(e,t):Ae.prototype[e]=hc(e,t)),t}static deregisterPlugin(e){if(e===An)throw new Error("Cannot de-register base plugin.");Dn(e)&&(delete ns[e],delete Ae.prototype[e])}static getPlugins(e=Object.keys(ns)){let t;return e.forEach(i=>{const r=hn(i);r&&(t=t||{},t[i]=r)}),t}static getPluginVersion(e){const t=hn(e);return t&&t.VERSION||""}}Tt.getPlugin=hn;Tt.BASE_PLUGIN_NAME=An;Tt.registerPlugin(An,Tt);Ae.prototype.usingPlugin=function(s){return!!this[ds]&&this[ds][s]===!0};Ae.prototype.hasPlugin=function(s){return!!Dn(s)};function Hy(s,e){let t=!1;return function(...i){return t||be.warn(s),t=!0,e.apply(this,i)}}function qt(s,e,t,i){return Hy(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var zy={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 Ih=s=>s.indexOf("#")===0?s.slice(1):s;function $(s,e,t){let i=$.getPlayer(s);if(i)return e&&be.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const r=typeof s=="string"?Ai("#"+Ih(s)):s;if(!As(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))&&be.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)),wi("beforesetup").forEach(l=>{const f=l(r,Ie(e));if(!ei(f)||Array.isArray(f)){be.error("please return an object in beforesetup hooks");return}e=Ie(e,f)});const u=Y.getComponent("Player");return i=new u(r,e,t),wi("setup").forEach(l=>l(i)),i}$.hooks_=oi;$.hooks=wi;$.hook=C_;$.hookOnce=w_;$.removeHook=hd;if(D.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&ws()){let s=Ai(".vjs-styles-defaults");if(!s){s=Md("vjs-styles-defaults");const e=Ai("head");e&&e.insertBefore(s,e.firstChild),Bd(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
|
+
`)}}uo(1,$);$.VERSION=ro;$.options=Ae.prototype.options_;$.getPlayers=()=>Ae.players;$.getPlayer=s=>{const e=Ae.players;let t;if(typeof s=="string"){const i=Ih(s),r=e[i];if(r)return r;t=Ai("#"+i)}else t=s;if(As(t)){const{player:i,playerId:r}=t;if(i||e[r])return i||e[r]}};$.getAllPlayers=()=>Object.keys(Ae.players).map(s=>Ae.players[s]).filter(Boolean);$.players=Ae.players;$.getComponent=Y.getComponent;$.registerComponent=(s,e)=>(ye.isTech(e)&&be.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),Y.registerComponent.call(Y,s,e));$.getTech=ye.getTech;$.registerTech=ye.registerTech;$.use=Z_;Object.defineProperty($,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty($.middleware,"TERMINATOR",{value:Cn,writeable:!1,enumerable:!0});$.browser=bd;$.obj=k_;$.mergeOptions=qt(9,"videojs.mergeOptions","videojs.obj.merge",Ie);$.defineLazyProperty=qt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",jn);$.bind=qt(9,"videojs.bind","native Function.prototype.bind",Re);$.registerPlugin=Tt.registerPlugin;$.deregisterPlugin=Tt.deregisterPlugin;$.plugin=(s,e)=>(be.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Tt.registerPlugin(s,e));$.getPlugins=Tt.getPlugins;$.getPlugin=Tt.getPlugin;$.getPluginVersion=Tt.getPluginVersion;$.addLanguage=function(s,e){return s=(""+s).toLowerCase(),$.options.languages=Ie($.options.languages,{[s]:e}),$.options.languages[s]};$.log=be;$.createLogger=fd;$.time=H_;$.createTimeRange=qt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ut);$.createTimeRanges=qt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ut);$.formatTime=qt(9,"videojs.formatTime","videojs.time.formatTime",Wi);$.setFormatTime=qt(9,"videojs.setFormatTime","videojs.time.setFormatTime",Hd);$.resetFormatTime=qt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",zd);$.parseUrl=qt(9,"videojs.parseUrl","videojs.url.parseUrl",zo);$.isCrossOrigin=qt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Jn);$.EventTarget=Ct;$.any=jo;$.on=Et;$.one=Yn;$.off=ut;$.trigger=Ds;$.xhr=Qc;$.TrackList=Xi;$.TextTrack=xr;$.TextTrackList=Vo;$.AudioTrack=Yd;$.AudioTrackList=Wd;$.VideoTrack=Qd;$.VideoTrackList=Xd;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{$[s]=function(){return be.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Rd[s].apply(null,arguments)}});$.computedStyle=qt(9,"videojs.computedStyle","videojs.dom.computedStyle",Es);$.dom=Rd;$.fn=F_;$.num=vy;$.str=$_;$.url=Q_;$.Error=zy;class Gy{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 In extends $.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 Gy(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}}In.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const s in In.prototype.allowedEvents_)In.prototype["on"+s]=null;var Ph="4.1.0";const Wy=function(s,e){const t=s.qualityLevels,i=new In,r=function(){i.dispose(),s.qualityLevels=t,s.off("dispose",r)};return s.on("dispose",r),s.qualityLevels=()=>i,s.qualityLevels.VERSION=Ph,i},Lh=function(s){return Wy(this,$.obj.merge({},s))};$.registerPlugin("qualityLevels",Lh);Lh.VERSION=Ph;const _t=Mn,Pn=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,Rt=s=>$.log.debug?$.log.debug.bind($,"VHS:",`${s} >`):function(){};function De(...s){const e=$.obj||$;return(e.merge||e.mergeOptions).apply(e,s)}function st(...s){const e=$.time||$;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function Xy(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 Qt=1/30,Jt=Qt*3,Nh=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 st(t)},as=function(s,e){return Nh(s,function(t,i){return t-Jt<=e&&i+Jt>=e})},an=function(s,e){return Nh(s,function(t){return t-Qt>=e})},rT=function(s){if(s.length<2)return st();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 st(e)},nT=function(s,e){let t=null,i=null,r=0;const n=[],a=[];if(!s||!s.length||!e||!e.length)return st();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 st(a)},Mh=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(", ")},aT=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},oT=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},Qa=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},lu=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},cu=(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},yo=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||[]},Fh=({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},Uh=(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},uT=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+=cu(s,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},lT=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+=cu(s,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},jh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=uT(s,e);if(i.precise)return i.result;const r=lT(s,e);return r.precise?r.result:i.result+t},qh=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 jh(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},$h=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return qh(s);if(e===null)return null;e=e||0;let r=jh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Uh(null,s),r-=i),Math.max(0,r)},cT=function(s,e,t){const r=e||0;let n=$h(s,e,!0,t);return n===null?st():(n<r&&(n=r),st(r,n))},dT=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:r,exactManifestTimings:n}){let a=e-r;const u=yo(s);let l=0;for(let f=0;f<u.length;f++){const m=u[f];if(t===m.segmentIndex&&!(typeof i=="number"&&typeof m.partIndex=="number"&&i!==m.partIndex)){l=f;break}}if(a<0){if(l>0)for(let f=l-1;f>=0;f--){const m=u[f];if(a+=m.duration,n){if(a<0)continue}else if(a+Qt<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.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 m=u[f];a-=m.duration;const _=m.duration>Qt,w=a===0,x=_&&a+Qt>=0;if(!((w||x)&&f!==u.length-1)){if(n){if(a>0)continue}else if(a-Qt>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.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}},Vh=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},du=function(s){return s.excludeUntil&&s.excludeUntil===1/0},sa=function(s){const e=Vh(s);return!s.disabled&&!e},hT=function(s){return s.disabled},fT=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},Hh=function(s,e){return e.attributes&&e.attributes[s]},pT=function(s,e,t,i=0){return Hh("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-i*8)/e:NaN},To=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>sa(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},hu=(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),pc=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},wr=s=>{if(!s||!s.playlists||!s.playlists.length)return pc(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=>id(n))||pc(s,n=>hu(t,n))))return!1}return!0};var yt={liveEdgeDelay:Uh,duration:qh,seekable:cT,getMediaInfoForTime:dT,isEnabled:sa,isDisabled:hT,isExcluded:Vh,isIncompatible:du,playlistEnd:$h,isAes:fT,hasAttribute:Hh,estimateSegmentRequestTime:pT,isLowestEnabledRendition:To,isAudioOnly:wr,playlistMatch:hu,segmentDurationWithParts:cu};const{log:zh}=$,hs=(s,e)=>`${s}-${e}`,Gh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,mT=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:r=[],llhls:n})=>{const a=new i0;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(m){f.hasOwnProperty(m)&&delete f[m]})})),!u.targetDuration){let f=10;u.segments&&u.segments.length&&(f=u.segments.reduce((m,_)=>Math.max(m,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${f}`}),u.targetDuration=f}const l=Bh(u);if(l.length&&!u.partTargetDuration){const f=l.reduce((m,_)=>Math.max(m,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${f}`}),zh.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},Ls=(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)}})},Wh=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},gT=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];Wh({playlist:t,id:hs(e,t.uri)}),t.resolvedUri=_t(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||zh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},_T=s=>{Ls(s,e=>{e.uri&&(e.resolvedUri=_t(s.uri,e.uri))})},yT=(s,e)=>{const t=hs(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},Xh=(s,e,t=Gh)=>{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=wr(s);Ls(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=[Ke({},r)]}r.playlists.forEach(function(l,f){const m=t(n,a,u,l),_=hs(f,m);l.uri?l.resolvedUri=l.resolvedUri||_t(s.uri,l.uri):(l.uri=f===0?m:_,l.resolvedUri=l.uri),l.id=l.id||_,l.attributes=l.attributes||{},s.playlists[l.id]=l,s.playlists[l.uri]=l})}),gT(s),_T(s)};class mc{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 Kh=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=Ke({},t),a.errorType=$.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=$.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=$.Error.NetworkRequestTimeout;else if(u){const l=i?$.Error.NetworkBodyParserFailed:$.Error.NetworkBadStatus;a.errorType=l,a.status=e.status,a.headers=e.headers}return a},TT=Rt("CodecUtils"),Yh=function(s){const e=s.attributes||{};if(e.CODECS)return Xt(e.CODECS)},Qh=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},vT=(s,e)=>{if(!Qh(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},Tr=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:r})=>{e[t]=e[t]||[],e[t].push(td(`${i}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){TT(`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},gc=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},fr=function(s,e){const t=e.attributes||{},i=Tr(Yh(e)||[]);if(Qh(s,e)&&!i.audio&&!vT(s,e)){const r=Tr(r0(s,t.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},{EventTarget:bT}=$,xT=(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=Fh(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},ST=(s,e)=>{if(!s)return e;const t=De(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]=De(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},ET=(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(ST(l,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},Jh=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=_t(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=_t(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=_t(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=_t(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))})},Zh=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},ef=(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,vo=(s,e,t=ef)=>{const i=De(s,{}),r=i.playlists[e.id];if(!r||t(r,e))return null;e.segments=Zh(e);const n=De(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=ET(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}n.segments.forEach(a=>{Jh(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,Ls(s,(a,u,l,f)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=n)}),i},bo=(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},_c=(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 os extends bT{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 mc,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=_t(this.main.uri,e.uri);this.llhls&&(t=xT(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=mT({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:$.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=Yh(i)||[];return!!Tr(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(),Wh({playlist:a,uri:i,id:r});const u=vo(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_(bo(this.media(),!!u)),n.parsedPlaylist=_c(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 mc,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_(bo(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=Pn(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=Pn(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=_c(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,Xh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=Zh(i),i.segments.forEach(r=>{Jh(r,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||D.location.href;this.main=yT(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),m=hs(r,f),_=this.createCloneAttributes_(r,a.attributes),w=this.createClonePlaylist_(a,m,e,_);i.playlists[n]=w,i.playlists[m]=w,i.playlists[f]=w}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,m)=>{const _=i.playlists[f.id],w=_.id,x=_.resolvedUri;delete i.playlists[w],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=hs(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]=Ke({},l);const f=r.mediaGroups[n][t][u],m=this.createCloneURI_(l.resolvedUri,e);f.resolvedUri=m,f.uri=m,f.playlists=[],l.playlists.forEach((_,w)=>{const x=r.playlists[_.id],P=Gh(n,t,u),T=hs(t,P);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[w]=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),De(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 xo=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)},CT=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},wT=(s,e,t,i)=>{!s||!s.size||s.forEach(r=>{r(e,t,i)})},tf=function(){const s=function e(t,i){t=De({timeout:45e3},t);const r=e.beforeRequest||$.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||$.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||$.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&($.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(r));const u=$.Vhs.xhr.original===!0?$.xhr:$.Vhs.xhr,l=CT(n,t);n.delete(r);const f=u(l||t,function(_,w){return wT(a,f,_,w),xo(f,_,w,i)}),m=f.abort;return f.abort=function(){return f.aborted=!0,m.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return s.original=!0,s},AT=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},So=function(s){const e={};return s.byterange&&(e.Range=AT(s.byterange)),e},DT=function(s,e){return s.start(e)+"-"+s.end(e)},kT=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},IT=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},sf=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];rd(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Ln=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},rf=function(s){return s.resolvedUri},nf=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(kT).join(""),n=e.slice(a*t,a*t+t).map(IT).join(""),i+=r+" "+n+`
|
|
183
|
-
`;return i},PT=({bytes:s})=>nf(s),LT=s=>{let e="",t;for(t=0;t<s.length;t++)e+=DT(s,t)+" ";return e};var OT=Object.freeze({__proto__:null,createTransferableMessage:sf,initSegmentId:Ln,segmentKeyId:rf,hexDump:nf,tagDump:PT,textRanges:LT});const af=.25,RT=(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)},NT=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,MT=(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?NT(r.videoTimingInfo):r.duration+r.duration*af,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:yt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},BT=(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*af)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},FT=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const r=t.getTime();return(i.getTime()-r)/1e3},UT=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},jT=({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=BT(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=RT(e,i.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},of=({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(!UT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=MT(s,e);if(!u)return a({message:`${s} was not found in the stream`});const l=u.segment,f=FT(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",()=>{of({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:r,tech:n,callback:a})});return}const m=l.start+f,_=()=>a(null,n.currentTime());n.one("seeked",_),r&&n.pause(),i(m)},Ja=(s,e)=>{if(s.readyState===4)return e()},qT=(s,e,t,i)=>{let r=[],n,a=!1;const u=function(_,w,x,P){return w.abort(),a=!0,t(_,w,x,P)},l=function(_,w){if(a)return;if(_)return _.metadata=Gi({requestType:i,request:w,error:_}),u(_,w,"",r);const x=w.responseText.substring(r&&r.byteLength||0,w.responseText.length);if(r=p0(r,nd(x,!0)),n=n||nr(r),r.length<10||n&&r.length<n+2)return Ja(w,()=>u(_,w,"",r));const P=Mo(r);return P==="ts"&&r.length<188?Ja(w,()=>u(_,w,"",r)):!P&&r.length<376?Ja(w,()=>u(_,w,"",r)):u(null,w,P,r)},m=e({uri:s,beforeSend(_){_.overrideMimeType("text/plain; charset=x-user-defined"),_.addEventListener("progress",function({total:w,loaded:x}){return xo(_,null,{statusCode:_.status},l)})}},function(_,w){return xo(m,_,w,l)});return m},{EventTarget:$T}=$,yc=function(s,e){if(!ef(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},VT=(s,e,t,i)=>{const r=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},HT=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:r})=>{const n=h_(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:r});return Xh(n,e,VT),n},zT=(s,e)=>{Ls(s,(t,i,r,n)=>{(!e.mediaGroups[i][r]||!(n in e.mediaGroups[i][r]))&&delete s.mediaGroups[i][r][n]})},GT=(s,e,t)=>{let i=!0,r=De(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=Un(a.sidx);t&&t[l]&&t[l].sidx&&Oo(a,t[l].sidx,a.sidx.resolvedUri)}const u=vo(r,a,yc);u&&(r=u,i=!1)}return Ls(e,(n,a,u,l)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,m=vo(r,n.playlists[0],yc);m&&(r=m,l in r.mediaGroups[a][u]||(r.mediaGroups[a][u][l]=n),r.mediaGroups[a][u][l].playlists[0]=r.playlists[f],i=!1)}}),zT(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:r},WT=(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,Tc=(s,e)=>{const t={};for(const i in s){const n=s[i].sidx;if(n){const a=Un(n);if(!e[a])break;const u=e[a].sidxInfo;WT(u,n)&&(t[a]=e[a])}}return t},XT=(s,e)=>{let i=Tc(s.playlists,e);return Ls(s,(r,n,a,u)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;i=De(i,Tc(l,e))}}),i};class Eo extends $T{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&&Un(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=D.setTimeout(()=>i(!1),0);return}const n=Pn(e.sidx.resolvedUri),a=(l,f)=>{if(this.requestErrored_(l,f,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=f;let w;try{w=__(fe(f.response).subarray(8))}catch(x){x.metadata=Gi({requestType:_,request:f,parseFailure:!0}),this.requestErrored_(x,f,t);return}return m[r]={sidxInfo:e.sidx,sidx:w},Oo(e,w,e.sidx.resolvedUri),i(!0)},u="dash-sidx";this.request=qT(n,this.vhs_.xhr,(l,f,m,_)=>{if(l)return a(l,f);if(!m||m!=="mp4"){const P=m||"unknown";return a({status:f.status,message:`Unsupported ${P} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:w,length:x}=e.sidx.byterange;if(_.length>=x+w)return a(l,{response:_.subarray(w,w+x),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:So({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=Pn(this.mainPlaylistLoader_.srcUrl,r),n){this.handleMain_(),this.syncClientServerClock_(()=>e(r,n));return}return e(r,n)})}syncClientServerClock_(e){const t=f_(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:_t(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=HT({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:$.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(i=GT(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_=XT(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()},bo(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 tt={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const KT=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},uf=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},YT=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())}},lf=function(s){return function(){const e=YT(s),t=uf(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}},cf=function(s){return`var browserWorkerPolyFill = ${uf.toString()};
|
|
182
|
+
`}return e}const Qt=1/30,Jt=Qt*3,Oh=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 st(t)},as=function(s,e){return Oh(s,function(t,i){return t-Jt<=e&&i+Jt>=e})},an=function(s,e){return Oh(s,function(t){return t-Qt>=e})},Ky=function(s){if(s.length<2)return st();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 st(e)},Yy=function(s,e){let t=null,i=null,r=0;const n=[],a=[];if(!s||!s.length||!e||!e.length)return st();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 st(a)},Rh=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(", ")},Qy=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},Jy=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},Ya=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},_o=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),[]),Nh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Mh=({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},Bh=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Nh(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},Zy=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}},eT=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}},Fh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=Zy(s,e);if(i.precise)return i.result;const r=eT(s,e);return r.precise?r.result:i.result+t},Uh=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 Fh(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},jh=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return Uh(s);if(e===null)return null;e=e||0;let r=Fh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Bh(null,s),r-=i),Math.max(0,r)},tT=function(s,e,t){const r=e||0;let n=jh(s,e,!0,t);return n===null?st():(n<r&&(n=r),st(r,n))},iT=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:r,exactManifestTimings:n}){let a=e-r;const u=_o(s);let l=0;for(let f=0;f<u.length;f++){const m=u[f];if(t===m.segmentIndex&&!(typeof i=="number"&&typeof m.partIndex=="number"&&i!==m.partIndex)){l=f;break}}if(a<0){if(l>0)for(let f=l-1;f>=0;f--){const m=u[f];if(a+=m.duration,n){if(a<0)continue}else if(a+Qt<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.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 m=u[f];a-=m.duration;const _=m.duration>Qt,w=a===0,x=_&&a+Qt>=0;if(!((w||x)&&f!==u.length-1)){if(n){if(a>0)continue}else if(a-Qt>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.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}},qh=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},cu=function(s){return s.excludeUntil&&s.excludeUntil===1/0},ia=function(s){const e=qh(s);return!s.disabled&&!e},sT=function(s){return s.disabled},rT=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},$h=function(s,e){return e.attributes&&e.attributes[s]},nT=function(s,e,t,i=0){return $h("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-i*8)/e:NaN},yo=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>ia(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},wr=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=>ed(n))||fc(s,n=>du(t,n))))return!1}return!0};var yt={liveEdgeDelay:Bh,duration:Uh,seekable:tT,getMediaInfoForTime:iT,isEnabled:ia,isDisabled:sT,isExcluded:qh,isIncompatible:cu,playlistEnd:jh,isAes:rT,hasAttribute:$h,estimateSegmentRequestTime:nT,isLowestEnabledRendition:yo,isAudioOnly:wr,playlistMatch:du,segmentDurationWithParts:lu};const{log:Vh}=$,hs=(s,e)=>`${s}-${e}`,Hh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,aT=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:r=[],llhls:n})=>{const a=new Wg;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(m){f.hasOwnProperty(m)&&delete f[m]})})),!u.targetDuration){let f=10;u.segments&&u.segments.length&&(f=u.segments.reduce((m,_)=>Math.max(m,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${f}`}),u.targetDuration=f}const l=Nh(u);if(l.length&&!u.partTargetDuration){const f=l.reduce((m,_)=>Math.max(m,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${f}`}),Vh.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},Ls=(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)}})},zh=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},oT=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];zh({playlist:t,id:hs(e,t.uri)}),t.resolvedUri=_t(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||Vh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},uT=s=>{Ls(s,e=>{e.uri&&(e.resolvedUri=_t(s.uri,e.uri))})},lT=(s,e)=>{const t=hs(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},Gh=(s,e,t=Hh)=>{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=wr(s);Ls(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=[Ke({},r)]}r.playlists.forEach(function(l,f){const m=t(n,a,u,l),_=hs(f,m);l.uri?l.resolvedUri=l.resolvedUri||_t(s.uri,l.uri):(l.uri=f===0?m:_,l.resolvedUri=l.uri),l.id=l.id||_,l.attributes=l.attributes||{},s.playlists[l.id]=l,s.playlists[l.uri]=l})}),oT(s),uT(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 Wh=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=Ke({},t),a.errorType=$.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=$.Error.NetworkRequestAborted;else if(e.timedout)a.errorType=$.Error.NetworkRequestTimeout;else if(u){const l=i?$.Error.NetworkBodyParserFailed:$.Error.NetworkBadStatus;a.errorType=l,a.status=e.status,a.headers=e.headers}return a},cT=Rt("CodecUtils"),Xh=function(s){const e=s.attributes||{};if(e.CODECS)return Xt(e.CODECS)},Kh=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},dT=(s,e)=>{if(!Kh(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},Tr=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:r})=>{e[t]=e[t]||[],e[t].push(Zc(`${i}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){cT(`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=Tr(Xh(e)||[]);if(Kh(s,e)&&!i.audio&&!dT(s,e)){const r=Tr(Kg(s,t.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},{EventTarget:hT}=$,fT=(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=Mh(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},pT=(s,e)=>{if(!s)return e;const t=De(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]=De(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},mT=(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(pT(l,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},Yh=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=_t(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=_t(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=_t(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=_t(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))})},Qh=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},Jh=(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,To=(s,e,t=Jh)=>{const i=De(s,{}),r=i.playlists[e.id];if(!r||t(r,e))return null;e.segments=Qh(e);const n=De(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=mT(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}n.segments.forEach(a=>{Yh(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,Ls(s,(a,u,l,f)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=n)}),i},vo=(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 os extends hT{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=_t(this.main.uri,e.uri);this.llhls&&(t=fT(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=aT({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:$.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=Xh(i)||[];return!!Tr(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(),zh({playlist:a,uri:i,id:r});const u=To(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_(vo(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_(vo(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=Pn(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=Pn(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,Gh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=Qh(i),i.segments.forEach(r=>{Yh(r,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||D.location.href;this.main=lT(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),m=hs(r,f),_=this.createCloneAttributes_(r,a.attributes),w=this.createClonePlaylist_(a,m,e,_);i.playlists[n]=w,i.playlists[m]=w,i.playlists[f]=w}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,m)=>{const _=i.playlists[f.id],w=_.id,x=_.resolvedUri;delete i.playlists[w],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=hs(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]=Ke({},l);const f=r.mediaGroups[n][t][u],m=this.createCloneURI_(l.resolvedUri,e);f.resolvedUri=m,f.uri=m,f.playlists=[],l.playlists.forEach((_,w)=>{const x=r.playlists[_.id],P=Hh(n,t,u),T=hs(t,P);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[w]=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),De(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 bo=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)},gT=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},_T=(s,e,t,i)=>{!s||!s.size||s.forEach(r=>{r(e,t,i)})},Zh=function(){const s=function e(t,i){t=De({timeout:45e3},t);const r=e.beforeRequest||$.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||$.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||$.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&($.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(r));const u=$.Vhs.xhr.original===!0?$.xhr:$.Vhs.xhr,l=gT(n,t);n.delete(r);const f=u(l||t,function(_,w){return _T(a,f,_,w),bo(f,_,w,i)}),m=f.abort;return f.abort=function(){return f.aborted=!0,m.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return s.original=!0,s},yT=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},xo=function(s){const e={};return s.byterange&&(e.Range=yT(s.byterange)),e},TT=function(s,e){return s.start(e)+"-"+s.end(e)},vT=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},bT=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},ef=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];id(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Ln=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},tf=function(s){return s.resolvedUri},sf=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(vT).join(""),n=e.slice(a*t,a*t+t).map(bT).join(""),i+=r+" "+n+`
|
|
183
|
+
`;return i},xT=({bytes:s})=>sf(s),ST=s=>{let e="",t;for(t=0;t<s.length;t++)e+=TT(s,t)+" ";return e};var ET=Object.freeze({__proto__:null,createTransferableMessage:ef,initSegmentId:Ln,segmentKeyId:tf,hexDump:sf,tagDump:xT,textRanges:ST});const rf=.25,CT=(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)},wT=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,AT=(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?wT(r.videoTimingInfo):r.duration+r.duration*rf,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:yt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},DT=(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*rf)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},kT=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const r=t.getTime();return(i.getTime()-r)/1e3},IT=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},PT=({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=DT(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=CT(e,i.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},nf=({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(!IT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=AT(s,e);if(!u)return a({message:`${s} was not found in the stream`});const l=u.segment,f=kT(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",()=>{nf({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:r,tech:n,callback:a})});return}const m=l.start+f,_=()=>a(null,n.currentTime());n.one("seeked",_),r&&n.pause(),i(m)},Qa=(s,e)=>{if(s.readyState===4)return e()},LT=(s,e,t,i)=>{let r=[],n,a=!1;const u=function(_,w,x,P){return w.abort(),a=!0,t(_,w,x,P)},l=function(_,w){if(a)return;if(_)return _.metadata=Gi({requestType:i,request:w,error:_}),u(_,w,"",r);const x=w.responseText.substring(r&&r.byteLength||0,w.responseText.length);if(r=n0(r,sd(x,!0)),n=n||nr(r),r.length<10||n&&r.length<n+2)return Qa(w,()=>u(_,w,"",r));const P=No(r);return P==="ts"&&r.length<188?Qa(w,()=>u(_,w,"",r)):!P&&r.length<376?Qa(w,()=>u(_,w,"",r)):u(null,w,P,r)},m=e({uri:s,beforeSend(_){_.overrideMimeType("text/plain; charset=x-user-defined"),_.addEventListener("progress",function({total:w,loaded:x}){return bo(_,null,{statusCode:_.status},l)})}},function(_,w){return bo(m,_,w,l)});return m},{EventTarget:OT}=$,_c=function(s,e){if(!Jh(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},RT=(s,e,t,i)=>{const r=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},NT=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:r})=>{const n=s_(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:r});return Gh(n,e,RT),n},MT=(s,e)=>{Ls(s,(t,i,r,n)=>{(!e.mediaGroups[i][r]||!(n in e.mediaGroups[i][r]))&&delete s.mediaGroups[i][r][n]})},BT=(s,e,t)=>{let i=!0,r=De(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=Fn(a.sidx);t&&t[l]&&t[l].sidx&&Lo(a,t[l].sidx,a.sidx.resolvedUri)}const u=To(r,a,_c);u&&(r=u,i=!1)}return Ls(e,(n,a,u,l)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,m=To(r,n.playlists[0],_c);m&&(r=m,l in r.mediaGroups[a][u]||(r.mediaGroups[a][u][l]=n),r.mediaGroups[a][u][l].playlists[0]=r.playlists[f],i=!1)}}),MT(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,yc=(s,e)=>{const t={};for(const i in s){const n=s[i].sidx;if(n){const a=Fn(n);if(!e[a])break;const u=e[a].sidxInfo;FT(u,n)&&(t[a]=e[a])}}return t},UT=(s,e)=>{let i=yc(s.playlists,e);return Ls(s,(r,n,a,u)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;i=De(i,yc(l,e))}}),i};class So extends OT{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&&Fn(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){D.clearTimeout(this.mediaRequest_),this.mediaRequest_=D.setTimeout(()=>i(!1),0);return}const n=Pn(e.sidx.resolvedUri),a=(l,f)=>{if(this.requestErrored_(l,f,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=f;let w;try{w=u_(fe(f.response).subarray(8))}catch(x){x.metadata=Gi({requestType:_,request:f,parseFailure:!0}),this.requestErrored_(x,f,t);return}return m[r]={sidxInfo:e.sidx,sidx:w},Lo(e,w,e.sidx.resolvedUri),i(!0)},u="dash-sidx";this.request=LT(n,this.vhs_.xhr,(l,f,m,_)=>{if(l)return a(l,f);if(!m||m!=="mp4"){const P=m||"unknown";return a({status:f.status,message:`Unsupported ${P} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:w,length:x}=e.sidx.byterange;if(_.length>=x+w)return a(l,{response:_.subarray(w,w+x),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:xo({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=Pn(this.mainPlaylistLoader_.srcUrl,r),n){this.handleMain_(),this.syncClientServerClock_(()=>e(r,n));return}return e(r,n)})}syncClientServerClock_(e){const t=r_(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:_t(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=NT({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:$.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(i=BT(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_=UT(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()},vo(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 tt={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 jT=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},af=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},qT=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())}},of=function(s){return function(){const e=qT(s),t=af(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}},uf=function(s){return`var browserWorkerPolyFill = ${af.toString()};
|
|
184
184
|
browserWorkerPolyFill(self);
|
|
185
|
-
`+s},df=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},QT=cf(df(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,g;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(g=[],d=arguments.length,d=1;d<arguments.length;++d)g.push(arguments[d]);for(p=h.length,d=0;d<p;++d)h[d].apply(this,g)}},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,m,_,w,x,P,T,I,M,N,O,F,j,U,R,G,v,E,V,H,q,K,te,ie,W,Z,ee,re,se,ce,de,_e,pe,$e;(function(){var o;if(q={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 q)q.hasOwnProperty(o)&&(q[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);K=new Uint8Array([105,115,111,109]),ie=new Uint8Array([97,118,99,49]),te=new Uint8Array([0,0,0,1]),W=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]),ee={video:W,audio:Z},ce=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),se=new Uint8Array([0,0,0,0,0,0,0,0]),de=new Uint8Array([0,0,0,0,0,0,0,0]),_e=de,pe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),$e=de,re=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),u=function(o){var c=[],h=0,d,p,g;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),g=new DataView(p.buffer,p.byteOffset,p.byteLength),g.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(q.dinf,u(q.dref,ce))},f=function(o){return u(q.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]))},m=function(){return u(q.ftyp,K,te,K,ie)},U=function(o){return u(q.hdlr,ee[o])},_=function(o){return u(q.mdat,o)},j=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(q.mdhd,c)},F=function(o){return u(q.mdia,j(o),U(o.type),x(o))},w=function(o){return u(q.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},x=function(o){return u(q.minf,o.type==="video"?u(q.vmhd,re):u(q.smhd,se),l(),G(o))},P=function(o,c){for(var h=[],d=c.length;d--;)h[d]=E(c[d]);return u.apply(null,[q.moof,w(o)].concat(h))},T=function(o){for(var c=o.length,h=[];c--;)h[c]=N(o[c]);return u.apply(null,[q.moov,M(4294967295)].concat(h).concat(I(o)))},I=function(o){for(var c=o.length,h=[];c--;)h[c]=V(o[c]);return u.apply(null,[q.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(q.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(q.sdtp,h)},G=function(o){return u(q.stbl,v(o),u(q.stts,$e),u(q.stsc,_e),u(q.stsz,pe),u(q.stco,de))},(function(){var o,c;v=function(h){return u(q.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||[],g=[],S=[],C,A;for(C=0;C<d.length;C++)g.push((d[C].byteLength&65280)>>>8),g.push(d[C].byteLength&255),g=g.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(A=[q.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(q.avcC,new Uint8Array([1,h.profileIdc,h.profileCompatibility,h.levelIdc,255].concat([d.length],g,[p.length],S))),u(q.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];A.push(u(q.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,A)},c=function(h){return u(q.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(q.tkhd,c)},E=function(o){var c,h,d,p,g,S,C;return c=u(q.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(q.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])),g=92,o.type==="audio"?(d=H(o,g),u(q.traf,c,h,d)):(p=R(o),d=H(o,p.length+g),u(q.traf,c,h,d,p))},N=function(o){return o.duration=o.duration||4294967295,u(q.trak,O(o),F(o))},V=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(q.trex,c)},(function(){var o,c,h;h=function(d,p){var g=0,S=0,C=0,A=0;return d.length&&(d[0].duration!==void 0&&(g=1),d[0].size!==void 0&&(S=2),d[0].flags!==void 0&&(C=4),d[0].compositionTimeOffset!==void 0&&(A=8)),[0,0,g|S|C|A,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 g,S,C,A,k,B;for(A=d.samples||[],p+=20+16*A.length,C=h(A,p),S=new Uint8Array(C.length+A.length*16),S.set(C),g=C.length,B=0;B<A.length;B++)k=A[B],S[g++]=(k.duration&4278190080)>>>24,S[g++]=(k.duration&16711680)>>>16,S[g++]=(k.duration&65280)>>>8,S[g++]=k.duration&255,S[g++]=(k.size&4278190080)>>>24,S[g++]=(k.size&16711680)>>>16,S[g++]=(k.size&65280)>>>8,S[g++]=k.size&255,S[g++]=k.flags.isLeading<<2|k.flags.dependsOn,S[g++]=k.flags.isDependedOn<<6|k.flags.hasRedundancy<<4|k.flags.paddingValue<<1|k.flags.isNonSyncSample,S[g++]=k.flags.degradationPriority&61440,S[g++]=k.flags.degradationPriority&15,S[g++]=(k.compositionTimeOffset&4278190080)>>>24,S[g++]=(k.compositionTimeOffset&16711680)>>>16,S[g++]=(k.compositionTimeOffset&65280)>>>8,S[g++]=k.compositionTimeOffset&255;return u(q.trun,S)},o=function(d,p){var g,S,C,A,k,B;for(A=d.samples||[],p+=20+8*A.length,C=h(A,p),g=new Uint8Array(C.length+A.length*8),g.set(C),S=C.length,B=0;B<A.length;B++)k=A[B],g[S++]=(k.duration&4278190080)>>>24,g[S++]=(k.duration&16711680)>>>16,g[S++]=(k.duration&65280)>>>8,g[S++]=k.duration&255,g[S++]=(k.size&4278190080)>>>24,g[S++]=(k.size&16711680)>>>16,g[S++]=(k.size&65280)>>>8,g[S++]=k.size&255;return u(q.trun,g)},H=function(d,p){return d.type==="audio"?o(d,p):c(d,p)}})();var Je={ftyp:m,mdat:_,moof:P,moov:T,initSegment:function(o){var c=m(),h=T(o),d;return d=new Uint8Array(c.byteLength+h.byteLength),d.set(c),d.set(h,c.byteLength),d}},Ce=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},Ze=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},ct=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},Ye=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},rt=function(o,c){var h=Ye();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},$t=function(o,c){var h,d,p,g,S,C=c||0,A=[];for(h=0;h<o.length;h++)for(g=o[h],d=0;d<g.length;d++)S=g[d],p=rt(S,C),C+=p.size,A.push(p);return A},Ge=function(o){var c,h,d,p,g,S,C=0,A=o.byteLength,k=o.nalCount,B=A+4*k,X=new Uint8Array(B),oe=new DataView(X.buffer);for(c=0;c<o.length;c++)for(p=o[c],h=0;h<p.length;h++)for(g=p[h],d=0;d<g.length;d++)S=g[d],oe.setUint32(C,S.data.byteLength),C+=4,X.set(S.data,C),C+=S.data.byteLength;return X},Vt=function(o,c){var h,d=c||0,p=[];return h=rt(o,d),p.push(h),p},Ve=function(o){var c,h,d=0,p=o.byteLength,g=o.length,S=p+4*g,C=new Uint8Array(S),A=new DataView(C.buffer);for(c=0;c<o.length;c++)h=o[c],A.setUint32(d,h.data.byteLength),d+=4,C.set(h.data,d),d+=h.data.byteLength;return C},xe={groupNalsIntoFrames:Ce,groupFramesIntoGops:Ze,extendFirstKeyFrame:ct,generateSampleTable:$t,concatenateNalData:Ge,generateSampleTableForFrame:Vt,concatenateNalDataForFrame:Ve},Ee=[33,16,5,32,164,27],We=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Te=function(o){for(var c=[];o--;)c.push(0);return c},Le=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},{})},Me,hi=function(){if(!Me){var o={96e3:[Ee,[227,64],Te(154),[56]],88200:[Ee,[231],Te(170),[56]],64e3:[Ee,[248,192],Te(240),[56]],48e3:[Ee,[255,192],Te(268),[55,148,128],Te(54),[112]],44100:[Ee,[255,192],Te(268),[55,163,128],Te(84),[112]],32e3:[Ee,[255,192],Te(268),[55,234],Te(226),[112]],24e3:[Ee,[255,192],Te(268),[55,255,128],Te(268),[111,112],Te(126),[224]],16e3:[Ee,[255,192],Te(268),[55,255,128],Te(268),[111,255],Te(269),[223,108],Te(195),[1,192]],12e3:[We,Te(268),[3,127,248],Te(268),[6,255,240],Te(268),[13,255,224],Te(268),[27,253,128],Te(259),[56]],11025:[We,Te(268),[3,127,248],Te(268),[6,255,240],Te(268),[13,255,224],Te(268),[27,255,192],Te(268),[55,175,128],Te(108),[112]],8e3:[We,Te(268),[3,121,16],Te(47),[7]]};Me=Le(o)}return Me},si=9e4,ki,Ii,fi,pi,Os,Rs,Ki;ki=function(o){return o*si},Ii=function(o,c){return o*c},fi=function(o){return o/si},pi=function(o,c){return o/c},Os=function(o,c){return ki(pi(o,c))},Rs=function(o,c){return Ii(fi(o),c)},Ki=function(o,c,h){return fi(h?o:o-c)};var we={ONE_SECOND_IN_TS:si,secondsToVideoTs:ki,secondsToAudioTs:Ii,videoTsToSeconds:fi,audioTsToSeconds:pi,audioTsToVideoTs:Os,videoTsToAudioTs:Rs,metadataTsToSeconds:Ki},Ns=hi,Pi=we,Ar=function(o){var c,h,d=0;for(c=0;c<o.length;c++)h=o[c],d+=h.data.byteLength;return d},Dr=function(o,c,h,d){var p,g=0,S=0,C=0,A=0,k,B,X;if(c.length&&(p=Pi.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),g=Math.ceil(Pi.ONE_SECOND_IN_TS/(o.samplerate/1024)),h&&d&&(S=p-Math.max(h,d),C=Math.floor(S/g),A=C*g),!(C<1||A>Pi.ONE_SECOND_IN_TS/2))){for(k=Ns()[o.samplerate],k||(k=c[0].data),B=0;B<C;B++)X=c[0],c.splice(0,0,{data:k,dts:X.dts-g,pts:X.pts-g});return o.baseMediaDecodeTime-=Math.floor(Pi.videoTsToAudioTs(A,o.samplerate)),A}},Ms=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}))},mi=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},kr=function(o){var c,h,d=0,p=new Uint8Array(Ar(o));for(c=0;c<o.length;c++)h=o[c],p.set(h.data,d),d+=h.data.byteLength;return p},Bs={prefixWithSilence:Dr,trimAdtsFramesByEarliestDts:Ms,generateSampleTable:mi,concatenateFrameData:kr},Ir=we.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},L=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/Ir,h*=d,h=Math.floor(h)),h},z={clearDtsInfo:b,calculateTrackBaseMediaDecodeTime:L,collectDtsInfo:y},ae=4,ge=128,Pe=function(o){for(var c=0,h={payloadType:-1,payloadSize:0},d=0,p=0;c<o.byteLength&&o[c]!==ge;){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 g=String.fromCharCode(o[c+3],o[c+4],o[c+5],o[c+6]);if(g==="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},at=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,g,S;if(!(c[0]&64))return h;for(p=c[0]&31,d=0;d<p;d++)g=d*3,S={type:c[g+2]&3,pts:o},c[g+2]&4&&(S.ccData=c[g+3]<<8|c[g+4],h.push(S));return h},Ht=function(o){for(var c=o.byteLength,h=[],d=1,p,g;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,g=new Uint8Array(p);var S=0;for(d=0;d<p;S++,d++)S===h[0]&&(S++,h.shift()),g[d]=o[S];return g},At={parseSei:Pe,parseUserData:at,parseCaptionPackets:vt,discardEmulationPreventionBytes:Ht,USER_DATA_REGISTERED_ITU_T_T35:ae},Nt=t,Dt=At,He=function(o){o=o||{},He.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Be(0,0),new Be(0,1),new Be(1,0),new Be(1,1)],this.parse708captions_&&(this.cc708Stream_=new Se({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")))};He.prototype=new Nt,He.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}},He.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},He.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)},He.prototype.flush=function(){return this.flushStream("flush")},He.prototype.partialFlush=function(){return this.flushStream("partialFlush")},He.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},He.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)},He.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},He.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},He.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},He.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},ri=function(o){var c=kt[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},zt=function(o){return 32<=o&&o<=127||160<=o&&o<=255},Oe=function(o){this.windowNum=o,this.reset()};Oe.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},Oe.prototype.getText=function(){return this.rows.join(`
|
|
186
|
-
`)},Oe.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Oe.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--},Oe.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Oe.prototype.addText=function(o){this.rows[this.rowIdx]+=o},Oe.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 Oe(-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 Oe(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 Se=function(o){o=o||{},Se.prototype.init.call(this);var c=this,h=o.captionServices||{},d={},p;Object.keys(h).forEach(g=>{p=h[g],/^SERVICE/.test(g)&&(d[g]=p.encoding)}),this.serviceEncodings=d,this.current708Packet=null,this.services={},this.push=function(g){g.type===3?(c.new708Packet(),c.add708Bytes(g)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(g))}};Se.prototype=new Nt,Se.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Se.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)},Se.prototype.push708Packet=function(){var o=this.current708Packet,c=o.data,h=null,d=null,p=0,g=c[p++];for(o.seq=g>>6,o.sizeCode=g&63;p<c.length;p++)g=c[p++],h=g>>5,d=g&31,h===7&&d>0&&(g=c[p++],h=g),this.pushServiceBlock(h,p,d),d>0&&(p+=d-1)},Se.prototype.pushServiceBlock=function(o,c,h){var d,p=c,g=this.current708Packet.data,S=this.services[o];for(S||(S=this.initService(o,p));p<c+h&&p<g.length;p++)d=g[p],zt(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++},Se.prototype.extendedCommands=function(o,c){var h=this.current708Packet.data,d=h[++o];return zt(d)&&(o=this.handleText(o,c,{isExtended:!0})),o},Se.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},Se.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(g){h.flushDisplayed(g,h.services[o])}),this.services[o]},Se.prototype.handleText=function(o,c,h){var d=h&&h.isExtended,p=h&&h.isMultiByte,g=this.current708Packet.data,S=d?4096:0,C=g[o],A=g[o+1],k=c.currentWindow,B,X;function oe(
|
|
185
|
+
`+s},lf=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},$T=uf(lf(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,g;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(g=[],d=arguments.length,d=1;d<arguments.length;++d)g.push(arguments[d]);for(p=h.length,d=0;d<p;++d)h[d].apply(this,g)}},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,m,_,w,x,P,T,I,M,N,O,F,j,U,R,G,v,E,V,H,q,K,te,ie,W,Z,ee,re,se,ce,de,_e,pe,$e;(function(){var o;if(q={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 q)q.hasOwnProperty(o)&&(q[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);K=new Uint8Array([105,115,111,109]),ie=new Uint8Array([97,118,99,49]),te=new Uint8Array([0,0,0,1]),W=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]),ee={video:W,audio:Z},ce=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),se=new Uint8Array([0,0,0,0,0,0,0,0]),de=new Uint8Array([0,0,0,0,0,0,0,0]),_e=de,pe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),$e=de,re=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),u=function(o){var c=[],h=0,d,p,g;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),g=new DataView(p.buffer,p.byteOffset,p.byteLength),g.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(q.dinf,u(q.dref,ce))},f=function(o){return u(q.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]))},m=function(){return u(q.ftyp,K,te,K,ie)},U=function(o){return u(q.hdlr,ee[o])},_=function(o){return u(q.mdat,o)},j=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(q.mdhd,c)},F=function(o){return u(q.mdia,j(o),U(o.type),x(o))},w=function(o){return u(q.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},x=function(o){return u(q.minf,o.type==="video"?u(q.vmhd,re):u(q.smhd,se),l(),G(o))},P=function(o,c){for(var h=[],d=c.length;d--;)h[d]=E(c[d]);return u.apply(null,[q.moof,w(o)].concat(h))},T=function(o){for(var c=o.length,h=[];c--;)h[c]=N(o[c]);return u.apply(null,[q.moov,M(4294967295)].concat(h).concat(I(o)))},I=function(o){for(var c=o.length,h=[];c--;)h[c]=V(o[c]);return u.apply(null,[q.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(q.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(q.sdtp,h)},G=function(o){return u(q.stbl,v(o),u(q.stts,$e),u(q.stsc,_e),u(q.stsz,pe),u(q.stco,de))},(function(){var o,c;v=function(h){return u(q.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||[],g=[],S=[],C,A;for(C=0;C<d.length;C++)g.push((d[C].byteLength&65280)>>>8),g.push(d[C].byteLength&255),g=g.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(A=[q.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(q.avcC,new Uint8Array([1,h.profileIdc,h.profileCompatibility,h.levelIdc,255].concat([d.length],g,[p.length],S))),u(q.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];A.push(u(q.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,A)},c=function(h){return u(q.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(q.tkhd,c)},E=function(o){var c,h,d,p,g,S,C;return c=u(q.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(q.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])),g=92,o.type==="audio"?(d=H(o,g),u(q.traf,c,h,d)):(p=R(o),d=H(o,p.length+g),u(q.traf,c,h,d,p))},N=function(o){return o.duration=o.duration||4294967295,u(q.trak,O(o),F(o))},V=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(q.trex,c)},(function(){var o,c,h;h=function(d,p){var g=0,S=0,C=0,A=0;return d.length&&(d[0].duration!==void 0&&(g=1),d[0].size!==void 0&&(S=2),d[0].flags!==void 0&&(C=4),d[0].compositionTimeOffset!==void 0&&(A=8)),[0,0,g|S|C|A,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 g,S,C,A,k,B;for(A=d.samples||[],p+=20+16*A.length,C=h(A,p),S=new Uint8Array(C.length+A.length*16),S.set(C),g=C.length,B=0;B<A.length;B++)k=A[B],S[g++]=(k.duration&4278190080)>>>24,S[g++]=(k.duration&16711680)>>>16,S[g++]=(k.duration&65280)>>>8,S[g++]=k.duration&255,S[g++]=(k.size&4278190080)>>>24,S[g++]=(k.size&16711680)>>>16,S[g++]=(k.size&65280)>>>8,S[g++]=k.size&255,S[g++]=k.flags.isLeading<<2|k.flags.dependsOn,S[g++]=k.flags.isDependedOn<<6|k.flags.hasRedundancy<<4|k.flags.paddingValue<<1|k.flags.isNonSyncSample,S[g++]=k.flags.degradationPriority&61440,S[g++]=k.flags.degradationPriority&15,S[g++]=(k.compositionTimeOffset&4278190080)>>>24,S[g++]=(k.compositionTimeOffset&16711680)>>>16,S[g++]=(k.compositionTimeOffset&65280)>>>8,S[g++]=k.compositionTimeOffset&255;return u(q.trun,S)},o=function(d,p){var g,S,C,A,k,B;for(A=d.samples||[],p+=20+8*A.length,C=h(A,p),g=new Uint8Array(C.length+A.length*8),g.set(C),S=C.length,B=0;B<A.length;B++)k=A[B],g[S++]=(k.duration&4278190080)>>>24,g[S++]=(k.duration&16711680)>>>16,g[S++]=(k.duration&65280)>>>8,g[S++]=k.duration&255,g[S++]=(k.size&4278190080)>>>24,g[S++]=(k.size&16711680)>>>16,g[S++]=(k.size&65280)>>>8,g[S++]=k.size&255;return u(q.trun,g)},H=function(d,p){return d.type==="audio"?o(d,p):c(d,p)}})();var Je={ftyp:m,mdat:_,moof:P,moov:T,initSegment:function(o){var c=m(),h=T(o),d;return d=new Uint8Array(c.byteLength+h.byteLength),d.set(c),d.set(h,c.byteLength),d}},Ce=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},Ze=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},ct=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},Ye=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},rt=function(o,c){var h=Ye();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},$t=function(o,c){var h,d,p,g,S,C=c||0,A=[];for(h=0;h<o.length;h++)for(g=o[h],d=0;d<g.length;d++)S=g[d],p=rt(S,C),C+=p.size,A.push(p);return A},Ge=function(o){var c,h,d,p,g,S,C=0,A=o.byteLength,k=o.nalCount,B=A+4*k,X=new Uint8Array(B),oe=new DataView(X.buffer);for(c=0;c<o.length;c++)for(p=o[c],h=0;h<p.length;h++)for(g=p[h],d=0;d<g.length;d++)S=g[d],oe.setUint32(C,S.data.byteLength),C+=4,X.set(S.data,C),C+=S.data.byteLength;return X},Vt=function(o,c){var h,d=c||0,p=[];return h=rt(o,d),p.push(h),p},Ve=function(o){var c,h,d=0,p=o.byteLength,g=o.length,S=p+4*g,C=new Uint8Array(S),A=new DataView(C.buffer);for(c=0;c<o.length;c++)h=o[c],A.setUint32(d,h.data.byteLength),d+=4,C.set(h.data,d),d+=h.data.byteLength;return C},xe={groupNalsIntoFrames:Ce,groupFramesIntoGops:Ze,extendFirstKeyFrame:ct,generateSampleTable:$t,concatenateNalData:Ge,generateSampleTableForFrame:Vt,concatenateNalDataForFrame:Ve},Ee=[33,16,5,32,164,27],We=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Te=function(o){for(var c=[];o--;)c.push(0);return c},Le=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},{})},Me,hi=function(){if(!Me){var o={96e3:[Ee,[227,64],Te(154),[56]],88200:[Ee,[231],Te(170),[56]],64e3:[Ee,[248,192],Te(240),[56]],48e3:[Ee,[255,192],Te(268),[55,148,128],Te(54),[112]],44100:[Ee,[255,192],Te(268),[55,163,128],Te(84),[112]],32e3:[Ee,[255,192],Te(268),[55,234],Te(226),[112]],24e3:[Ee,[255,192],Te(268),[55,255,128],Te(268),[111,112],Te(126),[224]],16e3:[Ee,[255,192],Te(268),[55,255,128],Te(268),[111,255],Te(269),[223,108],Te(195),[1,192]],12e3:[We,Te(268),[3,127,248],Te(268),[6,255,240],Te(268),[13,255,224],Te(268),[27,253,128],Te(259),[56]],11025:[We,Te(268),[3,127,248],Te(268),[6,255,240],Te(268),[13,255,224],Te(268),[27,255,192],Te(268),[55,175,128],Te(108),[112]],8e3:[We,Te(268),[3,121,16],Te(47),[7]]};Me=Le(o)}return Me},si=9e4,ki,Ii,fi,pi,Os,Rs,Ki;ki=function(o){return o*si},Ii=function(o,c){return o*c},fi=function(o){return o/si},pi=function(o,c){return o/c},Os=function(o,c){return ki(pi(o,c))},Rs=function(o,c){return Ii(fi(o),c)},Ki=function(o,c,h){return fi(h?o:o-c)};var we={ONE_SECOND_IN_TS:si,secondsToVideoTs:ki,secondsToAudioTs:Ii,videoTsToSeconds:fi,audioTsToSeconds:pi,audioTsToVideoTs:Os,videoTsToAudioTs:Rs,metadataTsToSeconds:Ki},Ns=hi,Pi=we,Ar=function(o){var c,h,d=0;for(c=0;c<o.length;c++)h=o[c],d+=h.data.byteLength;return d},Dr=function(o,c,h,d){var p,g=0,S=0,C=0,A=0,k,B,X;if(c.length&&(p=Pi.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),g=Math.ceil(Pi.ONE_SECOND_IN_TS/(o.samplerate/1024)),h&&d&&(S=p-Math.max(h,d),C=Math.floor(S/g),A=C*g),!(C<1||A>Pi.ONE_SECOND_IN_TS/2))){for(k=Ns()[o.samplerate],k||(k=c[0].data),B=0;B<C;B++)X=c[0],c.splice(0,0,{data:k,dts:X.dts-g,pts:X.pts-g});return o.baseMediaDecodeTime-=Math.floor(Pi.videoTsToAudioTs(A,o.samplerate)),A}},Ms=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}))},mi=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},kr=function(o){var c,h,d=0,p=new Uint8Array(Ar(o));for(c=0;c<o.length;c++)h=o[c],p.set(h.data,d),d+=h.data.byteLength;return p},Bs={prefixWithSilence:Dr,trimAdtsFramesByEarliestDts:Ms,generateSampleTable:mi,concatenateFrameData:kr},Ir=we.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},L=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/Ir,h*=d,h=Math.floor(h)),h},z={clearDtsInfo:b,calculateTrackBaseMediaDecodeTime:L,collectDtsInfo:y},ae=4,ge=128,Pe=function(o){for(var c=0,h={payloadType:-1,payloadSize:0},d=0,p=0;c<o.byteLength&&o[c]!==ge;){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 g=String.fromCharCode(o[c+3],o[c+4],o[c+5],o[c+6]);if(g==="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},at=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,g,S;if(!(c[0]&64))return h;for(p=c[0]&31,d=0;d<p;d++)g=d*3,S={type:c[g+2]&3,pts:o},c[g+2]&4&&(S.ccData=c[g+3]<<8|c[g+4],h.push(S));return h},Ht=function(o){for(var c=o.byteLength,h=[],d=1,p,g;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,g=new Uint8Array(p);var S=0;for(d=0;d<p;S++,d++)S===h[0]&&(S++,h.shift()),g[d]=o[S];return g},wt={parseSei:Pe,parseUserData:at,parseCaptionPackets:vt,discardEmulationPreventionBytes:Ht,USER_DATA_REGISTERED_ITU_T_T35:ae},Nt=t,At=wt,He=function(o){o=o||{},He.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Be(0,0),new Be(0,1),new Be(1,0),new Be(1,1)],this.parse708captions_&&(this.cc708Stream_=new Se({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")))};He.prototype=new Nt,He.prototype.push=function(o){var c,h,d;if(o.nalUnitType==="sei_rbsp"&&(c=At.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===At.USER_DATA_REGISTERED_ITU_T_T35&&(h=At.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=At.parseCaptionPackets(o.pts,h),this.captionPackets_=this.captionPackets_.concat(d),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},He.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},He.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)},He.prototype.flush=function(){return this.flushStream("flush")},He.prototype.partialFlush=function(){return this.flushStream("partialFlush")},He.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},He.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)},He.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},He.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},He.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},He.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var Dt={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},ri=function(o){var c=Dt[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},zt=function(o){return 32<=o&&o<=127||160<=o&&o<=255},Oe=function(o){this.windowNum=o,this.reset()};Oe.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},Oe.prototype.getText=function(){return this.rows.join(`
|
|
186
|
+
`)},Oe.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Oe.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--},Oe.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Oe.prototype.addText=function(o){this.rows[this.rowIdx]+=o},Oe.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 Oe(-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 Oe(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 Se=function(o){o=o||{},Se.prototype.init.call(this);var c=this,h=o.captionServices||{},d={},p;Object.keys(h).forEach(g=>{p=h[g],/^SERVICE/.test(g)&&(d[g]=p.encoding)}),this.serviceEncodings=d,this.current708Packet=null,this.services={},this.push=function(g){g.type===3?(c.new708Packet(),c.add708Bytes(g)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(g))}};Se.prototype=new Nt,Se.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Se.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)},Se.prototype.push708Packet=function(){var o=this.current708Packet,c=o.data,h=null,d=null,p=0,g=c[p++];for(o.seq=g>>6,o.sizeCode=g&63;p<c.length;p++)g=c[p++],h=g>>5,d=g&31,h===7&&d>0&&(g=c[p++],h=g),this.pushServiceBlock(h,p,d),d>0&&(p+=d-1)},Se.prototype.pushServiceBlock=function(o,c,h){var d,p=c,g=this.current708Packet.data,S=this.services[o];for(S||(S=this.initService(o,p));p<c+h&&p<g.length;p++)d=g[p],zt(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++},Se.prototype.extendedCommands=function(o,c){var h=this.current708Packet.data,d=h[++o];return zt(d)&&(o=this.handleText(o,c,{isExtended:!0})),o},Se.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},Se.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(g){h.flushDisplayed(g,h.services[o])}),this.services[o]},Se.prototype.handleText=function(o,c,h){var d=h&&h.isExtended,p=h&&h.isMultiByte,g=this.current708Packet.data,S=d?4096:0,C=g[o],A=g[o+1],k=c.currentWindow,B,X;function oe(Q){return Q.map(he=>("0"+(he&255).toString(16)).slice(-2)).join("")}if(p?(X=[C,A],o++):X=[C],c.textDecoder_&&!d)B=c.textDecoder_.decode(new Uint8Array(X));else if(p){const Q=oe(X);B=String.fromCharCode(parseInt(Q,16))}else B=ri(S|C);return k.pendingNewLine&&!k.isEmpty()&&k.newLine(this.getPts(o)),k.pendingNewLine=!1,k.addText(B),o},Se.prototype.multiByteCharacter=function(o,c){var h=this.current708Packet.data,d=h[o+1],p=h[o+2];return zt(d)&&zt(p)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},Se.prototype.setCurrentWindow=function(o,c){var h=this.current708Packet.data,d=h[o],p=d&7;return c.setCurrentWindow(p),o},Se.prototype.defineWindow=function(o,c){var h=this.current708Packet.data,d=h[o],p=d&7;c.setCurrentWindow(p);var g=c.currentWindow;return d=h[++o],g.visible=(d&32)>>5,g.rowLock=(d&16)>>4,g.columnLock=(d&8)>>3,g.priority=d&7,d=h[++o],g.relativePositioning=(d&128)>>7,g.anchorVertical=d&127,d=h[++o],g.anchorHorizontal=d,d=h[++o],g.anchorPoint=(d&240)>>4,g.rowCount=d&15,d=h[++o],g.columnCount=d&63,d=h[++o],g.windowStyle=(d&56)>>3,g.penStyle=d&7,g.virtualRowCount=g.rowCount+1,o},Se.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},Se.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(c),c.startPts=o},Se.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)},Se.prototype.displayWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&(c.windows[g].visible=1);return o},Se.prototype.hideWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&(c.windows[g].visible=0);return o},Se.prototype.toggleWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&(c.windows[g].visible^=1);return o},Se.prototype.clearWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&c.windows[g].clearText();return o},Se.prototype.deleteWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&c.windows[g].reset();return o},Se.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},Se.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},Se.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},Se.prototype.reset=function(o,c){var h=this.getPts(o);return this.flushDisplayed(h,c),this.initService(c.serviceNum,o)};var Pr={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},Lr=function(o){return o===null?"":(o=Pr[o]||o,String.fromCharCode(o))},Or=14,Uf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oi=function(){for(var o=[],c=Or+1;c--;)o.push({text:"",indent:0,offset:0});return o},Be=function(o,c){Be.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,g,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),g=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(g,S))g=(g&3)<<8,C=Lr(g|S),this[this.mode_](h.pts,C),this.column_++;else if(this.isExtCharacter(g,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),g=(g&3)<<8,C=Lr(g|S),this[this.mode_](h.pts,C),this.column_++;else if(this.isMidRowCode(g,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(g,S)){const k=S&3;this.nonDisplayed_[this.row_].offset=k,this.column_+=k}else if(this.isPAC(g,S)){var A=Uf.indexOf(d&7968);if(this.mode_==="rollUp"&&(A-this.rollUpRows_+1<0&&(A=this.rollUpRows_-1),this.setRollUp(h.pts,A)),A!==this.row_&&A>=0&&A<=14&&(this.clearFormatting(h.pts),this.row_=A),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(g)&&(S===0&&(S=null),C=Lr(g),C+=Lr(S),this[this.mode_](h.pts,C),this.column_+=C.length)}};Be.prototype=new Nt,Be.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_})},Be.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_=Or,this.rollUpRows_=2,this.formatting_=[]},Be.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},Be.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Be.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Be.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Be.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Be.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Be.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Be.prototype.isNormalChar=function(o){return o>=32&&o<=127},Be.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=Or,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},Be.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)},Be.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)}},Be.prototype.popOn=function(o,c){var h=this.nonDisplayed_[this.row_].text;h+=c,this.nonDisplayed_[this.row_].text=h},Be.prototype.rollUp=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h},Be.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<Or+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}},Be.prototype.paintOn=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h};var mu={CaptionStream:He,Cea608Stream:Be,Cea708Stream:Se},Rr={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},jf=t,qf=8589934592,$f=4294967296,gu="shared",ra=function(o,c){var h=1;for(o>c&&(h=-1);Math.abs(c-o)>$f;)o+=h*qf;return o},na=function(o){var c,h;na.prototype.init.call(this),this.type_=o||gu,this.push=function(d){if(d.type==="metadata"){this.trigger("data",d);return}this.type_!==gu&&d.type!==this.type_||(h===void 0&&(h=d.dts),d.dts=ra(d.dts,h),d.pts=ra(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")}};na.prototype=new jf;var _u={TimestampRolloverStream:na,handleRollover:ra},Vf=(o,c,h)=>{if(!o)return-1;for(var d=h;d<o.length;d++)if(o[d]===c)return d;return-1},Hf={typedArrayIndexOf:Vf},Nr=Hf.typedArrayIndexOf,Mr={Utf8:3},yu=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},Fs=function(o,c,h){return decodeURIComponent(yu(o,c,h))},Us=function(o,c,h){return unescape(yu(o,c,h))},js=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},qs={APIC:function(o){var c=1,h,d,p="-->";o.data[0]===Mr.Utf8&&(h=Nr(o.data,0,c),!(h<0)&&(o.mimeType=Us(o.data,c,h),c=h+1,o.pictureType=o.data[c],c++,d=Nr(o.data,0,c),!(d<0)&&(o.description=Fs(o.data,c,d),c=d+1,o.mimeType===p?o.url=Us(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===Mr.Utf8&&(o.value=Fs(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===Mr.Utf8&&(c=Nr(o.data,0,1),c!==-1&&(o.description=Fs(o.data,1,c),o.value=Fs(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=Us(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===Mr.Utf8&&(c=Nr(o.data,0,1),c!==-1&&(o.description=Fs(o.data,1,c),o.url=Us(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=Us(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},zf=function(o){var c,h,d=10,p=0,g=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){p=js(o.subarray(6,10)),p+=10;var S=o[5]&64;S&&(d+=4,d+=js(o.subarray(10,14)),p-=js(o.subarray(16,20)));do{if(c=js(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,qs[C.id]?qs[C.id](C):C.id[0]==="T"?qs["T*"](C):C.id[0]==="W"&&qs["W*"](C),g.push(C),d+=10,d+=c}while(d<p);return g}},Tu={parseId3Frames:zf,parseSyncSafeInteger:js,frameParsers:qs},Gf=t,Wf=Rr,gi=Tu,Br;Br=function(o){var c={descriptor:o&&o.descriptor},h=0,d=[],p=0,g;if(Br.prototype.init.call(this),this.dispatchType=Wf.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(g=0;g<c.descriptor.length;g++)this.dispatchType+=("00"+c.descriptor[g].toString(16)).slice(-2);this.push=function(S){var C,A,k,B,X,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=gi.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},X=0;X<h;)C.data.set(d[0].data.subarray(0,h-X),X),X+=d[0].data.byteLength,p-=d[0].data.byteLength,d.shift();A=10,C.data[5]&64&&(A+=4,A+=gi.parseSyncSafeInteger(C.data.subarray(10,14)),h-=gi.parseSyncSafeInteger(C.data.subarray(16,20)));do{if(k=gi.parseSyncSafeInteger(C.data.subarray(A+4,A+8)),k<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(oe=String.fromCharCode(C.data[A],C.data[A+1],C.data[A+2],C.data[A+3]),B={id:oe,data:C.data.subarray(A+10,A+k+10)},B.key=B.id,gi.frameParsers[B.id]?gi.frameParsers[B.id](B):B.id[0]==="T"?gi.frameParsers["T*"](B):B.id[0]==="W"&&gi.frameParsers["W*"](B),B.owner==="com.apple.streaming.transportStreamTimestamp"){var J=B.data,he=(J[3]&1)<<30|J[4]<<22|J[5]<<14|J[6]<<6|J[7]>>>2;he*=4,he+=J[7]&3,B.timeStamp=he,C.pts===void 0&&C.dts===void 0&&(C.pts=B.timeStamp,C.dts=B.timeStamp),this.trigger("timestamp",B)}C.frames.push(B),A+=10,A+=k}while(A<h);this.trigger("data",C)}}}},Br.prototype=new Gf;var Xf=Br,aa=t,oa=mu,Mt=Rr,Kf=_u.TimestampRolloverStream,Fr,$s,Ur,Yi=188,ua=71;Fr=function(){var o=new Uint8Array(Yi),c=0;Fr.prototype.init.call(this),this.push=function(h){var d=0,p=Yi,g;for(c?(g=new Uint8Array(h.byteLength+c),g.set(o.subarray(0,c)),g.set(h,c),c=0):g=h;p<g.byteLength;){if(g[d]===ua&&g[p]===ua){this.trigger("data",g.subarray(d,p)),d+=Yi,p+=Yi;continue}d++,p++}d<g.byteLength&&(o.set(g.subarray(d),0),c=g.byteLength-d)},this.flush=function(){c===Yi&&o[0]===ua&&(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")}},Fr.prototype=new aa,$s=function(){var o,c,h,d;$s.prototype.init.call(this),d=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(p,g){var S=0;g.payloadUnitStartIndicator&&(S+=p[S]+1),g.type==="pat"?c(p.subarray(S),g):h(p.subarray(S),g)},c=function(p,g){g.section_number=p[7],g.last_section_number=p[8],d.pmtPid=(p[10]&31)<<8|p[11],g.pmtPid=d.pmtPid},h=function(p,g){var S,C,A,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,A=(p[10]&15)<<8|p[11],k=12+A;k<C;){var B=p[k],X=(p[k+1]&31)<<8|p[k+2];B===Mt.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=X:B===Mt.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=X:B===Mt.METADATA_STREAM_TYPE&&(d.programMapTable["timed-metadata"][X]=B),k+=((p[k+3]&15)<<8|p[k+4])+5}g.programMapTable=d.programMapTable}},this.push=function(p){var g={},S=4;if(g.payloadUnitStartIndicator=!!(p[1]&64),g.pid=p[1]&31,g.pid<<=8,g.pid|=p[2],(p[3]&48)>>>4>1&&(S+=p[S]+1),g.pid===0)g.type="pat",o(p.subarray(S),g),this.trigger("data",g);else if(g.pid===this.pmtPid)for(g.type="pmt",o(p.subarray(S),g),this.trigger("data",g);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([p,S,g]):this.processPes_(p,S,g)},this.processPes_=function(p,g,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(g),this.trigger("data",S)}},$s.prototype=new aa,$s.STREAM_TYPES={h264:27,adts:15},Ur=function(){var o=this,c=!1,h={data:[],size:0},d={data:[],size:0},p={data:[],size:0},g,S=function(A,k){var B;const X=A[0]<<16|A[1]<<8|A[2];k.data=new Uint8Array,X===1&&(k.packetLength=6+(A[4]<<8|A[5]),k.dataAlignmentIndicator=(A[6]&4)!==0,B=A[7],B&192&&(k.pts=(A[9]&14)<<27|(A[10]&255)<<20|(A[11]&254)<<12|(A[12]&255)<<5|(A[13]&254)>>>3,k.pts*=4,k.pts+=(A[13]&6)>>>1,k.dts=k.pts,B&64&&(k.dts=(A[14]&14)<<27|(A[15]&255)<<20|(A[16]&254)<<12|(A[17]&255)<<5|(A[18]&254)>>>3,k.dts*=4,k.dts+=(A[18]&6)>>>1)),k.data=A.subarray(9+A[8]))},C=function(A,k,B){var X=new Uint8Array(A.size),oe={type:k},J=0,he=0,ve=!1,et;if(!(!A.data.length||A.size<9)){for(oe.trackId=A.data[0].pid,J=0;J<A.data.length;J++)et=A.data[J],X.set(et.data,he),he+=et.data.byteLength;S(X,oe),ve=k==="video"||oe.packetLength<=A.size,(B||ve)&&(A.size=0,A.data.length=0),ve&&o.trigger("data",oe)}};Ur.prototype.init.call(this),this.push=function(A){({pat:function(){},pes:function(){var k,B;switch(A.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}A.payloadUnitStartIndicator&&C(k,B,!0),k.data.push(A),k.size+=A.data.byteLength},pmt:function(){var k={type:"metadata",tracks:[]};g=A.programMapTable,g.video!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.video,codec:"avc",type:"video"}),g.audio!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.audio,codec:"adts",type:"audio"}),c=!0,o.trigger("data",k)}})[A.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&&g){var A={type:"metadata",tracks:[]};g.video!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.video,codec:"avc",type:"video"}),g.audio!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.audio,codec:"adts",type:"audio"}),o.trigger("data",A)}c=!1,this.flushStreams_(),this.trigger("done")}},Ur.prototype=new aa;var vu={PAT_PID:0,MP2T_PACKET_LENGTH:Yi,TransportPacketStream:Fr,TransportParseStream:$s,ElementaryStream:Ur,TimestampRolloverStream:Kf,CaptionStream:oa.CaptionStream,Cea608Stream:oa.Cea608Stream,Cea708Stream:oa.Cea708Stream,MetadataStream:Xf};for(var la in Mt)Mt.hasOwnProperty(la)&&(vu[la]=Mt[la]);var Yf=vu,Qf=t,Jf=we.ONE_SECOND_IN_TS,jr,bu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];jr=function(o){var c,h=0;jr.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,g,S,C,A,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,g=(c[p+3]&3)<<11|c[p+4]<<3|(c[p+5]&224)>>5,A=((c[p+6]&3)+1)*1024,k=A*Jf/bu[(c[p+2]&60)>>>2],c.byteLength-p<g)break;this.trigger("data",{pts:d.pts+h*k,dts:d.dts+h*k,sampleCount:A,audioobjecttype:(c[p+2]>>>6&3)+1,channelcount:(c[p+2]&1)<<2|(c[p+3]&192)>>>6,samplerate:bu[(c[p+2]&60)>>>2],samplingfrequencyindex:(c[p+2]&60)>>>2,samplesize:16,data:c.subarray(p+7+S,p+g)}),h++,p+=g}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")}},jr.prototype=new Qf;var Zf=jr,xu;xu=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,g=new Uint8Array(4),S=Math.min(4,c);if(S===0)throw new Error("no bytes available");g.set(o.subarray(p,p+S)),h=new DataView(g.buffer).getUint32(0),d=S*8,c-=S},this.skipBits=function(p){var g;d>p?(h<<=p,d-=p):(p-=d,g=Math.floor(p/8),p-=g*8,c-=g,this.loadWord(),h<<=p,d-=p)},this.readBits=function(p){var g=Math.min(d,p),S=h>>>32-g;return d-=g,d>0?h<<=g:c>0&&this.loadWord(),g=p-g,g>0?S<<g|this.readBits(g):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 ep=xu,Su=t,tp=ep,qr,$r,Eu;$r=function(){var o=0,c,h;$r.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 g=h.byteLength;o<g-3;o++)if(h[o+2]===1){c=o+5;break}for(;c<g;)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<g);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")}},$r.prototype=new Su,Eu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},qr=function(){var o=new $r,c,h,d,p,g,S,C;qr.prototype.init.call(this),c=this,this.push=function(A){A.type==="video"&&(h=A.trackId,d=A.pts,p=A.dts,o.push(A))},o.on("data",function(A){var k={trackId:h,pts:d,dts:p,data:A,nalUnitTypeCode:A[0]&31};switch(k.nalUnitTypeCode){case 5:k.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:k.nalUnitType="sei_rbsp",k.escapedRBSP=g(A.subarray(1));break;case 7:k.nalUnitType="seq_parameter_set_rbsp",k.escapedRBSP=g(A.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(A,k){var B=8,X=8,oe,J;for(oe=0;oe<A;oe++)X!==0&&(J=k.readExpGolomb(),X=(B+J+256)%256),B=X===0?B:X},g=function(A){for(var k=A.byteLength,B=[],X=1,oe,J;X<k-2;)A[X]===0&&A[X+1]===0&&A[X+2]===3?(B.push(X+2),X+=2):X++;if(B.length===0)return A;oe=k-B.length,J=new Uint8Array(oe);var he=0;for(X=0;X<oe;he++,X++)he===B[0]&&(he++,B.shift()),J[X]=A[he];return J},S=function(A){var k=0,B=0,X=0,oe=0,J,he,ve,et,bt,yi,Ks,Ys,Qs,Js,en,Ne=[1,1],Zs,Ft;if(J=new tp(A),he=J.readUnsignedByte(),et=J.readUnsignedByte(),ve=J.readUnsignedByte(),J.skipUnsignedExpGolomb(),Eu[he]&&(bt=J.readUnsignedExpGolomb(),bt===3&&J.skipBits(1),J.skipUnsignedExpGolomb(),J.skipUnsignedExpGolomb(),J.skipBits(1),J.readBoolean()))for(en=bt!==3?8:12,Ft=0;Ft<en;Ft++)J.readBoolean()&&(Ft<6?C(16,J):C(64,J));if(J.skipUnsignedExpGolomb(),yi=J.readUnsignedExpGolomb(),yi===0)J.readUnsignedExpGolomb();else if(yi===1)for(J.skipBits(1),J.skipExpGolomb(),J.skipExpGolomb(),Ks=J.readUnsignedExpGolomb(),Ft=0;Ft<Ks;Ft++)J.skipExpGolomb();if(J.skipUnsignedExpGolomb(),J.skipBits(1),Ys=J.readUnsignedExpGolomb(),Qs=J.readUnsignedExpGolomb(),Js=J.readBits(1),Js===0&&J.skipBits(1),J.skipBits(1),J.readBoolean()&&(k=J.readUnsignedExpGolomb(),B=J.readUnsignedExpGolomb(),X=J.readUnsignedExpGolomb(),oe=J.readUnsignedExpGolomb()),J.readBoolean()&&J.readBoolean()){switch(Zs=J.readUnsignedByte(),Zs){case 1:Ne=[1,1];break;case 2:Ne=[12,11];break;case 3:Ne=[10,11];break;case 4:Ne=[16,11];break;case 5:Ne=[40,33];break;case 6:Ne=[24,11];break;case 7:Ne=[20,11];break;case 8:Ne=[32,11];break;case 9:Ne=[80,33];break;case 10:Ne=[18,11];break;case 11:Ne=[15,11];break;case 12:Ne=[64,33];break;case 13:Ne=[160,99];break;case 14:Ne=[4,3];break;case 15:Ne=[3,2];break;case 16:Ne=[2,1];break;case 255:{Ne=[J.readUnsignedByte()<<8|J.readUnsignedByte(),J.readUnsignedByte()<<8|J.readUnsignedByte()];break}}Ne&&Ne[0]/Ne[1]}return{profileIdc:he,levelIdc:ve,profileCompatibility:et,width:(Ys+1)*16-k*2-B*2,height:(2-Js)*(Qs+1)*16-X*2-oe*2,sarRatio:Ne}}},qr.prototype=new Su;var ip={H264Stream:qr},sp=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Cu=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},wu=function(o,c){return o.length-c<10||o[c]!==73||o[c+1]!==68||o[c+2]!==51?c:(c+=Cu(o,c),wu(o,c))},rp=function(o){var c=wu(o,0);return o.length>=c+2&&(o[c]&255)===255&&(o[c+1]&240)===240&&(o[c+1]&22)===16},Au=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},np=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},ap=function(o,c,h){return unescape(np(o,c,h))},op=function(o,c){var h=(o[c+5]&224)>>5,d=o[c+4]<<3,p=o[c+3]&6144;return p|d|h},up=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},lp=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return sp[(o[c+2]&60)>>>2]}return null},cp=function(o){var c,h,d,p;c=10,o[5]&64&&(c+=4,c+=Au(o.subarray(10,14)));do{if(h=Au(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 g=0;g<d.byteLength;g++)if(d[g]===0){var S=ap(d,0,g);if(S==="com.apple.streaming.transportStreamTimestamp"){var C=d.subarray(g+1),A=(C[3]&1)<<30|C[4]<<22|C[5]<<14|C[6]<<6|C[7]>>>2;return A*=4,A+=C[7]&3,A}break}}c+=10,c+=h}while(c<o.byteLength);return null},ca={isLikelyAacData:rp,parseId3TagSize:Cu,parseAdtsSize:op,parseType:up,parseSampleRate:lp,parseAacTimestamp:cp},dp=t,Du=ca,Vr;Vr=function(){var o=new Uint8Array,c=0;Vr.prototype.init.call(this),this.setTimestamp=function(h){c=h},this.push=function(h){var d=0,p=0,g,S,C,A;for(o.length?(A=o.length,o=new Uint8Array(h.byteLength+A),o.set(o.subarray(0,A)),o.set(h,A)):o=h;o.length-p>=3;){if(o[p]===73&&o[p+1]===68&&o[p+2]===51){if(o.length-p<10||(d=Du.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=Du.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++}g=o.length-p,g>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")}},Vr.prototype=new dp;var hp=Vr,fp=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],pp=fp,mp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],gp=mp,Hr=t,Vs=Je,Hs=xe,zr=Bs,Bt=z,ni=Yf,Gr=we,ku=Zf,_p=ip.H264Stream,yp=hp,Tp=ca.isLikelyAacData,vp=we.ONE_SECOND_IN_TS,Iu=pp,Pu=gp,Wr,zs,Xr,Ri,bp=function(o,c){c.stream=o,this.trigger("log",c)},Lu=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",bp.bind(o,p))}},Ou=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},Ru=function(o,c,h,d,p,g){var S=h-c,C=d-c,A=p-h;return{start:{dts:o,pts:o+S},end:{dts:o+C,pts:o+A},prependedContentDuration:g,baseMediaDecodeTime:o}};zs=function(o,c){var h=[],d,p=0,g=0,S=1/0;c=c||{},d=c.firstSequenceNumber||0,zs.prototype.init.call(this),this.push=function(C){Bt.collectDtsInfo(o,C),o&&Iu.forEach(function(A){o[A]=C[A]}),h.push(C)},this.setEarliestDts=function(C){p=C},this.setVideoBaseMediaDecodeTime=function(C){S=C},this.setAudioAppendStart=function(C){g=C},this.flush=function(){var C,A,k,B,X,oe,J;if(h.length===0){this.trigger("done","AudioSegmentStream");return}C=zr.trimAdtsFramesByEarliestDts(h,o,p),o.baseMediaDecodeTime=Bt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),J=zr.prefixWithSilence(o,C,g,S),o.samples=zr.generateSampleTable(C),k=Vs.mdat(zr.concatenateFrameData(C)),h=[],A=Vs.moof(d,[o]),B=new Uint8Array(A.byteLength+k.byteLength),d++,B.set(A),B.set(k,A.byteLength),Bt.clearDtsInfo(o),X=Math.ceil(vp*1024/o.samplerate),C.length&&(oe=C.length*X,this.trigger("segmentTimingInfo",Ru(Gr.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),C[0].dts,C[0].pts,C[0].dts+oe,C[0].pts+oe,J||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")}},zs.prototype=new Hr,Wr=function(o,c){var h,d=[],p=[],g,S;c=c||{},h=c.firstSequenceNumber||0,Wr.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(C){Bt.collectDtsInfo(o,C),C.nalUnitType==="seq_parameter_set_rbsp"&&!g&&(g=C.config,o.sps=[C.data],Pu.forEach(function(A){o[A]=g[A]},this)),C.nalUnitType==="pic_parameter_set_rbsp"&&!S&&(S=C.data,o.pps=[C.data]),d.push(C)},this.flush=function(){for(var C,A,k,B,X,oe,J=0,he,ve;d.length&&d[0].nalUnitType!=="access_unit_delimiter_rbsp";)d.shift();if(d.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(C=Hs.groupNalsIntoFrames(d),k=Hs.groupFramesIntoGops(C),k[0][0].keyFrame||(A=this.getGopForFusion_(d[0],o),A?(J=A.duration,k.unshift(A),k.byteLength+=A.byteLength,k.nalCount+=A.nalCount,k.pts=A.pts,k.dts=A.dts,k.duration+=A.duration):k=Hs.extendFirstKeyFrame(k)),p.length){var et;if(c.alignGopsAtEnd?et=this.alignGopsAtEnd_(k):et=this.alignGopsAtStart_(k),!et){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=et}Bt.collectDtsInfo(o,k),o.samples=Hs.generateSampleTable(k),X=Vs.mdat(Hs.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}})),he=k[0],ve=k[k.length-1],this.trigger("segmentTimingInfo",Ru(o.baseMediaDecodeTime,he.dts,he.pts,ve.dts+ve.duration,ve.pts+ve.duration,J)),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=Vs.moof(h,[o]),oe=new Uint8Array(B.byteLength+X.byteLength),h++,oe.set(B),oe.set(X,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),g=void 0,S=void 0},this.getGopForFusion_=function(C){var A=45e3,k=1/0,B,X,oe,J,he;for(he=0;he<this.gopCache_.length;he++)J=this.gopCache_[he],oe=J.gop,!(!(o.pps&&Ou(o.pps[0],J.pps[0]))||!(o.sps&&Ou(o.sps[0],J.sps[0])))&&(oe.dts<o.timelineStartInfo.dts||(B=C.dts-oe.dts-oe.duration,B>=-1e4&&B<=A&&(!X||k>B)&&(X=J,k=B)));return X?X.gop:null},this.alignGopsAtStart_=function(C){var A,k,B,X,oe,J,he,ve;for(oe=C.byteLength,J=C.nalCount,he=C.duration,A=k=0;A<p.length&&k<C.length&&(B=p[A],X=C[k],B.pts!==X.pts);){if(X.pts>B.pts){A++;continue}k++,oe-=X.byteLength,J-=X.nalCount,he-=X.duration}return k===0?C:k===C.length?null:(ve=C.slice(k),ve.byteLength=oe,ve.duration=he,ve.nalCount=J,ve.pts=ve[0].pts,ve.dts=ve[0].dts,ve)},this.alignGopsAtEnd_=function(C){var A,k,B,X,oe,J;for(A=p.length-1,k=C.length-1,oe=null,J=!1;A>=0&&k>=0;){if(B=p[A],X=C[k],B.pts===X.pts){J=!0;break}if(B.pts>X.pts){A--;continue}A===p.length-1&&(oe=k),k--}if(!J&&oe===null)return null;var he;if(J?he=k:he=oe,he===0)return C;var ve=C.slice(he),et=ve.reduce(function(bt,yi){return bt.byteLength+=yi.byteLength,bt.duration+=yi.duration,bt.nalCount+=yi.nalCount,bt},{byteLength:0,duration:0,nalCount:0});return ve.byteLength=et.byteLength,ve.duration=et.duration,ve.nalCount=et.nalCount,ve.pts=ve[0].pts,ve.dts=ve[0].dts,ve},this.alignGopsWith=function(C){p=C}},Wr.prototype=new Hr,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 Hr,Ri.prototype.flush=function(o){var c=0,h={captions:[],captionStreams:{},metadata:[],info:{}},d,p,g,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,Pu.forEach(function(A){h.info[A]=this.videoTrack[A]},this)):this.audioTrack&&(S=this.audioTrack.timelineStartInfo.pts,Iu.forEach(function(A){h.info[A]=this.audioTrack[A]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,g=Vs.initSegment(this.pendingTracks),h.initSegment=new Uint8Array(g.byteLength),h.initSegment.set(g),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=Gr.metadataTsToSeconds(d.startPts,S,this.keepOriginalTimestamps),d.endTime=Gr.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=Gr.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},Xr=function(o){var c=this,h=!0,d,p;Xr.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="aac",g.metadataStream=new ni.MetadataStream,g.aacStream=new yp,g.audioTimestampRolloverStream=new ni.TimestampRolloverStream("audio"),g.timedMetadataTimestampRolloverStream=new ni.TimestampRolloverStream("timed-metadata"),g.adtsStream=new ku,g.coalesceStream=new Ri(o,g.metadataStream),g.headOfPipeline=g.aacStream,g.aacStream.pipe(g.audioTimestampRolloverStream).pipe(g.adtsStream),g.aacStream.pipe(g.timedMetadataTimestampRolloverStream).pipe(g.metadataStream).pipe(g.coalesceStream),g.metadataStream.on("timestamp",function(S){g.aacStream.setTimestamp(S.timeStamp)}),g.aacStream.on("data",function(S){S.type!=="timed-metadata"&&S.type!=="audio"||g.audioSegmentStream||(p=p||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},g.coalesceStream.numberOfTracks++,g.audioSegmentStream=new zs(p,o),g.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),g.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),g.adtsStream.pipe(g.audioSegmentStream).pipe(g.coalesceStream),c.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d}))}),g.coalesceStream.on("data",this.trigger.bind(this,"data")),g.coalesceStream.on("done",this.trigger.bind(this,"done")),Lu(this,g)},this.setupTsPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="ts",g.metadataStream=new ni.MetadataStream,g.packetStream=new ni.TransportPacketStream,g.parseStream=new ni.TransportParseStream,g.elementaryStream=new ni.ElementaryStream,g.timestampRolloverStream=new ni.TimestampRolloverStream,g.adtsStream=new ku,g.h264Stream=new _p,g.captionStream=new ni.CaptionStream(o),g.coalesceStream=new Ri(o,g.metadataStream),g.headOfPipeline=g.packetStream,g.packetStream.pipe(g.parseStream).pipe(g.elementaryStream).pipe(g.timestampRolloverStream),g.timestampRolloverStream.pipe(g.h264Stream),g.timestampRolloverStream.pipe(g.adtsStream),g.timestampRolloverStream.pipe(g.metadataStream).pipe(g.coalesceStream),g.h264Stream.pipe(g.captionStream).pipe(g.coalesceStream),g.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&&!g.videoSegmentStream&&(g.coalesceStream.numberOfTracks++,g.videoSegmentStream=new Wr(d,o),g.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),g.videoSegmentStream.on("timelineStartInfo",function(A){p&&!o.keepOriginalTimestamps&&(p.timelineStartInfo=A,g.audioSegmentStream.setEarliestDts(A.dts-c.baseMediaDecodeTime))}),g.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),g.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),g.videoSegmentStream.on("baseMediaDecodeTime",function(A){p&&g.audioSegmentStream.setVideoBaseMediaDecodeTime(A)}),g.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),g.h264Stream.pipe(g.videoSegmentStream).pipe(g.coalesceStream)),p&&!g.audioSegmentStream&&(g.coalesceStream.numberOfTracks++,g.audioSegmentStream=new zs(p,o),g.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),g.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),g.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),g.adtsStream.pipe(g.audioSegmentStream).pipe(g.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d})}}),g.coalesceStream.on("data",this.trigger.bind(this,"data")),g.coalesceStream.on("id3Frame",function(S){S.dispatchType=g.metadataStream.dispatchType,c.trigger("id3Frame",S)}),g.coalesceStream.on("caption",this.trigger.bind(this,"caption")),g.coalesceStream.on("done",this.trigger.bind(this,"done")),Lu(this,g)},this.setBaseMediaDecodeTime=function(g){var S=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=g),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(g){p&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(g)},this.setRemux=function(g){var S=this.transmuxPipeline_;o.remux=g,S&&S.coalesceStream&&S.coalesceStream.setRemux(g)},this.alignGopsWith=function(g){d&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(g)},this.getLogTrigger_=function(g){var S=this;return function(C){C.stream=g,S.trigger("log",C)}},this.push=function(g){if(h){var S=Tp(g);S&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!S&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),h=!1}this.transmuxPipeline_.headOfPipeline.push(g)},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()}},Xr.prototype=new Hr;var xp={Transmuxer:Xr},Sp=function(o){return o>>>0},Ep=function(o){return("00"+o.toString(16)).slice(-2)},Kr={toUnsigned:Sp,toHexString:Ep},Cp=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},Nu=Cp,wp=Kr.toUnsigned,Ap=Nu,Mu=function(o,c){var h=[],d,p,g,S,C;if(!c.length)return null;for(d=0;d<o.byteLength;)p=wp(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3]),g=Ap(o.subarray(d+4,d+8)),S=p>1?d+p:o.byteLength,g===c[0]&&(c.length===1?h.push(o.subarray(d+8,S)):(C=Mu(o.subarray(d+8,S),c.slice(1)),C.length&&(h=h.concat(C)))),d=S;return h},da=Mu,Dp=Kr.toUnsigned,kp=n.getUint64,Ip=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=kp(o.subarray(4)):c.baseMediaDecodeTime=Dp(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},ha=Ip,Pp=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,g=h.flags[2]&8,S=h.flags[2]&16,C=h.flags[2]&32,A=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),g&&(h.defaultSampleDuration=c.getUint32(B),B+=4),S&&(h.defaultSampleSize=c.getUint32(B),B+=4),C&&(h.defaultSampleFlags=c.getUint32(B)),A&&(h.durationIsEmpty=!0),!d&&k&&(h.baseDataOffsetIsMoof=!0),h},Bu=Pp,Lp=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]}},Op=Lp,Fu=Op,Rp=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,g=c.flags[1]&1,S=c.flags[1]&2,C=c.flags[1]&4,A=c.flags[1]&8,k=h.getUint32(4),B=8,X;for(d&&(c.dataOffset=h.getInt32(B),B+=4),p&&k&&(X={flags:Fu(o.subarray(B,B+4))},B+=4,g&&(X.duration=h.getUint32(B),B+=4),S&&(X.size=h.getUint32(B),B+=4),A&&(c.version===1?X.compositionTimeOffset=h.getInt32(B):X.compositionTimeOffset=h.getUint32(B),B+=4),c.samples.push(X),k--);k--;)X={},g&&(X.duration=h.getUint32(B),B+=4),S&&(X.size=h.getUint32(B),B+=4),C&&(X.flags=Fu(o.subarray(B,B+4)),B+=4),A&&(c.version===1?X.compositionTimeOffset=h.getInt32(B):X.compositionTimeOffset=h.getUint32(B),B+=4),c.samples.push(X);return c},Uu=Rp,ju={tfdt:ha,trun:Uu},qu={parseTfdt:ju.tfdt,parseTrun:ju.trun},Np=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},Mp={uint8ToCString:Np},Yr=Mp.uint8ToCString,Bp=n.getUint64,Fp=function(o){var c=4,h=o[0],d,p,g,S,C,A,k,B;if(h===0){d=Yr(o.subarray(c)),c+=d.length,p=Yr(o.subarray(c)),c+=p.length;var X=new DataView(o.buffer);g=X.getUint32(c),c+=4,C=X.getUint32(c),c+=4,A=X.getUint32(c),c+=4,k=X.getUint32(c),c+=4}else if(h===1){var X=new DataView(o.buffer);g=X.getUint32(c),c+=4,S=Bp(o.subarray(c)),c+=8,A=X.getUint32(c),c+=4,k=X.getUint32(c),c+=4,d=Yr(o.subarray(c)),c+=d.length,p=Yr(o.subarray(c)),c+=p.length}B=new Uint8Array(o.subarray(c,o.byteLength));var oe={scheme_id_uri:d,value:p,timescale:g||1,presentation_time:S,presentation_time_delta:C,event_duration:A,id:k,message_data:B};return jp(h,oe)?oe:void 0},Up=function(o,c,h,d){return o||o===0?o/c:d+h/c},jp=function(o,c){var h=c.scheme_id_uri!=="\0",d=o===0&&$u(c.presentation_time_delta)&&h,p=o===1&&$u(c.presentation_time)&&h;return!(o>1)&&d||p},$u=function(o){return o!==void 0||o!==null},qp={parseEmsgBox:Fp,scaleTime:Up},Gs;typeof window<"u"?Gs=window:typeof s<"u"?Gs=s:typeof self<"u"?Gs=self:Gs={};var Vu=Gs,Qr=Kr.toUnsigned,Ws=Kr.toHexString,Xe=da,Qi=Nu,fa=qp,$p=Bu,Vp=Uu,Hp=ha,zp=n.getUint64,Hu,zu,Gu,Wu,Xu,pa,Ku,ma=Vu,Gp=Tu.parseId3Frames;Hu=function(o){var c={},h=Xe(o,["moov","trak"]);return h.reduce(function(d,p){var g,S,C,A,k;return g=Xe(p,["tkhd"])[0],!g||(S=g[0],C=S===0?12:20,A=Qr(g[C]<<24|g[C+1]<<16|g[C+2]<<8|g[C+3]),k=Xe(p,["mdia","mdhd"])[0],!k)?null:(S=k[0],C=S===0?12:20,d[A]=Qr(k[C]<<24|k[C+1]<<16|k[C+2]<<8|k[C+3]),d)},c)},zu=function(o,c){var h;h=Xe(c,["moof","traf"]);var d=h.reduce(function(p,g){var S=Xe(g,["tfhd"])[0],C=Qr(S[4]<<24|S[5]<<16|S[6]<<8|S[7]),A=o[C]||9e4,k=Xe(g,["tfdt"])[0],B=new DataView(k.buffer,k.byteOffset,k.byteLength),X;k[0]===1?X=zp(k.subarray(4,12)):X=B.getUint32(4);let oe;return typeof X=="bigint"?oe=X/ma.BigInt(A):typeof X=="number"&&!isNaN(X)&&(oe=X/A),oe<Number.MAX_SAFE_INTEGER&&(oe=Number(oe)),oe<p&&(p=oe),p},1/0);return typeof d=="bigint"||isFinite(d)?d:0},Gu=function(o,c){var h=Xe(c,["moof","traf"]),d=0,p=0,g;if(h&&h.length){var S=Xe(h[0],["tfhd"])[0],C=Xe(h[0],["trun"])[0],A=Xe(h[0],["tfdt"])[0];if(S){var k=$p(S);g=k.trackId}if(A){var B=Hp(A);d=B.baseMediaDecodeTime}if(C){var X=Vp(C);X.samples&&X.samples.length&&(p=X.samples[0].compositionTimeOffset||0)}}var oe=o[g]||9e4;typeof d=="bigint"&&(p=ma.BigInt(p),oe=ma.BigInt(oe));var J=(d+p)/oe;return typeof J=="bigint"&&J<Number.MAX_SAFE_INTEGER&&(J=Number(J)),J},Wu=function(o){var c=Xe(o,["moov","trak"]),h=[];return c.forEach(function(d){var p=Xe(d,["mdia","hdlr"]),g=Xe(d,["tkhd"]);p.forEach(function(S,C){var A=Qi(S.subarray(8,12)),k=g[C],B,X,oe;A==="vide"&&(B=new DataView(k.buffer,k.byteOffset,k.byteLength),X=B.getUint8(0),oe=X===0?B.getUint32(12):B.getUint32(20),h.push(oe))})}),h},pa=function(o){var c=o[0],h=c===0?12:20;return Qr(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3])},Xu=function(o){var c=Xe(o,["moov","trak"]),h=[];return c.forEach(function(d){var p={},g=Xe(d,["tkhd"])[0],S,C;g&&(S=new DataView(g.buffer,g.byteOffset,g.byteLength),C=S.getUint8(0),p.id=C===0?S.getUint32(12):S.getUint32(20));var A=Xe(d,["mdia","hdlr"])[0];if(A){var k=Qi(A.subarray(8,12));k==="vide"?p.type="video":k==="soun"?p.type="audio":p.type=k}var B=Xe(d,["mdia","minf","stbl","stsd"])[0];if(B){var X=B.subarray(8);p.codec=Qi(X.subarray(4,8));var oe=Xe(X,[p.codec])[0],J,he;oe&&(/^[asm]vc[1-9]$/i.test(p.codec)?(J=oe.subarray(78),he=Qi(J.subarray(4,8)),he==="avcC"&&J.length>11?(p.codec+=".",p.codec+=Ws(J[9]),p.codec+=Ws(J[10]),p.codec+=Ws(J[11])):p.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(p.codec)?(J=oe.subarray(28),he=Qi(J.subarray(4,8)),he==="esds"&&J.length>20&&J[19]!==0?(p.codec+="."+Ws(J[19]),p.codec+="."+Ws(J[20]>>>2&63).replace(/^0/,"")):p.codec="mp4a.40.2"):p.codec=p.codec.toLowerCase())}var ve=Xe(d,["mdia","mdhd"])[0];ve&&(p.timescale=pa(ve)),h.push(p)}),h},Ku=function(o,c=0){var h=Xe(o,["emsg"]);return h.map(d=>{var p=fa.parseEmsgBox(new Uint8Array(d)),g=Gp(p.message_data);return{cueTime:fa.scaleTime(p.presentation_time,p.timescale,p.presentation_time_delta,c),duration:fa.scaleTime(p.event_duration,p.timescale),frames:g}})};var Xs={findBox:Xe,parseType:Qi,timescale:Hu,startTime:zu,compositionStartTime:Gu,videoTrackIds:Wu,tracks:Xu,getTimescaleFromMediaHeader:pa,getEmsgID3:Ku};const{parseTrun:Wp}=qu,{findBox:Yu}=Xs;var Qu=Vu,Xp=function(o){var c=Yu(o,["moof","traf"]),h=Yu(o,["mdat"]),d=[];return h.forEach(function(p,g){var S=c[g];d.push({mdat:p,traf:S})}),d},Kp=function(o,c,h){var d=c,p=h.defaultSampleDuration||0,g=h.defaultSampleSize||0,S=h.trackId,C=[];return o.forEach(function(A){var k=Wp(A),B=k.samples;B.forEach(function(X){X.duration===void 0&&(X.duration=p),X.size===void 0&&(X.size=g),X.trackId=S,X.dts=d,X.compositionTimeOffset===void 0&&(X.compositionTimeOffset=0),typeof d=="bigint"?(X.pts=d+Qu.BigInt(X.compositionTimeOffset),d+=Qu.BigInt(X.duration)):(X.pts=d+X.compositionTimeOffset,d+=X.duration)}),C=C.concat(B)}),C},Ju={getMdatTrafPairs:Xp,parseSamples:Kp},Yp=At.discardEmulationPreventionBytes,Qp=mu.CaptionStream,ga=da,Jp=ha,Zp=Bu,{getMdatTrafPairs:em,parseSamples:tm}=Ju,im=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},sm=function(o,c,h){var d=new DataView(o.buffer,o.byteOffset,o.byteLength),p={logs:[],seiNals:[]},g,S,C,A;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=im(S,c);if(g={nalUnitType:"sei_rbsp",size:C,data:k,escapedRBSP:Yp(k),trackId:h},B)g.pts=B.pts,g.dts=B.dts,A=B;else if(A)g.pts=A.pts,g.dts=A.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(g);break}return p},rm=function(o,c){var h={},d=em(o);return d.forEach(function(p){var g=p.mdat,S=p.traf,C=ga(S,["tfhd"]),A=Zp(C[0]),k=A.trackId,B=ga(S,["tfdt"]),X=B.length>0?Jp(B[0]).baseMediaDecodeTime:0,oe=ga(S,["trun"]),J,he;c===k&&oe.length>0&&(J=tm(oe,X,A),he=sm(g,J,k),h[k]||(h[k]={seiNals:[],logs:[]}),h[k].seiNals=h[k].seiNals.concat(he.seiNals),h[k].logs=h[k].logs.concat(he.logs))}),h},nm=function(o,c,h){var d;if(c===null)return null;d=rm(o,c);var p=d[c]||{};return{seiNals:p.seiNals,logs:p.logs,timescale:h}},am=function(){var o=!1,c,h,d,p,g,S;this.isInitialized=function(){return o},this.init=function(C){c=new Qp,o=!0,S=C?C.isPartial:!1,c.on("data",function(A){A.startTime=A.startPts/p,A.endTime=A.endPts/p,g.captions.push(A),g.captionStreams[A.stream]=!0}),c.on("log",function(A){g.logs.push(A)})},this.isNewInit=function(C,A){return C&&C.length===0||A&&typeof A=="object"&&Object.keys(A).length===0?!1:d!==C[0]||p!==A[d]},this.parse=function(C,A,k){var B;if(this.isInitialized()){if(!A||!k)return null;if(this.isNewInit(A,k))d=A[0],p=k[d];else if(d===null||!p)return h.push(C),null}else return null;for(;h.length>0;){var X=h.shift();this.parse(X,A,k)}return B=nm(C,d,p),B&&B.logs&&(g.logs=g.logs.concat(B.logs)),B===null||!B.seiNals?g.logs.length?{logs:g.logs,captions:[],captionStreams:[]}:null:(this.pushNals(B.seiNals),this.flushStream(),g)},this.pushNals=function(C){if(!this.isInitialized()||!C||C.length===0)return null;C.forEach(function(A){c.push(A)})},this.flushStream=function(){if(!this.isInitialized())return null;S?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){g.captions=[],g.captionStreams={},g.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,g?this.clearParsedCaptions():g={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},om=am;const{parseTfdt:um}=qu,_i=da,{getTimescaleFromMediaHeader:lm}=Xs,{parseSamples:cm,getMdatTrafPairs:dm}=Ju;var Zu=function(){let o=9e4;this.init=function(c){const h=_i(c,["moov","trak","mdia","mdhd"])[0];h&&(o=lm(h))},this.parseSegment=function(c){const h=[],d=dm(c);let p=0;return d.forEach(function(g){const S=g.mdat,C=g.traf,A=_i(C,["tfdt"])[0],k=_i(C,["tfhd"])[0],B=_i(C,["trun"]);if(A&&(p=um(A).baseMediaDecodeTime),B.length&&k){const X=cm(B,p,k);let oe=0;X.forEach(function(J){const he="utf-8",ve=new TextDecoder(he),et=S.slice(oe,oe+J.size);if(_i(et,["vtte"])[0]){oe+=J.size;return}_i(et,["vttc"]).forEach(function(Ks){const Ys=_i(Ks,["payl"])[0],Qs=_i(Ks,["sttg"])[0],Js=J.pts/o,en=(J.pts+J.duration)/o;let Ne,Zs;if(Ys)try{Ne=ve.decode(Ys)}catch(Ft){console.error(Ft)}if(Qs)try{Zs=ve.decode(Qs)}catch(Ft){console.error(Ft)}J.duration&&Ne&&h.push({cueText:Ne,start:Js,end:en,settings:Zs})}),oe+=J.size})}}),h}},_a=Rr,el=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},Jr=function(o){return!!(o[1]&64)},Zr=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},hm=function(o,c){var h=el(o);return h===0?"pat":h===c?"pmt":c?"pes":null},fm=function(o){var c=Jr(o),h=4+Zr(o);return c&&(h+=o[h]+1),(o[h+10]&31)<<8|o[h+11]},pm=function(o){var c={},h=Jr(o),d=4+Zr(o);if(h&&(d+=o[d]+1),!!(o[d+5]&1)){var p,g,S;p=(o[d+1]&15)<<8|o[d+2],g=3+p-4,S=(o[d+10]&15)<<8|o[d+11];for(var C=12+S;C<g;){var A=d+C;c[(o[A+1]&31)<<8|o[A+2]]=o[A],C+=((o[A+3]&15)<<8|o[A+4])+5}return c}},mm=function(o,c){var h=el(o),d=c[h];switch(d){case _a.H264_STREAM_TYPE:return"video";case _a.ADTS_STREAM_TYPE:return"audio";case _a.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},gm=function(o){var c=Jr(o);if(!c)return null;var h=4+Zr(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},ya=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}},_m=function(o){for(var c=4+Zr(o),h=o.subarray(c),d=0,p=0,g=!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=ya(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(g=!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=ya(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(g=!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=ya(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(g=!0)),g},ym={parseType:hm,parsePat:fm,parsePmt:pm,parsePayloadUnitStartIndicator:Jr,parsePesType:mm,parsePesTime:gm,videoPacketContainsKeyFrame:_m},tl=Rr,Ji=_u.handleRollover,ke={};ke.ts=ym,ke.aac=ca;var Ni=we.ONE_SECOND_IN_TS,dt=188,Gt=71,Tm=function(o,c){for(var h=0,d=dt,p,g;d<o.byteLength;){if(o[h]===Gt&&o[d]===Gt){switch(p=o.subarray(h,d),g=ke.ts.parseType(p,c.pid),g){case"pat":c.pid=ke.ts.parsePat(p);break;case"pmt":var S=ke.ts.parsePmt(p);c.table=c.table||{},Object.keys(S).forEach(function(C){c.table[C]=S[C]});break}h+=dt,d+=dt;continue}h++,d++}},il=function(o,c,h){for(var d=0,p=dt,g,S,C,A,k,B=!1;p<=o.byteLength;){if(o[d]===Gt&&(o[p]===Gt||p===o.byteLength)){if(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S==="pes"&&(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=ke.ts.parsePesTime(g),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d+=dt,p+=dt;continue}d++,p++}for(p=o.byteLength,d=p-dt,B=!1;d>=0;){if(o[d]===Gt&&(o[p]===Gt||p===o.byteLength)){if(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S==="pes"&&(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=ke.ts.parsePesTime(g),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d-=dt,p-=dt;continue}d--,p--}},vm=function(o,c,h){for(var d=0,p=dt,g,S,C,A,k,B,X,oe,J=!1,he={data:[],size:0};p<o.byteLength;){if(o[d]===Gt&&o[p]===Gt){switch(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S){case"pes":if(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="video"&&(A&&!J&&(k=ke.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),J=!0)),!h.firstKeyFrame)){if(A&&he.size!==0){for(B=new Uint8Array(he.size),X=0;he.data.length;)oe=he.data.shift(),B.set(oe,X),X+=oe.byteLength;if(ke.ts.videoPacketContainsKeyFrame(B)){var ve=ke.ts.parsePesTime(B);ve?(h.firstKeyFrame=ve,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.")}he.size=0}he.data.push(g),he.size+=g.byteLength}break}if(J&&h.firstKeyFrame)break;d+=dt,p+=dt;continue}d++,p++}for(p=o.byteLength,d=p-dt,J=!1;d>=0;){if(o[d]===Gt&&o[p]===Gt){if(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S==="pes"&&(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="video"&&A&&(k=ke.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),J=!0))),J)break;d-=dt,p-=dt;continue}d--,p--}},bm=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(g){g.dts=Ji(g.dts,h),g.pts=Ji(g.pts,h),g.dtsTime=g.dts/Ni,g.ptsTime=g.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(g){g.dts=Ji(g.dts,d),g.pts=Ji(g.pts,d),g.dtsTime=g.dts/Ni,g.ptsTime=g.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}}},xm=function(o){for(var c=!1,h=0,d=null,p=null,g=0,S=0,C;o.length-S>=3;){var A=ke.aac.parseType(o,S);switch(A){case"timed-metadata":if(o.length-S<10){c=!0;break}if(g=ke.aac.parseId3TagSize(o,S),g>o.length){c=!0;break}p===null&&(C=o.subarray(S,S+g),p=ke.aac.parseAacTimestamp(C)),S+=g;break;case"audio":if(o.length-S<7){c=!0;break}if(g=ke.aac.parseAdtsSize(o,S),g>o.length){c=!0;break}d===null&&(C=o.subarray(S,S+g),d=ke.aac.parseSampleRate(C)),h++,S+=g;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},Sm=function(o){var c={pid:null,table:null},h={};Tm(o,c);for(var d in c.table)if(c.table.hasOwnProperty(d)){var p=c.table[d];switch(p){case tl.H264_STREAM_TYPE:h.video=[],vm(o,c,h),h.video.length===0&&delete h.video;break;case tl.ADTS_STREAM_TYPE:h.audio=[],il(o,c,h),h.audio.length===0&&delete h.audio;break}}return h},Em=function(o,c){var h=ke.aac.isLikelyAacData(o),d;return h?d=xm(o):d=Sm(o),!d||!d.audio&&!d.video?null:(bm(d,c),d)},Cm={inspect:Em,parseAudioPes_:il};const wm=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:we.videoTsToSeconds(h.start.dts),presentation:we.videoTsToSeconds(h.start.pts)},end:{decode:we.videoTsToSeconds(h.end.dts),presentation:we.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:we.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=we.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:d})}),c.on("audioSegmentTimingInfo",function(h){const d={start:{decode:we.videoTsToSeconds(h.start.dts),presentation:we.videoTsToSeconds(h.start.pts)},end:{decode:we.videoTsToSeconds(h.end.dts),presentation:we.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:we.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=we.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:we.videoTsToSeconds(h.start),end:we.videoTsToSeconds(h.end)}})}),c.on("videoTimingInfo",function(h){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:we.videoTsToSeconds(h.start),end:we.videoTsToSeconds(h.end)}})}),c.on("log",function(h){o.postMessage({action:"log",log:h})})};class sl{constructor(c,h){this.options=h||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new xp.Transmuxer(this.options),wm(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new om,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 Zu);const h=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(h)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new Zu);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=Xs.startTime(c,h);this.self.postMessage({action:"probeMp4StartTime",startTime:d,data:h},[h.buffer])}probeMp4Tracks({data:c}){const h=Xs.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:h,data:c},[c.buffer])}probeEmsgID3({data:c,offset:h}){const d=Xs.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*we.ONE_SECOND_IN_TS:void 0,p=Cm.inspect(c,d);let g=null;p&&(g={hasVideo:p.video&&p.video.length===2||!1,hasAudio:p.audio&&p.audio.length===2||!1},g.hasVideo&&(g.videoStart=p.video[0].ptsTime),g.hasAudio&&(g.audioStart=p.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:g,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(we.secondsToVideoTs(h)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(we.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 sl(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new sl(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var JT=lf(QT);const ZT=(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 m=s.data.segment.boxes||{data:s.data.segment.data},_={type:i,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof l<"u"&&(_.videoFrameDtsTime=l),typeof f<"u"&&(_.videoFramePtsTime=f),t(_)},ev=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},tv=(s,e)=>{e.gopInfo=s.data.gopInfo},hf=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:u,onAudioTimingInfo:l,onVideoTimingInfo:f,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:_,onId3:w,onCaptions:x,onDone:P,onEndedTimeline:T,onTransmuxerLog:I,isEndOfTimeline:M,segment:N,triggerSegmentEventFn:O}=s,F={buffer:[]};let j=M;const U=G=>{e.currentTransmux===s&&(G.data.action==="data"&&ZT(G,F,a),G.data.action==="trackinfo"&&u(G.data.trackInfo),G.data.action==="gopInfo"&&tv(G,F),G.data.action==="audioTimingInfo"&&l(G.data.audioTimingInfo),G.data.action==="videoTimingInfo"&&f(G.data.videoTimingInfo),G.data.action==="videoSegmentTimingInfo"&&m(G.data.videoSegmentTimingInfo),G.data.action==="audioSegmentTimingInfo"&&_(G.data.audioSegmentTimingInfo),G.data.action==="id3Frame"&&w([G.data.id3Frame],G.data.id3Frame.dispatchType),G.data.action==="caption"&&x(G.data.caption),G.data.action==="endedtimeline"&&(j=!1,T()),G.data.action==="log"&&I(G.data.log),G.data.type==="transmuxed"&&(j||(e.onmessage=null,ev({transmuxedData:F,callback:P}),ff(e))))},R=()=>{const G={message:"Received an error message from the transmuxer worker",metadata:{errorType:$.Error.StreamingFailedToTransmuxSegment,segmentInfo:Ui({segment:N})}};P(null,G)};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 G=t instanceof ArrayBuffer?t:t.buffer,v=t instanceof ArrayBuffer?0:t.byteOffset;O({type:"segmenttransmuxingstart",segment:N}),e.postMessage({action:"push",data:G,byteOffset:v,byteLength:t.byteLength},[G])}M&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},ff=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():hf(s.currentTransmux))},vc=(s,e)=>{s.postMessage({action:e}),ff(s)},pf=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,vc(e,s);return}e.transmuxQueue.push(vc.bind(null,e,s))},iv=s=>{pf("reset",s)},sv=s=>{pf("endTimeline",s)},mf=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,hf(s);return}s.transmuxer.transmuxQueue.push(s)},rv=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 Za={reset:iv,endTimeline:sv,transmux:mf,createTransmuxer:rv};const fs=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,r=Ke({},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)},Zt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},gf="wvtt",Co=s=>{s.forEach(e=>{e.abort()})},nv=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),av=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},fu=(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:Zt.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Zt.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Zt.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Zt.FAILURE,xhr:e,metadata:i}:null},bc=(s,e,t,i)=>(r,n)=>{const a=n.response,u=fu(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:Zt.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 m={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:s,keyInfo:m}),t(null,s)},ov=(s,e)=>{e===gf&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},uv=(s,e,t)=>{e===gf&&fs({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:r})=>{s.bytes=i,t(null,s,{mp4VttCues:r})}})},_f=(s,e)=>{const t=Mo(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:Zt.FAILURE,metadata:{mediaType:r}})}fs({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"&&ov(s,n.codec))}),e(null))})},lv=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,r)=>{const n=fu(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,_f(s,function(u){if(u)return u.xhr=r,u.status=r.status,e(u,s);e(null,s)})},cv=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(r,n)=>{const a=fu(r,n);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const u=t==="arraybuffer"||!n.responseText?n.response:KT(n.responseText.substring(s.lastReachedChar||0));return s.stats=nv(n),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},dv=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{const P=s.map&&s.map.tracks||{},T=!!(P.audio&&P.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"),F=()=>mf({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:j=>{j.type=j.type==="combined"?"video":j.type,m(s,j)},onTrackInfo:j=>{t&&(T&&(j.isMuxed=!0),t(s,j))},onAudioTimingInfo:j=>{I&&typeof j.start<"u"&&(I(j.start),I=null),M&&typeof j.end<"u"&&M(j.end)},onVideoTimingInfo:j=>{N&&typeof j.start<"u"&&(N(j.start),N=null),O&&typeof j.end<"u"&&O(j.end)},onVideoSegmentTimingInfo:j=>{const U={pts:{start:j.start.presentation,end:j.end.presentation},dts:{start:j.start.decode,end:j.end.decode}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:U}),r(j)},onAudioSegmentTimingInfo:j=>{const U={pts:{start:j.start.pts,end:j.end.pts},dts:{start:j.start.dts,end:j.end.dts}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:U}),n(j)},onId3:(j,U)=>{a(s,j,U)},onCaptions:j=>{u(s,[j])},isEndOfTimeline:l,onEndedTimeline:()=>{f()},onTransmuxerLog:w,onDone:(j,U)=>{_&&(j.type=j.type==="combined"?"video":j.type,x({type:"segmenttransmuxingcomplete",segment:s}),_(U,s,j))},segment:s,triggerSegmentEventFn:x});fs({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:j=>{s.bytes=e=j.data;const U=j.result;U&&(t(s,{hasAudio:U.hasAudio,hasVideo:U.hasVideo,isMuxed:T}),t=null),F()}})},yf=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{let P=new Uint8Array(e);if(L_(P)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){m(s,{data:P,type:"text"}),uv(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,F)=>{m(s,{data:P,type:M.hasAudio&&!M.isMuxed?"audio":"video"}),F&&F.length&&a(s,F),O&&O.length&&u(s,O),_(null,s,{})};fs({action:"probeMp4StartTime",timescales:s.map.timescales,data:P,transmuxer:s.transmuxer,callback:({data:O,startTime:F})=>{e=O.buffer,s.bytes=P=O,M.hasAudio&&!M.isMuxed&&i(s,"audio","start",F),M.hasVideo&&i(s,"video","start",F),fs({action:"probeEmsgID3",data:P,transmuxer:s.transmuxer,offset:F,callback:({emsgData:j,id3Frames:U})=>{if(e=j.buffer,s.bytes=P=j,!T.video||!j.byteLength||!s.transmuxer){N(void 0,U);return}fs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:P,timescales:s.map.timescales,trackIds:[T.video.id],callback:R=>{e=R.data.buffer,s.bytes=P=R.data,R.logs.forEach(function(G){w(De(G,{stream:"mp4CaptionParser"}))}),N(R.captions,U)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=Mo(P)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}dv({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})},Tf=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 m=f.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};i.onerror=()=>{const f="An error occurred in the decryption worker",m=Ui({segment:r}),_={message:f,metadata:{error:new Error(f),errorType:$.Error.StreamingFailedToDecryptSegment,segmentInfo:m,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(sf({source:s,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},hv=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{x({type:"segmentdecryptionstart"}),Tf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},P=>{e.bytes=P,x({type:"segmentdecryptioncomplete",segment:e}),yf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})})},fv=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{let P=0,T=!1;return(I,M)=>{if(!T){if(I)return T=!0,Co(s),_(I,M);if(P+=1,P===s.length){const N=function(){if(M.encryptedBytes)return hv({decryptionWorker:e,segment:M,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x});yf({segment:M,bytes:M.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})};if(M.endOfAllRequests=Date.now(),M.map&&M.map.encryptedBytes&&!M.map.bytes)return x({type:"segmentdecryptionstart",segment:M}),Tf({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}),_f(M,F=>{if(F)return Co(s),_(F,M);N()})});N()}}}},pv=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},mv=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m})=>_=>{if(!_.target.aborted)return s.stats=De(s.stats,av(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},gv=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:M})=>{const N=[],O=fv({activeXhrs:N,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:M});if(i.key&&!i.key.bytes){const G=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&G.push(i.map.key);const v=De(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),E=bc(i,G,O,M),V={uri:i.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:V});const H=s(v,E);N.push(H)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const H=De(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),q=bc(i,[i.map.key],O,M),K={uri:i.map.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:K});const te=s(H,q);N.push(te)}const v=De(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:So(i.map),requestType:"segment-media-initialization"}),E=lv({segment:i,finishProcessingFn:O,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const V=s(v,E);N.push(V)}const F=De(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:So(i),requestType:"segment"}),j=cv({segment:i,finishProcessingFn:O,responseType:F.responseType,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const U=s(F,j);U.addEventListener("progress",mv({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P})),N.push(U);const R={};return N.forEach(G=>{G.addEventListener("loadend",pv({loadendState:R,abortFn:r}))}),()=>Co(N)},on=Rt("PlaylistSelector"),xc=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||""})},ps=function(s,e){if(!s)return"";const t=D.getComputedStyle(s);return t?t[e]:""},ms=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})},pu=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},_v=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 vf=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;yt.isAudioOnly(e)&&(f=u.getAudioTrackPlaylists_(),l.audioOnly=!0);let m=f.map(R=>{let G;const v=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,E=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return G=R.attributes&&R.attributes.BANDWIDTH,G=G||D.Number.MAX_VALUE,{bandwidth:G,width:v,height:E,playlist:R}});ms(m,(R,G)=>R.bandwidth-G.bandwidth),m=m.filter(R=>!yt.isIncompatible(R.playlist));let _=m.filter(R=>yt.isEnabled(R.playlist));_.length||(_=m.filter(R=>!yt.isDisabled(R.playlist)));const w=_.filter(R=>R.bandwidth*tt.BANDWIDTH_VARIANCE<t);let x=w[w.length-1];const P=w.filter(R=>R.bandwidth===x.bandwidth)[0];if(a===!1){const R=P||_[0]||m[0];if(R&&R.playlist){let G="sortedPlaylistReps";return P&&(G="bandwidthBestRep"),_[0]&&(G="enabledPlaylistReps"),on(`choosing ${xc(R)} using ${G} with options`,l),R.playlist}return on("could not choose a playlist with options",l),null}const T=w.filter(R=>R.width&&R.height);ms(T,(R,G)=>R.width-G.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,F;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],F=O.filter(R=>R.bandwidth===x.bandwidth)[0]);let j;if(u.leastPixelDiffSelector){const R=T.map(G=>(G.pixelDiff=Math.abs(G.width-i)+Math.abs(G.height-r),G));ms(R,(G,v)=>G.pixelDiff===v.pixelDiff?v.bandwidth-G.bandwidth:G.pixelDiff-v.pixelDiff),j=R[0]}const U=j||F||M||P||_[0]||m[0];if(U&&U.playlist){let R="sortedPlaylistReps";return j?R="leastPixelDiffRep":F?R="resolutionPlusOneRep":M?R="resolutionBestRep":P?R="bandwidthBestRep":_[0]&&(R="enabledPlaylistReps"),on(`choosing ${xc(U)} using ${R} with options`,l),U.playlist}return on("could not choose a playlist with options",l),null};const Sc=function(){let s=this.useDevicePixelRatio&&D.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),vf({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(ps(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(ps(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?ps(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},yv=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),vf({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(ps(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(ps(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?ps(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},Tv=function(s){const{main:e,currentTime:t,bandwidth:i,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:u,syncController:l}=s,f=e.playlists.filter(P=>!yt.isIncompatible(P));let m=f.filter(yt.isEnabled);m.length||(m=f.filter(P=>!yt.isDisabled(P)));const w=m.filter(yt.hasAttribute.bind(null,"BANDWIDTH")).map(P=>{const I=l.getSyncPoint(P,r,u,t)?1:2,N=yt.estimateSegmentRequestTime(n,i,P)*I-a;return{playlist:P,rebufferingImpact:N}}),x=w.filter(P=>P.rebufferingImpact<=0);return ms(x,(P,T)=>pu(T.playlist,P.playlist)),x.length?x[0]:(ms(w,(P,T)=>P.rebufferingImpact-T.rebufferingImpact),w[0]||null)},vv=function(){const s=this.playlists.main.playlists.filter(yt.isEnabled);return ms(s,(t,i)=>pu(t,i)),s.filter(t=>!!fr(this.playlists.main,t).video)[0]||null},bv=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 bf(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const xv=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}}},Sv=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))})},Ev=function(s){Object.defineProperties(s.frame,{id:{get(){return $.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return $.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return $.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},Cv=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const r=D.WebKitDataCue||D.VTTCue,n=s.metadataTrack_;if(!n||(e.forEach(m=>{const _=m.cueTime+t;typeof _!="number"||D.isNaN(_)||_<0||!(_<1/0)||!m.frames||!m.frames.length||m.frames.forEach(w=>{const x=new r(_,_,w.value||w.url||w.data||"");x.frame=w,x.value=w,Ev(x),n.addCue(x)})}),!n.cues||!n.cues.length))return;const a=n.cues,u=[];for(let m=0;m<a.length;m++)a[m]&&u.push(a[m]);const l=u.reduce((m,_)=>{const w=m[_.startTime]||[];return w.push(_),m[_.startTime]=w,m},{}),f=Object.keys(l).sort((m,_)=>Number(m)-Number(_));f.forEach((m,_)=>{const w=l[m],x=isFinite(i)?i:m,P=Number(f[_+1])||x;w.forEach(T=>{T.endTime=P})})},wv={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"},Av=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Dv=({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(Av.has(n))continue;const a=new i(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:wv[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()})},Ec=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,$.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)},kv=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}},Iv=(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)},Pv=(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)},Lv=(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},Ov=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},Rv=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]},rr=1,Nv=500,Cc=s=>typeof s=="number"&&isFinite(s),un=1/60,Mv=(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,Bv=(s,e,t)=>{let i=e-tt.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:m}=s,_=u.length-1;let w="mediaIndex/partIndex increment";s.getMediaInfoForTime?w=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(w="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(w+=` with independent ${s.independent}`);const x=typeof f=="number",P=s.segment.uri?"segment":"pre-segment",T=x?Fh({preloadSegment:i})-1:0;return`${P} [${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 [${m}] selected by [${w}] playlist [${a}]`},wc=s=>`${s}TimingInfo`,Fv=({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,wo=({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},Uv=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)},jv=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},bi=s=>{const e=s.pendingSegment_;if(!e)return;if(wo({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&Uv(s.timelineChangeController_)){if(jv(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},qv=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},Ac=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+Qt:!1,$v=(s,e)=>{if(e!=="hls")return null;const t=qv({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,r=Ac({segmentDuration:t,maxDuration:i*2}),n=Ac({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 Ao extends $.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_():bi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Ke({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():bi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Ke({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():bi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():bi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Za.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_&&Za.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return st();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=Ln(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=rf(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},Se.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)},Se.prototype.displayWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&(c.windows[g].visible=1);return o},Se.prototype.hideWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&(c.windows[g].visible=0);return o},Se.prototype.toggleWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&(c.windows[g].visible^=1);return o},Se.prototype.clearWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&c.windows[g].clearText();return o},Se.prototype.deleteWindows=function(o,c){var h=this.current708Packet.data,d=h[++o],p=this.getPts(o);this.flushDisplayed(p,c);for(var g=0;g<8;g++)d&1<<g&&c.windows[g].reset();return o},Se.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},Se.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},Se.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},Se.prototype.reset=function(o,c){var h=this.getPts(o);return this.flushDisplayed(h,c),this.initService(c.serviceNum,o)};var Pr={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},Lr=function(o){return o===null?"":(o=Pr[o]||o,String.fromCharCode(o))},Or=14,Bf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oi=function(){for(var o=[],c=Or+1;c--;)o.push({text:"",indent:0,offset:0});return o},Be=function(o,c){Be.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,g,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),g=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(g,S))g=(g&3)<<8,C=Lr(g|S),this[this.mode_](h.pts,C),this.column_++;else if(this.isExtCharacter(g,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),g=(g&3)<<8,C=Lr(g|S),this[this.mode_](h.pts,C),this.column_++;else if(this.isMidRowCode(g,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(g,S)){const k=S&3;this.nonDisplayed_[this.row_].offset=k,this.column_+=k}else if(this.isPAC(g,S)){var A=Bf.indexOf(d&7968);if(this.mode_==="rollUp"&&(A-this.rollUpRows_+1<0&&(A=this.rollUpRows_-1),this.setRollUp(h.pts,A)),A!==this.row_&&A>=0&&A<=14&&(this.clearFormatting(h.pts),this.row_=A),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(g)&&(S===0&&(S=null),C=Lr(g),C+=Lr(S),this[this.mode_](h.pts,C),this.column_+=C.length)}};Be.prototype=new Nt,Be.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_})},Be.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_=Or,this.rollUpRows_=2,this.formatting_=[]},Be.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},Be.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Be.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Be.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Be.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Be.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Be.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Be.prototype.isNormalChar=function(o){return o>=32&&o<=127},Be.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=Or,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},Be.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)},Be.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)}},Be.prototype.popOn=function(o,c){var h=this.nonDisplayed_[this.row_].text;h+=c,this.nonDisplayed_[this.row_].text=h},Be.prototype.rollUp=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h},Be.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<Or+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}},Be.prototype.paintOn=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h};var pu={CaptionStream:He,Cea608Stream:Be,Cea708Stream:Se},Rr={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ff=t,Uf=8589934592,jf=4294967296,mu="shared",sa=function(o,c){var h=1;for(o>c&&(h=-1);Math.abs(c-o)>jf;)o+=h*Uf;return o},ra=function(o){var c,h;ra.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=sa(d.dts,h),d.pts=sa(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")}};ra.prototype=new Ff;var gu={TimestampRolloverStream:ra,handleRollover:sa},qf=(o,c,h)=>{if(!o)return-1;for(var d=h;d<o.length;d++)if(o[d]===c)return d;return-1},$f={typedArrayIndexOf:qf},Nr=$f.typedArrayIndexOf,Mr={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},Fs=function(o,c,h){return decodeURIComponent(_u(o,c,h))},Us=function(o,c,h){return unescape(_u(o,c,h))},js=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},qs={APIC:function(o){var c=1,h,d,p="-->";o.data[0]===Mr.Utf8&&(h=Nr(o.data,0,c),!(h<0)&&(o.mimeType=Us(o.data,c,h),c=h+1,o.pictureType=o.data[c],c++,d=Nr(o.data,0,c),!(d<0)&&(o.description=Fs(o.data,c,d),c=d+1,o.mimeType===p?o.url=Us(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===Mr.Utf8&&(o.value=Fs(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===Mr.Utf8&&(c=Nr(o.data,0,1),c!==-1&&(o.description=Fs(o.data,1,c),o.value=Fs(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=Us(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===Mr.Utf8&&(c=Nr(o.data,0,1),c!==-1&&(o.description=Fs(o.data,1,c),o.url=Us(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=Us(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},Vf=function(o){var c,h,d=10,p=0,g=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){p=js(o.subarray(6,10)),p+=10;var S=o[5]&64;S&&(d+=4,d+=js(o.subarray(10,14)),p-=js(o.subarray(16,20)));do{if(c=js(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,qs[C.id]?qs[C.id](C):C.id[0]==="T"?qs["T*"](C):C.id[0]==="W"&&qs["W*"](C),g.push(C),d+=10,d+=c}while(d<p);return g}},yu={parseId3Frames:Vf,parseSyncSafeInteger:js,frameParsers:qs},Hf=t,zf=Rr,gi=yu,Br;Br=function(o){var c={descriptor:o&&o.descriptor},h=0,d=[],p=0,g;if(Br.prototype.init.call(this),this.dispatchType=zf.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(g=0;g<c.descriptor.length;g++)this.dispatchType+=("00"+c.descriptor[g].toString(16)).slice(-2);this.push=function(S){var C,A,k,B,X,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=gi.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},X=0;X<h;)C.data.set(d[0].data.subarray(0,h-X),X),X+=d[0].data.byteLength,p-=d[0].data.byteLength,d.shift();A=10,C.data[5]&64&&(A+=4,A+=gi.parseSyncSafeInteger(C.data.subarray(10,14)),h-=gi.parseSyncSafeInteger(C.data.subarray(16,20)));do{if(k=gi.parseSyncSafeInteger(C.data.subarray(A+4,A+8)),k<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(oe=String.fromCharCode(C.data[A],C.data[A+1],C.data[A+2],C.data[A+3]),B={id:oe,data:C.data.subarray(A+10,A+k+10)},B.key=B.id,gi.frameParsers[B.id]?gi.frameParsers[B.id](B):B.id[0]==="T"?gi.frameParsers["T*"](B):B.id[0]==="W"&&gi.frameParsers["W*"](B),B.owner==="com.apple.streaming.transportStreamTimestamp"){var Q=B.data,he=(Q[3]&1)<<30|Q[4]<<22|Q[5]<<14|Q[6]<<6|Q[7]>>>2;he*=4,he+=Q[7]&3,B.timeStamp=he,C.pts===void 0&&C.dts===void 0&&(C.pts=B.timeStamp,C.dts=B.timeStamp),this.trigger("timestamp",B)}C.frames.push(B),A+=10,A+=k}while(A<h);this.trigger("data",C)}}}},Br.prototype=new Hf;var Gf=Br,na=t,aa=pu,Mt=Rr,Wf=gu.TimestampRolloverStream,Fr,$s,Ur,Yi=188,oa=71;Fr=function(){var o=new Uint8Array(Yi),c=0;Fr.prototype.init.call(this),this.push=function(h){var d=0,p=Yi,g;for(c?(g=new Uint8Array(h.byteLength+c),g.set(o.subarray(0,c)),g.set(h,c),c=0):g=h;p<g.byteLength;){if(g[d]===oa&&g[p]===oa){this.trigger("data",g.subarray(d,p)),d+=Yi,p+=Yi;continue}d++,p++}d<g.byteLength&&(o.set(g.subarray(d),0),c=g.byteLength-d)},this.flush=function(){c===Yi&&o[0]===oa&&(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")}},Fr.prototype=new na,$s=function(){var o,c,h,d;$s.prototype.init.call(this),d=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(p,g){var S=0;g.payloadUnitStartIndicator&&(S+=p[S]+1),g.type==="pat"?c(p.subarray(S),g):h(p.subarray(S),g)},c=function(p,g){g.section_number=p[7],g.last_section_number=p[8],d.pmtPid=(p[10]&31)<<8|p[11],g.pmtPid=d.pmtPid},h=function(p,g){var S,C,A,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,A=(p[10]&15)<<8|p[11],k=12+A;k<C;){var B=p[k],X=(p[k+1]&31)<<8|p[k+2];B===Mt.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=X:B===Mt.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=X:B===Mt.METADATA_STREAM_TYPE&&(d.programMapTable["timed-metadata"][X]=B),k+=((p[k+3]&15)<<8|p[k+4])+5}g.programMapTable=d.programMapTable}},this.push=function(p){var g={},S=4;if(g.payloadUnitStartIndicator=!!(p[1]&64),g.pid=p[1]&31,g.pid<<=8,g.pid|=p[2],(p[3]&48)>>>4>1&&(S+=p[S]+1),g.pid===0)g.type="pat",o(p.subarray(S),g),this.trigger("data",g);else if(g.pid===this.pmtPid)for(g.type="pmt",o(p.subarray(S),g),this.trigger("data",g);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([p,S,g]):this.processPes_(p,S,g)},this.processPes_=function(p,g,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(g),this.trigger("data",S)}},$s.prototype=new na,$s.STREAM_TYPES={h264:27,adts:15},Ur=function(){var o=this,c=!1,h={data:[],size:0},d={data:[],size:0},p={data:[],size:0},g,S=function(A,k){var B;const X=A[0]<<16|A[1]<<8|A[2];k.data=new Uint8Array,X===1&&(k.packetLength=6+(A[4]<<8|A[5]),k.dataAlignmentIndicator=(A[6]&4)!==0,B=A[7],B&192&&(k.pts=(A[9]&14)<<27|(A[10]&255)<<20|(A[11]&254)<<12|(A[12]&255)<<5|(A[13]&254)>>>3,k.pts*=4,k.pts+=(A[13]&6)>>>1,k.dts=k.pts,B&64&&(k.dts=(A[14]&14)<<27|(A[15]&255)<<20|(A[16]&254)<<12|(A[17]&255)<<5|(A[18]&254)>>>3,k.dts*=4,k.dts+=(A[18]&6)>>>1)),k.data=A.subarray(9+A[8]))},C=function(A,k,B){var X=new Uint8Array(A.size),oe={type:k},Q=0,he=0,ve=!1,et;if(!(!A.data.length||A.size<9)){for(oe.trackId=A.data[0].pid,Q=0;Q<A.data.length;Q++)et=A.data[Q],X.set(et.data,he),he+=et.data.byteLength;S(X,oe),ve=k==="video"||oe.packetLength<=A.size,(B||ve)&&(A.size=0,A.data.length=0),ve&&o.trigger("data",oe)}};Ur.prototype.init.call(this),this.push=function(A){({pat:function(){},pes:function(){var k,B;switch(A.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}A.payloadUnitStartIndicator&&C(k,B,!0),k.data.push(A),k.size+=A.data.byteLength},pmt:function(){var k={type:"metadata",tracks:[]};g=A.programMapTable,g.video!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.video,codec:"avc",type:"video"}),g.audio!==null&&k.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.audio,codec:"adts",type:"audio"}),c=!0,o.trigger("data",k)}})[A.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&&g){var A={type:"metadata",tracks:[]};g.video!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.video,codec:"avc",type:"video"}),g.audio!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+g.audio,codec:"adts",type:"audio"}),o.trigger("data",A)}c=!1,this.flushStreams_(),this.trigger("done")}},Ur.prototype=new na;var Tu={PAT_PID:0,MP2T_PACKET_LENGTH:Yi,TransportPacketStream:Fr,TransportParseStream:$s,ElementaryStream:Ur,TimestampRolloverStream:Wf,CaptionStream:aa.CaptionStream,Cea608Stream:aa.Cea608Stream,Cea708Stream:aa.Cea708Stream,MetadataStream:Gf};for(var ua in Mt)Mt.hasOwnProperty(ua)&&(Tu[ua]=Mt[ua]);var Xf=Tu,Kf=t,Yf=we.ONE_SECOND_IN_TS,jr,vu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];jr=function(o){var c,h=0;jr.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,g,S,C,A,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,g=(c[p+3]&3)<<11|c[p+4]<<3|(c[p+5]&224)>>5,A=((c[p+6]&3)+1)*1024,k=A*Yf/vu[(c[p+2]&60)>>>2],c.byteLength-p<g)break;this.trigger("data",{pts:d.pts+h*k,dts:d.dts+h*k,sampleCount:A,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+g)}),h++,p+=g}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")}},jr.prototype=new Kf;var Qf=jr,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,g=new Uint8Array(4),S=Math.min(4,c);if(S===0)throw new Error("no bytes available");g.set(o.subarray(p,p+S)),h=new DataView(g.buffer).getUint32(0),d=S*8,c-=S},this.skipBits=function(p){var g;d>p?(h<<=p,d-=p):(p-=d,g=Math.floor(p/8),p-=g*8,c-=g,this.loadWord(),h<<=p,d-=p)},this.readBits=function(p){var g=Math.min(d,p),S=h>>>32-g;return d-=g,d>0?h<<=g:c>0&&this.loadWord(),g=p-g,g>0?S<<g|this.readBits(g):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 Jf=bu,xu=t,Zf=Jf,qr,$r,Su;$r=function(){var o=0,c,h;$r.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 g=h.byteLength;o<g-3;o++)if(h[o+2]===1){c=o+5;break}for(;c<g;)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<g);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")}},$r.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},qr=function(){var o=new $r,c,h,d,p,g,S,C;qr.prototype.init.call(this),c=this,this.push=function(A){A.type==="video"&&(h=A.trackId,d=A.pts,p=A.dts,o.push(A))},o.on("data",function(A){var k={trackId:h,pts:d,dts:p,data:A,nalUnitTypeCode:A[0]&31};switch(k.nalUnitTypeCode){case 5:k.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:k.nalUnitType="sei_rbsp",k.escapedRBSP=g(A.subarray(1));break;case 7:k.nalUnitType="seq_parameter_set_rbsp",k.escapedRBSP=g(A.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(A,k){var B=8,X=8,oe,Q;for(oe=0;oe<A;oe++)X!==0&&(Q=k.readExpGolomb(),X=(B+Q+256)%256),B=X===0?B:X},g=function(A){for(var k=A.byteLength,B=[],X=1,oe,Q;X<k-2;)A[X]===0&&A[X+1]===0&&A[X+2]===3?(B.push(X+2),X+=2):X++;if(B.length===0)return A;oe=k-B.length,Q=new Uint8Array(oe);var he=0;for(X=0;X<oe;he++,X++)he===B[0]&&(he++,B.shift()),Q[X]=A[he];return Q},S=function(A){var k=0,B=0,X=0,oe=0,Q,he,ve,et,bt,yi,Ks,Ys,Qs,Js,en,Ne=[1,1],Zs,Ft;if(Q=new Zf(A),he=Q.readUnsignedByte(),et=Q.readUnsignedByte(),ve=Q.readUnsignedByte(),Q.skipUnsignedExpGolomb(),Su[he]&&(bt=Q.readUnsignedExpGolomb(),bt===3&&Q.skipBits(1),Q.skipUnsignedExpGolomb(),Q.skipUnsignedExpGolomb(),Q.skipBits(1),Q.readBoolean()))for(en=bt!==3?8:12,Ft=0;Ft<en;Ft++)Q.readBoolean()&&(Ft<6?C(16,Q):C(64,Q));if(Q.skipUnsignedExpGolomb(),yi=Q.readUnsignedExpGolomb(),yi===0)Q.readUnsignedExpGolomb();else if(yi===1)for(Q.skipBits(1),Q.skipExpGolomb(),Q.skipExpGolomb(),Ks=Q.readUnsignedExpGolomb(),Ft=0;Ft<Ks;Ft++)Q.skipExpGolomb();if(Q.skipUnsignedExpGolomb(),Q.skipBits(1),Ys=Q.readUnsignedExpGolomb(),Qs=Q.readUnsignedExpGolomb(),Js=Q.readBits(1),Js===0&&Q.skipBits(1),Q.skipBits(1),Q.readBoolean()&&(k=Q.readUnsignedExpGolomb(),B=Q.readUnsignedExpGolomb(),X=Q.readUnsignedExpGolomb(),oe=Q.readUnsignedExpGolomb()),Q.readBoolean()&&Q.readBoolean()){switch(Zs=Q.readUnsignedByte(),Zs){case 1:Ne=[1,1];break;case 2:Ne=[12,11];break;case 3:Ne=[10,11];break;case 4:Ne=[16,11];break;case 5:Ne=[40,33];break;case 6:Ne=[24,11];break;case 7:Ne=[20,11];break;case 8:Ne=[32,11];break;case 9:Ne=[80,33];break;case 10:Ne=[18,11];break;case 11:Ne=[15,11];break;case 12:Ne=[64,33];break;case 13:Ne=[160,99];break;case 14:Ne=[4,3];break;case 15:Ne=[3,2];break;case 16:Ne=[2,1];break;case 255:{Ne=[Q.readUnsignedByte()<<8|Q.readUnsignedByte(),Q.readUnsignedByte()<<8|Q.readUnsignedByte()];break}}Ne&&Ne[0]/Ne[1]}return{profileIdc:he,levelIdc:ve,profileCompatibility:et,width:(Ys+1)*16-k*2-B*2,height:(2-Js)*(Qs+1)*16-X*2-oe*2,sarRatio:Ne}}},qr.prototype=new xu;var ep={H264Stream:qr},tp=[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))},ip=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]},sp=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},rp=function(o,c,h){return unescape(sp(o,c,h))},np=function(o,c){var h=(o[c+5]&224)>>5,d=o[c+4]<<3,p=o[c+3]&6144;return p|d|h},ap=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},op=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return tp[(o[c+2]&60)>>>2]}return null},up=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 g=0;g<d.byteLength;g++)if(d[g]===0){var S=rp(d,0,g);if(S==="com.apple.streaming.transportStreamTimestamp"){var C=d.subarray(g+1),A=(C[3]&1)<<30|C[4]<<22|C[5]<<14|C[6]<<6|C[7]>>>2;return A*=4,A+=C[7]&3,A}break}}c+=10,c+=h}while(c<o.byteLength);return null},la={isLikelyAacData:ip,parseId3TagSize:Eu,parseAdtsSize:np,parseType:ap,parseSampleRate:op,parseAacTimestamp:up},lp=t,Au=la,Vr;Vr=function(){var o=new Uint8Array,c=0;Vr.prototype.init.call(this),this.setTimestamp=function(h){c=h},this.push=function(h){var d=0,p=0,g,S,C,A;for(o.length?(A=o.length,o=new Uint8Array(h.byteLength+A),o.set(o.subarray(0,A)),o.set(h,A)):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++}g=o.length-p,g>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")}},Vr.prototype=new lp;var cp=Vr,dp=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],hp=dp,fp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],pp=fp,Hr=t,Vs=Je,Hs=xe,zr=Bs,Bt=z,ni=Xf,Gr=we,Du=Qf,mp=ep.H264Stream,gp=cp,_p=la.isLikelyAacData,yp=we.ONE_SECOND_IN_TS,ku=hp,Iu=pp,Wr,zs,Xr,Ri,Tp=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",Tp.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,g){var S=h-c,C=d-c,A=p-h;return{start:{dts:o,pts:o+S},end:{dts:o+C,pts:o+A},prependedContentDuration:g,baseMediaDecodeTime:o}};zs=function(o,c){var h=[],d,p=0,g=0,S=1/0;c=c||{},d=c.firstSequenceNumber||0,zs.prototype.init.call(this),this.push=function(C){Bt.collectDtsInfo(o,C),o&&ku.forEach(function(A){o[A]=C[A]}),h.push(C)},this.setEarliestDts=function(C){p=C},this.setVideoBaseMediaDecodeTime=function(C){S=C},this.setAudioAppendStart=function(C){g=C},this.flush=function(){var C,A,k,B,X,oe,Q;if(h.length===0){this.trigger("done","AudioSegmentStream");return}C=zr.trimAdtsFramesByEarliestDts(h,o,p),o.baseMediaDecodeTime=Bt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),Q=zr.prefixWithSilence(o,C,g,S),o.samples=zr.generateSampleTable(C),k=Vs.mdat(zr.concatenateFrameData(C)),h=[],A=Vs.moof(d,[o]),B=new Uint8Array(A.byteLength+k.byteLength),d++,B.set(A),B.set(k,A.byteLength),Bt.clearDtsInfo(o),X=Math.ceil(yp*1024/o.samplerate),C.length&&(oe=C.length*X,this.trigger("segmentTimingInfo",Ou(Gr.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")}},zs.prototype=new Hr,Wr=function(o,c){var h,d=[],p=[],g,S;c=c||{},h=c.firstSequenceNumber||0,Wr.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(C){Bt.collectDtsInfo(o,C),C.nalUnitType==="seq_parameter_set_rbsp"&&!g&&(g=C.config,o.sps=[C.data],Iu.forEach(function(A){o[A]=g[A]},this)),C.nalUnitType==="pic_parameter_set_rbsp"&&!S&&(S=C.data,o.pps=[C.data]),d.push(C)},this.flush=function(){for(var C,A,k,B,X,oe,Q=0,he,ve;d.length&&d[0].nalUnitType!=="access_unit_delimiter_rbsp";)d.shift();if(d.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(C=Hs.groupNalsIntoFrames(d),k=Hs.groupFramesIntoGops(C),k[0][0].keyFrame||(A=this.getGopForFusion_(d[0],o),A?(Q=A.duration,k.unshift(A),k.byteLength+=A.byteLength,k.nalCount+=A.nalCount,k.pts=A.pts,k.dts=A.dts,k.duration+=A.duration):k=Hs.extendFirstKeyFrame(k)),p.length){var et;if(c.alignGopsAtEnd?et=this.alignGopsAtEnd_(k):et=this.alignGopsAtStart_(k),!et){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=et}Bt.collectDtsInfo(o,k),o.samples=Hs.generateSampleTable(k),X=Vs.mdat(Hs.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}})),he=k[0],ve=k[k.length-1],this.trigger("segmentTimingInfo",Ou(o.baseMediaDecodeTime,he.dts,he.pts,ve.dts+ve.duration,ve.pts+ve.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=Vs.moof(h,[o]),oe=new Uint8Array(B.byteLength+X.byteLength),h++,oe.set(B),oe.set(X,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),g=void 0,S=void 0},this.getGopForFusion_=function(C){var A=45e3,k=1/0,B,X,oe,Q,he;for(he=0;he<this.gopCache_.length;he++)Q=this.gopCache_[he],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<=A&&(!X||k>B)&&(X=Q,k=B)));return X?X.gop:null},this.alignGopsAtStart_=function(C){var A,k,B,X,oe,Q,he,ve;for(oe=C.byteLength,Q=C.nalCount,he=C.duration,A=k=0;A<p.length&&k<C.length&&(B=p[A],X=C[k],B.pts!==X.pts);){if(X.pts>B.pts){A++;continue}k++,oe-=X.byteLength,Q-=X.nalCount,he-=X.duration}return k===0?C:k===C.length?null:(ve=C.slice(k),ve.byteLength=oe,ve.duration=he,ve.nalCount=Q,ve.pts=ve[0].pts,ve.dts=ve[0].dts,ve)},this.alignGopsAtEnd_=function(C){var A,k,B,X,oe,Q;for(A=p.length-1,k=C.length-1,oe=null,Q=!1;A>=0&&k>=0;){if(B=p[A],X=C[k],B.pts===X.pts){Q=!0;break}if(B.pts>X.pts){A--;continue}A===p.length-1&&(oe=k),k--}if(!Q&&oe===null)return null;var he;if(Q?he=k:he=oe,he===0)return C;var ve=C.slice(he),et=ve.reduce(function(bt,yi){return bt.byteLength+=yi.byteLength,bt.duration+=yi.duration,bt.nalCount+=yi.nalCount,bt},{byteLength:0,duration:0,nalCount:0});return ve.byteLength=et.byteLength,ve.duration=et.duration,ve.nalCount=et.nalCount,ve.pts=ve[0].pts,ve.dts=ve[0].dts,ve},this.alignGopsWith=function(C){p=C}},Wr.prototype=new Hr,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 Hr,Ri.prototype.flush=function(o){var c=0,h={captions:[],captionStreams:{},metadata:[],info:{}},d,p,g,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(A){h.info[A]=this.videoTrack[A]},this)):this.audioTrack&&(S=this.audioTrack.timelineStartInfo.pts,ku.forEach(function(A){h.info[A]=this.audioTrack[A]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?h.type=this.pendingTracks[0].type:h.type="combined",this.emittedTracks+=this.pendingTracks.length,g=Vs.initSegment(this.pendingTracks),h.initSegment=new Uint8Array(g.byteLength),h.initSegment.set(g),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=Gr.metadataTsToSeconds(d.startPts,S,this.keepOriginalTimestamps),d.endTime=Gr.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=Gr.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},Xr=function(o){var c=this,h=!0,d,p;Xr.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="aac",g.metadataStream=new ni.MetadataStream,g.aacStream=new gp,g.audioTimestampRolloverStream=new ni.TimestampRolloverStream("audio"),g.timedMetadataTimestampRolloverStream=new ni.TimestampRolloverStream("timed-metadata"),g.adtsStream=new Du,g.coalesceStream=new Ri(o,g.metadataStream),g.headOfPipeline=g.aacStream,g.aacStream.pipe(g.audioTimestampRolloverStream).pipe(g.adtsStream),g.aacStream.pipe(g.timedMetadataTimestampRolloverStream).pipe(g.metadataStream).pipe(g.coalesceStream),g.metadataStream.on("timestamp",function(S){g.aacStream.setTimestamp(S.timeStamp)}),g.aacStream.on("data",function(S){S.type!=="timed-metadata"&&S.type!=="audio"||g.audioSegmentStream||(p=p||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},g.coalesceStream.numberOfTracks++,g.audioSegmentStream=new zs(p,o),g.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),g.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),g.adtsStream.pipe(g.audioSegmentStream).pipe(g.coalesceStream),c.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d}))}),g.coalesceStream.on("data",this.trigger.bind(this,"data")),g.coalesceStream.on("done",this.trigger.bind(this,"done")),Pu(this,g)},this.setupTsPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="ts",g.metadataStream=new ni.MetadataStream,g.packetStream=new ni.TransportPacketStream,g.parseStream=new ni.TransportParseStream,g.elementaryStream=new ni.ElementaryStream,g.timestampRolloverStream=new ni.TimestampRolloverStream,g.adtsStream=new Du,g.h264Stream=new mp,g.captionStream=new ni.CaptionStream(o),g.coalesceStream=new Ri(o,g.metadataStream),g.headOfPipeline=g.packetStream,g.packetStream.pipe(g.parseStream).pipe(g.elementaryStream).pipe(g.timestampRolloverStream),g.timestampRolloverStream.pipe(g.h264Stream),g.timestampRolloverStream.pipe(g.adtsStream),g.timestampRolloverStream.pipe(g.metadataStream).pipe(g.coalesceStream),g.h264Stream.pipe(g.captionStream).pipe(g.coalesceStream),g.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&&!g.videoSegmentStream&&(g.coalesceStream.numberOfTracks++,g.videoSegmentStream=new Wr(d,o),g.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),g.videoSegmentStream.on("timelineStartInfo",function(A){p&&!o.keepOriginalTimestamps&&(p.timelineStartInfo=A,g.audioSegmentStream.setEarliestDts(A.dts-c.baseMediaDecodeTime))}),g.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),g.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),g.videoSegmentStream.on("baseMediaDecodeTime",function(A){p&&g.audioSegmentStream.setVideoBaseMediaDecodeTime(A)}),g.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),g.h264Stream.pipe(g.videoSegmentStream).pipe(g.coalesceStream)),p&&!g.audioSegmentStream&&(g.coalesceStream.numberOfTracks++,g.audioSegmentStream=new zs(p,o),g.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),g.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),g.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),g.adtsStream.pipe(g.audioSegmentStream).pipe(g.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d})}}),g.coalesceStream.on("data",this.trigger.bind(this,"data")),g.coalesceStream.on("id3Frame",function(S){S.dispatchType=g.metadataStream.dispatchType,c.trigger("id3Frame",S)}),g.coalesceStream.on("caption",this.trigger.bind(this,"caption")),g.coalesceStream.on("done",this.trigger.bind(this,"done")),Pu(this,g)},this.setBaseMediaDecodeTime=function(g){var S=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=g),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(g){p&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(g)},this.setRemux=function(g){var S=this.transmuxPipeline_;o.remux=g,S&&S.coalesceStream&&S.coalesceStream.setRemux(g)},this.alignGopsWith=function(g){d&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(g)},this.getLogTrigger_=function(g){var S=this;return function(C){C.stream=g,S.trigger("log",C)}},this.push=function(g){if(h){var S=_p(g);S&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!S&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),h=!1}this.transmuxPipeline_.headOfPipeline.push(g)},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()}},Xr.prototype=new Hr;var vp={Transmuxer:Xr},bp=function(o){return o>>>0},xp=function(o){return("00"+o.toString(16)).slice(-2)},Kr={toUnsigned:bp,toHexString:xp},Sp=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=Sp,Ep=Kr.toUnsigned,Cp=Ru,Nu=function(o,c){var h=[],d,p,g,S,C;if(!c.length)return null;for(d=0;d<o.byteLength;)p=Ep(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3]),g=Cp(o.subarray(d+4,d+8)),S=p>1?d+p:o.byteLength,g===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},ca=Nu,wp=Kr.toUnsigned,Ap=n.getUint64,Dp=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=Ap(o.subarray(4)):c.baseMediaDecodeTime=wp(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},da=Dp,kp=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,g=h.flags[2]&8,S=h.flags[2]&16,C=h.flags[2]&32,A=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),g&&(h.defaultSampleDuration=c.getUint32(B),B+=4),S&&(h.defaultSampleSize=c.getUint32(B),B+=4),C&&(h.defaultSampleFlags=c.getUint32(B)),A&&(h.durationIsEmpty=!0),!d&&k&&(h.baseDataOffsetIsMoof=!0),h},Mu=kp,Ip=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]}},Pp=Ip,Bu=Pp,Lp=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,g=c.flags[1]&1,S=c.flags[1]&2,C=c.flags[1]&4,A=c.flags[1]&8,k=h.getUint32(4),B=8,X;for(d&&(c.dataOffset=h.getInt32(B),B+=4),p&&k&&(X={flags:Bu(o.subarray(B,B+4))},B+=4,g&&(X.duration=h.getUint32(B),B+=4),S&&(X.size=h.getUint32(B),B+=4),A&&(c.version===1?X.compositionTimeOffset=h.getInt32(B):X.compositionTimeOffset=h.getUint32(B),B+=4),c.samples.push(X),k--);k--;)X={},g&&(X.duration=h.getUint32(B),B+=4),S&&(X.size=h.getUint32(B),B+=4),C&&(X.flags=Bu(o.subarray(B,B+4)),B+=4),A&&(c.version===1?X.compositionTimeOffset=h.getInt32(B):X.compositionTimeOffset=h.getUint32(B),B+=4),c.samples.push(X);return c},Fu=Lp,Uu={tfdt:da,trun:Fu},ju={parseTfdt:Uu.tfdt,parseTrun:Uu.trun},Op=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},Rp={uint8ToCString:Op},Yr=Rp.uint8ToCString,Np=n.getUint64,Mp=function(o){var c=4,h=o[0],d,p,g,S,C,A,k,B;if(h===0){d=Yr(o.subarray(c)),c+=d.length,p=Yr(o.subarray(c)),c+=p.length;var X=new DataView(o.buffer);g=X.getUint32(c),c+=4,C=X.getUint32(c),c+=4,A=X.getUint32(c),c+=4,k=X.getUint32(c),c+=4}else if(h===1){var X=new DataView(o.buffer);g=X.getUint32(c),c+=4,S=Np(o.subarray(c)),c+=8,A=X.getUint32(c),c+=4,k=X.getUint32(c),c+=4,d=Yr(o.subarray(c)),c+=d.length,p=Yr(o.subarray(c)),c+=p.length}B=new Uint8Array(o.subarray(c,o.byteLength));var oe={scheme_id_uri:d,value:p,timescale:g||1,presentation_time:S,presentation_time_delta:C,event_duration:A,id:k,message_data:B};return Fp(h,oe)?oe:void 0},Bp=function(o,c,h,d){return o||o===0?o/c:d+h/c},Fp=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},Up={parseEmsgBox:Mp,scaleTime:Bp},Gs;typeof window<"u"?Gs=window:typeof s<"u"?Gs=s:typeof self<"u"?Gs=self:Gs={};var $u=Gs,Qr=Kr.toUnsigned,Ws=Kr.toHexString,Xe=ca,Qi=Ru,ha=Up,jp=Mu,qp=Fu,$p=da,Vp=n.getUint64,Vu,Hu,zu,Gu,Wu,fa,Xu,pa=$u,Hp=yu.parseId3Frames;Vu=function(o){var c={},h=Xe(o,["moov","trak"]);return h.reduce(function(d,p){var g,S,C,A,k;return g=Xe(p,["tkhd"])[0],!g||(S=g[0],C=S===0?12:20,A=Qr(g[C]<<24|g[C+1]<<16|g[C+2]<<8|g[C+3]),k=Xe(p,["mdia","mdhd"])[0],!k)?null:(S=k[0],C=S===0?12:20,d[A]=Qr(k[C]<<24|k[C+1]<<16|k[C+2]<<8|k[C+3]),d)},c)},Hu=function(o,c){var h;h=Xe(c,["moof","traf"]);var d=h.reduce(function(p,g){var S=Xe(g,["tfhd"])[0],C=Qr(S[4]<<24|S[5]<<16|S[6]<<8|S[7]),A=o[C]||9e4,k=Xe(g,["tfdt"])[0],B=new DataView(k.buffer,k.byteOffset,k.byteLength),X;k[0]===1?X=Vp(k.subarray(4,12)):X=B.getUint32(4);let oe;return typeof X=="bigint"?oe=X/pa.BigInt(A):typeof X=="number"&&!isNaN(X)&&(oe=X/A),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=Xe(c,["moof","traf"]),d=0,p=0,g;if(h&&h.length){var S=Xe(h[0],["tfhd"])[0],C=Xe(h[0],["trun"])[0],A=Xe(h[0],["tfdt"])[0];if(S){var k=jp(S);g=k.trackId}if(A){var B=$p(A);d=B.baseMediaDecodeTime}if(C){var X=qp(C);X.samples&&X.samples.length&&(p=X.samples[0].compositionTimeOffset||0)}}var oe=o[g]||9e4;typeof d=="bigint"&&(p=pa.BigInt(p),oe=pa.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=Xe(o,["moov","trak"]),h=[];return c.forEach(function(d){var p=Xe(d,["mdia","hdlr"]),g=Xe(d,["tkhd"]);p.forEach(function(S,C){var A=Qi(S.subarray(8,12)),k=g[C],B,X,oe;A==="vide"&&(B=new DataView(k.buffer,k.byteOffset,k.byteLength),X=B.getUint8(0),oe=X===0?B.getUint32(12):B.getUint32(20),h.push(oe))})}),h},fa=function(o){var c=o[0],h=c===0?12:20;return Qr(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3])},Wu=function(o){var c=Xe(o,["moov","trak"]),h=[];return c.forEach(function(d){var p={},g=Xe(d,["tkhd"])[0],S,C;g&&(S=new DataView(g.buffer,g.byteOffset,g.byteLength),C=S.getUint8(0),p.id=C===0?S.getUint32(12):S.getUint32(20));var A=Xe(d,["mdia","hdlr"])[0];if(A){var k=Qi(A.subarray(8,12));k==="vide"?p.type="video":k==="soun"?p.type="audio":p.type=k}var B=Xe(d,["mdia","minf","stbl","stsd"])[0];if(B){var X=B.subarray(8);p.codec=Qi(X.subarray(4,8));var oe=Xe(X,[p.codec])[0],Q,he;oe&&(/^[asm]vc[1-9]$/i.test(p.codec)?(Q=oe.subarray(78),he=Qi(Q.subarray(4,8)),he==="avcC"&&Q.length>11?(p.codec+=".",p.codec+=Ws(Q[9]),p.codec+=Ws(Q[10]),p.codec+=Ws(Q[11])):p.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(p.codec)?(Q=oe.subarray(28),he=Qi(Q.subarray(4,8)),he==="esds"&&Q.length>20&&Q[19]!==0?(p.codec+="."+Ws(Q[19]),p.codec+="."+Ws(Q[20]>>>2&63).replace(/^0/,"")):p.codec="mp4a.40.2"):p.codec=p.codec.toLowerCase())}var ve=Xe(d,["mdia","mdhd"])[0];ve&&(p.timescale=fa(ve)),h.push(p)}),h},Xu=function(o,c=0){var h=Xe(o,["emsg"]);return h.map(d=>{var p=ha.parseEmsgBox(new Uint8Array(d)),g=Hp(p.message_data);return{cueTime:ha.scaleTime(p.presentation_time,p.timescale,p.presentation_time_delta,c),duration:ha.scaleTime(p.event_duration,p.timescale),frames:g}})};var Xs={findBox:Xe,parseType:Qi,timescale:Vu,startTime:Hu,compositionStartTime:zu,videoTrackIds:Gu,tracks:Wu,getTimescaleFromMediaHeader:fa,getEmsgID3:Xu};const{parseTrun:zp}=ju,{findBox:Ku}=Xs;var Yu=$u,Gp=function(o){var c=Ku(o,["moof","traf"]),h=Ku(o,["mdat"]),d=[];return h.forEach(function(p,g){var S=c[g];d.push({mdat:p,traf:S})}),d},Wp=function(o,c,h){var d=c,p=h.defaultSampleDuration||0,g=h.defaultSampleSize||0,S=h.trackId,C=[];return o.forEach(function(A){var k=zp(A),B=k.samples;B.forEach(function(X){X.duration===void 0&&(X.duration=p),X.size===void 0&&(X.size=g),X.trackId=S,X.dts=d,X.compositionTimeOffset===void 0&&(X.compositionTimeOffset=0),typeof d=="bigint"?(X.pts=d+Yu.BigInt(X.compositionTimeOffset),d+=Yu.BigInt(X.duration)):(X.pts=d+X.compositionTimeOffset,d+=X.duration)}),C=C.concat(B)}),C},Qu={getMdatTrafPairs:Gp,parseSamples:Wp},Xp=wt.discardEmulationPreventionBytes,Kp=pu.CaptionStream,ma=ca,Yp=da,Qp=Mu,{getMdatTrafPairs:Jp,parseSamples:Zp}=Qu,em=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},tm=function(o,c,h){var d=new DataView(o.buffer,o.byteOffset,o.byteLength),p={logs:[],seiNals:[]},g,S,C,A;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=em(S,c);if(g={nalUnitType:"sei_rbsp",size:C,data:k,escapedRBSP:Xp(k),trackId:h},B)g.pts=B.pts,g.dts=B.dts,A=B;else if(A)g.pts=A.pts,g.dts=A.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(g);break}return p},im=function(o,c){var h={},d=Jp(o);return d.forEach(function(p){var g=p.mdat,S=p.traf,C=ma(S,["tfhd"]),A=Qp(C[0]),k=A.trackId,B=ma(S,["tfdt"]),X=B.length>0?Yp(B[0]).baseMediaDecodeTime:0,oe=ma(S,["trun"]),Q,he;c===k&&oe.length>0&&(Q=Zp(oe,X,A),he=tm(g,Q,k),h[k]||(h[k]={seiNals:[],logs:[]}),h[k].seiNals=h[k].seiNals.concat(he.seiNals),h[k].logs=h[k].logs.concat(he.logs))}),h},sm=function(o,c,h){var d;if(c===null)return null;d=im(o,c);var p=d[c]||{};return{seiNals:p.seiNals,logs:p.logs,timescale:h}},rm=function(){var o=!1,c,h,d,p,g,S;this.isInitialized=function(){return o},this.init=function(C){c=new Kp,o=!0,S=C?C.isPartial:!1,c.on("data",function(A){A.startTime=A.startPts/p,A.endTime=A.endPts/p,g.captions.push(A),g.captionStreams[A.stream]=!0}),c.on("log",function(A){g.logs.push(A)})},this.isNewInit=function(C,A){return C&&C.length===0||A&&typeof A=="object"&&Object.keys(A).length===0?!1:d!==C[0]||p!==A[d]},this.parse=function(C,A,k){var B;if(this.isInitialized()){if(!A||!k)return null;if(this.isNewInit(A,k))d=A[0],p=k[d];else if(d===null||!p)return h.push(C),null}else return null;for(;h.length>0;){var X=h.shift();this.parse(X,A,k)}return B=sm(C,d,p),B&&B.logs&&(g.logs=g.logs.concat(B.logs)),B===null||!B.seiNals?g.logs.length?{logs:g.logs,captions:[],captionStreams:[]}:null:(this.pushNals(B.seiNals),this.flushStream(),g)},this.pushNals=function(C){if(!this.isInitialized()||!C||C.length===0)return null;C.forEach(function(A){c.push(A)})},this.flushStream=function(){if(!this.isInitialized())return null;S?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){g.captions=[],g.captionStreams={},g.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,g?this.clearParsedCaptions():g={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},nm=rm;const{parseTfdt:am}=ju,_i=ca,{getTimescaleFromMediaHeader:om}=Xs,{parseSamples:um,getMdatTrafPairs:lm}=Qu;var Ju=function(){let o=9e4;this.init=function(c){const h=_i(c,["moov","trak","mdia","mdhd"])[0];h&&(o=om(h))},this.parseSegment=function(c){const h=[],d=lm(c);let p=0;return d.forEach(function(g){const S=g.mdat,C=g.traf,A=_i(C,["tfdt"])[0],k=_i(C,["tfhd"])[0],B=_i(C,["trun"]);if(A&&(p=am(A).baseMediaDecodeTime),B.length&&k){const X=um(B,p,k);let oe=0;X.forEach(function(Q){const he="utf-8",ve=new TextDecoder(he),et=S.slice(oe,oe+Q.size);if(_i(et,["vtte"])[0]){oe+=Q.size;return}_i(et,["vttc"]).forEach(function(Ks){const Ys=_i(Ks,["payl"])[0],Qs=_i(Ks,["sttg"])[0],Js=Q.pts/o,en=(Q.pts+Q.duration)/o;let Ne,Zs;if(Ys)try{Ne=ve.decode(Ys)}catch(Ft){console.error(Ft)}if(Qs)try{Zs=ve.decode(Qs)}catch(Ft){console.error(Ft)}Q.duration&&Ne&&h.push({cueText:Ne,start:Js,end:en,settings:Zs})}),oe+=Q.size})}}),h}},ga=Rr,Zu=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},Jr=function(o){return!!(o[1]&64)},Zr=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},cm=function(o,c){var h=Zu(o);return h===0?"pat":h===c?"pmt":c?"pes":null},dm=function(o){var c=Jr(o),h=4+Zr(o);return c&&(h+=o[h]+1),(o[h+10]&31)<<8|o[h+11]},hm=function(o){var c={},h=Jr(o),d=4+Zr(o);if(h&&(d+=o[d]+1),!!(o[d+5]&1)){var p,g,S;p=(o[d+1]&15)<<8|o[d+2],g=3+p-4,S=(o[d+10]&15)<<8|o[d+11];for(var C=12+S;C<g;){var A=d+C;c[(o[A+1]&31)<<8|o[A+2]]=o[A],C+=((o[A+3]&15)<<8|o[A+4])+5}return c}},fm=function(o,c){var h=Zu(o),d=c[h];switch(d){case ga.H264_STREAM_TYPE:return"video";case ga.ADTS_STREAM_TYPE:return"audio";case ga.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},pm=function(o){var c=Jr(o);if(!c)return null;var h=4+Zr(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},_a=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}},mm=function(o){for(var c=4+Zr(o),h=o.subarray(c),d=0,p=0,g=!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=_a(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(g=!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=_a(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(g=!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=_a(h[p+3]&31),S==="slice_layer_without_partitioning_rbsp_idr"&&(g=!0)),g},gm={parseType:cm,parsePat:dm,parsePmt:hm,parsePayloadUnitStartIndicator:Jr,parsePesType:fm,parsePesTime:pm,videoPacketContainsKeyFrame:mm},el=Rr,Ji=gu.handleRollover,ke={};ke.ts=gm,ke.aac=la;var Ni=we.ONE_SECOND_IN_TS,dt=188,Gt=71,_m=function(o,c){for(var h=0,d=dt,p,g;d<o.byteLength;){if(o[h]===Gt&&o[d]===Gt){switch(p=o.subarray(h,d),g=ke.ts.parseType(p,c.pid),g){case"pat":c.pid=ke.ts.parsePat(p);break;case"pmt":var S=ke.ts.parsePmt(p);c.table=c.table||{},Object.keys(S).forEach(function(C){c.table[C]=S[C]});break}h+=dt,d+=dt;continue}h++,d++}},tl=function(o,c,h){for(var d=0,p=dt,g,S,C,A,k,B=!1;p<=o.byteLength;){if(o[d]===Gt&&(o[p]===Gt||p===o.byteLength)){if(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S==="pes"&&(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=ke.ts.parsePesTime(g),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d+=dt,p+=dt;continue}d++,p++}for(p=o.byteLength,d=p-dt,B=!1;d>=0;){if(o[d]===Gt&&(o[p]===Gt||p===o.byteLength)){if(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S==="pes"&&(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=ke.ts.parsePesTime(g),k&&(k.type="audio",h.audio.push(k),B=!0))),B)break;d-=dt,p-=dt;continue}d--,p--}},ym=function(o,c,h){for(var d=0,p=dt,g,S,C,A,k,B,X,oe,Q=!1,he={data:[],size:0};p<o.byteLength;){if(o[d]===Gt&&o[p]===Gt){switch(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S){case"pes":if(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="video"&&(A&&!Q&&(k=ke.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),Q=!0)),!h.firstKeyFrame)){if(A&&he.size!==0){for(B=new Uint8Array(he.size),X=0;he.data.length;)oe=he.data.shift(),B.set(oe,X),X+=oe.byteLength;if(ke.ts.videoPacketContainsKeyFrame(B)){var ve=ke.ts.parsePesTime(B);ve?(h.firstKeyFrame=ve,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.")}he.size=0}he.data.push(g),he.size+=g.byteLength}break}if(Q&&h.firstKeyFrame)break;d+=dt,p+=dt;continue}d++,p++}for(p=o.byteLength,d=p-dt,Q=!1;d>=0;){if(o[d]===Gt&&o[p]===Gt){if(g=o.subarray(d,p),S=ke.ts.parseType(g,c.pid),S==="pes"&&(C=ke.ts.parsePesType(g,c.table),A=ke.ts.parsePayloadUnitStartIndicator(g),C==="video"&&A&&(k=ke.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),Q=!0))),Q)break;d-=dt,p-=dt;continue}d--,p--}},Tm=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(g){g.dts=Ji(g.dts,h),g.pts=Ji(g.pts,h),g.dtsTime=g.dts/Ni,g.ptsTime=g.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(g){g.dts=Ji(g.dts,d),g.pts=Ji(g.pts,d),g.dtsTime=g.dts/Ni,g.ptsTime=g.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}}},vm=function(o){for(var c=!1,h=0,d=null,p=null,g=0,S=0,C;o.length-S>=3;){var A=ke.aac.parseType(o,S);switch(A){case"timed-metadata":if(o.length-S<10){c=!0;break}if(g=ke.aac.parseId3TagSize(o,S),g>o.length){c=!0;break}p===null&&(C=o.subarray(S,S+g),p=ke.aac.parseAacTimestamp(C)),S+=g;break;case"audio":if(o.length-S<7){c=!0;break}if(g=ke.aac.parseAdtsSize(o,S),g>o.length){c=!0;break}d===null&&(C=o.subarray(S,S+g),d=ke.aac.parseSampleRate(C)),h++,S+=g;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},bm=function(o){var c={pid:null,table:null},h={};_m(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=[],ym(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},xm=function(o,c){var h=ke.aac.isLikelyAacData(o),d;return h?d=vm(o):d=bm(o),!d||!d.audio&&!d.video?null:(Tm(d,c),d)},Sm={inspect:xm,parseAudioPes_:tl};const Em=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:we.videoTsToSeconds(h.start.dts),presentation:we.videoTsToSeconds(h.start.pts)},end:{decode:we.videoTsToSeconds(h.end.dts),presentation:we.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:we.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=we.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:d})}),c.on("audioSegmentTimingInfo",function(h){const d={start:{decode:we.videoTsToSeconds(h.start.dts),presentation:we.videoTsToSeconds(h.start.pts)},end:{decode:we.videoTsToSeconds(h.end.dts),presentation:we.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:we.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=we.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:we.videoTsToSeconds(h.start),end:we.videoTsToSeconds(h.end)}})}),c.on("videoTimingInfo",function(h){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:we.videoTsToSeconds(h.start),end:we.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 vp.Transmuxer(this.options),Em(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new nm,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=Xs.startTime(c,h);this.self.postMessage({action:"probeMp4StartTime",startTime:d,data:h},[h.buffer])}probeMp4Tracks({data:c}){const h=Xs.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:h,data:c},[c.buffer])}probeEmsgID3({data:c,offset:h}){const d=Xs.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*we.ONE_SECOND_IN_TS:void 0,p=Sm.inspect(c,d);let g=null;p&&(g={hasVideo:p.video&&p.video.length===2||!1,hasAudio:p.audio&&p.audio.length===2||!1},g.hasVideo&&(g.videoStart=p.video[0].ptsTime),g.hasAudio&&(g.audioStart=p.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:g,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(we.secondsToVideoTs(h)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(we.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 VT=of($T);const HT=(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 m=s.data.segment.boxes||{data:s.data.segment.data},_={type:i,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof l<"u"&&(_.videoFrameDtsTime=l),typeof f<"u"&&(_.videoFramePtsTime=f),t(_)},zT=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},GT=(s,e)=>{e.gopInfo=s.data.gopInfo},cf=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:r,remux:n,onData:a,onTrackInfo:u,onAudioTimingInfo:l,onVideoTimingInfo:f,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:_,onId3:w,onCaptions:x,onDone:P,onEndedTimeline:T,onTransmuxerLog:I,isEndOfTimeline:M,segment:N,triggerSegmentEventFn:O}=s,F={buffer:[]};let j=M;const U=G=>{e.currentTransmux===s&&(G.data.action==="data"&&HT(G,F,a),G.data.action==="trackinfo"&&u(G.data.trackInfo),G.data.action==="gopInfo"&>(G,F),G.data.action==="audioTimingInfo"&&l(G.data.audioTimingInfo),G.data.action==="videoTimingInfo"&&f(G.data.videoTimingInfo),G.data.action==="videoSegmentTimingInfo"&&m(G.data.videoSegmentTimingInfo),G.data.action==="audioSegmentTimingInfo"&&_(G.data.audioSegmentTimingInfo),G.data.action==="id3Frame"&&w([G.data.id3Frame],G.data.id3Frame.dispatchType),G.data.action==="caption"&&x(G.data.caption),G.data.action==="endedtimeline"&&(j=!1,T()),G.data.action==="log"&&I(G.data.log),G.data.type==="transmuxed"&&(j||(e.onmessage=null,zT({transmuxedData:F,callback:P}),df(e))))},R=()=>{const G={message:"Received an error message from the transmuxer worker",metadata:{errorType:$.Error.StreamingFailedToTransmuxSegment,segmentInfo:Ui({segment:N})}};P(null,G)};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 G=t instanceof ArrayBuffer?t:t.buffer,v=t instanceof ArrayBuffer?0:t.byteOffset;O({type:"segmenttransmuxingstart",segment:N}),e.postMessage({action:"push",data:G,byteOffset:v,byteLength:t.byteLength},[G])}M&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},df=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():cf(s.currentTransmux))},Tc=(s,e)=>{s.postMessage({action:e}),df(s)},hf=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,Tc(e,s);return}e.transmuxQueue.push(Tc.bind(null,e,s))},WT=s=>{hf("reset",s)},XT=s=>{hf("endTimeline",s)},ff=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,cf(s);return}s.transmuxer.transmuxQueue.push(s)},KT=s=>{const e=new VT;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 Ja={reset:WT,endTimeline:XT,transmux:ff,createTransmuxer:KT};const fs=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,r=Ke({},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)},Zt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},pf="wvtt",Eo=s=>{s.forEach(e=>{e.abort()})},YT=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),QT=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:Zt.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Zt.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Zt.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Zt.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:Zt.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 m={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:s,keyInfo:m}),t(null,s)},JT=(s,e)=>{e===pf&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},ZT=(s,e,t)=>{e===pf&&fs({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:r})=>{s.bytes=i,t(null,s,{mp4VttCues:r})}})},mf=(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:Zt.FAILURE,metadata:{mediaType:r}})}fs({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"&&JT(s,n.codec))}),e(null))})},ev=({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,mf(s,function(u){if(u)return u.xhr=r,u.status=r.status,e(u,s);e(null,s)})},tv=({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:jT(n.responseText.substring(s.lastReachedChar||0));return s.stats=YT(n),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},iv=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{const P=s.map&&s.map.tracks||{},T=!!(P.audio&&P.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"),F=()=>ff({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:j=>{j.type=j.type==="combined"?"video":j.type,m(s,j)},onTrackInfo:j=>{t&&(T&&(j.isMuxed=!0),t(s,j))},onAudioTimingInfo:j=>{I&&typeof j.start<"u"&&(I(j.start),I=null),M&&typeof j.end<"u"&&M(j.end)},onVideoTimingInfo:j=>{N&&typeof j.start<"u"&&(N(j.start),N=null),O&&typeof j.end<"u"&&O(j.end)},onVideoSegmentTimingInfo:j=>{const U={pts:{start:j.start.presentation,end:j.end.presentation},dts:{start:j.start.decode,end:j.end.decode}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:U}),r(j)},onAudioSegmentTimingInfo:j=>{const U={pts:{start:j.start.pts,end:j.end.pts},dts:{start:j.start.dts,end:j.end.dts}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:U}),n(j)},onId3:(j,U)=>{a(s,j,U)},onCaptions:j=>{u(s,[j])},isEndOfTimeline:l,onEndedTimeline:()=>{f()},onTransmuxerLog:w,onDone:(j,U)=>{_&&(j.type=j.type==="combined"?"video":j.type,x({type:"segmenttransmuxingcomplete",segment:s}),_(U,s,j))},segment:s,triggerSegmentEventFn:x});fs({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:j=>{s.bytes=e=j.data;const U=j.result;U&&(t(s,{hasAudio:U.hasAudio,hasVideo:U.hasVideo,isMuxed:T}),t=null),F()}})},gf=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{let P=new Uint8Array(e);if(S_(P)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){m(s,{data:P,type:"text"}),ZT(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,F)=>{m(s,{data:P,type:M.hasAudio&&!M.isMuxed?"audio":"video"}),F&&F.length&&a(s,F),O&&O.length&&u(s,O),_(null,s,{})};fs({action:"probeMp4StartTime",timescales:s.map.timescales,data:P,transmuxer:s.transmuxer,callback:({data:O,startTime:F})=>{e=O.buffer,s.bytes=P=O,M.hasAudio&&!M.isMuxed&&i(s,"audio","start",F),M.hasVideo&&i(s,"video","start",F),fs({action:"probeEmsgID3",data:P,transmuxer:s.transmuxer,offset:F,callback:({emsgData:j,id3Frames:U})=>{if(e=j.buffer,s.bytes=P=j,!T.video||!j.byteLength||!s.transmuxer){N(void 0,U);return}fs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:P,timescales:s.map.timescales,trackIds:[T.video.id],callback:R=>{e=R.data.buffer,s.bytes=P=R.data,R.logs.forEach(function(G){w(De(G,{stream:"mp4CaptionParser"}))}),N(R.captions,U)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=No(P)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}iv({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})},_f=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 m=f.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};i.onerror=()=>{const f="An error occurred in the decryption worker",m=Ui({segment:r}),_={message:f,metadata:{error:new Error(f),errorType:$.Error.StreamingFailedToDecryptSegment,segmentInfo:m,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(ef({source:s,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},sv=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{x({type:"segmentdecryptionstart"}),_f({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},P=>{e.bytes=P,x({type:"segmentdecryptioncomplete",segment:e}),gf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})})},rv=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{let P=0,T=!1;return(I,M)=>{if(!T){if(I)return T=!0,Eo(s),_(I,M);if(P+=1,P===s.length){const N=function(){if(M.encryptedBytes)return sv({decryptionWorker:e,segment:M,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x});gf({segment:M,bytes:M.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})};if(M.endOfAllRequests=Date.now(),M.map&&M.map.encryptedBytes&&!M.map.bytes)return x({type:"segmentdecryptionstart",segment:M}),_f({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}),mf(M,F=>{if(F)return Eo(s),_(F,M);N()})});N()}}}},nv=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},av=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m})=>_=>{if(!_.target.aborted)return s.stats=De(s.stats,QT(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},ov=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:r,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:M})=>{const N=[],O=rv({activeXhrs:N,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P,doneFn:T,onTransmuxerLog:I,triggerSegmentEventFn:M});if(i.key&&!i.key.bytes){const G=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&G.push(i.map.key);const v=De(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),E=vc(i,G,O,M),V={uri:i.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:V});const H=s(v,E);N.push(H)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const H=De(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),q=vc(i,[i.map.key],O,M),K={uri:i.map.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:K});const te=s(H,q);N.push(te)}const v=De(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:xo(i.map),requestType:"segment-media-initialization"}),E=ev({segment:i,finishProcessingFn:O,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const V=s(v,E);N.push(V)}const F=De(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:xo(i),requestType:"segment"}),j=tv({segment:i,finishProcessingFn:O,responseType:F.responseType,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const U=s(F,j);U.addEventListener("progress",av({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P})),N.push(U);const R={};return N.forEach(G=>{G.addEventListener("loadend",nv({loadendState:R,abortFn:r}))}),()=>Eo(N)},on=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||""})},ps=function(s,e){if(!s)return"";const t=D.getComputedStyle(s);return t?t[e]:""},ms=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},uv=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 yf=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;yt.isAudioOnly(e)&&(f=u.getAudioTrackPlaylists_(),l.audioOnly=!0);let m=f.map(R=>{let G;const v=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,E=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return G=R.attributes&&R.attributes.BANDWIDTH,G=G||D.Number.MAX_VALUE,{bandwidth:G,width:v,height:E,playlist:R}});ms(m,(R,G)=>R.bandwidth-G.bandwidth),m=m.filter(R=>!yt.isIncompatible(R.playlist));let _=m.filter(R=>yt.isEnabled(R.playlist));_.length||(_=m.filter(R=>!yt.isDisabled(R.playlist)));const w=_.filter(R=>R.bandwidth*tt.BANDWIDTH_VARIANCE<t);let x=w[w.length-1];const P=w.filter(R=>R.bandwidth===x.bandwidth)[0];if(a===!1){const R=P||_[0]||m[0];if(R&&R.playlist){let G="sortedPlaylistReps";return P&&(G="bandwidthBestRep"),_[0]&&(G="enabledPlaylistReps"),on(`choosing ${bc(R)} using ${G} with options`,l),R.playlist}return on("could not choose a playlist with options",l),null}const T=w.filter(R=>R.width&&R.height);ms(T,(R,G)=>R.width-G.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,F;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],F=O.filter(R=>R.bandwidth===x.bandwidth)[0]);let j;if(u.leastPixelDiffSelector){const R=T.map(G=>(G.pixelDiff=Math.abs(G.width-i)+Math.abs(G.height-r),G));ms(R,(G,v)=>G.pixelDiff===v.pixelDiff?v.bandwidth-G.bandwidth:G.pixelDiff-v.pixelDiff),j=R[0]}const U=j||F||M||P||_[0]||m[0];if(U&&U.playlist){let R="sortedPlaylistReps";return j?R="leastPixelDiffRep":F?R="resolutionPlusOneRep":M?R="resolutionBestRep":P?R="bandwidthBestRep":_[0]&&(R="enabledPlaylistReps"),on(`choosing ${bc(U)} using ${R} with options`,l),U.playlist}return on("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),yf({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(ps(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(ps(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?ps(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},lv=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),yf({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(ps(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(ps(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?ps(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},cv=function(s){const{main:e,currentTime:t,bandwidth:i,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:u,syncController:l}=s,f=e.playlists.filter(P=>!yt.isIncompatible(P));let m=f.filter(yt.isEnabled);m.length||(m=f.filter(P=>!yt.isDisabled(P)));const w=m.filter(yt.hasAttribute.bind(null,"BANDWIDTH")).map(P=>{const I=l.getSyncPoint(P,r,u,t)?1:2,N=yt.estimateSegmentRequestTime(n,i,P)*I-a;return{playlist:P,rebufferingImpact:N}}),x=w.filter(P=>P.rebufferingImpact<=0);return ms(x,(P,T)=>fu(T.playlist,P.playlist)),x.length?x[0]:(ms(w,(P,T)=>P.rebufferingImpact-T.rebufferingImpact),w[0]||null)},dv=function(){const s=this.playlists.main.playlists.filter(yt.isEnabled);return ms(s,(t,i)=>fu(t,i)),s.filter(t=>!!fr(this.playlists.main,t).video)[0]||null},hv=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 Tf(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const fv=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}}},pv=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))})},mv=function(s){Object.defineProperties(s.frame,{id:{get(){return $.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return $.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return $.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},gv=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const r=D.WebKitDataCue||D.VTTCue,n=s.metadataTrack_;if(!n||(e.forEach(m=>{const _=m.cueTime+t;typeof _!="number"||D.isNaN(_)||_<0||!(_<1/0)||!m.frames||!m.frames.length||m.frames.forEach(w=>{const x=new r(_,_,w.value||w.url||w.data||"");x.frame=w,x.value=w,mv(x),n.addCue(x)})}),!n.cues||!n.cues.length))return;const a=n.cues,u=[];for(let m=0;m<a.length;m++)a[m]&&u.push(a[m]);const l=u.reduce((m,_)=>{const w=m[_.startTime]||[];return w.push(_),m[_.startTime]=w,m},{}),f=Object.keys(l).sort((m,_)=>Number(m)-Number(_));f.forEach((m,_)=>{const w=l[m],x=isFinite(i)?i:m,P=Number(f[_+1])||x;w.forEach(T=>{T.endTime=P})})},_v={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"},yv=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),Tv=({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(yv.has(n))continue;const a=new i(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:_v[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,$.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)},vv=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}},bv=(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)},xv=(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)},Sv=(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},Ev=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},Cv=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]},rr=1,wv=500,Ec=s=>typeof s=="number"&&isFinite(s),un=1/60,Av=(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,Dv=(s,e,t)=>{let i=e-tt.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:m}=s,_=u.length-1;let w="mediaIndex/partIndex increment";s.getMediaInfoForTime?w=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(w="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(w+=` with independent ${s.independent}`);const x=typeof f=="number",P=s.segment.uri?"segment":"pre-segment",T=x?Mh({preloadSegment:i})-1:0;return`${P} [${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 [${m}] selected by [${w}] playlist [${a}]`},Cc=s=>`${s}TimingInfo`,kv=({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,Co=({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},Iv=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)},Pv=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},bi=s=>{const e=s.pendingSegment_;if(!e)return;if(Co({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&Iv(s.timelineChangeController_)){if(Pv(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},Lv=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+Qt:!1,Ov=(s,e)=>{if(e!=="hls")return null;const t=Lv({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 wo extends $.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_():bi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Ke({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():bi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Ke({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():bi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():bi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Ja.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_&&Ja.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return st();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=Ln(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=tf(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 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_&&
|
|
190
|
+
bufferedEnd: ${Ya(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_&&Ja.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_=Sv(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),wv)}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=Ya(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=Cv(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 w=a[this.mediaIndex],x=typeof this.partIndex=="number"?this.partIndex:-1;u.startOfSegment=w.end?w.end:t,w.parts&&w.parts[x+1]?(u.mediaIndex=this.mediaIndex,u.partIndex=x+1):u.mediaIndex=this.mediaIndex+1}else{let w,x,P;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 M="No sync info found while using media sequence sync";return this.error({message:M,metadata:{errorType:$.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})`),w=I.segmentIndex,x=I.partIndex,P=I.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const I=yt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});w=I.segmentIndex,x=I.partIndex,P=I.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,u.mediaIndex=w,u.startOfSegment=P,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 m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&f&&!m&&!f.independent)if(u.partIndex===0){const w=a[u.mediaIndex-1],x=w.parts&&w.parts.length&&w.parts[w.parts.length-1];x&&x.independent&&(u.mediaIndex-=1,u.partIndex=w.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,m=i.segments[r],_=typeof u=="number"&&m.parts[u],w={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||m.resolvedUri,mediaIndex:r,partIndex:_?u:null,isSyncRequest:a,startOfSegment:n,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:_&&_.duration||m.duration,segment:m,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:f,independent:t},x=typeof l<"u"?l:this.isPendingTimestampOffset_;w.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:x});const P=Qa(this.sourceUpdater_.audioBuffered());return typeof P=="number"&&(w.audioAppendStart=P-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(w.gopsToAlignWith=Iv(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),w}timestampOffsetForSegment_(e){return Fv(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=yt.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=aT(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const u=Tv({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 m=.5;a<=Qt&&(m=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||f<m)&&(this.bandwidth=u.playlist.attributes.BANDWIDTH*tt.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||{},Ov(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_():bi(this))))}handleTimingInfo_(e,t,i,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const n=this.pendingSegment_,a=wc(t);n[a]=n[a]||{},n[a][i]=r,this.logger_(`timinginfo: ${t} - ${i} - ${r}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():bi(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],m=this.inbandTextTracks_;this.logger_(`adding cues from ${u} -> ${l} for ${a}`),xv(m,this.vhs_.tech_,a),or(u,l,m[a]),Sv({captionArray:f,inbandTextTracks:m,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_()?!wo({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||wo({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_()){bi(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[wc(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=Ln(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,m=a.length?a.end(a.length-1):0;if(l-u<=rr&&m-f<=rr){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 w=this.currentTime_()-rr;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${w}`),this.remove(0,w,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${rr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=D.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},rr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},r){if(r){if(r.code===Kh){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:$.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=bv({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_()){bi(this),this.loadQueue_.push(()=>{const t=Ke({},e,{forceTimestampOffset:!0});Ke(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
|
-
${is(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=gv({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:m,timingInfo:_})=>{const x={segmentInfo:Ui({segment:l})};f&&(x.keyInfo=f),m&&(x.trackInfo=m),_&&(x.timingInfo=_),this.trigger({type:u,metadata:x})}})}trimBackBuffer_(e){const t=Bv(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<un){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${un}`);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===Zt.ABORTED)return;if(this.pause(),e.code===Zt.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_=Pv(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=Mv(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=$v(e,this.sourceType_);if(t&&(t.severity==="warn"?$.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<un){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${un}`);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(!Cc(i)||!Cc(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 ui(){}const xf=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Vv=["video","audio"],Do=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},Hv=(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},gs=(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(),gs("audio",e),gs("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Do(s,e))){if(i.type!==s){if(t=Hv(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,gs(s,e);return}}},Sf=(s,e)=>{const t=e[`${s}Buffer`],i=xf(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Kt=(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(Kt(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===Kh?"(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(Kt(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`];Kt(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){$.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){$.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Kt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){$.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=xf(s),r=_s(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(Sf(s,e),!!Kt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){$.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],r=_s(s);if(!Kt(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=$.Error.StreamingCodecsChangeError,l.error=f,f.metadata=l,t.error_=f,t.trigger("error"),$.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}),gs(s,e)},Dc=(s,e)=>t=>{const i=e[`${s}Buffered`](),r=sT(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_`])}gs(s,e)};class Ef extends $.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gs("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_=Dc("video",this),this.onAudioUpdateEnd_=Dc("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()){$.log.error("removeSourceBuffer is not supported!");return}St({type:"mediaSource",sourceUpdater:this,action:xt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!$.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()){$.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 Kt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:st()}videoBuffered(){return Kt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:st()}buffered(){const e=Kt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Kt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():nT(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ui){St({type:"mediaSource",sourceUpdater:this,action:xt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ui){typeof e!="string"&&(e=void 0),St({type:"mediaSource",sourceUpdater:this,action:xt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=ui){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=ui){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!!(Do("audio",this)||Do("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"),Vv.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Sf(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const kc=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),zv=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Ic=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:$.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})`),w=I.segmentIndex,x=I.partIndex,P=I.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const I=yt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:T,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});w=I.segmentIndex,x=I.partIndex,P=I.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${T}`:`currentTime ${T}`,u.mediaIndex=w,u.startOfSegment=P,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 m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&f&&!m&&!f.independent)if(u.partIndex===0){const w=a[u.mediaIndex-1],x=w.parts&&w.parts.length&&w.parts[w.parts.length-1];x&&x.independent&&(u.mediaIndex-=1,u.partIndex=w.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,m=i.segments[r],_=typeof u=="number"&&m.parts[u],w={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||m.resolvedUri,mediaIndex:r,partIndex:_?u:null,isSyncRequest:a,startOfSegment:n,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:_&&_.duration||m.duration,segment:m,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:f,independent:t},x=typeof l<"u"?l:this.isPendingTimestampOffset_;w.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:x});const P=Ya(this.sourceUpdater_.audioBuffered());return typeof P=="number"&&(w.audioAppendStart=P-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(w.gopsToAlignWith=bv(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),w}timestampOffsetForSegment_(e){return kv(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=yt.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=Qy(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const u=cv({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 m=.5;a<=Qt&&(m=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||f<m)&&(this.bandwidth=u.playlist.attributes.BANDWIDTH*tt.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||{},Ev(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_():bi(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_():bi(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],m=this.inbandTextTracks_;this.logger_(`adding cues from ${u} -> ${l} for ${a}`),fv(m,this.vhs_.tech_,a),or(u,l,m[a]),pv({captionArray:f,inbandTextTracks:m,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_()?!Co({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||Co({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_()){bi(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=Ln(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,m=a.length?a.end(a.length-1):0;if(l-u<=rr&&m-f<=rr){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 w=this.currentTime_()-rr;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${w}`),this.remove(0,w,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${rr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=D.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},rr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},r){if(r){if(r.code===Wh){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:$.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=hv({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_()){bi(this),this.loadQueue_.push(()=>{const t=Ke({},e,{forceTimestampOffset:!0});Ke(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
|
+
${Tf(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=ov({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:m,timingInfo:_})=>{const x={segmentInfo:Ui({segment:l})};f&&(x.keyInfo=f),m&&(x.trackInfo=m),_&&(x.timingInfo=_),this.trigger({type:u,metadata:x})}})}trimBackBuffer_(e){const t=Dv(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<un){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${un}`);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===Zt.ABORTED)return;if(this.pause(),e.code===Zt.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_=xv(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=Av(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=Ov(e,this.sourceType_);if(t&&(t.severity==="warn"?$.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<un){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${un}`);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 ui(){}const vf=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Rv=["video","audio"],Ao=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},Nv=(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},gs=(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(),gs("audio",e),gs("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Ao(s,e))){if(i.type!==s){if(t=Nv(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,gs(s,e);return}}},bf=(s,e)=>{const t=e[`${s}Buffer`],i=vf(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Kt=(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(Kt(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===Wh?"(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(Kt(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`];Kt(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){$.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){$.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Kt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){$.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=vf(s),r=_s(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(bf(s,e),!!Kt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){$.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],r=_s(s);if(!Kt(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=$.Error.StreamingCodecsChangeError,l.error=f,f.metadata=l,t.error_=f,t.trigger("error"),$.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}),gs(s,e)},Ac=(s,e)=>t=>{const i=e[`${s}Buffered`](),r=Xy(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_`])}gs(s,e)};class xf extends $.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gs("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()){$.log.error("removeSourceBuffer is not supported!");return}St({type:"mediaSource",sourceUpdater:this,action:xt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!$.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()){$.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 Kt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:st()}videoBuffered(){return Kt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:st()}buffered(){const e=Kt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Kt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Yy(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ui){St({type:"mediaSource",sourceUpdater:this,action:xt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ui){typeof e!="string"&&(e=void 0),St({type:"mediaSource",sourceUpdater:this,action:xt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=ui){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=ui){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!!(Ao("audio",this)||Ao("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"),Rv.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>bf(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))),Mv=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((l,f)=>{const m=this.storage_.get(u),_=a,w=_+l.duration,x=!!(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),P=new
|
|
202
|
-
`,M.syncInfo=U,U});r.set(u,new
|
|
203
|
-
`,u++,a=w}),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 Lc extends Cf{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 Qv=86400,eo=[{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=yo(e);r=r||0;for(let l=0;l<u.length;l++){const f=e.endList||r===0?l:u.length-(l+1),m=u[f],_=m.segment,w=s.timelineToDatetimeMappings[_.timeline];if(!w||!_.dateTimeObject)continue;let P=_.dateTimeObject.getTime()/1e3+w;if(_.parts&&typeof m.partIndex=="number")for(let I=0;I<m.partIndex;I++)P+=_.parts[I].duration;const T=Math.abs(r-P);if(a!==null&&(T===0||a<T))break;a=T,n={time:P,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return n}},{name:"Segment",run:(s,e,t,i,r)=>{let n=null,a=null;r=r||0;const u=yo(e);for(let l=0;l<u.length;l++){const f=e.endList||r===0?l:u.length-(l+1),m=u[f],_=m.segment,w=m.part&&m.part.start||_&&_.start;if(_.timeline===i&&typeof w<"u"){const x=Math.abs(r-w);if(a!==null&&a<x)break;(!n||a===null||a>=x)&&(a=x,n={time:w,segmentIndex:m.segmentIndex,partIndex:m.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,m=s.discontinuities[f];if(m){const _=Math.abs(r-m.time);if(a!==null&&a<_)break;(!n||a===null||a>=_)&&(a=_,n={time:m.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 $.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Cf,i=new Lc(t),r=new Lc(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 eo.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:m,time:_}=l;if(m<0)continue;const w=e.segments[m],x=_,P=x+w.duration;if(this.logger_(`Strategy: ${f}. Current time: ${r}. selected segment: ${m}. Time: [${x} -> ${P}]}`),r>=x&&r<P)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<eo.length;u++){const l=eo[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>Qv){$.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 Zv extends $.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 e2=cf(df(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 F=this.listeners[N].indexOf(O);return this.listeners[N]=this.listeners[N].slice(0),this.listeners[N].splice(F,1),F>-1},I.trigger=function(N){var O=this.listeners[N];if(O)if(arguments.length===2)for(var F=O.length,j=0;j<F;++j)O[j].call(this,arguments[1]);else for(var U=Array.prototype.slice.call(arguments,1),R=O.length,G=0;G<R;++G)O[G].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 F,j,U;const R=[],G=[];let v,E,V,H,q,K;for(F=0;F<256;F++)G[(R[F]=F<<1^(F>>7)*283)^F]=F;for(j=U=0;!N[j];j^=v||1,U=G[U]||1)for(H=U^U<<1^U<<2^U<<3^U<<4,H=H>>8^H&255^99,N[j]=H,O[H]=j,V=R[E=R[v=R[j]]],K=V*16843009^E*65537^v*257^j*16843008,q=R[H]*257^H*16843008,F=0;F<4;F++)I[F][j]=q=q<<24^q>>>8,M[F][H]=K=K<<24^K>>>8;for(F=0;F<5;F++)I[F]=I[F].slice(0),M[F]=M[F].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 F=this._tables[0][4],j=this._tables[1],U=I.length;let R=1;if(U!==4&&U!==6&&U!==8)throw new Error("Invalid aes key size");const G=I.slice(0),v=[];for(this._key=[G,v],M=U;M<4*U+28;M++)O=G[M-1],(M%U===0||U===8&&M%U===4)&&(O=F[O>>>24]<<24^F[O>>16&255]<<16^F[O>>8&255]<<8^F[O&255],M%U===0&&(O=O<<8^O>>>24^R<<24,R=R<<1^(R>>7)*283)),G[M]=G[M-U]^O;for(N=0;M;N++,M--)O=G[N&3?M:M-4],M<=4||N<4?v[N]=O:v[N]=j[0][F[O>>>24]]^j[1][F[O>>16&255]]^j[2][F[O>>8&255]]^j[3][F[O&255]]}decrypt(I,M,N,O,F,j){const U=this._key[1];let R=I^U[0],G=O^U[1],v=N^U[2],E=M^U[3],V,H,q;const K=U.length/4-2;let te,ie=4;const W=this._tables[1],Z=W[0],ee=W[1],re=W[2],se=W[3],ce=W[4];for(te=0;te<K;te++)V=Z[R>>>24]^ee[G>>16&255]^re[v>>8&255]^se[E&255]^U[ie],H=Z[G>>>24]^ee[v>>16&255]^re[E>>8&255]^se[R&255]^U[ie+1],q=Z[v>>>24]^ee[E>>16&255]^re[R>>8&255]^se[G&255]^U[ie+2],E=Z[E>>>24]^ee[R>>16&255]^re[G>>8&255]^se[v&255]^U[ie+3],ie+=4,R=V,G=H,v=q;for(te=0;te<4;te++)F[(3&-te)+j]=ce[R>>>24]<<24^ce[G>>16&255]<<16^ce[v>>8&255]<<8^ce[E&255]^U[ie++],V=R,R=G,G=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,M){const N=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),O=new r(Array.prototype.slice.call(I)),F=new Uint8Array(T.byteLength),j=new Int32Array(F.buffer);let U,R,G,v,E,V,H,q,K;for(U=M[0],R=M[1],G=M[2],v=M[3],K=0;K<N.length;K+=4)E=a(N[K]),V=a(N[K+1]),H=a(N[K+2]),q=a(N[K+3]),O.decrypt(E,V,H,q,j,K),j[K]=a(j[K]^U),j[K+1]=a(j[K+1]^R),j[K+2]=a(j[K+2]^G),j[K+3]=a(j[K+3]^v),U=E,R=V,G=H,v=q;return F};class l{constructor(I,M,N,O){const F=l.STEP,j=new Int32Array(I.buffer),U=new Uint8Array(I.byteLength);let R=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(j.subarray(R,R+F),M,N,U)),R=F;R<j.length;R+=F)N=new Uint32Array([a(j[R-4]),a(j[R-3]),a(j[R-2]),a(j[R-1])]),this.asyncStream_.push(this.decryptChunk_(j.subarray(R,R+F),M,N,U));this.asyncStream_.push(function(){O(null,e(U))})}static get STEP(){return 32e3}decryptChunk_(I,M,N,O){return function(){const F=u(I,M,N);O.set(F,I.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof f<"u"?m=f:typeof self<"u"?m=self:m={};var _=m,w=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 P=function(T){const I={};return Object.keys(T).forEach(M=>{const N=T[M];w(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(F,j){self.postMessage(P({source:I.source,decrypted:j}),[j.buffer])})}}));var t2=lf(e2);const i2=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},wf=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},ko=(s,e)=>{e.activePlaylistLoader=s,s.load()},s2=(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,wf(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),ko(a.playlistLoader,r)}},r2=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},n2=(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,wf(i,n),!!u)){if(u.isMainPlaylist){if(!a||!f||a.id===f.id)return;const m=e.vhs.playlistController_,_=m.selectPlaylist();if(m.media()===_)return;n.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),r.resetEverything(),m.fastQualityChange_(_);return}if(s==="AUDIO"){if(!u.playlistLoader){r.setAudio(!0),r.resetEverything();return}i.setAudio(!0),r.setAudio(!1)}if(l===u.playlistLoader){ko(u.playlistLoader,n);return}i.track&&i.track(a),i.resetEverything(),ko(u.playlistLoader,n)}},On={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}$.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;$.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},Oc={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",On[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",On[s](s,t))}},a2={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:m}=e,_=wr(m.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},_&&(a[s].main.default.playlists=m.main.playlists));for(const w in a[s]){u[w]||(u[w]=[]);for(const x in a[s][w]){let P=a[s][w][x],T;if(_?(f(`AUDIO group '${w}' label '${x}' is a main playlist`),P.isMainPlaylist=!0,T=null):i==="vhs-json"&&P.playlists?T=new os(P.playlists[0],t,n):P.resolvedUri?T=new os(P.resolvedUri,t,n):P.playlists&&i==="dash"?T=new Eo(P.playlists[0],t,n,m):T=null,P=De({id:x,playlistLoader:T},P),Oc[s](s,P.playlistLoader,e),u[w].push(P),typeof l[x]>"u"){const I=new $.AudioTrack({id:x,kind:i2(P),enabled:!1,language:P.language,default:P.default,label:x});l[x]=I}}}r.on("error",On[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:m}=e;for(const _ in u[s]){l[_]||(l[_]=[]);for(const w in u[s][_]){if(!i.options_.useForcedSubtitles&&u[s][_][w].forced)continue;let x=u[s][_][w],P;if(r==="hls")P=new os(x.resolvedUri,i,a);else if(r==="dash"){if(!x.playlists.filter(I=>I.excludeUntil!==1/0).length)return;P=new Eo(x.playlists[0],i,a,m)}else r==="vhs-json"&&(P=new os(x.playlists?x.playlists[0]:x.resolvedUri,i,a));if(x=De({id:w,playlistLoader:P},x),Oc[s](s,x.playlistLoader,e),l[_].push(x),typeof f[w]>"u"){const T=t.addRemoteTextTrack({id:w,kind:"subtitles",default:x.default&&x.autoselect,language:x.language,label:w},!1).track;f[w]=T}}}n.on("error",On[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 m={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(f[m.instreamId]&&(m=De(m,f[m.instreamId])),m.default===void 0&&delete m.default,r[a].push(De({id:u},l)),typeof n[u]>"u"){const _=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;n[u]=_}}}}},Af=(s,e)=>{for(let t=0;t<s.length;t++)if(hu(e,s[t])||s[t].playlists&&Af(s[t].playlists,e))return!0;return!1},o2=(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&&wr(e.main))for(let l=0;l<u.length;l++){const f=r[u[l]];if(Af(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},u2={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}},l2=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},c2=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{a2[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=o2(f,s),e[f].activeTrack=u2[f](f,s),e[f].onGroupChanged=s2(f,s),e[f].onGroupChanging=r2(f,s),e[f].onTrackChanged=n2(f,s),e[f].getActiveGroup=l2(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])},d2=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ui,activeTrack:ui,getActiveGroup:ui,onGroupChanged:ui,onTrackChanged:ui,lastTrack_:null,logger_:Rt(`MediaGroups[${e}]`)}}),s};class Rc{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_=_t(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 h2 extends $.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Rc,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=_t(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 m={errorType:$.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:m})}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 Rc}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&&(_t(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const f2=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},p2=10;let xi;const m2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],g2=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},_2=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:u,log:l}){if(!i)return $.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 m=!!as(e,t).length;if(!s.endList)return!m&&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 _=lu(e,t),w=u?tt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:tt.MAX_BUFFER_LOW_WATER_LINE;if(a<w)return l(`${f} as duration < max low water line (${a} < ${w})`),!0;const x=i.attributes.BANDWIDTH,P=s.attributes.BANDWIDTH;if(x<P&&(!u||_<n)){let T=`${f} as next bandwidth < current bandwidth (${x} < ${P})`;return u&&(T+=` and forwardBuffer < bufferHighWaterLine (${_} < ${n})`),l(T),!0}if((!u||x>P)&&_>=r){let T=`${f} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return u&&(T+=` and next bandwidth > current bandwidth (${x} > ${P})`),l(T),!0}return l(`not ${f} as no switching criteria met`),!1};class y2 extends $.EventTarget{constructor(e){super(),this.fastQualityChange_=f2(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:r,bandwidth:n,externVhs:a,useCueTags:u,playlistExclusionDuration:l,enableLowInitialPlaylist:f,sourceType:m,cacheEncryptionKeys:_,bufferBasedABR:w,leastPixelDiffSelector:x,captionServices:P,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),xi=a,this.bufferBasedABR=!!w,this.leastPixelDiffSelector=!!x,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=m,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_=d2(),T&&D.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new D.ManagedMediaSource,this.usingManagedMediaSource_=!0,$.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_=st(),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 t2,this.sourceUpdater_=new Ef(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Zv,this.keyStatusMap_=new Map;const M={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:P,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth: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 Eo(t,this.vhs_,De(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new os(t,this.vhs_,De(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ao(De(M,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ao(De(M,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Wv(De(M,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,j)=>{function U(){r.off("vttjserror",R),F()}function R(){r.off("vttjsloaded",U),j()}r.one("vttjsloaded",U),r.one("vttjserror",R),r.addWebVttScript_()})}),e);const N=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new h2(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_())),m2.forEach(F=>{this[F+"_"]=g2.bind(this,F)}),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 F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,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 m=e.playlists[f];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===u&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;To(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()),c2({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;To(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(Ke({},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"}),xi.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 _2({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:p2}))});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(Ke({},r))}),this.audioSegmentLoader_.on(i,r=>{this.player_.trigger(Ke({},r))}),this.subtitleSegmentLoader_.on(i,r=>{this.player_.trigger(Ke({},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=xi.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-n<=Jt;const u=a.end(a.length-1);return u-n<=Jt&&r-u<=Jt}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(sa),a=n.length===1&&n[0]===e;if(r.length===1&&i!==1/0)return $.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 P=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(P),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(P)},T);return}let x=!1;r.forEach(P=>{if(P===e)return;const T=P.excludeUntil;typeof T<"u"&&T!==1/0&&(x=!0,delete P.excludeUntil)}),x&&($.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_:$.log.warn,m=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} 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,w=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=_;return this.switchMedia_(l,"exclude",a||w)}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=as(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:xi.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=xi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),m=Math.max(u,l-f);return st([[u,m]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=xi.Playlist.seekable(i,n,xi.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:st([[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 [${Mh(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=xi.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||a0),e.main.isMuxed&&(r.video+=`,${i.audio||e.main.audioCodec||Sl}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(r.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Sl,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,m)=>f?ur(m,this.usingManagedMediaSource_):Ra(m),u={};let l;if(["video","audio"].forEach(function(f){if(r.hasOwnProperty(f)&&!a(e[f].isFmp4,r[f])){const m=e[f].isFmp4?"browser":"muxer";u[m]=u[m]||[],u[m].push(r[f]),f==="audio"&&(l=m)}}),n&&l&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===f&&m!==t&&(m.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((m,_)=>(m&&(m+=", "),m+=`${_} does not support codec(s): "${u[_].join(",")}"`,m),"")+".";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(m=>{const _=(Xt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,w=(Xt(r[m]||"")[0]||{}).type;_&&w&&_.toLowerCase()!==w.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[m]}" -> "${r[m]}"`)}),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&&!Ra(n.audio)&&!ur(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Ra(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=Tr(Xt(e)),n=gc(r),a=r.video&&Xt(r.video)[0]||null,u=r.audio&&Xt(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 m=[],_=fr(this.mainPlaylistLoader_.main,f),w=gc(_);if(!(!_.audio&&!_.video)){if(w!==n&&m.push(`codec count "${w}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const x=_.video&&Xt(_.video)[0]||null,P=_.audio&&Xt(_.audio)[0]||null;x&&a&&x.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${x.type}" !== "${a.type}"`),P&&u&&P.type.toLowerCase()!==u.type.toLowerCase()&&m.push(`audio codec "${P.type}" !== "${u.type}"`)}m.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),Kv(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=tt.GOAL_BUFFER_LENGTH,i=tt.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,tt.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=tt.BUFFER_LOW_WATER_LINE,i=tt.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,tt.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,tt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return tt.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Ec(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Dv({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Ec(this.inbandTextTracks_,e,this.tech_),Cv({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(Ke({},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(m=>m.attributes["PATHWAY-ID"]===u["BASE-ID"]).forEach(m=>{this.mainPlaylistLoader_.addClonePathway(u,m)}),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,$.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:zv(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 T2=(s,e,t)=>i=>{const r=s.main.playlists[e],n=du(r),a=sa(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 v2{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=T2(e.playlists,t.id,n)}}const b2=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=wr(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!du(i)).map((i,r)=>new v2(s,i,i.id)):[]}},Nc=["seeking","seeked","pause","playing","error"];class x2 extends $.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(m=>{l[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",l[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",l[m].reset),this.tech_.on(["seeked","seeking"],l[m].reset)});const f=m=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][m]("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(Nc,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(Nc,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(m=>{a[`${m}SegmentLoader_`].off("appendsdone",l[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",l[m].reset),this.tech_.off(["seeked","seeking"],l[m].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=oT(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+Jt>=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(st([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 P=t.start(0);n=P+(P===t.end(0)?0:Jt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Mh(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,m=this.media(),_=m.partTargetDuration?m.partTargetDuration:(m.targetDuration-Qt)*2,w=[l,f];for(let P=0;P<w.length;P++){if(!w[P])continue;if(lu(w[P],i)<_)return!1}const x=an(u,i);return x.length===0?!1:(n=x.start(0)+Jt,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=as(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=an(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)+Jt;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=as(e,i-3),a=as(e,i),u=as(t,i);u.length&&!a.length&&n.length&&(r={start:n.end(0),end:u.end(0)})}else an(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=an(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)+Qt);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=rT(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 S2={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},Df=function(s,e){let t=0,i=0;const r=De(S2,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){i&&s.currentTime(i)},a=function(m){m!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",n),s.src(m),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"){$.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(m){l(),Df(s,m)};s.on("error",u),s.on("dispose",l),s.reloadSourceOnError=f},E2=function(s){Df(this,s)};var kf="3.17.2",C2="7.1.0",w2="1.3.1",A2="7.2.0",D2="4.0.2";const je={PlaylistLoader:os,Playlist:yt,utils:OT,STANDARD_PLAYLIST_SELECTOR:Sc,INITIAL_PLAYLIST_SELECTOR:vv,lastBandwidthSelector:Sc,movingAverageBandwidthSelector:yv,comparePlaylistBandwidth:pu,comparePlaylistResolution:_v,xhr:tf()};Object.keys(tt).forEach(s=>{Object.defineProperty(je,s,{get(){return $.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),tt[s]},set(e){if($.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){$.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}tt[s]=e}})});const If="videojs-vhs",Pf=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"})},k2=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),Pf(s,e.playlists)};je.canPlaySource=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const I2=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Tr(Xt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const r=_s(i.video),n=_s(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 De(s,a)},P2=(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},[]),L2=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?i.concat([t]):i,n=P2(r,Object.keys(e)),a=[],u=[];return n.forEach(l=>{u.push(new Promise((f,m)=>{s.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,m)=>{s.eme.initializeMediaKeys({keySystems:l},_=>{if(_){m(_);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(u)])},O2=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const r=I2(e,t,i);return r?(s.currentSource().keySystems=r,r&&!s.eme?($.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Lf=()=>{if(!D.localStorage)return null;const s=D.localStorage.getItem(If);if(!s)return null;try{return JSON.parse(s)}catch{return null}},R2=s=>{if(!D.localStorage)return!1;let e=Lf();e=e?De(e,s):s;try{D.localStorage.setItem(If,JSON.stringify(e))}catch{return!1}return e},N2=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,Of=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Rf=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Nf=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Mf=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};je.supportsNativeHls=(function(){if(!ne||!ne.createElement)return!1;const s=ne.createElement("video");return $.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!ne||!ne.createElement||!$.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(ne.createElement("video").canPlayType("application/dash+xml"))})();je.supportsTypeNatively=s=>s==="hls"?je.supportsNativeHls:s==="dash"?je.supportsNativeDash:!1;je.isSupported=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};je.xhr.onRequest=function(s){Of(je.xhr,s)};je.xhr.onResponse=function(s){Rf(je.xhr,s)};je.xhr.offRequest=function(s){Nf(je.xhr,s)};je.xhr.offResponse=function(s){Mf(je.xhr,s)};const M2=$.getComponent("Component");class Bf extends M2{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=$.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(ne,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const n=ne.fullscreenElement||ne.webkitFullscreenElement||ne.mozFullScreenElement||ne.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_=De(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=Lf();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=tt.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===tt.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=N2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=je,this.options_.sourceType=sd(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new y2(this.options_);const i=De({liveRangeSafeTimeDelta:Jt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new x2(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=$.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(){$.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&&R2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{b2(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),($.browser.IS_ANY_SAFARI||$.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"),L2({player:this.player_,sourceKeySystems:this.source_.keySystems,audioMedia:e&&e.media(),mainPlaylists:this.playlists.main.playlists}).then(()=>{this.logger_("created EME key session"),this.playlistController_.sourceUpdater_.initializedEme()}).catch(t=>{this.logger_("error while creating EME key session",t),this.player_.error({message:"Failed to initialize media keys for EME",code:3})})}handleWaitingForKey_(){this.logger_("waitingforkey fired, attempting to create any new key sessions"),this.createKeySessions_()}setupEme_(){const e=this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader,t=O2({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=$.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{k2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Pf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":kf,"mux.js":C2,"mpd-parser":w2,"m3u8-parser":A2,"aes-decrypter":D2}}version(){return this.constructor.version()}canChangeType(){return Ef.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 jT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return of({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=>{Of(this.xhr,e)},this.xhr.onResponse=e=>{Rf(this.xhr,e)},this.xhr.offRequest=e=>{Nf(this.xhr,e)},this.xhr.offResponse=e=>{Mf(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(Ke({},r))})}),t.forEach(i=>{this.playbackWatcher_.on(i,r=>{this.player_.trigger(Ke({},r))})})}}const Rn={name:"videojs-http-streaming",VERSION:kf,canHandleSource(s,e={}){const t=De($.options,e);return!t.vhs.experimentalUseMMS&&!ur("avc1.4d400d,mp4a.40.2",!1)?!1:Rn.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=De($.options,t);return e.vhs=new Bf(s,e,i),e.vhs.xhr=tf(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=sd(s);if(!t)return"";const i=Rn.getOverrideNative(e);return!je.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!($.browser.IS_ANY_SAFARI||$.browser.IS_IOS),{overrideNative:i=t}=e;return i}},B2=()=>ur("avc1.4d400d,mp4a.40.2",!0);B2()&&$.getTech("Html5").registerSourceHandler(Rn,0);$.VhsHandler=Bf;$.VhsSourceHandler=Rn;$.Vhs=je;$.use||$.registerComponent("Vhs",je);$.options.vhs=$.options.vhs||{};(!$.getPlugin||!$.getPlugin("reloadSourceOnError"))&&$.registerPlugin("reloadSourceOnError",E2);function F2(){if(typeof navigator>"u")return!1;const s=navigator.userAgent;return/^((?!chrome|android|crios|fxios).)*safari/i.test(s)}function U2(){return typeof navigator>"u"?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function Mc(s){if(/\.mkv(\?|$)/i.test(s)&&(F2()||U2())){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 j2({src:s,poster:e,subtitles:t,onReady:i}){const r=ue.useRef(null),n=ue.useRef(null),a=ue.useRef(i),u=ue.useRef(s),l=ue.useRef(e);ue.useEffect(()=>{a.current=i},[i]),ue.useEffect(()=>{if(!r.current)return;const m=document.createElement("video-js");m.classList.add("vjs-big-play-centered"),m.setAttribute("x-webkit-airplay","allow"),m.setAttribute("airplay","allow"),m.setAttribute("playsinline",""),r.current.appendChild(m);const _=$(m,{controls:!1,autoplay:!0,fill:!0,sources:[Mc(u.current)],poster:l.current,html5:{vhs:{overrideNative:!1}}},()=>{_.isDisposed()||a.current?.(_)});return n.current=_,()=>{_.dispose(),n.current=null}},[]),ue.useEffect(()=>{const m=n.current;m&&s!==u.current&&m.src(Mc(s))},[s]),ue.useEffect(()=>{const m=n.current;!m||e===void 0||e!==l.current&&m.poster(e)},[e]),ue.useEffect(()=>{const m=n.current;if(!m||m.isDisposed())return;const w=(t??[]).filter(P=>P.isSupported),x=[];for(const P of w){const T=m.addRemoteTextTrack({src:`/api/subtitles/${P.id}`,srclang:P.language,label:P.displayLanguage,kind:"subtitles",default:!1},!1);x.push(T)}return()=>{if(!m.isDisposed())for(const P of x)m.removeRemoteTextTrack(P)}},[t]);const f=()=>{n.current&&(n.current.paused()?n.current.play():n.current.pause())};return Q.jsx("div",{ref:r,className:"w-full h-full cursor-pointer [&_video]:object-contain",onClick:f})}function q2(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 ln=()=>window;function $2(s){return/^https?:\/\//i.test(s)?s:`${window.location.origin}${s}`}function V2({episodeId:s,movieId:e,player:t,streamUrl:i,title:r}){const[n,a]=ue.useState({airplayAvailable:!1,chromecastAvailable:!1}),[u,l]=ue.useState(!1),f=ue.useRef(null),m=ue.useRef(null);ue.useEffect(()=>{const T=typeof document.querySelector("video")?.webkitShowPlaybackTargetPicker=="function";a(I=>({...I,airplayAvailable:T}))},[t]),ue.useEffect(()=>{let P=!1;const T=()=>{if(P)return;const N=ln(),O=N.cast?.framework;if(!(!O||!N.chrome?.cast))try{const F=O.CastContext.getInstance(),j=new O.RemotePlayer,U=new O.RemotePlayerController(j);f.current=j,m.current=U;const R=()=>{l(j.isConnected),t&&!j.isConnected&&j.currentTime>0&&(t.currentTime(j.currentTime),t.play())},G=()=>{if(!j.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:j.currentTime,duration:j.duration})}).catch(()=>{})};U.addEventListener(O.RemotePlayerEventType.IS_CONNECTED_CHANGED,R),U.addEventListener(O.RemotePlayerEventType.CURRENT_TIME_CHANGED,G),a(v=>({...v,chromecastAvailable:!0}))}catch(F){console.warn("Cast framework initialisation failed:",F)}},I=ln(),M=I.__onGCastApiAvailable;return I.__onGCastApiAvailable=N=>{M?.(N),N&&T()},I.cast?.framework&&I.chrome?.cast&&T(),()=>{P=!0,m.current,ln().cast?.framework}},[t,s,e]);const _=async()=>{const P=ln(),T=P.cast?.framework,I=P.chrome;if(!T||!I?.cast){pn.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,F=$2(i),j=new I.cast.media.MediaInfo(F,"video/mp4");j.metadata={title:r};const U=new I.cast.media.LoadRequest(j);U.currentTime=O,await N.loadMedia(U),t?.pause()}catch(M){console.warn("Cast session failed:",M),pn.error("Chromecast couldn't reach Jukebox. Make sure your device is on the same network.")}},w=()=>{const P=document.querySelector("video");P?.webkitShowPlaybackTargetPicker&&P.webkitShowPlaybackTargetPicker()},x=()=>{if(n.airplayAvailable&&n.chromecastAvailable){_();return}if(n.chromecastAvailable){_();return}n.airplayAvailable&&w()};return!n.airplayAvailable&&!n.chromecastAvailable?null:Q.jsx("button",{"aria-label":u?"Stop casting":"Cast",className:"p-2 flex justify-center items-center cursor-pointer",onClick:x,children:Q.jsx(Ym,{className:`size-7 hover:scale-125 ${u?"text-blue-400":"text-white"}`})})}function H2({buffered:s,progress:e,onSeek:t}){const i=ue.useRef(null),r=ue.useRef(!1),n=Math.min(Math.max(s,0),1)*100+"%",a=Math.min(Math.max(e,0),1)*100+"%",u=_=>{if(!i.current||!t)return;const w=i.current.getBoundingClientRect(),x=(_.clientX-w.left)/w.width;t(Math.min(Math.max(x,0),1))},l=_=>{i.current&&(i.current.setPointerCapture(_.pointerId),r.current=!0,u(_))},f=_=>{r.current&&u(_)},m=_=>{i.current&&(i.current.hasPointerCapture(_.pointerId)&&i.current.releasePointerCapture(_.pointerId),r.current=!1)};return Q.jsxs("div",{ref:i,className:"relative w-full h-4 cursor-pointer flex items-center touch-none",onPointerDown:l,onPointerMove:f,onPointerUp:m,onPointerCancel:m,children:[Q.jsxs("div",{className:"w-full h-1 rounded-full bg-white/20 relative overflow-hidden",children:[Q.jsx("div",{className:"h-full bg-white/30 absolute left-0 top-0 z-0",style:{width:n}}),Q.jsx("div",{className:"h-full bg-red-600 absolute left-0 top-0 z-10",style:{width:a}})]}),Q.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:a}})]})}const Ff="jukebox-volume";function z2(){try{const s=localStorage.getItem(Ff);if(s)return JSON.parse(s)}catch{}return{volume:1,muted:!1}}function G2(s,e){try{localStorage.setItem(Ff,JSON.stringify({volume:s,muted:e}))}catch{}}function W2({player:s}){const[e,t]=ue.useState(1),[i,r]=ue.useState(!1),n=ue.useRef(null);ue.useEffect(()=>{if(!s||s.isDisposed())return;const m=z2();t(m.volume),r(m.muted),s.volume(m.volume),s.muted(m.muted);const _=()=>{const w=s.volume()??1,x=s.muted()??!1;t(w),r(x),G2(w,x)};return s.on("volumechange",_),()=>{s.isDisposed()||s.off("volumechange",_)}},[s]);const a=()=>{!s||s.isDisposed()||s.muted(!i)},u=m=>{if(!n.current||!s||s.isDisposed())return;const _=n.current.getBoundingClientRect(),w=1-(m.clientY-_.top)/_.height,x=Math.min(Math.max(w,0),1);s.volume(x),x>0&&i&&s.muted(!1)},l=()=>i||e===0?Q.jsx(Hc,{className:"size-7 text-white"}):e<.33?Q.jsx(zc,{className:"size-7 text-white"}):e<.66?Q.jsx($c,{className:"size-7 text-white"}):Q.jsx(Vc,{className:"size-7 text-white"}),f=i?0:e*100;return Q.jsxs("div",{className:"relative group",children:[Q.jsx("button",{"aria-label":i?"Unmute":"Mute",className:"p-2 flex justify-center items-center cursor-pointer",onClick:a,children:l()}),Q.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 hidden group-hover:block z-50 pb-2",children:Q.jsx("div",{className:"bg-black/90 rounded-lg p-3 shadow-lg border border-white/20",children:Q.jsxs("div",{ref:n,className:"relative w-2 h-24 bg-white/20 rounded cursor-pointer",onClick:u,children:[Q.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-white rounded",style:{height:`${f}%`}}),Q.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 pr="off",Bc=10,X2=1e4;function K2({title:s,player:e,movieId:t,episodeId:i,onFullscreen:r,onNextEpisode:n,onToggleEpisodes:a,showEpisodesButton:u,streamUrl:l,subtitles:f}){const[m,_]=ue.useState(!1),[w,x]=ue.useState(0),[P,T]=ue.useState(0),[I,M]=ue.useState(0),[N,O]=ue.useState(pr),F=ue.useRef(0);ue.useEffect(()=>{O(pr)},[f]),ue.useEffect(()=>{if(!e||e.isDisposed())return;const q=e.remoteTextTrackEls();if(!q||q.length===0)return;const K=()=>{pn.error("Subtitle failed to load. Pick another track."),O(pr)},te=[];for(let ie=0;ie<q.length;ie++){const W=q[ie];W&&(W.addEventListener("error",K),te.push(W))}return()=>{for(const ie of te)ie.removeEventListener("error",K)}},[e,f]);const j=(f??[]).filter(q=>q.isSupported),U=(f??[]).filter(q=>!q.isSupported),R=j.length>0||U.length>0,G=q=>{if(O(q),!e||e.isDisposed())return;const K=e.textTracks();if(!K)return;const te=j.find(ie=>String(ie.id)===q);for(let ie=0;ie<K.length;ie++){const W=K[ie];!W||W.kind!=="subtitles"||(te&&W.language===te.language?W.mode="showing":W.mode="disabled")}};ue.useEffect(()=>{if(!e||e.isDisposed())return;const q=()=>_(!0),K=()=>_(!1),te=()=>{const W=e.currentTime()??0,Z=e.duration()??0;Z>0&&(x(W/Z),M(Z-W))},ie=()=>{const W=e.buffered(),Z=e.duration()??0;if(W&&W.length>0&&Z>0){const ee=W.end(W.length-1);T(ee/Z)}};return e.on("play",q),e.on("pause",K),e.on("timeupdate",te),e.on("progress",ie),_(!e.paused()),()=>{e.isDisposed()||(e.off("play",q),e.off("pause",K),e.off("timeupdate",te),e.off("progress",ie))}},[e]),ue.useEffect(()=>{if(!e)return;const q=async()=>{if(e.isDisposed())return;const te=e.currentTime()??0,ie=e.duration()??0;if(te===F.current)return;F.current=te;const W=i?`/api/progress/episode/${i}`:`/api/progress/${t}`;await fetch(W,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:te,duration:ie})})},K=setInterval(()=>{q()},X2);return()=>{clearInterval(K),q()}},[e,t,i]);const v=()=>{e&&(e.paused()?e.play():e.pause())},E=()=>{if(!e)return;const q=e.currentTime()??0;e.currentTime(Math.max(0,q-Bc))},V=()=>{if(!e)return;const q=e.currentTime()??0,K=e.duration()??0;e.currentTime(Math.min(K,q+Bc))},H=q=>{if(!e)return;const K=e.duration()??0;e.currentTime(q*K)};return Q.jsxs("div",{className:"px-6 overflow-visible",children:[Q.jsxs("div",{className:"flex items-center gap-4",children:[Q.jsx("div",{className:"flex-1",children:Q.jsx(H2,{buffered:P,progress:w,onSeek:H})}),Q.jsx("span",{className:"text-white text-xs font-mono whitespace-nowrap",children:q2(I)})]}),Q.jsxs("div",{className:"flex justify-between items-center py-4 relative z-10",children:[Q.jsxs("div",{className:"flex gap-2 items-center",children:[Q.jsx(ss,{"aria-label":m?"Pause":"Play",onClick:v,children:m?Q.jsx(ig,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"}):Q.jsx(Rm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),Q.jsx(ss,{"aria-label":"Skip backward 10 seconds",onClick:E,children:Q.jsx(rg,{className:"size-7 hover:scale-125 text-white"})}),Q.jsx(ss,{"aria-label":"Skip forward 10 seconds",onClick:V,children:Q.jsx(ag,{className:"size-7 hover:scale-125 text-white"})}),Q.jsx(W2,{player:e})]}),Q.jsx("div",{className:"text-white text-sm truncate",children:s}),Q.jsxs("div",{className:"flex gap-2 items-center",children:[l&&Q.jsx(V2,{episodeId:i,movieId:t,player:e,streamUrl:l,title:s}),R&&Q.jsx(Y2,{activeSubtitleId:N,onSelect:G,supportedSubtitles:j,unsupportedSubtitles:U}),n&&Q.jsx(ss,{"aria-label":"Next episode",onClick:n,children:Q.jsx(ug,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),u&&a&&Q.jsx(ss,{"aria-label":"Browse episodes",onClick:a,children:Q.jsx(Jm,{className:"size-7 hover:scale-125 text-white"})}),r&&Q.jsx(ss,{"aria-label":"Toggle fullscreen",onClick:r,children:Q.jsx(eg,{className:"size-7 hover:scale-125 text-white"})})]})]})]})}function Y2({activeSubtitleId:s,onSelect:e,supportedSubtitles:t,unsupportedSubtitles:i}){return Q.jsxs(Nm,{children:[Q.jsx(Mm,{asChild:!0,children:Q.jsx("button",{"aria-label":"Subtitles",className:"p-2 flex justify-center items-center cursor-pointer",type:"button",children:Q.jsx(Xm,{className:"size-7 hover:scale-125 text-white"})})}),Q.jsx(Bm,{children:Q.jsxs(Fm,{align:"end",className:"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",side:"top",sideOffset:8,children:[Q.jsx(Fc,{isActive:s===pr,label:"Off",onSelect:()=>e(pr)}),t.map(r=>{const n=String(r.id);return Q.jsx(Fc,{isActive:s===n,label:r.displayLanguage,onSelect:()=>e(n)},r.id)}),i.map(r=>Q.jsxs(qc,{className:"flex cursor-not-allowed items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-muted-foreground opacity-60 outline-none data-[disabled]:pointer-events-none",disabled:!0,children:[Q.jsx("span",{className:"size-4"}),Q.jsxs("span",{className:"flex-1 truncate",children:[r.displayLanguage," (unsupported format)"]})]},r.id))]})})]})}function Fc({isActive:s,label:e,onSelect:t}){return Q.jsxs(qc,{className:Nn("flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground",s&&"font-medium"),onSelect:i=>{i.preventDefault(),t()},children:[s?Q.jsx(Um,{className:"size-4 text-muted-foreground"}):Q.jsx("span",{className:"size-4"}),Q.jsx("span",{className:"flex-1 truncate",children:e})]})}function ss({"aria-label":s,children:e,onClick:t}){return Q.jsx("button",{"aria-label":s,className:"p-2 flex justify-center items-center cursor-pointer",onClick:t,children:e})}function Uc({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 Q.jsxs("div",{className:"bg-black/95 border-l border-white/10 h-full flex flex-col",children:[Q.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[Q.jsx("span",{className:"text-white text-sm font-medium truncate",children:u}),Q.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:Q.jsx(jc,{className:"size-5"})})]}),Q.jsx("div",{className:"flex gap-1 px-4 py-3 border-b border-white/10 flex-wrap",children:n.map(f=>Q.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))}),Q.jsx("div",{className:"flex-1 overflow-y-auto slim-scrollbar",children:l?.episodes.map(f=>{const m=f.id===s,_=r?.[f.id],w=_?.duration?Math.min(_.currentTime/_.duration*100,100):0,x=_?.duration?_.currentTime>=_.duration*.9:!1;return Q.jsxs("button",{className:`w-full text-left px-4 py-3 border-l-2 transition-colors ${m?"bg-white/10 border-red-600":"border-transparent hover:bg-white/5"}`,onClick:()=>{t(f),e()},children:[Q.jsxs("div",{className:"text-white/60 text-xs mb-1",children:["E",f.episodeNumber,f.runtime!=null&&` · ${f.runtime}m`,x&&Q.jsx("span",{className:"ml-2 text-white/30",children:"Watched"})]}),Q.jsx("div",{className:`text-sm leading-snug ${x?"text-white/40":"text-white"}`,children:f.title}),w>0&&!x&&Q.jsx("div",{className:"mt-1.5 h-0.5 w-full rounded-full bg-white/10",children:Q.jsx("div",{className:"h-full rounded-full bg-red-600",style:{width:`${w}%`}})})]},f.id)})})]})}const Q2=9,J2=1e3;function Z2({nextEpisode:s,show:e,onPlayNow:t,onCancel:i,countdownSeconds:r=Q2,isCountingDown:n}){const a=ue.useRef(null),u=ue.useRef(!1),l=ue.useRef(t);ue.useEffect(()=>{l.current=t},[t]),ue.useEffect(()=>{if(!n){u.current=!1;return}const _=a.current;if(!_)return;const w=_.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+J2);return()=>{w.cancel(),clearTimeout(x)}},[n,r]);const f=ue.useMemo(()=>`S${s.seasonNumber} E${s.episodeNumber} · ${s.title}`,[s]),m=()=>{u.current||(u.current=!0,t())};return Q.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:[Q.jsxs("div",{className:"flex gap-3",children:[Q.jsx("div",{className:"w-20 flex-shrink-0 overflow-hidden rounded",children:Q.jsx(jm,{alt:e.title,path:e.posterPath,size:"w185",title:e.title})}),Q.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[Q.jsx("span",{className:"text-xs uppercase tracking-wide text-white/60",children:"Up next"}),Q.jsx("h3",{className:"mt-1 truncate text-sm font-semibold text-white",children:e.title}),Q.jsx("p",{className:"mt-0.5 truncate text-xs text-white/70",children:f})]})]}),Q.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[Q.jsxs(to,{className:"flex-1 relative overflow-hidden bg-white/15 text-white hover:bg-white/25",onClick:m,size:"sm",children:[Q.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-0 left-0 w-full origin-left bg-white",ref:a,style:{transform:"scaleX(0)"}}),Q.jsx("span",{className:"relative mix-blend-difference",children:"Next episode"})]}),Q.jsx(to,{className:"flex-1",onClick:i,size:"sm",variant:"outline",children:"Cancel"})]})]})}function eb({muted:s,visible:e,volume:t}){const i=()=>s||t===0?Q.jsx(Hc,{className:"size-6 text-white"}):t<.33?Q.jsx(zc,{className:"size-6 text-white"}):t<.66?Q.jsx($c,{className:"size-6 text-white"}):Q.jsx(Vc,{className:"size-6 text-white"}),r=s?0:t*100;return Q.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:Q.jsxs("div",{className:"bg-black/70 rounded-full px-4 py-2 flex items-center gap-3 text-white",children:[i(),Q.jsx("div",{className:"relative w-32 h-1.5 bg-white/25 rounded-full overflow-hidden",children:Q.jsx("div",{className:"absolute top-0 left-0 bottom-0 bg-white rounded-full transition-[width] duration-150",style:{width:`${r}%`}})})]})})}function tb(s){return ue.useSyncExternalStore(e=>{const t=window.matchMedia(s);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia(s).matches,()=>!1)}async function ib(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 sb(s,e,t={}){const i=(t.enabled??!0)&&!!s&&!!e;return rs({queryKey:["next-episode",s,e],queryFn:()=>ib(s??0,e??0),enabled:i,retry:!1})}const rb=.9;async function nb(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 ab(s){return await(await fetch(`/api/progress/${s}`)).json()}async function ob(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 ub(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 lb(s){return await(await fetch(`/api/progress/episode/${s}`)).json()}async function cb(s){const e=await fetch(`/api/progress/episode/show/${s}`);return e.ok?await e.json():{}}const db=3e3,hb=45;function gb(){const{id:s}=qm(),e=$m(),t=Vm(),i=e.pathname.startsWith("/watch/episode/"),[r,n]=ue.useState(!0),[a,u]=ue.useState(!1),[l,f]=ue.useState(null),[m,_]=ue.useState(!1),w=tb("(max-width: 639px)"),[x,P]=ue.useState(1),[T,I]=ue.useState(!1),[M,N]=ue.useState(!1),[O,F]=ue.useState(!1),[j,U]=ue.useState(!1),[R,G]=ue.useState(null),v=ue.useRef(!1),E=ue.useRef(null),V=ue.useRef(null),H=ue.useRef(null),q=ue.useCallback(()=>{document.fullscreenElement?document.exitFullscreen():H.current?.requestFullscreen()},[]),K=ue.useCallback(()=>{n(!0),E.current&&clearTimeout(E.current),a&&(E.current=setTimeout(()=>{n(!1)},db))},[a]),te=ue.useCallback((xe,Ee)=>{G({volume:xe,muted:Ee}),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{G(null)},1200)},[]);ue.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>u(!0),Ee=()=>u(!1);return l.on("play",xe),l.on("pause",Ee),u(!l.paused()),()=>{l.isDisposed()||(l.off("play",xe),l.off("pause",Ee))}},[l]),ue.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>{l.isDisposed()||te(l.volume()??1,l.muted()??!1)};return l.on("volumechange",xe),()=>{l.isDisposed()||l.off("volumechange",xe)}},[l,te]),ue.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]),ue.useEffect(()=>(a?K():(n(!0),E.current&&clearTimeout(E.current)),()=>{E.current&&clearTimeout(E.current)}),[a,K]),Zi("*",()=>K()),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,Ee=l.duration()??0;l.currentTime(Math.min(Ee,xe+10))},[l]),Zi("up",xe=>{if(xe.preventDefault(),!l||l.isDisposed())return;const Ee=l.volume()??1,We=Math.min(1,Ee+.05);l.muted()&&l.muted(!1),l.volume(We)},[l]),Zi("down",xe=>{if(xe.preventDefault(),!l||l.isDisposed())return;const Ee=l.volume()??1,We=Math.max(0,Ee-.05);l.volume(We)},[l]);const{data:ie,isLoading:W,error:Z}=rs({queryKey:["movie",s],queryFn:()=>nb(s??""),enabled:!!s&&!i,placeholderData:nl}),{data:ee,isLoading:re,error:se}=rs({queryKey:["episode",s],queryFn:()=>ob(s??""),enabled:!!s&&i,placeholderData:nl}),ce=ee?.episode,de=ee?.show,{data:_e}=rs({queryKey:["show-for-episode",de?.id],queryFn:()=>ub(de?.id??0),enabled:!!de}),{data:pe}=rs({queryKey:["show-progress",de?.id],queryFn:()=>cb(de?.id??0),enabled:!!de}),{data:$e}=rs({queryKey:["progress",i?"episode":"movie",i?ce?.id:ie?.id],queryFn:()=>i?lb(ce?.id??0):ab(ie?.id??0),enabled:i?!!ce:!!ie});ue.useEffect(()=>{ce&&P(ce.seasonNumber)},[ce]),ue.useEffect(()=>{if(!l||!$e||$e.currentTime<=0||v.current)return;v.current=!0;const{currentTime:xe,duration:Ee}=$e;Ee!==null&&Ee>0&&xe/Ee>=rb||l.currentTime(xe)},[l,$e]);const{data:Je}=sb(de?.id,ce?.id,{enabled:i}),Ce=Je?.episode??null,Ze=Je?.show??null;ue.useEffect(()=>{I(!1),N(!1),F(!1),v.current=!1},[ce?.id]),ue.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>U(!1);return l.on("playing",xe),()=>{l.isDisposed()||l.off("playing",xe)}},[l]);const ct=ue.useCallback(()=>{Ce&&(U(!0),t(`/watch/episode/${Ce.id}`))},[Ce,t]);ue.useEffect(()=>{if(!l||l.isDisposed()||!i)return;const xe=()=>{const We=l.currentTime()??0,Te=l.duration()??0;if(Te<=0)return;Te-We<=hb&&!T&&Ce&&(N(!0),F(!0))},Ee=()=>{if(!Ce){pn("You've finished all episodes."),de&&t(`/shows/${de.id}`);return}T||(N(!0),F(!0))};return l.on("timeupdate",xe),l.on("ended",Ee),()=>{l.isDisposed()||(l.off("timeupdate",xe),l.off("ended",Ee))}},[l,i,Ce,T,de,t]);const Ye=ue.useCallback(xe=>{if(xe.id!==ce?.id){if(l&&ce){const Ee=l.currentTime()??0,We=l.duration()??0;fetch(`/api/progress/episode/${ce.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:Ee,duration:We})})}U(!0),t(`/watch/episode/${xe.id}`)}},[l,ce,t]),rt=i?re:W,$t=i?se:Z;if(rt)return Q.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:Q.jsx(Hm,{className:"h-8 w-8 animate-spin text-white"})});if($t||(i?!ce:!ie))return Q.jsxs("div",{className:"min-h-screen bg-black flex flex-col items-center justify-center gap-4",children:[Q.jsx("p",{className:"text-white",children:i?"Episode not found":"Movie not found"}),Q.jsx(to,{asChild:!0,variant:"outline",children:Q.jsx(rl,{to:"/",children:"Back to Library"})})]});const Ge=i?`/api/stream/episode/${ce?.id}`:`/api/stream/${ie?.id}`,Vt=i&&ce&&de?`${de.title} — S${ce.seasonNumber} E${ce.episodeNumber} · ${ce.title}`:ie?.title??"",Ve=i?ee?.subtitles??[]:ie?.subtitles??[];return Q.jsxs("div",{ref:H,className:`bg-black w-full h-screen relative ${r?"":"cursor-none"}`,onMouseMove:K,children:[Q.jsx("div",{className:"absolute inset-0",children:Q.jsx(j2,{src:Ge,subtitles:Ve,onReady:f})}),Q.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"}`}),Q.jsx(eb,{muted:R?.muted??!1,visible:R!==null,volume:R?.volume??0}),i&&M&&Ce&&Q.jsx("video",{"aria-hidden":"true",className:"hidden",preload:"auto",src:`/api/stream/episode/${Ce.id}`}),i&&M&&Ce&&Ze&&Q.jsx(Z2,{isCountingDown:O,nextEpisode:Ce,onCancel:()=>{I(!0),N(!1),F(!1)},onPlayNow:ct,show:Ze}),i&&_e&&ce&&Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:`hidden sm:block absolute top-0 right-0 bottom-0 w-96 z-20 ${m?"":"pointer-events-none opacity-0"} transition-opacity duration-200`,children:m&&Q.jsx(Uc,{currentEpisodeId:ce.id,onClose:()=>_(!1),onSelectEpisode:Ye,onSelectSeason:P,progressMap:pe,seasons:_e.seasons,selectedSeason:x,showTitle:_e.title})}),w&&Q.jsx(Dg,{onOpenChange:_,open:m,children:Q.jsxs(Pg,{className:"h-[85vh] p-0 bg-black/95 border-white/10",hideCloseButton:!0,side:"bottom",children:[Q.jsxs(Lg,{className:"sr-only",children:[_e.title," episodes"]}),Q.jsx(Uc,{currentEpisodeId:ce.id,onClose:()=>_(!1),onSelectEpisode:Ye,onSelectSeason:P,progressMap:pe,seasons:_e.seasons,selectedSeason:x,showTitle:_e.title})]})})]}),Q.jsx(rl,{"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:Q.jsx(Gm,{className:"size-7"})}),Q.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:Q.jsx(K2,{title:Vt,player:l,movieId:i?void 0:ie?.id,episodeId:i?ce?.id:void 0,showEpisodesButton:i,streamUrl:Ge,subtitles:Ve,onFullscreen:q,onNextEpisode:i&&Ce?ct:void 0,onToggleEpisodes:()=>_(xe=>!xe)})})]})}export{gb as WatchPage};
|
|
200
|
+
`.split("").map(s=>s.charCodeAt(0)));class Bv extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Fv extends wo{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 st();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return st([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Ln(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===Zt.TIMEOUT&&this.handleTimeout_(),e.code===Zt.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:$.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)}),vv(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],m=l[1];a[f]=isNaN(m)?m:Number(m)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof D.WebVTT!="function")throw new Bv;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=>{$.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 m=f.endTime-f.startTime,_=this.handleRollover_(f.startTime+l,t.time);f.startTime=Math.max(_,0),f.endTime=Math.max(_+m,0)}),!i.syncInfo){const f=e.cues[0].startTime,m=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(f,m-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 Uv=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},jv=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=Uv(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 qv{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 Sf{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 m=this.storage_.get(u),_=a,w=_+l.duration,x=!!(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),P=new Ic({start:_,end:w,appended:x,segmentIndex:f});l.syncInfo=P;let T=a;const I=(l.parts||[]).map((M,N)=>{const O=T,F=T+M.duration,j=!!(m&&m.partsSyncInfo&&m.partsSyncInfo[N]&&m.partsSyncInfo[N].isAppended),U=new Ic({start:O,end:F,appended:j,segmentIndex:f,partIndex:N});return T=F,n+=`Media Sequence: ${u}.${N} | Range: ${O} --> ${F} | Appended: ${j}
|
|
202
|
+
`,M.syncInfo=U,U});r.set(u,new qv(P,I)),n+=`${Tf(l.resolvedUri)} | Media Sequence: ${u} | Range: ${_} --> ${w} | Appended: ${x}
|
|
203
|
+
`,u++,a=w}),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 Sf{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,Za=[{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=_o(e);r=r||0;for(let l=0;l<u.length;l++){const f=e.endList||r===0?l:u.length-(l+1),m=u[f],_=m.segment,w=s.timelineToDatetimeMappings[_.timeline];if(!w||!_.dateTimeObject)continue;let P=_.dateTimeObject.getTime()/1e3+w;if(_.parts&&typeof m.partIndex=="number")for(let I=0;I<m.partIndex;I++)P+=_.parts[I].duration;const T=Math.abs(r-P);if(a!==null&&(T===0||a<T))break;a=T,n={time:P,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return n}},{name:"Segment",run:(s,e,t,i,r)=>{let n=null,a=null;r=r||0;const u=_o(e);for(let l=0;l<u.length;l++){const f=e.endList||r===0?l:u.length-(l+1),m=u[f],_=m.segment,w=m.part&&m.part.start||_&&_.start;if(_.timeline===i&&typeof w<"u"){const x=Math.abs(r-w);if(a!==null&&a<x)break;(!n||a===null||a>=x)&&(a=x,n={time:w,segmentIndex:m.segmentIndex,partIndex:m.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,m=s.discontinuities[f];if(m){const _=Math.abs(r-m.time);if(a!==null&&a<_)break;(!n||a===null||a>=_)&&(a=_,n={time:m.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 Vv extends $.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Sf,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 Za.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:m,time:_}=l;if(m<0)continue;const w=e.segments[m],x=_,P=x+w.duration;if(this.logger_(`Strategy: ${f}. Current time: ${r}. selected segment: ${m}. Time: [${x} -> ${P}]}`),r>=x&&r<P)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<Za.length;u++){const l=Za[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>$v){$.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 Hv extends $.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 zv=uf(lf(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 F=this.listeners[N].indexOf(O);return this.listeners[N]=this.listeners[N].slice(0),this.listeners[N].splice(F,1),F>-1},I.trigger=function(N){var O=this.listeners[N];if(O)if(arguments.length===2)for(var F=O.length,j=0;j<F;++j)O[j].call(this,arguments[1]);else for(var U=Array.prototype.slice.call(arguments,1),R=O.length,G=0;G<R;++G)O[G].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 F,j,U;const R=[],G=[];let v,E,V,H,q,K;for(F=0;F<256;F++)G[(R[F]=F<<1^(F>>7)*283)^F]=F;for(j=U=0;!N[j];j^=v||1,U=G[U]||1)for(H=U^U<<1^U<<2^U<<3^U<<4,H=H>>8^H&255^99,N[j]=H,O[H]=j,V=R[E=R[v=R[j]]],K=V*16843009^E*65537^v*257^j*16843008,q=R[H]*257^H*16843008,F=0;F<4;F++)I[F][j]=q=q<<24^q>>>8,M[F][H]=K=K<<24^K>>>8;for(F=0;F<5;F++)I[F]=I[F].slice(0),M[F]=M[F].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 F=this._tables[0][4],j=this._tables[1],U=I.length;let R=1;if(U!==4&&U!==6&&U!==8)throw new Error("Invalid aes key size");const G=I.slice(0),v=[];for(this._key=[G,v],M=U;M<4*U+28;M++)O=G[M-1],(M%U===0||U===8&&M%U===4)&&(O=F[O>>>24]<<24^F[O>>16&255]<<16^F[O>>8&255]<<8^F[O&255],M%U===0&&(O=O<<8^O>>>24^R<<24,R=R<<1^(R>>7)*283)),G[M]=G[M-U]^O;for(N=0;M;N++,M--)O=G[N&3?M:M-4],M<=4||N<4?v[N]=O:v[N]=j[0][F[O>>>24]]^j[1][F[O>>16&255]]^j[2][F[O>>8&255]]^j[3][F[O&255]]}decrypt(I,M,N,O,F,j){const U=this._key[1];let R=I^U[0],G=O^U[1],v=N^U[2],E=M^U[3],V,H,q;const K=U.length/4-2;let te,ie=4;const W=this._tables[1],Z=W[0],ee=W[1],re=W[2],se=W[3],ce=W[4];for(te=0;te<K;te++)V=Z[R>>>24]^ee[G>>16&255]^re[v>>8&255]^se[E&255]^U[ie],H=Z[G>>>24]^ee[v>>16&255]^re[E>>8&255]^se[R&255]^U[ie+1],q=Z[v>>>24]^ee[E>>16&255]^re[R>>8&255]^se[G&255]^U[ie+2],E=Z[E>>>24]^ee[R>>16&255]^re[G>>8&255]^se[v&255]^U[ie+3],ie+=4,R=V,G=H,v=q;for(te=0;te<4;te++)F[(3&-te)+j]=ce[R>>>24]<<24^ce[G>>16&255]<<16^ce[v>>8&255]<<8^ce[E&255]^U[ie++],V=R,R=G,G=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,M){const N=new Int32Array(T.buffer,T.byteOffset,T.byteLength>>2),O=new r(Array.prototype.slice.call(I)),F=new Uint8Array(T.byteLength),j=new Int32Array(F.buffer);let U,R,G,v,E,V,H,q,K;for(U=M[0],R=M[1],G=M[2],v=M[3],K=0;K<N.length;K+=4)E=a(N[K]),V=a(N[K+1]),H=a(N[K+2]),q=a(N[K+3]),O.decrypt(E,V,H,q,j,K),j[K]=a(j[K]^U),j[K+1]=a(j[K+1]^R),j[K+2]=a(j[K+2]^G),j[K+3]=a(j[K+3]^v),U=E,R=V,G=H,v=q;return F};class l{constructor(I,M,N,O){const F=l.STEP,j=new Int32Array(I.buffer),U=new Uint8Array(I.byteLength);let R=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(j.subarray(R,R+F),M,N,U)),R=F;R<j.length;R+=F)N=new Uint32Array([a(j[R-4]),a(j[R-3]),a(j[R-2]),a(j[R-1])]),this.asyncStream_.push(this.decryptChunk_(j.subarray(R,R+F),M,N,U));this.asyncStream_.push(function(){O(null,e(U))})}static get STEP(){return 32e3}decryptChunk_(I,M,N,O){return function(){const F=u(I,M,N);O.set(F,I.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof f<"u"?m=f:typeof self<"u"?m=self:m={};var _=m,w=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 P=function(T){const I={};return Object.keys(T).forEach(M=>{const N=T[M];w(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(F,j){self.postMessage(P({source:I.source,decrypted:j}),[j.buffer])})}}));var Gv=of(zv);const Wv=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Ef=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Do=(s,e)=>{e.activePlaylistLoader=s,s.load()},Xv=(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,Ef(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),Do(a.playlistLoader,r)}},Kv=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Yv=(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,Ef(i,n),!!u)){if(u.isMainPlaylist){if(!a||!f||a.id===f.id)return;const m=e.vhs.playlistController_,_=m.selectPlaylist();if(m.media()===_)return;n.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),r.resetEverything(),m.fastQualityChange_(_);return}if(s==="AUDIO"){if(!u.playlistLoader){r.setAudio(!0),r.resetEverything();return}i.setAudio(!0),r.setAudio(!1)}if(l===u.playlistLoader){Do(u.playlistLoader,n);return}i.track&&i.track(a),i.resetEverything(),Do(u.playlistLoader,n)}},On={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}$.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;$.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",On[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",On[s](s,t))}},Qv={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:m}=e,_=wr(m.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},_&&(a[s].main.default.playlists=m.main.playlists));for(const w in a[s]){u[w]||(u[w]=[]);for(const x in a[s][w]){let P=a[s][w][x],T;if(_?(f(`AUDIO group '${w}' label '${x}' is a main playlist`),P.isMainPlaylist=!0,T=null):i==="vhs-json"&&P.playlists?T=new os(P.playlists[0],t,n):P.resolvedUri?T=new os(P.resolvedUri,t,n):P.playlists&&i==="dash"?T=new So(P.playlists[0],t,n,m):T=null,P=De({id:x,playlistLoader:T},P),Lc[s](s,P.playlistLoader,e),u[w].push(P),typeof l[x]>"u"){const I=new $.AudioTrack({id:x,kind:Wv(P),enabled:!1,language:P.language,default:P.default,label:x});l[x]=I}}}r.on("error",On[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:m}=e;for(const _ in u[s]){l[_]||(l[_]=[]);for(const w in u[s][_]){if(!i.options_.useForcedSubtitles&&u[s][_][w].forced)continue;let x=u[s][_][w],P;if(r==="hls")P=new os(x.resolvedUri,i,a);else if(r==="dash"){if(!x.playlists.filter(I=>I.excludeUntil!==1/0).length)return;P=new So(x.playlists[0],i,a,m)}else r==="vhs-json"&&(P=new os(x.playlists?x.playlists[0]:x.resolvedUri,i,a));if(x=De({id:w,playlistLoader:P},x),Lc[s](s,x.playlistLoader,e),l[_].push(x),typeof f[w]>"u"){const T=t.addRemoteTextTrack({id:w,kind:"subtitles",default:x.default&&x.autoselect,language:x.language,label:w},!1).track;f[w]=T}}}n.on("error",On[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 m={label:u,language:l.language,instreamId:l.instreamId,default:l.default&&l.autoselect};if(f[m.instreamId]&&(m=De(m,f[m.instreamId])),m.default===void 0&&delete m.default,r[a].push(De({id:u},l)),typeof n[u]>"u"){const _=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;n[u]=_}}}}},Cf=(s,e)=>{for(let t=0;t<s.length;t++)if(du(e,s[t])||s[t].playlists&&Cf(s[t].playlists,e))return!0;return!1},Jv=(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&&wr(e.main))for(let l=0;l<u.length;l++){const f=r[u[l]];if(Cf(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},Zv={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}},e2=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},t2=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{Qv[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=Jv(f,s),e[f].activeTrack=Zv[f](f,s),e[f].onGroupChanged=Xv(f,s),e[f].onGroupChanging=Kv(f,s),e[f].onTrackChanged=Yv(f,s),e[f].getActiveGroup=e2(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])},i2=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ui,activeTrack:ui,getActiveGroup:ui,onGroupChanged:ui,onTrackChanged:ui,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_=_t(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 s2 extends $.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=_t(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 m={errorType:$.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:m})}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&&(_t(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const r2=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},n2=10;let xi;const a2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],o2=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},u2=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:r,bufferHighWaterLine:n,duration:a,bufferBasedABR:u,log:l}){if(!i)return $.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 m=!!as(e,t).length;if(!s.endList)return!m&&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),w=u?tt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:tt.MAX_BUFFER_LOW_WATER_LINE;if(a<w)return l(`${f} as duration < max low water line (${a} < ${w})`),!0;const x=i.attributes.BANDWIDTH,P=s.attributes.BANDWIDTH;if(x<P&&(!u||_<n)){let T=`${f} as next bandwidth < current bandwidth (${x} < ${P})`;return u&&(T+=` and forwardBuffer < bufferHighWaterLine (${_} < ${n})`),l(T),!0}if((!u||x>P)&&_>=r){let T=`${f} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return u&&(T+=` and next bandwidth > current bandwidth (${x} > ${P})`),l(T),!0}return l(`not ${f} as no switching criteria met`),!1};class l2 extends $.EventTarget{constructor(e){super(),this.fastQualityChange_=r2(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:r,bandwidth:n,externVhs:a,useCueTags:u,playlistExclusionDuration:l,enableLowInitialPlaylist:f,sourceType:m,cacheEncryptionKeys:_,bufferBasedABR:w,leastPixelDiffSelector:x,captionServices:P,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),xi=a,this.bufferBasedABR=!!w,this.leastPixelDiffSelector=!!x,this.withCredentials=i,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=m,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_=i2(),T&&D.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new D.ManagedMediaSource,this.usingManagedMediaSource_=!0,$.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_=st(),this.hasPlayed_=!1,this.syncController_=new Vv(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new Gv,this.sourceUpdater_=new xf(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Hv,this.keyStatusMap_=new Map;const M={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:P,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth: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 So(t,this.vhs_,De(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new os(t,this.vhs_,De(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new wo(De(M,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new wo(De(M,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Fv(De(M,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,j)=>{function U(){r.off("vttjserror",R),F()}function R(){r.off("vttjsloaded",U),j()}r.one("vttjsloaded",U),r.one("vttjserror",R),r.addWebVttScript_()})}),e);const N=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new s2(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_())),a2.forEach(F=>{this[F+"_"]=o2.bind(this,F)}),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 F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,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 m=e.playlists[f];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===u&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;yo(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()),t2({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;yo(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(Ke({},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"}),xi.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 u2({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:n2}))});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(Ke({},r))}),this.audioSegmentLoader_.on(i,r=>{this.player_.trigger(Ke({},r))}),this.subtitleSegmentLoader_.on(i,r=>{this.player_.trigger(Ke({},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=xi.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-n<=Jt;const u=a.end(a.length-1);return u-n<=Jt&&r-u<=Jt}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(ia),a=n.length===1&&n[0]===e;if(r.length===1&&i!==1/0)return $.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 P=this.pathwayAttribute_(e),T=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(P),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(P)},T);return}let x=!1;r.forEach(P=>{if(P===e)return;const T=P.excludeUntil;typeof T<"u"&&T!==1/0&&(x=!0,delete P.excludeUntil)}),x&&($.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_:$.log.warn,m=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} 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,w=typeof l.lastRequest=="number"&&Date.now()-l.lastRequest<=_;return this.switchMedia_(l,"exclude",a||w)}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=as(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:xi.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=xi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),m=Math.max(u,l-f);return st([[u,m]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=xi.Playlist.seekable(i,n,xi.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:st([[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 [${Rh(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=xi.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||Qg),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,m)=>f?ur(m,this.usingManagedMediaSource_):Oa(m),u={};let l;if(["video","audio"].forEach(function(f){if(r.hasOwnProperty(f)&&!a(e[f].isFmp4,r[f])){const m=e[f].isFmp4?"browser":"muxer";u[m]=u[m]||[],u[m].push(r[f]),f==="audio"&&(l=m)}}),n&&l&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===f&&m!==t&&(m.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((m,_)=>(m&&(m+=", "),m+=`${_} does not support codec(s): "${u[_].join(",")}"`,m),"")+".";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(m=>{const _=(Xt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,w=(Xt(r[m]||"")[0]||{}).type;_&&w&&_.toLowerCase()!==w.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[m]}" -> "${r[m]}"`)}),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&&!Oa(n.audio)&&!ur(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Oa(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=Tr(Xt(e)),n=mc(r),a=r.video&&Xt(r.video)[0]||null,u=r.audio&&Xt(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 m=[],_=fr(this.mainPlaylistLoader_.main,f),w=mc(_);if(!(!_.audio&&!_.video)){if(w!==n&&m.push(`codec count "${w}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const x=_.video&&Xt(_.video)[0]||null,P=_.audio&&Xt(_.audio)[0]||null;x&&a&&x.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${x.type}" !== "${a.type}"`),P&&u&&P.type.toLowerCase()!==u.type.toLowerCase()&&m.push(`audio codec "${P.type}" !== "${u.type}"`)}m.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),jv(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=tt.GOAL_BUFFER_LENGTH,i=tt.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,tt.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=tt.BUFFER_LOW_WATER_LINE,i=tt.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,tt.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,tt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return tt.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Sc(this.inbandTextTracks_,"com.apple.streaming",this.tech_),Tv({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_),gv({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(Ke({},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(m=>m.attributes["PATHWAY-ID"]===u["BASE-ID"]).forEach(m=>{this.mainPlaylistLoader_.addClonePathway(u,m)}),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,$.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:Mv(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 c2=(s,e,t)=>i=>{const r=s.main.playlists[e],n=cu(r),a=ia(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 d2{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=c2(e.playlists,t.id,n)}}const h2=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=wr(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!cu(i)).map((i,r)=>new d2(s,i,i.id)):[]}},Rc=["seeking","seeked","pause","playing","error"];class f2 extends $.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(m=>{l[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",l[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",l[m].reset),this.tech_.on(["seeked","seeking"],l[m].reset)});const f=m=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][m]("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(m=>{a[`${m}SegmentLoader_`].off("appendsdone",l[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",l[m].reset),this.tech_.off(["seeked","seeking"],l[m].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=Jy(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+Jt>=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(st([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 P=t.start(0);n=P+(P===t.end(0)?0:Jt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Rh(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,m=this.media(),_=m.partTargetDuration?m.partTargetDuration:(m.targetDuration-Qt)*2,w=[l,f];for(let P=0;P<w.length;P++){if(!w[P])continue;if(uu(w[P],i)<_)return!1}const x=an(u,i);return x.length===0?!1:(n=x.start(0)+Jt,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=as(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=an(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)+Jt;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=as(e,i-3),a=as(e,i),u=as(t,i);u.length&&!a.length&&n.length&&(r={start:n.end(0),end:u.end(0)})}else an(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=an(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)+Qt);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=Ky(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 p2={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},wf=function(s,e){let t=0,i=0;const r=De(p2,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){i&&s.currentTime(i)},a=function(m){m!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",n),s.src(m),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"){$.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(m){l(),wf(s,m)};s.on("error",u),s.on("dispose",l),s.reloadSourceOnError=f},m2=function(s){wf(this,s)};var Af="3.17.2",g2="7.1.0",_2="1.3.1",y2="7.2.0",T2="4.0.2";const je={PlaylistLoader:os,Playlist:yt,utils:ET,STANDARD_PLAYLIST_SELECTOR:xc,INITIAL_PLAYLIST_SELECTOR:dv,lastBandwidthSelector:xc,movingAverageBandwidthSelector:lv,comparePlaylistBandwidth:fu,comparePlaylistResolution:uv,xhr:Zh()};Object.keys(tt).forEach(s=>{Object.defineProperty(je,s,{get(){return $.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),tt[s]},set(e){if($.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){$.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}tt[s]=e}})});const Df="videojs-vhs",kf=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"})},v2=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),kf(s,e.playlists)};je.canPlaySource=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const b2=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Tr(Xt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const r=_s(i.video),n=_s(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 De(s,a)},x2=(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},[]),S2=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?i.concat([t]):i,n=x2(r,Object.keys(e)),a=[],u=[];return n.forEach(l=>{u.push(new Promise((f,m)=>{s.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,m)=>{s.eme.initializeMediaKeys({keySystems:l},_=>{if(_){m(_);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(u)])},E2=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const r=b2(e,t,i);return r?(s.currentSource().keySystems=r,r&&!s.eme?($.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},If=()=>{if(!D.localStorage)return null;const s=D.localStorage.getItem(Df);if(!s)return null;try{return JSON.parse(s)}catch{return null}},C2=s=>{if(!D.localStorage)return!1;let e=If();e=e?De(e,s):s;try{D.localStorage.setItem(Df,JSON.stringify(e))}catch{return!1}return e},w2=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,Pf=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Lf=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Of=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Rf=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};je.supportsNativeHls=(function(){if(!ne||!ne.createElement)return!1;const s=ne.createElement("video");return $.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!ne||!ne.createElement||!$.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(ne.createElement("video").canPlayType("application/dash+xml"))})();je.supportsTypeNatively=s=>s==="hls"?je.supportsNativeHls:s==="dash"?je.supportsNativeDash:!1;je.isSupported=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};je.xhr.onRequest=function(s){Pf(je.xhr,s)};je.xhr.onResponse=function(s){Lf(je.xhr,s)};je.xhr.offRequest=function(s){Of(je.xhr,s)};je.xhr.offResponse=function(s){Rf(je.xhr,s)};const A2=$.getComponent("Component");class Nf extends A2{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=$.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(ne,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const n=ne.fullscreenElement||ne.webkitFullscreenElement||ne.mozFullScreenElement||ne.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_=De(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=If();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=tt.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===tt.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=w2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=je,this.options_.sourceType=td(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new l2(this.options_);const i=De({liveRangeSafeTimeDelta:Jt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new f2(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=$.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(){$.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&&C2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{h2(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),($.browser.IS_ANY_SAFARI||$.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"),S2({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=E2({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=$.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{v2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{kf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Af,"mux.js":g2,"mpd-parser":_2,"m3u8-parser":y2,"aes-decrypter":T2}}version(){return this.constructor.version()}canChangeType(){return xf.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 PT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return nf({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=>{Pf(this.xhr,e)},this.xhr.onResponse=e=>{Lf(this.xhr,e)},this.xhr.offRequest=e=>{Of(this.xhr,e)},this.xhr.offResponse=e=>{Rf(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(Ke({},r))})}),t.forEach(i=>{this.playbackWatcher_.on(i,r=>{this.player_.trigger(Ke({},r))})})}}const Rn={name:"videojs-http-streaming",VERSION:Af,canHandleSource(s,e={}){const t=De($.options,e);return!t.vhs.experimentalUseMMS&&!ur("avc1.4d400d,mp4a.40.2",!1)?!1:Rn.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=De($.options,t);return e.vhs=new Nf(s,e,i),e.vhs.xhr=Zh(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=td(s);if(!t)return"";const i=Rn.getOverrideNative(e);return!je.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!($.browser.IS_ANY_SAFARI||$.browser.IS_IOS),{overrideNative:i=t}=e;return i}},D2=()=>ur("avc1.4d400d,mp4a.40.2",!0);D2()&&$.getTech("Html5").registerSourceHandler(Rn,0);$.VhsHandler=Nf;$.VhsSourceHandler=Rn;$.Vhs=je;$.use||$.registerComponent("Vhs",je);$.options.vhs=$.options.vhs||{};(!$.getPlugin||!$.getPlugin("reloadSourceOnError"))&&$.registerPlugin("reloadSourceOnError",m2);function k2(){if(typeof navigator>"u")return!1;const s=navigator.userAgent;return/^((?!chrome|android|crios|fxios).)*safari/i.test(s)}function I2(){return typeof navigator>"u"?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function Nc(s){if(/\.mkv(\?|$)/i.test(s)&&(k2()||I2())){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 P2({src:s,poster:e,subtitles:t,onReady:i}){const r=ue.useRef(null),n=ue.useRef(null),a=ue.useRef(i),u=ue.useRef(s),l=ue.useRef(e);ue.useEffect(()=>{a.current=i},[i]),ue.useEffect(()=>{if(!r.current)return;const m=document.createElement("video-js");m.classList.add("vjs-big-play-centered"),m.setAttribute("x-webkit-airplay","allow"),m.setAttribute("airplay","allow"),m.setAttribute("playsinline",""),r.current.appendChild(m);const _=$(m,{controls:!1,autoplay:!0,fill:!0,sources:[Nc(u.current)],poster:l.current,html5:{vhs:{overrideNative:!1}}},()=>{_.isDisposed()||a.current?.(_)});return n.current=_,()=>{_.dispose(),n.current=null}},[]),ue.useEffect(()=>{const m=n.current;m&&s!==u.current&&m.src(Nc(s))},[s]),ue.useEffect(()=>{const m=n.current;!m||e===void 0||e!==l.current&&m.poster(e)},[e]),ue.useEffect(()=>{const m=n.current;if(!m||m.isDisposed())return;const w=(t??[]).filter(P=>P.isSupported),x=[];for(const P of w){const T=m.addRemoteTextTrack({src:`/api/subtitles/${P.id}`,srclang:P.language,label:P.displayLanguage,kind:"subtitles",default:!1},!1);x.push(T)}return()=>{if(!m.isDisposed())for(const P of x)m.removeRemoteTextTrack(P)}},[t]);const f=()=>{n.current&&(n.current.paused()?n.current.play():n.current.pause())};return J.jsx("div",{ref:r,className:"w-full h-full cursor-pointer [&_video]:object-contain",onClick:f})}function L2(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 ln=()=>window;function O2(s){return/^https?:\/\//i.test(s)?s:`${window.location.origin}${s}`}function R2({episodeId:s,movieId:e,player:t,streamUrl:i,title:r}){const[n,a]=ue.useState({airplayAvailable:!1,chromecastAvailable:!1}),[u,l]=ue.useState(!1),f=ue.useRef(null),m=ue.useRef(null);ue.useEffect(()=>{const T=typeof document.querySelector("video")?.webkitShowPlaybackTargetPicker=="function";a(I=>({...I,airplayAvailable:T}))},[t]),ue.useEffect(()=>{let P=!1;const T=()=>{if(P)return;const N=ln(),O=N.cast?.framework;if(!(!O||!N.chrome?.cast))try{const F=O.CastContext.getInstance(),j=new O.RemotePlayer,U=new O.RemotePlayerController(j);f.current=j,m.current=U;const R=()=>{l(j.isConnected),t&&!j.isConnected&&j.currentTime>0&&(t.currentTime(j.currentTime),t.play())},G=()=>{if(!j.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:j.currentTime,duration:j.duration})}).catch(()=>{})};U.addEventListener(O.RemotePlayerEventType.IS_CONNECTED_CHANGED,R),U.addEventListener(O.RemotePlayerEventType.CURRENT_TIME_CHANGED,G),a(v=>({...v,chromecastAvailable:!0}))}catch(F){console.warn("Cast framework initialisation failed:",F)}},I=ln(),M=I.__onGCastApiAvailable;return I.__onGCastApiAvailable=N=>{M?.(N),N&&T()},I.cast?.framework&&I.chrome?.cast&&T(),()=>{P=!0,m.current,ln().cast?.framework}},[t,s,e]);const _=async()=>{const P=ln(),T=P.cast?.framework,I=P.chrome;if(!T||!I?.cast){pn.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,F=O2(i),j=new I.cast.media.MediaInfo(F,"video/mp4");j.metadata={title:r};const U=new I.cast.media.LoadRequest(j);U.currentTime=O,await N.loadMedia(U),t?.pause()}catch(M){console.warn("Cast session failed:",M),pn.error("Chromecast couldn't reach Jukebox. Make sure your device is on the same network.")}},w=()=>{const P=document.querySelector("video");P?.webkitShowPlaybackTargetPicker&&P.webkitShowPlaybackTargetPicker()},x=()=>{if(n.airplayAvailable&&n.chromecastAvailable){_();return}if(n.chromecastAvailable){_();return}n.airplayAvailable&&w()};return!n.airplayAvailable&&!n.chromecastAvailable?null:J.jsx("button",{"aria-label":u?"Stop casting":"Cast",className:"p-2 flex justify-center items-center cursor-pointer",onClick:x,children:J.jsx(Gm,{className:`size-7 hover:scale-125 ${u?"text-blue-400":"text-white"}`})})}function N2({buffered:s,progress:e,onSeek:t}){const i=ue.useRef(null),r=ue.useRef(!1),n=Math.min(Math.max(s,0),1)*100+"%",a=Math.min(Math.max(e,0),1)*100+"%",u=_=>{if(!i.current||!t)return;const w=i.current.getBoundingClientRect(),x=(_.clientX-w.left)/w.width;t(Math.min(Math.max(x,0),1))},l=_=>{i.current&&(i.current.setPointerCapture(_.pointerId),r.current=!0,u(_))},f=_=>{r.current&&u(_)},m=_=>{i.current&&(i.current.hasPointerCapture(_.pointerId)&&i.current.releasePointerCapture(_.pointerId),r.current=!1)};return J.jsxs("div",{ref:i,className:"relative w-full h-4 cursor-pointer flex items-center touch-none",onPointerDown:l,onPointerMove:f,onPointerUp:m,onPointerCancel:m,children:[J.jsxs("div",{className:"w-full h-1 rounded-full bg-white/20 relative overflow-hidden",children:[J.jsx("div",{className:"h-full bg-white/30 absolute left-0 top-0 z-0",style:{width:n}}),J.jsx("div",{className:"h-full bg-red-600 absolute left-0 top-0 z-10",style:{width:a}})]}),J.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:a}})]})}const Mf="jukebox-volume";function M2(){try{const s=localStorage.getItem(Mf);if(s)return JSON.parse(s)}catch{}return{volume:1,muted:!1}}function B2(s,e){try{localStorage.setItem(Mf,JSON.stringify({volume:s,muted:e}))}catch{}}function F2({player:s}){const[e,t]=ue.useState(1),[i,r]=ue.useState(!1),n=ue.useRef(null);ue.useEffect(()=>{if(!s||s.isDisposed())return;const m=M2();t(m.volume),r(m.muted),s.volume(m.volume),s.muted(m.muted);const _=()=>{const w=s.volume()??1,x=s.muted()??!1;t(w),r(x),B2(w,x)};return s.on("volumechange",_),()=>{s.isDisposed()||s.off("volumechange",_)}},[s]);const a=()=>{!s||s.isDisposed()||s.muted(!i)},u=m=>{if(!n.current||!s||s.isDisposed())return;const _=n.current.getBoundingClientRect(),w=1-(m.clientY-_.top)/_.height,x=Math.min(Math.max(w,0),1);s.volume(x),x>0&&i&&s.muted(!1)},l=()=>i||e===0?J.jsx($c,{className:"size-7 text-white"}):e<.33?J.jsx(Vc,{className:"size-7 text-white"}):e<.66?J.jsx(jc,{className:"size-7 text-white"}):J.jsx(qc,{className:"size-7 text-white"}),f=i?0:e*100;return J.jsxs("div",{className:"relative group",children:[J.jsx("button",{"aria-label":i?"Unmute":"Mute",className:"p-2 flex justify-center items-center cursor-pointer",onClick:a,children:l()}),J.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 hidden group-hover:block z-50 pb-2",children:J.jsx("div",{className:"bg-black/90 rounded-lg p-3 shadow-lg border border-white/20",children:J.jsxs("div",{ref:n,className:"relative w-2 h-24 bg-white/20 rounded cursor-pointer",onClick:u,children:[J.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-white rounded",style:{height:`${f}%`}}),J.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 pr="off",Mc=10,U2=1e4;function j2({title:s,player:e,movieId:t,episodeId:i,onFullscreen:r,onNextEpisode:n,onToggleEpisodes:a,showEpisodesButton:u,streamUrl:l,subtitles:f}){const[m,_]=ue.useState(!1),[w,x]=ue.useState(0),[P,T]=ue.useState(0),[I,M]=ue.useState(0),[N,O]=ue.useState(pr),F=ue.useRef(0);ue.useEffect(()=>{O(pr)},[f]),ue.useEffect(()=>{if(!e||e.isDisposed())return;const q=e.remoteTextTrackEls();if(!q||q.length===0)return;const K=()=>{pn.error("Subtitle failed to load. Pick another track."),O(pr)},te=[];for(let ie=0;ie<q.length;ie++){const W=q[ie];W&&(W.addEventListener("error",K),te.push(W))}return()=>{for(const ie of te)ie.removeEventListener("error",K)}},[e,f]);const j=(f??[]).filter(q=>q.isSupported),U=(f??[]).filter(q=>!q.isSupported),R=j.length>0||U.length>0,G=q=>{if(O(q),!e||e.isDisposed())return;const K=e.textTracks();if(!K)return;const te=j.find(ie=>String(ie.id)===q);for(let ie=0;ie<K.length;ie++){const W=K[ie];!W||W.kind!=="subtitles"||(te&&W.language===te.language?W.mode="showing":W.mode="disabled")}};ue.useEffect(()=>{if(!e||e.isDisposed())return;const q=()=>_(!0),K=()=>_(!1),te=()=>{const W=e.currentTime()??0,Z=e.duration()??0;Z>0&&(x(W/Z),M(Z-W))},ie=()=>{const W=e.buffered(),Z=e.duration()??0;if(W&&W.length>0&&Z>0){const ee=W.end(W.length-1);T(ee/Z)}};return e.on("play",q),e.on("pause",K),e.on("timeupdate",te),e.on("progress",ie),_(!e.paused()),()=>{e.isDisposed()||(e.off("play",q),e.off("pause",K),e.off("timeupdate",te),e.off("progress",ie))}},[e]),ue.useEffect(()=>{if(!e)return;const q=async()=>{if(e.isDisposed())return;const te=e.currentTime()??0,ie=e.duration()??0;if(te===F.current)return;F.current=te;const W=i?`/api/progress/episode/${i}`:`/api/progress/${t}`;await fetch(W,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:te,duration:ie})})},K=setInterval(()=>{q()},U2);return()=>{clearInterval(K),q()}},[e,t,i]);const v=()=>{e&&(e.paused()?e.play():e.pause())},E=()=>{if(!e)return;const q=e.currentTime()??0;e.currentTime(Math.max(0,q-Mc))},V=()=>{if(!e)return;const q=e.currentTime()??0,K=e.duration()??0;e.currentTime(Math.min(K,q+Mc))},H=q=>{if(!e)return;const K=e.duration()??0;e.currentTime(q*K)};return J.jsxs("div",{className:"px-6 overflow-visible",children:[J.jsxs("div",{className:"flex items-center gap-4",children:[J.jsx("div",{className:"flex-1",children:J.jsx(N2,{buffered:P,progress:w,onSeek:H})}),J.jsx("span",{className:"text-white text-xs font-mono whitespace-nowrap",children:L2(I)})]}),J.jsxs("div",{className:"flex justify-between items-center py-4 relative z-10",children:[J.jsxs("div",{className:"flex gap-2 items-center",children:[J.jsx(ss,{"aria-label":m?"Pause":"Play",onClick:v,children:m?J.jsx(Jm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"}):J.jsx(wm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),J.jsx(ss,{"aria-label":"Skip backward 10 seconds",onClick:E,children:J.jsx(eg,{className:"size-7 hover:scale-125 text-white"})}),J.jsx(ss,{"aria-label":"Skip forward 10 seconds",onClick:V,children:J.jsx(ig,{className:"size-7 hover:scale-125 text-white"})}),J.jsx(F2,{player:e})]}),J.jsx("div",{className:"text-white text-sm truncate",children:s}),J.jsxs("div",{className:"flex gap-2 items-center",children:[l&&J.jsx(R2,{episodeId:i,movieId:t,player:e,streamUrl:l,title:s}),R&&J.jsx(q2,{activeSubtitleId:N,onSelect:G,supportedSubtitles:j,unsupportedSubtitles:U}),n&&J.jsx(ss,{"aria-label":"Next episode",onClick:n,children:J.jsx(rg,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),u&&a&&J.jsx(ss,{"aria-label":"Browse episodes",onClick:a,children:J.jsx(Xm,{className:"size-7 hover:scale-125 text-white"})}),r&&J.jsx(ss,{"aria-label":"Toggle fullscreen",onClick:r,children:J.jsx(Ym,{className:"size-7 hover:scale-125 text-white"})})]})]})]})}function q2({activeSubtitleId:s,onSelect:e,supportedSubtitles:t,unsupportedSubtitles:i}){return J.jsxs(Am,{children:[J.jsx(Dm,{asChild:!0,children:J.jsx("button",{"aria-label":"Subtitles",className:"p-2 flex justify-center items-center cursor-pointer",type:"button",children:J.jsx(Hm,{className:"size-7 hover:scale-125 text-white"})})}),J.jsx(km,{children:J.jsxs(Im,{align:"end",className:"z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md",side:"top",sideOffset:8,children:[J.jsx(Bc,{isActive:s===pr,label:"Off",onSelect:()=>e(pr)}),t.map(r=>{const n=String(r.id);return J.jsx(Bc,{isActive:s===n,label:r.displayLanguage,onSelect:()=>e(n)},r.id)}),i.map(r=>J.jsxs(Uc,{className:"flex cursor-not-allowed items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-muted-foreground opacity-60 outline-none data-[disabled]:pointer-events-none",disabled:!0,children:[J.jsx("span",{className:"size-4"}),J.jsxs("span",{className:"flex-1 truncate",children:[r.displayLanguage," (unsupported format)"]})]},r.id))]})})]})}function Bc({isActive:s,label:e,onSelect:t}){return J.jsxs(Uc,{className:Pm("flex cursor-pointer items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground",s&&"font-medium"),onSelect:i=>{i.preventDefault(),t()},children:[s?J.jsx(Lm,{className:"size-4 text-muted-foreground"}):J.jsx("span",{className:"size-4"}),J.jsx("span",{className:"flex-1 truncate",children:e})]})}function ss({"aria-label":s,children:e,onClick:t}){return J.jsx("button",{"aria-label":s,className:"p-2 flex justify-center items-center cursor-pointer",onClick:t,children:e})}function Fc({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 J.jsxs("div",{className:"bg-black/95 border-l border-white/10 h-full flex flex-col",children:[J.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-white/10",children:[J.jsx("span",{className:"text-white text-sm font-medium truncate",children:u}),J.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:J.jsx(Om,{className:"size-5"})})]}),J.jsx("div",{className:"flex gap-1 px-4 py-3 border-b border-white/10 flex-wrap",children:n.map(f=>J.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))}),J.jsx("div",{className:"flex-1 overflow-y-auto slim-scrollbar",children:l?.episodes.map(f=>{const m=f.id===s,_=r?.[f.id],w=_?.duration?Math.min(_.currentTime/_.duration*100,100):0,x=_?.duration?_.currentTime>=_.duration*.9:!1;return J.jsxs("button",{className:`w-full text-left px-4 py-3 border-l-2 transition-colors ${m?"bg-white/10 border-red-600":"border-transparent hover:bg-white/5"}`,onClick:()=>{t(f),e()},children:[J.jsxs("div",{className:"text-white/60 text-xs mb-1",children:["E",f.episodeNumber,f.runtime!=null&&` · ${f.runtime}m`,x&&J.jsx("span",{className:"ml-2 text-white/30",children:"Watched"})]}),J.jsx("div",{className:`text-sm leading-snug ${x?"text-white/40":"text-white"}`,children:f.title}),w>0&&!x&&J.jsx("div",{className:"mt-1.5 h-0.5 w-full rounded-full bg-white/10",children:J.jsx("div",{className:"h-full rounded-full bg-red-600",style:{width:`${w}%`}})})]},f.id)})})]})}const $2=9,V2=1e3;function H2({nextEpisode:s,show:e,onPlayNow:t,onCancel:i,countdownSeconds:r=$2,isCountingDown:n}){const a=ue.useRef(null),u=ue.useRef(!1),l=ue.useRef(t);ue.useEffect(()=>{l.current=t},[t]),ue.useEffect(()=>{if(!n){u.current=!1;return}const _=a.current;if(!_)return;const w=_.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+V2);return()=>{w.cancel(),clearTimeout(x)}},[n,r]);const f=ue.useMemo(()=>`S${s.seasonNumber} E${s.episodeNumber} · ${s.title}`,[s]),m=()=>{u.current||(u.current=!0,t())};return J.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:[J.jsxs("div",{className:"flex gap-3",children:[J.jsx("div",{className:"w-20 flex-shrink-0 overflow-hidden rounded",children:J.jsx(Rm,{alt:e.title,url:e.posterUrl,title:e.title})}),J.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[J.jsx("span",{className:"text-xs uppercase tracking-wide text-white/60",children:"Up next"}),J.jsx("h3",{className:"mt-1 truncate text-sm font-semibold text-white",children:e.title}),J.jsx("p",{className:"mt-0.5 truncate text-xs text-white/70",children:f})]})]}),J.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[J.jsxs(eo,{className:"flex-1 relative overflow-hidden bg-white/15 text-white hover:bg-white/25",onClick:m,size:"sm",children:[J.jsx("span",{"aria-hidden":"true",className:"absolute inset-y-0 left-0 w-full origin-left bg-white",ref:a,style:{transform:"scaleX(0)"}}),J.jsx("span",{className:"relative mix-blend-difference",children:"Next episode"})]}),J.jsx(eo,{className:"flex-1",onClick:i,size:"sm",variant:"outline",children:"Cancel"})]})]})}function z2({muted:s,visible:e,volume:t}){const i=()=>s||t===0?J.jsx($c,{className:"size-6 text-white"}):t<.33?J.jsx(Vc,{className:"size-6 text-white"}):t<.66?J.jsx(jc,{className:"size-6 text-white"}):J.jsx(qc,{className:"size-6 text-white"}),r=s?0:t*100;return J.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:J.jsxs("div",{className:"bg-black/70 rounded-full px-4 py-2 flex items-center gap-3 text-white",children:[i(),J.jsx("div",{className:"relative w-32 h-1.5 bg-white/25 rounded-full overflow-hidden",children:J.jsx("div",{className:"absolute top-0 left-0 bottom-0 bg-white rounded-full transition-[width] duration-150",style:{width:`${r}%`}})})]})})}function G2(s){return ue.useSyncExternalStore(e=>{const t=window.matchMedia(s);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia(s).matches,()=>!1)}async function W2(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 X2(s,e,t={}){const i=(t.enabled??!0)&&!!s&&!!e;return rs({queryKey:["next-episode",s,e],queryFn:()=>W2(s??0,e??0),enabled:i,retry:!1})}const K2=.9;async function Y2(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 Q2(s){return await(await fetch(`/api/progress/${s}`)).json()}async function J2(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 Z2(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 eb(s){return await(await fetch(`/api/progress/episode/${s}`)).json()}async function tb(s){const e=await fetch(`/api/progress/episode/show/${s}`);return e.ok?await e.json():{}}const ib=3e3,sb=45;function ob(){const{id:s}=Nm(),e=Mm(),t=Bm(),i=e.pathname.startsWith("/watch/episode/"),[r,n]=ue.useState(!0),[a,u]=ue.useState(!1),[l,f]=ue.useState(null),[m,_]=ue.useState(!1),w=G2("(max-width: 639px)"),[x,P]=ue.useState(1),[T,I]=ue.useState(!1),[M,N]=ue.useState(!1),[O,F]=ue.useState(!1),[j,U]=ue.useState(!1),[R,G]=ue.useState(null),v=ue.useRef(!1),E=ue.useRef(null),V=ue.useRef(null),H=ue.useRef(null),q=ue.useCallback(()=>{document.fullscreenElement?document.exitFullscreen():H.current?.requestFullscreen()},[]),K=ue.useCallback(()=>{n(!0),E.current&&clearTimeout(E.current),a&&(E.current=setTimeout(()=>{n(!1)},ib))},[a]),te=ue.useCallback((xe,Ee)=>{G({volume:xe,muted:Ee}),V.current&&clearTimeout(V.current),V.current=setTimeout(()=>{G(null)},1200)},[]);ue.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>u(!0),Ee=()=>u(!1);return l.on("play",xe),l.on("pause",Ee),u(!l.paused()),()=>{l.isDisposed()||(l.off("play",xe),l.off("pause",Ee))}},[l]),ue.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>{l.isDisposed()||te(l.volume()??1,l.muted()??!1)};return l.on("volumechange",xe),()=>{l.isDisposed()||l.off("volumechange",xe)}},[l,te]),ue.useEffect(()=>()=>{V.current&&clearTimeout(V.current)},[]),ue.useEffect(()=>(a?K():(n(!0),E.current&&clearTimeout(E.current)),()=>{E.current&&clearTimeout(E.current)}),[a,K]),Zi("*",()=>K()),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,Ee=l.duration()??0;l.currentTime(Math.min(Ee,xe+10))},[l]),Zi("up",xe=>{if(xe.preventDefault(),!l||l.isDisposed())return;const Ee=l.volume()??1,We=Math.min(1,Ee+.05);l.muted()&&l.muted(!1),l.volume(We)},[l]),Zi("down",xe=>{if(xe.preventDefault(),!l||l.isDisposed())return;const Ee=l.volume()??1,We=Math.max(0,Ee-.05);l.volume(We)},[l]);const{data:ie,isLoading:W,error:Z}=rs({queryKey:["movie",s],queryFn:()=>Y2(s??""),enabled:!!s&&!i,placeholderData:rl}),{data:ee,isLoading:re,error:se}=rs({queryKey:["episode",s],queryFn:()=>J2(s??""),enabled:!!s&&i,placeholderData:rl}),ce=ee?.episode,de=ee?.show,{data:_e}=rs({queryKey:["show-for-episode",de?.id],queryFn:()=>Z2(de?.id??0),enabled:!!de}),{data:pe}=rs({queryKey:["show-progress",de?.id],queryFn:()=>tb(de?.id??0),enabled:!!de}),{data:$e}=rs({queryKey:["progress",i?"episode":"movie",i?ce?.id:ie?.id],queryFn:()=>i?eb(ce?.id??0):Q2(ie?.id??0),enabled:i?!!ce:!!ie});ue.useEffect(()=>{ce&&P(ce.seasonNumber)},[ce]),ue.useEffect(()=>{if(!l||!$e||$e.currentTime<=0||v.current)return;v.current=!0;const{currentTime:xe,duration:Ee}=$e;Ee!==null&&Ee>0&&xe/Ee>=K2||l.currentTime(xe)},[l,$e]);const{data:Je}=X2(de?.id,ce?.id,{enabled:i}),Ce=Je?.episode??null,Ze=Je?.show??null;ue.useEffect(()=>{I(!1),N(!1),F(!1),v.current=!1},[ce?.id]),ue.useEffect(()=>{if(!l||l.isDisposed())return;const xe=()=>U(!1);return l.on("playing",xe),()=>{l.isDisposed()||l.off("playing",xe)}},[l]);const ct=ue.useCallback(()=>{Ce&&(U(!0),t(`/watch/episode/${Ce.id}`))},[Ce,t]);ue.useEffect(()=>{if(!l||l.isDisposed()||!i)return;const xe=()=>{const We=l.currentTime()??0,Te=l.duration()??0;if(Te<=0)return;Te-We<=sb&&!T&&Ce&&(N(!0),F(!0))},Ee=()=>{if(!Ce){pn("You've finished all episodes."),de&&t(`/shows/${de.id}`);return}T||(N(!0),F(!0))};return l.on("timeupdate",xe),l.on("ended",Ee),()=>{l.isDisposed()||(l.off("timeupdate",xe),l.off("ended",Ee))}},[l,i,Ce,T,de,t]);const Ye=ue.useCallback(xe=>{if(xe.id!==ce?.id){if(l&&ce){const Ee=l.currentTime()??0,We=l.duration()??0;fetch(`/api/progress/episode/${ce.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:Ee,duration:We})})}U(!0),t(`/watch/episode/${xe.id}`)}},[l,ce,t]),rt=i?re:W,$t=i?se:Z;if(rt)return J.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:J.jsx(Fm,{className:"h-8 w-8 animate-spin text-white"})});if($t||(i?!ce:!ie))return J.jsxs("div",{className:"min-h-screen bg-black flex flex-col items-center justify-center gap-4",children:[J.jsx("p",{className:"text-white",children:i?"Episode not found":"Movie not found"}),J.jsx(eo,{asChild:!0,variant:"outline",children:J.jsx(sl,{to:"/",children:"Back to Library"})})]});const Ge=i?`/api/stream/episode/${ce?.id}`:`/api/stream/${ie?.id}`,Vt=i&&ce&&de?`${de.title} — S${ce.seasonNumber} E${ce.episodeNumber} · ${ce.title}`:ie?.title??"",Ve=i?ee?.subtitles??[]:ie?.subtitles??[];return J.jsxs("div",{ref:H,className:`bg-black w-full h-screen relative ${r?"":"cursor-none"}`,onMouseMove:K,children:[J.jsx("div",{className:"absolute inset-0",children:J.jsx(P2,{src:Ge,subtitles:Ve,onReady:f})}),J.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"}`}),J.jsx(z2,{muted:R?.muted??!1,visible:R!==null,volume:R?.volume??0}),i&&M&&Ce&&J.jsx("video",{"aria-hidden":"true",className:"hidden",preload:"auto",src:`/api/stream/episode/${Ce.id}`}),i&&M&&Ce&&Ze&&J.jsx(H2,{isCountingDown:O,nextEpisode:Ce,onCancel:()=>{I(!0),N(!1),F(!1)},onPlayNow:ct,show:Ze}),i&&_e&&ce&&J.jsxs(J.Fragment,{children:[J.jsx("div",{className:`hidden sm:block absolute top-0 right-0 bottom-0 w-96 z-20 ${m?"":"pointer-events-none opacity-0"} transition-opacity duration-200`,children:m&&J.jsx(Fc,{currentEpisodeId:ce.id,onClose:()=>_(!1),onSelectEpisode:Ye,onSelectSeason:P,progressMap:pe,seasons:_e.seasons,selectedSeason:x,showTitle:_e.title})}),w&&J.jsx(Um,{onOpenChange:_,open:m,children:J.jsxs(jm,{className:"h-[85vh] p-0 bg-black/95 border-white/10",hideCloseButton:!0,side:"bottom",children:[J.jsxs(qm,{className:"sr-only",children:[_e.title," episodes"]}),J.jsx(Fc,{currentEpisodeId:ce.id,onClose:()=>_(!1),onSelectEpisode:Ye,onSelectSeason:P,progressMap:pe,seasons:_e.seasons,selectedSeason:x,showTitle:_e.title})]})})]}),J.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:J.jsx($m,{className:"size-7"})}),J.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:J.jsx(j2,{title:Vt,player:l,movieId:i?void 0:ie?.id,episodeId:i?ce?.id:void 0,showEpisodesButton:i,streamUrl:Ge,subtitles:Ve,onFullscreen:q,onNextEpisode:i&&Ce?ct:void 0,onToggleEpisodes:()=>_(xe=>!xe)})})]})}export{ob as WatchPage};
|