@streamlayer/react 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/advertisement.js +30 -30
- package/lib/cjs/bet-pack.js +1 -1
- package/lib/cjs/gamification-feature2.js +1 -1
- package/lib/cjs/index2.js +5 -5
- package/lib/cjs/masters2.js +3 -3
- package/lib/cjs/provider.js +1 -1
- package/lib/cjs/useStreamLayerApp2.js +6 -6
- package/lib/classic/cjs/advertisement.js +30 -30
- package/lib/classic/cjs/bet-pack.js +1 -1
- package/lib/classic/cjs/gamification-feature2.js +1 -1
- package/lib/classic/cjs/index2.js +5 -5
- package/lib/classic/cjs/masters2.js +3 -3
- package/lib/classic/cjs/provider.js +1 -1
- package/lib/classic/cjs/useStreamLayerApp2.js +6 -6
- package/lib/classic/es/advertisement.js +2205 -2193
- package/lib/classic/es/bet-pack.js +1 -1
- package/lib/classic/es/gamification-feature2.js +1 -1
- package/lib/classic/es/index2.js +697 -685
- package/lib/classic/es/masters2.js +202 -231
- package/lib/classic/es/provider.js +2 -2
- package/lib/classic/es/useStreamLayerApp2.js +147 -138
- package/lib/classic/style.css +1 -1
- package/lib/dist/cjs/gamification-feature.js +1 -1
- package/lib/dist/cjs/gamification-feature2.js +1 -1
- package/lib/dist/cjs/masters.js +22 -22
- package/lib/dist/es/gamification-feature.js +1 -1
- package/lib/dist/es/gamification-feature2.js +45 -45
- package/lib/dist/es/index.js +3 -3
- package/lib/dist/es/masters.js +3057 -3065
- package/lib/dist/style.css +1 -1
- package/lib/es/advertisement.js +2205 -2193
- package/lib/es/bet-pack.js +1 -1
- package/lib/es/gamification-feature2.js +1 -1
- package/lib/es/index2.js +697 -685
- package/lib/es/masters2.js +202 -231
- package/lib/es/provider.js +2 -2
- package/lib/es/useStreamLayerApp2.js +147 -138
- package/lib/style.css +1 -1
- package/package.json +14 -14
package/lib/cjs/advertisement.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("react/jsx-runtime"),Ye=require("react"),Z=require("./provider.js"),ge=require("./useStreamLayerApp2.js"),kv=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function dp(s){return typeof s=="string"&&kv.test(s)}function eu(s){if(!dp(s))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(s.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(s.slice(9,13),16))>>>8,e&255,(e=parseInt(s.slice(14,18),16))>>>8,e&255,(e=parseInt(s.slice(19,23),16))>>>8,e&255,(e=parseInt(s.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function Cv(s){s=unescape(encodeURIComponent(s));const e=new Uint8Array(s.length);for(let t=0;t<s.length;++t)e[t]=s.charCodeAt(t);return e}const Iv="6ba7b810-9dad-11d1-80b4-00c04fd430c8",xv="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Lv(s,e,t,n,r,i){const a=typeof t=="string"?Cv(t):t,o=typeof n=="string"?eu(n):n;if(typeof n=="string"&&(n=eu(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);if(c.set(o),c.set(a,o.length),c=e(c),c[6]=c[6]&15|s,c[8]=c[8]&63|128,r){i=i||0;for(let h=0;h<16;++h)r[i+h]=c[h];return r}return ge.unsafeStringify(c)}function Pv(s,e,t,n){switch(s){case 0:return e&t^~e&n;case 1:return e^t^n;case 2:return e&t^e&n^t&n;case 3:return e^t^n}}function Xo(s,e){return s<<e|s>>>32-e}function Rv(s){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(s.length+1);n.set(s),n[s.length]=128,s=n;const r=s.length/4+2,i=Math.ceil(r/16),a=new Array(i);for(let o=0;o<i;++o){const c=new Uint32Array(16);for(let h=0;h<16;++h)c[h]=s[o*64+h*4]<<24|s[o*64+h*4+1]<<16|s[o*64+h*4+2]<<8|s[o*64+h*4+3];a[o]=c}a[i-1][14]=(s.length-1)*8/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(s.length-1)*8&4294967295;for(let o=0;o<i;++o){const c=new Uint32Array(80);for(let w=0;w<16;++w)c[w]=a[o][w];for(let w=16;w<80;++w)c[w]=Xo(c[w-3]^c[w-8]^c[w-14]^c[w-16],1);let h=t[0],m=t[1],_=t[2],T=t[3],S=t[4];for(let w=0;w<80;++w){const b=Math.floor(w/20),R=Xo(h,5)+Pv(b,m,_,T)+S+e[b]+c[w]>>>0;S=T,T=_,_=Xo(m,30)>>>0,m=h,h=R}t[0]=t[0]+h>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+_>>>0,t[3]=t[3]+T>>>0,t[4]=t[4]+S>>>0}return Uint8Array.of(t[0]>>24,t[0]>>16,t[0]>>8,t[0],t[1]>>24,t[1]>>16,t[1]>>8,t[1],t[2]>>24,t[2]>>16,t[2]>>8,t[2],t[3]>>24,t[3]>>16,t[3]>>8,t[3],t[4]>>24,t[4]>>16,t[4]>>8,t[4])}function ba(s,e,t,n){return Lv(80,Rv,s,e,t,n)}ba.DNS=Iv;ba.URL=xv;const Dv=Z.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Nv="a1rlj479",Ov="s35f1di",Mv="sj4471g",Uv="b12050d8",Bv="b1d5ybek",Fv=s=>s==="left"||s==="right"?Ov:Uv,jv=s=>s==="left"||s==="right"?Mv:Bv,qv=s=>s==="left"?"avdxyl3":s==="right"?"a1bisd08":s==="top"?"a1u9y2aj":"a1qqaks",rc=({children:s,style:e,className:t,enabled:n=!0,hiding:r,direction:i="left",onAnimationEnd:a})=>X.jsx(Dv,{style:e,className:Z.cx_default(t,Nv,qv(i),n&&!r&&Fv(i),n&&r&&jv(i)),onAnimationEnd:a,children:s}),Vv=Z.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),$v=Z.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Hv=()=>Vv,Wv=Z.styled_default(Hv())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),zv=({promotion:s,promotionId:e,hiding:t,direction:n="bottom"})=>{var r,i;if(!((r=s.additionalBanner)!=null&&r.imageUrl))return null;let a=(i=s.additionalBanner)==null?void 0:i.url;return a&&a.indexOf("http")!==0&&(a=`https://${a}`),X.jsx(rc,{direction:n,hiding:t,children:X.jsx($v,{className:"BannerContainer",children:X.jsx(Wv,{as:a?"a":"span",className:"BannerLink",href:a,style:{backgroundImage:`url(${s.additionalBanner.imageUrl})`,cursor:a?"pointer":"default"},"data-promo-id":e,"data-promo-type":s.type,"data-analytics":"banner",target:"_blank"})})})},Gv=Z.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Xv=Z.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Yv=Z.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),Kv=Z.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),ic=Z.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Qv=()=>ic,Zv=Z.styled_default(Qv())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),Jv=Z.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),eb=Z.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),tb=Z.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),sb=Z.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),nb=Z.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),rb=Z.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),ib={[ge.NotificationPromotionImagePosition.BOTTOM]:ic,[ge.NotificationPromotionImagePosition.MIDDLE]:Zv},ab=({src:s,imagePosition:e})=>{const t=ib[e]||ic;return X.jsx(t,{children:X.jsx("img",{src:s,alt:""})})},ob=({notification:s,open:e})=>{if(!s||!s.promotion||s.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:t,body:n,image:r,promotion:i}=s,{sponsorLogo:a,sponsorLogoMode:o,imagePosition:c,ctaButton:h}=i;return X.jsxs(rb,{className:"SL_Lower_Third_Notification",onClick:e,children:[X.jsxs(Gv,{children:[X.jsx(ab,{src:r,imagePosition:c}),X.jsxs(Xv,{children:[t&&X.jsx(Yv,{children:t}),n&&X.jsx(Kv,{children:n})]})]}),X.jsxs(sb,{children:[o!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&X.jsxs(X.Fragment,{children:[X.jsx(tb,{children:X.jsx("img",{src:a,alt:t})}),X.jsx(nb,{})]}),X.jsxs(eb,{name:"promo-button",style:{color:h==null?void 0:h.textColor,backgroundColor:h==null?void 0:h.color},children:[(h==null?void 0:h.ctaIcon)&&(h==null?void 0:h.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&X.jsx(Jv,{src:h==null?void 0:h.ctaIcon,alt:"cta-icon"}),(h==null?void 0:h.label)||"Open"]})]})]})},lb=Z.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),cb=Z.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),db=Z.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),ub=Z.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),hb=Z.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Ka=Z.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),pb=()=>Ka,tu=Z.styled_default(pb())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),mb=()=>Ka,up=Z.styled_default(mb())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),fb=()=>up,gb=Z.styled_default(fb())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),yb=()=>Ka,_b=Z.styled_default(yb())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),vb=()=>Ka,bb=Z.styled_default(vb())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Tb=Z.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),Ab=Z.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),Sb=()=>Z.u1,Eb=Z.styled_default(Sb())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),wb=Z.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),kb={[ge.NotificationPromotionImagePosition.UNSET]:tu,[ge.NotificationPromotionImagePosition.FIT]:tu,[ge.NotificationPromotionImagePosition.CENTERED]:up,[ge.NotificationPromotionImagePosition.BOTTOM]:gb,[ge.NotificationPromotionImagePosition.SOLID]:_b,[ge.NotificationPromotionImagePosition.MIDDLE]:bb},Cb=({src:s,imagePosition:e})=>{const t=kb[e];return X.jsx(t,{children:X.jsx("img",{src:s,alt:""})})},Ib=({notification:s,open:e,promotionId:t,hiding:n,direction:r="left"})=>{if(!s||!s.promotion||s.enabled!==ge.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(s.promotion.mode===ge.NotificationPromotionMode.LOWER_THIRD)return X.jsx(ob,{notification:s,open:e});const{title:i,body:a,image:o,promotion:c}=s,{sponsorLogo:h,sponsorLogoMode:m,imagePosition:_,ctaButton:T}=c;return X.jsx(rc,{className:"SL_Rich_Notification",direction:r,hiding:n,children:X.jsxs(cb,{onClick:e,children:[m!==ge.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&h&&X.jsx(wb,{children:X.jsx("img",{src:h,alt:i})}),X.jsxs(lb,{children:[X.jsx(Cb,{src:o,imagePosition:_}),X.jsxs(db,{children:[i&&X.jsx(ub,{children:i}),a&&X.jsx(hb,{children:a})]}),X.jsxs(Ab,{name:"promo-button",style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===ge.CtaIconMode.CTA_ICON_TRANSPARENT&&X.jsx(Tb,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]}),X.jsx(Eb,{name:"chevronRight"})]})]})})},su=globalThis||void 0||self,xb=Z.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),hp=Z.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),pp=Z.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),mp=Z.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),fp="h10toh7",nu=Z.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),Lb=Z.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),gp=Z.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),Pb=Z.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),Rb="s1nmch9k",ru=Z.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),Db=Z.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),Nb=Z.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),Ob=Z.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),yp=Z.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),Mb=Z.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),_p=Z.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),vp=Z.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),Ub=Z.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),Bb="h17rwbtk",Fb=Z.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),iu=Z.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),jb=Z.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),qb=({time:s,adCount:e,adPosition:t})=>{const n=Math.floor(s/60),r=s-n*60;return n===0&&r===0&&e===t?null:X.jsxs(Fb,{children:[e>1&&X.jsxs(X.Fragment,{children:[X.jsxs(iu,{children:[t," of ",e]}),X.jsx(jb,{})]}),X.jsxs(iu,{children:[n,":",r<10?`0${r}`:r]})]})};var bp=s=>{throw TypeError(s)},Tp=(s,e,t)=>e.has(s)||bp("Cannot "+t),Ae=(s,e,t)=>(Tp(s,e,"read from private field"),t?t.call(s):e.get(s)),it=(s,e,t)=>e.has(s)?bp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),Ke=(s,e,t,n)=>(Tp(s,e,"write to private field"),e.set(s,t),t),Ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof su<"u"?su:typeof self<"u"?self:{};function or(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function Vb(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return s[n]}})}),t}const Aa=globalThis||void 0||self;var Vr;typeof window<"u"?Vr=window:typeof Ta<"u"?Vr=Ta:typeof self<"u"?Vr=self:Vr={};var Qa=Vr;const I=or(Qa),$b={},Hb=Object.freeze(Object.defineProperty({__proto__:null,default:$b},Symbol.toStringTag,{value:"Module"})),Wb=Vb(Hb);var au=typeof Ta<"u"?Ta:typeof window<"u"?window:{},zb=Wb,$r;typeof document<"u"?$r=document:($r=au["__GLOBAL_DOCUMENT_CACHE@4"],$r||($r=au["__GLOBAL_DOCUMENT_CACHE@4"]=zb));var Ap=$r;const Y=or(Ap);var ac={exports:{}},Sp={exports:{}};(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}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})(Sp);var Gb=Sp.exports,Xb=Kb,Yb=Object.prototype.toString;function Kb(s){if(!s)return!1;var e=Yb.call(s);return e==="[object Function]"||typeof s=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}function Qb(s,e){var t=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t)return(t=t.call(s)).next.bind(t);if(Array.isArray(s)||(t=Zb(s))||e){t&&(s=t);var n=0;return function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}}}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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("react/jsx-runtime"),Ge=require("react"),Q=require("./provider.js"),ye=require("./useStreamLayerApp2.js"),kv=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i;function dp(s){return typeof s=="string"&&kv.test(s)}function eu(s){if(!dp(s))throw TypeError("Invalid UUID");let e;return Uint8Array.of((e=parseInt(s.slice(0,8),16))>>>24,e>>>16&255,e>>>8&255,e&255,(e=parseInt(s.slice(9,13),16))>>>8,e&255,(e=parseInt(s.slice(14,18),16))>>>8,e&255,(e=parseInt(s.slice(19,23),16))>>>8,e&255,(e=parseInt(s.slice(24,36),16))/1099511627776&255,e/4294967296&255,e>>>24&255,e>>>16&255,e>>>8&255,e&255)}function Cv(s){s=unescape(encodeURIComponent(s));const e=new Uint8Array(s.length);for(let t=0;t<s.length;++t)e[t]=s.charCodeAt(t);return e}const Iv="6ba7b810-9dad-11d1-80b4-00c04fd430c8",xv="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Lv(s,e,t,n,r,i){const a=typeof t=="string"?Cv(t):t,o=typeof n=="string"?eu(n):n;if(typeof n=="string"&&(n=eu(n)),(n==null?void 0:n.length)!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let c=new Uint8Array(16+a.length);if(c.set(o),c.set(a,o.length),c=e(c),c[6]=c[6]&15|s,c[8]=c[8]&63|128,r){i=i||0;for(let h=0;h<16;++h)r[i+h]=c[h];return r}return ye.unsafeStringify(c)}function Pv(s,e,t,n){switch(s){case 0:return e&t^~e&n;case 1:return e^t^n;case 2:return e&t^e&n^t&n;case 3:return e^t^n}}function Xo(s,e){return s<<e|s>>>32-e}function Rv(s){const e=[1518500249,1859775393,2400959708,3395469782],t=[1732584193,4023233417,2562383102,271733878,3285377520],n=new Uint8Array(s.length+1);n.set(s),n[s.length]=128,s=n;const r=s.length/4+2,i=Math.ceil(r/16),a=new Array(i);for(let o=0;o<i;++o){const c=new Uint32Array(16);for(let h=0;h<16;++h)c[h]=s[o*64+h*4]<<24|s[o*64+h*4+1]<<16|s[o*64+h*4+2]<<8|s[o*64+h*4+3];a[o]=c}a[i-1][14]=(s.length-1)*8/Math.pow(2,32),a[i-1][14]=Math.floor(a[i-1][14]),a[i-1][15]=(s.length-1)*8&4294967295;for(let o=0;o<i;++o){const c=new Uint32Array(80);for(let w=0;w<16;++w)c[w]=a[o][w];for(let w=16;w<80;++w)c[w]=Xo(c[w-3]^c[w-8]^c[w-14]^c[w-16],1);let h=t[0],m=t[1],_=t[2],T=t[3],S=t[4];for(let w=0;w<80;++w){const b=Math.floor(w/20),R=Xo(h,5)+Pv(b,m,_,T)+S+e[b]+c[w]>>>0;S=T,T=_,_=Xo(m,30)>>>0,m=h,h=R}t[0]=t[0]+h>>>0,t[1]=t[1]+m>>>0,t[2]=t[2]+_>>>0,t[3]=t[3]+T>>>0,t[4]=t[4]+S>>>0}return Uint8Array.of(t[0]>>24,t[0]>>16,t[0]>>8,t[0],t[1]>>24,t[1]>>16,t[1]>>8,t[1],t[2]>>24,t[2]>>16,t[2]>>8,t[2],t[3]>>24,t[3]>>16,t[3]>>8,t[3],t[4]>>24,t[4]>>16,t[4]>>8,t[4])}function ba(s,e,t,n){return Lv(80,Rv,s,e,t,n)}ba.DNS=Iv;ba.URL=xv;const Dv=Q.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Nv="a1rlj479",Ov="s35f1di",Mv="sj4471g",Uv="b12050d8",Bv="b1d5ybek",Fv=s=>s==="left"||s==="right"?Ov:Uv,jv=s=>s==="left"||s==="right"?Mv:Bv,qv=s=>s==="left"?"avdxyl3":s==="right"?"a1bisd08":s==="top"?"a1u9y2aj":"a1qqaks",rc=({children:s,style:e,className:t,enabled:n=!0,hiding:r,direction:i="left",onAnimationEnd:a})=>G.jsx(Dv,{style:e,className:Q.cx_default(t,Nv,qv(i),n&&!r&&Fv(i),n&&r&&jv(i)),onAnimationEnd:a,children:s}),Vv=Q.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),$v=Q.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Hv=()=>Vv,Wv=Q.styled_default(Hv())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),zv=({promotion:s,promotionId:e,hiding:t,direction:n="bottom"})=>{var r,i;if(!((r=s.additionalBanner)!=null&&r.imageUrl))return null;let a=(i=s.additionalBanner)==null?void 0:i.url;return a&&a.indexOf("http")!==0&&(a=`https://${a}`),G.jsx(rc,{direction:n,hiding:t,children:G.jsx($v,{className:"BannerContainer",children:G.jsx(Wv,{as:a?"a":"span",className:"BannerLink",href:a,style:{backgroundImage:`url(${s.additionalBanner.imageUrl})`,cursor:a?"pointer":"default"},"data-promo-id":e,"data-promo-type":s.type,"data-analytics":"banner",target:"_blank"})})})},Gv=Q.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Xv=Q.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Yv=Q.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),Kv=Q.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),ic=Q.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Qv=()=>ic,Jv=Q.styled_default(Qv())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),Zv=Q.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),eb=Q.styled_default("button")({name:"Button",class:"bgl6boa",propsAsIs:!1}),tb=Q.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),sb=Q.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),nb=Q.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),rb=Q.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),ib={[ye.NotificationPromotionImagePosition.BOTTOM]:ic,[ye.NotificationPromotionImagePosition.MIDDLE]:Jv},ab=({src:s,imagePosition:e})=>{const t=ib[e]||ic;return G.jsx(t,{children:G.jsx("img",{src:s,alt:""})})},ob=({notification:s,open:e})=>{if(!s||!s.promotion||s.enabled!==ye.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:t,body:n,image:r,promotion:i}=s,{sponsorLogo:a,sponsorLogoMode:o,imagePosition:c,ctaButton:h}=i;return G.jsxs(rb,{className:"SL_Lower_Third_Notification",onClick:e,children:[G.jsxs(Gv,{children:[G.jsx(ab,{src:r,imagePosition:c}),G.jsxs(Xv,{children:[t&&G.jsx(Yv,{children:t}),n&&G.jsx(Kv,{children:n})]})]}),G.jsxs(sb,{children:[o!==ye.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&G.jsxs(G.Fragment,{children:[G.jsx(tb,{children:G.jsx("img",{src:a,alt:t})}),G.jsx(nb,{})]}),G.jsxs(eb,{name:"promo-button",style:{color:h==null?void 0:h.textColor,backgroundColor:h==null?void 0:h.color},children:[(h==null?void 0:h.ctaIcon)&&(h==null?void 0:h.ctaIconMode)===ye.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(Zv,{src:h==null?void 0:h.ctaIcon,alt:"cta-icon"}),(h==null?void 0:h.label)||"Open"]})]})]})},lb=Q.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),cb=Q.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),db=Q.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),ub=Q.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),hb=Q.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Ka=Q.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),pb=()=>Ka,tu=Q.styled_default(pb())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),mb=()=>Ka,up=Q.styled_default(mb())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),fb=()=>up,gb=Q.styled_default(fb())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),yb=()=>Ka,_b=Q.styled_default(yb())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),vb=()=>Ka,bb=Q.styled_default(vb())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Tb=Q.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),Ab=Q.styled_default("button")({name:"Button",class:"bis90pl",propsAsIs:!1}),Sb=()=>Q.u1,Eb=Q.styled_default(Sb())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),wb=Q.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),kb={[ye.NotificationPromotionImagePosition.UNSET]:tu,[ye.NotificationPromotionImagePosition.FIT]:tu,[ye.NotificationPromotionImagePosition.CENTERED]:up,[ye.NotificationPromotionImagePosition.BOTTOM]:gb,[ye.NotificationPromotionImagePosition.SOLID]:_b,[ye.NotificationPromotionImagePosition.MIDDLE]:bb},Cb=({src:s,imagePosition:e})=>{const t=kb[e];return G.jsx(t,{children:G.jsx("img",{src:s,alt:""})})},Ib=({notification:s,open:e,promotionId:t,hiding:n,direction:r="left"})=>{if(!s||!s.promotion||s.enabled!==ye.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(s.promotion.mode===ye.NotificationPromotionMode.LOWER_THIRD)return G.jsx(ob,{notification:s,open:e});const{title:i,body:a,image:o,promotion:c}=s,{sponsorLogo:h,sponsorLogoMode:m,imagePosition:_,ctaButton:T}=c;return G.jsx(rc,{className:"SL_Rich_Notification",direction:r,hiding:n,children:G.jsxs(cb,{onClick:e,children:[m!==ye.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&h&&G.jsx(wb,{children:G.jsx("img",{src:h,alt:i})}),G.jsxs(lb,{children:[G.jsx(Cb,{src:o,imagePosition:_}),G.jsxs(db,{children:[i&&G.jsx(ub,{children:i}),a&&G.jsx(hb,{children:a})]}),G.jsxs(Ab,{name:"promo-button",style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===ye.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(Tb,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]}),G.jsx(Eb,{name:"chevronRight"})]})]})})},su=globalThis||void 0||self,xb=Q.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),hp=Q.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),pp=Q.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),mp=Q.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),fp="h10toh7",nu=Q.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),Lb=Q.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),gp=Q.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),Pb=Q.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),Rb="s1nmch9k",ru=Q.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),Db=Q.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),Nb=Q.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),Ob=Q.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),yp=Q.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),Mb=Q.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),_p=Q.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),vp=Q.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),Ub=Q.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),Bb="h17rwbtk",Fb=Q.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),iu=Q.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),jb=Q.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),qb=({time:s,adCount:e,adPosition:t})=>{const n=Math.floor(s/60),r=s-n*60;return n===0&&r===0&&e===t?null:G.jsxs(Fb,{children:[e>1&&G.jsxs(G.Fragment,{children:[G.jsxs(iu,{children:[t," of ",e]}),G.jsx(jb,{})]}),G.jsxs(iu,{children:[n,":",r<10?`0${r}`:r]})]})},Vb=Q.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),$b=({whyThisAd:s})=>!s.iconClickThroughURLTemplate||!s.staticResource?null:G.jsx(Vb,{style:{width:s.width,height:s.height,[s.xPosition]:1,[s.yPosition]:1},href:s.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:G.jsx("img",{alt:"GoogleWhyThisAd",src:s.staticResource})}),Hb=Q.styled_default("div")({name:"Container",class:"c1xzooj9",propsAsIs:!1}),Wb=Q.styled_default("div")({name:"ControlsContainer",class:"c1bo41vr",propsAsIs:!1}),au="m13efyu8",ou="mladkgh",lu="mjnga56";var bp=s=>{throw TypeError(s)},Tp=(s,e,t)=>e.has(s)||bp("Cannot "+t),Ae=(s,e,t)=>(Tp(s,e,"read from private field"),t?t.call(s):e.get(s)),it=(s,e,t)=>e.has(s)?bp("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(s):e.set(s,t),Ke=(s,e,t,n)=>(Tp(s,e,"write to private field"),e.set(s,t),t),Ta=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof su<"u"?su:typeof self<"u"?self:{};function or(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}function zb(s){if(s.__esModule)return s;var e=s.default;if(typeof e=="function"){var t=function n(){return this instanceof n?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};t.prototype=e.prototype}else t={};return Object.defineProperty(t,"__esModule",{value:!0}),Object.keys(s).forEach(function(n){var r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return s[n]}})}),t}const Aa=globalThis||void 0||self;var Vr;typeof window<"u"?Vr=window:typeof Ta<"u"?Vr=Ta:typeof self<"u"?Vr=self:Vr={};var Qa=Vr;const I=or(Qa),Gb={},Xb=Object.freeze(Object.defineProperty({__proto__:null,default:Gb},Symbol.toStringTag,{value:"Module"})),Yb=zb(Xb);var cu=typeof Ta<"u"?Ta:typeof window<"u"?window:{},Kb=Yb,$r;typeof document<"u"?$r=document:($r=cu["__GLOBAL_DOCUMENT_CACHE@4"],$r||($r=cu["__GLOBAL_DOCUMENT_CACHE@4"]=Kb));var Ap=$r;const X=or(Ap);var ac={exports:{}},Sp={exports:{}};(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var i in r)({}).hasOwnProperty.call(r,i)&&(t[i]=r[i])}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})(Sp);var Qb=Sp.exports,Jb=e0,Zb=Object.prototype.toString;function e0(s){if(!s)return!1;var e=Zb.call(s);return e==="[object Function]"||typeof s=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(s===window.setTimeout||s===window.alert||s===window.confirm||s===window.prompt)}function t0(s,e){var t=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(t)return(t=t.call(s)).next.bind(t);if(Array.isArray(s)||(t=s0(s))||e){t&&(s=t);var n=0;return function(){return n>=s.length?{done:!0}:{done:!1,value:s[n++]}}}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 s0(s,e){if(s){if(typeof s=="string")return du(s,e);var t=Object.prototype.toString.call(s).slice(8,-1);if(t==="Object"&&s.constructor&&(t=s.constructor.name),t==="Map"||t==="Set")return Array.from(s);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return du(s,e)}}function du(s,e){(e==null||e>s.length)&&(e=s.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=s[t];return n}var n0=function(){function s(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=s.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},e.addInterceptor=function(t,n){this.typeToInterceptorsMap_.has(t)||this.typeToInterceptorsMap_.set(t,new Set);var r=this.typeToInterceptorsMap_.get(t);return r.has(n)?!1:(r.add(n),!0)},e.removeInterceptor=function(t,n){var r=this.typeToInterceptorsMap_.get(t);return r&&r.has(n)?(r.delete(n),!0):!1},e.clearInterceptorsByType=function(t){var n=this.typeToInterceptorsMap_.get(t);return n?(this.typeToInterceptorsMap_.delete(t),this.typeToInterceptorsMap_.set(t,new Set),!0):!1},e.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},e.getForType=function(t){return this.typeToInterceptorsMap_.get(t)||new Set},e.execute=function(t,n){for(var r=this.getForType(t),i=t0(r),a;!(a=i()).done;){var o=a.value;try{n=o(n)}catch{}}return n},s}(),r0=n0,i0=function(){function s(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=s.prototype;return e.getIsEnabled=function(){return this.enabled_},e.enable=function(){this.enabled_=!0},e.disable=function(){this.enabled_=!1},e.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},e.getMaxAttempts=function(){return this.maxAttempts_},e.setMaxAttempts=function(t){this.maxAttempts_=t},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(t){this.delayFactor_=t},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(t){this.fuzzFactor_=t},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(t){this.initialDelay_=t},e.createRetry=function(t){var n=t===void 0?{}:t,r=n.maxAttempts,i=n.delayFactor,a=n.fuzzFactor,o=n.initialDelay;return new a0({maxAttempts:r||this.maxAttempts_,delayFactor:i||this.delayFactor_,fuzzFactor:a||this.fuzzFactor_,initialDelay:o||this.initialDelay_})},s}(),a0=function(){function s(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=s.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var t=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+t},e.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},e.getCurrentDelay=function(){return this.currentDelay_},e.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},e.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},e.getCurrentFuzzedDelay=function(){var t=this.getCurrentMinPossibleDelay(),n=this.getCurrentMaxPossibleDelay();return t+Math.random()*(n-t)},s}(),o0=i0,l0=Qa,c0=function(s,e){return e===void 0&&(e=!1),function(t,n,r){if(t){s(t);return}if(n.statusCode>=400&&n.statusCode<=599){var i=r;if(e)if(l0.TextDecoder){var a=d0(n.headers&&n.headers["content-type"]);try{i=new TextDecoder(a).decode(r)}catch{}}else i=String.fromCharCode.apply(null,new Uint8Array(r));s({cause:i});return}s(null,r)}};function d0(s){return s===void 0&&(s=""),s.toLowerCase().split(";").reduce(function(e,t){var n=t.split("="),r=n[0],i=n[1];return r.trim()==="charset"?i.trim():e},"utf-8")}var u0=c0,Ep=Qa,h0=Qb,p0=Jb,wp=r0,m0=o0;He.httpHandler=u0;He.requestInterceptorsStorage=new wp;He.responseInterceptorsStorage=new wp;He.retryManager=new m0;/**
|
|
3
3
|
* @license
|
|
4
4
|
* slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
|
|
5
5
|
* Copyright (c) 2014 David Björklund
|
|
6
6
|
* Available under the MIT license
|
|
7
7
|
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
8
|
-
*/var
|
|
9
|
-
`).forEach(function(t){var n=t.indexOf(":"),r=t.slice(0,n).trim().toLowerCase(),i=t.slice(n+1).trim();typeof e[r]>"u"?e[r]=i:Array.isArray(e[r])?e[r].push(i):e[r]=[e[r],i]}),e};ac.exports=He;ac.exports.default=He;He.XMLHttpRequest=Ep.XMLHttpRequest||f0;He.XDomainRequest="withCredentials"in new He.XMLHttpRequest?He.XMLHttpRequest:Ep.XDomainRequest;h0(["get","put","post","patch","head","delete"],function(s){He[s==="delete"?"del":s]=function(e,t,n){return t=kp(e,t,n),t.method=s.toUpperCase(),oc(t)}});function h0(s,e){for(var t=0;t<s.length;t++)e(s[t])}function p0(s){for(var e in s)if(s.hasOwnProperty(e))return!1;return!0}function kp(s,e,t){var n=s;return c0(e)?(t=e,typeof s=="string"&&(n={uri:s})):n=l0({},e,{uri:s}),n.callback=t,n}function He(s,e,t){return e=kp(s,e,t),oc(e)}function oc(s){if(typeof s.callback>"u")throw new Error("callback argument missing");if(s.requestType&&He.requestInterceptorsStorage.getIsEnabled()){var e={uri:s.uri||s.url,headers:s.headers||{},body:s.body,metadata:s.metadata||{},retry:s.retry,timeout:s.timeout},t=He.requestInterceptorsStorage.execute(s.requestType,e);s.uri=t.uri,s.headers=t.headers,s.body=t.body,s.metadata=t.metadata,s.retry=t.retry,s.timeout=t.timeout}var n=!1,r=function(F,N,j){n||(n=!0,s.callback(F,N,j))};function i(){h.readyState===4&&!He.responseInterceptorsStorage.getIsEnabled()&&setTimeout(c,0)}function a(){var F=void 0;if(h.response?F=h.response:F=h.responseText||m0(h),L)try{F=JSON.parse(F)}catch{}return F}function o(F){if(clearTimeout(U),clearTimeout(s.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!_&&He.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=h,oc(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&He.responseInterceptorsStorage.getIsEnabled()){var N={headers:M.headers||{},body:M.body,responseUrl:h.responseURL,responseType:h.responseType},j=He.responseInterceptorsStorage.execute(s.requestType,N);M.body=j.body,M.headers=j.headers}return r(F,M)}function c(){if(!_){var F;clearTimeout(U),clearTimeout(s.retryTimeout),s.useXDR&&h.status===void 0?F=200:F=h.status===1223?204:h.status;var N=M,j=null;if(F!==0?(N={body:a(),statusCode:F,method:S,headers:{},url:T,rawRequest:h},h.getAllResponseHeaders&&(N.headers=u0(h.getAllResponseHeaders()))):j=new Error("Internal XMLHttpRequest Error"),s.requestType&&He.responseInterceptorsStorage.getIsEnabled()){var J={headers:N.headers||{},body:N.body,responseUrl:h.responseURL,responseType:h.responseType},K=He.responseInterceptorsStorage.execute(s.requestType,J);N.body=K.body,N.headers=K.headers}return r(j,N,N.body)}}var h=s.xhr||null;h||(s.cors||s.useXDR?h=new He.XDomainRequest:h=new He.XMLHttpRequest);var m,_,T=h.url=s.uri||s.url,S=h.method=s.method||"GET",w=s.body||s.data,b=h.headers=s.headers||{},R=!!s.sync,L=!1,U,M={body:void 0,headers:{},statusCode:0,method:S,url:T,rawRequest:h};if("json"in s&&s.json!==!1&&(L=!0,b.accept||b.Accept||(b.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(b["content-type"]||b["Content-Type"]||(b["Content-Type"]="application/json"),w=JSON.stringify(s.json===!0?w:s.json))),h.onreadystatechange=i,h.onload=c,h.onerror=o,h.onprogress=function(){},h.onabort=function(){_=!0,clearTimeout(s.retryTimeout)},h.ontimeout=o,h.open(S,T,!R,s.username,s.password),R||(h.withCredentials=!!s.withCredentials),!R&&s.timeout>0&&(U=setTimeout(function(){if(!_){_=!0,h.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",o(F)}},s.timeout)),h.setRequestHeader)for(m in b)b.hasOwnProperty(m)&&h.setRequestHeader(m,b[m]);else if(s.headers&&!p0(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(h.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(h),h.send(w||null),h}function m0(s){try{if(s.responseType==="document")return s.responseXML;var e=s.responseXML&&s.responseXML.documentElement.nodeName==="parsererror";if(s.responseType===""&&!e)return s.responseXML}catch{}return null}function f0(){}var g0=ac.exports;const Cp=or(g0);var Ip={exports:{}},lu=Ap,lc=Object.create||function(){function s(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return s.prototype=e,new s}}();function xt(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}xt.prototype=lc(Error.prototype);xt.prototype.constructor=xt;xt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function cc(s){function e(n,r,i,a){return(n|0)*3600+(r|0)*60+(i|0)+(a|0)/1e3}var t=s.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function Jr(){this.values=lc(null)}Jr.prototype={set:function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},get:function(s,e,t){return t?this.has(s)?this.values[s]:e[t]:this.has(s)?this.values[s]:e},has:function(s){return s in this.values},alt:function(s,e,t){for(var n=0;n<t.length;++n)if(e===t[n]){this.set(s,e);break}},integer:function(s,e){/^-?\d+$/.test(e)&&this.set(s,parseInt(e,10))},percent:function(s,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(s,e),!0):!1}};function Hr(s,e,t,n){var r=n?s.split(n):[s];for(var i in r)if(typeof r[i]=="string"){var a=r[i].split(t);if(a.length===2){var o=a[0].trim(),c=a[1].trim();e(o,c)}}}function y0(s,e,t){var n=s;function r(){var o=cc(s);if(o===null)throw new xt(xt.Errors.BadTimeStamp,"Malformed timestamp: "+n);return s=s.replace(/^[^\sa-zA-Z-]+/,""),o}function i(o,c){var h=new Jr;Hr(o,function(m,_){switch(m){case"region":for(var T=t.length-1;T>=0;T--)if(t[T].id===_){h.set(m,t[T].region);break}break;case"vertical":h.alt(m,_,["rl","lr"]);break;case"line":var S=_.split(","),w=S[0];h.integer(m,w),h.percent(m,w)&&h.set("snapToLines",!1),h.alt(m,w,["auto"]),S.length===2&&h.alt("lineAlign",S[1],["start","center","end"]);break;case"position":S=_.split(","),h.percent(m,S[0]),S.length===2&&h.alt("positionAlign",S[1],["start","center","end"]);break;case"size":h.percent(m,_);break;case"align":h.alt(m,_,["start","center","end","left","right"]);break}},/:/,/\s/),c.region=h.get("region",null),c.vertical=h.get("vertical","");try{c.line=h.get("line","auto")}catch{}c.lineAlign=h.get("lineAlign","start"),c.snapToLines=h.get("snapToLines",!0),c.size=h.get("size",100);try{c.align=h.get("align","center")}catch{c.align=h.get("align","middle")}try{c.position=h.get("position","auto")}catch{c.position=h.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},c.align)}c.positionAlign=h.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},c.align)}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),s.substr(0,3)!=="-->")throw new xt(xt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);s=s.substr(3),a(),e.endTime=r(),a(),i(s,e)}var Yo=lu.createElement&&lu.createElement("textarea"),_0={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},cu={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)"},v0={v:"title",lang:"lang"},du={rt:"ruby"};function xp(s,e){function t(){if(!e)return null;function w(R){return e=e.substr(R.length),R}var b=e.match(/^([^<]*)(<[^>]*>?)?/);return w(b[1]?b[1]:b[2])}function n(w){return Yo.innerHTML=w,w=Yo.textContent,Yo.textContent="",w}function r(w,b){return!du[b.localName]||du[b.localName]===w.localName}function i(w,b){var R=_0[w];if(!R)return null;var L=s.document.createElement(R),U=v0[w];return U&&b&&(L[U]=b.trim()),L}for(var a=s.document.createElement("div"),o=a,c,h=[];(c=t())!==null;){if(c[0]==="<"){if(c[1]==="/"){h.length&&h[h.length-1]===c.substr(2).replace(">","")&&(h.pop(),o=o.parentNode);continue}var m=cc(c.substr(1,c.length-2)),_;if(m){_=s.document.createProcessingInstruction("timestamp",m),o.appendChild(_);continue}var T=c.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!T||(_=i(T[1],T[3]),!_)||!r(o,_))continue;if(T[2]){var S=T[2].split(".");S.forEach(function(w){var b=/^bg_/.test(w),R=b?w.slice(3):w;if(cu.hasOwnProperty(R)){var L=b?"background-color":"color",U=cu[R];_.style[L]=U}}),_.className=S.join(" ")}h.push(T[1]),o.appendChild(_),o=_;continue}o.appendChild(s.document.createTextNode(n(c)))}return a}var uu=[[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 b0(s){for(var e=0;e<uu.length;e++){var t=uu[e];if(s>=t[0]&&s<=t[1])return!0}return!1}function T0(s){var e=[],t="",n;if(!s||!s.childNodes)return"ltr";function r(o,c){for(var h=c.childNodes.length-1;h>=0;h--)o.push(c.childNodes[h])}function i(o){if(!o||!o.length)return null;var c=o.pop(),h=c.textContent||c.innerText;if(h){var m=h.match(/^.*(\n|\r)/);return m?(o.length=0,m[0]):h}if(c.tagName==="ruby")return i(o);if(c.childNodes)return r(o,c),i(o)}for(r(e,s);t=i(e);)for(var a=0;a<t.length;a++)if(n=t.charCodeAt(a),b0(n))return"rtl";return"ltr"}function A0(s){if(typeof s.line=="number"&&(s.snapToLines||s.line>=0&&s.line<=100))return s.line;if(!s.track||!s.track.textTrackList||!s.track.textTrackList.mediaElement)return-1;for(var e=s.track,t=e.textTrackList,n=0,r=0;r<t.length&&t[r]!==e;r++)t[r].mode==="showing"&&n++;return++n*-1}function Za(){}Za.prototype.applyStyles=function(s,e){e=e||this.div;for(var t in s)s.hasOwnProperty(t)&&(e.style[t]=s[t])};Za.prototype.formatStyle=function(s,e){return s===0?0:s+e};function Sa(s,e,t){Za.call(this),this.cue=e,this.cueDiv=xp(s,e.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=s.document.createElement("div"),n={direction:T0(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:t.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(e.positionAlign){case"start":case"line-left":r=e.position;break;case"center":r=e.position-e.size/2;break;case"end":case"line-right":r=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(i){this.applyStyles({top:this.formatStyle(i.top,"px"),bottom:this.formatStyle(i.bottom,"px"),left:this.formatStyle(i.left,"px"),right:this.formatStyle(i.right,"px"),height:this.formatStyle(i.height,"px"),width:this.formatStyle(i.width,"px")})}}Sa.prototype=lc(Za.prototype);Sa.prototype.constructor=Sa;function yt(s){var e,t,n,r;if(s.div){t=s.div.offsetHeight,n=s.div.offsetWidth,r=s.div.offsetTop;var i=(i=s.div.childNodes)&&(i=i[0])&&i.getClientRects&&i.getClientRects();s=s.div.getBoundingClientRect(),e=i?Math.max(i[0]&&i[0].height||0,s.height/i.length):0}this.left=s.left,this.right=s.right,this.top=s.top||r,this.height=s.height||t,this.bottom=s.bottom||r+(s.height||t),this.width=s.width||n,this.lineHeight=e!==void 0?e:s.lineHeight}yt.prototype.move=function(s,e){switch(e=e!==void 0?e:this.lineHeight,s){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}};yt.prototype.overlaps=function(s){return this.left<s.right&&this.right>s.left&&this.top<s.bottom&&this.bottom>s.top};yt.prototype.overlapsAny=function(s){for(var e=0;e<s.length;e++)if(this.overlaps(s[e]))return!0;return!1};yt.prototype.within=function(s){return this.top>=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right};yt.prototype.overlapsOppositeAxis=function(s,e){switch(e){case"+x":return this.left<s.left;case"-x":return this.right>s.right;case"+y":return this.top<s.top;case"-y":return this.bottom>s.bottom}};yt.prototype.intersectPercentage=function(s){var e=Math.max(0,Math.min(this.right,s.right)-Math.max(this.left,s.left)),t=Math.max(0,Math.min(this.bottom,s.bottom)-Math.max(this.top,s.top)),n=e*t;return n/(this.height*this.width)};yt.prototype.toCSSCompatValues=function(s){return{top:this.top-s.top,bottom:s.bottom-this.bottom,left:this.left-s.left,right:s.right-this.right,height:this.height,width:this.width}};yt.getSimpleBoxPosition=function(s){var e=s.div?s.div.offsetHeight:s.tagName?s.offsetHeight:0,t=s.div?s.div.offsetWidth:s.tagName?s.offsetWidth:0,n=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var r={left:s.left,right:s.right,top:s.top||n,height:s.height||e,bottom:s.bottom||n+(s.height||e),width:s.width||t};return r};function S0(s,e,t,n){function r(R,L){for(var U,M=new yt(R),F=1,N=0;N<L.length;N++){for(;R.overlapsOppositeAxis(t,L[N])||R.within(t)&&R.overlapsAny(n);)R.move(L[N]);if(R.within(t))return R;var j=R.intersectPercentage(t);F>j&&(U=new yt(R),F=j),R=new yt(M)}return U||M}var i=new yt(e),a=e.cue,o=A0(a),c=[];if(a.snapToLines){var h;switch(a.vertical){case"":c=["+y","-y"],h="height";break;case"rl":c=["+x","-x"],h="width";break;case"lr":c=["-x","+x"],h="width";break}var m=i.lineHeight,_=m*Math.round(o),T=t[h]+m,S=c[0];Math.abs(_)>T&&(_=_<0?-1:1,_*=Math.ceil(T/m)*m),o<0&&(_+=a.vertical===""?t.height:t.width,c=c.reverse()),i.move(S,_)}else{var w=i.lineHeight/t.height*100;switch(a.lineAlign){case"center":o-=w/2;break;case"end":o-=w;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}c=["+y","-x","+x","-y"],i=new yt(e)}var b=r(i,c);e.move(b.toCSSCompatValues(t))}function lr(){}lr.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}};lr.convertCueToDOMTree=function(s,e){return!s||!e?null:xp(s,e)};var E0=.05,w0="sans-serif",k0="1.5%";lr.processCues=function(s,e,t){if(!s||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var n=s.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=k0,t.appendChild(n);function r(m){for(var _=0;_<m.length;_++)if(m[_].hasBeenReset||!m[_].displayState)return!0;return!1}if(!r(e)){for(var i=0;i<e.length;i++)n.appendChild(e[i].displayState);return}var a=[],o=yt.getSimpleBoxPosition(n),c=Math.round(o.height*E0*100)/100,h={font:c+"px "+w0};(function(){for(var m,_,T=0;T<e.length;T++)_=e[T],m=new Sa(s,_,h),n.appendChild(m.div),S0(s,m,o,a),_.displayState=m.div,a.push(yt.getSimpleBoxPosition(m))})()};lr.Parser=function(s,e,t){t||(t=e,e={}),e||(e={}),this.window=s,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};lr.Parser.prototype={reportOrThrowError:function(s){if(s instanceof xt)this.onparsingerror&&this.onparsingerror(s);else throw s},parse:function(s){var e=this;s&&(e.buffer+=e.decoder.decode(s,{stream:!0}));function t(){for(var m=e.buffer,_=0;_<m.length&&m[_]!=="\r"&&m[_]!==`
|
|
8
|
+
*/var f0=function(s){var e={};return s&&s.trim().split(`
|
|
9
|
+
`).forEach(function(t){var n=t.indexOf(":"),r=t.slice(0,n).trim().toLowerCase(),i=t.slice(n+1).trim();typeof e[r]>"u"?e[r]=i:Array.isArray(e[r])?e[r].push(i):e[r]=[e[r],i]}),e};ac.exports=He;ac.exports.default=He;He.XMLHttpRequest=Ep.XMLHttpRequest||v0;He.XDomainRequest="withCredentials"in new He.XMLHttpRequest?He.XMLHttpRequest:Ep.XDomainRequest;g0(["get","put","post","patch","head","delete"],function(s){He[s==="delete"?"del":s]=function(e,t,n){return t=kp(e,t,n),t.method=s.toUpperCase(),oc(t)}});function g0(s,e){for(var t=0;t<s.length;t++)e(s[t])}function y0(s){for(var e in s)if(s.hasOwnProperty(e))return!1;return!0}function kp(s,e,t){var n=s;return p0(e)?(t=e,typeof s=="string"&&(n={uri:s})):n=h0({},e,{uri:s}),n.callback=t,n}function He(s,e,t){return e=kp(s,e,t),oc(e)}function oc(s){if(typeof s.callback>"u")throw new Error("callback argument missing");if(s.requestType&&He.requestInterceptorsStorage.getIsEnabled()){var e={uri:s.uri||s.url,headers:s.headers||{},body:s.body,metadata:s.metadata||{},retry:s.retry,timeout:s.timeout},t=He.requestInterceptorsStorage.execute(s.requestType,e);s.uri=t.uri,s.headers=t.headers,s.body=t.body,s.metadata=t.metadata,s.retry=t.retry,s.timeout=t.timeout}var n=!1,r=function(F,N,j){n||(n=!0,s.callback(F,N,j))};function i(){h.readyState===4&&!He.responseInterceptorsStorage.getIsEnabled()&&setTimeout(c,0)}function a(){var F=void 0;if(h.response?F=h.response:F=h.responseText||_0(h),L)try{F=JSON.parse(F)}catch{}return F}function o(F){if(clearTimeout(U),clearTimeout(s.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!_&&He.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=h,oc(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&He.responseInterceptorsStorage.getIsEnabled()){var N={headers:M.headers||{},body:M.body,responseUrl:h.responseURL,responseType:h.responseType},j=He.responseInterceptorsStorage.execute(s.requestType,N);M.body=j.body,M.headers=j.headers}return r(F,M)}function c(){if(!_){var F;clearTimeout(U),clearTimeout(s.retryTimeout),s.useXDR&&h.status===void 0?F=200:F=h.status===1223?204:h.status;var N=M,j=null;if(F!==0?(N={body:a(),statusCode:F,method:S,headers:{},url:T,rawRequest:h},h.getAllResponseHeaders&&(N.headers=f0(h.getAllResponseHeaders()))):j=new Error("Internal XMLHttpRequest Error"),s.requestType&&He.responseInterceptorsStorage.getIsEnabled()){var J={headers:N.headers||{},body:N.body,responseUrl:h.responseURL,responseType:h.responseType},Y=He.responseInterceptorsStorage.execute(s.requestType,J);N.body=Y.body,N.headers=Y.headers}return r(j,N,N.body)}}var h=s.xhr||null;h||(s.cors||s.useXDR?h=new He.XDomainRequest:h=new He.XMLHttpRequest);var m,_,T=h.url=s.uri||s.url,S=h.method=s.method||"GET",w=s.body||s.data,b=h.headers=s.headers||{},R=!!s.sync,L=!1,U,M={body:void 0,headers:{},statusCode:0,method:S,url:T,rawRequest:h};if("json"in s&&s.json!==!1&&(L=!0,b.accept||b.Accept||(b.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(b["content-type"]||b["Content-Type"]||(b["Content-Type"]="application/json"),w=JSON.stringify(s.json===!0?w:s.json))),h.onreadystatechange=i,h.onload=c,h.onerror=o,h.onprogress=function(){},h.onabort=function(){_=!0,clearTimeout(s.retryTimeout)},h.ontimeout=o,h.open(S,T,!R,s.username,s.password),R||(h.withCredentials=!!s.withCredentials),!R&&s.timeout>0&&(U=setTimeout(function(){if(!_){_=!0,h.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",o(F)}},s.timeout)),h.setRequestHeader)for(m in b)b.hasOwnProperty(m)&&h.setRequestHeader(m,b[m]);else if(s.headers&&!y0(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(h.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(h),h.send(w||null),h}function _0(s){try{if(s.responseType==="document")return s.responseXML;var e=s.responseXML&&s.responseXML.documentElement.nodeName==="parsererror";if(s.responseType===""&&!e)return s.responseXML}catch{}return null}function v0(){}var b0=ac.exports;const Cp=or(b0);var Ip={exports:{}},uu=Ap,lc=Object.create||function(){function s(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return s.prototype=e,new s}}();function xt(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}xt.prototype=lc(Error.prototype);xt.prototype.constructor=xt;xt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function cc(s){function e(n,r,i,a){return(n|0)*3600+(r|0)*60+(i|0)+(a|0)/1e3}var t=s.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function Zr(){this.values=lc(null)}Zr.prototype={set:function(s,e){!this.get(s)&&e!==""&&(this.values[s]=e)},get:function(s,e,t){return t?this.has(s)?this.values[s]:e[t]:this.has(s)?this.values[s]:e},has:function(s){return s in this.values},alt:function(s,e,t){for(var n=0;n<t.length;++n)if(e===t[n]){this.set(s,e);break}},integer:function(s,e){/^-?\d+$/.test(e)&&this.set(s,parseInt(e,10))},percent:function(s,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(s,e),!0):!1}};function Hr(s,e,t,n){var r=n?s.split(n):[s];for(var i in r)if(typeof r[i]=="string"){var a=r[i].split(t);if(a.length===2){var o=a[0].trim(),c=a[1].trim();e(o,c)}}}function T0(s,e,t){var n=s;function r(){var o=cc(s);if(o===null)throw new xt(xt.Errors.BadTimeStamp,"Malformed timestamp: "+n);return s=s.replace(/^[^\sa-zA-Z-]+/,""),o}function i(o,c){var h=new Zr;Hr(o,function(m,_){switch(m){case"region":for(var T=t.length-1;T>=0;T--)if(t[T].id===_){h.set(m,t[T].region);break}break;case"vertical":h.alt(m,_,["rl","lr"]);break;case"line":var S=_.split(","),w=S[0];h.integer(m,w),h.percent(m,w)&&h.set("snapToLines",!1),h.alt(m,w,["auto"]),S.length===2&&h.alt("lineAlign",S[1],["start","center","end"]);break;case"position":S=_.split(","),h.percent(m,S[0]),S.length===2&&h.alt("positionAlign",S[1],["start","center","end"]);break;case"size":h.percent(m,_);break;case"align":h.alt(m,_,["start","center","end","left","right"]);break}},/:/,/\s/),c.region=h.get("region",null),c.vertical=h.get("vertical","");try{c.line=h.get("line","auto")}catch{}c.lineAlign=h.get("lineAlign","start"),c.snapToLines=h.get("snapToLines",!0),c.size=h.get("size",100);try{c.align=h.get("align","center")}catch{c.align=h.get("align","middle")}try{c.position=h.get("position","auto")}catch{c.position=h.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},c.align)}c.positionAlign=h.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},c.align)}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=r(),a(),s.substr(0,3)!=="-->")throw new xt(xt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+n);s=s.substr(3),a(),e.endTime=r(),a(),i(s,e)}var Yo=uu.createElement&&uu.createElement("textarea"),A0={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},hu={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)"},S0={v:"title",lang:"lang"},pu={rt:"ruby"};function xp(s,e){function t(){if(!e)return null;function w(R){return e=e.substr(R.length),R}var b=e.match(/^([^<]*)(<[^>]*>?)?/);return w(b[1]?b[1]:b[2])}function n(w){return Yo.innerHTML=w,w=Yo.textContent,Yo.textContent="",w}function r(w,b){return!pu[b.localName]||pu[b.localName]===w.localName}function i(w,b){var R=A0[w];if(!R)return null;var L=s.document.createElement(R),U=S0[w];return U&&b&&(L[U]=b.trim()),L}for(var a=s.document.createElement("div"),o=a,c,h=[];(c=t())!==null;){if(c[0]==="<"){if(c[1]==="/"){h.length&&h[h.length-1]===c.substr(2).replace(">","")&&(h.pop(),o=o.parentNode);continue}var m=cc(c.substr(1,c.length-2)),_;if(m){_=s.document.createProcessingInstruction("timestamp",m),o.appendChild(_);continue}var T=c.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!T||(_=i(T[1],T[3]),!_)||!r(o,_))continue;if(T[2]){var S=T[2].split(".");S.forEach(function(w){var b=/^bg_/.test(w),R=b?w.slice(3):w;if(hu.hasOwnProperty(R)){var L=b?"background-color":"color",U=hu[R];_.style[L]=U}}),_.className=S.join(" ")}h.push(T[1]),o.appendChild(_),o=_;continue}o.appendChild(s.document.createTextNode(n(c)))}return a}var mu=[[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 E0(s){for(var e=0;e<mu.length;e++){var t=mu[e];if(s>=t[0]&&s<=t[1])return!0}return!1}function w0(s){var e=[],t="",n;if(!s||!s.childNodes)return"ltr";function r(o,c){for(var h=c.childNodes.length-1;h>=0;h--)o.push(c.childNodes[h])}function i(o){if(!o||!o.length)return null;var c=o.pop(),h=c.textContent||c.innerText;if(h){var m=h.match(/^.*(\n|\r)/);return m?(o.length=0,m[0]):h}if(c.tagName==="ruby")return i(o);if(c.childNodes)return r(o,c),i(o)}for(r(e,s);t=i(e);)for(var a=0;a<t.length;a++)if(n=t.charCodeAt(a),E0(n))return"rtl";return"ltr"}function k0(s){if(typeof s.line=="number"&&(s.snapToLines||s.line>=0&&s.line<=100))return s.line;if(!s.track||!s.track.textTrackList||!s.track.textTrackList.mediaElement)return-1;for(var e=s.track,t=e.textTrackList,n=0,r=0;r<t.length&&t[r]!==e;r++)t[r].mode==="showing"&&n++;return++n*-1}function Ja(){}Ja.prototype.applyStyles=function(s,e){e=e||this.div;for(var t in s)s.hasOwnProperty(t)&&(e.style[t]=s[t])};Ja.prototype.formatStyle=function(s,e){return s===0?0:s+e};function Sa(s,e,t){Ja.call(this),this.cue=e,this.cueDiv=xp(s,e.text);var n={color:"rgba(255, 255, 255, 1)",backgroundColor:"rgba(0, 0, 0, 0.8)",position:"relative",left:0,right:0,top:0,bottom:0,display:"inline",writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(n,this.cueDiv),this.div=s.document.createElement("div"),n={direction:w0(this.cueDiv),writingMode:e.vertical===""?"horizontal-tb":e.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:e.align==="middle"?"center":e.align,font:t.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(n),this.div.appendChild(this.cueDiv);var r=0;switch(e.positionAlign){case"start":case"line-left":r=e.position;break;case"center":r=e.position-e.size/2;break;case"end":case"line-right":r=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(r,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(r,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(i){this.applyStyles({top:this.formatStyle(i.top,"px"),bottom:this.formatStyle(i.bottom,"px"),left:this.formatStyle(i.left,"px"),right:this.formatStyle(i.right,"px"),height:this.formatStyle(i.height,"px"),width:this.formatStyle(i.width,"px")})}}Sa.prototype=lc(Ja.prototype);Sa.prototype.constructor=Sa;function yt(s){var e,t,n,r;if(s.div){t=s.div.offsetHeight,n=s.div.offsetWidth,r=s.div.offsetTop;var i=(i=s.div.childNodes)&&(i=i[0])&&i.getClientRects&&i.getClientRects();s=s.div.getBoundingClientRect(),e=i?Math.max(i[0]&&i[0].height||0,s.height/i.length):0}this.left=s.left,this.right=s.right,this.top=s.top||r,this.height=s.height||t,this.bottom=s.bottom||r+(s.height||t),this.width=s.width||n,this.lineHeight=e!==void 0?e:s.lineHeight}yt.prototype.move=function(s,e){switch(e=e!==void 0?e:this.lineHeight,s){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}};yt.prototype.overlaps=function(s){return this.left<s.right&&this.right>s.left&&this.top<s.bottom&&this.bottom>s.top};yt.prototype.overlapsAny=function(s){for(var e=0;e<s.length;e++)if(this.overlaps(s[e]))return!0;return!1};yt.prototype.within=function(s){return this.top>=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right};yt.prototype.overlapsOppositeAxis=function(s,e){switch(e){case"+x":return this.left<s.left;case"-x":return this.right>s.right;case"+y":return this.top<s.top;case"-y":return this.bottom>s.bottom}};yt.prototype.intersectPercentage=function(s){var e=Math.max(0,Math.min(this.right,s.right)-Math.max(this.left,s.left)),t=Math.max(0,Math.min(this.bottom,s.bottom)-Math.max(this.top,s.top)),n=e*t;return n/(this.height*this.width)};yt.prototype.toCSSCompatValues=function(s){return{top:this.top-s.top,bottom:s.bottom-this.bottom,left:this.left-s.left,right:s.right-this.right,height:this.height,width:this.width}};yt.getSimpleBoxPosition=function(s){var e=s.div?s.div.offsetHeight:s.tagName?s.offsetHeight:0,t=s.div?s.div.offsetWidth:s.tagName?s.offsetWidth:0,n=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var r={left:s.left,right:s.right,top:s.top||n,height:s.height||e,bottom:s.bottom||n+(s.height||e),width:s.width||t};return r};function C0(s,e,t,n){function r(R,L){for(var U,M=new yt(R),F=1,N=0;N<L.length;N++){for(;R.overlapsOppositeAxis(t,L[N])||R.within(t)&&R.overlapsAny(n);)R.move(L[N]);if(R.within(t))return R;var j=R.intersectPercentage(t);F>j&&(U=new yt(R),F=j),R=new yt(M)}return U||M}var i=new yt(e),a=e.cue,o=k0(a),c=[];if(a.snapToLines){var h;switch(a.vertical){case"":c=["+y","-y"],h="height";break;case"rl":c=["+x","-x"],h="width";break;case"lr":c=["-x","+x"],h="width";break}var m=i.lineHeight,_=m*Math.round(o),T=t[h]+m,S=c[0];Math.abs(_)>T&&(_=_<0?-1:1,_*=Math.ceil(T/m)*m),o<0&&(_+=a.vertical===""?t.height:t.width,c=c.reverse()),i.move(S,_)}else{var w=i.lineHeight/t.height*100;switch(a.lineAlign){case"center":o-=w/2;break;case"end":o-=w;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(o,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(o,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(o,"%")});break}c=["+y","-x","+x","-y"],i=new yt(e)}var b=r(i,c);e.move(b.toCSSCompatValues(t))}function lr(){}lr.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}};lr.convertCueToDOMTree=function(s,e){return!s||!e?null:xp(s,e)};var I0=.05,x0="sans-serif",L0="1.5%";lr.processCues=function(s,e,t){if(!s||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var n=s.document.createElement("div");n.style.position="absolute",n.style.left="0",n.style.right="0",n.style.top="0",n.style.bottom="0",n.style.margin=L0,t.appendChild(n);function r(m){for(var _=0;_<m.length;_++)if(m[_].hasBeenReset||!m[_].displayState)return!0;return!1}if(!r(e)){for(var i=0;i<e.length;i++)n.appendChild(e[i].displayState);return}var a=[],o=yt.getSimpleBoxPosition(n),c=Math.round(o.height*I0*100)/100,h={font:c+"px "+x0};(function(){for(var m,_,T=0;T<e.length;T++)_=e[T],m=new Sa(s,_,h),n.appendChild(m.div),C0(s,m,o,a),_.displayState=m.div,a.push(yt.getSimpleBoxPosition(m))})()};lr.Parser=function(s,e,t){t||(t=e,e={}),e||(e={}),this.window=s,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};lr.Parser.prototype={reportOrThrowError:function(s){if(s instanceof xt)this.onparsingerror&&this.onparsingerror(s);else throw s},parse:function(s){var e=this;s&&(e.buffer+=e.decoder.decode(s,{stream:!0}));function t(){for(var m=e.buffer,_=0;_<m.length&&m[_]!=="\r"&&m[_]!==`
|
|
10
10
|
`;)++_;var T=m.substr(0,_);return m[_]==="\r"&&++_,m[_]===`
|
|
11
|
-
`&&++_,e.buffer=m.substr(_),T}function n(m){var _=new
|
|
11
|
+
`&&++_,e.buffer=m.substr(_),T}function n(m){var _=new Zr;if(Hr(m,function(S,w){switch(S){case"id":_.set(S,w);break;case"width":_.percent(S,w);break;case"lines":_.integer(S,w);break;case"regionanchor":case"viewportanchor":var b=w.split(",");if(b.length!==2)break;var R=new Zr;if(R.percent("x",b[0]),R.percent("y",b[1]),!R.has("x")||!R.has("y"))break;_.set(S+"X",R.get("x")),_.set(S+"Y",R.get("y"));break;case"scroll":_.alt(S,w,["up"]);break}},/=/,/\s/),_.has("id")){var T=new(e.vttjs.VTTRegion||e.window.VTTRegion);T.width=_.get("width",100),T.lines=_.get("lines",3),T.regionAnchorX=_.get("regionanchorX",0),T.regionAnchorY=_.get("regionanchorY",100),T.viewportAnchorX=_.get("viewportanchorX",0),T.viewportAnchorY=_.get("viewportanchorY",100),T.scroll=_.get("scroll",""),e.onregion&&e.onregion(T),e.regionList.push({id:_.get("id"),region:T})}}function r(m){var _=new Zr;Hr(m,function(T,S){switch(T){case"MPEGT":_.integer(T+"S",S);break;case"LOCA":_.set(T+"L",cc(S));break}},/[^\d]:/,/,/),e.ontimestampmap&&e.ontimestampmap({MPEGTS:_.get("MPEGTS"),LOCAL:_.get("LOCAL")})}function i(m){m.match(/X-TIMESTAMP-MAP/)?Hr(m,function(_,T){switch(_){case"X-TIMESTAMP-MAP":r(T);break}},/=/):Hr(m,function(_,T){switch(_){case"Region":n(T);break}},/:/)}try{var a;if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;a=t();var o=a.match(/^WEBVTT([ \t].*)?$/);if(!o||!o[0])throw new xt(xt.Errors.BadSignature);e.state="HEADER"}for(var c=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(c?c=!1:a=t(),e.state){case"HEADER":/:/.test(a)?i(a):a||(e.state="ID");continue;case"NOTE":a||(e.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(a)){e.state="NOTE";break}if(!a)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",a.indexOf("-->")===-1){e.cue.id=a;continue}case"CUE":try{T0(a,e.cue,e.regionList)}catch(m){e.reportOrThrowError(m),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var h=a.indexOf("-->")!==-1;if(!a||h&&(c=!0)){e.oncue&&e.oncue(e.cue),e.cue=null,e.state="ID";continue}e.cue.text&&(e.cue.text+=`
|
|
12
12
|
`),e.cue.text+=a.replace(/\u2028/g,`
|
|
13
13
|
`).replace(/u2029/g,`
|
|
14
14
|
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(m){e.reportOrThrowError(m),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 s=this;try{if(s.buffer+=s.decoder.decode(),(s.cue||s.state==="HEADER")&&(s.buffer+=`
|
|
15
15
|
|
|
16
|
-
`,s.parse()),s.state==="INITIAL")throw new xt(xt.Errors.BadSignature)}catch(e){s.reportOrThrowError(e)}return s.onflush&&s.onflush(),this}};var
|
|
16
|
+
`,s.parse()),s.state==="INITIAL")throw new xt(xt.Errors.BadSignature)}catch(e){s.reportOrThrowError(e)}return s.onflush&&s.onflush(),this}};var P0=lr,R0="auto",D0={"":1,lr:1,rl:1},N0={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function O0(s){if(typeof s!="string")return!1;var e=D0[s.toLowerCase()];return e?s.toLowerCase():!1}function Ko(s){if(typeof s!="string")return!1;var e=N0[s.toLowerCase()];return e?s.toLowerCase():!1}function Lp(s,e,t){this.hasBeenReset=!1;var n="",r=!1,i=s,a=e,o=t,c=null,h="",m=!0,_="auto",T="start",S="auto",w="auto",b=100,R="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return n},set:function(L){n=""+L}},pauseOnExit:{enumerable:!0,get:function(){return r},set:function(L){r=!!L}},startTime:{enumerable:!0,get:function(){return i},set:function(L){if(typeof L!="number")throw new TypeError("Start time must be set to a number.");i=L,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(L){if(typeof L!="number")throw new TypeError("End time must be set to a number.");a=L,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return o},set:function(L){o=""+L,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return c},set:function(L){c=L,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return h},set:function(L){var U=O0(L);if(U===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");h=U,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return m},set:function(L){m=!!L,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return _},set:function(L){if(typeof L!="number"&&L!==R0)throw new SyntaxError("Line: an invalid number or illegal string was specified.");_=L,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return T},set:function(L){var U=Ko(L);U?(T=U,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return S},set:function(L){if(L<0||L>100)throw new Error("Position must be between 0 and 100.");S=L,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return w},set:function(L){var U=Ko(L);U?(w=U,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return b},set:function(L){if(L<0||L>100)throw new Error("Size must be between 0 and 100.");b=L,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return R},set:function(L){var U=Ko(L);if(!U)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");R=U,this.hasBeenReset=!0}}}),this.displayState=void 0}Lp.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var M0=Lp,U0={"":!0,up:!0};function B0(s){if(typeof s!="string")return!1;var e=U0[s.toLowerCase()];return e?s.toLowerCase():!1}function Or(s){return typeof s=="number"&&s>=0&&s<=100}function F0(){var s=100,e=3,t=0,n=100,r=0,i=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return s},set:function(o){if(!Or(o))throw new Error("Width must be between 0 and 100.");s=o}},lines:{enumerable:!0,get:function(){return e},set:function(o){if(typeof o!="number")throw new TypeError("Lines must be set to a number.");e=o}},regionAnchorY:{enumerable:!0,get:function(){return n},set:function(o){if(!Or(o))throw new Error("RegionAnchorX must be between 0 and 100.");n=o}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(o){if(!Or(o))throw new Error("RegionAnchorY must be between 0 and 100.");t=o}},viewportAnchorY:{enumerable:!0,get:function(){return i},set:function(o){if(!Or(o))throw new Error("ViewportAnchorY must be between 0 and 100.");i=o}},viewportAnchorX:{enumerable:!0,get:function(){return r},set:function(o){if(!Or(o))throw new Error("ViewportAnchorX must be between 0 and 100.");r=o}},scroll:{enumerable:!0,get:function(){return a},set:function(o){var c=B0(o);c===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=c}}})}var j0=F0,As=Qa,gn=Ip.exports={WebVTT:P0,VTTCue:M0,VTTRegion:j0};As.vttjs=gn;As.WebVTT=gn.WebVTT;var q0=gn.VTTCue,V0=gn.VTTRegion,$0=As.VTTCue,H0=As.VTTRegion;gn.shim=function(){As.VTTCue=q0,As.VTTRegion=V0};gn.restore=function(){As.VTTCue=$0,As.VTTRegion=H0};As.VTTCue||gn.shim();var W0=Ip.exports;const fu=or(W0);function ze(){return ze=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},ze.apply(null,arguments)}var gu="https://example.com",Za=function(s,e){if(/^[a-z]+:/i.test(e))return e;/^data:/.test(s)&&(s=I.location&&I.location.href||"");var t=/^\/\//.test(s),n=!I.location&&!/\/\//i.test(s);s=new I.URL(s,I.location||gu);var r=new URL(e,s);return n?r.href.slice(gu.length):t?r.href.slice(r.protocol.length):r.href},dc=function(){function s(){this.listeners={}}var e=s.prototype;return e.on=function(t,n){this.listeners[t]||(this.listeners[t]=[]),this.listeners[t].push(n)},e.off=function(t,n){if(!this.listeners[t])return!1;var r=this.listeners[t].indexOf(n);return this.listeners[t]=this.listeners[t].slice(0),this.listeners[t].splice(r,1),r>-1},e.trigger=function(t){var n=this.listeners[t];if(n)if(arguments.length===2)for(var r=n.length,i=0;i<r;++i)n[i].call(this,arguments[1]);else for(var a=Array.prototype.slice.call(arguments,1),o=n.length,c=0;c<o;++c)n[c].apply(this,a)},e.dispose=function(){this.listeners={}},e.pipe=function(t){this.on("data",function(n){t.push(n)})},s}(),Pp={},eo={};eo.byteLength=X0;eo.toByteArray=K0;eo.fromByteArray=Z0;var es=[],Mt=[],z0=typeof Uint8Array<"u"?Uint8Array:Array,Qo="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var wn=0,G0=Qo.length;wn<G0;++wn)es[wn]=Qo[wn],Mt[Qo.charCodeAt(wn)]=wn;Mt[45]=62;Mt[95]=63;function Rp(s){var e=s.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=s.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function X0(s){var e=Rp(s),t=e[0],n=e[1];return(t+n)*3/4-n}function Y0(s,e,t){return(e+t)*3/4-t}function K0(s){var e,t=Rp(s),n=t[0],r=t[1],i=new z0(Y0(s,n,r)),a=0,o=r>0?n-4:n,c;for(c=0;c<o;c+=4)e=Mt[s.charCodeAt(c)]<<18|Mt[s.charCodeAt(c+1)]<<12|Mt[s.charCodeAt(c+2)]<<6|Mt[s.charCodeAt(c+3)],i[a++]=e>>16&255,i[a++]=e>>8&255,i[a++]=e&255;return r===2&&(e=Mt[s.charCodeAt(c)]<<2|Mt[s.charCodeAt(c+1)]>>4,i[a++]=e&255),r===1&&(e=Mt[s.charCodeAt(c)]<<10|Mt[s.charCodeAt(c+1)]<<4|Mt[s.charCodeAt(c+2)]>>2,i[a++]=e>>8&255,i[a++]=e&255),i}function Q0(s){return es[s>>18&63]+es[s>>12&63]+es[s>>6&63]+es[s&63]}function J0(s,e,t){for(var n,r=[],i=e;i<t;i+=3)n=(s[i]<<16&16711680)+(s[i+1]<<8&65280)+(s[i+2]&255),r.push(Q0(n));return r.join("")}function Z0(s){for(var e,t=s.length,n=t%3,r=[],i=16383,a=0,o=t-n;a<o;a+=i)r.push(J0(s,a,a+i>o?o:a+i));return n===1?(e=s[t-1],r.push(es[e>>2]+es[e<<4&63]+"==")):n===2&&(e=(s[t-2]<<8)+s[t-1],r.push(es[e>>10]+es[e>>4&63]+es[e<<2&63]+"=")),r.join("")}var uc={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */uc.read=function(s,e,t,n,r){var i,a,o=r*8-n-1,c=(1<<o)-1,h=c>>1,m=-7,_=t?r-1:0,T=t?-1:1,S=s[e+_];for(_+=T,i=S&(1<<-m)-1,S>>=-m,m+=o;m>0;i=i*256+s[e+_],_+=T,m-=8);for(a=i&(1<<-m)-1,i>>=-m,m+=n;m>0;a=a*256+s[e+_],_+=T,m-=8);if(i===0)i=1-h;else{if(i===c)return a?NaN:(S?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-h}return(S?-1:1)*a*Math.pow(2,i-n)};uc.write=function(s,e,t,n,r,i){var a,o,c,h=i*8-r-1,m=(1<<h)-1,_=m>>1,T=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=n?0:i-1,w=n?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=m):(a=Math.floor(Math.log(e)/Math.LN2),e*(c=Math.pow(2,-a))<1&&(a--,c*=2),a+_>=1?e+=T/c:e+=T*Math.pow(2,1-_),e*c>=2&&(a++,c/=2),a+_>=m?(o=0,a=m):a+_>=1?(o=(e*c-1)*Math.pow(2,r),a=a+_):(o=e*Math.pow(2,_-1)*Math.pow(2,r),a=0));r>=8;s[t+S]=o&255,S+=w,o/=256,r-=8);for(a=a<<r|o,h+=r;h>0;s[t+S]=a&255,S+=w,a/=256,h-=8);s[t+S-w]|=b*128};/*!
|
|
17
17
|
* The buffer module from node.js, for the browser.
|
|
18
18
|
*
|
|
19
19
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
20
20
|
* @license MIT
|
|
21
|
-
*/(function(s){const e=eo,t=uc,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=m,s.SlowBuffer=N,s.INSPECT_MAX_BYTES=50;const r=2147483647;s.kMaxLength=r;const{Uint8Array:i,ArrayBuffer:a,SharedArrayBuffer:o}=globalThis;m.TYPED_ARRAY_SUPPORT=c(),!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const f=new i(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,i.prototype),Object.setPrototypeOf(f,v),f.foo()===42}catch{return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.buffer}}),Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.byteOffset}});function h(f){if(f>r)throw new RangeError('The value "'+f+'" is invalid for option "size"');const v=new i(f);return Object.setPrototypeOf(v,m.prototype),v}function m(f,v,A){if(typeof f=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(f)}return _(f,v,A)}m.poolSize=8192;function _(f,v,A){if(typeof f=="string")return b(f,v);if(a.isView(f))return L(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(vt(f,a)||f&&vt(f.buffer,a)||typeof o<"u"&&(vt(f,o)||f&&vt(f.buffer,o)))return U(f,v,A);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const D=f.valueOf&&f.valueOf();if(D!=null&&D!==f)return m.from(D,v,A);const B=M(f);if(B)return B;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return m.from(f[Symbol.toPrimitive]("string"),v,A);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}m.from=function(f,v,A){return _(f,v,A)},Object.setPrototypeOf(m.prototype,i.prototype),Object.setPrototypeOf(m,i);function T(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function S(f,v,A){return T(f),f<=0?h(f):v!==void 0?typeof A=="string"?h(f).fill(v,A):h(f).fill(v):h(f)}m.alloc=function(f,v,A){return S(f,v,A)};function w(f){return T(f),h(f<0?0:F(f)|0)}m.allocUnsafe=function(f){return w(f)},m.allocUnsafeSlow=function(f){return w(f)};function b(f,v){if((typeof v!="string"||v==="")&&(v="utf8"),!m.isEncoding(v))throw new TypeError("Unknown encoding: "+v);const A=j(f,v)|0;let D=h(A);const B=D.write(f,v);return B!==A&&(D=D.slice(0,B)),D}function R(f){const v=f.length<0?0:F(f.length)|0,A=h(v);for(let D=0;D<v;D+=1)A[D]=f[D]&255;return A}function L(f){if(vt(f,i)){const v=new i(f);return U(v.buffer,v.byteOffset,v.byteLength)}return R(f)}function U(f,v,A){if(v<0||f.byteLength<v)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<v+(A||0))throw new RangeError('"length" is outside of buffer bounds');let D;return v===void 0&&A===void 0?D=new i(f):A===void 0?D=new i(f,v):D=new i(f,v,A),Object.setPrototypeOf(D,m.prototype),D}function M(f){if(m.isBuffer(f)){const v=F(f.length)|0,A=h(v);return A.length===0||f.copy(A,0,0,v),A}if(f.length!==void 0)return typeof f.length!="number"||Ys(f.length)?h(0):R(f);if(f.type==="Buffer"&&Array.isArray(f.data))return R(f.data)}function F(f){if(f>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return f|0}function N(f){return+f!=f&&(f=0),m.alloc(+f)}m.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==m.prototype},m.compare=function(f,v){if(vt(f,i)&&(f=m.from(f,f.offset,f.byteLength)),vt(v,i)&&(v=m.from(v,v.offset,v.byteLength)),!m.isBuffer(f)||!m.isBuffer(v))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===v)return 0;let A=f.length,D=v.length;for(let B=0,H=Math.min(A,D);B<H;++B)if(f[B]!==v[B]){A=f[B],D=v[B];break}return A<D?-1:D<A?1:0},m.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},m.concat=function(f,v){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return m.alloc(0);let A;if(v===void 0)for(v=0,A=0;A<f.length;++A)v+=f[A].length;const D=m.allocUnsafe(v);let B=0;for(A=0;A<f.length;++A){let H=f[A];if(vt(H,i))B+H.length>D.length?(m.isBuffer(H)||(H=m.from(H)),H.copy(D,B)):i.prototype.set.call(D,H,B);else if(m.isBuffer(H))H.copy(D,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=H.length}return D};function j(f,v){if(m.isBuffer(f))return f.length;if(a.isView(f)||vt(f,a))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const A=f.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&A===0)return 0;let B=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return A;case"utf8":case"utf-8":return _e(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A*2;case"hex":return A>>>1;case"base64":return ki(f).length;default:if(B)return D?-1:_e(f).length;v=(""+v).toLowerCase(),B=!0}}m.byteLength=j;function J(f,v,A){let D=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,v>>>=0,A<=v))return"";for(f||(f="utf8");;)switch(f){case"hex":return st(this,v,A);case"utf8":case"utf-8":return fe(this,v,A);case"ascii":return Oe(this,v,A);case"latin1":case"binary":return tt(this,v,A);case"base64":return G(this,v,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,v,A);default:if(D)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),D=!0}}m.prototype._isBuffer=!0;function K(f,v,A){const D=f[v];f[v]=f[A],f[A]=D}m.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let v=0;v<f;v+=2)K(this,v,v+1);return this},m.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let v=0;v<f;v+=4)K(this,v,v+3),K(this,v+1,v+2);return this},m.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let v=0;v<f;v+=8)K(this,v,v+7),K(this,v+1,v+6),K(this,v+2,v+5),K(this,v+3,v+4);return this},m.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?fe(this,0,f):J.apply(this,arguments)},m.prototype.toLocaleString=m.prototype.toString,m.prototype.equals=function(f){if(!m.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:m.compare(this,f)===0},m.prototype.inspect=function(){let f="";const v=s.INSPECT_MAX_BYTES;return f=this.toString("hex",0,v).replace(/(.{2})/g,"$1 ").trim(),this.length>v&&(f+=" ... "),"<Buffer "+f+">"},n&&(m.prototype[n]=m.prototype.inspect),m.prototype.compare=function(f,v,A,D,B){if(vt(f,i)&&(f=m.from(f,f.offset,f.byteLength)),!m.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(v===void 0&&(v=0),A===void 0&&(A=f?f.length:0),D===void 0&&(D=0),B===void 0&&(B=this.length),v<0||A>f.length||D<0||B>this.length)throw new RangeError("out of range index");if(D>=B&&v>=A)return 0;if(D>=B)return-1;if(v>=A)return 1;if(v>>>=0,A>>>=0,D>>>=0,B>>>=0,this===f)return 0;let H=B-D,Q=A-v;const ke=Math.min(H,Q),Xe=this.slice(D,B),xe=f.slice(v,A);for(let Ee=0;Ee<ke;++Ee)if(Xe[Ee]!==xe[Ee]){H=Xe[Ee],Q=xe[Ee];break}return H<Q?-1:Q<H?1:0};function ne(f,v,A,D,B){if(f.length===0)return-1;if(typeof A=="string"?(D=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,Ys(A)&&(A=B?0:f.length-1),A<0&&(A=f.length+A),A>=f.length){if(B)return-1;A=f.length-1}else if(A<0)if(B)A=0;else return-1;if(typeof v=="string"&&(v=m.from(v,D)),m.isBuffer(v))return v.length===0?-1:he(f,v,A,D,B);if(typeof v=="number")return v=v&255,typeof i.prototype.indexOf=="function"?B?i.prototype.indexOf.call(f,v,A):i.prototype.lastIndexOf.call(f,v,A):he(f,[v],A,D,B);throw new TypeError("val must be string, number or Buffer")}function he(f,v,A,D,B){let H=1,Q=f.length,ke=v.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(f.length<2||v.length<2)return-1;H=2,Q/=2,ke/=2,A/=2}function Xe(Ee,qe){return H===1?Ee[qe]:Ee.readUInt16BE(qe*H)}let xe;if(B){let Ee=-1;for(xe=A;xe<Q;xe++)if(Xe(f,xe)===Xe(v,Ee===-1?0:xe-Ee)){if(Ee===-1&&(Ee=xe),xe-Ee+1===ke)return Ee*H}else Ee!==-1&&(xe-=xe-Ee),Ee=-1}else for(A+ke>Q&&(A=Q-ke),xe=A;xe>=0;xe--){let Ee=!0;for(let qe=0;qe<ke;qe++)if(Xe(f,xe+qe)!==Xe(v,qe)){Ee=!1;break}if(Ee)return xe}return-1}m.prototype.includes=function(f,v,A){return this.indexOf(f,v,A)!==-1},m.prototype.indexOf=function(f,v,A){return ne(this,f,v,A,!0)},m.prototype.lastIndexOf=function(f,v,A){return ne(this,f,v,A,!1)};function oe(f,v,A,D){A=Number(A)||0;const B=f.length-A;D?(D=Number(D),D>B&&(D=B)):D=B;const H=v.length;D>H/2&&(D=H/2);let Q;for(Q=0;Q<D;++Q){const ke=parseInt(v.substr(Q*2,2),16);if(Ys(ke))return Q;f[A+Q]=ke}return Q}function me(f,v,A,D){return Ls(_e(v,f.length-A),f,A,D)}function te(f,v,A,D){return Ls(ko(v),f,A,D)}function ue(f,v,A,D){return Ls(ki(v),f,A,D)}function z(f,v,A,D){return Ls(vr(v,f.length-A),f,A,D)}m.prototype.write=function(f,v,A,D){if(v===void 0)D="utf8",A=this.length,v=0;else if(A===void 0&&typeof v=="string")D=v,A=this.length,v=0;else if(isFinite(v))v=v>>>0,isFinite(A)?(A=A>>>0,D===void 0&&(D="utf8")):(D=A,A=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const B=this.length-v;if((A===void 0||A>B)&&(A=B),f.length>0&&(A<0||v<0)||v>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");let H=!1;for(;;)switch(D){case"hex":return oe(this,f,v,A);case"utf8":case"utf-8":return me(this,f,v,A);case"ascii":case"latin1":case"binary":return te(this,f,v,A);case"base64":return ue(this,f,v,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,f,v,A);default:if(H)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),H=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function G(f,v,A){return v===0&&A===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(v,A))}function fe(f,v,A){A=Math.min(f.length,A);const D=[];let B=v;for(;B<A;){const H=f[B];let Q=null,ke=H>239?4:H>223?3:H>191?2:1;if(B+ke<=A){let Xe,xe,Ee,qe;switch(ke){case 1:H<128&&(Q=H);break;case 2:Xe=f[B+1],(Xe&192)===128&&(qe=(H&31)<<6|Xe&63,qe>127&&(Q=qe));break;case 3:Xe=f[B+1],xe=f[B+2],(Xe&192)===128&&(xe&192)===128&&(qe=(H&15)<<12|(Xe&63)<<6|xe&63,qe>2047&&(qe<55296||qe>57343)&&(Q=qe));break;case 4:Xe=f[B+1],xe=f[B+2],Ee=f[B+3],(Xe&192)===128&&(xe&192)===128&&(Ee&192)===128&&(qe=(H&15)<<18|(Xe&63)<<12|(xe&63)<<6|Ee&63,qe>65535&&qe<1114112&&(Q=qe))}}Q===null?(Q=65533,ke=1):Q>65535&&(Q-=65536,D.push(Q>>>10&1023|55296),Q=56320|Q&1023),D.push(Q),B+=ke}return Pe(D)}const ye=4096;function Pe(f){const v=f.length;if(v<=ye)return String.fromCharCode.apply(String,f);let A="",D=0;for(;D<v;)A+=String.fromCharCode.apply(String,f.slice(D,D+=ye));return A}function Oe(f,v,A){let D="";A=Math.min(f.length,A);for(let B=v;B<A;++B)D+=String.fromCharCode(f[B]&127);return D}function tt(f,v,A){let D="";A=Math.min(f.length,A);for(let B=v;B<A;++B)D+=String.fromCharCode(f[B]);return D}function st(f,v,A){const D=f.length;(!v||v<0)&&(v=0),(!A||A<0||A>D)&&(A=D);let B="";for(let H=v;H<A;++H)B+=bn[f[H]];return B}function ut(f,v,A){const D=f.slice(v,A);let B="";for(let H=0;H<D.length-1;H+=2)B+=String.fromCharCode(D[H]+D[H+1]*256);return B}m.prototype.slice=function(f,v){const A=this.length;f=~~f,v=v===void 0?A:~~v,f<0?(f+=A,f<0&&(f=0)):f>A&&(f=A),v<0?(v+=A,v<0&&(v=0)):v>A&&(v=A),v<f&&(v=f);const D=this.subarray(f,v);return Object.setPrototypeOf(D,m.prototype),D};function be(f,v,A){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+v>A)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f],B=1,H=0;for(;++H<v&&(B*=256);)D+=this[f+H]*B;return D},m.prototype.readUintBE=m.prototype.readUIntBE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f+--v],B=1;for(;v>0&&(B*=256);)D+=this[f+--v]*B;return D},m.prototype.readUint8=m.prototype.readUInt8=function(f,v){return f=f>>>0,v||be(f,1,this.length),this[f]},m.prototype.readUint16LE=m.prototype.readUInt16LE=function(f,v){return f=f>>>0,v||be(f,2,this.length),this[f]|this[f+1]<<8},m.prototype.readUint16BE=m.prototype.readUInt16BE=function(f,v){return f=f>>>0,v||be(f,2,this.length),this[f]<<8|this[f+1]},m.prototype.readUint32LE=m.prototype.readUInt32LE=function(f,v){return f=f>>>0,v||be(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},m.prototype.readUint32BE=m.prototype.readUInt32BE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},m.prototype.readBigUInt64LE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=v+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,B=this[++f]+this[++f]*2**8+this[++f]*2**16+A*2**24;return BigInt(D)+(BigInt(B)<<BigInt(32))}),m.prototype.readBigUInt64BE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=v*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],B=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+A;return(BigInt(D)<<BigInt(32))+BigInt(B)}),m.prototype.readIntLE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f],B=1,H=0;for(;++H<v&&(B*=256);)D+=this[f+H]*B;return B*=128,D>=B&&(D-=Math.pow(2,8*v)),D},m.prototype.readIntBE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=v,B=1,H=this[f+--D];for(;D>0&&(B*=256);)H+=this[f+--D]*B;return B*=128,H>=B&&(H-=Math.pow(2,8*v)),H},m.prototype.readInt8=function(f,v){return f=f>>>0,v||be(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},m.prototype.readInt16LE=function(f,v){f=f>>>0,v||be(f,2,this.length);const A=this[f]|this[f+1]<<8;return A&32768?A|4294901760:A},m.prototype.readInt16BE=function(f,v){f=f>>>0,v||be(f,2,this.length);const A=this[f+1]|this[f]<<8;return A&32768?A|4294901760:A},m.prototype.readInt32LE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},m.prototype.readInt32BE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},m.prototype.readBigInt64LE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(A<<24);return(BigInt(D)<<BigInt(32))+BigInt(v+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),m.prototype.readBigInt64BE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=(v<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(D)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+A)}),m.prototype.readFloatLE=function(f,v){return f=f>>>0,v||be(f,4,this.length),t.read(this,f,!0,23,4)},m.prototype.readFloatBE=function(f,v){return f=f>>>0,v||be(f,4,this.length),t.read(this,f,!1,23,4)},m.prototype.readDoubleLE=function(f,v){return f=f>>>0,v||be(f,8,this.length),t.read(this,f,!0,52,8)},m.prototype.readDoubleBE=function(f,v){return f=f>>>0,v||be(f,8,this.length),t.read(this,f,!1,52,8)};function Re(f,v,A,D,B,H){if(!m.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>B||v<H)throw new RangeError('"value" argument is out of bounds');if(A+D>f.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(f,v,A,D){if(f=+f,v=v>>>0,A=A>>>0,!D){const Q=Math.pow(2,8*A)-1;Re(this,f,v,A,Q,0)}let B=1,H=0;for(this[v]=f&255;++H<A&&(B*=256);)this[v+H]=f/B&255;return v+A},m.prototype.writeUintBE=m.prototype.writeUIntBE=function(f,v,A,D){if(f=+f,v=v>>>0,A=A>>>0,!D){const Q=Math.pow(2,8*A)-1;Re(this,f,v,A,Q,0)}let B=A-1,H=1;for(this[v+B]=f&255;--B>=0&&(H*=256);)this[v+B]=f/H&255;return v+A},m.prototype.writeUint8=m.prototype.writeUInt8=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,1,255,0),this[v]=f&255,v+1},m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,65535,0),this[v]=f&255,this[v+1]=f>>>8,v+2},m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,65535,0),this[v]=f>>>8,this[v+1]=f&255,v+2},m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,4294967295,0),this[v+3]=f>>>24,this[v+2]=f>>>16,this[v+1]=f>>>8,this[v]=f&255,v+4},m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,4294967295,0),this[v]=f>>>24,this[v+1]=f>>>16,this[v+2]=f>>>8,this[v+3]=f&255,v+4};function ps(f,v,A,D,B){wi(v,D,B,f,A,7);let H=Number(v&BigInt(4294967295));f[A++]=H,H=H>>8,f[A++]=H,H=H>>8,f[A++]=H,H=H>>8,f[A++]=H;let Q=Number(v>>BigInt(32)&BigInt(4294967295));return f[A++]=Q,Q=Q>>8,f[A++]=Q,Q=Q>>8,f[A++]=Q,Q=Q>>8,f[A++]=Q,A}function Gs(f,v,A,D,B){wi(v,D,B,f,A,7);let H=Number(v&BigInt(4294967295));f[A+7]=H,H=H>>8,f[A+6]=H,H=H>>8,f[A+5]=H,H=H>>8,f[A+4]=H;let Q=Number(v>>BigInt(32)&BigInt(4294967295));return f[A+3]=Q,Q=Q>>8,f[A+2]=Q,Q=Q>>8,f[A+1]=Q,Q=Q>>8,f[A]=Q,A+8}m.prototype.writeBigUInt64LE=Dt(function(f,v=0){return ps(this,f,v,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeBigUInt64BE=Dt(function(f,v=0){return Gs(this,f,v,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeIntLE=function(f,v,A,D){if(f=+f,v=v>>>0,!D){const ke=Math.pow(2,8*A-1);Re(this,f,v,A,ke-1,-ke)}let B=0,H=1,Q=0;for(this[v]=f&255;++B<A&&(H*=256);)f<0&&Q===0&&this[v+B-1]!==0&&(Q=1),this[v+B]=(f/H>>0)-Q&255;return v+A},m.prototype.writeIntBE=function(f,v,A,D){if(f=+f,v=v>>>0,!D){const ke=Math.pow(2,8*A-1);Re(this,f,v,A,ke-1,-ke)}let B=A-1,H=1,Q=0;for(this[v+B]=f&255;--B>=0&&(H*=256);)f<0&&Q===0&&this[v+B+1]!==0&&(Q=1),this[v+B]=(f/H>>0)-Q&255;return v+A},m.prototype.writeInt8=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,1,127,-128),f<0&&(f=255+f+1),this[v]=f&255,v+1},m.prototype.writeInt16LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,32767,-32768),this[v]=f&255,this[v+1]=f>>>8,v+2},m.prototype.writeInt16BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,32767,-32768),this[v]=f>>>8,this[v+1]=f&255,v+2},m.prototype.writeInt32LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,2147483647,-2147483648),this[v]=f&255,this[v+1]=f>>>8,this[v+2]=f>>>16,this[v+3]=f>>>24,v+4},m.prototype.writeInt32BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[v]=f>>>24,this[v+1]=f>>>16,this[v+2]=f>>>8,this[v+3]=f&255,v+4},m.prototype.writeBigInt64LE=Dt(function(f,v=0){return ps(this,f,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),m.prototype.writeBigInt64BE=Dt(function(f,v=0){return Gs(this,f,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ms(f,v,A,D,B,H){if(A+D>f.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("Index out of range")}function Gt(f,v,A,D,B){return v=+v,A=A>>>0,B||ms(f,v,A,4),t.write(f,v,A,D,23,4),A+4}m.prototype.writeFloatLE=function(f,v,A){return Gt(this,f,v,!0,A)},m.prototype.writeFloatBE=function(f,v,A){return Gt(this,f,v,!1,A)};function Cs(f,v,A,D,B){return v=+v,A=A>>>0,B||ms(f,v,A,8),t.write(f,v,A,D,52,8),A+8}m.prototype.writeDoubleLE=function(f,v,A){return Cs(this,f,v,!0,A)},m.prototype.writeDoubleBE=function(f,v,A){return Cs(this,f,v,!1,A)},m.prototype.copy=function(f,v,A,D){if(!m.isBuffer(f))throw new TypeError("argument should be a Buffer");if(A||(A=0),!D&&D!==0&&(D=this.length),v>=f.length&&(v=f.length),v||(v=0),D>0&&D<A&&(D=A),D===A||f.length===0||this.length===0)return 0;if(v<0)throw new RangeError("targetStart out of bounds");if(A<0||A>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),f.length-v<D-A&&(D=f.length-v+A);const B=D-A;return this===f&&typeof i.prototype.copyWithin=="function"?this.copyWithin(v,A,D):i.prototype.set.call(f,this.subarray(A,D),v),B},m.prototype.fill=function(f,v,A,D){if(typeof f=="string"){if(typeof v=="string"?(D=v,v=0,A=this.length):typeof A=="string"&&(D=A,A=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!m.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(f.length===1){const H=f.charCodeAt(0);(D==="utf8"&&H<128||D==="latin1")&&(f=H)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(v<0||this.length<v||this.length<A)throw new RangeError("Out of range index");if(A<=v)return this;v=v>>>0,A=A===void 0?this.length:A>>>0,f||(f=0);let B;if(typeof f=="number")for(B=v;B<A;++B)this[B]=f;else{const H=m.isBuffer(f)?f:m.from(f,D),Q=H.length;if(Q===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<A-v;++B)this[B+v]=H[B%Q]}return this};const Is={};function vn(f,v,A){Is[f]=class extends A{constructor(){super(),Object.defineProperty(this,"message",{value:v.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(D){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:D,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}vn("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),vn("ERR_INVALID_ARG_TYPE",function(f,v){return`The "${f}" argument must be of type number. Received type ${typeof v}`},TypeError),vn("ERR_OUT_OF_RANGE",function(f,v,A){let D=`The value of "${f}" is out of range.`,B=A;return Number.isInteger(A)&&Math.abs(A)>2**32?B=Ei(String(A)):typeof A=="bigint"&&(B=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(B=Ei(B)),B+="n"),D+=` It must be ${v}. Received ${B}`,D},RangeError);function Ei(f){let v="",A=f.length;const D=f[0]==="-"?1:0;for(;A>=D+4;A-=3)v=`_${f.slice(A-3,A)}${v}`;return`${f.slice(0,A)}${v}`}function wo(f,v,A){xs(v,"offset"),(f[v]===void 0||f[v+A]===void 0)&&Xs(v,f.length-(A+1))}function wi(f,v,A,D,B,H){if(f>A||f<v){const Q=typeof v=="bigint"?"n":"";let ke;throw v===0||v===BigInt(0)?ke=`>= 0${Q} and < 2${Q} ** ${(H+1)*8}${Q}`:ke=`>= -(2${Q} ** ${(H+1)*8-1}${Q}) and < 2 ** ${(H+1)*8-1}${Q}`,new Is.ERR_OUT_OF_RANGE("value",ke,f)}wo(D,B,H)}function xs(f,v){if(typeof f!="number")throw new Is.ERR_INVALID_ARG_TYPE(v,"number",f)}function Xs(f,v,A){throw Math.floor(f)!==f?(xs(f,A),new Is.ERR_OUT_OF_RANGE("offset","an integer",f)):v<0?new Is.ERR_BUFFER_OUT_OF_BOUNDS:new Is.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${v}`,f)}const Xt=/[^+/0-9A-Za-z-_]/g;function _r(f){if(f=f.split("=")[0],f=f.trim().replace(Xt,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function _e(f,v){v=v||1/0;let A;const D=f.length;let B=null;const H=[];for(let Q=0;Q<D;++Q){if(A=f.charCodeAt(Q),A>55295&&A<57344){if(!B){if(A>56319){(v-=3)>-1&&H.push(239,191,189);continue}else if(Q+1===D){(v-=3)>-1&&H.push(239,191,189);continue}B=A;continue}if(A<56320){(v-=3)>-1&&H.push(239,191,189),B=A;continue}A=(B-55296<<10|A-56320)+65536}else B&&(v-=3)>-1&&H.push(239,191,189);if(B=null,A<128){if((v-=1)<0)break;H.push(A)}else if(A<2048){if((v-=2)<0)break;H.push(A>>6|192,A&63|128)}else if(A<65536){if((v-=3)<0)break;H.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((v-=4)<0)break;H.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error("Invalid code point")}return H}function ko(f){const v=[];for(let A=0;A<f.length;++A)v.push(f.charCodeAt(A)&255);return v}function vr(f,v){let A,D,B;const H=[];for(let Q=0;Q<f.length&&!((v-=2)<0);++Q)A=f.charCodeAt(Q),D=A>>8,B=A%256,H.push(B),H.push(D);return H}function ki(f){return e.toByteArray(_r(f))}function Ls(f,v,A,D){let B;for(B=0;B<D&&!(B+A>=v.length||B>=f.length);++B)v[B+A]=f[B];return B}function vt(f,v){return f instanceof v||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===v.name}function Ys(f){return f!==f}const bn=function(){const f="0123456789abcdef",v=new Array(256);for(let A=0;A<16;++A){const D=A*16;for(let B=0;B<16;++B)v[D+B]=f[A]+f[B]}return v}();function Dt(f){return typeof BigInt>"u"?Ci:f}function Ci(){throw new Error("BigInt not supported")}})(Pp);const K0=Pp.Buffer;var Q0=function(s){return I.atob?I.atob(s):K0.from(s,"base64").toString("binary")};function Dp(s){for(var e=Q0(s),t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class Z0 extends dc{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
21
|
+
*/(function(s){const e=eo,t=uc,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=m,s.SlowBuffer=N,s.INSPECT_MAX_BYTES=50;const r=2147483647;s.kMaxLength=r;const{Uint8Array:i,ArrayBuffer:a,SharedArrayBuffer:o}=globalThis;m.TYPED_ARRAY_SUPPORT=c(),!m.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function c(){try{const f=new i(1),v={foo:function(){return 42}};return Object.setPrototypeOf(v,i.prototype),Object.setPrototypeOf(f,v),f.foo()===42}catch{return!1}}Object.defineProperty(m.prototype,"parent",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.buffer}}),Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.byteOffset}});function h(f){if(f>r)throw new RangeError('The value "'+f+'" is invalid for option "size"');const v=new i(f);return Object.setPrototypeOf(v,m.prototype),v}function m(f,v,A){if(typeof f=="number"){if(typeof v=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return w(f)}return _(f,v,A)}m.poolSize=8192;function _(f,v,A){if(typeof f=="string")return b(f,v);if(a.isView(f))return L(f);if(f==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f);if(vt(f,a)||f&&vt(f.buffer,a)||typeof o<"u"&&(vt(f,o)||f&&vt(f.buffer,o)))return U(f,v,A);if(typeof f=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const D=f.valueOf&&f.valueOf();if(D!=null&&D!==f)return m.from(D,v,A);const B=M(f);if(B)return B;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof f[Symbol.toPrimitive]=="function")return m.from(f[Symbol.toPrimitive]("string"),v,A);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof f)}m.from=function(f,v,A){return _(f,v,A)},Object.setPrototypeOf(m.prototype,i.prototype),Object.setPrototypeOf(m,i);function T(f){if(typeof f!="number")throw new TypeError('"size" argument must be of type number');if(f<0)throw new RangeError('The value "'+f+'" is invalid for option "size"')}function S(f,v,A){return T(f),f<=0?h(f):v!==void 0?typeof A=="string"?h(f).fill(v,A):h(f).fill(v):h(f)}m.alloc=function(f,v,A){return S(f,v,A)};function w(f){return T(f),h(f<0?0:F(f)|0)}m.allocUnsafe=function(f){return w(f)},m.allocUnsafeSlow=function(f){return w(f)};function b(f,v){if((typeof v!="string"||v==="")&&(v="utf8"),!m.isEncoding(v))throw new TypeError("Unknown encoding: "+v);const A=j(f,v)|0;let D=h(A);const B=D.write(f,v);return B!==A&&(D=D.slice(0,B)),D}function R(f){const v=f.length<0?0:F(f.length)|0,A=h(v);for(let D=0;D<v;D+=1)A[D]=f[D]&255;return A}function L(f){if(vt(f,i)){const v=new i(f);return U(v.buffer,v.byteOffset,v.byteLength)}return R(f)}function U(f,v,A){if(v<0||f.byteLength<v)throw new RangeError('"offset" is outside of buffer bounds');if(f.byteLength<v+(A||0))throw new RangeError('"length" is outside of buffer bounds');let D;return v===void 0&&A===void 0?D=new i(f):A===void 0?D=new i(f,v):D=new i(f,v,A),Object.setPrototypeOf(D,m.prototype),D}function M(f){if(m.isBuffer(f)){const v=F(f.length)|0,A=h(v);return A.length===0||f.copy(A,0,0,v),A}if(f.length!==void 0)return typeof f.length!="number"||Ys(f.length)?h(0):R(f);if(f.type==="Buffer"&&Array.isArray(f.data))return R(f.data)}function F(f){if(f>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return f|0}function N(f){return+f!=f&&(f=0),m.alloc(+f)}m.isBuffer=function(f){return f!=null&&f._isBuffer===!0&&f!==m.prototype},m.compare=function(f,v){if(vt(f,i)&&(f=m.from(f,f.offset,f.byteLength)),vt(v,i)&&(v=m.from(v,v.offset,v.byteLength)),!m.isBuffer(f)||!m.isBuffer(v))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(f===v)return 0;let A=f.length,D=v.length;for(let B=0,H=Math.min(A,D);B<H;++B)if(f[B]!==v[B]){A=f[B],D=v[B];break}return A<D?-1:D<A?1:0},m.isEncoding=function(f){switch(String(f).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},m.concat=function(f,v){if(!Array.isArray(f))throw new TypeError('"list" argument must be an Array of Buffers');if(f.length===0)return m.alloc(0);let A;if(v===void 0)for(v=0,A=0;A<f.length;++A)v+=f[A].length;const D=m.allocUnsafe(v);let B=0;for(A=0;A<f.length;++A){let H=f[A];if(vt(H,i))B+H.length>D.length?(m.isBuffer(H)||(H=m.from(H)),H.copy(D,B)):i.prototype.set.call(D,H,B);else if(m.isBuffer(H))H.copy(D,B);else throw new TypeError('"list" argument must be an Array of Buffers');B+=H.length}return D};function j(f,v){if(m.isBuffer(f))return f.length;if(a.isView(f)||vt(f,a))return f.byteLength;if(typeof f!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof f);const A=f.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&A===0)return 0;let B=!1;for(;;)switch(v){case"ascii":case"latin1":case"binary":return A;case"utf8":case"utf-8":return _e(f).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A*2;case"hex":return A>>>1;case"base64":return ki(f).length;default:if(B)return D?-1:_e(f).length;v=(""+v).toLowerCase(),B=!0}}m.byteLength=j;function J(f,v,A){let D=!1;if((v===void 0||v<0)&&(v=0),v>this.length||((A===void 0||A>this.length)&&(A=this.length),A<=0)||(A>>>=0,v>>>=0,A<=v))return"";for(f||(f="utf8");;)switch(f){case"hex":return st(this,v,A);case"utf8":case"utf-8":return ce(this,v,A);case"ascii":return Oe(this,v,A);case"latin1":case"binary":return tt(this,v,A);case"base64":return ee(this,v,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,v,A);default:if(D)throw new TypeError("Unknown encoding: "+f);f=(f+"").toLowerCase(),D=!0}}m.prototype._isBuffer=!0;function Y(f,v,A){const D=f[v];f[v]=f[A],f[A]=D}m.prototype.swap16=function(){const f=this.length;if(f%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let v=0;v<f;v+=2)Y(this,v,v+1);return this},m.prototype.swap32=function(){const f=this.length;if(f%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let v=0;v<f;v+=4)Y(this,v,v+3),Y(this,v+1,v+2);return this},m.prototype.swap64=function(){const f=this.length;if(f%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let v=0;v<f;v+=8)Y(this,v,v+7),Y(this,v+1,v+6),Y(this,v+2,v+5),Y(this,v+3,v+4);return this},m.prototype.toString=function(){const f=this.length;return f===0?"":arguments.length===0?ce(this,0,f):J.apply(this,arguments)},m.prototype.toLocaleString=m.prototype.toString,m.prototype.equals=function(f){if(!m.isBuffer(f))throw new TypeError("Argument must be a Buffer");return this===f?!0:m.compare(this,f)===0},m.prototype.inspect=function(){let f="";const v=s.INSPECT_MAX_BYTES;return f=this.toString("hex",0,v).replace(/(.{2})/g,"$1 ").trim(),this.length>v&&(f+=" ... "),"<Buffer "+f+">"},n&&(m.prototype[n]=m.prototype.inspect),m.prototype.compare=function(f,v,A,D,B){if(vt(f,i)&&(f=m.from(f,f.offset,f.byteLength)),!m.isBuffer(f))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof f);if(v===void 0&&(v=0),A===void 0&&(A=f?f.length:0),D===void 0&&(D=0),B===void 0&&(B=this.length),v<0||A>f.length||D<0||B>this.length)throw new RangeError("out of range index");if(D>=B&&v>=A)return 0;if(D>=B)return-1;if(v>=A)return 1;if(v>>>=0,A>>>=0,D>>>=0,B>>>=0,this===f)return 0;let H=B-D,K=A-v;const ke=Math.min(H,K),Ye=this.slice(D,B),xe=f.slice(v,A);for(let Ee=0;Ee<ke;++Ee)if(Ye[Ee]!==xe[Ee]){H=Ye[Ee],K=xe[Ee];break}return H<K?-1:K<H?1:0};function re(f,v,A,D,B){if(f.length===0)return-1;if(typeof A=="string"?(D=A,A=0):A>2147483647?A=2147483647:A<-2147483648&&(A=-2147483648),A=+A,Ys(A)&&(A=B?0:f.length-1),A<0&&(A=f.length+A),A>=f.length){if(B)return-1;A=f.length-1}else if(A<0)if(B)A=0;else return-1;if(typeof v=="string"&&(v=m.from(v,D)),m.isBuffer(v))return v.length===0?-1:me(f,v,A,D,B);if(typeof v=="number")return v=v&255,typeof i.prototype.indexOf=="function"?B?i.prototype.indexOf.call(f,v,A):i.prototype.lastIndexOf.call(f,v,A):me(f,[v],A,D,B);throw new TypeError("val must be string, number or Buffer")}function me(f,v,A,D,B){let H=1,K=f.length,ke=v.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(f.length<2||v.length<2)return-1;H=2,K/=2,ke/=2,A/=2}function Ye(Ee,qe){return H===1?Ee[qe]:Ee.readUInt16BE(qe*H)}let xe;if(B){let Ee=-1;for(xe=A;xe<K;xe++)if(Ye(f,xe)===Ye(v,Ee===-1?0:xe-Ee)){if(Ee===-1&&(Ee=xe),xe-Ee+1===ke)return Ee*H}else Ee!==-1&&(xe-=xe-Ee),Ee=-1}else for(A+ke>K&&(A=K-ke),xe=A;xe>=0;xe--){let Ee=!0;for(let qe=0;qe<ke;qe++)if(Ye(f,xe+qe)!==Ye(v,qe)){Ee=!1;break}if(Ee)return xe}return-1}m.prototype.includes=function(f,v,A){return this.indexOf(f,v,A)!==-1},m.prototype.indexOf=function(f,v,A){return re(this,f,v,A,!0)},m.prototype.lastIndexOf=function(f,v,A){return re(this,f,v,A,!1)};function le(f,v,A,D){A=Number(A)||0;const B=f.length-A;D?(D=Number(D),D>B&&(D=B)):D=B;const H=v.length;D>H/2&&(D=H/2);let K;for(K=0;K<D;++K){const ke=parseInt(v.substr(K*2,2),16);if(Ys(ke))return K;f[A+K]=ke}return K}function ge(f,v,A,D){return Ls(_e(v,f.length-A),f,A,D)}function se(f,v,A,D){return Ls(ko(v),f,A,D)}function he(f,v,A,D){return Ls(ki(v),f,A,D)}function z(f,v,A,D){return Ls(vr(v,f.length-A),f,A,D)}m.prototype.write=function(f,v,A,D){if(v===void 0)D="utf8",A=this.length,v=0;else if(A===void 0&&typeof v=="string")D=v,A=this.length,v=0;else if(isFinite(v))v=v>>>0,isFinite(A)?(A=A>>>0,D===void 0&&(D="utf8")):(D=A,A=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const B=this.length-v;if((A===void 0||A>B)&&(A=B),f.length>0&&(A<0||v<0)||v>this.length)throw new RangeError("Attempt to write outside buffer bounds");D||(D="utf8");let H=!1;for(;;)switch(D){case"hex":return le(this,f,v,A);case"utf8":case"utf-8":return ge(this,f,v,A);case"ascii":case"latin1":case"binary":return se(this,f,v,A);case"base64":return he(this,f,v,A);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,f,v,A);default:if(H)throw new TypeError("Unknown encoding: "+D);D=(""+D).toLowerCase(),H=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function ee(f,v,A){return v===0&&A===f.length?e.fromByteArray(f):e.fromByteArray(f.slice(v,A))}function ce(f,v,A){A=Math.min(f.length,A);const D=[];let B=v;for(;B<A;){const H=f[B];let K=null,ke=H>239?4:H>223?3:H>191?2:1;if(B+ke<=A){let Ye,xe,Ee,qe;switch(ke){case 1:H<128&&(K=H);break;case 2:Ye=f[B+1],(Ye&192)===128&&(qe=(H&31)<<6|Ye&63,qe>127&&(K=qe));break;case 3:Ye=f[B+1],xe=f[B+2],(Ye&192)===128&&(xe&192)===128&&(qe=(H&15)<<12|(Ye&63)<<6|xe&63,qe>2047&&(qe<55296||qe>57343)&&(K=qe));break;case 4:Ye=f[B+1],xe=f[B+2],Ee=f[B+3],(Ye&192)===128&&(xe&192)===128&&(Ee&192)===128&&(qe=(H&15)<<18|(Ye&63)<<12|(xe&63)<<6|Ee&63,qe>65535&&qe<1114112&&(K=qe))}}K===null?(K=65533,ke=1):K>65535&&(K-=65536,D.push(K>>>10&1023|55296),K=56320|K&1023),D.push(K),B+=ke}return Pe(D)}const ne=4096;function Pe(f){const v=f.length;if(v<=ne)return String.fromCharCode.apply(String,f);let A="",D=0;for(;D<v;)A+=String.fromCharCode.apply(String,f.slice(D,D+=ne));return A}function Oe(f,v,A){let D="";A=Math.min(f.length,A);for(let B=v;B<A;++B)D+=String.fromCharCode(f[B]&127);return D}function tt(f,v,A){let D="";A=Math.min(f.length,A);for(let B=v;B<A;++B)D+=String.fromCharCode(f[B]);return D}function st(f,v,A){const D=f.length;(!v||v<0)&&(v=0),(!A||A<0||A>D)&&(A=D);let B="";for(let H=v;H<A;++H)B+=bn[f[H]];return B}function ut(f,v,A){const D=f.slice(v,A);let B="";for(let H=0;H<D.length-1;H+=2)B+=String.fromCharCode(D[H]+D[H+1]*256);return B}m.prototype.slice=function(f,v){const A=this.length;f=~~f,v=v===void 0?A:~~v,f<0?(f+=A,f<0&&(f=0)):f>A&&(f=A),v<0?(v+=A,v<0&&(v=0)):v>A&&(v=A),v<f&&(v=f);const D=this.subarray(f,v);return Object.setPrototypeOf(D,m.prototype),D};function be(f,v,A){if(f%1!==0||f<0)throw new RangeError("offset is not uint");if(f+v>A)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f],B=1,H=0;for(;++H<v&&(B*=256);)D+=this[f+H]*B;return D},m.prototype.readUintBE=m.prototype.readUIntBE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f+--v],B=1;for(;v>0&&(B*=256);)D+=this[f+--v]*B;return D},m.prototype.readUint8=m.prototype.readUInt8=function(f,v){return f=f>>>0,v||be(f,1,this.length),this[f]},m.prototype.readUint16LE=m.prototype.readUInt16LE=function(f,v){return f=f>>>0,v||be(f,2,this.length),this[f]|this[f+1]<<8},m.prototype.readUint16BE=m.prototype.readUInt16BE=function(f,v){return f=f>>>0,v||be(f,2,this.length),this[f]<<8|this[f+1]},m.prototype.readUint32LE=m.prototype.readUInt32LE=function(f,v){return f=f>>>0,v||be(f,4,this.length),(this[f]|this[f+1]<<8|this[f+2]<<16)+this[f+3]*16777216},m.prototype.readUint32BE=m.prototype.readUInt32BE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]*16777216+(this[f+1]<<16|this[f+2]<<8|this[f+3])},m.prototype.readBigUInt64LE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=v+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24,B=this[++f]+this[++f]*2**8+this[++f]*2**16+A*2**24;return BigInt(D)+(BigInt(B)<<BigInt(32))}),m.prototype.readBigUInt64BE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=v*2**24+this[++f]*2**16+this[++f]*2**8+this[++f],B=this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+A;return(BigInt(D)<<BigInt(32))+BigInt(B)}),m.prototype.readIntLE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=this[f],B=1,H=0;for(;++H<v&&(B*=256);)D+=this[f+H]*B;return B*=128,D>=B&&(D-=Math.pow(2,8*v)),D},m.prototype.readIntBE=function(f,v,A){f=f>>>0,v=v>>>0,A||be(f,v,this.length);let D=v,B=1,H=this[f+--D];for(;D>0&&(B*=256);)H+=this[f+--D]*B;return B*=128,H>=B&&(H-=Math.pow(2,8*v)),H},m.prototype.readInt8=function(f,v){return f=f>>>0,v||be(f,1,this.length),this[f]&128?(255-this[f]+1)*-1:this[f]},m.prototype.readInt16LE=function(f,v){f=f>>>0,v||be(f,2,this.length);const A=this[f]|this[f+1]<<8;return A&32768?A|4294901760:A},m.prototype.readInt16BE=function(f,v){f=f>>>0,v||be(f,2,this.length);const A=this[f+1]|this[f]<<8;return A&32768?A|4294901760:A},m.prototype.readInt32LE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]|this[f+1]<<8|this[f+2]<<16|this[f+3]<<24},m.prototype.readInt32BE=function(f,v){return f=f>>>0,v||be(f,4,this.length),this[f]<<24|this[f+1]<<16|this[f+2]<<8|this[f+3]},m.prototype.readBigInt64LE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=this[f+4]+this[f+5]*2**8+this[f+6]*2**16+(A<<24);return(BigInt(D)<<BigInt(32))+BigInt(v+this[++f]*2**8+this[++f]*2**16+this[++f]*2**24)}),m.prototype.readBigInt64BE=Dt(function(f){f=f>>>0,xs(f,"offset");const v=this[f],A=this[f+7];(v===void 0||A===void 0)&&Xs(f,this.length-8);const D=(v<<24)+this[++f]*2**16+this[++f]*2**8+this[++f];return(BigInt(D)<<BigInt(32))+BigInt(this[++f]*2**24+this[++f]*2**16+this[++f]*2**8+A)}),m.prototype.readFloatLE=function(f,v){return f=f>>>0,v||be(f,4,this.length),t.read(this,f,!0,23,4)},m.prototype.readFloatBE=function(f,v){return f=f>>>0,v||be(f,4,this.length),t.read(this,f,!1,23,4)},m.prototype.readDoubleLE=function(f,v){return f=f>>>0,v||be(f,8,this.length),t.read(this,f,!0,52,8)},m.prototype.readDoubleBE=function(f,v){return f=f>>>0,v||be(f,8,this.length),t.read(this,f,!1,52,8)};function Re(f,v,A,D,B,H){if(!m.isBuffer(f))throw new TypeError('"buffer" argument must be a Buffer instance');if(v>B||v<H)throw new RangeError('"value" argument is out of bounds');if(A+D>f.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(f,v,A,D){if(f=+f,v=v>>>0,A=A>>>0,!D){const K=Math.pow(2,8*A)-1;Re(this,f,v,A,K,0)}let B=1,H=0;for(this[v]=f&255;++H<A&&(B*=256);)this[v+H]=f/B&255;return v+A},m.prototype.writeUintBE=m.prototype.writeUIntBE=function(f,v,A,D){if(f=+f,v=v>>>0,A=A>>>0,!D){const K=Math.pow(2,8*A)-1;Re(this,f,v,A,K,0)}let B=A-1,H=1;for(this[v+B]=f&255;--B>=0&&(H*=256);)this[v+B]=f/H&255;return v+A},m.prototype.writeUint8=m.prototype.writeUInt8=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,1,255,0),this[v]=f&255,v+1},m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,65535,0),this[v]=f&255,this[v+1]=f>>>8,v+2},m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,65535,0),this[v]=f>>>8,this[v+1]=f&255,v+2},m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,4294967295,0),this[v+3]=f>>>24,this[v+2]=f>>>16,this[v+1]=f>>>8,this[v]=f&255,v+4},m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,4294967295,0),this[v]=f>>>24,this[v+1]=f>>>16,this[v+2]=f>>>8,this[v+3]=f&255,v+4};function ps(f,v,A,D,B){wi(v,D,B,f,A,7);let H=Number(v&BigInt(4294967295));f[A++]=H,H=H>>8,f[A++]=H,H=H>>8,f[A++]=H,H=H>>8,f[A++]=H;let K=Number(v>>BigInt(32)&BigInt(4294967295));return f[A++]=K,K=K>>8,f[A++]=K,K=K>>8,f[A++]=K,K=K>>8,f[A++]=K,A}function Gs(f,v,A,D,B){wi(v,D,B,f,A,7);let H=Number(v&BigInt(4294967295));f[A+7]=H,H=H>>8,f[A+6]=H,H=H>>8,f[A+5]=H,H=H>>8,f[A+4]=H;let K=Number(v>>BigInt(32)&BigInt(4294967295));return f[A+3]=K,K=K>>8,f[A+2]=K,K=K>>8,f[A+1]=K,K=K>>8,f[A]=K,A+8}m.prototype.writeBigUInt64LE=Dt(function(f,v=0){return ps(this,f,v,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeBigUInt64BE=Dt(function(f,v=0){return Gs(this,f,v,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeIntLE=function(f,v,A,D){if(f=+f,v=v>>>0,!D){const ke=Math.pow(2,8*A-1);Re(this,f,v,A,ke-1,-ke)}let B=0,H=1,K=0;for(this[v]=f&255;++B<A&&(H*=256);)f<0&&K===0&&this[v+B-1]!==0&&(K=1),this[v+B]=(f/H>>0)-K&255;return v+A},m.prototype.writeIntBE=function(f,v,A,D){if(f=+f,v=v>>>0,!D){const ke=Math.pow(2,8*A-1);Re(this,f,v,A,ke-1,-ke)}let B=A-1,H=1,K=0;for(this[v+B]=f&255;--B>=0&&(H*=256);)f<0&&K===0&&this[v+B+1]!==0&&(K=1),this[v+B]=(f/H>>0)-K&255;return v+A},m.prototype.writeInt8=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,1,127,-128),f<0&&(f=255+f+1),this[v]=f&255,v+1},m.prototype.writeInt16LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,32767,-32768),this[v]=f&255,this[v+1]=f>>>8,v+2},m.prototype.writeInt16BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,2,32767,-32768),this[v]=f>>>8,this[v+1]=f&255,v+2},m.prototype.writeInt32LE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,2147483647,-2147483648),this[v]=f&255,this[v+1]=f>>>8,this[v+2]=f>>>16,this[v+3]=f>>>24,v+4},m.prototype.writeInt32BE=function(f,v,A){return f=+f,v=v>>>0,A||Re(this,f,v,4,2147483647,-2147483648),f<0&&(f=4294967295+f+1),this[v]=f>>>24,this[v+1]=f>>>16,this[v+2]=f>>>8,this[v+3]=f&255,v+4},m.prototype.writeBigInt64LE=Dt(function(f,v=0){return ps(this,f,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),m.prototype.writeBigInt64BE=Dt(function(f,v=0){return Gs(this,f,v,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ms(f,v,A,D,B,H){if(A+D>f.length)throw new RangeError("Index out of range");if(A<0)throw new RangeError("Index out of range")}function Gt(f,v,A,D,B){return v=+v,A=A>>>0,B||ms(f,v,A,4),t.write(f,v,A,D,23,4),A+4}m.prototype.writeFloatLE=function(f,v,A){return Gt(this,f,v,!0,A)},m.prototype.writeFloatBE=function(f,v,A){return Gt(this,f,v,!1,A)};function Cs(f,v,A,D,B){return v=+v,A=A>>>0,B||ms(f,v,A,8),t.write(f,v,A,D,52,8),A+8}m.prototype.writeDoubleLE=function(f,v,A){return Cs(this,f,v,!0,A)},m.prototype.writeDoubleBE=function(f,v,A){return Cs(this,f,v,!1,A)},m.prototype.copy=function(f,v,A,D){if(!m.isBuffer(f))throw new TypeError("argument should be a Buffer");if(A||(A=0),!D&&D!==0&&(D=this.length),v>=f.length&&(v=f.length),v||(v=0),D>0&&D<A&&(D=A),D===A||f.length===0||this.length===0)return 0;if(v<0)throw new RangeError("targetStart out of bounds");if(A<0||A>=this.length)throw new RangeError("Index out of range");if(D<0)throw new RangeError("sourceEnd out of bounds");D>this.length&&(D=this.length),f.length-v<D-A&&(D=f.length-v+A);const B=D-A;return this===f&&typeof i.prototype.copyWithin=="function"?this.copyWithin(v,A,D):i.prototype.set.call(f,this.subarray(A,D),v),B},m.prototype.fill=function(f,v,A,D){if(typeof f=="string"){if(typeof v=="string"?(D=v,v=0,A=this.length):typeof A=="string"&&(D=A,A=this.length),D!==void 0&&typeof D!="string")throw new TypeError("encoding must be a string");if(typeof D=="string"&&!m.isEncoding(D))throw new TypeError("Unknown encoding: "+D);if(f.length===1){const H=f.charCodeAt(0);(D==="utf8"&&H<128||D==="latin1")&&(f=H)}}else typeof f=="number"?f=f&255:typeof f=="boolean"&&(f=Number(f));if(v<0||this.length<v||this.length<A)throw new RangeError("Out of range index");if(A<=v)return this;v=v>>>0,A=A===void 0?this.length:A>>>0,f||(f=0);let B;if(typeof f=="number")for(B=v;B<A;++B)this[B]=f;else{const H=m.isBuffer(f)?f:m.from(f,D),K=H.length;if(K===0)throw new TypeError('The value "'+f+'" is invalid for argument "value"');for(B=0;B<A-v;++B)this[B+v]=H[B%K]}return this};const Is={};function vn(f,v,A){Is[f]=class extends A{constructor(){super(),Object.defineProperty(this,"message",{value:v.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${f}]`,this.stack,delete this.name}get code(){return f}set code(D){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:D,writable:!0})}toString(){return`${this.name} [${f}]: ${this.message}`}}}vn("ERR_BUFFER_OUT_OF_BOUNDS",function(f){return f?`${f} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),vn("ERR_INVALID_ARG_TYPE",function(f,v){return`The "${f}" argument must be of type number. Received type ${typeof v}`},TypeError),vn("ERR_OUT_OF_RANGE",function(f,v,A){let D=`The value of "${f}" is out of range.`,B=A;return Number.isInteger(A)&&Math.abs(A)>2**32?B=Ei(String(A)):typeof A=="bigint"&&(B=String(A),(A>BigInt(2)**BigInt(32)||A<-(BigInt(2)**BigInt(32)))&&(B=Ei(B)),B+="n"),D+=` It must be ${v}. Received ${B}`,D},RangeError);function Ei(f){let v="",A=f.length;const D=f[0]==="-"?1:0;for(;A>=D+4;A-=3)v=`_${f.slice(A-3,A)}${v}`;return`${f.slice(0,A)}${v}`}function wo(f,v,A){xs(v,"offset"),(f[v]===void 0||f[v+A]===void 0)&&Xs(v,f.length-(A+1))}function wi(f,v,A,D,B,H){if(f>A||f<v){const K=typeof v=="bigint"?"n":"";let ke;throw v===0||v===BigInt(0)?ke=`>= 0${K} and < 2${K} ** ${(H+1)*8}${K}`:ke=`>= -(2${K} ** ${(H+1)*8-1}${K}) and < 2 ** ${(H+1)*8-1}${K}`,new Is.ERR_OUT_OF_RANGE("value",ke,f)}wo(D,B,H)}function xs(f,v){if(typeof f!="number")throw new Is.ERR_INVALID_ARG_TYPE(v,"number",f)}function Xs(f,v,A){throw Math.floor(f)!==f?(xs(f,A),new Is.ERR_OUT_OF_RANGE("offset","an integer",f)):v<0?new Is.ERR_BUFFER_OUT_OF_BOUNDS:new Is.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${v}`,f)}const Xt=/[^+/0-9A-Za-z-_]/g;function _r(f){if(f=f.split("=")[0],f=f.trim().replace(Xt,""),f.length<2)return"";for(;f.length%4!==0;)f=f+"=";return f}function _e(f,v){v=v||1/0;let A;const D=f.length;let B=null;const H=[];for(let K=0;K<D;++K){if(A=f.charCodeAt(K),A>55295&&A<57344){if(!B){if(A>56319){(v-=3)>-1&&H.push(239,191,189);continue}else if(K+1===D){(v-=3)>-1&&H.push(239,191,189);continue}B=A;continue}if(A<56320){(v-=3)>-1&&H.push(239,191,189),B=A;continue}A=(B-55296<<10|A-56320)+65536}else B&&(v-=3)>-1&&H.push(239,191,189);if(B=null,A<128){if((v-=1)<0)break;H.push(A)}else if(A<2048){if((v-=2)<0)break;H.push(A>>6|192,A&63|128)}else if(A<65536){if((v-=3)<0)break;H.push(A>>12|224,A>>6&63|128,A&63|128)}else if(A<1114112){if((v-=4)<0)break;H.push(A>>18|240,A>>12&63|128,A>>6&63|128,A&63|128)}else throw new Error("Invalid code point")}return H}function ko(f){const v=[];for(let A=0;A<f.length;++A)v.push(f.charCodeAt(A)&255);return v}function vr(f,v){let A,D,B;const H=[];for(let K=0;K<f.length&&!((v-=2)<0);++K)A=f.charCodeAt(K),D=A>>8,B=A%256,H.push(B),H.push(D);return H}function ki(f){return e.toByteArray(_r(f))}function Ls(f,v,A,D){let B;for(B=0;B<D&&!(B+A>=v.length||B>=f.length);++B)v[B+A]=f[B];return B}function vt(f,v){return f instanceof v||f!=null&&f.constructor!=null&&f.constructor.name!=null&&f.constructor.name===v.name}function Ys(f){return f!==f}const bn=function(){const f="0123456789abcdef",v=new Array(256);for(let A=0;A<16;++A){const D=A*16;for(let B=0;B<16;++B)v[D+B]=f[A]+f[B]}return v}();function Dt(f){return typeof BigInt>"u"?Ci:f}function Ci(){throw new Error("BigInt not supported")}})(Pp);const eT=Pp.Buffer;var tT=function(s){return I.atob?I.atob(s):eT.from(s,"base64").toString("binary")};function Dp(s){for(var e=tT(s),t=new Uint8Array(e.length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class sT extends dc{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
22
22
|
`);t>-1;t=this.buffer.indexOf(`
|
|
23
|
-
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const J0=" ",Zo=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},eT=function(){const s='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+s+")")},mt=function(s){const e={};if(!s)return e;const t=s.split(eT());let n=t.length,r;for(;n--;)t[n]!==""&&(r=/([^=]*)=(.*)/.exec(t[n]).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},mu=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 tT extends dc{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,n;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,i)=>{const a=i(e);return a===e?r:r.concat([a])},[e]).forEach(r=>{for(let i=0;i<this.customParsers.length;i++)if(this.customParsers[i].call(this,r))return;if(r.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:r.slice(1)});return}if(r=r.replace("\r",""),t=/^#EXTM3U/.exec(r),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(r),t){n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),this.trigger("data",n);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(r),t){n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),this.trigger("data",n);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(r),t){n=ze(Zo(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",n);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(r),t){n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(r),t){if(n={type:"tag",tagType:"map"},t[1]){const i=mt(t[1]);i.URI&&(n.uri=i.URI),i.BYTERANGE&&(n.byterange=Zo(i.BYTERANGE))}this.trigger("data",n);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(r),t){n={type:"tag",tagType:"stream-inf"},t[1]&&(n.attributes=mt(t[1]),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=mu(n.attributes.RESOLUTION)),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))),this.trigger("data",n);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(r),t){n={type:"tag",tagType:"media"},t[1]&&(n.attributes=mt(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-ENDLIST/.exec(r),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(r),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(r),t){n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(r),t){n={type:"tag",tagType:"key"},t[1]&&(n.attributes=mt(t[1]),n.attributes.IV&&(n.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),this.trigger("data",n);return}if(t=/^#EXT-X-START:(.*)$/.exec(r),t){n={type:"tag",tagType:"start"},t[1]&&(n.attributes=mt(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),this.trigger("data",n);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"skip"},n.attributes=mt(t[1]),n.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(n.attributes["SKIPPED-SEGMENTS"]=parseInt(n.attributes["SKIPPED-SEGMENTS"],10)),n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(n.attributes["RECENTLY-REMOVED-DATERANGES"]=n.attributes["RECENTLY-REMOVED-DATERANGES"].split(J0)),this.trigger("data",n);return}if(t=/^#EXT-X-PART:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"part"},n.attributes=mt(t[1]),["DURATION"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),["INDEPENDENT","GAP"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=/YES/.test(n.attributes[i]))}),n.attributes.hasOwnProperty("BYTERANGE")&&(n.attributes.byterange=Zo(n.attributes.BYTERANGE)),this.trigger("data",n);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"server-control"},n.attributes=mt(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=/YES/.test(n.attributes[i]))}),this.trigger("data",n);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"part-inf"},n.attributes=mt(t[1]),["PART-TARGET"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),this.trigger("data",n);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"preload-hint"},n.attributes=mt(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(i){if(n.attributes.hasOwnProperty(i)){n.attributes[i]=parseInt(n.attributes[i],10);const a=i==="BYTERANGE-LENGTH"?"length":"offset";n.attributes.byterange=n.attributes.byterange||{},n.attributes.byterange[a]=n.attributes[i],delete n.attributes[i]}}),this.trigger("data",n);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"rendition-report"},n.attributes=mt(t[1]),["LAST-MSN","LAST-PART"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseInt(n.attributes[i],10))}),this.trigger("data",n);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"daterange"},n.attributes=mt(t[1]),["ID","CLASS"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=String(n.attributes[a]))}),["START-DATE","END-DATE"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=new Date(n.attributes[a]))}),["DURATION","PLANNED-DURATION"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=parseFloat(n.attributes[a]))}),["END-ON-NEXT"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=/YES/i.test(n.attributes[a]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=n.attributes[a].toString(16))});const i=/^X-([A-Z]+-)+[A-Z]+$/;for(const a in n.attributes){if(!i.test(a))continue;const o=/[0-9A-Fa-f]{6}/g.test(n.attributes[a]),c=/^\d+(\.\d+)?$/.test(n.attributes[a]);n.attributes[a]=o?n.attributes[a].toString(16):c?parseFloat(n.attributes[a]):String(n.attributes[a])}this.trigger("data",n);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(r),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(r),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(r),t){n={type:"tag",tagType:"content-steering"},n.attributes=mt(t[1]),this.trigger("data",n);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(r),t){n={type:"tag",tagType:"i-frame-playlist"},n.attributes=mt(t[1]),n.attributes.URI&&(n.uri=n.attributes.URI),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=mu(n.attributes.RESOLUTION)),n.attributes["AVERAGE-BANDWIDTH"]&&(n.attributes["AVERAGE-BANDWIDTH"]=parseInt(n.attributes["AVERAGE-BANDWIDTH"],10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),this.trigger("data",n);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(r),t){n={type:"tag",tagType:"define"},n.attributes=mt(t[1]),this.trigger("data",n);return}this.trigger("data",{type:"tag",data:r.slice(4)})})}}addParser({expression:e,customType:t,dataParser:n,segment:r}){typeof n!="function"&&(n=i=>i),this.customParsers.push(i=>{if(e.exec(i))return this.trigger("data",{type:"custom",data:n(i),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const n=r=>e.test(r)?t(r):r;this.tagMappers.push(n)}}const sT=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ns=function(s){const e={};return Object.keys(s).forEach(function(t){e[sT(t)]=s[t]}),e},Jo=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:n}=s;if(!e)return;const r="#EXT-X-SERVER-CONTROL",i="holdBack",a="partHoldBack",o=t&&t*3,c=n&&n*2;t&&!e.hasOwnProperty(i)&&(e[i]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[i]<o&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${e[i]}) to targetDuration * 3 (${o})`}),e[i]=o),n&&!e.hasOwnProperty(a)&&(e[a]=n*3,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),n&&e[a]<c&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${c}).`}),e[a]=c)};class nT extends dc{constructor(e={}){super(),this.lineStream=new Z0,this.parseStream=new tT,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,n=[];let r={},i,a,o=!1;const c=function(){},h={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let T=0,S=0;const w={};this.on("end",()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&i&&(r.map=i),!r.key&&a&&(r.key=a),!r.timeline&&typeof _=="number"&&(r.timeline=_),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(b){let R,L;if(t.manifest.definitions){for(const U in t.manifest.definitions)if(b.uri&&(b.uri=b.uri.replace(`{$${U}}`,t.manifest.definitions[U])),b.attributes)for(const M in b.attributes)typeof b.attributes[M]=="string"&&(b.attributes[M]=b.attributes[M].replace(`{$${U}}`,t.manifest.definitions[U]))}({tag(){({version(){b.version&&(this.manifest.version=b.version)},"allow-cache"(){this.manifest.allowCache=b.allowed,"allowed"in b||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const U={};"length"in b&&(r.byterange=U,U.length=b.length,"offset"in b||(b.offset=T)),"offset"in b&&(r.byterange=U,U.offset=b.offset),T=U.offset+U.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"})),b.title&&(r.title=b.title),b.duration>0&&(r.duration=b.duration),b.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=n},key(){if(!b.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(b.attributes.METHOD==="NONE"){a=null;return}if(!b.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(b.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:b.attributes};return}if(b.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:b.attributes.URI};return}if(b.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(b.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(b.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),b.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(b.attributes.KEYID&&b.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:b.attributes.KEYFORMAT,keyId:b.attributes.KEYID.substring(2)},pssh:Dp(b.attributes.URI.split(",")[1])};return}b.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:b.attributes.METHOD||"AES-128",uri:b.attributes.URI},typeof b.attributes.IV<"u"&&(a.iv=b.attributes.IV)},"media-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+b.number});return}this.manifest.mediaSequence=b.number},"discontinuity-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+b.number});return}this.manifest.discontinuitySequence=b.number,_=b.number},"playlist-type"(){if(!/VOD|EVENT/.test(b.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+b.playlist});return}this.manifest.playlistType=b.playlistType},map(){i={},b.uri&&(i.uri=b.uri),b.byterange&&(i.byterange=b.byterange),a&&(i.key=a)},"stream-inf"(){if(this.manifest.playlists=n,this.manifest.mediaGroups=this.manifest.mediaGroups||h,!b.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),ze(r.attributes,b.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,!(b.attributes&&b.attributes.TYPE&&b.attributes["GROUP-ID"]&&b.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const U=this.manifest.mediaGroups[b.attributes.TYPE];U[b.attributes["GROUP-ID"]]=U[b.attributes["GROUP-ID"]]||{},R=U[b.attributes["GROUP-ID"]],L={default:/yes/i.test(b.attributes.DEFAULT)},L.default?L.autoselect=!0:L.autoselect=/yes/i.test(b.attributes.AUTOSELECT),b.attributes.LANGUAGE&&(L.language=b.attributes.LANGUAGE),b.attributes.URI&&(L.uri=b.attributes.URI),b.attributes["INSTREAM-ID"]&&(L.instreamId=b.attributes["INSTREAM-ID"]),b.attributes.CHARACTERISTICS&&(L.characteristics=b.attributes.CHARACTERISTICS),b.attributes.FORCED&&(L.forced=/yes/i.test(b.attributes.FORCED)),R[b.attributes.NAME]=L},discontinuity(){_+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(n.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=b.dateTimeString,this.manifest.dateTimeObject=b.dateTimeObject),r.dateTimeString=b.dateTimeString,r.dateTimeObject=b.dateTimeObject;const{lastProgramDateTime:U}=this;this.lastProgramDateTime=new Date(b.dateTimeString).getTime(),U===null&&this.manifest.segments.reduceRight((M,F)=>(F.programDateTime=M-F.duration*1e3,F.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(b.duration)||b.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+b.duration});return}this.manifest.targetDuration=b.duration,Jo.call(this,this.manifest)},start(){if(!b.attributes||isNaN(b.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:b.attributes["TIME-OFFSET"],precise:b.attributes.PRECISE}},"cue-out"(){r.cueOut=b.data},"cue-out-cont"(){r.cueOutCont=b.data},"cue-in"(){r.cueIn=b.data},skip(){this.manifest.skip=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",b.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const U=this.manifest.segments.length,M=Ns(b.attributes);r.parts=r.parts||[],r.parts.push(M),M.byterange&&(M.byterange.hasOwnProperty("offset")||(M.byterange.offset=S),S=M.byterange.offset+M.byterange.length);const F=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${U}`,b.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((N,j)=>{N.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${j} lacks required attribute(s): LAST-PART`})})},"server-control"(){const U=this.manifest.serverControl=Ns(b.attributes);U.hasOwnProperty("canBlockReload")||(U.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Jo.call(this,this.manifest),U.canSkipDateranges&&!U.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 U=this.manifest.segments.length,M=Ns(b.attributes),F=M.type&&M.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(M),M.byterange&&(M.byterange.hasOwnProperty("offset")||(M.byterange.offset=F?S:0,F&&(S=M.byterange.offset+M.byterange.length)));const N=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${N} for segment #${U}`,b.attributes,["TYPE","URI"]),!!M.type)for(let j=0;j<r.preloadHints.length-1;j++){const J=r.preloadHints[j];J.type&&J.type===M.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${N} for segment #${U} has the same TYPE ${M.type} as preload hint #${j}`})}},"rendition-report"(){const U=Ns(b.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(U);const M=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];o&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${M}`,b.attributes,F)},"part-inf"(){this.manifest.partInf=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",b.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Jo.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Ns(b.attributes));const U=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${U}`,b.attributes,["ID","START-DATE"]);const M=this.manifest.dateRanges[U];M.endDate&&M.startDate&&new Date(M.endDate)<new Date(M.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),M.duration&&M.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),M.plannedDuration&&M.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const F=!!M.endOnNext;if(F&&!M.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(M.duration||M.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),M.duration&&M.endDate){const N=M.startDate.getTime()+M.duration*1e3;this.manifest.dateRanges[U].endDate=new Date(N)}if(!w[M.id])w[M.id]=M;else{for(const j in w[M.id])if(M[j]&&JSON.stringify(w[M.id][j])!==JSON.stringify(M[j])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const N=this.manifest.dateRanges.findIndex(j=>j.id===M.id);this.manifest.dateRanges[N]=ze(this.manifest.dateRanges[N],M),w[M.id]=ze(w[M.id],M),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=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",b.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const U=(M,F)=>{if(M in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${M}`});return}this.manifest.definitions[M]=F};if("QUERYPARAM"in b.attributes){if("NAME"in b.attributes||"IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const M=this.params.get(b.attributes.QUERYPARAM);if(!M){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${b.attributes.QUERYPARAM}`});return}U(b.attributes.QUERYPARAM,decodeURIComponent(M));return}if("NAME"in b.attributes){if("IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in b.attributes)||typeof b.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${b.attributes.NAME}`});return}U(b.attributes.NAME,b.attributes.VALUE);return}if("IMPORT"in b.attributes){if(!this.mainDefinitions[b.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${b.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}U(b.attributes.IMPORT,this.mainDefinitions[b.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:b.attributes,uri:b.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",b.attributes,["BANDWIDTH","URI"])}}[b.tagType]||c).call(t)},uri(){r.uri=b.uri,n.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=_,i&&(r.map=i),S=0,this.lastProgramDateTime!==null&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=r.duration*1e3),r={}},comment(){},custom(){b.segment?(r.custom=r.custom||{},r.custom[b.customType]=b.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[b.customType]=b.data)}})[b.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,n){const r=[];n.forEach(function(i){t.hasOwnProperty(i)||r.push(i)}),r.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${r.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
24
|
-
`),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 cn={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^/},rT=["video","audio","text"],fu=["Video","Audio","Text"],Np=function(s){return s&&s.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,n){var r=("00"+Number(t).toString(16)).slice(-2),i=("00"+Number(n).toString(16)).slice(-2);return"avc1."+r+"00"+i})},Zt=function(s){s===void 0&&(s="");var e=s.split(","),t=[];return e.forEach(function(n){n=n.trim();var r;rT.forEach(function(i){var a=cn[i].exec(n.toLowerCase());if(!(!a||a.length<=1)){r=i;var o=n.substring(0,a[1].length),c=n.replace(o,"");t.push({type:o,details:c,mediaType:i})}}),r||t.push({type:n,details:"",mediaType:"unknown"})}),t},iT=function(s,e){if(!s.mediaGroups.AUDIO||!e)return null;var t=s.mediaGroups.AUDIO[e];if(!t)return null;for(var n in t){var r=t[n];if(r.default&&r.playlists)return Zt(r.playlists[0].attributes.CODECS)}return null},Op=function(s){return s===void 0&&(s=""),cn.audio.test(s.trim().toLowerCase())},aT=function(s){return s===void 0&&(s=""),cn.text.test(s.trim().toLowerCase())},Xn=function(s){if(!(!s||typeof s!="string")){var e=s.toLowerCase().split(",").map(function(r){return Np(r.trim())}),t="video";e.length===1&&Op(e[0])?t="audio":e.length===1&&aT(e[0])&&(t="application");var n="mp4";return e.every(function(r){return cn.mp4.test(r)})?n="mp4":e.every(function(r){return cn.webm.test(r)})?n="webm":e.every(function(r){return cn.ogg.test(r)})&&(n="ogg"),t+"/"+n+';codecs="'+s+'"'}},ei=function(s,e){return s===void 0&&(s=""),e===void 0&&(e=!1),I.MediaSource&&I.MediaSource.isTypeSupported&&I.MediaSource.isTypeSupported(Xn(s))||e&&I.ManagedMediaSource&&I.ManagedMediaSource.isTypeSupported&&I.ManagedMediaSource.isTypeSupported(Xn(s))||!1},el=function(s){return s===void 0&&(s=""),s.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<fu.length;t++){var n=fu[t];if(cn["muxer"+n].test(e))return!0}return!1})},gu="mp4a.40.2",oT="avc1.4d400d",lT=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,cT=/^application\/dash\+xml/i,Mp=function(s){return lT.test(s)?"hls":cT.test(s)?"dash":s==="application/vnd.videojs.vhs+json"?"vhs-json":null},dT=function(s){return s.toString(2).length},uT=function(s){return Math.ceil(dT(s)/8)},Up=function(s){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer},hT=function(s){return Up(s)},ie=function(s){return s instanceof Uint8Array?s:(!Array.isArray(s)&&!hT(s)&&!(s instanceof ArrayBuffer)&&(typeof s!="number"||typeof s=="number"&&s!==s?s=0:s=[s]),new Uint8Array(s&&s.buffer||s,s&&s.byteOffset||0,s&&s.byteLength||0))},nt=I.BigInt||Number,Sl=[nt("0x1"),nt("0x100"),nt("0x10000"),nt("0x1000000"),nt("0x100000000"),nt("0x10000000000"),nt("0x1000000000000"),nt("0x100000000000000"),nt("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var pT=function(s,e){var t=e===void 0?{}:e,n=t.signed,r=n===void 0?!1:n,i=t.le,a=i===void 0?!1:i;s=ie(s);var o=a?"reduce":"reduceRight",c=s[o]?s[o]:Array.prototype[o],h=c.call(s,function(_,T,S){var w=a?S:Math.abs(S+1-s.length);return _+nt(T)*Sl[w]},nt(0));if(r){var m=Sl[s.length]/nt(2)-nt(1);h=nt(h),h>m&&(h-=m,h-=m,h-=nt(2))}return Number(h)},mT=function(s,e){var t={},n=t.le,r=n===void 0?!1:n;(typeof s!="bigint"&&typeof s!="number"||typeof s=="number"&&s!==s)&&(s=0),s=nt(s);for(var i=uT(s),a=new Uint8Array(new ArrayBuffer(i)),o=0;o<i;o++){var c=r?o:Math.abs(o+1-a.length);a[c]=Number(s/Sl[o]&nt(255)),s<0&&(a[c]=Math.abs(~a[c]),a[c]-=o===0?1:2)}return a},Bp=function(s,e){if(typeof s!="string"&&s&&typeof s.toString=="function"&&(s=s.toString()),typeof s!="string")return new Uint8Array;e||(s=unescape(encodeURIComponent(s)));for(var t=new Uint8Array(s.length),n=0;n<s.length;n++)t[n]=s.charCodeAt(n);return t},fT=function(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];if(e=e.filter(function(a){return a&&(a.byteLength||a.length)&&typeof a!="string"}),e.length<=1)return ie(e[0]);var n=e.reduce(function(a,o,c){return a+(o.byteLength||o.length)},0),r=new Uint8Array(n),i=0;return e.forEach(function(a){a=ie(a),r.set(a,i),i+=a.byteLength}),r},Ue=function(s,e,t){var n=t===void 0?{}:t,r=n.offset,i=r===void 0?0:r,a=n.mask,o=a===void 0?[]:a;s=ie(s),e=ie(e);var c=e.every?e.every:Array.prototype.every;return e.length&&s.length-i>=e.length&&c.call(e,function(h,m){var _=o[m]?o[m]&s[i+m]:s[i+m];return h===_})},gT=function(s,e,t){e.forEach(function(n){for(var r in s.mediaGroups[n])for(var i in s.mediaGroups[n][r]){var a=s.mediaGroups[n][r][i];t(a,n,r,i)}})},Ws={},ks={};function yT(s,e,t){if(t===void 0&&(t=Array.prototype),s&&typeof t.find=="function")return t.find.call(s,e);for(var n=0;n<s.length;n++)if(Object.prototype.hasOwnProperty.call(s,n)){var r=s[n];if(e.call(void 0,r,n,s))return r}}function hc(s,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(s):s}function _T(s,e){if(s===null||typeof s!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(s[t]=e[t]);return s}var Fp=hc({HTML:"text/html",isHTML:function(s){return s===Fp.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),jp=hc({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(s){return s===jp.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});ks.assign=_T;ks.find=yT;ks.freeze=hc;ks.MIME_TYPE=Fp;ks.NAMESPACE=jp;var qp=ks,is=qp.find,ai=qp.NAMESPACE;function vT(s){return s!==""}function bT(s){return s?s.split(/[\t\n\f\r ]+/).filter(vT):[]}function TT(s,e){return s.hasOwnProperty(e)||(s[e]=!0),s}function yu(s){if(!s)return[];var e=bT(s);return Object.keys(e.reduce(TT,{}))}function AT(s){return function(e){return s&&s.indexOf(e)!==-1}}function mi(s,e){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}function wt(s,e){var t=s.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,mi(t,n),s.prototype=t=n}t.constructor!=s&&(typeof s!="function"&&console.error("unknown Class:"+s),t.constructor=s)}var kt={},$t=kt.ELEMENT_NODE=1,Yn=kt.ATTRIBUTE_NODE=2,Ea=kt.TEXT_NODE=3,Vp=kt.CDATA_SECTION_NODE=4,$p=kt.ENTITY_REFERENCE_NODE=5,ST=kt.ENTITY_NODE=6,Hp=kt.PROCESSING_INSTRUCTION_NODE=7,Wp=kt.COMMENT_NODE=8,zp=kt.DOCUMENT_NODE=9,Gp=kt.DOCUMENT_TYPE_NODE=10,Ss=kt.DOCUMENT_FRAGMENT_NODE=11,ET=kt.NOTATION_NODE=12,dt={},et={};dt.INDEX_SIZE_ERR=(et[1]="Index size error",1);dt.DOMSTRING_SIZE_ERR=(et[2]="DOMString size error",2);var At=dt.HIERARCHY_REQUEST_ERR=(et[3]="Hierarchy request error",3);dt.WRONG_DOCUMENT_ERR=(et[4]="Wrong document",4);dt.INVALID_CHARACTER_ERR=(et[5]="Invalid character",5);dt.NO_DATA_ALLOWED_ERR=(et[6]="No data allowed",6);dt.NO_MODIFICATION_ALLOWED_ERR=(et[7]="No modification allowed",7);var Xp=dt.NOT_FOUND_ERR=(et[8]="Not found",8);dt.NOT_SUPPORTED_ERR=(et[9]="Not supported",9);var _u=dt.INUSE_ATTRIBUTE_ERR=(et[10]="Attribute in use",10);dt.INVALID_STATE_ERR=(et[11]="Invalid state",11);dt.SYNTAX_ERR=(et[12]="Syntax error",12);dt.INVALID_MODIFICATION_ERR=(et[13]="Invalid modification",13);dt.NAMESPACE_ERR=(et[14]="Invalid namespace",14);dt.INVALID_ACCESS_ERR=(et[15]="Invalid access",15);function We(s,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,et[s]),this.message=et[s],Error.captureStackTrace&&Error.captureStackTrace(this,We);return t.code=s,e&&(this.message=this.message+": "+e),t}We.prototype=Error.prototype;mi(dt,We);function bs(){}bs.prototype={length:0,item:function(s){return s>=0&&s<this.length?this[s]:null},toString:function(s,e){for(var t=[],n=0;n<this.length;n++)On(this[n],t,s,e);return t.join("")},filter:function(s){return Array.prototype.filter.call(this,s)},indexOf:function(s){return Array.prototype.indexOf.call(this,s)}};function Kn(s,e){this._node=s,this._refresh=e,pc(this)}function pc(s){var e=s._node._inc||s._node.ownerDocument._inc;if(s._inc!==e){var t=s._refresh(s._node);if(am(s,"length",t.length),!s.$$length||t.length<s.$$length)for(var n=t.length;n in s;n++)Object.prototype.hasOwnProperty.call(s,n)&&delete s[n];mi(t,s),s._inc=e}}Kn.prototype.item=function(s){return pc(this),this[s]||null};wt(Kn,bs);function wa(){}function Yp(s,e){for(var t=s.length;t--;)if(s[t]===e)return t}function vu(s,e,t,n){if(n?e[Yp(e,n)]=t:e[e.length++]=t,s){t.ownerElement=s;var r=s.ownerDocument;r&&(n&&Zp(r,s,n),wT(r,s,t))}}function bu(s,e,t){var n=Yp(e,t);if(n>=0){for(var r=e.length-1;n<r;)e[n]=e[++n];if(e.length=r,s){var i=s.ownerDocument;i&&(Zp(i,s,t),t.ownerElement=null)}}else throw new We(Xp,new Error(s.tagName+"@"+t))}wa.prototype={length:0,item:bs.prototype.item,getNamedItem:function(s){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==s)return t}},setNamedItem:function(s){var e=s.ownerElement;if(e&&e!=this._ownerElement)throw new We(_u);var t=this.getNamedItem(s.nodeName);return vu(this._ownerElement,this,s,t),t},setNamedItemNS:function(s){var e=s.ownerElement,t;if(e&&e!=this._ownerElement)throw new We(_u);return t=this.getNamedItemNS(s.namespaceURI,s.localName),vu(this._ownerElement,this,s,t),t},removeNamedItem:function(s){var e=this.getNamedItem(s);return bu(this._ownerElement,this,e),e},removeNamedItemNS:function(s,e){var t=this.getNamedItemNS(s,e);return bu(this._ownerElement,this,t),t},getNamedItemNS:function(s,e){for(var t=this.length;t--;){var n=this[t];if(n.localName==e&&n.namespaceURI==s)return n}return null}};function Kp(){}Kp.prototype={hasFeature:function(s,e){return!0},createDocument:function(s,e,t){var n=new fi;if(n.implementation=this,n.childNodes=new bs,n.doctype=t||null,t&&n.appendChild(t),e){var r=n.createElementNS(s,e);n.appendChild(r)}return n},createDocumentType:function(s,e,t){var n=new to;return n.name=s,n.nodeName=s,n.publicId=e||"",n.systemId=t||"",n}};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(s,e){return ka(this,s,e)},replaceChild:function(s,e){ka(this,s,e,em),e&&this.removeChild(e)},removeChild:function(s){return Jp(this,s)},appendChild:function(s){return this.insertBefore(s,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(s){return El(this.ownerDocument||this,this,s)},normalize:function(){for(var s=this.firstChild;s;){var e=s.nextSibling;e&&e.nodeType==Ea&&s.nodeType==Ea?(this.removeChild(e),s.appendData(e.data)):(s.normalize(),s=e)}},isSupported:function(s,e){return this.ownerDocument.implementation.hasFeature(s,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(s){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]===s)return n}e=e.nodeType==Yn?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,s))return t[s];e=e.nodeType==Yn?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function Qp(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||"&#"+s.charCodeAt()+";"}mi(kt,Se);mi(kt,Se.prototype);function oi(s,e){if(e(s))return!0;if(s=s.firstChild)do if(oi(s,e))return!0;while(s=s.nextSibling)}function fi(){this.ownerDocument=this}function wT(s,e,t){s&&s._inc++;var n=t.namespaceURI;n===ai.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Zp(s,e,t,n){s&&s._inc++;var r=t.namespaceURI;r===ai.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function mc(s,e,t){if(s&&s._inc){s._inc++;var n=e.childNodes;if(t)n[n.length++]=t;else{for(var r=e.firstChild,i=0;r;)n[i++]=r,r=r.nextSibling;n.length=i,delete n[n.length]}}}function Jp(s,e){var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:s.firstChild=n,n?n.previousSibling=t:s.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,mc(s.ownerDocument,s),e}function kT(s){return s&&(s.nodeType===Se.DOCUMENT_NODE||s.nodeType===Se.DOCUMENT_FRAGMENT_NODE||s.nodeType===Se.ELEMENT_NODE)}function CT(s){return s&&(as(s)||fc(s)||Es(s)||s.nodeType===Se.DOCUMENT_FRAGMENT_NODE||s.nodeType===Se.COMMENT_NODE||s.nodeType===Se.PROCESSING_INSTRUCTION_NODE)}function Es(s){return s&&s.nodeType===Se.DOCUMENT_TYPE_NODE}function as(s){return s&&s.nodeType===Se.ELEMENT_NODE}function fc(s){return s&&s.nodeType===Se.TEXT_NODE}function Tu(s,e){var t=s.childNodes||[];if(is(t,as)||Es(e))return!1;var n=is(t,Es);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function Au(s,e){var t=s.childNodes||[];function n(i){return as(i)&&i!==e}if(is(t,n))return!1;var r=is(t,Es);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function IT(s,e,t){if(!kT(s))throw new We(At,"Unexpected parent node type "+s.nodeType);if(t&&t.parentNode!==s)throw new We(Xp,"child not in parent");if(!CT(e)||Es(e)&&s.nodeType!==Se.DOCUMENT_NODE)throw new We(At,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function xT(s,e,t){var n=s.childNodes||[],r=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var i=r.filter(as);if(i.length>1||is(r,fc))throw new We(At,"More than one element or text in fragment");if(i.length===1&&!Tu(s,t))throw new We(At,"Element in fragment can not be inserted before doctype")}if(as(e)&&!Tu(s,t))throw new We(At,"Only one element can be added and only after doctype");if(Es(e)){if(is(n,Es))throw new We(At,"Only one doctype is allowed");var a=is(n,as);if(t&&n.indexOf(a)<n.indexOf(t))throw new We(At,"Doctype can only be inserted before an element");if(!t&&a)throw new We(At,"Doctype can not be appended since element is present")}}function em(s,e,t){var n=s.childNodes||[],r=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var i=r.filter(as);if(i.length>1||is(r,fc))throw new We(At,"More than one element or text in fragment");if(i.length===1&&!Au(s,t))throw new We(At,"Element in fragment can not be inserted before doctype")}if(as(e)&&!Au(s,t))throw new We(At,"Only one element can be added and only after doctype");if(Es(e)){if(is(n,function(o){return Es(o)&&o!==t}))throw new We(At,"Only one doctype is allowed");var a=is(n,as);if(t&&n.indexOf(a)<n.indexOf(t))throw new We(At,"Doctype can only be inserted before an element")}}function ka(s,e,t,n){IT(s,e,t),s.nodeType===Se.DOCUMENT_NODE&&(n||xT)(s,e,t);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===Ss){var i=e.firstChild;if(i==null)return e;var a=e.lastChild}else i=a=e;var o=t?t.previousSibling:s.lastChild;i.previousSibling=o,a.nextSibling=t,o?o.nextSibling=i:s.firstChild=i,t==null?s.lastChild=a:t.previousSibling=a;do i.parentNode=s;while(i!==a&&(i=i.nextSibling));return mc(s.ownerDocument||s,s),e.nodeType==Ss&&(e.firstChild=e.lastChild=null),e}function LT(s,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=s,e.previousSibling=s.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:s.firstChild=e,s.lastChild=e,mc(s.ownerDocument,s,e),e}fi.prototype={nodeName:"#document",nodeType:zp,doctype:null,documentElement:null,_inc:1,insertBefore:function(s,e){if(s.nodeType==Ss){for(var t=s.firstChild;t;){var n=t.nextSibling;this.insertBefore(t,e),t=n}return s}return ka(this,s,e),s.ownerDocument=this,this.documentElement===null&&s.nodeType===$t&&(this.documentElement=s),s},removeChild:function(s){return this.documentElement==s&&(this.documentElement=null),Jp(this,s)},replaceChild:function(s,e){ka(this,s,e,em),s.ownerDocument=this,e&&this.removeChild(e),as(s)&&(this.documentElement=s)},importNode:function(s,e){return im(this,s,e)},getElementById:function(s){var e=null;return oi(this.documentElement,function(t){if(t.nodeType==$t&&t.getAttribute("id")==s)return e=t,!0}),e},getElementsByClassName:function(s){var e=yu(s);return new Kn(this,function(t){var n=[];return e.length>0&&oi(t.documentElement,function(r){if(r!==t&&r.nodeType===$t){var i=r.getAttribute("class");if(i){var a=s===i;if(!a){var o=yu(i);a=e.every(AT(o))}a&&n.push(r)}}}),n})},createElement:function(s){var e=new mn;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new bs;var t=e.attributes=new wa;return t._ownerElement=e,e},createDocumentFragment:function(){var s=new so;return s.ownerDocument=this,s.childNodes=new bs,s},createTextNode:function(s){var e=new gc;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new yc;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new _c;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var t=new bc;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=s,t.nodeValue=t.data=e,t},createAttribute:function(s){var e=new Ca;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new vc;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var t=new mn,n=e.split(":"),r=t.attributes=new wa;return t.childNodes=new bs,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=s,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,r._ownerElement=t,t},createAttributeNS:function(s,e){var t=new Ca,n=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=s,t.specified=!0,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,t}};wt(fi,Se);function mn(){this._nsMap={}}mn.prototype={nodeType:$t,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var t=this.ownerDocument.createAttribute(s);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ss?this.insertBefore(s,null):LT(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var t=this.getAttributeNodeNS(s,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var t=this.getAttributeNodeNS(s,e);return t&&t.value||""},setAttributeNS:function(s,e,t){var n=this.ownerDocument.createAttributeNS(s,e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new Kn(this,function(e){var t=[];return oi(e,function(n){n!==e&&n.nodeType==$t&&(s==="*"||n.tagName==s)&&t.push(n)}),t})},getElementsByTagNameNS:function(s,e){return new Kn(this,function(t){var n=[];return oi(t,function(r){r!==t&&r.nodeType===$t&&(s==="*"||r.namespaceURI===s)&&(e==="*"||r.localName==e)&&n.push(r)}),n})}};fi.prototype.getElementsByTagName=mn.prototype.getElementsByTagName;fi.prototype.getElementsByTagNameNS=mn.prototype.getElementsByTagNameNS;wt(mn,Se);function Ca(){}Ca.prototype.nodeType=Yn;wt(Ca,Se);function gi(){}gi.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(et[At])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,t){var n=this.data.substring(0,s),r=this.data.substring(s+e);t=n+t+r,this.nodeValue=this.data=t,this.length=t.length}};wt(gi,Se);function gc(){}gc.prototype={nodeName:"#text",nodeType:Ea,splitText:function(s){var e=this.data,t=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};wt(gc,gi);function yc(){}yc.prototype={nodeName:"#comment",nodeType:Wp};wt(yc,gi);function _c(){}_c.prototype={nodeName:"#cdata-section",nodeType:Vp};wt(_c,gi);function to(){}to.prototype.nodeType=Gp;wt(to,Se);function tm(){}tm.prototype.nodeType=ET;wt(tm,Se);function sm(){}sm.prototype.nodeType=ST;wt(sm,Se);function vc(){}vc.prototype.nodeType=$p;wt(vc,Se);function so(){}so.prototype.nodeName="#document-fragment";so.prototype.nodeType=Ss;wt(so,Se);function bc(){}bc.prototype.nodeType=Hp;wt(bc,Se);function nm(){}nm.prototype.serializeToString=function(s,e,t){return rm.call(s,e,t)};Se.prototype.toString=rm;function rm(s,e){var t=[],n=this.nodeType==9&&this.documentElement||this,r=n.prefix,i=n.namespaceURI;if(i&&r==null){var r=n.lookupPrefix(i);if(r==null)var a=[{namespace:i,prefix:null}]}return On(this,t,s,e,a),t.join("")}function Su(s,e,t){var n=s.prefix||"",r=s.namespaceURI;if(!r||n==="xml"&&r===ai.XML||r===ai.XMLNS)return!1;for(var i=t.length;i--;){var a=t[i];if(a.prefix===n)return a.namespace!==r}return!0}function tl(s,e,t){s.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Qp),'"')}function On(s,e,t,n,r){if(r||(r=[]),n)if(s=n(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case $t:var i=s.attributes,a=i.length,o=s.firstChild,c=s.tagName;t=ai.isHTML(s.namespaceURI)||t;var h=c;if(!t&&!s.prefix&&s.namespaceURI){for(var m,_=0;_<i.length;_++)if(i.item(_).name==="xmlns"){m=i.item(_).value;break}if(!m)for(var T=r.length-1;T>=0;T--){var S=r[T];if(S.prefix===""&&S.namespace===s.namespaceURI){m=S.namespace;break}}if(m!==s.namespaceURI)for(var T=r.length-1;T>=0;T--){var S=r[T];if(S.namespace===s.namespaceURI){S.prefix&&(h=S.prefix+":"+c);break}}}e.push("<",h);for(var w=0;w<a;w++){var b=i.item(w);b.prefix=="xmlns"?r.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&r.push({prefix:"",namespace:b.value})}for(var w=0;w<a;w++){var b=i.item(w);if(Su(b,t,r)){var R=b.prefix||"",L=b.namespaceURI;tl(e,R?"xmlns:"+R:"xmlns",L),r.push({prefix:R,namespace:L})}On(b,e,t,n,r)}if(c===h&&Su(s,t,r)){var R=s.prefix||"",L=s.namespaceURI;tl(e,R?"xmlns:"+R:"xmlns",L),r.push({prefix:R,namespace:L})}if(o||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(e.push(">"),t&&/^script$/i.test(c))for(;o;)o.data?e.push(o.data):On(o,e,t,n,r.slice()),o=o.nextSibling;else for(;o;)On(o,e,t,n,r.slice()),o=o.nextSibling;e.push("</",h,">")}else e.push("/>");return;case zp:case Ss:for(var o=s.firstChild;o;)On(o,e,t,n,r.slice()),o=o.nextSibling;return;case Yn:return tl(e,s.name,s.value);case Ea:return e.push(s.data.replace(/[<&>]/g,Qp));case Vp:return e.push("<![CDATA[",s.data,"]]>");case Wp:return e.push("<!--",s.data,"-->");case Gp:var U=s.publicId,M=s.systemId;if(e.push("<!DOCTYPE ",s.name),U)e.push(" PUBLIC ",U),M&&M!="."&&e.push(" ",M),e.push(">");else if(M&&M!=".")e.push(" SYSTEM ",M,">");else{var F=s.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case Hp:return e.push("<?",s.target," ",s.data,"?>");case $p:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function im(s,e,t){var n;switch(e.nodeType){case $t:n=e.cloneNode(!1),n.ownerDocument=s;case Ss:break;case Yn:t=!0;break}if(n||(n=e.cloneNode(!1)),n.ownerDocument=s,n.parentNode=null,t)for(var r=e.firstChild;r;)n.appendChild(im(s,r,t)),r=r.nextSibling;return n}function El(s,e,t){var n=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];typeof i!="object"&&i!=n[r]&&(n[r]=i)}switch(e.childNodes&&(n.childNodes=new bs),n.ownerDocument=s,n.nodeType){case $t:var a=e.attributes,o=n.attributes=new wa,c=a.length;o._ownerElement=n;for(var h=0;h<c;h++)n.setAttributeNode(El(s,a.item(h),!0));break;case Yn:t=!0}if(t)for(var m=e.firstChild;m;)n.appendChild(El(s,m,t)),m=m.nextSibling;return n}function am(s,e,t){s[e]=t}try{if(Object.defineProperty){let s=function(e){switch(e.nodeType){case $t:case Ss:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(s(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Kn.prototype,"length",{get:function(){return pc(this),this.$$length}}),Object.defineProperty(Se.prototype,"textContent",{get:function(){return s(this)},set:function(e){switch(this.nodeType){case $t:case Ss:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),am=function(e,t,n){e["$$"+t]=n}}}catch{}Ws.DocumentType=to;Ws.DOMException=We;Ws.DOMImplementation=Kp;Ws.Element=mn;Ws.Node=Se;Ws.NodeList=bs;Ws.XMLSerializer=nm;var no={},om={};(function(s){var e=ks.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:`
|
|
25
|
-
`,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})(om);var Tc={},li=ks.NAMESPACE,wl=/[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]/,Eu=new RegExp("[\\-\\.0-9"+wl.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),wu=new RegExp("^"+wl.source+Eu.source+"*(?::"+wl.source+Eu.source+"*)?$"),Mr=0,Os=1,kn=2,Ur=3,Cn=4,In=5,Br=6,ea=7;function Qn(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Qn)}Qn.prototype=new Error;Qn.prototype.name=Qn.name;function lm(){}lm.prototype={parse:function(s,e,t){var n=this.domBuilder;n.startDocument(),cm(e,e={}),PT(s,e,t,n,this.errorHandler),n.endDocument()}};function PT(s,e,t,n,r){function i(G){if(G>65535){G-=65536;var fe=55296+(G>>10),ye=56320+(G&1023);return String.fromCharCode(fe,ye)}else return String.fromCharCode(G)}function a(G){var fe=G.slice(1,-1);return Object.hasOwnProperty.call(t,fe)?t[fe]:fe.charAt(0)==="#"?i(parseInt(fe.substr(1).replace("x","0x"))):(r.error("entity not found:"+G),G)}function o(G){if(G>b){var fe=s.substring(b,G).replace(/&#?\w+;/g,a);T&&c(b),n.characters(fe,0,G-b),b=G}}function c(G,fe){for(;G>=m&&(fe=_.exec(s));)h=fe.index,m=h+fe[0].length,T.lineNumber++;T.columnNumber=G-h+1}for(var h=0,m=0,_=/.*(?:\r\n?|\n)|.*$/g,T=n.locator,S=[{currentNSMap:e}],w={},b=0;;){try{var R=s.indexOf("<",b);if(R<0){if(!s.substr(b).match(/^\s*$/)){var L=n.doc,U=L.createTextNode(s.substr(b));L.appendChild(U),n.currentElement=U}return}switch(R>b&&o(R),s.charAt(R+1)){case"/":var oe=s.indexOf(">",R+3),M=s.substring(R+2,oe).replace(/[ \t\n\r]+$/g,""),F=S.pop();oe<0?(M=s.substring(R+2).replace(/[\s<].*/,""),r.error("end tag name: "+M+" is not complete:"+F.tagName),oe=R+1+M.length):M.match(/\s</)&&(M=M.replace(/[\s<].*/,""),r.error("end tag name: "+M+" maybe not complete"),oe=R+1+M.length);var N=F.localNSMap,j=F.tagName==M,J=j||F.tagName&&F.tagName.toLowerCase()==M.toLowerCase();if(J){if(n.endElement(F.uri,F.localName,M),N)for(var K in N)Object.prototype.hasOwnProperty.call(N,K)&&n.endPrefixMapping(K);j||r.fatalError("end tag name: "+M+" is not match the current start tagName:"+F.tagName)}else S.push(F);oe++;break;case"?":T&&c(R),oe=MT(s,R,n);break;case"!":T&&c(R),oe=OT(s,R,n,r);break;default:T&&c(R);var ne=new dm,he=S[S.length-1].currentNSMap,oe=RT(s,R,ne,he,a,r),me=ne.length;if(!ne.closed&&NT(s,oe,ne.tagName,w)&&(ne.closed=!0,t.nbsp||r.warning("unclosed xml attribute")),T&&me){for(var te=ku(T,{}),ue=0;ue<me;ue++){var z=ne[ue];c(z.offset),z.locator=ku(T,{})}n.locator=te,Cu(ne,n,he)&&S.push(ne),n.locator=T}else Cu(ne,n,he)&&S.push(ne);li.isHTML(ne.uri)&&!ne.closed?oe=DT(s,oe,ne.tagName,a,n):oe++}}catch(G){if(G instanceof Qn)throw G;r.error("element parse error: "+G),oe=-1}oe>b?b=oe:o(Math.max(R,b)+1)}}function ku(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function RT(s,e,t,n,r,i){function a(T,S,w){t.attributeNames.hasOwnProperty(T)&&i.fatalError("Attribute "+T+" redefined"),t.addValue(T,S.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),w)}for(var o,c,h=++e,m=Mr;;){var _=s.charAt(h);switch(_){case"=":if(m===Os)o=s.slice(e,h),m=Ur;else if(m===kn)m=Ur;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(m===Ur||m===Os)if(m===Os&&(i.warning('attribute value must after "="'),o=s.slice(e,h)),e=h+1,h=s.indexOf(_,e),h>0)c=s.slice(e,h),a(o,c,e-1),m=In;else throw new Error("attribute value no end '"+_+"' match");else if(m==Cn)c=s.slice(e,h),a(o,c,e),i.warning('attribute "'+o+'" missed start quot('+_+")!!"),e=h+1,m=In;else throw new Error('attribute value must after "="');break;case"/":switch(m){case Mr:t.setTagName(s.slice(e,h));case In:case Br:case ea:m=ea,t.closed=!0;case Cn:case Os:break;case kn:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),m==Mr&&t.setTagName(s.slice(e,h)),h;case">":switch(m){case Mr:t.setTagName(s.slice(e,h));case In:case Br:case ea:break;case Cn:case Os:c=s.slice(e,h),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case kn:m===kn&&(c=o),m==Cn?(i.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):((!li.isHTML(n[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case Ur:throw new Error("attribute value missed!!")}return h;case"":_=" ";default:if(_<=" ")switch(m){case Mr:t.setTagName(s.slice(e,h)),m=Br;break;case Os:o=s.slice(e,h),m=kn;break;case Cn:var c=s.slice(e,h);i.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case In:m=Br;break}else switch(m){case kn:t.tagName,(!li.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,m=Os;break;case In:i.warning('attribute space is required"'+o+'"!!');case Br:m=Os,e=h;break;case Ur:m=Cn,e=h;break;case ea:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function Cu(s,e,t){for(var n=s.tagName,r=null,i=s.length;i--;){var a=s[i],o=a.qName,c=a.value,T=o.indexOf(":");if(T>0)var h=a.prefix=o.slice(0,T),m=o.slice(T+1),_=h==="xmlns"&&m;else m=o,h=null,_=o==="xmlns"&&"";a.localName=m,_!==!1&&(r==null&&(r={},cm(t,t={})),t[_]=r[_]=c,a.uri=li.XMLNS,e.startPrefixMapping(_,c))}for(var i=s.length;i--;){a=s[i];var h=a.prefix;h&&(h==="xml"&&(a.uri=li.XML),h!=="xmlns"&&(a.uri=t[h||""]))}var T=n.indexOf(":");T>0?(h=s.prefix=n.slice(0,T),m=s.localName=n.slice(T+1)):(h=null,m=s.localName=n);var S=s.uri=t[h||""];if(e.startElement(S,m,n,s),s.closed){if(e.endElement(S,m,n),r)for(h in r)Object.prototype.hasOwnProperty.call(r,h)&&e.endPrefixMapping(h)}else return s.currentNSMap=t,s.localNSMap=r,!0}function DT(s,e,t,n,r){if(/^(?:script|textarea)$/i.test(t)){var i=s.indexOf("</"+t+">",e),a=s.substring(e+1,i);if(/[&<]/.test(a))return/^script$/i.test(t)?(r.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,n),r.characters(a,0,a.length),i)}return e+1}function NT(s,e,t,n){var r=n[t];return r==null&&(r=s.lastIndexOf("</"+t+">"),r<e&&(r=s.lastIndexOf("</"+t)),n[t]=r),r<e}function cm(s,e){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}function OT(s,e,t,n){var r=s.charAt(e+2);switch(r){case"-":if(s.charAt(e+3)==="-"){var i=s.indexOf("-->",e+4);return i>e?(t.comment(s,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var i=s.indexOf("]]>",e+9);return t.startCDATA(),t.characters(s,e+9,i-e-9),t.endCDATA(),i+3}var a=UT(s,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var c=a[1][0],h=!1,m=!1;o>3&&(/^public$/i.test(a[2][0])?(h=a[3][0],m=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(m=a[3][0]));var _=a[o-1];return t.startDTD(c,h,m),t.endDTD(),_.index+_[0].length}}return-1}function MT(s,e,t){var n=s.indexOf("?>",e);if(n){var r=s.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,t.processingInstruction(r[1],r[2]),n+2):-1}return-1}function dm(){this.attributeNames={}}dm.prototype={setTagName:function(s){if(!wu.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,t){if(!wu.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:t}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function UT(s,e){var t,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(s);t=r.exec(s);)if(n.push(t),t[1])return n}Tc.XMLReader=lm;Tc.ParseError=Qn;var BT=ks,FT=Ws,Iu=om,um=Tc,jT=FT.DOMImplementation,xu=BT.NAMESPACE,qT=um.ParseError,VT=um.XMLReader;function hm(s){return s.replace(/\r[\n\u0085]/g,`
|
|
23
|
+
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const nT=" ",Jo=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},rT=function(){const s='(?:[^=]*)=(?:"[^"]*"|[^,]*)';return new RegExp("(?:^|,)("+s+")")},mt=function(s){const e={};if(!s)return e;const t=s.split(rT());let n=t.length,r;for(;n--;)t[n]!==""&&(r=/([^=]*)=(.*)/.exec(t[n]).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},yu=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 iT extends dc{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,n;if(e=e.trim(),e.length!==0){if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,i)=>{const a=i(e);return a===e?r:r.concat([a])},[e]).forEach(r=>{for(let i=0;i<this.customParsers.length;i++)if(this.customParsers[i].call(this,r))return;if(r.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:r.slice(1)});return}if(r=r.replace("\r",""),t=/^#EXTM3U/.exec(r),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(r),t){n={type:"tag",tagType:"inf"},t[1]&&(n.duration=parseFloat(t[1])),t[2]&&(n.title=t[2]),this.trigger("data",n);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"targetduration"},t[1]&&(n.duration=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"version"},t[1]&&(n.version=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"media-sequence"},t[1]&&(n.number=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){n={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(n.number=parseInt(t[1],10)),this.trigger("data",n);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(r),t){n={type:"tag",tagType:"playlist-type"},t[1]&&(n.playlistType=t[1]),this.trigger("data",n);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(r),t){n=ze(Jo(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",n);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(r),t){n={type:"tag",tagType:"allow-cache"},t[1]&&(n.allowed=!/NO/.test(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(r),t){if(n={type:"tag",tagType:"map"},t[1]){const i=mt(t[1]);i.URI&&(n.uri=i.URI),i.BYTERANGE&&(n.byterange=Jo(i.BYTERANGE))}this.trigger("data",n);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(r),t){n={type:"tag",tagType:"stream-inf"},t[1]&&(n.attributes=mt(t[1]),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=yu(n.attributes.RESOLUTION)),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),n.attributes["PROGRAM-ID"]&&(n.attributes["PROGRAM-ID"]=parseInt(n.attributes["PROGRAM-ID"],10))),this.trigger("data",n);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(r),t){n={type:"tag",tagType:"media"},t[1]&&(n.attributes=mt(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-ENDLIST/.exec(r),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(r),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(r),t){n={type:"tag",tagType:"program-date-time"},t[1]&&(n.dateTimeString=t[1],n.dateTimeObject=new Date(t[1])),this.trigger("data",n);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(r),t){n={type:"tag",tagType:"key"},t[1]&&(n.attributes=mt(t[1]),n.attributes.IV&&(n.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(n.attributes.IV=n.attributes.IV.substring(2)),n.attributes.IV=n.attributes.IV.match(/.{8}/g),n.attributes.IV[0]=parseInt(n.attributes.IV[0],16),n.attributes.IV[1]=parseInt(n.attributes.IV[1],16),n.attributes.IV[2]=parseInt(n.attributes.IV[2],16),n.attributes.IV[3]=parseInt(n.attributes.IV[3],16),n.attributes.IV=new Uint32Array(n.attributes.IV))),this.trigger("data",n);return}if(t=/^#EXT-X-START:(.*)$/.exec(r),t){n={type:"tag",tagType:"start"},t[1]&&(n.attributes=mt(t[1]),n.attributes["TIME-OFFSET"]=parseFloat(n.attributes["TIME-OFFSET"]),n.attributes.PRECISE=/YES/.test(n.attributes.PRECISE)),this.trigger("data",n);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-out-cont"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-out"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(r),t){n={type:"tag",tagType:"cue-in"},t[1]?n.data=t[1]:n.data="",this.trigger("data",n);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"skip"},n.attributes=mt(t[1]),n.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(n.attributes["SKIPPED-SEGMENTS"]=parseInt(n.attributes["SKIPPED-SEGMENTS"],10)),n.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(n.attributes["RECENTLY-REMOVED-DATERANGES"]=n.attributes["RECENTLY-REMOVED-DATERANGES"].split(nT)),this.trigger("data",n);return}if(t=/^#EXT-X-PART:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"part"},n.attributes=mt(t[1]),["DURATION"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),["INDEPENDENT","GAP"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=/YES/.test(n.attributes[i]))}),n.attributes.hasOwnProperty("BYTERANGE")&&(n.attributes.byterange=Jo(n.attributes.BYTERANGE)),this.trigger("data",n);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"server-control"},n.attributes=mt(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=/YES/.test(n.attributes[i]))}),this.trigger("data",n);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"part-inf"},n.attributes=mt(t[1]),["PART-TARGET"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseFloat(n.attributes[i]))}),this.trigger("data",n);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"preload-hint"},n.attributes=mt(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(i){if(n.attributes.hasOwnProperty(i)){n.attributes[i]=parseInt(n.attributes[i],10);const a=i==="BYTERANGE-LENGTH"?"length":"offset";n.attributes.byterange=n.attributes.byterange||{},n.attributes.byterange[a]=n.attributes[i],delete n.attributes[i]}}),this.trigger("data",n);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"rendition-report"},n.attributes=mt(t[1]),["LAST-MSN","LAST-PART"].forEach(function(i){n.attributes.hasOwnProperty(i)&&(n.attributes[i]=parseInt(n.attributes[i],10))}),this.trigger("data",n);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(r),t&&t[1]){n={type:"tag",tagType:"daterange"},n.attributes=mt(t[1]),["ID","CLASS"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=String(n.attributes[a]))}),["START-DATE","END-DATE"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=new Date(n.attributes[a]))}),["DURATION","PLANNED-DURATION"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=parseFloat(n.attributes[a]))}),["END-ON-NEXT"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=/YES/i.test(n.attributes[a]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(a){n.attributes.hasOwnProperty(a)&&(n.attributes[a]=n.attributes[a].toString(16))});const i=/^X-([A-Z]+-)+[A-Z]+$/;for(const a in n.attributes){if(!i.test(a))continue;const o=/[0-9A-Fa-f]{6}/g.test(n.attributes[a]),c=/^\d+(\.\d+)?$/.test(n.attributes[a]);n.attributes[a]=o?n.attributes[a].toString(16):c?parseFloat(n.attributes[a]):String(n.attributes[a])}this.trigger("data",n);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(r),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(r),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(r),t){n={type:"tag",tagType:"content-steering"},n.attributes=mt(t[1]),this.trigger("data",n);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(r),t){n={type:"tag",tagType:"i-frame-playlist"},n.attributes=mt(t[1]),n.attributes.URI&&(n.uri=n.attributes.URI),n.attributes.BANDWIDTH&&(n.attributes.BANDWIDTH=parseInt(n.attributes.BANDWIDTH,10)),n.attributes.RESOLUTION&&(n.attributes.RESOLUTION=yu(n.attributes.RESOLUTION)),n.attributes["AVERAGE-BANDWIDTH"]&&(n.attributes["AVERAGE-BANDWIDTH"]=parseInt(n.attributes["AVERAGE-BANDWIDTH"],10)),n.attributes["FRAME-RATE"]&&(n.attributes["FRAME-RATE"]=parseFloat(n.attributes["FRAME-RATE"])),this.trigger("data",n);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(r),t){n={type:"tag",tagType:"define"},n.attributes=mt(t[1]),this.trigger("data",n);return}this.trigger("data",{type:"tag",data:r.slice(4)})})}}addParser({expression:e,customType:t,dataParser:n,segment:r}){typeof n!="function"&&(n=i=>i),this.customParsers.push(i=>{if(e.exec(i))return this.trigger("data",{type:"custom",data:n(i),customType:t,segment:r}),!0})}addTagMapper({expression:e,map:t}){const n=r=>e.test(r)?t(r):r;this.tagMappers.push(n)}}const aT=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Ns=function(s){const e={};return Object.keys(s).forEach(function(t){e[aT(t)]=s[t]}),e},Zo=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:n}=s;if(!e)return;const r="#EXT-X-SERVER-CONTROL",i="holdBack",a="partHoldBack",o=t&&t*3,c=n&&n*2;t&&!e.hasOwnProperty(i)&&(e[i]=o,this.trigger("info",{message:`${r} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[i]<o&&(this.trigger("warn",{message:`${r} clamping HOLD-BACK (${e[i]}) to targetDuration * 3 (${o})`}),e[i]=o),n&&!e.hasOwnProperty(a)&&(e[a]=n*3,this.trigger("info",{message:`${r} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),n&&e[a]<c&&(this.trigger("warn",{message:`${r} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${c}).`}),e[a]=c)};class oT extends dc{constructor(e={}){super(),this.lineStream=new sT,this.parseStream=new iT,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,n=[];let r={},i,a,o=!1;const c=function(){},h={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let _=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let T=0,S=0;const w={};this.on("end",()=>{r.uri||!r.parts&&!r.preloadHints||(!r.map&&i&&(r.map=i),!r.key&&a&&(r.key=a),!r.timeline&&typeof _=="number"&&(r.timeline=_),this.manifest.preloadSegment=r)}),this.parseStream.on("data",function(b){let R,L;if(t.manifest.definitions){for(const U in t.manifest.definitions)if(b.uri&&(b.uri=b.uri.replace(`{$${U}}`,t.manifest.definitions[U])),b.attributes)for(const M in b.attributes)typeof b.attributes[M]=="string"&&(b.attributes[M]=b.attributes[M].replace(`{$${U}}`,t.manifest.definitions[U]))}({tag(){({version(){b.version&&(this.manifest.version=b.version)},"allow-cache"(){this.manifest.allowCache=b.allowed,"allowed"in b||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const U={};"length"in b&&(r.byterange=U,U.length=b.length,"offset"in b||(b.offset=T)),"offset"in b&&(r.byterange=U,U.offset=b.offset),T=U.offset+U.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"})),b.title&&(r.title=b.title),b.duration>0&&(r.duration=b.duration),b.duration===0&&(r.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=n},key(){if(!b.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(b.attributes.METHOD==="NONE"){a=null;return}if(!b.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(b.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:b.attributes};return}if(b.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:b.attributes.URI};return}if(b.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(b.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(b.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),b.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(b.attributes.KEYID&&b.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:b.attributes.KEYFORMAT,keyId:b.attributes.KEYID.substring(2)},pssh:Dp(b.attributes.URI.split(",")[1])};return}b.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:b.attributes.METHOD||"AES-128",uri:b.attributes.URI},typeof b.attributes.IV<"u"&&(a.iv=b.attributes.IV)},"media-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+b.number});return}this.manifest.mediaSequence=b.number},"discontinuity-sequence"(){if(!isFinite(b.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+b.number});return}this.manifest.discontinuitySequence=b.number,_=b.number},"playlist-type"(){if(!/VOD|EVENT/.test(b.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+b.playlist});return}this.manifest.playlistType=b.playlistType},map(){i={},b.uri&&(i.uri=b.uri),b.byterange&&(i.byterange=b.byterange),a&&(i.key=a)},"stream-inf"(){if(this.manifest.playlists=n,this.manifest.mediaGroups=this.manifest.mediaGroups||h,!b.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}r.attributes||(r.attributes={}),ze(r.attributes,b.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||h,!(b.attributes&&b.attributes.TYPE&&b.attributes["GROUP-ID"]&&b.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const U=this.manifest.mediaGroups[b.attributes.TYPE];U[b.attributes["GROUP-ID"]]=U[b.attributes["GROUP-ID"]]||{},R=U[b.attributes["GROUP-ID"]],L={default:/yes/i.test(b.attributes.DEFAULT)},L.default?L.autoselect=!0:L.autoselect=/yes/i.test(b.attributes.AUTOSELECT),b.attributes.LANGUAGE&&(L.language=b.attributes.LANGUAGE),b.attributes.URI&&(L.uri=b.attributes.URI),b.attributes["INSTREAM-ID"]&&(L.instreamId=b.attributes["INSTREAM-ID"]),b.attributes.CHARACTERISTICS&&(L.characteristics=b.attributes.CHARACTERISTICS),b.attributes.FORCED&&(L.forced=/yes/i.test(b.attributes.FORCED)),R[b.attributes.NAME]=L},discontinuity(){_+=1,r.discontinuity=!0,this.manifest.discontinuityStarts.push(n.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=b.dateTimeString,this.manifest.dateTimeObject=b.dateTimeObject),r.dateTimeString=b.dateTimeString,r.dateTimeObject=b.dateTimeObject;const{lastProgramDateTime:U}=this;this.lastProgramDateTime=new Date(b.dateTimeString).getTime(),U===null&&this.manifest.segments.reduceRight((M,F)=>(F.programDateTime=M-F.duration*1e3,F.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(b.duration)||b.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+b.duration});return}this.manifest.targetDuration=b.duration,Zo.call(this,this.manifest)},start(){if(!b.attributes||isNaN(b.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:b.attributes["TIME-OFFSET"],precise:b.attributes.PRECISE}},"cue-out"(){r.cueOut=b.data},"cue-out-cont"(){r.cueOutCont=b.data},"cue-in"(){r.cueIn=b.data},skip(){this.manifest.skip=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",b.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const U=this.manifest.segments.length,M=Ns(b.attributes);r.parts=r.parts||[],r.parts.push(M),M.byterange&&(M.byterange.hasOwnProperty("offset")||(M.byterange.offset=S),S=M.byterange.offset+M.byterange.length);const F=r.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${U}`,b.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((N,j)=>{N.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${j} lacks required attribute(s): LAST-PART`})})},"server-control"(){const U=this.manifest.serverControl=Ns(b.attributes);U.hasOwnProperty("canBlockReload")||(U.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Zo.call(this,this.manifest),U.canSkipDateranges&&!U.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 U=this.manifest.segments.length,M=Ns(b.attributes),F=M.type&&M.type==="PART";r.preloadHints=r.preloadHints||[],r.preloadHints.push(M),M.byterange&&(M.byterange.hasOwnProperty("offset")||(M.byterange.offset=F?S:0,F&&(S=M.byterange.offset+M.byterange.length)));const N=r.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${N} for segment #${U}`,b.attributes,["TYPE","URI"]),!!M.type)for(let j=0;j<r.preloadHints.length-1;j++){const J=r.preloadHints[j];J.type&&J.type===M.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${N} for segment #${U} has the same TYPE ${M.type} as preload hint #${j}`})}},"rendition-report"(){const U=Ns(b.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(U);const M=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];o&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${M}`,b.attributes,F)},"part-inf"(){this.manifest.partInf=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",b.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Zo.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Ns(b.attributes));const U=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${U}`,b.attributes,["ID","START-DATE"]);const M=this.manifest.dateRanges[U];M.endDate&&M.startDate&&new Date(M.endDate)<new Date(M.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),M.duration&&M.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),M.plannedDuration&&M.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const F=!!M.endOnNext;if(F&&!M.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(M.duration||M.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),M.duration&&M.endDate){const N=M.startDate.getTime()+M.duration*1e3;this.manifest.dateRanges[U].endDate=new Date(N)}if(!w[M.id])w[M.id]=M;else{for(const j in w[M.id])if(M[j]&&JSON.stringify(w[M.id][j])!==JSON.stringify(M[j])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const N=this.manifest.dateRanges.findIndex(j=>j.id===M.id);this.manifest.dateRanges[N]=ze(this.manifest.dateRanges[N],M),w[M.id]=ze(w[M.id],M),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=Ns(b.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",b.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const U=(M,F)=>{if(M in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${M}`});return}this.manifest.definitions[M]=F};if("QUERYPARAM"in b.attributes){if("NAME"in b.attributes||"IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const M=this.params.get(b.attributes.QUERYPARAM);if(!M){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${b.attributes.QUERYPARAM}`});return}U(b.attributes.QUERYPARAM,decodeURIComponent(M));return}if("NAME"in b.attributes){if("IMPORT"in b.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in b.attributes)||typeof b.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${b.attributes.NAME}`});return}U(b.attributes.NAME,b.attributes.VALUE);return}if("IMPORT"in b.attributes){if(!this.mainDefinitions[b.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${b.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}U(b.attributes.IMPORT,this.mainDefinitions[b.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:b.attributes,uri:b.uri,timeline:_}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",b.attributes,["BANDWIDTH","URI"])}}[b.tagType]||c).call(t)},uri(){r.uri=b.uri,n.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=_,i&&(r.map=i),S=0,this.lastProgramDateTime!==null&&(r.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=r.duration*1e3),r={}},comment(){},custom(){b.segment?(r.custom=r.custom||{},r.custom[b.customType]=b.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[b.customType]=b.data)}})[b.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,n){const r=[];n.forEach(function(i){t.hasOwnProperty(i)||r.push(i)}),r.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${r.join(", ")}`})}push(e){this.lineStream.push(e)}end(){this.lineStream.push(`
|
|
24
|
+
`),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 cn={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^/},lT=["video","audio","text"],_u=["Video","Audio","Text"],Np=function(s){return s&&s.replace(/avc1\.(\d+)\.(\d+)/i,function(e,t,n){var r=("00"+Number(t).toString(16)).slice(-2),i=("00"+Number(n).toString(16)).slice(-2);return"avc1."+r+"00"+i})},Jt=function(s){s===void 0&&(s="");var e=s.split(","),t=[];return e.forEach(function(n){n=n.trim();var r;lT.forEach(function(i){var a=cn[i].exec(n.toLowerCase());if(!(!a||a.length<=1)){r=i;var o=n.substring(0,a[1].length),c=n.replace(o,"");t.push({type:o,details:c,mediaType:i})}}),r||t.push({type:n,details:"",mediaType:"unknown"})}),t},cT=function(s,e){if(!s.mediaGroups.AUDIO||!e)return null;var t=s.mediaGroups.AUDIO[e];if(!t)return null;for(var n in t){var r=t[n];if(r.default&&r.playlists)return Jt(r.playlists[0].attributes.CODECS)}return null},Op=function(s){return s===void 0&&(s=""),cn.audio.test(s.trim().toLowerCase())},dT=function(s){return s===void 0&&(s=""),cn.text.test(s.trim().toLowerCase())},Xn=function(s){if(!(!s||typeof s!="string")){var e=s.toLowerCase().split(",").map(function(r){return Np(r.trim())}),t="video";e.length===1&&Op(e[0])?t="audio":e.length===1&&dT(e[0])&&(t="application");var n="mp4";return e.every(function(r){return cn.mp4.test(r)})?n="mp4":e.every(function(r){return cn.webm.test(r)})?n="webm":e.every(function(r){return cn.ogg.test(r)})&&(n="ogg"),t+"/"+n+';codecs="'+s+'"'}},ei=function(s,e){return s===void 0&&(s=""),e===void 0&&(e=!1),I.MediaSource&&I.MediaSource.isTypeSupported&&I.MediaSource.isTypeSupported(Xn(s))||e&&I.ManagedMediaSource&&I.ManagedMediaSource.isTypeSupported&&I.ManagedMediaSource.isTypeSupported(Xn(s))||!1},el=function(s){return s===void 0&&(s=""),s.toLowerCase().split(",").every(function(e){e=e.trim();for(var t=0;t<_u.length;t++){var n=_u[t];if(cn["muxer"+n].test(e))return!0}return!1})},vu="mp4a.40.2",uT="avc1.4d400d",hT=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,pT=/^application\/dash\+xml/i,Mp=function(s){return hT.test(s)?"hls":pT.test(s)?"dash":s==="application/vnd.videojs.vhs+json"?"vhs-json":null},mT=function(s){return s.toString(2).length},fT=function(s){return Math.ceil(mT(s)/8)},Up=function(s){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(s):s&&s.buffer instanceof ArrayBuffer},gT=function(s){return Up(s)},ae=function(s){return s instanceof Uint8Array?s:(!Array.isArray(s)&&!gT(s)&&!(s instanceof ArrayBuffer)&&(typeof s!="number"||typeof s=="number"&&s!==s?s=0:s=[s]),new Uint8Array(s&&s.buffer||s,s&&s.byteOffset||0,s&&s.byteLength||0))},nt=I.BigInt||Number,Sl=[nt("0x1"),nt("0x100"),nt("0x10000"),nt("0x1000000"),nt("0x100000000"),nt("0x10000000000"),nt("0x1000000000000"),nt("0x100000000000000"),nt("0x10000000000000000")];(function(){var s=new Uint16Array([65484]),e=new Uint8Array(s.buffer,s.byteOffset,s.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var yT=function(s,e){var t=e===void 0?{}:e,n=t.signed,r=n===void 0?!1:n,i=t.le,a=i===void 0?!1:i;s=ae(s);var o=a?"reduce":"reduceRight",c=s[o]?s[o]:Array.prototype[o],h=c.call(s,function(_,T,S){var w=a?S:Math.abs(S+1-s.length);return _+nt(T)*Sl[w]},nt(0));if(r){var m=Sl[s.length]/nt(2)-nt(1);h=nt(h),h>m&&(h-=m,h-=m,h-=nt(2))}return Number(h)},_T=function(s,e){var t={},n=t.le,r=n===void 0?!1:n;(typeof s!="bigint"&&typeof s!="number"||typeof s=="number"&&s!==s)&&(s=0),s=nt(s);for(var i=fT(s),a=new Uint8Array(new ArrayBuffer(i)),o=0;o<i;o++){var c=r?o:Math.abs(o+1-a.length);a[c]=Number(s/Sl[o]&nt(255)),s<0&&(a[c]=Math.abs(~a[c]),a[c]-=o===0?1:2)}return a},Bp=function(s,e){if(typeof s!="string"&&s&&typeof s.toString=="function"&&(s=s.toString()),typeof s!="string")return new Uint8Array;e||(s=unescape(encodeURIComponent(s)));for(var t=new Uint8Array(s.length),n=0;n<s.length;n++)t[n]=s.charCodeAt(n);return t},vT=function(){for(var s=arguments.length,e=new Array(s),t=0;t<s;t++)e[t]=arguments[t];if(e=e.filter(function(a){return a&&(a.byteLength||a.length)&&typeof a!="string"}),e.length<=1)return ae(e[0]);var n=e.reduce(function(a,o,c){return a+(o.byteLength||o.length)},0),r=new Uint8Array(n),i=0;return e.forEach(function(a){a=ae(a),r.set(a,i),i+=a.byteLength}),r},Ue=function(s,e,t){var n=t===void 0?{}:t,r=n.offset,i=r===void 0?0:r,a=n.mask,o=a===void 0?[]:a;s=ae(s),e=ae(e);var c=e.every?e.every:Array.prototype.every;return e.length&&s.length-i>=e.length&&c.call(e,function(h,m){var _=o[m]?o[m]&s[i+m]:s[i+m];return h===_})},bT=function(s,e,t){e.forEach(function(n){for(var r in s.mediaGroups[n])for(var i in s.mediaGroups[n][r]){var a=s.mediaGroups[n][r][i];t(a,n,r,i)}})},Ws={},ks={};function TT(s,e,t){if(t===void 0&&(t=Array.prototype),s&&typeof t.find=="function")return t.find.call(s,e);for(var n=0;n<s.length;n++)if(Object.prototype.hasOwnProperty.call(s,n)){var r=s[n];if(e.call(void 0,r,n,s))return r}}function hc(s,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(s):s}function AT(s,e){if(s===null||typeof s!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(s[t]=e[t]);return s}var Fp=hc({HTML:"text/html",isHTML:function(s){return s===Fp.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),jp=hc({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(s){return s===jp.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});ks.assign=AT;ks.find=TT;ks.freeze=hc;ks.MIME_TYPE=Fp;ks.NAMESPACE=jp;var qp=ks,is=qp.find,ai=qp.NAMESPACE;function ST(s){return s!==""}function ET(s){return s?s.split(/[\t\n\f\r ]+/).filter(ST):[]}function wT(s,e){return s.hasOwnProperty(e)||(s[e]=!0),s}function bu(s){if(!s)return[];var e=ET(s);return Object.keys(e.reduce(wT,{}))}function kT(s){return function(e){return s&&s.indexOf(e)!==-1}}function mi(s,e){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}function wt(s,e){var t=s.prototype;if(!(t instanceof e)){let n=function(){};n.prototype=e.prototype,n=new n,mi(t,n),s.prototype=t=n}t.constructor!=s&&(typeof s!="function"&&console.error("unknown Class:"+s),t.constructor=s)}var kt={},$t=kt.ELEMENT_NODE=1,Yn=kt.ATTRIBUTE_NODE=2,Ea=kt.TEXT_NODE=3,Vp=kt.CDATA_SECTION_NODE=4,$p=kt.ENTITY_REFERENCE_NODE=5,CT=kt.ENTITY_NODE=6,Hp=kt.PROCESSING_INSTRUCTION_NODE=7,Wp=kt.COMMENT_NODE=8,zp=kt.DOCUMENT_NODE=9,Gp=kt.DOCUMENT_TYPE_NODE=10,Ss=kt.DOCUMENT_FRAGMENT_NODE=11,IT=kt.NOTATION_NODE=12,dt={},et={};dt.INDEX_SIZE_ERR=(et[1]="Index size error",1);dt.DOMSTRING_SIZE_ERR=(et[2]="DOMString size error",2);var At=dt.HIERARCHY_REQUEST_ERR=(et[3]="Hierarchy request error",3);dt.WRONG_DOCUMENT_ERR=(et[4]="Wrong document",4);dt.INVALID_CHARACTER_ERR=(et[5]="Invalid character",5);dt.NO_DATA_ALLOWED_ERR=(et[6]="No data allowed",6);dt.NO_MODIFICATION_ALLOWED_ERR=(et[7]="No modification allowed",7);var Xp=dt.NOT_FOUND_ERR=(et[8]="Not found",8);dt.NOT_SUPPORTED_ERR=(et[9]="Not supported",9);var Tu=dt.INUSE_ATTRIBUTE_ERR=(et[10]="Attribute in use",10);dt.INVALID_STATE_ERR=(et[11]="Invalid state",11);dt.SYNTAX_ERR=(et[12]="Syntax error",12);dt.INVALID_MODIFICATION_ERR=(et[13]="Invalid modification",13);dt.NAMESPACE_ERR=(et[14]="Invalid namespace",14);dt.INVALID_ACCESS_ERR=(et[15]="Invalid access",15);function We(s,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,et[s]),this.message=et[s],Error.captureStackTrace&&Error.captureStackTrace(this,We);return t.code=s,e&&(this.message=this.message+": "+e),t}We.prototype=Error.prototype;mi(dt,We);function bs(){}bs.prototype={length:0,item:function(s){return s>=0&&s<this.length?this[s]:null},toString:function(s,e){for(var t=[],n=0;n<this.length;n++)On(this[n],t,s,e);return t.join("")},filter:function(s){return Array.prototype.filter.call(this,s)},indexOf:function(s){return Array.prototype.indexOf.call(this,s)}};function Kn(s,e){this._node=s,this._refresh=e,pc(this)}function pc(s){var e=s._node._inc||s._node.ownerDocument._inc;if(s._inc!==e){var t=s._refresh(s._node);if(am(s,"length",t.length),!s.$$length||t.length<s.$$length)for(var n=t.length;n in s;n++)Object.prototype.hasOwnProperty.call(s,n)&&delete s[n];mi(t,s),s._inc=e}}Kn.prototype.item=function(s){return pc(this),this[s]||null};wt(Kn,bs);function wa(){}function Yp(s,e){for(var t=s.length;t--;)if(s[t]===e)return t}function Au(s,e,t,n){if(n?e[Yp(e,n)]=t:e[e.length++]=t,s){t.ownerElement=s;var r=s.ownerDocument;r&&(n&&Jp(r,s,n),xT(r,s,t))}}function Su(s,e,t){var n=Yp(e,t);if(n>=0){for(var r=e.length-1;n<r;)e[n]=e[++n];if(e.length=r,s){var i=s.ownerDocument;i&&(Jp(i,s,t),t.ownerElement=null)}}else throw new We(Xp,new Error(s.tagName+"@"+t))}wa.prototype={length:0,item:bs.prototype.item,getNamedItem:function(s){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==s)return t}},setNamedItem:function(s){var e=s.ownerElement;if(e&&e!=this._ownerElement)throw new We(Tu);var t=this.getNamedItem(s.nodeName);return Au(this._ownerElement,this,s,t),t},setNamedItemNS:function(s){var e=s.ownerElement,t;if(e&&e!=this._ownerElement)throw new We(Tu);return t=this.getNamedItemNS(s.namespaceURI,s.localName),Au(this._ownerElement,this,s,t),t},removeNamedItem:function(s){var e=this.getNamedItem(s);return Su(this._ownerElement,this,e),e},removeNamedItemNS:function(s,e){var t=this.getNamedItemNS(s,e);return Su(this._ownerElement,this,t),t},getNamedItemNS:function(s,e){for(var t=this.length;t--;){var n=this[t];if(n.localName==e&&n.namespaceURI==s)return n}return null}};function Kp(){}Kp.prototype={hasFeature:function(s,e){return!0},createDocument:function(s,e,t){var n=new fi;if(n.implementation=this,n.childNodes=new bs,n.doctype=t||null,t&&n.appendChild(t),e){var r=n.createElementNS(s,e);n.appendChild(r)}return n},createDocumentType:function(s,e,t){var n=new to;return n.name=s,n.nodeName=s,n.publicId=e||"",n.systemId=t||"",n}};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(s,e){return ka(this,s,e)},replaceChild:function(s,e){ka(this,s,e,em),e&&this.removeChild(e)},removeChild:function(s){return Zp(this,s)},appendChild:function(s){return this.insertBefore(s,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(s){return El(this.ownerDocument||this,this,s)},normalize:function(){for(var s=this.firstChild;s;){var e=s.nextSibling;e&&e.nodeType==Ea&&s.nodeType==Ea?(this.removeChild(e),s.appendData(e.data)):(s.normalize(),s=e)}},isSupported:function(s,e){return this.ownerDocument.implementation.hasFeature(s,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(s){for(var e=this;e;){var t=e._nsMap;if(t){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&t[n]===s)return n}e=e.nodeType==Yn?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(s){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,s))return t[s];e=e.nodeType==Yn?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(s){var e=this.lookupPrefix(s);return e==null}};function Qp(s){return s=="<"&&"<"||s==">"&&">"||s=="&"&&"&"||s=='"'&&"""||"&#"+s.charCodeAt()+";"}mi(kt,Se);mi(kt,Se.prototype);function oi(s,e){if(e(s))return!0;if(s=s.firstChild)do if(oi(s,e))return!0;while(s=s.nextSibling)}function fi(){this.ownerDocument=this}function xT(s,e,t){s&&s._inc++;var n=t.namespaceURI;n===ai.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function Jp(s,e,t,n){s&&s._inc++;var r=t.namespaceURI;r===ai.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function mc(s,e,t){if(s&&s._inc){s._inc++;var n=e.childNodes;if(t)n[n.length++]=t;else{for(var r=e.firstChild,i=0;r;)n[i++]=r,r=r.nextSibling;n.length=i,delete n[n.length]}}}function Zp(s,e){var t=e.previousSibling,n=e.nextSibling;return t?t.nextSibling=n:s.firstChild=n,n?n.previousSibling=t:s.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,mc(s.ownerDocument,s),e}function LT(s){return s&&(s.nodeType===Se.DOCUMENT_NODE||s.nodeType===Se.DOCUMENT_FRAGMENT_NODE||s.nodeType===Se.ELEMENT_NODE)}function PT(s){return s&&(as(s)||fc(s)||Es(s)||s.nodeType===Se.DOCUMENT_FRAGMENT_NODE||s.nodeType===Se.COMMENT_NODE||s.nodeType===Se.PROCESSING_INSTRUCTION_NODE)}function Es(s){return s&&s.nodeType===Se.DOCUMENT_TYPE_NODE}function as(s){return s&&s.nodeType===Se.ELEMENT_NODE}function fc(s){return s&&s.nodeType===Se.TEXT_NODE}function Eu(s,e){var t=s.childNodes||[];if(is(t,as)||Es(e))return!1;var n=is(t,Es);return!(e&&n&&t.indexOf(n)>t.indexOf(e))}function wu(s,e){var t=s.childNodes||[];function n(i){return as(i)&&i!==e}if(is(t,n))return!1;var r=is(t,Es);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function RT(s,e,t){if(!LT(s))throw new We(At,"Unexpected parent node type "+s.nodeType);if(t&&t.parentNode!==s)throw new We(Xp,"child not in parent");if(!PT(e)||Es(e)&&s.nodeType!==Se.DOCUMENT_NODE)throw new We(At,"Unexpected node type "+e.nodeType+" for parent node type "+s.nodeType)}function DT(s,e,t){var n=s.childNodes||[],r=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var i=r.filter(as);if(i.length>1||is(r,fc))throw new We(At,"More than one element or text in fragment");if(i.length===1&&!Eu(s,t))throw new We(At,"Element in fragment can not be inserted before doctype")}if(as(e)&&!Eu(s,t))throw new We(At,"Only one element can be added and only after doctype");if(Es(e)){if(is(n,Es))throw new We(At,"Only one doctype is allowed");var a=is(n,as);if(t&&n.indexOf(a)<n.indexOf(t))throw new We(At,"Doctype can only be inserted before an element");if(!t&&a)throw new We(At,"Doctype can not be appended since element is present")}}function em(s,e,t){var n=s.childNodes||[],r=e.childNodes||[];if(e.nodeType===Se.DOCUMENT_FRAGMENT_NODE){var i=r.filter(as);if(i.length>1||is(r,fc))throw new We(At,"More than one element or text in fragment");if(i.length===1&&!wu(s,t))throw new We(At,"Element in fragment can not be inserted before doctype")}if(as(e)&&!wu(s,t))throw new We(At,"Only one element can be added and only after doctype");if(Es(e)){if(is(n,function(o){return Es(o)&&o!==t}))throw new We(At,"Only one doctype is allowed");var a=is(n,as);if(t&&n.indexOf(a)<n.indexOf(t))throw new We(At,"Doctype can only be inserted before an element")}}function ka(s,e,t,n){RT(s,e,t),s.nodeType===Se.DOCUMENT_NODE&&(n||DT)(s,e,t);var r=e.parentNode;if(r&&r.removeChild(e),e.nodeType===Ss){var i=e.firstChild;if(i==null)return e;var a=e.lastChild}else i=a=e;var o=t?t.previousSibling:s.lastChild;i.previousSibling=o,a.nextSibling=t,o?o.nextSibling=i:s.firstChild=i,t==null?s.lastChild=a:t.previousSibling=a;do i.parentNode=s;while(i!==a&&(i=i.nextSibling));return mc(s.ownerDocument||s,s),e.nodeType==Ss&&(e.firstChild=e.lastChild=null),e}function NT(s,e){return e.parentNode&&e.parentNode.removeChild(e),e.parentNode=s,e.previousSibling=s.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:s.firstChild=e,s.lastChild=e,mc(s.ownerDocument,s,e),e}fi.prototype={nodeName:"#document",nodeType:zp,doctype:null,documentElement:null,_inc:1,insertBefore:function(s,e){if(s.nodeType==Ss){for(var t=s.firstChild;t;){var n=t.nextSibling;this.insertBefore(t,e),t=n}return s}return ka(this,s,e),s.ownerDocument=this,this.documentElement===null&&s.nodeType===$t&&(this.documentElement=s),s},removeChild:function(s){return this.documentElement==s&&(this.documentElement=null),Zp(this,s)},replaceChild:function(s,e){ka(this,s,e,em),s.ownerDocument=this,e&&this.removeChild(e),as(s)&&(this.documentElement=s)},importNode:function(s,e){return im(this,s,e)},getElementById:function(s){var e=null;return oi(this.documentElement,function(t){if(t.nodeType==$t&&t.getAttribute("id")==s)return e=t,!0}),e},getElementsByClassName:function(s){var e=bu(s);return new Kn(this,function(t){var n=[];return e.length>0&&oi(t.documentElement,function(r){if(r!==t&&r.nodeType===$t){var i=r.getAttribute("class");if(i){var a=s===i;if(!a){var o=bu(i);a=e.every(kT(o))}a&&n.push(r)}}}),n})},createElement:function(s){var e=new mn;e.ownerDocument=this,e.nodeName=s,e.tagName=s,e.localName=s,e.childNodes=new bs;var t=e.attributes=new wa;return t._ownerElement=e,e},createDocumentFragment:function(){var s=new so;return s.ownerDocument=this,s.childNodes=new bs,s},createTextNode:function(s){var e=new gc;return e.ownerDocument=this,e.appendData(s),e},createComment:function(s){var e=new yc;return e.ownerDocument=this,e.appendData(s),e},createCDATASection:function(s){var e=new _c;return e.ownerDocument=this,e.appendData(s),e},createProcessingInstruction:function(s,e){var t=new bc;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=s,t.nodeValue=t.data=e,t},createAttribute:function(s){var e=new Ca;return e.ownerDocument=this,e.name=s,e.nodeName=s,e.localName=s,e.specified=!0,e},createEntityReference:function(s){var e=new vc;return e.ownerDocument=this,e.nodeName=s,e},createElementNS:function(s,e){var t=new mn,n=e.split(":"),r=t.attributes=new wa;return t.childNodes=new bs,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=s,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,r._ownerElement=t,t},createAttributeNS:function(s,e){var t=new Ca,n=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=s,t.specified=!0,n.length==2?(t.prefix=n[0],t.localName=n[1]):t.localName=e,t}};wt(fi,Se);function mn(){this._nsMap={}}mn.prototype={nodeType:$t,hasAttribute:function(s){return this.getAttributeNode(s)!=null},getAttribute:function(s){var e=this.getAttributeNode(s);return e&&e.value||""},getAttributeNode:function(s){return this.attributes.getNamedItem(s)},setAttribute:function(s,e){var t=this.ownerDocument.createAttribute(s);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(s){var e=this.getAttributeNode(s);e&&this.removeAttributeNode(e)},appendChild:function(s){return s.nodeType===Ss?this.insertBefore(s,null):NT(this,s)},setAttributeNode:function(s){return this.attributes.setNamedItem(s)},setAttributeNodeNS:function(s){return this.attributes.setNamedItemNS(s)},removeAttributeNode:function(s){return this.attributes.removeNamedItem(s.nodeName)},removeAttributeNS:function(s,e){var t=this.getAttributeNodeNS(s,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(s,e){return this.getAttributeNodeNS(s,e)!=null},getAttributeNS:function(s,e){var t=this.getAttributeNodeNS(s,e);return t&&t.value||""},setAttributeNS:function(s,e,t){var n=this.ownerDocument.createAttributeNS(s,e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},getAttributeNodeNS:function(s,e){return this.attributes.getNamedItemNS(s,e)},getElementsByTagName:function(s){return new Kn(this,function(e){var t=[];return oi(e,function(n){n!==e&&n.nodeType==$t&&(s==="*"||n.tagName==s)&&t.push(n)}),t})},getElementsByTagNameNS:function(s,e){return new Kn(this,function(t){var n=[];return oi(t,function(r){r!==t&&r.nodeType===$t&&(s==="*"||r.namespaceURI===s)&&(e==="*"||r.localName==e)&&n.push(r)}),n})}};fi.prototype.getElementsByTagName=mn.prototype.getElementsByTagName;fi.prototype.getElementsByTagNameNS=mn.prototype.getElementsByTagNameNS;wt(mn,Se);function Ca(){}Ca.prototype.nodeType=Yn;wt(Ca,Se);function gi(){}gi.prototype={data:"",substringData:function(s,e){return this.data.substring(s,s+e)},appendData:function(s){s=this.data+s,this.nodeValue=this.data=s,this.length=s.length},insertData:function(s,e){this.replaceData(s,0,e)},appendChild:function(s){throw new Error(et[At])},deleteData:function(s,e){this.replaceData(s,e,"")},replaceData:function(s,e,t){var n=this.data.substring(0,s),r=this.data.substring(s+e);t=n+t+r,this.nodeValue=this.data=t,this.length=t.length}};wt(gi,Se);function gc(){}gc.prototype={nodeName:"#text",nodeType:Ea,splitText:function(s){var e=this.data,t=e.substring(s);e=e.substring(0,s),this.data=this.nodeValue=e,this.length=e.length;var n=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(n,this.nextSibling),n}};wt(gc,gi);function yc(){}yc.prototype={nodeName:"#comment",nodeType:Wp};wt(yc,gi);function _c(){}_c.prototype={nodeName:"#cdata-section",nodeType:Vp};wt(_c,gi);function to(){}to.prototype.nodeType=Gp;wt(to,Se);function tm(){}tm.prototype.nodeType=IT;wt(tm,Se);function sm(){}sm.prototype.nodeType=CT;wt(sm,Se);function vc(){}vc.prototype.nodeType=$p;wt(vc,Se);function so(){}so.prototype.nodeName="#document-fragment";so.prototype.nodeType=Ss;wt(so,Se);function bc(){}bc.prototype.nodeType=Hp;wt(bc,Se);function nm(){}nm.prototype.serializeToString=function(s,e,t){return rm.call(s,e,t)};Se.prototype.toString=rm;function rm(s,e){var t=[],n=this.nodeType==9&&this.documentElement||this,r=n.prefix,i=n.namespaceURI;if(i&&r==null){var r=n.lookupPrefix(i);if(r==null)var a=[{namespace:i,prefix:null}]}return On(this,t,s,e,a),t.join("")}function ku(s,e,t){var n=s.prefix||"",r=s.namespaceURI;if(!r||n==="xml"&&r===ai.XML||r===ai.XMLNS)return!1;for(var i=t.length;i--;){var a=t[i];if(a.prefix===n)return a.namespace!==r}return!0}function tl(s,e,t){s.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,Qp),'"')}function On(s,e,t,n,r){if(r||(r=[]),n)if(s=n(s),s){if(typeof s=="string"){e.push(s);return}}else return;switch(s.nodeType){case $t:var i=s.attributes,a=i.length,o=s.firstChild,c=s.tagName;t=ai.isHTML(s.namespaceURI)||t;var h=c;if(!t&&!s.prefix&&s.namespaceURI){for(var m,_=0;_<i.length;_++)if(i.item(_).name==="xmlns"){m=i.item(_).value;break}if(!m)for(var T=r.length-1;T>=0;T--){var S=r[T];if(S.prefix===""&&S.namespace===s.namespaceURI){m=S.namespace;break}}if(m!==s.namespaceURI)for(var T=r.length-1;T>=0;T--){var S=r[T];if(S.namespace===s.namespaceURI){S.prefix&&(h=S.prefix+":"+c);break}}}e.push("<",h);for(var w=0;w<a;w++){var b=i.item(w);b.prefix=="xmlns"?r.push({prefix:b.localName,namespace:b.value}):b.nodeName=="xmlns"&&r.push({prefix:"",namespace:b.value})}for(var w=0;w<a;w++){var b=i.item(w);if(ku(b,t,r)){var R=b.prefix||"",L=b.namespaceURI;tl(e,R?"xmlns:"+R:"xmlns",L),r.push({prefix:R,namespace:L})}On(b,e,t,n,r)}if(c===h&&ku(s,t,r)){var R=s.prefix||"",L=s.namespaceURI;tl(e,R?"xmlns:"+R:"xmlns",L),r.push({prefix:R,namespace:L})}if(o||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(c)){if(e.push(">"),t&&/^script$/i.test(c))for(;o;)o.data?e.push(o.data):On(o,e,t,n,r.slice()),o=o.nextSibling;else for(;o;)On(o,e,t,n,r.slice()),o=o.nextSibling;e.push("</",h,">")}else e.push("/>");return;case zp:case Ss:for(var o=s.firstChild;o;)On(o,e,t,n,r.slice()),o=o.nextSibling;return;case Yn:return tl(e,s.name,s.value);case Ea:return e.push(s.data.replace(/[<&>]/g,Qp));case Vp:return e.push("<![CDATA[",s.data,"]]>");case Wp:return e.push("<!--",s.data,"-->");case Gp:var U=s.publicId,M=s.systemId;if(e.push("<!DOCTYPE ",s.name),U)e.push(" PUBLIC ",U),M&&M!="."&&e.push(" ",M),e.push(">");else if(M&&M!=".")e.push(" SYSTEM ",M,">");else{var F=s.internalSubset;F&&e.push(" [",F,"]"),e.push(">")}return;case Hp:return e.push("<?",s.target," ",s.data,"?>");case $p:return e.push("&",s.nodeName,";");default:e.push("??",s.nodeName)}}function im(s,e,t){var n;switch(e.nodeType){case $t:n=e.cloneNode(!1),n.ownerDocument=s;case Ss:break;case Yn:t=!0;break}if(n||(n=e.cloneNode(!1)),n.ownerDocument=s,n.parentNode=null,t)for(var r=e.firstChild;r;)n.appendChild(im(s,r,t)),r=r.nextSibling;return n}function El(s,e,t){var n=new e.constructor;for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){var i=e[r];typeof i!="object"&&i!=n[r]&&(n[r]=i)}switch(e.childNodes&&(n.childNodes=new bs),n.ownerDocument=s,n.nodeType){case $t:var a=e.attributes,o=n.attributes=new wa,c=a.length;o._ownerElement=n;for(var h=0;h<c;h++)n.setAttributeNode(El(s,a.item(h),!0));break;case Yn:t=!0}if(t)for(var m=e.firstChild;m;)n.appendChild(El(s,m,t)),m=m.nextSibling;return n}function am(s,e,t){s[e]=t}try{if(Object.defineProperty){let s=function(e){switch(e.nodeType){case $t:case Ss:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(s(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty(Kn.prototype,"length",{get:function(){return pc(this),this.$$length}}),Object.defineProperty(Se.prototype,"textContent",{get:function(){return s(this)},set:function(e){switch(this.nodeType){case $t:case Ss:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),am=function(e,t,n){e["$$"+t]=n}}}catch{}Ws.DocumentType=to;Ws.DOMException=We;Ws.DOMImplementation=Kp;Ws.Element=mn;Ws.Node=Se;Ws.NodeList=bs;Ws.XMLSerializer=nm;var no={},om={};(function(s){var e=ks.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:`
|
|
25
|
+
`,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})(om);var Tc={},li=ks.NAMESPACE,wl=/[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]/,Cu=new RegExp("[\\-\\.0-9"+wl.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Iu=new RegExp("^"+wl.source+Cu.source+"*(?::"+wl.source+Cu.source+"*)?$"),Mr=0,Os=1,kn=2,Ur=3,Cn=4,In=5,Br=6,ea=7;function Qn(s,e){this.message=s,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,Qn)}Qn.prototype=new Error;Qn.prototype.name=Qn.name;function lm(){}lm.prototype={parse:function(s,e,t){var n=this.domBuilder;n.startDocument(),cm(e,e={}),OT(s,e,t,n,this.errorHandler),n.endDocument()}};function OT(s,e,t,n,r){function i(ee){if(ee>65535){ee-=65536;var ce=55296+(ee>>10),ne=56320+(ee&1023);return String.fromCharCode(ce,ne)}else return String.fromCharCode(ee)}function a(ee){var ce=ee.slice(1,-1);return Object.hasOwnProperty.call(t,ce)?t[ce]:ce.charAt(0)==="#"?i(parseInt(ce.substr(1).replace("x","0x"))):(r.error("entity not found:"+ee),ee)}function o(ee){if(ee>b){var ce=s.substring(b,ee).replace(/&#?\w+;/g,a);T&&c(b),n.characters(ce,0,ee-b),b=ee}}function c(ee,ce){for(;ee>=m&&(ce=_.exec(s));)h=ce.index,m=h+ce[0].length,T.lineNumber++;T.columnNumber=ee-h+1}for(var h=0,m=0,_=/.*(?:\r\n?|\n)|.*$/g,T=n.locator,S=[{currentNSMap:e}],w={},b=0;;){try{var R=s.indexOf("<",b);if(R<0){if(!s.substr(b).match(/^\s*$/)){var L=n.doc,U=L.createTextNode(s.substr(b));L.appendChild(U),n.currentElement=U}return}switch(R>b&&o(R),s.charAt(R+1)){case"/":var le=s.indexOf(">",R+3),M=s.substring(R+2,le).replace(/[ \t\n\r]+$/g,""),F=S.pop();le<0?(M=s.substring(R+2).replace(/[\s<].*/,""),r.error("end tag name: "+M+" is not complete:"+F.tagName),le=R+1+M.length):M.match(/\s</)&&(M=M.replace(/[\s<].*/,""),r.error("end tag name: "+M+" maybe not complete"),le=R+1+M.length);var N=F.localNSMap,j=F.tagName==M,J=j||F.tagName&&F.tagName.toLowerCase()==M.toLowerCase();if(J){if(n.endElement(F.uri,F.localName,M),N)for(var Y in N)Object.prototype.hasOwnProperty.call(N,Y)&&n.endPrefixMapping(Y);j||r.fatalError("end tag name: "+M+" is not match the current start tagName:"+F.tagName)}else S.push(F);le++;break;case"?":T&&c(R),le=jT(s,R,n);break;case"!":T&&c(R),le=FT(s,R,n,r);break;default:T&&c(R);var re=new dm,me=S[S.length-1].currentNSMap,le=MT(s,R,re,me,a,r),ge=re.length;if(!re.closed&&BT(s,le,re.tagName,w)&&(re.closed=!0,t.nbsp||r.warning("unclosed xml attribute")),T&&ge){for(var se=xu(T,{}),he=0;he<ge;he++){var z=re[he];c(z.offset),z.locator=xu(T,{})}n.locator=se,Lu(re,n,me)&&S.push(re),n.locator=T}else Lu(re,n,me)&&S.push(re);li.isHTML(re.uri)&&!re.closed?le=UT(s,le,re.tagName,a,n):le++}}catch(ee){if(ee instanceof Qn)throw ee;r.error("element parse error: "+ee),le=-1}le>b?b=le:o(Math.max(R,b)+1)}}function xu(s,e){return e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber,e}function MT(s,e,t,n,r,i){function a(T,S,w){t.attributeNames.hasOwnProperty(T)&&i.fatalError("Attribute "+T+" redefined"),t.addValue(T,S.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,r),w)}for(var o,c,h=++e,m=Mr;;){var _=s.charAt(h);switch(_){case"=":if(m===Os)o=s.slice(e,h),m=Ur;else if(m===kn)m=Ur;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(m===Ur||m===Os)if(m===Os&&(i.warning('attribute value must after "="'),o=s.slice(e,h)),e=h+1,h=s.indexOf(_,e),h>0)c=s.slice(e,h),a(o,c,e-1),m=In;else throw new Error("attribute value no end '"+_+"' match");else if(m==Cn)c=s.slice(e,h),a(o,c,e),i.warning('attribute "'+o+'" missed start quot('+_+")!!"),e=h+1,m=In;else throw new Error('attribute value must after "="');break;case"/":switch(m){case Mr:t.setTagName(s.slice(e,h));case In:case Br:case ea:m=ea,t.closed=!0;case Cn:case Os:break;case kn:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return i.error("unexpected end of input"),m==Mr&&t.setTagName(s.slice(e,h)),h;case">":switch(m){case Mr:t.setTagName(s.slice(e,h));case In:case Br:case ea:break;case Cn:case Os:c=s.slice(e,h),c.slice(-1)==="/"&&(t.closed=!0,c=c.slice(0,-1));case kn:m===kn&&(c=o),m==Cn?(i.warning('attribute "'+c+'" missed quot(")!'),a(o,c,e)):((!li.isHTML(n[""])||!c.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+c+'" missed value!! "'+c+'" instead!!'),a(c,c,e));break;case Ur:throw new Error("attribute value missed!!")}return h;case"":_=" ";default:if(_<=" ")switch(m){case Mr:t.setTagName(s.slice(e,h)),m=Br;break;case Os:o=s.slice(e,h),m=kn;break;case Cn:var c=s.slice(e,h);i.warning('attribute "'+c+'" missed quot(")!!'),a(o,c,e);case In:m=Br;break}else switch(m){case kn:t.tagName,(!li.isHTML(n[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&i.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,e),e=h,m=Os;break;case In:i.warning('attribute space is required"'+o+'"!!');case Br:m=Os,e=h;break;case Ur:m=Cn,e=h;break;case ea:throw new Error("elements closed character '/' and '>' must be connected to")}}h++}}function Lu(s,e,t){for(var n=s.tagName,r=null,i=s.length;i--;){var a=s[i],o=a.qName,c=a.value,T=o.indexOf(":");if(T>0)var h=a.prefix=o.slice(0,T),m=o.slice(T+1),_=h==="xmlns"&&m;else m=o,h=null,_=o==="xmlns"&&"";a.localName=m,_!==!1&&(r==null&&(r={},cm(t,t={})),t[_]=r[_]=c,a.uri=li.XMLNS,e.startPrefixMapping(_,c))}for(var i=s.length;i--;){a=s[i];var h=a.prefix;h&&(h==="xml"&&(a.uri=li.XML),h!=="xmlns"&&(a.uri=t[h||""]))}var T=n.indexOf(":");T>0?(h=s.prefix=n.slice(0,T),m=s.localName=n.slice(T+1)):(h=null,m=s.localName=n);var S=s.uri=t[h||""];if(e.startElement(S,m,n,s),s.closed){if(e.endElement(S,m,n),r)for(h in r)Object.prototype.hasOwnProperty.call(r,h)&&e.endPrefixMapping(h)}else return s.currentNSMap=t,s.localNSMap=r,!0}function UT(s,e,t,n,r){if(/^(?:script|textarea)$/i.test(t)){var i=s.indexOf("</"+t+">",e),a=s.substring(e+1,i);if(/[&<]/.test(a))return/^script$/i.test(t)?(r.characters(a,0,a.length),i):(a=a.replace(/&#?\w+;/g,n),r.characters(a,0,a.length),i)}return e+1}function BT(s,e,t,n){var r=n[t];return r==null&&(r=s.lastIndexOf("</"+t+">"),r<e&&(r=s.lastIndexOf("</"+t)),n[t]=r),r<e}function cm(s,e){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(e[t]=s[t])}function FT(s,e,t,n){var r=s.charAt(e+2);switch(r){case"-":if(s.charAt(e+3)==="-"){var i=s.indexOf("-->",e+4);return i>e?(t.comment(s,e+4,i-e-4),i+3):(n.error("Unclosed comment"),-1)}else return-1;default:if(s.substr(e+3,6)=="CDATA["){var i=s.indexOf("]]>",e+9);return t.startCDATA(),t.characters(s,e+9,i-e-9),t.endCDATA(),i+3}var a=qT(s,e),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var c=a[1][0],h=!1,m=!1;o>3&&(/^public$/i.test(a[2][0])?(h=a[3][0],m=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(m=a[3][0]));var _=a[o-1];return t.startDTD(c,h,m),t.endDTD(),_.index+_[0].length}}return-1}function jT(s,e,t){var n=s.indexOf("?>",e);if(n){var r=s.substring(e,n).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return r?(r[0].length,t.processingInstruction(r[1],r[2]),n+2):-1}return-1}function dm(){this.attributeNames={}}dm.prototype={setTagName:function(s){if(!Iu.test(s))throw new Error("invalid tagName:"+s);this.tagName=s},addValue:function(s,e,t){if(!Iu.test(s))throw new Error("invalid attribute:"+s);this.attributeNames[s]=this.length,this[this.length++]={qName:s,value:e,offset:t}},length:0,getLocalName:function(s){return this[s].localName},getLocator:function(s){return this[s].locator},getQName:function(s){return this[s].qName},getURI:function(s){return this[s].uri},getValue:function(s){return this[s].value}};function qT(s,e){var t,n=[],r=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(r.lastIndex=e,r.exec(s);t=r.exec(s);)if(n.push(t),t[1])return n}Tc.XMLReader=lm;Tc.ParseError=Qn;var VT=ks,$T=Ws,Pu=om,um=Tc,HT=$T.DOMImplementation,Ru=VT.NAMESPACE,WT=um.ParseError,zT=um.XMLReader;function hm(s){return s.replace(/\r[\n\u0085]/g,`
|
|
26
26
|
`).replace(/[\r\u0085\u2028]/g,`
|
|
27
|
-
`)}function pm(s){this.options=s||{locator:{}}}pm.prototype.parseFromString=function(s,e){var t=this.options,n=new
|
|
28
|
-
@`+(s.systemId||"")+"#[line:"+s.lineNumber+",col:"+s.columnNumber+"]"}function Lu(s,e,t){return typeof s=="string"?s.substr(e,t):s.length>=e+t||e?new java.lang.String(s,e,t)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){yi.prototype[s]=function(){return null}});function ta(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}no.__DOMHandler=yi;no.normalizeLineEndings=hm;no.DOMParser=pm;var mm=no.DOMParser;const HT=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:mm},Symbol.toStringTag,{value:"Module"}));/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const Pu=s=>!!s&&typeof s=="object",Je=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(n=>{Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=e[n].concat(t[n]):Pu(e[n])&&Pu(t[n])?e[n]=Je(e[n],t[n]):e[n]=t[n]}),e),{}),fm=s=>Object.keys(s).map(e=>s[e]),WT=(s,e)=>{const t=[];for(let n=s;n<e;n++)t.push(n);return t},Zn=s=>s.reduce((e,t)=>e.concat(t),[]),gm=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},zT=(s,e)=>s.reduce((t,n,r)=>(n[e]&&t.push(r),t),[]),GT=(s,e)=>fm(s.reduce((t,n)=>(n.forEach(r=>{t[e(r)]=r}),t),{}));var Jn={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const ci=({baseUrl:s="",source:e="",range:t="",indexRange:n=""})=>{const r={uri:e,resolvedUri:Ja(s||"",e)};if(t||n){const i=(t||n).split("-");let a=I.BigInt?I.BigInt(i[0]):parseInt(i[0],10),o=I.BigInt?I.BigInt(i[1]):parseInt(i[1],10);a<Number.MAX_SAFE_INTEGER&&typeof a=="bigint"&&(a=Number(a)),o<Number.MAX_SAFE_INTEGER&&typeof o=="bigint"&&(o=Number(o));let c;typeof o=="bigint"||typeof a=="bigint"?c=I.BigInt(o)-I.BigInt(a)+I.BigInt(1):c=o-a+1,typeof c=="bigint"&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),r.byterange={length:c,offset:a}}return r},XT=s=>{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=I.BigInt(s.offset)+I.BigInt(s.length)-I.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},Ru=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),YT={static(s){const{duration:e,timescale:t=1,sourceDuration:n,periodDuration:r}=s,i=Ru(s.endNumber),a=e/t;return typeof i=="number"?{start:0,end:i}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:n/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:n,timescale:r=1,duration:i,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:c=1/0}=s,h=Ru(s.endNumber),m=(e+t)/1e3,_=n+a,T=m+o-_,S=Math.ceil(T*r/i),w=Math.floor((m-_-c)*r/i),b=Math.floor((m-_)*r/i);return{start:Math.max(0,w),end:typeof h=="number"?h:Math.min(S,b)}}},KT=s=>e=>{const{duration:t,timescale:n=1,periodStart:r,startNumber:i=1}=s;return{number:i+e,duration:t/n,timeline:r,time:e*t}},Ac=s=>{const{type:e,duration:t,timescale:n=1,periodDuration:r,sourceDuration:i}=s,{start:a,end:o}=YT[e](s),c=WT(a,o).map(KT(s));if(e==="static"){const h=c.length-1,m=typeof r=="number"?r:i;c[h].duration=m-t/n*h}return c},ym=s=>{const{baseUrl:e,initialization:t={},sourceDuration:n,indexRange:r="",periodStart:i,presentationTime:a,number:o=0,duration:c}=s;if(!e)throw new Error(Jn.NO_BASE_URL);const h=ci({baseUrl:e,source:t.sourceURL,range:t.range}),m=ci({baseUrl:e,source:e,indexRange:r});if(m.map=h,c){const _=Ac(s);_.length&&(m.duration=_[0].duration,m.timeline=_[0].timeline)}else n&&(m.duration=n,m.timeline=i);return m.presentationTime=a||i,m.number=o,[m]},Sc=(s,e,t)=>{const n=s.sidx.map?s.sidx.map:null,r=s.sidx.duration,i=s.timeline||0,a=s.sidx.byterange,o=a.offset+a.length,c=e.timescale,h=e.references.filter(R=>R.referenceType!==1),m=[],_=s.endList?"static":"dynamic",T=s.sidx.timeline;let S=T,w=s.mediaSequence||0,b;typeof e.firstOffset=="bigint"?b=I.BigInt(o)+e.firstOffset:b=o+e.firstOffset;for(let R=0;R<h.length;R++){const L=e.references[R],U=L.referencedSize,M=L.subsegmentDuration;let F;typeof b=="bigint"?F=b+I.BigInt(U)-I.BigInt(1):F=b+U-1;const N=`${b}-${F}`,j=ym({baseUrl:t,timescale:c,timeline:i,periodStart:T,presentationTime:S,number:w,duration:M,sourceDuration:r,indexRange:N,type:_})[0];n&&(j.map=n),m.push(j),typeof b=="bigint"?b+=I.BigInt(U):b+=U,S+=M/c,w++}return s.segments=m,s},QT=["AUDIO","SUBTITLES"],ZT=1/60,_m=s=>GT(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),JT=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Du=s=>{let e=[];return gT(s,QT,(t,n,r,i)=>{e=e.concat(t.playlists||[])}),e},Nu=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,n)=>{t.number=s.mediaSequence+n})},e1=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(n=>{n.discontinuitySequence=t.findIndex(function({timeline:o}){return o===n.timeline});const r=JT(s,n.attributes.NAME);if(!r||n.sidx)return;const i=n.segments[0],a=r.segments.findIndex(function(o){return Math.abs(o.presentationTime-i.presentationTime)<ZT});if(a===-1){Nu({playlist:n,mediaSequence:r.mediaSequence+r.segments.length}),n.segments[0].discontinuity=!0,n.discontinuityStarts.unshift(0),(!r.segments.length&&n.timeline>r.timeline||r.segments.length&&n.timeline>r.segments[r.segments.length-1].timeline)&&n.discontinuitySequence--;return}r.segments[a].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,n.discontinuityStarts.unshift(0),n.discontinuitySequence--),Nu({playlist:n,mediaSequence:r.segments[a].number})})},t1=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Du(s)),n=e.playlists.concat(Du(e));return e.timelineStarts=_m([s.timelineStarts,e.timelineStarts]),e1({oldPlaylists:t,newPlaylists:n,timelineStarts:e.timelineStarts}),e},ro=s=>s&&s.uri+"-"+XT(s.byterange),sl=s=>{const e=s.reduce(function(n,r){return n[r.attributes.baseUrl]||(n[r.attributes.baseUrl]=[]),n[r.attributes.baseUrl].push(r),n},{});let t=[];return Object.values(e).forEach(n=>{const r=fm(n.reduce((i,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return i[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),i[o].segments.push(...a.segments)),a.attributes.contentProtection&&(i[o].attributes.contentProtection=a.attributes.contentProtection)):(i[o]=a,i[o].attributes.timelineStarts=[]),i[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),i},{}));t=t.concat(r)}),t.map(n=>(n.discontinuityStarts=zT(n.segments||[],"discontinuity"),n))},Ec=(s,e)=>{const t=ro(s.sidx),n=t&&e[t]&&e[t].sidx;return n&&Sc(s,n,s.sidx.resolvedUri),s},s1=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Ec(s[t],e);return s},n1=({attributes:s,segments:e,sidx:t,mediaSequence:n,discontinuitySequence:r,discontinuityStarts:i},a)=>{const o={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:i,timelineStarts:s.timelineStarts,mediaSequence:n,segments:e};return s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},r1=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:n,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 i={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(i.CODECS=s.codecs);const a={attributes:i,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:n,discontinuitySequence:r,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},i1=(s,e={},t=!1)=>{let n;const r=s.reduce((i,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",c=a.attributes.lang||"";let h=a.attributes.label||"main";if(c&&!a.attributes.label){const _=o?` (${o})`:"";h=`${a.attributes.lang}${_}`}i[h]||(i[h]={language:c,autoselect:!0,default:o==="main",playlists:[],uri:""});const m=Ec(n1(a,t),e);return i[h].playlists.push(m),typeof n>"u"&&o==="main"&&(n=a,n.default=!0),i},{});if(!n){const i=Object.keys(r)[0];r[i].default=!0}return r},a1=(s,e={})=>s.reduce((t,n)=>{const r=n.attributes.label||n.attributes.lang||"text",i=n.attributes.lang||"und";return t[r]||(t[r]={language:i,default:!1,autoselect:!1,playlists:[],uri:""}),t[r].playlists.push(Ec(r1(n),e)),t},{}),o1=s=>s.reduce((e,t)=>(t&&t.forEach(n=>{const{channel:r,language:i}=n;e[i]={autoselect:!1,default:!1,instreamId:r,language:i},n.hasOwnProperty("aspectRatio")&&(e[i].aspectRatio=n.aspectRatio),n.hasOwnProperty("easyReader")&&(e[i].easyReader=n.easyReader),n.hasOwnProperty("3D")&&(e[i]["3D"]=n["3D"])}),e),{}),l1=({attributes:s,segments:e,sidx:t,discontinuityStarts:n})=>{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:n,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},c1=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",d1=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",u1=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",h1=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:n}){return n===t.timeline}),t.segments&&t.segments.forEach((n,r)=>{n.number=r})})},Ou=s=>s?Object.keys(s).reduce((e,t)=>{const n=s[t];return e.concat(n.playlists)},[]):[],p1=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:n={},previousManifest:r,eventStream:i})=>{if(!s.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=s[0].attributes,m=sl(s.filter(c1)).map(l1),_=sl(s.filter(d1)),T=sl(s.filter(u1)),S=s.map(F=>F.attributes.captionServices).filter(Boolean),w={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:s1(m,n)};h>=0&&(w.minimumUpdatePeriod=h*1e3),e&&(w.locations=e),t&&(w.contentSteering=t),o==="dynamic"&&(w.suggestedPresentationDelay=c),i&&i.length>0&&(w.eventStream=i);const b=w.playlists.length===0,R=_.length?i1(_,n,b):null,L=T.length?a1(T,n):null,U=m.concat(Ou(R),Ou(L)),M=U.map(({timelineStarts:F})=>F);return w.timelineStarts=_m(M),h1(U,w.timelineStarts),R&&(w.mediaGroups.AUDIO.audio=R),L&&(w.mediaGroups.SUBTITLES.subs=L),S.length&&(w.mediaGroups["CLOSED-CAPTIONS"].cc=o1(S)),r?t1({oldManifest:r,newManifest:w}):w},m1=(s,e,t)=>{const{NOW:n,clientOffset:r,availabilityStartTime:i,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:c=0}=s,h=(n+r)/1e3,m=i+o,_=h+c-m;return Math.ceil((_*a-e)/t)},vm=(s,e)=>{const{type:t,minimumUpdatePeriod:n=0,media:r="",sourceDuration:i,timescale:a=1,startNumber:o=1,periodStart:c}=s,h=[];let m=-1;for(let _=0;_<e.length;_++){const T=e[_],S=T.d,w=T.r||0,b=T.t||0;m<0&&(m=b),b&&b>m&&(m=b);let R;if(w<0){const M=_+1;M===e.length?t==="dynamic"&&n>0&&r.indexOf("$Number$")>0?R=m1(s,m,S):R=(i*a-m)/S:R=(e[M].t-m)/S}else R=w+1;const L=o+h.length+R;let U=o+h.length;for(;U<L;)h.push({number:U,duration:S/a,time:m,timeline:c}),m+=S,U++}return h},f1=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,g1=s=>(e,t,n,r)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const i=""+s[t];return t==="RepresentationID"||(n?r=parseInt(r,10):r=1,i.length>=r)?i:`${new Array(r-i.length+1).join("0")}${i}`},Mu=(s,e)=>s.replace(f1,g1(e)),y1=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Ac(s):vm(s,e),_1=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=s,r=ci({baseUrl:s.baseUrl,source:Mu(n.sourceURL,t),range:n.range});return y1(s,e).map(i=>{t.Number=i.number,t.Time=i.time;const a=Mu(s.media||"",t),o=s.timescale||1,c=s.presentationTimeOffset||0,h=s.periodStart+(i.time-c)/o;return{uri:a,timeline:i.timeline,duration:i.duration,resolvedUri:Ja(s.baseUrl||"",a),map:r,number:i.number,presentationTime:h}})},v1=(s,e)=>{const{baseUrl:t,initialization:n={}}=s,r=ci({baseUrl:t,source:n.sourceURL,range:n.range}),i=ci({baseUrl:t,source:e.media,range:e.mediaRange});return i.map=r,i},b1=(s,e)=>{const{duration:t,segmentUrls:n=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(Jn.SEGMENT_TIME_UNSPECIFIED);const i=n.map(o=>v1(s,o));let a;return t&&(a=Ac(s)),e&&(a=vm(s,e)),a.map((o,c)=>{if(i[c]){const h=i[c],m=s.timescale||1,_=s.presentationTimeOffset||0;return h.timeline=o.timeline,h.duration=o.duration,h.number=o.number,h.presentationTime=r+(o.time-_)/m,h}}).filter(o=>o)},T1=({attributes:s,segmentInfo:e})=>{let t,n;e.template?(n=_1,t=Je(s,e.template)):e.base?(n=ym,t=Je(s,e.base)):e.list&&(n=b1,t=Je(s,e.list));const r={attributes:s};if(!n)return r;const i=n(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else i.length?t.duration=i.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return r.attributes=t,r.segments=i,e.base&&t.indexRange&&(r.sidx=i[0],r.segments=[]),r},A1=s=>s.map(T1),Be=(s,e)=>gm(s.childNodes).filter(({tagName:t})=>t===e),_i=s=>s.textContent.trim(),S1=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),Ln=s=>{const e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!e)return 0;const[t,n,r,i,a,o]=e.slice(1);return parseFloat(t||0)*31536e3+parseFloat(n||0)*2592e3+parseFloat(r||0)*86400+parseFloat(i||0)*3600+parseFloat(a||0)*60+parseFloat(o||0)},E1=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),Uu={mediaPresentationDuration(s){return Ln(s)},availabilityStartTime(s){return E1(s)/1e3},minimumUpdatePeriod(s){return Ln(s)},suggestedPresentationDelay(s){return Ln(s)},type(s){return s},timeShiftBufferDepth(s){return Ln(s)},start(s){return Ln(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return S1(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)?Ln(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}},Ge=s=>s&&s.attributes?gm(s.attributes).reduce((e,t)=>{const n=Uu[t.name]||Uu.DEFAULT;return e[t.name]=n(t.value),e},{}):{},w1={"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"},io=(s,e)=>e.length?Zn(s.map(function(t){return e.map(function(n){const r=_i(n),i=Ja(t.baseUrl,r),a=Je(Ge(n),{baseUrl:i});return i!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,wc=s=>{const e=Be(s,"SegmentTemplate")[0],t=Be(s,"SegmentList")[0],n=t&&Be(t,"SegmentURL").map(_=>Je({tag:"SegmentURL"},Ge(_))),r=Be(s,"SegmentBase")[0],i=t||e,a=i&&Be(i,"SegmentTimeline")[0],o=t||r||e,c=o&&Be(o,"Initialization")[0],h=e&&Ge(e);h&&c?h.initialization=c&&Ge(c):h&&h.initialization&&(h.initialization={sourceURL:h.initialization});const m={template:h,segmentTimeline:a&&Be(a,"S").map(_=>Ge(_)),list:t&&Je(Ge(t),{segmentUrls:n,initialization:Ge(c)}),base:r&&Je(Ge(r),{initialization:Ge(c)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},k1=(s,e,t)=>n=>{const r=Be(n,"BaseURL"),i=io(e,r),a=Je(s,Ge(n)),o=wc(n);return i.map(c=>({segmentInfo:Je(t,o),attributes:Je(a,c)}))},C1=s=>s.reduce((e,t)=>{const n=Ge(t);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());const r=w1[n.schemeIdUri];if(r){e[r]={attributes:n};const i=Be(t,"cenc:pssh")[0];if(i){const a=_i(i);e[r].pssh=a&&Dp(a)}}return e},{}),I1=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(e=>{let t,n;return n=e,/^CC\d=/.test(e)?[t,n]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:n}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[n,r=""]=e.split("=");t.channel=n,t.language=e,r.split(",").forEach(i=>{const[a,o]=i.split(":");a==="lang"?t.language=o:a==="er"?t.easyReader=Number(o):a==="war"?t.aspectRatio=Number(o):a==="3D"&&(t["3D"]=Number(o))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})},x1=s=>Zn(Be(s.node,"EventStream").map(e=>{const t=Ge(e),n=t.schemeIdUri;return Be(e,"Event").map(r=>{const i=Ge(r),a=i.presentationTime||0,o=t.timescale||1,c=i.duration||0,h=a/o+s.attributes.start;return{schemeIdUri:n,value:t.value,id:i.id,start:h,end:h+c/o,messageData:_i(r)||i.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),L1=(s,e,t)=>n=>{const r=Ge(n),i=io(e,Be(n,"BaseURL")),a=Be(n,"Role")[0],o={role:Ge(a)};let c=Je(s,r,o);const h=Be(n,"Accessibility")[0],m=I1(Ge(h));m&&(c=Je(c,{captionServices:m}));const _=Be(n,"Label")[0];if(_&&_.childNodes.length){const R=_.childNodes[0].nodeValue.trim();c=Je(c,{label:R})}const T=C1(Be(n,"ContentProtection"));Object.keys(T).length&&(c=Je(c,{contentProtection:T}));const S=wc(n),w=Be(n,"Representation"),b=Je(t,S);return Zn(w.map(k1(c,i,b)))},P1=(s,e)=>(t,n)=>{const r=io(e,Be(t.node,"BaseURL")),i=Je(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(i.periodDuration=t.attributes.duration);const a=Be(t.node,"AdaptationSet"),o=wc(t.node);return Zn(a.map(L1(i,r,o)))},R1=(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:_i(s[0])},Ge(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},D1=({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,N1=(s,e={})=>{const{manifestUri:t="",NOW:n=Date.now(),clientOffset:r=0,eventHandler:i=function(){}}=e,a=Be(s,"Period");if(!a.length)throw new Error(Jn.INVALID_NUMBER_OF_PERIOD);const o=Be(s,"Location"),c=Ge(s),h=io([{baseUrl:t}],Be(s,"BaseURL")),m=Be(s,"ContentSteering");c.type=c.type||"static",c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=n,c.clientOffset=r,o.length&&(c.locations=o.map(_i));const _=[];return a.forEach((T,S)=>{const w=Ge(T),b=_[S-1];w.start=D1({attributes:w,priorPeriodAttributes:b?b.attributes:null,mpdType:c.type}),_.push({node:T,attributes:w})}),{locations:c.locations,contentSteeringInfo:R1(m,i),representationInfo:Zn(_.map(P1(c,h))),eventStream:Zn(_.map(x1))}},bm=s=>{if(s==="")throw new Error(Jn.DASH_EMPTY_MANIFEST);const e=new mm;let t,n;try{t=e.parseFromString(s,"application/xml"),n=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Jn.DASH_INVALID_XML);return n},O1=s=>{const e=Be(s,"UTCTiming")[0];if(!e)return null;const t=Ge(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Jn.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},M1=(s,e={})=>{const t=N1(bm(s),e),n=A1(t.representationInfo);return p1({dashPlaylists:n,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},U1=s=>O1(bm(s));var Tm=Math.pow(2,32),B1=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*Tm+e.getUint32(4)},F1={getUint64:B1,MAX_UINT32:Tm},Bu=F1.getUint64,j1=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t={version:s[0],flags:new Uint8Array(s.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},n=12;t.version===0?(t.earliestPresentationTime=e.getUint32(n),t.firstOffset=e.getUint32(n+4),n+=8):(t.earliestPresentationTime=Bu(s.subarray(n)),t.firstOffset=Bu(s.subarray(n+8)),n+=16),n+=2;var r=e.getUint16(n);for(n+=2;r>0;n+=12,r--)t.references.push({referenceType:(s[n]&128)>>>7,referencedSize:e.getUint32(n)&2147483647,subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(s[n+8]&128),sapType:(s[n+8]&112)>>>4,sapDeltaTime:e.getUint32(n+8)&268435455});return t},q1=j1;const V1=or(q1);var $1=ie([73,68,51]),H1=function(s,e){e===void 0&&(e=0),s=ie(s);var t=s[e+5],n=s[e+6]<<21|s[e+7]<<14|s[e+8]<<7|s[e+9],r=(t&16)>>4;return r?n+20:n+10},Wr=function s(e,t){return t===void 0&&(t=0),e=ie(e),e.length-t<10||!Ue(e,$1,{offset:t})?t:(t+=H1(e,t),s(e,t))},Fu=function(s){return typeof s=="string"?Bp(s):s},W1=function(s){return Array.isArray(s)?s.map(function(e){return Fu(e)}):[Fu(s)]},z1=function s(e,t,n){n===void 0&&(n=!1),t=W1(t),e=ie(e);var r=[];if(!t.length)return r;for(var i=0;i<e.length;){var a=(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])>>>0,o=e.subarray(i+4,i+8);if(a===0)break;var c=i+a;if(c>e.length){if(n)break;c=e.length}var h=e.subarray(i+8,c);Ue(o,t[0])&&(t.length===1?r.push(h):r.push.apply(r,s(h,t.slice(1),n))),i=c}return r},sa={EBML:ie([26,69,223,163]),DocType:ie([66,130]),Segment:ie([24,83,128,103]),SegmentInfo:ie([21,73,169,102]),Tracks:ie([22,84,174,107]),Track:ie([174]),TrackNumber:ie([215]),DefaultDuration:ie([35,227,131]),TrackEntry:ie([174]),TrackType:ie([131]),FlagDefault:ie([136]),CodecID:ie([134]),CodecPrivate:ie([99,162]),VideoTrack:ie([224]),AudioTrack:ie([225]),Cluster:ie([31,67,182,117]),Timestamp:ie([231]),TimestampScale:ie([42,215,177]),BlockGroup:ie([160]),BlockDuration:ie([155]),Block:ie([161]),SimpleBlock:ie([163])},Cl=[128,64,32,16,8,4,2,1],G1=function(s){for(var e=1,t=0;t<Cl.length&&!(s&Cl[t]);t++)e++;return e},Ia=function(s,e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1);var r=G1(s[e]),i=s.subarray(e,e+r);return t&&(i=Array.prototype.slice.call(s,e,e+r),i[0]^=Cl[r-1]),{length:r,value:pT(i,{signed:n}),bytes:i}},ju=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?mT(e):e},X1=function(s){return Array.isArray(s)?s.map(function(e){return ju(e)}):[ju(s)]},Y1=function s(e,t,n){if(n>=t.length)return t.length;var r=Ia(t,n,!1);if(Ue(e.bytes,r.bytes))return n;var i=Ia(t,n+r.length);return s(e,t,n+i.length+i.value+r.length)},qu=function s(e,t){t=X1(t),e=ie(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var i=Ia(e,r,!1),a=Ia(e,r+i.length),o=r+i.length+a.length;a.value===127&&(a.value=Y1(i,e,o),a.value!==e.length&&(a.value-=o));var c=o+a.value>e.length?e.length:o+a.value,h=e.subarray(o,c);Ue(t[0],i.bytes)&&(t.length===1?n.push(h):n=n.concat(s(h,t.slice(1))));var m=i.length+a.length+h.length;r+=m}return n},K1=ie([0,0,0,1]),Q1=ie([0,0,1]),Z1=ie([0,0,3]),J1=function(s){for(var e=[],t=1;t<s.length-2;)Ue(s.subarray(t,t+3),Z1)&&(e.push(t+2),t++),t++;if(e.length===0)return s;var n=s.length-e.length,r=new Uint8Array(n),i=0;for(t=0;t<n;i++,t++)i===e[0]&&(i++,e.shift()),r[t]=s[i];return r},Am=function(s,e,t,n){s=ie(s),t=[].concat(t);for(var r=0,i,a=0;r<s.length&&(a<n||i);){var o=void 0;if(Ue(s.subarray(r),K1)?o=4:Ue(s.subarray(r),Q1)&&(o=3),!o){r++;continue}if(a++,i)return J1(s.subarray(i,r));var c=void 0;e==="h264"?c=s[r+o]&31:e==="h265"&&(c=s[r+o]>>1&63),t.indexOf(c)!==-1&&(i=r+o),r+=o+(e==="h264"?1:2)}return s.subarray(0,0)},eA=function(s,e,t){return Am(s,"h264",e,t)},tA=function(s,e,t){return Am(s,"h265",e,t)},ft={webm:ie([119,101,98,109]),matroska:ie([109,97,116,114,111,115,107,97]),flac:ie([102,76,97,67]),ogg:ie([79,103,103,83]),ac3:ie([11,119]),riff:ie([82,73,70,70]),avi:ie([65,86,73]),wav:ie([87,65,86,69]),"3gp":ie([102,116,121,112,51,103]),mp4:ie([102,116,121,112]),fmp4:ie([115,116,121,112]),mov:ie([102,116,121,112,113,116]),moov:ie([109,111,111,118]),moof:ie([109,111,111,102])},er={aac:function(s){var e=Wr(s);return Ue(s,[255,16],{offset:e,mask:[255,22]})},mp3:function(s){var e=Wr(s);return Ue(s,[255,2],{offset:e,mask:[255,6]})},webm:function(s){var e=qu(s,[sa.EBML,sa.DocType])[0];return Ue(e,ft.webm)},mkv:function(s){var e=qu(s,[sa.EBML,sa.DocType])[0];return Ue(e,ft.matroska)},mp4:function(s){if(er["3gp"](s)||er.mov(s))return!1;if(Ue(s,ft.mp4,{offset:4})||Ue(s,ft.fmp4,{offset:4})||Ue(s,ft.moof,{offset:4})||Ue(s,ft.moov,{offset:4}))return!0},mov:function(s){return Ue(s,ft.mov,{offset:4})},"3gp":function(s){return Ue(s,ft["3gp"],{offset:4})},ac3:function(s){var e=Wr(s);return Ue(s,ft.ac3,{offset:e})},ts:function(s){if(s.length<189&&s.length>=1)return s[0]===71;for(var e=0;e+188<s.length&&e<188;){if(s[e]===71&&s[e+188]===71)return!0;e+=1}return!1},flac:function(s){var e=Wr(s);return Ue(s,ft.flac,{offset:e})},ogg:function(s){return Ue(s,ft.ogg)},avi:function(s){return Ue(s,ft.riff)&&Ue(s,ft.avi,{offset:8})},wav:function(s){return Ue(s,ft.riff)&&Ue(s,ft.wav,{offset:8})},h264:function(s){return eA(s,7,3).length},h265:function(s){return tA(s,[32,33],3).length}},Il=Object.keys(er).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);Il.forEach(function(s){var e=er[s];er[s]=function(t){return e(ie(t))}});var sA=er,kc=function(s){s=ie(s);for(var e=0;e<Il.length;e++){var t=Il[e];if(sA[t](s))return t}return""},nA=function(s){return z1(s,["moof"]).length>0},Cc=9e4,Ic,xc,ao,Lc,Sm,Em,wm;Ic=function(s){return s*Cc};xc=function(s,e){return s*e};ao=function(s){return s/Cc};Lc=function(s,e){return s/e};Sm=function(s,e){return Ic(Lc(s,e))};Em=function(s,e){return xc(ao(s),e)};wm=function(s,e,t){return ao(t?s:s-e)};var on={ONE_SECOND_IN_TS:Cc,secondsToVideoTs:Ic,secondsToAudioTs:xc,videoTsToSeconds:ao,audioTsToSeconds:Lc,audioTsToVideoTs:Sm,videoTsToAudioTs:Em,metadataTsToSeconds:wm},xl="8.21.0";const _s={},$s=function(s,e){return _s[s]=_s[s]||[],e&&(_s[s]=_s[s].concat(e)),_s[s]},rA=function(s,e){$s(s,e)},km=function(s,e){const t=$s(s).indexOf(e);return t<=-1?!1:(_s[s]=_s[s].slice(),_s[s].splice(t,1),!0)},iA=function(s,e){$s(s,[].concat(e).map(t=>{const n=(...r)=>(km(s,n),t(...r));return n}))},xa={prefixed:!0},la=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Vu=la[0];let zr;for(let s=0;s<la.length;s++)if(la[s][1]in Y){zr=la[s];break}if(zr){for(let s=0;s<zr.length;s++)xa[Vu[s]]=zr[s];xa.prefixed=zr[0]!==Vu[0]}let Tt=[];const aA=(s,e,t)=>(n,r,i)=>{const a=e.levels[r],o=new RegExp(`^(${a})$`);let c=s;if(n!=="log"&&i.unshift(n.toUpperCase()+":"),t&&(c=`%c${s}`,i.unshift(t)),i.unshift(c+":"),Tt){Tt.push([].concat(i));const m=Tt.length-1e3;Tt.splice(0,m>0?m:0)}if(!I.console)return;let h=I.console[n];!h&&n==="debug"&&(h=I.console.info||I.console.log),!(!h||!a||!o.test(n))&&h[Array.isArray(i)?"apply":"call"](I.console,i)};function Ll(s,e=":",t=""){let n="info",r;function i(...a){r("log",n,a)}return r=aA(s,i,t),i.createLogger=(a,o,c)=>{const h=o!==void 0?o:e,m=c!==void 0?c:t,_=`${s} ${h} ${a}`;return Ll(_,h,m)},i.createNewLogger=(a,o,c)=>Ll(a,o,c),i.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},i.level=a=>{if(typeof a=="string"){if(!i.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);n=a}return n},i.history=()=>Tt?[].concat(Tt):[],i.history.filter=a=>(Tt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),i.history.clear=()=>{Tt&&(Tt.length=0)},i.history.disable=()=>{Tt!==null&&(Tt.length=0,Tt=null)},i.history.enable=()=>{Tt===null&&(Tt=[])},i.error=(...a)=>r("error",n,a),i.warn=(...a)=>r("warn",n,a),i.debug=(...a)=>r("debug",n,a),i}const pe=Ll("VIDEOJS"),Cm=pe.createLogger,oA=Object.prototype.toString,Im=function(s){return os(s)?Object.keys(s):[]};function Fn(s,e){Im(s).forEach(t=>e(s[t],t))}function xm(s,e,t=0){return Im(s).reduce((n,r)=>e(n,s[r],r),t)}function os(s){return!!s&&typeof s=="object"}function tr(s){return os(s)&&oA.call(s)==="[object Object]"&&s.constructor===Object}function we(...s){const e={};return s.forEach(t=>{t&&Fn(t,(n,r)=>{if(!tr(n)){e[r]=n;return}tr(e[r])||(e[r]={}),e[r]=we(e[r],n)})}),e}function Lm(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const n=s[t];e.push(n)}return e}function oo(s,e,t,n=!0){const r=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),i={configurable:!0,enumerable:!0,get(){const a=t();return r(a),a}};return n&&(i.set=r),Object.defineProperty(s,e,i)}var lA=Object.freeze({__proto__:null,each:Fn,reduce:xm,isObject:os,isPlain:tr,merge:we,values:Lm,defineLazyProperty:oo});let Pc=!1,Pm=null,Wt=!1,Rm,Dm=!1,jn=!1,qn=!1,ls=!1,Rc=null,lo=null;const cA=!!(I.cast&&I.cast.framework&&I.cast.framework.CastReceiverContext);let Nm=null,La=!1,co=!1,Pa=!1,uo=!1,Ra=!1,Da=!1,Na=!1;const di=!!(cr()&&("ontouchstart"in I||I.navigator.maxTouchPoints||I.DocumentTouch&&I.document instanceof I.DocumentTouch)),Ms=I.navigator&&I.navigator.userAgentData;Ms&&Ms.platform&&Ms.brands&&(Wt=Ms.platform==="Android",jn=!!Ms.brands.find(s=>s.brand==="Microsoft Edge"),qn=!!Ms.brands.find(s=>s.brand==="Chromium"),ls=!jn&&qn,Rc=lo=(Ms.brands.find(s=>s.brand==="Chromium")||{}).version||null,co=Ms.platform==="Windows");if(!qn){const s=I.navigator&&I.navigator.userAgent||"";Pc=/iPod/i.test(s),Pm=function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Wt=/Android/i.test(s),Rm=function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Dm=/Firefox/i.test(s),jn=/Edg/i.test(s),qn=/Chrome/i.test(s)||/CriOS/i.test(s),ls=!jn&&qn,Rc=lo=function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Nm=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}(),Ra=/Tizen/i.test(s),Da=/Web0S/i.test(s),Na=Ra||Da,La=/Safari/i.test(s)&&!ls&&!Wt&&!jn&&!Na,co=/Windows/i.test(s),Pa=/iPad/i.test(s)||La&&di&&!/iPhone/i.test(s),uo=/iPhone/i.test(s)&&!Pa}const at=uo||Pa||Pc,ho=(La||at)&&!ls;var Om=Object.freeze({__proto__:null,get IS_IPOD(){return Pc},get IOS_VERSION(){return Pm},get IS_ANDROID(){return Wt},get ANDROID_VERSION(){return Rm},get IS_FIREFOX(){return Dm},get IS_EDGE(){return jn},get IS_CHROMIUM(){return qn},get IS_CHROME(){return ls},get CHROMIUM_VERSION(){return Rc},get CHROME_VERSION(){return lo},IS_CHROMECAST_RECEIVER:cA,get IE_VERSION(){return Nm},get IS_SAFARI(){return La},get IS_WINDOWS(){return co},get IS_IPAD(){return Pa},get IS_IPHONE(){return uo},get IS_TIZEN(){return Ra},get IS_WEBOS(){return Da},get IS_SMART_TV(){return Na},TOUCH_ENABLED:di,IS_IOS:at,IS_ANY_SAFARI:ho});function $u(s){return typeof s=="string"&&!!s.trim()}function dA(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function cr(){return Y===I.document}function dr(s){return os(s)&&s.nodeType===1}function Mm(){try{return I.parent!==I.self}catch{return!0}}function Um(s){return function(e,t){if(!$u(e))return Y[s](null);$u(t)&&(t=Y.querySelector(t));const n=dr(t)?t:Y;return n[s]&&n[s](e)}}function ae(s="div",e={},t={},n){const r=Y.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(i){const a=e[i];i==="textContent"?zs(r,a):(r[i]!==a||i==="tabIndex")&&(r[i]=a)}),Object.getOwnPropertyNames(t).forEach(function(i){r.setAttribute(i,t[i])}),n&&Dc(r,n),r}function zs(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function Pl(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function ti(s,e){return dA(e),s.classList.contains(e)}function dn(s,...e){return s.classList.add(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),s}function po(s,...e){return s?(s.classList.remove(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),s):(pe.warn("removeClass was called with an element that doesn't exist"),null)}function Bm(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(n=>s.classList.toggle(n,t)),s}function Fm(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const n=e[t];n===null||typeof n>"u"||n===!1?s.removeAttribute(t):s.setAttribute(t,n===!0?"":n)})}function js(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const n=s.attributes;for(let r=n.length-1;r>=0;r--){const i=n[r].name;let a=n[r].value;t.includes(i)&&(a=a!==null),e[i]=a}}return e}function jm(s,e){return s.getAttribute(e)}function sr(s,e,t){s.setAttribute(e,t)}function mo(s,e){s.removeAttribute(e)}function qm(){Y.body.focus(),Y.onselectstart=function(){return!1}}function Vm(){Y.onselectstart=function(){return!0}}function nr(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),t.height||(t.height=parseFloat(rr(s,"height"))),t.width||(t.width=parseFloat(rr(s,"width"))),t}}function ui(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let n=0,r=0;for(;s.offsetParent&&s!==Y[xa.fullscreenElement];)n+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:n,top:r,width:e,height:t}}function fo(s,e){const t={x:0,y:0};if(at){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=rr(m,"transform");if(/^matrix/.test(_)){const T=_.slice(7,-1).split(/,\s/).map(Number);t.x+=T[4],t.y+=T[5]}else if(/^matrix3d/.test(_)){const T=_.slice(9,-1).split(/,\s/).map(Number);t.x+=T[12],t.y+=T[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&I.WebKitCSSMatrix){const T=I.getComputedStyle(m.assignedSlot.parentElement).transform,S=new I.WebKitCSSMatrix(T);t.x+=S.m41,t.y+=S.m42}m=m.parentNode||m.host}}const n={},r=ui(e.target),i=ui(s),a=i.width,o=i.height;let c=e.offsetY-(i.top-r.top),h=e.offsetX-(i.left-r.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-i.left,c=e.changedTouches[0].pageY+i.top,at&&(h-=t.x,c-=t.y)),n.y=1-Math.max(0,Math.min(1,c/o)),n.x=Math.max(0,Math.min(1,h/a)),n}function $m(s){return os(s)&&s.nodeType===3}function go(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Hm(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),dr(e)||$m(e))return e;if(typeof e=="string"&&/\S/.test(e))return Y.createTextNode(e)}).filter(e=>e)}function Dc(s,e){return Hm(e).forEach(t=>s.appendChild(t)),s}function Wm(s,e){return Dc(go(s),e)}function hi(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 Hs=Um("querySelector"),zm=Um("querySelectorAll");function rr(s,e){if(!s||!e)return"";if(typeof I.getComputedStyle=="function"){let t;try{t=I.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Gm(s){[...Y.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),n=Y.createElement("style");n.textContent=t,s.document.head.appendChild(n)}catch{const t=Y.createElement("link");t.rel="stylesheet",t.type=e.type,t.media=e.media.mediaText,t.href=e.href,s.document.head.appendChild(t)}})}var Xm=Object.freeze({__proto__:null,isReal:cr,isEl:dr,isInFrame:Mm,createEl:ae,textContent:zs,prependTo:Pl,hasClass:ti,addClass:dn,removeClass:po,toggleClass:Bm,setAttributes:Fm,getAttributes:js,getAttribute:jm,setAttribute:sr,removeAttribute:mo,blockTextSelection:qm,unblockTextSelection:Vm,getBoundingClientRect:nr,findPosition:ui,getPointerPosition:fo,isTextNode:$m,emptyEl:go,normalizeContent:Hm,appendContent:Dc,insertContent:Wm,isSingleLeftClick:hi,$:Hs,$$:zm,computedStyle:rr,copyStyleSheetsToWindow:Gm});let Ym=!1,Rl;const uA=function(){if(Rl.options.autoSetup===!1)return;const s=Array.prototype.slice.call(Y.getElementsByTagName("video")),e=Array.prototype.slice.call(Y.getElementsByTagName("audio")),t=Array.prototype.slice.call(Y.getElementsByTagName("video-js")),n=s.concat(e,t);if(n&&n.length>0)for(let r=0,i=n.length;r<i;r++){const a=n[r];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&Rl(a);else{Dl(1);break}}else Ym||Dl(1)};function Dl(s,e){cr()&&(e&&(Rl=e),I.setTimeout(uA,s))}function Nl(){Ym=!0,I.removeEventListener("load",Nl)}cr()&&(Y.readyState==="complete"?Nl():I.addEventListener("load",Nl));const Km=function(s){const e=Y.createElement("style");return e.className=s,e},Qm=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var _t=new WeakMap;const hA=3;let pA=hA;function Bt(){return pA++}function Hu(s,e){if(!_t.has(s))return;const t=_t.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&&_t.delete(s)}function Nc(s,e,t,n){t.forEach(function(r){s(e,r,n)})}function yo(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const n=s||I.event;s={};const r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const i in n)r.includes(i)||i==="returnValue"&&n.preventDefault||(s[i]=n[i]);if(s.target||(s.target=s.srcElement||Y),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){n.preventDefault&&n.preventDefault(),s.returnValue=!1,n.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),s.cancelBubble=!0,n.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const i=Y.documentElement,a=Y.body;s.pageX=s.clientX+(i&&i.scrollLeft||a&&a.scrollLeft||0)-(i&&i.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(i&&i.scrollTop||a&&a.scrollTop||0)-(i&&i.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 na;const mA=function(){if(typeof na!="boolean"){na=!1;try{const s=Object.defineProperty({},"passive",{get(){na=!0}});I.addEventListener("test",null,s),I.removeEventListener("test",null,s)}catch{}}return na},fA=["touchstart","touchmove"];function Lt(s,e,t){if(Array.isArray(e))return Nc(Lt,s,e,t);_t.has(s)||_t.set(s,{});const n=_t.get(s);if(n.handlers||(n.handlers={}),n.handlers[e]||(n.handlers[e]=[]),t.guid||(t.guid=Bt()),n.handlers[e].push(t),n.dispatcher||(n.disabled=!1,n.dispatcher=function(r,i){if(n.disabled)return;r=yo(r);const a=n.handlers[r.type];if(a){const o=a.slice(0);for(let c=0,h=o.length;c<h&&!r.isImmediatePropagationStopped();c++)try{o[c].call(s,r,i)}catch(m){pe.error(m)}}}),n.handlers[e].length===1)if(s.addEventListener){let r=!1;mA()&&fA.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,n.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,n.dispatcher)}function ot(s,e,t){if(!_t.has(s))return;const n=_t.get(s);if(!n.handlers)return;if(Array.isArray(e))return Nc(ot,s,e,t);const r=function(a,o){n.handlers[o]=[],Hu(a,o)};if(e===void 0){for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&r(s,a);return}const i=n.handlers[e];if(i){if(!t){r(s,e);return}if(t.guid)for(let a=0;a<i.length;a++)i[a].guid===t.guid&&i.splice(a--,1);Hu(s,e)}}function ur(s,e,t){const n=_t.has(s)?_t.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=yo(e),n.dispatcher&&n.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)ur.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){_t.has(e.target)||_t.set(e.target,{});const i=_t.get(e.target);e.target[e.type]&&(i.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),i.disabled=!1)}return!e.defaultPrevented}function _o(s,e,t){if(Array.isArray(e))return Nc(_o,s,e,t);const n=function(){ot(s,e,n),t.apply(this,arguments)};n.guid=t.guid=t.guid||Bt(),Lt(s,e,n)}function Oc(s,e,t){const n=function(){ot(s,e,n),t.apply(this,arguments)};n.guid=t.guid=t.guid||Bt(),Lt(s,e,n)}var gA=Object.freeze({__proto__:null,fixEvent:yo,on:Lt,off:ot,trigger:ur,one:_o,any:Oc});const Ft=30,Le=function(s,e,t){e.guid||(e.guid=Bt());const n=e.bind(s);return n.guid=t?t+"_"+e.guid:e.guid,n},cs=function(s,e){let t=I.performance.now();return function(...n){const r=I.performance.now();r-t>=e&&(s(...n),t=r)}},Zm=function(s,e,t,n=I){let r;const i=()=>{n.clearTimeout(r),r=null},a=function(){const o=this,c=arguments;let h=function(){r=null,h=null,t||s.apply(o,c)};!r&&t&&s.apply(o,c),n.clearTimeout(r),r=n.setTimeout(h,e)};return a.cancel=i,a};var yA=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ft,bind_:Le,throttle:cs,debounce:Zm});let Fr;class Pt{on(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Lt(this,e,t),this.addEventListener=n}off(e,t){ot(this,e,t)}one(e,t){const n=this.addEventListener;this.addEventListener=()=>{},_o(this,e,t),this.addEventListener=n}any(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Oc(this,e,t),this.addEventListener=n}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=yo(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ur(this,e)}queueTrigger(e){Fr||(Fr=new Map);const t=e.type||e;let n=Fr.get(this);n||(n=new Map,Fr.set(this,n));const r=n.get(t);n.delete(t),I.clearTimeout(r);const i=I.setTimeout(()=>{n.delete(t),n.size===0&&(n=null,Fr.delete(this)),this.trigger(e)},0);n.set(t,i)}}Pt.prototype.allowedEvents_={};Pt.prototype.addEventListener=Pt.prototype.on;Pt.prototype.removeEventListener=Pt.prototype.off;Pt.prototype.dispatchEvent=Pt.prototype.trigger;const vo=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,Ts=s=>s instanceof Pt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),_A=(s,e)=>{Ts(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},Ol=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,Oa=(s,e,t)=>{if(!s||!s.nodeName&&!Ts(s))throw new Error(`Invalid target for ${vo(e)}#${t}; must be a DOM node or evented object.`)},Jm=(s,e,t)=>{if(!Ol(s))throw new Error(`Invalid event type for ${vo(e)}#${t}; must be a non-empty string or array.`)},ef=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${vo(e)}#${t}; must be a function.`)},nl=(s,e,t)=>{const n=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let r,i,a;return n?(r=s.eventBusEl_,e.length>=3&&e.shift(),[i,a]=e):(r=e[0],i=e[1],a=e[2]),Oa(r,s,t),Jm(i,s,t),ef(a,s,t),a=Le(s,a),{isTargetingSelf:n,target:r,type:i,listener:a}},tn=(s,e,t,n)=>{Oa(s,s,e),s.nodeName?gA[e](s,t,n):s[e](t,n)},vA={on(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"on");if(tn(t,"on",n,r),!e){const i=()=>this.off(t,n,r);i.guid=r.guid;const a=()=>this.off("dispose",i);a.guid=r.guid,tn(this,"on","dispose",i),tn(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"one");if(e)tn(t,"one",n,r);else{const i=(...a)=>{this.off(t,n,i),r.apply(null,a)};i.guid=r.guid,tn(t,"one",n,i)}},any(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"any");if(e)tn(t,"any",n,r);else{const i=(...a)=>{this.off(t,n,i),r.apply(null,a)};i.guid=r.guid,tn(t,"any",n,i)}},off(s,e,t){if(!s||Ol(s))ot(this.eventBusEl_,s,e);else{const n=s,r=e;Oa(n,this,"off"),Jm(r,this,"off"),ef(t,this,"off"),t=Le(this,t),this.off("dispose",t),n.nodeName?(ot(n,r,t),ot(n,"dispose",t)):Ts(n)&&(n.off(r,t),n.off("dispose",t))}},trigger(s,e){Oa(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!Ol(t))throw new Error(`Invalid event type for ${vo(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ur(this.eventBusEl_,s,e)}};function Mc(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_=ae("span",{className:"vjs-event-bus"});return Object.assign(s,vA),s.eventedCallbacks&&s.eventedCallbacks.forEach(n=>{n()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(n){n&&_t.has(n)&&_t.delete(n)}),I.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const bA={state:{},setState(s){typeof s=="function"&&(s=s());let e;return Fn(s,(t,n)=>{this.state[n]!==t&&(e=e||{},e[n]={from:this.state[n],to:t}),this.state[n]=t}),e&&Ts(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function tf(s,e){return Object.assign(s,bA),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&Ts(s)&&s.on("statechanged",s.handleStateChanged),s}const si=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},Ve=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},sf=function(s,e){return Ve(s)===Ve(e)};var TA=Object.freeze({__proto__:null,toLowerCase:si,toTitleCase:Ve,titleCaseEquals:sf});class ${constructor(e,t,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=we({},this.options_),t=this.options_=we(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${Bt()}`}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&&(Mc(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),tf(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(n),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_=we(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,n){return ae(e,t,n)}localize(e,t,n=e){const r=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),a=i&&i[r],o=r&&r.split("-")[0],c=i&&i[o];let h=n;return a&&a[e]?h=a[e]:c&&c[e]&&(h=c[e]),t&&(h=h.replace(/\{(\d+)\}/g,function(m,_){const T=t[_-1];let S=T;return typeof T>"u"&&(S=m),S})),h}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((n,r)=>n.concat(r),[]);let t=this;for(let n=0;n<e.length;n++)if(t=t.getChild(e[n]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const n="http://www.w3.org/2000/svg",r=ae("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),i=Y.createElementNS(n,"svg");i.setAttributeNS(null,"viewBox","0 0 512 512");const a=Y.createElementNS(n,"use");return i.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),r.appendChild(i),this.iconIsSet_?t.replaceChild(r,t.querySelector(".vjs-icon-placeholder")):t.appendChild(r),this.iconIsSet_=!0,r}addChild(e,t={},n=this.children_.length){let r,i;if(typeof e=="string"){i=Ve(e);const a=t.componentClass||i;t.name=i;const o=$.getComponent(a);if(!o)throw new Error(`Component ${a} does not exist`);if(typeof o!="function")return null;r=new o(this.player_||this,t)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,typeof r.id=="function"&&(this.childIndex_[r.id()]=r),i=i||r.name&&Ve(r.name()),i&&(this.childNameIndex_[i]=r,this.childNameIndex_[si(i)]=r),typeof r.el=="function"&&r.el()){let a=null;this.children_[n+1]&&(this.children_[n+1].el_?a=this.children_[n+1].el_:dr(this.children_[n+1])&&(a=this.children_[n+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_[Ve(e.name())]=null,this.childNameIndex_[si(e.name())]=null;const n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,n=a=>{const o=a.name;let c=a.opts;if(t[o]!==void 0&&(c=t[o]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const h=this.addChild(o,c);h&&(this[o]=h)};let r;const i=$.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,c;return typeof a=="string"?(o=a,c=e[o]||this.options_[o]||{}):(o=a.name,c=a),{name:o,opts:c}}).filter(a=>{const o=$.getComponent(a.opts.componentClass||Ve(a.name));return o&&!i.isTech(o)}).forEach(n)}}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 Hs(e,t||this.contentEl())}$$(e,t){return zm(e,t||this.contentEl())}hasClass(e){return ti(this.el_,e)}addClass(...e){dn(this.el_,...e)}removeClass(...e){po(this.el_,...e)}toggleClass(e,t){Bm(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 jm(this.el_,e)}setAttribute(e,t){sr(this.el_,e,t)}removeAttribute(e){mo(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,n){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",n||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],i=r.indexOf("px");return parseInt(i!==-1?r.slice(0,i):this.el_["offset"+Ve(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=rr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const n=`offset${Ve(e)}`;t=this.el_[n]}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},n={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:n}}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 n=10,r=200;let i;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=I.performance.now(),i=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)i=!1;else if(t){const c=o.touches[0].pageX-t.pageX,h=o.touches[0].pageY-t.pageY;Math.sqrt(c*c+h*h)>n&&(i=!1)}});const a=function(){i=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,i===!0&&I.performance.now()-e<r&&(o.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Le(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const n=function(r){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",n),this.on("touchcancel",n)}setTimeout(e,t){var n;return e=Le(this,e),this.clearTimersOnDispose_(),n=I.setTimeout(()=>{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),I.clearTimeout(e)),e}setInterval(e,t){e=Le(this,e),this.clearTimersOnDispose_();const n=I.setInterval(e,t);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),I.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Le(this,e),t=I.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Le(this,t);const n=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),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),I.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((n,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(i){const a=I.getComputedStyle(i,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function n(i){return!(!t(i.parentElement)||!t(i)||i.style.opacity==="0"||I.getComputedStyle(i).height==="0px"||I.getComputedStyle(i).width==="0px")}function r(i){if(i.offsetWidth+i.offsetHeight+i.getBoundingClientRect().height+i.getBoundingClientRect().width===0)return!1;const a={x:i.getBoundingClientRect().left+i.offsetWidth/2,y:i.getBoundingClientRect().top+i.offsetHeight/2};if(a.x<0||a.x>(Y.documentElement.clientWidth||I.innerWidth)||a.y<0||a.y>(Y.documentElement.clientHeight||I.innerHeight))return!1;let o=Y.elementFromPoint(a.x,a.y);for(;o;){if(o===i)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(r(e)&&n(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 n=$.getComponent("Tech"),r=n&&n.isTech(t),i=$===t||$.prototype.isPrototypeOf(t.prototype);if(r||!i){let o;throw r?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=Ve(e),$.components_||($.components_={});const a=$.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,c=Object.keys(o);if(o&&c.length>0&&c.map(h=>o[h]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return $.components_[e]=t,$.components_[si(e)]=t,t}static getComponent(e){if(!(!e||!$.components_))return $.components_[e]}}$.registerComponent("Component",$);function AA(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 Wu(s,e,t,n){return AA(s,n,t.length-1),t[n][e]}function rl(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:Wu.bind(null,"start",0,s),end:Wu.bind(null,"end",1,s)},I.Symbol&&I.Symbol.iterator&&(e[I.Symbol.iterator]=()=>(s||[]).values()),e}function Ht(s,e){return Array.isArray(s)?rl(s):s===void 0||e===void 0?rl():rl([[s,e]])}const nf=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),n=Math.floor(s/60%60),r=Math.floor(s/3600);const i=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(r=n=t="-"),r=r>0||a>0?r+":":"",n=((r||i>=10)&&n<10?"0"+n:n)+":",t=t<10?"0"+t:t,r+n+t};let Uc=nf;function rf(s){Uc=s}function af(){Uc=nf}function fn(s,e=s){return Uc(s,e)}var SA=Object.freeze({__proto__:null,createTimeRanges:Ht,createTimeRange:Ht,setFormatTime:rf,resetFormatTime:af,formatTime:fn});function of(s,e){let t=0,n,r;if(!e)return 0;(!s||!s.length)&&(s=Ht(0,0));for(let i=0;i<s.length;i++)n=s.start(i),r=s.end(i),r>e&&(r=e),t+=r-n;return t/e}function je(s){if(s instanceof je)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:os(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=je.defaultMessages[this.code]||"")}je.prototype.code=0;je.prototype.message="";je.prototype.status=null;je.prototype.metadata=null;je.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];je.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."};je.MEDIA_ERR_CUSTOM=0;je.prototype.MEDIA_ERR_CUSTOM=0;je.MEDIA_ERR_ABORTED=1;je.prototype.MEDIA_ERR_ABORTED=1;je.MEDIA_ERR_NETWORK=2;je.prototype.MEDIA_ERR_NETWORK=2;je.MEDIA_ERR_DECODE=3;je.prototype.MEDIA_ERR_DECODE=3;je.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.MEDIA_ERR_ENCRYPTED=5;je.prototype.MEDIA_ERR_ENCRYPTED=5;function ni(s){return s!=null&&typeof s.then=="function"}function ts(s){ni(s)&&s.then(null,e=>{})}const Ml=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,n)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},EA=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,n=>n.track);return Array.prototype.map.call(e,function(n){const r=Ml(n.track);return n.src&&(r.src=n.src),r}).concat(Array.prototype.filter.call(s.textTracks(),function(n){return t.indexOf(n)===-1}).map(Ml))},wA=function(s,e){return s.forEach(function(t){const n=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(r=>n.addCue(r))}),e.textTracks()};var zu={textTracksToJson:EA,jsonToTextTracks:wA,trackToJson_:Ml};const il="vjs-modal-dialog";class hr extends ${constructor(e,t){super(e,t),this.handleKeyDown_=n=>this.handleKeyDown(n),this.close_=n=>this.close(n),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=ae("div",{className:`${il}-content`},{role:"document"}),this.descEl_=ae("p",{className:`${il}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),zs(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`${il} 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 n=this.getChild("closeButton");if(t&&!n){const r=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),n=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),Wm(t,e),this.trigger("modalfill"),r?n.insertBefore(t,r):n.appendChild(t);const i=this.getChild("closeButton");i&&n.appendChild(i.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),go(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=Y.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_(),n=this.el_.querySelector(":focus");let r;for(let i=0;i<t.length;i++)if(n===t[i]){r=i;break}Y.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 I.HTMLAnchorElement||t instanceof I.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof I.HTMLInputElement||t instanceof I.HTMLSelectElement||t instanceof I.HTMLTextAreaElement||t instanceof I.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof I.HTMLIFrameElement||t instanceof I.HTMLObjectElement||t instanceof I.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}hr.prototype.options_={pauseOnOpen:!0,temporary:!0};$.registerComponent("ModalDialog",hr);class ir extends Pt{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})},Ts(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let n=0,r=this.length;n<r;n++)if(this[n]===e){t=this[n],t.off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let n=0,r=this.length;n<r;n++){const i=this[n];if(i.id===e){t=i;break}}return t}}ir.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in ir.prototype.allowedEvents_)ir.prototype["on"+s]=null;const al=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 kA extends ir{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){al(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&al(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,al(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 ol=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 CA extends ir{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){ol(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&&ol(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,ol(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 lf extends ir{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class IA{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,n=e.length;t<n;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 n=0,r=this.trackElements_.length;n<r;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t}removeTrackElement_(e){for(let t=0,n=this.trackElements_.length;t<n;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 Ma{constructor(e){Ma.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let n=0;const r=e.length;this.cues_=e,this.length_=e.length;const i=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<r)for(n=t;n<r;n++)i.call(this,n)}getCueById(e){let t=null;for(let n=0,r=this.length;n<r;n++){const i=this[n];if(i.id===e){t=i;break}}return t}}const xA={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},LA={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},PA={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Gu={disabled:"disabled",hidden:"hidden",showing:"showing"};class Bc extends Pt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Bt(),kind:e.kind||"",language:e.language||""};let n=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return n},set(r){r!==n&&(n=r,this.trigger("labelchange"))}})}}const Fc=function(s){return new URL(s,Y.baseURI)},cf=function(s){return new URL(s,Y.baseURI).href},jc=function(s){if(typeof s=="string"){const e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(s);if(e)return e.pop().toLowerCase()}return""},bo=function(s,e=I.location){return Fc(s).origin!==e.origin};var RA=Object.freeze({__proto__:null,parseUrl:Fc,getAbsoluteURL:cf,getFileExtension:jc,isCrossOrigin:bo});const Xu=function(s,e){const t=new I.WebVTT.Parser(I,I.vttjs,I.WebVTT.StringDecoder()),n=[];t.oncue=function(r){e.addCue(r)},t.onparsingerror=function(r){n.push(r)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),n.length>0&&(I.console&&I.console.groupCollapsed&&I.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),n.forEach(r=>pe.error(r)),I.console&&I.console.groupEnd&&I.console.groupEnd()),t.flush()},Yu=function(s,e){const t={uri:s},n=bo(s);n&&(t.cors=n);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Cp(t,Le(this,function(i,a,o){if(i)return pe.error(i,a);e.loaded_=!0,typeof I.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){pe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Xu(o,e)}):Xu(o,e)}))};class vi extends Bc{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=we(e,{kind:PA[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=Gu[t.mode]||"disabled";const r=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(n="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const i=new Ma(this.cues_),a=new Ma(this.activeCues_);let o=!1;this.timeupdateHandler=Le(this,function(h={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),n!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return n},set(h){Gu[h]&&n!==h&&(n=h,!this.preload_&&n!=="disabled"&&this.cues.length===0&&Yu(this.src,this),this.stopTracking(),n!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const h=this.tech_.currentTime(),m=[];for(let _=0,T=this.cues.length;_<T;_++){const S=this.cues[_];S.startTime<=h&&S.endTime>=h&&m.push(S)}if(o=!1,m.length!==this.activeCues_.length)o=!0;else for(let _=0;_<m.length;_++)this.activeCues_.indexOf(m[_])===-1&&(o=!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")&&Yu(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 I.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 n=this.tech_.textTracks();for(let r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const n=this.cues_[t];if(n===e||n.originalCue_&&n.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}vi.prototype.allowedEvents_={cuechange:"cuechange"};class df extends Bc{constructor(e={}){const t=we(e,{kind:LA[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"enabled",{get(){return n},set(r){typeof r!="boolean"||r===n||(n=r,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class uf extends Bc{constructor(e={}){const t=we(e,{kind:xA[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"selected",{get(){return n},set(r){typeof r!="boolean"||r===n||(n=r,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class ws extends Pt{constructor(e={}){super();let t;const n=new vi(e);this.kind=n.kind,this.src=n.src,this.srclang=n.language,this.label=n.label,this.default=n.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return n}}}),t=ws.NONE,n.addEventListener("loadeddata",()=>{t=ws.LOADED,this.trigger({type:"load",target:this})})}}ws.prototype.allowedEvents_={load:"load"};ws.NONE=0;ws.LOADING=1;ws.LOADED=2;ws.ERROR=3;const Ut={audio:{ListClass:kA,TrackClass:df,capitalName:"Audio"},video:{ListClass:CA,TrackClass:uf,capitalName:"Video"},text:{ListClass:lf,TrackClass:vi,capitalName:"Text"}};Object.keys(Ut).forEach(function(s){Ut[s].getterName=`${s}Tracks`,Ut[s].privateName=`${s}Tracks_`});const ar={remoteText:{ListClass:lf,TrackClass:vi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:IA,TrackClass:ws,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},gt=Object.assign({},Ut,ar);ar.names=Object.keys(ar);Ut.names=Object.keys(Ut);gt.names=[].concat(ar.names).concat(Ut.names);function DA(s,e,t,n,r={}){const i=s.textTracks();r.kind=e,t&&(r.label=t),n&&(r.language=n),r.tech=s;const a=new gt.text.TrackClass(r);return i.addTrack(a),a}class de extends ${constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=n=>this.onDurationChange(n),this.trackProgress_=n=>this.trackProgress(n),this.trackCurrentTime_=n=>this.trackCurrentTime(n),this.stopTrackingCurrentTime_=n=>this.stopTrackingCurrentTime(n),this.disposeSourceHandler_=n=>this.disposeSourceHandler(n),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),gt.names.forEach(n=>{const r=gt[n];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(n=>{e[`native${n}Tracks`]===!1&&(this[`featuresNative${n}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 gt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Le(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Ht(0,0)}bufferedPercent(){return of(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(Ut.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const n=this[`${t}Tracks`]()||[];let r=n.length;for(;r--;){const i=n[r];t==="text"&&this.removeRemoteTextTrack(i),n.removeTrack(i)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const n=e[t];this.removeRemoteTextTrack(n)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new je(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ht(0,0):Ht()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ut.names.forEach(e=>{const t=Ut[e],n=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),this.on("dispose",()=>{r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})}addWebVttScript_(){if(!I.WebVTT)if(Y.body.contains(this.el())){if(!this.options_["vtt.js"]&&tr(hu)&&Object.keys(hu).length>0){this.trigger("vttjsloaded");return}const e=Y.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}),I.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),n=o=>e.addTrack(o.track),r=o=>e.removeTrack(o.track);t.on("addtrack",n),t.on("removetrack",r),this.addWebVttScript_();const i=()=>this.trigger("texttrackchange"),a=()=>{i();for(let o=0;o<e.length;o++){const c=e[o];c.removeEventListener("cuechange",i),c.mode==="showing"&&c.addEventListener("cuechange",i)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",n),t.off("removetrack",r),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let o=0;o<e.length;o++)e[o].removeEventListener("cuechange",i)})}addTextTrack(e,t,n){if(!e)throw new Error("TextTrack kind is required but was not provided");return DA(this,e,t,n)}createRemoteTextTrack(e){const t=we(e,{tech:this});return new ar.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const n=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(n.track)),n}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=Bt();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 de.canPlayType(e.type)}static isTech(e){return e.prototype instanceof de||e instanceof de||e===de}static registerTech(e,t){if(de.techs_||(de.techs_={}),!de.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!de.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!de.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ve(e),de.techs_[e]=t,de.techs_[si(e)]=t,e!=="Tech"&&de.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(de.techs_&&de.techs_[e])return de.techs_[e];if(e=Ve(e),I&&I.videojs&&I.videojs[e])return pe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),I.videojs[e]}}}gt.names.forEach(function(s){const e=gt[s];de.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});de.prototype.featuresVolumeControl=!0;de.prototype.featuresMuteControl=!0;de.prototype.featuresFullscreenResize=!1;de.prototype.featuresPlaybackRate=!1;de.prototype.featuresProgressEvents=!1;de.prototype.featuresSourceset=!1;de.prototype.featuresTimeupdateEvents=!1;de.prototype.featuresNativeTextTracks=!1;de.prototype.featuresVideoFrameCallback=!1;de.withSourceHandlers=function(s){s.registerSourceHandler=function(e,t){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),t===void 0&&(t=n.length),n.splice(t,0,e)},s.canPlayType=function(e){const t=s.sourceHandlers||[];let n;for(let r=0;r<t.length;r++)if(n=t[r].canPlayType(e),n)return n;return""},s.selectSourceHandler=function(e,t){const n=s.sourceHandlers||[];let r;for(let i=0;i<n.length;i++)if(r=n[i].canHandleSource(e,t),r)return n[i];return null},s.canPlaySource=function(e,t){const n=s.selectSourceHandler(e,t);return n?n.canHandleSource(e,t):""},["seekable","seeking","duration"].forEach(function(e){const t=this[e];typeof t=="function"&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(e){let t=s.selectSourceHandler(e,this.options_);t||(s.nativeSourceHandler?t=s.nativeSourceHandler:pe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==s.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,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)}};$.registerComponent("Tech",de);de.registerTech("Tech",de);de.defaultTechOrder_=[];const un={},Ua={},Ba={};function NA(s,e){un[s]=un[s]||[],un[s].push(e)}function OA(s,e,t){s.setTimeout(()=>sn(e,un[e.type],t,s),1)}function MA(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function UA(s,e,t){return s.reduceRight(qc(t),e[t]())}function BA(s,e,t,n){return e[t](s.reduce(qc(t),n))}function Ku(s,e,t,n=null){const r="call"+Ve(t),i=s.reduce(qc(r),n),a=i===Ba,o=a?null:e[t](i);return qA(s,t,o,a),o}const FA={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},jA={setCurrentTime:1,setMuted:1,setVolume:1},Qu={play:1,pause:1};function qc(s){return(e,t)=>e===Ba?Ba:t[s]?t[s](e):e}function qA(s,e,t,n){for(let r=s.length-1;r>=0;r--){const i=s[r];i[e]&&i[e](n,t)}}function VA(s){Ua.hasOwnProperty(s.id())&&delete Ua[s.id()]}function $A(s,e){const t=Ua[s.id()];let n=null;if(t==null)return n=e(s),Ua[s.id()]=[[e,n]],n;for(let r=0;r<t.length;r++){const[i,a]=t[r];i===e&&(n=a)}return n===null&&(n=e(s),t.push([e,n])),n}function sn(s={},e=[],t,n,r=[],i=!1){const[a,...o]=e;if(typeof a=="string")sn(s,un[a],t,n,r,i);else if(a){const c=$A(n,a);if(!c.setSource)return r.push(c),sn(s,o,t,n,r,i);c.setSource(Object.assign({},s),function(h,m){if(h)return sn(s,o,t,n,r,i);r.push(c),sn(m,s.type===m.type?o:un[m.type],t,n,r,i)})}else o.length?sn(s,o,t,n,r,i):i?t(s,r):sn(s,un["*"],t,n,r,!0)}const HA={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"},Fa=function(s=""){const e=jc(s);return HA[e.toLowerCase()]||""},WA=(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 n=s.$$("source");for(let r=0;r<n.length;r++){const i=n[r];if(i.type&&i.src&&i.src===e)return i.type}return Fa(e)},hf=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=hf(t),Array.isArray(t)?e=e.concat(t):os(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Zu({src:s})]:os(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[Zu(s)]:s=[];return s};function Zu(s){if(!s.type){const e=Fa(s.src);e&&(s.type=e)}return s}var zA=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
27
|
+
`)}function pm(s){this.options=s||{locator:{}}}pm.prototype.parseFromString=function(s,e){var t=this.options,n=new zT,r=t.domBuilder||new yi,i=t.errorHandler,a=t.locator,o=t.xmlns||{},c=/\/x?html?$/.test(e),h=c?Pu.HTML_ENTITIES:Pu.XML_ENTITIES;a&&r.setDocumentLocator(a),n.errorHandler=GT(i,r,a),n.domBuilder=t.domBuilder||r,c&&(o[""]=Ru.HTML),o.xml=o.xml||Ru.XML;var m=t.normalizeLineEndings||hm;return s&&typeof s=="string"?n.parse(m(s),o,h):n.errorHandler.error("invalid doc source"),r.doc};function GT(s,e,t){if(!s){if(e instanceof yi)return e;s=e}var n={},r=s instanceof Function;t=t||{};function i(a){var o=s[a];!o&&r&&(o=s.length==2?function(c){s(a,c)}:s),n[a]=o&&function(c){o("[xmldom "+a+"] "+c+kl(t))}||function(){}}return i("warning"),i("error"),i("fatalError"),n}function yi(){this.cdata=!1}function xn(s,e){e.lineNumber=s.lineNumber,e.columnNumber=s.columnNumber}yi.prototype={startDocument:function(){this.doc=new HT().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(s,e,t,n){var r=this.doc,i=r.createElementNS(s,t||e),a=n.length;ta(this,i),this.currentElement=i,this.locator&&xn(this.locator,i);for(var o=0;o<a;o++){var s=n.getURI(o),c=n.getValue(o),t=n.getQName(o),h=r.createAttributeNS(s,t);this.locator&&xn(n.getLocator(o),h),h.value=h.nodeValue=c,i.setAttributeNode(h)}},endElement:function(s,e,t){var n=this.currentElement;n.tagName,this.currentElement=n.parentNode},startPrefixMapping:function(s,e){},endPrefixMapping:function(s){},processingInstruction:function(s,e){var t=this.doc.createProcessingInstruction(s,e);this.locator&&xn(this.locator,t),ta(this,t)},ignorableWhitespace:function(s,e,t){},characters:function(s,e,t){if(s=Du.apply(this,arguments),s){if(this.cdata)var n=this.doc.createCDATASection(s);else var n=this.doc.createTextNode(s);this.currentElement?this.currentElement.appendChild(n):/^\s*$/.test(s)&&this.doc.appendChild(n),this.locator&&xn(this.locator,n)}},skippedEntity:function(s){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(s){(this.locator=s)&&(s.lineNumber=0)},comment:function(s,e,t){s=Du.apply(this,arguments);var n=this.doc.createComment(s);this.locator&&xn(this.locator,n),ta(this,n)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(s,e,t){var n=this.doc.implementation;if(n&&n.createDocumentType){var r=n.createDocumentType(s,e,t);this.locator&&xn(this.locator,r),ta(this,r),this.doc.doctype=r}},warning:function(s){console.warn("[xmldom warning] "+s,kl(this.locator))},error:function(s){console.error("[xmldom error] "+s,kl(this.locator))},fatalError:function(s){throw new WT(s,this.locator)}};function kl(s){if(s)return`
|
|
28
|
+
@`+(s.systemId||"")+"#[line:"+s.lineNumber+",col:"+s.columnNumber+"]"}function Du(s,e,t){return typeof s=="string"?s.substr(e,t):s.length>=e+t||e?new java.lang.String(s,e,t)+"":s}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(s){yi.prototype[s]=function(){return null}});function ta(s,e){s.currentElement?s.currentElement.appendChild(e):s.doc.appendChild(e)}no.__DOMHandler=yi;no.normalizeLineEndings=hm;no.DOMParser=pm;var mm=no.DOMParser;const XT=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:mm},Symbol.toStringTag,{value:"Module"}));/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const Nu=s=>!!s&&typeof s=="object",Ze=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(n=>{Array.isArray(e[n])&&Array.isArray(t[n])?e[n]=e[n].concat(t[n]):Nu(e[n])&&Nu(t[n])?e[n]=Ze(e[n],t[n]):e[n]=t[n]}),e),{}),fm=s=>Object.keys(s).map(e=>s[e]),YT=(s,e)=>{const t=[];for(let n=s;n<e;n++)t.push(n);return t},Jn=s=>s.reduce((e,t)=>e.concat(t),[]),gm=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},KT=(s,e)=>s.reduce((t,n,r)=>(n[e]&&t.push(r),t),[]),QT=(s,e)=>fm(s.reduce((t,n)=>(n.forEach(r=>{t[e(r)]=r}),t),{}));var Zn={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",INVALID_NUMBER_OF_CONTENT_STEERING:"INVALID_NUMBER_OF_CONTENT_STEERING",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",MISSING_SEGMENT_INFORMATION:"MISSING_SEGMENT_INFORMATION",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const ci=({baseUrl:s="",source:e="",range:t="",indexRange:n=""})=>{const r={uri:e,resolvedUri:Za(s||"",e)};if(t||n){const i=(t||n).split("-");let a=I.BigInt?I.BigInt(i[0]):parseInt(i[0],10),o=I.BigInt?I.BigInt(i[1]):parseInt(i[1],10);a<Number.MAX_SAFE_INTEGER&&typeof a=="bigint"&&(a=Number(a)),o<Number.MAX_SAFE_INTEGER&&typeof o=="bigint"&&(o=Number(o));let c;typeof o=="bigint"||typeof a=="bigint"?c=I.BigInt(o)-I.BigInt(a)+I.BigInt(1):c=o-a+1,typeof c=="bigint"&&c<Number.MAX_SAFE_INTEGER&&(c=Number(c)),r.byterange={length:c,offset:a}}return r},JT=s=>{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=I.BigInt(s.offset)+I.BigInt(s.length)-I.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},Ou=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),ZT={static(s){const{duration:e,timescale:t=1,sourceDuration:n,periodDuration:r}=s,i=Ou(s.endNumber),a=e/t;return typeof i=="number"?{start:0,end:i}:typeof r=="number"?{start:0,end:r/a}:{start:0,end:n/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:n,timescale:r=1,duration:i,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:c=1/0}=s,h=Ou(s.endNumber),m=(e+t)/1e3,_=n+a,T=m+o-_,S=Math.ceil(T*r/i),w=Math.floor((m-_-c)*r/i),b=Math.floor((m-_)*r/i);return{start:Math.max(0,w),end:typeof h=="number"?h:Math.min(S,b)}}},e1=s=>e=>{const{duration:t,timescale:n=1,periodStart:r,startNumber:i=1}=s;return{number:i+e,duration:t/n,timeline:r,time:e*t}},Ac=s=>{const{type:e,duration:t,timescale:n=1,periodDuration:r,sourceDuration:i}=s,{start:a,end:o}=ZT[e](s),c=YT(a,o).map(e1(s));if(e==="static"){const h=c.length-1,m=typeof r=="number"?r:i;c[h].duration=m-t/n*h}return c},ym=s=>{const{baseUrl:e,initialization:t={},sourceDuration:n,indexRange:r="",periodStart:i,presentationTime:a,number:o=0,duration:c}=s;if(!e)throw new Error(Zn.NO_BASE_URL);const h=ci({baseUrl:e,source:t.sourceURL,range:t.range}),m=ci({baseUrl:e,source:e,indexRange:r});if(m.map=h,c){const _=Ac(s);_.length&&(m.duration=_[0].duration,m.timeline=_[0].timeline)}else n&&(m.duration=n,m.timeline=i);return m.presentationTime=a||i,m.number=o,[m]},Sc=(s,e,t)=>{const n=s.sidx.map?s.sidx.map:null,r=s.sidx.duration,i=s.timeline||0,a=s.sidx.byterange,o=a.offset+a.length,c=e.timescale,h=e.references.filter(R=>R.referenceType!==1),m=[],_=s.endList?"static":"dynamic",T=s.sidx.timeline;let S=T,w=s.mediaSequence||0,b;typeof e.firstOffset=="bigint"?b=I.BigInt(o)+e.firstOffset:b=o+e.firstOffset;for(let R=0;R<h.length;R++){const L=e.references[R],U=L.referencedSize,M=L.subsegmentDuration;let F;typeof b=="bigint"?F=b+I.BigInt(U)-I.BigInt(1):F=b+U-1;const N=`${b}-${F}`,j=ym({baseUrl:t,timescale:c,timeline:i,periodStart:T,presentationTime:S,number:w,duration:M,sourceDuration:r,indexRange:N,type:_})[0];n&&(j.map=n),m.push(j),typeof b=="bigint"?b+=I.BigInt(U):b+=U,S+=M/c,w++}return s.segments=m,s},t1=["AUDIO","SUBTITLES"],s1=1/60,_m=s=>QT(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),n1=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Mu=s=>{let e=[];return bT(s,t1,(t,n,r,i)=>{e=e.concat(t.playlists||[])}),e},Uu=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,n)=>{t.number=s.mediaSequence+n})},r1=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(n=>{n.discontinuitySequence=t.findIndex(function({timeline:o}){return o===n.timeline});const r=n1(s,n.attributes.NAME);if(!r||n.sidx)return;const i=n.segments[0],a=r.segments.findIndex(function(o){return Math.abs(o.presentationTime-i.presentationTime)<s1});if(a===-1){Uu({playlist:n,mediaSequence:r.mediaSequence+r.segments.length}),n.segments[0].discontinuity=!0,n.discontinuityStarts.unshift(0),(!r.segments.length&&n.timeline>r.timeline||r.segments.length&&n.timeline>r.segments[r.segments.length-1].timeline)&&n.discontinuitySequence--;return}r.segments[a].discontinuity&&!i.discontinuity&&(i.discontinuity=!0,n.discontinuityStarts.unshift(0),n.discontinuitySequence--),Uu({playlist:n,mediaSequence:r.segments[a].number})})},i1=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Mu(s)),n=e.playlists.concat(Mu(e));return e.timelineStarts=_m([s.timelineStarts,e.timelineStarts]),r1({oldPlaylists:t,newPlaylists:n,timelineStarts:e.timelineStarts}),e},ro=s=>s&&s.uri+"-"+JT(s.byterange),sl=s=>{const e=s.reduce(function(n,r){return n[r.attributes.baseUrl]||(n[r.attributes.baseUrl]=[]),n[r.attributes.baseUrl].push(r),n},{});let t=[];return Object.values(e).forEach(n=>{const r=fm(n.reduce((i,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return i[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),i[o].segments.push(...a.segments)),a.attributes.contentProtection&&(i[o].attributes.contentProtection=a.attributes.contentProtection)):(i[o]=a,i[o].attributes.timelineStarts=[]),i[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),i},{}));t=t.concat(r)}),t.map(n=>(n.discontinuityStarts=KT(n.segments||[],"discontinuity"),n))},Ec=(s,e)=>{const t=ro(s.sidx),n=t&&e[t]&&e[t].sidx;return n&&Sc(s,n,s.sidx.resolvedUri),s},a1=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Ec(s[t],e);return s},o1=({attributes:s,segments:e,sidx:t,mediaSequence:n,discontinuitySequence:r,discontinuityStarts:i},a)=>{const o={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:i,timelineStarts:s.timelineStarts,mediaSequence:n,segments:e};return s.contentProtection&&(o.contentProtection=s.contentProtection),s.serviceLocation&&(o.attributes.serviceLocation=s.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},l1=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:n,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 i={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(i.CODECS=s.codecs);const a={attributes:i,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:n,discontinuitySequence:r,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},c1=(s,e={},t=!1)=>{let n;const r=s.reduce((i,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",c=a.attributes.lang||"";let h=a.attributes.label||"main";if(c&&!a.attributes.label){const _=o?` (${o})`:"";h=`${a.attributes.lang}${_}`}i[h]||(i[h]={language:c,autoselect:!0,default:o==="main",playlists:[],uri:""});const m=Ec(o1(a,t),e);return i[h].playlists.push(m),typeof n>"u"&&o==="main"&&(n=a,n.default=!0),i},{});if(!n){const i=Object.keys(r)[0];r[i].default=!0}return r},d1=(s,e={})=>s.reduce((t,n)=>{const r=n.attributes.label||n.attributes.lang||"text",i=n.attributes.lang||"und";return t[r]||(t[r]={language:i,default:!1,autoselect:!1,playlists:[],uri:""}),t[r].playlists.push(Ec(l1(n),e)),t},{}),u1=s=>s.reduce((e,t)=>(t&&t.forEach(n=>{const{channel:r,language:i}=n;e[i]={autoselect:!1,default:!1,instreamId:r,language:i},n.hasOwnProperty("aspectRatio")&&(e[i].aspectRatio=n.aspectRatio),n.hasOwnProperty("easyReader")&&(e[i].easyReader=n.easyReader),n.hasOwnProperty("3D")&&(e[i]["3D"]=n["3D"])}),e),{}),h1=({attributes:s,segments:e,sidx:t,discontinuityStarts:n})=>{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:n,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},p1=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",m1=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",f1=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",g1=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:n}){return n===t.timeline}),t.segments&&t.segments.forEach((n,r)=>{n.number=r})})},Bu=s=>s?Object.keys(s).reduce((e,t)=>{const n=s[t];return e.concat(n.playlists)},[]):[],y1=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:n={},previousManifest:r,eventStream:i})=>{if(!s.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:c,minimumUpdatePeriod:h}=s[0].attributes,m=sl(s.filter(p1)).map(h1),_=sl(s.filter(m1)),T=sl(s.filter(f1)),S=s.map(F=>F.attributes.captionServices).filter(Boolean),w={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:a1(m,n)};h>=0&&(w.minimumUpdatePeriod=h*1e3),e&&(w.locations=e),t&&(w.contentSteering=t),o==="dynamic"&&(w.suggestedPresentationDelay=c),i&&i.length>0&&(w.eventStream=i);const b=w.playlists.length===0,R=_.length?c1(_,n,b):null,L=T.length?d1(T,n):null,U=m.concat(Bu(R),Bu(L)),M=U.map(({timelineStarts:F})=>F);return w.timelineStarts=_m(M),g1(U,w.timelineStarts),R&&(w.mediaGroups.AUDIO.audio=R),L&&(w.mediaGroups.SUBTITLES.subs=L),S.length&&(w.mediaGroups["CLOSED-CAPTIONS"].cc=u1(S)),r?i1({oldManifest:r,newManifest:w}):w},_1=(s,e,t)=>{const{NOW:n,clientOffset:r,availabilityStartTime:i,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:c=0}=s,h=(n+r)/1e3,m=i+o,_=h+c-m;return Math.ceil((_*a-e)/t)},vm=(s,e)=>{const{type:t,minimumUpdatePeriod:n=0,media:r="",sourceDuration:i,timescale:a=1,startNumber:o=1,periodStart:c}=s,h=[];let m=-1;for(let _=0;_<e.length;_++){const T=e[_],S=T.d,w=T.r||0,b=T.t||0;m<0&&(m=b),b&&b>m&&(m=b);let R;if(w<0){const M=_+1;M===e.length?t==="dynamic"&&n>0&&r.indexOf("$Number$")>0?R=_1(s,m,S):R=(i*a-m)/S:R=(e[M].t-m)/S}else R=w+1;const L=o+h.length+R;let U=o+h.length;for(;U<L;)h.push({number:U,duration:S/a,time:m,timeline:c}),m+=S,U++}return h},v1=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,b1=s=>(e,t,n,r)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const i=""+s[t];return t==="RepresentationID"||(n?r=parseInt(r,10):r=1,i.length>=r)?i:`${new Array(r-i.length+1).join("0")}${i}`},Fu=(s,e)=>s.replace(v1,b1(e)),T1=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?Ac(s):vm(s,e),A1=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:n={sourceURL:"",range:""}}=s,r=ci({baseUrl:s.baseUrl,source:Fu(n.sourceURL,t),range:n.range});return T1(s,e).map(i=>{t.Number=i.number,t.Time=i.time;const a=Fu(s.media||"",t),o=s.timescale||1,c=s.presentationTimeOffset||0,h=s.periodStart+(i.time-c)/o;return{uri:a,timeline:i.timeline,duration:i.duration,resolvedUri:Za(s.baseUrl||"",a),map:r,number:i.number,presentationTime:h}})},S1=(s,e)=>{const{baseUrl:t,initialization:n={}}=s,r=ci({baseUrl:t,source:n.sourceURL,range:n.range}),i=ci({baseUrl:t,source:e.media,range:e.mediaRange});return i.map=r,i},E1=(s,e)=>{const{duration:t,segmentUrls:n=[],periodStart:r}=s;if(!t&&!e||t&&e)throw new Error(Zn.SEGMENT_TIME_UNSPECIFIED);const i=n.map(o=>S1(s,o));let a;return t&&(a=Ac(s)),e&&(a=vm(s,e)),a.map((o,c)=>{if(i[c]){const h=i[c],m=s.timescale||1,_=s.presentationTimeOffset||0;return h.timeline=o.timeline,h.duration=o.duration,h.number=o.number,h.presentationTime=r+(o.time-_)/m,h}}).filter(o=>o)},w1=({attributes:s,segmentInfo:e})=>{let t,n;e.template?(n=A1,t=Ze(s,e.template)):e.base?(n=ym,t=Ze(s,e.base)):e.list&&(n=E1,t=Ze(s,e.list));const r={attributes:s};if(!n)return r;const i=n(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else i.length?t.duration=i.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return r.attributes=t,r.segments=i,e.base&&t.indexRange&&(r.sidx=i[0],r.segments=[]),r},k1=s=>s.map(w1),Be=(s,e)=>gm(s.childNodes).filter(({tagName:t})=>t===e),_i=s=>s.textContent.trim(),C1=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),Ln=s=>{const e=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!e)return 0;const[t,n,r,i,a,o]=e.slice(1);return parseFloat(t||0)*31536e3+parseFloat(n||0)*2592e3+parseFloat(r||0)*86400+parseFloat(i||0)*3600+parseFloat(a||0)*60+parseFloat(o||0)},I1=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),ju={mediaPresentationDuration(s){return Ln(s)},availabilityStartTime(s){return I1(s)/1e3},minimumUpdatePeriod(s){return Ln(s)},suggestedPresentationDelay(s){return Ln(s)},type(s){return s},timeShiftBufferDepth(s){return Ln(s)},start(s){return Ln(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return C1(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)?Ln(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}},Xe=s=>s&&s.attributes?gm(s.attributes).reduce((e,t)=>{const n=ju[t.name]||ju.DEFAULT;return e[t.name]=n(t.value),e},{}):{},x1={"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"},io=(s,e)=>e.length?Jn(s.map(function(t){return e.map(function(n){const r=_i(n),i=Za(t.baseUrl,r),a=Ze(Xe(n),{baseUrl:i});return i!==r&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,wc=s=>{const e=Be(s,"SegmentTemplate")[0],t=Be(s,"SegmentList")[0],n=t&&Be(t,"SegmentURL").map(_=>Ze({tag:"SegmentURL"},Xe(_))),r=Be(s,"SegmentBase")[0],i=t||e,a=i&&Be(i,"SegmentTimeline")[0],o=t||r||e,c=o&&Be(o,"Initialization")[0],h=e&&Xe(e);h&&c?h.initialization=c&&Xe(c):h&&h.initialization&&(h.initialization={sourceURL:h.initialization});const m={template:h,segmentTimeline:a&&Be(a,"S").map(_=>Xe(_)),list:t&&Ze(Xe(t),{segmentUrls:n,initialization:Xe(c)}),base:r&&Ze(Xe(r),{initialization:Xe(c)})};return Object.keys(m).forEach(_=>{m[_]||delete m[_]}),m},L1=(s,e,t)=>n=>{const r=Be(n,"BaseURL"),i=io(e,r),a=Ze(s,Xe(n)),o=wc(n);return i.map(c=>({segmentInfo:Ze(t,o),attributes:Ze(a,c)}))},P1=s=>s.reduce((e,t)=>{const n=Xe(t);n.schemeIdUri&&(n.schemeIdUri=n.schemeIdUri.toLowerCase());const r=x1[n.schemeIdUri];if(r){e[r]={attributes:n};const i=Be(t,"cenc:pssh")[0];if(i){const a=_i(i);e[r].pssh=a&&Dp(a)}}return e},{}),R1=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(e=>{let t,n;return n=e,/^CC\d=/.test(e)?[t,n]=e.split("="):/^CC\d$/.test(e)&&(t=e),{channel:t,language:n}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(e=>{const t={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(e)){const[n,r=""]=e.split("=");t.channel=n,t.language=e,r.split(",").forEach(i=>{const[a,o]=i.split(":");a==="lang"?t.language=o:a==="er"?t.easyReader=Number(o):a==="war"?t.aspectRatio=Number(o):a==="3D"&&(t["3D"]=Number(o))})}else t.language=e;return t.channel&&(t.channel="SERVICE"+t.channel),t})},D1=s=>Jn(Be(s.node,"EventStream").map(e=>{const t=Xe(e),n=t.schemeIdUri;return Be(e,"Event").map(r=>{const i=Xe(r),a=i.presentationTime||0,o=t.timescale||1,c=i.duration||0,h=a/o+s.attributes.start;return{schemeIdUri:n,value:t.value,id:i.id,start:h,end:h+c/o,messageData:_i(r)||i.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),N1=(s,e,t)=>n=>{const r=Xe(n),i=io(e,Be(n,"BaseURL")),a=Be(n,"Role")[0],o={role:Xe(a)};let c=Ze(s,r,o);const h=Be(n,"Accessibility")[0],m=R1(Xe(h));m&&(c=Ze(c,{captionServices:m}));const _=Be(n,"Label")[0];if(_&&_.childNodes.length){const R=_.childNodes[0].nodeValue.trim();c=Ze(c,{label:R})}const T=P1(Be(n,"ContentProtection"));Object.keys(T).length&&(c=Ze(c,{contentProtection:T}));const S=wc(n),w=Be(n,"Representation"),b=Ze(t,S);return Jn(w.map(L1(c,i,b)))},O1=(s,e)=>(t,n)=>{const r=io(e,Be(t.node,"BaseURL")),i=Ze(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(i.periodDuration=t.attributes.duration);const a=Be(t.node,"AdaptationSet"),o=wc(t.node);return Jn(a.map(N1(i,r,o)))},M1=(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=Ze({serverURL:_i(s[0])},Xe(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},U1=({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,B1=(s,e={})=>{const{manifestUri:t="",NOW:n=Date.now(),clientOffset:r=0,eventHandler:i=function(){}}=e,a=Be(s,"Period");if(!a.length)throw new Error(Zn.INVALID_NUMBER_OF_PERIOD);const o=Be(s,"Location"),c=Xe(s),h=io([{baseUrl:t}],Be(s,"BaseURL")),m=Be(s,"ContentSteering");c.type=c.type||"static",c.sourceDuration=c.mediaPresentationDuration||0,c.NOW=n,c.clientOffset=r,o.length&&(c.locations=o.map(_i));const _=[];return a.forEach((T,S)=>{const w=Xe(T),b=_[S-1];w.start=U1({attributes:w,priorPeriodAttributes:b?b.attributes:null,mpdType:c.type}),_.push({node:T,attributes:w})}),{locations:c.locations,contentSteeringInfo:M1(m,i),representationInfo:Jn(_.map(O1(c,h))),eventStream:Jn(_.map(D1))}},bm=s=>{if(s==="")throw new Error(Zn.DASH_EMPTY_MANIFEST);const e=new mm;let t,n;try{t=e.parseFromString(s,"application/xml"),n=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!n||n&&n.getElementsByTagName("parsererror").length>0)throw new Error(Zn.DASH_INVALID_XML);return n},F1=s=>{const e=Be(s,"UTCTiming")[0];if(!e)return null;const t=Xe(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;case"urn:mpeg:dash:utc:http-ntp:2014":case"urn:mpeg:dash:utc:ntp:2014":case"urn:mpeg:dash:utc:sntp:2014":default:throw new Error(Zn.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},j1=(s,e={})=>{const t=B1(bm(s),e),n=k1(t.representationInfo);return y1({dashPlaylists:n,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},q1=s=>F1(bm(s));var Tm=Math.pow(2,32),V1=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*Tm+e.getUint32(4)},$1={getUint64:V1,MAX_UINT32:Tm},qu=$1.getUint64,H1=function(s){var e=new DataView(s.buffer,s.byteOffset,s.byteLength),t={version:s[0],flags:new Uint8Array(s.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},n=12;t.version===0?(t.earliestPresentationTime=e.getUint32(n),t.firstOffset=e.getUint32(n+4),n+=8):(t.earliestPresentationTime=qu(s.subarray(n)),t.firstOffset=qu(s.subarray(n+8)),n+=16),n+=2;var r=e.getUint16(n);for(n+=2;r>0;n+=12,r--)t.references.push({referenceType:(s[n]&128)>>>7,referencedSize:e.getUint32(n)&2147483647,subsegmentDuration:e.getUint32(n+4),startsWithSap:!!(s[n+8]&128),sapType:(s[n+8]&112)>>>4,sapDeltaTime:e.getUint32(n+8)&268435455});return t},W1=H1;const z1=or(W1);var G1=ae([73,68,51]),X1=function(s,e){e===void 0&&(e=0),s=ae(s);var t=s[e+5],n=s[e+6]<<21|s[e+7]<<14|s[e+8]<<7|s[e+9],r=(t&16)>>4;return r?n+20:n+10},Wr=function s(e,t){return t===void 0&&(t=0),e=ae(e),e.length-t<10||!Ue(e,G1,{offset:t})?t:(t+=X1(e,t),s(e,t))},Vu=function(s){return typeof s=="string"?Bp(s):s},Y1=function(s){return Array.isArray(s)?s.map(function(e){return Vu(e)}):[Vu(s)]},K1=function s(e,t,n){n===void 0&&(n=!1),t=Y1(t),e=ae(e);var r=[];if(!t.length)return r;for(var i=0;i<e.length;){var a=(e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3])>>>0,o=e.subarray(i+4,i+8);if(a===0)break;var c=i+a;if(c>e.length){if(n)break;c=e.length}var h=e.subarray(i+8,c);Ue(o,t[0])&&(t.length===1?r.push(h):r.push.apply(r,s(h,t.slice(1),n))),i=c}return r},sa={EBML:ae([26,69,223,163]),DocType:ae([66,130]),Segment:ae([24,83,128,103]),SegmentInfo:ae([21,73,169,102]),Tracks:ae([22,84,174,107]),Track:ae([174]),TrackNumber:ae([215]),DefaultDuration:ae([35,227,131]),TrackEntry:ae([174]),TrackType:ae([131]),FlagDefault:ae([136]),CodecID:ae([134]),CodecPrivate:ae([99,162]),VideoTrack:ae([224]),AudioTrack:ae([225]),Cluster:ae([31,67,182,117]),Timestamp:ae([231]),TimestampScale:ae([42,215,177]),BlockGroup:ae([160]),BlockDuration:ae([155]),Block:ae([161]),SimpleBlock:ae([163])},Cl=[128,64,32,16,8,4,2,1],Q1=function(s){for(var e=1,t=0;t<Cl.length&&!(s&Cl[t]);t++)e++;return e},Ia=function(s,e,t,n){t===void 0&&(t=!0),n===void 0&&(n=!1);var r=Q1(s[e]),i=s.subarray(e,e+r);return t&&(i=Array.prototype.slice.call(s,e,e+r),i[0]^=Cl[r-1]),{length:r,value:yT(i,{signed:n}),bytes:i}},$u=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?_T(e):e},J1=function(s){return Array.isArray(s)?s.map(function(e){return $u(e)}):[$u(s)]},Z1=function s(e,t,n){if(n>=t.length)return t.length;var r=Ia(t,n,!1);if(Ue(e.bytes,r.bytes))return n;var i=Ia(t,n+r.length);return s(e,t,n+i.length+i.value+r.length)},Hu=function s(e,t){t=J1(t),e=ae(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var i=Ia(e,r,!1),a=Ia(e,r+i.length),o=r+i.length+a.length;a.value===127&&(a.value=Z1(i,e,o),a.value!==e.length&&(a.value-=o));var c=o+a.value>e.length?e.length:o+a.value,h=e.subarray(o,c);Ue(t[0],i.bytes)&&(t.length===1?n.push(h):n=n.concat(s(h,t.slice(1))));var m=i.length+a.length+h.length;r+=m}return n},eA=ae([0,0,0,1]),tA=ae([0,0,1]),sA=ae([0,0,3]),nA=function(s){for(var e=[],t=1;t<s.length-2;)Ue(s.subarray(t,t+3),sA)&&(e.push(t+2),t++),t++;if(e.length===0)return s;var n=s.length-e.length,r=new Uint8Array(n),i=0;for(t=0;t<n;i++,t++)i===e[0]&&(i++,e.shift()),r[t]=s[i];return r},Am=function(s,e,t,n){s=ae(s),t=[].concat(t);for(var r=0,i,a=0;r<s.length&&(a<n||i);){var o=void 0;if(Ue(s.subarray(r),eA)?o=4:Ue(s.subarray(r),tA)&&(o=3),!o){r++;continue}if(a++,i)return nA(s.subarray(i,r));var c=void 0;e==="h264"?c=s[r+o]&31:e==="h265"&&(c=s[r+o]>>1&63),t.indexOf(c)!==-1&&(i=r+o),r+=o+(e==="h264"?1:2)}return s.subarray(0,0)},rA=function(s,e,t){return Am(s,"h264",e,t)},iA=function(s,e,t){return Am(s,"h265",e,t)},ft={webm:ae([119,101,98,109]),matroska:ae([109,97,116,114,111,115,107,97]),flac:ae([102,76,97,67]),ogg:ae([79,103,103,83]),ac3:ae([11,119]),riff:ae([82,73,70,70]),avi:ae([65,86,73]),wav:ae([87,65,86,69]),"3gp":ae([102,116,121,112,51,103]),mp4:ae([102,116,121,112]),fmp4:ae([115,116,121,112]),mov:ae([102,116,121,112,113,116]),moov:ae([109,111,111,118]),moof:ae([109,111,111,102])},er={aac:function(s){var e=Wr(s);return Ue(s,[255,16],{offset:e,mask:[255,22]})},mp3:function(s){var e=Wr(s);return Ue(s,[255,2],{offset:e,mask:[255,6]})},webm:function(s){var e=Hu(s,[sa.EBML,sa.DocType])[0];return Ue(e,ft.webm)},mkv:function(s){var e=Hu(s,[sa.EBML,sa.DocType])[0];return Ue(e,ft.matroska)},mp4:function(s){if(er["3gp"](s)||er.mov(s))return!1;if(Ue(s,ft.mp4,{offset:4})||Ue(s,ft.fmp4,{offset:4})||Ue(s,ft.moof,{offset:4})||Ue(s,ft.moov,{offset:4}))return!0},mov:function(s){return Ue(s,ft.mov,{offset:4})},"3gp":function(s){return Ue(s,ft["3gp"],{offset:4})},ac3:function(s){var e=Wr(s);return Ue(s,ft.ac3,{offset:e})},ts:function(s){if(s.length<189&&s.length>=1)return s[0]===71;for(var e=0;e+188<s.length&&e<188;){if(s[e]===71&&s[e+188]===71)return!0;e+=1}return!1},flac:function(s){var e=Wr(s);return Ue(s,ft.flac,{offset:e})},ogg:function(s){return Ue(s,ft.ogg)},avi:function(s){return Ue(s,ft.riff)&&Ue(s,ft.avi,{offset:8})},wav:function(s){return Ue(s,ft.riff)&&Ue(s,ft.wav,{offset:8})},h264:function(s){return rA(s,7,3).length},h265:function(s){return iA(s,[32,33],3).length}},Il=Object.keys(er).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);Il.forEach(function(s){var e=er[s];er[s]=function(t){return e(ae(t))}});var aA=er,kc=function(s){s=ae(s);for(var e=0;e<Il.length;e++){var t=Il[e];if(aA[t](s))return t}return""},oA=function(s){return K1(s,["moof"]).length>0},Cc=9e4,Ic,xc,ao,Lc,Sm,Em,wm;Ic=function(s){return s*Cc};xc=function(s,e){return s*e};ao=function(s){return s/Cc};Lc=function(s,e){return s/e};Sm=function(s,e){return Ic(Lc(s,e))};Em=function(s,e){return xc(ao(s),e)};wm=function(s,e,t){return ao(t?s:s-e)};var on={ONE_SECOND_IN_TS:Cc,secondsToVideoTs:Ic,secondsToAudioTs:xc,videoTsToSeconds:ao,audioTsToSeconds:Lc,audioTsToVideoTs:Sm,videoTsToAudioTs:Em,metadataTsToSeconds:wm},xl="8.21.0";const _s={},$s=function(s,e){return _s[s]=_s[s]||[],e&&(_s[s]=_s[s].concat(e)),_s[s]},lA=function(s,e){$s(s,e)},km=function(s,e){const t=$s(s).indexOf(e);return t<=-1?!1:(_s[s]=_s[s].slice(),_s[s].splice(t,1),!0)},cA=function(s,e){$s(s,[].concat(e).map(t=>{const n=(...r)=>(km(s,n),t(...r));return n}))},xa={prefixed:!0},la=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Wu=la[0];let zr;for(let s=0;s<la.length;s++)if(la[s][1]in X){zr=la[s];break}if(zr){for(let s=0;s<zr.length;s++)xa[Wu[s]]=zr[s];xa.prefixed=zr[0]!==Wu[0]}let Tt=[];const dA=(s,e,t)=>(n,r,i)=>{const a=e.levels[r],o=new RegExp(`^(${a})$`);let c=s;if(n!=="log"&&i.unshift(n.toUpperCase()+":"),t&&(c=`%c${s}`,i.unshift(t)),i.unshift(c+":"),Tt){Tt.push([].concat(i));const m=Tt.length-1e3;Tt.splice(0,m>0?m:0)}if(!I.console)return;let h=I.console[n];!h&&n==="debug"&&(h=I.console.info||I.console.log),!(!h||!a||!o.test(n))&&h[Array.isArray(i)?"apply":"call"](I.console,i)};function Ll(s,e=":",t=""){let n="info",r;function i(...a){r("log",n,a)}return r=dA(s,i,t),i.createLogger=(a,o,c)=>{const h=o!==void 0?o:e,m=c!==void 0?c:t,_=`${s} ${h} ${a}`;return Ll(_,h,m)},i.createNewLogger=(a,o,c)=>Ll(a,o,c),i.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:n},i.level=a=>{if(typeof a=="string"){if(!i.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);n=a}return n},i.history=()=>Tt?[].concat(Tt):[],i.history.filter=a=>(Tt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),i.history.clear=()=>{Tt&&(Tt.length=0)},i.history.disable=()=>{Tt!==null&&(Tt.length=0,Tt=null)},i.history.enable=()=>{Tt===null&&(Tt=[])},i.error=(...a)=>r("error",n,a),i.warn=(...a)=>r("warn",n,a),i.debug=(...a)=>r("debug",n,a),i}const fe=Ll("VIDEOJS"),Cm=fe.createLogger,uA=Object.prototype.toString,Im=function(s){return os(s)?Object.keys(s):[]};function Fn(s,e){Im(s).forEach(t=>e(s[t],t))}function xm(s,e,t=0){return Im(s).reduce((n,r)=>e(n,s[r],r),t)}function os(s){return!!s&&typeof s=="object"}function tr(s){return os(s)&&uA.call(s)==="[object Object]"&&s.constructor===Object}function we(...s){const e={};return s.forEach(t=>{t&&Fn(t,(n,r)=>{if(!tr(n)){e[r]=n;return}tr(e[r])||(e[r]={}),e[r]=we(e[r],n)})}),e}function Lm(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const n=s[t];e.push(n)}return e}function oo(s,e,t,n=!0){const r=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),i={configurable:!0,enumerable:!0,get(){const a=t();return r(a),a}};return n&&(i.set=r),Object.defineProperty(s,e,i)}var hA=Object.freeze({__proto__:null,each:Fn,reduce:xm,isObject:os,isPlain:tr,merge:we,values:Lm,defineLazyProperty:oo});let Pc=!1,Pm=null,Wt=!1,Rm,Dm=!1,jn=!1,qn=!1,ls=!1,Rc=null,lo=null;const pA=!!(I.cast&&I.cast.framework&&I.cast.framework.CastReceiverContext);let Nm=null,La=!1,co=!1,Pa=!1,uo=!1,Ra=!1,Da=!1,Na=!1;const di=!!(cr()&&("ontouchstart"in I||I.navigator.maxTouchPoints||I.DocumentTouch&&I.document instanceof I.DocumentTouch)),Ms=I.navigator&&I.navigator.userAgentData;Ms&&Ms.platform&&Ms.brands&&(Wt=Ms.platform==="Android",jn=!!Ms.brands.find(s=>s.brand==="Microsoft Edge"),qn=!!Ms.brands.find(s=>s.brand==="Chromium"),ls=!jn&&qn,Rc=lo=(Ms.brands.find(s=>s.brand==="Chromium")||{}).version||null,co=Ms.platform==="Windows");if(!qn){const s=I.navigator&&I.navigator.userAgent||"";Pc=/iPod/i.test(s),Pm=function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Wt=/Android/i.test(s),Rm=function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),n=e[2]&&parseFloat(e[2]);return t&&n?parseFloat(e[1]+"."+e[2]):t||null}(),Dm=/Firefox/i.test(s),jn=/Edg/i.test(s),qn=/Chrome/i.test(s)||/CriOS/i.test(s),ls=!jn&&qn,Rc=lo=function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Nm=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}(),Ra=/Tizen/i.test(s),Da=/Web0S/i.test(s),Na=Ra||Da,La=/Safari/i.test(s)&&!ls&&!Wt&&!jn&&!Na,co=/Windows/i.test(s),Pa=/iPad/i.test(s)||La&&di&&!/iPhone/i.test(s),uo=/iPhone/i.test(s)&&!Pa}const at=uo||Pa||Pc,ho=(La||at)&&!ls;var Om=Object.freeze({__proto__:null,get IS_IPOD(){return Pc},get IOS_VERSION(){return Pm},get IS_ANDROID(){return Wt},get ANDROID_VERSION(){return Rm},get IS_FIREFOX(){return Dm},get IS_EDGE(){return jn},get IS_CHROMIUM(){return qn},get IS_CHROME(){return ls},get CHROMIUM_VERSION(){return Rc},get CHROME_VERSION(){return lo},IS_CHROMECAST_RECEIVER:pA,get IE_VERSION(){return Nm},get IS_SAFARI(){return La},get IS_WINDOWS(){return co},get IS_IPAD(){return Pa},get IS_IPHONE(){return uo},get IS_TIZEN(){return Ra},get IS_WEBOS(){return Da},get IS_SMART_TV(){return Na},TOUCH_ENABLED:di,IS_IOS:at,IS_ANY_SAFARI:ho});function zu(s){return typeof s=="string"&&!!s.trim()}function mA(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function cr(){return X===I.document}function dr(s){return os(s)&&s.nodeType===1}function Mm(){try{return I.parent!==I.self}catch{return!0}}function Um(s){return function(e,t){if(!zu(e))return X[s](null);zu(t)&&(t=X.querySelector(t));const n=dr(t)?t:X;return n[s]&&n[s](e)}}function oe(s="div",e={},t={},n){const r=X.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(i){const a=e[i];i==="textContent"?zs(r,a):(r[i]!==a||i==="tabIndex")&&(r[i]=a)}),Object.getOwnPropertyNames(t).forEach(function(i){r.setAttribute(i,t[i])}),n&&Dc(r,n),r}function zs(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function Pl(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function ti(s,e){return mA(e),s.classList.contains(e)}function dn(s,...e){return s.classList.add(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),s}function po(s,...e){return s?(s.classList.remove(...e.reduce((t,n)=>t.concat(n.split(/\s+/)),[])),s):(fe.warn("removeClass was called with an element that doesn't exist"),null)}function Bm(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(n=>s.classList.toggle(n,t)),s}function Fm(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const n=e[t];n===null||typeof n>"u"||n===!1?s.removeAttribute(t):s.setAttribute(t,n===!0?"":n)})}function js(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const n=s.attributes;for(let r=n.length-1;r>=0;r--){const i=n[r].name;let a=n[r].value;t.includes(i)&&(a=a!==null),e[i]=a}}return e}function jm(s,e){return s.getAttribute(e)}function sr(s,e,t){s.setAttribute(e,t)}function mo(s,e){s.removeAttribute(e)}function qm(){X.body.focus(),X.onselectstart=function(){return!1}}function Vm(){X.onselectstart=function(){return!0}}function nr(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(n=>{e[n]!==void 0&&(t[n]=e[n])}),t.height||(t.height=parseFloat(rr(s,"height"))),t.width||(t.width=parseFloat(rr(s,"width"))),t}}function ui(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let n=0,r=0;for(;s.offsetParent&&s!==X[xa.fullscreenElement];)n+=s.offsetLeft,r+=s.offsetTop,s=s.offsetParent;return{left:n,top:r,width:e,height:t}}function fo(s,e){const t={x:0,y:0};if(at){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const _=rr(m,"transform");if(/^matrix/.test(_)){const T=_.slice(7,-1).split(/,\s/).map(Number);t.x+=T[4],t.y+=T[5]}else if(/^matrix3d/.test(_)){const T=_.slice(9,-1).split(/,\s/).map(Number);t.x+=T[12],t.y+=T[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&I.WebKitCSSMatrix){const T=I.getComputedStyle(m.assignedSlot.parentElement).transform,S=new I.WebKitCSSMatrix(T);t.x+=S.m41,t.y+=S.m42}m=m.parentNode||m.host}}const n={},r=ui(e.target),i=ui(s),a=i.width,o=i.height;let c=e.offsetY-(i.top-r.top),h=e.offsetX-(i.left-r.left);return e.changedTouches&&(h=e.changedTouches[0].pageX-i.left,c=e.changedTouches[0].pageY+i.top,at&&(h-=t.x,c-=t.y)),n.y=1-Math.max(0,Math.min(1,c/o)),n.x=Math.max(0,Math.min(1,h/a)),n}function $m(s){return os(s)&&s.nodeType===3}function go(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function Hm(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),dr(e)||$m(e))return e;if(typeof e=="string"&&/\S/.test(e))return X.createTextNode(e)}).filter(e=>e)}function Dc(s,e){return Hm(e).forEach(t=>s.appendChild(t)),s}function Wm(s,e){return Dc(go(s),e)}function hi(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 Hs=Um("querySelector"),zm=Um("querySelectorAll");function rr(s,e){if(!s||!e)return"";if(typeof I.getComputedStyle=="function"){let t;try{t=I.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Gm(s){[...X.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(r=>r.cssText).join(""),n=X.createElement("style");n.textContent=t,s.document.head.appendChild(n)}catch{const t=X.createElement("link");t.rel="stylesheet",t.type=e.type,t.media=e.media.mediaText,t.href=e.href,s.document.head.appendChild(t)}})}var Xm=Object.freeze({__proto__:null,isReal:cr,isEl:dr,isInFrame:Mm,createEl:oe,textContent:zs,prependTo:Pl,hasClass:ti,addClass:dn,removeClass:po,toggleClass:Bm,setAttributes:Fm,getAttributes:js,getAttribute:jm,setAttribute:sr,removeAttribute:mo,blockTextSelection:qm,unblockTextSelection:Vm,getBoundingClientRect:nr,findPosition:ui,getPointerPosition:fo,isTextNode:$m,emptyEl:go,normalizeContent:Hm,appendContent:Dc,insertContent:Wm,isSingleLeftClick:hi,$:Hs,$$:zm,computedStyle:rr,copyStyleSheetsToWindow:Gm});let Ym=!1,Rl;const fA=function(){if(Rl.options.autoSetup===!1)return;const s=Array.prototype.slice.call(X.getElementsByTagName("video")),e=Array.prototype.slice.call(X.getElementsByTagName("audio")),t=Array.prototype.slice.call(X.getElementsByTagName("video-js")),n=s.concat(e,t);if(n&&n.length>0)for(let r=0,i=n.length;r<i;r++){const a=n[r];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&Rl(a);else{Dl(1);break}}else Ym||Dl(1)};function Dl(s,e){cr()&&(e&&(Rl=e),I.setTimeout(fA,s))}function Nl(){Ym=!0,I.removeEventListener("load",Nl)}cr()&&(X.readyState==="complete"?Nl():I.addEventListener("load",Nl));const Km=function(s){const e=X.createElement("style");return e.className=s,e},Qm=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var _t=new WeakMap;const gA=3;let yA=gA;function Bt(){return yA++}function Gu(s,e){if(!_t.has(s))return;const t=_t.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&&_t.delete(s)}function Nc(s,e,t,n){t.forEach(function(r){s(e,r,n)})}function yo(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const n=s||I.event;s={};const r=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const i in n)r.includes(i)||i==="returnValue"&&n.preventDefault||(s[i]=n[i]);if(s.target||(s.target=s.srcElement||X),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){n.preventDefault&&n.preventDefault(),s.returnValue=!1,n.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){n.stopPropagation&&n.stopPropagation(),s.cancelBubble=!0,n.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){n.stopImmediatePropagation&&n.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const i=X.documentElement,a=X.body;s.pageX=s.clientX+(i&&i.scrollLeft||a&&a.scrollLeft||0)-(i&&i.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(i&&i.scrollTop||a&&a.scrollTop||0)-(i&&i.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 na;const _A=function(){if(typeof na!="boolean"){na=!1;try{const s=Object.defineProperty({},"passive",{get(){na=!0}});I.addEventListener("test",null,s),I.removeEventListener("test",null,s)}catch{}}return na},vA=["touchstart","touchmove"];function Lt(s,e,t){if(Array.isArray(e))return Nc(Lt,s,e,t);_t.has(s)||_t.set(s,{});const n=_t.get(s);if(n.handlers||(n.handlers={}),n.handlers[e]||(n.handlers[e]=[]),t.guid||(t.guid=Bt()),n.handlers[e].push(t),n.dispatcher||(n.disabled=!1,n.dispatcher=function(r,i){if(n.disabled)return;r=yo(r);const a=n.handlers[r.type];if(a){const o=a.slice(0);for(let c=0,h=o.length;c<h&&!r.isImmediatePropagationStopped();c++)try{o[c].call(s,r,i)}catch(m){fe.error(m)}}}),n.handlers[e].length===1)if(s.addEventListener){let r=!1;_A()&&vA.indexOf(e)>-1&&(r={passive:!0}),s.addEventListener(e,n.dispatcher,r)}else s.attachEvent&&s.attachEvent("on"+e,n.dispatcher)}function ot(s,e,t){if(!_t.has(s))return;const n=_t.get(s);if(!n.handlers)return;if(Array.isArray(e))return Nc(ot,s,e,t);const r=function(a,o){n.handlers[o]=[],Gu(a,o)};if(e===void 0){for(const a in n.handlers)Object.prototype.hasOwnProperty.call(n.handlers||{},a)&&r(s,a);return}const i=n.handlers[e];if(i){if(!t){r(s,e);return}if(t.guid)for(let a=0;a<i.length;a++)i[a].guid===t.guid&&i.splice(a--,1);Gu(s,e)}}function ur(s,e,t){const n=_t.has(s)?_t.get(s):{},r=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=yo(e),n.dispatcher&&n.dispatcher.call(s,e,t),r&&!e.isPropagationStopped()&&e.bubbles===!0)ur.call(null,r,e,t);else if(!r&&!e.defaultPrevented&&e.target&&e.target[e.type]){_t.has(e.target)||_t.set(e.target,{});const i=_t.get(e.target);e.target[e.type]&&(i.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),i.disabled=!1)}return!e.defaultPrevented}function _o(s,e,t){if(Array.isArray(e))return Nc(_o,s,e,t);const n=function(){ot(s,e,n),t.apply(this,arguments)};n.guid=t.guid=t.guid||Bt(),Lt(s,e,n)}function Oc(s,e,t){const n=function(){ot(s,e,n),t.apply(this,arguments)};n.guid=t.guid=t.guid||Bt(),Lt(s,e,n)}var bA=Object.freeze({__proto__:null,fixEvent:yo,on:Lt,off:ot,trigger:ur,one:_o,any:Oc});const Ft=30,Le=function(s,e,t){e.guid||(e.guid=Bt());const n=e.bind(s);return n.guid=t?t+"_"+e.guid:e.guid,n},cs=function(s,e){let t=I.performance.now();return function(...n){const r=I.performance.now();r-t>=e&&(s(...n),t=r)}},Jm=function(s,e,t,n=I){let r;const i=()=>{n.clearTimeout(r),r=null},a=function(){const o=this,c=arguments;let h=function(){r=null,h=null,t||s.apply(o,c)};!r&&t&&s.apply(o,c),n.clearTimeout(r),r=n.setTimeout(h,e)};return a.cancel=i,a};var TA=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ft,bind_:Le,throttle:cs,debounce:Jm});let Fr;class Pt{on(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Lt(this,e,t),this.addEventListener=n}off(e,t){ot(this,e,t)}one(e,t){const n=this.addEventListener;this.addEventListener=()=>{},_o(this,e,t),this.addEventListener=n}any(e,t){const n=this.addEventListener;this.addEventListener=()=>{},Oc(this,e,t),this.addEventListener=n}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=yo(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ur(this,e)}queueTrigger(e){Fr||(Fr=new Map);const t=e.type||e;let n=Fr.get(this);n||(n=new Map,Fr.set(this,n));const r=n.get(t);n.delete(t),I.clearTimeout(r);const i=I.setTimeout(()=>{n.delete(t),n.size===0&&(n=null,Fr.delete(this)),this.trigger(e)},0);n.set(t,i)}}Pt.prototype.allowedEvents_={};Pt.prototype.addEventListener=Pt.prototype.on;Pt.prototype.removeEventListener=Pt.prototype.off;Pt.prototype.dispatchEvent=Pt.prototype.trigger;const vo=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,Ts=s=>s instanceof Pt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),AA=(s,e)=>{Ts(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},Ol=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,Oa=(s,e,t)=>{if(!s||!s.nodeName&&!Ts(s))throw new Error(`Invalid target for ${vo(e)}#${t}; must be a DOM node or evented object.`)},Zm=(s,e,t)=>{if(!Ol(s))throw new Error(`Invalid event type for ${vo(e)}#${t}; must be a non-empty string or array.`)},ef=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${vo(e)}#${t}; must be a function.`)},nl=(s,e,t)=>{const n=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let r,i,a;return n?(r=s.eventBusEl_,e.length>=3&&e.shift(),[i,a]=e):(r=e[0],i=e[1],a=e[2]),Oa(r,s,t),Zm(i,s,t),ef(a,s,t),a=Le(s,a),{isTargetingSelf:n,target:r,type:i,listener:a}},tn=(s,e,t,n)=>{Oa(s,s,e),s.nodeName?bA[e](s,t,n):s[e](t,n)},SA={on(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"on");if(tn(t,"on",n,r),!e){const i=()=>this.off(t,n,r);i.guid=r.guid;const a=()=>this.off("dispose",i);a.guid=r.guid,tn(this,"on","dispose",i),tn(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"one");if(e)tn(t,"one",n,r);else{const i=(...a)=>{this.off(t,n,i),r.apply(null,a)};i.guid=r.guid,tn(t,"one",n,i)}},any(...s){const{isTargetingSelf:e,target:t,type:n,listener:r}=nl(this,s,"any");if(e)tn(t,"any",n,r);else{const i=(...a)=>{this.off(t,n,i),r.apply(null,a)};i.guid=r.guid,tn(t,"any",n,i)}},off(s,e,t){if(!s||Ol(s))ot(this.eventBusEl_,s,e);else{const n=s,r=e;Oa(n,this,"off"),Zm(r,this,"off"),ef(t,this,"off"),t=Le(this,t),this.off("dispose",t),n.nodeName?(ot(n,r,t),ot(n,"dispose",t)):Ts(n)&&(n.off(r,t),n.off("dispose",t))}},trigger(s,e){Oa(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!Ol(t))throw new Error(`Invalid event type for ${vo(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ur(this.eventBusEl_,s,e)}};function Mc(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_=oe("span",{className:"vjs-event-bus"});return Object.assign(s,SA),s.eventedCallbacks&&s.eventedCallbacks.forEach(n=>{n()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(n){n&&_t.has(n)&&_t.delete(n)}),I.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const EA={state:{},setState(s){typeof s=="function"&&(s=s());let e;return Fn(s,(t,n)=>{this.state[n]!==t&&(e=e||{},e[n]={from:this.state[n],to:t}),this.state[n]=t}),e&&Ts(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function tf(s,e){return Object.assign(s,EA),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&Ts(s)&&s.on("statechanged",s.handleStateChanged),s}const si=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},Ve=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},sf=function(s,e){return Ve(s)===Ve(e)};var wA=Object.freeze({__proto__:null,toLowerCase:si,toTitleCase:Ve,titleCaseEquals:sf});class ${constructor(e,t,n){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=we({},this.options_),t=this.options_=we(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const r=e&&e.id&&e.id()||"no_player";this.id_=`${r}_component_${Bt()}`}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&&(Mc(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),tf(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(n),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_=we(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,n){return oe(e,t,n)}localize(e,t,n=e){const r=this.player_.language&&this.player_.language(),i=this.player_.languages&&this.player_.languages(),a=i&&i[r],o=r&&r.split("-")[0],c=i&&i[o];let h=n;return a&&a[e]?h=a[e]:c&&c[e]&&(h=c[e]),t&&(h=h.replace(/\{(\d+)\}/g,function(m,_){const T=t[_-1];let S=T;return typeof T>"u"&&(S=m),S})),h}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((n,r)=>n.concat(r),[]);let t=this;for(let n=0;n<e.length;n++)if(t=t.getChild(e[n]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const n="http://www.w3.org/2000/svg",r=oe("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),i=X.createElementNS(n,"svg");i.setAttributeNS(null,"viewBox","0 0 512 512");const a=X.createElementNS(n,"use");return i.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),r.appendChild(i),this.iconIsSet_?t.replaceChild(r,t.querySelector(".vjs-icon-placeholder")):t.appendChild(r),this.iconIsSet_=!0,r}addChild(e,t={},n=this.children_.length){let r,i;if(typeof e=="string"){i=Ve(e);const a=t.componentClass||i;t.name=i;const o=$.getComponent(a);if(!o)throw new Error(`Component ${a} does not exist`);if(typeof o!="function")return null;r=new o(this.player_||this,t)}else r=e;if(r.parentComponent_&&r.parentComponent_.removeChild(r),this.children_.splice(n,0,r),r.parentComponent_=this,typeof r.id=="function"&&(this.childIndex_[r.id()]=r),i=i||r.name&&Ve(r.name()),i&&(this.childNameIndex_[i]=r,this.childNameIndex_[si(i)]=r),typeof r.el=="function"&&r.el()){let a=null;this.children_[n+1]&&(this.children_[n+1].el_?a=this.children_[n+1].el_:dr(this.children_[n+1])&&(a=this.children_[n+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_[Ve(e.name())]=null,this.childNameIndex_[si(e.name())]=null;const n=e.el();n&&n.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,n=a=>{const o=a.name;let c=a.opts;if(t[o]!==void 0&&(c=t[o]),c===!1)return;c===!0&&(c={}),c.playerOptions=this.options_.playerOptions;const h=this.addChild(o,c);h&&(this[o]=h)};let r;const i=$.getComponent("Tech");Array.isArray(e)?r=e:r=Object.keys(e),r.concat(Object.keys(this.options_).filter(function(a){return!r.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,c;return typeof a=="string"?(o=a,c=e[o]||this.options_[o]||{}):(o=a.name,c=a),{name:o,opts:c}}).filter(a=>{const o=$.getComponent(a.opts.componentClass||Ve(a.name));return o&&!i.isTech(o)}).forEach(n)}}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 Hs(e,t||this.contentEl())}$$(e,t){return zm(e,t||this.contentEl())}hasClass(e){return ti(this.el_,e)}addClass(...e){dn(this.el_,...e)}removeClass(...e){po(this.el_,...e)}toggleClass(e,t){Bm(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 jm(this.el_,e)}setAttribute(e,t){sr(this.el_,e,t)}removeAttribute(e){mo(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,n){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",n||this.trigger("componentresize");return}if(!this.el_)return 0;const r=this.el_.style[e],i=r.indexOf("px");return parseInt(i!==-1?r.slice(0,i):this.el_["offset"+Ve(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=rr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const n=`offset${Ve(e)}`;t=this.el_[n]}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},n={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:n}}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 n=10,r=200;let i;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=I.performance.now(),i=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)i=!1;else if(t){const c=o.touches[0].pageX-t.pageX,h=o.touches[0].pageY-t.pageY;Math.sqrt(c*c+h*h)>n&&(i=!1)}});const a=function(){i=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,i===!0&&I.performance.now()-e<r&&(o.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Le(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const n=function(r){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",n),this.on("touchcancel",n)}setTimeout(e,t){var n;return e=Le(this,e),this.clearTimersOnDispose_(),n=I.setTimeout(()=>{this.setTimeoutIds_.has(n)&&this.setTimeoutIds_.delete(n),e()},t),this.setTimeoutIds_.add(n),n}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),I.clearTimeout(e)),e}setInterval(e,t){e=Le(this,e),this.clearTimersOnDispose_();const n=I.setInterval(e,t);return this.setIntervalIds_.add(n),n}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),I.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Le(this,e),t=I.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Le(this,t);const n=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,n),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),I.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((n,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(i){const a=I.getComputedStyle(i,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function n(i){return!(!t(i.parentElement)||!t(i)||i.style.opacity==="0"||I.getComputedStyle(i).height==="0px"||I.getComputedStyle(i).width==="0px")}function r(i){if(i.offsetWidth+i.offsetHeight+i.getBoundingClientRect().height+i.getBoundingClientRect().width===0)return!1;const a={x:i.getBoundingClientRect().left+i.offsetWidth/2,y:i.getBoundingClientRect().top+i.offsetHeight/2};if(a.x<0||a.x>(X.documentElement.clientWidth||I.innerWidth)||a.y<0||a.y>(X.documentElement.clientHeight||I.innerHeight))return!1;let o=X.elementFromPoint(a.x,a.y);for(;o;){if(o===i)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(r(e)&&n(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 n=$.getComponent("Tech"),r=n&&n.isTech(t),i=$===t||$.prototype.isPrototypeOf(t.prototype);if(r||!i){let o;throw r?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=Ve(e),$.components_||($.components_={});const a=$.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,c=Object.keys(o);if(o&&c.length>0&&c.map(h=>o[h]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return $.components_[e]=t,$.components_[si(e)]=t,t}static getComponent(e){if(!(!e||!$.components_))return $.components_[e]}}$.registerComponent("Component",$);function kA(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 Xu(s,e,t,n){return kA(s,n,t.length-1),t[n][e]}function rl(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:Xu.bind(null,"start",0,s),end:Xu.bind(null,"end",1,s)},I.Symbol&&I.Symbol.iterator&&(e[I.Symbol.iterator]=()=>(s||[]).values()),e}function Ht(s,e){return Array.isArray(s)?rl(s):s===void 0||e===void 0?rl():rl([[s,e]])}const nf=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),n=Math.floor(s/60%60),r=Math.floor(s/3600);const i=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(r=n=t="-"),r=r>0||a>0?r+":":"",n=((r||i>=10)&&n<10?"0"+n:n)+":",t=t<10?"0"+t:t,r+n+t};let Uc=nf;function rf(s){Uc=s}function af(){Uc=nf}function fn(s,e=s){return Uc(s,e)}var CA=Object.freeze({__proto__:null,createTimeRanges:Ht,createTimeRange:Ht,setFormatTime:rf,resetFormatTime:af,formatTime:fn});function of(s,e){let t=0,n,r;if(!e)return 0;(!s||!s.length)&&(s=Ht(0,0));for(let i=0;i<s.length;i++)n=s.start(i),r=s.end(i),r>e&&(r=e),t+=r-n;return t/e}function je(s){if(s instanceof je)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:os(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=je.defaultMessages[this.code]||"")}je.prototype.code=0;je.prototype.message="";je.prototype.status=null;je.prototype.metadata=null;je.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];je.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."};je.MEDIA_ERR_CUSTOM=0;je.prototype.MEDIA_ERR_CUSTOM=0;je.MEDIA_ERR_ABORTED=1;je.prototype.MEDIA_ERR_ABORTED=1;je.MEDIA_ERR_NETWORK=2;je.prototype.MEDIA_ERR_NETWORK=2;je.MEDIA_ERR_DECODE=3;je.prototype.MEDIA_ERR_DECODE=3;je.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;je.MEDIA_ERR_ENCRYPTED=5;je.prototype.MEDIA_ERR_ENCRYPTED=5;function ni(s){return s!=null&&typeof s.then=="function"}function ts(s){ni(s)&&s.then(null,e=>{})}const Ml=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((e,t,n)=>(s[t]&&(e[t]=s[t]),e),{cues:s.cues&&Array.prototype.map.call(s.cues,function(e){return{startTime:e.startTime,endTime:e.endTime,text:e.text,id:e.id}})})},IA=function(s){const e=s.$$("track"),t=Array.prototype.map.call(e,n=>n.track);return Array.prototype.map.call(e,function(n){const r=Ml(n.track);return n.src&&(r.src=n.src),r}).concat(Array.prototype.filter.call(s.textTracks(),function(n){return t.indexOf(n)===-1}).map(Ml))},xA=function(s,e){return s.forEach(function(t){const n=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(r=>n.addCue(r))}),e.textTracks()};var Yu={textTracksToJson:IA,jsonToTextTracks:xA,trackToJson_:Ml};const il="vjs-modal-dialog";class hr extends ${constructor(e,t){super(e,t),this.handleKeyDown_=n=>this.handleKeyDown(n),this.close_=n=>this.close(n),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=oe("div",{className:`${il}-content`},{role:"document"}),this.descEl_=oe("p",{className:`${il}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),zs(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`${il} 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 n=this.getChild("closeButton");if(t&&!n){const r=this.contentEl_;this.contentEl_=this.el_,n=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=r,this.on(n,"close",this.close_)}!t&&n&&(this.off(n,"close",this.close_),this.removeChild(n),n.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),n=t.parentNode,r=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,n.removeChild(t),this.empty(),Wm(t,e),this.trigger("modalfill"),r?n.insertBefore(t,r):n.appendChild(t);const i=this.getChild("closeButton");i&&n.appendChild(i.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),go(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=X.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_(),n=this.el_.querySelector(":focus");let r;for(let i=0;i<t.length;i++)if(n===t[i]){r=i;break}X.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 I.HTMLAnchorElement||t instanceof I.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof I.HTMLInputElement||t instanceof I.HTMLSelectElement||t instanceof I.HTMLTextAreaElement||t instanceof I.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof I.HTMLIFrameElement||t instanceof I.HTMLObjectElement||t instanceof I.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}hr.prototype.options_={pauseOnOpen:!0,temporary:!0};$.registerComponent("ModalDialog",hr);class ir extends Pt{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})},Ts(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let n=0,r=this.length;n<r;n++)if(this[n]===e){t=this[n],t.off&&t.off(),this.tracks_.splice(n,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let n=0,r=this.length;n<r;n++){const i=this[n];if(i.id===e){t=i;break}}return t}}ir.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in ir.prototype.allowedEvents_)ir.prototype["on"+s]=null;const al=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 LA extends ir{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){al(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&al(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,al(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 ol=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 PA extends ir{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){ol(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&&ol(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,ol(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 lf extends ir{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class RA{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,n=e.length;t<n;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 n=0,r=this.trackElements_.length;n<r;n++)if(e===this.trackElements_[n].track){t=this.trackElements_[n];break}return t}removeTrackElement_(e){for(let t=0,n=this.trackElements_.length;t<n;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 Ma{constructor(e){Ma.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let n=0;const r=e.length;this.cues_=e,this.length_=e.length;const i=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<r)for(n=t;n<r;n++)i.call(this,n)}getCueById(e){let t=null;for(let n=0,r=this.length;n<r;n++){const i=this[n];if(i.id===e){t=i;break}}return t}}const DA={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},NA={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},OA={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ku={disabled:"disabled",hidden:"hidden",showing:"showing"};class Bc extends Pt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Bt(),kind:e.kind||"",language:e.language||""};let n=e.label||"";for(const r in t)Object.defineProperty(this,r,{get(){return t[r]},set(){}});Object.defineProperty(this,"label",{get(){return n},set(r){r!==n&&(n=r,this.trigger("labelchange"))}})}}const Fc=function(s){return new URL(s,X.baseURI)},cf=function(s){return new URL(s,X.baseURI).href},jc=function(s){if(typeof s=="string"){const e=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(s);if(e)return e.pop().toLowerCase()}return""},bo=function(s,e=I.location){return Fc(s).origin!==e.origin};var MA=Object.freeze({__proto__:null,parseUrl:Fc,getAbsoluteURL:cf,getFileExtension:jc,isCrossOrigin:bo});const Qu=function(s,e){const t=new I.WebVTT.Parser(I,I.vttjs,I.WebVTT.StringDecoder()),n=[];t.oncue=function(r){e.addCue(r)},t.onparsingerror=function(r){n.push(r)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),n.length>0&&(I.console&&I.console.groupCollapsed&&I.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),n.forEach(r=>fe.error(r)),I.console&&I.console.groupEnd&&I.console.groupEnd()),t.flush()},Ju=function(s,e){const t={uri:s},n=bo(s);n&&(t.cors=n);const r=e.tech_.crossOrigin()==="use-credentials";r&&(t.withCredentials=r),Cp(t,Le(this,function(i,a,o){if(i)return fe.error(i,a);e.loaded_=!0,typeof I.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],c=>{if(c.type==="vttjserror"){fe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Qu(o,e)}):Qu(o,e)}))};class vi extends Bc{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=we(e,{kind:OA[e.kind]||"subtitles",language:e.language||e.srclang||""});let n=Ku[t.mode]||"disabled";const r=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(n="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const i=new Ma(this.cues_),a=new Ma(this.activeCues_);let o=!1;this.timeupdateHandler=Le(this,function(h={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),h.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const c=()=>{this.stopTracking()};this.tech_.one("dispose",c),n!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return r},set(){}},mode:{get(){return n},set(h){Ku[h]&&n!==h&&(n=h,!this.preload_&&n!=="disabled"&&this.cues.length===0&&Ju(this.src,this),this.stopTracking(),n!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?i:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const h=this.tech_.currentTime(),m=[];for(let _=0,T=this.cues.length;_<T;_++){const S=this.cues[_];S.startTime<=h&&S.endTime>=h&&m.push(S)}if(o=!1,m.length!==this.activeCues_.length)o=!0;else for(let _=0;_<m.length;_++)this.activeCues_.indexOf(m[_])===-1&&(o=!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")&&Ju(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 I.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 n=this.tech_.textTracks();for(let r=0;r<n.length;r++)n[r]!==this&&n[r].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const n=this.cues_[t];if(n===e||n.originalCue_&&n.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}vi.prototype.allowedEvents_={cuechange:"cuechange"};class df extends Bc{constructor(e={}){const t=we(e,{kind:NA[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"enabled",{get(){return n},set(r){typeof r!="boolean"||r===n||(n=r,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class uf extends Bc{constructor(e={}){const t=we(e,{kind:DA[e.kind]||""});super(t);let n=!1;Object.defineProperty(this,"selected",{get(){return n},set(r){typeof r!="boolean"||r===n||(n=r,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class ws extends Pt{constructor(e={}){super();let t;const n=new vi(e);this.kind=n.kind,this.src=n.src,this.srclang=n.language,this.label=n.label,this.default=n.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return n}}}),t=ws.NONE,n.addEventListener("loadeddata",()=>{t=ws.LOADED,this.trigger({type:"load",target:this})})}}ws.prototype.allowedEvents_={load:"load"};ws.NONE=0;ws.LOADING=1;ws.LOADED=2;ws.ERROR=3;const Ut={audio:{ListClass:LA,TrackClass:df,capitalName:"Audio"},video:{ListClass:PA,TrackClass:uf,capitalName:"Video"},text:{ListClass:lf,TrackClass:vi,capitalName:"Text"}};Object.keys(Ut).forEach(function(s){Ut[s].getterName=`${s}Tracks`,Ut[s].privateName=`${s}Tracks_`});const ar={remoteText:{ListClass:lf,TrackClass:vi,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:RA,TrackClass:ws,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},gt=Object.assign({},Ut,ar);ar.names=Object.keys(ar);Ut.names=Object.keys(Ut);gt.names=[].concat(ar.names).concat(Ut.names);function UA(s,e,t,n,r={}){const i=s.textTracks();r.kind=e,t&&(r.label=t),n&&(r.language=n),r.tech=s;const a=new gt.text.TrackClass(r);return i.addTrack(a),a}class pe extends ${constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=n=>this.onDurationChange(n),this.trackProgress_=n=>this.trackProgress(n),this.trackCurrentTime_=n=>this.trackCurrentTime(n),this.stopTrackingCurrentTime_=n=>this.stopTrackingCurrentTime(n),this.disposeSourceHandler_=n=>this.disposeSourceHandler(n),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),gt.names.forEach(n=>{const r=gt[n];e&&e[r.getterName]&&(this[r.privateName]=e[r.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(n=>{e[`native${n}Tracks`]===!1&&(this[`featuresNative${n}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 gt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Le(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Ht(0,0)}bufferedPercent(){return of(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(Ut.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const n=this[`${t}Tracks`]()||[];let r=n.length;for(;r--;){const i=n[r];t==="text"&&this.removeRemoteTextTrack(i),n.removeTrack(i)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const n=e[t];this.removeRemoteTextTrack(n)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new je(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Ht(0,0):Ht()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Ut.names.forEach(e=>{const t=Ut[e],n=()=>{this.trigger(`${e}trackchange`)},r=this[t.getterName]();r.addEventListener("removetrack",n),r.addEventListener("addtrack",n),this.on("dispose",()=>{r.removeEventListener("removetrack",n),r.removeEventListener("addtrack",n)})})}addWebVttScript_(){if(!I.WebVTT)if(X.body.contains(this.el())){if(!this.options_["vtt.js"]&&tr(fu)&&Object.keys(fu).length>0){this.trigger("vttjsloaded");return}const e=X.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}),I.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),n=o=>e.addTrack(o.track),r=o=>e.removeTrack(o.track);t.on("addtrack",n),t.on("removetrack",r),this.addWebVttScript_();const i=()=>this.trigger("texttrackchange"),a=()=>{i();for(let o=0;o<e.length;o++){const c=e[o];c.removeEventListener("cuechange",i),c.mode==="showing"&&c.addEventListener("cuechange",i)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",n),t.off("removetrack",r),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let o=0;o<e.length;o++)e[o].removeEventListener("cuechange",i)})}addTextTrack(e,t,n){if(!e)throw new Error("TextTrack kind is required but was not provided");return UA(this,e,t,n)}createRemoteTextTrack(e){const t=we(e,{tech:this});return new ar.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const n=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(n),this.remoteTextTracks().addTrack(n.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(n.track)),n}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=Bt();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 pe.canPlayType(e.type)}static isTech(e){return e.prototype instanceof pe||e instanceof pe||e===pe}static registerTech(e,t){if(pe.techs_||(pe.techs_={}),!pe.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!pe.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!pe.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Ve(e),pe.techs_[e]=t,pe.techs_[si(e)]=t,e!=="Tech"&&pe.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(pe.techs_&&pe.techs_[e])return pe.techs_[e];if(e=Ve(e),I&&I.videojs&&I.videojs[e])return fe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),I.videojs[e]}}}gt.names.forEach(function(s){const e=gt[s];pe.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});pe.prototype.featuresVolumeControl=!0;pe.prototype.featuresMuteControl=!0;pe.prototype.featuresFullscreenResize=!1;pe.prototype.featuresPlaybackRate=!1;pe.prototype.featuresProgressEvents=!1;pe.prototype.featuresSourceset=!1;pe.prototype.featuresTimeupdateEvents=!1;pe.prototype.featuresNativeTextTracks=!1;pe.prototype.featuresVideoFrameCallback=!1;pe.withSourceHandlers=function(s){s.registerSourceHandler=function(e,t){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),t===void 0&&(t=n.length),n.splice(t,0,e)},s.canPlayType=function(e){const t=s.sourceHandlers||[];let n;for(let r=0;r<t.length;r++)if(n=t[r].canPlayType(e),n)return n;return""},s.selectSourceHandler=function(e,t){const n=s.sourceHandlers||[];let r;for(let i=0;i<n.length;i++)if(r=n[i].canHandleSource(e,t),r)return n[i];return null},s.canPlaySource=function(e,t){const n=s.selectSourceHandler(e,t);return n?n.canHandleSource(e,t):""},["seekable","seeking","duration"].forEach(function(e){const t=this[e];typeof t=="function"&&(this[e]=function(){return this.sourceHandler_&&this.sourceHandler_[e]?this.sourceHandler_[e].apply(this.sourceHandler_,arguments):t.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(e){let t=s.selectSourceHandler(e,this.options_);t||(s.nativeSourceHandler?t=s.nativeSourceHandler:fe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),t!==s.nativeSourceHandler&&(this.currentSource_=e),this.sourceHandler_=t.handleSource(e,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)}};$.registerComponent("Tech",pe);pe.registerTech("Tech",pe);pe.defaultTechOrder_=[];const un={},Ua={},Ba={};function BA(s,e){un[s]=un[s]||[],un[s].push(e)}function FA(s,e,t){s.setTimeout(()=>sn(e,un[e.type],t,s),1)}function jA(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function qA(s,e,t){return s.reduceRight(qc(t),e[t]())}function VA(s,e,t,n){return e[t](s.reduce(qc(t),n))}function Zu(s,e,t,n=null){const r="call"+Ve(t),i=s.reduce(qc(r),n),a=i===Ba,o=a?null:e[t](i);return WA(s,t,o,a),o}const $A={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},HA={setCurrentTime:1,setMuted:1,setVolume:1},eh={play:1,pause:1};function qc(s){return(e,t)=>e===Ba?Ba:t[s]?t[s](e):e}function WA(s,e,t,n){for(let r=s.length-1;r>=0;r--){const i=s[r];i[e]&&i[e](n,t)}}function zA(s){Ua.hasOwnProperty(s.id())&&delete Ua[s.id()]}function GA(s,e){const t=Ua[s.id()];let n=null;if(t==null)return n=e(s),Ua[s.id()]=[[e,n]],n;for(let r=0;r<t.length;r++){const[i,a]=t[r];i===e&&(n=a)}return n===null&&(n=e(s),t.push([e,n])),n}function sn(s={},e=[],t,n,r=[],i=!1){const[a,...o]=e;if(typeof a=="string")sn(s,un[a],t,n,r,i);else if(a){const c=GA(n,a);if(!c.setSource)return r.push(c),sn(s,o,t,n,r,i);c.setSource(Object.assign({},s),function(h,m){if(h)return sn(s,o,t,n,r,i);r.push(c),sn(m,s.type===m.type?o:un[m.type],t,n,r,i)})}else o.length?sn(s,o,t,n,r,i):i?t(s,r):sn(s,un["*"],t,n,r,!0)}const XA={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"},Fa=function(s=""){const e=jc(s);return XA[e.toLowerCase()]||""},YA=(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 n=s.$$("source");for(let r=0;r<n.length;r++){const i=n[r];if(i.type&&i.src&&i.src===e)return i.type}return Fa(e)},hf=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=hf(t),Array.isArray(t)?e=e.concat(t):os(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[th({src:s})]:os(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[th(s)]:s=[];return s};function th(s){if(!s.type){const e=Fa(s.src);e&&(s.type=e)}return s}var KA=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
29
29
|
<defs>
|
|
30
30
|
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
31
31
|
<path d="M16 10v28l22-14z"></path>
|
|
@@ -167,8 +167,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
167
167
|
<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>
|
|
168
168
|
</symbol>
|
|
169
169
|
</defs>
|
|
170
|
-
</svg>`;const Ju=Ra?10009:Da?461:8,Pn={codes:{play:415,pause:19,ff:417,rw:412,back:Ju},names:{415:"play",19:"pause",417:"ff",412:"rw",[Ju]:"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}},eh=5;class GA extends Pt{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 n=t.key.substring(5).toLowerCase();this.move(n)}else if(Pn.isEventKey(t,"play")||Pn.isEventKey(t,"pause")||Pn.isEventKey(t,"ff")||Pn.isEventKey(t,"rw")){t.preventDefault();const n=Pn.getEventName(t);this.performMediaAction_(n)}else Pn.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()+eh);break;case"rw":this.userSeek_(this.player_.currentTime()-eh);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 n=null;const r=this.getCurrentComponent(e.target);t&&(n=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!n||!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 n(r){for(const i of r)i.hasOwnProperty("el_")&&i.getIsFocusable()&&i.getIsAvailableToBeFocused(i.el())&&t.push(i),i.hasOwnProperty("children_")&&i.children_.length>0&&n(i.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?n(r.children_):r.hasOwnProperty("items")&&r.items.length>0?n(r.items):this.findSuitableDOMChild(r)&&t.push(r);if(r.name_==="ErrorDisplay"&&r.opened_){const i=r.el_.querySelector(".vjs-errors-ok-button-container");i&&i.querySelectorAll("button").forEach((a,o)=>{t.push({name:()=>"ModalButton"+(o+1),el:()=>a,getPositions:()=>{const c=a.getBoundingClientRect(),h={x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left},m={x:c.left+c.width/2,y:c.top+c.height/2,width:0,height:0,top:c.top+c.height/2,right:c.left+c.width/2,bottom:c.top+c.height/2,left:c.left+c.width/2};return{boundingClientRect:h,center:m}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:c=>!0,focus:()=>a.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(n){if(e.getIsFocusable(n)&&e.getIsAvailableToBeFocused(n))return n;for(let r=0;r<n.children.length;r++){const i=n.children[r],a=t(i);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 n of this.focusableComponents)if(n.el()===t)return n}}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 n=t.getPositions(),r=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(n.boundingClientRect,a.getPositions().boundingClientRect,e)),i=this.findBestCandidate_(n.center,r,e);i?this.focus(i):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,n){let r=1/0,i=null;for(const a of t){const o=a.getPositions().center,c=this.calculateDistance_(e,o,n);c<r&&(r=c,i=a)}return i}isInDirection_(e,t,n){switch(n){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,n){const r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);let a;switch(n){case"right":case"left":a=r+i*100;break;case"up":a=i*2+r*.5;break;case"down":a=i*5+r;break;default:a=r+i}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class XA extends ${constructor(e,t,n){const r=we({createEl:!1},t);if(super(e,r,n),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let i=0,a=t.playerOptions.techOrder;i<a.length;i++){const o=Ve(a[i]);let c=de.getTech(o);if(o||(c=$.getComponent(o)),c&&c.isSupported()){e.loadTech_(o);break}}else e.src(t.playerOptions.sources)}}$.registerComponent("MediaLoader",XA);class To extends ${constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=n=>this.handleMouseOver(n),this.handleMouseOut_=n=>this.handleMouseOut(n),this.handleClick_=n=>this.handleClick(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.emitTapEvents(),this.enable()}createEl(e="div",t={},n={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&pe.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),n=Object.assign({role:"button"},n),this.tabIndex_=t.tabIndex;const r=ae(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=ae("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 n=this.localize(e);this.controlText_=e,zs(this.controlTextEl_,n),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",n)}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)}}$.registerComponent("ClickableComponent",To);class Ul extends To{constructor(e,t){super(e,t),this.update(),this.update_=n=>this.update(n),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return ae("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(ae("picture",{className:"vjs-poster",tabIndex:-1},{},ae("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()?ts(this.player_.play()):this.player_.pause())}}Ul.prototype.crossorigin=Ul.prototype.crossOrigin;$.registerComponent("PosterImage",Ul);const Ot="#222",th="#ccc",YA={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 ll(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 Qt(s,e,t){try{s.style[e]=t}catch{return}}function sh(s){return s?`${s}px`:""}class KA extends ${constructor(e,t,n){super(e,t,n);const r=a=>this.updateDisplay(a),i=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",r),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Le(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",i),e.on("playerresize",i);const a=I.screen.orientation||I,o=I.screen.orientation?"change":"orientationchange";a.addEventListener(o,i),e.on("dispose",()=>a.removeEventListener(o,i));const c=this.options_.playerOptions.tracks||[];for(let h=0;h<c.length;h++)this.player_.addRemoteTextTrack(c[h],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),n=this.player_.cache_.selectedLanguage;let r,i,a;for(let o=0;o<t.length;o++){const c=t[o];n&&n.enabled&&n.language&&n.language===c.language&&c.kind in e?c.kind===n.kind?a=c:a||(a=c):n&&!n.enabled?(a=null,r=null,i=null):c.default&&(c.kind==="descriptions"&&!r?r=c:c.kind in e&&!i&&(i=c))}a?a.mode="showing":i?i.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 I.WebVTT=="function"&&I.WebVTT.processCues(I,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let o=0;o<e.length;++o){const c=e[o];c.mode==="showing"&&a.push(c)}this.updateForTrack(a);return}let n=null,r=null,i=e.length;for(;i--;){const a=e[i];a.mode==="showing"&&(a.kind==="descriptions"?n=a:r=a)}if(r?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(r)):n&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(n)),!I.CSS.supports("inset","10px")){const a=this.el_,o=a.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,h=this.player_.el_.getBoundingClientRect().height;a.style="",Qt(a,"position","relative"),Qt(a,"height",h-c+"px"),Qt(a,"top","unset"),Na?Qt(a,"bottom",h+"px"):Qt(a,"bottom","0px"),o.length>0&&o.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()||!I.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),n=e/t,r=this.player_.videoWidth()/this.player_.videoHeight();let i=0,a=0;Math.abs(n-r)>.1&&(n>r?i=Math.round((e-t*r)/2):a=Math.round((t-e/r)/2)),Qt(this.el_,"insetInline",sh(i)),Qt(this.el_,"insetBlock",sh(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),n=e.activeCues;let r=n.length;for(;r--;){const i=n[r];if(!i)continue;const a=i.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Qt(a.firstChild,"color",ll(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Qt(a.firstChild,"backgroundColor",ll(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Qt(a,"backgroundColor",ll(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Ot}, 2px 2px 4px ${Ot}, 2px 2px 5px ${Ot}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Ot}, 2px 2px ${Ot}, 3px 3px ${Ot}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${th}, 0 1px ${th}, -1px -1px ${Ot}, 0 -1px ${Ot}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Ot}, 0 0 4px ${Ot}, 0 0 4px ${Ot}, 0 0 4px ${Ot}`)),t.fontPercent&&t.fontPercent!==1){const o=I.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=YA[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof I.WebVTT!="function"||e.every(n=>!n.activeCues))return;const t=[];for(let n=0;n<e.length;++n){const r=e[n];for(let i=0;i<r.activeCues.length;++i)t.push(r.activeCues[i])}I.WebVTT.processCues(I,t,this.el_);for(let n=0;n<e.length;++n){const r=e[n];for(let i=0;i<r.activeCues.length;++i){const a=r.activeCues[i].displayState;dn(a,"vjs-text-track-cue","vjs-text-track-cue-"+(r.language?r.language:n)),r.language&&sr(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}$.registerComponent("TextTrackDisplay",KA);class QA extends ${createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),n=ae("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(n),r}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}$.registerComponent("LoadingSpinner",QA);class lt extends To{createEl(e,t={},n={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),n=Object.assign({type:"button"},n);const r=ae(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const n=this.constructor.name;return pe.warn(`Adding an actionable (user controllable) child to a Button (${n}) is not supported; use a ClickableComponent instead.`),$.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)}}$.registerComponent("Button",lt);class pf extends lt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",n=>this.handleMouseDown(n))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){ts(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const i=()=>r.focus();ni(t)?t.then(i,()=>{}):this.setTimeout(i,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}pf.prototype.controlText_="Play Video";$.registerComponent("BigPlayButton",pf);class ZA 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)}}$.registerComponent("CloseButton",ZA);class mf extends lt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",n=>this.handlePlay(n)),this.on(e,"pause",n=>this.handlePause(n)),t.replay&&this.on(e,"ended",n=>this.handleEnded(n))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?ts(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))}}mf.prototype.controlText_="Play";$.registerComponent("PlayToggle",mf);class pr extends ${constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],n=>this.update(n)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),n=ae("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(n),this.contentEl_=ae("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=fn(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,pe.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_=Y.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}pr.prototype.labelText_="Time";pr.prototype.controlText_="Time";$.registerComponent("TimeDisplay",pr);class Vc extends pr{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Vc.prototype.labelText_="Current Time";Vc.prototype.controlText_="Current Time";$.registerComponent("CurrentTimeDisplay",Vc);class $c extends pr{constructor(e,t){super(e,t);const n=r=>this.updateContent(r);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}$c.prototype.labelText_="Duration";$c.prototype.controlText_="Duration";$.registerComponent("DurationDisplay",$c);class JA extends ${createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),n=super.createEl("span",{textContent:"/"});return t.appendChild(n),e.appendChild(t),e}}$.registerComponent("TimeDivider",JA);class Hc extends pr{constructor(e,t){super(e,t),this.on(e,"durationchange",n=>this.updateContent(n))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(ae("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)}}Hc.prototype.labelText_="Remaining Time";Hc.prototype.controlText_="Remaining Time";$.registerComponent("RemainingTimeDisplay",Hc);class eS extends ${constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",n=>this.updateShowing(n))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=ae("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(ae("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(Y.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()}}$.registerComponent("LiveDisplay",eS);class ff extends lt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=n=>this.updateLiveEdgeStatus(n),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_=ae("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()}}ff.prototype.controlText_="Seek to live, currently playing live";$.registerComponent("SeekToLive",ff);function bi(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var tS=Object.freeze({__proto__:null,clamp:bi});class Wc extends ${constructor(e,t){super(e,t),this.handleMouseDown_=n=>this.handleMouseDown(n),this.handleMouseUp_=n=>this.handleMouseUp(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.handleClick_=n=>this.handleClick(n),this.handleMouseMove_=n=>this.handleMouseMove(n),this.update_=n=>this.update(n),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={},n={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,t,n)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ls&&e.preventDefault(),qm(),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;Vm(),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(bi(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=fo(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,n=t&&t.enabled,r=t&&t.horizontalSeek;n?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()):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")}}$.registerComponent("Slider",Wc);const cl=(s,e)=>bi(s/e*100,0,100).toFixed(2)+"%";class sS extends ${constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",n=>this.update(n))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=ae("span",{className:"vjs-control-text"}),n=ae("span",{textContent:this.localize("Loaded")}),r=Y.createTextNode(": ");return this.percentageEl_=ae("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(n),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,n=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),a=this.partEls_,o=cl(i,r);this.percent_!==o&&(this.el_.style.width=o,zs(this.percentageEl_,o),this.percent_=o);for(let c=0;c<n.length;c++){const h=n.start(c),m=n.end(c);let _=a[c];_||(_=this.el_.appendChild(ae()),a[c]=_),!(_.dataset.start===h&&_.dataset.end===m)&&(_.dataset.start=h,_.dataset.end=m,_.style.left=cl(h,i),_.style.width=cl(m-h,i))}for(let c=a.length;c>n.length;c--)this.el_.removeChild(a[c-1]);a.length=n.length})}}$.registerComponent("LoadProgressBar",sS);class nS extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,n){const r=ui(this.el_),i=nr(this.player_.el()),a=e.width*t;if(!i||!r)return;let o=e.left-i.left+a,c=e.width-a+(i.right-e.right);c||(c=e.width-a,o=a);let h=r.width/2;o<h?h+=h-o:c<h&&(h=c),h<0?h=0:h>r.width&&(h=r.width),h=Math.round(h),this.el_.style.right=`-${h}px`,this.write(n)}write(e){zs(this.el_,e)}updateTime(e,t,n,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let i;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),c=o-t*o;i=(c<1?"":"-")+fn(c,o)}else i=fn(n,a);this.update(e,t,i),r&&r()})}}$.registerComponent("TimeTooltip",nS);class zc extends ${constructor(e,t){super(e,t),this.setIcon("circle"),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const n=this.getChild("timeTooltip");if(!n)return;const r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,r)}}zc.prototype.options_={children:[]};!at&&!Wt&&zc.prototype.options_.children.push("timeTooltip");$.registerComponent("PlayProgressBar",zc);class gf extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,()=>{this.el_.style.left=`${e.width*t}px`})}}gf.prototype.options_={children:["timeTooltip"]};$.registerComponent("MouseTimeDisplay",gf);const ra=5,nh=12;class Ao extends Wc{constructor(e,t){t=we(Ao.prototype.options_,t),t.children=[...t.children];const n=e.options_.disableSeekWhileScrubbingOnMobile&&(at||Wt);(!at&&!Wt||n)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=n,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Le(this,this.update),this.update=cs(this.update_,Ft),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 Y&&"visibilityState"in Y&&this.on(Y,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){Y.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,Ft))}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(Y.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const n=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let i=this.player_.duration();r&&r.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==n||this.duration_!==i)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[fn(n,i),fn(i,i)],"{1} of {2}")),this.currentTime_=n,this.duration_=i),this.bar&&this.bar.update(nr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();const e=this.getCurrentTime_();let t;const n=this.player_.liveTracker;return n&&n.isLive()?(t=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){hi(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!hi(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let n;const r=this.calculateDistance(e),i=this.player_.liveTracker;if(!i||!i.isLive())n=r*this.player_.duration(),n===this.player_.duration()&&(n=n-.1);else{if(r>=.99){i.seekToLiveEdge();return}const a=i.seekableStart(),o=i.liveCurrentTime();if(n=a+r*i.liveWindow(),n>=o&&(n=o),n<=a&&(n=a+.1),n===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=n:this.userSeek_(n),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_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?ts(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+ra)}stepBack(){this.userSeek_(this.player_.currentTime()-ra)}handleAction(e){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 n=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-ra*nh)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+ra*nh)):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 Y&&"visibilityState"in Y&&this.off(Y,"visibilitychange",this.toggleVisibility_),super.dispose()}}Ao.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};$.registerComponent("SeekBar",Ao);class yf extends ${constructor(e,t){super(e,t),this.handleMouseMove=cs(Le(this,this.handleMouseMove),Ft),this.throttledHandleMouseSeek=cs(Le(this,this.handleMouseSeek),Ft),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.handleMouseDownHandler_=n=>this.handleMouseDown(n),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const n=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!n&&!r)return;const i=t.el(),a=ui(i);let o=fo(i,e).x;o=bi(o,0,1),r&&r.update(a,o),n&&n.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&&ts(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,n=this.getChild("seekBar");n&&n.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()}}yf.prototype.options_={children:["seekBar"]};$.registerComponent("ProgressControl",yf);class _f extends lt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],n=>this.handlePictureInPictureChange(n)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],n=>this.handlePictureInPictureEnabledChange(n)),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(){Y.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in I?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 Y.exitPictureInPicture=="function"&&super.show()}}_f.prototype.controlText_="Picture-in-Picture";$.registerComponent("PictureInPictureToggle",_f);class vf extends lt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",n=>this.handleFullscreenChange(n)),Y[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()}}vf.prototype.controlText_="Fullscreen";$.registerComponent("FullscreenToggle",vf);const rS=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 iS extends ${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}}$.registerComponent("VolumeLevel",iS);class aS extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,n,r){if(!n){const i=nr(this.el_),a=nr(this.player_.el()),o=e.width*t;if(!a||!i)return;const c=e.left-a.left+o,h=e.width-o+(a.right-e.right);let m=i.width/2;c<m?m+=m-c:h<m&&(m=h),m<0?m=0:m>i.width&&(m=i.width),this.el_.style.right=`-${m}px`}this.write(`${r}%`)}write(e){zs(this.el_,e)}updateVolume(e,t,n,r,i){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,n,r.toFixed(0)),i&&i()})}}$.registerComponent("VolumeLevelTooltip",aS);class bf extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,n){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,r,()=>{n?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}bf.prototype.options_={children:["volumeLevelTooltip"]};$.registerComponent("MouseVolumeLevelDisplay",bf);class So extends Wc{constructor(e,t){super(e,t),this.on("slideractive",n=>this.updateLastVolume_(n)),this.on(e,"volumechange",n=>this.updateARIAAttributes(n)),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){hi(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const n=this.el(),r=nr(n),i=this.vertical();let a=fo(n,e);a=i?a.y:a.x,a=bi(a,0,1),t.update(r,a,i)}hi(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)})}}So.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!at&&!Wt&&So.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");So.prototype.playerEvent="volumechange";$.registerComponent("VolumeBar",So);class Tf extends ${constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||tr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),rS(this,e),this.throttledHandleMouseMove=cs(Le(this,this.handleMouseMove),Ft),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.on("mousedown",n=>this.handleMouseDown(n)),this.on("touchstart",n=>this.handleMouseDown(n)),this.on("mousemove",n=>this.handleMouseMove(n)),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)}}Tf.prototype.options_={children:["volumeBar"]};$.registerComponent("VolumeControl",Tf);const oS=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 Af extends lt{constructor(e,t){super(e,t),oS(this,e),this.on(e,["loadstart","volumechange"],n=>this.update(n))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),n=this.player_.lastVolume_();if(t===0){const r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),at&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),po(this.el_,[0,1,2,3].reduce((n,r)=>n+`${r?" ":""}vjs-vol-${r}`,"")),dn(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Af.prototype.controlText_="Mute";$.registerComponent("MuteToggle",Af);class Sf extends ${constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||tr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=n=>this.handleKeyPress(n),this.on(e,["loadstart"],n=>this.volumePanelState_(n)),this.on(this.muteToggle,"keyup",n=>this.handleKeyPress(n)),this.on(this.volumeControl,"keyup",n=>this.handleVolumeControlKeyUp(n)),this.on("keydown",n=>this.handleKeyPress(n)),this.on("mouseover",n=>this.handleMouseOver(n)),this.on("mouseout",n=>this.handleMouseOut(n)),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"),Lt(Y,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ot(Y,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Sf.prototype.options_={children:["muteToggle","volumeControl"]};$.registerComponent("VolumePanel",Sf);class Ef 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(),n=this.player_.liveTracker,r=n&&n.isLive()?n.seekableEnd():this.player_.duration();let i;t+this.skipTime<=r?i=t+this.skipTime:i=r,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Ef.prototype.controlText_="Skip Forward";$.registerComponent("SkipForward",Ef);class wf 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(),n=this.player_.liveTracker,r=n&&n.isLive()&&n.seekableStart();let i;r&&t-this.skipTime<=r?i=r:t>=this.skipTime?i=t-this.skipTime:i=0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}wf.prototype.controlText_="Skip Backward";$.registerComponent("SkipBackward",wf);class kf extends ${constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",n=>this.handleKeyDown(n)),this.boundHandleBlur_=n=>this.handleBlur(n),this.boundHandleTapClick_=n=>this.handleTapClick(n)}addEventListenerForItem(e){e instanceof $&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof $&&(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_=ae(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_),Lt(t,"click",function(n){n.preventDefault(),n.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||Y.activeElement;if(!this.children().some(n=>n.el()===t)){const n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const n=t.filter(r=>r.el()===e.target)[0];if(!n)return;n.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())}}$.registerComponent("Menu",kf);class Gc extends ${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 n=lt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+n,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=i=>this.handleClick(i);this.handleMenuKeyUp_=i=>this.handleMenuKeyUp(i),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",i=>this.handleKeyDown(i)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Lt(Y,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",i=>this.handleMouseLeave(i)),this.on("keydown",i=>this.handleSubmenuKeyDown(i))}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 kf(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=ae("li",{className:"vjs-menu-title",textContent:Ve(this.options_.title),tabIndex:-1}),n=new $(this.player_,{el:t});e.addItem(n)}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"),ot(Y,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),at&&Mm())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()}}$.registerComponent("MenuButton",Gc);class Xc extends Gc{constructor(e,t){const n=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!n)return;const r=Le(this,this.update);n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),n.addEventListener("labelchange",r),this.player_.on("ready",r),this.player_.on("dispose",function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r),n.removeEventListener("labelchange",r)})}}$.registerComponent("TrackButton",Xc);class Ti extends To{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,n){this.nonIconControl=!0;const r=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),n),i=ae("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?r.appendChild(i):r.replaceChild(i,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))}}$.registerComponent("MenuItem",Ti);class Ai extends Ti{constructor(e,t){const n=t.track,r=e.textTracks();t.label=n.label||n.language||"Unknown",t.selected=n.mode==="showing",super(e,t),this.track=n,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const i=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],i),r.addEventListener("change",i),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],i),r.removeEventListener("change",i),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof I.Event!="object")try{o=new I.Event("change")}catch{}o||(o=Y.createEvent("Event"),o.initEvent("change",!0,!0)),r.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,n=this.player_.textTracks();if(super.handleClick(e),!!n)for(let r=0;r<n.length;r++){const i=n[r];this.kinds.indexOf(i.kind)!==-1&&(i===t?i.mode!=="showing"&&(i.mode="showing"):i.mode!=="disabled"&&(i.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()}}$.registerComponent("TextTrackMenuItem",Ai);class Cf extends Ai{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 n=!0;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let n=!0;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}$.registerComponent("OffTextTrackMenuItem",Cf);class mr extends Xc{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ai){let n;this.label_&&(n=`${this.label_} off`),e.push(new Cf(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i<r.length;i++){const a=r[i];if(this.kinds_.indexOf(a.kind)>-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}$.registerComponent("TextTrackButton",mr);class If extends Ti{constructor(e,t){const n=t.track,r=t.cue,i=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=i&&i<r.endTime,super(e,t),this.track=n,this.cue=r}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}$.registerComponent("ChaptersTrackMenuItem",If);class Yc extends mr{constructor(e,t,n){super(e,t,n),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 n=e[t];if(n.kind===this.kind_)return n}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ve(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 n=0,r=t.length;n<r;n++){const i=t[n],a=new If(this.player_,{track:this.track_,cue:i});e.push(a)}return e}}Yc.prototype.kind_="chapters";Yc.prototype.controlText_="Chapters";$.registerComponent("ChaptersButton",Yc);class Kc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("audio-description");const r=e.textTracks(),i=Le(this,this.handleTracksChange);r.addEventListener("change",i),this.on("dispose",function(){r.removeEventListener("change",i)})}handleTracksChange(e){const t=this.player().textTracks();let n=!1;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(a.kind!==this.kind_&&a.mode==="showing"){n=!0;break}}n?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Kc.prototype.kind_="descriptions";Kc.prototype.controlText_="Descriptions";$.registerComponent("DescriptionsButton",Kc);class Qc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Qc.prototype.kind_="subtitles";Qc.prototype.controlText_="Subtitles";$.registerComponent("SubtitlesButton",Qc);class Zc extends Ai{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()}}$.registerComponent("CaptionSettingsMenuItem",Zc);class Jc extends mr{constructor(e,t,n){super(e,t,n),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 Zc(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Jc.prototype.kind_="captions";Jc.prototype.controlText_="Captions";$.registerComponent("CaptionsButton",Jc);class xf extends Ai{createEl(e,t,n){const r=super.createEl(e,t,n),i=r.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",r):i.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild(ae("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}$.registerComponent("SubsCapsMenuItem",xf);class ed extends mr{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(Ve(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 Zc(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,xf),e}}ed.prototype.kinds_=["captions","subtitles"];ed.prototype.controlText_="Subtitles";$.registerComponent("SubsCapsButton",ed);class Lf extends Ti{constructor(e,t){const n=t.track,r=e.audioTracks();t.label=n.label||n.language||"Unknown",t.selected=n.enabled,super(e,t),this.track=n,this.addClass(`vjs-${n.kind}-menu-item`);const i=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",i),this.on("dispose",()=>{r.removeEventListener("change",i)})}createEl(e,t,n){const r=super.createEl(e,t,n),i=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(i.appendChild(ae("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild(ae("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 n=0;n<t.length;n++){const r=t[n];r!==this.track&&(r.enabled=r===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}$.registerComponent("AudioTrackMenuItem",Lf);class Pf extends Xc{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 n=0;n<t.length;n++){const r=t[n];e.push(new Lf(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}Pf.prototype.controlText_="Audio Track";$.registerComponent("AudioTrackButton",Pf);class td extends Ti{constructor(e,t){const n=t.rate,r=parseFloat(n,10);t.label=n,t.selected=r===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=n,this.rate=r,this.on(e,"ratechange",i=>this.update(i))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}td.prototype.contentElType="button";$.registerComponent("PlaybackRateMenuItem",td);class Rf extends Gc{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",n=>this.updateVisibility(n)),this.on(e,"ratechange",n=>this.updateLabel(n)),this.on(e,"playbackrateschange",n=>this.handlePlaybackRateschange(n))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=ae("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 n=e.length-1;n>=0;n--)t.push(new td(this.player(),{rate:e[n]+"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")}}Rf.prototype.controlText_="Playback Rate";$.registerComponent("PlaybackRateMenuButton",Rf);class Df extends ${buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},n={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,n)}}$.registerComponent("Spacer",Df);class lS extends Df{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}$.registerComponent("CustomControlSpacer",lS);class Nf extends ${createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Nf.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};$.registerComponent("ControlBar",Nf);class Of extends hr{constructor(e,t){super(e,t),this.on(e,"error",n=>{this.open(n)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Of.prototype.options_=Object.assign({},hr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});$.registerComponent("ErrorDisplay",Of);class Mf extends ${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(),ae("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{const t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Bt()}`)+"-"+e[1].replace(/\W+/g,""),n=ae("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),n}))}}$.registerComponent("TextTrackSelect",Mf);class hn extends ${constructor(e,t={}){super(e,t);const n=ae("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(n);const r=this.options_.selects;for(const i of r){const a=this.options_.selectConfigs[i],o=a.className,c=a.id.replace("%s",this.options_.id_);let h=null;const m=`vjs_select_${Bt()}`;if(this.options_.type==="colors"){h=ae("span",{className:o});const T=ae("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});T.setAttribute("for",m),h.appendChild(T)}const _=new Mf(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:c});this.addChild(_),this.options_.type==="colors"&&(h.appendChild(_.el()),this.el().appendChild(h))}}createEl(){return ae("fieldset",{className:this.options_.className})}}$.registerComponent("TextTrackFieldset",hn);class Uf extends ${constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,r=new hn(e,{id_:n,legendId:`captions-text-legend-${n}`,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 i=new hn(e,{id_:n,legendId:`captions-background-${n}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(i);const a=new hn(e,{id_:n,legendId:`captions-window-${n}`,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 ae("div",{className:"vjs-track-settings-colors"})}}$.registerComponent("TextTrackSettingsColors",Uf);class Bf extends ${constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,r=new hn(e,{id_:n,legendId:`captions-font-size-${n}`,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 i=new hn(e,{id_:n,legendId:`captions-edge-style-${n}`,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(i);const a=new hn(e,{id_:n,legendId:`captions-font-family-${n}`,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 ae("div",{className:"vjs-track-settings-font"})}}$.registerComponent("TextTrackSettingsFont",Bf);class Ff extends ${constructor(e,t={}){super(e,t);const n=this.localize("restore all settings to the default values"),r=new lt(e,{controlText:n,className:"vjs-default-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Reset"),this.addChild(r);const i=new lt(e,{controlText:n,className:"vjs-done-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Done"),this.addChild(i)}createEl(){return ae("div",{className:"vjs-track-settings-controls"})}}$.registerComponent("TrackSettingsControls",Ff);const dl="vjs-text-track-settings",rh=["#000","Black"],ih=["#00F","Blue"],ah=["#0FF","Cyan"],oh=["#0F0","Green"],lh=["#F0F","Magenta"],ch=["#F00","Red"],dh=["#FFF","White"],uh=["#FF0","Yellow"],ul=["1","Opaque"],hl=["0.5","Semi-Transparent"],hh=["0","Transparent"],qs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[rh,dh,ch,oh,ih,uh,lh,ah],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ul,hl,hh],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[dh,rh,ch,oh,ih,uh,lh,ah],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:[ul,hl],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:[hh,hl,ul],className:"vjs-window-opacity vjs-opacity"}};qs.windowColor.options=qs.backgroundColor.options;function jf(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function cS(s,e){const t=s.options[s.options.selectedIndex].value;return jf(t,e)}function dS(s,e,t){if(e){for(let n=0;n<s.options.length;n++)if(jf(s.options[n].value,t)===e){s.selectedIndex=n;break}}}class uS extends hr{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=ae("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 Uf(e,{textTrackComponentid:this.id_,selectConfigs:qs,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const n=new Bf(e,{textTrackComponentid:this.id_,selectConfigs:qs,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(n);const r=new Ff(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()}),Fn(qs,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 xm(qs,(e,t,n)=>{const r=cS(this.$(t.selector),t.parser);return r!==void 0&&(e[n]=r),e},{})}setValues(e){Fn(qs,(t,n)=>{dS(this.$(t.selector),e[n],t.parser)})}setDefaults(){Fn(qs,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(I.localStorage.getItem(dl))}catch(t){pe.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?I.localStorage.setItem(dl,JSON.stringify(e)):I.localStorage.removeItem(dl)}catch(t){pe.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}$.registerComponent("TextTrackSettings",uS);class hS extends ${constructor(e,t){let n=t.ResizeObserver||I.ResizeObserver;t.ResizeObserver===null&&(n=!1);const r=we({createEl:!n,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||I.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Zm(()=>{this.resizeHandler()},100,!1,this),n?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const i=this.debouncedHandler_;let a=this.unloadListener_=function(){ot(this,"resize",i),ot(this,"unload",a),a=null};Lt(this.el_.contentWindow,"unload",a),Lt(this.el_.contentWindow,"resize",i)},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()}}$.registerComponent("ResizeManager",hS);const pS={trackingThreshold:20,liveTolerance:15};class mS extends ${constructor(e,t){const n=we(pS,t,{createEl:!1});super(e,n),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(I.performance.now().toFixed(4)),n=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;const r=this.liveCurrentTime(),i=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-i)>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_,Ft),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 n=e?e.length:0;for(;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let n=e?e.length:0;for(;n--;)t.push(e.start(n));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()}}$.registerComponent("LiveTracker",mS);class fS extends ${constructor(e,t){super(e,t),this.on("statechanged",n=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:ae("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Bt()}`}),description:ae("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Bt()}`})},ae("div",{className:"vjs-title-bar"},{},Lm(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const i=this.state[r],a=this.els[r],o=n[r];go(a),i&&zs(a,i),t&&(t.removeAttribute(o),i&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}$.registerComponent("TitleBar",fS);const gS={initialDisplay:4e3,position:[],takeFocus:!1};class yS extends lt{constructor(e,t){t=we(gS,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],n=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=ae("button",{},{type:"button",class:this.buildCSSClass()},ae("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()}}$.registerComponent("TransientButton",yS);const Bl=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),n=[];let r="";if(!t.length)return!1;for(let i=0;i<t.length;i++){const a=t[i].src;a&&n.indexOf(a)===-1&&n.push(a)}return n.length?(n.length===1&&(r=n[0]),s.triggerSourceset(r),!0):!1},_S=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=Y.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=Y.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",I.Element.prototype.appendChild.call(this,t),this.innerHTML}}),qf=(s,e)=>{let t={};for(let n=0;n<s.length&&(t=Object.getOwnPropertyDescriptor(s[n],e),!(t&&t.set&&t.get));n++);return t.enumerable=!0,t.configurable=!0,t},vS=s=>qf([s.el(),I.HTMLMediaElement.prototype,I.Element.prototype,_S],"innerHTML"),ph=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},n=vS(s),r=i=>(...a)=>{const o=i.apply(e,a);return Bl(s),o};["append","appendChild","insertAdjacentHTML"].forEach(i=>{e[i]&&(t[i]=e[i],e[i]=r(t[i]))}),Object.defineProperty(e,"innerHTML",we(n,{set:r(n.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(i=>{e[i]=t[i]}),Object.defineProperty(e,"innerHTML",n)},s.one("sourceset",e.resetSourceWatch_)},bS=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?cf(I.Element.prototype.getAttribute.call(this,"src")):""},set(s){return I.Element.prototype.setAttribute.call(this,"src",s),s}}),TS=s=>qf([s.el(),I.HTMLMediaElement.prototype,bS],"src"),AS=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=TS(s),n=e.setAttribute,r=e.load;Object.defineProperty(e,"src",we(t,{set:i=>{const a=t.set.call(e,i);return s.triggerSourceset(e.src),a}})),e.setAttribute=(i,a)=>{const o=n.call(e,i,a);return/src/i.test(i)&&s.triggerSourceset(e.src),o},e.load=()=>{const i=r.call(e);return Bl(s)||(s.triggerSourceset(""),ph(s)),i},e.currentSrc?s.triggerSourceset(e.currentSrc):Bl(s)||ph(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=n,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class se extends de{constructor(e,t){super(e,t);const n=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",n&&(this.el_.currentSrc!==n.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(n):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const i=this.el_.childNodes;let a=i.length;const o=[];for(;a--;){const c=i[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!r&&!this.el_.hasAttribute("crossorigin")&&bo(c.src)&&(r=!0)):o.push(c))}for(let c=0;c<o.length;c++)this.el_.removeChild(o[c])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&r&&pe.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
171
|
-
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(di||uo)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),se.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){AS(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const n=()=>{t=[];for(let i=0;i<e.length;i++){const a=e[i];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};n(),e.addEventListener("change",n),this.on("dispose",()=>e.removeEventListener("change",n));const r=()=>{for(let i=0;i<t.length;i++){const a=t[i];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",n),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",n),e.addEventListener("change",n),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach(r=>{this.el()[`${n}Tracks`].removeEventListener(r,this[`${n}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Ut[e],n=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!n||!n.addEventListener)return;const i={change:o=>{const c={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(c),e==="text"&&this[ar.remoteText.getterName]().trigger(c)},addtrack(o){r.addTrack(o.track)},removetrack(o){r.removeTrack(o.track)}},a=function(){const o=[];for(let c=0;c<r.length;c++){let h=!1;for(let m=0;m<n.length;m++)if(n[m]===r[c]){h=!0;break}h||o.push(r[c])}for(;o.length;)r.removeTrack(o.shift())};this[t.getterName+"Listeners_"]=i,Object.keys(i).forEach(o=>{const c=i[o];n.addEventListener(o,c),this.on("dispose",h=>n.removeEventListener(o,c))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Ut.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),se.disposeMediaElement(e),e=n}else{e=Y.createElement("video");const n=this.options_.tag&&js(this.options_.tag),r=we({},n);(!di||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Fm(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&sr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let n=0;n<t.length;n++){const r=t[n],i=this.options_[r];typeof i<"u"&&(i?sr(e,r,r):mo(e,r),e[r]=i)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let n=!1;const r=function(){n=!0};this.on("loadstart",r);const i=function(){n||this.trigger("loadstart")};this.on("loadedmetadata",i),this.ready(function(){this.off("loadstart",r),this.off("loadedmetadata",i),n||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(n){this.trigger(n)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ho?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){pe(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Wt&&ls&&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)ts(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 pe.error("Invalid source URL."),!1;const n={src:e};t&&(n.type=t);const r=ae("source",{},n);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return pe.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const n of t)if(n.src===e)return this.el_.removeChild(n),!0;return pe.warn(`No matching source element found with src: ${e}`),!1}reset(){se.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):super.addTextTrack(e,t,n)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=Y.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 n=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let n=t.length;for(;n--;)(e===t[n]||e===t[n].track)&&this.el().removeChild(t[n])}}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),I.performance&&(e.creationTime=I.performance.now()),e}}oo(se,"TEST_VID",function(){if(!cr())return;const s=Y.createElement("video"),e=Y.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});se.isSupported=function(){try{se.TEST_VID.volume=.5}catch{return!1}return!!(se.TEST_VID&&se.TEST_VID.canPlayType)};se.canPlayType=function(s){return se.TEST_VID.canPlayType(s)};se.canPlaySource=function(s,e){return se.canPlayType(s.type)};se.canControlVolume=function(){try{const s=se.TEST_VID.volume;se.TEST_VID.volume=s/2+.1;const e=s!==se.TEST_VID.volume;return e&&at?(I.setTimeout(()=>{se&&se.prototype&&(se.prototype.featuresVolumeControl=s!==se.TEST_VID.volume)}),!1):e}catch{return!1}};se.canMuteVolume=function(){try{const s=se.TEST_VID.muted;return se.TEST_VID.muted=!s,se.TEST_VID.muted?sr(se.TEST_VID,"muted","muted"):mo(se.TEST_VID,"muted","muted"),s!==se.TEST_VID.muted}catch{return!1}};se.canControlPlaybackRate=function(){if(Wt&&ls&&lo<58)return!1;try{const s=se.TEST_VID.playbackRate;return se.TEST_VID.playbackRate=s/2+.1,s!==se.TEST_VID.playbackRate}catch{return!1}};se.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(Y.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(Y.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(Y.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(Y.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};se.supportsNativeTextTracks=function(){return ho||at&&ls};se.supportsNativeVideoTracks=function(){return!!(se.TEST_VID&&se.TEST_VID.videoTracks)};se.supportsNativeAudioTracks=function(){return!!(se.TEST_VID&&se.TEST_VID.audioTracks)};se.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]){oo(se.prototype,s,()=>se[e](),!0)});se.prototype.featuresVolumeControl=se.canControlVolume();se.prototype.movingMediaElementInDOM=!at;se.prototype.featuresFullscreenResize=!0;se.prototype.featuresProgressEvents=!0;se.prototype.featuresTimeupdateEvents=!0;se.prototype.featuresVideoFrameCallback=!!(se.TEST_VID&&se.TEST_VID.requestVideoFrameCallback);se.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{}}()}};se.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){se.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){se.prototype["set"+Ve(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){se.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){se.prototype["set"+Ve(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){se.prototype[s]=function(){return this.el_[s]()}});de.withSourceHandlers(se);se.nativeSourceHandler={};se.nativeSourceHandler.canPlayType=function(s){try{return se.TEST_VID.canPlayType(s)}catch{return""}};se.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return se.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=jc(s.src);return se.nativeSourceHandler.canPlayType(`video/${t}`)}return""};se.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};se.nativeSourceHandler.dispose=function(){};se.registerSourceHandler(se.nativeSourceHandler);de.registerTech("Html5",se);const Vf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],pl={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Fl=["tiny","xsmall","small","medium","large","xlarge","huge"],ca={};Fl.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;ca[s]=`vjs-layout-${e}`});const SS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ne extends ${constructor(e,t,n){if(e.id=e.id||t.id||`vjs_video_${Bt()}`,t=Object.assign(Ne.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,n),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=Cm(this.id_),this.fsApi_=xa,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&&js(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ne.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(),Mc(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Lt(Y,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=we(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const a=new I.DOMParser().parseFromString(zA,"image/svg+xml");if(a.querySelector("parsererror"))pe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const o=a.documentElement;o.style.display="none",this.el_.appendChild(o),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 GA(this),this.addClass("vjs-spatial-navigation-enabled")),di&&this.addClass("vjs-touch-enabled"),at||this.addClass("vjs-workinghover"),Ne.players[this.id_]=this;const i=xl.split(".")[0];this.addClass(`vjs-v${i}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),ot(Y,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ot(Y,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ne.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),VA(this),gt.names.forEach(e=>{const t=gt[e],n=this[t.getterName]();n&&n.off&&n.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,n=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";n?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const i=js(e);if(r){for(t=this.el_=e,e=this.tag=Y.createElement("video");t.children.length;)e.appendChild(t.firstChild);ti(t,"video-js")||dn(t,"video-js"),t.appendChild(e),n=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),i.tabindex="-1",ls&&co&&(e.setAttribute("role","application"),i.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in i&&delete i.width,"height"in i&&delete i.height,Object.getOwnPropertyNames(i).forEach(function(c){r&&c==="class"||t.setAttribute(c,i[c]),r&&e.setAttribute(c,i[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(c=>Om[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),I.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Km("vjs-styles-dimensions");const c=Hs(".vjs-styles-defaults"),h=Hs("head");h.insertBefore(this.styleEl_,c?c.nextSibling:h.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 o=e.getElementsByTagName("a");for(let c=0;c<o.length;c++){const h=o.item(c);dn(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!n&&e.parentNode.insertBefore(t,e),Pl(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"){pe.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 n=e+"_";if(t===void 0)return this[n]||0;if(t===""||t==="auto"){this[n]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){pe.error(`Improper value "${t}" supplied for for ${e}`);return}this[n]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Ts(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),_A(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(I.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,h=this.tech_&&this.tech_.el();h&&(o>=0&&(h.width=o),c>=0&&(h.height=c));return}let e,t,n,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?n=this.aspectRatio_:this.videoWidth()>0?n=this.videoWidth()+":"+this.videoHeight():n="16:9";const i=n.split(":"),a=i[1]/i[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),Qm(this.styleEl_,`
|
|
170
|
+
</svg>`;const sh=Ra?10009:Da?461:8,Pn={codes:{play:415,pause:19,ff:417,rw:412,back:sh},names:{415:"play",19:"pause",417:"ff",412:"rw",[sh]:"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}},nh=5;class QA extends Pt{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 n=t.key.substring(5).toLowerCase();this.move(n)}else if(Pn.isEventKey(t,"play")||Pn.isEventKey(t,"pause")||Pn.isEventKey(t,"ff")||Pn.isEventKey(t,"rw")){t.preventDefault();const n=Pn.getEventName(t);this.performMediaAction_(n)}else Pn.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()+nh);break;case"rw":this.userSeek_(this.player_.currentTime()-nh);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 n=null;const r=this.getCurrentComponent(e.target);t&&(n=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!n||!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 n(r){for(const i of r)i.hasOwnProperty("el_")&&i.getIsFocusable()&&i.getIsAvailableToBeFocused(i.el())&&t.push(i),i.hasOwnProperty("children_")&&i.children_.length>0&&n(i.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?n(r.children_):r.hasOwnProperty("items")&&r.items.length>0?n(r.items):this.findSuitableDOMChild(r)&&t.push(r);if(r.name_==="ErrorDisplay"&&r.opened_){const i=r.el_.querySelector(".vjs-errors-ok-button-container");i&&i.querySelectorAll("button").forEach((a,o)=>{t.push({name:()=>"ModalButton"+(o+1),el:()=>a,getPositions:()=>{const c=a.getBoundingClientRect(),h={x:c.x,y:c.y,width:c.width,height:c.height,top:c.top,right:c.right,bottom:c.bottom,left:c.left},m={x:c.left+c.width/2,y:c.top+c.height/2,width:0,height:0,top:c.top+c.height/2,right:c.left+c.width/2,bottom:c.top+c.height/2,left:c.left+c.width/2};return{boundingClientRect:h,center:m}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:c=>!0,focus:()=>a.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(n){if(e.getIsFocusable(n)&&e.getIsAvailableToBeFocused(n))return n;for(let r=0;r<n.children.length;r++){const i=n.children[r],a=t(i);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 n of this.focusableComponents)if(n.el()===t)return n}}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 n=t.getPositions(),r=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(n.boundingClientRect,a.getPositions().boundingClientRect,e)),i=this.findBestCandidate_(n.center,r,e);i?this.focus(i):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,n){let r=1/0,i=null;for(const a of t){const o=a.getPositions().center,c=this.calculateDistance_(e,o,n);c<r&&(r=c,i=a)}return i}isInDirection_(e,t,n){switch(n){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,n){const r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);let a;switch(n){case"right":case"left":a=r+i*100;break;case"up":a=i*2+r*.5;break;case"down":a=i*5+r;break;default:a=r+i}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class JA extends ${constructor(e,t,n){const r=we({createEl:!1},t);if(super(e,r,n),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let i=0,a=t.playerOptions.techOrder;i<a.length;i++){const o=Ve(a[i]);let c=pe.getTech(o);if(o||(c=$.getComponent(o)),c&&c.isSupported()){e.loadTech_(o);break}}else e.src(t.playerOptions.sources)}}$.registerComponent("MediaLoader",JA);class To extends ${constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=n=>this.handleMouseOver(n),this.handleMouseOut_=n=>this.handleMouseOut(n),this.handleClick_=n=>this.handleClick(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.emitTapEvents(),this.enable()}createEl(e="div",t={},n={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&fe.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),n=Object.assign({role:"button"},n),this.tabIndex_=t.tabIndex;const r=oe(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(oe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=oe("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 n=this.localize(e);this.controlText_=e,zs(this.controlTextEl_,n),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",n)}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)}}$.registerComponent("ClickableComponent",To);class Ul extends To{constructor(e,t){super(e,t),this.update(),this.update_=n=>this.update(n),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return oe("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(oe("picture",{className:"vjs-poster",tabIndex:-1},{},oe("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()?ts(this.player_.play()):this.player_.pause())}}Ul.prototype.crossorigin=Ul.prototype.crossOrigin;$.registerComponent("PosterImage",Ul);const Ot="#222",rh="#ccc",ZA={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 ll(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 Qt(s,e,t){try{s.style[e]=t}catch{return}}function ih(s){return s?`${s}px`:""}class eS extends ${constructor(e,t,n){super(e,t,n);const r=a=>this.updateDisplay(a),i=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",r),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Le(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",i),e.on("playerresize",i);const a=I.screen.orientation||I,o=I.screen.orientation?"change":"orientationchange";a.addEventListener(o,i),e.on("dispose",()=>a.removeEventListener(o,i));const c=this.options_.playerOptions.tracks||[];for(let h=0;h<c.length;h++)this.player_.addRemoteTextTrack(c[h],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),n=this.player_.cache_.selectedLanguage;let r,i,a;for(let o=0;o<t.length;o++){const c=t[o];n&&n.enabled&&n.language&&n.language===c.language&&c.kind in e?c.kind===n.kind?a=c:a||(a=c):n&&!n.enabled?(a=null,r=null,i=null):c.default&&(c.kind==="descriptions"&&!r?r=c:c.kind in e&&!i&&(i=c))}a?a.mode="showing":i?i.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 I.WebVTT=="function"&&I.WebVTT.processCues(I,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let o=0;o<e.length;++o){const c=e[o];c.mode==="showing"&&a.push(c)}this.updateForTrack(a);return}let n=null,r=null,i=e.length;for(;i--;){const a=e[i];a.mode==="showing"&&(a.kind==="descriptions"?n=a:r=a)}if(r?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(r)):n&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(n)),!I.CSS.supports("inset","10px")){const a=this.el_,o=a.querySelectorAll(".vjs-text-track-cue"),c=this.player_.controlBar.el_.getBoundingClientRect().height,h=this.player_.el_.getBoundingClientRect().height;a.style="",Qt(a,"position","relative"),Qt(a,"height",h-c+"px"),Qt(a,"top","unset"),Na?Qt(a,"bottom",h+"px"):Qt(a,"bottom","0px"),o.length>0&&o.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()||!I.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),n=e/t,r=this.player_.videoWidth()/this.player_.videoHeight();let i=0,a=0;Math.abs(n-r)>.1&&(n>r?i=Math.round((e-t*r)/2):a=Math.round((t-e/r)/2)),Qt(this.el_,"insetInline",ih(i)),Qt(this.el_,"insetBlock",ih(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),n=e.activeCues;let r=n.length;for(;r--;){const i=n[r];if(!i)continue;const a=i.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Qt(a.firstChild,"color",ll(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Qt(a.firstChild,"backgroundColor",ll(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Qt(a,"backgroundColor",ll(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Ot}, 2px 2px 4px ${Ot}, 2px 2px 5px ${Ot}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Ot}, 2px 2px ${Ot}, 3px 3px ${Ot}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${rh}, 0 1px ${rh}, -1px -1px ${Ot}, 0 -1px ${Ot}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Ot}, 0 0 4px ${Ot}, 0 0 4px ${Ot}, 0 0 4px ${Ot}`)),t.fontPercent&&t.fontPercent!==1){const o=I.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=ZA[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof I.WebVTT!="function"||e.every(n=>!n.activeCues))return;const t=[];for(let n=0;n<e.length;++n){const r=e[n];for(let i=0;i<r.activeCues.length;++i)t.push(r.activeCues[i])}I.WebVTT.processCues(I,t,this.el_);for(let n=0;n<e.length;++n){const r=e[n];for(let i=0;i<r.activeCues.length;++i){const a=r.activeCues[i].displayState;dn(a,"vjs-text-track-cue","vjs-text-track-cue-"+(r.language?r.language:n)),r.language&&sr(a,"lang",r.language)}this.player_.textTrackSettings&&this.updateDisplayState(r)}}}$.registerComponent("TextTrackDisplay",eS);class tS extends ${createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),n=oe("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(n),r}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}$.registerComponent("LoadingSpinner",tS);class lt extends To{createEl(e,t={},n={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),n=Object.assign({type:"button"},n);const r=oe(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(oe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(r),r}addChild(e,t={}){const n=this.constructor.name;return fe.warn(`Adding an actionable (user controllable) child to a Button (${n}) is not supported; use a ClickableComponent instead.`),$.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)}}$.registerComponent("Button",lt);class pf extends lt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",n=>this.handleMouseDown(n))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){ts(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const n=this.player_.getChild("controlBar"),r=n&&n.getChild("playToggle");if(!r){this.player_.tech(!0).focus();return}const i=()=>r.focus();ni(t)?t.then(i,()=>{}):this.setTimeout(i,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}pf.prototype.controlText_="Play Video";$.registerComponent("BigPlayButton",pf);class sS 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)}}$.registerComponent("CloseButton",sS);class mf extends lt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",n=>this.handlePlay(n)),this.on(e,"pause",n=>this.handlePause(n)),t.replay&&this.on(e,"ended",n=>this.handleEnded(n))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?ts(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))}}mf.prototype.controlText_="Play";$.registerComponent("PlayToggle",mf);class pr extends ${constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],n=>this.update(n)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),n=oe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(n),this.contentEl_=oe("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=fn(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,fe.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_=X.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}pr.prototype.labelText_="Time";pr.prototype.controlText_="Time";$.registerComponent("TimeDisplay",pr);class Vc extends pr{buildCSSClass(){return"vjs-current-time"}updateContent(e){let t;this.player_.ended()?t=this.player_.duration():t=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime(),this.updateTextNode_(t)}}Vc.prototype.labelText_="Current Time";Vc.prototype.controlText_="Current Time";$.registerComponent("CurrentTimeDisplay",Vc);class $c extends pr{constructor(e,t){super(e,t);const n=r=>this.updateContent(r);this.on(e,"durationchange",n),this.on(e,"loadstart",n),this.on(e,"loadedmetadata",n)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}$c.prototype.labelText_="Duration";$c.prototype.controlText_="Duration";$.registerComponent("DurationDisplay",$c);class nS extends ${createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),n=super.createEl("span",{textContent:"/"});return t.appendChild(n),e.appendChild(t),e}}$.registerComponent("TimeDivider",nS);class Hc extends pr{constructor(e,t){super(e,t),this.on(e,"durationchange",n=>this.updateContent(n))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(oe("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)}}Hc.prototype.labelText_="Remaining Time";Hc.prototype.controlText_="Remaining Time";$.registerComponent("RemainingTimeDisplay",Hc);class rS extends ${constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",n=>this.updateShowing(n))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=oe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(oe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(X.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()}}$.registerComponent("LiveDisplay",rS);class ff extends lt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=n=>this.updateLiveEdgeStatus(n),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_=oe("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()}}ff.prototype.controlText_="Seek to live, currently playing live";$.registerComponent("SeekToLive",ff);function bi(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var iS=Object.freeze({__proto__:null,clamp:bi});class Wc extends ${constructor(e,t){super(e,t),this.handleMouseDown_=n=>this.handleMouseDown(n),this.handleMouseUp_=n=>this.handleMouseUp(n),this.handleKeyDown_=n=>this.handleKeyDown(n),this.handleClick_=n=>this.handleClick(n),this.handleMouseMove_=n=>this.handleMouseMove(n),this.update_=n=>this.update(n),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={},n={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),n=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},n),super.createEl(e,t,n)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ls&&e.preventDefault(),qm(),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;Vm(),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(bi(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=fo(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,n=t&&t.enabled,r=t&&t.horizontalSeek;n?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()):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")}}$.registerComponent("Slider",Wc);const cl=(s,e)=>bi(s/e*100,0,100).toFixed(2)+"%";class aS extends ${constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",n=>this.update(n))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=oe("span",{className:"vjs-control-text"}),n=oe("span",{textContent:this.localize("Loaded")}),r=X.createTextNode(": ");return this.percentageEl_=oe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(n),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,n=this.player_.buffered(),r=t&&t.isLive()?t.seekableEnd():this.player_.duration(),i=this.player_.bufferedEnd(),a=this.partEls_,o=cl(i,r);this.percent_!==o&&(this.el_.style.width=o,zs(this.percentageEl_,o),this.percent_=o);for(let c=0;c<n.length;c++){const h=n.start(c),m=n.end(c);let _=a[c];_||(_=this.el_.appendChild(oe()),a[c]=_),!(_.dataset.start===h&&_.dataset.end===m)&&(_.dataset.start=h,_.dataset.end=m,_.style.left=cl(h,i),_.style.width=cl(m-h,i))}for(let c=a.length;c>n.length;c--)this.el_.removeChild(a[c-1]);a.length=n.length})}}$.registerComponent("LoadProgressBar",aS);class oS extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,n){const r=ui(this.el_),i=nr(this.player_.el()),a=e.width*t;if(!i||!r)return;let o=e.left-i.left+a,c=e.width-a+(i.right-e.right);c||(c=e.width-a,o=a);let h=r.width/2;o<h?h+=h-o:c<h&&(h=c),h<0?h=0:h>r.width&&(h=r.width),h=Math.round(h),this.el_.style.right=`-${h}px`,this.write(n)}write(e){zs(this.el_,e)}updateTime(e,t,n,r){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let i;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),c=o-t*o;i=(c<1?"":"-")+fn(c,o)}else i=fn(n,a);this.update(e,t,i),r&&r()})}}$.registerComponent("TimeTooltip",oS);class zc extends ${constructor(e,t){super(e,t),this.setIcon("circle"),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const n=this.getChild("timeTooltip");if(!n)return;const r=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();n.updateTime(e,t,r)}}zc.prototype.options_={children:[]};!at&&!Wt&&zc.prototype.options_.children.push("timeTooltip");$.registerComponent("PlayProgressBar",zc);class gf extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const n=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,n,()=>{this.el_.style.left=`${e.width*t}px`})}}gf.prototype.options_={children:["timeTooltip"]};$.registerComponent("MouseTimeDisplay",gf);const ra=5,ah=12;class Ao extends Wc{constructor(e,t){t=we(Ao.prototype.options_,t),t.children=[...t.children];const n=e.options_.disableSeekWhileScrubbingOnMobile&&(at||Wt);(!at&&!Wt||n)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=n,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Le(this,this.update),this.update=cs(this.update_,Ft),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 X&&"visibilityState"in X&&this.on(X,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){X.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,Ft))}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(X.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const n=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),r=this.player_.liveTracker;let i=this.player_.duration();r&&r.isLive()&&(i=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==n||this.duration_!==i)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[fn(n,i),fn(i,i)],"{1} of {2}")),this.currentTime_=n,this.duration_=i),this.bar&&this.bar.update(nr(this.el()),this.getProgress())}),t}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}getCurrentTime_(){return this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime()}getPercent(){if(this.pendingSeekTime_)return this.pendingSeekTime_/this.player_.duration();const e=this.getCurrentTime_();let t;const n=this.player_.liveTracker;return n&&n.isLive()?(t=(e-n.seekableStart())/n.liveWindow(),n.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){hi(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!hi(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let n;const r=this.calculateDistance(e),i=this.player_.liveTracker;if(!i||!i.isLive())n=r*this.player_.duration(),n===this.player_.duration()&&(n=n-.1);else{if(r>=.99){i.seekToLiveEdge();return}const a=i.seekableStart(),o=i.liveCurrentTime();if(n=a+r*i.liveWindow(),n>=o&&(n=o),n<=a&&(n=a+.1),n===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=n:this.userSeek_(n),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_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?ts(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+ra)}stepBack(){this.userSeek_(this.player_.currentTime()-ra)}handleAction(e){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 n=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*n):this.userSeek_(this.player_.duration()*n)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-ra*ah)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+ra*ah)):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 X&&"visibilityState"in X&&this.off(X,"visibilitychange",this.toggleVisibility_),super.dispose()}}Ao.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};$.registerComponent("SeekBar",Ao);class yf extends ${constructor(e,t){super(e,t),this.handleMouseMove=cs(Le(this,this.handleMouseMove),Ft),this.throttledHandleMouseSeek=cs(Le(this,this.handleMouseSeek),Ft),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.handleMouseDownHandler_=n=>this.handleMouseDown(n),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const n=t.getChild("playProgressBar"),r=t.getChild("mouseTimeDisplay");if(!n&&!r)return;const i=t.el(),a=ui(i);let o=fo(i,e).x;o=bi(o,0,1),r&&r.update(a,o),n&&n.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&&ts(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,n=this.getChild("seekBar");n&&n.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()}}yf.prototype.options_={children:["seekBar"]};$.registerComponent("ProgressControl",yf);class _f extends lt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],n=>this.handlePictureInPictureChange(n)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],n=>this.handlePictureInPictureEnabledChange(n)),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(){X.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in I?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 X.exitPictureInPicture=="function"&&super.show()}}_f.prototype.controlText_="Picture-in-Picture";$.registerComponent("PictureInPictureToggle",_f);class vf extends lt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",n=>this.handleFullscreenChange(n)),X[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()}}vf.prototype.controlText_="Fullscreen";$.registerComponent("FullscreenToggle",vf);const lS=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 cS extends ${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}}$.registerComponent("VolumeLevel",cS);class dS extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,n,r){if(!n){const i=nr(this.el_),a=nr(this.player_.el()),o=e.width*t;if(!a||!i)return;const c=e.left-a.left+o,h=e.width-o+(a.right-e.right);let m=i.width/2;c<m?m+=m-c:h<m&&(m=h),m<0?m=0:m>i.width&&(m=i.width),this.el_.style.right=`-${m}px`}this.write(`${r}%`)}write(e){zs(this.el_,e)}updateVolume(e,t,n,r,i){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,n,r.toFixed(0)),i&&i()})}}$.registerComponent("VolumeLevelTooltip",dS);class bf extends ${constructor(e,t){super(e,t),this.update=cs(Le(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,n){const r=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,n,r,()=>{n?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}bf.prototype.options_={children:["volumeLevelTooltip"]};$.registerComponent("MouseVolumeLevelDisplay",bf);class So extends Wc{constructor(e,t){super(e,t),this.on("slideractive",n=>this.updateLastVolume_(n)),this.on(e,"volumechange",n=>this.updateARIAAttributes(n)),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){hi(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const n=this.el(),r=nr(n),i=this.vertical();let a=fo(n,e);a=i?a.y:a.x,a=bi(a,0,1),t.update(r,a,i)}hi(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)})}}So.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!at&&!Wt&&So.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");So.prototype.playerEvent="volumechange";$.registerComponent("VolumeBar",So);class Tf extends ${constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||tr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),lS(this,e),this.throttledHandleMouseMove=cs(Le(this,this.handleMouseMove),Ft),this.handleMouseUpHandler_=n=>this.handleMouseUp(n),this.on("mousedown",n=>this.handleMouseDown(n)),this.on("touchstart",n=>this.handleMouseDown(n)),this.on("mousemove",n=>this.handleMouseMove(n)),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)}}Tf.prototype.options_={children:["volumeBar"]};$.registerComponent("VolumeControl",Tf);const uS=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 Af extends lt{constructor(e,t){super(e,t),uS(this,e),this.on(e,["loadstart","volumechange"],n=>this.update(n))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),n=this.player_.lastVolume_();if(t===0){const r=n<.1?.1:n;this.player_.volume(r),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),at&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),po(this.el_,[0,1,2,3].reduce((n,r)=>n+`${r?" ":""}vjs-vol-${r}`,"")),dn(this.el_,`vjs-vol-${t}`)}updateControlText_(){const e=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==e&&this.controlText(e)}}Af.prototype.controlText_="Mute";$.registerComponent("MuteToggle",Af);class Sf extends ${constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||tr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=n=>this.handleKeyPress(n),this.on(e,["loadstart"],n=>this.volumePanelState_(n)),this.on(this.muteToggle,"keyup",n=>this.handleKeyPress(n)),this.on(this.volumeControl,"keyup",n=>this.handleVolumeControlKeyUp(n)),this.on("keydown",n=>this.handleKeyPress(n)),this.on("mouseover",n=>this.handleMouseOver(n)),this.on("mouseout",n=>this.handleMouseOut(n)),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"),Lt(X,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),ot(X,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Sf.prototype.options_={children:["muteToggle","volumeControl"]};$.registerComponent("VolumePanel",Sf);class Ef 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(),n=this.player_.liveTracker,r=n&&n.isLive()?n.seekableEnd():this.player_.duration();let i;t+this.skipTime<=r?i=t+this.skipTime:i=r,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Ef.prototype.controlText_="Skip Forward";$.registerComponent("SkipForward",Ef);class wf 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(),n=this.player_.liveTracker,r=n&&n.isLive()&&n.seekableStart();let i;r&&t-this.skipTime<=r?i=r:t>=this.skipTime?i=t-this.skipTime:i=0,this.player_.currentTime(i)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}wf.prototype.controlText_="Skip Backward";$.registerComponent("SkipBackward",wf);class kf extends ${constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",n=>this.handleKeyDown(n)),this.boundHandleBlur_=n=>this.handleBlur(n),this.boundHandleTapClick_=n=>this.handleTapClick(n)}addEventListenerForItem(e){e instanceof $&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof $&&(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_=oe(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_),Lt(t,"click",function(n){n.preventDefault(),n.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||X.activeElement;if(!this.children().some(n=>n.el()===t)){const n=this.menuButton_;n&&n.buttonPressed_&&t!==n.el().firstChild&&n.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const n=t.filter(r=>r.el()===e.target)[0];if(!n)return;n.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())}}$.registerComponent("Menu",kf);class Gc extends ${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 n=lt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+n,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const r=i=>this.handleClick(i);this.handleMenuKeyUp_=i=>this.handleMenuKeyUp(i),this.on(this.menuButton_,"tap",r),this.on(this.menuButton_,"click",r),this.on(this.menuButton_,"keydown",i=>this.handleKeyDown(i)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),Lt(X,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",i=>this.handleMouseLeave(i)),this.on("keydown",i=>this.handleSubmenuKeyDown(i))}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 kf(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=oe("li",{className:"vjs-menu-title",textContent:Ve(this.options_.title),tabIndex:-1}),n=new $(this.player_,{el:t});e.addItem(n)}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"),ot(X,"keyup",this.handleMenuKeyUp_)}focus(){this.menuButton_.focus()}blur(){this.menuButton_.blur()}handleKeyDown(e){e.key==="Escape"||e.key==="Tab"?(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus())):(e.key==="Up"||e.key==="Down"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled))&&(this.buttonPressed_||(e.preventDefault(),this.pressButton()))}handleMenuKeyUp(e){(e.key==="Escape"||e.key==="Tab")&&this.removeClass("vjs-hover")}handleSubmenuKeyPress(e){this.handleSubmenuKeyDown(e)}handleSubmenuKeyDown(e){(e.key==="Escape"||e.key==="Tab")&&(this.buttonPressed_&&this.unpressButton(),!e.key==="Tab"&&(e.preventDefault(),this.menuButton_.focus()))}pressButton(){if(this.enabled_){if(this.buttonPressed_=!0,this.menu.show(),this.menu.lockShowing(),this.menuButton_.el_.setAttribute("aria-expanded","true"),at&&Mm())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()}}$.registerComponent("MenuButton",Gc);class Xc extends Gc{constructor(e,t){const n=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!n)return;const r=Le(this,this.update);n.addEventListener("removetrack",r),n.addEventListener("addtrack",r),n.addEventListener("labelchange",r),this.player_.on("ready",r),this.player_.on("dispose",function(){n.removeEventListener("removetrack",r),n.removeEventListener("addtrack",r),n.removeEventListener("labelchange",r)})}}$.registerComponent("TrackButton",Xc);class Ti extends To{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,n){this.nonIconControl=!0;const r=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),n),i=oe("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?r.appendChild(i):r.replaceChild(i,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))}}$.registerComponent("MenuItem",Ti);class Ai extends Ti{constructor(e,t){const n=t.track,r=e.textTracks();t.label=n.label||n.language||"Unknown",t.selected=n.mode==="showing",super(e,t),this.track=n,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const i=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};if(e.on(["loadstart","texttrackchange"],i),r.addEventListener("change",i),r.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],i),r.removeEventListener("change",i),r.removeEventListener("selectedlanguagechange",a)}),r.onchange===void 0){let o;this.on(["tap","click"],function(){if(typeof I.Event!="object")try{o=new I.Event("change")}catch{}o||(o=X.createEvent("Event"),o.initEvent("change",!0,!0)),r.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,n=this.player_.textTracks();if(super.handleClick(e),!!n)for(let r=0;r<n.length;r++){const i=n[r];this.kinds.indexOf(i.kind)!==-1&&(i===t?i.mode!=="showing"&&(i.mode="showing"):i.mode!=="disabled"&&(i.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()}}$.registerComponent("TextTrackMenuItem",Ai);class Cf extends Ai{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 n=!0;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){n=!1;break}}n!==this.isSelected_&&this.selected(n)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let n=!0;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){n=!1;break}}n&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}$.registerComponent("OffTextTrackMenuItem",Cf);class mr extends Xc{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Ai){let n;this.label_&&(n=`${this.label_} off`),e.push(new Cf(this.player_,{kinds:this.kinds_,kind:this.kind_,label:n})),this.hideThreshold_+=1;const r=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let i=0;i<r.length;i++){const a=r[i];if(this.kinds_.indexOf(a.kind)>-1){const o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}$.registerComponent("TextTrackButton",mr);class If extends Ti{constructor(e,t){const n=t.track,r=t.cue,i=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=r.text,t.selected=r.startTime<=i&&i<r.endTime,super(e,t),this.track=n,this.cue=r}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}$.registerComponent("ChaptersTrackMenuItem",If);class Yc extends mr{constructor(e,t,n){super(e,t,n),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 n=e[t];if(n.kind===this.kind_)return n}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Ve(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 n=0,r=t.length;n<r;n++){const i=t[n],a=new If(this.player_,{track:this.track_,cue:i});e.push(a)}return e}}Yc.prototype.kind_="chapters";Yc.prototype.controlText_="Chapters";$.registerComponent("ChaptersButton",Yc);class Kc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("audio-description");const r=e.textTracks(),i=Le(this,this.handleTracksChange);r.addEventListener("change",i),this.on("dispose",function(){r.removeEventListener("change",i)})}handleTracksChange(e){const t=this.player().textTracks();let n=!1;for(let r=0,i=t.length;r<i;r++){const a=t[r];if(a.kind!==this.kind_&&a.mode==="showing"){n=!0;break}}n?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}Kc.prototype.kind_="descriptions";Kc.prototype.controlText_="Descriptions";$.registerComponent("DescriptionsButton",Kc);class Qc extends mr{constructor(e,t,n){super(e,t,n),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}Qc.prototype.kind_="subtitles";Qc.prototype.controlText_="Subtitles";$.registerComponent("SubtitlesButton",Qc);class Jc extends Ai{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()}}$.registerComponent("CaptionSettingsMenuItem",Jc);class Zc extends mr{constructor(e,t,n){super(e,t,n),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 Jc(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}Zc.prototype.kind_="captions";Zc.prototype.controlText_="Captions";$.registerComponent("CaptionsButton",Zc);class xf extends Ai{createEl(e,t,n){const r=super.createEl(e,t,n),i=r.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",r):i.appendChild(oe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild(oe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),r}}$.registerComponent("SubsCapsMenuItem",xf);class ed extends mr{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(Ve(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 Jc(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,xf),e}}ed.prototype.kinds_=["captions","subtitles"];ed.prototype.controlText_="Subtitles";$.registerComponent("SubsCapsButton",ed);class Lf extends Ti{constructor(e,t){const n=t.track,r=e.audioTracks();t.label=n.label||n.language||"Unknown",t.selected=n.enabled,super(e,t),this.track=n,this.addClass(`vjs-${n.kind}-menu-item`);const i=(...a)=>{this.handleTracksChange.apply(this,a)};r.addEventListener("change",i),this.on("dispose",()=>{r.removeEventListener("change",i)})}createEl(e,t,n){const r=super.createEl(e,t,n),i=r.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(i.appendChild(oe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),i.appendChild(oe("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 n=0;n<t.length;n++){const r=t[n];r!==this.track&&(r.enabled=r===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}$.registerComponent("AudioTrackMenuItem",Lf);class Pf extends Xc{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 n=0;n<t.length;n++){const r=t[n];e.push(new Lf(this.player_,{track:r,selectable:!0,multiSelectable:!1}))}return e}}Pf.prototype.controlText_="Audio Track";$.registerComponent("AudioTrackButton",Pf);class td extends Ti{constructor(e,t){const n=t.rate,r=parseFloat(n,10);t.label=n,t.selected=r===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=n,this.rate=r,this.on(e,"ratechange",i=>this.update(i))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}td.prototype.contentElType="button";$.registerComponent("PlaybackRateMenuItem",td);class Rf extends Gc{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",n=>this.updateVisibility(n)),this.on(e,"ratechange",n=>this.updateLabel(n)),this.on(e,"playbackrateschange",n=>this.handlePlaybackRateschange(n))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=oe("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 n=e.length-1;n>=0;n--)t.push(new td(this.player(),{rate:e[n]+"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")}}Rf.prototype.controlText_="Playback Rate";$.registerComponent("PlaybackRateMenuButton",Rf);class Df extends ${buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},n={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,n)}}$.registerComponent("Spacer",Df);class hS extends Df{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}$.registerComponent("CustomControlSpacer",hS);class Nf extends ${createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Nf.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};$.registerComponent("ControlBar",Nf);class Of extends hr{constructor(e,t){super(e,t),this.on(e,"error",n=>{this.open(n)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Of.prototype.options_=Object.assign({},hr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});$.registerComponent("ErrorDisplay",Of);class Mf extends ${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(),oe("select",{id:this.options_.id},{},this.options_.SelectOptions.map(e=>{const t=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Bt()}`)+"-"+e[1].replace(/\W+/g,""),n=oe("option",{id:t,value:this.localize(e[0]),textContent:this.localize(e[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${t}`),n}))}}$.registerComponent("TextTrackSelect",Mf);class hn extends ${constructor(e,t={}){super(e,t);const n=oe("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(n);const r=this.options_.selects;for(const i of r){const a=this.options_.selectConfigs[i],o=a.className,c=a.id.replace("%s",this.options_.id_);let h=null;const m=`vjs_select_${Bt()}`;if(this.options_.type==="colors"){h=oe("span",{className:o});const T=oe("label",{id:c,className:"vjs-label",textContent:this.localize(a.label)});T.setAttribute("for",m),h.appendChild(T)}const _=new Mf(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:c});this.addChild(_),this.options_.type==="colors"&&(h.appendChild(_.el()),this.el().appendChild(h))}}createEl(){return oe("fieldset",{className:this.options_.className})}}$.registerComponent("TextTrackFieldset",hn);class Uf extends ${constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,r=new hn(e,{id_:n,legendId:`captions-text-legend-${n}`,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 i=new hn(e,{id_:n,legendId:`captions-background-${n}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(i);const a=new hn(e,{id_:n,legendId:`captions-window-${n}`,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 oe("div",{className:"vjs-track-settings-colors"})}}$.registerComponent("TextTrackSettingsColors",Uf);class Bf extends ${constructor(e,t={}){super(e,t);const n=this.options_.textTrackComponentid,r=new hn(e,{id_:n,legendId:`captions-font-size-${n}`,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 i=new hn(e,{id_:n,legendId:`captions-edge-style-${n}`,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(i);const a=new hn(e,{id_:n,legendId:`captions-font-family-${n}`,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 oe("div",{className:"vjs-track-settings-font"})}}$.registerComponent("TextTrackSettingsFont",Bf);class Ff extends ${constructor(e,t={}){super(e,t);const n=this.localize("restore all settings to the default values"),r=new lt(e,{controlText:n,className:"vjs-default-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Reset"),this.addChild(r);const i=new lt(e,{controlText:n,className:"vjs-done-button"});i.el().classList.remove("vjs-control","vjs-button"),i.el().textContent=this.localize("Done"),this.addChild(i)}createEl(){return oe("div",{className:"vjs-track-settings-controls"})}}$.registerComponent("TrackSettingsControls",Ff);const dl="vjs-text-track-settings",oh=["#000","Black"],lh=["#00F","Blue"],ch=["#0FF","Cyan"],dh=["#0F0","Green"],uh=["#F0F","Magenta"],hh=["#F00","Red"],ph=["#FFF","White"],mh=["#FF0","Yellow"],ul=["1","Opaque"],hl=["0.5","Semi-Transparent"],fh=["0","Transparent"],qs={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[oh,ph,hh,dh,lh,mh,uh,ch],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ul,hl,fh],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[ph,oh,hh,dh,lh,mh,uh,ch],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:[ul,hl],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:[fh,hl,ul],className:"vjs-window-opacity vjs-opacity"}};qs.windowColor.options=qs.backgroundColor.options;function jf(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function pS(s,e){const t=s.options[s.options.selectedIndex].value;return jf(t,e)}function mS(s,e,t){if(e){for(let n=0;n<s.options.length;n++)if(jf(s.options[n].value,t)===e){s.selectedIndex=n;break}}}class fS extends hr{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=oe("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 Uf(e,{textTrackComponentid:this.id_,selectConfigs:qs,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const n=new Bf(e,{textTrackComponentid:this.id_,selectConfigs:qs,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(n);const r=new Ff(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()}),Fn(qs,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 xm(qs,(e,t,n)=>{const r=pS(this.$(t.selector),t.parser);return r!==void 0&&(e[n]=r),e},{})}setValues(e){Fn(qs,(t,n)=>{mS(this.$(t.selector),e[n],t.parser)})}setDefaults(){Fn(qs,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(I.localStorage.getItem(dl))}catch(t){fe.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?I.localStorage.setItem(dl,JSON.stringify(e)):I.localStorage.removeItem(dl)}catch(t){fe.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}$.registerComponent("TextTrackSettings",fS);class gS extends ${constructor(e,t){let n=t.ResizeObserver||I.ResizeObserver;t.ResizeObserver===null&&(n=!1);const r=we({createEl:!n,reportTouchActivity:!1},t);super(e,r),this.ResizeObserver=t.ResizeObserver||I.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Jm(()=>{this.resizeHandler()},100,!1,this),n?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const i=this.debouncedHandler_;let a=this.unloadListener_=function(){ot(this,"resize",i),ot(this,"unload",a),a=null};Lt(this.el_.contentWindow,"unload",a),Lt(this.el_.contentWindow,"resize",i)},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()}}$.registerComponent("ResizeManager",gS);const yS={trackingThreshold:20,liveTolerance:15};class _S extends ${constructor(e,t){const n=we(yS,t,{createEl:!1});super(e,n),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(I.performance.now().toFixed(4)),n=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+n;const r=this.liveCurrentTime(),i=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(r-i)>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_,Ft),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 n=e?e.length:0;for(;n--;)t.push(e.end(n));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let n=e?e.length:0;for(;n--;)t.push(e.start(n));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()}}$.registerComponent("LiveTracker",_S);class vS extends ${constructor(e,t){super(e,t),this.on("statechanged",n=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:oe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Bt()}`}),description:oe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Bt()}`})},oe("div",{className:"vjs-title-bar"},{},Lm(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,n={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(r=>{const i=this.state[r],a=this.els[r],o=n[r];go(a),i&&zs(a,i),t&&(t.removeAttribute(o),i&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}$.registerComponent("TitleBar",vS);const bS={initialDisplay:4e3,position:[],takeFocus:!1};class TS extends lt{constructor(e,t){t=we(bS,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],n=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=oe("button",{},{type:"button",class:this.buildCSSClass()},oe("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()}}$.registerComponent("TransientButton",TS);const Bl=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),n=[];let r="";if(!t.length)return!1;for(let i=0;i<t.length;i++){const a=t[i].src;a&&n.indexOf(a)===-1&&n.push(a)}return n.length?(n.length===1&&(r=n[0]),s.triggerSourceset(r),!0):!1},AS=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=X.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=X.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",I.Element.prototype.appendChild.call(this,t),this.innerHTML}}),qf=(s,e)=>{let t={};for(let n=0;n<s.length&&(t=Object.getOwnPropertyDescriptor(s[n],e),!(t&&t.set&&t.get));n++);return t.enumerable=!0,t.configurable=!0,t},SS=s=>qf([s.el(),I.HTMLMediaElement.prototype,I.Element.prototype,AS],"innerHTML"),gh=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},n=SS(s),r=i=>(...a)=>{const o=i.apply(e,a);return Bl(s),o};["append","appendChild","insertAdjacentHTML"].forEach(i=>{e[i]&&(t[i]=e[i],e[i]=r(t[i]))}),Object.defineProperty(e,"innerHTML",we(n,{set:r(n.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(i=>{e[i]=t[i]}),Object.defineProperty(e,"innerHTML",n)},s.one("sourceset",e.resetSourceWatch_)},ES=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?cf(I.Element.prototype.getAttribute.call(this,"src")):""},set(s){return I.Element.prototype.setAttribute.call(this,"src",s),s}}),wS=s=>qf([s.el(),I.HTMLMediaElement.prototype,ES],"src"),kS=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=wS(s),n=e.setAttribute,r=e.load;Object.defineProperty(e,"src",we(t,{set:i=>{const a=t.set.call(e,i);return s.triggerSourceset(e.src),a}})),e.setAttribute=(i,a)=>{const o=n.call(e,i,a);return/src/i.test(i)&&s.triggerSourceset(e.src),o},e.load=()=>{const i=r.call(e);return Bl(s)||(s.triggerSourceset(""),gh(s)),i},e.currentSrc?s.triggerSourceset(e.currentSrc):Bl(s)||gh(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=r,e.setAttribute=n,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class te extends pe{constructor(e,t){super(e,t);const n=e.source;let r=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",n&&(this.el_.currentSrc!==n.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(n):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const i=this.el_.childNodes;let a=i.length;const o=[];for(;a--;){const c=i[a];c.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(c),this.remoteTextTracks().addTrack(c.track),this.textTracks().addTrack(c.track),!r&&!this.el_.hasAttribute("crossorigin")&&bo(c.src)&&(r=!0)):o.push(c))}for(let c=0;c<o.length;c++)this.el_.removeChild(o[c])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&r&&fe.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
171
|
+
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(di||uo)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),te.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){kS(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const n=()=>{t=[];for(let i=0;i<e.length;i++){const a=e[i];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};n(),e.addEventListener("change",n),this.on("dispose",()=>e.removeEventListener("change",n));const r=()=>{for(let i=0;i<t.length;i++){const a=t[i];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",r)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",n),e.removeEventListener("change",r),e.addEventListener("change",r)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",n),e.addEventListener("change",n),e.removeEventListener("change",r)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const n=e.toLowerCase();this[`${n}TracksListeners_`]&&Object.keys(this[`${n}TracksListeners_`]).forEach(r=>{this.el()[`${n}Tracks`].removeEventListener(r,this[`${n}TracksListeners_`][r])}),this[`featuresNative${e}Tracks`]=!t,this[`${n}TracksListeners_`]=null,this.proxyNativeTracksForType_(n)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Ut[e],n=this.el()[t.getterName],r=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!n||!n.addEventListener)return;const i={change:o=>{const c={type:"change",target:r,currentTarget:r,srcElement:r};r.trigger(c),e==="text"&&this[ar.remoteText.getterName]().trigger(c)},addtrack(o){r.addTrack(o.track)},removetrack(o){r.removeTrack(o.track)}},a=function(){const o=[];for(let c=0;c<r.length;c++){let h=!1;for(let m=0;m<n.length;m++)if(n[m]===r[c]){h=!0;break}h||o.push(r[c])}for(;o.length;)r.removeTrack(o.shift())};this[t.getterName+"Listeners_"]=i,Object.keys(i).forEach(o=>{const c=i[o];n.addEventListener(o,c),this.on("dispose",h=>n.removeEventListener(o,c))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Ut.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const n=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(n,e),te.disposeMediaElement(e),e=n}else{e=X.createElement("video");const n=this.options_.tag&&js(this.options_.tag),r=we({},n);(!di||this.options_.nativeControlsForTouch!==!0)&&delete r.controls,Fm(e,Object.assign(r,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&sr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let n=0;n<t.length;n++){const r=t[n],i=this.options_[r];typeof i<"u"&&(i?sr(e,r,r):mo(e,r),e[r]=i)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let n=!1;const r=function(){n=!0};this.on("loadstart",r);const i=function(){n||this.trigger("loadstart")};this.on("loadedmetadata",i),this.ready(function(){this.off("loadstart",r),this.off("loadedmetadata",i),n||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(n){this.trigger(n)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ho?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){fe(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Wt&&ls&&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)ts(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 fe.error("Invalid source URL."),!1;const n={src:e};t&&(n.type=t);const r=oe("source",{},n);return this.el_.appendChild(r),!0}removeSourceElement(e){if(!e)return fe.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const n of t)if(n.src===e)return this.el_.removeChild(n),!0;return fe.warn(`No matching source element found with src: ${e}`),!1}reset(){te.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,n){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,n):super.addTextTrack(e,t,n)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=X.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 n=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(n),n}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let n=t.length;for(;n--;)(e===t[n]||e===t[n].track)&&this.el().removeChild(t[n])}}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),I.performance&&(e.creationTime=I.performance.now()),e}}oo(te,"TEST_VID",function(){if(!cr())return;const s=X.createElement("video"),e=X.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});te.isSupported=function(){try{te.TEST_VID.volume=.5}catch{return!1}return!!(te.TEST_VID&&te.TEST_VID.canPlayType)};te.canPlayType=function(s){return te.TEST_VID.canPlayType(s)};te.canPlaySource=function(s,e){return te.canPlayType(s.type)};te.canControlVolume=function(){try{const s=te.TEST_VID.volume;te.TEST_VID.volume=s/2+.1;const e=s!==te.TEST_VID.volume;return e&&at?(I.setTimeout(()=>{te&&te.prototype&&(te.prototype.featuresVolumeControl=s!==te.TEST_VID.volume)}),!1):e}catch{return!1}};te.canMuteVolume=function(){try{const s=te.TEST_VID.muted;return te.TEST_VID.muted=!s,te.TEST_VID.muted?sr(te.TEST_VID,"muted","muted"):mo(te.TEST_VID,"muted","muted"),s!==te.TEST_VID.muted}catch{return!1}};te.canControlPlaybackRate=function(){if(Wt&&ls&&lo<58)return!1;try{const s=te.TEST_VID.playbackRate;return te.TEST_VID.playbackRate=s/2+.1,s!==te.TEST_VID.playbackRate}catch{return!1}};te.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(X.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(X.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(X.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(X.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};te.supportsNativeTextTracks=function(){return ho||at&&ls};te.supportsNativeVideoTracks=function(){return!!(te.TEST_VID&&te.TEST_VID.videoTracks)};te.supportsNativeAudioTracks=function(){return!!(te.TEST_VID&&te.TEST_VID.audioTracks)};te.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([s,e]){oo(te.prototype,s,()=>te[e](),!0)});te.prototype.featuresVolumeControl=te.canControlVolume();te.prototype.movingMediaElementInDOM=!at;te.prototype.featuresFullscreenResize=!0;te.prototype.featuresProgressEvents=!0;te.prototype.featuresTimeupdateEvents=!0;te.prototype.featuresVideoFrameCallback=!!(te.TEST_VID&&te.TEST_VID.requestVideoFrameCallback);te.disposeMediaElement=function(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{}}()}};te.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){te.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){te.prototype["set"+Ve(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){te.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){te.prototype["set"+Ve(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){te.prototype[s]=function(){return this.el_[s]()}});pe.withSourceHandlers(te);te.nativeSourceHandler={};te.nativeSourceHandler.canPlayType=function(s){try{return te.TEST_VID.canPlayType(s)}catch{return""}};te.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return te.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=jc(s.src);return te.nativeSourceHandler.canPlayType(`video/${t}`)}return""};te.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};te.nativeSourceHandler.dispose=function(){};te.registerSourceHandler(te.nativeSourceHandler);pe.registerTech("Html5",te);const Vf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],pl={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Fl=["tiny","xsmall","small","medium","large","xlarge","huge"],ca={};Fl.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;ca[s]=`vjs-layout-${e}`});const CS={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ne extends ${constructor(e,t,n){if(e.id=e.id||t.id||`vjs_video_${Bt()}`,t=Object.assign(Ne.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,n),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=Cm(this.id_),this.fsApi_=xa,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&&js(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ne.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(),Mc(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(Lt(X,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const r=we(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=r,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const a=new I.DOMParser().parseFromString(KA,"image/svg+xml");if(a.querySelector("parsererror"))fe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const o=a.documentElement;o.style.display="none",this.el_.appendChild(o),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 QA(this),this.addClass("vjs-spatial-navigation-enabled")),di&&this.addClass("vjs-touch-enabled"),at||this.addClass("vjs-workinghover"),Ne.players[this.id_]=this;const i=xl.split(".")[0];this.addClass(`vjs-v${i}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),ot(X,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),ot(X,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ne.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),zA(this),gt.names.forEach(e=>{const t=gt[e],n=this[t.getterName]();n&&n.off&&n.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,n=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const r=this.tag.tagName.toLowerCase()==="video-js";n?t=this.el_=e.parentNode:r||(t=this.el_=super.createEl("div"));const i=js(e);if(r){for(t=this.el_=e,e=this.tag=X.createElement("video");t.children.length;)e.appendChild(t.firstChild);ti(t,"video-js")||dn(t,"video-js"),t.appendChild(e),n=this.playerElIngest_=t,Object.keys(t).forEach(c=>{try{e[c]=t[c]}catch{}})}e.setAttribute("tabindex","-1"),i.tabindex="-1",ls&&co&&(e.setAttribute("role","application"),i.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in i&&delete i.width,"height"in i&&delete i.height,Object.getOwnPropertyNames(i).forEach(function(c){r&&c==="class"||t.setAttribute(c,i[c]),r&&e.setAttribute(c,i[c])}),e.playerId=e.id,e.id+="_html5_api",e.className="vjs-tech",e.player=t.player=this,this.addClass("vjs-paused");const a=["IS_SMART_TV","IS_TIZEN","IS_WEBOS","IS_ANDROID","IS_IPAD","IS_IPHONE","IS_CHROMECAST_RECEIVER"].filter(c=>Om[c]).map(c=>"vjs-device-"+c.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),I.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Km("vjs-styles-dimensions");const c=Hs(".vjs-styles-defaults"),h=Hs("head");h.insertBefore(this.styleEl_,c?c.nextSibling:h.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 o=e.getElementsByTagName("a");for(let c=0;c<o.length;c++){const h=o.item(c);dn(h,"vjs-hidden"),h.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!n&&e.parentNode.insertBefore(t,e),Pl(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"){fe.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 n=e+"_";if(t===void 0)return this[n]||0;if(t===""||t==="auto"){this[n]=void 0,this.updateStyleEl_();return}const r=parseFloat(t);if(isNaN(r)){fe.error(`Improper value "${t}" supplied for for ${e}`);return}this[n]=r,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Ts(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),AA(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(I.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,c=typeof this.height_=="number"?this.height_:this.options_.height,h=this.tech_&&this.tech_.el();h&&(o>=0&&(h.width=o),c>=0&&(h.height=c));return}let e,t,n,r;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?n=this.aspectRatio_:this.videoWidth()>0?n=this.videoWidth()+":"+this.videoHeight():n="16:9";const i=n.split(":"),a=i[1]/i[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),Qm(this.styleEl_,`
|
|
172
172
|
.${r} {
|
|
173
173
|
width: ${e}px;
|
|
174
174
|
height: ${t}px;
|
|
@@ -177,9 +177,9 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati
|
|
|
177
177
|
.${r}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
178
178
|
padding-top: ${a*100}%;
|
|
179
179
|
}
|
|
180
|
-
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const n=Ve(e),r=e.charAt(0).toLowerCase()+e.slice(1);n!=="Html5"&&this.tag&&(
|
|
180
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const n=Ve(e),r=e.charAt(0).toLowerCase()+e.slice(1);n!=="Html5"&&this.tag&&(pe.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=n,this.isReady_=!1;let i=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(i=!1);const a={source:t,autoplay:i,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};gt.names.forEach(c=>{const h=gt[c];a[h.getterName]=this[h.privateName]}),Object.assign(a,this.options_[n]),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 o=pe.getTech(e);if(!o)throw new Error(`No Tech named '${n}' exists! '${n}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Le(this,this.handleTechReady_),!0),Yu.jsonToTextTracks(this.textTracksJson_||[],this.tech_),Vf.forEach(c=>{this.on(this.tech_,c,h=>this[`handleTech${Ve(c)}_`](h))}),Object.keys(pl).forEach(c=>{this.on(this.tech_,c,h=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${pl[c]}_`].bind(this),event:h});return}this[`handleTech${pl[c]}_`](h)})}),this.on(this.tech_,"loadstart",c=>this.handleTechLoadStart_(c)),this.on(this.tech_,"sourceset",c=>this.handleTechSourceset_(c)),this.on(this.tech_,"waiting",c=>this.handleTechWaiting_(c)),this.on(this.tech_,"ended",c=>this.handleTechEnded_(c)),this.on(this.tech_,"seeking",c=>this.handleTechSeeking_(c)),this.on(this.tech_,"play",c=>this.handleTechPlay_(c)),this.on(this.tech_,"pause",c=>this.handleTechPause_(c)),this.on(this.tech_,"durationchange",c=>this.handleTechDurationChange_(c)),this.on(this.tech_,"fullscreenchange",(c,h)=>this.handleTechFullscreenChange_(c,h)),this.on(this.tech_,"fullscreenerror",(c,h)=>this.handleTechFullscreenError_(c,h)),this.on(this.tech_,"enterpictureinpicture",c=>this.handleTechEnterPictureInPicture_(c)),this.on(this.tech_,"leavepictureinpicture",c=>this.handleTechLeavePictureInPicture_(c)),this.on(this.tech_,"error",c=>this.handleTechError_(c)),this.on(this.tech_,"posterchange",c=>this.handleTechPosterChange_(c)),this.on(this.tech_,"textdata",c=>this.handleTechTextData_(c)),this.on(this.tech_,"ratechange",c=>this.handleTechRateChange_(c)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(n!=="Html5"||!this.tag)&&Pl(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){gt.names.forEach(e=>{const t=gt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Yu.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&&fe.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
181
181
|
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
182
|
-
`),this.tech_}version(){return{"video.js":xl}}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 i=()=>{this.muted(r)};this.playTerminatedQueue_.push(i);const a=this.play();if(ni(a))return a.catch(o=>{throw i(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let n;if(e==="any"&&!this.muted()?(n=this.play(),ni(n)&&(n=n.catch(t))):e==="muted"&&!this.muted()?n=t():n=this.play(),!!ni(n))return n.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,n="";typeof t!="string"&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=WA(this,t)),this.cache_.source=we({},e,{src:t,type:n});const r=this.cache_.sources.filter(c=>c.src&&c.src===t),i=[],a=this.$$("source"),o=[];for(let c=0;c<a.length;c++){const h=js(a[c]);i.push(h),h.src&&h.src===t&&o.push(h.src)}o.length&&!r.length?this.cache_.sources=i:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=i=>this.updateSourceCaches_(i);const n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(t=()=>{}),t(r),e.src||this.tech_.any(["sourceset","loadstart"],i=>{if(i.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()?ts(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.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()&&!Y.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 n=this.el();let r=Y[this.fsApi_.fullscreenElement]===n;!r&&n.matches&&(r=n.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 jA)return BA(this.middleware_,this.tech_,e,t);if(e in Qu)return Ku(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(n){throw pe(n),n}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in FA)return UA(this.middleware_,this.tech_,e);if(e in Qu)return Ku(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(pe(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(pe(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(pe(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=ts){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),n=!!(ho||at);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=i=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&n&&this.load();return}const r=this.techGet_("play");n&&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(n){n(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ht(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=Ht(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ht(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 of(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let n=e.end(e.length-1);return n>t&&(n=t),n}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((n,r)=>{function i(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){i(),n()}function o(h,m){i(),r(m)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const c=t.requestFullscreenHelper_(e);c&&(c.then(i,i),c.then(n,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 n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),n}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,n)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",i)}function i(){r(),t()}function a(c,h){r(),n(h)}e.one("fullscreenchange",i),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(r,r),o.then(t,n))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=Y[this.fsApi_.exitFullscreen]();return e&&ts(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=Y.documentElement.style.overflow,Lt(Y,"keydown",this.boundFullWindowOnEscKey_),Y.documentElement.style.overflow="hidden",dn(Y.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,ot(Y,"keydown",this.boundFullWindowOnEscKey_),Y.documentElement.style.overflow=this.docOrigOverflow,po(Y.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&&I.documentPictureInPicture){const e=Y.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(ae("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),I.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Gm(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",n=>{const r=n.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in Y&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(I.documentPictureInPicture&&I.documentPictureInPicture.window)return I.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in Y)return Y.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();return n.isContentEditable?!0:r==="input"?["button","checkbox","hidden","radio","reset","submit"].indexOf(n.type)===-1:["textarea"].indexOf(r)!==-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:n=a=>e.key.toLowerCase()==="f",muteKey:r=a=>e.key.toLowerCase()==="m",playPauseKey:i=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const a=$.getComponent("FullscreenToggle");Y[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),$.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),$.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let n=0,r=this.options_.techOrder;n<r.length;n++){const i=r[n];let a=de.getTech(i);if(a||(a=$.getComponent(i)),!a){pe.error(`The "${i}" 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(o=>[o,de.getTech(o)]).filter(([o,c])=>c?c.isSupported():(pe.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),n=function(o,c,h){let m;return o.some(_=>c.some(T=>{if(m=h(_,T),m)return!0})),m};let r;const i=o=>(c,h)=>o(h,c),a=([o,c],h)=>{if(c.canPlaySource(h,this.options_[o.toLowerCase()]))return{source:h,tech:o}};return this.options_.sourceOrder?r=n(e,t,i(a)):r=n(t,e,a),r||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const n=hf(e);if(!n.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),OA(this,n[0],(r,i)=>{if(this.middleware_=i,t||(this.cache_.sources=n),this.updateSourceCaches_(r),this.src_(r)){if(n.length>1)return this.handleSrc_(n.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}MA(i,this.tech_)}),n.length>1){const r=()=>{this.error(null),this.handleSrc_(n.slice(1),!0)},i=()=>{this.off("error",r)};this.one("error",r),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",i)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?sf(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();ts(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}),Ts(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:n,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:i}=n||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.updateContent(),i&&(i.update(),i.loadProgressBar&&i.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($s("beforeerror").forEach(t=>{const n=t(this,e);if(!(os(n)&&!Array.isArray(n)||typeof n=="string"||typeof n=="number"||n===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=n}),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 je(e),this.addClass("vjs-error"),pe.error(`(CODE:${this.error_.code} ${je.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),$s("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,n;const r=Le(this,this.reportUserActivity),i=function(_){(_.screenX!==t||_.screenY!==n)&&(t=_.screenX,n=_.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},o=function(_){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",i),this.on("mouseup",o),this.on("mouseleave",o);const c=this.getChild("controlBar");c&&!at&&!Wt&&(c.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let h;const m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(h);const _=this.options_.inactivityTimeout;_<=0||(h=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"),n=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=n,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(n),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,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)}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(),Ts(this)&&this.trigger("languagechange"))}languages(){return we(Ne.prototype.options_.languages,this.languages_)}toJSON(){const e=we(this.options_),t=e.tracks;e.tracks=[];for(let n=0;n<t.length;n++){let r=t[n];r=we(r),r.player=void 0,e.tracks[n]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const n=new hr(this,t);return this.addChild(n),n.on("dispose",()=>{this.removeChild(n)}),n.open(),n}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let n=0;n<Fl.length;n++){const r=Fl[n],i=this.breakpoints_[r];if(t<=i){if(e===r)return;e&&this.removeClass(ca[e]),this.addClass(ca[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({},SS,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 ca[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const n=this.crossOrigin();this.reset(),this.cache_.media=we(e);const{artist:r,artwork:i,description:a,poster:o,src:c,textTracks:h,title:m}=this.cache_.media;!i&&o&&(this.cache_.media.artwork=[{src:o,type:Fa(o)}]),n&&this.crossOrigin(n),c&&this.src(c),o&&this.poster(o),Array.isArray(h)&&h.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(),n=Array.prototype.map.call(this.remoteTextTracks(),i=>({kind:i.kind,label:i.label,language:i.language,src:i.src})),r={src:t,textTracks:n};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:Fa(r.poster)}]),r}return we(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},n=js(e),r=n["data-setup"];if(ti(e,"vjs-fill")&&(n.fill=!0),ti(e,"vjs-fluid")&&(n.fluid=!0),r!==null)try{Object.assign(n,JSON.parse(r||"{}"))}catch(i){pe.error("data-setup",i)}if(Object.assign(t,n),e.hasChildNodes()){const i=e.childNodes;for(let a=0,o=i.length;a<o;a++){const c=i[a],h=c.nodeName.toLowerCase();h==="source"?t.sources.push(js(c)):h==="track"&&t.tracks.push(js(c))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}gt.names.forEach(function(s){const e=gt[s];Ne.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ne.prototype.crossorigin=Ne.prototype.crossOrigin;Ne.players={};const jr=I.navigator;Ne.prototype.options_={techOrder:de.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:jr&&(jr.languages&&jr.languages[0]||jr.userLanguage||jr.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};Vf.forEach(function(s){Ne.prototype[`handleTech${Ve(s)}_`]=function(){return this.trigger(s)}});$.registerComponent("Player",Ne);const ja="plugin",Vn="activePlugins_",Mn={},qa=s=>Mn.hasOwnProperty(s),da=s=>qa(s)?Mn[s]:void 0,$f=(s,e)=>{s[Vn]=s[Vn]||{},s[Vn][e]=!0},Va=(s,e,t)=>{const n=(t?"before":"")+"pluginsetup";s.trigger(n,e),s.trigger(n+":"+e.name,e)},ES=function(s,e){const t=function(){Va(this,{name:s,plugin:e,instance:null},!0);const n=e.apply(this,arguments);return $f(this,s),Va(this,{name:s,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t},mh=(s,e)=>(e.prototype.name=s,function(...t){Va(this,{name:s,plugin:e,instance:null},!0);const n=new e(this,...t);return this[s]=()=>n,Va(this,n.getEventHash()),n});let ds=class ua{constructor(e){if(this.constructor===ua)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Mc(this),delete this.trigger,tf(this,this.constructor.defaultState),$f(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return ur(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[Vn][e]=!1,this.player=this.state=null,t[e]=mh(e,Mn[e])}static isBasic(e){const t=typeof e=="string"?da(e):e;return typeof t=="function"&&!ua.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(qa(e))pe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ne.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 Mn[e]=t,e!==ja&&(ua.isBasic(t)?Ne.prototype[e]=ES(e,t):Ne.prototype[e]=mh(e,t)),t}static deregisterPlugin(e){if(e===ja)throw new Error("Cannot de-register base plugin.");qa(e)&&(delete Mn[e],delete Ne.prototype[e])}static getPlugins(e=Object.keys(Mn)){let t;return e.forEach(n=>{const r=da(n);r&&(t=t||{},t[n]=r)}),t}static getPluginVersion(e){const t=da(e);return t&&t.VERSION||""}};ds.getPlugin=da;ds.BASE_PLUGIN_NAME=ja;ds.registerPlugin(ja,ds);Ne.prototype.usingPlugin=function(s){return!!this[Vn]&&this[Vn][s]===!0};Ne.prototype.hasPlugin=function(s){return!!qa(s)};function wS(s,e){let t=!1;return function(...n){return t||pe.warn(s),t=!0,e.apply(this,n)}}function zt(s,e,t,n){return wS(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,n)}var kS={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 Hf=s=>s.indexOf("#")===0?s.slice(1):s;function P(s,e,t){let n=P.getPlayer(s);if(n)return e&&pe.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&n.ready(t),n;const r=typeof s=="string"?Hs("#"+Hf(s)):s;if(!dr(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const i="getRootNode"in r&&r.getRootNode()instanceof I.ShadowRoot?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!i.contains(r))&&pe.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)),$s("beforesetup").forEach(o=>{const c=o(r,we(e));if(!os(c)||Array.isArray(c)){pe.error("please return an object in beforesetup hooks");return}e=we(e,c)});const a=$.getComponent("Player");return n=new a(r,e,t),$s("setup").forEach(o=>o(n)),n}P.hooks_=_s;P.hooks=$s;P.hook=rA;P.hookOnce=iA;P.removeHook=km;if(I.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&cr()){let s=Hs(".vjs-styles-defaults");if(!s){s=Km("vjs-styles-defaults");const e=Hs("head");e&&e.insertBefore(s,e.firstChild),Qm(s,`
|
|
182
|
+
`),this.tech_}version(){return{"video.js":xl}}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 i=()=>{this.muted(r)};this.playTerminatedQueue_.push(i);const a=this.play();if(ni(a))return a.catch(o=>{throw i(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let n;if(e==="any"&&!this.muted()?(n=this.play(),ni(n)&&(n=n.catch(t))):e==="muted"&&!this.muted()?n=t():n=this.play(),!!ni(n))return n.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,n="";typeof t!="string"&&(t=e.src,n=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!n&&(n=YA(this,t)),this.cache_.source=we({},e,{src:t,type:n});const r=this.cache_.sources.filter(c=>c.src&&c.src===t),i=[],a=this.$$("source"),o=[];for(let c=0;c<a.length;c++){const h=js(a[c]);i.push(h),h.src&&h.src===t&&o.push(h.src)}o.length&&!r.length?this.cache_.sources=i:r.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=i=>this.updateSourceCaches_(i);const n=this.currentSource().src,r=e.src;n&&!/^blob:/.test(n)&&/^blob:/.test(r)&&(!this.lastSource_||this.lastSource_.tech!==r&&this.lastSource_.player!==n)&&(t=()=>{}),t(r),e.src||this.tech_.any(["sourceset","loadstart"],i=>{if(i.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()?ts(this.play()):this.pause())}handleTechDoubleClick_(e){this.controls_&&(Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),t=>t.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()&&!X.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 n=this.el();let r=X[this.fsApi_.fullscreenElement]===n;!r&&n.matches&&(r=n.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 HA)return VA(this.middleware_,this.tech_,e,t);if(e in eh)return Zu(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(n){throw fe(n),n}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in $A)return qA(this.middleware_,this.tech_,e);if(e in eh)return Zu(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(fe(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(fe(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(fe(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=ts){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),n=!!(ho||at);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=i=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&n&&this.load();return}const r=this.techGet_("play");n&&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(n){n(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Ht(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=Ht(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Ht(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 of(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let n=e.end(e.length-1);return n>t&&(n=t),n}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((n,r)=>{function i(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){i(),n()}function o(h,m){i(),r(m)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const c=t.requestFullscreenHelper_(e);c&&(c.then(i,i),c.then(n,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 n=this.el_[this.fsApi_.requestFullscreen](t);return n&&n.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),n}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,n)=>{function r(){e.off("fullscreenerror",a),e.off("fullscreenchange",i)}function i(){r(),t()}function a(c,h){r(),n(h)}e.one("fullscreenchange",i),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(r,r),o.then(t,n))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=X[this.fsApi_.exitFullscreen]();return e&&ts(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=X.documentElement.style.overflow,Lt(X,"keydown",this.boundFullWindowOnEscKey_),X.documentElement.style.overflow="hidden",dn(X.body,"vjs-full-window"),this.trigger("enterFullWindow")}fullWindowOnEscKey(e){e.key==="Escape"&&this.isFullscreen()===!0&&(this.isFullWindow?this.exitFullWindow():this.exitFullscreen())}exitFullWindow(){this.isFullscreen(!1),this.isFullWindow=!1,ot(X,"keydown",this.boundFullWindowOnEscKey_),X.documentElement.style.overflow=this.docOrigOverflow,po(X.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&&I.documentPictureInPicture){const e=X.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(oe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),I.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Gm(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",n=>{const r=n.target.querySelector(".video-js");e.parentNode.replaceChild(r,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in X&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(I.documentPictureInPicture&&I.documentPictureInPicture.window)return I.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in X)return X.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();return n.isContentEditable?!0:r==="input"?["button","checkbox","hidden","radio","reset","submit"].indexOf(n.type)===-1:["textarea"].indexOf(r)!==-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:n=a=>e.key.toLowerCase()==="f",muteKey:r=a=>e.key.toLowerCase()==="m",playPauseKey:i=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(n.call(this,e)){e.preventDefault(),e.stopPropagation();const a=$.getComponent("FullscreenToggle");X[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else r.call(this,e)?(e.preventDefault(),e.stopPropagation(),$.getComponent("MuteToggle").prototype.handleClick.call(this,e)):i.call(this,e)&&(e.preventDefault(),e.stopPropagation(),$.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let n=0,r=this.options_.techOrder;n<r.length;n++){const i=r[n];let a=pe.getTech(i);if(a||(a=$.getComponent(i)),!a){fe.error(`The "${i}" 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(o=>[o,pe.getTech(o)]).filter(([o,c])=>c?c.isSupported():(fe.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),n=function(o,c,h){let m;return o.some(_=>c.some(T=>{if(m=h(_,T),m)return!0})),m};let r;const i=o=>(c,h)=>o(h,c),a=([o,c],h)=>{if(c.canPlaySource(h,this.options_[o.toLowerCase()]))return{source:h,tech:o}};return this.options_.sourceOrder?r=n(e,t,i(a)):r=n(t,e,a),r||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const n=hf(e);if(!n.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=n),this.updateSourceCaches_(n[0]),FA(this,n[0],(r,i)=>{if(this.middleware_=i,t||(this.cache_.sources=n),this.updateSourceCaches_(r),this.src_(r)){if(n.length>1)return this.handleSrc_(n.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}jA(i,this.tech_)}),n.length>1){const r=()=>{this.error(null),this.handleSrc_(n.slice(1),!0)},i=()=>{this.off("error",r)};this.one("error",r),this.one("playing",i),this.resetRetryOnError_=()=>{this.off("error",r),this.off("playing",i)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?sf(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();ts(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}),Ts(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:n,remainingTimeDisplay:r}=this.controlBar||{},{seekBar:i}=n||{};e&&e.updateContent(),t&&t.updateContent(),r&&r.updateContent(),i&&(i.update(),i.loadProgressBar&&i.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($s("beforeerror").forEach(t=>{const n=t(this,e);if(!(os(n)&&!Array.isArray(n)||typeof n=="string"||typeof n=="number"||n===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=n}),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 je(e),this.addClass("vjs-error"),fe.error(`(CODE:${this.error_.code} ${je.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),$s("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,n;const r=Le(this,this.reportUserActivity),i=function(_){(_.screenX!==t||_.screenY!==n)&&(t=_.screenX,n=_.screenY,r())},a=function(){r(),this.clearInterval(e),e=this.setInterval(r,250)},o=function(_){r(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",i),this.on("mouseup",o),this.on("mouseleave",o);const c=this.getChild("controlBar");c&&!at&&!Wt&&(c.on("mouseenter",function(_){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),c.on("mouseleave",function(_){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",r),this.on("keyup",r);let h;const m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(h);const _=this.options_.inactivityTimeout;_<=0||(h=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"),n=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=n,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(n),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,n){if(this.tech_)return this.tech_.addTextTrack(e,t,n)}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(),Ts(this)&&this.trigger("languagechange"))}languages(){return we(Ne.prototype.options_.languages,this.languages_)}toJSON(){const e=we(this.options_),t=e.tracks;e.tracks=[];for(let n=0;n<t.length;n++){let r=t[n];r=we(r),r.player=void 0,e.tracks[n]=r}return e}createModal(e,t){t=t||{},t.content=e||"";const n=new hr(this,t);return this.addChild(n),n.on("dispose",()=>{this.removeChild(n)}),n.open(),n}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let n=0;n<Fl.length;n++){const r=Fl[n],i=this.breakpoints_[r];if(t<=i){if(e===r)return;e&&this.removeClass(ca[e]),this.addClass(ca[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({},CS,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 ca[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const n=this.crossOrigin();this.reset(),this.cache_.media=we(e);const{artist:r,artwork:i,description:a,poster:o,src:c,textTracks:h,title:m}=this.cache_.media;!i&&o&&(this.cache_.media.artwork=[{src:o,type:Fa(o)}]),n&&this.crossOrigin(n),c&&this.src(c),o&&this.poster(o),Array.isArray(h)&&h.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(),n=Array.prototype.map.call(this.remoteTextTracks(),i=>({kind:i.kind,label:i.label,language:i.language,src:i.src})),r={src:t,textTracks:n};return e&&(r.poster=e,r.artwork=[{src:r.poster,type:Fa(r.poster)}]),r}return we(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},n=js(e),r=n["data-setup"];if(ti(e,"vjs-fill")&&(n.fill=!0),ti(e,"vjs-fluid")&&(n.fluid=!0),r!==null)try{Object.assign(n,JSON.parse(r||"{}"))}catch(i){fe.error("data-setup",i)}if(Object.assign(t,n),e.hasChildNodes()){const i=e.childNodes;for(let a=0,o=i.length;a<o;a++){const c=i[a],h=c.nodeName.toLowerCase();h==="source"?t.sources.push(js(c)):h==="track"&&t.tracks.push(js(c))}}return t}debug(e){if(e===void 0)return this.debugEnabled_;e?(this.trigger("debugon"),this.previousLogLevel_=this.log.level,this.log.level("debug"),this.debugEnabled_=!0):(this.trigger("debugoff"),this.log.level(this.previousLogLevel_),this.previousLogLevel_=void 0,this.debugEnabled_=!1)}playbackRates(e){if(e===void 0)return this.cache_.playbackRates;Array.isArray(e)&&e.every(t=>typeof t=="number")&&(this.cache_.playbackRates=e,this.trigger("playbackrateschange"))}}gt.names.forEach(function(s){const e=gt[s];Ne.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ne.prototype.crossorigin=Ne.prototype.crossOrigin;Ne.players={};const jr=I.navigator;Ne.prototype.options_={techOrder:pe.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:jr&&(jr.languages&&jr.languages[0]||jr.userLanguage||jr.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};Vf.forEach(function(s){Ne.prototype[`handleTech${Ve(s)}_`]=function(){return this.trigger(s)}});$.registerComponent("Player",Ne);const ja="plugin",Vn="activePlugins_",Mn={},qa=s=>Mn.hasOwnProperty(s),da=s=>qa(s)?Mn[s]:void 0,$f=(s,e)=>{s[Vn]=s[Vn]||{},s[Vn][e]=!0},Va=(s,e,t)=>{const n=(t?"before":"")+"pluginsetup";s.trigger(n,e),s.trigger(n+":"+e.name,e)},IS=function(s,e){const t=function(){Va(this,{name:s,plugin:e,instance:null},!0);const n=e.apply(this,arguments);return $f(this,s),Va(this,{name:s,plugin:e,instance:n}),n};return Object.keys(e).forEach(function(n){t[n]=e[n]}),t},yh=(s,e)=>(e.prototype.name=s,function(...t){Va(this,{name:s,plugin:e,instance:null},!0);const n=new e(this,...t);return this[s]=()=>n,Va(this,n.getEventHash()),n});let ds=class ua{constructor(e){if(this.constructor===ua)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Mc(this),delete this.trigger,tf(this,this.constructor.defaultState),$f(e,this.name),this.dispose=this.dispose.bind(this),e.on("dispose",this.dispose)}version(){return this.constructor.VERSION}getEventHash(e={}){return e.name=this.name,e.plugin=this.constructor,e.instance=this,e}trigger(e,t={}){return ur(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[Vn][e]=!1,this.player=this.state=null,t[e]=yh(e,Mn[e])}static isBasic(e){const t=typeof e=="string"?da(e):e;return typeof t=="function"&&!ua.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(qa(e))fe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ne.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 Mn[e]=t,e!==ja&&(ua.isBasic(t)?Ne.prototype[e]=IS(e,t):Ne.prototype[e]=yh(e,t)),t}static deregisterPlugin(e){if(e===ja)throw new Error("Cannot de-register base plugin.");qa(e)&&(delete Mn[e],delete Ne.prototype[e])}static getPlugins(e=Object.keys(Mn)){let t;return e.forEach(n=>{const r=da(n);r&&(t=t||{},t[n]=r)}),t}static getPluginVersion(e){const t=da(e);return t&&t.VERSION||""}};ds.getPlugin=da;ds.BASE_PLUGIN_NAME=ja;ds.registerPlugin(ja,ds);Ne.prototype.usingPlugin=function(s){return!!this[Vn]&&this[Vn][s]===!0};Ne.prototype.hasPlugin=function(s){return!!qa(s)};function xS(s,e){let t=!1;return function(...n){return t||fe.warn(s),t=!0,e.apply(this,n)}}function zt(s,e,t,n){return xS(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,n)}var LS={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 Hf=s=>s.indexOf("#")===0?s.slice(1):s;function P(s,e,t){let n=P.getPlayer(s);if(n)return e&&fe.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&n.ready(t),n;const r=typeof s=="string"?Hs("#"+Hf(s)):s;if(!dr(r))throw new TypeError("The element or ID supplied is not valid. (videojs)");const i="getRootNode"in r&&r.getRootNode()instanceof I.ShadowRoot?r.getRootNode():r.ownerDocument.body;(!r.ownerDocument.defaultView||!i.contains(r))&&fe.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)),$s("beforesetup").forEach(o=>{const c=o(r,we(e));if(!os(c)||Array.isArray(c)){fe.error("please return an object in beforesetup hooks");return}e=we(e,c)});const a=$.getComponent("Player");return n=new a(r,e,t),$s("setup").forEach(o=>o(n)),n}P.hooks_=_s;P.hooks=$s;P.hook=lA;P.hookOnce=cA;P.removeHook=km;if(I.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&cr()){let s=Hs(".vjs-styles-defaults");if(!s){s=Km("vjs-styles-defaults");const e=Hs("head");e&&e.insertBefore(s,e.firstChild),Qm(s,`
|
|
183
183
|
.video-js {
|
|
184
184
|
width: 300px;
|
|
185
185
|
height: 150px;
|
|
@@ -188,15 +188,15 @@ See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
|
188
188
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
189
189
|
padding-top: 56.25%
|
|
190
190
|
}
|
|
191
|
-
`)}}Dl(1,P);P.VERSION=xl;P.options=Ne.prototype.options_;P.getPlayers=()=>Ne.players;P.getPlayer=s=>{const e=Ne.players;let t;if(typeof s=="string"){const n=Hf(s),r=e[n];if(r)return r;t=Hs("#"+n)}else t=s;if(dr(t)){const{player:n,playerId:r}=t;if(n||e[r])return n||e[r]}};P.getAllPlayers=()=>Object.keys(Ne.players).map(s=>Ne.players[s]).filter(Boolean);P.players=Ne.players;P.getComponent=$.getComponent;P.registerComponent=(s,e)=>(
|
|
191
|
+
`)}}Dl(1,P);P.VERSION=xl;P.options=Ne.prototype.options_;P.getPlayers=()=>Ne.players;P.getPlayer=s=>{const e=Ne.players;let t;if(typeof s=="string"){const n=Hf(s),r=e[n];if(r)return r;t=Hs("#"+n)}else t=s;if(dr(t)){const{player:n,playerId:r}=t;if(n||e[r])return n||e[r]}};P.getAllPlayers=()=>Object.keys(Ne.players).map(s=>Ne.players[s]).filter(Boolean);P.players=Ne.players;P.getComponent=$.getComponent;P.registerComponent=(s,e)=>(pe.isTech(e)&&fe.warn(`The ${s} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),$.registerComponent.call($,s,e));P.getTech=pe.getTech;P.registerTech=pe.registerTech;P.use=BA;Object.defineProperty(P,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(P.middleware,"TERMINATOR",{value:Ba,writeable:!1,enumerable:!0});P.browser=Om;P.obj=hA;P.mergeOptions=zt(9,"videojs.mergeOptions","videojs.obj.merge",we);P.defineLazyProperty=zt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",oo);P.bind=zt(9,"videojs.bind","native Function.prototype.bind",Le);P.registerPlugin=ds.registerPlugin;P.deregisterPlugin=ds.deregisterPlugin;P.plugin=(s,e)=>(fe.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),ds.registerPlugin(s,e));P.getPlugins=ds.getPlugins;P.getPlugin=ds.getPlugin;P.getPluginVersion=ds.getPluginVersion;P.addLanguage=function(s,e){return s=(""+s).toLowerCase(),P.options.languages=we(P.options.languages,{[s]:e}),P.options.languages[s]};P.log=fe;P.createLogger=Cm;P.time=CA;P.createTimeRange=zt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Ht);P.createTimeRanges=zt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Ht);P.formatTime=zt(9,"videojs.formatTime","videojs.time.formatTime",fn);P.setFormatTime=zt(9,"videojs.setFormatTime","videojs.time.setFormatTime",rf);P.resetFormatTime=zt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",af);P.parseUrl=zt(9,"videojs.parseUrl","videojs.url.parseUrl",Fc);P.isCrossOrigin=zt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",bo);P.EventTarget=Pt;P.any=Oc;P.on=Lt;P.one=_o;P.off=ot;P.trigger=ur;P.xhr=Cp;P.TextTrack=vi;P.AudioTrack=df;P.VideoTrack=uf;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(s=>{P[s]=function(){return fe.warn(`videojs.${s}() is deprecated; use videojs.dom.${s}() instead`),Xm[s].apply(null,arguments)}});P.computedStyle=zt(9,"videojs.computedStyle","videojs.dom.computedStyle",rr);P.dom=Xm;P.fn=TA;P.num=iS;P.str=wA;P.url=MA;P.Error=LS;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class PS{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(n){t.enabled_(n)}}),t}}class $a extends P.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 n=this.levels_.length;return t=new PS(e),""+n in this||Object.defineProperty(this,n,{get(){return this.levels_[n]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let n=0,r=this.length;n<r;n++)if(this[n]===e){t=this.levels_.splice(n,1)[0],this.selectedIndex_===n?this.selectedIndex_=-1:this.selectedIndex_>n&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,n=this.length;t<n;t++){const r=this[t];if(r.id===e)return r}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}$a.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const s in $a.prototype.allowedEvents_)$a.prototype["on"+s]=null;var Wf="4.1.0";const RS=function(s,e){const t=s.qualityLevels,n=new $a,r=function(){n.dispose(),s.qualityLevels=t,s.off("dispose",r)};return s.on("dispose",r),s.qualityLevels=()=>n,s.qualityLevels.VERSION=Wf,n},zf=function(s){return RS(this,P.obj.merge({},s))};P.registerPlugin("qualityLevels",zf);zf.VERSION=Wf;/*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */const St=Za,Ha=(s,e)=>e&&e.responseURL&&s!==e.responseURL?e.responseURL:s,jt=s=>P.log.debug?P.log.debug.bind(P,"VHS:",`${s} >`):function(){};function ve(...s){const e=P.obj||P;return(e.merge||e.mergeOptions).apply(e,s)}function ct(...s){const e=P.time||P;return(e.createTimeRanges||e.createTimeRanges).apply(e,s)}function DS(s){if(s.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
192
192
|
`;for(let t=0;t<s.length;t++){const n=s.start(t),r=s.end(t);e+=`${n} --> ${r}. Duration (${r-n})
|
|
193
|
-
`}return e}const ss=1/30,ns=ss*3,Gf=function(s,e){const t=[];let n;if(s&&s.length)for(n=0;n<s.length;n++)e(s.start(n),s.end(n))&&t.push([s.start(n),s.end(n)]);return ct(t)},Un=function(s,e){return Gf(s,function(t,n){return t-ns<=e&&n+ns>=e})},ia=function(s,e){return Gf(s,function(t){return t-ss>=e})},LS=function(s){if(s.length<2)return ct();const e=[];for(let t=1;t<s.length;t++){const n=s.end(t-1),r=s.start(t);e.push([n,r])}return ct(e)},PS=function(s,e){let t=null,n=null,r=0;const i=[],a=[];if(!s||!s.length||!e||!e.length)return ct();let o=s.length;for(;o--;)i.push({time:s.start(o),type:"start"}),i.push({time:s.end(o),type:"end"});for(o=e.length;o--;)i.push({time:e.start(o),type:"start"}),i.push({time:e.end(o),type:"end"});for(i.sort(function(c,h){return c.time-h.time}),o=0;o<i.length;o++)i[o].type==="start"?(r++,r===2&&(t=i[o].time)):i[o].type==="end"&&(r--,r===1&&(n=i[o].time)),t!==null&&n!==null&&(a.push([t,n]),t=null,n=null);return ct(a)},Xf=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(", ")},RS=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},ln=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},DS=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},ml=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},sd=function(s,e){let t=0;if(!s||!s.length)return t;for(let n=0;n<s.length;n++){const r=s.start(n),i=s.end(n);if(!(e>i)){if(e>r&&e<=i){t+=i-e;continue}t+=i-r}}return t},nd=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(n){t+=n.duration}),(e.preloadHints||[]).forEach(function(n){n.type==="PART"&&(t+=s.partTargetDuration)}),t},jl=s=>(s.segments||[]).reduce((e,t,n)=>(t.parts?t.parts.forEach(function(r,i){e.push({duration:r.duration,segmentIndex:n,partIndex:i,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e),[]),Yf=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Kf=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let n=(t||[]).reduce((r,i)=>r+(i.type==="PART"?1:0),0);return n+=e&&e.length?e.length:0,n},Qf=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Yf(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},NS=function(s,e){let t=0,n=e-s.mediaSequence,r=s.segments[n];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(;n--;){if(r=s.segments[n],typeof r.end<"u")return{result:t+r.end,precise:!0};if(t+=nd(s,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},OS=function(s,e){let t=0,n,r=e-s.mediaSequence;for(;r<s.segments.length;r++){if(n=s.segments[r],typeof n.start<"u")return{result:n.start-t,precise:!0};if(t+=nd(s,n),typeof n.end<"u")return{result:n.end-t,precise:!0}}return{result:-1,precise:!1}},Zf=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const n=NS(s,e);if(n.precise)return n.result;const r=OS(s,e);return r.precise?r.result:n.result+t},Jf=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 I.Infinity}return Zf(s,e,t)},ri=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:n}){let r=0;if(t>n&&([t,n]=[n,t]),t<0){for(let i=t;i<Math.min(0,n);i++)r+=s;t=0}for(let i=t;i<n;i++)r+=e[i].duration;return r},eg=function(s,e,t,n){if(!s||!s.segments)return null;if(s.endList)return Jf(s);if(e===null)return null;e=e||0;let r=Zf(s,s.mediaSequence+s.segments.length,e);return t&&(n=typeof n=="number"?n:Qf(null,s),r-=n),Math.max(0,r)},MS=function(s,e,t){const n=e||0;let r=eg(s,e,!0,t);return r===null?ct():(r<n&&(r=n),ct(n,r))},US=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:n,startTime:r,exactManifestTimings:i}){let a=e-r;const o=jl(s);let c=0;for(let h=0;h<o.length;h++){const m=o[h];if(t===m.segmentIndex&&!(typeof n=="number"&&typeof m.partIndex=="number"&&n!==m.partIndex)){c=h;break}}if(a<0){if(c>0)for(let h=c-1;h>=0;h--){const m=o[h];if(a+=m.duration,i){if(a<0)continue}else if(a+ss<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r-ri({defaultDuration:s.targetDuration,durationList:o,startIndex:c,endIndex:h})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(c<0){for(let h=c;h<0;h++)if(a-=s.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};c=0}for(let h=c;h<o.length;h++){const m=o[h];a-=m.duration;const _=m.duration>ss,T=a===0,S=_&&a+ss>=0;if(!((T||S)&&h!==o.length-1)){if(i){if(a>0)continue}else if(a-ss>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r+ri({defaultDuration:s.targetDuration,durationList:o,startIndex:c,endIndex:h})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},tg=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},rd=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Eo=function(s){const e=tg(s);return!s.disabled&&!e},BS=function(s){return s.disabled},FS=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},sg=function(s,e){return e.attributes&&e.attributes[s]},jS=function(s,e,t,n=0){return sg("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-n*8)/e:NaN},ql=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(n=>Eo(n)?(n.attributes.BANDWIDTH||0)<t:!1).length===0},id=(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),fh=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let n=!1;for(const r in t){for(const i in t[r])if(n=e(t[r][i]),n)break;if(n)break}return!!n},Si=s=>{if(!s||!s.playlists||!s.playlists.length)return fh(s,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],n=t.attributes&&t.attributes.CODECS;if(!(n&&n.split(",").every(r=>Op(r))||fh(s,r=>id(t,r))))return!1}return!0};var Et={liveEdgeDelay:Qf,duration:Jf,seekable:MS,getMediaInfoForTime:US,isEnabled:Eo,isDisabled:BS,isExcluded:tg,isIncompatible:rd,playlistEnd:eg,isAes:FS,hasAttribute:sg,estimateSegmentRequestTime:jS,isLowestEnabledRendition:ql,isAudioOnly:Si,playlistMatch:id,segmentDurationWithParts:nd};const{log:ng}=P,$n=(s,e)=>`${s}-${e}`,rg=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,qS=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:n=[],customTagMappers:r=[],llhls:i})=>{const a=new nT;s&&a.on("warn",s),e&&a.on("info",e),n.forEach(h=>a.addParser(h)),r.forEach(h=>a.addTagMapper(h)),a.push(t),a.end();const o=a.manifest;if(i||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(h){o.hasOwnProperty(h)&&delete o[h]}),o.segments&&o.segments.forEach(function(h){["parts","preloadHints"].forEach(function(m){h.hasOwnProperty(m)&&delete h[m]})})),!o.targetDuration){let h=10;o.segments&&o.segments.length&&(h=o.segments.reduce((m,_)=>Math.max(m,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${h}`}),o.targetDuration=h}const c=Yf(o);if(c.length&&!o.partTargetDuration){const h=c.reduce((m,_)=>Math.max(m,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${h}`}),ng.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=h}return o},fr=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const n in s.mediaGroups[t])for(const r in s.mediaGroups[t][n]){const i=s.mediaGroups[t][n][r];e(i,t,n,r)}})},ig=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},VS=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];ig({playlist:t,id:$n(e,t.uri)}),t.resolvedUri=St(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||ng.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},$S=s=>{fr(s,e=>{e.uri&&(e.resolvedUri=St(s.uri,e.uri))})},HS=(s,e)=>{const t=$n(0,e),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:I.location.href,resolvedUri:I.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return n.playlists[t]=n.playlists[0],n.playlists[e]=n.playlists[0],n},ag=(s,e,t=rg)=>{s.uri=e;for(let r=0;r<s.playlists.length;r++)if(!s.playlists[r].uri){const i=`placeholder-uri-${r}`;s.playlists[r].uri=i}const n=Si(s);fr(s,(r,i,a,o)=>{if(!r.playlists||!r.playlists.length){if(n&&i==="AUDIO"&&!r.uri)for(let c=0;c<s.playlists.length;c++){const h=s.playlists[c];if(h.attributes&&h.attributes.AUDIO&&h.attributes.AUDIO===a)return}r.playlists=[ze({},r)]}r.playlists.forEach(function(c,h){const m=t(i,a,o,c),_=$n(h,m);c.uri?c.resolvedUri=c.resolvedUri||St(s.uri,c.uri):(c.uri=h===0?m:_,c.resolvedUri=c.uri),c.id=c.id||_,c.attributes=c.attributes||{},s.playlists[c.id]=c,s.playlists[c.uri]=c})}),VS(s),$S(s)};class gh{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,n=t.startDate.getTime();this.trimProcessedDateRanges_(n),this.pendingDateRanges_=e.reduce((r,i)=>(r.set(i.id,i),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((n,r)=>{if(!this.processedDateRanges_.has(r)&&(n.startTime=n.startDate.getTime()/1e3-this.offset_,n.processDateRange=()=>this.processDateRange(n),t.push(n),!!n.class))if(e[n.class]){const i=e[n.class].push(n);n.classListIndex=i-1}else e[n.class]=[n],n.classListIndex=0});for(const n of t){const r=e[n.class]||[];n.endDate?n.endTime=n.endDate.getTime()/1e3-this.offset_:n.endOnNext&&r[n.classListIndex+1]?n.endTime=r[n.classListIndex+1].startTime:n.duration?n.endTime=n.startTime+n.duration:n.plannedDuration?n.endTime=n.startTime+n.plannedDuration:n.endTime=n.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,n)=>{t.startDate.getTime()<e&&this.processedDateRanges_.delete(n)})}}const og=22,pn=({requestType:s,request:e,error:t,parseFailure:n})=>{const r=e.status<200||e.status>299,i=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},o=r&&!i||n;if(t&&i)a.error=ze({},t),a.errorType=P.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=P.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=P.Error.NetworkRequestTimeout;else if(o){const c=n?P.Error.NetworkBodyParserFailed:P.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},{EventTarget:WS}=P,zS=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:n}=e;let r=e.mediaSequence+e.segments.length;if(n){const i=n.parts||[],a=Kf(e)-1;a>-1&&a!==i.length-1&&(t._HLS_part=a),(a>-1||i.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 n=new I.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){t.hasOwnProperty(r)&&n.searchParams.set(r,t[r])}),s=n.toString()}return s},GS=(s,e)=>{if(!s)return e;const t=ve(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 n=0;n<e.parts.length;n++)s.parts&&s.parts[n]&&(t.parts[n]=ve(s.parts[n],e.parts[n]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},XS=(s,e,t)=>{const n=s.slice(),r=e.slice();t=t||0;const i=[];let a;for(let o=0;o<r.length;o++){const c=n[o+t],h=r[o];c?(a=c.map||a,i.push(GS(c,h))):(a&&!h.map&&(h.map=a),i.push(h))}return i},lg=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=St(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=St(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=St(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=St(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=St(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=St(e,t.uri))})},cg=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let n=0;n<t.preloadHints.length;n++)if(t.preloadHints[n].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},dg=(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,Vl=(s,e,t=dg)=>{const n=ve(s,{}),r=n.playlists[e.id];if(!r||t(r,e))return null;e.segments=cg(e);const i=ve(r,e);if(i.preloadSegment&&!e.preloadSegment&&delete i.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}i.segments=XS(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}i.segments.forEach(a=>{lg(a,i.resolvedUri)});for(let a=0;a<n.playlists.length;a++)n.playlists[a].id===e.id&&(n.playlists[a]=i);return n.playlists[e.id]=i,n.playlists[e.uri]=i,fr(s,(a,o,c,h)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=i)}),n},$l=(s,e)=>{const t=s.segments||[],n=t[t.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],i=r&&r.duration||n&&n.duration;return e&&i?i*1e3:(s.partTargetDuration||s.targetDuration||10)*500},yh=(s,e,t)=>{if(!s)return;const n=[];return s.forEach(r=>{if(!r.attributes)return;const{BANDWIDTH:i,RESOLUTION:a,CODECS:o}=r.attributes;n.push({id:r.id,bandwidth:i,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:n}};class Bn extends WS{constructor(e,t,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=jt("PlaylistLoader");const{withCredentials:r=!1}=n;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=n.addDateRangesToTextTrack;const i=t.options_;this.customTagParsers=i&&i.customTagParsers||[],this.customTagMappers=i&&i.customTagMappers||[],this.llhls=i&&i.llhls,this.dateRangesStorage_=new gh,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=St(this.main.uri,e.uri);this.llhls&&(t=zS(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(n,r)=>{if(this.request){if(n)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,n){const{uri:r,id:i}=t;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[i],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:pn({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return qS({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(n){this.error=n,this.error.metadata={errorType:P.Error.StreamingHlsPlaylistParserError,error:n}}}haveMetadata({playlistString:e,playlistObject:t,url:n,id:r}){this.request=null,this.state="HAVE_METADATA";const i={playlistInfo:{type:"media",uri:n}};this.trigger({type:"playlistparsestart",metadata:i});const a=t||this.parseManifest_({url:n,manifestString:e});a.lastRequest=Date.now(),ig({playlist:a,uri:n,id:r});const o=Vl(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_($l(this.media(),!!o)),i.parsedPlaylist=yh(this.main.playlists,i.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:i}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),I.clearTimeout(this.mediaUpdateTimeout),I.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new gh,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(I.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=I.setTimeout(this.media.bind(this,e,!1),o);return}const n=this.state,r=!this.media_||e.id!==this.media_.id,i=this.main.playlists[e.id];if(i&&i.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"),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_($l(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"},(o,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Ha(e.resolvedUri,c),o)return this.playlistRequestError(this.request,e,n);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(I.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&&(I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const n=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=I.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},n);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=I.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=I.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,n)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:n.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:n.responseText,code:2,metadata:pn({requestType:n.requestType,request:n,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Ha(this.src,n),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:n.responseText,url:this.src});e.parsedPlaylist=yh(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,ag(this.main,this.srcUri()),e.playlists.forEach(n=>{n.segments=cg(n),n.segments.forEach(r=>{lg(r,n.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||I.location.href;this.main=HS(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const n=this.main,r=e.ID;let i=n.playlists.length;for(;i--;){const a=n.playlists[i];if(a.attributes["PATHWAY-ID"]===r){const o=a.resolvedUri,c=a.id;if(t){const h=this.createCloneURI_(a.resolvedUri,e),m=$n(r,h),_=this.createCloneAttributes_(r,a.attributes),T=this.createClonePlaylist_(a,m,e,_);n.playlists[i]=T,n.playlists[m]=T,n.playlists[h]=T}else n.playlists.splice(i,1);delete n.playlists[c],delete n.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const n=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(i=>{if(!(!n.mediaGroups[i]||!n.mediaGroups[i][r])){for(const a in n.mediaGroups[i])if(a===r){for(const o in n.mediaGroups[i][a])n.mediaGroups[i][a][o].playlists.forEach((c,h)=>{const m=n.playlists[c.id],_=m.id,T=m.resolvedUri;delete n.playlists[_],delete n.playlists[T]});delete n.mediaGroups[i][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const n=this.main,r=n.playlists.length,i=this.createCloneURI_(t.resolvedUri,e),a=$n(e.ID,i),o=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,o);n.playlists[r]=c,n.playlists[a]=c,n.playlists[i]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,n=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(i=>{if(!(!r.mediaGroups[i]||r.mediaGroups[i][t]))for(const a in r.mediaGroups[i]){if(a===n)r.mediaGroups[i][t]={};else continue;for(const o in r.mediaGroups[i][a]){const c=r.mediaGroups[i][a][o];r.mediaGroups[i][t][o]=ze({},c);const h=r.mediaGroups[i][t][o],m=this.createCloneURI_(c.resolvedUri,e);h.resolvedUri=m,h.uri=m,h.playlists=[],c.playlists.forEach((_,T)=>{const S=r.playlists[_.id],w=rg(i,t,o),b=$n(t,w);if(S&&!r.playlists[b]){const R=this.createClonePlaylist_(S,b,e),L=R.resolvedUri;r.playlists[b]=R,r.playlists[L]=R}h.playlists[T]=this.createClonePlaylist_(_,b,e)})}}})}createClonePlaylist_(e,t,n,r){const i=this.createCloneURI_(e.resolvedUri,n),a={resolvedUri:i,uri:i,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),ve(e,a)}createCloneURI_(e,t){const n=new URL(e);n.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const i of Object.keys(r))n.searchParams.set(i,r[i]);return n.href}createCloneAttributes_(e,t){const n={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(n[r]=e)}),n}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const r=e.contentProtection[n].attributes.keyId;r&&t.add(r.toLowerCase())}return t}}}const Hl=function(s,e,t,n){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)))),n(e,s)},YS=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(n=>{t=n(t)}),t},KS=(s,e,t,n)=>{!s||!s.size||s.forEach(r=>{r(e,t,n)})},ug=function(){const s=function e(t,n){t=ve({timeout:45e3},t);const r=e.beforeRequest||P.Vhs.xhr.beforeRequest,i=e._requestCallbackSet||P.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||P.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(P.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(r));const o=P.Vhs.xhr.original===!0?P.xhr:P.Vhs.xhr,c=YS(i,t);i.delete(r);const h=o(c||t,function(_,T){return KS(a,h,_,T),Hl(h,_,T,n)}),m=h.abort;return h.abort=function(){return h.aborted=!0,m.apply(h,arguments)},h.uri=t.uri,h.requestType=t.requestType,h.requestTime=Date.now(),h};return s.original=!0,s},QS=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=I.BigInt(s.offset)+I.BigInt(s.length)-I.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},Wl=function(s){const e={};return s.byterange&&(e.Range=QS(s.byterange)),e},ZS=function(s,e){return s.start(e)+"-"+s.end(e)},JS=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},eE=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},hg=function(s){const e={};return Object.keys(s).forEach(t=>{const n=s[t];Up(n)?e[t]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:e[t]=n}),e},Wa=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},pg=function(s){return s.resolvedUri},mg=s=>{const e=Array.prototype.slice.call(s),t=16;let n="",r,i;for(let a=0;a<e.length/t;a++)r=e.slice(a*t,a*t+t).map(JS).join(""),i=e.slice(a*t,a*t+t).map(eE).join(""),n+=r+" "+i+`
|
|
194
|
-
`;return n},tE=({bytes:s})=>mg(s),sE=s=>{let e="",t;for(t=0;t<s.length;t++)e+=ZS(s,t)+" ";return e};var nE=Object.freeze({__proto__:null,createTransferableMessage:hg,initSegmentId:Wa,segmentKeyId:pg,hexDump:mg,tagDump:tE,textRanges:sE});const fg=.25,rE=(s,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,n=e.videoTimingInfo.transmuxedPresentationStart+t,r=s-n;return new Date(e.dateTimeObject.getTime()+r*1e3)},iE=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,aE=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let n=e.segments[0];if(t<new Date(n.dateTimeObject))return null;for(let c=0;c<e.segments.length-1;c++){n=e.segments[c];const h=new Date(e.segments[c+1].dateTimeObject);if(t<h)break}const r=e.segments[e.segments.length-1],i=r.dateTimeObject,a=r.videoTimingInfo?iE(r.videoTimingInfo):r.duration+r.duration*fg,o=new Date(i.getTime()+a*1e3);return t>o?null:(t>new Date(i)&&(n=r),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Et.duration(e,e.mediaSequence+e.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},oE=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,n;for(let i=0;i<e.segments.length&&(n=e.segments[i],t=n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:t+n.duration,!(s<=t));i++);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*fg)return null;n=r}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:t-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},lE=(s,e)=>{let t,n;try{t=new Date(s),n=new Date(e)}catch{}const r=t.getTime();return(n.getTime()-r)/1e3},cE=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},dE=({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 n=oE(e,s);if(!n)return t({message:"valid programTime was not found"});if(n.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const r={mediaSeconds:e},i=rE(e,n.segment);return i&&(r.programDateTime=i.toISOString()),t(null,r)},gg=({programTime:s,playlist:e,retryCount:t=2,seekTo:n,pauseAfterSeek:r=!0,tech:i,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!n)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!i.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!cE(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=aE(s,e);if(!o)return a({message:`${s} was not found in the stream`});const c=o.segment,h=lE(c.dateTimeObject,s);if(o.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});n(o.estimatedStart+h),i.one("seeked",()=>{gg({programTime:s,playlist:e,retryCount:t-1,seekTo:n,pauseAfterSeek:r,tech:i,callback:a})});return}const m=c.start+h,_=()=>a(null,i.currentTime());i.one("seeked",_),r&&i.pause(),n(m)},fl=(s,e)=>{if(s.readyState===4)return e()},uE=(s,e,t,n)=>{let r=[],i,a=!1;const o=function(m,_,T,S){return _.abort(),a=!0,t(m,_,T,S)},c=function(m,_){if(a)return;if(m)return m.metadata=pn({requestType:n,request:_,error:m}),o(m,_,"",r);const T=_.responseText.substring(r&&r.byteLength||0,_.responseText.length);if(r=fT(r,Bp(T,!0)),i=i||Wr(r),r.length<10||i&&r.length<i+2)return fl(_,()=>o(m,_,"",r));const S=kc(r);return S==="ts"&&r.length<188?fl(_,()=>o(m,_,"",r)):!S&&r.length<376?fl(_,()=>o(m,_,"",r)):o(null,_,S,r)},h=e({uri:s,beforeSend(m){m.overrideMimeType("text/plain; charset=x-user-defined"),m.addEventListener("progress",function({total:_,loaded:T}){return Hl(m,null,{statusCode:m.status},c)})}},function(m,_){return Hl(h,m,_,c)});return h},{EventTarget:hE}=P,_h=function(s,e){if(!dg(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length)||!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 n=s.segments[t],r=e.segments[t];if(n.uri!==r.uri)return!1;if(!n.byterange&&!r.byterange)continue;const i=n.byterange,a=r.byterange;if(i&&!a||!i&&a||i.offset!==a.offset||i.length!==a.length)return!1}return!0},pE=(s,e,t,n)=>{const r=n.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},mE=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:n,previousManifest:r})=>{const i=M1(s,{manifestUri:e,clientOffset:t,sidxMapping:n,previousManifest:r});return ag(i,e,pE),i},fE=(s,e)=>{fr(s,(t,n,r,i)=>{(!e.mediaGroups[n][r]||!(i in e.mediaGroups[n][r]))&&delete s.mediaGroups[n][r][i]})},gE=(s,e,t)=>{let n=!0,r=ve(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let i=0;i<e.playlists.length;i++){const a=e.playlists[i];if(a.sidx){const c=ro(a.sidx);t&&t[c]&&t[c].sidx&&Sc(a,t[c].sidx,a.sidx.resolvedUri)}const o=Vl(r,a,_h);o&&(r=o,n=!1)}return fr(e,(i,a,o,c)=>{if(i.playlists&&i.playlists.length){const h=i.playlists[0].id,m=Vl(r,i.playlists[0],_h);m&&(r=m,c in r.mediaGroups[a][o]||(r.mediaGroups[a][o][c]=i),r.mediaGroups[a][o][c].playlists[0]=r.playlists[h],n=!1)}}),fE(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(n=!1),n?null:r},yE=(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,vh=(s,e)=>{const t={};for(const n in s){const r=s[n].sidx;if(r){const i=ro(r);if(!e[i])break;const a=e[i].sidxInfo;yE(a,r)&&(t[i]=e[i])}}return t},_E=(s,e)=>{let t=vh(s.playlists,e);return fr(s,(n,r,i,a)=>{if(n.playlists&&n.playlists.length){const o=n.playlists;t=ve(t,vh(o,e))}}),t};class zl extends hE{constructor(e,t,n={},r){super(),this.isPaused_=!0,this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:i=!1}=n;if(this.vhs_=t,this.withCredentials=i,this.addMetadataToTextTrack=n.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_=jt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,n){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},n&&(this.state=n),this.trigger("error"),!0}addSidxSegments_(e,t,n){const r=e.sidx&&ro(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=I.setTimeout(()=>n(!1),0);return}const i=Ha(e.sidx.resolvedUri),a=(c,h)=>{if(this.requestErrored_(c,h,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=h;let T;try{T=V1(ie(h.response).subarray(8))}catch(S){S.metadata=pn({requestType:_,request:h,parseFailure:!0}),this.requestErrored_(S,h,t);return}return m[r]={sidxInfo:e.sidx,sidx:T},Sc(e,T,e.sidx.resolvedUri),n(!0)},o="dash-sidx";this.request=uE(i,this.vhs_.xhr,(c,h,m,_)=>{if(c)return a(c,h);if(!m||m!=="mp4"){const w=m||"unknown";return a({status:h.status,message:`Unsupported ${w} container type for sidx segment at URL: ${i}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},h)}const{offset:T,length:S}=e.sidx.byterange;if(_.length>=S+T)return a(c,{response:_.subarray(T,T+S),status:h.status,uri:h.uri});this.request=this.vhs_.xhr({uri:i,responseType:"arraybuffer",requestType:"dash-sidx",headers:Wl({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},I.clearTimeout(this.minimumUpdatePeriodTimeout_),I.clearTimeout(this.mediaRequest_),I.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 n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}n&&(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,I.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(),I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(I.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const n=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=I.setTimeout(()=>this.load(),n);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_){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=I.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"},(n,r)=>{if(n){const{requestType:a}=r;n.metadata=pn({requestType:a,request:r,error:n})}if(this.requestErrored_(n,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const i=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=Ha(this.mainPlaylistLoader_.srcUrl,r),i){this.handleMain_(),this.syncClientServerClock_(()=>e(r,i));return}return e(r,i)})}syncClientServerClock_(e){const t=U1(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:St(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(n,r)=>{if(!this.request)return;if(n){const{requestType:a}=r;return this.error.metadata=pn({requestType:a,request:r,error:n}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let i;t.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?i=this.mainLoaded_:i=Date.parse(r.responseHeaders.date):i=Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=i-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let n;try{n=mE({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(i){this.error=i,this.error.metadata={errorType:P.Error.StreamingDashManifestParserError,error:i},this.trigger("error")}e&&(n=gE(e,n,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=n||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||n&&n.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(n),n){const{duration:i,endList:a}=n,o=[];n.playlists.forEach(h=>{o.push({id:h.id,bandwidth:h.attributes.BANDWIDTH,resolution:h.attributes.RESOLUTION,codecs:h.attributes.CODECS})});const c={duration:i,isLive:!a,renditions:o};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!n}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(I.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_=I.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_=_E(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,n=>{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,n=!this.media_||this.media_!==t[e];if(n?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=I.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},$l(this.media(),!!n)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(n=>({cueTime:n.start,frames:[{data:n.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const r=e.contentProtection[n].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var Ze={GOAL_BUFFER_LENGTH:30,MAX_GOAL_BUFFER_LENGTH:60,BACK_BUFFER_LENGTH:30,GOAL_BUFFER_LENGTH_RATE:1,INITIAL_BANDWIDTH:4194304,BANDWIDTH_VARIANCE:1.2,BUFFER_LOW_WATER_LINE:0,MAX_BUFFER_LOW_WATER_LINE:30,EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:16,BUFFER_LOW_WATER_LINE_RATE:1,BUFFER_HIGH_WATER_LINE:30};const vE=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},yg=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},bE=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const e=new BlobBuilder;return e.append(s),URL.createObjectURL(e.getBlob())}},_g=function(s){return function(){const e=bE(s),t=yg(new Worker(e));t.objURL=e;const n=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),n.call(this)},t}},vg=function(s){return`var browserWorkerPolyFill = ${yg.toString()};
|
|
193
|
+
`}return e}const ss=1/30,ns=ss*3,Gf=function(s,e){const t=[];let n;if(s&&s.length)for(n=0;n<s.length;n++)e(s.start(n),s.end(n))&&t.push([s.start(n),s.end(n)]);return ct(t)},Un=function(s,e){return Gf(s,function(t,n){return t-ns<=e&&n+ns>=e})},ia=function(s,e){return Gf(s,function(t){return t-ss>=e})},NS=function(s){if(s.length<2)return ct();const e=[];for(let t=1;t<s.length;t++){const n=s.end(t-1),r=s.start(t);e.push([n,r])}return ct(e)},OS=function(s,e){let t=null,n=null,r=0;const i=[],a=[];if(!s||!s.length||!e||!e.length)return ct();let o=s.length;for(;o--;)i.push({time:s.start(o),type:"start"}),i.push({time:s.end(o),type:"end"});for(o=e.length;o--;)i.push({time:e.start(o),type:"start"}),i.push({time:e.end(o),type:"end"});for(i.sort(function(c,h){return c.time-h.time}),o=0;o<i.length;o++)i[o].type==="start"?(r++,r===2&&(t=i[o].time)):i[o].type==="end"&&(r--,r===1&&(n=i[o].time)),t!==null&&n!==null&&(a.push([t,n]),t=null,n=null);return ct(a)},Xf=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(", ")},MS=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},ln=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},US=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},ml=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},sd=function(s,e){let t=0;if(!s||!s.length)return t;for(let n=0;n<s.length;n++){const r=s.start(n),i=s.end(n);if(!(e>i)){if(e>r&&e<=i){t+=i-e;continue}t+=i-r}}return t},nd=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(n){t+=n.duration}),(e.preloadHints||[]).forEach(function(n){n.type==="PART"&&(t+=s.partTargetDuration)}),t},jl=s=>(s.segments||[]).reduce((e,t,n)=>(t.parts?t.parts.forEach(function(r,i){e.push({duration:r.duration,segmentIndex:n,partIndex:i,part:r,segment:t})}):e.push({duration:t.duration,segmentIndex:n,partIndex:null,segment:t,part:null}),e),[]),Yf=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},Kf=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let n=(t||[]).reduce((r,i)=>r+(i.type==="PART"?1:0),0);return n+=e&&e.length?e.length:0,n},Qf=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=Yf(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},BS=function(s,e){let t=0,n=e-s.mediaSequence,r=s.segments[n];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(;n--;){if(r=s.segments[n],typeof r.end<"u")return{result:t+r.end,precise:!0};if(t+=nd(s,r),typeof r.start<"u")return{result:t+r.start,precise:!0}}return{result:t,precise:!1}},FS=function(s,e){let t=0,n,r=e-s.mediaSequence;for(;r<s.segments.length;r++){if(n=s.segments[r],typeof n.start<"u")return{result:n.start-t,precise:!0};if(t+=nd(s,n),typeof n.end<"u")return{result:n.end-t,precise:!0}}return{result:-1,precise:!1}},Jf=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const n=BS(s,e);if(n.precise)return n.result;const r=FS(s,e);return r.precise?r.result:n.result+t},Zf=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 I.Infinity}return Jf(s,e,t)},ri=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:n}){let r=0;if(t>n&&([t,n]=[n,t]),t<0){for(let i=t;i<Math.min(0,n);i++)r+=s;t=0}for(let i=t;i<n;i++)r+=e[i].duration;return r},eg=function(s,e,t,n){if(!s||!s.segments)return null;if(s.endList)return Zf(s);if(e===null)return null;e=e||0;let r=Jf(s,s.mediaSequence+s.segments.length,e);return t&&(n=typeof n=="number"?n:Qf(null,s),r-=n),Math.max(0,r)},jS=function(s,e,t){const n=e||0;let r=eg(s,e,!0,t);return r===null?ct():(r<n&&(r=n),ct(n,r))},qS=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:n,startTime:r,exactManifestTimings:i}){let a=e-r;const o=jl(s);let c=0;for(let h=0;h<o.length;h++){const m=o[h];if(t===m.segmentIndex&&!(typeof n=="number"&&typeof m.partIndex=="number"&&n!==m.partIndex)){c=h;break}}if(a<0){if(c>0)for(let h=c-1;h>=0;h--){const m=o[h];if(a+=m.duration,i){if(a<0)continue}else if(a+ss<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r-ri({defaultDuration:s.targetDuration,durationList:o,startIndex:c,endIndex:h})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(c<0){for(let h=c;h<0;h++)if(a-=s.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};c=0}for(let h=c;h<o.length;h++){const m=o[h];a-=m.duration;const _=m.duration>ss,T=a===0,S=_&&a+ss>=0;if(!((T||S)&&h!==o.length-1)){if(i){if(a>0)continue}else if(a-ss>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:r+ri({defaultDuration:s.targetDuration,durationList:o,startIndex:c,endIndex:h})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},tg=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},rd=function(s){return s.excludeUntil&&s.excludeUntil===1/0},Eo=function(s){const e=tg(s);return!s.disabled&&!e},VS=function(s){return s.disabled},$S=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},sg=function(s,e){return e.attributes&&e.attributes[s]},HS=function(s,e,t,n=0){return sg("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-n*8)/e:NaN},ql=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(n=>Eo(n)?(n.attributes.BANDWIDTH||0)<t:!1).length===0},id=(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),_h=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let n=!1;for(const r in t){for(const i in t[r])if(n=e(t[r][i]),n)break;if(n)break}return!!n},Si=s=>{if(!s||!s.playlists||!s.playlists.length)return _h(s,e=>e.playlists&&e.playlists.length||e.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],n=t.attributes&&t.attributes.CODECS;if(!(n&&n.split(",").every(r=>Op(r))||_h(s,r=>id(t,r))))return!1}return!0};var Et={liveEdgeDelay:Qf,duration:Zf,seekable:jS,getMediaInfoForTime:qS,isEnabled:Eo,isDisabled:VS,isExcluded:tg,isIncompatible:rd,playlistEnd:eg,isAes:$S,hasAttribute:sg,estimateSegmentRequestTime:HS,isLowestEnabledRendition:ql,isAudioOnly:Si,playlistMatch:id,segmentDurationWithParts:nd};const{log:ng}=P,$n=(s,e)=>`${s}-${e}`,rg=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,WS=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:n=[],customTagMappers:r=[],llhls:i})=>{const a=new oT;s&&a.on("warn",s),e&&a.on("info",e),n.forEach(h=>a.addParser(h)),r.forEach(h=>a.addTagMapper(h)),a.push(t),a.end();const o=a.manifest;if(i||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(h){o.hasOwnProperty(h)&&delete o[h]}),o.segments&&o.segments.forEach(function(h){["parts","preloadHints"].forEach(function(m){h.hasOwnProperty(m)&&delete h[m]})})),!o.targetDuration){let h=10;o.segments&&o.segments.length&&(h=o.segments.reduce((m,_)=>Math.max(m,_.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${h}`}),o.targetDuration=h}const c=Yf(o);if(c.length&&!o.partTargetDuration){const h=c.reduce((m,_)=>Math.max(m,_.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${h}`}),ng.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=h}return o},fr=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const n in s.mediaGroups[t])for(const r in s.mediaGroups[t][n]){const i=s.mediaGroups[t][n][r];e(i,t,n,r)}})},ig=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},zS=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];ig({playlist:t,id:$n(e,t.uri)}),t.resolvedUri=St(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||ng.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},GS=s=>{fr(s,e=>{e.uri&&(e.resolvedUri=St(s.uri,e.uri))})},XS=(s,e)=>{const t=$n(0,e),n={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:I.location.href,resolvedUri:I.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return n.playlists[t]=n.playlists[0],n.playlists[e]=n.playlists[0],n},ag=(s,e,t=rg)=>{s.uri=e;for(let r=0;r<s.playlists.length;r++)if(!s.playlists[r].uri){const i=`placeholder-uri-${r}`;s.playlists[r].uri=i}const n=Si(s);fr(s,(r,i,a,o)=>{if(!r.playlists||!r.playlists.length){if(n&&i==="AUDIO"&&!r.uri)for(let c=0;c<s.playlists.length;c++){const h=s.playlists[c];if(h.attributes&&h.attributes.AUDIO&&h.attributes.AUDIO===a)return}r.playlists=[ze({},r)]}r.playlists.forEach(function(c,h){const m=t(i,a,o,c),_=$n(h,m);c.uri?c.resolvedUri=c.resolvedUri||St(s.uri,c.uri):(c.uri=h===0?m:_,c.resolvedUri=c.uri),c.id=c.id||_,c.attributes=c.attributes||{},s.playlists[c.id]=c,s.playlists[c.uri]=c})}),zS(s),GS(s)};class vh{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,n=t.startDate.getTime();this.trimProcessedDateRanges_(n),this.pendingDateRanges_=e.reduce((r,i)=>(r.set(i.id,i),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((n,r)=>{if(!this.processedDateRanges_.has(r)&&(n.startTime=n.startDate.getTime()/1e3-this.offset_,n.processDateRange=()=>this.processDateRange(n),t.push(n),!!n.class))if(e[n.class]){const i=e[n.class].push(n);n.classListIndex=i-1}else e[n.class]=[n],n.classListIndex=0});for(const n of t){const r=e[n.class]||[];n.endDate?n.endTime=n.endDate.getTime()/1e3-this.offset_:n.endOnNext&&r[n.classListIndex+1]?n.endTime=r[n.classListIndex+1].startTime:n.duration?n.endTime=n.startTime+n.duration:n.plannedDuration?n.endTime=n.startTime+n.plannedDuration:n.endTime=n.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((t,n)=>{t.startDate.getTime()<e&&this.processedDateRanges_.delete(n)})}}const og=22,pn=({requestType:s,request:e,error:t,parseFailure:n})=>{const r=e.status<200||e.status>299,i=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},o=r&&!i||n;if(t&&i)a.error=ze({},t),a.errorType=P.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=P.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=P.Error.NetworkRequestTimeout;else if(o){const c=n?P.Error.NetworkBodyParserFailed:P.Error.NetworkBadStatus;a.errorType=c,a.status=e.status,a.headers=e.headers}return a},{EventTarget:YS}=P,KS=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:n}=e;let r=e.mediaSequence+e.segments.length;if(n){const i=n.parts||[],a=Kf(e)-1;a>-1&&a!==i.length-1&&(t._HLS_part=a),(a>-1||i.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 n=new I.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(r){t.hasOwnProperty(r)&&n.searchParams.set(r,t[r])}),s=n.toString()}return s},QS=(s,e)=>{if(!s)return e;const t=ve(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 n=0;n<e.parts.length;n++)s.parts&&s.parts[n]&&(t.parts[n]=ve(s.parts[n],e.parts[n]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},JS=(s,e,t)=>{const n=s.slice(),r=e.slice();t=t||0;const i=[];let a;for(let o=0;o<r.length;o++){const c=n[o+t],h=r[o];c?(a=c.map||a,i.push(QS(c,h))):(a&&!h.map&&(h.map=a),i.push(h))}return i},lg=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=St(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=St(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=St(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=St(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=St(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=St(e,t.uri))})},cg=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let n=0;n<t.preloadHints.length;n++)if(t.preloadHints[n].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},dg=(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,Vl=(s,e,t=dg)=>{const n=ve(s,{}),r=n.playlists[e.id];if(!r||t(r,e))return null;e.segments=cg(e);const i=ve(r,e);if(i.preloadSegment&&!e.preloadSegment&&delete i.preloadSegment,r.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}i.segments=JS(r.segments,e.segments,e.mediaSequence-r.mediaSequence)}i.segments.forEach(a=>{lg(a,i.resolvedUri)});for(let a=0;a<n.playlists.length;a++)n.playlists[a].id===e.id&&(n.playlists[a]=i);return n.playlists[e.id]=i,n.playlists[e.uri]=i,fr(s,(a,o,c,h)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=i)}),n},$l=(s,e)=>{const t=s.segments||[],n=t[t.length-1],r=n&&n.parts&&n.parts[n.parts.length-1],i=r&&r.duration||n&&n.duration;return e&&i?i*1e3:(s.partTargetDuration||s.targetDuration||10)*500},bh=(s,e,t)=>{if(!s)return;const n=[];return s.forEach(r=>{if(!r.attributes)return;const{BANDWIDTH:i,RESOLUTION:a,CODECS:o}=r.attributes;n.push({id:r.id,bandwidth:i,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:n}};class Bn extends YS{constructor(e,t,n={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=jt("PlaylistLoader");const{withCredentials:r=!1}=n;this.src=e,this.vhs_=t,this.withCredentials=r,this.addDateRangesToTextTrack_=n.addDateRangesToTextTrack;const i=t.options_;this.customTagParsers=i&&i.customTagParsers||[],this.customTagMappers=i&&i.customTagMappers||[],this.llhls=i&&i.llhls,this.dateRangesStorage_=new vh,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=St(this.main.uri,e.uri);this.llhls&&(t=KS(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(n,r)=>{if(this.request){if(n)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,n){const{uri:r,id:i}=t;this.request=null,n&&(this.state=n),this.error={playlist:this.main.playlists[i],status:e.status,message:`HLS playlist request error at URL: ${r}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:pn({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return WS({onwarn:({message:n})=>this.logger_(`m3u8-parser warn for ${e}: ${n}`),oninfo:({message:n})=>this.logger_(`m3u8-parser info for ${e}: ${n}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(n){this.error=n,this.error.metadata={errorType:P.Error.StreamingHlsPlaylistParserError,error:n}}}haveMetadata({playlistString:e,playlistObject:t,url:n,id:r}){this.request=null,this.state="HAVE_METADATA";const i={playlistInfo:{type:"media",uri:n}};this.trigger({type:"playlistparsestart",metadata:i});const a=t||this.parseManifest_({url:n,manifestString:e});a.lastRequest=Date.now(),ig({playlist:a,uri:n,id:r});const o=Vl(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[r]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_($l(this.media(),!!o)),i.parsedPlaylist=bh(this.main.playlists,i.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:i}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),I.clearTimeout(this.mediaUpdateTimeout),I.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new vh,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(I.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=I.setTimeout(this.media.bind(this,e,!1),o);return}const n=this.state,r=!this.media_||e.id!==this.media_.id,i=this.main.playlists[e.id];if(i&&i.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"),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_($l(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"},(o,c)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Ha(e.resolvedUri,c),o)return this.playlistRequestError(this.request,e,n);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:c.responseText,url:e.uri,id:e.id}),n==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(I.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&&(I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const n=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=I.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},n);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=I.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=I.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,n)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:n.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:n.responseText,code:2,metadata:pn({requestType:n.requestType,request:n,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Ha(this.src,n),this.trigger({type:"playlistparsestart",metadata:e});const r=this.parseManifest_({manifestString:n.responseText,url:this.src});e.parsedPlaylist=bh(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,ag(this.main,this.srcUri()),e.playlists.forEach(n=>{n.segments=cg(n),n.segments.forEach(r=>{lg(r,n.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||I.location.href;this.main=XS(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const n=this.main,r=e.ID;let i=n.playlists.length;for(;i--;){const a=n.playlists[i];if(a.attributes["PATHWAY-ID"]===r){const o=a.resolvedUri,c=a.id;if(t){const h=this.createCloneURI_(a.resolvedUri,e),m=$n(r,h),_=this.createCloneAttributes_(r,a.attributes),T=this.createClonePlaylist_(a,m,e,_);n.playlists[i]=T,n.playlists[m]=T,n.playlists[h]=T}else n.playlists.splice(i,1);delete n.playlists[c],delete n.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const n=this.main,r=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(i=>{if(!(!n.mediaGroups[i]||!n.mediaGroups[i][r])){for(const a in n.mediaGroups[i])if(a===r){for(const o in n.mediaGroups[i][a])n.mediaGroups[i][a][o].playlists.forEach((c,h)=>{const m=n.playlists[c.id],_=m.id,T=m.resolvedUri;delete n.playlists[_],delete n.playlists[T]});delete n.mediaGroups[i][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const n=this.main,r=n.playlists.length,i=this.createCloneURI_(t.resolvedUri,e),a=$n(e.ID,i),o=this.createCloneAttributes_(e.ID,t.attributes),c=this.createClonePlaylist_(t,a,e,o);n.playlists[r]=c,n.playlists[a]=c,n.playlists[i]=c,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,n=e["BASE-ID"],r=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(i=>{if(!(!r.mediaGroups[i]||r.mediaGroups[i][t]))for(const a in r.mediaGroups[i]){if(a===n)r.mediaGroups[i][t]={};else continue;for(const o in r.mediaGroups[i][a]){const c=r.mediaGroups[i][a][o];r.mediaGroups[i][t][o]=ze({},c);const h=r.mediaGroups[i][t][o],m=this.createCloneURI_(c.resolvedUri,e);h.resolvedUri=m,h.uri=m,h.playlists=[],c.playlists.forEach((_,T)=>{const S=r.playlists[_.id],w=rg(i,t,o),b=$n(t,w);if(S&&!r.playlists[b]){const R=this.createClonePlaylist_(S,b,e),L=R.resolvedUri;r.playlists[b]=R,r.playlists[L]=R}h.playlists[T]=this.createClonePlaylist_(_,b,e)})}}})}createClonePlaylist_(e,t,n,r){const i=this.createCloneURI_(e.resolvedUri,n),a={resolvedUri:i,uri:i,id:t};return e.segments&&(a.segments=[]),r&&(a.attributes=r),ve(e,a)}createCloneURI_(e,t){const n=new URL(e);n.hostname=t["URI-REPLACEMENT"].HOST;const r=t["URI-REPLACEMENT"].PARAMS;for(const i of Object.keys(r))n.searchParams.set(i,r[i]);return n.href}createCloneAttributes_(e,t){const n={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{t[r]&&(n[r]=e)}),n}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const r=e.contentProtection[n].attributes.keyId;r&&t.add(r.toLowerCase())}return t}}}const Hl=function(s,e,t,n){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)))),n(e,s)},ZS=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(n=>{t=n(t)}),t},eE=(s,e,t,n)=>{!s||!s.size||s.forEach(r=>{r(e,t,n)})},ug=function(){const s=function e(t,n){t=ve({timeout:45e3},t);const r=e.beforeRequest||P.Vhs.xhr.beforeRequest,i=e._requestCallbackSet||P.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||P.Vhs.xhr._responseCallbackSet;r&&typeof r=="function"&&(P.log.warn("beforeRequest is deprecated, use onRequest instead."),i.add(r));const o=P.Vhs.xhr.original===!0?P.xhr:P.Vhs.xhr,c=ZS(i,t);i.delete(r);const h=o(c||t,function(_,T){return eE(a,h,_,T),Hl(h,_,T,n)}),m=h.abort;return h.abort=function(){return h.aborted=!0,m.apply(h,arguments)},h.uri=t.uri,h.requestType=t.requestType,h.requestTime=Date.now(),h};return s.original=!0,s},tE=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=I.BigInt(s.offset)+I.BigInt(s.length)-I.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},Wl=function(s){const e={};return s.byterange&&(e.Range=tE(s.byterange)),e},sE=function(s,e){return s.start(e)+"-"+s.end(e)},nE=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},rE=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},hg=function(s){const e={};return Object.keys(s).forEach(t=>{const n=s[t];Up(n)?e[t]={bytes:n.buffer,byteOffset:n.byteOffset,byteLength:n.byteLength}:e[t]=n}),e},Wa=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},pg=function(s){return s.resolvedUri},mg=s=>{const e=Array.prototype.slice.call(s),t=16;let n="",r,i;for(let a=0;a<e.length/t;a++)r=e.slice(a*t,a*t+t).map(nE).join(""),i=e.slice(a*t,a*t+t).map(rE).join(""),n+=r+" "+i+`
|
|
194
|
+
`;return n},iE=({bytes:s})=>mg(s),aE=s=>{let e="",t;for(t=0;t<s.length;t++)e+=sE(s,t)+" ";return e};var oE=Object.freeze({__proto__:null,createTransferableMessage:hg,initSegmentId:Wa,segmentKeyId:pg,hexDump:mg,tagDump:iE,textRanges:aE});const fg=.25,lE=(s,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,n=e.videoTimingInfo.transmuxedPresentationStart+t,r=s-n;return new Date(e.dateTimeObject.getTime()+r*1e3)},cE=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,dE=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let n=e.segments[0];if(t<new Date(n.dateTimeObject))return null;for(let c=0;c<e.segments.length-1;c++){n=e.segments[c];const h=new Date(e.segments[c+1].dateTimeObject);if(t<h)break}const r=e.segments[e.segments.length-1],i=r.dateTimeObject,a=r.videoTimingInfo?cE(r.videoTimingInfo):r.duration+r.duration*fg,o=new Date(i.getTime()+a*1e3);return t>o?null:(t>new Date(i)&&(n=r),{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:Et.duration(e,e.mediaSequence+e.segments.indexOf(n)),type:n.videoTimingInfo?"accurate":"estimate"})},uE=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,n;for(let i=0;i<e.segments.length&&(n=e.segments[i],t=n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationEnd:t+n.duration,!(s<=t));i++);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*fg)return null;n=r}return{segment:n,estimatedStart:n.videoTimingInfo?n.videoTimingInfo.transmuxedPresentationStart:t-n.duration,type:n.videoTimingInfo?"accurate":"estimate"}},hE=(s,e)=>{let t,n;try{t=new Date(s),n=new Date(e)}catch{}const r=t.getTime();return(n.getTime()-r)/1e3},pE=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},mE=({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 n=uE(e,s);if(!n)return t({message:"valid programTime was not found"});if(n.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:n.estimatedStart});const r={mediaSeconds:e},i=lE(e,n.segment);return i&&(r.programDateTime=i.toISOString()),t(null,r)},gg=({programTime:s,playlist:e,retryCount:t=2,seekTo:n,pauseAfterSeek:r=!0,tech:i,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!n)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!i.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!pE(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=dE(s,e);if(!o)return a({message:`${s} was not found in the stream`});const c=o.segment,h=hE(c.dateTimeObject,s);if(o.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});n(o.estimatedStart+h),i.one("seeked",()=>{gg({programTime:s,playlist:e,retryCount:t-1,seekTo:n,pauseAfterSeek:r,tech:i,callback:a})});return}const m=c.start+h,_=()=>a(null,i.currentTime());i.one("seeked",_),r&&i.pause(),n(m)},fl=(s,e)=>{if(s.readyState===4)return e()},fE=(s,e,t,n)=>{let r=[],i,a=!1;const o=function(m,_,T,S){return _.abort(),a=!0,t(m,_,T,S)},c=function(m,_){if(a)return;if(m)return m.metadata=pn({requestType:n,request:_,error:m}),o(m,_,"",r);const T=_.responseText.substring(r&&r.byteLength||0,_.responseText.length);if(r=vT(r,Bp(T,!0)),i=i||Wr(r),r.length<10||i&&r.length<i+2)return fl(_,()=>o(m,_,"",r));const S=kc(r);return S==="ts"&&r.length<188?fl(_,()=>o(m,_,"",r)):!S&&r.length<376?fl(_,()=>o(m,_,"",r)):o(null,_,S,r)},h=e({uri:s,beforeSend(m){m.overrideMimeType("text/plain; charset=x-user-defined"),m.addEventListener("progress",function({total:_,loaded:T}){return Hl(m,null,{statusCode:m.status},c)})}},function(m,_){return Hl(h,m,_,c)});return h},{EventTarget:gE}=P,Th=function(s,e){if(!dg(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length)||!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 n=s.segments[t],r=e.segments[t];if(n.uri!==r.uri)return!1;if(!n.byterange&&!r.byterange)continue;const i=n.byterange,a=r.byterange;if(i&&!a||!i&&a||i.offset!==a.offset||i.length!==a.length)return!1}return!0},yE=(s,e,t,n)=>{const r=n.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${r}`},_E=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:n,previousManifest:r})=>{const i=j1(s,{manifestUri:e,clientOffset:t,sidxMapping:n,previousManifest:r});return ag(i,e,yE),i},vE=(s,e)=>{fr(s,(t,n,r,i)=>{(!e.mediaGroups[n][r]||!(i in e.mediaGroups[n][r]))&&delete s.mediaGroups[n][r][i]})},bE=(s,e,t)=>{let n=!0,r=ve(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let i=0;i<e.playlists.length;i++){const a=e.playlists[i];if(a.sidx){const c=ro(a.sidx);t&&t[c]&&t[c].sidx&&Sc(a,t[c].sidx,a.sidx.resolvedUri)}const o=Vl(r,a,Th);o&&(r=o,n=!1)}return fr(e,(i,a,o,c)=>{if(i.playlists&&i.playlists.length){const h=i.playlists[0].id,m=Vl(r,i.playlists[0],Th);m&&(r=m,c in r.mediaGroups[a][o]||(r.mediaGroups[a][o][c]=i),r.mediaGroups[a][o][c].playlists[0]=r.playlists[h],n=!1)}}),vE(r,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(n=!1),n?null:r},TE=(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,Ah=(s,e)=>{const t={};for(const n in s){const r=s[n].sidx;if(r){const i=ro(r);if(!e[i])break;const a=e[i].sidxInfo;TE(a,r)&&(t[i]=e[i])}}return t},AE=(s,e)=>{let t=Ah(s.playlists,e);return fr(s,(n,r,i,a)=>{if(n.playlists&&n.playlists.length){const o=n.playlists;t=ve(t,Ah(o,e))}}),t};class zl extends gE{constructor(e,t,n={},r){super(),this.isPaused_=!0,this.mainPlaylistLoader_=r||this,r||(this.isMain_=!0);const{withCredentials:i=!1}=n;if(this.vhs_=t,this.withCredentials=i,this.addMetadataToTextTrack=n.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_=jt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,n){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},n&&(this.state=n),this.trigger("error"),!0}addSidxSegments_(e,t,n){const r=e.sidx&&ro(e.sidx);if(!e.sidx||!r||this.mainPlaylistLoader_.sidxMapping_[r]){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=I.setTimeout(()=>n(!1),0);return}const i=Ha(e.sidx.resolvedUri),a=(c,h)=>{if(this.requestErrored_(c,h,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:_}=h;let T;try{T=z1(ae(h.response).subarray(8))}catch(S){S.metadata=pn({requestType:_,request:h,parseFailure:!0}),this.requestErrored_(S,h,t);return}return m[r]={sidxInfo:e.sidx,sidx:T},Sc(e,T,e.sidx.resolvedUri),n(!0)},o="dash-sidx";this.request=fE(i,this.vhs_.xhr,(c,h,m,_)=>{if(c)return a(c,h);if(!m||m!=="mp4"){const w=m||"unknown";return a({status:h.status,message:`Unsupported ${w} container type for sidx segment at URL: ${i}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},h)}const{offset:T,length:S}=e.sidx.byterange;if(_.length>=S+T)return a(c,{response:_.subarray(T,T+S),status:h.status,uri:h.uri});this.request=this.vhs_.xhr({uri:i,responseType:"arraybuffer",requestType:"dash-sidx",headers:Wl({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},I.clearTimeout(this.minimumUpdatePeriodTimeout_),I.clearTimeout(this.mediaRequest_),I.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 n=!this.media_||e.id!==this.media_.id;if(n&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,n&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}n&&(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,I.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(),I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(I.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,I.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const n=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=I.setTimeout(()=>this.load(),n);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_){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=I.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"},(n,r)=>{if(n){const{requestType:a}=r;n.metadata=pn({requestType:a,request:r,error:n})}if(this.requestErrored_(n,r)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const i=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=Ha(this.mainPlaylistLoader_.srcUrl,r),i){this.handleMain_(),this.syncClientServerClock_(()=>e(r,i));return}return e(r,i)})}syncClientServerClock_(e){const t=q1(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:St(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(n,r)=>{if(!this.request)return;if(n){const{requestType:a}=r;return this.error.metadata=pn({requestType:a,request:r,error:n}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let i;t.method==="HEAD"?!r.responseHeaders||!r.responseHeaders.date?i=this.mainLoaded_:i=Date.parse(r.responseHeaders.date):i=Date.parse(r.responseText),this.mainPlaylistLoader_.clientOffset_=i-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){I.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let n;try{n=_E({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(i){this.error=i,this.error.metadata={errorType:P.Error.StreamingDashManifestParserError,error:i},this.trigger("error")}e&&(n=bE(e,n,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=n||e;const r=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(r&&r!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=r),(!e||n&&n.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(n),n){const{duration:i,endList:a}=n,o=[];n.playlists.forEach(h=>{o.push({id:h.id,bandwidth:h.attributes.BANDWIDTH,resolution:h.attributes.RESOLUTION,codecs:h.attributes.CODECS})});const c={duration:i,isLive:!a,renditions:o};t.parsedManifest=c,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!n}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(I.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_=I.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_=AE(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,n=>{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,n=!this.media_||this.media_!==t[e];if(n?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const r=()=>{this.media().endList||(this.mediaUpdateTimeout=I.setTimeout(()=>{this.trigger("mediaupdatetimeout"),r()},$l(this.media(),!!n)))};r()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(n=>({cueTime:n.start,frames:[{data:n.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const n in e.contentProtection){const r=e.contentProtection[n].attributes["cenc:default_KID"];r&&t.add(r.replace(/-/g,"").toLowerCase())}return t}}}var Je={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 SE=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},yg=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},EE=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const e=new BlobBuilder;return e.append(s),URL.createObjectURL(e.getBlob())}},_g=function(s){return function(){const e=EE(s),t=yg(new Worker(e));t.objURL=e;const n=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),n.call(this)},t}},vg=function(s){return`var browserWorkerPolyFill = ${yg.toString()};
|
|
195
195
|
browserWorkerPolyFill(self);
|
|
196
|
-
`+s},bg=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},TE=vg(bg(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Aa<"u"?Aa:typeof self<"u"?self:{},e=function(){this.init=function(){var l={};this.on=function(d,u){l[d]||(l[d]=[]),l[d]=l[d].concat(u)},this.off=function(d,u){var p;return l[d]?(p=l[d].indexOf(u),l[d]=l[d].slice(),l[d].splice(p,1),p>-1):!1},this.trigger=function(d){var u,p,g,y;if(u=l[d],!!u)if(arguments.length===2)for(g=u.length,p=0;p<g;++p)u[p].call(this,arguments[1]);else{for(y=[],p=arguments.length,p=1;p<arguments.length;++p)y.push(arguments[p]);for(g=u.length,p=0;p<g;++p)u[p].apply(this,y)}},this.dispose=function(){l={}}}};e.prototype.pipe=function(l){return this.on("data",function(d){l.push(d)}),this.on("done",function(d){l.flush(d)}),this.on("partialdone",function(d){l.partialFlush(d)}),this.on("endedtimeline",function(d){l.endTimeline(d)}),this.on("reset",function(d){l.reset(d)}),l},e.prototype.push=function(l){this.trigger("data",l)},e.prototype.flush=function(l){this.trigger("done",l)},e.prototype.partialFlush=function(l){this.trigger("partialdone",l)},e.prototype.endTimeline=function(l){this.trigger("endedtimeline",l)},e.prototype.reset=function(l){this.trigger("reset",l)};var t=e,n=Math.pow(2,32),r=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u;return d.getBigUint64?(u=d.getBigUint64(0),u<Number.MAX_SAFE_INTEGER?Number(u):u):d.getUint32(0)*n+d.getUint32(4)},i={getUint64:r,MAX_UINT32:n},a=i.MAX_UINT32,o,c,h,m,_,T,S,w,b,R,L,U,M,F,N,j,J,K,ne,he,oe,me,te,ue,z,G,fe,ye,Pe,Oe,tt,st,ut,be,Re,ps;(function(){var l;if(te={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(l in te)te.hasOwnProperty(l)&&(te[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);ue=new Uint8Array([105,115,111,109]),G=new Uint8Array([97,118,99,49]),z=new Uint8Array([0,0,0,1]),fe=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]),ye=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]),Pe={video:fe,audio:ye},st=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),tt=new Uint8Array([0,0,0,0,0,0,0,0]),ut=new Uint8Array([0,0,0,0,0,0,0,0]),be=ut,Re=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ps=ut,Oe=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(l){var d=[],u=0,p,g,y;for(p=1;p<arguments.length;p++)d.push(arguments[p]);for(p=d.length;p--;)u+=d[p].byteLength;for(g=new Uint8Array(u+8),y=new DataView(g.buffer,g.byteOffset,g.byteLength),y.setUint32(0,g.byteLength),g.set(l,4),p=0,u=8;p<d.length;p++)g.set(d[p],u),u+=d[p].byteLength;return g},c=function(){return o(te.dinf,o(te.dref,st))},h=function(l){return o(te.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,l.audioobjecttype<<3|l.samplingfrequencyindex>>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},m=function(){return o(te.ftyp,ue,z,ue,G)},j=function(l){return o(te.hdlr,Pe[l])},_=function(l){return o(te.mdat,l)},N=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,l.duration&255,85,196,0,0]);return l.samplerate&&(d[12]=l.samplerate>>>24&255,d[13]=l.samplerate>>>16&255,d[14]=l.samplerate>>>8&255,d[15]=l.samplerate&255),o(te.mdhd,d)},F=function(l){return o(te.mdia,N(l),j(l.type),S(l))},T=function(l){return o(te.mfhd,new Uint8Array([0,0,0,0,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255]))},S=function(l){return o(te.minf,l.type==="video"?o(te.vmhd,Oe):o(te.smhd,tt),c(),K(l))},w=function(l,d){for(var u=[],p=d.length;p--;)u[p]=he(d[p]);return o.apply(null,[te.moof,T(l)].concat(u))},b=function(l){for(var d=l.length,u=[];d--;)u[d]=U(l[d]);return o.apply(null,[te.moov,L(4294967295)].concat(u).concat(R(l)))},R=function(l){for(var d=l.length,u=[];d--;)u[d]=oe(l[d]);return o.apply(null,[te.mvex].concat(u))},L=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(te.mvhd,d)},J=function(l){var d=l.samples||[],u=new Uint8Array(4+d.length),p,g;for(g=0;g<d.length;g++)p=d[g].flags,u[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return o(te.sdtp,u)},K=function(l){return o(te.stbl,ne(l),o(te.stts,ps),o(te.stsc,be),o(te.stsz,Re),o(te.stco,ut))},function(){var l,d;ne=function(u){return o(te.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),u.type==="video"?l(u):d(u))},l=function(u){var p=u.sps||[],g=u.pps||[],y=[],E=[],k,C;for(k=0;k<p.length;k++)y.push((p[k].byteLength&65280)>>>8),y.push(p[k].byteLength&255),y=y.concat(Array.prototype.slice.call(p[k]));for(k=0;k<g.length;k++)E.push((g[k].byteLength&65280)>>>8),E.push(g[k].byteLength&255),E=E.concat(Array.prototype.slice.call(g[k]));if(C=[te.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,(u.width&65280)>>8,u.width&255,(u.height&65280)>>8,u.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(te.avcC,new Uint8Array([1,u.profileIdc,u.profileCompatibility,u.levelIdc,255].concat([p.length],y,[g.length],E))),o(te.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],u.sarRatio){var x=u.sarRatio[0],O=u.sarRatio[1];C.push(o(te.pasp,new Uint8Array([(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255,(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255])))}return o.apply(null,C)},d=function(u){return o(te.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(u.channelcount&65280)>>8,u.channelcount&255,(u.samplesize&65280)>>8,u.samplesize&255,0,0,0,0,(u.samplerate&65280)>>8,u.samplerate&255,0,0]),h(u))}}(),M=function(l){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,0,(l.duration&4278190080)>>24,(l.duration&16711680)>>16,(l.duration&65280)>>8,l.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,(l.width&65280)>>8,l.width&255,0,0,(l.height&65280)>>8,l.height&255,0,0]);return o(te.tkhd,d)},he=function(l){var d,u,p,g,y,E,k;return d=o(te.tfhd,new Uint8Array([0,0,0,58,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(l.baseMediaDecodeTime/a),k=Math.floor(l.baseMediaDecodeTime%a),u=o(te.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255])),y=92,l.type==="audio"?(p=me(l,y),o(te.traf,d,u,p)):(g=J(l),p=me(l,g.length+y),o(te.traf,d,u,p,g))},U=function(l){return l.duration=l.duration||4294967295,o(te.trak,M(l),F(l))},oe=function(l){var d=new Uint8Array([0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(d[d.length-1]=0),o(te.trex,d)},function(){var l,d,u;u=function(p,g){var y=0,E=0,k=0,C=0;return p.length&&(p[0].duration!==void 0&&(y=1),p[0].size!==void 0&&(E=2),p[0].flags!==void 0&&(k=4),p[0].compositionTimeOffset!==void 0&&(C=8)),[0,0,y|E|k|C,1,(p.length&4278190080)>>>24,(p.length&16711680)>>>16,(p.length&65280)>>>8,p.length&255,(g&4278190080)>>>24,(g&16711680)>>>16,(g&65280)>>>8,g&255]},d=function(p,g){var y,E,k,C,x,O;for(C=p.samples||[],g+=20+16*C.length,k=u(C,g),E=new Uint8Array(k.length+C.length*16),E.set(k),y=k.length,O=0;O<C.length;O++)x=C[O],E[y++]=(x.duration&4278190080)>>>24,E[y++]=(x.duration&16711680)>>>16,E[y++]=(x.duration&65280)>>>8,E[y++]=x.duration&255,E[y++]=(x.size&4278190080)>>>24,E[y++]=(x.size&16711680)>>>16,E[y++]=(x.size&65280)>>>8,E[y++]=x.size&255,E[y++]=x.flags.isLeading<<2|x.flags.dependsOn,E[y++]=x.flags.isDependedOn<<6|x.flags.hasRedundancy<<4|x.flags.paddingValue<<1|x.flags.isNonSyncSample,E[y++]=x.flags.degradationPriority&61440,E[y++]=x.flags.degradationPriority&15,E[y++]=(x.compositionTimeOffset&4278190080)>>>24,E[y++]=(x.compositionTimeOffset&16711680)>>>16,E[y++]=(x.compositionTimeOffset&65280)>>>8,E[y++]=x.compositionTimeOffset&255;return o(te.trun,E)},l=function(p,g){var y,E,k,C,x,O;for(C=p.samples||[],g+=20+8*C.length,k=u(C,g),y=new Uint8Array(k.length+C.length*8),y.set(k),E=k.length,O=0;O<C.length;O++)x=C[O],y[E++]=(x.duration&4278190080)>>>24,y[E++]=(x.duration&16711680)>>>16,y[E++]=(x.duration&65280)>>>8,y[E++]=x.duration&255,y[E++]=(x.size&4278190080)>>>24,y[E++]=(x.size&16711680)>>>16,y[E++]=(x.size&65280)>>>8,y[E++]=x.size&255;return o(te.trun,y)},me=function(p,g){return p.type==="audio"?l(p,g):d(p,g)}}();var Gs={ftyp:m,mdat:_,moof:w,moov:b,initSegment:function(l){var d=m(),u=b(l),p;return p=new Uint8Array(d.byteLength+u.byteLength),p.set(d),p.set(u,d.byteLength),p}},ms=function(l){var d,u,p=[],g=[];for(g.byteLength=0,g.nalCount=0,g.duration=0,p.byteLength=0,d=0;d<l.length;d++)u=l[d],u.nalUnitType==="access_unit_delimiter_rbsp"?(p.length&&(p.duration=u.dts-p.dts,g.byteLength+=p.byteLength,g.nalCount+=p.length,g.duration+=p.duration,g.push(p)),p=[u],p.byteLength=u.data.byteLength,p.pts=u.pts,p.dts=u.dts):(u.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(p.keyFrame=!0),p.duration=u.dts-p.dts,p.byteLength+=u.data.byteLength,p.push(u));return g.length&&(!p.duration||p.duration<=0)&&(p.duration=g[g.length-1].duration),g.byteLength+=p.byteLength,g.nalCount+=p.length,g.duration+=p.duration,g.push(p),g},Gt=function(l){var d,u,p=[],g=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=l[0].pts,p.dts=l[0].dts,g.byteLength=0,g.nalCount=0,g.duration=0,g.pts=l[0].pts,g.dts=l[0].dts,d=0;d<l.length;d++)u=l[d],u.keyFrame?(p.length&&(g.push(p),g.byteLength+=p.byteLength,g.nalCount+=p.nalCount,g.duration+=p.duration),p=[u],p.nalCount=u.length,p.byteLength=u.byteLength,p.pts=u.pts,p.dts=u.dts,p.duration=u.duration):(p.duration+=u.duration,p.nalCount+=u.length,p.byteLength+=u.byteLength,p.push(u));return g.length&&p.duration<=0&&(p.duration=g[g.length-1].duration),g.byteLength+=p.byteLength,g.nalCount+=p.nalCount,g.duration+=p.duration,g.push(p),g},Cs=function(l){var d;return!l[0][0].keyFrame&&l.length>1&&(d=l.shift(),l.byteLength-=d.byteLength,l.nalCount-=d.nalCount,l[0][0].dts=d.dts,l[0][0].pts=d.pts,l[0][0].duration+=d.duration),l},Is=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},vn=function(l,d){var u=Is();return u.dataOffset=d,u.compositionTimeOffset=l.pts-l.dts,u.duration=l.duration,u.size=4*l.length,u.size+=l.byteLength,l.keyFrame&&(u.flags.dependsOn=2,u.flags.isNonSyncSample=0),u},Ei=function(l,d){var u,p,g,y,E,k=d||0,C=[];for(u=0;u<l.length;u++)for(y=l[u],p=0;p<y.length;p++)E=y[p],g=vn(E,k),k+=g.size,C.push(g);return C},wo=function(l){var d,u,p,g,y,E,k=0,C=l.byteLength,x=l.nalCount,O=C+4*x,V=new Uint8Array(O),ee=new DataView(V.buffer);for(d=0;d<l.length;d++)for(g=l[d],u=0;u<g.length;u++)for(y=g[u],p=0;p<y.length;p++)E=y[p],ee.setUint32(k,E.data.byteLength),k+=4,V.set(E.data,k),k+=E.data.byteLength;return V},wi=function(l,d){var u,p=d||0,g=[];return u=vn(l,p),g.push(u),g},xs=function(l){var d,u,p=0,g=l.byteLength,y=l.length,E=g+4*y,k=new Uint8Array(E),C=new DataView(k.buffer);for(d=0;d<l.length;d++)u=l[d],C.setUint32(p,u.data.byteLength),p+=4,k.set(u.data,p),p+=u.data.byteLength;return k},Xs={groupNalsIntoFrames:ms,groupFramesIntoGops:Gt,extendFirstKeyFrame:Cs,generateSampleTable:Ei,concatenateNalData:wo,generateSampleTableForFrame:wi,concatenateNalDataForFrame:xs},Xt=[33,16,5,32,164,27],_r=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],_e=function(l){for(var d=[];l--;)d.push(0);return d},ko=function(l){return Object.keys(l).reduce(function(d,u){return d[u]=new Uint8Array(l[u].reduce(function(p,g){return p.concat(g)},[])),d},{})},vr,ki=function(){if(!vr){var l={96e3:[Xt,[227,64],_e(154),[56]],88200:[Xt,[231],_e(170),[56]],64e3:[Xt,[248,192],_e(240),[56]],48e3:[Xt,[255,192],_e(268),[55,148,128],_e(54),[112]],44100:[Xt,[255,192],_e(268),[55,163,128],_e(84),[112]],32e3:[Xt,[255,192],_e(268),[55,234],_e(226),[112]],24e3:[Xt,[255,192],_e(268),[55,255,128],_e(268),[111,112],_e(126),[224]],16e3:[Xt,[255,192],_e(268),[55,255,128],_e(268),[111,255],_e(269),[223,108],_e(195),[1,192]],12e3:[_r,_e(268),[3,127,248],_e(268),[6,255,240],_e(268),[13,255,224],_e(268),[27,253,128],_e(259),[56]],11025:[_r,_e(268),[3,127,248],_e(268),[6,255,240],_e(268),[13,255,224],_e(268),[27,255,192],_e(268),[55,175,128],_e(108),[112]],8e3:[_r,_e(268),[3,121,16],_e(47),[7]]};vr=ko(l)}return vr},Ls=9e4,vt,Ys,bn,Dt,Ci,f,v;vt=function(l){return l*Ls},Ys=function(l,d){return l*d},bn=function(l){return l/Ls},Dt=function(l,d){return l/d},Ci=function(l,d){return vt(Dt(l,d))},f=function(l,d){return Ys(bn(l),d)},v=function(l,d,u){return bn(u?l:l-d)};var A={ONE_SECOND_IN_TS:Ls,secondsToVideoTs:vt,secondsToAudioTs:Ys,videoTsToSeconds:bn,audioTsToSeconds:Dt,audioTsToVideoTs:Ci,videoTsToAudioTs:f,metadataTsToSeconds:v},D=ki,B=A,H=function(l){var d,u,p=0;for(d=0;d<l.length;d++)u=l[d],p+=u.data.byteLength;return p},Q=function(l,d,u,p){var g,y=0,E=0,k=0,C=0,x,O,V;if(d.length&&(g=B.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),y=Math.ceil(B.ONE_SECOND_IN_TS/(l.samplerate/1024)),u&&p&&(E=g-Math.max(u,p),k=Math.floor(E/y),C=k*y),!(k<1||C>B.ONE_SECOND_IN_TS/2))){for(x=D()[l.samplerate],x||(x=d[0].data),O=0;O<k;O++)V=d[0],d.splice(0,0,{data:x,dts:V.dts-y,pts:V.pts-y});return l.baseMediaDecodeTime-=Math.floor(B.videoTsToAudioTs(C,l.samplerate)),C}},ke=function(l,d,u){return d.minSegmentDts>=u?l:(d.minSegmentDts=1/0,l.filter(function(p){return p.dts>=u?(d.minSegmentDts=Math.min(d.minSegmentDts,p.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},Xe=function(l){var d,u,p=[];for(d=0;d<l.length;d++)u=l[d],p.push({size:u.data.byteLength,duration:1024});return p},xe=function(l){var d,u,p=0,g=new Uint8Array(H(l));for(d=0;d<l.length;d++)u=l[d],g.set(u.data,p),p+=u.data.byteLength;return g},Ee={prefixWithSilence:Q,trimAdtsFramesByEarliestDts:ke,generateSampleTable:Xe,concatenateFrameData:xe},qe=A.ONE_SECOND_IN_TS,Ty=function(l,d){typeof d.pts=="number"&&(l.timelineStartInfo.pts===void 0&&(l.timelineStartInfo.pts=d.pts),l.minSegmentPts===void 0?l.minSegmentPts=d.pts:l.minSegmentPts=Math.min(l.minSegmentPts,d.pts),l.maxSegmentPts===void 0?l.maxSegmentPts=d.pts:l.maxSegmentPts=Math.max(l.maxSegmentPts,d.pts)),typeof d.dts=="number"&&(l.timelineStartInfo.dts===void 0&&(l.timelineStartInfo.dts=d.dts),l.minSegmentDts===void 0?l.minSegmentDts=d.dts:l.minSegmentDts=Math.min(l.minSegmentDts,d.dts),l.maxSegmentDts===void 0?l.maxSegmentDts=d.dts:l.maxSegmentDts=Math.max(l.maxSegmentDts,d.dts))},Ay=function(l){delete l.minSegmentDts,delete l.maxSegmentDts,delete l.minSegmentPts,delete l.maxSegmentPts},Sy=function(l,d){var u,p,g=l.minSegmentDts;return d||(g-=l.timelineStartInfo.dts),u=l.timelineStartInfo.baseMediaDecodeTime,u+=g,u=Math.max(0,u),l.type==="audio"&&(p=l.samplerate/qe,u*=p,u=Math.floor(u)),u},Ey={clearDtsInfo:Ay,calculateTrackBaseMediaDecodeTime:Sy,collectDtsInfo:Ty},hd=4,wy=128,ky=function(l){for(var d=0,u={payloadType:-1,payloadSize:0},p=0,g=0;d<l.byteLength&&l[d]!==wy;){for(;l[d]===255;)p+=255,d++;for(p+=l[d++];l[d]===255;)g+=255,d++;if(g+=l[d++],!u.payload&&p===hd){var y=String.fromCharCode(l[d+3],l[d+4],l[d+5],l[d+6]);if(y==="GA94"){u.payloadType=p,u.payloadSize=g,u.payload=l.subarray(d,d+g);break}else u.payload=void 0}d+=g,p=0,g=0}return u},Cy=function(l){return l.payload[0]!==181||(l.payload[1]<<8|l.payload[2])!==49||String.fromCharCode(l.payload[3],l.payload[4],l.payload[5],l.payload[6])!=="GA94"||l.payload[7]!==3?null:l.payload.subarray(8,l.payload.length-1)},Iy=function(l,d){var u=[],p,g,y,E;if(!(d[0]&64))return u;for(g=d[0]&31,p=0;p<g;p++)y=p*3,E={type:d[y+2]&3,pts:l},d[y+2]&4&&(E.ccData=d[y+3]<<8|d[y+4],u.push(E));return u},xy=function(l){for(var d=l.byteLength,u=[],p=1,g,y;p<d-2;)l[p]===0&&l[p+1]===0&&l[p+2]===3?(u.push(p+2),p+=2):p++;if(u.length===0)return l;g=d-u.length,y=new Uint8Array(g);var E=0;for(p=0;p<g;E++,p++)E===u[0]&&(E++,u.shift()),y[p]=l[E];return y},pd={parseSei:ky,parseUserData:Cy,parseCaptionPackets:Iy,discardEmulationPreventionBytes:xy,USER_DATA_REGISTERED_ITU_T_T35:hd},Co=t,Ii=pd,bt=function(l){l=l||{},bt.prototype.init.call(this),this.parse708captions_=typeof l.parse708captions=="boolean"?l.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Me(0,0),new Me(0,1),new Me(1,0),new Me(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ce({captionServices:l.captionServices})),this.reset(),this.ccStreams_.forEach(function(d){d.on("data",this.trigger.bind(this,"data")),d.on("partialdone",this.trigger.bind(this,"partialdone")),d.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")))};bt.prototype=new Co,bt.prototype.push=function(l){var d,u,p;if(l.nalUnitType==="sei_rbsp"&&(d=Ii.parseSei(l.escapedRBSP),!!d.payload&&d.payloadType===Ii.USER_DATA_REGISTERED_ITU_T_T35&&(u=Ii.parseUserData(d),!!u))){if(l.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(l.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}p=Ii.parseCaptionPackets(l.pts,u),this.captionPackets_=this.captionPackets_.concat(p),this.latestDts_!==l.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=l.dts}},bt.prototype.flushCCStreams=function(l){this.ccStreams_.forEach(function(d){return l==="flush"?d.flush():d.partialFlush()},this)},bt.prototype.flushStream=function(l){if(!this.captionPackets_.length){this.flushCCStreams(l);return}this.captionPackets_.forEach(function(d,u){d.presortIndex=u}),this.captionPackets_.sort(function(d,u){return d.pts===u.pts?d.presortIndex-u.presortIndex:d.pts-u.pts}),this.captionPackets_.forEach(function(d){d.type<2?this.dispatchCea608Packet(d):this.dispatchCea708Packet(d)},this),this.captionPackets_.length=0,this.flushCCStreams(l)},bt.prototype.flush=function(){return this.flushStream("flush")},bt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},bt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(l){l.reset()})},bt.prototype.dispatchCea608Packet=function(l){this.setsTextOrXDSActive(l)?this.activeCea608Channel_[l.type]=null:this.setsChannel1Active(l)?this.activeCea608Channel_[l.type]=0:this.setsChannel2Active(l)&&(this.activeCea608Channel_[l.type]=1),this.activeCea608Channel_[l.type]!==null&&this.ccStreams_[(l.type<<1)+this.activeCea608Channel_[l.type]].push(l)},bt.prototype.setsChannel1Active=function(l){return(l.ccData&30720)===4096},bt.prototype.setsChannel2Active=function(l){return(l.ccData&30720)===6144},bt.prototype.setsTextOrXDSActive=function(l){return(l.ccData&28928)===256||(l.ccData&30974)===4138||(l.ccData&30974)===6186},bt.prototype.dispatchCea708Packet=function(l){this.parse708captions_&&this.cc708Stream_.push(l)};var Ly={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},Py=function(l){var d=Ly[l]||l;return l&4096&&l===d?"":String.fromCharCode(d)},xi=function(l){return 32<=l&&l<=127||160<=l&&l<=255},fs=function(l){this.windowNum=l,this.reset()};fs.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},fs.prototype.getText=function(){return this.rows.join(`
|
|
197
|
-
`)},fs.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},fs.prototype.newLine=function(l){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(l),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},fs.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},fs.prototype.addText=function(l){this.rows[this.rowIdx]+=l},fs.prototype.backspace=function(){if(!this.isEmpty()){var l=this.rows[this.rowIdx];this.rows[this.rowIdx]=l.substr(0,l.length-1)}};var Li=function(l,d,u){this.serviceNum=l,this.text="",this.currentWindow=new fs(-1),this.windows=[],this.stream=u,typeof d=="string"&&this.createTextDecoder(d)};Li.prototype.init=function(l,d){this.startPts=l;for(var u=0;u<8;u++)this.windows[u]=new fs(u),typeof d=="function"&&(this.windows[u].beforeRowOverflow=d)},Li.prototype.setCurrentWindow=function(l){this.currentWindow=this.windows[l]},Li.prototype.createTextDecoder=function(l){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(l)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+l+" encoding. "+d})}};var Ce=function(l){l=l||{},Ce.prototype.init.call(this);var d=this,u=l.captionServices||{},p={},g;Object.keys(u).forEach(y=>{g=u[y],/^SERVICE/.test(y)&&(p[y]=g.encoding)}),this.serviceEncodings=p,this.current708Packet=null,this.services={},this.push=function(y){y.type===3?(d.new708Packet(),d.add708Bytes(y)):(d.current708Packet===null&&d.new708Packet(),d.add708Bytes(y))}};Ce.prototype=new Co,Ce.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ce.prototype.add708Bytes=function(l){var d=l.ccData,u=d>>>8,p=d&255;this.current708Packet.ptsVals.push(l.pts),this.current708Packet.data.push(u),this.current708Packet.data.push(p)},Ce.prototype.push708Packet=function(){var l=this.current708Packet,d=l.data,u=null,p=null,g=0,y=d[g++];for(l.seq=y>>6,l.sizeCode=y&63;g<d.length;g++)y=d[g++],u=y>>5,p=y&31,u===7&&p>0&&(y=d[g++],u=y),this.pushServiceBlock(u,g,p),p>0&&(g+=p-1)},Ce.prototype.pushServiceBlock=function(l,d,u){var p,g=d,y=this.current708Packet.data,E=this.services[l];for(E||(E=this.initService(l,g));g<d+u&&g<y.length;g++)p=y[g],xi(p)?g=this.handleText(g,E):p===24?g=this.multiByteCharacter(g,E):p===16?g=this.extendedCommands(g,E):128<=p&&p<=135?g=this.setCurrentWindow(g,E):152<=p&&p<=159?g=this.defineWindow(g,E):p===136?g=this.clearWindows(g,E):p===140?g=this.deleteWindows(g,E):p===137?g=this.displayWindows(g,E):p===138?g=this.hideWindows(g,E):p===139?g=this.toggleWindows(g,E):p===151?g=this.setWindowAttributes(g,E):p===144?g=this.setPenAttributes(g,E):p===145?g=this.setPenColor(g,E):p===146?g=this.setPenLocation(g,E):p===143?E=this.reset(g,E):p===8?E.currentWindow.backspace():p===12?E.currentWindow.clearText():p===13?E.currentWindow.pendingNewLine=!0:p===14?E.currentWindow.clearText():p===141&&g++},Ce.prototype.extendedCommands=function(l,d){var u=this.current708Packet.data,p=u[++l];return xi(p)&&(l=this.handleText(l,d,{isExtended:!0})),l},Ce.prototype.getPts=function(l){return this.current708Packet.ptsVals[Math.floor(l/2)]},Ce.prototype.initService=function(l,d){var p="SERVICE"+l,u=this,p,g;return p in this.serviceEncodings&&(g=this.serviceEncodings[p]),this.services[l]=new Li(l,g,u),this.services[l].init(this.getPts(d),function(y){u.flushDisplayed(y,u.services[l])}),this.services[l]},Ce.prototype.handleText=function(l,d,u){var p=u&&u.isExtended,g=u&&u.isMultiByte,y=this.current708Packet.data,E=p?4096:0,k=y[l],C=y[l+1],x=d.currentWindow,O,V;function
|
|
196
|
+
`+s},bg=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},wE=vg(bg(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Aa<"u"?Aa:typeof self<"u"?self:{},e=function(){this.init=function(){var l={};this.on=function(d,u){l[d]||(l[d]=[]),l[d]=l[d].concat(u)},this.off=function(d,u){var p;return l[d]?(p=l[d].indexOf(u),l[d]=l[d].slice(),l[d].splice(p,1),p>-1):!1},this.trigger=function(d){var u,p,g,y;if(u=l[d],!!u)if(arguments.length===2)for(g=u.length,p=0;p<g;++p)u[p].call(this,arguments[1]);else{for(y=[],p=arguments.length,p=1;p<arguments.length;++p)y.push(arguments[p]);for(g=u.length,p=0;p<g;++p)u[p].apply(this,y)}},this.dispose=function(){l={}}}};e.prototype.pipe=function(l){return this.on("data",function(d){l.push(d)}),this.on("done",function(d){l.flush(d)}),this.on("partialdone",function(d){l.partialFlush(d)}),this.on("endedtimeline",function(d){l.endTimeline(d)}),this.on("reset",function(d){l.reset(d)}),l},e.prototype.push=function(l){this.trigger("data",l)},e.prototype.flush=function(l){this.trigger("done",l)},e.prototype.partialFlush=function(l){this.trigger("partialdone",l)},e.prototype.endTimeline=function(l){this.trigger("endedtimeline",l)},e.prototype.reset=function(l){this.trigger("reset",l)};var t=e,n=Math.pow(2,32),r=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u;return d.getBigUint64?(u=d.getBigUint64(0),u<Number.MAX_SAFE_INTEGER?Number(u):u):d.getUint32(0)*n+d.getUint32(4)},i={getUint64:r,MAX_UINT32:n},a=i.MAX_UINT32,o,c,h,m,_,T,S,w,b,R,L,U,M,F,N,j,J,Y,re,me,le,ge,se,he,z,ee,ce,ne,Pe,Oe,tt,st,ut,be,Re,ps;(function(){var l;if(se={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(l in se)se.hasOwnProperty(l)&&(se[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);he=new Uint8Array([105,115,111,109]),ee=new Uint8Array([97,118,99,49]),z=new Uint8Array([0,0,0,1]),ce=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]),ne=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]),Pe={video:ce,audio:ne},st=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),tt=new Uint8Array([0,0,0,0,0,0,0,0]),ut=new Uint8Array([0,0,0,0,0,0,0,0]),be=ut,Re=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),ps=ut,Oe=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(l){var d=[],u=0,p,g,y;for(p=1;p<arguments.length;p++)d.push(arguments[p]);for(p=d.length;p--;)u+=d[p].byteLength;for(g=new Uint8Array(u+8),y=new DataView(g.buffer,g.byteOffset,g.byteLength),y.setUint32(0,g.byteLength),g.set(l,4),p=0,u=8;p<d.length;p++)g.set(d[p],u),u+=d[p].byteLength;return g},c=function(){return o(se.dinf,o(se.dref,st))},h=function(l){return o(se.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,l.audioobjecttype<<3|l.samplingfrequencyindex>>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},m=function(){return o(se.ftyp,he,z,he,ee)},j=function(l){return o(se.hdlr,Pe[l])},_=function(l){return o(se.mdat,l)},N=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,l.duration&255,85,196,0,0]);return l.samplerate&&(d[12]=l.samplerate>>>24&255,d[13]=l.samplerate>>>16&255,d[14]=l.samplerate>>>8&255,d[15]=l.samplerate&255),o(se.mdhd,d)},F=function(l){return o(se.mdia,N(l),j(l.type),S(l))},T=function(l){return o(se.mfhd,new Uint8Array([0,0,0,0,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255]))},S=function(l){return o(se.minf,l.type==="video"?o(se.vmhd,Oe):o(se.smhd,tt),c(),Y(l))},w=function(l,d){for(var u=[],p=d.length;p--;)u[p]=me(d[p]);return o.apply(null,[se.moof,T(l)].concat(u))},b=function(l){for(var d=l.length,u=[];d--;)u[d]=U(l[d]);return o.apply(null,[se.moov,L(4294967295)].concat(u).concat(R(l)))},R=function(l){for(var d=l.length,u=[];d--;)u[d]=le(l[d]);return o.apply(null,[se.mvex].concat(u))},L=function(l){var d=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(se.mvhd,d)},J=function(l){var d=l.samples||[],u=new Uint8Array(4+d.length),p,g;for(g=0;g<d.length;g++)p=d[g].flags,u[g+4]=p.dependsOn<<4|p.isDependedOn<<2|p.hasRedundancy;return o(se.sdtp,u)},Y=function(l){return o(se.stbl,re(l),o(se.stts,ps),o(se.stsc,be),o(se.stsz,Re),o(se.stco,ut))},function(){var l,d;re=function(u){return o(se.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),u.type==="video"?l(u):d(u))},l=function(u){var p=u.sps||[],g=u.pps||[],y=[],E=[],k,C;for(k=0;k<p.length;k++)y.push((p[k].byteLength&65280)>>>8),y.push(p[k].byteLength&255),y=y.concat(Array.prototype.slice.call(p[k]));for(k=0;k<g.length;k++)E.push((g[k].byteLength&65280)>>>8),E.push(g[k].byteLength&255),E=E.concat(Array.prototype.slice.call(g[k]));if(C=[se.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,(u.width&65280)>>8,u.width&255,(u.height&65280)>>8,u.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(se.avcC,new Uint8Array([1,u.profileIdc,u.profileCompatibility,u.levelIdc,255].concat([p.length],y,[g.length],E))),o(se.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],u.sarRatio){var x=u.sarRatio[0],O=u.sarRatio[1];C.push(o(se.pasp,new Uint8Array([(x&4278190080)>>24,(x&16711680)>>16,(x&65280)>>8,x&255,(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255])))}return o.apply(null,C)},d=function(u){return o(se.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(u.channelcount&65280)>>8,u.channelcount&255,(u.samplesize&65280)>>8,u.samplesize&255,0,0,0,0,(u.samplerate&65280)>>8,u.samplerate&255,0,0]),h(u))}}(),M=function(l){var d=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,0,(l.duration&4278190080)>>24,(l.duration&16711680)>>16,(l.duration&65280)>>8,l.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,(l.width&65280)>>8,l.width&255,0,0,(l.height&65280)>>8,l.height&255,0,0]);return o(se.tkhd,d)},me=function(l){var d,u,p,g,y,E,k;return d=o(se.tfhd,new Uint8Array([0,0,0,58,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(l.baseMediaDecodeTime/a),k=Math.floor(l.baseMediaDecodeTime%a),u=o(se.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,k>>>24&255,k>>>16&255,k>>>8&255,k&255])),y=92,l.type==="audio"?(p=ge(l,y),o(se.traf,d,u,p)):(g=J(l),p=ge(l,g.length+y),o(se.traf,d,u,p,g))},U=function(l){return l.duration=l.duration||4294967295,o(se.trak,M(l),F(l))},le=function(l){var d=new Uint8Array([0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(d[d.length-1]=0),o(se.trex,d)},function(){var l,d,u;u=function(p,g){var y=0,E=0,k=0,C=0;return p.length&&(p[0].duration!==void 0&&(y=1),p[0].size!==void 0&&(E=2),p[0].flags!==void 0&&(k=4),p[0].compositionTimeOffset!==void 0&&(C=8)),[0,0,y|E|k|C,1,(p.length&4278190080)>>>24,(p.length&16711680)>>>16,(p.length&65280)>>>8,p.length&255,(g&4278190080)>>>24,(g&16711680)>>>16,(g&65280)>>>8,g&255]},d=function(p,g){var y,E,k,C,x,O;for(C=p.samples||[],g+=20+16*C.length,k=u(C,g),E=new Uint8Array(k.length+C.length*16),E.set(k),y=k.length,O=0;O<C.length;O++)x=C[O],E[y++]=(x.duration&4278190080)>>>24,E[y++]=(x.duration&16711680)>>>16,E[y++]=(x.duration&65280)>>>8,E[y++]=x.duration&255,E[y++]=(x.size&4278190080)>>>24,E[y++]=(x.size&16711680)>>>16,E[y++]=(x.size&65280)>>>8,E[y++]=x.size&255,E[y++]=x.flags.isLeading<<2|x.flags.dependsOn,E[y++]=x.flags.isDependedOn<<6|x.flags.hasRedundancy<<4|x.flags.paddingValue<<1|x.flags.isNonSyncSample,E[y++]=x.flags.degradationPriority&61440,E[y++]=x.flags.degradationPriority&15,E[y++]=(x.compositionTimeOffset&4278190080)>>>24,E[y++]=(x.compositionTimeOffset&16711680)>>>16,E[y++]=(x.compositionTimeOffset&65280)>>>8,E[y++]=x.compositionTimeOffset&255;return o(se.trun,E)},l=function(p,g){var y,E,k,C,x,O;for(C=p.samples||[],g+=20+8*C.length,k=u(C,g),y=new Uint8Array(k.length+C.length*8),y.set(k),E=k.length,O=0;O<C.length;O++)x=C[O],y[E++]=(x.duration&4278190080)>>>24,y[E++]=(x.duration&16711680)>>>16,y[E++]=(x.duration&65280)>>>8,y[E++]=x.duration&255,y[E++]=(x.size&4278190080)>>>24,y[E++]=(x.size&16711680)>>>16,y[E++]=(x.size&65280)>>>8,y[E++]=x.size&255;return o(se.trun,y)},ge=function(p,g){return p.type==="audio"?l(p,g):d(p,g)}}();var Gs={ftyp:m,mdat:_,moof:w,moov:b,initSegment:function(l){var d=m(),u=b(l),p;return p=new Uint8Array(d.byteLength+u.byteLength),p.set(d),p.set(u,d.byteLength),p}},ms=function(l){var d,u,p=[],g=[];for(g.byteLength=0,g.nalCount=0,g.duration=0,p.byteLength=0,d=0;d<l.length;d++)u=l[d],u.nalUnitType==="access_unit_delimiter_rbsp"?(p.length&&(p.duration=u.dts-p.dts,g.byteLength+=p.byteLength,g.nalCount+=p.length,g.duration+=p.duration,g.push(p)),p=[u],p.byteLength=u.data.byteLength,p.pts=u.pts,p.dts=u.dts):(u.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(p.keyFrame=!0),p.duration=u.dts-p.dts,p.byteLength+=u.data.byteLength,p.push(u));return g.length&&(!p.duration||p.duration<=0)&&(p.duration=g[g.length-1].duration),g.byteLength+=p.byteLength,g.nalCount+=p.length,g.duration+=p.duration,g.push(p),g},Gt=function(l){var d,u,p=[],g=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=l[0].pts,p.dts=l[0].dts,g.byteLength=0,g.nalCount=0,g.duration=0,g.pts=l[0].pts,g.dts=l[0].dts,d=0;d<l.length;d++)u=l[d],u.keyFrame?(p.length&&(g.push(p),g.byteLength+=p.byteLength,g.nalCount+=p.nalCount,g.duration+=p.duration),p=[u],p.nalCount=u.length,p.byteLength=u.byteLength,p.pts=u.pts,p.dts=u.dts,p.duration=u.duration):(p.duration+=u.duration,p.nalCount+=u.length,p.byteLength+=u.byteLength,p.push(u));return g.length&&p.duration<=0&&(p.duration=g[g.length-1].duration),g.byteLength+=p.byteLength,g.nalCount+=p.nalCount,g.duration+=p.duration,g.push(p),g},Cs=function(l){var d;return!l[0][0].keyFrame&&l.length>1&&(d=l.shift(),l.byteLength-=d.byteLength,l.nalCount-=d.nalCount,l[0][0].dts=d.dts,l[0][0].pts=d.pts,l[0][0].duration+=d.duration),l},Is=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},vn=function(l,d){var u=Is();return u.dataOffset=d,u.compositionTimeOffset=l.pts-l.dts,u.duration=l.duration,u.size=4*l.length,u.size+=l.byteLength,l.keyFrame&&(u.flags.dependsOn=2,u.flags.isNonSyncSample=0),u},Ei=function(l,d){var u,p,g,y,E,k=d||0,C=[];for(u=0;u<l.length;u++)for(y=l[u],p=0;p<y.length;p++)E=y[p],g=vn(E,k),k+=g.size,C.push(g);return C},wo=function(l){var d,u,p,g,y,E,k=0,C=l.byteLength,x=l.nalCount,O=C+4*x,V=new Uint8Array(O),Z=new DataView(V.buffer);for(d=0;d<l.length;d++)for(g=l[d],u=0;u<g.length;u++)for(y=g[u],p=0;p<y.length;p++)E=y[p],Z.setUint32(k,E.data.byteLength),k+=4,V.set(E.data,k),k+=E.data.byteLength;return V},wi=function(l,d){var u,p=d||0,g=[];return u=vn(l,p),g.push(u),g},xs=function(l){var d,u,p=0,g=l.byteLength,y=l.length,E=g+4*y,k=new Uint8Array(E),C=new DataView(k.buffer);for(d=0;d<l.length;d++)u=l[d],C.setUint32(p,u.data.byteLength),p+=4,k.set(u.data,p),p+=u.data.byteLength;return k},Xs={groupNalsIntoFrames:ms,groupFramesIntoGops:Gt,extendFirstKeyFrame:Cs,generateSampleTable:Ei,concatenateNalData:wo,generateSampleTableForFrame:wi,concatenateNalDataForFrame:xs},Xt=[33,16,5,32,164,27],_r=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],_e=function(l){for(var d=[];l--;)d.push(0);return d},ko=function(l){return Object.keys(l).reduce(function(d,u){return d[u]=new Uint8Array(l[u].reduce(function(p,g){return p.concat(g)},[])),d},{})},vr,ki=function(){if(!vr){var l={96e3:[Xt,[227,64],_e(154),[56]],88200:[Xt,[231],_e(170),[56]],64e3:[Xt,[248,192],_e(240),[56]],48e3:[Xt,[255,192],_e(268),[55,148,128],_e(54),[112]],44100:[Xt,[255,192],_e(268),[55,163,128],_e(84),[112]],32e3:[Xt,[255,192],_e(268),[55,234],_e(226),[112]],24e3:[Xt,[255,192],_e(268),[55,255,128],_e(268),[111,112],_e(126),[224]],16e3:[Xt,[255,192],_e(268),[55,255,128],_e(268),[111,255],_e(269),[223,108],_e(195),[1,192]],12e3:[_r,_e(268),[3,127,248],_e(268),[6,255,240],_e(268),[13,255,224],_e(268),[27,253,128],_e(259),[56]],11025:[_r,_e(268),[3,127,248],_e(268),[6,255,240],_e(268),[13,255,224],_e(268),[27,255,192],_e(268),[55,175,128],_e(108),[112]],8e3:[_r,_e(268),[3,121,16],_e(47),[7]]};vr=ko(l)}return vr},Ls=9e4,vt,Ys,bn,Dt,Ci,f,v;vt=function(l){return l*Ls},Ys=function(l,d){return l*d},bn=function(l){return l/Ls},Dt=function(l,d){return l/d},Ci=function(l,d){return vt(Dt(l,d))},f=function(l,d){return Ys(bn(l),d)},v=function(l,d,u){return bn(u?l:l-d)};var A={ONE_SECOND_IN_TS:Ls,secondsToVideoTs:vt,secondsToAudioTs:Ys,videoTsToSeconds:bn,audioTsToSeconds:Dt,audioTsToVideoTs:Ci,videoTsToAudioTs:f,metadataTsToSeconds:v},D=ki,B=A,H=function(l){var d,u,p=0;for(d=0;d<l.length;d++)u=l[d],p+=u.data.byteLength;return p},K=function(l,d,u,p){var g,y=0,E=0,k=0,C=0,x,O,V;if(d.length&&(g=B.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),y=Math.ceil(B.ONE_SECOND_IN_TS/(l.samplerate/1024)),u&&p&&(E=g-Math.max(u,p),k=Math.floor(E/y),C=k*y),!(k<1||C>B.ONE_SECOND_IN_TS/2))){for(x=D()[l.samplerate],x||(x=d[0].data),O=0;O<k;O++)V=d[0],d.splice(0,0,{data:x,dts:V.dts-y,pts:V.pts-y});return l.baseMediaDecodeTime-=Math.floor(B.videoTsToAudioTs(C,l.samplerate)),C}},ke=function(l,d,u){return d.minSegmentDts>=u?l:(d.minSegmentDts=1/0,l.filter(function(p){return p.dts>=u?(d.minSegmentDts=Math.min(d.minSegmentDts,p.dts),d.minSegmentPts=d.minSegmentDts,!0):!1}))},Ye=function(l){var d,u,p=[];for(d=0;d<l.length;d++)u=l[d],p.push({size:u.data.byteLength,duration:1024});return p},xe=function(l){var d,u,p=0,g=new Uint8Array(H(l));for(d=0;d<l.length;d++)u=l[d],g.set(u.data,p),p+=u.data.byteLength;return g},Ee={prefixWithSilence:K,trimAdtsFramesByEarliestDts:ke,generateSampleTable:Ye,concatenateFrameData:xe},qe=A.ONE_SECOND_IN_TS,Ty=function(l,d){typeof d.pts=="number"&&(l.timelineStartInfo.pts===void 0&&(l.timelineStartInfo.pts=d.pts),l.minSegmentPts===void 0?l.minSegmentPts=d.pts:l.minSegmentPts=Math.min(l.minSegmentPts,d.pts),l.maxSegmentPts===void 0?l.maxSegmentPts=d.pts:l.maxSegmentPts=Math.max(l.maxSegmentPts,d.pts)),typeof d.dts=="number"&&(l.timelineStartInfo.dts===void 0&&(l.timelineStartInfo.dts=d.dts),l.minSegmentDts===void 0?l.minSegmentDts=d.dts:l.minSegmentDts=Math.min(l.minSegmentDts,d.dts),l.maxSegmentDts===void 0?l.maxSegmentDts=d.dts:l.maxSegmentDts=Math.max(l.maxSegmentDts,d.dts))},Ay=function(l){delete l.minSegmentDts,delete l.maxSegmentDts,delete l.minSegmentPts,delete l.maxSegmentPts},Sy=function(l,d){var u,p,g=l.minSegmentDts;return d||(g-=l.timelineStartInfo.dts),u=l.timelineStartInfo.baseMediaDecodeTime,u+=g,u=Math.max(0,u),l.type==="audio"&&(p=l.samplerate/qe,u*=p,u=Math.floor(u)),u},Ey={clearDtsInfo:Ay,calculateTrackBaseMediaDecodeTime:Sy,collectDtsInfo:Ty},hd=4,wy=128,ky=function(l){for(var d=0,u={payloadType:-1,payloadSize:0},p=0,g=0;d<l.byteLength&&l[d]!==wy;){for(;l[d]===255;)p+=255,d++;for(p+=l[d++];l[d]===255;)g+=255,d++;if(g+=l[d++],!u.payload&&p===hd){var y=String.fromCharCode(l[d+3],l[d+4],l[d+5],l[d+6]);if(y==="GA94"){u.payloadType=p,u.payloadSize=g,u.payload=l.subarray(d,d+g);break}else u.payload=void 0}d+=g,p=0,g=0}return u},Cy=function(l){return l.payload[0]!==181||(l.payload[1]<<8|l.payload[2])!==49||String.fromCharCode(l.payload[3],l.payload[4],l.payload[5],l.payload[6])!=="GA94"||l.payload[7]!==3?null:l.payload.subarray(8,l.payload.length-1)},Iy=function(l,d){var u=[],p,g,y,E;if(!(d[0]&64))return u;for(g=d[0]&31,p=0;p<g;p++)y=p*3,E={type:d[y+2]&3,pts:l},d[y+2]&4&&(E.ccData=d[y+3]<<8|d[y+4],u.push(E));return u},xy=function(l){for(var d=l.byteLength,u=[],p=1,g,y;p<d-2;)l[p]===0&&l[p+1]===0&&l[p+2]===3?(u.push(p+2),p+=2):p++;if(u.length===0)return l;g=d-u.length,y=new Uint8Array(g);var E=0;for(p=0;p<g;E++,p++)E===u[0]&&(E++,u.shift()),y[p]=l[E];return y},pd={parseSei:ky,parseUserData:Cy,parseCaptionPackets:Iy,discardEmulationPreventionBytes:xy,USER_DATA_REGISTERED_ITU_T_T35:hd},Co=t,Ii=pd,bt=function(l){l=l||{},bt.prototype.init.call(this),this.parse708captions_=typeof l.parse708captions=="boolean"?l.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Me(0,0),new Me(0,1),new Me(1,0),new Me(1,1)],this.parse708captions_&&(this.cc708Stream_=new Ce({captionServices:l.captionServices})),this.reset(),this.ccStreams_.forEach(function(d){d.on("data",this.trigger.bind(this,"data")),d.on("partialdone",this.trigger.bind(this,"partialdone")),d.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")))};bt.prototype=new Co,bt.prototype.push=function(l){var d,u,p;if(l.nalUnitType==="sei_rbsp"&&(d=Ii.parseSei(l.escapedRBSP),!!d.payload&&d.payloadType===Ii.USER_DATA_REGISTERED_ITU_T_T35&&(u=Ii.parseUserData(d),!!u))){if(l.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(l.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}p=Ii.parseCaptionPackets(l.pts,u),this.captionPackets_=this.captionPackets_.concat(p),this.latestDts_!==l.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=l.dts}},bt.prototype.flushCCStreams=function(l){this.ccStreams_.forEach(function(d){return l==="flush"?d.flush():d.partialFlush()},this)},bt.prototype.flushStream=function(l){if(!this.captionPackets_.length){this.flushCCStreams(l);return}this.captionPackets_.forEach(function(d,u){d.presortIndex=u}),this.captionPackets_.sort(function(d,u){return d.pts===u.pts?d.presortIndex-u.presortIndex:d.pts-u.pts}),this.captionPackets_.forEach(function(d){d.type<2?this.dispatchCea608Packet(d):this.dispatchCea708Packet(d)},this),this.captionPackets_.length=0,this.flushCCStreams(l)},bt.prototype.flush=function(){return this.flushStream("flush")},bt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},bt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(l){l.reset()})},bt.prototype.dispatchCea608Packet=function(l){this.setsTextOrXDSActive(l)?this.activeCea608Channel_[l.type]=null:this.setsChannel1Active(l)?this.activeCea608Channel_[l.type]=0:this.setsChannel2Active(l)&&(this.activeCea608Channel_[l.type]=1),this.activeCea608Channel_[l.type]!==null&&this.ccStreams_[(l.type<<1)+this.activeCea608Channel_[l.type]].push(l)},bt.prototype.setsChannel1Active=function(l){return(l.ccData&30720)===4096},bt.prototype.setsChannel2Active=function(l){return(l.ccData&30720)===6144},bt.prototype.setsTextOrXDSActive=function(l){return(l.ccData&28928)===256||(l.ccData&30974)===4138||(l.ccData&30974)===6186},bt.prototype.dispatchCea708Packet=function(l){this.parse708captions_&&this.cc708Stream_.push(l)};var Ly={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},Py=function(l){var d=Ly[l]||l;return l&4096&&l===d?"":String.fromCharCode(d)},xi=function(l){return 32<=l&&l<=127||160<=l&&l<=255},fs=function(l){this.windowNum=l,this.reset()};fs.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},fs.prototype.getText=function(){return this.rows.join(`
|
|
197
|
+
`)},fs.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},fs.prototype.newLine=function(l){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(l),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},fs.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},fs.prototype.addText=function(l){this.rows[this.rowIdx]+=l},fs.prototype.backspace=function(){if(!this.isEmpty()){var l=this.rows[this.rowIdx];this.rows[this.rowIdx]=l.substr(0,l.length-1)}};var Li=function(l,d,u){this.serviceNum=l,this.text="",this.currentWindow=new fs(-1),this.windows=[],this.stream=u,typeof d=="string"&&this.createTextDecoder(d)};Li.prototype.init=function(l,d){this.startPts=l;for(var u=0;u<8;u++)this.windows[u]=new fs(u),typeof d=="function"&&(this.windows[u].beforeRowOverflow=d)},Li.prototype.setCurrentWindow=function(l){this.currentWindow=this.windows[l]},Li.prototype.createTextDecoder=function(l){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(l)}catch(d){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+l+" encoding. "+d})}};var Ce=function(l){l=l||{},Ce.prototype.init.call(this);var d=this,u=l.captionServices||{},p={},g;Object.keys(u).forEach(y=>{g=u[y],/^SERVICE/.test(y)&&(p[y]=g.encoding)}),this.serviceEncodings=p,this.current708Packet=null,this.services={},this.push=function(y){y.type===3?(d.new708Packet(),d.add708Bytes(y)):(d.current708Packet===null&&d.new708Packet(),d.add708Bytes(y))}};Ce.prototype=new Co,Ce.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Ce.prototype.add708Bytes=function(l){var d=l.ccData,u=d>>>8,p=d&255;this.current708Packet.ptsVals.push(l.pts),this.current708Packet.data.push(u),this.current708Packet.data.push(p)},Ce.prototype.push708Packet=function(){var l=this.current708Packet,d=l.data,u=null,p=null,g=0,y=d[g++];for(l.seq=y>>6,l.sizeCode=y&63;g<d.length;g++)y=d[g++],u=y>>5,p=y&31,u===7&&p>0&&(y=d[g++],u=y),this.pushServiceBlock(u,g,p),p>0&&(g+=p-1)},Ce.prototype.pushServiceBlock=function(l,d,u){var p,g=d,y=this.current708Packet.data,E=this.services[l];for(E||(E=this.initService(l,g));g<d+u&&g<y.length;g++)p=y[g],xi(p)?g=this.handleText(g,E):p===24?g=this.multiByteCharacter(g,E):p===16?g=this.extendedCommands(g,E):128<=p&&p<=135?g=this.setCurrentWindow(g,E):152<=p&&p<=159?g=this.defineWindow(g,E):p===136?g=this.clearWindows(g,E):p===140?g=this.deleteWindows(g,E):p===137?g=this.displayWindows(g,E):p===138?g=this.hideWindows(g,E):p===139?g=this.toggleWindows(g,E):p===151?g=this.setWindowAttributes(g,E):p===144?g=this.setPenAttributes(g,E):p===145?g=this.setPenColor(g,E):p===146?g=this.setPenLocation(g,E):p===143?E=this.reset(g,E):p===8?E.currentWindow.backspace():p===12?E.currentWindow.clearText():p===13?E.currentWindow.pendingNewLine=!0:p===14?E.currentWindow.clearText():p===141&&g++},Ce.prototype.extendedCommands=function(l,d){var u=this.current708Packet.data,p=u[++l];return xi(p)&&(l=this.handleText(l,d,{isExtended:!0})),l},Ce.prototype.getPts=function(l){return this.current708Packet.ptsVals[Math.floor(l/2)]},Ce.prototype.initService=function(l,d){var p="SERVICE"+l,u=this,p,g;return p in this.serviceEncodings&&(g=this.serviceEncodings[p]),this.services[l]=new Li(l,g,u),this.services[l].init(this.getPts(d),function(y){u.flushDisplayed(y,u.services[l])}),this.services[l]},Ce.prototype.handleText=function(l,d,u){var p=u&&u.isExtended,g=u&&u.isMultiByte,y=this.current708Packet.data,E=p?4096:0,k=y[l],C=y[l+1],x=d.currentWindow,O,V;function Z(W){return W.map(ie=>("0"+(ie&255).toString(16)).slice(-2)).join("")}if(g?(V=[k,C],l++):V=[k],d.textDecoder_&&!p)O=d.textDecoder_.decode(new Uint8Array(V));else if(g){const W=Z(V);O=String.fromCharCode(parseInt(W,16))}else O=Py(E|k);return x.pendingNewLine&&!x.isEmpty()&&x.newLine(this.getPts(l)),x.pendingNewLine=!1,x.addText(O),l},Ce.prototype.multiByteCharacter=function(l,d){var u=this.current708Packet.data,p=u[l+1],g=u[l+2];return xi(p)&&xi(g)&&(l=this.handleText(++l,d,{isMultiByte:!0})),l},Ce.prototype.setCurrentWindow=function(l,d){var u=this.current708Packet.data,p=u[l],g=p&7;return d.setCurrentWindow(g),l},Ce.prototype.defineWindow=function(l,d){var u=this.current708Packet.data,p=u[l],g=p&7;d.setCurrentWindow(g);var y=d.currentWindow;return p=u[++l],y.visible=(p&32)>>5,y.rowLock=(p&16)>>4,y.columnLock=(p&8)>>3,y.priority=p&7,p=u[++l],y.relativePositioning=(p&128)>>7,y.anchorVertical=p&127,p=u[++l],y.anchorHorizontal=p,p=u[++l],y.anchorPoint=(p&240)>>4,y.rowCount=p&15,p=u[++l],y.columnCount=p&63,p=u[++l],y.windowStyle=(p&56)>>3,y.penStyle=p&7,y.virtualRowCount=y.rowCount+1,l},Ce.prototype.setWindowAttributes=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.winAttr;return p=u[++l],g.fillOpacity=(p&192)>>6,g.fillRed=(p&48)>>4,g.fillGreen=(p&12)>>2,g.fillBlue=p&3,p=u[++l],g.borderType=(p&192)>>6,g.borderRed=(p&48)>>4,g.borderGreen=(p&12)>>2,g.borderBlue=p&3,p=u[++l],g.borderType+=(p&128)>>5,g.wordWrap=(p&64)>>6,g.printDirection=(p&48)>>4,g.scrollDirection=(p&12)>>2,g.justify=p&3,p=u[++l],g.effectSpeed=(p&240)>>4,g.effectDirection=(p&12)>>2,g.displayEffect=p&3,l},Ce.prototype.flushDisplayed=function(l,d){for(var u=[],p=0;p<8;p++)d.windows[p].visible&&!d.windows[p].isEmpty()&&u.push(d.windows[p].getText());d.endPts=l,d.text=u.join(`
|
|
198
198
|
|
|
199
|
-
`),this.pushCaption(d),d.startPts=l},Ce.prototype.pushCaption=function(l){l.text!==""&&(this.trigger("data",{startPts:l.startPts,endPts:l.endPts,text:l.text,stream:"cc708_"+l.serviceNum}),l.text="",l.startPts=l.endPts)},Ce.prototype.displayWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible=1);return l},Ce.prototype.hideWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible=0);return l},Ce.prototype.toggleWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible^=1);return l},Ce.prototype.clearWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&d.windows[y].clearText();return l},Ce.prototype.deleteWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&d.windows[y].reset();return l},Ce.prototype.setPenAttributes=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penAttr;return p=u[++l],g.textTag=(p&240)>>4,g.offset=(p&12)>>2,g.penSize=p&3,p=u[++l],g.italics=(p&128)>>7,g.underline=(p&64)>>6,g.edgeType=(p&56)>>3,g.fontStyle=p&7,l},Ce.prototype.setPenColor=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penColor;return p=u[++l],g.fgOpacity=(p&192)>>6,g.fgRed=(p&48)>>4,g.fgGreen=(p&12)>>2,g.fgBlue=p&3,p=u[++l],g.bgOpacity=(p&192)>>6,g.bgRed=(p&48)>>4,g.bgGreen=(p&12)>>2,g.bgBlue=p&3,p=u[++l],g.edgeRed=(p&48)>>4,g.edgeGreen=(p&12)>>2,g.edgeBlue=p&3,l},Ce.prototype.setPenLocation=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,p=u[++l],g.row=p&15,p=u[++l],g.column=p&63,l},Ce.prototype.reset=function(l,d){var u=this.getPts(l);return this.flushDisplayed(u,d),this.initService(d.serviceNum,l)};var Ry={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},Pi=function(l){return l===null?"":(l=Ry[l]||l,String.fromCharCode(l))},Ri=14,Dy=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ks=function(){for(var l=[],d=Ri+1;d--;)l.push({text:"",indent:0,offset:0});return l},Me=function(l,d){Me.prototype.init.call(this),this.field_=l||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(u){var p,g,y,E,k;if(p=u.ccData&32639,p===this.lastControlCode_){this.lastControlCode_=null;return}if((p&61440)===4096?this.lastControlCode_=p:p!==this.PADDING_&&(this.lastControlCode_=null),y=p>>>8,E=p&255,p!==this.PADDING_)if(p===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(p===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(u.pts),this.flushDisplayed(u.pts),g=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=g,this.startPts_=u.pts;else if(p===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(u.pts);else if(p===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(u.pts);else if(p===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(u.pts);else if(p===this.CARRIAGE_RETURN_)this.clearFormatting(u.pts),this.flushDisplayed(u.pts),this.shiftRowsUp_(),this.startPts_=u.pts;else if(p===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(p===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(u.pts),this.displayed_=Ks();else if(p===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ks();else if(p===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(u.pts),this.displayed_=Ks()),this.mode_="paintOn",this.startPts_=u.pts;else if(this.isSpecialCharacter(y,E))y=(y&3)<<8,k=Pi(y|E),this[this.mode_](u.pts,k),this.column_++;else if(this.isExtCharacter(y,E))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),y=(y&3)<<8,k=Pi(y|E),this[this.mode_](u.pts,k),this.column_++;else if(this.isMidRowCode(y,E))this.clearFormatting(u.pts),this[this.mode_](u.pts," "),this.column_++,(E&14)===14&&this.addFormatting(u.pts,["i"]),(E&1)===1&&this.addFormatting(u.pts,["u"]);else if(this.isOffsetControlCode(y,E)){const x=E&3;this.nonDisplayed_[this.row_].offset=x,this.column_+=x}else if(this.isPAC(y,E)){var C=Dy.indexOf(p&7968);if(this.mode_==="rollUp"&&(C-this.rollUpRows_+1<0&&(C=this.rollUpRows_-1),this.setRollUp(u.pts,C)),C!==this.row_&&C>=0&&C<=14&&(this.clearFormatting(u.pts),this.row_=C),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(u.pts,["u"]),(p&16)===16){const x=(p&14)>>1;this.column_=x*4,this.nonDisplayed_[this.row_].indent+=x}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(u.pts,["i"])}else this.isNormalChar(y)&&(E===0&&(E=null),k=Pi(y),k+=Pi(E),this[this.mode_](u.pts,k),this.column_+=k.length)}};Me.prototype=new Co,Me.prototype.flushDisplayed=function(l){const d=p=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+p+"."})},u=[];this.displayed_.forEach((p,g)=>{if(p&&p.text&&p.text.length){try{p.text=p.text.trim()}catch{d(g)}p.text.length&&u.push({text:p.text,line:g+1,position:10+Math.min(70,p.indent*10)+p.offset*2.5})}else p==null&&d(g)}),u.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,content:u,stream:this.name_})},Me.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ks(),this.nonDisplayed_=Ks(),this.lastControlCode_=null,this.column_=0,this.row_=Ri,this.rollUpRows_=2,this.formatting_=[]},Me.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Me.prototype.isSpecialCharacter=function(l,d){return l===this.EXT_&&d>=48&&d<=63},Me.prototype.isExtCharacter=function(l,d){return(l===this.EXT_+1||l===this.EXT_+2)&&d>=32&&d<=63},Me.prototype.isMidRowCode=function(l,d){return l===this.EXT_&&d>=32&&d<=47},Me.prototype.isOffsetControlCode=function(l,d){return l===this.OFFSET_&&d>=33&&d<=35},Me.prototype.isPAC=function(l,d){return l>=this.BASE_&&l<this.BASE_+8&&d>=64&&d<=127},Me.prototype.isColorPAC=function(l){return l>=64&&l<=79||l>=96&&l<=127},Me.prototype.isNormalChar=function(l){return l>=32&&l<=127},Me.prototype.setRollUp=function(l,d){if(this.mode_!=="rollUp"&&(this.row_=Ri,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=Ks(),this.displayed_=Ks()),d!==void 0&&d!==this.row_)for(var u=0;u<this.rollUpRows_;u++)this.displayed_[d-u]=this.displayed_[this.row_-u],this.displayed_[this.row_-u]={text:"",indent:0,offset:0};d===void 0&&(d=this.row_),this.topRow_=d-this.rollUpRows_+1},Me.prototype.addFormatting=function(l,d){this.formatting_=this.formatting_.concat(d);var u=d.reduce(function(p,g){return p+"<"+g+">"},"");this[this.mode_](l,u)},Me.prototype.clearFormatting=function(l){if(this.formatting_.length){var d=this.formatting_.reverse().reduce(function(u,p){return u+"</"+p+">"},"");this.formatting_=[],this[this.mode_](l,d)}},Me.prototype.popOn=function(l,d){var u=this.nonDisplayed_[this.row_].text;u+=d,this.nonDisplayed_[this.row_].text=u},Me.prototype.rollUp=function(l,d){var u=this.displayed_[this.row_].text;u+=d,this.displayed_[this.row_].text=u},Me.prototype.shiftRowsUp_=function(){var l;for(l=0;l<this.topRow_;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.row_+1;l<Ri+1;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.topRow_;l<this.row_;l++)this.displayed_[l]=this.displayed_[l+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Me.prototype.paintOn=function(l,d){var u=this.displayed_[this.row_].text;u+=d,this.displayed_[this.row_].text=u};var md={CaptionStream:bt,Cea608Stream:Me,Cea708Stream:Ce},Di={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ny=t,Oy=8589934592,My=4294967296,fd="shared",Io=function(l,d){var u=1;for(l>d&&(u=-1);Math.abs(d-l)>My;)l+=u*Oy;return l},xo=function(l){var d,u;xo.prototype.init.call(this),this.type_=l||fd,this.push=function(p){if(p.type==="metadata"){this.trigger("data",p);return}this.type_!==fd&&p.type!==this.type_||(u===void 0&&(u=p.dts),p.dts=Io(p.dts,u),p.pts=Io(p.pts,u),d=p.dts,this.trigger("data",p))},this.flush=function(){u=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){u=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};xo.prototype=new Ny;var gd={TimestampRolloverStream:xo,handleRollover:Io},Uy=(l,d,u)=>{if(!l)return-1;for(var p=u;p<l.length;p++)if(l[p]===d)return p;return-1},By={typedArrayIndexOf:Uy},Ni=By.typedArrayIndexOf,Oi={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},yd=function(l,d,u){var p,g="";for(p=d;p<u;p++)g+="%"+("00"+l[p].toString(16)).slice(-2);return g},br=function(l,d,u){return decodeURIComponent(yd(l,d,u))},Tr=function(l,d,u){return unescape(yd(l,d,u))},Ar=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Sr={APIC:function(l){var d=1,u,p,g="-->";l.data[0]===Oi.Utf8&&(u=Ni(l.data,0,d),!(u<0)&&(l.mimeType=Tr(l.data,d,u),d=u+1,l.pictureType=l.data[d],d++,p=Ni(l.data,0,d),!(p<0)&&(l.description=br(l.data,d,p),d=p+1,l.mimeType===g?l.url=Tr(l.data,d,l.data.length):l.pictureData=l.data.subarray(d,l.data.length))))},"T*":function(l){l.data[0]===Oi.Utf8&&(l.value=br(l.data,1,l.data.length).replace(/\0*$/,""),l.values=l.value.split("\0"))},TXXX:function(l){var d;l.data[0]===Oi.Utf8&&(d=Ni(l.data,0,1),d!==-1&&(l.description=br(l.data,1,d),l.value=br(l.data,d+1,l.data.length).replace(/\0*$/,""),l.data=l.value))},"W*":function(l){l.url=Tr(l.data,0,l.data.length).replace(/\0.*$/,"")},WXXX:function(l){var d;l.data[0]===Oi.Utf8&&(d=Ni(l.data,0,1),d!==-1&&(l.description=br(l.data,1,d),l.url=Tr(l.data,d+1,l.data.length).replace(/\0.*$/,"")))},PRIV:function(l){var d;for(d=0;d<l.data.length;d++)if(l.data[d]===0){l.owner=Tr(l.data,0,d);break}l.privateData=l.data.subarray(d+1),l.data=l.privateData}},Fy=function(l){var d,u,p=10,g=0,y=[];if(!(l.length<10||l[0]!==73||l[1]!==68||l[2]!==51)){g=Ar(l.subarray(6,10)),g+=10;var E=l[5]&64;E&&(p+=4,p+=Ar(l.subarray(10,14)),g-=Ar(l.subarray(16,20)));do{if(d=Ar(l.subarray(p+4,p+8)),d<1)break;u=String.fromCharCode(l[p],l[p+1],l[p+2],l[p+3]);var k={id:u,data:l.subarray(p+10,p+d+10)};k.key=k.id,Sr[k.id]?Sr[k.id](k):k.id[0]==="T"?Sr["T*"](k):k.id[0]==="W"&&Sr["W*"](k),y.push(k),p+=10,p+=d}while(p<g);return y}},_d={parseId3Frames:Fy,parseSyncSafeInteger:Ar,frameParsers:Sr},jy=t,qy=Di,Ps=_d,Mi;Mi=function(l){var d={descriptor:l&&l.descriptor},u=0,p=[],g=0,y;if(Mi.prototype.init.call(this),this.dispatchType=qy.METADATA_STREAM_TYPE.toString(16),d.descriptor)for(y=0;y<d.descriptor.length;y++)this.dispatchType+=("00"+d.descriptor[y].toString(16)).slice(-2);this.push=function(E){var k,C,x,O,V,ee;if(E.type==="timed-metadata"){if(E.dataAlignmentIndicator&&(g=0,p.length=0),p.length===0&&(E.data.length<10||E.data[0]!==73||E.data[1]!==68||E.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(p.push(E),g+=E.data.byteLength,p.length===1&&(u=Ps.parseSyncSafeInteger(E.data.subarray(6,10)),u+=10),!(g<u)){for(k={data:new Uint8Array(u),frames:[],pts:p[0].pts,dts:p[0].dts},V=0;V<u;)k.data.set(p[0].data.subarray(0,u-V),V),V+=p[0].data.byteLength,g-=p[0].data.byteLength,p.shift();C=10,k.data[5]&64&&(C+=4,C+=Ps.parseSyncSafeInteger(k.data.subarray(10,14)),u-=Ps.parseSyncSafeInteger(k.data.subarray(16,20)));do{if(x=Ps.parseSyncSafeInteger(k.data.subarray(C+4,C+8)),x<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(ee=String.fromCharCode(k.data[C],k.data[C+1],k.data[C+2],k.data[C+3]),O={id:ee,data:k.data.subarray(C+10,C+x+10)},O.key=O.id,Ps.frameParsers[O.id]?Ps.frameParsers[O.id](O):O.id[0]==="T"?Ps.frameParsers["T*"](O):O.id[0]==="W"&&Ps.frameParsers["W*"](O),O.owner==="com.apple.streaming.transportStreamTimestamp"){var W=O.data,re=(W[3]&1)<<30|W[4]<<22|W[5]<<14|W[6]<<6|W[7]>>>2;re*=4,re+=W[7]&3,O.timeStamp=re,k.pts===void 0&&k.dts===void 0&&(k.pts=O.timeStamp,k.dts=O.timeStamp),this.trigger("timestamp",O)}k.frames.push(O),C+=10,C+=x}while(C<u);this.trigger("data",k)}}}},Mi.prototype=new jy;var Vy=Mi,Lo=t,Po=md,qt=Di,$y=gd.TimestampRolloverStream,Ui,Er,Bi,Tn=188,Ro=71;Ui=function(){var l=new Uint8Array(Tn),d=0;Ui.prototype.init.call(this),this.push=function(u){var p=0,g=Tn,y;for(d?(y=new Uint8Array(u.byteLength+d),y.set(l.subarray(0,d)),y.set(u,d),d=0):y=u;g<y.byteLength;){if(y[p]===Ro&&y[g]===Ro){this.trigger("data",y.subarray(p,g)),p+=Tn,g+=Tn;continue}p++,g++}p<y.byteLength&&(l.set(y.subarray(p),0),d=y.byteLength-p)},this.flush=function(){d===Tn&&l[0]===Ro&&(this.trigger("data",l),d=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){d=0,this.trigger("reset")}},Ui.prototype=new Lo,Er=function(){var l,d,u,p;Er.prototype.init.call(this),p=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,l=function(g,y){var E=0;y.payloadUnitStartIndicator&&(E+=g[E]+1),y.type==="pat"?d(g.subarray(E),y):u(g.subarray(E),y)},d=function(g,y){y.section_number=g[7],y.last_section_number=g[8],p.pmtPid=(g[10]&31)<<8|g[11],y.pmtPid=p.pmtPid},u=function(g,y){var E,k,C,x;if(g[5]&1){for(p.programMapTable={video:null,audio:null,"timed-metadata":{}},E=(g[1]&15)<<8|g[2],k=3+E-4,C=(g[10]&15)<<8|g[11],x=12+C;x<k;){var O=g[x],V=(g[x+1]&31)<<8|g[x+2];O===qt.H264_STREAM_TYPE&&p.programMapTable.video===null?p.programMapTable.video=V:O===qt.ADTS_STREAM_TYPE&&p.programMapTable.audio===null?p.programMapTable.audio=V:O===qt.METADATA_STREAM_TYPE&&(p.programMapTable["timed-metadata"][V]=O),x+=((g[x+3]&15)<<8|g[x+4])+5}y.programMapTable=p.programMapTable}},this.push=function(g){var y={},E=4;if(y.payloadUnitStartIndicator=!!(g[1]&64),y.pid=g[1]&31,y.pid<<=8,y.pid|=g[2],(g[3]&48)>>>4>1&&(E+=g[E]+1),y.pid===0)y.type="pat",l(g.subarray(E),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",l(g.subarray(E),y),this.trigger("data",y);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([g,E,y]):this.processPes_(g,E,y)},this.processPes_=function(g,y,E){E.pid===this.programMapTable.video?E.streamType=qt.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=qt.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=g.subarray(y),this.trigger("data",E)}},Er.prototype=new Lo,Er.STREAM_TYPES={h264:27,adts:15},Bi=function(){var l=this,d=!1,u={data:[],size:0},p={data:[],size:0},g={data:[],size:0},y,E=function(C,x){var O;const V=C[0]<<16|C[1]<<8|C[2];x.data=new Uint8Array,V===1&&(x.packetLength=6+(C[4]<<8|C[5]),x.dataAlignmentIndicator=(C[6]&4)!==0,O=C[7],O&192&&(x.pts=(C[9]&14)<<27|(C[10]&255)<<20|(C[11]&254)<<12|(C[12]&255)<<5|(C[13]&254)>>>3,x.pts*=4,x.pts+=(C[13]&6)>>>1,x.dts=x.pts,O&64&&(x.dts=(C[14]&14)<<27|(C[15]&255)<<20|(C[16]&254)<<12|(C[17]&255)<<5|(C[18]&254)>>>3,x.dts*=4,x.dts+=(C[18]&6)>>>1)),x.data=C.subarray(9+C[8]))},k=function(C,x,O){var V=new Uint8Array(C.size),ee={type:x},W=0,re=0,le=!1,Qe;if(!(!C.data.length||C.size<9)){for(ee.trackId=C.data[0].pid,W=0;W<C.data.length;W++)Qe=C.data[W],V.set(Qe.data,re),re+=Qe.data.byteLength;E(V,ee),le=x==="video"||ee.packetLength<=C.size,(O||le)&&(C.size=0,C.data.length=0),le&&l.trigger("data",ee)}};Bi.prototype.init.call(this),this.push=function(C){({pat:function(){},pes:function(){var x,O;switch(C.streamType){case qt.H264_STREAM_TYPE:x=u,O="video";break;case qt.ADTS_STREAM_TYPE:x=p,O="audio";break;case qt.METADATA_STREAM_TYPE:x=g,O="timed-metadata";break;default:return}C.payloadUnitStartIndicator&&k(x,O,!0),x.data.push(C),x.size+=C.data.byteLength},pmt:function(){var x={type:"metadata",tracks:[]};y=C.programMapTable,y.video!==null&&x.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&x.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),d=!0,l.trigger("data",x)}})[C.type]()},this.reset=function(){u.size=0,u.data.length=0,p.size=0,p.data.length=0,this.trigger("reset")},this.flushStreams_=function(){k(u,"video"),k(p,"audio"),k(g,"timed-metadata")},this.flush=function(){if(!d&&y){var C={type:"metadata",tracks:[]};y.video!==null&&C.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&C.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),l.trigger("data",C)}d=!1,this.flushStreams_(),this.trigger("done")}},Bi.prototype=new Lo;var vd={PAT_PID:0,MP2T_PACKET_LENGTH:Tn,TransportPacketStream:Ui,TransportParseStream:Er,ElementaryStream:Bi,TimestampRolloverStream:$y,CaptionStream:Po.CaptionStream,Cea608Stream:Po.Cea608Stream,Cea708Stream:Po.Cea708Stream,MetadataStream:Vy};for(var Do in qt)qt.hasOwnProperty(Do)&&(vd[Do]=qt[Do]);var Hy=vd,Wy=t,zy=A.ONE_SECOND_IN_TS,Fi,bd=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Fi=function(l){var d,u=0;Fi.prototype.init.call(this),this.skipWarn_=function(p,g){this.trigger("log",{level:"warn",message:`adts skiping bytes ${p} to ${g} in frame ${u} outside syncword`})},this.push=function(p){var g=0,y,E,k,C,x;if(l||(u=0),p.type==="audio"){d&&d.length?(k=d,d=new Uint8Array(k.byteLength+p.data.byteLength),d.set(k),d.set(p.data,k.byteLength)):d=p.data;for(var O;g+7<d.length;){if(d[g]!==255||(d[g+1]&246)!==240){typeof O!="number"&&(O=g),g++;continue}if(typeof O=="number"&&(this.skipWarn_(O,g),O=null),E=(~d[g+1]&1)*2,y=(d[g+3]&3)<<11|d[g+4]<<3|(d[g+5]&224)>>5,C=((d[g+6]&3)+1)*1024,x=C*zy/bd[(d[g+2]&60)>>>2],d.byteLength-g<y)break;this.trigger("data",{pts:p.pts+u*x,dts:p.dts+u*x,sampleCount:C,audioobjecttype:(d[g+2]>>>6&3)+1,channelcount:(d[g+2]&1)<<2|(d[g+3]&192)>>>6,samplerate:bd[(d[g+2]&60)>>>2],samplingfrequencyindex:(d[g+2]&60)>>>2,samplesize:16,data:d.subarray(g+7+E,g+y)}),u++,g+=y}typeof O=="number"&&(this.skipWarn_(O,g),O=null),d=d.subarray(g)}},this.flush=function(){u=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},Fi.prototype=new Wy;var Gy=Fi,Td;Td=function(l){var d=l.byteLength,u=0,p=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+p},this.loadWord=function(){var g=l.byteLength-d,y=new Uint8Array(4),E=Math.min(4,d);if(E===0)throw new Error("no bytes available");y.set(l.subarray(g,g+E)),u=new DataView(y.buffer).getUint32(0),p=E*8,d-=E},this.skipBits=function(g){var y;p>g?(u<<=g,p-=g):(g-=p,y=Math.floor(g/8),g-=y*8,d-=y,this.loadWord(),u<<=g,p-=g)},this.readBits=function(g){var y=Math.min(p,g),E=u>>>32-y;return p-=y,p>0?u<<=y:d>0&&this.loadWord(),y=g-y,y>0?E<<y|this.readBits(y):E},this.skipLeadingZeros=function(){var g;for(g=0;g<p;++g)if(u&2147483648>>>g)return u<<=g,p-=g,g;return this.loadWord(),g+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var g=this.skipLeadingZeros();return this.readBits(g+1)-1},this.readExpGolomb=function(){var g=this.readUnsignedExpGolomb();return 1&g?1+g>>>1:-1*(g>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Xy=Td,Ad=t,Yy=Xy,ji,wr,Sd;wr=function(){var l=0,d,u;wr.prototype.init.call(this),this.push=function(p){var g;u?(g=new Uint8Array(u.byteLength+p.data.byteLength),g.set(u),g.set(p.data,u.byteLength),u=g):u=p.data;for(var y=u.byteLength;l<y-3;l++)if(u[l+2]===1){d=l+5;break}for(;d<y;)switch(u[d]){case 0:if(u[d-1]!==0){d+=2;break}else if(u[d-2]!==0){d++;break}l+3!==d-2&&this.trigger("data",u.subarray(l+3,d-2));do d++;while(u[d]!==1&&d<y);l=d-2,d+=3;break;case 1:if(u[d-1]!==0||u[d-2]!==0){d+=3;break}this.trigger("data",u.subarray(l+3,d-2)),l=d-2,d+=3;break;default:d+=3;break}u=u.subarray(l),d-=l,l=0},this.reset=function(){u=null,l=0,this.trigger("reset")},this.flush=function(){u&&u.byteLength>3&&this.trigger("data",u.subarray(l+3)),u=null,l=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},wr.prototype=new Ad,Sd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ji=function(){var l=new wr,d,u,p,g,y,E,k;ji.prototype.init.call(this),d=this,this.push=function(C){C.type==="video"&&(u=C.trackId,p=C.pts,g=C.dts,l.push(C))},l.on("data",function(C){var x={trackId:u,pts:p,dts:g,data:C,nalUnitTypeCode:C[0]&31};switch(x.nalUnitTypeCode){case 5:x.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:x.nalUnitType="sei_rbsp",x.escapedRBSP=y(C.subarray(1));break;case 7:x.nalUnitType="seq_parameter_set_rbsp",x.escapedRBSP=y(C.subarray(1)),x.config=E(x.escapedRBSP);break;case 8:x.nalUnitType="pic_parameter_set_rbsp";break;case 9:x.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",x)}),l.on("done",function(){d.trigger("done")}),l.on("partialdone",function(){d.trigger("partialdone")}),l.on("reset",function(){d.trigger("reset")}),l.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},k=function(C,x){var O=8,V=8,ee,W;for(ee=0;ee<C;ee++)V!==0&&(W=x.readExpGolomb(),V=(O+W+256)%256),O=V===0?O:V},y=function(C){for(var x=C.byteLength,O=[],V=1,ee,W;V<x-2;)C[V]===0&&C[V+1]===0&&C[V+2]===3?(O.push(V+2),V+=2):V++;if(O.length===0)return C;ee=x-O.length,W=new Uint8Array(ee);var re=0;for(V=0;V<ee;re++,V++)re===O[0]&&(re++,O.shift()),W[V]=C[re];return W},E=function(C){var x=0,O=0,V=0,ee=0,W,re,le,Qe,pt,Kt,Dr,Zi,Ji,Js,Nr,De=[1,1],Jd,en;if(W=new Yy(C),re=W.readUnsignedByte(),Qe=W.readUnsignedByte(),le=W.readUnsignedByte(),W.skipUnsignedExpGolomb(),Sd[re]&&(pt=W.readUnsignedExpGolomb(),pt===3&&W.skipBits(1),W.skipUnsignedExpGolomb(),W.skipUnsignedExpGolomb(),W.skipBits(1),W.readBoolean()))for(Nr=pt!==3?8:12,en=0;en<Nr;en++)W.readBoolean()&&(en<6?k(16,W):k(64,W));if(W.skipUnsignedExpGolomb(),Kt=W.readUnsignedExpGolomb(),Kt===0)W.readUnsignedExpGolomb();else if(Kt===1)for(W.skipBits(1),W.skipExpGolomb(),W.skipExpGolomb(),Dr=W.readUnsignedExpGolomb(),en=0;en<Dr;en++)W.skipExpGolomb();if(W.skipUnsignedExpGolomb(),W.skipBits(1),Zi=W.readUnsignedExpGolomb(),Ji=W.readUnsignedExpGolomb(),Js=W.readBits(1),Js===0&&W.skipBits(1),W.skipBits(1),W.readBoolean()&&(x=W.readUnsignedExpGolomb(),O=W.readUnsignedExpGolomb(),V=W.readUnsignedExpGolomb(),ee=W.readUnsignedExpGolomb()),W.readBoolean()&&W.readBoolean()){switch(Jd=W.readUnsignedByte(),Jd){case 1:De=[1,1];break;case 2:De=[12,11];break;case 3:De=[10,11];break;case 4:De=[16,11];break;case 5:De=[40,33];break;case 6:De=[24,11];break;case 7:De=[20,11];break;case 8:De=[32,11];break;case 9:De=[80,33];break;case 10:De=[18,11];break;case 11:De=[15,11];break;case 12:De=[64,33];break;case 13:De=[160,99];break;case 14:De=[4,3];break;case 15:De=[3,2];break;case 16:De=[2,1];break;case 255:{De=[W.readUnsignedByte()<<8|W.readUnsignedByte(),W.readUnsignedByte()<<8|W.readUnsignedByte()];break}}De&&De[0]/De[1]}return{profileIdc:re,levelIdc:le,profileCompatibility:Qe,width:(Zi+1)*16-x*2-O*2,height:(2-Js)*(Ji+1)*16-V*2-ee*2,sarRatio:De}}},ji.prototype=new Ad;var Ky={H264Stream:ji,NalByteStream:wr},Qy=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ed=function(l,d){var u=l[d+6]<<21|l[d+7]<<14|l[d+8]<<7|l[d+9],p=l[d+5],g=(p&16)>>4;return u=u>=0?u:0,g?u+20:u+10},wd=function(l,d){return l.length-d<10||l[d]!==73||l[d+1]!==68||l[d+2]!==51?d:(d+=Ed(l,d),wd(l,d))},Zy=function(l){var d=wd(l,0);return l.length>=d+2&&(l[d]&255)===255&&(l[d+1]&240)===240&&(l[d+1]&22)===16},kd=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Jy=function(l,d,u){var p,g="";for(p=d;p<u;p++)g+="%"+("00"+l[p].toString(16)).slice(-2);return g},e_=function(l,d,u){return unescape(Jy(l,d,u))},t_=function(l,d){var u=(l[d+5]&224)>>5,p=l[d+4]<<3,g=l[d+3]&6144;return g|p|u},s_=function(l,d){return l[d]===73&&l[d+1]===68&&l[d+2]===51?"timed-metadata":l[d]&!0&&(l[d+1]&240)===240?"audio":null},n_=function(l){for(var d=0;d+5<l.length;){if(l[d]!==255||(l[d+1]&246)!==240){d++;continue}return Qy[(l[d+2]&60)>>>2]}return null},r_=function(l){var d,u,p,g;d=10,l[5]&64&&(d+=4,d+=kd(l.subarray(10,14)));do{if(u=kd(l.subarray(d+4,d+8)),u<1)return null;if(g=String.fromCharCode(l[d],l[d+1],l[d+2],l[d+3]),g==="PRIV"){p=l.subarray(d+10,d+u+10);for(var y=0;y<p.byteLength;y++)if(p[y]===0){var E=e_(p,0,y);if(E==="com.apple.streaming.transportStreamTimestamp"){var k=p.subarray(y+1),C=(k[3]&1)<<30|k[4]<<22|k[5]<<14|k[6]<<6|k[7]>>>2;return C*=4,C+=k[7]&3,C}break}}d+=10,d+=u}while(d<l.byteLength);return null},No={isLikelyAacData:Zy,parseId3TagSize:Ed,parseAdtsSize:t_,parseType:s_,parseSampleRate:n_,parseAacTimestamp:r_},i_=t,Cd=No,qi;qi=function(){var l=new Uint8Array,d=0;qi.prototype.init.call(this),this.setTimestamp=function(u){d=u},this.push=function(u){var p=0,g=0,y,E,k,C;for(l.length?(C=l.length,l=new Uint8Array(u.byteLength+C),l.set(l.subarray(0,C)),l.set(u,C)):l=u;l.length-g>=3;){if(l[g]===73&&l[g+1]===68&&l[g+2]===51){if(l.length-g<10||(p=Cd.parseId3TagSize(l,g),g+p>l.length))break;E={type:"timed-metadata",data:l.subarray(g,g+p)},this.trigger("data",E),g+=p;continue}else if((l[g]&255)===255&&(l[g+1]&240)===240){if(l.length-g<7||(p=Cd.parseAdtsSize(l,g),g+p>l.length))break;k={type:"audio",data:l.subarray(g,g+p),pts:d,dts:d},this.trigger("data",k),g+=p;continue}g++}y=l.length-g,y>0?l=l.subarray(g):l=new Uint8Array},this.reset=function(){l=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){l=new Uint8Array,this.trigger("endedtimeline")}},qi.prototype=new i_;var a_=qi,o_=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],l_=o_,c_=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],d_=c_,Vi=t,kr=Gs,Cr=Xs,$i=Ee,Vt=Ey,gs=Hy,Hi=A,Id=Gy,u_=Ky.H264Stream,h_=a_,p_=No.isLikelyAacData,m_=A.ONE_SECOND_IN_TS,Oo=l_,Mo=d_,Ir,An,Wi,Qs,f_=function(l,d){d.stream=l,this.trigger("log",d)},xd=function(l,d){for(var u=Object.keys(d),p=0;p<u.length;p++){var g=u[p];g==="headOfPipeline"||!d[g].on||d[g].on("log",f_.bind(l,g))}},Ld=function(l,d){var u;if(l.length!==d.length)return!1;for(u=0;u<l.length;u++)if(l[u]!==d[u])return!1;return!0},Uo=function(l,d,u,p,g,y){var E=u-d,k=p-d,C=g-u;return{start:{dts:l,pts:l+E},end:{dts:l+k,pts:l+C},prependedContentDuration:y,baseMediaDecodeTime:l}};An=function(l,d){var u=[],p,g=0,y=0,E=1/0;d=d||{},p=d.firstSequenceNumber||0,An.prototype.init.call(this),this.push=function(k){Vt.collectDtsInfo(l,k),l&&Oo.forEach(function(C){l[C]=k[C]}),u.push(k)},this.setEarliestDts=function(k){g=k},this.setVideoBaseMediaDecodeTime=function(k){E=k},this.setAudioAppendStart=function(k){y=k},this.flush=function(){var k,C,x,O,V,ee,W;if(u.length===0){this.trigger("done","AudioSegmentStream");return}k=$i.trimAdtsFramesByEarliestDts(u,l,g),l.baseMediaDecodeTime=Vt.calculateTrackBaseMediaDecodeTime(l,d.keepOriginalTimestamps),W=$i.prefixWithSilence(l,k,y,E),l.samples=$i.generateSampleTable(k),x=kr.mdat($i.concatenateFrameData(k)),u=[],C=kr.moof(p,[l]),O=new Uint8Array(C.byteLength+x.byteLength),p++,O.set(C),O.set(x,C.byteLength),Vt.clearDtsInfo(l),V=Math.ceil(m_*1024/l.samplerate),k.length&&(ee=k.length*V,this.trigger("segmentTimingInfo",Uo(Hi.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),k[0].dts,k[0].pts,k[0].dts+ee,k[0].pts+ee,W||0)),this.trigger("timingInfo",{start:k[0].pts,end:k[0].pts+ee})),this.trigger("data",{track:l,boxes:O}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Vt.clearDtsInfo(l),u=[],this.trigger("reset")}},An.prototype=new Vi,Ir=function(l,d){var u,p=[],g=[],y,E;d=d||{},u=d.firstSequenceNumber||0,Ir.prototype.init.call(this),delete l.minPTS,this.gopCache_=[],this.push=function(k){Vt.collectDtsInfo(l,k),k.nalUnitType==="seq_parameter_set_rbsp"&&!y&&(y=k.config,l.sps=[k.data],Mo.forEach(function(C){l[C]=y[C]},this)),k.nalUnitType==="pic_parameter_set_rbsp"&&!E&&(E=k.data,l.pps=[k.data]),p.push(k)},this.flush=function(){for(var k,C,x,O,V,ee,W=0,re,le;p.length&&p[0].nalUnitType!=="access_unit_delimiter_rbsp";)p.shift();if(p.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(k=Cr.groupNalsIntoFrames(p),x=Cr.groupFramesIntoGops(k),x[0][0].keyFrame||(C=this.getGopForFusion_(p[0],l),C?(W=C.duration,x.unshift(C),x.byteLength+=C.byteLength,x.nalCount+=C.nalCount,x.pts=C.pts,x.dts=C.dts,x.duration+=C.duration):x=Cr.extendFirstKeyFrame(x)),g.length){var Qe;if(d.alignGopsAtEnd?Qe=this.alignGopsAtEnd_(x):Qe=this.alignGopsAtStart_(x),!Qe){this.gopCache_.unshift({gop:x.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),p=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Vt.clearDtsInfo(l),x=Qe}Vt.collectDtsInfo(l,x),l.samples=Cr.generateSampleTable(x),V=kr.mdat(Cr.concatenateNalData(x)),l.baseMediaDecodeTime=Vt.calculateTrackBaseMediaDecodeTime(l,d.keepOriginalTimestamps),this.trigger("processedGopsInfo",x.map(function(pt){return{pts:pt.pts,dts:pt.dts,byteLength:pt.byteLength}})),re=x[0],le=x[x.length-1],this.trigger("segmentTimingInfo",Uo(l.baseMediaDecodeTime,re.dts,re.pts,le.dts+le.duration,le.pts+le.duration,W)),this.trigger("timingInfo",{start:x[0].pts,end:x[x.length-1].pts+x[x.length-1].duration}),this.gopCache_.unshift({gop:x.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),p=[],this.trigger("baseMediaDecodeTime",l.baseMediaDecodeTime),this.trigger("timelineStartInfo",l.timelineStartInfo),O=kr.moof(u,[l]),ee=new Uint8Array(O.byteLength+V.byteLength),u++,ee.set(O),ee.set(V,O.byteLength),this.trigger("data",{track:l,boxes:ee}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),p=[],this.gopCache_.length=0,g.length=0,this.trigger("reset")},this.resetStream_=function(){Vt.clearDtsInfo(l),y=void 0,E=void 0},this.getGopForFusion_=function(k){var C=45e3,x=1e4,O=1/0,V,ee,W,re,le;for(le=0;le<this.gopCache_.length;le++)re=this.gopCache_[le],W=re.gop,!(!(l.pps&&Ld(l.pps[0],re.pps[0]))||!(l.sps&&Ld(l.sps[0],re.sps[0])))&&(W.dts<l.timelineStartInfo.dts||(V=k.dts-W.dts-W.duration,V>=-x&&V<=C&&(!ee||O>V)&&(ee=re,O=V)));return ee?ee.gop:null},this.alignGopsAtStart_=function(k){var C,x,O,V,ee,W,re,le;for(ee=k.byteLength,W=k.nalCount,re=k.duration,C=x=0;C<g.length&&x<k.length&&(O=g[C],V=k[x],O.pts!==V.pts);){if(V.pts>O.pts){C++;continue}x++,ee-=V.byteLength,W-=V.nalCount,re-=V.duration}return x===0?k:x===k.length?null:(le=k.slice(x),le.byteLength=ee,le.duration=re,le.nalCount=W,le.pts=le[0].pts,le.dts=le[0].dts,le)},this.alignGopsAtEnd_=function(k){var C,x,O,V,ee,W;for(C=g.length-1,x=k.length-1,ee=null,W=!1;C>=0&&x>=0;){if(O=g[C],V=k[x],O.pts===V.pts){W=!0;break}if(O.pts>V.pts){C--;continue}C===g.length-1&&(ee=x),x--}if(!W&&ee===null)return null;var re;if(W?re=x:re=ee,re===0)return k;var le=k.slice(re),Qe=le.reduce(function(pt,Kt){return pt.byteLength+=Kt.byteLength,pt.duration+=Kt.duration,pt.nalCount+=Kt.nalCount,pt},{byteLength:0,duration:0,nalCount:0});return le.byteLength=Qe.byteLength,le.duration=Qe.duration,le.nalCount=Qe.nalCount,le.pts=le[0].pts,le.dts=le[0].dts,le},this.alignGopsWith=function(k){g=k}},Ir.prototype=new Vi,Qs=function(l,d){this.numberOfTracks=0,this.metadataStream=d,l=l||{},typeof l.remux<"u"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=l.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Qs.prototype.init.call(this),this.push=function(u){if(u.content||u.text)return this.pendingCaptions.push(u);if(u.frames)return this.pendingMetadata.push(u);this.pendingTracks.push(u.track),this.pendingBytes+=u.boxes.byteLength,u.track.type==="video"&&(this.videoTrack=u.track,this.pendingBoxes.push(u.boxes)),u.track.type==="audio"&&(this.audioTrack=u.track,this.pendingBoxes.unshift(u.boxes))}},Qs.prototype=new Vi,Qs.prototype.flush=function(l){var d=0,u={captions:[],captionStreams:{},metadata:[],info:{}},p,g,y,E=0,k;if(this.pendingTracks.length<this.numberOfTracks){if(l!=="VideoSegmentStream"&&l!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(E=this.videoTrack.timelineStartInfo.pts,Mo.forEach(function(C){u.info[C]=this.videoTrack[C]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,Oo.forEach(function(C){u.info[C]=this.audioTrack[C]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?u.type=this.pendingTracks[0].type:u.type="combined",this.emittedTracks+=this.pendingTracks.length,y=kr.initSegment(this.pendingTracks),u.initSegment=new Uint8Array(y.byteLength),u.initSegment.set(y),u.data=new Uint8Array(this.pendingBytes),k=0;k<this.pendingBoxes.length;k++)u.data.set(this.pendingBoxes[k],d),d+=this.pendingBoxes[k].byteLength;for(k=0;k<this.pendingCaptions.length;k++)p=this.pendingCaptions[k],p.startTime=Hi.metadataTsToSeconds(p.startPts,E,this.keepOriginalTimestamps),p.endTime=Hi.metadataTsToSeconds(p.endPts,E,this.keepOriginalTimestamps),u.captionStreams[p.stream]=!0,u.captions.push(p);for(k=0;k<this.pendingMetadata.length;k++)g=this.pendingMetadata[k],g.cueTime=Hi.metadataTsToSeconds(g.pts,E,this.keepOriginalTimestamps),u.metadata.push(g);for(u.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",u),k=0;k<u.captions.length;k++)p=u.captions[k],this.trigger("caption",p);for(k=0;k<u.metadata.length;k++)g=u.metadata[k],this.trigger("id3Frame",g)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Qs.prototype.setRemux=function(l){this.remuxTracks=l},Wi=function(l){var d=this,u=!0,p,g;Wi.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new gs.MetadataStream,y.aacStream=new h_,y.audioTimestampRolloverStream=new gs.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new gs.TimestampRolloverStream("timed-metadata"),y.adtsStream=new Id,y.coalesceStream=new Qs(l,y.metadataStream),y.headOfPipeline=y.aacStream,y.aacStream.pipe(y.audioTimestampRolloverStream).pipe(y.adtsStream),y.aacStream.pipe(y.timedMetadataTimestampRolloverStream).pipe(y.metadataStream).pipe(y.coalesceStream),y.metadataStream.on("timestamp",function(E){y.aacStream.setTimestamp(E.timeStamp)}),y.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||y.audioSegmentStream||(g=g||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new An(g,l),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!p}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xd(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new gs.MetadataStream,y.packetStream=new gs.TransportPacketStream,y.parseStream=new gs.TransportParseStream,y.elementaryStream=new gs.ElementaryStream,y.timestampRolloverStream=new gs.TimestampRolloverStream,y.adtsStream=new Id,y.h264Stream=new u_,y.captionStream=new gs.CaptionStream(l),y.coalesceStream=new Qs(l,y.metadataStream),y.headOfPipeline=y.packetStream,y.packetStream.pipe(y.parseStream).pipe(y.elementaryStream).pipe(y.timestampRolloverStream),y.timestampRolloverStream.pipe(y.h264Stream),y.timestampRolloverStream.pipe(y.adtsStream),y.timestampRolloverStream.pipe(y.metadataStream).pipe(y.coalesceStream),y.h264Stream.pipe(y.captionStream).pipe(y.coalesceStream),y.elementaryStream.on("data",function(E){var k;if(E.type==="metadata"){for(k=E.tracks.length;k--;)!p&&E.tracks[k].type==="video"?(p=E.tracks[k],p.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!g&&E.tracks[k].type==="audio"&&(g=E.tracks[k],g.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);p&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new Ir(p,l),y.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(C){g&&!l.keepOriginalTimestamps&&(g.timelineStartInfo=C,y.audioSegmentStream.setEarliestDts(C.dts-d.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(C){g&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(C)}),y.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),g&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new An(g,l),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!p})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(E){E.dispatchType=y.metadataStream.dispatchType,d.trigger("id3Frame",E)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xd(this,y)},this.setBaseMediaDecodeTime=function(y){var E=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),g&&(g.timelineStartInfo.dts=void 0,g.timelineStartInfo.pts=void 0,Vt.clearDtsInfo(g),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),p&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),p.timelineStartInfo.dts=void 0,p.timelineStartInfo.pts=void 0,Vt.clearDtsInfo(p),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){g&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var E=this.transmuxPipeline_;l.remux=y,E&&E.coalesceStream&&E.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){p&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(y)},this.getLogTrigger_=function(y){var E=this;return function(k){k.stream=y,E.trigger("log",k)}},this.push=function(y){if(u){var E=p_(y);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),u=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){u=!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()}},Wi.prototype=new Vi;var g_={Transmuxer:Wi,VideoSegmentStream:Ir,AudioSegmentStream:An,AUDIO_PROPERTIES:Oo,VIDEO_PROPERTIES:Mo,generateSegmentTimingInfo:Uo},y_=function(l){return l>>>0},__=function(l){return("00"+l.toString(16)).slice(-2)},zi={toUnsigned:y_,toHexString:__},v_=function(l){var d="";return d+=String.fromCharCode(l[0]),d+=String.fromCharCode(l[1]),d+=String.fromCharCode(l[2]),d+=String.fromCharCode(l[3]),d},Bo=v_,b_=zi.toUnsigned,T_=Bo,Pd=function(l,d){var u=[],p,g,y,E,k;if(!d.length)return null;for(p=0;p<l.byteLength;)g=b_(l[p]<<24|l[p+1]<<16|l[p+2]<<8|l[p+3]),y=T_(l.subarray(p+4,p+8)),E=g>1?p+g:l.byteLength,y===d[0]&&(d.length===1?u.push(l.subarray(p+8,E)):(k=Pd(l.subarray(p+8,E),d.slice(1)),k.length&&(u=u.concat(k)))),p=E;return u},Gi=Pd,A_=zi.toUnsigned,S_=i.getUint64,E_=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=S_(l.subarray(4)):d.baseMediaDecodeTime=A_(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),d},Fo=E_,w_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4)},p=u.flags[2]&1,g=u.flags[2]&2,y=u.flags[2]&8,E=u.flags[2]&16,k=u.flags[2]&32,C=u.flags[0]&65536,x=u.flags[0]&131072,O;return O=8,p&&(O+=4,u.baseDataOffset=d.getUint32(12),O+=4),g&&(u.sampleDescriptionIndex=d.getUint32(O),O+=4),y&&(u.defaultSampleDuration=d.getUint32(O),O+=4),E&&(u.defaultSampleSize=d.getUint32(O),O+=4),k&&(u.defaultSampleFlags=d.getUint32(O)),C&&(u.durationIsEmpty=!0),!p&&x&&(u.baseDataOffsetIsMoof=!0),u},jo=w_,Rd=i.getUint64,k_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),references:[],referenceId:d.getUint32(4),timescale:d.getUint32(8)},p=12;u.version===0?(u.earliestPresentationTime=d.getUint32(p),u.firstOffset=d.getUint32(p+4),p+=8):(u.earliestPresentationTime=Rd(l.subarray(p)),u.firstOffset=Rd(l.subarray(p+8)),p+=16),p+=2;var g=d.getUint16(p);for(p+=2;g>0;p+=12,g--)u.references.push({referenceType:(l[p]&128)>>>7,referencedSize:d.getUint32(p)&2147483647,subsegmentDuration:d.getUint32(p+4),startsWithSap:!!(l[p+8]&128),sapType:(l[p+8]&112)>>>4,sapDeltaTime:d.getUint32(p+8)&268435455});return u},C_=k_,I_=function(l){return{isLeading:(l[0]&12)>>>2,dependsOn:l[0]&3,isDependedOn:(l[1]&192)>>>6,hasRedundancy:(l[1]&48)>>>4,paddingValue:(l[1]&14)>>>1,isNonSyncSample:l[1]&1,degradationPriority:l[2]<<8|l[3]}},x_=I_,Dd=x_,L_=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},u=new DataView(l.buffer,l.byteOffset,l.byteLength),p=d.flags[2]&1,g=d.flags[2]&4,y=d.flags[1]&1,E=d.flags[1]&2,k=d.flags[1]&4,C=d.flags[1]&8,x=u.getUint32(4),O=8,V;for(p&&(d.dataOffset=u.getInt32(O),O+=4),g&&x&&(V={flags:Dd(l.subarray(O,O+4))},O+=4,y&&(V.duration=u.getUint32(O),O+=4),E&&(V.size=u.getUint32(O),O+=4),C&&(d.version===1?V.compositionTimeOffset=u.getInt32(O):V.compositionTimeOffset=u.getUint32(O),O+=4),d.samples.push(V),x--);x--;)V={},y&&(V.duration=u.getUint32(O),O+=4),E&&(V.size=u.getUint32(O),O+=4),k&&(V.flags=Dd(l.subarray(O,O+4)),O+=4),C&&(d.version===1?V.compositionTimeOffset=u.getInt32(O):V.compositionTimeOffset=u.getUint32(O),O+=4),d.samples.push(V);return d},Nd=L_,P_=i,Od=P_.getUint64,rt,qo,Nt=function(l){return new Date(l*1e3-20828448e5)},xr=Bo,R_=Gi,D_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=[],p,g;for(p=0;p+4<l.length;p+=g){if(g=d.getUint32(p),p+=4,g<=0){u.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(l[p]&31){case 1:u.push("slice_layer_without_partitioning_rbsp");break;case 5:u.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:u.push("sei_rbsp");break;case 7:u.push("seq_parameter_set_rbsp");break;case 8:u.push("pic_parameter_set_rbsp");break;case 9:u.push("access_unit_delimiter_rbsp");break;default:u.push("UNKNOWN NAL - "+l[p]&31);break}}return u},Rs={avc1:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{dataReferenceIndex:d.getUint16(6),width:d.getUint16(24),height:d.getUint16(26),horizresolution:d.getUint16(28)+d.getUint16(30)/16,vertresolution:d.getUint16(32)+d.getUint16(34)/16,frameCount:d.getUint16(40),depth:d.getUint16(74),config:rt(l.subarray(78,l.byteLength))}},avcC:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={configurationVersion:l[0],avcProfileIndication:l[1],profileCompatibility:l[2],avcLevelIndication:l[3],lengthSizeMinusOne:l[4]&3,sps:[],pps:[]},p=l[5]&31,g,y,E,k;for(E=6,k=0;k<p;k++)y=d.getUint16(E),E+=2,u.sps.push(new Uint8Array(l.subarray(E,E+y))),E+=y;for(g=l[E],E++,k=0;k<g;k++)y=d.getUint16(E),E+=2,u.pps.push(new Uint8Array(l.subarray(E,E+y))),E+=y;return u},btrt:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{bufferSizeDB:d.getUint32(0),maxBitrate:d.getUint32(4),avgBitrate:d.getUint32(8)}},edts:function(l){return{boxes:rt(l)}},elst:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),edits:[]},p=d.getUint32(4),g;for(g=8;p;p--)u.version===0?(u.edits.push({segmentDuration:d.getUint32(g),mediaTime:d.getInt32(g+4),mediaRate:d.getUint16(g+8)+d.getUint16(g+10)/(256*256)}),g+=12):(u.edits.push({segmentDuration:Od(l.subarray(g)),mediaTime:Od(l.subarray(g+8)),mediaRate:d.getUint16(g+16)+d.getUint16(g+18)/(256*256)}),g+=20);return u},esds:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),esId:l[6]<<8|l[7],streamPriority:l[8]&31,decoderConfig:{objectProfileIndication:l[11],streamType:l[12]>>>2&63,bufferSize:l[13]<<16|l[14]<<8|l[15],maxBitrate:l[16]<<24|l[17]<<16|l[18]<<8|l[19],avgBitrate:l[20]<<24|l[21]<<16|l[22]<<8|l[23],decoderConfigDescriptor:{tag:l[24],length:l[25],audioObjectType:l[26]>>>3&31,samplingFrequencyIndex:(l[26]&7)<<1|l[27]>>>7&1,channelConfiguration:l[27]>>>3&15}}}},ftyp:function(l){for(var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={majorBrand:xr(l.subarray(0,4)),minorVersion:d.getUint32(4),compatibleBrands:[]},p=8;p<l.byteLength;)u.compatibleBrands.push(xr(l.subarray(p,p+4))),p+=4;return u},dinf:function(l){return{boxes:rt(l)}},dref:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),dataReferences:rt(l.subarray(8))}},hdlr:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),handlerType:xr(l.subarray(8,12)),name:""},p=8;for(p=24;p<l.byteLength;p++){if(l[p]===0){p++;break}u.name+=String.fromCharCode(l[p])}return u.name=decodeURIComponent(escape(u.name)),u},mdat:function(l){return{byteLength:l.byteLength,nals:D_(l)}},mdhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p,g={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),language:""};return g.version===1?(u+=4,g.creationTime=Nt(d.getUint32(u)),u+=8,g.modificationTime=Nt(d.getUint32(u)),u+=4,g.timescale=d.getUint32(u),u+=8,g.duration=d.getUint32(u)):(g.creationTime=Nt(d.getUint32(u)),u+=4,g.modificationTime=Nt(d.getUint32(u)),u+=4,g.timescale=d.getUint32(u),u+=4,g.duration=d.getUint32(u)),u+=4,p=d.getUint16(u),g.language+=String.fromCharCode((p>>10)+96),g.language+=String.fromCharCode(((p&992)>>5)+96),g.language+=String.fromCharCode((p&31)+96),g},mdia:function(l){return{boxes:rt(l)}},mfhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sequenceNumber:l[4]<<24|l[5]<<16|l[6]<<8|l[7]}},minf:function(l){return{boxes:rt(l)}},mp4a:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={dataReferenceIndex:d.getUint16(6),channelcount:d.getUint16(16),samplesize:d.getUint16(18),samplerate:d.getUint16(24)+d.getUint16(26)/65536};return l.byteLength>28&&(u.streamDescriptor=rt(l.subarray(28))[0]),u},moof:function(l){return{boxes:rt(l)}},moov:function(l){return{boxes:rt(l)}},mvex:function(l){return{boxes:rt(l)}},mvhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return p.version===1?(u+=4,p.creationTime=Nt(d.getUint32(u)),u+=8,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.timescale=d.getUint32(u),u+=8,p.duration=d.getUint32(u)):(p.creationTime=Nt(d.getUint32(u)),u+=4,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.timescale=d.getUint32(u),u+=4,p.duration=d.getUint32(u)),u+=4,p.rate=d.getUint16(u)+d.getUint16(u+2)/16,u+=4,p.volume=d.getUint8(u)+d.getUint8(u+1)/8,u+=2,u+=2,u+=2*4,p.matrix=new Uint32Array(l.subarray(u,u+9*4)),u+=9*4,u+=6*4,p.nextTrackId=d.getUint32(u),p},pdin:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),rate:d.getUint32(4),initialDelay:d.getUint32(8)}},sdtp:function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},u;for(u=4;u<l.byteLength;u++)d.samples.push({dependsOn:(l[u]&48)>>4,isDependedOn:(l[u]&12)>>2,hasRedundancy:l[u]&3});return d},sidx:C_,smhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),balance:l[4]+l[5]/256}},stbl:function(l){return{boxes:rt(l)}},ctts:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),compositionOffsets:[]},p=d.getUint32(4),g;for(g=8;p;g+=8,p--)u.compositionOffsets.push({sampleCount:d.getUint32(g),sampleOffset:d[u.version===0?"getUint32":"getInt32"](g+4)});return u},stss:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),syncSamples:[]},p=d.getUint32(4),g;for(g=8;p;g+=4,p--)u.syncSamples.push(d.getUint32(g));return u},stco:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),chunkOffsets:[]},p=d.getUint32(4),g;for(g=8;p;g+=4,p--)u.chunkOffsets.push(d.getUint32(g));return u},stsc:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=d.getUint32(4),p={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleToChunks:[]},g;for(g=8;u;g+=12,u--)p.sampleToChunks.push({firstChunk:d.getUint32(g),samplesPerChunk:d.getUint32(g+4),sampleDescriptionIndex:d.getUint32(g+8)});return p},stsd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleDescriptions:rt(l.subarray(8))}},stsz:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleSize:d.getUint32(4),entries:[]},p;for(p=12;p<l.byteLength;p+=4)u.entries.push(d.getUint32(p));return u},stts:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),timeToSamples:[]},p=d.getUint32(4),g;for(g=8;p;g+=8,p--)u.timeToSamples.push({sampleCount:d.getUint32(g),sampleDelta:d.getUint32(g+4)});return u},styp:function(l){return Rs.ftyp(l)},tfdt:Fo,tfhd:jo,tkhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return p.version===1?(u+=4,p.creationTime=Nt(d.getUint32(u)),u+=8,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.trackId=d.getUint32(u),u+=4,u+=8,p.duration=d.getUint32(u)):(p.creationTime=Nt(d.getUint32(u)),u+=4,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.trackId=d.getUint32(u),u+=4,u+=4,p.duration=d.getUint32(u)),u+=4,u+=2*4,p.layer=d.getUint16(u),u+=2,p.alternateGroup=d.getUint16(u),u+=2,p.volume=d.getUint8(u)+d.getUint8(u+1)/8,u+=2,u+=2,p.matrix=new Uint32Array(l.subarray(u,u+9*4)),u+=9*4,p.width=d.getUint16(u)+d.getUint16(u+2)/65536,u+=4,p.height=d.getUint16(u)+d.getUint16(u+2)/65536,p},traf:function(l){return{boxes:rt(l)}},trak:function(l){return{boxes:rt(l)}},trex:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4),defaultSampleDescriptionIndex:d.getUint32(8),defaultSampleDuration:d.getUint32(12),defaultSampleSize:d.getUint32(16),sampleDependsOn:l[20]&3,sampleIsDependedOn:(l[21]&192)>>6,sampleHasRedundancy:(l[21]&48)>>4,samplePaddingValue:(l[21]&14)>>1,sampleIsDifferenceSample:!!(l[21]&1),sampleDegradationPriority:d.getUint16(22)}},trun:Nd,"url ":function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4))}},vmhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),graphicsmode:d.getUint16(4),opcolor:new Uint16Array([d.getUint16(6),d.getUint16(8),d.getUint16(10)])}}};rt=function(l){for(var d=0,u=[],p,g,y,E,k,C=new ArrayBuffer(l.length),x=new Uint8Array(C),O=0;O<l.length;++O)x[O]=l[O];for(p=new DataView(C);d<l.byteLength;)g=p.getUint32(d),y=xr(l.subarray(d+4,d+8)),E=g>1?d+g:l.byteLength,k=(Rs[y]||function(V){return{data:V}})(l.subarray(d+8,E)),k.size=g,k.type=y,u.push(k),d=E;return u},qo=function(l,d){var u;return d=d||0,u=new Array(d*2+1).join(" "),l.map(function(p,g){return u+p.type+`
|
|
199
|
+
`),this.pushCaption(d),d.startPts=l},Ce.prototype.pushCaption=function(l){l.text!==""&&(this.trigger("data",{startPts:l.startPts,endPts:l.endPts,text:l.text,stream:"cc708_"+l.serviceNum}),l.text="",l.startPts=l.endPts)},Ce.prototype.displayWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible=1);return l},Ce.prototype.hideWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible=0);return l},Ce.prototype.toggleWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&(d.windows[y].visible^=1);return l},Ce.prototype.clearWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&d.windows[y].clearText();return l},Ce.prototype.deleteWindows=function(l,d){var u=this.current708Packet.data,p=u[++l],g=this.getPts(l);this.flushDisplayed(g,d);for(var y=0;y<8;y++)p&1<<y&&d.windows[y].reset();return l},Ce.prototype.setPenAttributes=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penAttr;return p=u[++l],g.textTag=(p&240)>>4,g.offset=(p&12)>>2,g.penSize=p&3,p=u[++l],g.italics=(p&128)>>7,g.underline=(p&64)>>6,g.edgeType=(p&56)>>3,g.fontStyle=p&7,l},Ce.prototype.setPenColor=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penColor;return p=u[++l],g.fgOpacity=(p&192)>>6,g.fgRed=(p&48)>>4,g.fgGreen=(p&12)>>2,g.fgBlue=p&3,p=u[++l],g.bgOpacity=(p&192)>>6,g.bgRed=(p&48)>>4,g.bgGreen=(p&12)>>2,g.bgBlue=p&3,p=u[++l],g.edgeRed=(p&48)>>4,g.edgeGreen=(p&12)>>2,g.edgeBlue=p&3,l},Ce.prototype.setPenLocation=function(l,d){var u=this.current708Packet.data,p=u[l],g=d.currentWindow.penLoc;return d.currentWindow.pendingNewLine=!0,p=u[++l],g.row=p&15,p=u[++l],g.column=p&63,l},Ce.prototype.reset=function(l,d){var u=this.getPts(l);return this.flushDisplayed(u,d),this.initService(d.serviceNum,l)};var Ry={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},Pi=function(l){return l===null?"":(l=Ry[l]||l,String.fromCharCode(l))},Ri=14,Dy=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Ks=function(){for(var l=[],d=Ri+1;d--;)l.push({text:"",indent:0,offset:0});return l},Me=function(l,d){Me.prototype.init.call(this),this.field_=l||0,this.dataChannel_=d||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(u){var p,g,y,E,k;if(p=u.ccData&32639,p===this.lastControlCode_){this.lastControlCode_=null;return}if((p&61440)===4096?this.lastControlCode_=p:p!==this.PADDING_&&(this.lastControlCode_=null),y=p>>>8,E=p&255,p!==this.PADDING_)if(p===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(p===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(u.pts),this.flushDisplayed(u.pts),g=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=g,this.startPts_=u.pts;else if(p===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(u.pts);else if(p===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(u.pts);else if(p===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(u.pts);else if(p===this.CARRIAGE_RETURN_)this.clearFormatting(u.pts),this.flushDisplayed(u.pts),this.shiftRowsUp_(),this.startPts_=u.pts;else if(p===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(p===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(u.pts),this.displayed_=Ks();else if(p===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Ks();else if(p===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(u.pts),this.displayed_=Ks()),this.mode_="paintOn",this.startPts_=u.pts;else if(this.isSpecialCharacter(y,E))y=(y&3)<<8,k=Pi(y|E),this[this.mode_](u.pts,k),this.column_++;else if(this.isExtCharacter(y,E))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),y=(y&3)<<8,k=Pi(y|E),this[this.mode_](u.pts,k),this.column_++;else if(this.isMidRowCode(y,E))this.clearFormatting(u.pts),this[this.mode_](u.pts," "),this.column_++,(E&14)===14&&this.addFormatting(u.pts,["i"]),(E&1)===1&&this.addFormatting(u.pts,["u"]);else if(this.isOffsetControlCode(y,E)){const x=E&3;this.nonDisplayed_[this.row_].offset=x,this.column_+=x}else if(this.isPAC(y,E)){var C=Dy.indexOf(p&7968);if(this.mode_==="rollUp"&&(C-this.rollUpRows_+1<0&&(C=this.rollUpRows_-1),this.setRollUp(u.pts,C)),C!==this.row_&&C>=0&&C<=14&&(this.clearFormatting(u.pts),this.row_=C),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(u.pts,["u"]),(p&16)===16){const x=(p&14)>>1;this.column_=x*4,this.nonDisplayed_[this.row_].indent+=x}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(u.pts,["i"])}else this.isNormalChar(y)&&(E===0&&(E=null),k=Pi(y),k+=Pi(E),this[this.mode_](u.pts,k),this.column_+=k.length)}};Me.prototype=new Co,Me.prototype.flushDisplayed=function(l){const d=p=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+p+"."})},u=[];this.displayed_.forEach((p,g)=>{if(p&&p.text&&p.text.length){try{p.text=p.text.trim()}catch{d(g)}p.text.length&&u.push({text:p.text,line:g+1,position:10+Math.min(70,p.indent*10)+p.offset*2.5})}else p==null&&d(g)}),u.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,content:u,stream:this.name_})},Me.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Ks(),this.nonDisplayed_=Ks(),this.lastControlCode_=null,this.column_=0,this.row_=Ri,this.rollUpRows_=2,this.formatting_=[]},Me.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Me.prototype.isSpecialCharacter=function(l,d){return l===this.EXT_&&d>=48&&d<=63},Me.prototype.isExtCharacter=function(l,d){return(l===this.EXT_+1||l===this.EXT_+2)&&d>=32&&d<=63},Me.prototype.isMidRowCode=function(l,d){return l===this.EXT_&&d>=32&&d<=47},Me.prototype.isOffsetControlCode=function(l,d){return l===this.OFFSET_&&d>=33&&d<=35},Me.prototype.isPAC=function(l,d){return l>=this.BASE_&&l<this.BASE_+8&&d>=64&&d<=127},Me.prototype.isColorPAC=function(l){return l>=64&&l<=79||l>=96&&l<=127},Me.prototype.isNormalChar=function(l){return l>=32&&l<=127},Me.prototype.setRollUp=function(l,d){if(this.mode_!=="rollUp"&&(this.row_=Ri,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=Ks(),this.displayed_=Ks()),d!==void 0&&d!==this.row_)for(var u=0;u<this.rollUpRows_;u++)this.displayed_[d-u]=this.displayed_[this.row_-u],this.displayed_[this.row_-u]={text:"",indent:0,offset:0};d===void 0&&(d=this.row_),this.topRow_=d-this.rollUpRows_+1},Me.prototype.addFormatting=function(l,d){this.formatting_=this.formatting_.concat(d);var u=d.reduce(function(p,g){return p+"<"+g+">"},"");this[this.mode_](l,u)},Me.prototype.clearFormatting=function(l){if(this.formatting_.length){var d=this.formatting_.reverse().reduce(function(u,p){return u+"</"+p+">"},"");this.formatting_=[],this[this.mode_](l,d)}},Me.prototype.popOn=function(l,d){var u=this.nonDisplayed_[this.row_].text;u+=d,this.nonDisplayed_[this.row_].text=u},Me.prototype.rollUp=function(l,d){var u=this.displayed_[this.row_].text;u+=d,this.displayed_[this.row_].text=u},Me.prototype.shiftRowsUp_=function(){var l;for(l=0;l<this.topRow_;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.row_+1;l<Ri+1;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.topRow_;l<this.row_;l++)this.displayed_[l]=this.displayed_[l+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Me.prototype.paintOn=function(l,d){var u=this.displayed_[this.row_].text;u+=d,this.displayed_[this.row_].text=u};var md={CaptionStream:bt,Cea608Stream:Me,Cea708Stream:Ce},Di={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ny=t,Oy=8589934592,My=4294967296,fd="shared",Io=function(l,d){var u=1;for(l>d&&(u=-1);Math.abs(d-l)>My;)l+=u*Oy;return l},xo=function(l){var d,u;xo.prototype.init.call(this),this.type_=l||fd,this.push=function(p){if(p.type==="metadata"){this.trigger("data",p);return}this.type_!==fd&&p.type!==this.type_||(u===void 0&&(u=p.dts),p.dts=Io(p.dts,u),p.pts=Io(p.pts,u),d=p.dts,this.trigger("data",p))},this.flush=function(){u=d,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){u=void 0,d=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};xo.prototype=new Ny;var gd={TimestampRolloverStream:xo,handleRollover:Io},Uy=(l,d,u)=>{if(!l)return-1;for(var p=u;p<l.length;p++)if(l[p]===d)return p;return-1},By={typedArrayIndexOf:Uy},Ni=By.typedArrayIndexOf,Oi={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},yd=function(l,d,u){var p,g="";for(p=d;p<u;p++)g+="%"+("00"+l[p].toString(16)).slice(-2);return g},br=function(l,d,u){return decodeURIComponent(yd(l,d,u))},Tr=function(l,d,u){return unescape(yd(l,d,u))},Ar=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Sr={APIC:function(l){var d=1,u,p,g="-->";l.data[0]===Oi.Utf8&&(u=Ni(l.data,0,d),!(u<0)&&(l.mimeType=Tr(l.data,d,u),d=u+1,l.pictureType=l.data[d],d++,p=Ni(l.data,0,d),!(p<0)&&(l.description=br(l.data,d,p),d=p+1,l.mimeType===g?l.url=Tr(l.data,d,l.data.length):l.pictureData=l.data.subarray(d,l.data.length))))},"T*":function(l){l.data[0]===Oi.Utf8&&(l.value=br(l.data,1,l.data.length).replace(/\0*$/,""),l.values=l.value.split("\0"))},TXXX:function(l){var d;l.data[0]===Oi.Utf8&&(d=Ni(l.data,0,1),d!==-1&&(l.description=br(l.data,1,d),l.value=br(l.data,d+1,l.data.length).replace(/\0*$/,""),l.data=l.value))},"W*":function(l){l.url=Tr(l.data,0,l.data.length).replace(/\0.*$/,"")},WXXX:function(l){var d;l.data[0]===Oi.Utf8&&(d=Ni(l.data,0,1),d!==-1&&(l.description=br(l.data,1,d),l.url=Tr(l.data,d+1,l.data.length).replace(/\0.*$/,"")))},PRIV:function(l){var d;for(d=0;d<l.data.length;d++)if(l.data[d]===0){l.owner=Tr(l.data,0,d);break}l.privateData=l.data.subarray(d+1),l.data=l.privateData}},Fy=function(l){var d,u,p=10,g=0,y=[];if(!(l.length<10||l[0]!==73||l[1]!==68||l[2]!==51)){g=Ar(l.subarray(6,10)),g+=10;var E=l[5]&64;E&&(p+=4,p+=Ar(l.subarray(10,14)),g-=Ar(l.subarray(16,20)));do{if(d=Ar(l.subarray(p+4,p+8)),d<1)break;u=String.fromCharCode(l[p],l[p+1],l[p+2],l[p+3]);var k={id:u,data:l.subarray(p+10,p+d+10)};k.key=k.id,Sr[k.id]?Sr[k.id](k):k.id[0]==="T"?Sr["T*"](k):k.id[0]==="W"&&Sr["W*"](k),y.push(k),p+=10,p+=d}while(p<g);return y}},_d={parseId3Frames:Fy,parseSyncSafeInteger:Ar,frameParsers:Sr},jy=t,qy=Di,Ps=_d,Mi;Mi=function(l){var d={descriptor:l&&l.descriptor},u=0,p=[],g=0,y;if(Mi.prototype.init.call(this),this.dispatchType=qy.METADATA_STREAM_TYPE.toString(16),d.descriptor)for(y=0;y<d.descriptor.length;y++)this.dispatchType+=("00"+d.descriptor[y].toString(16)).slice(-2);this.push=function(E){var k,C,x,O,V,Z;if(E.type==="timed-metadata"){if(E.dataAlignmentIndicator&&(g=0,p.length=0),p.length===0&&(E.data.length<10||E.data[0]!==73||E.data[1]!==68||E.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(p.push(E),g+=E.data.byteLength,p.length===1&&(u=Ps.parseSyncSafeInteger(E.data.subarray(6,10)),u+=10),!(g<u)){for(k={data:new Uint8Array(u),frames:[],pts:p[0].pts,dts:p[0].dts},V=0;V<u;)k.data.set(p[0].data.subarray(0,u-V),V),V+=p[0].data.byteLength,g-=p[0].data.byteLength,p.shift();C=10,k.data[5]&64&&(C+=4,C+=Ps.parseSyncSafeInteger(k.data.subarray(10,14)),u-=Ps.parseSyncSafeInteger(k.data.subarray(16,20)));do{if(x=Ps.parseSyncSafeInteger(k.data.subarray(C+4,C+8)),x<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Z=String.fromCharCode(k.data[C],k.data[C+1],k.data[C+2],k.data[C+3]),O={id:Z,data:k.data.subarray(C+10,C+x+10)},O.key=O.id,Ps.frameParsers[O.id]?Ps.frameParsers[O.id](O):O.id[0]==="T"?Ps.frameParsers["T*"](O):O.id[0]==="W"&&Ps.frameParsers["W*"](O),O.owner==="com.apple.streaming.transportStreamTimestamp"){var W=O.data,ie=(W[3]&1)<<30|W[4]<<22|W[5]<<14|W[6]<<6|W[7]>>>2;ie*=4,ie+=W[7]&3,O.timeStamp=ie,k.pts===void 0&&k.dts===void 0&&(k.pts=O.timeStamp,k.dts=O.timeStamp),this.trigger("timestamp",O)}k.frames.push(O),C+=10,C+=x}while(C<u);this.trigger("data",k)}}}},Mi.prototype=new jy;var Vy=Mi,Lo=t,Po=md,qt=Di,$y=gd.TimestampRolloverStream,Ui,Er,Bi,Tn=188,Ro=71;Ui=function(){var l=new Uint8Array(Tn),d=0;Ui.prototype.init.call(this),this.push=function(u){var p=0,g=Tn,y;for(d?(y=new Uint8Array(u.byteLength+d),y.set(l.subarray(0,d)),y.set(u,d),d=0):y=u;g<y.byteLength;){if(y[p]===Ro&&y[g]===Ro){this.trigger("data",y.subarray(p,g)),p+=Tn,g+=Tn;continue}p++,g++}p<y.byteLength&&(l.set(y.subarray(p),0),d=y.byteLength-p)},this.flush=function(){d===Tn&&l[0]===Ro&&(this.trigger("data",l),d=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){d=0,this.trigger("reset")}},Ui.prototype=new Lo,Er=function(){var l,d,u,p;Er.prototype.init.call(this),p=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,l=function(g,y){var E=0;y.payloadUnitStartIndicator&&(E+=g[E]+1),y.type==="pat"?d(g.subarray(E),y):u(g.subarray(E),y)},d=function(g,y){y.section_number=g[7],y.last_section_number=g[8],p.pmtPid=(g[10]&31)<<8|g[11],y.pmtPid=p.pmtPid},u=function(g,y){var E,k,C,x;if(g[5]&1){for(p.programMapTable={video:null,audio:null,"timed-metadata":{}},E=(g[1]&15)<<8|g[2],k=3+E-4,C=(g[10]&15)<<8|g[11],x=12+C;x<k;){var O=g[x],V=(g[x+1]&31)<<8|g[x+2];O===qt.H264_STREAM_TYPE&&p.programMapTable.video===null?p.programMapTable.video=V:O===qt.ADTS_STREAM_TYPE&&p.programMapTable.audio===null?p.programMapTable.audio=V:O===qt.METADATA_STREAM_TYPE&&(p.programMapTable["timed-metadata"][V]=O),x+=((g[x+3]&15)<<8|g[x+4])+5}y.programMapTable=p.programMapTable}},this.push=function(g){var y={},E=4;if(y.payloadUnitStartIndicator=!!(g[1]&64),y.pid=g[1]&31,y.pid<<=8,y.pid|=g[2],(g[3]&48)>>>4>1&&(E+=g[E]+1),y.pid===0)y.type="pat",l(g.subarray(E),y),this.trigger("data",y);else if(y.pid===this.pmtPid)for(y.type="pmt",l(g.subarray(E),y),this.trigger("data",y);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([g,E,y]):this.processPes_(g,E,y)},this.processPes_=function(g,y,E){E.pid===this.programMapTable.video?E.streamType=qt.H264_STREAM_TYPE:E.pid===this.programMapTable.audio?E.streamType=qt.ADTS_STREAM_TYPE:E.streamType=this.programMapTable["timed-metadata"][E.pid],E.type="pes",E.data=g.subarray(y),this.trigger("data",E)}},Er.prototype=new Lo,Er.STREAM_TYPES={h264:27,adts:15},Bi=function(){var l=this,d=!1,u={data:[],size:0},p={data:[],size:0},g={data:[],size:0},y,E=function(C,x){var O;const V=C[0]<<16|C[1]<<8|C[2];x.data=new Uint8Array,V===1&&(x.packetLength=6+(C[4]<<8|C[5]),x.dataAlignmentIndicator=(C[6]&4)!==0,O=C[7],O&192&&(x.pts=(C[9]&14)<<27|(C[10]&255)<<20|(C[11]&254)<<12|(C[12]&255)<<5|(C[13]&254)>>>3,x.pts*=4,x.pts+=(C[13]&6)>>>1,x.dts=x.pts,O&64&&(x.dts=(C[14]&14)<<27|(C[15]&255)<<20|(C[16]&254)<<12|(C[17]&255)<<5|(C[18]&254)>>>3,x.dts*=4,x.dts+=(C[18]&6)>>>1)),x.data=C.subarray(9+C[8]))},k=function(C,x,O){var V=new Uint8Array(C.size),Z={type:x},W=0,ie=0,de=!1,Qe;if(!(!C.data.length||C.size<9)){for(Z.trackId=C.data[0].pid,W=0;W<C.data.length;W++)Qe=C.data[W],V.set(Qe.data,ie),ie+=Qe.data.byteLength;E(V,Z),de=x==="video"||Z.packetLength<=C.size,(O||de)&&(C.size=0,C.data.length=0),de&&l.trigger("data",Z)}};Bi.prototype.init.call(this),this.push=function(C){({pat:function(){},pes:function(){var x,O;switch(C.streamType){case qt.H264_STREAM_TYPE:x=u,O="video";break;case qt.ADTS_STREAM_TYPE:x=p,O="audio";break;case qt.METADATA_STREAM_TYPE:x=g,O="timed-metadata";break;default:return}C.payloadUnitStartIndicator&&k(x,O,!0),x.data.push(C),x.size+=C.data.byteLength},pmt:function(){var x={type:"metadata",tracks:[]};y=C.programMapTable,y.video!==null&&x.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&x.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),d=!0,l.trigger("data",x)}})[C.type]()},this.reset=function(){u.size=0,u.data.length=0,p.size=0,p.data.length=0,this.trigger("reset")},this.flushStreams_=function(){k(u,"video"),k(p,"audio"),k(g,"timed-metadata")},this.flush=function(){if(!d&&y){var C={type:"metadata",tracks:[]};y.video!==null&&C.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.video,codec:"avc",type:"video"}),y.audio!==null&&C.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+y.audio,codec:"adts",type:"audio"}),l.trigger("data",C)}d=!1,this.flushStreams_(),this.trigger("done")}},Bi.prototype=new Lo;var vd={PAT_PID:0,MP2T_PACKET_LENGTH:Tn,TransportPacketStream:Ui,TransportParseStream:Er,ElementaryStream:Bi,TimestampRolloverStream:$y,CaptionStream:Po.CaptionStream,Cea608Stream:Po.Cea608Stream,Cea708Stream:Po.Cea708Stream,MetadataStream:Vy};for(var Do in qt)qt.hasOwnProperty(Do)&&(vd[Do]=qt[Do]);var Hy=vd,Wy=t,zy=A.ONE_SECOND_IN_TS,Fi,bd=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Fi=function(l){var d,u=0;Fi.prototype.init.call(this),this.skipWarn_=function(p,g){this.trigger("log",{level:"warn",message:`adts skiping bytes ${p} to ${g} in frame ${u} outside syncword`})},this.push=function(p){var g=0,y,E,k,C,x;if(l||(u=0),p.type==="audio"){d&&d.length?(k=d,d=new Uint8Array(k.byteLength+p.data.byteLength),d.set(k),d.set(p.data,k.byteLength)):d=p.data;for(var O;g+7<d.length;){if(d[g]!==255||(d[g+1]&246)!==240){typeof O!="number"&&(O=g),g++;continue}if(typeof O=="number"&&(this.skipWarn_(O,g),O=null),E=(~d[g+1]&1)*2,y=(d[g+3]&3)<<11|d[g+4]<<3|(d[g+5]&224)>>5,C=((d[g+6]&3)+1)*1024,x=C*zy/bd[(d[g+2]&60)>>>2],d.byteLength-g<y)break;this.trigger("data",{pts:p.pts+u*x,dts:p.dts+u*x,sampleCount:C,audioobjecttype:(d[g+2]>>>6&3)+1,channelcount:(d[g+2]&1)<<2|(d[g+3]&192)>>>6,samplerate:bd[(d[g+2]&60)>>>2],samplingfrequencyindex:(d[g+2]&60)>>>2,samplesize:16,data:d.subarray(g+7+E,g+y)}),u++,g+=y}typeof O=="number"&&(this.skipWarn_(O,g),O=null),d=d.subarray(g)}},this.flush=function(){u=0,this.trigger("done")},this.reset=function(){d=void 0,this.trigger("reset")},this.endTimeline=function(){d=void 0,this.trigger("endedtimeline")}},Fi.prototype=new Wy;var Gy=Fi,Td;Td=function(l){var d=l.byteLength,u=0,p=0;this.length=function(){return 8*d},this.bitsAvailable=function(){return 8*d+p},this.loadWord=function(){var g=l.byteLength-d,y=new Uint8Array(4),E=Math.min(4,d);if(E===0)throw new Error("no bytes available");y.set(l.subarray(g,g+E)),u=new DataView(y.buffer).getUint32(0),p=E*8,d-=E},this.skipBits=function(g){var y;p>g?(u<<=g,p-=g):(g-=p,y=Math.floor(g/8),g-=y*8,d-=y,this.loadWord(),u<<=g,p-=g)},this.readBits=function(g){var y=Math.min(p,g),E=u>>>32-y;return p-=y,p>0?u<<=y:d>0&&this.loadWord(),y=g-y,y>0?E<<y|this.readBits(y):E},this.skipLeadingZeros=function(){var g;for(g=0;g<p;++g)if(u&2147483648>>>g)return u<<=g,p-=g,g;return this.loadWord(),g+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var g=this.skipLeadingZeros();return this.readBits(g+1)-1},this.readExpGolomb=function(){var g=this.readUnsignedExpGolomb();return 1&g?1+g>>>1:-1*(g>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var Xy=Td,Ad=t,Yy=Xy,ji,wr,Sd;wr=function(){var l=0,d,u;wr.prototype.init.call(this),this.push=function(p){var g;u?(g=new Uint8Array(u.byteLength+p.data.byteLength),g.set(u),g.set(p.data,u.byteLength),u=g):u=p.data;for(var y=u.byteLength;l<y-3;l++)if(u[l+2]===1){d=l+5;break}for(;d<y;)switch(u[d]){case 0:if(u[d-1]!==0){d+=2;break}else if(u[d-2]!==0){d++;break}l+3!==d-2&&this.trigger("data",u.subarray(l+3,d-2));do d++;while(u[d]!==1&&d<y);l=d-2,d+=3;break;case 1:if(u[d-1]!==0||u[d-2]!==0){d+=3;break}this.trigger("data",u.subarray(l+3,d-2)),l=d-2,d+=3;break;default:d+=3;break}u=u.subarray(l),d-=l,l=0},this.reset=function(){u=null,l=0,this.trigger("reset")},this.flush=function(){u&&u.byteLength>3&&this.trigger("data",u.subarray(l+3)),u=null,l=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},wr.prototype=new Ad,Sd={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},ji=function(){var l=new wr,d,u,p,g,y,E,k;ji.prototype.init.call(this),d=this,this.push=function(C){C.type==="video"&&(u=C.trackId,p=C.pts,g=C.dts,l.push(C))},l.on("data",function(C){var x={trackId:u,pts:p,dts:g,data:C,nalUnitTypeCode:C[0]&31};switch(x.nalUnitTypeCode){case 5:x.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:x.nalUnitType="sei_rbsp",x.escapedRBSP=y(C.subarray(1));break;case 7:x.nalUnitType="seq_parameter_set_rbsp",x.escapedRBSP=y(C.subarray(1)),x.config=E(x.escapedRBSP);break;case 8:x.nalUnitType="pic_parameter_set_rbsp";break;case 9:x.nalUnitType="access_unit_delimiter_rbsp";break}d.trigger("data",x)}),l.on("done",function(){d.trigger("done")}),l.on("partialdone",function(){d.trigger("partialdone")}),l.on("reset",function(){d.trigger("reset")}),l.on("endedtimeline",function(){d.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},k=function(C,x){var O=8,V=8,Z,W;for(Z=0;Z<C;Z++)V!==0&&(W=x.readExpGolomb(),V=(O+W+256)%256),O=V===0?O:V},y=function(C){for(var x=C.byteLength,O=[],V=1,Z,W;V<x-2;)C[V]===0&&C[V+1]===0&&C[V+2]===3?(O.push(V+2),V+=2):V++;if(O.length===0)return C;Z=x-O.length,W=new Uint8Array(Z);var ie=0;for(V=0;V<Z;ie++,V++)ie===O[0]&&(ie++,O.shift()),W[V]=C[ie];return W},E=function(C){var x=0,O=0,V=0,Z=0,W,ie,de,Qe,pt,Kt,Dr,Ji,Zi,Zs,Nr,De=[1,1],Zd,en;if(W=new Yy(C),ie=W.readUnsignedByte(),Qe=W.readUnsignedByte(),de=W.readUnsignedByte(),W.skipUnsignedExpGolomb(),Sd[ie]&&(pt=W.readUnsignedExpGolomb(),pt===3&&W.skipBits(1),W.skipUnsignedExpGolomb(),W.skipUnsignedExpGolomb(),W.skipBits(1),W.readBoolean()))for(Nr=pt!==3?8:12,en=0;en<Nr;en++)W.readBoolean()&&(en<6?k(16,W):k(64,W));if(W.skipUnsignedExpGolomb(),Kt=W.readUnsignedExpGolomb(),Kt===0)W.readUnsignedExpGolomb();else if(Kt===1)for(W.skipBits(1),W.skipExpGolomb(),W.skipExpGolomb(),Dr=W.readUnsignedExpGolomb(),en=0;en<Dr;en++)W.skipExpGolomb();if(W.skipUnsignedExpGolomb(),W.skipBits(1),Ji=W.readUnsignedExpGolomb(),Zi=W.readUnsignedExpGolomb(),Zs=W.readBits(1),Zs===0&&W.skipBits(1),W.skipBits(1),W.readBoolean()&&(x=W.readUnsignedExpGolomb(),O=W.readUnsignedExpGolomb(),V=W.readUnsignedExpGolomb(),Z=W.readUnsignedExpGolomb()),W.readBoolean()&&W.readBoolean()){switch(Zd=W.readUnsignedByte(),Zd){case 1:De=[1,1];break;case 2:De=[12,11];break;case 3:De=[10,11];break;case 4:De=[16,11];break;case 5:De=[40,33];break;case 6:De=[24,11];break;case 7:De=[20,11];break;case 8:De=[32,11];break;case 9:De=[80,33];break;case 10:De=[18,11];break;case 11:De=[15,11];break;case 12:De=[64,33];break;case 13:De=[160,99];break;case 14:De=[4,3];break;case 15:De=[3,2];break;case 16:De=[2,1];break;case 255:{De=[W.readUnsignedByte()<<8|W.readUnsignedByte(),W.readUnsignedByte()<<8|W.readUnsignedByte()];break}}De&&De[0]/De[1]}return{profileIdc:ie,levelIdc:de,profileCompatibility:Qe,width:(Ji+1)*16-x*2-O*2,height:(2-Zs)*(Zi+1)*16-V*2-Z*2,sarRatio:De}}},ji.prototype=new Ad;var Ky={H264Stream:ji,NalByteStream:wr},Qy=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Ed=function(l,d){var u=l[d+6]<<21|l[d+7]<<14|l[d+8]<<7|l[d+9],p=l[d+5],g=(p&16)>>4;return u=u>=0?u:0,g?u+20:u+10},wd=function(l,d){return l.length-d<10||l[d]!==73||l[d+1]!==68||l[d+2]!==51?d:(d+=Ed(l,d),wd(l,d))},Jy=function(l){var d=wd(l,0);return l.length>=d+2&&(l[d]&255)===255&&(l[d+1]&240)===240&&(l[d+1]&22)===16},kd=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Zy=function(l,d,u){var p,g="";for(p=d;p<u;p++)g+="%"+("00"+l[p].toString(16)).slice(-2);return g},e_=function(l,d,u){return unescape(Zy(l,d,u))},t_=function(l,d){var u=(l[d+5]&224)>>5,p=l[d+4]<<3,g=l[d+3]&6144;return g|p|u},s_=function(l,d){return l[d]===73&&l[d+1]===68&&l[d+2]===51?"timed-metadata":l[d]&!0&&(l[d+1]&240)===240?"audio":null},n_=function(l){for(var d=0;d+5<l.length;){if(l[d]!==255||(l[d+1]&246)!==240){d++;continue}return Qy[(l[d+2]&60)>>>2]}return null},r_=function(l){var d,u,p,g;d=10,l[5]&64&&(d+=4,d+=kd(l.subarray(10,14)));do{if(u=kd(l.subarray(d+4,d+8)),u<1)return null;if(g=String.fromCharCode(l[d],l[d+1],l[d+2],l[d+3]),g==="PRIV"){p=l.subarray(d+10,d+u+10);for(var y=0;y<p.byteLength;y++)if(p[y]===0){var E=e_(p,0,y);if(E==="com.apple.streaming.transportStreamTimestamp"){var k=p.subarray(y+1),C=(k[3]&1)<<30|k[4]<<22|k[5]<<14|k[6]<<6|k[7]>>>2;return C*=4,C+=k[7]&3,C}break}}d+=10,d+=u}while(d<l.byteLength);return null},No={isLikelyAacData:Jy,parseId3TagSize:Ed,parseAdtsSize:t_,parseType:s_,parseSampleRate:n_,parseAacTimestamp:r_},i_=t,Cd=No,qi;qi=function(){var l=new Uint8Array,d=0;qi.prototype.init.call(this),this.setTimestamp=function(u){d=u},this.push=function(u){var p=0,g=0,y,E,k,C;for(l.length?(C=l.length,l=new Uint8Array(u.byteLength+C),l.set(l.subarray(0,C)),l.set(u,C)):l=u;l.length-g>=3;){if(l[g]===73&&l[g+1]===68&&l[g+2]===51){if(l.length-g<10||(p=Cd.parseId3TagSize(l,g),g+p>l.length))break;E={type:"timed-metadata",data:l.subarray(g,g+p)},this.trigger("data",E),g+=p;continue}else if((l[g]&255)===255&&(l[g+1]&240)===240){if(l.length-g<7||(p=Cd.parseAdtsSize(l,g),g+p>l.length))break;k={type:"audio",data:l.subarray(g,g+p),pts:d,dts:d},this.trigger("data",k),g+=p;continue}g++}y=l.length-g,y>0?l=l.subarray(g):l=new Uint8Array},this.reset=function(){l=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){l=new Uint8Array,this.trigger("endedtimeline")}},qi.prototype=new i_;var a_=qi,o_=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],l_=o_,c_=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],d_=c_,Vi=t,kr=Gs,Cr=Xs,$i=Ee,Vt=Ey,gs=Hy,Hi=A,Id=Gy,u_=Ky.H264Stream,h_=a_,p_=No.isLikelyAacData,m_=A.ONE_SECOND_IN_TS,Oo=l_,Mo=d_,Ir,An,Wi,Qs,f_=function(l,d){d.stream=l,this.trigger("log",d)},xd=function(l,d){for(var u=Object.keys(d),p=0;p<u.length;p++){var g=u[p];g==="headOfPipeline"||!d[g].on||d[g].on("log",f_.bind(l,g))}},Ld=function(l,d){var u;if(l.length!==d.length)return!1;for(u=0;u<l.length;u++)if(l[u]!==d[u])return!1;return!0},Uo=function(l,d,u,p,g,y){var E=u-d,k=p-d,C=g-u;return{start:{dts:l,pts:l+E},end:{dts:l+k,pts:l+C},prependedContentDuration:y,baseMediaDecodeTime:l}};An=function(l,d){var u=[],p,g=0,y=0,E=1/0;d=d||{},p=d.firstSequenceNumber||0,An.prototype.init.call(this),this.push=function(k){Vt.collectDtsInfo(l,k),l&&Oo.forEach(function(C){l[C]=k[C]}),u.push(k)},this.setEarliestDts=function(k){g=k},this.setVideoBaseMediaDecodeTime=function(k){E=k},this.setAudioAppendStart=function(k){y=k},this.flush=function(){var k,C,x,O,V,Z,W;if(u.length===0){this.trigger("done","AudioSegmentStream");return}k=$i.trimAdtsFramesByEarliestDts(u,l,g),l.baseMediaDecodeTime=Vt.calculateTrackBaseMediaDecodeTime(l,d.keepOriginalTimestamps),W=$i.prefixWithSilence(l,k,y,E),l.samples=$i.generateSampleTable(k),x=kr.mdat($i.concatenateFrameData(k)),u=[],C=kr.moof(p,[l]),O=new Uint8Array(C.byteLength+x.byteLength),p++,O.set(C),O.set(x,C.byteLength),Vt.clearDtsInfo(l),V=Math.ceil(m_*1024/l.samplerate),k.length&&(Z=k.length*V,this.trigger("segmentTimingInfo",Uo(Hi.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),k[0].dts,k[0].pts,k[0].dts+Z,k[0].pts+Z,W||0)),this.trigger("timingInfo",{start:k[0].pts,end:k[0].pts+Z})),this.trigger("data",{track:l,boxes:O}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Vt.clearDtsInfo(l),u=[],this.trigger("reset")}},An.prototype=new Vi,Ir=function(l,d){var u,p=[],g=[],y,E;d=d||{},u=d.firstSequenceNumber||0,Ir.prototype.init.call(this),delete l.minPTS,this.gopCache_=[],this.push=function(k){Vt.collectDtsInfo(l,k),k.nalUnitType==="seq_parameter_set_rbsp"&&!y&&(y=k.config,l.sps=[k.data],Mo.forEach(function(C){l[C]=y[C]},this)),k.nalUnitType==="pic_parameter_set_rbsp"&&!E&&(E=k.data,l.pps=[k.data]),p.push(k)},this.flush=function(){for(var k,C,x,O,V,Z,W=0,ie,de;p.length&&p[0].nalUnitType!=="access_unit_delimiter_rbsp";)p.shift();if(p.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(k=Cr.groupNalsIntoFrames(p),x=Cr.groupFramesIntoGops(k),x[0][0].keyFrame||(C=this.getGopForFusion_(p[0],l),C?(W=C.duration,x.unshift(C),x.byteLength+=C.byteLength,x.nalCount+=C.nalCount,x.pts=C.pts,x.dts=C.dts,x.duration+=C.duration):x=Cr.extendFirstKeyFrame(x)),g.length){var Qe;if(d.alignGopsAtEnd?Qe=this.alignGopsAtEnd_(x):Qe=this.alignGopsAtStart_(x),!Qe){this.gopCache_.unshift({gop:x.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),p=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Vt.clearDtsInfo(l),x=Qe}Vt.collectDtsInfo(l,x),l.samples=Cr.generateSampleTable(x),V=kr.mdat(Cr.concatenateNalData(x)),l.baseMediaDecodeTime=Vt.calculateTrackBaseMediaDecodeTime(l,d.keepOriginalTimestamps),this.trigger("processedGopsInfo",x.map(function(pt){return{pts:pt.pts,dts:pt.dts,byteLength:pt.byteLength}})),ie=x[0],de=x[x.length-1],this.trigger("segmentTimingInfo",Uo(l.baseMediaDecodeTime,ie.dts,ie.pts,de.dts+de.duration,de.pts+de.duration,W)),this.trigger("timingInfo",{start:x[0].pts,end:x[x.length-1].pts+x[x.length-1].duration}),this.gopCache_.unshift({gop:x.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),p=[],this.trigger("baseMediaDecodeTime",l.baseMediaDecodeTime),this.trigger("timelineStartInfo",l.timelineStartInfo),O=kr.moof(u,[l]),Z=new Uint8Array(O.byteLength+V.byteLength),u++,Z.set(O),Z.set(V,O.byteLength),this.trigger("data",{track:l,boxes:Z}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),p=[],this.gopCache_.length=0,g.length=0,this.trigger("reset")},this.resetStream_=function(){Vt.clearDtsInfo(l),y=void 0,E=void 0},this.getGopForFusion_=function(k){var C=45e3,x=1e4,O=1/0,V,Z,W,ie,de;for(de=0;de<this.gopCache_.length;de++)ie=this.gopCache_[de],W=ie.gop,!(!(l.pps&&Ld(l.pps[0],ie.pps[0]))||!(l.sps&&Ld(l.sps[0],ie.sps[0])))&&(W.dts<l.timelineStartInfo.dts||(V=k.dts-W.dts-W.duration,V>=-x&&V<=C&&(!Z||O>V)&&(Z=ie,O=V)));return Z?Z.gop:null},this.alignGopsAtStart_=function(k){var C,x,O,V,Z,W,ie,de;for(Z=k.byteLength,W=k.nalCount,ie=k.duration,C=x=0;C<g.length&&x<k.length&&(O=g[C],V=k[x],O.pts!==V.pts);){if(V.pts>O.pts){C++;continue}x++,Z-=V.byteLength,W-=V.nalCount,ie-=V.duration}return x===0?k:x===k.length?null:(de=k.slice(x),de.byteLength=Z,de.duration=ie,de.nalCount=W,de.pts=de[0].pts,de.dts=de[0].dts,de)},this.alignGopsAtEnd_=function(k){var C,x,O,V,Z,W;for(C=g.length-1,x=k.length-1,Z=null,W=!1;C>=0&&x>=0;){if(O=g[C],V=k[x],O.pts===V.pts){W=!0;break}if(O.pts>V.pts){C--;continue}C===g.length-1&&(Z=x),x--}if(!W&&Z===null)return null;var ie;if(W?ie=x:ie=Z,ie===0)return k;var de=k.slice(ie),Qe=de.reduce(function(pt,Kt){return pt.byteLength+=Kt.byteLength,pt.duration+=Kt.duration,pt.nalCount+=Kt.nalCount,pt},{byteLength:0,duration:0,nalCount:0});return de.byteLength=Qe.byteLength,de.duration=Qe.duration,de.nalCount=Qe.nalCount,de.pts=de[0].pts,de.dts=de[0].dts,de},this.alignGopsWith=function(k){g=k}},Ir.prototype=new Vi,Qs=function(l,d){this.numberOfTracks=0,this.metadataStream=d,l=l||{},typeof l.remux<"u"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=l.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Qs.prototype.init.call(this),this.push=function(u){if(u.content||u.text)return this.pendingCaptions.push(u);if(u.frames)return this.pendingMetadata.push(u);this.pendingTracks.push(u.track),this.pendingBytes+=u.boxes.byteLength,u.track.type==="video"&&(this.videoTrack=u.track,this.pendingBoxes.push(u.boxes)),u.track.type==="audio"&&(this.audioTrack=u.track,this.pendingBoxes.unshift(u.boxes))}},Qs.prototype=new Vi,Qs.prototype.flush=function(l){var d=0,u={captions:[],captionStreams:{},metadata:[],info:{}},p,g,y,E=0,k;if(this.pendingTracks.length<this.numberOfTracks){if(l!=="VideoSegmentStream"&&l!=="AudioSegmentStream"||this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(E=this.videoTrack.timelineStartInfo.pts,Mo.forEach(function(C){u.info[C]=this.videoTrack[C]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,Oo.forEach(function(C){u.info[C]=this.audioTrack[C]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?u.type=this.pendingTracks[0].type:u.type="combined",this.emittedTracks+=this.pendingTracks.length,y=kr.initSegment(this.pendingTracks),u.initSegment=new Uint8Array(y.byteLength),u.initSegment.set(y),u.data=new Uint8Array(this.pendingBytes),k=0;k<this.pendingBoxes.length;k++)u.data.set(this.pendingBoxes[k],d),d+=this.pendingBoxes[k].byteLength;for(k=0;k<this.pendingCaptions.length;k++)p=this.pendingCaptions[k],p.startTime=Hi.metadataTsToSeconds(p.startPts,E,this.keepOriginalTimestamps),p.endTime=Hi.metadataTsToSeconds(p.endPts,E,this.keepOriginalTimestamps),u.captionStreams[p.stream]=!0,u.captions.push(p);for(k=0;k<this.pendingMetadata.length;k++)g=this.pendingMetadata[k],g.cueTime=Hi.metadataTsToSeconds(g.pts,E,this.keepOriginalTimestamps),u.metadata.push(g);for(u.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",u),k=0;k<u.captions.length;k++)p=u.captions[k],this.trigger("caption",p);for(k=0;k<u.metadata.length;k++)g=u.metadata[k],this.trigger("id3Frame",g)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Qs.prototype.setRemux=function(l){this.remuxTracks=l},Wi=function(l){var d=this,u=!0,p,g;Wi.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="aac",y.metadataStream=new gs.MetadataStream,y.aacStream=new h_,y.audioTimestampRolloverStream=new gs.TimestampRolloverStream("audio"),y.timedMetadataTimestampRolloverStream=new gs.TimestampRolloverStream("timed-metadata"),y.adtsStream=new Id,y.coalesceStream=new Qs(l,y.metadataStream),y.headOfPipeline=y.aacStream,y.aacStream.pipe(y.audioTimestampRolloverStream).pipe(y.adtsStream),y.aacStream.pipe(y.timedMetadataTimestampRolloverStream).pipe(y.metadataStream).pipe(y.coalesceStream),y.metadataStream.on("timestamp",function(E){y.aacStream.setTimestamp(E.timeStamp)}),y.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||y.audioSegmentStream||(g=g||{timelineStartInfo:{baseMediaDecodeTime:d.baseMediaDecodeTime},codec:"adts",type:"audio"},y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new An(g,l),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!p}))}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xd(this,y)},this.setupTsPipeline=function(){var y={};this.transmuxPipeline_=y,y.type="ts",y.metadataStream=new gs.MetadataStream,y.packetStream=new gs.TransportPacketStream,y.parseStream=new gs.TransportParseStream,y.elementaryStream=new gs.ElementaryStream,y.timestampRolloverStream=new gs.TimestampRolloverStream,y.adtsStream=new Id,y.h264Stream=new u_,y.captionStream=new gs.CaptionStream(l),y.coalesceStream=new Qs(l,y.metadataStream),y.headOfPipeline=y.packetStream,y.packetStream.pipe(y.parseStream).pipe(y.elementaryStream).pipe(y.timestampRolloverStream),y.timestampRolloverStream.pipe(y.h264Stream),y.timestampRolloverStream.pipe(y.adtsStream),y.timestampRolloverStream.pipe(y.metadataStream).pipe(y.coalesceStream),y.h264Stream.pipe(y.captionStream).pipe(y.coalesceStream),y.elementaryStream.on("data",function(E){var k;if(E.type==="metadata"){for(k=E.tracks.length;k--;)!p&&E.tracks[k].type==="video"?(p=E.tracks[k],p.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime):!g&&E.tracks[k].type==="audio"&&(g=E.tracks[k],g.timelineStartInfo.baseMediaDecodeTime=d.baseMediaDecodeTime);p&&!y.videoSegmentStream&&(y.coalesceStream.numberOfTracks++,y.videoSegmentStream=new Ir(p,l),y.videoSegmentStream.on("log",d.getLogTrigger_("videoSegmentStream")),y.videoSegmentStream.on("timelineStartInfo",function(C){g&&!l.keepOriginalTimestamps&&(g.timelineStartInfo=C,y.audioSegmentStream.setEarliestDts(C.dts-d.baseMediaDecodeTime))}),y.videoSegmentStream.on("processedGopsInfo",d.trigger.bind(d,"gopInfo")),y.videoSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"videoSegmentTimingInfo")),y.videoSegmentStream.on("baseMediaDecodeTime",function(C){g&&y.audioSegmentStream.setVideoBaseMediaDecodeTime(C)}),y.videoSegmentStream.on("timingInfo",d.trigger.bind(d,"videoTimingInfo")),y.h264Stream.pipe(y.videoSegmentStream).pipe(y.coalesceStream)),g&&!y.audioSegmentStream&&(y.coalesceStream.numberOfTracks++,y.audioSegmentStream=new An(g,l),y.audioSegmentStream.on("log",d.getLogTrigger_("audioSegmentStream")),y.audioSegmentStream.on("timingInfo",d.trigger.bind(d,"audioTimingInfo")),y.audioSegmentStream.on("segmentTimingInfo",d.trigger.bind(d,"audioSegmentTimingInfo")),y.adtsStream.pipe(y.audioSegmentStream).pipe(y.coalesceStream)),d.trigger("trackinfo",{hasAudio:!!g,hasVideo:!!p})}}),y.coalesceStream.on("data",this.trigger.bind(this,"data")),y.coalesceStream.on("id3Frame",function(E){E.dispatchType=y.metadataStream.dispatchType,d.trigger("id3Frame",E)}),y.coalesceStream.on("caption",this.trigger.bind(this,"caption")),y.coalesceStream.on("done",this.trigger.bind(this,"done")),xd(this,y)},this.setBaseMediaDecodeTime=function(y){var E=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=y),g&&(g.timelineStartInfo.dts=void 0,g.timelineStartInfo.pts=void 0,Vt.clearDtsInfo(g),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),p&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),p.timelineStartInfo.dts=void 0,p.timelineStartInfo.pts=void 0,Vt.clearDtsInfo(p),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(y){g&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(y)},this.setRemux=function(y){var E=this.transmuxPipeline_;l.remux=y,E&&E.coalesceStream&&E.coalesceStream.setRemux(y)},this.alignGopsWith=function(y){p&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(y)},this.getLogTrigger_=function(y){var E=this;return function(k){k.stream=y,E.trigger("log",k)}},this.push=function(y){if(u){var E=p_(y);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),u=!1}this.transmuxPipeline_.headOfPipeline.push(y)},this.flush=function(){u=!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()}},Wi.prototype=new Vi;var g_={Transmuxer:Wi,VideoSegmentStream:Ir,AudioSegmentStream:An,AUDIO_PROPERTIES:Oo,VIDEO_PROPERTIES:Mo,generateSegmentTimingInfo:Uo},y_=function(l){return l>>>0},__=function(l){return("00"+l.toString(16)).slice(-2)},zi={toUnsigned:y_,toHexString:__},v_=function(l){var d="";return d+=String.fromCharCode(l[0]),d+=String.fromCharCode(l[1]),d+=String.fromCharCode(l[2]),d+=String.fromCharCode(l[3]),d},Bo=v_,b_=zi.toUnsigned,T_=Bo,Pd=function(l,d){var u=[],p,g,y,E,k;if(!d.length)return null;for(p=0;p<l.byteLength;)g=b_(l[p]<<24|l[p+1]<<16|l[p+2]<<8|l[p+3]),y=T_(l.subarray(p+4,p+8)),E=g>1?p+g:l.byteLength,y===d[0]&&(d.length===1?u.push(l.subarray(p+8,E)):(k=Pd(l.subarray(p+8,E),d.slice(1)),k.length&&(u=u.concat(k)))),p=E;return u},Gi=Pd,A_=zi.toUnsigned,S_=i.getUint64,E_=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4))};return d.version===1?d.baseMediaDecodeTime=S_(l.subarray(4)):d.baseMediaDecodeTime=A_(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),d},Fo=E_,w_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4)},p=u.flags[2]&1,g=u.flags[2]&2,y=u.flags[2]&8,E=u.flags[2]&16,k=u.flags[2]&32,C=u.flags[0]&65536,x=u.flags[0]&131072,O;return O=8,p&&(O+=4,u.baseDataOffset=d.getUint32(12),O+=4),g&&(u.sampleDescriptionIndex=d.getUint32(O),O+=4),y&&(u.defaultSampleDuration=d.getUint32(O),O+=4),E&&(u.defaultSampleSize=d.getUint32(O),O+=4),k&&(u.defaultSampleFlags=d.getUint32(O)),C&&(u.durationIsEmpty=!0),!p&&x&&(u.baseDataOffsetIsMoof=!0),u},jo=w_,Rd=i.getUint64,k_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),references:[],referenceId:d.getUint32(4),timescale:d.getUint32(8)},p=12;u.version===0?(u.earliestPresentationTime=d.getUint32(p),u.firstOffset=d.getUint32(p+4),p+=8):(u.earliestPresentationTime=Rd(l.subarray(p)),u.firstOffset=Rd(l.subarray(p+8)),p+=16),p+=2;var g=d.getUint16(p);for(p+=2;g>0;p+=12,g--)u.references.push({referenceType:(l[p]&128)>>>7,referencedSize:d.getUint32(p)&2147483647,subsegmentDuration:d.getUint32(p+4),startsWithSap:!!(l[p+8]&128),sapType:(l[p+8]&112)>>>4,sapDeltaTime:d.getUint32(p+8)&268435455});return u},C_=k_,I_=function(l){return{isLeading:(l[0]&12)>>>2,dependsOn:l[0]&3,isDependedOn:(l[1]&192)>>>6,hasRedundancy:(l[1]&48)>>>4,paddingValue:(l[1]&14)>>>1,isNonSyncSample:l[1]&1,degradationPriority:l[2]<<8|l[3]}},x_=I_,Dd=x_,L_=function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},u=new DataView(l.buffer,l.byteOffset,l.byteLength),p=d.flags[2]&1,g=d.flags[2]&4,y=d.flags[1]&1,E=d.flags[1]&2,k=d.flags[1]&4,C=d.flags[1]&8,x=u.getUint32(4),O=8,V;for(p&&(d.dataOffset=u.getInt32(O),O+=4),g&&x&&(V={flags:Dd(l.subarray(O,O+4))},O+=4,y&&(V.duration=u.getUint32(O),O+=4),E&&(V.size=u.getUint32(O),O+=4),C&&(d.version===1?V.compositionTimeOffset=u.getInt32(O):V.compositionTimeOffset=u.getUint32(O),O+=4),d.samples.push(V),x--);x--;)V={},y&&(V.duration=u.getUint32(O),O+=4),E&&(V.size=u.getUint32(O),O+=4),k&&(V.flags=Dd(l.subarray(O,O+4)),O+=4),C&&(d.version===1?V.compositionTimeOffset=u.getInt32(O):V.compositionTimeOffset=u.getUint32(O),O+=4),d.samples.push(V);return d},Nd=L_,P_=i,Od=P_.getUint64,rt,qo,Nt=function(l){return new Date(l*1e3-20828448e5)},xr=Bo,R_=Gi,D_=function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=[],p,g;for(p=0;p+4<l.length;p+=g){if(g=d.getUint32(p),p+=4,g<=0){u.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(l[p]&31){case 1:u.push("slice_layer_without_partitioning_rbsp");break;case 5:u.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:u.push("sei_rbsp");break;case 7:u.push("seq_parameter_set_rbsp");break;case 8:u.push("pic_parameter_set_rbsp");break;case 9:u.push("access_unit_delimiter_rbsp");break;default:u.push("UNKNOWN NAL - "+l[p]&31);break}}return u},Rs={avc1:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{dataReferenceIndex:d.getUint16(6),width:d.getUint16(24),height:d.getUint16(26),horizresolution:d.getUint16(28)+d.getUint16(30)/16,vertresolution:d.getUint16(32)+d.getUint16(34)/16,frameCount:d.getUint16(40),depth:d.getUint16(74),config:rt(l.subarray(78,l.byteLength))}},avcC:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={configurationVersion:l[0],avcProfileIndication:l[1],profileCompatibility:l[2],avcLevelIndication:l[3],lengthSizeMinusOne:l[4]&3,sps:[],pps:[]},p=l[5]&31,g,y,E,k;for(E=6,k=0;k<p;k++)y=d.getUint16(E),E+=2,u.sps.push(new Uint8Array(l.subarray(E,E+y))),E+=y;for(g=l[E],E++,k=0;k<g;k++)y=d.getUint16(E),E+=2,u.pps.push(new Uint8Array(l.subarray(E,E+y))),E+=y;return u},btrt:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{bufferSizeDB:d.getUint32(0),maxBitrate:d.getUint32(4),avgBitrate:d.getUint32(8)}},edts:function(l){return{boxes:rt(l)}},elst:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),edits:[]},p=d.getUint32(4),g;for(g=8;p;p--)u.version===0?(u.edits.push({segmentDuration:d.getUint32(g),mediaTime:d.getInt32(g+4),mediaRate:d.getUint16(g+8)+d.getUint16(g+10)/(256*256)}),g+=12):(u.edits.push({segmentDuration:Od(l.subarray(g)),mediaTime:Od(l.subarray(g+8)),mediaRate:d.getUint16(g+16)+d.getUint16(g+18)/(256*256)}),g+=20);return u},esds:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),esId:l[6]<<8|l[7],streamPriority:l[8]&31,decoderConfig:{objectProfileIndication:l[11],streamType:l[12]>>>2&63,bufferSize:l[13]<<16|l[14]<<8|l[15],maxBitrate:l[16]<<24|l[17]<<16|l[18]<<8|l[19],avgBitrate:l[20]<<24|l[21]<<16|l[22]<<8|l[23],decoderConfigDescriptor:{tag:l[24],length:l[25],audioObjectType:l[26]>>>3&31,samplingFrequencyIndex:(l[26]&7)<<1|l[27]>>>7&1,channelConfiguration:l[27]>>>3&15}}}},ftyp:function(l){for(var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={majorBrand:xr(l.subarray(0,4)),minorVersion:d.getUint32(4),compatibleBrands:[]},p=8;p<l.byteLength;)u.compatibleBrands.push(xr(l.subarray(p,p+4))),p+=4;return u},dinf:function(l){return{boxes:rt(l)}},dref:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),dataReferences:rt(l.subarray(8))}},hdlr:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),handlerType:xr(l.subarray(8,12)),name:""},p=8;for(p=24;p<l.byteLength;p++){if(l[p]===0){p++;break}u.name+=String.fromCharCode(l[p])}return u.name=decodeURIComponent(escape(u.name)),u},mdat:function(l){return{byteLength:l.byteLength,nals:D_(l)}},mdhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p,g={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),language:""};return g.version===1?(u+=4,g.creationTime=Nt(d.getUint32(u)),u+=8,g.modificationTime=Nt(d.getUint32(u)),u+=4,g.timescale=d.getUint32(u),u+=8,g.duration=d.getUint32(u)):(g.creationTime=Nt(d.getUint32(u)),u+=4,g.modificationTime=Nt(d.getUint32(u)),u+=4,g.timescale=d.getUint32(u),u+=4,g.duration=d.getUint32(u)),u+=4,p=d.getUint16(u),g.language+=String.fromCharCode((p>>10)+96),g.language+=String.fromCharCode(((p&992)>>5)+96),g.language+=String.fromCharCode((p&31)+96),g},mdia:function(l){return{boxes:rt(l)}},mfhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sequenceNumber:l[4]<<24|l[5]<<16|l[6]<<8|l[7]}},minf:function(l){return{boxes:rt(l)}},mp4a:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={dataReferenceIndex:d.getUint16(6),channelcount:d.getUint16(16),samplesize:d.getUint16(18),samplerate:d.getUint16(24)+d.getUint16(26)/65536};return l.byteLength>28&&(u.streamDescriptor=rt(l.subarray(28))[0]),u},moof:function(l){return{boxes:rt(l)}},moov:function(l){return{boxes:rt(l)}},mvex:function(l){return{boxes:rt(l)}},mvhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return p.version===1?(u+=4,p.creationTime=Nt(d.getUint32(u)),u+=8,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.timescale=d.getUint32(u),u+=8,p.duration=d.getUint32(u)):(p.creationTime=Nt(d.getUint32(u)),u+=4,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.timescale=d.getUint32(u),u+=4,p.duration=d.getUint32(u)),u+=4,p.rate=d.getUint16(u)+d.getUint16(u+2)/16,u+=4,p.volume=d.getUint8(u)+d.getUint8(u+1)/8,u+=2,u+=2,u+=2*4,p.matrix=new Uint32Array(l.subarray(u,u+9*4)),u+=9*4,u+=6*4,p.nextTrackId=d.getUint32(u),p},pdin:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),rate:d.getUint32(4),initialDelay:d.getUint32(8)}},sdtp:function(l){var d={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},u;for(u=4;u<l.byteLength;u++)d.samples.push({dependsOn:(l[u]&48)>>4,isDependedOn:(l[u]&12)>>2,hasRedundancy:l[u]&3});return d},sidx:C_,smhd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),balance:l[4]+l[5]/256}},stbl:function(l){return{boxes:rt(l)}},ctts:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),compositionOffsets:[]},p=d.getUint32(4),g;for(g=8;p;g+=8,p--)u.compositionOffsets.push({sampleCount:d.getUint32(g),sampleOffset:d[u.version===0?"getUint32":"getInt32"](g+4)});return u},stss:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4)),syncSamples:[]},p=d.getUint32(4),g;for(g=8;p;g+=4,p--)u.syncSamples.push(d.getUint32(g));return u},stco:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),chunkOffsets:[]},p=d.getUint32(4),g;for(g=8;p;g+=4,p--)u.chunkOffsets.push(d.getUint32(g));return u},stsc:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=d.getUint32(4),p={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleToChunks:[]},g;for(g=8;u;g+=12,u--)p.sampleToChunks.push({firstChunk:d.getUint32(g),samplesPerChunk:d.getUint32(g+4),sampleDescriptionIndex:d.getUint32(g+8)});return p},stsd:function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleDescriptions:rt(l.subarray(8))}},stsz:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),sampleSize:d.getUint32(4),entries:[]},p;for(p=12;p<l.byteLength;p+=4)u.entries.push(d.getUint32(p));return u},stts:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u={version:l[0],flags:new Uint8Array(l.subarray(1,4)),timeToSamples:[]},p=d.getUint32(4),g;for(g=8;p;g+=8,p--)u.timeToSamples.push({sampleCount:d.getUint32(g),sampleDelta:d.getUint32(g+4)});return u},styp:function(l){return Rs.ftyp(l)},tfdt:Fo,tfhd:jo,tkhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength),u=4,p={version:d.getUint8(0),flags:new Uint8Array(l.subarray(1,4))};return p.version===1?(u+=4,p.creationTime=Nt(d.getUint32(u)),u+=8,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.trackId=d.getUint32(u),u+=4,u+=8,p.duration=d.getUint32(u)):(p.creationTime=Nt(d.getUint32(u)),u+=4,p.modificationTime=Nt(d.getUint32(u)),u+=4,p.trackId=d.getUint32(u),u+=4,u+=4,p.duration=d.getUint32(u)),u+=4,u+=2*4,p.layer=d.getUint16(u),u+=2,p.alternateGroup=d.getUint16(u),u+=2,p.volume=d.getUint8(u)+d.getUint8(u+1)/8,u+=2,u+=2,p.matrix=new Uint32Array(l.subarray(u,u+9*4)),u+=9*4,p.width=d.getUint16(u)+d.getUint16(u+2)/65536,u+=4,p.height=d.getUint16(u)+d.getUint16(u+2)/65536,p},traf:function(l){return{boxes:rt(l)}},trak:function(l){return{boxes:rt(l)}},trex:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:d.getUint32(4),defaultSampleDescriptionIndex:d.getUint32(8),defaultSampleDuration:d.getUint32(12),defaultSampleSize:d.getUint32(16),sampleDependsOn:l[20]&3,sampleIsDependedOn:(l[21]&192)>>6,sampleHasRedundancy:(l[21]&48)>>4,samplePaddingValue:(l[21]&14)>>1,sampleIsDifferenceSample:!!(l[21]&1),sampleDegradationPriority:d.getUint16(22)}},trun:Nd,"url ":function(l){return{version:l[0],flags:new Uint8Array(l.subarray(1,4))}},vmhd:function(l){var d=new DataView(l.buffer,l.byteOffset,l.byteLength);return{version:l[0],flags:new Uint8Array(l.subarray(1,4)),graphicsmode:d.getUint16(4),opcolor:new Uint16Array([d.getUint16(6),d.getUint16(8),d.getUint16(10)])}}};rt=function(l){for(var d=0,u=[],p,g,y,E,k,C=new ArrayBuffer(l.length),x=new Uint8Array(C),O=0;O<l.length;++O)x[O]=l[O];for(p=new DataView(C);d<l.byteLength;)g=p.getUint32(d),y=xr(l.subarray(d+4,d+8)),E=g>1?d+g:l.byteLength,k=(Rs[y]||function(V){return{data:V}})(l.subarray(d+8,E)),k.size=g,k.type=y,u.push(k),d=E;return u},qo=function(l,d){var u;return d=d||0,u=new Array(d*2+1).join(" "),l.map(function(p,g){return u+p.type+`
|
|
200
200
|
`+Object.keys(p).filter(function(y){return y!=="type"&&y!=="boxes"}).map(function(y){var E=u+" "+y+": ",k=p[y];if(k instanceof Uint8Array||k instanceof Uint32Array){var C=Array.prototype.slice.call(new Uint8Array(k.buffer,k.byteOffset,k.byteLength)).map(function(x){return" "+("00"+x.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return C?C.length===1?E+"<"+C.join("").slice(1)+">":E+`<
|
|
201
201
|
`+C.map(function(x){return u+" "+x}).join(`
|
|
202
202
|
`)+`
|
|
@@ -205,19 +205,19 @@ browserWorkerPolyFill(self);
|
|
|
205
205
|
`)}).join(`
|
|
206
206
|
`)+(p.boxes?`
|
|
207
207
|
`+qo(p.boxes,d+1):"")}).join(`
|
|
208
|
-
`)};var Md={inspect:rt,textify:qo,parseType:xr,findBox:R_,parseTraf:Rs.traf,parseTfdt:Rs.tfdt,parseHdlr:Rs.hdlr,parseTfhd:Rs.tfhd,parseTrun:Rs.trun,parseSidx:Rs.sidx},N_=function(l){for(var d=0,u=String.fromCharCode(l[d]),p="";u!=="\0";)p+=u,d++,u=String.fromCharCode(l[d]);return p+=u,p},O_={uint8ToCString:N_},Xi=O_.uint8ToCString,M_=i.getUint64,U_=function(l){var d=4,u=l[0],p,g,y,E,k,C,x,O;if(u===0){p=Xi(l.subarray(d)),d+=p.length,g=Xi(l.subarray(d)),d+=g.length;var V=new DataView(l.buffer);y=V.getUint32(d),d+=4,k=V.getUint32(d),d+=4,C=V.getUint32(d),d+=4,x=V.getUint32(d),d+=4}else if(u===1){var V=new DataView(l.buffer);y=V.getUint32(d),d+=4,E=M_(l.subarray(d)),d+=8,C=V.getUint32(d),d+=4,x=V.getUint32(d),d+=4,p=Xi(l.subarray(d)),d+=p.length,g=Xi(l.subarray(d)),d+=g.length}O=new Uint8Array(l.subarray(d,l.byteLength));var ee={scheme_id_uri:p,value:g,timescale:y||1,presentation_time:E,presentation_time_delta:k,event_duration:C,id:x,message_data:O};return F_(u,ee)?ee:void 0},B_=function(l,d,u,p){return l||l===0?l/d:p+u/d},F_=function(l,d){var u=d.scheme_id_uri!=="\0",p=l===0&&Ud(d.presentation_time_delta)&&u,g=l===1&&Ud(d.presentation_time)&&u;return!(l>1)&&p||g},Ud=function(l){return l!==void 0||l!==null},j_={parseEmsgBox:U_,scaleTime:B_},Lr;typeof window<"u"?Lr=window:typeof s<"u"?Lr=s:typeof self<"u"?Lr=self:Lr={};var Bd=Lr,Yi=zi.toUnsigned,Pr=zi.toHexString,$e=Gi,Sn=Bo,Vo=j_,q_=jo,V_=Nd,$_=Fo,H_=i.getUint64,Fd,jd,qd,Vd,$d,$o,Hd,Ho=Bd,W_=_d.parseId3Frames;Fd=function(l){var d={},u=$e(l,["moov","trak"]);return u.reduce(function(p,g){var y,E,k,C,x;return y=$e(g,["tkhd"])[0],!y||(E=y[0],k=E===0?12:20,C=Yi(y[k]<<24|y[k+1]<<16|y[k+2]<<8|y[k+3]),x=$e(g,["mdia","mdhd"])[0],!x)?null:(E=x[0],k=E===0?12:20,p[C]=Yi(x[k]<<24|x[k+1]<<16|x[k+2]<<8|x[k+3]),p)},d)},jd=function(l,d){var u;u=$e(d,["moof","traf"]);var p=u.reduce(function(g,y){var E=$e(y,["tfhd"])[0],k=Yi(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),C=l[k]||9e4,x=$e(y,["tfdt"])[0],O=new DataView(x.buffer,x.byteOffset,x.byteLength),V;x[0]===1?V=H_(x.subarray(4,12)):V=O.getUint32(4);let ee;return typeof V=="bigint"?ee=V/Ho.BigInt(C):typeof V=="number"&&!isNaN(V)&&(ee=V/C),ee<Number.MAX_SAFE_INTEGER&&(ee=Number(ee)),ee<g&&(g=ee),g},1/0);return typeof p=="bigint"||isFinite(p)?p:0},qd=function(l,d){var u=$e(d,["moof","traf"]),p=0,g=0,y;if(u&&u.length){var E=$e(u[0],["tfhd"])[0],k=$e(u[0],["trun"])[0],C=$e(u[0],["tfdt"])[0];if(E){var x=q_(E);y=x.trackId}if(C){var O=$_(C);p=O.baseMediaDecodeTime}if(k){var V=V_(k);V.samples&&V.samples.length&&(g=V.samples[0].compositionTimeOffset||0)}}var ee=l[y]||9e4;typeof p=="bigint"&&(g=Ho.BigInt(g),ee=Ho.BigInt(ee));var W=(p+g)/ee;return typeof W=="bigint"&&W<Number.MAX_SAFE_INTEGER&&(W=Number(W)),W},Vd=function(l){var d=$e(l,["moov","trak"]),u=[];return d.forEach(function(p){var g=$e(p,["mdia","hdlr"]),y=$e(p,["tkhd"]);g.forEach(function(E,k){var C=Sn(E.subarray(8,12)),x=y[k],O,V,ee;C==="vide"&&(O=new DataView(x.buffer,x.byteOffset,x.byteLength),V=O.getUint8(0),ee=V===0?O.getUint32(12):O.getUint32(20),u.push(ee))})}),u},$o=function(l){var d=l[0],u=d===0?12:20;return Yi(l[u]<<24|l[u+1]<<16|l[u+2]<<8|l[u+3])},$d=function(l){var d=$e(l,["moov","trak"]),u=[];return d.forEach(function(p){var g={},y=$e(p,["tkhd"])[0],E,k;y&&(E=new DataView(y.buffer,y.byteOffset,y.byteLength),k=E.getUint8(0),g.id=k===0?E.getUint32(12):E.getUint32(20));var C=$e(p,["mdia","hdlr"])[0];if(C){var x=Sn(C.subarray(8,12));x==="vide"?g.type="video":x==="soun"?g.type="audio":g.type=x}var O=$e(p,["mdia","minf","stbl","stsd"])[0];if(O){var V=O.subarray(8);g.codec=Sn(V.subarray(4,8));var ee=$e(V,[g.codec])[0],W,re;ee&&(/^[asm]vc[1-9]$/i.test(g.codec)?(W=ee.subarray(78),re=Sn(W.subarray(4,8)),re==="avcC"&&W.length>11?(g.codec+=".",g.codec+=Pr(W[9]),g.codec+=Pr(W[10]),g.codec+=Pr(W[11])):g.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(g.codec)?(W=ee.subarray(28),re=Sn(W.subarray(4,8)),re==="esds"&&W.length>20&&W[19]!==0?(g.codec+="."+Pr(W[19]),g.codec+="."+Pr(W[20]>>>2&63).replace(/^0/,"")):g.codec="mp4a.40.2"):g.codec=g.codec.toLowerCase())}var le=$e(p,["mdia","mdhd"])[0];le&&(g.timescale=$o(le)),u.push(g)}),u},Hd=function(l,d=0){var u=$e(l,["emsg"]);return u.map(p=>{var g=Vo.parseEmsgBox(new Uint8Array(p)),y=W_(g.message_data);return{cueTime:Vo.scaleTime(g.presentation_time,g.timescale,g.presentation_time_delta,d),duration:Vo.scaleTime(g.event_duration,g.timescale),frames:y}})};var Rr={findBox:$e,parseType:Sn,timescale:Fd,startTime:jd,compositionStartTime:qd,videoTrackIds:Vd,tracks:$d,getTimescaleFromMediaHeader:$o,getEmsgID3:Hd};const{parseTrun:z_}=Md,{findBox:Wd}=Rr;var zd=Bd,G_=function(l){var d=Wd(l,["moof","traf"]),u=Wd(l,["mdat"]),p=[];return u.forEach(function(g,y){var E=d[y];p.push({mdat:g,traf:E})}),p},X_=function(l,d,u){var p=d,g=u.defaultSampleDuration||0,y=u.defaultSampleSize||0,E=u.trackId,k=[];return l.forEach(function(C){var x=z_(C),O=x.samples;O.forEach(function(V){V.duration===void 0&&(V.duration=g),V.size===void 0&&(V.size=y),V.trackId=E,V.dts=p,V.compositionTimeOffset===void 0&&(V.compositionTimeOffset=0),typeof p=="bigint"?(V.pts=p+zd.BigInt(V.compositionTimeOffset),p+=zd.BigInt(V.duration)):(V.pts=p+V.compositionTimeOffset,p+=V.duration)}),k=k.concat(O)}),k},Gd={getMdatTrafPairs:G_,parseSamples:X_},Y_=pd.discardEmulationPreventionBytes,K_=md.CaptionStream,Wo=Gi,Q_=Fo,Z_=jo,{getMdatTrafPairs:J_,parseSamples:ev}=Gd,tv=function(l,d){for(var u=l,p=0;p<d.length;p++){var g=d[p];if(u<g.size)return g;u-=g.size}return null},sv=function(l,d,u){var p=new DataView(l.buffer,l.byteOffset,l.byteLength),g={logs:[],seiNals:[]},y,E,k,C;for(E=0;E+4<l.length;E+=k)if(k=p.getUint32(E),E+=4,!(k<=0))switch(l[E]&31){case 6:var x=l.subarray(E+1,E+1+k),O=tv(E,d);if(y={nalUnitType:"sei_rbsp",size:k,data:x,escapedRBSP:Y_(x),trackId:u},O)y.pts=O.pts,y.dts=O.dts,C=O;else if(C)y.pts=C.pts,y.dts=C.dts;else{g.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+E+" for trackId "+u+". See mux.js#223."});break}g.seiNals.push(y);break}return g},nv=function(l,d){var u={},p=J_(l);return p.forEach(function(g){var y=g.mdat,E=g.traf,k=Wo(E,["tfhd"]),C=Z_(k[0]),x=C.trackId,O=Wo(E,["tfdt"]),V=O.length>0?Q_(O[0]).baseMediaDecodeTime:0,ee=Wo(E,["trun"]),W,re;d===x&&ee.length>0&&(W=ev(ee,V,C),re=sv(y,W,x),u[x]||(u[x]={seiNals:[],logs:[]}),u[x].seiNals=u[x].seiNals.concat(re.seiNals),u[x].logs=u[x].logs.concat(re.logs))}),u},rv=function(l,d,u){var p;if(d===null)return null;p=nv(l,d);var g=p[d]||{};return{seiNals:g.seiNals,logs:g.logs,timescale:u}},iv=function(){var l=!1,d,u,p,g,y,E;this.isInitialized=function(){return l},this.init=function(k){d=new K_,l=!0,E=k?k.isPartial:!1,d.on("data",function(C){C.startTime=C.startPts/g,C.endTime=C.endPts/g,y.captions.push(C),y.captionStreams[C.stream]=!0}),d.on("log",function(C){y.logs.push(C)})},this.isNewInit=function(k,C){return k&&k.length===0||C&&typeof C=="object"&&Object.keys(C).length===0?!1:p!==k[0]||g!==C[p]},this.parse=function(k,C,x){var O;if(this.isInitialized()){if(!C||!x)return null;if(this.isNewInit(C,x))p=C[0],g=x[p];else if(p===null||!g)return u.push(k),null}else return null;for(;u.length>0;){var V=u.shift();this.parse(V,C,x)}return O=rv(k,p,g),O&&O.logs&&(y.logs=y.logs.concat(O.logs)),O===null||!O.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(O.seiNals),this.flushStream(),y)},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(C){d.push(C)})},this.flushStream=function(){if(!this.isInitialized())return null;E?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){u=[],p=null,g=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},av=iv;const{parseTfdt:ov}=Md,Ds=Gi,{getTimescaleFromMediaHeader:lv}=Rr,{parseSamples:cv,getMdatTrafPairs:dv}=Gd;var Xd=function(){let l=9e4;this.init=function(d){const u=Ds(d,["moov","trak","mdia","mdhd"])[0];u&&(l=lv(u))},this.parseSegment=function(d){const u=[],p=dv(d);let g=0;return p.forEach(function(y){const E=y.mdat,k=y.traf,C=Ds(k,["tfdt"])[0],x=Ds(k,["tfhd"])[0],O=Ds(k,["trun"]);if(C&&(g=ov(C).baseMediaDecodeTime),O.length&&x){const V=cv(O,g,x);let ee=0;V.forEach(function(W){const re="utf-8",le=new TextDecoder(re),Qe=E.slice(ee,ee+W.size);if(Ds(Qe,["vtte"])[0]){ee+=W.size;return}Ds(Qe,["vttc"]).forEach(function(pt){const Kt=Ds(pt,["payl"])[0],Dr=Ds(pt,["sttg"])[0],Zi=W.pts/l,Ji=(W.pts+W.duration)/l;let Js,Nr;if(Kt)try{Js=le.decode(Kt)}catch(De){console.error(De)}if(Dr)try{Nr=le.decode(Dr)}catch(De){console.error(De)}W.duration&&Js&&u.push({cueText:Js,start:Zi,end:Ji,settings:Nr})}),ee+=W.size})}}),u}},zo=Di,Yd=function(l){var d=l[1]&31;return d<<=8,d|=l[2],d},Ki=function(l){return!!(l[1]&64)},Qi=function(l){var d=0;return(l[3]&48)>>>4>1&&(d+=l[4]+1),d},uv=function(l,d){var u=Yd(l);return u===0?"pat":u===d?"pmt":d?"pes":null},hv=function(l){var d=Ki(l),u=4+Qi(l);return d&&(u+=l[u]+1),(l[u+10]&31)<<8|l[u+11]},pv=function(l){var d={},u=Ki(l),p=4+Qi(l);if(u&&(p+=l[p]+1),!!(l[p+5]&1)){var g,y,E;g=(l[p+1]&15)<<8|l[p+2],y=3+g-4,E=(l[p+10]&15)<<8|l[p+11];for(var k=12+E;k<y;){var C=p+k;d[(l[C+1]&31)<<8|l[C+2]]=l[C],k+=((l[C+3]&15)<<8|l[C+4])+5}return d}},mv=function(l,d){var u=Yd(l),p=d[u];switch(p){case zo.H264_STREAM_TYPE:return"video";case zo.ADTS_STREAM_TYPE:return"audio";case zo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},fv=function(l){var d=Ki(l);if(!d)return null;var u=4+Qi(l);if(u>=l.byteLength)return null;var p=null,g;return g=l[u+7],g&192&&(p={},p.pts=(l[u+9]&14)<<27|(l[u+10]&255)<<20|(l[u+11]&254)<<12|(l[u+12]&255)<<5|(l[u+13]&254)>>>3,p.pts*=4,p.pts+=(l[u+13]&6)>>>1,p.dts=p.pts,g&64&&(p.dts=(l[u+14]&14)<<27|(l[u+15]&255)<<20|(l[u+16]&254)<<12|(l[u+17]&255)<<5|(l[u+18]&254)>>>3,p.dts*=4,p.dts+=(l[u+18]&6)>>>1)),p},Go=function(l){switch(l){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}},gv=function(l){for(var d=4+Qi(l),u=l.subarray(d),p=0,g=0,y=!1,E;g<u.byteLength-3;g++)if(u[g+2]===1){p=g+5;break}for(;p<u.byteLength;)switch(u[p]){case 0:if(u[p-1]!==0){p+=2;break}else if(u[p-2]!==0){p++;break}g+3!==p-2&&(E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0));do p++;while(u[p]!==1&&p<u.length);g=p-2,p+=3;break;case 1:if(u[p-1]!==0||u[p-2]!==0){p+=3;break}E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0),g=p-2,p+=3;break;default:p+=3;break}return u=u.subarray(g),p-=g,g=0,u&&u.byteLength>3&&(E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},yv={parseType:uv,parsePat:hv,parsePmt:pv,parsePayloadUnitStartIndicator:Ki,parsePesType:mv,parsePesTime:fv,videoPacketContainsKeyFrame:gv},Kd=Di,En=gd.handleRollover,Te={};Te.ts=yv,Te.aac=No;var Zs=A.ONE_SECOND_IN_TS,ht=188,Yt=71,_v=function(l,d){for(var u=0,p=ht,g,y;p<l.byteLength;){if(l[u]===Yt&&l[p]===Yt){switch(g=l.subarray(u,p),y=Te.ts.parseType(g,d.pid),y){case"pat":d.pid=Te.ts.parsePat(g);break;case"pmt":var E=Te.ts.parsePmt(g);d.table=d.table||{},Object.keys(E).forEach(function(k){d.table[k]=E[k]});break}u+=ht,p+=ht;continue}u++,p++}},Qd=function(l,d,u){for(var p=0,g=ht,y,E,k,C,x,O=!1;g<=l.byteLength;){if(l[p]===Yt&&(l[g]===Yt||g===l.byteLength)){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="audio",u.audio.push(x),O=!0));break}if(O)break;p+=ht,g+=ht;continue}p++,g++}for(g=l.byteLength,p=g-ht,O=!1;p>=0;){if(l[p]===Yt&&(l[g]===Yt||g===l.byteLength)){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="audio",u.audio.push(x),O=!0));break}if(O)break;p-=ht,g-=ht;continue}p--,g--}},vv=function(l,d,u){for(var p=0,g=ht,y,E,k,C,x,O,V,ee,W=!1,re={data:[],size:0};g<l.byteLength;){if(l[p]===Yt&&l[g]===Yt){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":if(k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&(C&&!W&&(x=Te.ts.parsePesTime(y),x&&(x.type="video",u.video.push(x),W=!0)),!u.firstKeyFrame)){if(C&&re.size!==0){for(O=new Uint8Array(re.size),V=0;re.data.length;)ee=re.data.shift(),O.set(ee,V),V+=ee.byteLength;if(Te.ts.videoPacketContainsKeyFrame(O)){var le=Te.ts.parsePesTime(O);le?(u.firstKeyFrame=le,u.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.")}re.size=0}re.data.push(y),re.size+=y.byteLength}break}if(W&&u.firstKeyFrame)break;p+=ht,g+=ht;continue}p++,g++}for(g=l.byteLength,p=g-ht,W=!1;p>=0;){if(l[p]===Yt&&l[g]===Yt){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="video",u.video.push(x),W=!0));break}if(W)break;p-=ht,g-=ht;continue}p--,g--}},bv=function(l,d){if(l.audio&&l.audio.length){var u=d;(typeof u>"u"||isNaN(u))&&(u=l.audio[0].dts),l.audio.forEach(function(y){y.dts=En(y.dts,u),y.pts=En(y.pts,u),y.dtsTime=y.dts/Zs,y.ptsTime=y.pts/Zs})}if(l.video&&l.video.length){var p=d;if((typeof p>"u"||isNaN(p))&&(p=l.video[0].dts),l.video.forEach(function(y){y.dts=En(y.dts,p),y.pts=En(y.pts,p),y.dtsTime=y.dts/Zs,y.ptsTime=y.pts/Zs}),l.firstKeyFrame){var g=l.firstKeyFrame;g.dts=En(g.dts,p),g.pts=En(g.pts,p),g.dtsTime=g.dts/Zs,g.ptsTime=g.pts/Zs}}},Tv=function(l){for(var d=!1,u=0,p=null,g=null,y=0,E=0,k;l.length-E>=3;){var C=Te.aac.parseType(l,E);switch(C){case"timed-metadata":if(l.length-E<10){d=!0;break}if(y=Te.aac.parseId3TagSize(l,E),y>l.length){d=!0;break}g===null&&(k=l.subarray(E,E+y),g=Te.aac.parseAacTimestamp(k)),E+=y;break;case"audio":if(l.length-E<7){d=!0;break}if(y=Te.aac.parseAdtsSize(l,E),y>l.length){d=!0;break}p===null&&(k=l.subarray(E,E+y),p=Te.aac.parseSampleRate(k)),u++,E+=y;break;default:E++;break}if(d)return null}if(p===null||g===null)return null;var x=Zs/p,O={audio:[{type:"audio",dts:g,pts:g},{type:"audio",dts:g+u*1024*x,pts:g+u*1024*x}]};return O},Av=function(l){var d={pid:null,table:null},u={};_v(l,d);for(var p in d.table)if(d.table.hasOwnProperty(p)){var g=d.table[p];switch(g){case Kd.H264_STREAM_TYPE:u.video=[],vv(l,d,u),u.video.length===0&&delete u.video;break;case Kd.ADTS_STREAM_TYPE:u.audio=[],Qd(l,d,u),u.audio.length===0&&delete u.audio;break}}return u},Sv=function(l,d){var u=Te.aac.isLikelyAacData(l),p;return u?p=Tv(l):p=Av(l),!p||!p.audio&&!p.video?null:(bv(p,d),p)},Ev={inspect:Sv,parseAudioPes_:Qd};const wv=function(l,d){d.on("data",function(u){const p=u.initSegment;u.initSegment={data:p.buffer,byteOffset:p.byteOffset,byteLength:p.byteLength};const g=u.data;u.data=g.buffer,l.postMessage({action:"data",segment:u,byteOffset:g.byteOffset,byteLength:g.byteLength},[u.data])}),d.on("done",function(u){l.postMessage({action:"done"})}),d.on("gopInfo",function(u){l.postMessage({action:"gopInfo",gopInfo:u})}),d.on("videoSegmentTimingInfo",function(u){const p={start:{decode:A.videoTsToSeconds(u.start.dts),presentation:A.videoTsToSeconds(u.start.pts)},end:{decode:A.videoTsToSeconds(u.end.dts),presentation:A.videoTsToSeconds(u.end.pts)},baseMediaDecodeTime:A.videoTsToSeconds(u.baseMediaDecodeTime)};u.prependedContentDuration&&(p.prependedContentDuration=A.videoTsToSeconds(u.prependedContentDuration)),l.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:p})}),d.on("audioSegmentTimingInfo",function(u){const p={start:{decode:A.videoTsToSeconds(u.start.dts),presentation:A.videoTsToSeconds(u.start.pts)},end:{decode:A.videoTsToSeconds(u.end.dts),presentation:A.videoTsToSeconds(u.end.pts)},baseMediaDecodeTime:A.videoTsToSeconds(u.baseMediaDecodeTime)};u.prependedContentDuration&&(p.prependedContentDuration=A.videoTsToSeconds(u.prependedContentDuration)),l.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:p})}),d.on("id3Frame",function(u){l.postMessage({action:"id3Frame",id3Frame:u})}),d.on("caption",function(u){l.postMessage({action:"caption",caption:u})}),d.on("trackinfo",function(u){l.postMessage({action:"trackinfo",trackInfo:u})}),d.on("audioTimingInfo",function(u){l.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:A.videoTsToSeconds(u.start),end:A.videoTsToSeconds(u.end)}})}),d.on("videoTimingInfo",function(u){l.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:A.videoTsToSeconds(u.start),end:A.videoTsToSeconds(u.end)}})}),d.on("log",function(u){l.postMessage({action:"log",log:u})})};class Zd{constructor(d,u){this.options=u||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new g_.Transmuxer(this.options),wv(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new av,this.captionParser.init());const u=new Uint8Array(d.data,d.byteOffset,d.byteLength),p=this.captionParser.parse(u,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:p&&p.captions||[],logs:p&&p.logs||[],data:u.buffer},[u.buffer])}initMp4WebVttParser(d){this.webVttParser||(this.webVttParser=new Xd);const u=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.webVttParser.init(u)}getMp4WebVttText(d){this.webVttParser||(this.webVttParser=new Xd);const u=new Uint8Array(d.data,d.byteOffset,d.byteLength),p=this.webVttParser.parseSegment(u);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:p||[],data:u.buffer},[u.buffer])}probeMp4StartTime({timescales:d,data:u}){const p=Rr.startTime(d,u);this.self.postMessage({action:"probeMp4StartTime",startTime:p,data:u},[u.buffer])}probeMp4Tracks({data:d}){const u=Rr.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:u,data:d},[d.buffer])}probeEmsgID3({data:d,offset:u}){const p=Rr.getEmsgID3(d,u);this.self.postMessage({action:"probeEmsgID3",id3Frames:p,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:u}){const p=typeof u=="number"&&!isNaN(u)?u*A.ONE_SECOND_IN_TS:void 0,g=Ev.inspect(d,p);let y=null;g&&(y={hasVideo:g.video&&g.video.length===2||!1,hasAudio:g.audio&&g.audio.length===2||!1},y.hasVideo&&(y.videoStart=g.video[0].ptsTime),y.hasAudio&&(y.audioStart=g.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const u=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(u)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const u=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(A.secondsToVideoTs(u)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(A.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(l){if(l.data.action==="init"&&l.data.options){this.messageHandlers=new Zd(self,l.data.options);return}this.messageHandlers||(this.messageHandlers=new Zd(self)),l.data&&l.data.action&&l.data.action!=="init"&&this.messageHandlers[l.data.action]&&this.messageHandlers[l.data.action](l.data)}}));var AE=_g(TE);const SE=(s,e,t)=>{const{type:n,initSegment:r,captions:i,captionStreams:a,metadata:o,videoFrameDtsTime:c,videoFramePtsTime:h}=s.data.segment;e.buffer.push({captions:i,captionStreams:a,metadata:o});const m=s.data.segment.boxes||{data:s.data.segment.data},_={type:n,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof c<"u"&&(_.videoFrameDtsTime=c),typeof h<"u"&&(_.videoFramePtsTime=h),t(_)},EE=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},wE=(s,e)=>{e.gopInfo=s.data.gopInfo},Tg=s=>{const{transmuxer:e,bytes:t,audioAppendStart:n,gopsToAlignWith:r,remux:i,onData:a,onTrackInfo:o,onAudioTimingInfo:c,onVideoTimingInfo:h,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:_,onId3:T,onCaptions:S,onDone:w,onEndedTimeline:b,onTransmuxerLog:R,isEndOfTimeline:L,segment:U,triggerSegmentEventFn:M}=s,F={buffer:[]};let N=L;const j=K=>{e.currentTransmux===s&&(K.data.action==="data"&&SE(K,F,a),K.data.action==="trackinfo"&&o(K.data.trackInfo),K.data.action==="gopInfo"&&wE(K,F),K.data.action==="audioTimingInfo"&&c(K.data.audioTimingInfo),K.data.action==="videoTimingInfo"&&h(K.data.videoTimingInfo),K.data.action==="videoSegmentTimingInfo"&&m(K.data.videoSegmentTimingInfo),K.data.action==="audioSegmentTimingInfo"&&_(K.data.audioSegmentTimingInfo),K.data.action==="id3Frame"&&T([K.data.id3Frame],K.data.id3Frame.dispatchType),K.data.action==="caption"&&S(K.data.caption),K.data.action==="endedtimeline"&&(N=!1,b()),K.data.action==="log"&&R(K.data.log),K.data.type==="transmuxed"&&(N||(e.onmessage=null,EE({transmuxedData:F,callback:w}),Ag(e))))},J=()=>{const K={message:"Received an error message from the transmuxer worker",metadata:{errorType:P.Error.StreamingFailedToTransmuxSegment,segmentInfo:rn({segment:U})}};w(null,K)};if(e.onmessage=j,e.onerror=J,n&&e.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof i<"u"&&e.postMessage({action:"setRemux",remux:i}),t.byteLength){const K=t instanceof ArrayBuffer?t:t.buffer,ne=t instanceof ArrayBuffer?0:t.byteOffset;M({type:"segmenttransmuxingstart",segment:U}),e.postMessage({action:"push",data:K,byteOffset:ne,byteLength:t.byteLength},[K])}L&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Ag=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():Tg(s.currentTransmux))},bh=(s,e)=>{s.postMessage({action:e}),Ag(s)},Sg=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,bh(e,s);return}e.transmuxQueue.push(bh.bind(null,e,s))},kE=s=>{Sg("reset",s)},CE=s=>{Sg("endTimeline",s)},Eg=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,Tg(s);return}s.transmuxer.transmuxQueue.push(s)},IE=s=>{const e=new AE;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 gl={reset:kE,endTimeline:CE,transmux:Eg,createTransmuxer:IE};const Hn=function(s){const e=s.transmuxer,t=s.endAction||s.action,n=s.callback,r=ze({},s,{endAction:null,transmuxer:null,callback:null}),i=a=>{a.data.action===t&&(e.removeEventListener("message",i),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)),n(a.data))};if(e.addEventListener("message",i),s.data){const a=s.data instanceof ArrayBuffer;r.byteOffset=a?0:s.data.byteOffset,r.byteLength=s.data.byteLength;const o=[a?s.data:s.data.buffer];e.postMessage(r,o)}else e.postMessage(r)},rs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},wg="wvtt",Gl=s=>{s.forEach(e=>{e.abort()})},xE=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),LE=s=>{const e=s.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return t.bytesReceived=s.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},ad=(s,e)=>{const{requestType:t}=e,n=pn({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:rs.TIMEOUT,xhr:e,metadata:n}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:rs.ABORTED,xhr:e,metadata:n}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:rs.FAILURE,xhr:e,metadata:n}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:rs.FAILURE,xhr:e,metadata:n}:null},Th=(s,e,t,n)=>(r,i)=>{const a=i.response,o=ad(r,i);if(o)return t(o,s);if(a.byteLength!==16)return t({status:i.status,message:"Invalid HLS key at URL: "+i.uri,code:rs.FAILURE,xhr:i},s);const c=new DataView(a),h=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=h;const m={uri:i.uri};return n({type:"segmentkeyloadcomplete",segment:s,keyInfo:m}),t(null,s)},PE=(s,e)=>{e===wg&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},RE=(s,e,t)=>{e===wg&&Hn({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:n,mp4VttCues:r})=>{s.bytes=n,t(null,s,{mp4VttCues:r})}})},kg=(s,e)=>{const t=kc(s.map.bytes);if(t!=="mp4"){const n=s.map.resolvedUri||s.map.uri,r=t||"unknown";return e({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${n}`,code:rs.FAILURE,metadata:{mediaType:r}})}Hn({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:n,data:r})=>(s.map.bytes=r,n.forEach(function(i){s.map.tracks=s.map.tracks||{},!s.map.tracks[i.type]&&(s.map.tracks[i.type]=i,typeof i.id=="number"&&i.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[i.id]=i.timescale),i.type==="text"&&PE(s,i.codec))}),e(null))})},DE=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(n,r)=>{const i=ad(n,r);if(i)return e(i,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,kg(s,function(o){if(o)return o.xhr=r,o.status=r.status,e(o,s);e(null,s)})},NE=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:n})=>(r,i)=>{const a=ad(r,i);if(a)return e(a,s);n({type:"segmentloaded",segment:s});const o=t==="arraybuffer"||!i.responseText?i.response:vE(i.responseText.substring(s.lastReachedChar||0));return s.stats=xE(i),s.key?s.encryptedBytes=new Uint8Array(o):s.bytes=new Uint8Array(o),e(null,s)},OE=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{const w=s.map&&s.map.tracks||{},b=!!(w.audio&&w.video);let R=n.bind(null,s,"audio","start");const L=n.bind(null,s,"audio","end");let U=n.bind(null,s,"video","start");const M=n.bind(null,s,"video","end"),F=()=>Eg({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:b,onData:N=>{N.type=N.type==="combined"?"video":N.type,m(s,N)},onTrackInfo:N=>{t&&(b&&(N.isMuxed=!0),t(s,N))},onAudioTimingInfo:N=>{R&&typeof N.start<"u"&&(R(N.start),R=null),L&&typeof N.end<"u"&&L(N.end)},onVideoTimingInfo:N=>{U&&typeof N.start<"u"&&(U(N.start),U=null),M&&typeof N.end<"u"&&M(N.end)},onVideoSegmentTimingInfo:N=>{const j={pts:{start:N.start.presentation,end:N.end.presentation},dts:{start:N.start.decode,end:N.end.decode}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),r(N)},onAudioSegmentTimingInfo:N=>{const j={pts:{start:N.start.pts,end:N.end.pts},dts:{start:N.start.dts,end:N.end.dts}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),i(N)},onId3:(N,j)=>{a(s,N,j)},onCaptions:N=>{o(s,[N])},isEndOfTimeline:c,onEndedTimeline:()=>{h()},onTransmuxerLog:T,onDone:(N,j)=>{_&&(N.type=N.type==="combined"?"video":N.type,S({type:"segmenttransmuxingcomplete",segment:s}),_(j,s,N))},segment:s,triggerSegmentEventFn:S});Hn({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:N=>{s.bytes=e=N.data;const j=N.result;j&&(t(s,{hasAudio:j.hasAudio,hasVideo:j.hasVideo,isMuxed:b}),t=null),F()}})},Cg=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{let w=new Uint8Array(e);if(nA(w)){s.isFmp4=!0;const{tracks:b}=s.map;if(b.text&&(!b.audio||!b.video)){m(s,{data:w,type:"text"}),RE(s,b.text.codec,_);return}const R={isFmp4:!0,hasVideo:!!b.video,hasAudio:!!b.audio};b.audio&&b.audio.codec&&b.audio.codec!=="enca"&&(R.audioCodec=b.audio.codec),b.video&&b.video.codec&&b.video.codec!=="encv"&&(R.videoCodec=b.video.codec),b.video&&b.audio&&(R.isMuxed=!0),t(s,R);const L=(U,M)=>{m(s,{data:w,type:R.hasAudio&&!R.isMuxed?"audio":"video"}),M&&M.length&&a(s,M),U&&U.length&&o(s,U),_(null,s,{})};Hn({action:"probeMp4StartTime",timescales:s.map.timescales,data:w,transmuxer:s.transmuxer,callback:({data:U,startTime:M})=>{e=U.buffer,s.bytes=w=U,R.hasAudio&&!R.isMuxed&&n(s,"audio","start",M),R.hasVideo&&n(s,"video","start",M),Hn({action:"probeEmsgID3",data:w,transmuxer:s.transmuxer,offset:M,callback:({emsgData:F,id3Frames:N})=>{if(e=F.buffer,s.bytes=w=F,!b.video||!F.byteLength||!s.transmuxer){L(void 0,N);return}Hn({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:w,timescales:s.map.timescales,trackIds:[b.video.id],callback:j=>{e=j.data.buffer,s.bytes=w=j.data,j.logs.forEach(function(J){T(ve(J,{stream:"mp4CaptionParser"}))}),L(j.captions,N)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=kc(w)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}OE({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})},Ig=function({id:s,key:e,encryptedBytes:t,decryptionWorker:n,segment:r,doneFn:i},a){const o=h=>{if(h.data.source===s){n.removeEventListener("message",o);const m=h.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};n.onerror=()=>{const h="An error occurred in the decryption worker",m=rn({segment:r}),_={message:h,metadata:{error:new Error(h),errorType:P.Error.StreamingFailedToDecryptSegment,segmentInfo:m,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};i(_,r)},n.addEventListener("message",o);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),n.postMessage(hg({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},ME=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{S({type:"segmentdecryptionstart"}),Ig({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},w=>{e.bytes=w,S({type:"segmentdecryptioncomplete",segment:e}),Cg({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})})},UE=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{let w=0,b=!1;return(R,L)=>{if(!b){if(R)return b=!0,Gl(s),_(R,L);if(w+=1,w===s.length){const U=function(){if(L.encryptedBytes)return ME({decryptionWorker:e,segment:L,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S});Cg({segment:L,bytes:L.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})};if(L.endOfAllRequests=Date.now(),L.map&&L.map.encryptedBytes&&!L.map.bytes)return S({type:"segmentdecryptionstart",segment:L}),Ig({decryptionWorker:e,id:L.requestId+"-init",encryptedBytes:L.map.encryptedBytes,key:L.map.key,segment:L,doneFn:_},M=>{L.map.bytes=M,S({type:"segmentdecryptioncomplete",segment:L}),kg(L,F=>{if(F)return Gl(s),_(F,L);U()})});U()}}}},BE=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},FE=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m})=>_=>{if(!_.target.aborted)return s.stats=ve(s.stats,LE(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},jE=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:n,abortFn:r,progressFn:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w,doneFn:b,onTransmuxerLog:R,triggerSegmentEventFn:L})=>{const U=[],M=UE({activeXhrs:U,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w,doneFn:b,onTransmuxerLog:R,triggerSegmentEventFn:L});if(n.key&&!n.key.bytes){const K=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&K.push(n.map.key);const ne=ve(e,{uri:n.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),he=Th(n,K,M,L),oe={uri:n.key.resolvedUri};L({type:"segmentkeyloadstart",segment:n,keyInfo:oe});const me=s(ne,he);U.push(me)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const oe=ve(e,{uri:n.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),me=Th(n,[n.map.key],M,L),te={uri:n.map.key.resolvedUri};L({type:"segmentkeyloadstart",segment:n,keyInfo:te});const ue=s(oe,me);U.push(ue)}const K=ve(e,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Wl(n.map),requestType:"segment-media-initialization"}),ne=DE({segment:n,finishProcessingFn:M,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:n});const he=s(K,ne);U.push(he)}const F=ve(e,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Wl(n),requestType:"segment"}),N=NE({segment:n,finishProcessingFn:M,responseType:F.responseType,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:n});const j=s(F,N);j.addEventListener("progress",FE({segment:n,progressFn:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w})),U.push(j);const J={};return U.forEach(K=>{K.addEventListener("loadend",BE({loadendState:J,abortFn:r}))}),()=>Gl(U)},qE=jt("CodecUtils"),VE=function(s){const e=s.attributes||{};if(e.CODECS)return Zt(e.CODECS)},xg=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},$E=(s,e)=>{if(!xg(s,e))return!0;const t=e.attributes||{},n=s.mediaGroups.AUDIO[t.AUDIO];for(const r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1},za=function(s){const e={};return s.forEach(({mediaType:t,type:n,details:r})=>{e[t]=e[t]||[],e[t].push(Np(`${n}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){qE(`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},Ah=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},ii=function(s,e){const t=e.attributes||{},n=za(VE(e)||[]);if(xg(s,e)&&!n.audio&&!$E(s,e)){const r=za(iT(s,t.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},aa=jt("PlaylistSelector"),Sh=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||""})},Ga=function(s,e){if(!s)return"";const t=I.getComputedStyle(s);return t?t[e]:""},Wn=function(s,e){const t=s.slice();s.sort(function(n,r){const i=e(n,r);return i===0?t.indexOf(n)-t.indexOf(r):i})},od=function(s,e){let t,n;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||I.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||I.Number.MAX_VALUE,t-n},HE=function(s,e){let t,n;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||I.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||I.Number.MAX_VALUE,t===n&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-n};let Lg=function(s,e,t,n,r,i){if(!s)return;const a={bandwidth:e,width:t,height:n,limitRenditionByPlayerDimensions:r};let o=s.playlists;Et.isAudioOnly(s)&&(o=i.getAudioTrackPlaylists_(),a.audioOnly=!0);let c=o.map(N=>{let j;const J=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.width,K=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.height;return j=N.attributes&&N.attributes.BANDWIDTH,j=j||I.Number.MAX_VALUE,{bandwidth:j,width:J,height:K,playlist:N}});Wn(c,(N,j)=>N.bandwidth-j.bandwidth),c=c.filter(N=>!Et.isIncompatible(N.playlist));let h=c.filter(N=>Et.isEnabled(N.playlist));h.length||(h=c.filter(N=>!Et.isDisabled(N.playlist)));const m=h.filter(N=>N.bandwidth*Ze.BANDWIDTH_VARIANCE<e);let _=m[m.length-1];const T=m.filter(N=>N.bandwidth===_.bandwidth)[0];if(r===!1){const N=T||h[0]||c[0];if(N&&N.playlist){let j="sortedPlaylistReps";return T&&(j="bandwidthBestRep"),h[0]&&(j="enabledPlaylistReps"),aa(`choosing ${Sh(N)} using ${j} with options`,a),N.playlist}return aa("could not choose a playlist with options",a),null}const S=m.filter(N=>N.width&&N.height);Wn(S,(N,j)=>N.width-j.width);const w=S.filter(N=>N.width===t&&N.height===n);_=w[w.length-1];const b=w.filter(N=>N.bandwidth===_.bandwidth)[0];let R,L,U;b||(R=S.filter(N=>N.width>t||N.height>n),L=R.filter(N=>N.width===R[0].width&&N.height===R[0].height),_=L[L.length-1],U=L.filter(N=>N.bandwidth===_.bandwidth)[0]);let M;if(i.leastPixelDiffSelector){const N=S.map(j=>(j.pixelDiff=Math.abs(j.width-t)+Math.abs(j.height-n),j));Wn(N,(j,J)=>j.pixelDiff===J.pixelDiff?J.bandwidth-j.bandwidth:j.pixelDiff-J.pixelDiff),M=N[0]}const F=M||U||b||T||h[0]||c[0];if(F&&F.playlist){let N="sortedPlaylistReps";return M?N="leastPixelDiffRep":U?N="resolutionPlusOneRep":b?N="resolutionBestRep":T?N="bandwidthBestRep":h[0]&&(N="enabledPlaylistReps"),aa(`choosing ${Sh(F)} using ${N} with options`,a),F.playlist}return aa("could not choose a playlist with options",a),null};const Eh=function(){let s=this.useDevicePixelRatio&&I.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),Lg(this.playlists.main,this.systemBandwidth,parseInt(Ga(this.tech_.el(),"width"),10)*s,parseInt(Ga(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)},WE=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 n=this.useDevicePixelRatio&&I.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=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),Lg(this.playlists.main,e,parseInt(Ga(this.tech_.el(),"width"),10)*n,parseInt(Ga(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},zE=function(s){const{main:e,currentTime:t,bandwidth:n,duration:r,segmentDuration:i,timeUntilRebuffer:a,currentTimeline:o,syncController:c}=s,h=e.playlists.filter(S=>!Et.isIncompatible(S));let m=h.filter(Et.isEnabled);m.length||(m=h.filter(S=>!Et.isDisabled(S)));const _=m.filter(Et.hasAttribute.bind(null,"BANDWIDTH")).map(S=>{const w=c.getSyncPoint(S,r,o,t)?1:2,b=Et.estimateSegmentRequestTime(i,n,S)*w-a;return{playlist:S,rebufferingImpact:b}}),T=_.filter(S=>S.rebufferingImpact<=0);return Wn(T,(S,w)=>od(w.playlist,S.playlist)),T.length?T[0]:(Wn(_,(S,w)=>S.rebufferingImpact-w.rebufferingImpact),_[0]||null)},GE=function(){const s=this.playlists.main.playlists.filter(Et.isEnabled);return Wn(s,(e,t)=>od(e,t)),s.filter(e=>!!ii(this.playlists.main,e).video)[0]||null},XE=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(n=>{t.set(n,e),e+=n.byteLength})),t};function Pg(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const YE=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let n=t;/^cc708_/.test(t)&&(n="SERVICE"+t.split("_")[1]);const r=e.textTracks().getTrackById(n);if(r)s[t]=r;else{const i=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,c=!1;const h=i[n];h&&(a=h.label,o=h.language,c=h.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:n,default:c,label:a,language:o},!1).track}}},KE=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const n=I.WebKitDataCue||I.VTTCue;e.forEach(r=>{const i=r.stream;r.content?r.content.forEach(a=>{const o=new n(r.startTime+t,r.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",s[i].addCue(o)}):s[i].addCue(new n(r.startTime+t,r.endTime+t,r.text))})},QE=function(s){Object.defineProperties(s.frame,{id:{get(){return P.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return P.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return P.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},ZE=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:n})=>{if(!e)return;const r=I.WebKitDataCue||I.VTTCue,i=s.metadataTrack_;if(!i||(e.forEach(m=>{const _=m.cueTime+t;typeof _!="number"||I.isNaN(_)||_<0||!(_<1/0)||!m.frames||!m.frames.length||m.frames.forEach(T=>{const S=new r(_,_,T.value||T.url||T.data||"");S.frame=T,S.value=T,QE(S),i.addCue(S)})}),!i.cues||!i.cues.length))return;const a=i.cues,o=[];for(let m=0;m<a.length;m++)a[m]&&o.push(a[m]);const c=o.reduce((m,_)=>{const T=m[_.startTime]||[];return T.push(_),m[_.startTime]=T,m},{}),h=Object.keys(c).sort((m,_)=>Number(m)-Number(_));h.forEach((m,_)=>{const T=c[m],S=isFinite(n)?n:m,w=Number(h[_+1])||S;T.forEach(b=>{b.endTime=w})})},JE={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"},ew=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),tw=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const n=I.WebKitDataCue||I.VTTCue;e.forEach(r=>{for(const i of Object.keys(r)){if(ew.has(i))continue;const a=new n(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:JE[i],data:r[i]},(i==="scte35Out"||i==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}r.processDateRange()})},wh=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,P.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},Gr=function(s,e,t){let n,r;if(t&&t.cues)for(n=t.cues.length;n--;)r=t.cues[n],r.startTime>=s&&r.endTime<=e&&t.removeCue(r)},sw=function(s){const e=s.cues;if(!e)return;const t={};for(let n=e.length-1;n>=0;n--){const r=e[n],i=`${r.startTime}-${r.endTime}-${r.text}`;t[i]?s.removeCue(r):t[i]=r}},nw=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const n=Math.ceil((e-t+3)*on.ONE_SECOND_IN_TS);let r;for(r=0;r<s.length&&!(s[r].pts>n);r++);return s.slice(r)},rw=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const n=e[0].pts;let r=0;for(r;r<s.length&&!(s[r].pts>=n);r++);return s.slice(0,r).concat(e)},iw=(s,e,t,n)=>{const r=Math.ceil((e-n)*on.ONE_SECOND_IN_TS),i=Math.ceil((t-n)*on.ONE_SECOND_IN_TS),a=s.slice();let o=s.length;for(;o--&&!(s[o].pts<=i););if(o===-1)return a;let c=o+1;for(;c--&&!(s[c].pts<=r););return c=Math.max(c,0),a.splice(c,o-c+1),a},aw=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),n=Object.keys(e).sort();if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const i=t[r];if(i!==n[r]||s[i]!==e[i])return!1}return!0},ow=function(s,e,t){e=e||[];const n=[];let r=0;for(let i=0;i<e.length;i++){const a=e[i];if(s===a.timeline&&(n.push(i),r+=a.duration,r>t))return i}return n.length===0?0:n[n.length-1]},qr=1,lw=500,kh=s=>typeof s=="number"&&isFinite(s),oa=1/60,cw=(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,dw=(s,e,t)=>{let n=e-Ze.BACK_BUFFER_LENGTH;s.length&&(n=Math.max(n,s.start(0)));const r=e-t;return Math.min(r,n)},Rn=s=>{const{startOfSegment:e,duration:t,segment:n,part:r,playlist:{mediaSequence:i,id:a,segments:o=[]},mediaIndex:c,partIndex:h,timeline:m}=s,_=o.length-1;let T="mediaIndex/partIndex increment";s.getMediaInfoForTime?T=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(T="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(T+=` with independent ${s.independent}`);const S=typeof h=="number",w=s.segment.uri?"segment":"pre-segment",b=S?Kf({preloadSegment:n})-1:0;return`${w} [${i+c}/${i+_}]`+(S?` part [${h}/${b}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(S?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${m}] selected by [${T}] playlist [${a}]`},Ch=s=>`${s}TimingInfo`,uw=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:n,overrideCheck:r})=>!r&&s===e?null:s<e?t:n.length?n.end(n.length-1):t,Xl=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:n,audioDisabled:r})=>{if(e===t)return!1;if(n==="audio"){const i=s.lastTimelineChange({type:"main"});return!i||i.to!==t}if(n==="main"&&r){const i=s.pendingTimelineChange({type:"audio"});return!(i&&i.to===t)}return!1},hw=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),n=e&&t,r=n&&e.to!==t.to;return!!(n&&e.from!==-1&&t.from!==-1&&r)},pw=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Us=s=>{const e=s.pendingSegment_;if(e&&Xl({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&hw(s.timelineChangeController_)){if(pw(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},mw=s=>{let e=0;return["video","audio"].forEach(function(t){const n=s[`${t}TimingInfo`];if(!n)return;const{start:r,end:i}=n;let a;typeof r=="bigint"||typeof i=="bigint"?a=I.BigInt(i)-I.BigInt(r):typeof r=="number"&&typeof i=="number"&&(a=i-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},Ih=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+ss:!1,fw=(s,e)=>{if(e!=="hls")return null;const t=mw({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const n=s.playlist.targetDuration,r=Ih({segmentDuration:t,maxDuration:n*2}),i=Ih({segmentDuration:t,maxDuration:n}),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 ${n}. 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||i?{severity:r?"warn":"info",message:a}:null},rn=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),n=!!(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:n}};class Yl extends P.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_=jt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(n){n!==this.state_&&(this.logger_(`${this.state_} -> ${n}`),this.state_=n,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)}),this.sourceUpdater_.on("codecschange",n=>{this.trigger(ze({type:"codecschange"},n))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",n=>{this.trigger(ze({type:"timelinechange"},n)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Us(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return gl.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_&&I.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,I.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_&&gl.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ct();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:n,isMuxed:r}=e;if(n&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const n=Wa(e);let r=this.initSegments_[n];return t&&!r&&e.bytes&&(this.initSegments_[n]=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 n=pg(e);let r=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const i={resolvedUri:(r||e).resolvedUri};return r&&(i.bytes=r.bytes),i}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 n=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 i=null;if(n&&(n.id?i=n.id:n.uri&&(i=n.uri)),this.logger_(`playlist update [${i} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
208
|
+
`)};var Md={inspect:rt,textify:qo,parseType:xr,findBox:R_,parseTraf:Rs.traf,parseTfdt:Rs.tfdt,parseHdlr:Rs.hdlr,parseTfhd:Rs.tfhd,parseTrun:Rs.trun,parseSidx:Rs.sidx},N_=function(l){for(var d=0,u=String.fromCharCode(l[d]),p="";u!=="\0";)p+=u,d++,u=String.fromCharCode(l[d]);return p+=u,p},O_={uint8ToCString:N_},Xi=O_.uint8ToCString,M_=i.getUint64,U_=function(l){var d=4,u=l[0],p,g,y,E,k,C,x,O;if(u===0){p=Xi(l.subarray(d)),d+=p.length,g=Xi(l.subarray(d)),d+=g.length;var V=new DataView(l.buffer);y=V.getUint32(d),d+=4,k=V.getUint32(d),d+=4,C=V.getUint32(d),d+=4,x=V.getUint32(d),d+=4}else if(u===1){var V=new DataView(l.buffer);y=V.getUint32(d),d+=4,E=M_(l.subarray(d)),d+=8,C=V.getUint32(d),d+=4,x=V.getUint32(d),d+=4,p=Xi(l.subarray(d)),d+=p.length,g=Xi(l.subarray(d)),d+=g.length}O=new Uint8Array(l.subarray(d,l.byteLength));var Z={scheme_id_uri:p,value:g,timescale:y||1,presentation_time:E,presentation_time_delta:k,event_duration:C,id:x,message_data:O};return F_(u,Z)?Z:void 0},B_=function(l,d,u,p){return l||l===0?l/d:p+u/d},F_=function(l,d){var u=d.scheme_id_uri!=="\0",p=l===0&&Ud(d.presentation_time_delta)&&u,g=l===1&&Ud(d.presentation_time)&&u;return!(l>1)&&p||g},Ud=function(l){return l!==void 0||l!==null},j_={parseEmsgBox:U_,scaleTime:B_},Lr;typeof window<"u"?Lr=window:typeof s<"u"?Lr=s:typeof self<"u"?Lr=self:Lr={};var Bd=Lr,Yi=zi.toUnsigned,Pr=zi.toHexString,$e=Gi,Sn=Bo,Vo=j_,q_=jo,V_=Nd,$_=Fo,H_=i.getUint64,Fd,jd,qd,Vd,$d,$o,Hd,Ho=Bd,W_=_d.parseId3Frames;Fd=function(l){var d={},u=$e(l,["moov","trak"]);return u.reduce(function(p,g){var y,E,k,C,x;return y=$e(g,["tkhd"])[0],!y||(E=y[0],k=E===0?12:20,C=Yi(y[k]<<24|y[k+1]<<16|y[k+2]<<8|y[k+3]),x=$e(g,["mdia","mdhd"])[0],!x)?null:(E=x[0],k=E===0?12:20,p[C]=Yi(x[k]<<24|x[k+1]<<16|x[k+2]<<8|x[k+3]),p)},d)},jd=function(l,d){var u;u=$e(d,["moof","traf"]);var p=u.reduce(function(g,y){var E=$e(y,["tfhd"])[0],k=Yi(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),C=l[k]||9e4,x=$e(y,["tfdt"])[0],O=new DataView(x.buffer,x.byteOffset,x.byteLength),V;x[0]===1?V=H_(x.subarray(4,12)):V=O.getUint32(4);let Z;return typeof V=="bigint"?Z=V/Ho.BigInt(C):typeof V=="number"&&!isNaN(V)&&(Z=V/C),Z<Number.MAX_SAFE_INTEGER&&(Z=Number(Z)),Z<g&&(g=Z),g},1/0);return typeof p=="bigint"||isFinite(p)?p:0},qd=function(l,d){var u=$e(d,["moof","traf"]),p=0,g=0,y;if(u&&u.length){var E=$e(u[0],["tfhd"])[0],k=$e(u[0],["trun"])[0],C=$e(u[0],["tfdt"])[0];if(E){var x=q_(E);y=x.trackId}if(C){var O=$_(C);p=O.baseMediaDecodeTime}if(k){var V=V_(k);V.samples&&V.samples.length&&(g=V.samples[0].compositionTimeOffset||0)}}var Z=l[y]||9e4;typeof p=="bigint"&&(g=Ho.BigInt(g),Z=Ho.BigInt(Z));var W=(p+g)/Z;return typeof W=="bigint"&&W<Number.MAX_SAFE_INTEGER&&(W=Number(W)),W},Vd=function(l){var d=$e(l,["moov","trak"]),u=[];return d.forEach(function(p){var g=$e(p,["mdia","hdlr"]),y=$e(p,["tkhd"]);g.forEach(function(E,k){var C=Sn(E.subarray(8,12)),x=y[k],O,V,Z;C==="vide"&&(O=new DataView(x.buffer,x.byteOffset,x.byteLength),V=O.getUint8(0),Z=V===0?O.getUint32(12):O.getUint32(20),u.push(Z))})}),u},$o=function(l){var d=l[0],u=d===0?12:20;return Yi(l[u]<<24|l[u+1]<<16|l[u+2]<<8|l[u+3])},$d=function(l){var d=$e(l,["moov","trak"]),u=[];return d.forEach(function(p){var g={},y=$e(p,["tkhd"])[0],E,k;y&&(E=new DataView(y.buffer,y.byteOffset,y.byteLength),k=E.getUint8(0),g.id=k===0?E.getUint32(12):E.getUint32(20));var C=$e(p,["mdia","hdlr"])[0];if(C){var x=Sn(C.subarray(8,12));x==="vide"?g.type="video":x==="soun"?g.type="audio":g.type=x}var O=$e(p,["mdia","minf","stbl","stsd"])[0];if(O){var V=O.subarray(8);g.codec=Sn(V.subarray(4,8));var Z=$e(V,[g.codec])[0],W,ie;Z&&(/^[asm]vc[1-9]$/i.test(g.codec)?(W=Z.subarray(78),ie=Sn(W.subarray(4,8)),ie==="avcC"&&W.length>11?(g.codec+=".",g.codec+=Pr(W[9]),g.codec+=Pr(W[10]),g.codec+=Pr(W[11])):g.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(g.codec)?(W=Z.subarray(28),ie=Sn(W.subarray(4,8)),ie==="esds"&&W.length>20&&W[19]!==0?(g.codec+="."+Pr(W[19]),g.codec+="."+Pr(W[20]>>>2&63).replace(/^0/,"")):g.codec="mp4a.40.2"):g.codec=g.codec.toLowerCase())}var de=$e(p,["mdia","mdhd"])[0];de&&(g.timescale=$o(de)),u.push(g)}),u},Hd=function(l,d=0){var u=$e(l,["emsg"]);return u.map(p=>{var g=Vo.parseEmsgBox(new Uint8Array(p)),y=W_(g.message_data);return{cueTime:Vo.scaleTime(g.presentation_time,g.timescale,g.presentation_time_delta,d),duration:Vo.scaleTime(g.event_duration,g.timescale),frames:y}})};var Rr={findBox:$e,parseType:Sn,timescale:Fd,startTime:jd,compositionStartTime:qd,videoTrackIds:Vd,tracks:$d,getTimescaleFromMediaHeader:$o,getEmsgID3:Hd};const{parseTrun:z_}=Md,{findBox:Wd}=Rr;var zd=Bd,G_=function(l){var d=Wd(l,["moof","traf"]),u=Wd(l,["mdat"]),p=[];return u.forEach(function(g,y){var E=d[y];p.push({mdat:g,traf:E})}),p},X_=function(l,d,u){var p=d,g=u.defaultSampleDuration||0,y=u.defaultSampleSize||0,E=u.trackId,k=[];return l.forEach(function(C){var x=z_(C),O=x.samples;O.forEach(function(V){V.duration===void 0&&(V.duration=g),V.size===void 0&&(V.size=y),V.trackId=E,V.dts=p,V.compositionTimeOffset===void 0&&(V.compositionTimeOffset=0),typeof p=="bigint"?(V.pts=p+zd.BigInt(V.compositionTimeOffset),p+=zd.BigInt(V.duration)):(V.pts=p+V.compositionTimeOffset,p+=V.duration)}),k=k.concat(O)}),k},Gd={getMdatTrafPairs:G_,parseSamples:X_},Y_=pd.discardEmulationPreventionBytes,K_=md.CaptionStream,Wo=Gi,Q_=Fo,J_=jo,{getMdatTrafPairs:Z_,parseSamples:ev}=Gd,tv=function(l,d){for(var u=l,p=0;p<d.length;p++){var g=d[p];if(u<g.size)return g;u-=g.size}return null},sv=function(l,d,u){var p=new DataView(l.buffer,l.byteOffset,l.byteLength),g={logs:[],seiNals:[]},y,E,k,C;for(E=0;E+4<l.length;E+=k)if(k=p.getUint32(E),E+=4,!(k<=0))switch(l[E]&31){case 6:var x=l.subarray(E+1,E+1+k),O=tv(E,d);if(y={nalUnitType:"sei_rbsp",size:k,data:x,escapedRBSP:Y_(x),trackId:u},O)y.pts=O.pts,y.dts=O.dts,C=O;else if(C)y.pts=C.pts,y.dts=C.dts;else{g.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+E+" for trackId "+u+". See mux.js#223."});break}g.seiNals.push(y);break}return g},nv=function(l,d){var u={},p=Z_(l);return p.forEach(function(g){var y=g.mdat,E=g.traf,k=Wo(E,["tfhd"]),C=J_(k[0]),x=C.trackId,O=Wo(E,["tfdt"]),V=O.length>0?Q_(O[0]).baseMediaDecodeTime:0,Z=Wo(E,["trun"]),W,ie;d===x&&Z.length>0&&(W=ev(Z,V,C),ie=sv(y,W,x),u[x]||(u[x]={seiNals:[],logs:[]}),u[x].seiNals=u[x].seiNals.concat(ie.seiNals),u[x].logs=u[x].logs.concat(ie.logs))}),u},rv=function(l,d,u){var p;if(d===null)return null;p=nv(l,d);var g=p[d]||{};return{seiNals:g.seiNals,logs:g.logs,timescale:u}},iv=function(){var l=!1,d,u,p,g,y,E;this.isInitialized=function(){return l},this.init=function(k){d=new K_,l=!0,E=k?k.isPartial:!1,d.on("data",function(C){C.startTime=C.startPts/g,C.endTime=C.endPts/g,y.captions.push(C),y.captionStreams[C.stream]=!0}),d.on("log",function(C){y.logs.push(C)})},this.isNewInit=function(k,C){return k&&k.length===0||C&&typeof C=="object"&&Object.keys(C).length===0?!1:p!==k[0]||g!==C[p]},this.parse=function(k,C,x){var O;if(this.isInitialized()){if(!C||!x)return null;if(this.isNewInit(C,x))p=C[0],g=x[p];else if(p===null||!g)return u.push(k),null}else return null;for(;u.length>0;){var V=u.shift();this.parse(V,C,x)}return O=rv(k,p,g),O&&O.logs&&(y.logs=y.logs.concat(O.logs)),O===null||!O.seiNals?y.logs.length?{logs:y.logs,captions:[],captionStreams:[]}:null:(this.pushNals(O.seiNals),this.flushStream(),y)},this.pushNals=function(k){if(!this.isInitialized()||!k||k.length===0)return null;k.forEach(function(C){d.push(C)})},this.flushStream=function(){if(!this.isInitialized())return null;E?d.partialFlush():d.flush()},this.clearParsedCaptions=function(){y.captions=[],y.captionStreams={},y.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;d.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){u=[],p=null,g=null,y?this.clearParsedCaptions():y={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},av=iv;const{parseTfdt:ov}=Md,Ds=Gi,{getTimescaleFromMediaHeader:lv}=Rr,{parseSamples:cv,getMdatTrafPairs:dv}=Gd;var Xd=function(){let l=9e4;this.init=function(d){const u=Ds(d,["moov","trak","mdia","mdhd"])[0];u&&(l=lv(u))},this.parseSegment=function(d){const u=[],p=dv(d);let g=0;return p.forEach(function(y){const E=y.mdat,k=y.traf,C=Ds(k,["tfdt"])[0],x=Ds(k,["tfhd"])[0],O=Ds(k,["trun"]);if(C&&(g=ov(C).baseMediaDecodeTime),O.length&&x){const V=cv(O,g,x);let Z=0;V.forEach(function(W){const ie="utf-8",de=new TextDecoder(ie),Qe=E.slice(Z,Z+W.size);if(Ds(Qe,["vtte"])[0]){Z+=W.size;return}Ds(Qe,["vttc"]).forEach(function(pt){const Kt=Ds(pt,["payl"])[0],Dr=Ds(pt,["sttg"])[0],Ji=W.pts/l,Zi=(W.pts+W.duration)/l;let Zs,Nr;if(Kt)try{Zs=de.decode(Kt)}catch(De){console.error(De)}if(Dr)try{Nr=de.decode(Dr)}catch(De){console.error(De)}W.duration&&Zs&&u.push({cueText:Zs,start:Ji,end:Zi,settings:Nr})}),Z+=W.size})}}),u}},zo=Di,Yd=function(l){var d=l[1]&31;return d<<=8,d|=l[2],d},Ki=function(l){return!!(l[1]&64)},Qi=function(l){var d=0;return(l[3]&48)>>>4>1&&(d+=l[4]+1),d},uv=function(l,d){var u=Yd(l);return u===0?"pat":u===d?"pmt":d?"pes":null},hv=function(l){var d=Ki(l),u=4+Qi(l);return d&&(u+=l[u]+1),(l[u+10]&31)<<8|l[u+11]},pv=function(l){var d={},u=Ki(l),p=4+Qi(l);if(u&&(p+=l[p]+1),!!(l[p+5]&1)){var g,y,E;g=(l[p+1]&15)<<8|l[p+2],y=3+g-4,E=(l[p+10]&15)<<8|l[p+11];for(var k=12+E;k<y;){var C=p+k;d[(l[C+1]&31)<<8|l[C+2]]=l[C],k+=((l[C+3]&15)<<8|l[C+4])+5}return d}},mv=function(l,d){var u=Yd(l),p=d[u];switch(p){case zo.H264_STREAM_TYPE:return"video";case zo.ADTS_STREAM_TYPE:return"audio";case zo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},fv=function(l){var d=Ki(l);if(!d)return null;var u=4+Qi(l);if(u>=l.byteLength)return null;var p=null,g;return g=l[u+7],g&192&&(p={},p.pts=(l[u+9]&14)<<27|(l[u+10]&255)<<20|(l[u+11]&254)<<12|(l[u+12]&255)<<5|(l[u+13]&254)>>>3,p.pts*=4,p.pts+=(l[u+13]&6)>>>1,p.dts=p.pts,g&64&&(p.dts=(l[u+14]&14)<<27|(l[u+15]&255)<<20|(l[u+16]&254)<<12|(l[u+17]&255)<<5|(l[u+18]&254)>>>3,p.dts*=4,p.dts+=(l[u+18]&6)>>>1)),p},Go=function(l){switch(l){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}},gv=function(l){for(var d=4+Qi(l),u=l.subarray(d),p=0,g=0,y=!1,E;g<u.byteLength-3;g++)if(u[g+2]===1){p=g+5;break}for(;p<u.byteLength;)switch(u[p]){case 0:if(u[p-1]!==0){p+=2;break}else if(u[p-2]!==0){p++;break}g+3!==p-2&&(E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0));do p++;while(u[p]!==1&&p<u.length);g=p-2,p+=3;break;case 1:if(u[p-1]!==0||u[p-2]!==0){p+=3;break}E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0),g=p-2,p+=3;break;default:p+=3;break}return u=u.subarray(g),p-=g,g=0,u&&u.byteLength>3&&(E=Go(u[g+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(y=!0)),y},yv={parseType:uv,parsePat:hv,parsePmt:pv,parsePayloadUnitStartIndicator:Ki,parsePesType:mv,parsePesTime:fv,videoPacketContainsKeyFrame:gv},Kd=Di,En=gd.handleRollover,Te={};Te.ts=yv,Te.aac=No;var Js=A.ONE_SECOND_IN_TS,ht=188,Yt=71,_v=function(l,d){for(var u=0,p=ht,g,y;p<l.byteLength;){if(l[u]===Yt&&l[p]===Yt){switch(g=l.subarray(u,p),y=Te.ts.parseType(g,d.pid),y){case"pat":d.pid=Te.ts.parsePat(g);break;case"pmt":var E=Te.ts.parsePmt(g);d.table=d.table||{},Object.keys(E).forEach(function(k){d.table[k]=E[k]});break}u+=ht,p+=ht;continue}u++,p++}},Qd=function(l,d,u){for(var p=0,g=ht,y,E,k,C,x,O=!1;g<=l.byteLength;){if(l[p]===Yt&&(l[g]===Yt||g===l.byteLength)){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="audio",u.audio.push(x),O=!0));break}if(O)break;p+=ht,g+=ht;continue}p++,g++}for(g=l.byteLength,p=g-ht,O=!1;p>=0;){if(l[p]===Yt&&(l[g]===Yt||g===l.byteLength)){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="audio"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="audio",u.audio.push(x),O=!0));break}if(O)break;p-=ht,g-=ht;continue}p--,g--}},vv=function(l,d,u){for(var p=0,g=ht,y,E,k,C,x,O,V,Z,W=!1,ie={data:[],size:0};g<l.byteLength;){if(l[p]===Yt&&l[g]===Yt){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":if(k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&(C&&!W&&(x=Te.ts.parsePesTime(y),x&&(x.type="video",u.video.push(x),W=!0)),!u.firstKeyFrame)){if(C&&ie.size!==0){for(O=new Uint8Array(ie.size),V=0;ie.data.length;)Z=ie.data.shift(),O.set(Z,V),V+=Z.byteLength;if(Te.ts.videoPacketContainsKeyFrame(O)){var de=Te.ts.parsePesTime(O);de?(u.firstKeyFrame=de,u.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.")}ie.size=0}ie.data.push(y),ie.size+=y.byteLength}break}if(W&&u.firstKeyFrame)break;p+=ht,g+=ht;continue}p++,g++}for(g=l.byteLength,p=g-ht,W=!1;p>=0;){if(l[p]===Yt&&l[g]===Yt){switch(y=l.subarray(p,g),E=Te.ts.parseType(y,d.pid),E){case"pes":k=Te.ts.parsePesType(y,d.table),C=Te.ts.parsePayloadUnitStartIndicator(y),k==="video"&&C&&(x=Te.ts.parsePesTime(y),x&&(x.type="video",u.video.push(x),W=!0));break}if(W)break;p-=ht,g-=ht;continue}p--,g--}},bv=function(l,d){if(l.audio&&l.audio.length){var u=d;(typeof u>"u"||isNaN(u))&&(u=l.audio[0].dts),l.audio.forEach(function(y){y.dts=En(y.dts,u),y.pts=En(y.pts,u),y.dtsTime=y.dts/Js,y.ptsTime=y.pts/Js})}if(l.video&&l.video.length){var p=d;if((typeof p>"u"||isNaN(p))&&(p=l.video[0].dts),l.video.forEach(function(y){y.dts=En(y.dts,p),y.pts=En(y.pts,p),y.dtsTime=y.dts/Js,y.ptsTime=y.pts/Js}),l.firstKeyFrame){var g=l.firstKeyFrame;g.dts=En(g.dts,p),g.pts=En(g.pts,p),g.dtsTime=g.dts/Js,g.ptsTime=g.pts/Js}}},Tv=function(l){for(var d=!1,u=0,p=null,g=null,y=0,E=0,k;l.length-E>=3;){var C=Te.aac.parseType(l,E);switch(C){case"timed-metadata":if(l.length-E<10){d=!0;break}if(y=Te.aac.parseId3TagSize(l,E),y>l.length){d=!0;break}g===null&&(k=l.subarray(E,E+y),g=Te.aac.parseAacTimestamp(k)),E+=y;break;case"audio":if(l.length-E<7){d=!0;break}if(y=Te.aac.parseAdtsSize(l,E),y>l.length){d=!0;break}p===null&&(k=l.subarray(E,E+y),p=Te.aac.parseSampleRate(k)),u++,E+=y;break;default:E++;break}if(d)return null}if(p===null||g===null)return null;var x=Js/p,O={audio:[{type:"audio",dts:g,pts:g},{type:"audio",dts:g+u*1024*x,pts:g+u*1024*x}]};return O},Av=function(l){var d={pid:null,table:null},u={};_v(l,d);for(var p in d.table)if(d.table.hasOwnProperty(p)){var g=d.table[p];switch(g){case Kd.H264_STREAM_TYPE:u.video=[],vv(l,d,u),u.video.length===0&&delete u.video;break;case Kd.ADTS_STREAM_TYPE:u.audio=[],Qd(l,d,u),u.audio.length===0&&delete u.audio;break}}return u},Sv=function(l,d){var u=Te.aac.isLikelyAacData(l),p;return u?p=Tv(l):p=Av(l),!p||!p.audio&&!p.video?null:(bv(p,d),p)},Ev={inspect:Sv,parseAudioPes_:Qd};const wv=function(l,d){d.on("data",function(u){const p=u.initSegment;u.initSegment={data:p.buffer,byteOffset:p.byteOffset,byteLength:p.byteLength};const g=u.data;u.data=g.buffer,l.postMessage({action:"data",segment:u,byteOffset:g.byteOffset,byteLength:g.byteLength},[u.data])}),d.on("done",function(u){l.postMessage({action:"done"})}),d.on("gopInfo",function(u){l.postMessage({action:"gopInfo",gopInfo:u})}),d.on("videoSegmentTimingInfo",function(u){const p={start:{decode:A.videoTsToSeconds(u.start.dts),presentation:A.videoTsToSeconds(u.start.pts)},end:{decode:A.videoTsToSeconds(u.end.dts),presentation:A.videoTsToSeconds(u.end.pts)},baseMediaDecodeTime:A.videoTsToSeconds(u.baseMediaDecodeTime)};u.prependedContentDuration&&(p.prependedContentDuration=A.videoTsToSeconds(u.prependedContentDuration)),l.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:p})}),d.on("audioSegmentTimingInfo",function(u){const p={start:{decode:A.videoTsToSeconds(u.start.dts),presentation:A.videoTsToSeconds(u.start.pts)},end:{decode:A.videoTsToSeconds(u.end.dts),presentation:A.videoTsToSeconds(u.end.pts)},baseMediaDecodeTime:A.videoTsToSeconds(u.baseMediaDecodeTime)};u.prependedContentDuration&&(p.prependedContentDuration=A.videoTsToSeconds(u.prependedContentDuration)),l.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:p})}),d.on("id3Frame",function(u){l.postMessage({action:"id3Frame",id3Frame:u})}),d.on("caption",function(u){l.postMessage({action:"caption",caption:u})}),d.on("trackinfo",function(u){l.postMessage({action:"trackinfo",trackInfo:u})}),d.on("audioTimingInfo",function(u){l.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:A.videoTsToSeconds(u.start),end:A.videoTsToSeconds(u.end)}})}),d.on("videoTimingInfo",function(u){l.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:A.videoTsToSeconds(u.start),end:A.videoTsToSeconds(u.end)}})}),d.on("log",function(u){l.postMessage({action:"log",log:u})})};class Jd{constructor(d,u){this.options=u||{},this.self=d,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new g_.Transmuxer(this.options),wv(this.self,this.transmuxer)}pushMp4Captions(d){this.captionParser||(this.captionParser=new av,this.captionParser.init());const u=new Uint8Array(d.data,d.byteOffset,d.byteLength),p=this.captionParser.parse(u,d.trackIds,d.timescales);this.self.postMessage({action:"mp4Captions",captions:p&&p.captions||[],logs:p&&p.logs||[],data:u.buffer},[u.buffer])}initMp4WebVttParser(d){this.webVttParser||(this.webVttParser=new Xd);const u=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.webVttParser.init(u)}getMp4WebVttText(d){this.webVttParser||(this.webVttParser=new Xd);const u=new Uint8Array(d.data,d.byteOffset,d.byteLength),p=this.webVttParser.parseSegment(u);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:p||[],data:u.buffer},[u.buffer])}probeMp4StartTime({timescales:d,data:u}){const p=Rr.startTime(d,u);this.self.postMessage({action:"probeMp4StartTime",startTime:p,data:u},[u.buffer])}probeMp4Tracks({data:d}){const u=Rr.tracks(d);this.self.postMessage({action:"probeMp4Tracks",tracks:u,data:d},[d.buffer])}probeEmsgID3({data:d,offset:u}){const p=Rr.getEmsgID3(d,u);this.self.postMessage({action:"probeEmsgID3",id3Frames:p,emsgData:d},[d.buffer])}probeTs({data:d,baseStartTime:u}){const p=typeof u=="number"&&!isNaN(u)?u*A.ONE_SECOND_IN_TS:void 0,g=Ev.inspect(d,p);let y=null;g&&(y={hasVideo:g.video&&g.video.length===2||!1,hasAudio:g.audio&&g.audio.length===2||!1},y.hasVideo&&(y.videoStart=g.video[0].ptsTime),y.hasAudio&&(y.audioStart=g.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:y,data:d},[d.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(d){const u=new Uint8Array(d.data,d.byteOffset,d.byteLength);this.transmuxer.push(u)}reset(){this.transmuxer.reset()}setTimestampOffset(d){const u=d.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(A.secondsToVideoTs(u)))}setAudioAppendStart(d){this.transmuxer.setAudioAppendStart(Math.ceil(A.secondsToVideoTs(d.appendStart)))}setRemux(d){this.transmuxer.setRemux(d.remux)}flush(d){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(d){this.transmuxer.alignGopsWith(d.gopsToAlignWith.slice())}}self.onmessage=function(l){if(l.data.action==="init"&&l.data.options){this.messageHandlers=new Jd(self,l.data.options);return}this.messageHandlers||(this.messageHandlers=new Jd(self)),l.data&&l.data.action&&l.data.action!=="init"&&this.messageHandlers[l.data.action]&&this.messageHandlers[l.data.action](l.data)}}));var kE=_g(wE);const CE=(s,e,t)=>{const{type:n,initSegment:r,captions:i,captionStreams:a,metadata:o,videoFrameDtsTime:c,videoFramePtsTime:h}=s.data.segment;e.buffer.push({captions:i,captionStreams:a,metadata:o});const m=s.data.segment.boxes||{data:s.data.segment.data},_={type:n,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(r.data,r.byteOffset,r.byteLength)};typeof c<"u"&&(_.videoFrameDtsTime=c),typeof h<"u"&&(_.videoFramePtsTime=h),t(_)},IE=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},xE=(s,e)=>{e.gopInfo=s.data.gopInfo},Tg=s=>{const{transmuxer:e,bytes:t,audioAppendStart:n,gopsToAlignWith:r,remux:i,onData:a,onTrackInfo:o,onAudioTimingInfo:c,onVideoTimingInfo:h,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:_,onId3:T,onCaptions:S,onDone:w,onEndedTimeline:b,onTransmuxerLog:R,isEndOfTimeline:L,segment:U,triggerSegmentEventFn:M}=s,F={buffer:[]};let N=L;const j=Y=>{e.currentTransmux===s&&(Y.data.action==="data"&&CE(Y,F,a),Y.data.action==="trackinfo"&&o(Y.data.trackInfo),Y.data.action==="gopInfo"&&xE(Y,F),Y.data.action==="audioTimingInfo"&&c(Y.data.audioTimingInfo),Y.data.action==="videoTimingInfo"&&h(Y.data.videoTimingInfo),Y.data.action==="videoSegmentTimingInfo"&&m(Y.data.videoSegmentTimingInfo),Y.data.action==="audioSegmentTimingInfo"&&_(Y.data.audioSegmentTimingInfo),Y.data.action==="id3Frame"&&T([Y.data.id3Frame],Y.data.id3Frame.dispatchType),Y.data.action==="caption"&&S(Y.data.caption),Y.data.action==="endedtimeline"&&(N=!1,b()),Y.data.action==="log"&&R(Y.data.log),Y.data.type==="transmuxed"&&(N||(e.onmessage=null,IE({transmuxedData:F,callback:w}),Ag(e))))},J=()=>{const Y={message:"Received an error message from the transmuxer worker",metadata:{errorType:P.Error.StreamingFailedToTransmuxSegment,segmentInfo:rn({segment:U})}};w(null,Y)};if(e.onmessage=j,e.onerror=J,n&&e.postMessage({action:"setAudioAppendStart",appendStart:n}),Array.isArray(r)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:r}),typeof i<"u"&&e.postMessage({action:"setRemux",remux:i}),t.byteLength){const Y=t instanceof ArrayBuffer?t:t.buffer,re=t instanceof ArrayBuffer?0:t.byteOffset;M({type:"segmenttransmuxingstart",segment:U}),e.postMessage({action:"push",data:Y,byteOffset:re,byteLength:t.byteLength},[Y])}L&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},Ag=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():Tg(s.currentTransmux))},Sh=(s,e)=>{s.postMessage({action:e}),Ag(s)},Sg=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,Sh(e,s);return}e.transmuxQueue.push(Sh.bind(null,e,s))},LE=s=>{Sg("reset",s)},PE=s=>{Sg("endTimeline",s)},Eg=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,Tg(s);return}s.transmuxer.transmuxQueue.push(s)},RE=s=>{const e=new kE;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 gl={reset:LE,endTimeline:PE,transmux:Eg,createTransmuxer:RE};const Hn=function(s){const e=s.transmuxer,t=s.endAction||s.action,n=s.callback,r=ze({},s,{endAction:null,transmuxer:null,callback:null}),i=a=>{a.data.action===t&&(e.removeEventListener("message",i),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)),n(a.data))};if(e.addEventListener("message",i),s.data){const a=s.data instanceof ArrayBuffer;r.byteOffset=a?0:s.data.byteOffset,r.byteLength=s.data.byteLength;const o=[a?s.data:s.data.buffer];e.postMessage(r,o)}else e.postMessage(r)},rs={FAILURE:2,TIMEOUT:-101,ABORTED:-102},wg="wvtt",Gl=s=>{s.forEach(e=>{e.abort()})},DE=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),NE=s=>{const e=s.target,t={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return t.bytesReceived=s.loaded,t.bandwidth=Math.floor(t.bytesReceived/t.roundTripTime*8*1e3),t},ad=(s,e)=>{const{requestType:t}=e,n=pn({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:rs.TIMEOUT,xhr:e,metadata:n}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:rs.ABORTED,xhr:e,metadata:n}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:rs.FAILURE,xhr:e,metadata:n}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:rs.FAILURE,xhr:e,metadata:n}:null},Eh=(s,e,t,n)=>(r,i)=>{const a=i.response,o=ad(r,i);if(o)return t(o,s);if(a.byteLength!==16)return t({status:i.status,message:"Invalid HLS key at URL: "+i.uri,code:rs.FAILURE,xhr:i},s);const c=new DataView(a),h=new Uint32Array([c.getUint32(0),c.getUint32(4),c.getUint32(8),c.getUint32(12)]);for(let _=0;_<e.length;_++)e[_].bytes=h;const m={uri:i.uri};return n({type:"segmentkeyloadcomplete",segment:s,keyInfo:m}),t(null,s)},OE=(s,e)=>{e===wg&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},ME=(s,e,t)=>{e===wg&&Hn({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:n,mp4VttCues:r})=>{s.bytes=n,t(null,s,{mp4VttCues:r})}})},kg=(s,e)=>{const t=kc(s.map.bytes);if(t!=="mp4"){const n=s.map.resolvedUri||s.map.uri,r=t||"unknown";return e({internal:!0,message:`Found unsupported ${r} container for initialization segment at URL: ${n}`,code:rs.FAILURE,metadata:{mediaType:r}})}Hn({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:n,data:r})=>(s.map.bytes=r,n.forEach(function(i){s.map.tracks=s.map.tracks||{},!s.map.tracks[i.type]&&(s.map.tracks[i.type]=i,typeof i.id=="number"&&i.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[i.id]=i.timescale),i.type==="text"&&OE(s,i.codec))}),e(null))})},UE=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(n,r)=>{const i=ad(n,r);if(i)return e(i,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,kg(s,function(o){if(o)return o.xhr=r,o.status=r.status,e(o,s);e(null,s)})},BE=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:n})=>(r,i)=>{const a=ad(r,i);if(a)return e(a,s);n({type:"segmentloaded",segment:s});const o=t==="arraybuffer"||!i.responseText?i.response:SE(i.responseText.substring(s.lastReachedChar||0));return s.stats=DE(i),s.key?s.encryptedBytes=new Uint8Array(o):s.bytes=new Uint8Array(o),e(null,s)},FE=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{const w=s.map&&s.map.tracks||{},b=!!(w.audio&&w.video);let R=n.bind(null,s,"audio","start");const L=n.bind(null,s,"audio","end");let U=n.bind(null,s,"video","start");const M=n.bind(null,s,"video","end"),F=()=>Eg({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:b,onData:N=>{N.type=N.type==="combined"?"video":N.type,m(s,N)},onTrackInfo:N=>{t&&(b&&(N.isMuxed=!0),t(s,N))},onAudioTimingInfo:N=>{R&&typeof N.start<"u"&&(R(N.start),R=null),L&&typeof N.end<"u"&&L(N.end)},onVideoTimingInfo:N=>{U&&typeof N.start<"u"&&(U(N.start),U=null),M&&typeof N.end<"u"&&M(N.end)},onVideoSegmentTimingInfo:N=>{const j={pts:{start:N.start.presentation,end:N.end.presentation},dts:{start:N.start.decode,end:N.end.decode}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),r(N)},onAudioSegmentTimingInfo:N=>{const j={pts:{start:N.start.pts,end:N.end.pts},dts:{start:N.start.dts,end:N.end.dts}};S({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:j}),i(N)},onId3:(N,j)=>{a(s,N,j)},onCaptions:N=>{o(s,[N])},isEndOfTimeline:c,onEndedTimeline:()=>{h()},onTransmuxerLog:T,onDone:(N,j)=>{_&&(N.type=N.type==="combined"?"video":N.type,S({type:"segmenttransmuxingcomplete",segment:s}),_(j,s,N))},segment:s,triggerSegmentEventFn:S});Hn({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:N=>{s.bytes=e=N.data;const j=N.result;j&&(t(s,{hasAudio:j.hasAudio,hasVideo:j.hasVideo,isMuxed:b}),t=null),F()}})},Cg=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{let w=new Uint8Array(e);if(oA(w)){s.isFmp4=!0;const{tracks:b}=s.map;if(b.text&&(!b.audio||!b.video)){m(s,{data:w,type:"text"}),ME(s,b.text.codec,_);return}const R={isFmp4:!0,hasVideo:!!b.video,hasAudio:!!b.audio};b.audio&&b.audio.codec&&b.audio.codec!=="enca"&&(R.audioCodec=b.audio.codec),b.video&&b.video.codec&&b.video.codec!=="encv"&&(R.videoCodec=b.video.codec),b.video&&b.audio&&(R.isMuxed=!0),t(s,R);const L=(U,M)=>{m(s,{data:w,type:R.hasAudio&&!R.isMuxed?"audio":"video"}),M&&M.length&&a(s,M),U&&U.length&&o(s,U),_(null,s,{})};Hn({action:"probeMp4StartTime",timescales:s.map.timescales,data:w,transmuxer:s.transmuxer,callback:({data:U,startTime:M})=>{e=U.buffer,s.bytes=w=U,R.hasAudio&&!R.isMuxed&&n(s,"audio","start",M),R.hasVideo&&n(s,"video","start",M),Hn({action:"probeEmsgID3",data:w,transmuxer:s.transmuxer,offset:M,callback:({emsgData:F,id3Frames:N})=>{if(e=F.buffer,s.bytes=w=F,!b.video||!F.byteLength||!s.transmuxer){L(void 0,N);return}Hn({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:w,timescales:s.map.timescales,trackIds:[b.video.id],callback:j=>{e=j.data.buffer,s.bytes=w=j.data,j.logs.forEach(function(J){T(ve(J,{stream:"mp4CaptionParser"}))}),L(j.captions,N)}})}})}});return}if(!s.transmuxer){_(null,s,{});return}if(typeof s.container>"u"&&(s.container=kc(w)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),_(null,s,{});return}FE({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})},Ig=function({id:s,key:e,encryptedBytes:t,decryptionWorker:n,segment:r,doneFn:i},a){const o=h=>{if(h.data.source===s){n.removeEventListener("message",o);const m=h.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};n.onerror=()=>{const h="An error occurred in the decryption worker",m=rn({segment:r}),_={message:h,metadata:{error:new Error(h),errorType:P.Error.StreamingFailedToDecryptSegment,segmentInfo:m,keyInfo:{uri:r.key.resolvedUri||r.map.key.resolvedUri}}};i(_,r)},n.addEventListener("message",o);let c;e.bytes.slice?c=e.bytes.slice():c=new Uint32Array(Array.prototype.slice.call(e.bytes)),n.postMessage(hg({source:s,encrypted:t,key:c,iv:e.iv}),[t.buffer,c.buffer])},jE=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{S({type:"segmentdecryptionstart"}),Ig({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:_},w=>{e.bytes=w,S({type:"segmentdecryptioncomplete",segment:e}),Cg({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})})},qE=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})=>{let w=0,b=!1;return(R,L)=>{if(!b){if(R)return b=!0,Gl(s),_(R,L);if(w+=1,w===s.length){const U=function(){if(L.encryptedBytes)return jE({decryptionWorker:e,segment:L,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S});Cg({segment:L,bytes:L.bytes,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m,doneFn:_,onTransmuxerLog:T,triggerSegmentEventFn:S})};if(L.endOfAllRequests=Date.now(),L.map&&L.map.encryptedBytes&&!L.map.bytes)return S({type:"segmentdecryptionstart",segment:L}),Ig({decryptionWorker:e,id:L.requestId+"-init",encryptedBytes:L.map.encryptedBytes,key:L.map.key,segment:L,doneFn:_},M=>{L.map.bytes=M,S({type:"segmentdecryptioncomplete",segment:L}),kg(L,F=>{if(F)return Gl(s),_(F,L);U()})});U()}}}},VE=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},$E=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:n,videoSegmentTimingInfoFn:r,audioSegmentTimingInfoFn:i,id3Fn:a,captionsFn:o,isEndOfTimeline:c,endedTimelineFn:h,dataFn:m})=>_=>{if(!_.target.aborted)return s.stats=ve(s.stats,NE(_)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(_,s)},HE=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:n,abortFn:r,progressFn:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w,doneFn:b,onTransmuxerLog:R,triggerSegmentEventFn:L})=>{const U=[],M=qE({activeXhrs:U,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w,doneFn:b,onTransmuxerLog:R,triggerSegmentEventFn:L});if(n.key&&!n.key.bytes){const Y=[n.key];n.map&&!n.map.bytes&&n.map.key&&n.map.key.resolvedUri===n.key.resolvedUri&&Y.push(n.map.key);const re=ve(e,{uri:n.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),me=Eh(n,Y,M,L),le={uri:n.key.resolvedUri};L({type:"segmentkeyloadstart",segment:n,keyInfo:le});const ge=s(re,me);U.push(ge)}if(n.map&&!n.map.bytes){if(n.map.key&&(!n.key||n.key.resolvedUri!==n.map.key.resolvedUri)){const le=ve(e,{uri:n.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ge=Eh(n,[n.map.key],M,L),se={uri:n.map.key.resolvedUri};L({type:"segmentkeyloadstart",segment:n,keyInfo:se});const he=s(le,ge);U.push(he)}const Y=ve(e,{uri:n.map.resolvedUri,responseType:"arraybuffer",headers:Wl(n.map),requestType:"segment-media-initialization"}),re=UE({segment:n,finishProcessingFn:M,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:n});const me=s(Y,re);U.push(me)}const F=ve(e,{uri:n.part&&n.part.resolvedUri||n.resolvedUri,responseType:"arraybuffer",headers:Wl(n),requestType:"segment"}),N=BE({segment:n,finishProcessingFn:M,responseType:F.responseType,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:n});const j=s(F,N);j.addEventListener("progress",$E({segment:n,progressFn:i,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:c,audioSegmentTimingInfoFn:h,id3Fn:m,captionsFn:_,isEndOfTimeline:T,endedTimelineFn:S,dataFn:w})),U.push(j);const J={};return U.forEach(Y=>{Y.addEventListener("loadend",VE({loadendState:J,abortFn:r}))}),()=>Gl(U)},WE=jt("CodecUtils"),zE=function(s){const e=s.attributes||{};if(e.CODECS)return Jt(e.CODECS)},xg=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},GE=(s,e)=>{if(!xg(s,e))return!0;const t=e.attributes||{},n=s.mediaGroups.AUDIO[t.AUDIO];for(const r in n)if(!n[r].uri&&!n[r].playlists)return!0;return!1},za=function(s){const e={};return s.forEach(({mediaType:t,type:n,details:r})=>{e[t]=e[t]||[],e[t].push(Np(`${n}${r}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){WE(`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},wh=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},ii=function(s,e){const t=e.attributes||{},n=za(zE(e)||[]);if(xg(s,e)&&!n.audio&&!GE(s,e)){const r=za(cT(s,t.AUDIO)||[]);r.audio&&(n.audio=r.audio)}return n},aa=jt("PlaylistSelector"),kh=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||""})},Ga=function(s,e){if(!s)return"";const t=I.getComputedStyle(s);return t?t[e]:""},Wn=function(s,e){const t=s.slice();s.sort(function(n,r){const i=e(n,r);return i===0?t.indexOf(n)-t.indexOf(r):i})},od=function(s,e){let t,n;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||I.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(n=e.attributes.BANDWIDTH),n=n||I.Number.MAX_VALUE,t-n},XE=function(s,e){let t,n;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||I.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(n=e.attributes.RESOLUTION.width),n=n||I.Number.MAX_VALUE,t===n&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-n};let Lg=function(s,e,t,n,r,i){if(!s)return;const a={bandwidth:e,width:t,height:n,limitRenditionByPlayerDimensions:r};let o=s.playlists;Et.isAudioOnly(s)&&(o=i.getAudioTrackPlaylists_(),a.audioOnly=!0);let c=o.map(N=>{let j;const J=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.width,Y=N.attributes&&N.attributes.RESOLUTION&&N.attributes.RESOLUTION.height;return j=N.attributes&&N.attributes.BANDWIDTH,j=j||I.Number.MAX_VALUE,{bandwidth:j,width:J,height:Y,playlist:N}});Wn(c,(N,j)=>N.bandwidth-j.bandwidth),c=c.filter(N=>!Et.isIncompatible(N.playlist));let h=c.filter(N=>Et.isEnabled(N.playlist));h.length||(h=c.filter(N=>!Et.isDisabled(N.playlist)));const m=h.filter(N=>N.bandwidth*Je.BANDWIDTH_VARIANCE<e);let _=m[m.length-1];const T=m.filter(N=>N.bandwidth===_.bandwidth)[0];if(r===!1){const N=T||h[0]||c[0];if(N&&N.playlist){let j="sortedPlaylistReps";return T&&(j="bandwidthBestRep"),h[0]&&(j="enabledPlaylistReps"),aa(`choosing ${kh(N)} using ${j} with options`,a),N.playlist}return aa("could not choose a playlist with options",a),null}const S=m.filter(N=>N.width&&N.height);Wn(S,(N,j)=>N.width-j.width);const w=S.filter(N=>N.width===t&&N.height===n);_=w[w.length-1];const b=w.filter(N=>N.bandwidth===_.bandwidth)[0];let R,L,U;b||(R=S.filter(N=>N.width>t||N.height>n),L=R.filter(N=>N.width===R[0].width&&N.height===R[0].height),_=L[L.length-1],U=L.filter(N=>N.bandwidth===_.bandwidth)[0]);let M;if(i.leastPixelDiffSelector){const N=S.map(j=>(j.pixelDiff=Math.abs(j.width-t)+Math.abs(j.height-n),j));Wn(N,(j,J)=>j.pixelDiff===J.pixelDiff?J.bandwidth-j.bandwidth:j.pixelDiff-J.pixelDiff),M=N[0]}const F=M||U||b||T||h[0]||c[0];if(F&&F.playlist){let N="sortedPlaylistReps";return M?N="leastPixelDiffRep":U?N="resolutionPlusOneRep":b?N="resolutionBestRep":T?N="bandwidthBestRep":h[0]&&(N="enabledPlaylistReps"),aa(`choosing ${kh(F)} using ${N} with options`,a),F.playlist}return aa("could not choose a playlist with options",a),null};const Ch=function(){let s=this.useDevicePixelRatio&&I.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),Lg(this.playlists.main,this.systemBandwidth,parseInt(Ga(this.tech_.el(),"width"),10)*s,parseInt(Ga(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)},YE=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 n=this.useDevicePixelRatio&&I.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(n=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),Lg(this.playlists.main,e,parseInt(Ga(this.tech_.el(),"width"),10)*n,parseInt(Ga(this.tech_.el(),"height"),10)*n,this.limitRenditionByPlayerDimensions,this.playlistController_)}},KE=function(s){const{main:e,currentTime:t,bandwidth:n,duration:r,segmentDuration:i,timeUntilRebuffer:a,currentTimeline:o,syncController:c}=s,h=e.playlists.filter(S=>!Et.isIncompatible(S));let m=h.filter(Et.isEnabled);m.length||(m=h.filter(S=>!Et.isDisabled(S)));const _=m.filter(Et.hasAttribute.bind(null,"BANDWIDTH")).map(S=>{const w=c.getSyncPoint(S,r,o,t)?1:2,b=Et.estimateSegmentRequestTime(i,n,S)*w-a;return{playlist:S,rebufferingImpact:b}}),T=_.filter(S=>S.rebufferingImpact<=0);return Wn(T,(S,w)=>od(w.playlist,S.playlist)),T.length?T[0]:(Wn(_,(S,w)=>S.rebufferingImpact-w.rebufferingImpact),_[0]||null)},QE=function(){const s=this.playlists.main.playlists.filter(Et.isEnabled);return Wn(s,(e,t)=>od(e,t)),s.filter(e=>!!ii(this.playlists.main,e).video)[0]||null},JE=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(n=>{t.set(n,e),e+=n.byteLength})),t};function Pg(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const ZE=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let n=t;/^cc708_/.test(t)&&(n="SERVICE"+t.split("_")[1]);const r=e.textTracks().getTrackById(n);if(r)s[t]=r;else{const i=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,c=!1;const h=i[n];h&&(a=h.label,o=h.language,c=h.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:n,default:c,label:a,language:o},!1).track}}},ew=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const n=I.WebKitDataCue||I.VTTCue;e.forEach(r=>{const i=r.stream;r.content?r.content.forEach(a=>{const o=new n(r.startTime+t,r.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",s[i].addCue(o)}):s[i].addCue(new n(r.startTime+t,r.endTime+t,r.text))})},tw=function(s){Object.defineProperties(s.frame,{id:{get(){return P.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return P.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return P.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},sw=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:n})=>{if(!e)return;const r=I.WebKitDataCue||I.VTTCue,i=s.metadataTrack_;if(!i||(e.forEach(m=>{const _=m.cueTime+t;typeof _!="number"||I.isNaN(_)||_<0||!(_<1/0)||!m.frames||!m.frames.length||m.frames.forEach(T=>{const S=new r(_,_,T.value||T.url||T.data||"");S.frame=T,S.value=T,tw(S),i.addCue(S)})}),!i.cues||!i.cues.length))return;const a=i.cues,o=[];for(let m=0;m<a.length;m++)a[m]&&o.push(a[m]);const c=o.reduce((m,_)=>{const T=m[_.startTime]||[];return T.push(_),m[_.startTime]=T,m},{}),h=Object.keys(c).sort((m,_)=>Number(m)-Number(_));h.forEach((m,_)=>{const T=c[m],S=isFinite(n)?n:m,w=Number(h[_+1])||S;T.forEach(b=>{b.endTime=w})})},nw={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"},rw=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),iw=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const n=I.WebKitDataCue||I.VTTCue;e.forEach(r=>{for(const i of Object.keys(r)){if(rw.has(i))continue;const a=new n(r.startTime,r.endTime,"");a.id=r.id,a.type="com.apple.quicktime.HLS",a.value={key:nw[i],data:r[i]},(i==="scte35Out"||i==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}r.processDateRange()})},Ih=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,P.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},Gr=function(s,e,t){let n,r;if(t&&t.cues)for(n=t.cues.length;n--;)r=t.cues[n],r.startTime>=s&&r.endTime<=e&&t.removeCue(r)},aw=function(s){const e=s.cues;if(!e)return;const t={};for(let n=e.length-1;n>=0;n--){const r=e[n],i=`${r.startTime}-${r.endTime}-${r.text}`;t[i]?s.removeCue(r):t[i]=r}},ow=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const n=Math.ceil((e-t+3)*on.ONE_SECOND_IN_TS);let r;for(r=0;r<s.length&&!(s[r].pts>n);r++);return s.slice(r)},lw=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const n=e[0].pts;let r=0;for(r;r<s.length&&!(s[r].pts>=n);r++);return s.slice(0,r).concat(e)},cw=(s,e,t,n)=>{const r=Math.ceil((e-n)*on.ONE_SECOND_IN_TS),i=Math.ceil((t-n)*on.ONE_SECOND_IN_TS),a=s.slice();let o=s.length;for(;o--&&!(s[o].pts<=i););if(o===-1)return a;let c=o+1;for(;c--&&!(s[c].pts<=r););return c=Math.max(c,0),a.splice(c,o-c+1),a},dw=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),n=Object.keys(e).sort();if(t.length!==n.length)return!1;for(let r=0;r<t.length;r++){const i=t[r];if(i!==n[r]||s[i]!==e[i])return!1}return!0},uw=function(s,e,t){e=e||[];const n=[];let r=0;for(let i=0;i<e.length;i++){const a=e[i];if(s===a.timeline&&(n.push(i),r+=a.duration,r>t))return i}return n.length===0?0:n[n.length-1]},qr=1,hw=500,xh=s=>typeof s=="number"&&isFinite(s),oa=1/60,pw=(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,mw=(s,e,t)=>{let n=e-Je.BACK_BUFFER_LENGTH;s.length&&(n=Math.max(n,s.start(0)));const r=e-t;return Math.min(r,n)},Rn=s=>{const{startOfSegment:e,duration:t,segment:n,part:r,playlist:{mediaSequence:i,id:a,segments:o=[]},mediaIndex:c,partIndex:h,timeline:m}=s,_=o.length-1;let T="mediaIndex/partIndex increment";s.getMediaInfoForTime?T=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(T="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(T+=` with independent ${s.independent}`);const S=typeof h=="number",w=s.segment.uri?"segment":"pre-segment",b=S?Kf({preloadSegment:n})-1:0;return`${w} [${i+c}/${i+_}]`+(S?` part [${h}/${b}]`:"")+` segment start/end [${n.start} => ${n.end}]`+(S?` part start/end [${r.start} => ${r.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${m}] selected by [${T}] playlist [${a}]`},Lh=s=>`${s}TimingInfo`,fw=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:n,overrideCheck:r})=>!r&&s===e?null:s<e?t:n.length?n.end(n.length-1):t,Xl=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:n,audioDisabled:r})=>{if(e===t)return!1;if(n==="audio"){const i=s.lastTimelineChange({type:"main"});return!i||i.to!==t}if(n==="main"&&r){const i=s.pendingTimelineChange({type:"audio"});return!(i&&i.to===t)}return!1},gw=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),n=e&&t,r=n&&e.to!==t.to;return!!(n&&e.from!==-1&&t.from!==-1&&r)},yw=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Us=s=>{const e=s.pendingSegment_;if(e&&Xl({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&gw(s.timelineChangeController_)){if(yw(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},_w=s=>{let e=0;return["video","audio"].forEach(function(t){const n=s[`${t}TimingInfo`];if(!n)return;const{start:r,end:i}=n;let a;typeof r=="bigint"||typeof i=="bigint"?a=I.BigInt(i)-I.BigInt(r):typeof r=="number"&&typeof i=="number"&&(a=i-r),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},Ph=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+ss:!1,vw=(s,e)=>{if(e!=="hls")return null;const t=_w({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const n=s.playlist.targetDuration,r=Ph({segmentDuration:t,maxDuration:n*2}),i=Ph({segmentDuration:t,maxDuration:n}),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 ${n}. 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||i?{severity:r?"warn":"info",message:a}:null},rn=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),n=!!(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:n}};class Yl extends P.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_=jt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(n){n!==this.state_&&(this.logger_(`${this.state_} -> ${n}`),this.state_=n,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)}),this.sourceUpdater_.on("codecschange",n=>{this.trigger(ze({type:"codecschange"},n))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",n=>{this.trigger(ze({type:"timelinechange"},n)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Us(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return gl.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_&&I.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,I.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_&&gl.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return ct();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:n,isMuxed:r}=e;if(n&&t&&!this.audioDisabled_&&!r)return this.sourceUpdater_.buffered();if(n)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const n=Wa(e);let r=this.initSegments_[n];return t&&!r&&e.bytes&&(this.initSegments_[n]=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 n=pg(e);let r=this.keyCache_[n];this.cacheEncryptionKeys_&&t&&!r&&e.bytes&&(this.keyCache_[n]=r={resolvedUri:e.resolvedUri,bytes:e.bytes});const i={resolvedUri:(r||e).resolvedUri};return r&&(i.bytes=r.bytes),i}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 n=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 i=null;if(n&&(n.id?i=n.id:n.uri&&(i=n.uri)),this.logger_(`playlist update [${i} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
209
209
|
currentTime: ${this.currentTime_()}
|
|
210
210
|
bufferedEnd: ${ml(this.buffered_())}
|
|
211
|
-
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!n||n.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-n.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}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(n,e)}pause(){this.checkBufferTimeout_&&(I.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_&&gl.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,n=()=>{},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 i=1;const a=()=>{i--,i===0&&n()};(r||!this.audioDisabled_)&&(i++,this.sourceUpdater_.removeAudio(e,t,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=
|
|
211
|
+
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!n||n.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-n.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.parts[this.partIndex])){const c=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=c}}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(n,e)}pause(){this.checkBufferTimeout_&&(I.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_&&gl.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,n=()=>{},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 i=1;const a=()=>{i--,i===0&&n()};(r||!this.audioDisabled_)&&(i++,this.sourceUpdater_.removeAudio(e,t,a)),(r||this.loaderType_==="main")&&(this.gopBuffer_=cw(this.gopBuffer_,e,t,this.timeMapping_),i++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)Gr(e,t,this.inbandTextTracks_[o]);Gr(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&I.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=I.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&I.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=I.setTimeout(this.monitorBufferTick_.bind(this),hw)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:rn({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_,n=this.partIndex){if(!t||!this.mediaSource_)return!1;const r=typeof e=="number"&&t.segments[e],i=e+1===t.segments.length,a=!r||!r.parts||n+1===r.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&i&&a}chooseNextRequest_(){const e=this.buffered_(),t=ml(e)||0,n=sd(e,this.currentTime_()),r=!this.hasPlayed_()&&n>=1,i=n>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||r||i)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=uw(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${o.mediaIndex}`);else if(this.mediaIndex!==null){const T=a[this.mediaIndex],S=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=T.end?T.end:t,T.parts&&T.parts[S+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=S+1):o.mediaIndex=this.mediaIndex+1}else{let T,S,w;const b=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
212
212
|
For TargetTime: ${b}.
|
|
213
213
|
CurrentTime: ${this.currentTime_()}
|
|
214
214
|
BufferedEnd: ${t}
|
|
215
215
|
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
216
|
-
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const R=this.getSyncInfoFromMediaSequenceSync_(b);if(!R){const L="No sync info found while using media sequence sync";return this.error({message:L,metadata:{errorType:P.Error.StreamingFailedToSelectNextSegment,error:new Error(L)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${R.start} --> ${R.end})`),T=R.segmentIndex,S=R.partIndex,w=R.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const R=Et.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:b,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});T=R.segmentIndex,S=R.partIndex,w=R.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${b}`:`currentTime ${b}`,o.mediaIndex=T,o.startOfSegment=w,o.partIndex=S,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const c=a[o.mediaIndex];let h=c&&typeof o.partIndex=="number"&&c.parts&&c.parts[o.partIndex];if(!c||typeof o.partIndex=="number"&&!h)return null;typeof o.partIndex!="number"&&c.parts&&(o.partIndex=0,h=c.parts[0]);const m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&h&&!m&&!h.independent)if(o.partIndex===0){const T=a[o.mediaIndex-1],S=T.parts&&T.parts.length&&T.parts[T.parts.length-1];S&&S.independent&&(o.mediaIndex-=1,o.partIndex=T.parts.length-1,o.independent="previous segment")}else c.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}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 n=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!n)return null;if(!n.isAppended)return n;const r=this.mediaSequenceSync_.getSyncInfoForTime(n.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:n,mediaIndex:r,startOfSegment:i,isSyncRequest:a,partIndex:o,forceTimestampOffset:c,getMediaInfoForTime:h}=e,m=n.segments[r],_=typeof o=="number"&&m.parts[o],T={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||m.resolvedUri,mediaIndex:r,partIndex:_?o:null,isSyncRequest:a,startOfSegment:i,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:_&&_.duration||m.duration,segment:m,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:h,independent:t},S=typeof c<"u"?c:this.isPendingTimestampOffset_;T.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:i,buffered:this.buffered_(),overrideCheck:S});const w=ml(this.sourceUpdater_.audioBuffered());return typeof w=="number"&&(T.audioAppendStart=w-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(T.gopsToAlignWith=nw(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),T}timestampOffsetForSegment_(e){return uw(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_(),n=e.bandwidth,r=this.pendingSegment_.duration,i=Et.estimateSegmentRequestTime(r,n,this.playlist_,e.bytesReceived),a=RS(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(i<=a)return;const o=zE({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const c=i-a-o.rebufferingImpact;let h=.5;a<=ss&&(h=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||c<h)&&(this.bandwidth=o.playlist.attributes.BANDWIDTH*Ze.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Rn(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:n,hasVideo:r}=t,i={segmentInfo:rn({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:n,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:i}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},aw(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_():Us(this))))}handleTimingInfo_(e,t,n,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const i=this.pendingSegment_,a=Ch(t);i[a]=i[a]||{},i[a][n]=r,this.logger_(`timinginfo: ${t} - ${n} - ${r}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(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 n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach(i=>{r[i.stream]=r[i.stream]||{startTime:1/0,captions:[],endTime:0};const a=r[i.stream];a.startTime=Math.min(a.startTime,i.startTime+n),a.endTime=Math.max(a.endTime,i.endTime+n),a.captions.push(i)}),Object.keys(r).forEach(i=>{const{startTime:a,endTime:o,captions:c}=r[i],h=this.inbandTextTracks_;this.logger_(`adding cues from ${a} -> ${o} for ${i}`),YE(h,this.vhs_.tech_,i),Gr(a,o,h[i]),KE({captionArray:c,inbandTextTracks:h,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n));return}this.addMetadataToTextTrack(n,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_()?!Xl({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:n,hasVideo:r,isMuxed:i}=t;return!(r&&!e.videoTimingInfo||n&&!this.audioDisabled_&&!i&&!e.audioTimingInfo||Xl({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_()){Us(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[Ch(t.type)].start;else{const r=this.getCurrentMediaInfo_(),i=this.loaderType_==="main"&&r&&r.hasVideo;let a;i&&(a=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:i,firstVideoFrameTimeForData:a,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,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:n,playlist:r}){if(n){const i=Wa(n);if(this.activeInitSegmentId_===i)return null;t=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=i}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n},r){const i=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();i.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ln(i).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ln(a).join(", "));const o=i.length?i.start(0):0,c=i.length?i.end(i.length-1):0,h=a.length?a.start(0):0,m=a.length?a.end(a.length-1):0;if(c-o<=qr&&m-h<=qr){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${ln(i).join(", ")}, video buffer: ${ln(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:n}));const _=this.currentTime_()-qr;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${qr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=I.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},qr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:n},r){if(r){if(r.code===og){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:P.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:n,data:r,bytes:i}){if(!i){const o=[r];let c=r.byteLength;n&&(o.unshift(n),c+=n.byteLength),i=XE({bytes:c,segments:o})}const a={segmentInfo:rn({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:i},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:i}))}handleSegmentTimingInfo_(e,t,n){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,i=`${e}TimingInfo`;r[i]||(r[i]={}),r[i].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[i].transmuxedPresentationStart=n.start.presentation,r[i].transmuxedDecodeStart=n.start.decode,r[i].transmuxedPresentationEnd=n.end.presentation,r[i].transmuxedDecodeEnd=n.end.decode,r[i].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,t){const{type:n,data:r}=t;if(!r||!r.byteLength||n==="audio"&&this.audioDisabled_)return;const i=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:i,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_()){Us(this),this.loadQueue_.push(()=>{const t=ze({},e,{forceTimestampOffset:!0});ze(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),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,i=e.timeline!==this.currentTimeline_&&e.timeline>0,a=n||r&&i;this.logger_(`Requesting
|
|
216
|
+
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const R=this.getSyncInfoFromMediaSequenceSync_(b);if(!R){const L="No sync info found while using media sequence sync";return this.error({message:L,metadata:{errorType:P.Error.StreamingFailedToSelectNextSegment,error:new Error(L)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${R.start} --> ${R.end})`),T=R.segmentIndex,S=R.partIndex,w=R.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const R=Et.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:b,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});T=R.segmentIndex,S=R.partIndex,w=R.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${b}`:`currentTime ${b}`,o.mediaIndex=T,o.startOfSegment=w,o.partIndex=S,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const c=a[o.mediaIndex];let h=c&&typeof o.partIndex=="number"&&c.parts&&c.parts[o.partIndex];if(!c||typeof o.partIndex=="number"&&!h)return null;typeof o.partIndex!="number"&&c.parts&&(o.partIndex=0,h=c.parts[0]);const m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!n&&h&&!m&&!h.independent)if(o.partIndex===0){const T=a[o.mediaIndex-1],S=T.parts&&T.parts.length&&T.parts[T.parts.length-1];S&&S.independent&&(o.mediaIndex-=1,o.partIndex=T.parts.length-1,o.independent="previous segment")}else c.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const _=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&_&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}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 n=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!n)return null;if(!n.isAppended)return n;const r=this.mediaSequenceSync_.getSyncInfoForTime(n.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:n,mediaIndex:r,startOfSegment:i,isSyncRequest:a,partIndex:o,forceTimestampOffset:c,getMediaInfoForTime:h}=e,m=n.segments[r],_=typeof o=="number"&&m.parts[o],T={requestId:"segment-loader-"+Math.random(),uri:_&&_.resolvedUri||m.resolvedUri,mediaIndex:r,partIndex:_?o:null,isSyncRequest:a,startOfSegment:i,playlist:n,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:_&&_.duration||m.duration,segment:m,part:_,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:h,independent:t},S=typeof c<"u"?c:this.isPendingTimestampOffset_;T.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:i,buffered:this.buffered_(),overrideCheck:S});const w=ml(this.sourceUpdater_.audioBuffered());return typeof w=="number"&&(T.audioAppendStart=w-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(T.gopsToAlignWith=ow(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),T}timestampOffsetForSegment_(e){return fw(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_(),n=e.bandwidth,r=this.pendingSegment_.duration,i=Et.estimateSegmentRequestTime(r,n,this.playlist_,e.bytesReceived),a=MS(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(i<=a)return;const o=KE({main:this.vhs_.playlists.main,currentTime:t,bandwidth:n,duration:this.duration_(),segmentDuration:r,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const c=i-a-o.rebufferingImpact;let h=.5;a<=ss&&(h=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||c<h)&&(this.bandwidth=o.playlist.attributes.BANDWIDTH*Je.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Rn(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:n,hasVideo:r}=t,i={segmentInfo:rn({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:n,hasVideo:r}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:i}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},dw(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_():Us(this))))}handleTimingInfo_(e,t,n,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const i=this.pendingSegment_,a=Lh(t);i[a]=i[a]||{},i[a][n]=r,this.logger_(`timinginfo: ${t} - ${n} - ${r}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Us(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 n=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),r={};t.forEach(i=>{r[i.stream]=r[i.stream]||{startTime:1/0,captions:[],endTime:0};const a=r[i.stream];a.startTime=Math.min(a.startTime,i.startTime+n),a.endTime=Math.max(a.endTime,i.endTime+n),a.captions.push(i)}),Object.keys(r).forEach(i=>{const{startTime:a,endTime:o,captions:c}=r[i],h=this.inbandTextTracks_;this.logger_(`adding cues from ${a} -> ${o} for ${i}`),ZE(h,this.vhs_.tech_,i),Gr(a,o,h[i]),ew({captionArray:c,inbandTextTracks:h,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,n){if(this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)){if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,n));return}this.addMetadataToTextTrack(n,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_()?!Xl({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:n,hasVideo:r,isMuxed:i}=t;return!(r&&!e.videoTimingInfo||n&&!this.audioDisabled_&&!i&&!e.audioTimingInfo||Xl({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_()){Us(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const n=this.pendingSegment_;if(this.setTimeMapping_(n.timeline),this.updateMediaSecondsLoaded_(n.part||n.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),n.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),n.isFmp4=e.isFmp4,n.timingInfo=n.timingInfo||{},n.isFmp4)this.trigger("fmp4"),n.timingInfo.start=n[Lh(t.type)].start;else{const r=this.getCurrentMediaInfo_(),i=this.loaderType_==="main"&&r&&r.hasVideo;let a;i&&(a=n.videoTimingInfo.start),n.timingInfo.start=this.trueSegmentStart_({currentStart:n.timingInfo.start,playlist:n.playlist,mediaIndex:n.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:i,firstVideoFrameTimeForData:a,videoTimingInfo:n.videoTimingInfo,audioTimingInfo:n.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(n,t.type),this.updateSourceBufferTimestampOffset_(n),n.isSyncRequest){this.updateTimingInfoEnd_(n),this.syncController_.saveSegmentTimingInfo({segmentInfo:n,shouldSaveTimelineMapping:this.loaderType_==="main"});const r=this.chooseNextRequest_();if(r.mediaIndex!==n.mediaIndex||r.partIndex!==n.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}n.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(n,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:n,playlist:r}){if(n){const i=Wa(n);if(this.activeInitSegmentId_===i)return null;t=this.initSegmentForMap(n,!0).bytes,this.activeInitSegmentId_=i}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=r,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n},r){const i=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();i.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ln(i).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ln(a).join(", "));const o=i.length?i.start(0):0,c=i.length?i.end(i.length-1):0,h=a.length?a.start(0):0,m=a.length?a.end(a.length-1):0;if(c-o<=qr&&m-h<=qr){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${n.byteLength}, audio buffer: ${ln(i).join(", ")}, video buffer: ${ln(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:n}));const _=this.currentTime_()-qr;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${_}`),this.remove(0,_,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${qr}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=I.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},qr*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:n},r){if(r){if(r.code===og){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:n});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",r),this.error({message:`${t} append of ${n.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:P.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:n,data:r,bytes:i}){if(!i){const o=[r];let c=r.byteLength;n&&(o.unshift(n),c+=n.byteLength),i=JE({bytes:c,segments:o})}const a={segmentInfo:rn({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:i},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:i}))}handleSegmentTimingInfo_(e,t,n){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const r=this.pendingSegment_.segment,i=`${e}TimingInfo`;r[i]||(r[i]={}),r[i].transmuxerPrependedSeconds=n.prependedContentDuration||0,r[i].transmuxedPresentationStart=n.start.presentation,r[i].transmuxedDecodeStart=n.start.decode,r[i].transmuxedPresentationEnd=n.end.presentation,r[i].transmuxedDecodeEnd=n.end.decode,r[i].baseMediaDecodeTime=n.baseMediaDecodeTime}appendData_(e,t){const{type:n,data:r}=t;if(!r||!r.byteLength||n==="audio"&&this.audioDisabled_)return;const i=this.getInitSegmentAndUpdateState_({type:n,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:n,initSegment:i,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_()){Us(this),this.loadQueue_.push(()=>{const t=ze({},e,{forceTimestampOffset:!0});ze(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),n=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),r=this.mediaIndex!==null,i=e.timeline!==this.currentTimeline_&&e.timeline>0,a=n||r&&i;this.logger_(`Requesting
|
|
217
217
|
${Pg(e.uri)}
|
|
218
|
-
${Rn(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=jE({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:c,stream:h})=>{this.logger_(`${Rn(e)} logged from transmuxer stream ${h} as a ${c}: ${o}`)},triggerSegmentEventFn:({type:o,segment:c,keyInfo:h,trackInfo:m,timingInfo:_})=>{const T={segmentInfo:rn({segment:c})};h&&(T.keyInfo=h),m&&(T.trackInfo=m),_&&(T.timingInfo=_),this.trigger({type:o,metadata:T})}})}trimBackBuffer_(e){const t=dw(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,n=e.part,r=e.segment.key||e.segment.map&&e.segment.map.key,i=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.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:i},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<oa){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${oa}`);return}const n={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:n}),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,n){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,n));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===rs.ABORTED)return;if(this.pause(),e.code===rs.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,n.gopInfo&&(this.gopBuffer_=rw(this.gopBuffer_,n.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:n,firstVideoFrameTimeForData:r,currentVideoTimestampOffset:i,useVideoTimingInfo:a,videoTimingInfo:o,audioTimingInfo:c}){if(typeof e<"u")return e;if(!a)return c.start;const h=t.segments[n-1];return n===0||!h||typeof h.start>"u"||h.end!==r+i?r:o.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:n,hasVideo:r,isMuxed:i}=t,a=this.loaderType_==="main"&&r,o=!this.audioDisabled_&&n&&!i;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++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&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=cw(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:n}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end=typeof n.end=="number"?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const o={segmentInfo:rn({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:o})}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=fw(e,this.sourceType_);if(t&&(t.severity==="warn"?P.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 ${Rn(e)}`);return}this.logger_(`Appended ${Rn(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 n=e.segment,r=e.part,i=n.end&&this.currentTime_()-n.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(i||a){this.logger_(`bad ${i?"segment":"part"} ${Rn(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<oa){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${oa}`);return}const t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,n=t.start,r=t.end;if(!kh(n)||!kh(r))return;Gr(n,r,this.segmentMetadataTrack_);const i=I.WebKitDataCue||I.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:n,end:r},o=JSON.stringify(a),c=new i(n,r,o);c.value=a,this.segmentMetadataTrack_.addCue(c)}}function vs(){}const Rg=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},gw=["video","audio"],Kl=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},yw=(s,e)=>{for(let t=0;t<e.length;t++){const n=e[t];if(n.type==="mediaSource")return null;if(n.type===s)return t}return null},zn=(s,e)=>{if(e.queue.length===0)return;let t=0,n=e.queue[t];if(n.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),n.action(e),n.doneFn&&n.doneFn(),zn("audio",e),zn("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Kl(s,e))){if(n.type!==s){if(t=yw(s,e.queue),t===null)return;n=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=n,n.action(s,e),!n.doneFn){e.queuePending[s]=null,zn(s,e);return}}},Dg=(s,e)=>{const t=e[`${s}Buffer`],n=Rg(s);t&&(t.removeEventListener("updateend",e[`on${n}UpdateEnd_`]),t.removeEventListener("error",e[`on${n}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Jt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Ct={appendBuffer:(s,e,t)=>(n,r)=>{const i=r[`${n}Buffer`];if(Jt(r.mediaSource,i)){r.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${n}Buffer`);try{i.appendBuffer(s)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===og?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${n}Buffer`),r.queuePending[n]=null,t(a)}}},remove:(s,e)=>(t,n)=>{const r=n[`${t}Buffer`];if(Jt(n.mediaSource,r)){n.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{r.remove(s,e)}catch{n.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const n=t[`${e}Buffer`];Jt(t.mediaSource,n)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),n.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){P.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){P.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Jt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(n){P.log.warn(`Failed to abort on ${s}Buffer`,n)}}},addSourceBuffer:(s,e)=>t=>{const n=Rg(s),r=Xn(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const i=t.mediaSource.addSourceBuffer(r);i.addEventListener("updateend",t[`on${n}UpdateEnd_`]),i.addEventListener("error",t[`on${n}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=i},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(Dg(s,e),!!Jt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(n){P.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,n)}}},changeType:s=>(e,t)=>{const n=t[`${e}Buffer`],r=Xn(s);if(!Jt(t.mediaSource,n))return;const i=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===i)return;const o={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:o}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{n.changeType(r),t.codecs[e]=s}catch(c){o.errorType=P.Error.StreamingCodecsChangeError,o.error=c,c.metadata=o,t.error_=c,t.trigger("error"),P.log.warn(`Failed to changeType on ${e}Buffer`,c)}}},It=({type:s,sourceUpdater:e,action:t,doneFn:n,name:r})=>{e.queue.push({type:s,action:t,doneFn:n,name:r}),zn(s,e)},xh=(s,e)=>t=>{const n=e[`${s}Buffered`](),r=xS(n);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,r),e.queuePending[s]){const i=e.queuePending[s].doneFn;e.queuePending[s]=null,i&&i(e[`${s}Error_`])}zn(s,e)};class Ng extends P.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>zn("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=jt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=xh("video",this),this.onAudioUpdateEnd_=xh("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){It({type:"mediaSource",sourceUpdater:this,action:Ct.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){It({type:e,sourceUpdater:this,action:Ct.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){P.log.error("removeSourceBuffer is not supported!");return}It({type:"mediaSource",sourceUpdater:this,action:Ct.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!P.browser.IS_FIREFOX&&I.MediaSource&&I.MediaSource.prototype&&typeof I.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return I.SourceBuffer&&I.SourceBuffer.prototype&&typeof I.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){P.log.error("changeType is not supported!");return}It({type:e,sourceUpdater:this,action:Ct.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 n=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,n);this.canChangeType()&&this.changeType(t,n)})}appendBuffer(e,t){const{segmentInfo:n,type:r,bytes:i}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${i.length} until video append`);return}const a=t;if(It({type:r,sourceUpdater:this,action:Ct.appendBuffer(i,n||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return Jt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ct()}videoBuffered(){return Jt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ct()}buffered(){const e=Jt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Jt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():PS(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=vs){It({type:"mediaSource",sourceUpdater:this,action:Ct.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=vs){typeof e!="string"&&(e=void 0),It({type:"mediaSource",sourceUpdater:this,action:Ct.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,n=vs){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){n();return}It({type:"audio",sourceUpdater:this,action:Ct.remove(e,t),doneFn:n,name:"remove"})}removeVideo(e,t,n=vs){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){n();return}It({type:"video",sourceUpdater:this,action:Ct.remove(e,t),doneFn:n,name:"remove"})}updating(){return!!(Kl("audio",this)||Kl("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(It({type:"audio",sourceUpdater:this,action:Ct.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(It({type:"video",sourceUpdater:this,action:Ct.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&It({type:"audio",sourceUpdater:this,action:Ct.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&It({type:"video",sourceUpdater:this,action:Ct.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),gw.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Dg(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Lh=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),_w=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Ph=new Uint8Array(`
|
|
218
|
+
${Rn(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=HE({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:c,stream:h})=>{this.logger_(`${Rn(e)} logged from transmuxer stream ${h} as a ${c}: ${o}`)},triggerSegmentEventFn:({type:o,segment:c,keyInfo:h,trackInfo:m,timingInfo:_})=>{const T={segmentInfo:rn({segment:c})};h&&(T.keyInfo=h),m&&(T.trackInfo=m),_&&(T.timingInfo=_),this.trigger({type:o,metadata:T})}})}trimBackBuffer_(e){const t=mw(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,n=e.part,r=e.segment.key||e.segment.map&&e.segment.map.key,i=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:n?n.resolvedUri:t.resolvedUri,byterange:n?n.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:i},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const c=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=c}return t.map&&(a.map=this.initSegmentForMap(t.map)),a}saveTransferStats_(e){this.mediaRequests+=1,e&&(this.mediaBytesTransferred+=e.bytesReceived,this.mediaTransferDuration+=e.roundTripTime)}saveBandwidthRelatedStats_(e,t){if(this.pendingSegment_.byteLength=t.bytesReceived,e<oa){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${oa}`);return}const n={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:n}),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,n){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,n));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===rs.ABORTED)return;if(this.pause(),e.code===rs.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,n.gopInfo&&(this.gopBuffer_=lw(this.gopBuffer_,n.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:n,firstVideoFrameTimeForData:r,currentVideoTimestampOffset:i,useVideoTimingInfo:a,videoTimingInfo:o,audioTimingInfo:c}){if(typeof e<"u")return e;if(!a)return c.start;const h=t.segments[n-1];return n===0||!h||typeof h.start>"u"||h.end!==r+i?r:o.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:n,hasVideo:r,isMuxed:i}=t,a=this.loaderType_==="main"&&r,o=!this.audioDisabled_&&n&&!i;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++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&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=pw(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:n}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:n.start:n.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),n=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;n&&(e.timingInfo.end=typeof n.end=="number"?n.end:n.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const o={segmentInfo:rn({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:o})}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=vw(e,this.sourceType_);if(t&&(t.severity==="warn"?P.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 ${Rn(e)}`);return}this.logger_(`Appended ${Rn(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 n=e.segment,r=e.part,i=n.end&&this.currentTime_()-n.end>e.playlist.targetDuration*3,a=r&&r.end&&this.currentTime_()-r.end>e.playlist.partTargetDuration*3;if(i||a){this.logger_(`bad ${i?"segment":"part"} ${Rn(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<oa){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${oa}`);return}const t=this.throughput.rate,n=Date.now()-e.endOfAllRequests+1,r=Math.floor(e.byteLength/n*8*1e3);this.throughput.rate+=(r-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,n=t.start,r=t.end;if(!xh(n)||!xh(r))return;Gr(n,r,this.segmentMetadataTrack_);const i=I.WebKitDataCue||I.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:n,end:r},o=JSON.stringify(a),c=new i(n,r,o);c.value=a,this.segmentMetadataTrack_.addCue(c)}}function vs(){}const Rg=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},bw=["video","audio"],Kl=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},Tw=(s,e)=>{for(let t=0;t<e.length;t++){const n=e[t];if(n.type==="mediaSource")return null;if(n.type===s)return t}return null},zn=(s,e)=>{if(e.queue.length===0)return;let t=0,n=e.queue[t];if(n.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),n.action(e),n.doneFn&&n.doneFn(),zn("audio",e),zn("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Kl(s,e))){if(n.type!==s){if(t=Tw(s,e.queue),t===null)return;n=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=n,n.action(s,e),!n.doneFn){e.queuePending[s]=null,zn(s,e);return}}},Dg=(s,e)=>{const t=e[`${s}Buffer`],n=Rg(s);t&&(t.removeEventListener("updateend",e[`on${n}UpdateEnd_`]),t.removeEventListener("error",e[`on${n}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Zt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,Ct={appendBuffer:(s,e,t)=>(n,r)=>{const i=r[`${n}Buffer`];if(Zt(r.mediaSource,i)){r.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${n}Buffer`);try{i.appendBuffer(s)}catch(a){r.logger_(`Error with code ${a.code} `+(a.code===og?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${n}Buffer`),r.queuePending[n]=null,t(a)}}},remove:(s,e)=>(t,n)=>{const r=n[`${t}Buffer`];if(Zt(n.mediaSource,r)){n.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{r.remove(s,e)}catch{n.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const n=t[`${e}Buffer`];Zt(t.mediaSource,n)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),n.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){P.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){P.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Zt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(n){P.log.warn(`Failed to abort on ${s}Buffer`,n)}}},addSourceBuffer:(s,e)=>t=>{const n=Rg(s),r=Xn(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const i=t.mediaSource.addSourceBuffer(r);i.addEventListener("updateend",t[`on${n}UpdateEnd_`]),i.addEventListener("error",t[`on${n}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=i},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(Dg(s,e),!!Zt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(n){P.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,n)}}},changeType:s=>(e,t)=>{const n=t[`${e}Buffer`],r=Xn(s);if(!Zt(t.mediaSource,n))return;const i=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===i)return;const o={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:o}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{n.changeType(r),t.codecs[e]=s}catch(c){o.errorType=P.Error.StreamingCodecsChangeError,o.error=c,c.metadata=o,t.error_=c,t.trigger("error"),P.log.warn(`Failed to changeType on ${e}Buffer`,c)}}},It=({type:s,sourceUpdater:e,action:t,doneFn:n,name:r})=>{e.queue.push({type:s,action:t,doneFn:n,name:r}),zn(s,e)},Rh=(s,e)=>t=>{const n=e[`${s}Buffered`](),r=DS(n);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,r),e.queuePending[s]){const i=e.queuePending[s].doneFn;e.queuePending[s]=null,i&&i(e[`${s}Error_`])}zn(s,e)};class Ng extends P.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>zn("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=jt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=Rh("video",this),this.onAudioUpdateEnd_=Rh("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){It({type:"mediaSource",sourceUpdater:this,action:Ct.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){It({type:e,sourceUpdater:this,action:Ct.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){P.log.error("removeSourceBuffer is not supported!");return}It({type:"mediaSource",sourceUpdater:this,action:Ct.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!P.browser.IS_FIREFOX&&I.MediaSource&&I.MediaSource.prototype&&typeof I.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return I.SourceBuffer&&I.SourceBuffer.prototype&&typeof I.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){P.log.error("changeType is not supported!");return}It({type:e,sourceUpdater:this,action:Ct.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 n=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,n);this.canChangeType()&&this.changeType(t,n)})}appendBuffer(e,t){const{segmentInfo:n,type:r,bytes:i}=e;if(this.processedAppend_=!0,r==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${i.length} until video append`);return}const a=t;if(It({type:r,sourceUpdater:this,action:Ct.appendBuffer(i,n||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),r==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(c=>{this.appendBuffer.apply(this,c)})}}audioBuffered(){return Zt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:ct()}videoBuffered(){return Zt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:ct()}buffered(){const e=Zt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Zt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():OS(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=vs){It({type:"mediaSource",sourceUpdater:this,action:Ct.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=vs){typeof e!="string"&&(e=void 0),It({type:"mediaSource",sourceUpdater:this,action:Ct.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,n=vs){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){n();return}It({type:"audio",sourceUpdater:this,action:Ct.remove(e,t),doneFn:n,name:"remove"})}removeVideo(e,t,n=vs){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){n();return}It({type:"video",sourceUpdater:this,action:Ct.remove(e,t),doneFn:n,name:"remove"})}updating(){return!!(Kl("audio",this)||Kl("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(It({type:"audio",sourceUpdater:this,action:Ct.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(It({type:"video",sourceUpdater:this,action:Ct.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&It({type:"audio",sourceUpdater:this,action:Ct.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&It({type:"video",sourceUpdater:this,action:Ct.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),bw.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Dg(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const Dh=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),Aw=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},Nh=new Uint8Array(`
|
|
219
219
|
|
|
220
|
-
`.split("").map(s=>s.charCodeAt(0)));class
|
|
221
|
-
`,a=n,o=t;this.start_=a,e.forEach((c,h)=>{const m=this.storage_.get(o),_=a,T=_+c.duration,S=!!(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),w=new
|
|
222
|
-
`,L.syncInfo=j,j});r.set(o,new
|
|
223
|
-
`,o++,a=T}),this.end_=a,this.storage_=r,this.diagnostics_=i}calculateBaseTime_(e,t,n){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 i=r-e;let a=this.storage_.get(r).segmentSyncInfo.start;for(let o=0;o<i;o++){const c=t[o];a-=c.duration}return a}return n}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Dh extends Og{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,n){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,n)}}const Ew=86400,yl=[{name:"VOD",run:(s,e,t,n,r)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,n,r,i)=>{const a=s.getMediaSequenceSync(i);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,n,r)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let i=null,a=null;const o=jl(e);r=r||0;for(let c=0;c<o.length;c++){const h=e.endList||r===0?c:o.length-(c+1),m=o[h],_=m.segment,T=s.timelineToDatetimeMappings[_.timeline];if(!T||!_.dateTimeObject)continue;let S=_.dateTimeObject.getTime()/1e3+T;if(_.parts&&typeof m.partIndex=="number")for(let b=0;b<m.partIndex;b++)S+=_.parts[b].duration;const w=Math.abs(r-S);if(a!==null&&(w===0||a<w))break;a=w,i={time:S,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return i}},{name:"Segment",run:(s,e,t,n,r)=>{let i=null,a=null;r=r||0;const o=jl(e);for(let c=0;c<o.length;c++){const h=e.endList||r===0?c:o.length-(c+1),m=o[h],_=m.segment,T=m.part&&m.part.start||_&&_.start;if(_.timeline===n&&typeof T<"u"){const S=Math.abs(r-T);if(a!==null&&a<S)break;(!i||a===null||a>=S)&&(a=S,i={time:T,segmentIndex:m.segmentIndex,partIndex:m.partIndex})}}return i}},{name:"Discontinuity",run:(s,e,t,n,r)=>{let i=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o<e.discontinuityStarts.length;o++){const c=e.discontinuityStarts[o],h=e.discontinuitySequence+o+1,m=s.discontinuities[h];if(m){const _=Math.abs(r-m.time);if(a!==null&&a<_)break;(!i||a===null||a>=_)&&(a=_,i={time:m.time,segmentIndex:c,partIndex:null})}}}return i}},{name:"Playlist",run:(s,e,t,n,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class ww extends P.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Og,n=new Dh(t),r=new Dh(t);this.mediaSequenceStorage_={main:t,audio:n,vtt:r},this.logger_=jt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,n,r,i){if(t!==1/0)return yl.find(({name:o})=>o==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,n,r,i);if(!a.length)return null;for(const o of a){const{syncPoint:c,strategy:h}=o,{segmentIndex:m,time:_}=c;if(m<0)continue;const T=e.segments[m],S=_,w=S+T.duration;if(this.logger_(`Strategy: ${h}. Current time: ${r}. selected segment: ${m}. Time: [${S} -> ${w}]}`),r>=S&&r<w)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(a,{key:"time",value:r})}getExpiredTime(e,t){if(!e||!e.segments)return null;const n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;const r=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+ri({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,n,r,i){const a=[];for(let o=0;o<yl.length;o++){const c=yl[o],h=c.run(this,e,t,n,r,i);h&&(h.strategy=c.name,a.push({strategy:c.name,syncPoint:h}))}return a}selectSyncPoint_(e,t){let n=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),i=e[0].strategy;for(let a=1;a<e.length;a++){const o=Math.abs(e[a].syncPoint[t.key]-t.value);o<r&&(r=o,n=e[a].syncPoint,i=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${i}]: [time:${n.time}, segmentIndex:${n.segmentIndex}`+(typeof n.partIndex=="number"?`,partIndex:${n.partIndex}`:"")+"]"),n}saveExpiredSegmentInfo(e,t){const n=t.mediaSequence-e.mediaSequence;if(n>Ew){P.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);return}for(let r=n-1;r>=0;r--){const i=e.segments[r];if(i&&typeof i.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+r,time:i.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],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const i=r.dateTimeObject;r.discontinuity&&t&&i&&(this.timelineToDatetimeMappings[r.timeline]=-(i.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,n){const r=e.segment,i=e.part;let a=this.timelines[e.timeline],o,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,c=t.end+a.mapping;else if(a)o=t.start+a.mapping,c=t.end+a.mapping;else return!1;return i&&(i.start=o,i.end=c),(!r.start||o<r.start)&&(r.start=o),r.end=c,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let r=0;r<t.discontinuityStarts.length;r++){const i=t.discontinuityStarts[r],a=t.discontinuitySequence+r+1,o=i-e.mediaIndex,c=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>c){let h;o<0?h=n.start-ri({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:i}):h=n.end+ri({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:i}),this.discontinuities[a]={time:h,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class kw extends P.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:n}){return typeof t=="number"&&typeof n=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:n}){if(typeof t=="number"&&typeof n=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:n},delete this.pendingTimelineChanges_[e];const r={timelineChangeInfo:{from:t,to:n}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Cw=vg(bg(function(){var s=function(){function b(){this.listeners={}}var R=b.prototype;return R.on=function(L,U){this.listeners[L]||(this.listeners[L]=[]),this.listeners[L].push(U)},R.off=function(L,U){if(!this.listeners[L])return!1;var M=this.listeners[L].indexOf(U);return this.listeners[L]=this.listeners[L].slice(0),this.listeners[L].splice(M,1),M>-1},R.trigger=function(L){var U=this.listeners[L];if(U)if(arguments.length===2)for(var M=U.length,F=0;F<M;++F)U[F].call(this,arguments[1]);else for(var N=Array.prototype.slice.call(arguments,1),j=U.length,J=0;J<j;++J)U[J].apply(this,N)},R.dispose=function(){this.listeners={}},R.pipe=function(L){this.on("data",function(U){L.push(U)})},b}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(b){return b.subarray(0,b.byteLength-b[b.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const b=[[[],[],[],[],[]],[[],[],[],[],[]]],R=b[0],L=b[1],U=R[4],M=L[4];let F,N,j;const J=[],K=[];let ne,he,oe,me,te,ue;for(F=0;F<256;F++)K[(J[F]=F<<1^(F>>7)*283)^F]=F;for(N=j=0;!U[N];N^=ne||1,j=K[j]||1)for(me=j^j<<1^j<<2^j<<3^j<<4,me=me>>8^me&255^99,U[N]=me,M[me]=N,oe=J[he=J[ne=J[N]]],ue=oe*16843009^he*65537^ne*257^N*16843008,te=J[me]*257^me*16843008,F=0;F<4;F++)R[F][N]=te=te<<24^te>>>8,L[F][me]=ue=ue<<24^ue>>>8;for(F=0;F<5;F++)R[F]=R[F].slice(0),L[F]=L[F].slice(0);return b};let n=null;class r{constructor(R){n||(n=t()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let L,U,M;const F=this._tables[0][4],N=this._tables[1],j=R.length;let J=1;if(j!==4&&j!==6&&j!==8)throw new Error("Invalid aes key size");const K=R.slice(0),ne=[];for(this._key=[K,ne],L=j;L<4*j+28;L++)M=K[L-1],(L%j===0||j===8&&L%j===4)&&(M=F[M>>>24]<<24^F[M>>16&255]<<16^F[M>>8&255]<<8^F[M&255],L%j===0&&(M=M<<8^M>>>24^J<<24,J=J<<1^(J>>7)*283)),K[L]=K[L-j]^M;for(U=0;L;U++,L--)M=K[U&3?L:L-4],L<=4||U<4?ne[U]=M:ne[U]=N[0][F[M>>>24]]^N[1][F[M>>16&255]]^N[2][F[M>>8&255]]^N[3][F[M&255]]}decrypt(R,L,U,M,F,N){const j=this._key[1];let J=R^j[0],K=M^j[1],ne=U^j[2],he=L^j[3],oe,me,te;const ue=j.length/4-2;let z,G=4;const fe=this._tables[1],ye=fe[0],Pe=fe[1],Oe=fe[2],tt=fe[3],st=fe[4];for(z=0;z<ue;z++)oe=ye[J>>>24]^Pe[K>>16&255]^Oe[ne>>8&255]^tt[he&255]^j[G],me=ye[K>>>24]^Pe[ne>>16&255]^Oe[he>>8&255]^tt[J&255]^j[G+1],te=ye[ne>>>24]^Pe[he>>16&255]^Oe[J>>8&255]^tt[K&255]^j[G+2],he=ye[he>>>24]^Pe[J>>16&255]^Oe[K>>8&255]^tt[ne&255]^j[G+3],G+=4,J=oe,K=me,ne=te;for(z=0;z<4;z++)F[(3&-z)+N]=st[J>>>24]<<24^st[K>>16&255]<<16^st[ne>>8&255]<<8^st[he&255]^j[G++],oe=J,J=K,K=ne,ne=he,he=oe}}class i 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(R){this.jobs.push(R),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(b){return b<<24|(b&65280)<<8|(b&16711680)>>8|b>>>24},o=function(b,R,L){const U=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>2),M=new r(Array.prototype.slice.call(R)),F=new Uint8Array(b.byteLength),N=new Int32Array(F.buffer);let j,J,K,ne,he,oe,me,te,ue;for(j=L[0],J=L[1],K=L[2],ne=L[3],ue=0;ue<U.length;ue+=4)he=a(U[ue]),oe=a(U[ue+1]),me=a(U[ue+2]),te=a(U[ue+3]),M.decrypt(he,oe,me,te,N,ue),N[ue]=a(N[ue]^j),N[ue+1]=a(N[ue+1]^J),N[ue+2]=a(N[ue+2]^K),N[ue+3]=a(N[ue+3]^ne),j=he,J=oe,K=me,ne=te;return F};class c{constructor(R,L,U,M){const F=c.STEP,N=new Int32Array(R.buffer),j=new Uint8Array(R.byteLength);let J=0;for(this.asyncStream_=new i,this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,U,j)),J=F;J<N.length;J+=F)U=new Uint32Array([a(N[J-4]),a(N[J-3]),a(N[J-2]),a(N[J-1])]),this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,U,j));this.asyncStream_.push(function(){M(null,e(j))})}static get STEP(){return 32e3}decryptChunk_(R,L,U,M){return function(){const F=o(R,L,U);M.set(F,R.byteOffset)}}}var h=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Aa<"u"?Aa:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof h<"u"?m=h:typeof self<"u"?m=self:m={};var _=m,T=function(b){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(b):b&&b.buffer instanceof ArrayBuffer},S=_.BigInt||Number;S("0x1"),S("0x100"),S("0x10000"),S("0x1000000"),S("0x100000000"),S("0x10000000000"),S("0x1000000000000"),S("0x100000000000000"),S("0x10000000000000000"),function(){var b=new Uint16Array([65484]),R=new Uint8Array(b.buffer,b.byteOffset,b.byteLength);return R[0]===255?"big":R[0]===204?"little":"unknown"}();const w=function(b){const R={};return Object.keys(b).forEach(L=>{const U=b[L];T(U)?R[L]={bytes:U.buffer,byteOffset:U.byteOffset,byteLength:U.byteLength}:R[L]=U}),R};self.onmessage=function(b){const R=b.data,L=new Uint8Array(R.encrypted.bytes,R.encrypted.byteOffset,R.encrypted.byteLength),U=new Uint32Array(R.key.bytes,R.key.byteOffset,R.key.byteLength/4),M=new Uint32Array(R.iv.bytes,R.iv.byteOffset,R.iv.byteLength/4);new c(L,U,M,function(F,N){self.postMessage(w({source:R.source,decrypted:N}),[N.buffer])})}}));var Iw=_g(Cw);const xw=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Mg=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Ql=(s,e)=>{e.activePlaylistLoader=s,s.load()},Lw=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:n},mediaTypes:{[s]:r}}=e,i=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,c=r.lastGroup_;if(!(a&&c&&a.id===c.id)&&(r.lastGroup_=a,r.lastTrack_=i,Mg(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&n.resetEverything();return}t.resyncLoader(),Ql(a.playlistLoader,r)}},Pw=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:n}}=e;n.lastGroup_=null,t.abort(),t.pause()},Rw=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:n,main:r},mediaTypes:{[s]:i}}=e,a=i.activeTrack(),o=i.getActiveGroup(),c=i.activePlaylistLoader,h=i.lastTrack_;if(!(h&&a&&h.id===a.id)&&(i.lastGroup_=o,i.lastTrack_=a,Mg(n,i),!!o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;const m=e.vhs.playlistController_,_=m.selectPlaylist();if(m.media()===_)return;i.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),t.pause(),r.resetEverything(),m.fastQualityChange_(_);return}if(s==="AUDIO"){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}n.setAudio(!0),r.setAudio(!1)}if(c===o.playlistLoader){Ql(o.playlistLoader,i);return}n.track&&n.track(a),n.resetEverything(),Ql(o.playlistLoader,i)}},Xa={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:n}=e,r=t.activeTrack(),i=t.activeGroup(),a=(i.filter(c=>c.default)[0]||i[0]).id,o=t.tracks[a];if(r===o){n({error:{message:"Problem encountered loading the default audio track."}});return}P.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===o;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;P.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=t.activeTrack();n&&(n.mode="disabled"),t.onTrackChanged()}},Nh={AUDIO:(s,e,t)=>{if(!e)return;const{tech:n,requestOptions:r,segmentLoaders:{[s]:i}}=t;e.on("loadedmetadata",()=>{const a=e.media();i.playlist(a,r),(!n.paused()||a.endList&&n.preload()!=="none")&&i.load()}),e.on("loadedplaylist",()=>{i.playlist(e.media(),r),n.paused()||i.load()}),e.on("error",Xa[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:n,requestOptions:r,segmentLoaders:{[s]:i},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();i.playlist(o,r),i.track(a.activeTrack()),(!n.paused()||o.endList&&n.preload()!=="none")&&i.load()}),e.on("loadedplaylist",()=>{i.playlist(e.media(),r),n.paused()||i.load()}),e.on("error",Xa[s](s,t))}},Dw={AUDIO:(s,e)=>{const{vhs:t,sourceType:n,segmentLoaders:{[s]:r},requestOptions:i,main:{mediaGroups:a},mediaTypes:{[s]:{groups:o,tracks:c,logger_:h}},mainPlaylistLoader:m}=e,_=Si(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 T in a[s]){o[T]||(o[T]=[]);for(const S in a[s][T]){let w=a[s][T][S],b;if(_?(h(`AUDIO group '${T}' label '${S}' is a main playlist`),w.isMainPlaylist=!0,b=null):n==="vhs-json"&&w.playlists?b=new Bn(w.playlists[0],t,i):w.resolvedUri?b=new Bn(w.resolvedUri,t,i):w.playlists&&n==="dash"?b=new zl(w.playlists[0],t,i,m):b=null,w=ve({id:S,playlistLoader:b},w),Nh[s](s,w.playlistLoader,e),o[T].push(w),typeof c[S]>"u"){const R=new P.AudioTrack({id:S,kind:xw(w),enabled:!1,language:w.language,default:w.default,label:S});c[S]=R}}}r.on("error",Xa[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:n,sourceType:r,segmentLoaders:{[s]:i},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[s]:{groups:c,tracks:h}},mainPlaylistLoader:m}=e;for(const _ in o[s]){c[_]||(c[_]=[]);for(const T in o[s][_]){if(!n.options_.useForcedSubtitles&&o[s][_][T].forced)continue;let S=o[s][_][T],w;if(r==="hls")w=new Bn(S.resolvedUri,n,a);else if(r==="dash"){if(!S.playlists.filter(b=>b.excludeUntil!==1/0).length)return;w=new zl(S.playlists[0],n,a,m)}else r==="vhs-json"&&(w=new Bn(S.playlists?S.playlists[0]:S.resolvedUri,n,a));if(S=ve({id:T,playlistLoader:w},S),Nh[s](s,S.playlistLoader,e),c[_].push(S),typeof h[T]>"u"){const b=t.addRemoteTextTrack({id:T,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:T},!1).track;h[T]=b}}}i.on("error",Xa[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:n},mediaTypes:{[s]:{groups:r,tracks:i}}}=e;for(const a in n[s]){r[a]||(r[a]=[]);for(const o in n[s][a]){const c=n[s][a][o];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const h=t.options_.vhs&&t.options_.vhs.captionServices||{};let m={label:o,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(h[m.instreamId]&&(m=ve(m,h[m.instreamId])),m.default===void 0&&delete m.default,r[a].push(ve({id:o},c)),typeof i[o]>"u"){const _=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;i[o]=_}}}}},Ug=(s,e)=>{for(let t=0;t<s.length;t++)if(id(e,s[t])||s[t].playlists&&Ug(s[t].playlists,e))return!0;return!1},Nw=(s,e)=>t=>{const{mainPlaylistLoader:n,mediaTypes:{[s]:{groups:r}}}=e,i=n.media();if(!i)return null;let a=null;i.attributes[s]&&(a=r[i.attributes[s]]);const o=Object.keys(r);if(!a)if(s==="AUDIO"&&o.length>1&&Si(e.main))for(let c=0;c<o.length;c++){const h=r[o[c]];if(Ug(h,i)){a=h;break}}else r.main?a=r.main:o.length===1&&(a=r[o[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},Ow={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const n in t)if(t[n].enabled)return t[n];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const n in t)if(t[n].mode==="showing"||t[n].mode==="hidden")return t[n];return null}},Mw=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},Uw=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(h=>{Dw[h](h,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:n,vhs:r,segmentLoaders:{["AUDIO"]:i,main:a}}=s;["AUDIO","SUBTITLES"].forEach(h=>{e[h].activeGroup=Nw(h,s),e[h].activeTrack=Ow[h](h,s),e[h].onGroupChanged=Lw(h,s),e[h].onGroupChanging=Pw(h,s),e[h].onTrackChanged=Rw(h,s),e[h].getActiveGroup=Mw(h,s)});const o=e.AUDIO.activeGroup();if(o){const h=(o.filter(m=>m.default)[0]||o[0]).id;e.AUDIO.tracks[h].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),i.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",c),n.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{n.audioTracks().removeEventListener("change",c),n.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),n.clearTracks("audio");for(const h in e.AUDIO.tracks)n.audioTracks().addTrack(e.AUDIO.tracks[h])},Bw=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:vs,activeTrack:vs,getActiveGroup:vs,onGroupChanged:vs,onTrackChanged:vs,lastTrack_:null,logger_:jt(`MediaGroups[${e}]`)}}),s};class Oh{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_=St(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 Fw extends P.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Oh,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_=jt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const n=t.serverUri||t.serverURL;if(!n){this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`),this.trigger("error");return}if(n.startsWith("data:")){this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1));return}this.steeringManifest.reloadUri=St(e,n),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 n=e?t:this.getRequestURI(t);if(!n){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:n}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:n,requestType:"content-steering-manifest"},(i,a)=>{if(i){if(a.status===410){this.logger_(`manifest request 410 ${i}.`),this.logger_(`There will be no more content steering requests to ${n} this session.`),this.excludedSteeringManifestURLs.add(n);return}if(a.status===429){const h=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${i}.`),this.logger_(`content steering will retry in ${h} seconds.`),this.startTTLTimeout_(parseInt(h,10));return}this.logger_(`manifest failed to load ${i}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let o;try{o=JSON.parse(this.request_.responseText)}catch(h){const m={errorType:P.Error.StreamingContentSteeringParserError,error:h};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(o);const c={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new I.URL(e),n=new I.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(n.toString())}decodeDataUriManifest_(e){const t=JSON.parse(I.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new I.URL(e),n=this.getPathway(),r=this.getBandwidth_();if(n){const i=`_${this.manifestType_}_pathway`;t.searchParams.set(i,n)}if(r){const i=`_${this.manifestType_}_throughput`;t.searchParams.set(i,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 t=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,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 n=this.setSteeringParams_(e);return t(n)?null:n}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=I.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){I.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 Oh}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&&(St(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const jw=(s,e)=>{let t=null;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,n)},e)}},qw=10;let Bs;const Vw=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],$w=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},Hw=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:i,duration:a,bufferBasedABR:o,log:c}){if(!n)return P.log.warn("We received no playlist to switch to. Please check your stream."),!1;const h=`allowing switch ${s&&s.id||"null"} -> ${n.id}`;if(!s)return c(`${h} as current playlist is not set`),!0;if(n.id===s.id)return!1;const m=!!Un(e,t).length;if(!s.endList)return!m&&typeof s.partTargetDuration=="number"?(c(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${h} as current playlist is live`),!0);const _=sd(e,t),T=o?Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Ze.MAX_BUFFER_LOW_WATER_LINE;if(a<T)return c(`${h} as duration < max low water line (${a} < ${T})`),!0;const S=n.attributes.BANDWIDTH,w=s.attributes.BANDWIDTH;if(S<w&&(!o||_<i)){let b=`${h} as next bandwidth < current bandwidth (${S} < ${w})`;return o&&(b+=` and forwardBuffer < bufferHighWaterLine (${_} < ${i})`),c(b),!0}if((!o||S>w)&&_>=r){let b=`${h} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return o&&(b+=` and next bandwidth > current bandwidth (${S} > ${w})`),c(b),!0}return c(`not ${h} as no switching criteria met`),!1};class Ww extends P.EventTarget{constructor(e){super(),this.fastQualityChange_=jw(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:n,tech:r,bandwidth:i,externVhs:a,useCueTags:o,playlistExclusionDuration:c,enableLowInitialPlaylist:h,sourceType:m,cacheEncryptionKeys:_,bufferBasedABR:T,leastPixelDiffSelector:S,captionServices:w,experimentalUseMMS:b}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:R}=e;(R===null||typeof R>"u")&&(R=1/0),Bs=a,this.bufferBasedABR=!!T,this.leastPixelDiffSelector=!!S,this.withCredentials=n,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=o,this.playlistExclusionDuration=c,this.maxPlaylistRetries=R,this.enableLowInitialPlaylist=h,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:R,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Bw(),b&&I.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new I.ManagedMediaSource,this.usingManagedMediaSource_=!0,P.log("Using ManagedMediaSource")):I.MediaSource&&(this.mediaSource=new I.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_=ct(),this.hasPlayed_=!1,this.syncController_=new ww(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Iw,this.sourceUpdater_=new Ng(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new kw,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:w,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:i,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 zl(t,this.vhs_,ve(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Bn(t,this.vhs_,ve(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Yl(ve(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Yl(ve(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new bw(ve(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,N)=>{function j(){r.off("vttjserror",J),F()}function J(){r.off("vttjsloaded",j),N()}r.one("vttjsloaded",j),r.one("vttjserror",J),r.addWebVttScript_()})}),e);const U=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new Fw(this.vhs_.xhr,U),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),Vw.forEach(F=>{this[F+"_"]=$w.bind(this,F)}),this.logger_=jt("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 M=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(M,()=>{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,n){const r=this.media(),i=r&&(r.id||r.uri),a=e&&(e.id||e.uri);if(i&&i!==a){this.logger_(`switch media ${i} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,n)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],n=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(n&&r){const i=(n.length?n[0].playlists:n.playlists).filter(a=>a.attributes.serviceLocation===r);i.length&&this.mediaTypes_[e].activePlaylistLoader.media(i[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=I.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(I.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 n=e.mediaGroups.AUDIO,r=Object.keys(n);let i;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{const o=n.main||r.length&&n[r[0]];for(const c in o)if(o[c].default){i={label:c};break}}if(!i)return t;const a=[];for(const o in n)if(n[o][i.label]){const c=n[o][i.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let h=0;h<e.playlists.length;h++){const m=e.playlists[h];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===o&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),Uw({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(ze({},t))})})}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 n=e.mediaGroups||{};let r=!0;const i=Object.keys(n.AUDIO);for(const a in n.AUDIO)for(const o in n.AUDIO[a])n.AUDIO[a][o].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Bs.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),i.length&&Object.keys(n.AUDIO[i[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_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),i=this.bufferHighWaterLine(),a=this.tech_.buffered();return Hw({buffered:a,currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:i,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const n=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(n)}),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",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:qw}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))}),this.audioSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))}),this.subtitleSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))})})}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 n=t.end(0);let r=n;if(e.start){const i=e.start.timeOffset;i<0?r=Math.max(n+i,t.start(0)):r=Math.min(n,i)}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 t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const n=Bs.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),i=this.tech_.buffered();if(!i.length)return n-r<=ns;const a=i.end(i.length-1);return a-r<=ns&&n-a<=ns}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||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,i=r.filter(Eo),a=i.length===1&&i[0]===e;if(r.length===1&&n!==1/0)return P.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 w=this.pathwayAttribute_(e),b=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(w),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(w)},b);return}let S=!1;r.forEach(w=>{if(w===e)return;const b=w.excludeUntil;typeof b<"u"&&b!==1/0&&(S=!0,delete w.excludeUntil)}),S&&(P.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+n*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const h=t.internal?this.logger_:P.log.warn,m=t.message?" "+t.message:"";h(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=c.targetDuration/2*1e3||5*1e3,T=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=_;return this.switchMedia_(c,"exclude",a||T)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const n=[],r=e==="all";(r||e==="main")&&n.push(this.mainPlaylistLoader_);const i=[];(r||e==="audio")&&i.push("AUDIO"),(r||e==="subtitle")&&(i.push("CLOSED-CAPTIONS"),i.push("SUBTITLES")),i.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&n.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&n.push(o)}),n.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=Un(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:Bs.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const n=e.media();if(!n)return null;const r=this.syncController_.getMediaSequenceSync(t);if(r&&r.isReliable){const o=r.start,c=r.end;if(!isFinite(o)||!isFinite(c))return null;const h=Bs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n),m=Math.max(0,c-h);return m<o?null:ct([[o,m]])}const i=this.syncController_.getExpiredTime(n,this.duration());if(i===null)return null;const a=Bs.Playlist.seekable(n,i,Bs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const n=e.start(0),r=e.end(0),i=t.start(0),a=t.end(0);return i>r||n>a?e:ct([[Math.max(n,i),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 n=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||n&&n.length&&this.seekable_.length&&n.start(0)===this.seekable_.start(0)&&n.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Xf(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 n=Bs.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(n=Math.max(n,t.end(t.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}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 n in t)t[n].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_(),n=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const n=ii(this.main(),t),r={},i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=n.video||e.main.videoCodec||oT),e.main.isMuxed&&(r.video+=`,${n.audio||e.main.audioCodec||gu}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||i)&&(r.audio=n.audio||e.main.audioCodec||e.audio.audioCodec||gu,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=(h,m)=>h?ei(m,this.usingManagedMediaSource_):el(m),o={};let c;if(["video","audio"].forEach(function(h){if(r.hasOwnProperty(h)&&!a(e[h].isFmp4,r[h])){const m=e[h].isFmp4?"browser":"muxer";o[m]=o[m]||[],o[m].push(r[h]),h==="audio"&&(c=m)}}),i&&c&&t.attributes.AUDIO){const h=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===h&&m!==t&&(m.excludeUntil=1/0)}),this.logger_(`excluding audio group ${h} as ${c} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){const h=Object.keys(o).reduce((m,_)=>(m&&(m+=", "),m+=`${_} does not support codec(s): "${o[_].join(",")}"`,m),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:h},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const h=[];if(["video","audio"].forEach(m=>{const _=(Zt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,T=(Zt(r[m]||"")[0]||{}).type;_&&T&&_.toLowerCase()!==T.toLowerCase()&&h.push(`"${this.sourceUpdater_.codecs[m]}" -> "${r[m]}"`)}),h.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${h.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(n=>{const r=e[n];if(t.indexOf(r.id)!==-1)return;t.push(r.id);const i=ii(this.main,r),a=[];i.audio&&!el(i.audio)&&!ei(i.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${i.audio}`),i.video&&!el(i.video)&&!ei(i.video,this.usingManagedMediaSource_)&&a.push(`video codec ${i.video}`),i.text&&i.text==="stpp.ttml.im1t"&&a.push(`text codec ${i.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],n=this.main().playlists,r=za(Zt(e)),i=Ah(r),a=r.video&&Zt(r.video)[0]||null,o=r.audio&&Zt(r.audio)[0]||null;Object.keys(n).forEach(c=>{const h=n[c];if(t.indexOf(h.id)!==-1||h.excludeUntil===1/0)return;t.push(h.id);const m=[],_=ii(this.mainPlaylistLoader_.main,h),T=Ah(_);if(!(!_.audio&&!_.video)){if(T!==i&&m.push(`codec count "${T}" !== "${i}"`),!this.sourceUpdater_.canChangeType()){const S=_.video&&Zt(_.video)[0]||null,w=_.audio&&Zt(_.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${S.type}" !== "${a.type}"`),w&&o&&w.type.toLowerCase()!==o.type.toLowerCase()&&m.push(`audio codec "${w.type}" !== "${o.type}"`)}m.length&&(h.excludeUntil=1/0,this.logger_(`excluding ${h.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const n=this.seekable();n.length&&(t=n.start(0)),Aw(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Ze.GOAL_BUFFER_LENGTH,n=Ze.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Ze.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Ze.BUFFER_LOW_WATER_LINE,n=Ze.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Ze.MAX_BUFFER_LOW_WATER_LINE),i=Math.max(t,Ze.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?i:r)}bufferHighWaterLine(){return Ze.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){wh(this.inbandTextTracks_,"com.apple.streaming",this.tech_),tw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,n){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();wh(this.inbandTextTracks_,e,this.tech_),ZE({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:n})}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(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(ze({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),n=[];for(const r of e.playlists){const i=r.attributes.serviceLocation;if(i&&(n.push(i),!t.has(i)))return!0}return!!(!n.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,n=new Set;let r=!1;Object.keys(t).forEach(i=>{const a=t[i],o=this.pathwayAttribute_(a),c=o&&e!==o;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!c&&(delete a.excludeUntil,delete a.lastExcludeReason_,r=!0);const h=!a.excludeUntil&&a.excludeUntil!==1/0;!n.has(a.id)&&c&&h&&(n.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(i=>{const a=this.mediaTypes_[i];if(a.activePlaylistLoader){const o=a.activePlaylistLoader.media_;o&&o.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||n&&n.size){for(const[r,i]of t.entries())n.get(r)||(this.mainPlaylistLoader_.updateOrDeleteClone(i),this.contentSteeringController_.excludePathway(r));for(const[r,i]of n.entries()){const a=t.get(r);if(!a){e.filter(o=>o.attributes["PATHWAY-ID"]===i["BASE-ID"]).forEach(o=>{this.mainPlaylistLoader_.addClonePathway(i,o)}),this.contentSteeringController_.addAvailablePathway(r);continue}this.equalPathwayClones_(a,i)||(this.mainPlaylistLoader_.updateOrDeleteClone(i,!0),this.contentSteeringController_.addAvailablePathway(r))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...n])))}}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 n=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(const i in n)if(n[i]!==r[i])return!1;for(const i in r)if(n[i]!==r[i])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(n=>{const r=this.mainPlaylistLoader_.getKeyIdSet(n);!r||!r.size||r.forEach(i=>{const a="usable",o=this.keyStatusMap_.has(i)&&this.keyStatusMap_.get(i)===a,c=n.lastExcludeReason_===t&&n.excludeUntil===1/0;o?o&&c&&(delete n.excludeUntil,delete n.lastExcludeReason_,this.logger_(`enabling playlist ${n.id} because key ID ${i} is ${a}`)):(n.excludeUntil!==1/0&&n.lastExcludeReason_!==t&&(n.excludeUntil=1/0,n.lastExcludeReason_=t,this.logger_(`excluding playlist ${n.id} because the key ID ${i} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(n=>{const r=n&&n.attributes&&n.attributes.RESOLUTION&&n.attributes.RESOLUTION.height<720,i=n.excludeUntil===1/0&&n.lastExcludeReason_===t;r&&i&&(delete n.excludeUntil,P.log.warn(`enabling non-HD playlist ${n.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:_w(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 zw=(s,e,t)=>n=>{const r=s.main.playlists[e],i=rd(r),a=Eo(r);if(typeof n>"u")return a;n?delete r.disabled:r.disabled=!0;const o={renditionInfo:{id:e,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return n!==a&&!i&&(n?(t(r),s.trigger({type:"renditionenabled",metadata:o})):s.trigger({type:"renditiondisabled",metadata:o})),n};class Gw{constructor(e,t,n){const{playlistController_:r}=e,i=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=ii(r.main(),t),this.playlist=t,this.id=n,this.enabled=zw(e.playlists,t.id,i)}}const Xw=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Si(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(n=>!rd(n)).map((n,r)=>new Gw(s,n,n.id)):[]}},Mh=["seeking","seeked","pause","playing","error"];class Yw extends P.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_=jt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),n=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),i=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],c={};o.forEach(m=>{c[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",c[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",c[m].reset),this.tech_.on(["seeked","seeking"],c[m].reset)});const h=m=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),h("off"))},this.clearSeekingAppendCheck_=()=>h("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),h("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Mh,i),this.tech_.on("canplay",n),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Mh,i),this.tech_.off("canplay",n),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(m=>{a[`${m}SegmentLoader_`].off("appendsdone",c[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",c[m].reset),this.tech_.off(["seeked","seeking"],c[m].reset)}),this.checkCurrentTimeTimeout_&&I.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&I.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=I.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_,n=t[`${e}SegmentLoader_`],r=n.buffered_(),i=DS(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,i){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:n.playlist_&&n.playlist_.id,buffered:ln(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+ns>=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(ct([this.lastRecordedTime,e]));const n={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:n}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime(),n=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const S=e.start(0);r=S+(S===e.end(0)?0:ns)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Xf(e)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const i=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),o=i.audioBuffer?i.audioBuffered():null,c=i.videoBuffer?i.videoBuffered():null,h=this.media(),m=h.partTargetDuration?h.partTargetDuration:(h.targetDuration-ss)*2,_=[o,c];for(let S=0;S<_.length;S++)if(_[S]&&sd(_[S],t)<m)return!1;const T=ia(a,t);return T.length===0?!1:(r=T.start(0)+ns,this.logger_(`Buffered region starts (${T.start(0)}) just beyond seek point (${t}). Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),n=Un(t,e);if(n.length&&e+3<=n.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${n.start(0)} -> ${n.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 a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const n=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const i=ia(r,t);return i.length>0?(this.logger_(`Stopped at ${t} and seeking to ${i.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,n,r=!1){if(!e.length)return!1;let i=e.end(e.length-1)+ns;const a=!n.endList,o=typeof n.partTargetDuration=="number";return a&&(o||r)&&(i=e.end(e.length-1)+n.targetDuration*3),t>i}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:n}){if(!e)return;let r;if(e.length&&t.length){const i=Un(e,n-3),a=Un(e,n),o=Un(t,n);o.length&&!a.length&&i.length&&(r={start:i.end(0),end:o.end(0)})}else ia(e,n).length||(r=this.gapFromVideoUnderflow_(e,n));return r?(this.logger_(`Encountered a gap in video from ${r.start} to ${r.end}. Seeking to current time ${n}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),n=this.tech_.currentTime(),r=ia(t,n);if(this.resetTimeUpdate_(),r.length===0||n!==e)return;this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+ss);const i={gapInfo:{from:n,to:r.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:i}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const n=LS(e);for(let r=0;r<n.length;r++){const i=n.start(r),a=n.end(r);if(t-i<4&&t-i>2)return{start:i,end:a}}return null}}const Kw={errorInterval:30,getSource(s){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(e)}},Bg=function(s,e){let t=0,n=0;const r=ve(Kw,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const i=function(){n&&s.currentTime(n)},a=function(m){m!=null&&(n=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",i),s.src(m),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},o=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"){P.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),r.getSource.call(s,a)},c=function(){s.off("loadedmetadata",i),s.off("error",o),s.off("dispose",c)},h=function(m){c(),Bg(s,m)};s.on("error",o),s.on("dispose",c),s.reloadSourceOnError=h},Qw=function(s){Bg(this,s)};var Fg="3.16.2",Zw="7.1.0",Jw="1.3.1",ek="7.2.0",tk="4.0.2";const Fe={PlaylistLoader:Bn,Playlist:Et,utils:nE,STANDARD_PLAYLIST_SELECTOR:Eh,INITIAL_PLAYLIST_SELECTOR:GE,lastBandwidthSelector:Eh,movingAverageBandwidthSelector:WE,comparePlaylistBandwidth:od,comparePlaylistResolution:HE,xhr:ug()};Object.keys(Ze).forEach(s=>{Object.defineProperty(Fe,s,{get(){return P.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Ze[s]},set(e){if(P.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){P.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}Ze[s]=e}})});const jg="videojs-vhs",qg=function(s,e){const t=e.media();let n=-1;for(let r=0;r<s.length;r++)if(s[r].id===t.id){n=r;break}s.selectedIndex_=n,s.trigger({selectedIndex:n,type:"change"})},sk=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),qg(s,e.playlists)};Fe.canPlaySource=function(){return P.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const nk=(s,e,t)=>{if(!s)return s;let n={};e&&e.attributes&&e.attributes.CODECS&&(n=za(Zt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(n.audio=t.attributes.CODECS);const r=Xn(n.video),i=Xn(n.audio),a={};for(const o in s)a[o]={},i&&(a[o].audioContentType=i),r&&(a[o].videoContentType=r),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof s[o]=="string"&&(a[o].url=s[o]);return ve(s,a)},rk=(s,e)=>s.reduce((t,n)=>{if(!n.contentProtection)return t;const r=e.reduce((i,a)=>{const o=n.contentProtection[a];return o&&o.pssh&&(i[a]={pssh:o.pssh}),i},{});return Object.keys(r).length&&t.push(r),t},[]),ik=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:n})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?n.concat([t]):n,i=rk(r,Object.keys(e)),a=[],o=[];return i.forEach(c=>{o.push(new Promise((h,m)=>{s.tech_.one("keysessioncreated",h)})),a.push(new Promise((h,m)=>{s.eme.initializeMediaKeys({keySystems:c},_=>{if(_){m(_);return}h()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},ak=({player:s,sourceKeySystems:e,media:t,audioMedia:n})=>{const r=nk(e,t,n);return r?(s.currentSource().keySystems=r,r&&!s.eme?(P.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Vg=()=>{if(!I.localStorage)return null;const s=I.localStorage.getItem(jg);if(!s)return null;try{return JSON.parse(s)}catch{return null}},ok=s=>{if(!I.localStorage)return!1;let e=Vg();e=e?ve(e,s):s;try{I.localStorage.setItem(jg,JSON.stringify(e))}catch{return!1}return e},lk=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,$g=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Hg=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Wg=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},zg=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Fe.supportsNativeHls=function(){if(!Y||!Y.createElement)return!1;const s=Y.createElement("video");return P.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(s.canPlayType(e))}):!1}();Fe.supportsNativeDash=function(){return!Y||!Y.createElement||!P.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(Y.createElement("video").canPlayType("application/dash+xml"))}();Fe.supportsTypeNatively=s=>s==="hls"?Fe.supportsNativeHls:s==="dash"?Fe.supportsNativeDash:!1;Fe.isSupported=function(){return P.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Fe.xhr.onRequest=function(s){$g(Fe.xhr,s)};Fe.xhr.onResponse=function(s){Hg(Fe.xhr,s)};Fe.xhr.offRequest=function(s){Wg(Fe.xhr,s)};Fe.xhr.offResponse=function(s){zg(Fe.xhr,s)};const ck=P.getComponent("Component");class Gg extends ck{constructor(e,t,n){if(super(t,n.vhs),typeof n.initialBandwidth=="number"&&(this.options_.bandwidth=n.initialBandwidth),this.logger_=jt("VhsHandler"),t.options_&&t.options_.playerId){const r=P.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(Y,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const i=Y.fullscreenElement||Y.webkitFullscreenElement||Y.mozFullScreenElement||Y.msFullscreenElement;i&&i.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_=ve(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_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.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 n=Vg();n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Ze.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Ze.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(n=>{typeof this.source_[n]<"u"&&(this.options_[n]=this.source_[n])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;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=lk(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Fe,this.options_.sourceType=Mp(t),this.options_.seekTo=i=>{this.tech_.setCurrentTime(i)},this.options_.player_=this.player_,this.playlistController_=new Ww(this.options_);const n=ve({liveRangeSafeTimeDelta:ns},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Yw(n),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const i=P.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}),i.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(i){this.playlistController_.selectPlaylist=i.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(i){this.playlistController_.mainSegmentLoader_.throughput.rate=i,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let i=this.playlistController_.mainSegmentLoader_.bandwidth;const a=I.navigator.connection||I.navigator.mozConnection||I.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=o&&i>=o?i=Math.max(i,c):i=c}return i},set(i){this.playlistController_.mainSegmentLoader_.bandwidth=i,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const i=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(i+a))},set(){P.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:()=>ln(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:()=>ln(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&&ok({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Xw(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_=I.URL.createObjectURL(this.playlistController_.mediaSource),(P.browser.IS_ANY_SAFARI||P.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"),ik({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=ak({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",n=>{this.playlistController_.updatePlaylistByKeyStatus(n.keyId,n.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=P.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{sk(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{qg(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Fg,"mux.js":Zw,"mpd-parser":Jw,"m3u8-parser":ek,"aes-decrypter":tk}}version(){return this.constructor.version()}canChangeType(){return Ng.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_&&I.URL.revokeObjectURL&&(I.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return dE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,n=!0,r=2){return gg({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{$g(this.xhr,e)},this.xhr.onResponse=e=>{Hg(this.xhr,e)},this.xhr.offRequest=e=>{Wg(this.xhr,e)},this.xhr.offResponse=e=>{zg(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(n=>{this.playlistController_.on(n,r=>{this.player_.trigger(ze({},r))})}),t.forEach(n=>{this.playbackWatcher_.on(n,r=>{this.player_.trigger(ze({},r))})})}}const Ya={name:"videojs-http-streaming",VERSION:Fg,canHandleSource(s,e={}){const t=ve(P.options,e);return!t.vhs.experimentalUseMMS&&!ei("avc1.4d400d,mp4a.40.2",!1)?!1:Ya.canPlayType(s.type,t)},handleSource(s,e,t={}){const n=ve(P.options,t);return e.vhs=new Gg(s,e,n),e.vhs.xhr=ug(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=Mp(s);if(!t)return"";const n=Ya.getOverrideNative(e);return!Fe.supportsTypeNatively(t)||n?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(P.browser.IS_ANY_SAFARI||P.browser.IS_IOS),{overrideNative:n=t}=e;return n}},dk=()=>ei("avc1.4d400d,mp4a.40.2",!0);dk()&&P.getTech("Html5").registerSourceHandler(Ya,0);P.VhsHandler=Gg;P.VhsSourceHandler=Ya;P.Vhs=Fe;P.use||P.registerComponent("Vhs",Fe);P.options.vhs=P.options.vhs||{};(!P.getPlugin||!P.getPlugin("reloadSourceOnError"))&&P.registerPlugin("reloadSourceOnError",Qw);const uk=(s,e)=>{const t=goog.pal,n=new t.ConsentSettings;n.allowStorage=!1;const r=new t.NonceLoader(n);return async()=>{try{const i=new URL(e),a=new t.NonceRequest;let o=localStorage.getItem("sl-device-id")||ge.v4(),c=sessionStorage.getItem("sl-ad-session-id");c||(c=ge.v4(),sessionStorage.setItem("sl-ad-session-id",c)),dp(o)||(o=ba(`https://${o}`,ba.URL)),a.adWillAutoPlay=i.searchParams.get("vpa")==="auto",a.adWillPlayMuted=i.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=i.searchParams.get("description_url")||"",a.iconsSupported=!0,a.sessionId=o,a.supportedApiFrameworks="2,7,9",a.videoHeight=s.clientHeight,a.videoWidth=s.clientWidth;const h=await r.loadNonceManager(a);return i.searchParams.set("givn",h.getNonce()),i.searchParams.get("is_lat")==="[placeholder]"&&i.searchParams.set("is_lat","1"),i.searchParams.get("rdid")==="[placeholder]"&&i.searchParams.set("rdid",o),i.searchParams.get("correlator")==="[placeholder]"&&i.searchParams.set("correlator",c),i}catch(i){console.log("AdsManager could not be started",i);return}}};/*! @name videojs-contrib-ads @version 7.5.2 @license Apache-2.0 */var Xg="7.5.2";function hk(s){return{disableNextSnapshotRestore:!1,_contentEnding:!1,_contentHasEnded:!1,_hasThereBeenALoadStartDuringPlayerLife:!1,_hasThereBeenALoadedData:!1,_hasThereBeenALoadedMetaData:!1,_inLinearAdMode:!1,_shouldBlockPlay:!1,_playBlocked:!1,_playRequested:!1,_error:null,adType:null,VERSION:Xg,reset:function(){s.ads.disableNextSnapshotRestore=!1,s.ads._contentEnding=!1,s.ads._contentHasEnded=!1,s.ads.snapshot=null,s.ads.adType=null,s.ads._hasThereBeenALoadedData=!1,s.ads._hasThereBeenALoadedMetaData=!1,s.ads._cancelledPlay=!1,s.ads._shouldBlockPlay=!1,s.ads._playBlocked=!1,s.ads.nopreroll_=!1,s.ads.nopostroll_=!1,s.ads._playRequested=!1,s.ads._error=null},startLinearAdMode:function(){s.ads._state.startLinearAdMode()},endLinearAdMode:function(){s.ads._state.endLinearAdMode()},skipLinearAdMode:function(){s.ads._state.skipLinearAdMode()},stitchedAds:function(e){return e!==void 0&&(P.log.warn("Using player.ads.stitchedAds() as a setter is deprecated, it should be set as an option upon initialization of contrib-ads."),this.settings.stitchedAds=!!e),this.settings.stitchedAds},videoElementRecycled:function(){if(s.ads.shouldPlayContentBehindAd(s))return!1;if(!this.snapshot)throw new Error("You cannot use videoElementRecycled while there is no snapshot.");var e=s.tech_.src()!==this.snapshot.src,t=s.currentSrc()!==this.snapshot.currentSrc;return e||t},isLive:function(e){return e===void 0&&(e=s),typeof e.ads.settings.contentIsLive=="boolean"?e.ads.settings.contentIsLive:e.duration()===1/0?!0:P.browser.IOS_VERSION==="8"&&e.duration()===0},shouldPlayContentBehindAd:function(e){if(e===void 0&&(e=s),e)return e.ads.settings.liveCuePoints?!P.browser.IS_IOS&&!P.browser.IS_ANDROID&&e.duration()===1/0:!1;throw new Error("shouldPlayContentBehindAd requires a player as a param")},shouldTakeSnapshots:function(e){return e===void 0&&(e=s),!this.shouldPlayContentBehindAd(e)&&!this.stitchedAds()},isInAdMode:function(){return this._state.isAdState()},isWaitingForAdBreak:function(){return this._state.isWaitingForAdBreak()},isContentResuming:function(){return this._state.isContentResuming()},isAdPlaying:function(){return this._state.inAdBreak()},inAdBreak:function(){return this._state.inAdBreak()},removeNativePoster:function(){var e=s.$(".vjs-tech");e&&e.removeAttribute("poster")},debug:function(){if(this.settings.debug){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length===1&&typeof t[0]=="string"?P.log("ADS: "+t[0]):P.log.apply(P,["ADS:"].concat(t))}},error:function(e){if(e===void 0)return this._error||null;if(e===null||!e.errorType){this._error=null;return}this._error=e,P.log.error("An error with Ads occured. Type: "+e.errorType+"."),s.trigger({type:"vjsadserror",error:this._error})}}}var Yg=function(s,e){e.isImmediatePropagationStopped=function(){return!0},e.cancelBubble=!0,e.isPropagationStopped=function(){return!0}},us=function(s,e,t){Yg(s,t),s.trigger({type:e+t.type,originalEvent:t})},pk=function(s,e){s.ads.isInAdMode()&&(s.ads.isContentResuming()?s.ads._contentEnding&&us(s,"content",e):us(s,"ad",e))},mk=function(s,e){s.ads.isInAdMode()?s.ads.isContentResuming()?(Yg(s,e),s.trigger("resumeended")):us(s,"ad",e):!s.ads._contentHasEnded&&!s.ads.stitchedAds()&&(us(s,"content",e),s.trigger("readyforpostroll"))},fk=function(s,e){if(!(e.type==="loadstart"&&!s.ads._hasThereBeenALoadStartDuringPlayerLife||e.type==="loadeddata"&&!s.ads._hasThereBeenALoadedData||e.type==="loadedmetadata"&&!s.ads._hasThereBeenALoadedMetaData))if(s.ads.inAdBreak())us(s,"ad",e);else{if(s.currentSrc()!==s.ads.contentSrc)return;us(s,"content",e)}},gk=function(s,e){s.ads.inAdBreak()?us(s,"ad",e):s.ads.isContentResuming()&&us(s,"content",e)};function yk(s){s.type==="playing"?pk(this,s):s.type==="ended"?mk(this,s):s.type==="loadstart"||s.type==="loadeddata"||s.type==="loadedmetadata"?fk(this,s):s.type==="play"?gk(this,s):this.ads.isInAdMode()&&(this.ads.isContentResuming()?us(this,"content",s):us(this,"ad",s))}function _k(s){s.ads.contentSrc=s.currentSrc(),s.ads._seenInitialLoadstart=!1;var e=function(){if(!s.ads.inAdBreak()){var t=s.currentSrc();t!==s.ads.contentSrc&&(s.ads._seenInitialLoadstart&&s.trigger({type:"contentchanged"}),s.trigger({type:"contentupdate",oldValue:s.ads.contentSrc,newValue:t}),s.ads.contentSrc=t),s.ads._seenInitialLoadstart=!0}};s.on("loadstart",e)}function Zl(){return Zl=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},Zl.apply(this,arguments)}function Rt(s,e){s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Jl(s,e)}function Jl(s,e){return Jl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Jl(s,e)}var Kg={},vk=function(s){if(P.dom.isInFrame()&&typeof I.__tcfapi!="function"){for(var e=I,t,n={};e;){try{if(e.frames.__tcfapiLocator){t=e;break}}catch{}if(e===I.top)break;e=e.parent}if(!t)return;I.__tcfapi=function(r,i,a,o){var c=Math.random()+"",h={__tcfapiCall:{command:r,parameter:o,version:i,callId:c}};n[c]=a,t.postMessage(h,"*")},I.addEventListener("message",function(r){var i={};try{i=typeof r.data=="string"?JSON.parse(r.data):r.data}catch{}var a=i.__tcfapiReturn;a&&typeof n[a.callId]=="function"&&(n[a.callId](a.returnValue,a.success),n[a.callId]=null)},!1)}},Uh=function(){vk(),typeof I.__tcfapi=="function"&&I.__tcfapi("addEventListener",2,function(s,e){e&&(Kg=s)})},bk=function(s){for(var e=s.parent;e!==s.top;){try{if(e.frames&&e.frames.__uspapiLocator)return e}catch{}e=e.parent}try{if(s.top.frames&&s.top.frames.__uspapiLocator)return s.top}catch{}return null},ec="",Tk=function(){return ec},Bh=function(s,e){if(e===void 0&&(e=I),e.__uspapi)e.__uspapi("getUSPData",1,function(a,o){var c=o?a.uspString:null;ec=c,s(c)});else{var t=bk(e);if(!t){s(null);return}var n=Math.random().toString(36).substring(2),r={__uspapiCall:{command:"getUSPData",version:1,callId:n}},i=function a(o){if(o&&o.data&&o.data.__uspapiReturn&&o.data.__uspapiReturn.callId===n){e.removeEventListener("message",a,!1);var c=o.data.__uspapiReturn,h=c.returnValue,m=c.success,_=m?h.uspString:null;ec=_,s(_)}};e.addEventListener("message",i,!1),t.postMessage(r,"*")}},yn={AdsBeforePrerollError:"ads-before-preroll-error",AdsPrerollError:"ads-preroll-error",AdsMidrollError:"ads-midroll-error",AdsPostrollError:"ads-postroll-error",AdsMacroReplacementFailed:"ads-macro-replacement-failed",AdsResumeContentFailed:"ads-resume-content-failed"},Fh=function(s,e){return e?encodeURIComponent(s):s},Ak=function(s,e,t){if(s&&s[t])for(var n=s[t],r=Object.keys(n),i=0;i<r.length;i++){var a="{mediainfo."+t+"."+r[i]+"}";e[a]=n[r[i]]}},Sk=function(s,e){var t={};return["description","tags","reference_id","ad_keys"].forEach(function(n){s&&s[n]?t["{mediainfo."+n+"}"]=s[n]:e["{mediainfo."+n+"}"]?t["{mediainfo."+n+"}"]=e["{mediainfo."+n+"}"]:t["{mediainfo."+n+"}"]=""}),["custom_fields","customFields"].forEach(function(n){Ak(s,t,n)}),t},Ek=function(s){var e={},t=s.replace(/{([^}=]+)=([^}]*)}/g,function(n,r,i){return e["{"+r+"}"]=i,"{"+r+"}"});return{defaults:e,modifiedString:t}},wk=function(s){return{"{player.id}":s.options_["data-player"]||s.id_,"{player.height}":s.currentHeight(),"{player.width}":s.currentWidth(),"{player.heightInt}":Math.round(s.currentHeight()),"{player.widthInt}":Math.round(s.currentWidth()),"{player.autoplay}":s.autoplay()?1:0,"{player.muted}":s.muted()?1:0,"{player.language}":s.language()||"","{mediainfo.id}":s.mediainfo?s.mediainfo.id:"","{mediainfo.name}":s.mediainfo?s.mediainfo.name:"","{mediainfo.duration}":s.mediainfo?s.mediainfo.duration:"","{player.duration}":s.duration(),"{player.durationInt}":Math.round(s.duration()),"{player.live}":s.duration()===1/0?1:0,"{player.pageUrl}":P.dom.isInFrame()?Y.referrer:I.location.href,"{playlistinfo.id}":s.playlistinfo?s.playlistinfo.id:"","{playlistinfo.name}":s.playlistinfo?s.playlistinfo.name:"","{timestamp}":new Date().getTime(),"{document.referrer}":Y.referrer,"{window.location.href}":I.location.href,"{random}":Math.floor(Math.random()*1e12)}},kk=function(s){var e={};return Object.keys(s).forEach(function(t){e["{tcf."+t+"}"]=s[t]}),e["{tcf.gdprAppliesInt}"]=s.gdprApplies?1:0,e},Ck=function(){return{"{usp.uspString}":Tk()}},Ik=function(s,e,t){var n=new RegExp("{pageVariable\\.([^}]+)}","g"),r={},i=(s.match(n)||[]).concat(Object.keys(t).filter(function(a){return n.test(a)&&s.includes(t[a])}));if(i)return i.forEach(function(a){for(var o=a,c=a.slice(14,-1),h=c.split("."),m=I,_,T=0;T<h.length;T++)if(T===h.length-1)_=m[h[T]];else if(m=m[h[T]],typeof m>"u")break;var S=typeof _;_===null?r[o]="null":_===void 0?e[o]?r[o]=e[o]:(P.log.warn('Page variable "'+c+'" not found'),r[o]=""):S!=="string"&&S!=="number"&&S!=="boolean"?(P.log.warn('Page variable "'+c+'" is not a supported type'),r[o]=""):r[o]=_}),r},jh=function(s,e,t,n,r){n===void 0&&(n={});for(var i in e){var a=n.hasOwnProperty(i)?n[i]:i;if(a.startsWith("r:"))try{var o=new RegExp(a.slice(2),"g");s=s.replace(o,Fh(e[i],t))}catch(c){r.ads.error({errorType:yn.AdsMacroReplacementFailed,macro:i,error:c}),P.log.warn('Unable to replace macro with regex "'+a+'". The provided regex may be invalid.')}else s=s.split(a).join(Fh(e[i],t))}return s};function xk(s,e,t){e===void 0&&(e=!1),t===void 0&&(t={});var n=t.disableDefaultMacros||!1,r=t.macroNameOverrides||{};delete t.disableDefaultMacros,delete t.macroNameOverrides;var i=t;if(n)return jh(s,i,e,r);var a=Ek(s),o=a.defaults,c=a.modifiedString;s=c,Zl(i,wk(this),Sk(this.mediainfo,o),kk(Kg),Ck(),Ik(s,o,r)),s=jh(s,i,e,r,this);for(var h in o)s=s.replace(h,o[h]);return s}var _n={};_n.processMetadataTracks=function(s,e){for(var t=s.textTracks(),n=function(i){i.kind==="metadata"&&(s.ads.cueTextTracks.setMetadataTrackMode(i),e(s,i))},r=0;r<t.length;r++)n(t[r]);t.addEventListener("addtrack",function(i){n(i.track)})};_n.setMetadataTrackMode=function(s){};_n.getSupportedAdCue=function(s,e){return e};_n.isSupportedAdCue=function(s,e){return!0};_n.getCueId=function(s,e){return e.id};var Lk=function(s,e){return e!==void 0&&s.ads.includedCues[e]},Pk=function(s,e){e!==void 0&&e!==""&&(s.ads.includedCues[e]=!0)};_n.processAdTrack=function(s,e,t,n){s.ads.includedCues={};for(var r=0;r<e.length;r++){var i=e[r],a=this.getSupportedAdCue(s,i);if(!this.isSupportedAdCue(s,i)){P.log.warn("Skipping as this is not a supported ad cue.",i);return}var o=this.getCueId(s,i),c=i.startTime;if(Lk(s,o)){P.log("Skipping ad already seen with ID "+o);return}n&&n(s,a,o,c),t(s,a,o,c),Pk(s,o)}};function Rk(s,e){e&&P.log("Using cancelContentPlay to block content playback"),s.on("play",Dk)}function Dk(){this.ads._shouldBlockPlay!==!1&&(this.paused()||(this.ads.debug("Playback was canceled by cancelContentPlay"),this.pause()),this.ads._cancelledPlay=!0)}var gr={},an=P;gr.isMiddlewareMediatorSupported=function(){return an.browser.IS_IOS||an.browser.IS_ANDROID?!1:!!(an.use&&an.middleware&&an.middleware.TERMINATOR)};gr.playMiddleware=function(s){return{setSource:function(e,t){t(null,e)},callPlay:function(){if(s.ads&&s.ads._shouldBlockPlay===!0)return s.ads.debug("Using playMiddleware to block content playback"),s.ads._playBlocked=!0,an.middleware.TERMINATOR},play:function(e,t){s.ads&&s.ads._playBlocked&&e?(s.ads.debug("Play call to Tech was terminated."),s.trigger("play"),s.addClass("vjs-has-started"),s.ads._playBlocked=!1):t&&t.catch&&t.catch(function(n){n.name==="NotAllowedError"&&!P.browser.IS_SAFARI&&s.trigger("pause")})}}};gr.testHook=function(s){an=s};var Nk=gr.playMiddleware,Ok=gr.isMiddlewareMediatorSupported,Mk=function(){if(P.getPlugin)return!!P.getPlugin("ads");var s=P.getComponent("Player");return!!(s&&s.prototype.ads)};function Uk(s){if(Mk())return!1;var e=P.registerPlugin||P.plugin;return e("ads",s),Ok()&&!P.usingContribAdsMiddleware_&&(P.use("*",Nk),P.usingContribAdsMiddleware_=!0,P.log.debug("Play middleware has been registered with videojs")),!0}var Bk={src:"data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAxJtZGF03ABMYXZjNjEuMy4xMDAAQiAIwRg4AAACrgYF//+q3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2NCByMzEwOCAzMWUxOWY5IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMyAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MzoweDExMyBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MSBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0zIGJfcHlyYW1pZD0yIGJfYWRhcHQ9MSBiX2JpYXM9MCBkaXJlY3Q9MSB3ZWlnaHRiPTEgb3Blbl9nb3A9MCB3ZWlnaHRwPTIga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAAn//71sXwKaunqigzoMi7hlyTJrrYi4m0AwABFxzcqWKGahTaoBcQAAMWK4AlcFlIICBeldSEQBGCMHAAABVNtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAIgABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAACQXRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAIgAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAABQAAAAPAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAACIAAAAAAAEAAAAAAbltZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAADwAAAACAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAFkbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABJHN0YmwAAADAc3RzZAAAAAAAAAABAAAAsGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABQADwAEgAAABIAAAAAAAAAAEUTGF2YzYxLjMuMTAwIGxpYngyNjQAAAAAAAAAAAAAAAAY//8AAAA2YXZjQwFkAA3/4QAZZ2QADazZQUH7ARAAAAMAEAAAAwPA8UKZYAEABmjr48siwP34+AAAAAAQcGFzcAAAAAEAAAABAAAAFGJ0cnQAAAAAAALAEAACwBAAAAAYc3R0cwAAAAAAAAABAAAAAQAAAgAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAC7wAAAAEAAAAUc3RjbwAAAAAAAAABAAAARQAAAj10cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAABgAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAAXAAAEAAABAAAAAAG1bWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAAACABVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAABYG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABJHN0YmwAAAB+c3RzZAAAAAAAAAABAAAAbm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAH0AAAAEisFgICABRIQVuUABoCAgAECAAAAFGJ0cnQAAAAAAAH0AAAAEisAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAAVAAAABgAAABhzdGNvAAAAAAAAAAIAAAAwAAADNAAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAAACAAAAAQAAAGF1ZHRhAAAAWW1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALGlsc3QAAAAkqXRvbwAAABxkYXRhAAAAAQAAAABMYXZmNjEuMS4xMDA=",type:"video/mp4"},ce=function(){function s(){}return s.getState=function(e){if(e&&s.states_&&s.states_[e])return s.states_[e]},s.registerState=function(e,t){if(typeof e!="string"||!e)throw new Error('Illegal state name, "'+e+'"; must be a non-empty string.');return s.states_||(s.states_={}),s.states_[e]=t,t},s}(),ld=function(){s._getName=function(){return"Anonymous State"};function s(t){this.player=t}var e=s.prototype;return e.transitionTo=function(t){var n=this.player;this.cleanup(n);var r=new t(n);n.ads._state=r,n.ads.debug(this.constructor._getName()+" -> "+r.constructor._getName());for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];r.init.apply(r,[n].concat(a))},e.init=function(){},e.cleanup=function(){},e.onPlay=function(){},e.onPlaying=function(){},e.onEnded=function(){},e.onAdEnded=function(){},e.onAdsReady=function(){P.log.warn("Unexpected adsready event")},e.onAdsError=function(){},e.onAdsCanceled=function(){},e.onAdTimeout=function(){},e.onAdStarted=function(){},e.onAdSkipped=function(){},e.onContentChanged=function(){},e.onContentResumed=function(){},e.onReadyForPostroll=function(){P.log.warn("Unexpected readyforpostroll event")},e.onNoPreroll=function(){},e.onNoPostroll=function(){},e.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.endLinearAdMode=function(){P.log.warn("Unexpected endLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.skipLinearAdMode=function(){P.log.warn("Unexpected skipLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.isAdState=function(){throw new Error("isAdState unimplemented for "+this.constructor._getName())},e.isWaitingForAdBreak=function(){return!1},e.isContentResuming=function(){return!1},e.inAdBreak=function(){return!1},e.handleEvent=function(t){var n=this.player;t==="play"?this.onPlay(n):t==="adsready"?this.onAdsReady(n):t==="adserror"?this.onAdsError(n):t==="adscanceled"?this.onAdsCanceled(n):t==="adtimeout"?this.onAdTimeout(n):t==="ads-ad-started"?this.onAdStarted(n):t==="ads-ad-skipped"?this.onAdSkipped(n):t==="contentchanged"?this.onContentChanged(n):t==="contentresumed"?this.onContentResumed(n):t==="readyforpostroll"?this.onReadyForPostroll(n):t==="playing"?this.onPlaying(n):t==="ended"?this.onEnded(n):t==="nopreroll"?this.onNoPreroll(n):t==="nopostroll"?this.onNoPostroll(n):t==="adended"&&this.onAdEnded(n)},s}();ce.registerState("State",ld);var Fk=function(s){Rt(e,s);function e(n){var r;return r=s.call(this,n)||this,r.contentResuming=!1,r.waitingForAdBreak=!1,r}var t=e.prototype;return t.isAdState=function(){return!0},t.onPlaying=function(){var n=ce.getState("ContentPlayback");this.contentResuming&&this.transitionTo(n)},t.onContentResumed=function(){var n=ce.getState("ContentPlayback");this.contentResuming&&this.transitionTo(n)},t.isWaitingForAdBreak=function(){return this.waitingForAdBreak},t.isContentResuming=function(){return this.contentResuming},t.inAdBreak=function(){return this.player.ads._inLinearAdMode===!0},e}(ld);ce.registerState("AdState",Fk);var jk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}var t=e.prototype;return t.isAdState=function(){return!1},t.onContentChanged=function(n){var r=ce.getState("BeforePreroll"),i=ce.getState("Preroll");n.ads.debug("Received contentchanged event (ContentState)"),n.paused()?this.transitionTo(r):(this.transitionTo(i,!1),n.pause(),n.ads._pausedOnContentupdate=!0)},e}(ld);ce.registerState("ContentState",jk);var qk=ce.getState("ContentState"),Vk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"AdsDone"};var t=e.prototype;return t.init=function(n){n.ads._contentHasEnded=!0,n.trigger("ended")},t.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (AdsDone)")},e}(qk);ce.registerState("AdsDone",Vk);var _l;function $k(s){var e;P.browser.IS_IOS&&s.ads.isLive(s)&&s.seekable().length>0?e=s.currentTime()-s.seekable().end(0):e=s.currentTime();var t=s.$(".vjs-tech"),n=s.textTracks?s.textTracks():[],r=[],i={ended:s.ended(),currentSrc:s.currentSrc(),sources:s.currentSources(),src:s.tech_.src(),currentTime:e,type:s.currentType()};t&&(i.style=t.getAttribute("style"));for(var a=0;a<n.length;a++){var o=n[a];r.push({track:o,mode:o.mode}),o.mode="disabled"}return i.suppressedTracks=r,i}function Hk(s,e){var t=s.ads.snapshot;if(e===void 0&&(e=function(){}),s.ads.disableNextSnapshotRestore===!0){s.ads.disableNextSnapshotRestore=!1,delete s.ads.snapshot,e();return}var n=s.$(".vjs-tech"),r=20,i=t.suppressedTracks,a,o=function(){for(var _=0;_<i.length;_++)a=i[_],a.track.mode=a.mode},c=function(){var _;if(P.browser.IS_IOS&&s.ads.isLive(s)){if(t.currentTime<0&&(s.seekable().length>0?_=s.seekable().end(0)+t.currentTime:_=s.currentTime(),s.currentTime(_)),s.paused()){var T=s.play();T&&T.catch&&T.catch(function(w){P.log.warn("Play promise rejected in IOS snapshot resume",w)})}}else if(t.ended)s.currentTime(s.duration());else{s.currentTime(t.currentTime);var S=s.play();S&&S.catch&&S.catch(function(w){P.log.warn("Play promise rejected in snapshot resume",w)})}s.ads.shouldRemoveAutoplay_&&(s.autoplay(!1),s.ads.shouldRemoveAutoplay_=!1)},h=function _(){if(s.off("contentcanplay",_),_l&&s.clearTimeout(_l),n=s.el().querySelector(".vjs-tech"),n.readyState>1||n.seekable===void 0||n.seekable.length>0)return c();if(r--)s.setTimeout(_,50);else try{c()}catch(T){s.ads.error({errorType:yn.AdsResumeContentFailed,error:T}),P.log.warn("Failed to resume the content after an advertisement",T)}};if("style"in t&&n.setAttribute("style",t.style||""),s.ads.videoElementRecycled())s.one("resumeended",function(){delete s.ads.snapshot,e()}),s.one("contentloadedmetadata",o),P.browser.IS_IOS&&!s.autoplay()&&typeof s.techCall_=="function"&&(s.techCall_("setAutoplay",!0),s.ads.shouldRemoveAutoplay_=!0),s.src(t.sources),s.one("contentcanplay",h),_l=s.setTimeout(h,2e3);else{if(o(),!s.ended()){var m=s.play();m&&m.catch&&m.catch(function(_){P.log.warn("Play promise rejected in snapshot restore",_)})}delete s.ads.snapshot,e()}}function Wk(s){s.ads.debug("Starting ad break"),s.ads._inLinearAdMode=!0,s.trigger("adstart"),s.ads.shouldTakeSnapshots()&&(s.ads.snapshot=$k(s)),s.ads.shouldPlayContentBehindAd(s)&&!s.ads.settings.stitchedAds&&(s.ads.preAdVolume_=s.volume(),s.volume(0)),s.addClass("vjs-ad-playing"),s.hasClass("vjs-live")&&s.removeClass("vjs-live"),s.ads.removeNativePoster(),s.ads.preAdPlaybackRate_=s.playbackRate(),s.playbackRate(1),s.controlBar&&s.controlBar.playbackRateMenuButton&&s.controlBar.playbackRateMenuButton.playbackRateSupported&&!s.controlBar.playbackRateMenuButton.hasClass("vjs-hidden")?(s.controlBar.playbackRateMenuButton.hide(),s.ads.showPlaybackMenuOnAdEnd_=!0):s.ads.showPlaybackMenuOnAdEnd_=!1}function zk(s,e){s.ads.debug("Ending ad break"),e===void 0&&(e=function(){}),s.ads.adType=null,s.ads._inLinearAdMode=!1,s.trigger("adend"),s.removeClass("vjs-ad-playing"),s.ads.isLive(s)&&s.addClass("vjs-live"),s.ads.shouldTakeSnapshots()?Hk(s,e):(s.ads.preAdVolume_&&s.volume(s.ads.preAdVolume_),e()),s.playbackRate(s.ads.preAdPlaybackRate_),s.ads.showPlaybackMenuOnAdEnd_&&s.controlBar.playbackRateMenuButton.show()}var hs={start:Wk,end:zk},Gk=ce.getState("AdState"),Xk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Preroll"};var t=e.prototype;return t.init=function(n,r,i){if(this.waitingForAdBreak=!0,n.addClass("vjs-ad-loading"),i||n.ads.nopreroll_)return this.resumeAfterNoPreroll(n);var a=n.ads.settings.timeout;typeof n.ads.settings.prerollTimeout=="number"&&(a=n.ads.settings.prerollTimeout),this._timeout=n.setTimeout(function(){n.trigger("adtimeout")},a),r?this.handleAdsReady():this.adsReady=!1},t.onAdsReady=function(n){n.ads.inAdBreak()?P.log.warn("Unexpected adsready event (Preroll)"):(n.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},t.handleAdsReady=function(){this.adsReady=!0,this.readyForPreroll()},t.afterLoadStart=function(n){var r=this.player;r.ads._hasThereBeenALoadStartDuringPlayerLife?n():(r.ads.debug("Waiting for loadstart..."),r.one("loadstart",function(){r.ads.debug("Received loadstart event"),n()}))},t.noPreroll=function(){var n=this;this.afterLoadStart(function(){n.player.ads.debug("Skipping prerolls due to nopreroll event (Preroll)"),n.resumeAfterNoPreroll(n.player)})},t.readyForPreroll=function(){var n=this.player;this.afterLoadStart(function(){n.ads.debug("Triggered readyforpreroll event (Preroll)"),n.trigger("readyforpreroll")})},t.onAdsCanceled=function(n){var r=this;n.ads.debug("adscanceled (Preroll)"),this.afterLoadStart(function(){r.resumeAfterNoPreroll(n)})},t.onAdsError=function(n){var r=this;P.log("adserror (Preroll)"),n.ads.error({errorType:yn.AdsPrerollError}),this.inAdBreak()?n.ads.endLinearAdMode():this.afterLoadStart(function(){r.resumeAfterNoPreroll(n)})},t.startLinearAdMode=function(){var n=this.player;this.adsReady&&!n.ads.inAdBreak()&&!this.isContentResuming()?(this.clearTimeout(n),n.ads.adType="preroll",this.waitingForAdBreak=!1,hs.start(n),n.ads._shouldBlockPlay=!1):P.log.warn("Unexpected startLinearAdMode invocation (Preroll)")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(n.removeClass("vjs-ad-loading"),n.addClass("vjs-ad-content-resuming"),this.contentResuming=!0,hs.end(n))},t.skipLinearAdMode=function(){var n=this,r=this.player;r.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){r.trigger("adskip"),r.ads.debug("skipLinearAdMode (Preroll)"),n.resumeAfterNoPreroll(r)})},t.onAdTimeout=function(n){var r=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (Preroll)"),r.resumeAfterNoPreroll(n)})},t.onNoPreroll=function(n){n.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected nopreroll event (Preroll)"):this.noPreroll()},t.resumeAfterNoPreroll=function(n){if(this.contentResuming=!0,n.ads._shouldBlockPlay=!1,this.cleanupPartial(n),n.ads._playRequested||n.ads._pausedOnContentupdate)if(n.paused()){n.ads.debug("resumeAfterNoPreroll: attempting to resume playback (Preroll)");var r=n.play();r&&r.then&&r.then(null,function(i){})}else n.ads.debug("resumeAfterNoPreroll: already playing (Preroll)"),n.trigger("play"),n.trigger("playing")},t.cleanup=function(n){n.ads._hasThereBeenALoadStartDuringPlayerLife||P.log.warn("Leaving Preroll state before loadstart event can cause issues."),this.cleanupPartial(n)},t.cleanupPartial=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming"),this.clearTimeout(n)},t.clearTimeout=function(n){n.clearTimeout(this._timeout),this._timeout=null},e}(Gk);ce.registerState("Preroll",Xk);var Yk=ce.getState("ContentState"),Kk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"BeforePreroll"};var t=e.prototype;return t.init=function(n){this.adsReady=!1,this.shouldResumeToContent=!1,n.ads._shouldBlockPlay=n.ads.settings.allowVjsAutoplay?!n.autoplay():!0},t.onAdsReady=function(n){n.ads.debug("Received adsready event (BeforePreroll)"),this.adsReady=!0},t.onPlay=function(n){var r=ce.getState("Preroll");n.ads.debug("Received play event (BeforePreroll)"),this.transitionTo(r,this.adsReady,this.shouldResumeToContent)},t.onAdsCanceled=function(n){n.ads.debug("adscanceled (BeforePreroll)"),this.shouldResumeToContent=!0},t.onAdsError=function(){this.player.ads.debug("adserror (BeforePreroll)"),this.player.ads.error({errorType:yn.AdsBeforePrerollError}),this.shouldResumeToContent=!0},t.onNoPreroll=function(){this.player.ads.debug("Skipping prerolls due to nopreroll event (BeforePreroll)"),this.shouldResumeToContent=!0},t.skipLinearAdMode=function(){var n=this.player;n.trigger("adskip"),n.ads.debug("skipLinearAdMode (BeforePreroll)"),this.shouldResumeToContent=!0},t.onContentChanged=function(){this.init(this.player)},e}(Yk);ce.registerState("BeforePreroll",Kk);var Qk=ce.getState("AdState"),Zk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Midroll"};var t=e.prototype;return t.init=function(n){n.ads.adType="midroll",hs.start(n),n.addClass("vjs-ad-loading")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(this.contentResuming=!0,n.addClass("vjs-ad-content-resuming"),n.removeClass("vjs-ad-loading"),hs.end(n))},t.onAdsError=function(n){n.ads.error({errorType:yn.AdsMidrollError}),this.inAdBreak()&&n.ads.endLinearAdMode()},t.cleanup=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming")},e}(Qk);ce.registerState("Midroll",Zk);var Jk=ce.getState("AdState"),eC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Postroll"};var t=e.prototype;return t.init=function(n){if(this.waitingForAdBreak=!0,n.ads._contentEnding=!0,n.ads.nopostroll_){this.resumeContent(n);var r=ce.getState("AdsDone");this.transitionTo(r)}else{n.addClass("vjs-ad-loading");var i=n.ads.settings.timeout;typeof n.ads.settings.postrollTimeout=="number"&&(i=n.ads.settings.postrollTimeout),this._postrollTimeout=n.setTimeout(function(){n.trigger("adtimeout")},i)}},t.startLinearAdMode=function(){var n=this.player;!n.ads.inAdBreak()&&!this.isContentResuming()?(n.ads.adType="postroll",n.clearTimeout(this._postrollTimeout),this.waitingForAdBreak=!1,hs.start(n)):P.log.warn("Unexpected startLinearAdMode invocation (Postroll)")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this,r=this.player,i=ce.getState("AdsDone");this.inAdBreak()&&(r.removeClass("vjs-ad-loading"),this.resumeContent(r),hs.end(r,function(){n.transitionTo(i)}))},t.skipLinearAdMode=function(){var n=this.player;n.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected skipLinearAdMode invocation"):(n.ads.debug("Postroll abort (skipLinearAdMode)"),n.trigger("adskip"),this.abort(n))},t.onAdTimeout=function(n){n.ads.debug("Postroll abort (adtimeout)"),this.abort(n)},t.onAdsError=function(n){n.ads.debug("Postroll abort (adserror)"),n.ads.error({errorType:yn.AdsPostrollError}),n.ads.inAdBreak()?n.ads.endLinearAdMode():this.abort(n)},t.onContentChanged=function(n){if(this.isContentResuming()){var r=ce.getState("BeforePreroll");this.transitionTo(r)}else if(!this.inAdBreak()){var i=ce.getState("Preroll");this.transitionTo(i)}},t.onNoPostroll=function(n){!this.isContentResuming()&&!this.inAdBreak()?this.abort(n):P.log.warn("Unexpected nopostroll event (Postroll)")},t.resumeContent=function(n){this.contentResuming=!0,n.addClass("vjs-ad-content-resuming")},t.abort=function(n){var r=ce.getState("AdsDone");this.resumeContent(n),n.removeClass("vjs-ad-loading"),this.transitionTo(r)},t.cleanup=function(n){n.removeClass("vjs-ad-content-resuming"),n.clearTimeout(this._postrollTimeout),n.ads._contentEnding=!1},e}(Jk);ce.registerState("Postroll",eC);var tC=ce.getState("ContentState"),sC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"ContentPlayback"};var t=e.prototype;return t.init=function(n){n.ads._shouldBlockPlay=!1},t.onAdsReady=function(n){n.ads.debug("Received adsready event (ContentPlayback)"),n.ads.nopreroll_||(n.ads.debug("Triggered readyforpreroll event (ContentPlayback)"),n.trigger("readyforpreroll"))},t.onReadyForPostroll=function(n){var r=ce.getState("Postroll");n.ads.debug("Received readyforpostroll event"),this.transitionTo(r)},t.startLinearAdMode=function(){var n=ce.getState("Midroll");this.transitionTo(n)},e}(tC);ce.registerState("ContentPlayback",sC);var nC=ce.getState("ContentState"),rC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"StitchedContentPlayback"};var t=e.prototype;return t.init=function(){this.player.ads._shouldBlockPlay=!1},t.onContentChanged=function(){this.player.ads.debug("Received contentchanged event ("+this.constructor._getName()+")")},t.startLinearAdMode=function(){var n=ce.getState("StitchedAdRoll");this.transitionTo(n)},e}(nC);ce.registerState("StitchedContentPlayback",rC);var iC=ce.getState("AdState"),aC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"StitchedAdRoll"};var t=e.prototype;return t.init=function(){this.waitingForAdBreak=!1,this.contentResuming=!1,this.player.ads.adType="stitched",hs.start(this.player)},t.onPlaying=function(){},t.onContentResumed=function(){},t.onAdEnded=function(){this.endLinearAdMode(),this.player.trigger("ended")},t.endLinearAdMode=function(){var n=ce.getState("StitchedContentPlayback");hs.end(this.player),this.transitionTo(n)},e}(iC);ce.registerState("StitchedAdRoll",aC);var oC=ce.getState("AdState"),lC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamPending"};var t=e.prototype;return t.init=function(n){this.adsReady=!1},t.onPlay=function(n){var r=ce.getState("OutstreamPlayback");n.ads.debug("Received play event (OutstreamPending)"),this.transitionTo(r,this.adsReady)},t.onAdsReady=function(n){n.ads.debug("Received adsready event (OutstreamPending)"),this.adsReady=!0},t.onAdsError=function(){this.player.ads.debug("adserror (OutstreamPending)"),this.adsReady=!1},e}(oC);ce.registerState("OutstreamPending",lC);var cC=ce.getState("AdState"),dC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamPlayback"};var t=e.prototype;return t.init=function(n,r){n.addClass("vjs-ad-loading"),r?this.handleAdsReady():this.abort(n)},t.onAdsReady=function(n){n.ads.inAdBreak()?P.log.warn("Unexpected adsready event (Preroll)"):(n.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},t.abort=function(n){var r=ce.getState("OutstreamDone");n.removeClass("vjs-ad-loading"),this.transitionTo(r)},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.handleAdsReady=function(){this.adsReady=!0,this.readyForOutstreamPlayback()},t.readyForOutstreamPlayback=function(){var n=this.player;this.afterLoadStart(function(){n.trigger("readyforoutstream")})},t.startLinearAdMode=function(){var n=this.player;this.adsReady&&!n.ads.inAdBreak()&&hs.start(n)},t.cleanup=function(n){n.ads._hasThereBeenALoadStartDuringPlayerLife||P.log.warn("Leaving OutstreamPlayback state before loadstart event can cause issues."),this.cleanupPartial(n)},t.cleanupPartial=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming"),this.clearTimeout(n)},t.clearTimeout=function(n){n.clearTimeout(this._timeout),this._timeout=null},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.onAdsError=function(n){var r=this;P.log("adserror (OutstreamPlayback)"),this.inAdBreak()?n.ads.endLinearAdMode():this.afterLoadStart(function(){r.abort(n)})},t.onAdTimeout=function(n){var r=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (OutstreamPlayback)"),r.abort(n)})},t.onAdsCanceled=function(n){var r=this;n.ads.debug("adscanceled (OutstreamPlaybac)"),this.afterLoadStart(function(){r.abort(n)})},t.endLinearAdMode=function(){var n=this;if(this.inAdBreak()){this.player.removeClass("vjs-ad-loading");var r=ce.getState("OutstreamDone");hs.end(this.player,function(){n.transitionTo(r)})}},t.afterLoadStart=function(n){var r=this.player;r.ads._hasThereBeenALoadStartDuringPlayerLife?n():(r.ads.debug("Waiting for loadstart..."),r.one("loadstart",function(){r.ads.debug("Received loadstart event"),n()}))},t.skipLinearAdMode=function(){var n=this,r=this.player,i=ce.getState("OutstreamDone");this.inAdBreak()?P.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){r.trigger("adskip"),r.ads.debug("skipLinearAdMode (OutstreamPlayback)"),n.transitionTo(i)})},e}(cC);ce.registerState("OutstreamPlayback",dC);var uC=ce.getState("AdState"),hC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamDone"};var t=e.prototype;return t.init=function(n){n.trigger("ended")},t.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (OutstreamDone)")},e}(uC);ce.registerState("OutstreamDone",hC);var pC=gr.isMiddlewareMediatorSupported,mC=P.getTech("Html5").Events,fC={timeout:5e3,prerollTimeout:void 0,postrollTimeout:void 0,debug:!1,stitchedAds:!1,contentIsLive:void 0,liveCuePoints:!0,allowVjsAutoplay:P.options.normalizeAutoplay||!1},cd=function(s){var e=this,t=P.obj.merge(fC,s),n=[];mC.concat(["firstplay","loadedalldata"]).forEach(function(a){n.indexOf(a)===-1&&n.push(a)}),e.on(n,yk),pC()||Rk(e,t.debug),e.setTimeout(function(){!e.ads._hasThereBeenALoadStartDuringPlayerLife&&e.src()!==""&&P.log.error("videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html")},5e3),e.on("ended",function(){e.hasClass("vjs-has-started")||e.addClass("vjs-has-started")}),e.on("contenttimeupdate",function(){e.removeClass("vjs-waiting")}),e.on(["addurationchange","adcanplay"],function(){if(!e.ads.settings.stitchedAds&&!e.hasStarted()&&!(e.ads.snapshot&&e.currentSrc()===e.ads.snapshot.currentSrc)&&e.ads.inAdBreak()){var a=e.play();a&&a.catch&&a.catch(function(o){P.log.warn("Play promise rejected when playing ad",o)})}}),e.on("nopreroll",function(){e.ads.debug("Received nopreroll event"),e.ads.nopreroll_=!0}),e.on("nopostroll",function(){e.ads.debug("Received nopostroll event"),e.ads.nopostroll_=!0}),e.on("playing",function(){e.ads._cancelledPlay=!1,e.ads._pausedOnContentupdate=!1}),e.on("play",function(){e.ads._playRequested=!0}),e.one("loadstart",function(){e.ads._hasThereBeenALoadStartDuringPlayerLife=!0}),e.on("loadeddata",function(){e.ads._hasThereBeenALoadedData=!0}),e.on("loadedmetadata",function(){e.ads._hasThereBeenALoadedMetaData=!0}),e.ads=hk(e),e.ads.settings=t,t.stitchedAds=!!t.stitchedAds,t.playerMode==="outstream"?(e.src(Bk),e.ads._state=new(ce.getState("OutstreamPending"))(e)):t.stitchedAds?e.ads._state=new(ce.getState("StitchedContentPlayback"))(e):e.ads._state=new(ce.getState("BeforePreroll"))(e),e.ads._state.init(e),e.ads.cueTextTracks=_n,e.ads.adMacroReplacement=xk.bind(e),_k(e),e.on("contentchanged",e.ads.reset);var r=function(){return!e.ads.shouldPlayContentBehindAd(e)&&e.ads.inAdBreak()&&e.tech_.featuresNativeTextTracks&&P.browser.IS_IOS&&!Array.isArray(e.textTracks())},i=function(){var a=e.textTracks();if(r())for(var o=0;o<a.length;o++){var c=a[o];c.mode==="showing"&&(c.mode="disabled")}};e.ready(function(){e.textTracks().addEventListener("change",i)}),e.on(["play","playing","ended","adsready","adscanceled","adskip","adserror","adtimeout","adended","ads-ad-started","ads-ad-skipped","contentchanged","dispose","contentresumed","readyforpostroll","nopreroll","nopostroll"],function(a){e.ads._state.handleEvent(a.type)}),e.on("dispose",function(){e.ads.reset(),e.textTracks().removeEventListener("change",i)}),Uh(),Bh(function(){}),e.ads.listenToTcf=Uh,e.ads.updateUsPrivacyString=function(a){return Bh(a)}};cd.Error=yn;cd.VERSION=Xg;Uk(cd);function dd(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,adId:s.adId||null,sequence:s.sequence||null,apiFramework:s.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const gC=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function qh(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=[],r=Zg(s);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=ty(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const i in e)e[i]=ey(e[i]);for(const i in r){const a=r[i];typeof a=="string"&&n.push(Qg(a,e))}return n}function Qg(s,e){const t=(s=Vh(s,e)).match(/[^[\]]+(?=])/g);if(!t)return s;let n=t.filter(r=>gC.indexOf(r)>-1);return n.length===0?s:(n=n.reduce((r,i)=>(r[i]=-1,r),{}),Vh(s,n))}function Vh(s,e){let t=s;for(const n in e){const r=e[n];t=t.replace(new RegExp("(?:\\[|%%)(".concat(n,")(?:\\]|%%)"),"g"),r)}return t}function Zg(s){return Array.isArray(s)?s.map(e=>e&&e.hasOwnProperty("url")?e.url:e):s}function $h(s){return/^(https?:\/\/|\/\/)/.test(s)}function Hh(s,e){for(let t=0;t<e.length;t++)if(Jg(e[t],s))return!0;return!1}function Jg(s,e){if(s&&e){const t=Object.getOwnPropertyNames(s),n=Object.getOwnPropertyNames(e);return t.length===n.length&&s.id===e.id&&s.url===e.url}return!1}function ey(s){return encodeURIComponent(s).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function ty(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return s.toString().padStart(e,"0")}const Ie={track:function(s,e,t){qh(s,e,t).forEach(n=>{typeof window<"u"&&window!==null&&(new Image().src=n)})},resolveURLTemplates:qh,extractURLsFromTemplates:Zg,filterUrlTemplates:function(s){return s.reduce((e,t)=>{const n=t.url||t;return $h(n)?e.validUrls.push(n):e.invalidUrls.push(n),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Hh,isTemplateObjectEqual:Jg,encodeURIComponentRFC3986:ey,replaceUrlMacros:Qg,isNumeric:function(s){return!isNaN(parseFloat(s))&&isFinite(s)},flatten:function s(e){return e.reduce((t,n)=>t.concat(Array.isArray(n)?s(n):n),[])},joinArrayOfUniqueTemplateObjs:function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(s)?s:[],n=Array.isArray(e)?e:[];return t.concat(n).reduce((r,i)=>(Hh(i,r)||r.push(i),r),[])},isValidTimeValue:function(s){return Number.isFinite(s)&&s>=-2},addLeadingZeros:ty,isValidUrl:$h,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(s){return typeof s!="object"?s:JSON.stringify(s)}};function Wh(s){return["true","TRUE","True","1"].includes(s)}function yC(s){if(s==null)return-1;if(Ie.isNumeric(s))return parseInt(s);const e=s.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let n=parseInt(t[0]);t.length===2&&(n+=parseFloat("0.".concat(t[1])));const r=parseInt(60*e[1]),i=parseInt(60*e[0]*60);return isNaN(i)||isNaN(r)||isNaN(n)||r>3600||n>60?-1:i+r+n}const q={childByName:function(s,e){return Array.from(s.childNodes).find(t=>t.nodeName===e)},childrenByName:function(s,e){return Array.from(s.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(s,e){if(!e)return s;if(s.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(s)}if(!s.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(s)}return s},parseBoolean:Wh,parseNodeText:function(s){return s&&(s.textContent||s.text||"").trim()},copyNodeAttribute:function(s,e,t){const n=e.getAttribute(s);n&&t.setAttribute(s,n)},parseAttributes:function(s){return Array.from(s.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:yC,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(s=>!parseInt(s.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(s=>parseInt(s.sequence,10)).sort((s,e)=>s.sequence-e.sequence)},assignAttributes:function(s,e){s&&Array.from(s).forEach(t=>{let{nodeName:n,nodeValue:r}=t;if(n&&r&&e.hasOwnProperty(n)){let i=r;typeof e[n]=="boolean"&&(i=Wh(i)),e[n]=i}})},mergeWrapperAdData:function(s,e){var t;s.errorURLTemplates=e.errorURLTemplates.concat(s.errorURLTemplates),s.impressionURLTemplates=e.impressionURLTemplates.concat(s.impressionURLTemplates),s.extensions=e.extensions.concat(s.extensions),e.viewableImpression.length>0&&(s.viewableImpression=[...s.viewableImpression,...e.viewableImpression]),s.followAdditionalWrappers=e.followAdditionalWrappers,s.allowMultipleAds=e.allowMultipleAds,s.fallbackOnNoAd=e.fallbackOnNoAd;const n=(e.creatives||[]).filter(o=>o&&o.type==="companion"),r=n.reduce((o,c)=>((c.variations||[]).forEach(h=>{(h.companionClickTrackingURLTemplates||[]).forEach(m=>{Ie.containsTemplateObject(m,o)||o.push(m)})}),o),[]);s.creatives=n.concat(s.creatives);const i=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(s.creatives.forEach(o=>{if(e.trackingEvents&&e.trackingEvents[o.type])for(const c in e.trackingEvents[o.type]){const h=e.trackingEvents[o.type][c];Array.isArray(o.trackingEvents[c])||(o.trackingEvents[c]=[]),o.trackingEvents[c]=o.trackingEvents[c].concat(h)}o.type==="linear"&&(i&&(o.videoClickTrackingURLTemplates=o.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(o.videoCustomClickURLTemplates=o.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||o.videoClickThroughURLTemplate!==null&&o.videoClickThroughURLTemplate!==void 0||(o.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),o.type==="companion"&&r.length&&(o.variations||[]).forEach(c=>{c.companionClickTrackingURLTemplates=Ie.joinArrayOfUniqueTemplateObjs(c.companionClickTrackingURLTemplates,r)})}),e.adVerifications&&(s.adVerifications=s.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(s.blockedAdCategories=s.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const o=e.creatives.filter(c=>{var h;return((h=c.icons)===null||h===void 0?void 0:h.length)&&!c.mediaFiles.length});o.length&&(s.creatives=s.creatives.concat(o))}}};function _C(s,e){const t=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:r,adId:i,sequence:a,apiFramework:o}=dd(n);return{id:r,adId:i,sequence:a,apiFramework:o,type:"companion",required:null,variations:[]}}(e);return t.required=s.getAttribute("required")||null,t.variations=q.childrenByName(s,"Companion").map(n=>{const r=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:o.id||null,adType:"companionAd",width:o.width||0,height:o.height||0,assetWidth:o.assetWidth||null,assetHeight:o.assetHeight||null,expandedWidth:o.expandedWidth||null,expandedHeight:o.expandedHeight||null,apiFramework:o.apiFramework||null,adSlotId:o.adSlotId||null,pxratio:o.pxratio||"1",renderingMode:o.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(q.parseAttributes(n));r.htmlResources=q.childrenByName(n,"HTMLResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat(h):o},[]),r.iframeResources=q.childrenByName(n,"IFrameResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat(h):o},[]),r.staticResources=q.childrenByName(n,"StaticResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat({url:h,creativeType:c.getAttribute("creativeType")||null}):o},[]),r.altText=q.parseNodeText(q.childByName(n,"AltText"))||null;const i=q.childByName(n,"TrackingEvents");i&&q.childrenByName(i,"Tracking").forEach(o=>{const c=o.getAttribute("event"),h=q.parseNodeText(o);c&&h&&(Array.isArray(r.trackingEvents[c])||(r.trackingEvents[c]=[]),r.trackingEvents[c].push(h))}),r.companionClickTrackingURLTemplates=q.childrenByName(n,"CompanionClickTracking").map(o=>({id:o.getAttribute("id")||null,url:q.parseNodeText(o)})),r.companionClickThroughURLTemplate=q.parseNodeText(q.childByName(n,"CompanionClickThrough"))||null;const a=q.childByName(n,"AdParameters");return a&&(r.adParameters={value:q.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),r}),t}function vC(s,e){let t;const n=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:h,adId:m,sequence:_,apiFramework:T}=dd(c);return{id:h,adId:m,sequence:_,apiFramework:T,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);n.duration=q.parseDuration(q.parseNodeText(q.childByName(s,"Duration")));const r=s.getAttribute("skipoffset");if(r==null)n.skipDelay=null;else if(r.charAt(r.length-1)==="%"&&n.duration!==-1){const c=parseInt(r,10);n.skipDelay=n.duration*(c/100)}else n.skipDelay=q.parseDuration(r);const i=q.childByName(s,"VideoClicks");if(i){const c=q.childByName(i,"ClickThrough");n.videoClickThroughURLTemplate=c?{id:c.getAttribute("id")||null,url:q.parseNodeText(c)}:null,q.childrenByName(i,"ClickTracking").forEach(h=>{n.videoClickTrackingURLTemplates.push({id:h.getAttribute("id")||null,url:q.parseNodeText(h)})}),q.childrenByName(i,"CustomClick").forEach(h=>{n.videoCustomClickURLTemplates.push({id:h.getAttribute("id")||null,url:q.parseNodeText(h)})})}const a=q.childByName(s,"AdParameters");a&&(n.adParameters={value:q.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),q.childrenByName(s,"TrackingEvents").forEach(c=>{q.childrenByName(c,"Tracking").forEach(h=>{let m=h.getAttribute("event");const _=q.parseNodeText(h);if(m&&_){if(m==="progress"){if(t=h.getAttribute("offset"),!t)return;m=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(q.parseDuration(t))}Array.isArray(n.trackingEvents[m])||(n.trackingEvents[m]=[]),n.trackingEvents[m].push(_)}})}),q.childrenByName(s,"MediaFiles").forEach(c=>{q.childrenByName(c,"MediaFile").forEach(S=>{n.mediaFiles.push(function(w){const b={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};b.id=w.getAttribute("id"),b.fileURL=q.parseNodeText(w),b.deliveryType=w.getAttribute("delivery"),b.codec=w.getAttribute("codec"),b.mimeType=w.getAttribute("type"),b.mediaType=w.getAttribute("mediaType")||"2D",b.apiFramework=w.getAttribute("apiFramework"),b.fileSize=parseInt(w.getAttribute("fileSize")||0),b.bitrate=parseInt(w.getAttribute("bitrate")||0),b.minBitrate=parseInt(w.getAttribute("minBitrate")||0),b.maxBitrate=parseInt(w.getAttribute("maxBitrate")||0),b.width=parseInt(w.getAttribute("width")||0),b.height=parseInt(w.getAttribute("height")||0);const R=w.getAttribute("scalable");R&&typeof R=="string"&&(b.scalable=q.parseBoolean(R));const L=w.getAttribute("maintainAspectRatio");return L&&typeof L=="string"&&(b.maintainAspectRatio=q.parseBoolean(L)),b}(S))});const h=q.childByName(c,"InteractiveCreativeFile");h&&(n.interactiveCreativeFile=function(S){const w=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:b.type||null,apiFramework:b.apiFramework||null,variableDuration:q.parseBoolean(b.variableDuration),fileURL:null}}(q.parseAttributes(S));return w.fileURL=q.parseNodeText(S),w}(h));const m=q.childByName(c,"ClosedCaptionFiles");m&&q.childrenByName(m,"ClosedCaptionFile").forEach(S=>{const w=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:b.type||null,language:b.language||null,fileURL:null}}(q.parseAttributes(S));w.fileURL=q.parseNodeText(S),n.closedCaptionFiles.push(w)});const _=q.childByName(c,"Mezzanine"),T=function(S,w){const b={};let R=!1;return w.forEach(L=>{S&&S.getAttribute(L)?b[L]=S.getAttribute(L):R=!0}),R?null:b}(_,["delivery","type","width","height"]);if(T){const S={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};S.id=_.getAttribute("id"),S.fileURL=q.parseNodeText(_),S.delivery=T.delivery,S.codec=_.getAttribute("codec"),S.type=T.type,S.width=parseInt(T.width,10),S.height=parseInt(T.height,10),S.fileSize=parseInt(_.getAttribute("fileSize"),10),S.mediaType=_.getAttribute("mediaType")||"2D",n.mezzanine=S}});const o=q.childByName(s,"Icons");return o&&q.childrenByName(o,"Icon").forEach(c=>{n.icons.push(function(h){const m={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[]};m.program=h.getAttribute("program"),m.height=parseInt(h.getAttribute("height")||0),m.width=parseInt(h.getAttribute("width")||0),m.xPosition=function(T){return["left","right"].indexOf(T)!==-1?T:parseInt(T||0)}(h.getAttribute("xPosition")),m.yPosition=function(T){return["top","bottom"].indexOf(T)!==-1?T:parseInt(T||0)}(h.getAttribute("yPosition")),m.apiFramework=h.getAttribute("apiFramework"),m.pxratio=h.getAttribute("pxratio")||"1",m.offset=q.parseDuration(h.getAttribute("offset")),m.duration=q.parseDuration(h.getAttribute("duration")),q.childrenByName(h,"HTMLResource").forEach(T=>{m.type=T.getAttribute("creativeType")||"text/html",m.htmlResource=q.parseNodeText(T)}),q.childrenByName(h,"IFrameResource").forEach(T=>{m.type=T.getAttribute("creativeType")||0,m.iframeResource=q.parseNodeText(T)}),q.childrenByName(h,"StaticResource").forEach(T=>{m.type=T.getAttribute("creativeType")||0,m.staticResource=q.parseNodeText(T)});const _=q.childByName(h,"IconClicks");if(_){m.iconClickThroughURLTemplate=q.parseNodeText(q.childByName(_,"IconClickThrough")),q.childrenByName(_,"IconClickTracking").forEach(S=>{m.iconClickTrackingURLTemplates.push({id:S.getAttribute("id")||null,url:q.parseNodeText(S)})});const T=q.childByName(_,"IconClickFallbackImages");T&&q.childrenByName(T,"IconClickFallbackImage").forEach(S=>{m.iconClickFallbackImages.push({url:q.parseNodeText(S)||null,width:S.getAttribute("width")||null,height:S.getAttribute("height")||null})})}return m.iconViewTrackingURLTemplate=q.parseNodeText(q.childByName(h,"IconViewTracking")),m}(c))}),n}function bC(s,e){const t=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:r,adId:i,sequence:a,apiFramework:o}=dd(n);return{id:r,adId:i,sequence:a,apiFramework:o,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return q.childrenByName(s,"TrackingEvents").forEach(n=>{let r,i;q.childrenByName(n,"Tracking").forEach(a=>{r=a.getAttribute("event"),i=q.parseNodeText(a),r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))})}),q.childrenByName(s,"NonLinear").forEach(n=>{const r={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};r.id=n.getAttribute("id")||null,r.width=n.getAttribute("width"),r.height=n.getAttribute("height"),r.expandedWidth=n.getAttribute("expandedWidth"),r.expandedHeight=n.getAttribute("expandedHeight"),r.scalable=q.parseBoolean(n.getAttribute("scalable")),r.maintainAspectRatio=q.parseBoolean(n.getAttribute("maintainAspectRatio")),r.minSuggestedDuration=q.parseDuration(n.getAttribute("minSuggestedDuration")),r.apiFramework=n.getAttribute("apiFramework"),q.childrenByName(n,"HTMLResource").forEach(a=>{r.type=a.getAttribute("creativeType")||"text/html",r.htmlResource=q.parseNodeText(a)}),q.childrenByName(n,"IFrameResource").forEach(a=>{r.type=a.getAttribute("creativeType")||0,r.iframeResource=q.parseNodeText(a)}),q.childrenByName(n,"StaticResource").forEach(a=>{r.type=a.getAttribute("creativeType")||0,r.staticResource=q.parseNodeText(a)});const i=q.childByName(n,"AdParameters");i&&(r.adParameters={value:q.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),r.nonlinearClickThroughURLTemplate=q.parseNodeText(q.childByName(n,"NonLinearClickThrough")),q.childrenByName(n,"NonLinearClickTracking").forEach(a=>{r.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:q.parseNodeText(a)})}),t.variations.push(r)}),t}function zh(s){const e=[];return s.forEach(t=>{const n=sy(t);n&&e.push(n)}),e}function sy(s){if(s.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=s.attributes,n=s.childNodes;if(e.name=s.nodeName,s.attributes){for(const i in t)if(t.hasOwnProperty(i)){const a=t[i];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const i in n)if(n.hasOwnProperty(i)){const a=sy(n[i]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const i=q.parseNodeText(s);i!==""&&(e.value=i),e.children=[]}return(r=e).value===null&&Object.keys(r.attributes).length===0&&r.children.length===0?null:e;var r}function TC(s){return s.getAttribute("AdID")||s.getAttribute("adID")||s.getAttribute("adId")||null}const ha={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Gh(s,e){if(!ha[s.nodeName]||!ha[s.nodeName].attributes)return;const t=ha[s.nodeName].attributes.filter(n=>!s.getAttribute(n));t.length>0&&pi({name:s.nodeName,parentName:s.parentNode.nodeName,attributes:t},e)}function Xh(s,e,t){const n=ha[s.nodeName],r=!t&&s.nodeName!=="Wrapper";if(!(!n||r)){if(n.subElements){const i=n.subElements.filter(a=>!q.childByName(s,a));i.length>0&&pi({name:s.nodeName,parentName:s.parentNode.nodeName,subElements:i},e)}!t||!n.oneOfinLineResources||n.oneOfinLineResources.some(i=>q.childByName(s,i))||pi({name:s.nodeName,parentName:s.parentNode.nodeName,oneOfResources:n.oneOfinLineResources},e)}}function Yh(s){return s.children&&s.children.length!==0}function pi(s,e){let{name:t,parentName:n,attributes:r,subElements:i,oneOfResources:a}=s,o="Element '".concat(t,"'");o+=r?" missing required attribute(s) '".concat(r.join(", "),"' "):i?" missing required sub element(s) '".concat(i.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:o,parentElement:n,specVersion:4.1})}const AC={verifyRequiredValues:function s(e,t,n){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(n=!0),Gh(e,t),Yh(e)){Xh(e,t,n);for(let r=0;r<e.children.length;r++)s(e.children[r],t,n)}else q.parseNodeText(e).length===0&&pi({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Yh,emitMissingValueWarning:pi,verifyRequiredAttributes:Gh,verifyRequiredSubElements:Xh};function SC(s,e){let{allowMultipleAds:t,followAdditionalWrappers:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=Array.from(s.childNodes).filter(i=>{const a=i.nodeName.toLowerCase();return a==="inline"||n!==!1&&a==="wrapper"});for(const i of r){if(q.copyNodeAttribute("id",s,i),q.copyNodeAttribute("sequence",s,i),q.copyNodeAttribute("adType",s,i),i.nodeName==="Wrapper")return{ad:wC(i,e),type:"WRAPPER"};if(i.nodeName==="InLine")return{ad:EC(i,e,{allowMultipleAds:t}),type:"INLINE"};const a=i.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(i.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function EC(s,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&s.getAttribute("sequence")?null:ny(s,e)}function ny(s,e){let t=[];e&&AC.verifyRequiredValues(s,e);const n=Array.from(s.childNodes),r=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,sequence:i.sequence||null,adType:i.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(q.parseAttributes(s));return n.forEach(i=>{switch(i.nodeName){case"Error":r.errorURLTemplates.push(q.parseNodeText(i));break;case"Impression":r.impressionURLTemplates.push({id:i.getAttribute("id")||null,url:q.parseNodeText(i)});break;case"Creatives":r.creatives=function(a){const o=[];return a.forEach(c=>{const h={id:c.getAttribute("id")||null,adId:TC(c),sequence:c.getAttribute("sequence")||null,apiFramework:c.getAttribute("apiFramework")||null},m=[];let _;q.childrenByName(c,"UniversalAdId").forEach(S=>{const w={idRegistry:S.getAttribute("idRegistry")||"unknown",value:q.parseNodeText(S)};m.push(w)});const T=q.childByName(c,"CreativeExtensions");T&&(_=zh(q.childrenByName(T,"CreativeExtension")));for(const S in c.childNodes){const w=c.childNodes[S];let b;switch(w.nodeName){case"Linear":b=vC(w,h);break;case"NonLinearAds":b=bC(w,h);break;case"CompanionAds":b=_C(w,h)}b&&(m&&(b.universalAdIds=m),_&&(b.creativeExtensions=_),o.push(b))}}),o}(q.childrenByName(i,"Creative"));break;case"Extensions":{const a=q.childrenByName(i,"Extension");r.extensions=zh(a),r.adVerifications.length||(t=function(o){let c=null,h=[];return o.some(m=>c=q.childByName(m,"AdVerifications")),c&&(h=Kh(q.childrenByName(c,"Verification"))),h}(a));break}case"AdVerifications":r.adVerifications=Kh(q.childrenByName(i,"Verification"));break;case"AdSystem":r.system={value:q.parseNodeText(i),version:i.getAttribute("version")||null};break;case"AdTitle":r.title=q.parseNodeText(i);break;case"AdServingId":r.adServingId=q.parseNodeText(i);break;case"Category":r.categories.push({authority:i.getAttribute("authority")||null,value:q.parseNodeText(i)});break;case"Expires":r.expires=parseInt(q.parseNodeText(i),10);break;case"ViewableImpression":r.viewableImpression.push(function(a){const o=(c,h)=>{const m=q.parseNodeText(h);return m&&c.push(m),c};return{id:a.getAttribute("id")||null,viewable:q.childrenByName(a,"Viewable").reduce(o,[]),notViewable:q.childrenByName(a,"NotViewable").reduce(o,[]),viewUndetermined:q.childrenByName(a,"ViewUndetermined").reduce(o,[])}}(i));break;case"Description":r.description=q.parseNodeText(i);break;case"Advertiser":r.advertiser={id:i.getAttribute("id")||null,value:q.parseNodeText(i)};break;case"Pricing":r.pricing={value:q.parseNodeText(i),model:i.getAttribute("model")||null,currency:i.getAttribute("currency")||null};break;case"Survey":r.survey={value:q.parseNodeText(i),type:i.getAttribute("type")||null};break;case"BlockedAdCategories":r.blockedAdCategories.push({authority:i.getAttribute("authority")||null,value:q.parseNodeText(i)})}}),t.length&&(r.adVerifications=r.adVerifications.concat(t)),r}function wC(s,e){const t=ny(s,e),n=s.getAttribute("followAdditionalWrappers"),r=s.getAttribute("allowMultipleAds"),i=s.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!n||q.parseBoolean(n),t.allowMultipleAds=!!r&&q.parseBoolean(r),t.fallbackOnNoAd=i?q.parseBoolean(i):null;let a=q.childByName(s,"VASTAdTagURI");if(a?t.nextWrapperURL=q.parseNodeText(a):(a=q.childByName(s,"VASTAdTagURL"),a&&(t.nextWrapperURL=q.parseNodeText(q.childByName(a,"URL")))),t.creatives.forEach(o=>{if(["linear","nonlinear"].includes(o.type)){if(o.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[o.type]||(t.trackingEvents[o.type]={});for(const c in o.trackingEvents){const h=o.trackingEvents[c];Array.isArray(t.trackingEvents[o.type][c])||(t.trackingEvents[o.type][c]=[]),h.forEach(m=>{t.trackingEvents[o.type][c].push(m)})}}o.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),o.videoClickTrackingURLTemplates.forEach(c=>{t.videoClickTrackingURLTemplates.push(c)})),o.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=o.videoClickThroughURLTemplate),o.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),o.videoCustomClickURLTemplates.forEach(c=>{t.videoCustomClickURLTemplates.push(c)}))}}),t.nextWrapperURL)return t}function Kh(s){const e=[];return s.forEach(t=>{const n={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},r=Array.from(t.childNodes);q.assignAttributes(t.attributes,n),r.forEach(a=>{let{nodeName:o,textContent:c,attributes:h}=a;switch(o){case"JavaScriptResource":case"ExecutableResource":n.resource=c.trim(),q.assignAttributes(h,n);break;case"VerificationParameters":n.parameters=c.trim()}});const i=q.childByName(t,"TrackingEvents");i&&q.childrenByName(i,"Tracking").forEach(a=>{const o=a.getAttribute("event"),c=q.parseNodeText(a);o&&c&&(Array.isArray(n.trackingEvents[o])||(n.trackingEvents[o]=[]),n.trackingEvents[o].push(c))}),e.push(n)}),e}class ry{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(n,r,i){const a={fired:!1,wrapFn:void 0};function o(){a.fired||(n.off(r,a.wrapFn),a.fired=!0,i.bind(n)(...arguments))}return a.wrapFn=o,o}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(n=>n.event!==e||n.handler!==t),this}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let i=!1;return this._handlers.forEach(a=>{a.event==="*"&&(i=!0,a.handler(e,...n)),a.event===e&&(i=!0,a.handler(...n))}),i}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,n)=>(n.event===e&&t.push(n.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let Qh=0,tc=0;const iy=(s,e)=>{!s||!e||s<=0||e<=0||(tc=(tc*Qh+8*s/e)/++Qh)},kC={ERRORCODE:900,extensions:[]},Zh="VAST response version not supported";class ay extends ry{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null}trackVastError(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];this.emit("VAST-error",Object.assign({},kC,t,...r)),Ie.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return tc}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.rootURL="",this.resetParsingStatus(),iy(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(this.remainingAds.length===0)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(n=>this.buildVASTResponse(n))}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(n=>this.buildVASTResponse(n))}buildVASTResponse(e){const t=function(n){let{ads:r,errorURLTemplates:i,version:a}=n;return{ads:r||[],errorURLTemplates:i||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:n=!1,url:r=null,wrapperDepth:i=0,allowMultipleAds:a,followAdditionalWrappers:o}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var c;this.emit("VAST-ad-parsed",{type:"ERROR",url:r,wrapperDepth:i});const T=(e==null||(c=e.documentElement)===null||c===void 0?void 0:c.nodeName)==="VideoAdServingTemplate";throw new Error(T?Zh:"Invalid VAST XMLDocument")}const h=[],m=e.documentElement.childNodes,_=e.documentElement.getAttribute("version");n&&_&&(this.vastVersion=_);for(const T in m){const S=m[T];if(S.nodeName==="Error"){const w=q.parseNodeText(S);n?this.rootErrorURLTemplates.push(w):this.errorURLTemplates.push(w)}else if(S.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&h.length>1)break;const w=SC(S,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:o});w.ad?(h.push(w.ad),this.emit("VAST-ad-parsed",{type:w.type,url:r,wrapperDepth:i,adIndex:h.length-1,vastVersion:_})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return h}parse(e){let{url:t=null,resolveAll:n=!0,wrapperSequence:r=null,previousUrl:i=null,wrapperDepth:a=0,isRootVAST:o=!1,followAdditionalWrappers:c,allowMultipleAds:h}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&o&&(h=!0);try{m=this.parseVastXml(e,{isRootVAST:o,url:t,wrapperDepth:a,allowMultipleAds:h,followAdditionalWrappers:c})}catch(_){return Promise.reject(_)}if(m.length===1&&r!=null&&(m[0].sequence=r),n===!1){const _=q.getSortedAdPods(m),T=q.getStandAloneAds(m);_.length?m=_:T.length&&(m=[T.shift()]),this.remainingAds=T}return this.resolveAds(m,{wrapperDepth:a,previousUrl:i,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:n,url:r}=arguments.length>1?arguments[1]:void 0;const i=[];return n=r,e.forEach(a=>{const o=this.resolveWrappers(a,t,n);i.push(o)}),Promise.all(i).then(a=>Ie.flatten(a))}resolveWrappers(e,t,n){const r={...e};return new Promise(i=>{var a;if(t++,!r.nextWrapperURL)return delete r.nextWrapperURL,i(r);if(!this.fetcher)return r.VASTAdTagURI=r.nextWrapperURL,delete r.nextWrapperURL,i(r);if(t>=this.maxWrapperDepth)return r.errorCode=302,delete r.nextWrapperURL,i(r);r.nextWrapperURL=q.resolveVastAdTagURI(r.nextWrapperURL,n);const o=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:r.allowMultipleAds,c=r.sequence;this.fetcher.fetchVAST({url:r.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(h=>this.parse(h,{url:r.nextWrapperURL,previousUrl:n,wrapperSequence:c,wrapperDepth:t,followAdditionalWrappers:r.followAdditionalWrappers,allowMultipleAds:o}).then(m=>{if(delete r.nextWrapperURL,m.length===0)return r.creatives=[],i(r);m.forEach(_=>{_&&q.mergeWrapperAdData(_,r)}),i(m)})).catch(h=>{r.errorCode=h.message===Zh?102:301,r.errorMessage=h.message,i(r)})})}completeWrapperResolving(e){if(e.ads.length===0)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const n=e.ads[t],r=!n.creatives.some(i=>{var a;return((a=i.mediaFiles)===null||a===void 0?void 0:a.length)>0});!n.errorCode&&!r||n.VASTAdTagURI||(this.trackVastError(n.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:n.errorCode||303},{ERRORMESSAGE:n.errorMessage||""},{extensions:n.extensions},{system:n.system}),e.ads.splice(t,1))}}}let ys=null;const CC={data:{},length:0,getItem(s){return this.data[s]},setItem(s,e){this.data[s]=e,this.length=Object.keys(this.data).length},removeItem(s){delete this.data[s],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class IC{constructor(){this.storage=this.initStorage()}initStorage(){if(ys)return ys;try{ys=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{ys=null}return ys&&!this.isStorageDisabled(ys)||(ys=CC,ys.clear()),ys}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch{return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const sc=12e4,xC={get:async function(s,e){try{const t=new AbortController,n=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||sc," ms (408)"))},e.timeout||sc),r=await fetch(s,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(n)}),i=function(a){return Ie.isBrowserEnvironment()&&window.location.protocol==="https:"&&a.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":a.status===200&&a.ok?null:"URLHandler: ".concat(a.statusText," (").concat(a.status,")")}(r);return i?{error:new Error(i),statusCode:r.status}:async function(a){const o=await a.text();let c;return c=Ie.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>HT)).DOMParser,{xml:c.parseFromString(o,"text/xml"),details:{byteLength:o.length,statusCode:a.status,rawXml:o}}}(r)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};class LC{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||xC,this.fetchingOptions={timeout:e.timeout||sc,withCredentials:!!e.withCredentials}}addURLTemplateFilter(e){typeof e=="function"&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:n,maxWrapperDepth:r,emitter:i,wrapperDepth:a=0,previousUrl:o=null,wrapperAd:c=null}=e;const h=Date.now();this.URLTemplateFilters.forEach(T=>{n=T(n)}),i("VAST-resolving",{url:n,previousUrl:o,wrapperDepth:a,maxWrapperDepth:r,timeout:this.fetchingOptions.timeout,wrapperAd:c});const m=await this.urlHandler.get(n,this.fetchingOptions),_=Math.round(Date.now()-h);if(i("VAST-resolved",{url:n,previousUrl:o,wrapperDepth:a,error:(m==null?void 0:m.error)||null,duration:_,statusCode:(m==null?void 0:m.statusCode)||null,...m==null?void 0:m.details}),iy(m==null||(t=m.details)===null||t===void 0?void 0:t.byteLength,_),m.error)throw new Error(m.error);return m.xml}}class PC{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new IC;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new LC,this.vastParser=new ay({fetcher:this.fetcher}),this.storage=n,this.lastSuccessfulAd===void 0&&(this.lastSuccessfulAd=0),this.totalCalls===void 0&&(this.totalCalls=0),this.totalCallsTimeout===void 0&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const n=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<n?(this.totalCalls=1,this.totalCallsTimeout=n+36e5):this.totalCalls++,new Promise((r,i)=>{if(this.cappingFreeLunch>=this.totalCalls)return i(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=n-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return i(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(o=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(o,t).then(c=>{const h=this.vastParser.buildVASTResponse(c);r(h)}))).catch(o=>i(o))})}}class Jh extends ry{constructor(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=n,this.variation=r,this.muted=i,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const a in this.creative.trackingEvents){const o=this.creative.trackingEvents[a];this.trackingEvents[a]=o.slice(0)}(function(a){return a.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ie.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!Ie.isValidTimeValue(e)||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});const r=this.skipDelay||-1;if(r===-1||this.skippable||(r>e?this.emit("skip-countdown",r-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let o=this.lastPercentage;o<i;o++)a.push("progress-".concat(o+1,"%"));a.push("progress-".concat(e));for(const o in this.quartiles)this.isQuartileReached(o,this.quartiles[o],e)&&(a.push(o),this._alreadyTriggeredQuartiles[o]=!0);this.lastPercentage=i}a.forEach(o=>{this.track(o,{macros:t,once:n})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,n){let r=!1;return t<=n&&!this._alreadyTriggeredQuartiles[e]&&(r=!0),r}setMuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setSkipDelay(e){Ie.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewable,e)}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.notViewable,e)}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewUndetermined,e)}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ie.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="string"&&typeof t=="boolean"?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const n=this.ad.adVerifications.find(i=>i.vendor===e);if(!n)throw new Error("No associated verification element found for vendor: ".concat(e));const r=n.trackingEvents;if(r&&r.verificationNotExecuted){const i=r.verificationNotExecuted;this.trackURLs(i,t),this.emit("verificationNotExecuted",{trackingURLTemplates:i})}}overlayViewDuration(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&typeof t=="object"?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}close(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==null&&typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const n=this.clickThroughURLTemplate||e,r={...t};if(n){this.progress&&(r.ADPLAYHEAD=this.progressFormatted());const i=Ie.resolveURLTemplates([n],r)[0];this.emit("clickthrough",i)}}trackProgressEvents(e,t,n){const r=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(i=>{let[a]=i;return a.startsWith("progress-")}).map(i=>{let[a,o]=i;return{name:a,time:parseFloat(a.split("-")[1]),urls:o}}).filter(i=>{let{time:a}=i;return a<=r&&a>this.progress}).forEach(i=>{let{name:a,urls:o}=i;!n&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:o}),this.trackURLs(o,t),n?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:n=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t!="object")return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});e==="closeLinear"&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,n);const r=this.trackingEvents[e],i=this.emitAlwaysEvents.indexOf(e)>-1;r?(this.emit(e,{trackingURLTemplates:r}),this.trackURLs(r,t)):i&&this.emit(e,null),n&&(delete this.trackingEvents[e],i&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:i,invalidUrls:a}=Ie.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const o={...n};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map(c=>c.idRegistry.concat(" ",c.value)).join(",")),this.ad&&(this.ad.sequence&&(o.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(o.ADTYPE=this.ad.adType),this.ad.adServingId&&(o.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(o.ADCATEGORIES=this.ad.categories.map(c=>c.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(c=>c.value).join(","))),Ie.track(i,o,r)}convertToTimecode(e){if(!Ie.isValidTimeValue(e))return"";const t=1e3*e,n=Math.floor(t/36e5),r=Math.floor(t/6e4%60),i=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ie.addLeadingZeros(n,2),":").concat(Ie.addLeadingZeros(r,2),":").concat(Ie.addLeadingZeros(i,2),".").concat(Ie.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var pa,ma;class RC extends P.EventTarget{constructor(e,t){super(),it(this,pa,()=>{const n=this.skipDelay,r=this.player;n>0&&(r.duration()||this.duration)>=n&&(this.skipButtonElement&&(this.skipButtonElement.style.display="block"),this.options.displayRemainingTime&&(this.remainingTimeElement.style.display="block"),this.options.displayRemainingTimeIcons&&(this.remainingTimePlayElement&&this.remainingTimePlayElement.classList.remove("vjs-hidden"),this.remainingTimeMuteElement&&this.remainingTimeMuteElement.classList.remove("vjs-hidden")),r.on("adtimeupdate",Ae(this,ma))),r.loadingSpinner.el().style.display="none"}),it(this,ma,()=>{this.player.loadingSpinner.el().style.display="none";const n=Math.ceil(this.skipDelay-this.player.currentTime());if(this.options.displayRemainingTime){const r=Math.ceil(this.player.remainingTime());this.remainingTimeElement.innerHTML=this.options.messages.remainingTime.replace("{seconds}",r)}this.skipButtonElement&&(n>0?(DC(this.skipButtonElement),this.skipButtonElement.innerHTML=this.options.messages.skipCountdown.replace("{seconds}",n)):(NC(this.skipButtonElement),this.skipButtonElement.innerHTML=this.options.messages.skip))}),this.player=e,this.options=t,this.duration=0,this.skipDelay=0,this.originalState={controlsEnabled:e.controls(),seekEnabled:e.controlBar.progressControl.enabled()}}setUp(){const e=this.player,t=this.options,n=()=>{e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable()},r=()=>{const c=this.blocker=window.document.createElement("div");c.className="vast-blocker",c.onclick=()=>{if(e.paused())return e.play(),!1;this.trigger("click")},e.el().insertBefore(c,e.controlBar.el())},i=()=>{const c=this.skipButtonElement=window.document.createElement("div");c.className="vast-skip-button",c.style.display="none",e.el().appendChild(c),e.one("adplay",Ae(this,pa)),c.onclick=h=>{if((" "+c.className+" ").indexOf(" enabled ")>=0&&this.trigger("skip"),window.Event.prototype.stopPropagation!==void 0)h.stopPropagation();else return!1}},a=()=>{if(!t.displayRemainingTime)return;const c=this.remainingTimeElement=window.document.createElement("div");c.className="vast-remaining-time",c.style.display="none",e.el().appendChild(c)},o=c=>{if(!t.displayRemainingTimeIcons)return;const h={play:{className:"vjs-icon-play vast-remaining-time-icon-play",action:L=>L.paused()?L.play():L.pause(),toggleClasses:["vjs-icon-pause","vjs-icon-play"],events:["adplay","adpause"],initialState:L=>L.paused()?"vjs-icon-play":"vjs-icon-pause"},mute:{className:"vast-remaining-time-icon-mute",action:L=>L.muted(!L.muted()),toggleClasses:["vjs-icon-volume-high","vjs-icon-volume-mute"],events:["advolumechange"],initialState:L=>L.muted()?"vjs-icon-volume-mute":"vjs-icon-volume-high"}},{className:m,action:_,toggleClasses:T,events:S,initialState:w}=h[c],b=e.addChild("button",{className:`vjs-visible-text vjs-button vast-remaining-time-icon ${m}`,clickHandler:(function(){_(this.player)}).bind(this)});b.removeClass("vjs-control"),b.addClass(w(e));const R=()=>{T.forEach(L=>b.toggleClass(L))};this[`remainingTime${c.charAt(0).toUpperCase()+c.slice(1)}Element`]=b.el(),S.forEach(L=>e.on(L,R))};n(),r(),a(),t.displaySkipBtn&&i(),t.autoplay||o("play"),t.muted&&o("mute")}tearDown(){const e=this.player,t=this.originalState;this.duration=0,this.skipDelay=0,e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable(),this.blocker.parentElement.removeChild(this.blocker),this.skipButtonElement&&this.skipButtonElement.parentElement.removeChild(this.skipButtonElement),this.options.displayRemainingTime&&this.remainingTimeElement.parentElement.removeChild(this.remainingTimeElement),this.options.displayRemainingTimeIcons&&(this.remainingTimePlayElement.parentElement.removeChild(this.remainingTimePlayElement),this.remainingTimeMuteElement.parentElement.removeChild(this.remainingTimeMuteElement)),e.off("adtimeupdate",Ae(this,ma)),e.off("adplay",Ae(this,pa))}}pa=new WeakMap,ma=new WeakMap;function oy(s){return s&&(" "+s.className+" ").indexOf(" enabled ")>-1}function DC(s){s&&oy(s)&&(s.className=s.className.replace(" enabled ",""))}function NC(s){s&&!oy(s)&&(s.className+=" enabled ")}function ly(s,e=null){let t;return function(){return s&&(t=s.apply(e||this,arguments),s=null),t}}function cy(s){return s.type==="linear"&&s.mediaFiles.length}function ep(s){return s.type==="companion"}function OC(s){return JSON.parse(JSON.stringify(s))}function MC(s,e=null){let t=null;if(typeof s=="string")if(s.includes("%"))e!=null&&(t=s.replace("%","")/100*e);else if(s.includes(":")){const[n,r,i]=s.split(":").slice(-3);t=parseInt(n||0,10)*3600+parseInt(r||0,10)*60+parseInt(i||0,10)}else t=parseInt(s);return t==null&&(t=Number(s)),isNaN(t)?null:t}var Xr,fa,Yr;class UC{constructor(e,t){it(this,Xr),it(this,fa),it(this,Yr),Ke(this,Xr,e),Ke(this,fa,t),Ke(this,Yr,!1)}get linearCreative(){return Ae(this,Xr).creative}get linearAdTracker(){return Ae(this,Xr)}get companionTracker(){return Ae(this,fa)}get skipAfterDuration(){return Ae(this,Yr)}set skipAfterDuration(e){Ke(this,Yr,e)}hasVideoMedia(){return this.linearCreative.mediaFiles.some(e=>e&&e.apiFramework==null)}}Xr=new WeakMap,fa=new WeakMap,Yr=new WeakMap;var Dn,ga,Nn,Kr,ya;class BC{constructor(e,t,n,r){it(this,Dn),it(this,ga),it(this,Nn),it(this,Kr),it(this,ya,i=>{const a=o=>{const c=new Jh(Ae(this,Dn),o,o.creatives.find(cy),o.creatives.find(ep));c.on("clickthrough",tp);let h=null;const m=o.creatives.find(ep);if(m){const _=Ae(this,Nn),T=m.variations.filter(S=>S.staticResource).filter(S=>S.type.indexOf("image")===0).find(S=>parseInt(S.width,10)<=_.companion.maxWidth&&parseInt(S.height,10)<=_.companion.maxHeight);T&&(h=new Jh(Ae(this,Dn),o,m,T),h.on("clickthrough",tp))}return new UC(c,h)};return i.map(a)}),Ke(this,Dn,e),Ke(this,ga,t),Ke(this,Kr,n),Ke(this,Nn,r)}loadAds(e={}){return new Promise((t,n)=>{const{url:r,xml:i}=e,a=(Array.isArray(r)?r:[r]).filter(c=>c!=null);let o;if(a.length)o=Promise.resolve([]),a.forEach(c=>{o=o.then(h=>h==null||h.length===0?this.loadAdsWithUrl(c):h).catch(h=>[])});else if(i!=null)o=this.loadAdsWithXml(i);else throw new Error("xml or url must be set");o.then(t).catch(n)})}loadAdsWithXml(e){return new Promise((t,n)=>{let r;if(e.constructor===window.XMLDocument)r=e;else if(e.constructor===String)r=new window.DOMParser().parseFromString(e,"application/xml");else throw new Error("xml config option must be a String or XMLDocument");Ae(this,ga).parseVAST(r).then(Ae(this,Kr).selectAds).then(Ae(this,ya)).then(t).catch(n)})}loadAdsWithUrl(e){return new Promise((t,n)=>{Ae(this,Dn).get(e,{withCredentials:Ae(this,Nn).withCredentials,wrapperLimit:Ae(this,Nn).wrapperLimit}).then(Ae(this,Kr).selectAds).then(Ae(this,ya)).then(t).catch(n)})}}Dn=new WeakMap,ga=new WeakMap,Nn=new WeakMap,Kr=new WeakMap,ya=new WeakMap;function tp(s){window.open(s,"_blank")}class FC{selectAds(e){if(!e.ads||e.ads.length===0)throw new Error("no ads found in VAST");const t=e.ads.filter(r=>r.creatives.some(cy));if(!t.length)throw new Error("no linear ads found in VAST");const n=t.filter(r=>r.sequence);return n.length?n.sort((r,i)=>r.sequence-i.sequence):t.filter(r=>!n.includes(r)).slice(0,1)}}function dy(){}function jC(s,e){return s?null:new Error(e)}var nc={};function uy(s){var e=nc[s];e&&(clearTimeout(e),delete nc[s])}function qC(s,e,t){var n,r;return r=setTimeout(function(){e=dy,delete r[n],t()},s),n=function(){e.apply(this,arguments)&&uy(n)},nc[n]=r,n}function VC(s,e,t){var n=document.createElement(e);return t&&(n.id=t),s.appendChild(n),n}function $C(s,e,t){var n=hy(s,null,t.zIndex);if(fy(n,my(e,t)))return n}function hy(s,e,t){var n=document.createElement("iframe");return n.src=e||"about:blank",n.marginWidth="0",n.marginHeight="0",n.frameBorder="0",n.width="100%",n.height="100%",py(n),t&&(n.style.zIndex=t),n.setAttribute("SCROLLING","NO"),s.innerHTML="",s.appendChild(n),n}function py(s){s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.margin="0px",s.style.padding="0px",s.style.border="none",s.style.width="100%",s.style.height="100%"}function my(s,e){return Object.keys(e).forEach(function(t){var n=typeof n=="object"?JSON.stringify(e[t]):e[t];s=s.replace(new RegExp("{{"+t+"}}","g"),n)}),s}function fy(s,e){var t=s.contentWindow&&s.contentWindow.document;return t?(t.write(e),!0):!1}function HC(s,e){return Object.keys(e).forEach(function(t){s[t]=e[t]}),s}function WC(s){var e=-1;return function(){return s+"_"+ ++e}}var gy={noop:dy,validate:jC,clearCallbackTimeout:uy,callbackTimeout:qC,createElementInEl:VC,createIframeWithContent:$C,createIframe:hy,setFullSizeStyle:py,simpleTemplate:my,setIframeContent:fy,extend:HC,unique:WC},vl,sp;function zC(){if(sp)return vl;sp=1;var s=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"],e=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"],t=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"],n=["setAdVolume"];function r(o,c,h){}r.prototype.handshakeVersion=function(o,c){},r.prototype.initAd=function(o,c,h,m,_,T,S){},r.prototype.startAd=function(o){},r.prototype.stopAd=function(o){},r.prototype.skipAd=function(o){},r.prototype.resizeAd=function(o,c,h,m){},r.prototype.pauseAd=function(o){},r.prototype.resumeAd=function(o){},r.prototype.expandAd=function(o){},r.prototype.collapseAd=function(o){},r.prototype.subscribe=function(o,c,h){},r.prototype.unsubscribe=function(o,c){},r.prototype.getAdLinear=function(o){},r.prototype.getAdWidth=function(o){},r.prototype.getAdHeight=function(o){},r.prototype.getAdExpanded=function(o){},r.prototype.getAdSkippableState=function(o){},r.prototype.getAdRemainingTime=function(o){},r.prototype.getAdDuration=function(o){},r.prototype.getAdVolume=function(o){},r.prototype.getAdCompanions=function(o){},r.prototype.getAdIcons=function(o){},r.prototype.setAdVolume=function(o,c){},a(r,"METHODS",s),a(r,"GETTERS",t),a(r,"SETTERS",n),a(r,"EVENTS",e);var i=s.filter(function(o){return["skipAd"].indexOf(o)===-1});a(r,"checkVPAIDInterface",function(o){var c=i.every(function(h){return typeof o[h]=="function"});return c}),vl=r;function a(o,c,h){Object.defineProperty(o,c,{writable:!1,configurable:!1,value:h})}return vl}var bl,np;function GC(){if(np)return bl;np=1;function s(){this._subscribers={}}return s.prototype.subscribe=function(e,t,n){this.isHandlerAttached(e,t)||this.get(t).push({handler:e,context:n,eventName:t})},s.prototype.unsubscribe=function(e,t){this._subscribers[t]=this.get(t).filter(function(n){return e!==n.handler})},s.prototype.unsubscribeAll=function(){this._subscribers={}},s.prototype.trigger=function(e,t){var n=this,r=this.get(e).concat(this.get("*"));r.forEach(function(i){setTimeout(function(){n.isHandlerAttached(i.handler,i.eventName)&&i.handler.call(i.context,t)},0)})},s.prototype.triggerSync=function(e,t){var n=this.get(e).concat(this.get("*"));n.forEach(function(r){r.handler.call(r.context,t)})},s.prototype.get=function(e){return this._subscribers[e]||(this._subscribers[e]=[]),this._subscribers[e]},s.prototype.isHandlerAttached=function(e,t){return this.get(t).some(function(n){return e===n.handler})},bl=s,bl}var Tl,rp;function XC(){if(rp)return Tl;rp=1;var s=zC(),e=GC(),t=s.checkVPAIDInterface,n=gy;s.METHODS;var r="AdError",i="AdClickThru",a=s.EVENTS.filter(function(T){return T!=i});function o(T,S,w,b){this._isValid=t(T),this._isValid&&(this._creative=T,this._el=S,this._videoEl=w,this._iframe=b,this._subscribers=new e,n.setFullSizeStyle(S),c.call(this))}o.prototype=Object.create(s.prototype),o.prototype.isValidVPAIDAd=function(){return this._isValid},s.METHODS.forEach(function(T){var S=["subscribe","unsubscribe","initAd"];S.indexOf(T)===-1&&(o.prototype[T]=function(){var w=s.prototype[T].length,b=Array.prototype.slice.call(arguments),R=w===b.length?b.pop():void 0;setTimeout((function(){var L,U=null;try{L=this._creative[T].apply(this._creative,b)}catch(M){U=M}_(R,this._subscribers,U,L)}).bind(this),0)})}),o.prototype.initAd=function(T,S,w,b,R,L,U){R=R||{},L=n.extend({slot:this._el,videoSlot:this._videoEl},L||{}),setTimeout((function(){var M;try{this._creative.initAd(T,S,w,b,R,L)}catch(F){M=F}_(U,this._subscribers,M)}).bind(this),0)},o.prototype.subscribe=function(T,S,w){this._subscribers.subscribe(S,T,w)},o.prototype.unsubscribe=function(T,S){this._subscribers.unsubscribe(S,T)},o.prototype.on=o.prototype.subscribe,o.prototype.off=o.prototype.unsubscribe,s.GETTERS.forEach(function(T){o.prototype[T]=function(S){setTimeout((function(){var w,b=null;try{w=this._creative[T]()}catch(R){b=R}_(S,this._subscribers,b,w)}).bind(this),0)}}),o.prototype.setAdVolume=function(T,S){setTimeout((function(){var w,b=null;try{this._creative.setAdVolume(T),w=this._creative.getAdVolume()}catch(R){b=R}b||(b=n.validate(w===T,"failed to apply volume: "+T)),_(S,this._subscribers,b,w)}).bind(this),0)},o.prototype._destroy=function(){this.stopAd(),this._subscribers.unsubscribeAll()};function c(){if(a.forEach((function(w){this._creative.subscribe(m.bind(this,w),w)}).bind(this)),this._creative.subscribe(h.bind(this),i),this._videoEl){var T=this._iframe.contentDocument.documentElement,S=this._videoEl;T.addEventListener("click",function(w){w.target===T&&S.click()})}}function h(T,S,w){this._subscribers.triggerSync(i,{url:T,id:S,playerHandles:w})}function m(T){this._subscribers.trigger(T,Array.prototype.slice(arguments,1))}function _(T,S,w,b){T?T(w,b):w&&S.trigger(r,w)}return Tl=o,Tl}var Vs=gy,YC=Vs.unique("vpaidIframe"),KC=XC(),QC=`<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"></head><body style="margin:0;padding:0"><div class="ad-element"></div><script type="text/javascript" src="{{iframeURL_JS}}"><\/script><script type="text/javascript">window.parent.postMessage('{"event": "ready", "id": "{{iframeID}}"}', '{{origin}}');<\/script></body></html>`,ZC="AdStopped";function yr(s,e,t,n){t=t||{},this._id=YC(),this._destroyed=!1,this._frameContainer=Vs.createElementInEl(s,"div"),this._videoEl=e,this._vpaidOptions=n||{timeout:1e4},this._templateConfig={template:t.template||QC,extraOptions:t.extraOptions||{}}}yr.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,ud.call(this))};yr.prototype.isDestroyed=function(){return this._destroyed};yr.prototype.loadAdUnit=function(s,e){s2.call(this),ud.call(this);var t=this,n=Vs.createIframeWithContent(this._frameContainer,this._templateConfig.template,Vs.extend({iframeURL_JS:s,iframeID:this.getID(),origin:ip()},this._templateConfig.extraOptions));this._frame=n,this._onLoad=Vs.callbackTimeout(this._vpaidOptions.timeout,r.bind(this),i.bind(this)),window.addEventListener("message",this._onLoad);function r(a){if(a.origin===ip()){var o=JSON.parse(a.data);if(o.id===t.getID()){var c,h,m;if(t._frame.contentWindow?(m=t._frame.contentWindow.getVPAIDAd,h=Vs.validate(typeof m=="function","the ad didn't return a function to create an ad")):h="the iframe is not anymore in the DOM tree",!h){var _=t._frame.contentWindow.document.querySelector(".ad-element");c=new KC(m(),_,t._videoEl,t._frame),c.subscribe(ZC,e2.bind(t)),h=Vs.validate(c.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}return t._adUnit=c,_y.call(t),e(h,h?null:c),!0}}}function i(){e("timeout",null)}};yr.prototype.unloadAdUnit=function(){ud.call(this)};yr.prototype.getID=function(){return this._id};function JC(s){var e=this[s];e&&(e.remove(),delete this[s])}function e2(){yy.call(this),delete this._adUnit}function ud(){yy.call(this),t2.call(this)}function yy(){JC.call(this,"_frame"),_y.call(this)}function _y(){this._onLoad&&(window.removeEventListener("message",this._onLoad),Vs.clearCallbackTimeout(this._onLoad),delete this._onLoad)}function t2(){this._adUnit&&(this._adUnit.stopAd(),delete this._adUnit)}function s2(){if(this._destroyed)throw new Error("VPAIDHTML5Client already destroyed!")}function ip(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}var n2=yr;const r2=or(n2);function Gn(s){if(s){console.log("vastTracker",{...s});const e=s.ad,t=s.creative;return{mediaFiles:t.mediaFiles.map(n=>Object.assign({},n)),adSequenceId:e.sequence,adId:e.id,creativeAdId:t.id,skippable:s.skippable,skipDelay:s.skipDelay,hasAdUrl:!!t.videoClickThroughURLTemplate.url}}}const i2=["application/x-javascript","text/javascript","application/javascript"];var nn,Fs,Qr,_a,va,Zr;class a2{constructor(e,t){it(this,nn),it(this,Fs),it(this,Qr),it(this,_a),it(this,va),it(this,Zr),Ke(this,_a,e),Ke(this,va,t),Ke(this,Zr,new P.EventTarget)}handle(e){return Ke(this,Fs,!1),Ke(this,Qr,!1),Ke(this,nn,!1),new Promise((t,n)=>{const r=Ae(this,va),i=Ae(this,_a);let a=null;const o=(T,S)=>{if(T){n(T);return}const w=()=>{R(),t(),i.trigger("vpaid.AdStopped"),i.trigger({type:"vast.adEnd",vast:Gn(e)})};S.subscribe("AdStopped",w);const b=N=>{if(S&&!Ae(this,nn)){S.unsubscribe("AdStopped",w);const j=()=>{Ke(this,nn,!0),R(),n(N),i.trigger("vpaid.AdStopped")};Al(S,"AdStopped",j,j),S.stopAd()}else Ke(this,nn,!0),n(N)};if(Ae(this,Zr).on("forceStopAd",b),Ae(this,Fs)){b("Received cancel signal from player");return}function R(){i.controlBar.show(),i.off("playerresize",F),_.destroy(),a&&(a.parentElement.removeChild(a),a=null)}const L=(N,j)=>{var J;if(N){log.console(N),b("Error on VPAID handshake");return}const K={AdParameters:c.adParameters||"",Duration:c.duration||30,SkipTime:r.skip,ClickURL:((J=c.videoClickThroughURLTemplate)==null?void 0:J.url)||"about:blank",All:c,Options:r},ne={};Al(S,"AdLoaded",U,b);const he=i.isFullscreen()?"fullscreen":"normal";S.subscribe("AdError",oe=>{e.error({ERRORCODE:901}),Ke(this,nn,!0),R(),n(`Fatal VPAID Error: ${typeof oe=="object"?JSON.stringify(oe):oe}`),i.trigger({type:"vpaid.AdError",error:oe})}),S.initAd(i.currentWidth(),i.currentHeight(),he,-1,K,ne)},U=()=>{if(Ae(this,Fs)){b("Received cancel signal");return}S.subscribe("AdSkipped",()=>{e.skip(),i.trigger("vpaid.AdSkipped"),i.trigger({type:"vast.adSkip",vast:Gn(e)})}),S.subscribe("AdVolumeChange",()=>{const j=i.volume();S.getAdVolume((J,K)=>{J||(K===0&&j>0?e.setMuted(!0):K>0&&j===0&&e.setMuted(!1),i.volume(K),i.trigger("vpaid.AdVolumeChange"))})}),S.subscribe("AdImpression",()=>{e.trackImpression(),i.trigger("vpaid.AdImpression")}),S.subscribe("AdClickThru",({url:j,id:J,playerHandles:K})=>{K||e.once("clickthrough",ne=>{window.open(ne,"_blank")}),e.click(j),i.trigger("vpaid.AdClickThru")}),S.subscribe("AdVideoFirstQuartile",()=>{e.track("firstQuartile"),i.trigger("vpaid.AdVideoFirstQuartile")}),S.subscribe("AdVideoMidpoint",()=>{e.track("midpoint"),i.trigger("vpaid.AdVideoMidpoint")}),S.subscribe("AdVideoThirdQuartile",()=>{e.track("thirdQuartile"),i.trigger("vpaid.AdVideoThirdQuartile")}),S.subscribe("AdVideoComplete",()=>{e.track("complete"),i.trigger("vpaid.AdVideoComplete")}),S.subscribe("AdUserAcceptInvitation",()=>{e.acceptInvitation(),i.trigger("vpaid.AdUserAcceptInvitation")}),S.subscribe("AdUserMinimize",()=>{e.minimize(),i.trigger("vpaid.AdUserMinimize")}),S.subscribe("AdUserClose",()=>{e.close(),i.trigger("vpaid.AdUserClose")}),S.subscribe("AdPaused",()=>{e.setPaused(!0),i.trigger("vpaid.AdPaused")}),S.subscribe("AdPlaying",()=>{e.setPaused(!1),i.trigger("vpaid.AdPlaying")}),S.getAdLinear(vy((j,J)=>{if(Ae(this,Fs)){b("Received cancel signal");return}j?b(j):J?N():b("Non-linear not supported")},()=>{b("Unable to get mode of operation: linear or non-linear")}));const N=()=>{i.controlBar.hide();const j=ly(M);Al(S,"AdStarted",j,b),S.startAd()}},M=()=>{Ae(this,Fs)?b("Received cancel signal"):(Ke(this,Qr,!0),e.track("start"),i.on("playerresize",F),i.trigger("ads-ad-started"),i.trigger({type:"vast.adStart",vast:Gn(e)}))},F=()=>{S.resizeAd(i.currentWidth(),i.currentHeight(),i.isFullscreen()?"fullscreen":"normal")};S.handshakeVersion("2.0",L)},c=e.creative,h=c.mediaFiles.find(T=>T.apiFramework==="VPAID"&&l2(T));if(!h)throw new Error("Invalid VPAID media file: only JavaScript is supported");a=c2(r),i.el().insertBefore(a,i.controlBar.el());const m=o2(i,r),_=new r2(a,m,{});_.loadAdUnit(h.fileURL,o)})}cancel(){Ke(this,Fs,!0),Ae(this,Qr)&&Ae(this,Zr).trigger("forceStopAd")}}nn=new WeakMap,Fs=new WeakMap,Qr=new WeakMap,_a=new WeakMap,va=new WeakMap,Zr=new WeakMap;function o2(s,e){const t=e.vpaid.videoInstance;let n;return t==="none"?n=null:(t!=="same"&&console.log(`${t} is an invalid videoInstance value. Defaulting to 'same'.`),n=s.tech({kindaKnowWhatImDoing:!0}).el(),n==null&&console.log("Unable to find the video element for VPAID.")),n}function l2(s){return i2.indexOf(s.mimeType.trim())>-1}function c2(s){const e=s.vpaid.containerClass,t=document.createElement("div");return e&&t.classList.add(e),t}function vy(s,e=null){const t=setTimeout(()=>{s=()=>{},e&&e()},1e4);return function(){clearTimeout(t),s.apply(null,arguments)}}function Al(s,e,t,n){const r=vy(t,()=>{n&&n(new Error(`Timeout while waiting for ${e} event.`))});s.subscribe(e,r)}const d2=P.getPlugin("plugin"),u2=Object.freeze({seekEnabled:!1,controlsEnabled:!1,wrapperLimit:10,withCredentials:!0,skip:0,autoplay:!0,muted:!1,displaySkipBtn:!0,displayRemainingTime:!1,displayRemainingTimeIcons:!1,messages:{skip:"Skip",skipCountdown:"Skip in {seconds}...",remainingTime:"This ad will end in {seconds}"},vpaid:{containerClass:"vjs-vpaid-container",videoInstance:"none"},companion:{elementId:null,maxWidth:0,maxHeight:0},honorSkipOffset:!1});class h2 extends d2{constructor(e,t){super(e),typeof e.ads=="function"&&e.ads({debug:!0,stitchedAds:!0,liveCuePoints:!1}),t=(parseInt(P.VERSION,10)>=8?P.obj.merge:P.mergeOptions)(u2,t||{});const n=new PC,r=[];let i=null,a=0,o=0;const c=new a2(e,t);let h=!1,m=t.schedule;m==null||m.length===0?m=[{offset:0,url:t.url||null,xml:t.xml||null}]:(m=OC(m),m.forEach(z=>delete z.offsetInSeconds));const _=oe(m),T=me(m),S=te(m).sort((z,G)=>z.offset-G.offset);e.on("adtimeout",()=>{console.log("Ad timeout"),h=!0});const w=new RC(e,t);function b(){i!=null&&i.hasVideoMedia()&&(i.linearAdTracker.skip(),e.trigger({type:"vast.skipAd",vast:Gn(i.linearAdTracker)}),F())}this.skipAd=b,w.on("skip",b),w.on("click",()=>{!e.paused()&&!t.autoplay&&e.pause()}),this.adAction=()=>{i.linearAdTracker.click()};const R=(()=>{let z=!1;return()=>{if(z)return;let G=null;for(;S.length>0&&(G=S[0].offsetInSeconds,G==null);){const{offset:fe}=S[0];G=MC(fe,e.duration()),G==null?S.shift():S[0].offsetInSeconds=G}if(G!=null&&this.player.currentTime()>G){z=!0;const fe=S.shift();U.loadAds(fe).then(ye=>{ye.length>0&&(r.push(...ye),i=null,K())}).catch(ye=>{console.log(`An error occurred when loading ads for the midroll ad break: : ${ye==null?void 0:ye.message}`)}).finally(()=>{z=!1})}}})();S.length>0&&e.on("timeupdate",R),e.on("readyforpostroll",()=>{h=!1,U.loadAds(T).then(z=>{h?z.forEach(G=>{G.linearAdTracker.error({ERRORCODE:301})}):z.length>0?(r.push(...z),i=null,K()):e.trigger("nopostroll")}).catch(z=>{console.log(`An error occurred when loading ads for the postroll ad break: : ${z.message}`),e.trigger("nopostroll")})}),e.on("readyforpreroll",()=>{K()});const L=ly(()=>{e.trigger("adsready")});setTimeout(L,3e3);const U=new BC(n,new ay,new FC,t);U.loadAds(_).then(z=>{console.log("trackedAds",z),h?z.forEach(G=>{G.linearAdTracker.error({ERRORCODE:301})}):z.length>0?(r.push(...z),i=null,L(),i||K()):e.trigger("nopreroll")}).catch(z=>{console.log(`An error occurred when loading ads for the preroll ad break: ${z.message}`),e.trigger("nopreroll")});const M=z=>z.filter(G=>G.apiFramework==null).map(G=>({type:G.mimeType,src:G.fileURL})),F=()=>{const z=r.shift();if(z!=null&&z.hasVideoMedia()?i!=null&&i.hasVideoMedia()||w.setUp():i!=null&&i.hasVideoMedia()&&w.tearDown(),z){if(i=z,a++,console.log(`Playing ad ${a}/${o}`),i.hasVideoMedia()){const G=i.linearCreative.mediaFiles,fe=G.filter(Oe=>Oe.deliveryType==="streaming"),ye=G.filter(Oe=>Oe.deliveryType!=="streaming");if(ye.length>0)e.src(M(ye));else if(fe.length>0){let Oe=i.linearAdTracker.assetDuration;if(Oe==null||Oe<1){console.log("Streaming ads must have a duration"),F();return}e.src(M(fe)),i.skipAfterDuration=!0}w.duration=i.linearAdTracker.assetDuration||0;const Pe=i.linearAdTracker.skipDelay;w.skipDelay=Pe!=null&&t.honorSkipOffset?Pe:t.skip,t.autoplay&&e.play(),t.muted&&e.muted(!0)}else c.handle(i.linearAdTracker).then(()=>{F()}).catch(G=>{console.log(G),F()});J()}else i=null,a=0,ue()},{setUpEvents:N,tearDownEvents:j}=(()=>{const z=()=>{if(i.skipAfterDuration){const st=i;setTimeout(()=>{i===st&&b()},st.linearAdTracker.assetDuration*1e3)}!i.linearAdTracker.impressed&&i.hasVideoMedia()&&(i.linearAdTracker.trackImpression(),e.trigger({type:"vast.adStart",vast:Gn(i.linearAdTracker),adCount:a,adTotal:o,skipDelay:w.skipDelay}))},G=()=>{i&&(isNaN(i.linearAdTracker.assetDuration)&&(i.linearAdTracker.assetDuration=e.duration()),i.linearAdTracker.setProgress(e.currentTime()))},fe=()=>{e.remainingTime()>0&&(i.linearAdTracker.setPaused(!0),e.one("adplay",()=>{i.linearAdTracker.setPaused(!1)}))},ye=()=>{i.linearAdTracker.error({ERRORCODE:405}),e.error(null),F()},Pe=()=>{i.linearAdTracker.setFullscreen(e.isFullscreen())},Oe=(()=>{let st=e.muted(),ut=e.volume();return()=>{const be=e.volume(),Re=e.muted();st!==Re?(i.linearAdTracker.setMuted(Re),st=Re):ut!==be&&(ut>0&&be===0?i.linearAdTracker.setMuted(!0):ut===0&&be>0&&i.linearAdTracker.setMuted(!1),ut=be)}})(),tt=()=>{i.hasVideoMedia()&&(i.linearAdTracker.complete(),e.trigger({type:"vast.adEnd",vast:Gn(i.linearAdTracker)}),F())};return{setUpEvents:()=>{e.on("adended",tt),e.on("adplay",z),e.on("adtimeupdate",G),e.on("adpause",fe),e.on("aderror",ye),e.on("advolumechange",Oe),e.on("fullscreenchange",Pe)},tearDownEvents:()=>{e.off("adended",tt),e.off("adplay",z),e.off("adtimeupdate",G),e.off("adpause",fe),e.off("aderror",ye),e.off("advolumechange",Oe),e.off("fullscreenchange",Pe)}}})(),J=()=>{const z=i.companionTracker,G=document.getElementById(t.companion.elementId);if(z&&z.variation&&G){const fe=z.variation,ye=()=>{z.click()},Pe=document.createElement("a");Pe.src="#",Pe.addEventListener("click",ye);const Oe=document.createElement("img");Oe.src=fe.staticResource,Pe.appendChild(Oe),G.innerHTML="",G.appendChild(Pe)}else G&&(G.innerHTML="")},K=()=>{o=r.length,console.log(`Playing ${o} ads`),e.ads.startLinearAdMode(),N(),F()};function ne(z){return z.offset===0||z.offset==null||z.offset==="pre"}function he(z){return z.offset==="post"}function oe(z){return z.find(ne)}function me(z){return z.find(he)}function te(z){return z.filter(G=>!ne(G)&&!he(G))}const ue=()=>{e.ads.endLinearAdMode(),j()}}}P.registerPlugin("vast",h2);const p2=Z.styled_default("div")({name:"Container",class:"c4q6dw1",propsAsIs:!1}),m2=Z.styled_default("div")({name:"ControlsContainer",class:"c1la67r",propsAsIs:!1}),ap="m3guev",op="m7099mt",lp="mmm6o5s",f2=({promotion:s,controlVideo:e,onClose:t,promotionId:n,externalAd:r,skipAutoClose:i})=>{var a,o,c,h,m;const _=Ye.useRef(null),T=Ye.useRef(),S=Ye.useRef(),[w,b]=Ye.useState(!0),[R,L]=Ye.useState(!0),[U,M]=Ye.useState(!1),[F,N]=Ye.useState(0),[j,J]=Ye.useState(0),[K,ne]=Ye.useState(0),[he,oe]=Ye.useState(0),me=Ye.useCallback(()=>{T.current&&(T.current.dispose(),T.current=void 0)},[]),te=Ye.useCallback(()=>{N(0),J(0),ne(0),b(!1),e==null||e({muted:!1}),me(),S.current=void 0,T.current=void 0,_.current&&(_.current.innerHTML="")},[e,me]);Ye.useEffect(()=>{if(r!=null&&r.url&&_.current){b(!0);const z=document.createElement("video");z.classList.add("video-js","vjs-default-skin"),_.current.appendChild(z),T.current=P(z,{controls:!1,playsinline:!0}),T.current.on("pause",()=>{L(!0)}),T.current.on("play",()=>{L(!1)}),T.current.on("vast.play",G=>{console.log("Ad is playing",G)}),T.current.on("timeupdate",G=>{N(Math.round(G.target.player.duration()-G.target.player.currentTime()))}),T.current.on("vast.adStart",G=>{console.log("Ad is start",G),b(!0),ne(G.adCount),J(G.adTotal),oe(G.skipDelay),M(G.vast.hasAdUrl)}),T.current.on("nopreroll",G=>{console.log("Ad is nopreroll",G)}),T.current.on("nopostroll",G=>{console.log("Ad is nopostroll",G)}),T.current.on("vast.adEnd",G=>{console.log("Ad is end",G),b(!1),t==null||t()}),T.current.on("vast.skipAd",G=>{console.log("Ad is skip",G),te(),t==null||t()}),uk(_.current,r==null?void 0:r.url)().then(G=>{G&&T.current?S.current=T.current.vast({url:G.toString(),honorSkipOffset:!0,displayRemainingTimeIcons:!0,displaySkipBtn:!1,withCredentials:!0,autoplay:G.searchParams.get("vpa")!=="click",muted:G.searchParams.get("vpmute")==="1"}):te()}).catch(G=>{console.log("error",G),te()})}return te},[r==null?void 0:r.url,me,te]);const ue=((a=s.sponsor)==null?void 0:a.logo)&&s.logoMode===ge.PromotionLogoMode.CENTER;return X.jsxs(hp,{className:"PromoOverlay",children:[X.jsxs(pp,{children:[X.jsx(mp,{className:Z.cx_default(!ue&&fp),children:X.jsx(yp,{style:{transform:"scale(1.5)"},children:"Ad"})}),X.jsxs(m2,{children:[X.jsx(qb,{time:F,adCount:j,adPosition:K}),!!he&&w&&X.jsx(Z.y$1,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{var z;(z=S.current)==null||z.skipAd()},duration:he,isPlaying:!R,skipIcon:!0}),i&&X.jsx(Z.y$1,{className:"ClosePromoIcon",close:()=>{te(),t==null||t()}})]})]}),X.jsx(gp,{className:Z.cx_default(ap,w&&op,!w&&lp),children:X.jsx(p2,{ref:_})}),U&&X.jsx(_p,{className:Z.cx_default(ap,w&&op,!w&&lp),children:X.jsx(vp,{as:"button",onClick:()=>{var z;(z=S.current)==null||z.adAction()},style:{backgroundColor:((c=(o=s.banner)==null?void 0:o.ctaButton)==null?void 0:c.color)||"#009dc4",color:((m=(h=s.banner)==null?void 0:h.ctaButton)==null?void 0:m.textColor)||"#fff"},"data-analytics":"button","data-promo-id":n,"data-promo-type":s.type,target:"_blank",children:"Show more"})})]})},cp=s=>{var e,t,n,r,i,a,o,c,h,m,_,T,S,w,b,R,L,U,M,F,N,j,J,K,ne,he,oe,me,te,ue;const{promotion:z,open:G,advertisementPaused:fe,togglePause:ye,controlVideo:Pe,skipAutoClose:Oe,promotionId:tt,onClose:st,markAsViewed:ut,externalAd:be}=s,Re=z.type===ge.PromotionType.INGAME_IAB11_LBAR||z.type===ge.PromotionType.INGAME_IAB11,ps=((e=z.sponsor)==null?void 0:e.logo)&&z.logoMode===ge.PromotionLogoMode.CENTER,Gs=!!((n=(t=z.banner)==null?void 0:t.video)!=null&&n.url),ms=z.autoPlayVideo===ge.AutoPlayVideo.ENABLED;if(Ye.useEffect(()=>{ye==null||ye(Gs||ms),G==null||G()},[]),Ye.useEffect(()=>{tt&&z.type&&ut&&ut()},[tt,z.type,ut]),Ye.useEffect(()=>()=>{Pe==null||Pe({muted:!1})},[Pe]),be)return X.jsx(f2,{...s,externalAd:be});let Gt=(r=z.banner)==null?void 0:r.url;Gt&&Gt.indexOf("http")!==0&&(Gt=`https://${Gt}`);let Cs=!0;return Gs&&(!fe||!ms?Cs=!0:Cs=!1),X.jsxs(hp,{className:"PromoOverlay",children:[X.jsxs(pp,{children:[X.jsxs(mp,{className:Z.cx_default(!ps&&fp),children:[((i=z.sponsor)==null?void 0:i.logo)&&z.logoMode===ge.PromotionLogoMode.LEFT&&X.jsx(nu,{className:"PromoSponsorLogo",src:(a=z.sponsor)==null?void 0:a.logo,alt:"promo"}),X.jsxs(Nb,{style:{paddingLeft:(o=z.sponsor)!=null&&o.logo&&z.logoMode===ge.PromotionLogoMode.LEFT?"0px":"8px"},children:[((c=z.sponsor)==null?void 0:c.logo)&&z.logoMode===ge.PromotionLogoMode.LEFT&&X.jsx(Lb,{children:(h=z.sponsor)==null?void 0:h.name}),X.jsxs(Ob,{className:"SponsorText",children:[X.jsx(yp,{children:"AD"}),X.jsx(Mb,{children:"SPONSORED"})]})]})]}),X.jsx(Z.y$1,{className:"ClosePromoIcon",close:st,autoClose:(m=z.closeTimer)==null?void 0:m.auto,duration:Oe?0:(_=z.closeTimer)==null?void 0:_.seconds,isPlaying:Cs})]}),X.jsxs(gp,{children:[ps&&X.jsx(nu,{className:Rb,src:(T=z.sponsor)==null?void 0:T.logo,alt:"promo"}),X.jsx(ru,{children:(w=(S=z.banner)==null?void 0:S.video)!=null&&w.url?X.jsx(Z.Y,{source:(R=(b=z.banner)==null?void 0:b.video)==null?void 0:R.url,poster:(U=(L=z.banner)==null?void 0:L.video)==null?void 0:U.thumbnailUrl,aspectRatio:Re?"1/1":"16/9",onPause:()=>{ms&&(ye==null||ye(!0))},onPlay:()=>{Z.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:tt,type:z.type}}),ye==null||ye(!1)},controlVideo:Pe,autoPlay:ms}):(M=z.banner)!=null&&M.imageUrl?X.jsx(Pb,{style:Re?{aspectRatio:"1/1"}:{},src:(F=z.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Re&&X.jsxs(ru,{children:[((N=z.banner)==null?void 0:N.title)&&X.jsx(Ub,{className:Z.cx_default("AdvTitle",ps&&Bb),children:(j=z.banner)==null?void 0:j.title}),((J=z.banner)==null?void 0:J.body)&&X.jsx(Db,{className:"AdvDescription",children:(K=z.banner)==null?void 0:K.body})]})]}),z.buttonType!==ge.PromotionButtonType.NO_BUTTON&&X.jsx(_p,{children:X.jsx(vp,{href:Gt,style:{backgroundColor:((he=(ne=z.banner)==null?void 0:ne.ctaButton)==null?void 0:he.color)||"#009dc4",color:((me=(oe=z.banner)==null?void 0:oe.ctaButton)==null?void 0:me.textColor)||"#fff"},"data-analytics":"button","data-promo-id":tt,"data-promo-type":z.type,target:"_blank",children:(ue=(te=z.banner)==null?void 0:te.ctaButton)==null?void 0:ue.label})})]})},g2=Z.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),y2=({children:s,direction:e,style:t,className:n,hiding:r})=>X.jsx(rc,{direction:e,style:t,hiding:r,className:n,children:X.jsx(g2,{children:s})}),_2=s=>(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB11_LBAR||(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB21_LBAR,v2=s=>(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB11||(s==null?void 0:s.type)===ge.PromotionType.INGAME_IAB21,b2=({advertisement:s,close:e,skipTypeCheck:t,skipAutoClose:n,layoutMode:r="side-by-side",sidebar:i,isNotification:a,banner:o,markAsViewed:c,open:h,externalAd:m,controlVideo:_,advertisementPaused:T,togglePause:S})=>s.promotion?a&&s.notification?X.jsx(Ib,{open:()=>h==null?void 0:h({fromNotification:!0}),notification:s.notification,promotionId:s.question.id}):!i&&!o&&(t||v2(s.promotion))?X.jsx(xb,{className:"PromoOverlayContainer",children:X.jsx(cp,{markAsViewed:c,promotionId:s.question.id,promotion:s.promotion,onClose:e,open:h,skipAutoClose:n,externalAd:m,controlVideo:_,advertisementPaused:T,togglePause:S})}):i&&(t||_2(s.promotion))?X.jsx(y2,{className:"PromoSidebarContainer",direction:i,hiding:!1,children:X.jsx(cp,{markAsViewed:c,promotionId:s.question.id,promotion:s.promotion,externalAd:m,onClose:e,open:h,controlVideo:_,skipAutoClose:n,advertisementPaused:T,togglePause:S})}):o?X.jsx(zv,{promotionId:s.question.id,hiding:!1,promotion:s.promotion,direction:o}):null:null,T2=Z.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),A2=s=>{const e=s.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",n=e.getAttribute("data-promo-type")||ge.PromotionType.UNSET;e.getAttribute("data-analytics")==="button"&&Z.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:n}}),e.getAttribute("data-analytics")==="banner"&&Z.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:n}})}},S2=({gamification:s,layoutMode:e,skipAutoClose:t,skipTypeCheck:n,sidebar:r,banner:i,notification:a,isMobileScreen:o,persistent:c,externalAd:h,controlVideo:m})=>{var _,T,S;const w=Ye.useRef(null),b=Z.useStore(s.advertisement.$store);Z.y(w,{enabled:!!b.data,event:"click",listener:A2});const R=!i&&!r;if(b.data===void 0||!c&&b.isViewed)return null;const L=((S=(T=(_=b==null?void 0:b.data)==null?void 0:_.notification)==null?void 0:T.promotion)==null?void 0:S.mode)===ge.NotificationPromotionMode.LOWER_THIRD;return X.jsx(T2,{ref:w,style:{height:R?"auto":"100%"},className:Z.cx_default("SL-AdvertisementUIWrap",o&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:X.jsx(b2,{skipTypeCheck:n,sidebar:r,banner:i,advertisement:b.data,advertisementPaused:b.isPaused,togglePause:b.togglePause,close:b.close,externalAd:h?b.externalAd:void 0,markAsViewed:s.advertisement.markAsViewed,open:s.advertisement.open,layoutMode:e,isNotification:a,skipAutoClose:t,controlVideo:m})})},by=({sdk:s,sidebar:e,externalAd:t,banner:n,skipAutoClose:r,skipTypeCheck:i,layoutMode:a,isMobileScreen:o,persistent:c,notification:h})=>{const m=Z.useStore(s.featuresList.getStore()),[_,T]=Ye.useState(!t);if(Ye.useEffect(()=>{if(t){const w=document.createElement("script");w.async=!0,w.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(w),w.onload=()=>{T(!0)}}},[t]),e&&n)return X.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(n&&t)return X.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!m)return null;const S=s.getFeature(ge.SdkOverlayType.GAMES);return!S||t&&!_?null:X.jsx(S2,{gamification:S,sidebar:e,banner:n,layoutMode:a,isMobileScreen:o,persistent:c,notification:h,skipTypeCheck:i,skipAutoClose:r,externalAd:t,controlVideo:s.controlVideoPlayer})},E2=({event:s,sidebar:e,banner:t,isMobileScreen:n,skipAutoClose:r,persistent:i,theme:a,notification:o,skipTypeCheck:c,externalAd:h})=>{const m=Z.useStreamLayer(),_=Z.useStreamLayerUI(),T=Z.useStreamLayerTheme();return m?h&&!_.promotionExternalAd?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):!h&&_.promotionExternalAd?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):e&&!_.promotionSidebar?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):t&&!_.promotionBanner?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):o&&!_.promotionNotification?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):!t&&!e&&!o&&!_.promotionOverlay?s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s}):X.jsxs("div",{className:"StreamLayerSDK",children:[X.jsx(Z.h,{customTheme:a??T.theme,themeMode:T.themeMode,children:X.jsx(by,{sdk:m,sidebar:e,banner:t,isMobileScreen:n,persistent:i,notification:o,skipTypeCheck:c,skipAutoClose:r,layoutMode:"side-by-side",externalAd:h})}),s!==void 0&&X.jsx(Z.StreamLayerSDKEvent,{event:s})]}):null};exports.StreamLayerSDKAdvertisement=E2;exports.StreamLayerSDKAdvertisementUI=by;
|
|
220
|
+
`.split("").map(s=>s.charCodeAt(0)));class Sw extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class Ew extends Yl{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 ct();const e=this.subtitlesTrack_.cues,t=e[0].startTime,n=e[e.length-1].startTime;return ct([[t,n]])}initSegmentForMap(e,t=!1){if(!e)return null;const n=Wa(e);let r=this.initSegments_[n];if(t&&!r&&e.bytes){const i=Nh.byteLength+e.bytes.byteLength,a=new Uint8Array(i);a.set(e.bytes),a.set(Nh,e.bytes.byteLength),this.initSegments_[n]=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){Gr(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,n){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===rs.TIMEOUT&&this.handleTimeout_(),e.code===rs.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const r=this.pendingSegment_,i=n.mp4VttCues&&n.mp4VttCues.length;i&&(r.mp4VttCues=n.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 I.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,n),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(r)}catch(o){this.stopForError({message:o.message,metadata:{errorType:P.Error.StreamingVttParserError,error:o}});return}if(i||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(o=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new I.VTTCue(o.startTime,o.endTime,o.text):o)}),aw(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const n=e&&e.type==="vtt",r=t&&t.type==="text";n&&r&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(n=>{const r=n.start+t,i=n.end+t,a=new I.VTTCue(r,i,n.cueText);n.settings&&n.settings.split(" ").forEach(o=>{const c=o.split(":"),h=c[0],m=c[1];a[h]=isNaN(m)?m:Number(m)}),e.cues.push(a)})}parseVTTCues_(e){let t,n=!1;if(typeof I.WebVTT!="function")throw new Sw;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof I.TextDecoder=="function"?t=new I.TextDecoder("utf8"):(t=I.WebVTT.StringDecoder(),n=!0);const r=new I.WebVTT.Parser(I,I.vttjs,t);if(r.oncue=e.cues.push.bind(e.cues),r.ontimestampmap=a=>{e.timestampmap=a},r.onparsingerror=a=>{P.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;n&&(a=Dh(a)),r.parse(a)}let i=e.bytes;n&&(i=Dh(i)),r.parse(i),r.flush()}updateTimeMapping_(e,t,n){const r=e.segment;if(!t)return;if(!e.cues.length){r.empty=!0;return}const{MPEGTS:i,LOCAL:a}=e.timestampmap,o=i/on.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(c=>{const h=c.endTime-c.startTime,m=this.handleRollover_(c.startTime+o,t.time);c.startTime=Math.max(m,0),c.endTime=Math.max(m+h,0)}),!n.syncInfo){const c=e.cues[0].startTime,h=e.cues[e.cues.length-1].startTime;n.syncInfo={mediaSequence:n.mediaSequence+e.mediaIndex,time:Math.min(c,h-r.duration)}}}handleRollover_(e,t){if(t===null)return e;let n=e*on.ONE_SECOND_IN_TS;const r=t*on.ONE_SECOND_IN_TS;let i;for(r<n?i=-8589934592:i=8589934592;Math.abs(n-r)>4294967296;)n+=i;return n/on.ONE_SECOND_IN_TS}}const ww=function(s,e){const t=s.cues;for(let n=0;n<t.length;n++){const r=t[n];if(e>=r.adStartTime&&e<=r.adEndTime)return r}return null},kw=function(s,e,t=0){if(!s.segments)return;let n=t,r;for(let i=0;i<s.segments.length;i++){const a=s.segments[i];if(r||(r=ww(e,n+a.duration/2)),r){if("cueIn"in a){r.endTime=n,r.adEndTime=n,n+=a.duration,r=null;continue}if(n<r.endTime){n+=a.duration;continue}r.endTime+=a.duration}else if("cueOut"in a&&(r=new I.VTTCue(n,n+a.duration,a.cueOut),r.adStartTime=n,r.adEndTime=n+parseFloat(a.cueOut),e.addCue(r)),"cueOutCont"in a){const[o,c]=a.cueOutCont.split("/").map(parseFloat);r=new I.VTTCue(n,n+a.duration,""),r.adStartTime=n-o,r.adEndTime=r.adStartTime+c,e.addCue(r)}n+=a.duration}};class Oh{constructor({start:e,end:t,segmentIndex:n,partIndex:r=null,appended:i=!1}){this.start_=e,this.end_=t,this.segmentIndex_=n,this.partIndex_=r,this.appended_=i}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 Cw{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 Og{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:n,segments:r}=e;if(this.isReliable_=this.isReliablePlaylist_(n,r),!!this.isReliable_)return this.updateStorage_(r,n,this.calculateBaseTime_(n,r,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:n}of this.storage_.values())if(n.length){for(const r of n)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,n){const r=new Map;let i=`
|
|
221
|
+
`,a=n,o=t;this.start_=a,e.forEach((c,h)=>{const m=this.storage_.get(o),_=a,T=_+c.duration,S=!!(m&&m.segmentSyncInfo&&m.segmentSyncInfo.isAppended),w=new Oh({start:_,end:T,appended:S,segmentIndex:h});c.syncInfo=w;let b=a;const R=(c.parts||[]).map((L,U)=>{const M=b,F=b+L.duration,N=!!(m&&m.partsSyncInfo&&m.partsSyncInfo[U]&&m.partsSyncInfo[U].isAppended),j=new Oh({start:M,end:F,appended:N,segmentIndex:h,partIndex:U});return b=F,i+=`Media Sequence: ${o}.${U} | Range: ${M} --> ${F} | Appended: ${N}
|
|
222
|
+
`,L.syncInfo=j,j});r.set(o,new Cw(w,R)),i+=`${Pg(c.resolvedUri)} | Media Sequence: ${o} | Range: ${_} --> ${T} | Appended: ${S}
|
|
223
|
+
`,o++,a=T}),this.end_=a,this.storage_=r,this.diagnostics_=i}calculateBaseTime_(e,t,n){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 i=r-e;let a=this.storage_.get(r).segmentSyncInfo.start;for(let o=0;o<i;o++){const c=t[o];a-=c.duration}return a}return n}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Mh extends Og{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,n){if(!this.storage_.size){const r=this.parent_.getSyncInfoForMediaSequence(e);return r?r.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,n)}}const Iw=86400,yl=[{name:"VOD",run:(s,e,t,n,r)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,n,r,i)=>{const a=s.getMediaSequenceSync(i);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(r);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,n,r)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let i=null,a=null;const o=jl(e);r=r||0;for(let c=0;c<o.length;c++){const h=e.endList||r===0?c:o.length-(c+1),m=o[h],_=m.segment,T=s.timelineToDatetimeMappings[_.timeline];if(!T||!_.dateTimeObject)continue;let S=_.dateTimeObject.getTime()/1e3+T;if(_.parts&&typeof m.partIndex=="number")for(let b=0;b<m.partIndex;b++)S+=_.parts[b].duration;const w=Math.abs(r-S);if(a!==null&&(w===0||a<w))break;a=w,i={time:S,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return i}},{name:"Segment",run:(s,e,t,n,r)=>{let i=null,a=null;r=r||0;const o=jl(e);for(let c=0;c<o.length;c++){const h=e.endList||r===0?c:o.length-(c+1),m=o[h],_=m.segment,T=m.part&&m.part.start||_&&_.start;if(_.timeline===n&&typeof T<"u"){const S=Math.abs(r-T);if(a!==null&&a<S)break;(!i||a===null||a>=S)&&(a=S,i={time:T,segmentIndex:m.segmentIndex,partIndex:m.partIndex})}}return i}},{name:"Discontinuity",run:(s,e,t,n,r)=>{let i=null;if(r=r||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o<e.discontinuityStarts.length;o++){const c=e.discontinuityStarts[o],h=e.discontinuitySequence+o+1,m=s.discontinuities[h];if(m){const _=Math.abs(r-m.time);if(a!==null&&a<_)break;(!i||a===null||a>=_)&&(a=_,i={time:m.time,segmentIndex:c,partIndex:null})}}}return i}},{name:"Playlist",run:(s,e,t,n,r)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class xw extends P.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Og,n=new Mh(t),r=new Mh(t);this.mediaSequenceStorage_={main:t,audio:n,vtt:r},this.logger_=jt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,n,r,i){if(t!==1/0)return yl.find(({name:o})=>o==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,n,r,i);if(!a.length)return null;for(const o of a){const{syncPoint:c,strategy:h}=o,{segmentIndex:m,time:_}=c;if(m<0)continue;const T=e.segments[m],S=_,w=S+T.duration;if(this.logger_(`Strategy: ${h}. Current time: ${r}. selected segment: ${m}. Time: [${S} -> ${w}]}`),r>=S&&r<w)return this.logger_("Found sync point with exact match: ",c),c}return this.selectSyncPoint_(a,{key:"time",value:r})}getExpiredTime(e,t){if(!e||!e.segments)return null;const n=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!n.length)return null;const r=this.selectSyncPoint_(n,{key:"segmentIndex",value:0});return r.segmentIndex>0&&(r.time*=-1),Math.abs(r.time+ri({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:r.segmentIndex,endIndex:0}))}runStrategies_(e,t,n,r,i){const a=[];for(let o=0;o<yl.length;o++){const c=yl[o],h=c.run(this,e,t,n,r,i);h&&(h.strategy=c.name,a.push({strategy:c.name,syncPoint:h}))}return a}selectSyncPoint_(e,t){let n=e[0].syncPoint,r=Math.abs(e[0].syncPoint[t.key]-t.value),i=e[0].strategy;for(let a=1;a<e.length;a++){const o=Math.abs(e[a].syncPoint[t.key]-t.value);o<r&&(r=o,n=e[a].syncPoint,i=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${i}]: [time:${n.time}, segmentIndex:${n.segmentIndex}`+(typeof n.partIndex=="number"?`,partIndex:${n.partIndex}`:"")+"]"),n}saveExpiredSegmentInfo(e,t){const n=t.mediaSequence-e.mediaSequence;if(n>Iw){P.log.warn(`Not saving expired segment info. Media sequence gap ${n} is too large.`);return}for(let r=n-1;r>=0;r--){const i=e.segments[r];if(i&&typeof i.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+r,time:i.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],n=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-n}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const n=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),r=e.segment;n&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:r.start}));const i=r.dateTimeObject;r.discontinuity&&t&&i&&(this.timelineToDatetimeMappings[r.timeline]=-(i.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,n){const r=e.segment,i=e.part;let a=this.timelines[e.timeline],o,c;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},n&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),o=e.startOfSegment,c=t.end+a.mapping;else if(a)o=t.start+a.mapping,c=t.end+a.mapping;else return!1;return i&&(i.start=o,i.end=c),(!r.start||o<r.start)&&(r.start=o),r.end=c,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,n=e.segment;if(n.discontinuity)this.discontinuities[n.timeline]={time:n.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let r=0;r<t.discontinuityStarts.length;r++){const i=t.discontinuityStarts[r],a=t.discontinuitySequence+r+1,o=i-e.mediaIndex,c=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>c){let h;o<0?h=n.start-ri({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:i}):h=n.end+ri({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:i}),this.discontinuities[a]={time:h,accuracy:c}}}}dispose(){this.trigger("dispose"),this.off()}}class Lw extends P.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:n}){return typeof t=="number"&&typeof n=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:n},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:n}){if(typeof t=="number"&&typeof n=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:n},delete this.pendingTimelineChanges_[e];const r={timelineChangeInfo:{from:t,to:n}};this.trigger({type:"timelinechange",metadata:r})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Pw=vg(bg(function(){var s=function(){function b(){this.listeners={}}var R=b.prototype;return R.on=function(L,U){this.listeners[L]||(this.listeners[L]=[]),this.listeners[L].push(U)},R.off=function(L,U){if(!this.listeners[L])return!1;var M=this.listeners[L].indexOf(U);return this.listeners[L]=this.listeners[L].slice(0),this.listeners[L].splice(M,1),M>-1},R.trigger=function(L){var U=this.listeners[L];if(U)if(arguments.length===2)for(var M=U.length,F=0;F<M;++F)U[F].call(this,arguments[1]);else for(var N=Array.prototype.slice.call(arguments,1),j=U.length,J=0;J<j;++J)U[J].apply(this,N)},R.dispose=function(){this.listeners={}},R.pipe=function(L){this.on("data",function(U){L.push(U)})},b}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(b){return b.subarray(0,b.byteLength-b[b.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const b=[[[],[],[],[],[]],[[],[],[],[],[]]],R=b[0],L=b[1],U=R[4],M=L[4];let F,N,j;const J=[],Y=[];let re,me,le,ge,se,he;for(F=0;F<256;F++)Y[(J[F]=F<<1^(F>>7)*283)^F]=F;for(N=j=0;!U[N];N^=re||1,j=Y[j]||1)for(ge=j^j<<1^j<<2^j<<3^j<<4,ge=ge>>8^ge&255^99,U[N]=ge,M[ge]=N,le=J[me=J[re=J[N]]],he=le*16843009^me*65537^re*257^N*16843008,se=J[ge]*257^ge*16843008,F=0;F<4;F++)R[F][N]=se=se<<24^se>>>8,L[F][ge]=he=he<<24^he>>>8;for(F=0;F<5;F++)R[F]=R[F].slice(0),L[F]=L[F].slice(0);return b};let n=null;class r{constructor(R){n||(n=t()),this._tables=[[n[0][0].slice(),n[0][1].slice(),n[0][2].slice(),n[0][3].slice(),n[0][4].slice()],[n[1][0].slice(),n[1][1].slice(),n[1][2].slice(),n[1][3].slice(),n[1][4].slice()]];let L,U,M;const F=this._tables[0][4],N=this._tables[1],j=R.length;let J=1;if(j!==4&&j!==6&&j!==8)throw new Error("Invalid aes key size");const Y=R.slice(0),re=[];for(this._key=[Y,re],L=j;L<4*j+28;L++)M=Y[L-1],(L%j===0||j===8&&L%j===4)&&(M=F[M>>>24]<<24^F[M>>16&255]<<16^F[M>>8&255]<<8^F[M&255],L%j===0&&(M=M<<8^M>>>24^J<<24,J=J<<1^(J>>7)*283)),Y[L]=Y[L-j]^M;for(U=0;L;U++,L--)M=Y[U&3?L:L-4],L<=4||U<4?re[U]=M:re[U]=N[0][F[M>>>24]]^N[1][F[M>>16&255]]^N[2][F[M>>8&255]]^N[3][F[M&255]]}decrypt(R,L,U,M,F,N){const j=this._key[1];let J=R^j[0],Y=M^j[1],re=U^j[2],me=L^j[3],le,ge,se;const he=j.length/4-2;let z,ee=4;const ce=this._tables[1],ne=ce[0],Pe=ce[1],Oe=ce[2],tt=ce[3],st=ce[4];for(z=0;z<he;z++)le=ne[J>>>24]^Pe[Y>>16&255]^Oe[re>>8&255]^tt[me&255]^j[ee],ge=ne[Y>>>24]^Pe[re>>16&255]^Oe[me>>8&255]^tt[J&255]^j[ee+1],se=ne[re>>>24]^Pe[me>>16&255]^Oe[J>>8&255]^tt[Y&255]^j[ee+2],me=ne[me>>>24]^Pe[J>>16&255]^Oe[Y>>8&255]^tt[re&255]^j[ee+3],ee+=4,J=le,Y=ge,re=se;for(z=0;z<4;z++)F[(3&-z)+N]=st[J>>>24]<<24^st[Y>>16&255]<<16^st[re>>8&255]<<8^st[me&255]^j[ee++],le=J,J=Y,Y=re,re=me,me=le}}class i 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(R){this.jobs.push(R),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(b){return b<<24|(b&65280)<<8|(b&16711680)>>8|b>>>24},o=function(b,R,L){const U=new Int32Array(b.buffer,b.byteOffset,b.byteLength>>2),M=new r(Array.prototype.slice.call(R)),F=new Uint8Array(b.byteLength),N=new Int32Array(F.buffer);let j,J,Y,re,me,le,ge,se,he;for(j=L[0],J=L[1],Y=L[2],re=L[3],he=0;he<U.length;he+=4)me=a(U[he]),le=a(U[he+1]),ge=a(U[he+2]),se=a(U[he+3]),M.decrypt(me,le,ge,se,N,he),N[he]=a(N[he]^j),N[he+1]=a(N[he+1]^J),N[he+2]=a(N[he+2]^Y),N[he+3]=a(N[he+3]^re),j=me,J=le,Y=ge,re=se;return F};class c{constructor(R,L,U,M){const F=c.STEP,N=new Int32Array(R.buffer),j=new Uint8Array(R.byteLength);let J=0;for(this.asyncStream_=new i,this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,U,j)),J=F;J<N.length;J+=F)U=new Uint32Array([a(N[J-4]),a(N[J-3]),a(N[J-2]),a(N[J-1])]),this.asyncStream_.push(this.decryptChunk_(N.subarray(J,J+F),L,U,j));this.asyncStream_.push(function(){M(null,e(j))})}static get STEP(){return 32e3}decryptChunk_(R,L,U,M){return function(){const F=o(R,L,U);M.set(F,R.byteOffset)}}}var h=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Aa<"u"?Aa:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof h<"u"?m=h:typeof self<"u"?m=self:m={};var _=m,T=function(b){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(b):b&&b.buffer instanceof ArrayBuffer},S=_.BigInt||Number;S("0x1"),S("0x100"),S("0x10000"),S("0x1000000"),S("0x100000000"),S("0x10000000000"),S("0x1000000000000"),S("0x100000000000000"),S("0x10000000000000000"),function(){var b=new Uint16Array([65484]),R=new Uint8Array(b.buffer,b.byteOffset,b.byteLength);return R[0]===255?"big":R[0]===204?"little":"unknown"}();const w=function(b){const R={};return Object.keys(b).forEach(L=>{const U=b[L];T(U)?R[L]={bytes:U.buffer,byteOffset:U.byteOffset,byteLength:U.byteLength}:R[L]=U}),R};self.onmessage=function(b){const R=b.data,L=new Uint8Array(R.encrypted.bytes,R.encrypted.byteOffset,R.encrypted.byteLength),U=new Uint32Array(R.key.bytes,R.key.byteOffset,R.key.byteLength/4),M=new Uint32Array(R.iv.bytes,R.iv.byteOffset,R.iv.byteLength/4);new c(L,U,M,function(F,N){self.postMessage(w({source:R.source,decrypted:N}),[N.buffer])})}}));var Rw=_g(Pw);const Dw=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Mg=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Ql=(s,e)=>{e.activePlaylistLoader=s,s.load()},Nw=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:n},mediaTypes:{[s]:r}}=e,i=r.activeTrack(),a=r.getActiveGroup(),o=r.activePlaylistLoader,c=r.lastGroup_;if(!(a&&c&&a.id===c.id)&&(r.lastGroup_=a,r.lastTrack_=i,Mg(t,r),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&n.resetEverything();return}t.resyncLoader(),Ql(a.playlistLoader,r)}},Ow=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:n}}=e;n.lastGroup_=null,t.abort(),t.pause()},Mw=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:n,main:r},mediaTypes:{[s]:i}}=e,a=i.activeTrack(),o=i.getActiveGroup(),c=i.activePlaylistLoader,h=i.lastTrack_;if(!(h&&a&&h.id===a.id)&&(i.lastGroup_=o,i.lastTrack_=a,Mg(n,i),!!o)){if(o.isMainPlaylist){if(!a||!h||a.id===h.id)return;const m=e.vhs.playlistController_,_=m.selectPlaylist();if(m.media()===_)return;i.logger_(`track change. Switching main audio from ${h.id} to ${a.id}`),t.pause(),r.resetEverything(),m.fastQualityChange_(_);return}if(s==="AUDIO"){if(!o.playlistLoader){r.setAudio(!0),r.resetEverything();return}n.setAudio(!0),r.setAudio(!1)}if(c===o.playlistLoader){Ql(o.playlistLoader,i);return}n.track&&n.track(a),n.resetEverything(),Ql(o.playlistLoader,i)}},Xa={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:n}=e,r=t.activeTrack(),i=t.activeGroup(),a=(i.filter(c=>c.default)[0]||i[0]).id,o=t.tracks[a];if(r===o){n({error:{message:"Problem encountered loading the default audio track."}});return}P.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const c in t.tracks)t.tracks[c].enabled=t.tracks[c]===o;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;P.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const n=t.activeTrack();n&&(n.mode="disabled"),t.onTrackChanged()}},Uh={AUDIO:(s,e,t)=>{if(!e)return;const{tech:n,requestOptions:r,segmentLoaders:{[s]:i}}=t;e.on("loadedmetadata",()=>{const a=e.media();i.playlist(a,r),(!n.paused()||a.endList&&n.preload()!=="none")&&i.load()}),e.on("loadedplaylist",()=>{i.playlist(e.media(),r),n.paused()||i.load()}),e.on("error",Xa[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:n,requestOptions:r,segmentLoaders:{[s]:i},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();i.playlist(o,r),i.track(a.activeTrack()),(!n.paused()||o.endList&&n.preload()!=="none")&&i.load()}),e.on("loadedplaylist",()=>{i.playlist(e.media(),r),n.paused()||i.load()}),e.on("error",Xa[s](s,t))}},Uw={AUDIO:(s,e)=>{const{vhs:t,sourceType:n,segmentLoaders:{[s]:r},requestOptions:i,main:{mediaGroups:a},mediaTypes:{[s]:{groups:o,tracks:c,logger_:h}},mainPlaylistLoader:m}=e,_=Si(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 T in a[s]){o[T]||(o[T]=[]);for(const S in a[s][T]){let w=a[s][T][S],b;if(_?(h(`AUDIO group '${T}' label '${S}' is a main playlist`),w.isMainPlaylist=!0,b=null):n==="vhs-json"&&w.playlists?b=new Bn(w.playlists[0],t,i):w.resolvedUri?b=new Bn(w.resolvedUri,t,i):w.playlists&&n==="dash"?b=new zl(w.playlists[0],t,i,m):b=null,w=ve({id:S,playlistLoader:b},w),Uh[s](s,w.playlistLoader,e),o[T].push(w),typeof c[S]>"u"){const R=new P.AudioTrack({id:S,kind:Dw(w),enabled:!1,language:w.language,default:w.default,label:S});c[S]=R}}}r.on("error",Xa[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:n,sourceType:r,segmentLoaders:{[s]:i},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[s]:{groups:c,tracks:h}},mainPlaylistLoader:m}=e;for(const _ in o[s]){c[_]||(c[_]=[]);for(const T in o[s][_]){if(!n.options_.useForcedSubtitles&&o[s][_][T].forced)continue;let S=o[s][_][T],w;if(r==="hls")w=new Bn(S.resolvedUri,n,a);else if(r==="dash"){if(!S.playlists.filter(b=>b.excludeUntil!==1/0).length)return;w=new zl(S.playlists[0],n,a,m)}else r==="vhs-json"&&(w=new Bn(S.playlists?S.playlists[0]:S.resolvedUri,n,a));if(S=ve({id:T,playlistLoader:w},S),Uh[s](s,S.playlistLoader,e),c[_].push(S),typeof h[T]>"u"){const b=t.addRemoteTextTrack({id:T,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:T},!1).track;h[T]=b}}}i.on("error",Xa[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:n},mediaTypes:{[s]:{groups:r,tracks:i}}}=e;for(const a in n[s]){r[a]||(r[a]=[]);for(const o in n[s][a]){const c=n[s][a][o];if(!/^(?:CC|SERVICE)/.test(c.instreamId))continue;const h=t.options_.vhs&&t.options_.vhs.captionServices||{};let m={label:o,language:c.language,instreamId:c.instreamId,default:c.default&&c.autoselect};if(h[m.instreamId]&&(m=ve(m,h[m.instreamId])),m.default===void 0&&delete m.default,r[a].push(ve({id:o},c)),typeof i[o]>"u"){const _=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;i[o]=_}}}}},Ug=(s,e)=>{for(let t=0;t<s.length;t++)if(id(e,s[t])||s[t].playlists&&Ug(s[t].playlists,e))return!0;return!1},Bw=(s,e)=>t=>{const{mainPlaylistLoader:n,mediaTypes:{[s]:{groups:r}}}=e,i=n.media();if(!i)return null;let a=null;i.attributes[s]&&(a=r[i.attributes[s]]);const o=Object.keys(r);if(!a)if(s==="AUDIO"&&o.length>1&&Si(e.main))for(let c=0;c<o.length;c++){const h=r[o[c]];if(Ug(h,i)){a=h;break}}else r.main?a=r.main:o.length===1&&(a=r[o[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(c=>c.id===t.id)[0]||null},Fw={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const n in t)if(t[n].enabled)return t[n];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const n in t)if(t[n].mode==="showing"||t[n].mode==="hidden")return t[n];return null}},jw=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},qw=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(h=>{Uw[h](h,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:n,vhs:r,segmentLoaders:{["AUDIO"]:i,main:a}}=s;["AUDIO","SUBTITLES"].forEach(h=>{e[h].activeGroup=Bw(h,s),e[h].activeTrack=Fw[h](h,s),e[h].onGroupChanged=Nw(h,s),e[h].onGroupChanging=Ow(h,s),e[h].onTrackChanged=Mw(h,s),e[h].getActiveGroup=jw(h,s)});const o=e.AUDIO.activeGroup();if(o){const h=(o.filter(m=>m.default)[0]||o[0]).id;e.AUDIO.tracks[h].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),i.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(h=>e[h].onGroupChanging())});const c=()=>{e.AUDIO.onTrackChanged(),n.trigger({type:"usage",name:"vhs-audio-change"})};n.audioTracks().addEventListener("change",c),n.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),r.on("dispose",()=>{n.audioTracks().removeEventListener("change",c),n.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),n.clearTracks("audio");for(const h in e.AUDIO.tracks)n.audioTracks().addTrack(e.AUDIO.tracks[h])},Vw=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:vs,activeTrack:vs,getActiveGroup:vs,onGroupChanged:vs,onTrackChanged:vs,lastTrack_:null,logger_:jt(`MediaGroups[${e}]`)}}),s};class Bh{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_=St(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 $w extends P.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new Bh,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_=jt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const n=t.serverUri||t.serverURL;if(!n){this.logger_(`steering manifest URL is ${n}, cannot request steering manifest.`),this.trigger("error");return}if(n.startsWith("data:")){this.decodeDataUriManifest_(n.substring(n.indexOf(",")+1));return}this.steeringManifest.reloadUri=St(e,n),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 n=e?t:this.getRequestURI(t);if(!n){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const r={contentSteeringInfo:{uri:n}};this.trigger({type:"contentsteeringloadstart",metadata:r}),this.request_=this.xhr_({uri:n,requestType:"content-steering-manifest"},(i,a)=>{if(i){if(a.status===410){this.logger_(`manifest request 410 ${i}.`),this.logger_(`There will be no more content steering requests to ${n} this session.`),this.excludedSteeringManifestURLs.add(n);return}if(a.status===429){const h=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${i}.`),this.logger_(`content steering will retry in ${h} seconds.`),this.startTTLTimeout_(parseInt(h,10));return}this.logger_(`manifest failed to load ${i}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:r});let o;try{o=JSON.parse(this.request_.responseText)}catch(h){const m={errorType:P.Error.StreamingContentSteeringParserError,error:h};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(o);const c={contentSteeringInfo:r.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:c}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new I.URL(e),n=new I.URL(this.proxyServerUrl_);return n.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(n.toString())}decodeDataUriManifest_(e){const t=JSON.parse(I.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new I.URL(e),n=this.getPathway(),r=this.getBandwidth_();if(n){const i=`_${this.manifestType_}_pathway`;t.searchParams.set(i,n)}if(r){const i=`_${this.manifestType_}_throughput`;t.searchParams.set(i,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 t=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==t&&(this.currentPathway=t,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 n=this.setSteeringParams_(e);return t(n)?null:n}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=I.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){I.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 Bh}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&&(St(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const Hw=(s,e)=>{let t=null;return(...n)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,n)},e)}},Ww=10;let Bs;const zw=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],Gw=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},Xw=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:n,bufferLowWaterLine:r,bufferHighWaterLine:i,duration:a,bufferBasedABR:o,log:c}){if(!n)return P.log.warn("We received no playlist to switch to. Please check your stream."),!1;const h=`allowing switch ${s&&s.id||"null"} -> ${n.id}`;if(!s)return c(`${h} as current playlist is not set`),!0;if(n.id===s.id)return!1;const m=!!Un(e,t).length;if(!s.endList)return!m&&typeof s.partTargetDuration=="number"?(c(`not ${h} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(c(`${h} as current playlist is live`),!0);const _=sd(e,t),T=o?Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Je.MAX_BUFFER_LOW_WATER_LINE;if(a<T)return c(`${h} as duration < max low water line (${a} < ${T})`),!0;const S=n.attributes.BANDWIDTH,w=s.attributes.BANDWIDTH;if(S<w&&(!o||_<i)){let b=`${h} as next bandwidth < current bandwidth (${S} < ${w})`;return o&&(b+=` and forwardBuffer < bufferHighWaterLine (${_} < ${i})`),c(b),!0}if((!o||S>w)&&_>=r){let b=`${h} as forwardBuffer >= bufferLowWaterLine (${_} >= ${r})`;return o&&(b+=` and next bandwidth > current bandwidth (${S} > ${w})`),c(b),!0}return c(`not ${h} as no switching criteria met`),!1};class Yw extends P.EventTarget{constructor(e){super(),this.fastQualityChange_=Hw(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:n,tech:r,bandwidth:i,externVhs:a,useCueTags:o,playlistExclusionDuration:c,enableLowInitialPlaylist:h,sourceType:m,cacheEncryptionKeys:_,bufferBasedABR:T,leastPixelDiffSelector:S,captionServices:w,experimentalUseMMS:b}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:R}=e;(R===null||typeof R>"u")&&(R=1/0),Bs=a,this.bufferBasedABR=!!T,this.leastPixelDiffSelector=!!S,this.withCredentials=n,this.tech_=r,this.vhs_=r.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=o,this.playlistExclusionDuration=c,this.maxPlaylistRetries=R,this.enableLowInitialPlaylist=h,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:n,maxPlaylistRetries:R,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Vw(),b&&I.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new I.ManagedMediaSource,this.usingManagedMediaSource_=!0,P.log("Using ManagedMediaSource")):I.MediaSource&&(this.mediaSource=new I.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_=ct(),this.hasPlayed_=!1,this.syncController_=new xw(e),this.segmentMetadataTrack_=r.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new Rw,this.sourceUpdater_=new Ng(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Lw,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:w,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:i,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 zl(t,this.vhs_,ve(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Bn(t,this.vhs_,ve(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Yl(ve(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Yl(ve(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Ew(ve(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,N)=>{function j(){r.off("vttjserror",J),F()}function J(){r.off("vttjsloaded",j),N()}r.one("vttjsloaded",j),r.one("vttjserror",J),r.addWebVttScript_()})}),e);const U=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new $w(this.vhs_.xhr,U),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),zw.forEach(F=>{this[F+"_"]=Gw.bind(this,F)}),this.logger_=jt("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 M=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(M,()=>{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,n){const r=this.media(),i=r&&(r.id||r.uri),a=e&&(e.id||e.uri);if(i&&i!==a){this.logger_(`switch media ${i} -> ${a} from ${t}`);const o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,n)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],n=t?t.activeGroup():null,r=this.contentSteeringController_.getPathway();if(n&&r){const i=(n.length?n[0].playlists:n.playlists).filter(a=>a.attributes.serviceLocation===r);i.length&&this.mediaTypes_[e].activePlaylistLoader.media(i[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=I.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(I.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 n=e.mediaGroups.AUDIO,r=Object.keys(n);let i;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)i=this.mediaTypes_.AUDIO.activeTrack();else{const o=n.main||r.length&&n[r[0]];for(const c in o)if(o[c].default){i={label:c};break}}if(!i)return t;const a=[];for(const o in n)if(n[o][i.label]){const c=n[o][i.label];if(c.playlists&&c.playlists.length)a.push.apply(a,c.playlists);else if(c.uri)a.push(c);else if(e.playlists.length)for(let h=0;h<e.playlists.length;h++){const m=e.playlists[h];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===o&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,e.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.mainSegmentLoader_.load()),qw({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),e),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let e=this.mainPlaylistLoader_.media();if(!e){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let t;if(this.enableLowInitialPlaylist&&(t=this.selectInitialPlaylist()),t||(t=this.selectPlaylist()),!t||!this.shouldSwitchToMedia_(t)||(this.initialMedia_=t,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;e=this.initialMedia_}this.handleUpdatedMediaPlaylist(e)}),this.mainPlaylistLoader_.on("error",()=>{const e=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:e.playlist,error:e})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const e=this.mainPlaylistLoader_.media(),t=e.targetDuration*1.5*1e3;ql(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=t,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const e=this.mainPlaylistLoader_.media();e.lastExcludeReason_!=="playlist-unchanged"&&this.stuckAtPlaylistEnd_(e)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(e=>{this.mainPlaylistLoader_.on(e,t=>{this.player_.trigger(ze({},t))})})}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 n=e.mediaGroups||{};let r=!0;const i=Object.keys(n.AUDIO);for(const a in n.AUDIO)for(const o in n.AUDIO[a])n.AUDIO[a][o].uri||(r=!1);r&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(n.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Bs.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),i.length&&Object.keys(n.AUDIO[i[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_,n=this.tech_.currentTime(),r=this.bufferLowWaterLine(),i=this.bufferHighWaterLine(),a=this.tech_.buffered();return Xw({buffered:a,currentTime:n,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:r,bufferHighWaterLine:i,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const t=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const t=this.audioSegmentLoader_.pendingSegment_;if(!t||!t.segment||!t.segment.syncInfo)return;const n=t.segment.syncInfo.end+.01;this.tech_.setCurrentTime(n)}),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",t=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:Ww}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const t=this.getCodecsOrExclude_();t&&this.sourceUpdater_.addOrChangeSourceBuffers(t)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(t=>{this.mainSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))}),this.audioSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))}),this.subtitleSegmentLoader_.on(t,n=>{this.player_.trigger(ze({},n))})})}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 n=t.end(0);let r=n;if(e.start){const i=e.start.timeOffset;i<0?r=Math.max(n+i,t.start(0)):r=Math.min(n,i)}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 t=this.syncController_.getExpiredTime(e,this.duration());if(t===null)return!1;const n=Bs.Playlist.playlistEnd(e,t),r=this.tech_.currentTime(),i=this.tech_.buffered();if(!i.length)return n-r<=ns;const a=i.end(i.length-1);return a-r<=ns&&n-a<=ns}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:n}){if(e=e||this.mainPlaylistLoader_.media(),n=n||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,i=r.filter(Eo),a=i.length===1&&i[0]===e;if(r.length===1&&n!==1/0)return P.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 w=this.pathwayAttribute_(e),b=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(w),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(w)},b);return}let S=!1;r.forEach(w=>{if(w===e)return;const b=w.excludeUntil;typeof b<"u"&&b!==1/0&&(S=!0,delete w.excludeUntil)}),S&&(P.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+n*1e3,e.excludeUntil=o,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const c=this.selectPlaylist();if(!c){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const h=t.internal?this.logger_:P.log.warn,m=t.message?" "+t.message:"";h(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${c.id}.`),c.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),c.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const _=c.targetDuration/2*1e3||5*1e3,T=typeof c.lastRequest=="number"&&Date.now()-c.lastRequest<=_;return this.switchMedia_(c,"exclude",a||T)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const n=[],r=e==="all";(r||e==="main")&&n.push(this.mainPlaylistLoader_);const i=[];(r||e==="audio")&&i.push("AUDIO"),(r||e==="subtitle")&&(i.push("CLOSED-CAPTIONS"),i.push("SUBTITLES")),i.forEach(a=>{const o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&n.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&n.push(o)}),n.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=Un(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:Bs.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const n=e.media();if(!n)return null;const r=this.syncController_.getMediaSequenceSync(t);if(r&&r.isReliable){const o=r.start,c=r.end;if(!isFinite(o)||!isFinite(c))return null;const h=Bs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n),m=Math.max(0,c-h);return m<o?null:ct([[o,m]])}const i=this.syncController_.getExpiredTime(n,this.duration());if(i===null)return null;const a=Bs.Playlist.seekable(n,i,Bs.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,n));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const n=e.start(0),r=e.end(0),i=t.start(0),a=t.end(0);return i>r||n>a?e:ct([[Math.max(n,i),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 n=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||n&&n.length&&this.seekable_.length&&n.start(0)===this.seekable_.start(0)&&n.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Xf(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 n=Bs.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(n=Math.max(n,t.end(t.length-1))),this.mediaSource.duration!==n&&this.sourceUpdater_.setDuration(n)}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 n in t)t[n].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_(),n=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!n)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const n=ii(this.main(),t),r={},i=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(r.video=n.video||e.main.videoCodec||uT),e.main.isMuxed&&(r.video+=`,${n.audio||e.main.audioCodec||vu}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||i)&&(r.audio=n.audio||e.main.audioCodec||e.audio.audioCodec||vu,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=(h,m)=>h?ei(m,this.usingManagedMediaSource_):el(m),o={};let c;if(["video","audio"].forEach(function(h){if(r.hasOwnProperty(h)&&!a(e[h].isFmp4,r[h])){const m=e[h].isFmp4?"browser":"muxer";o[m]=o[m]||[],o[m].push(r[h]),h==="audio"&&(c=m)}}),i&&c&&t.attributes.AUDIO){const h=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===h&&m!==t&&(m.excludeUntil=1/0)}),this.logger_(`excluding audio group ${h} as ${c} does not support codec(s): "${r.audio}"`)}if(Object.keys(o).length){const h=Object.keys(o).reduce((m,_)=>(m&&(m+=", "),m+=`${_} does not support codec(s): "${o[_].join(",")}"`,m),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:h},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const h=[];if(["video","audio"].forEach(m=>{const _=(Jt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,T=(Jt(r[m]||"")[0]||{}).type;_&&T&&_.toLowerCase()!==T.toLowerCase()&&h.push(`"${this.sourceUpdater_.codecs[m]}" -> "${r[m]}"`)}),h.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${h.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(n=>{const r=e[n];if(t.indexOf(r.id)!==-1)return;t.push(r.id);const i=ii(this.main,r),a=[];i.audio&&!el(i.audio)&&!ei(i.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${i.audio}`),i.video&&!el(i.video)&&!ei(i.video,this.usingManagedMediaSource_)&&a.push(`video codec ${i.video}`),i.text&&i.text==="stpp.ttml.im1t"&&a.push(`text codec ${i.text}`),a.length&&(r.excludeUntil=1/0,this.logger_(`excluding ${r.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],n=this.main().playlists,r=za(Jt(e)),i=wh(r),a=r.video&&Jt(r.video)[0]||null,o=r.audio&&Jt(r.audio)[0]||null;Object.keys(n).forEach(c=>{const h=n[c];if(t.indexOf(h.id)!==-1||h.excludeUntil===1/0)return;t.push(h.id);const m=[],_=ii(this.mainPlaylistLoader_.main,h),T=wh(_);if(!(!_.audio&&!_.video)){if(T!==i&&m.push(`codec count "${T}" !== "${i}"`),!this.sourceUpdater_.canChangeType()){const S=_.video&&Jt(_.video)[0]||null,w=_.audio&&Jt(_.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${S.type}" !== "${a.type}"`),w&&o&&w.type.toLowerCase()!==o.type.toLowerCase()&&m.push(`audio codec "${w.type}" !== "${o.type}"`)}m.length&&(h.excludeUntil=1/0,this.logger_(`excluding ${h.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const n=this.seekable();n.length&&(t=n.start(0)),kw(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Je.GOAL_BUFFER_LENGTH,n=Je.GOAL_BUFFER_LENGTH_RATE,r=Math.max(t,Je.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*n,r)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Je.BUFFER_LOW_WATER_LINE,n=Je.BUFFER_LOW_WATER_LINE_RATE,r=Math.max(t,Je.MAX_BUFFER_LOW_WATER_LINE),i=Math.max(t,Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*n,this.bufferBasedABR?i:r)}bufferHighWaterLine(){return Je.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){Ih(this.inbandTextTracks_,"com.apple.streaming",this.tech_),iw({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,n){const r=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();Ih(this.inbandTextTracks_,e,this.tech_),sw({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:r,videoDuration:n})}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(e=>{this.contentSteeringController_.on(e,t=>{this.trigger(ze({},t))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const e=this.main();(this.contentSteeringController_.didDASHTagChange(e.uri,e.contentSteering)||(()=>{const t=this.contentSteeringController_.getAvailablePathways(),n=[];for(const r of e.playlists){const i=r.attributes.serviceLocation;if(i&&(n.push(i),!t.has(i)))return!0}return!!(!n.length&&t.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const t=this.main().playlists,n=new Set;let r=!1;Object.keys(t).forEach(i=>{const a=t[i],o=this.pathwayAttribute_(a),c=o&&e!==o;a.excludeUntil===1/0&&a.lastExcludeReason_==="content-steering"&&!c&&(delete a.excludeUntil,delete a.lastExcludeReason_,r=!0);const h=!a.excludeUntil&&a.excludeUntil!==1/0;!n.has(a.id)&&c&&h&&(n.add(a.id),a.excludeUntil=1/0,a.lastExcludeReason_="content-steering",this.logger_(`excluding ${a.id} for ${a.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(i=>{const a=this.mediaTypes_[i];if(a.activePlaylistLoader){const o=a.activePlaylistLoader.media_;o&&o.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const e=this.main().playlists,t=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(t&&t.size||n&&n.size){for(const[r,i]of t.entries())n.get(r)||(this.mainPlaylistLoader_.updateOrDeleteClone(i),this.contentSteeringController_.excludePathway(r));for(const[r,i]of n.entries()){const a=t.get(r);if(!a){e.filter(o=>o.attributes["PATHWAY-ID"]===i["BASE-ID"]).forEach(o=>{this.mainPlaylistLoader_.addClonePathway(i,o)}),this.contentSteeringController_.addAvailablePathway(r);continue}this.equalPathwayClones_(a,i)||(this.mainPlaylistLoader_.updateOrDeleteClone(i,!0),this.contentSteeringController_.addAvailablePathway(r))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...n])))}}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 n=e["URI-REPLACEMENT"].PARAMS,r=t["URI-REPLACEMENT"].PARAMS;for(const i in n)if(n[i]!==r[i])return!1;for(const i in r)if(n[i]!==r[i])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(n=>{const r=this.mainPlaylistLoader_.getKeyIdSet(n);!r||!r.size||r.forEach(i=>{const a="usable",o=this.keyStatusMap_.has(i)&&this.keyStatusMap_.get(i)===a,c=n.lastExcludeReason_===t&&n.excludeUntil===1/0;o?o&&c&&(delete n.excludeUntil,delete n.lastExcludeReason_,this.logger_(`enabling playlist ${n.id} because key ID ${i} is ${a}`)):(n.excludeUntil!==1/0&&n.lastExcludeReason_!==t&&(n.excludeUntil=1/0,n.lastExcludeReason_=t,this.logger_(`excluding playlist ${n.id} because the key ID ${i} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(n=>{const r=n&&n.attributes&&n.attributes.RESOLUTION&&n.attributes.RESOLUTION.height<720,i=n.excludeUntil===1/0&&n.lastExcludeReason_===t;r&&i&&(delete n.excludeUntil,P.log.warn(`enabling non-HD playlist ${n.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:Aw(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 Kw=(s,e,t)=>n=>{const r=s.main.playlists[e],i=rd(r),a=Eo(r);if(typeof n>"u")return a;n?delete r.disabled:r.disabled=!0;const o={renditionInfo:{id:e,bandwidth:r.attributes.BANDWIDTH,resolution:r.attributes.RESOLUTION,codecs:r.attributes.CODECS},cause:"fast-quality"};return n!==a&&!i&&(n?(t(r),s.trigger({type:"renditionenabled",metadata:o})):s.trigger({type:"renditiondisabled",metadata:o})),n};class Qw{constructor(e,t,n){const{playlistController_:r}=e,i=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=ii(r.main(),t),this.playlist=t,this.id=n,this.enabled=Kw(e.playlists,t.id,i)}}const Jw=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=Si(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(n=>!rd(n)).map((n,r)=>new Qw(s,n,n.id)):[]}},Fh=["seeking","seeked","pause","playing","error"];class Zw extends P.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_=jt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),n=()=>this.monitorCurrentTime_(),r=()=>this.techWaiting_(),i=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],c={};o.forEach(m=>{c[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",c[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",c[m].reset),this.tech_.on(["seeked","seeking"],c[m].reset)});const h=m=>{["main","audio"].forEach(_=>{a[`${_}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),h("off"))},this.clearSeekingAppendCheck_=()=>h("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),h("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",r),this.tech_.on(Fh,i),this.tech_.on("canplay",n),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",r),this.tech_.off(Fh,i),this.tech_.off("canplay",n),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.forEach(m=>{a[`${m}SegmentLoader_`].off("appendsdone",c[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",c[m].reset),this.tech_.off(["seeked","seeking"],c[m].reset)}),this.checkCurrentTimeTimeout_&&I.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&I.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=I.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_,n=t[`${e}SegmentLoader_`],r=n.buffered_(),i=US(this[`${e}Buffered_`],r);if(this[`${e}Buffered_`]=r,i){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:n.playlist_&&n.playlist_.id,buffered:ln(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+ns>=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(ct([this.lastRecordedTime,e]));const n={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:n}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const e=this.seekable(),t=this.tech_.currentTime(),n=this.afterSeekableWindow_(e,t,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=e.end(e.length-1)),this.beforeSeekableWindow_(e,t)){const S=e.start(0);r=S+(S===e.end(0)?0:ns)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${t} with seekable range ${Xf(e)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const i=this.playlistController_.sourceUpdater_,a=this.tech_.buffered(),o=i.audioBuffer?i.audioBuffered():null,c=i.videoBuffer?i.videoBuffered():null,h=this.media(),m=h.partTargetDuration?h.partTargetDuration:(h.targetDuration-ss)*2,_=[o,c];for(let S=0;S<_.length;S++)if(_[S]&&sd(_[S],t)<m)return!1;const T=ia(a,t);return T.length===0?!1:(r=T.start(0)+ns,this.logger_(`Buffered region starts (${T.start(0)}) just beyond seek point (${t}). Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),n=Un(t,e);if(n.length&&e+3<=n.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${n.start(0)} -> ${n.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 a=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${a}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(a),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const n=this.tech_.vhs.playlistController_.sourceUpdater_,r=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:n.audioBuffered(),videoBuffered:n.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const i=ia(r,t);return i.length>0?(this.logger_(`Stopped at ${t} and seeking to ${i.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,n,r=!1){if(!e.length)return!1;let i=e.end(e.length-1)+ns;const a=!n.endList,o=typeof n.partTargetDuration=="number";return a&&(o||r)&&(i=e.end(e.length-1)+n.targetDuration*3),t>i}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:n}){if(!e)return;let r;if(e.length&&t.length){const i=Un(e,n-3),a=Un(e,n),o=Un(t,n);o.length&&!a.length&&i.length&&(r={start:i.end(0),end:o.end(0)})}else ia(e,n).length||(r=this.gapFromVideoUnderflow_(e,n));return r?(this.logger_(`Encountered a gap in video from ${r.start} to ${r.end}. Seeking to current time ${n}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),n=this.tech_.currentTime(),r=ia(t,n);if(this.resetTimeUpdate_(),r.length===0||n!==e)return;this.logger_("skipTheGap_:","currentTime:",n,"scheduled currentTime:",e,"nextRange start:",r.start(0)),this.tech_.setCurrentTime(r.start(0)+ss);const i={gapInfo:{from:n,to:r.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:i}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const n=NS(e);for(let r=0;r<n.length;r++){const i=n.start(r),a=n.end(r);if(t-i<4&&t-i>2)return{start:i,end:a}}return null}}const ek={errorInterval:30,getSource(s){const e=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(e)}},Bg=function(s,e){let t=0,n=0;const r=ve(ek,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const i=function(){n&&s.currentTime(n)},a=function(m){m!=null&&(n=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",i),s.src(m),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},o=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"){P.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),r.getSource.call(s,a)},c=function(){s.off("loadedmetadata",i),s.off("error",o),s.off("dispose",c)},h=function(m){c(),Bg(s,m)};s.on("error",o),s.on("dispose",c),s.reloadSourceOnError=h},tk=function(s){Bg(this,s)};var Fg="3.16.2",sk="7.1.0",nk="1.3.1",rk="7.2.0",ik="4.0.2";const Fe={PlaylistLoader:Bn,Playlist:Et,utils:oE,STANDARD_PLAYLIST_SELECTOR:Ch,INITIAL_PLAYLIST_SELECTOR:QE,lastBandwidthSelector:Ch,movingAverageBandwidthSelector:YE,comparePlaylistBandwidth:od,comparePlaylistResolution:XE,xhr:ug()};Object.keys(Je).forEach(s=>{Object.defineProperty(Fe,s,{get(){return P.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),Je[s]},set(e){if(P.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){P.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}Je[s]=e}})});const jg="videojs-vhs",qg=function(s,e){const t=e.media();let n=-1;for(let r=0;r<s.length;r++)if(s[r].id===t.id){n=r;break}s.selectedIndex_=n,s.trigger({selectedIndex:n,type:"change"})},ak=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),qg(s,e.playlists)};Fe.canPlaySource=function(){return P.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const ok=(s,e,t)=>{if(!s)return s;let n={};e&&e.attributes&&e.attributes.CODECS&&(n=za(Jt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(n.audio=t.attributes.CODECS);const r=Xn(n.video),i=Xn(n.audio),a={};for(const o in s)a[o]={},i&&(a[o].audioContentType=i),r&&(a[o].videoContentType=r),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof s[o]=="string"&&(a[o].url=s[o]);return ve(s,a)},lk=(s,e)=>s.reduce((t,n)=>{if(!n.contentProtection)return t;const r=e.reduce((i,a)=>{const o=n.contentProtection[a];return o&&o.pssh&&(i[a]={pssh:o.pssh}),i},{});return Object.keys(r).length&&t.push(r),t},[]),ck=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:n})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const r=t?n.concat([t]):n,i=lk(r,Object.keys(e)),a=[],o=[];return i.forEach(c=>{o.push(new Promise((h,m)=>{s.tech_.one("keysessioncreated",h)})),a.push(new Promise((h,m)=>{s.eme.initializeMediaKeys({keySystems:c},_=>{if(_){m(_);return}h()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},dk=({player:s,sourceKeySystems:e,media:t,audioMedia:n})=>{const r=ok(e,t,n);return r?(s.currentSource().keySystems=r,r&&!s.eme?(P.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Vg=()=>{if(!I.localStorage)return null;const s=I.localStorage.getItem(jg);if(!s)return null;try{return JSON.parse(s)}catch{return null}},uk=s=>{if(!I.localStorage)return!1;let e=Vg();e=e?ve(e,s):s;try{I.localStorage.setItem(jg,JSON.stringify(e))}catch{return!1}return e},hk=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,$g=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},Hg=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},Wg=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},zg=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Fe.supportsNativeHls=function(){if(!X||!X.createElement)return!1;const s=X.createElement("video");return P.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(e){return/maybe|probably/i.test(s.canPlayType(e))}):!1}();Fe.supportsNativeDash=function(){return!X||!X.createElement||!P.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(X.createElement("video").canPlayType("application/dash+xml"))}();Fe.supportsTypeNatively=s=>s==="hls"?Fe.supportsNativeHls:s==="dash"?Fe.supportsNativeDash:!1;Fe.isSupported=function(){return P.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Fe.xhr.onRequest=function(s){$g(Fe.xhr,s)};Fe.xhr.onResponse=function(s){Hg(Fe.xhr,s)};Fe.xhr.offRequest=function(s){Wg(Fe.xhr,s)};Fe.xhr.offResponse=function(s){zg(Fe.xhr,s)};const pk=P.getComponent("Component");class Gg extends pk{constructor(e,t,n){if(super(t,n.vhs),typeof n.initialBandwidth=="number"&&(this.options_.bandwidth=n.initialBandwidth),this.logger_=jt("VhsHandler"),t.options_&&t.options_.playerId){const r=P.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(X,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],r=>{const i=X.fullscreenElement||X.webkitFullscreenElement||X.mozFullScreenElement||X.msFullscreenElement;i&&i.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_=ve(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_.useBandwidthFromLocalStorage=typeof this.source_.useBandwidthFromLocalStorage<"u"?this.source_.useBandwidthFromLocalStorage:this.options_.useBandwidthFromLocalStorage||!1,this.options_.useForcedSubtitles=this.options_.useForcedSubtitles||!1,this.options_.useNetworkInformationApi=this.options_.useNetworkInformationApi||!1,this.options_.useDtsForTimestampOffset=this.options_.useDtsForTimestampOffset||!1,this.options_.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 n=Vg();n&&n.bandwidth&&(this.options_.bandwidth=n.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),n&&n.throughput&&(this.options_.throughput=n.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=Je.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===Je.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(n=>{typeof this.source_[n]<"u"&&(this.options_[n]=this.source_[n])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;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=hk(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Fe,this.options_.sourceType=Mp(t),this.options_.seekTo=i=>{this.tech_.setCurrentTime(i)},this.options_.player_=this.player_,this.playlistController_=new Yw(this.options_);const n=ve({liveRangeSafeTimeDelta:ns},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new Zw(n),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const i=P.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}),i.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(i){this.playlistController_.selectPlaylist=i.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(i){this.playlistController_.mainSegmentLoader_.throughput.rate=i,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let i=this.playlistController_.mainSegmentLoader_.bandwidth;const a=I.navigator.connection||I.navigator.mozConnection||I.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const c=a.downlink*1e3*1e3;c>=o&&i>=o?i=Math.max(i,c):i=c}return i},set(i){this.playlistController_.mainSegmentLoader_.bandwidth=i,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const i=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(i+a))},set(){P.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:()=>ln(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:()=>ln(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&&uk({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{Jw(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_=I.URL.createObjectURL(this.playlistController_.mediaSource),(P.browser.IS_ANY_SAFARI||P.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"),ck({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=dk({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",n=>{this.playlistController_.updatePlaylistByKeyStatus(n.keyId,n.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=P.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{ak(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{qg(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Fg,"mux.js":sk,"mpd-parser":nk,"m3u8-parser":rk,"aes-decrypter":ik}}version(){return this.constructor.version()}canChangeType(){return Ng.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_&&I.URL.revokeObjectURL&&(I.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return mE({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,n=!0,r=2){return gg({programTime:e,playlist:this.playlistController_.media(),retryCount:r,pauseAfterSeek:n,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{$g(this.xhr,e)},this.xhr.onResponse=e=>{Hg(this.xhr,e)},this.xhr.offRequest=e=>{Wg(this.xhr,e)},this.xhr.offResponse=e=>{zg(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(n=>{this.playlistController_.on(n,r=>{this.player_.trigger(ze({},r))})}),t.forEach(n=>{this.playbackWatcher_.on(n,r=>{this.player_.trigger(ze({},r))})})}}const Ya={name:"videojs-http-streaming",VERSION:Fg,canHandleSource(s,e={}){const t=ve(P.options,e);return!t.vhs.experimentalUseMMS&&!ei("avc1.4d400d,mp4a.40.2",!1)?!1:Ya.canPlayType(s.type,t)},handleSource(s,e,t={}){const n=ve(P.options,t);return e.vhs=new Gg(s,e,n),e.vhs.xhr=ug(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=Mp(s);if(!t)return"";const n=Ya.getOverrideNative(e);return!Fe.supportsTypeNatively(t)||n?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(P.browser.IS_ANY_SAFARI||P.browser.IS_IOS),{overrideNative:n=t}=e;return n}},mk=()=>ei("avc1.4d400d,mp4a.40.2",!0);mk()&&P.getTech("Html5").registerSourceHandler(Ya,0);P.VhsHandler=Gg;P.VhsSourceHandler=Ya;P.Vhs=Fe;P.use||P.registerComponent("Vhs",Fe);P.options.vhs=P.options.vhs||{};(!P.getPlugin||!P.getPlugin("reloadSourceOnError"))&&P.registerPlugin("reloadSourceOnError",tk);const fk=(s,e)=>{const t=goog.pal,n=new t.ConsentSettings;n.allowStorage=!1;const r=new t.NonceLoader(n);return async()=>{try{const i=new URL(e),a=new t.NonceRequest;let o=localStorage.getItem("sl-device-id")||ye.v4(),c=sessionStorage.getItem("sl-ad-session-id");c||(c=ye.v4(),sessionStorage.setItem("sl-ad-session-id",c)),dp(o)||(o=ba(`https://${o}`,ba.URL)),a.adWillAutoPlay=i.searchParams.get("vpa")==="auto",a.adWillPlayMuted=i.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=i.searchParams.get("description_url")||"",a.iconsSupported=!0,a.sessionId=o,a.supportedApiFrameworks="2,7,9",a.videoHeight=s.clientHeight,a.videoWidth=s.clientWidth;const h=await r.loadNonceManager(a);return i.searchParams.set("givn",h.getNonce()),i.searchParams.get("is_lat")==="[placeholder]"&&i.searchParams.set("is_lat","1"),i.searchParams.get("rdid")==="[placeholder]"&&i.searchParams.set("rdid",o),i.searchParams.get("correlator")==="[placeholder]"&&i.searchParams.set("correlator",c),i}catch(i){console.log("AdsManager could not be started",i);return}}};/*! @name videojs-contrib-ads @version 7.5.2 @license Apache-2.0 */var Xg="7.5.2";function gk(s){return{disableNextSnapshotRestore:!1,_contentEnding:!1,_contentHasEnded:!1,_hasThereBeenALoadStartDuringPlayerLife:!1,_hasThereBeenALoadedData:!1,_hasThereBeenALoadedMetaData:!1,_inLinearAdMode:!1,_shouldBlockPlay:!1,_playBlocked:!1,_playRequested:!1,_error:null,adType:null,VERSION:Xg,reset:function(){s.ads.disableNextSnapshotRestore=!1,s.ads._contentEnding=!1,s.ads._contentHasEnded=!1,s.ads.snapshot=null,s.ads.adType=null,s.ads._hasThereBeenALoadedData=!1,s.ads._hasThereBeenALoadedMetaData=!1,s.ads._cancelledPlay=!1,s.ads._shouldBlockPlay=!1,s.ads._playBlocked=!1,s.ads.nopreroll_=!1,s.ads.nopostroll_=!1,s.ads._playRequested=!1,s.ads._error=null},startLinearAdMode:function(){s.ads._state.startLinearAdMode()},endLinearAdMode:function(){s.ads._state.endLinearAdMode()},skipLinearAdMode:function(){s.ads._state.skipLinearAdMode()},stitchedAds:function(e){return e!==void 0&&(P.log.warn("Using player.ads.stitchedAds() as a setter is deprecated, it should be set as an option upon initialization of contrib-ads."),this.settings.stitchedAds=!!e),this.settings.stitchedAds},videoElementRecycled:function(){if(s.ads.shouldPlayContentBehindAd(s))return!1;if(!this.snapshot)throw new Error("You cannot use videoElementRecycled while there is no snapshot.");var e=s.tech_.src()!==this.snapshot.src,t=s.currentSrc()!==this.snapshot.currentSrc;return e||t},isLive:function(e){return e===void 0&&(e=s),typeof e.ads.settings.contentIsLive=="boolean"?e.ads.settings.contentIsLive:e.duration()===1/0?!0:P.browser.IOS_VERSION==="8"&&e.duration()===0},shouldPlayContentBehindAd:function(e){if(e===void 0&&(e=s),e)return e.ads.settings.liveCuePoints?!P.browser.IS_IOS&&!P.browser.IS_ANDROID&&e.duration()===1/0:!1;throw new Error("shouldPlayContentBehindAd requires a player as a param")},shouldTakeSnapshots:function(e){return e===void 0&&(e=s),!this.shouldPlayContentBehindAd(e)&&!this.stitchedAds()},isInAdMode:function(){return this._state.isAdState()},isWaitingForAdBreak:function(){return this._state.isWaitingForAdBreak()},isContentResuming:function(){return this._state.isContentResuming()},isAdPlaying:function(){return this._state.inAdBreak()},inAdBreak:function(){return this._state.inAdBreak()},removeNativePoster:function(){var e=s.$(".vjs-tech");e&&e.removeAttribute("poster")},debug:function(){if(this.settings.debug){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t.length===1&&typeof t[0]=="string"?P.log("ADS: "+t[0]):P.log.apply(P,["ADS:"].concat(t))}},error:function(e){if(e===void 0)return this._error||null;if(e===null||!e.errorType){this._error=null;return}this._error=e,P.log.error("An error with Ads occured. Type: "+e.errorType+"."),s.trigger({type:"vjsadserror",error:this._error})}}}var Yg=function(s,e){e.isImmediatePropagationStopped=function(){return!0},e.cancelBubble=!0,e.isPropagationStopped=function(){return!0}},us=function(s,e,t){Yg(s,t),s.trigger({type:e+t.type,originalEvent:t})},yk=function(s,e){s.ads.isInAdMode()&&(s.ads.isContentResuming()?s.ads._contentEnding&&us(s,"content",e):us(s,"ad",e))},_k=function(s,e){s.ads.isInAdMode()?s.ads.isContentResuming()?(Yg(s,e),s.trigger("resumeended")):us(s,"ad",e):!s.ads._contentHasEnded&&!s.ads.stitchedAds()&&(us(s,"content",e),s.trigger("readyforpostroll"))},vk=function(s,e){if(!(e.type==="loadstart"&&!s.ads._hasThereBeenALoadStartDuringPlayerLife||e.type==="loadeddata"&&!s.ads._hasThereBeenALoadedData||e.type==="loadedmetadata"&&!s.ads._hasThereBeenALoadedMetaData))if(s.ads.inAdBreak())us(s,"ad",e);else{if(s.currentSrc()!==s.ads.contentSrc)return;us(s,"content",e)}},bk=function(s,e){s.ads.inAdBreak()?us(s,"ad",e):s.ads.isContentResuming()&&us(s,"content",e)};function Tk(s){s.type==="playing"?yk(this,s):s.type==="ended"?_k(this,s):s.type==="loadstart"||s.type==="loadeddata"||s.type==="loadedmetadata"?vk(this,s):s.type==="play"?bk(this,s):this.ads.isInAdMode()&&(this.ads.isContentResuming()?us(this,"content",s):us(this,"ad",s))}function Ak(s){s.ads.contentSrc=s.currentSrc(),s.ads._seenInitialLoadstart=!1;var e=function(){if(!s.ads.inAdBreak()){var t=s.currentSrc();t!==s.ads.contentSrc&&(s.ads._seenInitialLoadstart&&s.trigger({type:"contentchanged"}),s.trigger({type:"contentupdate",oldValue:s.ads.contentSrc,newValue:t}),s.ads.contentSrc=t),s.ads._seenInitialLoadstart=!0}};s.on("loadstart",e)}function Jl(){return Jl=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(s[n]=t[n])}return s},Jl.apply(this,arguments)}function Rt(s,e){s.prototype=Object.create(e.prototype),s.prototype.constructor=s,Zl(s,e)}function Zl(s,e){return Zl=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,n){return t.__proto__=n,t},Zl(s,e)}var Kg={},Sk=function(s){if(P.dom.isInFrame()&&typeof I.__tcfapi!="function"){for(var e=I,t,n={};e;){try{if(e.frames.__tcfapiLocator){t=e;break}}catch{}if(e===I.top)break;e=e.parent}if(!t)return;I.__tcfapi=function(r,i,a,o){var c=Math.random()+"",h={__tcfapiCall:{command:r,parameter:o,version:i,callId:c}};n[c]=a,t.postMessage(h,"*")},I.addEventListener("message",function(r){var i={};try{i=typeof r.data=="string"?JSON.parse(r.data):r.data}catch{}var a=i.__tcfapiReturn;a&&typeof n[a.callId]=="function"&&(n[a.callId](a.returnValue,a.success),n[a.callId]=null)},!1)}},jh=function(){Sk(),typeof I.__tcfapi=="function"&&I.__tcfapi("addEventListener",2,function(s,e){e&&(Kg=s)})},Ek=function(s){for(var e=s.parent;e!==s.top;){try{if(e.frames&&e.frames.__uspapiLocator)return e}catch{}e=e.parent}try{if(s.top.frames&&s.top.frames.__uspapiLocator)return s.top}catch{}return null},ec="",wk=function(){return ec},qh=function(s,e){if(e===void 0&&(e=I),e.__uspapi)e.__uspapi("getUSPData",1,function(a,o){var c=o?a.uspString:null;ec=c,s(c)});else{var t=Ek(e);if(!t){s(null);return}var n=Math.random().toString(36).substring(2),r={__uspapiCall:{command:"getUSPData",version:1,callId:n}},i=function a(o){if(o&&o.data&&o.data.__uspapiReturn&&o.data.__uspapiReturn.callId===n){e.removeEventListener("message",a,!1);var c=o.data.__uspapiReturn,h=c.returnValue,m=c.success,_=m?h.uspString:null;ec=_,s(_)}};e.addEventListener("message",i,!1),t.postMessage(r,"*")}},yn={AdsBeforePrerollError:"ads-before-preroll-error",AdsPrerollError:"ads-preroll-error",AdsMidrollError:"ads-midroll-error",AdsPostrollError:"ads-postroll-error",AdsMacroReplacementFailed:"ads-macro-replacement-failed",AdsResumeContentFailed:"ads-resume-content-failed"},Vh=function(s,e){return e?encodeURIComponent(s):s},kk=function(s,e,t){if(s&&s[t])for(var n=s[t],r=Object.keys(n),i=0;i<r.length;i++){var a="{mediainfo."+t+"."+r[i]+"}";e[a]=n[r[i]]}},Ck=function(s,e){var t={};return["description","tags","reference_id","ad_keys"].forEach(function(n){s&&s[n]?t["{mediainfo."+n+"}"]=s[n]:e["{mediainfo."+n+"}"]?t["{mediainfo."+n+"}"]=e["{mediainfo."+n+"}"]:t["{mediainfo."+n+"}"]=""}),["custom_fields","customFields"].forEach(function(n){kk(s,t,n)}),t},Ik=function(s){var e={},t=s.replace(/{([^}=]+)=([^}]*)}/g,function(n,r,i){return e["{"+r+"}"]=i,"{"+r+"}"});return{defaults:e,modifiedString:t}},xk=function(s){return{"{player.id}":s.options_["data-player"]||s.id_,"{player.height}":s.currentHeight(),"{player.width}":s.currentWidth(),"{player.heightInt}":Math.round(s.currentHeight()),"{player.widthInt}":Math.round(s.currentWidth()),"{player.autoplay}":s.autoplay()?1:0,"{player.muted}":s.muted()?1:0,"{player.language}":s.language()||"","{mediainfo.id}":s.mediainfo?s.mediainfo.id:"","{mediainfo.name}":s.mediainfo?s.mediainfo.name:"","{mediainfo.duration}":s.mediainfo?s.mediainfo.duration:"","{player.duration}":s.duration(),"{player.durationInt}":Math.round(s.duration()),"{player.live}":s.duration()===1/0?1:0,"{player.pageUrl}":P.dom.isInFrame()?X.referrer:I.location.href,"{playlistinfo.id}":s.playlistinfo?s.playlistinfo.id:"","{playlistinfo.name}":s.playlistinfo?s.playlistinfo.name:"","{timestamp}":new Date().getTime(),"{document.referrer}":X.referrer,"{window.location.href}":I.location.href,"{random}":Math.floor(Math.random()*1e12)}},Lk=function(s){var e={};return Object.keys(s).forEach(function(t){e["{tcf."+t+"}"]=s[t]}),e["{tcf.gdprAppliesInt}"]=s.gdprApplies?1:0,e},Pk=function(){return{"{usp.uspString}":wk()}},Rk=function(s,e,t){var n=new RegExp("{pageVariable\\.([^}]+)}","g"),r={},i=(s.match(n)||[]).concat(Object.keys(t).filter(function(a){return n.test(a)&&s.includes(t[a])}));if(i)return i.forEach(function(a){for(var o=a,c=a.slice(14,-1),h=c.split("."),m=I,_,T=0;T<h.length;T++)if(T===h.length-1)_=m[h[T]];else if(m=m[h[T]],typeof m>"u")break;var S=typeof _;_===null?r[o]="null":_===void 0?e[o]?r[o]=e[o]:(P.log.warn('Page variable "'+c+'" not found'),r[o]=""):S!=="string"&&S!=="number"&&S!=="boolean"?(P.log.warn('Page variable "'+c+'" is not a supported type'),r[o]=""):r[o]=_}),r},$h=function(s,e,t,n,r){n===void 0&&(n={});for(var i in e){var a=n.hasOwnProperty(i)?n[i]:i;if(a.startsWith("r:"))try{var o=new RegExp(a.slice(2),"g");s=s.replace(o,Vh(e[i],t))}catch(c){r.ads.error({errorType:yn.AdsMacroReplacementFailed,macro:i,error:c}),P.log.warn('Unable to replace macro with regex "'+a+'". The provided regex may be invalid.')}else s=s.split(a).join(Vh(e[i],t))}return s};function Dk(s,e,t){e===void 0&&(e=!1),t===void 0&&(t={});var n=t.disableDefaultMacros||!1,r=t.macroNameOverrides||{};delete t.disableDefaultMacros,delete t.macroNameOverrides;var i=t;if(n)return $h(s,i,e,r);var a=Ik(s),o=a.defaults,c=a.modifiedString;s=c,Jl(i,xk(this),Ck(this.mediainfo,o),Lk(Kg),Pk(),Rk(s,o,r)),s=$h(s,i,e,r,this);for(var h in o)s=s.replace(h,o[h]);return s}var _n={};_n.processMetadataTracks=function(s,e){for(var t=s.textTracks(),n=function(i){i.kind==="metadata"&&(s.ads.cueTextTracks.setMetadataTrackMode(i),e(s,i))},r=0;r<t.length;r++)n(t[r]);t.addEventListener("addtrack",function(i){n(i.track)})};_n.setMetadataTrackMode=function(s){};_n.getSupportedAdCue=function(s,e){return e};_n.isSupportedAdCue=function(s,e){return!0};_n.getCueId=function(s,e){return e.id};var Nk=function(s,e){return e!==void 0&&s.ads.includedCues[e]},Ok=function(s,e){e!==void 0&&e!==""&&(s.ads.includedCues[e]=!0)};_n.processAdTrack=function(s,e,t,n){s.ads.includedCues={};for(var r=0;r<e.length;r++){var i=e[r],a=this.getSupportedAdCue(s,i);if(!this.isSupportedAdCue(s,i)){P.log.warn("Skipping as this is not a supported ad cue.",i);return}var o=this.getCueId(s,i),c=i.startTime;if(Nk(s,o)){P.log("Skipping ad already seen with ID "+o);return}n&&n(s,a,o,c),t(s,a,o,c),Ok(s,o)}};function Mk(s,e){e&&P.log("Using cancelContentPlay to block content playback"),s.on("play",Uk)}function Uk(){this.ads._shouldBlockPlay!==!1&&(this.paused()||(this.ads.debug("Playback was canceled by cancelContentPlay"),this.pause()),this.ads._cancelledPlay=!0)}var gr={},an=P;gr.isMiddlewareMediatorSupported=function(){return an.browser.IS_IOS||an.browser.IS_ANDROID?!1:!!(an.use&&an.middleware&&an.middleware.TERMINATOR)};gr.playMiddleware=function(s){return{setSource:function(e,t){t(null,e)},callPlay:function(){if(s.ads&&s.ads._shouldBlockPlay===!0)return s.ads.debug("Using playMiddleware to block content playback"),s.ads._playBlocked=!0,an.middleware.TERMINATOR},play:function(e,t){s.ads&&s.ads._playBlocked&&e?(s.ads.debug("Play call to Tech was terminated."),s.trigger("play"),s.addClass("vjs-has-started"),s.ads._playBlocked=!1):t&&t.catch&&t.catch(function(n){n.name==="NotAllowedError"&&!P.browser.IS_SAFARI&&s.trigger("pause")})}}};gr.testHook=function(s){an=s};var Bk=gr.playMiddleware,Fk=gr.isMiddlewareMediatorSupported,jk=function(){if(P.getPlugin)return!!P.getPlugin("ads");var s=P.getComponent("Player");return!!(s&&s.prototype.ads)};function qk(s){if(jk())return!1;var e=P.registerPlugin||P.plugin;return e("ads",s),Fk()&&!P.usingContribAdsMiddleware_&&(P.use("*",Bk),P.usingContribAdsMiddleware_=!0,P.log.debug("Play middleware has been registered with videojs")),!0}var Vk={src:"data:video/mp4;base64,AAAAIGZ0eXBpc29tAAACAGlzb21pc28yYXZjMW1wNDEAAAAIZnJlZQAAAxJtZGF03ABMYXZjNjEuMy4xMDAAQiAIwRg4AAACrgYF//+q3EXpvebZSLeWLNgg2SPu73gyNjQgLSBjb3JlIDE2NCByMzEwOCAzMWUxOWY5IC0gSC4yNjQvTVBFRy00IEFWQyBjb2RlYyAtIENvcHlsZWZ0IDIwMDMtMjAyMyAtIGh0dHA6Ly93d3cudmlkZW9sYW4ub3JnL3gyNjQuaHRtbCAtIG9wdGlvbnM6IGNhYmFjPTEgcmVmPTMgZGVibG9jaz0xOjA6MCBhbmFseXNlPTB4MzoweDExMyBtZT1oZXggc3VibWU9NyBwc3k9MSBwc3lfcmQ9MS4wMDowLjAwIG1peGVkX3JlZj0xIG1lX3JhbmdlPTE2IGNocm9tYV9tZT0xIHRyZWxsaXM9MSA4eDhkY3Q9MSBjcW09MCBkZWFkem9uZT0yMSwxMSBmYXN0X3Bza2lwPTEgY2hyb21hX3FwX29mZnNldD0tMiB0aHJlYWRzPTcgbG9va2FoZWFkX3RocmVhZHM9MSBzbGljZWRfdGhyZWFkcz0wIG5yPTAgZGVjaW1hdGU9MSBpbnRlcmxhY2VkPTAgYmx1cmF5X2NvbXBhdD0wIGNvbnN0cmFpbmVkX2ludHJhPTAgYmZyYW1lcz0zIGJfcHlyYW1pZD0yIGJfYWRhcHQ9MSBiX2JpYXM9MCBkaXJlY3Q9MSB3ZWlnaHRiPTEgb3Blbl9nb3A9MCB3ZWlnaHRwPTIga2V5aW50PTI1MCBrZXlpbnRfbWluPTI1IHNjZW5lY3V0PTQwIGludHJhX3JlZnJlc2g9MCByY19sb29rYWhlYWQ9NDAgcmM9Y3JmIG1idHJlZT0xIGNyZj0yMy4wIHFjb21wPTAuNjAgcXBtaW49MCBxcG1heD02OSBxcHN0ZXA9NCBpcF9yYXRpbz0xLjQwIGFxPTE6MS4wMACAAAAAOWWIhAAn//71sXwKaunqigzoMi7hlyTJrrYi4m0AwABFxzcqWKGahTaoBcQAAMWK4AlcFlIICBeldSEQBGCMHAAABVNtb292AAAAbG12aGQAAAAAAAAAAAAAAAAAAAPoAAAAIgABAAABAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAACQXRyYWsAAABcdGtoZAAAAAMAAAAAAAAAAAAAAAEAAAAAAAAAIgAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAEAAAAABQAAAAPAAAAAAACRlZHRzAAAAHGVsc3QAAAAAAAAAAQAAACIAAAAAAAEAAAAAAbltZGlhAAAAIG1kaGQAAAAAAAAAAAAAAAAAADwAAAACAFXEAAAAAAAtaGRscgAAAAAAAAAAdmlkZQAAAAAAAAAAAAAAAFZpZGVvSGFuZGxlcgAAAAFkbWluZgAAABR2bWhkAAAAAQAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABJHN0YmwAAADAc3RzZAAAAAAAAAABAAAAsGF2YzEAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAABQADwAEgAAABIAAAAAAAAAAEUTGF2YzYxLjMuMTAwIGxpYngyNjQAAAAAAAAAAAAAAAAY//8AAAA2YXZjQwFkAA3/4QAZZ2QADazZQUH7ARAAAAMAEAAAAwPA8UKZYAEABmjr48siwP34+AAAAAAQcGFzcAAAAAEAAAABAAAAFGJ0cnQAAAAAAALAEAACwBAAAAAYc3R0cwAAAAAAAAABAAAAAQAAAgAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAFHN0c3oAAAAAAAAC7wAAAAEAAAAUc3RjbwAAAAAAAAABAAAARQAAAj10cmFrAAAAXHRraGQAAAADAAAAAAAAAAAAAAACAAAAAAAAABgAAAAAAAAAAAAAAAEBAAAAAAEAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAkZWR0cwAAABxlbHN0AAAAAAAAAAEAAAAXAAAEAAABAAAAAAG1bWRpYQAAACBtZGhkAAAAAAAAAAAAAAAAAACsRAAACABVxAAAAAAALWhkbHIAAAAAAAAAAHNvdW4AAAAAAAAAAAAAAABTb3VuZEhhbmRsZXIAAAABYG1pbmYAAAAQc21oZAAAAAAAAAAAAAAAJGRpbmYAAAAcZHJlZgAAAAAAAAABAAAADHVybCAAAAABAAABJHN0YmwAAAB+c3RzZAAAAAAAAAABAAAAbm1wNGEAAAAAAAAAAQAAAAAAAAAAAAIAEAAAAACsRAAAAAAANmVzZHMAAAAAA4CAgCUAAgAEgICAF0AVAAAAAAH0AAAAEisFgICABRIQVuUABoCAgAECAAAAFGJ0cnQAAAAAAAH0AAAAEisAAAAYc3R0cwAAAAAAAAABAAAAAgAABAAAAAAcc3RzYwAAAAAAAAABAAAAAQAAAAEAAAABAAAAHHN0c3oAAAAAAAAAAAAAAAIAAAAVAAAABgAAABhzdGNvAAAAAAAAAAIAAAAwAAADNAAAABpzZ3BkAQAAAHJvbGwAAAACAAAAAf//AAAAHHNiZ3AAAAAAcm9sbAAAAAEAAAACAAAAAQAAAGF1ZHRhAAAAWW1ldGEAAAAAAAAAIWhkbHIAAAAAAAAAAG1kaXJhcHBsAAAAAAAAAAAAAAAALGlsc3QAAAAkqXRvbwAAABxkYXRhAAAAAQAAAABMYXZmNjEuMS4xMDA=",type:"video/mp4"},ue=function(){function s(){}return s.getState=function(e){if(e&&s.states_&&s.states_[e])return s.states_[e]},s.registerState=function(e,t){if(typeof e!="string"||!e)throw new Error('Illegal state name, "'+e+'"; must be a non-empty string.');return s.states_||(s.states_={}),s.states_[e]=t,t},s}(),ld=function(){s._getName=function(){return"Anonymous State"};function s(t){this.player=t}var e=s.prototype;return e.transitionTo=function(t){var n=this.player;this.cleanup(n);var r=new t(n);n.ads._state=r,n.ads.debug(this.constructor._getName()+" -> "+r.constructor._getName());for(var i=arguments.length,a=new Array(i>1?i-1:0),o=1;o<i;o++)a[o-1]=arguments[o];r.init.apply(r,[n].concat(a))},e.init=function(){},e.cleanup=function(){},e.onPlay=function(){},e.onPlaying=function(){},e.onEnded=function(){},e.onAdEnded=function(){},e.onAdsReady=function(){P.log.warn("Unexpected adsready event")},e.onAdsError=function(){},e.onAdsCanceled=function(){},e.onAdTimeout=function(){},e.onAdStarted=function(){},e.onAdSkipped=function(){},e.onContentChanged=function(){},e.onContentResumed=function(){},e.onReadyForPostroll=function(){P.log.warn("Unexpected readyforpostroll event")},e.onNoPreroll=function(){},e.onNoPostroll=function(){},e.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.endLinearAdMode=function(){P.log.warn("Unexpected endLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.skipLinearAdMode=function(){P.log.warn("Unexpected skipLinearAdMode invocation (State via "+this.constructor._getName()+")")},e.isAdState=function(){throw new Error("isAdState unimplemented for "+this.constructor._getName())},e.isWaitingForAdBreak=function(){return!1},e.isContentResuming=function(){return!1},e.inAdBreak=function(){return!1},e.handleEvent=function(t){var n=this.player;t==="play"?this.onPlay(n):t==="adsready"?this.onAdsReady(n):t==="adserror"?this.onAdsError(n):t==="adscanceled"?this.onAdsCanceled(n):t==="adtimeout"?this.onAdTimeout(n):t==="ads-ad-started"?this.onAdStarted(n):t==="ads-ad-skipped"?this.onAdSkipped(n):t==="contentchanged"?this.onContentChanged(n):t==="contentresumed"?this.onContentResumed(n):t==="readyforpostroll"?this.onReadyForPostroll(n):t==="playing"?this.onPlaying(n):t==="ended"?this.onEnded(n):t==="nopreroll"?this.onNoPreroll(n):t==="nopostroll"?this.onNoPostroll(n):t==="adended"&&this.onAdEnded(n)},s}();ue.registerState("State",ld);var $k=function(s){Rt(e,s);function e(n){var r;return r=s.call(this,n)||this,r.contentResuming=!1,r.waitingForAdBreak=!1,r}var t=e.prototype;return t.isAdState=function(){return!0},t.onPlaying=function(){var n=ue.getState("ContentPlayback");this.contentResuming&&this.transitionTo(n)},t.onContentResumed=function(){var n=ue.getState("ContentPlayback");this.contentResuming&&this.transitionTo(n)},t.isWaitingForAdBreak=function(){return this.waitingForAdBreak},t.isContentResuming=function(){return this.contentResuming},t.inAdBreak=function(){return this.player.ads._inLinearAdMode===!0},e}(ld);ue.registerState("AdState",$k);var Hk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}var t=e.prototype;return t.isAdState=function(){return!1},t.onContentChanged=function(n){var r=ue.getState("BeforePreroll"),i=ue.getState("Preroll");n.ads.debug("Received contentchanged event (ContentState)"),n.paused()?this.transitionTo(r):(this.transitionTo(i,!1),n.pause(),n.ads._pausedOnContentupdate=!0)},e}(ld);ue.registerState("ContentState",Hk);var Wk=ue.getState("ContentState"),zk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"AdsDone"};var t=e.prototype;return t.init=function(n){n.ads._contentHasEnded=!0,n.trigger("ended")},t.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (AdsDone)")},e}(Wk);ue.registerState("AdsDone",zk);var _l;function Gk(s){var e;P.browser.IS_IOS&&s.ads.isLive(s)&&s.seekable().length>0?e=s.currentTime()-s.seekable().end(0):e=s.currentTime();var t=s.$(".vjs-tech"),n=s.textTracks?s.textTracks():[],r=[],i={ended:s.ended(),currentSrc:s.currentSrc(),sources:s.currentSources(),src:s.tech_.src(),currentTime:e,type:s.currentType()};t&&(i.style=t.getAttribute("style"));for(var a=0;a<n.length;a++){var o=n[a];r.push({track:o,mode:o.mode}),o.mode="disabled"}return i.suppressedTracks=r,i}function Xk(s,e){var t=s.ads.snapshot;if(e===void 0&&(e=function(){}),s.ads.disableNextSnapshotRestore===!0){s.ads.disableNextSnapshotRestore=!1,delete s.ads.snapshot,e();return}var n=s.$(".vjs-tech"),r=20,i=t.suppressedTracks,a,o=function(){for(var _=0;_<i.length;_++)a=i[_],a.track.mode=a.mode},c=function(){var _;if(P.browser.IS_IOS&&s.ads.isLive(s)){if(t.currentTime<0&&(s.seekable().length>0?_=s.seekable().end(0)+t.currentTime:_=s.currentTime(),s.currentTime(_)),s.paused()){var T=s.play();T&&T.catch&&T.catch(function(w){P.log.warn("Play promise rejected in IOS snapshot resume",w)})}}else if(t.ended)s.currentTime(s.duration());else{s.currentTime(t.currentTime);var S=s.play();S&&S.catch&&S.catch(function(w){P.log.warn("Play promise rejected in snapshot resume",w)})}s.ads.shouldRemoveAutoplay_&&(s.autoplay(!1),s.ads.shouldRemoveAutoplay_=!1)},h=function _(){if(s.off("contentcanplay",_),_l&&s.clearTimeout(_l),n=s.el().querySelector(".vjs-tech"),n.readyState>1||n.seekable===void 0||n.seekable.length>0)return c();if(r--)s.setTimeout(_,50);else try{c()}catch(T){s.ads.error({errorType:yn.AdsResumeContentFailed,error:T}),P.log.warn("Failed to resume the content after an advertisement",T)}};if("style"in t&&n.setAttribute("style",t.style||""),s.ads.videoElementRecycled())s.one("resumeended",function(){delete s.ads.snapshot,e()}),s.one("contentloadedmetadata",o),P.browser.IS_IOS&&!s.autoplay()&&typeof s.techCall_=="function"&&(s.techCall_("setAutoplay",!0),s.ads.shouldRemoveAutoplay_=!0),s.src(t.sources),s.one("contentcanplay",h),_l=s.setTimeout(h,2e3);else{if(o(),!s.ended()){var m=s.play();m&&m.catch&&m.catch(function(_){P.log.warn("Play promise rejected in snapshot restore",_)})}delete s.ads.snapshot,e()}}function Yk(s){s.ads.debug("Starting ad break"),s.ads._inLinearAdMode=!0,s.trigger("adstart"),s.ads.shouldTakeSnapshots()&&(s.ads.snapshot=Gk(s)),s.ads.shouldPlayContentBehindAd(s)&&!s.ads.settings.stitchedAds&&(s.ads.preAdVolume_=s.volume(),s.volume(0)),s.addClass("vjs-ad-playing"),s.hasClass("vjs-live")&&s.removeClass("vjs-live"),s.ads.removeNativePoster(),s.ads.preAdPlaybackRate_=s.playbackRate(),s.playbackRate(1),s.controlBar&&s.controlBar.playbackRateMenuButton&&s.controlBar.playbackRateMenuButton.playbackRateSupported&&!s.controlBar.playbackRateMenuButton.hasClass("vjs-hidden")?(s.controlBar.playbackRateMenuButton.hide(),s.ads.showPlaybackMenuOnAdEnd_=!0):s.ads.showPlaybackMenuOnAdEnd_=!1}function Kk(s,e){s.ads.debug("Ending ad break"),e===void 0&&(e=function(){}),s.ads.adType=null,s.ads._inLinearAdMode=!1,s.trigger("adend"),s.removeClass("vjs-ad-playing"),s.ads.isLive(s)&&s.addClass("vjs-live"),s.ads.shouldTakeSnapshots()?Xk(s,e):(s.ads.preAdVolume_&&s.volume(s.ads.preAdVolume_),e()),s.playbackRate(s.ads.preAdPlaybackRate_),s.ads.showPlaybackMenuOnAdEnd_&&s.controlBar.playbackRateMenuButton.show()}var hs={start:Yk,end:Kk},Qk=ue.getState("AdState"),Jk=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Preroll"};var t=e.prototype;return t.init=function(n,r,i){if(this.waitingForAdBreak=!0,n.addClass("vjs-ad-loading"),i||n.ads.nopreroll_)return this.resumeAfterNoPreroll(n);var a=n.ads.settings.timeout;typeof n.ads.settings.prerollTimeout=="number"&&(a=n.ads.settings.prerollTimeout),this._timeout=n.setTimeout(function(){n.trigger("adtimeout")},a),r?this.handleAdsReady():this.adsReady=!1},t.onAdsReady=function(n){n.ads.inAdBreak()?P.log.warn("Unexpected adsready event (Preroll)"):(n.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},t.handleAdsReady=function(){this.adsReady=!0,this.readyForPreroll()},t.afterLoadStart=function(n){var r=this.player;r.ads._hasThereBeenALoadStartDuringPlayerLife?n():(r.ads.debug("Waiting for loadstart..."),r.one("loadstart",function(){r.ads.debug("Received loadstart event"),n()}))},t.noPreroll=function(){var n=this;this.afterLoadStart(function(){n.player.ads.debug("Skipping prerolls due to nopreroll event (Preroll)"),n.resumeAfterNoPreroll(n.player)})},t.readyForPreroll=function(){var n=this.player;this.afterLoadStart(function(){n.ads.debug("Triggered readyforpreroll event (Preroll)"),n.trigger("readyforpreroll")})},t.onAdsCanceled=function(n){var r=this;n.ads.debug("adscanceled (Preroll)"),this.afterLoadStart(function(){r.resumeAfterNoPreroll(n)})},t.onAdsError=function(n){var r=this;P.log("adserror (Preroll)"),n.ads.error({errorType:yn.AdsPrerollError}),this.inAdBreak()?n.ads.endLinearAdMode():this.afterLoadStart(function(){r.resumeAfterNoPreroll(n)})},t.startLinearAdMode=function(){var n=this.player;this.adsReady&&!n.ads.inAdBreak()&&!this.isContentResuming()?(this.clearTimeout(n),n.ads.adType="preroll",this.waitingForAdBreak=!1,hs.start(n),n.ads._shouldBlockPlay=!1):P.log.warn("Unexpected startLinearAdMode invocation (Preroll)")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(n.removeClass("vjs-ad-loading"),n.addClass("vjs-ad-content-resuming"),this.contentResuming=!0,hs.end(n))},t.skipLinearAdMode=function(){var n=this,r=this.player;r.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){r.trigger("adskip"),r.ads.debug("skipLinearAdMode (Preroll)"),n.resumeAfterNoPreroll(r)})},t.onAdTimeout=function(n){var r=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (Preroll)"),r.resumeAfterNoPreroll(n)})},t.onNoPreroll=function(n){n.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected nopreroll event (Preroll)"):this.noPreroll()},t.resumeAfterNoPreroll=function(n){if(this.contentResuming=!0,n.ads._shouldBlockPlay=!1,this.cleanupPartial(n),n.ads._playRequested||n.ads._pausedOnContentupdate)if(n.paused()){n.ads.debug("resumeAfterNoPreroll: attempting to resume playback (Preroll)");var r=n.play();r&&r.then&&r.then(null,function(i){})}else n.ads.debug("resumeAfterNoPreroll: already playing (Preroll)"),n.trigger("play"),n.trigger("playing")},t.cleanup=function(n){n.ads._hasThereBeenALoadStartDuringPlayerLife||P.log.warn("Leaving Preroll state before loadstart event can cause issues."),this.cleanupPartial(n)},t.cleanupPartial=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming"),this.clearTimeout(n)},t.clearTimeout=function(n){n.clearTimeout(this._timeout),this._timeout=null},e}(Qk);ue.registerState("Preroll",Jk);var Zk=ue.getState("ContentState"),eC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"BeforePreroll"};var t=e.prototype;return t.init=function(n){this.adsReady=!1,this.shouldResumeToContent=!1,n.ads._shouldBlockPlay=n.ads.settings.allowVjsAutoplay?!n.autoplay():!0},t.onAdsReady=function(n){n.ads.debug("Received adsready event (BeforePreroll)"),this.adsReady=!0},t.onPlay=function(n){var r=ue.getState("Preroll");n.ads.debug("Received play event (BeforePreroll)"),this.transitionTo(r,this.adsReady,this.shouldResumeToContent)},t.onAdsCanceled=function(n){n.ads.debug("adscanceled (BeforePreroll)"),this.shouldResumeToContent=!0},t.onAdsError=function(){this.player.ads.debug("adserror (BeforePreroll)"),this.player.ads.error({errorType:yn.AdsBeforePrerollError}),this.shouldResumeToContent=!0},t.onNoPreroll=function(){this.player.ads.debug("Skipping prerolls due to nopreroll event (BeforePreroll)"),this.shouldResumeToContent=!0},t.skipLinearAdMode=function(){var n=this.player;n.trigger("adskip"),n.ads.debug("skipLinearAdMode (BeforePreroll)"),this.shouldResumeToContent=!0},t.onContentChanged=function(){this.init(this.player)},e}(Zk);ue.registerState("BeforePreroll",eC);var tC=ue.getState("AdState"),sC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Midroll"};var t=e.prototype;return t.init=function(n){n.ads.adType="midroll",hs.start(n),n.addClass("vjs-ad-loading")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this.player;this.inAdBreak()&&(this.contentResuming=!0,n.addClass("vjs-ad-content-resuming"),n.removeClass("vjs-ad-loading"),hs.end(n))},t.onAdsError=function(n){n.ads.error({errorType:yn.AdsMidrollError}),this.inAdBreak()&&n.ads.endLinearAdMode()},t.cleanup=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming")},e}(tC);ue.registerState("Midroll",sC);var nC=ue.getState("AdState"),rC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"Postroll"};var t=e.prototype;return t.init=function(n){if(this.waitingForAdBreak=!0,n.ads._contentEnding=!0,n.ads.nopostroll_){this.resumeContent(n);var r=ue.getState("AdsDone");this.transitionTo(r)}else{n.addClass("vjs-ad-loading");var i=n.ads.settings.timeout;typeof n.ads.settings.postrollTimeout=="number"&&(i=n.ads.settings.postrollTimeout),this._postrollTimeout=n.setTimeout(function(){n.trigger("adtimeout")},i)}},t.startLinearAdMode=function(){var n=this.player;!n.ads.inAdBreak()&&!this.isContentResuming()?(n.ads.adType="postroll",n.clearTimeout(this._postrollTimeout),this.waitingForAdBreak=!1,hs.start(n)):P.log.warn("Unexpected startLinearAdMode invocation (Postroll)")},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.endLinearAdMode=function(){var n=this,r=this.player,i=ue.getState("AdsDone");this.inAdBreak()&&(r.removeClass("vjs-ad-loading"),this.resumeContent(r),hs.end(r,function(){n.transitionTo(i)}))},t.skipLinearAdMode=function(){var n=this.player;n.ads.inAdBreak()||this.isContentResuming()?P.log.warn("Unexpected skipLinearAdMode invocation"):(n.ads.debug("Postroll abort (skipLinearAdMode)"),n.trigger("adskip"),this.abort(n))},t.onAdTimeout=function(n){n.ads.debug("Postroll abort (adtimeout)"),this.abort(n)},t.onAdsError=function(n){n.ads.debug("Postroll abort (adserror)"),n.ads.error({errorType:yn.AdsPostrollError}),n.ads.inAdBreak()?n.ads.endLinearAdMode():this.abort(n)},t.onContentChanged=function(n){if(this.isContentResuming()){var r=ue.getState("BeforePreroll");this.transitionTo(r)}else if(!this.inAdBreak()){var i=ue.getState("Preroll");this.transitionTo(i)}},t.onNoPostroll=function(n){!this.isContentResuming()&&!this.inAdBreak()?this.abort(n):P.log.warn("Unexpected nopostroll event (Postroll)")},t.resumeContent=function(n){this.contentResuming=!0,n.addClass("vjs-ad-content-resuming")},t.abort=function(n){var r=ue.getState("AdsDone");this.resumeContent(n),n.removeClass("vjs-ad-loading"),this.transitionTo(r)},t.cleanup=function(n){n.removeClass("vjs-ad-content-resuming"),n.clearTimeout(this._postrollTimeout),n.ads._contentEnding=!1},e}(nC);ue.registerState("Postroll",rC);var iC=ue.getState("ContentState"),aC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"ContentPlayback"};var t=e.prototype;return t.init=function(n){n.ads._shouldBlockPlay=!1},t.onAdsReady=function(n){n.ads.debug("Received adsready event (ContentPlayback)"),n.ads.nopreroll_||(n.ads.debug("Triggered readyforpreroll event (ContentPlayback)"),n.trigger("readyforpreroll"))},t.onReadyForPostroll=function(n){var r=ue.getState("Postroll");n.ads.debug("Received readyforpostroll event"),this.transitionTo(r)},t.startLinearAdMode=function(){var n=ue.getState("Midroll");this.transitionTo(n)},e}(iC);ue.registerState("ContentPlayback",aC);var oC=ue.getState("ContentState"),lC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"StitchedContentPlayback"};var t=e.prototype;return t.init=function(){this.player.ads._shouldBlockPlay=!1},t.onContentChanged=function(){this.player.ads.debug("Received contentchanged event ("+this.constructor._getName()+")")},t.startLinearAdMode=function(){var n=ue.getState("StitchedAdRoll");this.transitionTo(n)},e}(oC);ue.registerState("StitchedContentPlayback",lC);var cC=ue.getState("AdState"),dC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"StitchedAdRoll"};var t=e.prototype;return t.init=function(){this.waitingForAdBreak=!1,this.contentResuming=!1,this.player.ads.adType="stitched",hs.start(this.player)},t.onPlaying=function(){},t.onContentResumed=function(){},t.onAdEnded=function(){this.endLinearAdMode(),this.player.trigger("ended")},t.endLinearAdMode=function(){var n=ue.getState("StitchedContentPlayback");hs.end(this.player),this.transitionTo(n)},e}(cC);ue.registerState("StitchedAdRoll",dC);var uC=ue.getState("AdState"),hC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamPending"};var t=e.prototype;return t.init=function(n){this.adsReady=!1},t.onPlay=function(n){var r=ue.getState("OutstreamPlayback");n.ads.debug("Received play event (OutstreamPending)"),this.transitionTo(r,this.adsReady)},t.onAdsReady=function(n){n.ads.debug("Received adsready event (OutstreamPending)"),this.adsReady=!0},t.onAdsError=function(){this.player.ads.debug("adserror (OutstreamPending)"),this.adsReady=!1},e}(uC);ue.registerState("OutstreamPending",hC);var pC=ue.getState("AdState"),mC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamPlayback"};var t=e.prototype;return t.init=function(n,r){n.addClass("vjs-ad-loading"),r?this.handleAdsReady():this.abort(n)},t.onAdsReady=function(n){n.ads.inAdBreak()?P.log.warn("Unexpected adsready event (Preroll)"):(n.ads.debug("Received adsready event (Preroll)"),this.handleAdsReady())},t.abort=function(n){var r=ue.getState("OutstreamDone");n.removeClass("vjs-ad-loading"),this.transitionTo(r)},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.handleAdsReady=function(){this.adsReady=!0,this.readyForOutstreamPlayback()},t.readyForOutstreamPlayback=function(){var n=this.player;this.afterLoadStart(function(){n.trigger("readyforoutstream")})},t.startLinearAdMode=function(){var n=this.player;this.adsReady&&!n.ads.inAdBreak()&&hs.start(n)},t.cleanup=function(n){n.ads._hasThereBeenALoadStartDuringPlayerLife||P.log.warn("Leaving OutstreamPlayback state before loadstart event can cause issues."),this.cleanupPartial(n)},t.cleanupPartial=function(n){n.removeClass("vjs-ad-loading"),n.removeClass("vjs-ad-content-resuming"),this.clearTimeout(n)},t.clearTimeout=function(n){n.clearTimeout(this._timeout),this._timeout=null},t.onAdStarted=function(n){n.removeClass("vjs-ad-loading")},t.onAdsError=function(n){var r=this;P.log("adserror (OutstreamPlayback)"),this.inAdBreak()?n.ads.endLinearAdMode():this.afterLoadStart(function(){r.abort(n)})},t.onAdTimeout=function(n){var r=this;this.afterLoadStart(function(){n.ads.debug("adtimeout (OutstreamPlayback)"),r.abort(n)})},t.onAdsCanceled=function(n){var r=this;n.ads.debug("adscanceled (OutstreamPlaybac)"),this.afterLoadStart(function(){r.abort(n)})},t.endLinearAdMode=function(){var n=this;if(this.inAdBreak()){this.player.removeClass("vjs-ad-loading");var r=ue.getState("OutstreamDone");hs.end(this.player,function(){n.transitionTo(r)})}},t.afterLoadStart=function(n){var r=this.player;r.ads._hasThereBeenALoadStartDuringPlayerLife?n():(r.ads.debug("Waiting for loadstart..."),r.one("loadstart",function(){r.ads.debug("Received loadstart event"),n()}))},t.skipLinearAdMode=function(){var n=this,r=this.player,i=ue.getState("OutstreamDone");this.inAdBreak()?P.log.warn("Unexpected skipLinearAdMode invocation"):this.afterLoadStart(function(){r.trigger("adskip"),r.ads.debug("skipLinearAdMode (OutstreamPlayback)"),n.transitionTo(i)})},e}(pC);ue.registerState("OutstreamPlayback",mC);var fC=ue.getState("AdState"),gC=function(s){Rt(e,s);function e(){return s.apply(this,arguments)||this}e._getName=function(){return"OutstreamDone"};var t=e.prototype;return t.init=function(n){n.trigger("ended")},t.startLinearAdMode=function(){P.log.warn("Unexpected startLinearAdMode invocation (OutstreamDone)")},e}(fC);ue.registerState("OutstreamDone",gC);var yC=gr.isMiddlewareMediatorSupported,_C=P.getTech("Html5").Events,vC={timeout:5e3,prerollTimeout:void 0,postrollTimeout:void 0,debug:!1,stitchedAds:!1,contentIsLive:void 0,liveCuePoints:!0,allowVjsAutoplay:P.options.normalizeAutoplay||!1},cd=function(s){var e=this,t=P.obj.merge(vC,s),n=[];_C.concat(["firstplay","loadedalldata"]).forEach(function(a){n.indexOf(a)===-1&&n.push(a)}),e.on(n,Tk),yC()||Mk(e,t.debug),e.setTimeout(function(){!e.ads._hasThereBeenALoadStartDuringPlayerLife&&e.src()!==""&&P.log.error("videojs-contrib-ads has not seen a loadstart event 5 seconds after being initialized, but a source is present. This indicates that videojs-contrib-ads was initialized too late. It must be initialized immediately after video.js in the same tick. As a result, some ads will not play and some media events will be incorrect. For more information, see http://videojs.github.io/videojs-contrib-ads/integrator/getting-started.html")},5e3),e.on("ended",function(){e.hasClass("vjs-has-started")||e.addClass("vjs-has-started")}),e.on("contenttimeupdate",function(){e.removeClass("vjs-waiting")}),e.on(["addurationchange","adcanplay"],function(){if(!e.ads.settings.stitchedAds&&!e.hasStarted()&&!(e.ads.snapshot&&e.currentSrc()===e.ads.snapshot.currentSrc)&&e.ads.inAdBreak()){var a=e.play();a&&a.catch&&a.catch(function(o){P.log.warn("Play promise rejected when playing ad",o)})}}),e.on("nopreroll",function(){e.ads.debug("Received nopreroll event"),e.ads.nopreroll_=!0}),e.on("nopostroll",function(){e.ads.debug("Received nopostroll event"),e.ads.nopostroll_=!0}),e.on("playing",function(){e.ads._cancelledPlay=!1,e.ads._pausedOnContentupdate=!1}),e.on("play",function(){e.ads._playRequested=!0}),e.one("loadstart",function(){e.ads._hasThereBeenALoadStartDuringPlayerLife=!0}),e.on("loadeddata",function(){e.ads._hasThereBeenALoadedData=!0}),e.on("loadedmetadata",function(){e.ads._hasThereBeenALoadedMetaData=!0}),e.ads=gk(e),e.ads.settings=t,t.stitchedAds=!!t.stitchedAds,t.playerMode==="outstream"?(e.src(Vk),e.ads._state=new(ue.getState("OutstreamPending"))(e)):t.stitchedAds?e.ads._state=new(ue.getState("StitchedContentPlayback"))(e):e.ads._state=new(ue.getState("BeforePreroll"))(e),e.ads._state.init(e),e.ads.cueTextTracks=_n,e.ads.adMacroReplacement=Dk.bind(e),Ak(e),e.on("contentchanged",e.ads.reset);var r=function(){return!e.ads.shouldPlayContentBehindAd(e)&&e.ads.inAdBreak()&&e.tech_.featuresNativeTextTracks&&P.browser.IS_IOS&&!Array.isArray(e.textTracks())},i=function(){var a=e.textTracks();if(r())for(var o=0;o<a.length;o++){var c=a[o];c.mode==="showing"&&(c.mode="disabled")}};e.ready(function(){e.textTracks().addEventListener("change",i)}),e.on(["play","playing","ended","adsready","adscanceled","adskip","adserror","adtimeout","adended","ads-ad-started","ads-ad-skipped","contentchanged","dispose","contentresumed","readyforpostroll","nopreroll","nopostroll"],function(a){e.ads._state.handleEvent(a.type)}),e.on("dispose",function(){e.ads.reset(),e.textTracks().removeEventListener("change",i)}),jh(),qh(function(){}),e.ads.listenToTcf=jh,e.ads.updateUsPrivacyString=function(a){return qh(a)}};cd.Error=yn;cd.VERSION=Xg;qk(cd);function dd(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:s.id||null,adId:s.adId||null,sequence:s.sequence||null,apiFramework:s.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const bC=["ADCATEGORIES","ADCOUNT","ADPLAYHEAD","ADSERVINGID","ADTYPE","APIFRAMEWORKS","APPBUNDLE","ASSETURI","BLOCKEDADCATEGORIES","BREAKMAXADLENGTH","BREAKMAXADS","BREAKMAXDURATION","BREAKMINADLENGTH","BREAKMINDURATION","BREAKPOSITION","CLICKPOS","CLICKTYPE","CLIENTUA","CONTENTID","CONTENTPLAYHEAD","CONTENTURI","DEVICEIP","DEVICEUA","DOMAIN","EXTENSIONS","GDPRCONSENT","IFA","IFATYPE","INVENTORYSTATE","LATLONG","LIMITADTRACKING","MEDIAMIME","MEDIAPLAYHEAD","OMIDPARTNER","PAGEURL","PLACEMENTTYPE","PLAYERCAPABILITIES","PLAYERSIZE","PLAYERSTATE","PODSEQUENCE","REGULATIONS","SERVERSIDE","SERVERUA","TRANSACTIONID","UNIVERSALADID","VASTVERSIONS","VERIFICATIONVENDORS"];function Hh(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const n=[],r=Jg(s);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=ty(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const i in e)e[i]=ey(e[i]);for(const i in r){const a=r[i];typeof a=="string"&&n.push(Qg(a,e))}return n}function Qg(s,e){const t=(s=Wh(s,e)).match(/[^[\]]+(?=])/g);if(!t)return s;let n=t.filter(r=>bC.indexOf(r)>-1);return n.length===0?s:(n=n.reduce((r,i)=>(r[i]=-1,r),{}),Wh(s,n))}function Wh(s,e){let t=s;for(const n in e){const r=e[n];t=t.replace(new RegExp("(?:\\[|%%)(".concat(n,")(?:\\]|%%)"),"g"),r)}return t}function Jg(s){return Array.isArray(s)?s.map(e=>e&&e.hasOwnProperty("url")?e.url:e):s}function zh(s){return/^(https?:\/\/|\/\/)/.test(s)}function Gh(s,e){for(let t=0;t<e.length;t++)if(Zg(e[t],s))return!0;return!1}function Zg(s,e){if(s&&e){const t=Object.getOwnPropertyNames(s),n=Object.getOwnPropertyNames(e);return t.length===n.length&&s.id===e.id&&s.url===e.url}return!1}function ey(s){return encodeURIComponent(s).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function ty(s){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return s.toString().padStart(e,"0")}const Ie={track:function(s,e,t){Hh(s,e,t).forEach(n=>{typeof window<"u"&&window!==null&&(new Image().src=n)})},resolveURLTemplates:Hh,extractURLsFromTemplates:Jg,filterUrlTemplates:function(s){return s.reduce((e,t)=>{const n=t.url||t;return zh(n)?e.validUrls.push(n):e.invalidUrls.push(n),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Gh,isTemplateObjectEqual:Zg,encodeURIComponentRFC3986:ey,replaceUrlMacros:Qg,isNumeric:function(s){return!isNaN(parseFloat(s))&&isFinite(s)},flatten:function s(e){return e.reduce((t,n)=>t.concat(Array.isArray(n)?s(n):n),[])},joinArrayOfUniqueTemplateObjs:function(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(s)?s:[],n=Array.isArray(e)?e:[];return t.concat(n).reduce((r,i)=>(Gh(i,r)||r.push(i),r),[])},isValidTimeValue:function(s){return Number.isFinite(s)&&s>=-2},addLeadingZeros:ty,isValidUrl:zh,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(s){return typeof s!="object"?s:JSON.stringify(s)}};function Xh(s){return["true","TRUE","True","1"].includes(s)}function TC(s){if(s==null)return-1;if(Ie.isNumeric(s))return parseInt(s);const e=s.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let n=parseInt(t[0]);t.length===2&&(n+=parseFloat("0.".concat(t[1])));const r=parseInt(60*e[1]),i=parseInt(60*e[0]*60);return isNaN(i)||isNaN(r)||isNaN(n)||r>3600||n>60?-1:i+r+n}const q={childByName:function(s,e){return Array.from(s.childNodes).find(t=>t.nodeName===e)},childrenByName:function(s,e){return Array.from(s.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(s,e){if(!e)return s;if(s.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(s)}if(!s.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(s)}return s},parseBoolean:Xh,parseNodeText:function(s){return s&&(s.textContent||s.text||"").trim()},copyNodeAttribute:function(s,e,t){const n=e.getAttribute(s);n&&t.setAttribute(s,n)},parseAttributes:function(s){return Array.from(s.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:TC,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(s=>!parseInt(s.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(s=>parseInt(s.sequence,10)).sort((s,e)=>s.sequence-e.sequence)},assignAttributes:function(s,e){s&&Array.from(s).forEach(t=>{let{nodeName:n,nodeValue:r}=t;if(n&&r&&e.hasOwnProperty(n)){let i=r;typeof e[n]=="boolean"&&(i=Xh(i)),e[n]=i}})},mergeWrapperAdData:function(s,e){var t;s.errorURLTemplates=e.errorURLTemplates.concat(s.errorURLTemplates),s.impressionURLTemplates=e.impressionURLTemplates.concat(s.impressionURLTemplates),s.extensions=e.extensions.concat(s.extensions),e.viewableImpression.length>0&&(s.viewableImpression=[...s.viewableImpression,...e.viewableImpression]),s.followAdditionalWrappers=e.followAdditionalWrappers,s.allowMultipleAds=e.allowMultipleAds,s.fallbackOnNoAd=e.fallbackOnNoAd;const n=(e.creatives||[]).filter(o=>o&&o.type==="companion"),r=n.reduce((o,c)=>((c.variations||[]).forEach(h=>{(h.companionClickTrackingURLTemplates||[]).forEach(m=>{Ie.containsTemplateObject(m,o)||o.push(m)})}),o),[]);s.creatives=n.concat(s.creatives);const i=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(s.creatives.forEach(o=>{if(e.trackingEvents&&e.trackingEvents[o.type])for(const c in e.trackingEvents[o.type]){const h=e.trackingEvents[o.type][c];Array.isArray(o.trackingEvents[c])||(o.trackingEvents[c]=[]),o.trackingEvents[c]=o.trackingEvents[c].concat(h)}o.type==="linear"&&(i&&(o.videoClickTrackingURLTemplates=o.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(o.videoCustomClickURLTemplates=o.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||o.videoClickThroughURLTemplate!==null&&o.videoClickThroughURLTemplate!==void 0||(o.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),o.type==="companion"&&r.length&&(o.variations||[]).forEach(c=>{c.companionClickTrackingURLTemplates=Ie.joinArrayOfUniqueTemplateObjs(c.companionClickTrackingURLTemplates,r)})}),e.adVerifications&&(s.adVerifications=s.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(s.blockedAdCategories=s.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const o=e.creatives.filter(c=>{var h;return((h=c.icons)===null||h===void 0?void 0:h.length)&&!c.mediaFiles.length});o.length&&(s.creatives=s.creatives.concat(o))}}};function AC(s,e){const t=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:r,adId:i,sequence:a,apiFramework:o}=dd(n);return{id:r,adId:i,sequence:a,apiFramework:o,type:"companion",required:null,variations:[]}}(e);return t.required=s.getAttribute("required")||null,t.variations=q.childrenByName(s,"Companion").map(n=>{const r=function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:o.id||null,adType:"companionAd",width:o.width||0,height:o.height||0,assetWidth:o.assetWidth||null,assetHeight:o.assetHeight||null,expandedWidth:o.expandedWidth||null,expandedHeight:o.expandedHeight||null,apiFramework:o.apiFramework||null,adSlotId:o.adSlotId||null,pxratio:o.pxratio||"1",renderingMode:o.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(q.parseAttributes(n));r.htmlResources=q.childrenByName(n,"HTMLResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat(h):o},[]),r.iframeResources=q.childrenByName(n,"IFrameResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat(h):o},[]),r.staticResources=q.childrenByName(n,"StaticResource").reduce((o,c)=>{const h=q.parseNodeText(c);return h?o.concat({url:h,creativeType:c.getAttribute("creativeType")||null}):o},[]),r.altText=q.parseNodeText(q.childByName(n,"AltText"))||null;const i=q.childByName(n,"TrackingEvents");i&&q.childrenByName(i,"Tracking").forEach(o=>{const c=o.getAttribute("event"),h=q.parseNodeText(o);c&&h&&(Array.isArray(r.trackingEvents[c])||(r.trackingEvents[c]=[]),r.trackingEvents[c].push(h))}),r.companionClickTrackingURLTemplates=q.childrenByName(n,"CompanionClickTracking").map(o=>({id:o.getAttribute("id")||null,url:q.parseNodeText(o)})),r.companionClickThroughURLTemplate=q.parseNodeText(q.childByName(n,"CompanionClickThrough"))||null;const a=q.childByName(n,"AdParameters");return a&&(r.adParameters={value:q.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),r}),t}function SC(s,e){let t;const n=function(){let c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:h,adId:m,sequence:_,apiFramework:T}=dd(c);return{id:h,adId:m,sequence:_,apiFramework:T,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);n.duration=q.parseDuration(q.parseNodeText(q.childByName(s,"Duration")));const r=s.getAttribute("skipoffset");if(r==null)n.skipDelay=null;else if(r.charAt(r.length-1)==="%"&&n.duration!==-1){const c=parseInt(r,10);n.skipDelay=n.duration*(c/100)}else n.skipDelay=q.parseDuration(r);const i=q.childByName(s,"VideoClicks");if(i){const c=q.childByName(i,"ClickThrough");n.videoClickThroughURLTemplate=c?{id:c.getAttribute("id")||null,url:q.parseNodeText(c)}:null,q.childrenByName(i,"ClickTracking").forEach(h=>{n.videoClickTrackingURLTemplates.push({id:h.getAttribute("id")||null,url:q.parseNodeText(h)})}),q.childrenByName(i,"CustomClick").forEach(h=>{n.videoCustomClickURLTemplates.push({id:h.getAttribute("id")||null,url:q.parseNodeText(h)})})}const a=q.childByName(s,"AdParameters");a&&(n.adParameters={value:q.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),q.childrenByName(s,"TrackingEvents").forEach(c=>{q.childrenByName(c,"Tracking").forEach(h=>{let m=h.getAttribute("event");const _=q.parseNodeText(h);if(m&&_){if(m==="progress"){if(t=h.getAttribute("offset"),!t)return;m=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(q.parseDuration(t))}Array.isArray(n.trackingEvents[m])||(n.trackingEvents[m]=[]),n.trackingEvents[m].push(_)}})}),q.childrenByName(s,"MediaFiles").forEach(c=>{q.childrenByName(c,"MediaFile").forEach(S=>{n.mediaFiles.push(function(w){const b={id:null,fileURL:null,fileSize:0,deliveryType:"progressive",mimeType:null,mediaType:null,codec:null,bitrate:0,minBitrate:0,maxBitrate:0,width:0,height:0,apiFramework:null,scalable:null,maintainAspectRatio:null};b.id=w.getAttribute("id"),b.fileURL=q.parseNodeText(w),b.deliveryType=w.getAttribute("delivery"),b.codec=w.getAttribute("codec"),b.mimeType=w.getAttribute("type"),b.mediaType=w.getAttribute("mediaType")||"2D",b.apiFramework=w.getAttribute("apiFramework"),b.fileSize=parseInt(w.getAttribute("fileSize")||0),b.bitrate=parseInt(w.getAttribute("bitrate")||0),b.minBitrate=parseInt(w.getAttribute("minBitrate")||0),b.maxBitrate=parseInt(w.getAttribute("maxBitrate")||0),b.width=parseInt(w.getAttribute("width")||0),b.height=parseInt(w.getAttribute("height")||0);const R=w.getAttribute("scalable");R&&typeof R=="string"&&(b.scalable=q.parseBoolean(R));const L=w.getAttribute("maintainAspectRatio");return L&&typeof L=="string"&&(b.maintainAspectRatio=q.parseBoolean(L)),b}(S))});const h=q.childByName(c,"InteractiveCreativeFile");h&&(n.interactiveCreativeFile=function(S){const w=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:b.type||null,apiFramework:b.apiFramework||null,variableDuration:q.parseBoolean(b.variableDuration),fileURL:null}}(q.parseAttributes(S));return w.fileURL=q.parseNodeText(S),w}(h));const m=q.childByName(c,"ClosedCaptionFiles");m&&q.childrenByName(m,"ClosedCaptionFile").forEach(S=>{const w=function(){let b=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:b.type||null,language:b.language||null,fileURL:null}}(q.parseAttributes(S));w.fileURL=q.parseNodeText(S),n.closedCaptionFiles.push(w)});const _=q.childByName(c,"Mezzanine"),T=function(S,w){const b={};let R=!1;return w.forEach(L=>{S&&S.getAttribute(L)?b[L]=S.getAttribute(L):R=!0}),R?null:b}(_,["delivery","type","width","height"]);if(T){const S={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};S.id=_.getAttribute("id"),S.fileURL=q.parseNodeText(_),S.delivery=T.delivery,S.codec=_.getAttribute("codec"),S.type=T.type,S.width=parseInt(T.width,10),S.height=parseInt(T.height,10),S.fileSize=parseInt(_.getAttribute("fileSize"),10),S.mediaType=_.getAttribute("mediaType")||"2D",n.mezzanine=S}});const o=q.childByName(s,"Icons");return o&&q.childrenByName(o,"Icon").forEach(c=>{n.icons.push(function(h){const m={program:null,height:0,width:0,xPosition:0,yPosition:0,apiFramework:null,offset:null,duration:0,type:null,staticResource:null,htmlResource:null,iframeResource:null,pxratio:"1",iconClickThroughURLTemplate:null,iconClickTrackingURLTemplates:[],iconViewTrackingURLTemplate:null,iconClickFallbackImages:[]};m.program=h.getAttribute("program"),m.height=parseInt(h.getAttribute("height")||0),m.width=parseInt(h.getAttribute("width")||0),m.xPosition=function(T){return["left","right"].indexOf(T)!==-1?T:parseInt(T||0)}(h.getAttribute("xPosition")),m.yPosition=function(T){return["top","bottom"].indexOf(T)!==-1?T:parseInt(T||0)}(h.getAttribute("yPosition")),m.apiFramework=h.getAttribute("apiFramework"),m.pxratio=h.getAttribute("pxratio")||"1",m.offset=q.parseDuration(h.getAttribute("offset")),m.duration=q.parseDuration(h.getAttribute("duration")),q.childrenByName(h,"HTMLResource").forEach(T=>{m.type=T.getAttribute("creativeType")||"text/html",m.htmlResource=q.parseNodeText(T)}),q.childrenByName(h,"IFrameResource").forEach(T=>{m.type=T.getAttribute("creativeType")||0,m.iframeResource=q.parseNodeText(T)}),q.childrenByName(h,"StaticResource").forEach(T=>{m.type=T.getAttribute("creativeType")||0,m.staticResource=q.parseNodeText(T)});const _=q.childByName(h,"IconClicks");if(_){m.iconClickThroughURLTemplate=q.parseNodeText(q.childByName(_,"IconClickThrough")),q.childrenByName(_,"IconClickTracking").forEach(S=>{m.iconClickTrackingURLTemplates.push({id:S.getAttribute("id")||null,url:q.parseNodeText(S)})});const T=q.childByName(_,"IconClickFallbackImages");T&&q.childrenByName(T,"IconClickFallbackImage").forEach(S=>{m.iconClickFallbackImages.push({url:q.parseNodeText(S)||null,width:S.getAttribute("width")||null,height:S.getAttribute("height")||null})})}return m.iconViewTrackingURLTemplate=q.parseNodeText(q.childByName(h,"IconViewTracking")),m}(c))}),n}function EC(s,e){const t=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:r,adId:i,sequence:a,apiFramework:o}=dd(n);return{id:r,adId:i,sequence:a,apiFramework:o,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return q.childrenByName(s,"TrackingEvents").forEach(n=>{let r,i;q.childrenByName(n,"Tracking").forEach(a=>{r=a.getAttribute("event"),i=q.parseNodeText(a),r&&i&&(Array.isArray(t.trackingEvents[r])||(t.trackingEvents[r]=[]),t.trackingEvents[r].push(i))})}),q.childrenByName(s,"NonLinear").forEach(n=>{const r={id:null,width:0,height:0,expandedWidth:0,expandedHeight:0,scalable:!0,maintainAspectRatio:!0,minSuggestedDuration:0,apiFramework:"static",adType:"nonLinearAd",type:null,staticResource:null,htmlResource:null,iframeResource:null,nonlinearClickThroughURLTemplate:null,nonlinearClickTrackingURLTemplates:[],adParameters:null};r.id=n.getAttribute("id")||null,r.width=n.getAttribute("width"),r.height=n.getAttribute("height"),r.expandedWidth=n.getAttribute("expandedWidth"),r.expandedHeight=n.getAttribute("expandedHeight"),r.scalable=q.parseBoolean(n.getAttribute("scalable")),r.maintainAspectRatio=q.parseBoolean(n.getAttribute("maintainAspectRatio")),r.minSuggestedDuration=q.parseDuration(n.getAttribute("minSuggestedDuration")),r.apiFramework=n.getAttribute("apiFramework"),q.childrenByName(n,"HTMLResource").forEach(a=>{r.type=a.getAttribute("creativeType")||"text/html",r.htmlResource=q.parseNodeText(a)}),q.childrenByName(n,"IFrameResource").forEach(a=>{r.type=a.getAttribute("creativeType")||0,r.iframeResource=q.parseNodeText(a)}),q.childrenByName(n,"StaticResource").forEach(a=>{r.type=a.getAttribute("creativeType")||0,r.staticResource=q.parseNodeText(a)});const i=q.childByName(n,"AdParameters");i&&(r.adParameters={value:q.parseNodeText(i),xmlEncoded:i.getAttribute("xmlEncoded")||null}),r.nonlinearClickThroughURLTemplate=q.parseNodeText(q.childByName(n,"NonLinearClickThrough")),q.childrenByName(n,"NonLinearClickTracking").forEach(a=>{r.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:q.parseNodeText(a)})}),t.variations.push(r)}),t}function Yh(s){const e=[];return s.forEach(t=>{const n=sy(t);n&&e.push(n)}),e}function sy(s){if(s.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=s.attributes,n=s.childNodes;if(e.name=s.nodeName,s.attributes){for(const i in t)if(t.hasOwnProperty(i)){const a=t[i];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const i in n)if(n.hasOwnProperty(i)){const a=sy(n[i]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const i=q.parseNodeText(s);i!==""&&(e.value=i),e.children=[]}return(r=e).value===null&&Object.keys(r.attributes).length===0&&r.children.length===0?null:e;var r}function wC(s){return s.getAttribute("AdID")||s.getAttribute("adID")||s.getAttribute("adId")||null}const ha={Wrapper:{subElements:["VASTAdTagURI","Impression"]},BlockedAdCategories:{attributes:["authority"]},InLine:{subElements:["AdSystem","AdTitle","Impression","AdServingId","Creatives"]},Category:{attributes:["authority"]},Pricing:{attributes:["model","currency"]},Verification:{oneOfinLineResources:["JavaScriptResource","ExecutableResource"],attributes:["vendor"]},UniversalAdId:{attributes:["idRegistry"]},JavaScriptResource:{attributes:["apiFramework","browserOptional"]},ExecutableResource:{attributes:["apiFramework","type"]},Tracking:{attributes:["event"]},Creatives:{subElements:["Creative"]},Creative:{subElements:["UniversalAdId"]},Linear:{subElements:["MediaFiles","Duration"]},MediaFiles:{subElements:["MediaFile"]},MediaFile:{attributes:["delivery","type","width","height"]},Mezzanine:{attributes:["delivery","type","width","height"]},NonLinear:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},Companion:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"],attributes:["width","height"]},StaticResource:{attributes:["creativeType"]},Icons:{subElements:["Icon"]},Icon:{oneOfinLineResources:["StaticResource","IFrameResource","HTMLResource"]}};function Kh(s,e){if(!ha[s.nodeName]||!ha[s.nodeName].attributes)return;const t=ha[s.nodeName].attributes.filter(n=>!s.getAttribute(n));t.length>0&&pi({name:s.nodeName,parentName:s.parentNode.nodeName,attributes:t},e)}function Qh(s,e,t){const n=ha[s.nodeName],r=!t&&s.nodeName!=="Wrapper";if(!(!n||r)){if(n.subElements){const i=n.subElements.filter(a=>!q.childByName(s,a));i.length>0&&pi({name:s.nodeName,parentName:s.parentNode.nodeName,subElements:i},e)}!t||!n.oneOfinLineResources||n.oneOfinLineResources.some(i=>q.childByName(s,i))||pi({name:s.nodeName,parentName:s.parentNode.nodeName,oneOfResources:n.oneOfinLineResources},e)}}function Jh(s){return s.children&&s.children.length!==0}function pi(s,e){let{name:t,parentName:n,attributes:r,subElements:i,oneOfResources:a}=s,o="Element '".concat(t,"'");o+=r?" missing required attribute(s) '".concat(r.join(", "),"' "):i?" missing required sub element(s) '".concat(i.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:o,parentElement:n,specVersion:4.1})}const kC={verifyRequiredValues:function s(e,t,n){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(n=!0),Kh(e,t),Jh(e)){Qh(e,t,n);for(let r=0;r<e.children.length;r++)s(e.children[r],t,n)}else q.parseNodeText(e).length===0&&pi({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Jh,emitMissingValueWarning:pi,verifyRequiredAttributes:Kh,verifyRequiredSubElements:Qh};function CC(s,e){let{allowMultipleAds:t,followAdditionalWrappers:n}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=Array.from(s.childNodes).filter(i=>{const a=i.nodeName.toLowerCase();return a==="inline"||n!==!1&&a==="wrapper"});for(const i of r){if(q.copyNodeAttribute("id",s,i),q.copyNodeAttribute("sequence",s,i),q.copyNodeAttribute("adType",s,i),i.nodeName==="Wrapper")return{ad:xC(i,e),type:"WRAPPER"};if(i.nodeName==="InLine")return{ad:IC(i,e,{allowMultipleAds:t}),type:"INLINE"};const a=i.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(i.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:i})}}function IC(s,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&s.getAttribute("sequence")?null:ny(s,e)}function ny(s,e){let t=[];e&&kC.verifyRequiredValues(s,e);const n=Array.from(s.childNodes),r=function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,sequence:i.sequence||null,adType:i.adType||null,adServingId:null,categories:[],expires:null,viewableImpression:[],system:null,title:null,description:null,advertiser:null,pricing:null,survey:null,errorURLTemplates:[],impressionURLTemplates:[],creatives:[],extensions:[],adVerifications:[],blockedAdCategories:[],followAdditionalWrappers:!0,allowMultipleAds:!1,fallbackOnNoAd:null}}(q.parseAttributes(s));return n.forEach(i=>{switch(i.nodeName){case"Error":r.errorURLTemplates.push(q.parseNodeText(i));break;case"Impression":r.impressionURLTemplates.push({id:i.getAttribute("id")||null,url:q.parseNodeText(i)});break;case"Creatives":r.creatives=function(a){const o=[];return a.forEach(c=>{const h={id:c.getAttribute("id")||null,adId:wC(c),sequence:c.getAttribute("sequence")||null,apiFramework:c.getAttribute("apiFramework")||null},m=[];let _;q.childrenByName(c,"UniversalAdId").forEach(S=>{const w={idRegistry:S.getAttribute("idRegistry")||"unknown",value:q.parseNodeText(S)};m.push(w)});const T=q.childByName(c,"CreativeExtensions");T&&(_=Yh(q.childrenByName(T,"CreativeExtension")));for(const S in c.childNodes){const w=c.childNodes[S];let b;switch(w.nodeName){case"Linear":b=SC(w,h);break;case"NonLinearAds":b=EC(w,h);break;case"CompanionAds":b=AC(w,h)}b&&(m&&(b.universalAdIds=m),_&&(b.creativeExtensions=_),o.push(b))}}),o}(q.childrenByName(i,"Creative"));break;case"Extensions":{const a=q.childrenByName(i,"Extension");r.extensions=Yh(a),r.adVerifications.length||(t=function(o){let c=null,h=[];return o.some(m=>c=q.childByName(m,"AdVerifications")),c&&(h=Zh(q.childrenByName(c,"Verification"))),h}(a));break}case"AdVerifications":r.adVerifications=Zh(q.childrenByName(i,"Verification"));break;case"AdSystem":r.system={value:q.parseNodeText(i),version:i.getAttribute("version")||null};break;case"AdTitle":r.title=q.parseNodeText(i);break;case"AdServingId":r.adServingId=q.parseNodeText(i);break;case"Category":r.categories.push({authority:i.getAttribute("authority")||null,value:q.parseNodeText(i)});break;case"Expires":r.expires=parseInt(q.parseNodeText(i),10);break;case"ViewableImpression":r.viewableImpression.push(function(a){const o=(c,h)=>{const m=q.parseNodeText(h);return m&&c.push(m),c};return{id:a.getAttribute("id")||null,viewable:q.childrenByName(a,"Viewable").reduce(o,[]),notViewable:q.childrenByName(a,"NotViewable").reduce(o,[]),viewUndetermined:q.childrenByName(a,"ViewUndetermined").reduce(o,[])}}(i));break;case"Description":r.description=q.parseNodeText(i);break;case"Advertiser":r.advertiser={id:i.getAttribute("id")||null,value:q.parseNodeText(i)};break;case"Pricing":r.pricing={value:q.parseNodeText(i),model:i.getAttribute("model")||null,currency:i.getAttribute("currency")||null};break;case"Survey":r.survey={value:q.parseNodeText(i),type:i.getAttribute("type")||null};break;case"BlockedAdCategories":r.blockedAdCategories.push({authority:i.getAttribute("authority")||null,value:q.parseNodeText(i)})}}),t.length&&(r.adVerifications=r.adVerifications.concat(t)),r}function xC(s,e){const t=ny(s,e),n=s.getAttribute("followAdditionalWrappers"),r=s.getAttribute("allowMultipleAds"),i=s.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!n||q.parseBoolean(n),t.allowMultipleAds=!!r&&q.parseBoolean(r),t.fallbackOnNoAd=i?q.parseBoolean(i):null;let a=q.childByName(s,"VASTAdTagURI");if(a?t.nextWrapperURL=q.parseNodeText(a):(a=q.childByName(s,"VASTAdTagURL"),a&&(t.nextWrapperURL=q.parseNodeText(q.childByName(a,"URL")))),t.creatives.forEach(o=>{if(["linear","nonlinear"].includes(o.type)){if(o.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[o.type]||(t.trackingEvents[o.type]={});for(const c in o.trackingEvents){const h=o.trackingEvents[c];Array.isArray(t.trackingEvents[o.type][c])||(t.trackingEvents[o.type][c]=[]),h.forEach(m=>{t.trackingEvents[o.type][c].push(m)})}}o.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),o.videoClickTrackingURLTemplates.forEach(c=>{t.videoClickTrackingURLTemplates.push(c)})),o.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=o.videoClickThroughURLTemplate),o.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),o.videoCustomClickURLTemplates.forEach(c=>{t.videoCustomClickURLTemplates.push(c)}))}}),t.nextWrapperURL)return t}function Zh(s){const e=[];return s.forEach(t=>{const n={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},r=Array.from(t.childNodes);q.assignAttributes(t.attributes,n),r.forEach(a=>{let{nodeName:o,textContent:c,attributes:h}=a;switch(o){case"JavaScriptResource":case"ExecutableResource":n.resource=c.trim(),q.assignAttributes(h,n);break;case"VerificationParameters":n.parameters=c.trim()}});const i=q.childByName(t,"TrackingEvents");i&&q.childrenByName(i,"Tracking").forEach(a=>{const o=a.getAttribute("event"),c=q.parseNodeText(a);o&&c&&(Array.isArray(n.trackingEvents[o])||(n.trackingEvents[o]=[]),n.trackingEvents[o].push(c))}),e.push(n)}),e}class ry{constructor(){this._handlers=[]}on(e,t){if(typeof t!="function")throw new TypeError("The handler argument must be of type Function. Received type ".concat(typeof t));if(!e)throw new TypeError("The event argument must be of type String. Received type ".concat(typeof e));return this._handlers.push({event:e,handler:t}),this}once(e,t){return this.on(e,function(n,r,i){const a={fired:!1,wrapFn:void 0};function o(){a.fired||(n.off(r,a.wrapFn),a.fired=!0,i.bind(n)(...arguments))}return a.wrapFn=o,o}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(n=>n.event!==e||n.handler!==t),this}emit(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];let i=!1;return this._handlers.forEach(a=>{a.event==="*"&&(i=!0,a.handler(e,...n)),a.event===e&&(i=!0,a.handler(...n))}),i}removeAllListeners(e){return e?(this._handlers=this._handlers.filter(t=>t.event!==e),this):(this._handlers=[],this)}listenerCount(e){return this._handlers.filter(t=>t.event===e).length}listeners(e){return this._handlers.reduce((t,n)=>(n.event===e&&t.push(n.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let ep=0,tc=0;const iy=(s,e)=>{!s||!e||s<=0||e<=0||(tc=(tc*ep+8*s/e)/++ep)},LC={ERRORCODE:900,extensions:[]},tp="VAST response version not supported";class ay extends ry{constructor(){let{fetcher:e}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.maxWrapperDepth=null,this.rootErrorURLTemplates=[],this.errorURLTemplates=[],this.remainingAds=[],this.parsingOptions={},this.fetcher=e||null}trackVastError(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];this.emit("VAST-error",Object.assign({},LC,t,...r)),Ie.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return tc}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.rootURL="",this.resetParsingStatus(),iy(e.byteLength,e.requestDuration)}resetParsingStatus(){this.errorURLTemplates=[],this.rootErrorURLTemplates=[],this.vastVersion=null}getRemainingAds(e){if(this.remainingAds.length===0)return Promise.reject(new Error("No more ads are available for the given VAST"));const t=e?this.remainingAds:[this.remainingAds.shift()];return this.errorURLTemplates=[],this.resolveAds(t,{wrapperDepth:0,url:this.rootURL}).then(n=>this.buildVASTResponse(n))}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.initParsingStatus(t),t.isRootVAST=!0,this.parse(e,t).then(n=>this.buildVASTResponse(n))}buildVASTResponse(e){const t=function(n){let{ads:r,errorURLTemplates:i,version:a}=n;return{ads:r||[],errorURLTemplates:i||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:n=!1,url:r=null,wrapperDepth:i=0,allowMultipleAds:a,followAdditionalWrappers:o}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var c;this.emit("VAST-ad-parsed",{type:"ERROR",url:r,wrapperDepth:i});const T=(e==null||(c=e.documentElement)===null||c===void 0?void 0:c.nodeName)==="VideoAdServingTemplate";throw new Error(T?tp:"Invalid VAST XMLDocument")}const h=[],m=e.documentElement.childNodes,_=e.documentElement.getAttribute("version");n&&_&&(this.vastVersion=_);for(const T in m){const S=m[T];if(S.nodeName==="Error"){const w=q.parseNodeText(S);n?this.rootErrorURLTemplates.push(w):this.errorURLTemplates.push(w)}else if(S.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&h.length>1)break;const w=CC(S,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:o});w.ad?(h.push(w.ad),this.emit("VAST-ad-parsed",{type:w.type,url:r,wrapperDepth:i,adIndex:h.length-1,vastVersion:_})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return h}parse(e){let{url:t=null,resolveAll:n=!0,wrapperSequence:r=null,previousUrl:i=null,wrapperDepth:a=0,isRootVAST:o=!1,followAdditionalWrappers:c,allowMultipleAds:h}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},m=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&o&&(h=!0);try{m=this.parseVastXml(e,{isRootVAST:o,url:t,wrapperDepth:a,allowMultipleAds:h,followAdditionalWrappers:c})}catch(_){return Promise.reject(_)}if(m.length===1&&r!=null&&(m[0].sequence=r),n===!1){const _=q.getSortedAdPods(m),T=q.getStandAloneAds(m);_.length?m=_:T.length&&(m=[T.shift()]),this.remainingAds=T}return this.resolveAds(m,{wrapperDepth:a,previousUrl:i,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:n,url:r}=arguments.length>1?arguments[1]:void 0;const i=[];return n=r,e.forEach(a=>{const o=this.resolveWrappers(a,t,n);i.push(o)}),Promise.all(i).then(a=>Ie.flatten(a))}resolveWrappers(e,t,n){const r={...e};return new Promise(i=>{var a;if(t++,!r.nextWrapperURL)return delete r.nextWrapperURL,i(r);if(!this.fetcher)return r.VASTAdTagURI=r.nextWrapperURL,delete r.nextWrapperURL,i(r);if(t>=this.maxWrapperDepth)return r.errorCode=302,delete r.nextWrapperURL,i(r);r.nextWrapperURL=q.resolveVastAdTagURI(r.nextWrapperURL,n);const o=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:r.allowMultipleAds,c=r.sequence;this.fetcher.fetchVAST({url:r.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(h=>this.parse(h,{url:r.nextWrapperURL,previousUrl:n,wrapperSequence:c,wrapperDepth:t,followAdditionalWrappers:r.followAdditionalWrappers,allowMultipleAds:o}).then(m=>{if(delete r.nextWrapperURL,m.length===0)return r.creatives=[],i(r);m.forEach(_=>{_&&q.mergeWrapperAdData(_,r)}),i(m)})).catch(h=>{r.errorCode=h.message===tp?102:301,r.errorMessage=h.message,i(r)})})}completeWrapperResolving(e){if(e.ads.length===0)this.trackVastError(e.errorURLTemplates,{ERRORCODE:303});else for(let t=e.ads.length-1;t>=0;t--){const n=e.ads[t],r=!n.creatives.some(i=>{var a;return((a=i.mediaFiles)===null||a===void 0?void 0:a.length)>0});!n.errorCode&&!r||n.VASTAdTagURI||(this.trackVastError(n.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:n.errorCode||303},{ERRORMESSAGE:n.errorMessage||""},{extensions:n.extensions},{system:n.system}),e.ads.splice(t,1))}}}let ys=null;const PC={data:{},length:0,getItem(s){return this.data[s]},setItem(s,e){this.data[s]=e,this.length=Object.keys(this.data).length},removeItem(s){delete this.data[s],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class RC{constructor(){this.storage=this.initStorage()}initStorage(){if(ys)return ys;try{ys=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{ys=null}return ys&&!this.isStorageDisabled(ys)||(ys=PC,ys.clear()),ys}isStorageDisabled(e){const t="__VASTStorage__";try{if(e.setItem(t,t),e.getItem(t)!==t)return e.removeItem(t),!0}catch{return!0}return e.removeItem(t),!1}getItem(e){return this.storage.getItem(e)}setItem(e,t){return this.storage.setItem(e,t)}removeItem(e){return this.storage.removeItem(e)}clear(){return this.storage.clear()}}const sc=12e4,DC={get:async function(s,e){try{const t=new AbortController,n=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||sc," ms (408)"))},e.timeout||sc),r=await fetch(s,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(n)}),i=function(a){return Ie.isBrowserEnvironment()&&window.location.protocol==="https:"&&a.url.includes("http://")?"URLHandler: Cannot go from HTTPS to HTTP.":a.status===200&&a.ok?null:"URLHandler: ".concat(a.statusText," (").concat(a.status,")")}(r);return i?{error:new Error(i),statusCode:r.status}:async function(a){const o=await a.text();let c;return c=Ie.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>XT)).DOMParser,{xml:c.parseFromString(o,"text/xml"),details:{byteLength:o.length,statusCode:a.status,rawXml:o}}}(r)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};class NC{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||DC,this.fetchingOptions={timeout:e.timeout||sc,withCredentials:!!e.withCredentials}}addURLTemplateFilter(e){typeof e=="function"&&this.URLTemplateFilters.push(e)}removeLastURLTemplateFilter(){this.URLTemplateFilters.pop()}countURLTemplateFilters(){return this.URLTemplateFilters.length}clearURLTemplateFilters(){this.URLTemplateFilters=[]}async fetchVAST(e){var t;let{url:n,maxWrapperDepth:r,emitter:i,wrapperDepth:a=0,previousUrl:o=null,wrapperAd:c=null}=e;const h=Date.now();this.URLTemplateFilters.forEach(T=>{n=T(n)}),i("VAST-resolving",{url:n,previousUrl:o,wrapperDepth:a,maxWrapperDepth:r,timeout:this.fetchingOptions.timeout,wrapperAd:c});const m=await this.urlHandler.get(n,this.fetchingOptions),_=Math.round(Date.now()-h);if(i("VAST-resolved",{url:n,previousUrl:o,wrapperDepth:a,error:(m==null?void 0:m.error)||null,duration:_,statusCode:(m==null?void 0:m.statusCode)||null,...m==null?void 0:m.details}),iy(m==null||(t=m.details)===null||t===void 0?void 0:t.byteLength,_),m.error)throw new Error(m.error);return m.xml}}class OC{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new RC;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new NC,this.vastParser=new ay({fetcher:this.fetcher}),this.storage=n,this.lastSuccessfulAd===void 0&&(this.lastSuccessfulAd=0),this.totalCalls===void 0&&(this.totalCalls=0),this.totalCallsTimeout===void 0&&(this.totalCallsTimeout=0)}addURLTemplateFilter(e){this.fetcher.addURLTemplateFilter(e)}removeLastURLTemplateFilter(){this.fetcher.removeLastURLTemplateFilter()}countURLTemplateFilters(){return this.fetcher.countURLTemplateFilters()}clearURLTemplateFilters(){this.fetcher.clearURLTemplateFilters()}getParser(){return this.vastParser}get lastSuccessfulAd(){return this.storage.getItem("vast-client-last-successful-ad")}set lastSuccessfulAd(e){this.storage.setItem("vast-client-last-successful-ad",e)}get totalCalls(){return this.storage.getItem("vast-client-total-calls")}set totalCalls(e){this.storage.setItem("vast-client-total-calls",e)}get totalCallsTimeout(){return this.storage.getItem("vast-client-total-calls-timeout")}set totalCallsTimeout(e){this.storage.setItem("vast-client-total-calls-timeout",e)}hasRemainingAds(){return this.vastParser.remainingAds.length>0}getNextAds(e){return this.vastParser.getRemainingAds(e)}parseVAST(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return this.fetcher.setOptions(t),this.vastParser.parseVAST(e,t)}get(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const n=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<n?(this.totalCalls=1,this.totalCallsTimeout=n+36e5):this.totalCalls++,new Promise((r,i)=>{if(this.cappingFreeLunch>=this.totalCalls)return i(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=n-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return i(new Error("VAST call canceled – (".concat(this.cappingMinimumTimeInterval,")ms minimum interval reached")));this.vastParser.initParsingStatus(t),this.fetcher.setOptions(t),this.vastParser.rootURL=e,this.fetcher.fetchVAST({url:e,emitter:this.vastParser.emit.bind(this.vastParser),maxWrapperDepth:this.vastParser.maxWrapperDepth}).then(o=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(o,t).then(c=>{const h=this.vastParser.buildVASTResponse(c);r(h)}))).catch(o=>i(o))})}}class sp extends ry{constructor(e,t,n){let r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,i=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=n,this.variation=r,this.muted=i,this.impressed=!1,this.skippable=!1,this.trackingEvents={},this.trackedProgressEvents=[],this.lastPercentage=0,this._alreadyTriggeredQuartiles={},this.emitAlwaysEvents=["creativeView","start","firstQuartile","midpoint","thirdQuartile","complete","resume","pause","rewind","skip","closeLinear","close"];for(const a in this.creative.trackingEvents){const o=this.creative.trackingEvents[a];this.trackingEvents[a]=o.slice(0)}(function(a){return a.type==="linear"})(this.creative)?this._initLinearTracking():this._initVariationTracking(),e&&this.on("start",()=>{e.lastSuccessfulAd=Date.now()})}_initLinearTracking(){this.linear=!0,this.skipDelay=this.creative.skipDelay,this.setDuration(this.creative.duration),this.clickThroughURLTemplate=this.creative.videoClickThroughURLTemplate,this.clickTrackingURLTemplates=this.creative.videoClickTrackingURLTemplates}_initVariationTracking(){if(this.linear=!1,this.skipDelay=-1,this.variation){for(const e in this.variation.trackingEvents){const t=this.variation.trackingEvents[e];this.trackingEvents[e]?this.trackingEvents[e]=this.trackingEvents[e].concat(t.slice(0)):this.trackingEvents[e]=t.slice(0)}this.variation.adType==="nonLinearAd"?(this.clickThroughURLTemplate=this.variation.nonlinearClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.nonlinearClickTrackingURLTemplates,this.setDuration(this.variation.minSuggestedDuration)):function(e){return e.adType==="companionAd"}(this.variation)&&(this.clickThroughURLTemplate=this.variation.companionClickThroughURLTemplate,this.clickTrackingURLTemplates=this.variation.companionClickTrackingURLTemplates)}}setDuration(e){Ie.isValidTimeValue(e)?(this.assetDuration=e,this.quartiles={firstQuartile:Math.round(25*this.assetDuration)/100,midpoint:Math.round(50*this.assetDuration)/100,thirdQuartile:Math.round(75*this.assetDuration)/100}):this.emit("TRACKER-error",{message:"the duration provided is not valid. duration: ".concat(e)})}setProgress(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!Ie.isValidTimeValue(e)||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given setProgress parameter has the wrong type. progress: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});const r=this.skipDelay||-1;if(r===-1||this.skippable||(r>e?this.emit("skip-countdown",r-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const i=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let o=this.lastPercentage;o<i;o++)a.push("progress-".concat(o+1,"%"));a.push("progress-".concat(e));for(const o in this.quartiles)this.isQuartileReached(o,this.quartiles[o],e)&&(a.push(o),this._alreadyTriggeredQuartiles[o]=!0);this.lastPercentage=i}a.forEach(o=>{this.track(o,{macros:t,once:n})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,n){let r=!1;return t<=n&&!this._alreadyTriggeredQuartiles[e]&&(r=!0),r}setMuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.muted!==e&&this.track(e?"mute":"unmute",{macros:t}),this.muted=e):this.emit("TRACKER-error",{message:"One given setMuted parameter has the wrong type. muted: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setPaused(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.paused!==e&&this.track(e?"pause":"resume",{macros:t}),this.paused=e):this.emit("TRACKER-error",{message:"One given setPaused parameter has the wrong type. paused: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setFullscreen(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.fullscreen!==e&&this.track(e?"fullscreen":"exitFullscreen",{macros:t}),this.fullscreen=e):this.emit("TRACKER-error",{message:"One given setFullScreen parameter has the wrong type. fullscreen: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setExpand(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="boolean"&&typeof t=="object"?(this.expanded!==e&&(this.track(e?"expand":"collapse",{macros:t}),this.track(e?"playerExpand":"playerCollapse",{macros:t})),this.expanded=e):this.emit("TRACKER-error",{message:"One given setExpand parameter has the wrong type. expanded: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}setSkipDelay(e){Ie.isValidTimeValue(e)?this.skipDelay=e:this.emit("TRACKER-error",{message:"setSkipDelay parameter does not have a valid value. duration: ".concat(e)})}trackImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.impressed||(this.impressed=!0,this.trackURLs(this.ad.impressionURLTemplates,e),this.track("creativeView",{macros:e})):this.emit("TRACKER-error",{message:"trackImpression parameter has the wrong type. macros: ".concat(e)})}trackViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewable,e)}):this.emit("TRACKER-error",{message:"trackViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackNotViewableImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.notViewable,e)}):this.emit("TRACKER-error",{message:"trackNotViewableImpression given macros has the wrong type. macros: ".concat(e)})}trackUndeterminedImpression(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.ad.viewableImpression.forEach(t=>{this.trackURLs(t.viewUndetermined,e)}):this.emit("TRACKER-error",{message:"trackUndeterminedImpression given macros has the wrong type. macros: ".concat(e)})}error(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"&&typeof t=="boolean"?this.trackURLs(this.ad.errorURLTemplates,e,{isCustomCode:t}):this.emit("TRACKER-error",{message:"One given error parameter has the wrong type. macros: ".concat(Ie.formatMacrosValues(e),", isCustomCode: ").concat(t)})}errorWithCode(e){let t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="string"&&typeof t=="boolean"?(this.error({ERRORCODE:e},t),console.log("The method errorWithCode is deprecated, please use vast tracker error method instead")):this.emit("TRACKER-error",{message:"One given errorWithCode parameter has the wrong type. errorCode: ".concat(e,", isCustomCode: ").concat(t)})}complete(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("complete",{macros:e}):this.emit("TRACKER-error",{message:"complete given macros has the wrong type. macros: ".concat(e)})}notUsed(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?(this.track("notUsed",{macros:e}),this.trackingEvents=[]):this.emit("TRACKER-error",{message:"notUsed given macros has the wrong type. macros: ".concat(e)})}otherAdInteraction(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("otherAdInteraction",{macros:e}):this.emit("TRACKER-error",{message:"otherAdInteraction given macros has the wrong type. macros: ".concat(e)})}acceptInvitation(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("acceptInvitation",{macros:e}):this.emit("TRACKER-error",{message:"acceptInvitation given macros has the wrong type. macros: ".concat(e)})}adExpand(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adExpand",{macros:e}):this.emit("TRACKER-error",{message:"adExpand given macros has the wrong type. macros: ".concat(e)})}adCollapse(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("adCollapse",{macros:e}):this.emit("TRACKER-error",{message:"adCollapse given macros has the wrong type. macros: ".concat(e)})}minimize(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("minimize",{macros:e}):this.emit("TRACKER-error",{message:"minimize given macros has the wrong type. macros: ".concat(e)})}verificationNotExecuted(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given verificationNotExecuted parameter has to wrong type. vendor: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});if(!this.ad||!this.ad.adVerifications||!this.ad.adVerifications.length)throw new Error("No adVerifications provided");if(!e)throw new Error("No vendor provided, unable to find associated verificationNotExecuted");const n=this.ad.adVerifications.find(i=>i.vendor===e);if(!n)throw new Error("No associated verification element found for vendor: ".concat(e));const r=n.trackingEvents;if(r&&r.verificationNotExecuted){const i=r.verificationNotExecuted;this.trackURLs(i,t),this.emit("verificationNotExecuted",{trackingURLTemplates:i})}}overlayViewDuration(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};typeof e=="string"&&typeof t=="object"?(t.ADPLAYHEAD=e,this.track("overlayViewDuration",{macros:t})):this.emit("TRACKER-error",{message:"One given overlayViewDuration parameters has the wrong type. formattedDuration: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))})}close(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track(this.linear?"closeLinear":"close",{macros:e}):this.emit("TRACKER-error",{message:"close given macros has the wrong type. macros: ".concat(e)})}skip(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("skip",{macros:e}):this.emit("TRACKER-error",{message:"skip given macros has the wrong type. macros: ".concat(e)})}load(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};typeof e=="object"?this.track("loaded",{macros:e}):this.emit("TRACKER-error",{message:"load given macros has the wrong type. macros: ".concat(e)})}click(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e!==null&&typeof e!="string"||typeof t!="object")return void this.emit("TRACKER-error",{message:"One given click parameter has the wrong type. fallbackClickThroughURL: ".concat(e,", macros: ").concat(Ie.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const n=this.clickThroughURLTemplate||e,r={...t};if(n){this.progress&&(r.ADPLAYHEAD=this.progressFormatted());const i=Ie.resolveURLTemplates([n],r)[0];this.emit("clickthrough",i)}}trackProgressEvents(e,t,n){const r=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(i=>{let[a]=i;return a.startsWith("progress-")}).map(i=>{let[a,o]=i;return{name:a,time:parseFloat(a.split("-")[1]),urls:o}}).filter(i=>{let{time:a}=i;return a<=r&&a>this.progress}).forEach(i=>{let{name:a,urls:o}=i;!n&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:o}),this.trackURLs(o,t),n?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:n=!1}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t!="object")return void this.emit("TRACKER-error",{message:"track given macros has the wrong type. macros: ".concat(t)});e==="closeLinear"&&!this.trackingEvents[e]&&this.trackingEvents.close&&(e="close"),e.startsWith("progress-")&&!e.endsWith("%")&&this.trackProgressEvents(e,t,n);const r=this.trackingEvents[e],i=this.emitAlwaysEvents.indexOf(e)>-1;r?(this.emit(e,{trackingURLTemplates:r}),this.trackURLs(r,t)):i&&this.emit(e,null),n&&(delete this.trackingEvents[e],i&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:i,invalidUrls:a}=Ie.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const o={...n};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map(c=>c.idRegistry.concat(" ",c.value)).join(",")),this.ad&&(this.ad.sequence&&(o.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(o.ADTYPE=this.ad.adType),this.ad.adServingId&&(o.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(o.ADCATEGORIES=this.ad.categories.map(c=>c.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(c=>c.value).join(","))),Ie.track(i,o,r)}convertToTimecode(e){if(!Ie.isValidTimeValue(e))return"";const t=1e3*e,n=Math.floor(t/36e5),r=Math.floor(t/6e4%60),i=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ie.addLeadingZeros(n,2),":").concat(Ie.addLeadingZeros(r,2),":").concat(Ie.addLeadingZeros(i,2),".").concat(Ie.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var pa,ma;class MC extends P.EventTarget{constructor(e,t){super(),it(this,pa,()=>{const n=this.skipDelay,r=this.player;n>0&&(r.duration()||this.duration)>=n&&(this.skipButtonElement&&(this.skipButtonElement.style.display="block"),this.options.displayRemainingTime&&(this.remainingTimeElement.style.display="block"),this.options.displayRemainingTimeIcons&&(this.remainingTimePlayElement&&this.remainingTimePlayElement.classList.remove("vjs-hidden"),this.remainingTimeMuteElement&&this.remainingTimeMuteElement.classList.remove("vjs-hidden")),r.on("adtimeupdate",Ae(this,ma))),r.loadingSpinner.el().style.display="none"}),it(this,ma,()=>{this.player.loadingSpinner.el().style.display="none";const n=Math.ceil(this.skipDelay-this.player.currentTime());if(this.options.displayRemainingTime){const r=Math.ceil(this.player.remainingTime());this.remainingTimeElement.innerHTML=this.options.messages.remainingTime.replace("{seconds}",r)}this.skipButtonElement&&(n>0?(UC(this.skipButtonElement),this.skipButtonElement.innerHTML=this.options.messages.skipCountdown.replace("{seconds}",n)):(BC(this.skipButtonElement),this.skipButtonElement.innerHTML=this.options.messages.skip))}),this.player=e,this.options=t,this.duration=0,this.skipDelay=0,this.originalState={controlsEnabled:e.controls(),seekEnabled:e.controlBar.progressControl.enabled()}}setUp(){const e=this.player,t=this.options,n=()=>{e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable()},r=()=>{const c=this.blocker=window.document.createElement("div");c.className="vast-blocker",c.onclick=()=>{if(e.paused())return e.play(),!1;this.trigger("click")},e.el().insertBefore(c,e.controlBar.el())},i=()=>{const c=this.skipButtonElement=window.document.createElement("div");c.className="vast-skip-button",c.style.display="none",e.el().appendChild(c),e.one("adplay",Ae(this,pa)),c.onclick=h=>{if((" "+c.className+" ").indexOf(" enabled ")>=0&&this.trigger("skip"),window.Event.prototype.stopPropagation!==void 0)h.stopPropagation();else return!1}},a=()=>{if(!t.displayRemainingTime)return;const c=this.remainingTimeElement=window.document.createElement("div");c.className="vast-remaining-time",c.style.display="none",e.el().appendChild(c)},o=c=>{if(!t.displayRemainingTimeIcons)return;const h={play:{className:"vjs-icon-play vast-remaining-time-icon-play",action:L=>L.paused()?L.play():L.pause(),toggleClasses:["vjs-icon-pause","vjs-icon-play"],events:["adplay","adpause"],initialState:L=>L.paused()?"vjs-icon-play":"vjs-icon-pause"},mute:{className:"vast-remaining-time-icon-mute",action:L=>L.muted(!L.muted()),toggleClasses:["vjs-icon-volume-high","vjs-icon-volume-mute"],events:["advolumechange"],initialState:L=>L.muted()?"vjs-icon-volume-mute":"vjs-icon-volume-high"}},{className:m,action:_,toggleClasses:T,events:S,initialState:w}=h[c],b=e.addChild("button",{className:`vjs-visible-text vjs-button vast-remaining-time-icon ${m}`,clickHandler:(function(){_(this.player)}).bind(this)});b.removeClass("vjs-control"),b.addClass(w(e));const R=()=>{T.forEach(L=>b.toggleClass(L))};this[`remainingTime${c.charAt(0).toUpperCase()+c.slice(1)}Element`]=b.el(),S.forEach(L=>e.on(L,R))};n(),r(),a(),t.displaySkipBtn&&i(),t.autoplay||o("play"),t.muted&&o("mute")}tearDown(){const e=this.player,t=this.originalState;this.duration=0,this.skipDelay=0,e.controls(t.controlsEnabled),t.seekEnabled?e.controlBar.progressControl.enable():e.controlBar.progressControl.disable(),this.blocker.parentElement.removeChild(this.blocker),this.skipButtonElement&&this.skipButtonElement.parentElement.removeChild(this.skipButtonElement),this.options.displayRemainingTime&&this.remainingTimeElement.parentElement.removeChild(this.remainingTimeElement),this.options.displayRemainingTimeIcons&&(this.remainingTimePlayElement.parentElement.removeChild(this.remainingTimePlayElement),this.remainingTimeMuteElement.parentElement.removeChild(this.remainingTimeMuteElement)),e.off("adtimeupdate",Ae(this,ma)),e.off("adplay",Ae(this,pa))}}pa=new WeakMap,ma=new WeakMap;function oy(s){return s&&(" "+s.className+" ").indexOf(" enabled ")>-1}function UC(s){s&&oy(s)&&(s.className=s.className.replace(" enabled ",""))}function BC(s){s&&!oy(s)&&(s.className+=" enabled ")}function ly(s,e=null){let t;return function(){return s&&(t=s.apply(e||this,arguments),s=null),t}}function cy(s){return s.type==="linear"&&s.mediaFiles.length}function np(s){return s.type==="companion"}function FC(s){return JSON.parse(JSON.stringify(s))}function jC(s,e=null){let t=null;if(typeof s=="string")if(s.includes("%"))e!=null&&(t=s.replace("%","")/100*e);else if(s.includes(":")){const[n,r,i]=s.split(":").slice(-3);t=parseInt(n||0,10)*3600+parseInt(r||0,10)*60+parseInt(i||0,10)}else t=parseInt(s);return t==null&&(t=Number(s)),isNaN(t)?null:t}var Xr,fa,Yr;class qC{constructor(e,t){it(this,Xr),it(this,fa),it(this,Yr),Ke(this,Xr,e),Ke(this,fa,t),Ke(this,Yr,!1)}get linearCreative(){return Ae(this,Xr).creative}get linearAdTracker(){return Ae(this,Xr)}get companionTracker(){return Ae(this,fa)}get skipAfterDuration(){return Ae(this,Yr)}set skipAfterDuration(e){Ke(this,Yr,e)}hasVideoMedia(){return this.linearCreative.mediaFiles.some(e=>e&&e.apiFramework==null)}}Xr=new WeakMap,fa=new WeakMap,Yr=new WeakMap;var Dn,ga,Nn,Kr,ya;class VC{constructor(e,t,n,r){it(this,Dn),it(this,ga),it(this,Nn),it(this,Kr),it(this,ya,i=>{const a=o=>{const c=new sp(Ae(this,Dn),o,o.creatives.find(cy),o.creatives.find(np));c.on("clickthrough",rp);let h=null;const m=o.creatives.find(np);if(m){const _=Ae(this,Nn),T=m.variations.filter(S=>S.staticResource).filter(S=>S.type.indexOf("image")===0).find(S=>parseInt(S.width,10)<=_.companion.maxWidth&&parseInt(S.height,10)<=_.companion.maxHeight);T&&(h=new sp(Ae(this,Dn),o,m,T),h.on("clickthrough",rp))}return new qC(c,h)};return i.map(a)}),Ke(this,Dn,e),Ke(this,ga,t),Ke(this,Kr,n),Ke(this,Nn,r)}loadAds(e={}){return new Promise((t,n)=>{const{url:r,xml:i}=e,a=(Array.isArray(r)?r:[r]).filter(c=>c!=null);let o;if(a.length)o=Promise.resolve([]),a.forEach(c=>{o=o.then(h=>h==null||h.length===0?this.loadAdsWithUrl(c):h).catch(h=>[])});else if(i!=null)o=this.loadAdsWithXml(i);else throw new Error("xml or url must be set");o.then(t).catch(n)})}loadAdsWithXml(e){return new Promise((t,n)=>{let r;if(e.constructor===window.XMLDocument)r=e;else if(e.constructor===String)r=new window.DOMParser().parseFromString(e,"application/xml");else throw new Error("xml config option must be a String or XMLDocument");Ae(this,ga).parseVAST(r).then(Ae(this,Kr).selectAds).then(Ae(this,ya)).then(t).catch(n)})}loadAdsWithUrl(e){return new Promise((t,n)=>{Ae(this,Dn).get(e,{withCredentials:Ae(this,Nn).withCredentials,wrapperLimit:Ae(this,Nn).wrapperLimit}).then(Ae(this,Kr).selectAds).then(Ae(this,ya)).then(t).catch(n)})}}Dn=new WeakMap,ga=new WeakMap,Nn=new WeakMap,Kr=new WeakMap,ya=new WeakMap;function rp(s){window.open(s,"_blank")}class $C{selectAds(e){if(!e.ads||e.ads.length===0)throw new Error("no ads found in VAST");const t=e.ads.filter(r=>r.creatives.some(cy));if(!t.length)throw new Error("no linear ads found in VAST");const n=t.filter(r=>r.sequence);return n.length?n.sort((r,i)=>r.sequence-i.sequence):t.filter(r=>!n.includes(r)).slice(0,1)}}function dy(){}function HC(s,e){return s?null:new Error(e)}var nc={};function uy(s){var e=nc[s];e&&(clearTimeout(e),delete nc[s])}function WC(s,e,t){var n,r;return r=setTimeout(function(){e=dy,delete r[n],t()},s),n=function(){e.apply(this,arguments)&&uy(n)},nc[n]=r,n}function zC(s,e,t){var n=document.createElement(e);return t&&(n.id=t),s.appendChild(n),n}function GC(s,e,t){var n=hy(s,null,t.zIndex);if(fy(n,my(e,t)))return n}function hy(s,e,t){var n=document.createElement("iframe");return n.src=e||"about:blank",n.marginWidth="0",n.marginHeight="0",n.frameBorder="0",n.width="100%",n.height="100%",py(n),t&&(n.style.zIndex=t),n.setAttribute("SCROLLING","NO"),s.innerHTML="",s.appendChild(n),n}function py(s){s.style.position="absolute",s.style.left="0",s.style.top="0",s.style.margin="0px",s.style.padding="0px",s.style.border="none",s.style.width="100%",s.style.height="100%"}function my(s,e){return Object.keys(e).forEach(function(t){var n=typeof n=="object"?JSON.stringify(e[t]):e[t];s=s.replace(new RegExp("{{"+t+"}}","g"),n)}),s}function fy(s,e){var t=s.contentWindow&&s.contentWindow.document;return t?(t.write(e),!0):!1}function XC(s,e){return Object.keys(e).forEach(function(t){s[t]=e[t]}),s}function YC(s){var e=-1;return function(){return s+"_"+ ++e}}var gy={noop:dy,validate:HC,clearCallbackTimeout:uy,callbackTimeout:WC,createElementInEl:zC,createIframeWithContent:GC,createIframe:hy,setFullSizeStyle:py,simpleTemplate:my,setIframeContent:fy,extend:XC,unique:YC},vl,ip;function KC(){if(ip)return vl;ip=1;var s=["handshakeVersion","initAd","startAd","stopAd","skipAd","resizeAd","pauseAd","resumeAd","expandAd","collapseAd","subscribe","unsubscribe"],e=["AdLoaded","AdStarted","AdStopped","AdSkipped","AdSkippableStateChange","AdSizeChange","AdLinearChange","AdDurationChange","AdExpandedChange","AdRemainingTimeChange","AdVolumeChange","AdImpression","AdVideoStart","AdVideoFirstQuartile","AdVideoMidpoint","AdVideoThirdQuartile","AdVideoComplete","AdClickThru","AdInteraction","AdUserAcceptInvitation","AdUserMinimize","AdUserClose","AdPaused","AdPlaying","AdLog","AdError"],t=["getAdLinear","getAdWidth","getAdHeight","getAdExpanded","getAdSkippableState","getAdRemainingTime","getAdDuration","getAdVolume","getAdCompanions","getAdIcons"],n=["setAdVolume"];function r(o,c,h){}r.prototype.handshakeVersion=function(o,c){},r.prototype.initAd=function(o,c,h,m,_,T,S){},r.prototype.startAd=function(o){},r.prototype.stopAd=function(o){},r.prototype.skipAd=function(o){},r.prototype.resizeAd=function(o,c,h,m){},r.prototype.pauseAd=function(o){},r.prototype.resumeAd=function(o){},r.prototype.expandAd=function(o){},r.prototype.collapseAd=function(o){},r.prototype.subscribe=function(o,c,h){},r.prototype.unsubscribe=function(o,c){},r.prototype.getAdLinear=function(o){},r.prototype.getAdWidth=function(o){},r.prototype.getAdHeight=function(o){},r.prototype.getAdExpanded=function(o){},r.prototype.getAdSkippableState=function(o){},r.prototype.getAdRemainingTime=function(o){},r.prototype.getAdDuration=function(o){},r.prototype.getAdVolume=function(o){},r.prototype.getAdCompanions=function(o){},r.prototype.getAdIcons=function(o){},r.prototype.setAdVolume=function(o,c){},a(r,"METHODS",s),a(r,"GETTERS",t),a(r,"SETTERS",n),a(r,"EVENTS",e);var i=s.filter(function(o){return["skipAd"].indexOf(o)===-1});a(r,"checkVPAIDInterface",function(o){var c=i.every(function(h){return typeof o[h]=="function"});return c}),vl=r;function a(o,c,h){Object.defineProperty(o,c,{writable:!1,configurable:!1,value:h})}return vl}var bl,ap;function QC(){if(ap)return bl;ap=1;function s(){this._subscribers={}}return s.prototype.subscribe=function(e,t,n){this.isHandlerAttached(e,t)||this.get(t).push({handler:e,context:n,eventName:t})},s.prototype.unsubscribe=function(e,t){this._subscribers[t]=this.get(t).filter(function(n){return e!==n.handler})},s.prototype.unsubscribeAll=function(){this._subscribers={}},s.prototype.trigger=function(e,t){var n=this,r=this.get(e).concat(this.get("*"));r.forEach(function(i){setTimeout(function(){n.isHandlerAttached(i.handler,i.eventName)&&i.handler.call(i.context,t)},0)})},s.prototype.triggerSync=function(e,t){var n=this.get(e).concat(this.get("*"));n.forEach(function(r){r.handler.call(r.context,t)})},s.prototype.get=function(e){return this._subscribers[e]||(this._subscribers[e]=[]),this._subscribers[e]},s.prototype.isHandlerAttached=function(e,t){return this.get(t).some(function(n){return e===n.handler})},bl=s,bl}var Tl,op;function JC(){if(op)return Tl;op=1;var s=KC(),e=QC(),t=s.checkVPAIDInterface,n=gy;s.METHODS;var r="AdError",i="AdClickThru",a=s.EVENTS.filter(function(T){return T!=i});function o(T,S,w,b){this._isValid=t(T),this._isValid&&(this._creative=T,this._el=S,this._videoEl=w,this._iframe=b,this._subscribers=new e,n.setFullSizeStyle(S),c.call(this))}o.prototype=Object.create(s.prototype),o.prototype.isValidVPAIDAd=function(){return this._isValid},s.METHODS.forEach(function(T){var S=["subscribe","unsubscribe","initAd"];S.indexOf(T)===-1&&(o.prototype[T]=function(){var w=s.prototype[T].length,b=Array.prototype.slice.call(arguments),R=w===b.length?b.pop():void 0;setTimeout((function(){var L,U=null;try{L=this._creative[T].apply(this._creative,b)}catch(M){U=M}_(R,this._subscribers,U,L)}).bind(this),0)})}),o.prototype.initAd=function(T,S,w,b,R,L,U){R=R||{},L=n.extend({slot:this._el,videoSlot:this._videoEl},L||{}),setTimeout((function(){var M;try{this._creative.initAd(T,S,w,b,R,L)}catch(F){M=F}_(U,this._subscribers,M)}).bind(this),0)},o.prototype.subscribe=function(T,S,w){this._subscribers.subscribe(S,T,w)},o.prototype.unsubscribe=function(T,S){this._subscribers.unsubscribe(S,T)},o.prototype.on=o.prototype.subscribe,o.prototype.off=o.prototype.unsubscribe,s.GETTERS.forEach(function(T){o.prototype[T]=function(S){setTimeout((function(){var w,b=null;try{w=this._creative[T]()}catch(R){b=R}_(S,this._subscribers,b,w)}).bind(this),0)}}),o.prototype.setAdVolume=function(T,S){setTimeout((function(){var w,b=null;try{this._creative.setAdVolume(T),w=this._creative.getAdVolume()}catch(R){b=R}b||(b=n.validate(w===T,"failed to apply volume: "+T)),_(S,this._subscribers,b,w)}).bind(this),0)},o.prototype._destroy=function(){this.stopAd(),this._subscribers.unsubscribeAll()};function c(){if(a.forEach((function(w){this._creative.subscribe(m.bind(this,w),w)}).bind(this)),this._creative.subscribe(h.bind(this),i),this._videoEl){var T=this._iframe.contentDocument.documentElement,S=this._videoEl;T.addEventListener("click",function(w){w.target===T&&S.click()})}}function h(T,S,w){this._subscribers.triggerSync(i,{url:T,id:S,playerHandles:w})}function m(T){this._subscribers.trigger(T,Array.prototype.slice(arguments,1))}function _(T,S,w,b){T?T(w,b):w&&S.trigger(r,w)}return Tl=o,Tl}var Vs=gy,ZC=Vs.unique("vpaidIframe"),e2=JC(),t2=`<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"></head><body style="margin:0;padding:0"><div class="ad-element"></div><script type="text/javascript" src="{{iframeURL_JS}}"><\/script><script type="text/javascript">window.parent.postMessage('{"event": "ready", "id": "{{iframeID}}"}', '{{origin}}');<\/script></body></html>`,s2="AdStopped";function yr(s,e,t,n){t=t||{},this._id=ZC(),this._destroyed=!1,this._frameContainer=Vs.createElementInEl(s,"div"),this._videoEl=e,this._vpaidOptions=n||{timeout:1e4},this._templateConfig={template:t.template||t2,extraOptions:t.extraOptions||{}}}yr.prototype.destroy=function(){this._destroyed||(this._destroyed=!0,ud.call(this))};yr.prototype.isDestroyed=function(){return this._destroyed};yr.prototype.loadAdUnit=function(s,e){a2.call(this),ud.call(this);var t=this,n=Vs.createIframeWithContent(this._frameContainer,this._templateConfig.template,Vs.extend({iframeURL_JS:s,iframeID:this.getID(),origin:lp()},this._templateConfig.extraOptions));this._frame=n,this._onLoad=Vs.callbackTimeout(this._vpaidOptions.timeout,r.bind(this),i.bind(this)),window.addEventListener("message",this._onLoad);function r(a){if(a.origin===lp()){var o=JSON.parse(a.data);if(o.id===t.getID()){var c,h,m;if(t._frame.contentWindow?(m=t._frame.contentWindow.getVPAIDAd,h=Vs.validate(typeof m=="function","the ad didn't return a function to create an ad")):h="the iframe is not anymore in the DOM tree",!h){var _=t._frame.contentWindow.document.querySelector(".ad-element");c=new e2(m(),_,t._videoEl,t._frame),c.subscribe(s2,r2.bind(t)),h=Vs.validate(c.isValidVPAIDAd(),"the add is not fully complaint with VPAID specification")}return t._adUnit=c,_y.call(t),e(h,h?null:c),!0}}}function i(){e("timeout",null)}};yr.prototype.unloadAdUnit=function(){ud.call(this)};yr.prototype.getID=function(){return this._id};function n2(s){var e=this[s];e&&(e.remove(),delete this[s])}function r2(){yy.call(this),delete this._adUnit}function ud(){yy.call(this),i2.call(this)}function yy(){n2.call(this,"_frame"),_y.call(this)}function _y(){this._onLoad&&(window.removeEventListener("message",this._onLoad),Vs.clearCallbackTimeout(this._onLoad),delete this._onLoad)}function i2(){this._adUnit&&(this._adUnit.stopAd(),delete this._adUnit)}function a2(){if(this._destroyed)throw new Error("VPAIDHTML5Client already destroyed!")}function lp(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")}var o2=yr;const l2=or(o2);function Gn(s){if(s){console.log("vastTracker",{...s});const e=s.ad,t=s.creative;return{mediaFiles:t.mediaFiles.map(n=>Object.assign({},n)),adSequenceId:e.sequence,adId:e.id,creativeAdId:t.id,skippable:s.skippable,skipDelay:s.skipDelay,hasAdUrl:!!t.videoClickThroughURLTemplate.url,whyThisAd:t.icons.find(n=>n.program==="GoogleWhyThisAd")}}}const c2=["application/x-javascript","text/javascript","application/javascript"];var nn,Fs,Qr,_a,va,Jr;class d2{constructor(e,t){it(this,nn),it(this,Fs),it(this,Qr),it(this,_a),it(this,va),it(this,Jr),Ke(this,_a,e),Ke(this,va,t),Ke(this,Jr,new P.EventTarget)}handle(e){return Ke(this,Fs,!1),Ke(this,Qr,!1),Ke(this,nn,!1),new Promise((t,n)=>{const r=Ae(this,va),i=Ae(this,_a);let a=null;const o=(T,S)=>{if(T){n(T);return}const w=()=>{R(),t(),i.trigger("vpaid.AdStopped"),i.trigger({type:"vast.adEnd",vast:Gn(e)})};S.subscribe("AdStopped",w);const b=N=>{if(S&&!Ae(this,nn)){S.unsubscribe("AdStopped",w);const j=()=>{Ke(this,nn,!0),R(),n(N),i.trigger("vpaid.AdStopped")};Al(S,"AdStopped",j,j),S.stopAd()}else Ke(this,nn,!0),n(N)};if(Ae(this,Jr).on("forceStopAd",b),Ae(this,Fs)){b("Received cancel signal from player");return}function R(){i.controlBar.show(),i.off("playerresize",F),_.destroy(),a&&(a.parentElement.removeChild(a),a=null)}const L=(N,j)=>{var J;if(N){log.console(N),b("Error on VPAID handshake");return}const Y={AdParameters:c.adParameters||"",Duration:c.duration||30,SkipTime:r.skip,ClickURL:((J=c.videoClickThroughURLTemplate)==null?void 0:J.url)||"about:blank",All:c,Options:r},re={};Al(S,"AdLoaded",U,b);const me=i.isFullscreen()?"fullscreen":"normal";S.subscribe("AdError",le=>{e.error({ERRORCODE:901}),Ke(this,nn,!0),R(),n(`Fatal VPAID Error: ${typeof le=="object"?JSON.stringify(le):le}`),i.trigger({type:"vpaid.AdError",error:le})}),S.initAd(i.currentWidth(),i.currentHeight(),me,-1,Y,re)},U=()=>{if(Ae(this,Fs)){b("Received cancel signal");return}S.subscribe("AdSkipped",()=>{e.skip(),i.trigger("vpaid.AdSkipped"),i.trigger({type:"vast.adSkip",vast:Gn(e)})}),S.subscribe("AdVolumeChange",()=>{const j=i.volume();S.getAdVolume((J,Y)=>{J||(Y===0&&j>0?e.setMuted(!0):Y>0&&j===0&&e.setMuted(!1),i.volume(Y),i.trigger("vpaid.AdVolumeChange"))})}),S.subscribe("AdImpression",()=>{e.trackImpression(),i.trigger("vpaid.AdImpression")}),S.subscribe("AdClickThru",({url:j,id:J,playerHandles:Y})=>{Y||e.once("clickthrough",re=>{window.open(re,"_blank")}),e.click(j),i.trigger("vpaid.AdClickThru")}),S.subscribe("AdVideoFirstQuartile",()=>{e.track("firstQuartile"),i.trigger("vpaid.AdVideoFirstQuartile")}),S.subscribe("AdVideoMidpoint",()=>{e.track("midpoint"),i.trigger("vpaid.AdVideoMidpoint")}),S.subscribe("AdVideoThirdQuartile",()=>{e.track("thirdQuartile"),i.trigger("vpaid.AdVideoThirdQuartile")}),S.subscribe("AdVideoComplete",()=>{e.track("complete"),i.trigger("vpaid.AdVideoComplete")}),S.subscribe("AdUserAcceptInvitation",()=>{e.acceptInvitation(),i.trigger("vpaid.AdUserAcceptInvitation")}),S.subscribe("AdUserMinimize",()=>{e.minimize(),i.trigger("vpaid.AdUserMinimize")}),S.subscribe("AdUserClose",()=>{e.close(),i.trigger("vpaid.AdUserClose")}),S.subscribe("AdPaused",()=>{e.setPaused(!0),i.trigger("vpaid.AdPaused")}),S.subscribe("AdPlaying",()=>{e.setPaused(!1),i.trigger("vpaid.AdPlaying")}),S.getAdLinear(vy((j,J)=>{if(Ae(this,Fs)){b("Received cancel signal");return}j?b(j):J?N():b("Non-linear not supported")},()=>{b("Unable to get mode of operation: linear or non-linear")}));const N=()=>{i.controlBar.hide();const j=ly(M);Al(S,"AdStarted",j,b),S.startAd()}},M=()=>{Ae(this,Fs)?b("Received cancel signal"):(Ke(this,Qr,!0),e.track("start"),i.on("playerresize",F),i.trigger("ads-ad-started"),i.trigger({type:"vast.adStart",vast:Gn(e)}))},F=()=>{S.resizeAd(i.currentWidth(),i.currentHeight(),i.isFullscreen()?"fullscreen":"normal")};S.handshakeVersion("2.0",L)},c=e.creative,h=c.mediaFiles.find(T=>T.apiFramework==="VPAID"&&h2(T));if(!h)throw new Error("Invalid VPAID media file: only JavaScript is supported");a=p2(r),i.el().insertBefore(a,i.controlBar.el());const m=u2(i,r),_=new l2(a,m,{});_.loadAdUnit(h.fileURL,o)})}cancel(){Ke(this,Fs,!0),Ae(this,Qr)&&Ae(this,Jr).trigger("forceStopAd")}}nn=new WeakMap,Fs=new WeakMap,Qr=new WeakMap,_a=new WeakMap,va=new WeakMap,Jr=new WeakMap;function u2(s,e){const t=e.vpaid.videoInstance;let n;return t==="none"?n=null:(t!=="same"&&console.log(`${t} is an invalid videoInstance value. Defaulting to 'same'.`),n=s.tech({kindaKnowWhatImDoing:!0}).el(),n==null&&console.log("Unable to find the video element for VPAID.")),n}function h2(s){return c2.indexOf(s.mimeType.trim())>-1}function p2(s){const e=s.vpaid.containerClass,t=document.createElement("div");return e&&t.classList.add(e),t}function vy(s,e=null){const t=setTimeout(()=>{s=()=>{},e&&e()},1e4);return function(){clearTimeout(t),s.apply(null,arguments)}}function Al(s,e,t,n){const r=vy(t,()=>{n&&n(new Error(`Timeout while waiting for ${e} event.`))});s.subscribe(e,r)}const m2=P.getPlugin("plugin"),f2=Object.freeze({seekEnabled:!1,controlsEnabled:!1,wrapperLimit:10,withCredentials:!0,skip:0,autoplay:!0,muted:!1,displaySkipBtn:!0,displayRemainingTime:!1,displayRemainingTimeIcons:!1,messages:{skip:"Skip",skipCountdown:"Skip in {seconds}...",remainingTime:"This ad will end in {seconds}"},vpaid:{containerClass:"vjs-vpaid-container",videoInstance:"none"},companion:{elementId:null,maxWidth:0,maxHeight:0},honorSkipOffset:!1});class g2 extends m2{constructor(e,t){super(e),typeof e.ads=="function"&&e.ads({debug:!0,stitchedAds:!0,liveCuePoints:!1}),t=(parseInt(P.VERSION,10)>=8?P.obj.merge:P.mergeOptions)(f2,t||{});const n=new OC,r=[];let i=null,a=0,o=0;const c=new d2(e,t);let h=!1,m=t.schedule;m==null||m.length===0?m=[{offset:0,url:t.url||null,xml:t.xml||null}]:(m=FC(m),m.forEach(z=>delete z.offsetInSeconds));const _=le(m),T=ge(m),S=se(m).sort((z,ee)=>z.offset-ee.offset);e.on("adtimeout",()=>{console.log("Ad timeout"),h=!0});const w=new MC(e,t);function b(){i!=null&&i.hasVideoMedia()&&(i.linearAdTracker.skip(),e.trigger({type:"vast.skipAd",vast:Gn(i.linearAdTracker)}),F())}this.skipAd=b,w.on("skip",b),w.on("click",()=>{!e.paused()&&!t.autoplay&&e.pause()}),this.adAction=()=>{i.linearAdTracker.click()};const R=(()=>{let z=!1;return()=>{if(z)return;let ee=null;for(;S.length>0&&(ee=S[0].offsetInSeconds,ee==null);){const{offset:ce}=S[0];ee=jC(ce,e.duration()),ee==null?S.shift():S[0].offsetInSeconds=ee}if(ee!=null&&this.player.currentTime()>ee){z=!0;const ce=S.shift();U.loadAds(ce).then(ne=>{ne.length>0&&(r.push(...ne),i=null,Y())}).catch(ne=>{console.log(`An error occurred when loading ads for the midroll ad break: : ${ne==null?void 0:ne.message}`)}).finally(()=>{z=!1})}}})();S.length>0&&e.on("timeupdate",R),e.on("readyforpostroll",()=>{h=!1,U.loadAds(T).then(z=>{h?z.forEach(ee=>{ee.linearAdTracker.error({ERRORCODE:301})}):z.length>0?(r.push(...z),i=null,Y()):e.trigger("nopostroll")}).catch(z=>{console.log(`An error occurred when loading ads for the postroll ad break: : ${z.message}`),e.trigger("nopostroll")})}),e.on("readyforpreroll",()=>{Y()});const L=ly(()=>{e.trigger("adsready")});setTimeout(L,3e3);const U=new VC(n,new ay,new $C,t);U.loadAds(_).then(z=>{console.log("trackedAds",z),h?z.forEach(ee=>{ee.linearAdTracker.error({ERRORCODE:301})}):z.length>0?(r.push(...z),i=null,L(),i||Y()):e.trigger("nopreroll")}).catch(z=>{console.log(`An error occurred when loading ads for the preroll ad break: ${z.message}`),e.trigger("nopreroll")});const M=z=>z.filter(ee=>ee.apiFramework==null).map(ee=>({type:ee.mimeType,src:ee.fileURL})),F=()=>{const z=r.shift();if(z!=null&&z.hasVideoMedia()?i!=null&&i.hasVideoMedia()||w.setUp():i!=null&&i.hasVideoMedia()&&w.tearDown(),z){if(i=z,a++,console.log(`Playing ad ${a}/${o}`),i.hasVideoMedia()){const ee=i.linearCreative.mediaFiles,ce=ee.filter(Oe=>Oe.deliveryType==="streaming"),ne=ee.filter(Oe=>Oe.deliveryType!=="streaming");if(ne.length>0)e.src(M(ne));else if(ce.length>0){let Oe=i.linearAdTracker.assetDuration;if(Oe==null||Oe<1){console.log("Streaming ads must have a duration"),F();return}e.src(M(ce)),i.skipAfterDuration=!0}w.duration=i.linearAdTracker.assetDuration||0;const Pe=i.linearAdTracker.skipDelay;w.skipDelay=Pe!=null&&t.honorSkipOffset?Pe:t.skip,t.autoplay&&e.play(),t.muted&&e.muted(!0)}else c.handle(i.linearAdTracker).then(()=>{F()}).catch(ee=>{console.log(ee),F()});J()}else i=null,a=0,he()},{setUpEvents:N,tearDownEvents:j}=(()=>{const z=()=>{if(i.skipAfterDuration){const st=i;setTimeout(()=>{i===st&&b()},st.linearAdTracker.assetDuration*1e3)}!i.linearAdTracker.impressed&&i.hasVideoMedia()&&(i.linearAdTracker.trackImpression(),e.trigger({type:"vast.adStart",vast:Gn(i.linearAdTracker),adCount:a,adTotal:o,skipDelay:w.skipDelay}))},ee=()=>{i&&(isNaN(i.linearAdTracker.assetDuration)&&(i.linearAdTracker.assetDuration=e.duration()),i.linearAdTracker.setProgress(e.currentTime()))},ce=()=>{e.remainingTime()>0&&(i.linearAdTracker.setPaused(!0),e.one("adplay",()=>{i.linearAdTracker.setPaused(!1)}))},ne=()=>{i.linearAdTracker.error({ERRORCODE:405}),e.error(null),F()},Pe=()=>{i.linearAdTracker.setFullscreen(e.isFullscreen())},Oe=(()=>{let st=e.muted(),ut=e.volume();return()=>{const be=e.volume(),Re=e.muted();st!==Re?(i.linearAdTracker.setMuted(Re),st=Re):ut!==be&&(ut>0&&be===0?i.linearAdTracker.setMuted(!0):ut===0&&be>0&&i.linearAdTracker.setMuted(!1),ut=be)}})(),tt=()=>{i.hasVideoMedia()&&(i.linearAdTracker.complete(),e.trigger({type:"vast.adEnd",vast:Gn(i.linearAdTracker)}),F())};return{setUpEvents:()=>{e.on("adended",tt),e.on("adplay",z),e.on("adtimeupdate",ee),e.on("adpause",ce),e.on("aderror",ne),e.on("advolumechange",Oe),e.on("fullscreenchange",Pe)},tearDownEvents:()=>{e.off("adended",tt),e.off("adplay",z),e.off("adtimeupdate",ee),e.off("adpause",ce),e.off("aderror",ne),e.off("advolumechange",Oe),e.off("fullscreenchange",Pe)}}})(),J=()=>{const z=i.companionTracker,ee=document.getElementById(t.companion.elementId);if(z&&z.variation&&ee){const ce=z.variation,ne=()=>{z.click()},Pe=document.createElement("a");Pe.src="#",Pe.addEventListener("click",ne);const Oe=document.createElement("img");Oe.src=ce.staticResource,Pe.appendChild(Oe),ee.innerHTML="",ee.appendChild(Pe)}else ee&&(ee.innerHTML="")},Y=()=>{o=r.length,console.log(`Playing ${o} ads`),e.ads.startLinearAdMode(),N(),F()};function re(z){return z.offset===0||z.offset==null||z.offset==="pre"}function me(z){return z.offset==="post"}function le(z){return z.find(re)}function ge(z){return z.find(me)}function se(z){return z.filter(ee=>!re(ee)&&!me(ee))}const he=()=>{e.ads.endLinearAdMode(),j()}}}P.registerPlugin("vast",g2);const y2=({promotion:s,controlVideo:e,onClose:t,promotionId:n,externalAd:r,skipAutoClose:i})=>{var a,o,c,h,m;const _=Ge.useRef(null),T=Ge.useRef(),S=Ge.useRef(),[w,b]=Ge.useState(!0),[R,L]=Ge.useState(!0),[U,M]=Ge.useState(!1),[F,N]=Ge.useState(0),[j,J]=Ge.useState(0),[Y,re]=Ge.useState(0),[me,le]=Ge.useState(0),[ge,se]=Ge.useState(),he=Ge.useCallback(()=>{T.current&&(T.current.dispose(),T.current=void 0)},[]),z=Ge.useCallback(()=>{N(0),J(0),re(0),b(!1),se(void 0),e==null||e({muted:!1}),he(),S.current=void 0,T.current=void 0,_.current&&(_.current.innerHTML="")},[e,he]);Ge.useEffect(()=>{if(r!=null&&r.url&&_.current){b(!0);const ce=document.createElement("video");ce.classList.add("video-js","vjs-default-skin"),_.current.appendChild(ce),T.current=P(ce,{controls:!1,playsinline:!0}),T.current.on("pause",()=>{L(!0)}),T.current.on("play",()=>{L(!1)}),T.current.on("vast.play",ne=>{console.log("Ad is playing",ne)}),T.current.on("timeupdate",ne=>{N(Math.round(ne.target.player.duration()-ne.target.player.currentTime()))}),T.current.on("vast.adStart",ne=>{console.log("Ad is start",ne),b(!0),re(ne.adCount),J(ne.adTotal),le(ne.skipDelay),M(ne.vast.hasAdUrl),se(ne.vast.whyThisAd),ne.vast.whyThisAd&&console.log(JSON.stringify(ne.vast.whyThisAd,null,2))}),T.current.on("nopreroll",ne=>{console.log("Ad is nopreroll",ne)}),T.current.on("nopostroll",ne=>{console.log("Ad is nopostroll",ne)}),T.current.on("vast.adEnd",ne=>{console.log("Ad is end",ne),b(!1),t==null||t()}),T.current.on("vast.skipAd",ne=>{console.log("Ad is skip",ne),z(),t==null||t()}),fk(_.current,r==null?void 0:r.url)().then(ne=>{ne&&T.current?S.current=T.current.vast({url:ne.toString(),honorSkipOffset:!0,displayRemainingTimeIcons:!0,displaySkipBtn:!1,withCredentials:!0,autoplay:ne.searchParams.get("vpa")!=="click",muted:ne.searchParams.get("vpmute")==="1"}):z()}).catch(ne=>{console.log("error",ne),z()})}return z},[r==null?void 0:r.url,he,z,t]);const ee=((a=s.sponsor)==null?void 0:a.logo)&&s.logoMode===ye.PromotionLogoMode.CENTER;return G.jsxs(hp,{className:"PromoOverlay",children:[G.jsxs(pp,{children:[G.jsx(mp,{className:Q.cx_default(!ee&&fp),children:G.jsx(yp,{style:{transform:"scale(1.5)"},children:"Ad"})}),G.jsxs(Wb,{children:[G.jsx(qb,{time:F,adCount:j,adPosition:Y}),!!me&&w&&G.jsx(Q.y$1,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{var ce;(ce=S.current)==null||ce.skipAd()},duration:me,isPlaying:!R,skipIcon:!0}),i&&G.jsx(Q.y$1,{className:"ClosePromoIcon",close:()=>{z(),t==null||t()}})]})]}),G.jsx(gp,{className:Q.cx_default(au,w&&ou,!w&&lu),children:G.jsx(Hb,{ref:_,children:ge&&G.jsx($b,{whyThisAd:ge})})}),U&&G.jsx(_p,{className:Q.cx_default(au,w&&ou,!w&&lu),children:G.jsx(vp,{as:"button",onClick:()=>{var ce;(ce=S.current)==null||ce.adAction()},style:{backgroundColor:((c=(o=s.banner)==null?void 0:o.ctaButton)==null?void 0:c.color)||"#009dc4",color:((m=(h=s.banner)==null?void 0:h.ctaButton)==null?void 0:m.textColor)||"#fff"},"data-analytics":"button","data-promo-id":n,"data-promo-type":s.type,target:"_blank",children:"Show more"})})]})},cp=s=>{var e,t,n,r,i,a,o,c,h,m,_,T,S,w,b,R,L,U,M,F,N,j,J,Y,re,me,le,ge,se,he;const{promotion:z,open:ee,advertisementPaused:ce,togglePause:ne,controlVideo:Pe,skipAutoClose:Oe,promotionId:tt,onClose:st,markAsViewed:ut,externalAd:be}=s,Re=z.type===ye.PromotionType.INGAME_IAB11_LBAR||z.type===ye.PromotionType.INGAME_IAB11,ps=((e=z.sponsor)==null?void 0:e.logo)&&z.logoMode===ye.PromotionLogoMode.CENTER,Gs=!!((n=(t=z.banner)==null?void 0:t.video)!=null&&n.url),ms=z.autoPlayVideo===ye.AutoPlayVideo.ENABLED;if(Ge.useEffect(()=>{ne==null||ne(Gs||ms),ee==null||ee()},[]),Ge.useEffect(()=>{tt&&z.type&&ut&&ut()},[tt,z.type,ut]),Ge.useEffect(()=>()=>{Pe==null||Pe({muted:!1})},[Pe]),be)return G.jsx(y2,{...s,externalAd:be});let Gt=(r=z.banner)==null?void 0:r.url;Gt&&Gt.indexOf("http")!==0&&(Gt=`https://${Gt}`);let Cs=!0;return Gs&&(!ce||!ms?Cs=!0:Cs=!1),G.jsxs(hp,{className:"PromoOverlay",children:[G.jsxs(pp,{children:[G.jsxs(mp,{className:Q.cx_default(!ps&&fp),children:[((i=z.sponsor)==null?void 0:i.logo)&&z.logoMode===ye.PromotionLogoMode.LEFT&&G.jsx(nu,{className:"PromoSponsorLogo",src:(a=z.sponsor)==null?void 0:a.logo,alt:"promo"}),G.jsxs(Nb,{style:{paddingLeft:(o=z.sponsor)!=null&&o.logo&&z.logoMode===ye.PromotionLogoMode.LEFT?"0px":"8px"},children:[((c=z.sponsor)==null?void 0:c.logo)&&z.logoMode===ye.PromotionLogoMode.LEFT&&G.jsx(Lb,{children:(h=z.sponsor)==null?void 0:h.name}),G.jsxs(Ob,{className:"SponsorText",children:[G.jsx(yp,{children:"AD"}),G.jsx(Mb,{children:"SPONSORED"})]})]})]}),G.jsx(Q.y$1,{className:"ClosePromoIcon",close:st,autoClose:(m=z.closeTimer)==null?void 0:m.auto,duration:Oe?0:(_=z.closeTimer)==null?void 0:_.seconds,isPlaying:Cs})]}),G.jsxs(gp,{children:[ps&&G.jsx(nu,{className:Rb,src:(T=z.sponsor)==null?void 0:T.logo,alt:"promo"}),G.jsx(ru,{children:(w=(S=z.banner)==null?void 0:S.video)!=null&&w.url?G.jsx(Q.Y,{source:(R=(b=z.banner)==null?void 0:b.video)==null?void 0:R.url,poster:(U=(L=z.banner)==null?void 0:L.video)==null?void 0:U.thumbnailUrl,aspectRatio:Re?"1/1":"16/9",onPause:()=>{ms&&(ne==null||ne(!0))},onPlay:()=>{Q.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:tt,type:z.type}}),ne==null||ne(!1)},controlVideo:Pe,autoPlay:ms}):(M=z.banner)!=null&&M.imageUrl?G.jsx(Pb,{style:Re?{aspectRatio:"1/1"}:{},src:(F=z.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!Re&&G.jsxs(ru,{children:[((N=z.banner)==null?void 0:N.title)&&G.jsx(Ub,{className:Q.cx_default("AdvTitle",ps&&Bb),children:(j=z.banner)==null?void 0:j.title}),((J=z.banner)==null?void 0:J.body)&&G.jsx(Db,{className:"AdvDescription",children:(Y=z.banner)==null?void 0:Y.body})]})]}),z.buttonType!==ye.PromotionButtonType.NO_BUTTON&&G.jsx(_p,{children:G.jsx(vp,{href:Gt,style:{backgroundColor:((me=(re=z.banner)==null?void 0:re.ctaButton)==null?void 0:me.color)||"#009dc4",color:((ge=(le=z.banner)==null?void 0:le.ctaButton)==null?void 0:ge.textColor)||"#fff"},"data-analytics":"button","data-promo-id":tt,"data-promo-type":z.type,target:"_blank",children:(he=(se=z.banner)==null?void 0:se.ctaButton)==null?void 0:he.label})})]})},_2=Q.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),v2=({children:s,direction:e,style:t,className:n,hiding:r})=>G.jsx(rc,{direction:e,style:t,hiding:r,className:n,children:G.jsx(_2,{children:s})}),b2=s=>(s==null?void 0:s.type)===ye.PromotionType.INGAME_IAB11_LBAR||(s==null?void 0:s.type)===ye.PromotionType.INGAME_IAB21_LBAR,T2=s=>(s==null?void 0:s.type)===ye.PromotionType.INGAME_IAB11||(s==null?void 0:s.type)===ye.PromotionType.INGAME_IAB21,A2=({advertisement:s,close:e,skipTypeCheck:t,skipAutoClose:n,layoutMode:r="side-by-side",sidebar:i,isNotification:a,banner:o,markAsViewed:c,open:h,externalAd:m,controlVideo:_,advertisementPaused:T,togglePause:S})=>s.promotion?a&&s.notification?G.jsx(Ib,{open:()=>h==null?void 0:h({fromNotification:!0}),notification:s.notification,promotionId:s.question.id}):!i&&!o&&(t||T2(s.promotion))?G.jsx(xb,{className:"PromoOverlayContainer",children:G.jsx(cp,{markAsViewed:c,promotionId:s.question.id,promotion:s.promotion,onClose:e,open:h,skipAutoClose:n,externalAd:m,controlVideo:_,advertisementPaused:T,togglePause:S})}):i&&(t||b2(s.promotion))?G.jsx(v2,{className:"PromoSidebarContainer",direction:i,hiding:!1,children:G.jsx(cp,{markAsViewed:c,promotionId:s.question.id,promotion:s.promotion,externalAd:m,onClose:e,open:h,controlVideo:_,skipAutoClose:n,advertisementPaused:T,togglePause:S})}):o?G.jsx(zv,{promotionId:s.question.id,hiding:!1,promotion:s.promotion,direction:o}):null:null,S2=Q.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),E2=s=>{const e=s.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",n=e.getAttribute("data-promo-type")||ye.PromotionType.UNSET;e.getAttribute("data-analytics")==="button"&&Q.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:n}}),e.getAttribute("data-analytics")==="banner"&&Q.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:n}})}},w2=({gamification:s,layoutMode:e,skipAutoClose:t,skipTypeCheck:n,sidebar:r,banner:i,notification:a,isMobileScreen:o,persistent:c,externalAd:h,controlVideo:m})=>{var _,T,S;const w=Ge.useRef(null),b=Q.useStore(s.advertisement.$store);Q.y(w,{enabled:!!b.data,event:"click",listener:E2});const R=!i&&!r;if(b.data===void 0||!c&&b.isViewed)return null;const L=((S=(T=(_=b==null?void 0:b.data)==null?void 0:_.notification)==null?void 0:T.promotion)==null?void 0:S.mode)===ye.NotificationPromotionMode.LOWER_THIRD;return G.jsx(S2,{ref:w,style:{height:R?"auto":"100%"},className:Q.cx_default("SL-AdvertisementUIWrap",o&&"mobile-view",L&&"SL-AdvertisementUIWrap--lower-third"),children:G.jsx(A2,{skipTypeCheck:n,sidebar:r,banner:i,advertisement:b.data,advertisementPaused:b.isPaused,togglePause:b.togglePause,close:b.close,externalAd:h?b.externalAd:void 0,markAsViewed:s.advertisement.markAsViewed,open:s.advertisement.open,layoutMode:e,isNotification:a,skipAutoClose:t,controlVideo:m})})},by=({sdk:s,sidebar:e,externalAd:t,banner:n,skipAutoClose:r,skipTypeCheck:i,layoutMode:a,isMobileScreen:o,persistent:c,notification:h})=>{const m=Q.useStore(s.featuresList.getStore()),[_,T]=Ge.useState(!t);if(Ge.useEffect(()=>{if(t){const w=document.createElement("script");w.async=!0,w.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(w),w.onload=()=>{T(!0)}}},[t]),e&&n)return G.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(n&&t)return G.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!m)return null;const S=s.getFeature(ye.SdkOverlayType.GAMES);return!S||t&&!_?null:G.jsx(w2,{gamification:S,sidebar:e,banner:n,layoutMode:a,isMobileScreen:o,persistent:c,notification:h,skipTypeCheck:i,skipAutoClose:r,externalAd:t,controlVideo:s.controlVideoPlayer})},k2=({event:s,sidebar:e,banner:t,isMobileScreen:n,skipAutoClose:r,persistent:i,theme:a,notification:o,skipTypeCheck:c,externalAd:h})=>{const m=Q.useStreamLayer(),_=Q.useStreamLayerUI(),T=Q.useStreamLayerTheme();return m?h&&!_.promotionExternalAd?s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s}):!h&&_.promotionExternalAd?s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s}):e&&!_.promotionSidebar?s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s}):t&&!_.promotionBanner?s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s}):o&&!_.promotionNotification?s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s}):!t&&!e&&!o&&!_.promotionOverlay?s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s}):G.jsxs("div",{className:"StreamLayerSDK",children:[G.jsx(Q.h,{customTheme:a??T.theme,themeMode:T.themeMode,children:G.jsx(by,{sdk:m,sidebar:e,banner:t,isMobileScreen:n,persistent:i,notification:o,skipTypeCheck:c,skipAutoClose:r,layoutMode:"side-by-side",externalAd:h})}),s!==void 0&&G.jsx(Q.StreamLayerSDKEvent,{event:s})]}):null};exports.StreamLayerSDKAdvertisement=k2;exports.StreamLayerSDKAdvertisementUI=by;
|