jukebox-media-server 0.6.0 → 0.7.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.
Files changed (31) hide show
  1. package/dist/client/assets/{Watch-Ja4PAA8Y.js → Watch-BiR2iXrC.js} +33 -33
  2. package/dist/client/assets/index-CKZbQJYY.css +1 -0
  3. package/dist/client/assets/index-CoxOmmZz.js +87 -0
  4. package/dist/client/index.html +2 -2
  5. package/dist/client/sw.js +1 -1
  6. package/dist/server/HttpApiBuilder-DWwOvarr.js +42786 -0
  7. package/dist/server/{better-sqlite3-6WoM5xG0.js → better-sqlite3-CkwhTVXW.js} +3 -3
  8. package/dist/server/bun-database-CqinoQgb.js +14 -0
  9. package/dist/server/bun-database-oVoIc-C8.js +15 -0
  10. package/dist/server/{bun-sqlite-BBdvu820.js → bun-sqlite-Bk_yjDLi.js} +2 -2
  11. package/dist/server/chunk-CrysgU_F.js +36 -0
  12. package/dist/server/config-CCAveLuN.js +12 -0
  13. package/dist/server/esm-Dm4Gq4cv.js +40975 -0
  14. package/dist/server/index.js +3889 -5608
  15. package/dist/server/{indexes-VMR6QVVl.js → indexes-vPbUiKXP.js} +4 -100
  16. package/dist/server/{session-DfEK0QWr.js → logger-ygdFSBOU.js} +250 -249
  17. package/dist/server/{migrator-C_0LpHsF.js → migrator-CpDrzLY4.js} +1 -1
  18. package/dist/server/{migrator-CXTJWgtg.js → migrator-D9F-ETAB.js} +1 -1
  19. package/dist/server/schema-1sWMC8cP.js +59 -0
  20. package/dist/server/schema-B7-kIAVY.js +145 -0
  21. package/dist/server/select-62doObBa.js +101 -0
  22. package/drizzle/0011_loose_eternity.sql +1 -0
  23. package/drizzle/meta/0011_snapshot.json +1066 -0
  24. package/drizzle/meta/_journal.json +8 -1
  25. package/drizzle-telemetry/0000_great_thor.sql +45 -0
  26. package/drizzle-telemetry/meta/0000_snapshot.json +320 -0
  27. package/drizzle-telemetry/meta/_journal.json +13 -0
  28. package/package.json +22 -8
  29. package/dist/client/assets/index-AENKhh_8.css +0 -1
  30. package/dist/client/assets/index-Cm9WIhoR.js +0 -58
  31. /package/dist/server/{migrator-CAdL3H58.js → migrator-8uumkKvi.js} +0 -0
@@ -1,20 +1,20 @@
1
- import{c as Rt,r as oe,a as fn,g as vr,b as Am,j as J,t as pn,P as Dm,R as km,T as Im,d as Pm,C as Lm,I as Uc,e as Om,f as jc,X as Rm,h as Nm,B as eo,u as rs,i as Mm,k as Bm,l as Fm,L as Um,m as sl,S as jm,n as qm,o as $m,A as Vm,p as rl}from"./index-Cm9WIhoR.js";const Hm=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],zm=Rt("captions",Hm);const Gm=[["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"}]],Wm=Rt("cast",Gm);const Xm=[["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"}]],Km=Rt("list",Xm);const Ym=[["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"}]],Qm=Rt("maximize",Ym);const Jm=[["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"}]],Zm=Rt("pause",Jm);const eg=[["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"}]],tg=Rt("rotate-ccw",eg);const ig=[["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"}]],sg=Rt("rotate-cw",ig);const rg=[["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"}]],ng=Rt("skip-forward",rg);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"}]],qc=Rt("volume-1",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"}],["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"}]],$c=Rt("volume-2",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"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],Vc=Rt("volume-x",ug);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"}]],Hc=Rt("volume",lg),zc=["shift","alt","meta","mod","ctrl","control"],cg={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 wi(s){return(cg[s.trim()]||s.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function Gc(s){return zc.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=>wi(m))):a=s.toLocaleLowerCase().split(e).map(m=>wi(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=>!zc.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&&Wc([wi(s.code)])}),document.addEventListener("keyup",s=>{s.code!==void 0&&Xc([wi(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 dg(s,e=","){return(ko(s)?s:s.split(e)).every(t=>li.has(t.trim().toLowerCase()))}function Wc(s){const e=Array.isArray(s)?s:[s];li.has("meta")&&li.forEach(t=>{Gc(t)||li.delete(t.toLowerCase())}),e.forEach(t=>{li.add(t.toLowerCase())})}function Xc(s){const e=Array.isArray(s)?s:[s];s==="meta"?li.clear():e.forEach(t=>{li.delete(t.toLowerCase())})}function hg(s,e,t){(typeof t=="function"&&t(s,e)||t===!0)&&s.preventDefault()}function fg(s,e,t){return typeof t=="function"?t(s,e):t===!0||t===void 0}const pg=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function mg(s){return Kc(s,pg)}function Kc(s,e=!1){const{target:t,composed:i}=s;let r,n;return gg(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 gg(s){return!!s.tagName&&!s.tagName.startsWith("-")&&s.tagName.includes("-")}function _g(s,e){return s.length===0&&e?!1:e?s.some(t=>e.includes(t))||s.includes("*"):!0}const yg=(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=wi(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)?dg(l):!1:!l||l.length===0},Tg=oe.createContext(void 0),vg=()=>oe.useContext(Tg);function Yc(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&&Yc(s[i],e[i]),!0):s===e}const bg=oe.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),xg=()=>oe.useContext(bg);function Sg(s){const e=oe.useRef(void 0);return Yc(e.current,s)||(e.current=s),e.current}const nl=s=>{s.stopPropagation(),s.preventDefault(),s.stopImmediatePropagation()},Eg=typeof window<"u"?oe.useLayoutEffect:oe.useEffect;function Zi(s,e,t,i){const r=oe.useRef(null),n=oe.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=oe.useCallback(e,l??[]),m=oe.useRef(f);l?m.current=f:m.current=e;const _=Sg(a),{activeScopes:w}=xg(),x=vg();return Eg(()=>{if(_?.enabled===!1||!_g(w,_?.scopes))return;let P=[],T;const I=(F,q=!1)=>{if(!(mg(F)&&!Kc(F,_?.enableOnFormTags))){if(r.current!==null){const j=r.current.getRootNode();if((j instanceof Document||j instanceof ShadowRoot)&&j.activeElement!==r.current&&!r.current.contains(j.activeElement)){nl(F);return}}F.target?.isContentEditable&&!_?.enableOnContentEditable||ya(u,_?.delimiter).forEach(j=>{if(j.includes(_?.splitKey??"+")&&j.includes(_?.sequenceSplitKey??">")){console.warn(`Hotkey ${j} contains both ${_?.splitKey??"+"} and ${_?.sequenceSplitKey??">"} which is not supported.`);return}const R=Ta(j,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata);if(R.isSequence){T=setTimeout(()=>{P=[]},_?.sequenceTimeoutMs??1e3);const G=R.useKey?F.key:wi(F.code);if(Gc(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(yg(F,R,_?.ignoreModifiers)||R.keys?.includes("*")){if(_?.ignoreEventWhen?.(F)||q&&n.current)return;if(hg(F,R,_?.preventDefault),!fg(F,R,_?.enabled)){nl(F);return}m.current(F,R),q||(n.current=!0)}})}},M=F=>{F.code!==void 0&&(Wc(wi(F.code)),(_?.keydown===void 0&&_?.keyup!==!0||_?.keydown)&&I(F))},N=F=>{F.code!==void 0&&(Xc(wi(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 Cg=Nn();const D=vr(Cg),wg={},Ag=Object.freeze(Object.defineProperty({__proto__:null,default:wg},Symbol.toStringTag,{value:"Module"})),Dg=Am(Ag);var ba,ol;function Qc(){if(ol)return ba;ol=1;var s=typeof fn<"u"?fn:typeof window<"u"?window:{},e=Dg,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 kg=Qc();const ne=vr(kg);var tn={exports:{}},xa={exports:{}},ul;function Ig(){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 Pg(){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 Lg(){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 Og(){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 Rg(){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 Ng(){if(fl)return tn.exports;fl=1;var s=Nn(),e=Ig(),t=Pg(),i=Lg(),r=Og();f.httpHandler=Rg(),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,te,ie){I||(I=!0,x.callback(Z,te,ie))};function N(){j.readyState===4&&!f.responseInterceptorsStorage.getIsEnabled()&&setTimeout(q,0)}function O(){var W=void 0;if(j.response?W=j.response:W=j.responseText||_(j),K)try{W=JSON.parse(W)}catch{}return W}function F(W){if(clearTimeout(ee),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=j,m(x)},x.retry.getCurrentFuzzedDelay());return}if(x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var Z={headers:se.headers||{},body:se.body,responseUrl:j.responseURL,responseType:j.responseType},te=f.responseInterceptorsStorage.execute(x.requestType,Z);se.body=te.body,se.headers=te.headers}return M(W,se)}function q(){if(!G){var W;clearTimeout(ee),clearTimeout(x.retryTimeout),x.useXDR&&j.status===void 0?W=200:W=j.status===1223?204:j.status;var Z=se,te=null;if(W!==0?(Z={body:O(),statusCode:W,method:E,headers:{},url:v,rawRequest:j},j.getAllResponseHeaders&&(Z.headers=n(j.getAllResponseHeaders()))):te=new Error("Internal XMLHttpRequest Error"),x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var ie={headers:Z.headers||{},body:Z.body,responseUrl:j.responseURL,responseType:j.responseType},re=f.responseInterceptorsStorage.execute(x.requestType,ie);Z.body=re.body,Z.headers=re.headers}return M(te,Z,Z.body)}}var j=x.xhr||null;j||(x.cors||x.useXDR?j=new f.XDomainRequest:j=new f.XMLHttpRequest);var R,G,v=j.url=x.uri||x.url,E=j.method=x.method||"GET",V=x.body||x.data,H=j.headers=x.headers||{},U=!!x.sync,K=!1,ee,se={body:void 0,headers:{},statusCode:0,method:E,url:v,rawRequest:j};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))),j.onreadystatechange=N,j.onload=q,j.onerror=F,j.onprogress=function(){},j.onabort=function(){G=!0,clearTimeout(x.retryTimeout)},j.ontimeout=F,j.open(E,v,!U,x.username,x.password),U||(j.withCredentials=!!x.withCredentials),!U&&x.timeout>0&&(ee=setTimeout(function(){if(!G){G=!0,j.abort("timeout");var W=new Error("XMLHttpRequest timeout");W.code="ETIMEDOUT",F(W)}},x.timeout)),j.setRequestHeader)for(R in H)H.hasOwnProperty(R)&&j.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&&(j.responseType=x.responseType),"beforeSend"in x&&typeof x.beforeSend=="function"&&x.beforeSend(j),j.send(V||null),j}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 Mg=Ng();const Jc=vr(Mg);var Aa={exports:{}},Da,pl;function Bg(){if(pl)return Da;pl=1;var s=Qc(),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,U,K,ee){return(H|0)*3600+(U|0)*60+(K|0)+(ee|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 U=H?v.split(H):[v];for(var K in U)if(typeof U[K]=="string"){var ee=U[K].split(V);if(ee.length===2){var se=ee[0].trim(),W=ee[1].trim();E(se,W)}}}function a(v,E,V){var H=v;function U(){var se=i(v);if(se===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+H);return v=v.replace(/^[^\sa-zA-Z-]+/,""),se}function K(se,W){var Z=new r;n(se,function(te,ie){switch(te){case"region":for(var re=V.length-1;re>=0;re--)if(V[re].id===ie){Z.set(te,V[re].region);break}break;case"vertical":Z.alt(te,ie,["rl","lr"]);break;case"line":var ge=ie.split(","),ye=ge[0];Z.integer(te,ye),Z.percent(te,ye)&&Z.set("snapToLines",!1),Z.alt(te,ye,["auto"]),ge.length===2&&Z.alt("lineAlign",ge[1],["start","center","end"]);break;case"position":ge=ie.split(","),Z.percent(te,ge[0]),ge.length===2&&Z.alt("positionAlign",ge[1],["start","center","end"]);break;case"size":Z.percent(te,ie);break;case"align":Z.alt(te,ie,["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 ee(){v=v.replace(/^\s+/,"")}if(ee(),E.startTime=U(),ee(),v.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+H);v=v.substr(3),ee(),E.endTime=U(),ee(),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 ye(fe){return E=E.substr(fe.length),fe}var ve=E.match(/^([^<]*)(<[^>]*>?)?/);return ye(ve[1]?ve[1]:ve[2])}function H(ye){return u.innerHTML=ye,ye=u.textContent,u.textContent="",ye}function U(ye,ve){return!_[ve.localName]||_[ve.localName]===ye.localName}function K(ye,ve){var fe=l[ye];if(!fe)return null;var Se=v.document.createElement(fe),ke=m[ye];return ke&&ve&&(Se[ke]=ve.trim()),Se}for(var ee=v.document.createElement("div"),se=ee,W,Z=[];(W=V())!==null;){if(W[0]==="<"){if(W[1]==="/"){Z.length&&Z[Z.length-1]===W.substr(2).replace(">","")&&(Z.pop(),se=se.parentNode);continue}var te=i(W.substr(1,W.length-2)),ie;if(te){ie=v.document.createProcessingInstruction("timestamp",te),se.appendChild(ie);continue}var re=W.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!re||(ie=K(re[1],re[3]),!ie)||!U(se,ie))continue;if(re[2]){var ge=re[2].split(".");ge.forEach(function(ye){var ve=/^bg_/.test(ye),fe=ve?ye.slice(3):ye;if(f.hasOwnProperty(fe)){var Se=ve?"background-color":"color",ke=f[fe];ie.style[Se]=ke}}),ie.className=ge.join(" ")}Z.push(re[1]),se.appendChild(ie),se=ie;continue}se.appendChild(v.document.createTextNode(H(W)))}return ee}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 U(se,W){for(var Z=W.childNodes.length-1;Z>=0;Z--)se.push(W.childNodes[Z])}function K(se){if(!se||!se.length)return null;var W=se.pop(),Z=W.textContent||W.innerText;if(Z){var te=Z.match(/^.*(\n|\r)/);return te?(se.length=0,te[0]):Z}if(W.tagName==="ruby")return K(se);if(W.childNodes)return U(se,W),K(se)}for(U(E,v);V=K(E);)for(var ee=0;ee<V.length;ee++)if(H=V.charCodeAt(ee),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,U=0;U<V.length&&V[U]!==E;U++)V[U].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 U=0;switch(E.positionAlign){case"start":case"line-left":U=E.position;break;case"center":U=E.position-E.size/2;break;case"end":case"line-right":U=E.position-E.size;break}E.vertical===""?this.applyStyles({left:this.formatStyle(U,"%"),width:this.formatStyle(E.size,"%")}):this.applyStyles({top:this.formatStyle(U,"%"),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,U;if(v.div){V=v.div.offsetHeight,H=v.div.offsetWidth,U=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||U,this.height=v.height||V,this.bottom=v.bottom||U+(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 U={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 U};function F(v,E,V,H){function U(fe,Se){for(var ke,Le=new O(fe),Qe=1,st=0;st<Se.length;st++){for(;fe.overlapsOppositeAxis(V,Se[st])||fe.within(V)&&fe.overlapsAny(H);)fe.move(Se[st]);if(fe.within(V))return fe;var Ke=fe.intersectPercentage(V);Qe>Ke&&(ke=new O(fe),Qe=Ke),fe=new O(Le)}return ke||Le}var K=new O(E),ee=E.cue,se=I(ee),W=[];if(ee.snapToLines){var Z;switch(ee.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 te=K.lineHeight,ie=te*Math.round(se),re=V[Z]+te,ge=W[0];Math.abs(ie)>re&&(ie=ie<0?-1:1,ie*=Math.ceil(re/te)*te),se<0&&(ie+=ee.vertical===""?V.height:V.width,W=W.reverse()),K.move(ge,ie)}else{var ye=K.lineHeight/V.height*100;switch(ee.lineAlign){case"center":se-=ye/2;break;case"end":se-=ye;break}switch(ee.vertical){case"":E.applyStyles({top:E.formatStyle(se,"%")});break;case"rl":E.applyStyles({left:E.formatStyle(se,"%")});break;case"lr":E.applyStyles({right:E.formatStyle(se,"%")});break}W=["+y","-x","+x","-y"],K=new O(E)}var ve=U(K,W);E.move(ve.toCSSCompatValues(V))}function q(){}q.StringDecoder=function(){return{decode:function(v){if(!v)return"";if(typeof v!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(v))}}},q.convertCueToDOMTree=function(v,E){return!v||!E?null:w(v,E)};var j=.05,R="sans-serif",G="1.5%";return q.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 U(te){for(var ie=0;ie<te.length;ie++)if(te[ie].hasBeenReset||!te[ie].displayState)return!0;return!1}if(!U(E)){for(var K=0;K<E.length;K++)H.appendChild(E[K].displayState);return}var ee=[],se=O.getSimpleBoxPosition(H),W=Math.round(se.height*j*100)/100,Z={font:W+"px "+R};(function(){for(var te,ie,re=0;re<E.length;re++)ie=E[re],te=new N(v,ie,Z),H.appendChild(te.div),F(v,te,se,ee),ie.displayState=te.div,ee.push(O.getSimpleBoxPosition(te))})()},q.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=[]},q.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 te=E.buffer,ie=0;ie<te.length&&te[ie]!=="\r"&&te[ie]!==`
4
- `;)++ie;var re=te.substr(0,ie);return te[ie]==="\r"&&++ie,te[ie]===`
5
- `&&++ie,E.buffer=te.substr(ie),re}function H(te){var ie=new r;if(n(te,function(ge,ye){switch(ge){case"id":ie.set(ge,ye);break;case"width":ie.percent(ge,ye);break;case"lines":ie.integer(ge,ye);break;case"regionanchor":case"viewportanchor":var ve=ye.split(",");if(ve.length!==2)break;var fe=new r;if(fe.percent("x",ve[0]),fe.percent("y",ve[1]),!fe.has("x")||!fe.has("y"))break;ie.set(ge+"X",fe.get("x")),ie.set(ge+"Y",fe.get("y"));break;case"scroll":ie.alt(ge,ye,["up"]);break}},/=/,/\s/),ie.has("id")){var re=new(E.vttjs.VTTRegion||E.window.VTTRegion);re.width=ie.get("width",100),re.lines=ie.get("lines",3),re.regionAnchorX=ie.get("regionanchorX",0),re.regionAnchorY=ie.get("regionanchorY",100),re.viewportAnchorX=ie.get("viewportanchorX",0),re.viewportAnchorY=ie.get("viewportanchorY",100),re.scroll=ie.get("scroll",""),E.onregion&&E.onregion(re),E.regionList.push({id:ie.get("id"),region:re})}}function U(te){var ie=new r;n(te,function(re,ge){switch(re){case"MPEGT":ie.integer(re+"S",ge);break;case"LOCA":ie.set(re+"L",i(ge));break}},/[^\d]:/,/,/),E.ontimestampmap&&E.ontimestampmap({MPEGTS:ie.get("MPEGTS"),LOCAL:ie.get("LOCAL")})}function K(te){te.match(/X-TIMESTAMP-MAP/)?n(te,function(ie,re){ie==="X-TIMESTAMP-MAP"&&U(re)},/=/):n(te,function(ie,re){ie==="Region"&&H(re)},/:/)}try{var ee;if(E.state==="INITIAL"){if(!/\r\n|\n/.test(E.buffer))return this;ee=V();var se=ee.match(/^WEBVTT([ \t].*)?$/);if(!se||!se[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:ee=V(),E.state){case"HEADER":/:/.test(ee)?K(ee):ee||(E.state="ID");continue;case"NOTE":ee||(E.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(ee)){E.state="NOTE";break}if(!ee)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",ee.indexOf("-->")===-1){E.cue.id=ee;continue}case"CUE":try{a(ee,E.cue,E.regionList)}catch(te){E.reportOrThrowError(te),E.cue=null,E.state="BADCUE";continue}E.state="CUETEXT";continue;case"CUETEXT":var Z=ee.indexOf("-->")!==-1;if(!ee||Z&&(W=!0)){E.oncue&&E.oncue(E.cue),E.cue=null,E.state="ID";continue}E.cue.text&&(E.cue.text+=`
6
- `),E.cue.text+=ee.replace(/\u2028/g,`
1
+ import{c as Lt,r as ue,j as Q,P as Mm,B as eo,u as Bm,a as Fm,b as ri,i as Um,t as fn,d as jm,R as qm,T as $m,e as Vm,C as Hm,I as Gc,f as zm,g as Wc,h as pn,k as br,l as Gm,X as Wm,S as Xm,m as Km,n as Ym,o as Xc,p as ns,A as Qm,q as nl,s as Jm,v as Zm,L as Kc,w as eg,x as tg}from"./index-CoxOmmZz.js";const ig=[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],sg=Lt("captions",ig);const rg=[["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"}]],ng=Lt("cast",rg);const ag=[["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"}]],og=Lt("list",ag);const ug=[["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"}]],lg=Lt("maximize",ug);const cg=[["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"}]],dg=Lt("pause",cg);const hg=[["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"}]],fg=Lt("rotate-ccw",hg);const pg=[["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"}]],mg=Lt("rotate-cw",pg);const gg=[["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"}]],_g=Lt("skip-forward",gg);const yg=[["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"}]],Yc=Lt("volume-1",yg);const Tg=[["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=Lt("volume-2",Tg);const vg=[["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"}]],Jc=Lt("volume-x",vg);const bg=[["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=Lt("volume",bg),xg=9,Sg=1e3;function Eg({nextEpisode:s,show:e,onPlayNow:t,onCancel:i,countdownSeconds:r=xg,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+Sg);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("dialog",{"aria-label":"Up next","aria-live":"polite",className:"absolute bottom-24 right-6 left-auto top-auto z-40 m-0 w-80 max-w-[calc(100vw-3rem)] rounded-lg border-0 bg-black/85 p-4 text-white shadow-2xl ring-1 ring-white/10 backdrop-blur",open:!0,children:[Q.jsxs("div",{className:"flex gap-3",children:[Q.jsx("div",{className:"w-20 flex-shrink-0 overflow-hidden rounded",children:Q.jsx(Mm,{alt:e.title,url:e.posterUrl,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(eo,{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(eo,{className:"flex-1",onClick:i,size:"sm",variant:"outline",children:"Cancel"})]})]})}function Cg(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 wg={buffered:0,isPlaying:!1,progress:0,remainingTime:0};function Ag(s,e){switch(e.type){case"buffered-changed":return{...s,buffered:e.buffered};case"playing-changed":return{...s,isPlaying:e.isPlaying};case"time-updated":return{...s,progress:e.progress,remainingTime:e.remainingTime}}}function Dg(s){const[e,t]=ue.useReducer(Ag,wg);return ue.useEffect(()=>{if(!s||s.isDisposed())return;const i=()=>t({type:"playing-changed",isPlaying:!0}),r=()=>t({type:"playing-changed",isPlaying:!1}),n=()=>{const u=s.currentTime()??0,l=s.duration()??0;l>0&&t({type:"time-updated",progress:u/l,remainingTime:l-u})},a=()=>{const u=s.buffered(),l=s.duration()??0;if(u&&u.length>0&&l>0){const f=u.end(u.length-1);t({type:"buffered-changed",buffered:f/l})}};return s.on("play",i),s.on("pause",r),s.on("timeupdate",n),s.on("progress",a),t({type:"playing-changed",isPlaying:!s.paused()}),()=>{s.isDisposed()||(s.off("play",i),s.off("pause",r),s.off("timeupdate",n),s.off("progress",a))}},[s]),e}const kg=1e4,Ig=/^\/api\/progress\/episode\/(\d+)$/,Pg=/^\/api\/progress\/(\d+)$/;async function Lg({currentTime:s,duration:e,progressUrl:t}){const i={currentTime:s,duration:e},r=Ig.exec(t);if(r){await ri(a=>a.episodeProgress.saveEpisodeProgress({path:{episodeId:Number(r[1])},payload:i}));return}const n=Pg.exec(t);Um(n),await ri(a=>a.progress.saveMovieProgress({path:{movieId:Number(n[1])},payload:i}))}function Io(){const s=Bm();return Fm({mutationFn:Lg,onSuccess:()=>{s.invalidateQueries({queryKey:["progress"]}),s.invalidateQueries({queryKey:["show-progress"]}),s.invalidateQueries({queryKey:["continue-watching"]})}})}function Og(s,{episodeId:e,movieId:t}){const{mutate:i}=Io(),r=ue.useRef(0),n=ue.useEffectEvent(()=>{if(!s||s.isDisposed())return;const a=s.currentTime()??0,u=s.duration()??0;if(a===r.current)return;r.current=a;const l=e?`/api/progress/episode/${e}`:`/api/progress/${t}`;i({currentTime:a,duration:u,progressUrl:l})});ue.useEffect(()=>{if(!s)return;const a=setInterval(n,kg);return()=>{clearInterval(a),n()}},[s])}const to="off";function Rg(s,e){const[t,i]=ue.useState(null),r=t&&t.forSubtitles===e?t.id:to;return ue.useEffect(()=>{if(!s||s.isDisposed())return;const a=s.remoteTextTrackEls();if(!a||a.length===0)return;const u=()=>{fn.error("Subtitle failed to load. Pick another track."),i(null)},l=[];for(let f=0;f<a.length;f++){const m=a[f];m&&(m.addEventListener("error",u),l.push(m))}return()=>{for(const f of l)f.removeEventListener("error",u)}},[s,e]),{activeSubtitleId:r,selectSubtitle:a=>{if(i({forSubtitles:e,id:a}),!s||s.isDisposed())return;const u=s.textTracks();if(!u)return;const l=(e??[]).find(f=>f.isSupported&&String(f.id)===a);for(let f=0;f<u.length;f++){const m=u[f];!m||m.kind!=="subtitles"||(l&&m.language===l.language?m.mode="showing":m.mode="disabled")}}}}const ar=()=>window;function Ng(s){return/^https?:\/\//i.test(s)?s:`${window.location.origin}${s}`}function Mg(){return typeof HTMLVideoElement>"u"?!1:"webkitShowPlaybackTargetPicker"in HTMLVideoElement.prototype}const al=Mg();function Bg(){try{const s=ar(),e=s.cast?.framework;return!e||!s.chrome?.cast?!1:new e.RemotePlayer().isConnected}catch{return!1}}function Fg(){const s=document.querySelector("video");s?.webkitShowPlaybackTargetPicker&&s.webkitShowPlaybackTargetPicker()}function Ug({episodeId:s,movieId:e,player:t,streamUrl:i,title:r}){const[n,a]=ue.useState(()=>{const B=ar();return!!(B.cast?.framework&&B.chrome?.cast)}),u=ue.useRef(null),l=ue.useRef(null),f=ue.useRef(null),{mutate:m}=Io(),_=()=>f.current??=new Set,w=ue.useCallback(B=>(_().add(B),()=>{_().delete(B)}),[]),x=ue.useCallback(()=>u.current?.isConnected??Bg(),[]),I=ue.useSyncExternalStore(w,x,()=>!1),y=()=>{const B=f.current;if(B!==null)for(const U of B)U()},P=ue.useEffectEvent(B=>{y(),t&&!B.isConnected&&B.currentTime>0&&(t.currentTime(B.currentTime),t.play())}),N=ue.useEffectEvent(B=>{if(!B.isConnected)return;const U=s?`/api/progress/episode/${s}`:e?`/api/progress/${e}`:null;U&&m({currentTime:B.currentTime,duration:B.duration,progressUrl:U})});ue.useEffect(()=>{let B=!1,U=null;const j=()=>{if(B)return;const E=ar(),q=E.cast?.framework;if(!(!q||!E.chrome?.cast))try{const H=q.CastContext.getInstance(),z=u.current??new q.RemotePlayer,K=l.current??new q.RemotePlayerController(z);u.current=z,l.current=K;const te=()=>P(z),re=()=>N(z);K.addEventListener(q.RemotePlayerEventType.IS_CONNECTED_CHANGED,te),K.addEventListener(q.RemotePlayerEventType.CURRENT_TIME_CHANGED,re),U=()=>{K.removeEventListener(q.RemotePlayerEventType.IS_CONNECTED_CHANGED,te),K.removeEventListener(q.RemotePlayerEventType.CURRENT_TIME_CHANGED,re)}}catch(H){console.warn("Cast framework initialisation failed:",H)}},O=ar(),V=O.__onGCastApiAvailable,v=E=>{V?.(E),E&&(j(),a(!0))};return O.__onGCastApiAvailable=v,O.cast?.framework&&O.chrome?.cast&&j(),()=>{B=!0,U?.(),O.__onGCastApiAvailable===v&&(O.__onGCastApiAvailable=V)}},[]);const M=async()=>{const B=ar(),U=B.cast?.framework,j=B.chrome;if(!U||!j?.cast){fn.error("Cast isn't available. Make sure you're using Chrome with a Chromecast on the same network.");return}try{const O=U.CastContext.getInstance();await O.requestSession();const V=O.getCurrentSession();if(!V)return;const v=t?.currentTime()??0,E=Ng(i),q=new j.cast.media.MediaInfo(E,"video/mp4");q.metadata={title:r};const H=new j.cast.media.LoadRequest(q);H.currentTime=v,await V.loadMedia(H),t?.pause()}catch(O){console.warn("Cast session failed:",O),fn.error("Chromecast couldn't reach Jukebox. Make sure your device is on the same network.")}},L=()=>{if(n){M();return}al&&Fg()};return!al&&!n?null:Q.jsx("button",{"aria-label":I?"Stop casting":"Cast",className:"p-2 flex justify-center items-center cursor-pointer",onClick:L,type:"button",children:Q.jsx(ng,{className:`size-7 hover:scale-125 ${I?"text-blue-400":"text-white"}`})})}function jg({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 ed="jukebox-volume";function ol(){try{const s=localStorage.getItem(ed);if(s)return JSON.parse(s)}catch{}return{muted:!1,volume:1}}function qg(s,e){try{localStorage.setItem(ed,JSON.stringify({volume:s,muted:e}))}catch{}}function $g({player:s}){const[e,t]=ue.useState(ol),{muted:i,volume:r}=e;ue.useEffect(()=>{if(!s||s.isDisposed())return;const m=ol();s.volume(m.volume),s.muted(m.muted);const _=()=>{if(s.isDisposed())return;const w=s.volume()??1,x=s.muted()??!1;t({muted:x,volume:w}),qg(w,x)};return s.on("volumechange",_),()=>{s.isDisposed()||s.off("volumechange",_)}},[s]);const n=()=>{!s||s.isDisposed()||s.muted(!i)},a=m=>{if(!s||s.isDisposed())return;const _=Math.min(Math.max(m,0),1);s.volume(_),_>0&&i&&s.muted(!1)},u=m=>{a(Number(m.target.value)/100)},l=()=>i||r===0?Q.jsx(Jc,{className:"size-7 text-white"}):r<.33?Q.jsx(Zc,{className:"size-7 text-white"}):r<.66?Q.jsx(Yc,{className:"size-7 text-white"}):Q.jsx(Qc,{className:"size-7 text-white"}),f=i?0:r*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:n,type:"button",children:l()}),Q.jsx("div",{className:"absolute bottom-full left-1/2 -translate-x-1/2 hidden group-hover:block group-focus-within: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.jsx("input",{"aria-label":"Volume",className:"block h-24 w-2 cursor-pointer appearance-none rounded [writing-mode:vertical-lr] [direction:rtl] [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:size-3 [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:bg-white [&::-moz-range-thumb]:size-3 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-0 [&::-moz-range-thumb]:bg-white",max:100,min:0,onChange:u,step:5,style:{background:`linear-gradient(to top, white ${f}%, rgba(255, 255, 255, 0.2) ${f}%)`},type:"range",value:Math.round(f)})})})]})}const ul=10;function Vg({title:s,player:e,movieId:t,episodeId:i,onFullscreen:r,onNextEpisode:n,onToggleEpisodes:a,showEpisodesButton:u,streamUrl:l,subtitles:f}){const{buffered:m,isPlaying:_,progress:w,remainingTime:x}=Dg(e),{activeSubtitleId:I,selectSubtitle:y}=Rg(e,f);Og(e,{episodeId:i,movieId:t});const P=(f??[]).filter(O=>O.isSupported),N=(f??[]).filter(O=>!O.isSupported),M=P.length>0||N.length>0,L=()=>{e&&(e.paused()?e.play():e.pause())},B=()=>{if(!e)return;const O=e.currentTime()??0;e.currentTime(Math.max(0,O-ul))},U=()=>{if(!e)return;const O=e.currentTime()??0,V=e.duration()??0;e.currentTime(Math.min(V,O+ul))},j=O=>{if(!e)return;const V=e.duration()??0;e.currentTime(O*V)};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(jg,{buffered:m,progress:w,onSeek:j})}),Q.jsx("span",{className:"text-white text-xs font-mono whitespace-nowrap",children:Cg(x)})]}),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(es,{"aria-label":_?"Pause":"Play",onClick:L,children:_?Q.jsx(dg,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"}):Q.jsx(jm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),Q.jsx(es,{"aria-label":"Skip backward 10 seconds",onClick:B,children:Q.jsx(fg,{className:"size-7 hover:scale-125 text-white"})}),Q.jsx(es,{"aria-label":"Skip forward 10 seconds",onClick:U,children:Q.jsx(mg,{className:"size-7 hover:scale-125 text-white"})}),Q.jsx($g,{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(Ug,{episodeId:i,movieId:t,player:e,streamUrl:l,title:s}),M&&Q.jsx(Hg,{activeSubtitleId:I,onSelect:y,supportedSubtitles:P,unsupportedSubtitles:N}),n&&Q.jsx(es,{"aria-label":"Next episode",onClick:n,children:Q.jsx(_g,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),u&&a&&Q.jsx(es,{"aria-label":"Browse episodes",onClick:a,children:Q.jsx(og,{className:"size-7 hover:scale-125 text-white"})}),r&&Q.jsx(es,{"aria-label":"Toggle fullscreen",onClick:r,children:Q.jsx(lg,{className:"size-7 hover:scale-125 text-white"})})]})]})]})}function Hg({activeSubtitleId:s,onSelect:e,supportedSubtitles:t,unsupportedSubtitles:i}){return Q.jsxs(qm,{children:[Q.jsx($m,{asChild:!0,children:Q.jsx("button",{"aria-label":"Subtitles",className:"p-2 flex justify-center items-center cursor-pointer",type:"button",children:Q.jsx(sg,{className:"size-7 hover:scale-125 text-white"})})}),Q.jsx(Vm,{children:Q.jsxs(Hm,{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(ll,{isActive:s===to,label:"Off",onSelect:()=>e(to)}),t.map(r=>{const n=String(r.id);return Q.jsx(ll,{isActive:s===n,label:r.displayLanguage,onSelect:()=>e(n)},r.id)}),i.map(r=>Q.jsxs(Gc,{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 ll({isActive:s,label:e,onSelect:t}){return Q.jsxs(Gc,{className:zm("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(Wc,{className:"size-4 text-muted-foreground"}):Q.jsx("span",{className:"size-4"}),Q.jsx("span",{className:"flex-1 truncate",children:e})]})}function es({"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,type:"button",children:e})}var ya,cl;function Nn(){if(cl)return ya;cl=1;var s;return typeof window<"u"?s=window:typeof pn<"u"?s=pn:typeof self<"u"?s=self:s={},ya=s,ya}var zg=Nn();const D=br(zg),Gg={},Wg=Object.freeze(Object.defineProperty({__proto__:null,default:Gg},Symbol.toStringTag,{value:"Module"})),Xg=Gm(Wg);var Ta,dl;function td(){if(dl)return Ta;dl=1;var s=typeof pn<"u"?pn:typeof window<"u"?window:{},e=Xg,t;return typeof document<"u"?t=document:(t=s["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=s["__GLOBAL_DOCUMENT_CACHE@4"]=e)),Ta=t,Ta}var Kg=td();const ne=br(Kg);var sn={exports:{}},va={exports:{}},hl;function Yg(){return hl||(hl=1,(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var r=arguments[i];for(var n in r)({}).hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},s.exports.__esModule=!0,s.exports.default=s.exports,e.apply(null,arguments)}s.exports=e,s.exports.__esModule=!0,s.exports.default=s.exports})(va)),va.exports}var ba,fl;function Qg(){if(fl)return ba;fl=1,ba=e;var s=Object.prototype.toString;function e(t){if(!t)return!1;var i=s.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return ba}var xa,pl;function Jg(){if(pl)return xa;pl=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 xa=i,xa}var Sa,ml;function Zg(){if(ml)return Sa;ml=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 Sa=s,Sa}var Ea,gl;function e0(){if(gl)return Ea;gl=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 Ea=e,Ea}var _l;function t0(){if(_l)return sn.exports;_l=1;var s=Nn(),e=Yg(),t=Qg(),i=Jg(),r=Zg();f.httpHandler=e0(),f.requestInterceptorsStorage=new i,f.responseInterceptorsStorage=new i,f.retryManager=new r;var n=function(I){var y={};return I&&I.trim().split(`
3
+ `).forEach(function(P){var N=P.indexOf(":"),M=P.slice(0,N).trim().toLowerCase(),L=P.slice(N+1).trim();typeof y[M]>"u"?y[M]=L:Array.isArray(y[M])?y[M].push(L):y[M]=[y[M],L]}),y};sn.exports=f,sn.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(I,y,P){return y=l(I,y,P),y.method=x.toUpperCase(),m(y)}});function a(x,I){for(var y=0;y<x.length;y++)I(x[y])}function u(x){for(var I in x)if(x.hasOwnProperty(I))return!1;return!0}function l(x,I,y){var P=x;return t(I)?(y=I,typeof x=="string"&&(P={uri:x})):P=e({},I,{uri:x}),P.callback=y,P}function f(x,I,y){return I=l(x,I,y),m(I)}function m(x){if(typeof x.callback>"u")throw new Error("callback argument missing");if(x.requestType&&f.requestInterceptorsStorage.getIsEnabled()){var I={uri:x.uri||x.url,headers:x.headers||{},body:x.body,metadata:x.metadata||{},retry:x.retry,timeout:x.timeout},y=f.requestInterceptorsStorage.execute(x.requestType,I);x.uri=y.uri,x.headers=y.headers,x.body=y.body,x.metadata=y.metadata,x.retry=y.retry,x.timeout=y.timeout}var P=!1,N=function(ee,Z,ie){P||(P=!0,x.callback(ee,Z,ie))};function M(){j.readyState===4&&!f.responseInterceptorsStorage.getIsEnabled()&&setTimeout(U,0)}function L(){var Y=void 0;if(j.response?Y=j.response:Y=j.responseText||_(j),K)try{Y=JSON.parse(Y)}catch{}return Y}function B(Y){if(clearTimeout(te),clearTimeout(x.retryTimeout),Y instanceof Error||(Y=new Error(""+(Y||"Unknown XMLHttpRequest Error"))),Y.statusCode=0,!V&&f.retryManager.getIsEnabled()&&x.retry&&x.retry.shouldRetry()){x.retryTimeout=setTimeout(function(){x.retry.moveToNextAttempt(),x.xhr=j,m(x)},x.retry.getCurrentFuzzedDelay());return}if(x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var ee={headers:re.headers||{},body:re.body,responseUrl:j.responseURL,responseType:j.responseType},Z=f.responseInterceptorsStorage.execute(x.requestType,ee);re.body=Z.body,re.headers=Z.headers}return N(Y,re)}function U(){if(!V){var Y;clearTimeout(te),clearTimeout(x.retryTimeout),x.useXDR&&j.status===void 0?Y=200:Y=j.status===1223?204:j.status;var ee=re,Z=null;if(Y!==0?(ee={body:L(),statusCode:Y,method:E,headers:{},url:v,rawRequest:j},j.getAllResponseHeaders&&(ee.headers=n(j.getAllResponseHeaders()))):Z=new Error("Internal XMLHttpRequest Error"),x.requestType&&f.responseInterceptorsStorage.getIsEnabled()){var ie={headers:ee.headers||{},body:ee.body,responseUrl:j.responseURL,responseType:j.responseType},se=f.responseInterceptorsStorage.execute(x.requestType,ie);ee.body=se.body,ee.headers=se.headers}return N(Z,ee,ee.body)}}var j=x.xhr||null;j||(x.cors||x.useXDR?j=new f.XDomainRequest:j=new f.XMLHttpRequest);var O,V,v=j.url=x.uri||x.url,E=j.method=x.method||"GET",q=x.body||x.data,H=j.headers=x.headers||{},z=!!x.sync,K=!1,te,re={body:void 0,headers:{},statusCode:0,method:E,url:v,rawRequest:j};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"),q=JSON.stringify(x.json===!0?q:x.json))),j.onreadystatechange=M,j.onload=U,j.onerror=B,j.onprogress=function(){},j.onabort=function(){V=!0,clearTimeout(x.retryTimeout)},j.ontimeout=B,j.open(E,v,!z,x.username,x.password),z||(j.withCredentials=!!x.withCredentials),!z&&x.timeout>0&&(te=setTimeout(function(){if(!V){V=!0,j.abort("timeout");var Y=new Error("XMLHttpRequest timeout");Y.code="ETIMEDOUT",B(Y)}},x.timeout)),j.setRequestHeader)for(O in H)H.hasOwnProperty(O)&&j.setRequestHeader(O,H[O]);else if(x.headers&&!u(x.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in x&&(j.responseType=x.responseType),"beforeSend"in x&&typeof x.beforeSend=="function"&&x.beforeSend(j),j.send(q||null),j}function _(x){try{if(x.responseType==="document")return x.responseXML;var I=x.responseXML&&x.responseXML.documentElement.nodeName==="parsererror";if(x.responseType===""&&!I)return x.responseXML}catch{}return null}function w(){}return sn.exports}var i0=t0();const id=br(i0);var Ca={exports:{}},wa,yl;function s0(){if(yl)return wa;yl=1;var s=td(),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,z,K,te){return(H|0)*3600+(z|0)*60+(K|0)+(te|0)/1e3}var q=v.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return q?q[3]?E(q[1],q[2],q[3].replace(":",""),q[4]):q[1]>59?E(q[1],q[2],0,q[4]):E(0,q[1],q[2],q[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,q){return q?this.has(v)?this.values[v]:E[q]:this.has(v)?this.values[v]:E},has:function(v){return v in this.values},alt:function(v,E,q){for(var H=0;H<q.length;++H)if(E===q[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,q,H){var z=H?v.split(H):[v];for(var K in z)if(typeof z[K]=="string"){var te=z[K].split(q);if(te.length===2){var re=te[0].trim(),Y=te[1].trim();E(re,Y)}}}function a(v,E,q){var H=v;function z(){var re=i(v);if(re===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+H);return v=v.replace(/^[^\sa-zA-Z-]+/,""),re}function K(re,Y){var ee=new r;n(re,function(Z,ie){switch(Z){case"region":for(var se=q.length-1;se>=0;se--)if(q[se].id===ie){ee.set(Z,q[se].region);break}break;case"vertical":ee.alt(Z,ie,["rl","lr"]);break;case"line":var pe=ie.split(","),ge=pe[0];ee.integer(Z,ge),ee.percent(Z,ge)&&ee.set("snapToLines",!1),ee.alt(Z,ge,["auto"]),pe.length===2&&ee.alt("lineAlign",pe[1],["start","center","end"]);break;case"position":pe=ie.split(","),ee.percent(Z,pe[0]),pe.length===2&&ee.alt("positionAlign",pe[1],["start","center","end"]);break;case"size":ee.percent(Z,ie);break;case"align":ee.alt(Z,ie,["start","center","end","left","right"]);break}},/:/,/\s/),Y.region=ee.get("region",null),Y.vertical=ee.get("vertical","");try{Y.line=ee.get("line","auto")}catch{}Y.lineAlign=ee.get("lineAlign","start"),Y.snapToLines=ee.get("snapToLines",!0),Y.size=ee.get("size",100);try{Y.align=ee.get("align","center")}catch{Y.align=ee.get("align","middle")}try{Y.position=ee.get("position","auto")}catch{Y.position=ee.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},Y.align)}Y.positionAlign=ee.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},Y.align)}function te(){v=v.replace(/^\s+/,"")}if(te(),E.startTime=z(),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=z(),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 q(){if(!E)return null;function ge(he){return E=E.substr(he.length),he}var ye=E.match(/^([^<]*)(<[^>]*>?)?/);return ge(ye[1]?ye[1]:ye[2])}function H(ge){return u.innerHTML=ge,ge=u.textContent,u.textContent="",ge}function z(ge,ye){return!_[ye.localName]||_[ye.localName]===ge.localName}function K(ge,ye){var he=l[ge];if(!he)return null;var Ge=v.document.createElement(he),We=m[ge];return We&&ye&&(Ge[We]=ye.trim()),Ge}for(var te=v.document.createElement("div"),re=te,Y,ee=[];(Y=q())!==null;){if(Y[0]==="<"){if(Y[1]==="/"){ee.length&&ee[ee.length-1]===Y.substr(2).replace(">","")&&(ee.pop(),re=re.parentNode);continue}var Z=i(Y.substr(1,Y.length-2)),ie;if(Z){ie=v.document.createProcessingInstruction("timestamp",Z),re.appendChild(ie);continue}var se=Y.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!se||(ie=K(se[1],se[3]),!ie)||!z(re,ie))continue;if(se[2]){var pe=se[2].split(".");pe.forEach(function(ge){var ye=/^bg_/.test(ge),he=ye?ge.slice(3):ge;if(f.hasOwnProperty(he)){var Ge=ye?"background-color":"color",We=f[he];ie.style[Ge]=We}}),ie.className=pe.join(" ")}ee.push(se[1]),re.appendChild(ie),re=ie;continue}re.appendChild(v.document.createTextNode(H(Y)))}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 I(v){for(var E=0;E<x.length;E++){var q=x[E];if(v>=q[0]&&v<=q[1])return!0}return!1}function y(v){var E=[],q="",H;if(!v||!v.childNodes)return"ltr";function z(re,Y){for(var ee=Y.childNodes.length-1;ee>=0;ee--)re.push(Y.childNodes[ee])}function K(re){if(!re||!re.length)return null;var Y=re.pop(),ee=Y.textContent||Y.innerText;if(ee){var Z=ee.match(/^.*(\n|\r)/);return Z?(re.length=0,Z[0]):ee}if(Y.tagName==="ruby")return K(re);if(Y.childNodes)return z(re,Y),K(re)}for(z(E,v);q=K(E);)for(var te=0;te<q.length;te++)if(H=q.charCodeAt(te),I(H))return"rtl";return"ltr"}function P(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,q=E.textTrackList,H=0,z=0;z<q.length&&q[z]!==E;z++)q[z].mode==="showing"&&H++;return++H*-1}function N(){}N.prototype.applyStyles=function(v,E){E=E||this.div;for(var q in v)v.hasOwnProperty(q)&&(E.style[q]=v[q])},N.prototype.formatStyle=function(v,E){return v===0?0:v+E};function M(v,E,q){N.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:y(this.cueDiv),writingMode:E.vertical===""?"horizontal-tb":E.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:E.align==="middle"?"center":E.align,font:q.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(H),this.div.appendChild(this.cueDiv);var z=0;switch(E.positionAlign){case"start":case"line-left":z=E.position;break;case"center":z=E.position-E.size/2;break;case"end":case"line-right":z=E.position-E.size;break}E.vertical===""?this.applyStyles({left:this.formatStyle(z,"%"),width:this.formatStyle(E.size,"%")}):this.applyStyles({top:this.formatStyle(z,"%"),height:this.formatStyle(E.size,"%")}),this.move=function(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")})}}M.prototype=e(N.prototype),M.prototype.constructor=M;function L(v){var E,q,H,z;if(v.div){q=v.div.offsetHeight,H=v.div.offsetWidth,z=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||z,this.height=v.height||q,this.bottom=v.bottom||z+(v.height||q),this.width=v.width||H,this.lineHeight=E!==void 0?E:v.lineHeight}L.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}},L.prototype.overlaps=function(v){return this.left<v.right&&this.right>v.left&&this.top<v.bottom&&this.bottom>v.top},L.prototype.overlapsAny=function(v){for(var E=0;E<v.length;E++)if(this.overlaps(v[E]))return!0;return!1},L.prototype.within=function(v){return this.top>=v.top&&this.bottom<=v.bottom&&this.left>=v.left&&this.right<=v.right},L.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}},L.prototype.intersectPercentage=function(v){var E=Math.max(0,Math.min(this.right,v.right)-Math.max(this.left,v.left)),q=Math.max(0,Math.min(this.bottom,v.bottom)-Math.max(this.top,v.top)),H=E*q;return H/(this.height*this.width)},L.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}},L.getSimpleBoxPosition=function(v){var E=v.div?v.div.offsetHeight:v.tagName?v.offsetHeight:0,q=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 z={left:v.left,right:v.right,top:v.top||H,height:v.height||E,bottom:v.bottom||H+(v.height||E),width:v.width||q};return z};function B(v,E,q,H){function z(he,Ge){for(var We,je=new L(he),ke=1,St=0;St<Ge.length;St++){for(;he.overlapsOppositeAxis(q,Ge[St])||he.within(q)&&he.overlapsAny(H);)he.move(Ge[St]);if(he.within(q))return he;var et=he.intersectPercentage(q);ke>et&&(We=new L(he),ke=et),he=new L(je)}return We||je}var K=new L(E),te=E.cue,re=P(te),Y=[];if(te.snapToLines){var ee;switch(te.vertical){case"":Y=["+y","-y"],ee="height";break;case"rl":Y=["+x","-x"],ee="width";break;case"lr":Y=["-x","+x"],ee="width";break}var Z=K.lineHeight,ie=Z*Math.round(re),se=q[ee]+Z,pe=Y[0];Math.abs(ie)>se&&(ie=ie<0?-1:1,ie*=Math.ceil(se/Z)*Z),re<0&&(ie+=te.vertical===""?q.height:q.width,Y=Y.reverse()),K.move(pe,ie)}else{var ge=K.lineHeight/q.height*100;switch(te.lineAlign){case"center":re-=ge/2;break;case"end":re-=ge;break}switch(te.vertical){case"":E.applyStyles({top:E.formatStyle(re,"%")});break;case"rl":E.applyStyles({left:E.formatStyle(re,"%")});break;case"lr":E.applyStyles({right:E.formatStyle(re,"%")});break}Y=["+y","-x","+x","-y"],K=new L(E)}var ye=z(K,Y);E.move(ye.toCSSCompatValues(q))}function U(){}U.StringDecoder=function(){return{decode:function(v){if(!v)return"";if(typeof v!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(v))}}},U.convertCueToDOMTree=function(v,E){return!v||!E?null:w(v,E)};var j=.05,O="sans-serif",V="1.5%";return U.processCues=function(v,E,q){if(!v||!E||!q)return null;for(;q.firstChild;)q.removeChild(q.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=V,q.appendChild(H);function z(Z){for(var ie=0;ie<Z.length;ie++)if(Z[ie].hasBeenReset||!Z[ie].displayState)return!0;return!1}if(!z(E)){for(var K=0;K<E.length;K++)H.appendChild(E[K].displayState);return}var te=[],re=L.getSimpleBoxPosition(H),Y=Math.round(re.height*j*100)/100,ee={font:Y+"px "+O};(function(){for(var Z,ie,se=0;se<E.length;se++)ie=E[se],Z=new M(v,ie,ee),H.appendChild(Z.div),B(v,Z,re,te),ie.displayState=Z.div,te.push(L.getSimpleBoxPosition(Z))})()},U.Parser=function(v,E,q){q||(q=E,E={}),E||(E={}),this.window=v,this.vttjs=E,this.state="INITIAL",this.buffer="",this.decoder=q||new TextDecoder("utf8"),this.regionList=[]},U.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 q(){for(var Z=E.buffer,ie=0;ie<Z.length&&Z[ie]!=="\r"&&Z[ie]!==`
4
+ `;)++ie;var se=Z.substr(0,ie);return Z[ie]==="\r"&&++ie,Z[ie]===`
5
+ `&&++ie,E.buffer=Z.substr(ie),se}function H(Z){var ie=new r;if(n(Z,function(pe,ge){switch(pe){case"id":ie.set(pe,ge);break;case"width":ie.percent(pe,ge);break;case"lines":ie.integer(pe,ge);break;case"regionanchor":case"viewportanchor":var ye=ge.split(",");if(ye.length!==2)break;var he=new r;if(he.percent("x",ye[0]),he.percent("y",ye[1]),!he.has("x")||!he.has("y"))break;ie.set(pe+"X",he.get("x")),ie.set(pe+"Y",he.get("y"));break;case"scroll":ie.alt(pe,ge,["up"]);break}},/=/,/\s/),ie.has("id")){var se=new(E.vttjs.VTTRegion||E.window.VTTRegion);se.width=ie.get("width",100),se.lines=ie.get("lines",3),se.regionAnchorX=ie.get("regionanchorX",0),se.regionAnchorY=ie.get("regionanchorY",100),se.viewportAnchorX=ie.get("viewportanchorX",0),se.viewportAnchorY=ie.get("viewportanchorY",100),se.scroll=ie.get("scroll",""),E.onregion&&E.onregion(se),E.regionList.push({id:ie.get("id"),region:se})}}function z(Z){var ie=new r;n(Z,function(se,pe){switch(se){case"MPEGT":ie.integer(se+"S",pe);break;case"LOCA":ie.set(se+"L",i(pe));break}},/[^\d]:/,/,/),E.ontimestampmap&&E.ontimestampmap({MPEGTS:ie.get("MPEGTS"),LOCAL:ie.get("LOCAL")})}function K(Z){Z.match(/X-TIMESTAMP-MAP/)?n(Z,function(ie,se){ie==="X-TIMESTAMP-MAP"&&z(se)},/=/):n(Z,function(ie,se){ie==="Region"&&H(se)},/:/)}try{var te;if(E.state==="INITIAL"){if(!/\r\n|\n/.test(E.buffer))return this;te=q();var re=te.match(/^WEBVTT([ \t].*)?$/);if(!re||!re[0])throw new t(t.Errors.BadSignature);E.state="HEADER"}for(var Y=!1;E.buffer;){if(!/\r\n|\n/.test(E.buffer))return this;switch(Y?Y=!1:te=q(),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(Z){E.reportOrThrowError(Z),E.cue=null,E.state="BADCUE";continue}E.state="CUETEXT";continue;case"CUETEXT":var ee=te.indexOf("-->")!==-1;if(!te||ee&&(Y=!0)){E.oncue&&E.oncue(E.cue),E.cue=null,E.state="ID";continue}E.cue.text&&(E.cue.text+=`
6
+ `),E.cue.text+=te.replace(/\u2028/g,`
7
7
  `).replace(/u2029/g,`
8
- `);continue;case"BADCUE":ee||(E.state="ID");continue}}}catch(te){E.reportOrThrowError(te),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+=`
8
+ `);continue;case"BADCUE":te||(E.state="ID");continue}}}catch(Z){E.reportOrThrowError(Z),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}},Da=q,Da}var ka,ml;function Fg(){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",q=100,j="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 q},set:function(R){if(R<0||R>100)throw new Error("Size must be between 0 and 100.");q=R,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return j},set:function(R){var G=r(R);if(!G)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");j=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 Ug(){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 jg(){if(_l)return Aa.exports;_l=1;var s=Nn(),e=Aa.exports={WebVTT:Bg(),VTTCue:Fg(),VTTRegion:Ug()};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 qg=jg();const yl=vr(qg);function Xe(){return Xe=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},Xe.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})(),$g=function(e){return D.atob?D.atob(e):Buffer.from(e,"base64").toString("binary")};function Zc(s){for(var e=$g(s),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class Vg extends Io{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
10
+ `,v.parse()),v.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(E){v.reportOrThrowError(E)}return v.onflush&&v.onflush(),this}},wa=U,wa}var Aa,Tl;function r0(){if(Tl)return Aa;Tl=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,I=null,y="",P=!0,N="auto",M="start",L="auto",B="auto",U=100,j="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return f},set:function(O){f=""+O}},pauseOnExit:{enumerable:!0,get:function(){return m},set:function(O){m=!!O}},startTime:{enumerable:!0,get:function(){return _},set:function(O){if(typeof O!="number")throw new TypeError("Start time must be set to a number.");_=O,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return w},set:function(O){if(typeof O!="number")throw new TypeError("End time must be set to a number.");w=O,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return x},set:function(O){x=""+O,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return I},set:function(O){I=O,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return y},set:function(O){var V=i(O);if(V===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");y=V,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return P},set:function(O){P=!!O,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return N},set:function(O){if(typeof O!="number"&&O!==s)throw new SyntaxError("Line: an invalid number or illegal string was specified.");N=O,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return M},set:function(O){var V=r(O);V?(M=V,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return L},set:function(O){if(O<0||O>100)throw new Error("Position must be between 0 and 100.");L=O,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return B},set:function(O){var V=r(O);V?(B=V,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return U},set:function(O){if(O<0||O>100)throw new Error("Size must be between 0 and 100.");U=O,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return j},set:function(O){var V=r(O);if(!V)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");j=V,this.hasBeenReset=!0}}}),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Aa=n,Aa}var Da,vl;function n0(){if(vl)return Da;vl=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 Da=i,Da}var bl;function a0(){if(bl)return Ca.exports;bl=1;var s=Nn(),e=Ca.exports={WebVTT:s0(),VTTCue:r0(),VTTRegion:n0()};s.vttjs=e,s.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,r=s.VTTCue,n=s.VTTRegion;return e.shim=function(){s.VTTCue=t,s.VTTRegion=i},e.restore=function(){s.VTTCue=r,s.VTTRegion=n},s.VTTCue||e.shim(),Ca.exports}var o0=a0();const xl=br(o0);function He(){return He=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},He.apply(null,arguments)}var Sl="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||Sl);var n=new URL(t,e);return r?n.href.slice(Sl.length):i?n.href.slice(n.protocol.length):n.href},Po=(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})(),u0=function(e){return D.atob?D.atob(e):Buffer.from(e,"base64").toString("binary")};function sd(s){for(var e=u0(s),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class l0 extends Po{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 Hg=" ",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},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},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 Gg 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=Xe(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(Hg)),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 Wg=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),vi=function(s){const e={};return Object.keys(s).forEach(function(t){e[Wg(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 Xg extends Io{constructor(e={}){super(),this.lineStream=new Vg,this.parseStream=new Gg,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:Zc(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={}),Xe(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=vi(T.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",T.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const N=this.manifest.segments.length,O=vi(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((q,j)=>{q.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${j} lacks required attribute(s): LAST-PART`})})},"server-control"(){const N=this.manifest.serverControl=vi(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=vi(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 q=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${q} for segment #${N}`,T.attributes,["TYPE","URI"]),!!O.type)for(let j=0;j<r.preloadHints.length-1;j++){const R=r.preloadHints[j];R.type&&R.type===O.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${q} for segment #${N} has the same TYPE ${O.type} as preload hint #${j}`})}},"rendition-report"(){const N=vi(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=vi(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(vi(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 j=O.startDate.getTime()+O.duration*1e3;this.manifest.dateRanges[N].endDate=new Date(j)}if(!P[O.id])P[O.id]=O;else{for(const j in P[O.id])if(O[j]&&JSON.stringify(P[O.id][j])!==JSON.stringify(O[j])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const q=this.manifest.dateRanges.findIndex(j=>j.id===O.id);this.manifest.dateRanges[q]=Xe(this.manifest.dateRanges[q],O),P[O.id]=Xe(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=vi(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^/},Kg=["video","audio","text"],bl=["Video","Audio","Text"],ed=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})},Kt=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(r){r=r.trim();var n;Kg.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},Yg=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 Kt(n.playlists[0].attributes.CODECS)}return null},td=function(e){return e===void 0&&(e=""),$i.audio.test(e.trim().toLowerCase())},Qg=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 ed(n.trim())}),i="video";t.length===1&&td(t[0])?i="audio":t.length===1&&Qg(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",Jg="avc1.4d400d",Zg=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,e0=/^application\/dash\+xml/i,id=function(e){return Zg.test(e)?"hls":e0.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},t0=function(e){return e.toString(2).length},i0=function(e){return Math.ceil(t0(e)/8)},sd=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},s0=function(e){return sd(e)},he=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!s0(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))},rt=D.BigInt||Number,to=[rt("0x1"),rt("0x100"),rt("0x10000"),rt("0x1000000"),rt("0x100000000"),rt("0x10000000000"),rt("0x1000000000000"),rt("0x100000000000000"),rt("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 r0=function(e,t){var i=t===void 0?{}:t,r=i.signed,n=r===void 0?!1:r,a=i.le,u=a===void 0?!1:a;e=he(e);var l=u?"reduce":"reduceRight",f=e[l]?e[l]:Array.prototype[l],m=f.call(e,function(w,x,P){var T=u?P:Math.abs(P+1-e.length);return w+rt(x)*to[T]},rt(0));if(n){var _=to[e.length]/rt(2)-rt(1);m=rt(m),m>_&&(m-=_,m-=_,m-=rt(2))}return Number(m)},n0=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=rt(e);for(var a=i0(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]&rt(255)),e<0&&(u[f]=Math.abs(~u[f]),u[f]-=l===0?1:2)}return u},rd=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},a0=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(u){return u&&(u.byteLength||u.length)&&typeof u!="string"}),t.length<=1)return he(t[0]);var r=t.reduce(function(u,l,f){return u+(l.byteLength||l.length)},0),n=new Uint8Array(r),a=0;return t.forEach(function(u){u=he(u),n.set(u,a),a+=u.byteLength}),n},Ue=function(e,t,i){var r=i===void 0?{}:i,n=r.offset,a=n===void 0?0:n,u=r.mask,l=u===void 0?[]:u;e=he(e),t=he(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(m,_){var w=l[_]?l[_]&e[a+_]:e[a+_];return m===w})},o0=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 nd(){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,q=m.DOCUMENT_FRAGMENT_NODE=11,j=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 U(){}U.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++)gi(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,ee(this)}function ee(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 ee(this),this[y]||null},f(K,U);function se(){}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&&Se(ae,y,z),fe(ae,y,L))}}function te(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 me=y.ownerDocument;me&&(Se(me,y,L),L.ownerElement=null)}}else throw new H(E,new Error(y.tagName+"@"+L))}se.prototype={length:0,item:U.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 te(this._ownerElement,this,b),b},removeNamedItemNS:function(y,b){var L=this.getNamedItemNS(y,b);return te(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 ie(){}ie.prototype={hasFeature:function(y,b){return!0},createDocument:function(y,b,L){var z=new ve;if(z.implementation=this,z.childNodes=new U,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 mi;return z.name=y,z.nodeName=y,z.publicId=b||"",z.systemId=L||"",z}};function re(){}re.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 gt(this,y,b)},replaceChild:function(y,b){gt(this,y,b,nt),b&&this.removeChild(b)},removeChild:function(y){return Le(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 ge(y){return y=="<"&&"&lt;"||y==">"&&"&gt;"||y=="&"&&"&amp;"||y=='"'&&"&quot;"||"&#"+y.charCodeAt()+";"}l(m,re),l(m,re.prototype);function ye(y,b){if(b(y))return!0;if(y=y.firstChild)do if(ye(y,b))return!0;while(y=y.nextSibling)}function ve(){this.ownerDocument=this}function fe(y,b,L){y&&y._inc++;var z=L.namespaceURI;z===t.XMLNS&&(b._nsMap[L.prefix?L.localName:""]=L.value)}function Se(y,b,L,z){y&&y._inc++;var ae=L.namespaceURI;ae===t.XMLNS&&delete b._nsMap[L.prefix?L.localName:""]}function ke(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,me=0;ae;)z[me++]=ae,ae=ae.nextSibling;z.length=me,delete z[z.length]}}}function Le(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,ke(y.ownerDocument,y),b}function Qe(y){return y&&(y.nodeType===re.DOCUMENT_NODE||y.nodeType===re.DOCUMENT_FRAGMENT_NODE||y.nodeType===re.ELEMENT_NODE)}function st(y){return y&&(Oe(y)||Mt(y)||Ke(y)||y.nodeType===re.DOCUMENT_FRAGMENT_NODE||y.nodeType===re.COMMENT_NODE||y.nodeType===re.PROCESSING_INSTRUCTION_NODE)}function Ke(y){return y&&y.nodeType===re.DOCUMENT_TYPE_NODE}function Oe(y){return y&&y.nodeType===re.ELEMENT_NODE}function Mt(y){return y&&y.nodeType===re.TEXT_NODE}function ze(y,b){var L=y.childNodes||[];if(e(L,Oe)||Ke(b))return!1;var z=e(L,Ke);return!(b&&z&&L.indexOf(z)>L.indexOf(b))}function Bt(y,b){var L=y.childNodes||[];function z(me){return Oe(me)&&me!==b}if(e(L,z))return!1;var ae=e(L,Ke);return!(b&&ae&&L.indexOf(ae)>L.indexOf(b))}function Ge(y,b,L){if(!Qe(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(!st(b)||Ke(b)&&y.nodeType!==re.DOCUMENT_NODE)throw new H(v,"Unexpected node type "+b.nodeType+" for parent node type "+y.nodeType)}function hi(y,b,L){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===re.DOCUMENT_FRAGMENT_NODE){var me=ae.filter(Oe);if(me.length>1||e(ae,Mt))throw new H(v,"More than one element or text in fragment");if(me.length===1&&!ze(y,L))throw new H(v,"Element in fragment can not be inserted before doctype")}if(Oe(b)&&!ze(y,L))throw new H(v,"Only one element can be added and only after doctype");if(Ke(b)){if(e(z,Ke))throw new H(v,"Only one doctype is allowed");var Re=e(z,Oe);if(L&&z.indexOf(Re)<z.indexOf(L))throw new H(v,"Doctype can only be inserted before an element");if(!L&&Re)throw new H(v,"Doctype can not be appended since element is present")}}function nt(y,b,L){var z=y.childNodes||[],ae=b.childNodes||[];if(b.nodeType===re.DOCUMENT_FRAGMENT_NODE){var me=ae.filter(Oe);if(me.length>1||e(ae,Mt))throw new H(v,"More than one element or text in fragment");if(me.length===1&&!Bt(y,L))throw new H(v,"Element in fragment can not be inserted before doctype")}if(Oe(b)&&!Bt(y,L))throw new H(v,"Only one element can be added and only after doctype");if(Ke(b)){if(e(z,function(bt){return Ke(bt)&&bt!==L}))throw new H(v,"Only one doctype is allowed");var Re=e(z,Oe);if(L&&z.indexOf(Re)<z.indexOf(L))throw new H(v,"Doctype can only be inserted before an element")}}function gt(y,b,L,z){Ge(y,b,L),y.nodeType===re.DOCUMENT_NODE&&(z||hi)(y,b,L);var ae=b.parentNode;if(ae&&ae.removeChild(b),b.nodeType===q){var me=b.firstChild;if(me==null)return b;var Re=b.lastChild}else me=Re=b;var at=L?L.previousSibling:y.lastChild;me.previousSibling=at,Re.nextSibling=L,at?at.nextSibling=me:y.firstChild=me,L==null?y.lastChild=Re:L.previousSibling=Re;do{me.parentNode=y;var bt=y.ownerDocument||y;be(me,bt)}while(me!==Re&&(me=me.nextSibling));return ke(y.ownerDocument||y,y),b.nodeType==q&&(b.firstChild=b.lastChild=null),b}function be(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;)be(ae,b),ae=ae.nextSibling}}function ce(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,ke(y.ownerDocument,y,b);var L=y.ownerDocument||y;return be(b,L),b}ve.prototype={nodeName:"#document",nodeType:O,doctype:null,documentElement:null,_inc:1,insertBefore:function(y,b){if(y.nodeType==q){for(var L=y.firstChild;L;){var z=L.nextSibling;this.insertBefore(L,b),L=z}return y}return gt(this,y,b),be(y,this),this.documentElement===null&&y.nodeType===_&&(this.documentElement=y),y},removeChild:function(y){return this.documentElement==y&&(this.documentElement=null),Le(this,y)},replaceChild:function(y,b){gt(this,y,b,nt),be(y,this),b&&this.removeChild(b),Oe(y)&&(this.documentElement=y)},importNode:function(y,b){return kr(this,y,b)},getElementById:function(y){var b=null;return ye(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&&ye(L.documentElement,function(ae){if(ae!==L&&ae.nodeType===_){var me=ae.getAttribute("class");if(me){var Re=y===me;if(!Re){var at=a(me);Re=b.every(u(at))}Re&&z.push(ae)}}}),z})},createElement:function(y){var b=new _e;b.ownerDocument=this,b.nodeName=y,b.tagName=y,b.localName=y,b.childNodes=new U;var L=b.attributes=new se;return L._ownerElement=b,b},createDocumentFragment:function(){var y=new we;return y.ownerDocument=this,y.childNodes=new U,y},createTextNode:function(y){var b=new fi;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 pi;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 Je;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 _e,z=b.split(":"),ae=L.attributes=new se;return L.childNodes=new U,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 Je,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(ve,re);function _e(){this._nsMap={}}_e.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===q?this.insertBefore(y,null):ce(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 ye(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 ye(L,function(ae){ae!==L&&ae.nodeType===_&&(y==="*"||ae.namespaceURI===y)&&(b==="*"||ae.localName==b)&&z.push(ae)}),z})}},ve.prototype.getElementsByTagName=_e.prototype.getElementsByTagName,ve.prototype.getElementsByTagNameNS=_e.prototype.getElementsByTagNameNS,f(_e,re);function Je(){}Je.prototype.nodeType=w,f(Je,re);function ct(){}ct.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(ct,re);function fi(){}fi.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(fi,ct);function Ii(){}Ii.prototype={nodeName:"#comment",nodeType:N},f(Ii,ct);function pi(){}pi.prototype={nodeName:"#cdata-section",nodeType:P},f(pi,ct);function mi(){}mi.prototype.nodeType=F,f(mi,re);function Os(){}Os.prototype.nodeType=j,f(Os,re);function Rs(){}Rs.prototype.nodeType=I,f(Rs,re);function Ki(){}Ki.prototype.nodeType=T,f(Ki,re);function we(){}we.prototype.nodeName="#document-fragment",we.prototype.nodeType=q,f(we,re);function Ns(){}Ns.prototype.nodeType=M,f(Ns,re);function Pi(){}Pi.prototype.serializeToString=function(y,b,L){return Ar.call(y,b,L)},re.prototype.toString=Ar;function Ar(y,b){var L=[],z=this.nodeType==9&&this.documentElement||this,ae=z.prefix,me=z.namespaceURI;if(me&&ae==null){var ae=z.lookupPrefix(me);if(ae==null)var Re=[{namespace:me,prefix:null}]}return gi(this,L,y,b,Re),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 me=L.length;me--;){var Re=L[me];if(Re.prefix===z)return Re.namespace!==ae}return!0}function Ms(y,b,L){y.push(" ",b,'="',L.replace(/[<>&"\t\n\r]/g,ge),'"')}function gi(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 me=y.attributes,Re=me.length,Ne=y.firstChild,at=y.tagName;L=t.isHTML(y.namespaceURI)||L;var bt=at;if(!L&&!y.prefix&&y.namespaceURI){for(var zt,At=0;At<me.length;At++)if(me.item(At).name==="xmlns"){zt=me.item(At).value;break}if(!zt)for(var Ft=ae.length-1;Ft>=0;Ft--){var Dt=ae[Ft];if(Dt.prefix===""&&Dt.namespace===y.namespaceURI){zt=Dt.namespace;break}}if(zt!==y.namespaceURI)for(var Ft=ae.length-1;Ft>=0;Ft--){var Dt=ae[Ft];if(Dt.namespace===y.namespaceURI){Dt.prefix&&(bt=Dt.prefix+":"+at);break}}}b.push("<",bt);for(var Ve=0;Ve<Re;Ve++){var kt=me.item(Ve);kt.prefix=="xmlns"?ae.push({prefix:kt.localName,namespace:kt.value}):kt.nodeName=="xmlns"&&ae.push({prefix:"",namespace:kt.value})}for(var Ve=0;Ve<Re;Ve++){var kt=me.item(Ve);if(Dr(kt,L,ae)){var ri=kt.prefix||"",Gt=kt.namespaceURI;Ms(b,ri?"xmlns:"+ri:"xmlns",Gt),ae.push({prefix:ri,namespace:Gt})}gi(kt,b,L,z,ae)}if(at===bt&&Dr(y,L,ae)){var ri=y.prefix||"",Gt=y.namespaceURI;Ms(b,ri?"xmlns:"+ri:"xmlns",Gt),ae.push({prefix:ri,namespace:Gt})}if(Ne||L&&!/^(?:meta|link|img|br|hr|input)$/i.test(at)){if(b.push(">"),L&&/^script$/i.test(at))for(;Ne;)Ne.data?b.push(Ne.data):gi(Ne,b,L,z,ae.slice()),Ne=Ne.nextSibling;else for(;Ne;)gi(Ne,b,L,z,ae.slice()),Ne=Ne.nextSibling;b.push("</",bt,">")}else b.push("/>");return;case O:case q:for(var Ne=y.firstChild;Ne;)gi(Ne,b,L,z,ae.slice()),Ne=Ne.nextSibling;return;case w:return Ms(b,y.name,y.value);case x:return b.push(y.data.replace(/[<&>]/g,ge));case P:return b.push("<![CDATA[",y.data,"]]>");case N:return b.push("<!--",y.data,"-->");case F:var Li=y.publicId,Ce=y.systemId;if(b.push("<!DOCTYPE ",y.name),Li)b.push(" PUBLIC ",Li),Ce&&Ce!="."&&b.push(" ",Ce),b.push(">");else if(Ce&&Ce!=".")b.push(" SYSTEM ",Ce,">");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 q: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 me=b[ae];typeof me!="object"&&me!=z[ae]&&(z[ae]=me)}switch(b.childNodes&&(z.childNodes=new U),z.ownerDocument=y,z.nodeType){case _:var Re=b.attributes,at=z.attributes=new se,bt=Re.length;at._ownerElement=z;for(var zt=0;zt<bt;zt++)z.setAttributeNode(Bs(y,Re.item(zt),!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 q: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 ee(this),this.$$length}}),Object.defineProperty(re.prototype,"textContent",{get:function(){return y(this)},set:function(b){switch(this.nodeType){case _:case q: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=mi,ai.DOMException=H,ai.DOMImplementation=ie,ai.Element=_e,ai.Node=re,ai.NodeList=U,ai.XMLSerializer=Pi,ai}var tr={},Ra={},Cl;function u0(){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 l0(){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,U){function K(ce){if(ce>65535){ce-=65536;var _e=55296+(ce>>10),Je=56320+(ce&1023);return String.fromCharCode(_e,Je)}else return String.fromCharCode(ce)}function ee(ce){var _e=ce.slice(1,-1);return Object.hasOwnProperty.call(V,_e)?V[_e]:_e.charAt(0)==="#"?K(parseInt(_e.substr(1).replace("x","0x"))):(U.error("entity not found:"+ce),ce)}function se(ce){if(ce>ve){var _e=v.substring(ve,ce).replace(/&#?\w+;/g,ee);re&&W(ve),H.characters(_e,0,ce-ve),ve=ce}}function W(ce,_e){for(;ce>=te&&(_e=ie.exec(v));)Z=_e.index,te=Z+_e[0].length,re.lineNumber++;re.columnNumber=ce-Z+1}for(var Z=0,te=0,ie=/.*(?:\r\n?|\n)|.*$/g,re=H.locator,ge=[{currentNSMap:E}],ye={},ve=0;;){try{var fe=v.indexOf("<",ve);if(fe<0){if(!v.substr(ve).match(/^\s*$/)){var Se=H.doc,ke=Se.createTextNode(v.substr(ve));Se.appendChild(ke),H.currentElement=ke}return}switch(fe>ve&&se(fe),v.charAt(fe+1)){case"/":var Ge=v.indexOf(">",fe+3),Le=v.substring(fe+2,Ge).replace(/[ \t\n\r]+$/g,""),Qe=ge.pop();Ge<0?(Le=v.substring(fe+2).replace(/[\s<].*/,""),U.error("end tag name: "+Le+" is not complete:"+Qe.tagName),Ge=fe+1+Le.length):Le.match(/\s</)&&(Le=Le.replace(/[\s<].*/,""),U.error("end tag name: "+Le+" maybe not complete"),Ge=fe+1+Le.length);var st=Qe.localNSMap,Ke=Qe.tagName==Le,Oe=Ke||Qe.tagName&&Qe.tagName.toLowerCase()==Le.toLowerCase();if(Oe){if(H.endElement(Qe.uri,Qe.localName,Le),st)for(var Mt in st)Object.prototype.hasOwnProperty.call(st,Mt)&&H.endPrefixMapping(Mt);Ke||U.fatalError("end tag name: "+Le+" is not match the current start tagName:"+Qe.tagName)}else ge.push(Qe);Ge++;break;case"?":re&&W(fe),Ge=j(v,fe,H);break;case"!":re&&W(fe),Ge=q(v,fe,H,U);break;default:re&&W(fe);var ze=new R,Bt=ge[ge.length-1].currentNSMap,Ge=I(v,fe,ze,Bt,ee,U),hi=ze.length;if(!ze.closed&&O(v,Ge,ze.tagName,ye)&&(ze.closed=!0,V.nbsp||U.warning("unclosed xml attribute")),re&&hi){for(var nt=T(re,{}),gt=0;gt<hi;gt++){var be=ze[gt];W(be.offset),be.locator=T(re,{})}H.locator=nt,M(ze,H,Bt)&&ge.push(ze),H.locator=re}else M(ze,H,Bt)&&ge.push(ze);s.isHTML(ze.uri)&&!ze.closed?Ge=N(v,Ge,ze.tagName,ee,H):Ge++}}catch(ce){if(ce instanceof w)throw ce;U.error("element parse error: "+ce),Ge=-1}Ge>ve?ve=Ge:se(Math.max(fe,ve)+1)}}function T(v,E){return E.lineNumber=v.lineNumber,E.columnNumber=v.columnNumber,E}function I(v,E,V,H,U,K){function ee(re,ge,ye){V.attributeNames.hasOwnProperty(re)&&K.fatalError("Attribute "+re+" redefined"),V.addValue(re,ge.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,U),ye)}for(var se,W,Z=++E,te=r;;){var ie=v.charAt(Z);switch(ie){case"=":if(te===n)se=v.slice(E,Z),te=u;else if(te===a)te=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(te===u||te===n)if(te===n&&(K.warning('attribute value must after "="'),se=v.slice(E,Z)),E=Z+1,Z=v.indexOf(ie,E),Z>0)W=v.slice(E,Z),ee(se,W,E-1),te=f;else throw new Error("attribute value no end '"+ie+"' match");else if(te==l)W=v.slice(E,Z),ee(se,W,E),K.warning('attribute "'+se+'" missed start quot('+ie+")!!"),E=Z+1,te=f;else throw new Error('attribute value must after "="');break;case"/":switch(te){case r:V.setTagName(v.slice(E,Z));case f:case m:case _:te=_,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"),te==r&&V.setTagName(v.slice(E,Z)),Z;case">":switch(te){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:te===a&&(W=se),te==l?(K.warning('attribute "'+W+'" missed quot(")!'),ee(se,W,E)):((!s.isHTML(H[""])||!W.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+W+'" missed value!! "'+W+'" instead!!'),ee(W,W,E));break;case u:throw new Error("attribute value missed!!")}return Z;case"€":ie=" ";default:if(ie<=" ")switch(te){case r:V.setTagName(v.slice(E,Z)),te=m;break;case n:se=v.slice(E,Z),te=a;break;case l:var W=v.slice(E,Z);K.warning('attribute "'+W+'" missed quot(")!!'),ee(se,W,E);case f:te=m;break}else switch(te){case a:V.tagName,(!s.isHTML(H[""])||!se.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+se+'" missed value!! "'+se+'" instead2!!'),ee(se,se,E),E=Z,te=n;break;case f:K.warning('attribute space is required"'+se+'"!!');case m:te=n,E=Z;break;case u:te=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,U=null,ie=v.length;ie--;){var K=v[ie],ee=K.qName,se=K.value,re=ee.indexOf(":");if(re>0)var W=K.prefix=ee.slice(0,re),Z=ee.slice(re+1),te=W==="xmlns"&&Z;else Z=ee,W=null,te=ee==="xmlns"&&"";K.localName=Z,te!==!1&&(U==null&&(U={},F(V,V={})),V[te]=U[te]=se,K.uri=s.XMLNS,E.startPrefixMapping(te,se))}for(var ie=v.length;ie--;){K=v[ie];var W=K.prefix;W&&(W==="xml"&&(K.uri=s.XML),W!=="xmlns"&&(K.uri=V[W||""]))}var re=H.indexOf(":");re>0?(W=v.prefix=H.slice(0,re),Z=v.localName=H.slice(re+1)):(W=null,Z=v.localName=H);var ge=v.uri=V[W||""];if(E.startElement(ge,Z,H,v),v.closed){if(E.endElement(ge,Z,H),U)for(W in U)Object.prototype.hasOwnProperty.call(U,W)&&E.endPrefixMapping(W)}else return v.currentNSMap=V,v.localNSMap=U,!0}function N(v,E,V,H,U){if(/^(?:script|textarea)$/i.test(V)){var K=v.indexOf("</"+V+">",E),ee=v.substring(E+1,K);if(/[&<]/.test(ee))return/^script$/i.test(V)?(U.characters(ee,0,ee.length),K):(ee=ee.replace(/&#?\w+;/g,H),U.characters(ee,0,ee.length),K)}return E+1}function O(v,E,V,H){var U=H[V];return U==null&&(U=v.lastIndexOf("</"+V+">"),U<E&&(U=v.lastIndexOf("</"+V)),H[V]=U),U<E}function F(v,E){for(var V in v)Object.prototype.hasOwnProperty.call(v,V)&&(E[V]=v[V])}function q(v,E,V,H){var U=v.charAt(E+2);switch(U){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 ee=G(v,E),se=ee.length;if(se>1&&/!doctype/i.test(ee[0][0])){var W=ee[1][0],Z=!1,te=!1;se>3&&(/^public$/i.test(ee[2][0])?(Z=ee[3][0],te=se>4&&ee[4][0]):/^system$/i.test(ee[2][0])&&(te=ee[3][0]));var ie=ee[se-1];return V.startDTD(W,Z,te),V.endDTD(),ie.index+ie[0].length}}return-1}function j(v,E,V){var H=v.indexOf("?>",E);if(H){var U=v.substring(E,H).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return U?(U[0].length,V.processingInstruction(U[1],U[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=[],U=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(U.lastIndex=E,U.exec(v);V=U.exec(v);)if(H.push(V),V[1])return H}return sn.XMLReader=x,sn.ParseError=w,sn}var Al;function c0(){if(Al)return tr;Al=1;var s=Bn(),e=nd(),t=u0(),i=l0(),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 c0=" ",ka=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},d0=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},ut=function(s){const e={};if(!s)return e;const t=s.split(d0());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},El=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 h0 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=He(ka(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(i={type:"tag",tagType:"map"},t[1]){const a=ut(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=ka(a.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=ut(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=El(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=ut(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=ut(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=ut(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=ut(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(c0)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=ut(t[1]),["DURATION"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["INDEPENDENT","GAP"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=ka(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=ut(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=ut(t[1]),["PART-TARGET"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=ut(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(i.attributes.hasOwnProperty(a)){i.attributes[a]=parseInt(i.attributes[a],10);const u=a==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[u]=i.attributes[a],delete i.attributes[a]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=ut(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseInt(i.attributes[a],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=ut(t[1]),["ID","CLASS"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=String(i.attributes[u]))}),["START-DATE","END-DATE"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=new Date(i.attributes[u]))}),["DURATION","PLANNED-DURATION"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=parseFloat(i.attributes[u]))}),["END-ON-NEXT"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=/YES/i.test(i.attributes[u]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(u){i.attributes.hasOwnProperty(u)&&(i.attributes[u]=i.attributes[u].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const u in i.attributes){if(!a.test(u))continue;const 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=ut(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=ut(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=El(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){i={type:"tag",tagType:"define"},i.attributes=ut(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:r}){typeof i!="function"&&(i=n=>n),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:i(n),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const i=r=>e.test(r)?t(r):r;this.tagMappers.push(i)}}const f0=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ti=function(s){const e={};return Object.keys(s).forEach(function(t){e[f0(t)]=s[t]}),e},Ia=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:i}=s;if(!e)return;const r="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",u=t&&t*3,l=i&&i*2;t&&!e.hasOwnProperty(n)&&(e[n]=u,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${u}).`})),u&&e[n]<u&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${u})`}),e[n]=u),i&&!e.hasOwnProperty(a)&&(e[a]=i*3,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),i&&e[a]<l&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${l}).`}),e[a]=l)};class p0 extends Po{constructor(e={}){super(),this.lineStream=new l0,this.parseStream=new h0,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 I={};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(y){let P,N;if(t.manifest.definitions){for(const M in t.manifest.definitions)if(y.uri&&(y.uri=y.uri.replace(`{$${M}}`,t.manifest.definitions[M])),y.attributes)for(const L in y.attributes)typeof y.attributes[L]=="string"&&(y.attributes[L]=y.attributes[L].replace(`{$${M}}`,t.manifest.definitions[M]))}({tag(){({version(){y.version&&(this.manifest.version=y.version)},"allow-cache"(){this.manifest.allowCache=y.allowed,"allowed"in y||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const M={};"length"in y&&(r.byterange=M,M.length=y.length,"offset"in y||(y.offset=w)),"offset"in y&&(r.byterange=M,M.offset=y.offset),w=M.offset+M.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"})),y.title&&(r.title=y.title),y.duration>0&&(r.duration=y.duration),y.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!y.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(y.attributes.METHOD==="NONE"){a=null;return}if(!y.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(y.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:y.attributes};return}if(y.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:y.attributes.URI};return}if(y.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(y.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(y.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),y.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(y.attributes.KEYID&&y.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:y.attributes.KEYFORMAT,keyId:y.attributes.KEYID.substring(2)},pssh:sd(y.attributes.URI.split(",")[1])};return}y.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:y.attributes.METHOD||"AES-128",uri:y.attributes.URI},typeof y.attributes.IV<"u"&&(a.iv=y.attributes.IV)},"media-sequence"(){if(!isFinite(y.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+y.number});return}this.manifest.mediaSequence=y.number},"discontinuity-sequence"(){if(!isFinite(y.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+y.number});return}this.manifest.discontinuitySequence=y.number,_=y.number},"playlist-type"(){if(!/VOD|EVENT/.test(y.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+y.playlist});return}this.manifest.playlistType=y.playlistType},map(){n={},y.uri&&(n.uri=y.uri),y.byterange&&(n.byterange=y.byterange),a&&(n.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||f,!y.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),He(r.attributes,y.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||f,!(y.attributes&&y.attributes.TYPE&&y.attributes["GROUP-ID"]&&y.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const M=this.manifest.mediaGroups[y.attributes.TYPE];M[y.attributes["GROUP-ID"]]=M[y.attributes["GROUP-ID"]]||{},P=M[y.attributes["GROUP-ID"]],N={default:/yes/i.test(y.attributes.DEFAULT)},N.default?N.autoselect=!0:N.autoselect=/yes/i.test(y.attributes.AUTOSELECT),y.attributes.LANGUAGE&&(N.language=y.attributes.LANGUAGE),y.attributes.URI&&(N.uri=y.attributes.URI),y.attributes["INSTREAM-ID"]&&(N.instreamId=y.attributes["INSTREAM-ID"]),y.attributes.CHARACTERISTICS&&(N.characteristics=y.attributes.CHARACTERISTICS),y.attributes.FORCED&&(N.forced=/yes/i.test(y.attributes.FORCED)),P[y.attributes.NAME]=N},discontinuity(){_+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=y.dateTimeString,this.manifest.dateTimeObject=y.dateTimeObject),r.dateTimeString=y.dateTimeString,r.dateTimeObject=y.dateTimeObject;const{lastProgramDateTime:M}=this;this.lastProgramDateTime=new Date(y.dateTimeString).getTime(),M===null&&this.manifest.segments.reduceRight((L,B)=>(B.programDateTime=L-B.duration*1e3,B.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(y.duration)||y.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+y.duration});return}this.manifest.targetDuration=y.duration,Ia.call(this,this.manifest)},start(){if(!y.attributes||isNaN(y.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:y.attributes["TIME-OFFSET"],precise:y.attributes.PRECISE}},"cue-out"(){r.cueOut=y.data},"cue-out-cont"(){r.cueOutCont=y.data},"cue-in"(){r.cueIn=y.data},skip(){this.manifest.skip=Ti(y.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",y.attributes,["SKIPPED-SEGMENTS"])},part(){u=!0;const M=this.manifest.segments.length,L=Ti(y.attributes);r.parts=r.parts||[],r.parts.push(L),L.byterange&&(L.byterange.hasOwnProperty("offset")||(L.byterange.offset=x),x=L.byterange.offset+L.byterange.length);const B=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${B} for segment #${M}`,y.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((U,j)=>{U.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${j} lacks required attribute(s): LAST-PART`})})},"server-control"(){const M=this.manifest.serverControl=Ti(y.attributes);M.hasOwnProperty("canBlockReload")||(M.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Ia.call(this,this.manifest),M.canSkipDateranges&&!M.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 M=this.manifest.segments.length,L=Ti(y.attributes),B=L.type&&L.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(L),L.byterange&&(L.byterange.hasOwnProperty("offset")||(L.byterange.offset=B?x:0,B&&(x=L.byterange.offset+L.byterange.length)));const U=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${U} for segment #${M}`,y.attributes,["TYPE","URI"]),!!L.type)for(let j=0;j<r.preloadHints.length-1;j++){const O=r.preloadHints[j];O.type&&O.type===L.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${U} for segment #${M} has the same TYPE ${L.type} as preload hint #${j}`})}},"rendition-report"(){const M=Ti(y.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(M);const L=this.manifest.renditionReports.length-1,B=["LAST-MSN","URI"];u&&B.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${L}`,y.attributes,B)},"part-inf"(){this.manifest.partInf=Ti(y.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",y.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Ia.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Ti(y.attributes));const M=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${M}`,y.attributes,["ID","START-DATE"]);const L=this.manifest.dateRanges[M];L.endDate&&L.startDate&&new Date(L.endDate)<new Date(L.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),L.duration&&L.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),L.plannedDuration&&L.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const B=!!L.endOnNext;if(B&&!L.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),B&&(L.duration||L.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),L.duration&&L.endDate){const j=L.startDate.getTime()+L.duration*1e3;this.manifest.dateRanges[M].endDate=new Date(j)}if(!I[L.id])I[L.id]=L;else{for(const j in I[L.id])if(L[j]&&JSON.stringify(I[L.id][j])!==JSON.stringify(L[j])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const U=this.manifest.dateRanges.findIndex(j=>j.id===L.id);this.manifest.dateRanges[U]=He(this.manifest.dateRanges[U],L),I[L.id]=He(I[L.id],L),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(y.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",y.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const M=(L,B)=>{if(L in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${L}`});return}this.manifest.definitions[L]=B};if("QUERYPARAM"in y.attributes){if("NAME"in y.attributes||"IMPORT"in y.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const L=this.params.get(y.attributes.QUERYPARAM);if(!L){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${y.attributes.QUERYPARAM}`});return}M(y.attributes.QUERYPARAM,decodeURIComponent(L));return}if("NAME"in y.attributes){if("IMPORT"in y.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in y.attributes)||typeof y.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${y.attributes.NAME}`});return}M(y.attributes.NAME,y.attributes.VALUE);return}if("IMPORT"in y.attributes){if(!this.mainDefinitions[y.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${y.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}M(y.attributes.IMPORT,this.mainDefinitions[y.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:y.attributes,uri:y.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",y.attributes,["BANDWIDTH","URI"])}}[y.tagType]||l).call(t)},uri(){r.uri=y.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(){y.segment?(r.custom=r.custom||{},r.custom[y.customType]=y.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[y.customType]=y.data)}})[y.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^/},m0=["video","audio","text"],Cl=["Video","Audio","Text"],rd=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})},zt=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(r){r=r.trim();var n;m0.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},g0=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 zt(n.playlists[0].attributes.CODECS)}return null},nd=function(e){return e===void 0&&(e=""),$i.audio.test(e.trim().toLowerCase())},_0=function(e){return e===void 0&&(e=""),$i.text.test(e.trim().toLowerCase())},ys=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return rd(n.trim())}),i="video";t.length===1&&nd(t[0])?i="audio":t.length===1&&_0(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+'"'}},cr=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),D.MediaSource&&D.MediaSource.isTypeSupported&&D.MediaSource.isTypeSupported(ys(e))||t&&D.ManagedMediaSource&&D.ManagedMediaSource.isTypeSupported&&D.ManagedMediaSource.isTypeSupported(ys(e))||!1},Pa=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<Cl.length;i++){var r=Cl[i];if($i["muxer"+r].test(t))return!0}return!1})},wl="mp4a.40.2",y0="avc1.4d400d",T0=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,v0=/^application\/dash\+xml/i,ad=function(e){return T0.test(e)?"hls":v0.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},b0=function(e){return e.toString(2).length},x0=function(e){return Math.ceil(b0(e)/8)},od=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},S0=function(e){return od(e)},de=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!S0(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))},tt=D.BigInt||Number,io=[tt("0x1"),tt("0x100"),tt("0x10000"),tt("0x1000000"),tt("0x100000000"),tt("0x10000000000"),tt("0x1000000000000"),tt("0x100000000000000"),tt("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var E0=function(e,t){var i=t===void 0?{}:t,r=i.signed,n=r===void 0?!1:r,a=i.le,u=a===void 0?!1:a;e=de(e);var l=u?"reduce":"reduceRight",f=e[l]?e[l]:Array.prototype[l],m=f.call(e,function(w,x,I){var y=u?I:Math.abs(I+1-e.length);return w+tt(x)*io[y]},tt(0));if(n){var _=io[e.length]/tt(2)-tt(1);m=tt(m),m>_&&(m-=_,m-=_,m-=tt(2))}return Number(m)},C0=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=tt(e);for(var a=x0(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]&tt(255)),e<0&&(u[f]=Math.abs(~u[f]),u[f]-=l===0?1:2)}return u},ud=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},w0=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 de(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=de(u),n.set(u,a),a+=u.byteLength}),n},Me=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=de(e),t=de(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)}})},tr={},si={},Mi={},Al;function Bn(){if(Al)return Mi;Al=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 Dl;function ld(){if(Dl)return si;Dl=1;var s=Bn(),e=s.find,t=s.NAMESPACE;function i(T){return T!==""}function r(T){return T?T.split(/[\t\n\f\r ]+/).filter(i):[]}function n(T,b){return T.hasOwnProperty(b)||(T[b]=!0),T}function a(T){if(!T)return[];var b=r(T);return Object.keys(b.reduce(n,{}))}function u(T){return function(b){return T&&T.indexOf(b)!==-1}}function l(T,b){for(var R in T)Object.prototype.hasOwnProperty.call(T,R)&&(b[R]=T[R])}function f(T,b){var R=T.prototype;if(!(R instanceof b)){let G=function(){};G.prototype=b.prototype,G=new G,l(R,G),T.prototype=R=G}R.constructor!=T&&(typeof T!="function"&&console.error("unknown Class:"+T),R.constructor=T)}var m={},_=m.ELEMENT_NODE=1,w=m.ATTRIBUTE_NODE=2,x=m.TEXT_NODE=3,I=m.CDATA_SECTION_NODE=4,y=m.ENTITY_REFERENCE_NODE=5,P=m.ENTITY_NODE=6,N=m.PROCESSING_INSTRUCTION_NODE=7,M=m.COMMENT_NODE=8,L=m.DOCUMENT_NODE=9,B=m.DOCUMENT_TYPE_NODE=10,U=m.DOCUMENT_FRAGMENT_NODE=11,j=m.NOTATION_NODE=12,O={},V={};O.INDEX_SIZE_ERR=(V[1]="Index size error",1),O.DOMSTRING_SIZE_ERR=(V[2]="DOMString size error",2);var v=O.HIERARCHY_REQUEST_ERR=(V[3]="Hierarchy request error",3);O.WRONG_DOCUMENT_ERR=(V[4]="Wrong document",4),O.INVALID_CHARACTER_ERR=(V[5]="Invalid character",5),O.NO_DATA_ALLOWED_ERR=(V[6]="No data allowed",6),O.NO_MODIFICATION_ALLOWED_ERR=(V[7]="No modification allowed",7);var E=O.NOT_FOUND_ERR=(V[8]="Not found",8);O.NOT_SUPPORTED_ERR=(V[9]="Not supported",9);var q=O.INUSE_ATTRIBUTE_ERR=(V[10]="Attribute in use",10);O.INVALID_STATE_ERR=(V[11]="Invalid state",11),O.SYNTAX_ERR=(V[12]="Syntax error",12),O.INVALID_MODIFICATION_ERR=(V[13]="Invalid modification",13),O.NAMESPACE_ERR=(V[14]="Invalid namespace",14),O.INVALID_ACCESS_ERR=(V[15]="Invalid access",15);function H(T,b){if(b instanceof Error)var R=b;else R=this,Error.call(this,V[T]),this.message=V[T],Error.captureStackTrace&&Error.captureStackTrace(this,H);return R.code=T,b&&(this.message=this.message+": "+b),R}H.prototype=Error.prototype,l(O,H);function z(){}z.prototype={length:0,item:function(T){return T>=0&&T<this.length?this[T]:null},toString:function(T,b){for(var R=[],G=0;G<this.length;G++)mi(this[G],R,T,b);return R.join("")},filter:function(T){return Array.prototype.filter.call(this,T)},indexOf:function(T){return Array.prototype.indexOf.call(this,T)}};function K(T,b){this._node=T,this._refresh=b,te(this)}function te(T){var b=T._node._inc||T._node.ownerDocument._inc;if(T._inc!==b){var R=T._refresh(T._node);if(Pr(T,"length",R.length),!T.$$length||R.length<T.$$length)for(var G=R.length;G in T;G++)Object.prototype.hasOwnProperty.call(T,G)&&delete T[G];l(R,T),T._inc=b}}K.prototype.item=function(T){return te(this),this[T]||null},f(K,z);function re(){}function Y(T,b){for(var R=T.length;R--;)if(T[R]===b)return R}function ee(T,b,R,G){if(G?b[Y(b,G)]=R:b[b.length++]=R,T){R.ownerElement=T;var ae=T.ownerDocument;ae&&(G&&Ge(ae,T,G),he(ae,T,R))}}function Z(T,b,R){var G=Y(b,R);if(G>=0){for(var ae=b.length-1;G<ae;)b[G]=b[++G];if(b.length=ae,T){var me=T.ownerDocument;me&&(Ge(me,T,R),R.ownerElement=null)}}else throw new H(E,new Error(T.tagName+"@"+R))}re.prototype={length:0,item:z.prototype.item,getNamedItem:function(T){for(var b=this.length;b--;){var R=this[b];if(R.nodeName==T)return R}},setNamedItem:function(T){var b=T.ownerElement;if(b&&b!=this._ownerElement)throw new H(q);var R=this.getNamedItem(T.nodeName);return ee(this._ownerElement,this,T,R),R},setNamedItemNS:function(T){var b=T.ownerElement,R;if(b&&b!=this._ownerElement)throw new H(q);return R=this.getNamedItemNS(T.namespaceURI,T.localName),ee(this._ownerElement,this,T,R),R},removeNamedItem:function(T){var b=this.getNamedItem(T);return Z(this._ownerElement,this,b),b},removeNamedItemNS:function(T,b){var R=this.getNamedItemNS(T,b);return Z(this._ownerElement,this,R),R},getNamedItemNS:function(T,b){for(var R=this.length;R--;){var G=this[R];if(G.localName==b&&G.namespaceURI==T)return G}return null}};function ie(){}ie.prototype={hasFeature:function(T,b){return!0},createDocument:function(T,b,R){var G=new ye;if(G.implementation=this,G.childNodes=new z,G.doctype=R||null,R&&G.appendChild(R),b){var ae=G.createElementNS(T,b);G.appendChild(ae)}return G},createDocumentType:function(T,b,R){var G=new pi;return G.name=T,G.nodeName=T,G.publicId=b||"",G.systemId=R||"",G}};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(T,b){return Et(this,T,b)},replaceChild:function(T,b){Et(this,T,b,gt),b&&this.removeChild(b)},removeChild:function(T){return je(this,T)},appendChild:function(T){return this.insertBefore(T,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(T){return Fs(this.ownerDocument||this,this,T)},normalize:function(){for(var T=this.firstChild;T;){var b=T.nextSibling;b&&b.nodeType==x&&T.nodeType==x?(this.removeChild(b),T.appendData(b.data)):(T.normalize(),T=b)}},isSupported:function(T,b){return this.ownerDocument.implementation.hasFeature(T,b)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(T){for(var b=this;b;){var R=b._nsMap;if(R){for(var G in R)if(Object.prototype.hasOwnProperty.call(R,G)&&R[G]===T)return G}b=b.nodeType==w?b.ownerDocument:b.parentNode}return null},lookupNamespaceURI:function(T){for(var b=this;b;){var R=b._nsMap;if(R&&Object.prototype.hasOwnProperty.call(R,T))return R[T];b=b.nodeType==w?b.ownerDocument:b.parentNode}return null},isDefaultNamespace:function(T){var b=this.lookupPrefix(T);return b==null}};function pe(T){return T=="<"&&"&lt;"||T==">"&&"&gt;"||T=="&"&&"&amp;"||T=='"'&&"&quot;"||"&#"+T.charCodeAt()+";"}l(m,se),l(m,se.prototype);function ge(T,b){if(b(T))return!0;if(T=T.firstChild)do if(ge(T,b))return!0;while(T=T.nextSibling)}function ye(){this.ownerDocument=this}function he(T,b,R){T&&T._inc++;var G=R.namespaceURI;G===t.XMLNS&&(b._nsMap[R.prefix?R.localName:""]=R.value)}function Ge(T,b,R,G){T&&T._inc++;var ae=R.namespaceURI;ae===t.XMLNS&&delete b._nsMap[R.prefix?R.localName:""]}function We(T,b,R){if(T&&T._inc){T._inc++;var G=b.childNodes;if(R)G[G.length++]=R;else{for(var ae=b.firstChild,me=0;ae;)G[me++]=ae,ae=ae.nextSibling;G.length=me,delete G[G.length]}}}function je(T,b){var R=b.previousSibling,G=b.nextSibling;return R?R.nextSibling=G:T.firstChild=G,G?G.previousSibling=R:T.lastChild=R,b.parentNode=null,b.previousSibling=null,b.nextSibling=null,We(T.ownerDocument,T),b}function ke(T){return T&&(T.nodeType===se.DOCUMENT_NODE||T.nodeType===se.DOCUMENT_FRAGMENT_NODE||T.nodeType===se.ELEMENT_NODE)}function St(T){return T&&(at(T)||ci(T)||et(T)||T.nodeType===se.DOCUMENT_FRAGMENT_NODE||T.nodeType===se.COMMENT_NODE||T.nodeType===se.PROCESSING_INSTRUCTION_NODE)}function et(T){return T&&T.nodeType===se.DOCUMENT_TYPE_NODE}function at(T){return T&&T.nodeType===se.ELEMENT_NODE}function ci(T){return T&&T.nodeType===se.TEXT_NODE}function Ke(T,b){var R=T.childNodes||[];if(e(R,at)||et(b))return!1;var G=e(R,et);return!(b&&G&&R.indexOf(G)>R.indexOf(b))}function di(T,b){var R=T.childNodes||[];function G(me){return at(me)&&me!==b}if(e(R,G))return!1;var ae=e(R,et);return!(b&&ae&&R.indexOf(ae)>R.indexOf(b))}function Xe(T,b,R){if(!ke(T))throw new H(v,"Unexpected parent node type "+T.nodeType);if(R&&R.parentNode!==T)throw new H(E,"child not in parent");if(!St(b)||et(b)&&T.nodeType!==se.DOCUMENT_NODE)throw new H(v,"Unexpected node type "+b.nodeType+" for parent node type "+T.nodeType)}function Ki(T,b,R){var G=T.childNodes||[],ae=b.childNodes||[];if(b.nodeType===se.DOCUMENT_FRAGMENT_NODE){var me=ae.filter(at);if(me.length>1||e(ae,ci))throw new H(v,"More than one element or text in fragment");if(me.length===1&&!Ke(T,R))throw new H(v,"Element in fragment can not be inserted before doctype")}if(at(b)&&!Ke(T,R))throw new H(v,"Only one element can be added and only after doctype");if(et(b)){if(e(G,et))throw new H(v,"Only one doctype is allowed");var De=e(G,at);if(R&&G.indexOf(De)<G.indexOf(R))throw new H(v,"Doctype can only be inserted before an element");if(!R&&De)throw new H(v,"Doctype can not be appended since element is present")}}function gt(T,b,R){var G=T.childNodes||[],ae=b.childNodes||[];if(b.nodeType===se.DOCUMENT_FRAGMENT_NODE){var me=ae.filter(at);if(me.length>1||e(ae,ci))throw new H(v,"More than one element or text in fragment");if(me.length===1&&!di(T,R))throw new H(v,"Element in fragment can not be inserted before doctype")}if(at(b)&&!di(T,R))throw new H(v,"Only one element can be added and only after doctype");if(et(b)){if(e(G,function(_t){return et(_t)&&_t!==R}))throw new H(v,"Only one doctype is allowed");var De=e(G,at);if(R&&G.indexOf(De)<G.indexOf(R))throw new H(v,"Doctype can only be inserted before an element")}}function Et(T,b,R,G){Xe(T,b,R),T.nodeType===se.DOCUMENT_NODE&&(G||Ki)(T,b,R);var ae=b.parentNode;if(ae&&ae.removeChild(b),b.nodeType===U){var me=b.firstChild;if(me==null)return b;var De=b.lastChild}else me=De=b;var it=R?R.previousSibling:T.lastChild;me.previousSibling=it,De.nextSibling=R,it?it.nextSibling=me:T.firstChild=me,R==null?T.lastChild=De:R.previousSibling=De;do{me.parentNode=T;var _t=T.ownerDocument||T;be(me,_t)}while(me!==De&&(me=me.nextSibling));return We(T.ownerDocument||T,T),b.nodeType==U&&(b.firstChild=b.lastChild=null),b}function be(T,b){if(T.ownerDocument!==b){if(T.ownerDocument=b,T.nodeType===_&&T.attributes)for(var R=0;R<T.attributes.length;R++){var G=T.attributes.item(R);G&&(G.ownerDocument=b)}for(var ae=T.firstChild;ae;)be(ae,b),ae=ae.nextSibling}}function Le(T,b){b.parentNode&&b.parentNode.removeChild(b),b.parentNode=T,b.previousSibling=T.lastChild,b.nextSibling=null,b.previousSibling?b.previousSibling.nextSibling=b:T.firstChild=b,T.lastChild=b,We(T.ownerDocument,T,b);var R=T.ownerDocument||T;return be(b,R),b}ye.prototype={nodeName:"#document",nodeType:L,doctype:null,documentElement:null,_inc:1,insertBefore:function(T,b){if(T.nodeType==U){for(var R=T.firstChild;R;){var G=R.nextSibling;this.insertBefore(R,b),R=G}return T}return Et(this,T,b),be(T,this),this.documentElement===null&&T.nodeType===_&&(this.documentElement=T),T},removeChild:function(T){return this.documentElement==T&&(this.documentElement=null),je(this,T)},replaceChild:function(T,b){Et(this,T,b,gt),be(T,this),b&&this.removeChild(b),at(T)&&(this.documentElement=T)},importNode:function(T,b){return Ir(this,T,b)},getElementById:function(T){var b=null;return ge(this.documentElement,function(R){if(R.nodeType==_&&R.getAttribute("id")==T)return b=R,!0}),b},getElementsByClassName:function(T){var b=a(T);return new K(this,function(R){var G=[];return b.length>0&&ge(R.documentElement,function(ae){if(ae!==R&&ae.nodeType===_){var me=ae.getAttribute("class");if(me){var De=T===me;if(!De){var it=a(me);De=b.every(u(it))}De&&G.push(ae)}}}),G})},createElement:function(T){var b=new Re;b.ownerDocument=this,b.nodeName=T,b.tagName=T,b.localName=T,b.childNodes=new z;var R=b.attributes=new re;return R._ownerElement=b,b},createDocumentFragment:function(){var T=new Se;return T.ownerDocument=this,T.childNodes=new z,T},createTextNode:function(T){var b=new ki;return b.ownerDocument=this,b.appendData(T),b},createComment:function(T){var b=new Ii;return b.ownerDocument=this,b.appendData(T),b},createCDATASection:function(T){var b=new fi;return b.ownerDocument=this,b.appendData(T),b},createProcessingInstruction:function(T,b){var R=new Ms;return R.ownerDocument=this,R.tagName=R.nodeName=R.target=T,R.nodeValue=R.data=b,R},createAttribute:function(T){var b=new hi;return b.ownerDocument=this,b.name=T,b.nodeName=T,b.localName=T,b.specified=!0,b},createEntityReference:function(T){var b=new Yi;return b.ownerDocument=this,b.nodeName=T,b},createElementNS:function(T,b){var R=new Re,G=b.split(":"),ae=R.attributes=new re;return R.childNodes=new z,R.ownerDocument=this,R.nodeName=b,R.tagName=b,R.namespaceURI=T,G.length==2?(R.prefix=G[0],R.localName=G[1]):R.localName=b,ae._ownerElement=R,R},createAttributeNS:function(T,b){var R=new hi,G=b.split(":");return R.ownerDocument=this,R.nodeName=b,R.name=b,R.namespaceURI=T,R.specified=!0,G.length==2?(R.prefix=G[0],R.localName=G[1]):R.localName=b,R}},f(ye,se);function Re(){this._nsMap={}}Re.prototype={nodeType:_,hasAttribute:function(T){return this.getAttributeNode(T)!=null},getAttribute:function(T){var b=this.getAttributeNode(T);return b&&b.value||""},getAttributeNode:function(T){return this.attributes.getNamedItem(T)},setAttribute:function(T,b){var R=this.ownerDocument.createAttribute(T);R.value=R.nodeValue=""+b,this.setAttributeNode(R)},removeAttribute:function(T){var b=this.getAttributeNode(T);b&&this.removeAttributeNode(b)},appendChild:function(T){return T.nodeType===U?this.insertBefore(T,null):Le(this,T)},setAttributeNode:function(T){return this.attributes.setNamedItem(T)},setAttributeNodeNS:function(T){return this.attributes.setNamedItemNS(T)},removeAttributeNode:function(T){return this.attributes.removeNamedItem(T.nodeName)},removeAttributeNS:function(T,b){var R=this.getAttributeNodeNS(T,b);R&&this.removeAttributeNode(R)},hasAttributeNS:function(T,b){return this.getAttributeNodeNS(T,b)!=null},getAttributeNS:function(T,b){var R=this.getAttributeNodeNS(T,b);return R&&R.value||""},setAttributeNS:function(T,b,R){var G=this.ownerDocument.createAttributeNS(T,b);G.value=G.nodeValue=""+R,this.setAttributeNode(G)},getAttributeNodeNS:function(T,b){return this.attributes.getNamedItemNS(T,b)},getElementsByTagName:function(T){return new K(this,function(b){var R=[];return ge(b,function(G){G!==b&&G.nodeType==_&&(T==="*"||G.tagName==T)&&R.push(G)}),R})},getElementsByTagNameNS:function(T,b){return new K(this,function(R){var G=[];return ge(R,function(ae){ae!==R&&ae.nodeType===_&&(T==="*"||ae.namespaceURI===T)&&(b==="*"||ae.localName==b)&&G.push(ae)}),G})}},ye.prototype.getElementsByTagName=Re.prototype.getElementsByTagName,ye.prototype.getElementsByTagNameNS=Re.prototype.getElementsByTagNameNS,f(Re,se);function hi(){}hi.prototype.nodeType=w,f(hi,se);function ei(){}ei.prototype={data:"",substringData:function(T,b){return this.data.substring(T,T+b)},appendData:function(T){T=this.data+T,this.nodeValue=this.data=T,this.length=T.length},insertData:function(T,b){this.replaceData(T,0,b)},appendChild:function(T){throw new Error(V[v])},deleteData:function(T,b){this.replaceData(T,b,"")},replaceData:function(T,b,R){var G=this.data.substring(0,T),ae=this.data.substring(T+b);R=G+R+ae,this.nodeValue=this.data=R,this.length=R.length}},f(ei,se);function ki(){}ki.prototype={nodeName:"#text",nodeType:x,splitText:function(T){var b=this.data,R=b.substring(T);b=b.substring(0,T),this.data=this.nodeValue=b,this.length=b.length;var G=this.ownerDocument.createTextNode(R);return this.parentNode&&this.parentNode.insertBefore(G,this.nextSibling),G}},f(ki,ei);function Ii(){}Ii.prototype={nodeName:"#comment",nodeType:M},f(Ii,ei);function fi(){}fi.prototype={nodeName:"#cdata-section",nodeType:I},f(fi,ei);function pi(){}pi.prototype.nodeType=B,f(pi,se);function Rs(){}Rs.prototype.nodeType=j,f(Rs,se);function Ns(){}Ns.prototype.nodeType=P,f(Ns,se);function Yi(){}Yi.prototype.nodeType=y,f(Yi,se);function Se(){}Se.prototype.nodeName="#document-fragment",Se.prototype.nodeType=U,f(Se,se);function Ms(){}Ms.prototype.nodeType=N,f(Ms,se);function Pi(){}Pi.prototype.serializeToString=function(T,b,R){return Dr.call(T,b,R)},se.prototype.toString=Dr;function Dr(T,b){var R=[],G=this.nodeType==9&&this.documentElement||this,ae=G.prefix,me=G.namespaceURI;if(me&&ae==null){var ae=G.lookupPrefix(me);if(ae==null)var De=[{namespace:me,prefix:null}]}return mi(this,R,T,b,De),R.join("")}function kr(T,b,R){var G=T.prefix||"",ae=T.namespaceURI;if(!ae||G==="xml"&&ae===t.XML||ae===t.XMLNS)return!1;for(var me=R.length;me--;){var De=R[me];if(De.prefix===G)return De.namespace!==ae}return!0}function Bs(T,b,R){T.push(" ",b,'="',R.replace(/[<>&"\t\n\r]/g,pe),'"')}function mi(T,b,R,G,ae){if(ae||(ae=[]),G)if(T=G(T),T){if(typeof T=="string"){b.push(T);return}}else return;switch(T.nodeType){case _:var me=T.attributes,De=me.length,Ie=T.firstChild,it=T.tagName;R=t.isHTML(T.namespaceURI)||R;var _t=it;if(!R&&!T.prefix&&T.namespaceURI){for(var qt,Ct=0;Ct<me.length;Ct++)if(me.item(Ct).name==="xmlns"){qt=me.item(Ct).value;break}if(!qt)for(var Rt=ae.length-1;Rt>=0;Rt--){var wt=ae[Rt];if(wt.prefix===""&&wt.namespace===T.namespaceURI){qt=wt.namespace;break}}if(qt!==T.namespaceURI)for(var Rt=ae.length-1;Rt>=0;Rt--){var wt=ae[Rt];if(wt.namespace===T.namespaceURI){wt.prefix&&(_t=wt.prefix+":"+it);break}}}b.push("<",_t);for(var qe=0;qe<De;qe++){var At=me.item(qe);At.prefix=="xmlns"?ae.push({prefix:At.localName,namespace:At.value}):At.nodeName=="xmlns"&&ae.push({prefix:"",namespace:At.value})}for(var qe=0;qe<De;qe++){var At=me.item(qe);if(kr(At,R,ae)){var ti=At.prefix||"",$t=At.namespaceURI;Bs(b,ti?"xmlns:"+ti:"xmlns",$t),ae.push({prefix:ti,namespace:$t})}mi(At,b,R,G,ae)}if(it===_t&&kr(T,R,ae)){var ti=T.prefix||"",$t=T.namespaceURI;Bs(b,ti?"xmlns:"+ti:"xmlns",$t),ae.push({prefix:ti,namespace:$t})}if(Ie||R&&!/^(?:meta|link|img|br|hr|input)$/i.test(it)){if(b.push(">"),R&&/^script$/i.test(it))for(;Ie;)Ie.data?b.push(Ie.data):mi(Ie,b,R,G,ae.slice()),Ie=Ie.nextSibling;else for(;Ie;)mi(Ie,b,R,G,ae.slice()),Ie=Ie.nextSibling;b.push("</",_t,">")}else b.push("/>");return;case L:case U:for(var Ie=T.firstChild;Ie;)mi(Ie,b,R,G,ae.slice()),Ie=Ie.nextSibling;return;case w:return Bs(b,T.name,T.value);case x:return b.push(T.data.replace(/[<&>]/g,pe));case I:return b.push("<![CDATA[",T.data,"]]>");case M:return b.push("<!--",T.data,"-->");case B:var Li=T.publicId,xe=T.systemId;if(b.push("<!DOCTYPE ",T.name),Li)b.push(" PUBLIC ",Li),xe&&xe!="."&&b.push(" ",xe),b.push(">");else if(xe&&xe!=".")b.push(" SYSTEM ",xe,">");else{var Lr=T.internalSubset;Lr&&b.push(" [",Lr,"]"),b.push(">")}return;case N:return b.push("<?",T.target," ",T.data,"?>");case y:return b.push("&",T.nodeName,";");default:b.push("??",T.nodeName)}}function Ir(T,b,R){var G;switch(b.nodeType){case _:G=b.cloneNode(!1),G.ownerDocument=T;case U:break;case w:R=!0;break}if(G||(G=b.cloneNode(!1)),G.ownerDocument=T,G.parentNode=null,R)for(var ae=b.firstChild;ae;)G.appendChild(Ir(T,ae,R)),ae=ae.nextSibling;return G}function Fs(T,b,R){var G=new b.constructor;for(var ae in b)if(Object.prototype.hasOwnProperty.call(b,ae)){var me=b[ae];typeof me!="object"&&me!=G[ae]&&(G[ae]=me)}switch(b.childNodes&&(G.childNodes=new z),G.ownerDocument=T,G.nodeType){case _:var De=b.attributes,it=G.attributes=new re,_t=De.length;it._ownerElement=G;for(var qt=0;qt<_t;qt++)G.setAttributeNode(Fs(T,De.item(qt),!0));break;case w:R=!0}if(R)for(var Ct=b.firstChild;Ct;)G.appendChild(Fs(T,Ct,R)),Ct=Ct.nextSibling;return G}function Pr(T,b,R){T[b]=R}try{if(Object.defineProperty){let T=function(b){switch(b.nodeType){case _:case U:var R=[];for(b=b.firstChild;b;)b.nodeType!==7&&b.nodeType!==8&&R.push(T(b)),b=b.nextSibling;return R.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 T(this)},set:function(b){switch(this.nodeType){case _:case U: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}}}),Pr=function(b,R,G){b["$$"+R]=G}}}catch{}return si.DocumentType=pi,si.DOMException=H,si.DOMImplementation=ie,si.Element=Re,si.Node=se,si.NodeList=z,si.XMLSerializer=Pi,si}var ir={},La={},kl;function D0(){return kl||(kl=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})(La)),La}var rn={},Il;function k0(){if(Il)return rn;Il=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,q){var H=this.domBuilder;H.startDocument(),B(E,E={}),I(v,E,q,H,this.errorHandler),H.endDocument()}};function I(v,E,q,H,z){function K(Le){if(Le>65535){Le-=65536;var Re=55296+(Le>>10),hi=56320+(Le&1023);return String.fromCharCode(Re,hi)}else return String.fromCharCode(Le)}function te(Le){var Re=Le.slice(1,-1);return Object.hasOwnProperty.call(q,Re)?q[Re]:Re.charAt(0)==="#"?K(parseInt(Re.substr(1).replace("x","0x"))):(z.error("entity not found:"+Le),Le)}function re(Le){if(Le>ye){var Re=v.substring(ye,Le).replace(/&#?\w+;/g,te);se&&Y(ye),H.characters(Re,0,Le-ye),ye=Le}}function Y(Le,Re){for(;Le>=Z&&(Re=ie.exec(v));)ee=Re.index,Z=ee+Re[0].length,se.lineNumber++;se.columnNumber=Le-ee+1}for(var ee=0,Z=0,ie=/.*(?:\r\n?|\n)|.*$/g,se=H.locator,pe=[{currentNSMap:E}],ge={},ye=0;;){try{var he=v.indexOf("<",ye);if(he<0){if(!v.substr(ye).match(/^\s*$/)){var Ge=H.doc,We=Ge.createTextNode(v.substr(ye));Ge.appendChild(We),H.currentElement=We}return}switch(he>ye&&re(he),v.charAt(he+1)){case"/":var Xe=v.indexOf(">",he+3),je=v.substring(he+2,Xe).replace(/[ \t\n\r]+$/g,""),ke=pe.pop();Xe<0?(je=v.substring(he+2).replace(/[\s<].*/,""),z.error("end tag name: "+je+" is not complete:"+ke.tagName),Xe=he+1+je.length):je.match(/\s</)&&(je=je.replace(/[\s<].*/,""),z.error("end tag name: "+je+" maybe not complete"),Xe=he+1+je.length);var St=ke.localNSMap,et=ke.tagName==je,at=et||ke.tagName&&ke.tagName.toLowerCase()==je.toLowerCase();if(at){if(H.endElement(ke.uri,ke.localName,je),St)for(var ci in St)Object.prototype.hasOwnProperty.call(St,ci)&&H.endPrefixMapping(ci);et||z.fatalError("end tag name: "+je+" is not match the current start tagName:"+ke.tagName)}else pe.push(ke);Xe++;break;case"?":se&&Y(he),Xe=j(v,he,H);break;case"!":se&&Y(he),Xe=U(v,he,H,z);break;default:se&&Y(he);var Ke=new O,di=pe[pe.length-1].currentNSMap,Xe=P(v,he,Ke,di,te,z),Ki=Ke.length;if(!Ke.closed&&L(v,Xe,Ke.tagName,ge)&&(Ke.closed=!0,q.nbsp||z.warning("unclosed xml attribute")),se&&Ki){for(var gt=y(se,{}),Et=0;Et<Ki;Et++){var be=Ke[Et];Y(be.offset),be.locator=y(se,{})}H.locator=gt,N(Ke,H,di)&&pe.push(Ke),H.locator=se}else N(Ke,H,di)&&pe.push(Ke);s.isHTML(Ke.uri)&&!Ke.closed?Xe=M(v,Xe,Ke.tagName,te,H):Xe++}}catch(Le){if(Le instanceof w)throw Le;z.error("element parse error: "+Le),Xe=-1}Xe>ye?ye=Xe:re(Math.max(he,ye)+1)}}function y(v,E){return E.lineNumber=v.lineNumber,E.columnNumber=v.columnNumber,E}function P(v,E,q,H,z,K){function te(se,pe,ge){q.attributeNames.hasOwnProperty(se)&&K.fatalError("Attribute "+se+" redefined"),q.addValue(se,pe.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,z),ge)}for(var re,Y,ee=++E,Z=r;;){var ie=v.charAt(ee);switch(ie){case"=":if(Z===n)re=v.slice(E,ee),Z=u;else if(Z===a)Z=u;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(Z===u||Z===n)if(Z===n&&(K.warning('attribute value must after "="'),re=v.slice(E,ee)),E=ee+1,ee=v.indexOf(ie,E),ee>0)Y=v.slice(E,ee),te(re,Y,E-1),Z=f;else throw new Error("attribute value no end '"+ie+"' match");else if(Z==l)Y=v.slice(E,ee),te(re,Y,E),K.warning('attribute "'+re+'" missed start quot('+ie+")!!"),E=ee+1,Z=f;else throw new Error('attribute value must after "="');break;case"/":switch(Z){case r:q.setTagName(v.slice(E,ee));case f:case m:case _:Z=_,q.closed=!0;case l:case n:break;case a:q.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return K.error("unexpected end of input"),Z==r&&q.setTagName(v.slice(E,ee)),ee;case">":switch(Z){case r:q.setTagName(v.slice(E,ee));case f:case m:case _:break;case l:case n:Y=v.slice(E,ee),Y.slice(-1)==="/"&&(q.closed=!0,Y=Y.slice(0,-1));case a:Z===a&&(Y=re),Z==l?(K.warning('attribute "'+Y+'" missed quot(")!'),te(re,Y,E)):((!s.isHTML(H[""])||!Y.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+Y+'" missed value!! "'+Y+'" instead!!'),te(Y,Y,E));break;case u:throw new Error("attribute value missed!!")}return ee;case"€":ie=" ";default:if(ie<=" ")switch(Z){case r:q.setTagName(v.slice(E,ee)),Z=m;break;case n:re=v.slice(E,ee),Z=a;break;case l:var Y=v.slice(E,ee);K.warning('attribute "'+Y+'" missed quot(")!!'),te(re,Y,E);case f:Z=m;break}else switch(Z){case a:q.tagName,(!s.isHTML(H[""])||!re.match(/^(?:disabled|checked|selected)$/i))&&K.warning('attribute "'+re+'" missed value!! "'+re+'" instead2!!'),te(re,re,E),E=ee,Z=n;break;case f:K.warning('attribute space is required"'+re+'"!!');case m:Z=n,E=ee;break;case u:Z=l,E=ee;break;case _:throw new Error("elements closed character '/' and '>' must be connected to")}}ee++}}function N(v,E,q){for(var H=v.tagName,z=null,ie=v.length;ie--;){var K=v[ie],te=K.qName,re=K.value,se=te.indexOf(":");if(se>0)var Y=K.prefix=te.slice(0,se),ee=te.slice(se+1),Z=Y==="xmlns"&&ee;else ee=te,Y=null,Z=te==="xmlns"&&"";K.localName=ee,Z!==!1&&(z==null&&(z={},B(q,q={})),q[Z]=z[Z]=re,K.uri=s.XMLNS,E.startPrefixMapping(Z,re))}for(var ie=v.length;ie--;){K=v[ie];var Y=K.prefix;Y&&(Y==="xml"&&(K.uri=s.XML),Y!=="xmlns"&&(K.uri=q[Y||""]))}var se=H.indexOf(":");se>0?(Y=v.prefix=H.slice(0,se),ee=v.localName=H.slice(se+1)):(Y=null,ee=v.localName=H);var pe=v.uri=q[Y||""];if(E.startElement(pe,ee,H,v),v.closed){if(E.endElement(pe,ee,H),z)for(Y in z)Object.prototype.hasOwnProperty.call(z,Y)&&E.endPrefixMapping(Y)}else return v.currentNSMap=q,v.localNSMap=z,!0}function M(v,E,q,H,z){if(/^(?:script|textarea)$/i.test(q)){var K=v.indexOf("</"+q+">",E),te=v.substring(E+1,K);if(/[&<]/.test(te))return/^script$/i.test(q)?(z.characters(te,0,te.length),K):(te=te.replace(/&#?\w+;/g,H),z.characters(te,0,te.length),K)}return E+1}function L(v,E,q,H){var z=H[q];return z==null&&(z=v.lastIndexOf("</"+q+">"),z<E&&(z=v.lastIndexOf("</"+q)),H[q]=z),z<E}function B(v,E){for(var q in v)Object.prototype.hasOwnProperty.call(v,q)&&(E[q]=v[q])}function U(v,E,q,H){var z=v.charAt(E+2);switch(z){case"-":if(v.charAt(E+3)==="-"){var K=v.indexOf("-->",E+4);return K>E?(q.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 q.startCDATA(),q.characters(v,E+9,K-E-9),q.endCDATA(),K+3}var te=V(v,E),re=te.length;if(re>1&&/!doctype/i.test(te[0][0])){var Y=te[1][0],ee=!1,Z=!1;re>3&&(/^public$/i.test(te[2][0])?(ee=te[3][0],Z=re>4&&te[4][0]):/^system$/i.test(te[2][0])&&(Z=te[3][0]));var ie=te[re-1];return q.startDTD(Y,ee,Z),q.endDTD(),ie.index+ie[0].length}}return-1}function j(v,E,q){var H=v.indexOf("?>",E);if(H){var z=v.substring(E,H).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return z?(z[0].length,q.processingInstruction(z[1],z[2]),H+2):-1}return-1}function O(){this.attributeNames={}}O.prototype={setTagName:function(v){if(!i.test(v))throw new Error("invalid tagName:"+v);this.tagName=v},addValue:function(v,E,q){if(!i.test(v))throw new Error("invalid attribute:"+v);this.attributeNames[v]=this.length,this[this.length++]={qName:v,value:E,offset:q}},length:0,getLocalName:function(v){return this[v].localName},getLocator:function(v){return this[v].locator},getQName:function(v){return this[v].qName},getURI:function(v){return this[v].uri},getValue:function(v){return this[v].value}};function V(v,E){var q,H=[],z=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(z.lastIndex=E,z.exec(v);q=z.exec(v);)if(H.push(q),q[1])return H}return rn.XMLReader=x,rn.ParseError=w,rn}var Pl;function I0(){if(Pl)return ir;Pl=1;var s=Bn(),e=ld(),t=D0(),i=k0(),r=e.DOMImplementation,n=s.NAMESPACE,a=i.ParseError,u=i.XMLReader;function l(P){return P.replace(/\r[\n\u0085]/g,`
15
15
  `).replace(/[\r\u0085\u2028]/g,`
16
- `)}function f(I){this.options=I||{locator:{}}}f.prototype.parseFromString=function(I,M){var N=this.options,O=new u,F=N.domBuilder||new _,q=N.errorHandler,j=N.locator,R=N.xmlns||{},G=/\/x?html?$/.test(M),v=G?t.HTML_ENTITIES:t.XML_ENTITIES;j&&F.setDocumentLocator(j),O.errorHandler=m(q,F,j),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 q(j){var R=I[j];!R&&F&&(R=I.length==2?function(G){I(j,G)}:I),O[j]=R&&function(G){R("[xmldom "+j+"] "+G+x(N))}||function(){}}return q("warning"),q("error"),q("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,q=F.createElementNS(I,N||M),j=O.length;T(this,q),this.currentElement=q,this.locator&&w(this.locator,q);for(var R=0;R<j;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,q.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 Dl;function d0(){if(Dl)return er;Dl=1;var s=nd();return er.DOMImplementation=s.DOMImplementation,er.XMLSerializer=s.XMLSerializer,er.DOMParser=c0().DOMParser,er}var h0=d0();const kl=s=>!!s&&typeof s=="object",tt=(...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]=tt(e[i],t[i]):e[i]=t[i]}),e),{}),ad=s=>Object.keys(s).map(e=>s[e]),f0=(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),[]),od=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},p0=(s,e)=>s.reduce((t,i,r)=>(i[e]&&t.push(r),t),[]),m0=(s,e)=>ad(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},g0=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),_0={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)}}},y0=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}=_0[e](s),l=f0(a,u).map(y0(s));if(e==="static"){const f=l.length-1,m=typeof r=="number"?r:n;l[f].duration=m-t/i*f}return l},ud=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 q=`${T}-${F}`,R=ud({baseUrl:t,timescale:l,timeline:n,periodStart:w,presentationTime:x,number:P,duration:O,sourceDuration:r,indexRange:q,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},T0=["AUDIO","SUBTITLES"],v0=1/60,ld=s=>m0(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),b0=(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 o0(s,T0,(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})},x0=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:l}){return l===i.timeline});const r=b0(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)<v0});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})})},S0=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Pl(s)),i=e.playlists.concat(Pl(e));return e.timelineStarts=ld([s.timelineStarts,e.timelineStarts]),x0({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Fn=s=>s&&s.uri+"-"+g0(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=ad(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=p0(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},E0=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Oo(s[t],e);return s},C0=({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},w0=({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},A0=(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(C0(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},D0=(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(w0(i),e)),t},{}),k0=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),{}),I0=({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},P0=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",L0=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",O0=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",R0=(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)},[]):[],N0=({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(P0)).map(I0),_=Na(s.filter(L0)),w=Na(s.filter(O0)),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:E0(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?A0(_,i,T):null,M=w.length?D0(w,i):null,N=m.concat(Ol(I),Ol(M)),O=N.map(({timelineStarts:F})=>F);return P.timelineStarts=ld(O),R0(N,P.timelineStarts),I&&(P.mediaGroups.AUDIO.audio=I),M&&(P.mediaGroups.SUBTITLES.subs=M),x.length&&(P.mediaGroups["CLOSED-CAPTIONS"].cc=k0(x)),r?S0({oldManifest:r,newManifest:P}):P},M0=(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)},cd=(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=M0(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},B0=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,F0=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(B0,F0(e)),U0=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Po(s):cd(s,e),j0=(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 U0(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}})},q0=(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},$0=(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=>q0(s,l));let a;return t&&(a=Po(s)),e&&(a=cd(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)},V0=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=j0,t=tt(s,e.template)):e.base?(i=ud,t=tt(s,e.base)):e.list&&(i=$0,t=tt(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},H0=s=>s.map(V0),je=(s,e)=>od(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)},G0=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 G0(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}},Ye=s=>s&&s.attributes?od(s.attributes).reduce((e,t)=>{const i=Nl[t.name]||Nl.DEFAULT;return e[t.name]=i(t.value),e},{}):{},W0={"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=tt(Ye(i),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,Ro=s=>{const e=je(s,"SegmentTemplate")[0],t=je(s,"SegmentList")[0],i=t&&je(t,"SegmentURL").map(_=>tt({tag:"SegmentURL"},Ye(_))),r=je(s,"SegmentBase")[0],n=t||e,a=n&&je(n,"SegmentTimeline")[0],u=t||r||e,l=u&&je(u,"Initialization")[0],f=e&&Ye(e);f&&l?f.initialization=l&&Ye(l):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const m={template:f,segmentTimeline:a&&je(a,"S").map(_=>Ye(_)),list:t&&tt(Ye(t),{segmentUrls:i,initialization:Ye(l)}),base:r&&tt(Ye(r),{initialization:Ye(l)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},X0=(s,e,t)=>i=>{const r=je(i,"BaseURL"),n=Un(e,r),a=tt(s,Ye(i)),u=Ro(i);return n.map(l=>({segmentInfo:tt(t,u),attributes:tt(a,l)}))},K0=s=>s.reduce((e,t)=>{const i=Ye(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const r=W0[i.schemeIdUri];if(r){e[r]={attributes:i};const n=je(t,"cenc:pssh")[0];if(n){const a=br(n);e[r].pssh=a&&Zc(a)}}return e},{}),Y0=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})},Q0=s=>ys(je(s.node,"EventStream").map(e=>{const t=Ye(e),i=t.schemeIdUri;return je(e,"Event").map(r=>{const n=Ye(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}})})),J0=(s,e,t)=>i=>{const r=Ye(i),n=Un(e,je(i,"BaseURL")),a=je(i,"Role")[0],u={role:Ye(a)};let l=tt(s,r,u);const f=je(i,"Accessibility")[0],m=Y0(Ye(f));m&&(l=tt(l,{captionServices:m}));const _=je(i,"Label")[0];if(_&&_.childNodes.length){const I=_.childNodes[0].nodeValue.trim();l=tt(l,{label:I})}const w=K0(je(i,"ContentProtection"));Object.keys(w).length&&(l=tt(l,{contentProtection:w}));const x=Ro(i),P=je(i,"Representation"),T=tt(t,x);return ys(P.map(X0(l,n,T)))},Z0=(s,e)=>(t,i)=>{const r=Un(e,je(t.node,"BaseURL")),n=tt(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=je(t.node,"AdaptationSet"),u=Ro(t.node);return ys(a.map(J0(n,r,u)))},e_=(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=tt({serverURL:br(s[0])},Ye(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},t_=({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,i_=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=je(s,"Period");if(!a.length)throw new Error(Ts.INVALID_NUMBER_OF_PERIOD);const u=je(s,"Location"),l=Ye(s),f=Un([{baseUrl:t}],je(s,"BaseURL")),m=je(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=Ye(w),T=_[x-1];P.start=t_({attributes:P,priorPeriodAttributes:T?T.attributes:null,mpdType:l.type}),_.push({node:w,attributes:P})}),{locations:l.locations,contentSteeringInfo:e_(m,n),representationInfo:ys(_.map(Z0(l,f))),eventStream:ys(_.map(Q0))}},dd=s=>{if(s==="")throw new Error(Ts.DASH_EMPTY_MANIFEST);const e=new h0.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},s_=s=>{const e=je(s,"UTCTiming")[0];if(!e)return null;const t=Ye(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},r_=(s,e={})=>{const t=i_(dd(s),e),i=H0(t.representationInfo);return N0({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},n_=s=>s_(dd(s));var Ma,Ml;function a_(){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 o_(){if(Bl)return Ba;Bl=1;var s=a_().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 u_=o_();const l_=vr(u_);var c_=he([73,68,51]),d_=function(e,t){t===void 0&&(t=0),e=he(e);var i=e[t+5],r=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(i&16)>>4;return n?r+20:r+10},nr=function s(e,t){return t===void 0&&(t=0),e=he(e),e.length-t<10||!Ue(e,c_,{offset:t})?t:(t+=d_(e,t),s(e,t))},Fl=function(e){return typeof e=="string"?rd(e):e},h_=function(e){return Array.isArray(e)?e.map(function(t){return Fl(t)}):[Fl(e)]},f_=function s(e,t,i){i===void 0&&(i=!1),t=h_(t),e=he(e);var r=[];if(!t.length)return r;for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,u=e.subarray(n+4,n+8);if(a===0)break;var l=n+a;if(l>e.length){if(i)break;l=e.length}var f=e.subarray(n+8,l);Ue(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:he([26,69,223,163]),DocType:he([66,130]),Segment:he([24,83,128,103]),SegmentInfo:he([21,73,169,102]),Tracks:he([22,84,174,107]),Track:he([174]),TrackNumber:he([215]),DefaultDuration:he([35,227,131]),TrackEntry:he([174]),TrackType:he([131]),FlagDefault:he([136]),CodecID:he([134]),CodecPrivate:he([99,162]),VideoTrack:he([224]),AudioTrack:he([225]),Cluster:he([31,67,182,117]),Timestamp:he([231]),TimestampScale:he([42,215,177]),BlockGroup:he([160]),BlockDuration:he([155]),Block:he([161]),SimpleBlock:he([163])},io=[128,64,32,16,8,4,2,1],p_=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=p_(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:r0(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"?n0(e):e},m_=function(e){return Array.isArray(e)?e.map(function(t){return Ul(t)}):[Ul(e)]},g_=function s(e,t,i){if(i>=t.length)return t.length;var r=mn(t,i,!1);if(Ue(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=m_(t),e=he(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=g_(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);Ue(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},__=he([0,0,0,1]),y_=he([0,0,1]),T_=he([0,0,3]),v_=function(e){for(var t=[],i=1;i<e.length-2;)Ue(e.subarray(i,i+3),T_)&&(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},hd=function(e,t,i,r){e=he(e),i=[].concat(i);for(var n=0,a,u=0;n<e.length&&(u<r||a);){var l=void 0;if(Ue(e.subarray(n),__)?l=4:Ue(e.subarray(n),y_)&&(l=3),!l){n++;continue}if(u++,a)return v_(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)},b_=function(e,t,i){return hd(e,"h264",t,i)},x_=function(e,t,i){return hd(e,"h265",t,i)},ft={webm:he([119,101,98,109]),matroska:he([109,97,116,114,111,115,107,97]),flac:he([102,76,97,67]),ogg:he([79,103,103,83]),ac3:he([11,119]),riff:he([82,73,70,70]),avi:he([65,86,73]),wav:he([87,65,86,69]),"3gp":he([102,116,121,112,51,103]),mp4:he([102,116,121,112]),fmp4:he([115,116,121,112]),mov:he([102,116,121,112,113,116]),moov:he([109,111,111,118]),moof:he([109,111,111,102])},vs={aac:function(e){var t=nr(e);return Ue(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=nr(e);return Ue(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=jl(e,[rn.EBML,rn.DocType])[0];return Ue(t,ft.webm)},mkv:function(e){var t=jl(e,[rn.EBML,rn.DocType])[0];return Ue(t,ft.matroska)},mp4:function(e){if(vs["3gp"](e)||vs.mov(e))return!1;if(Ue(e,ft.mp4,{offset:4})||Ue(e,ft.fmp4,{offset:4})||Ue(e,ft.moof,{offset:4})||Ue(e,ft.moov,{offset:4}))return!0},mov:function(e){return Ue(e,ft.mov,{offset:4})},"3gp":function(e){return Ue(e,ft["3gp"],{offset:4})},ac3:function(e){var t=nr(e);return Ue(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 Ue(e,ft.flac,{offset:t})},ogg:function(e){return Ue(e,ft.ogg)},avi:function(e){return Ue(e,ft.riff)&&Ue(e,ft.avi,{offset:8})},wav:function(e){return Ue(e,ft.riff)&&Ue(e,ft.wav,{offset:8})},h264:function(e){return b_(e,7,3).length},h265:function(e){return x_(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(he(t))}});var S_=vs,No=function(e){e=he(e);for(var t=0;t<so.length;t++){var i=so[t];if(S_[i](e))return i}return""},E_=function(e){return f_(e,["moof"]).length>0},Fa,ql;function C_(){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=C_();var ro="8.23.4";const oi={},Ai=function(s,e){return oi[s]=oi[s]||[],e&&(oi[s]=oi[s].concat(e)),oi[s]},w_=function(s,e){Ai(s,e)},fd=function(s,e){const t=Ai(s).indexOf(e);return t<=-1?!1:(oi[s]=oi[s].slice(),oi[s].splice(t,1),!0)},A_=function(s,e){Ai(s,[].concat(e).map(t=>{const i=(...r)=>(fd(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 _t=[];const D_=(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+":"),_t){_t.push([].concat(n));const m=_t.length-1e3;_t.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=D_(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=()=>_t?[].concat(_t):[],n.history.filter=a=>(_t||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),n.history.clear=()=>{_t&&(_t.length=0)},n.history.disable=()=>{_t!==null&&(_t.length=0,_t=null)},n.history.enable=()=>{_t===null&&(_t=[])},n.error=(...a)=>r("error",i,a),n.warn=(...a)=>r("warn",i,a),n.debug=(...a)=>r("debug",i,a),n}const Ee=no("VIDEOJS"),pd=Ee.createLogger,k_=Object.prototype.toString,md=function(s){return ti(s)?Object.keys(s):[]};function us(s,e){md(s).forEach(t=>e(s[t],t))}function gd(s,e,t=0){return md(s).reduce((i,r)=>e(i,s[r],r),t)}function ti(s){return!!s&&typeof s=="object"}function bs(s){return ti(s)&&k_.call(s)==="[object Object]"&&s.constructor===Object}function Pe(...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]=Pe(e[r],i)})}),e}function _d(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 I_=Object.freeze({__proto__:null,each:us,reduce:gd,isObject:ti,isPlain:bs,merge:Pe,values:_d,defineLazyProperty:jn});let Mo=!1,yd=null,Vt=!1,Td,vd=!1,ls=!1,cs=!1,ii=!1,Bo=null,qn=null;const P_=!!(D.cast&&D.cast.framework&&D.cast.framework.CastReceiverContext);let bd=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)),bi=D.navigator&&D.navigator.userAgentData;bi&&bi.platform&&bi.brands&&(Vt=bi.platform==="Android",ls=!!bi.brands.find(s=>s.brand==="Microsoft Edge"),cs=!!bi.brands.find(s=>s.brand==="Chromium"),ii=!ls&&cs,Bo=qn=(bi.brands.find(s=>s.brand==="Chromium")||{}).version||null,$n=bi.platform==="Windows");if(!cs){const s=D.navigator&&D.navigator.userAgent||"";Mo=/iPod/i.test(s),yd=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),Vt=/Android/i.test(s),Td=(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})(),vd=/Firefox/i.test(s),ls=/Edg/i.test(s),cs=/Chrome/i.test(s)||/CriOS/i.test(s),ii=!ls&&cs,Bo=qn=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),bd=(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)&&!ii&&!Vt&&!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)&&!ii;var xd=Object.freeze({__proto__:null,get IS_IPOD(){return Mo},get IOS_VERSION(){return yd},get IS_ANDROID(){return Vt},get ANDROID_VERSION(){return Td},get IS_FIREFOX(){return vd},get IS_EDGE(){return ls},get IS_CHROMIUM(){return cs},get IS_CHROME(){return ii},get CHROMIUM_VERSION(){return Bo},get CHROME_VERSION(){return qn},IS_CHROMECAST_RECEIVER:P_,get IE_VERSION(){return bd},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 L_(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function ws(){return ne===D.document}function As(s){return ti(s)&&s.nodeType===1}function Sd(){try{return D.parent!==D.self}catch{return!0}}function Ed(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 pe(s="div",e={},t={},i){const r=ne.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?ki(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 ki(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 L_(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):(Ee.warn("removeClass was called with an element that doesn't exist"),null)}function Cd(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function wd(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 Ei(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 Ad(s,e){return s.getAttribute(e)}function xs(s,e,t){s.setAttribute(e,t)}function Gn(s,e){s.removeAttribute(e)}function Dd(){ne.body.focus(),ne.onselectstart=function(){return!1}}function kd(){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 Id(s){return ti(s)&&s.nodeType===3}function Xn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Pd(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),As(e)||Id(e))return e;if(typeof e=="string"&&/\S/.test(e))return ne.createTextNode(e)}).filter(e=>e)}function Fo(s,e){return Pd(e).forEach(t=>s.appendChild(t)),s}function Ld(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 Di=Ed("querySelector"),Od=Ed("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 Rd(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 Nd=Object.freeze({__proto__:null,isReal:ws,isEl:As,isInFrame:Sd,createEl:pe,textContent:ki,prependTo:ao,hasClass:lr,addClass:Vi,removeClass:zn,toggleClass:Cd,setAttributes:wd,getAttributes:Ei,getAttribute:Ad,setAttribute:xs,removeAttribute:Gn,blockTextSelection:Dd,unblockTextSelection:kd,getBoundingClientRect:Ss,findPosition:_r,getPointerPosition:Wn,isTextNode:Id,emptyEl:Xn,normalizeContent:Pd,appendContent:Fo,insertContent:Ld,isSingleLeftClick:yr,$:Di,$$:Od,computedStyle:Es,copyStyleSheetsToWindow:Rd});let Md=!1,oo;const O_=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 Md||uo(1)};function uo(s,e){ws()&&(e&&(oo=e),D.setTimeout(O_,s))}function lo(){Md=!0,D.removeEventListener("load",lo)}ws()&&(ne.readyState==="complete"?lo():D.addEventListener("load",lo));const Bd=function(s){const e=ne.createElement("style");return e.className=s,e},Fd=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var mt=new WeakMap;const R_=3;let N_=R_;function Lt(){return N_++}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 M_=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},B_=["touchstart","touchmove"];function Ct(s,e,t){if(Array.isArray(e))return Uo(Ct,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=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){Ee.error(m)}}}),i.handlers[e].length===1)if(s.addEventListener){let r=!1;M_()&&B_.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||Lt(),Ct(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||Lt(),Ct(s,e,i)}var F_=Object.freeze({__proto__:null,fixEvent:Kn,on:Ct,off:ut,trigger:Ds,one:Yn,any:jo});const Ot=30,Me=function(s,e,t){e.guid||(e.guid=Lt());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},si=function(s,e){let t=D.performance.now();return function(...r){const n=D.performance.now();n-t>=e&&(s(...r),t=n)}},Ud=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 U_=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ot,bind_:Me,throttle:si,debounce:Ud});let ir;class wt{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Ct(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)}}wt.prototype.allowedEvents_={};wt.prototype.addEventListener=wt.prototype.on;wt.prototype.removeEventListener=wt.prototype.off;wt.prototype.dispatchEvent=wt.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 wt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),j_=(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.`)},jd=(s,e,t)=>{if(!co(s))throw new Error(`Invalid event type for ${Qn(e)}#${t}; must be a non-empty string or array.`)},qd=(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),jd(n,s,t),qd(a,s,t),a=Me(s,a),{isTargetingSelf:i,target:r,type:n,listener:a}},Bi=(s,e,t,i)=>{xn(s,s,e),s.nodeName?F_[e](s,t,i):s[e](t,i)},q_={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"),jd(r,this,"off"),qd(t,this,"off"),t=Me(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_=pe("span",{className:"vjs-event-bus"});return Object.assign(s,q_),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 $_={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 $d(s,e){return Object.assign(s,$_),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())},He=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Vd=function(s,e){return He(s)===He(e)};var V_=Object.freeze({__proto__:null,toLowerCase:cr,toTitleCase:He,titleCaseEquals:Vd});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_=Pe({},this.options_),t=this.options_=Pe(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${Lt()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),t.evented!==!1&&(qo(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),$d(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_=Pe(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return pe(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=pe("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=He(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&&He(r.name()),n&&(this.childNameIndex_[n]=r,this.childNameIndex_[cr(n)]=r),typeof r.el=="function"&&r.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_: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_[He(e.name())]=null,this.childNameIndex_[cr(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const u=a.name;let l=a.opts;if(t[u]!==void 0&&(l=t[u]),l===!1)return;l===!0&&(l={}),l.playerOptions=this.options_.playerOptions;const f=this.addChild(u,l);f&&(this[u]=f)};let r;const n=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||He(a.name));return u&&!n.isTech(u)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Di(e,t||this.contentEl())}$$(e,t){return Od(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){Cd(this.el_,e,t)}show(){this.removeClass("vjs-hidden")}hide(){this.addClass("vjs-hidden")}lockShowing(){this.addClass("vjs-lock-showing")}unlockShowing(){this.removeClass("vjs-lock-showing")}getAttribute(e){return Ad(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"+He(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Es(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${He(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,r=200;let n;this.on("touchstart",function(u){u.touches.length===1&&(t={pageX:u.touches[0].pageX,pageY:u.touches[0].pageY},e=D.performance.now(),n=!0)}),this.on("touchmove",function(u){if(u.touches.length>1)n=!1;else if(t){const l=u.touches[0].pageX-t.pageX,f=u.touches[0].pageY-t.pageY;Math.sqrt(l*l+f*f)>i&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(u){t=null,n===!0&&D.performance.now()-e<r&&(u.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Me(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=Me(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=Me(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=Me(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=Me(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=He(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 H_(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 H_(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 $t(s,e){return Array.isArray(s)?ja(s):s===void 0||e===void 0?ja():ja([[s,e]])}const Hd=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=Hd;function zd(s){$o=s}function Gd(){$o=Hd}function Wi(s,e=s){return $o(s,e)}var z_=Object.freeze({__proto__:null,createTimeRanges:$t,createTimeRange:$t,setFormatTime:zd,resetFormatTime:Gd,formatTime:Wi});function Wd(s,e){let t=0,i,r;if(!e)return 0;(!s||!s.length)&&(s=$t(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 $e(s){if(s instanceof $e)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:ti(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=$e.defaultMessages[this.code]||"")}$e.prototype.code=0;$e.prototype.message="";$e.prototype.status=null;$e.prototype.metadata=null;$e.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];$e.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."};$e.MEDIA_ERR_CUSTOM=0;$e.prototype.MEDIA_ERR_CUSTOM=0;$e.MEDIA_ERR_ABORTED=1;$e.prototype.MEDIA_ERR_ABORTED=1;$e.MEDIA_ERR_NETWORK=2;$e.prototype.MEDIA_ERR_NETWORK=2;$e.MEDIA_ERR_DECODE=3;$e.prototype.MEDIA_ERR_DECODE=3;$e.MEDIA_ERR_SRC_NOT_SUPPORTED=4;$e.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;$e.MEDIA_ERR_ENCRYPTED=5;$e.prototype.MEDIA_ERR_ENCRYPTED=5;function dr(s){return s!=null&&typeof s.then=="function"}function Qt(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}})})},G_=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))},W_=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:G_,jsonToTextTracks:W_,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_=pe("div",{className:`${qa}-content`},{role:"document"}),this.descEl_=pe("p",{className:`${qa}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),ki(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(),Ld(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 wt{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 Xd 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 Kd 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 X_{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,r=this.trackElements_.length;i<r;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class 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 K_={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},Y_={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},Q_={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Gl={disabled:"disabled",hidden:"hidden",showing:"showing"};class Ho extends wt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Lt(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(r){r!==i&&(i=r,this.trigger("labelchange"))}})}}const zo=function(s){return new URL(s,ne.baseURI)},Yd=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 J_=Object.freeze({__proto__:null,parseUrl:zo,getAbsoluteURL:Yd,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=>Ee.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),Jc(t,Me(this,function(n,a,u){if(n)return Ee.error(n,a);e.loaded_=!0,typeof D.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){Ee.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=Pe(e,{kind:Q_[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=Me(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 Qd extends Ho{constructor(e={}){const t=Pe(e,{kind:Y_[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 Jd extends Ho{constructor(e={}){const t=Pe(e,{kind:K_[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 wt{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:Xd,TrackClass:Qd,capitalName:"Audio"},video:{ListClass:Kd,TrackClass:Jd,capitalName:"Video"},text:{ListClass:Vo,TrackClass:xr,capitalName:"Text"}};Object.keys(Pt).forEach(function(s){Pt[s].getterName=`${s}Tracks`,Pt[s].privateName=`${s}Tracks_`});const Cs={remoteText:{ListClass:Vo,TrackClass:xr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:X_,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 Z_(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 Te 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(Me(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 $t(0,0)}bufferedPercent(){return Wd(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 $e(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?$t(0,0):$t()}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(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 Z_(this,e,t,i)}createRemoteTextTrack(e){const t=Pe(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 Te.canPlayType(e.type)}static isTech(e){return e.prototype instanceof Te||e instanceof Te||e===Te}static registerTech(e,t){if(Te.techs_||(Te.techs_={}),!Te.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!Te.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!Te.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=He(e),Te.techs_[e]=t,Te.techs_[cr(e)]=t,e!=="Tech"&&Te.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(Te.techs_&&Te.techs_[e])return Te.techs_[e];if(e=He(e),D&&D.videojs&&D.videojs[e])return Ee.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];Te.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});Te.prototype.featuresVolumeControl=!0;Te.prototype.featuresMuteControl=!0;Te.prototype.featuresFullscreenResize=!1;Te.prototype.featuresPlaybackRate=!1;Te.prototype.featuresProgressEvents=!1;Te.prototype.featuresSourceset=!1;Te.prototype.featuresTimeupdateEvents=!1;Te.prototype.featuresNativeTextTracks=!1;Te.prototype.featuresVideoFrameCallback=!1;Te.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:Ee.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",Te);Te.registerTech("Tech",Te);Te.defaultTechOrder_=[];const Hi={},En={},Cn={};function ey(s,e){Hi[s]=Hi[s]||[],Hi[s].push(e)}function ty(s,e,t){s.setTimeout(()=>Fi(e,Hi[e.type],t,s),1)}function iy(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function sy(s,e,t){return s.reduceRight(Wo(t),e[t]())}function ry(s,e,t,i){return e[t](s.reduce(Wo(t),i))}function Kl(s,e,t,i=null){const r="call"+He(t),n=s.reduce(Wo(r),i),a=n===Cn,u=a?null:e[t](n);return oy(s,t,u,a),u}const ny={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},ay={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 oy(s,e,t,i){for(let r=s.length-1;r>=0;r--){const n=s[r];n[e]&&n[e](i,t)}}function uy(s){En.hasOwnProperty(s.id())&&delete En[s.id()]}function ly(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=ly(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 cy={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 cy[e.toLowerCase()]||""},dy=(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)},Zd=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=Zd(t),Array.isArray(t)?e=e.concat(t):ti(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Ql({src:s})]:ti(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 hy=`<svg xmlns="http://www.w3.org/2000/svg">
16
+ `)}function f(P){this.options=P||{locator:{}}}f.prototype.parseFromString=function(P,N){var M=this.options,L=new u,B=M.domBuilder||new _,U=M.errorHandler,j=M.locator,O=M.xmlns||{},V=/\/x?html?$/.test(N),v=V?t.HTML_ENTITIES:t.XML_ENTITIES;j&&B.setDocumentLocator(j),L.errorHandler=m(U,B,j),L.domBuilder=M.domBuilder||B,V&&(O[""]=n.HTML),O.xml=O.xml||n.XML;var E=M.normalizeLineEndings||l;return P&&typeof P=="string"?L.parse(E(P),O,v):L.errorHandler.error("invalid doc source"),B.doc};function m(P,N,M){if(!P){if(N instanceof _)return N;P=N}var L={},B=P instanceof Function;M=M||{};function U(j){var O=P[j];!O&&B&&(O=P.length==2?function(V){P(j,V)}:P),L[j]=O&&function(V){O("[xmldom "+j+"] "+V+x(M))}||function(){}}return U("warning"),U("error"),U("fatalError"),L}function _(){this.cdata=!1}function w(P,N){N.lineNumber=P.lineNumber,N.columnNumber=P.columnNumber}_.prototype={startDocument:function(){this.doc=new r().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(P,N,M,L){var B=this.doc,U=B.createElementNS(P,M||N),j=L.length;y(this,U),this.currentElement=U,this.locator&&w(this.locator,U);for(var O=0;O<j;O++){var P=L.getURI(O),V=L.getValue(O),M=L.getQName(O),v=B.createAttributeNS(P,M);this.locator&&w(L.getLocator(O),v),v.value=v.nodeValue=V,U.setAttributeNode(v)}},endElement:function(P,N,M){var L=this.currentElement;L.tagName,this.currentElement=L.parentNode},startPrefixMapping:function(P,N){},endPrefixMapping:function(P){},processingInstruction:function(P,N){var M=this.doc.createProcessingInstruction(P,N);this.locator&&w(this.locator,M),y(this,M)},ignorableWhitespace:function(P,N,M){},characters:function(P,N,M){if(P=I.apply(this,arguments),P){if(this.cdata)var L=this.doc.createCDATASection(P);else var L=this.doc.createTextNode(P);this.currentElement?this.currentElement.appendChild(L):/^\s*$/.test(P)&&this.doc.appendChild(L),this.locator&&w(this.locator,L)}},skippedEntity:function(P){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(P){(this.locator=P)&&(P.lineNumber=0)},comment:function(P,N,M){P=I.apply(this,arguments);var L=this.doc.createComment(P);this.locator&&w(this.locator,L),y(this,L)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(P,N,M){var L=this.doc.implementation;if(L&&L.createDocumentType){var B=L.createDocumentType(P,N,M);this.locator&&w(this.locator,B),y(this,B),this.doc.doctype=B}},warning:function(P){console.warn("[xmldom warning] "+P,x(this.locator))},error:function(P){console.error("[xmldom error] "+P,x(this.locator))},fatalError:function(P){throw new a(P,this.locator)}};function x(P){if(P)return`
17
+ @`+(P.systemId||"")+"#[line:"+P.lineNumber+",col:"+P.columnNumber+"]"}function I(P,N,M){return typeof P=="string"?P.substr(N,M):P.length>=N+M||N?new java.lang.String(P,N,M)+"":P}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(P){_.prototype[P]=function(){return null}});function y(P,N){P.currentElement?P.currentElement.appendChild(N):P.doc.appendChild(N)}return ir.__DOMHandler=_,ir.normalizeLineEndings=l,ir.DOMParser=f,ir}var Ll;function P0(){if(Ll)return tr;Ll=1;var s=ld();return tr.DOMImplementation=s.DOMImplementation,tr.XMLSerializer=s.XMLSerializer,tr.DOMParser=I0().DOMParser,tr}var L0=P0();const Ol=s=>!!s&&typeof s=="object",Je=(...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]):Ol(e[i])&&Ol(t[i])?e[i]=Je(e[i],t[i]):e[i]=t[i]}),e),{}),cd=s=>Object.keys(s).map(e=>s[e]),O0=(s,e)=>{const t=[];for(let i=s;i<e;i++)t.push(i);return t},Ts=s=>s.reduce((e,t)=>e.concat(t),[]),dd=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},R0=(s,e)=>s.reduce((t,i,r)=>(i[e]&&t.push(r),t),[]),N0=(s,e)=>cd(s.reduce((t,i)=>(i.forEach(r=>{t[e(r)]=r}),t),{}));var vs={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 gr=({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}`},Rl=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),B0={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:r}=s,n=Rl(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=Rl(s.endNumber),m=(e+t)/1e3,_=i+a,x=m+u-_,I=Math.ceil(x*r/n),y=Math.floor((m-_-l)*r/n),P=Math.floor((m-_)*r/n);return{start:Math.max(0,y),end:typeof f=="number"?f:Math.min(I,P)}}},F0=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}=B0[e](s),l=O0(a,u).map(F0(s));if(e==="static"){const f=l.length-1,m=typeof r=="number"?r:n;l[f].duration=m-t/i*f}return l},hd=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(vs.NO_BASE_URL);const f=gr({baseUrl:e,source:t.sourceURL,range:t.range}),m=gr({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(P=>P.referenceType!==1),m=[],_=s.endList?"static":"dynamic",w=s.sidx.timeline;let x=w,I=s.mediaSequence||0,y;typeof e.firstOffset=="bigint"?y=D.BigInt(u)+e.firstOffset:y=u+e.firstOffset;for(let P=0;P<f.length;P++){const N=e.references[P],M=N.referencedSize,L=N.subsegmentDuration;let B;typeof y=="bigint"?B=y+D.BigInt(M)-D.BigInt(1):B=y+M-1;const U=`${y}-${B}`,O=hd({baseUrl:t,timescale:l,timeline:n,periodStart:w,presentationTime:x,number:I,duration:L,sourceDuration:r,indexRange:U,type:_})[0];i&&(O.map=i),m.push(O),typeof y=="bigint"?y+=D.BigInt(M):y+=M,x+=L/l,I++}return s.segments=m,s},U0=["AUDIO","SUBTITLES"],j0=1/60,fd=s=>N0(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),q0=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Nl=s=>{let e=[];return A0(s,U0,(t,i,r,n)=>{e=e.concat(t.playlists||[])}),e},Ml=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},$0=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:l}){return l===i.timeline});const r=q0(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)<j0});if(a===-1){Ml({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--),Ml({playlist:i,mediaSequence:r.segments[a].number})})},V0=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Nl(s)),i=e.playlists.concat(Nl(e));return e.timelineStarts=fd([s.timelineStarts,e.timelineStarts]),$0({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Fn=s=>s&&s.uri+"-"+M0(s.byterange),Oa=s=>{const e=s.reduce(function(i,r){return i[r.attributes.baseUrl]||(i[r.attributes.baseUrl]=[]),i[r.attributes.baseUrl].push(r),i},{});let t=[];return Object.values(e).forEach(i=>{const r=cd(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=R0(i.segments||[],"discontinuity"),i))},Ro=(s,e)=>{const t=Fn(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&Oo(s,i,s.sidx.resolvedUri),s},H0=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Ro(s[t],e);return s},z0=({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},G0=({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=Ro(z0(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},X0=(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(G0(i),e)),t},{}),K0=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),{}),Y0=({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},Q0=({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",Z0=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",e_=(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})})},Bl=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],t_=({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=Oa(s.filter(Q0)).map(Y0),_=Oa(s.filter(J0)),w=Oa(s.filter(Z0)),x=s.map(B=>B.attributes.captionServices).filter(Boolean),I={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:H0(m,i)};f>=0&&(I.minimumUpdatePeriod=f*1e3),e&&(I.locations=e),t&&(I.contentSteering=t),u==="dynamic"&&(I.suggestedPresentationDelay=l),n&&n.length>0&&(I.eventStream=n);const y=I.playlists.length===0,P=_.length?W0(_,i,y):null,N=w.length?X0(w,i):null,M=m.concat(Bl(P),Bl(N)),L=M.map(({timelineStarts:B})=>B);return I.timelineStarts=fd(L),e_(M,I.timelineStarts),P&&(I.mediaGroups.AUDIO.audio=P),N&&(I.mediaGroups.SUBTITLES.subs=N),x.length&&(I.mediaGroups["CLOSED-CAPTIONS"].cc=K0(x)),r?V0({oldManifest:r,newManifest:I}):I},i_=(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)},pd=(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,I=w.r||0,y=w.t||0;m<0&&(m=y),y&&y>m&&(m=y);let P;if(I<0){const L=_+1;L===e.length?t==="dynamic"&&i>0&&r.indexOf("$Number$")>0?P=i_(s,m,x):P=(n*a-m)/x:P=(e[L].t-m)/x}else P=I+1;const N=u+f.length+P;let M=u+f.length;for(;M<N;)f.push({number:M,duration:x/a,time:m,timeline:l}),m+=x,M++}return f},s_=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,r_=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}`},Fl=(s,e)=>s.replace(s_,r_(e)),n_=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Lo(s):pd(s,e),a_=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,r=gr({baseUrl:s.baseUrl,source:Fl(i.sourceURL,t),range:i.range});return n_(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const u=Fl(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}})},o_=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,r=gr({baseUrl:t,source:i.sourceURL,range:i.range}),n=gr({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=r,n},u_=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(vs.SEGMENT_TIME_UNSPECIFIED);const n=i.map(l=>o_(s,l));let a;return t&&(a=Lo(s)),e&&(a=pd(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)},l_=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=a_,t=Je(s,e.template)):e.base?(i=hd,t=Je(s,e.base)):e.list&&(i=u_,t=Je(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},c_=s=>s.map(l_),Be=(s,e)=>dd(s.childNodes).filter(({tagName:t})=>t===e),xr=s=>s.textContent.trim(),d_=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),ts=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)},h_=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),Ul={mediaPresentationDuration(s){return ts(s)},availabilityStartTime(s){return h_(s)/1e3},minimumUpdatePeriod(s){return ts(s)},suggestedPresentationDelay(s){return ts(s)},type(s){return s},timeShiftBufferDepth(s){return ts(s)},start(s){return ts(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return d_(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)?ts(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}},ze=s=>s&&s.attributes?dd(s.attributes).reduce((e,t)=>{const i=Ul[t.name]||Ul.DEFAULT;return e[t.name]=i(t.value),e},{}):{},f_={"urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b":"org.w3.clearkey","urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed":"com.widevine.alpha","urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95":"com.microsoft.playready","urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb":"com.adobe.primetime","urn:mpeg:dash:mp4protection:2011":"mp4protection"},Un=(s,e)=>e.length?Ts(s.map(function(t){return e.map(function(i){const r=xr(i),n=Mn(t.baseUrl,r),a=Je(ze(i),{baseUrl:n});return n!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,No=s=>{const e=Be(s,"SegmentTemplate")[0],t=Be(s,"SegmentList")[0],i=t&&Be(t,"SegmentURL").map(_=>Je({tag:"SegmentURL"},ze(_))),r=Be(s,"SegmentBase")[0],n=t||e,a=n&&Be(n,"SegmentTimeline")[0],u=t||r||e,l=u&&Be(u,"Initialization")[0],f=e&&ze(e);f&&l?f.initialization=l&&ze(l):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const m={template:f,segmentTimeline:a&&Be(a,"S").map(_=>ze(_)),list:t&&Je(ze(t),{segmentUrls:i,initialization:ze(l)}),base:r&&Je(ze(r),{initialization:ze(l)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},p_=(s,e,t)=>i=>{const r=Be(i,"BaseURL"),n=Un(e,r),a=Je(s,ze(i)),u=No(i);return n.map(l=>({segmentInfo:Je(t,u),attributes:Je(a,l)}))},m_=s=>s.reduce((e,t)=>{const i=ze(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const r=f_[i.schemeIdUri];if(r){e[r]={attributes:i};const n=Be(t,"cenc:pssh")[0];if(n){const a=xr(n);e[r].pssh=a&&sd(a)}}return e},{}),g_=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})},__=s=>Ts(Be(s.node,"EventStream").map(e=>{const t=ze(e),i=t.schemeIdUri;return Be(e,"Event").map(r=>{const n=ze(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:xr(r)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),y_=(s,e,t)=>i=>{const r=ze(i),n=Un(e,Be(i,"BaseURL")),a=Be(i,"Role")[0],u={role:ze(a)};let l=Je(s,r,u);const f=Be(i,"Accessibility")[0],m=g_(ze(f));m&&(l=Je(l,{captionServices:m}));const _=Be(i,"Label")[0];if(_&&_.childNodes.length){const P=_.childNodes[0].nodeValue.trim();l=Je(l,{label:P})}const w=m_(Be(i,"ContentProtection"));Object.keys(w).length&&(l=Je(l,{contentProtection:w}));const x=No(i),I=Be(i,"Representation"),y=Je(t,x);return Ts(I.map(p_(l,n,y)))},T_=(s,e)=>(t,i)=>{const r=Un(e,Be(t.node,"BaseURL")),n=Je(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Be(t.node,"AdaptationSet"),u=No(t.node);return Ts(a.map(y_(n,r,u)))},v_=(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=Je({serverURL:xr(s[0])},ze(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},b_=({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,x_=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:r=0,eventHandler:n=function(){}}=e,a=Be(s,"Period");if(!a.length)throw new Error(vs.INVALID_NUMBER_OF_PERIOD);const u=Be(s,"Location"),l=ze(s),f=Un([{baseUrl:t}],Be(s,"BaseURL")),m=Be(s,"ContentSteering");l.type=l.type||"static",l.sourceDuration=l.mediaPresentationDuration||0,l.NOW=i,l.clientOffset=r,u.length&&(l.locations=u.map(xr));const _=[];return a.forEach((w,x)=>{const I=ze(w),y=_[x-1];I.start=b_({attributes:I,priorPeriodAttributes:y?y.attributes:null,mpdType:l.type}),_.push({node:w,attributes:I})}),{locations:l.locations,contentSteeringInfo:v_(m,n),representationInfo:Ts(_.map(T_(l,f))),eventStream:Ts(_.map(__))}},md=s=>{if(s==="")throw new Error(vs.DASH_EMPTY_MANIFEST);const e=new L0.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(vs.DASH_INVALID_XML);return i},S_=s=>{const e=Be(s,"UTCTiming")[0];if(!e)return null;const t=ze(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(vs.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},E_=(s,e={})=>{const t=x_(md(s),e),i=c_(t.representationInfo);return t_({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},C_=s=>S_(md(s));var Ra,jl;function w_(){if(jl)return Ra;jl=1;var s=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),r;return i.getBigUint64?(r=i.getBigUint64(0),r<Number.MAX_SAFE_INTEGER?Number(r):r):i.getUint32(0)*s+i.getUint32(4)};return Ra={getUint64:e,MAX_UINT32:s},Ra}var Na,ql;function A_(){if(ql)return Na;ql=1;var s=w_().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),r={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},n=12;r.version===0?(r.earliestPresentationTime=i.getUint32(n),r.firstOffset=i.getUint32(n+4),n+=8):(r.earliestPresentationTime=s(t.subarray(n)),r.firstOffset=s(t.subarray(n+8)),n+=16),n+=2;var a=i.getUint16(n);for(n+=2;a>0;n+=12,a--)r.references.push({referenceType:(t[n]&128)>>>7,referencedSize:i.getUint32(n)&2147483647,subsegmentDuration:i.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:i.getUint32(n+8)&268435455});return r};return Na=e,Na}var D_=A_();const k_=br(D_);var I_=de([73,68,51]),P_=function(e,t){t===void 0&&(t=0),e=de(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},or=function s(e,t){return t===void 0&&(t=0),e=de(e),e.length-t<10||!Me(e,I_,{offset:t})?t:(t+=P_(e,t),s(e,t))},$l=function(e){return typeof e=="string"?ud(e):e},L_=function(e){return Array.isArray(e)?e.map(function(t){return $l(t)}):[$l(e)]},O_=function s(e,t,i){i===void 0&&(i=!1),t=L_(t),e=de(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);Me(u,t[0])&&(t.length===1?r.push(f):r.push.apply(r,s(f,t.slice(1),i))),n=l}return r},nn={EBML:de([26,69,223,163]),DocType:de([66,130]),Segment:de([24,83,128,103]),SegmentInfo:de([21,73,169,102]),Tracks:de([22,84,174,107]),Track:de([174]),TrackNumber:de([215]),DefaultDuration:de([35,227,131]),TrackEntry:de([174]),TrackType:de([131]),FlagDefault:de([136]),CodecID:de([134]),CodecPrivate:de([99,162]),VideoTrack:de([224]),AudioTrack:de([225]),Cluster:de([31,67,182,117]),Timestamp:de([231]),TimestampScale:de([42,215,177]),BlockGroup:de([160]),BlockDuration:de([155]),Block:de([161]),SimpleBlock:de([163])},so=[128,64,32,16,8,4,2,1],R_=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=R_(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:E0(a,{signed:r}),bytes:a}},Vl=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?C0(e):e},N_=function(e){return Array.isArray(e)?e.map(function(t){return Vl(t)}):[Vl(e)]},M_=function s(e,t,i){if(i>=t.length)return t.length;var r=mn(t,i,!1);if(Me(e.bytes,r.bytes))return i;var n=mn(t,i+r.length);return s(e,t,i+n.length+n.value+r.length)},Hl=function s(e,t){t=N_(t),e=de(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);Me(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},B_=de([0,0,0,1]),F_=de([0,0,1]),U_=de([0,0,3]),j_=function(e){for(var t=[],i=1;i<e.length-2;)Me(e.subarray(i,i+3),U_)&&(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},gd=function(e,t,i,r){e=de(e),i=[].concat(i);for(var n=0,a,u=0;n<e.length&&(u<r||a);){var l=void 0;if(Me(e.subarray(n),B_)?l=4:Me(e.subarray(n),F_)&&(l=3),!l){n++;continue}if(u++,a)return j_(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)},q_=function(e,t,i){return gd(e,"h264",t,i)},$_=function(e,t,i){return gd(e,"h265",t,i)},lt={webm:de([119,101,98,109]),matroska:de([109,97,116,114,111,115,107,97]),flac:de([102,76,97,67]),ogg:de([79,103,103,83]),ac3:de([11,119]),riff:de([82,73,70,70]),avi:de([65,86,73]),wav:de([87,65,86,69]),"3gp":de([102,116,121,112,51,103]),mp4:de([102,116,121,112]),fmp4:de([115,116,121,112]),mov:de([102,116,121,112,113,116]),moov:de([109,111,111,118]),moof:de([109,111,111,102])},bs={aac:function(e){var t=or(e);return Me(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=or(e);return Me(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Hl(e,[nn.EBML,nn.DocType])[0];return Me(t,lt.webm)},mkv:function(e){var t=Hl(e,[nn.EBML,nn.DocType])[0];return Me(t,lt.matroska)},mp4:function(e){if(bs["3gp"](e)||bs.mov(e))return!1;if(Me(e,lt.mp4,{offset:4})||Me(e,lt.fmp4,{offset:4})||Me(e,lt.moof,{offset:4})||Me(e,lt.moov,{offset:4}))return!0},mov:function(e){return Me(e,lt.mov,{offset:4})},"3gp":function(e){return Me(e,lt["3gp"],{offset:4})},ac3:function(e){var t=or(e);return Me(e,lt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=or(e);return Me(e,lt.flac,{offset:t})},ogg:function(e){return Me(e,lt.ogg)},avi:function(e){return Me(e,lt.riff)&&Me(e,lt.avi,{offset:8})},wav:function(e){return Me(e,lt.riff)&&Me(e,lt.wav,{offset:8})},h264:function(e){return q_(e,7,3).length},h265:function(e){return $_(e,[32,33],3).length}},ro=Object.keys(bs).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);ro.forEach(function(s){var e=bs[s];bs[s]=function(t){return e(de(t))}});var V_=bs,Mo=function(e){e=de(e);for(var t=0;t<ro.length;t++){var i=ro[t];if(V_[i](e))return i}return""},H_=function(e){return O_(e,["moof"]).length>0},Ma,zl;function z_(){if(zl)return Ma;zl=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)},Ma={ONE_SECOND_IN_TS:s,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:r,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:u},Ma}var ji=z_();var no="8.23.4";const ni={},wi=function(s,e){return ni[s]=ni[s]||[],e&&(ni[s]=ni[s].concat(e)),ni[s]},G_=function(s,e){wi(s,e)},_d=function(s,e){const t=wi(s).indexOf(e);return t<=-1?!1:(ni[s]=ni[s].slice(),ni[s].splice(t,1),!0)},W_=function(s,e){wi(s,[].concat(e).map(t=>{const i=(...r)=>(_d(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"]],Gl=cn[0];let ur;for(let s=0;s<cn.length;s++)if(cn[s][1]in ne){ur=cn[s];break}if(ur){for(let s=0;s<ur.length;s++)gn[Gl[s]]=ur[s];gn.prefixed=ur[0]!==Gl[0]}let ht=[];const X_=(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+":"),ht){ht.push([].concat(n));const m=ht.length-1e3;ht.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=X_(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=()=>ht?[].concat(ht):[],n.history.filter=a=>(ht||[]).filter(u=>new RegExp(`.*${a}.*`).test(u[0])),n.history.clear=()=>{ht&&(ht.length=0)},n.history.disable=()=>{ht!==null&&(ht.length=0,ht=null)},n.history.enable=()=>{ht===null&&(ht=[])},n.error=(...a)=>r("error",i,a),n.warn=(...a)=>r("warn",i,a),n.debug=(...a)=>r("debug",i,a),n}const ve=ao("VIDEOJS"),yd=ve.createLogger,K_=Object.prototype.toString,Td=function(s){return Qt(s)?Object.keys(s):[]};function ls(s,e){Td(s).forEach(t=>e(s[t],t))}function vd(s,e,t=0){return Td(s).reduce((i,r)=>e(i,s[r],r),t)}function Qt(s){return!!s&&typeof s=="object"}function xs(s){return Qt(s)&&K_.call(s)==="[object Object]"&&s.constructor===Object}function Ae(...s){const e={};return s.forEach(t=>{t&&ls(t,(i,r)=>{if(!xs(i)){e[r]=i;return}xs(e[r])||(e[r]={}),e[r]=Ae(e[r],i)})}),e}function bd(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 Y_=Object.freeze({__proto__:null,each:ls,reduce:vd,isObject:Qt,isPlain:xs,merge:Ae,values:bd,defineLazyProperty:jn});let Bo=!1,xd=null,Ut=!1,Sd,Ed=!1,cs=!1,ds=!1,Jt=!1,Fo=null,qn=null;const Q_=!!(D.cast&&D.cast.framework&&D.cast.framework.CastReceiverContext);let Cd=null,_n=!1,$n=!1,yn=!1,Vn=!1,Tn=!1,vn=!1,bn=!1;const _r=!!(As()&&("ontouchstart"in D||D.navigator.maxTouchPoints||D.DocumentTouch&&D.document instanceof D.DocumentTouch)),vi=D.navigator&&D.navigator.userAgentData;vi&&vi.platform&&vi.brands&&(Ut=vi.platform==="Android",cs=!!vi.brands.find(s=>s.brand==="Microsoft Edge"),ds=!!vi.brands.find(s=>s.brand==="Chromium"),Jt=!cs&&ds,Fo=qn=(vi.brands.find(s=>s.brand==="Chromium")||{}).version||null,$n=vi.platform==="Windows");if(!ds){const s=D.navigator&&D.navigator.userAgent||"";Bo=/iPod/i.test(s),xd=(function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),Ut=/Android/i.test(s),Sd=(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})(),Ed=/Firefox/i.test(s),cs=/Edg/i.test(s),ds=/Chrome/i.test(s)||/CriOS/i.test(s),Jt=!cs&&ds,Fo=qn=(function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),Cd=(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)&&!Jt&&!Ut&&!cs&&!bn,$n=/Windows/i.test(s),yn=/iPad/i.test(s)||_n&&_r&&!/iPhone/i.test(s),Vn=/iPhone/i.test(s)&&!yn}const st=Vn||yn||Bo,Hn=(_n||st)&&!Jt;var wd=Object.freeze({__proto__:null,get IS_IPOD(){return Bo},get IOS_VERSION(){return xd},get IS_ANDROID(){return Ut},get ANDROID_VERSION(){return Sd},get IS_FIREFOX(){return Ed},get IS_EDGE(){return cs},get IS_CHROMIUM(){return ds},get IS_CHROME(){return Jt},get CHROMIUM_VERSION(){return Fo},get CHROME_VERSION(){return qn},IS_CHROMECAST_RECEIVER:Q_,get IE_VERSION(){return Cd},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:_r,IS_IOS:st,IS_ANY_SAFARI:Hn});function Wl(s){return typeof s=="string"&&!!s.trim()}function J_(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function As(){return ne===D.document}function Ds(s){return Qt(s)&&s.nodeType===1}function Ad(){try{return D.parent!==D.self}catch{return!0}}function Dd(s){return function(e,t){if(!Wl(e))return ne[s](null);Wl(t)&&(t=ne.querySelector(t));const i=Ds(t)?t:ne;return i[s]&&i[s](e)}}function fe(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 dr(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 zn(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(ve.warn("removeClass was called with an element that doesn't exist"),null)}function kd(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 Id(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 Pd(s,e){return s.getAttribute(e)}function Ss(s,e,t){s.setAttribute(e,t)}function Gn(s,e){s.removeAttribute(e)}function Ld(){ne.body.focus(),ne.onselectstart=function(){return!1}}function Od(){ne.onselectstart=function(){return!0}}function Es(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(Cs(s,"height"))),t.width||(t.width=parseFloat(Cs(s,"width"))),t}}function yr(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(st){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=Cs(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=yr(e.target),n=yr(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,st&&(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 Rd(s){return Qt(s)&&s.nodeType===3}function Xn(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Nd(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),Ds(e)||Rd(e))return e;if(typeof e=="string"&&/\S/.test(e))return ne.createTextNode(e)}).filter(e=>e)}function Uo(s,e){return Nd(e).forEach(t=>s.appendChild(t)),s}function Md(s,e){return Uo(Xn(s),e)}function Tr(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=Dd("querySelector"),Bd=Dd("querySelectorAll");function Cs(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 Fd(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 Ud=Object.freeze({__proto__:null,isReal:As,isEl:Ds,isInFrame:Ad,createEl:fe,textContent:Di,prependTo:oo,hasClass:dr,addClass:Vi,removeClass:zn,toggleClass:kd,setAttributes:Id,getAttributes:Si,getAttribute:Pd,setAttribute:Ss,removeAttribute:Gn,blockTextSelection:Ld,unblockTextSelection:Od,getBoundingClientRect:Es,findPosition:yr,getPointerPosition:Wn,isTextNode:Rd,emptyEl:Xn,normalizeContent:Nd,appendContent:Uo,insertContent:Md,isSingleLeftClick:Tr,$:Ai,$$:Bd,computedStyle:Cs,copyStyleSheetsToWindow:Fd});let jd=!1,uo;const Z_=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 jd||lo(1)};function lo(s,e){As()&&(e&&(uo=e),D.setTimeout(Z_,s))}function co(){jd=!0,D.removeEventListener("load",co)}As()&&(ne.readyState==="complete"?co():D.addEventListener("load",co));const qd=function(s){const e=ne.createElement("style");return e.className=s,e},$d=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var dt=new WeakMap;const ey=3;let ty=ey;function It(){return ty++}function Xl(s,e){if(!dt.has(s))return;const t=dt.get(s);t.handlers[e].length===0&&(delete t.handlers[e],s.removeEventListener?s.removeEventListener(e,t.dispatcher,!1):s.detachEvent&&s.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&dt.delete(s)}function jo(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 an;const iy=function(){if(typeof an!="boolean"){an=!1;try{const s=Object.defineProperty({},"passive",{get(){an=!0}});D.addEventListener("test",null,s),D.removeEventListener("test",null,s)}catch{}}return an},sy=["touchstart","touchmove"];function bt(s,e,t){if(Array.isArray(e))return jo(bt,s,e,t);dt.has(s)||dt.set(s,{});const i=dt.get(s);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=It()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(r,n){if(i.disabled)return;r=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){ve.error(m)}}}),i.handlers[e].length===1)if(s.addEventListener){let r=!1;iy()&&sy.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,i.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function rt(s,e,t){if(!dt.has(s))return;const i=dt.get(s);if(!i.handlers)return;if(Array.isArray(e))return jo(rt,s,e,t);const r=function(a,u){i.handlers[u]=[],Xl(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);Xl(s,e)}}function ks(s,e,t){const i=dt.has(s)?dt.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Kn(e),i.dispatcher&&i.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)ks.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){dt.has(e.target)||dt.set(e.target,{});const n=dt.get(e.target);e.target[e.type]&&(n.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),n.disabled=!1)}return!e.defaultPrevented}function Yn(s,e,t){if(Array.isArray(e))return jo(Yn,s,e,t);const i=function(){rt(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||It(),bt(s,e,i)}function qo(s,e,t){const i=function(){rt(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||It(),bt(s,e,i)}var ry=Object.freeze({__proto__:null,fixEvent:Kn,on:bt,off:rt,trigger:ks,one:Yn,any:qo});const Pt=30,Pe=function(s,e,t){e.guid||(e.guid=It());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},Zt=function(s,e){let t=D.performance.now();return function(...r){const n=D.performance.now();n-t>=e&&(s(...r),t=n)}},Vd=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 ny=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Pt,bind_:Pe,throttle:Zt,debounce:Vd});let sr;class xt{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},bt(this,e,t),this.addEventListener=i}off(e,t){rt(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Yn(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=Kn(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ks(this,e)}queueTrigger(e){sr||(sr=new Map);const t=e.type||e;let i=sr.get(this);i||(i=new Map,sr.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,sr.delete(this)),this.trigger(e)},0);i.set(t,n)}}xt.prototype.allowedEvents_={};xt.prototype.addEventListener=xt.prototype.on;xt.prototype.removeEventListener=xt.prototype.off;xt.prototype.dispatchEvent=xt.prototype.trigger;const 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,ui=s=>s instanceof xt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),ay=(s,e)=>{ui(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&&!ui(s))throw new Error(`Invalid target for ${Qn(e)}#${t}; must be a DOM node or evented object.`)},Hd=(s,e,t)=>{if(!ho(s))throw new Error(`Invalid event type for ${Qn(e)}#${t}; must be a non-empty string or array.`)},zd=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Qn(e)}#${t}; must be a function.`)},Ba=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let r,n,a;return i?(r=s.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(r=e[0],n=e[1],a=e[2]),xn(r,s,t),Hd(n,s,t),zd(a,s,t),a=Pe(s,a),{isTargetingSelf:i,target:r,type:n,listener:a}},Bi=(s,e,t,i)=>{xn(s,s,e),s.nodeName?ry[e](s,t,i):s[e](t,i)},oy={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ba(this,s,"on");if(Bi(t,"on",i,r),!e){const n=()=>this.off(t,i,r);n.guid=r.guid;const a=()=>this.off("dispose",n);a.guid=r.guid,Bi(this,"on","dispose",n),Bi(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ba(this,s,"one");if(e)Bi(t,"one",i,r);else{const n=(...a)=>{this.off(t,i,n),r.apply(null,a)};n.guid=r.guid,Bi(t,"one",i,n)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:r}=Ba(this,s,"any");if(e)Bi(t,"any",i,r);else{const n=(...a)=>{this.off(t,i,n),r.apply(null,a)};n.guid=r.guid,Bi(t,"any",i,n)}},off(s,e,t){if(!s||ho(s))rt(this.eventBusEl_,s,e);else{const i=s,r=e;xn(i,this,"off"),Hd(r,this,"off"),zd(t,this,"off"),t=Pe(this,t),this.off("dispose",t),i.nodeName?(rt(i,r,t),rt(i,"dispose",t)):ui(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 ${Qn(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ks(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_=fe("span",{className:"vjs-event-bus"});return Object.assign(s,oy),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&dt.has(i)&&dt.delete(i)}),D.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const uy={state:{},setState(s){typeof s=="function"&&(s=s());let e;return ls(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&ui(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Gd(s,e){return Object.assign(s,uy),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&ui(s)&&s.on("statechanged",s.handleStateChanged),s}const hr=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},$e=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Wd=function(s,e){return $e(s)===$e(e)};var ly=Object.freeze({__proto__:null,toLowerCase:hr,toTitleCase:$e,titleCaseEquals:Wd});class X{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ae({},this.options_),t=this.options_=Ae(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${It()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(r=>this.addClass(r)),["on","off","one","any","trigger"].forEach(r=>{this[r]=void 0}),t.evented!==!1&&($o(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Gd(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Ae(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return fe(e,t,i)}localize(e,t,i=e){const r=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[r],u=r&&r.split("-")[0],l=n&&n[u];let f=i;return a&&a[e]?f=a[e]:l&&l[e]&&(f=l[e]),t&&(f=f.replace(/\{(\d+)\}/g,function(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=fe("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=$e(e);const a=t.componentClass||n;t.name=n;const u=X.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&&$e(r.name()),n&&(this.childNameIndex_[n]=r,this.childNameIndex_[hr(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_:Ds(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_[$e(e.name())]=null,this.childNameIndex_[hr(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=X.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=X.getComponent(a.opts.componentClass||$e(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 Bd(e,t||this.contentEl())}hasClass(e){return dr(this.el_,e)}addClass(...e){Vi(this.el_,...e)}removeClass(...e){zn(this.el_,...e)}toggleClass(e,t){kd(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 Pd(this.el_,e)}setAttribute(e,t){Ss(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"+$e(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Cs(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${$e(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=Pe(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=Pe(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=Pe(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=Pe(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=Pe(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=X.getComponent("Tech"),r=i&&i.isTech(t),n=X===t||X.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=$e(e),X.components_||(X.components_={});const a=X.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 X.components_[e]=t,X.components_[hr(e)]=t,t}static getComponent(e){if(!(!e||!X.components_))return X.components_[e]}}X.registerComponent("Component",X);function cy(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 Kl(s,e,t,i){return cy(s,i,t.length-1),t[i][e]}function Fa(s){let e;return s===void 0||s.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:s.length,start:Kl.bind(null,"start",0,s),end:Kl.bind(null,"end",1,s)},D.Symbol&&D.Symbol.iterator&&(e[D.Symbol.iterator]=()=>(s||[]).values()),e}function Ft(s,e){return Array.isArray(s)?Fa(s):s===void 0||e===void 0?Fa():Fa([[s,e]])}const Xd=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=Xd;function Kd(s){Vo=s}function Yd(){Vo=Xd}function Wi(s,e=s){return Vo(s,e)}var dy=Object.freeze({__proto__:null,createTimeRanges:Ft,createTimeRange:Ft,setFormatTime:Kd,resetFormatTime:Yd,formatTime:Wi});function Qd(s,e){let t=0,i,r;if(!e)return 0;(!s||!s.length)&&(s=Ft(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 Ue(s){if(s instanceof Ue)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:Qt(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=Ue.defaultMessages[this.code]||"")}Ue.prototype.code=0;Ue.prototype.message="";Ue.prototype.status=null;Ue.prototype.metadata=null;Ue.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ue.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."};Ue.MEDIA_ERR_CUSTOM=0;Ue.prototype.MEDIA_ERR_CUSTOM=0;Ue.MEDIA_ERR_ABORTED=1;Ue.prototype.MEDIA_ERR_ABORTED=1;Ue.MEDIA_ERR_NETWORK=2;Ue.prototype.MEDIA_ERR_NETWORK=2;Ue.MEDIA_ERR_DECODE=3;Ue.prototype.MEDIA_ERR_DECODE=3;Ue.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ue.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ue.MEDIA_ERR_ENCRYPTED=5;Ue.prototype.MEDIA_ERR_ENCRYPTED=5;function fr(s){return s!=null&&typeof s.then=="function"}function Wt(s){fr(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}})})},hy=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))},fy=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:hy,jsonToTextTracks:fy,trackToJson:fo};const Ua="vjs-modal-dialog";class Is extends X{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=fe("div",{className:`${Ua}-content`},{role:"document"}),this.descEl_=fe("p",{className:`${Ua}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),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`${Ua} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const r=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Md(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"))}}Is.prototype.options_={pauseOnOpen:!0,temporary:!0};X.registerComponent("ModalDialog",Is);class Xi extends xt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},ui(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,r=this.length;i<r;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,r=this.length;i<r;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}Xi.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in Xi.prototype.allowedEvents_)Xi.prototype["on"+s]=null;const ja=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].enabled=!1)};class Jd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){ja(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&ja(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,ja(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const qa=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].selected=!1)};class Zd extends Xi{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){qa(e,e[t]);break}super(e),this.changing_=!1,Object.defineProperty(this,"selectedIndex",{get(){for(let t=0;t<this.length;t++)if(this[t].selected)return t;return-1},set(){}})}addTrack(e){e.selected&&qa(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,qa(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("selectedchange",e.selectedChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.selectedChange_&&(e.removeEventListener("selectedchange",e.selectedChange_),e.selectedChange_=null)}}class 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 py{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 my={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},gy={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"},Yl={disabled:"disabled",hidden:"hidden",showing:"showing"};class zo extends xt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+It(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(r){r!==i&&(i=r,this.trigger("labelchange"))}})}}const Go=function(s){return new URL(s,ne.baseURI)},eh=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""},Jn=function(s,e=D.location){return Go(s).origin!==e.origin};var yy=Object.freeze({__proto__:null,parseUrl:Go,getAbsoluteURL:eh,getFileExtension:Wo,isCrossOrigin:Jn});const Ql=function(s,e){const t=new D.WebVTT.Parser(D,D.vttjs,D.WebVTT.StringDecoder()),i=[];t.oncue=function(r){e.addCue(r)},t.onparsingerror=function(r){i.push(r)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),i.length>0&&(D.console&&D.console.groupCollapsed&&D.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(r=>ve.error(r)),D.console&&D.console.groupEnd&&D.console.groupEnd()),t.flush()},Jl=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),id(t,Pe(this,function(n,a,u){if(n)return ve.error(n,a);e.loaded_=!0,typeof D.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],l=>{if(l.type==="vttjserror"){ve.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Ql(u,e)}):Ql(u,e)}))};class Sr extends zo{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ae(e,{kind:_y[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=Yl[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=Pe(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){Yl[f]&&i!==f&&(i=f,!this.preload_&&i!=="disabled"&&this.cues.length===0&&Jl(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")&&Jl(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}}}}Sr.prototype.allowedEvents_={cuechange:"cuechange"};class th extends zo{constructor(e={}){const t=Ae(e,{kind:gy[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 ih extends zo{constructor(e={}){const t=Ae(e,{kind:my[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 li extends xt{constructor(e={}){super();let t;const i=new Sr(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=li.NONE,i.addEventListener("loadeddata",()=>{t=li.LOADED,this.trigger({type:"load",target:this})})}}li.prototype.allowedEvents_={load:"load"};li.NONE=0;li.LOADING=1;li.LOADED=2;li.ERROR=3;const kt={audio:{ListClass:Jd,TrackClass:th,capitalName:"Audio"},video:{ListClass:Zd,TrackClass:ih,capitalName:"Video"},text:{ListClass:Ho,TrackClass:Sr,capitalName:"Text"}};Object.keys(kt).forEach(function(s){kt[s].getterName=`${s}Tracks`,kt[s].privateName=`${s}Tracks_`});const ws={remoteText:{ListClass:Ho,TrackClass:Sr,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:py,TrackClass:li,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},ct=Object.assign({},kt,ws);ws.names=Object.keys(ws);kt.names=Object.keys(kt);ct.names=[].concat(ws.names).concat(kt.names);function Ty(s,e,t,i,r={}){const n=s.textTracks();r.kind=e,t&&(r.label=t),i&&(r.language=i),r.tech=s;const a=new ct.text.TrackClass(r);return n.addTrack(a),a}class _e extends X{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),ct.names.forEach(i=>{const r=ct[i];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new ct.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Pe(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 Ft(0,0)}bufferedPercent(){return Qd(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(kt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let r=i.length;for(;r--;){const n=i[r];t==="text"&&this.removeRemoteTextTrack(n),i.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Ue(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ft(0,0):Ft()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){kt.names.forEach(e=>{const t=kt[e],i=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",i),r.addEventListener("addtrack",i),this.on("dispose",()=>{r.removeEventListener("removetrack",i),r.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!D.WebVTT)if(ne.body.contains(this.el())){if(!this.options_["vtt.js"]&&xs(xl)&&Object.keys(xl).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 Ty(this,e,t,i)}createRemoteTextTrack(e){const t=Ae(e,{tech:this});return new ws.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=It();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return _e.canPlayType(e.type)}static isTech(e){return e.prototype instanceof _e||e instanceof _e||e===_e}static registerTech(e,t){if(_e.techs_||(_e.techs_={}),!_e.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!_e.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!_e.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=$e(e),_e.techs_[e]=t,_e.techs_[hr(e)]=t,e!=="Tech"&&_e.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(_e.techs_&&_e.techs_[e])return _e.techs_[e];if(e=$e(e),D&&D.videojs&&D.videojs[e])return ve.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),D.videojs[e]}}}ct.names.forEach(function(s){const e=ct[s];_e.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});_e.prototype.featuresVolumeControl=!0;_e.prototype.featuresMuteControl=!0;_e.prototype.featuresFullscreenResize=!1;_e.prototype.featuresPlaybackRate=!1;_e.prototype.featuresProgressEvents=!1;_e.prototype.featuresSourceset=!1;_e.prototype.featuresTimeupdateEvents=!1;_e.prototype.featuresNativeTextTracks=!1;_e.prototype.featuresVideoFrameCallback=!1;_e.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let r=s.sourceHandlers;r||(r=s.sourceHandlers=[]),i===void 0&&(i=r.length),r.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let r;for(let n=0;n<i.length;n++)if(r=i[n].canPlayType(t),r)return r;return""},s.selectSourceHandler=function(t,i){const r=s.sourceHandlers||[];let n;for(let a=0;a<r.length;a++)if(n=r[a].canHandleSource(t,i),n)return r[a];return null},s.canPlaySource=function(t,i){const r=s.selectSourceHandler(t,i);return r?r.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(t){let i=s.selectSourceHandler(t,this.options_);i||(s.nativeSourceHandler?i=s.nativeSourceHandler:ve.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==s.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},s.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};X.registerComponent("Tech",_e);_e.registerTech("Tech",_e);_e.defaultTechOrder_=[];const Hi={},En={},Cn={};function vy(s,e){Hi[s]=Hi[s]||[],Hi[s].push(e)}function by(s,e,t){s.setTimeout(()=>Fi(e,Hi[e.type],t,s),1)}function xy(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function Sy(s,e,t){return s.reduceRight(Xo(t),e[t]())}function Ey(s,e,t,i){return e[t](s.reduce(Xo(t),i))}function Zl(s,e,t,i=null){const r="call"+$e(t),n=s.reduce(Xo(r),i),a=n===Cn,u=a?null:e[t](n);return Ay(s,t,u,a),u}const Cy={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},wy={setCurrentTime:1,setMuted:1,setVolume:1},ec={play:1,pause:1};function Xo(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 Dy(s){En.hasOwnProperty(s.id())&&delete En[s.id()]}function ky(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=ky(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 Iy={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 Iy[e.toLowerCase()]||""},Py=(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)},sh=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=sh(t),Array.isArray(t)?e=e.concat(t):Qt(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[tc({src:s})]:Qt(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[tc(s)]:s=[];return s};function tc(s){if(!s.type){const e=wn(s.src);e&&(s.type=e)}return s}var Ly=`<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 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 fy extends wt{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 py extends Y{constructor(e,t,i){const r=Pe({createEl:!1},t);if(super(e,r,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const u=He(a[n]);let l=Te.getTech(u);if(u||(l=Y.getComponent(u)),l&&l.isSupported()){e.loadTech_(u);break}}else e.src(t.playerOptions.sources)}}Y.registerComponent("MediaLoader",py);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"&&Ee.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=pe(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(pe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=pe("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,ki(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 pe("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(pe("picture",{className:"vjs-poster",tabIndex:-1},{},pe("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()?Qt(this.player_.play()):this.player_.pause())}}po.prototype.crossorigin=po.prototype.crossOrigin;Y.registerComponent("PosterImage",po);const It="#222",ec="#ccc",my={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 Xt(s,e,t){try{s.style[e]=t}catch{return}}function tc(s){return s?`${s}px`:""}class gy 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(Me(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="",Xt(a,"position","relative"),Xt(a,"height",f-l+"px"),Xt(a,"top","unset"),bn?Xt(a,"bottom",f+"px"):Xt(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)),Xt(this.el_,"insetInline",tc(n)),Xt(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&&Xt(a.firstChild,"color",Ha(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Xt(a.firstChild,"backgroundColor",Ha(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Xt(a,"backgroundColor",Ha(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${It}, 2px 2px 4px ${It}, 2px 2px 5px ${It}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${It}, 2px 2px ${It}, 3px 3px ${It}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${ec}, 0 1px ${ec}, -1px -1px ${It}, 0 -1px ${It}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${It}, 0 0 4px ${It}, 0 0 4px ${It}, 0 0 4px ${It}`)),t.fontPercent&&t.fontPercent!==1){const u=D.parseFloat(a.style.fontSize);a.style.fontSize=u*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=my[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",gy);class _y extends Y{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=pe("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",_y);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=pe(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(pe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const i=this.constructor.name;return Ee.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 eh 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){Qt(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}}eh.prototype.controlText_="Play Video";Y.registerComponent("BigPlayButton",eh);class yy 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",yy);class th 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()?Qt(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))}}th.prototype.controlText_="Play";Y.registerComponent("PlayToggle",th);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=pe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=pe("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,Ee.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 Ty 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",Ty);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(pe("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 vy 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_=pe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(pe("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",vy);class ih 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_=pe("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()}}ih.prototype.controlText_="Seek to live, currently playing live";Y.registerComponent("SeekToLive",ih);function Sr(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var by=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"&&!ii&&e.preventDefault(),Dd(),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;kd(),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 xy 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=pe("span",{className:"vjs-control-text"}),i=pe("span",{textContent:this.localize("Loaded")}),r=ne.createTextNode(": ");return this.percentageEl_=pe("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,ki(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(pe()),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",xy);class Sy extends Y{constructor(e,t){super(e,t),this.update=si(Me(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){ki(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",Sy);class Jo extends Y{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=si(Me(this,this.update),Ot)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const r=this.getChild("timeTooltip");if(!r)return;const n=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}Jo.prototype.options_={children:[]};!ot&&!Vt&&Jo.prototype.options_.children.push("timeTooltip");Y.registerComponent("PlayProgressBar",Jo);class sh extends Y{constructor(e,t){super(e,t),this.update=si(Me(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`})}}sh.prototype.options_={children:["timeTooltip"]};Y.registerComponent("MouseTimeDisplay",sh);class ea extends Qo{constructor(e,t){t=Pe(ea.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(ot||Vt)||e.options_.disableSeekWhileScrubbingOnSTV;(!ot&&!Vt||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Me(this,this.update),this.update=si(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?Qt(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 rh extends Y{constructor(e,t){super(e,t),this.handleMouseMove=si(Me(this,this.handleMouseMove),Ot),this.throttledHandleMouseSeek=si(Me(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=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&&Qt(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()}}rh.prototype.options_={children:["seekBar"]};Y.registerComponent("ProgressControl",rh);class nh 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()}}nh.prototype.controlText_="Picture-in-Picture";Y.registerComponent("PictureInPictureToggle",nh);class ah 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()}}ah.prototype.controlText_="Fullscreen";Y.registerComponent("FullscreenToggle",ah);const Ey=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 Cy 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",Cy);class wy extends Y{constructor(e,t){super(e,t),this.update=si(Me(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){ki(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",wy);class oh extends Y{constructor(e,t){super(e,t),this.update=si(Me(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`})}}oh.prototype.options_={children:["volumeLevelTooltip"]};Y.registerComponent("MouseVolumeLevelDisplay",oh);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&&!Vt&&ta.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");ta.prototype.playerEvent="volumechange";Y.registerComponent("VolumeBar",ta);let uh=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),Ey(this,e),this.throttledHandleMouseMove=si(Me(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)}};uh.prototype.options_={children:["volumeBar"]};Y.registerComponent("VolumeControl",uh);const Ay=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 lh extends lt{constructor(e,t){super(e,t),Ay(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)}}lh.prototype.controlText_="Mute";Y.registerComponent("MuteToggle",lh);class ch 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"),Ct(ne,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ut(ne,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}ch.prototype.options_={children:["muteToggle","volumeControl"]};Y.registerComponent("VolumePanel",ch);class dh 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]))}}dh.prototype.controlText_="Skip Forward";Y.registerComponent("SkipForward",dh);class hh 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]))}}hh.prototype.controlText_="Skip Backward";Y.registerComponent("SkipBackward",hh);class fh 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_=pe(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_),Ct(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",fh);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(),Ct(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 fh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=pe("li",{className:"vjs-menu-title",textContent:He(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&&Sd())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=Me(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=pe("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 ph 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",ph);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 ph(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 mh 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",mh);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(He(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,r=t.length;i<r;i++){const n=t[i],a=new mh(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=Me(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 gh 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(pe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(pe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}Y.registerComponent("SubsCapsMenuItem",gh);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(He(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new ru(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,gh),e}}au.prototype.kinds_=["captions","subtitles"];au.prototype.controlText_="Subtitles";Y.registerComponent("SubsCapsButton",au);class _h 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(pe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(pe("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",_h);class yh 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 _h(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}yh.prototype.controlText_="Audio Track";Y.registerComponent("AudioTrackButton",yh);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 Th 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_=pe("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")}}Th.prototype.controlText_="Playback Rate";Y.registerComponent("PlaybackRateMenuButton",Th);class vh 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",vh);class Dy extends vh{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}Y.registerComponent("CustomControlSpacer",Dy);class bh extends Y{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}bh.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",bh);class xh 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):""}}xh.prototype.options_=Object.assign({},ks.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});Y.registerComponent("ErrorDisplay",xh);class Sh 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(),pe("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=pe("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",Sh);class zi extends Y{constructor(e,t={}){super(e,t);const i=pe("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=pe("span",{className:u});const w=pe("label",{id:l,className:"vjs-label",textContent:this.localize(a.label)});w.setAttribute("for",m),f.appendChild(w)}const _=new Sh(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 pe("fieldset",{className:this.options_.className})}}Y.registerComponent("TextTrackFieldset",zi);class Eh 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 pe("div",{className:"vjs-track-settings-colors"})}}Y.registerComponent("TextTrackSettingsColors",Eh);class Ch 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 pe("div",{className:"vjs-track-settings-font"})}}Y.registerComponent("TextTrackSettingsFont",Ch);class wh 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 pe("div",{className:"vjs-track-settings-controls"})}}Y.registerComponent("TrackSettingsControls",wh);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"],Ci={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"}};Ci.windowColor.options=Ci.backgroundColor.options;function Ah(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function ky(s,e){const t=s.options[s.options.selectedIndex].value;return Ah(t,e)}function Iy(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(Ah(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Py 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=pe("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 Eh(e,{textTrackComponentid:this.id_,selectConfigs:Ci,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new Ch(e,{textTrackComponentid:this.id_,selectConfigs:Ci,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const r=new wh(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(Ci,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 gd(Ci,(e,t,i)=>{const r=ky(this.$(t.selector),t.parser);return r!==void 0&&(e[i]=r),e},{})}setValues(e){us(Ci,(t,i)=>{Iy(this.$(t.selector),e[i],t.parser)})}setDefaults(){us(Ci,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){Ee.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){Ee.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}Y.registerComponent("TextTrackSettings",Py);class Ly extends Y{constructor(e,t){let i=t.ResizeObserver||D.ResizeObserver;t.ResizeObserver===null&&(i=!1);const r=Pe({createEl:!i,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||D.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Ud(()=>{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};Ct(this.el_.contentWindow,"unload",a),Ct(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",Ly);const Oy={trackingThreshold:20,liveTolerance:15};class Ry extends Y{constructor(e,t){const i=Pe(Oy,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(D.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const r=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,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",Ry);class Ny extends Y{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:pe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Lt()}`}),description:pe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Lt()}`})},pe("div",{className:"vjs-title-bar"},{},_d(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&&ki(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",Ny);const My={initialDisplay:4e3,position:[],takeFocus:!1};class By extends lt{constructor(e,t){t=Pe(My,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=pe("button",{},{type:"button",class:this.buildCSSClass()},pe("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",By);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},Fy=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}}),Dh=(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},Uy=s=>Dh([s.el(),D.HTMLMediaElement.prototype,D.Element.prototype,Fy],"innerHTML"),dc=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=Uy(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",Pe(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_)},jy=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Yd(D.Element.prototype.getAttribute.call(this,"src")):""},set(s){return D.Element.prototype.setAttribute.call(this,"src",s),s}}),qy=s=>Dh([s.el(),D.HTMLMediaElement.prototype,jy],"src"),$y=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=qy(s),i=e.setAttribute,r=e.load;Object.defineProperty(e,"src",Pe(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 Te{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&&Ee.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_(){$y(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&&Ei(this.options_.tag),r=Pe({},i);(!gr||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,wd(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){Ee(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Vt&&ii&&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)Qt(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 Ee.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const r=pe("source",{},i);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return Ee.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 Ee.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(Vt&&ii&&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&&ii};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"+He(s)]=function(e){this.el_[s]=e,e?this.el_.setAttribute(s,s):this.el_.removeAttribute(s)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(s){le.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){le.prototype["set"+He(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){le.prototype[s]=function(){return this.el_[s]()}});Te.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);Te.registerTech("Html5",le);const kh=["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 Vy={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=pd(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&&Ei(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&&(Ct(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Pe(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(hy,"image/svg+xml");if(u.querySelector("parsererror"))Ee.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 fy(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),uy(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=Ei(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",ii&&$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=>xd[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),D.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Bd("vjs-styles-dimensions");const l=Di(".vjs-styles-defaults"),f=Di("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"){Ee.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)){Ee.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),j_(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),Fd(this.styleEl_,`
159
+ </svg>`;const ic=Tn?10009:vn?461:8,is={codes:{play:415,pause:19,ff:417,rw:412,back:ic},names:{415:"play",19:"pause",417:"ff",412:"rw",[ic]:"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}},sc=5;class Oy extends xt{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(is.isEventKey(t,"play")||is.isEventKey(t,"pause")||is.isEventKey(t,"ff")||is.isEventKey(t,"rw")){t.preventDefault();const i=is.getEventName(t);this.performMediaAction_(i)}else is.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()+sc);break;case"rw":this.userSeek_(this.player_.currentTime()-sc);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 Ry extends X{constructor(e,t,i){const r=Ae({createEl:!1},t);if(super(e,r,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const u=$e(a[n]);let l=_e.getTech(u);if(u||(l=X.getComponent(u)),l&&l.isSupported()){e.loadTech_(u);break}}else e.src(t.playerOptions.sources)}}X.registerComponent("MediaLoader",Ry);class Zn extends X{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ve.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const r=fe(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=fe("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,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)}}X.registerComponent("ClickableComponent",Zn);class mo 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 fe("div",{className:"vjs-poster"})}crossOrigin(e){if(typeof e>"u")return this.$("img")?this.$("img").crossOrigin:this.player_.tech_&&this.player_.tech_.isReady_?this.player_.crossOrigin():this.player_.options_.crossOrigin||this.player_.options_.crossorigin||null;if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.$("img")&&(this.$("img").crossOrigin=e)}update(e){const t=this.player().poster();this.setSrc(t),t?this.show():this.hide()}setSrc(e){if(!e){this.el_.textContent="";return}this.$("img")||this.el_.appendChild(fe("picture",{className:"vjs-poster",tabIndex:-1},{},fe("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Wt(this.player_.play()):this.player_.pause())}}mo.prototype.crossorigin=mo.prototype.crossOrigin;X.registerComponent("PosterImage",mo);const Dt="#222",rc="#ccc",Ny={monospace:"monospace",sansSerif:"sans-serif",serif:"serif",monospaceSansSerif:'"Andale Mono", "Lucida Console", monospace',monospaceSerif:'"Courier New", monospace',proportionalSansSerif:"sans-serif",proportionalSerif:"serif",casual:'"Comic Sans MS", Impact, fantasy',script:'"Monotype Corsiva", cursive',smallcaps:'"Andale Mono", "Lucida Console", monospace, sans-serif'};function $a(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Ht(s,e,t){try{s.style[e]=t}catch{return}}function nc(s){return s?`${s}px`:""}class My extends X{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(Pe(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="",Ht(a,"position","relative"),Ht(a,"height",f-l+"px"),Ht(a,"top","unset"),bn?Ht(a,"bottom",f+"px"):Ht(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)),Ht(this.el_,"insetInline",nc(n)),Ht(this.el_,"insetBlock",nc(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&&Ht(a.firstChild,"color",$a(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Ht(a.firstChild,"backgroundColor",$a(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Ht(a,"backgroundColor",$a(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Dt}, 2px 2px 4px ${Dt}, 2px 2px 5px ${Dt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Dt}, 2px 2px ${Dt}, 3px 3px ${Dt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${rc}, 0 1px ${rc}, -1px -1px ${Dt}, 0 -1px ${Dt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Dt}, 0 0 4px ${Dt}, 0 0 4px ${Dt}, 0 0 4px ${Dt}`)),t.fontPercent&&t.fontPercent!==1){const u=D.parseFloat(a.style.fontSize);a.style.fontSize=u*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=Ny[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&&Ss(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}X.registerComponent("TextTrackDisplay",My);class By extends X{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=fe("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),r=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return r.appendChild(i),r}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}X.registerComponent("LoadingSpinner",By);class nt extends Zn{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const r=fe(e,t,i);return this.player_.options_.experimentalSvgIcons||r.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const i=this.constructor.name;return ve.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),X.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)}}X.registerComponent("Button",nt);class rh extends nt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(e.type==="tap"||this.mouseused_&&"clientX"in e&&"clientY"in e){Wt(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();fr(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}rh.prototype.controlText_="Play Video";X.registerComponent("BigPlayButton",rh);class Fy extends nt{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}X.registerComponent("CloseButton",Fy);class nh extends nt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Wt(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))}}nh.prototype.controlText_="Play";X.registerComponent("PlayToggle",nh);class Ps extends X{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=fe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=fe("span",{className:`${e}-display`},{role:"presentation"}),t.appendChild(this.contentEl_),t}dispose(){this.contentEl_=null,this.textNode_=null,super.dispose()}update(e){!this.player_.options_.enableSmoothSeeking&&e.type==="seeking"||this.updateContent(e)}updateTextNode_(e=0){e=Wi(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,ve.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=ne.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}Ps.prototype.labelText_="Time";Ps.prototype.controlText_="Time";X.registerComponent("TimeDisplay",Ps);class Ko extends Ps{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";X.registerComponent("CurrentTimeDisplay",Ko);class Yo extends Ps{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";X.registerComponent("DurationDisplay",Yo);class Uy extends X{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}}X.registerComponent("TimeDivider",Uy);class Qo extends Ps{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(fe("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Qo.prototype.labelText_="Remaining Time";Qo.prototype.controlText_="Remaining Time";X.registerComponent("RemainingTimeDisplay",Qo);class jy extends X{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=fe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(fe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(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()}}X.registerComponent("LiveDisplay",jy);class ah extends nt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=fe("span",{className:"vjs-seek-to-live-text",textContent:this.localize("LIVE")},{"aria-hidden":"true"}),e.appendChild(this.textEl_),e}updateLiveEdgeStatus(){!this.player_.liveTracker||this.player_.liveTracker.atLiveEdge()?(this.setAttribute("aria-disabled",!0),this.addClass("vjs-at-live-edge"),this.controlText("Seek to live, currently playing live")):(this.setAttribute("aria-disabled",!1),this.removeClass("vjs-at-live-edge"),this.controlText("Seek to live, currently behind live"))}handleClick(){this.player_.liveTracker.seekToLiveEdge()}dispose(){this.player_.liveTracker&&this.off(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_),this.textEl_=null,super.dispose()}}ah.prototype.controlText_="Seek to live, currently playing live";X.registerComponent("SeekToLive",ah);function Er(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var qy=Object.freeze({__proto__:null,clamp:Er});class Jo extends X{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"&&!Jt&&e.preventDefault(),Ld(),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;Od(),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(Er(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")}}X.registerComponent("Slider",Jo);const Va=(s,e)=>Er(s/e*100,0,100).toFixed(2)+"%";class $y extends X{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=fe("span",{className:"vjs-control-text"}),i=fe("span",{textContent:this.localize("Loaded")}),r=ne.createTextNode(": ");return this.percentageEl_=fe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(r),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,u=Va(n,r);this.percent_!==u&&(this.el_.style.width=u,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(fe()),a[l]=_),!(_.dataset.start===f&&_.dataset.end===m)&&(_.dataset.start=f,_.dataset.end=m,_.style.left=Va(f,n),_.style.width=Va(m-f,n))}for(let l=a.length;l>i.length;l--)this.el_.removeChild(a[l-1]);a.length=i.length})}}X.registerComponent("LoadProgressBar",$y);class Vy extends X{constructor(e,t){super(e,t),this.update=Zt(Pe(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const r=yr(this.el_),n=Es(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()})}}X.registerComponent("TimeTooltip",Vy);class Zo extends X{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Zt(Pe(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t,i){const r=this.getChild("timeTooltip");if(!r)return;const n=i&&i.target&&typeof i.target.pendingSeekTime=="function"?i.target.pendingSeekTime():this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,n)}}Zo.prototype.options_={children:[]};!st&&!Ut&&Zo.prototype.options_.children.push("timeTooltip");X.registerComponent("PlayProgressBar",Zo);class oh extends X{constructor(e,t){super(e,t),this.update=Zt(Pe(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}oh.prototype.options_={children:["timeTooltip"]};X.registerComponent("MouseTimeDisplay",oh);class ea extends Jo{constructor(e,t){t=Ae(ea.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(st||Ut)||e.options_.disableSeekWhileScrubbingOnSTV;(!st&&!Ut||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbing_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Pe(this,this.update),this.update=Zt(this.update_,Pt),this.on(this.player_,["durationchange","timeupdate"],this.update),this.on(this.player_,["ended"],this.update_),this.player_.liveTracker&&this.on(this.player_.liveTracker,"liveedgechange",this.update),this.updateInterval=null,this.enableIntervalHandler_=e=>this.enableInterval_(e),this.disableIntervalHandler_=e=>this.disableInterval_(e),this.on(this.player_,["playing"],this.enableIntervalHandler_),this.on(this.player_,["ended","pause","waiting"],this.disableIntervalHandler_),"hidden"in 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,Pt))}disableInterval_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&e&&e.type!=="ended"||this.updateInterval&&(this.clearInterval(this.updateInterval),this.updateInterval=null)}createEl(){return super.createEl("div",{className:"vjs-progress-holder"},{"aria-label":this.localize("Progress Bar")})}update(e){if(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(Es(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){Tr(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbing_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!Tr(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?Wt(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};X.registerComponent("SeekBar",ea);class uh extends X{constructor(e,t){super(e,t),this.handleMouseMove=Zt(Pe(this,this.handleMouseMove),Pt),this.throttledHandleMouseSeek=Zt(Pe(this,this.handleMouseSeek),Pt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!i&&!r)return;const n=t.el(),a=yr(n);let u=Wn(n,e).x;u=Er(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&&Wt(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()}}uh.prototype.options_={children:["seekBar"]};X.registerComponent("ProgressControl",uh);class lh extends nt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){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()}}lh.prototype.controlText_="Picture-in-Picture";X.registerComponent("PictureInPictureToggle",lh);class ch extends nt{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()}}ch.prototype.controlText_="Fullscreen";X.registerComponent("FullscreenToggle",ch);const Hy=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 zy extends X{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}}X.registerComponent("VolumeLevel",zy);class Gy extends X{constructor(e,t){super(e,t),this.update=Zt(Pe(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,r){if(!i){const n=Es(this.el_),a=Es(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()})}}X.registerComponent("VolumeLevelTooltip",Gy);class dh extends X{constructor(e,t){super(e,t),this.update=Zt(Pe(this,this.update),Pt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,r,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}dh.prototype.options_={children:["volumeLevelTooltip"]};X.registerComponent("MouseVolumeLevelDisplay",dh);class ta 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){Tr(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),r=Es(i),n=this.vertical();let a=Wn(i,e);a=n?a.y:a.x,a=Er(a,0,1),t.update(r,a,n)}Tr(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"};!st&&!Ut&&ta.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");ta.prototype.playerEvent="volumechange";X.registerComponent("VolumeBar",ta);class hh extends X{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||xs(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Hy(this,e),this.throttledHandleMouseMove=Zt(Pe(this,this.handleMouseMove),Pt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}hh.prototype.options_={children:["volumeBar"]};X.registerComponent("VolumeControl",hh);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 fh extends nt{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"),st&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),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)}}fh.prototype.controlText_="Mute";X.registerComponent("MuteToggle",fh);class ph extends X{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||xs(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),bt(ne,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),rt(ne,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}ph.prototype.options_={children:["muteToggle","volumeControl"]};X.registerComponent("VolumePanel",ph);class mh extends nt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,r=i&&i.isLive()?i.seekableEnd():this.player_.duration();let n;t+this.skipTime<=r?n=t+this.skipTime:n=r,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}mh.prototype.controlText_="Skip Forward";X.registerComponent("SkipForward",mh);class gh extends nt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,r=i&&i.isLive()&&i.seekableStart();let n;r&&t-this.skipTime<=r?n=r:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}gh.prototype.controlText_="Skip Backward";X.registerComponent("SkipBackward",gh);class _h extends X{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 X&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof X&&(this.off(e,"blur",this.boundHandleBlur_),this.off(e,["tap","click"],this.boundHandleTapClick_))}removeChild(e){typeof e=="string"&&(e=this.getChild(e)),this.removeEventListenerForItem(e),super.removeChild(e)}addItem(e){const t=this.addChild(e);t&&this.addEventListenerForItem(t)}createEl(){const e=this.options_.contentElType||"ul";this.contentEl_=fe(e,{className:"vjs-menu-content"}),this.contentEl_.setAttribute("role","menu");const t=super.createEl("div",{append:this.contentEl_,className:"vjs-menu"});return t.appendChild(this.contentEl_),bt(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||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())}}X.registerComponent("Menu",_h);class eu extends X{constructor(e,t={}){super(e,t),this.menuButton_=new nt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=nt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),bt(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 _h(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=fe("li",{className:"vjs-menu-title",textContent:$e(this.options_.title),tabIndex:-1}),i=new X(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=nt.prototype.buildCSSClass();return`vjs-menu-button ${e} ${t} ${super.buildCSSClass()}`}buildCSSClass(){let e="vjs-menu-button";return this.options_.inline===!0?e+="-inline":e+="-popup",`vjs-menu-button ${e} ${super.buildCSSClass()}`}controlText(e,t=this.menuButton_.el()){return this.menuButton_.controlText(e,t)}dispose(){this.handleMouseLeave(),super.dispose()}handleClick(e){this.buttonPressed_?this.unpressButton():this.pressButton()}handleMouseLeave(e){this.removeClass("vjs-hover"),rt(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"),st&&Ad())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()}}X.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=Pe(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)})}}X.registerComponent("TrackButton",tu);class Cr 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=fe("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?r.appendChild(n):r.replaceChild(n,r.querySelector(".vjs-icon-placeholder")),r}handleKeyDown(e){["Tab","Escape","ArrowUp","ArrowLeft","ArrowRight","ArrowDown"].includes(e.key)||super.handleKeyDown(e)}handleClick(e){this.selected(!0)}selected(e){this.selectable&&(e?(this.addClass("vjs-selected"),this.el_.setAttribute("aria-checked","true"),this.controlText(", selected"),this.isSelected_=!0):(this.removeClass("vjs-selected"),this.el_.setAttribute("aria-checked","false"),this.controlText(""),this.isSelected_=!1))}}X.registerComponent("MenuItem",Cr);class wr extends Cr{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()}}X.registerComponent("TextTrackMenuItem",wr);class yh extends wr{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()}}X.registerComponent("OffTextTrackMenuItem",yh);class Ls extends tu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=wr){let i;this.label_&&(i=`${this.label_} off`),e.push(new yh(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}}X.registerComponent("TextTrackButton",Ls);class Th extends Cr{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)}}X.registerComponent("ChaptersTrackMenuItem",Th);class iu extends Ls{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($e(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 Th(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}iu.prototype.kind_="chapters";iu.prototype.controlText_="Chapters";X.registerComponent("ChaptersButton",iu);class su extends Ls{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const r=e.textTracks(),n=Pe(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";X.registerComponent("DescriptionsButton",su);class ru extends Ls{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";X.registerComponent("SubtitlesButton",ru);class nu extends wr{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()}}X.registerComponent("CaptionSettingsMenuItem",nu);class au extends Ls{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";X.registerComponent("CaptionsButton",au);class vh extends wr{createEl(e,t,i){const r=super.createEl(e,t,i),n=r.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",r):n.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(fe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}X.registerComponent("SubsCapsMenuItem",vh);class ou extends Ls{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($e(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,vh),e}}ou.prototype.kinds_=["captions","subtitles"];ou.prototype.controlText_="Subtitles";X.registerComponent("SubsCapsButton",ou);class bh extends Cr{constructor(e,t){const i=t.track,r=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",n),this.on("dispose",()=>{r.removeEventListener("change",n)})}createEl(e,t,i){const r=super.createEl(e,t,i),n=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(fe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(fe("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),r}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const r=t[i];r!==this.track&&(r.enabled=r===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}X.registerComponent("AudioTrackMenuItem",bh);class xh 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 bh(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}xh.prototype.controlText_="Audio Track";X.registerComponent("AudioTrackButton",xh);class uu extends Cr{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";X.registerComponent("PlaybackRateMenuItem",uu);class Sh 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_=fe("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new 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")}}Sh.prototype.controlText_="Playback Rate";X.registerComponent("PlaybackRateMenuButton",Sh);class Eh extends X{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}X.registerComponent("Spacer",Eh);class Xy extends Eh{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}X.registerComponent("CustomControlSpacer",Xy);class Ch extends X{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Ch.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};X.registerComponent("ControlBar",Ch);class wh extends Is{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):""}}wh.prototype.options_=Object.assign({},Is.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});X.registerComponent("ErrorDisplay",wh);class Ah extends X{constructor(e,t={}){super(e,t),this.el_.setAttribute("aria-labelledby",this.selectLabelledbyIds)}createEl(){return this.selectLabelledbyIds=[this.options_.legendId,this.options_.labelId].join(" ").trim(),fe("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${It()}`)+"-"+t[1].replace(/\W+/g,""),r=fe("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return r.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),r}))}}X.registerComponent("TextTrackSelect",Ah);class zi extends X{constructor(e,t={}){super(e,t);const i=fe("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const r=this.options_.selects;for(const n of r){const a=this.options_.selectConfigs[n],u=a.className,l=a.id.replace("%s",this.options_.id_);let f=null;const m=`vjs_select_${It()}`;if(this.options_.type==="colors"){f=fe("span",{className:u});const w=fe("label",{id:l,className:"vjs-label",textContent:this.localize(a.label)});w.setAttribute("for",m),f.appendChild(w)}const _=new Ah(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 fe("fieldset",{className:this.options_.className})}}X.registerComponent("TextTrackFieldset",zi);class Dh extends X{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,r=new zi(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const n=new zi(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new zi(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return fe("div",{className:"vjs-track-settings-colors"})}}X.registerComponent("TextTrackSettingsColors",Dh);class kh extends X{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,r=new zi(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const n=new zi(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new zi(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return fe("div",{className:"vjs-track-settings-font"})}}X.registerComponent("TextTrackSettingsFont",kh);class Ih extends X{constructor(e,t={}){super(e,t);const i=new nt(e,{controlText:this.localize("restore all settings to the default values"),className:"vjs-default-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Reset"),this.addChild(i);const r=this.localize("Done"),n=new nt(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=r,this.addChild(n)}createEl(){return fe("div",{className:"vjs-track-settings-controls"})}}X.registerComponent("TrackSettingsControls",Ih);const Ha="vjs-text-track-settings",ac=["#000","Black"],oc=["#00F","Blue"],uc=["#0FF","Cyan"],lc=["#0F0","Green"],cc=["#F0F","Magenta"],dc=["#F00","Red"],hc=["#FFF","White"],fc=["#FF0","Yellow"],za=["1","Opaque"],Ga=["0.5","Semi-Transparent"],pc=["0","Transparent"],Ei={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[ac,hc,dc,lc,oc,fc,cc,uc],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[za,Ga,pc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[hc,ac,dc,lc,oc,fc,cc,uc],className:"vjs-text-color"},edgeStyle:{selector:".vjs-edge-style > select",id:"",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Drop shadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:s=>s==="1.00"?null:Number(s)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[za,Ga],className:"vjs-text-opacity vjs-opacity"},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color",className:"vjs-window-color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Opacity",options:[pc,Ga,za],className:"vjs-window-opacity vjs-opacity"}};Ei.windowColor.options=Ei.backgroundColor.options;function Ph(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function Ky(s,e){const t=s.options[s.options.selectedIndex].value;return Ph(t,e)}function Yy(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(Ph(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Qy extends Is{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=fe("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new Dh(e,{textTrackComponentid:this.id_,selectConfigs:Ei,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new kh(e,{textTrackComponentid:this.id_,selectConfigs:Ei,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const r=new Ih(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()}),ls(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 vd(Ei,(e,t,i)=>{const r=Ky(this.$(t.selector),t.parser);return r!==void 0&&(e[i]=r),e},{})}setValues(e){ls(Ei,(t,i)=>{Yy(this.$(t.selector),e[i],t.parser)})}setDefaults(){ls(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(Ha))}catch(t){ve.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?D.localStorage.setItem(Ha,JSON.stringify(e)):D.localStorage.removeItem(Ha)}catch(t){ve.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}X.registerComponent("TextTrackSettings",Qy);class Jy extends X{constructor(e,t){let i=t.ResizeObserver||D.ResizeObserver;t.ResizeObserver===null&&(i=!1);const r=Ae({createEl:!i,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||D.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Vd(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){rt(this,"resize",n),rt(this,"unload",a),a=null};bt(this.el_.contentWindow,"unload",a),bt(this.el_.contentWindow,"resize",n)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}X.registerComponent("ResizeManager",Jy);const Zy={trackingThreshold:20,liveTolerance:15};class eT extends X{constructor(e,t){const i=Ae(Zy,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=r=>this.handlePlay(r),this.handleFirstTimeupdate_=r=>this.handleFirstTimeupdate(r),this.handleSeeked_=r=>this.handleSeeked(r),this.seekToLiveEdge_=r=>this.seekToLiveEdge(r),this.reset_(),this.on(this.player_,"durationchange",r=>this.handleDurationchange(r)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(D.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const r=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||r===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,Pt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}X.registerComponent("LiveTracker",eT);class tT extends X{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:fe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${It()}`}),description:fe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${It()}`})},fe("div",{className:"vjs-title-bar"},{},bd(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}}X.registerComponent("TitleBar",tT);const iT={initialDisplay:4e3,position:[],takeFocus:!1};class sT extends nt{constructor(e,t){t=Ae(iT,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=fe("button",{},{type:"button",class:this.buildCSSClass()},fe("span"));return this.controlTextEl_=e.querySelector("span"),e}show(){super.show(),this.addClass("force-display"),this.options_.takeFocus&&this.el().focus({preventScroll:!0}),this.forceDisplayTimeout=this.player_.setTimeout(()=>{this.removeClass("force-display")},this.options_.initialDisplay)}hide(){this.removeClass("force-display"),super.hide()}dispose(){this.player_.clearTimeout(this.forceDisplayTimeout),super.dispose()}}X.registerComponent("TransientButton",sT);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},rT=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}}),Lh=(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},nT=s=>Lh([s.el(),D.HTMLMediaElement.prototype,D.Element.prototype,rT],"innerHTML"),mc=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=nT(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",Ae(i,{set:r(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},aT=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?eh(D.Element.prototype.getAttribute.call(this,"src")):""},set(s){return D.Element.prototype.setAttribute.call(this,"src",s),s}}),oT=s=>Lh([s.el(),D.HTMLMediaElement.prototype,aT],"src"),uT=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=oT(s),i=e.setAttribute,r=e.load;Object.defineProperty(e,"src",Ae(t,{set:n=>{const a=t.set.call(e,n);return s.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const u=i.call(e,n,a);return/src/i.test(n)&&s.triggerSourceset(e.src),u},e.load=()=>{const n=r.call(e);return go(s)||(s.triggerSourceset(""),mc(s)),n},e.currentSrc?s.triggerSourceset(e.currentSrc):go(s)||mc(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class le extends _e{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&&ve.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
160
+ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(_r||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_(){uT(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let n=0;n<e.length;n++){const a=e[n];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const r=()=>{for(let n=0;n<t.length;n++){const a=t[n];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(r=>{this.el()[`${i}Tracks`].removeEventListener(r,this[`${i}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=kt[e],i=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const n={change:u=>{const l={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(l),e==="text"&&this[ws.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_(){kt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),le.disposeMediaElement(e),e=i}else{e=ne.createElement("video");const i=this.options_.tag&&Si(this.options_.tag),r=Ae({},i);(!_r||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Id(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Ss(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?Ss(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){ve(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Ut&&Jt&&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)Wt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return ve.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const r=fe("source",{},i);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return ve.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return ve.warn(`No matching source element found with src: ${e}`),!1}reset(){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(!As())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&&st?(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?Ss(le.TEST_VID,"muted","muted"):Gn(le.TEST_VID,"muted","muted"),s!==le.TEST_VID.muted}catch{return!1}};le.canControlPlaybackRate=function(){if(Ut&&Jt&&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||st&&Jt};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=!st;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"+$e(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"+$e(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){le.prototype[s]=function(){return this.el_[s]()}});_e.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);_e.registerTech("Html5",le);const Oh=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Wa={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 lT={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ee extends X{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${It()}`,t=Object.assign(Ee.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=yd(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_=Ee.prototype.options_.languages;this.resetCache_(),this.poster_=t.poster||"",this.controls_=!!t.controls,e.controls=!1,e.removeAttribute("controls"),this.changingSrc_=!1,this.playCallbacks_=[],this.playTerminatedQueue_=[],e.hasAttribute("autoplay")?this.autoplay(!0):this.autoplay(this.options_.autoplay),t.plugins&&Object.keys(t.plugins).forEach(a=>{if(typeof this[a]!="function")throw new Error(`plugin "${a}" does not exist`)}),this.scrubbing_=!1,this.el_=this.createEl(),$o(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(bt(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=Ae(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const u=new D.DOMParser().parseFromString(Ly,"image/svg+xml");if(u.querySelector("parsererror"))ve.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const f=u.documentElement;f.style.display="none",this.el_.appendChild(f),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new Oy(this),this.addClass("vjs-spatial-navigation-enabled")),_r&&this.addClass("vjs-touch-enabled"),st||this.addClass("vjs-workinghover"),Ee.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"),rt(ne,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),rt(ne,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ee.players[this.id_]=null,this.tag&&this.tag.player&&(this.tag.player=null),this.el_&&this.el_.player&&(this.el_.player=null),this.tech_&&(this.tech_.dispose(),this.isPosterFromTech_=!1,this.poster_=""),this.playerElIngest_&&(this.playerElIngest_=null),this.tag&&(this.tag=null),Dy(this),ct.names.forEach(e=>{const t=ct[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const n=Si(e);if(r){for(t=this.el_=e,e=this.tag=ne.createElement("video");t.children.length;)e.appendChild(t.firstChild);dr(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",Jt&&$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=>wd[l]).map(l=>"vjs-device-"+l.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),D.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=qd("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"){ve.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){ve.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,ui(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),ay(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),$d(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=He(e),r=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(Te.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=Te.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(Me(this,this.handleTechReady_),!0),fo.jsonToTextTracks(this.textTracksJson_||[],this.tech_),kh.forEach(l=>{this.on(this.tech_,l,f=>this[`handleTech${He(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&&Ee.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
169
+ `)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=$e(e),r=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(_e.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};ct.names.forEach(l=>{const f=ct[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=_e.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(Pe(this,this.handleTechReady_),!0),po.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Oh.forEach(l=>{this.on(this.tech_,l,f=>this[`handleTech${$e(l)}_`](f))}),Object.keys(Wa).forEach(l=>{this.on(this.tech_,l,f=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Wa[l]}_`].bind(this),event:f});return}this[`handleTech${Wa[l]}_`](f)})}),this.on(this.tech_,"loadstart",l=>this.handleTechLoadStart_(l)),this.on(this.tech_,"sourceset",l=>this.handleTechSourceset_(l)),this.on(this.tech_,"waiting",l=>this.handleTechWaiting_(l)),this.on(this.tech_,"ended",l=>this.handleTechEnded_(l)),this.on(this.tech_,"seeking",l=>this.handleTechSeeking_(l)),this.on(this.tech_,"play",l=>this.handleTechPlay_(l)),this.on(this.tech_,"pause",l=>this.handleTechPause_(l)),this.on(this.tech_,"durationchange",l=>this.handleTechDurationChange_(l)),this.on(this.tech_,"fullscreenchange",(l,f)=>this.handleTechFullscreenChange_(l,f)),this.on(this.tech_,"fullscreenerror",(l,f)=>this.handleTechFullscreenError_(l,f)),this.on(this.tech_,"enterpictureinpicture",l=>this.handleTechEnterPictureInPicture_(l)),this.on(this.tech_,"leavepictureinpicture",l=>this.handleTechLeavePictureInPicture_(l)),this.on(this.tech_,"error",l=>this.handleTechError_(l)),this.on(this.tech_,"posterchange",l=>this.handleTechPosterChange_(l)),this.on(this.tech_,"textdata",l=>this.handleTechTextData_(l)),this.on(this.tech_,"ratechange",l=>this.handleTechRateChange_(l)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(i!=="Html5"||!this.tag)&&oo(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){ct.names.forEach(e=>{const t=ct[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=po.textTracksToJson(this.tech_),this.isReady_=!1,this.tech_.dispose(),this.tech_=!1,this.isPosterFromTech_&&(this.poster_="",this.trigger("posterchange")),this.isPosterFromTech_=!1}tech(e){return e===void 0&&ve.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
170
170
  See https://github.com/videojs/video.js/issues/2617 for more info.
171
- `),this.tech_}version(){return{"video.js":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=dy(this,t)),this.cache_.source=Pe({},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=Ei(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()?Qt(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 ay)return ry(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 Ee(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in ny)return sy(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?(Ee(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Ee(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Ee(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Qt){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")||$t(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=$t(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=$t(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 Wd(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&&Qt(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,Ct(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(pe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),D.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Rd(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=Te.getTech(n);if(a||(a=Y.getComponent(n)),!a){Ee.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,Te.getTech(u)]).filter(([u,l])=>l?l.isSupported():(Ee.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=Zd(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]),ty(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}iy(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?Vd(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();Qt(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(Ai("beforeerror").forEach(t=>{const i=t(this,e);if(!(ti(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 $e(e),this.addClass("vjs-error"),Ee.error(`(CODE:${this.error_.code} ${$e.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Ai("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=Me(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&&!Vt&&(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 Pe(Ae.prototype.options_.languages,this.languages_)}toJSON(){const e=Pe(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let r=t[i];r=Pe(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({},Vy,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=Pe(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 Pe(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Ei(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){Ee.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(Ei(l)):f==="track"&&t.tracks.push(Ei(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:Te.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};kh.forEach(function(s){Ae.prototype[`handleTech${He(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,Ih=(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)},Hy=function(s,e){const t=function(){kn(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return Ih(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 vt{constructor(e){if(this.constructor===vt)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,$d(this,this.constructor.defaultState),Ih(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"&&!vt.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))Ee.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&&(vt.isBasic(t)?Ae.prototype[e]=Hy(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||""}}vt.getPlugin=hn;vt.BASE_PLUGIN_NAME=An;vt.registerPlugin(An,vt);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||Ee.warn(s),t=!0,e.apply(this,i)}}function Ht(s,e,t,i){return zy(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var Gy={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 Ph=s=>s.indexOf("#")===0?s.slice(1):s;function $(s,e,t){let i=$.getPlayer(s);if(i)return e&&Ee.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const r=typeof s=="string"?Di("#"+Ph(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))&&Ee.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)),Ai("beforesetup").forEach(l=>{const f=l(r,Pe(e));if(!ti(f)||Array.isArray(f)){Ee.error("please return an object in beforesetup hooks");return}e=Pe(e,f)});const u=Y.getComponent("Player");return i=new u(r,e,t),Ai("setup").forEach(l=>l(i)),i}$.hooks_=oi;$.hooks=Ai;$.hook=w_;$.hookOnce=A_;$.removeHook=fd;if(D.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&ws()){let s=Di(".vjs-styles-defaults");if(!s){s=Bd("vjs-styles-defaults");const e=Di("head");e&&e.insertBefore(s,e.firstChild),Fd(s,`
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(fr(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(),fr(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!fr(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=Py(this,t)),this.cache_.source=Ae({},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()?Wt(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 wy)return Ey(this.middleware_,this.tech_,e,t);if(e in ec)return Zl(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw ve(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in Cy)return Sy(this.middleware_,this.tech_,e);if(e in ec)return Zl(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ve(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ve(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ve(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Wt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(Hn||st);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const r=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),r===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(r)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ft(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=Ft(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ft(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 Qd(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&&Wt(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,bt(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,rt(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(fe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),D.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Fd(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=X.getComponent("FullscreenToggle");ne[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),X.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),X.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=_e.getTech(n);if(a||(a=X.getComponent(n)),!a){ve.error(`The "${n}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(u=>[u,_e.getTech(u)]).filter(([u,l])=>l?l.isSupported():(ve.error(`The "${u}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(u,l,f){let 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=sh(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]),by(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}xy(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?Wd(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();Wt(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}),ui(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(!(Qt(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 Ue(e),this.addClass("vjs-error"),ve.error(`(CODE:${this.error_.code} ${Ue.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=Pe(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&&!st&&!Ut&&(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(),ui(this)&&this.trigger("languagechange"))}languages(){return Ae(Ee.prototype.options_.languages,this.languages_)}toJSON(){const e=Ae(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let r=t[i];r=Ae(r),r.player=void 0,e.tracks[i]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Is(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({},lT,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=Ae(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 Ae(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Si(e),r=i["data-setup"];if(dr(e,"vjs-fill")&&(i.fill=!0),dr(e,"vjs-fluid")&&(i.fluid=!0),r!==null)try{Object.assign(i,JSON.parse(r||"{}"))}catch(n){ve.error("data-setup",n)}if(Object.assign(t,i),e.hasChildNodes()){const n=e.childNodes;for(let a=0,u=n.length;a<u;a++){const l=n[a],f=l.nodeName.toLowerCase();f==="source"?t.sources.push(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"))}}Ee.prototype.videoTracks=()=>{};Ee.prototype.audioTracks=()=>{};Ee.prototype.textTracks=()=>{};Ee.prototype.remoteTextTracks=()=>{};Ee.prototype.remoteTextTrackEls=()=>{};ct.names.forEach(function(s){const e=ct[s];Ee.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ee.prototype.crossorigin=Ee.prototype.crossOrigin;Ee.players={};const rr=D.navigator;Ee.prototype.options_={techOrder:_e.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:rr&&(rr.languages&&rr.languages[0]||rr.userLanguage||rr.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};Oh.forEach(function(s){Ee.prototype[`handleTech${$e(s)}_`]=function(){return this.trigger(s)}});X.registerComponent("Player",Ee);const An="plugin",hs="activePlugins_",as={},Dn=s=>as.hasOwnProperty(s),hn=s=>Dn(s)?as[s]:void 0,Rh=(s,e)=>{s[hs]=s[hs]||{},s[hs][e]=!0},kn=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},cT=function(s,e){const t=function(){kn(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return Rh(this,s),kn(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},gc=(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 mt{constructor(e){if(this.constructor===mt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),$o(this),delete this.trigger,Gd(this,this.constructor.defaultState),Rh(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 ks(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[hs][e]=!1,this.player=this.state=null,t[e]=gc(e,as[e])}static isBasic(e){const t=typeof e=="string"?hn(e):e;return typeof t=="function"&&!mt.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Dn(e))ve.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ee.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return as[e]=t,e!==An&&(mt.isBasic(t)?Ee.prototype[e]=cT(e,t):Ee.prototype[e]=gc(e,t)),t}static deregisterPlugin(e){if(e===An)throw new Error("Cannot de-register base plugin.");Dn(e)&&(delete as[e],delete Ee.prototype[e])}static getPlugins(e=Object.keys(as)){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||""}}mt.getPlugin=hn;mt.BASE_PLUGIN_NAME=An;mt.registerPlugin(An,mt);Ee.prototype.usingPlugin=function(s){return!!this[hs]&&this[hs][s]===!0};Ee.prototype.hasPlugin=function(s){return!!Dn(s)};function dT(s,e){let t=!1;return function(...i){return t||ve.warn(s),t=!0,e.apply(this,i)}}function jt(s,e,t,i){return dT(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var hT={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 Nh=s=>s.indexOf("#")===0?s.slice(1):s;function $(s,e,t){let i=$.getPlayer(s);if(i)return e&&ve.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const r=typeof s=="string"?Ai("#"+Nh(s)):s;if(!Ds(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in r?r.getRootNode()instanceof D.ShadowRoot:!1)?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!a.contains(r))&&ve.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(r.parentNode&&r.parentNode.hasAttribute&&r.parentNode.hasAttribute("data-vjs-player")?r.parentNode:r).cloneNode(!0)),wi("beforesetup").forEach(l=>{const f=l(r,Ae(e));if(!Qt(f)||Array.isArray(f)){ve.error("please return an object in beforesetup hooks");return}e=Ae(e,f)});const u=X.getComponent("Player");return i=new u(r,e,t),wi("setup").forEach(l=>l(i)),i}$.hooks_=ni;$.hooks=wi;$.hook=G_;$.hookOnce=W_;$.removeHook=_d;if(D.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&As()){let s=Ai(".vjs-styles-defaults");if(!s){s=qd("vjs-styles-defaults");const e=Ai("head");e&&e.insertBefore(s,e.firstChild),$d(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
- `)}}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=Ph(s),r=e[i];if(r)return r;t=Di("#"+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)=>(Te.isTech(e)&&Ee.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=Te.getTech;$.registerTech=Te.registerTech;$.use=ey;Object.defineProperty($,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty($.middleware,"TERMINATOR",{value:Cn,writeable:!1,enumerable:!0});$.browser=xd;$.obj=I_;$.mergeOptions=Ht(9,"videojs.mergeOptions","videojs.obj.merge",Pe);$.defineLazyProperty=Ht(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",jn);$.bind=Ht(9,"videojs.bind","native Function.prototype.bind",Me);$.registerPlugin=vt.registerPlugin;$.deregisterPlugin=vt.deregisterPlugin;$.plugin=(s,e)=>(Ee.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),vt.registerPlugin(s,e));$.getPlugins=vt.getPlugins;$.getPlugin=vt.getPlugin;$.getPluginVersion=vt.getPluginVersion;$.addLanguage=function(s,e){return s=(""+s).toLowerCase(),$.options.languages=Pe($.options.languages,{[s]:e}),$.options.languages[s]};$.log=Ee;$.createLogger=pd;$.time=z_;$.createTimeRange=Ht(9,"videojs.createTimeRange","videojs.time.createTimeRanges",$t);$.createTimeRanges=Ht(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",$t);$.formatTime=Ht(9,"videojs.formatTime","videojs.time.formatTime",Wi);$.setFormatTime=Ht(9,"videojs.setFormatTime","videojs.time.setFormatTime",zd);$.resetFormatTime=Ht(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Gd);$.parseUrl=Ht(9,"videojs.parseUrl","videojs.url.parseUrl",zo);$.isCrossOrigin=Ht(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Jn);$.EventTarget=wt;$.any=jo;$.on=Ct;$.one=Yn;$.off=ut;$.trigger=Ds;$.xhr=Jc;$.TrackList=Xi;$.TextTrack=xr;$.TextTrackList=Vo;$.AudioTrack=Qd;$.AudioTrackList=Xd;$.VideoTrack=Jd;$.VideoTrackList=Kd;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{$[s]=function(){return Ee.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Nd[s].apply(null,arguments)}});$.computedStyle=Ht(9,"videojs.computedStyle","videojs.dom.computedStyle",Es);$.dom=Nd;$.fn=U_;$.num=by;$.str=V_;$.url=J_;$.Error=Gy;class Wy{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 Wy(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 Lh="4.1.0";const Xy=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=Lh,i},Oh=function(s){return Xy(this,$.obj.merge({},s))};$.registerPlugin("qualityLevels",Oh);Oh.VERSION=Lh;const yt=Mn,Pn=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,Nt=s=>$.log.debug?$.log.debug.bind($,"VHS:",`${s} >`):function(){};function De(...s){const e=$.obj||$;return(e.merge||e.mergeOptions).apply(e,s)}function it(...s){const e=$.time||$;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function Ky(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
180
+ `)}}lo(1,$);$.VERSION=no;$.options=Ee.prototype.options_;$.getPlayers=()=>Ee.players;$.getPlayer=s=>{const e=Ee.players;let t;if(typeof s=="string"){const i=Nh(s),r=e[i];if(r)return r;t=Ai("#"+i)}else t=s;if(Ds(t)){const{player:i,playerId:r}=t;if(i||e[r])return i||e[r]}};$.getAllPlayers=()=>Object.keys(Ee.players).map(s=>Ee.players[s]).filter(Boolean);$.players=Ee.players;$.getComponent=X.getComponent;$.registerComponent=(s,e)=>(_e.isTech(e)&&ve.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),X.registerComponent.call(X,s,e));$.getTech=_e.getTech;$.registerTech=_e.registerTech;$.use=vy;Object.defineProperty($,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty($.middleware,"TERMINATOR",{value:Cn,writeable:!1,enumerable:!0});$.browser=wd;$.obj=Y_;$.mergeOptions=jt(9,"videojs.mergeOptions","videojs.obj.merge",Ae);$.defineLazyProperty=jt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",jn);$.bind=jt(9,"videojs.bind","native Function.prototype.bind",Pe);$.registerPlugin=mt.registerPlugin;$.deregisterPlugin=mt.deregisterPlugin;$.plugin=(s,e)=>(ve.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),mt.registerPlugin(s,e));$.getPlugins=mt.getPlugins;$.getPlugin=mt.getPlugin;$.getPluginVersion=mt.getPluginVersion;$.addLanguage=function(s,e){return s=(""+s).toLowerCase(),$.options.languages=Ae($.options.languages,{[s]:e}),$.options.languages[s]};$.log=ve;$.createLogger=yd;$.time=dy;$.createTimeRange=jt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ft);$.createTimeRanges=jt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ft);$.formatTime=jt(9,"videojs.formatTime","videojs.time.formatTime",Wi);$.setFormatTime=jt(9,"videojs.setFormatTime","videojs.time.setFormatTime",Kd);$.resetFormatTime=jt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Yd);$.parseUrl=jt(9,"videojs.parseUrl","videojs.url.parseUrl",Go);$.isCrossOrigin=jt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Jn);$.EventTarget=xt;$.any=qo;$.on=bt;$.one=Yn;$.off=rt;$.trigger=ks;$.xhr=id;$.TrackList=Xi;$.TextTrack=Sr;$.TextTrackList=Ho;$.AudioTrack=th;$.AudioTrackList=Jd;$.VideoTrack=ih;$.VideoTrackList=Zd;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{$[s]=function(){return ve.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Ud[s].apply(null,arguments)}});$.computedStyle=jt(9,"videojs.computedStyle","videojs.dom.computedStyle",Cs);$.dom=Ud;$.fn=ny;$.num=qy;$.str=ly;$.url=yy;$.Error=hT;class fT{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 fT(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 Mh="4.1.0";const pT=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=Mh,i},Bh=function(s){return pT(this,$.obj.merge({},s))};$.registerPlugin("qualityLevels",Bh);Bh.VERSION=Mh;const ft=Mn,Pn=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,Ot=s=>$.log.debug?$.log.debug.bind($,"VHS:",`${s} >`):function(){};function Ce(...s){const e=$.obj||$;return(e.merge||e.mergeOptions).apply(e,s)}function Ze(...s){const e=$.time||$;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function mT(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 Jt=1/30,Zt=Jt*3,Rh=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 it(t)},as=function(s,e){return Rh(s,function(t,i){return t-Zt<=e&&i+Zt>=e})},an=function(s,e){return Rh(s,function(t){return t-Jt>=e})},Yy=function(s){if(s.length<2)return it();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 it(e)},Qy=function(s,e){let t=null,i=null,r=0;const n=[],a=[];if(!s||!s.length||!e||!e.length)return it();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 it(a)},Nh=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(", ")},Jy=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},Zy=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),[]),Mh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Bh=({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},Fh=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Mh(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},eT=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}},tT=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}},Uh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=eT(s,e);if(i.precise)return i.result;const r=tT(s,e);return r.precise?r.result:i.result+t},jh=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 Uh(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},qh=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return jh(s);if(e===null)return null;e=e||0;let r=Uh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Fh(null,s),r-=i),Math.max(0,r)},iT=function(s,e,t){const r=e||0;let n=qh(s,e,!0,t);return n===null?it():(n<r&&(n=r),it(r,n))},sT=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+Jt<=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>Jt,w=a===0,x=_&&a+Jt>=0;if(!((w||x)&&f!==u.length-1)){if(n){if(a>0)continue}else if(a-Jt>=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}},$h=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},cu=function(s){return s.excludeUntil&&s.excludeUntil===1/0},ia=function(s){const e=$h(s);return!s.disabled&&!e},rT=function(s){return s.disabled},nT=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},Vh=function(s,e){return e.attributes&&e.attributes[s]},aT=function(s,e,t,i=0){return Vh("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=>td(n))||fc(s,n=>du(t,n))))return!1}return!0};var Tt={liveEdgeDelay:Fh,duration:jh,seekable:iT,getMediaInfoForTime:sT,isEnabled:ia,isDisabled:rT,isExcluded:$h,isIncompatible:cu,playlistEnd:qh,isAes:nT,hasAttribute:Vh,estimateSegmentRequestTime:aT,isLowestEnabledRendition:yo,isAudioOnly:wr,playlistMatch:du,segmentDurationWithParts:lu};const{log:Hh}=$,hs=(s,e)=>`${s}-${e}`,zh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,oT=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:r=[],llhls:n})=>{const a=new Xg;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(f=>a.addParser(f)),r.forEach(f=>a.addTagMapper(f)),a.push(t),a.end();const u=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(f){u.hasOwnProperty(f)&&delete u[f]}),u.segments&&u.segments.forEach(function(f){["parts","preloadHints"].forEach(function(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=Mh(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}`}),Hh.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)}})},Gh=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},uT=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];Gh({playlist:t,id:hs(e,t.uri)}),t.resolvedUri=yt(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||Hh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},lT=s=>{Ls(s,e=>{e.uri&&(e.resolvedUri=yt(s.uri,e.uri))})},cT=(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},Wh=(s,e,t=zh)=>{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=[Xe({},r)]}r.playlists.forEach(function(l,f){const m=t(n,a,u,l),_=hs(f,m);l.uri?l.resolvedUri=l.resolvedUri||yt(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})}),uT(s),lT(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 Xh=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=Xe({},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},dT=Nt("CodecUtils"),Kh=function(s){const e=s.attributes||{};if(e.CODECS)return Kt(e.CODECS)},Yh=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},hT=(s,e)=>{if(!Yh(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(ed(`${i}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){dT(`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(Kh(e)||[]);if(Yh(s,e)&&!i.audio&&!hT(s,e)){const r=Tr(Yg(s,t.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},{EventTarget:fT}=$,pT=(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=Bh(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},mT=(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},gT=(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(mT(l,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},Qh=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=yt(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=yt(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=yt(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=yt(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=yt(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=yt(e,t.uri))})},Jh=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},Zh=(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=Zh)=>{const i=De(s,{}),r=i.playlists[e.id];if(!r||t(r,e))return null;e.segments=Jh(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=gT(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}n.segments.forEach(a=>{Qh(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 fT{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Nt("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=yt(this.main.uri,e.uri);this.llhls&&(t=pT(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=oT({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=Kh(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(),Gh({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,Wh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=Jh(i),i.segments.forEach(r=>{Qh(r,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||D.location.href;this.main=cT(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]=Xe({},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=zh(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)},_T=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},yT=(s,e,t,i)=>{!s||!s.size||s.forEach(r=>{r(e,t,i)})},ef=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=_T(n,t);n.delete(r);const f=u(l||t,function(_,w){return yT(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},TT=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=TT(s.byterange)),e},vT=function(s,e){return s.start(e)+"-"+s.end(e)},bT=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},xT=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},tf=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];sd(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(",")},sf=function(s){return s.resolvedUri},rf=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(bT).join(""),n=e.slice(a*t,a*t+t).map(xT).join(""),i+=r+" "+n+`
183
- `;return i},ST=({bytes:s})=>rf(s),ET=s=>{let e="",t;for(t=0;t<s.length;t++)e+=vT(s,t)+" ";return e};var CT=Object.freeze({__proto__:null,createTransferableMessage:tf,initSegmentId:Ln,segmentKeyId:sf,hexDump:rf,tagDump:ST,textRanges:ET});const nf=.25,wT=(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)},AT=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,DT=(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?AT(r.videoTimingInfo):r.duration+r.duration*nf,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:Tt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},kT=(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*nf)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},IT=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const r=t.getTime();return(i.getTime()-r)/1e3},PT=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},LT=({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=kT(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=wT(e,i.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},af=({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(!PT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=DT(s,e);if(!u)return a({message:`${s} was not found in the stream`});const l=u.segment,f=IT(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",()=>{af({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()},OT=(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=a0(r,rd(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:RT}=$,_c=function(s,e){if(!Zh(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},NT=(s,e,t,i)=>{const r=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},MT=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:r})=>{const n=r_(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:r});return Wh(n,e,NT),n},BT=(s,e)=>{Ls(s,(t,i,r,n)=>{(!e.mediaGroups[i][r]||!(n in e.mediaGroups[i][r]))&&delete s.mediaGroups[i][r][n]})},FT=(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)}}),BT(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:r},UT=(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;UT(u,n)&&(t[a]=e[a])}}return t},jT=(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 RT{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_=Nt("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=l_(he(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=OT(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=n_(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:yt(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=MT({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=FT(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_=jT(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 et={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 qT=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},of=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},$T=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())}},uf=function(s){return function(){const e=$T(s),t=of(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}},lf=function(s){return`var browserWorkerPolyFill = ${of.toString()};
182
+ `}return e}const Xt=1/30,Kt=Xt*3,Fh=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 Ze(t)},os=function(s,e){return Fh(s,function(t,i){return t-Kt<=e&&i+Kt>=e})},on=function(s,e){return Fh(s,function(t){return t-Xt>=e})},gT=function(s){if(s.length<2)return Ze();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 Ze(e)},_T=function(s,e){let t=null,i=null,r=0;const n=[],a=[];if(!s||!s.length||!e||!e.length)return Ze();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 Ze(a)},Uh=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(", ")},yT=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},TT=function(s,e){if(s===e)return!1;if(!s&&e||!e&&s||s.length!==e.length)return!0;for(let t=0;t<s.length;t++)if(s.start(t)!==e.start(t)||s.end(t)!==e.end(t))return!0;return!1},Xa=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},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),[]),jh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},qh=({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},$h=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=jh(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},vT=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}},bT=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}},Vh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=vT(s,e);if(i.precise)return i.result;const r=bT(s,e);return r.precise?r.result:i.result+t},Hh=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 Vh(s,e,t)},pr=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},zh=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return Hh(s);if(e===null)return null;e=e||0;let r=Vh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:$h(null,s),r-=i),Math.max(0,r)},xT=function(s,e,t){const r=e||0;let n=zh(s,e,!0,t);return n===null?Ze():(n<r&&(n=r),Ze(r,n))},ST=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+Xt<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r-pr({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>Xt,w=a===0,x=_&&a+Xt>=0;if(!((w||x)&&f!==u.length-1)){if(n){if(a>0)continue}else if(a-Xt>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r+pr({defaultDuration:s.targetDuration,durationList:u,startIndex:l,endIndex:f})}}}return{segmentIndex:u[u.length-1].segmentIndex,partIndex:u[u.length-1].partIndex,startTime:e}},Gh=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},du=function(s){return s.excludeUntil&&s.excludeUntil===1/0},ia=function(s){const e=Gh(s);return!s.disabled&&!e},ET=function(s){return s.disabled},CT=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},Wh=function(s,e){return e.attributes&&e.attributes[s]},wT=function(s,e,t,i=0){return Wh("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=>ia(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),_c=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},Ar=s=>{if(!s||!s.playlists||!s.playlists.length)return _c(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=>nd(n))||_c(s,n=>hu(t,n))))return!1}return!0};var pt={liveEdgeDelay:$h,duration:Hh,seekable:xT,getMediaInfoForTime:ST,isEnabled:ia,isDisabled:ET,isExcluded:Gh,isIncompatible:du,playlistEnd:zh,isAes:CT,hasAttribute:Wh,estimateSegmentRequestTime:wT,isLowestEnabledRendition:To,isAudioOnly:Ar,playlistMatch:hu,segmentDurationWithParts:cu};const{log:Xh}=$,fs=(s,e)=>`${s}-${e}`,Kh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,AT=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:r=[],llhls:n})=>{const a=new p0;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=jh(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}`}),Xh.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},Os=(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)}})},Yh=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},DT=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];Yh({playlist:t,id:fs(e,t.uri)}),t.resolvedUri=ft(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||Xh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},kT=s=>{Os(s,e=>{e.uri&&(e.resolvedUri=ft(s.uri,e.uri))})},IT=(s,e)=>{const t=fs(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},Qh=(s,e,t=Kh)=>{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=Ar(s);Os(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=[He({},r)]}r.playlists.forEach(function(l,f){const m=t(n,a,u,l),_=fs(f,m);l.uri?l.resolvedUri=l.resolvedUri||ft(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})}),DT(s),kT(s)};class yc{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 Jh=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=He({},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},PT=Ot("CodecUtils"),Zh=function(s){const e=s.attributes||{};if(e.CODECS)return zt(e.CODECS)},ef=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},LT=(s,e)=>{if(!ef(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},vr=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:r})=>{e[t]=e[t]||[],e[t].push(rd(`${i}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){PT(`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},Tc=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},mr=function(s,e){const t=e.attributes||{},i=vr(Zh(e)||[]);if(ef(s,e)&&!i.audio&&!LT(s,e)){const r=vr(g0(s,t.AUDIO)||[]);r.audio&&(i.audio=r.audio)}return i},{EventTarget:OT}=$,RT=(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=qh(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},NT=(s,e)=>{if(!s)return e;const t=Ce(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i<e.parts.length;i++)s.parts&&s.parts[i]&&(t.parts[i]=Ce(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},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(NT(l,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},tf=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=ft(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=ft(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=ft(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=ft(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=ft(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=ft(e,t.uri))})},sf=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},rf=(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=rf)=>{const i=Ce(s,{}),r=i.playlists[e.id];if(!r||t(r,e))return null;e.segments=sf(e);const n=Ce(r,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}n.segments=MT(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}n.segments.forEach(a=>{tf(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,Os(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},vc=(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 us extends OT{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Ot("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 yc,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=ft(this.main.uri,e.uri);this.llhls&&(t=RT(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=Zh(i)||[];return!!vr(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(),Yh({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=vc(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 yc,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=vc(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,Qh(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=sf(i),i.segments.forEach(r=>{tf(r,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||D.location.href;this.main=IT(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=fs(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=fs(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]=He({},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],I=Kh(n,t,u),y=fs(t,I);if(x&&!r.playlists[y]){const P=this.createClonePlaylist_(x,y,e),N=P.resolvedUri;r.playlists[y]=P,r.playlists[N]=P}f.playlists[w]=this.createClonePlaylist_(_,y,e)})}}})}createClonePlaylist_(e,t,i,r){const n=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),Ce(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(r))i.searchParams.set(n,r[n]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(i[r]=e)}),i}getKeyIdSet(e){const t=new Set;if(!e||!e.contentProtection)return t;for(const i in e.contentProtection)if(e.contentProtection[i]&&e.contentProtection[i].attributes&&e.contentProtection[i].attributes.keyId){const r=e.contentProtection[i].attributes.keyId;t.add(r.toLowerCase())}return t}}const 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)},BT=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},FT=(s,e,t,i)=>{!s||!s.size||s.forEach(r=>{r(e,t,i)})},nf=function(){const s=function e(t,i){t=Ce({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=BT(n,t);n.delete(r);const f=u(l||t,function(_,w){return FT(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},UT=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=UT(s.byterange)),e},jT=function(s,e){return s.start(e)+"-"+s.end(e)},qT=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},$T=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},af=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];od(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(",")},of=function(s){return s.resolvedUri},uf=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(qT).join(""),n=e.slice(a*t,a*t+t).map($T).join(""),i+=r+" "+n+`
183
+ `;return i},VT=({bytes:s})=>uf(s),HT=s=>{let e="",t;for(t=0;t<s.length;t++)e+=jT(s,t)+" ";return e};var zT=Object.freeze({__proto__:null,createTransferableMessage:af,initSegmentId:Ln,segmentKeyId:of,hexDump:uf,tagDump:VT,textRanges:HT});const lf=.25,GT=(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,XT=(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*lf,u=new Date(n.getTime()+a*1e3);return t>u?null:(t>new Date(n)&&(i=r),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:pt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},KT=(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*lf)return null;i=r}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},YT=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const r=t.getTime();return(i.getTime()-r)/1e3},QT=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=KT(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=GT(e,i.segment);return n&&(r.programDateTime=n.toISOString()),t(null,r)},cf=({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(!QT(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const u=XT(s,e);if(!u)return a({message:`${s} was not found in the stream`});const l=u.segment,f=YT(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",()=>{cf({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)},Ka=(s,e)=>{if(s.readyState===4)return e()},ZT=(s,e,t,i)=>{let r=[],n,a=!1;const u=function(_,w,x,I){return w.abort(),a=!0,t(_,w,x,I)},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=w0(r,ud(x,!0)),n=n||or(r),r.length<10||n&&r.length<n+2)return Ka(w,()=>u(_,w,"",r));const I=Mo(r);return I==="ts"&&r.length<188?Ka(w,()=>u(_,w,"",r)):!I&&r.length<376?Ka(w,()=>u(_,w,"",r)):u(null,w,I,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:ev}=$,bc=function(s,e){if(!rf(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},tv=(s,e,t,i)=>{const r=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},iv=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:r})=>{const n=E_(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:r});return Qh(n,e,tv),n},sv=(s,e)=>{Os(s,(t,i,r,n)=>{(!e.mediaGroups[i][r]||!(n in e.mediaGroups[i][r]))&&delete s.mediaGroups[i][r][n]})},rv=(s,e,t)=>{let i=!0,r=Ce(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){const a=e.playlists[n];if(a.sidx){const l=Fn(a.sidx);t&&t[l]&&t[l].sidx&&Oo(a,t[l].sidx,a.sidx.resolvedUri)}const u=vo(r,a,bc);u&&(r=u,i=!1)}return Os(e,(n,a,u,l)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,m=vo(r,n.playlists[0],bc);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)}}),sv(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:r},nv=(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,xc=(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;nv(u,n)&&(t[a]=e[a])}}return t},av=(s,e)=>{let i=xc(s.playlists,e);return Os(s,(r,n,a,u)=>{if(r.playlists&&r.playlists.length){const l=r.playlists;i=Ce(i,xc(l,e))}}),i};class Eo extends ev{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_=Ot("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=k_(de(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=ZT(n,this.vhs_.xhr,(l,f,m,_)=>{if(l)return a(l,f);if(!m||m!=="mp4"){const I=m||"unknown";return a({status:f.status,message:`Unsupported ${I} 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=C_(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:ft(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,r)=>{if(!this.request)return;if(i){const{requestType:a}=r;return this.error.metadata=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=iv({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=rv(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_=av(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 Qe={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 ov=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},df=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},uv=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())}},hf=function(s){return function(){const e=uv(s),t=df(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}},ff=function(s){return`var browserWorkerPolyFill = ${df.toString()};
184
184
  browserWorkerPolyFill(self);
185
- `+s},cf=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},VT=lf(cf(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,q,j,R,G,v,E,V,H,U,K,ee,se,W,Z,te,ie,re,ge,ye,ve,fe,Se;(function(){var o;if(U={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 U)U.hasOwnProperty(o)&&(U[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);K=new Uint8Array([105,115,111,109]),se=new Uint8Array([97,118,99,49]),ee=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]),te={video:W,audio:Z},ge=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),re=new Uint8Array([0,0,0,0,0,0,0,0]),ye=new Uint8Array([0,0,0,0,0,0,0,0]),ve=ye,fe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Se=ye,ie=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(U.dinf,u(U.dref,ge))},f=function(o){return u(U.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(U.ftyp,K,ee,K,se)},j=function(o){return u(U.hdlr,te[o])},_=function(o){return u(U.mdat,o)},q=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(U.mdhd,c)},F=function(o){return u(U.mdia,q(o),j(o.type),x(o))},w=function(o){return u(U.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},x=function(o){return u(U.minf,o.type==="video"?u(U.vmhd,ie):u(U.smhd,re),l(),G(o))},P=function(o,c){for(var h=[],d=c.length;d--;)h[d]=E(c[d]);return u.apply(null,[U.moof,w(o)].concat(h))},T=function(o){for(var c=o.length,h=[];c--;)h[c]=N(o[c]);return u.apply(null,[U.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,[U.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(U.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(U.sdtp,h)},G=function(o){return u(U.stbl,v(o),u(U.stts,Se),u(U.stsc,ve),u(U.stsz,fe),u(U.stco,ye))},(function(){var o,c;v=function(h){return u(U.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=[U.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(U.avcC,new Uint8Array([1,h.profileIdc,h.profileCompatibility,h.levelIdc,255].concat([d.length],g,[p.length],S))),u(U.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(U.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(U.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(U.tkhd,c)},E=function(o){var c,h,d,p,g,S,C;return c=u(U.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(U.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(U.traf,c,h,d)):(p=R(o),d=H(o,p.length+g),u(U.traf,c,h,d,p))},N=function(o){return o.duration=o.duration||4294967295,u(U.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(U.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(U.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(U.trun,g)},H=function(d,p){return d.type==="audio"?o(d,p):c(d,p)}})();var ke={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}},Le=function(o){var c,h,d=[],p=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,d.byteLength=0,c=0;c<o.length;c++)h=o[c],h.nalUnitType==="access_unit_delimiter_rbsp"?(d.length&&(d.duration=h.dts-d.dts,p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d)),d=[h],d.byteLength=h.data.byteLength,d.pts=h.pts,d.dts=h.dts):(h.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(d.keyFrame=!0),d.duration=h.dts-d.dts,d.byteLength+=h.data.byteLength,d.push(h));return p.length&&(!d.duration||d.duration<=0)&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d),p},Qe=function(o){var c,h,d=[],p=[];for(d.byteLength=0,d.nalCount=0,d.duration=0,d.pts=o[0].pts,d.dts=o[0].dts,p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=o[0].pts,p.dts=o[0].dts,c=0;c<o.length;c++)h=o[c],h.keyFrame?(d.length&&(p.push(d),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration),d=[h],d.nalCount=h.length,d.byteLength=h.byteLength,d.pts=h.pts,d.dts=h.dts,d.duration=h.duration):(d.duration+=h.duration,d.nalCount+=h.length,d.byteLength+=h.byteLength,d.push(h));return p.length&&d.duration<=0&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration,p.push(d),p},st=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},Ke=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Oe=function(o,c){var h=Ke();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},Mt=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=Oe(S,C),C+=p.size,A.push(p);return A},ze=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),ue=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],ue.setUint32(C,S.data.byteLength),C+=4,X.set(S.data,C),C+=S.data.byteLength;return X},Bt=function(o,c){var h,d=c||0,p=[];return h=Oe(o,d),p.push(h),p},Ge=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},hi={groupNalsIntoFrames:Le,groupFramesIntoGops:Qe,extendFirstKeyFrame:st,generateSampleTable:Mt,concatenateNalData:ze,generateSampleTableForFrame:Bt,concatenateNalDataForFrame:Ge},nt=[33,16,5,32,164,27],gt=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],be=function(o){for(var c=[];o--;)c.push(0);return c},ce=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},{})},_e,Je=function(){if(!_e){var o={96e3:[nt,[227,64],be(154),[56]],88200:[nt,[231],be(170),[56]],64e3:[nt,[248,192],be(240),[56]],48e3:[nt,[255,192],be(268),[55,148,128],be(54),[112]],44100:[nt,[255,192],be(268),[55,163,128],be(84),[112]],32e3:[nt,[255,192],be(268),[55,234],be(226),[112]],24e3:[nt,[255,192],be(268),[55,255,128],be(268),[111,112],be(126),[224]],16e3:[nt,[255,192],be(268),[55,255,128],be(268),[111,255],be(269),[223,108],be(195),[1,192]],12e3:[gt,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,253,128],be(259),[56]],11025:[gt,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,255,192],be(268),[55,175,128],be(108),[112]],8e3:[gt,be(268),[3,121,16],be(47),[7]]};_e=ce(o)}return _e},ct=9e4,fi,Ii,pi,mi,Os,Rs,Ki;fi=function(o){return o*ct},Ii=function(o,c){return o*c},pi=function(o){return o/ct},mi=function(o,c){return o/c},Os=function(o,c){return fi(mi(o,c))},Rs=function(o,c){return Ii(pi(o),c)},Ki=function(o,c,h){return pi(h?o:o-c)};var we={ONE_SECOND_IN_TS:ct,secondsToVideoTs:fi,secondsToAudioTs:Ii,videoTsToSeconds:pi,audioTsToSeconds:mi,audioTsToVideoTs:Os,videoTsToAudioTs:Rs,metadataTsToSeconds:Ki},Ns=Je,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}))},gi=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:gi,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,me=128,Re=function(o){for(var c=0,h={payloadType:-1,payloadSize:0},d=0,p=0;c<o.byteLength&&o[c]!==me;){for(;o[c]===255;)d+=255,c++;for(d+=o[c++];o[c]===255;)p+=255,c++;if(p+=o[c++],!h.payload&&d===ae){var 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)},bt=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},zt=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:Re,parseUserData:at,parseCaptionPackets:bt,discardEmulationPreventionBytes:zt,USER_DATA_REGISTERED_ITU_T_T35:ae},Ft=t,Dt=At,Ve=function(o){o=o||{},Ve.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Fe(0,0),new Fe(0,1),new Fe(1,0),new Fe(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ce({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};Ve.prototype=new Ft,Ve.prototype.push=function(o){var c,h,d;if(o.nalUnitType==="sei_rbsp"&&(c=Dt.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===Dt.USER_DATA_REGISTERED_ITU_T_T35&&(h=Dt.parseUserData(c),!!h))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}d=Dt.parseCaptionPackets(o.pts,h),this.captionPackets_=this.captionPackets_.concat(d),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},Ve.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},Ve.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(c,h){c.presortIndex=h}),this.captionPackets_.sort(function(c,h){return c.pts===h.pts?c.presortIndex-h.presortIndex:c.pts-h.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},Ve.prototype.flush=function(){return this.flushStream("flush")},Ve.prototype.partialFlush=function(){return this.flushStream("partialFlush")},Ve.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},Ve.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},Ve.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},Ve.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},Ve.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},Ve.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var kt={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},ri=function(o){var c=kt[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},Gt=function(o){return 32<=o&&o<=127||160<=o&&o<=255},Ne=function(o){this.windowNum=o,this.reset()};Ne.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},Ne.prototype.getText=function(){return this.rows.join(`
186
- `)},Ne.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ne.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--},Ne.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Ne.prototype.addText=function(o){this.rows[this.rowIdx]+=o},Ne.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 Ne(-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 Ne(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 Ce=function(o){o=o||{},Ce.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))}};Ce.prototype=new Ft,Ce.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ce.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)},Ce.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)},Ce.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],Gt(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++},Ce.prototype.extendedCommands=function(o,c){var h=this.current708Packet.data,d=h[++o];return Gt(d)&&(o=this.handleText(o,c,{isExtended:!0})),o},Ce.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},Ce.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]},Ce.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 ue(Q){return Q.map(de=>("0"+(de&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=ue(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},Ce.prototype.multiByteCharacter=function(o,c){var h=this.current708Packet.data,d=h[o+1],p=h[o+2];return Gt(d)&&Gt(p)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},Ce.prototype.setCurrentWindow=function(o,c){var h=this.current708Packet.data,d=h[o],p=d&7;return c.setCurrentWindow(p),o},Ce.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},Ce.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},Ce.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(`
185
+ `+s},pf=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},lv=ff(pf(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,I,y,P,N,M,L,B,U,j,O,V,v,E,q,H,z,K,te,re,Y,ee,Z,ie,se,pe,ge,ye,he,Ge;(function(){var o;if(z={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in z)z.hasOwnProperty(o)&&(z[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);K=new Uint8Array([105,115,111,109]),re=new Uint8Array([97,118,99,49]),te=new Uint8Array([0,0,0,1]),Y=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),ee=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]),Z={video:Y,audio:ee},pe=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]),ge=new Uint8Array([0,0,0,0,0,0,0,0]),ye=ge,he=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ge=ge,ie=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(z.dinf,u(z.dref,pe))},f=function(o){return u(z.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},m=function(){return u(z.ftyp,K,te,K,re)},j=function(o){return u(z.hdlr,Z[o])},_=function(o){return u(z.mdat,o)},U=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(z.mdhd,c)},B=function(o){return u(z.mdia,U(o),j(o.type),x(o))},w=function(o){return u(z.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},x=function(o){return u(z.minf,o.type==="video"?u(z.vmhd,ie):u(z.smhd,se),l(),V(o))},I=function(o,c){for(var h=[],d=c.length;d--;)h[d]=E(c[d]);return u.apply(null,[z.moof,w(o)].concat(h))},y=function(o){for(var c=o.length,h=[];c--;)h[c]=M(o[c]);return u.apply(null,[z.moov,N(4294967295)].concat(h).concat(P(o)))},P=function(o){for(var c=o.length,h=[];c--;)h[c]=q(o[c]);return u.apply(null,[z.mvex].concat(h))},N=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(z.mvhd,c)},O=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(z.sdtp,h)},V=function(o){return u(z.stbl,v(o),u(z.stts,Ge),u(z.stsc,ye),u(z.stsz,he),u(z.stco,ge))},(function(){var o,c;v=function(h){return u(z.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=[z.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(h.width&65280)>>8,h.width&255,(h.height&65280)>>8,h.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u(z.avcC,new Uint8Array([1,h.profileIdc,h.profileCompatibility,h.levelIdc,255].concat([d.length],g,[p.length],S))),u(z.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],h.sarRatio){var k=h.sarRatio[0],F=h.sarRatio[1];A.push(u(z.pasp,new Uint8Array([(k&4278190080)>>24,(k&16711680)>>16,(k&65280)>>8,k&255,(F&4278190080)>>24,(F&16711680)>>16,(F&65280)>>8,F&255])))}return u.apply(null,A)},c=function(h){return u(z.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(h.channelcount&65280)>>8,h.channelcount&255,(h.samplesize&65280)>>8,h.samplesize&255,0,0,0,0,(h.samplerate&65280)>>8,h.samplerate&255,0,0]),f(h))}})(),L=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(z.tkhd,c)},E=function(o){var c,h,d,p,g,S,C;return c=u(z.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),S=Math.floor(o.baseMediaDecodeTime/a),C=Math.floor(o.baseMediaDecodeTime%a),h=u(z.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(z.traf,c,h,d)):(p=O(o),d=H(o,p.length+g),u(z.traf,c,h,d,p))},M=function(o){return o.duration=o.duration||4294967295,u(z.trak,L(o),B(o))},q=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(z.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,F;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,F=0;F<A.length;F++)k=A[F],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(z.trun,S)},o=function(d,p){var g,S,C,A,k,F;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,F=0;F<A.length;F++)k=A[F],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(z.trun,g)},H=function(d,p){return d.type==="audio"?o(d,p):c(d,p)}})();var We={ftyp:m,mdat:_,moof:I,moov:y,initSegment:function(o){var c=m(),h=y(o),d;return d=new Uint8Array(c.byteLength+h.byteLength),d.set(c),d.set(h,c.byteLength),d}},je=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},ke=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},St=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},et=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},at=function(o,c){var h=et();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},ci=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=at(S,C),C+=p.size,A.push(p);return A},Ke=function(o){var c,h,d,p,g,S,C=0,A=o.byteLength,k=o.nalCount,F=A+4*k,W=new Uint8Array(F),oe=new DataView(W.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,W.set(S.data,C),C+=S.data.byteLength;return W},di=function(o,c){var h,d=c||0,p=[];return h=at(o,d),p.push(h),p},Xe=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},Ki={groupNalsIntoFrames:je,groupFramesIntoGops:ke,extendFirstKeyFrame:St,generateSampleTable:ci,concatenateNalData:Ke,generateSampleTableForFrame:di,concatenateNalDataForFrame:Xe},gt=[33,16,5,32,164,27],Et=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],be=function(o){for(var 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},{})},Re,hi=function(){if(!Re){var o={96e3:[gt,[227,64],be(154),[56]],88200:[gt,[231],be(170),[56]],64e3:[gt,[248,192],be(240),[56]],48e3:[gt,[255,192],be(268),[55,148,128],be(54),[112]],44100:[gt,[255,192],be(268),[55,163,128],be(84),[112]],32e3:[gt,[255,192],be(268),[55,234],be(226),[112]],24e3:[gt,[255,192],be(268),[55,255,128],be(268),[111,112],be(126),[224]],16e3:[gt,[255,192],be(268),[55,255,128],be(268),[111,255],be(269),[223,108],be(195),[1,192]],12e3:[Et,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,253,128],be(259),[56]],11025:[Et,be(268),[3,127,248],be(268),[6,255,240],be(268),[13,255,224],be(268),[27,255,192],be(268),[55,175,128],be(108),[112]],8e3:[Et,be(268),[3,121,16],be(47),[7]]};Re=Le(o)}return Re},ei=9e4,ki,Ii,fi,pi,Rs,Ns,Yi;ki=function(o){return o*ei},Ii=function(o,c){return o*c},fi=function(o){return o/ei},pi=function(o,c){return o/c},Rs=function(o,c){return ki(pi(o,c))},Ns=function(o,c){return Ii(fi(o),c)},Yi=function(o,c,h){return fi(h?o:o-c)};var Se={ONE_SECOND_IN_TS:ei,secondsToVideoTs:ki,secondsToAudioTs:Ii,videoTsToSeconds:fi,audioTsToSeconds:pi,audioTsToVideoTs:Rs,videoTsToAudioTs:Ns,metadataTsToSeconds:Yi},Ms=hi,Pi=Se,Dr=function(o){var c,h,d=0;for(c=0;c<o.length;c++)h=o[c],d+=h.data.byteLength;return d},kr=function(o,c,h,d){var p,g=0,S=0,C=0,A=0,k,F,W;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=Ms()[o.samplerate],k||(k=c[0].data),F=0;F<C;F++)W=c[0],c.splice(0,0,{data:k,dts:W.dts-g,pts:W.pts-g});return o.baseMediaDecodeTime-=Math.floor(Pi.videoTsToAudioTs(A,o.samplerate)),A}},Bs=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},Ir=function(o){var c,h,d=0,p=new Uint8Array(Dr(o));for(c=0;c<o.length;c++)h=o[c],p.set(h.data,d),d+=h.data.byteLength;return p},Fs={prefixWithSilence:kr,trimAdtsFramesByEarliestDts:Bs,generateSampleTable:mi,concatenateFrameData:Ir},Pr=Se.ONE_SECOND_IN_TS,T=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},R=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/Pr,h*=d,h=Math.floor(h)),h},G={clearDtsInfo:b,calculateTrackBaseMediaDecodeTime:R,collectDtsInfo:T},ae=4,me=128,De=function(o){for(var c=0,h={payloadType:-1,payloadSize:0},d=0,p=0;c<o.byteLength&&o[c]!==me;){for(;o[c]===255;)d+=255,c++;for(d+=o[c++];o[c]===255;)p+=255,c++;if(p+=o[c++],!h.payload&&d===ae){var 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},it=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},_t=function(o,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},qt=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},Ct={parseSei:De,parseUserData:it,parseCaptionPackets:_t,discardEmulationPreventionBytes:qt,USER_DATA_REGISTERED_ITU_T_T35:ae},Rt=t,wt=Ct,qe=function(o){o=o||{},qe.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Ne(0,0),new Ne(0,1),new Ne(1,0),new Ne(1,1)],this.parse708captions_&&(this.cc708Stream_=new xe({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")))};qe.prototype=new Rt,qe.prototype.push=function(o){var c,h,d;if(o.nalUnitType==="sei_rbsp"&&(c=wt.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===wt.USER_DATA_REGISTERED_ITU_T_T35&&(h=wt.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=wt.parseCaptionPackets(o.pts,h),this.captionPackets_=this.captionPackets_.concat(d),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},qe.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},qe.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)},qe.prototype.flush=function(){return this.flushStream("flush")},qe.prototype.partialFlush=function(){return this.flushStream("partialFlush")},qe.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},qe.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)},qe.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},qe.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},qe.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},qe.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var At={127:9834,4128:32,4129:160,4133:8230,4138:352,4140:338,4144:9608,4145:8216,4146:8217,4147:8220,4148:8221,4149:8226,4153:8482,4154:353,4156:339,4157:8480,4159:376,4214:8539,4215:8540,4216:8541,4217:8542,4218:9168,4219:9124,4220:9123,4221:9135,4222:9126,4223:9121,4256:12600},ti=function(o){var c=At[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},$t=function(o){return 32<=o&&o<=127||160<=o&&o<=255},Ie=function(o){this.windowNum=o,this.reset()};Ie.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},Ie.prototype.getText=function(){return this.rows.join(`
186
+ `)},Ie.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},Ie.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--},Ie.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},Ie.prototype.addText=function(o){this.rows[this.rowIdx]+=o},Ie.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 Ie(-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 Ie(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 xe=function(o){o=o||{},xe.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))}};xe.prototype=new Rt,xe.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},xe.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)},xe.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)},xe.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],$t(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++},xe.prototype.extendedCommands=function(o,c){var h=this.current708Packet.data,d=h[++o];return $t(d)&&(o=this.handleText(o,c,{isExtended:!0})),o},xe.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},xe.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]},xe.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,F,W;function oe(J){return J.map(ce=>("0"+(ce&255).toString(16)).slice(-2)).join("")}if(p?(W=[C,A],o++):W=[C],c.textDecoder_&&!d)F=c.textDecoder_.decode(new Uint8Array(W));else if(p){const J=oe(W);F=String.fromCharCode(parseInt(J,16))}else F=ti(S|C);return k.pendingNewLine&&!k.isEmpty()&&k.newLine(this.getPts(o)),k.pendingNewLine=!1,k.addText(F),o},xe.prototype.multiByteCharacter=function(o,c){var h=this.current708Packet.data,d=h[o+1],p=h[o+2];return $t(d)&&$t(p)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},xe.prototype.setCurrentWindow=function(o,c){var h=this.current708Packet.data,d=h[o],p=d&7;return c.setCurrentWindow(p),o},xe.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},xe.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},xe.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},Ce.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)},Ce.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},Ce.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},Ce.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},Ce.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},Ce.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},Ce.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},Ce.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},Ce.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},Ce.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},Fe=function(o,c){Fe.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)}};Fe.prototype=new Ft,Fe.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_})},Fe.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_=[]},Fe.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},Fe.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Fe.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Fe.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Fe.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Fe.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Fe.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Fe.prototype.isNormalChar=function(o){return o>=32&&o<=127},Fe.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},Fe.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)},Fe.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)}},Fe.prototype.popOn=function(o,c){var h=this.nonDisplayed_[this.row_].text;h+=c,this.nonDisplayed_[this.row_].text=h},Fe.prototype.rollUp=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h},Fe.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}},Fe.prototype.paintOn=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h};var pu={CaptionStream:Ve,Cea608Stream:Fe,Cea708Stream:Ce},Rr={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},jf=t,qf=8589934592,$f=4294967296,mu="shared",sa=function(o,c){var h=1;for(o>c&&(h=-1);Math.abs(c-o)>$f;)o+=h*qf;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 jf;var gu={TimestampRolloverStream:ra,handleRollover:sa},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},_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}},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}},yu={parseId3Frames:zf,parseSyncSafeInteger:js,frameParsers:qs},Gf=t,Wf=Rr,_i=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=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,ue;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=_i.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+=_i.parseSyncSafeInteger(C.data.subarray(10,14)),h-=_i.parseSyncSafeInteger(C.data.subarray(16,20)));do{if(k=_i.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(ue=String.fromCharCode(C.data[A],C.data[A+1],C.data[A+2],C.data[A+3]),B={id:ue,data:C.data.subarray(A+10,A+k+10)},B.key=B.id,_i.frameParsers[B.id]?_i.frameParsers[B.id](B):B.id[0]==="T"?_i.frameParsers["T*"](B):B.id[0]==="W"&&_i.frameParsers["W*"](B),B.owner==="com.apple.streaming.transportStreamTimestamp"){var Q=B.data,de=(Q[3]&1)<<30|Q[4]<<22|Q[5]<<14|Q[6]<<6|Q[7]>>>2;de*=4,de+=Q[7]&3,B.timeStamp=de,C.pts===void 0&&C.dts===void 0&&(C.pts=B.timeStamp,C.dts=B.timeStamp),this.trigger("timestamp",B)}C.frames.push(B),A+=10,A+=k}while(A<h);this.trigger("data",C)}}}},Br.prototype=new Gf;var Xf=Br,na=t,aa=pu,Ut=Rr,Kf=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===Ut.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=X:B===Ut.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=X:B===Ut.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=Ut.H264_STREAM_TYPE:S.pid===this.programMapTable.audio?S.streamType=Ut.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),ue={type:k},Q=0,de=0,xe=!1,Ze;if(!(!A.data.length||A.size<9)){for(ue.trackId=A.data[0].pid,Q=0;Q<A.data.length;Q++)Ze=A.data[Q],X.set(Ze.data,de),de+=Ze.data.byteLength;S(X,ue),xe=k==="video"||ue.packetLength<=A.size,(B||xe)&&(A.size=0,A.data.length=0),xe&&o.trigger("data",ue)}};Ur.prototype.init.call(this),this.push=function(A){({pat:function(){},pes:function(){var k,B;switch(A.streamType){case Ut.H264_STREAM_TYPE:k=h,B="video";break;case Ut.ADTS_STREAM_TYPE:k=d,B="audio";break;case Ut.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:Kf,CaptionStream:aa.CaptionStream,Cea608Stream:aa.Cea608Stream,Cea708Stream:aa.Cea708Stream,MetadataStream:Xf};for(var ua in Ut)Ut.hasOwnProperty(ua)&&(Tu[ua]=Ut[ua]);var Yf=Tu,Qf=t,Jf=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*Jf/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 Qf;var Zf=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 ep=bu,xu=t,tp=ep,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,ue,Q;for(ue=0;ue<A;ue++)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,ue,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;ue=k-B.length,Q=new Uint8Array(ue);var de=0;for(X=0;X<ue;de++,X++)de===B[0]&&(de++,B.shift()),Q[X]=A[de];return Q},S=function(A){var k=0,B=0,X=0,ue=0,Q,de,xe,Ze,xt,Ti,Ks,Ys,Qs,Js,en,Be=[1,1],Zs,qt;if(Q=new tp(A),de=Q.readUnsignedByte(),Ze=Q.readUnsignedByte(),xe=Q.readUnsignedByte(),Q.skipUnsignedExpGolomb(),Su[de]&&(xt=Q.readUnsignedExpGolomb(),xt===3&&Q.skipBits(1),Q.skipUnsignedExpGolomb(),Q.skipUnsignedExpGolomb(),Q.skipBits(1),Q.readBoolean()))for(en=xt!==3?8:12,qt=0;qt<en;qt++)Q.readBoolean()&&(qt<6?C(16,Q):C(64,Q));if(Q.skipUnsignedExpGolomb(),Ti=Q.readUnsignedExpGolomb(),Ti===0)Q.readUnsignedExpGolomb();else if(Ti===1)for(Q.skipBits(1),Q.skipExpGolomb(),Q.skipExpGolomb(),Ks=Q.readUnsignedExpGolomb(),qt=0;qt<Ks;qt++)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(),ue=Q.readUnsignedExpGolomb()),Q.readBoolean()&&Q.readBoolean()){switch(Zs=Q.readUnsignedByte(),Zs){case 1:Be=[1,1];break;case 2:Be=[12,11];break;case 3:Be=[10,11];break;case 4:Be=[16,11];break;case 5:Be=[40,33];break;case 6:Be=[24,11];break;case 7:Be=[20,11];break;case 8:Be=[32,11];break;case 9:Be=[80,33];break;case 10:Be=[18,11];break;case 11:Be=[15,11];break;case 12:Be=[64,33];break;case 13:Be=[160,99];break;case 14:Be=[4,3];break;case 15:Be=[3,2];break;case 16:Be=[2,1];break;case 255:{Be=[Q.readUnsignedByte()<<8|Q.readUnsignedByte(),Q.readUnsignedByte()<<8|Q.readUnsignedByte()];break}}Be&&Be[0]/Be[1]}return{profileIdc:de,levelIdc:xe,profileCompatibility:Ze,width:(Ys+1)*16-k*2-B*2,height:(2-Js)*(Qs+1)*16-X*2-ue*2,sarRatio:Be}}},qr.prototype=new xu;var ip={H264Stream:qr},sp=[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))},rp=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]},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+=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=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},la={isLikelyAacData:rp,parseId3TagSize:Eu,parseAdtsSize:op,parseType:up,parseSampleRate:lp,parseAacTimestamp:cp},dp=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 dp;var hp=Vr,fp=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],pp=fp,mp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],gp=mp,Hr=t,Vs=ke,Hs=hi,zr=Bs,jt=z,ni=Yf,Gr=we,Du=Zf,_p=ip.H264Stream,yp=hp,Tp=la.isLikelyAacData,vp=we.ONE_SECOND_IN_TS,ku=pp,Iu=gp,Wr,zs,Xr,Ri,bp=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",bp.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){jt.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,ue,Q;if(h.length===0){this.trigger("done","AudioSegmentStream");return}C=zr.trimAdtsFramesByEarliestDts(h,o,p),o.baseMediaDecodeTime=jt.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),jt.clearDtsInfo(o),X=Math.ceil(vp*1024/o.samplerate),C.length&&(ue=C.length*X,this.trigger("segmentTimingInfo",Ou(Gr.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),C[0].dts,C[0].pts,C[0].dts+ue,C[0].pts+ue,Q||0)),this.trigger("timingInfo",{start:C[0].pts,end:C[0].pts+ue})),this.trigger("data",{track:o,boxes:B}),this.trigger("done","AudioSegmentStream")},this.reset=function(){jt.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){jt.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,ue,Q=0,de,xe;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 Ze;if(c.alignGopsAtEnd?Ze=this.alignGopsAtEnd_(k):Ze=this.alignGopsAtStart_(k),!Ze){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}jt.clearDtsInfo(o),k=Ze}jt.collectDtsInfo(o,k),o.samples=Hs.generateSampleTable(k),X=Vs.mdat(Hs.concatenateNalData(k)),o.baseMediaDecodeTime=jt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",k.map(function(xt){return{pts:xt.pts,dts:xt.dts,byteLength:xt.byteLength}})),de=k[0],xe=k[k.length-1],this.trigger("segmentTimingInfo",Ou(o.baseMediaDecodeTime,de.dts,de.pts,xe.dts+xe.duration,xe.pts+xe.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]),ue=new Uint8Array(B.byteLength+X.byteLength),h++,ue.set(B),ue.set(X,B.byteLength),this.trigger("data",{track:o,boxes:ue}),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(){jt.clearDtsInfo(o),g=void 0,S=void 0},this.getGopForFusion_=function(C){var A=45e3,k=1/0,B,X,ue,Q,de;for(de=0;de<this.gopCache_.length;de++)Q=this.gopCache_[de],ue=Q.gop,!(!(o.pps&&Lu(o.pps[0],Q.pps[0]))||!(o.sps&&Lu(o.sps[0],Q.sps[0])))&&(ue.dts<o.timelineStartInfo.dts||(B=C.dts-ue.dts-ue.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,ue,Q,de,xe;for(ue=C.byteLength,Q=C.nalCount,de=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++,ue-=X.byteLength,Q-=X.nalCount,de-=X.duration}return k===0?C:k===C.length?null:(xe=C.slice(k),xe.byteLength=ue,xe.duration=de,xe.nalCount=Q,xe.pts=xe[0].pts,xe.dts=xe[0].dts,xe)},this.alignGopsAtEnd_=function(C){var A,k,B,X,ue,Q;for(A=p.length-1,k=C.length-1,ue=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&&(ue=k),k--}if(!Q&&ue===null)return null;var de;if(Q?de=k:de=ue,de===0)return C;var xe=C.slice(de),Ze=xe.reduce(function(xt,Ti){return xt.byteLength+=Ti.byteLength,xt.duration+=Ti.duration,xt.nalCount+=Ti.nalCount,xt},{byteLength:0,duration:0,nalCount:0});return xe.byteLength=Ze.byteLength,xe.duration=Ze.duration,xe.nalCount=Ze.nalCount,xe.pts=xe[0].pts,xe.dts=xe[0].dts,xe},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 yp,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 _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")),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,jt.clearDtsInfo(p),S.audioTimestampRolloverStream&&S.audioTimestampRolloverStream.discontinuity()),d&&(S.videoSegmentStream&&(S.videoSegmentStream.gopCache_=[]),d.timelineStartInfo.dts=void 0,d.timelineStartInfo.pts=void 0,jt.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},Ru=Cp,wp=Kr.toUnsigned,Ap=Ru,Nu=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=Nu(o.subarray(d+8,S),c.slice(1)),C.length&&(h=h.concat(C)))),d=S;return h},ca=Nu,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},da=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},Mu=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,Bu=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: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=Rp,Uu={tfdt:da,trun:Fu},ju={parseTfdt:Uu.tfdt,parseTrun:Uu.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 ue={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,ue)?ue: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&&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},qp={parseEmsgBox:Fp,scaleTime:Up},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,We=ca,Qi=Ru,ha=qp,$p=Mu,Vp=Fu,Hp=da,zp=n.getUint64,Vu,Hu,zu,Gu,Wu,fa,Xu,pa=$u,Gp=yu.parseId3Frames;Vu=function(o){var c={},h=We(o,["moov","trak"]);return h.reduce(function(d,p){var g,S,C,A,k;return g=We(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=We(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=We(c,["moof","traf"]);var d=h.reduce(function(p,g){var S=We(g,["tfhd"])[0],C=Qr(S[4]<<24|S[5]<<16|S[6]<<8|S[7]),A=o[C]||9e4,k=We(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 ue;return typeof X=="bigint"?ue=X/pa.BigInt(A):typeof X=="number"&&!isNaN(X)&&(ue=X/A),ue<Number.MAX_SAFE_INTEGER&&(ue=Number(ue)),ue<p&&(p=ue),p},1/0);return typeof d=="bigint"||isFinite(d)?d:0},zu=function(o,c){var h=We(c,["moof","traf"]),d=0,p=0,g;if(h&&h.length){var S=We(h[0],["tfhd"])[0],C=We(h[0],["trun"])[0],A=We(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 ue=o[g]||9e4;typeof d=="bigint"&&(p=pa.BigInt(p),ue=pa.BigInt(ue));var Q=(d+p)/ue;return typeof Q=="bigint"&&Q<Number.MAX_SAFE_INTEGER&&(Q=Number(Q)),Q},Gu=function(o){var c=We(o,["moov","trak"]),h=[];return c.forEach(function(d){var p=We(d,["mdia","hdlr"]),g=We(d,["tkhd"]);p.forEach(function(S,C){var A=Qi(S.subarray(8,12)),k=g[C],B,X,ue;A==="vide"&&(B=new DataView(k.buffer,k.byteOffset,k.byteLength),X=B.getUint8(0),ue=X===0?B.getUint32(12):B.getUint32(20),h.push(ue))})}),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=We(o,["moov","trak"]),h=[];return c.forEach(function(d){var p={},g=We(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=We(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=We(d,["mdia","minf","stbl","stsd"])[0];if(B){var X=B.subarray(8);p.codec=Qi(X.subarray(4,8));var ue=We(X,[p.codec])[0],Q,de;ue&&(/^[asm]vc[1-9]$/i.test(p.codec)?(Q=ue.subarray(78),de=Qi(Q.subarray(4,8)),de==="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=ue.subarray(28),de=Qi(Q.subarray(4,8)),de==="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 xe=We(d,["mdia","mdhd"])[0];xe&&(p.timescale=fa(xe)),h.push(p)}),h},Xu=function(o,c=0){var h=We(o,["emsg"]);return h.map(d=>{var p=ha.parseEmsgBox(new Uint8Array(d)),g=Gp(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:We,parseType:Qi,timescale:Vu,startTime:Hu,compositionStartTime:zu,videoTrackIds:Gu,tracks:Wu,getTimescaleFromMediaHeader:fa,getEmsgID3:Xu};const{parseTrun:Wp}=ju,{findBox:Ku}=Xs;var Yu=$u,Xp=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},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+Yu.BigInt(X.compositionTimeOffset),d+=Yu.BigInt(X.duration)):(X.pts=d+X.compositionTimeOffset,d+=X.duration)}),C=C.concat(B)}),C},Qu={getMdatTrafPairs:Xp,parseSamples:Kp},Yp=At.discardEmulationPreventionBytes,Qp=pu.CaptionStream,ma=ca,Jp=da,Zp=Mu,{getMdatTrafPairs:em,parseSamples:tm}=Qu,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=ma(S,["tfhd"]),A=Zp(C[0]),k=A.trackId,B=ma(S,["tfdt"]),X=B.length>0?Jp(B[0]).baseMediaDecodeTime:0,ue=ma(S,["trun"]),Q,de;c===k&&ue.length>0&&(Q=tm(ue,X,A),de=sm(g,Q,k),h[k]||(h[k]={seiNals:[],logs:[]}),h[k].seiNals=h[k].seiNals.concat(de.seiNals),h[k].logs=h[k].logs.concat(de.logs))}),h},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}=ju,yi=ca,{getTimescaleFromMediaHeader:lm}=Xs,{parseSamples:cm,getMdatTrafPairs:dm}=Qu;var Ju=function(){let o=9e4;this.init=function(c){const h=yi(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=yi(C,["tfdt"])[0],k=yi(C,["tfhd"])[0],B=yi(C,["trun"]);if(A&&(p=um(A).baseMediaDecodeTime),B.length&&k){const X=cm(B,p,k);let ue=0;X.forEach(function(Q){const de="utf-8",xe=new TextDecoder(de),Ze=S.slice(ue,ue+Q.size);if(yi(Ze,["vtte"])[0]){ue+=Q.size;return}yi(Ze,["vttc"]).forEach(function(Ks){const Ys=yi(Ks,["payl"])[0],Qs=yi(Ks,["sttg"])[0],Js=Q.pts/o,en=(Q.pts+Q.duration)/o;let Be,Zs;if(Ys)try{Be=xe.decode(Ys)}catch(qt){console.error(qt)}if(Qs)try{Zs=xe.decode(Qs)}catch(qt){console.error(qt)}Q.duration&&Be&&h.push({cueText:Be,start:Js,end:en,settings:Zs})}),ue+=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},hm=function(o,c){var h=Zu(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=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}},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},_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}},_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=_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},ym={parseType:hm,parsePat:fm,parsePmt:pm,parsePayloadUnitStartIndicator:Jr,parsePesType:mm,parsePesTime:gm,videoPacketContainsKeyFrame:_m},el=Rr,Ji=gu.handleRollover,Ie={};Ie.ts=ym,Ie.aac=la;var Ni=we.ONE_SECOND_IN_TS,dt=188,Wt=71,Tm=function(o,c){for(var h=0,d=dt,p,g;d<o.byteLength;){if(o[h]===Wt&&o[d]===Wt){switch(p=o.subarray(h,d),g=Ie.ts.parseType(p,c.pid),g){case"pat":c.pid=Ie.ts.parsePat(p);break;case"pmt":var S=Ie.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]===Wt&&(o[p]===Wt||p===o.byteLength)){if(g=o.subarray(d,p),S=Ie.ts.parseType(g,c.pid),S==="pes"&&(C=Ie.ts.parsePesType(g,c.table),A=Ie.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=Ie.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]===Wt&&(o[p]===Wt||p===o.byteLength)){if(g=o.subarray(d,p),S=Ie.ts.parseType(g,c.pid),S==="pes"&&(C=Ie.ts.parsePesType(g,c.table),A=Ie.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=Ie.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,ue,Q=!1,de={data:[],size:0};p<o.byteLength;){if(o[d]===Wt&&o[p]===Wt){switch(g=o.subarray(d,p),S=Ie.ts.parseType(g,c.pid),S){case"pes":if(C=Ie.ts.parsePesType(g,c.table),A=Ie.ts.parsePayloadUnitStartIndicator(g),C==="video"&&(A&&!Q&&(k=Ie.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),Q=!0)),!h.firstKeyFrame)){if(A&&de.size!==0){for(B=new Uint8Array(de.size),X=0;de.data.length;)ue=de.data.shift(),B.set(ue,X),X+=ue.byteLength;if(Ie.ts.videoPacketContainsKeyFrame(B)){var xe=Ie.ts.parsePesTime(B);xe?(h.firstKeyFrame=xe,h.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}de.size=0}de.data.push(g),de.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]===Wt&&o[p]===Wt){if(g=o.subarray(d,p),S=Ie.ts.parseType(g,c.pid),S==="pes"&&(C=Ie.ts.parsePesType(g,c.table),A=Ie.ts.parsePayloadUnitStartIndicator(g),C==="video"&&A&&(k=Ie.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),Q=!0))),Q)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=Ie.aac.parseType(o,S);switch(A){case"timed-metadata":if(o.length-S<10){c=!0;break}if(g=Ie.aac.parseId3TagSize(o,S),g>o.length){c=!0;break}p===null&&(C=o.subarray(S,S+g),p=Ie.aac.parseAacTimestamp(C)),S+=g;break;case"audio":if(o.length-S<7){c=!0;break}if(g=Ie.aac.parseAdtsSize(o,S),g>o.length){c=!0;break}d===null&&(C=o.subarray(S,S+g),d=Ie.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 el.H264_STREAM_TYPE:h.video=[],vm(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},Em=function(o,c){var h=Ie.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_:tl};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 il{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 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=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 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 HT=uf(VT);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(_)},GT=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},WT=(s,e)=>{e.gopInfo=s.data.gopInfo},df=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 q=M;const j=G=>{e.currentTransmux===s&&(G.data.action==="data"&&zT(G,F,a),G.data.action==="trackinfo"&&u(G.data.trackInfo),G.data.action==="gopInfo"&&WT(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"&&(q=!1,T()),G.data.action==="log"&&I(G.data.log),G.data.type==="transmuxed"&&(q||(e.onmessage=null,GT({transmuxedData:F,callback:P}),hf(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=j,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"})},hf=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():df(s.currentTransmux))},Tc=(s,e)=>{s.postMessage({action:e}),hf(s)},ff=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,Tc(e,s);return}e.transmuxQueue.push(Tc.bind(null,e,s))},XT=s=>{ff("reset",s)},KT=s=>{ff("endTimeline",s)},pf=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,df(s);return}s.transmuxer.transmuxQueue.push(s)},YT=s=>{const e=new HT;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:XT,endTimeline:KT,transmux:pf,createTransmuxer:YT};const fs=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,r=Xe({},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)},ei={FAILURE:2,TIMEOUT:-101,ABORTED:-102},mf="wvtt",Eo=s=>{s.forEach(e=>{e.abort()})},QT=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),JT=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:ei.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:ei.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:ei.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:ei.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:ei.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)},ZT=(s,e)=>{e===mf&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},ev=(s,e,t)=>{e===mf&&fs({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:r})=>{s.bytes=i,t(null,s,{mp4VttCues:r})}})},gf=(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:ei.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"&&ZT(s,n.codec))}),e(null))})},tv=({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,gf(s,function(u){if(u)return u.xhr=r,u.status=r.status,e(u,s);e(null,s)})},iv=({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:qT(n.responseText.substring(s.lastReachedChar||0));return s.stats=QT(n),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},sv=({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=()=>pf({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:T,onData:q=>{q.type=q.type==="combined"?"video":q.type,m(s,q)},onTrackInfo:q=>{t&&(T&&(q.isMuxed=!0),t(s,q))},onAudioTimingInfo:q=>{I&&typeof q.start<"u"&&(I(q.start),I=null),M&&typeof q.end<"u"&&M(q.end)},onVideoTimingInfo:q=>{N&&typeof q.start<"u"&&(N(q.start),N=null),O&&typeof q.end<"u"&&O(q.end)},onVideoSegmentTimingInfo:q=>{const j={pts:{start:q.start.presentation,end:q.end.presentation},dts:{start:q.start.decode,end:q.end.decode}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),r(q)},onAudioSegmentTimingInfo:q=>{const j={pts:{start:q.start.pts,end:q.end.pts},dts:{start:q.start.dts,end:q.end.dts}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),n(q)},onId3:(q,j)=>{a(s,q,j)},onCaptions:q=>{u(s,[q])},isEndOfTimeline:l,onEndedTimeline:()=>{f()},onTransmuxerLog:w,onDone:(q,j)=>{_&&(q.type=q.type==="combined"?"video":q.type,x({type:"segmenttransmuxingcomplete",segment:s}),_(j,s,q))},segment:s,triggerSegmentEventFn:x});fs({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:q=>{s.bytes=e=q.data;const j=q.result;j&&(t(s,{hasAudio:j.hasAudio,hasVideo:j.hasVideo,isMuxed:T}),t=null),F()}})},_f=({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(E_(P)){s.isFmp4=!0;const{tracks:T}=s.map;if(T.text&&(!T.audio||!T.video)){m(s,{data:P,type:"text"}),ev(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:q,id3Frames:j})=>{if(e=q.buffer,s.bytes=P=q,!T.video||!q.byteLength||!s.transmuxer){N(void 0,j);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,j)}})}})}});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}sv({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})},yf=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(tf({source:s,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},rv=({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"}),yf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},P=>{e.bytes=P,x({type:"segmentdecryptioncomplete",segment:e}),_f({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})})},nv=({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 rv({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});_f({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}),yf({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}),gf(M,F=>{if(F)return Eo(s),_(F,M);N()})});N()}}}},av=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},ov=({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,JT(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},uv=({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=nv({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"}),U=vc(i,[i.map.key],O,M),K={uri:i.map.key.resolvedUri};M({type:"segmentkeyloadstart",segment:i,keyInfo:K});const ee=s(H,U);N.push(ee)}const v=De(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:xo(i.map),requestType:"segment-media-initialization"}),E=tv({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"}),q=iv({segment:i,finishProcessingFn:O,responseType:F.responseType,triggerSegmentEventFn:M});M({type:"segmentloadstart",segment:i});const j=s(F,q);j.addEventListener("progress",ov({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:P})),N.push(j);const R={};return N.forEach(G=>{G.addEventListener("loadend",av({loadendState:R,abortFn:r}))}),()=>Eo(N)},on=Nt("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},lv=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 Tf=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;Tt.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=>!Tt.isIncompatible(R.playlist));let _=m.filter(R=>Tt.isEnabled(R.playlist));_.length||(_=m.filter(R=>!Tt.isDisabled(R.playlist)));const w=_.filter(R=>R.bandwidth*et.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 q;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),q=R[0]}const j=q||F||M||P||_[0]||m[0];if(j&&j.playlist){let R="sortedPlaylistReps";return q?R="leastPixelDiffRep":F?R="resolutionPlusOneRep":M?R="resolutionBestRep":P?R="bandwidthBestRep":_[0]&&(R="enabledPlaylistReps"),on(`choosing ${bc(j)} using ${R} with options`,l),j.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),Tf({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_})},cv=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),Tf({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_})}},dv=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=>!Tt.isIncompatible(P));let m=f.filter(Tt.isEnabled);m.length||(m=f.filter(P=>!Tt.isDisabled(P)));const w=m.filter(Tt.hasAttribute.bind(null,"BANDWIDTH")).map(P=>{const I=l.getSyncPoint(P,r,u,t)?1:2,N=Tt.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)},hv=function(){const s=this.playlists.main.playlists.filter(Tt.isEnabled);return ms(s,(t,i)=>fu(t,i)),s.filter(t=>!!fr(this.playlists.main,t).video)[0]||null},fv=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 vf(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const pv=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}}},mv=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))})},gv=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}}})},_v=({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,gv(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})})},yv={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"},Tv=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),vv=({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(Tv.has(n))continue;const a=new i(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:yv[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)},bv=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}},xv=(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)},Sv=(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)},Ev=(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},Cv=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},wv=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,Av=500,Ec=s=>typeof s=="number"&&isFinite(s),un=1/60,Dv=(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,kv=(s,e,t)=>{let i=e-et.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?Bh({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`,Iv=({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},Pv=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)},Lv=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},xi=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_})&&Pv(s.timelineChangeController_)){if(Lv(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},Ov=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:r,end:n}=i;let a;typeof r=="bigint"||typeof n=="bigint"?a=D.BigInt(n)-D.BigInt(r):typeof r=="number"&&typeof n=="number"&&(a=n-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},wc=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+Jt:!1,Rv=(s,e)=>{if(e!=="hls")return null;const t=Ov({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,r=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_=Nt(`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_():xi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(Xe({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():xi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(Xe({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():xi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():xi(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 it();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=sf(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},xe.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},xe.prototype.displayWindows=function(o,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},xe.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},xe.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},xe.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},xe.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},xe.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},xe.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},xe.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},xe.prototype.reset=function(o,c){var h=this.getPts(o);return this.flushDisplayed(h,c),this.initService(c.serviceNum,o)};var Lr={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},Or=function(o){return o===null?"":(o=Lr[o]||o,String.fromCharCode(o))},Rr=14,Xf=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Oi=function(){for(var o=[],c=Rr+1;c--;)o.push({text:"",indent:0,offset:0});return o},Ne=function(o,c){Ne.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=Or(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=Or(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=Xf.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=Or(g),C+=Or(S),this[this.mode_](h.pts,C),this.column_+=C.length)}};Ne.prototype=new Rt,Ne.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_})},Ne.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_=Rr,this.rollUpRows_=2,this.formatting_=[]},Ne.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},Ne.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Ne.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Ne.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Ne.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Ne.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Ne.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Ne.prototype.isNormalChar=function(o){return o>=32&&o<=127},Ne.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=Rr,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},Ne.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)},Ne.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)}},Ne.prototype.popOn=function(o,c){var h=this.nonDisplayed_[this.row_].text;h+=c,this.nonDisplayed_[this.row_].text=h},Ne.prototype.rollUp=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h},Ne.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<Rr+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}},Ne.prototype.paintOn=function(o,c){var h=this.displayed_[this.row_].text;h+=c,this.displayed_[this.row_].text=h};var gu={CaptionStream:qe,Cea608Stream:Ne,Cea708Stream:xe},Nr={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Kf=t,Yf=8589934592,Qf=4294967296,_u="shared",sa=function(o,c){var h=1;for(o>c&&(h=-1);Math.abs(c-o)>Qf;)o+=h*Yf;return o},ra=function(o){var c,h;ra.prototype.init.call(this),this.type_=o||_u,this.push=function(d){if(d.type==="metadata"){this.trigger("data",d);return}this.type_!==_u&&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 Kf;var yu={TimestampRolloverStream:ra,handleRollover:sa},Jf=(o,c,h)=>{if(!o)return-1;for(var d=h;d<o.length;d++)if(o[d]===c)return d;return-1},Zf={typedArrayIndexOf:Jf},Mr=Zf.typedArrayIndexOf,Br={Utf8:3},Tu=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},Us=function(o,c,h){return decodeURIComponent(Tu(o,c,h))},js=function(o,c,h){return unescape(Tu(o,c,h))},qs=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},$s={APIC:function(o){var c=1,h,d,p="-->";o.data[0]===Br.Utf8&&(h=Mr(o.data,0,c),!(h<0)&&(o.mimeType=js(o.data,c,h),c=h+1,o.pictureType=o.data[c],c++,d=Mr(o.data,0,c),!(d<0)&&(o.description=Us(o.data,c,d),c=d+1,o.mimeType===p?o.url=js(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===Br.Utf8&&(o.value=Us(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===Br.Utf8&&(c=Mr(o.data,0,1),c!==-1&&(o.description=Us(o.data,1,c),o.value=Us(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=js(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===Br.Utf8&&(c=Mr(o.data,0,1),c!==-1&&(o.description=Us(o.data,1,c),o.url=js(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=js(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},ep=function(o){var c,h,d=10,p=0,g=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){p=qs(o.subarray(6,10)),p+=10;var S=o[5]&64;S&&(d+=4,d+=qs(o.subarray(10,14)),p-=qs(o.subarray(16,20)));do{if(c=qs(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,$s[C.id]?$s[C.id](C):C.id[0]==="T"?$s["T*"](C):C.id[0]==="W"&&$s["W*"](C),g.push(C),d+=10,d+=c}while(d<p);return g}},vu={parseId3Frames:ep,parseSyncSafeInteger:qs,frameParsers:$s},tp=t,ip=Nr,gi=vu,Fr;Fr=function(o){var c={descriptor:o&&o.descriptor},h=0,d=[],p=0,g;if(Fr.prototype.init.call(this),this.dispatchType=ip.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,F,W,oe;if(S.type==="timed-metadata"){if(S.dataAlignmentIndicator&&(p=0,d.length=0),d.length===0&&(S.data.length<10||S.data[0]!==73||S.data[1]!==68||S.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(d.push(S),p+=S.data.byteLength,d.length===1&&(h=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},W=0;W<h;)C.data.set(d[0].data.subarray(0,h-W),W),W+=d[0].data.byteLength,p-=d[0].data.byteLength,d.shift();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]),F={id:oe,data:C.data.subarray(A+10,A+k+10)},F.key=F.id,gi.frameParsers[F.id]?gi.frameParsers[F.id](F):F.id[0]==="T"?gi.frameParsers["T*"](F):F.id[0]==="W"&&gi.frameParsers["W*"](F),F.owner==="com.apple.streaming.transportStreamTimestamp"){var J=F.data,ce=(J[3]&1)<<30|J[4]<<22|J[5]<<14|J[6]<<6|J[7]>>>2;ce*=4,ce+=J[7]&3,F.timeStamp=ce,C.pts===void 0&&C.dts===void 0&&(C.pts=F.timeStamp,C.dts=F.timeStamp),this.trigger("timestamp",F)}C.frames.push(F),A+=10,A+=k}while(A<h);this.trigger("data",C)}}}},Fr.prototype=new tp;var sp=Fr,na=t,aa=gu,Nt=Nr,rp=yu.TimestampRolloverStream,Ur,Vs,jr,Qi=188,oa=71;Ur=function(){var o=new Uint8Array(Qi),c=0;Ur.prototype.init.call(this),this.push=function(h){var d=0,p=Qi,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+=Qi,p+=Qi;continue}d++,p++}d<g.byteLength&&(o.set(g.subarray(d),0),c=g.byteLength-d)},this.flush=function(){c===Qi&&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")}},Ur.prototype=new na,Vs=function(){var o,c,h,d;Vs.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 F=p[k],W=(p[k+1]&31)<<8|p[k+2];F===Nt.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=W:F===Nt.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=W:F===Nt.METADATA_STREAM_TYPE&&(d.programMapTable["timed-metadata"][W]=F),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=Nt.H264_STREAM_TYPE:S.pid===this.programMapTable.audio?S.streamType=Nt.ADTS_STREAM_TYPE:S.streamType=this.programMapTable["timed-metadata"][S.pid],S.type="pes",S.data=p.subarray(g),this.trigger("data",S)}},Vs.prototype=new na,Vs.STREAM_TYPES={h264:27,adts:15},jr=function(){var o=this,c=!1,h={data:[],size:0},d={data:[],size:0},p={data:[],size:0},g,S=function(A,k){var F;const W=A[0]<<16|A[1]<<8|A[2];k.data=new Uint8Array,W===1&&(k.packetLength=6+(A[4]<<8|A[5]),k.dataAlignmentIndicator=(A[6]&4)!==0,F=A[7],F&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,F&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,F){var W=new Uint8Array(A.size),oe={type:k},J=0,ce=0,Te=!1,Ye;if(!(!A.data.length||A.size<9)){for(oe.trackId=A.data[0].pid,J=0;J<A.data.length;J++)Ye=A.data[J],W.set(Ye.data,ce),ce+=Ye.data.byteLength;S(W,oe),Te=k==="video"||oe.packetLength<=A.size,(F||Te)&&(A.size=0,A.data.length=0),Te&&o.trigger("data",oe)}};jr.prototype.init.call(this),this.push=function(A){({pat:function(){},pes:function(){var k,F;switch(A.streamType){case Nt.H264_STREAM_TYPE:k=h,F="video";break;case Nt.ADTS_STREAM_TYPE:k=d,F="audio";break;case Nt.METADATA_STREAM_TYPE:k=p,F="timed-metadata";break;default:return}A.payloadUnitStartIndicator&&C(k,F,!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")}},jr.prototype=new na;var bu={PAT_PID:0,MP2T_PACKET_LENGTH:Qi,TransportPacketStream:Ur,TransportParseStream:Vs,ElementaryStream:jr,TimestampRolloverStream:rp,CaptionStream:aa.CaptionStream,Cea608Stream:aa.Cea608Stream,Cea708Stream:aa.Cea708Stream,MetadataStream:sp};for(var ua in Nt)Nt.hasOwnProperty(ua)&&(bu[ua]=Nt[ua]);var np=bu,ap=t,op=Se.ONE_SECOND_IN_TS,qr,xu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];qr=function(o){var c,h=0;qr.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 F;p+7<c.length;){if(c[p]!==255||(c[p+1]&246)!==240){typeof F!="number"&&(F=p),p++;continue}if(typeof F=="number"&&(this.skipWarn_(F,p),F=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*op/xu[(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:xu[(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 F=="number"&&(this.skipWarn_(F,p),F=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")}},qr.prototype=new ap;var up=qr,Su;Su=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 lp=Su,Eu=t,cp=lp,$r,Vr,Cu;Vr=function(){var o=0,c,h;Vr.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")}},Vr.prototype=new Eu,Cu={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},$r=function(){var o=new Vr,c,h,d,p,g,S,C;$r.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 F=8,W=8,oe,J;for(oe=0;oe<A;oe++)W!==0&&(J=k.readExpGolomb(),W=(F+J+256)%256),F=W===0?F:W},g=function(A){for(var k=A.byteLength,F=[],W=1,oe,J;W<k-2;)A[W]===0&&A[W+1]===0&&A[W+2]===3?(F.push(W+2),W+=2):W++;if(F.length===0)return A;oe=k-F.length,J=new Uint8Array(oe);var ce=0;for(W=0;W<oe;ce++,W++)ce===F[0]&&(ce++,F.shift()),J[W]=A[ce];return J},S=function(A){var k=0,F=0,W=0,oe=0,J,ce,Te,Ye,yt,yi,Ys,Qs,Js,Zs,tn,Oe=[1,1],er,Bt;if(J=new cp(A),ce=J.readUnsignedByte(),Ye=J.readUnsignedByte(),Te=J.readUnsignedByte(),J.skipUnsignedExpGolomb(),Cu[ce]&&(yt=J.readUnsignedExpGolomb(),yt===3&&J.skipBits(1),J.skipUnsignedExpGolomb(),J.skipUnsignedExpGolomb(),J.skipBits(1),J.readBoolean()))for(tn=yt!==3?8:12,Bt=0;Bt<tn;Bt++)J.readBoolean()&&(Bt<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(),Ys=J.readUnsignedExpGolomb(),Bt=0;Bt<Ys;Bt++)J.skipExpGolomb();if(J.skipUnsignedExpGolomb(),J.skipBits(1),Qs=J.readUnsignedExpGolomb(),Js=J.readUnsignedExpGolomb(),Zs=J.readBits(1),Zs===0&&J.skipBits(1),J.skipBits(1),J.readBoolean()&&(k=J.readUnsignedExpGolomb(),F=J.readUnsignedExpGolomb(),W=J.readUnsignedExpGolomb(),oe=J.readUnsignedExpGolomb()),J.readBoolean()&&J.readBoolean()){switch(er=J.readUnsignedByte(),er){case 1:Oe=[1,1];break;case 2:Oe=[12,11];break;case 3:Oe=[10,11];break;case 4:Oe=[16,11];break;case 5:Oe=[40,33];break;case 6:Oe=[24,11];break;case 7:Oe=[20,11];break;case 8:Oe=[32,11];break;case 9:Oe=[80,33];break;case 10:Oe=[18,11];break;case 11:Oe=[15,11];break;case 12:Oe=[64,33];break;case 13:Oe=[160,99];break;case 14:Oe=[4,3];break;case 15:Oe=[3,2];break;case 16:Oe=[2,1];break;case 255:{Oe=[J.readUnsignedByte()<<8|J.readUnsignedByte(),J.readUnsignedByte()<<8|J.readUnsignedByte()];break}}Oe&&Oe[0]/Oe[1]}return{profileIdc:ce,levelIdc:Te,profileCompatibility:Ye,width:(Qs+1)*16-k*2-F*2,height:(2-Zs)*(Js+1)*16-W*2-oe*2,sarRatio:Oe}}},$r.prototype=new Eu;var dp={H264Stream:$r},hp=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],wu=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},Au=function(o,c){return o.length-c<10||o[c]!==73||o[c+1]!==68||o[c+2]!==51?c:(c+=wu(o,c),Au(o,c))},fp=function(o){var c=Au(o,0);return o.length>=c+2&&(o[c]&255)===255&&(o[c+1]&240)===240&&(o[c+1]&22)===16},Du=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},pp=function(o,c,h){var d,p="";for(d=c;d<h;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},mp=function(o,c,h){return unescape(pp(o,c,h))},gp=function(o,c){var h=(o[c+5]&224)>>5,d=o[c+4]<<3,p=o[c+3]&6144;return p|d|h},_p=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},yp=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return hp[(o[c+2]&60)>>>2]}return null},Tp=function(o){var c,h,d,p;c=10,o[5]&64&&(c+=4,c+=Du(o.subarray(10,14)));do{if(h=Du(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=mp(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:fp,parseId3TagSize:wu,parseAdtsSize:gp,parseType:_p,parseSampleRate:yp,parseAacTimestamp:Tp},vp=t,ku=la,Hr;Hr=function(){var o=new Uint8Array,c=0;Hr.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=ku.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=ku.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")}},Hr.prototype=new vp;var bp=Hr,xp=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Sp=xp,Ep=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Cp=Ep,zr=t,Hs=We,zs=Ki,Gr=Fs,Mt=G,ii=np,Wr=Se,Iu=up,wp=dp.H264Stream,Ap=bp,Dp=la.isLikelyAacData,kp=Se.ONE_SECOND_IN_TS,Pu=Sp,Lu=Cp,Xr,Gs,Kr,Ri,Ip=function(o,c){c.stream=o,this.trigger("log",c)},Ou=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",Ip.bind(o,p))}},Ru=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},Nu=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}};Gs=function(o,c){var h=[],d,p=0,g=0,S=1/0;c=c||{},d=c.firstSequenceNumber||0,Gs.prototype.init.call(this),this.push=function(C){Mt.collectDtsInfo(o,C),o&&Pu.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,F,W,oe,J;if(h.length===0){this.trigger("done","AudioSegmentStream");return}C=Gr.trimAdtsFramesByEarliestDts(h,o,p),o.baseMediaDecodeTime=Mt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),J=Gr.prefixWithSilence(o,C,g,S),o.samples=Gr.generateSampleTable(C),k=Hs.mdat(Gr.concatenateFrameData(C)),h=[],A=Hs.moof(d,[o]),F=new Uint8Array(A.byteLength+k.byteLength),d++,F.set(A),F.set(k,A.byteLength),Mt.clearDtsInfo(o),W=Math.ceil(kp*1024/o.samplerate),C.length&&(oe=C.length*W,this.trigger("segmentTimingInfo",Nu(Wr.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:F}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Mt.clearDtsInfo(o),h=[],this.trigger("reset")}},Gs.prototype=new zr,Xr=function(o,c){var h,d=[],p=[],g,S;c=c||{},h=c.firstSequenceNumber||0,Xr.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(C){Mt.collectDtsInfo(o,C),C.nalUnitType==="seq_parameter_set_rbsp"&&!g&&(g=C.config,o.sps=[C.data],Lu.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,F,W,oe,J=0,ce,Te;d.length&&d[0].nalUnitType!=="access_unit_delimiter_rbsp";)d.shift();if(d.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(C=zs.groupNalsIntoFrames(d),k=zs.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=zs.extendFirstKeyFrame(k)),p.length){var Ye;if(c.alignGopsAtEnd?Ye=this.alignGopsAtEnd_(k):Ye=this.alignGopsAtStart_(k),!Ye){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}Mt.clearDtsInfo(o),k=Ye}Mt.collectDtsInfo(o,k),o.samples=zs.generateSampleTable(k),W=Hs.mdat(zs.concatenateNalData(k)),o.baseMediaDecodeTime=Mt.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",k.map(function(yt){return{pts:yt.pts,dts:yt.dts,byteLength:yt.byteLength}})),ce=k[0],Te=k[k.length-1],this.trigger("segmentTimingInfo",Nu(o.baseMediaDecodeTime,ce.dts,ce.pts,Te.dts+Te.duration,Te.pts+Te.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),F=Hs.moof(h,[o]),oe=new Uint8Array(F.byteLength+W.byteLength),h++,oe.set(F),oe.set(W,F.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(){Mt.clearDtsInfo(o),g=void 0,S=void 0},this.getGopForFusion_=function(C){var A=45e3,k=1/0,F,W,oe,J,ce;for(ce=0;ce<this.gopCache_.length;ce++)J=this.gopCache_[ce],oe=J.gop,!(!(o.pps&&Ru(o.pps[0],J.pps[0]))||!(o.sps&&Ru(o.sps[0],J.sps[0])))&&(oe.dts<o.timelineStartInfo.dts||(F=C.dts-oe.dts-oe.duration,F>=-1e4&&F<=A&&(!W||k>F)&&(W=J,k=F)));return W?W.gop:null},this.alignGopsAtStart_=function(C){var A,k,F,W,oe,J,ce,Te;for(oe=C.byteLength,J=C.nalCount,ce=C.duration,A=k=0;A<p.length&&k<C.length&&(F=p[A],W=C[k],F.pts!==W.pts);){if(W.pts>F.pts){A++;continue}k++,oe-=W.byteLength,J-=W.nalCount,ce-=W.duration}return k===0?C:k===C.length?null:(Te=C.slice(k),Te.byteLength=oe,Te.duration=ce,Te.nalCount=J,Te.pts=Te[0].pts,Te.dts=Te[0].dts,Te)},this.alignGopsAtEnd_=function(C){var A,k,F,W,oe,J;for(A=p.length-1,k=C.length-1,oe=null,J=!1;A>=0&&k>=0;){if(F=p[A],W=C[k],F.pts===W.pts){J=!0;break}if(F.pts>W.pts){A--;continue}A===p.length-1&&(oe=k),k--}if(!J&&oe===null)return null;var ce;if(J?ce=k:ce=oe,ce===0)return C;var Te=C.slice(ce),Ye=Te.reduce(function(yt,yi){return yt.byteLength+=yi.byteLength,yt.duration+=yi.duration,yt.nalCount+=yi.nalCount,yt},{byteLength:0,duration:0,nalCount:0});return Te.byteLength=Ye.byteLength,Te.duration=Ye.duration,Te.nalCount=Ye.nalCount,Te.pts=Te[0].pts,Te.dts=Te[0].dts,Te},this.alignGopsWith=function(C){p=C}},Xr.prototype=new zr,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 zr,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,Lu.forEach(function(A){h.info[A]=this.videoTrack[A]},this)):this.audioTrack&&(S=this.audioTrack.timelineStartInfo.pts,Pu.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=Hs.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=Wr.metadataTsToSeconds(d.startPts,S,this.keepOriginalTimestamps),d.endTime=Wr.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=Wr.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},Kr=function(o){var c=this,h=!0,d,p;Kr.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 ii.MetadataStream,g.aacStream=new Ap,g.audioTimestampRolloverStream=new ii.TimestampRolloverStream("audio"),g.timedMetadataTimestampRolloverStream=new ii.TimestampRolloverStream("timed-metadata"),g.adtsStream=new Iu,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 Gs(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")),Ou(this,g)},this.setupTsPipeline=function(){var g={};this.transmuxPipeline_=g,g.type="ts",g.metadataStream=new ii.MetadataStream,g.packetStream=new ii.TransportPacketStream,g.parseStream=new ii.TransportParseStream,g.elementaryStream=new ii.ElementaryStream,g.timestampRolloverStream=new ii.TimestampRolloverStream,g.adtsStream=new Iu,g.h264Stream=new wp,g.captionStream=new ii.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 Xr(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 Gs(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")),Ou(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,Mt.clearDtsInfo(p),S.audioTimestampRolloverStream&&S.audioTimestampRolloverStream.discontinuity()),d&&(S.videoSegmentStream&&(S.videoSegmentStream.gopCache_=[]),d.timelineStartInfo.dts=void 0,d.timelineStartInfo.pts=void 0,Mt.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=Dp(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()}},Kr.prototype=new zr;var Pp={Transmuxer:Kr},Lp=function(o){return o>>>0},Op=function(o){return("00"+o.toString(16)).slice(-2)},Yr={toUnsigned:Lp,toHexString:Op},Rp=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},Mu=Rp,Np=Yr.toUnsigned,Mp=Mu,Bu=function(o,c){var h=[],d,p,g,S,C;if(!c.length)return null;for(d=0;d<o.byteLength;)p=Np(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3]),g=Mp(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=Bu(o.subarray(d+8,S),c.slice(1)),C.length&&(h=h.concat(C)))),d=S;return h},ca=Bu,Bp=Yr.toUnsigned,Fp=n.getUint64,Up=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=Fp(o.subarray(4)):c.baseMediaDecodeTime=Bp(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},da=Up,jp=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,F;return F=8,d&&(F+=4,h.baseDataOffset=c.getUint32(12),F+=4),p&&(h.sampleDescriptionIndex=c.getUint32(F),F+=4),g&&(h.defaultSampleDuration=c.getUint32(F),F+=4),S&&(h.defaultSampleSize=c.getUint32(F),F+=4),C&&(h.defaultSampleFlags=c.getUint32(F)),A&&(h.durationIsEmpty=!0),!d&&k&&(h.baseDataOffsetIsMoof=!0),h},Fu=jp,qp=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},$p=qp,Uu=$p,Vp=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),F=8,W;for(d&&(c.dataOffset=h.getInt32(F),F+=4),p&&k&&(W={flags:Uu(o.subarray(F,F+4))},F+=4,g&&(W.duration=h.getUint32(F),F+=4),S&&(W.size=h.getUint32(F),F+=4),A&&(c.version===1?W.compositionTimeOffset=h.getInt32(F):W.compositionTimeOffset=h.getUint32(F),F+=4),c.samples.push(W),k--);k--;)W={},g&&(W.duration=h.getUint32(F),F+=4),S&&(W.size=h.getUint32(F),F+=4),C&&(W.flags=Uu(o.subarray(F,F+4)),F+=4),A&&(c.version===1?W.compositionTimeOffset=h.getInt32(F):W.compositionTimeOffset=h.getUint32(F),F+=4),c.samples.push(W);return c},ju=Vp,qu={tfdt:da,trun:ju},$u={parseTfdt:qu.tfdt,parseTrun:qu.trun},Hp=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},zp={uint8ToCString:Hp},Qr=zp.uint8ToCString,Gp=n.getUint64,Wp=function(o){var c=4,h=o[0],d,p,g,S,C,A,k,F;if(h===0){d=Qr(o.subarray(c)),c+=d.length,p=Qr(o.subarray(c)),c+=p.length;var W=new DataView(o.buffer);g=W.getUint32(c),c+=4,C=W.getUint32(c),c+=4,A=W.getUint32(c),c+=4,k=W.getUint32(c),c+=4}else if(h===1){var W=new DataView(o.buffer);g=W.getUint32(c),c+=4,S=Gp(o.subarray(c)),c+=8,A=W.getUint32(c),c+=4,k=W.getUint32(c),c+=4,d=Qr(o.subarray(c)),c+=d.length,p=Qr(o.subarray(c)),c+=p.length}F=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:F};return Kp(h,oe)?oe:void 0},Xp=function(o,c,h,d){return o||o===0?o/c:d+h/c},Kp=function(o,c){var h=c.scheme_id_uri!=="\0",d=o===0&&Vu(c.presentation_time_delta)&&h,p=o===1&&Vu(c.presentation_time)&&h;return!(o>1)&&d||p},Vu=function(o){return o!==void 0||o!==null},Yp={parseEmsgBox:Wp,scaleTime:Xp},Ws;typeof window<"u"?Ws=window:typeof s<"u"?Ws=s:typeof self<"u"?Ws=self:Ws={};var Hu=Ws,Jr=Yr.toUnsigned,Xs=Yr.toHexString,Ve=ca,Ji=Mu,ha=Yp,Qp=Fu,Jp=ju,Zp=da,em=n.getUint64,zu,Gu,Wu,Xu,Ku,fa,Yu,pa=Hu,tm=vu.parseId3Frames;zu=function(o){var c={},h=Ve(o,["moov","trak"]);return h.reduce(function(d,p){var g,S,C,A,k;return g=Ve(p,["tkhd"])[0],!g||(S=g[0],C=S===0?12:20,A=Jr(g[C]<<24|g[C+1]<<16|g[C+2]<<8|g[C+3]),k=Ve(p,["mdia","mdhd"])[0],!k)?null:(S=k[0],C=S===0?12:20,d[A]=Jr(k[C]<<24|k[C+1]<<16|k[C+2]<<8|k[C+3]),d)},c)},Gu=function(o,c){var h;h=Ve(c,["moof","traf"]);var d=h.reduce(function(p,g){var S=Ve(g,["tfhd"])[0],C=Jr(S[4]<<24|S[5]<<16|S[6]<<8|S[7]),A=o[C]||9e4,k=Ve(g,["tfdt"])[0],F=new DataView(k.buffer,k.byteOffset,k.byteLength),W;k[0]===1?W=em(k.subarray(4,12)):W=F.getUint32(4);let oe;return typeof W=="bigint"?oe=W/pa.BigInt(A):typeof W=="number"&&!isNaN(W)&&(oe=W/A),oe<Number.MAX_SAFE_INTEGER&&(oe=Number(oe)),oe<p&&(p=oe),p},1/0);return typeof d=="bigint"||isFinite(d)?d:0},Wu=function(o,c){var h=Ve(c,["moof","traf"]),d=0,p=0,g;if(h&&h.length){var S=Ve(h[0],["tfhd"])[0],C=Ve(h[0],["trun"])[0],A=Ve(h[0],["tfdt"])[0];if(S){var k=Qp(S);g=k.trackId}if(A){var F=Zp(A);d=F.baseMediaDecodeTime}if(C){var W=Jp(C);W.samples&&W.samples.length&&(p=W.samples[0].compositionTimeOffset||0)}}var oe=o[g]||9e4;typeof d=="bigint"&&(p=pa.BigInt(p),oe=pa.BigInt(oe));var J=(d+p)/oe;return typeof J=="bigint"&&J<Number.MAX_SAFE_INTEGER&&(J=Number(J)),J},Xu=function(o){var c=Ve(o,["moov","trak"]),h=[];return c.forEach(function(d){var p=Ve(d,["mdia","hdlr"]),g=Ve(d,["tkhd"]);p.forEach(function(S,C){var A=Ji(S.subarray(8,12)),k=g[C],F,W,oe;A==="vide"&&(F=new DataView(k.buffer,k.byteOffset,k.byteLength),W=F.getUint8(0),oe=W===0?F.getUint32(12):F.getUint32(20),h.push(oe))})}),h},fa=function(o){var c=o[0],h=c===0?12:20;return Jr(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3])},Ku=function(o){var c=Ve(o,["moov","trak"]),h=[];return c.forEach(function(d){var p={},g=Ve(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=Ve(d,["mdia","hdlr"])[0];if(A){var k=Ji(A.subarray(8,12));k==="vide"?p.type="video":k==="soun"?p.type="audio":p.type=k}var F=Ve(d,["mdia","minf","stbl","stsd"])[0];if(F){var W=F.subarray(8);p.codec=Ji(W.subarray(4,8));var oe=Ve(W,[p.codec])[0],J,ce;oe&&(/^[asm]vc[1-9]$/i.test(p.codec)?(J=oe.subarray(78),ce=Ji(J.subarray(4,8)),ce==="avcC"&&J.length>11?(p.codec+=".",p.codec+=Xs(J[9]),p.codec+=Xs(J[10]),p.codec+=Xs(J[11])):p.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(p.codec)?(J=oe.subarray(28),ce=Ji(J.subarray(4,8)),ce==="esds"&&J.length>20&&J[19]!==0?(p.codec+="."+Xs(J[19]),p.codec+="."+Xs(J[20]>>>2&63).replace(/^0/,"")):p.codec="mp4a.40.2"):p.codec=p.codec.toLowerCase())}var Te=Ve(d,["mdia","mdhd"])[0];Te&&(p.timescale=fa(Te)),h.push(p)}),h},Yu=function(o,c=0){var h=Ve(o,["emsg"]);return h.map(d=>{var p=ha.parseEmsgBox(new Uint8Array(d)),g=tm(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 Ks={findBox:Ve,parseType:Ji,timescale:zu,startTime:Gu,compositionStartTime:Wu,videoTrackIds:Xu,tracks:Ku,getTimescaleFromMediaHeader:fa,getEmsgID3:Yu};const{parseTrun:im}=$u,{findBox:Qu}=Ks;var Ju=Hu,sm=function(o){var c=Qu(o,["moof","traf"]),h=Qu(o,["mdat"]),d=[];return h.forEach(function(p,g){var S=c[g];d.push({mdat:p,traf:S})}),d},rm=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=im(A),F=k.samples;F.forEach(function(W){W.duration===void 0&&(W.duration=p),W.size===void 0&&(W.size=g),W.trackId=S,W.dts=d,W.compositionTimeOffset===void 0&&(W.compositionTimeOffset=0),typeof d=="bigint"?(W.pts=d+Ju.BigInt(W.compositionTimeOffset),d+=Ju.BigInt(W.duration)):(W.pts=d+W.compositionTimeOffset,d+=W.duration)}),C=C.concat(F)}),C},Zu={getMdatTrafPairs:sm,parseSamples:rm},nm=Ct.discardEmulationPreventionBytes,am=gu.CaptionStream,ma=ca,om=da,um=Fu,{getMdatTrafPairs:lm,parseSamples:cm}=Zu,dm=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},hm=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),F=dm(S,c);if(g={nalUnitType:"sei_rbsp",size:C,data:k,escapedRBSP:nm(k),trackId:h},F)g.pts=F.pts,g.dts=F.dts,A=F;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},fm=function(o,c){var h={},d=lm(o);return d.forEach(function(p){var g=p.mdat,S=p.traf,C=ma(S,["tfhd"]),A=um(C[0]),k=A.trackId,F=ma(S,["tfdt"]),W=F.length>0?om(F[0]).baseMediaDecodeTime:0,oe=ma(S,["trun"]),J,ce;c===k&&oe.length>0&&(J=cm(oe,W,A),ce=hm(g,J,k),h[k]||(h[k]={seiNals:[],logs:[]}),h[k].seiNals=h[k].seiNals.concat(ce.seiNals),h[k].logs=h[k].logs.concat(ce.logs))}),h},pm=function(o,c,h){var d;if(c===null)return null;d=fm(o,c);var p=d[c]||{};return{seiNals:p.seiNals,logs:p.logs,timescale:h}},mm=function(){var o=!1,c,h,d,p,g,S;this.isInitialized=function(){return o},this.init=function(C){c=new am,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 F;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 W=h.shift();this.parse(W,A,k)}return F=pm(C,d,p),F&&F.logs&&(g.logs=g.logs.concat(F.logs)),F===null||!F.seiNals?g.logs.length?{logs:g.logs,captions:[],captionStreams:[]}:null:(this.pushNals(F.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()},gm=mm;const{parseTfdt:_m}=$u,_i=ca,{getTimescaleFromMediaHeader:ym}=Ks,{parseSamples:Tm,getMdatTrafPairs:vm}=Zu;var el=function(){let o=9e4;this.init=function(c){const h=_i(c,["moov","trak","mdia","mdhd"])[0];h&&(o=ym(h))},this.parseSegment=function(c){const h=[],d=vm(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],F=_i(C,["trun"]);if(A&&(p=_m(A).baseMediaDecodeTime),F.length&&k){const W=Tm(F,p,k);let oe=0;W.forEach(function(J){const ce="utf-8",Te=new TextDecoder(ce),Ye=S.slice(oe,oe+J.size);if(_i(Ye,["vtte"])[0]){oe+=J.size;return}_i(Ye,["vttc"]).forEach(function(Ys){const Qs=_i(Ys,["payl"])[0],Js=_i(Ys,["sttg"])[0],Zs=J.pts/o,tn=(J.pts+J.duration)/o;let Oe,er;if(Qs)try{Oe=Te.decode(Qs)}catch(Bt){console.error(Bt)}if(Js)try{er=Te.decode(Js)}catch(Bt){console.error(Bt)}J.duration&&Oe&&h.push({cueText:Oe,start:Zs,end:tn,settings:er})}),oe+=J.size})}}),h}},ga=Nr,tl=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},Zr=function(o){return!!(o[1]&64)},en=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},bm=function(o,c){var h=tl(o);return h===0?"pat":h===c?"pmt":c?"pes":null},xm=function(o){var c=Zr(o),h=4+en(o);return c&&(h+=o[h]+1),(o[h+10]&31)<<8|o[h+11]},Sm=function(o){var c={},h=Zr(o),d=4+en(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}},Em=function(o,c){var h=tl(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}},Cm=function(o){var c=Zr(o);if(!c)return null;var h=4+en(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}},wm=function(o){for(var c=4+en(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},Am={parseType:bm,parsePat:xm,parsePmt:Sm,parsePayloadUnitStartIndicator:Zr,parsePesType:Em,parsePesTime:Cm,videoPacketContainsKeyFrame:wm},il=Nr,Zi=yu.handleRollover,we={};we.ts=Am,we.aac=la;var Ni=Se.ONE_SECOND_IN_TS,ot=188,Vt=71,Dm=function(o,c){for(var h=0,d=ot,p,g;d<o.byteLength;){if(o[h]===Vt&&o[d]===Vt){switch(p=o.subarray(h,d),g=we.ts.parseType(p,c.pid),g){case"pat":c.pid=we.ts.parsePat(p);break;case"pmt":var S=we.ts.parsePmt(p);c.table=c.table||{},Object.keys(S).forEach(function(C){c.table[C]=S[C]});break}h+=ot,d+=ot;continue}h++,d++}},sl=function(o,c,h){for(var d=0,p=ot,g,S,C,A,k,F=!1;p<=o.byteLength;){if(o[d]===Vt&&(o[p]===Vt||p===o.byteLength)){if(g=o.subarray(d,p),S=we.ts.parseType(g,c.pid),S==="pes"&&(C=we.ts.parsePesType(g,c.table),A=we.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=we.ts.parsePesTime(g),k&&(k.type="audio",h.audio.push(k),F=!0))),F)break;d+=ot,p+=ot;continue}d++,p++}for(p=o.byteLength,d=p-ot,F=!1;d>=0;){if(o[d]===Vt&&(o[p]===Vt||p===o.byteLength)){if(g=o.subarray(d,p),S=we.ts.parseType(g,c.pid),S==="pes"&&(C=we.ts.parsePesType(g,c.table),A=we.ts.parsePayloadUnitStartIndicator(g),C==="audio"&&A&&(k=we.ts.parsePesTime(g),k&&(k.type="audio",h.audio.push(k),F=!0))),F)break;d-=ot,p-=ot;continue}d--,p--}},km=function(o,c,h){for(var d=0,p=ot,g,S,C,A,k,F,W,oe,J=!1,ce={data:[],size:0};p<o.byteLength;){if(o[d]===Vt&&o[p]===Vt){switch(g=o.subarray(d,p),S=we.ts.parseType(g,c.pid),S){case"pes":if(C=we.ts.parsePesType(g,c.table),A=we.ts.parsePayloadUnitStartIndicator(g),C==="video"&&(A&&!J&&(k=we.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),J=!0)),!h.firstKeyFrame)){if(A&&ce.size!==0){for(F=new Uint8Array(ce.size),W=0;ce.data.length;)oe=ce.data.shift(),F.set(oe,W),W+=oe.byteLength;if(we.ts.videoPacketContainsKeyFrame(F)){var Te=we.ts.parsePesTime(F);Te?(h.firstKeyFrame=Te,h.firstKeyFrame.type="video"):console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.")}ce.size=0}ce.data.push(g),ce.size+=g.byteLength}break}if(J&&h.firstKeyFrame)break;d+=ot,p+=ot;continue}d++,p++}for(p=o.byteLength,d=p-ot,J=!1;d>=0;){if(o[d]===Vt&&o[p]===Vt){if(g=o.subarray(d,p),S=we.ts.parseType(g,c.pid),S==="pes"&&(C=we.ts.parsePesType(g,c.table),A=we.ts.parsePayloadUnitStartIndicator(g),C==="video"&&A&&(k=we.ts.parsePesTime(g),k&&(k.type="video",h.video.push(k),J=!0))),J)break;d-=ot,p-=ot;continue}d--,p--}},Im=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=Zi(g.dts,h),g.pts=Zi(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=Zi(g.dts,d),g.pts=Zi(g.pts,d),g.dtsTime=g.dts/Ni,g.ptsTime=g.pts/Ni}),o.firstKeyFrame){var p=o.firstKeyFrame;p.dts=Zi(p.dts,d),p.pts=Zi(p.pts,d),p.dtsTime=p.dts/Ni,p.ptsTime=p.pts/Ni}}},Pm=function(o){for(var c=!1,h=0,d=null,p=null,g=0,S=0,C;o.length-S>=3;){var A=we.aac.parseType(o,S);switch(A){case"timed-metadata":if(o.length-S<10){c=!0;break}if(g=we.aac.parseId3TagSize(o,S),g>o.length){c=!0;break}p===null&&(C=o.subarray(S,S+g),p=we.aac.parseAacTimestamp(C)),S+=g;break;case"audio":if(o.length-S<7){c=!0;break}if(g=we.aac.parseAdtsSize(o,S),g>o.length){c=!0;break}d===null&&(C=o.subarray(S,S+g),d=we.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,F={audio:[{type:"audio",dts:p,pts:p},{type:"audio",dts:p+h*1024*k,pts:p+h*1024*k}]};return F},Lm=function(o){var c={pid:null,table:null},h={};Dm(o,c);for(var d in c.table)if(c.table.hasOwnProperty(d)){var p=c.table[d];switch(p){case il.H264_STREAM_TYPE:h.video=[],km(o,c,h),h.video.length===0&&delete h.video;break;case il.ADTS_STREAM_TYPE:h.audio=[],sl(o,c,h),h.audio.length===0&&delete h.audio;break}}return h},Om=function(o,c){var h=we.aac.isLikelyAacData(o),d;return h?d=Pm(o):d=Lm(o),!d||!d.audio&&!d.video?null:(Im(d,c),d)},Rm={inspect:Om,parseAudioPes_:sl};const Nm=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:Se.videoTsToSeconds(h.start.dts),presentation:Se.videoTsToSeconds(h.start.pts)},end:{decode:Se.videoTsToSeconds(h.end.dts),presentation:Se.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:Se.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=Se.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:d})}),c.on("audioSegmentTimingInfo",function(h){const d={start:{decode:Se.videoTsToSeconds(h.start.dts),presentation:Se.videoTsToSeconds(h.start.pts)},end:{decode:Se.videoTsToSeconds(h.end.dts),presentation:Se.videoTsToSeconds(h.end.pts)},baseMediaDecodeTime:Se.videoTsToSeconds(h.baseMediaDecodeTime)};h.prependedContentDuration&&(d.prependedContentDuration=Se.videoTsToSeconds(h.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:d})}),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:Se.videoTsToSeconds(h.start),end:Se.videoTsToSeconds(h.end)}})}),c.on("videoTimingInfo",function(h){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:Se.videoTsToSeconds(h.start),end:Se.videoTsToSeconds(h.end)}})}),c.on("log",function(h){o.postMessage({action:"log",log:h})})};class rl{constructor(c,h){this.options=h||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Pp.Transmuxer(this.options),Nm(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new gm,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 el);const h=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(h)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new el);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=Ks.startTime(c,h);this.self.postMessage({action:"probeMp4StartTime",startTime:d,data:h},[h.buffer])}probeMp4Tracks({data:c}){const h=Ks.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:h,data:c},[c.buffer])}probeEmsgID3({data:c,offset:h}){const d=Ks.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*Se.ONE_SECOND_IN_TS:void 0,p=Rm.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(Se.secondsToVideoTs(h)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(Se.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 rl(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new rl(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var cv=hf(lv);const dv=(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(_)},hv=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},fv=(s,e)=>{e.gopInfo=s.data.gopInfo},mf=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:I,onEndedTimeline:y,onTransmuxerLog:P,isEndOfTimeline:N,segment:M,triggerSegmentEventFn:L}=s,B={buffer:[]};let U=N;const j=V=>{e.currentTransmux===s&&(V.data.action==="data"&&dv(V,B,a),V.data.action==="trackinfo"&&u(V.data.trackInfo),V.data.action==="gopInfo"&&fv(V,B),V.data.action==="audioTimingInfo"&&l(V.data.audioTimingInfo),V.data.action==="videoTimingInfo"&&f(V.data.videoTimingInfo),V.data.action==="videoSegmentTimingInfo"&&m(V.data.videoSegmentTimingInfo),V.data.action==="audioSegmentTimingInfo"&&_(V.data.audioSegmentTimingInfo),V.data.action==="id3Frame"&&w([V.data.id3Frame],V.data.id3Frame.dispatchType),V.data.action==="caption"&&x(V.data.caption),V.data.action==="endedtimeline"&&(U=!1,y()),V.data.action==="log"&&P(V.data.log),V.data.type==="transmuxed"&&(U||(e.onmessage=null,hv({transmuxedData:B,callback:I}),gf(e))))},O=()=>{const V={message:"Received an error message from the transmuxer worker",metadata:{errorType:$.Error.StreamingFailedToTransmuxSegment,segmentInfo:Ui({segment:M})}};I(null,V)};if(e.onmessage=j,e.onerror=O,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 V=t instanceof ArrayBuffer?t:t.buffer,v=t instanceof ArrayBuffer?0:t.byteOffset;L({type:"segmenttransmuxingstart",segment:M}),e.postMessage({action:"push",data:V,byteOffset:v,byteLength:t.byteLength},[V])}N&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},gf=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():mf(s.currentTransmux))},Sc=(s,e)=>{s.postMessage({action:e}),gf(s)},_f=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,Sc(e,s);return}e.transmuxQueue.push(Sc.bind(null,e,s))},pv=s=>{_f("reset",s)},mv=s=>{_f("endTimeline",s)},yf=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,mf(s);return}s.transmuxer.transmuxQueue.push(s)},gv=s=>{const e=new cv;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:s}),e};var Ya={reset:pv,endTimeline:mv,transmux:yf,createTransmuxer:gv};const ps=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,r=He({},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)},Yt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Tf="wvtt",Co=s=>{s.forEach(e=>{e.abort()})},_v=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),yv=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:Yt.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Yt.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Yt.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Yt.FAILURE,xhr:e,metadata:i}:null},Ec=(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:Yt.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)},Tv=(s,e)=>{e===Tf&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},vv=(s,e,t)=>{e===Tf&&ps({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:r})=>{s.bytes=i,t(null,s,{mp4VttCues:r})}})},vf=(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:Yt.FAILURE,metadata:{mediaType:r}})}ps({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"&&Tv(s,n.codec))}),e(null))})},bv=({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,vf(s,function(u){if(u)return u.xhr=r,u.status=r.status,e(u,s);e(null,s)})},xv=({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:ov(n.responseText.substring(s.lastReachedChar||0));return s.stats=_v(n),s.key?s.encryptedBytes=new Uint8Array(u):s.bytes=new Uint8Array(u),e(null,s)},Sv=({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 I=s.map&&s.map.tracks||{},y=!!(I.audio&&I.video);let P=i.bind(null,s,"audio","start");const N=i.bind(null,s,"audio","end");let M=i.bind(null,s,"video","start");const L=i.bind(null,s,"video","end"),B=()=>yf({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:y,onData:U=>{U.type=U.type==="combined"?"video":U.type,m(s,U)},onTrackInfo:U=>{t&&(y&&(U.isMuxed=!0),t(s,U))},onAudioTimingInfo:U=>{P&&typeof U.start<"u"&&(P(U.start),P=null),N&&typeof U.end<"u"&&N(U.end)},onVideoTimingInfo:U=>{M&&typeof U.start<"u"&&(M(U.start),M=null),L&&typeof U.end<"u"&&L(U.end)},onVideoSegmentTimingInfo:U=>{const j={pts:{start:U.start.presentation,end:U.end.presentation},dts:{start:U.start.decode,end:U.end.decode}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),r(U)},onAudioSegmentTimingInfo:U=>{const j={pts:{start:U.start.pts,end:U.end.pts},dts:{start:U.start.dts,end:U.end.dts}};x({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),n(U)},onId3:(U,j)=>{a(s,U,j)},onCaptions:U=>{u(s,[U])},isEndOfTimeline:l,onEndedTimeline:()=>{f()},onTransmuxerLog:w,onDone:(U,j)=>{_&&(U.type=U.type==="combined"?"video":U.type,x({type:"segmenttransmuxingcomplete",segment:s}),_(j,s,U))},segment:s,triggerSegmentEventFn:x});ps({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:U=>{s.bytes=e=U.data;const j=U.result;j&&(t(s,{hasAudio:j.hasAudio,hasVideo:j.hasVideo,isMuxed:y}),t=null),B()}})},bf=({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 I=new Uint8Array(e);if(H_(I)){s.isFmp4=!0;const{tracks:y}=s.map;if(y.text&&(!y.audio||!y.video)){m(s,{data:I,type:"text"}),vv(s,y.text.codec,_);return}const N={isFmp4:!0,hasVideo:!!y.video,hasAudio:!!y.audio};y.audio&&y.audio.codec&&y.audio.codec!=="enca"&&(N.audioCodec=y.audio.codec),y.video&&y.video.codec&&y.video.codec!=="encv"&&(N.videoCodec=y.video.codec),y.video&&y.audio&&(N.isMuxed=!0),t(s,N);const M=(L,B)=>{m(s,{data:I,type:N.hasAudio&&!N.isMuxed?"audio":"video"}),B&&B.length&&a(s,B),L&&L.length&&u(s,L),_(null,s,{})};ps({action:"probeMp4StartTime",timescales:s.map.timescales,data:I,transmuxer:s.transmuxer,callback:({data:L,startTime:B})=>{e=L.buffer,s.bytes=I=L,N.hasAudio&&!N.isMuxed&&i(s,"audio","start",B),N.hasVideo&&i(s,"video","start",B),ps({action:"probeEmsgID3",data:I,transmuxer:s.transmuxer,offset:B,callback:({emsgData:U,id3Frames:j})=>{if(e=U.buffer,s.bytes=I=U,!y.video||!U.byteLength||!s.transmuxer){M(void 0,j);return}ps({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:I,timescales:s.map.timescales,trackIds:[y.video.id],callback:O=>{e=O.data.buffer,s.bytes=I=O.data,O.logs.forEach(function(V){w(Ce(V,{stream:"mp4CaptionParser"}))}),M(O.captions,j)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=Mo(I)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}Sv({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})},xf=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(af({source:s,encrypted:t,key:l,iv:e.iv}),[t.buffer,l.buffer])},Ev=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x})=>{x({type:"segmentdecryptionstart"}),xf({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},I=>{e.bytes=I,x({type:"segmentdecryptioncomplete",segment:e}),bf({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})})},Cv=({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 I=0,y=!1;return(P,N)=>{if(!y){if(P)return y=!0,Co(s),_(P,N);if(I+=1,I===s.length){const M=function(){if(N.encryptedBytes)return Ev({decryptionWorker:e,segment:N,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:u,isEndOfTimeline:l,endedTimelineFn:f,dataFn:m,doneFn:_,onTransmuxerLog:w,triggerSegmentEventFn:x});bf({segment:N,bytes:N.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(N.endOfAllRequests=Date.now(),N.map&&N.map.encryptedBytes&&!N.map.bytes)return x({type:"segmentdecryptionstart",segment:N}),xf({decryptionWorker:e,id:N.requestId+"-init",encryptedBytes:N.map.encryptedBytes,key:N.map.key,segment:N,doneFn:_},L=>{N.map.bytes=L,x({type:"segmentdecryptioncomplete",segment:N}),vf(N,B=>{if(B)return Co(s),_(B,N);M()})});M()}}}},wv=({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=Ce(s.stats,yv(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},Dv=({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:I,doneFn:y,onTransmuxerLog:P,triggerSegmentEventFn:N})=>{const M=[],L=Cv({activeXhrs:M,decryptionWorker:t,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:I,doneFn:y,onTransmuxerLog:P,triggerSegmentEventFn:N});if(i.key&&!i.key.bytes){const V=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&V.push(i.map.key);const v=Ce(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),E=Ec(i,V,L,N),q={uri:i.key.resolvedUri};N({type:"segmentkeyloadstart",segment:i,keyInfo:q});const H=s(v,E);M.push(H)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const H=Ce(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),z=Ec(i,[i.map.key],L,N),K={uri:i.map.key.resolvedUri};N({type:"segmentkeyloadstart",segment:i,keyInfo:K});const te=s(H,z);M.push(te)}const v=Ce(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:So(i.map),requestType:"segment-media-initialization"}),E=bv({segment:i,finishProcessingFn:L,triggerSegmentEventFn:N});N({type:"segmentloadstart",segment:i});const q=s(v,E);M.push(q)}const B=Ce(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:So(i),requestType:"segment"}),U=xv({segment:i,finishProcessingFn:L,responseType:B.responseType,triggerSegmentEventFn:N});N({type:"segmentloadstart",segment:i});const j=s(B,U);j.addEventListener("progress",Av({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:u,videoSegmentTimingInfoFn:l,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:_,isEndOfTimeline:w,endedTimelineFn:x,dataFn:I})),M.push(j);const O={};return M.forEach(V=>{V.addEventListener("loadend",wv({loadendState:O,abortFn:r}))}),()=>Co(M)},un=Ot("PlaylistSelector"),Cc=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||""})},ms=function(s,e){if(!s)return"";const t=D.getComputedStyle(s);return t?t[e]:""},gs=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},kv=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 Sf=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;pt.isAudioOnly(e)&&(f=u.getAudioTrackPlaylists_(),l.audioOnly=!0);let m=f.map(O=>{let V;const v=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.width,E=O.attributes&&O.attributes.RESOLUTION&&O.attributes.RESOLUTION.height;return V=O.attributes&&O.attributes.BANDWIDTH,V=V||D.Number.MAX_VALUE,{bandwidth:V,width:v,height:E,playlist:O}});gs(m,(O,V)=>O.bandwidth-V.bandwidth),m=m.filter(O=>!pt.isIncompatible(O.playlist));let _=m.filter(O=>pt.isEnabled(O.playlist));_.length||(_=m.filter(O=>!pt.isDisabled(O.playlist)));const w=_.filter(O=>O.bandwidth*Qe.BANDWIDTH_VARIANCE<t);let x=w[w.length-1];const I=w.filter(O=>O.bandwidth===x.bandwidth)[0];if(a===!1){const O=I||_[0]||m[0];if(O&&O.playlist){let V="sortedPlaylistReps";return I&&(V="bandwidthBestRep"),_[0]&&(V="enabledPlaylistReps"),un(`choosing ${Cc(O)} using ${V} with options`,l),O.playlist}return un("could not choose a playlist with options",l),null}const y=w.filter(O=>O.width&&O.height);gs(y,(O,V)=>O.width-V.width);const P=y.filter(O=>O.width===i&&O.height===r);x=P[P.length-1];const N=P.filter(O=>O.bandwidth===x.bandwidth)[0];let M,L,B;N||(M=y.filter(O=>n==="cover"?O.width>i&&O.height>r:O.width>i||O.height>r),L=M.filter(O=>O.width===M[0].width&&O.height===M[0].height),x=L[L.length-1],B=L.filter(O=>O.bandwidth===x.bandwidth)[0]);let U;if(u.leastPixelDiffSelector){const O=y.map(V=>(V.pixelDiff=Math.abs(V.width-i)+Math.abs(V.height-r),V));gs(O,(V,v)=>V.pixelDiff===v.pixelDiff?v.bandwidth-V.bandwidth:V.pixelDiff-v.pixelDiff),U=O[0]}const j=U||B||N||I||_[0]||m[0];if(j&&j.playlist){let O="sortedPlaylistReps";return U?O="leastPixelDiffRep":B?O="resolutionPlusOneRep":N?O="resolutionBestRep":I?O="bandwidthBestRep":_[0]&&(O="enabledPlaylistReps"),un(`choosing ${Cc(j)} using ${O} with options`,l),j.playlist}return un("could not choose a playlist with options",l),null};const wc=function(){let s=this.useDevicePixelRatio&&D.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),Sf({main:this.playlists.main,bandwidth:this.systemBandwidth,playerWidth:parseInt(ms(this.tech_.el(),"width"),10)*s,playerHeight:parseInt(ms(this.tech_.el(),"height"),10)*s,playerObjectFit:this.usePlayerObjectFit?ms(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})},Iv=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),Sf({main:this.playlists.main,bandwidth:e,playerWidth:parseInt(ms(this.tech_.el(),"width"),10)*i,playerHeight:parseInt(ms(this.tech_.el(),"height"),10)*i,playerObjectFit:this.usePlayerObjectFit?ms(this.tech_.el(),"objectFit"):"",limitRenditionByPlayerDimensions:this.limitRenditionByPlayerDimensions,playlistController:this.playlistController_})}},Pv=function(s){const{main:e,currentTime:t,bandwidth:i,duration:r,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:u,syncController:l}=s,f=e.playlists.filter(I=>!pt.isIncompatible(I));let m=f.filter(pt.isEnabled);m.length||(m=f.filter(I=>!pt.isDisabled(I)));const w=m.filter(pt.hasAttribute.bind(null,"BANDWIDTH")).map(I=>{const P=l.getSyncPoint(I,r,u,t)?1:2,M=pt.estimateSegmentRequestTime(n,i,I)*P-a;return{playlist:I,rebufferingImpact:M}}),x=w.filter(I=>I.rebufferingImpact<=0);return gs(x,(I,y)=>pu(y.playlist,I.playlist)),x.length?x[0]:(gs(w,(I,y)=>I.rebufferingImpact-y.rebufferingImpact),w[0]||null)},Lv=function(){const s=this.playlists.main.playlists.filter(pt.isEnabled);return gs(s,(t,i)=>pu(t,i)),s.filter(t=>!!mr(this.playlists.main,t).video)[0]||null},Ov=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 Ef(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const Rv=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}}},Nv=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}}})},Bv=({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,I=Number(f[_+1])||x;w.forEach(y=>{y.endTime=I})})},Fv={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"},Uv=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),jv=({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(Uv.has(n))continue;const a=new i(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:Fv[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()})},Ac=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,$.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},lr=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)},qv=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}},$v=(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)},Vv=(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)},Hv=(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},zv=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},Gv=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]},nr=1,Wv=500,Dc=s=>typeof s=="number"&&isFinite(s),ln=1/60,Xv=(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,Kv=(s,e,t)=>{let i=e-Qe.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const r=e-t;return Math.min(r,i)},ss=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",I=s.segment.uri?"segment":"pre-segment",y=x?qh({preloadSegment:i})-1:0;return`${I} [${n+l}/${n+_}]`+(x?` part [${f}/${y}]`:"")+` 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}]`},kc=s=>`${s}TimingInfo`,Yv=({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},Qv=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_})&&Qv(s.timelineChangeController_)){if(Jv(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},Zv=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},Ic=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+Xt:!1,eb=(s,e)=>{if(e!=="hls")return null;const t=Zv({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,r=Ic({segmentDuration:t,maxDuration:i*2}),n=Ic({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_=Ot(`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(He({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(He({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 Ya.createTransmuxer({remux:!1,alignGopsAtEnd:this.safeAppend_,keepOriginalTimestamps:!0,parse708captions:this.parse708captions_,captionServices:this.captionServices_})}resetStats_(){this.mediaBytesTransferred=0,this.mediaRequests=0,this.mediaRequestsAborted=0,this.mediaRequestsTimedout=0,this.mediaRequestsErrored=0,this.mediaTransferDuration=0,this.mediaSecondsLoaded=0,this.mediaAppends=0}dispose(){this.trigger("dispose"),this.state="DISPOSED",this.pause(),this.abort_(),this.transmuxer_&&this.transmuxer_.terminate(),this.resetStats_(),this.checkBufferTimeout_&&D.clearTimeout(this.checkBufferTimeout_),this.syncController_&&this.triggerSyncInfoUpdate_&&this.syncController_.off("syncinfoupdate",this.triggerSyncInfoUpdate_),this.off()}setAudio(e){this.audioDisabled_=!e,e?this.appendInitSegment_.audio=!0:this.sourceUpdater_.removeAudio(0,this.duration_())}abort(){if(this.state!=="WAITING"){this.pendingSegment_&&(this.pendingSegment_=null),this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);return}this.abort_(),this.state="READY",this.paused()||this.monitorBuffer_()}abort_(){this.pendingSegment_&&this.pendingSegment_.abortRequests&&this.pendingSegment_.abortRequests(),this.pendingSegment_=null,this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_),this.waitingOnRemove_=!1,D.clearTimeout(this.quotaExceededErrorRetryTimeout_),this.quotaExceededErrorRetryTimeout_=null}checkForAbort_(e){return this.state==="APPENDING"&&!this.pendingSegment_?(this.state="READY",!0):!this.pendingSegment_||this.pendingSegment_.requestId!==e}error(e){return typeof e<"u"&&(this.logger_("error occurred:",e),this.error_=e),this.pendingSegment_=null,this.error_}endOfStream(){this.ended_=!0,this.transmuxer_&&Ya.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ze();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=of(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: ${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_=Ev(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),Av)}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=wv(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
- For TargetTime: ${T}.
190
+ bufferedEnd: ${Xa(this.buffered_())}
191
+ `,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const u=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!u.parts||!u.parts.length||!u.parts[this.partIndex])){const l=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=l}}r&&(r.mediaIndex-=a,r.mediaIndex<0?(r.mediaIndex=null,r.partIndex=null):(r.mediaIndex>=0&&(r.segment=e.segments[r.mediaIndex]),r.partIndex>=0&&r.segment.parts&&(r.part=r.segment.parts[r.partIndex]))),this.syncController_.saveExpiredSegmentInfo(i,e)}pause(){this.checkBufferTimeout_&&(D.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=null)}paused(){return this.checkBufferTimeout_===null}resetEverything(e){this.ended_=!1,this.activeInitSegmentId_=null,this.appendInitSegment_={audio:!0,video:!0},this.resetLoader(),this.remove(0,1/0,e),this.transmuxer_&&(this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),this.transmuxer_.postMessage({action:"reset"}))}resetLoader(){this.fetchAtBuffer_=!1,this.mediaSequenceSync_&&this.mediaSequenceSync_.resetAppendedStatus(),this.resyncLoader()}resyncLoader(){this.transmuxer_&&Ya.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},r=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let n=1;const a=()=>{n--,n===0&&i()};(r||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=Hv(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const u in this.inbandTextTracks_)lr(e,t,this.inbandTextTracks_[u]);lr(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=Xa(e)||0,i=lu(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=Gv(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,I;const y=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
192
+ For TargetTime: ${y}.
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=Tt.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=xv(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),w}timestampOffsetForSegment_(e){return Iv(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=Tt.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=Jy(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const u=dv({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<=Jt&&(m=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||f<m)&&(this.bandwidth=u.playlist.attributes.BANDWIDTH*et.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||{},Cv(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_():xi(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_():xi(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}`),pv(m,this.vhs_.tech_,a),or(u,l,m[a]),mv({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_()){xi(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===Xh){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=fv({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_()){xi(this),this.loadQueue_.push(()=>{const t=Xe({},e,{forceTimestampOffset:!0});Xe(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
- ${vf(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=uv({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=kv(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===ei.ABORTED)return;if(this.pause(),e.code===ei.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_=Sv(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=Dv(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=Rv(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 bf=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Nv=["video","audio"],Ao=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},Mv=(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=Mv(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}}},xf=(s,e)=>{const t=e[`${s}Buffer`],i=bf(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Yt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,St={appendBuffer:(s,e,t)=>(i,r)=>{const n=r[`${i}Buffer`];if(Yt(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===Xh?"(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(Yt(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`];Yt(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(Yt(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=bf(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(xf(s,e),!!Yt(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(!Yt(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)}}},Et=({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=Ky(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 Sf extends $.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>gs("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Nt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=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){Et({type:"mediaSource",sourceUpdater:this,action:St.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){Et({type:e,sourceUpdater:this,action:St.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){$.log.error("removeSourceBuffer is not supported!");return}Et({type:"mediaSource",sourceUpdater:this,action:St.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}Et({type:e,sourceUpdater:this,action:St.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(Et({type:r,sourceUpdater:this,action:St.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 Yt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:it()}videoBuffered(){return Yt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:it()}buffered(){const e=Yt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Yt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Qy(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ui){Et({type:"mediaSource",sourceUpdater:this,action:St.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ui){typeof e!="string"&&(e=void 0),Et({type:"mediaSource",sourceUpdater:this,action:St.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=ui){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}Et({type:"audio",sourceUpdater:this,action:St.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=ui){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}Et({type:"video",sourceUpdater:this,action:St.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&&(Et({type:"audio",sourceUpdater:this,action:St.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(Et({type:"video",sourceUpdater:this,action:St.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&Et({type:"audio",sourceUpdater:this,action:St.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&Et({type:"video",sourceUpdater:this,action:St.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Nv.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>xf(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))),Bv=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},kc=new Uint8Array(`
196
+ `,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const P=this.getSyncInfoFromMediaSequenceSync_(y);if(!P){const N="No sync info found while using media sequence sync";return this.error({message:N,metadata:{errorType:$.Error.StreamingFailedToSelectNextSegment,error:new Error(N)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${P.start} --> ${P.end})`),w=P.segmentIndex,x=P.partIndex,I=P.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const P=pt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:y,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});w=P.segmentIndex,x=P.partIndex,I=P.startTime}u.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${y}`:`currentTime ${y}`,u.mediaIndex=w,u.startOfSegment=I,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 I=Xa(this.sourceUpdater_.audioBuffered());return typeof I=="number"&&(w.audioAppendStart=I-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(w.gopsToAlignWith=$v(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),w}timestampOffsetForSegment_(e){return Yv(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,r=this.pendingSegment_.duration,n=pt.estimateSegmentRequestTime(r,i,this.playlist_,e.bytesReceived),a=yT(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const u=Pv({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<=Xt&&(m=1),!(!u.playlist||u.playlist.uri===this.playlist_.uri||f<m)&&(this.bandwidth=u.playlist.attributes.BANDWIDTH*Qe.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${ss(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||{},zv(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=kc(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}`),Rv(m,this.vhs_.tech_,a),lr(u,l,m[a]),Nv({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[kc(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<=nr&&m-f<=nr){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_()-nr;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 ${nr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=D.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},nr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},r){if(r){if(r.code===Jh){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=Ov({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=He({},e,{forceTimestampOffset:!0});He(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
+ ${Ef(e.uri)}
198
+ ${ss(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Dv({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_(`${ss(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=Kv(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<ln){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${ln}`);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===Yt.ABORTED)return;if(this.pause(),e.code===Yt.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_=Vv(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=Xv(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=eb(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 ${ss(e)}`);return}this.logger_(`Appended ${ss(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"} ${ss(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<ln){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${ln}`);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(!Dc(i)||!Dc(r))return;lr(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 ai(){}const Cf=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},tb=["video","audio"],Do=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},ib=(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},_s=(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(),_s("audio",e),_s("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Do(s,e))){if(i.type!==s){if(t=ib(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,_s(s,e);return}}},wf=(s,e)=>{const t=e[`${s}Buffer`],i=Cf(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Gt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Tt={appendBuffer:(s,e,t)=>(i,r)=>{const n=r[`${i}Buffer`];if(Gt(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===Jh?"(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(Gt(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`];Gt(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(Gt(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=Cf(s),r=ys(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(wf(s,e),!!Gt(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=ys(s);if(!Gt(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)}}},vt=({type:s,sourceUpdater:e,action:t,doneFn:i,name:r})=>{e.queue.push({type:s,action:t,doneFn:i,name:r}),_s(s,e)},Pc=(s,e)=>t=>{const i=e[`${s}Buffered`](),r=mT(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_`])}_s(s,e)};class Af extends $.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>_s("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Ot("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Pc("video",this),this.onAudioUpdateEnd_=Pc("audio",this),this.onVideoError_=t=>{this.videoError_=t},this.onAudioError_=t=>{this.audioError_=t},this.createdSourceBuffers_=!1,this.initializedEme_=!1,this.triggeredReady_=!1}initializedEme(){this.initializedEme_=!0,this.triggerReady()}hasCreatedSourceBuffers(){return this.createdSourceBuffers_}hasInitializedAnyEme(){return this.initializedEme_}ready(){return this.hasCreatedSourceBuffers()&&this.hasInitializedAnyEme()}createSourceBuffers(e){this.hasCreatedSourceBuffers()||(this.addOrChangeSourceBuffers(e),this.createdSourceBuffers_=!0,this.trigger("createdsourcebuffers"),this.triggerReady())}triggerReady(){this.ready()&&!this.triggeredReady_&&(this.triggeredReady_=!0,this.trigger("ready"))}addSourceBuffer(e,t){vt({type:"mediaSource",sourceUpdater:this,action:Tt.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){vt({type:e,sourceUpdater:this,action:Tt.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){$.log.error("removeSourceBuffer is not supported!");return}vt({type:"mediaSource",sourceUpdater:this,action:Tt.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}vt({type:e,sourceUpdater:this,action:Tt.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:r,bytes:n}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${n.length} until video append`);return}const a=t;if(vt({type:r,sourceUpdater:this,action:Tt.appendBuffer(n,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const u=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${u.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,u.forEach(l=>{this.appendBuffer.apply(this,l)})}}audioBuffered(){return Gt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Ze()}videoBuffered(){return Gt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Ze()}buffered(){const e=Gt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Gt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():_T(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ai){vt({type:"mediaSource",sourceUpdater:this,action:Tt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ai){typeof e!="string"&&(e=void 0),vt({type:"mediaSource",sourceUpdater:this,action:Tt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=ai){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}vt({type:"audio",sourceUpdater:this,action:Tt.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=ai){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}vt({type:"video",sourceUpdater:this,action:Tt.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(Do("audio",this)||Do("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(vt({type:"audio",sourceUpdater:this,action:Tt.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(vt({type:"video",sourceUpdater:this,action:Tt.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&vt({type:"audio",sourceUpdater:this,action:Tt.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&vt({type:"video",sourceUpdater:this,action:Tt.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),tb.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>wf(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Lc=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),sb=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Oc=new Uint8Array(`
199
199
 
200
- `.split("").map(s=>s.charCodeAt(0)));class Fv extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Uv 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 it();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return it([[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===ei.TIMEOUT&&this.handleTimeout_(),e.code===ei.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)}),bv(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 Fv;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 jv=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},qv=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=jv(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 $v{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 Ef{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,q=!!(m&&m.partsSyncInfo&&m.partsSyncInfo[N]&&m.partsSyncInfo[N].isAppended),j=new Ic({start:O,end:F,appended:q,segmentIndex:f,partIndex:N});return T=F,n+=`Media Sequence: ${u}.${N} | Range: ${O} --> ${F} | Appended: ${q}
202
- `,M.syncInfo=j,j});r.set(u,new $v(P,I)),n+=`${vf(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 Ef{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 Vv=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 Hv extends $.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Ef,i=new Pc(t),r=new Pc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=Nt("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>Vv){$.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 Gv=lf(cf(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,q=0;q<F;++q)O[q].call(this,arguments[1]);else for(var j=Array.prototype.slice.call(arguments,1),R=O.length,G=0;G<R;++G)O[G].apply(this,j)},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,q,j;const R=[],G=[];let v,E,V,H,U,K;for(F=0;F<256;F++)G[(R[F]=F<<1^(F>>7)*283)^F]=F;for(q=j=0;!N[q];q^=v||1,j=G[j]||1)for(H=j^j<<1^j<<2^j<<3^j<<4,H=H>>8^H&255^99,N[q]=H,O[H]=q,V=R[E=R[v=R[q]]],K=V*16843009^E*65537^v*257^q*16843008,U=R[H]*257^H*16843008,F=0;F<4;F++)I[F][q]=U=U<<24^U>>>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],q=this._tables[1],j=I.length;let R=1;if(j!==4&&j!==6&&j!==8)throw new Error("Invalid aes key size");const G=I.slice(0),v=[];for(this._key=[G,v],M=j;M<4*j+28;M++)O=G[M-1],(M%j===0||j===8&&M%j===4)&&(O=F[O>>>24]<<24^F[O>>16&255]<<16^F[O>>8&255]<<8^F[O&255],M%j===0&&(O=O<<8^O>>>24^R<<24,R=R<<1^(R>>7)*283)),G[M]=G[M-j]^O;for(N=0;M;N++,M--)O=G[N&3?M:M-4],M<=4||N<4?v[N]=O:v[N]=q[0][F[O>>>24]]^q[1][F[O>>16&255]]^q[2][F[O>>8&255]]^q[3][F[O&255]]}decrypt(I,M,N,O,F,q){const j=this._key[1];let R=I^j[0],G=O^j[1],v=N^j[2],E=M^j[3],V,H,U;const K=j.length/4-2;let ee,se=4;const W=this._tables[1],Z=W[0],te=W[1],ie=W[2],re=W[3],ge=W[4];for(ee=0;ee<K;ee++)V=Z[R>>>24]^te[G>>16&255]^ie[v>>8&255]^re[E&255]^j[se],H=Z[G>>>24]^te[v>>16&255]^ie[E>>8&255]^re[R&255]^j[se+1],U=Z[v>>>24]^te[E>>16&255]^ie[R>>8&255]^re[G&255]^j[se+2],E=Z[E>>>24]^te[R>>16&255]^ie[G>>8&255]^re[v&255]^j[se+3],se+=4,R=V,G=H,v=U;for(ee=0;ee<4;ee++)F[(3&-ee)+q]=ge[R>>>24]<<24^ge[G>>16&255]<<16^ge[v>>8&255]<<8^ge[E&255]^j[se++],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),q=new Int32Array(F.buffer);let j,R,G,v,E,V,H,U,K;for(j=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]),U=a(N[K+3]),O.decrypt(E,V,H,U,q,K),q[K]=a(q[K]^j),q[K+1]=a(q[K+1]^R),q[K+2]=a(q[K+2]^G),q[K+3]=a(q[K+3]^v),j=E,R=V,G=H,v=U;return F};class l{constructor(I,M,N,O){const F=l.STEP,q=new Int32Array(I.buffer),j=new Uint8Array(I.byteLength);let R=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(q.subarray(R,R+F),M,N,j)),R=F;R<q.length;R+=F)N=new Uint32Array([a(q[R-4]),a(q[R-3]),a(q[R-2]),a(q[R-1])]),this.asyncStream_.push(this.decryptChunk_(q.subarray(R,R+F),M,N,j));this.asyncStream_.push(function(){O(null,e(j))})}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,q){self.postMessage(P({source:I.source,decrypted:q}),[q.buffer])})}}));var Wv=uf(Gv);const Xv=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Cf=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Do=(s,e)=>{e.activePlaylistLoader=s,s.load()},Kv=(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,Cf(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),Do(a.playlistLoader,r)}},Yv=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Qv=(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,Cf(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))}},Jv={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:Xv(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]=_}}}}},wf=(s,e)=>{for(let t=0;t<s.length;t++)if(du(e,s[t])||s[t].playlists&&wf(s[t].playlists,e))return!0;return!1},Zv=(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(wf(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},e2={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}},t2=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},i2=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{Jv[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=Zv(f,s),e[f].activeTrack=e2[f](f,s),e[f].onGroupChanged=Kv(f,s),e[f].onGroupChanging=Yv(f,s),e[f].onTrackChanged=Qv(f,s),e[f].getActiveGroup=t2(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])},s2=()=>{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_:Nt(`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_=yt(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 r2 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_=Nt("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=yt(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&&(yt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const n2=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},a2=10;let Si;const o2=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],u2=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},l2=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?et.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:et.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 c2 extends $.EventTarget{constructor(e){super(),this.fastQualityChange_=n2(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),Si=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_=s2(),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_=it(),this.hasPlayed_=!1,this.syncController_=new Hv(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new Wv,this.sourceUpdater_=new Sf(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 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 Uv(De(M,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,q)=>{function j(){r.off("vttjserror",R),F()}function R(){r.off("vttjsloaded",j),q()}r.one("vttjsloaded",j),r.one("vttjserror",R),r.addWebVttScript_()})}),e);const N=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new r2(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_())),o2.forEach(F=>{this[F+"_"]=u2.bind(this,F)}),this.logger_=Nt("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const 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()),i2({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(Xe({},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"}),Si.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 l2({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:a2}))});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(Xe({},r))}),this.audioSegmentLoader_.on(i,r=>{this.player_.trigger(Xe({},r))}),this.subtitleSegmentLoader_.on(i,r=>{this.player_.trigger(Xe({},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=Si.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return r-n<=Zt;const u=a.end(a.length-1);return u-n<=Zt&&r-u<=Zt}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:Si.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=Si.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),m=Math.max(u,l-f);return it([[u,m]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=Si.Playlist.seekable(i,n,Si.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:it([[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 [${Nh(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=Si.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||Jg),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 _=(Kt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,w=(Kt(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(Kt(e)),n=mc(r),a=r.video&&Kt(r.video)[0]||null,u=r.audio&&Kt(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&&Kt(_.video)[0]||null,P=_.audio&&Kt(_.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)),qv(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=et.GOAL_BUFFER_LENGTH,i=et.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,et.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=et.BUFFER_LOW_WATER_LINE,i=et.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,et.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,et.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return et.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Sc(this.inbandTextTracks_,"com.apple.streaming",this.tech_),vv({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_),_v({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(Xe({},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:Bv(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 d2=(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 h2{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=d2(e.playlists,t.id,n)}}const f2=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 h2(s,i,i.id)):[]}},Rc=["seeking","seeked","pause","playing","error"];class p2 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_=Nt("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=Zy(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+Zt>=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(it([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:Zt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Nh(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-Jt)*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)+Zt,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)+Zt;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)+Jt);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=Yy(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 m2={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},Af=function(s,e){let t=0,i=0;const r=De(m2,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(),Af(s,m)};s.on("error",u),s.on("dispose",l),s.reloadSourceOnError=f},g2=function(s){Af(this,s)};var Df="3.17.2",_2="7.1.0",y2="1.3.1",T2="7.2.0",v2="4.0.2";const qe={PlaylistLoader:os,Playlist:Tt,utils:CT,STANDARD_PLAYLIST_SELECTOR:xc,INITIAL_PLAYLIST_SELECTOR:hv,lastBandwidthSelector:xc,movingAverageBandwidthSelector:cv,comparePlaylistBandwidth:fu,comparePlaylistResolution:lv,xhr:ef()};Object.keys(et).forEach(s=>{Object.defineProperty(qe,s,{get(){return $.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),et[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}et[s]=e}})});const kf="videojs-vhs",If=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"})},b2=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),If(s,e.playlists)};qe.canPlaySource=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const x2=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Tr(Kt(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)},S2=(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},[]),E2=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?i.concat([t]):i,n=S2(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)])},C2=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const r=x2(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},Pf=()=>{if(!D.localStorage)return null;const s=D.localStorage.getItem(kf);if(!s)return null;try{return JSON.parse(s)}catch{return null}},w2=s=>{if(!D.localStorage)return!1;let e=Pf();e=e?De(e,s):s;try{D.localStorage.setItem(kf,JSON.stringify(e))}catch{return!1}return e},A2=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,Lf=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Of=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Rf=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Nf=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};qe.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})();qe.supportsNativeDash=(function(){return!ne||!ne.createElement||!$.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(ne.createElement("video").canPlayType("application/dash+xml"))})();qe.supportsTypeNatively=s=>s==="hls"?qe.supportsNativeHls:s==="dash"?qe.supportsNativeDash:!1;qe.isSupported=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};qe.xhr.onRequest=function(s){Lf(qe.xhr,s)};qe.xhr.onResponse=function(s){Of(qe.xhr,s)};qe.xhr.offRequest=function(s){Rf(qe.xhr,s)};qe.xhr.offResponse=function(s){Nf(qe.xhr,s)};const D2=$.getComponent("Component");class Mf extends D2{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Nt("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=Pf();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=et.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===et.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=A2(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=qe,this.options_.sourceType=id(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new c2(this.options_);const i=De({liveRangeSafeTimeDelta:Zt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new p2(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?qe.movingAverageBandwidthSelector(.55):qe.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=qe.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&&w2({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{f2(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"),E2({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=C2({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",()=>{b2(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{If(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Df,"mux.js":_2,"mpd-parser":y2,"m3u8-parser":T2,"aes-decrypter":v2}}version(){return this.constructor.version()}canChangeType(){return Sf.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 LT({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,r=2){return af({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=>{Lf(this.xhr,e)},this.xhr.onResponse=e=>{Of(this.xhr,e)},this.xhr.offRequest=e=>{Rf(this.xhr,e)},this.xhr.offResponse=e=>{Nf(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(Xe({},r))})}),t.forEach(i=>{this.playbackWatcher_.on(i,r=>{this.player_.trigger(Xe({},r))})})}}const Rn={name:"videojs-http-streaming",VERSION:Df,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 Mf(s,e,i),e.vhs.xhr=ef(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=id(s);if(!t)return"";const i=Rn.getOverrideNative(e);return!qe.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!($.browser.IS_ANY_SAFARI||$.browser.IS_IOS),{overrideNative:i=t}=e;return i}},k2=()=>ur("avc1.4d400d,mp4a.40.2",!0);k2()&&$.getTech("Html5").registerSourceHandler(Rn,0);$.VhsHandler=Mf;$.VhsSourceHandler=Rn;$.Vhs=qe;$.use||$.registerComponent("Vhs",qe);$.options.vhs=$.options.vhs||{};(!$.getPlugin||!$.getPlugin("reloadSourceOnError"))&&$.registerPlugin("reloadSourceOnError",g2);function I2(){if(typeof navigator>"u")return!1;const s=navigator.userAgent;return/^((?!chrome|android|crios|fxios).)*safari/i.test(s)}function P2(){return typeof navigator>"u"?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function Nc(s){if(/\.mkv(\?|$)/i.test(s)&&(I2()||P2())){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 L2({src:s,poster:e,subtitles:t,onReady:i}){const r=oe.useRef(null),n=oe.useRef(null),a=oe.useRef(i),u=oe.useRef(s),l=oe.useRef(e);oe.useEffect(()=>{a.current=i},[i]),oe.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}},[]),oe.useEffect(()=>{const m=n.current;m&&s!==u.current&&m.src(Nc(s))},[s]),oe.useEffect(()=>{const m=n.current;!m||e===void 0||e!==l.current&&m.poster(e)},[e]),oe.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 O2(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 R2(s){return/^https?:\/\//i.test(s)?s:`${window.location.origin}${s}`}function N2({episodeId:s,movieId:e,player:t,streamUrl:i,title:r}){const[n,a]=oe.useState({airplayAvailable:!1,chromecastAvailable:!1}),[u,l]=oe.useState(!1),f=oe.useRef(null),m=oe.useRef(null);oe.useEffect(()=>{const T=typeof document.querySelector("video")?.webkitShowPlaybackTargetPicker=="function";a(I=>({...I,airplayAvailable:T}))},[t]),oe.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(),q=new O.RemotePlayer,j=new O.RemotePlayerController(q);f.current=q,m.current=j;const R=()=>{l(q.isConnected),t&&!q.isConnected&&q.currentTime>0&&(t.currentTime(q.currentTime),t.play())},G=()=>{if(!q.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:q.currentTime,duration:q.duration})}).catch(()=>{})};j.addEventListener(O.RemotePlayerEventType.IS_CONNECTED_CHANGED,R),j.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=R2(i),q=new I.cast.media.MediaInfo(F,"video/mp4");q.metadata={title:r};const j=new I.cast.media.LoadRequest(q);j.currentTime=O,await N.loadMedia(j),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(Wm,{className:`size-7 hover:scale-125 ${u?"text-blue-400":"text-white"}`})})}function M2({buffered:s,progress:e,onSeek:t}){const i=oe.useRef(null),r=oe.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 Bf="jukebox-volume";function B2(){try{const s=localStorage.getItem(Bf);if(s)return JSON.parse(s)}catch{}return{volume:1,muted:!1}}function F2(s,e){try{localStorage.setItem(Bf,JSON.stringify({volume:s,muted:e}))}catch{}}function U2({player:s}){const[e,t]=oe.useState(1),[i,r]=oe.useState(!1),n=oe.useRef(null);oe.useEffect(()=>{if(!s||s.isDisposed())return;const m=B2();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),F2(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(Vc,{className:"size-7 text-white"}):e<.33?J.jsx(Hc,{className:"size-7 text-white"}):e<.66?J.jsx(qc,{className:"size-7 text-white"}):J.jsx($c,{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,j2=1e4;function q2({title:s,player:e,movieId:t,episodeId:i,onFullscreen:r,onNextEpisode:n,onToggleEpisodes:a,showEpisodesButton:u,streamUrl:l,subtitles:f}){const[m,_]=oe.useState(!1),[w,x]=oe.useState(0),[P,T]=oe.useState(0),[I,M]=oe.useState(0),[N,O]=oe.useState(pr),F=oe.useRef(0);oe.useEffect(()=>{O(pr)},[f]),oe.useEffect(()=>{if(!e||e.isDisposed())return;const U=e.remoteTextTrackEls();if(!U||U.length===0)return;const K=()=>{pn.error("Subtitle failed to load. Pick another track."),O(pr)},ee=[];for(let se=0;se<U.length;se++){const W=U[se];W&&(W.addEventListener("error",K),ee.push(W))}return()=>{for(const se of ee)se.removeEventListener("error",K)}},[e,f]);const q=(f??[]).filter(U=>U.isSupported),j=(f??[]).filter(U=>!U.isSupported),R=q.length>0||j.length>0,G=U=>{if(O(U),!e||e.isDisposed())return;const K=e.textTracks();if(!K)return;const ee=q.find(se=>String(se.id)===U);for(let se=0;se<K.length;se++){const W=K[se];!W||W.kind!=="subtitles"||(ee&&W.language===ee.language?W.mode="showing":W.mode="disabled")}};oe.useEffect(()=>{if(!e||e.isDisposed())return;const U=()=>_(!0),K=()=>_(!1),ee=()=>{const W=e.currentTime()??0,Z=e.duration()??0;Z>0&&(x(W/Z),M(Z-W))},se=()=>{const W=e.buffered(),Z=e.duration()??0;if(W&&W.length>0&&Z>0){const te=W.end(W.length-1);T(te/Z)}};return e.on("play",U),e.on("pause",K),e.on("timeupdate",ee),e.on("progress",se),_(!e.paused()),()=>{e.isDisposed()||(e.off("play",U),e.off("pause",K),e.off("timeupdate",ee),e.off("progress",se))}},[e]),oe.useEffect(()=>{if(!e)return;const U=async()=>{if(e.isDisposed())return;const ee=e.currentTime()??0,se=e.duration()??0;if(ee===F.current)return;F.current=ee;const W=i?`/api/progress/episode/${i}`:`/api/progress/${t}`;await fetch(W,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:ee,duration:se})})},K=setInterval(()=>{U()},j2);return()=>{clearInterval(K),U()}},[e,t,i]);const v=()=>{e&&(e.paused()?e.play():e.pause())},E=()=>{if(!e)return;const U=e.currentTime()??0;e.currentTime(Math.max(0,U-Mc))},V=()=>{if(!e)return;const U=e.currentTime()??0,K=e.duration()??0;e.currentTime(Math.min(K,U+Mc))},H=U=>{if(!e)return;const K=e.duration()??0;e.currentTime(U*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(M2,{buffered:P,progress:w,onSeek:H})}),J.jsx("span",{className:"text-white text-xs font-mono whitespace-nowrap",children:O2(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(Zm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"}):J.jsx(Dm,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),J.jsx(ss,{"aria-label":"Skip backward 10 seconds",onClick:E,children:J.jsx(tg,{className:"size-7 hover:scale-125 text-white"})}),J.jsx(ss,{"aria-label":"Skip forward 10 seconds",onClick:V,children:J.jsx(sg,{className:"size-7 hover:scale-125 text-white"})}),J.jsx(U2,{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(N2,{episodeId:i,movieId:t,player:e,streamUrl:l,title:s}),R&&J.jsx($2,{activeSubtitleId:N,onSelect:G,supportedSubtitles:q,unsupportedSubtitles:j}),n&&J.jsx(ss,{"aria-label":"Next episode",onClick:n,children:J.jsx(ng,{className:"size-7 hover:scale-125 text-white",fill:"currentColor"})}),u&&a&&J.jsx(ss,{"aria-label":"Browse episodes",onClick:a,children:J.jsx(Km,{className:"size-7 hover:scale-125 text-white"})}),r&&J.jsx(ss,{"aria-label":"Toggle fullscreen",onClick:r,children:J.jsx(Qm,{className:"size-7 hover:scale-125 text-white"})})]})]})]})}function $2({activeSubtitleId:s,onSelect:e,supportedSubtitles:t,unsupportedSubtitles:i}){return J.jsxs(km,{children:[J.jsx(Im,{asChild:!0,children:J.jsx("button",{"aria-label":"Subtitles",className:"p-2 flex justify-center items-center cursor-pointer",type:"button",children:J.jsx(zm,{className:"size-7 hover:scale-125 text-white"})})}),J.jsx(Pm,{children:J.jsxs(Lm,{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:Om("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(jc,{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})}const Ff=.9;function Fc({currentEpisodeId:s,onClose:e,onSelectEpisode:t,onSelectSeason:i,progressMap:r,seasons:n,selectedSeason:a,showTitle:u}){const l=n.find(_=>_.seasonNumber===a),f=oe.useRef(null),m=oe.useRef(null);return oe.useEffect(()=>{const _=f.current,w=m.current;if(!_||!w)return;const x=_.getBoundingClientRect(),I=w.getBoundingClientRect().top-x.top+_.scrollTop-_.clientHeight/2+w.clientHeight/2,M=_.scrollHeight-_.clientHeight;_.scrollTop=Math.max(0,Math.min(I,M))},[a,s,l?.episodes.length]),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(Rm,{className:"size-5"})})]}),J.jsx("div",{className:"flex gap-1 px-4 py-3 border-b border-white/10 flex-wrap",children:n.map(_=>J.jsxs("button",{className:`px-3 min-h-11 rounded text-sm font-medium cursor-pointer transition-colors ${_.seasonNumber===a?"bg-white text-black":"text-white/60 hover:text-white hover:bg-white/10"}`,onClick:()=>i(_.seasonNumber),children:["Season ",_.seasonNumber]},_.seasonNumber))}),J.jsx("div",{className:"flex-1 overflow-y-auto slim-scrollbar",ref:f,children:l?.episodes.map(_=>{const w=_.id===s,x=r?.[_.id],P=x?.duration?Math.min(x.currentTime/x.duration*100,100):0,T=x?.duration?x.currentTime/x.duration>=Ff:!1,I=P>0&&!T;return J.jsxs("button",{ref:w?m:void 0,className:`w-full text-left px-4 py-3 border-l-2 transition-colors ${w?"bg-white/10 border-red-600":"border-transparent hover:bg-white/5"}`,onClick:()=>{t(_),e()},children:[J.jsxs("div",{className:"text-white/60 text-xs mb-1 flex items-center gap-1",children:[T&&J.jsx(jc,{className:"size-3"}),J.jsxs("span",{children:["E",_.episodeNumber,_.runtime!=null&&` · ${_.runtime}m`]})]}),J.jsx("div",{className:`text-sm leading-snug ${T?"text-white/70":"text-white"}`,children:_.title}),(T||I)&&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 ${T?"bg-white/40":"bg-red-600"}`,style:{width:`${T?100:P}%`}})})]},_.id)})})]})}const V2=9,H2=1e3;function z2({nextEpisode:s,show:e,onPlayNow:t,onCancel:i,countdownSeconds:r=V2,isCountingDown:n}){const a=oe.useRef(null),u=oe.useRef(!1),l=oe.useRef(t);oe.useEffect(()=>{l.current=t},[t]),oe.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+H2);return()=>{w.cancel(),clearTimeout(x)}},[n,r]);const f=oe.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(Nm,{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 G2({muted:s,visible:e,volume:t}){const i=()=>s||t===0?J.jsx(Vc,{className:"size-6 text-white"}):t<.33?J.jsx(Hc,{className:"size-6 text-white"}):t<.66?J.jsx(qc,{className:"size-6 text-white"}):J.jsx($c,{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 W2(s){return oe.useSyncExternalStore(e=>{const t=window.matchMedia(s);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia(s).matches,()=>!1)}async function X2(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 K2(s,e,t={}){const i=(t.enabled??!0)&&!!s&&!!e;return rs({queryKey:["next-episode",s,e],queryFn:()=>X2(s??0,e??0),enabled:i,retry:!1})}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}=Mm(),e=Bm(),t=Fm(),i=e.pathname.startsWith("/watch/episode/"),[r,n]=oe.useState(!0),[a,u]=oe.useState(!1),[l,f]=oe.useState(null),[m,_]=oe.useState(!1),w=W2("(max-width: 639px)"),[x,P]=oe.useState(1),[T,I]=oe.useState(!1),[M,N]=oe.useState(!1),[O,F]=oe.useState(!1),[q,j]=oe.useState(!1),[R,G]=oe.useState(null),[v,E]=oe.useState(0),V=oe.useRef(!1),H=oe.useRef(null),U=oe.useRef(null),K=oe.useRef(null),ee=oe.useRef(null),se=oe.useCallback(ce=>{if(ee.current?.disconnect(),!ce){ee.current=null;return}E(ce.offsetHeight);const _e=new ResizeObserver(Je=>{const ct=Je[0];ct&&E(ct.contentRect.height)});_e.observe(ce),ee.current=_e},[]),W=oe.useCallback(()=>{document.fullscreenElement?document.exitFullscreen():K.current?.requestFullscreen()},[]),Z=oe.useCallback(()=>{n(!0),H.current&&clearTimeout(H.current),a&&(H.current=setTimeout(()=>{n(!1)},ib))},[a]),te=oe.useCallback((ce,_e)=>{G({volume:ce,muted:_e}),U.current&&clearTimeout(U.current),U.current=setTimeout(()=>{G(null)},1200)},[]);oe.useEffect(()=>{if(!l||l.isDisposed())return;const ce=()=>u(!0),_e=()=>u(!1);return l.on("play",ce),l.on("pause",_e),u(!l.paused()),()=>{l.isDisposed()||(l.off("play",ce),l.off("pause",_e))}},[l]),oe.useEffect(()=>{if(!l||l.isDisposed())return;const ce=()=>{l.isDisposed()||te(l.volume()??1,l.muted()??!1)};return l.on("volumechange",ce),()=>{l.isDisposed()||l.off("volumechange",ce)}},[l,te]),oe.useEffect(()=>()=>{U.current&&clearTimeout(U.current)},[]),oe.useEffect(()=>(a?Z():(n(!0),H.current&&clearTimeout(H.current)),()=>{H.current&&clearTimeout(H.current)}),[a,Z]),Zi("*",()=>Z()),Zi("space",ce=>{ce.preventDefault(),l&&(l.paused()?l.play():l.pause())},[l]),Zi("left",()=>{if(!l)return;const ce=l.currentTime()??0;l.currentTime(Math.max(0,ce-10))},[l]),Zi("right",()=>{if(!l)return;const ce=l.currentTime()??0,_e=l.duration()??0;l.currentTime(Math.min(_e,ce+10))},[l]),Zi("up",ce=>{if(ce.preventDefault(),!l||l.isDisposed())return;const _e=l.volume()??1,Je=Math.min(1,_e+.05);l.muted()&&l.muted(!1),l.volume(Je)},[l]),Zi("down",ce=>{if(ce.preventDefault(),!l||l.isDisposed())return;const _e=l.volume()??1,Je=Math.max(0,_e-.05);l.volume(Je)},[l]);const{data:ie,isLoading:re,error:ge}=rs({queryKey:["movie",s],queryFn:()=>Y2(s??""),enabled:!!s&&!i,placeholderData:rl}),{data:ye,isLoading:ve,error:fe}=rs({queryKey:["episode",s],queryFn:()=>J2(s??""),enabled:!!s&&i,placeholderData:rl}),Se=ye?.episode,ke=ye?.show,{data:Le}=rs({queryKey:["show-for-episode",ke?.id],queryFn:()=>Z2(ke?.id??0),enabled:!!ke}),{data:Qe}=rs({queryKey:["show-progress",ke?.id],queryFn:()=>tb(ke?.id??0),enabled:!!ke}),{data:st}=rs({queryKey:["progress",i?"episode":"movie",i?Se?.id:ie?.id],queryFn:()=>i?eb(Se?.id??0):Q2(ie?.id??0),enabled:i?!!Se:!!ie});oe.useEffect(()=>{Se&&P(Se.seasonNumber)},[Se]),oe.useEffect(()=>{if(!l||!st||st.currentTime<=0||V.current)return;V.current=!0;const{currentTime:ce,duration:_e}=st;_e!==null&&_e>0&&ce/_e>=Ff||l.currentTime(ce)},[l,st]);const{data:Ke}=K2(ke?.id,Se?.id,{enabled:i}),Oe=Ke?.episode??null,Mt=Ke?.show??null;oe.useEffect(()=>{I(!1),N(!1),F(!1),V.current=!1},[Se?.id]),oe.useEffect(()=>{if(!l||l.isDisposed())return;const ce=()=>j(!1);return l.on("playing",ce),()=>{l.isDisposed()||l.off("playing",ce)}},[l]);const ze=oe.useCallback(()=>{Oe&&(j(!0),t(`/watch/episode/${Oe.id}`))},[Oe,t]);oe.useEffect(()=>{if(!l||l.isDisposed()||!i)return;const ce=()=>{const Je=l.currentTime()??0,ct=l.duration()??0;if(ct<=0)return;ct-Je<=sb&&!T&&Oe&&(N(!0),F(!0))},_e=()=>{if(!Oe){pn("You've finished all episodes."),ke&&t(`/shows/${ke.id}`);return}T||(N(!0),F(!0))};return l.on("timeupdate",ce),l.on("ended",_e),()=>{l.isDisposed()||(l.off("timeupdate",ce),l.off("ended",_e))}},[l,i,Oe,T,ke,t]);const Bt=oe.useCallback(ce=>{if(ce.id!==Se?.id){if(l&&Se){const _e=l.currentTime()??0,Je=l.duration()??0;fetch(`/api/progress/episode/${Se.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({currentTime:_e,duration:Je})})}j(!0),t(`/watch/episode/${ce.id}`)}},[l,Se,t]),Ge=i?ve:re,hi=i?fe:ge;if(Ge)return J.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:J.jsx(Um,{className:"h-8 w-8 animate-spin text-white"})});if(hi||(i?!Se:!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 nt=i?`/api/stream/episode/${Se?.id}`:`/api/stream/${ie?.id}`,gt=i&&Se&&ke?`${ke.title} — S${Se.seasonNumber} E${Se.episodeNumber} · ${Se.title}`:ie?.title??"",be=i?ye?.subtitles??[]:ie?.subtitles??[];return J.jsxs("div",{ref:K,className:`bg-black w-full h-screen relative ${r?"":"cursor-none"}`,onMouseMove:Z,children:[J.jsx("div",{className:"absolute inset-0",children:J.jsx(L2,{src:nt,subtitles:be,onReady:f})}),J.jsx("div",{"aria-hidden":"true",className:`absolute inset-0 z-40 bg-black pointer-events-none transition-opacity duration-300 ${q?"opacity-100":"opacity-0"}`}),J.jsx(G2,{muted:R?.muted??!1,visible:R!==null,volume:R?.volume??0}),i&&M&&Oe&&J.jsx("video",{"aria-hidden":"true",className:"hidden",preload:"auto",src:`/api/stream/episode/${Oe.id}`}),i&&M&&Oe&&Mt&&J.jsx(z2,{isCountingDown:O,nextEpisode:Oe,onCancel:()=>{I(!0),N(!1),F(!1)},onPlayNow:ze,show:Mt}),i&&Le&&Se&&J.jsxs(J.Fragment,{children:[J.jsx("div",{className:`hidden sm:block absolute top-0 right-0 w-96 z-20 ${m?"":"pointer-events-none opacity-0"} transition-opacity duration-200`,style:{bottom:v},children:m&&J.jsx(Fc,{currentEpisodeId:Se.id,onClose:()=>_(!1),onSelectEpisode:Bt,onSelectSeason:P,progressMap:Qe,seasons:Le.seasons,selectedSeason:x,showTitle:Le.title})}),w&&J.jsx(jm,{onOpenChange:_,open:m,children:J.jsxs(qm,{className:"p-0 bg-black/95 border-white/10",hideCloseButton:!0,side:"bottom",style:{height:`calc(85vh - ${v}px)`,bottom:v},children:[J.jsxs($m,{className:"sr-only",children:[Le.title," episodes"]}),J.jsx(Fc,{currentEpisodeId:Se.id,onClose:()=>_(!1),onSelectEpisode:Bt,onSelectSeason:P,progressMap:Qe,seasons:Le.seasons,selectedSeason:x,showTitle:Le.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(Vm,{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"}`,ref:se,children:J.jsx(q2,{title:gt,player:l,movieId:i?void 0:ie?.id,episodeId:i?Se?.id:void 0,showEpisodesButton:i,streamUrl:nt,subtitles:be,onFullscreen:W,onNextEpisode:i&&Oe?ze:void 0,onToggleEpisodes:()=>_(ce=>!ce)})})]})}export{ob as WatchPage};
200
+ `.split("").map(s=>s.charCodeAt(0)));class rb extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class nb extends Ao{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 Ze();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return Ze([[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=Oc.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(Oc,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){lr(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===Yt.TIMEOUT&&this.handleTimeout_(),e.code===Yt.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)}),qv(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 rb;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=Lc(a)),r.parse(a)}let n=e.bytes;i&&(n=Lc(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 ab=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},ob=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=ab(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 Rc{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 ub{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 Df{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),I=new Rc({start:_,end:w,appended:x,segmentIndex:f});l.syncInfo=I;let y=a;const P=(l.parts||[]).map((N,M)=>{const L=y,B=y+N.duration,U=!!(m&&m.partsSyncInfo&&m.partsSyncInfo[M]&&m.partsSyncInfo[M].isAppended),j=new Rc({start:L,end:B,appended:U,segmentIndex:f,partIndex:M});return y=B,n+=`Media Sequence: ${u}.${M} | Range: ${L} --> ${B} | Appended: ${U}
202
+ `,N.syncInfo=j,j});r.set(u,new ub(I,P)),n+=`${Ef(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 Nc extends Df{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 lb=86400,Qa=[{name:"VOD",run:(s,e,t,i,r)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,r,n)=>{const a=s.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const u=a.getSyncInfoForTime(r);return u?{time:u.start,partIndex:u.partIndex,segmentIndex:u.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,r)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let n=null,a=null;const u=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 I=_.dateTimeObject.getTime()/1e3+w;if(_.parts&&typeof m.partIndex=="number")for(let P=0;P<m.partIndex;P++)I+=_.parts[P].duration;const y=Math.abs(r-I);if(a!==null&&(y===0||a<y))break;a=y,n={time:I,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 cb extends $.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Df,i=new Nc(t),r=new Nc(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:r},this.logger_=Ot("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,r,n){if(t!==1/0)return Qa.find(({name:l})=>l==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,r,n);if(!a.length)return null;for(const u of a){const{syncPoint:l,strategy:f}=u,{segmentIndex:m,time:_}=l;if(m<0)continue;const w=e.segments[m],x=_,I=x+w.duration;if(this.logger_(`Strategy: ${f}. Current time: ${r}. selected segment: ${m}. Time: [${x} -> ${I}]}`),r>=x&&r<I)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+pr({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,r,n){const a=[];for(let u=0;u<Qa.length;u++){const l=Qa[u],f=l.run(this,e,t,i,r,n);f&&(f.strategy=l.name,a.push({strategy:l.name,syncPoint:f}))}return a}selectSyncPoint_(e,t){let i=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy;for(let a=1;a<e.length;a++){const u=Math.abs(e[a].syncPoint[t.key]-t.value);u<r&&(r=u,i=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>lb){$.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-pr({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):f=i.end+pr({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 db 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 hb=ff(pf(function(){var s=(function(){function y(){this.listeners={}}var P=y.prototype;return P.on=function(M,L){this.listeners[M]||(this.listeners[M]=[]),this.listeners[M].push(L)},P.off=function(M,L){if(!this.listeners[M])return!1;var B=this.listeners[M].indexOf(L);return this.listeners[M]=this.listeners[M].slice(0),this.listeners[M].splice(B,1),B>-1},P.trigger=function(M){var L=this.listeners[M];if(L)if(arguments.length===2)for(var B=L.length,U=0;U<B;++U)L[U].call(this,arguments[1]);else for(var j=Array.prototype.slice.call(arguments,1),O=L.length,V=0;V<O;++V)L[V].apply(this,j)},P.dispose=function(){this.listeners={}},P.pipe=function(M){this.on("data",function(L){M.push(L)})},y})();function e(y){return y.subarray(0,y.byteLength-y[y.byteLength-1])}const t=function(){const y=[[[],[],[],[],[]],[[],[],[],[],[]]],P=y[0],N=y[1],M=P[4],L=N[4];let B,U,j;const O=[],V=[];let v,E,q,H,z,K;for(B=0;B<256;B++)V[(O[B]=B<<1^(B>>7)*283)^B]=B;for(U=j=0;!M[U];U^=v||1,j=V[j]||1)for(H=j^j<<1^j<<2^j<<3^j<<4,H=H>>8^H&255^99,M[U]=H,L[H]=U,q=O[E=O[v=O[U]]],K=q*16843009^E*65537^v*257^U*16843008,z=O[H]*257^H*16843008,B=0;B<4;B++)P[B][U]=z=z<<24^z>>>8,N[B][H]=K=K<<24^K>>>8;for(B=0;B<5;B++)P[B]=P[B].slice(0),N[B]=N[B].slice(0);return y};let i=null;class r{constructor(P){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 N,M,L;const B=this._tables[0][4],U=this._tables[1],j=P.length;let O=1;if(j!==4&&j!==6&&j!==8)throw new Error("Invalid aes key size");const V=P.slice(0),v=[];for(this._key=[V,v],N=j;N<4*j+28;N++)L=V[N-1],(N%j===0||j===8&&N%j===4)&&(L=B[L>>>24]<<24^B[L>>16&255]<<16^B[L>>8&255]<<8^B[L&255],N%j===0&&(L=L<<8^L>>>24^O<<24,O=O<<1^(O>>7)*283)),V[N]=V[N-j]^L;for(M=0;N;M++,N--)L=V[M&3?N:N-4],N<=4||M<4?v[M]=L:v[M]=U[0][B[L>>>24]]^U[1][B[L>>16&255]]^U[2][B[L>>8&255]]^U[3][B[L&255]]}decrypt(P,N,M,L,B,U){const j=this._key[1];let O=P^j[0],V=L^j[1],v=M^j[2],E=N^j[3],q,H,z;const K=j.length/4-2;let te,re=4;const Y=this._tables[1],ee=Y[0],Z=Y[1],ie=Y[2],se=Y[3],pe=Y[4];for(te=0;te<K;te++)q=ee[O>>>24]^Z[V>>16&255]^ie[v>>8&255]^se[E&255]^j[re],H=ee[V>>>24]^Z[v>>16&255]^ie[E>>8&255]^se[O&255]^j[re+1],z=ee[v>>>24]^Z[E>>16&255]^ie[O>>8&255]^se[V&255]^j[re+2],E=ee[E>>>24]^Z[O>>16&255]^ie[V>>8&255]^se[v&255]^j[re+3],re+=4,O=q,V=H,v=z;for(te=0;te<4;te++)B[(3&-te)+U]=pe[O>>>24]<<24^pe[V>>16&255]<<16^pe[v>>8&255]<<8^pe[E&255]^j[re++],q=O,O=V,V=v,v=E,E=q}}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(P){this.jobs.push(P),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(y){return y<<24|(y&65280)<<8|(y&16711680)>>8|y>>>24},u=function(y,P,N){const M=new Int32Array(y.buffer,y.byteOffset,y.byteLength>>2),L=new r(Array.prototype.slice.call(P)),B=new Uint8Array(y.byteLength),U=new Int32Array(B.buffer);let j,O,V,v,E,q,H,z,K;for(j=N[0],O=N[1],V=N[2],v=N[3],K=0;K<M.length;K+=4)E=a(M[K]),q=a(M[K+1]),H=a(M[K+2]),z=a(M[K+3]),L.decrypt(E,q,H,z,U,K),U[K]=a(U[K]^j),U[K+1]=a(U[K+1]^O),U[K+2]=a(U[K+2]^V),U[K+3]=a(U[K+3]^v),j=E,O=q,V=H,v=z;return B};class l{constructor(P,N,M,L){const B=l.STEP,U=new Int32Array(P.buffer),j=new Uint8Array(P.byteLength);let O=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(U.subarray(O,O+B),N,M,j)),O=B;O<U.length;O+=B)M=new Uint32Array([a(U[O-4]),a(U[O-3]),a(U[O-2]),a(U[O-1])]),this.asyncStream_.push(this.decryptChunk_(U.subarray(O,O+B),N,M,j));this.asyncStream_.push(function(){L(null,e(j))})}static get STEP(){return 32e3}decryptChunk_(P,N,M,L){return function(){const B=u(P,N,M);L.set(B,P.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(P){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(P):P&&P.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 y=new Uint16Array([65484]),P=new Uint8Array(y.buffer,y.byteOffset,y.byteLength);return P[0]===255?"big":P[0]===204?"little":"unknown"})();const I=function(y){const P={};return Object.keys(y).forEach(N=>{const M=y[N];w(M)?P[N]={bytes:M.buffer,byteOffset:M.byteOffset,byteLength:M.byteLength}:P[N]=M}),P};self.onmessage=function(y){const P=y.data,N=new Uint8Array(P.encrypted.bytes,P.encrypted.byteOffset,P.encrypted.byteLength),M=new Uint32Array(P.key.bytes,P.key.byteOffset,P.key.byteLength/4),L=new Uint32Array(P.iv.bytes,P.iv.byteOffset,P.iv.byteLength/4);new l(N,M,L,function(B,U){self.postMessage(I({source:P.source,decrypted:U}),[U.buffer])})}}));var fb=hf(hb);const pb=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},kf=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},ko=(s,e)=>{e.activePlaylistLoader=s,s.load()},mb=(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,kf(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){u&&i.resetEverything();return}t.resyncLoader(),ko(a.playlistLoader,r)}},gb=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},_b=(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,kf(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()}},Mc={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))}},yb={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,_=Ar(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 I=a[s][w][x],y;if(_?(f(`AUDIO group '${w}' label '${x}' is a main playlist`),I.isMainPlaylist=!0,y=null):i==="vhs-json"&&I.playlists?y=new us(I.playlists[0],t,n):I.resolvedUri?y=new us(I.resolvedUri,t,n):I.playlists&&i==="dash"?y=new Eo(I.playlists[0],t,n,m):y=null,I=Ce({id:x,playlistLoader:y},I),Mc[s](s,I.playlistLoader,e),u[w].push(I),typeof l[x]>"u"){const P=new $.AudioTrack({id:x,kind:pb(I),enabled:!1,language:I.language,default:I.default,label:x});l[x]=P}}}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],I;if(r==="hls")I=new us(x.resolvedUri,i,a);else if(r==="dash"){if(!x.playlists.filter(P=>P.excludeUntil!==1/0).length)return;I=new Eo(x.playlists[0],i,a,m)}else r==="vhs-json"&&(I=new us(x.playlists?x.playlists[0]:x.resolvedUri,i,a));if(x=Ce({id:w,playlistLoader:I},x),Mc[s](s,x.playlistLoader,e),l[_].push(x),typeof f[w]>"u"){const y=t.addRemoteTextTrack({id:w,kind:"subtitles",default:x.default&&x.autoselect,language:x.language,label:w},!1).track;f[w]=y}}}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=Ce(m,f[m.instreamId])),m.default===void 0&&delete m.default,r[a].push(Ce({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]=_}}}}},If=(s,e)=>{for(let t=0;t<s.length;t++)if(hu(e,s[t])||s[t].playlists&&If(s[t].playlists,e))return!0;return!1},Tb=(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&&Ar(e.main))for(let l=0;l<u.length;l++){const f=r[u[l]];if(If(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},vb={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}},bb=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},xb=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{yb[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=Tb(f,s),e[f].activeTrack=vb[f](f,s),e[f].onGroupChanged=mb(f,s),e[f].onGroupChanging=gb(f,s),e[f].onTrackChanged=_b(f,s),e[f].getActiveGroup=bb(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])},Sb=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ai,activeTrack:ai,getActiveGroup:ai,onGroupChanged:ai,onTrackChanged:ai,lastTrack_:null,logger_:Ot(`MediaGroups[${e}]`)}}),s};class Bc{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=ft(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class Eb extends $.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Bc,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_=Ot("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=ft(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const f=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${f} seconds.`),this.startTTLTimeout_(parseInt(f,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let u;try{u=JSON.parse(this.request_.responseText)}catch(f){const 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 Bc}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(ft(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const Cb=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},wb=10;let xi;const Ab=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Db=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},kb=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=!!os(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?Qe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Qe.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,I=s.attributes.BANDWIDTH;if(x<I&&(!u||_<n)){let y=`${f} as next bandwidth < current bandwidth (${x} < ${I})`;return u&&(y+=` and forwardBuffer < bufferHighWaterLine (${_} < ${n})`),l(y),!0}if((!u||x>I)&&_>=r){let y=`${f} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return u&&(y+=` and next bandwidth > current bandwidth (${x} > ${I})`),l(y),!0}return l(`not ${f} as no switching criteria met`),!1};class Ib extends $.EventTarget{constructor(e){super(),this.fastQualityChange_=Cb(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:I,experimentalUseMMS:y}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:P}=e;(P===null||typeof P>"u")&&(P=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=P,this.enableLowInitialPlaylist=f,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:P,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Sb(),y&&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_=Ze(),this.hasPlayed_=!1,this.syncController_=new cb(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.segmentMetadataTrack_.mode="hidden",this.decrypter_=new fb,this.sourceUpdater_=new Af(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new db,this.keyStatusMap_=new Map;const N={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:I,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_,Ce(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new us(t,this.vhs_,Ce(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Ao(Ce(N,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Ao(Ce(N,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new nb(Ce(N,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((B,U)=>{function j(){r.off("vttjserror",O),B()}function O(){r.off("vttjsloaded",j),U()}r.one("vttjsloaded",j),r.one("vttjserror",O),r.addWebVttScript_()})}),e);const M=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new Eb(this.vhs_.xhr,M),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Ab.forEach(B=>{this[B+"_"]=Db.bind(this,B)}),this.logger_=Ot("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 L=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(L,()=>{const B=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-B,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()),xb({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(He({},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 kb({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:wb}))});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(He({},r))}),this.audioSegmentLoader_.on(i,r=>{this.player_.trigger(He({},r))}),this.subtitleSegmentLoader_.on(i,r=>{this.player_.trigger(He({},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<=Kt;const u=a.end(a.length-1);return u-n<=Kt&&r-u<=Kt}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 I=this.pathwayAttribute_(e),y=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(I),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(I)},y);return}let x=!1;r.forEach(I=>{if(I===e)return;const y=I.excludeUntil;typeof y<"u"&&y!==1/0&&(x=!0,delete I.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=os(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 Ze([[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:Ze([[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 [${Uh(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=mr(this.main(),t),r={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=i.video||e.main.videoCodec||y0),e.main.isMuxed&&(r.video+=`,${i.audio||e.main.audioCodec||wl}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(r.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||wl,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?cr(m,this.usingManagedMediaSource_):Pa(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 _=(zt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,w=(zt(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=mr(this.main,r),a=[];n.audio&&!Pa(n.audio)&&!cr(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Pa(n.video)&&!cr(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=vr(zt(e)),n=Tc(r),a=r.video&&zt(r.video)[0]||null,u=r.audio&&zt(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=[],_=mr(this.mainPlaylistLoader_.main,f),w=Tc(_);if(!(!_.audio&&!_.video)){if(w!==n&&m.push(`codec count "${w}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const x=_.video&&zt(_.video)[0]||null,I=_.audio&&zt(_.audio)[0]||null;x&&a&&x.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${x.type}" !== "${a.type}"`),I&&u&&I.type.toLowerCase()!==u.type.toLowerCase()&&m.push(`audio codec "${I.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)),ob(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Qe.GOAL_BUFFER_LENGTH,i=Qe.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Qe.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Qe.BUFFER_LOW_WATER_LINE,i=Qe.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Qe.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Qe.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:r)}bufferHighWaterLine(){return Qe.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Ac(this.inbandTextTracks_,"com.apple.streaming",this.tech_),jv({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Ac(this.inbandTextTracks_,e,this.tech_),Bv({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(He({},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:sb(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 Pb=(s,e,t)=>i=>{const r=s.main.playlists[e],n=du(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 Lb{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=mr(r.main(),t),this.playlist=t,this.id=i,this.enabled=Pb(e.playlists,t.id,n)}}const Ob=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Ar(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!du(i)).map((i,r)=>new Lb(s,i,i.id)):[]}},Fc=["seeking","seeked","pause","playing","error"];class Rb 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_=Ot("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(Fc,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(Fc,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=TT(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+Kt>=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(Ze([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 I=t.start(0);n=I+(I===t.end(0)?0:Kt)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Uh(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-Xt)*2,w=[l,f];for(let I=0;I<w.length;I++){if(!w[I])continue;if(lu(w[I],i)<_)return!1}const x=on(u,i);return x.length===0?!1:(n=x.start(0)+Kt,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=os(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=on(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)+Kt;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=os(e,i-3),a=os(e,i),u=os(t,i);u.length&&!a.length&&n.length&&(r={start:n.end(0),end:u.end(0)})}else on(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=on(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)+Xt);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=gT(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 Nb={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},Pf=function(s,e){let t=0,i=0;const r=Ce(Nb,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(),Pf(s,m)};s.on("error",u),s.on("dispose",l),s.reloadSourceOnError=f},Mb=function(s){Pf(this,s)};var Lf="3.17.2",Bb="7.1.0",Fb="1.3.1",Ub="7.2.0",jb="4.0.2";const Fe={PlaylistLoader:us,Playlist:pt,utils:zT,STANDARD_PLAYLIST_SELECTOR:wc,INITIAL_PLAYLIST_SELECTOR:Lv,lastBandwidthSelector:wc,movingAverageBandwidthSelector:Iv,comparePlaylistBandwidth:pu,comparePlaylistResolution:kv,xhr:nf()};Object.keys(Qe).forEach(s=>{Object.defineProperty(Fe,s,{get(){return $.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Qe[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}Qe[s]=e}})});const Of="videojs-vhs",Rf=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"})},qb=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),Rf(s,e.playlists)};Fe.canPlaySource=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const $b=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=vr(zt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const r=ys(i.video),n=ys(i.audio),a={};for(const u in s)a[u]={},n&&(a[u].audioContentType=n),r&&(a[u].videoContentType=r),e.contentProtection&&e.contentProtection[u]&&e.contentProtection[u].pssh&&(a[u].pssh=e.contentProtection[u].pssh),typeof s[u]=="string"&&(a[u].url=s[u]);return Ce(s,a)},Vb=(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},[]),Hb=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?i.concat([t]):i,n=Vb(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)])},zb=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const r=$b(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},Nf=()=>{if(!D.localStorage)return null;const s=D.localStorage.getItem(Of);if(!s)return null;try{return JSON.parse(s)}catch{return null}},Gb=s=>{if(!D.localStorage)return!1;let e=Nf();e=e?Ce(e,s):s;try{D.localStorage.setItem(Of,JSON.stringify(e))}catch{return!1}return e},Wb=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,Mf=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Bf=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Ff=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Uf=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Fe.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})();Fe.supportsNativeDash=(function(){return!ne||!ne.createElement||!$.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(ne.createElement("video").canPlayType("application/dash+xml"))})();Fe.supportsTypeNatively=s=>s==="hls"?Fe.supportsNativeHls:s==="dash"?Fe.supportsNativeDash:!1;Fe.isSupported=function(){return $.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Fe.xhr.onRequest=function(s){Mf(Fe.xhr,s)};Fe.xhr.onResponse=function(s){Bf(Fe.xhr,s)};Fe.xhr.offRequest=function(s){Ff(Fe.xhr,s)};Fe.xhr.offResponse=function(s){Uf(Fe.xhr,s)};const Xb=$.getComponent("Component");class jf extends Xb{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Ot("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_=Ce(this.options_,e),this.options_.withCredentials=this.options_.withCredentials||!1,this.options_.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions!==!1,this.options_.useDevicePixelRatio=this.options_.useDevicePixelRatio||!1,this.options_.usePlayerObjectFit=this.options_.usePlayerObjectFit||!1,this.options_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=typeof this.options_.useNetworkInformationApi<"u"?this.options_.useNetworkInformationApi:!0,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.customTagParsers=this.options_.customTagParsers||[],this.options_.customTagMappers=this.options_.customTagMappers||[],this.options_.cacheEncryptionKeys=this.options_.cacheEncryptionKeys||!1,this.options_.llhls=this.options_.llhls!==!1,this.options_.bufferBasedABR=this.options_.bufferBasedABR||!1,typeof this.options_.playlistExclusionDuration!="number"&&(this.options_.playlistExclusionDuration=60),typeof this.options_.bandwidth!="number"&&this.options_.useBandwidthFromLocalStorage){const i=Nf();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=Qe.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Qe.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=Wb(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Fe,this.options_.sourceType=ad(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new Ib(this.options_);const i=Ce({liveRangeSafeTimeDelta:Kt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Rb(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?Fe.movingAverageBandwidthSelector(.55):Fe.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):r.bind(this),this.playlistController_.selectInitialPlaylist=Fe.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&&Gb({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Ob(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"),Hb({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=zb({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",()=>{qb(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Rf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Lf,"mux.js":Bb,"mpd-parser":Fb,"m3u8-parser":Ub,"aes-decrypter":jb}}version(){return this.constructor.version()}canChangeType(){return Af.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 cf({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=>{Mf(this.xhr,e)},this.xhr.onResponse=e=>{Bf(this.xhr,e)},this.xhr.offRequest=e=>{Ff(this.xhr,e)},this.xhr.offResponse=e=>{Uf(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(He({},r))})}),t.forEach(i=>{this.playbackWatcher_.on(i,r=>{this.player_.trigger(He({},r))})})}}const Rn={name:"videojs-http-streaming",VERSION:Lf,canHandleSource(s,e={}){const t=Ce($.options,e);return!t.vhs.experimentalUseMMS&&!cr("avc1.4d400d,mp4a.40.2",!1)?!1:Rn.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=Ce($.options,t);return e.vhs=new jf(s,e,i),e.vhs.xhr=nf(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=ad(s);if(!t)return"";const i=Rn.getOverrideNative(e);return!Fe.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!($.browser.IS_ANY_SAFARI||$.browser.IS_IOS),{overrideNative:i=t}=e;return i}},Kb=()=>cr("avc1.4d400d,mp4a.40.2",!0);Kb()&&$.getTech("Html5").registerSourceHandler(Rn,0);$.VhsHandler=jf;$.VhsSourceHandler=Rn;$.Vhs=Fe;$.use||$.registerComponent("Vhs",Fe);$.options.vhs=$.options.vhs||{};(!$.getPlugin||!$.getPlugin("reloadSourceOnError"))&&$.registerPlugin("reloadSourceOnError",Mb);function Yb(){if(typeof navigator>"u")return!1;const s=navigator.userAgent;return/^((?!chrome|android|crios|fxios).)*safari/i.test(s)}function Qb(){return typeof navigator>"u"?!1:/iphone|ipad|ipod/i.test(navigator.userAgent)}function Uc(s){if(/\.mkv(\?|$)/i.test(s)&&(Yb()||Qb())){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 Jb(s){s.key!=="Enter"&&s.key!==" "||s.stopPropagation()}function Zb({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:[Uc(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(Uc(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(I=>I.isSupported),x=[];for(const I of w){const y=m.addRemoteTextTrack({src:`/api/subtitles/${I.id}`,srclang:I.language,label:I.displayLanguage,kind:"subtitles",default:!1},!1);x.push(y)}return()=>{if(!m.isDisposed())for(const I of x)m.removeRemoteTextTrack(I)}},[t]);const f=()=>{n.current&&(n.current.paused()?n.current.play():n.current.pause())};return Q.jsxs("div",{className:"relative w-full h-full",children:[Q.jsx("div",{className:"absolute inset-0 [&_video]:object-contain",ref:r}),Q.jsx("button",{"aria-label":"Toggle playback",className:"absolute inset-0 z-10 cursor-pointer appearance-none border-0 bg-transparent p-0 outline-none",onClick:f,onKeyDown:Jb,type:"button"})]})}function e2({muted:s,visible:e,volume:t}){const i=()=>s||t===0?Q.jsx(Jc,{className:"size-6 text-white"}):t<.33?Q.jsx(Zc,{className:"size-6 text-white"}):t<.66?Q.jsx(Yc,{className:"size-6 text-white"}):Q.jsx(Qc,{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}%`}})})]})})}const qf=.9;function jc({currentEpisodeId:s,onClose:e,onSelectEpisode:t,onSelectSeason:i,progressMap:r,seasons:n,selectedSeason:a,showTitle:u}){const l=n.find(_=>_.seasonNumber===a),f=ue.useRef(null),m=ue.useRef(null);return ue.useEffect(()=>{const _=f.current,w=m.current;if(!_||!w)return;const x=_.getBoundingClientRect(),P=w.getBoundingClientRect().top-x.top+_.scrollTop-_.clientHeight/2+w.clientHeight/2,N=_.scrollHeight-_.clientHeight;_.scrollTop=Math.max(0,Math.min(P,N))},[a,s,l?.episodes.length]),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,type:"button",children:Q.jsx(Wm,{className:"size-5"})})]}),Q.jsx("div",{className:"flex gap-1 px-4 py-3 border-b border-white/10 flex-wrap",children:n.map(_=>Q.jsxs("button",{className:`px-3 min-h-11 rounded text-sm font-medium cursor-pointer transition-colors ${_.seasonNumber===a?"bg-white text-black":"text-white/60 hover:text-white hover:bg-white/10"}`,onClick:()=>i(_.seasonNumber),type:"button",children:["Season ",_.seasonNumber]},_.seasonNumber))}),Q.jsx("div",{className:"flex-1 overflow-y-auto slim-scrollbar",ref:f,children:l?.episodes.map(_=>{const w=_.id===s,x=r?.[_.id],I=x?.duration?Math.min(x.currentTime/x.duration*100,100):0,y=x?.duration?x.currentTime/x.duration>=qf:!1,P=I>0&&!y;return Q.jsxs("button",{ref:w?m:void 0,className:`w-full text-left px-4 py-3 border-l-2 transition-colors ${w?"bg-white/10 border-red-600":"border-transparent hover:bg-white/5"}`,onClick:()=>{t(_),e()},type:"button",children:[Q.jsxs("div",{className:"text-white/60 text-xs mb-1 flex items-center gap-1",children:[y&&Q.jsx(Wc,{className:"size-3"}),Q.jsxs("span",{children:["E",_.episodeNumber,_.runtime!=null&&` · ${_.runtime}m`]})]}),Q.jsx("div",{className:`text-sm leading-snug ${y?"text-white/70":"text-white"}`,children:_.title}),(y||P)&&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 ${y?"bg-white/40":"bg-red-600"}`,style:{width:`${y?100:I}%`}})})]},_.id)})})]})}function t2({controlsHeight:s,currentEpisodeId:e,isMobile:t,onOpenChange:i,onSelectEpisode:r,onSelectSeason:n,open:a,progressMap:u,seasons:l,selectedSeason:f,showTitle:m}){return Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:`hidden sm:block absolute top-0 right-0 w-96 z-20 ${a?"":"pointer-events-none opacity-0"} transition-opacity duration-200`,style:{bottom:s},children:a&&Q.jsx(jc,{currentEpisodeId:e,onClose:()=>i(!1),onSelectEpisode:r,onSelectSeason:n,progressMap:u,seasons:l,selectedSeason:f,showTitle:m})}),t&&Q.jsx(Xm,{onOpenChange:i,open:a,children:Q.jsxs(Km,{className:"p-0 bg-black/95 border-white/10",hideCloseButton:!0,side:"bottom",style:{height:`calc(85vh - ${s}px)`,bottom:s},children:[Q.jsxs(Ym,{className:"sr-only",children:[m," episodes"]}),Q.jsx(jc,{currentEpisodeId:e,onClose:()=>i(!1),onSelectEpisode:r,onSelectSeason:n,progressMap:u,seasons:l,selectedSeason:f,showTitle:m})]})})]})}function i2(s){const e=ue.useCallback(i=>!s||s.isDisposed()?()=>{}:(s.on("play",i),s.on("pause",i),()=>{s.isDisposed()||(s.off("play",i),s.off("pause",i))}),[s]),t=()=>!s||s.isDisposed()?!1:!s.paused();return ue.useSyncExternalStore(e,t)}function s2(){const[s,e]=ue.useState(0),t=ue.useRef(null),i=ue.useCallback(r=>{if(t.current?.disconnect(),!r){t.current=null;return}e(r.offsetHeight);const n=new ResizeObserver(a=>{const u=a[0];u&&e(u.contentRect.height)});n.observe(r),t.current=n},[]);return{height:s,ref:i}}function r2(s){return ue.useSyncExternalStore(e=>{const t=window.matchMedia(s);return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>window.matchMedia(s).matches,()=>!1)}const $f=["shift","alt","meta","mod","ctrl","control"],n2={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(n2[s.trim()]||s.trim()).toLowerCase().replace(/key|digit|numpad/,"")}function Vf(s){return $f.includes(s)}function Ja(s,e=","){return s.toLowerCase().split(e)}function Za(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=>!$f.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&&Hf([Ci(s.code)])}),document.addEventListener("keyup",s=>{s.code!==void 0&&zf([Ci(s.code)])})),typeof window<"u"&&(window.addEventListener("blur",()=>{oi.clear()}),window.addEventListener("contextmenu",()=>{setTimeout(()=>{oi.clear()},0)}));const oi=new Set;function mu(s){return Array.isArray(s)}function a2(s,e=","){return(mu(s)?s:s.split(e)).every(t=>oi.has(t.trim().toLowerCase()))}function Hf(s){const e=Array.isArray(s)?s:[s];oi.has("meta")&&oi.forEach(t=>{Vf(t)||oi.delete(t.toLowerCase())}),e.forEach(t=>{oi.add(t.toLowerCase())})}function zf(s){const e=Array.isArray(s)?s:[s];s==="meta"?oi.clear():e.forEach(t=>{oi.delete(t.toLowerCase())})}function o2(s,e,t){(typeof t=="function"&&t(s,e)||t===!0)&&s.preventDefault()}function u2(s,e,t){return typeof t=="function"?t(s,e):t===!0||t===void 0}const l2=["input","textarea","select","searchbox","slider","spinbutton","menuitem","menuitemcheckbox","menuitemradio","option","radio","textbox"];function c2(s){return Gf(s,l2)}function Gf(s,e=!1){const{target:t,composed:i}=s;let r,n;return d2(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),mu(e)?!!(r&&e&&e.some(a=>a.toLowerCase()===r.toLowerCase()||a===n)):!!(r&&e&&e)}function d2(s){return!!s.tagName&&!s.tagName.startsWith("-")&&s.tagName.includes("-")}function h2(s,e){return s.length===0&&e?!1:e?s.some(t=>e.includes(t))||s.includes("*"):!0}const f2=(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:I,altKey:y}=s,P=Ci(m);if(f&&l?.length===1&&l.includes(_.toLowerCase()))return!0;if(!l?.includes(P)&&!["ctrl","control","unknown","meta","alt","shift","os"].includes(P))return!1;if(!t){if(i!==y&&P!=="alt"||a!==I&&P!=="shift")return!1;if(n){if(!x&&!w)return!1}else if(r!==x&&P!=="meta"&&P!=="os"||u!==w&&P!=="ctrl"&&P!=="control")return!1}return l&&l.length===1&&l.includes(P)?!0:l&&l.length>0?l.includes(P)?a2(l):!1:!l||l.length===0},p2=ue.createContext(void 0),m2=()=>ue.useContext(p2);function Wf(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&&Wf(s[i],e[i]),!0):s===e}const g2=ue.createContext({hotkeys:[],activeScopes:[],toggleScope:()=>{},enableScope:()=>{},disableScope:()=>{}}),_2=()=>ue.useContext(g2);function y2(s){const e=ue.useRef(void 0);return Wf(e.current,s)||(e.current=s),e.current}const qc=s=>{s.stopPropagation(),s.preventDefault(),s.stopImmediatePropagation()},T2=typeof window<"u"?ue.useLayoutEffect:ue.useEffect;function rs(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=mu(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 _=y2(a),{activeScopes:w}=_2(),x=m2();return T2(()=>{if(_?.enabled===!1||!h2(w,_?.scopes))return;let I=[],y;const P=(B,U=!1)=>{if(!(c2(B)&&!Gf(B,_?.enableOnFormTags))){if(r.current!==null){const j=r.current.getRootNode();if((j instanceof Document||j instanceof ShadowRoot)&&j.activeElement!==r.current&&!r.current.contains(j.activeElement)){qc(B);return}}B.target?.isContentEditable&&!_?.enableOnContentEditable||Ja(u,_?.delimiter).forEach(j=>{if(j.includes(_?.splitKey??"+")&&j.includes(_?.sequenceSplitKey??">")){console.warn(`Hotkey ${j} contains both ${_?.splitKey??"+"} and ${_?.sequenceSplitKey??">"} which is not supported.`);return}const O=Za(j,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata);if(O.isSequence){y=setTimeout(()=>{I=[]},_?.sequenceTimeoutMs??1e3);const V=O.useKey?B.key:Ci(B.code);if(Vf(V.toLowerCase()))return;I.push(V);const v=O.keys?.[I.length-1];if(V!==v){I=[],y&&clearTimeout(y);return}I.length===O.keys?.length&&(m.current(B,O),y&&clearTimeout(y),I=[])}else if(f2(B,O,_?.ignoreModifiers)||O.keys?.includes("*")){if(_?.ignoreEventWhen?.(B)||U&&n.current)return;if(o2(B,O,_?.preventDefault),!u2(B,O,_?.enabled)){qc(B);return}m.current(B,O),U||(n.current=!0)}})}},N=B=>{B.code!==void 0&&(Hf(Ci(B.code)),(_?.keydown===void 0&&_?.keyup!==!0||_?.keydown)&&P(B))},M=B=>{B.code!==void 0&&(zf(Ci(B.code)),n.current=!1,_?.keyup&&P(B,!0))},L=r.current||a?.document||document;return L.addEventListener("keyup",M,a?.eventListenerOptions),L.addEventListener("keydown",N,a?.eventListenerOptions),x&&Ja(u,_?.delimiter).forEach(B=>{x.addHotkey(Za(B,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),()=>{L.removeEventListener("keyup",M,a?.eventListenerOptions),L.removeEventListener("keydown",N,a?.eventListenerOptions),x&&Ja(u,_?.delimiter).forEach(B=>{x.removeHotkey(Za(B,_?.splitKey,_?.sequenceSplitKey,_?.useKey,_?.description,_?.metadata))}),I=[],y&&clearTimeout(y)}},[u,_,w]),r}const $c=10,Vc=.05;function v2(s,e){rs("*",()=>e()),rs("space",t=>{t.preventDefault(),s&&(s.paused()?s.play():s.pause())},[s]),rs("left",()=>{if(!s)return;const t=s.currentTime()??0;s.currentTime(Math.max(0,t-$c))},[s]),rs("right",()=>{if(!s)return;const t=s.currentTime()??0,i=s.duration()??0;s.currentTime(Math.min(i,t+$c))},[s]),rs("up",t=>{if(t.preventDefault(),!s||s.isDisposed())return;const i=s.volume()??1,r=Math.min(1,i+Vc);s.muted()&&s.muted(!1),s.volume(r)},[s]),rs("down",t=>{if(t.preventDefault(),!s||s.isDisposed())return;const i=s.volume()??1,r=Math.max(0,i-Vc);s.volume(r)},[s])}function b2(s,e,t){const i=ue.useRef(null);ue.useEffect(()=>{if(!s||!e||e.currentTime<=0||!t||i.current===t)return;i.current=t;const{currentTime:r,duration:n}=e;n!==null&&n>0&&r/n>=qf||s.currentTime(r)},[s,e,t])}const x2=45,Hc={countingDown:!1,forEpisodeId:void 0,visible:!1};function S2({episodeId:s,episodeShow:e,isEpisode:t,nextEpisode:i,player:r}){const n=Xc(),[a,u]=ue.useState(Hc),l=ue.useRef(void 0),f=a.forEpisodeId===s,m=()=>{u(I=>I.forEpisodeId===s&&I.visible&&I.countingDown?I:{countingDown:!0,forEpisodeId:s,visible:!0})},_=ue.useEffectEvent(()=>{if(!r||r.isDisposed())return;const I=r.currentTime()??0,y=r.duration()??0;if(y<=0)return;const P=y-I,N=l.current===s;P<=x2&&!N&&i&&m()}),w=ue.useEffectEvent(()=>{if(!i){fn("You've finished all episodes."),e&&n(`/shows/${e.id}`);return}l.current!==s&&m()});return ue.useEffect(()=>{if(!r||r.isDisposed()||!t)return;const I=()=>_(),y=()=>w();return r.on("timeupdate",I),r.on("ended",y),()=>{r.isDisposed()||(r.off("timeupdate",I),r.off("ended",y))}},[r,t]),{dismiss:()=>{l.current=s,u(Hc)},isCountingDown:f&&a.countingDown,upNextVisible:f&&a.visible}}const E2=1200;function C2(s){const[e,t]=ue.useState(null);return ue.useEffect(()=>{if(!s||s.isDisposed())return;let i=null;const r=()=>{s.isDisposed()||(t({muted:s.muted()??!1,volume:s.volume()??1}),i&&clearTimeout(i),i=setTimeout(()=>{t(null)},E2))};return s.on("volumechange",r),()=>{i&&clearTimeout(i),!s.isDisposed()&&s.off("volumechange",r)}},[s]),e}async function w2(s,e){try{return await ri(t=>t.shows.getNextEpisode({path:{showId:s},urlParams:{afterEpisodeId:e}}))}catch(t){if(t instanceof Qm&&t.status===404)return null;throw t}}function A2(s,e,t={}){const i=(t.enabled??!0)&&!!s&&!!e;return ns({queryKey:["next-episode",s,e],queryFn:()=>w2(s??0,e??0),enabled:i,retry:!1})}async function D2(s){try{return await ri(e=>e.episodeProgress.getShowProgress({path:{showId:s}}))}catch{return{}}}function k2(s,e){const{data:t,isLoading:i,error:r}=ns({queryKey:["movie",s],queryFn:()=>ri(y=>y.library.getMovie({path:{id:Number(s)}})),enabled:!!s&&!e,placeholderData:nl}),{data:n,isLoading:a,error:u}=ns({queryKey:["episode",s],queryFn:()=>ri(y=>y.shows.getEpisode({path:{id:Number(s)}})),enabled:!!s&&e,placeholderData:nl}),l=n?.episode,f=n?.show,{data:m}=ns({queryKey:["show-for-episode",f?.id],queryFn:()=>ri(y=>y.shows.getShow({path:{id:f?.id??0}})),enabled:!!f}),{data:_}=ns({queryKey:["show-progress",f?.id],queryFn:()=>D2(f?.id??0),enabled:!!f}),{data:w}=ns({queryKey:["progress",e?"episode":"movie",e?l?.id:t?.id],queryFn:()=>e?ri(y=>y.episodeProgress.getEpisodeProgress({path:{episodeId:l?.id??0}})):ri(y=>y.progress.getMovieProgress({path:{movieId:t?.id??0}})),enabled:e?!!l:!!t}),{data:x}=A2(f?.id,l?.id,{enabled:e}),I=e?n?.subtitles??[]:t?.subtitles??[];return{episode:l,episodeProgressMap:_,episodeShow:f,error:e?u:r,isLoading:e?a:i,movie:t,nextEpisode:x?.episode??null,nextEpisodeShow:x?.show??null,savedProgress:w,show:m,subtitles:I}}const zc=3e3;function I2(){return Q.jsx("div",{className:"min-h-screen bg-black flex items-center justify-center",children:Q.jsx(tg,{className:"h-8 w-8 animate-spin text-white"})})}function P2({isEpisode:s}){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:s?"Episode not found":"Movie not found"}),Q.jsx(eo,{asChild:!0,variant:"outline",children:Q.jsx(Kc,{to:"/",children:"Back to Library"})})]})}function R2(){const{id:s}=Jm(),e=Zm(),t=Xc(),i=e.pathname.startsWith("/watch/episode/"),[r,n]=ue.useState(!0),[a,u]=ue.useState(null),[l,f]=ue.useState(!1),m=r2("(max-width: 639px)"),[_,w]=ue.useState(null),[x,I]=ue.useState(!1),{height:y,ref:P}=s2(),N=ue.useRef(null),M=ue.useRef(null),{episode:L,episodeProgressMap:B,episodeShow:U,error:j,isLoading:O,movie:V,nextEpisode:v,nextEpisodeShow:E,savedProgress:q,show:H,subtitles:z}=k2(s,i),K=i2(a),te=C2(a),{mutate:re}=Io(),Y=i?L?`episode-${L.id}`:null:V?`movie-${V.id}`:null;b2(a,q,Y);const{dismiss:ee,isCountingDown:Z,upNextVisible:ie}=S2({episodeId:L?.id,episodeShow:U,isEpisode:i,nextEpisode:v,player:a}),se=ue.useCallback(()=>{document.fullscreenElement?document.exitFullscreen():M.current?.requestFullscreen()},[]),pe=ue.useCallback(()=>{n(!0),N.current&&clearTimeout(N.current),K&&(N.current=setTimeout(()=>{n(!1)},zc))},[K]);ue.useEffect(()=>{if(n(!0),!K){N.current&&clearTimeout(N.current);return}return N.current=setTimeout(()=>{n(!1)},zc),()=>{N.current&&clearTimeout(N.current)}},[K]),v2(a,pe),ue.useEffect(()=>{if(!a||a.isDisposed())return;const ke=()=>I(!1);return a.on("playing",ke),()=>{a.isDisposed()||a.off("playing",ke)}},[a]);const ge=ue.useCallback(()=>{v&&(I(!0),t(`/watch/episode/${v.id}`))},[v,t]),ye=ue.useCallback(ke=>{ke.id!==L?.id&&(a&&L&&re({currentTime:a.currentTime()??0,duration:a.duration()??0,progressUrl:`/api/progress/episode/${L.id}`}),I(!0),t(`/watch/episode/${ke.id}`))},[a,L,t,re]),he=_&&_.forEpisodeId===L?.id?_.season:L?.seasonNumber??1,Ge=ke=>{L&&w({forEpisodeId:L.id,season:ke})};if(O)return Q.jsx(I2,{});if(j||(i?!L:!V))return Q.jsx(P2,{isEpisode:i});const We=i?`/api/stream/episode/${L?.id}`:`/api/stream/${V?.id}`,je=i&&L&&U?`${U.title} — S${L.seasonNumber} E${L.episodeNumber} · ${L.title}`:V?.title??"";return Q.jsxs("div",{ref:M,className:`bg-black w-full h-screen relative ${r?"":"cursor-none"}`,onMouseMove:pe,children:[Q.jsx("div",{className:"absolute inset-0",children:Q.jsx(Zb,{src:We,subtitles:z,onReady:u})}),Q.jsx("div",{"aria-hidden":"true",className:`absolute inset-0 z-40 bg-black pointer-events-none transition-opacity duration-300 ${x?"opacity-100":"opacity-0"}`}),Q.jsx(e2,{muted:te?.muted??!1,visible:te!==null,volume:te?.volume??0}),i&&ie&&v&&Q.jsx("video",{"aria-hidden":"true",className:"hidden",muted:!0,preload:"auto",src:`/api/stream/episode/${v.id}`,tabIndex:-1}),i&&ie&&v&&E&&Q.jsx(Eg,{isCountingDown:Z,nextEpisode:v,onCancel:ee,onPlayNow:ge,show:E}),i&&H&&L&&Q.jsx(t2,{controlsHeight:y,currentEpisodeId:L.id,isMobile:m,onOpenChange:f,onSelectEpisode:ye,onSelectSeason:Ge,open:l,progressMap:B,seasons:H.seasons,selectedSeason:he,showTitle:H.title}),Q.jsx(Kc,{"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(eg,{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"}`,ref:P,children:Q.jsx(Vg,{title:je,player:a,movieId:i?void 0:V?.id,episodeId:i?L?.id:void 0,showEpisodesButton:i,streamUrl:We,subtitles:z,onFullscreen:se,onNextEpisode:i&&v?ge:void 0,onToggleEpisodes:()=>f(ke=>!ke)})})]})}export{R2 as WatchPage};