@streamlayer/react 1.22.3 → 1.23.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/app/pause-ad.d.ts +2 -4
- package/lib/app/polymarket.d.ts +7 -0
- package/lib/cjs/Question.js +1 -1
- package/lib/cjs/advertisement.js +44 -40
- package/lib/cjs/analytics.js +1 -1
- package/lib/cjs/auth.js +1 -1
- package/lib/cjs/bet-pack.js +1 -1
- package/lib/cjs/feature.js +1 -0
- package/lib/cjs/hooks-WfHlJH12.js +1 -0
- package/lib/cjs/index-eShKGO10.js +5 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index10.js +1 -1
- package/lib/cjs/index16.js +2 -2
- package/lib/cjs/index2.js +1 -1
- package/lib/cjs/index3.js +1 -1
- package/lib/cjs/index4.js +1 -1
- package/lib/cjs/index7.js +1 -5
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +5 -5
- package/lib/cjs/notification.js +1 -1
- package/lib/cjs/pause-ad.js +1 -1
- package/lib/cjs/points.js +1 -1
- package/lib/cjs/polymarket.js +19 -0
- package/lib/cjs/useStreamLayerApp2.js +17 -17
- package/lib/classic/app/pause-ad.d.ts +2 -4
- package/lib/classic/app/polymarket.d.ts +7 -0
- package/lib/classic/cjs/Question.js +1 -1
- package/lib/classic/cjs/advertisement.js +44 -40
- package/lib/classic/cjs/analytics.js +1 -1
- package/lib/classic/cjs/auth.js +1 -1
- package/lib/classic/cjs/bet-pack.js +3 -3
- package/lib/classic/cjs/feature.js +1 -0
- package/lib/classic/cjs/hooks-WfHlJH12.js +1 -0
- package/lib/classic/cjs/index-eShKGO10.js +5 -0
- package/lib/classic/cjs/index.js +1 -1
- package/lib/classic/cjs/index10.js +1 -1
- package/lib/classic/cjs/index11.js +1 -1
- package/lib/classic/cjs/index12.js +1 -1
- package/lib/classic/cjs/index13.js +1 -1
- package/lib/classic/cjs/index2.js +2 -2
- package/lib/classic/cjs/index3.js +1 -1
- package/lib/classic/cjs/index4.js +1 -1
- package/lib/classic/cjs/index5.js +1 -1
- package/lib/classic/cjs/index6.js +1 -5
- package/lib/classic/cjs/index9.js +1 -1
- package/lib/classic/cjs/insight.js +1 -1
- package/lib/classic/cjs/notification.js +1 -1
- package/lib/classic/cjs/notification2.js +1 -1
- package/lib/classic/cjs/pause-ad.js +1 -1
- package/lib/classic/cjs/points.js +1 -1
- package/lib/classic/cjs/polymarket.js +19 -0
- package/lib/classic/cjs/useStreamLayerApp2.js +17 -17
- package/lib/classic/es/Question.js +50 -50
- package/lib/classic/es/advertisement.js +15547 -10742
- package/lib/classic/es/analytics.js +74 -18
- package/lib/classic/es/auth.js +1 -1
- package/lib/classic/es/bet-pack.js +19 -18
- package/lib/classic/es/feature.js +63 -0
- package/lib/classic/es/hooks-WfHlJH12.js +98 -0
- package/lib/classic/es/index-eShKGO10.js +3757 -0
- package/lib/classic/es/index.js +1 -1
- package/lib/classic/es/index10.js +1 -1
- package/lib/classic/es/index11.js +767 -755
- package/lib/classic/es/index12.js +1 -1
- package/lib/classic/es/index13.js +2 -2
- package/lib/classic/es/index2.js +125 -125
- package/lib/classic/es/index3.js +16 -61
- package/lib/classic/es/index4.js +282 -16
- package/lib/classic/es/index5.js +4 -283
- package/lib/classic/es/index6.js +5 -3758
- package/lib/classic/es/index9.js +1 -1
- package/lib/classic/es/insight.js +1 -1
- package/lib/classic/es/notification.js +1 -1
- package/lib/classic/es/notification2.js +476 -451
- package/lib/classic/es/pause-ad.js +174 -208
- package/lib/classic/es/points.js +16 -15
- package/lib/classic/es/polymarket.js +6670 -0
- package/lib/classic/es/useStreamLayerApp2.js +5088 -4030
- package/lib/dist/cjs/index-eShKGO10.js +5 -0
- package/lib/dist/cjs/masters.js +36 -36
- package/lib/dist/es/index-eShKGO10.js +3757 -0
- package/lib/dist/es/masters.js +9243 -8192
- package/lib/dist/index.d.ts +30 -7
- package/lib/dist/style.css +1 -1
- package/lib/es/Question.js +3 -3
- package/lib/es/advertisement.js +15547 -10742
- package/lib/es/analytics.js +74 -18
- package/lib/es/auth.js +1 -1
- package/lib/es/bet-pack.js +1 -1
- package/lib/es/feature.js +63 -0
- package/lib/es/hooks-WfHlJH12.js +98 -0
- package/lib/es/index-eShKGO10.js +3757 -0
- package/lib/es/index.js +1 -1
- package/lib/es/index10.js +9 -9
- package/lib/es/index16.js +2 -2
- package/lib/es/index2.js +118 -118
- package/lib/es/index3.js +3 -61
- package/lib/es/index4.js +1 -1
- package/lib/es/index7.js +5 -3758
- package/lib/es/insight.js +1 -1
- package/lib/es/masters.js +1 -1
- package/lib/es/masters2.js +23 -23
- package/lib/es/notification.js +450 -425
- package/lib/es/pause-ad.js +174 -208
- package/lib/es/points.js +5 -4
- package/lib/es/polymarket.js +6670 -0
- package/lib/es/useStreamLayerApp2.js +5088 -4030
- package/lib/style.css +1 -1
- package/package.json +27 -17
- package/lib/cjs/hooks-B0Qttldg.js +0 -1
- package/lib/cjs/index-DSi8Qgfs.js +0 -1
- package/lib/cjs/vast-client.min.js +0 -1
- package/lib/classic/cjs/hooks-B0Qttldg.js +0 -1
- package/lib/classic/cjs/index-DSi8Qgfs.js +0 -1
- package/lib/classic/cjs/vast-client.min.js +0 -1
- package/lib/classic/es/hooks-B0Qttldg.js +0 -98
- package/lib/classic/es/index-DSi8Qgfs.js +0 -65
- package/lib/classic/es/vast-client.min.js +0 -1060
- package/lib/es/hooks-B0Qttldg.js +0 -98
- package/lib/es/index-DSi8Qgfs.js +0 -65
- package/lib/es/vast-client.min.js +0 -1060
package/lib/cjs/advertisement.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const W=require("react/jsx-runtime"),Jm=require("./index8.js"),Q=require("./sl-types.js"),Zm=require("./analytics.js"),Te=require("react"),qt=require("./index3.js"),re=require("./useStreamLayerApp2.js"),Or=require("./index14.js"),eg=require("./index6.js"),ur=require("./index13.js"),Lc=require("./vast-client.min.js"),Jt=require("./index15.js"),tg=require("./index7.js"),Qs=require("uuid"),Oc=require("./index-DSi8Qgfs.js"),ig=require("./utils.js"),Vt=require("./hooks-B0Qttldg.js");function je(){return je=Object.assign?Object.assign.bind():function(s){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(s[i]=t[i])}return s},je.apply(null,arguments)}const sg=Q.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),ng="a1rlj479",rg="s35f1di",ag="sj4471g",og="b12050d8",lg="b1d5ybek",ug=s=>s==="left"||s==="right"?rg:og,cg=s=>s==="left"||s==="right"?ag:lg,dg=s=>s==="left"?"avdxyl3":s==="right"?"a1bisd08":s==="top"?"a1u9y2aj":"a1qqaks",xo=({children:s,style:e,className:t,enabled:i=!0,hiding:n,direction:r="left",onAnimationEnd:a})=>W.jsx(sg,{style:e,className:Q.cx_default(t,ng,dg(r),i&&!n&&ug(r),i&&n&&cg(r)),onAnimationEnd:a,children:s}),hg=Q.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),fg=Q.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),pg=()=>hg,mg=Q.styled_default(pg())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),Rc=({promotion:s,promotionId:e,hiding:t,isEventFired:i,fireEvent:n,direction:r="bottom"})=>{const a=(s==null?void 0:s.adUnit)===re.AdUnit.STANDART,l=a?s.banner:s.additionalBanner;if(Te.useEffect(()=>{l!=null&&l.imageUrl&&s.type&&e&&(i!=null&&i("banner-showed")||(qt.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:s.type}}),n==null||n("banner-showed")))},[l==null?void 0:l.imageUrl,n,i,s.type,e]),!(l!=null&&l.imageUrl))return null;let h=l==null?void 0:l.url;return h&&h.indexOf("http")!==0&&(h=`https://${h}`),W.jsx(xo,{direction:r,hiding:t,children:W.jsx(fg,{className:"BannerContainer","data-is-ad":a,children:W.jsx(mg,{as:h?"a":"span",className:"BannerLink",href:h,style:{backgroundImage:`url(${l.imageUrl})`,cursor:h?"pointer":"default"},"data-promo-id":e,"data-promo-type":s.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},gg=({cardId:s,promotion:e,direction:t="bottom"})=>W.jsx(Rc,{promotion:e,promotionId:s,direction:t,hiding:!1}),yg=Q.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),_g=Q.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Tg=Q.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),vg=Q.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),ts=Q.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),bg=()=>ts,xg=Q.styled_default(bg())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),su=Q.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),Sg=Q.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),Eg=Q.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Cg=Q.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),wg=Q.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Mc=Q.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Ig=()=>Mc,Ag=Q.styled_default(Ig())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),kg=()=>Mc,Nc=Q.styled_default(kg())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),Pg={[re.NotificationPromotionImagePosition.UNSET]:ts,[re.NotificationPromotionImagePosition.FIT]:ts,[re.NotificationPromotionImagePosition.CENTERED]:ts,[re.NotificationPromotionImagePosition.SOLID]:ts,[re.NotificationPromotionImagePosition.BOTTOM]:ts,[re.NotificationPromotionImagePosition.MIDDLE]:xg},Dg=({src:s,imagePosition:e})=>{const t=Pg[e];return W.jsx(t,{children:W.jsx("img",{src:s,alt:""})})},Lg=Or.O(Ag),Og=Or.O(Nc),Rg=({notification:s,open:e,close:t,webos:i})=>{if(!s||!s.promotion||s.enabled!==re.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:n,body:r,image:a,promotion:l}=s,{sponsorLogo:h,sponsorLogoMode:f,imagePosition:m,ctaButton:T}=l;return W.jsxs(wg,{"data-webos":i,className:"SL_Lower_Third_Notification",onClick:i?void 0:e,children:[W.jsxs(yg,{children:[W.jsx(Dg,{src:a,imagePosition:m}),W.jsxs(_g,{children:[n&&W.jsx(Tg,{children:n}),r&&W.jsx(vg,{children:r})]})]}),W.jsxs(Eg,{children:[f!==re.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&W.jsxs(W.Fragment,{children:[W.jsx(Sg,{children:W.jsx("img",{src:h,alt:n})}),W.jsx(Cg,{})]}),i?W.jsxs(W.Fragment,{children:[W.jsx(Lg,{webos:!0,onClick:t,children:"Dismiss"}),W.jsxs(Og,{webos:!0,autoFocus:!0,style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},onClick:e,children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===re.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(su,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]})]}):W.jsxs(Nc,{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)===re.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(su,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]})]})]})},Mg=Q.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),Ng=Q.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),Ug=Q.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),Bg=Q.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),Fg=Q.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Rr=Q.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),$g=()=>Rr,nu=Q.styled_default($g())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),jg=()=>Rr,Uc=Q.styled_default(jg())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),Vg=()=>Uc,Hg=Q.styled_default(Vg())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),qg=()=>Rr,zg=Q.styled_default(qg())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),Wg=()=>Rr,Gg=Q.styled_default(Wg())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),Kg=Q.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),Xg=()=>eg.B1,Yg=Q.styled_default(Xg())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),Qg=Q.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),Bc=Q.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),Jg=()=>Bc,Zg=Q.styled_default(Jg())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),e0=()=>Bc,t0=Q.styled_default(e0())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),i0={[re.NotificationPromotionImagePosition.UNSET]:nu,[re.NotificationPromotionImagePosition.FIT]:nu,[re.NotificationPromotionImagePosition.CENTERED]:Uc,[re.NotificationPromotionImagePosition.BOTTOM]:Hg,[re.NotificationPromotionImagePosition.SOLID]:zg,[re.NotificationPromotionImagePosition.MIDDLE]:Gg},s0=({src:s,imagePosition:e})=>{const t=i0[e];return W.jsx(t,{children:W.jsx("img",{src:s,alt:""})})},n0=Or.O(Zg),r0=Or.O(t0),a0=({notification:s,open:e,promotionId:t,hiding:i,direction:n="left",close:r,webos:a})=>{if(!s||!s.promotion||s.enabled!==re.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(s.promotion.mode===re.NotificationPromotionMode.LOWER_THIRD)return W.jsx(Rg,{notification:s,open:e,close:r,webos:a});const{title:l,body:h,image:f,promotion:m}=s,{sponsorLogo:T,sponsorLogoMode:E,imagePosition:C,ctaButton:P}=m,v=R=>{R.stopPropagation(),r==null||r()};return W.jsx(xo,{className:"SL_Rich_Notification",direction:n,hiding:i,children:W.jsxs(Ng,{onClick:a?()=>{}:e,children:[E!==re.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&T&&W.jsx(Qg,{children:W.jsx("img",{src:T,alt:l})}),W.jsxs(Mg,{children:[W.jsx(s0,{src:f,imagePosition:C}),W.jsxs(Ug,{children:[l&&W.jsx(Bg,{children:l}),h&&W.jsx(Fg,{children:h})]}),a&&W.jsx(n0,{webos:!0,onClick:v,children:"Dismiss"}),W.jsxs(r0,{webos:a,autoFocus:a,onClick:a?e:()=>{},name:"promo-button",style:{color:P==null?void 0:P.textColor,backgroundColor:P==null?void 0:P.color},children:[(P==null?void 0:P.ctaIcon)&&(P==null?void 0:P.ctaIconMode)===re.CtaIconMode.CTA_ICON_TRANSPARENT&&W.jsx(Kg,{src:P==null?void 0:P.ctaIcon,alt:"cta-icon"}),(P==null?void 0:P.label)||"Open"]}),W.jsx(Yg,{name:"chevronRight"})]})]})})},o0=Q.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Fc=Q.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),$c=Q.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),jc=Q.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Vc="h10toh7",ru=Q.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),l0=Q.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),Hc=Q.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),u0=Q.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),c0="s1nmch9k",au=Q.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),d0=Q.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),h0=Q.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),f0=Q.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),qc=Q.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),p0=Q.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),zc=Q.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),Wc=Q.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),m0=Q.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),g0="h17rwbtk",y0=Q.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),ou=Q.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),_0=Q.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),T0=({time:s,adCount:e,adPosition:t})=>{const i=Math.floor(s/60),n=s-i*60;return i===0&&n===0&&e===t?null:W.jsxs(y0,{children:[e>1&&W.jsxs(W.Fragment,{children:[W.jsxs(ou,{children:[t," of ",e]}),W.jsx(_0,{})]}),W.jsxs(ou,{children:[i,":",n<10?`0${n}`:n]})]})},v0=Q.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),b0=({whyThisAd:s})=>{const[e,t]=Te.useState(!1);return!s.iconClickThroughURLTemplate||!s.staticResource?null:W.jsxs(v0,{style:{width:s.width,height:s.height,[s.xPosition]:3,[s.yPosition]:11},href:s.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&W.jsx("img",{alt:"ad choice",src:s.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&W.jsx("span",{children:"ad choice"})]})},x0=Q.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Gc=Q.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),S0=()=>Gc,E0=Q.styled_default(S0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),C0=()=>Gc,w0=Q.styled_default(C0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),I0=Q.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),A0=Q.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),lu="m12n261r",uu="m16vcml8",cu="m1078nk6";var nn;typeof window<"u"?nn=window:typeof Jt.commonjsGlobal<"u"?nn=Jt.commonjsGlobal:typeof self<"u"?nn=self:nn={};var Mr=nn;const k=Jt.getDefaultExportFromCjs(Mr),k0={},P0=Object.freeze(Object.defineProperty({__proto__:null,default:k0},Symbol.toStringTag,{value:"Module"})),D0=Jt.getAugmentedNamespace(P0);var du=typeof Jt.commonjsGlobal<"u"?Jt.commonjsGlobal:typeof window<"u"?window:{},L0=D0,rn;typeof document<"u"?rn=document:(rn=du["__GLOBAL_DOCUMENT_CACHE@4"],rn||(rn=du["__GLOBAL_DOCUMENT_CACHE@4"]=L0));var Kc=rn;const K=Jt.getDefaultExportFromCjs(Kc);var So={exports:{}},Xc={exports:{}};(function(s){function e(){return s.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var n=arguments[i];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}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})(Xc);var O0=Xc.exports,R0=N0,M0=Object.prototype.toString;function N0(s){if(!s)return!1;var e=M0.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 U0(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=B0(s))||e){t&&(s=t);var i=0;return function(){return i>=s.length?{done:!0}:{done:!1,value:s[i++]}}}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"),by=require("./index8.js"),J=require("./sl-types.js"),El=require("./analytics.js"),Se=require("react"),ei=require("./index3.js"),oe=require("./useStreamLayerApp2.js"),Aa=require("./index14.js"),xy=require("./index6.js"),Jn=require("./index13.js"),ci=require("./index15.js"),Cs=require("uuid"),Sy=require("./utils.js"),Jt=require("./hooks-WfHlJH12.js");function Ke(){return Ke=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ke.apply(null,arguments)}const Ey=J.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Cy="a1rlj479",Ay="s35f1di",wy="sj4471g",Dy="b12050d8",Iy="b1d5ybek",ky=i=>i==="left"||i==="right"?Ay:Dy,Py=i=>i==="left"||i==="right"?wy:Iy,Ly=i=>i==="left"?"avdxyl3":i==="right"?"a1bisd08":i==="top"?"a1u9y2aj":"a1qqaks",Cl=({children:i,style:e,className:t,enabled:r=!0,hiding:s,direction:n="left",onAnimationEnd:a})=>G.jsx(Ey,{style:e,className:J.cx_default(t,Cy,Ly(n),r&&!s&&ky(n),r&&s&&Py(n)),onAnimationEnd:a,children:i}),Ry=J.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),Oy=J.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Ny=()=>Ry,By=J.styled_default(Ny())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),_h=({promotion:i,promotionId:e,hiding:t,isEventFired:r,fireEvent:s,direction:n="bottom"})=>{const a=(i==null?void 0:i.adUnit)===oe.AdUnit.STANDART,l=a?i.banner:i.additionalBanner;if(Se.useEffect(()=>{l!=null&&l.imageUrl&&i.type&&e&&(r!=null&&r("banner-showed")||(ei.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:i.type}}),s==null||s("banner-showed")))},[l==null?void 0:l.imageUrl,s,r,i.type,e]),!(l!=null&&l.imageUrl))return null;let u=l==null?void 0:l.url;return u&&u.indexOf("http")!==0&&(u=`https://${u}`),G.jsx(Cl,{direction:n,hiding:t,children:G.jsx(Oy,{className:"BannerContainer","data-is-ad":a,children:G.jsx(By,{as:u?"a":"span",className:"BannerLink",href:u,style:{backgroundImage:`url(${l.imageUrl})`,cursor:u?"pointer":"default"},"data-promo-id":e,"data-promo-type":i.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},My=({cardId:i,promotion:e,direction:t="bottom"})=>G.jsx(_h,{promotion:e,promotionId:i,direction:t,hiding:!1}),Uy=J.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Fy=J.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),$y=J.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),jy=J.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),Cr=J.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),Vy=()=>Cr,qy=J.styled_default(Vy())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),yc=J.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),Hy=J.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),zy=J.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Wy=J.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),Gy=J.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Th=J.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Ky=()=>Th,Xy=J.styled_default(Ky())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),Yy=()=>Th,vh=J.styled_default(Yy())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),Qy={[oe.NotificationPromotionImagePosition.UNSET]:Cr,[oe.NotificationPromotionImagePosition.FIT]:Cr,[oe.NotificationPromotionImagePosition.CENTERED]:Cr,[oe.NotificationPromotionImagePosition.SOLID]:Cr,[oe.NotificationPromotionImagePosition.BOTTOM]:Cr,[oe.NotificationPromotionImagePosition.MIDDLE]:qy},Jy=({src:i,imagePosition:e})=>{const t=Qy[e];return G.jsx(t,{children:G.jsx("img",{src:i,alt:""})})},Zy=Aa.O(Xy),e_=Aa.O(vh),t_=({notification:i,open:e,close:t,webos:r})=>{if(!i||!i.promotion||i.enabled!==oe.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:s,body:n,image:a,promotion:l}=i,{sponsorLogo:u,sponsorLogoMode:f,imagePosition:p,ctaButton:T}=l;return G.jsxs(Gy,{"data-webos":r,className:"SL_Lower_Third_Notification",onClick:r?void 0:e,children:[G.jsxs(Uy,{children:[G.jsx(Jy,{src:a,imagePosition:p}),G.jsxs(Fy,{children:[s&&G.jsx($y,{children:s}),n&&G.jsx(jy,{children:n})]})]}),G.jsxs(zy,{children:[f!==oe.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&G.jsxs(G.Fragment,{children:[G.jsx(Hy,{children:G.jsx("img",{src:u,alt:s})}),G.jsx(Wy,{})]}),r?G.jsxs(G.Fragment,{children:[G.jsx(Zy,{webos:!0,onClick:t,children:"Dismiss"}),G.jsxs(e_,{webos:!0,autoFocus:!0,style:{color:T==null?void 0:T.textColor,backgroundColor:T==null?void 0:T.color},onClick:e,children:[(T==null?void 0:T.ctaIcon)&&(T==null?void 0:T.ctaIconMode)===oe.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(yc,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]})]}):G.jsxs(vh,{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)===oe.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(yc,{src:T==null?void 0:T.ctaIcon,alt:"cta-icon"}),(T==null?void 0:T.label)||"Open"]})]})]})},i_=J.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),r_=J.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),s_=J.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),n_=J.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),a_=J.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),wa=J.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),o_=()=>wa,_c=J.styled_default(o_())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),l_=()=>wa,bh=J.styled_default(l_())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),u_=()=>bh,c_=J.styled_default(u_())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),d_=()=>wa,h_=J.styled_default(d_())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),f_=()=>wa,p_=J.styled_default(f_())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),m_=J.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),g_=()=>xy.B1,y_=J.styled_default(g_())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),__=J.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),xh=J.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),T_=()=>xh,v_=J.styled_default(T_())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),b_=()=>xh,x_=J.styled_default(b_())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),S_={[oe.NotificationPromotionImagePosition.UNSET]:_c,[oe.NotificationPromotionImagePosition.FIT]:_c,[oe.NotificationPromotionImagePosition.CENTERED]:bh,[oe.NotificationPromotionImagePosition.BOTTOM]:c_,[oe.NotificationPromotionImagePosition.SOLID]:h_,[oe.NotificationPromotionImagePosition.MIDDLE]:p_},E_=({src:i,imagePosition:e})=>{const t=S_[e];return G.jsx(t,{children:G.jsx("img",{src:i,alt:""})})},C_=Aa.O(v_),A_=Aa.O(x_),w_=({notification:i,open:e,promotionId:t,hiding:r,direction:s="left",close:n,webos:a})=>{if(!i||!i.promotion||i.enabled!==oe.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(i.promotion.mode===oe.NotificationPromotionMode.LOWER_THIRD)return G.jsx(t_,{notification:i,open:e,close:n,webos:a});const{title:l,body:u,image:f,promotion:p}=i,{sponsorLogo:T,sponsorLogoMode:b,imagePosition:S,ctaButton:A}=p,v=L=>{L.stopPropagation(),n==null||n()};return G.jsx(Cl,{className:"SL_Rich_Notification",direction:s,hiding:r,children:G.jsxs(r_,{onClick:a?()=>{}:e,children:[b!==oe.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&T&&G.jsx(__,{children:G.jsx("img",{src:T,alt:l})}),G.jsxs(i_,{children:[G.jsx(E_,{src:f,imagePosition:S}),G.jsxs(s_,{children:[l&&G.jsx(n_,{children:l}),u&&G.jsx(a_,{children:u})]}),a&&G.jsx(C_,{webos:!0,onClick:v,children:"Dismiss"}),G.jsxs(A_,{webos:a,autoFocus:a,onClick:a?e:()=>{},name:"promo-button",style:{color:A==null?void 0:A.textColor,backgroundColor:A==null?void 0:A.color},children:[(A==null?void 0:A.ctaIcon)&&(A==null?void 0:A.ctaIconMode)===oe.CtaIconMode.CTA_ICON_TRANSPARENT&&G.jsx(m_,{src:A==null?void 0:A.ctaIcon,alt:"cta-icon"}),(A==null?void 0:A.label)||"Open"]}),G.jsx(y_,{name:"chevronRight"})]})]})})},D_=J.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Sh=J.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Eh=J.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Ch=J.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ah="h10toh7",Tc=J.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),I_=J.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),wh=J.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),k_=J.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),P_="s1nmch9k",vc=J.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),L_=J.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),R_=J.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),O_=J.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Dh=J.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),N_=J.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Ih=J.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),kh=J.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),B_=J.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),M_="h17rwbtk",U_=J.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),bc=J.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),F_=J.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),$_=({time:i,adCount:e,adPosition:t})=>{const r=Math.floor(i/60),s=i-r*60;return r===0&&s===0&&e===t?null:G.jsxs(U_,{children:[e>1&&G.jsxs(G.Fragment,{children:[G.jsxs(bc,{children:[t," of ",e]}),G.jsx(F_,{})]}),G.jsxs(bc,{children:[r,":",s<10?`0${s}`:s]})]})},j_=J.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),V_=({whyThisAd:i})=>{const[e,t]=Se.useState(!1);return!i.iconClickThroughURLTemplate||!i.staticResource?null:G.jsxs(j_,{style:{width:i.width,height:i.height,[i.xPosition]:3,[i.yPosition]:11},href:i.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&G.jsx("img",{alt:"ad choice",src:i.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&G.jsx("span",{children:"ad choice"})]})},q_=J.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Ph=J.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),H_=()=>Ph,z_=J.styled_default(H_())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),W_=()=>Ph,G_=J.styled_default(W_())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),K_=J.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),X_=J.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),xc="m12n261r",Sc="m16vcml8",Ec="m1078nk6";function Al(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:i.id||null,adId:i.adId||null,sequence:i.sequence||null,apiFramework:i.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const Y_=["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 Cc(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const r=[],s=Rh(i);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Bh(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const n in e)e[n]=Nh(e[n]);for(const n in s){const a=s[n];typeof a=="string"&&r.push(Lh(a,e))}return r}function Lh(i,e){const t=(i=Ac(i,e)).match(/[^[\]]+(?=])/g);if(!t)return i;let r=t.filter(s=>Y_.indexOf(s)>-1);return r.length===0?i:(r=r.reduce((s,n)=>(s[n]=-1,s),{}),Ac(i,r))}function Ac(i,e){let t=i;for(const r in e){const s=e[r];t=t.replace(new RegExp("(?:\\[|%%)(".concat(r,")(?:\\]|%%)"),"g"),s)}return t}function Rh(i){return Array.isArray(i)?i.map(e=>e&&e.hasOwnProperty("url")?e.url:e):i}function wc(i){return/^(https?:\/\/|\/\/)/.test(i)}function Dc(i,e){for(let t=0;t<e.length;t++)if(Oh(e[t],i))return!0;return!1}function Oh(i,e){if(i&&e){const t=Object.getOwnPropertyNames(i),r=Object.getOwnPropertyNames(e);return t.length===r.length&&i.id===e.id&&i.url===e.url}return!1}function Nh(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>"%".concat(e.charCodeAt(0).toString(16)))}function Bh(i){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return i.toString().padStart(e,"0")}const De={track:function(i,e,t){Cc(i,e,t).forEach(r=>{typeof window<"u"&&window!==null&&(new Image().src=r)})},resolveURLTemplates:Cc,extractURLsFromTemplates:Rh,filterUrlTemplates:function(i){return i.reduce((e,t)=>{const r=t.url||t;return wc(r)?e.validUrls.push(r):e.invalidUrls.push(r),e},{validUrls:[],invalidUrls:[]})},containsTemplateObject:Dc,isTemplateObjectEqual:Oh,encodeURIComponentRFC3986:Nh,replaceUrlMacros:Lh,isNumeric:function(i){return!isNaN(parseFloat(i))&&isFinite(i)},flatten:function i(e){return e.reduce((t,r)=>t.concat(Array.isArray(r)?i(r):r),[])},joinArrayOfUniqueTemplateObjs:function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(i)?i:[],r=Array.isArray(e)?e:[];return t.concat(r).reduce((s,n)=>(Dc(n,s)||s.push(n),s),[])},isValidTimeValue:function(i){return Number.isFinite(i)&&i>=-2},addLeadingZeros:Bh,isValidUrl:wc,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(i){return typeof i!="object"?i:JSON.stringify(i)}};function Ic(i){return["true","TRUE","True","1"].includes(i)}function Q_(i){if(i==null)return-1;if(De.isNumeric(i))return parseInt(i);const e=i.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let r=parseInt(t[0]);t.length===2&&(r+=parseFloat("0.".concat(t[1])));const s=parseInt(60*e[1]),n=parseInt(60*e[0]*60);return isNaN(n)||isNaN(s)||isNaN(r)||s>3600||r>60?-1:n+s+r}const j={childByName:function(i,e){return Array.from(i.childNodes).find(t=>t.nodeName===e)},childrenByName:function(i,e){return Array.from(i.childNodes).filter(t=>t.nodeName===e)},resolveVastAdTagURI:function(i,e){if(!e)return i;if(i.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(i)}if(!i.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(i)}return i},parseBoolean:Ic,parseNodeText:function(i){return i&&(i.textContent||i.text||"").trim()},copyNodeAttribute:function(i,e,t){const r=e.getAttribute(i);r&&t.setAttribute(i,r)},parseAttributes:function(i){return Array.from(i.attributes).reduce((e,t)=>(e[t.nodeName]=t.nodeValue,e),{})},parseDuration:Q_,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>!parseInt(i.sequence,10))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter(i=>parseInt(i.sequence,10)).sort((i,e)=>i.sequence-e.sequence)},assignAttributes:function(i,e){i&&Array.from(i).forEach(t=>{let{nodeName:r,nodeValue:s}=t;if(r&&s&&e.hasOwnProperty(r)){let n=s;typeof e[r]=="boolean"&&(n=Ic(n)),e[r]=n}})},mergeWrapperAdData:function(i,e){var t;i.errorURLTemplates=e.errorURLTemplates.concat(i.errorURLTemplates),i.impressionURLTemplates=e.impressionURLTemplates.concat(i.impressionURLTemplates),i.extensions=e.extensions.concat(i.extensions),e.viewableImpression.length>0&&(i.viewableImpression=[...i.viewableImpression,...e.viewableImpression]),i.followAdditionalWrappers=e.followAdditionalWrappers,i.allowMultipleAds=e.allowMultipleAds,i.fallbackOnNoAd=e.fallbackOnNoAd;const r=(e.creatives||[]).filter(l=>l&&l.type==="companion"),s=r.reduce((l,u)=>((u.variations||[]).forEach(f=>{(f.companionClickTrackingURLTemplates||[]).forEach(p=>{De.containsTemplateObject(p,l)||l.push(p)})}),l),[]);i.creatives=r.concat(i.creatives);const n=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(i.creatives.forEach(l=>{if(e.trackingEvents&&e.trackingEvents[l.type])for(const u in e.trackingEvents[l.type]){const f=e.trackingEvents[l.type][u];Array.isArray(l.trackingEvents[u])||(l.trackingEvents[u]=[]),l.trackingEvents[u]=l.trackingEvents[u].concat(f)}l.type==="linear"&&(n&&(l.videoClickTrackingURLTemplates=l.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(l.videoCustomClickURLTemplates=l.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||l.videoClickThroughURLTemplate!==null&&l.videoClickThroughURLTemplate!==void 0||(l.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),l.type==="companion"&&s.length&&(l.variations||[]).forEach(u=>{u.companionClickTrackingURLTemplates=De.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,s)})}),e.adVerifications&&(i.adVerifications=i.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(i.blockedAdCategories=i.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const l=e.creatives.filter(u=>{var f;return((f=u.icons)===null||f===void 0?void 0:f.length)&&!u.mediaFiles.length});l.length&&(i.creatives=i.creatives.concat(l))}}};function J_(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:l}=Al(r);return{id:s,adId:n,sequence:a,apiFramework:l,type:"companion",required:null,variations:[]}}(e);return t.required=i.getAttribute("required")||null,t.variations=j.childrenByName(i,"Companion").map(r=>{const s=function(){let l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:l.id||null,adType:"companionAd",width:l.width||0,height:l.height||0,assetWidth:l.assetWidth||null,assetHeight:l.assetHeight||null,expandedWidth:l.expandedWidth||null,expandedHeight:l.expandedHeight||null,apiFramework:l.apiFramework||null,adSlotId:l.adSlotId||null,pxratio:l.pxratio||"1",renderingMode:l.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}}(j.parseAttributes(r));s.htmlResources=j.childrenByName(r,"HTMLResource").reduce((l,u)=>{const f=j.parseNodeText(u);return f?l.concat(f):l},[]),s.iframeResources=j.childrenByName(r,"IFrameResource").reduce((l,u)=>{const f=j.parseNodeText(u);return f?l.concat(f):l},[]),s.staticResources=j.childrenByName(r,"StaticResource").reduce((l,u)=>{const f=j.parseNodeText(u);return f?l.concat({url:f,creativeType:u.getAttribute("creativeType")||null}):l},[]),s.altText=j.parseNodeText(j.childByName(r,"AltText"))||null;const n=j.childByName(r,"TrackingEvents");n&&j.childrenByName(n,"Tracking").forEach(l=>{const u=l.getAttribute("event"),f=j.parseNodeText(l);u&&f&&(Array.isArray(s.trackingEvents[u])||(s.trackingEvents[u]=[]),s.trackingEvents[u].push(f))}),s.companionClickTrackingURLTemplates=j.childrenByName(r,"CompanionClickTracking").map(l=>({id:l.getAttribute("id")||null,url:j.parseNodeText(l)})),s.companionClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"CompanionClickThrough"))||null;const a=j.childByName(r,"AdParameters");return a&&(s.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),s}),t}function Z_(i,e){let t;const r=function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:f,adId:p,sequence:T,apiFramework:b}=Al(u);return{id:f,adId:p,sequence:T,apiFramework:b,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}}(e);r.duration=j.parseDuration(j.parseNodeText(j.childByName(i,"Duration")));const s=i.getAttribute("skipoffset");if(s==null)r.skipDelay=null;else if(s.charAt(s.length-1)==="%"&&r.duration!==-1){const u=parseInt(s,10);r.skipDelay=r.duration*(u/100)}else r.skipDelay=j.parseDuration(s);const n=j.childByName(i,"VideoClicks");if(n){const u=j.childByName(n,"ClickThrough");r.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:j.parseNodeText(u)}:null,j.childrenByName(n,"ClickTracking").forEach(f=>{r.videoClickTrackingURLTemplates.push({id:f.getAttribute("id")||null,url:j.parseNodeText(f)})}),j.childrenByName(n,"CustomClick").forEach(f=>{r.videoCustomClickURLTemplates.push({id:f.getAttribute("id")||null,url:j.parseNodeText(f)})})}const a=j.childByName(i,"AdParameters");a&&(r.adParameters={value:j.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),j.childrenByName(i,"TrackingEvents").forEach(u=>{j.childrenByName(u,"Tracking").forEach(f=>{let p=f.getAttribute("event");const T=j.parseNodeText(f);if(p&&T){if(p==="progress"){if(t=f.getAttribute("offset"),!t)return;p=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(j.parseDuration(t))}Array.isArray(r.trackingEvents[p])||(r.trackingEvents[p]=[]),r.trackingEvents[p].push(T)}})}),j.childrenByName(i,"MediaFiles").forEach(u=>{j.childrenByName(u,"MediaFile").forEach(S=>{r.mediaFiles.push(function(A){const v={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};v.id=A.getAttribute("id"),v.fileURL=j.parseNodeText(A),v.deliveryType=A.getAttribute("delivery"),v.codec=A.getAttribute("codec"),v.mimeType=A.getAttribute("type"),v.mediaType=A.getAttribute("mediaType")||"2D",v.apiFramework=A.getAttribute("apiFramework"),v.fileSize=parseInt(A.getAttribute("fileSize")||0),v.bitrate=parseInt(A.getAttribute("bitrate")||0),v.minBitrate=parseInt(A.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(A.getAttribute("maxBitrate")||0),v.width=parseInt(A.getAttribute("width")||0),v.height=parseInt(A.getAttribute("height")||0);const L=A.getAttribute("scalable");L&&typeof L=="string"&&(v.scalable=j.parseBoolean(L));const P=A.getAttribute("maintainAspectRatio");return P&&typeof P=="string"&&(v.maintainAspectRatio=j.parseBoolean(P)),v}(S))});const f=j.childByName(u,"InteractiveCreativeFile");f&&(r.interactiveCreativeFile=function(S){const A=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,apiFramework:v.apiFramework||null,variableDuration:j.parseBoolean(v.variableDuration),fileURL:null}}(j.parseAttributes(S));return A.fileURL=j.parseNodeText(S),A}(f));const p=j.childByName(u,"ClosedCaptionFiles");p&&j.childrenByName(p,"ClosedCaptionFile").forEach(S=>{const A=function(){let v=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{type:v.type||null,language:v.language||null,fileURL:null}}(j.parseAttributes(S));A.fileURL=j.parseNodeText(S),r.closedCaptionFiles.push(A)});const T=j.childByName(u,"Mezzanine"),b=function(S,A){const v={};let L=!1;return A.forEach(P=>{S&&S.getAttribute(P)?v[P]=S.getAttribute(P):L=!0}),L?null:v}(T,["delivery","type","width","height"]);if(b){const S={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};S.id=T.getAttribute("id"),S.fileURL=j.parseNodeText(T),S.delivery=b.delivery,S.codec=T.getAttribute("codec"),S.type=b.type,S.width=parseInt(b.width,10),S.height=parseInt(b.height,10),S.fileSize=parseInt(T.getAttribute("fileSize"),10),S.mediaType=T.getAttribute("mediaType")||"2D",r.mezzanine=S}});const l=j.childByName(i,"Icons");return l&&j.childrenByName(l,"Icon").forEach(u=>{r.icons.push(function(f){const p={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:[],altText:null,hoverText:null};p.program=f.getAttribute("program"),p.height=parseInt(f.getAttribute("height")||0),p.width=parseInt(f.getAttribute("width")||0),p.xPosition=function(b){return["left","right"].indexOf(b)!==-1?b:parseInt(b||0)}(f.getAttribute("xPosition")),p.yPosition=function(b){return["top","bottom"].indexOf(b)!==-1?b:parseInt(b||0)}(f.getAttribute("yPosition")),p.apiFramework=f.getAttribute("apiFramework"),p.pxratio=f.getAttribute("pxratio")||"1",p.offset=j.parseDuration(f.getAttribute("offset")),p.duration=j.parseDuration(f.getAttribute("duration")),p.altText=f.getAttribute("altText"),p.hoverText=f.getAttribute("hoverText"),j.childrenByName(f,"HTMLResource").forEach(b=>{p.type=b.getAttribute("creativeType")||"text/html",p.htmlResource=j.parseNodeText(b)}),j.childrenByName(f,"IFrameResource").forEach(b=>{p.type=b.getAttribute("creativeType")||0,p.iframeResource=j.parseNodeText(b)}),j.childrenByName(f,"StaticResource").forEach(b=>{p.type=b.getAttribute("creativeType")||0,p.staticResource=j.parseNodeText(b)});const T=j.childByName(f,"IconClicks");if(T){p.iconClickThroughURLTemplate=j.parseNodeText(j.childByName(T,"IconClickThrough")),j.childrenByName(T,"IconClickTracking").forEach(S=>{p.iconClickTrackingURLTemplates.push({id:S.getAttribute("id")||null,url:j.parseNodeText(S)})});const b=j.childByName(T,"IconClickFallbackImages");b&&j.childrenByName(b,"IconClickFallbackImage").forEach(S=>{p.iconClickFallbackImages.push({url:j.parseNodeText(S)||null,width:S.getAttribute("width")||null,height:S.getAttribute("height")||null})})}return p.iconViewTrackingURLTemplate=j.parseNodeText(j.childByName(f,"IconViewTracking")),p}(u))}),r}function eT(i,e){const t=function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:l}=Al(r);return{id:s,adId:n,sequence:a,apiFramework:l,type:"nonlinear",variations:[],trackingEvents:{}}}(e);return j.childrenByName(i,"TrackingEvents").forEach(r=>{let s,n;j.childrenByName(r,"Tracking").forEach(a=>{s=a.getAttribute("event"),n=j.parseNodeText(a),s&&n&&(Array.isArray(t.trackingEvents[s])||(t.trackingEvents[s]=[]),t.trackingEvents[s].push(n))})}),j.childrenByName(i,"NonLinear").forEach(r=>{const s={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};s.id=r.getAttribute("id")||null,s.width=r.getAttribute("width"),s.height=r.getAttribute("height"),s.expandedWidth=r.getAttribute("expandedWidth"),s.expandedHeight=r.getAttribute("expandedHeight"),s.scalable=j.parseBoolean(r.getAttribute("scalable")),s.maintainAspectRatio=j.parseBoolean(r.getAttribute("maintainAspectRatio")),s.minSuggestedDuration=j.parseDuration(r.getAttribute("minSuggestedDuration")),s.apiFramework=r.getAttribute("apiFramework"),j.childrenByName(r,"HTMLResource").forEach(a=>{s.type=a.getAttribute("creativeType")||"text/html",s.htmlResource=j.parseNodeText(a)}),j.childrenByName(r,"IFrameResource").forEach(a=>{s.type=a.getAttribute("creativeType")||0,s.iframeResource=j.parseNodeText(a)}),j.childrenByName(r,"StaticResource").forEach(a=>{s.type=a.getAttribute("creativeType")||0,s.staticResource=j.parseNodeText(a)});const n=j.childByName(r,"AdParameters");n&&(s.adParameters={value:j.parseNodeText(n),xmlEncoded:n.getAttribute("xmlEncoded")||null}),s.nonlinearClickThroughURLTemplate=j.parseNodeText(j.childByName(r,"NonLinearClickThrough")),j.childrenByName(r,"NonLinearClickTracking").forEach(a=>{s.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:j.parseNodeText(a)})}),t.variations.push(s)}),t}function kc(i){const e=[];return i.forEach(t=>{const r=Mh(t);r&&e.push(r)}),e}function Mh(i){if(i.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=i.attributes,r=i.childNodes;if(e.name=i.nodeName,i.attributes){for(const n in t)if(t.hasOwnProperty(n)){const a=t[n];a.nodeName&&a.nodeValue&&(e.attributes[a.nodeName]=a.nodeValue)}}for(const n in r)if(r.hasOwnProperty(n)){const a=Mh(r[n]);a&&e.children.push(a)}if(e.children.length===0||e.children.length===1&&["#cdata-section","#text"].indexOf(e.children[0].name)>=0){const n=j.parseNodeText(i);n!==""&&(e.value=n),e.children=[]}return(s=e).value===null&&Object.keys(s.attributes).length===0&&s.children.length===0?null:e;var s}function tT(i){return i.getAttribute("AdID")||i.getAttribute("adID")||i.getAttribute("adId")||null}const Kn={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 Pc(i,e){if(!Kn[i.nodeName]||!Kn[i.nodeName].attributes)return;const t=Kn[i.nodeName].attributes.filter(r=>!i.getAttribute(r));t.length>0&&Gs({name:i.nodeName,parentName:i.parentNode.nodeName,attributes:t},e)}function Lc(i,e,t){const r=Kn[i.nodeName],s=!t&&i.nodeName!=="Wrapper";if(!(!r||s)){if(r.subElements){const n=r.subElements.filter(a=>!j.childByName(i,a));n.length>0&&Gs({name:i.nodeName,parentName:i.parentNode.nodeName,subElements:n},e)}!t||!r.oneOfinLineResources||r.oneOfinLineResources.some(n=>j.childByName(i,n))||Gs({name:i.nodeName,parentName:i.parentNode.nodeName,oneOfResources:r.oneOfinLineResources},e)}}function Rc(i){return i.children&&i.children.length!==0}function Gs(i,e){let{name:t,parentName:r,attributes:s,subElements:n,oneOfResources:a}=i,l="Element '".concat(t,"'");l+=s?" missing required attribute(s) '".concat(s.join(", "),"' "):n?" missing required sub element(s) '".concat(n.join(", "),"' "):a?" must provide one of the following '".concat(a.join(", "),"' "):" is empty",e("VAST-warning",{message:l,parentElement:r,specVersion:4.1})}const iT={verifyRequiredValues:function i(e,t,r){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(r=!0),Pc(e,t),Rc(e)){Lc(e,t,r);for(let s=0;s<e.children.length;s++)i(e.children[s],t,r)}else j.parseNodeText(e).length===0&&Gs({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Rc,emitMissingValueWarning:Gs,verifyRequiredAttributes:Pc,verifyRequiredSubElements:Lc};function rT(i,e){let{allowMultipleAds:t,followAdditionalWrappers:r}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=Array.from(i.childNodes).filter(n=>{const a=n.nodeName.toLowerCase();return a==="inline"||r!==!1&&a==="wrapper"});for(const n of s){if(j.copyNodeAttribute("id",i,n),j.copyNodeAttribute("sequence",i,n),j.copyNodeAttribute("adType",i,n),n.nodeName==="Wrapper")return{ad:nT(n,e),type:"WRAPPER"};if(n.nodeName==="InLine")return{ad:sT(n,e,{allowMultipleAds:t}),type:"INLINE"};const a=n.nodeName.toLowerCase();e("VAST-warning",{message:"<".concat(n.nodeName,a==="inline"?"> must be written <InLine>":"> must be written <Wrapper>"),wrongNode:n})}}function sT(i,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&i.getAttribute("sequence")?null:Uh(i,e)}function Uh(i,e){let t=[];e&&iT.verifyRequiredValues(i,e);const r=Array.from(i.childNodes),s=function(){let n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:n.id||null,sequence:n.sequence||null,adType:n.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}}(j.parseAttributes(i));return r.forEach(n=>{switch(n.nodeName){case"Error":s.errorURLTemplates.push(j.parseNodeText(n));break;case"Impression":s.impressionURLTemplates.push({id:n.getAttribute("id")||null,url:j.parseNodeText(n)});break;case"Creatives":s.creatives=function(a){const l=[];return a.forEach(u=>{const f={id:u.getAttribute("id")||null,adId:tT(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},p=[];let T;j.childrenByName(u,"UniversalAdId").forEach(S=>{const A={idRegistry:S.getAttribute("idRegistry")||"unknown",value:j.parseNodeText(S)};p.push(A)});const b=j.childByName(u,"CreativeExtensions");b&&(T=kc(j.childrenByName(b,"CreativeExtension")));for(const S in u.childNodes){const A=u.childNodes[S];let v;switch(A.nodeName){case"Linear":v=Z_(A,f);break;case"NonLinearAds":v=eT(A,f);break;case"CompanionAds":v=J_(A,f)}v&&(p&&(v.universalAdIds=p),T&&(v.creativeExtensions=T),l.push(v))}}),l}(j.childrenByName(n,"Creative"));break;case"Extensions":{const a=j.childrenByName(n,"Extension");s.extensions=kc(a),s.adVerifications.length||(t=function(l){let u=null,f=[];return l.some(p=>u=j.childByName(p,"AdVerifications")),u&&(f=Oc(j.childrenByName(u,"Verification"))),f}(a));break}case"AdVerifications":s.adVerifications=Oc(j.childrenByName(n,"Verification"));break;case"AdSystem":s.system={value:j.parseNodeText(n),version:n.getAttribute("version")||null};break;case"AdTitle":s.title=j.parseNodeText(n);break;case"AdServingId":s.adServingId=j.parseNodeText(n);break;case"Category":s.categories.push({authority:n.getAttribute("authority")||null,value:j.parseNodeText(n)});break;case"Expires":s.expires=parseInt(j.parseNodeText(n),10);break;case"ViewableImpression":s.viewableImpression.push(function(a){const l=(u,f)=>{const p=j.parseNodeText(f);return p&&u.push(p),u};return{id:a.getAttribute("id")||null,viewable:j.childrenByName(a,"Viewable").reduce(l,[]),notViewable:j.childrenByName(a,"NotViewable").reduce(l,[]),viewUndetermined:j.childrenByName(a,"ViewUndetermined").reduce(l,[])}}(n));break;case"Description":s.description=j.parseNodeText(n);break;case"Advertiser":s.advertiser={id:n.getAttribute("id")||null,value:j.parseNodeText(n)};break;case"Pricing":s.pricing={value:j.parseNodeText(n),model:n.getAttribute("model")||null,currency:n.getAttribute("currency")||null};break;case"Survey":s.survey={value:j.parseNodeText(n),type:n.getAttribute("type")||null};break;case"BlockedAdCategories":s.blockedAdCategories.push({authority:n.getAttribute("authority")||null,value:j.parseNodeText(n)})}}),t.length&&(s.adVerifications=s.adVerifications.concat(t)),s}function nT(i,e){const t=Uh(i,e),r=i.getAttribute("followAdditionalWrappers"),s=i.getAttribute("allowMultipleAds"),n=i.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!r||j.parseBoolean(r),t.allowMultipleAds=!!s&&j.parseBoolean(s),t.fallbackOnNoAd=n?j.parseBoolean(n):null;let a=j.childByName(i,"VASTAdTagURI");if(a?t.nextWrapperURL=j.parseNodeText(a):(a=j.childByName(i,"VASTAdTagURL"),a&&(t.nextWrapperURL=j.parseNodeText(j.childByName(a,"URL")))),t.creatives.forEach(l=>{if(["linear","nonlinear"].includes(l.type)){if(l.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[l.type]||(t.trackingEvents[l.type]={});for(const u in l.trackingEvents){const f=l.trackingEvents[u];Array.isArray(t.trackingEvents[l.type][u])||(t.trackingEvents[l.type][u]=[]),f.forEach(p=>{t.trackingEvents[l.type][u].push(p)})}}l.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),l.videoClickTrackingURLTemplates.forEach(u=>{t.videoClickTrackingURLTemplates.push(u)})),l.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=l.videoClickThroughURLTemplate),l.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),l.videoCustomClickURLTemplates.forEach(u=>{t.videoCustomClickURLTemplates.push(u)}))}}),t.nextWrapperURL)return t}function Oc(i){const e=[];return i.forEach(t=>{const r={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},s=Array.from(t.childNodes);j.assignAttributes(t.attributes,r),s.forEach(a=>{let{nodeName:l,textContent:u,attributes:f}=a;switch(l){case"JavaScriptResource":case"ExecutableResource":r.resource=u.trim(),j.assignAttributes(f,r);break;case"VerificationParameters":r.parameters=u.trim()}});const n=j.childByName(t,"TrackingEvents");n&&j.childrenByName(n,"Tracking").forEach(a=>{const l=a.getAttribute("event"),u=j.parseNodeText(a);l&&u&&(Array.isArray(r.trackingEvents[l])||(r.trackingEvents[l]=[]),r.trackingEvents[l].push(u))}),e.push(r)}),e}class Fh{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(r,s,n){const a={fired:!1,wrapFn:void 0};function l(){a.fired||(r.off(s,a.wrapFn),a.fired=!0,n.bind(r)(...arguments))}return a.wrapFn=l,l}(this,e,t))}off(e,t){return this._handlers=this._handlers.filter(r=>r.event!==e||r.handler!==t),this}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];let n=!1;return this._handlers.forEach(a=>{a.event==="*"&&(n=!0,a.handler(e,...r)),a.event===e&&(n=!0,a.handler(...r))}),n}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,r)=>(r.event===e&&t.push(r.handler),t),[])}eventNames(){return this._handlers.map(e=>e.event)}}let Nc=0,Go=0;const $h=(i,e)=>{!i||!e||i<=0||e<=0||(Go=(Go*Nc+8*i/e)/++Nc)},aT={ERRORCODE:900,extensions:[]},Bc="VAST response version not supported";class oT extends Fh{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,this.keepFailedAdPod=!1}trackVastError(e,t){for(var r=arguments.length,s=new Array(r>2?r-2:0),n=2;n<r;n++)s[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},aT,t,...s)),De.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return Go}initParsingStatus(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.maxWrapperDepth=e.wrapperLimit||10,this.parsingOptions={allowMultipleAds:e.allowMultipleAds},this.keepFailedAdPod=e.keepFailedAdPod||!1,this.rootURL="",this.resetParsingStatus(),$h(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(r=>this.buildVASTResponse(r))}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(r=>this.buildVASTResponse(r))}buildVASTResponse(e){const t=function(r){let{ads:s,errorURLTemplates:n,version:a}=r;return{ads:s||[],errorURLTemplates:n||[],version:a||null}}({ads:e,errorURLTemplates:this.getErrorURLTemplates(),version:this.vastVersion});return this.completeWrapperResolving(t),t}parseVastXml(e,t){let{isRootVAST:r=!1,url:s=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:l}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:s,wrapperDepth:n});const b=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(b?Bc:"Invalid VAST XMLDocument")}const f=[],p=e.documentElement.childNodes,T=e.documentElement.getAttribute("version");r&&T&&(this.vastVersion=T);for(const b in p){const S=p[b];if(S.nodeName==="Error"){const A=j.parseNodeText(S);r?this.rootErrorURLTemplates.push(A):this.errorURLTemplates.push(A)}else if(S.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&f.length>1)break;const A=rT(S,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:l});A.ad?(f.push(A.ad),this.emit("VAST-ad-parsed",{type:A.type,url:s,wrapperDepth:n,adIndex:f.length-1,vastVersion:T})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return f}parse(e){let{url:t=null,resolveAll:r=!0,wrapperSequence:s=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:l=!1,followAdditionalWrappers:u,allowMultipleAds:f}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&l&&(f=!0);try{p=this.parseVastXml(e,{isRootVAST:l,url:t,wrapperDepth:a,allowMultipleAds:f,followAdditionalWrappers:u})}catch(T){return Promise.reject(T)}if(p.length===1&&s!=null&&(p[0].sequence=s),r===!1){const T=j.getSortedAdPods(p),b=j.getStandAloneAds(p);T.length?p=T:b.length&&(p=[b.shift()]),this.remainingAds=b}return this.resolveAds(p,{wrapperDepth:a,previousUrl:n,url:t})}resolveAds(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],{wrapperDepth:t,previousUrl:r,url:s}=arguments.length>1?arguments[1]:void 0;const n=[];return r=s,e.forEach(a=>{const l=this.resolveWrappers(a,t,r);n.push(l)}),Promise.all(n).then(a=>De.flatten(a))}resolveWrappers(e,t,r){const s={...e};return new Promise(n=>{var a;if(t++,!s.nextWrapperURL)return delete s.nextWrapperURL,n(s);if(!this.fetcher)return s.VASTAdTagURI=s.nextWrapperURL,delete s.nextWrapperURL,n(s);if(t>=this.maxWrapperDepth)return s.errorCode=302,delete s.nextWrapperURL,n(s);s.nextWrapperURL=j.resolveVastAdTagURI(s.nextWrapperURL,r);const l=(a=this.parsingOptions.allowMultipleAds)!==null&&a!==void 0?a:s.allowMultipleAds,u=s.sequence;this.fetcher.fetchVAST({url:s.nextWrapperURL,emitter:this.emit.bind(this),maxWrapperDepth:this.maxWrapperDepth}).then(f=>this.parse(f,{url:s.nextWrapperURL,previousUrl:r,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:s.followAdditionalWrappers,allowMultipleAds:l}).then(p=>{if(delete s.nextWrapperURL,p.length===0)return s.creatives=[],n(s);p.forEach(T=>{T&&j.mergeWrapperAdData(T,s)}),n(p)})).catch(f=>{s.errorCode=f.message===Bc?102:301,s.errorMessage=f.message,n(s)})})}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 r=e.ads[t],s=!r.creatives.some(n=>{var a,l;return((a=n.mediaFiles)===null||a===void 0?void 0:a.length)>0||((l=n.variations)===null||l===void 0?void 0:l.length)>0});!r.errorCode&&!s||r.VASTAdTagURI||(this.trackVastError(r.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:r.errorCode||303},{ERRORMESSAGE:r.errorMessage||""},{extensions:r.extensions},{system:r.system}),this.keepFailedAdPod&&r.sequence?r.hasFailed=!0:e.ads.splice(t,1))}}}let gi=null;const lT={data:{},length:0,getItem(i){return this.data[i]},setItem(i,e){this.data[i]=e,this.length=Object.keys(this.data).length},removeItem(i){delete this.data[i],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class uT{constructor(){this.storage=this.initStorage()}initStorage(){if(gi)return gi;try{gi=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{gi=null}return gi&&!this.isStorageDisabled(gi)||(gi=lT,gi.clear()),gi}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 Ko=12e4,cT={get:async function(i,e){try{const t=new AbortController,r=setTimeout(()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||Ko," ms (408)"))},e.timeout||Ko),s=await fetch(i,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally(()=>{clearTimeout(r)}),n=function(a){return De.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,")")}(s);return n?{error:new Error(n),statusCode:s.status}:async function(a){const l=await a.text();let u;return u=De.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>mb)).DOMParser,{xml:u.parseFromString(l,"text/xml"),details:{byteLength:l.length,statusCode:a.status,rawXml:l}}}(s)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let dT=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||cT,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||Ko,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:r,maxWrapperDepth:s,emitter:n,wrapperDepth:a=0,previousUrl:l=null,wrapperAd:u=null}=e;const f=Date.now();this.URLTemplateFilters.forEach(b=>{r=b(r)}),n("VAST-resolving",{url:r,previousUrl:l,wrapperDepth:a,maxWrapperDepth:s,timeout:this.fetchingOptions.timeout,wrapperAd:u});const p=await this.urlHandler.get(r,this.fetchingOptions),T=Math.round(Date.now()-f);if(n("VAST-resolved",{url:r,previousUrl:l,wrapperDepth:a,error:(p==null?void 0:p.error)||null,duration:T,statusCode:(p==null?void 0:p.statusCode)||null,...p==null?void 0:p.details}),$h(p==null||(t=p.details)===null||t===void 0?void 0:t.byteLength,T),p.error)throw new Error(p.error);return p.xml}},hT=class{constructor(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new uT;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new dT,this.vastParser=new oT({fetcher:this.fetcher}),this.storage=r,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 r=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<r?(this.totalCalls=1,this.totalCallsTimeout=r+36e5):this.totalCalls++,new Promise((s,n)=>{if(this.cappingFreeLunch>=this.totalCalls)return n(new Error("VAST call canceled – FreeLunch capping not reached yet ".concat(this.totalCalls,"/").concat(this.cappingFreeLunch)));const a=r-this.lastSuccessfulAd;if(a<0)this.lastSuccessfulAd=0;else if(a<this.cappingMinimumTimeInterval)return n(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(l=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(l,t).then(u=>{const f=this.vastParser.buildVASTResponse(u);s(f)}))).catch(l=>n(l))})}};class fT extends Fh{constructor(e,t,r){var s;let n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:null,a=arguments.length>4&&arguments[4]!==void 0&&arguments[4];super(),this.ad=t,this.creative=r,this.variation=n,this.muted=a,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 l in this.creative.trackingEvents){const u=this.creative.trackingEvents[l];this.trackingEvents[l]=u.slice(0)}this.viewableImpressionTrackers=((s=this.ad.viewableImpression)===null||s===void 0?void 0:s.reduce((l,u)=>(l.notViewable.push(...u.notViewable),l.viewUndetermined.push(...u.viewUndetermined),l.viewable.push(...u.viewable),l),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach(l=>{let[u,f]=l;f.length&&(this.trackingEvents[u]=f)}),function(l){return l.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){De.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]:{},r=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!De.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(De.formatMacrosValues(t))});const s=this.skipDelay||-1;if(s===-1||this.skippable||(s>e?this.emit("skip-countdown",s-e):(this.skippable=!0,this.emit("skip-countdown",0))),this.assetDuration>0){const n=Math.round(e/this.assetDuration*100),a=[];if(e>0){a.push("start");for(let l=this.lastPercentage;l<n;l++)a.push("progress-".concat(l+1,"%"));a.push("progress-".concat(e));for(const l in this.quartiles)this.isQuartileReached(l,this.quartiles[l],e)&&(a.push(l),this._alreadyTriggeredQuartiles[l]=!0);this.lastPercentage=n}a.forEach(l=>{this.track(l,{macros:t,once:r})}),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,r){let s=!1;return t<=r&&!this._alreadyTriggeredQuartiles[e]&&(s=!0),s}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(De.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(De.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(De.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(De.formatMacrosValues(t))})}setSkipDelay(e){De.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]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("viewable",{macros:e,once:t}):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]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("notViewable",{macros:e,once:t}):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]:{},t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];typeof e=="object"?this.track("viewUndetermined",{macros:e,once:t}):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(De.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(De.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 r=this.ad.adVerifications.find(n=>n.vendor===e);if(!r)throw new Error("No associated verification element found for vendor: ".concat(e));const s=r.trackingEvents;if(s&&s.verificationNotExecuted){const n=s.verificationNotExecuted;this.trackURLs(n,t),this.emit("verificationNotExecuted",{trackingURLTemplates:n})}}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(De.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(De.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const r=this.clickThroughURLTemplate||e,s={...t};if(r){this.progress&&(s.ADPLAYHEAD=this.progressFormatted());const n=De.resolveURLTemplates([r],s)[0];this.emit("clickthrough",n)}}trackProgressEvents(e,t,r){const s=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter(n=>{let[a]=n;return a.startsWith("progress-")}).map(n=>{let[a,l]=n;return{name:a,time:parseFloat(a.split("-")[1]),urls:l}}).filter(n=>{let{time:a}=n;return a<=s&&a>this.progress}).forEach(n=>{let{name:a,urls:l}=n;!r&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:l}),this.trackURLs(l,t),r?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))})}track(e){let{macros:t={},once:r=!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,r);const s=this.trackingEvents[e],n=this.emitAlwaysEvents.indexOf(e)>-1;s?(this.emit(e,{trackingURLTemplates:s}),this.trackURLs(s,t)):n&&this.emit(e,null),r&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:n,invalidUrls:a}=De.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const l={...r};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(l.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(l.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(l.UNIVERSALADID=this.creative.universalAdIds.map(u=>u.idRegistry.concat(" ",u.value)).join(",")),this.ad&&(this.ad.sequence&&(l.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(l.ADTYPE=this.ad.adType),this.ad.adServingId&&(l.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(l.ADCATEGORIES=this.ad.categories.map(u=>u.value).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(l.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map(u=>u.value).join(","))),De.track(n,l,s)}convertToTimecode(e){if(!De.isValidTimeValue(e))return"";const t=1e3*e,r=Math.floor(t/36e5),s=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(De.addLeadingZeros(r,2),":").concat(De.addLeadingZeros(s,2),":").concat(De.addLeadingZeros(n,2),".").concat(De.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var Os;typeof window<"u"?Os=window:typeof ci.commonjsGlobal<"u"?Os=ci.commonjsGlobal:typeof self<"u"?Os=self:Os={};var Da=Os;const k=ci.getDefaultExportFromCjs(Da),pT={},mT=Object.freeze(Object.defineProperty({__proto__:null,default:pT},Symbol.toStringTag,{value:"Module"})),gT=ci.getAugmentedNamespace(mT);var Mc=typeof ci.commonjsGlobal<"u"?ci.commonjsGlobal:typeof window<"u"?window:{},yT=gT,Ns;typeof document<"u"?Ns=document:(Ns=Mc["__GLOBAL_DOCUMENT_CACHE@4"],Ns||(Ns=Mc["__GLOBAL_DOCUMENT_CACHE@4"]=yT));var jh=Ns;const X=ci.getDefaultExportFromCjs(jh);var wl={exports:{}},Vh={exports:{}};(function(i){function e(){return i.exports=e=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var s=arguments[r];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},i.exports.__esModule=!0,i.exports.default=i.exports,e.apply(null,arguments)}i.exports=e,i.exports.__esModule=!0,i.exports.default=i.exports})(Vh);var _T=Vh.exports,TT=bT,vT=Object.prototype.toString;function bT(i){if(!i)return!1;var e=vT.call(i);return e==="[object Function]"||typeof i=="function"&&e!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}function xT(i,e){var t=typeof Symbol<"u"&&i[Symbol.iterator]||i["@@iterator"];if(t)return(t=t.call(i)).next.bind(t);if(Array.isArray(i)||(t=ST(i))||e){t&&(i=t);var r=0;return function(){return r>=i.length?{done:!0}:{done:!1,value:i[r++]}}}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 ST(i,e){if(i){if(typeof i=="string")return Uc(i,e);var t=Object.prototype.toString.call(i).slice(8,-1);if(t==="Object"&&i.constructor&&(t=i.constructor.name),t==="Map"||t==="Set")return Array.from(i);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Uc(i,e)}}function Uc(i,e){(e==null||e>i.length)&&(e=i.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=i[t];return r}var ET=function(){function i(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var e=i.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(r,s){this.typeToInterceptorsMap_.has(r)||this.typeToInterceptorsMap_.set(r,new Set);var n=this.typeToInterceptorsMap_.get(r);return n.has(s)?!1:(n.add(s),!0)},e.removeInterceptor=function(r,s){var n=this.typeToInterceptorsMap_.get(r);return n&&n.has(s)?(n.delete(s),!0):!1},e.clearInterceptorsByType=function(r){var s=this.typeToInterceptorsMap_.get(r);return s?(this.typeToInterceptorsMap_.delete(r),this.typeToInterceptorsMap_.set(r,new Set),!0):!1},e.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},e.getForType=function(r){return this.typeToInterceptorsMap_.get(r)||new Set},e.execute=function(r,s){for(var n=this.getForType(r),a=xT(n),l;!(l=a()).done;){var u=l.value;try{s=u(s)}catch{}}return s},i}(),CT=ET,AT=function(){function i(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var e=i.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(r){this.maxAttempts_=r},e.getDelayFactor=function(){return this.delayFactor_},e.setDelayFactor=function(r){this.delayFactor_=r},e.getFuzzFactor=function(){return this.fuzzFactor_},e.setFuzzFactor=function(r){this.fuzzFactor_=r},e.getInitialDelay=function(){return this.initialDelay_},e.setInitialDelay=function(r){this.initialDelay_=r},e.createRetry=function(r){var s=r===void 0?{}:r,n=s.maxAttempts,a=s.delayFactor,l=s.fuzzFactor,u=s.initialDelay;return new wT({maxAttempts:n||this.maxAttempts_,delayFactor:a||this.delayFactor_,fuzzFactor:l||this.fuzzFactor_,initialDelay:u||this.initialDelay_})},i}(),wT=function(){function i(t){this.maxAttempts_=t.maxAttempts,this.delayFactor_=t.delayFactor,this.fuzzFactor_=t.fuzzFactor,this.currentDelay_=t.initialDelay,this.currentAttempt_=1}var e=i.prototype;return e.moveToNextAttempt=function(){this.currentAttempt_++;var r=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+r},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 r=this.getCurrentMinPossibleDelay(),s=this.getCurrentMaxPossibleDelay();return r+Math.random()*(s-r)},i}(),DT=AT,IT=Da,kT=function(e,t){return t===void 0&&(t=!1),function(r,s,n){if(r){e(r);return}if(s.statusCode>=400&&s.statusCode<=599){var a=n;if(t)if(IT.TextDecoder){var l=PT(s.headers&&s.headers["content-type"]);try{a=new TextDecoder(l).decode(n)}catch{}}else a=String.fromCharCode.apply(null,new Uint8Array(n));e({cause:a});return}e(null,n)}};function PT(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(e,t){var r=t.split("="),s=r[0],n=r[1];return s.trim()==="charset"?n.trim():e},"utf-8")}var LT=kT,qh=Da,RT=_T,OT=TT,Hh=CT,NT=DT;We.httpHandler=LT;We.requestInterceptorsStorage=new Hh;We.responseInterceptorsStorage=new Hh;We.retryManager=new NT;/**
|
|
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(i){var n=i.indexOf(":"),r=i.slice(0,n).trim().toLowerCase(),a=i.slice(n+1).trim();typeof t[r]>"u"?t[r]=a:Array.isArray(t[r])?t[r].push(a):t[r]=[t[r],a]}),t};So.exports=$e;So.exports.default=$e;$e.XMLHttpRequest=Yc.XMLHttpRequest||ty;$e.XDomainRequest="withCredentials"in new $e.XMLHttpRequest?$e.XMLHttpRequest:Yc.XDomainRequest;J0(["get","put","post","patch","head","delete"],function(s){$e[s==="delete"?"del":s]=function(e,t,i){return t=Jc(e,t,i),t.method=s.toUpperCase(),Eo(t)}});function J0(s,e){for(var t=0;t<s.length;t++)e(s[t])}function Z0(s){for(var e in s)if(s.hasOwnProperty(e))return!1;return!0}function Jc(s,e,t){var i=s;return X0(e)?(t=e,typeof s=="string"&&(i={uri:s})):i=K0({},e,{uri:s}),i.callback=t,i}function $e(s,e,t){return e=Jc(s,e,t),Eo(e)}function Eo(s){if(typeof s.callback>"u")throw new Error("callback argument missing");if(s.requestType&&$e.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=$e.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 i=!1,n=function(D,V,X){i||(i=!0,s.callback(D,V,X))};function r(){f.readyState===4&&!$e.responseInterceptorsStorage.getIsEnabled()&&setTimeout(h,0)}function a(){var F=void 0;if(f.response?F=f.response:F=f.responseText||ey(f),L)try{F=JSON.parse(F)}catch{}return F}function l(F){if(clearTimeout(N),clearTimeout(s.retryTimeout),F instanceof Error||(F=new Error(""+(F||"Unknown XMLHttpRequest Error"))),F.statusCode=0,!T&&$e.retryManager.getIsEnabled()&&s.retry&&s.retry.shouldRetry()){s.retryTimeout=setTimeout(function(){s.retry.moveToNextAttempt(),s.xhr=f,Eo(s)},s.retry.getCurrentFuzzedDelay());return}if(s.requestType&&$e.responseInterceptorsStorage.getIsEnabled()){var D={headers:U.headers||{},body:U.body,responseUrl:f.responseURL,responseType:f.responseType},V=$e.responseInterceptorsStorage.execute(s.requestType,D);U.body=V.body,U.headers=V.headers}return n(F,U)}function h(){if(!T){var F;clearTimeout(N),clearTimeout(s.retryTimeout),s.useXDR&&f.status===void 0?F=200:F=f.status===1223?204:f.status;var D=U,V=null;if(F!==0?(D={body:a(),statusCode:F,method:C,headers:{},url:E,rawRequest:f},f.getAllResponseHeaders&&(D.headers=Q0(f.getAllResponseHeaders()))):V=new Error("Internal XMLHttpRequest Error"),s.requestType&&$e.responseInterceptorsStorage.getIsEnabled()){var X={headers:D.headers||{},body:D.body,responseUrl:f.responseURL,responseType:f.responseType},G=$e.responseInterceptorsStorage.execute(s.requestType,X);D.body=G.body,D.headers=G.headers}return n(V,D,D.body)}}var f=s.xhr||null;f||(s.cors||s.useXDR?f=new $e.XDomainRequest:f=new $e.XMLHttpRequest);var m,T,E=f.url=s.uri||s.url,C=f.method=s.method||"GET",P=s.body||s.data,v=f.headers=s.headers||{},R=!!s.sync,L=!1,N,U={body:void 0,headers:{},statusCode:0,method:C,url:E,rawRequest:f};if("json"in s&&s.json!==!1&&(L=!0,v.accept||v.Accept||(v.Accept="application/json"),C!=="GET"&&C!=="HEAD"&&(v["content-type"]||v["Content-Type"]||(v["Content-Type"]="application/json"),P=JSON.stringify(s.json===!0?P:s.json))),f.onreadystatechange=r,f.onload=h,f.onerror=l,f.onprogress=function(){},f.onabort=function(){T=!0,clearTimeout(s.retryTimeout)},f.ontimeout=l,f.open(C,E,!R,s.username,s.password),R||(f.withCredentials=!!s.withCredentials),!R&&s.timeout>0&&(N=setTimeout(function(){if(!T){T=!0,f.abort("timeout");var F=new Error("XMLHttpRequest timeout");F.code="ETIMEDOUT",l(F)}},s.timeout)),f.setRequestHeader)for(m in v)v.hasOwnProperty(m)&&f.setRequestHeader(m,v[m]);else if(s.headers&&!Z0(s.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in s&&(f.responseType=s.responseType),"beforeSend"in s&&typeof s.beforeSend=="function"&&s.beforeSend(f),f.send(P||null),f}function ey(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 ty(){}var iy=So.exports;const Zc=Jt.getDefaultExportFromCjs(iy);var ed={exports:{}},fu=Kc,Co=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 Tt(s,e){this.name="ParsingError",this.code=s.code,this.message=e||s.message}Tt.prototype=Co(Error.prototype);Tt.prototype.constructor=Tt;Tt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function wo(s){function e(i,n,r,a){return(i|0)*3600+(n|0)*60+(r|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 cn(){this.values=Co(null)}cn.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 i=0;i<t.length;++i)if(e===t[i]){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 an(s,e,t,i){var n=i?s.split(i):[s];for(var r in n)if(typeof n[r]=="string"){var a=n[r].split(t);if(a.length===2){var l=a[0].trim(),h=a[1].trim();e(l,h)}}}function sy(s,e,t){var i=s;function n(){var l=wo(s);if(l===null)throw new Tt(Tt.Errors.BadTimeStamp,"Malformed timestamp: "+i);return s=s.replace(/^[^\sa-zA-Z-]+/,""),l}function r(l,h){var f=new cn;an(l,function(m,T){switch(m){case"region":for(var E=t.length-1;E>=0;E--)if(t[E].id===T){f.set(m,t[E].region);break}break;case"vertical":f.alt(m,T,["rl","lr"]);break;case"line":var C=T.split(","),P=C[0];f.integer(m,P),f.percent(m,P)&&f.set("snapToLines",!1),f.alt(m,P,["auto"]),C.length===2&&f.alt("lineAlign",C[1],["start","center","end"]);break;case"position":C=T.split(","),f.percent(m,C[0]),C.length===2&&f.alt("positionAlign",C[1],["start","center","end"]);break;case"size":f.percent(m,T);break;case"align":f.alt(m,T,["start","center","end","left","right"]);break}},/:/,/\s/),h.region=f.get("region",null),h.vertical=f.get("vertical","");try{h.line=f.get("line","auto")}catch{}h.lineAlign=f.get("lineAlign","start"),h.snapToLines=f.get("snapToLines",!0),h.size=f.get("size",100);try{h.align=f.get("align","center")}catch{h.align=f.get("align","middle")}try{h.position=f.get("position","auto")}catch{h.position=f.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},h.align)}h.positionAlign=f.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},h.align)}function a(){s=s.replace(/^\s+/,"")}if(a(),e.startTime=n(),a(),s.substr(0,3)!=="-->")throw new Tt(Tt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+i);s=s.substr(3),a(),e.endTime=n(),a(),r(s,e)}var Ia=fu.createElement&&fu.createElement("textarea"),ny={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},pu={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)"},ry={v:"title",lang:"lang"},mu={rt:"ruby"};function td(s,e){function t(){if(!e)return null;function P(R){return e=e.substr(R.length),R}var v=e.match(/^([^<]*)(<[^>]*>?)?/);return P(v[1]?v[1]:v[2])}function i(P){return Ia.innerHTML=P,P=Ia.textContent,Ia.textContent="",P}function n(P,v){return!mu[v.localName]||mu[v.localName]===P.localName}function r(P,v){var R=ny[P];if(!R)return null;var L=s.document.createElement(R),N=ry[P];return N&&v&&(L[N]=v.trim()),L}for(var a=s.document.createElement("div"),l=a,h,f=[];(h=t())!==null;){if(h[0]==="<"){if(h[1]==="/"){f.length&&f[f.length-1]===h.substr(2).replace(">","")&&(f.pop(),l=l.parentNode);continue}var m=wo(h.substr(1,h.length-2)),T;if(m){T=s.document.createProcessingInstruction("timestamp",m),l.appendChild(T);continue}var E=h.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!E||(T=r(E[1],E[3]),!T)||!n(l,T))continue;if(E[2]){var C=E[2].split(".");C.forEach(function(P){var v=/^bg_/.test(P),R=v?P.slice(3):P;if(pu.hasOwnProperty(R)){var L=v?"background-color":"color",N=pu[R];T.style[L]=N}}),T.className=C.join(" ")}f.push(E[1]),l.appendChild(T),l=T;continue}l.appendChild(s.document.createTextNode(i(h)))}return a}var gu=[[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 ay(s){for(var e=0;e<gu.length;e++){var t=gu[e];if(s>=t[0]&&s<=t[1])return!0}return!1}function oy(s){var e=[],t="",i;if(!s||!s.childNodes)return"ltr";function n(l,h){for(var f=h.childNodes.length-1;f>=0;f--)l.push(h.childNodes[f])}function r(l){if(!l||!l.length)return null;var h=l.pop(),f=h.textContent||h.innerText;if(f){var m=f.match(/^.*(\n|\r)/);return m?(l.length=0,m[0]):f}if(h.tagName==="ruby")return r(l);if(h.childNodes)return n(l,h),r(l)}for(n(e,s);t=r(e);)for(var a=0;a<t.length;a++)if(i=t.charCodeAt(a),ay(i))return"rtl";return"ltr"}function ly(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,i=0,n=0;n<t.length&&t[n]!==e;n++)t[n].mode==="showing"&&i++;return++i*-1}function Nr(){}Nr.prototype.applyStyles=function(s,e){e=e||this.div;for(var t in s)s.hasOwnProperty(t)&&(e.style[t]=s[t])};Nr.prototype.formatStyle=function(s,e){return s===0?0:s+e};function cr(s,e,t){Nr.call(this),this.cue=e,this.cueDiv=td(s,e.text);var i={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(i,this.cueDiv),this.div=s.document.createElement("div"),i={direction:oy(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(i),this.div.appendChild(this.cueDiv);var n=0;switch(e.positionAlign){case"start":case"line-left":n=e.position;break;case"center":n=e.position-e.size/2;break;case"end":case"line-right":n=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(n,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(n,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(r){this.applyStyles({top:this.formatStyle(r.top,"px"),bottom:this.formatStyle(r.bottom,"px"),left:this.formatStyle(r.left,"px"),right:this.formatStyle(r.right,"px"),height:this.formatStyle(r.height,"px"),width:this.formatStyle(r.width,"px")})}}cr.prototype=Co(Nr.prototype);cr.prototype.constructor=cr;function at(s){var e,t,i,n;if(s.div){t=s.div.offsetHeight,i=s.div.offsetWidth,n=s.div.offsetTop;var r=(r=s.div.childNodes)&&(r=r[0])&&r.getClientRects&&r.getClientRects();s=s.div.getBoundingClientRect(),e=r?Math.max(r[0]&&r[0].height||0,s.height/r.length):0}this.left=s.left,this.right=s.right,this.top=s.top||n,this.height=s.height||t,this.bottom=s.bottom||n+(s.height||t),this.width=s.width||i,this.lineHeight=e!==void 0?e:s.lineHeight}at.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}};at.prototype.overlaps=function(s){return this.left<s.right&&this.right>s.left&&this.top<s.bottom&&this.bottom>s.top};at.prototype.overlapsAny=function(s){for(var e=0;e<s.length;e++)if(this.overlaps(s[e]))return!0;return!1};at.prototype.within=function(s){return this.top>=s.top&&this.bottom<=s.bottom&&this.left>=s.left&&this.right<=s.right};at.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}};at.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)),i=e*t;return i/(this.height*this.width)};at.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}};at.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,i=s.div?s.div.offsetTop:s.tagName?s.offsetTop:0;s=s.div?s.div.getBoundingClientRect():s.tagName?s.getBoundingClientRect():s;var n={left:s.left,right:s.right,top:s.top||i,height:s.height||e,bottom:s.bottom||i+(s.height||e),width:s.width||t};return n};function uy(s,e,t,i){function n(R,L){for(var N,U=new at(R),F=1,D=0;D<L.length;D++){for(;R.overlapsOppositeAxis(t,L[D])||R.within(t)&&R.overlapsAny(i);)R.move(L[D]);if(R.within(t))return R;var V=R.intersectPercentage(t);F>V&&(N=new at(R),F=V),R=new at(U)}return N||U}var r=new at(e),a=e.cue,l=ly(a),h=[];if(a.snapToLines){var f;switch(a.vertical){case"":h=["+y","-y"],f="height";break;case"rl":h=["+x","-x"],f="width";break;case"lr":h=["-x","+x"],f="width";break}var m=r.lineHeight,T=m*Math.round(l),E=t[f]+m,C=h[0];Math.abs(T)>E&&(T=T<0?-1:1,T*=Math.ceil(E/m)*m),l<0&&(T+=a.vertical===""?t.height:t.width,h=h.reverse()),r.move(C,T)}else{var P=r.lineHeight/t.height*100;switch(a.lineAlign){case"center":l-=P/2;break;case"end":l-=P;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(l,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(l,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(l,"%")});break}h=["+y","-x","+x","-y"],r=new at(e)}var v=n(r,h);e.move(v.toCSSCompatValues(t))}function Ss(){}Ss.StringDecoder=function(){return{decode:function(s){if(!s)return"";if(typeof s!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(s))}}};Ss.convertCueToDOMTree=function(s,e){return!s||!e?null:td(s,e)};var cy=.05,dy="sans-serif",hy="1.5%";Ss.processCues=function(s,e,t){if(!s||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var i=s.document.createElement("div");i.style.position="absolute",i.style.left="0",i.style.right="0",i.style.top="0",i.style.bottom="0",i.style.margin=hy,t.appendChild(i);function n(m){for(var T=0;T<m.length;T++)if(m[T].hasBeenReset||!m[T].displayState)return!0;return!1}if(!n(e)){for(var r=0;r<e.length;r++)i.appendChild(e[r].displayState);return}var a=[],l=at.getSimpleBoxPosition(i),h=Math.round(l.height*cy*100)/100,f={font:h+"px "+dy};(function(){for(var m,T,E=0;E<e.length;E++)T=e[E],m=new cr(s,T,f),i.appendChild(m.div),uy(s,m,l,a),T.displayState=m.div,a.push(at.getSimpleBoxPosition(m))})()};Ss.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=[]};Ss.Parser.prototype={reportOrThrowError:function(s){if(s instanceof Tt)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,T=0;T<m.length&&m[T]!=="\r"&&m[T]!==`
|
|
10
|
-
`;)++T;var
|
|
11
|
-
`&&++T,e.buffer=
|
|
8
|
+
*/var BT=function(e){var t={};return e&&e.trim().split(`
|
|
9
|
+
`).forEach(function(r){var s=r.indexOf(":"),n=r.slice(0,s).trim().toLowerCase(),a=r.slice(s+1).trim();typeof t[n]>"u"?t[n]=a:Array.isArray(t[n])?t[n].push(a):t[n]=[t[n],a]}),t};wl.exports=We;wl.exports.default=We;We.XMLHttpRequest=qh.XMLHttpRequest||$T;We.XDomainRequest="withCredentials"in new We.XMLHttpRequest?We.XMLHttpRequest:qh.XDomainRequest;MT(["get","put","post","patch","head","delete"],function(i){We[i==="delete"?"del":i]=function(e,t,r){return t=zh(e,t,r),t.method=i.toUpperCase(),Dl(t)}});function MT(i,e){for(var t=0;t<i.length;t++)e(i[t])}function UT(i){for(var e in i)if(i.hasOwnProperty(e))return!1;return!0}function zh(i,e,t){var r=i;return OT(e)?(t=e,typeof i=="string"&&(r={uri:i})):r=RT({},e,{uri:i}),r.callback=t,r}function We(i,e,t){return e=zh(i,e,t),Dl(e)}function Dl(i){if(typeof i.callback>"u")throw new Error("callback argument missing");if(i.requestType&&We.requestInterceptorsStorage.getIsEnabled()){var e={uri:i.uri||i.url,headers:i.headers||{},body:i.body,metadata:i.metadata||{},retry:i.retry,timeout:i.timeout},t=We.requestInterceptorsStorage.execute(i.requestType,e);i.uri=t.uri,i.headers=t.headers,i.body=t.body,i.metadata=t.metadata,i.retry=t.retry,i.timeout=t.timeout}var r=!1,s=function(R,q,Y){r||(r=!0,i.callback(R,q,Y))};function n(){f.readyState===4&&!We.responseInterceptorsStorage.getIsEnabled()&&setTimeout(u,0)}function a(){var U=void 0;if(f.response?U=f.response:U=f.responseText||FT(f),P)try{U=JSON.parse(U)}catch{}return U}function l(U){if(clearTimeout(M),clearTimeout(i.retryTimeout),U instanceof Error||(U=new Error(""+(U||"Unknown XMLHttpRequest Error"))),U.statusCode=0,!T&&We.retryManager.getIsEnabled()&&i.retry&&i.retry.shouldRetry()){i.retryTimeout=setTimeout(function(){i.retry.moveToNextAttempt(),i.xhr=f,Dl(i)},i.retry.getCurrentFuzzedDelay());return}if(i.requestType&&We.responseInterceptorsStorage.getIsEnabled()){var R={headers:O.headers||{},body:O.body,responseUrl:f.responseURL,responseType:f.responseType},q=We.responseInterceptorsStorage.execute(i.requestType,R);O.body=q.body,O.headers=q.headers}return s(U,O)}function u(){if(!T){var U;clearTimeout(M),clearTimeout(i.retryTimeout),i.useXDR&&f.status===void 0?U=200:U=f.status===1223?204:f.status;var R=O,q=null;if(U!==0?(R={body:a(),statusCode:U,method:S,headers:{},url:b,rawRequest:f},f.getAllResponseHeaders&&(R.headers=BT(f.getAllResponseHeaders()))):q=new Error("Internal XMLHttpRequest Error"),i.requestType&&We.responseInterceptorsStorage.getIsEnabled()){var Y={headers:R.headers||{},body:R.body,responseUrl:f.responseURL,responseType:f.responseType},K=We.responseInterceptorsStorage.execute(i.requestType,Y);R.body=K.body,R.headers=K.headers}return s(q,R,R.body)}}var f=i.xhr||null;f||(i.cors||i.useXDR?f=new We.XDomainRequest:f=new We.XMLHttpRequest);var p,T,b=f.url=i.uri||i.url,S=f.method=i.method||"GET",A=i.body||i.data,v=f.headers=i.headers||{},L=!!i.sync,P=!1,M,O={body:void 0,headers:{},statusCode:0,method:S,url:b,rawRequest:f};if("json"in i&&i.json!==!1&&(P=!0,v.accept||v.Accept||(v.Accept="application/json"),S!=="GET"&&S!=="HEAD"&&(v["content-type"]||v["Content-Type"]||(v["Content-Type"]="application/json"),A=JSON.stringify(i.json===!0?A:i.json))),f.onreadystatechange=n,f.onload=u,f.onerror=l,f.onprogress=function(){},f.onabort=function(){T=!0,clearTimeout(i.retryTimeout)},f.ontimeout=l,f.open(S,b,!L,i.username,i.password),L||(f.withCredentials=!!i.withCredentials),!L&&i.timeout>0&&(M=setTimeout(function(){if(!T){T=!0,f.abort("timeout");var U=new Error("XMLHttpRequest timeout");U.code="ETIMEDOUT",l(U)}},i.timeout)),f.setRequestHeader)for(p in v)v.hasOwnProperty(p)&&f.setRequestHeader(p,v[p]);else if(i.headers&&!UT(i.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in i&&(f.responseType=i.responseType),"beforeSend"in i&&typeof i.beforeSend=="function"&&i.beforeSend(f),f.send(A||null),f}function FT(i){try{if(i.responseType==="document")return i.responseXML;var e=i.responseXML&&i.responseXML.documentElement.nodeName==="parsererror";if(i.responseType===""&&!e)return i.responseXML}catch{}return null}function $T(){}var jT=wl.exports;const Wh=ci.getDefaultExportFromCjs(jT);var Gh={exports:{}},Fc=jh,Il=Object.create||function(){function i(){}return function(e){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return i.prototype=e,new i}}();function Dt(i,e){this.name="ParsingError",this.code=i.code,this.message=e||i.message}Dt.prototype=Il(Error.prototype);Dt.prototype.constructor=Dt;Dt.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function kl(i){function e(r,s,n,a){return(r|0)*3600+(s|0)*60+(n|0)+(a|0)/1e3}var t=i.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return t?t[3]?e(t[1],t[2],t[3].replace(":",""),t[4]):t[1]>59?e(t[1],t[2],0,t[4]):e(0,t[1],t[2],t[4]):null}function $s(){this.values=Il(null)}$s.prototype={set:function(i,e){!this.get(i)&&e!==""&&(this.values[i]=e)},get:function(i,e,t){return t?this.has(i)?this.values[i]:e[t]:this.has(i)?this.values[i]:e},has:function(i){return i in this.values},alt:function(i,e,t){for(var r=0;r<t.length;++r)if(e===t[r]){this.set(i,e);break}},integer:function(i,e){/^-?\d+$/.test(e)&&this.set(i,parseInt(e,10))},percent:function(i,e){return e.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(e=parseFloat(e),e>=0&&e<=100)?(this.set(i,e),!0):!1}};function Bs(i,e,t,r){var s=r?i.split(r):[i];for(var n in s)if(typeof s[n]=="string"){var a=s[n].split(t);if(a.length===2){var l=a[0].trim(),u=a[1].trim();e(l,u)}}}function VT(i,e,t){var r=i;function s(){var l=kl(i);if(l===null)throw new Dt(Dt.Errors.BadTimeStamp,"Malformed timestamp: "+r);return i=i.replace(/^[^\sa-zA-Z-]+/,""),l}function n(l,u){var f=new $s;Bs(l,function(p,T){switch(p){case"region":for(var b=t.length-1;b>=0;b--)if(t[b].id===T){f.set(p,t[b].region);break}break;case"vertical":f.alt(p,T,["rl","lr"]);break;case"line":var S=T.split(","),A=S[0];f.integer(p,A),f.percent(p,A)&&f.set("snapToLines",!1),f.alt(p,A,["auto"]),S.length===2&&f.alt("lineAlign",S[1],["start","center","end"]);break;case"position":S=T.split(","),f.percent(p,S[0]),S.length===2&&f.alt("positionAlign",S[1],["start","center","end"]);break;case"size":f.percent(p,T);break;case"align":f.alt(p,T,["start","center","end","left","right"]);break}},/:/,/\s/),u.region=f.get("region",null),u.vertical=f.get("vertical","");try{u.line=f.get("line","auto")}catch{}u.lineAlign=f.get("lineAlign","start"),u.snapToLines=f.get("snapToLines",!0),u.size=f.get("size",100);try{u.align=f.get("align","center")}catch{u.align=f.get("align","middle")}try{u.position=f.get("position","auto")}catch{u.position=f.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},u.align)}u.positionAlign=f.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},u.align)}function a(){i=i.replace(/^\s+/,"")}if(a(),e.startTime=s(),a(),i.substr(0,3)!=="-->")throw new Dt(Dt.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+r);i=i.substr(3),a(),e.endTime=s(),a(),n(i,e)}var Eo=Fc.createElement&&Fc.createElement("textarea"),qT={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},$c={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)"},HT={v:"title",lang:"lang"},jc={rt:"ruby"};function Kh(i,e){function t(){if(!e)return null;function A(L){return e=e.substr(L.length),L}var v=e.match(/^([^<]*)(<[^>]*>?)?/);return A(v[1]?v[1]:v[2])}function r(A){return Eo.innerHTML=A,A=Eo.textContent,Eo.textContent="",A}function s(A,v){return!jc[v.localName]||jc[v.localName]===A.localName}function n(A,v){var L=qT[A];if(!L)return null;var P=i.document.createElement(L),M=HT[A];return M&&v&&(P[M]=v.trim()),P}for(var a=i.document.createElement("div"),l=a,u,f=[];(u=t())!==null;){if(u[0]==="<"){if(u[1]==="/"){f.length&&f[f.length-1]===u.substr(2).replace(">","")&&(f.pop(),l=l.parentNode);continue}var p=kl(u.substr(1,u.length-2)),T;if(p){T=i.document.createProcessingInstruction("timestamp",p),l.appendChild(T);continue}var b=u.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!b||(T=n(b[1],b[3]),!T)||!s(l,T))continue;if(b[2]){var S=b[2].split(".");S.forEach(function(A){var v=/^bg_/.test(A),L=v?A.slice(3):A;if($c.hasOwnProperty(L)){var P=v?"background-color":"color",M=$c[L];T.style[P]=M}}),T.className=S.join(" ")}f.push(b[1]),l.appendChild(T),l=T;continue}l.appendChild(i.document.createTextNode(r(u)))}return a}var Vc=[[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 zT(i){for(var e=0;e<Vc.length;e++){var t=Vc[e];if(i>=t[0]&&i<=t[1])return!0}return!1}function WT(i){var e=[],t="",r;if(!i||!i.childNodes)return"ltr";function s(l,u){for(var f=u.childNodes.length-1;f>=0;f--)l.push(u.childNodes[f])}function n(l){if(!l||!l.length)return null;var u=l.pop(),f=u.textContent||u.innerText;if(f){var p=f.match(/^.*(\n|\r)/);return p?(l.length=0,p[0]):f}if(u.tagName==="ruby")return n(l);if(u.childNodes)return s(l,u),n(l)}for(s(e,i);t=n(e);)for(var a=0;a<t.length;a++)if(r=t.charCodeAt(a),zT(r))return"rtl";return"ltr"}function GT(i){if(typeof i.line=="number"&&(i.snapToLines||i.line>=0&&i.line<=100))return i.line;if(!i.track||!i.track.textTrackList||!i.track.textTrackList.mediaElement)return-1;for(var e=i.track,t=e.textTrackList,r=0,s=0;s<t.length&&t[s]!==e;s++)t[s].mode==="showing"&&r++;return++r*-1}function Ia(){}Ia.prototype.applyStyles=function(i,e){e=e||this.div;for(var t in i)i.hasOwnProperty(t)&&(e.style[t]=i[t])};Ia.prototype.formatStyle=function(i,e){return i===0?0:i+e};function Zn(i,e,t){Ia.call(this),this.cue=e,this.cueDiv=Kh(i,e.text);var r={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(r,this.cueDiv),this.div=i.document.createElement("div"),r={direction:WT(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(r),this.div.appendChild(this.cueDiv);var s=0;switch(e.positionAlign){case"start":case"line-left":s=e.position;break;case"center":s=e.position-e.size/2;break;case"end":case"line-right":s=e.position-e.size;break}e.vertical===""?this.applyStyles({left:this.formatStyle(s,"%"),width:this.formatStyle(e.size,"%")}):this.applyStyles({top:this.formatStyle(s,"%"),height:this.formatStyle(e.size,"%")}),this.move=function(n){this.applyStyles({top:this.formatStyle(n.top,"px"),bottom:this.formatStyle(n.bottom,"px"),left:this.formatStyle(n.left,"px"),right:this.formatStyle(n.right,"px"),height:this.formatStyle(n.height,"px"),width:this.formatStyle(n.width,"px")})}}Zn.prototype=Il(Ia.prototype);Zn.prototype.constructor=Zn;function ht(i){var e,t,r,s;if(i.div){t=i.div.offsetHeight,r=i.div.offsetWidth,s=i.div.offsetTop;var n=(n=i.div.childNodes)&&(n=n[0])&&n.getClientRects&&n.getClientRects();i=i.div.getBoundingClientRect(),e=n?Math.max(n[0]&&n[0].height||0,i.height/n.length):0}this.left=i.left,this.right=i.right,this.top=i.top||s,this.height=i.height||t,this.bottom=i.bottom||s+(i.height||t),this.width=i.width||r,this.lineHeight=e!==void 0?e:i.lineHeight}ht.prototype.move=function(i,e){switch(e=e!==void 0?e:this.lineHeight,i){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}};ht.prototype.overlaps=function(i){return this.left<i.right&&this.right>i.left&&this.top<i.bottom&&this.bottom>i.top};ht.prototype.overlapsAny=function(i){for(var e=0;e<i.length;e++)if(this.overlaps(i[e]))return!0;return!1};ht.prototype.within=function(i){return this.top>=i.top&&this.bottom<=i.bottom&&this.left>=i.left&&this.right<=i.right};ht.prototype.overlapsOppositeAxis=function(i,e){switch(e){case"+x":return this.left<i.left;case"-x":return this.right>i.right;case"+y":return this.top<i.top;case"-y":return this.bottom>i.bottom}};ht.prototype.intersectPercentage=function(i){var e=Math.max(0,Math.min(this.right,i.right)-Math.max(this.left,i.left)),t=Math.max(0,Math.min(this.bottom,i.bottom)-Math.max(this.top,i.top)),r=e*t;return r/(this.height*this.width)};ht.prototype.toCSSCompatValues=function(i){return{top:this.top-i.top,bottom:i.bottom-this.bottom,left:this.left-i.left,right:i.right-this.right,height:this.height,width:this.width}};ht.getSimpleBoxPosition=function(i){var e=i.div?i.div.offsetHeight:i.tagName?i.offsetHeight:0,t=i.div?i.div.offsetWidth:i.tagName?i.offsetWidth:0,r=i.div?i.div.offsetTop:i.tagName?i.offsetTop:0;i=i.div?i.div.getBoundingClientRect():i.tagName?i.getBoundingClientRect():i;var s={left:i.left,right:i.right,top:i.top||r,height:i.height||e,bottom:i.bottom||r+(i.height||e),width:i.width||t};return s};function KT(i,e,t,r){function s(L,P){for(var M,O=new ht(L),U=1,R=0;R<P.length;R++){for(;L.overlapsOppositeAxis(t,P[R])||L.within(t)&&L.overlapsAny(r);)L.move(P[R]);if(L.within(t))return L;var q=L.intersectPercentage(t);U>q&&(M=new ht(L),U=q),L=new ht(O)}return M||O}var n=new ht(e),a=e.cue,l=GT(a),u=[];if(a.snapToLines){var f;switch(a.vertical){case"":u=["+y","-y"],f="height";break;case"rl":u=["+x","-x"],f="width";break;case"lr":u=["-x","+x"],f="width";break}var p=n.lineHeight,T=p*Math.round(l),b=t[f]+p,S=u[0];Math.abs(T)>b&&(T=T<0?-1:1,T*=Math.ceil(b/p)*p),l<0&&(T+=a.vertical===""?t.height:t.width,u=u.reverse()),n.move(S,T)}else{var A=n.lineHeight/t.height*100;switch(a.lineAlign){case"center":l-=A/2;break;case"end":l-=A;break}switch(a.vertical){case"":e.applyStyles({top:e.formatStyle(l,"%")});break;case"rl":e.applyStyles({left:e.formatStyle(l,"%")});break;case"lr":e.applyStyles({right:e.formatStyle(l,"%")});break}u=["+y","-x","+x","-y"],n=new ht(e)}var v=s(n,u);e.move(v.toCSSCompatValues(t))}function Qr(){}Qr.StringDecoder=function(){return{decode:function(i){if(!i)return"";if(typeof i!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(i))}}};Qr.convertCueToDOMTree=function(i,e){return!i||!e?null:Kh(i,e)};var XT=.05,YT="sans-serif",QT="1.5%";Qr.processCues=function(i,e,t){if(!i||!e||!t)return null;for(;t.firstChild;)t.removeChild(t.firstChild);var r=i.document.createElement("div");r.style.position="absolute",r.style.left="0",r.style.right="0",r.style.top="0",r.style.bottom="0",r.style.margin=QT,t.appendChild(r);function s(p){for(var T=0;T<p.length;T++)if(p[T].hasBeenReset||!p[T].displayState)return!0;return!1}if(!s(e)){for(var n=0;n<e.length;n++)r.appendChild(e[n].displayState);return}var a=[],l=ht.getSimpleBoxPosition(r),u=Math.round(l.height*XT*100)/100,f={font:u+"px "+YT};(function(){for(var p,T,b=0;b<e.length;b++)T=e[b],p=new Zn(i,T,f),r.appendChild(p.div),KT(i,p,l,a),T.displayState=p.div,a.push(ht.getSimpleBoxPosition(p))})()};Qr.Parser=function(i,e,t){t||(t=e,e={}),e||(e={}),this.window=i,this.vttjs=e,this.state="INITIAL",this.buffer="",this.decoder=t||new TextDecoder("utf8"),this.regionList=[]};Qr.Parser.prototype={reportOrThrowError:function(i){if(i instanceof Dt)this.onparsingerror&&this.onparsingerror(i);else throw i},parse:function(i){var e=this;i&&(e.buffer+=e.decoder.decode(i,{stream:!0}));function t(){for(var p=e.buffer,T=0;T<p.length&&p[T]!=="\r"&&p[T]!==`
|
|
10
|
+
`;)++T;var b=p.substr(0,T);return p[T]==="\r"&&++T,p[T]===`
|
|
11
|
+
`&&++T,e.buffer=p.substr(T),b}function r(p){var T=new $s;if(Bs(p,function(S,A){switch(S){case"id":T.set(S,A);break;case"width":T.percent(S,A);break;case"lines":T.integer(S,A);break;case"regionanchor":case"viewportanchor":var v=A.split(",");if(v.length!==2)break;var L=new $s;if(L.percent("x",v[0]),L.percent("y",v[1]),!L.has("x")||!L.has("y"))break;T.set(S+"X",L.get("x")),T.set(S+"Y",L.get("y"));break;case"scroll":T.alt(S,A,["up"]);break}},/=/,/\s/),T.has("id")){var b=new(e.vttjs.VTTRegion||e.window.VTTRegion);b.width=T.get("width",100),b.lines=T.get("lines",3),b.regionAnchorX=T.get("regionanchorX",0),b.regionAnchorY=T.get("regionanchorY",100),b.viewportAnchorX=T.get("viewportanchorX",0),b.viewportAnchorY=T.get("viewportanchorY",100),b.scroll=T.get("scroll",""),e.onregion&&e.onregion(b),e.regionList.push({id:T.get("id"),region:b})}}function s(p){var T=new $s;Bs(p,function(b,S){switch(b){case"MPEGT":T.integer(b+"S",S);break;case"LOCA":T.set(b+"L",kl(S));break}},/[^\d]:/,/,/),e.ontimestampmap&&e.ontimestampmap({MPEGTS:T.get("MPEGTS"),LOCAL:T.get("LOCAL")})}function n(p){p.match(/X-TIMESTAMP-MAP/)?Bs(p,function(T,b){switch(T){case"X-TIMESTAMP-MAP":s(b);break}},/=/):Bs(p,function(T,b){switch(T){case"Region":r(b);break}},/:/)}try{var a;if(e.state==="INITIAL"){if(!/\r\n|\n/.test(e.buffer))return this;a=t();var l=a.match(/^WEBVTT([ \t].*)?$/);if(!l||!l[0])throw new Dt(Dt.Errors.BadSignature);e.state="HEADER"}for(var u=!1;e.buffer;){if(!/\r\n|\n/.test(e.buffer))return this;switch(u?u=!1:a=t(),e.state){case"HEADER":/:/.test(a)?n(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{VT(a,e.cue,e.regionList)}catch(p){e.reportOrThrowError(p),e.cue=null,e.state="BADCUE";continue}e.state="CUETEXT";continue;case"CUETEXT":var f=a.indexOf("-->")!==-1;if(!a||f&&(u=!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
|
-
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(
|
|
14
|
+
`);continue;case"BADCUE":a||(e.state="ID");continue}}}catch(p){e.reportOrThrowError(p),e.state==="CUETEXT"&&e.cue&&e.oncue&&e.oncue(e.cue),e.cue=null,e.state=e.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var i=this;try{if(i.buffer+=i.decoder.decode(),(i.cue||i.state==="HEADER")&&(i.buffer+=`
|
|
15
15
|
|
|
16
|
-
`,
|
|
16
|
+
`,i.parse()),i.state==="INITIAL")throw new Dt(Dt.Errors.BadSignature)}catch(e){i.reportOrThrowError(e)}return i.onflush&&i.onflush(),this}};var JT=Qr,ZT="auto",ev={"":1,lr:1,rl:1},tv={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function iv(i){if(typeof i!="string")return!1;var e=ev[i.toLowerCase()];return e?i.toLowerCase():!1}function Co(i){if(typeof i!="string")return!1;var e=tv[i.toLowerCase()];return e?i.toLowerCase():!1}function Xh(i,e,t){this.hasBeenReset=!1;var r="",s=!1,n=i,a=e,l=t,u=null,f="",p=!0,T="auto",b="start",S="auto",A="auto",v=100,L="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return r},set:function(P){r=""+P}},pauseOnExit:{enumerable:!0,get:function(){return s},set:function(P){s=!!P}},startTime:{enumerable:!0,get:function(){return n},set:function(P){if(typeof P!="number")throw new TypeError("Start time must be set to a number.");n=P,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return a},set:function(P){if(typeof P!="number")throw new TypeError("End time must be set to a number.");a=P,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return l},set:function(P){l=""+P,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return u},set:function(P){u=P,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return f},set:function(P){var M=iv(P);if(M===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");f=M,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return p},set:function(P){p=!!P,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return T},set:function(P){if(typeof P!="number"&&P!==ZT)throw new SyntaxError("Line: an invalid number or illegal string was specified.");T=P,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return b},set:function(P){var M=Co(P);M?(b=M,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return S},set:function(P){if(P<0||P>100)throw new Error("Position must be between 0 and 100.");S=P,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return A},set:function(P){var M=Co(P);M?(A=M,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return v},set:function(P){if(P<0||P>100)throw new Error("Size must be between 0 and 100.");v=P,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return L},set:function(P){var M=Co(P);if(!M)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");L=M,this.hasBeenReset=!0}}}),this.displayState=void 0}Xh.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)};var rv=Xh,sv={"":!0,up:!0};function nv(i){if(typeof i!="string")return!1;var e=sv[i.toLowerCase()];return e?i.toLowerCase():!1}function As(i){return typeof i=="number"&&i>=0&&i<=100}function av(){var i=100,e=3,t=0,r=100,s=0,n=100,a="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return i},set:function(l){if(!As(l))throw new Error("Width must be between 0 and 100.");i=l}},lines:{enumerable:!0,get:function(){return e},set:function(l){if(typeof l!="number")throw new TypeError("Lines must be set to a number.");e=l}},regionAnchorY:{enumerable:!0,get:function(){return r},set:function(l){if(!As(l))throw new Error("RegionAnchorX must be between 0 and 100.");r=l}},regionAnchorX:{enumerable:!0,get:function(){return t},set:function(l){if(!As(l))throw new Error("RegionAnchorY must be between 0 and 100.");t=l}},viewportAnchorY:{enumerable:!0,get:function(){return n},set:function(l){if(!As(l))throw new Error("ViewportAnchorY must be between 0 and 100.");n=l}},viewportAnchorX:{enumerable:!0,get:function(){return s},set:function(l){if(!As(l))throw new Error("ViewportAnchorX must be between 0 and 100.");s=l}},scroll:{enumerable:!0,get:function(){return a},set:function(l){var u=nv(l);u===!1?console.warn("Scroll: an invalid or illegal string was specified."):a=u}}})}var ov=av,bi=Da,cr=Gh.exports={WebVTT:JT,VTTCue:rv,VTTRegion:ov};bi.vttjs=cr;bi.WebVTT=cr.WebVTT;var lv=cr.VTTCue,uv=cr.VTTRegion,cv=bi.VTTCue,dv=bi.VTTRegion;cr.shim=function(){bi.VTTCue=lv,bi.VTTRegion=uv};cr.restore=function(){bi.VTTCue=cv,bi.VTTRegion=dv};bi.VTTCue||cr.shim();var hv=Gh.exports;const qc=ci.getDefaultExportFromCjs(hv);var Hc="https://example.com",ka=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=k.location&&k.location.href||"");var r=/^\/\//.test(e),s=!k.location&&!/\/\//i.test(e);e=new k.URL(e,k.location||Hc);var n=new URL(t,e);return s?n.href.slice(Hc.length):r?n.href.slice(n.protocol.length):n.href},Pl=function(){function i(){this.listeners={}}var e=i.prototype;return e.on=function(r,s){this.listeners[r]||(this.listeners[r]=[]),this.listeners[r].push(s)},e.off=function(r,s){if(!this.listeners[r])return!1;var n=this.listeners[r].indexOf(s);return this.listeners[r]=this.listeners[r].slice(0),this.listeners[r].splice(n,1),n>-1},e.trigger=function(r){var s=this.listeners[r];if(s)if(arguments.length===2)for(var n=s.length,a=0;a<n;++a)s[a].call(this,arguments[1]);else for(var l=Array.prototype.slice.call(arguments,1),u=s.length,f=0;f<u;++f)s[f].apply(this,l)},e.dispose=function(){this.listeners={}},e.pipe=function(r){this.on("data",function(s){r.push(s)})},i}(),Yh={},Pa={};Pa.byteLength=mv;Pa.toByteArray=yv;Pa.fromByteArray=vv;var ri=[],Nt=[],fv=typeof Uint8Array<"u"?Uint8Array:Array,Ao="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var yr=0,pv=Ao.length;yr<pv;++yr)ri[yr]=Ao[yr],Nt[Ao.charCodeAt(yr)]=yr;Nt[45]=62;Nt[95]=63;function Qh(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function mv(i){var e=Qh(i),t=e[0],r=e[1];return(t+r)*3/4-r}function gv(i,e,t){return(e+t)*3/4-t}function yv(i){var e,t=Qh(i),r=t[0],s=t[1],n=new fv(gv(i,r,s)),a=0,l=s>0?r-4:r,u;for(u=0;u<l;u+=4)e=Nt[i.charCodeAt(u)]<<18|Nt[i.charCodeAt(u+1)]<<12|Nt[i.charCodeAt(u+2)]<<6|Nt[i.charCodeAt(u+3)],n[a++]=e>>16&255,n[a++]=e>>8&255,n[a++]=e&255;return s===2&&(e=Nt[i.charCodeAt(u)]<<2|Nt[i.charCodeAt(u+1)]>>4,n[a++]=e&255),s===1&&(e=Nt[i.charCodeAt(u)]<<10|Nt[i.charCodeAt(u+1)]<<4|Nt[i.charCodeAt(u+2)]>>2,n[a++]=e>>8&255,n[a++]=e&255),n}function _v(i){return ri[i>>18&63]+ri[i>>12&63]+ri[i>>6&63]+ri[i&63]}function Tv(i,e,t){for(var r,s=[],n=e;n<t;n+=3)r=(i[n]<<16&16711680)+(i[n+1]<<8&65280)+(i[n+2]&255),s.push(_v(r));return s.join("")}function vv(i){for(var e,t=i.length,r=t%3,s=[],n=16383,a=0,l=t-r;a<l;a+=n)s.push(Tv(i,a,a+n>l?l:a+n));return r===1?(e=i[t-1],s.push(ri[e>>2]+ri[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],s.push(ri[e>>10]+ri[e>>4&63]+ri[e<<2&63]+"=")),s.join("")}var Ll={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Ll.read=function(i,e,t,r,s){var n,a,l=s*8-r-1,u=(1<<l)-1,f=u>>1,p=-7,T=t?s-1:0,b=t?-1:1,S=i[e+T];for(T+=b,n=S&(1<<-p)-1,S>>=-p,p+=l;p>0;n=n*256+i[e+T],T+=b,p-=8);for(a=n&(1<<-p)-1,n>>=-p,p+=r;p>0;a=a*256+i[e+T],T+=b,p-=8);if(n===0)n=1-f;else{if(n===u)return a?NaN:(S?-1:1)*(1/0);a=a+Math.pow(2,r),n=n-f}return(S?-1:1)*a*Math.pow(2,n-r)};Ll.write=function(i,e,t,r,s,n){var a,l,u,f=n*8-s-1,p=(1<<f)-1,T=p>>1,b=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=r?0:n-1,A=r?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+T>=1?e+=b/u:e+=b*Math.pow(2,1-T),e*u>=2&&(a++,u/=2),a+T>=p?(l=0,a=p):a+T>=1?(l=(e*u-1)*Math.pow(2,s),a=a+T):(l=e*Math.pow(2,T-1)*Math.pow(2,s),a=0));s>=8;i[t+S]=l&255,S+=A,l/=256,s-=8);for(a=a<<s|l,f+=s;f>0;i[t+S]=a&255,S+=A,a/=256,f-=8);i[t+S-A]|=v*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=Br,t=Ao,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;s.Buffer=m,s.SlowBuffer=D,s.INSPECT_MAX_BYTES=50;const n=2147483647;s.kMaxLength=n;const{Uint8Array:r,ArrayBuffer:a,SharedArrayBuffer:l}=globalThis;m.TYPED_ARRAY_SUPPORT=h(),!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 h(){try{const b=new r(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,r.prototype),Object.setPrototypeOf(b,g),b.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 f(b){if(b>n)throw new RangeError('The value "'+b+'" is invalid for option "size"');const g=new r(b);return Object.setPrototypeOf(g,m.prototype),g}function m(b,g,y){if(typeof b=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return P(b)}return T(b,g,y)}m.poolSize=8192;function T(b,g,y){if(typeof b=="string")return v(b,g);if(a.isView(b))return L(b);if(b==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b);if(lt(b,a)||b&<(b.buffer,a)||typeof l<"u"&&(lt(b,l)||b&<(b.buffer,l)))return N(b,g,y);if(typeof b=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const w=b.valueOf&&b.valueOf();if(w!=null&&w!==b)return m.from(w,g,y);const M=U(b);if(M)return M;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof b[Symbol.toPrimitive]=="function")return m.from(b[Symbol.toPrimitive]("string"),g,y);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof b)}m.from=function(b,g,y){return T(b,g,y)},Object.setPrototypeOf(m.prototype,r.prototype),Object.setPrototypeOf(m,r);function E(b){if(typeof b!="number")throw new TypeError('"size" argument must be of type number');if(b<0)throw new RangeError('The value "'+b+'" is invalid for option "size"')}function C(b,g,y){return E(b),b<=0?f(b):g!==void 0?typeof y=="string"?f(b).fill(g,y):f(b).fill(g):f(b)}m.alloc=function(b,g,y){return C(b,g,y)};function P(b){return E(b),f(b<0?0:F(b)|0)}m.allocUnsafe=function(b){return P(b)},m.allocUnsafeSlow=function(b){return P(b)};function v(b,g){if((typeof g!="string"||g==="")&&(g="utf8"),!m.isEncoding(g))throw new TypeError("Unknown encoding: "+g);const y=V(b,g)|0;let w=f(y);const M=w.write(b,g);return M!==y&&(w=w.slice(0,M)),w}function R(b){const g=b.length<0?0:F(b.length)|0,y=f(g);for(let w=0;w<g;w+=1)y[w]=b[w]&255;return y}function L(b){if(lt(b,r)){const g=new r(b);return N(g.buffer,g.byteOffset,g.byteLength)}return R(b)}function N(b,g,y){if(g<0||b.byteLength<g)throw new RangeError('"offset" is outside of buffer bounds');if(b.byteLength<g+(y||0))throw new RangeError('"length" is outside of buffer bounds');let w;return g===void 0&&y===void 0?w=new r(b):y===void 0?w=new r(b,g):w=new r(b,g,y),Object.setPrototypeOf(w,m.prototype),w}function U(b){if(m.isBuffer(b)){const g=F(b.length)|0,y=f(g);return y.length===0||b.copy(y,0,0,g),y}if(b.length!==void 0)return typeof b.length!="number"||ki(b.length)?f(0):R(b);if(b.type==="Buffer"&&Array.isArray(b.data))return R(b.data)}function F(b){if(b>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return b|0}function D(b){return+b!=b&&(b=0),m.alloc(+b)}m.isBuffer=function(g){return g!=null&&g._isBuffer===!0&&g!==m.prototype},m.compare=function(g,y){if(lt(g,r)&&(g=m.from(g,g.offset,g.byteLength)),lt(y,r)&&(y=m.from(y,y.offset,y.byteLength)),!m.isBuffer(g)||!m.isBuffer(y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(g===y)return 0;let w=g.length,M=y.length;for(let $=0,z=Math.min(w,M);$<z;++$)if(g[$]!==y[$]){w=g[$],M=y[$];break}return w<M?-1:M<w?1:0},m.isEncoding=function(g){switch(String(g).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(g,y){if(!Array.isArray(g))throw new TypeError('"list" argument must be an Array of Buffers');if(g.length===0)return m.alloc(0);let w;if(y===void 0)for(y=0,w=0;w<g.length;++w)y+=g[w].length;const M=m.allocUnsafe(y);let $=0;for(w=0;w<g.length;++w){let z=g[w];if(lt(z,r))$+z.length>M.length?(m.isBuffer(z)||(z=m.from(z)),z.copy(M,$)):r.prototype.set.call(M,z,$);else if(m.isBuffer(z))z.copy(M,$);else throw new TypeError('"list" argument must be an Array of Buffers');$+=z.length}return M};function V(b,g){if(m.isBuffer(b))return b.length;if(a.isView(b)||lt(b,a))return b.byteLength;if(typeof b!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof b);const y=b.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&y===0)return 0;let M=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return y;case"utf8":case"utf-8":return pe(b).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y*2;case"hex":return y>>>1;case"base64":return In(b).length;default:if(M)return w?-1:pe(b).length;g=(""+g).toLowerCase(),M=!0}}m.byteLength=V;function X(b,g,y){let w=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((y===void 0||y>this.length)&&(y=this.length),y<=0)||(y>>>=0,g>>>=0,y<=g))return"";for(b||(b="utf8");;)switch(b){case"hex":return pt(this,g,y);case"utf8":case"utf-8":return Qe(this,g,y);case"ascii":return be(this,g,y);case"latin1":case"binary":return me(this,g,y);case"base64":return Xe(this,g,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xt(this,g,y);default:if(w)throw new TypeError("Unknown encoding: "+b);b=(b+"").toLowerCase(),w=!0}}m.prototype._isBuffer=!0;function G(b,g,y){const w=b[g];b[g]=b[y],b[y]=w}m.prototype.swap16=function(){const g=this.length;if(g%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let y=0;y<g;y+=2)G(this,y,y+1);return this},m.prototype.swap32=function(){const g=this.length;if(g%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let y=0;y<g;y+=4)G(this,y,y+3),G(this,y+1,y+2);return this},m.prototype.swap64=function(){const g=this.length;if(g%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let y=0;y<g;y+=8)G(this,y,y+7),G(this,y+1,y+6),G(this,y+2,y+5),G(this,y+3,y+4);return this},m.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?Qe(this,0,g):X.apply(this,arguments)},m.prototype.toLocaleString=m.prototype.toString,m.prototype.equals=function(g){if(!m.isBuffer(g))throw new TypeError("Argument must be a Buffer");return this===g?!0:m.compare(this,g)===0},m.prototype.inspect=function(){let g="";const y=s.INSPECT_MAX_BYTES;return g=this.toString("hex",0,y).replace(/(.{2})/g,"$1 ").trim(),this.length>y&&(g+=" ... "),"<Buffer "+g+">"},i&&(m.prototype[i]=m.prototype.inspect),m.prototype.compare=function(g,y,w,M,$){if(lt(g,r)&&(g=m.from(g,g.offset,g.byteLength)),!m.isBuffer(g))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof g);if(y===void 0&&(y=0),w===void 0&&(w=g?g.length:0),M===void 0&&(M=0),$===void 0&&($=this.length),y<0||w>g.length||M<0||$>this.length)throw new RangeError("out of range index");if(M>=$&&y>=w)return 0;if(M>=$)return-1;if(y>=w)return 1;if(y>>>=0,w>>>=0,M>>>=0,$>>>=0,this===g)return 0;let z=$-M,le=w-y;const Pe=Math.min(z,le),Ce=this.slice(M,$),De=g.slice(y,w);for(let ye=0;ye<Pe;++ye)if(Ce[ye]!==De[ye]){z=Ce[ye],le=De[ye];break}return z<le?-1:le<z?1:0};function ae(b,g,y,w,M){if(b.length===0)return-1;if(typeof y=="string"?(w=y,y=0):y>2147483647?y=2147483647:y<-2147483648&&(y=-2147483648),y=+y,ki(y)&&(y=M?0:b.length-1),y<0&&(y=b.length+y),y>=b.length){if(M)return-1;y=b.length-1}else if(y<0)if(M)y=0;else return-1;if(typeof g=="string"&&(g=m.from(g,w)),m.isBuffer(g))return g.length===0?-1:fe(b,g,y,w,M);if(typeof g=="number")return g=g&255,typeof r.prototype.indexOf=="function"?M?r.prototype.indexOf.call(b,g,y):r.prototype.lastIndexOf.call(b,g,y):fe(b,[g],y,w,M);throw new TypeError("val must be string, number or Buffer")}function fe(b,g,y,w,M){let $=1,z=b.length,le=g.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(b.length<2||g.length<2)return-1;$=2,z/=2,le/=2,y/=2}function Pe(De,ye){return $===1?De[ye]:De.readUInt16BE(ye*$)}let Ce;if(M){let De=-1;for(Ce=y;Ce<z;Ce++)if(Pe(b,Ce)===Pe(g,De===-1?0:Ce-De)){if(De===-1&&(De=Ce),Ce-De+1===le)return De*$}else De!==-1&&(Ce-=Ce-De),De=-1}else for(y+le>z&&(y=z-le),Ce=y;Ce>=0;Ce--){let De=!0;for(let ye=0;ye<le;ye++)if(Pe(b,Ce+ye)!==Pe(g,ye)){De=!1;break}if(De)return Ce}return-1}m.prototype.includes=function(g,y,w){return this.indexOf(g,y,w)!==-1},m.prototype.indexOf=function(g,y,w){return ae(this,g,y,w,!0)},m.prototype.lastIndexOf=function(g,y,w){return ae(this,g,y,w,!1)};function ve(b,g,y,w){y=Number(y)||0;const M=b.length-y;w?(w=Number(w),w>M&&(w=M)):w=M;const $=g.length;w>$/2&&(w=$/2);let z;for(z=0;z<w;++z){const le=parseInt(g.substr(z*2,2),16);if(ki(le))return z;b[y+z]=le}return z}function he(b,g,y,w){return hi(pe(g,b.length-y),b,y,w)}function Z(b,g,y,w){return hi(ra(g),b,y,w)}function de(b,g,y,w){return hi(In(g),b,y,w)}function ee(b,g,y,w){return hi(Ls(g,b.length-y),b,y,w)}m.prototype.write=function(g,y,w,M){if(y===void 0)M="utf8",w=this.length,y=0;else if(w===void 0&&typeof y=="string")M=y,w=this.length,y=0;else if(isFinite(y))y=y>>>0,isFinite(w)?(w=w>>>0,M===void 0&&(M="utf8")):(M=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const $=this.length-y;if((w===void 0||w>$)&&(w=$),g.length>0&&(w<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");M||(M="utf8");let z=!1;for(;;)switch(M){case"hex":return ve(this,g,y,w);case"utf8":case"utf-8":return he(this,g,y,w);case"ascii":case"latin1":case"binary":return Z(this,g,y,w);case"base64":return de(this,g,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ee(this,g,y,w);default:if(z)throw new TypeError("Unknown encoding: "+M);M=(""+M).toLowerCase(),z=!0}},m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xe(b,g,y){return g===0&&y===b.length?e.fromByteArray(b):e.fromByteArray(b.slice(g,y))}function Qe(b,g,y){y=Math.min(b.length,y);const w=[];let M=g;for(;M<y;){const $=b[M];let z=null,le=$>239?4:$>223?3:$>191?2:1;if(M+le<=y){let Pe,Ce,De,ye;switch(le){case 1:$<128&&(z=$);break;case 2:Pe=b[M+1],(Pe&192)===128&&(ye=($&31)<<6|Pe&63,ye>127&&(z=ye));break;case 3:Pe=b[M+1],Ce=b[M+2],(Pe&192)===128&&(Ce&192)===128&&(ye=($&15)<<12|(Pe&63)<<6|Ce&63,ye>2047&&(ye<55296||ye>57343)&&(z=ye));break;case 4:Pe=b[M+1],Ce=b[M+2],De=b[M+3],(Pe&192)===128&&(Ce&192)===128&&(De&192)===128&&(ye=($&15)<<18|(Pe&63)<<12|(Ce&63)<<6|De&63,ye>65535&&ye<1114112&&(z=ye))}}z===null?(z=65533,le=1):z>65535&&(z-=65536,w.push(z>>>10&1023|55296),z=56320|z&1023),w.push(z),M+=le}return qe(w)}const Ve=4096;function qe(b){const g=b.length;if(g<=Ve)return String.fromCharCode.apply(String,b);let y="",w=0;for(;w<g;)y+=String.fromCharCode.apply(String,b.slice(w,w+=Ve));return y}function be(b,g,y){let w="";y=Math.min(b.length,y);for(let M=g;M<y;++M)w+=String.fromCharCode(b[M]&127);return w}function me(b,g,y){let w="";y=Math.min(b.length,y);for(let M=g;M<y;++M)w+=String.fromCharCode(b[M]);return w}function pt(b,g,y){const w=b.length;(!g||g<0)&&(g=0),(!y||y<0||y>w)&&(y=w);let M="";for(let $=g;$<y;++$)M+=Wi[b[$]];return M}function xt(b,g,y){const w=b.slice(g,y);let M="";for(let $=0;$<w.length-1;$+=2)M+=String.fromCharCode(w[$]+w[$+1]*256);return M}m.prototype.slice=function(g,y){const w=this.length;g=~~g,y=y===void 0?w:~~y,g<0?(g+=w,g<0&&(g=0)):g>w&&(g=w),y<0?(y+=w,y<0&&(y=0)):y>w&&(y=w),y<g&&(y=g);const M=this.subarray(g,y);return Object.setPrototypeOf(M,m.prototype),M};function Ee(b,g,y){if(b%1!==0||b<0)throw new RangeError("offset is not uint");if(b+g>y)throw new RangeError("Trying to access beyond buffer length")}m.prototype.readUintLE=m.prototype.readUIntLE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ee(g,y,this.length);let M=this[g],$=1,z=0;for(;++z<y&&($*=256);)M+=this[g+z]*$;return M},m.prototype.readUintBE=m.prototype.readUIntBE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ee(g,y,this.length);let M=this[g+--y],$=1;for(;y>0&&($*=256);)M+=this[g+--y]*$;return M},m.prototype.readUint8=m.prototype.readUInt8=function(g,y){return g=g>>>0,y||Ee(g,1,this.length),this[g]},m.prototype.readUint16LE=m.prototype.readUInt16LE=function(g,y){return g=g>>>0,y||Ee(g,2,this.length),this[g]|this[g+1]<<8},m.prototype.readUint16BE=m.prototype.readUInt16BE=function(g,y){return g=g>>>0,y||Ee(g,2,this.length),this[g]<<8|this[g+1]},m.prototype.readUint32LE=m.prototype.readUInt32LE=function(g,y){return g=g>>>0,y||Ee(g,4,this.length),(this[g]|this[g+1]<<8|this[g+2]<<16)+this[g+3]*16777216},m.prototype.readUint32BE=m.prototype.readUInt32BE=function(g,y){return g=g>>>0,y||Ee(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},m.prototype.readBigUInt64LE=St(function(g){g=g>>>0,Lt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Ai(g,this.length-8);const M=y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,$=this[++g]+this[++g]*2**8+this[++g]*2**16+w*2**24;return BigInt(M)+(BigInt($)<<BigInt(32))}),m.prototype.readBigUInt64BE=St(function(g){g=g>>>0,Lt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Ai(g,this.length-8);const M=y*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],$=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+w;return(BigInt(M)<<BigInt(32))+BigInt($)}),m.prototype.readIntLE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ee(g,y,this.length);let M=this[g],$=1,z=0;for(;++z<y&&($*=256);)M+=this[g+z]*$;return $*=128,M>=$&&(M-=Math.pow(2,8*y)),M},m.prototype.readIntBE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ee(g,y,this.length);let M=y,$=1,z=this[g+--M];for(;M>0&&($*=256);)z+=this[g+--M]*$;return $*=128,z>=$&&(z-=Math.pow(2,8*y)),z},m.prototype.readInt8=function(g,y){return g=g>>>0,y||Ee(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},m.prototype.readInt16LE=function(g,y){g=g>>>0,y||Ee(g,2,this.length);const w=this[g]|this[g+1]<<8;return w&32768?w|4294901760:w},m.prototype.readInt16BE=function(g,y){g=g>>>0,y||Ee(g,2,this.length);const w=this[g+1]|this[g]<<8;return w&32768?w|4294901760:w},m.prototype.readInt32LE=function(g,y){return g=g>>>0,y||Ee(g,4,this.length),this[g]|this[g+1]<<8|this[g+2]<<16|this[g+3]<<24},m.prototype.readInt32BE=function(g,y){return g=g>>>0,y||Ee(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},m.prototype.readBigInt64LE=St(function(g){g=g>>>0,Lt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Ai(g,this.length-8);const M=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(w<<24);return(BigInt(M)<<BigInt(32))+BigInt(y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),m.prototype.readBigInt64BE=St(function(g){g=g>>>0,Lt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Ai(g,this.length-8);const M=(y<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt(M)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+w)}),m.prototype.readFloatLE=function(g,y){return g=g>>>0,y||Ee(g,4,this.length),t.read(this,g,!0,23,4)},m.prototype.readFloatBE=function(g,y){return g=g>>>0,y||Ee(g,4,this.length),t.read(this,g,!1,23,4)},m.prototype.readDoubleLE=function(g,y){return g=g>>>0,y||Ee(g,8,this.length),t.read(this,g,!0,52,8)},m.prototype.readDoubleBE=function(g,y){return g=g>>>0,y||Ee(g,8,this.length),t.read(this,g,!1,52,8)};function ce(b,g,y,w,M,$){if(!m.isBuffer(b))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>M||g<$)throw new RangeError('"value" argument is out of bounds');if(y+w>b.length)throw new RangeError("Index out of range")}m.prototype.writeUintLE=m.prototype.writeUIntLE=function(g,y,w,M){if(g=+g,y=y>>>0,w=w>>>0,!M){const le=Math.pow(2,8*w)-1;ce(this,g,y,w,le,0)}let $=1,z=0;for(this[y]=g&255;++z<w&&($*=256);)this[y+z]=g/$&255;return y+w},m.prototype.writeUintBE=m.prototype.writeUIntBE=function(g,y,w,M){if(g=+g,y=y>>>0,w=w>>>0,!M){const le=Math.pow(2,8*w)-1;ce(this,g,y,w,le,0)}let $=w-1,z=1;for(this[y+$]=g&255;--$>=0&&(z*=256);)this[y+$]=g/z&255;return y+w},m.prototype.writeUint8=m.prototype.writeUInt8=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,1,255,0),this[y]=g&255,y+1},m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,2,65535,0),this[y]=g&255,this[y+1]=g>>>8,y+2},m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,2,65535,0),this[y]=g>>>8,this[y+1]=g&255,y+2},m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,4,4294967295,0),this[y+3]=g>>>24,this[y+2]=g>>>16,this[y+1]=g>>>8,this[y]=g&255,y+4},m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,4,4294967295,0),this[y]=g>>>24,this[y+1]=g>>>16,this[y+2]=g>>>8,this[y+3]=g&255,y+4};function Ue(b,g,y,w,M){Dt(g,w,M,b,y,7);let $=Number(g&BigInt(4294967295));b[y++]=$,$=$>>8,b[y++]=$,$=$>>8,b[y++]=$,$=$>>8,b[y++]=$;let z=Number(g>>BigInt(32)&BigInt(4294967295));return b[y++]=z,z=z>>8,b[y++]=z,z=z>>8,b[y++]=z,z=z>>8,b[y++]=z,y}function zi(b,g,y,w,M){Dt(g,w,M,b,y,7);let $=Number(g&BigInt(4294967295));b[y+7]=$,$=$>>8,b[y+6]=$,$=$>>8,b[y+5]=$,$=$>>8,b[y+4]=$;let z=Number(g>>BigInt(32)&BigInt(4294967295));return b[y+3]=z,z=z>>8,b[y+2]=z,z=z>>8,b[y+1]=z,z=z>>8,b[y]=z,y+8}m.prototype.writeBigUInt64LE=St(function(g,y=0){return Ue(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeBigUInt64BE=St(function(g,y=0){return zi(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),m.prototype.writeIntLE=function(g,y,w,M){if(g=+g,y=y>>>0,!M){const Pe=Math.pow(2,8*w-1);ce(this,g,y,w,Pe-1,-Pe)}let $=0,z=1,le=0;for(this[y]=g&255;++$<w&&(z*=256);)g<0&&le===0&&this[y+$-1]!==0&&(le=1),this[y+$]=(g/z>>0)-le&255;return y+w},m.prototype.writeIntBE=function(g,y,w,M){if(g=+g,y=y>>>0,!M){const Pe=Math.pow(2,8*w-1);ce(this,g,y,w,Pe-1,-Pe)}let $=w-1,z=1,le=0;for(this[y+$]=g&255;--$>=0&&(z*=256);)g<0&&le===0&&this[y+$+1]!==0&&(le=1),this[y+$]=(g/z>>0)-le&255;return y+w},m.prototype.writeInt8=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,1,127,-128),g<0&&(g=255+g+1),this[y]=g&255,y+1},m.prototype.writeInt16LE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,2,32767,-32768),this[y]=g&255,this[y+1]=g>>>8,y+2},m.prototype.writeInt16BE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,2,32767,-32768),this[y]=g>>>8,this[y+1]=g&255,y+2},m.prototype.writeInt32LE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,4,2147483647,-2147483648),this[y]=g&255,this[y+1]=g>>>8,this[y+2]=g>>>16,this[y+3]=g>>>24,y+4},m.prototype.writeInt32BE=function(g,y,w){return g=+g,y=y>>>0,w||ce(this,g,y,4,2147483647,-2147483648),g<0&&(g=4294967295+g+1),this[y]=g>>>24,this[y+1]=g>>>16,this[y+2]=g>>>8,this[y+3]=g&255,y+4},m.prototype.writeBigInt64LE=St(function(g,y=0){return Ue(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),m.prototype.writeBigInt64BE=St(function(g,y=0){return zi(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ui(b,g,y,w,M,$){if(y+w>b.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("Index out of range")}function ci(b,g,y,w,M){return g=+g,y=y>>>0,M||ui(b,g,y,4),t.write(b,g,y,w,23,4),y+4}m.prototype.writeFloatLE=function(g,y,w){return ci(this,g,y,!0,w)},m.prototype.writeFloatBE=function(g,y,w){return ci(this,g,y,!1,w)};function wi(b,g,y,w,M){return g=+g,y=y>>>0,M||ui(b,g,y,8),t.write(b,g,y,w,52,8),y+8}m.prototype.writeDoubleLE=function(g,y,w){return wi(this,g,y,!0,w)},m.prototype.writeDoubleBE=function(g,y,w){return wi(this,g,y,!1,w)},m.prototype.copy=function(g,y,w,M){if(!m.isBuffer(g))throw new TypeError("argument should be a Buffer");if(w||(w=0),!M&&M!==0&&(M=this.length),y>=g.length&&(y=g.length),y||(y=0),M>0&&M<w&&(M=w),M===w||g.length===0||this.length===0)return 0;if(y<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(M<0)throw new RangeError("sourceEnd out of bounds");M>this.length&&(M=this.length),g.length-y<M-w&&(M=g.length-y+w);const $=M-w;return this===g&&typeof r.prototype.copyWithin=="function"?this.copyWithin(y,w,M):r.prototype.set.call(g,this.subarray(w,M),y),$},m.prototype.fill=function(g,y,w,M){if(typeof g=="string"){if(typeof y=="string"?(M=y,y=0,w=this.length):typeof w=="string"&&(M=w,w=this.length),M!==void 0&&typeof M!="string")throw new TypeError("encoding must be a string");if(typeof M=="string"&&!m.isEncoding(M))throw new TypeError("Unknown encoding: "+M);if(g.length===1){const z=g.charCodeAt(0);(M==="utf8"&&z<128||M==="latin1")&&(g=z)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(y<0||this.length<y||this.length<w)throw new RangeError("Out of range index");if(w<=y)return this;y=y>>>0,w=w===void 0?this.length:w>>>0,g||(g=0);let $;if(typeof g=="number")for($=y;$<w;++$)this[$]=g;else{const z=m.isBuffer(g)?g:m.from(g,M),le=z.length;if(le===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for($=0;$<w-y;++$)this[$+y]=z[$%le]}return this};const mt={};function di(b,g,y){mt[b]=class extends y{constructor(){super(),Object.defineProperty(this,"message",{value:g.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${b}]`,this.stack,delete this.name}get code(){return b}set code(M){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:M,writable:!0})}toString(){return`${this.name} [${b}]: ${this.message}`}}}di("ERR_BUFFER_OUT_OF_BOUNDS",function(b){return b?`${b} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),di("ERR_INVALID_ARG_TYPE",function(b,g){return`The "${b}" argument must be of type number. Received type ${typeof g}`},TypeError),di("ERR_OUT_OF_RANGE",function(b,g,y){let w=`The value of "${b}" is out of range.`,M=y;return Number.isInteger(y)&&Math.abs(y)>2**32?M=Ft(String(y)):typeof y=="bigint"&&(M=String(y),(y>BigInt(2)**BigInt(32)||y<-(BigInt(2)**BigInt(32)))&&(M=Ft(M)),M+="n"),w+=` It must be ${g}. Received ${M}`,w},RangeError);function Ft(b){let g="",y=b.length;const w=b[0]==="-"?1:0;for(;y>=w+4;y-=3)g=`_${b.slice(y-3,y)}${g}`;return`${b.slice(0,y)}${g}`}function Ii(b,g,y){Lt(g,"offset"),(b[g]===void 0||b[g+y]===void 0)&&Ai(g,b.length-(y+1))}function Dt(b,g,y,w,M,$){if(b>y||b<g){const z=typeof g=="bigint"?"n":"";let le;throw g===0||g===BigInt(0)?le=`>= 0${z} and < 2${z} ** ${($+1)*8}${z}`:le=`>= -(2${z} ** ${($+1)*8-1}${z}) and < 2 ** ${($+1)*8-1}${z}`,new mt.ERR_OUT_OF_RANGE("value",le,b)}Ii(w,M,$)}function Lt(b,g){if(typeof b!="number")throw new mt.ERR_INVALID_ARG_TYPE(g,"number",b)}function Ai(b,g,y){throw Math.floor(b)!==b?(Lt(b,y),new mt.ERR_OUT_OF_RANGE("offset","an integer",b)):g<0?new mt.ERR_BUFFER_OUT_OF_BOUNDS:new mt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${g}`,b)}const $t=/[^+/0-9A-Za-z-_]/g;function Ds(b){if(b=b.split("=")[0],b=b.trim().replace($t,""),b.length<2)return"";for(;b.length%4!==0;)b=b+"=";return b}function pe(b,g){g=g||1/0;let y;const w=b.length;let M=null;const $=[];for(let z=0;z<w;++z){if(y=b.charCodeAt(z),y>55295&&y<57344){if(!M){if(y>56319){(g-=3)>-1&&$.push(239,191,189);continue}else if(z+1===w){(g-=3)>-1&&$.push(239,191,189);continue}M=y;continue}if(y<56320){(g-=3)>-1&&$.push(239,191,189),M=y;continue}y=(M-55296<<10|y-56320)+65536}else M&&(g-=3)>-1&&$.push(239,191,189);if(M=null,y<128){if((g-=1)<0)break;$.push(y)}else if(y<2048){if((g-=2)<0)break;$.push(y>>6|192,y&63|128)}else if(y<65536){if((g-=3)<0)break;$.push(y>>12|224,y>>6&63|128,y&63|128)}else if(y<1114112){if((g-=4)<0)break;$.push(y>>18|240,y>>12&63|128,y>>6&63|128,y&63|128)}else throw new Error("Invalid code point")}return $}function ra(b){const g=[];for(let y=0;y<b.length;++y)g.push(b.charCodeAt(y)&255);return g}function Ls(b,g){let y,w,M;const $=[];for(let z=0;z<b.length&&!((g-=2)<0);++z)y=b.charCodeAt(z),w=y>>8,M=y%256,$.push(M),$.push(w);return $}function In(b){return e.toByteArray(Ds(b))}function hi(b,g,y,w){let M;for(M=0;M<w&&!(M+y>=g.length||M>=b.length);++M)g[M+y]=b[M];return M}function lt(b,g){return b instanceof g||b!=null&&b.constructor!=null&&b.constructor.name!=null&&b.constructor.name===g.name}function ki(b){return b!==b}const Wi=function(){const b="0123456789abcdef",g=new Array(256);for(let y=0;y<16;++y){const w=y*16;for(let M=0;M<16;++M)g[w+M]=b[y]+b[M]}return g}();function St(b){return typeof BigInt>"u"?An:b}function An(){throw new Error("BigInt not supported")}})(sd);const Ny=sd.Buffer;var Uy=function(e){return k.atob?k.atob(e):Ny.from(e,"base64").toString("binary")};function rd(s){for(var e=Uy(s),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class By extends Io{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
21
|
+
*/(function(i){const e=Pa,t=Ll,r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;i.Buffer=p,i.SlowBuffer=R,i.INSPECT_MAX_BYTES=50;const s=2147483647;i.kMaxLength=s;const{Uint8Array:n,ArrayBuffer:a,SharedArrayBuffer:l}=globalThis;p.TYPED_ARRAY_SUPPORT=u(),!p.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 u(){try{const x=new n(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,n.prototype),Object.setPrototypeOf(x,g),x.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}}),Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function f(x){if(x>s)throw new RangeError('The value "'+x+'" is invalid for option "size"');const g=new n(x);return Object.setPrototypeOf(g,p.prototype),g}function p(x,g,y){if(typeof x=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return A(x)}return T(x,g,y)}p.poolSize=8192;function T(x,g,y){if(typeof x=="string")return v(x,g);if(a.isView(x))return P(x);if(x==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x);if(pt(x,a)||x&&pt(x.buffer,a)||typeof l<"u"&&(pt(x,l)||x&&pt(x.buffer,l)))return M(x,g,y);if(typeof x=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const w=x.valueOf&&x.valueOf();if(w!=null&&w!==x)return p.from(w,g,y);const B=O(x);if(B)return B;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof x[Symbol.toPrimitive]=="function")return p.from(x[Symbol.toPrimitive]("string"),g,y);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof x)}p.from=function(x,g,y){return T(x,g,y)},Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n);function b(x){if(typeof x!="number")throw new TypeError('"size" argument must be of type number');if(x<0)throw new RangeError('The value "'+x+'" is invalid for option "size"')}function S(x,g,y){return b(x),x<=0?f(x):g!==void 0?typeof y=="string"?f(x).fill(g,y):f(x).fill(g):f(x)}p.alloc=function(x,g,y){return S(x,g,y)};function A(x){return b(x),f(x<0?0:U(x)|0)}p.allocUnsafe=function(x){return A(x)},p.allocUnsafeSlow=function(x){return A(x)};function v(x,g){if((typeof g!="string"||g==="")&&(g="utf8"),!p.isEncoding(g))throw new TypeError("Unknown encoding: "+g);const y=q(x,g)|0;let w=f(y);const B=w.write(x,g);return B!==y&&(w=w.slice(0,B)),w}function L(x){const g=x.length<0?0:U(x.length)|0,y=f(g);for(let w=0;w<g;w+=1)y[w]=x[w]&255;return y}function P(x){if(pt(x,n)){const g=new n(x);return M(g.buffer,g.byteOffset,g.byteLength)}return L(x)}function M(x,g,y){if(g<0||x.byteLength<g)throw new RangeError('"offset" is outside of buffer bounds');if(x.byteLength<g+(y||0))throw new RangeError('"length" is outside of buffer bounds');let w;return g===void 0&&y===void 0?w=new n(x):y===void 0?w=new n(x,g):w=new n(x,g,y),Object.setPrototypeOf(w,p.prototype),w}function O(x){if(p.isBuffer(x)){const g=U(x.length)|0,y=f(g);return y.length===0||x.copy(y,0,0,g),y}if(x.length!==void 0)return typeof x.length!="number"||Ki(x.length)?f(0):L(x);if(x.type==="Buffer"&&Array.isArray(x.data))return L(x.data)}function U(x){if(x>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return x|0}function R(x){return+x!=x&&(x=0),p.alloc(+x)}p.isBuffer=function(g){return g!=null&&g._isBuffer===!0&&g!==p.prototype},p.compare=function(g,y){if(pt(g,n)&&(g=p.from(g,g.offset,g.byteLength)),pt(y,n)&&(y=p.from(y,y.offset,y.byteLength)),!p.isBuffer(g)||!p.isBuffer(y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(g===y)return 0;let w=g.length,B=y.length;for(let $=0,W=Math.min(w,B);$<W;++$)if(g[$]!==y[$]){w=g[$],B=y[$];break}return w<B?-1:B<w?1:0},p.isEncoding=function(g){switch(String(g).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}},p.concat=function(g,y){if(!Array.isArray(g))throw new TypeError('"list" argument must be an Array of Buffers');if(g.length===0)return p.alloc(0);let w;if(y===void 0)for(y=0,w=0;w<g.length;++w)y+=g[w].length;const B=p.allocUnsafe(y);let $=0;for(w=0;w<g.length;++w){let W=g[w];if(pt(W,n))$+W.length>B.length?(p.isBuffer(W)||(W=p.from(W)),W.copy(B,$)):n.prototype.set.call(B,W,$);else if(p.isBuffer(W))W.copy(B,$);else throw new TypeError('"list" argument must be an Array of Buffers');$+=W.length}return B};function q(x,g){if(p.isBuffer(x))return x.length;if(a.isView(x)||pt(x,a))return x.byteLength;if(typeof x!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof x);const y=x.length,w=arguments.length>2&&arguments[2]===!0;if(!w&&y===0)return 0;let B=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return y;case"utf8":case"utf-8":return ye(x).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y*2;case"hex":return y>>>1;case"base64":return fn(x).length;default:if(B)return w?-1:ye(x).length;g=(""+g).toLowerCase(),B=!0}}p.byteLength=q;function Y(x,g,y){let w=!1;if((g===void 0||g<0)&&(g=0),g>this.length||((y===void 0||y>this.length)&&(y=this.length),y<=0)||(y>>>=0,g>>>=0,y<=g))return"";for(x||(x="utf8");;)switch(x){case"hex":return St(this,g,y);case"utf8":case"utf-8":return ve(this,g,y);case"ascii":return Ce(this,g,y);case"latin1":case"binary":return _e(this,g,y);case"base64":return de(this,g,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Pt(this,g,y);default:if(w)throw new TypeError("Unknown encoding: "+x);x=(x+"").toLowerCase(),w=!0}}p.prototype._isBuffer=!0;function K(x,g,y){const w=x[g];x[g]=x[y],x[y]=w}p.prototype.swap16=function(){const g=this.length;if(g%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let y=0;y<g;y+=2)K(this,y,y+1);return this},p.prototype.swap32=function(){const g=this.length;if(g%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let y=0;y<g;y+=4)K(this,y,y+3),K(this,y+1,y+2);return this},p.prototype.swap64=function(){const g=this.length;if(g%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let y=0;y<g;y+=8)K(this,y,y+7),K(this,y+1,y+6),K(this,y+2,y+5),K(this,y+3,y+4);return this},p.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?ve(this,0,g):Y.apply(this,arguments)},p.prototype.toLocaleString=p.prototype.toString,p.prototype.equals=function(g){if(!p.isBuffer(g))throw new TypeError("Argument must be a Buffer");return this===g?!0:p.compare(this,g)===0},p.prototype.inspect=function(){let g="";const y=i.INSPECT_MAX_BYTES;return g=this.toString("hex",0,y).replace(/(.{2})/g,"$1 ").trim(),this.length>y&&(g+=" ... "),"<Buffer "+g+">"},r&&(p.prototype[r]=p.prototype.inspect),p.prototype.compare=function(g,y,w,B,$){if(pt(g,n)&&(g=p.from(g,g.offset,g.byteLength)),!p.isBuffer(g))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof g);if(y===void 0&&(y=0),w===void 0&&(w=g?g.length:0),B===void 0&&(B=0),$===void 0&&($=this.length),y<0||w>g.length||B<0||$>this.length)throw new RangeError("out of range index");if(B>=$&&y>=w)return 0;if(B>=$)return-1;if(y>=w)return 1;if(y>>>=0,w>>>=0,B>>>=0,$>>>=0,this===g)return 0;let W=$-B,he=w-y;const Ne=Math.min(W,he),ke=this.slice(B,$),Be=g.slice(y,w);for(let be=0;be<Ne;++be)if(ke[be]!==Be[be]){W=ke[be],he=Be[be];break}return W<he?-1:he<W?1:0};function ie(x,g,y,w,B){if(x.length===0)return-1;if(typeof y=="string"?(w=y,y=0):y>2147483647?y=2147483647:y<-2147483648&&(y=-2147483648),y=+y,Ki(y)&&(y=B?0:x.length-1),y<0&&(y=x.length+y),y>=x.length){if(B)return-1;y=x.length-1}else if(y<0)if(B)y=0;else return-1;if(typeof g=="string"&&(g=p.from(g,w)),p.isBuffer(g))return g.length===0?-1:me(x,g,y,w,B);if(typeof g=="number")return g=g&255,typeof n.prototype.indexOf=="function"?B?n.prototype.indexOf.call(x,g,y):n.prototype.lastIndexOf.call(x,g,y):me(x,[g],y,w,B);throw new TypeError("val must be string, number or Buffer")}function me(x,g,y,w,B){let $=1,W=x.length,he=g.length;if(w!==void 0&&(w=String(w).toLowerCase(),w==="ucs2"||w==="ucs-2"||w==="utf16le"||w==="utf-16le")){if(x.length<2||g.length<2)return-1;$=2,W/=2,he/=2,y/=2}function Ne(Be,be){return $===1?Be[be]:Be.readUInt16BE(be*$)}let ke;if(B){let Be=-1;for(ke=y;ke<W;ke++)if(Ne(x,ke)===Ne(g,Be===-1?0:ke-Be)){if(Be===-1&&(Be=ke),ke-Be+1===he)return Be*$}else Be!==-1&&(ke-=ke-Be),Be=-1}else for(y+he>W&&(y=W-he),ke=y;ke>=0;ke--){let Be=!0;for(let be=0;be<he;be++)if(Ne(x,ke+be)!==Ne(g,be)){Be=!1;break}if(Be)return ke}return-1}p.prototype.includes=function(g,y,w){return this.indexOf(g,y,w)!==-1},p.prototype.indexOf=function(g,y,w){return ie(this,g,y,w,!0)},p.prototype.lastIndexOf=function(g,y,w){return ie(this,g,y,w,!1)};function le(x,g,y,w){y=Number(y)||0;const B=x.length-y;w?(w=Number(w),w>B&&(w=B)):w=B;const $=g.length;w>$/2&&(w=$/2);let W;for(W=0;W<w;++W){const he=parseInt(g.substr(W*2,2),16);if(Ki(he))return W;x[y+W]=he}return W}function ge(x,g,y,w){return Ii(ye(g,x.length-y),x,y,w)}function ee(x,g,y,w){return Ii(to(g),x,y,w)}function ce(x,g,y,w){return Ii(fn(g),x,y,w)}function te(x,g,y,w){return Ii(as(g,x.length-y),x,y,w)}p.prototype.write=function(g,y,w,B){if(y===void 0)B="utf8",w=this.length,y=0;else if(w===void 0&&typeof y=="string")B=y,w=this.length,y=0;else if(isFinite(y))y=y>>>0,isFinite(w)?(w=w>>>0,B===void 0&&(B="utf8")):(B=w,w=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const $=this.length-y;if((w===void 0||w>$)&&(w=$),g.length>0&&(w<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");B||(B="utf8");let W=!1;for(;;)switch(B){case"hex":return le(this,g,y,w);case"utf8":case"utf-8":return ge(this,g,y,w);case"ascii":case"latin1":case"binary":return ee(this,g,y,w);case"base64":return ce(this,g,y,w);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return te(this,g,y,w);default:if(W)throw new TypeError("Unknown encoding: "+B);B=(""+B).toLowerCase(),W=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function de(x,g,y){return g===0&&y===x.length?e.fromByteArray(x):e.fromByteArray(x.slice(g,y))}function ve(x,g,y){y=Math.min(x.length,y);const w=[];let B=g;for(;B<y;){const $=x[B];let W=null,he=$>239?4:$>223?3:$>191?2:1;if(B+he<=y){let Ne,ke,Be,be;switch(he){case 1:$<128&&(W=$);break;case 2:Ne=x[B+1],(Ne&192)===128&&(be=($&31)<<6|Ne&63,be>127&&(W=be));break;case 3:Ne=x[B+1],ke=x[B+2],(Ne&192)===128&&(ke&192)===128&&(be=($&15)<<12|(Ne&63)<<6|ke&63,be>2047&&(be<55296||be>57343)&&(W=be));break;case 4:Ne=x[B+1],ke=x[B+2],Be=x[B+3],(Ne&192)===128&&(ke&192)===128&&(Be&192)===128&&(be=($&15)<<18|(Ne&63)<<12|(ke&63)<<6|Be&63,be>65535&&be<1114112&&(W=be))}}W===null?(W=65533,he=1):W>65535&&(W-=65536,w.push(W>>>10&1023|55296),W=56320|W&1023),w.push(W),B+=he}return Ye(w)}const Ve=4096;function Ye(x){const g=x.length;if(g<=Ve)return String.fromCharCode.apply(String,x);let y="",w=0;for(;w<g;)y+=String.fromCharCode.apply(String,x.slice(w,w+=Ve));return y}function Ce(x,g,y){let w="";y=Math.min(x.length,y);for(let B=g;B<y;++B)w+=String.fromCharCode(x[B]&127);return w}function _e(x,g,y){let w="";y=Math.min(x.length,y);for(let B=g;B<y;++B)w+=String.fromCharCode(x[B]);return w}function St(x,g,y){const w=x.length;(!g||g<0)&&(g=0),(!y||y<0||y>w)&&(y=w);let B="";for(let $=g;$<y;++$)B+=hr[x[$]];return B}function Pt(x,g,y){const w=x.slice(g,y);let B="";for(let $=0;$<w.length-1;$+=2)B+=String.fromCharCode(w[$]+w[$+1]*256);return B}p.prototype.slice=function(g,y){const w=this.length;g=~~g,y=y===void 0?w:~~y,g<0?(g+=w,g<0&&(g=0)):g>w&&(g=w),y<0?(y+=w,y<0&&(y=0)):y>w&&(y=w),y<g&&(y=g);const B=this.subarray(g,y);return Object.setPrototypeOf(B,p.prototype),B};function Ie(x,g,y){if(x%1!==0||x<0)throw new RangeError("offset is not uint");if(x+g>y)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ie(g,y,this.length);let B=this[g],$=1,W=0;for(;++W<y&&($*=256);)B+=this[g+W]*$;return B},p.prototype.readUintBE=p.prototype.readUIntBE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ie(g,y,this.length);let B=this[g+--y],$=1;for(;y>0&&($*=256);)B+=this[g+--y]*$;return B},p.prototype.readUint8=p.prototype.readUInt8=function(g,y){return g=g>>>0,y||Ie(g,1,this.length),this[g]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(g,y){return g=g>>>0,y||Ie(g,2,this.length),this[g]|this[g+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(g,y){return g=g>>>0,y||Ie(g,2,this.length),this[g]<<8|this[g+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(g,y){return g=g>>>0,y||Ie(g,4,this.length),(this[g]|this[g+1]<<8|this[g+2]<<16)+this[g+3]*16777216},p.prototype.readUint32BE=p.prototype.readUInt32BE=function(g,y){return g=g>>>0,y||Ie(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},p.prototype.readBigUInt64LE=Lt(function(g){g=g>>>0,Vt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Gi(g,this.length-8);const B=y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,$=this[++g]+this[++g]*2**8+this[++g]*2**16+w*2**24;return BigInt(B)+(BigInt($)<<BigInt(32))}),p.prototype.readBigUInt64BE=Lt(function(g){g=g>>>0,Vt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Gi(g,this.length-8);const B=y*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],$=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+w;return(BigInt(B)<<BigInt(32))+BigInt($)}),p.prototype.readIntLE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ie(g,y,this.length);let B=this[g],$=1,W=0;for(;++W<y&&($*=256);)B+=this[g+W]*$;return $*=128,B>=$&&(B-=Math.pow(2,8*y)),B},p.prototype.readIntBE=function(g,y,w){g=g>>>0,y=y>>>0,w||Ie(g,y,this.length);let B=y,$=1,W=this[g+--B];for(;B>0&&($*=256);)W+=this[g+--B]*$;return $*=128,W>=$&&(W-=Math.pow(2,8*y)),W},p.prototype.readInt8=function(g,y){return g=g>>>0,y||Ie(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},p.prototype.readInt16LE=function(g,y){g=g>>>0,y||Ie(g,2,this.length);const w=this[g]|this[g+1]<<8;return w&32768?w|4294901760:w},p.prototype.readInt16BE=function(g,y){g=g>>>0,y||Ie(g,2,this.length);const w=this[g+1]|this[g]<<8;return w&32768?w|4294901760:w},p.prototype.readInt32LE=function(g,y){return g=g>>>0,y||Ie(g,4,this.length),this[g]|this[g+1]<<8|this[g+2]<<16|this[g+3]<<24},p.prototype.readInt32BE=function(g,y){return g=g>>>0,y||Ie(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},p.prototype.readBigInt64LE=Lt(function(g){g=g>>>0,Vt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Gi(g,this.length-8);const B=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(w<<24);return(BigInt(B)<<BigInt(32))+BigInt(y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),p.prototype.readBigInt64BE=Lt(function(g){g=g>>>0,Vt(g,"offset");const y=this[g],w=this[g+7];(y===void 0||w===void 0)&&Gi(g,this.length-8);const B=(y<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt(B)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+w)}),p.prototype.readFloatLE=function(g,y){return g=g>>>0,y||Ie(g,4,this.length),t.read(this,g,!0,23,4)},p.prototype.readFloatBE=function(g,y){return g=g>>>0,y||Ie(g,4,this.length),t.read(this,g,!1,23,4)},p.prototype.readDoubleLE=function(g,y){return g=g>>>0,y||Ie(g,8,this.length),t.read(this,g,!0,52,8)},p.prototype.readDoubleBE=function(g,y){return g=g>>>0,y||Ie(g,8,this.length),t.read(this,g,!1,52,8)};function pe(x,g,y,w,B,$){if(!p.isBuffer(x))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>B||g<$)throw new RangeError('"value" argument is out of bounds');if(y+w>x.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(g,y,w,B){if(g=+g,y=y>>>0,w=w>>>0,!B){const he=Math.pow(2,8*w)-1;pe(this,g,y,w,he,0)}let $=1,W=0;for(this[y]=g&255;++W<w&&($*=256);)this[y+W]=g/$&255;return y+w},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(g,y,w,B){if(g=+g,y=y>>>0,w=w>>>0,!B){const he=Math.pow(2,8*w)-1;pe(this,g,y,w,he,0)}let $=w-1,W=1;for(this[y+$]=g&255;--$>=0&&(W*=256);)this[y+$]=g/W&255;return y+w},p.prototype.writeUint8=p.prototype.writeUInt8=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,1,255,0),this[y]=g&255,y+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,2,65535,0),this[y]=g&255,this[y+1]=g>>>8,y+2},p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,2,65535,0),this[y]=g>>>8,this[y+1]=g&255,y+2},p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,4,4294967295,0),this[y+3]=g>>>24,this[y+2]=g>>>16,this[y+1]=g>>>8,this[y]=g&255,y+4},p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,4,4294967295,0),this[y]=g>>>24,this[y+1]=g>>>16,this[y+2]=g>>>8,this[y+3]=g&255,y+4};function qe(x,g,y,w,B){jt(g,w,B,x,y,7);let $=Number(g&BigInt(4294967295));x[y++]=$,$=$>>8,x[y++]=$,$=$>>8,x[y++]=$,$=$>>8,x[y++]=$;let W=Number(g>>BigInt(32)&BigInt(4294967295));return x[y++]=W,W=W>>8,x[y++]=W,W=W>>8,x[y++]=W,W=W>>8,x[y++]=W,y}function dr(x,g,y,w,B){jt(g,w,B,x,y,7);let $=Number(g&BigInt(4294967295));x[y+7]=$,$=$>>8,x[y+6]=$,$=$>>8,x[y+5]=$,$=$>>8,x[y+4]=$;let W=Number(g>>BigInt(32)&BigInt(4294967295));return x[y+3]=W,W=W>>8,x[y+2]=W,W=W>>8,x[y+1]=W,W=W>>8,x[y]=W,y+8}p.prototype.writeBigUInt64LE=Lt(function(g,y=0){return qe(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=Lt(function(g,y=0){return dr(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(g,y,w,B){if(g=+g,y=y>>>0,!B){const Ne=Math.pow(2,8*w-1);pe(this,g,y,w,Ne-1,-Ne)}let $=0,W=1,he=0;for(this[y]=g&255;++$<w&&(W*=256);)g<0&&he===0&&this[y+$-1]!==0&&(he=1),this[y+$]=(g/W>>0)-he&255;return y+w},p.prototype.writeIntBE=function(g,y,w,B){if(g=+g,y=y>>>0,!B){const Ne=Math.pow(2,8*w-1);pe(this,g,y,w,Ne-1,-Ne)}let $=w-1,W=1,he=0;for(this[y+$]=g&255;--$>=0&&(W*=256);)g<0&&he===0&&this[y+$+1]!==0&&(he=1),this[y+$]=(g/W>>0)-he&255;return y+w},p.prototype.writeInt8=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,1,127,-128),g<0&&(g=255+g+1),this[y]=g&255,y+1},p.prototype.writeInt16LE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,2,32767,-32768),this[y]=g&255,this[y+1]=g>>>8,y+2},p.prototype.writeInt16BE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,2,32767,-32768),this[y]=g>>>8,this[y+1]=g&255,y+2},p.prototype.writeInt32LE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,4,2147483647,-2147483648),this[y]=g&255,this[y+1]=g>>>8,this[y+2]=g>>>16,this[y+3]=g>>>24,y+4},p.prototype.writeInt32BE=function(g,y,w){return g=+g,y=y>>>0,w||pe(this,g,y,4,2147483647,-2147483648),g<0&&(g=4294967295+g+1),this[y]=g>>>24,this[y+1]=g>>>16,this[y+2]=g>>>8,this[y+3]=g&255,y+4},p.prototype.writeBigInt64LE=Lt(function(g,y=0){return qe(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=Lt(function(g,y=0){return dr(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ai(x,g,y,w,B,$){if(y+w>x.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("Index out of range")}function wi(x,g,y,w,B){return g=+g,y=y>>>0,B||Ai(x,g,y,4),t.write(x,g,y,w,23,4),y+4}p.prototype.writeFloatLE=function(g,y,w){return wi(this,g,y,!0,w)},p.prototype.writeFloatBE=function(g,y,w){return wi(this,g,y,!1,w)};function zi(x,g,y,w,B){return g=+g,y=y>>>0,B||Ai(x,g,y,8),t.write(x,g,y,w,52,8),y+8}p.prototype.writeDoubleLE=function(g,y,w){return zi(this,g,y,!0,w)},p.prototype.writeDoubleBE=function(g,y,w){return zi(this,g,y,!1,w)},p.prototype.copy=function(g,y,w,B){if(!p.isBuffer(g))throw new TypeError("argument should be a Buffer");if(w||(w=0),!B&&B!==0&&(B=this.length),y>=g.length&&(y=g.length),y||(y=0),B>0&&B<w&&(B=w),B===w||g.length===0||this.length===0)return 0;if(y<0)throw new RangeError("targetStart out of bounds");if(w<0||w>=this.length)throw new RangeError("Index out of range");if(B<0)throw new RangeError("sourceEnd out of bounds");B>this.length&&(B=this.length),g.length-y<B-w&&(B=g.length-y+w);const $=B-w;return this===g&&typeof n.prototype.copyWithin=="function"?this.copyWithin(y,w,B):n.prototype.set.call(g,this.subarray(w,B),y),$},p.prototype.fill=function(g,y,w,B){if(typeof g=="string"){if(typeof y=="string"?(B=y,y=0,w=this.length):typeof w=="string"&&(B=w,w=this.length),B!==void 0&&typeof B!="string")throw new TypeError("encoding must be a string");if(typeof B=="string"&&!p.isEncoding(B))throw new TypeError("Unknown encoding: "+B);if(g.length===1){const W=g.charCodeAt(0);(B==="utf8"&&W<128||B==="latin1")&&(g=W)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(y<0||this.length<y||this.length<w)throw new RangeError("Out of range index");if(w<=y)return this;y=y>>>0,w=w===void 0?this.length:w>>>0,g||(g=0);let $;if(typeof g=="number")for($=y;$<w;++$)this[$]=g;else{const W=p.isBuffer(g)?g:p.from(g,B),he=W.length;if(he===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for($=0;$<w-y;++$)this[$+y]=W[$%he]}return this};const Et={};function Di(x,g,y){Et[x]=class extends y{constructor(){super(),Object.defineProperty(this,"message",{value:g.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${x}]`,this.stack,delete this.name}get code(){return x}set code(B){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:B,writable:!0})}toString(){return`${this.name} [${x}]: ${this.message}`}}}Di("ERR_BUFFER_OUT_OF_BOUNDS",function(x){return x?`${x} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Di("ERR_INVALID_ARG_TYPE",function(x,g){return`The "${x}" argument must be of type number. Received type ${typeof g}`},TypeError),Di("ERR_OUT_OF_RANGE",function(x,g,y){let w=`The value of "${x}" is out of range.`,B=y;return Number.isInteger(y)&&Math.abs(y)>2**32?B=Xt(String(y)):typeof y=="bigint"&&(B=String(y),(y>BigInt(2)**BigInt(32)||y<-(BigInt(2)**BigInt(32)))&&(B=Xt(B)),B+="n"),w+=` It must be ${g}. Received ${B}`,w},RangeError);function Xt(x){let g="",y=x.length;const w=x[0]==="-"?1:0;for(;y>=w+4;y-=3)g=`_${x.slice(y-3,y)}${g}`;return`${x.slice(0,y)}${g}`}function Wi(x,g,y){Vt(g,"offset"),(x[g]===void 0||x[g+y]===void 0)&&Gi(g,x.length-(y+1))}function jt(x,g,y,w,B,$){if(x>y||x<g){const W=typeof g=="bigint"?"n":"";let he;throw g===0||g===BigInt(0)?he=`>= 0${W} and < 2${W} ** ${($+1)*8}${W}`:he=`>= -(2${W} ** ${($+1)*8-1}${W}) and < 2 ** ${($+1)*8-1}${W}`,new Et.ERR_OUT_OF_RANGE("value",he,x)}Wi(w,B,$)}function Vt(x,g){if(typeof x!="number")throw new Et.ERR_INVALID_ARG_TYPE(g,"number",x)}function Gi(x,g,y){throw Math.floor(x)!==x?(Vt(x,y),new Et.ERR_OUT_OF_RANGE("offset","an integer",x)):g<0?new Et.ERR_BUFFER_OUT_OF_BOUNDS:new Et.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${g}`,x)}const Yt=/[^+/0-9A-Za-z-_]/g;function ns(x){if(x=x.split("=")[0],x=x.trim().replace(Yt,""),x.length<2)return"";for(;x.length%4!==0;)x=x+"=";return x}function ye(x,g){g=g||1/0;let y;const w=x.length;let B=null;const $=[];for(let W=0;W<w;++W){if(y=x.charCodeAt(W),y>55295&&y<57344){if(!B){if(y>56319){(g-=3)>-1&&$.push(239,191,189);continue}else if(W+1===w){(g-=3)>-1&&$.push(239,191,189);continue}B=y;continue}if(y<56320){(g-=3)>-1&&$.push(239,191,189),B=y;continue}y=(B-55296<<10|y-56320)+65536}else B&&(g-=3)>-1&&$.push(239,191,189);if(B=null,y<128){if((g-=1)<0)break;$.push(y)}else if(y<2048){if((g-=2)<0)break;$.push(y>>6|192,y&63|128)}else if(y<65536){if((g-=3)<0)break;$.push(y>>12|224,y>>6&63|128,y&63|128)}else if(y<1114112){if((g-=4)<0)break;$.push(y>>18|240,y>>12&63|128,y>>6&63|128,y&63|128)}else throw new Error("Invalid code point")}return $}function to(x){const g=[];for(let y=0;y<x.length;++y)g.push(x.charCodeAt(y)&255);return g}function as(x,g){let y,w,B;const $=[];for(let W=0;W<x.length&&!((g-=2)<0);++W)y=x.charCodeAt(W),w=y>>8,B=y%256,$.push(B),$.push(w);return $}function fn(x){return e.toByteArray(ns(x))}function Ii(x,g,y,w){let B;for(B=0;B<w&&!(B+y>=g.length||B>=x.length);++B)g[B+y]=x[B];return B}function pt(x,g){return x instanceof g||x!=null&&x.constructor!=null&&x.constructor.name!=null&&x.constructor.name===g.name}function Ki(x){return x!==x}const hr=function(){const x="0123456789abcdef",g=new Array(256);for(let y=0;y<16;++y){const w=y*16;for(let B=0;B<16;++B)g[w+B]=x[y]+x[B]}return g}();function Lt(x){return typeof BigInt>"u"?pn:x}function pn(){throw new Error("BigInt not supported")}})(Yh);const bv=Yh.Buffer;var xv=function(e){return k.atob?k.atob(e):bv.from(e,"base64").toString("binary")};function Jh(i){for(var e=xv(i),t=new Uint8Array(e.length),r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}/*! @name m3u8-parser @version 7.2.0 @license Apache-2.0 */class Sv extends Pl{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 Fy=" ",Pa=function(s){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(s||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},$y=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},st=function(s){const e={};if(!s)return e;const t=s.split($y());let i=t.length,n;for(;i--;)t[i]!==""&&(n=/([^=]*)=(.*)/.exec(t[i]).slice(1),n[0]=n[0].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^\s+|\s+$/g,""),n[1]=n[1].replace(/^['"](.*)['"]$/g,"$1"),e[n[0]]=n[1]);return e},Tu=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 jy extends Io{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((r,a)=>{const l=a(e);return l===e?r:r.concat([l])},[e]).forEach(r=>{for(let a=0;a<this.customParsers.length;a++)if(this.customParsers[a].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){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(r),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(r),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(r),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(r),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(r),t){i=je(Pa(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(r),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(r),t){if(i={type:"tag",tagType:"map"},t[1]){const a=st(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=Pa(a.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(r),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=st(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=Tu(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(r),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=st(t[1])),this.trigger("data",i);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){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(r),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=st(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(r),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=st(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(r),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(r),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(r),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=st(t[1]),i.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(i.attributes["SKIPPED-SEGMENTS"]=parseInt(i.attributes["SKIPPED-SEGMENTS"],10)),i.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(i.attributes["RECENTLY-REMOVED-DATERANGES"]=i.attributes["RECENTLY-REMOVED-DATERANGES"].split(Fy)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=st(t[1]),["DURATION"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["INDEPENDENT","GAP"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),i.attributes.hasOwnProperty("BYTERANGE")&&(i.attributes.byterange=Pa(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=st(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=st(t[1]),["PART-TARGET"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=st(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(i.attributes.hasOwnProperty(a)){i.attributes[a]=parseInt(i.attributes[a],10);const l=a==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[l]=i.attributes[a],delete i.attributes[a]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=st(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseInt(i.attributes[a],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(r),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=st(t[1]),["ID","CLASS"].forEach(function(l){i.attributes.hasOwnProperty(l)&&(i.attributes[l]=String(i.attributes[l]))}),["START-DATE","END-DATE"].forEach(function(l){i.attributes.hasOwnProperty(l)&&(i.attributes[l]=new Date(i.attributes[l]))}),["DURATION","PLANNED-DURATION"].forEach(function(l){i.attributes.hasOwnProperty(l)&&(i.attributes[l]=parseFloat(i.attributes[l]))}),["END-ON-NEXT"].forEach(function(l){i.attributes.hasOwnProperty(l)&&(i.attributes[l]=/YES/i.test(i.attributes[l]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(l){i.attributes.hasOwnProperty(l)&&(i.attributes[l]=i.attributes[l].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const l in i.attributes){if(!a.test(l))continue;const h=/[0-9A-Fa-f]{6}/g.test(i.attributes[l]),f=/^\d+(\.\d+)?$/.test(i.attributes[l]);i.attributes[l]=h?i.attributes[l].toString(16):f?parseFloat(i.attributes[l]):String(i.attributes[l])}this.trigger("data",i);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){i={type:"tag",tagType:"content-steering"},i.attributes=st(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(r),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=st(t[1]),i.attributes.URI&&(i.uri=i.attributes.URI),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=Tu(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(r),t){i={type:"tag",tagType:"define"},i.attributes=st(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:r.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:n}){typeof i!="function"&&(i=r=>r),this.customParsers.push(r=>{if(e.exec(r))return this.trigger("data",{type:"custom",data:i(r),customType:t,segment:n}),!0})}addTagMapper({expression:e,map:t}){const i=n=>e.test(n)?t(n):n;this.tagMappers.push(i)}}const Vy=s=>s.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),yi=function(s){const e={};return Object.keys(s).forEach(function(t){e[Vy(t)]=s[t]}),e},Da=function(s){const{serverControl:e,targetDuration:t,partTargetDuration:i}=s;if(!e)return;const n="#EXT-X-SERVER-CONTROL",r="holdBack",a="partHoldBack",l=t&&t*3,h=i&&i*2;t&&!e.hasOwnProperty(r)&&(e[r]=l,this.trigger("info",{message:`${n} defaulting HOLD-BACK to targetDuration * 3 (${l}).`})),l&&e[r]<l&&(this.trigger("warn",{message:`${n} clamping HOLD-BACK (${e[r]}) to targetDuration * 3 (${l})`}),e[r]=l),i&&!e.hasOwnProperty(a)&&(e[a]=i*3,this.trigger("info",{message:`${n} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),i&&e[a]<h&&(this.trigger("warn",{message:`${n} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${h}).`}),e[a]=h)};class Hy extends Io{constructor(e={}){super(),this.lineStream=new By,this.parseStream=new jy,this.lineStream.pipe(this.parseStream),this.mainDefinitions=e.mainDefinitions||{},this.params=new URL(e.uri,"https://a.com").searchParams,this.lastProgramDateTime=null;const t=this,i=[];let n={},r,a,l=!1;const h=function(){},f={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},m="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let T=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let E=0,C=0;const P={};this.on("end",()=>{n.uri||!n.parts&&!n.preloadHints||(!n.map&&r&&(n.map=r),!n.key&&a&&(n.key=a),!n.timeline&&typeof T=="number"&&(n.timeline=T),this.manifest.preloadSegment=n)}),this.parseStream.on("data",function(v){let R,L;if(t.manifest.definitions){for(const N in t.manifest.definitions)if(v.uri&&(v.uri=v.uri.replace(`{$${N}}`,t.manifest.definitions[N])),v.attributes)for(const U in v.attributes)typeof v.attributes[U]=="string"&&(v.attributes[U]=v.attributes[U].replace(`{$${N}}`,t.manifest.definitions[N]))}({tag(){({version(){v.version&&(this.manifest.version=v.version)},"allow-cache"(){this.manifest.allowCache=v.allowed,"allowed"in v||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const N={};"length"in v&&(n.byterange=N,N.length=v.length,"offset"in v||(v.offset=E)),"offset"in v&&(n.byterange=N,N.offset=v.offset),E=N.offset+N.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),v.title&&(n.title=v.title),v.duration>0&&(n.duration=v.duration),v.duration===0&&(n.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=i},key(){if(!v.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(v.attributes.METHOD==="NONE"){a=null;return}if(!v.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(v.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:v.attributes};return}if(v.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:v.attributes.URI};return}if(v.attributes.KEYFORMAT===m){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(v.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(v.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),v.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(v.attributes.KEYID&&v.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:v.attributes.KEYFORMAT,keyId:v.attributes.KEYID.substring(2)},pssh:rd(v.attributes.URI.split(",")[1])};return}v.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:v.attributes.METHOD||"AES-128",uri:v.attributes.URI},typeof v.attributes.IV<"u"&&(a.iv=v.attributes.IV)},"media-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+v.number});return}this.manifest.mediaSequence=v.number},"discontinuity-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+v.number});return}this.manifest.discontinuitySequence=v.number,T=v.number},"playlist-type"(){if(!/VOD|EVENT/.test(v.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+v.playlist});return}this.manifest.playlistType=v.playlistType},map(){r={},v.uri&&(r.uri=v.uri),v.byterange&&(r.byterange=v.byterange),a&&(r.key=a)},"stream-inf"(){if(this.manifest.playlists=i,this.manifest.mediaGroups=this.manifest.mediaGroups||f,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}n.attributes||(n.attributes={}),je(n.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||f,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const N=this.manifest.mediaGroups[v.attributes.TYPE];N[v.attributes["GROUP-ID"]]=N[v.attributes["GROUP-ID"]]||{},R=N[v.attributes["GROUP-ID"]],L={default:/yes/i.test(v.attributes.DEFAULT)},L.default?L.autoselect=!0:L.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(L.language=v.attributes.LANGUAGE),v.attributes.URI&&(L.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(L.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(L.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(L.forced=/yes/i.test(v.attributes.FORCED)),R[v.attributes.NAME]=L},discontinuity(){T+=1,n.discontinuity=!0,this.manifest.discontinuityStarts.push(i.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=v.dateTimeString,this.manifest.dateTimeObject=v.dateTimeObject),n.dateTimeString=v.dateTimeString,n.dateTimeObject=v.dateTimeObject;const{lastProgramDateTime:N}=this;this.lastProgramDateTime=new Date(v.dateTimeString).getTime(),N===null&&this.manifest.segments.reduceRight((U,F)=>(F.programDateTime=U-F.duration*1e3,F.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(v.duration)||v.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+v.duration});return}this.manifest.targetDuration=v.duration,Da.call(this,this.manifest)},start(){if(!v.attributes||isNaN(v.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:v.attributes["TIME-OFFSET"],precise:v.attributes.PRECISE}},"cue-out"(){n.cueOut=v.data},"cue-out-cont"(){n.cueOutCont=v.data},"cue-in"(){n.cueIn=v.data},skip(){this.manifest.skip=yi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;const N=this.manifest.segments.length,U=yi(v.attributes);n.parts=n.parts||[],n.parts.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=C),C=U.byterange.offset+U.byterange.length);const F=n.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${F} for segment #${N}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((D,V)=>{D.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${V} lacks required attribute(s): LAST-PART`})})},"server-control"(){const N=this.manifest.serverControl=yi(v.attributes);N.hasOwnProperty("canBlockReload")||(N.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Da.call(this,this.manifest),N.canSkipDateranges&&!N.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const N=this.manifest.segments.length,U=yi(v.attributes),F=U.type&&U.type==="PART";n.preloadHints=n.preloadHints||[],n.preloadHints.push(U),U.byterange&&(U.byterange.hasOwnProperty("offset")||(U.byterange.offset=F?C:0,F&&(C=U.byterange.offset+U.byterange.length)));const D=n.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${D} for segment #${N}`,v.attributes,["TYPE","URI"]),!!U.type)for(let V=0;V<n.preloadHints.length-1;V++){const X=n.preloadHints[V];X.type&&X.type===U.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${D} for segment #${N} has the same TYPE ${U.type} as preload hint #${V}`})}},"rendition-report"(){const N=yi(v.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(N);const U=this.manifest.renditionReports.length-1,F=["LAST-MSN","URI"];l&&F.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${U}`,v.attributes,F)},"part-inf"(){this.manifest.partInf=yi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",v.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Da.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(yi(v.attributes));const N=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${N}`,v.attributes,["ID","START-DATE"]);const U=this.manifest.dateRanges[N];U.endDate&&U.startDate&&new Date(U.endDate)<new Date(U.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),U.duration&&U.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),U.plannedDuration&&U.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const F=!!U.endOnNext;if(F&&!U.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),F&&(U.duration||U.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),U.duration&&U.endDate){const V=U.startDate.getTime()+U.duration*1e3;this.manifest.dateRanges[N].endDate=new Date(V)}if(!P[U.id])P[U.id]=U;else{for(const V in P[U.id])if(U[V]&&JSON.stringify(P[U.id][V])!==JSON.stringify(U[V])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const D=this.manifest.dateRanges.findIndex(V=>V.id===U.id);this.manifest.dateRanges[D]=je(this.manifest.dateRanges[D],U),P[U.id]=je(P[U.id],U),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=yi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",v.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const N=(U,F)=>{if(U in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${U}`});return}this.manifest.definitions[U]=F};if("QUERYPARAM"in v.attributes){if("NAME"in v.attributes||"IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const U=this.params.get(v.attributes.QUERYPARAM);if(!U){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${v.attributes.QUERYPARAM}`});return}N(v.attributes.QUERYPARAM,decodeURIComponent(U));return}if("NAME"in v.attributes){if("IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in v.attributes)||typeof v.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${v.attributes.NAME}`});return}N(v.attributes.NAME,v.attributes.VALUE);return}if("IMPORT"in v.attributes){if(!this.mainDefinitions[v.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${v.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}N(v.attributes.IMPORT,this.mainDefinitions[v.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:v.attributes,uri:v.uri,timeline:T}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",v.attributes,["BANDWIDTH","URI"])}}[v.tagType]||h).call(t)},uri(){n.uri=v.uri,i.push(n),this.manifest.targetDuration&&!("duration"in n)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),n.duration=this.manifest.targetDuration),a&&(n.key=a),n.timeline=T,r&&(n.map=r),C=0,this.lastProgramDateTime!==null&&(n.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=n.duration*1e3),n={}},comment(){},custom(){v.segment?(n.custom=n.custom||{},n.custom[v.customType]=v.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[v.customType]=v.data)}})[v.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,i){const n=[];i.forEach(function(r){t.hasOwnProperty(r)||n.push(r)}),n.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${n.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 Bi={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^/},qy=["video","audio","text"],vu=["Video","Audio","Text"],ad=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,n){var r=("00"+Number(i).toString(16)).slice(-2),a=("00"+Number(n).toString(16)).slice(-2);return"avc1."+r+"00"+a})},zt=function(e){e===void 0&&(e="");var t=e.split(","),i=[];return t.forEach(function(n){n=n.trim();var r;qy.forEach(function(a){var l=Bi[a].exec(n.toLowerCase());if(!(!l||l.length<=1)){r=a;var h=n.substring(0,l[1].length),f=n.replace(h,"");i.push({type:h,details:f,mediaType:a})}}),r||i.push({type:n,details:"",mediaType:"unknown"})}),i},zy=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var n in i){var r=i[n];if(r.default&&r.playlists)return zt(r.playlists[0].attributes.CODECS)}return null},od=function(e){return e===void 0&&(e=""),Bi.audio.test(e.trim().toLowerCase())},Wy=function(e){return e===void 0&&(e=""),Bi.text.test(e.trim().toLowerCase())},fs=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(r){return ad(r.trim())}),i="video";t.length===1&&od(t[0])?i="audio":t.length===1&&Wy(t[0])&&(i="application");var n="mp4";return t.every(function(r){return Bi.mp4.test(r)})?n="mp4":t.every(function(r){return Bi.webm.test(r)})?n="webm":t.every(function(r){return Bi.ogg.test(r)})&&(n="ogg"),i+"/"+n+';codecs="'+e+'"'}},dn=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),k.MediaSource&&k.MediaSource.isTypeSupported&&k.MediaSource.isTypeSupported(fs(e))||t&&k.ManagedMediaSource&&k.ManagedMediaSource.isTypeSupported&&k.ManagedMediaSource.isTypeSupported(fs(e))||!1},La=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<vu.length;i++){var n=vu[i];if(Bi["muxer"+n].test(t))return!0}return!1})},bu="mp4a.40.2",Gy="avc1.4d400d",Ky=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Xy=/^application\/dash\+xml/i,ld=function(e){return Ky.test(e)?"hls":Xy.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},Yy=function(e){return e.toString(2).length},Qy=function(e){return Math.ceil(Yy(e)/8)},ud=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Jy=function(e){return ud(e)},ie=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!Jy(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},Ye=k.BigInt||Number,Xa=[Ye("0x1"),Ye("0x100"),Ye("0x10000"),Ye("0x1000000"),Ye("0x100000000"),Ye("0x10000000000"),Ye("0x1000000000000"),Ye("0x100000000000000"),Ye("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 Zy=function(e,t){var i=t===void 0?{}:t,n=i.signed,r=n===void 0?!1:n,a=i.le,l=a===void 0?!1:a;e=ie(e);var h=l?"reduce":"reduceRight",f=e[h]?e[h]:Array.prototype[h],m=f.call(e,function(E,C,P){var v=l?P:Math.abs(P+1-e.length);return E+Ye(C)*Xa[v]},Ye(0));if(r){var T=Xa[e.length]/Ye(2)-Ye(1);m=Ye(m),m>T&&(m-=T,m-=T,m-=Ye(2))}return Number(m)},e_=function(e,t){var i={},n=i.le,r=n===void 0?!1:n;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=Ye(e);for(var a=Qy(e),l=new Uint8Array(new ArrayBuffer(a)),h=0;h<a;h++){var f=r?h:Math.abs(h+1-l.length);l[f]=Number(e/Xa[h]&Ye(255)),e<0&&(l[f]=Math.abs(~l[f]),l[f]-=h===0?1:2)}return l},cd=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var i=new Uint8Array(e.length),n=0;n<e.length;n++)i[n]=e.charCodeAt(n);return i},t_=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(l){return l&&(l.byteLength||l.length)&&typeof l!="string"}),t.length<=1)return ie(t[0]);var n=t.reduce(function(l,h,f){return l+(h.byteLength||h.length)},0),r=new Uint8Array(n),a=0;return t.forEach(function(l){l=ie(l),r.set(l,a),a+=l.byteLength}),r},Oe=function(e,t,i){var n=i===void 0?{}:i,r=n.offset,a=r===void 0?0:r,l=n.mask,h=l===void 0?[]:l;e=ie(e),t=ie(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(m,T){var E=h[T]?h[T]&e[a+T]:e[a+T];return m===E})},i_=function(e,t,i){t.forEach(function(n){for(var r in e.mediaGroups[n])for(var a in e.mediaGroups[n][r]){var l=e.mediaGroups[n][r][a];i(l,n,r,a)}})};/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const xu=s=>!!s&&typeof s=="object",Ge=(...s)=>s.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(i=>{Array.isArray(e[i])&&Array.isArray(t[i])?e[i]=e[i].concat(t[i]):xu(e[i])&&xu(t[i])?e[i]=Ge(e[i],t[i]):e[i]=t[i]}),e),{}),dd=s=>Object.keys(s).map(e=>s[e]),s_=(s,e)=>{const t=[];for(let i=s;i<e;i++)t.push(i);return t},ps=s=>s.reduce((e,t)=>e.concat(t),[]),hd=s=>{if(!s.length)return[];const e=[];for(let t=0;t<s.length;t++)e.push(s[t]);return e},n_=(s,e)=>s.reduce((t,i,n)=>(i[e]&&t.push(n),t),[]),r_=(s,e)=>dd(s.reduce((t,i)=>(i.forEach(n=>{t[e(n)]=n}),t),{}));var ms={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 yn=({baseUrl:s="",source:e="",range:t="",indexRange:i=""})=>{const n={uri:e,resolvedUri:Ur(s||"",e)};if(t||i){const a=(t||i).split("-");let l=k.BigInt?k.BigInt(a[0]):parseInt(a[0],10),h=k.BigInt?k.BigInt(a[1]):parseInt(a[1],10);l<Number.MAX_SAFE_INTEGER&&typeof l=="bigint"&&(l=Number(l)),h<Number.MAX_SAFE_INTEGER&&typeof h=="bigint"&&(h=Number(h));let f;typeof h=="bigint"||typeof l=="bigint"?f=k.BigInt(h)-k.BigInt(l)+k.BigInt(1):f=h-l+1,typeof f=="bigint"&&f<Number.MAX_SAFE_INTEGER&&(f=Number(f)),n.byterange={length:f,offset:l}}return n},a_=s=>{let e;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=k.BigInt(s.offset)+k.BigInt(s.length)-k.BigInt(1):e=s.offset+s.length-1,`${s.offset}-${e}`},Su=s=>(s&&typeof s!="number"&&(s=parseInt(s,10)),isNaN(s)?null:s),o_={static(s){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:n}=s,r=Su(s.endNumber),a=e/t;return typeof r=="number"?{start:0,end:r}:typeof n=="number"?{start:0,end:n/a}:{start:0,end:i/a}},dynamic(s){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:n=1,duration:r,periodStart:a=0,minimumUpdatePeriod:l=0,timeShiftBufferDepth:h=1/0}=s,f=Su(s.endNumber),m=(e+t)/1e3,T=i+a,C=m+l-T,P=Math.ceil(C*n/r),v=Math.floor((m-T-h)*n/r),R=Math.floor((m-T)*n/r);return{start:Math.max(0,v),end:typeof f=="number"?f:Math.min(P,R)}}},l_=s=>e=>{const{duration:t,timescale:i=1,periodStart:n,startNumber:r=1}=s;return{number:r+e,duration:t/i,timeline:n,time:e*t}},ko=s=>{const{type:e,duration:t,timescale:i=1,periodDuration:n,sourceDuration:r}=s,{start:a,end:l}=o_[e](s),h=s_(a,l).map(l_(s));if(e==="static"){const f=h.length-1,m=typeof n=="number"?n:r;h[f].duration=m-t/i*f}return h},fd=s=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:n="",periodStart:r,presentationTime:a,number:l=0,duration:h}=s;if(!e)throw new Error(ms.NO_BASE_URL);const f=yn({baseUrl:e,source:t.sourceURL,range:t.range}),m=yn({baseUrl:e,source:e,indexRange:n});if(m.map=f,h){const T=ko(s);T.length&&(m.duration=T[0].duration,m.timeline=T[0].timeline)}else i&&(m.duration=i,m.timeline=r);return m.presentationTime=a||r,m.number=l,[m]},Po=(s,e,t)=>{const i=s.sidx.map?s.sidx.map:null,n=s.sidx.duration,r=s.timeline||0,a=s.sidx.byterange,l=a.offset+a.length,h=e.timescale,f=e.references.filter(R=>R.referenceType!==1),m=[],T=s.endList?"static":"dynamic",E=s.sidx.timeline;let C=E,P=s.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=k.BigInt(l)+e.firstOffset:v=l+e.firstOffset;for(let R=0;R<f.length;R++){const L=e.references[R],N=L.referencedSize,U=L.subsegmentDuration;let F;typeof v=="bigint"?F=v+k.BigInt(N)-k.BigInt(1):F=v+N-1;const D=`${v}-${F}`,X=fd({baseUrl:t,timescale:h,timeline:r,periodStart:E,presentationTime:C,number:P,duration:U,sourceDuration:n,indexRange:D,type:T})[0];i&&(X.map=i),m.push(X),typeof v=="bigint"?v+=k.BigInt(N):v+=N,C+=U/h,P++}return s.segments=m,s},u_=["AUDIO","SUBTITLES"],c_=1/60,pd=s=>r_(s,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),d_=(s,e)=>{for(let t=0;t<s.length;t++)if(s[t].attributes.NAME===e)return s[t];return null},Eu=s=>{let e=[];return i_(s,u_,(t,i,n,r)=>{e=e.concat(t.playlists||[])}),e},Cu=({playlist:s,mediaSequence:e})=>{s.mediaSequence=e,s.segments.forEach((t,i)=>{t.number=s.mediaSequence+i})},h_=({oldPlaylists:s,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:h}){return h===i.timeline});const n=d_(s,i.attributes.NAME);if(!n||i.sidx)return;const r=i.segments[0],a=n.segments.findIndex(function(h){return Math.abs(h.presentationTime-r.presentationTime)<c_});if(a===-1){Cu({playlist:i,mediaSequence:n.mediaSequence+n.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!n.segments.length&&i.timeline>n.timeline||n.segments.length&&i.timeline>n.segments[n.segments.length-1].timeline)&&i.discontinuitySequence--;return}n.segments[a].discontinuity&&!r.discontinuity&&(r.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),Cu({playlist:i,mediaSequence:n.segments[a].number})})},f_=({oldManifest:s,newManifest:e})=>{const t=s.playlists.concat(Eu(s)),i=e.playlists.concat(Eu(e));return e.timelineStarts=pd([s.timelineStarts,e.timelineStarts]),h_({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Fr=s=>s&&s.uri+"-"+a_(s.byterange),Oa=s=>{const e=s.reduce(function(i,n){return i[n.attributes.baseUrl]||(i[n.attributes.baseUrl]=[]),i[n.attributes.baseUrl].push(n),i},{});let t=[];return Object.values(e).forEach(i=>{const n=dd(i.reduce((r,a)=>{const l=a.attributes.id+(a.attributes.lang||"");return r[l]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),r[l].segments.push(...a.segments)),a.attributes.contentProtection&&(r[l].attributes.contentProtection=a.attributes.contentProtection)):(r[l]=a,r[l].attributes.timelineStarts=[]),r[l].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),r},{}));t=t.concat(n)}),t.map(i=>(i.discontinuityStarts=n_(i.segments||[],"discontinuity"),i))},Do=(s,e)=>{const t=Fr(s.sidx),i=t&&e[t]&&e[t].sidx;return i&&Po(s,i,s.sidx.resolvedUri),s},p_=(s,e={})=>{if(!Object.keys(e).length)return s;for(const t in s)s[t]=Do(s[t],e);return s},m_=({attributes:s,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:n,discontinuityStarts:r},a)=>{const l={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:n,discontinuityStarts:r,timelineStarts:s.timelineStarts,mediaSequence:i,segments:e};return s.contentProtection&&(l.contentProtection=s.contentProtection),s.serviceLocation&&(l.attributes.serviceLocation=s.serviceLocation),t&&(l.sidx=t),a&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l},g_=({attributes:s,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:n})=>{typeof e>"u"&&(e=[{uri:s.baseUrl,timeline:s.periodStart,resolvedUri:s.baseUrl||"",duration:s.sourceDuration,number:0}],s.duration=s.sourceDuration);const r={NAME:s.id,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1};s.codecs&&(r.CODECS=s.codecs);const a={attributes:r,uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,timelineStarts:s.timelineStarts,discontinuityStarts:i,discontinuitySequence:n,mediaSequence:t,segments:e};return s.serviceLocation&&(a.attributes.serviceLocation=s.serviceLocation),a},y_=(s,e={},t=!1)=>{let i;const n=s.reduce((r,a)=>{const l=a.attributes.role&&a.attributes.role.value||"",h=a.attributes.lang||"";let f=a.attributes.label||"main";if(h&&!a.attributes.label){const T=l?` (${l})`:"";f=`${a.attributes.lang}${T}`}r[f]||(r[f]={language:h,autoselect:!0,default:l==="main",playlists:[],uri:""});const m=Do(m_(a,t),e);return r[f].playlists.push(m),typeof i>"u"&&l==="main"&&(i=a,i.default=!0),r},{});if(!i){const r=Object.keys(n)[0];n[r].default=!0}return n},__=(s,e={})=>s.reduce((t,i)=>{const n=i.attributes.label||i.attributes.lang||"text",r=i.attributes.lang||"und";return t[n]||(t[n]={language:r,default:!1,autoselect:!1,playlists:[],uri:""}),t[n].playlists.push(Do(g_(i),e)),t},{}),T_=s=>s.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:n,language:r}=i;e[r]={autoselect:!1,default:!1,instreamId:n,language:r},i.hasOwnProperty("aspectRatio")&&(e[r].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[r].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[r]["3D"]=i["3D"])}),e),{}),v_=({attributes:s,segments:e,sidx:t,discontinuityStarts:i})=>{const n={attributes:{NAME:s.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:s.width,height:s.height},CODECS:s.codecs,BANDWIDTH:s.bandwidth,"PROGRAM-ID":1},uri:"",endList:s.type==="static",timeline:s.periodStart,resolvedUri:s.baseUrl||"",targetDuration:s.duration,discontinuityStarts:i,timelineStarts:s.timelineStarts,segments:e};return s.frameRate&&(n.attributes["FRAME-RATE"]=s.frameRate),s.contentProtection&&(n.contentProtection=s.contentProtection),s.serviceLocation&&(n.attributes.serviceLocation=s.serviceLocation),t&&(n.sidx=t),n},b_=({attributes:s})=>s.mimeType==="video/mp4"||s.mimeType==="video/webm"||s.contentType==="video",x_=({attributes:s})=>s.mimeType==="audio/mp4"||s.mimeType==="audio/webm"||s.contentType==="audio",S_=({attributes:s})=>s.mimeType==="text/vtt"||s.contentType==="text",E_=(s,e)=>{s.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,n)=>{i.number=n})})},wu=s=>s?Object.keys(s).reduce((e,t)=>{const i=s[t];return e.concat(i.playlists)},[]):[],C_=({dashPlaylists:s,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:n,eventStream:r})=>{if(!s.length)return{};const{sourceDuration:a,type:l,suggestedPresentationDelay:h,minimumUpdatePeriod:f}=s[0].attributes,m=Oa(s.filter(b_)).map(v_),T=Oa(s.filter(x_)),E=Oa(s.filter(S_)),C=s.map(F=>F.attributes.captionServices).filter(Boolean),P={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:p_(m,i)};f>=0&&(P.minimumUpdatePeriod=f*1e3),e&&(P.locations=e),t&&(P.contentSteering=t),l==="dynamic"&&(P.suggestedPresentationDelay=h),r&&r.length>0&&(P.eventStream=r);const v=P.playlists.length===0,R=T.length?y_(T,i,v):null,L=E.length?__(E,i):null,N=m.concat(wu(R),wu(L)),U=N.map(({timelineStarts:F})=>F);return P.timelineStarts=pd(U),E_(N,P.timelineStarts),R&&(P.mediaGroups.AUDIO.audio=R),L&&(P.mediaGroups.SUBTITLES.subs=L),C.length&&(P.mediaGroups["CLOSED-CAPTIONS"].cc=T_(C)),n?f_({oldManifest:n,newManifest:P}):P},w_=(s,e,t)=>{const{NOW:i,clientOffset:n,availabilityStartTime:r,timescale:a=1,periodStart:l=0,minimumUpdatePeriod:h=0}=s,f=(i+n)/1e3,m=r+l,E=f+h-m;return Math.ceil((E*a-e)/t)},md=(s,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:n="",sourceDuration:r,timescale:a=1,startNumber:l=1,periodStart:h}=s,f=[];let m=-1;for(let T=0;T<e.length;T++){const E=e[T],C=E.d,P=E.r||0,v=E.t||0;m<0&&(m=v),v&&v>m&&(m=v);let R;if(P<0){const U=T+1;U===e.length?t==="dynamic"&&i>0&&n.indexOf("$Number$")>0?R=w_(s,m,C):R=(r*a-m)/C:R=(e[U].t-m)/C}else R=P+1;const L=l+f.length+R;let N=l+f.length;for(;N<L;)f.push({number:N,duration:C/a,time:m,timeline:h}),m+=C,N++}return f},I_=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,A_=s=>(e,t,i,n)=>{if(e==="$$")return"$";if(typeof s[t]>"u")return e;const r=""+s[t];return t==="RepresentationID"||(i?n=parseInt(n,10):n=1,r.length>=n)?r:`${new Array(n-r.length+1).join("0")}${r}`},Iu=(s,e)=>s.replace(I_,A_(e)),k_=(s,e)=>!s.duration&&!e?[{number:s.startNumber||1,duration:s.sourceDuration,time:0,timeline:s.periodStart}]:s.duration?ko(s):md(s,e),P_=(s,e)=>{const t={RepresentationID:s.id,Bandwidth:s.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=s,n=yn({baseUrl:s.baseUrl,source:Iu(i.sourceURL,t),range:i.range});return k_(s,e).map(a=>{t.Number=a.number,t.Time=a.time;const l=Iu(s.media||"",t),h=s.timescale||1,f=s.presentationTimeOffset||0,m=s.periodStart+(a.time-f)/h;return{uri:l,timeline:a.timeline,duration:a.duration,resolvedUri:Ur(s.baseUrl||"",l),map:n,number:a.number,presentationTime:m}})},D_=(s,e)=>{const{baseUrl:t,initialization:i={}}=s,n=yn({baseUrl:t,source:i.sourceURL,range:i.range}),r=yn({baseUrl:t,source:e.media,range:e.mediaRange});return r.map=n,r},L_=(s,e)=>{const{duration:t,segmentUrls:i=[],periodStart:n}=s;if(!t&&!e||t&&e)throw new Error(ms.SEGMENT_TIME_UNSPECIFIED);const r=i.map(h=>D_(s,h));let a;return t&&(a=ko(s)),e&&(a=md(s,e)),a.map((h,f)=>{if(r[f]){const m=r[f],T=s.timescale||1,E=s.presentationTimeOffset||0;return m.timeline=h.timeline,m.duration=h.duration,m.number=h.number,m.presentationTime=n+(h.time-E)/T,m}}).filter(h=>h)},O_=({attributes:s,segmentInfo:e})=>{let t,i;e.template?(i=P_,t=Ge(s,e.template)):e.base?(i=fd,t=Ge(s,e.base)):e.list&&(i=L_,t=Ge(s,e.list));const n={attributes:s};if(!i)return n;const r=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:l=1}=t;t.duration=a/l}else r.length?t.duration=r.reduce((a,l)=>Math.max(a,Math.ceil(l.duration)),0):t.duration=0;return n.attributes=t,n.segments=r,e.base&&t.indexRange&&(n.sidx=r[0],n.segments=[]),n},R_=s=>s.map(O_),Re=(s,e)=>hd(s.childNodes).filter(({tagName:t})=>t===e),bn=s=>s.textContent.trim(),M_=s=>parseFloat(s.split("/").reduce((e,t)=>e/t)),Ji=s=>{const l=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(s);if(!l)return 0;const[h,f,m,T,E,C]=l.slice(1);return parseFloat(h||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(m||0)*86400+parseFloat(T||0)*3600+parseFloat(E||0)*60+parseFloat(C||0)},N_=s=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(s)&&(s+="Z"),Date.parse(s)),Au={mediaPresentationDuration(s){return Ji(s)},availabilityStartTime(s){return N_(s)/1e3},minimumUpdatePeriod(s){return Ji(s)},suggestedPresentationDelay(s){return Ji(s)},type(s){return s},timeShiftBufferDepth(s){return Ji(s)},start(s){return Ji(s)},width(s){return parseInt(s,10)},height(s){return parseInt(s,10)},bandwidth(s){return parseInt(s,10)},frameRate(s){return M_(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)?Ji(s):e},d(s){return parseInt(s,10)},t(s){return parseInt(s,10)},r(s){return parseInt(s,10)},presentationTime(s){return parseInt(s,10)},DEFAULT(s){return s}},He=s=>s&&s.attributes?hd(s.attributes).reduce((e,t)=>{const i=Au[t.name]||Au.DEFAULT;return e[t.name]=i(t.value),e},{}):{},U_={"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"},$r=(s,e)=>e.length?ps(s.map(function(t){return e.map(function(i){const n=bn(i),r=Ur(t.baseUrl,n),a=Ge(He(i),{baseUrl:r});return r!==n&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):s,Lo=s=>{const e=Re(s,"SegmentTemplate")[0],t=Re(s,"SegmentList")[0],i=t&&Re(t,"SegmentURL").map(T=>Ge({tag:"SegmentURL"},He(T))),n=Re(s,"SegmentBase")[0],r=t||e,a=r&&Re(r,"SegmentTimeline")[0],l=t||n||e,h=l&&Re(l,"Initialization")[0],f=e&&He(e);f&&h?f.initialization=h&&He(h):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const m={template:f,segmentTimeline:a&&Re(a,"S").map(T=>He(T)),list:t&&Ge(He(t),{segmentUrls:i,initialization:He(h)}),base:n&&Ge(He(n),{initialization:He(h)})};return Object.keys(m).forEach(T=>{m[T]||delete m[T]}),m},B_=(s,e,t)=>i=>{const n=Re(i,"BaseURL"),r=$r(e,n),a=Ge(s,He(i)),l=Lo(i);return r.map(h=>({segmentInfo:Ge(t,l),attributes:Ge(a,h)}))},F_=s=>s.reduce((e,t)=>{const i=He(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const n=U_[i.schemeIdUri];if(n){e[n]={attributes:i};const r=Re(t,"cenc:pssh")[0];if(r){const a=bn(r);e[n].pssh=a&&rd(a)}}return e},{}),$_=s=>{if(s.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{let i,n;return n=t,/^CC\d=/.test(t)?[i,n]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:n}});if(s.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof s.value!="string"?[]:s.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[n,r=""]=t.split("=");i.channel=n,i.language=t,r.split(",").forEach(a=>{const[l,h]=a.split(":");l==="lang"?i.language=h:l==="er"?i.easyReader=Number(h):l==="war"?i.aspectRatio=Number(h):l==="3D"&&(i["3D"]=Number(h))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},j_=s=>ps(Re(s.node,"EventStream").map(e=>{const t=He(e),i=t.schemeIdUri;return Re(e,"Event").map(n=>{const r=He(n),a=r.presentationTime||0,l=t.timescale||1,h=r.duration||0,f=a/l+s.attributes.start;return{schemeIdUri:i,value:t.value,id:r.id,start:f,end:f+h/l,messageData:bn(n)||r.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),V_=(s,e,t)=>i=>{const n=He(i),r=$r(e,Re(i,"BaseURL")),a=Re(i,"Role")[0],l={role:He(a)};let h=Ge(s,n,l);const f=Re(i,"Accessibility")[0],m=$_(He(f));m&&(h=Ge(h,{captionServices:m}));const T=Re(i,"Label")[0];if(T&&T.childNodes.length){const R=T.childNodes[0].nodeValue.trim();h=Ge(h,{label:R})}const E=F_(Re(i,"ContentProtection"));Object.keys(E).length&&(h=Ge(h,{contentProtection:E}));const C=Lo(i),P=Re(i,"Representation"),v=Ge(t,C);return ps(P.map(B_(h,r,v)))},H_=(s,e)=>(t,i)=>{const n=$r(e,Re(t.node,"BaseURL")),r=Ge(s,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(r.periodDuration=t.attributes.duration);const a=Re(t.node,"AdaptationSet"),l=Lo(t.node);return ps(a.map(V_(r,n,l)))},q_=(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=Ge({serverURL:bn(s[0])},He(s[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},z_=({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,W_=(s,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:n=0,eventHandler:r=function(){}}=e,a=Re(s,"Period");if(!a.length)throw new Error(ms.INVALID_NUMBER_OF_PERIOD);const l=Re(s,"Location"),h=He(s),f=$r([{baseUrl:t}],Re(s,"BaseURL")),m=Re(s,"ContentSteering");h.type=h.type||"static",h.sourceDuration=h.mediaPresentationDuration||0,h.NOW=i,h.clientOffset=n,l.length&&(h.locations=l.map(bn));const T=[];return a.forEach((E,C)=>{const P=He(E),v=T[C-1];P.start=z_({attributes:P,priorPeriodAttributes:v?v.attributes:null,mpdType:h.type}),T.push({node:E,attributes:P})}),{locations:h.locations,contentSteeringInfo:q_(m,r),representationInfo:ps(T.map(H_(h,f))),eventStream:ps(T.map(j_))}},gd=s=>{if(s==="")throw new Error(ms.DASH_EMPTY_MANIFEST);const e=new tg.DOMParser;let t,i;try{t=e.parseFromString(s,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(ms.DASH_INVALID_XML);return i},G_=s=>{const e=Re(s,"UTCTiming")[0];if(!e)return null;const t=He(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;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(ms.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},K_=(s,e={})=>{const t=W_(gd(s),e),i=R_(t.representationInfo);return C_({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},X_=s=>G_(gd(s));var yd=Math.pow(2,32),Y_=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)*yd+e.getUint32(4)},Q_={getUint64:Y_,MAX_UINT32:yd},ku=Q_.getUint64,J_=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)},i=12;t.version===0?(t.earliestPresentationTime=e.getUint32(i),t.firstOffset=e.getUint32(i+4),i+=8):(t.earliestPresentationTime=ku(s.subarray(i)),t.firstOffset=ku(s.subarray(i+8)),i+=16),i+=2;var n=e.getUint16(i);for(i+=2;n>0;i+=12,n--)t.references.push({referenceType:(s[i]&128)>>>7,referencedSize:e.getUint32(i)&2147483647,subsegmentDuration:e.getUint32(i+4),startsWithSap:!!(s[i+8]&128),sapType:(s[i+8]&112)>>>4,sapDeltaTime:e.getUint32(i+8)&268435455});return t},Z_=J_;const eT=Jt.getDefaultExportFromCjs(Z_);var tT=ie([73,68,51]),iT=function(e,t){t===void 0&&(t=0),e=ie(e);var i=e[t+5],n=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],r=(i&16)>>4;return r?n+20:n+10},on=function s(e,t){return t===void 0&&(t=0),e=ie(e),e.length-t<10||!Oe(e,tT,{offset:t})?t:(t+=iT(e,t),s(e,t))},Pu=function(e){return typeof e=="string"?cd(e):e},sT=function(e){return Array.isArray(e)?e.map(function(t){return Pu(t)}):[Pu(e)]},nT=function s(e,t,i){i===void 0&&(i=!1),t=sT(t),e=ie(e);var n=[];if(!t.length)return n;for(var r=0;r<e.length;){var a=(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0,l=e.subarray(r+4,r+8);if(a===0)break;var h=r+a;if(h>e.length){if(i)break;h=e.length}var f=e.subarray(r+8,h);Oe(l,t[0])&&(t.length===1?n.push(f):n.push.apply(n,s(f,t.slice(1),i))),r=h}return n},er={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])},Ya=[128,64,32,16,8,4,2,1],rT=function(e){for(var t=1,i=0;i<Ya.length&&!(e&Ya[i]);i++)t++;return t},dr=function(e,t,i,n){i===void 0&&(i=!0),n===void 0&&(n=!1);var r=rT(e[t]),a=e.subarray(t,t+r);return i&&(a=Array.prototype.slice.call(e,t,t+r),a[0]^=Ya[r-1]),{length:r,value:Zy(a,{signed:n}),bytes:a}},Du=function s(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return s(t)}):typeof e=="number"?e_(e):e},aT=function(e){return Array.isArray(e)?e.map(function(t){return Du(t)}):[Du(e)]},oT=function s(e,t,i){if(i>=t.length)return t.length;var n=dr(t,i,!1);if(Oe(e.bytes,n.bytes))return i;var r=dr(t,i+n.length);return s(e,t,i+r.length+r.value+n.length)},Lu=function s(e,t){t=aT(t),e=ie(e);var i=[];if(!t.length)return i;for(var n=0;n<e.length;){var r=dr(e,n,!1),a=dr(e,n+r.length),l=n+r.length+a.length;a.value===127&&(a.value=oT(r,e,l),a.value!==e.length&&(a.value-=l));var h=l+a.value>e.length?e.length:l+a.value,f=e.subarray(l,h);Oe(t[0],r.bytes)&&(t.length===1?i.push(f):i=i.concat(s(f,t.slice(1))));var m=r.length+a.length+f.length;n+=m}return i},lT=ie([0,0,0,1]),uT=ie([0,0,1]),cT=ie([0,0,3]),dT=function(e){for(var t=[],i=1;i<e.length-2;)Oe(e.subarray(i,i+3),cT)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var n=e.length-t.length,r=new Uint8Array(n),a=0;for(i=0;i<n;a++,i++)a===t[0]&&(a++,t.shift()),r[i]=e[a];return r},_d=function(e,t,i,n){e=ie(e),i=[].concat(i);for(var r=0,a,l=0;r<e.length&&(l<n||a);){var h=void 0;if(Oe(e.subarray(r),lT)?h=4:Oe(e.subarray(r),uT)&&(h=3),!h){r++;continue}if(l++,a)return dT(e.subarray(a,r));var f=void 0;t==="h264"?f=e[r+h]&31:t==="h265"&&(f=e[r+h]>>1&63),i.indexOf(f)!==-1&&(a=r+h),r+=h+(t==="h264"?1:2)}return e.subarray(0,0)},hT=function(e,t,i){return _d(e,"h264",t,i)},fT=function(e,t,i){return _d(e,"h265",t,i)},nt={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])},gs={aac:function(e){var t=on(e);return Oe(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=on(e);return Oe(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=Lu(e,[er.EBML,er.DocType])[0];return Oe(t,nt.webm)},mkv:function(e){var t=Lu(e,[er.EBML,er.DocType])[0];return Oe(t,nt.matroska)},mp4:function(e){if(gs["3gp"](e)||gs.mov(e))return!1;if(Oe(e,nt.mp4,{offset:4})||Oe(e,nt.fmp4,{offset:4})||Oe(e,nt.moof,{offset:4})||Oe(e,nt.moov,{offset:4}))return!0},mov:function(e){return Oe(e,nt.mov,{offset:4})},"3gp":function(e){return Oe(e,nt["3gp"],{offset:4})},ac3:function(e){var t=on(e);return Oe(e,nt.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=on(e);return Oe(e,nt.flac,{offset:t})},ogg:function(e){return Oe(e,nt.ogg)},avi:function(e){return Oe(e,nt.riff)&&Oe(e,nt.avi,{offset:8})},wav:function(e){return Oe(e,nt.riff)&&Oe(e,nt.wav,{offset:8})},h264:function(e){return hT(e,7,3).length},h265:function(e){return fT(e,[32,33],3).length}},Qa=Object.keys(gs).filter(function(s){return s!=="ts"&&s!=="h264"&&s!=="h265"}).concat(["ts","h264","h265"]);Qa.forEach(function(s){var e=gs[s];gs[s]=function(t){return e(ie(t))}});var pT=gs,Oo=function(e){e=ie(e);for(var t=0;t<Qa.length;t++){var i=Qa[t];if(pT[i](e))return i}return""},mT=function(e){return nT(e,["moof"]).length>0},Ro=9e4,Mo,No,jr,Uo,Td,vd,bd;Mo=function(s){return s*Ro};No=function(s,e){return s*e};jr=function(s){return s/Ro};Uo=function(s,e){return s/e};Td=function(s,e){return Mo(Uo(s,e))};vd=function(s,e){return No(jr(s),e)};bd=function(s,e,t){return jr(t?s:s-e)};var Ni={ONE_SECOND_IN_TS:Ro,secondsToVideoTs:Mo,secondsToAudioTs:No,videoTsToSeconds:jr,audioTsToSeconds:Uo,audioTsToVideoTs:Td,videoTsToAudioTs:vd,metadataTsToSeconds:bd},Ja="8.21.0";const ni={},Si=function(s,e){return ni[s]=ni[s]||[],e&&(ni[s]=ni[s].concat(e)),ni[s]},gT=function(s,e){Si(s,e)},xd=function(s,e){const t=Si(s).indexOf(e);return t<=-1?!1:(ni[s]=ni[s].slice(),ni[s].splice(t,1),!0)},yT=function(s,e){Si(s,[].concat(e).map(t=>{const i=(...n)=>(xd(s,i),t(...n));return i}))},hr={prefixed:!0},ar=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Ou=ar[0];let ln;for(let s=0;s<ar.length;s++)if(ar[s][1]in K){ln=ar[s];break}if(ln){for(let s=0;s<ln.length;s++)hr[Ou[s]]=ln[s];hr.prefixed=ln[0]!==Ou[0]}let ct=[];const _T=(s,e,t)=>(i,n,r)=>{const a=e.levels[n],l=new RegExp(`^(${a})$`);let h=s;if(i!=="log"&&r.unshift(i.toUpperCase()+":"),t&&(h=`%c${s}`,r.unshift(t)),r.unshift(h+":"),ct){ct.push([].concat(r));const m=ct.length-1e3;ct.splice(0,m>0?m:0)}if(!k.console)return;let f=k.console[i];!f&&i==="debug"&&(f=k.console.info||k.console.log),!(!f||!a||!l.test(i))&&f[Array.isArray(r)?"apply":"call"](k.console,r)};function Za(s,e=":",t=""){let i="info",n;function r(...a){n("log",i,a)}return n=_T(s,r,t),r.createLogger=(a,l,h)=>{const f=l!==void 0?l:e,m=h!==void 0?h:t,T=`${s} ${f} ${a}`;return Za(T,f,m)},r.createNewLogger=(a,l,h)=>Za(a,l,h),r.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},r.level=a=>{if(typeof a=="string"){if(!r.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},r.history=()=>ct?[].concat(ct):[],r.history.filter=a=>(ct||[]).filter(l=>new RegExp(`.*${a}.*`).test(l[0])),r.history.clear=()=>{ct&&(ct.length=0)},r.history.disable=()=>{ct!==null&&(ct.length=0,ct=null)},r.history.enable=()=>{ct===null&&(ct=[])},r.error=(...a)=>n("error",i,a),r.warn=(...a)=>n("warn",i,a),r.debug=(...a)=>n("debug",i,a),r}const ue=Za("VIDEOJS"),Sd=ue.createLogger,TT=Object.prototype.toString,Ed=function(s){return Zt(s)?Object.keys(s):[]};function rs(s,e){Ed(s).forEach(t=>e(s[t],t))}function Cd(s,e,t=0){return Ed(s).reduce((i,n)=>e(i,s[n],n),t)}function Zt(s){return!!s&&typeof s=="object"}function ys(s){return Zt(s)&&TT.call(s)==="[object Object]"&&s.constructor===Object}function xe(...s){const e={};return s.forEach(t=>{t&&rs(t,(i,n)=>{if(!ys(i)){e[n]=i;return}ys(e[n])||(e[n]={}),e[n]=xe(e[n],i)})}),e}function wd(s={}){const e=[];for(const t in s)if(s.hasOwnProperty(t)){const i=s[t];e.push(i)}return e}function Vr(s,e,t,i=!0){const n=a=>Object.defineProperty(s,e,{value:a,enumerable:!0,writable:!0}),r={configurable:!0,enumerable:!0,get(){const a=t();return n(a),a}};return i&&(r.set=n),Object.defineProperty(s,e,r)}var vT=Object.freeze({__proto__:null,each:rs,reduce:Cd,isObject:Zt,isPlain:ys,merge:xe,values:wd,defineLazyProperty:Vr});let Bo=!1,Id=null,Ut=!1,Ad,kd=!1,as=!1,os=!1,ei=!1,Fo=null,Hr=null;const bT=!!(k.cast&&k.cast.framework&&k.cast.framework.CastReceiverContext);let Pd=null,fr=!1,qr=!1,pr=!1,zr=!1,mr=!1,gr=!1,yr=!1;const _n=!!(Es()&&("ontouchstart"in k||k.navigator.maxTouchPoints||k.DocumentTouch&&k.document instanceof k.DocumentTouch)),_i=k.navigator&&k.navigator.userAgentData;_i&&_i.platform&&_i.brands&&(Ut=_i.platform==="Android",as=!!_i.brands.find(s=>s.brand==="Microsoft Edge"),os=!!_i.brands.find(s=>s.brand==="Chromium"),ei=!as&&os,Fo=Hr=(_i.brands.find(s=>s.brand==="Chromium")||{}).version||null,qr=_i.platform==="Windows");if(!os){const s=k.navigator&&k.navigator.userAgent||"";Bo=/iPod/i.test(s),Id=function(){const e=s.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Ut=/Android/i.test(s),Ad=function(){const e=s.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),i=e[2]&&parseFloat(e[2]);return t&&i?parseFloat(e[1]+"."+e[2]):t||null}(),kd=/Firefox/i.test(s),as=/Edg/i.test(s),os=/Chrome/i.test(s)||/CriOS/i.test(s),ei=!as&&os,Fo=Hr=function(){const e=s.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),Pd=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}(),mr=/Tizen/i.test(s),gr=/Web0S/i.test(s),yr=mr||gr,fr=/Safari/i.test(s)&&!ei&&!Ut&&!as&&!yr,qr=/Windows/i.test(s),pr=/iPad/i.test(s)||fr&&_n&&!/iPhone/i.test(s),zr=/iPhone/i.test(s)&&!pr}const Ze=zr||pr||Bo,Wr=(fr||Ze)&&!ei;var Dd=Object.freeze({__proto__:null,get IS_IPOD(){return Bo},get IOS_VERSION(){return Id},get IS_ANDROID(){return Ut},get ANDROID_VERSION(){return Ad},get IS_FIREFOX(){return kd},get IS_EDGE(){return as},get IS_CHROMIUM(){return os},get IS_CHROME(){return ei},get CHROMIUM_VERSION(){return Fo},get CHROME_VERSION(){return Hr},IS_CHROMECAST_RECEIVER:bT,get IE_VERSION(){return Pd},get IS_SAFARI(){return fr},get IS_WINDOWS(){return qr},get IS_IPAD(){return pr},get IS_IPHONE(){return zr},get IS_TIZEN(){return mr},get IS_WEBOS(){return gr},get IS_SMART_TV(){return yr},TOUCH_ENABLED:_n,IS_IOS:Ze,IS_ANY_SAFARI:Wr});function Ru(s){return typeof s=="string"&&!!s.trim()}function xT(s){if(s.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Es(){return K===k.document}function Cs(s){return Zt(s)&&s.nodeType===1}function Ld(){try{return k.parent!==k.self}catch{return!0}}function Od(s){return function(e,t){if(!Ru(e))return K[s](null);Ru(t)&&(t=K.querySelector(t));const i=Cs(t)?t:K;return i[s]&&i[s](e)}}function se(s="div",e={},t={},i){const n=K.createElement(s);return Object.getOwnPropertyNames(e).forEach(function(r){const a=e[r];r==="textContent"?Ci(n,a):(n[r]!==a||r==="tabIndex")&&(n[r]=a)}),Object.getOwnPropertyNames(t).forEach(function(r){n.setAttribute(r,t[r])}),i&&$o(n,i),n}function Ci(s,e){return typeof s.textContent>"u"?s.innerText=e:s.textContent=e,s}function eo(s,e){e.firstChild?e.insertBefore(s,e.firstChild):e.appendChild(s)}function hn(s,e){return xT(e),s.classList.contains(e)}function Fi(s,...e){return s.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s}function Gr(s,...e){return s?(s.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),s):(ue.warn("removeClass was called with an element that doesn't exist"),null)}function Rd(s,e,t){return typeof t=="function"&&(t=t(s,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>s.classList.toggle(i,t)),s}function Md(s,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?s.removeAttribute(t):s.setAttribute(t,i===!0?"":i)})}function bi(s){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(s&&s.attributes&&s.attributes.length>0){const i=s.attributes;for(let n=i.length-1;n>=0;n--){const r=i[n].name;let a=i[n].value;t.includes(r)&&(a=a!==null),e[r]=a}}return e}function Nd(s,e){return s.getAttribute(e)}function _s(s,e,t){s.setAttribute(e,t)}function Kr(s,e){s.removeAttribute(e)}function Ud(){K.body.focus(),K.onselectstart=function(){return!1}}function Bd(){K.onselectstart=function(){return!0}}function Ts(s){if(s&&s.getBoundingClientRect&&s.parentNode){const e=s.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(vs(s,"height"))),t.width||(t.width=parseFloat(vs(s,"width"))),t}}function Tn(s){if(!s||s&&!s.offsetParent)return{left:0,top:0,width:0,height:0};const e=s.offsetWidth,t=s.offsetHeight;let i=0,n=0;for(;s.offsetParent&&s!==K[hr.fullscreenElement];)i+=s.offsetLeft,n+=s.offsetTop,s=s.offsetParent;return{left:i,top:n,width:e,height:t}}function Xr(s,e){const t={x:0,y:0};if(Ze){let m=s;for(;m&&m.nodeName.toLowerCase()!=="html";){const T=vs(m,"transform");if(/^matrix/.test(T)){const E=T.slice(7,-1).split(/,\s/).map(Number);t.x+=E[4],t.y+=E[5]}else if(/^matrix3d/.test(T)){const E=T.slice(9,-1).split(/,\s/).map(Number);t.x+=E[12],t.y+=E[13]}if(m.assignedSlot&&m.assignedSlot.parentElement&&k.WebKitCSSMatrix){const E=k.getComputedStyle(m.assignedSlot.parentElement).transform,C=new k.WebKitCSSMatrix(E);t.x+=C.m41,t.y+=C.m42}m=m.parentNode||m.host}}const i={},n=Tn(e.target),r=Tn(s),a=r.width,l=r.height;let h=e.offsetY-(r.top-n.top),f=e.offsetX-(r.left-n.left);return e.changedTouches&&(f=e.changedTouches[0].pageX-r.left,h=e.changedTouches[0].pageY+r.top,Ze&&(f-=t.x,h-=t.y)),i.y=1-Math.max(0,Math.min(1,h/l)),i.x=Math.max(0,Math.min(1,f/a)),i}function Fd(s){return Zt(s)&&s.nodeType===3}function Yr(s){for(;s.firstChild;)s.removeChild(s.firstChild);return s}function $d(s){return typeof s=="function"&&(s=s()),(Array.isArray(s)?s:[s]).map(e=>{if(typeof e=="function"&&(e=e()),Cs(e)||Fd(e))return e;if(typeof e=="string"&&/\S/.test(e))return K.createTextNode(e)}).filter(e=>e)}function $o(s,e){return $d(e).forEach(t=>s.appendChild(t)),s}function jd(s,e){return $o(Yr(s),e)}function vn(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 Ei=Od("querySelector"),Vd=Od("querySelectorAll");function vs(s,e){if(!s||!e)return"";if(typeof k.getComputedStyle=="function"){let t;try{t=k.getComputedStyle(s)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Hd(s){[...K.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(n=>n.cssText).join(""),i=K.createElement("style");i.textContent=t,s.document.head.appendChild(i)}catch{const i=K.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,s.document.head.appendChild(i)}})}var qd=Object.freeze({__proto__:null,isReal:Es,isEl:Cs,isInFrame:Ld,createEl:se,textContent:Ci,prependTo:eo,hasClass:hn,addClass:Fi,removeClass:Gr,toggleClass:Rd,setAttributes:Md,getAttributes:bi,getAttribute:Nd,setAttribute:_s,removeAttribute:Kr,blockTextSelection:Ud,unblockTextSelection:Bd,getBoundingClientRect:Ts,findPosition:Tn,getPointerPosition:Xr,isTextNode:Fd,emptyEl:Yr,normalizeContent:$d,appendContent:$o,insertContent:jd,isSingleLeftClick:vn,$:Ei,$$:Vd,computedStyle:vs,copyStyleSheetsToWindow:Hd});let zd=!1,to;const ST=function(){if(to.options.autoSetup===!1)return;const s=Array.prototype.slice.call(K.getElementsByTagName("video")),e=Array.prototype.slice.call(K.getElementsByTagName("audio")),t=Array.prototype.slice.call(K.getElementsByTagName("video-js")),i=s.concat(e,t);if(i&&i.length>0)for(let n=0,r=i.length;n<r;n++){const a=i[n];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&to(a);else{io(1);break}}else zd||io(1)};function io(s,e){Es()&&(e&&(to=e),k.setTimeout(ST,s))}function so(){zd=!0,k.removeEventListener("load",so)}Es()&&(K.readyState==="complete"?so():k.addEventListener("load",so));const Wd=function(s){const e=K.createElement("style");return e.className=s,e},Gd=function(s,e){s.styleSheet?s.styleSheet.cssText=e:s.textContent=e};var ot=new WeakMap;const ET=3;let CT=ET;function At(){return CT++}function Mu(s,e){if(!ot.has(s))return;const t=ot.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&&ot.delete(s)}function jo(s,e,t,i){t.forEach(function(n){s(e,n,i)})}function Qr(s){if(s.fixed_)return s;function e(){return!0}function t(){return!1}if(!s||!s.isPropagationStopped||!s.isImmediatePropagationStopped){const i=s||k.event;s={};const n=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const r in i)n.includes(r)||r==="returnValue"&&i.preventDefault||(s[r]=i[r]);if(s.target||(s.target=s.srcElement||K),s.relatedTarget||(s.relatedTarget=s.fromElement===s.target?s.toElement:s.fromElement),s.preventDefault=function(){i.preventDefault&&i.preventDefault(),s.returnValue=!1,i.returnValue=!1,s.defaultPrevented=!0},s.defaultPrevented=!1,s.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),s.cancelBubble=!0,i.cancelBubble=!0,s.isPropagationStopped=e},s.isPropagationStopped=t,s.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),s.isImmediatePropagationStopped=e,s.stopPropagation()},s.isImmediatePropagationStopped=t,s.clientX!==null&&s.clientX!==void 0){const r=K.documentElement,a=K.body;s.pageX=s.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),s.pageY=s.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.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 tr;const wT=function(){if(typeof tr!="boolean"){tr=!1;try{const s=Object.defineProperty({},"passive",{get(){tr=!0}});k.addEventListener("test",null,s),k.removeEventListener("test",null,s)}catch{}}return tr},IT=["touchstart","touchmove"];function vt(s,e,t){if(Array.isArray(e))return jo(vt,s,e,t);ot.has(s)||ot.set(s,{});const i=ot.get(s);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=At()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(n,r){if(i.disabled)return;n=Qr(n);const a=i.handlers[n.type];if(a){const l=a.slice(0);for(let h=0,f=l.length;h<f&&!n.isImmediatePropagationStopped();h++)try{l[h].call(s,n,r)}catch(m){ue.error(m)}}}),i.handlers[e].length===1)if(s.addEventListener){let n=!1;wT()&&IT.indexOf(e)>-1&&(n={passive:!0}),s.addEventListener(e,i.dispatcher,n)}else s.attachEvent&&s.attachEvent("on"+e,i.dispatcher)}function et(s,e,t){if(!ot.has(s))return;const i=ot.get(s);if(!i.handlers)return;if(Array.isArray(e))return jo(et,s,e,t);const n=function(a,l){i.handlers[l]=[],Mu(a,l)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&n(s,a);return}const r=i.handlers[e];if(r){if(!t){n(s,e);return}if(t.guid)for(let a=0;a<r.length;a++)r[a].guid===t.guid&&r.splice(a--,1);Mu(s,e)}}function ws(s,e,t){const i=ot.has(s)?ot.get(s):{},n=s.parentNode||s.ownerDocument;if(typeof e=="string"?e={type:e,target:s}:e.target||(e.target=s),e=Qr(e),i.dispatcher&&i.dispatcher.call(s,e,t),n&&!e.isPropagationStopped()&&e.bubbles===!0)ws.call(null,n,e,t);else if(!n&&!e.defaultPrevented&&e.target&&e.target[e.type]){ot.has(e.target)||ot.set(e.target,{});const r=ot.get(e.target);e.target[e.type]&&(r.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),r.disabled=!1)}return!e.defaultPrevented}function Jr(s,e,t){if(Array.isArray(e))return jo(Jr,s,e,t);const i=function(){et(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||At(),vt(s,e,i)}function Vo(s,e,t){const i=function(){et(s,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||At(),vt(s,e,i)}var AT=Object.freeze({__proto__:null,fixEvent:Qr,on:vt,off:et,trigger:ws,one:Jr,any:Vo});const kt=30,we=function(s,e,t){e.guid||(e.guid=At());const i=e.bind(s);return i.guid=t?t+"_"+e.guid:e.guid,i},ti=function(s,e){let t=k.performance.now();return function(...n){const r=k.performance.now();r-t>=e&&(s(...n),t=r)}},Kd=function(s,e,t,i=k){let n;const r=()=>{i.clearTimeout(n),n=null},a=function(){const l=this,h=arguments;let f=function(){n=null,f=null,t||s.apply(l,h)};!n&&t&&s.apply(l,h),i.clearTimeout(n),n=i.setTimeout(f,e)};return a.cancel=r,a};var kT=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:kt,bind_:we,throttle:ti,debounce:Kd});let Zs;class bt{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},vt(this,e,t),this.addEventListener=i}off(e,t){et(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Jr(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},Vo(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Qr(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),ws(this,e)}queueTrigger(e){Zs||(Zs=new Map);const t=e.type||e;let i=Zs.get(this);i||(i=new Map,Zs.set(this,i));const n=i.get(t);i.delete(t),k.clearTimeout(n);const r=k.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,Zs.delete(this)),this.trigger(e)},0);i.set(t,r)}}bt.prototype.allowedEvents_={};bt.prototype.addEventListener=bt.prototype.on;bt.prototype.removeEventListener=bt.prototype.off;bt.prototype.dispatchEvent=bt.prototype.trigger;const Zr=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,ai=s=>s instanceof bt||!!s.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof s[e]=="function"),PT=(s,e)=>{ai(s)?e():(s.eventedCallbacks||(s.eventedCallbacks=[]),s.eventedCallbacks.push(e))},no=s=>typeof s=="string"&&/\S/.test(s)||Array.isArray(s)&&!!s.length,_r=(s,e,t)=>{if(!s||!s.nodeName&&!ai(s))throw new Error(`Invalid target for ${Zr(e)}#${t}; must be a DOM node or evented object.`)},Xd=(s,e,t)=>{if(!no(s))throw new Error(`Invalid event type for ${Zr(e)}#${t}; must be a non-empty string or array.`)},Yd=(s,e,t)=>{if(typeof s!="function")throw new Error(`Invalid listener for ${Zr(e)}#${t}; must be a function.`)},Ra=(s,e,t)=>{const i=e.length<3||e[0]===s||e[0]===s.eventBusEl_;let n,r,a;return i?(n=s.eventBusEl_,e.length>=3&&e.shift(),[r,a]=e):(n=e[0],r=e[1],a=e[2]),_r(n,s,t),Xd(r,s,t),Yd(a,s,t),a=we(s,a),{isTargetingSelf:i,target:n,type:r,listener:a}},Oi=(s,e,t,i)=>{_r(s,s,e),s.nodeName?AT[e](s,t,i):s[e](t,i)},DT={on(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=Ra(this,s,"on");if(Oi(t,"on",i,n),!e){const r=()=>this.off(t,i,n);r.guid=n.guid;const a=()=>this.off("dispose",r);a.guid=n.guid,Oi(this,"on","dispose",r),Oi(t,"on","dispose",a)}},one(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=Ra(this,s,"one");if(e)Oi(t,"one",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,Oi(t,"one",i,r)}},any(...s){const{isTargetingSelf:e,target:t,type:i,listener:n}=Ra(this,s,"any");if(e)Oi(t,"any",i,n);else{const r=(...a)=>{this.off(t,i,r),n.apply(null,a)};r.guid=n.guid,Oi(t,"any",i,r)}},off(s,e,t){if(!s||no(s))et(this.eventBusEl_,s,e);else{const i=s,n=e;_r(i,this,"off"),Xd(n,this,"off"),Yd(t,this,"off"),t=we(this,t),this.off("dispose",t),i.nodeName?(et(i,n,t),et(i,"dispose",t)):ai(i)&&(i.off(n,t),i.off("dispose",t))}},trigger(s,e){_r(this.eventBusEl_,this,"trigger");const t=s&&typeof s!="string"?s.type:s;if(!no(t))throw new Error(`Invalid event type for ${Zr(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return ws(this.eventBusEl_,s,e)}};function Ho(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_=se("span",{className:"vjs-event-bus"});return Object.assign(s,DT),s.eventedCallbacks&&s.eventedCallbacks.forEach(i=>{i()}),s.on("dispose",()=>{s.off(),[s,s.el_,s.eventBusEl_].forEach(function(i){i&&ot.has(i)&&ot.delete(i)}),k.setTimeout(()=>{s.eventBusEl_=null},0)}),s}const LT={state:{},setState(s){typeof s=="function"&&(s=s());let e;return rs(s,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&ai(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Qd(s,e){return Object.assign(s,LT),s.state=Object.assign({},s.state,e),typeof s.handleStateChanged=="function"&&ai(s)&&s.on("statechanged",s.handleStateChanged),s}const fn=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toLowerCase())},Be=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Jd=function(s,e){return Be(s)===Be(e)};var OT=Object.freeze({__proto__:null,toLowerCase:fn,toTitleCase:Be,titleCaseEquals:Jd});class H{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=xe({},this.options_),t=this.options_=xe(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const n=e&&e.id&&e.id()||"no_player";this.id_=`${n}_component_${At()}`}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(n=>this.addClass(n)),["on","off","one","any","trigger"].forEach(n=>{this[n]=void 0}),t.evented!==!1&&(Ho(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Qd(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(i),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=xe(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return se(e,t,i)}localize(e,t,i=e){const n=this.player_.language&&this.player_.language(),r=this.player_.languages&&this.player_.languages(),a=r&&r[n],l=n&&n.split("-")[0],h=r&&r[l];let f=i;return a&&a[e]?f=a[e]:h&&h[e]&&(f=h[e]),t&&(f=f.replace(/\{(\d+)\}/g,function(m,T){const E=t[T-1];let C=E;return typeof E>"u"&&(C=m),C})),f}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((i,n)=>i.concat(n),[]);let t=this;for(let i=0;i<e.length;i++)if(t=t.getChild(e[i]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const i="http://www.w3.org/2000/svg",n=se("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),r=K.createElementNS(i,"svg");r.setAttributeNS(null,"viewBox","0 0 512 512");const a=K.createElementNS(i,"use");return r.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),n.appendChild(r),this.iconIsSet_?t.replaceChild(n,t.querySelector(".vjs-icon-placeholder")):t.appendChild(n),this.iconIsSet_=!0,n}addChild(e,t={},i=this.children_.length){let n,r;if(typeof e=="string"){r=Be(e);const a=t.componentClass||r;t.name=r;const l=H.getComponent(a);if(!l)throw new Error(`Component ${a} does not exist`);if(typeof l!="function")return null;n=new l(this.player_||this,t)}else n=e;if(n.parentComponent_&&n.parentComponent_.removeChild(n),this.children_.splice(i,0,n),n.parentComponent_=this,typeof n.id=="function"&&(this.childIndex_[n.id()]=n),r=r||n.name&&Be(n.name()),r&&(this.childNameIndex_[r]=n,this.childNameIndex_[fn(r)]=n),typeof n.el=="function"&&n.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_:Cs(this.children_[i+1])&&(a=this.children_[i+1])),this.contentEl().insertBefore(n.el(),a)}return n}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let n=this.children_.length-1;n>=0;n--)if(this.children_[n]===e){t=!0,this.children_.splice(n,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[Be(e.name())]=null,this.childNameIndex_[fn(e.name())]=null;const i=e.el();i&&i.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,i=a=>{const l=a.name;let h=a.opts;if(t[l]!==void 0&&(h=t[l]),h===!1)return;h===!0&&(h={}),h.playerOptions=this.options_.playerOptions;const f=this.addChild(l,h);f&&(this[l]=f)};let n;const r=H.getComponent("Tech");Array.isArray(e)?n=e:n=Object.keys(e),n.concat(Object.keys(this.options_).filter(function(a){return!n.some(function(l){return typeof l=="string"?a===l:a===l.name})})).map(a=>{let l,h;return typeof a=="string"?(l=a,h=e[l]||this.options_[l]||{}):(l=a.name,h=a),{name:l,opts:h}}).filter(a=>{const l=H.getComponent(a.opts.componentClass||Be(a.name));return l&&!r.isTech(l)}).forEach(i)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Ei(e,t||this.contentEl())}$$(e,t){return Vd(e,t||this.contentEl())}hasClass(e){return hn(this.el_,e)}addClass(...e){Fi(this.el_,...e)}removeClass(...e){Gr(this.el_,...e)}toggleClass(e,t){Rd(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 Nd(this.el_,e)}setAttribute(e,t){_s(this.el_,e,t)}removeAttribute(e){Kr(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,i){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",i||this.trigger("componentresize");return}if(!this.el_)return 0;const n=this.el_.style[e],r=n.indexOf("px");return parseInt(r!==-1?n.slice(0,r):this.el_["offset"+Be(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=vs(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${Be(e)}`;t=this.el_[i]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}getPositions(){const e=this.el_.getBoundingClientRect(),t={x:e.x,y:e.y,width:e.width,height:e.height,top:e.top,right:e.right,bottom:e.bottom,left:e.left},i={x:e.left+e.width/2,y:e.top+e.height/2,width:0,height:0,top:e.top+e.height/2,right:e.left+e.width/2,bottom:e.top+e.height/2,left:e.left+e.width/2};return{boundingClientRect:t,center:i}}focus(){this.el_.focus()}blur(){this.el_.blur()}handleKeyDown(e){this.player_&&(e.key!=="Tab"&&!(this.player_.options_.playerOptions.spatialNavigation&&this.player_.options_.playerOptions.spatialNavigation.enabled)&&e.stopPropagation(),this.player_.handleKeyDown(e))}handleKeyPress(e){this.handleKeyDown(e)}emitTapEvents(){let e=0,t=null;const i=10,n=200;let r;this.on("touchstart",function(l){l.touches.length===1&&(t={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=k.performance.now(),r=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)r=!1;else if(t){const h=l.touches[0].pageX-t.pageX,f=l.touches[0].pageY-t.pageY;Math.sqrt(h*h+f*f)>i&&(r=!1)}});const a=function(){r=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(l){t=null,r===!0&&k.performance.now()-e<n&&(l.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=we(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(n){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=we(this,e),this.clearTimersOnDispose_(),i=k.setTimeout(()=>{this.setTimeoutIds_.has(i)&&this.setTimeoutIds_.delete(i),e()},t),this.setTimeoutIds_.add(i),i}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),k.clearTimeout(e)),e}setInterval(e,t){e=we(this,e),this.clearTimersOnDispose_();const i=k.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),k.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=we(this,e),t=k.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=we(this,t);const i=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,i),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),k.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((i,n)=>this[t](n))}),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(r){const a=k.getComputedStyle(r,null),l=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function i(r){return!(!t(r.parentElement)||!t(r)||r.style.opacity==="0"||k.getComputedStyle(r).height==="0px"||k.getComputedStyle(r).width==="0px")}function n(r){if(r.offsetWidth+r.offsetHeight+r.getBoundingClientRect().height+r.getBoundingClientRect().width===0)return!1;const a={x:r.getBoundingClientRect().left+r.offsetWidth/2,y:r.getBoundingClientRect().top+r.offsetHeight/2};if(a.x<0||a.x>(K.documentElement.clientWidth||k.innerWidth)||a.y<0||a.y>(K.documentElement.clientHeight||k.innerHeight))return!1;let l=K.elementFromPoint(a.x,a.y);for(;l;){if(l===r)return!0;if(l.parentNode)l=l.parentNode;else return!1}}return e||(e=this.el()),!!(n(e)&&i(e)&&(!e.parentElement||e.tabIndex>=0))}static registerComponent(e,t){if(typeof e!="string"||!e)throw new Error(`Illegal component name, "${e}"; must be a non-empty string.`);const i=H.getComponent("Tech"),n=i&&i.isTech(t),r=H===t||H.prototype.isPrototypeOf(t.prototype);if(n||!r){let l;throw n?l="techs must be registered using Tech.registerTech()":l="must be a Component subclass",new Error(`Illegal component, "${e}"; ${l}.`)}e=Be(e),H.components_||(H.components_={});const a=H.getComponent("Player");if(e==="Player"&&a&&a.players){const l=a.players,h=Object.keys(l);if(l&&h.length>0&&h.map(f=>l[f]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return H.components_[e]=t,H.components_[fn(e)]=t,t}static getComponent(e){if(!(!e||!H.components_))return H.components_[e]}}H.registerComponent("Component",H);function RT(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 Nu(s,e,t,i){return RT(s,i,t.length-1),t[i][e]}function Ma(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:Nu.bind(null,"start",0,s),end:Nu.bind(null,"end",1,s)},k.Symbol&&k.Symbol.iterator&&(e[k.Symbol.iterator]=()=>(s||[]).values()),e}function Nt(s,e){return Array.isArray(s)?Ma(s):s===void 0||e===void 0?Ma():Ma([[s,e]])}const Zd=function(s,e){s=s<0?0:s;let t=Math.floor(s%60),i=Math.floor(s/60%60),n=Math.floor(s/3600);const r=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(s)||s===1/0)&&(n=i=t="-"),n=n>0||a>0?n+":":"",i=((n||r>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,n+i+t};let qo=Zd;function eh(s){qo=s}function th(){qo=Zd}function Hi(s,e=s){return qo(s,e)}var MT=Object.freeze({__proto__:null,createTimeRanges:Nt,createTimeRange:Nt,setFormatTime:eh,resetFormatTime:th,formatTime:Hi});function ih(s,e){let t=0,i,n;if(!e)return 0;(!s||!s.length)&&(s=Nt(0,0));for(let r=0;r<s.length;r++)i=s.start(r),n=s.end(r),n>e&&(n=e),t+=n-i;return t/e}function Ne(s){if(s instanceof Ne)return s;typeof s=="number"?this.code=s:typeof s=="string"?this.message=s:Zt(s)&&(typeof s.code=="number"&&(this.code=s.code),Object.assign(this,s)),this.message||(this.message=Ne.defaultMessages[this.code]||"")}Ne.prototype.code=0;Ne.prototype.message="";Ne.prototype.status=null;Ne.prototype.metadata=null;Ne.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];Ne.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."};Ne.MEDIA_ERR_CUSTOM=0;Ne.prototype.MEDIA_ERR_CUSTOM=0;Ne.MEDIA_ERR_ABORTED=1;Ne.prototype.MEDIA_ERR_ABORTED=1;Ne.MEDIA_ERR_NETWORK=2;Ne.prototype.MEDIA_ERR_NETWORK=2;Ne.MEDIA_ERR_DECODE=3;Ne.prototype.MEDIA_ERR_DECODE=3;Ne.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ne.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;Ne.MEDIA_ERR_ENCRYPTED=5;Ne.prototype.MEDIA_ERR_ENCRYPTED=5;function pn(s){return s!=null&&typeof s.then=="function"}function Kt(s){pn(s)&&s.then(null,e=>{})}const ro=function(s){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,n)=>(s[i]&&(t[i]=s[i]),t),{cues:s.cues&&Array.prototype.map.call(s.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},NT=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=ro(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(ro))},UT=function(s,e){return s.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(n=>i.addCue(n))}),e.textTracks()};var Uu={textTracksToJson:NT,jsonToTextTracks:UT,trackToJson_:ro};const Na="vjs-modal-dialog";class Is extends H{constructor(e,t){super(e,t),this.handleKeyDown_=i=>this.handleKeyDown(i),this.close_=i=>this.close(i),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=se("div",{className:`${Na}-content`},{role:"document"}),this.descEl_=se("p",{className:`${Na}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ci(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`${Na} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const n=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=n,this.on(i,"close",this.close_)}!t&&i&&(this.off(i,"close",this.close_),this.removeChild(i),i.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),i=t.parentNode,n=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),jd(t,e),this.trigger("modalfill"),n?i.insertBefore(t,n):i.appendChild(t);const r=this.getChild("closeButton");r&&i.appendChild(r.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Yr(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=K.activeElement,t=this.player_.el_;this.previouslyActiveEl_=null,(t.contains(e)||t===e)&&(this.previouslyActiveEl_=e,this.focus())}conditionalBlur_(){this.previouslyActiveEl_&&(this.previouslyActiveEl_.focus(),this.previouslyActiveEl_=null)}handleKeyDown(e){if(this.trigger({type:"modalKeydown",originalEvent:e,target:this,bubbles:!0}),e.stopPropagation(),e.key==="Escape"&&this.closeable()){e.preventDefault(),this.close();return}if(e.key!=="Tab")return;const t=this.focusableEls_(),i=this.el_.querySelector(":focus");let n;for(let r=0;r<t.length;r++)if(i===t[r]){n=r;break}K.activeElement===this.el_&&(n=0),e.shiftKey&&n===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&n===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof k.HTMLAnchorElement||t instanceof k.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof k.HTMLInputElement||t instanceof k.HTMLSelectElement||t instanceof k.HTMLTextAreaElement||t instanceof k.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof k.HTMLIFrameElement||t instanceof k.HTMLObjectElement||t instanceof k.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Is.prototype.options_={pauseOnOpen:!0,temporary:!0};H.registerComponent("ModalDialog",Is);class bs extends bt{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})},ai(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,n=this.length;i<n;i++)if(this[i]===e){t=this[i],t.off&&t.off(),this.tracks_.splice(i,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let i=0,n=this.length;i<n;i++){const r=this[i];if(r.id===e){t=r;break}}return t}}bs.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const s in bs.prototype.allowedEvents_)bs.prototype["on"+s]=null;const Ua=function(s,e){for(let t=0;t<s.length;t++)!Object.keys(s[t]).length||e.id===s[t].id||(s[t].enabled=!1)};class BT extends bs{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Ua(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Ua(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Ua(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Ba=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 FT extends bs{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Ba(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&&Ba(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Ba(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 sh extends bs{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 $T{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,i=e.length;t<i;t++)this.addTrackElement_(e[t])}addTrackElement_(e){const t=this.trackElements_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.trackElements_[t]}}),this.trackElements_.indexOf(e)===-1&&this.trackElements_.push(e)}getTrackElementByTrack_(e){let t;for(let i=0,n=this.trackElements_.length;i<n;i++)if(e===this.trackElements_[i].track){t=this.trackElements_[i];break}return t}removeTrackElement_(e){for(let t=0,i=this.trackElements_.length;t<i;t++)if(e===this.trackElements_[t]){this.trackElements_[t].track&&typeof this.trackElements_[t].track.off=="function"&&this.trackElements_[t].track.off(),typeof this.trackElements_[t].off=="function"&&this.trackElements_[t].off(),this.trackElements_.splice(t,1);break}}}class Tr{constructor(e){Tr.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=0;const n=e.length;this.cues_=e,this.length_=e.length;const r=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<n)for(i=t;i<n;i++)r.call(this,i)}getCueById(e){let t=null;for(let i=0,n=this.length;i<n;i++){const r=this[i];if(r.id===e){t=r;break}}return t}}const jT={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},VT={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},HT={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Bu={disabled:"disabled",hidden:"hidden",showing:"showing"};class zo extends bt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+At(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const n in t)Object.defineProperty(this,n,{get(){return t[n]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(n){n!==i&&(i=n,this.trigger("labelchange"))}})}}const Wo=function(s){return new URL(s,K.baseURI)},nh=function(s){return new URL(s,K.baseURI).href},Go=function(s){if(typeof s=="string"){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(s);if(t)return t.pop().toLowerCase()}return""},ea=function(s,e=k.location){return Wo(s).origin!==e.origin};var qT=Object.freeze({__proto__:null,parseUrl:Wo,getAbsoluteURL:nh,getFileExtension:Go,isCrossOrigin:ea});const Fu=function(s,e){const t=new k.WebVTT.Parser(k,k.vttjs,k.WebVTT.StringDecoder()),i=[];t.oncue=function(n){e.addCue(n)},t.onparsingerror=function(n){i.push(n)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(s),i.length>0&&(k.console&&k.console.groupCollapsed&&k.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(n=>ue.error(n)),k.console&&k.console.groupEnd&&k.console.groupEnd()),t.flush()},$u=function(s,e){const t={uri:s},i=ea(s);i&&(t.cors=i);const n=e.tech_.crossOrigin()==="use-credentials";n&&(t.withCredentials=n),Zc(t,we(this,function(r,a,l){if(r)return ue.error(r,a);e.loaded_=!0,typeof k.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],h=>{if(h.type==="vttjserror"){ue.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Fu(l,e)}):Fu(l,e)}))};class xn extends zo{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=xe(e,{kind:HT[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=Bu[t.mode]||"disabled";const n=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const r=new Tr(this.cues_),a=new Tr(this.activeCues_);let l=!1;this.timeupdateHandler=we(this,function(f={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const h=()=>{this.stopTracking()};this.tech_.one("dispose",h),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return n},set(){}},mode:{get(){return i},set(f){Bu[f]&&i!==f&&(i=f,!this.preload_&&i!=="disabled"&&this.cues.length===0&&$u(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?r:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const f=this.tech_.currentTime(),m=[];for(let T=0,E=this.cues.length;T<E;T++){const C=this.cues[T];C.startTime<=f&&C.endTime>=f&&m.push(C)}if(l=!1,m.length!==this.activeCues_.length)l=!0;else for(let T=0;T<m.length;T++)this.activeCues_.indexOf(m[T])===-1&&(l=!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")&&$u(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 k.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const n in e)n in t||(t[n]=e[n]);t.id=e.id,t.originalCue_=e}const i=this.tech_.textTracks();for(let n=0;n<i.length;n++)i[n]!==this&&i[n].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const i=this.cues_[t];if(i===e||i.originalCue_&&i.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}xn.prototype.allowedEvents_={cuechange:"cuechange"};class rh extends zo{constructor(e={}){const t=xe(e,{kind:VT[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(n){typeof n!="boolean"||n===i||(i=n,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class ah extends zo{constructor(e={}){const t=xe(e,{kind:jT[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(n){typeof n!="boolean"||n===i||(i=n,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class li extends bt{constructor(e={}){super();let t;const i=new xn(e);this.kind=i.kind,this.src=i.src,this.srclang=i.language,this.label=i.label,this.default=i.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return i}}}),t=li.NONE,i.addEventListener("loadeddata",()=>{t=li.LOADED,this.trigger({type:"load",target:this})})}}li.prototype.allowedEvents_={load:"load"};li.NONE=0;li.LOADING=1;li.LOADED=2;li.ERROR=3;const It={audio:{ListClass:BT,TrackClass:rh,capitalName:"Audio"},video:{ListClass:FT,TrackClass:ah,capitalName:"Video"},text:{ListClass:sh,TrackClass:xn,capitalName:"Text"}};Object.keys(It).forEach(function(s){It[s].getterName=`${s}Tracks`,It[s].privateName=`${s}Tracks_`});const xs={remoteText:{ListClass:sh,TrackClass:xn,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:$T,TrackClass:li,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},rt=Object.assign({},It,xs);xs.names=Object.keys(xs);It.names=Object.keys(It);rt.names=[].concat(xs.names).concat(It.names);function zT(s,e,t,i,n={}){const r=s.textTracks();n.kind=e,t&&(n.label=t),i&&(n.language=i),n.tech=s;const a=new rt.text.TrackClass(n);return r.addTrack(a),a}class oe extends H{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=i=>this.onDurationChange(i),this.trackProgress_=i=>this.trackProgress(i),this.trackCurrentTime_=i=>this.trackCurrentTime(i),this.stopTrackingCurrentTime_=i=>this.stopTrackingCurrentTime(i),this.disposeSourceHandler_=i=>this.disposeSourceHandler(i),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),rt.names.forEach(i=>{const n=rt[i];e&&e[n.getterName]&&(this[n.privateName]=e[n.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(i=>{e[`native${i}Tracks`]===!1&&(this[`featuresNative${i}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new rt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(we(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 Nt(0,0)}bufferedPercent(){return ih(this.buffered(),this.duration_)}stopTrackingProgress(){this.clearInterval(this.progressInterval)}manualTimeUpdatesOn(){this.manualTimeUpdates=!0,this.on("play",this.trackCurrentTime_),this.on("pause",this.stopTrackingCurrentTime_)}manualTimeUpdatesOff(){this.manualTimeUpdates=!1,this.stopTrackingCurrentTime(),this.off("play",this.trackCurrentTime_),this.off("pause",this.stopTrackingCurrentTime_)}trackCurrentTime(){this.currentTimeInterval&&this.stopTrackingCurrentTime(),this.currentTimeInterval=this.setInterval(function(){this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})},250)}stopTrackingCurrentTime(){this.clearInterval(this.currentTimeInterval),this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}dispose(){this.clearTracks(It.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const i=this[`${t}Tracks`]()||[];let n=i.length;for(;n--;){const r=i[n];t==="text"&&this.removeRemoteTextTrack(r),i.removeTrack(r)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new Ne(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Nt(0,0):Nt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){It.names.forEach(e=>{const t=It[e],i=()=>{this.trigger(`${e}trackchange`)},n=this[t.getterName]();n.addEventListener("removetrack",i),n.addEventListener("addtrack",i),this.on("dispose",()=>{n.removeEventListener("removetrack",i),n.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!k.WebVTT)if(K.body.contains(this.el())){if(!this.options_["vtt.js"]&&ys(yu)&&Object.keys(yu).length>0){this.trigger("vttjsloaded");return}const e=K.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}),k.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=l=>e.addTrack(l.track),n=l=>e.removeTrack(l.track);t.on("addtrack",i),t.on("removetrack",n),this.addWebVttScript_();const r=()=>this.trigger("texttrackchange"),a=()=>{r();for(let l=0;l<e.length;l++){const h=e[l];h.removeEventListener("cuechange",r),h.mode==="showing"&&h.addEventListener("cuechange",r)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",i),t.off("removetrack",n),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",r)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return zT(this,e,t,i)}createRemoteTextTrack(e){const t=xe(e,{tech:this});return new xs.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const i=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(i),this.remoteTextTracks().addTrack(i.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(i.track)),i}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=At();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 oe.canPlayType(e.type)}static isTech(e){return e.prototype instanceof oe||e instanceof oe||e===oe}static registerTech(e,t){if(oe.techs_||(oe.techs_={}),!oe.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!oe.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!oe.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=Be(e),oe.techs_[e]=t,oe.techs_[fn(e)]=t,e!=="Tech"&&oe.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(oe.techs_&&oe.techs_[e])return oe.techs_[e];if(e=Be(e),k&&k.videojs&&k.videojs[e])return ue.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),k.videojs[e]}}}rt.names.forEach(function(s){const e=rt[s];oe.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});oe.prototype.featuresVolumeControl=!0;oe.prototype.featuresMuteControl=!0;oe.prototype.featuresFullscreenResize=!1;oe.prototype.featuresPlaybackRate=!1;oe.prototype.featuresProgressEvents=!1;oe.prototype.featuresSourceset=!1;oe.prototype.featuresTimeupdateEvents=!1;oe.prototype.featuresNativeTextTracks=!1;oe.prototype.featuresVideoFrameCallback=!1;oe.withSourceHandlers=function(s){s.registerSourceHandler=function(t,i){let n=s.sourceHandlers;n||(n=s.sourceHandlers=[]),i===void 0&&(i=n.length),n.splice(i,0,t)},s.canPlayType=function(t){const i=s.sourceHandlers||[];let n;for(let r=0;r<i.length;r++)if(n=i[r].canPlayType(t),n)return n;return""},s.selectSourceHandler=function(t,i){const n=s.sourceHandlers||[];let r;for(let a=0;a<n.length;a++)if(r=n[a].canHandleSource(t,i),r)return n[a];return null},s.canPlaySource=function(t,i){const n=s.selectSourceHandler(t,i);return n?n.canHandleSource(t,i):""},["seekable","seeking","duration"].forEach(function(t){const i=this[t];typeof i=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):i.apply(this,arguments)})},s.prototype),s.prototype.setSource=function(t){let i=s.selectSourceHandler(t,this.options_);i||(s.nativeSourceHandler?i=s.nativeSourceHandler:ue.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==s.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},s.prototype.disposeSourceHandler=function(){this.currentSource_&&(this.clearTracks(["audio","video"]),this.currentSource_=null),this.cleanupAutoTextTracks(),this.sourceHandler_&&(this.sourceHandler_.dispose&&this.sourceHandler_.dispose(),this.sourceHandler_=null)}};H.registerComponent("Tech",oe);oe.registerTech("Tech",oe);oe.defaultTechOrder_=[];const $i={},vr={},br={};function WT(s,e){$i[s]=$i[s]||[],$i[s].push(e)}function GT(s,e,t){s.setTimeout(()=>Ri(e,$i[e.type],t,s),1)}function KT(s,e){s.forEach(t=>t.setTech&&t.setTech(e))}function XT(s,e,t){return s.reduceRight(Ko(t),e[t]())}function YT(s,e,t,i){return e[t](s.reduce(Ko(t),i))}function ju(s,e,t,i=null){const n="call"+Be(t),r=s.reduce(Ko(n),i),a=r===br,l=a?null:e[t](r);return ZT(s,t,l,a),l}const QT={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},JT={setCurrentTime:1,setMuted:1,setVolume:1},Vu={play:1,pause:1};function Ko(s){return(e,t)=>e===br?br:t[s]?t[s](e):e}function ZT(s,e,t,i){for(let n=s.length-1;n>=0;n--){const r=s[n];r[e]&&r[e](i,t)}}function ev(s){vr.hasOwnProperty(s.id())&&delete vr[s.id()]}function tv(s,e){const t=vr[s.id()];let i=null;if(t==null)return i=e(s),vr[s.id()]=[[e,i]],i;for(let n=0;n<t.length;n++){const[r,a]=t[n];r===e&&(i=a)}return i===null&&(i=e(s),t.push([e,i])),i}function Ri(s={},e=[],t,i,n=[],r=!1){const[a,...l]=e;if(typeof a=="string")Ri(s,$i[a],t,i,n,r);else if(a){const h=tv(i,a);if(!h.setSource)return n.push(h),Ri(s,l,t,i,n,r);h.setSource(Object.assign({},s),function(f,m){if(f)return Ri(s,l,t,i,n,r);n.push(h),Ri(m,s.type===m.type?l:$i[m.type],t,i,n,r)})}else l.length?Ri(s,l,t,i,n,r):r?t(s,n):Ri(s,$i["*"],t,i,n,!0)}const iv={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"},xr=function(s=""){const e=Go(s);return iv[e.toLowerCase()]||""},sv=(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(n=>n.src===e);if(t.length)return t[0].type;const i=s.$$("source");for(let n=0;n<i.length;n++){const r=i[n];if(r.type&&r.src&&r.src===e)return r.type}return xr(e)},oh=function(s){if(Array.isArray(s)){let e=[];s.forEach(function(t){t=oh(t),Array.isArray(t)?e=e.concat(t):Zt(t)&&e.push(t)}),s=e}else typeof s=="string"&&s.trim()?s=[Hu({src:s})]:Zt(s)&&typeof s.src=="string"&&s.src&&s.src.trim()?s=[Hu(s)]:s=[];return s};function Hu(s){if(!s.type){const e=xr(s.src);e&&(s.type=e)}return s}var nv=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
23
|
+
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const Ev=" ",wo=function(i){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(i||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},Cv=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},ut=function(i){const e={};if(!i)return e;const t=i.split(Cv());let r=t.length,s;for(;r--;)t[r]!==""&&(s=/([^=]*)=(.*)/.exec(t[r]).slice(1),s[0]=s[0].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^\s+|\s+$/g,""),s[1]=s[1].replace(/^['"](.*)['"]$/g,"$1"),e[s[0]]=s[1]);return e},zc=i=>{const e=i.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class Av extends Pl{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,r;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,a)=>{const l=a(e);return l===e?n:n.concat([l])},[e]).forEach(n=>{for(let a=0;a<this.customParsers.length;a++)if(this.customParsers[a].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){r={type:"tag",tagType:"inf"},t[1]&&(r.duration=parseFloat(t[1])),t[2]&&(r.title=t[2]),this.trigger("data",r);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"targetduration"},t[1]&&(r.duration=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"version"},t[1]&&(r.version=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"media-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){r={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(r.number=parseInt(t[1],10)),this.trigger("data",r);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){r={type:"tag",tagType:"playlist-type"},t[1]&&(r.playlistType=t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){r=Ke(wo(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",r);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){r={type:"tag",tagType:"allow-cache"},t[1]&&(r.allowed=!/NO/.test(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(r={type:"tag",tagType:"map"},t[1]){const a=ut(t[1]);a.URI&&(r.uri=a.URI),a.BYTERANGE&&(r.byterange=wo(a.BYTERANGE))}this.trigger("data",r);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"stream-inf"},t[1]&&(r.attributes=ut(t[1]),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=zc(r.attributes.RESOLUTION)),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),r.attributes["PROGRAM-ID"]&&(r.attributes["PROGRAM-ID"]=parseInt(r.attributes["PROGRAM-ID"],10))),this.trigger("data",r);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){r={type:"tag",tagType:"media"},t[1]&&(r.attributes=ut(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){r={type:"tag",tagType:"program-date-time"},t[1]&&(r.dateTimeString=t[1],r.dateTimeObject=new Date(t[1])),this.trigger("data",r);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){r={type:"tag",tagType:"key"},t[1]&&(r.attributes=ut(t[1]),r.attributes.IV&&(r.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(r.attributes.IV=r.attributes.IV.substring(2)),r.attributes.IV=r.attributes.IV.match(/.{8}/g),r.attributes.IV[0]=parseInt(r.attributes.IV[0],16),r.attributes.IV[1]=parseInt(r.attributes.IV[1],16),r.attributes.IV[2]=parseInt(r.attributes.IV[2],16),r.attributes.IV[3]=parseInt(r.attributes.IV[3],16),r.attributes.IV=new Uint32Array(r.attributes.IV))),this.trigger("data",r);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){r={type:"tag",tagType:"start"},t[1]&&(r.attributes=ut(t[1]),r.attributes["TIME-OFFSET"]=parseFloat(r.attributes["TIME-OFFSET"]),r.attributes.PRECISE=/YES/.test(r.attributes.PRECISE)),this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out-cont"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-out"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){r={type:"tag",tagType:"cue-in"},t[1]?r.data=t[1]:r.data="",this.trigger("data",r);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"skip"},r.attributes=ut(t[1]),r.attributes.hasOwnProperty("SKIPPED-SEGMENTS")&&(r.attributes["SKIPPED-SEGMENTS"]=parseInt(r.attributes["SKIPPED-SEGMENTS"],10)),r.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")&&(r.attributes["RECENTLY-REMOVED-DATERANGES"]=r.attributes["RECENTLY-REMOVED-DATERANGES"].split(Ev)),this.trigger("data",r);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part"},r.attributes=ut(t[1]),["DURATION"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseFloat(r.attributes[a]))}),["INDEPENDENT","GAP"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=/YES/.test(r.attributes[a]))}),r.attributes.hasOwnProperty("BYTERANGE")&&(r.attributes.byterange=wo(r.attributes.BYTERANGE)),this.trigger("data",r);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"server-control"},r.attributes=ut(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseFloat(r.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=/YES/.test(r.attributes[a]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"part-inf"},r.attributes=ut(t[1]),["PART-TARGET"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseFloat(r.attributes[a]))}),this.trigger("data",r);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"preload-hint"},r.attributes=ut(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(r.attributes.hasOwnProperty(a)){r.attributes[a]=parseInt(r.attributes[a],10);const l=a==="BYTERANGE-LENGTH"?"length":"offset";r.attributes.byterange=r.attributes.byterange||{},r.attributes.byterange[l]=r.attributes[a],delete r.attributes[a]}}),this.trigger("data",r);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"rendition-report"},r.attributes=ut(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){r.attributes.hasOwnProperty(a)&&(r.attributes[a]=parseInt(r.attributes[a],10))}),this.trigger("data",r);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){r={type:"tag",tagType:"daterange"},r.attributes=ut(t[1]),["ID","CLASS"].forEach(function(l){r.attributes.hasOwnProperty(l)&&(r.attributes[l]=String(r.attributes[l]))}),["START-DATE","END-DATE"].forEach(function(l){r.attributes.hasOwnProperty(l)&&(r.attributes[l]=new Date(r.attributes[l]))}),["DURATION","PLANNED-DURATION"].forEach(function(l){r.attributes.hasOwnProperty(l)&&(r.attributes[l]=parseFloat(r.attributes[l]))}),["END-ON-NEXT"].forEach(function(l){r.attributes.hasOwnProperty(l)&&(r.attributes[l]=/YES/i.test(r.attributes[l]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(l){r.attributes.hasOwnProperty(l)&&(r.attributes[l]=r.attributes[l].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const l in r.attributes){if(!a.test(l))continue;const u=/[0-9A-Fa-f]{6}/g.test(r.attributes[l]),f=/^\d+(\.\d+)?$/.test(r.attributes[l]);r.attributes[l]=u?r.attributes[l].toString(16):f?parseFloat(r.attributes[l]):String(r.attributes[l])}this.trigger("data",r);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){r={type:"tag",tagType:"content-steering"},r.attributes=ut(t[1]),this.trigger("data",r);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){r={type:"tag",tagType:"i-frame-playlist"},r.attributes=ut(t[1]),r.attributes.URI&&(r.uri=r.attributes.URI),r.attributes.BANDWIDTH&&(r.attributes.BANDWIDTH=parseInt(r.attributes.BANDWIDTH,10)),r.attributes.RESOLUTION&&(r.attributes.RESOLUTION=zc(r.attributes.RESOLUTION)),r.attributes["AVERAGE-BANDWIDTH"]&&(r.attributes["AVERAGE-BANDWIDTH"]=parseInt(r.attributes["AVERAGE-BANDWIDTH"],10)),r.attributes["FRAME-RATE"]&&(r.attributes["FRAME-RATE"]=parseFloat(r.attributes["FRAME-RATE"])),this.trigger("data",r);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){r={type:"tag",tagType:"define"},r.attributes=ut(t[1]),this.trigger("data",r);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}addParser({expression:e,customType:t,dataParser:r,segment:s}){typeof r!="function"&&(r=n=>n),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:r(n),customType:t,segment:s}),!0})}addTagMapper({expression:e,map:t}){const r=s=>e.test(s)?t(s):s;this.tagMappers.push(r)}}const wv=i=>i.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),Oi=function(i){const e={};return Object.keys(i).forEach(function(t){e[wv(t)]=i[t]}),e},Do=function(i){const{serverControl:e,targetDuration:t,partTargetDuration:r}=i;if(!e)return;const s="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",l=t&&t*3,u=r&&r*2;t&&!e.hasOwnProperty(n)&&(e[n]=l,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${l}).`})),l&&e[n]<l&&(this.trigger("warn",{message:`${s} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${l})`}),e[n]=l),r&&!e.hasOwnProperty(a)&&(e[a]=r*3,this.trigger("info",{message:`${s} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),r&&e[a]<u&&(this.trigger("warn",{message:`${s} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${u}).`}),e[a]=u)};class Dv extends Pl{constructor(e={}){super(),this.lineStream=new Sv,this.parseStream=new Av,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,r=[];let s={},n,a,l=!1;const u=function(){},f={AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},p="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";let T=0;this.manifest={allowCache:!0,discontinuityStarts:[],dateRanges:[],iFramePlaylists:[],segments:[]};let b=0,S=0;const A={};this.on("end",()=>{s.uri||!s.parts&&!s.preloadHints||(!s.map&&n&&(s.map=n),!s.key&&a&&(s.key=a),!s.timeline&&typeof T=="number"&&(s.timeline=T),this.manifest.preloadSegment=s)}),this.parseStream.on("data",function(v){let L,P;if(t.manifest.definitions){for(const M in t.manifest.definitions)if(v.uri&&(v.uri=v.uri.replace(`{$${M}}`,t.manifest.definitions[M])),v.attributes)for(const O in v.attributes)typeof v.attributes[O]=="string"&&(v.attributes[O]=v.attributes[O].replace(`{$${M}}`,t.manifest.definitions[M]))}({tag(){({version(){v.version&&(this.manifest.version=v.version)},"allow-cache"(){this.manifest.allowCache=v.allowed,"allowed"in v||(this.trigger("info",{message:"defaulting allowCache to YES"}),this.manifest.allowCache=!0)},byterange(){const M={};"length"in v&&(s.byterange=M,M.length=v.length,"offset"in v||(v.offset=b)),"offset"in v&&(s.byterange=M,M.offset=v.offset),b=M.offset+M.length},endlist(){this.manifest.endList=!0},inf(){"mediaSequence"in this.manifest||(this.manifest.mediaSequence=0,this.trigger("info",{message:"defaulting media sequence to zero"})),"discontinuitySequence"in this.manifest||(this.manifest.discontinuitySequence=0,this.trigger("info",{message:"defaulting discontinuity sequence to zero"})),v.title&&(s.title=v.title),v.duration>0&&(s.duration=v.duration),v.duration===0&&(s.duration=.01,this.trigger("info",{message:"updating zero segment duration to a small value"})),this.manifest.segments=r},key(){if(!v.attributes){this.trigger("warn",{message:"ignoring key declaration without attribute list"});return}if(v.attributes.METHOD==="NONE"){a=null;return}if(!v.attributes.URI){this.trigger("warn",{message:"ignoring key declaration without URI"});return}if(v.attributes.KEYFORMAT==="com.apple.streamingkeydelivery"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.apple.fps.1_0"]={attributes:v.attributes};return}if(v.attributes.KEYFORMAT==="com.microsoft.playready"){this.manifest.contentProtection=this.manifest.contentProtection||{},this.manifest.contentProtection["com.microsoft.playready"]={uri:v.attributes.URI};return}if(v.attributes.KEYFORMAT===p){if(["SAMPLE-AES","SAMPLE-AES-CTR","SAMPLE-AES-CENC"].indexOf(v.attributes.METHOD)===-1){this.trigger("warn",{message:"invalid key method provided for Widevine"});return}if(v.attributes.METHOD==="SAMPLE-AES-CENC"&&this.trigger("warn",{message:"SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"}),v.attributes.URI.substring(0,23)!=="data:text/plain;base64,"){this.trigger("warn",{message:"invalid key URI provided for Widevine"});return}if(!(v.attributes.KEYID&&v.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:v.attributes.KEYFORMAT,keyId:v.attributes.KEYID.substring(2)},pssh:Jh(v.attributes.URI.split(",")[1])};return}v.attributes.METHOD||this.trigger("warn",{message:"defaulting key method to AES-128"}),a={method:v.attributes.METHOD||"AES-128",uri:v.attributes.URI},typeof v.attributes.IV<"u"&&(a.iv=v.attributes.IV)},"media-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid media sequence: "+v.number});return}this.manifest.mediaSequence=v.number},"discontinuity-sequence"(){if(!isFinite(v.number)){this.trigger("warn",{message:"ignoring invalid discontinuity sequence: "+v.number});return}this.manifest.discontinuitySequence=v.number,T=v.number},"playlist-type"(){if(!/VOD|EVENT/.test(v.playlistType)){this.trigger("warn",{message:"ignoring unknown playlist type: "+v.playlist});return}this.manifest.playlistType=v.playlistType},map(){n={},v.uri&&(n.uri=v.uri),v.byterange&&(n.byterange=v.byterange),a&&(n.key=a)},"stream-inf"(){if(this.manifest.playlists=r,this.manifest.mediaGroups=this.manifest.mediaGroups||f,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}s.attributes||(s.attributes={}),Ke(s.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||f,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const M=this.manifest.mediaGroups[v.attributes.TYPE];M[v.attributes["GROUP-ID"]]=M[v.attributes["GROUP-ID"]]||{},L=M[v.attributes["GROUP-ID"]],P={default:/yes/i.test(v.attributes.DEFAULT)},P.default?P.autoselect=!0:P.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(P.language=v.attributes.LANGUAGE),v.attributes.URI&&(P.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(P.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(P.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(P.forced=/yes/i.test(v.attributes.FORCED)),L[v.attributes.NAME]=P},discontinuity(){T+=1,s.discontinuity=!0,this.manifest.discontinuityStarts.push(r.length)},"program-date-time"(){typeof this.manifest.dateTimeString>"u"&&(this.manifest.dateTimeString=v.dateTimeString,this.manifest.dateTimeObject=v.dateTimeObject),s.dateTimeString=v.dateTimeString,s.dateTimeObject=v.dateTimeObject;const{lastProgramDateTime:M}=this;this.lastProgramDateTime=new Date(v.dateTimeString).getTime(),M===null&&this.manifest.segments.reduceRight((O,U)=>(U.programDateTime=O-U.duration*1e3,U.programDateTime),this.lastProgramDateTime)},targetduration(){if(!isFinite(v.duration)||v.duration<0){this.trigger("warn",{message:"ignoring invalid target duration: "+v.duration});return}this.manifest.targetDuration=v.duration,Do.call(this,this.manifest)},start(){if(!v.attributes||isNaN(v.attributes["TIME-OFFSET"])){this.trigger("warn",{message:"ignoring start declaration without appropriate attribute list"});return}this.manifest.start={timeOffset:v.attributes["TIME-OFFSET"],precise:v.attributes.PRECISE}},"cue-out"(){s.cueOut=v.data},"cue-out-cont"(){s.cueOutCont=v.data},"cue-in"(){s.cueIn=v.data},skip(){this.manifest.skip=Oi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){l=!0;const M=this.manifest.segments.length,O=Oi(v.attributes);s.parts=s.parts||[],s.parts.push(O),O.byterange&&(O.byterange.hasOwnProperty("offset")||(O.byterange.offset=S),S=O.byterange.offset+O.byterange.length);const U=s.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${U} for segment #${M}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((R,q)=>{R.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${q} lacks required attribute(s): LAST-PART`})})},"server-control"(){const M=this.manifest.serverControl=Oi(v.attributes);M.hasOwnProperty("canBlockReload")||(M.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),Do.call(this,this.manifest),M.canSkipDateranges&&!M.hasOwnProperty("canSkipUntil")&&this.trigger("warn",{message:"#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"})},"preload-hint"(){const M=this.manifest.segments.length,O=Oi(v.attributes),U=O.type&&O.type==="PART";s.preloadHints=s.preloadHints||[],s.preloadHints.push(O),O.byterange&&(O.byterange.hasOwnProperty("offset")||(O.byterange.offset=U?S:0,U&&(S=O.byterange.offset+O.byterange.length)));const R=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${R} for segment #${M}`,v.attributes,["TYPE","URI"]),!!O.type)for(let q=0;q<s.preloadHints.length-1;q++){const Y=s.preloadHints[q];Y.type&&Y.type===O.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${R} for segment #${M} has the same TYPE ${O.type} as preload hint #${q}`})}},"rendition-report"(){const M=Oi(v.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push(M);const O=this.manifest.renditionReports.length-1,U=["LAST-MSN","URI"];l&&U.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${O}`,v.attributes,U)},"part-inf"(){this.manifest.partInf=Oi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",v.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),Do.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push(Oi(v.attributes));const M=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${M}`,v.attributes,["ID","START-DATE"]);const O=this.manifest.dateRanges[M];O.endDate&&O.startDate&&new Date(O.endDate)<new Date(O.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),O.duration&&O.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),O.plannedDuration&&O.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const U=!!O.endOnNext;if(U&&!O.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),U&&(O.duration||O.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),O.duration&&O.endDate){const q=O.startDate.getTime()+O.duration*1e3;this.manifest.dateRanges[M].endDate=new Date(q)}if(!A[O.id])A[O.id]=O;else{for(const q in A[O.id])if(O[q]&&JSON.stringify(A[O.id][q])!==JSON.stringify(O[q])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const R=this.manifest.dateRanges.findIndex(q=>q.id===O.id);this.manifest.dateRanges[R]=Ke(this.manifest.dateRanges[R],O),A[O.id]=Ke(A[O.id],O),this.manifest.dateRanges.pop()}},"independent-segments"(){this.manifest.independentSegments=!0},"i-frames-only"(){this.manifest.iFramesOnly=!0,this.requiredCompatibilityversion(this.manifest.version,4)},"content-steering"(){this.manifest.contentSteering=Oi(v.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",v.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const M=(O,U)=>{if(O in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${O}`});return}this.manifest.definitions[O]=U};if("QUERYPARAM"in v.attributes){if("NAME"in v.attributes||"IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}const O=this.params.get(v.attributes.QUERYPARAM);if(!O){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${v.attributes.QUERYPARAM}`});return}M(v.attributes.QUERYPARAM,decodeURIComponent(O));return}if("NAME"in v.attributes){if("IMPORT"in v.attributes){this.trigger("error",{message:"EXT-X-DEFINE: Invalid attributes"});return}if(!("VALUE"in v.attributes)||typeof v.attributes.VALUE!="string"){this.trigger("error",{message:`EXT-X-DEFINE: No value for ${v.attributes.NAME}`});return}M(v.attributes.NAME,v.attributes.VALUE);return}if("IMPORT"in v.attributes){if(!this.mainDefinitions[v.attributes.IMPORT]){this.trigger("error",{message:`EXT-X-DEFINE: No value ${v.attributes.IMPORT} to import, or IMPORT used on main playlist`});return}M(v.attributes.IMPORT,this.mainDefinitions[v.attributes.IMPORT]);return}this.trigger("error",{message:"EXT-X-DEFINE: No attribute"})},"i-frame-playlist"(){this.manifest.iFramePlaylists.push({attributes:v.attributes,uri:v.uri,timeline:T}),this.warnOnMissingAttributes_("#EXT-X-I-FRAME-STREAM-INF",v.attributes,["BANDWIDTH","URI"])}}[v.tagType]||u).call(t)},uri(){s.uri=v.uri,r.push(s),this.manifest.targetDuration&&!("duration"in s)&&(this.trigger("warn",{message:"defaulting segment duration to the target duration"}),s.duration=this.manifest.targetDuration),a&&(s.key=a),s.timeline=T,n&&(s.map=n),S=0,this.lastProgramDateTime!==null&&(s.programDateTime=this.lastProgramDateTime,this.lastProgramDateTime+=s.duration*1e3),s={}},comment(){},custom(){v.segment?(s.custom=s.custom||{},s.custom[v.customType]=v.data):(this.manifest.custom=this.manifest.custom||{},this.manifest.custom[v.customType]=v.data)}})[v.type].call(t)})}requiredCompatibilityversion(e,t){(e<t||!e)&&this.trigger("warn",{message:`manifest must be at least version ${t}`})}warnOnMissingAttributes_(e,t,r){const s=[];r.forEach(function(n){t.hasOwnProperty(n)||s.push(n)}),s.length&&this.trigger("warn",{message:`${e} lacks required attribute(s): ${s.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 rr={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^/},Iv=["video","audio","text"],Wc=["Video","Audio","Text"],Zh=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,r,s){var n=("00"+Number(r).toString(16)).slice(-2),a=("00"+Number(s).toString(16)).slice(-2);return"avc1."+n+"00"+a})},ti=function(e){e===void 0&&(e="");var t=e.split(","),r=[];return t.forEach(function(s){s=s.trim();var n;Iv.forEach(function(a){var l=rr[a].exec(s.toLowerCase());if(!(!l||l.length<=1)){n=a;var u=s.substring(0,l[1].length),f=s.replace(u,"");r.push({type:u,details:f,mediaType:a})}}),n||r.push({type:s,details:"",mediaType:"unknown"})}),r},kv=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var r=e.mediaGroups.AUDIO[t];if(!r)return null;for(var s in r){var n=r[s];if(n.default&&n.playlists)return ti(n.playlists[0].attributes.CODECS)}return null},ef=function(e){return e===void 0&&(e=""),rr.audio.test(e.trim().toLowerCase())},Pv=function(e){return e===void 0&&(e=""),rr.text.test(e.trim().toLowerCase())},Ur=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return Zh(n.trim())}),r="video";t.length===1&&ef(t[0])?r="audio":t.length===1&&Pv(t[0])&&(r="application");var s="mp4";return t.every(function(n){return rr.mp4.test(n)})?s="mp4":t.every(function(n){return rr.webm.test(n)})?s="webm":t.every(function(n){return rr.ogg.test(n)})&&(s="ogg"),r+"/"+s+';codecs="'+e+'"'}},js=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),k.MediaSource&&k.MediaSource.isTypeSupported&&k.MediaSource.isTypeSupported(Ur(e))||t&&k.ManagedMediaSource&&k.ManagedMediaSource.isTypeSupported&&k.ManagedMediaSource.isTypeSupported(Ur(e))||!1},Io=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var r=0;r<Wc.length;r++){var s=Wc[r];if(rr["muxer"+s].test(t))return!0}return!1})},Gc="mp4a.40.2",Lv="avc1.4d400d",Rv=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Ov=/^application\/dash\+xml/i,tf=function(e){return Rv.test(e)?"hls":Ov.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},Nv=function(e){return e.toString(2).length},Bv=function(e){return Math.ceil(Nv(e)/8)},rf=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Mv=function(e){return rf(e)},se=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!Mv(e)&&!(e instanceof ArrayBuffer)&&(typeof e!="number"||typeof e=="number"&&e!==e?e=0:e=[e]),new Uint8Array(e&&e.buffer||e,e&&e.byteOffset||0,e&&e.byteLength||0))},it=k.BigInt||Number,Xo=[it("0x1"),it("0x100"),it("0x10000"),it("0x1000000"),it("0x100000000"),it("0x10000000000"),it("0x1000000000000"),it("0x100000000000000"),it("0x10000000000000000")];(function(){var i=new Uint16Array([65484]),e=new Uint8Array(i.buffer,i.byteOffset,i.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var Uv=function(e,t){var r=t===void 0?{}:t,s=r.signed,n=s===void 0?!1:s,a=r.le,l=a===void 0?!1:a;e=se(e);var u=l?"reduce":"reduceRight",f=e[u]?e[u]:Array.prototype[u],p=f.call(e,function(b,S,A){var v=l?A:Math.abs(A+1-e.length);return b+it(S)*Xo[v]},it(0));if(n){var T=Xo[e.length]/it(2)-it(1);p=it(p),p>T&&(p-=T,p-=T,p-=it(2))}return Number(p)},Fv=function(e,t){var r={},s=r.le,n=s===void 0?!1:s;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=it(e);for(var a=Bv(e),l=new Uint8Array(new ArrayBuffer(a)),u=0;u<a;u++){var f=n?u:Math.abs(u+1-l.length);l[f]=Number(e/Xo[u]&it(255)),e<0&&(l[f]=Math.abs(~l[f]),l[f]-=u===0?1:2)}return l},sf=function(e,t){if(typeof e!="string"&&e&&typeof e.toString=="function"&&(e=e.toString()),typeof e!="string")return new Uint8Array;t||(e=unescape(encodeURIComponent(e)));for(var r=new Uint8Array(e.length),s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r},$v=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(t=t.filter(function(l){return l&&(l.byteLength||l.length)&&typeof l!="string"}),t.length<=1)return se(t[0]);var s=t.reduce(function(l,u,f){return l+(u.byteLength||u.length)},0),n=new Uint8Array(s),a=0;return t.forEach(function(l){l=se(l),n.set(l,a),a+=l.byteLength}),n},Ue=function(e,t,r){var s=r===void 0?{}:r,n=s.offset,a=n===void 0?0:n,l=s.mask,u=l===void 0?[]:l;e=se(e),t=se(t);var f=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&f.call(t,function(p,T){var b=u[T]?u[T]&e[a+T]:e[a+T];return p===b})},jv=function(e,t,r){t.forEach(function(s){for(var n in e.mediaGroups[s])for(var a in e.mediaGroups[s][n]){var l=e.mediaGroups[s][n][a];r(l,s,n,a)}})},qi={},Ci={};function Vv(i,e,t){if(t===void 0&&(t=Array.prototype),i&&typeof t.find=="function")return t.find.call(i,e);for(var r=0;r<i.length;r++)if(Object.prototype.hasOwnProperty.call(i,r)){var s=i[r];if(e.call(void 0,s,r,i))return s}}function Rl(i,e){return e===void 0&&(e=Object),e&&typeof e.freeze=="function"?e.freeze(i):i}function qv(i,e){if(i===null||typeof i!="object")throw new TypeError("target is not an object");for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&(i[t]=e[t]);return i}var nf=Rl({HTML:"text/html",isHTML:function(i){return i===nf.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),af=Rl({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(i){return i===af.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});Ci.assign=qv;Ci.find=Vv;Ci.freeze=Rl;Ci.MIME_TYPE=nf;Ci.NAMESPACE=af;var of=Ci,li=of.find,Ks=of.NAMESPACE;function Hv(i){return i!==""}function zv(i){return i?i.split(/[\t\n\f\r ]+/).filter(Hv):[]}function Wv(i,e){return i.hasOwnProperty(e)||(i[e]=!0),i}function Kc(i){if(!i)return[];var e=zv(i);return Object.keys(e.reduce(Wv,{}))}function Gv(i){return function(e){return i&&i.indexOf(e)!==-1}}function rn(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function bt(i,e){var t=i.prototype;if(!(t instanceof e)){let r=function(){};r.prototype=e.prototype,r=new r,rn(t,r),i.prototype=t=r}t.constructor!=i&&(typeof i!="function"&&console.error("unknown Class:"+i),t.constructor=i)}var xt={},Bt=xt.ELEMENT_NODE=1,Fr=xt.ATTRIBUTE_NODE=2,ea=xt.TEXT_NODE=3,lf=xt.CDATA_SECTION_NODE=4,uf=xt.ENTITY_REFERENCE_NODE=5,Kv=xt.ENTITY_NODE=6,cf=xt.PROCESSING_INSTRUCTION_NODE=7,df=xt.COMMENT_NODE=8,hf=xt.DOCUMENT_NODE=9,ff=xt.DOCUMENT_TYPE_NODE=10,xi=xt.DOCUMENT_FRAGMENT_NODE=11,Xv=xt.NOTATION_NODE=12,ot={},tt={};ot.INDEX_SIZE_ERR=(tt[1]="Index size error",1);ot.DOMSTRING_SIZE_ERR=(tt[2]="DOMString size error",2);var yt=ot.HIERARCHY_REQUEST_ERR=(tt[3]="Hierarchy request error",3);ot.WRONG_DOCUMENT_ERR=(tt[4]="Wrong document",4);ot.INVALID_CHARACTER_ERR=(tt[5]="Invalid character",5);ot.NO_DATA_ALLOWED_ERR=(tt[6]="No data allowed",6);ot.NO_MODIFICATION_ALLOWED_ERR=(tt[7]="No modification allowed",7);var pf=ot.NOT_FOUND_ERR=(tt[8]="Not found",8);ot.NOT_SUPPORTED_ERR=(tt[9]="Not supported",9);var Xc=ot.INUSE_ATTRIBUTE_ERR=(tt[10]="Attribute in use",10);ot.INVALID_STATE_ERR=(tt[11]="Invalid state",11);ot.SYNTAX_ERR=(tt[12]="Syntax error",12);ot.INVALID_MODIFICATION_ERR=(tt[13]="Invalid modification",13);ot.NAMESPACE_ERR=(tt[14]="Invalid namespace",14);ot.INVALID_ACCESS_ERR=(tt[15]="Invalid access",15);function Ge(i,e){if(e instanceof Error)var t=e;else t=this,Error.call(this,tt[i]),this.message=tt[i],Error.captureStackTrace&&Error.captureStackTrace(this,Ge);return t.code=i,e&&(this.message=this.message+": "+e),t}Ge.prototype=Error.prototype;rn(ot,Ge);function Ti(){}Ti.prototype={length:0,item:function(i){return i>=0&&i<this.length?this[i]:null},toString:function(i,e){for(var t=[],r=0;r<this.length;r++)Ar(this[r],t,i,e);return t.join("")},filter:function(i){return Array.prototype.filter.call(this,i)},indexOf:function(i){return Array.prototype.indexOf.call(this,i)}};function $r(i,e){this._node=i,this._refresh=e,Ol(this)}function Ol(i){var e=i._node._inc||i._node.ownerDocument._inc;if(i._inc!==e){var t=i._refresh(i._node);if(Af(i,"length",t.length),!i.$$length||t.length<i.$$length)for(var r=t.length;r in i;r++)Object.prototype.hasOwnProperty.call(i,r)&&delete i[r];rn(t,i),i._inc=e}}$r.prototype.item=function(i){return Ol(this),this[i]||null};bt($r,Ti);function ta(){}function mf(i,e){for(var t=i.length;t--;)if(i[t]===e)return t}function Yc(i,e,t,r){if(r?e[mf(e,r)]=t:e[e.length++]=t,i){t.ownerElement=i;var s=i.ownerDocument;s&&(r&&_f(s,i,r),Yv(s,i,t))}}function Qc(i,e,t){var r=mf(e,t);if(r>=0){for(var s=e.length-1;r<s;)e[r]=e[++r];if(e.length=s,i){var n=i.ownerDocument;n&&(_f(n,i,t),t.ownerElement=null)}}else throw new Ge(pf,new Error(i.tagName+"@"+t))}ta.prototype={length:0,item:Ti.prototype.item,getNamedItem:function(i){for(var e=this.length;e--;){var t=this[e];if(t.nodeName==i)return t}},setNamedItem:function(i){var e=i.ownerElement;if(e&&e!=this._ownerElement)throw new Ge(Xc);var t=this.getNamedItem(i.nodeName);return Yc(this._ownerElement,this,i,t),t},setNamedItemNS:function(i){var e=i.ownerElement,t;if(e&&e!=this._ownerElement)throw new Ge(Xc);return t=this.getNamedItemNS(i.namespaceURI,i.localName),Yc(this._ownerElement,this,i,t),t},removeNamedItem:function(i){var e=this.getNamedItem(i);return Qc(this._ownerElement,this,e),e},removeNamedItemNS:function(i,e){var t=this.getNamedItemNS(i,e);return Qc(this._ownerElement,this,t),t},getNamedItemNS:function(i,e){for(var t=this.length;t--;){var r=this[t];if(r.localName==e&&r.namespaceURI==i)return r}return null}};function gf(){}gf.prototype={hasFeature:function(i,e){return!0},createDocument:function(i,e,t){var r=new sn;if(r.implementation=this,r.childNodes=new Ti,r.doctype=t||null,t&&r.appendChild(t),e){var s=r.createElementNS(i,e);r.appendChild(s)}return r},createDocumentType:function(i,e,t){var r=new La;return r.name=i,r.nodeName=i,r.publicId=e||"",r.systemId=t||"",r}};function Ee(){}Ee.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(i,e){return ia(this,i,e)},replaceChild:function(i,e){ia(this,i,e,vf),e&&this.removeChild(e)},removeChild:function(i){return Tf(this,i)},appendChild:function(i){return this.insertBefore(i,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(i){return Yo(this.ownerDocument||this,this,i)},normalize:function(){for(var i=this.firstChild;i;){var e=i.nextSibling;e&&e.nodeType==ea&&i.nodeType==ea?(this.removeChild(e),i.appendData(e.data)):(i.normalize(),i=e)}},isSupported:function(i,e){return this.ownerDocument.implementation.hasFeature(i,e)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(i){for(var e=this;e;){var t=e._nsMap;if(t){for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&t[r]===i)return r}e=e.nodeType==Fr?e.ownerDocument:e.parentNode}return null},lookupNamespaceURI:function(i){for(var e=this;e;){var t=e._nsMap;if(t&&Object.prototype.hasOwnProperty.call(t,i))return t[i];e=e.nodeType==Fr?e.ownerDocument:e.parentNode}return null},isDefaultNamespace:function(i){var e=this.lookupPrefix(i);return e==null}};function yf(i){return i=="<"&&"<"||i==">"&&">"||i=="&"&&"&"||i=='"'&&"""||"&#"+i.charCodeAt()+";"}rn(xt,Ee);rn(xt,Ee.prototype);function Xs(i,e){if(e(i))return!0;if(i=i.firstChild)do if(Xs(i,e))return!0;while(i=i.nextSibling)}function sn(){this.ownerDocument=this}function Yv(i,e,t){i&&i._inc++;var r=t.namespaceURI;r===Ks.XMLNS&&(e._nsMap[t.prefix?t.localName:""]=t.value)}function _f(i,e,t,r){i&&i._inc++;var s=t.namespaceURI;s===Ks.XMLNS&&delete e._nsMap[t.prefix?t.localName:""]}function Nl(i,e,t){if(i&&i._inc){i._inc++;var r=e.childNodes;if(t)r[r.length++]=t;else{for(var s=e.firstChild,n=0;s;)r[n++]=s,s=s.nextSibling;r.length=n,delete r[r.length]}}}function Tf(i,e){var t=e.previousSibling,r=e.nextSibling;return t?t.nextSibling=r:i.firstChild=r,r?r.previousSibling=t:i.lastChild=t,e.parentNode=null,e.previousSibling=null,e.nextSibling=null,Nl(i.ownerDocument,i),e}function Qv(i){return i&&(i.nodeType===Ee.DOCUMENT_NODE||i.nodeType===Ee.DOCUMENT_FRAGMENT_NODE||i.nodeType===Ee.ELEMENT_NODE)}function Jv(i){return i&&(ui(i)||Bl(i)||Si(i)||i.nodeType===Ee.DOCUMENT_FRAGMENT_NODE||i.nodeType===Ee.COMMENT_NODE||i.nodeType===Ee.PROCESSING_INSTRUCTION_NODE)}function Si(i){return i&&i.nodeType===Ee.DOCUMENT_TYPE_NODE}function ui(i){return i&&i.nodeType===Ee.ELEMENT_NODE}function Bl(i){return i&&i.nodeType===Ee.TEXT_NODE}function Jc(i,e){var t=i.childNodes||[];if(li(t,ui)||Si(e))return!1;var r=li(t,Si);return!(e&&r&&t.indexOf(r)>t.indexOf(e))}function Zc(i,e){var t=i.childNodes||[];function r(n){return ui(n)&&n!==e}if(li(t,r))return!1;var s=li(t,Si);return!(e&&s&&t.indexOf(s)>t.indexOf(e))}function Zv(i,e,t){if(!Qv(i))throw new Ge(yt,"Unexpected parent node type "+i.nodeType);if(t&&t.parentNode!==i)throw new Ge(pf,"child not in parent");if(!Jv(e)||Si(e)&&i.nodeType!==Ee.DOCUMENT_NODE)throw new Ge(yt,"Unexpected node type "+e.nodeType+" for parent node type "+i.nodeType)}function eb(i,e,t){var r=i.childNodes||[],s=e.childNodes||[];if(e.nodeType===Ee.DOCUMENT_FRAGMENT_NODE){var n=s.filter(ui);if(n.length>1||li(s,Bl))throw new Ge(yt,"More than one element or text in fragment");if(n.length===1&&!Jc(i,t))throw new Ge(yt,"Element in fragment can not be inserted before doctype")}if(ui(e)&&!Jc(i,t))throw new Ge(yt,"Only one element can be added and only after doctype");if(Si(e)){if(li(r,Si))throw new Ge(yt,"Only one doctype is allowed");var a=li(r,ui);if(t&&r.indexOf(a)<r.indexOf(t))throw new Ge(yt,"Doctype can only be inserted before an element");if(!t&&a)throw new Ge(yt,"Doctype can not be appended since element is present")}}function vf(i,e,t){var r=i.childNodes||[],s=e.childNodes||[];if(e.nodeType===Ee.DOCUMENT_FRAGMENT_NODE){var n=s.filter(ui);if(n.length>1||li(s,Bl))throw new Ge(yt,"More than one element or text in fragment");if(n.length===1&&!Zc(i,t))throw new Ge(yt,"Element in fragment can not be inserted before doctype")}if(ui(e)&&!Zc(i,t))throw new Ge(yt,"Only one element can be added and only after doctype");if(Si(e)){if(li(r,function(u){return Si(u)&&u!==t}))throw new Ge(yt,"Only one doctype is allowed");var a=li(r,ui);if(t&&r.indexOf(a)<r.indexOf(t))throw new Ge(yt,"Doctype can only be inserted before an element")}}function ia(i,e,t,r){Zv(i,e,t),i.nodeType===Ee.DOCUMENT_NODE&&(r||eb)(i,e,t);var s=e.parentNode;if(s&&s.removeChild(e),e.nodeType===xi){var n=e.firstChild;if(n==null)return e;var a=e.lastChild}else n=a=e;var l=t?t.previousSibling:i.lastChild;n.previousSibling=l,a.nextSibling=t,l?l.nextSibling=n:i.firstChild=n,t==null?i.lastChild=a:t.previousSibling=a;do{n.parentNode=i;var u=i.ownerDocument||i;Ys(n,u)}while(n!==a&&(n=n.nextSibling));return Nl(i.ownerDocument||i,i),e.nodeType==xi&&(e.firstChild=e.lastChild=null),e}function Ys(i,e){if(i.ownerDocument!==e){if(i.ownerDocument=e,i.nodeType===Bt&&i.attributes)for(var t=0;t<i.attributes.length;t++){var r=i.attributes.item(t);r&&(r.ownerDocument=e)}for(var s=i.firstChild;s;)Ys(s,e),s=s.nextSibling}}function tb(i,e){e.parentNode&&e.parentNode.removeChild(e),e.parentNode=i,e.previousSibling=i.lastChild,e.nextSibling=null,e.previousSibling?e.previousSibling.nextSibling=e:i.firstChild=e,i.lastChild=e,Nl(i.ownerDocument,i,e);var t=i.ownerDocument||i;return Ys(e,t),e}sn.prototype={nodeName:"#document",nodeType:hf,doctype:null,documentElement:null,_inc:1,insertBefore:function(i,e){if(i.nodeType==xi){for(var t=i.firstChild;t;){var r=t.nextSibling;this.insertBefore(t,e),t=r}return i}return ia(this,i,e),Ys(i,this),this.documentElement===null&&i.nodeType===Bt&&(this.documentElement=i),i},removeChild:function(i){return this.documentElement==i&&(this.documentElement=null),Tf(this,i)},replaceChild:function(i,e){ia(this,i,e,vf),Ys(i,this),e&&this.removeChild(e),ui(i)&&(this.documentElement=i)},importNode:function(i,e){return Cf(this,i,e)},getElementById:function(i){var e=null;return Xs(this.documentElement,function(t){if(t.nodeType==Bt&&t.getAttribute("id")==i)return e=t,!0}),e},getElementsByClassName:function(i){var e=Kc(i);return new $r(this,function(t){var r=[];return e.length>0&&Xs(t.documentElement,function(s){if(s!==t&&s.nodeType===Bt){var n=s.getAttribute("class");if(n){var a=i===n;if(!a){var l=Kc(n);a=e.every(Gv(l))}a&&r.push(s)}}}),r})},createElement:function(i){var e=new lr;e.ownerDocument=this,e.nodeName=i,e.tagName=i,e.localName=i,e.childNodes=new Ti;var t=e.attributes=new ta;return t._ownerElement=e,e},createDocumentFragment:function(){var i=new Ra;return i.ownerDocument=this,i.childNodes=new Ti,i},createTextNode:function(i){var e=new Ml;return e.ownerDocument=this,e.appendData(i),e},createComment:function(i){var e=new Ul;return e.ownerDocument=this,e.appendData(i),e},createCDATASection:function(i){var e=new Fl;return e.ownerDocument=this,e.appendData(i),e},createProcessingInstruction:function(i,e){var t=new jl;return t.ownerDocument=this,t.tagName=t.nodeName=t.target=i,t.nodeValue=t.data=e,t},createAttribute:function(i){var e=new ra;return e.ownerDocument=this,e.name=i,e.nodeName=i,e.localName=i,e.specified=!0,e},createEntityReference:function(i){var e=new $l;return e.ownerDocument=this,e.nodeName=i,e},createElementNS:function(i,e){var t=new lr,r=e.split(":"),s=t.attributes=new ta;return t.childNodes=new Ti,t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.namespaceURI=i,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,s._ownerElement=t,t},createAttributeNS:function(i,e){var t=new ra,r=e.split(":");return t.ownerDocument=this,t.nodeName=e,t.name=e,t.namespaceURI=i,t.specified=!0,r.length==2?(t.prefix=r[0],t.localName=r[1]):t.localName=e,t}};bt(sn,Ee);function lr(){this._nsMap={}}lr.prototype={nodeType:Bt,hasAttribute:function(i){return this.getAttributeNode(i)!=null},getAttribute:function(i){var e=this.getAttributeNode(i);return e&&e.value||""},getAttributeNode:function(i){return this.attributes.getNamedItem(i)},setAttribute:function(i,e){var t=this.ownerDocument.createAttribute(i);t.value=t.nodeValue=""+e,this.setAttributeNode(t)},removeAttribute:function(i){var e=this.getAttributeNode(i);e&&this.removeAttributeNode(e)},appendChild:function(i){return i.nodeType===xi?this.insertBefore(i,null):tb(this,i)},setAttributeNode:function(i){return this.attributes.setNamedItem(i)},setAttributeNodeNS:function(i){return this.attributes.setNamedItemNS(i)},removeAttributeNode:function(i){return this.attributes.removeNamedItem(i.nodeName)},removeAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);t&&this.removeAttributeNode(t)},hasAttributeNS:function(i,e){return this.getAttributeNodeNS(i,e)!=null},getAttributeNS:function(i,e){var t=this.getAttributeNodeNS(i,e);return t&&t.value||""},setAttributeNS:function(i,e,t){var r=this.ownerDocument.createAttributeNS(i,e);r.value=r.nodeValue=""+t,this.setAttributeNode(r)},getAttributeNodeNS:function(i,e){return this.attributes.getNamedItemNS(i,e)},getElementsByTagName:function(i){return new $r(this,function(e){var t=[];return Xs(e,function(r){r!==e&&r.nodeType==Bt&&(i==="*"||r.tagName==i)&&t.push(r)}),t})},getElementsByTagNameNS:function(i,e){return new $r(this,function(t){var r=[];return Xs(t,function(s){s!==t&&s.nodeType===Bt&&(i==="*"||s.namespaceURI===i)&&(e==="*"||s.localName==e)&&r.push(s)}),r})}};sn.prototype.getElementsByTagName=lr.prototype.getElementsByTagName;sn.prototype.getElementsByTagNameNS=lr.prototype.getElementsByTagNameNS;bt(lr,Ee);function ra(){}ra.prototype.nodeType=Fr;bt(ra,Ee);function nn(){}nn.prototype={data:"",substringData:function(i,e){return this.data.substring(i,i+e)},appendData:function(i){i=this.data+i,this.nodeValue=this.data=i,this.length=i.length},insertData:function(i,e){this.replaceData(i,0,e)},appendChild:function(i){throw new Error(tt[yt])},deleteData:function(i,e){this.replaceData(i,e,"")},replaceData:function(i,e,t){var r=this.data.substring(0,i),s=this.data.substring(i+e);t=r+t+s,this.nodeValue=this.data=t,this.length=t.length}};bt(nn,Ee);function Ml(){}Ml.prototype={nodeName:"#text",nodeType:ea,splitText:function(i){var e=this.data,t=e.substring(i);e=e.substring(0,i),this.data=this.nodeValue=e,this.length=e.length;var r=this.ownerDocument.createTextNode(t);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}};bt(Ml,nn);function Ul(){}Ul.prototype={nodeName:"#comment",nodeType:df};bt(Ul,nn);function Fl(){}Fl.prototype={nodeName:"#cdata-section",nodeType:lf};bt(Fl,nn);function La(){}La.prototype.nodeType=ff;bt(La,Ee);function bf(){}bf.prototype.nodeType=Xv;bt(bf,Ee);function xf(){}xf.prototype.nodeType=Kv;bt(xf,Ee);function $l(){}$l.prototype.nodeType=uf;bt($l,Ee);function Ra(){}Ra.prototype.nodeName="#document-fragment";Ra.prototype.nodeType=xi;bt(Ra,Ee);function jl(){}jl.prototype.nodeType=cf;bt(jl,Ee);function Sf(){}Sf.prototype.serializeToString=function(i,e,t){return Ef.call(i,e,t)};Ee.prototype.toString=Ef;function Ef(i,e){var t=[],r=this.nodeType==9&&this.documentElement||this,s=r.prefix,n=r.namespaceURI;if(n&&s==null){var s=r.lookupPrefix(n);if(s==null)var a=[{namespace:n,prefix:null}]}return Ar(this,t,i,e,a),t.join("")}function ed(i,e,t){var r=i.prefix||"",s=i.namespaceURI;if(!s||r==="xml"&&s===Ks.XML||s===Ks.XMLNS)return!1;for(var n=t.length;n--;){var a=t[n];if(a.prefix===r)return a.namespace!==s}return!0}function ko(i,e,t){i.push(" ",e,'="',t.replace(/[<>&"\t\n\r]/g,yf),'"')}function Ar(i,e,t,r,s){if(s||(s=[]),r)if(i=r(i),i){if(typeof i=="string"){e.push(i);return}}else return;switch(i.nodeType){case Bt:var n=i.attributes,a=n.length,P=i.firstChild,l=i.tagName;t=Ks.isHTML(i.namespaceURI)||t;var u=l;if(!t&&!i.prefix&&i.namespaceURI){for(var f,p=0;p<n.length;p++)if(n.item(p).name==="xmlns"){f=n.item(p).value;break}if(!f)for(var T=s.length-1;T>=0;T--){var b=s[T];if(b.prefix===""&&b.namespace===i.namespaceURI){f=b.namespace;break}}if(f!==i.namespaceURI)for(var T=s.length-1;T>=0;T--){var b=s[T];if(b.namespace===i.namespaceURI){b.prefix&&(u=b.prefix+":"+l);break}}}e.push("<",u);for(var S=0;S<a;S++){var A=n.item(S);A.prefix=="xmlns"?s.push({prefix:A.localName,namespace:A.value}):A.nodeName=="xmlns"&&s.push({prefix:"",namespace:A.value})}for(var S=0;S<a;S++){var A=n.item(S);if(ed(A,t,s)){var v=A.prefix||"",L=A.namespaceURI;ko(e,v?"xmlns:"+v:"xmlns",L),s.push({prefix:v,namespace:L})}Ar(A,e,t,r,s)}if(l===u&&ed(i,t,s)){var v=i.prefix||"",L=i.namespaceURI;ko(e,v?"xmlns:"+v:"xmlns",L),s.push({prefix:v,namespace:L})}if(P||t&&!/^(?:meta|link|img|br|hr|input)$/i.test(l)){if(e.push(">"),t&&/^script$/i.test(l))for(;P;)P.data?e.push(P.data):Ar(P,e,t,r,s.slice()),P=P.nextSibling;else for(;P;)Ar(P,e,t,r,s.slice()),P=P.nextSibling;e.push("</",u,">")}else e.push("/>");return;case hf:case xi:for(var P=i.firstChild;P;)Ar(P,e,t,r,s.slice()),P=P.nextSibling;return;case Fr:return ko(e,i.name,i.value);case ea:return e.push(i.data.replace(/[<&>]/g,yf));case lf:return e.push("<![CDATA[",i.data,"]]>");case df:return e.push("<!--",i.data,"-->");case ff:var M=i.publicId,O=i.systemId;if(e.push("<!DOCTYPE ",i.name),M)e.push(" PUBLIC ",M),O&&O!="."&&e.push(" ",O),e.push(">");else if(O&&O!=".")e.push(" SYSTEM ",O,">");else{var U=i.internalSubset;U&&e.push(" [",U,"]"),e.push(">")}return;case cf:return e.push("<?",i.target," ",i.data,"?>");case uf:return e.push("&",i.nodeName,";");default:e.push("??",i.nodeName)}}function Cf(i,e,t){var r;switch(e.nodeType){case Bt:r=e.cloneNode(!1),r.ownerDocument=i;case xi:break;case Fr:t=!0;break}if(r||(r=e.cloneNode(!1)),r.ownerDocument=i,r.parentNode=null,t)for(var s=e.firstChild;s;)r.appendChild(Cf(i,s,t)),s=s.nextSibling;return r}function Yo(i,e,t){var r=new e.constructor;for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){var n=e[s];typeof n!="object"&&n!=r[s]&&(r[s]=n)}switch(e.childNodes&&(r.childNodes=new Ti),r.ownerDocument=i,r.nodeType){case Bt:var a=e.attributes,l=r.attributes=new ta,u=a.length;l._ownerElement=r;for(var f=0;f<u;f++)r.setAttributeNode(Yo(i,a.item(f),!0));break;case Fr:t=!0}if(t)for(var p=e.firstChild;p;)r.appendChild(Yo(i,p,t)),p=p.nextSibling;return r}function Af(i,e,t){i[e]=t}try{if(Object.defineProperty){let i=function(e){switch(e.nodeType){case Bt:case xi:var t=[];for(e=e.firstChild;e;)e.nodeType!==7&&e.nodeType!==8&&t.push(i(e)),e=e.nextSibling;return t.join("");default:return e.nodeValue}};Object.defineProperty($r.prototype,"length",{get:function(){return Ol(this),this.$$length}}),Object.defineProperty(Ee.prototype,"textContent",{get:function(){return i(this)},set:function(e){switch(this.nodeType){case Bt:case xi: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}}}),Af=function(e,t,r){e["$$"+t]=r}}}catch{}qi.DocumentType=La;qi.DOMException=Ge;qi.DOMImplementation=gf;qi.Element=lr;qi.Node=Ee;qi.NodeList=Ti;qi.XMLSerializer=Sf;var Oa={},wf={};(function(i){var e=Ci.freeze;i.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),i.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:""}),i.entityMap=i.HTML_ENTITIES})(wf);var Vl={},Qs=Ci.NAMESPACE,Qo=/[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]/,td=new RegExp("[\\-\\.0-9"+Qo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),id=new RegExp("^"+Qo.source+td.source+"*(?::"+Qo.source+td.source+"*)?$"),ws=0,Ni=1,_r=2,Ds=3,Tr=4,vr=5,Is=6,$n=7;function jr(i,e){this.message=i,this.locator=e,Error.captureStackTrace&&Error.captureStackTrace(this,jr)}jr.prototype=new Error;jr.prototype.name=jr.name;function Df(){}Df.prototype={parse:function(i,e,t){var r=this.domBuilder;r.startDocument(),If(e,e={}),ib(i,e,t,r,this.errorHandler),r.endDocument()}};function ib(i,e,t,r,s){function n(de){if(de>65535){de-=65536;var ve=55296+(de>>10),Ve=56320+(de&1023);return String.fromCharCode(ve,Ve)}else return String.fromCharCode(de)}function a(de){var ve=de.slice(1,-1);return Object.hasOwnProperty.call(t,ve)?t[ve]:ve.charAt(0)==="#"?n(parseInt(ve.substr(1).replace("x","0x"))):(s.error("entity not found:"+de),de)}function l(de){if(de>v){var ve=i.substring(v,de).replace(/&#?\w+;/g,a);b&&u(v),r.characters(ve,0,de-v),v=de}}function u(de,ve){for(;de>=p&&(ve=T.exec(i));)f=ve.index,p=f+ve[0].length,b.lineNumber++;b.columnNumber=de-f+1}for(var f=0,p=0,T=/.*(?:\r\n?|\n)|.*$/g,b=r.locator,S=[{currentNSMap:e}],A={},v=0;;){try{var L=i.indexOf("<",v);if(L<0){if(!i.substr(v).match(/^\s*$/)){var P=r.doc,M=P.createTextNode(i.substr(v));P.appendChild(M),r.currentElement=M}return}switch(L>v&&l(L),i.charAt(L+1)){case"/":var le=i.indexOf(">",L+3),O=i.substring(L+2,le).replace(/[ \t\n\r]+$/g,""),U=S.pop();le<0?(O=i.substring(L+2).replace(/[\s<].*/,""),s.error("end tag name: "+O+" is not complete:"+U.tagName),le=L+1+O.length):O.match(/\s</)&&(O=O.replace(/[\s<].*/,""),s.error("end tag name: "+O+" maybe not complete"),le=L+1+O.length);var R=U.localNSMap,q=U.tagName==O,Y=q||U.tagName&&U.tagName.toLowerCase()==O.toLowerCase();if(Y){if(r.endElement(U.uri,U.localName,O),R)for(var K in R)Object.prototype.hasOwnProperty.call(R,K)&&r.endPrefixMapping(K);q||s.fatalError("end tag name: "+O+" is not match the current start tagName:"+U.tagName)}else S.push(U);le++;break;case"?":b&&u(L),le=ob(i,L,r);break;case"!":b&&u(L),le=ab(i,L,r,s);break;default:b&&u(L);var ie=new kf,me=S[S.length-1].currentNSMap,le=rb(i,L,ie,me,a,s),ge=ie.length;if(!ie.closed&&nb(i,le,ie.tagName,A)&&(ie.closed=!0,t.nbsp||s.warning("unclosed xml attribute")),b&&ge){for(var ee=rd(b,{}),ce=0;ce<ge;ce++){var te=ie[ce];u(te.offset),te.locator=rd(b,{})}r.locator=ee,sd(ie,r,me)&&S.push(ie),r.locator=b}else sd(ie,r,me)&&S.push(ie);Qs.isHTML(ie.uri)&&!ie.closed?le=sb(i,le,ie.tagName,a,r):le++}}catch(de){if(de instanceof jr)throw de;s.error("element parse error: "+de),le=-1}le>v?v=le:l(Math.max(L,v)+1)}}function rd(i,e){return e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber,e}function rb(i,e,t,r,s,n){function a(b,S,A){t.attributeNames.hasOwnProperty(b)&&n.fatalError("Attribute "+b+" redefined"),t.addValue(b,S.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),A)}for(var l,u,f=++e,p=ws;;){var T=i.charAt(f);switch(T){case"=":if(p===Ni)l=i.slice(e,f),p=Ds;else if(p===_r)p=Ds;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(p===Ds||p===Ni)if(p===Ni&&(n.warning('attribute value must after "="'),l=i.slice(e,f)),e=f+1,f=i.indexOf(T,e),f>0)u=i.slice(e,f),a(l,u,e-1),p=vr;else throw new Error("attribute value no end '"+T+"' match");else if(p==Tr)u=i.slice(e,f),a(l,u,e),n.warning('attribute "'+l+'" missed start quot('+T+")!!"),e=f+1,p=vr;else throw new Error('attribute value must after "="');break;case"/":switch(p){case ws:t.setTagName(i.slice(e,f));case vr:case Is:case $n:p=$n,t.closed=!0;case Tr:case Ni:break;case _r:t.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),p==ws&&t.setTagName(i.slice(e,f)),f;case">":switch(p){case ws:t.setTagName(i.slice(e,f));case vr:case Is:case $n:break;case Tr:case Ni:u=i.slice(e,f),u.slice(-1)==="/"&&(t.closed=!0,u=u.slice(0,-1));case _r:p===_r&&(u=l),p==Tr?(n.warning('attribute "'+u+'" missed quot(")!'),a(l,u,e)):((!Qs.isHTML(r[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,e));break;case Ds:throw new Error("attribute value missed!!")}return f;case"":T=" ";default:if(T<=" ")switch(p){case ws:t.setTagName(i.slice(e,f)),p=Is;break;case Ni:l=i.slice(e,f),p=_r;break;case Tr:var u=i.slice(e,f);n.warning('attribute "'+u+'" missed quot(")!!'),a(l,u,e);case vr:p=Is;break}else switch(p){case _r:t.tagName,(!Qs.isHTML(r[""])||!l.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+l+'" missed value!! "'+l+'" instead2!!'),a(l,l,e),e=f,p=Ni;break;case vr:n.warning('attribute space is required"'+l+'"!!');case Is:p=Ni,e=f;break;case Ds:p=Tr,e=f;break;case $n:throw new Error("elements closed character '/' and '>' must be connected to")}}f++}}function sd(i,e,t){for(var r=i.tagName,s=null,T=i.length;T--;){var n=i[T],a=n.qName,l=n.value,b=a.indexOf(":");if(b>0)var u=n.prefix=a.slice(0,b),f=a.slice(b+1),p=u==="xmlns"&&f;else f=a,u=null,p=a==="xmlns"&&"";n.localName=f,p!==!1&&(s==null&&(s={},If(t,t={})),t[p]=s[p]=l,n.uri=Qs.XMLNS,e.startPrefixMapping(p,l))}for(var T=i.length;T--;){n=i[T];var u=n.prefix;u&&(u==="xml"&&(n.uri=Qs.XML),u!=="xmlns"&&(n.uri=t[u||""]))}var b=r.indexOf(":");b>0?(u=i.prefix=r.slice(0,b),f=i.localName=r.slice(b+1)):(u=null,f=i.localName=r);var S=i.uri=t[u||""];if(e.startElement(S,f,r,i),i.closed){if(e.endElement(S,f,r),s)for(u in s)Object.prototype.hasOwnProperty.call(s,u)&&e.endPrefixMapping(u)}else return i.currentNSMap=t,i.localNSMap=s,!0}function sb(i,e,t,r,s){if(/^(?:script|textarea)$/i.test(t)){var n=i.indexOf("</"+t+">",e),a=i.substring(e+1,n);if(/[&<]/.test(a))return/^script$/i.test(t)?(s.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,r),s.characters(a,0,a.length),n)}return e+1}function nb(i,e,t,r){var s=r[t];return s==null&&(s=i.lastIndexOf("</"+t+">"),s<e&&(s=i.lastIndexOf("</"+t)),r[t]=s),s<e}function If(i,e){for(var t in i)Object.prototype.hasOwnProperty.call(i,t)&&(e[t]=i[t])}function ab(i,e,t,r){var s=i.charAt(e+2);switch(s){case"-":if(i.charAt(e+3)==="-"){var n=i.indexOf("-->",e+4);return n>e?(t.comment(i,e+4,n-e-4),n+3):(r.error("Unclosed comment"),-1)}else return-1;default:if(i.substr(e+3,6)=="CDATA["){var n=i.indexOf("]]>",e+9);return t.startCDATA(),t.characters(i,e+9,n-e-9),t.endCDATA(),n+3}var a=lb(i,e),l=a.length;if(l>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],f=!1,p=!1;l>3&&(/^public$/i.test(a[2][0])?(f=a[3][0],p=l>4&&a[4][0]):/^system$/i.test(a[2][0])&&(p=a[3][0]));var T=a[l-1];return t.startDTD(u,f,p),t.endDTD(),T.index+T[0].length}}return-1}function ob(i,e,t){var r=i.indexOf("?>",e);if(r){var s=i.substring(e,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return s?(s[0].length,t.processingInstruction(s[1],s[2]),r+2):-1}return-1}function kf(){this.attributeNames={}}kf.prototype={setTagName:function(i){if(!id.test(i))throw new Error("invalid tagName:"+i);this.tagName=i},addValue:function(i,e,t){if(!id.test(i))throw new Error("invalid attribute:"+i);this.attributeNames[i]=this.length,this[this.length++]={qName:i,value:e,offset:t}},length:0,getLocalName:function(i){return this[i].localName},getLocator:function(i){return this[i].locator},getQName:function(i){return this[i].qName},getURI:function(i){return this[i].uri},getValue:function(i){return this[i].value}};function lb(i,e){var t,r=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=e,s.exec(i);t=s.exec(i);)if(r.push(t),t[1])return r}Vl.XMLReader=Df;Vl.ParseError=jr;var ub=Ci,cb=qi,nd=wf,Pf=Vl,db=cb.DOMImplementation,ad=ub.NAMESPACE,hb=Pf.ParseError,fb=Pf.XMLReader;function Lf(i){return i.replace(/\r[\n\u0085]/g,`
|
|
26
|
+
`).replace(/[\r\u0085\u2028]/g,`
|
|
27
|
+
`)}function Rf(i){this.options=i||{locator:{}}}Rf.prototype.parseFromString=function(i,e){var t=this.options,r=new fb,s=t.domBuilder||new an,n=t.errorHandler,a=t.locator,l=t.xmlns||{},u=/\/x?html?$/.test(e),f=u?nd.HTML_ENTITIES:nd.XML_ENTITIES;a&&s.setDocumentLocator(a),r.errorHandler=pb(n,s,a),r.domBuilder=t.domBuilder||s,u&&(l[""]=ad.HTML),l.xml=l.xml||ad.XML;var p=t.normalizeLineEndings||Lf;return i&&typeof i=="string"?r.parse(p(i),l,f):r.errorHandler.error("invalid doc source"),s.doc};function pb(i,e,t){if(!i){if(e instanceof an)return e;i=e}var r={},s=i instanceof Function;t=t||{};function n(a){var l=i[a];!l&&s&&(l=i.length==2?function(u){i(a,u)}:i),r[a]=l&&function(u){l("[xmldom "+a+"] "+u+Jo(t))}||function(){}}return n("warning"),n("error"),n("fatalError"),r}function an(){this.cdata=!1}function br(i,e){e.lineNumber=i.lineNumber,e.columnNumber=i.columnNumber}an.prototype={startDocument:function(){this.doc=new db().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(i,e,t,r){var s=this.doc,n=s.createElementNS(i,t||e),a=r.length;jn(this,n),this.currentElement=n,this.locator&&br(this.locator,n);for(var l=0;l<a;l++){var i=r.getURI(l),u=r.getValue(l),t=r.getQName(l),f=s.createAttributeNS(i,t);this.locator&&br(r.getLocator(l),f),f.value=f.nodeValue=u,n.setAttributeNode(f)}},endElement:function(i,e,t){var r=this.currentElement;r.tagName,this.currentElement=r.parentNode},startPrefixMapping:function(i,e){},endPrefixMapping:function(i){},processingInstruction:function(i,e){var t=this.doc.createProcessingInstruction(i,e);this.locator&&br(this.locator,t),jn(this,t)},ignorableWhitespace:function(i,e,t){},characters:function(i,e,t){if(i=od.apply(this,arguments),i){if(this.cdata)var r=this.doc.createCDATASection(i);else var r=this.doc.createTextNode(i);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(i)&&this.doc.appendChild(r),this.locator&&br(this.locator,r)}},skippedEntity:function(i){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(i){(this.locator=i)&&(i.lineNumber=0)},comment:function(i,e,t){i=od.apply(this,arguments);var r=this.doc.createComment(i);this.locator&&br(this.locator,r),jn(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(i,e,t){var r=this.doc.implementation;if(r&&r.createDocumentType){var s=r.createDocumentType(i,e,t);this.locator&&br(this.locator,s),jn(this,s),this.doc.doctype=s}},warning:function(i){console.warn("[xmldom warning] "+i,Jo(this.locator))},error:function(i){console.error("[xmldom error] "+i,Jo(this.locator))},fatalError:function(i){throw new hb(i,this.locator)}};function Jo(i){if(i)return`
|
|
28
|
+
@`+(i.systemId||"")+"#[line:"+i.lineNumber+",col:"+i.columnNumber+"]"}function od(i,e,t){return typeof i=="string"?i.substr(e,t):i.length>=e+t||e?new java.lang.String(i,e,t)+"":i}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(i){an.prototype[i]=function(){return null}});function jn(i,e){i.currentElement?i.currentElement.appendChild(e):i.doc.appendChild(e)}Oa.__DOMHandler=an;Oa.normalizeLineEndings=Lf;Oa.DOMParser=Rf;var Of=Oa.DOMParser;const mb=Object.freeze(Object.defineProperty({__proto__:null,DOMParser:Of},Symbol.toStringTag,{value:"Module"}));/*! @name mpd-parser @version 1.3.1 @license Apache-2.0 */const ld=i=>!!i&&typeof i=="object",Ze=(...i)=>i.reduce((e,t)=>(typeof t!="object"||Object.keys(t).forEach(r=>{Array.isArray(e[r])&&Array.isArray(t[r])?e[r]=e[r].concat(t[r]):ld(e[r])&&ld(t[r])?e[r]=Ze(e[r],t[r]):e[r]=t[r]}),e),{}),Nf=i=>Object.keys(i).map(e=>i[e]),gb=(i,e)=>{const t=[];for(let r=i;r<e;r++)t.push(r);return t},Vr=i=>i.reduce((e,t)=>e.concat(t),[]),Bf=i=>{if(!i.length)return[];const e=[];for(let t=0;t<i.length;t++)e.push(i[t]);return e},yb=(i,e)=>i.reduce((t,r,s)=>(r[e]&&t.push(s),t),[]),_b=(i,e)=>Nf(i.reduce((t,r)=>(r.forEach(s=>{t[e(s)]=s}),t),{}));var qr={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 Js=({baseUrl:i="",source:e="",range:t="",indexRange:r=""})=>{const s={uri:e,resolvedUri:ka(i||"",e)};if(t||r){const a=(t||r).split("-");let l=k.BigInt?k.BigInt(a[0]):parseInt(a[0],10),u=k.BigInt?k.BigInt(a[1]):parseInt(a[1],10);l<Number.MAX_SAFE_INTEGER&&typeof l=="bigint"&&(l=Number(l)),u<Number.MAX_SAFE_INTEGER&&typeof u=="bigint"&&(u=Number(u));let f;typeof u=="bigint"||typeof l=="bigint"?f=k.BigInt(u)-k.BigInt(l)+k.BigInt(1):f=u-l+1,typeof f=="bigint"&&f<Number.MAX_SAFE_INTEGER&&(f=Number(f)),s.byterange={length:f,offset:l}}return s},Tb=i=>{let e;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=k.BigInt(i.offset)+k.BigInt(i.length)-k.BigInt(1):e=i.offset+i.length-1,`${i.offset}-${e}`},ud=i=>(i&&typeof i!="number"&&(i=parseInt(i,10)),isNaN(i)?null:i),vb={static(i){const{duration:e,timescale:t=1,sourceDuration:r,periodDuration:s}=i,n=ud(i.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof s=="number"?{start:0,end:s/a}:{start:0,end:r/a}},dynamic(i){const{NOW:e,clientOffset:t,availabilityStartTime:r,timescale:s=1,duration:n,periodStart:a=0,minimumUpdatePeriod:l=0,timeShiftBufferDepth:u=1/0}=i,f=ud(i.endNumber),p=(e+t)/1e3,T=r+a,S=p+l-T,A=Math.ceil(S*s/n),v=Math.floor((p-T-u)*s/n),L=Math.floor((p-T)*s/n);return{start:Math.max(0,v),end:typeof f=="number"?f:Math.min(A,L)}}},bb=i=>e=>{const{duration:t,timescale:r=1,periodStart:s,startNumber:n=1}=i;return{number:n+e,duration:t/r,timeline:s,time:e*t}},ql=i=>{const{type:e,duration:t,timescale:r=1,periodDuration:s,sourceDuration:n}=i,{start:a,end:l}=vb[e](i),u=gb(a,l).map(bb(i));if(e==="static"){const f=u.length-1,p=typeof s=="number"?s:n;u[f].duration=p-t/r*f}return u},Mf=i=>{const{baseUrl:e,initialization:t={},sourceDuration:r,indexRange:s="",periodStart:n,presentationTime:a,number:l=0,duration:u}=i;if(!e)throw new Error(qr.NO_BASE_URL);const f=Js({baseUrl:e,source:t.sourceURL,range:t.range}),p=Js({baseUrl:e,source:e,indexRange:s});if(p.map=f,u){const T=ql(i);T.length&&(p.duration=T[0].duration,p.timeline=T[0].timeline)}else r&&(p.duration=r,p.timeline=n);return p.presentationTime=a||n,p.number=l,[p]},Hl=(i,e,t)=>{const r=i.sidx.map?i.sidx.map:null,s=i.sidx.duration,n=i.timeline||0,a=i.sidx.byterange,l=a.offset+a.length,u=e.timescale,f=e.references.filter(L=>L.referenceType!==1),p=[],T=i.endList?"static":"dynamic",b=i.sidx.timeline;let S=b,A=i.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=k.BigInt(l)+e.firstOffset:v=l+e.firstOffset;for(let L=0;L<f.length;L++){const P=e.references[L],M=P.referencedSize,O=P.subsegmentDuration;let U;typeof v=="bigint"?U=v+k.BigInt(M)-k.BigInt(1):U=v+M-1;const R=`${v}-${U}`,Y=Mf({baseUrl:t,timescale:u,timeline:n,periodStart:b,presentationTime:S,number:A,duration:O,sourceDuration:s,indexRange:R,type:T})[0];r&&(Y.map=r),p.push(Y),typeof v=="bigint"?v+=k.BigInt(M):v+=M,S+=O/u,A++}return i.segments=p,i},xb=["AUDIO","SUBTITLES"],Sb=1/60,Uf=i=>_b(i,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),Eb=(i,e)=>{for(let t=0;t<i.length;t++)if(i[t].attributes.NAME===e)return i[t];return null},cd=i=>{let e=[];return jv(i,xb,(t,r,s,n)=>{e=e.concat(t.playlists||[])}),e},dd=({playlist:i,mediaSequence:e})=>{i.mediaSequence=e,i.segments.forEach((t,r)=>{t.number=i.mediaSequence+r})},Cb=({oldPlaylists:i,newPlaylists:e,timelineStarts:t})=>{e.forEach(r=>{r.discontinuitySequence=t.findIndex(function({timeline:u}){return u===r.timeline});const s=Eb(i,r.attributes.NAME);if(!s||r.sidx)return;const n=r.segments[0],a=s.segments.findIndex(function(u){return Math.abs(u.presentationTime-n.presentationTime)<Sb});if(a===-1){dd({playlist:r,mediaSequence:s.mediaSequence+s.segments.length}),r.segments[0].discontinuity=!0,r.discontinuityStarts.unshift(0),(!s.segments.length&&r.timeline>s.timeline||s.segments.length&&r.timeline>s.segments[s.segments.length-1].timeline)&&r.discontinuitySequence--;return}s.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,r.discontinuityStarts.unshift(0),r.discontinuitySequence--),dd({playlist:r,mediaSequence:s.segments[a].number})})},Ab=({oldManifest:i,newManifest:e})=>{const t=i.playlists.concat(cd(i)),r=e.playlists.concat(cd(e));return e.timelineStarts=Uf([i.timelineStarts,e.timelineStarts]),Cb({oldPlaylists:t,newPlaylists:r,timelineStarts:e.timelineStarts}),e},Na=i=>i&&i.uri+"-"+Tb(i.byterange),Po=i=>{const e=i.reduce(function(r,s){return r[s.attributes.baseUrl]||(r[s.attributes.baseUrl]=[]),r[s.attributes.baseUrl].push(s),r},{});let t=[];return Object.values(e).forEach(r=>{const s=Nf(r.reduce((n,a)=>{const l=a.attributes.id+(a.attributes.lang||"");return n[l]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[l].segments.push(...a.segments)),a.attributes.contentProtection&&(n[l].attributes.contentProtection=a.attributes.contentProtection)):(n[l]=a,n[l].attributes.timelineStarts=[]),n[l].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(s)}),t.map(r=>(r.discontinuityStarts=yb(r.segments||[],"discontinuity"),r))},zl=(i,e)=>{const t=Na(i.sidx),r=t&&e[t]&&e[t].sidx;return r&&Hl(i,r,i.sidx.resolvedUri),i},wb=(i,e={})=>{if(!Object.keys(e).length)return i;for(const t in i)i[t]=zl(i[t],e);return i},Db=({attributes:i,segments:e,sidx:t,mediaSequence:r,discontinuitySequence:s,discontinuityStarts:n},a)=>{const l={attributes:{NAME:i.id,BANDWIDTH:i.bandwidth,CODECS:i.codecs,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:i.timelineStarts,mediaSequence:r,segments:e};return i.contentProtection&&(l.contentProtection=i.contentProtection),i.serviceLocation&&(l.attributes.serviceLocation=i.serviceLocation),t&&(l.sidx=t),a&&(l.attributes.AUDIO="audio",l.attributes.SUBTITLES="subs"),l},Ib=({attributes:i,segments:e,mediaSequence:t,discontinuityStarts:r,discontinuitySequence:s})=>{typeof e>"u"&&(e=[{uri:i.baseUrl,timeline:i.periodStart,resolvedUri:i.baseUrl||"",duration:i.sourceDuration,number:0}],i.duration=i.sourceDuration);const n={NAME:i.id,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1};i.codecs&&(n.CODECS=i.codecs);const a={attributes:n,uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,timelineStarts:i.timelineStarts,discontinuityStarts:r,discontinuitySequence:s,mediaSequence:t,segments:e};return i.serviceLocation&&(a.attributes.serviceLocation=i.serviceLocation),a},kb=(i,e={},t=!1)=>{let r;const s=i.reduce((n,a)=>{const l=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let f=a.attributes.label||"main";if(u&&!a.attributes.label){const T=l?` (${l})`:"";f=`${a.attributes.lang}${T}`}n[f]||(n[f]={language:u,autoselect:!0,default:l==="main",playlists:[],uri:""});const p=zl(Db(a,t),e);return n[f].playlists.push(p),typeof r>"u"&&l==="main"&&(r=a,r.default=!0),n},{});if(!r){const n=Object.keys(s)[0];s[n].default=!0}return s},Pb=(i,e={})=>i.reduce((t,r)=>{const s=r.attributes.label||r.attributes.lang||"text",n=r.attributes.lang||"und";return t[s]||(t[s]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[s].playlists.push(zl(Ib(r),e)),t},{}),Lb=i=>i.reduce((e,t)=>(t&&t.forEach(r=>{const{channel:s,language:n}=r;e[n]={autoselect:!1,default:!1,instreamId:s,language:n},r.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=r.aspectRatio),r.hasOwnProperty("easyReader")&&(e[n].easyReader=r.easyReader),r.hasOwnProperty("3D")&&(e[n]["3D"]=r["3D"])}),e),{}),Rb=({attributes:i,segments:e,sidx:t,discontinuityStarts:r})=>{const s={attributes:{NAME:i.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:i.width,height:i.height},CODECS:i.codecs,BANDWIDTH:i.bandwidth,"PROGRAM-ID":1},uri:"",endList:i.type==="static",timeline:i.periodStart,resolvedUri:i.baseUrl||"",targetDuration:i.duration,discontinuityStarts:r,timelineStarts:i.timelineStarts,segments:e};return i.frameRate&&(s.attributes["FRAME-RATE"]=i.frameRate),i.contentProtection&&(s.contentProtection=i.contentProtection),i.serviceLocation&&(s.attributes.serviceLocation=i.serviceLocation),t&&(s.sidx=t),s},Ob=({attributes:i})=>i.mimeType==="video/mp4"||i.mimeType==="video/webm"||i.contentType==="video",Nb=({attributes:i})=>i.mimeType==="audio/mp4"||i.mimeType==="audio/webm"||i.contentType==="audio",Bb=({attributes:i})=>i.mimeType==="text/vtt"||i.contentType==="text",Mb=(i,e)=>{i.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:r}){return r===t.timeline}),t.segments&&t.segments.forEach((r,s)=>{r.number=s})})},hd=i=>i?Object.keys(i).reduce((e,t)=>{const r=i[t];return e.concat(r.playlists)},[]):[],Ub=({dashPlaylists:i,locations:e,contentSteering:t,sidxMapping:r={},previousManifest:s,eventStream:n})=>{if(!i.length)return{};const{sourceDuration:a,type:l,suggestedPresentationDelay:u,minimumUpdatePeriod:f}=i[0].attributes,p=Po(i.filter(Ob)).map(Rb),T=Po(i.filter(Nb)),b=Po(i.filter(Bb)),S=i.map(U=>U.attributes.captionServices).filter(Boolean),A={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:wb(p,r)};f>=0&&(A.minimumUpdatePeriod=f*1e3),e&&(A.locations=e),t&&(A.contentSteering=t),l==="dynamic"&&(A.suggestedPresentationDelay=u),n&&n.length>0&&(A.eventStream=n);const v=A.playlists.length===0,L=T.length?kb(T,r,v):null,P=b.length?Pb(b,r):null,M=p.concat(hd(L),hd(P)),O=M.map(({timelineStarts:U})=>U);return A.timelineStarts=Uf(O),Mb(M,A.timelineStarts),L&&(A.mediaGroups.AUDIO.audio=L),P&&(A.mediaGroups.SUBTITLES.subs=P),S.length&&(A.mediaGroups["CLOSED-CAPTIONS"].cc=Lb(S)),s?Ab({oldManifest:s,newManifest:A}):A},Fb=(i,e,t)=>{const{NOW:r,clientOffset:s,availabilityStartTime:n,timescale:a=1,periodStart:l=0,minimumUpdatePeriod:u=0}=i,f=(r+s)/1e3,p=n+l,b=f+u-p;return Math.ceil((b*a-e)/t)},Ff=(i,e)=>{const{type:t,minimumUpdatePeriod:r=0,media:s="",sourceDuration:n,timescale:a=1,startNumber:l=1,periodStart:u}=i,f=[];let p=-1;for(let T=0;T<e.length;T++){const b=e[T],S=b.d,A=b.r||0,v=b.t||0;p<0&&(p=v),v&&v>p&&(p=v);let L;if(A<0){const O=T+1;O===e.length?t==="dynamic"&&r>0&&s.indexOf("$Number$")>0?L=Fb(i,p,S):L=(n*a-p)/S:L=(e[O].t-p)/S}else L=A+1;const P=l+f.length+L;let M=l+f.length;for(;M<P;)f.push({number:M,duration:S/a,time:p,timeline:u}),p+=S,M++}return f},$b=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,jb=i=>(e,t,r,s)=>{if(e==="$$")return"$";if(typeof i[t]>"u")return e;const n=""+i[t];return t==="RepresentationID"||(r?s=parseInt(s,10):s=1,n.length>=s)?n:`${new Array(s-n.length+1).join("0")}${n}`},fd=(i,e)=>i.replace($b,jb(e)),Vb=(i,e)=>!i.duration&&!e?[{number:i.startNumber||1,duration:i.sourceDuration,time:0,timeline:i.periodStart}]:i.duration?ql(i):Ff(i,e),qb=(i,e)=>{const t={RepresentationID:i.id,Bandwidth:i.bandwidth||0},{initialization:r={sourceURL:"",range:""}}=i,s=Js({baseUrl:i.baseUrl,source:fd(r.sourceURL,t),range:r.range});return Vb(i,e).map(a=>{t.Number=a.number,t.Time=a.time;const l=fd(i.media||"",t),u=i.timescale||1,f=i.presentationTimeOffset||0,p=i.periodStart+(a.time-f)/u;return{uri:l,timeline:a.timeline,duration:a.duration,resolvedUri:ka(i.baseUrl||"",l),map:s,number:a.number,presentationTime:p}})},Hb=(i,e)=>{const{baseUrl:t,initialization:r={}}=i,s=Js({baseUrl:t,source:r.sourceURL,range:r.range}),n=Js({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=s,n},zb=(i,e)=>{const{duration:t,segmentUrls:r=[],periodStart:s}=i;if(!t&&!e||t&&e)throw new Error(qr.SEGMENT_TIME_UNSPECIFIED);const n=r.map(u=>Hb(i,u));let a;return t&&(a=ql(i)),e&&(a=Ff(i,e)),a.map((u,f)=>{if(n[f]){const p=n[f],T=i.timescale||1,b=i.presentationTimeOffset||0;return p.timeline=u.timeline,p.duration=u.duration,p.number=u.number,p.presentationTime=s+(u.time-b)/T,p}}).filter(u=>u)},Wb=({attributes:i,segmentInfo:e})=>{let t,r;e.template?(r=qb,t=Ze(i,e.template)):e.base?(r=Mf,t=Ze(i,e.base)):e.list&&(r=zb,t=Ze(i,e.list));const s={attributes:i};if(!r)return s;const n=r(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:l=1}=t;t.duration=a/l}else n.length?t.duration=n.reduce((a,l)=>Math.max(a,Math.ceil(l.duration)),0):t.duration=0;return s.attributes=t,s.segments=n,e.base&&t.indexRange&&(s.sidx=n[0],s.segments=[]),s},Gb=i=>i.map(Wb),Fe=(i,e)=>Bf(i.childNodes).filter(({tagName:t})=>t===e),on=i=>i.textContent.trim(),Kb=i=>parseFloat(i.split("/").reduce((e,t)=>e/t)),xr=i=>{const l=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(i);if(!l)return 0;const[u,f,p,T,b,S]=l.slice(1);return parseFloat(u||0)*31536e3+parseFloat(f||0)*2592e3+parseFloat(p||0)*86400+parseFloat(T||0)*3600+parseFloat(b||0)*60+parseFloat(S||0)},Xb=i=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(i)&&(i+="Z"),Date.parse(i)),pd={mediaPresentationDuration(i){return xr(i)},availabilityStartTime(i){return Xb(i)/1e3},minimumUpdatePeriod(i){return xr(i)},suggestedPresentationDelay(i){return xr(i)},type(i){return i},timeShiftBufferDepth(i){return xr(i)},start(i){return xr(i)},width(i){return parseInt(i,10)},height(i){return parseInt(i,10)},bandwidth(i){return parseInt(i,10)},frameRate(i){return Kb(i)},startNumber(i){return parseInt(i,10)},timescale(i){return parseInt(i,10)},presentationTimeOffset(i){return parseInt(i,10)},duration(i){const e=parseInt(i,10);return isNaN(e)?xr(i):e},d(i){return parseInt(i,10)},t(i){return parseInt(i,10)},r(i){return parseInt(i,10)},presentationTime(i){return parseInt(i,10)},DEFAULT(i){return i}},Xe=i=>i&&i.attributes?Bf(i.attributes).reduce((e,t)=>{const r=pd[t.name]||pd.DEFAULT;return e[t.name]=r(t.value),e},{}):{},Yb={"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"},Ba=(i,e)=>e.length?Vr(i.map(function(t){return e.map(function(r){const s=on(r),n=ka(t.baseUrl,s),a=Ze(Xe(r),{baseUrl:n});return n!==s&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):i,Wl=i=>{const e=Fe(i,"SegmentTemplate")[0],t=Fe(i,"SegmentList")[0],r=t&&Fe(t,"SegmentURL").map(T=>Ze({tag:"SegmentURL"},Xe(T))),s=Fe(i,"SegmentBase")[0],n=t||e,a=n&&Fe(n,"SegmentTimeline")[0],l=t||s||e,u=l&&Fe(l,"Initialization")[0],f=e&&Xe(e);f&&u?f.initialization=u&&Xe(u):f&&f.initialization&&(f.initialization={sourceURL:f.initialization});const p={template:f,segmentTimeline:a&&Fe(a,"S").map(T=>Xe(T)),list:t&&Ze(Xe(t),{segmentUrls:r,initialization:Xe(u)}),base:s&&Ze(Xe(s),{initialization:Xe(u)})};return Object.keys(p).forEach(T=>{p[T]||delete p[T]}),p},Qb=(i,e,t)=>r=>{const s=Fe(r,"BaseURL"),n=Ba(e,s),a=Ze(i,Xe(r)),l=Wl(r);return n.map(u=>({segmentInfo:Ze(t,l),attributes:Ze(a,u)}))},Jb=i=>i.reduce((e,t)=>{const r=Xe(t);r.schemeIdUri&&(r.schemeIdUri=r.schemeIdUri.toLowerCase());const s=Yb[r.schemeIdUri];if(s){e[s]={attributes:r};const n=Fe(t,"cenc:pssh")[0];if(n){const a=on(n);e[s].pssh=a&&Jh(a)}}return e},{}),Zb=i=>{if(i.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{let r,s;return s=t,/^CC\d=/.test(t)?[r,s]=t.split("="):/^CC\d$/.test(t)&&(r=t),{channel:r,language:s}});if(i.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof i.value!="string"?[]:i.value.split(";")).map(t=>{const r={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[s,n=""]=t.split("=");r.channel=s,r.language=t,n.split(",").forEach(a=>{const[l,u]=a.split(":");l==="lang"?r.language=u:l==="er"?r.easyReader=Number(u):l==="war"?r.aspectRatio=Number(u):l==="3D"&&(r["3D"]=Number(u))})}else r.language=t;return r.channel&&(r.channel="SERVICE"+r.channel),r})},e2=i=>Vr(Fe(i.node,"EventStream").map(e=>{const t=Xe(e),r=t.schemeIdUri;return Fe(e,"Event").map(s=>{const n=Xe(s),a=n.presentationTime||0,l=t.timescale||1,u=n.duration||0,f=a/l+i.attributes.start;return{schemeIdUri:r,value:t.value,id:n.id,start:f,end:f+u/l,messageData:on(s)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),t2=(i,e,t)=>r=>{const s=Xe(r),n=Ba(e,Fe(r,"BaseURL")),a=Fe(r,"Role")[0],l={role:Xe(a)};let u=Ze(i,s,l);const f=Fe(r,"Accessibility")[0],p=Zb(Xe(f));p&&(u=Ze(u,{captionServices:p}));const T=Fe(r,"Label")[0];if(T&&T.childNodes.length){const L=T.childNodes[0].nodeValue.trim();u=Ze(u,{label:L})}const b=Jb(Fe(r,"ContentProtection"));Object.keys(b).length&&(u=Ze(u,{contentProtection:b}));const S=Wl(r),A=Fe(r,"Representation"),v=Ze(t,S);return Vr(A.map(Qb(u,n,v)))},i2=(i,e)=>(t,r)=>{const s=Ba(e,Fe(t.node,"BaseURL")),n=Ze(i,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=Fe(t.node,"AdaptationSet"),l=Wl(t.node);return Vr(a.map(t2(n,s,l)))},r2=(i,e)=>{if(i.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!i.length)return null;const t=Ze({serverURL:on(i[0])},Xe(i[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},s2=({attributes:i,priorPeriodAttributes:e,mpdType:t})=>typeof i.start=="number"?i.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,n2=(i,e={})=>{const{manifestUri:t="",NOW:r=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=e,a=Fe(i,"Period");if(!a.length)throw new Error(qr.INVALID_NUMBER_OF_PERIOD);const l=Fe(i,"Location"),u=Xe(i),f=Ba([{baseUrl:t}],Fe(i,"BaseURL")),p=Fe(i,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=r,u.clientOffset=s,l.length&&(u.locations=l.map(on));const T=[];return a.forEach((b,S)=>{const A=Xe(b),v=T[S-1];A.start=s2({attributes:A,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),T.push({node:b,attributes:A})}),{locations:u.locations,contentSteeringInfo:r2(p,n),representationInfo:Vr(T.map(i2(u,f))),eventStream:Vr(T.map(e2))}},$f=i=>{if(i==="")throw new Error(qr.DASH_EMPTY_MANIFEST);const e=new Of;let t,r;try{t=e.parseFromString(i,"application/xml"),r=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!r||r&&r.getElementsByTagName("parsererror").length>0)throw new Error(qr.DASH_INVALID_XML);return r},a2=i=>{const e=Fe(i,"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(qr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},o2=(i,e={})=>{const t=n2($f(i),e),r=Gb(t.representationInfo);return Ub({dashPlaylists:r,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},l2=i=>a2($f(i));var jf=Math.pow(2,32),u2=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t;return e.getBigUint64?(t=e.getBigUint64(0),t<Number.MAX_SAFE_INTEGER?Number(t):t):e.getUint32(0)*jf+e.getUint32(4)},c2={getUint64:u2,MAX_UINT32:jf},md=c2.getUint64,d2=function(i){var e=new DataView(i.buffer,i.byteOffset,i.byteLength),t={version:i[0],flags:new Uint8Array(i.subarray(1,4)),references:[],referenceId:e.getUint32(4),timescale:e.getUint32(8)},r=12;t.version===0?(t.earliestPresentationTime=e.getUint32(r),t.firstOffset=e.getUint32(r+4),r+=8):(t.earliestPresentationTime=md(i.subarray(r)),t.firstOffset=md(i.subarray(r+8)),r+=16),r+=2;var s=e.getUint16(r);for(r+=2;s>0;r+=12,s--)t.references.push({referenceType:(i[r]&128)>>>7,referencedSize:e.getUint32(r)&2147483647,subsegmentDuration:e.getUint32(r+4),startsWithSap:!!(i[r+8]&128),sapType:(i[r+8]&112)>>>4,sapDeltaTime:e.getUint32(r+8)&268435455});return t},h2=d2;const f2=ci.getDefaultExportFromCjs(h2);var p2=se([73,68,51]),m2=function(e,t){t===void 0&&(t=0),e=se(e);var r=e[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(r&16)>>4;return n?s+20:s+10},Ms=function i(e,t){return t===void 0&&(t=0),e=se(e),e.length-t<10||!Ue(e,p2,{offset:t})?t:(t+=m2(e,t),i(e,t))},gd=function(e){return typeof e=="string"?sf(e):e},g2=function(e){return Array.isArray(e)?e.map(function(t){return gd(t)}):[gd(e)]},y2=function i(e,t,r){r===void 0&&(r=!1),t=g2(t),e=se(e);var s=[];if(!t.length)return s;for(var n=0;n<e.length;){var a=(e[n]<<24|e[n+1]<<16|e[n+2]<<8|e[n+3])>>>0,l=e.subarray(n+4,n+8);if(a===0)break;var u=n+a;if(u>e.length){if(r)break;u=e.length}var f=e.subarray(n+8,u);Ue(l,t[0])&&(t.length===1?s.push(f):s.push.apply(s,i(f,t.slice(1),r))),n=u}return s},Vn={EBML:se([26,69,223,163]),DocType:se([66,130]),Segment:se([24,83,128,103]),SegmentInfo:se([21,73,169,102]),Tracks:se([22,84,174,107]),Track:se([174]),TrackNumber:se([215]),DefaultDuration:se([35,227,131]),TrackEntry:se([174]),TrackType:se([131]),FlagDefault:se([136]),CodecID:se([134]),CodecPrivate:se([99,162]),VideoTrack:se([224]),AudioTrack:se([225]),Cluster:se([31,67,182,117]),Timestamp:se([231]),TimestampScale:se([42,215,177]),BlockGroup:se([160]),BlockDuration:se([155]),Block:se([161]),SimpleBlock:se([163])},Zo=[128,64,32,16,8,4,2,1],_2=function(e){for(var t=1,r=0;r<Zo.length&&!(e&Zo[r]);r++)t++;return t},sa=function(e,t,r,s){r===void 0&&(r=!0),s===void 0&&(s=!1);var n=_2(e[t]),a=e.subarray(t,t+n);return r&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=Zo[n-1]),{length:n,value:Uv(a,{signed:s}),bytes:a}},yd=function i(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return i(t)}):typeof e=="number"?Fv(e):e},T2=function(e){return Array.isArray(e)?e.map(function(t){return yd(t)}):[yd(e)]},v2=function i(e,t,r){if(r>=t.length)return t.length;var s=sa(t,r,!1);if(Ue(e.bytes,s.bytes))return r;var n=sa(t,r+s.length);return i(e,t,r+n.length+n.value+s.length)},_d=function i(e,t){t=T2(t),e=se(e);var r=[];if(!t.length)return r;for(var s=0;s<e.length;){var n=sa(e,s,!1),a=sa(e,s+n.length),l=s+n.length+a.length;a.value===127&&(a.value=v2(n,e,l),a.value!==e.length&&(a.value-=l));var u=l+a.value>e.length?e.length:l+a.value,f=e.subarray(l,u);Ue(t[0],n.bytes)&&(t.length===1?r.push(f):r=r.concat(i(f,t.slice(1))));var p=n.length+a.length+f.length;s+=p}return r},b2=se([0,0,0,1]),x2=se([0,0,1]),S2=se([0,0,3]),E2=function(e){for(var t=[],r=1;r<e.length-2;)Ue(e.subarray(r,r+3),S2)&&(t.push(r+2),r++),r++;if(t.length===0)return e;var s=e.length-t.length,n=new Uint8Array(s),a=0;for(r=0;r<s;a++,r++)a===t[0]&&(a++,t.shift()),n[r]=e[a];return n},Vf=function(e,t,r,s){e=se(e),r=[].concat(r);for(var n=0,a,l=0;n<e.length&&(l<s||a);){var u=void 0;if(Ue(e.subarray(n),b2)?u=4:Ue(e.subarray(n),x2)&&(u=3),!u){n++;continue}if(l++,a)return E2(e.subarray(a,n));var f=void 0;t==="h264"?f=e[n+u]&31:t==="h265"&&(f=e[n+u]>>1&63),r.indexOf(f)!==-1&&(a=n+u),n+=u+(t==="h264"?1:2)}return e.subarray(0,0)},C2=function(e,t,r){return Vf(e,"h264",t,r)},A2=function(e,t,r){return Vf(e,"h265",t,r)},ct={webm:se([119,101,98,109]),matroska:se([109,97,116,114,111,115,107,97]),flac:se([102,76,97,67]),ogg:se([79,103,103,83]),ac3:se([11,119]),riff:se([82,73,70,70]),avi:se([65,86,73]),wav:se([87,65,86,69]),"3gp":se([102,116,121,112,51,103]),mp4:se([102,116,121,112]),fmp4:se([115,116,121,112]),mov:se([102,116,121,112,113,116]),moov:se([109,111,111,118]),moof:se([109,111,111,102])},Hr={aac:function(e){var t=Ms(e);return Ue(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=Ms(e);return Ue(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=_d(e,[Vn.EBML,Vn.DocType])[0];return Ue(t,ct.webm)},mkv:function(e){var t=_d(e,[Vn.EBML,Vn.DocType])[0];return Ue(t,ct.matroska)},mp4:function(e){if(Hr["3gp"](e)||Hr.mov(e))return!1;if(Ue(e,ct.mp4,{offset:4})||Ue(e,ct.fmp4,{offset:4})||Ue(e,ct.moof,{offset:4})||Ue(e,ct.moov,{offset:4}))return!0},mov:function(e){return Ue(e,ct.mov,{offset:4})},"3gp":function(e){return Ue(e,ct["3gp"],{offset:4})},ac3:function(e){var t=Ms(e);return Ue(e,ct.ac3,{offset:t})},ts:function(e){if(e.length<189&&e.length>=1)return e[0]===71;for(var t=0;t+188<e.length&&t<188;){if(e[t]===71&&e[t+188]===71)return!0;t+=1}return!1},flac:function(e){var t=Ms(e);return Ue(e,ct.flac,{offset:t})},ogg:function(e){return Ue(e,ct.ogg)},avi:function(e){return Ue(e,ct.riff)&&Ue(e,ct.avi,{offset:8})},wav:function(e){return Ue(e,ct.riff)&&Ue(e,ct.wav,{offset:8})},h264:function(e){return C2(e,7,3).length},h265:function(e){return A2(e,[32,33],3).length}},el=Object.keys(Hr).filter(function(i){return i!=="ts"&&i!=="h264"&&i!=="h265"}).concat(["ts","h264","h265"]);el.forEach(function(i){var e=Hr[i];Hr[i]=function(t){return e(se(t))}});var w2=Hr,Gl=function(e){e=se(e);for(var t=0;t<el.length;t++){var r=el[t];if(w2[r](e))return r}return""},D2=function(e){return y2(e,["moof"]).length>0},Kl=9e4,Xl,Yl,Ma,Ql,qf,Hf,zf;Xl=function(i){return i*Kl};Yl=function(i,e){return i*e};Ma=function(i){return i/Kl};Ql=function(i,e){return i/e};qf=function(i,e){return Xl(Ql(i,e))};Hf=function(i,e){return Yl(Ma(i),e)};zf=function(i,e,t){return Ma(t?i:i-e)};var tr={ONE_SECOND_IN_TS:Kl,secondsToVideoTs:Xl,secondsToAudioTs:Yl,videoTsToSeconds:Ma,audioTsToSeconds:Ql,audioTsToVideoTs:qf,videoTsToAudioTs:Hf,metadataTsToSeconds:zf},tl="8.21.0";const yi={},ji=function(i,e){return yi[i]=yi[i]||[],e&&(yi[i]=yi[i].concat(e)),yi[i]},I2=function(i,e){ji(i,e)},Wf=function(i,e){const t=ji(i).indexOf(e);return t<=-1?!1:(yi[i]=yi[i].slice(),yi[i].splice(t,1),!0)},k2=function(i,e){ji(i,[].concat(e).map(t=>{const r=(...s)=>(Wf(i,r),t(...s));return r}))},na={prefixed:!0},Xn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Td=Xn[0];let Us;for(let i=0;i<Xn.length;i++)if(Xn[i][1]in X){Us=Xn[i];break}if(Us){for(let i=0;i<Us.length;i++)na[Td[i]]=Us[i];na.prefixed=Us[0]!==Td[0]}let gt=[];const P2=(i,e,t)=>(r,s,n)=>{const a=e.levels[s],l=new RegExp(`^(${a})$`);let u=i;if(r!=="log"&&n.unshift(r.toUpperCase()+":"),t&&(u=`%c${i}`,n.unshift(t)),n.unshift(u+":"),gt){gt.push([].concat(n));const p=gt.length-1e3;gt.splice(0,p>0?p:0)}if(!k.console)return;let f=k.console[r];!f&&r==="debug"&&(f=k.console.info||k.console.log),!(!f||!a||!l.test(r))&&f[Array.isArray(n)?"apply":"call"](k.console,n)};function il(i,e=":",t=""){let r="info",s;function n(...a){s("log",r,a)}return s=P2(i,n,t),n.createLogger=(a,l,u)=>{const f=l!==void 0?l:e,p=u!==void 0?u:t,T=`${i} ${f} ${a}`;return il(T,f,p)},n.createNewLogger=(a,l,u)=>il(a,l,u),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:r},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);r=a}return r},n.history=()=>gt?[].concat(gt):[],n.history.filter=a=>(gt||[]).filter(l=>new RegExp(`.*${a}.*`).test(l[0])),n.history.clear=()=>{gt&&(gt.length=0)},n.history.disable=()=>{gt!==null&&(gt.length=0,gt=null)},n.history.enable=()=>{gt===null&&(gt=[])},n.error=(...a)=>s("error",r,a),n.warn=(...a)=>s("warn",r,a),n.debug=(...a)=>s("debug",r,a),n}const fe=il("VIDEOJS"),Gf=fe.createLogger,L2=Object.prototype.toString,Kf=function(i){return di(i)?Object.keys(i):[]};function kr(i,e){Kf(i).forEach(t=>e(i[t],t))}function Xf(i,e,t=0){return Kf(i).reduce((r,s)=>e(r,i[s],s),t)}function di(i){return!!i&&typeof i=="object"}function zr(i){return di(i)&&L2.call(i)==="[object Object]"&&i.constructor===Object}function Ae(...i){const e={};return i.forEach(t=>{t&&kr(t,(r,s)=>{if(!zr(r)){e[s]=r;return}zr(e[s])||(e[s]={}),e[s]=Ae(e[s],r)})}),e}function Yf(i={}){const e=[];for(const t in i)if(i.hasOwnProperty(t)){const r=i[t];e.push(r)}return e}function Ua(i,e,t,r=!0){const s=a=>Object.defineProperty(i,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return s(a),a}};return r&&(n.set=s),Object.defineProperty(i,e,n)}var R2=Object.freeze({__proto__:null,each:kr,reduce:Xf,isObject:di,isPlain:zr,merge:Ae,values:Yf,defineLazyProperty:Ua});let Jl=!1,Qf=null,Gt=!1,Jf,Zf=!1,Pr=!1,Lr=!1,hi=!1,Zl=null,Fa=null;const O2=!!(k.cast&&k.cast.framework&&k.cast.framework.CastReceiverContext);let ep=null,aa=!1,$a=!1,oa=!1,ja=!1,la=!1,ua=!1,ca=!1;const Zs=!!(Jr()&&("ontouchstart"in k||k.navigator.maxTouchPoints||k.DocumentTouch&&k.document instanceof k.DocumentTouch)),Bi=k.navigator&&k.navigator.userAgentData;Bi&&Bi.platform&&Bi.brands&&(Gt=Bi.platform==="Android",Pr=!!Bi.brands.find(i=>i.brand==="Microsoft Edge"),Lr=!!Bi.brands.find(i=>i.brand==="Chromium"),hi=!Pr&&Lr,Zl=Fa=(Bi.brands.find(i=>i.brand==="Chromium")||{}).version||null,$a=Bi.platform==="Windows");if(!Lr){const i=k.navigator&&k.navigator.userAgent||"";Jl=/iPod/i.test(i),Qf=function(){const e=i.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null}(),Gt=/Android/i.test(i),Jf=function(){const e=i.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);if(!e)return null;const t=e[1]&&parseFloat(e[1]),r=e[2]&&parseFloat(e[2]);return t&&r?parseFloat(e[1]+"."+e[2]):t||null}(),Zf=/Firefox/i.test(i),Pr=/Edg/i.test(i),Lr=/Chrome/i.test(i)||/CriOS/i.test(i),hi=!Pr&&Lr,Zl=Fa=function(){const e=i.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null}(),ep=function(){const e=/MSIE\s(\d+)\.\d/.exec(i);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(i)&&/rv:11.0/.test(i)&&(t=11),t}(),la=/Tizen/i.test(i),ua=/Web0S/i.test(i),ca=la||ua,aa=/Safari/i.test(i)&&!hi&&!Gt&&!Pr&&!ca,$a=/Windows/i.test(i),oa=/iPad/i.test(i)||aa&&Zs&&!/iPhone/i.test(i),ja=/iPhone/i.test(i)&&!oa}const st=ja||oa||Jl,Va=(aa||st)&&!hi;var tp=Object.freeze({__proto__:null,get IS_IPOD(){return Jl},get IOS_VERSION(){return Qf},get IS_ANDROID(){return Gt},get ANDROID_VERSION(){return Jf},get IS_FIREFOX(){return Zf},get IS_EDGE(){return Pr},get IS_CHROMIUM(){return Lr},get IS_CHROME(){return hi},get CHROMIUM_VERSION(){return Zl},get CHROME_VERSION(){return Fa},IS_CHROMECAST_RECEIVER:O2,get IE_VERSION(){return ep},get IS_SAFARI(){return aa},get IS_WINDOWS(){return $a},get IS_IPAD(){return oa},get IS_IPHONE(){return ja},get IS_TIZEN(){return la},get IS_WEBOS(){return ua},get IS_SMART_TV(){return ca},TOUCH_ENABLED:Zs,IS_IOS:st,IS_ANY_SAFARI:Va});function vd(i){return typeof i=="string"&&!!i.trim()}function N2(i){if(i.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function Jr(){return X===k.document}function Zr(i){return di(i)&&i.nodeType===1}function ip(){try{return k.parent!==k.self}catch{return!0}}function rp(i){return function(e,t){if(!vd(e))return X[i](null);vd(t)&&(t=X.querySelector(t));const r=Zr(t)?t:X;return r[i]&&r[i](e)}}function ne(i="div",e={},t={},r){const s=X.createElement(i);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Hi(s,a):(s[n]!==a||n==="tabIndex")&&(s[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){s.setAttribute(n,t[n])}),r&&eu(s,r),s}function Hi(i,e){return typeof i.textContent>"u"?i.innerText=e:i.textContent=e,i}function rl(i,e){e.firstChild?e.insertBefore(i,e.firstChild):e.appendChild(i)}function Vs(i,e){return N2(e),i.classList.contains(e)}function sr(i,...e){return i.classList.add(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i}function qa(i,...e){return i?(i.classList.remove(...e.reduce((t,r)=>t.concat(r.split(/\s+/)),[])),i):(fe.warn("removeClass was called with an element that doesn't exist"),null)}function sp(i,e,t){return typeof t=="function"&&(t=t(i,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(r=>i.classList.toggle(r,t)),i}function np(i,e){Object.getOwnPropertyNames(e).forEach(function(t){const r=e[t];r===null||typeof r>"u"||r===!1?i.removeAttribute(t):i.setAttribute(t,r===!0?"":r)})}function Fi(i){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(i&&i.attributes&&i.attributes.length>0){const r=i.attributes;for(let s=r.length-1;s>=0;s--){const n=r[s].name;let a=r[s].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function ap(i,e){return i.getAttribute(e)}function Wr(i,e,t){i.setAttribute(e,t)}function Ha(i,e){i.removeAttribute(e)}function op(){X.body.focus(),X.onselectstart=function(){return!1}}function lp(){X.onselectstart=function(){return!0}}function Gr(i){if(i&&i.getBoundingClientRect&&i.parentNode){const e=i.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(r=>{e[r]!==void 0&&(t[r]=e[r])}),t.height||(t.height=parseFloat(Kr(i,"height"))),t.width||(t.width=parseFloat(Kr(i,"width"))),t}}function en(i){if(!i||i&&!i.offsetParent)return{left:0,top:0,width:0,height:0};const e=i.offsetWidth,t=i.offsetHeight;let r=0,s=0;for(;i.offsetParent&&i!==X[na.fullscreenElement];)r+=i.offsetLeft,s+=i.offsetTop,i=i.offsetParent;return{left:r,top:s,width:e,height:t}}function za(i,e){const t={x:0,y:0};if(st){let p=i;for(;p&&p.nodeName.toLowerCase()!=="html";){const T=Kr(p,"transform");if(/^matrix/.test(T)){const b=T.slice(7,-1).split(/,\s/).map(Number);t.x+=b[4],t.y+=b[5]}else if(/^matrix3d/.test(T)){const b=T.slice(9,-1).split(/,\s/).map(Number);t.x+=b[12],t.y+=b[13]}if(p.assignedSlot&&p.assignedSlot.parentElement&&k.WebKitCSSMatrix){const b=k.getComputedStyle(p.assignedSlot.parentElement).transform,S=new k.WebKitCSSMatrix(b);t.x+=S.m41,t.y+=S.m42}p=p.parentNode||p.host}}const r={},s=en(e.target),n=en(i),a=n.width,l=n.height;let u=e.offsetY-(n.top-s.top),f=e.offsetX-(n.left-s.left);return e.changedTouches&&(f=e.changedTouches[0].pageX-n.left,u=e.changedTouches[0].pageY+n.top,st&&(f-=t.x,u-=t.y)),r.y=1-Math.max(0,Math.min(1,u/l)),r.x=Math.max(0,Math.min(1,f/a)),r}function up(i){return di(i)&&i.nodeType===3}function Wa(i){for(;i.firstChild;)i.removeChild(i.firstChild);return i}function cp(i){return typeof i=="function"&&(i=i()),(Array.isArray(i)?i:[i]).map(e=>{if(typeof e=="function"&&(e=e()),Zr(e)||up(e))return e;if(typeof e=="string"&&/\S/.test(e))return X.createTextNode(e)}).filter(e=>e)}function eu(i,e){return cp(e).forEach(t=>i.appendChild(t)),i}function dp(i,e){return eu(Wa(i),e)}function tn(i){return i.button===void 0&&i.buttons===void 0||i.button===0&&i.buttons===void 0||i.type==="mouseup"&&i.button===0&&i.buttons===0||i.type==="mousedown"&&i.button===0&&i.buttons===0?!0:!(i.button!==0||i.buttons!==1)}const Vi=rp("querySelector"),hp=rp("querySelectorAll");function Kr(i,e){if(!i||!e)return"";if(typeof k.getComputedStyle=="function"){let t;try{t=k.getComputedStyle(i)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function fp(i){[...X.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(s=>s.cssText).join(""),r=X.createElement("style");r.textContent=t,i.document.head.appendChild(r)}catch{const r=X.createElement("link");r.rel="stylesheet",r.type=e.type,r.media=e.media.mediaText,r.href=e.href,i.document.head.appendChild(r)}})}var pp=Object.freeze({__proto__:null,isReal:Jr,isEl:Zr,isInFrame:ip,createEl:ne,textContent:Hi,prependTo:rl,hasClass:Vs,addClass:sr,removeClass:qa,toggleClass:sp,setAttributes:np,getAttributes:Fi,getAttribute:ap,setAttribute:Wr,removeAttribute:Ha,blockTextSelection:op,unblockTextSelection:lp,getBoundingClientRect:Gr,findPosition:en,getPointerPosition:za,isTextNode:up,emptyEl:Wa,normalizeContent:cp,appendContent:eu,insertContent:dp,isSingleLeftClick:tn,$:Vi,$$:hp,computedStyle:Kr,copyStyleSheetsToWindow:fp});let mp=!1,sl;const B2=function(){if(sl.options.autoSetup===!1)return;const i=Array.prototype.slice.call(X.getElementsByTagName("video")),e=Array.prototype.slice.call(X.getElementsByTagName("audio")),t=Array.prototype.slice.call(X.getElementsByTagName("video-js")),r=i.concat(e,t);if(r&&r.length>0)for(let s=0,n=r.length;s<n;s++){const a=r[s];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&sl(a);else{nl(1);break}}else mp||nl(1)};function nl(i,e){Jr()&&(e&&(sl=e),k.setTimeout(B2,i))}function al(){mp=!0,k.removeEventListener("load",al)}Jr()&&(X.readyState==="complete"?al():k.addEventListener("load",al));const gp=function(i){const e=X.createElement("style");return e.className=i,e},yp=function(i,e){i.styleSheet?i.styleSheet.cssText=e:i.textContent=e};var ft=new WeakMap;const M2=3;let U2=M2;function Ut(){return U2++}function bd(i,e){if(!ft.has(i))return;const t=ft.get(i);t.handlers[e].length===0&&(delete t.handlers[e],i.removeEventListener?i.removeEventListener(e,t.dispatcher,!1):i.detachEvent&&i.detachEvent("on"+e,t.dispatcher)),Object.getOwnPropertyNames(t.handlers).length<=0&&(delete t.handlers,delete t.dispatcher,delete t.disabled),Object.getOwnPropertyNames(t).length===0&&ft.delete(i)}function tu(i,e,t,r){t.forEach(function(s){i(e,s,r)})}function Ga(i){if(i.fixed_)return i;function e(){return!0}function t(){return!1}if(!i||!i.isPropagationStopped||!i.isImmediatePropagationStopped){const r=i||k.event;i={};const s=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const n in r)s.includes(n)||n==="returnValue"&&r.preventDefault||(i[n]=r[n]);if(i.target||(i.target=i.srcElement||X),i.relatedTarget||(i.relatedTarget=i.fromElement===i.target?i.toElement:i.fromElement),i.preventDefault=function(){r.preventDefault&&r.preventDefault(),i.returnValue=!1,r.returnValue=!1,i.defaultPrevented=!0},i.defaultPrevented=!1,i.stopPropagation=function(){r.stopPropagation&&r.stopPropagation(),i.cancelBubble=!0,r.cancelBubble=!0,i.isPropagationStopped=e},i.isPropagationStopped=t,i.stopImmediatePropagation=function(){r.stopImmediatePropagation&&r.stopImmediatePropagation(),i.isImmediatePropagationStopped=e,i.stopPropagation()},i.isImmediatePropagationStopped=t,i.clientX!==null&&i.clientX!==void 0){const n=X.documentElement,a=X.body;i.pageX=i.clientX+(n&&n.scrollLeft||a&&a.scrollLeft||0)-(n&&n.clientLeft||a&&a.clientLeft||0),i.pageY=i.clientY+(n&&n.scrollTop||a&&a.scrollTop||0)-(n&&n.clientTop||a&&a.clientTop||0)}i.which=i.charCode||i.keyCode,i.button!==null&&i.button!==void 0&&(i.button=i.button&1?0:i.button&4?1:i.button&2?2:0)}return i.fixed_=!0,i}let qn;const F2=function(){if(typeof qn!="boolean"){qn=!1;try{const i=Object.defineProperty({},"passive",{get(){qn=!0}});k.addEventListener("test",null,i),k.removeEventListener("test",null,i)}catch{}}return qn},$2=["touchstart","touchmove"];function It(i,e,t){if(Array.isArray(e))return tu(It,i,e,t);ft.has(i)||ft.set(i,{});const r=ft.get(i);if(r.handlers||(r.handlers={}),r.handlers[e]||(r.handlers[e]=[]),t.guid||(t.guid=Ut()),r.handlers[e].push(t),r.dispatcher||(r.disabled=!1,r.dispatcher=function(s,n){if(r.disabled)return;s=Ga(s);const a=r.handlers[s.type];if(a){const l=a.slice(0);for(let u=0,f=l.length;u<f&&!s.isImmediatePropagationStopped();u++)try{l[u].call(i,s,n)}catch(p){fe.error(p)}}}),r.handlers[e].length===1)if(i.addEventListener){let s=!1;F2()&&$2.indexOf(e)>-1&&(s={passive:!0}),i.addEventListener(e,r.dispatcher,s)}else i.attachEvent&&i.attachEvent("on"+e,r.dispatcher)}function nt(i,e,t){if(!ft.has(i))return;const r=ft.get(i);if(!r.handlers)return;if(Array.isArray(e))return tu(nt,i,e,t);const s=function(a,l){r.handlers[l]=[],bd(a,l)};if(e===void 0){for(const a in r.handlers)Object.prototype.hasOwnProperty.call(r.handlers||{},a)&&s(i,a);return}const n=r.handlers[e];if(n){if(!t){s(i,e);return}if(t.guid)for(let a=0;a<n.length;a++)n[a].guid===t.guid&&n.splice(a--,1);bd(i,e)}}function es(i,e,t){const r=ft.has(i)?ft.get(i):{},s=i.parentNode||i.ownerDocument;if(typeof e=="string"?e={type:e,target:i}:e.target||(e.target=i),e=Ga(e),r.dispatcher&&r.dispatcher.call(i,e,t),s&&!e.isPropagationStopped()&&e.bubbles===!0)es.call(null,s,e,t);else if(!s&&!e.defaultPrevented&&e.target&&e.target[e.type]){ft.has(e.target)||ft.set(e.target,{});const n=ft.get(e.target);e.target[e.type]&&(n.disabled=!0,typeof e.target[e.type]=="function"&&e.target[e.type](),n.disabled=!1)}return!e.defaultPrevented}function Ka(i,e,t){if(Array.isArray(e))return tu(Ka,i,e,t);const r=function(){nt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Ut(),It(i,e,r)}function iu(i,e,t){const r=function(){nt(i,e,r),t.apply(this,arguments)};r.guid=t.guid=t.guid||Ut(),It(i,e,r)}var j2=Object.freeze({__proto__:null,fixEvent:Ga,on:It,off:nt,trigger:es,one:Ka,any:iu});const Ft=30,Pe=function(i,e,t){e.guid||(e.guid=Ut());const r=e.bind(i);return r.guid=t?t+"_"+e.guid:e.guid,r},fi=function(i,e){let t=k.performance.now();return function(...s){const n=k.performance.now();n-t>=e&&(i(...s),t=n)}},_p=function(i,e,t,r=k){let s;const n=()=>{r.clearTimeout(s),s=null},a=function(){const l=this,u=arguments;let f=function(){s=null,f=null,t||i.apply(l,u)};!s&&t&&i.apply(l,u),r.clearTimeout(s),s=r.setTimeout(f,e)};return a.cancel=n,a};var V2=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Ft,bind_:Pe,throttle:fi,debounce:_p});let ks;class kt{on(e,t){const r=this.addEventListener;this.addEventListener=()=>{},It(this,e,t),this.addEventListener=r}off(e,t){nt(this,e,t)}one(e,t){const r=this.addEventListener;this.addEventListener=()=>{},Ka(this,e,t),this.addEventListener=r}any(e,t){const r=this.addEventListener;this.addEventListener=()=>{},iu(this,e,t),this.addEventListener=r}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=Ga(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),es(this,e)}queueTrigger(e){ks||(ks=new Map);const t=e.type||e;let r=ks.get(this);r||(r=new Map,ks.set(this,r));const s=r.get(t);r.delete(t),k.clearTimeout(s);const n=k.setTimeout(()=>{r.delete(t),r.size===0&&(r=null,ks.delete(this)),this.trigger(e)},0);r.set(t,n)}}kt.prototype.allowedEvents_={};kt.prototype.addEventListener=kt.prototype.on;kt.prototype.removeEventListener=kt.prototype.off;kt.prototype.dispatchEvent=kt.prototype.trigger;const Xa=i=>typeof i.name=="function"?i.name():typeof i.name=="string"?i.name:i.name_?i.name_:i.constructor&&i.constructor.name?i.constructor.name:typeof i,vi=i=>i instanceof kt||!!i.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof i[e]=="function"),q2=(i,e)=>{vi(i)?e():(i.eventedCallbacks||(i.eventedCallbacks=[]),i.eventedCallbacks.push(e))},ol=i=>typeof i=="string"&&/\S/.test(i)||Array.isArray(i)&&!!i.length,da=(i,e,t)=>{if(!i||!i.nodeName&&!vi(i))throw new Error(`Invalid target for ${Xa(e)}#${t}; must be a DOM node or evented object.`)},Tp=(i,e,t)=>{if(!ol(i))throw new Error(`Invalid event type for ${Xa(e)}#${t}; must be a non-empty string or array.`)},vp=(i,e,t)=>{if(typeof i!="function")throw new Error(`Invalid listener for ${Xa(e)}#${t}; must be a function.`)},Lo=(i,e,t)=>{const r=e.length<3||e[0]===i||e[0]===i.eventBusEl_;let s,n,a;return r?(s=i.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(s=e[0],n=e[1],a=e[2]),da(s,i,t),Tp(n,i,t),vp(a,i,t),a=Pe(i,a),{isTargetingSelf:r,target:s,type:n,listener:a}},Ji=(i,e,t,r)=>{da(i,i,e),i.nodeName?j2[e](i,t,r):i[e](t,r)},H2={on(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Lo(this,i,"on");if(Ji(t,"on",r,s),!e){const n=()=>this.off(t,r,s);n.guid=s.guid;const a=()=>this.off("dispose",n);a.guid=s.guid,Ji(this,"on","dispose",n),Ji(t,"on","dispose",a)}},one(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Lo(this,i,"one");if(e)Ji(t,"one",r,s);else{const n=(...a)=>{this.off(t,r,n),s.apply(null,a)};n.guid=s.guid,Ji(t,"one",r,n)}},any(...i){const{isTargetingSelf:e,target:t,type:r,listener:s}=Lo(this,i,"any");if(e)Ji(t,"any",r,s);else{const n=(...a)=>{this.off(t,r,n),s.apply(null,a)};n.guid=s.guid,Ji(t,"any",r,n)}},off(i,e,t){if(!i||ol(i))nt(this.eventBusEl_,i,e);else{const r=i,s=e;da(r,this,"off"),Tp(s,this,"off"),vp(t,this,"off"),t=Pe(this,t),this.off("dispose",t),r.nodeName?(nt(r,s,t),nt(r,"dispose",t)):vi(r)&&(r.off(s,t),r.off("dispose",t))}},trigger(i,e){da(this.eventBusEl_,this,"trigger");const t=i&&typeof i!="string"?i.type:i;if(!ol(t))throw new Error(`Invalid event type for ${Xa(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return es(this.eventBusEl_,i,e)}};function ru(i,e={}){const{eventBusKey:t}=e;if(t){if(!i[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);i.eventBusEl_=i[t]}else i.eventBusEl_=ne("span",{className:"vjs-event-bus"});return Object.assign(i,H2),i.eventedCallbacks&&i.eventedCallbacks.forEach(r=>{r()}),i.on("dispose",()=>{i.off(),[i,i.el_,i.eventBusEl_].forEach(function(r){r&&ft.has(r)&&ft.delete(r)}),k.setTimeout(()=>{i.eventBusEl_=null},0)}),i}const z2={state:{},setState(i){typeof i=="function"&&(i=i());let e;return kr(i,(t,r)=>{this.state[r]!==t&&(e=e||{},e[r]={from:this.state[r],to:t}),this.state[r]=t}),e&&vi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function bp(i,e){return Object.assign(i,z2),i.state=Object.assign({},i.state,e),typeof i.handleStateChanged=="function"&&vi(i)&&i.on("statechanged",i.handleStateChanged),i}const qs=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toLowerCase())},He=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},xp=function(i,e){return He(i)===He(e)};var W2=Object.freeze({__proto__:null,toLowerCase:qs,toTitleCase:He,titleCaseEquals:xp});class H{constructor(e,t,r){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=Ae({},this.options_),t=this.options_=Ae(this.options_,t),this.id_=t.id||t.el&&t.el.id,!this.id_){const s=e&&e.id&&e.id()||"no_player";this.id_=`${s}_component_${Ut()}`}this.name_=t.name||null,t.el?this.el_=t.el:t.createEl!==!1&&(this.el_=this.createEl()),t.className&&this.el_&&t.className.split(" ").forEach(s=>this.addClass(s)),["on","off","one","any","trigger"].forEach(s=>{this[s]=void 0}),t.evented!==!1&&(ru(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),bp(this,this.constructor.defaultState),this.children_=[],this.childIndex_={},this.childNameIndex_={},this.setTimeoutIds_=new Set,this.setIntervalIds_=new Set,this.rafIds_=new Set,this.namedRafs_=new Map,this.clearingTimersOnDispose_=!1,t.initChildren!==!1&&this.initChildren(),this.ready(r),t.reportTouchActivity!==!1&&this.enableTouchActivity()}dispose(e={}){if(!this.isDisposed_){if(this.readyQueue_&&(this.readyQueue_.length=0),this.trigger({type:"dispose",bubbles:!1}),this.isDisposed_=!0,this.children_)for(let t=this.children_.length-1;t>=0;t--)this.children_[t].dispose&&this.children_[t].dispose();this.children_=null,this.childIndex_=null,this.childNameIndex_=null,this.parentComponent_=null,this.el_&&(this.el_.parentNode&&(e.restoreEl?this.el_.parentNode.replaceChild(e.restoreEl,this.el_):this.el_.parentNode.removeChild(this.el_)),this.el_=null),this.player_=null}}isDisposed(){return!!this.isDisposed_}player(){return this.player_}options(e){return e?(this.options_=Ae(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,r){return ne(e,t,r)}localize(e,t,r=e){const s=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[s],l=s&&s.split("-")[0],u=n&&n[l];let f=r;return a&&a[e]?f=a[e]:u&&u[e]&&(f=u[e]),t&&(f=f.replace(/\{(\d+)\}/g,function(p,T){const b=t[T-1];let S=b;return typeof b>"u"&&(S=p),S})),f}handleLanguagechange(){}contentEl(){return this.contentEl_||this.el_}id(){return this.id_}name(){return this.name_}children(){return this.children_}getChildById(e){return this.childIndex_[e]}getChild(e){if(e)return this.childNameIndex_[e]}getDescendant(...e){e=e.reduce((r,s)=>r.concat(s),[]);let t=this;for(let r=0;r<e.length;r++)if(t=t.getChild(e[r]),!t||!t.getChild)return;return t}setIcon(e,t=this.el()){if(!this.player_.options_.experimentalSvgIcons)return;const r="http://www.w3.org/2000/svg",s=ne("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=X.createElementNS(r,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=X.createElementNS(r,"use");return n.appendChild(a),a.setAttributeNS(null,"href",`#vjs-icon-${e}`),s.appendChild(n),this.iconIsSet_?t.replaceChild(s,t.querySelector(".vjs-icon-placeholder")):t.appendChild(s),this.iconIsSet_=!0,s}addChild(e,t={},r=this.children_.length){let s,n;if(typeof e=="string"){n=He(e);const a=t.componentClass||n;t.name=n;const l=H.getComponent(a);if(!l)throw new Error(`Component ${a} does not exist`);if(typeof l!="function")return null;s=new l(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(r,0,s),s.parentComponent_=this,typeof s.id=="function"&&(this.childIndex_[s.id()]=s),n=n||s.name&&He(s.name()),n&&(this.childNameIndex_[n]=s,this.childNameIndex_[qs(n)]=s),typeof s.el=="function"&&s.el()){let a=null;this.children_[r+1]&&(this.children_[r+1].el_?a=this.children_[r+1].el_:Zr(this.children_[r+1])&&(a=this.children_[r+1])),this.contentEl().insertBefore(s.el(),a)}return s}removeChild(e){if(typeof e=="string"&&(e=this.getChild(e)),!e||!this.children_)return;let t=!1;for(let s=this.children_.length-1;s>=0;s--)if(this.children_[s]===e){t=!0,this.children_.splice(s,1);break}if(!t)return;e.parentComponent_=null,this.childIndex_[e.id()]=null,this.childNameIndex_[He(e.name())]=null,this.childNameIndex_[qs(e.name())]=null;const r=e.el();r&&r.parentNode===this.contentEl()&&this.contentEl().removeChild(e.el())}initChildren(){const e=this.options_.children;if(e){const t=this.options_,r=a=>{const l=a.name;let u=a.opts;if(t[l]!==void 0&&(u=t[l]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const f=this.addChild(l,u);f&&(this[l]=f)};let s;const n=H.getComponent("Tech");Array.isArray(e)?s=e:s=Object.keys(e),s.concat(Object.keys(this.options_).filter(function(a){return!s.some(function(l){return typeof l=="string"?a===l:a===l.name})})).map(a=>{let l,u;return typeof a=="string"?(l=a,u=e[l]||this.options_[l]||{}):(l=a.name,u=a),{name:l,opts:u}}).filter(a=>{const l=H.getComponent(a.opts.componentClass||He(a.name));return l&&!n.isTech(l)}).forEach(r)}}buildCSSClass(){return""}ready(e,t=!1){if(e){if(!this.isReady_){this.readyQueue_=this.readyQueue_||[],this.readyQueue_.push(e);return}t?e.call(this):this.setTimeout(e,1)}}triggerReady(){this.isReady_=!0,this.setTimeout(function(){const e=this.readyQueue_;this.readyQueue_=[],e&&e.length>0&&e.forEach(function(t){t.call(this)},this),this.trigger("ready")},1)}$(e,t){return Vi(e,t||this.contentEl())}$$(e,t){return hp(e,t||this.contentEl())}hasClass(e){return Vs(this.el_,e)}addClass(...e){sr(this.el_,...e)}removeClass(...e){qa(this.el_,...e)}toggleClass(e,t){sp(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 ap(this.el_,e)}setAttribute(e,t){Wr(this.el_,e,t)}removeAttribute(e){Ha(this.el_,e)}width(e,t){return this.dimension("width",e,t)}height(e,t){return this.dimension("height",e,t)}dimensions(e,t){this.width(e,!0),this.height(t)}dimension(e,t,r){if(t!==void 0){(t===null||t!==t)&&(t=0),(""+t).indexOf("%")!==-1||(""+t).indexOf("px")!==-1?this.el_.style[e]=t:t==="auto"?this.el_.style[e]="":this.el_.style[e]=t+"px",r||this.trigger("componentresize");return}if(!this.el_)return 0;const s=this.el_.style[e],n=s.indexOf("px");return parseInt(n!==-1?s.slice(0,n):this.el_["offset"+He(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Kr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const r=`offset${He(e)}`;t=this.el_[r]}return t}currentDimensions(){return{width:this.currentDimension("width"),height:this.currentDimension("height")}}currentWidth(){return this.currentDimension("width")}currentHeight(){return this.currentDimension("height")}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},r={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:r}}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 r=10,s=200;let n;this.on("touchstart",function(l){l.touches.length===1&&(t={pageX:l.touches[0].pageX,pageY:l.touches[0].pageY},e=k.performance.now(),n=!0)}),this.on("touchmove",function(l){if(l.touches.length>1)n=!1;else if(t){const u=l.touches[0].pageX-t.pageX,f=l.touches[0].pageY-t.pageY;Math.sqrt(u*u+f*f)>r&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(l){t=null,n===!0&&k.performance.now()-e<s&&(l.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Pe(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const r=function(s){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",r),this.on("touchcancel",r)}setTimeout(e,t){var r;return e=Pe(this,e),this.clearTimersOnDispose_(),r=k.setTimeout(()=>{this.setTimeoutIds_.has(r)&&this.setTimeoutIds_.delete(r),e()},t),this.setTimeoutIds_.add(r),r}clearTimeout(e){return this.setTimeoutIds_.has(e)&&(this.setTimeoutIds_.delete(e),k.clearTimeout(e)),e}setInterval(e,t){e=Pe(this,e),this.clearTimersOnDispose_();const r=k.setInterval(e,t);return this.setIntervalIds_.add(r),r}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),k.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Pe(this,e),t=k.requestAnimationFrame(()=>{this.rafIds_.has(t)&&this.rafIds_.delete(t),e()}),this.rafIds_.add(t),t}requestNamedAnimationFrame(e,t){this.namedRafs_.has(e)&&this.cancelNamedAnimationFrame(e),this.clearTimersOnDispose_(),t=Pe(this,t);const r=this.requestAnimationFrame(()=>{t(),this.namedRafs_.has(e)&&this.namedRafs_.delete(e)});return this.namedRafs_.set(e,r),e}cancelNamedAnimationFrame(e){this.namedRafs_.has(e)&&(this.cancelAnimationFrame(this.namedRafs_.get(e)),this.namedRafs_.delete(e))}cancelAnimationFrame(e){return this.rafIds_.has(e)&&(this.rafIds_.delete(e),k.cancelAnimationFrame(e)),e}clearTimersOnDispose_(){this.clearingTimersOnDispose_||(this.clearingTimersOnDispose_=!0,this.one("dispose",()=>{[["namedRafs_","cancelNamedAnimationFrame"],["rafIds_","cancelAnimationFrame"],["setTimeoutIds_","clearTimeout"],["setIntervalIds_","clearInterval"]].forEach(([e,t])=>{this[e].forEach((r,s)=>this[t](s))}),this.clearingTimersOnDispose_=!1}))}getIsDisabled(){return!!this.el_.disabled}getIsExpresslyInert(){return this.el_.inert&&!this.el_.ownerDocument.documentElement.inert}getIsFocusable(e){return(e||this.el_).tabIndex>=0&&!(this.getIsDisabled()||this.getIsExpresslyInert())}getIsAvailableToBeFocused(e){function t(n){const a=k.getComputedStyle(n,null),l=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(l)}function r(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||k.getComputedStyle(n).height==="0px"||k.getComputedStyle(n).width==="0px")}function s(n){if(n.offsetWidth+n.offsetHeight+n.getBoundingClientRect().height+n.getBoundingClientRect().width===0)return!1;const a={x:n.getBoundingClientRect().left+n.offsetWidth/2,y:n.getBoundingClientRect().top+n.offsetHeight/2};if(a.x<0||a.x>(X.documentElement.clientWidth||k.innerWidth)||a.y<0||a.y>(X.documentElement.clientHeight||k.innerHeight))return!1;let l=X.elementFromPoint(a.x,a.y);for(;l;){if(l===n)return!0;if(l.parentNode)l=l.parentNode;else return!1}}return e||(e=this.el()),!!(s(e)&&r(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 r=H.getComponent("Tech"),s=r&&r.isTech(t),n=H===t||H.prototype.isPrototypeOf(t.prototype);if(s||!n){let l;throw s?l="techs must be registered using Tech.registerTech()":l="must be a Component subclass",new Error(`Illegal component, "${e}"; ${l}.`)}e=He(e),H.components_||(H.components_={});const a=H.getComponent("Player");if(e==="Player"&&a&&a.players){const l=a.players,u=Object.keys(l);if(l&&u.length>0&&u.map(f=>l[f]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return H.components_[e]=t,H.components_[qs(e)]=t,t}static getComponent(e){if(!(!e||!H.components_))return H.components_[e]}}H.registerComponent("Component",H);function G2(i,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${i}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function xd(i,e,t,r){return G2(i,r,t.length-1),t[r][e]}function Ro(i){let e;return i===void 0||i.length===0?e={length:0,start(){throw new Error("This TimeRanges object is empty")},end(){throw new Error("This TimeRanges object is empty")}}:e={length:i.length,start:xd.bind(null,"start",0,i),end:xd.bind(null,"end",1,i)},k.Symbol&&k.Symbol.iterator&&(e[k.Symbol.iterator]=()=>(i||[]).values()),e}function Wt(i,e){return Array.isArray(i)?Ro(i):i===void 0||e===void 0?Ro():Ro([[i,e]])}const Sp=function(i,e){i=i<0?0:i;let t=Math.floor(i%60),r=Math.floor(i/60%60),s=Math.floor(i/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(i)||i===1/0)&&(s=r=t="-"),s=s>0||a>0?s+":":"",r=((s||n>=10)&&r<10?"0"+r:r)+":",t=t<10?"0"+t:t,s+r+t};let su=Sp;function Ep(i){su=i}function Cp(){su=Sp}function ur(i,e=i){return su(i,e)}var K2=Object.freeze({__proto__:null,createTimeRanges:Wt,createTimeRange:Wt,setFormatTime:Ep,resetFormatTime:Cp,formatTime:ur});function Ap(i,e){let t=0,r,s;if(!e)return 0;(!i||!i.length)&&(i=Wt(0,0));for(let n=0;n<i.length;n++)r=i.start(n),s=i.end(n),s>e&&(s=e),t+=s-r;return t/e}function je(i){if(i instanceof je)return i;typeof i=="number"?this.code=i:typeof i=="string"?this.message=i:di(i)&&(typeof i.code=="number"&&(this.code=i.code),Object.assign(this,i)),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 Hs(i){return i!=null&&typeof i.then=="function"}function si(i){Hs(i)&&i.then(null,e=>{})}const ll=function(i){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,r,s)=>(i[r]&&(t[r]=i[r]),t),{cues:i.cues&&Array.prototype.map.call(i.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},X2=function(i){const e=i.$$("track"),t=Array.prototype.map.call(e,s=>s.track);return Array.prototype.map.call(e,function(s){const n=ll(s.track);return s.src&&(n.src=s.src),n}).concat(Array.prototype.filter.call(i.textTracks(),function(s){return t.indexOf(s)===-1}).map(ll))},Y2=function(i,e){return i.forEach(function(t){const r=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(s=>r.addCue(s))}),e.textTracks()};var Sd={textTracksToJson:X2,jsonToTextTracks:Y2,trackToJson_:ll};const Oo="vjs-modal-dialog";class ts extends H{constructor(e,t){super(e,t),this.handleKeyDown_=r=>this.handleKeyDown(r),this.close_=r=>this.close(r),this.opened_=this.hasBeenOpened_=this.hasBeenFilled_=!1,this.closeable(!this.options_.uncloseable),this.content(this.options_.content),this.contentEl_=ne("div",{className:`${Oo}-content`},{role:"document"}),this.descEl_=ne("p",{className:`${Oo}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Hi(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`${Oo} 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 r=this.getChild("closeButton");if(t&&!r){const s=this.contentEl_;this.contentEl_=this.el_,r=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,this.on(r,"close",this.close_)}!t&&r&&(this.off(r,"close",this.close_),this.removeChild(r),r.dispose())}return this.closeable_}fill(){this.fillWith(this.content())}fillWith(e){const t=this.contentEl(),r=t.parentNode,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,r.removeChild(t),this.empty(),dp(t,e),this.trigger("modalfill"),s?r.insertBefore(t,s):r.appendChild(t);const n=this.getChild("closeButton");n&&r.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),Wa(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_(),r=this.el_.querySelector(":focus");let s;for(let n=0;n<t.length;n++)if(r===t[n]){s=n;break}X.activeElement===this.el_&&(s=0),e.shiftKey&&s===0?(t[t.length-1].focus(),e.preventDefault()):!e.shiftKey&&s===t.length-1&&(t[0].focus(),e.preventDefault())}focusableEls_(){const e=this.el_.querySelectorAll("*");return Array.prototype.filter.call(e,t=>(t instanceof k.HTMLAnchorElement||t instanceof k.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof k.HTMLInputElement||t instanceof k.HTMLSelectElement||t instanceof k.HTMLTextAreaElement||t instanceof k.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof k.HTMLIFrameElement||t instanceof k.HTMLObjectElement||t instanceof k.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}ts.prototype.options_={pauseOnOpen:!0,temporary:!0};H.registerComponent("ModalDialog",ts);class Xr extends kt{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})},vi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let r=0,s=this.length;r<s;r++)if(this[r]===e){t=this[r],t.off&&t.off(),this.tracks_.splice(r,1);break}t&&this.trigger({track:t,type:"removetrack",target:this})}getTrackById(e){let t=null;for(let r=0,s=this.length;r<s;r++){const n=this[r];if(n.id===e){t=n;break}}return t}}Xr.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const i in Xr.prototype.allowedEvents_)Xr.prototype["on"+i]=null;const No=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].enabled=!1)};class Q2 extends Xr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){No(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&No(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,No(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 Bo=function(i,e){for(let t=0;t<i.length;t++)!Object.keys(i[t]).length||e.id===i[t].id||(i[t].selected=!1)};class J2 extends Xr{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Bo(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&&Bo(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Bo(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 wp extends Xr{addTrack(e){super.addTrack(e),this.queueChange_||(this.queueChange_=()=>this.queueTrigger("change")),this.triggerSelectedlanguagechange||(this.triggerSelectedlanguagechange_=()=>this.trigger("selectedlanguagechange")),e.addEventListener("modechange",this.queueChange_),["metadata","chapters"].indexOf(e.kind)===-1&&e.addEventListener("modechange",this.triggerSelectedlanguagechange_)}removeTrack(e){super.removeTrack(e),e.removeEventListener&&(this.queueChange_&&e.removeEventListener("modechange",this.queueChange_),this.selectedlanguagechange_&&e.removeEventListener("modechange",this.triggerSelectedlanguagechange_))}}class Z2{constructor(e=[]){this.trackElements_=[],Object.defineProperty(this,"length",{get(){return this.trackElements_.length}});for(let t=0,r=e.length;t<r;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 r=0,s=this.trackElements_.length;r<s;r++)if(e===this.trackElements_[r].track){t=this.trackElements_[r];break}return t}removeTrackElement_(e){for(let t=0,r=this.trackElements_.length;t<r;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 ha{constructor(e){ha.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let r=0;const s=e.length;this.cues_=e,this.length_=e.length;const n=function(a){""+a in this||Object.defineProperty(this,""+a,{get(){return this.cues_[a]}})};if(t<s)for(r=t;r<s;r++)n.call(this,r)}getCueById(e){let t=null;for(let r=0,s=this.length;r<s;r++){const n=this[r];if(n.id===e){t=n;break}}return t}}const e1={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},t1={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},i1={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ed={disabled:"disabled",hidden:"hidden",showing:"showing"};class nu extends kt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Ut(),kind:e.kind||"",language:e.language||""};let r=e.label||"";for(const s in t)Object.defineProperty(this,s,{get(){return t[s]},set(){}});Object.defineProperty(this,"label",{get(){return r},set(s){s!==r&&(r=s,this.trigger("labelchange"))}})}}const au=function(i){return new URL(i,X.baseURI)},Dp=function(i){return new URL(i,X.baseURI).href},ou=function(i){if(typeof i=="string"){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(i);if(t)return t.pop().toLowerCase()}return""},Ya=function(i,e=k.location){return au(i).origin!==e.origin};var r1=Object.freeze({__proto__:null,parseUrl:au,getAbsoluteURL:Dp,getFileExtension:ou,isCrossOrigin:Ya});const Cd=function(i,e){const t=new k.WebVTT.Parser(k,k.vttjs,k.WebVTT.StringDecoder()),r=[];t.oncue=function(s){e.addCue(s)},t.onparsingerror=function(s){r.push(s)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(i),r.length>0&&(k.console&&k.console.groupCollapsed&&k.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),r.forEach(s=>fe.error(s)),k.console&&k.console.groupEnd&&k.console.groupEnd()),t.flush()},Ad=function(i,e){const t={uri:i},r=Ya(i);r&&(t.cors=r);const s=e.tech_.crossOrigin()==="use-credentials";s&&(t.withCredentials=s),Wh(t,Pe(this,function(n,a,l){if(n)return fe.error(n,a);e.loaded_=!0,typeof k.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){fe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Cd(l,e)}):Cd(l,e)}))};class ln extends nu{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=Ae(e,{kind:i1[e.kind]||"subtitles",language:e.language||e.srclang||""});let r=Ed[t.mode]||"disabled";const s=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(r="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new ha(this.cues_),a=new ha(this.activeCues_);let l=!1;this.timeupdateHandler=Pe(this,function(f={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,l&&(this.trigger("cuechange"),l=!1),f.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),r!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return r},set(f){Ed[f]&&r!==f&&(r=f,!this.preload_&&r!=="disabled"&&this.cues.length===0&&Ad(this.src,this),this.stopTracking(),r!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const f=this.tech_.currentTime(),p=[];for(let T=0,b=this.cues.length;T<b;T++){const S=this.cues[T];S.startTime<=f&&S.endTime>=f&&p.push(S)}if(l=!1,p.length!==this.activeCues_.length)l=!0;else for(let T=0;T<p.length;T++)this.activeCues_.indexOf(p[T])===-1&&(l=!0);return this.activeCues_=p,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")&&Ad(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 k.vttjs.VTTCue(e.startTime,e.endTime,e.text);for(const s in e)s in t||(t[s]=e[s]);t.id=e.id,t.originalCue_=e}const r=this.tech_.textTracks();for(let s=0;s<r.length;s++)r[s]!==this&&r[s].removeCue(t);this.cues_.push(t),this.cues.setCues_(this.cues_)}removeCue(e){let t=this.cues_.length;for(;t--;){const r=this.cues_[t];if(r===e||r.originalCue_&&r.originalCue_===e){this.cues_.splice(t,1),this.cues.setCues_(this.cues_);break}}}}ln.prototype.allowedEvents_={cuechange:"cuechange"};class Ip extends nu{constructor(e={}){const t=Ae(e,{kind:t1[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"enabled",{get(){return r},set(s){typeof s!="boolean"||s===r||(r=s,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class kp extends nu{constructor(e={}){const t=Ae(e,{kind:e1[e.kind]||""});super(t);let r=!1;Object.defineProperty(this,"selected",{get(){return r},set(s){typeof s!="boolean"||s===r||(r=s,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Ei extends kt{constructor(e={}){super();let t;const r=new ln(e);this.kind=r.kind,this.src=r.src,this.srclang=r.language,this.label=r.label,this.default=r.default,Object.defineProperties(this,{readyState:{get(){return t}},track:{get(){return r}}}),t=Ei.NONE,r.addEventListener("loadeddata",()=>{t=Ei.LOADED,this.trigger({type:"load",target:this})})}}Ei.prototype.allowedEvents_={load:"load"};Ei.NONE=0;Ei.LOADING=1;Ei.LOADED=2;Ei.ERROR=3;const Mt={audio:{ListClass:Q2,TrackClass:Ip,capitalName:"Audio"},video:{ListClass:J2,TrackClass:kp,capitalName:"Video"},text:{ListClass:wp,TrackClass:ln,capitalName:"Text"}};Object.keys(Mt).forEach(function(i){Mt[i].getterName=`${i}Tracks`,Mt[i].privateName=`${i}Tracks_`});const Yr={remoteText:{ListClass:wp,TrackClass:ln,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:Z2,TrackClass:Ei,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},dt=Object.assign({},Mt,Yr);Yr.names=Object.keys(Yr);Mt.names=Object.keys(Mt);dt.names=[].concat(Yr.names).concat(Mt.names);function s1(i,e,t,r,s={}){const n=i.textTracks();s.kind=e,t&&(s.label=t),r&&(s.language=r),s.tech=i;const a=new dt.text.TrackClass(s);return n.addTrack(a),a}class ue extends H{constructor(e={},t=function(){}){e.reportTouchActivity=!1,super(null,e,t),this.onDurationChange_=r=>this.onDurationChange(r),this.trackProgress_=r=>this.trackProgress(r),this.trackCurrentTime_=r=>this.trackCurrentTime(r),this.stopTrackingCurrentTime_=r=>this.stopTrackingCurrentTime(r),this.disposeSourceHandler_=r=>this.disposeSourceHandler(r),this.queuedHanders_=new Set,this.hasStarted_=!1,this.on("playing",function(){this.hasStarted_=!0}),this.on("loadstart",function(){this.hasStarted_=!1}),dt.names.forEach(r=>{const s=dt[r];e&&e[s.getterName]&&(this[s.privateName]=e[s.getterName])}),this.featuresProgressEvents||this.manualProgressOn(),this.featuresTimeupdateEvents||this.manualTimeUpdatesOn(),["Text","Audio","Video"].forEach(r=>{e[`native${r}Tracks`]===!1&&(this[`featuresNative${r}Tracks`]=!1)}),e.nativeCaptions===!1||e.nativeTextTracks===!1?this.featuresNativeTextTracks=!1:(e.nativeCaptions===!0||e.nativeTextTracks===!0)&&(this.featuresNativeTextTracks=!0),this.featuresNativeTextTracks||this.emulateTextTracks(),this.preloadTextTracks=e.preloadTextTracks!==!1,this.autoRemoteTextTracks_=new dt.text.ListClass,this.initTrackListeners(),e.nativeControlsForTouch||this.emitTapEvents(),this.constructor&&(this.name_=this.constructor.name||"Unknown Tech")}triggerSourceset(e){this.isReady_||this.one("ready",()=>this.setTimeout(()=>this.triggerSourceset(e),1)),this.trigger({src:e,type:"sourceset"})}manualProgressOn(){this.on("durationchange",this.onDurationChange_),this.manualProgress=!0,this.one("ready",this.trackProgress_)}manualProgressOff(){this.manualProgress=!1,this.stopTrackingProgress(),this.off("durationchange",this.onDurationChange_)}trackProgress(e){this.stopTrackingProgress(),this.progressInterval=this.setInterval(Pe(this,function(){const t=this.bufferedPercent();this.bufferedPercent_!==t&&this.trigger("progress"),this.bufferedPercent_=t,t===1&&this.stopTrackingProgress()}),500)}onDurationChange(e){this.duration_=this.duration()}buffered(){return Wt(0,0)}bufferedPercent(){return Ap(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(Mt.names),this.manualProgress&&this.manualProgressOff(),this.manualTimeUpdates&&this.manualTimeUpdatesOff(),super.dispose()}clearTracks(e){e=[].concat(e),e.forEach(t=>{const r=this[`${t}Tracks`]()||[];let s=r.length;for(;s--;){const n=r[s];t==="text"&&this.removeRemoteTextTrack(n),r.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const r=e[t];this.removeRemoteTextTrack(r)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new je(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?Wt(0,0):Wt()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Mt.names.forEach(e=>{const t=Mt[e],r=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",r),s.addEventListener("addtrack",r),this.on("dispose",()=>{s.removeEventListener("removetrack",r),s.removeEventListener("addtrack",r)})})}addWebVttScript_(){if(!k.WebVTT)if(X.body.contains(this.el())){if(!this.options_["vtt.js"]&&zr(qc)&&Object.keys(qc).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}),k.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),r=l=>e.addTrack(l.track),s=l=>e.removeTrack(l.track);t.on("addtrack",r),t.on("removetrack",s),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let l=0;l<e.length;l++){const u=e[l];u.removeEventListener("cuechange",n),u.mode==="showing"&&u.addEventListener("cuechange",n)}};a(),e.addEventListener("change",a),e.addEventListener("addtrack",a),e.addEventListener("removetrack",a),this.on("dispose",function(){t.off("addtrack",r),t.off("removetrack",s),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let l=0;l<e.length;l++)e[l].removeEventListener("cuechange",n)})}addTextTrack(e,t,r){if(!e)throw new Error("TextTrack kind is required but was not provided");return s1(this,e,t,r)}createRemoteTextTrack(e){const t=Ae(e,{tech:this});return new Yr.remoteTextEl.TrackClass(t)}addRemoteTextTrack(e={},t){const r=this.createRemoteTextTrack(e);return typeof t!="boolean"&&(t=!1),this.remoteTextTrackEls().addTrackElement_(r),this.remoteTextTracks().addTrack(r.track),t===!1&&this.ready(()=>this.autoRemoteTextTracks_.addTrack(r.track)),r}removeRemoteTextTrack(e){const t=this.remoteTextTrackEls().getTrackElementByTrack_(e);this.remoteTextTrackEls().removeTrackElement_(t),this.remoteTextTracks().removeTrack(e),this.autoRemoteTextTracks_.removeTrack(e)}getVideoPlaybackQuality(){return{}}requestPictureInPicture(){return Promise.reject()}disablePictureInPicture(){return!0}setDisablePictureInPicture(){}requestVideoFrameCallback(e){const t=Ut();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 ue.canPlayType(e.type)}static isTech(e){return e.prototype instanceof ue||e instanceof ue||e===ue}static registerTech(e,t){if(ue.techs_||(ue.techs_={}),!ue.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!ue.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!ue.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=He(e),ue.techs_[e]=t,ue.techs_[qs(e)]=t,e!=="Tech"&&ue.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(ue.techs_&&ue.techs_[e])return ue.techs_[e];if(e=He(e),k&&k.videojs&&k.videojs[e])return fe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),k.videojs[e]}}}dt.names.forEach(function(i){const e=dt[i];ue.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});ue.prototype.featuresVolumeControl=!0;ue.prototype.featuresMuteControl=!0;ue.prototype.featuresFullscreenResize=!1;ue.prototype.featuresPlaybackRate=!1;ue.prototype.featuresProgressEvents=!1;ue.prototype.featuresSourceset=!1;ue.prototype.featuresTimeupdateEvents=!1;ue.prototype.featuresNativeTextTracks=!1;ue.prototype.featuresVideoFrameCallback=!1;ue.withSourceHandlers=function(i){i.registerSourceHandler=function(t,r){let s=i.sourceHandlers;s||(s=i.sourceHandlers=[]),r===void 0&&(r=s.length),s.splice(r,0,t)},i.canPlayType=function(t){const r=i.sourceHandlers||[];let s;for(let n=0;n<r.length;n++)if(s=r[n].canPlayType(t),s)return s;return""},i.selectSourceHandler=function(t,r){const s=i.sourceHandlers||[];let n;for(let a=0;a<s.length;a++)if(n=s[a].canHandleSource(t,r),n)return s[a];return null},i.canPlaySource=function(t,r){const s=i.selectSourceHandler(t,r);return s?s.canHandleSource(t,r):""},["seekable","seeking","duration"].forEach(function(t){const r=this[t];typeof r=="function"&&(this[t]=function(){return this.sourceHandler_&&this.sourceHandler_[t]?this.sourceHandler_[t].apply(this.sourceHandler_,arguments):r.apply(this,arguments)})},i.prototype),i.prototype.setSource=function(t){let r=i.selectSourceHandler(t,this.options_);r||(i.nativeSourceHandler?r=i.nativeSourceHandler:fe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),r!==i.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=r.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},i.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)}};H.registerComponent("Tech",ue);ue.registerTech("Tech",ue);ue.defaultTechOrder_=[];const nr={},fa={},pa={};function n1(i,e){nr[i]=nr[i]||[],nr[i].push(e)}function a1(i,e,t){i.setTimeout(()=>Zi(e,nr[e.type],t,i),1)}function o1(i,e){i.forEach(t=>t.setTech&&t.setTech(e))}function l1(i,e,t){return i.reduceRight(lu(t),e[t]())}function u1(i,e,t,r){return e[t](i.reduce(lu(t),r))}function wd(i,e,t,r=null){const s="call"+He(t),n=i.reduce(lu(s),r),a=n===pa,l=a?null:e[t](n);return h1(i,t,l,a),l}const c1={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},d1={setCurrentTime:1,setMuted:1,setVolume:1},Dd={play:1,pause:1};function lu(i){return(e,t)=>e===pa?pa:t[i]?t[i](e):e}function h1(i,e,t,r){for(let s=i.length-1;s>=0;s--){const n=i[s];n[e]&&n[e](r,t)}}function f1(i){fa.hasOwnProperty(i.id())&&delete fa[i.id()]}function p1(i,e){const t=fa[i.id()];let r=null;if(t==null)return r=e(i),fa[i.id()]=[[e,r]],r;for(let s=0;s<t.length;s++){const[n,a]=t[s];n===e&&(r=a)}return r===null&&(r=e(i),t.push([e,r])),r}function Zi(i={},e=[],t,r,s=[],n=!1){const[a,...l]=e;if(typeof a=="string")Zi(i,nr[a],t,r,s,n);else if(a){const u=p1(r,a);if(!u.setSource)return s.push(u),Zi(i,l,t,r,s,n);u.setSource(Object.assign({},i),function(f,p){if(f)return Zi(i,l,t,r,s,n);s.push(u),Zi(p,i.type===p.type?l:nr[p.type],t,r,s,n)})}else l.length?Zi(i,l,t,r,s,n):n?t(i,s):Zi(i,nr["*"],t,r,s,!0)}const m1={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"},ma=function(i=""){const e=ou(i);return m1[e.toLowerCase()]||""},g1=(i,e)=>{if(!e)return"";if(i.cache_.source.src===e&&i.cache_.source.type)return i.cache_.source.type;const t=i.cache_.sources.filter(s=>s.src===e);if(t.length)return t[0].type;const r=i.$$("source");for(let s=0;s<r.length;s++){const n=r[s];if(n.type&&n.src&&n.src===e)return n.type}return ma(e)},Pp=function(i){if(Array.isArray(i)){let e=[];i.forEach(function(t){t=Pp(t),Array.isArray(t)?e=e.concat(t):di(t)&&e.push(t)}),i=e}else typeof i=="string"&&i.trim()?i=[Id({src:i})]:di(i)&&typeof i.src=="string"&&i.src&&i.src.trim()?i=[Id(i)]:i=[];return i};function Id(i){if(!i.type){const e=ma(i.src);e&&(i.type=e)}return i}var y1=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
25
29
|
<defs>
|
|
26
30
|
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
27
31
|
<path d="M16 10v28l22-14z"></path>
|
|
@@ -163,19 +167,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
163
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>
|
|
164
168
|
</symbol>
|
|
165
169
|
</defs>
|
|
166
|
-
</svg>`;const qu=mr?10009:gr?461:8,Zi={codes:{play:415,pause:19,ff:417,rw:412,back:qu},names:{415:"play",19:"pause",417:"ff",412:"rw",[qu]:"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}},zu=5;class rv extends bt{constructor(e){super(),this.player_=e,this.focusableComponents=[],this.isListening_=!1,this.isPaused_=!1,this.onKeyDown_=this.onKeyDown_.bind(this),this.lastFocusedComponent_=null}start(){this.isListening_||(this.player_.on("keydown",this.onKeyDown_),this.player_.on("modalKeydown",this.onKeyDown_),this.player_.on("loadedmetadata",()=>{this.focus(this.updateFocusableComponents()[0])}),this.player_.on("modalclose",()=>{this.refocusComponent()}),this.player_.on("focusin",this.handlePlayerFocus_.bind(this)),this.player_.on("focusout",this.handlePlayerBlur_.bind(this)),this.isListening_=!0,this.player_.errorDisplay&&this.player_.errorDisplay.on("aftermodalfill",()=>{this.updateFocusableComponents(),this.focusableComponents.length&&(this.focusableComponents.length>1?this.focusableComponents[1].focus():this.focusableComponents[0].focus())}))}stop(){this.player_.off("keydown",this.onKeyDown_),this.isListening_=!1}onKeyDown_(e){const t=e.originalEvent?e.originalEvent:e;if(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(t.key)){if(this.isPaused_)return;t.preventDefault();const i=t.key.substring(5).toLowerCase();this.move(i)}else if(Zi.isEventKey(t,"play")||Zi.isEventKey(t,"pause")||Zi.isEventKey(t,"ff")||Zi.isEventKey(t,"rw")){t.preventDefault();const i=Zi.getEventName(t);this.performMediaAction_(i)}else Zi.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()+zu);break;case"rw":this.userSeek_(this.player_.currentTime()-zu);break}}userSeek_(e){this.player_.liveTracker&&this.player_.liveTracker.isLive()&&this.player_.liveTracker.nextSeekedFromUser(),this.player_.currentTime(e)}pause(){this.isPaused_=!0}resume(){this.isPaused_=!1}handlePlayerBlur_(e){const t=e.relatedTarget;let i=null;const n=this.getCurrentComponent(e.target);t&&(i=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!i||!t)&&(n&&n.name()==="CloseButton"?this.refocusComponent():(this.pause(),n&&n.el()&&(this.lastFocusedComponent_=n)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function i(n){for(const r of n)r.hasOwnProperty("el_")&&r.getIsFocusable()&&r.getIsAvailableToBeFocused(r.el())&&t.push(r),r.hasOwnProperty("children_")&&r.children_.length>0&&i(r.children_)}return e.children_.forEach(n=>{if(n.hasOwnProperty("el_"))if(n.getIsFocusable&&n.getIsAvailableToBeFocused&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())){t.push(n);return}else n.hasOwnProperty("children_")&&n.children_.length>0?i(n.children_):n.hasOwnProperty("items")&&n.items.length>0?i(n.items):this.findSuitableDOMChild(n)&&t.push(n);if(n.name_==="ErrorDisplay"&&n.opened_){const r=n.el_.querySelector(".vjs-errors-ok-button-container");r&&r.querySelectorAll("button").forEach((l,h)=>{t.push({name:()=>"ModalButton"+(h+1),el:()=>l,getPositions:()=>{const f=l.getBoundingClientRect(),m={x:f.x,y:f.y,width:f.width,height:f.height,top:f.top,right:f.right,bottom:f.bottom,left:f.left},T={x:f.left+f.width/2,y:f.top+f.height/2,width:0,height:0,top:f.top+f.height/2,right:f.left+f.width/2,bottom:f.top+f.height/2,left:f.left+f.width/2};return{boundingClientRect:m,center:T}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:f=>!0,focus:()=>l.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let n=0;n<i.children.length;n++){const r=i.children[n],a=t(r);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const i of this.focusableComponents)if(i.el()===t)return i}}add(e){const t=[...this.focusableComponents];e.hasOwnProperty("el_")&&e.getIsFocusable()&&e.getIsAvailableToBeFocused(e.el())&&t.push(e),this.focusableComponents=t,this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents})}remove(e){for(let t=0;t<this.focusableComponents.length;t++)if(this.focusableComponents[t].name()===e.name()){this.focusableComponents.splice(t,1),this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents});return}}clear(){this.focusableComponents.length>0&&(this.focusableComponents=[],this.trigger({type:"focusableComponentsChanged",focusableComponents:this.focusableComponents}))}move(e){const t=this.getCurrentComponent();if(!t)return;const i=t.getPositions(),n=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),r=this.findBestCandidate_(i.center,n,e);r?this.focus(r):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let n=1/0,r=null;for(const a of t){const l=a.getPositions().center,h=this.calculateDistance_(e,l,i);h<n&&(n=h,r=a)}return r}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const n=Math.abs(e.x-t.x),r=Math.abs(e.y-t.y);let a;switch(i){case"right":case"left":a=n+r*100;break;case"up":a=r*2+n*.5;break;case"down":a=r*5+n;break;default:a=n+r}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class av extends H{constructor(e,t,i){const n=xe({createEl:!1},t);if(super(e,n,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let r=0,a=t.playerOptions.techOrder;r<a.length;r++){const l=Be(a[r]);let h=oe.getTech(l);if(l||(h=H.getComponent(l)),h&&h.isSupported()){e.loadTech_(l);break}}else e.src(t.playerOptions.sources)}}H.registerComponent("MediaLoader",av);class ta extends H{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=i=>this.handleMouseOver(i),this.handleMouseOut_=i=>this.handleMouseOut(i),this.handleClick_=i=>this.handleClick(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.emitTapEvents(),this.enable()}createEl(e="div",t={},i={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&ue.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),i=Object.assign({role:"button"},i),this.tabIndex_=t.tabIndex;const n=se(e,t,i);return this.player_.options_.experimentalSvgIcons||n.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=se("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Ci(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}H.registerComponent("ClickableComponent",ta);class ao extends ta{constructor(e,t){super(e,t),this.update(),this.update_=i=>this.update(i),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return se("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(se("picture",{className:"vjs-poster",tabIndex:-1},{},se("img",{loading:"lazy",crossOrigin:this.crossOrigin()},{alt:""}))),this.$("img").src=e}handleClick(e){this.player_.controls()&&(this.player_.tech(!0)&&this.player_.tech(!0).focus(),this.player_.paused()?Kt(this.player_.play()):this.player_.pause())}}ao.prototype.crossorigin=ao.prototype.crossOrigin;H.registerComponent("PosterImage",ao);const Ct="#222",Wu="#ccc",ov={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 Fa(s,e){let t;if(s.length===4)t=s[1]+s[1]+s[2]+s[2]+s[3]+s[3];else if(s.length===7)t=s.slice(1);else throw new Error("Invalid color code provided, "+s+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Ht(s,e,t){try{s.style[e]=t}catch{return}}function Gu(s){return s?`${s}px`:""}class lv extends H{constructor(e,t,i){super(e,t,i);const n=a=>this.updateDisplay(a),r=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",n),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(we(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",r),e.on("playerresize",r);const a=k.screen.orientation||k,l=k.screen.orientation?"change":"orientationchange";a.addEventListener(l,r),e.on("dispose",()=>a.removeEventListener(l,r));const h=this.options_.playerOptions.tracks||[];for(let f=0;f<h.length;f++)this.player_.addRemoteTextTrack(h[f],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let n,r,a;for(let l=0;l<t.length;l++){const h=t[l];i&&i.enabled&&i.language&&i.language===h.language&&h.kind in e?h.kind===i.kind?a=h:a||(a=h):i&&!i.enabled?(a=null,n=null,r=null):h.default&&(h.kind==="descriptions"&&!n?n=h:h.kind in e&&!r&&(r=h))}a?a.mode="showing":r?r.mode="showing":n&&(n.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 k.WebVTT=="function"&&k.WebVTT.processCues(k,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let l=0;l<e.length;++l){const h=e[l];h.mode==="showing"&&a.push(h)}this.updateForTrack(a);return}let i=null,n=null,r=e.length;for(;r--;){const a=e[r];a.mode==="showing"&&(a.kind==="descriptions"?i=a:n=a)}if(n?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(n)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!k.CSS.supports("inset","10px")){const a=this.el_,l=a.querySelectorAll(".vjs-text-track-cue"),h=this.player_.controlBar.el_.getBoundingClientRect().height,f=this.player_.el_.getBoundingClientRect().height;a.style="",Ht(a,"position","relative"),Ht(a,"height",f-h+"px"),Ht(a,"top","unset"),yr?Ht(a,"bottom",f+"px"):Ht(a,"bottom","0px"),l.length>0&&l.forEach(m=>{if(m.style.inset){const T=m.style.inset.split(" ");T.length===3&&Object.assign(m.style,{top:T[0],right:T[1],bottom:T[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!k.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,n=this.player_.videoWidth()/this.player_.videoHeight();let r=0,a=0;Math.abs(i-n)>.1&&(i>n?r=Math.round((e-t*n)/2):a=Math.round((t-e/n)/2)),Ht(this.el_,"insetInline",Gu(r)),Ht(this.el_,"insetBlock",Gu(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let n=i.length;for(;n--;){const r=i[n];if(!r)continue;const a=r.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Ht(a.firstChild,"color",Fa(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Ht(a.firstChild,"backgroundColor",Fa(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Ht(a,"backgroundColor",Fa(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Ct}, 2px 2px 4px ${Ct}, 2px 2px 5px ${Ct}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Ct}, 2px 2px ${Ct}, 3px 3px ${Ct}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Wu}, 0 1px ${Wu}, -1px -1px ${Ct}, 0 -1px ${Ct}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Ct}, 0 0 4px ${Ct}, 0 0 4px ${Ct}, 0 0 4px ${Ct}`)),t.fontPercent&&t.fontPercent!==1){const l=k.parseFloat(a.style.fontSize);a.style.fontSize=l*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=ov[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof k.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const n=e[i];for(let r=0;r<n.activeCues.length;++r)t.push(n.activeCues[r])}k.WebVTT.processCues(k,t,this.el_);for(let i=0;i<e.length;++i){const n=e[i];for(let r=0;r<n.activeCues.length;++r){const a=n.activeCues[r].displayState;Fi(a,"vjs-text-track-cue","vjs-text-track-cue-"+(n.language?n.language:i)),n.language&&_s(a,"lang",n.language)}this.player_.textTrackSettings&&this.updateDisplayState(n)}}}H.registerComponent("TextTrackDisplay",lv);class uv extends H{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=se("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),n=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return n.appendChild(i),n}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}H.registerComponent("LoadingSpinner",uv);class tt extends ta{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const n=se(e,t,i);return this.player_.options_.experimentalSvgIcons||n.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(n),n}addChild(e,t={}){const i=this.constructor.name;return ue.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),H.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)}}H.registerComponent("Button",tt);class lh extends tt{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",i=>this.handleMouseDown(i))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){Kt(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),n=i&&i.getChild("playToggle");if(!n){this.player_.tech(!0).focus();return}const r=()=>n.focus();pn(t)?t.then(r,()=>{}):this.setTimeout(r,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}lh.prototype.controlText_="Play Video";H.registerComponent("BigPlayButton",lh);class cv extends tt{constructor(e,t){super(e,t),this.setIcon("cancel"),this.controlText(t&&t.controlText||this.localize("Close"))}buildCSSClass(){return`vjs-close-button ${super.buildCSSClass()}`}handleClick(e){this.trigger({type:"close",bubbles:!1})}handleKeyDown(e){e.key==="Escape"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}H.registerComponent("CloseButton",cv);class uh extends tt{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",i=>this.handlePlay(i)),this.on(e,"pause",i=>this.handlePause(i)),t.replay&&this.on(e,"ended",i=>this.handleEnded(i))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?Kt(this.player_.play()):this.player_.pause()}handleSeeked(e){this.removeClass("vjs-ended"),this.player_.paused()?this.handlePause(e):this.handlePlay(e)}handlePlay(e){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.setIcon("pause"),this.controlText("Pause")}handlePause(e){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.setIcon("play"),this.controlText("Play")}handleEnded(e){this.removeClass("vjs-playing"),this.addClass("vjs-ended"),this.setIcon("replay"),this.controlText("Replay"),this.one(this.player_,"seeked",t=>this.handleSeeked(t))}}uh.prototype.controlText_="Play";H.registerComponent("PlayToggle",uh);class As extends H{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],i=>this.update(i)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),i=se("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=se("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=Hi(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,ue.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_=K.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}As.prototype.labelText_="Time";As.prototype.controlText_="Time";H.registerComponent("TimeDisplay",As);class Xo extends As{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)}}Xo.prototype.labelText_="Current Time";Xo.prototype.controlText_="Current Time";H.registerComponent("CurrentTimeDisplay",Xo);class Yo extends As{constructor(e,t){super(e,t);const i=n=>this.updateContent(n);this.on(e,"durationchange",i),this.on(e,"loadstart",i),this.on(e,"loadedmetadata",i)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}Yo.prototype.labelText_="Duration";Yo.prototype.controlText_="Duration";H.registerComponent("DurationDisplay",Yo);class dv extends H{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),i=super.createEl("span",{textContent:"/"});return t.appendChild(i),e.appendChild(t),e}}H.registerComponent("TimeDivider",dv);class Qo extends As{constructor(e,t){super(e,t),this.on(e,"durationchange",i=>this.updateContent(i))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(se("span",{},{"aria-hidden":!0},"-"),this.contentEl_),e}updateContent(e){if(typeof this.player_.duration()!="number")return;let t;this.player_.ended()?t=0:this.player_.remainingTimeDisplay?t=this.player_.remainingTimeDisplay():t=this.player_.remainingTime(),this.updateTextNode_(t)}}Qo.prototype.labelText_="Remaining Time";Qo.prototype.controlText_="Remaining Time";H.registerComponent("RemainingTimeDisplay",Qo);class hv extends H{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",i=>this.updateShowing(i))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=se("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(se("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(K.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()}}H.registerComponent("LiveDisplay",hv);class ch extends tt{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=i=>this.updateLiveEdgeStatus(i),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=se("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()}}ch.prototype.controlText_="Seek to live, currently playing live";H.registerComponent("SeekToLive",ch);function Sn(s,e,t){return s=Number(s),Math.min(t,Math.max(e,isNaN(s)?e:s))}var fv=Object.freeze({__proto__:null,clamp:Sn});class Jo extends H{constructor(e,t){super(e,t),this.handleMouseDown_=i=>this.handleMouseDown(i),this.handleMouseUp_=i=>this.handleMouseUp(i),this.handleKeyDown_=i=>this.handleKeyDown(i),this.handleClick_=i=>this.handleClick(i),this.handleMouseMove_=i=>this.handleMouseMove(i),this.update_=i=>this.update(i),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},i={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),i=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},i),super.createEl(e,t,i)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!ei&&e.preventDefault(),Ud(),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;Bd(),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(Sn(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=Xr(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,n=t&&t.horizontalSeek;i?n&&e.key==="ArrowLeft"||!n&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):n&&e.key==="ArrowRight"||!n&&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")}}H.registerComponent("Slider",Jo);const $a=(s,e)=>Sn(s/e*100,0,100).toFixed(2)+"%";class pv extends H{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",i=>this.update(i))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=se("span",{className:"vjs-control-text"}),i=se("span",{textContent:this.localize("Loaded")}),n=K.createTextNode(": ");return this.percentageEl_=se("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),t.appendChild(n),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,i=this.player_.buffered(),n=t&&t.isLive()?t.seekableEnd():this.player_.duration(),r=this.player_.bufferedEnd(),a=this.partEls_,l=$a(r,n);this.percent_!==l&&(this.el_.style.width=l,Ci(this.percentageEl_,l),this.percent_=l);for(let h=0;h<i.length;h++){const f=i.start(h),m=i.end(h);let T=a[h];T||(T=this.el_.appendChild(se()),a[h]=T),!(T.dataset.start===f&&T.dataset.end===m)&&(T.dataset.start=f,T.dataset.end=m,T.style.left=$a(f,r),T.style.width=$a(m-f,r))}for(let h=a.length;h>i.length;h--)this.el_.removeChild(a[h-1]);a.length=i.length})}}H.registerComponent("LoadProgressBar",pv);class mv extends H{constructor(e,t){super(e,t),this.update=ti(we(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const n=Tn(this.el_),r=Ts(this.player_.el()),a=e.width*t;if(!r||!n)return;let l=e.left-r.left+a,h=e.width-a+(r.right-e.right);h||(h=e.width-a,l=a);let f=n.width/2;l<f?f+=f-l:h<f&&(f=h),f<0?f=0:f>n.width&&(f=n.width),f=Math.round(f),this.el_.style.right=`-${f}px`,this.write(i)}write(e){Ci(this.el_,e)}updateTime(e,t,i,n){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let r;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const l=this.player_.liveTracker.liveWindow(),h=l-t*l;r=(h<1?"":"-")+Hi(h,l)}else r=Hi(i,a);this.update(e,t,r),n&&n()})}}H.registerComponent("TimeTooltip",mv);class Zo extends H{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=ti(we(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const i=this.getChild("timeTooltip");if(!i)return;const n=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,n)}}Zo.prototype.options_={children:[]};!Ze&&!Ut&&Zo.prototype.options_.children.push("timeTooltip");H.registerComponent("PlayProgressBar",Zo);class dh extends H{constructor(e,t){super(e,t),this.update=ti(we(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const i=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,i,()=>{this.el_.style.left=`${e.width*t}px`})}}dh.prototype.options_={children:["timeTooltip"]};H.registerComponent("MouseTimeDisplay",dh);const ir=5,Ku=12;class ia extends Jo{constructor(e,t){t=xe(ia.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(Ze||Ut);(!Ze&&!Ut||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=we(this,this.update),this.update=ti(this.update_,kt),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 K&&"visibilityState"in K&&this.on(K,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){K.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,kt))}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(K.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),n=this.player_.liveTracker;let r=this.player_.duration();n&&n.isLive()&&(r=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==i||this.duration_!==r)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[Hi(i,r),Hi(r,r)],"{1} of {2}")),this.currentTime_=i,this.duration_=r),this.bar&&this.bar.update(Ts(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 i=this.player_.liveTracker;return i&&i.isLive()?(t=(e-i.seekableStart())/i.liveWindow(),i.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){vn(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!vn(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const n=this.calculateDistance(e),r=this.player_.liveTracker;if(!r||!r.isLive())i=n*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(n>=.99){r.seekToLiveEdge();return}const a=r.seekableStart(),l=r.liveCurrentTime();if(i=a+n*r.liveWindow(),i>=l&&(i=l),i<=a&&(i=a+.1),i===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=i:this.userSeek_(i),this.player_.options_.enableSmoothSeeking&&this.update()}enable(){super.enable();const e=this.getChild("mouseTimeDisplay");e&&e.show()}disable(){super.disable();const e=this.getChild("mouseTimeDisplay");e&&e.hide()}handleMouseUp(e){super.handleMouseUp(e),e&&e.stopPropagation(),this.player_.scrubbing(!1),this.pendingSeekTime_&&(this.userSeek_(this.pendingSeekTime_),this.pendingSeekTime_=null),this.player_.trigger({type:"timeupdate",target:this,manuallyTriggered:!0}),this.videoWasPlaying?Kt(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+ir)}stepBack(){this.userSeek_(this.player_.currentTime()-ir)}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 i=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*i):this.userSeek_(this.player_.duration()*i)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-ir*Ku)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+ir*Ku)):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 K&&"visibilityState"in K&&this.off(K,"visibilitychange",this.toggleVisibility_),super.dispose()}}ia.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};H.registerComponent("SeekBar",ia);class hh extends H{constructor(e,t){super(e,t),this.handleMouseMove=ti(we(this,this.handleMouseMove),kt),this.throttledHandleMouseSeek=ti(we(this,this.handleMouseSeek),kt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.handleMouseDownHandler_=i=>this.handleMouseDown(i),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const i=t.getChild("playProgressBar"),n=t.getChild("mouseTimeDisplay");if(!i&&!n)return;const r=t.el(),a=Tn(r);let l=Xr(r,e).x;l=Sn(l,0,1),n&&n.update(a,l),i&&i.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeListenersAddedOnMousedownAndTouchstart(),this.addClass("disabled"),this.enabled_=!1,this.player_.scrubbing())){const e=this.getChild("seekBar");this.player_.scrubbing(!1),e.videoWasPlaying&&Kt(this.player_.play())}}enable(){this.children().forEach(e=>e.enable&&e.enable()),!this.enabled()&&(this.on(["mousedown","touchstart"],this.handleMouseDownHandler_),this.on(this.el_,["mousemove","touchmove"],this.handleMouseMove),this.removeClass("disabled"),this.enabled_=!0)}removeListenersAddedOnMousedownAndTouchstart(){const e=this.el_.ownerDocument;this.off(e,"mousemove",this.throttledHandleMouseSeek),this.off(e,"touchmove",this.throttledHandleMouseSeek),this.off(e,"mouseup",this.handleMouseUpHandler_),this.off(e,"touchend",this.handleMouseUpHandler_)}handleMouseDown(e){const t=this.el_.ownerDocument,i=this.getChild("seekBar");i&&i.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}hh.prototype.options_={children:["seekBar"]};H.registerComponent("ProgressControl",hh);class fh extends tt{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],i=>this.handlePictureInPictureChange(i)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],i=>this.handlePictureInPictureEnabledChange(i)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){K.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in k?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 K.exitPictureInPicture=="function"&&super.show()}}fh.prototype.controlText_="Picture-in-Picture";H.registerComponent("PictureInPictureToggle",fh);class ph extends tt{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),K[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()}}ph.prototype.controlText_="Fullscreen";H.registerComponent("FullscreenToggle",ph);const gv=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 yv extends H{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}}H.registerComponent("VolumeLevel",yv);class _v extends H{constructor(e,t){super(e,t),this.update=ti(we(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,n){if(!i){const r=Ts(this.el_),a=Ts(this.player_.el()),l=e.width*t;if(!a||!r)return;const h=e.left-a.left+l,f=e.width-l+(a.right-e.right);let m=r.width/2;h<m?m+=m-h:f<m&&(m=f),m<0?m=0:m>r.width&&(m=r.width),this.el_.style.right=`-${m}px`}this.write(`${n}%`)}write(e){Ci(this.el_,e)}updateVolume(e,t,i,n,r){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,n.toFixed(0)),r&&r()})}}H.registerComponent("VolumeLevelTooltip",_v);class mh extends H{constructor(e,t){super(e,t),this.update=ti(we(this,this.update),kt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const n=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,n,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}mh.prototype.options_={children:["volumeLevelTooltip"]};H.registerComponent("MouseVolumeLevelDisplay",mh);class sa extends Jo{constructor(e,t){super(e,t),this.on("slideractive",i=>this.updateLastVolume_(i)),this.on(e,"volumechange",i=>this.updateARIAAttributes(i)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){vn(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),n=Ts(i),r=this.vertical();let a=Xr(i,e);a=r?a.y:a.x,a=Sn(a,0,1),t.update(n,a,r)}vn(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)})}}sa.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!Ze&&!Ut&&sa.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");sa.prototype.playerEvent="volumechange";H.registerComponent("VolumeBar",sa);class gh extends H{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||ys(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),gv(this,e),this.throttledHandleMouseMove=ti(we(this,this.handleMouseMove),kt),this.handleMouseUpHandler_=i=>this.handleMouseUp(i),this.on("mousedown",i=>this.handleMouseDown(i)),this.on("touchstart",i=>this.handleMouseDown(i)),this.on("mousemove",i=>this.handleMouseMove(i)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}gh.prototype.options_={children:["volumeBar"]};H.registerComponent("VolumeControl",gh);const Tv=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 yh extends tt{constructor(e,t){super(e,t),Tv(this,e),this.on(e,["loadstart","volumechange"],i=>this.update(i))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),i=this.player_.lastVolume_();if(t===0){const n=i<.1?.1:i;this.player_.volume(n),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"),Ze&&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),Gr(this.el_,[0,1,2,3].reduce((i,n)=>i+`${n?" ":""}vjs-vol-${n}`,"")),Fi(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}yh.prototype.controlText_="Mute";H.registerComponent("MuteToggle",yh);class _h extends H{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||ys(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=i=>this.handleKeyPress(i),this.on(e,["loadstart"],i=>this.volumePanelState_(i)),this.on(this.muteToggle,"keyup",i=>this.handleKeyPress(i)),this.on(this.volumeControl,"keyup",i=>this.handleVolumeControlKeyUp(i)),this.on("keydown",i=>this.handleKeyPress(i)),this.on("mouseover",i=>this.handleMouseOver(i)),this.on("mouseout",i=>this.handleMouseOut(i)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),vt(K,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),et(K,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}_h.prototype.options_={children:["muteToggle","volumeControl"]};H.registerComponent("VolumePanel",_h);class Th extends tt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipForwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`forward-${this.skipTime}`),this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipForwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.forward}buildCSSClass(){return`vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`}handleClick(e){if(isNaN(this.player_.duration()))return;const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()?i.seekableEnd():this.player_.duration();let r;t+this.skipTime<=n?r=t+this.skipTime:r=n,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}Th.prototype.controlText_="Skip Forward";H.registerComponent("SkipForward",Th);class vh extends tt{constructor(e,t){super(e,t),this.validOptions=[5,10,30],this.skipTime=this.getSkipBackwardTime(),this.skipTime&&this.validOptions.includes(this.skipTime)?(this.setIcon(`replay-${this.skipTime}`),this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime.toLocaleString(e.language())])),this.show()):this.hide()}getSkipBackwardTime(){const e=this.options_.playerOptions;return e.controlBar&&e.controlBar.skipButtons&&e.controlBar.skipButtons.backward}buildCSSClass(){return`vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.currentTime(),i=this.player_.liveTracker,n=i&&i.isLive()&&i.seekableStart();let r;n&&t-this.skipTime<=n?r=n:t>=this.skipTime?r=t-this.skipTime:r=0,this.player_.currentTime(r)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}vh.prototype.controlText_="Skip Backward";H.registerComponent("SkipBackward",vh);class bh extends H{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",i=>this.handleKeyDown(i)),this.boundHandleBlur_=i=>this.handleBlur(i),this.boundHandleTapClick_=i=>this.handleTapClick(i)}addEventListenerForItem(e){e instanceof H&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof H&&(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_=se(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_),vt(t,"click",function(i){i.preventDefault(),i.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||K.activeElement;if(!this.children().some(i=>i.el()===t)){const i=this.menuButton_;i&&i.buttonPressed_&&t!==i.el().firstChild&&i.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const i=t.filter(n=>n.el()===e.target)[0];if(!i)return;i.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){e.key==="ArrowLeft"||e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepForward()):(e.key==="ArrowRight"||e.key==="ArrowUp")&&(e.preventDefault(),e.stopPropagation(),this.stepBack())}stepForward(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_+1),this.focus(e)}stepBack(){let e=0;this.focusedChild_!==void 0&&(e=this.focusedChild_-1),this.focus(e)}focus(e=0){const t=this.children().slice();t.length&&t[0].hasClass("vjs-menu-title")&&t.shift(),t.length>0&&(e<0?e=0:e>=t.length&&(e=t.length-1),this.focusedChild_=e,t[e].el_.focus())}}H.registerComponent("Menu",bh);class el extends H{constructor(e,t={}){super(e,t),this.menuButton_=new tt(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=tt.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const n=r=>this.handleClick(r);this.handleMenuKeyUp_=r=>this.handleMenuKeyUp(r),this.on(this.menuButton_,"tap",n),this.on(this.menuButton_,"click",n),this.on(this.menuButton_,"keydown",r=>this.handleKeyDown(r)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),vt(K,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",r=>this.handleMouseLeave(r)),this.on("keydown",r=>this.handleSubmenuKeyDown(r))}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 bh(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=se("li",{className:"vjs-menu-title",textContent:Be(this.options_.title),tabIndex:-1}),i=new H(this.player_,{el:t});e.addItem(i)}if(this.items=this.createItems(),this.items)for(let t=0;t<this.items.length;t++)e.addItem(this.items[t]);return e}createItems(){}createEl(){return super.createEl("div",{className:this.buildWrapperCSSClass()},{})}setIcon(e){super.setIcon(e,this.menuButton_.el_)}buildWrapperCSSClass(){let e="vjs-menu-button";this.options_.inline===!0?e+="-inline":e+="-popup";const t=tt.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"),et(K,"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"),Ze&&Ld())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()}}H.registerComponent("MenuButton",el);class tl extends el{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const n=we(this,this.update);i.addEventListener("removetrack",n),i.addEventListener("addtrack",n),i.addEventListener("labelchange",n),this.player_.on("ready",n),this.player_.on("dispose",function(){i.removeEventListener("removetrack",n),i.removeEventListener("addtrack",n),i.removeEventListener("labelchange",n)})}}H.registerComponent("TrackButton",tl);class En extends ta{constructor(e,t){super(e,t),this.selectable=t.selectable,this.isSelected_=t.selected||!1,this.multiSelectable=t.multiSelectable,this.selected(this.isSelected_),this.selectable?this.multiSelectable?this.el_.setAttribute("role","menuitemcheckbox"):this.el_.setAttribute("role","menuitemradio"):this.el_.setAttribute("role","menuitem")}createEl(e,t,i){this.nonIconControl=!0;const n=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),r=se("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?n.appendChild(r):n.replaceChild(r,n.querySelector(".vjs-icon-placeholder")),n}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))}}H.registerComponent("MenuItem",En);class Cn extends En{constructor(e,t){const i=t.track,n=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const r=(...l)=>{this.handleTracksChange.apply(this,l)},a=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],r),n.addEventListener("change",r),n.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],r),n.removeEventListener("change",r),n.removeEventListener("selectedlanguagechange",a)}),n.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof k.Event!="object")try{l=new k.Event("change")}catch{}l||(l=K.createEvent("Event"),l.initEvent("change",!0,!0)),n.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let n=0;n<i.length;n++){const r=i[n];this.kinds.indexOf(r.kind)!==-1&&(r===t?r.mode!=="showing"&&(r.mode="showing"):r.mode!=="disabled"&&(r.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()}}H.registerComponent("TextTrackMenuItem",Cn);class xh extends Cn{constructor(e,t){t.track={player:e,kind:t.kind,kinds:t.kinds,default:!1,mode:"disabled"},t.kinds||(t.kinds=[t.kind]),t.label?t.track.label=t.label:t.track.label=t.kinds.join(" and ")+" off",t.selectable=!0,t.multiSelectable=!1,super(e,t)}handleTracksChange(e){const t=this.player().textTracks();let i=!0;for(let n=0,r=t.length;n<r;n++){const a=t[n];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i!==this.isSelected_&&this.selected(i)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let i=!0;for(let n=0,r=t.length;n<r;n++){const a=t[n];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){i=!1;break}}i&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}H.registerComponent("OffTextTrackMenuItem",xh);class ks extends tl{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Cn){let i;this.label_&&(i=`${this.label_} off`),e.push(new xh(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),this.hideThreshold_+=1;const n=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let r=0;r<n.length;r++){const a=n[r];if(this.kinds_.indexOf(a.kind)>-1){const l=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${a.kind}-menu-item`),e.push(l)}}return e}}H.registerComponent("TextTrackButton",ks);class Sh extends En{constructor(e,t){const i=t.track,n=t.cue,r=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=n.text,t.selected=n.startTime<=r&&r<n.endTime,super(e,t),this.track=i,this.cue=n}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}H.registerComponent("ChaptersTrackMenuItem",Sh);class il extends ks{constructor(e,t,i){super(e,t,i),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(n=>{n.selected(this.track_.activeCues[0]===n.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(Be(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let i=0,n=t.length;i<n;i++){const r=t[i],a=new Sh(this.player_,{track:this.track_,cue:r});e.push(a)}return e}}il.prototype.kind_="chapters";il.prototype.controlText_="Chapters";H.registerComponent("ChaptersButton",il);class sl extends ks{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const n=e.textTracks(),r=we(this,this.handleTracksChange);n.addEventListener("change",r),this.on("dispose",function(){n.removeEventListener("change",r)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let n=0,r=t.length;n<r;n++){const a=t[n];if(a.kind!==this.kind_&&a.mode==="showing"){i=!0;break}}i?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}sl.prototype.kind_="descriptions";sl.prototype.controlText_="Descriptions";H.registerComponent("DescriptionsButton",sl);class nl extends ks{constructor(e,t,i){super(e,t,i),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}nl.prototype.kind_="subtitles";nl.prototype.controlText_="Subtitles";H.registerComponent("SubtitlesButton",nl);class rl extends Cn{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()}}H.registerComponent("CaptionSettingsMenuItem",rl);class al extends ks{constructor(e,t,i){super(e,t,i),this.setIcon("captions")}buildCSSClass(){return`vjs-captions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-captions-button ${super.buildWrapperCSSClass()}`}createItems(){const e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new rl(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}al.prototype.kind_="captions";al.prototype.controlText_="Captions";H.registerComponent("CaptionsButton",al);class Eh extends Cn{createEl(e,t,i){const n=super.createEl(e,t,i),r=n.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",n):r.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(se("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),n}}H.registerComponent("SubsCapsMenuItem",Eh);class ol extends ks{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(Be(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 rl(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Eh),e}}ol.prototype.kinds_=["captions","subtitles"];ol.prototype.controlText_="Subtitles";H.registerComponent("SubsCapsButton",ol);class Ch extends En{constructor(e,t){const i=t.track,n=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const r=(...a)=>{this.handleTracksChange.apply(this,a)};n.addEventListener("change",r),this.on("dispose",()=>{n.removeEventListener("change",r)})}createEl(e,t,i){const n=super.createEl(e,t,i),r=n.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(r.appendChild(se("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),r.appendChild(se("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),n}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const n=t[i];n!==this.track&&(n.enabled=n===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}H.registerComponent("AudioTrackMenuItem",Ch);class wh extends tl{constructor(e,t={}){t.tracks=e.audioTracks(),super(e,t),this.setIcon("audio")}buildCSSClass(){return`vjs-audio-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-audio-button ${super.buildWrapperCSSClass()}`}createItems(e=[]){this.hideThreshold_=1;const t=this.player_.audioTracks();for(let i=0;i<t.length;i++){const n=t[i];e.push(new Ch(this.player_,{track:n,selectable:!0,multiSelectable:!1}))}return e}}wh.prototype.controlText_="Audio Track";H.registerComponent("AudioTrackButton",wh);class ll extends En{constructor(e,t){const i=t.rate,n=parseFloat(i,10);t.label=i,t.selected=n===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,this.rate=n,this.on(e,"ratechange",r=>this.update(r))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}ll.prototype.contentElType="button";H.registerComponent("PlaybackRateMenuItem",ll);class Ih extends el{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",i=>this.updateVisibility(i)),this.on(e,"ratechange",i=>this.updateLabel(i)),this.on(e,"playbackrateschange",i=>this.handlePlaybackRateschange(i))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=se("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let i=e.length-1;i>=0;i--)t.push(new ll(this.player(),{rate:e[i]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}Ih.prototype.controlText_="Playback Rate";H.registerComponent("PlaybackRateMenuButton",Ih);class Ah extends H{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}H.registerComponent("Spacer",Ah);class vv extends Ah{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}H.registerComponent("CustomControlSpacer",vv);class kh extends H{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}kh.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};H.registerComponent("ControlBar",kh);class Ph extends Is{constructor(e,t){super(e,t),this.on(e,"error",i=>{this.open(i)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}Ph.prototype.options_=Object.assign({},Is.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});H.registerComponent("ErrorDisplay",Ph);class Dh extends H{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(),se("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${At()}`)+"-"+t[1].replace(/\W+/g,""),n=se("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return n.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),n}))}}H.registerComponent("TextTrackSelect",Dh);class ji extends H{constructor(e,t={}){super(e,t);const i=se("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const n=this.options_.selects;for(const r of n){const a=this.options_.selectConfigs[r],l=a.className,h=a.id.replace("%s",this.options_.id_);let f=null;const m=`vjs_select_${At()}`;if(this.options_.type==="colors"){f=se("span",{className:l});const E=se("label",{id:h,className:"vjs-label",textContent:this.localize(a.label)});E.setAttribute("for",m),f.appendChild(E)}const T=new Dh(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:m,labelId:h});this.addChild(T),this.options_.type==="colors"&&(f.appendChild(T.el()),this.el().appendChild(f))}}createEl(){return se("fieldset",{className:this.options_.className})}}H.registerComponent("TextTrackFieldset",ji);class Lh extends H{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new ji(e,{id_:i,legendId:`captions-text-legend-${i}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const r=new ji(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(r);const a=new ji(e,{id_:i,legendId:`captions-window-${i}`,legendText:this.localize("Caption Area Background"),className:"vjs-window vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(a)}createEl(){return se("div",{className:"vjs-track-settings-colors"})}}H.registerComponent("TextTrackSettingsColors",Lh);class Oh extends H{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,n=new ji(e,{id_:i,legendId:`captions-font-size-${i}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const r=new ji(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(r);const a=new ji(e,{id_:i,legendId:`captions-font-family-${i}`,legendText:this.localize("Font Family"),className:"vjs-font-family vjs-track-setting",selects:this.options_.fieldSets[2],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(a)}createEl(){return se("div",{className:"vjs-track-settings-font"})}}H.registerComponent("TextTrackSettingsFont",Oh);class Rh extends H{constructor(e,t={}){super(e,t);const i=this.localize("restore all settings to the default values"),n=new tt(e,{controlText:i,className:"vjs-default-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Reset"),this.addChild(n);const r=new tt(e,{controlText:i,className:"vjs-done-button"});r.el().classList.remove("vjs-control","vjs-button"),r.el().textContent=this.localize("Done"),this.addChild(r)}createEl(){return se("div",{className:"vjs-track-settings-controls"})}}H.registerComponent("TrackSettingsControls",Rh);const ja="vjs-text-track-settings",Xu=["#000","Black"],Yu=["#00F","Blue"],Qu=["#0FF","Cyan"],Ju=["#0F0","Green"],Zu=["#F0F","Magenta"],ec=["#F00","Red"],tc=["#FFF","White"],ic=["#FF0","Yellow"],Va=["1","Opaque"],Ha=["0.5","Semi-Transparent"],sc=["0","Transparent"],xi={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Xu,tc,ec,Ju,Yu,ic,Zu,Qu],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[Va,Ha,sc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[tc,Xu,ec,Ju,Yu,ic,Zu,Qu],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:[Va,Ha],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:[sc,Ha,Va],className:"vjs-window-opacity vjs-opacity"}};xi.windowColor.options=xi.backgroundColor.options;function Mh(s,e){if(e&&(s=e(s)),s&&s!=="none")return s}function bv(s,e){const t=s.options[s.options.selectedIndex].value;return Mh(t,e)}function xv(s,e,t){if(e){for(let i=0;i<s.options.length;i++)if(Mh(s.options[i].value,t)===e){s.selectedIndex=i;break}}}class Sv extends Is{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=se("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),t.persistTextTrackSettings===void 0&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.bindFunctionsToSelectsAndButtons(),this.options_.persistTextTrackSettings&&this.restoreSettings()}renderModalComponents(e){const t=new Lh(e,{textTrackComponentid:this.id_,selectConfigs:xi,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new Oh(e,{textTrackComponentid:this.id_,selectConfigs:xi,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const n=new Rh(e);this.addChild(n)}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()}),rs(xi,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 Cd(xi,(e,t,i)=>{const n=bv(this.$(t.selector),t.parser);return n!==void 0&&(e[i]=n),e},{})}setValues(e){rs(xi,(t,i)=>{xv(this.$(t.selector),e[i],t.parser)})}setDefaults(){rs(xi,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(k.localStorage.getItem(ja))}catch(t){ue.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?k.localStorage.setItem(ja,JSON.stringify(e)):k.localStorage.removeItem(ja)}catch(t){ue.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}H.registerComponent("TextTrackSettings",Sv);class Ev extends H{constructor(e,t){let i=t.ResizeObserver||k.ResizeObserver;t.ResizeObserver===null&&(i=!1);const n=xe({createEl:!i,reportTouchActivity:!1},t);super(e,n),this.ResizeObserver=t.ResizeObserver||k.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Kd(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const r=this.debouncedHandler_;let a=this.unloadListener_=function(){et(this,"resize",r),et(this,"unload",a),a=null};vt(this.el_.contentWindow,"unload",a),vt(this.el_.contentWindow,"resize",r)},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()}}H.registerComponent("ResizeManager",Ev);const Cv={trackingThreshold:20,liveTolerance:15};class wv extends H{constructor(e,t){const i=xe(Cv,t,{createEl:!1});super(e,i),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=n=>this.handlePlay(n),this.handleFirstTimeupdate_=n=>this.handleFirstTimeupdate(n),this.handleSeeked_=n=>this.handleSeeked(n),this.seekToLiveEdge_=n=>this.seekToLiveEdge(n),this.reset_(),this.on(this.player_,"durationchange",n=>this.handleDurationchange(n)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(k.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;const n=this.liveCurrentTime(),r=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(n-r)>this.options_.liveTolerance;(!this.timeupdateSeen_||n===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_,kt),this.trackLive_(),this.on(this.player_,["play","pause"],this.trackLiveHandler_),this.timeupdateSeen_?this.on(this.player_,"seeked",this.handleSeeked_):(this.one(this.player_,"play",this.handlePlay_),this.one(this.player_,"timeupdate",this.handleFirstTimeupdate_)))}handleFirstTimeupdate(){this.timeupdateSeen_=!0,this.on(this.player_,"seeked",this.handleSeeked_)}handleSeeked(){const e=Math.abs(this.liveCurrentTime()-this.player_.currentTime());this.seekedBehindLive_=this.nextSeekedFromUser_&&e>2,this.nextSeekedFromUser_=!1,this.trackLive_()}handlePlay(){this.one(this.player_,"timeupdate",this.seekToLiveEdge_)}reset_(){this.lastTime_=-1,this.pastSeekEnd_=0,this.lastSeekEnd_=-1,this.behindLiveEdge_=!0,this.timeupdateSeen_=!1,this.seekedBehindLive_=!1,this.nextSeekedFromUser_=!1,this.clearInterval(this.trackingInterval_),this.trackingInterval_=null,this.off(this.player_,["play","pause"],this.trackLiveHandler_),this.off(this.player_,"seeked",this.handleSeeked_),this.off(this.player_,"play",this.handlePlay_),this.off(this.player_,"timeupdate",this.handleFirstTimeupdate_),this.off(this.player_,"timeupdate",this.seekToLiveEdge_)}nextSeekedFromUser(){this.nextSeekedFromUser_=!0}stopTracking(){this.isTracking()&&(this.reset_(),this.trigger("liveedgechange"))}seekableEnd(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.end(i));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let i=e?e.length:0;for(;i--;)t.push(e.start(i));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}H.registerComponent("LiveTracker",wv);class Iv extends H{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:se("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${At()}`}),description:se("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${At()}`})},se("div",{className:"vjs-title-bar"},{},wd(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(n=>{const r=this.state[n],a=this.els[n],l=i[n];Yr(a),r&&Ci(a,r),t&&(t.removeAttribute(l),r&&t.setAttribute(l,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}}H.registerComponent("TitleBar",Iv);const Av={initialDisplay:4e3,position:[],takeFocus:!1};class kv extends tt{constructor(e,t){t=xe(Av,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],i=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=se("button",{},{type:"button",class:this.buildCSSClass()},se("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()}}H.registerComponent("TransientButton",kv);const oo=s=>{const e=s.el();if(e.hasAttribute("src"))return s.triggerSourceset(e.src),!0;const t=s.$$("source"),i=[];let n="";if(!t.length)return!1;for(let r=0;r<t.length;r++){const a=t[r].src;a&&i.indexOf(a)===-1&&i.push(a)}return i.length?(i.length===1&&(n=i[0]),s.triggerSourceset(n),!0):!1},Pv=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(s){const e=K.createElement(this.nodeName.toLowerCase());e.innerHTML=s;const t=K.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",k.Element.prototype.appendChild.call(this,t),this.innerHTML}}),Nh=(s,e)=>{let t={};for(let i=0;i<s.length&&(t=Object.getOwnPropertyDescriptor(s[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},Dv=s=>Nh([s.el(),k.HTMLMediaElement.prototype,k.Element.prototype,Pv],"innerHTML"),nc=function(s){const e=s.el();if(e.resetSourceWatch_)return;const t={},i=Dv(s),n=r=>(...a)=>{const l=r.apply(e,a);return oo(s),l};["append","appendChild","insertAdjacentHTML"].forEach(r=>{e[r]&&(t[r]=e[r],e[r]=n(t[r]))}),Object.defineProperty(e,"innerHTML",xe(i,{set:n(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(r=>{e[r]=t[r]}),Object.defineProperty(e,"innerHTML",i)},s.one("sourceset",e.resetSourceWatch_)},Lv=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?nh(k.Element.prototype.getAttribute.call(this,"src")):""},set(s){return k.Element.prototype.setAttribute.call(this,"src",s),s}}),Ov=s=>Nh([s.el(),k.HTMLMediaElement.prototype,Lv],"src"),Rv=function(s){if(!s.featuresSourceset)return;const e=s.el();if(e.resetSourceset_)return;const t=Ov(s),i=e.setAttribute,n=e.load;Object.defineProperty(e,"src",xe(t,{set:r=>{const a=t.set.call(e,r);return s.triggerSourceset(e.src),a}})),e.setAttribute=(r,a)=>{const l=i.call(e,r,a);return/src/i.test(r)&&s.triggerSourceset(e.src),l},e.load=()=>{const r=n.call(e);return oo(s)||(s.triggerSourceset(""),nc(s)),r},e.currentSrc?s.triggerSourceset(e.currentSrc):oo(s)||nc(s),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=n,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class J extends oe{constructor(e,t){super(e,t);const i=e.source;let n=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const r=this.el_.childNodes;let a=r.length;const l=[];for(;a--;){const h=r[a];h.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(h),this.remoteTextTracks().addTrack(h.track),this.textTracks().addTrack(h.track),!n&&!this.el_.hasAttribute("crossorigin")&&ea(h.src)&&(n=!0)):l.push(h))}for(let h=0;h<l.length;h++)this.el_.removeChild(l[h])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&n&&ue.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
167
|
-
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(_n||zr)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),J.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){Rv(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let r=0;r<e.length;r++){const a=e[r];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const n=()=>{for(let r=0;r<t.length;r++){const a=t[r];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",n)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",i),e.removeEventListener("change",n),e.addEventListener("change",n)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",n)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(n=>{this.el()[`${i}Tracks`].removeEventListener(n,this[`${i}TracksListeners_`][n])}),this[`featuresNative${e}Tracks`]=!t,this[`${i}TracksListeners_`]=null,this.proxyNativeTracksForType_(i)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=It[e],i=this.el()[t.getterName],n=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const r={change:l=>{const h={type:"change",target:n,currentTarget:n,srcElement:n};n.trigger(h),e==="text"&&this[xs.remoteText.getterName]().trigger(h)},addtrack(l){n.addTrack(l.track)},removetrack(l){n.removeTrack(l.track)}},a=function(){const l=[];for(let h=0;h<n.length;h++){let f=!1;for(let m=0;m<i.length;m++)if(i[m]===n[h]){f=!0;break}f||l.push(n[h])}for(;l.length;)n.removeTrack(l.shift())};this[t.getterName+"Listeners_"]=r,Object.keys(r).forEach(l=>{const h=r[l];i.addEventListener(l,h),this.on("dispose",f=>i.removeEventListener(l,h))}),this.on("loadstart",a),this.on("dispose",l=>this.off("loadstart",a))}proxyNativeTracks_(){It.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const i=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(i,e),J.disposeMediaElement(e),e=i}else{e=K.createElement("video");const i=this.options_.tag&&bi(this.options_.tag),n=xe({},i);(!_n||this.options_.nativeControlsForTouch!==!0)&&delete n.controls,Md(e,Object.assign(n,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&_s(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let i=0;i<t.length;i++){const n=t[i],r=this.options_[n];typeof r<"u"&&(r?_s(e,n,n):Kr(e,n),e[n]=r)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const n=function(){i=!0};this.on("loadstart",n);const r=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",r),this.ready(function(){this.off("loadstart",n),this.off("loadedmetadata",r),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&Wr?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){ue(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&Ut&&ei&&this.el_.currentTime===0){const e=()=>{this.el_.currentTime>0&&(this.el_.duration===1/0&&this.trigger("durationchange"),this.off("timeupdate",e))};return this.on("timeupdate",e),NaN}return this.el_.duration||NaN}width(){return this.el_.offsetWidth}height(){return this.el_.offsetHeight}proxyWebkitFullscreen_(){if(!("webkitDisplayingFullscreen"in this.el_))return;const e=function(){this.trigger("fullscreenchange",{isFullscreen:!1}),this.el_.controls&&!this.options_.nativeControlsForTouch&&this.controls()&&(this.el_.controls=!1)},t=function(){"webkitPresentationMode"in this.el_&&this.el_.webkitPresentationMode!=="picture-in-picture"&&(this.one("webkitendfullscreen",e),this.trigger("fullscreenchange",{isFullscreen:!0,nativeIOSFullscreen:!0}))};this.on("webkitbeginfullscreen",t),this.on("dispose",()=>{this.off("webkitbeginfullscreen",t),this.off("webkitendfullscreen",e)})}supportsFullScreen(){return typeof this.el_.webkitEnterFullScreen=="function"}enterFullScreen(){const e=this.el_;if(e.paused&&e.networkState<=e.HAVE_METADATA)Kt(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return ue.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const n=se("source",{},i);return this.el_.appendChild(n),!0}removeSourceElement(e){if(!e)return ue.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return ue.warn(`No matching source element found with src: ${e}`),!1}reset(){J.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,i){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,i):super.addTextTrack(e,t,i)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=K.createElement("track");return e.kind&&(t.kind=e.kind),e.label&&(t.label=e.label),(e.language||e.srclang)&&(t.srclang=e.language||e.srclang),e.default&&(t.default=e.default),e.id&&(t.id=e.id),e.src&&(t.src=e.src),t}addRemoteTextTrack(e,t){const i=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(i),i}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let i=t.length;for(;i--;)(e===t[i]||e===t[i].track)&&this.el().removeChild(t[i])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),k.performance&&(e.creationTime=k.performance.now()),e}}Vr(J,"TEST_VID",function(){if(!Es())return;const s=K.createElement("video"),e=K.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",s.appendChild(e),s});J.isSupported=function(){try{J.TEST_VID.volume=.5}catch{return!1}return!!(J.TEST_VID&&J.TEST_VID.canPlayType)};J.canPlayType=function(s){return J.TEST_VID.canPlayType(s)};J.canPlaySource=function(s,e){return J.canPlayType(s.type)};J.canControlVolume=function(){try{const s=J.TEST_VID.volume;J.TEST_VID.volume=s/2+.1;const e=s!==J.TEST_VID.volume;return e&&Ze?(k.setTimeout(()=>{J&&J.prototype&&(J.prototype.featuresVolumeControl=s!==J.TEST_VID.volume)}),!1):e}catch{return!1}};J.canMuteVolume=function(){try{const s=J.TEST_VID.muted;return J.TEST_VID.muted=!s,J.TEST_VID.muted?_s(J.TEST_VID,"muted","muted"):Kr(J.TEST_VID,"muted","muted"),s!==J.TEST_VID.muted}catch{return!1}};J.canControlPlaybackRate=function(){if(Ut&&ei&&Hr<58)return!1;try{const s=J.TEST_VID.playbackRate;return J.TEST_VID.playbackRate=s/2+.1,s!==J.TEST_VID.playbackRate}catch{return!1}};J.canOverrideAttributes=function(){try{const s=()=>{};Object.defineProperty(K.createElement("video"),"src",{get:s,set:s}),Object.defineProperty(K.createElement("audio"),"src",{get:s,set:s}),Object.defineProperty(K.createElement("video"),"innerHTML",{get:s,set:s}),Object.defineProperty(K.createElement("audio"),"innerHTML",{get:s,set:s})}catch{return!1}return!0};J.supportsNativeTextTracks=function(){return Wr||Ze&&ei};J.supportsNativeVideoTracks=function(){return!!(J.TEST_VID&&J.TEST_VID.videoTracks)};J.supportsNativeAudioTracks=function(){return!!(J.TEST_VID&&J.TEST_VID.audioTracks)};J.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]){Vr(J.prototype,s,()=>J[e](),!0)});J.prototype.featuresVolumeControl=J.canControlVolume();J.prototype.movingMediaElementInDOM=!Ze;J.prototype.featuresFullscreenResize=!0;J.prototype.featuresProgressEvents=!0;J.prototype.featuresTimeupdateEvents=!0;J.prototype.featuresVideoFrameCallback=!!(J.TEST_VID&&J.TEST_VID.requestVideoFrameCallback);J.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{}}()}};J.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){J.prototype[s]=function(){return this.el_[s]||this.el_.hasAttribute(s)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(s){J.prototype["set"+Be(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){J.prototype[s]=function(){return this.el_[s]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(s){J.prototype["set"+Be(s)]=function(e){this.el_[s]=e}});["pause","load","play"].forEach(function(s){J.prototype[s]=function(){return this.el_[s]()}});oe.withSourceHandlers(J);J.nativeSourceHandler={};J.nativeSourceHandler.canPlayType=function(s){try{return J.TEST_VID.canPlayType(s)}catch{return""}};J.nativeSourceHandler.canHandleSource=function(s,e){if(s.type)return J.nativeSourceHandler.canPlayType(s.type);if(s.src){const t=Go(s.src);return J.nativeSourceHandler.canPlayType(`video/${t}`)}return""};J.nativeSourceHandler.handleSource=function(s,e,t){e.setSrc(s.src)};J.nativeSourceHandler.dispose=function(){};J.registerSourceHandler(J.nativeSourceHandler);oe.registerTech("Html5",J);const Uh=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],qa={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},lo=["tiny","xsmall","small","medium","large","xlarge","huge"],or={};lo.forEach(s=>{const e=s.charAt(0)==="x"?`x-${s.substring(1)}`:s;or[s]=`vjs-layout-${e}`});const Mv={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class ke extends H{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${At()}`,t=Object.assign(ke.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,i),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Sd(this.id_),this.fsApi_=hr,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&&bi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(l){a[l.toLowerCase()]=t.languages[l]}),this.languages_=a}else this.languages_=ke.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(),Ho(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(vt(K,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const n=xe(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=n,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const l=new k.DOMParser().parseFromString(nv,"image/svg+xml");if(l.querySelector("parsererror"))ue.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const f=l.documentElement;f.style.display="none",this.el_.appendChild(f),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new rv(this),this.addClass("vjs-spatial-navigation-enabled")),_n&&this.addClass("vjs-touch-enabled"),Ze||this.addClass("vjs-workinghover"),ke.players[this.id_]=this;const r=Ja.split(".")[0];this.addClass(`vjs-v${r}`),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"),et(K,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),et(K,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),ke.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),ev(this),rt.names.forEach(e=>{const t=rt[e],i=this[t.getterName]();i&&i.off&&i.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,i=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const n=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:n||(t=this.el_=super.createEl("div"));const r=bi(e);if(n){for(t=this.el_=e,e=this.tag=K.createElement("video");t.children.length;)e.appendChild(t.firstChild);hn(t,"video-js")||Fi(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(h=>{try{e[h]=t[h]}catch{}})}e.setAttribute("tabindex","-1"),r.tabindex="-1",ei&&qr&&(e.setAttribute("role","application"),r.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in r&&delete r.width,"height"in r&&delete r.height,Object.getOwnPropertyNames(r).forEach(function(h){n&&h==="class"||t.setAttribute(h,r[h]),n&&e.setAttribute(h,r[h])}),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(h=>Dd[h]).map(h=>"vjs-device-"+h.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),k.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Wd("vjs-styles-dimensions");const h=Ei(".vjs-styles-defaults"),f=Ei("head");f.insertBefore(this.styleEl_,h?h.nextSibling:f.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const l=e.getElementsByTagName("a");for(let h=0;h<l.length;h++){const f=l.item(h);Fi(f,"vjs-hidden"),f.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),eo(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"){ue.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const n=parseFloat(t);if(isNaN(n)){ue.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=n,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,ai(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),PT(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(k.VIDEOJS_NO_DYNAMIC_STYLE===!0){const l=typeof this.width_=="number"?this.width_:this.options_.width,h=typeof this.height_=="number"?this.height_:this.options_.height,f=this.tech_&&this.tech_.el();f&&(l>=0&&(f.width=l),h>=0&&(f.height=h));return}let e,t,i,n;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const r=i.split(":"),a=r[1]/r[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())?n="dimensions-"+this.id():n=this.id()+"-dimensions",this.addClass(n),Gd(this.styleEl_,`
|
|
168
|
-
.${
|
|
170
|
+
</svg>`;const kd=la?10009:ua?461:8,Sr={codes:{play:415,pause:19,ff:417,rw:412,back:kd},names:{415:"play",19:"pause",417:"ff",412:"rw",[kd]:"back"},isEventKey(i,e){return e=e.toLowerCase(),!!(this.names[i.keyCode]&&this.names[i.keyCode]===e)},getEventName(i){if(this.names[i.keyCode])return this.names[i.keyCode];if(this.codes[i.code]){const e=this.codes[i.code];return this.names[e]}return null}},Pd=5;class _1 extends kt{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 r=t.key.substring(5).toLowerCase();this.move(r)}else if(Sr.isEventKey(t,"play")||Sr.isEventKey(t,"pause")||Sr.isEventKey(t,"ff")||Sr.isEventKey(t,"rw")){t.preventDefault();const r=Sr.getEventName(t);this.performMediaAction_(r)}else Sr.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()+Pd);break;case"rw":this.userSeek_(this.player_.currentTime()-Pd);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 r=null;const s=this.getCurrentComponent(e.target);t&&(r=!!t.closest(".video-js"),t.classList.contains("vjs-text-track-settings")&&!this.isPaused_&&this.searchForTrackSelect_()),(!e.currentTarget.contains(e.relatedTarget)&&!r||!t)&&(s&&s.name()==="CloseButton"?this.refocusComponent():(this.pause(),s&&s.el()&&(this.lastFocusedComponent_=s)))}handlePlayerFocus_(){this.getCurrentComponent()&&this.getCurrentComponent().getIsFocusable()&&this.resume()}updateFocusableComponents(){const e=this.player_,t=[];function r(s){for(const n of s)n.hasOwnProperty("el_")&&n.getIsFocusable()&&n.getIsAvailableToBeFocused(n.el())&&t.push(n),n.hasOwnProperty("children_")&&n.children_.length>0&&r(n.children_)}return e.children_.forEach(s=>{if(s.hasOwnProperty("el_"))if(s.getIsFocusable&&s.getIsAvailableToBeFocused&&s.getIsFocusable()&&s.getIsAvailableToBeFocused(s.el())){t.push(s);return}else s.hasOwnProperty("children_")&&s.children_.length>0?r(s.children_):s.hasOwnProperty("items")&&s.items.length>0?r(s.items):this.findSuitableDOMChild(s)&&t.push(s);if(s.name_==="ErrorDisplay"&&s.opened_){const n=s.el_.querySelector(".vjs-errors-ok-button-container");n&&n.querySelectorAll("button").forEach((l,u)=>{t.push({name:()=>"ModalButton"+(u+1),el:()=>l,getPositions:()=>{const f=l.getBoundingClientRect(),p={x:f.x,y:f.y,width:f.width,height:f.height,top:f.top,right:f.right,bottom:f.bottom,left:f.left},T={x:f.left+f.width/2,y:f.top+f.height/2,width:0,height:0,top:f.top+f.height/2,right:f.left+f.width/2,bottom:f.top+f.height/2,left:f.left+f.width/2};return{boundingClientRect:p,center:T}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:f=>!0,focus:()=>l.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(r){if(e.getIsFocusable(r)&&e.getIsAvailableToBeFocused(r))return r;for(let s=0;s<r.children.length;s++){const n=r.children[s],a=t(n);if(a)return a}return null}return e.el()?t(e.el()):null}getCurrentComponent(e){this.updateFocusableComponents();const t=e||document.activeElement;if(this.focusableComponents.length){for(const r of this.focusableComponents)if(r.el()===t)return r}}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 r=t.getPositions(),s=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(r.boundingClientRect,a.getPositions().boundingClientRect,e)),n=this.findBestCandidate_(r.center,s,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,r){let s=1/0,n=null;for(const a of t){const l=a.getPositions().center,u=this.calculateDistance_(e,l,r);u<s&&(s=u,n=a)}return n}isInDirection_(e,t,r){switch(r){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,r){const s=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);let a;switch(r){case"right":case"left":a=s+n*100;break;case"up":a=n*2+s*.5;break;case"down":a=n*5+s;break;default:a=s+n}return a}searchForTrackSelect_(){const e=this;for(const t of e.updateFocusableComponents())if(t.constructor.name==="TextTrackSelect"){e.focus(t);break}}}class T1 extends H{constructor(e,t,r){const s=Ae({createEl:!1},t);if(super(e,s,r),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const l=He(a[n]);let u=ue.getTech(l);if(l||(u=H.getComponent(l)),u&&u.isSupported()){e.loadTech_(l);break}}else e.src(t.playerOptions.sources)}}H.registerComponent("MediaLoader",T1);class Qa extends H{constructor(e,t){super(e,t),this.options_.controlText&&this.controlText(this.options_.controlText),this.handleMouseOver_=r=>this.handleMouseOver(r),this.handleMouseOut_=r=>this.handleMouseOut(r),this.handleClick_=r=>this.handleClick(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.emitTapEvents(),this.enable()}createEl(e="div",t={},r={}){t=Object.assign({className:this.buildCSSClass(),tabIndex:0},t),e==="button"&&fe.error(`Creating a ClickableComponent with an HTML element of ${e} is not supported; use a Button instead.`),r=Object.assign({role:"button"},r),this.tabIndex_=t.tabIndex;const s=ne(e,t,r);return this.player_.options_.experimentalSvgIcons||s.appendChild(ne("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=ne("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const r=this.localize(e);this.controlText_=e,Hi(this.controlTextEl_,r),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",r)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"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)}}H.registerComponent("ClickableComponent",Qa);class ul extends Qa{constructor(e,t){super(e,t),this.update(),this.update_=r=>this.update(r),e.on("posterchange",this.update_)}dispose(){this.player().off("posterchange",this.update_),super.dispose()}createEl(){return ne("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(ne("picture",{className:"vjs-poster",tabIndex:-1},{},ne("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()?si(this.player_.play()):this.player_.pause())}}ul.prototype.crossorigin=ul.prototype.crossOrigin;H.registerComponent("PosterImage",ul);const Ot="#222",Ld="#ccc",v1={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 Mo(i,e){let t;if(i.length===4)t=i[1]+i[1]+i[2]+i[2]+i[3]+i[3];else if(i.length===7)t=i.slice(1);else throw new Error("Invalid color code provided, "+i+"; must be formatted as e.g. #f0e or #f604e2.");return"rgba("+parseInt(t.slice(0,2),16)+","+parseInt(t.slice(2,4),16)+","+parseInt(t.slice(4,6),16)+","+e+")"}function Zt(i,e,t){try{i.style[e]=t}catch{return}}function Rd(i){return i?`${i}px`:""}class b1 extends H{constructor(e,t,r){super(e,t,r);const s=a=>this.updateDisplay(a),n=a=>{this.updateDisplayOverlay(),this.updateDisplay(a)};e.on("loadstart",a=>this.toggleDisplay(a)),e.on("texttrackchange",s),e.on("loadedmetadata",a=>{this.updateDisplayOverlay(),this.preselectTrack(a)}),e.ready(Pe(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",n),e.on("playerresize",n);const a=k.screen.orientation||k,l=k.screen.orientation?"change":"orientationchange";a.addEventListener(l,n),e.on("dispose",()=>a.removeEventListener(l,n));const u=this.options_.playerOptions.tracks||[];for(let f=0;f<u.length;f++)this.player_.addRemoteTextTrack(u[f],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),r=this.player_.cache_.selectedLanguage;let s,n,a;for(let l=0;l<t.length;l++){const u=t[l];r&&r.enabled&&r.language&&r.language===u.language&&u.kind in e?u.kind===r.kind?a=u:a||(a=u):r&&!r.enabled?(a=null,s=null,n=null):u.default&&(u.kind==="descriptions"&&!s?s=u:u.kind in e&&!n&&(n=u))}a?a.mode="showing":n?n.mode="showing":s&&(s.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 k.WebVTT=="function"&&k.WebVTT.processCues(k,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let l=0;l<e.length;++l){const u=e[l];u.mode==="showing"&&a.push(u)}this.updateForTrack(a);return}let r=null,s=null,n=e.length;for(;n--;){const a=e[n];a.mode==="showing"&&(a.kind==="descriptions"?r=a:s=a)}if(s?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):r&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(r)),!k.CSS.supports("inset","10px")){const a=this.el_,l=a.querySelectorAll(".vjs-text-track-cue"),u=this.player_.controlBar.el_.getBoundingClientRect().height,f=this.player_.el_.getBoundingClientRect().height;a.style="",Zt(a,"position","relative"),Zt(a,"height",f-u+"px"),Zt(a,"top","unset"),ca?Zt(a,"bottom",f+"px"):Zt(a,"bottom","0px"),l.length>0&&l.forEach(p=>{if(p.style.inset){const T=p.style.inset.split(" ");T.length===3&&Object.assign(p.style,{top:T[0],right:T[1],bottom:T[2],left:"unset"})}})}}updateDisplayOverlay(){if(!this.player_.videoHeight()||!k.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),r=e/t,s=this.player_.videoWidth()/this.player_.videoHeight();let n=0,a=0;Math.abs(r-s)>.1&&(r>s?n=Math.round((e-t*s)/2):a=Math.round((t-e/s)/2)),Zt(this.el_,"insetInline",Rd(n)),Zt(this.el_,"insetBlock",Rd(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),r=e.activeCues;let s=r.length;for(;s--;){const n=r[s];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&Zt(a.firstChild,"color",Mo(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&Zt(a.firstChild,"backgroundColor",Mo(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?Zt(a,"backgroundColor",Mo(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 ${Ld}, 0 1px ${Ld}, -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 l=k.parseFloat(a.style.fontSize);a.style.fontSize=l*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=v1[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof k.WebVTT!="function"||e.every(r=>!r.activeCues))return;const t=[];for(let r=0;r<e.length;++r){const s=e[r];for(let n=0;n<s.activeCues.length;++n)t.push(s.activeCues[n])}k.WebVTT.processCues(k,t,this.el_);for(let r=0;r<e.length;++r){const s=e[r];for(let n=0;n<s.activeCues.length;++n){const a=s.activeCues[n].displayState;sr(a,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:r)),s.language&&Wr(a,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}}H.registerComponent("TextTrackDisplay",b1);class x1 extends H{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),r=ne("span",{className:"vjs-control-text",textContent:this.localize("{1} is loading.",[t])}),s=super.createEl("div",{className:"vjs-loading-spinner",dir:"ltr"});return s.appendChild(r),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}H.registerComponent("LoadingSpinner",x1);class at extends Qa{createEl(e,t={},r={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),r=Object.assign({type:"button"},r);const s=ne(e,t,r);return this.player_.options_.experimentalSvgIcons||s.appendChild(ne("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}addChild(e,t={}){const r=this.constructor.name;return fe.warn(`Adding an actionable (user controllable) child to a Button (${r}) is not supported; use a ClickableComponent instead.`),H.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)}}H.registerComponent("Button",at);class Lp extends at{constructor(e,t){super(e,t),this.mouseused_=!1,this.setIcon("play"),this.on("mousedown",r=>this.handleMouseDown(r))}buildCSSClass(){return"vjs-big-play-button"}handleClick(e){const t=this.player_.play();if(this.mouseused_&&"clientX"in e&&"clientY"in e){si(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const r=this.player_.getChild("controlBar"),s=r&&r.getChild("playToggle");if(!s){this.player_.tech(!0).focus();return}const n=()=>s.focus();Hs(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}Lp.prototype.controlText_="Play Video";H.registerComponent("BigPlayButton",Lp);class S1 extends at{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)}}H.registerComponent("CloseButton",S1);class Rp extends at{constructor(e,t={}){super(e,t),t.replay=t.replay===void 0||t.replay,this.setIcon("play"),this.on(e,"play",r=>this.handlePlay(r)),this.on(e,"pause",r=>this.handlePause(r)),t.replay&&this.on(e,"ended",r=>this.handleEnded(r))}buildCSSClass(){return`vjs-play-control ${super.buildCSSClass()}`}handleClick(e){this.player_.paused()?si(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))}}Rp.prototype.controlText_="Play";H.registerComponent("PlayToggle",Rp);class is extends H{constructor(e,t){super(e,t),this.on(e,["timeupdate","ended","seeking"],r=>this.update(r)),this.updateTextNode_()}createEl(){const e=this.buildCSSClass(),t=super.createEl("div",{className:`${e} vjs-time-control vjs-control`}),r=ne("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(r),this.contentEl_=ne("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=ur(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){}}is.prototype.labelText_="Time";is.prototype.controlText_="Time";H.registerComponent("TimeDisplay",is);class uu extends is{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)}}uu.prototype.labelText_="Current Time";uu.prototype.controlText_="Current Time";H.registerComponent("CurrentTimeDisplay",uu);class cu extends is{constructor(e,t){super(e,t);const r=s=>this.updateContent(s);this.on(e,"durationchange",r),this.on(e,"loadstart",r),this.on(e,"loadedmetadata",r)}buildCSSClass(){return"vjs-duration"}updateContent(e){const t=this.player_.duration();this.updateTextNode_(t)}}cu.prototype.labelText_="Duration";cu.prototype.controlText_="Duration";H.registerComponent("DurationDisplay",cu);class E1 extends H{createEl(){const e=super.createEl("div",{className:"vjs-time-control vjs-time-divider"},{"aria-hidden":!0}),t=super.createEl("div"),r=super.createEl("span",{textContent:"/"});return t.appendChild(r),e.appendChild(t),e}}H.registerComponent("TimeDivider",E1);class du extends is{constructor(e,t){super(e,t),this.on(e,"durationchange",r=>this.updateContent(r))}buildCSSClass(){return"vjs-remaining-time"}createEl(){const e=super.createEl();return this.options_.displayNegative!==!1&&e.insertBefore(ne("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)}}du.prototype.labelText_="Remaining Time";du.prototype.controlText_="Remaining Time";H.registerComponent("RemainingTimeDisplay",du);class C1 extends H{constructor(e,t){super(e,t),this.updateShowing(),this.on(this.player(),"durationchange",r=>this.updateShowing(r))}createEl(){const e=super.createEl("div",{className:"vjs-live-control vjs-control"});return this.contentEl_=ne("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(ne("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()}}H.registerComponent("LiveDisplay",C1);class Op extends at{constructor(e,t){super(e,t),this.updateLiveEdgeStatus(),this.player_.liveTracker&&(this.updateLiveEdgeStatusHandler_=r=>this.updateLiveEdgeStatus(r),this.on(this.player_.liveTracker,"liveedgechange",this.updateLiveEdgeStatusHandler_))}createEl(){const e=super.createEl("button",{className:"vjs-seek-to-live-control vjs-control"});return this.setIcon("circle",e),this.textEl_=ne("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()}}Op.prototype.controlText_="Seek to live, currently playing live";H.registerComponent("SeekToLive",Op);function un(i,e,t){return i=Number(i),Math.min(t,Math.max(e,isNaN(i)?e:i))}var A1=Object.freeze({__proto__:null,clamp:un});class hu extends H{constructor(e,t){super(e,t),this.handleMouseDown_=r=>this.handleMouseDown(r),this.handleMouseUp_=r=>this.handleMouseUp(r),this.handleKeyDown_=r=>this.handleKeyDown(r),this.handleClick_=r=>this.handleClick(r),this.handleMouseMove_=r=>this.handleMouseMove(r),this.update_=r=>this.update(r),this.bar=this.getChild(this.options_.barName),this.vertical(!!this.options_.vertical),this.enable()}enabled(){return this.enabled_}enable(){this.enabled()||(this.on("mousedown",this.handleMouseDown_),this.on("touchstart",this.handleMouseDown_),this.on("keydown",this.handleKeyDown_),this.on("click",this.handleClick_),this.on(this.player_,"controlsvisible",this.update),this.playerEvent&&this.on(this.player_,this.playerEvent,this.update),this.removeClass("disabled"),this.setAttribute("tabindex",0),this.enabled_=!0)}disable(){if(!this.enabled())return;const e=this.bar.el_.ownerDocument;this.off("mousedown",this.handleMouseDown_),this.off("touchstart",this.handleMouseDown_),this.off("keydown",this.handleKeyDown_),this.off("click",this.handleClick_),this.off(this.player_,"controlsvisible",this.update_),this.off(e,"mousemove",this.handleMouseMove_),this.off(e,"mouseup",this.handleMouseUp_),this.off(e,"touchmove",this.handleMouseMove_),this.off(e,"touchend",this.handleMouseUp_),this.removeAttribute("tabindex"),this.addClass("disabled"),this.playerEvent&&this.off(this.player_,this.playerEvent,this.update),this.enabled_=!1}createEl(e,t={},r={}){return t.className=t.className+" vjs-slider",t=Object.assign({tabIndex:0},t),r=Object.assign({role:"slider","aria-valuenow":0,"aria-valuemin":0,"aria-valuemax":100},r),super.createEl(e,t,r)}handleMouseDown(e){const t=this.bar.el_.ownerDocument;e.type==="mousedown"&&e.preventDefault(),e.type==="touchstart"&&!hi&&e.preventDefault(),op(),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;lp(),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(un(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=za(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,r=t&&t.enabled,s=t&&t.horizontalSeek;r?s&&e.key==="ArrowLeft"||!s&&e.key==="ArrowDown"?(e.preventDefault(),e.stopPropagation(),this.stepBack()):s&&e.key==="ArrowRight"||!s&&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")}}H.registerComponent("Slider",hu);const Uo=(i,e)=>un(i/e*100,0,100).toFixed(2)+"%";class w1 extends H{constructor(e,t){super(e,t),this.partEls_=[],this.on(e,"progress",r=>this.update(r))}createEl(){const e=super.createEl("div",{className:"vjs-load-progress"}),t=ne("span",{className:"vjs-control-text"}),r=ne("span",{textContent:this.localize("Loaded")}),s=X.createTextNode(": ");return this.percentageEl_=ne("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(r),t.appendChild(s),t.appendChild(this.percentageEl_),e}dispose(){this.partEls_=null,this.percentageEl_=null,super.dispose()}update(e){this.requestNamedAnimationFrame("LoadProgressBar#update",()=>{const t=this.player_.liveTracker,r=this.player_.buffered(),s=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,l=Uo(n,s);this.percent_!==l&&(this.el_.style.width=l,Hi(this.percentageEl_,l),this.percent_=l);for(let u=0;u<r.length;u++){const f=r.start(u),p=r.end(u);let T=a[u];T||(T=this.el_.appendChild(ne()),a[u]=T),!(T.dataset.start===f&&T.dataset.end===p)&&(T.dataset.start=f,T.dataset.end=p,T.style.left=Uo(f,n),T.style.width=Uo(p-f,n))}for(let u=a.length;u>r.length;u--)this.el_.removeChild(a[u-1]);a.length=r.length})}}H.registerComponent("LoadProgressBar",w1);class D1 extends H{constructor(e,t){super(e,t),this.update=fi(Pe(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,r){const s=en(this.el_),n=Gr(this.player_.el()),a=e.width*t;if(!n||!s)return;let l=e.left-n.left+a,u=e.width-a+(n.right-e.right);u||(u=e.width-a,l=a);let f=s.width/2;l<f?f+=f-l:u<f&&(f=u),f<0?f=0:f>s.width&&(f=s.width),f=Math.round(f),this.el_.style.right=`-${f}px`,this.write(r)}write(e){Hi(this.el_,e)}updateTime(e,t,r,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const l=this.player_.liveTracker.liveWindow(),u=l-t*l;n=(u<1?"":"-")+ur(u,l)}else n=ur(r,a);this.update(e,t,n),s&&s()})}}H.registerComponent("TimeTooltip",D1);class fu extends H{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=fi(Pe(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-play-progress vjs-slider-bar"},{"aria-hidden":"true"})}update(e,t){const r=this.getChild("timeTooltip");if(!r)return;const s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();r.updateTime(e,t,s)}}fu.prototype.options_={children:[]};!st&&!Gt&&fu.prototype.options_.children.push("timeTooltip");H.registerComponent("PlayProgressBar",fu);class Np extends H{constructor(e,t){super(e,t),this.update=fi(Pe(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t){const r=t*this.player_.duration();this.getChild("timeTooltip").updateTime(e,t,r,()=>{this.el_.style.left=`${e.width*t}px`})}}Np.prototype.options_={children:["timeTooltip"]};H.registerComponent("MouseTimeDisplay",Np);const Hn=5,Od=12;class Ja extends hu{constructor(e,t){t=Ae(Ja.prototype.options_,t),t.children=[...t.children];const r=e.options_.disableSeekWhileScrubbingOnMobile&&(st||Gt);(!st&&!Gt||r)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=r,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Pe(this,this.update),this.update=fi(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 r=this.player_.ended()?this.player_.duration():this.getCurrentTime_(),s=this.player_.liveTracker;let n=this.player_.duration();s&&s.isLive()&&(n=this.player_.liveTracker.liveCurrentTime()),this.percent_!==t&&(this.el_.setAttribute("aria-valuenow",(t*100).toFixed(2)),this.percent_=t),(this.currentTime_!==r||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[ur(r,n),ur(n,n)],"{1} of {2}")),this.currentTime_=r,this.duration_=n),this.bar&&this.bar.update(Gr(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 r=this.player_.liveTracker;return r&&r.isLive()?(t=(e-r.seekableStart())/r.liveWindow(),r.atLiveEdge()&&(t=1)):t=e/this.player_.duration(),t}handleMouseDown(e){tn(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!tn(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let r;const s=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())r=s*this.player_.duration(),r===this.player_.duration()&&(r=r-.1);else{if(s>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),l=n.liveCurrentTime();if(r=a+s*n.liveWindow(),r>=l&&(r=l),r<=a&&(r=a+.1),r===1/0)return}this.shouldDisableSeekWhileScrubbingOnMobile_?this.pendingSeekTime_=r:this.userSeek_(r),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?si(this.player_.play()):this.update_()}stepForward(){this.userSeek_(this.player_.currentTime()+Hn)}stepBack(){this.userSeek_(this.player_.currentTime()-Hn)}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 r=parseInt(e.key,10)*.1;t&&t.isLive()?this.userSeek_(t.seekableStart()+t.liveWindow()*r):this.userSeek_(this.player_.duration()*r)}else e.key==="PageDown"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()-Hn*Od)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+Hn*Od)):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()}}Ja.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};H.registerComponent("SeekBar",Ja);class Bp extends H{constructor(e,t){super(e,t),this.handleMouseMove=fi(Pe(this,this.handleMouseMove),Ft),this.throttledHandleMouseSeek=fi(Pe(this,this.handleMouseSeek),Ft),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.handleMouseDownHandler_=r=>this.handleMouseDown(r),this.enable()}createEl(){return super.createEl("div",{className:"vjs-progress-control vjs-control"})}handleMouseMove(e){const t=this.getChild("seekBar");if(!t)return;const r=t.getChild("playProgressBar"),s=t.getChild("mouseTimeDisplay");if(!r&&!s)return;const n=t.el(),a=en(n);let l=za(n,e).x;l=un(l,0,1),s&&s.update(a,l),r&&r.update(a,t.getProgress())}handleMouseSeek(e){const t=this.getChild("seekBar");t&&t.handleMouseMove(e)}enabled(){return this.enabled_}disable(){if(this.children().forEach(e=>e.disable&&e.disable()),!!this.enabled()&&(this.off(["mousedown","touchstart"],this.handleMouseDownHandler_),this.off(this.el_,["mousemove","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&&si(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,r=this.getChild("seekBar");r&&r.handleMouseDown(e),this.on(t,"mousemove",this.throttledHandleMouseSeek),this.on(t,"touchmove",this.throttledHandleMouseSeek),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.getChild("seekBar");t&&t.handleMouseUp(e),this.removeListenersAddedOnMousedownAndTouchstart()}}Bp.prototype.options_={children:["seekBar"]};H.registerComponent("ProgressControl",Bp);class Mp extends at{constructor(e,t){super(e,t),this.setIcon("picture-in-picture-enter"),this.on(e,["enterpictureinpicture","leavepictureinpicture"],r=>this.handlePictureInPictureChange(r)),this.on(e,["disablepictureinpicturechanged","loadedmetadata"],r=>this.handlePictureInPictureEnabledChange(r)),this.on(e,["loadedmetadata","audioonlymodechange","audiopostermodechange"],()=>this.handlePictureInPictureAudioModeChange()),this.disable()}buildCSSClass(){return`vjs-picture-in-picture-control vjs-hidden ${super.buildCSSClass()}`}handlePictureInPictureAudioModeChange(){if(!(this.player_.currentType().substring(0,5)==="audio"||this.player_.audioPosterMode()||this.player_.audioOnlyMode())){this.show();return}this.player_.isInPictureInPicture()&&this.player_.exitPictureInPicture(),this.hide()}handlePictureInPictureEnabledChange(){X.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in k?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()}}Mp.prototype.controlText_="Picture-in-Picture";H.registerComponent("PictureInPictureToggle",Mp);class Up extends at{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",r=>this.handleFullscreenChange(r)),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()}}Up.prototype.controlText_="Fullscreen";H.registerComponent("FullscreenToggle",Up);const I1=function(i,e){e.tech_&&!e.tech_.featuresVolumeControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class k1 extends H{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}}H.registerComponent("VolumeLevel",k1);class P1 extends H{constructor(e,t){super(e,t),this.update=fi(Pe(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,r,s){if(!r){const n=Gr(this.el_),a=Gr(this.player_.el()),l=e.width*t;if(!a||!n)return;const u=e.left-a.left+l,f=e.width-l+(a.right-e.right);let p=n.width/2;u<p?p+=p-u:f<p&&(p=f),p<0?p=0:p>n.width&&(p=n.width),this.el_.style.right=`-${p}px`}this.write(`${s}%`)}write(e){Hi(this.el_,e)}updateVolume(e,t,r,s,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,r,s.toFixed(0)),n&&n()})}}H.registerComponent("VolumeLevelTooltip",P1);class Fp extends H{constructor(e,t){super(e,t),this.update=fi(Pe(this,this.update),Ft)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,r){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,r,s,()=>{r?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}Fp.prototype.options_={children:["volumeLevelTooltip"]};H.registerComponent("MouseVolumeLevelDisplay",Fp);class Za extends hu{constructor(e,t){super(e,t),this.on("slideractive",r=>this.updateLastVolume_(r)),this.on(e,"volumechange",r=>this.updateARIAAttributes(r)),e.ready(()=>this.updateARIAAttributes())}createEl(){return super.createEl("div",{className:"vjs-volume-bar vjs-slider-bar"},{"aria-label":this.localize("Volume Level"),"aria-live":"polite"})}handleMouseDown(e){tn(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const r=this.el(),s=Gr(r),n=this.vertical();let a=za(r,e);a=n?a.y:a.x,a=un(a,0,1),t.update(s,a,n)}tn(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)})}}Za.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!st&&!Gt&&Za.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");Za.prototype.playerEvent="volumechange";H.registerComponent("VolumeBar",Za);class $p extends H{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||zr(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),I1(this,e),this.throttledHandleMouseMove=fi(Pe(this,this.handleMouseMove),Ft),this.handleMouseUpHandler_=r=>this.handleMouseUp(r),this.on("mousedown",r=>this.handleMouseDown(r)),this.on("touchstart",r=>this.handleMouseDown(r)),this.on("mousemove",r=>this.handleMouseMove(r)),this.on(this.volumeBar,["focus","slideractive"],()=>{this.volumeBar.addClass("vjs-slider-active"),this.addClass("vjs-slider-active"),this.trigger("slideractive")}),this.on(this.volumeBar,["blur","sliderinactive"],()=>{this.volumeBar.removeClass("vjs-slider-active"),this.removeClass("vjs-slider-active"),this.trigger("sliderinactive")})}createEl(){let e="vjs-volume-horizontal";return this.options_.vertical&&(e="vjs-volume-vertical"),super.createEl("div",{className:`vjs-volume-control vjs-control ${e}`})}handleMouseDown(e){const t=this.el_.ownerDocument;this.on(t,"mousemove",this.throttledHandleMouseMove),this.on(t,"touchmove",this.throttledHandleMouseMove),this.on(t,"mouseup",this.handleMouseUpHandler_),this.on(t,"touchend",this.handleMouseUpHandler_)}handleMouseUp(e){const t=this.el_.ownerDocument;this.off(t,"mousemove",this.throttledHandleMouseMove),this.off(t,"touchmove",this.throttledHandleMouseMove),this.off(t,"mouseup",this.handleMouseUpHandler_),this.off(t,"touchend",this.handleMouseUpHandler_)}handleMouseMove(e){this.volumeBar.handleMouseMove(e)}}$p.prototype.options_={children:["volumeBar"]};H.registerComponent("VolumeControl",$p);const L1=function(i,e){e.tech_&&!e.tech_.featuresMuteControl&&i.addClass("vjs-hidden"),i.on(e,"loadstart",function(){e.tech_.featuresMuteControl?i.removeClass("vjs-hidden"):i.addClass("vjs-hidden")})};class jp extends at{constructor(e,t){super(e,t),L1(this,e),this.on(e,["loadstart","volumechange"],r=>this.update(r))}buildCSSClass(){return`vjs-mute-control ${super.buildCSSClass()}`}handleClick(e){const t=this.player_.volume(),r=this.player_.lastVolume_();if(t===0){const s=r<.1?.1:r;this.player_.volume(s),this.player_.muted(!1)}else this.player_.muted(!this.player_.muted())}update(e){this.updateIcon_(),this.updateControlText_()}updateIcon_(){const e=this.player_.volume();let t=3;this.setIcon("volume-high"),st&&this.player_.tech_&&this.player_.tech_.el_&&this.player_.muted(this.player_.tech_.el_.muted),e===0||this.player_.muted()?(this.setIcon("volume-mute"),t=0):e<.33?(this.setIcon("volume-low"),t=1):e<.67&&(this.setIcon("volume-medium"),t=2),qa(this.el_,[0,1,2,3].reduce((r,s)=>r+`${s?" ":""}vjs-vol-${s}`,"")),sr(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}jp.prototype.controlText_="Mute";H.registerComponent("MuteToggle",jp);class Vp extends H{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||zr(t.volumeControl))&&(t.volumeControl=t.volumeControl||{},t.volumeControl.vertical=!t.inline),super(e,t),this.handleKeyPressHandler_=r=>this.handleKeyPress(r),this.on(e,["loadstart"],r=>this.volumePanelState_(r)),this.on(this.muteToggle,"keyup",r=>this.handleKeyPress(r)),this.on(this.volumeControl,"keyup",r=>this.handleVolumeControlKeyUp(r)),this.on("keydown",r=>this.handleKeyPress(r)),this.on("mouseover",r=>this.handleMouseOver(r)),this.on("mouseout",r=>this.handleMouseOut(r)),this.on(this.volumeControl,["slideractive"],this.sliderActive_),this.on(this.volumeControl,["sliderinactive"],this.sliderInactive_)}sliderActive_(){this.addClass("vjs-slider-active")}sliderInactive_(){this.removeClass("vjs-slider-active")}volumePanelState_(){this.volumeControl.hasClass("vjs-hidden")&&this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-hidden"),this.volumeControl.hasClass("vjs-hidden")&&!this.muteToggle.hasClass("vjs-hidden")&&this.addClass("vjs-mute-toggle-only")}createEl(){let e="vjs-volume-panel-horizontal";return this.options_.inline||(e="vjs-volume-panel-vertical"),super.createEl("div",{className:`vjs-volume-panel vjs-control ${e}`})}dispose(){this.handleMouseOut(),super.dispose()}handleVolumeControlKeyUp(e){e.key==="Escape"&&this.muteToggle.focus()}handleMouseOver(e){this.addClass("vjs-hover"),It(X,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),nt(X,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}Vp.prototype.options_={children:["muteToggle","volumeControl"]};H.registerComponent("VolumePanel",Vp);class qp extends at{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(),r=this.player_.liveTracker,s=r&&r.isLive()?r.seekableEnd():this.player_.duration();let n;t+this.skipTime<=s?n=t+this.skipTime:n=s,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip forward {1} seconds",[this.skipTime]))}}qp.prototype.controlText_="Skip Forward";H.registerComponent("SkipForward",qp);class Hp extends at{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(),r=this.player_.liveTracker,s=r&&r.isLive()&&r.seekableStart();let n;s&&t-this.skipTime<=s?n=s:t>=this.skipTime?n=t-this.skipTime:n=0,this.player_.currentTime(n)}handleLanguagechange(){this.controlText(this.localize("Skip backward {1} seconds",[this.skipTime]))}}Hp.prototype.controlText_="Skip Backward";H.registerComponent("SkipBackward",Hp);class zp extends H{constructor(e,t){super(e,t),t&&(this.menuButton_=t.menuButton),this.focusedChild_=-1,this.on("keydown",r=>this.handleKeyDown(r)),this.boundHandleBlur_=r=>this.handleBlur(r),this.boundHandleTapClick_=r=>this.handleTapClick(r)}addEventListenerForItem(e){e instanceof H&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof H&&(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_=ne(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_),It(t,"click",function(r){r.preventDefault(),r.stopImmediatePropagation()}),t}dispose(){this.contentEl_=null,this.boundHandleBlur_=null,this.boundHandleTapClick_=null,super.dispose()}handleBlur(e){const t=e.relatedTarget||X.activeElement;if(!this.children().some(r=>r.el()===t)){const r=this.menuButton_;r&&r.buttonPressed_&&t!==r.el().firstChild&&r.unpressButton()}}handleTapClick(e){if(this.menuButton_){this.menuButton_.unpressButton();const t=this.children();if(!Array.isArray(t))return;const r=t.filter(s=>s.el()===e.target)[0];if(!r)return;r.name()!=="CaptionSettingsMenuItem"&&this.menuButton_.focus()}}handleKeyDown(e){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())}}H.registerComponent("Menu",zp);class pu extends H{constructor(e,t={}){super(e,t),this.menuButton_=new at(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const r=at.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+r,this.menuButton_.removeClass("vjs-control"),this.addChild(this.menuButton_),this.update(),this.enabled_=!0;const s=n=>this.handleClick(n);this.handleMenuKeyUp_=n=>this.handleMenuKeyUp(n),this.on(this.menuButton_,"tap",s),this.on(this.menuButton_,"click",s),this.on(this.menuButton_,"keydown",n=>this.handleKeyDown(n)),this.on(this.menuButton_,"mouseenter",()=>{this.addClass("vjs-hover"),this.menu.show(),It(X,"keyup",this.handleMenuKeyUp_)}),this.on("mouseleave",n=>this.handleMouseLeave(n)),this.on("keydown",n=>this.handleSubmenuKeyDown(n))}update(){const e=this.createMenu();this.menu&&(this.menu.dispose(),this.removeChild(this.menu)),this.menu=e,this.addChild(e),this.buttonPressed_=!1,this.menuButton_.el_.setAttribute("aria-expanded","false"),this.items&&this.items.length<=this.hideThreshold_?(this.hide(),this.menu.contentEl_.removeAttribute("role")):(this.show(),this.menu.contentEl_.setAttribute("role","menu"))}createMenu(){const e=new zp(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=ne("li",{className:"vjs-menu-title",textContent:He(this.options_.title),tabIndex:-1}),r=new H(this.player_,{el:t});e.addItem(r)}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=at.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"),nt(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"),st&&ip())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()}}H.registerComponent("MenuButton",pu);class mu extends pu{constructor(e,t){const r=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!r)return;const s=Pe(this,this.update);r.addEventListener("removetrack",s),r.addEventListener("addtrack",s),r.addEventListener("labelchange",s),this.player_.on("ready",s),this.player_.on("dispose",function(){r.removeEventListener("removetrack",s),r.removeEventListener("addtrack",s),r.removeEventListener("labelchange",s)})}}H.registerComponent("TrackButton",mu);class cn extends Qa{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,r){this.nonIconControl=!0;const s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),r),n=ne("span",{className:"vjs-menu-item-text",textContent:this.localize(this.options_.label)});return this.player_.options_.experimentalSvgIcons?s.appendChild(n):s.replaceChild(n,s.querySelector(".vjs-icon-placeholder")),s}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))}}H.registerComponent("MenuItem",cn);class dn extends cn{constructor(e,t){const r=t.track,s=e.textTracks();t.label=r.label||r.language||"Unknown",t.selected=r.mode==="showing",super(e,t),this.track=r,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const n=(...l)=>{this.handleTracksChange.apply(this,l)},a=(...l)=>{this.handleSelectedLanguageChange.apply(this,l)};if(e.on(["loadstart","texttrackchange"],n),s.addEventListener("change",n),s.addEventListener("selectedlanguagechange",a),this.on("dispose",function(){e.off(["loadstart","texttrackchange"],n),s.removeEventListener("change",n),s.removeEventListener("selectedlanguagechange",a)}),s.onchange===void 0){let l;this.on(["tap","click"],function(){if(typeof k.Event!="object")try{l=new k.Event("change")}catch{}l||(l=X.createEvent("Event"),l.initEvent("change",!0,!0)),s.dispatchEvent(l)})}this.handleTracksChange()}handleClick(e){const t=this.track,r=this.player_.textTracks();if(super.handleClick(e),!!r)for(let s=0;s<r.length;s++){const n=r[s];this.kinds.indexOf(n.kind)!==-1&&(n===t?n.mode!=="showing"&&(n.mode="showing"):n.mode!=="disabled"&&(n.mode="disabled"))}}handleTracksChange(e){const t=this.track.mode==="showing";t!==this.isSelected_&&this.selected(t)}handleSelectedLanguageChange(e){if(this.track.mode==="showing"){const t=this.player_.cache_.selectedLanguage;if(t&&t.enabled&&t.language===this.track.language&&t.kind!==this.track.kind)return;this.player_.cache_.selectedLanguage={enabled:!0,language:this.track.language,kind:this.track.kind}}}dispose(){this.track=null,super.dispose()}}H.registerComponent("TextTrackMenuItem",dn);class Wp extends dn{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 r=!0;for(let s=0,n=t.length;s<n;s++){const a=t[s];if(this.options_.kinds.indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r!==this.isSelected_&&this.selected(r)}handleSelectedLanguageChange(e){const t=this.player().textTracks();let r=!0;for(let s=0,n=t.length;s<n;s++){const a=t[s];if(["captions","descriptions","subtitles"].indexOf(a.kind)>-1&&a.mode==="showing"){r=!1;break}}r&&(this.player_.cache_.selectedLanguage={enabled:!1})}handleLanguagechange(){this.$(".vjs-menu-item-text").textContent=this.player_.localize(this.options_.label),super.handleLanguagechange()}}H.registerComponent("OffTextTrackMenuItem",Wp);class rs extends mu{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=dn){let r;this.label_&&(r=`${this.label_} off`),e.push(new Wp(this.player_,{kinds:this.kinds_,kind:this.kind_,label:r})),this.hideThreshold_+=1;const s=this.player_.textTracks();Array.isArray(this.kinds_)||(this.kinds_=[this.kind_]);for(let n=0;n<s.length;n++){const a=s[n];if(this.kinds_.indexOf(a.kind)>-1){const l=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});l.addClass(`vjs-${a.kind}-menu-item`),e.push(l)}}return e}}H.registerComponent("TextTrackButton",rs);class Gp extends cn{constructor(e,t){const r=t.track,s=t.cue,n=e.currentTime();t.selectable=!0,t.multiSelectable=!1,t.label=s.text,t.selected=s.startTime<=n&&n<s.endTime,super(e,t),this.track=r,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}H.registerComponent("ChaptersTrackMenuItem",Gp);class gu extends rs{constructor(e,t,r){super(e,t,r),this.setIcon("chapters"),this.selectCurrentItem_=()=>{this.items.forEach(s=>{s.selected(this.track_.activeCues[0]===s.cue)})}}buildCSSClass(){return`vjs-chapters-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-chapters-button ${super.buildWrapperCSSClass()}`}update(e){if(e&&e.track&&e.track.kind!=="chapters")return;const t=this.findChaptersTrack();t!==this.track_?(this.setTrack(t),super.update()):(!this.items||t&&t.cues&&t.cues.length!==this.items.length)&&super.update()}setTrack(e){if(this.track_!==e){if(this.updateHandler_||(this.updateHandler_=this.update.bind(this)),this.track_){const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.removeEventListener("load",this.updateHandler_),this.track_.removeEventListener("cuechange",this.selectCurrentItem_),this.track_=null}if(this.track_=e,this.track_){this.track_.mode="hidden";const t=this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);t&&t.addEventListener("load",this.updateHandler_),this.track_.addEventListener("cuechange",this.selectCurrentItem_)}}}findChaptersTrack(){const e=this.player_.textTracks()||[];for(let t=e.length-1;t>=0;t--){const r=e[t];if(r.kind===this.kind_)return r}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(He(this.kind_))}createMenu(){return this.options_.title=this.getMenuCaption(),super.createMenu()}createItems(){const e=[];if(!this.track_)return e;const t=this.track_.cues;if(!t)return e;for(let r=0,s=t.length;r<s;r++){const n=t[r],a=new Gp(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}gu.prototype.kind_="chapters";gu.prototype.controlText_="Chapters";H.registerComponent("ChaptersButton",gu);class yu extends rs{constructor(e,t,r){super(e,t,r),this.setIcon("audio-description");const s=e.textTracks(),n=Pe(this,this.handleTracksChange);s.addEventListener("change",n),this.on("dispose",function(){s.removeEventListener("change",n)})}handleTracksChange(e){const t=this.player().textTracks();let r=!1;for(let s=0,n=t.length;s<n;s++){const a=t[s];if(a.kind!==this.kind_&&a.mode==="showing"){r=!0;break}}r?this.disable():this.enable()}buildCSSClass(){return`vjs-descriptions-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-descriptions-button ${super.buildWrapperCSSClass()}`}}yu.prototype.kind_="descriptions";yu.prototype.controlText_="Descriptions";H.registerComponent("DescriptionsButton",yu);class _u extends rs{constructor(e,t,r){super(e,t,r),this.setIcon("subtitles")}buildCSSClass(){return`vjs-subtitles-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subtitles-button ${super.buildWrapperCSSClass()}`}}_u.prototype.kind_="subtitles";_u.prototype.controlText_="Subtitles";H.registerComponent("SubtitlesButton",_u);class Tu extends dn{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()}}H.registerComponent("CaptionSettingsMenuItem",Tu);class vu extends rs{constructor(e,t,r){super(e,t,r),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 Tu(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}vu.prototype.kind_="captions";vu.prototype.controlText_="Captions";H.registerComponent("CaptionsButton",vu);class Kp extends dn{createEl(e,t,r){const s=super.createEl(e,t,r),n=s.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",s):n.appendChild(ne("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(ne("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),s}}H.registerComponent("SubsCapsMenuItem",Kp);class bu extends rs{constructor(e,t={}){super(e,t),this.label_="subtitles",this.setIcon("subtitles"),["en","en-us","en-ca","fr-ca"].indexOf(this.player_.language_)>-1&&(this.label_="captions",this.setIcon("captions")),this.menuButton_.controlText(He(this.label_))}buildCSSClass(){return`vjs-subs-caps-button ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-subs-caps-button ${super.buildWrapperCSSClass()}`}createItems(){let e=[];return!(this.player().tech_&&this.player().tech_.featuresNativeTextTracks)&&this.player().getChild("textTrackSettings")&&(e.push(new Tu(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,Kp),e}}bu.prototype.kinds_=["captions","subtitles"];bu.prototype.controlText_="Subtitles";H.registerComponent("SubsCapsButton",bu);class Xp extends cn{constructor(e,t){const r=t.track,s=e.audioTracks();t.label=r.label||r.language||"Unknown",t.selected=r.enabled,super(e,t),this.track=r,this.addClass(`vjs-${r.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};s.addEventListener("change",n),this.on("dispose",()=>{s.removeEventListener("change",n)})}createEl(e,t,r){const s=super.createEl(e,t,r),n=s.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(ne("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(ne("span",{className:"vjs-control-text",textContent:" "+this.localize("Descriptions")}))),s}handleClick(e){if(super.handleClick(e),this.track.enabled=!0,this.player_.tech_.featuresNativeAudioTracks){const t=this.player_.audioTracks();for(let r=0;r<t.length;r++){const s=t[r];s!==this.track&&(s.enabled=s===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}H.registerComponent("AudioTrackMenuItem",Xp);class Yp extends mu{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 r=0;r<t.length;r++){const s=t[r];e.push(new Xp(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}Yp.prototype.controlText_="Audio Track";H.registerComponent("AudioTrackButton",Yp);class xu extends cn{constructor(e,t){const r=t.rate,s=parseFloat(r,10);t.label=r,t.selected=s===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=r,this.rate=s,this.on(e,"ratechange",n=>this.update(n))}handleClick(e){super.handleClick(),this.player().playbackRate(this.rate)}update(e){this.selected(this.player().playbackRate()===this.rate)}}xu.prototype.contentElType="button";H.registerComponent("PlaybackRateMenuItem",xu);class Qp extends pu{constructor(e,t){super(e,t),this.menuButton_.el_.setAttribute("aria-describedby",this.labelElId_),this.updateVisibility(),this.updateLabel(),this.on(e,"loadstart",r=>this.updateVisibility(r)),this.on(e,"ratechange",r=>this.updateLabel(r)),this.on(e,"playbackrateschange",r=>this.handlePlaybackRateschange(r))}createEl(){const e=super.createEl();return this.labelElId_="vjs-playback-rate-value-label-"+this.id_,this.labelEl_=ne("div",{className:"vjs-playback-rate-value",id:this.labelElId_,textContent:"1x"}),e.appendChild(this.labelEl_),e}dispose(){this.labelEl_=null,super.dispose()}buildCSSClass(){return`vjs-playback-rate ${super.buildCSSClass()}`}buildWrapperCSSClass(){return`vjs-playback-rate ${super.buildWrapperCSSClass()}`}createItems(){const e=this.playbackRates(),t=[];for(let r=e.length-1;r>=0;r--)t.push(new xu(this.player(),{rate:e[r]+"x"}));return t}handlePlaybackRateschange(e){this.update()}playbackRates(){const e=this.player();return e.playbackRates&&e.playbackRates()||[]}playbackRateSupported(){return this.player().tech_&&this.player().tech_.featuresPlaybackRate&&this.playbackRates()&&this.playbackRates().length>0}updateVisibility(e){this.playbackRateSupported()?this.removeClass("vjs-hidden"):this.addClass("vjs-hidden")}updateLabel(e){this.playbackRateSupported()&&(this.labelEl_.textContent=this.player().playbackRate()+"x")}}Qp.prototype.controlText_="Playback Rate";H.registerComponent("PlaybackRateMenuButton",Qp);class Jp extends H{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},r={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,r)}}H.registerComponent("Spacer",Jp);class R1 extends Jp{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}H.registerComponent("CustomControlSpacer",R1);class Zp extends H{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}Zp.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};H.registerComponent("ControlBar",Zp);class em extends ts{constructor(e,t){super(e,t),this.on(e,"error",r=>{this.open(r)})}buildCSSClass(){return`vjs-error-display ${super.buildCSSClass()}`}content(){const e=this.player().error();return e?this.localize(e.message):""}}em.prototype.options_=Object.assign({},ts.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});H.registerComponent("ErrorDisplay",em);class tm extends H{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(),ne("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const r=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Ut()}`)+"-"+t[1].replace(/\W+/g,""),s=ne("option",{id:r,value:this.localize(t[0]),textContent:this.localize(t[1])});return s.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${r}`),s}))}}H.registerComponent("TextTrackSelect",tm);class ar extends H{constructor(e,t={}){super(e,t);const r=ne("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(r);const s=this.options_.selects;for(const n of s){const a=this.options_.selectConfigs[n],l=a.className,u=a.id.replace("%s",this.options_.id_);let f=null;const p=`vjs_select_${Ut()}`;if(this.options_.type==="colors"){f=ne("span",{className:l});const b=ne("label",{id:u,className:"vjs-label",textContent:this.localize(a.label)});b.setAttribute("for",p),f.appendChild(b)}const T=new tm(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:p,labelId:u});this.addChild(T),this.options_.type==="colors"&&(f.appendChild(T.el()),this.el().appendChild(f))}}createEl(){return ne("fieldset",{className:this.options_.className})}}H.registerComponent("TextTrackFieldset",ar);class im extends H{constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,s=new ar(e,{id_:r,legendId:`captions-text-legend-${r}`,legendText:this.localize("Text"),className:"vjs-fg vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(s);const n=new ar(e,{id_:r,legendId:`captions-background-${r}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new ar(e,{id_:r,legendId:`captions-window-${r}`,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 ne("div",{className:"vjs-track-settings-colors"})}}H.registerComponent("TextTrackSettingsColors",im);class rm extends H{constructor(e,t={}){super(e,t);const r=this.options_.textTrackComponentid,s=new ar(e,{id_:r,legendId:`captions-font-size-${r}`,legendText:"Font Size",className:"vjs-font-percent vjs-track-setting",selects:this.options_.fieldSets[0],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(s);const n=new ar(e,{id_:r,legendId:`captions-edge-style-${r}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new ar(e,{id_:r,legendId:`captions-font-family-${r}`,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 ne("div",{className:"vjs-track-settings-font"})}}H.registerComponent("TextTrackSettingsFont",rm);class sm extends H{constructor(e,t={}){super(e,t);const r=this.localize("restore all settings to the default values"),s=new at(e,{controlText:r,className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);const n=new at(e,{controlText:r,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Done"),this.addChild(n)}createEl(){return ne("div",{className:"vjs-track-settings-controls"})}}H.registerComponent("TrackSettingsControls",sm);const Fo="vjs-text-track-settings",Nd=["#000","Black"],Bd=["#00F","Blue"],Md=["#0FF","Cyan"],Ud=["#0F0","Green"],Fd=["#F0F","Magenta"],$d=["#F00","Red"],jd=["#FFF","White"],Vd=["#FF0","Yellow"],$o=["1","Opaque"],jo=["0.5","Semi-Transparent"],qd=["0","Transparent"],$i={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Nd,jd,$d,Ud,Bd,Vd,Fd,Md],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[$o,jo,qd],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[jd,Nd,$d,Ud,Bd,Vd,Fd,Md],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:i=>i==="1.00"?null:Number(i)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[$o,jo],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:[qd,jo,$o],className:"vjs-window-opacity vjs-opacity"}};$i.windowColor.options=$i.backgroundColor.options;function nm(i,e){if(e&&(i=e(i)),i&&i!=="none")return i}function O1(i,e){const t=i.options[i.options.selectedIndex].value;return nm(t,e)}function N1(i,e,t){if(e){for(let r=0;r<i.options.length;r++)if(nm(i.options[r].value,t)===e){i.selectedIndex=r;break}}}class B1 extends ts{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=ne("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 im(e,{textTrackComponentid:this.id_,selectConfigs:$i,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const r=new rm(e,{textTrackComponentid:this.id_,selectConfigs:$i,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(r);const s=new sm(e);this.addChild(s)}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()}),kr($i,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 Xf($i,(e,t,r)=>{const s=O1(this.$(t.selector),t.parser);return s!==void 0&&(e[r]=s),e},{})}setValues(e){kr($i,(t,r)=>{N1(this.$(t.selector),e[r],t.parser)})}setDefaults(){kr($i,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(k.localStorage.getItem(Fo))}catch(t){fe.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?k.localStorage.setItem(Fo,JSON.stringify(e)):k.localStorage.removeItem(Fo)}catch(t){fe.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}H.registerComponent("TextTrackSettings",B1);class M1 extends H{constructor(e,t){let r=t.ResizeObserver||k.ResizeObserver;t.ResizeObserver===null&&(r=!1);const s=Ae({createEl:!r,reportTouchActivity:!1},t);super(e,s),this.ResizeObserver=t.ResizeObserver||k.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=_p(()=>{this.resizeHandler()},100,!1,this),r?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){nt(this,"resize",n),nt(this,"unload",a),a=null};It(this.el_.contentWindow,"unload",a),It(this.el_.contentWindow,"resize",n)},this.one("load",this.loadListener_))}createEl(){return super.createEl("iframe",{className:"vjs-resize-manager",tabIndex:-1,title:this.localize("No content")},{"aria-hidden":"true"})}resizeHandler(){!this.player_||!this.player_.trigger||this.player_.trigger("playerresize")}dispose(){this.debouncedHandler_&&this.debouncedHandler_.cancel(),this.resizeObserver_&&(this.player_.el()&&this.resizeObserver_.unobserve(this.player_.el()),this.resizeObserver_.disconnect()),this.loadListener_&&this.off("load",this.loadListener_),this.el_&&this.el_.contentWindow&&this.unloadListener_&&this.unloadListener_.call(this.el_.contentWindow),this.ResizeObserver=null,this.resizeObserver=null,this.debouncedHandler_=null,this.loadListener_=null,super.dispose()}}H.registerComponent("ResizeManager",M1);const U1={trackingThreshold:20,liveTolerance:15};class F1 extends H{constructor(e,t){const r=Ae(U1,t,{createEl:!1});super(e,r),this.trackLiveHandler_=()=>this.trackLive_(),this.handlePlay_=s=>this.handlePlay(s),this.handleFirstTimeupdate_=s=>this.handleFirstTimeupdate(s),this.handleSeeked_=s=>this.handleSeeked(s),this.seekToLiveEdge_=s=>this.seekToLiveEdge(s),this.reset_(),this.on(this.player_,"durationchange",s=>this.handleDurationchange(s)),this.on(this.player_,"canplay",()=>this.toggleTracking())}trackLive_(){const e=this.player_.seekable();if(!e||!e.length)return;const t=Number(k.performance.now().toFixed(4)),r=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+r;const s=this.liveCurrentTime(),n=this.player_.currentTime();let a=this.player_.paused()||this.seekedBehindLive_||Math.abs(s-n)>this.options_.liveTolerance;(!this.timeupdateSeen_||s===1/0)&&(a=!1),a!==this.behindLiveEdge_&&(this.behindLiveEdge_=a,this.trigger("liveedgechange"))}handleDurationchange(){this.toggleTracking()}toggleTracking(){this.player_.duration()===1/0&&this.liveWindow()>=this.options_.trackingThreshold?(this.player_.options_.liveui&&this.player_.addClass("vjs-liveui"),this.startTracking()):(this.player_.removeClass("vjs-liveui"),this.stopTracking())}startTracking(){this.isTracking()||(this.timeupdateSeen_||(this.timeupdateSeen_=this.player_.hasStarted()),this.trackingInterval_=this.setInterval(this.trackLiveHandler_,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 r=e?e.length:0;for(;r--;)t.push(e.end(r));return t.length?t.sort()[t.length-1]:1/0}seekableStart(){const e=this.player_.seekable(),t=[];let r=e?e.length:0;for(;r--;)t.push(e.start(r));return t.length?t.sort()[0]:0}liveWindow(){const e=this.liveCurrentTime();return e===1/0?0:e-this.seekableStart()}isLive(){return this.isTracking()}atLiveEdge(){return!this.behindLiveEdge()}liveCurrentTime(){return this.pastSeekEnd()+this.seekableEnd()}pastSeekEnd(){const e=this.seekableEnd();return this.lastSeekEnd_!==-1&&e!==this.lastSeekEnd_&&(this.pastSeekEnd_=0),this.lastSeekEnd_=e,this.pastSeekEnd_}behindLiveEdge(){return this.behindLiveEdge_}isTracking(){return typeof this.trackingInterval_=="number"}seekToLiveEdge(){this.seekedBehindLive_=!1,!this.atLiveEdge()&&(this.nextSeekedFromUser_=!1,this.player_.currentTime(this.liveCurrentTime()))}dispose(){this.stopTracking(),super.dispose()}}H.registerComponent("LiveTracker",F1);class $1 extends H{constructor(e,t){super(e,t),this.on("statechanged",r=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:ne("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Ut()}`}),description:ne("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Ut()}`})},ne("div",{className:"vjs-title-bar"},{},Yf(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,r={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(s=>{const n=this.state[s],a=this.els[s],l=r[s];Wa(a),n&&Hi(a,n),t&&(t.removeAttribute(l),n&&t.setAttribute(l,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}}H.registerComponent("TitleBar",$1);const j1={initialDisplay:4e3,position:[],takeFocus:!1};class V1 extends at{constructor(e,t){t=Ae(j1,t),super(e,t),this.controlText(t.controlText),this.hide(),this.on(this.player_,["useractive","userinactive"],r=>{this.removeClass("force-display")})}buildCSSClass(){return`vjs-transient-button focus-visible ${this.options_.position.map(e=>`vjs-${e}`).join(" ")}`}createEl(){const e=ne("button",{},{type:"button",class:this.buildCSSClass()},ne("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()}}H.registerComponent("TransientButton",V1);const cl=i=>{const e=i.el();if(e.hasAttribute("src"))return i.triggerSourceset(e.src),!0;const t=i.$$("source"),r=[];let s="";if(!t.length)return!1;for(let n=0;n<t.length;n++){const a=t[n].src;a&&r.indexOf(a)===-1&&r.push(a)}return r.length?(r.length===1&&(s=r[0]),i.triggerSourceset(s),!0):!1},q1=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(i){const e=X.createElement(this.nodeName.toLowerCase());e.innerHTML=i;const t=X.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",k.Element.prototype.appendChild.call(this,t),this.innerHTML}}),am=(i,e)=>{let t={};for(let r=0;r<i.length&&(t=Object.getOwnPropertyDescriptor(i[r],e),!(t&&t.set&&t.get));r++);return t.enumerable=!0,t.configurable=!0,t},H1=i=>am([i.el(),k.HTMLMediaElement.prototype,k.Element.prototype,q1],"innerHTML"),Hd=function(i){const e=i.el();if(e.resetSourceWatch_)return;const t={},r=H1(i),s=n=>(...a)=>{const l=n.apply(e,a);return cl(i),l};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=s(t[n]))}),Object.defineProperty(e,"innerHTML",Ae(r,{set:s(r.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",r)},i.one("sourceset",e.resetSourceWatch_)},z1=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?Dp(k.Element.prototype.getAttribute.call(this,"src")):""},set(i){return k.Element.prototype.setAttribute.call(this,"src",i),i}}),W1=i=>am([i.el(),k.HTMLMediaElement.prototype,z1],"src"),G1=function(i){if(!i.featuresSourceset)return;const e=i.el();if(e.resetSourceset_)return;const t=W1(i),r=e.setAttribute,s=e.load;Object.defineProperty(e,"src",Ae(t,{set:n=>{const a=t.set.call(e,n);return i.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const l=r.call(e,n,a);return/src/i.test(n)&&i.triggerSourceset(e.src),l},e.load=()=>{const n=s.call(e);return cl(i)||(i.triggerSourceset(""),Hd(i)),n},e.currentSrc?i.triggerSourceset(e.currentSrc):cl(i)||Hd(i),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=s,e.setAttribute=r,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class Z extends ue{constructor(e,t){super(e,t);const r=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",r&&(this.el_.currentSrc!==r.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(r):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const l=[];for(;a--;){const u=n[a];u.nodeName.toLowerCase()==="track"&&(this.featuresNativeTextTracks?(this.remoteTextTrackEls().addTrackElement_(u),this.remoteTextTracks().addTrack(u.track),this.textTracks().addTrack(u.track),!s&&!this.el_.hasAttribute("crossorigin")&&Ya(u.src)&&(s=!0)):l.push(u))}for(let u=0;u<l.length;u++)this.el_.removeChild(l[u])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s&&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_(),(Zs||ja)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),Z.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){G1(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const r=()=>{t=[];for(let n=0;n<e.length;n++){const a=e[n];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};r(),e.addEventListener("change",r),this.on("dispose",()=>e.removeEventListener("change",r));const s=()=>{for(let n=0;n<t.length;n++){const a=t[n];a.track.mode==="disabled"&&a.track.mode!==a.storedMode&&(a.track.mode=a.storedMode)}e.removeEventListener("change",s)};this.on("webkitbeginfullscreen",()=>{e.removeEventListener("change",r),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",r),e.addEventListener("change",r),e.removeEventListener("change",s)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const r=e.toLowerCase();this[`${r}TracksListeners_`]&&Object.keys(this[`${r}TracksListeners_`]).forEach(s=>{this.el()[`${r}Tracks`].removeEventListener(s,this[`${r}TracksListeners_`][s])}),this[`featuresNative${e}Tracks`]=!t,this[`${r}TracksListeners_`]=null,this.proxyNativeTracksForType_(r)}overrideNativeAudioTracks(e){this.overrideNative_("Audio",e)}overrideNativeVideoTracks(e){this.overrideNative_("Video",e)}proxyNativeTracksForType_(e){const t=Mt[e],r=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!r||!r.addEventListener)return;const n={change:l=>{const u={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(u),e==="text"&&this[Yr.remoteText.getterName]().trigger(u)},addtrack(l){s.addTrack(l.track)},removetrack(l){s.removeTrack(l.track)}},a=function(){const l=[];for(let u=0;u<s.length;u++){let f=!1;for(let p=0;p<r.length;p++)if(r[p]===s[u]){f=!0;break}f||l.push(s[u])}for(;l.length;)s.removeTrack(l.shift())};this[t.getterName+"Listeners_"]=n,Object.keys(n).forEach(l=>{const u=n[l];r.addEventListener(l,u),this.on("dispose",f=>r.removeEventListener(l,u))}),this.on("loadstart",a),this.on("dispose",l=>this.off("loadstart",a))}proxyNativeTracks_(){Mt.names.forEach(e=>{this.proxyNativeTracksForType_(e)})}createEl(){let e=this.options_.tag;if(!e||!(this.options_.playerElIngest||this.movingMediaElementInDOM)){if(e){const r=e.cloneNode(!0);e.parentNode&&e.parentNode.insertBefore(r,e),Z.disposeMediaElement(e),e=r}else{e=X.createElement("video");const r=this.options_.tag&&Fi(this.options_.tag),s=Ae({},r);(!Zs||this.options_.nativeControlsForTouch!==!0)&&delete s.controls,np(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Wr(e,"preload",this.options_.preload),this.options_.disablePictureInPicture!==void 0&&(e.disablePictureInPicture=this.options_.disablePictureInPicture);const t=["loop","muted","playsinline","autoplay"];for(let r=0;r<t.length;r++){const s=t[r],n=this.options_[s];typeof n<"u"&&(n?Wr(e,s,s):Ha(e,s),e[s]=n)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let r=!1;const s=function(){r=!0};this.on("loadstart",s);const n=function(){r||this.trigger("loadstart")};this.on("loadedmetadata",n),this.ready(function(){this.off("loadstart",s),this.off("loadedmetadata",n),r||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(r){this.trigger(r)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&Va?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&&Gt&&hi&&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)si(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 r={src:e};t&&(r.type=t);const s=ne("source",{},r);return this.el_.appendChild(s),!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 r of t)if(r.src===e)return this.el_.removeChild(r),!0;return fe.warn(`No matching source element found with src: ${e}`),!1}reset(){Z.resetMediaElement(this.el_)}currentSrc(){return this.currentSource_?this.currentSource_.src:this.el_.currentSrc}setControls(e){this.el_.controls=!!e}addTextTrack(e,t,r){return this.featuresNativeTextTracks?this.el_.addTextTrack(e,t,r):super.addTextTrack(e,t,r)}createRemoteTextTrack(e){if(!this.featuresNativeTextTracks)return super.createRemoteTextTrack(e);const t=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 r=super.addRemoteTextTrack(e,t);return this.featuresNativeTextTracks&&this.el().appendChild(r),r}removeRemoteTextTrack(e){if(super.removeRemoteTextTrack(e),this.featuresNativeTextTracks){const t=this.$$("track");let r=t.length;for(;r--;)(e===t[r]||e===t[r].track)&&this.el().removeChild(t[r])}}getVideoPlaybackQuality(){if(typeof this.el().getVideoPlaybackQuality=="function")return this.el().getVideoPlaybackQuality();const e={};return typeof this.el().webkitDroppedFrameCount<"u"&&typeof this.el().webkitDecodedFrameCount<"u"&&(e.droppedVideoFrames=this.el().webkitDroppedFrameCount,e.totalVideoFrames=this.el().webkitDecodedFrameCount),k.performance&&(e.creationTime=k.performance.now()),e}}Ua(Z,"TEST_VID",function(){if(!Jr())return;const i=X.createElement("video"),e=X.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",i.appendChild(e),i});Z.isSupported=function(){try{Z.TEST_VID.volume=.5}catch{return!1}return!!(Z.TEST_VID&&Z.TEST_VID.canPlayType)};Z.canPlayType=function(i){return Z.TEST_VID.canPlayType(i)};Z.canPlaySource=function(i,e){return Z.canPlayType(i.type)};Z.canControlVolume=function(){try{const i=Z.TEST_VID.volume;Z.TEST_VID.volume=i/2+.1;const e=i!==Z.TEST_VID.volume;return e&&st?(k.setTimeout(()=>{Z&&Z.prototype&&(Z.prototype.featuresVolumeControl=i!==Z.TEST_VID.volume)}),!1):e}catch{return!1}};Z.canMuteVolume=function(){try{const i=Z.TEST_VID.muted;return Z.TEST_VID.muted=!i,Z.TEST_VID.muted?Wr(Z.TEST_VID,"muted","muted"):Ha(Z.TEST_VID,"muted","muted"),i!==Z.TEST_VID.muted}catch{return!1}};Z.canControlPlaybackRate=function(){if(Gt&&hi&&Fa<58)return!1;try{const i=Z.TEST_VID.playbackRate;return Z.TEST_VID.playbackRate=i/2+.1,i!==Z.TEST_VID.playbackRate}catch{return!1}};Z.canOverrideAttributes=function(){try{const i=()=>{};Object.defineProperty(X.createElement("video"),"src",{get:i,set:i}),Object.defineProperty(X.createElement("audio"),"src",{get:i,set:i}),Object.defineProperty(X.createElement("video"),"innerHTML",{get:i,set:i}),Object.defineProperty(X.createElement("audio"),"innerHTML",{get:i,set:i})}catch{return!1}return!0};Z.supportsNativeTextTracks=function(){return Va||st&&hi};Z.supportsNativeVideoTracks=function(){return!!(Z.TEST_VID&&Z.TEST_VID.videoTracks)};Z.supportsNativeAudioTracks=function(){return!!(Z.TEST_VID&&Z.TEST_VID.audioTracks)};Z.Events=["loadstart","suspend","abort","error","emptied","stalled","loadedmetadata","loadeddata","canplay","canplaythrough","playing","waiting","seeking","seeked","ended","durationchange","timeupdate","progress","play","pause","ratechange","resize","volumechange"];[["featuresMuteControl","canMuteVolume"],["featuresPlaybackRate","canControlPlaybackRate"],["featuresSourceset","canOverrideAttributes"],["featuresNativeTextTracks","supportsNativeTextTracks"],["featuresNativeVideoTracks","supportsNativeVideoTracks"],["featuresNativeAudioTracks","supportsNativeAudioTracks"]].forEach(function([i,e]){Ua(Z.prototype,i,()=>Z[e](),!0)});Z.prototype.featuresVolumeControl=Z.canControlVolume();Z.prototype.movingMediaElementInDOM=!st;Z.prototype.featuresFullscreenResize=!0;Z.prototype.featuresProgressEvents=!0;Z.prototype.featuresTimeupdateEvents=!0;Z.prototype.featuresVideoFrameCallback=!!(Z.TEST_VID&&Z.TEST_VID.requestVideoFrameCallback);Z.disposeMediaElement=function(i){if(i){for(i.parentNode&&i.parentNode.removeChild(i);i.hasChildNodes();)i.removeChild(i.firstChild);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()}};Z.resetMediaElement=function(i){if(!i)return;const e=i.querySelectorAll("source");let t=e.length;for(;t--;)i.removeChild(e[t]);i.removeAttribute("src"),typeof i.load=="function"&&function(){try{i.load()}catch{}}()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]||this.el_.hasAttribute(i)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(i){Z.prototype["set"+He(i)]=function(e){this.el_[i]=e,e?this.el_.setAttribute(i,i):this.el_.removeAttribute(i)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(i){Z.prototype["set"+He(i)]=function(e){this.el_[i]=e}});["pause","load","play"].forEach(function(i){Z.prototype[i]=function(){return this.el_[i]()}});ue.withSourceHandlers(Z);Z.nativeSourceHandler={};Z.nativeSourceHandler.canPlayType=function(i){try{return Z.TEST_VID.canPlayType(i)}catch{return""}};Z.nativeSourceHandler.canHandleSource=function(i,e){if(i.type)return Z.nativeSourceHandler.canPlayType(i.type);if(i.src){const t=ou(i.src);return Z.nativeSourceHandler.canPlayType(`video/${t}`)}return""};Z.nativeSourceHandler.handleSource=function(i,e,t){e.setSrc(i.src)};Z.nativeSourceHandler.dispose=function(){};Z.registerSourceHandler(Z.nativeSourceHandler);ue.registerTech("Html5",Z);const om=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],Vo={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},dl=["tiny","xsmall","small","medium","large","xlarge","huge"],Yn={};dl.forEach(i=>{const e=i.charAt(0)==="x"?`x-${i.substring(1)}`:i;Yn[i]=`vjs-layout-${e}`});const K1={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Oe extends H{constructor(e,t,r){if(e.id=e.id||t.id||`vjs_video_${Ut()}`,t=Object.assign(Oe.getTagSettings(e),t),t.initChildren=!1,t.createEl=!1,t.evented=!1,t.reportTouchActivity=!1,!t.language){const a=e.closest("[lang]");a&&(t.language=a.getAttribute("lang"))}if(super(null,t,r),this.boundDocumentFullscreenChange_=a=>this.documentFullscreenChange_(a),this.boundFullWindowOnEscKey_=a=>this.fullWindowOnEscKey(a),this.boundUpdateStyleEl_=a=>this.updateStyleEl_(a),this.boundApplyInitTime_=a=>this.applyInitTime_(a),this.boundUpdateCurrentBreakpoint_=a=>this.updateCurrentBreakpoint_(a),this.boundHandleTechClick_=a=>this.handleTechClick_(a),this.boundHandleTechDoubleClick_=a=>this.handleTechDoubleClick_(a),this.boundHandleTechTouchStart_=a=>this.handleTechTouchStart_(a),this.boundHandleTechTouchMove_=a=>this.handleTechTouchMove_(a),this.boundHandleTechTouchEnd_=a=>this.handleTechTouchEnd_(a),this.boundHandleTechTap_=a=>this.handleTechTap_(a),this.boundUpdatePlayerHeightOnAudioOnlyMode_=a=>this.updatePlayerHeightOnAudioOnlyMode_(a),this.isFullscreen_=!1,this.log=Gf(this.id_),this.fsApi_=na,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&&Fi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(l){a[l.toLowerCase()]=t.languages[l]}),this.languages_=a}else this.languages_=Oe.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(),ru(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(It(X,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=Ae(this.options_);if(t.plugins&&Object.keys(t.plugins).forEach(a=>{this[a](t.plugins[a])}),t.debug&&this.debug(!0),this.options_.playerOptions=s,this.middleware_=[],this.playbackRates(t.playbackRates),t.experimentalSvgIcons){const l=new k.DOMParser().parseFromString(y1,"image/svg+xml");if(l.querySelector("parsererror"))fe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const f=l.documentElement;f.style.display="none",this.el_.appendChild(f),this.addClass("vjs-svg-icons-enabled")}}this.initChildren(),this.isAudio(e.nodeName.toLowerCase()==="audio"),this.controls()?this.addClass("vjs-controls-enabled"):this.addClass("vjs-controls-disabled"),this.el_.setAttribute("role","region"),this.isAudio()?this.el_.setAttribute("aria-label",this.localize("Audio Player")):this.el_.setAttribute("aria-label",this.localize("Video Player")),this.isAudio()&&this.addClass("vjs-audio"),t.spatialNavigation&&t.spatialNavigation.enabled&&(this.spatialNavigation=new _1(this),this.addClass("vjs-spatial-navigation-enabled")),Zs&&this.addClass("vjs-touch-enabled"),st||this.addClass("vjs-workinghover"),Oe.players[this.id_]=this;const n=tl.split(".")[0];this.addClass(`vjs-v${n}`),this.userActive(!0),this.reportUserActivity(),this.one("play",a=>this.listenForUserActivity_(a)),this.on("keydown",a=>this.handleKeyDown(a)),this.on("languagechange",a=>this.handleLanguagechange(a)),this.breakpoints(this.options_.breakpoints),this.responsive(this.options_.responsive),this.on("ready",()=>{this.audioPosterMode(this.options_.audioPosterMode),this.audioOnlyMode(this.options_.audioOnlyMode)})}dispose(){this.trigger("dispose"),this.off("dispose"),nt(X,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),nt(X,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Oe.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),f1(this),dt.names.forEach(e=>{const t=dt[e],r=this[t.getterName]();r&&r.off&&r.off()}),super.dispose({restoreEl:this.options_.restoreEl})}createEl(){let e=this.tag,t,r=this.playerElIngest_=e.parentNode&&e.parentNode.hasAttribute&&e.parentNode.hasAttribute("data-vjs-player");const s=this.tag.tagName.toLowerCase()==="video-js";r?t=this.el_=e.parentNode:s||(t=this.el_=super.createEl("div"));const n=Fi(e);if(s){for(t=this.el_=e,e=this.tag=X.createElement("video");t.children.length;)e.appendChild(t.firstChild);Vs(t,"video-js")||sr(t,"video-js"),t.appendChild(e),r=this.playerElIngest_=t,Object.keys(t).forEach(u=>{try{e[u]=t[u]}catch{}})}e.setAttribute("tabindex","-1"),n.tabindex="-1",hi&&$a&&(e.setAttribute("role","application"),n.role="application"),e.removeAttribute("width"),e.removeAttribute("height"),"width"in n&&delete n.width,"height"in n&&delete n.height,Object.getOwnPropertyNames(n).forEach(function(u){s&&u==="class"||t.setAttribute(u,n[u]),s&&e.setAttribute(u,n[u])}),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(u=>tp[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),k.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=gp("vjs-styles-dimensions");const u=Vi(".vjs-styles-defaults"),f=Vi("head");f.insertBefore(this.styleEl_,u?u.nextSibling:f.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const l=e.getElementsByTagName("a");for(let u=0;u<l.length;u++){const f=l.item(u);sr(f,"vjs-hidden"),f.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!r&&e.parentNode.insertBefore(t,e),rl(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 r=e+"_";if(t===void 0)return this[r]||0;if(t===""||t==="auto"){this[r]=void 0,this.updateStyleEl_();return}const s=parseFloat(t);if(isNaN(s)){fe.error(`Improper value "${t}" supplied for for ${e}`);return}this[r]=s,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,vi(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),q2(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(k.VIDEOJS_NO_DYNAMIC_STYLE===!0){const l=typeof this.width_=="number"?this.width_:this.options_.width,u=typeof this.height_=="number"?this.height_:this.options_.height,f=this.tech_&&this.tech_.el();f&&(l>=0&&(f.width=l),u>=0&&(f.height=u));return}let e,t,r,s;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?r=this.aspectRatio_:this.videoWidth()>0?r=this.videoWidth()+":"+this.videoHeight():r="16:9";const n=r.split(":"),a=n[1]/n[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?s="dimensions-"+this.id():s=this.id()+"-dimensions",this.addClass(s),yp(this.styleEl_,`
|
|
172
|
+
.${s} {
|
|
169
173
|
width: ${e}px;
|
|
170
174
|
height: ${t}px;
|
|
171
175
|
}
|
|
172
176
|
|
|
173
|
-
.${
|
|
177
|
+
.${s}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
174
178
|
padding-top: ${a*100}%;
|
|
175
179
|
}
|
|
176
|
-
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const
|
|
180
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const r=He(e),s=e.charAt(0).toLowerCase()+e.slice(1);r!=="Html5"&&this.tag&&(ue.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=r,this.isReady_=!1;let n=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(n=!1);const a={source:t,autoplay:n,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${s}_api`,playsinline:this.options_.playsinline,preload:this.options_.preload,loop:this.options_.loop,disablePictureInPicture:this.options_.disablePictureInPicture,muted:this.options_.muted,poster:this.poster(),language:this.language(),playerElIngest:this.playerElIngest_||!1,"vtt.js":this.options_["vtt.js"],canOverridePoster:!!this.options_.techCanOverridePoster,enableSourceset:this.options_.enableSourceset};dt.names.forEach(u=>{const f=dt[u];a[f.getterName]=this[f.privateName]}),Object.assign(a,this.options_[r]),Object.assign(a,this.options_[s]),Object.assign(a,this.options_[e.toLowerCase()]),this.tag&&(a.tag=this.tag),t&&t.src===this.cache_.src&&this.cache_.currentTime>0&&(a.startTime=this.cache_.currentTime);const l=ue.getTech(e);if(!l)throw new Error(`No Tech named '${r}' exists! '${r}' should be registered using videojs.registerTech()'`);this.tech_=new l(a),this.tech_.ready(Pe(this,this.handleTechReady_),!0),Sd.jsonToTextTracks(this.textTracksJson_||[],this.tech_),om.forEach(u=>{this.on(this.tech_,u,f=>this[`handleTech${He(u)}_`](f))}),Object.keys(Vo).forEach(u=>{this.on(this.tech_,u,f=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${Vo[u]}_`].bind(this),event:f});return}this[`handleTech${Vo[u]}_`](f)})}),this.on(this.tech_,"loadstart",u=>this.handleTechLoadStart_(u)),this.on(this.tech_,"sourceset",u=>this.handleTechSourceset_(u)),this.on(this.tech_,"waiting",u=>this.handleTechWaiting_(u)),this.on(this.tech_,"ended",u=>this.handleTechEnded_(u)),this.on(this.tech_,"seeking",u=>this.handleTechSeeking_(u)),this.on(this.tech_,"play",u=>this.handleTechPlay_(u)),this.on(this.tech_,"pause",u=>this.handleTechPause_(u)),this.on(this.tech_,"durationchange",u=>this.handleTechDurationChange_(u)),this.on(this.tech_,"fullscreenchange",(u,f)=>this.handleTechFullscreenChange_(u,f)),this.on(this.tech_,"fullscreenerror",(u,f)=>this.handleTechFullscreenError_(u,f)),this.on(this.tech_,"enterpictureinpicture",u=>this.handleTechEnterPictureInPicture_(u)),this.on(this.tech_,"leavepictureinpicture",u=>this.handleTechLeavePictureInPicture_(u)),this.on(this.tech_,"error",u=>this.handleTechError_(u)),this.on(this.tech_,"posterchange",u=>this.handleTechPosterChange_(u)),this.on(this.tech_,"textdata",u=>this.handleTechTextData_(u)),this.on(this.tech_,"ratechange",u=>this.handleTechRateChange_(u)),this.on(this.tech_,"loadedmetadata",this.boundUpdateStyleEl_),this.usingNativeControls(this.techGet_("controls")),this.controls()&&!this.usingNativeControls()&&this.addTechControlsListeners_(),this.tech_.el().parentNode!==this.el()&&(r!=="Html5"||!this.tag)&&rl(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){dt.names.forEach(e=>{const t=dt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Sd.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.
|
|
177
181
|
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
178
|
-
`),this.tech_}version(){return{"video.js":Ja}}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 n=this.muted();this.muted(!0);const r=()=>{this.muted(n)};this.playTerminatedQueue_.push(r);const a=this.play();if(pn(a))return a.catch(l=>{throw r(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${l||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),pn(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!pn(i))return i.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,i="";typeof t!="string"&&(t=e.src,i=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!i&&(i=sv(this,t)),this.cache_.source=xe({},e,{src:t,type:i});const n=this.cache_.sources.filter(h=>h.src&&h.src===t),r=[],a=this.$$("source"),l=[];for(let h=0;h<a.length;h++){const f=bi(a[h]);r.push(f),f.src&&f.src===t&&l.push(f.src)}l.length&&!n.length?this.cache_.sources=r:n.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=r=>this.updateSourceCaches_(r);const i=this.currentSource().src,n=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(n)&&(!this.lastSource_||this.lastSource_.tech!==n&&this.lastSource_.player!==i)&&(t=()=>{}),t(n),e.src||this.tech_.any(["sourceset","loadstart"],r=>{if(r.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?Kt(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),i=>i.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.isInPictureInPicture()&&!K.pictureInPictureElement?this.exitPictureInPicture():this.isFullscreen()?this.exitFullscreen():this.requestFullscreen())}handleTechTap_(){this.userActive(!this.userActive())}handleTechTouchStart_(){this.userWasActive=this.userActive()}handleTechTouchMove_(){this.userWasActive&&this.reportUserActivity()}handleTechTouchEnd_(e){e.cancelable&&e.preventDefault()}toggleFullscreenClass_(){this.isFullscreen()?this.addClass("vjs-fullscreen"):this.removeClass("vjs-fullscreen")}documentFullscreenChange_(e){const t=e.target.player;if(t&&t!==this)return;const i=this.el();let n=K[this.fsApi_.fullscreenElement]===i;!n&&i.matches&&(n=i.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(n)}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 JT)return YT(this.middleware_,this.tech_,e,t);if(e in Vu)return ju(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw ue(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in QT)return XT(this.middleware_,this.tech_,e);if(e in Vu)return ju(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(ue(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(ue(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(ue(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=Kt){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(Wr||Ze);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&i&&this.load();return}const n=this.techGet_("play");i&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),n===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(n)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Nt(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=Nt(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Nt(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 ih(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let i=e.end(e.length-1);return i>t&&(i=t),i}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((i,n)=>{function r(){t.off("fullscreenerror",l),t.off("fullscreenchange",a)}function a(){r(),i()}function l(f,m){r(),n(m)}t.one("fullscreenchange",a),t.one("fullscreenerror",l);const h=t.requestFullscreenHelper_(e);h&&(h.then(r,r),h.then(i,n))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const i=this.el_[this.fsApi_.requestFullscreen](t);return i&&i.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),i}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,i)=>{function n(){e.off("fullscreenerror",a),e.off("fullscreenchange",r)}function r(){n(),t()}function a(h,f){n(),i(f)}e.one("fullscreenchange",r),e.one("fullscreenerror",a);const l=e.exitFullscreenHelper_();l&&(l.then(n,n),l.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=K[this.fsApi_.exitFullscreen]();return e&&Kt(e.then(()=>this.isFullscreen(!1))),e}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("exitFullScreen"):this.exitFullWindow()}enterFullWindow(){this.isFullscreen(!0),this.isFullWindow=!0,this.docOrigOverflow=K.documentElement.style.overflow,vt(K,"keydown",this.boundFullWindowOnEscKey_),K.documentElement.style.overflow="hidden",Fi(K.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,et(K,"keydown",this.boundFullWindowOnEscKey_),K.documentElement.style.overflow=this.docOrigOverflow,Gr(K.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&&k.documentPictureInPicture){const e=K.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(se("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),k.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Hd(t),this.el_.parentNode.insertBefore(e,this.el_),t.document.body.appendChild(this.el_),t.document.body.classList.add("vjs-pip-window"),this.player_.isInPictureInPicture(!0),this.player_.trigger({type:"enterpictureinpicture",pipWindow:t}),t.addEventListener("pagehide",i=>{const n=i.target.querySelector(".video-js");e.parentNode.replaceChild(n,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in K&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(k.documentPictureInPicture&&k.documentPictureInPicture.window)return k.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in K)return K.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(n=>{const r=n.tagName.toLowerCase();if(n.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return r==="input"?a.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:i=a=>e.key.toLowerCase()==="f",muteKey:n=a=>e.key.toLowerCase()==="m",playPauseKey:r=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=H.getComponent("FullscreenToggle");K[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else n.call(this,e)?(e.preventDefault(),e.stopPropagation(),H.getComponent("MuteToggle").prototype.handleClick.call(this,e)):r.call(this,e)&&(e.preventDefault(),e.stopPropagation(),H.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,n=this.options_.techOrder;i<n.length;i++){const r=n[i];let a=oe.getTech(r);if(a||(a=H.getComponent(r)),!a){ue.error(`The "${r}" 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(l=>[l,oe.getTech(l)]).filter(([l,h])=>h?h.isSupported():(ue.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(l,h,f){let m;return l.some(T=>h.some(E=>{if(m=f(T,E),m)return!0})),m};let n;const r=l=>(h,f)=>l(f,h),a=([l,h],f)=>{if(h.canPlaySource(f,this.options_[l.toLowerCase()]))return{source:f,tech:l}};return this.options_.sourceOrder?n=i(e,t,r(a)):n=i(t,e,a),n||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=oh(e);if(!i.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=i),this.updateSourceCaches_(i[0]),GT(this,i[0],(n,r)=>{if(this.middleware_=r,t||(this.cache_.sources=i),this.updateSourceCaches_(n),this.src_(n)){if(i.length>1)return this.handleSrc_(i.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}KT(r,this.tech_)}),i.length>1){const n=()=>{this.error(null),this.handleSrc_(i.slice(1),!0)},r=()=>{this.off("error",n)};this.one("error",n),this.one("playing",r),this.resetRetryOnError_=()=>{this.off("error",n),this.off("playing",r)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?Jd(t.tech,this.techName_)?(this.ready(function(){this.tech_.constructor.prototype.hasOwnProperty("setSource")?this.techCall_("setSource",e):this.techCall_("src",e.src),this.changingSrc_=!1},!0),!1):(this.changingSrc_=!0,this.loadTech_(t.tech,t.source),this.tech_.ready(()=>{this.changingSrc_=!1}),!1):!0}addSourceElement(e,t){return this.tech_?this.tech_.addSourceElement(e,t):!1}removeSourceElement(e){return this.tech_?this.tech_.removeSourceElement(e):!1}load(){if(this.tech_&&this.tech_.vhs){this.src(this.currentSource());return}this.techCall_("load")}reset(){if(this.paused())this.doReset_();else{const e=this.play();Kt(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),ai(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:n}=this.controlBar||{},{seekBar:r}=i||{};e&&e.updateContent(),t&&t.updateContent(),n&&n.updateContent(),r&&(r.update(),r.loadProgressBar&&r.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(Si("beforeerror").forEach(t=>{const i=t(this,e);if(!(Zt(i)&&!Array.isArray(i)||typeof i=="string"||typeof i=="number"||i===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=i}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new Ne(e),this.addClass("vjs-error"),ue.error(`(CODE:${this.error_.code} ${Ne.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Si("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const n=we(this,this.reportUserActivity),r=function(T){(T.screenX!==t||T.screenY!==i)&&(t=T.screenX,i=T.screenY,n())},a=function(){n(),this.clearInterval(e),e=this.setInterval(n,250)},l=function(T){n(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",r),this.on("mouseup",l),this.on("mouseleave",l);const h=this.getChild("controlBar");h&&!Ze&&!Ut&&(h.on("mouseenter",function(T){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),h.on("mouseleave",function(T){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",n),this.on("keyup",n);let f;const m=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(f);const T=this.options_.inactivityTimeout;T<=0||(f=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},T))};this.setInterval(m,250)}playbackRate(e){if(e!==void 0){this.techCall_("setPlaybackRate",e);return}return this.tech_&&this.tech_.featuresPlaybackRate?this.cache_.lastPlaybackRate||this.techGet_("playbackRate"):1}defaultPlaybackRate(e){return e!==void 0?this.techCall_("setDefaultPlaybackRate",e):this.tech_&&this.tech_.featuresPlaybackRate?this.techGet_("defaultPlaybackRate"):1}isAudio(e){if(e!==void 0){this.isAudio_=!!e;return}return!!this.isAudio_}updatePlayerHeightOnAudioOnlyMode_(){const e=this.getChild("ControlBar");!e||this.audioOnlyCache_.controlBarHeight===e.currentHeight()||(this.audioOnlyCache_.controlBarHeight=e.currentHeight(),this.height(this.audioOnlyCache_.controlBarHeight))}enableAudioOnlyUI_(){this.addClass("vjs-audio-only-mode");const e=this.children(),t=this.getChild("ControlBar"),i=t&&t.currentHeight();e.forEach(n=>{n!==t&&n.el_&&!n.hasClass("vjs-hidden")&&(n.hide(),this.audioOnlyCache_.hiddenChildren.push(n))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),ai(this)&&this.trigger("languagechange"))}languages(){return xe(ke.prototype.options_.languages,this.languages_)}toJSON(){const e=xe(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let n=t[i];n=xe(n),n.player=void 0,e.tracks[i]=n}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Is(this,t);return this.addChild(i),i.on("dispose",()=>{this.removeChild(i)}),i.open(),i}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let i=0;i<lo.length;i++){const n=lo[i],r=this.breakpoints_[n];if(t<=r){if(e===n)return;e&&this.removeClass(or[e]),this.addClass(or[n]),this.breakpoint_=n;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({},Mv,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 or[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=xe(e);const{artist:n,artwork:r,description:a,poster:l,src:h,textTracks:f,title:m}=this.cache_.media;!r&&l&&(this.cache_.media.artwork=[{src:l,type:xr(l)}]),i&&this.crossOrigin(i),h&&this.src(h),l&&this.poster(l),Array.isArray(f)&&f.forEach(T=>this.addRemoteTextTrack(T,!1)),this.titleBar&&this.titleBar.update({title:m,description:a||n||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),i=Array.prototype.map.call(this.remoteTextTracks(),r=>({kind:r.kind,label:r.label,language:r.language,src:r.src})),n={src:t,textTracks:i};return e&&(n.poster=e,n.artwork=[{src:n.poster,type:xr(n.poster)}]),n}return xe(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=bi(e),n=i["data-setup"];if(hn(e,"vjs-fill")&&(i.fill=!0),hn(e,"vjs-fluid")&&(i.fluid=!0),n!==null)try{Object.assign(i,JSON.parse(n||"{}"))}catch(r){ue.error("data-setup",r)}if(Object.assign(t,i),e.hasChildNodes()){const r=e.childNodes;for(let a=0,l=r.length;a<l;a++){const h=r[a],f=h.nodeName.toLowerCase();f==="source"?t.sources.push(bi(h)):f==="track"&&t.tracks.push(bi(h))}}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"))}}rt.names.forEach(function(s){const e=rt[s];ke.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});ke.prototype.crossorigin=ke.prototype.crossOrigin;ke.players={};const en=k.navigator;ke.prototype.options_={techOrder:oe.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:en&&(en.languages&&en.languages[0]||en.userLanguage||en.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};Uh.forEach(function(s){ke.prototype[`handleTech${Be(s)}_`]=function(){return this.trigger(s)}});H.registerComponent("Player",ke);const Sr="plugin",ls="activePlugins_",is={},Er=s=>is.hasOwnProperty(s),lr=s=>Er(s)?is[s]:void 0,Bh=(s,e)=>{s[ls]=s[ls]||{},s[ls][e]=!0},Cr=(s,e,t)=>{const i=(t?"before":"")+"pluginsetup";s.trigger(i,e),s.trigger(i+":"+e.name,e)},Nv=function(s,e){const t=function(){Cr(this,{name:s,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return Bh(this,s),Cr(this,{name:s,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},rc=(s,e)=>(e.prototype.name=s,function(...t){Cr(this,{name:s,plugin:e,instance:null},!0);const i=new e(this,...t);return this[s]=()=>i,Cr(this,i.getEventHash()),i});class ft{constructor(e){if(this.constructor===ft)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),Ho(this),delete this.trigger,Qd(this,this.constructor.defaultState),Bh(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 ws(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[ls][e]=!1,this.player=this.state=null,t[e]=rc(e,is[e])}static isBasic(e){const t=typeof e=="string"?lr(e):e;return typeof t=="function"&&!ft.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Er(e))ue.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(ke.prototype.hasOwnProperty(e))throw new Error(`Illegal plugin name, "${e}", cannot share a name with an existing player method!`);if(typeof t!="function")throw new Error(`Illegal plugin for "${e}", must be a function, was ${typeof t}.`);return is[e]=t,e!==Sr&&(ft.isBasic(t)?ke.prototype[e]=Nv(e,t):ke.prototype[e]=rc(e,t)),t}static deregisterPlugin(e){if(e===Sr)throw new Error("Cannot de-register base plugin.");Er(e)&&(delete is[e],delete ke.prototype[e])}static getPlugins(e=Object.keys(is)){let t;return e.forEach(i=>{const n=lr(i);n&&(t=t||{},t[i]=n)}),t}static getPluginVersion(e){const t=lr(e);return t&&t.VERSION||""}}ft.getPlugin=lr;ft.BASE_PLUGIN_NAME=Sr;ft.registerPlugin(Sr,ft);ke.prototype.usingPlugin=function(s){return!!this[ls]&&this[ls][s]===!0};ke.prototype.hasPlugin=function(s){return!!Er(s)};function Uv(s,e){let t=!1;return function(...i){return t||ue.warn(s),t=!0,e.apply(this,i)}}function Bt(s,e,t,i){return Uv(`${e} is deprecated and will be removed in ${s}.0; please use ${t} instead.`,i)}var Bv={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 Fh=s=>s.indexOf("#")===0?s.slice(1):s;function B(s,e,t){let i=B.getPlayer(s);if(i)return e&&ue.warn(`Player "${s}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const n=typeof s=="string"?Ei("#"+Fh(s)):s;if(!Cs(n))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in n?n.getRootNode()instanceof k.ShadowRoot:!1)?n.getRootNode():n.ownerDocument.body;(!n.ownerDocument.defaultView||!a.contains(n))&&ue.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(n.parentNode&&n.parentNode.hasAttribute&&n.parentNode.hasAttribute("data-vjs-player")?n.parentNode:n).cloneNode(!0)),Si("beforesetup").forEach(h=>{const f=h(n,xe(e));if(!Zt(f)||Array.isArray(f)){ue.error("please return an object in beforesetup hooks");return}e=xe(e,f)});const l=H.getComponent("Player");return i=new l(n,e,t),Si("setup").forEach(h=>h(i)),i}B.hooks_=ni;B.hooks=Si;B.hook=gT;B.hookOnce=yT;B.removeHook=xd;if(k.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Es()){let s=Ei(".vjs-styles-defaults");if(!s){s=Wd("vjs-styles-defaults");const e=Ei("head");e&&e.insertBefore(s,e.firstChild),Gd(s,`
|
|
182
|
+
`),this.tech_}version(){return{"video.js":tl}}addTechControlsListeners_(){this.removeTechControlsListeners_(),this.on(this.tech_,"click",this.boundHandleTechClick_),this.on(this.tech_,"dblclick",this.boundHandleTechDoubleClick_),this.on(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.on(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.on(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.on(this.tech_,"tap",this.boundHandleTechTap_)}removeTechControlsListeners_(){this.off(this.tech_,"tap",this.boundHandleTechTap_),this.off(this.tech_,"touchstart",this.boundHandleTechTouchStart_),this.off(this.tech_,"touchmove",this.boundHandleTechTouchMove_),this.off(this.tech_,"touchend",this.boundHandleTechTouchEnd_),this.off(this.tech_,"click",this.boundHandleTechClick_),this.off(this.tech_,"dblclick",this.boundHandleTechDoubleClick_)}handleTechReady_(){this.triggerReady(),this.cache_.volume&&this.techCall_("setVolume",this.cache_.volume),this.handleTechPosterChange_(),this.handleTechDurationChange_()}handleTechLoadStart_(){this.removeClass("vjs-ended","vjs-seeking"),this.error(null),this.handleTechDurationChange_(),this.paused()?(this.hasStarted(!1),this.trigger("loadstart")):this.trigger("loadstart"),this.manualAutoplay_(this.autoplay()===!0&&this.options_.normalizeAutoplay?"play":this.autoplay())}manualAutoplay_(e){if(!this.tech_||typeof e!="string")return;const t=()=>{const s=this.muted();this.muted(!0);const n=()=>{this.muted(s)};this.playTerminatedQueue_.push(n);const a=this.play();if(Hs(a))return a.catch(l=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${l||""}`)})};let r;if(e==="any"&&!this.muted()?(r=this.play(),Hs(r)&&(r=r.catch(t))):e==="muted"&&!this.muted()?r=t():r=this.play(),!!Hs(r))return r.then(()=>{this.trigger({type:"autoplay-success",autoplay:e})}).catch(()=>{this.trigger({type:"autoplay-failure",autoplay:e})})}updateSourceCaches_(e=""){let t=e,r="";typeof t!="string"&&(t=e.src,r=e.type),this.cache_.source=this.cache_.source||{},this.cache_.sources=this.cache_.sources||[],t&&!r&&(r=g1(this,t)),this.cache_.source=Ae({},e,{src:t,type:r});const s=this.cache_.sources.filter(u=>u.src&&u.src===t),n=[],a=this.$$("source"),l=[];for(let u=0;u<a.length;u++){const f=Fi(a[u]);n.push(f),f.src&&f.src===t&&l.push(f.src)}l.length&&!s.length?this.cache_.sources=n:s.length||(this.cache_.sources=[this.cache_.source]),this.cache_.src=t}handleTechSourceset_(e){if(!this.changingSrc_){let t=n=>this.updateSourceCaches_(n);const r=this.currentSource().src,s=e.src;r&&!/^blob:/.test(r)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==r)&&(t=()=>{}),t(s),e.src||this.tech_.any(["sourceset","loadstart"],n=>{if(n.type==="sourceset")return;const a=this.techGet_("currentSrc");this.lastSource_.tech=a,this.updateSourceCaches_(a)})}this.lastSource_={player:this.currentSource().src,tech:e.src},this.trigger({src:e.src,type:"sourceset"})}hasStarted(e){if(e===void 0)return this.hasStarted_;e!==this.hasStarted_&&(this.hasStarted_=e,this.hasStarted_?this.addClass("vjs-has-started"):this.removeClass("vjs-has-started"))}handleTechPlay_(){this.removeClass("vjs-ended","vjs-paused"),this.addClass("vjs-playing"),this.hasStarted(!0),this.trigger("play")}handleTechRateChange_(){this.tech_.playbackRate()>0&&this.cache_.lastPlaybackRate===0&&(this.queuedCallbacks_.forEach(e=>e.callback(e.event)),this.queuedCallbacks_=[]),this.cache_.lastPlaybackRate=this.tech_.playbackRate(),this.trigger("ratechange")}handleTechWaiting_(){this.addClass("vjs-waiting"),this.trigger("waiting");const e=this.currentTime(),t=()=>{e!==this.currentTime()&&(this.removeClass("vjs-waiting"),this.off("timeupdate",t))};this.on("timeupdate",t)}handleTechCanPlay_(){this.removeClass("vjs-waiting"),this.trigger("canplay")}handleTechCanPlayThrough_(){this.removeClass("vjs-waiting"),this.trigger("canplaythrough")}handleTechPlaying_(){this.removeClass("vjs-waiting"),this.trigger("playing")}handleTechSeeking_(){this.addClass("vjs-seeking"),this.trigger("seeking")}handleTechSeeked_(){this.removeClass("vjs-seeking","vjs-ended"),this.trigger("seeked")}handleTechPause_(){this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.trigger("pause")}handleTechEnded_(){this.addClass("vjs-ended"),this.removeClass("vjs-waiting"),this.options_.loop?(this.currentTime(0),this.play()):this.paused()||this.pause(),this.trigger("ended")}handleTechDurationChange_(){this.duration(this.techGet_("duration"))}handleTechClick_(e){this.controls_&&(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.click===void 0||this.options_.userActions.click!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.click=="function"?this.options_.userActions.click.call(this,e):this.paused()?si(this.play()):this.pause())}handleTechDoubleClick_(e){if(!this.controls_)return;Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"),r=>r.contains(e.target))||(this.options_===void 0||this.options_.userActions===void 0||this.options_.userActions.doubleClick===void 0||this.options_.userActions.doubleClick!==!1)&&(this.options_!==void 0&&this.options_.userActions!==void 0&&typeof this.options_.userActions.doubleClick=="function"?this.options_.userActions.doubleClick.call(this,e):this.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 r=this.el();let s=X[this.fsApi_.fullscreenElement]===r;!s&&r.matches&&(s=r.matches(":"+this.fsApi_.fullscreen)),this.isFullscreen(s)}handleTechFullscreenChange_(e,t){t&&(t.nativeIOSFullscreen&&(this.addClass("vjs-ios-native-fs"),this.tech_.one("webkitendfullscreen",()=>{this.removeClass("vjs-ios-native-fs")})),this.isFullscreen(t.isFullscreen))}handleTechFullscreenError_(e,t){this.trigger("fullscreenerror",t)}togglePictureInPictureClass_(){this.isInPictureInPicture()?this.addClass("vjs-picture-in-picture"):this.removeClass("vjs-picture-in-picture")}handleTechEnterPictureInPicture_(e){this.isInPictureInPicture(!0)}handleTechLeavePictureInPicture_(e){this.isInPictureInPicture(!1)}handleTechError_(){const e=this.tech_.error();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 d1)return u1(this.middleware_,this.tech_,e,t);if(e in Dd)return wd(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(r){throw fe(r),r}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in c1)return l1(this.middleware_,this.tech_,e);if(e in Dd)return wd(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=si){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),r=!!(Va||st);if(this.waitToPlay_&&(this.off(["ready","loadstart"],this.waitToPlay_),this.waitToPlay_=null),!this.isReady_||!t){this.waitToPlay_=a=>{this.play_()},this.one(["ready","loadstart"],this.waitToPlay_),!t&&r&&this.load();return}const s=this.techGet_("play");r&&this.hasClass("vjs-ended")&&this.resetProgressBar_(),s===null?this.runPlayTerminatedQueue_():this.runPlayCallbacks_(s)}runPlayTerminatedQueue_(){const e=this.playTerminatedQueue_.slice(0);this.playTerminatedQueue_=[],e.forEach(function(t){t()})}runPlayCallbacks_(e){const t=this.playCallbacks_.slice(0);this.playCallbacks_=[],this.playTerminatedQueue_=[],t.forEach(function(r){r(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||Wt(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=Wt(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=Wt(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 Ap(this.buffered(),this.duration())}bufferedEnd(){const e=this.buffered(),t=this.duration();let r=e.end(e.length-1);return r>t&&(r=t),r}volume(e){let t;if(e!==void 0){t=Math.max(0,Math.min(1,e)),this.cache_.volume=t,this.techCall_("setVolume",t),t>0&&this.lastVolume_(t);return}return t=parseFloat(this.techGet_("volume")),isNaN(t)?1:t}muted(e){if(e!==void 0){this.techCall_("setMuted",e);return}return this.techGet_("muted")||!1}defaultMuted(e){return e!==void 0&&this.techCall_("setDefaultMuted",e),this.techGet_("defaultMuted")||!1}lastVolume_(e){if(e!==void 0&&e!==0){this.cache_.lastVolume=e;return}return this.cache_.lastVolume}supportsFullScreen(){return this.techGet_("supportsFullScreen")||!1}isFullscreen(e){if(e!==void 0){const t=this.isFullscreen_;this.isFullscreen_=!!e,this.isFullscreen_!==t&&this.fsApi_.prefixed&&this.trigger("fullscreenchange"),this.toggleFullscreenClass_();return}return this.isFullscreen_}requestFullscreen(e){this.isInPictureInPicture()&&this.exitPictureInPicture();const t=this;return new Promise((r,s)=>{function n(){t.off("fullscreenerror",l),t.off("fullscreenchange",a)}function a(){n(),r()}function l(f,p){n(),s(p)}t.one("fullscreenchange",a),t.one("fullscreenerror",l);const u=t.requestFullscreenHelper_(e);u&&(u.then(n,n),u.then(r,s))})}requestFullscreenHelper_(e){let t;if(this.fsApi_.prefixed||(t=this.options_.fullscreen&&this.options_.fullscreen.options||{},e!==void 0&&(t=e)),this.fsApi_.requestFullscreen){const r=this.el_[this.fsApi_.requestFullscreen](t);return r&&r.then(()=>this.isFullscreen(!0),()=>this.isFullscreen(!1)),r}else this.tech_.supportsFullScreen()&&!this.options_.preferFullWindow?this.techCall_("enterFullScreen"):this.enterFullWindow()}exitFullscreen(){const e=this;return new Promise((t,r)=>{function s(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){s(),t()}function a(u,f){s(),r(f)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const l=e.exitFullscreenHelper_();l&&(l.then(s,s),l.then(t,r))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=X[this.fsApi_.exitFullscreen]();return e&&si(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,It(X,"keydown",this.boundFullWindowOnEscKey_),X.documentElement.style.overflow="hidden",sr(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,nt(X,"keydown",this.boundFullWindowOnEscKey_),X.documentElement.style.overflow=this.docOrigOverflow,qa(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&&k.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(ne("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),k.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(fp(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",r=>{const s=r.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in X&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(k.documentPictureInPicture&&k.documentPictureInPicture.window)return k.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in X)return X.exitPictureInPicture()}handleKeyDown(e){const{userActions:t}=this.options_;!t||!t.hotkeys||(s=>{const n=s.tagName.toLowerCase();if(s.isContentEditable)return!0;const a=["button","checkbox","hidden","radio","reset","submit"];return n==="input"?a.indexOf(s.type)===-1:["textarea"].indexOf(n)!==-1})(this.el_.ownerDocument.activeElement)||(typeof t.hotkeys=="function"?t.hotkeys.call(this,e):this.handleHotkeys(e))}handleHotkeys(e){const t=this.options_.userActions?this.options_.userActions.hotkeys:{},{fullscreenKey:r=a=>e.key.toLowerCase()==="f",muteKey:s=a=>e.key.toLowerCase()==="m",playPauseKey:n=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(r.call(this,e)){e.preventDefault(),e.stopPropagation();const a=H.getComponent("FullscreenToggle");X[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),H.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),H.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let r=0,s=this.options_.techOrder;r<s.length;r++){const n=s[r];let a=ue.getTech(n);if(a||(a=H.getComponent(n)),!a){fe.error(`The "${n}" tech is undefined. Skipped browser support check for that tech.`);continue}if(a.isSupported()&&(t=a.canPlayType(e),t))return t}return""}selectSource(e){const t=this.options_.techOrder.map(l=>[l,ue.getTech(l)]).filter(([l,u])=>u?u.isSupported():(fe.error(`The "${l}" tech is undefined. Skipped browser support check for that tech.`),!1)),r=function(l,u,f){let p;return l.some(T=>u.some(b=>{if(p=f(T,b),p)return!0})),p};let s;const n=l=>(u,f)=>l(f,u),a=([l,u],f)=>{if(u.canPlaySource(f,this.options_[l.toLowerCase()]))return{source:f,tech:l}};return this.options_.sourceOrder?s=r(e,t,n(a)):s=r(t,e,a),s||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const r=Pp(e);if(!r.length){this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0);return}if(this.changingSrc_=!0,t||(this.cache_.sources=r),this.updateSourceCaches_(r[0]),a1(this,r[0],(s,n)=>{if(this.middleware_=n,t||(this.cache_.sources=r),this.updateSourceCaches_(s),this.src_(s)){if(r.length>1)return this.handleSrc_(r.slice(1));this.changingSrc_=!1,this.setTimeout(function(){this.error({code:4,message:this.options_.notSupportedMessage})},0),this.triggerReady();return}o1(n,this.tech_)}),r.length>1){const s=()=>{this.error(null),this.handleSrc_(r.slice(1),!0)},n=()=>{this.off("error",s)};this.one("error",s),this.one("playing",n),this.resetRetryOnError_=()=>{this.off("error",s),this.off("playing",n)}}}src(e){return this.handleSrc_(e,!1)}src_(e){const t=this.selectSource([e]);return t?xp(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();si(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}),vi(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:r,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:n}=r||{};e&&e.updateContent(),t&&t.updateContent(),s&&s.updateContent(),n&&(n.update(),n.loadProgressBar&&n.loadProgressBar.update())}resetPlaybackRate_(){this.playbackRate(this.defaultPlaybackRate()),this.handleTechRateChange_()}resetVolumeBar_(){this.volume(1),this.trigger("volumechange")}currentSources(){const e=this.currentSource(),t=[];return Object.keys(e).length!==0&&t.push(e),this.cache_.sources||t}currentSource(){return this.cache_.source||{}}currentSrc(){return this.currentSource()&&this.currentSource().src||""}currentType(){return this.currentSource()&&this.currentSource().type||""}preload(e){if(e!==void 0){this.techCall_("setPreload",e),this.options_.preload=e;return}return this.techGet_("preload")}autoplay(e){if(e===void 0)return this.options_.autoplay||!1;let t;typeof e=="string"&&/(any|play|muted)/.test(e)||e===!0&&this.options_.normalizeAutoplay?(this.options_.autoplay=e,this.manualAutoplay_(typeof e=="string"?e:"play"),t=!1):e?this.options_.autoplay=!0:this.options_.autoplay=!1,t=typeof t>"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(ji("beforeerror").forEach(t=>{const r=t(this,e);if(!(di(r)&&!Array.isArray(r)||typeof r=="string"||typeof r=="number"||r===null)){this.log.error("please return a value that MediaError expects in beforeerror hooks");return}e=r}),this.options_.suppressNotSupportedError&&e&&e.code===4){const t=function(){this.error(e)};this.options_.suppressNotSupportedError=!1,this.any(["click","touchstart"],t),this.one("loadstart",function(){this.off(["click","touchstart"],t)});return}if(e===null){this.error_=null,this.removeClass("vjs-error"),this.errorDisplay&&this.errorDisplay.close();return}this.error_=new 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"),ji("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,r;const s=Pe(this,this.reportUserActivity),n=function(T){(T.screenX!==t||T.screenY!==r)&&(t=T.screenX,r=T.screenY,s())},a=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},l=function(T){s(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",l),this.on("mouseleave",l);const u=this.getChild("controlBar");u&&!st&&!Gt&&(u.on("mouseenter",function(T){this.player().options_.inactivityTimeout!==0&&(this.player().cache_.inactivityTimeout=this.player().options_.inactivityTimeout),this.player().options_.inactivityTimeout=0}),u.on("mouseleave",function(T){this.player().options_.inactivityTimeout=this.player().cache_.inactivityTimeout})),this.on("keydown",s),this.on("keyup",s);let f;const p=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(f);const T=this.options_.inactivityTimeout;T<=0||(f=this.setTimeout(function(){this.userActivity_||this.userActive(!1)},T))};this.setInterval(p,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"),r=t&&t.currentHeight();e.forEach(s=>{s!==t&&s.el_&&!s.hasClass("vjs-hidden")&&(s.hide(),this.audioOnlyCache_.hiddenChildren.push(s))}),this.audioOnlyCache_.playerHeight=this.currentHeight(),this.audioOnlyCache_.controlBarHeight=r,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(r),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,r){if(this.tech_)return this.tech_.addTextTrack(e,t,r)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),vi(this)&&this.trigger("languagechange"))}languages(){return Ae(Oe.prototype.options_.languages,this.languages_)}toJSON(){const e=Ae(this.options_),t=e.tracks;e.tracks=[];for(let r=0;r<t.length;r++){let s=t[r];s=Ae(s),s.player=void 0,e.tracks[r]=s}return e}createModal(e,t){t=t||{},t.content=e||"";const r=new ts(this,t);return this.addChild(r),r.on("dispose",()=>{this.removeChild(r)}),r.open(),r}updateCurrentBreakpoint_(){if(!this.responsive())return;const e=this.currentBreakpoint(),t=this.currentWidth();for(let r=0;r<dl.length;r++){const s=dl[r],n=this.breakpoints_[s];if(t<=n){if(e===s)return;e&&this.removeClass(Yn[e]),this.addClass(Yn[s]),this.breakpoint_=s;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({},K1,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 Yn[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const r=this.crossOrigin();this.reset(),this.cache_.media=Ae(e);const{artist:s,artwork:n,description:a,poster:l,src:u,textTracks:f,title:p}=this.cache_.media;!n&&l&&(this.cache_.media.artwork=[{src:l,type:ma(l)}]),r&&this.crossOrigin(r),u&&this.src(u),l&&this.poster(l),Array.isArray(f)&&f.forEach(T=>this.addRemoteTextTrack(T,!1)),this.titleBar&&this.titleBar.update({title:p,description:a||s||""}),this.ready(t)}getMedia(){if(!this.cache_.media){const e=this.poster(),t=this.currentSources(),r=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),s={src:t,textTracks:r};return e&&(s.poster=e,s.artwork=[{src:s.poster,type:ma(s.poster)}]),s}return Ae(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},r=Fi(e),s=r["data-setup"];if(Vs(e,"vjs-fill")&&(r.fill=!0),Vs(e,"vjs-fluid")&&(r.fluid=!0),s!==null)try{Object.assign(r,JSON.parse(s||"{}"))}catch(n){fe.error("data-setup",n)}if(Object.assign(t,r),e.hasChildNodes()){const n=e.childNodes;for(let a=0,l=n.length;a<l;a++){const u=n[a],f=u.nodeName.toLowerCase();f==="source"?t.sources.push(Fi(u)):f==="track"&&t.tracks.push(Fi(u))}}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"))}}dt.names.forEach(function(i){const e=dt[i];Oe.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Oe.prototype.crossorigin=Oe.prototype.crossOrigin;Oe.players={};const Ps=k.navigator;Oe.prototype.options_={techOrder:ue.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language:Ps&&(Ps.languages&&Ps.languages[0]||Ps.userLanguage||Ps.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};om.forEach(function(i){Oe.prototype[`handleTech${He(i)}_`]=function(){return this.trigger(i)}});H.registerComponent("Player",Oe);const ga="plugin",Rr="activePlugins_",wr={},ya=i=>wr.hasOwnProperty(i),Qn=i=>ya(i)?wr[i]:void 0,lm=(i,e)=>{i[Rr]=i[Rr]||{},i[Rr][e]=!0},_a=(i,e,t)=>{const r=(t?"before":"")+"pluginsetup";i.trigger(r,e),i.trigger(r+":"+e.name,e)},X1=function(i,e){const t=function(){_a(this,{name:i,plugin:e,instance:null},!0);const r=e.apply(this,arguments);return lm(this,i),_a(this,{name:i,plugin:e,instance:r}),r};return Object.keys(e).forEach(function(r){t[r]=e[r]}),t},zd=(i,e)=>(e.prototype.name=i,function(...t){_a(this,{name:i,plugin:e,instance:null},!0);const r=new e(this,...t);return this[i]=()=>r,_a(this,r.getEventHash()),r});class vt{constructor(e){if(this.constructor===vt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),ru(this),delete this.trigger,bp(this,this.constructor.defaultState),lm(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 es(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[Rr][e]=!1,this.player=this.state=null,t[e]=zd(e,wr[e])}static isBasic(e){const t=typeof e=="string"?Qn(e):e;return typeof t=="function"&&!vt.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(ya(e))fe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Oe.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 wr[e]=t,e!==ga&&(vt.isBasic(t)?Oe.prototype[e]=X1(e,t):Oe.prototype[e]=zd(e,t)),t}static deregisterPlugin(e){if(e===ga)throw new Error("Cannot de-register base plugin.");ya(e)&&(delete wr[e],delete Oe.prototype[e])}static getPlugins(e=Object.keys(wr)){let t;return e.forEach(r=>{const s=Qn(r);s&&(t=t||{},t[r]=s)}),t}static getPluginVersion(e){const t=Qn(e);return t&&t.VERSION||""}}vt.getPlugin=Qn;vt.BASE_PLUGIN_NAME=ga;vt.registerPlugin(ga,vt);Oe.prototype.usingPlugin=function(i){return!!this[Rr]&&this[Rr][i]===!0};Oe.prototype.hasPlugin=function(i){return!!ya(i)};function Y1(i,e){let t=!1;return function(...r){return t||fe.warn(i),t=!0,e.apply(this,r)}}function Kt(i,e,t,r){return Y1(`${e} is deprecated and will be removed in ${i}.0; please use ${t} instead.`,r)}var Q1={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 um=i=>i.indexOf("#")===0?i.slice(1):i;function F(i,e,t){let r=F.getPlayer(i);if(r)return e&&fe.warn(`Player "${i}" is already initialised. Options will not be applied.`),t&&r.ready(t),r;const s=typeof i=="string"?Vi("#"+um(i)):i;if(!Zr(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in s?s.getRootNode()instanceof k.ShadowRoot:!1)?s.getRootNode():s.ownerDocument.body;(!s.ownerDocument.defaultView||!a.contains(s))&&fe.warn("The element supplied is not included in the DOM"),e=e||{},e.restoreEl===!0&&(e.restoreEl=(s.parentNode&&s.parentNode.hasAttribute&&s.parentNode.hasAttribute("data-vjs-player")?s.parentNode:s).cloneNode(!0)),ji("beforesetup").forEach(u=>{const f=u(s,Ae(e));if(!di(f)||Array.isArray(f)){fe.error("please return an object in beforesetup hooks");return}e=Ae(e,f)});const l=H.getComponent("Player");return r=new l(s,e,t),ji("setup").forEach(u=>u(r)),r}F.hooks_=yi;F.hooks=ji;F.hook=I2;F.hookOnce=k2;F.removeHook=Wf;if(k.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&Jr()){let i=Vi(".vjs-styles-defaults");if(!i){i=gp("vjs-styles-defaults");const e=Vi("head");e&&e.insertBefore(i,e.firstChild),yp(i,`
|
|
179
183
|
.video-js {
|
|
180
184
|
width: 300px;
|
|
181
185
|
height: 150px;
|
|
@@ -184,36 +188,36 @@ See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
|
184
188
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
185
189
|
padding-top: 56.25%
|
|
186
190
|
}
|
|
187
|
-
`)}}
|
|
188
|
-
`;for(let t=0;t<
|
|
189
|
-
`}return e}const Xt=1/30,Yt=Xt*3,Vh=function(s,e){const t=[];let i;if(s&&s.length)for(i=0;i<s.length;i++)e(s.start(i),s.end(i))&&t.push([s.start(i),s.end(i)]);return Ke(t)},ss=function(s,e){return Vh(s,function(t,i){return t-Yt<=e&&i+Yt>=e})},sr=function(s,e){return Vh(s,function(t){return t-Xt>=e})},Vv=function(s){if(s.length<2)return Ke();const e=[];for(let t=1;t<s.length;t++){const i=s.end(t-1),n=s.start(t);e.push([i,n])}return Ke(e)},Hv=function(s,e){let t=null,i=null,n=0;const r=[],a=[];if(!s||!s.length||!e||!e.length)return Ke();let l=s.length;for(;l--;)r.push({time:s.start(l),type:"start"}),r.push({time:s.end(l),type:"end"});for(l=e.length;l--;)r.push({time:e.start(l),type:"start"}),r.push({time:e.end(l),type:"end"});for(r.sort(function(h,f){return h.time-f.time}),l=0;l<r.length;l++)r[l].type==="start"?(n++,n===2&&(t=r[l].time)):r[l].type==="end"&&(n--,n===1&&(i=r[l].time)),t!==null&&i!==null&&(a.push([t,i]),t=null,i=null);return Ke(a)},Hh=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(", ")},qv=function(s,e,t=1){return((s.length?s.end(s.length-1):0)-e)/t},Ui=s=>{const e=[];for(let t=0;t<s.length;t++)e.push({start:s.start(t),end:s.end(t)});return e},zv=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},za=function(s){if(!(!s||!s.length||!s.end))return s.end(s.length-1)},ul=function(s,e){let t=0;if(!s||!s.length)return t;for(let i=0;i<s.length;i++){const n=s.start(i),r=s.end(i);if(!(e>r)){if(e>n&&e<=r){t+=r-e;continue}t+=r-n}}return t},cl=(s,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(i){t+=i.duration}),(e.preloadHints||[]).forEach(function(i){i.type==="PART"&&(t+=s.partTargetDuration)}),t},uo=s=>(s.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(n,r){e.push({duration:n.duration,segmentIndex:i,partIndex:r,part:n,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),qh=s=>{const e=s.segments&&s.segments.length&&s.segments[s.segments.length-1];return e&&e.parts||[]},zh=({preloadSegment:s})=>{if(!s)return;const{parts:e,preloadHints:t}=s;let i=(t||[]).reduce((n,r)=>n+(r.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},Wh=(s,e)=>{if(e.endList)return 0;if(s&&s.suggestedPresentationDelay)return s.suggestedPresentationDelay;const t=qh(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},Wv=function(s,e){let t=0,i=e-s.mediaSequence,n=s.segments[i];if(n){if(typeof n.start<"u")return{result:n.start,precise:!0};if(typeof n.end<"u")return{result:n.end-n.duration,precise:!0}}for(;i--;){if(n=s.segments[i],typeof n.end<"u")return{result:t+n.end,precise:!0};if(t+=cl(s,n),typeof n.start<"u")return{result:t+n.start,precise:!0}}return{result:t,precise:!1}},Gv=function(s,e){let t=0,i,n=e-s.mediaSequence;for(;n<s.segments.length;n++){if(i=s.segments[n],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=cl(s,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},Gh=function(s,e,t){if(typeof e>"u"&&(e=s.mediaSequence+s.segments.length),e<s.mediaSequence)return 0;const i=Wv(s,e);if(i.precise)return i.result;const n=Gv(s,e);return n.precise?n.result:i.result+t},Kh=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 k.Infinity}return Gh(s,e,t)},mn=function({defaultDuration:s,durationList:e,startIndex:t,endIndex:i}){let n=0;if(t>i&&([t,i]=[i,t]),t<0){for(let r=t;r<Math.min(0,i);r++)n+=s;t=0}for(let r=t;r<i;r++)n+=e[r].duration;return n},Xh=function(s,e,t,i){if(!s||!s.segments)return null;if(s.endList)return Kh(s);if(e===null)return null;e=e||0;let n=Gh(s,s.mediaSequence+s.segments.length,e);return t&&(i=typeof i=="number"?i:Wh(null,s),n-=i),Math.max(0,n)},Kv=function(s,e,t){const n=e||0;let r=Xh(s,e,!0,t);return r===null?Ke():(r<n&&(r=n),Ke(n,r))},Xv=function({playlist:s,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:n,exactManifestTimings:r}){let a=e-n;const l=uo(s);let h=0;for(let f=0;f<l.length;f++){const m=l[f];if(t===m.segmentIndex&&!(typeof i=="number"&&typeof m.partIndex=="number"&&i!==m.partIndex)){h=f;break}}if(a<0){if(h>0)for(let f=h-1;f>=0;f--){const m=l[f];if(a+=m.duration,r){if(a<0)continue}else if(a+Xt<=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:n-mn({defaultDuration:s.targetDuration,durationList:l,startIndex:h,endIndex:f})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e}}if(h<0){for(let f=h;f<0;f++)if(a-=s.targetDuration,a<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e};h=0}for(let f=h;f<l.length;f++){const m=l[f];a-=m.duration;const T=m.duration>Xt,E=a===0,C=T&&a+Xt>=0;if(!((E||C)&&f!==l.length-1)){if(r){if(a>0)continue}else if(a-Xt>=0)continue;return{partIndex:m.partIndex,segmentIndex:m.segmentIndex,startTime:n+mn({defaultDuration:s.targetDuration,durationList:l,startIndex:h,endIndex:f})}}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:e}},Yh=function(s){return s.excludeUntil&&s.excludeUntil>Date.now()},dl=function(s){return s.excludeUntil&&s.excludeUntil===1/0},na=function(s){const e=Yh(s);return!s.disabled&&!e},Yv=function(s){return s.disabled},Qv=function(s){for(let e=0;e<s.segments.length;e++)if(s.segments[e].key)return!0;return!1},Qh=function(s,e){return e.attributes&&e.attributes[s]},Jv=function(s,e,t,i=0){return Qh("BANDWIDTH",t)?(s*t.attributes.BANDWIDTH-i*8)/e:NaN},co=(s,e)=>{if(s.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return s.playlists.filter(i=>na(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},hl=(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),ac=function(s,e){const t=s&&s.mediaGroups&&s.mediaGroups.AUDIO||{};let i=!1;for(const n in t){for(const r in t[n])if(i=e(t[n][r]),i)break;if(i)break}return!!i},wn=s=>{if(!s||!s.playlists||!s.playlists.length)return ac(s,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<s.playlists.length;e++){const t=s.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(r=>od(r))||ac(s,r=>hl(t,r))))return!1}return!0};var ht={liveEdgeDelay:Wh,duration:Kh,seekable:Kv,getMediaInfoForTime:Xv,isEnabled:na,isDisabled:Yv,isExcluded:Yh,isIncompatible:dl,playlistEnd:Xh,isAes:Qv,hasAttribute:Qh,estimateSegmentRequestTime:Jv,isLowestEnabledRendition:co,isAudioOnly:wn,playlistMatch:hl,segmentDurationWithParts:cl};const{log:Jh}=B,us=(s,e)=>`${s}-${e}`,Zh=(s,e,t)=>`placeholder-uri-${s}-${e}-${t}`,Zv=({onwarn:s,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:n=[],llhls:r})=>{const a=new Hy;s&&a.on("warn",s),e&&a.on("info",e),i.forEach(f=>a.addParser(f)),n.forEach(f=>a.addTagMapper(f)),a.push(t),a.end();const l=a.manifest;if(r||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(f){l.hasOwnProperty(f)&&delete l[f]}),l.segments&&l.segments.forEach(function(f){["parts","preloadHints"].forEach(function(m){f.hasOwnProperty(m)&&delete f[m]})})),!l.targetDuration){let f=10;l.segments&&l.segments.length&&(f=l.segments.reduce((m,T)=>Math.max(m,T.duration),0)),s&&s({message:`manifest has no targetDuration defaulting to ${f}`}),l.targetDuration=f}const h=qh(l);if(h.length&&!l.partTargetDuration){const f=h.reduce((m,T)=>Math.max(m,T.duration),0);s&&(s({message:`manifest has no partTargetDuration defaulting to ${f}`}),Jh.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.")),l.partTargetDuration=f}return l},Ps=(s,e)=>{s.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(s.mediaGroups[t])for(const i in s.mediaGroups[t])for(const n in s.mediaGroups[t][i]){const r=s.mediaGroups[t][i][n];e(r,t,i,n)}})},ef=({playlist:s,uri:e,id:t})=>{s.id=t,s.playlistErrors_=0,e&&(s.uri=e),s.attributes=s.attributes||{}},eb=s=>{let e=s.playlists.length;for(;e--;){const t=s.playlists[e];ef({playlist:t,id:us(e,t.uri)}),t.resolvedUri=dt(s.uri,t.uri),s.playlists[t.id]=t,s.playlists[t.uri]=t,t.attributes.BANDWIDTH||Jh.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},tb=s=>{Ps(s,e=>{e.uri&&(e.resolvedUri=dt(s.uri,e.uri))})},ib=(s,e)=>{const t=us(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:k.location.href,resolvedUri:k.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},tf=(s,e,t=Zh)=>{s.uri=e;for(let n=0;n<s.playlists.length;n++)if(!s.playlists[n].uri){const r=`placeholder-uri-${n}`;s.playlists[n].uri=r}const i=wn(s);Ps(s,(n,r,a,l)=>{if(!n.playlists||!n.playlists.length){if(i&&r==="AUDIO"&&!n.uri)for(let h=0;h<s.playlists.length;h++){const f=s.playlists[h];if(f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===a)return}n.playlists=[je({},n)]}n.playlists.forEach(function(h,f){const m=t(r,a,l,h),T=us(f,m);h.uri?h.resolvedUri=h.resolvedUri||dt(s.uri,h.uri):(h.uri=f===0?m:T,h.resolvedUri=h.uri),h.id=h.id||T,h.attributes=h.attributes||{},s.playlists[h.id]=h,s.playlists[h.uri]=h})}),eb(s),tb(s)};class oc{constructor(){this.offset_=null,this.pendingDateRanges_=new Map,this.processedDateRanges_=new Map}setOffset(e=[]){if(this.offset_!==null||!e.length)return;const[t]=e;t.programDateTime!==void 0&&(this.offset_=t.programDateTime/1e3)}setPendingDateRanges(e=[]){if(!e.length)return;const[t]=e,i=t.startDate.getTime();this.trimProcessedDateRanges_(i),this.pendingDateRanges_=e.reduce((n,r)=>(n.set(r.id,r),n),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((i,n)=>{if(!this.processedDateRanges_.has(n)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const r=e[i.class].push(i);i.classListIndex=r-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const n=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&n[i.classListIndex+1]?i.endTime=n[i.classListIndex+1].startTime:i.duration?i.endTime=i.startTime+i.duration:i.plannedDuration?i.endTime=i.startTime+i.plannedDuration:i.endTime=i.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((i,n)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(n)})}}const sf=22,Vi=({requestType:s,request:e,error:t,parseFailure:i})=>{const n=e.status<200||e.status>299,r=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:s},l=n&&!r||i;if(t&&r)a.error=je({},t),a.errorType=B.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=B.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=B.Error.NetworkRequestTimeout;else if(l){const h=i?B.Error.NetworkBodyParserFailed:B.Error.NetworkBadStatus;a.errorType=h,a.status=e.status,a.headers=e.headers}return a},{EventTarget:sb}=B,nb=(s,e)=>{if(e.endList||!e.serverControl)return s;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let n=e.mediaSequence+e.segments.length;if(i){const r=i.parts||[],a=zh(e)-1;a>-1&&a!==r.length-1&&(t._HLS_part=a),(a>-1||r.length)&&n--}t._HLS_msn=n}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const i=new k.URL(s);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(n){t.hasOwnProperty(n)&&i.searchParams.set(n,t[n])}),s=i.toString()}return s},rb=(s,e)=>{if(!s)return e;const t=ge(s,e);if(s.preloadHints&&!e.preloadHints&&delete t.preloadHints,s.parts&&!e.parts)delete t.parts;else if(s.parts&&e.parts)for(let i=0;i<e.parts.length;i++)s.parts&&s.parts[i]&&(t.parts[i]=ge(s.parts[i],e.parts[i]));return!s.skipped&&e.skipped&&(t.skipped=!1),s.preload&&!e.preload&&(t.preload=!1),t},ab=(s,e,t)=>{const i=s.slice(),n=e.slice();t=t||0;const r=[];let a;for(let l=0;l<n.length;l++){const h=i[l+t],f=n[l];h?(a=h.map||a,r.push(rb(h,f))):(a&&!f.map&&(f.map=a),r.push(f))}return r},nf=(s,e)=>{!s.resolvedUri&&s.uri&&(s.resolvedUri=dt(e,s.uri)),s.key&&!s.key.resolvedUri&&(s.key.resolvedUri=dt(e,s.key.uri)),s.map&&!s.map.resolvedUri&&(s.map.resolvedUri=dt(e,s.map.uri)),s.map&&s.map.key&&!s.map.key.resolvedUri&&(s.map.key.resolvedUri=dt(e,s.map.key.uri)),s.parts&&s.parts.length&&s.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=dt(e,t.uri))}),s.preloadHints&&s.preloadHints.length&&s.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=dt(e,t.uri))})},rf=function(s){const e=s.segments||[],t=s.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let i=0;i<t.preloadHints.length;i++)if(t.preloadHints[i].type==="MAP")return e}t.duration=s.targetDuration,t.preload=!0,e.push(t)}return e},af=(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,ho=(s,e,t=af)=>{const i=ge(s,{}),n=i.playlists[e.id];if(!n||t(n,e))return null;e.segments=rf(e);const r=ge(n,e);if(r.preloadSegment&&!e.preloadSegment&&delete r.preloadSegment,n.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}r.segments=ab(n.segments,e.segments,e.mediaSequence-n.mediaSequence)}r.segments.forEach(a=>{nf(a,r.resolvedUri)});for(let a=0;a<i.playlists.length;a++)i.playlists[a].id===e.id&&(i.playlists[a]=r);return i.playlists[e.id]=r,i.playlists[e.uri]=r,Ps(s,(a,l,h,f)=>{if(a.playlists)for(let m=0;m<a.playlists.length;m++)e.id===a.playlists[m].id&&(a.playlists[m]=r)}),i},fo=(s,e)=>{const t=s.segments||[],i=t[t.length-1],n=i&&i.parts&&i.parts[i.parts.length-1],r=n&&n.duration||i&&i.duration;return e&&r?r*1e3:(s.partTargetDuration||s.targetDuration||10)*500},lc=(s,e,t)=>{if(!s)return;const i=[];return s.forEach(n=>{if(!n.attributes)return;const{BANDWIDTH:r,RESOLUTION:a,CODECS:l}=n.attributes;i.push({id:n.id,bandwidth:r,resolution:a,codecs:l})}),{type:e,isLive:t,renditions:i}};class ns extends sb{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Pt("PlaylistLoader");const{withCredentials:n=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=n,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const r=t.options_;this.customTagParsers=r&&r.customTagParsers||[],this.customTagMappers=r&&r.customTagMappers||[],this.llhls=r&&r.llhls,this.dateRangesStorage_=new oc,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=dt(this.main.uri,e.uri);this.llhls&&(t=nb(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,n)=>{if(this.request){if(i)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,i){const{uri:n,id:r}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[r],status:e.status,message:`HLS playlist request error at URL: ${n}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:Vi({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return Zv({onwarn:({message:i})=>this.logger_(`m3u8-parser warn for ${e}: ${i}`),oninfo:({message:i})=>this.logger_(`m3u8-parser info for ${e}: ${i}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(i){this.error=i,this.error.metadata={errorType:B.Error.StreamingHlsPlaylistParserError,error:i}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:n}){this.request=null,this.state="HAVE_METADATA";const r={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:r});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),ef({playlist:a,uri:i,id:n});const l=ho(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[n]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(fo(this.media(),!!l)),r.parsedPlaylist=lc(this.main.playlists,r.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:r}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),k.clearTimeout(this.mediaUpdateTimeout),k.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new oc,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(k.clearTimeout(this.finalRenditionTimeout),t){const l=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=k.setTimeout(this.media.bind(this,e,!1),l);return}const i=this.state,n=!this.media_||e.id!==this.media_.id,r=this.main.playlists[e.id];if(r&&r.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,n&&(this.trigger("mediachanging"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(fo(e,!0)),!n)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"},(l,h)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Ir(e.resolvedUri,h),l)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:h.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(k.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&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},i);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=k.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=k.location.href),this.src.resolvedUri=this.src.uri,setTimeout(()=>{this.setupInitialPlaylist(this.src)},0);return}const e={playlistInfo:{type:"multivariant",uri:this.src}};this.trigger({type:"playlistrequeststart",metadata:e}),this.request=this.vhs_.xhr({uri:this.src,withCredentials:this.withCredentials,requestType:"hls-playlist"},(t,i)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:i.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:i.responseText,code:2,metadata:Vi({requestType:i.requestType,request:i,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=Ir(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const n=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=lc(n.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(n)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,tf(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=rf(i),i.segments.forEach(n=>{nf(n,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||k.location.href;this.main=ib(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,n=e.ID;let r=i.playlists.length;for(;r--;){const a=i.playlists[r];if(a.attributes["PATHWAY-ID"]===n){const l=a.resolvedUri,h=a.id;if(t){const f=this.createCloneURI_(a.resolvedUri,e),m=us(n,f),T=this.createCloneAttributes_(n,a.attributes),E=this.createClonePlaylist_(a,m,e,T);i.playlists[r]=E,i.playlists[m]=E,i.playlists[f]=E}else i.playlists.splice(r,1);delete i.playlists[h],delete i.playlists[l]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,n=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!i.mediaGroups[r]||!i.mediaGroups[r][n])){for(const a in i.mediaGroups[r])if(a===n){for(const l in i.mediaGroups[r][a])i.mediaGroups[r][a][l].playlists.forEach((f,m)=>{const T=i.playlists[f.id],E=T.id,C=T.resolvedUri;delete i.playlists[E],delete i.playlists[C]});delete i.mediaGroups[r][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,n=i.playlists.length,r=this.createCloneURI_(t.resolvedUri,e),a=us(e.ID,r),l=this.createCloneAttributes_(e.ID,t.attributes),h=this.createClonePlaylist_(t,a,e,l);i.playlists[n]=h,i.playlists[a]=h,i.playlists[r]=h,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=e["BASE-ID"],n=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(r=>{if(!(!n.mediaGroups[r]||n.mediaGroups[r][t]))for(const a in n.mediaGroups[r]){if(a===i)n.mediaGroups[r][t]={};else continue;for(const l in n.mediaGroups[r][a]){const h=n.mediaGroups[r][a][l];n.mediaGroups[r][t][l]=je({},h);const f=n.mediaGroups[r][t][l],m=this.createCloneURI_(h.resolvedUri,e);f.resolvedUri=m,f.uri=m,f.playlists=[],h.playlists.forEach((T,E)=>{const C=n.playlists[T.id],P=Zh(r,t,l),v=us(t,P);if(C&&!n.playlists[v]){const R=this.createClonePlaylist_(C,v,e),L=R.resolvedUri;n.playlists[v]=R,n.playlists[L]=R}f.playlists[E]=this.createClonePlaylist_(T,v,e)})}}})}createClonePlaylist_(e,t,i,n){const r=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:r,uri:r,id:t};return e.segments&&(a.segments=[]),n&&(a.attributes=n),ge(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const n=t["URI-REPLACEMENT"].PARAMS;for(const r of Object.keys(n))i.searchParams.set(r,n[r]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{t[n]&&(i[n]=e)}),i}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const n=e.contentProtection[i].attributes.keyId;n&&t.add(n.toLowerCase())}return t}}}const po=function(s,e,t,i){const n=s.responseType==="arraybuffer"?s.response:s.responseText;!e&&n&&(s.responseTime=Date.now(),s.roundTripTime=s.responseTime-s.requestTime,s.bytesReceived=n.byteLength||n.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&&(n||s.responseText)))),i(e,s)},ob=(s,e)=>{if(!s||!s.size)return;let t=e;return s.forEach(i=>{t=i(t)}),t},lb=(s,e,t,i)=>{!s||!s.size||s.forEach(n=>{n(e,t,i)})},of=function(){const s=function e(t,i){t=ge({timeout:45e3},t);const n=e.beforeRequest||B.Vhs.xhr.beforeRequest,r=e._requestCallbackSet||B.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||B.Vhs.xhr._responseCallbackSet;n&&typeof n=="function"&&(B.log.warn("beforeRequest is deprecated, use onRequest instead."),r.add(n));const l=B.Vhs.xhr.original===!0?B.xhr:B.Vhs.xhr,h=ob(r,t);r.delete(n);const f=l(h||t,function(T,E){return lb(a,f,T,E),po(f,T,E,i)}),m=f.abort;return f.abort=function(){return f.aborted=!0,m.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return s.original=!0,s},ub=function(s){let e;const t=s.offset;return typeof s.offset=="bigint"||typeof s.length=="bigint"?e=k.BigInt(s.offset)+k.BigInt(s.length)-k.BigInt(1):e=s.offset+s.length-1,"bytes="+t+"-"+e},mo=function(s){const e={};return s.byterange&&(e.Range=ub(s.byterange)),e},cb=function(s,e){return s.start(e)+"-"+s.end(e)},db=function(s,e){const t=s.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},hb=function(s){return s>=32&&s<126?String.fromCharCode(s):"."},lf=function(s){const e={};return Object.keys(s).forEach(t=>{const i=s[t];ud(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Ar=function(s){const e=s.byterange||{length:1/0,offset:0};return[e.length,e.offset,s.resolvedUri].join(",")},uf=function(s){return s.resolvedUri},cf=s=>{const e=Array.prototype.slice.call(s),t=16;let i="",n,r;for(let a=0;a<e.length/t;a++)n=e.slice(a*t,a*t+t).map(db).join(""),r=e.slice(a*t,a*t+t).map(hb).join(""),i+=n+" "+r+`
|
|
190
|
-
`;return i},fb=({bytes:s})=>cf(s),pb=s=>{let e="",t;for(t=0;t<s.length;t++)e+=cb(s,t)+" ";return e};var mb=Object.freeze({__proto__:null,createTransferableMessage:lf,initSegmentId:Ar,segmentKeyId:uf,hexDump:cf,tagDump:fb,textRanges:pb});const df=.25,gb=(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)},yb=s=>s.transmuxedPresentationEnd-s.transmuxedPresentationStart-s.transmuxerPrependedSeconds,_b=(s,e)=>{let t;try{t=new Date(s)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let i=e.segments[0];if(t<new Date(i.dateTimeObject))return null;for(let h=0;h<e.segments.length-1;h++){i=e.segments[h];const f=new Date(e.segments[h+1].dateTimeObject);if(t<f)break}const n=e.segments[e.segments.length-1],r=n.dateTimeObject,a=n.videoTimingInfo?yb(n.videoTimingInfo):n.duration+n.duration*df,l=new Date(r.getTime()+a*1e3);return t>l?null:(t>new Date(r)&&(i=n),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:ht.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Tb=(s,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let r=0;r<e.segments.length&&(i=e.segments[r],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(s<=t));r++);const n=e.segments[e.segments.length-1];if(n.videoTimingInfo&&n.videoTimingInfo.transmuxedPresentationEnd<s)return null;if(s>t){if(s>t+n.duration*df)return null;i=n}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},vb=(s,e)=>{let t,i;try{t=new Date(s),i=new Date(e)}catch{}const n=t.getTime();return(i.getTime()-n)/1e3},bb=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},xb=({playlist:s,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!s||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=Tb(e,s);if(!i)return t({message:"valid programTime was not found"});if(i.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:i.estimatedStart});const n={mediaSeconds:e},r=gb(e,i.segment);return r&&(n.programDateTime=r.toISOString()),t(null,n)},hf=({programTime:s,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:n=!0,tech:r,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof s>"u"||!e||!i)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!r.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!bb(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=_b(s,e);if(!l)return a({message:`${s} was not found in the stream`});const h=l.segment,f=vb(h.dateTimeObject,s);if(l.type==="estimate"){if(t===0)return a({message:`${s} is not buffered yet. Try again`});i(l.estimatedStart+f),r.one("seeked",()=>{hf({programTime:s,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:n,tech:r,callback:a})});return}const m=h.start+f,T=()=>a(null,r.currentTime());r.one("seeked",T),n&&r.pause(),i(m)},Wa=(s,e)=>{if(s.readyState===4)return e()},Sb=(s,e,t,i)=>{let n=[],r,a=!1;const l=function(T,E,C,P){return E.abort(),a=!0,t(T,E,C,P)},h=function(T,E){if(a)return;if(T)return T.metadata=Vi({requestType:i,request:E,error:T}),l(T,E,"",n);const C=E.responseText.substring(n&&n.byteLength||0,E.responseText.length);if(n=t_(n,cd(C,!0)),r=r||on(n),n.length<10||r&&n.length<r+2)return Wa(E,()=>l(T,E,"",n));const P=Oo(n);return P==="ts"&&n.length<188?Wa(E,()=>l(T,E,"",n)):!P&&n.length<376?Wa(E,()=>l(T,E,"",n)):l(null,E,P,n)},m=e({uri:s,beforeSend(T){T.overrideMimeType("text/plain; charset=x-user-defined"),T.addEventListener("progress",function({total:E,loaded:C}){return po(T,null,{statusCode:T.status},h)})}},function(T,E){return po(m,T,E,h)});return m},{EventTarget:Eb}=B,uc=function(s,e){if(!af(s,e)||s.sidx&&e.sidx&&(s.sidx.offset!==e.sidx.offset||s.sidx.length!==e.sidx.length))return!1;if(!s.sidx&&e.sidx||s.sidx&&!e.sidx||s.segments&&!e.segments||!s.segments&&e.segments)return!1;if(!s.segments&&!e.segments)return!0;for(let t=0;t<s.segments.length;t++){const i=s.segments[t],n=e.segments[t];if(i.uri!==n.uri)return!1;if(!i.byterange&&!n.byterange)continue;const r=i.byterange,a=n.byterange;if(r&&!a||!r&&a||r.offset!==a.offset||r.length!==a.length)return!1}return!0},Cb=(s,e,t,i)=>{const n=i.attributes.NAME||t;return`placeholder-uri-${s}-${e}-${n}`},wb=({mainXml:s,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:n})=>{const r=K_(s,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:n});return tf(r,e,Cb),r},Ib=(s,e)=>{Ps(s,(t,i,n,r)=>{(!e.mediaGroups[i][n]||!(r in e.mediaGroups[i][n]))&&delete s.mediaGroups[i][n][r]})},Ab=(s,e,t)=>{let i=!0,n=ge(s,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let r=0;r<e.playlists.length;r++){const a=e.playlists[r];if(a.sidx){const h=Fr(a.sidx);t&&t[h]&&t[h].sidx&&Po(a,t[h].sidx,a.sidx.resolvedUri)}const l=ho(n,a,uc);l&&(n=l,i=!1)}return Ps(e,(r,a,l,h)=>{if(r.playlists&&r.playlists.length){const f=r.playlists[0].id,m=ho(n,r.playlists[0],uc);m&&(n=m,h in n.mediaGroups[a][l]||(n.mediaGroups[a][l][h]=r),n.mediaGroups[a][l][h].playlists[0]=n.playlists[f],i=!1)}}),Ib(n,e),e.minimumUpdatePeriod!==s.minimumUpdatePeriod&&(i=!1),i?null:n},kb=(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,cc=(s,e)=>{const t={};for(const i in s){const r=s[i].sidx;if(r){const a=Fr(r);if(!e[a])break;const l=e[a].sidxInfo;kb(l,r)&&(t[a]=e[a])}}return t},Pb=(s,e)=>{let i=cc(s.playlists,e);return Ps(s,(n,r,a,l)=>{if(n.playlists&&n.playlists.length){const h=n.playlists;i=ge(i,cc(h,e))}}),i};class go extends Eb{constructor(e,t,i={},n){super(),this.isPaused_=!0,this.mainPlaylistLoader_=n||this,n||(this.isMain_=!0);const{withCredentials:r=!1}=i;if(this.vhs_=t,this.withCredentials=r,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Pt("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,i){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},i&&(this.state=i),this.trigger("error"),!0}addSidxSegments_(e,t,i){const n=e.sidx&&Fr(e.sidx);if(!e.sidx||!n||this.mainPlaylistLoader_.sidxMapping_[n]){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=k.setTimeout(()=>i(!1),0);return}const r=Ir(e.sidx.resolvedUri),a=(h,f)=>{if(this.requestErrored_(h,f,t))return;const m=this.mainPlaylistLoader_.sidxMapping_,{requestType:T}=f;let E;try{E=eT(ie(f.response).subarray(8))}catch(C){C.metadata=Vi({requestType:T,request:f,parseFailure:!0}),this.requestErrored_(C,f,t);return}return m[n]={sidxInfo:e.sidx,sidx:E},Po(e,E,e.sidx.resolvedUri),i(!0)},l="dash-sidx";this.request=Sb(r,this.vhs_.xhr,(h,f,m,T)=>{if(h)return a(h,f);if(!m||m!=="mp4"){const P=m||"unknown";return a({status:f.status,message:`Unsupported ${P} container type for sidx segment at URL: ${r}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:E,length:C}=e.sidx.byterange;if(T.length>=C+E)return a(h,{response:T.subarray(E,E+C),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:r,responseType:"arraybuffer",requestType:"dash-sidx",headers:mo({byterange:e.sidx.byterange})},a)},l)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},k.clearTimeout(this.minimumUpdatePeriodTimeout_),k.clearTimeout(this.mediaRequest_),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const i=!this.media_||e.id!==this.media_.id;if(i&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,i&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}i&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,n=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,k.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(),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(k.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>this.load(),i);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=k.setTimeout(()=>this.haveMain_(),0);return}this.requestMain_((e,t)=>{this.haveMain_(),!this.hasPendingRequest()&&!this.media_&&this.media(this.mainPlaylistLoader_.main.playlists[0])})}requestMain_(e){const t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestrequeststart",metadata:t}),this.request=this.vhs_.xhr({uri:this.mainPlaylistLoader_.srcUrl,withCredentials:this.withCredentials,requestType:"dash-manifest"},(i,n)=>{if(i){const{requestType:a}=n;i.metadata=Vi({requestType:a,request:n,error:i})}if(this.requestErrored_(i,n)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const r=n.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=n.responseText,n.responseHeaders&&n.responseHeaders.date?this.mainLoaded_=Date.parse(n.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=Ir(this.mainPlaylistLoader_.srcUrl,n),r){this.handleMain_(),this.syncClientServerClock_(()=>e(n,r));return}return e(n,r)})}syncClientServerClock_(e){const t=X_(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:dt(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,n)=>{if(!this.request)return;if(i){const{requestType:a}=n;return this.error.metadata=Vi({requestType:a,request:n,error:i}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let r;t.method==="HEAD"?!n.responseHeaders||!n.responseHeaders.date?r=this.mainLoaded_:r=Date.parse(n.responseHeaders.date):r=Date.parse(n.responseText),this.mainPlaylistLoader_.clientOffset_=r-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let i;try{i=wb({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(r){this.error=r,this.error.metadata={errorType:B.Error.StreamingDashManifestParserError,error:r},this.trigger("error")}e&&(i=Ab(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const n=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(n&&n!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=n),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:r,endList:a}=i,l=[];i.playlists.forEach(f=>{l.push({id:f.id,bandwidth:f.attributes.BANDWIDTH,resolution:f.attributes.RESOLUTION,codecs:f.attributes.CODECS})});const h={duration:r,isLive:!a,renditions:l};t.parsedManifest=h,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!i}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(k.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_=k.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_=Pb(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,i=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,i=!this.media_||this.media_!==t[e];if(i?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const n=()=>{this.media().endList||(this.mediaUpdateTimeout=k.setTimeout(()=>{this.trigger("mediaupdatetimeout"),n()},fo(this.media(),!!i)))};n()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(i=>({cueTime:i.start,frames:[{data:i.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const n=e.contentProtection[i].attributes["cenc:default_KID"];n&&t.add(n.replace(/-/g,"").toLowerCase())}return t}}}var We={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 Db=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},ff=function(s){return s.on=s.addEventListener,s.off=s.removeEventListener,s},Lb=function(s){try{return URL.createObjectURL(new Blob([s],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(s),URL.createObjectURL(t.getBlob())}},pf=function(s){return function(){const e=Lb(s),t=ff(new Worker(e));t.objURL=e;const i=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),i.call(this)},t}},mf=function(s){return`var browserWorkerPolyFill = ${ff.toString()};
|
|
191
|
+
`)}}nl(1,F);F.VERSION=tl;F.options=Oe.prototype.options_;F.getPlayers=()=>Oe.players;F.getPlayer=i=>{const e=Oe.players;let t;if(typeof i=="string"){const r=um(i),s=e[r];if(s)return s;t=Vi("#"+r)}else t=i;if(Zr(t)){const{player:r,playerId:s}=t;if(r||e[s])return r||e[s]}};F.getAllPlayers=()=>Object.keys(Oe.players).map(i=>Oe.players[i]).filter(Boolean);F.players=Oe.players;F.getComponent=H.getComponent;F.registerComponent=(i,e)=>(ue.isTech(e)&&fe.warn(`The ${i} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),H.registerComponent.call(H,i,e));F.getTech=ue.getTech;F.registerTech=ue.registerTech;F.use=n1;Object.defineProperty(F,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(F.middleware,"TERMINATOR",{value:pa,writeable:!1,enumerable:!0});F.browser=tp;F.obj=R2;F.mergeOptions=Kt(9,"videojs.mergeOptions","videojs.obj.merge",Ae);F.defineLazyProperty=Kt(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Ua);F.bind=Kt(9,"videojs.bind","native Function.prototype.bind",Pe);F.registerPlugin=vt.registerPlugin;F.deregisterPlugin=vt.deregisterPlugin;F.plugin=(i,e)=>(fe.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),vt.registerPlugin(i,e));F.getPlugins=vt.getPlugins;F.getPlugin=vt.getPlugin;F.getPluginVersion=vt.getPluginVersion;F.addLanguage=function(i,e){return i=(""+i).toLowerCase(),F.options.languages=Ae(F.options.languages,{[i]:e}),F.options.languages[i]};F.log=fe;F.createLogger=Gf;F.time=K2;F.createTimeRange=Kt(9,"videojs.createTimeRange","videojs.time.createTimeRanges",Wt);F.createTimeRanges=Kt(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",Wt);F.formatTime=Kt(9,"videojs.formatTime","videojs.time.formatTime",ur);F.setFormatTime=Kt(9,"videojs.setFormatTime","videojs.time.setFormatTime",Ep);F.resetFormatTime=Kt(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Cp);F.parseUrl=Kt(9,"videojs.parseUrl","videojs.url.parseUrl",au);F.isCrossOrigin=Kt(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",Ya);F.EventTarget=kt;F.any=iu;F.on=It;F.one=Ka;F.off=nt;F.trigger=es;F.xhr=Wh;F.TextTrack=ln;F.AudioTrack=Ip;F.VideoTrack=kp;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(i=>{F[i]=function(){return fe.warn(`videojs.${i}() is deprecated; use videojs.dom.${i}() instead`),pp[i].apply(null,arguments)}});F.computedStyle=Kt(9,"videojs.computedStyle","videojs.dom.computedStyle",Kr);F.dom=pp;F.fn=V2;F.num=A1;F.str=W2;F.url=r1;F.Error=Q1;/*! @name videojs-contrib-quality-levels @version 4.1.0 @license Apache-2.0 */class J1{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(r){t.enabled_(r)}}),t}}class Ta extends F.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const r=this.levels_.length;return t=new J1(e),""+r in this||Object.defineProperty(this,r,{get(){return this.levels_[r]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let r=0,s=this.length;r<s;r++)if(this[r]===e){t=this.levels_.splice(r,1)[0],this.selectedIndex_===r?this.selectedIndex_=-1:this.selectedIndex_>r&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,r=this.length;t<r;t++){const s=this[t];if(s.id===e)return s}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Ta.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const i in Ta.prototype.allowedEvents_)Ta.prototype["on"+i]=null;var cm="4.1.0";const Z1=function(i,e){const t=i.qualityLevels,r=new Ta,s=function(){r.dispose(),i.qualityLevels=t,i.off("dispose",s)};return i.on("dispose",s),i.qualityLevels=()=>r,i.qualityLevels.VERSION=cm,r},dm=function(i){return Z1(this,F.obj.merge({},i))};F.registerPlugin("qualityLevels",dm);dm.VERSION=cm;/*! @name @videojs/http-streaming @version 3.16.2 @license Apache-2.0 */const _t=ka,va=(i,e)=>e&&e.responseURL&&i!==e.responseURL?e.responseURL:i,$t=i=>F.log.debug?F.log.debug.bind(F,"VHS:",`${i} >`):function(){};function Te(...i){const e=F.obj||F;return(e.merge||e.mergeOptions).apply(e,i)}function et(...i){const e=F.time||F;return(e.createTimeRanges||e.createTimeRanges).apply(e,i)}function ex(i){if(i.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
192
|
+
`;for(let t=0;t<i.length;t++){const r=i.start(t),s=i.end(t);e+=`${r} --> ${s}. Duration (${s-r})
|
|
193
|
+
`}return e}const ni=1/30,ai=ni*3,hm=function(i,e){const t=[];let r;if(i&&i.length)for(r=0;r<i.length;r++)e(i.start(r),i.end(r))&&t.push([i.start(r),i.end(r)]);return et(t)},Dr=function(i,e){return hm(i,function(t,r){return t-ai<=e&&r+ai>=e})},zn=function(i,e){return hm(i,function(t){return t-ni>=e})},tx=function(i){if(i.length<2)return et();const e=[];for(let t=1;t<i.length;t++){const r=i.end(t-1),s=i.start(t);e.push([r,s])}return et(e)},ix=function(i,e){let t=null,r=null,s=0;const n=[],a=[];if(!i||!i.length||!e||!e.length)return et();let l=i.length;for(;l--;)n.push({time:i.start(l),type:"start"}),n.push({time:i.end(l),type:"end"});for(l=e.length;l--;)n.push({time:e.start(l),type:"start"}),n.push({time:e.end(l),type:"end"});for(n.sort(function(u,f){return u.time-f.time}),l=0;l<n.length;l++)n[l].type==="start"?(s++,s===2&&(t=n[l].time)):n[l].type==="end"&&(s--,s===1&&(r=n[l].time)),t!==null&&r!==null&&(a.push([t,r]),t=null,r=null);return et(a)},fm=i=>{const e=[];if(!i||!i.length)return"";for(let t=0;t<i.length;t++)e.push(i.start(t)+" => "+i.end(t));return e.join(", ")},rx=function(i,e,t=1){return((i.length?i.end(i.length-1):0)-e)/t},ir=i=>{const e=[];for(let t=0;t<i.length;t++)e.push({start:i.start(t),end:i.end(t)});return e},sx=function(i,e){if(i===e)return!1;if(!i&&e||!e&&i||i.length!==e.length)return!0;for(let t=0;t<i.length;t++)if(i.start(t)!==e.start(t)||i.end(t)!==e.end(t))return!0;return!1},qo=function(i){if(!(!i||!i.length||!i.end))return i.end(i.length-1)},Su=function(i,e){let t=0;if(!i||!i.length)return t;for(let r=0;r<i.length;r++){const s=i.start(r),n=i.end(r);if(!(e>n)){if(e>s&&e<=n){t+=n-e;continue}t+=n-s}}return t},Eu=(i,e)=>{if(!e.preload)return e.duration;let t=0;return(e.parts||[]).forEach(function(r){t+=r.duration}),(e.preloadHints||[]).forEach(function(r){r.type==="PART"&&(t+=i.partTargetDuration)}),t},hl=i=>(i.segments||[]).reduce((e,t,r)=>(t.parts?t.parts.forEach(function(s,n){e.push({duration:s.duration,segmentIndex:r,partIndex:n,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:r,partIndex:null,segment:t,part:null}),e),[]),pm=i=>{const e=i.segments&&i.segments.length&&i.segments[i.segments.length-1];return e&&e.parts||[]},mm=({preloadSegment:i})=>{if(!i)return;const{parts:e,preloadHints:t}=i;let r=(t||[]).reduce((s,n)=>s+(n.type==="PART"?1:0),0);return r+=e&&e.length?e.length:0,r},gm=(i,e)=>{if(e.endList)return 0;if(i&&i.suggestedPresentationDelay)return i.suggestedPresentationDelay;const t=pm(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},nx=function(i,e){let t=0,r=e-i.mediaSequence,s=i.segments[r];if(s){if(typeof s.start<"u")return{result:s.start,precise:!0};if(typeof s.end<"u")return{result:s.end-s.duration,precise:!0}}for(;r--;){if(s=i.segments[r],typeof s.end<"u")return{result:t+s.end,precise:!0};if(t+=Eu(i,s),typeof s.start<"u")return{result:t+s.start,precise:!0}}return{result:t,precise:!1}},ax=function(i,e){let t=0,r,s=e-i.mediaSequence;for(;s<i.segments.length;s++){if(r=i.segments[s],typeof r.start<"u")return{result:r.start-t,precise:!0};if(t+=Eu(i,r),typeof r.end<"u")return{result:r.end-t,precise:!0}}return{result:-1,precise:!1}},ym=function(i,e,t){if(typeof e>"u"&&(e=i.mediaSequence+i.segments.length),e<i.mediaSequence)return 0;const r=nx(i,e);if(r.precise)return r.result;const s=ax(i,e);return s.precise?s.result:r.result+t},_m=function(i,e,t){if(!i)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(i.totalDuration)return i.totalDuration;if(!i.endList)return k.Infinity}return ym(i,e,t)},zs=function({defaultDuration:i,durationList:e,startIndex:t,endIndex:r}){let s=0;if(t>r&&([t,r]=[r,t]),t<0){for(let n=t;n<Math.min(0,r);n++)s+=i;t=0}for(let n=t;n<r;n++)s+=e[n].duration;return s},Tm=function(i,e,t,r){if(!i||!i.segments)return null;if(i.endList)return _m(i);if(e===null)return null;e=e||0;let s=ym(i,i.mediaSequence+i.segments.length,e);return t&&(r=typeof r=="number"?r:gm(null,i),s-=r),Math.max(0,s)},ox=function(i,e,t){const s=e||0;let n=Tm(i,e,!0,t);return n===null?et():(n<s&&(n=s),et(s,n))},lx=function({playlist:i,currentTime:e,startingSegmentIndex:t,startingPartIndex:r,startTime:s,exactManifestTimings:n}){let a=e-s;const l=hl(i);let u=0;for(let f=0;f<l.length;f++){const p=l[f];if(t===p.segmentIndex&&!(typeof r=="number"&&typeof p.partIndex=="number"&&r!==p.partIndex)){u=f;break}}if(a<0){if(u>0)for(let f=u-1;f>=0;f--){const p=l[f];if(a+=p.duration,n){if(a<0)continue}else if(a+ni<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s-zs({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:f})}}return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e}}if(u<0){for(let f=u;f<0;f++)if(a-=i.targetDuration,a<0)return{partIndex:l[0]&&l[0].partIndex||null,segmentIndex:l[0]&&l[0].segmentIndex||0,startTime:e};u=0}for(let f=u;f<l.length;f++){const p=l[f];a-=p.duration;const T=p.duration>ni,b=a===0,S=T&&a+ni>=0;if(!((b||S)&&f!==l.length-1)){if(n){if(a>0)continue}else if(a-ni>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s+zs({defaultDuration:i.targetDuration,durationList:l,startIndex:u,endIndex:f})}}}return{segmentIndex:l[l.length-1].segmentIndex,partIndex:l[l.length-1].partIndex,startTime:e}},vm=function(i){return i.excludeUntil&&i.excludeUntil>Date.now()},Cu=function(i){return i.excludeUntil&&i.excludeUntil===1/0},eo=function(i){const e=vm(i);return!i.disabled&&!e},ux=function(i){return i.disabled},cx=function(i){for(let e=0;e<i.segments.length;e++)if(i.segments[e].key)return!0;return!1},bm=function(i,e){return e.attributes&&e.attributes[i]},dx=function(i,e,t,r=0){return bm("BANDWIDTH",t)?(i*t.attributes.BANDWIDTH-r*8)/e:NaN},fl=(i,e)=>{if(i.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return i.playlists.filter(r=>eo(r)?(r.attributes.BANDWIDTH||0)<t:!1).length===0},Au=(i,e)=>!i&&!e||!i&&e||i&&!e?!1:!!(i===e||i.id&&e.id&&i.id===e.id||i.resolvedUri&&e.resolvedUri&&i.resolvedUri===e.resolvedUri||i.uri&&e.uri&&i.uri===e.uri),Wd=function(i,e){const t=i&&i.mediaGroups&&i.mediaGroups.AUDIO||{};let r=!1;for(const s in t){for(const n in t[s])if(r=e(t[s][n]),r)break;if(r)break}return!!r},hn=i=>{if(!i||!i.playlists||!i.playlists.length)return Wd(i,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<i.playlists.length;e++){const t=i.playlists[e],r=t.attributes&&t.attributes.CODECS;if(!(r&&r.split(",").every(n=>ef(n))||Wd(i,n=>Au(t,n))))return!1}return!0};var Tt={liveEdgeDelay:gm,duration:_m,seekable:ox,getMediaInfoForTime:lx,isEnabled:eo,isDisabled:ux,isExcluded:vm,isIncompatible:Cu,playlistEnd:Tm,isAes:cx,hasAttribute:bm,estimateSegmentRequestTime:dx,isLowestEnabledRendition:fl,isAudioOnly:hn,playlistMatch:Au,segmentDurationWithParts:Eu};const{log:xm}=F,Or=(i,e)=>`${i}-${e}`,Sm=(i,e,t)=>`placeholder-uri-${i}-${e}-${t}`,hx=({onwarn:i,oninfo:e,manifestString:t,customTagParsers:r=[],customTagMappers:s=[],llhls:n})=>{const a=new Dv;i&&a.on("warn",i),e&&a.on("info",e),r.forEach(f=>a.addParser(f)),s.forEach(f=>a.addTagMapper(f)),a.push(t),a.end();const l=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(f){l.hasOwnProperty(f)&&delete l[f]}),l.segments&&l.segments.forEach(function(f){["parts","preloadHints"].forEach(function(p){f.hasOwnProperty(p)&&delete f[p]})})),!l.targetDuration){let f=10;l.segments&&l.segments.length&&(f=l.segments.reduce((p,T)=>Math.max(p,T.duration),0)),i&&i({message:`manifest has no targetDuration defaulting to ${f}`}),l.targetDuration=f}const u=pm(l);if(u.length&&!l.partTargetDuration){const f=u.reduce((p,T)=>Math.max(p,T.duration),0);i&&(i({message:`manifest has no partTargetDuration defaulting to ${f}`}),xm.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.")),l.partTargetDuration=f}return l},ss=(i,e)=>{i.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(i.mediaGroups[t])for(const r in i.mediaGroups[t])for(const s in i.mediaGroups[t][r]){const n=i.mediaGroups[t][r][s];e(n,t,r,s)}})},Em=({playlist:i,uri:e,id:t})=>{i.id=t,i.playlistErrors_=0,e&&(i.uri=e),i.attributes=i.attributes||{}},fx=i=>{let e=i.playlists.length;for(;e--;){const t=i.playlists[e];Em({playlist:t,id:Or(e,t.uri)}),t.resolvedUri=_t(i.uri,t.uri),i.playlists[t.id]=t,i.playlists[t.uri]=t,t.attributes.BANDWIDTH||xm.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},px=i=>{ss(i,e=>{e.uri&&(e.resolvedUri=_t(i.uri,e.uri))})},mx=(i,e)=>{const t=Or(0,e),r={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:k.location.href,resolvedUri:k.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return r.playlists[t]=r.playlists[0],r.playlists[e]=r.playlists[0],r},Cm=(i,e,t=Sm)=>{i.uri=e;for(let s=0;s<i.playlists.length;s++)if(!i.playlists[s].uri){const n=`placeholder-uri-${s}`;i.playlists[s].uri=n}const r=hn(i);ss(i,(s,n,a,l)=>{if(!s.playlists||!s.playlists.length){if(r&&n==="AUDIO"&&!s.uri)for(let u=0;u<i.playlists.length;u++){const f=i.playlists[u];if(f.attributes&&f.attributes.AUDIO&&f.attributes.AUDIO===a)return}s.playlists=[Ke({},s)]}s.playlists.forEach(function(u,f){const p=t(n,a,l,u),T=Or(f,p);u.uri?u.resolvedUri=u.resolvedUri||_t(i.uri,u.uri):(u.uri=f===0?p:T,u.resolvedUri=u.uri),u.id=u.id||T,u.attributes=u.attributes||{},i.playlists[u.id]=u,i.playlists[u.uri]=u})}),fx(i),px(i)};class Gd{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,r=t.startDate.getTime();this.trimProcessedDateRanges_(r),this.pendingDateRanges_=e.reduce((s,n)=>(s.set(n.id,n),s),new Map)}processDateRange(e){this.pendingDateRanges_.delete(e.id),this.processedDateRanges_.set(e.id,e)}getDateRangesToProcess(){if(this.offset_===null)return[];const e={},t=[];this.pendingDateRanges_.forEach((r,s)=>{if(!this.processedDateRanges_.has(s)&&(r.startTime=r.startDate.getTime()/1e3-this.offset_,r.processDateRange=()=>this.processDateRange(r),t.push(r),!!r.class))if(e[r.class]){const n=e[r.class].push(r);r.classListIndex=n-1}else e[r.class]=[r],r.classListIndex=0});for(const r of t){const s=e[r.class]||[];r.endDate?r.endTime=r.endDate.getTime()/1e3-this.offset_:r.endOnNext&&s[r.classListIndex+1]?r.endTime=s[r.classListIndex+1].startTime:r.duration?r.endTime=r.startTime+r.duration:r.plannedDuration?r.endTime=r.startTime+r.plannedDuration:r.endTime=r.startTime}return t}trimProcessedDateRanges_(e){new Map(this.processedDateRanges_).forEach((r,s)=>{r.startDate.getTime()<e&&this.processedDateRanges_.delete(s)})}}const Am=22,or=({requestType:i,request:e,error:t,parseFailure:r})=>{const s=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:i},l=s&&!n||r;if(t&&n)a.error=Ke({},t),a.errorType=F.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=F.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=F.Error.NetworkRequestTimeout;else if(l){const u=r?F.Error.NetworkBodyParserFailed:F.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},{EventTarget:gx}=F,yx=(i,e)=>{if(e.endList||!e.serverControl)return i;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:r}=e;let s=e.mediaSequence+e.segments.length;if(r){const n=r.parts||[],a=mm(e)-1;a>-1&&a!==n.length-1&&(t._HLS_part=a),(a>-1||n.length)&&s--}t._HLS_msn=s}if(e.serverControl&&e.serverControl.canSkipUntil&&(t._HLS_skip=e.serverControl.canSkipDateranges?"v2":"YES"),Object.keys(t).length){const r=new k.URL(i);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){t.hasOwnProperty(s)&&r.searchParams.set(s,t[s])}),i=r.toString()}return i},_x=(i,e)=>{if(!i)return e;const t=Te(i,e);if(i.preloadHints&&!e.preloadHints&&delete t.preloadHints,i.parts&&!e.parts)delete t.parts;else if(i.parts&&e.parts)for(let r=0;r<e.parts.length;r++)i.parts&&i.parts[r]&&(t.parts[r]=Te(i.parts[r],e.parts[r]));return!i.skipped&&e.skipped&&(t.skipped=!1),i.preload&&!e.preload&&(t.preload=!1),t},Tx=(i,e,t)=>{const r=i.slice(),s=e.slice();t=t||0;const n=[];let a;for(let l=0;l<s.length;l++){const u=r[l+t],f=s[l];u?(a=u.map||a,n.push(_x(u,f))):(a&&!f.map&&(f.map=a),n.push(f))}return n},wm=(i,e)=>{!i.resolvedUri&&i.uri&&(i.resolvedUri=_t(e,i.uri)),i.key&&!i.key.resolvedUri&&(i.key.resolvedUri=_t(e,i.key.uri)),i.map&&!i.map.resolvedUri&&(i.map.resolvedUri=_t(e,i.map.uri)),i.map&&i.map.key&&!i.map.key.resolvedUri&&(i.map.key.resolvedUri=_t(e,i.map.key.uri)),i.parts&&i.parts.length&&i.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))}),i.preloadHints&&i.preloadHints.length&&i.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=_t(e,t.uri))})},Dm=function(i){const e=i.segments||[],t=i.preloadSegment;if(t&&t.parts&&t.parts.length){if(t.preloadHints){for(let r=0;r<t.preloadHints.length;r++)if(t.preloadHints[r].type==="MAP")return e}t.duration=i.targetDuration,t.preload=!0,e.push(t)}return e},Im=(i,e)=>i===e||i.segments&&e.segments&&i.segments.length===e.segments.length&&i.endList===e.endList&&i.mediaSequence===e.mediaSequence&&i.preloadSegment===e.preloadSegment,pl=(i,e,t=Im)=>{const r=Te(i,{}),s=r.playlists[e.id];if(!s||t(s,e))return null;e.segments=Dm(e);const n=Te(s,e);if(n.preloadSegment&&!e.preloadSegment&&delete n.preloadSegment,s.segments){if(e.skip){e.segments=e.segments||[];for(let a=0;a<e.skip.skippedSegments;a++)e.segments.unshift({skipped:!0})}n.segments=Tx(s.segments,e.segments,e.mediaSequence-s.mediaSequence)}n.segments.forEach(a=>{wm(a,n.resolvedUri)});for(let a=0;a<r.playlists.length;a++)r.playlists[a].id===e.id&&(r.playlists[a]=n);return r.playlists[e.id]=n,r.playlists[e.uri]=n,ss(i,(a,l,u,f)=>{if(a.playlists)for(let p=0;p<a.playlists.length;p++)e.id===a.playlists[p].id&&(a.playlists[p]=n)}),r},ml=(i,e)=>{const t=i.segments||[],r=t[t.length-1],s=r&&r.parts&&r.parts[r.parts.length-1],n=s&&s.duration||r&&r.duration;return e&&n?n*1e3:(i.partTargetDuration||i.targetDuration||10)*500},Kd=(i,e,t)=>{if(!i)return;const r=[];return i.forEach(s=>{if(!s.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:l}=s.attributes;r.push({id:s.id,bandwidth:n,resolution:a,codecs:l})}),{type:e,isLive:t,renditions:r}};class Ir extends gx{constructor(e,t,r={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=$t("PlaylistLoader");const{withCredentials:s=!1}=r;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=r.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new Gd,this.state="HAVE_NOTHING",this.handleMediaupdatetimeout_=this.handleMediaupdatetimeout_.bind(this),this.on("mediaupdatetimeout",this.handleMediaupdatetimeout_),this.on("loadedplaylist",this.handleLoadedPlaylist_.bind(this))}handleLoadedPlaylist_(){const e=this.media();if(!e)return;this.dateRangesStorage_.setOffset(e.segments),this.dateRangesStorage_.setPendingDateRanges(e.dateRanges);const t=this.dateRangesStorage_.getDateRangesToProcess();!t.length||!this.addDateRangesToTextTrack_||this.addDateRangesToTextTrack_(t)}handleMediaupdatetimeout_(){if(this.state!=="HAVE_METADATA")return;const e=this.media();let t=_t(this.main.uri,e.uri);this.llhls&&(t=yx(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(r,s)=>{if(this.request){if(r)return this.playlistRequestError(this.request,this.media(),"HAVE_METADATA");this.haveMetadata({playlistString:this.request.responseText,url:this.media().uri,id:this.media().id})}})}playlistRequestError(e,t,r){const{uri:s,id:n}=t;this.request=null,r&&(this.state=r),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:or({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return hx({onwarn:({message:r})=>this.logger_(`m3u8-parser warn for ${e}: ${r}`),oninfo:({message:r})=>this.logger_(`m3u8-parser info for ${e}: ${r}`),manifestString:t,customTagParsers:this.customTagParsers,customTagMappers:this.customTagMappers,llhls:this.llhls})}catch(r){this.error=r,this.error.metadata={errorType:F.Error.StreamingHlsPlaylistParserError,error:r}}}haveMetadata({playlistString:e,playlistObject:t,url:r,id:s}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:r}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:r,manifestString:e});a.lastRequest=Date.now(),Em({playlist:a,uri:r,id:s});const l=pl(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,l?(this.main=l,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ml(this.media(),!!l)),n.parsedPlaylist=Kd(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),k.clearTimeout(this.mediaUpdateTimeout),k.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Gd,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(k.clearTimeout(this.finalRenditionTimeout),t){const l=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=k.setTimeout(this.media.bind(this,e,!1),l);return}const r=this.state,s=!this.media_||e.id!==this.media_.id,n=this.main.playlists[e.id];if(n&&n.endList||e.endList&&e.segments.length){this.request&&(this.request.onreadystatechange=null,this.request.abort(),this.request=null),this.state="HAVE_METADATA",this.media_=e,s&&(this.trigger("mediachanging"),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(ml(e,!0)),!s)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"},(l,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=va(e.resolvedUri,u),l)return this.playlistRequestError(this.request,e,r);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),r==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(k.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&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const r=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>{this.mediaUpdateTimeout=null,this.load()},r);return}if(!this.started){this.start();return}t&&!t.endList?this.trigger("mediaupdatetimeout"):this.trigger("loadedplaylist")}updateMediaUpdateTimeout_(e){this.mediaUpdateTimeout&&(k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=k.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=k.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,r)=>{if(!this.request)return;if(this.request=null,t)return this.error={status:r.status,message:`HLS playlist request error at URL: ${this.src}.`,responseText:r.responseText,code:2,metadata:or({requestType:r.requestType,request:r,error:t})},this.state==="HAVE_NOTHING"&&(this.started=!1),this.trigger("error");this.trigger({type:"playlistrequestcomplete",metadata:e}),this.src=va(this.src,r),this.trigger({type:"playlistparsestart",metadata:e});const s=this.parseManifest_({manifestString:r.responseText,url:this.src});e.parsedPlaylist=Kd(s.playlists,e.playlistInfo.type,!1),this.trigger({type:"playlistparsecomplete",metadata:e}),this.setupInitialPlaylist(s)})}srcUri(){return typeof this.src=="string"?this.src:this.src.uri}setupInitialPlaylist(e){if(this.state="HAVE_MAIN_MANIFEST",e.playlists){this.main=e,Cm(this.main,this.srcUri()),e.playlists.forEach(r=>{r.segments=Dm(r),r.segments.forEach(s=>{wm(s,r.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||k.location.href;this.main=mx(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const r=this.main,s=e.ID;let n=r.playlists.length;for(;n--;){const a=r.playlists[n];if(a.attributes["PATHWAY-ID"]===s){const l=a.resolvedUri,u=a.id;if(t){const f=this.createCloneURI_(a.resolvedUri,e),p=Or(s,f),T=this.createCloneAttributes_(s,a.attributes),b=this.createClonePlaylist_(a,p,e,T);r.playlists[n]=b,r.playlists[p]=b,r.playlists[f]=b}else r.playlists.splice(n,1);delete r.playlists[u],delete r.playlists[l]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const r=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!r.mediaGroups[n]||!r.mediaGroups[n][s])){for(const a in r.mediaGroups[n])if(a===s){for(const l in r.mediaGroups[n][a])r.mediaGroups[n][a][l].playlists.forEach((f,p)=>{const T=r.playlists[f.id],b=T.id,S=T.resolvedUri;delete r.playlists[b],delete r.playlists[S]});delete r.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const r=this.main,s=r.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=Or(e.ID,n),l=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,l);r.playlists[s]=u,r.playlists[a]=u,r.playlists[n]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,r=e["BASE-ID"],s=this.main;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!s.mediaGroups[n]||s.mediaGroups[n][t]))for(const a in s.mediaGroups[n]){if(a===r)s.mediaGroups[n][t]={};else continue;for(const l in s.mediaGroups[n][a]){const u=s.mediaGroups[n][a][l];s.mediaGroups[n][t][l]=Ke({},u);const f=s.mediaGroups[n][t][l],p=this.createCloneURI_(u.resolvedUri,e);f.resolvedUri=p,f.uri=p,f.playlists=[],u.playlists.forEach((T,b)=>{const S=s.playlists[T.id],A=Sm(n,t,l),v=Or(t,A);if(S&&!s.playlists[v]){const L=this.createClonePlaylist_(S,v,e),P=L.resolvedUri;s.playlists[v]=L,s.playlists[P]=L}f.playlists[b]=this.createClonePlaylist_(T,v,e)})}}})}createClonePlaylist_(e,t,r,s){const n=this.createCloneURI_(e.resolvedUri,r),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),s&&(a.attributes=s),Te(e,a)}createCloneURI_(e,t){const r=new URL(e);r.hostname=t["URI-REPLACEMENT"].HOST;const s=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(s))r.searchParams.set(n,s[n]);return r.href}createCloneAttributes_(e,t){const r={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(r[s]=e)}),r}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const s=e.contentProtection[r].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}const gl=function(i,e,t,r){const s=i.responseType==="arraybuffer"?i.response:i.responseText;!e&&s&&(i.responseTime=Date.now(),i.roundTripTime=i.responseTime-i.requestTime,i.bytesReceived=s.byteLength||s.length,i.bandwidth||(i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3))),t.headers&&(i.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(i.timedout=!0),!e&&!i.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(i&&(s||i.responseText)))),r(e,i)},vx=(i,e)=>{if(!i||!i.size)return;let t=e;return i.forEach(r=>{t=r(t)}),t},bx=(i,e,t,r)=>{!i||!i.size||i.forEach(s=>{s(e,t,r)})},km=function(){const i=function e(t,r){t=Te({timeout:45e3},t);const s=e.beforeRequest||F.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||F.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||F.Vhs.xhr._responseCallbackSet;s&&typeof s=="function"&&(F.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s));const l=F.Vhs.xhr.original===!0?F.xhr:F.Vhs.xhr,u=vx(n,t);n.delete(s);const f=l(u||t,function(T,b){return bx(a,f,T,b),gl(f,T,b,r)}),p=f.abort;return f.abort=function(){return f.aborted=!0,p.apply(f,arguments)},f.uri=t.uri,f.requestType=t.requestType,f.requestTime=Date.now(),f};return i.original=!0,i},xx=function(i){let e;const t=i.offset;return typeof i.offset=="bigint"||typeof i.length=="bigint"?e=k.BigInt(i.offset)+k.BigInt(i.length)-k.BigInt(1):e=i.offset+i.length-1,"bytes="+t+"-"+e},yl=function(i){const e={};return i.byterange&&(e.Range=xx(i.byterange)),e},Sx=function(i,e){return i.start(e)+"-"+i.end(e)},Ex=function(i,e){const t=i.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Cx=function(i){return i>=32&&i<126?String.fromCharCode(i):"."},Pm=function(i){const e={};return Object.keys(i).forEach(t=>{const r=i[t];rf(r)?e[t]={bytes:r.buffer,byteOffset:r.byteOffset,byteLength:r.byteLength}:e[t]=r}),e},ba=function(i){const e=i.byterange||{length:1/0,offset:0};return[e.length,e.offset,i.resolvedUri].join(",")},Lm=function(i){return i.resolvedUri},Rm=i=>{const e=Array.prototype.slice.call(i),t=16;let r="",s,n;for(let a=0;a<e.length/t;a++)s=e.slice(a*t,a*t+t).map(Ex).join(""),n=e.slice(a*t,a*t+t).map(Cx).join(""),r+=s+" "+n+`
|
|
194
|
+
`;return r},Ax=({bytes:i})=>Rm(i),wx=i=>{let e="",t;for(t=0;t<i.length;t++)e+=Sx(i,t)+" ";return e};var Dx=Object.freeze({__proto__:null,createTransferableMessage:Pm,initSegmentId:ba,segmentKeyId:Lm,hexDump:Rm,tagDump:Ax,textRanges:wx});const Om=.25,Ix=(i,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+t,n=i-s;return new Date(e.dateTimeObject.getTime()+n*1e3)},kx=i=>i.transmuxedPresentationEnd-i.transmuxedPresentationStart-i.transmuxerPrependedSeconds,Px=(i,e)=>{let t;try{t=new Date(i)}catch{return null}if(!e||!e.segments||e.segments.length===0)return null;let r=e.segments[0];if(t<new Date(r.dateTimeObject))return null;for(let u=0;u<e.segments.length-1;u++){r=e.segments[u];const f=new Date(e.segments[u+1].dateTimeObject);if(t<f)break}const s=e.segments[e.segments.length-1],n=s.dateTimeObject,a=s.videoTimingInfo?kx(s.videoTimingInfo):s.duration+s.duration*Om,l=new Date(n.getTime()+a*1e3);return t>l?null:(t>new Date(n)&&(r=s),{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:Tt.duration(e,e.mediaSequence+e.segments.indexOf(r)),type:r.videoTimingInfo?"accurate":"estimate"})},Lx=(i,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,r;for(let n=0;n<e.segments.length&&(r=e.segments[n],t=r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationEnd:t+r.duration,!(i<=t));n++);const s=e.segments[e.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<i)return null;if(i>t){if(i>t+s.duration*Om)return null;r=s}return{segment:r,estimatedStart:r.videoTimingInfo?r.videoTimingInfo.transmuxedPresentationStart:t-r.duration,type:r.videoTimingInfo?"accurate":"estimate"}},Rx=(i,e)=>{let t,r;try{t=new Date(i),r=new Date(e)}catch{}const s=t.getTime();return(r.getTime()-s)/1e3},Ox=i=>{if(!i.segments||i.segments.length===0)return!1;for(let e=0;e<i.segments.length;e++)if(!i.segments[e].dateTimeObject)return!1;return!0},Nx=({playlist:i,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!i||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const r=Lx(e,i);if(!r)return t({message:"valid programTime was not found"});if(r.type==="estimate")return t({message:"Accurate programTime could not be determined. Please seek to e.seekTime and try again",seekTime:r.estimatedStart});const s={mediaSeconds:e},n=Ix(e,r.segment);return n&&(s.programDateTime=n.toISOString()),t(null,s)},Nm=({programTime:i,playlist:e,retryCount:t=2,seekTo:r,pauseAfterSeek:s=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof i>"u"||!e||!r)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!Ox(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const l=Px(i,e);if(!l)return a({message:`${i} was not found in the stream`});const u=l.segment,f=Rx(u.dateTimeObject,i);if(l.type==="estimate"){if(t===0)return a({message:`${i} is not buffered yet. Try again`});r(l.estimatedStart+f),n.one("seeked",()=>{Nm({programTime:i,playlist:e,retryCount:t-1,seekTo:r,pauseAfterSeek:s,tech:n,callback:a})});return}const p=u.start+f,T=()=>a(null,n.currentTime());n.one("seeked",T),s&&n.pause(),r(p)},Ho=(i,e)=>{if(i.readyState===4)return e()},Bx=(i,e,t,r)=>{let s=[],n,a=!1;const l=function(T,b,S,A){return b.abort(),a=!0,t(T,b,S,A)},u=function(T,b){if(a)return;if(T)return T.metadata=or({requestType:r,request:b,error:T}),l(T,b,"",s);const S=b.responseText.substring(s&&s.byteLength||0,b.responseText.length);if(s=$v(s,sf(S,!0)),n=n||Ms(s),s.length<10||n&&s.length<n+2)return Ho(b,()=>l(T,b,"",s));const A=Gl(s);return A==="ts"&&s.length<188?Ho(b,()=>l(T,b,"",s)):!A&&s.length<376?Ho(b,()=>l(T,b,"",s)):l(null,b,A,s)},p=e({uri:i,beforeSend(T){T.overrideMimeType("text/plain; charset=x-user-defined"),T.addEventListener("progress",function({total:b,loaded:S}){return gl(T,null,{statusCode:T.status},u)})}},function(T,b){return gl(p,T,b,u)});return p},{EventTarget:Mx}=F,Xd=function(i,e){if(!Im(i,e)||i.sidx&&e.sidx&&(i.sidx.offset!==e.sidx.offset||i.sidx.length!==e.sidx.length))return!1;if(!i.sidx&&e.sidx||i.sidx&&!e.sidx||i.segments&&!e.segments||!i.segments&&e.segments)return!1;if(!i.segments&&!e.segments)return!0;for(let t=0;t<i.segments.length;t++){const r=i.segments[t],s=e.segments[t];if(r.uri!==s.uri)return!1;if(!r.byterange&&!s.byterange)continue;const n=r.byterange,a=s.byterange;if(n&&!a||!n&&a||n.offset!==a.offset||n.length!==a.length)return!1}return!0},Ux=(i,e,t,r)=>{const s=r.attributes.NAME||t;return`placeholder-uri-${i}-${e}-${s}`},Fx=({mainXml:i,srcUrl:e,clientOffset:t,sidxMapping:r,previousManifest:s})=>{const n=o2(i,{manifestUri:e,clientOffset:t,sidxMapping:r,previousManifest:s});return Cm(n,e,Ux),n},$x=(i,e)=>{ss(i,(t,r,s,n)=>{(!e.mediaGroups[r][s]||!(n in e.mediaGroups[r][s]))&&delete i.mediaGroups[r][s][n]})},jx=(i,e,t)=>{let r=!0,s=Te(i,{duration:e.duration,minimumUpdatePeriod:e.minimumUpdatePeriod,timelineStarts:e.timelineStarts});for(let n=0;n<e.playlists.length;n++){const a=e.playlists[n];if(a.sidx){const u=Na(a.sidx);t&&t[u]&&t[u].sidx&&Hl(a,t[u].sidx,a.sidx.resolvedUri)}const l=pl(s,a,Xd);l&&(s=l,r=!1)}return ss(e,(n,a,l,u)=>{if(n.playlists&&n.playlists.length){const f=n.playlists[0].id,p=pl(s,n.playlists[0],Xd);p&&(s=p,u in s.mediaGroups[a][l]||(s.mediaGroups[a][l][u]=n),s.mediaGroups[a][l][u].playlists[0]=s.playlists[f],r=!1)}}),$x(s,e),e.minimumUpdatePeriod!==i.minimumUpdatePeriod&&(r=!1),r?null:s},Vx=(i,e)=>(!i.map&&!e.map||!!(i.map&&e.map&&i.map.byterange.offset===e.map.byterange.offset&&i.map.byterange.length===e.map.byterange.length))&&i.uri===e.uri&&i.byterange.offset===e.byterange.offset&&i.byterange.length===e.byterange.length,Yd=(i,e)=>{const t={};for(const r in i){const n=i[r].sidx;if(n){const a=Na(n);if(!e[a])break;const l=e[a].sidxInfo;Vx(l,n)&&(t[a]=e[a])}}return t},qx=(i,e)=>{let r=Yd(i.playlists,e);return ss(i,(s,n,a,l)=>{if(s.playlists&&s.playlists.length){const u=s.playlists;r=Te(r,Yd(u,e))}}),r};class _l extends Mx{constructor(e,t,r={},s){super(),this.isPaused_=!0,this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:n=!1}=r;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=r.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=$t("DashPlaylistLoader"),this.isMain_?(this.mainPlaylistLoader_.srcUrl=e,this.mainPlaylistLoader_.sidxMapping_={}):this.childPlaylist_=e}get isPaused(){return this.isPaused_}requestErrored_(e,t,r){if(!this.request)return!0;if(this.request=null,e)return this.error=typeof e=="object"&&!(e instanceof Error)?e:{status:t.status,message:"DASH request error at URL: "+t.uri,response:t.response,code:2,metadata:e.metadata},r&&(this.state=r),this.trigger("error"),!0}addSidxSegments_(e,t,r){const s=e.sidx&&Na(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=k.setTimeout(()=>r(!1),0);return}const n=va(e.sidx.resolvedUri),a=(u,f)=>{if(this.requestErrored_(u,f,t))return;const p=this.mainPlaylistLoader_.sidxMapping_,{requestType:T}=f;let b;try{b=f2(se(f.response).subarray(8))}catch(S){S.metadata=or({requestType:T,request:f,parseFailure:!0}),this.requestErrored_(S,f,t);return}return p[s]={sidxInfo:e.sidx,sidx:b},Hl(e,b,e.sidx.resolvedUri),r(!0)},l="dash-sidx";this.request=Bx(n,this.vhs_.xhr,(u,f,p,T)=>{if(u)return a(u,f);if(!p||p!=="mp4"){const A=p||"unknown";return a({status:f.status,message:`Unsupported ${A} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},f)}const{offset:b,length:S}=e.sidx.byterange;if(T.length>=S+b)return a(u,{response:T.subarray(b,b+S),status:f.status,uri:f.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:yl({byterange:e.sidx.byterange})},a)},l)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},k.clearTimeout(this.minimumUpdatePeriodTimeout_),k.clearTimeout(this.mediaRequest_),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.mediaRequest_=null,this.minimumUpdatePeriodTimeout_=null,this.mainPlaylistLoader_.createMupOnMedia_&&(this.off("loadedmetadata",this.mainPlaylistLoader_.createMupOnMedia_),this.mainPlaylistLoader_.createMupOnMedia_=null),this.off()}hasPendingRequest(){return this.request||this.mediaRequest_}stopRequest(){if(this.request){const e=this.request;this.request=null,e.onreadystatechange=null,e.abort()}}media(e){if(!e)return this.media_;if(this.state==="HAVE_NOTHING")throw new Error("Cannot switch media playlist from "+this.state);const t=this.state;if(typeof e=="string"){if(!this.mainPlaylistLoader_.main.playlists[e])throw new Error("Unknown playlist URI: "+e);e=this.mainPlaylistLoader_.main.playlists[e]}const r=!this.media_||e.id!==this.media_.id;if(r&&this.loadedPlaylists_[e.id]&&this.loadedPlaylists_[e.id].endList){this.state="HAVE_METADATA",this.media_=e,r&&(this.trigger("mediachanging"),this.trigger("mediachange"));return}r&&(this.media_&&this.trigger("mediachanging"),this.addSidxSegments_(e,t,s=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,k.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(),k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(k.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,k.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const r=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=k.setTimeout(()=>this.load(),r);return}if(!this.started){this.start();return}t&&!t.endList?(this.isMain_&&!this.minimumUpdatePeriodTimeout_&&(this.trigger("minimumUpdatePeriod"),this.updateMinimumUpdatePeriodTimeout_()),this.trigger("mediaupdatetimeout")):this.trigger("loadedplaylist")}start(){if(this.started=!0,!this.isMain_){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=k.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"},(r,s)=>{if(r){const{requestType:a}=s;r.metadata=or({requestType:a,request:s,error:r})}if(this.requestErrored_(r,s)){this.state==="HAVE_NOTHING"&&(this.started=!1);return}this.trigger({type:"manifestrequestcomplete",metadata:t});const n=s.responseText!==this.mainPlaylistLoader_.mainXml_;if(this.mainPlaylistLoader_.mainXml_=s.responseText,s.responseHeaders&&s.responseHeaders.date?this.mainLoaded_=Date.parse(s.responseHeaders.date):this.mainLoaded_=Date.now(),this.mainPlaylistLoader_.srcUrl=va(this.mainPlaylistLoader_.srcUrl,s),n){this.handleMain_(),this.syncClientServerClock_(()=>e(s,n));return}return e(s,n)})}syncClientServerClock_(e){const t=l2(this.mainPlaylistLoader_.mainXml_);if(t===null)return this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e();if(t.method==="DIRECT")return this.mainPlaylistLoader_.clientOffset_=t.value-Date.now(),e();this.request=this.vhs_.xhr({uri:_t(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(r,s)=>{if(!this.request)return;if(r){const{requestType:a}=s;return this.error.metadata=or({requestType:a,request:s,error:r}),this.mainPlaylistLoader_.clientOffset_=this.mainLoaded_-Date.now(),e()}let n;t.method==="HEAD"?!s.responseHeaders||!s.responseHeaders.date?n=this.mainLoaded_:n=Date.parse(s.responseHeaders.date):n=Date.parse(s.responseText),this.mainPlaylistLoader_.clientOffset_=n-Date.now(),e()})}haveMain_(){this.state="HAVE_MAIN_MANIFEST",this.isMain_?this.trigger("loadedplaylist"):this.media_||this.media(this.childPlaylist_)}handleMain_(){k.clearTimeout(this.mediaRequest_),this.mediaRequest_=null;const e=this.mainPlaylistLoader_.main,t={manifestInfo:{uri:this.mainPlaylistLoader_.srcUrl}};this.trigger({type:"manifestparsestart",metadata:t});let r;try{r=Fx({mainXml:this.mainPlaylistLoader_.mainXml_,srcUrl:this.mainPlaylistLoader_.srcUrl,clientOffset:this.mainPlaylistLoader_.clientOffset_,sidxMapping:this.mainPlaylistLoader_.sidxMapping_,previousManifest:e})}catch(n){this.error=n,this.error.metadata={errorType:F.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(r=jx(e,r,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=r||e;const s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||r&&r.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(r),r){const{duration:n,endList:a}=r,l=[];r.playlists.forEach(f=>{l.push({id:f.id,bandwidth:f.attributes.BANDWIDTH,resolution:f.attributes.RESOLUTION,codecs:f.attributes.CODECS})});const u={duration:n,isLive:!a,renditions:l};t.parsedManifest=u,this.trigger({type:"manifestparsecomplete",metadata:t})}return!!r}updateMinimumUpdatePeriodTimeout_(){const e=this.mainPlaylistLoader_;e.createMupOnMedia_&&(e.off("loadedmetadata",e.createMupOnMedia_),e.createMupOnMedia_=null),e.minimumUpdatePeriodTimeout_&&(k.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_=k.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_=qx(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.sidxMapping_),this.addSidxSegments_(this.media(),this.state,r=>{this.refreshMedia_(this.media().id)}))})}refreshMedia_(e){if(!e)throw new Error("refreshMedia_ must take a media id");this.media_&&this.isMain_&&this.handleMain_();const t=this.mainPlaylistLoader_.main.playlists,r=!this.media_||this.media_!==t[e];if(r?this.media_=t[e]:this.trigger("playlistunchanged"),!this.mediaUpdateTimeout){const s=()=>{this.media().endList||(this.mediaUpdateTimeout=k.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},ml(this.media(),!!r)))};s()}this.trigger("loadedplaylist")}addEventStreamToMetadataTrack_(e){if(e&&this.mainPlaylistLoader_.main.eventStream){const t=this.mainPlaylistLoader_.main.eventStream.map(r=>({cueTime:r.start,frames:[{data:r.messageData}]}));this.addMetadataToTextTrack("EventStream",t,this.mainPlaylistLoader_.main.duration)}}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const r in e.contentProtection){const s=e.contentProtection[r].attributes["cenc:default_KID"];s&&t.add(s.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 Hx=i=>{const e=new Uint8Array(new ArrayBuffer(i.length));for(let t=0;t<i.length;t++)e[t]=i.charCodeAt(t);return e.buffer},Bm=function(i){return i.on=i.addEventListener,i.off=i.removeEventListener,i},zx=function(i){try{return URL.createObjectURL(new Blob([i],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(i),URL.createObjectURL(t.getBlob())}},Mm=function(i){return function(){const e=zx(i),t=Bm(new Worker(e));t.objURL=e;const r=t.terminate;return t.on=t.addEventListener,t.off=t.removeEventListener,t.terminate=function(){return URL.revokeObjectURL(e),r.call(this)},t}},Um=function(i){return`var browserWorkerPolyFill = ${Bm.toString()};
|
|
191
195
|
browserWorkerPolyFill(self);
|
|
192
|
-
`+s},gf=function(s){return s.toString().replace(/^function.+?{/,"").slice(0,-1)},Ob=mf(gf(function(){var s=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof re.global<"u"?re.global:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(u,c){o[u]||(o[u]=[]),o[u]=o[u].concat(c)},this.off=function(u,c){var d;return o[u]?(d=o[u].indexOf(c),o[u]=o[u].slice(),o[u].splice(d,1),d>-1):!1},this.trigger=function(u){var c,d,p,_;if(c=o[u],!!c)if(arguments.length===2)for(p=c.length,d=0;d<p;++d)c[d].call(this,arguments[1]);else{for(_=[],d=arguments.length,d=1;d<arguments.length;++d)_.push(arguments[d]);for(p=c.length,d=0;d<p;++d)c[d].apply(this,_)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(u){o.push(u)}),this.on("done",function(u){o.flush(u)}),this.on("partialdone",function(u){o.partialFlush(u)}),this.on("endedtimeline",function(u){o.endTimeline(u)}),this.on("reset",function(u){o.reset(u)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,i=Math.pow(2,32),n=function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c;return u.getBigUint64?(c=u.getBigUint64(0),c<Number.MAX_SAFE_INTEGER?Number(c):c):u.getUint32(0)*i+u.getUint32(4)},r={getUint64:n,MAX_UINT32:i},a=r.MAX_UINT32,l,h,f,m,T,E,C,P,v,R,L,N,U,F,D,V,X,G,ae,fe,ve,he,Z,de,ee,Xe,Qe,Ve,qe,be,me,pt,xt,Ee,ce,Ue;(function(){var o;if(Z={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in Z)Z.hasOwnProperty(o)&&(Z[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);de=new Uint8Array([105,115,111,109]),Xe=new Uint8Array([97,118,99,49]),ee=new Uint8Array([0,0,0,1]),Qe=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]),Ve=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]),qe={video:Qe,audio:Ve},pt=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),me=new Uint8Array([0,0,0,0,0,0,0,0]),xt=new Uint8Array([0,0,0,0,0,0,0,0]),Ee=xt,ce=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Ue=xt,be=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),l=function(o){var u=[],c=0,d,p,_;for(d=1;d<arguments.length;d++)u.push(arguments[d]);for(d=u.length;d--;)c+=u[d].byteLength;for(p=new Uint8Array(c+8),_=new DataView(p.buffer,p.byteOffset,p.byteLength),_.setUint32(0,p.byteLength),p.set(o,4),d=0,c=8;d<u.length;d++)p.set(u[d],c),c+=u[d].byteLength;return p},h=function(){return l(Z.dinf,l(Z.dref,pt))},f=function(o){return l(Z.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},m=function(){return l(Z.ftyp,de,ee,de,Xe)},V=function(o){return l(Z.hdlr,qe[o])},T=function(o){return l(Z.mdat,o)},D=function(o){var u=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(u[12]=o.samplerate>>>24&255,u[13]=o.samplerate>>>16&255,u[14]=o.samplerate>>>8&255,u[15]=o.samplerate&255),l(Z.mdhd,u)},F=function(o){return l(Z.mdia,D(o),V(o.type),C(o))},E=function(o){return l(Z.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},C=function(o){return l(Z.minf,o.type==="video"?l(Z.vmhd,be):l(Z.smhd,me),h(),G(o))},P=function(o,u){for(var c=[],d=u.length;d--;)c[d]=fe(u[d]);return l.apply(null,[Z.moof,E(o)].concat(c))},v=function(o){for(var u=o.length,c=[];u--;)c[u]=N(o[u]);return l.apply(null,[Z.moov,L(4294967295)].concat(c).concat(R(o)))},R=function(o){for(var u=o.length,c=[];u--;)c[u]=ve(o[u]);return l.apply(null,[Z.mvex].concat(c))},L=function(o){var u=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(Z.mvhd,u)},X=function(o){var u=o.samples||[],c=new Uint8Array(4+u.length),d,p;for(p=0;p<u.length;p++)d=u[p].flags,c[p+4]=d.dependsOn<<4|d.isDependedOn<<2|d.hasRedundancy;return l(Z.sdtp,c)},G=function(o){return l(Z.stbl,ae(o),l(Z.stts,Ue),l(Z.stsc,Ee),l(Z.stsz,ce),l(Z.stco,xt))},function(){var o,u;ae=function(c){return l(Z.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),c.type==="video"?o(c):u(c))},o=function(c){var d=c.sps||[],p=c.pps||[],_=[],x=[],S,I;for(S=0;S<d.length;S++)_.push((d[S].byteLength&65280)>>>8),_.push(d[S].byteLength&255),_=_.concat(Array.prototype.slice.call(d[S]));for(S=0;S<p.length;S++)x.push((p[S].byteLength&65280)>>>8),x.push(p[S].byteLength&255),x=x.concat(Array.prototype.slice.call(p[S]));if(I=[Z.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,(c.width&65280)>>8,c.width&255,(c.height&65280)>>8,c.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]),l(Z.avcC,new Uint8Array([1,c.profileIdc,c.profileCompatibility,c.levelIdc,255].concat([d.length],_,[p.length],x))),l(Z.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],c.sarRatio){var A=c.sarRatio[0],O=c.sarRatio[1];I.push(l(Z.pasp,new Uint8Array([(A&4278190080)>>24,(A&16711680)>>16,(A&65280)>>8,A&255,(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255])))}return l.apply(null,I)},u=function(c){return l(Z.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(c.channelcount&65280)>>8,c.channelcount&255,(c.samplesize&65280)>>8,c.samplesize&255,0,0,0,0,(c.samplerate&65280)>>8,c.samplerate&255,0,0]),f(c))}}(),U=function(o){var u=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return l(Z.tkhd,u)},fe=function(o){var u,c,d,p,_,x,S;return u=l(Z.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),x=Math.floor(o.baseMediaDecodeTime/a),S=Math.floor(o.baseMediaDecodeTime%a),c=l(Z.tfdt,new Uint8Array([1,0,0,0,x>>>24&255,x>>>16&255,x>>>8&255,x&255,S>>>24&255,S>>>16&255,S>>>8&255,S&255])),_=92,o.type==="audio"?(d=he(o,_),l(Z.traf,u,c,d)):(p=X(o),d=he(o,p.length+_),l(Z.traf,u,c,d,p))},N=function(o){return o.duration=o.duration||4294967295,l(Z.trak,U(o),F(o))},ve=function(o){var u=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(u[u.length-1]=0),l(Z.trex,u)},function(){var o,u,c;c=function(d,p){var _=0,x=0,S=0,I=0;return d.length&&(d[0].duration!==void 0&&(_=1),d[0].size!==void 0&&(x=2),d[0].flags!==void 0&&(S=4),d[0].compositionTimeOffset!==void 0&&(I=8)),[0,0,_|x|S|I,1,(d.length&4278190080)>>>24,(d.length&16711680)>>>16,(d.length&65280)>>>8,d.length&255,(p&4278190080)>>>24,(p&16711680)>>>16,(p&65280)>>>8,p&255]},u=function(d,p){var _,x,S,I,A,O;for(I=d.samples||[],p+=20+16*I.length,S=c(I,p),x=new Uint8Array(S.length+I.length*16),x.set(S),_=S.length,O=0;O<I.length;O++)A=I[O],x[_++]=(A.duration&4278190080)>>>24,x[_++]=(A.duration&16711680)>>>16,x[_++]=(A.duration&65280)>>>8,x[_++]=A.duration&255,x[_++]=(A.size&4278190080)>>>24,x[_++]=(A.size&16711680)>>>16,x[_++]=(A.size&65280)>>>8,x[_++]=A.size&255,x[_++]=A.flags.isLeading<<2|A.flags.dependsOn,x[_++]=A.flags.isDependedOn<<6|A.flags.hasRedundancy<<4|A.flags.paddingValue<<1|A.flags.isNonSyncSample,x[_++]=A.flags.degradationPriority&61440,x[_++]=A.flags.degradationPriority&15,x[_++]=(A.compositionTimeOffset&4278190080)>>>24,x[_++]=(A.compositionTimeOffset&16711680)>>>16,x[_++]=(A.compositionTimeOffset&65280)>>>8,x[_++]=A.compositionTimeOffset&255;return l(Z.trun,x)},o=function(d,p){var _,x,S,I,A,O;for(I=d.samples||[],p+=20+8*I.length,S=c(I,p),_=new Uint8Array(S.length+I.length*8),_.set(S),x=S.length,O=0;O<I.length;O++)A=I[O],_[x++]=(A.duration&4278190080)>>>24,_[x++]=(A.duration&16711680)>>>16,_[x++]=(A.duration&65280)>>>8,_[x++]=A.duration&255,_[x++]=(A.size&4278190080)>>>24,_[x++]=(A.size&16711680)>>>16,_[x++]=(A.size&65280)>>>8,_[x++]=A.size&255;return l(Z.trun,_)},he=function(d,p){return d.type==="audio"?o(d,p):u(d,p)}}();var zi={ftyp:m,mdat:T,moof:P,moov:v,initSegment:function(o){var u=m(),c=v(o),d;return d=new Uint8Array(u.byteLength+c.byteLength),d.set(u),d.set(c,u.byteLength),d}},ui=function(o){var u,c,d=[],p=[];for(p.byteLength=0,p.nalCount=0,p.duration=0,d.byteLength=0,u=0;u<o.length;u++)c=o[u],c.nalUnitType==="access_unit_delimiter_rbsp"?(d.length&&(d.duration=c.dts-d.dts,p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d)),d=[c],d.byteLength=c.data.byteLength,d.pts=c.pts,d.dts=c.dts):(c.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(d.keyFrame=!0),d.duration=c.dts-d.dts,d.byteLength+=c.data.byteLength,d.push(c));return p.length&&(!d.duration||d.duration<=0)&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.length,p.duration+=d.duration,p.push(d),p},ci=function(o){var u,c,d=[],p=[];for(d.byteLength=0,d.nalCount=0,d.duration=0,d.pts=o[0].pts,d.dts=o[0].dts,p.byteLength=0,p.nalCount=0,p.duration=0,p.pts=o[0].pts,p.dts=o[0].dts,u=0;u<o.length;u++)c=o[u],c.keyFrame?(d.length&&(p.push(d),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration),d=[c],d.nalCount=c.length,d.byteLength=c.byteLength,d.pts=c.pts,d.dts=c.dts,d.duration=c.duration):(d.duration+=c.duration,d.nalCount+=c.length,d.byteLength+=c.byteLength,d.push(c));return p.length&&d.duration<=0&&(d.duration=p[p.length-1].duration),p.byteLength+=d.byteLength,p.nalCount+=d.nalCount,p.duration+=d.duration,p.push(d),p},wi=function(o){var u;return!o[0][0].keyFrame&&o.length>1&&(u=o.shift(),o.byteLength-=u.byteLength,o.nalCount-=u.nalCount,o[0][0].dts=u.dts,o[0][0].pts=u.pts,o[0][0].duration+=u.duration),o},mt=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},di=function(o,u){var c=mt();return c.dataOffset=u,c.compositionTimeOffset=o.pts-o.dts,c.duration=o.duration,c.size=4*o.length,c.size+=o.byteLength,o.keyFrame&&(c.flags.dependsOn=2,c.flags.isNonSyncSample=0),c},Ft=function(o,u){var c,d,p,_,x,S=u||0,I=[];for(c=0;c<o.length;c++)for(_=o[c],d=0;d<_.length;d++)x=_[d],p=di(x,S),S+=p.size,I.push(p);return I},Ii=function(o){var u,c,d,p,_,x,S=0,I=o.byteLength,A=o.nalCount,O=I+4*A,j=new Uint8Array(O),Y=new DataView(j.buffer);for(u=0;u<o.length;u++)for(p=o[u],c=0;c<p.length;c++)for(_=p[c],d=0;d<_.length;d++)x=_[d],Y.setUint32(S,x.data.byteLength),S+=4,j.set(x.data,S),S+=x.data.byteLength;return j},Dt=function(o,u){var c,d=u||0,p=[];return c=di(o,d),p.push(c),p},Lt=function(o){var u,c,d=0,p=o.byteLength,_=o.length,x=p+4*_,S=new Uint8Array(x),I=new DataView(S.buffer);for(u=0;u<o.length;u++)c=o[u],I.setUint32(d,c.data.byteLength),d+=4,S.set(c.data,d),d+=c.data.byteLength;return S},Ai={groupNalsIntoFrames:ui,groupFramesIntoGops:ci,extendFirstKeyFrame:wi,generateSampleTable:Ft,concatenateNalData:Ii,generateSampleTableForFrame:Dt,concatenateNalDataForFrame:Lt},$t=[33,16,5,32,164,27],Ds=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],pe=function(o){for(var u=[];o--;)u.push(0);return u},ra=function(o){return Object.keys(o).reduce(function(u,c){return u[c]=new Uint8Array(o[c].reduce(function(d,p){return d.concat(p)},[])),u},{})},Ls,In=function(){if(!Ls){var o={96e3:[$t,[227,64],pe(154),[56]],88200:[$t,[231],pe(170),[56]],64e3:[$t,[248,192],pe(240),[56]],48e3:[$t,[255,192],pe(268),[55,148,128],pe(54),[112]],44100:[$t,[255,192],pe(268),[55,163,128],pe(84),[112]],32e3:[$t,[255,192],pe(268),[55,234],pe(226),[112]],24e3:[$t,[255,192],pe(268),[55,255,128],pe(268),[111,112],pe(126),[224]],16e3:[$t,[255,192],pe(268),[55,255,128],pe(268),[111,255],pe(269),[223,108],pe(195),[1,192]],12e3:[Ds,pe(268),[3,127,248],pe(268),[6,255,240],pe(268),[13,255,224],pe(268),[27,253,128],pe(259),[56]],11025:[Ds,pe(268),[3,127,248],pe(268),[6,255,240],pe(268),[13,255,224],pe(268),[27,255,192],pe(268),[55,175,128],pe(108),[112]],8e3:[Ds,pe(268),[3,121,16],pe(47),[7]]};Ls=ra(o)}return Ls},hi=9e4,lt,ki,Wi,St,An,b,g;lt=function(o){return o*hi},ki=function(o,u){return o*u},Wi=function(o){return o/hi},St=function(o,u){return o/u},An=function(o,u){return lt(St(o,u))},b=function(o,u){return ki(Wi(o),u)},g=function(o,u,c){return Wi(c?o:o-u)};var y={ONE_SECOND_IN_TS:hi,secondsToVideoTs:lt,secondsToAudioTs:ki,videoTsToSeconds:Wi,audioTsToSeconds:St,audioTsToVideoTs:An,videoTsToAudioTs:b,metadataTsToSeconds:g},w=In,M=y,$=function(o){var u,c,d=0;for(u=0;u<o.length;u++)c=o[u],d+=c.data.byteLength;return d},z=function(o,u,c,d){var p,_=0,x=0,S=0,I=0,A,O,j;if(u.length&&(p=M.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),_=Math.ceil(M.ONE_SECOND_IN_TS/(o.samplerate/1024)),c&&d&&(x=p-Math.max(c,d),S=Math.floor(x/_),I=S*_),!(S<1||I>M.ONE_SECOND_IN_TS/2))){for(A=w()[o.samplerate],A||(A=u[0].data),O=0;O<S;O++)j=u[0],u.splice(0,0,{data:A,dts:j.dts-_,pts:j.pts-_});return o.baseMediaDecodeTime-=Math.floor(M.videoTsToAudioTs(I,o.samplerate)),I}},le=function(o,u,c){return u.minSegmentDts>=c?o:(u.minSegmentDts=1/0,o.filter(function(d){return d.dts>=c?(u.minSegmentDts=Math.min(u.minSegmentDts,d.dts),u.minSegmentPts=u.minSegmentDts,!0):!1}))},Pe=function(o){var u,c,d=[];for(u=0;u<o.length;u++)c=o[u],d.push({size:c.data.byteLength,duration:1024});return d},Ce=function(o){var u,c,d=0,p=new Uint8Array($(o));for(u=0;u<o.length;u++)c=o[u],p.set(c.data,d),d+=c.data.byteLength;return p},De={prefixWithSilence:z,trimAdtsFramesByEarliestDts:le,generateSampleTable:Pe,concatenateFrameData:Ce},ye=y.ONE_SECOND_IN_TS,Gf=function(o,u){typeof u.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=u.pts),o.minSegmentPts===void 0?o.minSegmentPts=u.pts:o.minSegmentPts=Math.min(o.minSegmentPts,u.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=u.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,u.pts)),typeof u.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=u.dts),o.minSegmentDts===void 0?o.minSegmentDts=u.dts:o.minSegmentDts=Math.min(o.minSegmentDts,u.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=u.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,u.dts))},Kf=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},Xf=function(o,u){var c,d,p=o.minSegmentDts;return u||(p-=o.timelineStartInfo.dts),c=o.timelineStartInfo.baseMediaDecodeTime,c+=p,c=Math.max(0,c),o.type==="audio"&&(d=o.samplerate/ye,c*=d,c=Math.floor(c)),c},Yf={clearDtsInfo:Kf,calculateTrackBaseMediaDecodeTime:Xf,collectDtsInfo:Gf},gl=4,Qf=128,Jf=function(o){for(var u=0,c={payloadType:-1,payloadSize:0},d=0,p=0;u<o.byteLength&&o[u]!==Qf;){for(;o[u]===255;)d+=255,u++;for(d+=o[u++];o[u]===255;)p+=255,u++;if(p+=o[u++],!c.payload&&d===gl){var _=String.fromCharCode(o[u+3],o[u+4],o[u+5],o[u+6]);if(_==="GA94"){c.payloadType=d,c.payloadSize=p,c.payload=o.subarray(u,u+p);break}else c.payload=void 0}u+=p,d=0,p=0}return c},Zf=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},ep=function(o,u){var c=[],d,p,_,x;if(!(u[0]&64))return c;for(p=u[0]&31,d=0;d<p;d++)_=d*3,x={type:u[_+2]&3,pts:o},u[_+2]&4&&(x.ccData=u[_+3]<<8|u[_+4],c.push(x));return c},tp=function(o){for(var u=o.byteLength,c=[],d=1,p,_;d<u-2;)o[d]===0&&o[d+1]===0&&o[d+2]===3?(c.push(d+2),d+=2):d++;if(c.length===0)return o;p=u-c.length,_=new Uint8Array(p);var x=0;for(d=0;d<p;x++,d++)x===c[0]&&(x++,c.shift()),_[d]=o[x];return _},yl={parseSei:Jf,parseUserData:Zf,parseCaptionPackets:ep,discardEmulationPreventionBytes:tp,USER_DATA_REGISTERED_ITU_T_T35:gl},aa=t,kn=yl,ut=function(o){o=o||{},ut.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Le(0,0),new Le(0,1),new Le(1,0),new Le(1,1)],this.parse708captions_&&(this.cc708Stream_=new Se({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(u){u.on("data",this.trigger.bind(this,"data")),u.on("partialdone",this.trigger.bind(this,"partialdone")),u.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")))};ut.prototype=new aa,ut.prototype.push=function(o){var u,c,d;if(o.nalUnitType==="sei_rbsp"&&(u=kn.parseSei(o.escapedRBSP),!!u.payload&&u.payloadType===kn.USER_DATA_REGISTERED_ITU_T_T35&&(c=kn.parseUserData(u),!!c))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}d=kn.parseCaptionPackets(o.pts,c),this.captionPackets_=this.captionPackets_.concat(d),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},ut.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(u){return o==="flush"?u.flush():u.partialFlush()},this)},ut.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(u,c){u.presortIndex=c}),this.captionPackets_.sort(function(u,c){return u.pts===c.pts?u.presortIndex-c.presortIndex:u.pts-c.pts}),this.captionPackets_.forEach(function(u){u.type<2?this.dispatchCea608Packet(u):this.dispatchCea708Packet(u)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},ut.prototype.flush=function(){return this.flushStream("flush")},ut.prototype.partialFlush=function(){return this.flushStream("partialFlush")},ut.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},ut.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},ut.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},ut.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},ut.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},ut.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var ip={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},sp=function(o){var u=ip[o]||o;return o&4096&&o===u?"":String.fromCharCode(u)},Pn=function(o){return 32<=o&&o<=127||160<=o&&o<=255},ii=function(o){this.windowNum=o,this.reset()};ii.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},ii.prototype.getText=function(){return this.rows.join(`
|
|
193
|
-
`)},
|
|
196
|
+
`+i},Fm=function(i){return i.toString().replace(/^function.+?{/,"").slice(0,-1)},Wx=Um(Fm(function(){var i=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof oe.global<"u"?oe.global:typeof self<"u"?self:{},e=function(){this.init=function(){var o={};this.on=function(c,d){o[c]||(o[c]=[]),o[c]=o[c].concat(d)},this.off=function(c,d){var h;return o[c]?(h=o[c].indexOf(d),o[c]=o[c].slice(),o[c].splice(h,1),h>-1):!1},this.trigger=function(c){var d,h,m,_;if(d=o[c],!!d)if(arguments.length===2)for(m=d.length,h=0;h<m;++h)d[h].call(this,arguments[1]);else{for(_=[],h=arguments.length,h=1;h<arguments.length;++h)_.push(arguments[h]);for(m=d.length,h=0;h<m;++h)d[h].apply(this,_)}},this.dispose=function(){o={}}}};e.prototype.pipe=function(o){return this.on("data",function(c){o.push(c)}),this.on("done",function(c){o.flush(c)}),this.on("partialdone",function(c){o.partialFlush(c)}),this.on("endedtimeline",function(c){o.endTimeline(c)}),this.on("reset",function(c){o.reset(c)}),o},e.prototype.push=function(o){this.trigger("data",o)},e.prototype.flush=function(o){this.trigger("done",o)},e.prototype.partialFlush=function(o){this.trigger("partialdone",o)},e.prototype.endTimeline=function(o){this.trigger("endedtimeline",o)},e.prototype.reset=function(o){this.trigger("reset",o)};var t=e,r=Math.pow(2,32),s=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d;return c.getBigUint64?(d=c.getBigUint64(0),d<Number.MAX_SAFE_INTEGER?Number(d):d):c.getUint32(0)*r+c.getUint32(4)},n={getUint64:s,MAX_UINT32:r},a=n.MAX_UINT32,l,u,f,p,T,b,S,A,v,L,P,M,O,U,R,q,Y,K,ie,me,le,ge,ee,ce,te,de,ve,Ve,Ye,Ce,_e,St,Pt,Ie,pe,qe;(function(){var o;if(ee={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(o in ee)ee.hasOwnProperty(o)&&(ee[o]=[o.charCodeAt(0),o.charCodeAt(1),o.charCodeAt(2),o.charCodeAt(3)]);ce=new Uint8Array([105,115,111,109]),de=new Uint8Array([97,118,99,49]),te=new Uint8Array([0,0,0,1]),ve=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]),Ve=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]),Ye={video:ve,audio:Ve},St=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),_e=new Uint8Array([0,0,0,0,0,0,0,0]),Pt=new Uint8Array([0,0,0,0,0,0,0,0]),Ie=Pt,pe=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),qe=Pt,Ce=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),l=function(o){var c=[],d=0,h,m,_;for(h=1;h<arguments.length;h++)c.push(arguments[h]);for(h=c.length;h--;)d+=c[h].byteLength;for(m=new Uint8Array(d+8),_=new DataView(m.buffer,m.byteOffset,m.byteLength),_.setUint32(0,m.byteLength),m.set(o,4),h=0,d=8;h<c.length;h++)m.set(c[h],d),d+=c[h].byteLength;return m},u=function(){return l(ee.dinf,l(ee.dref,St))},f=function(o){return l(ee.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,o.audioobjecttype<<3|o.samplingfrequencyindex>>>1,o.samplingfrequencyindex<<7|o.channelcount<<3,6,1,2]))},p=function(){return l(ee.ftyp,ce,te,ce,de)},q=function(o){return l(ee.hdlr,Ye[o])},T=function(o){return l(ee.mdat,o)},R=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,o.duration>>>24&255,o.duration>>>16&255,o.duration>>>8&255,o.duration&255,85,196,0,0]);return o.samplerate&&(c[12]=o.samplerate>>>24&255,c[13]=o.samplerate>>>16&255,c[14]=o.samplerate>>>8&255,c[15]=o.samplerate&255),l(ee.mdhd,c)},U=function(o){return l(ee.mdia,R(o),q(o.type),S(o))},b=function(o){return l(ee.mfhd,new Uint8Array([0,0,0,0,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255]))},S=function(o){return l(ee.minf,o.type==="video"?l(ee.vmhd,Ce):l(ee.smhd,_e),u(),K(o))},A=function(o,c){for(var d=[],h=c.length;h--;)d[h]=me(c[h]);return l.apply(null,[ee.moof,b(o)].concat(d))},v=function(o){for(var c=o.length,d=[];c--;)d[c]=M(o[c]);return l.apply(null,[ee.moov,P(4294967295)].concat(d).concat(L(o)))},L=function(o){for(var c=o.length,d=[];c--;)d[c]=le(o[c]);return l.apply(null,[ee.mvex].concat(d))},P=function(o){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(o&4278190080)>>24,(o&16711680)>>16,(o&65280)>>8,o&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return l(ee.mvhd,c)},Y=function(o){var c=o.samples||[],d=new Uint8Array(4+c.length),h,m;for(m=0;m<c.length;m++)h=c[m].flags,d[m+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return l(ee.sdtp,d)},K=function(o){return l(ee.stbl,ie(o),l(ee.stts,qe),l(ee.stsc,Ie),l(ee.stsz,pe),l(ee.stco,Pt))},function(){var o,c;ie=function(d){return l(ee.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),d.type==="video"?o(d):c(d))},o=function(d){var h=d.sps||[],m=d.pps||[],_=[],E=[],C,D;for(C=0;C<h.length;C++)_.push((h[C].byteLength&65280)>>>8),_.push(h[C].byteLength&255),_=_.concat(Array.prototype.slice.call(h[C]));for(C=0;C<m.length;C++)E.push((m[C].byteLength&65280)>>>8),E.push(m[C].byteLength&255),E=E.concat(Array.prototype.slice.call(m[C]));if(D=[ee.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,(d.width&65280)>>8,d.width&255,(d.height&65280)>>8,d.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]),l(ee.avcC,new Uint8Array([1,d.profileIdc,d.profileCompatibility,d.levelIdc,255].concat([h.length],_,[m.length],E))),l(ee.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],d.sarRatio){var I=d.sarRatio[0],N=d.sarRatio[1];D.push(l(ee.pasp,new Uint8Array([(I&4278190080)>>24,(I&16711680)>>16,(I&65280)>>8,I&255,(N&4278190080)>>24,(N&16711680)>>16,(N&65280)>>8,N&255])))}return l.apply(null,D)},c=function(d){return l(ee.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(d.channelcount&65280)>>8,d.channelcount&255,(d.samplesize&65280)>>8,d.samplesize&255,0,0,0,0,(d.samplerate&65280)>>8,d.samplerate&255,0,0]),f(d))}}(),O=function(o){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,0,(o.duration&4278190080)>>24,(o.duration&16711680)>>16,(o.duration&65280)>>8,o.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(o.width&65280)>>8,o.width&255,0,0,(o.height&65280)>>8,o.height&255,0,0]);return l(ee.tkhd,c)},me=function(o){var c,d,h,m,_,E,C;return c=l(ee.tfhd,new Uint8Array([0,0,0,58,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),E=Math.floor(o.baseMediaDecodeTime/a),C=Math.floor(o.baseMediaDecodeTime%a),d=l(ee.tfdt,new Uint8Array([1,0,0,0,E>>>24&255,E>>>16&255,E>>>8&255,E&255,C>>>24&255,C>>>16&255,C>>>8&255,C&255])),_=92,o.type==="audio"?(h=ge(o,_),l(ee.traf,c,d,h)):(m=Y(o),h=ge(o,m.length+_),l(ee.traf,c,d,h,m))},M=function(o){return o.duration=o.duration||4294967295,l(ee.trak,O(o),U(o))},le=function(o){var c=new Uint8Array([0,0,0,0,(o.id&4278190080)>>24,(o.id&16711680)>>16,(o.id&65280)>>8,o.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return o.type!=="video"&&(c[c.length-1]=0),l(ee.trex,c)},function(){var o,c,d;d=function(h,m){var _=0,E=0,C=0,D=0;return h.length&&(h[0].duration!==void 0&&(_=1),h[0].size!==void 0&&(E=2),h[0].flags!==void 0&&(C=4),h[0].compositionTimeOffset!==void 0&&(D=8)),[0,0,_|E|C|D,1,(h.length&4278190080)>>>24,(h.length&16711680)>>>16,(h.length&65280)>>>8,h.length&255,(m&4278190080)>>>24,(m&16711680)>>>16,(m&65280)>>>8,m&255]},c=function(h,m){var _,E,C,D,I,N;for(D=h.samples||[],m+=20+16*D.length,C=d(D,m),E=new Uint8Array(C.length+D.length*16),E.set(C),_=C.length,N=0;N<D.length;N++)I=D[N],E[_++]=(I.duration&4278190080)>>>24,E[_++]=(I.duration&16711680)>>>16,E[_++]=(I.duration&65280)>>>8,E[_++]=I.duration&255,E[_++]=(I.size&4278190080)>>>24,E[_++]=(I.size&16711680)>>>16,E[_++]=(I.size&65280)>>>8,E[_++]=I.size&255,E[_++]=I.flags.isLeading<<2|I.flags.dependsOn,E[_++]=I.flags.isDependedOn<<6|I.flags.hasRedundancy<<4|I.flags.paddingValue<<1|I.flags.isNonSyncSample,E[_++]=I.flags.degradationPriority&61440,E[_++]=I.flags.degradationPriority&15,E[_++]=(I.compositionTimeOffset&4278190080)>>>24,E[_++]=(I.compositionTimeOffset&16711680)>>>16,E[_++]=(I.compositionTimeOffset&65280)>>>8,E[_++]=I.compositionTimeOffset&255;return l(ee.trun,E)},o=function(h,m){var _,E,C,D,I,N;for(D=h.samples||[],m+=20+8*D.length,C=d(D,m),_=new Uint8Array(C.length+D.length*8),_.set(C),E=C.length,N=0;N<D.length;N++)I=D[N],_[E++]=(I.duration&4278190080)>>>24,_[E++]=(I.duration&16711680)>>>16,_[E++]=(I.duration&65280)>>>8,_[E++]=I.duration&255,_[E++]=(I.size&4278190080)>>>24,_[E++]=(I.size&16711680)>>>16,_[E++]=(I.size&65280)>>>8,_[E++]=I.size&255;return l(ee.trun,_)},ge=function(h,m){return h.type==="audio"?o(h,m):c(h,m)}}();var dr={ftyp:p,mdat:T,moof:A,moov:v,initSegment:function(o){var c=p(),d=v(o),h;return h=new Uint8Array(c.byteLength+d.byteLength),h.set(c),h.set(d,c.byteLength),h}},Ai=function(o){var c,d,h=[],m=[];for(m.byteLength=0,m.nalCount=0,m.duration=0,h.byteLength=0,c=0;c<o.length;c++)d=o[c],d.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=d.dts-h.dts,m.byteLength+=h.byteLength,m.nalCount+=h.length,m.duration+=h.duration,m.push(h)),h=[d],h.byteLength=d.data.byteLength,h.pts=d.pts,h.dts=d.dts):(d.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=d.dts-h.dts,h.byteLength+=d.data.byteLength,h.push(d));return m.length&&(!h.duration||h.duration<=0)&&(h.duration=m[m.length-1].duration),m.byteLength+=h.byteLength,m.nalCount+=h.length,m.duration+=h.duration,m.push(h),m},wi=function(o){var c,d,h=[],m=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=o[0].pts,h.dts=o[0].dts,m.byteLength=0,m.nalCount=0,m.duration=0,m.pts=o[0].pts,m.dts=o[0].dts,c=0;c<o.length;c++)d=o[c],d.keyFrame?(h.length&&(m.push(h),m.byteLength+=h.byteLength,m.nalCount+=h.nalCount,m.duration+=h.duration),h=[d],h.nalCount=d.length,h.byteLength=d.byteLength,h.pts=d.pts,h.dts=d.dts,h.duration=d.duration):(h.duration+=d.duration,h.nalCount+=d.length,h.byteLength+=d.byteLength,h.push(d));return m.length&&h.duration<=0&&(h.duration=m[m.length-1].duration),m.byteLength+=h.byteLength,m.nalCount+=h.nalCount,m.duration+=h.duration,m.push(h),m},zi=function(o){var c;return!o[0][0].keyFrame&&o.length>1&&(c=o.shift(),o.byteLength-=c.byteLength,o.nalCount-=c.nalCount,o[0][0].dts=c.dts,o[0][0].pts=c.pts,o[0][0].duration+=c.duration),o},Et=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},Di=function(o,c){var d=Et();return d.dataOffset=c,d.compositionTimeOffset=o.pts-o.dts,d.duration=o.duration,d.size=4*o.length,d.size+=o.byteLength,o.keyFrame&&(d.flags.dependsOn=2,d.flags.isNonSyncSample=0),d},Xt=function(o,c){var d,h,m,_,E,C=c||0,D=[];for(d=0;d<o.length;d++)for(_=o[d],h=0;h<_.length;h++)E=_[h],m=Di(E,C),C+=m.size,D.push(m);return D},Wi=function(o){var c,d,h,m,_,E,C=0,D=o.byteLength,I=o.nalCount,N=D+4*I,V=new Uint8Array(N),Q=new DataView(V.buffer);for(c=0;c<o.length;c++)for(m=o[c],d=0;d<m.length;d++)for(_=m[d],h=0;h<_.length;h++)E=_[h],Q.setUint32(C,E.data.byteLength),C+=4,V.set(E.data,C),C+=E.data.byteLength;return V},jt=function(o,c){var d,h=c||0,m=[];return d=Di(o,h),m.push(d),m},Vt=function(o){var c,d,h=0,m=o.byteLength,_=o.length,E=m+4*_,C=new Uint8Array(E),D=new DataView(C.buffer);for(c=0;c<o.length;c++)d=o[c],D.setUint32(h,d.data.byteLength),h+=4,C.set(d.data,h),h+=d.data.byteLength;return C},Gi={groupNalsIntoFrames:Ai,groupFramesIntoGops:wi,extendFirstKeyFrame:zi,generateSampleTable:Xt,concatenateNalData:Wi,generateSampleTableForFrame:jt,concatenateNalDataForFrame:Vt},Yt=[33,16,5,32,164,27],ns=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],ye=function(o){for(var c=[];o--;)c.push(0);return c},to=function(o){return Object.keys(o).reduce(function(c,d){return c[d]=new Uint8Array(o[d].reduce(function(h,m){return h.concat(m)},[])),c},{})},as,fn=function(){if(!as){var o={96e3:[Yt,[227,64],ye(154),[56]],88200:[Yt,[231],ye(170),[56]],64e3:[Yt,[248,192],ye(240),[56]],48e3:[Yt,[255,192],ye(268),[55,148,128],ye(54),[112]],44100:[Yt,[255,192],ye(268),[55,163,128],ye(84),[112]],32e3:[Yt,[255,192],ye(268),[55,234],ye(226),[112]],24e3:[Yt,[255,192],ye(268),[55,255,128],ye(268),[111,112],ye(126),[224]],16e3:[Yt,[255,192],ye(268),[55,255,128],ye(268),[111,255],ye(269),[223,108],ye(195),[1,192]],12e3:[ns,ye(268),[3,127,248],ye(268),[6,255,240],ye(268),[13,255,224],ye(268),[27,253,128],ye(259),[56]],11025:[ns,ye(268),[3,127,248],ye(268),[6,255,240],ye(268),[13,255,224],ye(268),[27,255,192],ye(268),[55,175,128],ye(108),[112]],8e3:[ns,ye(268),[3,121,16],ye(47),[7]]};as=to(o)}return as},Ii=9e4,pt,Ki,hr,Lt,pn,x,g;pt=function(o){return o*Ii},Ki=function(o,c){return o*c},hr=function(o){return o/Ii},Lt=function(o,c){return o/c},pn=function(o,c){return pt(Lt(o,c))},x=function(o,c){return Ki(hr(o),c)},g=function(o,c,d){return hr(d?o:o-c)};var y={ONE_SECOND_IN_TS:Ii,secondsToVideoTs:pt,secondsToAudioTs:Ki,videoTsToSeconds:hr,audioTsToSeconds:Lt,audioTsToVideoTs:pn,videoTsToAudioTs:x,metadataTsToSeconds:g},w=fn,B=y,$=function(o){var c,d,h=0;for(c=0;c<o.length;c++)d=o[c],h+=d.data.byteLength;return h},W=function(o,c,d,h){var m,_=0,E=0,C=0,D=0,I,N,V;if(c.length&&(m=B.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),_=Math.ceil(B.ONE_SECOND_IN_TS/(o.samplerate/1024)),d&&h&&(E=m-Math.max(d,h),C=Math.floor(E/_),D=C*_),!(C<1||D>B.ONE_SECOND_IN_TS/2))){for(I=w()[o.samplerate],I||(I=c[0].data),N=0;N<C;N++)V=c[0],c.splice(0,0,{data:I,dts:V.dts-_,pts:V.pts-_});return o.baseMediaDecodeTime-=Math.floor(B.videoTsToAudioTs(D,o.samplerate)),D}},he=function(o,c,d){return c.minSegmentDts>=d?o:(c.minSegmentDts=1/0,o.filter(function(h){return h.dts>=d?(c.minSegmentDts=Math.min(c.minSegmentDts,h.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},Ne=function(o){var c,d,h=[];for(c=0;c<o.length;c++)d=o[c],h.push({size:d.data.byteLength,duration:1024});return h},ke=function(o){var c,d,h=0,m=new Uint8Array($(o));for(c=0;c<o.length;c++)d=o[c],m.set(d.data,h),h+=d.data.byteLength;return m},Be={prefixWithSilence:W,trimAdtsFramesByEarliestDts:he,generateSampleTable:Ne,concatenateFrameData:ke},be=y.ONE_SECOND_IN_TS,gg=function(o,c){typeof c.pts=="number"&&(o.timelineStartInfo.pts===void 0&&(o.timelineStartInfo.pts=c.pts),o.minSegmentPts===void 0?o.minSegmentPts=c.pts:o.minSegmentPts=Math.min(o.minSegmentPts,c.pts),o.maxSegmentPts===void 0?o.maxSegmentPts=c.pts:o.maxSegmentPts=Math.max(o.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(o.timelineStartInfo.dts===void 0&&(o.timelineStartInfo.dts=c.dts),o.minSegmentDts===void 0?o.minSegmentDts=c.dts:o.minSegmentDts=Math.min(o.minSegmentDts,c.dts),o.maxSegmentDts===void 0?o.maxSegmentDts=c.dts:o.maxSegmentDts=Math.max(o.maxSegmentDts,c.dts))},yg=function(o){delete o.minSegmentDts,delete o.maxSegmentDts,delete o.minSegmentPts,delete o.maxSegmentPts},_g=function(o,c){var d,h,m=o.minSegmentDts;return c||(m-=o.timelineStartInfo.dts),d=o.timelineStartInfo.baseMediaDecodeTime,d+=m,d=Math.max(0,d),o.type==="audio"&&(h=o.samplerate/be,d*=h,d=Math.floor(d)),d},Tg={clearDtsInfo:yg,calculateTrackBaseMediaDecodeTime:_g,collectDtsInfo:gg},ku=4,vg=128,bg=function(o){for(var c=0,d={payloadType:-1,payloadSize:0},h=0,m=0;c<o.byteLength&&o[c]!==vg;){for(;o[c]===255;)h+=255,c++;for(h+=o[c++];o[c]===255;)m+=255,c++;if(m+=o[c++],!d.payload&&h===ku){var _=String.fromCharCode(o[c+3],o[c+4],o[c+5],o[c+6]);if(_==="GA94"){d.payloadType=h,d.payloadSize=m,d.payload=o.subarray(c,c+m);break}else d.payload=void 0}c+=m,h=0,m=0}return d},xg=function(o){return o.payload[0]!==181||(o.payload[1]<<8|o.payload[2])!==49||String.fromCharCode(o.payload[3],o.payload[4],o.payload[5],o.payload[6])!=="GA94"||o.payload[7]!==3?null:o.payload.subarray(8,o.payload.length-1)},Sg=function(o,c){var d=[],h,m,_,E;if(!(c[0]&64))return d;for(m=c[0]&31,h=0;h<m;h++)_=h*3,E={type:c[_+2]&3,pts:o},c[_+2]&4&&(E.ccData=c[_+3]<<8|c[_+4],d.push(E));return d},Eg=function(o){for(var c=o.byteLength,d=[],h=1,m,_;h<c-2;)o[h]===0&&o[h+1]===0&&o[h+2]===3?(d.push(h+2),h+=2):h++;if(d.length===0)return o;m=c-d.length,_=new Uint8Array(m);var E=0;for(h=0;h<m;E++,h++)E===d[0]&&(E++,d.shift()),_[h]=o[E];return _},Pu={parseSei:bg,parseUserData:xg,parseCaptionPackets:Sg,discardEmulationPreventionBytes:Eg,USER_DATA_REGISTERED_ITU_T_T35:ku},io=t,mn=Pu,mt=function(o){o=o||{},mt.prototype.init.call(this),this.parse708captions_=typeof o.parse708captions=="boolean"?o.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Me(0,0),new Me(0,1),new Me(1,0),new Me(1,1)],this.parse708captions_&&(this.cc708Stream_=new we({captionServices:o.captionServices})),this.reset(),this.ccStreams_.forEach(function(c){c.on("data",this.trigger.bind(this,"data")),c.on("partialdone",this.trigger.bind(this,"partialdone")),c.on("done",this.trigger.bind(this,"done"))},this),this.parse708captions_&&(this.cc708Stream_.on("data",this.trigger.bind(this,"data")),this.cc708Stream_.on("partialdone",this.trigger.bind(this,"partialdone")),this.cc708Stream_.on("done",this.trigger.bind(this,"done")))};mt.prototype=new io,mt.prototype.push=function(o){var c,d,h;if(o.nalUnitType==="sei_rbsp"&&(c=mn.parseSei(o.escapedRBSP),!!c.payload&&c.payloadType===mn.USER_DATA_REGISTERED_ITU_T_T35&&(d=mn.parseUserData(c),!!d))){if(o.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(o.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=mn.parseCaptionPackets(o.pts,d),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==o.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=o.dts}},mt.prototype.flushCCStreams=function(o){this.ccStreams_.forEach(function(c){return o==="flush"?c.flush():c.partialFlush()},this)},mt.prototype.flushStream=function(o){if(!this.captionPackets_.length){this.flushCCStreams(o);return}this.captionPackets_.forEach(function(c,d){c.presortIndex=d}),this.captionPackets_.sort(function(c,d){return c.pts===d.pts?c.presortIndex-d.presortIndex:c.pts-d.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(o)},mt.prototype.flush=function(){return this.flushStream("flush")},mt.prototype.partialFlush=function(){return this.flushStream("partialFlush")},mt.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(o){o.reset()})},mt.prototype.dispatchCea608Packet=function(o){this.setsTextOrXDSActive(o)?this.activeCea608Channel_[o.type]=null:this.setsChannel1Active(o)?this.activeCea608Channel_[o.type]=0:this.setsChannel2Active(o)&&(this.activeCea608Channel_[o.type]=1),this.activeCea608Channel_[o.type]!==null&&this.ccStreams_[(o.type<<1)+this.activeCea608Channel_[o.type]].push(o)},mt.prototype.setsChannel1Active=function(o){return(o.ccData&30720)===4096},mt.prototype.setsChannel2Active=function(o){return(o.ccData&30720)===6144},mt.prototype.setsTextOrXDSActive=function(o){return(o.ccData&28928)===256||(o.ccData&30974)===4138||(o.ccData&30974)===6186},mt.prototype.dispatchCea708Packet=function(o){this.parse708captions_&&this.cc708Stream_.push(o)};var Cg={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},Ag=function(o){var c=Cg[o]||o;return o&4096&&o===c?"":String.fromCharCode(c)},gn=function(o){return 32<=o&&o<=127||160<=o&&o<=255},pi=function(o){this.windowNum=o,this.reset()};pi.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},pi.prototype.getText=function(){return this.rows.join(`
|
|
197
|
+
`)},pi.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},pi.prototype.newLine=function(o){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(o),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},pi.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},pi.prototype.addText=function(o){this.rows[this.rowIdx]+=o},pi.prototype.backspace=function(){if(!this.isEmpty()){var o=this.rows[this.rowIdx];this.rows[this.rowIdx]=o.substr(0,o.length-1)}};var yn=function(o,c,d){this.serviceNum=o,this.text="",this.currentWindow=new pi(-1),this.windows=[],this.stream=d,typeof c=="string"&&this.createTextDecoder(c)};yn.prototype.init=function(o,c){this.startPts=o;for(var d=0;d<8;d++)this.windows[d]=new pi(d),typeof c=="function"&&(this.windows[d].beforeRowOverflow=c)},yn.prototype.setCurrentWindow=function(o){this.currentWindow=this.windows[o]},yn.prototype.createTextDecoder=function(o){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(o)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+o+" encoding. "+c})}};var we=function(o){o=o||{},we.prototype.init.call(this);var c=this,d=o.captionServices||{},h={},m;Object.keys(d).forEach(_=>{m=d[_],/^SERVICE/.test(_)&&(h[_]=m.encoding)}),this.serviceEncodings=h,this.current708Packet=null,this.services={},this.push=function(_){_.type===3?(c.new708Packet(),c.add708Bytes(_)):(c.current708Packet===null&&c.new708Packet(),c.add708Bytes(_))}};we.prototype=new io,we.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},we.prototype.add708Bytes=function(o){var c=o.ccData,d=c>>>8,h=c&255;this.current708Packet.ptsVals.push(o.pts),this.current708Packet.data.push(d),this.current708Packet.data.push(h)},we.prototype.push708Packet=function(){var o=this.current708Packet,c=o.data,d=null,h=null,m=0,_=c[m++];for(o.seq=_>>6,o.sizeCode=_&63;m<c.length;m++)_=c[m++],d=_>>5,h=_&31,d===7&&h>0&&(_=c[m++],d=_),this.pushServiceBlock(d,m,h),h>0&&(m+=h-1)},we.prototype.pushServiceBlock=function(o,c,d){var h,m=c,_=this.current708Packet.data,E=this.services[o];for(E||(E=this.initService(o,m));m<c+d&&m<_.length;m++)h=_[m],gn(h)?m=this.handleText(m,E):h===24?m=this.multiByteCharacter(m,E):h===16?m=this.extendedCommands(m,E):128<=h&&h<=135?m=this.setCurrentWindow(m,E):152<=h&&h<=159?m=this.defineWindow(m,E):h===136?m=this.clearWindows(m,E):h===140?m=this.deleteWindows(m,E):h===137?m=this.displayWindows(m,E):h===138?m=this.hideWindows(m,E):h===139?m=this.toggleWindows(m,E):h===151?m=this.setWindowAttributes(m,E):h===144?m=this.setPenAttributes(m,E):h===145?m=this.setPenColor(m,E):h===146?m=this.setPenLocation(m,E):h===143?E=this.reset(m,E):h===8?E.currentWindow.backspace():h===12?E.currentWindow.clearText():h===13?E.currentWindow.pendingNewLine=!0:h===14?E.currentWindow.clearText():h===141&&m++},we.prototype.extendedCommands=function(o,c){var d=this.current708Packet.data,h=d[++o];return gn(h)&&(o=this.handleText(o,c,{isExtended:!0})),o},we.prototype.getPts=function(o){return this.current708Packet.ptsVals[Math.floor(o/2)]},we.prototype.initService=function(o,c){var h="SERVICE"+o,d=this,h,m;return h in this.serviceEncodings&&(m=this.serviceEncodings[h]),this.services[o]=new yn(o,m,d),this.services[o].init(this.getPts(c),function(_){d.flushDisplayed(_,d.services[o])}),this.services[o]},we.prototype.handleText=function(o,c,d){var h=d&&d.isExtended,m=d&&d.isMultiByte,_=this.current708Packet.data,E=h?4096:0,C=_[o],D=_[o+1],I=c.currentWindow,N,V;function Q(z){return z.map(re=>("0"+(re&255).toString(16)).slice(-2)).join("")}if(m?(V=[C,D],o++):V=[C],c.textDecoder_&&!h)N=c.textDecoder_.decode(new Uint8Array(V));else if(m){const z=Q(V);N=String.fromCharCode(parseInt(z,16))}else N=Ag(E|C);return I.pendingNewLine&&!I.isEmpty()&&I.newLine(this.getPts(o)),I.pendingNewLine=!1,I.addText(N),o},we.prototype.multiByteCharacter=function(o,c){var d=this.current708Packet.data,h=d[o+1],m=d[o+2];return gn(h)&&gn(m)&&(o=this.handleText(++o,c,{isMultiByte:!0})),o},we.prototype.setCurrentWindow=function(o,c){var d=this.current708Packet.data,h=d[o],m=h&7;return c.setCurrentWindow(m),o},we.prototype.defineWindow=function(o,c){var d=this.current708Packet.data,h=d[o],m=h&7;c.setCurrentWindow(m);var _=c.currentWindow;return h=d[++o],_.visible=(h&32)>>5,_.rowLock=(h&16)>>4,_.columnLock=(h&8)>>3,_.priority=h&7,h=d[++o],_.relativePositioning=(h&128)>>7,_.anchorVertical=h&127,h=d[++o],_.anchorHorizontal=h,h=d[++o],_.anchorPoint=(h&240)>>4,_.rowCount=h&15,h=d[++o],_.columnCount=h&63,h=d[++o],_.windowStyle=(h&56)>>3,_.penStyle=h&7,_.virtualRowCount=_.rowCount+1,o},we.prototype.setWindowAttributes=function(o,c){var d=this.current708Packet.data,h=d[o],m=c.currentWindow.winAttr;return h=d[++o],m.fillOpacity=(h&192)>>6,m.fillRed=(h&48)>>4,m.fillGreen=(h&12)>>2,m.fillBlue=h&3,h=d[++o],m.borderType=(h&192)>>6,m.borderRed=(h&48)>>4,m.borderGreen=(h&12)>>2,m.borderBlue=h&3,h=d[++o],m.borderType+=(h&128)>>5,m.wordWrap=(h&64)>>6,m.printDirection=(h&48)>>4,m.scrollDirection=(h&12)>>2,m.justify=h&3,h=d[++o],m.effectSpeed=(h&240)>>4,m.effectDirection=(h&12)>>2,m.displayEffect=h&3,o},we.prototype.flushDisplayed=function(o,c){for(var d=[],h=0;h<8;h++)c.windows[h].visible&&!c.windows[h].isEmpty()&&d.push(c.windows[h].getText());c.endPts=o,c.text=d.join(`
|
|
194
198
|
|
|
195
|
-
`),this.pushCaption(u),u.startPts=o},Se.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},Se.prototype.displayWindows=function(o,u){var c=this.current708Packet.data,d=c[++o],p=this.getPts(o);this.flushDisplayed(p,u);for(var _=0;_<8;_++)d&1<<_&&(u.windows[_].visible=1);return o},Se.prototype.hideWindows=function(o,u){var c=this.current708Packet.data,d=c[++o],p=this.getPts(o);this.flushDisplayed(p,u);for(var _=0;_<8;_++)d&1<<_&&(u.windows[_].visible=0);return o},Se.prototype.toggleWindows=function(o,u){var c=this.current708Packet.data,d=c[++o],p=this.getPts(o);this.flushDisplayed(p,u);for(var _=0;_<8;_++)d&1<<_&&(u.windows[_].visible^=1);return o},Se.prototype.clearWindows=function(o,u){var c=this.current708Packet.data,d=c[++o],p=this.getPts(o);this.flushDisplayed(p,u);for(var _=0;_<8;_++)d&1<<_&&u.windows[_].clearText();return o},Se.prototype.deleteWindows=function(o,u){var c=this.current708Packet.data,d=c[++o],p=this.getPts(o);this.flushDisplayed(p,u);for(var _=0;_<8;_++)d&1<<_&&u.windows[_].reset();return o},Se.prototype.setPenAttributes=function(o,u){var c=this.current708Packet.data,d=c[o],p=u.currentWindow.penAttr;return d=c[++o],p.textTag=(d&240)>>4,p.offset=(d&12)>>2,p.penSize=d&3,d=c[++o],p.italics=(d&128)>>7,p.underline=(d&64)>>6,p.edgeType=(d&56)>>3,p.fontStyle=d&7,o},Se.prototype.setPenColor=function(o,u){var c=this.current708Packet.data,d=c[o],p=u.currentWindow.penColor;return d=c[++o],p.fgOpacity=(d&192)>>6,p.fgRed=(d&48)>>4,p.fgGreen=(d&12)>>2,p.fgBlue=d&3,d=c[++o],p.bgOpacity=(d&192)>>6,p.bgRed=(d&48)>>4,p.bgGreen=(d&12)>>2,p.bgBlue=d&3,d=c[++o],p.edgeRed=(d&48)>>4,p.edgeGreen=(d&12)>>2,p.edgeBlue=d&3,o},Se.prototype.setPenLocation=function(o,u){var c=this.current708Packet.data,d=c[o],p=u.currentWindow.penLoc;return u.currentWindow.pendingNewLine=!0,d=c[++o],p.row=d&15,d=c[++o],p.column=d&63,o},Se.prototype.reset=function(o,u){var c=this.getPts(o);return this.flushDisplayed(c,u),this.initService(u.serviceNum,o)};var np={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},Ln=function(o){return o===null?"":(o=np[o]||o,String.fromCharCode(o))},On=14,rp=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Pi=function(){for(var o=[],u=On+1;u--;)o.push({text:"",indent:0,offset:0});return o},Le=function(o,u){Le.prototype.init.call(this),this.field_=o||0,this.dataChannel_=u||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(c){var d,p,_,x,S;if(d=c.ccData&32639,d===this.lastControlCode_){this.lastControlCode_=null;return}if((d&61440)===4096?this.lastControlCode_=d:d!==this.PADDING_&&(this.lastControlCode_=null),_=d>>>8,x=d&255,d!==this.PADDING_)if(d===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(d===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(c.pts),this.flushDisplayed(c.pts),p=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=p,this.startPts_=c.pts;else if(d===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(c.pts);else if(d===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(c.pts);else if(d===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(c.pts);else if(d===this.CARRIAGE_RETURN_)this.clearFormatting(c.pts),this.flushDisplayed(c.pts),this.shiftRowsUp_(),this.startPts_=c.pts;else if(d===this.BACKSPACE_)this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1);else if(d===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(c.pts),this.displayed_=Pi();else if(d===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Pi();else if(d===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(c.pts),this.displayed_=Pi()),this.mode_="paintOn",this.startPts_=c.pts;else if(this.isSpecialCharacter(_,x))_=(_&3)<<8,S=Ln(_|x),this[this.mode_](c.pts,S),this.column_++;else if(this.isExtCharacter(_,x))this.mode_==="popOn"?this.nonDisplayed_[this.row_].text=this.nonDisplayed_[this.row_].text.slice(0,-1):this.displayed_[this.row_].text=this.displayed_[this.row_].text.slice(0,-1),_=(_&3)<<8,S=Ln(_|x),this[this.mode_](c.pts,S),this.column_++;else if(this.isMidRowCode(_,x))this.clearFormatting(c.pts),this[this.mode_](c.pts," "),this.column_++,(x&14)===14&&this.addFormatting(c.pts,["i"]),(x&1)===1&&this.addFormatting(c.pts,["u"]);else if(this.isOffsetControlCode(_,x)){const A=x&3;this.nonDisplayed_[this.row_].offset=A,this.column_+=A}else if(this.isPAC(_,x)){var I=rp.indexOf(d&7968);if(this.mode_==="rollUp"&&(I-this.rollUpRows_+1<0&&(I=this.rollUpRows_-1),this.setRollUp(c.pts,I)),I!==this.row_&&I>=0&&I<=14&&(this.clearFormatting(c.pts),this.row_=I),x&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(c.pts,["u"]),(d&16)===16){const A=(d&14)>>1;this.column_=A*4,this.nonDisplayed_[this.row_].indent+=A}this.isColorPAC(x)&&(x&14)===14&&this.addFormatting(c.pts,["i"])}else this.isNormalChar(_)&&(x===0&&(x=null),S=Ln(_),S+=Ln(x),this[this.mode_](c.pts,S),this.column_+=S.length)}};Le.prototype=new aa,Le.prototype.flushDisplayed=function(o){const u=d=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+d+"."})},c=[];this.displayed_.forEach((d,p)=>{if(d&&d.text&&d.text.length){try{d.text=d.text.trim()}catch{u(p)}d.text.length&&c.push({text:d.text,line:p+1,position:10+Math.min(70,d.indent*10)+d.offset*2.5})}else d==null&&u(p)}),c.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:c,stream:this.name_})},Le.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Pi(),this.nonDisplayed_=Pi(),this.lastControlCode_=null,this.column_=0,this.row_=On,this.rollUpRows_=2,this.formatting_=[]},Le.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},Le.prototype.isSpecialCharacter=function(o,u){return o===this.EXT_&&u>=48&&u<=63},Le.prototype.isExtCharacter=function(o,u){return(o===this.EXT_+1||o===this.EXT_+2)&&u>=32&&u<=63},Le.prototype.isMidRowCode=function(o,u){return o===this.EXT_&&u>=32&&u<=47},Le.prototype.isOffsetControlCode=function(o,u){return o===this.OFFSET_&&u>=33&&u<=35},Le.prototype.isPAC=function(o,u){return o>=this.BASE_&&o<this.BASE_+8&&u>=64&&u<=127},Le.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Le.prototype.isNormalChar=function(o){return o>=32&&o<=127},Le.prototype.setRollUp=function(o,u){if(this.mode_!=="rollUp"&&(this.row_=On,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=Pi(),this.displayed_=Pi()),u!==void 0&&u!==this.row_)for(var c=0;c<this.rollUpRows_;c++)this.displayed_[u-c]=this.displayed_[this.row_-c],this.displayed_[this.row_-c]={text:"",indent:0,offset:0};u===void 0&&(u=this.row_),this.topRow_=u-this.rollUpRows_+1},Le.prototype.addFormatting=function(o,u){this.formatting_=this.formatting_.concat(u);var c=u.reduce(function(d,p){return d+"<"+p+">"},"");this[this.mode_](o,c)},Le.prototype.clearFormatting=function(o){if(this.formatting_.length){var u=this.formatting_.reverse().reduce(function(c,d){return c+"</"+d+">"},"");this.formatting_=[],this[this.mode_](o,u)}},Le.prototype.popOn=function(o,u){var c=this.nonDisplayed_[this.row_].text;c+=u,this.nonDisplayed_[this.row_].text=c},Le.prototype.rollUp=function(o,u){var c=this.displayed_[this.row_].text;c+=u,this.displayed_[this.row_].text=c},Le.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<On+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Le.prototype.paintOn=function(o,u){var c=this.displayed_[this.row_].text;c+=u,this.displayed_[this.row_].text=c};var _l={CaptionStream:ut,Cea608Stream:Le,Cea708Stream:Se},Rn={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},ap=t,op=8589934592,lp=4294967296,Tl="shared",oa=function(o,u){var c=1;for(o>u&&(c=-1);Math.abs(u-o)>lp;)o+=c*op;return o},la=function(o){var u,c;la.prototype.init.call(this),this.type_=o||Tl,this.push=function(d){if(d.type==="metadata"){this.trigger("data",d);return}this.type_!==Tl&&d.type!==this.type_||(c===void 0&&(c=d.dts),d.dts=oa(d.dts,c),d.pts=oa(d.pts,c),u=d.dts,this.trigger("data",d))},this.flush=function(){c=u,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){c=void 0,u=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};la.prototype=new ap;var vl={TimestampRolloverStream:la,handleRollover:oa},up=(o,u,c)=>{if(!o)return-1;for(var d=c;d<o.length;d++)if(o[d]===u)return d;return-1},cp={typedArrayIndexOf:up},Mn=cp.typedArrayIndexOf,Nn={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},bl=function(o,u,c){var d,p="";for(d=u;d<c;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},Os=function(o,u,c){return decodeURIComponent(bl(o,u,c))},Rs=function(o,u,c){return unescape(bl(o,u,c))},Ms=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Ns={APIC:function(o){var u=1,c,d,p="-->";o.data[0]===Nn.Utf8&&(c=Mn(o.data,0,u),!(c<0)&&(o.mimeType=Rs(o.data,u,c),u=c+1,o.pictureType=o.data[u],u++,d=Mn(o.data,0,u),!(d<0)&&(o.description=Os(o.data,u,d),u=d+1,o.mimeType===p?o.url=Rs(o.data,u,o.data.length):o.pictureData=o.data.subarray(u,o.data.length))))},"T*":function(o){o.data[0]===Nn.Utf8&&(o.value=Os(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var u;o.data[0]===Nn.Utf8&&(u=Mn(o.data,0,1),u!==-1&&(o.description=Os(o.data,1,u),o.value=Os(o.data,u+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=Rs(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var u;o.data[0]===Nn.Utf8&&(u=Mn(o.data,0,1),u!==-1&&(o.description=Os(o.data,1,u),o.url=Rs(o.data,u+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var u;for(u=0;u<o.data.length;u++)if(o.data[u]===0){o.owner=Rs(o.data,0,u);break}o.privateData=o.data.subarray(u+1),o.data=o.privateData}},dp=function(o){var u,c,d=10,p=0,_=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){p=Ms(o.subarray(6,10)),p+=10;var x=o[5]&64;x&&(d+=4,d+=Ms(o.subarray(10,14)),p-=Ms(o.subarray(16,20)));do{if(u=Ms(o.subarray(d+4,d+8)),u<1)break;c=String.fromCharCode(o[d],o[d+1],o[d+2],o[d+3]);var S={id:c,data:o.subarray(d+10,d+u+10)};S.key=S.id,Ns[S.id]?Ns[S.id](S):S.id[0]==="T"?Ns["T*"](S):S.id[0]==="W"&&Ns["W*"](S),_.push(S),d+=10,d+=u}while(d<p);return _}},xl={parseId3Frames:dp,parseSyncSafeInteger:Ms,frameParsers:Ns},hp=t,fp=Rn,fi=xl,Un;Un=function(o){var u={descriptor:o&&o.descriptor},c=0,d=[],p=0,_;if(Un.prototype.init.call(this),this.dispatchType=fp.METADATA_STREAM_TYPE.toString(16),u.descriptor)for(_=0;_<u.descriptor.length;_++)this.dispatchType+=("00"+u.descriptor[_].toString(16)).slice(-2);this.push=function(x){var S,I,A,O,j,Y;if(x.type==="timed-metadata"){if(x.dataAlignmentIndicator&&(p=0,d.length=0),d.length===0&&(x.data.length<10||x.data[0]!==73||x.data[1]!==68||x.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(d.push(x),p+=x.data.byteLength,d.length===1&&(c=fi.parseSyncSafeInteger(x.data.subarray(6,10)),c+=10),!(p<c)){for(S={data:new Uint8Array(c),frames:[],pts:d[0].pts,dts:d[0].dts},j=0;j<c;)S.data.set(d[0].data.subarray(0,c-j),j),j+=d[0].data.byteLength,p-=d[0].data.byteLength,d.shift();I=10,S.data[5]&64&&(I+=4,I+=fi.parseSyncSafeInteger(S.data.subarray(10,14)),c-=fi.parseSyncSafeInteger(S.data.subarray(16,20)));do{if(A=fi.parseSyncSafeInteger(S.data.subarray(I+4,I+8)),A<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Y=String.fromCharCode(S.data[I],S.data[I+1],S.data[I+2],S.data[I+3]),O={id:Y,data:S.data.subarray(I+10,I+A+10)},O.key=O.id,fi.frameParsers[O.id]?fi.frameParsers[O.id](O):O.id[0]==="T"?fi.frameParsers["T*"](O):O.id[0]==="W"&&fi.frameParsers["W*"](O),O.owner==="com.apple.streaming.transportStreamTimestamp"){var q=O.data,te=(q[3]&1)<<30|q[4]<<22|q[5]<<14|q[6]<<6|q[7]>>>2;te*=4,te+=q[7]&3,O.timeStamp=te,S.pts===void 0&&S.dts===void 0&&(S.pts=O.timeStamp,S.dts=O.timeStamp),this.trigger("timestamp",O)}S.frames.push(O),I+=10,I+=A}while(I<c);this.trigger("data",S)}}}},Un.prototype=new hp;var pp=Un,ua=t,ca=_l,Ot=Rn,mp=vl.TimestampRolloverStream,Bn,Us,Fn,Gi=188,da=71;Bn=function(){var o=new Uint8Array(Gi),u=0;Bn.prototype.init.call(this),this.push=function(c){var d=0,p=Gi,_;for(u?(_=new Uint8Array(c.byteLength+u),_.set(o.subarray(0,u)),_.set(c,u),u=0):_=c;p<_.byteLength;){if(_[d]===da&&_[p]===da){this.trigger("data",_.subarray(d,p)),d+=Gi,p+=Gi;continue}d++,p++}d<_.byteLength&&(o.set(_.subarray(d),0),u=_.byteLength-d)},this.flush=function(){u===Gi&&o[0]===da&&(this.trigger("data",o),u=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){u=0,this.trigger("reset")}},Bn.prototype=new ua,Us=function(){var o,u,c,d;Us.prototype.init.call(this),d=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(p,_){var x=0;_.payloadUnitStartIndicator&&(x+=p[x]+1),_.type==="pat"?u(p.subarray(x),_):c(p.subarray(x),_)},u=function(p,_){_.section_number=p[7],_.last_section_number=p[8],d.pmtPid=(p[10]&31)<<8|p[11],_.pmtPid=d.pmtPid},c=function(p,_){var x,S,I,A;if(p[5]&1){for(d.programMapTable={video:null,audio:null,"timed-metadata":{}},x=(p[1]&15)<<8|p[2],S=3+x-4,I=(p[10]&15)<<8|p[11],A=12+I;A<S;){var O=p[A],j=(p[A+1]&31)<<8|p[A+2];O===Ot.H264_STREAM_TYPE&&d.programMapTable.video===null?d.programMapTable.video=j:O===Ot.ADTS_STREAM_TYPE&&d.programMapTable.audio===null?d.programMapTable.audio=j:O===Ot.METADATA_STREAM_TYPE&&(d.programMapTable["timed-metadata"][j]=O),A+=((p[A+3]&15)<<8|p[A+4])+5}_.programMapTable=d.programMapTable}},this.push=function(p){var _={},x=4;if(_.payloadUnitStartIndicator=!!(p[1]&64),_.pid=p[1]&31,_.pid<<=8,_.pid|=p[2],(p[3]&48)>>>4>1&&(x+=p[x]+1),_.pid===0)_.type="pat",o(p.subarray(x),_),this.trigger("data",_);else if(_.pid===this.pmtPid)for(_.type="pmt",o(p.subarray(x),_),this.trigger("data",_);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([p,x,_]):this.processPes_(p,x,_)},this.processPes_=function(p,_,x){x.pid===this.programMapTable.video?x.streamType=Ot.H264_STREAM_TYPE:x.pid===this.programMapTable.audio?x.streamType=Ot.ADTS_STREAM_TYPE:x.streamType=this.programMapTable["timed-metadata"][x.pid],x.type="pes",x.data=p.subarray(_),this.trigger("data",x)}},Us.prototype=new ua,Us.STREAM_TYPES={h264:27,adts:15},Fn=function(){var o=this,u=!1,c={data:[],size:0},d={data:[],size:0},p={data:[],size:0},_,x=function(I,A){var O;const j=I[0]<<16|I[1]<<8|I[2];A.data=new Uint8Array,j===1&&(A.packetLength=6+(I[4]<<8|I[5]),A.dataAlignmentIndicator=(I[6]&4)!==0,O=I[7],O&192&&(A.pts=(I[9]&14)<<27|(I[10]&255)<<20|(I[11]&254)<<12|(I[12]&255)<<5|(I[13]&254)>>>3,A.pts*=4,A.pts+=(I[13]&6)>>>1,A.dts=A.pts,O&64&&(A.dts=(I[14]&14)<<27|(I[15]&255)<<20|(I[16]&254)<<12|(I[17]&255)<<5|(I[18]&254)>>>3,A.dts*=4,A.dts+=(I[18]&6)>>>1)),A.data=I.subarray(9+I[8]))},S=function(I,A,O){var j=new Uint8Array(I.size),Y={type:A},q=0,te=0,ne=!1,ze;if(!(!I.data.length||I.size<9)){for(Y.trackId=I.data[0].pid,q=0;q<I.data.length;q++)ze=I.data[q],j.set(ze.data,te),te+=ze.data.byteLength;x(j,Y),ne=A==="video"||Y.packetLength<=I.size,(O||ne)&&(I.size=0,I.data.length=0),ne&&o.trigger("data",Y)}};Fn.prototype.init.call(this),this.push=function(I){({pat:function(){},pes:function(){var A,O;switch(I.streamType){case Ot.H264_STREAM_TYPE:A=c,O="video";break;case Ot.ADTS_STREAM_TYPE:A=d,O="audio";break;case Ot.METADATA_STREAM_TYPE:A=p,O="timed-metadata";break;default:return}I.payloadUnitStartIndicator&&S(A,O,!0),A.data.push(I),A.size+=I.data.byteLength},pmt:function(){var A={type:"metadata",tracks:[]};_=I.programMapTable,_.video!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&A.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),u=!0,o.trigger("data",A)}})[I.type]()},this.reset=function(){c.size=0,c.data.length=0,d.size=0,d.data.length=0,this.trigger("reset")},this.flushStreams_=function(){S(c,"video"),S(d,"audio"),S(p,"timed-metadata")},this.flush=function(){if(!u&&_){var I={type:"metadata",tracks:[]};_.video!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),o.trigger("data",I)}u=!1,this.flushStreams_(),this.trigger("done")}},Fn.prototype=new ua;var Sl={PAT_PID:0,MP2T_PACKET_LENGTH:Gi,TransportPacketStream:Bn,TransportParseStream:Us,ElementaryStream:Fn,TimestampRolloverStream:mp,CaptionStream:ca.CaptionStream,Cea608Stream:ca.Cea608Stream,Cea708Stream:ca.Cea708Stream,MetadataStream:pp};for(var ha in Ot)Ot.hasOwnProperty(ha)&&(Sl[ha]=Ot[ha]);var gp=Sl,yp=t,_p=y.ONE_SECOND_IN_TS,$n,El=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];$n=function(o){var u,c=0;$n.prototype.init.call(this),this.skipWarn_=function(d,p){this.trigger("log",{level:"warn",message:`adts skiping bytes ${d} to ${p} in frame ${c} outside syncword`})},this.push=function(d){var p=0,_,x,S,I,A;if(o||(c=0),d.type==="audio"){u&&u.length?(S=u,u=new Uint8Array(S.byteLength+d.data.byteLength),u.set(S),u.set(d.data,S.byteLength)):u=d.data;for(var O;p+7<u.length;){if(u[p]!==255||(u[p+1]&246)!==240){typeof O!="number"&&(O=p),p++;continue}if(typeof O=="number"&&(this.skipWarn_(O,p),O=null),x=(~u[p+1]&1)*2,_=(u[p+3]&3)<<11|u[p+4]<<3|(u[p+5]&224)>>5,I=((u[p+6]&3)+1)*1024,A=I*_p/El[(u[p+2]&60)>>>2],u.byteLength-p<_)break;this.trigger("data",{pts:d.pts+c*A,dts:d.dts+c*A,sampleCount:I,audioobjecttype:(u[p+2]>>>6&3)+1,channelcount:(u[p+2]&1)<<2|(u[p+3]&192)>>>6,samplerate:El[(u[p+2]&60)>>>2],samplingfrequencyindex:(u[p+2]&60)>>>2,samplesize:16,data:u.subarray(p+7+x,p+_)}),c++,p+=_}typeof O=="number"&&(this.skipWarn_(O,p),O=null),u=u.subarray(p)}},this.flush=function(){c=0,this.trigger("done")},this.reset=function(){u=void 0,this.trigger("reset")},this.endTimeline=function(){u=void 0,this.trigger("endedtimeline")}},$n.prototype=new yp;var Tp=$n,Cl;Cl=function(o){var u=o.byteLength,c=0,d=0;this.length=function(){return 8*u},this.bitsAvailable=function(){return 8*u+d},this.loadWord=function(){var p=o.byteLength-u,_=new Uint8Array(4),x=Math.min(4,u);if(x===0)throw new Error("no bytes available");_.set(o.subarray(p,p+x)),c=new DataView(_.buffer).getUint32(0),d=x*8,u-=x},this.skipBits=function(p){var _;d>p?(c<<=p,d-=p):(p-=d,_=Math.floor(p/8),p-=_*8,u-=_,this.loadWord(),c<<=p,d-=p)},this.readBits=function(p){var _=Math.min(d,p),x=c>>>32-_;return d-=_,d>0?c<<=_:u>0&&this.loadWord(),_=p-_,_>0?x<<_|this.readBits(_):x},this.skipLeadingZeros=function(){var p;for(p=0;p<d;++p)if(c&2147483648>>>p)return c<<=p,d-=p,p;return this.loadWord(),p+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var p=this.skipLeadingZeros();return this.readBits(p+1)-1},this.readExpGolomb=function(){var p=this.readUnsignedExpGolomb();return 1&p?1+p>>>1:-1*(p>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var vp=Cl,wl=t,bp=vp,jn,Bs,Il;Bs=function(){var o=0,u,c;Bs.prototype.init.call(this),this.push=function(d){var p;c?(p=new Uint8Array(c.byteLength+d.data.byteLength),p.set(c),p.set(d.data,c.byteLength),c=p):c=d.data;for(var _=c.byteLength;o<_-3;o++)if(c[o+2]===1){u=o+5;break}for(;u<_;)switch(c[u]){case 0:if(c[u-1]!==0){u+=2;break}else if(c[u-2]!==0){u++;break}o+3!==u-2&&this.trigger("data",c.subarray(o+3,u-2));do u++;while(c[u]!==1&&u<_);o=u-2,u+=3;break;case 1:if(c[u-1]!==0||c[u-2]!==0){u+=3;break}this.trigger("data",c.subarray(o+3,u-2)),o=u-2,u+=3;break;default:u+=3;break}c=c.subarray(o),u-=o,o=0},this.reset=function(){c=null,o=0,this.trigger("reset")},this.flush=function(){c&&c.byteLength>3&&this.trigger("data",c.subarray(o+3)),c=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Bs.prototype=new wl,Il={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},jn=function(){var o=new Bs,u,c,d,p,_,x,S;jn.prototype.init.call(this),u=this,this.push=function(I){I.type==="video"&&(c=I.trackId,d=I.pts,p=I.dts,o.push(I))},o.on("data",function(I){var A={trackId:c,pts:d,dts:p,data:I,nalUnitTypeCode:I[0]&31};switch(A.nalUnitTypeCode){case 5:A.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:A.nalUnitType="sei_rbsp",A.escapedRBSP=_(I.subarray(1));break;case 7:A.nalUnitType="seq_parameter_set_rbsp",A.escapedRBSP=_(I.subarray(1)),A.config=x(A.escapedRBSP);break;case 8:A.nalUnitType="pic_parameter_set_rbsp";break;case 9:A.nalUnitType="access_unit_delimiter_rbsp";break}u.trigger("data",A)}),o.on("done",function(){u.trigger("done")}),o.on("partialdone",function(){u.trigger("partialdone")}),o.on("reset",function(){u.trigger("reset")}),o.on("endedtimeline",function(){u.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},S=function(I,A){var O=8,j=8,Y,q;for(Y=0;Y<I;Y++)j!==0&&(q=A.readExpGolomb(),j=(O+q+256)%256),O=j===0?O:j},_=function(I){for(var A=I.byteLength,O=[],j=1,Y,q;j<A-2;)I[j]===0&&I[j+1]===0&&I[j+2]===3?(O.push(j+2),j+=2):j++;if(O.length===0)return I;Y=A-O.length,q=new Uint8Array(Y);var te=0;for(j=0;j<Y;te++,j++)te===O[0]&&(te++,O.shift()),q[j]=I[te];return q},x=function(I){var A=0,O=0,j=0,Y=0,q,te,ne,ze,gt,gi,Ws,Gs,Ks,Xs,Zn,Ie=[1,1],Ys,Mt;if(q=new bp(I),te=q.readUnsignedByte(),ze=q.readUnsignedByte(),ne=q.readUnsignedByte(),q.skipUnsignedExpGolomb(),Il[te]&&(gt=q.readUnsignedExpGolomb(),gt===3&&q.skipBits(1),q.skipUnsignedExpGolomb(),q.skipUnsignedExpGolomb(),q.skipBits(1),q.readBoolean()))for(Zn=gt!==3?8:12,Mt=0;Mt<Zn;Mt++)q.readBoolean()&&(Mt<6?S(16,q):S(64,q));if(q.skipUnsignedExpGolomb(),gi=q.readUnsignedExpGolomb(),gi===0)q.readUnsignedExpGolomb();else if(gi===1)for(q.skipBits(1),q.skipExpGolomb(),q.skipExpGolomb(),Ws=q.readUnsignedExpGolomb(),Mt=0;Mt<Ws;Mt++)q.skipExpGolomb();if(q.skipUnsignedExpGolomb(),q.skipBits(1),Gs=q.readUnsignedExpGolomb(),Ks=q.readUnsignedExpGolomb(),Xs=q.readBits(1),Xs===0&&q.skipBits(1),q.skipBits(1),q.readBoolean()&&(A=q.readUnsignedExpGolomb(),O=q.readUnsignedExpGolomb(),j=q.readUnsignedExpGolomb(),Y=q.readUnsignedExpGolomb()),q.readBoolean()&&q.readBoolean()){switch(Ys=q.readUnsignedByte(),Ys){case 1:Ie=[1,1];break;case 2:Ie=[12,11];break;case 3:Ie=[10,11];break;case 4:Ie=[16,11];break;case 5:Ie=[40,33];break;case 6:Ie=[24,11];break;case 7:Ie=[20,11];break;case 8:Ie=[32,11];break;case 9:Ie=[80,33];break;case 10:Ie=[18,11];break;case 11:Ie=[15,11];break;case 12:Ie=[64,33];break;case 13:Ie=[160,99];break;case 14:Ie=[4,3];break;case 15:Ie=[3,2];break;case 16:Ie=[2,1];break;case 255:{Ie=[q.readUnsignedByte()<<8|q.readUnsignedByte(),q.readUnsignedByte()<<8|q.readUnsignedByte()];break}}Ie&&Ie[0]/Ie[1]}return{profileIdc:te,levelIdc:ne,profileCompatibility:ze,width:(Gs+1)*16-A*2-O*2,height:(2-Xs)*(Ks+1)*16-j*2-Y*2,sarRatio:Ie}}},jn.prototype=new wl;var xp={H264Stream:jn,NalByteStream:Bs},Sp=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Al=function(o,u){var c=o[u+6]<<21|o[u+7]<<14|o[u+8]<<7|o[u+9],d=o[u+5],p=(d&16)>>4;return c=c>=0?c:0,p?c+20:c+10},kl=function(o,u){return o.length-u<10||o[u]!==73||o[u+1]!==68||o[u+2]!==51?u:(u+=Al(o,u),kl(o,u))},Ep=function(o){var u=kl(o,0);return o.length>=u+2&&(o[u]&255)===255&&(o[u+1]&240)===240&&(o[u+1]&22)===16},Pl=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Cp=function(o,u,c){var d,p="";for(d=u;d<c;d++)p+="%"+("00"+o[d].toString(16)).slice(-2);return p},wp=function(o,u,c){return unescape(Cp(o,u,c))},Ip=function(o,u){var c=(o[u+5]&224)>>5,d=o[u+4]<<3,p=o[u+3]&6144;return p|d|c},Ap=function(o,u){return o[u]===73&&o[u+1]===68&&o[u+2]===51?"timed-metadata":o[u]&!0&&(o[u+1]&240)===240?"audio":null},kp=function(o){for(var u=0;u+5<o.length;){if(o[u]!==255||(o[u+1]&246)!==240){u++;continue}return Sp[(o[u+2]&60)>>>2]}return null},Pp=function(o){var u,c,d,p;u=10,o[5]&64&&(u+=4,u+=Pl(o.subarray(10,14)));do{if(c=Pl(o.subarray(u+4,u+8)),c<1)return null;if(p=String.fromCharCode(o[u],o[u+1],o[u+2],o[u+3]),p==="PRIV"){d=o.subarray(u+10,u+c+10);for(var _=0;_<d.byteLength;_++)if(d[_]===0){var x=wp(d,0,_);if(x==="com.apple.streaming.transportStreamTimestamp"){var S=d.subarray(_+1),I=(S[3]&1)<<30|S[4]<<22|S[5]<<14|S[6]<<6|S[7]>>>2;return I*=4,I+=S[7]&3,I}break}}u+=10,u+=c}while(u<o.byteLength);return null},fa={isLikelyAacData:Ep,parseId3TagSize:Al,parseAdtsSize:Ip,parseType:Ap,parseSampleRate:kp,parseAacTimestamp:Pp},Dp=t,Dl=fa,Vn;Vn=function(){var o=new Uint8Array,u=0;Vn.prototype.init.call(this),this.setTimestamp=function(c){u=c},this.push=function(c){var d=0,p=0,_,x,S,I;for(o.length?(I=o.length,o=new Uint8Array(c.byteLength+I),o.set(o.subarray(0,I)),o.set(c,I)):o=c;o.length-p>=3;){if(o[p]===73&&o[p+1]===68&&o[p+2]===51){if(o.length-p<10||(d=Dl.parseId3TagSize(o,p),p+d>o.length))break;x={type:"timed-metadata",data:o.subarray(p,p+d)},this.trigger("data",x),p+=d;continue}else if((o[p]&255)===255&&(o[p+1]&240)===240){if(o.length-p<7||(d=Dl.parseAdtsSize(o,p),p+d>o.length))break;S={type:"audio",data:o.subarray(p,p+d),pts:u,dts:u},this.trigger("data",S),p+=d;continue}p++}_=o.length-p,_>0?o=o.subarray(p):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},Vn.prototype=new Dp;var Lp=Vn,Op=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],Rp=Op,Mp=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],Np=Mp,Hn=t,Fs=zi,$s=Ai,qn=De,Rt=Yf,si=gp,zn=y,Ll=Tp,Up=xp.H264Stream,Bp=Lp,Fp=fa.isLikelyAacData,$p=y.ONE_SECOND_IN_TS,pa=Rp,ma=Np,js,Ki,Wn,Di,jp=function(o,u){u.stream=o,this.trigger("log",u)},Ol=function(o,u){for(var c=Object.keys(u),d=0;d<c.length;d++){var p=c[d];p==="headOfPipeline"||!u[p].on||u[p].on("log",jp.bind(o,p))}},Rl=function(o,u){var c;if(o.length!==u.length)return!1;for(c=0;c<o.length;c++)if(o[c]!==u[c])return!1;return!0},ga=function(o,u,c,d,p,_){var x=c-u,S=d-u,I=p-c;return{start:{dts:o,pts:o+x},end:{dts:o+S,pts:o+I},prependedContentDuration:_,baseMediaDecodeTime:o}};Ki=function(o,u){var c=[],d,p=0,_=0,x=1/0;u=u||{},d=u.firstSequenceNumber||0,Ki.prototype.init.call(this),this.push=function(S){Rt.collectDtsInfo(o,S),o&&pa.forEach(function(I){o[I]=S[I]}),c.push(S)},this.setEarliestDts=function(S){p=S},this.setVideoBaseMediaDecodeTime=function(S){x=S},this.setAudioAppendStart=function(S){_=S},this.flush=function(){var S,I,A,O,j,Y,q;if(c.length===0){this.trigger("done","AudioSegmentStream");return}S=qn.trimAdtsFramesByEarliestDts(c,o,p),o.baseMediaDecodeTime=Rt.calculateTrackBaseMediaDecodeTime(o,u.keepOriginalTimestamps),q=qn.prefixWithSilence(o,S,_,x),o.samples=qn.generateSampleTable(S),A=Fs.mdat(qn.concatenateFrameData(S)),c=[],I=Fs.moof(d,[o]),O=new Uint8Array(I.byteLength+A.byteLength),d++,O.set(I),O.set(A,I.byteLength),Rt.clearDtsInfo(o),j=Math.ceil($p*1024/o.samplerate),S.length&&(Y=S.length*j,this.trigger("segmentTimingInfo",ga(zn.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),S[0].dts,S[0].pts,S[0].dts+Y,S[0].pts+Y,q||0)),this.trigger("timingInfo",{start:S[0].pts,end:S[0].pts+Y})),this.trigger("data",{track:o,boxes:O}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Rt.clearDtsInfo(o),c=[],this.trigger("reset")}},Ki.prototype=new Hn,js=function(o,u){var c,d=[],p=[],_,x;u=u||{},c=u.firstSequenceNumber||0,js.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(S){Rt.collectDtsInfo(o,S),S.nalUnitType==="seq_parameter_set_rbsp"&&!_&&(_=S.config,o.sps=[S.data],ma.forEach(function(I){o[I]=_[I]},this)),S.nalUnitType==="pic_parameter_set_rbsp"&&!x&&(x=S.data,o.pps=[S.data]),d.push(S)},this.flush=function(){for(var S,I,A,O,j,Y,q=0,te,ne;d.length&&d[0].nalUnitType!=="access_unit_delimiter_rbsp";)d.shift();if(d.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(S=$s.groupNalsIntoFrames(d),A=$s.groupFramesIntoGops(S),A[0][0].keyFrame||(I=this.getGopForFusion_(d[0],o),I?(q=I.duration,A.unshift(I),A.byteLength+=I.byteLength,A.nalCount+=I.nalCount,A.pts=I.pts,A.dts=I.dts,A.duration+=I.duration):A=$s.extendFirstKeyFrame(A)),p.length){var ze;if(u.alignGopsAtEnd?ze=this.alignGopsAtEnd_(A):ze=this.alignGopsAtStart_(A),!ze){this.gopCache_.unshift({gop:A.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),d=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Rt.clearDtsInfo(o),A=ze}Rt.collectDtsInfo(o,A),o.samples=$s.generateSampleTable(A),j=Fs.mdat($s.concatenateNalData(A)),o.baseMediaDecodeTime=Rt.calculateTrackBaseMediaDecodeTime(o,u.keepOriginalTimestamps),this.trigger("processedGopsInfo",A.map(function(gt){return{pts:gt.pts,dts:gt.dts,byteLength:gt.byteLength}})),te=A[0],ne=A[A.length-1],this.trigger("segmentTimingInfo",ga(o.baseMediaDecodeTime,te.dts,te.pts,ne.dts+ne.duration,ne.pts+ne.duration,q)),this.trigger("timingInfo",{start:A[0].pts,end:A[A.length-1].pts+A[A.length-1].duration}),this.gopCache_.unshift({gop:A.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),d=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),O=Fs.moof(c,[o]),Y=new Uint8Array(O.byteLength+j.byteLength),c++,Y.set(O),Y.set(j,O.byteLength),this.trigger("data",{track:o,boxes:Y}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),d=[],this.gopCache_.length=0,p.length=0,this.trigger("reset")},this.resetStream_=function(){Rt.clearDtsInfo(o),_=void 0,x=void 0},this.getGopForFusion_=function(S){var I=45e3,A=1e4,O=1/0,j,Y,q,te,ne;for(ne=0;ne<this.gopCache_.length;ne++)te=this.gopCache_[ne],q=te.gop,!(!(o.pps&&Rl(o.pps[0],te.pps[0]))||!(o.sps&&Rl(o.sps[0],te.sps[0])))&&(q.dts<o.timelineStartInfo.dts||(j=S.dts-q.dts-q.duration,j>=-A&&j<=I&&(!Y||O>j)&&(Y=te,O=j)));return Y?Y.gop:null},this.alignGopsAtStart_=function(S){var I,A,O,j,Y,q,te,ne;for(Y=S.byteLength,q=S.nalCount,te=S.duration,I=A=0;I<p.length&&A<S.length&&(O=p[I],j=S[A],O.pts!==j.pts);){if(j.pts>O.pts){I++;continue}A++,Y-=j.byteLength,q-=j.nalCount,te-=j.duration}return A===0?S:A===S.length?null:(ne=S.slice(A),ne.byteLength=Y,ne.duration=te,ne.nalCount=q,ne.pts=ne[0].pts,ne.dts=ne[0].dts,ne)},this.alignGopsAtEnd_=function(S){var I,A,O,j,Y,q;for(I=p.length-1,A=S.length-1,Y=null,q=!1;I>=0&&A>=0;){if(O=p[I],j=S[A],O.pts===j.pts){q=!0;break}if(O.pts>j.pts){I--;continue}I===p.length-1&&(Y=A),A--}if(!q&&Y===null)return null;var te;if(q?te=A:te=Y,te===0)return S;var ne=S.slice(te),ze=ne.reduce(function(gt,gi){return gt.byteLength+=gi.byteLength,gt.duration+=gi.duration,gt.nalCount+=gi.nalCount,gt},{byteLength:0,duration:0,nalCount:0});return ne.byteLength=ze.byteLength,ne.duration=ze.duration,ne.nalCount=ze.nalCount,ne.pts=ne[0].pts,ne.dts=ne[0].dts,ne},this.alignGopsWith=function(S){p=S}},js.prototype=new Hn,Di=function(o,u){this.numberOfTracks=0,this.metadataStream=u,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Di.prototype.init.call(this),this.push=function(c){if(c.content||c.text)return this.pendingCaptions.push(c);if(c.frames)return this.pendingMetadata.push(c);this.pendingTracks.push(c.track),this.pendingBytes+=c.boxes.byteLength,c.track.type==="video"&&(this.videoTrack=c.track,this.pendingBoxes.push(c.boxes)),c.track.type==="audio"&&(this.audioTrack=c.track,this.pendingBoxes.unshift(c.boxes))}},Di.prototype=new Hn,Di.prototype.flush=function(o){var u=0,c={captions:[],captionStreams:{},metadata:[],info:{}},d,p,_,x=0,S;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(x=this.videoTrack.timelineStartInfo.pts,ma.forEach(function(I){c.info[I]=this.videoTrack[I]},this)):this.audioTrack&&(x=this.audioTrack.timelineStartInfo.pts,pa.forEach(function(I){c.info[I]=this.audioTrack[I]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?c.type=this.pendingTracks[0].type:c.type="combined",this.emittedTracks+=this.pendingTracks.length,_=Fs.initSegment(this.pendingTracks),c.initSegment=new Uint8Array(_.byteLength),c.initSegment.set(_),c.data=new Uint8Array(this.pendingBytes),S=0;S<this.pendingBoxes.length;S++)c.data.set(this.pendingBoxes[S],u),u+=this.pendingBoxes[S].byteLength;for(S=0;S<this.pendingCaptions.length;S++)d=this.pendingCaptions[S],d.startTime=zn.metadataTsToSeconds(d.startPts,x,this.keepOriginalTimestamps),d.endTime=zn.metadataTsToSeconds(d.endPts,x,this.keepOriginalTimestamps),c.captionStreams[d.stream]=!0,c.captions.push(d);for(S=0;S<this.pendingMetadata.length;S++)p=this.pendingMetadata[S],p.cueTime=zn.metadataTsToSeconds(p.pts,x,this.keepOriginalTimestamps),c.metadata.push(p);for(c.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",c),S=0;S<c.captions.length;S++)d=c.captions[S],this.trigger("caption",d);for(S=0;S<c.metadata.length;S++)p=c.metadata[S],this.trigger("id3Frame",p)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Di.prototype.setRemux=function(o){this.remuxTracks=o},Wn=function(o){var u=this,c=!0,d,p;Wn.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="aac",_.metadataStream=new si.MetadataStream,_.aacStream=new Bp,_.audioTimestampRolloverStream=new si.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new si.TimestampRolloverStream("timed-metadata"),_.adtsStream=new Ll,_.coalesceStream=new Di(o,_.metadataStream),_.headOfPipeline=_.aacStream,_.aacStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.aacStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.metadataStream.on("timestamp",function(x){_.aacStream.setTimestamp(x.timeStamp)}),_.aacStream.on("data",function(x){x.type!=="timed-metadata"&&x.type!=="audio"||_.audioSegmentStream||(p=p||{timelineStartInfo:{baseMediaDecodeTime:u.baseMediaDecodeTime},codec:"adts",type:"audio"},_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new Ki(p,o),_.audioSegmentStream.on("log",u.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",u.trigger.bind(u,"audioTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream),u.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d}))}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),Ol(this,_)},this.setupTsPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="ts",_.metadataStream=new si.MetadataStream,_.packetStream=new si.TransportPacketStream,_.parseStream=new si.TransportParseStream,_.elementaryStream=new si.ElementaryStream,_.timestampRolloverStream=new si.TimestampRolloverStream,_.adtsStream=new Ll,_.h264Stream=new Up,_.captionStream=new si.CaptionStream(o),_.coalesceStream=new Di(o,_.metadataStream),_.headOfPipeline=_.packetStream,_.packetStream.pipe(_.parseStream).pipe(_.elementaryStream).pipe(_.timestampRolloverStream),_.timestampRolloverStream.pipe(_.h264Stream),_.timestampRolloverStream.pipe(_.adtsStream),_.timestampRolloverStream.pipe(_.metadataStream).pipe(_.coalesceStream),_.h264Stream.pipe(_.captionStream).pipe(_.coalesceStream),_.elementaryStream.on("data",function(x){var S;if(x.type==="metadata"){for(S=x.tracks.length;S--;)!d&&x.tracks[S].type==="video"?(d=x.tracks[S],d.timelineStartInfo.baseMediaDecodeTime=u.baseMediaDecodeTime):!p&&x.tracks[S].type==="audio"&&(p=x.tracks[S],p.timelineStartInfo.baseMediaDecodeTime=u.baseMediaDecodeTime);d&&!_.videoSegmentStream&&(_.coalesceStream.numberOfTracks++,_.videoSegmentStream=new js(d,o),_.videoSegmentStream.on("log",u.getLogTrigger_("videoSegmentStream")),_.videoSegmentStream.on("timelineStartInfo",function(I){p&&!o.keepOriginalTimestamps&&(p.timelineStartInfo=I,_.audioSegmentStream.setEarliestDts(I.dts-u.baseMediaDecodeTime))}),_.videoSegmentStream.on("processedGopsInfo",u.trigger.bind(u,"gopInfo")),_.videoSegmentStream.on("segmentTimingInfo",u.trigger.bind(u,"videoSegmentTimingInfo")),_.videoSegmentStream.on("baseMediaDecodeTime",function(I){p&&_.audioSegmentStream.setVideoBaseMediaDecodeTime(I)}),_.videoSegmentStream.on("timingInfo",u.trigger.bind(u,"videoTimingInfo")),_.h264Stream.pipe(_.videoSegmentStream).pipe(_.coalesceStream)),p&&!_.audioSegmentStream&&(_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new Ki(p,o),_.audioSegmentStream.on("log",u.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",u.trigger.bind(u,"audioTimingInfo")),_.audioSegmentStream.on("segmentTimingInfo",u.trigger.bind(u,"audioSegmentTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream)),u.trigger("trackinfo",{hasAudio:!!p,hasVideo:!!d})}}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("id3Frame",function(x){x.dispatchType=_.metadataStream.dispatchType,u.trigger("id3Frame",x)}),_.coalesceStream.on("caption",this.trigger.bind(this,"caption")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),Ol(this,_)},this.setBaseMediaDecodeTime=function(_){var x=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=_),p&&(p.timelineStartInfo.dts=void 0,p.timelineStartInfo.pts=void 0,Rt.clearDtsInfo(p),x.audioTimestampRolloverStream&&x.audioTimestampRolloverStream.discontinuity()),d&&(x.videoSegmentStream&&(x.videoSegmentStream.gopCache_=[]),d.timelineStartInfo.dts=void 0,d.timelineStartInfo.pts=void 0,Rt.clearDtsInfo(d),x.captionStream.reset()),x.timestampRolloverStream&&x.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(_){p&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(_)},this.setRemux=function(_){var x=this.transmuxPipeline_;o.remux=_,x&&x.coalesceStream&&x.coalesceStream.setRemux(_)},this.alignGopsWith=function(_){d&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(_)},this.getLogTrigger_=function(_){var x=this;return function(S){S.stream=_,x.trigger("log",S)}},this.push=function(_){if(c){var x=Fp(_);x&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!x&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),c=!1}this.transmuxPipeline_.headOfPipeline.push(_)},this.flush=function(){c=!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()}},Wn.prototype=new Hn;var Vp={Transmuxer:Wn,VideoSegmentStream:js,AudioSegmentStream:Ki,AUDIO_PROPERTIES:pa,VIDEO_PROPERTIES:ma,generateSegmentTimingInfo:ga},Hp=function(o){return o>>>0},qp=function(o){return("00"+o.toString(16)).slice(-2)},Gn={toUnsigned:Hp,toHexString:qp},zp=function(o){var u="";return u+=String.fromCharCode(o[0]),u+=String.fromCharCode(o[1]),u+=String.fromCharCode(o[2]),u+=String.fromCharCode(o[3]),u},ya=zp,Wp=Gn.toUnsigned,Gp=ya,Ml=function(o,u){var c=[],d,p,_,x,S;if(!u.length)return null;for(d=0;d<o.byteLength;)p=Wp(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3]),_=Gp(o.subarray(d+4,d+8)),x=p>1?d+p:o.byteLength,_===u[0]&&(u.length===1?c.push(o.subarray(d+8,x)):(S=Ml(o.subarray(d+8,x),u.slice(1)),S.length&&(c=c.concat(S)))),d=x;return c},Kn=Ml,Kp=Gn.toUnsigned,Xp=r.getUint64,Yp=function(o){var u={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return u.version===1?u.baseMediaDecodeTime=Xp(o.subarray(4)):u.baseMediaDecodeTime=Kp(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),u},_a=Yp,Qp=function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:u.getUint32(4)},d=c.flags[2]&1,p=c.flags[2]&2,_=c.flags[2]&8,x=c.flags[2]&16,S=c.flags[2]&32,I=c.flags[0]&65536,A=c.flags[0]&131072,O;return O=8,d&&(O+=4,c.baseDataOffset=u.getUint32(12),O+=4),p&&(c.sampleDescriptionIndex=u.getUint32(O),O+=4),_&&(c.defaultSampleDuration=u.getUint32(O),O+=4),x&&(c.defaultSampleSize=u.getUint32(O),O+=4),S&&(c.defaultSampleFlags=u.getUint32(O)),I&&(c.durationIsEmpty=!0),!d&&A&&(c.baseDataOffsetIsMoof=!0),c},Ta=Qp,Nl=r.getUint64,Jp=function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),references:[],referenceId:u.getUint32(4),timescale:u.getUint32(8)},d=12;c.version===0?(c.earliestPresentationTime=u.getUint32(d),c.firstOffset=u.getUint32(d+4),d+=8):(c.earliestPresentationTime=Nl(o.subarray(d)),c.firstOffset=Nl(o.subarray(d+8)),d+=16),d+=2;var p=u.getUint16(d);for(d+=2;p>0;d+=12,p--)c.references.push({referenceType:(o[d]&128)>>>7,referencedSize:u.getUint32(d)&2147483647,subsegmentDuration:u.getUint32(d+4),startsWithSap:!!(o[d+8]&128),sapType:(o[d+8]&112)>>>4,sapDeltaTime:u.getUint32(d+8)&268435455});return c},Zp=Jp,em=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},tm=em,Ul=tm,im=function(o){var u={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=u.flags[2]&1,p=u.flags[2]&4,_=u.flags[1]&1,x=u.flags[1]&2,S=u.flags[1]&4,I=u.flags[1]&8,A=c.getUint32(4),O=8,j;for(d&&(u.dataOffset=c.getInt32(O),O+=4),p&&A&&(j={flags:Ul(o.subarray(O,O+4))},O+=4,_&&(j.duration=c.getUint32(O),O+=4),x&&(j.size=c.getUint32(O),O+=4),I&&(u.version===1?j.compositionTimeOffset=c.getInt32(O):j.compositionTimeOffset=c.getUint32(O),O+=4),u.samples.push(j),A--);A--;)j={},_&&(j.duration=c.getUint32(O),O+=4),x&&(j.size=c.getUint32(O),O+=4),S&&(j.flags=Ul(o.subarray(O,O+4)),O+=4),I&&(u.version===1?j.compositionTimeOffset=c.getInt32(O):j.compositionTimeOffset=c.getUint32(O),O+=4),u.samples.push(j);return u},Bl=im,sm=r,Fl=sm.getUint64,Je,va,Et=function(o){return new Date(o*1e3-20828448e5)},Vs=ya,nm=Kn,rm=function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c=[],d,p;for(d=0;d+4<o.length;d+=p){if(p=u.getUint32(d),d+=4,p<=0){c.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(o[d]&31){case 1:c.push("slice_layer_without_partitioning_rbsp");break;case 5:c.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:c.push("sei_rbsp");break;case 7:c.push("seq_parameter_set_rbsp");break;case 8:c.push("pic_parameter_set_rbsp");break;case 9:c.push("access_unit_delimiter_rbsp");break;default:c.push("UNKNOWN NAL - "+o[d]&31);break}}return c},pi={avc1:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength);return{dataReferenceIndex:u.getUint16(6),width:u.getUint16(24),height:u.getUint16(26),horizresolution:u.getUint16(28)+u.getUint16(30)/16,vertresolution:u.getUint16(32)+u.getUint16(34)/16,frameCount:u.getUint16(40),depth:u.getUint16(74),config:Je(o.subarray(78,o.byteLength))}},avcC:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={configurationVersion:o[0],avcProfileIndication:o[1],profileCompatibility:o[2],avcLevelIndication:o[3],lengthSizeMinusOne:o[4]&3,sps:[],pps:[]},d=o[5]&31,p,_,x,S;for(x=6,S=0;S<d;S++)_=u.getUint16(x),x+=2,c.sps.push(new Uint8Array(o.subarray(x,x+_))),x+=_;for(p=o[x],x++,S=0;S<p;S++)_=u.getUint16(x),x+=2,c.pps.push(new Uint8Array(o.subarray(x,x+_))),x+=_;return c},btrt:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength);return{bufferSizeDB:u.getUint32(0),maxBitrate:u.getUint32(4),avgBitrate:u.getUint32(8)}},edts:function(u){return{boxes:Je(u)}},elst:function(u){var c=new DataView(u.buffer,u.byteOffset,u.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(u.subarray(1,4)),edits:[]},p=c.getUint32(4),_;for(_=8;p;p--)d.version===0?(d.edits.push({segmentDuration:c.getUint32(_),mediaTime:c.getInt32(_+4),mediaRate:c.getUint16(_+8)+c.getUint16(_+10)/(256*256)}),_+=12):(d.edits.push({segmentDuration:Fl(u.subarray(_)),mediaTime:Fl(u.subarray(_+8)),mediaRate:c.getUint16(_+16)+c.getUint16(_+18)/(256*256)}),_+=20);return d},esds:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),esId:o[6]<<8|o[7],streamPriority:o[8]&31,decoderConfig:{objectProfileIndication:o[11],streamType:o[12]>>>2&63,bufferSize:o[13]<<16|o[14]<<8|o[15],maxBitrate:o[16]<<24|o[17]<<16|o[18]<<8|o[19],avgBitrate:o[20]<<24|o[21]<<16|o[22]<<8|o[23],decoderConfigDescriptor:{tag:o[24],length:o[25],audioObjectType:o[26]>>>3&31,samplingFrequencyIndex:(o[26]&7)<<1|o[27]>>>7&1,channelConfiguration:o[27]>>>3&15}}}},ftyp:function(o){for(var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={majorBrand:Vs(o.subarray(0,4)),minorVersion:u.getUint32(4),compatibleBrands:[]},d=8;d<o.byteLength;)c.compatibleBrands.push(Vs(o.subarray(d,d+4))),d+=4;return c},dinf:function(o){return{boxes:Je(o)}},dref:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),dataReferences:Je(o.subarray(8))}},hdlr:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),handlerType:Vs(o.subarray(8,12)),name:""},d=8;for(d=24;d<o.byteLength;d++){if(o[d]===0){d++;break}c.name+=String.fromCharCode(o[d])}return c.name=decodeURIComponent(escape(c.name)),c},mdat:function(o){return{byteLength:o.byteLength,nals:rm(o)}},mdhd:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c=4,d,p={version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),language:""};return p.version===1?(c+=4,p.creationTime=Et(u.getUint32(c)),c+=8,p.modificationTime=Et(u.getUint32(c)),c+=4,p.timescale=u.getUint32(c),c+=8,p.duration=u.getUint32(c)):(p.creationTime=Et(u.getUint32(c)),c+=4,p.modificationTime=Et(u.getUint32(c)),c+=4,p.timescale=u.getUint32(c),c+=4,p.duration=u.getUint32(c)),c+=4,d=u.getUint16(c),p.language+=String.fromCharCode((d>>10)+96),p.language+=String.fromCharCode(((d&992)>>5)+96),p.language+=String.fromCharCode((d&31)+96),p},mdia:function(o){return{boxes:Je(o)}},mfhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sequenceNumber:o[4]<<24|o[5]<<16|o[6]<<8|o[7]}},minf:function(o){return{boxes:Je(o)}},mp4a:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={dataReferenceIndex:u.getUint16(6),channelcount:u.getUint16(16),samplesize:u.getUint16(18),samplerate:u.getUint16(24)+u.getUint16(26)/65536};return o.byteLength>28&&(c.streamDescriptor=Je(o.subarray(28))[0]),c},moof:function(o){return{boxes:Je(o)}},moov:function(o){return{boxes:Je(o)}},mvex:function(o){return{boxes:Je(o)}},mvhd:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c=4,d={version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return d.version===1?(c+=4,d.creationTime=Et(u.getUint32(c)),c+=8,d.modificationTime=Et(u.getUint32(c)),c+=4,d.timescale=u.getUint32(c),c+=8,d.duration=u.getUint32(c)):(d.creationTime=Et(u.getUint32(c)),c+=4,d.modificationTime=Et(u.getUint32(c)),c+=4,d.timescale=u.getUint32(c),c+=4,d.duration=u.getUint32(c)),c+=4,d.rate=u.getUint16(c)+u.getUint16(c+2)/16,c+=4,d.volume=u.getUint8(c)+u.getUint8(c+1)/8,c+=2,c+=2,c+=2*4,d.matrix=new Uint32Array(o.subarray(c,c+9*4)),c+=9*4,c+=6*4,d.nextTrackId=u.getUint32(c),d},pdin:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),rate:u.getUint32(4),initialDelay:u.getUint32(8)}},sdtp:function(o){var u={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},c;for(c=4;c<o.byteLength;c++)u.samples.push({dependsOn:(o[c]&48)>>4,isDependedOn:(o[c]&12)>>2,hasRedundancy:o[c]&3});return u},sidx:Zp,smhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),balance:o[4]+o[5]/256}},stbl:function(o){return{boxes:Je(o)}},ctts:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),compositionOffsets:[]},d=u.getUint32(4),p;for(p=8;d;p+=8,d--)c.compositionOffsets.push({sampleCount:u.getUint32(p),sampleOffset:u[c.version===0?"getUint32":"getInt32"](p+4)});return c},stss:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),syncSamples:[]},d=u.getUint32(4),p;for(p=8;d;p+=4,d--)c.syncSamples.push(u.getUint32(p));return c},stco:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),chunkOffsets:[]},d=u.getUint32(4),p;for(p=8;d;p+=4,d--)c.chunkOffsets.push(u.getUint32(p));return c},stsc:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c=u.getUint32(4),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleToChunks:[]},p;for(p=8;c;p+=12,c--)d.sampleToChunks.push({firstChunk:u.getUint32(p),samplesPerChunk:u.getUint32(p+4),sampleDescriptionIndex:u.getUint32(p+8)});return d},stsd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleDescriptions:Je(o.subarray(8))}},stsz:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleSize:u.getUint32(4),entries:[]},d;for(d=12;d<o.byteLength;d+=4)c.entries.push(u.getUint32(d));return c},stts:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),timeToSamples:[]},d=u.getUint32(4),p;for(p=8;d;p+=8,d--)c.timeToSamples.push({sampleCount:u.getUint32(p),sampleDelta:u.getUint32(p+4)});return c},styp:function(o){return pi.ftyp(o)},tfdt:_a,tfhd:Ta,tkhd:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength),c=4,d={version:u.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return d.version===1?(c+=4,d.creationTime=Et(u.getUint32(c)),c+=8,d.modificationTime=Et(u.getUint32(c)),c+=4,d.trackId=u.getUint32(c),c+=4,c+=8,d.duration=u.getUint32(c)):(d.creationTime=Et(u.getUint32(c)),c+=4,d.modificationTime=Et(u.getUint32(c)),c+=4,d.trackId=u.getUint32(c),c+=4,c+=4,d.duration=u.getUint32(c)),c+=4,c+=2*4,d.layer=u.getUint16(c),c+=2,d.alternateGroup=u.getUint16(c),c+=2,d.volume=u.getUint8(c)+u.getUint8(c+1)/8,c+=2,c+=2,d.matrix=new Uint32Array(o.subarray(c,c+9*4)),c+=9*4,d.width=u.getUint16(c)+u.getUint16(c+2)/65536,c+=4,d.height=u.getUint16(c)+u.getUint16(c+2)/65536,d},traf:function(o){return{boxes:Je(o)}},trak:function(o){return{boxes:Je(o)}},trex:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:u.getUint32(4),defaultSampleDescriptionIndex:u.getUint32(8),defaultSampleDuration:u.getUint32(12),defaultSampleSize:u.getUint32(16),sampleDependsOn:o[20]&3,sampleIsDependedOn:(o[21]&192)>>6,sampleHasRedundancy:(o[21]&48)>>4,samplePaddingValue:(o[21]&14)>>1,sampleIsDifferenceSample:!!(o[21]&1),sampleDegradationPriority:u.getUint16(22)}},trun:Bl,"url ":function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4))}},vmhd:function(o){var u=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),graphicsmode:u.getUint16(4),opcolor:new Uint16Array([u.getUint16(6),u.getUint16(8),u.getUint16(10)])}}};Je=function(o){for(var u=0,c=[],d,p,_,x,S,I=new ArrayBuffer(o.length),A=new Uint8Array(I),O=0;O<o.length;++O)A[O]=o[O];for(d=new DataView(I);u<o.byteLength;)p=d.getUint32(u),_=Vs(o.subarray(u+4,u+8)),x=p>1?u+p:o.byteLength,S=(pi[_]||function(j){return{data:j}})(o.subarray(u+8,x)),S.size=p,S.type=_,c.push(S),u=x;return c},va=function(o,u){var c;return u=u||0,c=new Array(u*2+1).join(" "),o.map(function(d,p){return c+d.type+`
|
|
196
|
-
`+Object.keys(
|
|
197
|
-
`+
|
|
199
|
+
`),this.pushCaption(c),c.startPts=o},we.prototype.pushCaption=function(o){o.text!==""&&(this.trigger("data",{startPts:o.startPts,endPts:o.endPts,text:o.text,stream:"cc708_"+o.serviceNum}),o.text="",o.startPts=o.endPts)},we.prototype.displayWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],m=this.getPts(o);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible=1);return o},we.prototype.hideWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],m=this.getPts(o);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible=0);return o},we.prototype.toggleWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],m=this.getPts(o);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible^=1);return o},we.prototype.clearWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],m=this.getPts(o);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&c.windows[_].clearText();return o},we.prototype.deleteWindows=function(o,c){var d=this.current708Packet.data,h=d[++o],m=this.getPts(o);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&c.windows[_].reset();return o},we.prototype.setPenAttributes=function(o,c){var d=this.current708Packet.data,h=d[o],m=c.currentWindow.penAttr;return h=d[++o],m.textTag=(h&240)>>4,m.offset=(h&12)>>2,m.penSize=h&3,h=d[++o],m.italics=(h&128)>>7,m.underline=(h&64)>>6,m.edgeType=(h&56)>>3,m.fontStyle=h&7,o},we.prototype.setPenColor=function(o,c){var d=this.current708Packet.data,h=d[o],m=c.currentWindow.penColor;return h=d[++o],m.fgOpacity=(h&192)>>6,m.fgRed=(h&48)>>4,m.fgGreen=(h&12)>>2,m.fgBlue=h&3,h=d[++o],m.bgOpacity=(h&192)>>6,m.bgRed=(h&48)>>4,m.bgGreen=(h&12)>>2,m.bgBlue=h&3,h=d[++o],m.edgeRed=(h&48)>>4,m.edgeGreen=(h&12)>>2,m.edgeBlue=h&3,o},we.prototype.setPenLocation=function(o,c){var d=this.current708Packet.data,h=d[o],m=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,h=d[++o],m.row=h&15,h=d[++o],m.column=h&63,o},we.prototype.reset=function(o,c){var d=this.getPts(o);return this.flushDisplayed(d,c),this.initService(c.serviceNum,o)};var wg={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},_n=function(o){return o===null?"":(o=wg[o]||o,String.fromCharCode(o))},Tn=14,Dg=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Xi=function(){for(var o=[],c=Tn+1;c--;)o.push({text:"",indent:0,offset:0});return o},Me=function(o,c){Me.prototype.init.call(this),this.field_=o||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(d){var h,m,_,E,C;if(h=d.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),_=h>>>8,E=h&255,h!==this.PADDING_)if(h===this.RESUME_CAPTION_LOADING_)this.mode_="popOn";else if(h===this.END_OF_CAPTION_)this.mode_="popOn",this.clearFormatting(d.pts),this.flushDisplayed(d.pts),m=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=m,this.startPts_=d.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(d.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(d.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(d.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(d.pts),this.flushDisplayed(d.pts),this.shiftRowsUp_(),this.startPts_=d.pts;else if(h===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(h===this.ERASE_DISPLAYED_MEMORY_)this.flushDisplayed(d.pts),this.displayed_=Xi();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Xi();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(d.pts),this.displayed_=Xi()),this.mode_="paintOn",this.startPts_=d.pts;else if(this.isSpecialCharacter(_,E))_=(_&3)<<8,C=_n(_|E),this[this.mode_](d.pts,C),this.column_++;else if(this.isExtCharacter(_,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),_=(_&3)<<8,C=_n(_|E),this[this.mode_](d.pts,C),this.column_++;else if(this.isMidRowCode(_,E))this.clearFormatting(d.pts),this[this.mode_](d.pts," "),this.column_++,(E&14)===14&&this.addFormatting(d.pts,["i"]),(E&1)===1&&this.addFormatting(d.pts,["u"]);else if(this.isOffsetControlCode(_,E)){const I=E&3;this.nonDisplayed_[this.row_].offset=I,this.column_+=I}else if(this.isPAC(_,E)){var D=Dg.indexOf(h&7968);if(this.mode_==="rollUp"&&(D-this.rollUpRows_+1<0&&(D=this.rollUpRows_-1),this.setRollUp(d.pts,D)),D!==this.row_&&D>=0&&D<=14&&(this.clearFormatting(d.pts),this.row_=D),E&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(d.pts,["u"]),(h&16)===16){const I=(h&14)>>1;this.column_=I*4,this.nonDisplayed_[this.row_].indent+=I}this.isColorPAC(E)&&(E&14)===14&&this.addFormatting(d.pts,["i"])}else this.isNormalChar(_)&&(E===0&&(E=null),C=_n(_),C+=_n(E),this[this.mode_](d.pts,C),this.column_+=C.length)}};Me.prototype=new io,Me.prototype.flushDisplayed=function(o){const c=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},d=[];this.displayed_.forEach((h,m)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{c(m)}h.text.length&&d.push({text:h.text,line:m+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&c(m)}),d.length&&this.trigger("data",{startPts:this.startPts_,endPts:o,content:d,stream:this.name_})},Me.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Xi(),this.nonDisplayed_=Xi(),this.lastControlCode_=null,this.column_=0,this.row_=Tn,this.rollUpRows_=2,this.formatting_=[]},Me.prototype.setConstants=function(){this.dataChannel_===0?(this.BASE_=16,this.EXT_=17,this.CONTROL_=(20|this.field_)<<8,this.OFFSET_=23):this.dataChannel_===1&&(this.BASE_=24,this.EXT_=25,this.CONTROL_=(28|this.field_)<<8,this.OFFSET_=31),this.PADDING_=0,this.RESUME_CAPTION_LOADING_=this.CONTROL_|32,this.END_OF_CAPTION_=this.CONTROL_|47,this.ROLL_UP_2_ROWS_=this.CONTROL_|37,this.ROLL_UP_3_ROWS_=this.CONTROL_|38,this.ROLL_UP_4_ROWS_=this.CONTROL_|39,this.CARRIAGE_RETURN_=this.CONTROL_|45,this.RESUME_DIRECT_CAPTIONING_=this.CONTROL_|41,this.BACKSPACE_=this.CONTROL_|33,this.ERASE_DISPLAYED_MEMORY_=this.CONTROL_|44,this.ERASE_NON_DISPLAYED_MEMORY_=this.CONTROL_|46},Me.prototype.isSpecialCharacter=function(o,c){return o===this.EXT_&&c>=48&&c<=63},Me.prototype.isExtCharacter=function(o,c){return(o===this.EXT_+1||o===this.EXT_+2)&&c>=32&&c<=63},Me.prototype.isMidRowCode=function(o,c){return o===this.EXT_&&c>=32&&c<=47},Me.prototype.isOffsetControlCode=function(o,c){return o===this.OFFSET_&&c>=33&&c<=35},Me.prototype.isPAC=function(o,c){return o>=this.BASE_&&o<this.BASE_+8&&c>=64&&c<=127},Me.prototype.isColorPAC=function(o){return o>=64&&o<=79||o>=96&&o<=127},Me.prototype.isNormalChar=function(o){return o>=32&&o<=127},Me.prototype.setRollUp=function(o,c){if(this.mode_!=="rollUp"&&(this.row_=Tn,this.mode_="rollUp",this.flushDisplayed(o),this.nonDisplayed_=Xi(),this.displayed_=Xi()),c!==void 0&&c!==this.row_)for(var d=0;d<this.rollUpRows_;d++)this.displayed_[c-d]=this.displayed_[this.row_-d],this.displayed_[this.row_-d]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},Me.prototype.addFormatting=function(o,c){this.formatting_=this.formatting_.concat(c);var d=c.reduce(function(h,m){return h+"<"+m+">"},"");this[this.mode_](o,d)},Me.prototype.clearFormatting=function(o){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(d,h){return d+"</"+h+">"},"");this.formatting_=[],this[this.mode_](o,c)}},Me.prototype.popOn=function(o,c){var d=this.nonDisplayed_[this.row_].text;d+=c,this.nonDisplayed_[this.row_].text=d},Me.prototype.rollUp=function(o,c){var d=this.displayed_[this.row_].text;d+=c,this.displayed_[this.row_].text=d},Me.prototype.shiftRowsUp_=function(){var o;for(o=0;o<this.topRow_;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.row_+1;o<Tn+1;o++)this.displayed_[o]={text:"",indent:0,offset:0};for(o=this.topRow_;o<this.row_;o++)this.displayed_[o]=this.displayed_[o+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Me.prototype.paintOn=function(o,c){var d=this.displayed_[this.row_].text;d+=c,this.displayed_[this.row_].text=d};var Lu={CaptionStream:mt,Cea608Stream:Me,Cea708Stream:we},vn={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Ig=t,kg=8589934592,Pg=4294967296,Ru="shared",ro=function(o,c){var d=1;for(o>c&&(d=-1);Math.abs(c-o)>Pg;)o+=d*kg;return o},so=function(o){var c,d;so.prototype.init.call(this),this.type_=o||Ru,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Ru&&h.type!==this.type_||(d===void 0&&(d=h.dts),h.dts=ro(h.dts,d),h.pts=ro(h.pts,d),c=h.dts,this.trigger("data",h))},this.flush=function(){d=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){d=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};so.prototype=new Ig;var Ou={TimestampRolloverStream:so,handleRollover:ro},Lg=(o,c,d)=>{if(!o)return-1;for(var h=d;h<o.length;h++)if(o[h]===c)return h;return-1},Rg={typedArrayIndexOf:Lg},bn=Rg.typedArrayIndexOf,xn={Iso88591:0,Utf16:1,Utf16be:2,Utf8:3},Nu=function(o,c,d){var h,m="";for(h=c;h<d;h++)m+="%"+("00"+o[h].toString(16)).slice(-2);return m},os=function(o,c,d){return decodeURIComponent(Nu(o,c,d))},ls=function(o,c,d){return unescape(Nu(o,c,d))},us=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},cs={APIC:function(o){var c=1,d,h,m="-->";o.data[0]===xn.Utf8&&(d=bn(o.data,0,c),!(d<0)&&(o.mimeType=ls(o.data,c,d),c=d+1,o.pictureType=o.data[c],c++,h=bn(o.data,0,c),!(h<0)&&(o.description=os(o.data,c,h),c=h+1,o.mimeType===m?o.url=ls(o.data,c,o.data.length):o.pictureData=o.data.subarray(c,o.data.length))))},"T*":function(o){o.data[0]===xn.Utf8&&(o.value=os(o.data,1,o.data.length).replace(/\0*$/,""),o.values=o.value.split("\0"))},TXXX:function(o){var c;o.data[0]===xn.Utf8&&(c=bn(o.data,0,1),c!==-1&&(o.description=os(o.data,1,c),o.value=os(o.data,c+1,o.data.length).replace(/\0*$/,""),o.data=o.value))},"W*":function(o){o.url=ls(o.data,0,o.data.length).replace(/\0.*$/,"")},WXXX:function(o){var c;o.data[0]===xn.Utf8&&(c=bn(o.data,0,1),c!==-1&&(o.description=os(o.data,1,c),o.url=ls(o.data,c+1,o.data.length).replace(/\0.*$/,"")))},PRIV:function(o){var c;for(c=0;c<o.data.length;c++)if(o.data[c]===0){o.owner=ls(o.data,0,c);break}o.privateData=o.data.subarray(c+1),o.data=o.privateData}},Og=function(o){var c,d,h=10,m=0,_=[];if(!(o.length<10||o[0]!==73||o[1]!==68||o[2]!==51)){m=us(o.subarray(6,10)),m+=10;var E=o[5]&64;E&&(h+=4,h+=us(o.subarray(10,14)),m-=us(o.subarray(16,20)));do{if(c=us(o.subarray(h+4,h+8)),c<1)break;d=String.fromCharCode(o[h],o[h+1],o[h+2],o[h+3]);var C={id:d,data:o.subarray(h+10,h+c+10)};C.key=C.id,cs[C.id]?cs[C.id](C):C.id[0]==="T"?cs["T*"](C):C.id[0]==="W"&&cs["W*"](C),_.push(C),h+=10,h+=c}while(h<m);return _}},Bu={parseId3Frames:Og,parseSyncSafeInteger:us,frameParsers:cs},Ng=t,Bg=vn,ki=Bu,Sn;Sn=function(o){var c={descriptor:o&&o.descriptor},d=0,h=[],m=0,_;if(Sn.prototype.init.call(this),this.dispatchType=Bg.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(_=0;_<c.descriptor.length;_++)this.dispatchType+=("00"+c.descriptor[_].toString(16)).slice(-2);this.push=function(E){var C,D,I,N,V,Q;if(E.type==="timed-metadata"){if(E.dataAlignmentIndicator&&(m=0,h.length=0),h.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(h.push(E),m+=E.data.byteLength,h.length===1&&(d=ki.parseSyncSafeInteger(E.data.subarray(6,10)),d+=10),!(m<d)){for(C={data:new Uint8Array(d),frames:[],pts:h[0].pts,dts:h[0].dts},V=0;V<d;)C.data.set(h[0].data.subarray(0,d-V),V),V+=h[0].data.byteLength,m-=h[0].data.byteLength,h.shift();D=10,C.data[5]&64&&(D+=4,D+=ki.parseSyncSafeInteger(C.data.subarray(10,14)),d-=ki.parseSyncSafeInteger(C.data.subarray(16,20)));do{if(I=ki.parseSyncSafeInteger(C.data.subarray(D+4,D+8)),I<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(Q=String.fromCharCode(C.data[D],C.data[D+1],C.data[D+2],C.data[D+3]),N={id:Q,data:C.data.subarray(D+10,D+I+10)},N.key=N.id,ki.frameParsers[N.id]?ki.frameParsers[N.id](N):N.id[0]==="T"?ki.frameParsers["T*"](N):N.id[0]==="W"&&ki.frameParsers["W*"](N),N.owner==="com.apple.streaming.transportStreamTimestamp"){var z=N.data,re=(z[3]&1)<<30|z[4]<<22|z[5]<<14|z[6]<<6|z[7]>>>2;re*=4,re+=z[7]&3,N.timeStamp=re,C.pts===void 0&&C.dts===void 0&&(C.pts=N.timeStamp,C.dts=N.timeStamp),this.trigger("timestamp",N)}C.frames.push(N),D+=10,D+=I}while(D<d);this.trigger("data",C)}}}},Sn.prototype=new Ng;var Mg=Sn,no=t,ao=Lu,qt=vn,Ug=Ou.TimestampRolloverStream,En,ds,Cn,fr=188,oo=71;En=function(){var o=new Uint8Array(fr),c=0;En.prototype.init.call(this),this.push=function(d){var h=0,m=fr,_;for(c?(_=new Uint8Array(d.byteLength+c),_.set(o.subarray(0,c)),_.set(d,c),c=0):_=d;m<_.byteLength;){if(_[h]===oo&&_[m]===oo){this.trigger("data",_.subarray(h,m)),h+=fr,m+=fr;continue}h++,m++}h<_.byteLength&&(o.set(_.subarray(h),0),c=_.byteLength-h)},this.flush=function(){c===fr&&o[0]===oo&&(this.trigger("data",o),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},En.prototype=new no,ds=function(){var o,c,d,h;ds.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,o=function(m,_){var E=0;_.payloadUnitStartIndicator&&(E+=m[E]+1),_.type==="pat"?c(m.subarray(E),_):d(m.subarray(E),_)},c=function(m,_){_.section_number=m[7],_.last_section_number=m[8],h.pmtPid=(m[10]&31)<<8|m[11],_.pmtPid=h.pmtPid},d=function(m,_){var E,C,D,I;if(m[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},E=(m[1]&15)<<8|m[2],C=3+E-4,D=(m[10]&15)<<8|m[11],I=12+D;I<C;){var N=m[I],V=(m[I+1]&31)<<8|m[I+2];N===qt.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=V:N===qt.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=V:N===qt.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][V]=N),I+=((m[I+3]&15)<<8|m[I+4])+5}_.programMapTable=h.programMapTable}},this.push=function(m){var _={},E=4;if(_.payloadUnitStartIndicator=!!(m[1]&64),_.pid=m[1]&31,_.pid<<=8,_.pid|=m[2],(m[3]&48)>>>4>1&&(E+=m[E]+1),_.pid===0)_.type="pat",o(m.subarray(E),_),this.trigger("data",_);else if(_.pid===this.pmtPid)for(_.type="pmt",o(m.subarray(E),_),this.trigger("data",_);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([m,E,_]):this.processPes_(m,E,_)},this.processPes_=function(m,_,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=m.subarray(_),this.trigger("data",E)}},ds.prototype=new no,ds.STREAM_TYPES={h264:27,adts:15},Cn=function(){var o=this,c=!1,d={data:[],size:0},h={data:[],size:0},m={data:[],size:0},_,E=function(D,I){var N;const V=D[0]<<16|D[1]<<8|D[2];I.data=new Uint8Array,V===1&&(I.packetLength=6+(D[4]<<8|D[5]),I.dataAlignmentIndicator=(D[6]&4)!==0,N=D[7],N&192&&(I.pts=(D[9]&14)<<27|(D[10]&255)<<20|(D[11]&254)<<12|(D[12]&255)<<5|(D[13]&254)>>>3,I.pts*=4,I.pts+=(D[13]&6)>>>1,I.dts=I.pts,N&64&&(I.dts=(D[14]&14)<<27|(D[15]&255)<<20|(D[16]&254)<<12|(D[17]&255)<<5|(D[18]&254)>>>3,I.dts*=4,I.dts+=(D[18]&6)>>>1)),I.data=D.subarray(9+D[8]))},C=function(D,I,N){var V=new Uint8Array(D.size),Q={type:I},z=0,re=0,ae=!1,Qe;if(!(!D.data.length||D.size<9)){for(Q.trackId=D.data[0].pid,z=0;z<D.data.length;z++)Qe=D.data[z],V.set(Qe.data,re),re+=Qe.data.byteLength;E(V,Q),ae=I==="video"||Q.packetLength<=D.size,(N||ae)&&(D.size=0,D.data.length=0),ae&&o.trigger("data",Q)}};Cn.prototype.init.call(this),this.push=function(D){({pat:function(){},pes:function(){var I,N;switch(D.streamType){case qt.H264_STREAM_TYPE:I=d,N="video";break;case qt.ADTS_STREAM_TYPE:I=h,N="audio";break;case qt.METADATA_STREAM_TYPE:I=m,N="timed-metadata";break;default:return}D.payloadUnitStartIndicator&&C(I,N,!0),I.data.push(D),I.size+=D.data.byteLength},pmt:function(){var I={type:"metadata",tracks:[]};_=D.programMapTable,_.video!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&I.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),c=!0,o.trigger("data",I)}})[D.type]()},this.reset=function(){d.size=0,d.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){C(d,"video"),C(h,"audio"),C(m,"timed-metadata")},this.flush=function(){if(!c&&_){var D={type:"metadata",tracks:[]};_.video!==null&&D.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&D.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),o.trigger("data",D)}c=!1,this.flushStreams_(),this.trigger("done")}},Cn.prototype=new no;var Mu={PAT_PID:0,MP2T_PACKET_LENGTH:fr,TransportPacketStream:En,TransportParseStream:ds,ElementaryStream:Cn,TimestampRolloverStream:Ug,CaptionStream:ao.CaptionStream,Cea608Stream:ao.Cea608Stream,Cea708Stream:ao.Cea708Stream,MetadataStream:Mg};for(var lo in qt)qt.hasOwnProperty(lo)&&(Mu[lo]=qt[lo]);var Fg=Mu,$g=t,jg=y.ONE_SECOND_IN_TS,An,Uu=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];An=function(o){var c,d=0;An.prototype.init.call(this),this.skipWarn_=function(h,m){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${m} in frame ${d} outside syncword`})},this.push=function(h){var m=0,_,E,C,D,I;if(o||(d=0),h.type==="audio"){c&&c.length?(C=c,c=new Uint8Array(C.byteLength+h.data.byteLength),c.set(C),c.set(h.data,C.byteLength)):c=h.data;for(var N;m+7<c.length;){if(c[m]!==255||(c[m+1]&246)!==240){typeof N!="number"&&(N=m),m++;continue}if(typeof N=="number"&&(this.skipWarn_(N,m),N=null),E=(~c[m+1]&1)*2,_=(c[m+3]&3)<<11|c[m+4]<<3|(c[m+5]&224)>>5,D=((c[m+6]&3)+1)*1024,I=D*jg/Uu[(c[m+2]&60)>>>2],c.byteLength-m<_)break;this.trigger("data",{pts:h.pts+d*I,dts:h.dts+d*I,sampleCount:D,audioobjecttype:(c[m+2]>>>6&3)+1,channelcount:(c[m+2]&1)<<2|(c[m+3]&192)>>>6,samplerate:Uu[(c[m+2]&60)>>>2],samplingfrequencyindex:(c[m+2]&60)>>>2,samplesize:16,data:c.subarray(m+7+E,m+_)}),d++,m+=_}typeof N=="number"&&(this.skipWarn_(N,m),N=null),c=c.subarray(m)}},this.flush=function(){d=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},An.prototype=new $g;var Vg=An,Fu;Fu=function(o){var c=o.byteLength,d=0,h=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+h},this.loadWord=function(){var m=o.byteLength-c,_=new Uint8Array(4),E=Math.min(4,c);if(E===0)throw new Error("no bytes available");_.set(o.subarray(m,m+E)),d=new DataView(_.buffer).getUint32(0),h=E*8,c-=E},this.skipBits=function(m){var _;h>m?(d<<=m,h-=m):(m-=h,_=Math.floor(m/8),m-=_*8,c-=_,this.loadWord(),d<<=m,h-=m)},this.readBits=function(m){var _=Math.min(h,m),E=d>>>32-_;return h-=_,h>0?d<<=_:c>0&&this.loadWord(),_=m-_,_>0?E<<_|this.readBits(_):E},this.skipLeadingZeros=function(){var m;for(m=0;m<h;++m)if(d&2147483648>>>m)return d<<=m,h-=m,m;return this.loadWord(),m+this.skipLeadingZeros()},this.skipUnsignedExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.skipExpGolomb=function(){this.skipBits(1+this.skipLeadingZeros())},this.readUnsignedExpGolomb=function(){var m=this.skipLeadingZeros();return this.readBits(m+1)-1},this.readExpGolomb=function(){var m=this.readUnsignedExpGolomb();return 1&m?1+m>>>1:-1*(m>>>1)},this.readBoolean=function(){return this.readBits(1)===1},this.readUnsignedByte=function(){return this.readBits(8)},this.loadWord()};var qg=Fu,$u=t,Hg=qg,wn,hs,ju;hs=function(){var o=0,c,d;hs.prototype.init.call(this),this.push=function(h){var m;d?(m=new Uint8Array(d.byteLength+h.data.byteLength),m.set(d),m.set(h.data,d.byteLength),d=m):d=h.data;for(var _=d.byteLength;o<_-3;o++)if(d[o+2]===1){c=o+5;break}for(;c<_;)switch(d[c]){case 0:if(d[c-1]!==0){c+=2;break}else if(d[c-2]!==0){c++;break}o+3!==c-2&&this.trigger("data",d.subarray(o+3,c-2));do c++;while(d[c]!==1&&c<_);o=c-2,c+=3;break;case 1:if(d[c-1]!==0||d[c-2]!==0){c+=3;break}this.trigger("data",d.subarray(o+3,c-2)),o=c-2,c+=3;break;default:c+=3;break}d=d.subarray(o),c-=o,o=0},this.reset=function(){d=null,o=0,this.trigger("reset")},this.flush=function(){d&&d.byteLength>3&&this.trigger("data",d.subarray(o+3)),d=null,o=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},hs.prototype=new $u,ju={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},wn=function(){var o=new hs,c,d,h,m,_,E,C;wn.prototype.init.call(this),c=this,this.push=function(D){D.type==="video"&&(d=D.trackId,h=D.pts,m=D.dts,o.push(D))},o.on("data",function(D){var I={trackId:d,pts:h,dts:m,data:D,nalUnitTypeCode:D[0]&31};switch(I.nalUnitTypeCode){case 5:I.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:I.nalUnitType="sei_rbsp",I.escapedRBSP=_(D.subarray(1));break;case 7:I.nalUnitType="seq_parameter_set_rbsp",I.escapedRBSP=_(D.subarray(1)),I.config=E(I.escapedRBSP);break;case 8:I.nalUnitType="pic_parameter_set_rbsp";break;case 9:I.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",I)}),o.on("done",function(){c.trigger("done")}),o.on("partialdone",function(){c.trigger("partialdone")}),o.on("reset",function(){c.trigger("reset")}),o.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){o.flush()},this.partialFlush=function(){o.partialFlush()},this.reset=function(){o.reset()},this.endTimeline=function(){o.endTimeline()},C=function(D,I){var N=8,V=8,Q,z;for(Q=0;Q<D;Q++)V!==0&&(z=I.readExpGolomb(),V=(N+z+256)%256),N=V===0?N:V},_=function(D){for(var I=D.byteLength,N=[],V=1,Q,z;V<I-2;)D[V]===0&&D[V+1]===0&&D[V+2]===3?(N.push(V+2),V+=2):V++;if(N.length===0)return D;Q=I-N.length,z=new Uint8Array(Q);var re=0;for(V=0;V<Q;re++,V++)re===N[0]&&(re++,N.shift()),z[V]=D[re];return z},E=function(D){var I=0,N=0,V=0,Q=0,z,re,ae,Qe,Ct,Ri,vs,bs,xs,Ss,Fn,Le=[1,1],Es,zt;if(z=new Hg(D),re=z.readUnsignedByte(),Qe=z.readUnsignedByte(),ae=z.readUnsignedByte(),z.skipUnsignedExpGolomb(),ju[re]&&(Ct=z.readUnsignedExpGolomb(),Ct===3&&z.skipBits(1),z.skipUnsignedExpGolomb(),z.skipUnsignedExpGolomb(),z.skipBits(1),z.readBoolean()))for(Fn=Ct!==3?8:12,zt=0;zt<Fn;zt++)z.readBoolean()&&(zt<6?C(16,z):C(64,z));if(z.skipUnsignedExpGolomb(),Ri=z.readUnsignedExpGolomb(),Ri===0)z.readUnsignedExpGolomb();else if(Ri===1)for(z.skipBits(1),z.skipExpGolomb(),z.skipExpGolomb(),vs=z.readUnsignedExpGolomb(),zt=0;zt<vs;zt++)z.skipExpGolomb();if(z.skipUnsignedExpGolomb(),z.skipBits(1),bs=z.readUnsignedExpGolomb(),xs=z.readUnsignedExpGolomb(),Ss=z.readBits(1),Ss===0&&z.skipBits(1),z.skipBits(1),z.readBoolean()&&(I=z.readUnsignedExpGolomb(),N=z.readUnsignedExpGolomb(),V=z.readUnsignedExpGolomb(),Q=z.readUnsignedExpGolomb()),z.readBoolean()&&z.readBoolean()){switch(Es=z.readUnsignedByte(),Es){case 1:Le=[1,1];break;case 2:Le=[12,11];break;case 3:Le=[10,11];break;case 4:Le=[16,11];break;case 5:Le=[40,33];break;case 6:Le=[24,11];break;case 7:Le=[20,11];break;case 8:Le=[32,11];break;case 9:Le=[80,33];break;case 10:Le=[18,11];break;case 11:Le=[15,11];break;case 12:Le=[64,33];break;case 13:Le=[160,99];break;case 14:Le=[4,3];break;case 15:Le=[3,2];break;case 16:Le=[2,1];break;case 255:{Le=[z.readUnsignedByte()<<8|z.readUnsignedByte(),z.readUnsignedByte()<<8|z.readUnsignedByte()];break}}Le&&Le[0]/Le[1]}return{profileIdc:re,levelIdc:ae,profileCompatibility:Qe,width:(bs+1)*16-I*2-N*2,height:(2-Ss)*(xs+1)*16-V*2-Q*2,sarRatio:Le}}},wn.prototype=new $u;var zg={H264Stream:wn,NalByteStream:hs},Wg=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Vu=function(o,c){var d=o[c+6]<<21|o[c+7]<<14|o[c+8]<<7|o[c+9],h=o[c+5],m=(h&16)>>4;return d=d>=0?d:0,m?d+20:d+10},qu=function(o,c){return o.length-c<10||o[c]!==73||o[c+1]!==68||o[c+2]!==51?c:(c+=Vu(o,c),qu(o,c))},Gg=function(o){var c=qu(o,0);return o.length>=c+2&&(o[c]&255)===255&&(o[c+1]&240)===240&&(o[c+1]&22)===16},Hu=function(o){return o[0]<<21|o[1]<<14|o[2]<<7|o[3]},Kg=function(o,c,d){var h,m="";for(h=c;h<d;h++)m+="%"+("00"+o[h].toString(16)).slice(-2);return m},Xg=function(o,c,d){return unescape(Kg(o,c,d))},Yg=function(o,c){var d=(o[c+5]&224)>>5,h=o[c+4]<<3,m=o[c+3]&6144;return m|h|d},Qg=function(o,c){return o[c]===73&&o[c+1]===68&&o[c+2]===51?"timed-metadata":o[c]&!0&&(o[c+1]&240)===240?"audio":null},Jg=function(o){for(var c=0;c+5<o.length;){if(o[c]!==255||(o[c+1]&246)!==240){c++;continue}return Wg[(o[c+2]&60)>>>2]}return null},Zg=function(o){var c,d,h,m;c=10,o[5]&64&&(c+=4,c+=Hu(o.subarray(10,14)));do{if(d=Hu(o.subarray(c+4,c+8)),d<1)return null;if(m=String.fromCharCode(o[c],o[c+1],o[c+2],o[c+3]),m==="PRIV"){h=o.subarray(c+10,c+d+10);for(var _=0;_<h.byteLength;_++)if(h[_]===0){var E=Xg(h,0,_);if(E==="com.apple.streaming.transportStreamTimestamp"){var C=h.subarray(_+1),D=(C[3]&1)<<30|C[4]<<22|C[5]<<14|C[6]<<6|C[7]>>>2;return D*=4,D+=C[7]&3,D}break}}c+=10,c+=d}while(c<o.byteLength);return null},uo={isLikelyAacData:Gg,parseId3TagSize:Vu,parseAdtsSize:Yg,parseType:Qg,parseSampleRate:Jg,parseAacTimestamp:Zg},e0=t,zu=uo,Dn;Dn=function(){var o=new Uint8Array,c=0;Dn.prototype.init.call(this),this.setTimestamp=function(d){c=d},this.push=function(d){var h=0,m=0,_,E,C,D;for(o.length?(D=o.length,o=new Uint8Array(d.byteLength+D),o.set(o.subarray(0,D)),o.set(d,D)):o=d;o.length-m>=3;){if(o[m]===73&&o[m+1]===68&&o[m+2]===51){if(o.length-m<10||(h=zu.parseId3TagSize(o,m),m+h>o.length))break;E={type:"timed-metadata",data:o.subarray(m,m+h)},this.trigger("data",E),m+=h;continue}else if((o[m]&255)===255&&(o[m+1]&240)===240){if(o.length-m<7||(h=zu.parseAdtsSize(o,m),m+h>o.length))break;C={type:"audio",data:o.subarray(m,m+h),pts:c,dts:c},this.trigger("data",C),m+=h;continue}m++}_=o.length-m,_>0?o=o.subarray(m):o=new Uint8Array},this.reset=function(){o=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){o=new Uint8Array,this.trigger("endedtimeline")}},Dn.prototype=new e0;var t0=Dn,i0=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],r0=i0,s0=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],n0=s0,In=t,fs=dr,ps=Gi,kn=Be,Ht=Tg,mi=Fg,Pn=y,Wu=Vg,a0=zg.H264Stream,o0=t0,l0=uo.isLikelyAacData,u0=y.ONE_SECOND_IN_TS,co=r0,ho=n0,ms,pr,Ln,Yi,c0=function(o,c){c.stream=o,this.trigger("log",c)},Gu=function(o,c){for(var d=Object.keys(c),h=0;h<d.length;h++){var m=d[h];m==="headOfPipeline"||!c[m].on||c[m].on("log",c0.bind(o,m))}},Ku=function(o,c){var d;if(o.length!==c.length)return!1;for(d=0;d<o.length;d++)if(o[d]!==c[d])return!1;return!0},fo=function(o,c,d,h,m,_){var E=d-c,C=h-c,D=m-d;return{start:{dts:o,pts:o+E},end:{dts:o+C,pts:o+D},prependedContentDuration:_,baseMediaDecodeTime:o}};pr=function(o,c){var d=[],h,m=0,_=0,E=1/0;c=c||{},h=c.firstSequenceNumber||0,pr.prototype.init.call(this),this.push=function(C){Ht.collectDtsInfo(o,C),o&&co.forEach(function(D){o[D]=C[D]}),d.push(C)},this.setEarliestDts=function(C){m=C},this.setVideoBaseMediaDecodeTime=function(C){E=C},this.setAudioAppendStart=function(C){_=C},this.flush=function(){var C,D,I,N,V,Q,z;if(d.length===0){this.trigger("done","AudioSegmentStream");return}C=kn.trimAdtsFramesByEarliestDts(d,o,m),o.baseMediaDecodeTime=Ht.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),z=kn.prefixWithSilence(o,C,_,E),o.samples=kn.generateSampleTable(C),I=fs.mdat(kn.concatenateFrameData(C)),d=[],D=fs.moof(h,[o]),N=new Uint8Array(D.byteLength+I.byteLength),h++,N.set(D),N.set(I,D.byteLength),Ht.clearDtsInfo(o),V=Math.ceil(u0*1024/o.samplerate),C.length&&(Q=C.length*V,this.trigger("segmentTimingInfo",fo(Pn.audioTsToVideoTs(o.baseMediaDecodeTime,o.samplerate),C[0].dts,C[0].pts,C[0].dts+Q,C[0].pts+Q,z||0)),this.trigger("timingInfo",{start:C[0].pts,end:C[0].pts+Q})),this.trigger("data",{track:o,boxes:N}),this.trigger("done","AudioSegmentStream")},this.reset=function(){Ht.clearDtsInfo(o),d=[],this.trigger("reset")}},pr.prototype=new In,ms=function(o,c){var d,h=[],m=[],_,E;c=c||{},d=c.firstSequenceNumber||0,ms.prototype.init.call(this),delete o.minPTS,this.gopCache_=[],this.push=function(C){Ht.collectDtsInfo(o,C),C.nalUnitType==="seq_parameter_set_rbsp"&&!_&&(_=C.config,o.sps=[C.data],ho.forEach(function(D){o[D]=_[D]},this)),C.nalUnitType==="pic_parameter_set_rbsp"&&!E&&(E=C.data,o.pps=[C.data]),h.push(C)},this.flush=function(){for(var C,D,I,N,V,Q,z=0,re,ae;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(C=ps.groupNalsIntoFrames(h),I=ps.groupFramesIntoGops(C),I[0][0].keyFrame||(D=this.getGopForFusion_(h[0],o),D?(z=D.duration,I.unshift(D),I.byteLength+=D.byteLength,I.nalCount+=D.nalCount,I.pts=D.pts,I.dts=D.dts,I.duration+=D.duration):I=ps.extendFirstKeyFrame(I)),m.length){var Qe;if(c.alignGopsAtEnd?Qe=this.alignGopsAtEnd_(I):Qe=this.alignGopsAtStart_(I),!Qe){this.gopCache_.unshift({gop:I.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}Ht.clearDtsInfo(o),I=Qe}Ht.collectDtsInfo(o,I),o.samples=ps.generateSampleTable(I),V=fs.mdat(ps.concatenateNalData(I)),o.baseMediaDecodeTime=Ht.calculateTrackBaseMediaDecodeTime(o,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",I.map(function(Ct){return{pts:Ct.pts,dts:Ct.dts,byteLength:Ct.byteLength}})),re=I[0],ae=I[I.length-1],this.trigger("segmentTimingInfo",fo(o.baseMediaDecodeTime,re.dts,re.pts,ae.dts+ae.duration,ae.pts+ae.duration,z)),this.trigger("timingInfo",{start:I[0].pts,end:I[I.length-1].pts+I[I.length-1].duration}),this.gopCache_.unshift({gop:I.pop(),pps:o.pps,sps:o.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",o.baseMediaDecodeTime),this.trigger("timelineStartInfo",o.timelineStartInfo),N=fs.moof(d,[o]),Q=new Uint8Array(N.byteLength+V.byteLength),d++,Q.set(N),Q.set(V,N.byteLength),this.trigger("data",{track:o,boxes:Q}),this.resetStream_(),this.trigger("done","VideoSegmentStream")},this.reset=function(){this.resetStream_(),h=[],this.gopCache_.length=0,m.length=0,this.trigger("reset")},this.resetStream_=function(){Ht.clearDtsInfo(o),_=void 0,E=void 0},this.getGopForFusion_=function(C){var D=45e3,I=1e4,N=1/0,V,Q,z,re,ae;for(ae=0;ae<this.gopCache_.length;ae++)re=this.gopCache_[ae],z=re.gop,!(!(o.pps&&Ku(o.pps[0],re.pps[0]))||!(o.sps&&Ku(o.sps[0],re.sps[0])))&&(z.dts<o.timelineStartInfo.dts||(V=C.dts-z.dts-z.duration,V>=-I&&V<=D&&(!Q||N>V)&&(Q=re,N=V)));return Q?Q.gop:null},this.alignGopsAtStart_=function(C){var D,I,N,V,Q,z,re,ae;for(Q=C.byteLength,z=C.nalCount,re=C.duration,D=I=0;D<m.length&&I<C.length&&(N=m[D],V=C[I],N.pts!==V.pts);){if(V.pts>N.pts){D++;continue}I++,Q-=V.byteLength,z-=V.nalCount,re-=V.duration}return I===0?C:I===C.length?null:(ae=C.slice(I),ae.byteLength=Q,ae.duration=re,ae.nalCount=z,ae.pts=ae[0].pts,ae.dts=ae[0].dts,ae)},this.alignGopsAtEnd_=function(C){var D,I,N,V,Q,z;for(D=m.length-1,I=C.length-1,Q=null,z=!1;D>=0&&I>=0;){if(N=m[D],V=C[I],N.pts===V.pts){z=!0;break}if(N.pts>V.pts){D--;continue}D===m.length-1&&(Q=I),I--}if(!z&&Q===null)return null;var re;if(z?re=I:re=Q,re===0)return C;var ae=C.slice(re),Qe=ae.reduce(function(Ct,Ri){return Ct.byteLength+=Ri.byteLength,Ct.duration+=Ri.duration,Ct.nalCount+=Ri.nalCount,Ct},{byteLength:0,duration:0,nalCount:0});return ae.byteLength=Qe.byteLength,ae.duration=Qe.duration,ae.nalCount=Qe.nalCount,ae.pts=ae[0].pts,ae.dts=ae[0].dts,ae},this.alignGopsWith=function(C){m=C}},ms.prototype=new In,Yi=function(o,c){this.numberOfTracks=0,this.metadataStream=c,o=o||{},typeof o.remux<"u"?this.remuxTracks=!!o.remux:this.remuxTracks=!0,typeof o.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=o.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Yi.prototype.init.call(this),this.push=function(d){if(d.content||d.text)return this.pendingCaptions.push(d);if(d.frames)return this.pendingMetadata.push(d);this.pendingTracks.push(d.track),this.pendingBytes+=d.boxes.byteLength,d.track.type==="video"&&(this.videoTrack=d.track,this.pendingBoxes.push(d.boxes)),d.track.type==="audio"&&(this.audioTrack=d.track,this.pendingBoxes.unshift(d.boxes))}},Yi.prototype=new In,Yi.prototype.flush=function(o){var c=0,d={captions:[],captionStreams:{},metadata:[],info:{}},h,m,_,E=0,C;if(this.pendingTracks.length<this.numberOfTracks){if(o!=="VideoSegmentStream"&&o!=="AudioSegmentStream")return;if(this.remuxTracks)return;if(this.pendingTracks.length===0){this.emittedTracks++,this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0);return}}if(this.videoTrack?(E=this.videoTrack.timelineStartInfo.pts,ho.forEach(function(D){d.info[D]=this.videoTrack[D]},this)):this.audioTrack&&(E=this.audioTrack.timelineStartInfo.pts,co.forEach(function(D){d.info[D]=this.audioTrack[D]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?d.type=this.pendingTracks[0].type:d.type="combined",this.emittedTracks+=this.pendingTracks.length,_=fs.initSegment(this.pendingTracks),d.initSegment=new Uint8Array(_.byteLength),d.initSegment.set(_),d.data=new Uint8Array(this.pendingBytes),C=0;C<this.pendingBoxes.length;C++)d.data.set(this.pendingBoxes[C],c),c+=this.pendingBoxes[C].byteLength;for(C=0;C<this.pendingCaptions.length;C++)h=this.pendingCaptions[C],h.startTime=Pn.metadataTsToSeconds(h.startPts,E,this.keepOriginalTimestamps),h.endTime=Pn.metadataTsToSeconds(h.endPts,E,this.keepOriginalTimestamps),d.captionStreams[h.stream]=!0,d.captions.push(h);for(C=0;C<this.pendingMetadata.length;C++)m=this.pendingMetadata[C],m.cueTime=Pn.metadataTsToSeconds(m.pts,E,this.keepOriginalTimestamps),d.metadata.push(m);for(d.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",d),C=0;C<d.captions.length;C++)h=d.captions[C],this.trigger("caption",h);for(C=0;C<d.metadata.length;C++)m=d.metadata[C],this.trigger("id3Frame",m)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Yi.prototype.setRemux=function(o){this.remuxTracks=o},Ln=function(o){var c=this,d=!0,h,m;Ln.prototype.init.call(this),o=o||{},this.baseMediaDecodeTime=o.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="aac",_.metadataStream=new mi.MetadataStream,_.aacStream=new o0,_.audioTimestampRolloverStream=new mi.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new mi.TimestampRolloverStream("timed-metadata"),_.adtsStream=new Wu,_.coalesceStream=new Yi(o,_.metadataStream),_.headOfPipeline=_.aacStream,_.aacStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.aacStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.metadataStream.on("timestamp",function(E){_.aacStream.setTimestamp(E.timeStamp)}),_.aacStream.on("data",function(E){E.type!=="timed-metadata"&&E.type!=="audio"||_.audioSegmentStream||(m=m||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new pr(m,o),_.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream),c.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h}))}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),Gu(this,_)},this.setupTsPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="ts",_.metadataStream=new mi.MetadataStream,_.packetStream=new mi.TransportPacketStream,_.parseStream=new mi.TransportParseStream,_.elementaryStream=new mi.ElementaryStream,_.timestampRolloverStream=new mi.TimestampRolloverStream,_.adtsStream=new Wu,_.h264Stream=new a0,_.captionStream=new mi.CaptionStream(o),_.coalesceStream=new Yi(o,_.metadataStream),_.headOfPipeline=_.packetStream,_.packetStream.pipe(_.parseStream).pipe(_.elementaryStream).pipe(_.timestampRolloverStream),_.timestampRolloverStream.pipe(_.h264Stream),_.timestampRolloverStream.pipe(_.adtsStream),_.timestampRolloverStream.pipe(_.metadataStream).pipe(_.coalesceStream),_.h264Stream.pipe(_.captionStream).pipe(_.coalesceStream),_.elementaryStream.on("data",function(E){var C;if(E.type==="metadata"){for(C=E.tracks.length;C--;)!h&&E.tracks[C].type==="video"?(h=E.tracks[C],h.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!m&&E.tracks[C].type==="audio"&&(m=E.tracks[C],m.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);h&&!_.videoSegmentStream&&(_.coalesceStream.numberOfTracks++,_.videoSegmentStream=new ms(h,o),_.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),_.videoSegmentStream.on("timelineStartInfo",function(D){m&&!o.keepOriginalTimestamps&&(m.timelineStartInfo=D,_.audioSegmentStream.setEarliestDts(D.dts-c.baseMediaDecodeTime))}),_.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),_.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),_.videoSegmentStream.on("baseMediaDecodeTime",function(D){m&&_.audioSegmentStream.setVideoBaseMediaDecodeTime(D)}),_.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),_.h264Stream.pipe(_.videoSegmentStream).pipe(_.coalesceStream)),m&&!_.audioSegmentStream&&(_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new pr(m,o),_.audioSegmentStream.on("log",c.getLogTrigger_("audioSegmentStream")),_.audioSegmentStream.on("timingInfo",c.trigger.bind(c,"audioTimingInfo")),_.audioSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"audioSegmentTimingInfo")),_.adtsStream.pipe(_.audioSegmentStream).pipe(_.coalesceStream)),c.trigger("trackinfo",{hasAudio:!!m,hasVideo:!!h})}}),_.coalesceStream.on("data",this.trigger.bind(this,"data")),_.coalesceStream.on("id3Frame",function(E){E.dispatchType=_.metadataStream.dispatchType,c.trigger("id3Frame",E)}),_.coalesceStream.on("caption",this.trigger.bind(this,"caption")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),Gu(this,_)},this.setBaseMediaDecodeTime=function(_){var E=this.transmuxPipeline_;o.keepOriginalTimestamps||(this.baseMediaDecodeTime=_),m&&(m.timelineStartInfo.dts=void 0,m.timelineStartInfo.pts=void 0,Ht.clearDtsInfo(m),E.audioTimestampRolloverStream&&E.audioTimestampRolloverStream.discontinuity()),h&&(E.videoSegmentStream&&(E.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,Ht.clearDtsInfo(h),E.captionStream.reset()),E.timestampRolloverStream&&E.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(_){m&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(_)},this.setRemux=function(_){var E=this.transmuxPipeline_;o.remux=_,E&&E.coalesceStream&&E.coalesceStream.setRemux(_)},this.alignGopsWith=function(_){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(_)},this.getLogTrigger_=function(_){var E=this;return function(C){C.stream=_,E.trigger("log",C)}},this.push=function(_){if(d){var E=l0(_);E&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!E&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),d=!1}this.transmuxPipeline_.headOfPipeline.push(_)},this.flush=function(){d=!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()}},Ln.prototype=new In;var d0={Transmuxer:Ln,VideoSegmentStream:ms,AudioSegmentStream:pr,AUDIO_PROPERTIES:co,VIDEO_PROPERTIES:ho,generateSegmentTimingInfo:fo},h0=function(o){return o>>>0},f0=function(o){return("00"+o.toString(16)).slice(-2)},Rn={toUnsigned:h0,toHexString:f0},p0=function(o){var c="";return c+=String.fromCharCode(o[0]),c+=String.fromCharCode(o[1]),c+=String.fromCharCode(o[2]),c+=String.fromCharCode(o[3]),c},po=p0,m0=Rn.toUnsigned,g0=po,Xu=function(o,c){var d=[],h,m,_,E,C;if(!c.length)return null;for(h=0;h<o.byteLength;)m=m0(o[h]<<24|o[h+1]<<16|o[h+2]<<8|o[h+3]),_=g0(o.subarray(h+4,h+8)),E=m>1?h+m:o.byteLength,_===c[0]&&(c.length===1?d.push(o.subarray(h+8,E)):(C=Xu(o.subarray(h+8,E),c.slice(1)),C.length&&(d=d.concat(C)))),h=E;return d},On=Xu,y0=Rn.toUnsigned,_0=n.getUint64,T0=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=_0(o.subarray(4)):c.baseMediaDecodeTime=y0(o[4]<<24|o[5]<<16|o[6]<<8|o[7]),c},mo=T0,v0=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4)},h=d.flags[2]&1,m=d.flags[2]&2,_=d.flags[2]&8,E=d.flags[2]&16,C=d.flags[2]&32,D=d.flags[0]&65536,I=d.flags[0]&131072,N;return N=8,h&&(N+=4,d.baseDataOffset=c.getUint32(12),N+=4),m&&(d.sampleDescriptionIndex=c.getUint32(N),N+=4),_&&(d.defaultSampleDuration=c.getUint32(N),N+=4),E&&(d.defaultSampleSize=c.getUint32(N),N+=4),C&&(d.defaultSampleFlags=c.getUint32(N)),D&&(d.durationIsEmpty=!0),!h&&I&&(d.baseDataOffsetIsMoof=!0),d},go=v0,Yu=n.getUint64,b0=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),references:[],referenceId:c.getUint32(4),timescale:c.getUint32(8)},h=12;d.version===0?(d.earliestPresentationTime=c.getUint32(h),d.firstOffset=c.getUint32(h+4),h+=8):(d.earliestPresentationTime=Yu(o.subarray(h)),d.firstOffset=Yu(o.subarray(h+8)),h+=16),h+=2;var m=c.getUint16(h);for(h+=2;m>0;h+=12,m--)d.references.push({referenceType:(o[h]&128)>>>7,referencedSize:c.getUint32(h)&2147483647,subsegmentDuration:c.getUint32(h+4),startsWithSap:!!(o[h+8]&128),sapType:(o[h+8]&112)>>>4,sapDeltaTime:c.getUint32(h+8)&268435455});return d},x0=b0,S0=function(o){return{isLeading:(o[0]&12)>>>2,dependsOn:o[0]&3,isDependedOn:(o[1]&192)>>>6,hasRedundancy:(o[1]&48)>>>4,paddingValue:(o[1]&14)>>>1,isNonSyncSample:o[1]&1,degradationPriority:o[2]<<8|o[3]}},E0=S0,Qu=E0,C0=function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d=new DataView(o.buffer,o.byteOffset,o.byteLength),h=c.flags[2]&1,m=c.flags[2]&4,_=c.flags[1]&1,E=c.flags[1]&2,C=c.flags[1]&4,D=c.flags[1]&8,I=d.getUint32(4),N=8,V;for(h&&(c.dataOffset=d.getInt32(N),N+=4),m&&I&&(V={flags:Qu(o.subarray(N,N+4))},N+=4,_&&(V.duration=d.getUint32(N),N+=4),E&&(V.size=d.getUint32(N),N+=4),D&&(c.version===1?V.compositionTimeOffset=d.getInt32(N):V.compositionTimeOffset=d.getUint32(N),N+=4),c.samples.push(V),I--);I--;)V={},_&&(V.duration=d.getUint32(N),N+=4),E&&(V.size=d.getUint32(N),N+=4),C&&(V.flags=Qu(o.subarray(N,N+4)),N+=4),D&&(c.version===1?V.compositionTimeOffset=d.getInt32(N):V.compositionTimeOffset=d.getUint32(N),N+=4),c.samples.push(V);return c},Ju=C0,A0=n,Zu=A0.getUint64,rt,yo,Rt=function(o){return new Date(o*1e3-20828448e5)},gs=po,w0=On,D0=function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=[],h,m;for(h=0;h+4<o.length;h+=m){if(m=c.getUint32(h),h+=4,m<=0){d.push("<span style='color:red;'>MALFORMED DATA</span>");continue}switch(o[h]&31){case 1:d.push("slice_layer_without_partitioning_rbsp");break;case 5:d.push("slice_layer_without_partitioning_rbsp_idr");break;case 6:d.push("sei_rbsp");break;case 7:d.push("seq_parameter_set_rbsp");break;case 8:d.push("pic_parameter_set_rbsp");break;case 9:d.push("access_unit_delimiter_rbsp");break;default:d.push("UNKNOWN NAL - "+o[h]&31);break}}return d},Pi={avc1:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{dataReferenceIndex:c.getUint16(6),width:c.getUint16(24),height:c.getUint16(26),horizresolution:c.getUint16(28)+c.getUint16(30)/16,vertresolution:c.getUint16(32)+c.getUint16(34)/16,frameCount:c.getUint16(40),depth:c.getUint16(74),config:rt(o.subarray(78,o.byteLength))}},avcC:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={configurationVersion:o[0],avcProfileIndication:o[1],profileCompatibility:o[2],avcLevelIndication:o[3],lengthSizeMinusOne:o[4]&3,sps:[],pps:[]},h=o[5]&31,m,_,E,C;for(E=6,C=0;C<h;C++)_=c.getUint16(E),E+=2,d.sps.push(new Uint8Array(o.subarray(E,E+_))),E+=_;for(m=o[E],E++,C=0;C<m;C++)_=c.getUint16(E),E+=2,d.pps.push(new Uint8Array(o.subarray(E,E+_))),E+=_;return d},btrt:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{bufferSizeDB:c.getUint32(0),maxBitrate:c.getUint32(4),avgBitrate:c.getUint32(8)}},edts:function(c){return{boxes:rt(c)}},elst:function(c){var d=new DataView(c.buffer,c.byteOffset,c.byteLength),h={version:d.getUint8(0),flags:new Uint8Array(c.subarray(1,4)),edits:[]},m=d.getUint32(4),_;for(_=8;m;m--)h.version===0?(h.edits.push({segmentDuration:d.getUint32(_),mediaTime:d.getInt32(_+4),mediaRate:d.getUint16(_+8)+d.getUint16(_+10)/(256*256)}),_+=12):(h.edits.push({segmentDuration:Zu(c.subarray(_)),mediaTime:Zu(c.subarray(_+8)),mediaRate:d.getUint16(_+16)+d.getUint16(_+18)/(256*256)}),_+=20);return h},esds:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),esId:o[6]<<8|o[7],streamPriority:o[8]&31,decoderConfig:{objectProfileIndication:o[11],streamType:o[12]>>>2&63,bufferSize:o[13]<<16|o[14]<<8|o[15],maxBitrate:o[16]<<24|o[17]<<16|o[18]<<8|o[19],avgBitrate:o[20]<<24|o[21]<<16|o[22]<<8|o[23],decoderConfigDescriptor:{tag:o[24],length:o[25],audioObjectType:o[26]>>>3&31,samplingFrequencyIndex:(o[26]&7)<<1|o[27]>>>7&1,channelConfiguration:o[27]>>>3&15}}}},ftyp:function(o){for(var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={majorBrand:gs(o.subarray(0,4)),minorVersion:c.getUint32(4),compatibleBrands:[]},h=8;h<o.byteLength;)d.compatibleBrands.push(gs(o.subarray(h,h+4))),h+=4;return d},dinf:function(o){return{boxes:rt(o)}},dref:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),dataReferences:rt(o.subarray(8))}},hdlr:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),handlerType:gs(o.subarray(8,12)),name:""},h=8;for(h=24;h<o.byteLength;h++){if(o[h]===0){h++;break}d.name+=String.fromCharCode(o[h])}return d.name=decodeURIComponent(escape(d.name)),d},mdat:function(o){return{byteLength:o.byteLength,nals:D0(o)}},mdhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h,m={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),language:""};return m.version===1?(d+=4,m.creationTime=Rt(c.getUint32(d)),d+=8,m.modificationTime=Rt(c.getUint32(d)),d+=4,m.timescale=c.getUint32(d),d+=8,m.duration=c.getUint32(d)):(m.creationTime=Rt(c.getUint32(d)),d+=4,m.modificationTime=Rt(c.getUint32(d)),d+=4,m.timescale=c.getUint32(d),d+=4,m.duration=c.getUint32(d)),d+=4,h=c.getUint16(d),m.language+=String.fromCharCode((h>>10)+96),m.language+=String.fromCharCode(((h&992)>>5)+96),m.language+=String.fromCharCode((h&31)+96),m},mdia:function(o){return{boxes:rt(o)}},mfhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sequenceNumber:o[4]<<24|o[5]<<16|o[6]<<8|o[7]}},minf:function(o){return{boxes:rt(o)}},mp4a:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={dataReferenceIndex:c.getUint16(6),channelcount:c.getUint16(16),samplesize:c.getUint16(18),samplerate:c.getUint16(24)+c.getUint16(26)/65536};return o.byteLength>28&&(d.streamDescriptor=rt(o.subarray(28))[0]),d},moof:function(o){return{boxes:rt(o)}},moov:function(o){return{boxes:rt(o)}},mvex:function(o){return{boxes:rt(o)}},mvhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return h.version===1?(d+=4,h.creationTime=Rt(c.getUint32(d)),d+=8,h.modificationTime=Rt(c.getUint32(d)),d+=4,h.timescale=c.getUint32(d),d+=8,h.duration=c.getUint32(d)):(h.creationTime=Rt(c.getUint32(d)),d+=4,h.modificationTime=Rt(c.getUint32(d)),d+=4,h.timescale=c.getUint32(d),d+=4,h.duration=c.getUint32(d)),d+=4,h.rate=c.getUint16(d)+c.getUint16(d+2)/16,d+=4,h.volume=c.getUint8(d)+c.getUint8(d+1)/8,d+=2,d+=2,d+=2*4,h.matrix=new Uint32Array(o.subarray(d,d+9*4)),d+=9*4,d+=6*4,h.nextTrackId=c.getUint32(d),h},pdin:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),rate:c.getUint32(4),initialDelay:c.getUint32(8)}},sdtp:function(o){var c={version:o[0],flags:new Uint8Array(o.subarray(1,4)),samples:[]},d;for(d=4;d<o.byteLength;d++)c.samples.push({dependsOn:(o[d]&48)>>4,isDependedOn:(o[d]&12)>>2,hasRedundancy:o[d]&3});return c},sidx:x0,smhd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),balance:o[4]+o[5]/256}},stbl:function(o){return{boxes:rt(o)}},ctts:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),compositionOffsets:[]},h=c.getUint32(4),m;for(m=8;h;m+=8,h--)d.compositionOffsets.push({sampleCount:c.getUint32(m),sampleOffset:c[d.version===0?"getUint32":"getInt32"](m+4)});return d},stss:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4)),syncSamples:[]},h=c.getUint32(4),m;for(m=8;h;m+=4,h--)d.syncSamples.push(c.getUint32(m));return d},stco:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),chunkOffsets:[]},h=c.getUint32(4),m;for(m=8;h;m+=4,h--)d.chunkOffsets.push(c.getUint32(m));return d},stsc:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=c.getUint32(4),h={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleToChunks:[]},m;for(m=8;d;m+=12,d--)h.sampleToChunks.push({firstChunk:c.getUint32(m),samplesPerChunk:c.getUint32(m+4),sampleDescriptionIndex:c.getUint32(m+8)});return h},stsd:function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleDescriptions:rt(o.subarray(8))}},stsz:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),sampleSize:c.getUint32(4),entries:[]},h;for(h=12;h<o.byteLength;h+=4)d.entries.push(c.getUint32(h));return d},stts:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d={version:o[0],flags:new Uint8Array(o.subarray(1,4)),timeToSamples:[]},h=c.getUint32(4),m;for(m=8;h;m+=8,h--)d.timeToSamples.push({sampleCount:c.getUint32(m),sampleDelta:c.getUint32(m+4)});return d},styp:function(o){return Pi.ftyp(o)},tfdt:mo,tfhd:go,tkhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength),d=4,h={version:c.getUint8(0),flags:new Uint8Array(o.subarray(1,4))};return h.version===1?(d+=4,h.creationTime=Rt(c.getUint32(d)),d+=8,h.modificationTime=Rt(c.getUint32(d)),d+=4,h.trackId=c.getUint32(d),d+=4,d+=8,h.duration=c.getUint32(d)):(h.creationTime=Rt(c.getUint32(d)),d+=4,h.modificationTime=Rt(c.getUint32(d)),d+=4,h.trackId=c.getUint32(d),d+=4,d+=4,h.duration=c.getUint32(d)),d+=4,d+=2*4,h.layer=c.getUint16(d),d+=2,h.alternateGroup=c.getUint16(d),d+=2,h.volume=c.getUint8(d)+c.getUint8(d+1)/8,d+=2,d+=2,h.matrix=new Uint32Array(o.subarray(d,d+9*4)),d+=9*4,h.width=c.getUint16(d)+c.getUint16(d+2)/65536,d+=4,h.height=c.getUint16(d)+c.getUint16(d+2)/65536,h},traf:function(o){return{boxes:rt(o)}},trak:function(o){return{boxes:rt(o)}},trex:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),trackId:c.getUint32(4),defaultSampleDescriptionIndex:c.getUint32(8),defaultSampleDuration:c.getUint32(12),defaultSampleSize:c.getUint32(16),sampleDependsOn:o[20]&3,sampleIsDependedOn:(o[21]&192)>>6,sampleHasRedundancy:(o[21]&48)>>4,samplePaddingValue:(o[21]&14)>>1,sampleIsDifferenceSample:!!(o[21]&1),sampleDegradationPriority:c.getUint16(22)}},trun:Ju,"url ":function(o){return{version:o[0],flags:new Uint8Array(o.subarray(1,4))}},vmhd:function(o){var c=new DataView(o.buffer,o.byteOffset,o.byteLength);return{version:o[0],flags:new Uint8Array(o.subarray(1,4)),graphicsmode:c.getUint16(4),opcolor:new Uint16Array([c.getUint16(6),c.getUint16(8),c.getUint16(10)])}}};rt=function(o){for(var c=0,d=[],h,m,_,E,C,D=new ArrayBuffer(o.length),I=new Uint8Array(D),N=0;N<o.length;++N)I[N]=o[N];for(h=new DataView(D);c<o.byteLength;)m=h.getUint32(c),_=gs(o.subarray(c+4,c+8)),E=m>1?c+m:o.byteLength,C=(Pi[_]||function(V){return{data:V}})(o.subarray(c+8,E)),C.size=m,C.type=_,d.push(C),c=E;return d},yo=function(o,c){var d;return c=c||0,d=new Array(c*2+1).join(" "),o.map(function(h,m){return d+h.type+`
|
|
200
|
+
`+Object.keys(h).filter(function(_){return _!=="type"&&_!=="boxes"}).map(function(_){var E=d+" "+_+": ",C=h[_];if(C instanceof Uint8Array||C instanceof Uint32Array){var D=Array.prototype.slice.call(new Uint8Array(C.buffer,C.byteOffset,C.byteLength)).map(function(I){return" "+("00"+I.toString(16)).slice(-2)}).join("").match(/.{1,24}/g);return D?D.length===1?E+"<"+D.join("").slice(1)+">":E+`<
|
|
201
|
+
`+D.map(function(I){return d+" "+I}).join(`
|
|
198
202
|
`)+`
|
|
199
|
-
`+
|
|
200
|
-
`).map(function(
|
|
203
|
+
`+d+" >":E+"<>"}return E+JSON.stringify(C,null,2).split(`
|
|
204
|
+
`).map(function(I,N){return N===0?I:d+" "+I}).join(`
|
|
201
205
|
`)}).join(`
|
|
202
|
-
`)+(
|
|
203
|
-
`+
|
|
204
|
-
`)};var $l={inspect:Je,textify:va,parseType:Vs,findBox:nm,parseTraf:pi.traf,parseTfdt:pi.tfdt,parseHdlr:pi.hdlr,parseTfhd:pi.tfhd,parseTrun:pi.trun,parseSidx:pi.sidx},am=function(o){for(var u=0,c=String.fromCharCode(o[u]),d="";c!=="\0";)d+=c,u++,c=String.fromCharCode(o[u]);return d+=c,d},om={uint8ToCString:am},Xn=om.uint8ToCString,lm=r.getUint64,um=function(o){var u=4,c=o[0],d,p,_,x,S,I,A,O;if(c===0){d=Xn(o.subarray(u)),u+=d.length,p=Xn(o.subarray(u)),u+=p.length;var j=new DataView(o.buffer);_=j.getUint32(u),u+=4,S=j.getUint32(u),u+=4,I=j.getUint32(u),u+=4,A=j.getUint32(u),u+=4}else if(c===1){var j=new DataView(o.buffer);_=j.getUint32(u),u+=4,x=lm(o.subarray(u)),u+=8,I=j.getUint32(u),u+=4,A=j.getUint32(u),u+=4,d=Xn(o.subarray(u)),u+=d.length,p=Xn(o.subarray(u)),u+=p.length}O=new Uint8Array(o.subarray(u,o.byteLength));var Y={scheme_id_uri:d,value:p,timescale:_||1,presentation_time:x,presentation_time_delta:S,event_duration:I,id:A,message_data:O};return dm(c,Y)?Y:void 0},cm=function(o,u,c,d){return o||o===0?o/u:d+c/u},dm=function(o,u){var c=u.scheme_id_uri!=="\0",d=o===0&&jl(u.presentation_time_delta)&&c,p=o===1&&jl(u.presentation_time)&&c;return!(o>1)&&d||p},jl=function(o){return o!==void 0||o!==null},hm={parseEmsgBox:um,scaleTime:cm},Hs;typeof window<"u"?Hs=window:typeof s<"u"?Hs=s:typeof self<"u"?Hs=self:Hs={};var Vl=Hs,Yn=Gn.toUnsigned,qs=Gn.toHexString,Fe=Kn,Xi=ya,ba=hm,fm=Ta,pm=Bl,mm=_a,gm=r.getUint64,Hl,ql,zl,Wl,Gl,xa,Kl,Sa=Vl,ym=xl.parseId3Frames;Hl=function(o){var u={},c=Fe(o,["moov","trak"]);return c.reduce(function(d,p){var _,x,S,I,A;return _=Fe(p,["tkhd"])[0],!_||(x=_[0],S=x===0?12:20,I=Yn(_[S]<<24|_[S+1]<<16|_[S+2]<<8|_[S+3]),A=Fe(p,["mdia","mdhd"])[0],!A)?null:(x=A[0],S=x===0?12:20,d[I]=Yn(A[S]<<24|A[S+1]<<16|A[S+2]<<8|A[S+3]),d)},u)},ql=function(o,u){var c;c=Fe(u,["moof","traf"]);var d=c.reduce(function(p,_){var x=Fe(_,["tfhd"])[0],S=Yn(x[4]<<24|x[5]<<16|x[6]<<8|x[7]),I=o[S]||9e4,A=Fe(_,["tfdt"])[0],O=new DataView(A.buffer,A.byteOffset,A.byteLength),j;A[0]===1?j=gm(A.subarray(4,12)):j=O.getUint32(4);let Y;return typeof j=="bigint"?Y=j/Sa.BigInt(I):typeof j=="number"&&!isNaN(j)&&(Y=j/I),Y<Number.MAX_SAFE_INTEGER&&(Y=Number(Y)),Y<p&&(p=Y),p},1/0);return typeof d=="bigint"||isFinite(d)?d:0},zl=function(o,u){var c=Fe(u,["moof","traf"]),d=0,p=0,_;if(c&&c.length){var x=Fe(c[0],["tfhd"])[0],S=Fe(c[0],["trun"])[0],I=Fe(c[0],["tfdt"])[0];if(x){var A=fm(x);_=A.trackId}if(I){var O=mm(I);d=O.baseMediaDecodeTime}if(S){var j=pm(S);j.samples&&j.samples.length&&(p=j.samples[0].compositionTimeOffset||0)}}var Y=o[_]||9e4;typeof d=="bigint"&&(p=Sa.BigInt(p),Y=Sa.BigInt(Y));var q=(d+p)/Y;return typeof q=="bigint"&&q<Number.MAX_SAFE_INTEGER&&(q=Number(q)),q},Wl=function(o){var u=Fe(o,["moov","trak"]),c=[];return u.forEach(function(d){var p=Fe(d,["mdia","hdlr"]),_=Fe(d,["tkhd"]);p.forEach(function(x,S){var I=Xi(x.subarray(8,12)),A=_[S],O,j,Y;I==="vide"&&(O=new DataView(A.buffer,A.byteOffset,A.byteLength),j=O.getUint8(0),Y=j===0?O.getUint32(12):O.getUint32(20),c.push(Y))})}),c},xa=function(o){var u=o[0],c=u===0?12:20;return Yn(o[c]<<24|o[c+1]<<16|o[c+2]<<8|o[c+3])},Gl=function(o){var u=Fe(o,["moov","trak"]),c=[];return u.forEach(function(d){var p={},_=Fe(d,["tkhd"])[0],x,S;_&&(x=new DataView(_.buffer,_.byteOffset,_.byteLength),S=x.getUint8(0),p.id=S===0?x.getUint32(12):x.getUint32(20));var I=Fe(d,["mdia","hdlr"])[0];if(I){var A=Xi(I.subarray(8,12));A==="vide"?p.type="video":A==="soun"?p.type="audio":p.type=A}var O=Fe(d,["mdia","minf","stbl","stsd"])[0];if(O){var j=O.subarray(8);p.codec=Xi(j.subarray(4,8));var Y=Fe(j,[p.codec])[0],q,te;Y&&(/^[asm]vc[1-9]$/i.test(p.codec)?(q=Y.subarray(78),te=Xi(q.subarray(4,8)),te==="avcC"&&q.length>11?(p.codec+=".",p.codec+=qs(q[9]),p.codec+=qs(q[10]),p.codec+=qs(q[11])):p.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(p.codec)?(q=Y.subarray(28),te=Xi(q.subarray(4,8)),te==="esds"&&q.length>20&&q[19]!==0?(p.codec+="."+qs(q[19]),p.codec+="."+qs(q[20]>>>2&63).replace(/^0/,"")):p.codec="mp4a.40.2"):p.codec=p.codec.toLowerCase())}var ne=Fe(d,["mdia","mdhd"])[0];ne&&(p.timescale=xa(ne)),c.push(p)}),c},Kl=function(o,u=0){var c=Fe(o,["emsg"]);return c.map(d=>{var p=ba.parseEmsgBox(new Uint8Array(d)),_=ym(p.message_data);return{cueTime:ba.scaleTime(p.presentation_time,p.timescale,p.presentation_time_delta,u),duration:ba.scaleTime(p.event_duration,p.timescale),frames:_}})};var zs={findBox:Fe,parseType:Xi,timescale:Hl,startTime:ql,compositionStartTime:zl,videoTrackIds:Wl,tracks:Gl,getTimescaleFromMediaHeader:xa,getEmsgID3:Kl};const{parseTrun:_m}=$l,{findBox:Xl}=zs;var Yl=Vl,Tm=function(o){var u=Xl(o,["moof","traf"]),c=Xl(o,["mdat"]),d=[];return c.forEach(function(p,_){var x=u[_];d.push({mdat:p,traf:x})}),d},vm=function(o,u,c){var d=u,p=c.defaultSampleDuration||0,_=c.defaultSampleSize||0,x=c.trackId,S=[];return o.forEach(function(I){var A=_m(I),O=A.samples;O.forEach(function(j){j.duration===void 0&&(j.duration=p),j.size===void 0&&(j.size=_),j.trackId=x,j.dts=d,j.compositionTimeOffset===void 0&&(j.compositionTimeOffset=0),typeof d=="bigint"?(j.pts=d+Yl.BigInt(j.compositionTimeOffset),d+=Yl.BigInt(j.duration)):(j.pts=d+j.compositionTimeOffset,d+=j.duration)}),S=S.concat(O)}),S},Ql={getMdatTrafPairs:Tm,parseSamples:vm},bm=yl.discardEmulationPreventionBytes,xm=_l.CaptionStream,Ea=Kn,Sm=_a,Em=Ta,{getMdatTrafPairs:Cm,parseSamples:wm}=Ql,Im=function(o,u){for(var c=o,d=0;d<u.length;d++){var p=u[d];if(c<p.size)return p;c-=p.size}return null},Am=function(o,u,c){var d=new DataView(o.buffer,o.byteOffset,o.byteLength),p={logs:[],seiNals:[]},_,x,S,I;for(x=0;x+4<o.length;x+=S)if(S=d.getUint32(x),x+=4,!(S<=0))switch(o[x]&31){case 6:var A=o.subarray(x+1,x+1+S),O=Im(x,u);if(_={nalUnitType:"sei_rbsp",size:S,data:A,escapedRBSP:bm(A),trackId:c},O)_.pts=O.pts,_.dts=O.dts,I=O;else if(I)_.pts=I.pts,_.dts=I.dts;else{p.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+x+" for trackId "+c+". See mux.js#223."});break}p.seiNals.push(_);break}return p},km=function(o,u){var c={},d=Cm(o);return d.forEach(function(p){var _=p.mdat,x=p.traf,S=Ea(x,["tfhd"]),I=Em(S[0]),A=I.trackId,O=Ea(x,["tfdt"]),j=O.length>0?Sm(O[0]).baseMediaDecodeTime:0,Y=Ea(x,["trun"]),q,te;u===A&&Y.length>0&&(q=wm(Y,j,I),te=Am(_,q,A),c[A]||(c[A]={seiNals:[],logs:[]}),c[A].seiNals=c[A].seiNals.concat(te.seiNals),c[A].logs=c[A].logs.concat(te.logs))}),c},Pm=function(o,u,c){var d;if(u===null)return null;d=km(o,u);var p=d[u]||{};return{seiNals:p.seiNals,logs:p.logs,timescale:c}},Dm=function(){var o=!1,u,c,d,p,_,x;this.isInitialized=function(){return o},this.init=function(S){u=new xm,o=!0,x=S?S.isPartial:!1,u.on("data",function(I){I.startTime=I.startPts/p,I.endTime=I.endPts/p,_.captions.push(I),_.captionStreams[I.stream]=!0}),u.on("log",function(I){_.logs.push(I)})},this.isNewInit=function(S,I){return S&&S.length===0||I&&typeof I=="object"&&Object.keys(I).length===0?!1:d!==S[0]||p!==I[d]},this.parse=function(S,I,A){var O;if(this.isInitialized()){if(!I||!A)return null;if(this.isNewInit(I,A))d=I[0],p=A[d];else if(d===null||!p)return c.push(S),null}else return null;for(;c.length>0;){var j=c.shift();this.parse(j,I,A)}return O=Pm(S,d,p),O&&O.logs&&(_.logs=_.logs.concat(O.logs)),O===null||!O.seiNals?_.logs.length?{logs:_.logs,captions:[],captionStreams:[]}:null:(this.pushNals(O.seiNals),this.flushStream(),_)},this.pushNals=function(S){if(!this.isInitialized()||!S||S.length===0)return null;S.forEach(function(I){u.push(I)})},this.flushStream=function(){if(!this.isInitialized())return null;x?u.partialFlush():u.flush()},this.clearParsedCaptions=function(){_.captions=[],_.captionStreams={},_.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;u.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){c=[],d=null,p=null,_?this.clearParsedCaptions():_={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Lm=Dm;const{parseTfdt:Om}=$l,mi=Kn,{getTimescaleFromMediaHeader:Rm}=zs,{parseSamples:Mm,getMdatTrafPairs:Nm}=Ql;var Jl=function(){let o=9e4;this.init=function(u){const c=mi(u,["moov","trak","mdia","mdhd"])[0];c&&(o=Rm(c))},this.parseSegment=function(u){const c=[],d=Nm(u);let p=0;return d.forEach(function(_){const x=_.mdat,S=_.traf,I=mi(S,["tfdt"])[0],A=mi(S,["tfhd"])[0],O=mi(S,["trun"]);if(I&&(p=Om(I).baseMediaDecodeTime),O.length&&A){const j=Mm(O,p,A);let Y=0;j.forEach(function(q){const te="utf-8",ne=new TextDecoder(te),ze=x.slice(Y,Y+q.size);if(mi(ze,["vtte"])[0]){Y+=q.size;return}mi(ze,["vttc"]).forEach(function(Ws){const Gs=mi(Ws,["payl"])[0],Ks=mi(Ws,["sttg"])[0],Xs=q.pts/o,Zn=(q.pts+q.duration)/o;let Ie,Ys;if(Gs)try{Ie=ne.decode(Gs)}catch(Mt){console.error(Mt)}if(Ks)try{Ys=ne.decode(Ks)}catch(Mt){console.error(Mt)}q.duration&&Ie&&c.push({cueText:Ie,start:Xs,end:Zn,settings:Ys})}),Y+=q.size})}}),c}},Ca=Rn,Zl=function(o){var u=o[1]&31;return u<<=8,u|=o[2],u},Qn=function(o){return!!(o[1]&64)},Jn=function(o){var u=0;return(o[3]&48)>>>4>1&&(u+=o[4]+1),u},Um=function(o,u){var c=Zl(o);return c===0?"pat":c===u?"pmt":u?"pes":null},Bm=function(o){var u=Qn(o),c=4+Jn(o);return u&&(c+=o[c]+1),(o[c+10]&31)<<8|o[c+11]},Fm=function(o){var u={},c=Qn(o),d=4+Jn(o);if(c&&(d+=o[d]+1),!!(o[d+5]&1)){var p,_,x;p=(o[d+1]&15)<<8|o[d+2],_=3+p-4,x=(o[d+10]&15)<<8|o[d+11];for(var S=12+x;S<_;){var I=d+S;u[(o[I+1]&31)<<8|o[I+2]]=o[I],S+=((o[I+3]&15)<<8|o[I+4])+5}return u}},$m=function(o,u){var c=Zl(o),d=u[c];switch(d){case Ca.H264_STREAM_TYPE:return"video";case Ca.ADTS_STREAM_TYPE:return"audio";case Ca.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},jm=function(o){var u=Qn(o);if(!u)return null;var c=4+Jn(o);if(c>=o.byteLength)return null;var d=null,p;return p=o[c+7],p&192&&(d={},d.pts=(o[c+9]&14)<<27|(o[c+10]&255)<<20|(o[c+11]&254)<<12|(o[c+12]&255)<<5|(o[c+13]&254)>>>3,d.pts*=4,d.pts+=(o[c+13]&6)>>>1,d.dts=d.pts,p&64&&(d.dts=(o[c+14]&14)<<27|(o[c+15]&255)<<20|(o[c+16]&254)<<12|(o[c+17]&255)<<5|(o[c+18]&254)>>>3,d.dts*=4,d.dts+=(o[c+18]&6)>>>1)),d},wa=function(o){switch(o){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},Vm=function(o){for(var u=4+Jn(o),c=o.subarray(u),d=0,p=0,_=!1,x;p<c.byteLength-3;p++)if(c[p+2]===1){d=p+5;break}for(;d<c.byteLength;)switch(c[d]){case 0:if(c[d-1]!==0){d+=2;break}else if(c[d-2]!==0){d++;break}p+3!==d-2&&(x=wa(c[p+3]&31),x==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0));do d++;while(c[d]!==1&&d<c.length);p=d-2,d+=3;break;case 1:if(c[d-1]!==0||c[d-2]!==0){d+=3;break}x=wa(c[p+3]&31),x==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0),p=d-2,d+=3;break;default:d+=3;break}return c=c.subarray(p),d-=p,p=0,c&&c.byteLength>3&&(x=wa(c[p+3]&31),x==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0)),_},Hm={parseType:Um,parsePat:Bm,parsePmt:Fm,parsePayloadUnitStartIndicator:Qn,parsePesType:$m,parsePesTime:jm,videoPacketContainsKeyFrame:Vm},eu=Rn,Yi=vl.handleRollover,_e={};_e.ts=Hm,_e.aac=fa;var Li=y.ONE_SECOND_IN_TS,it=188,jt=71,qm=function(o,u){for(var c=0,d=it,p,_;d<o.byteLength;){if(o[c]===jt&&o[d]===jt){switch(p=o.subarray(c,d),_=_e.ts.parseType(p,u.pid),_){case"pat":u.pid=_e.ts.parsePat(p);break;case"pmt":var x=_e.ts.parsePmt(p);u.table=u.table||{},Object.keys(x).forEach(function(S){u.table[S]=x[S]});break}c+=it,d+=it;continue}c++,d++}},tu=function(o,u,c){for(var d=0,p=it,_,x,S,I,A,O=!1;p<=o.byteLength;){if(o[d]===jt&&(o[p]===jt||p===o.byteLength)){switch(_=o.subarray(d,p),x=_e.ts.parseType(_,u.pid),x){case"pes":S=_e.ts.parsePesType(_,u.table),I=_e.ts.parsePayloadUnitStartIndicator(_),S==="audio"&&I&&(A=_e.ts.parsePesTime(_),A&&(A.type="audio",c.audio.push(A),O=!0));break}if(O)break;d+=it,p+=it;continue}d++,p++}for(p=o.byteLength,d=p-it,O=!1;d>=0;){if(o[d]===jt&&(o[p]===jt||p===o.byteLength)){switch(_=o.subarray(d,p),x=_e.ts.parseType(_,u.pid),x){case"pes":S=_e.ts.parsePesType(_,u.table),I=_e.ts.parsePayloadUnitStartIndicator(_),S==="audio"&&I&&(A=_e.ts.parsePesTime(_),A&&(A.type="audio",c.audio.push(A),O=!0));break}if(O)break;d-=it,p-=it;continue}d--,p--}},zm=function(o,u,c){for(var d=0,p=it,_,x,S,I,A,O,j,Y,q=!1,te={data:[],size:0};p<o.byteLength;){if(o[d]===jt&&o[p]===jt){switch(_=o.subarray(d,p),x=_e.ts.parseType(_,u.pid),x){case"pes":if(S=_e.ts.parsePesType(_,u.table),I=_e.ts.parsePayloadUnitStartIndicator(_),S==="video"&&(I&&!q&&(A=_e.ts.parsePesTime(_),A&&(A.type="video",c.video.push(A),q=!0)),!c.firstKeyFrame)){if(I&&te.size!==0){for(O=new Uint8Array(te.size),j=0;te.data.length;)Y=te.data.shift(),O.set(Y,j),j+=Y.byteLength;if(_e.ts.videoPacketContainsKeyFrame(O)){var ne=_e.ts.parsePesTime(O);ne?(c.firstKeyFrame=ne,c.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.")}te.size=0}te.data.push(_),te.size+=_.byteLength}break}if(q&&c.firstKeyFrame)break;d+=it,p+=it;continue}d++,p++}for(p=o.byteLength,d=p-it,q=!1;d>=0;){if(o[d]===jt&&o[p]===jt){switch(_=o.subarray(d,p),x=_e.ts.parseType(_,u.pid),x){case"pes":S=_e.ts.parsePesType(_,u.table),I=_e.ts.parsePayloadUnitStartIndicator(_),S==="video"&&I&&(A=_e.ts.parsePesTime(_),A&&(A.type="video",c.video.push(A),q=!0));break}if(q)break;d-=it,p-=it;continue}d--,p--}},Wm=function(o,u){if(o.audio&&o.audio.length){var c=u;(typeof c>"u"||isNaN(c))&&(c=o.audio[0].dts),o.audio.forEach(function(_){_.dts=Yi(_.dts,c),_.pts=Yi(_.pts,c),_.dtsTime=_.dts/Li,_.ptsTime=_.pts/Li})}if(o.video&&o.video.length){var d=u;if((typeof d>"u"||isNaN(d))&&(d=o.video[0].dts),o.video.forEach(function(_){_.dts=Yi(_.dts,d),_.pts=Yi(_.pts,d),_.dtsTime=_.dts/Li,_.ptsTime=_.pts/Li}),o.firstKeyFrame){var p=o.firstKeyFrame;p.dts=Yi(p.dts,d),p.pts=Yi(p.pts,d),p.dtsTime=p.dts/Li,p.ptsTime=p.pts/Li}}},Gm=function(o){for(var u=!1,c=0,d=null,p=null,_=0,x=0,S;o.length-x>=3;){var I=_e.aac.parseType(o,x);switch(I){case"timed-metadata":if(o.length-x<10){u=!0;break}if(_=_e.aac.parseId3TagSize(o,x),_>o.length){u=!0;break}p===null&&(S=o.subarray(x,x+_),p=_e.aac.parseAacTimestamp(S)),x+=_;break;case"audio":if(o.length-x<7){u=!0;break}if(_=_e.aac.parseAdtsSize(o,x),_>o.length){u=!0;break}d===null&&(S=o.subarray(x,x+_),d=_e.aac.parseSampleRate(S)),c++,x+=_;break;default:x++;break}if(u)return null}if(d===null||p===null)return null;var A=Li/d,O={audio:[{type:"audio",dts:p,pts:p},{type:"audio",dts:p+c*1024*A,pts:p+c*1024*A}]};return O},Km=function(o){var u={pid:null,table:null},c={};qm(o,u);for(var d in u.table)if(u.table.hasOwnProperty(d)){var p=u.table[d];switch(p){case eu.H264_STREAM_TYPE:c.video=[],zm(o,u,c),c.video.length===0&&delete c.video;break;case eu.ADTS_STREAM_TYPE:c.audio=[],tu(o,u,c),c.audio.length===0&&delete c.audio;break}}return c},Xm=function(o,u){var c=_e.aac.isLikelyAacData(o),d;return c?d=Gm(o):d=Km(o),!d||!d.audio&&!d.video?null:(Wm(d,u),d)},Ym={inspect:Xm,parseAudioPes_:tu};const Qm=function(o,u){u.on("data",function(c){const d=c.initSegment;c.initSegment={data:d.buffer,byteOffset:d.byteOffset,byteLength:d.byteLength};const p=c.data;c.data=p.buffer,o.postMessage({action:"data",segment:c,byteOffset:p.byteOffset,byteLength:p.byteLength},[c.data])}),u.on("done",function(c){o.postMessage({action:"done"})}),u.on("gopInfo",function(c){o.postMessage({action:"gopInfo",gopInfo:c})}),u.on("videoSegmentTimingInfo",function(c){const d={start:{decode:y.videoTsToSeconds(c.start.dts),presentation:y.videoTsToSeconds(c.start.pts)},end:{decode:y.videoTsToSeconds(c.end.dts),presentation:y.videoTsToSeconds(c.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(c.baseMediaDecodeTime)};c.prependedContentDuration&&(d.prependedContentDuration=y.videoTsToSeconds(c.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:d})}),u.on("audioSegmentTimingInfo",function(c){const d={start:{decode:y.videoTsToSeconds(c.start.dts),presentation:y.videoTsToSeconds(c.start.pts)},end:{decode:y.videoTsToSeconds(c.end.dts),presentation:y.videoTsToSeconds(c.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(c.baseMediaDecodeTime)};c.prependedContentDuration&&(d.prependedContentDuration=y.videoTsToSeconds(c.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:d})}),u.on("id3Frame",function(c){o.postMessage({action:"id3Frame",id3Frame:c})}),u.on("caption",function(c){o.postMessage({action:"caption",caption:c})}),u.on("trackinfo",function(c){o.postMessage({action:"trackinfo",trackInfo:c})}),u.on("audioTimingInfo",function(c){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:y.videoTsToSeconds(c.start),end:y.videoTsToSeconds(c.end)}})}),u.on("videoTimingInfo",function(c){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:y.videoTsToSeconds(c.start),end:y.videoTsToSeconds(c.end)}})}),u.on("log",function(c){o.postMessage({action:"log",log:c})})};class iu{constructor(u,c){this.options=c||{},this.self=u,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new Vp.Transmuxer(this.options),Qm(this.self,this.transmuxer)}pushMp4Captions(u){this.captionParser||(this.captionParser=new Lm,this.captionParser.init());const c=new Uint8Array(u.data,u.byteOffset,u.byteLength),d=this.captionParser.parse(c,u.trackIds,u.timescales);this.self.postMessage({action:"mp4Captions",captions:d&&d.captions||[],logs:d&&d.logs||[],data:c.buffer},[c.buffer])}initMp4WebVttParser(u){this.webVttParser||(this.webVttParser=new Jl);const c=new Uint8Array(u.data,u.byteOffset,u.byteLength);this.webVttParser.init(c)}getMp4WebVttText(u){this.webVttParser||(this.webVttParser=new Jl);const c=new Uint8Array(u.data,u.byteOffset,u.byteLength),d=this.webVttParser.parseSegment(c);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:d||[],data:c.buffer},[c.buffer])}probeMp4StartTime({timescales:u,data:c}){const d=zs.startTime(u,c);this.self.postMessage({action:"probeMp4StartTime",startTime:d,data:c},[c.buffer])}probeMp4Tracks({data:u}){const c=zs.tracks(u);this.self.postMessage({action:"probeMp4Tracks",tracks:c,data:u},[u.buffer])}probeEmsgID3({data:u,offset:c}){const d=zs.getEmsgID3(u,c);this.self.postMessage({action:"probeEmsgID3",id3Frames:d,emsgData:u},[u.buffer])}probeTs({data:u,baseStartTime:c}){const d=typeof c=="number"&&!isNaN(c)?c*y.ONE_SECOND_IN_TS:void 0,p=Ym.inspect(u,d);let _=null;p&&(_={hasVideo:p.video&&p.video.length===2||!1,hasAudio:p.audio&&p.audio.length===2||!1},_.hasVideo&&(_.videoStart=p.video[0].ptsTime),_.hasAudio&&(_.audioStart=p.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:_,data:u},[u.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(u){const c=new Uint8Array(u.data,u.byteOffset,u.byteLength);this.transmuxer.push(c)}reset(){this.transmuxer.reset()}setTimestampOffset(u){const c=u.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(y.secondsToVideoTs(c)))}setAudioAppendStart(u){this.transmuxer.setAudioAppendStart(Math.ceil(y.secondsToVideoTs(u.appendStart)))}setRemux(u){this.transmuxer.setRemux(u.remux)}flush(u){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(u){this.transmuxer.alignGopsWith(u.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new iu(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new iu(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var Rb=pf(Ob);const Mb=(s,e,t)=>{const{type:i,initSegment:n,captions:r,captionStreams:a,metadata:l,videoFrameDtsTime:h,videoFramePtsTime:f}=s.data.segment;e.buffer.push({captions:r,captionStreams:a,metadata:l});const m=s.data.segment.boxes||{data:s.data.segment.data},T={type:i,data:new Uint8Array(m.data,m.data.byteOffset,m.data.byteLength),initSegment:new Uint8Array(n.data,n.byteOffset,n.byteLength)};typeof h<"u"&&(T.videoFrameDtsTime=h),typeof f<"u"&&(T.videoFramePtsTime=f),t(T)},Nb=({transmuxedData:s,callback:e})=>{s.buffer=[],e(s)},Ub=(s,e)=>{e.gopInfo=s.data.gopInfo},yf=s=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:n,remux:r,onData:a,onTrackInfo:l,onAudioTimingInfo:h,onVideoTimingInfo:f,onVideoSegmentTimingInfo:m,onAudioSegmentTimingInfo:T,onId3:E,onCaptions:C,onDone:P,onEndedTimeline:v,onTransmuxerLog:R,isEndOfTimeline:L,segment:N,triggerSegmentEventFn:U}=s,F={buffer:[]};let D=L;const V=G=>{e.currentTransmux===s&&(G.data.action==="data"&&Mb(G,F,a),G.data.action==="trackinfo"&&l(G.data.trackInfo),G.data.action==="gopInfo"&&Ub(G,F),G.data.action==="audioTimingInfo"&&h(G.data.audioTimingInfo),G.data.action==="videoTimingInfo"&&f(G.data.videoTimingInfo),G.data.action==="videoSegmentTimingInfo"&&m(G.data.videoSegmentTimingInfo),G.data.action==="audioSegmentTimingInfo"&&T(G.data.audioSegmentTimingInfo),G.data.action==="id3Frame"&&E([G.data.id3Frame],G.data.id3Frame.dispatchType),G.data.action==="caption"&&C(G.data.caption),G.data.action==="endedtimeline"&&(D=!1,v()),G.data.action==="log"&&R(G.data.log),G.data.type==="transmuxed"&&(D||(e.onmessage=null,Nb({transmuxedData:F,callback:P}),_f(e))))},X=()=>{const G={message:"Received an error message from the transmuxer worker",metadata:{errorType:B.Error.StreamingFailedToTransmuxSegment,segmentInfo:Mi({segment:N})}};P(null,G)};if(e.onmessage=V,e.onerror=X,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(n)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:n}),typeof r<"u"&&e.postMessage({action:"setRemux",remux:r}),t.byteLength){const G=t instanceof ArrayBuffer?t:t.buffer,ae=t instanceof ArrayBuffer?0:t.byteOffset;U({type:"segmenttransmuxingstart",segment:N}),e.postMessage({action:"push",data:G,byteOffset:ae,byteLength:t.byteLength},[G])}L&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},_f=s=>{s.currentTransmux=null,s.transmuxQueue.length&&(s.currentTransmux=s.transmuxQueue.shift(),typeof s.currentTransmux=="function"?s.currentTransmux():yf(s.currentTransmux))},dc=(s,e)=>{s.postMessage({action:e}),_f(s)},Tf=(s,e)=>{if(!e.currentTransmux){e.currentTransmux=s,dc(e,s);return}e.transmuxQueue.push(dc.bind(null,e,s))},Bb=s=>{Tf("reset",s)},Fb=s=>{Tf("endTimeline",s)},vf=s=>{if(!s.transmuxer.currentTransmux){s.transmuxer.currentTransmux=s,yf(s);return}s.transmuxer.transmuxQueue.push(s)},$b=s=>{const e=new Rb;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 Ga={reset:Bb,endTimeline:Fb,transmux:vf,createTransmuxer:$b};const cs=function(s){const e=s.transmuxer,t=s.endAction||s.action,i=s.callback,n=je({},s,{endAction:null,transmuxer:null,callback:null}),r=a=>{a.data.action===t&&(e.removeEventListener("message",r),a.data.data&&(a.data.data=new Uint8Array(a.data.data,s.byteOffset||0,s.byteLength||a.data.data.byteLength),s.data&&(s.data=a.data.data)),i(a.data))};if(e.addEventListener("message",r),s.data){const a=s.data instanceof ArrayBuffer;n.byteOffset=a?0:s.data.byteOffset,n.byteLength=s.data.byteLength;const l=[a?s.data:s.data.buffer];e.postMessage(n,l)}else e.postMessage(n)},Qt={FAILURE:2,TIMEOUT:-101,ABORTED:-102},bf="wvtt",yo=s=>{s.forEach(e=>{e.abort()})},jb=s=>({bandwidth:s.bandwidth,bytesReceived:s.bytesReceived||0,roundTripTime:s.roundTripTime||0}),Vb=s=>{const e=s.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=s.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},fl=(s,e)=>{const{requestType:t}=e,i=Vi({requestType:t,request:e,error:s});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Qt.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Qt.ABORTED,xhr:e,metadata:i}:s?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Qt.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Qt.FAILURE,xhr:e,metadata:i}:null},hc=(s,e,t,i)=>(n,r)=>{const a=r.response,l=fl(n,r);if(l)return t(l,s);if(a.byteLength!==16)return t({status:r.status,message:"Invalid HLS key at URL: "+r.uri,code:Qt.FAILURE,xhr:r},s);const h=new DataView(a),f=new Uint32Array([h.getUint32(0),h.getUint32(4),h.getUint32(8),h.getUint32(12)]);for(let T=0;T<e.length;T++)e[T].bytes=f;const m={uri:r.uri};return i({type:"segmentkeyloadcomplete",segment:s,keyInfo:m}),t(null,s)},Hb=(s,e)=>{e===bf&&s.transmuxer.postMessage({action:"initMp4WebVttParser",data:s.map.bytes})},qb=(s,e,t)=>{e===bf&&cs({action:"getMp4WebVttText",data:s.bytes,transmuxer:s.transmuxer,callback:({data:i,mp4VttCues:n})=>{s.bytes=i,t(null,s,{mp4VttCues:n})}})},xf=(s,e)=>{const t=Oo(s.map.bytes);if(t!=="mp4"){const i=s.map.resolvedUri||s.map.uri,n=t||"unknown";return e({internal:!0,message:`Found unsupported ${n} container for initialization segment at URL: ${i}`,code:Qt.FAILURE,metadata:{mediaType:n}})}cs({action:"probeMp4Tracks",data:s.map.bytes,transmuxer:s.transmuxer,callback:({tracks:i,data:n})=>(s.map.bytes=n,i.forEach(function(r){s.map.tracks=s.map.tracks||{},!s.map.tracks[r.type]&&(s.map.tracks[r.type]=r,typeof r.id=="number"&&r.timescale&&(s.map.timescales=s.map.timescales||{},s.map.timescales[r.id]=r.timescale),r.type==="text"&&Hb(s,r.codec))}),e(null))})},zb=({segment:s,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,n)=>{const r=fl(i,n);if(r)return e(r,s);const a=new Uint8Array(n.response);if(t({type:"segmentloaded",segment:s}),s.map.key)return s.map.encryptedBytes=a,e(null,s);s.map.bytes=a,xf(s,function(l){if(l)return l.xhr=n,l.status=n.status,e(l,s);e(null,s)})},Wb=({segment:s,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(n,r)=>{const a=fl(n,r);if(a)return e(a,s);i({type:"segmentloaded",segment:s});const l=t==="arraybuffer"||!r.responseText?r.response:Db(r.responseText.substring(s.lastReachedChar||0));return s.stats=jb(r),s.key?s.encryptedBytes=new Uint8Array(l):s.bytes=new Uint8Array(l),e(null,s)},Gb=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})=>{const P=s.map&&s.map.tracks||{},v=!!(P.audio&&P.video);let R=i.bind(null,s,"audio","start");const L=i.bind(null,s,"audio","end");let N=i.bind(null,s,"video","start");const U=i.bind(null,s,"video","end"),F=()=>vf({bytes:e,transmuxer:s.transmuxer,audioAppendStart:s.audioAppendStart,gopsToAlignWith:s.gopsToAlignWith,remux:v,onData:D=>{D.type=D.type==="combined"?"video":D.type,m(s,D)},onTrackInfo:D=>{t&&(v&&(D.isMuxed=!0),t(s,D))},onAudioTimingInfo:D=>{R&&typeof D.start<"u"&&(R(D.start),R=null),L&&typeof D.end<"u"&&L(D.end)},onVideoTimingInfo:D=>{N&&typeof D.start<"u"&&(N(D.start),N=null),U&&typeof D.end<"u"&&U(D.end)},onVideoSegmentTimingInfo:D=>{const V={pts:{start:D.start.presentation,end:D.end.presentation},dts:{start:D.start.decode,end:D.end.decode}};C({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:V}),n(D)},onAudioSegmentTimingInfo:D=>{const V={pts:{start:D.start.pts,end:D.end.pts},dts:{start:D.start.dts,end:D.end.dts}};C({type:"segmenttransmuxingtiminginfoavailable",segment:s,timingInfo:V}),r(D)},onId3:(D,V)=>{a(s,D,V)},onCaptions:D=>{l(s,[D])},isEndOfTimeline:h,onEndedTimeline:()=>{f()},onTransmuxerLog:E,onDone:(D,V)=>{T&&(D.type=D.type==="combined"?"video":D.type,C({type:"segmenttransmuxingcomplete",segment:s}),T(V,s,D))},segment:s,triggerSegmentEventFn:C});cs({action:"probeTs",transmuxer:s.transmuxer,data:e,baseStartTime:s.baseStartTime,callback:D=>{s.bytes=e=D.data;const V=D.result;V&&(t(s,{hasAudio:V.hasAudio,hasVideo:V.hasVideo,isMuxed:v}),t=null),F()}})},Sf=({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})=>{let P=new Uint8Array(e);if(mT(P)){s.isFmp4=!0;const{tracks:v}=s.map;if(v.text&&(!v.audio||!v.video)){m(s,{data:P,type:"text"}),qb(s,v.text.codec,T);return}const L={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(L.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(L.videoCodec=v.video.codec),v.video&&v.audio&&(L.isMuxed=!0),t(s,L);const N=(U,F)=>{m(s,{data:P,type:L.hasAudio&&!L.isMuxed?"audio":"video"}),F&&F.length&&a(s,F),U&&U.length&&l(s,U),T(null,s,{})};cs({action:"probeMp4StartTime",timescales:s.map.timescales,data:P,transmuxer:s.transmuxer,callback:({data:U,startTime:F})=>{e=U.buffer,s.bytes=P=U,L.hasAudio&&!L.isMuxed&&i(s,"audio","start",F),L.hasVideo&&i(s,"video","start",F),cs({action:"probeEmsgID3",data:P,transmuxer:s.transmuxer,offset:F,callback:({emsgData:D,id3Frames:V})=>{if(e=D.buffer,s.bytes=P=D,!v.video||!D.byteLength||!s.transmuxer){N(void 0,V);return}cs({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:s.transmuxer,data:P,timescales:s.map.timescales,trackIds:[v.video.id],callback:X=>{e=X.data.buffer,s.bytes=P=X.data,X.logs.forEach(function(G){E(ge(G,{stream:"mp4CaptionParser"}))}),N(X.captions,V)}})}})}});return}if(!s.transmuxer){T(null,s,{});return}if(typeof s.container>"u"&&(s.container=Oo(P)),s.container!=="ts"&&s.container!=="aac"){t(s,{hasAudio:!1,hasVideo:!1}),T(null,s,{});return}Gb({segment:s,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})},Ef=function({id:s,key:e,encryptedBytes:t,decryptionWorker:i,segment:n,doneFn:r},a){const l=f=>{if(f.data.source===s){i.removeEventListener("message",l);const m=f.data.decrypted;a(new Uint8Array(m.bytes,m.byteOffset,m.byteLength))}};i.onerror=()=>{const f="An error occurred in the decryption worker",m=Mi({segment:n}),T={message:f,metadata:{error:new Error(f),errorType:B.Error.StreamingFailedToDecryptSegment,segmentInfo:m,keyInfo:{uri:n.key.resolvedUri||n.map.key.resolvedUri}}};r(T,n)},i.addEventListener("message",l);let h;e.bytes.slice?h=e.bytes.slice():h=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(lf({source:s,encrypted:t,key:h,iv:e.iv}),[t.buffer,h.buffer])},Kb=({decryptionWorker:s,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})=>{C({type:"segmentdecryptionstart"}),Ef({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:s,segment:e,doneFn:T},P=>{e.bytes=P,C({type:"segmentdecryptioncomplete",segment:e}),Sf({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})})},Xb=({activeXhrs:s,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})=>{let P=0,v=!1;return(R,L)=>{if(!v){if(R)return v=!0,yo(s),T(R,L);if(P+=1,P===s.length){const N=function(){if(L.encryptedBytes)return Kb({decryptionWorker:e,segment:L,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C});Sf({segment:L,bytes:L.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m,doneFn:T,onTransmuxerLog:E,triggerSegmentEventFn:C})};if(L.endOfAllRequests=Date.now(),L.map&&L.map.encryptedBytes&&!L.map.bytes)return C({type:"segmentdecryptionstart",segment:L}),Ef({decryptionWorker:e,id:L.requestId+"-init",encryptedBytes:L.map.encryptedBytes,key:L.map.key,segment:L,doneFn:T},U=>{L.map.bytes=U,C({type:"segmentdecryptioncomplete",segment:L}),xf(L,F=>{if(F)return yo(s),T(F,L);N()})});N()}}}},Yb=({loadendState:s,abortFn:e})=>t=>{t.target.aborted&&e&&!s.calledAbortFn&&(e(),s.calledAbortFn=!0)},Qb=({segment:s,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:n,audioSegmentTimingInfoFn:r,id3Fn:a,captionsFn:l,isEndOfTimeline:h,endedTimelineFn:f,dataFn:m})=>T=>{if(!T.target.aborted)return s.stats=ge(s.stats,Vb(T)),!s.stats.firstBytesReceivedAt&&s.stats.bytesReceived&&(s.stats.firstBytesReceivedAt=Date.now()),e(T,s)},Jb=({xhr:s,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:n,progressFn:r,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:T,isEndOfTimeline:E,endedTimelineFn:C,dataFn:P,doneFn:v,onTransmuxerLog:R,triggerSegmentEventFn:L})=>{const N=[],U=Xb({activeXhrs:N,decryptionWorker:t,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:T,isEndOfTimeline:E,endedTimelineFn:C,dataFn:P,doneFn:v,onTransmuxerLog:R,triggerSegmentEventFn:L});if(i.key&&!i.key.bytes){const G=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&G.push(i.map.key);const ae=ge(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),fe=hc(i,G,U,L),ve={uri:i.key.resolvedUri};L({type:"segmentkeyloadstart",segment:i,keyInfo:ve});const he=s(ae,fe);N.push(he)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const he=ge(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),Z=hc(i,[i.map.key],U,L),de={uri:i.map.key.resolvedUri};L({type:"segmentkeyloadstart",segment:i,keyInfo:de});const ee=s(he,Z);N.push(ee)}const ae=ge(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:mo(i.map),requestType:"segment-media-initialization"}),fe=zb({segment:i,finishProcessingFn:U,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:i});const ve=s(ae,fe);N.push(ve)}const F=ge(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:mo(i),requestType:"segment"}),D=Wb({segment:i,finishProcessingFn:U,responseType:F.responseType,triggerSegmentEventFn:L});L({type:"segmentloadstart",segment:i});const V=s(F,D);V.addEventListener("progress",Qb({segment:i,progressFn:r,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:h,audioSegmentTimingInfoFn:f,id3Fn:m,captionsFn:T,isEndOfTimeline:E,endedTimelineFn:C,dataFn:P})),N.push(V);const X={};return N.forEach(G=>{G.addEventListener("loadend",Yb({loadendState:X,abortFn:n}))}),()=>yo(N)},Zb=Pt("CodecUtils"),ex=function(s){const e=s.attributes||{};if(e.CODECS)return zt(e.CODECS)},Cf=(s,e)=>{const t=e.attributes||{};return s&&s.mediaGroups&&s.mediaGroups.AUDIO&&t.AUDIO&&s.mediaGroups.AUDIO[t.AUDIO]},tx=(s,e)=>{if(!Cf(s,e))return!0;const t=e.attributes||{},i=s.mediaGroups.AUDIO[t.AUDIO];for(const n in i)if(!i[n].uri&&!i[n].playlists)return!0;return!1},kr=function(s){const e={};return s.forEach(({mediaType:t,type:i,details:n})=>{e[t]=e[t]||[],e[t].push(ad(`${i}${n}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){Zb(`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},fc=function(s){let e=0;return s.audio&&e++,s.video&&e++,e},gn=function(s,e){const t=e.attributes||{},i=kr(ex(e)||[]);if(Cf(s,e)&&!i.audio&&!tx(s,e)){const n=kr(zy(s,t.AUDIO)||[]);n.audio&&(i.audio=n.audio)}return i},nr=Pt("PlaylistSelector"),pc=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||""})},Pr=function(s,e){if(!s)return"";const t=k.getComputedStyle(s);return t?t[e]:""},ds=function(s,e){const t=s.slice();s.sort(function(i,n){const r=e(i,n);return r===0?t.indexOf(i)-t.indexOf(n):r})},pl=function(s,e){let t,i;return s.attributes.BANDWIDTH&&(t=s.attributes.BANDWIDTH),t=t||k.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||k.Number.MAX_VALUE,t-i},ix=function(s,e){let t,i;return s.attributes.RESOLUTION&&s.attributes.RESOLUTION.width&&(t=s.attributes.RESOLUTION.width),t=t||k.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||k.Number.MAX_VALUE,t===i&&s.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?s.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let wf=function(s,e,t,i,n,r){if(!s)return;const a={bandwidth:e,width:t,height:i,limitRenditionByPlayerDimensions:n};let l=s.playlists;ht.isAudioOnly(s)&&(l=r.getAudioTrackPlaylists_(),a.audioOnly=!0);let h=l.map(D=>{let V;const X=D.attributes&&D.attributes.RESOLUTION&&D.attributes.RESOLUTION.width,G=D.attributes&&D.attributes.RESOLUTION&&D.attributes.RESOLUTION.height;return V=D.attributes&&D.attributes.BANDWIDTH,V=V||k.Number.MAX_VALUE,{bandwidth:V,width:X,height:G,playlist:D}});ds(h,(D,V)=>D.bandwidth-V.bandwidth),h=h.filter(D=>!ht.isIncompatible(D.playlist));let f=h.filter(D=>ht.isEnabled(D.playlist));f.length||(f=h.filter(D=>!ht.isDisabled(D.playlist)));const m=f.filter(D=>D.bandwidth*We.BANDWIDTH_VARIANCE<e);let T=m[m.length-1];const E=m.filter(D=>D.bandwidth===T.bandwidth)[0];if(n===!1){const D=E||f[0]||h[0];if(D&&D.playlist){let V="sortedPlaylistReps";return E&&(V="bandwidthBestRep"),f[0]&&(V="enabledPlaylistReps"),nr(`choosing ${pc(D)} using ${V} with options`,a),D.playlist}return nr("could not choose a playlist with options",a),null}const C=m.filter(D=>D.width&&D.height);ds(C,(D,V)=>D.width-V.width);const P=C.filter(D=>D.width===t&&D.height===i);T=P[P.length-1];const v=P.filter(D=>D.bandwidth===T.bandwidth)[0];let R,L,N;v||(R=C.filter(D=>D.width>t||D.height>i),L=R.filter(D=>D.width===R[0].width&&D.height===R[0].height),T=L[L.length-1],N=L.filter(D=>D.bandwidth===T.bandwidth)[0]);let U;if(r.leastPixelDiffSelector){const D=C.map(V=>(V.pixelDiff=Math.abs(V.width-t)+Math.abs(V.height-i),V));ds(D,(V,X)=>V.pixelDiff===X.pixelDiff?X.bandwidth-V.bandwidth:V.pixelDiff-X.pixelDiff),U=D[0]}const F=U||N||v||E||f[0]||h[0];if(F&&F.playlist){let D="sortedPlaylistReps";return U?D="leastPixelDiffRep":N?D="resolutionPlusOneRep":v?D="resolutionBestRep":E?D="bandwidthBestRep":f[0]&&(D="enabledPlaylistReps"),nr(`choosing ${pc(F)} using ${D} with options`,a),F.playlist}return nr("could not choose a playlist with options",a),null};const mc=function(){let s=this.useDevicePixelRatio&&k.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(s=this.customPixelRatio),wf(this.playlists.main,this.systemBandwidth,parseInt(Pr(this.tech_.el(),"width"),10)*s,parseInt(Pr(this.tech_.el(),"height"),10)*s,this.limitRenditionByPlayerDimensions,this.playlistController_)},sx=function(s){let e=-1,t=-1;if(s<0||s>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&k.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=s*this.systemBandwidth+(1-s)*e,t=this.systemBandwidth),wf(this.playlists.main,e,parseInt(Pr(this.tech_.el(),"width"),10)*i,parseInt(Pr(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)}},nx=function(s){const{main:e,currentTime:t,bandwidth:i,duration:n,segmentDuration:r,timeUntilRebuffer:a,currentTimeline:l,syncController:h}=s,f=e.playlists.filter(P=>!ht.isIncompatible(P));let m=f.filter(ht.isEnabled);m.length||(m=f.filter(P=>!ht.isDisabled(P)));const E=m.filter(ht.hasAttribute.bind(null,"BANDWIDTH")).map(P=>{const R=h.getSyncPoint(P,n,l,t)?1:2,N=ht.estimateSegmentRequestTime(r,i,P)*R-a;return{playlist:P,rebufferingImpact:N}}),C=E.filter(P=>P.rebufferingImpact<=0);return ds(C,(P,v)=>pl(v.playlist,P.playlist)),C.length?C[0]:(ds(E,(P,v)=>P.rebufferingImpact-v.rebufferingImpact),E[0]||null)},rx=function(){const s=this.playlists.main.playlists.filter(ht.isEnabled);return ds(s,(t,i)=>pl(t,i)),s.filter(t=>!!gn(this.playlists.main,t).video)[0]||null},ax=s=>{let e=0,t;return s.bytes&&(t=new Uint8Array(s.bytes),s.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function If(s){try{return new URL(s).pathname.split("/").slice(-2).join("/")}catch{return""}}const ox=function(s,e,t){if(!s[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const n=e.textTracks().getTrackById(i);if(n)s[t]=n;else{const r=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,l=t,h=!1;const f=r[i];f&&(a=f.label,l=f.language,h=f.default),s[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:h,label:a,language:l},!1).track}}},lx=function({inbandTextTracks:s,captionArray:e,timestampOffset:t}){if(!e)return;const i=k.WebKitDataCue||k.VTTCue;e.forEach(n=>{const r=n.stream;n.content?n.content.forEach(a=>{const l=new i(n.startTime+t,n.endTime+t,a.text);l.line=a.line,l.align="left",l.position=a.position,l.positionAlign="line-left",s[r].addCue(l)}):s[r].addCue(new i(n.startTime+t,n.endTime+t,n.text))})},ux=function(s){Object.defineProperties(s.frame,{id:{get(){return B.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),s.value.key}},value:{get(){return B.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),s.value.data}},privateData:{get(){return B.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),s.value.data}}})},cx=({inbandTextTracks:s,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const n=k.WebKitDataCue||k.VTTCue,r=s.metadataTrack_;if(!r||(e.forEach(m=>{const T=m.cueTime+t;typeof T!="number"||k.isNaN(T)||T<0||!(T<1/0)||!m.frames||!m.frames.length||m.frames.forEach(E=>{const C=new n(T,T,E.value||E.url||E.data||"");C.frame=E,C.value=E,ux(C),r.addCue(C)})}),!r.cues||!r.cues.length))return;const a=r.cues,l=[];for(let m=0;m<a.length;m++)a[m]&&l.push(a[m]);const h=l.reduce((m,T)=>{const E=m[T.startTime]||[];return E.push(T),m[T.startTime]=E,m},{}),f=Object.keys(h).sort((m,T)=>Number(m)-Number(T));f.forEach((m,T)=>{const E=h[m],C=isFinite(i)?i:m,P=Number(f[T+1])||C;E.forEach(v=>{v.endTime=P})})},dx={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"},hx=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),fx=({inbandTextTracks:s,dateRanges:e})=>{const t=s.metadataTrack_;if(!t)return;const i=k.WebKitDataCue||k.VTTCue;e.forEach(n=>{for(const r of Object.keys(n)){if(hx.has(r))continue;const a=new i(n.startTime,n.endTime,"");a.id=n.id,a.type="com.apple.quicktime.HLS",a.value={key:dx[r],data:n[r]},(r==="scte35Out"||r==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}n.processDateRange()})},gc=(s,e,t)=>{s.metadataTrack_||(s.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,B.browser.IS_ANY_SAFARI||(s.metadataTrack_.inBandMetadataTrackDispatchType=e))},un=function(s,e,t){let i,n;if(t&&t.cues)for(i=t.cues.length;i--;)n=t.cues[i],n.startTime>=s&&n.endTime<=e&&t.removeCue(n)},px=function(s){const e=s.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const n=e[i],r=`${n.startTime}-${n.endTime}-${n.text}`;t[r]?s.removeCue(n):t[r]=n}},mx=(s,e,t)=>{if(typeof e>"u"||e===null||!s.length)return[];const i=Math.ceil((e-t+3)*Ni.ONE_SECOND_IN_TS);let n;for(n=0;n<s.length&&!(s[n].pts>i);n++);return s.slice(n)},gx=(s,e,t)=>{if(!e.length)return s;if(t)return e.slice();const i=e[0].pts;let n=0;for(n;n<s.length&&!(s[n].pts>=i);n++);return s.slice(0,n).concat(e)},yx=(s,e,t,i)=>{const n=Math.ceil((e-i)*Ni.ONE_SECOND_IN_TS),r=Math.ceil((t-i)*Ni.ONE_SECOND_IN_TS),a=s.slice();let l=s.length;for(;l--&&!(s[l].pts<=r););if(l===-1)return a;let h=l+1;for(;h--&&!(s[h].pts<=n););return h=Math.max(h,0),a.splice(h,l-h+1),a},_x=function(s,e){if(!s&&!e||!s&&e||s&&!e)return!1;if(s===e)return!0;const t=Object.keys(s).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let n=0;n<t.length;n++){const r=t[n];if(r!==i[n]||s[r]!==e[r])return!1}return!0},Tx=function(s,e,t){e=e||[];const i=[];let n=0;for(let r=0;r<e.length;r++){const a=e[r];if(s===a.timeline&&(i.push(r),n+=a.duration,n>t))return r}return i.length===0?0:i[i.length-1]},tn=1,vx=500,yc=s=>typeof s=="number"&&isFinite(s),rr=1/60,bx=(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,xx=(s,e,t)=>{let i=e-We.BACK_BUFFER_LENGTH;s.length&&(i=Math.max(i,s.start(0)));const n=e-t;return Math.min(n,i)},es=s=>{const{startOfSegment:e,duration:t,segment:i,part:n,playlist:{mediaSequence:r,id:a,segments:l=[]},mediaIndex:h,partIndex:f,timeline:m}=s,T=l.length-1;let E="mediaIndex/partIndex increment";s.getMediaInfoForTime?E=`getMediaInfoForTime (${s.getMediaInfoForTime})`:s.isSyncRequest&&(E="getSyncSegmentCandidate (isSyncRequest)"),s.independent&&(E+=` with independent ${s.independent}`);const C=typeof f=="number",P=s.segment.uri?"segment":"pre-segment",v=C?zh({preloadSegment:i})-1:0;return`${P} [${r+h}/${r+T}]`+(C?` part [${f}/${v}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(C?` part start/end [${n.start} => ${n.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${m}] selected by [${E}] playlist [${a}]`},_c=s=>`${s}TimingInfo`,Sx=({segmentTimeline:s,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:n})=>!n&&s===e?null:s<e?t:i.length?i.end(i.length-1):t,_o=({timelineChangeController:s,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:n})=>{if(e===t)return!1;if(i==="audio"){const r=s.lastTimelineChange({type:"main"});return!r||r.to!==t}if(i==="main"&&n){const r=s.pendingTimelineChange({type:"audio"});return!(r&&r.to===t)}return!1},Ex=s=>{if(!s)return!1;const e=s.pendingTimelineChange({type:"audio"}),t=s.pendingTimelineChange({type:"main"}),i=e&&t,n=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&n)},Cx=s=>{const e=s.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=s.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Ti=s=>{const e=s.pendingSegment_;if(!e)return;if(_o({timelineChangeController:s.timelineChangeController_,currentTimeline:s.currentTimeline_,segmentTimeline:e.timeline,loaderType:s.loaderType_,audioDisabled:s.audioDisabled_})&&Ex(s.timelineChangeController_)){if(Cx(s)){s.timelineChangeController_.trigger("audioTimelineBehind");return}s.timelineChangeController_.trigger("fixBadTimelineChange")}},wx=s=>{let e=0;return["video","audio"].forEach(function(t){const i=s[`${t}TimingInfo`];if(!i)return;const{start:n,end:r}=i;let a;typeof n=="bigint"||typeof r=="bigint"?a=k.BigInt(r)-k.BigInt(n):typeof n=="number"&&typeof r=="number"&&(a=r-n),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},Tc=({segmentDuration:s,maxDuration:e})=>s?Math.round(s)>e+Xt:!1,Ix=(s,e)=>{if(e!=="hls")return null;const t=wx({audioTimingInfo:s.audioTimingInfo,videoTimingInfo:s.videoTimingInfo});if(!t)return null;const i=s.playlist.targetDuration,n=Tc({segmentDuration:t,maxDuration:i*2}),r=Tc({segmentDuration:t,maxDuration:i}),a=`Segment with index ${s.mediaIndex} from playlist ${s.playlist.id} has a duration of ${t} when the reported duration is ${s.duration} and the target duration is ${i}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return n||r?{severity:n?"warn":"info",message:a}:null},Mi=({type:s,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),n=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:s||e.type,uri:e.resolvedUri||e.uri,start:n,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class To extends B.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_=Pt(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(i){i!==this.state_&&(this.logger_(`${this.state_} -> ${i}`),this.state_=i,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ti(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(je({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ti(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(je({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Ti(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ti(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return Ga.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_&&k.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,k.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_&&Ga.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return Ke();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:n}=e;if(i&&t&&!this.audioDisabled_&&!n)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Ar(e);let n=this.initSegments_[i];return t&&!n&&e.bytes&&(this.initSegments_[i]=n={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),n||e}segmentKey(e,t=!1){if(!e)return null;const i=uf(e);let n=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!n&&e.bytes&&(this.keyCache_[i]=n={resolvedUri:e.resolvedUri,bytes:e.bytes});const r={resolvedUri:(n||e).resolvedUri};return n&&(r.bytes=n.bytes),r}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const i=this.playlist_,n=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 r=null;if(i&&(i.id?r=i.id:i.uri&&(r=i.uri)),this.logger_(`playlist update [${r} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
206
|
+
`)+(h.boxes?`
|
|
207
|
+
`+yo(h.boxes,c+1):"")}).join(`
|
|
208
|
+
`)};var ec={inspect:rt,textify:yo,parseType:gs,findBox:w0,parseTraf:Pi.traf,parseTfdt:Pi.tfdt,parseHdlr:Pi.hdlr,parseTfhd:Pi.tfhd,parseTrun:Pi.trun,parseSidx:Pi.sidx},I0=function(o){for(var c=0,d=String.fromCharCode(o[c]),h="";d!=="\0";)h+=d,c++,d=String.fromCharCode(o[c]);return h+=d,h},k0={uint8ToCString:I0},Nn=k0.uint8ToCString,P0=n.getUint64,L0=function(o){var c=4,d=o[0],h,m,_,E,C,D,I,N;if(d===0){h=Nn(o.subarray(c)),c+=h.length,m=Nn(o.subarray(c)),c+=m.length;var V=new DataView(o.buffer);_=V.getUint32(c),c+=4,C=V.getUint32(c),c+=4,D=V.getUint32(c),c+=4,I=V.getUint32(c),c+=4}else if(d===1){var V=new DataView(o.buffer);_=V.getUint32(c),c+=4,E=P0(o.subarray(c)),c+=8,D=V.getUint32(c),c+=4,I=V.getUint32(c),c+=4,h=Nn(o.subarray(c)),c+=h.length,m=Nn(o.subarray(c)),c+=m.length}N=new Uint8Array(o.subarray(c,o.byteLength));var Q={scheme_id_uri:h,value:m,timescale:_||1,presentation_time:E,presentation_time_delta:C,event_duration:D,id:I,message_data:N};return O0(d,Q)?Q:void 0},R0=function(o,c,d,h){return o||o===0?o/c:h+d/c},O0=function(o,c){var d=c.scheme_id_uri!=="\0",h=o===0&&tc(c.presentation_time_delta)&&d,m=o===1&&tc(c.presentation_time)&&d;return!(o>1)&&h||m},tc=function(o){return o!==void 0||o!==null},N0={parseEmsgBox:L0,scaleTime:R0},ys;typeof window<"u"?ys=window:typeof i<"u"?ys=i:typeof self<"u"?ys=self:ys={};var ic=ys,Bn=Rn.toUnsigned,_s=Rn.toHexString,ze=On,mr=po,_o=N0,B0=go,M0=Ju,U0=mo,F0=n.getUint64,rc,sc,nc,ac,oc,To,lc,vo=ic,$0=Bu.parseId3Frames;rc=function(o){var c={},d=ze(o,["moov","trak"]);return d.reduce(function(h,m){var _,E,C,D,I;return _=ze(m,["tkhd"])[0],!_||(E=_[0],C=E===0?12:20,D=Bn(_[C]<<24|_[C+1]<<16|_[C+2]<<8|_[C+3]),I=ze(m,["mdia","mdhd"])[0],!I)?null:(E=I[0],C=E===0?12:20,h[D]=Bn(I[C]<<24|I[C+1]<<16|I[C+2]<<8|I[C+3]),h)},c)},sc=function(o,c){var d;d=ze(c,["moof","traf"]);var h=d.reduce(function(m,_){var E=ze(_,["tfhd"])[0],C=Bn(E[4]<<24|E[5]<<16|E[6]<<8|E[7]),D=o[C]||9e4,I=ze(_,["tfdt"])[0],N=new DataView(I.buffer,I.byteOffset,I.byteLength),V;I[0]===1?V=F0(I.subarray(4,12)):V=N.getUint32(4);let Q;return typeof V=="bigint"?Q=V/vo.BigInt(D):typeof V=="number"&&!isNaN(V)&&(Q=V/D),Q<Number.MAX_SAFE_INTEGER&&(Q=Number(Q)),Q<m&&(m=Q),m},1/0);return typeof h=="bigint"||isFinite(h)?h:0},nc=function(o,c){var d=ze(c,["moof","traf"]),h=0,m=0,_;if(d&&d.length){var E=ze(d[0],["tfhd"])[0],C=ze(d[0],["trun"])[0],D=ze(d[0],["tfdt"])[0];if(E){var I=B0(E);_=I.trackId}if(D){var N=U0(D);h=N.baseMediaDecodeTime}if(C){var V=M0(C);V.samples&&V.samples.length&&(m=V.samples[0].compositionTimeOffset||0)}}var Q=o[_]||9e4;typeof h=="bigint"&&(m=vo.BigInt(m),Q=vo.BigInt(Q));var z=(h+m)/Q;return typeof z=="bigint"&&z<Number.MAX_SAFE_INTEGER&&(z=Number(z)),z},ac=function(o){var c=ze(o,["moov","trak"]),d=[];return c.forEach(function(h){var m=ze(h,["mdia","hdlr"]),_=ze(h,["tkhd"]);m.forEach(function(E,C){var D=mr(E.subarray(8,12)),I=_[C],N,V,Q;D==="vide"&&(N=new DataView(I.buffer,I.byteOffset,I.byteLength),V=N.getUint8(0),Q=V===0?N.getUint32(12):N.getUint32(20),d.push(Q))})}),d},To=function(o){var c=o[0],d=c===0?12:20;return Bn(o[d]<<24|o[d+1]<<16|o[d+2]<<8|o[d+3])},oc=function(o){var c=ze(o,["moov","trak"]),d=[];return c.forEach(function(h){var m={},_=ze(h,["tkhd"])[0],E,C;_&&(E=new DataView(_.buffer,_.byteOffset,_.byteLength),C=E.getUint8(0),m.id=C===0?E.getUint32(12):E.getUint32(20));var D=ze(h,["mdia","hdlr"])[0];if(D){var I=mr(D.subarray(8,12));I==="vide"?m.type="video":I==="soun"?m.type="audio":m.type=I}var N=ze(h,["mdia","minf","stbl","stsd"])[0];if(N){var V=N.subarray(8);m.codec=mr(V.subarray(4,8));var Q=ze(V,[m.codec])[0],z,re;Q&&(/^[asm]vc[1-9]$/i.test(m.codec)?(z=Q.subarray(78),re=mr(z.subarray(4,8)),re==="avcC"&&z.length>11?(m.codec+=".",m.codec+=_s(z[9]),m.codec+=_s(z[10]),m.codec+=_s(z[11])):m.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(m.codec)?(z=Q.subarray(28),re=mr(z.subarray(4,8)),re==="esds"&&z.length>20&&z[19]!==0?(m.codec+="."+_s(z[19]),m.codec+="."+_s(z[20]>>>2&63).replace(/^0/,"")):m.codec="mp4a.40.2"):m.codec=m.codec.toLowerCase())}var ae=ze(h,["mdia","mdhd"])[0];ae&&(m.timescale=To(ae)),d.push(m)}),d},lc=function(o,c=0){var d=ze(o,["emsg"]);return d.map(h=>{var m=_o.parseEmsgBox(new Uint8Array(h)),_=$0(m.message_data);return{cueTime:_o.scaleTime(m.presentation_time,m.timescale,m.presentation_time_delta,c),duration:_o.scaleTime(m.event_duration,m.timescale),frames:_}})};var Ts={findBox:ze,parseType:mr,timescale:rc,startTime:sc,compositionStartTime:nc,videoTrackIds:ac,tracks:oc,getTimescaleFromMediaHeader:To,getEmsgID3:lc};const{parseTrun:j0}=ec,{findBox:uc}=Ts;var cc=ic,V0=function(o){var c=uc(o,["moof","traf"]),d=uc(o,["mdat"]),h=[];return d.forEach(function(m,_){var E=c[_];h.push({mdat:m,traf:E})}),h},q0=function(o,c,d){var h=c,m=d.defaultSampleDuration||0,_=d.defaultSampleSize||0,E=d.trackId,C=[];return o.forEach(function(D){var I=j0(D),N=I.samples;N.forEach(function(V){V.duration===void 0&&(V.duration=m),V.size===void 0&&(V.size=_),V.trackId=E,V.dts=h,V.compositionTimeOffset===void 0&&(V.compositionTimeOffset=0),typeof h=="bigint"?(V.pts=h+cc.BigInt(V.compositionTimeOffset),h+=cc.BigInt(V.duration)):(V.pts=h+V.compositionTimeOffset,h+=V.duration)}),C=C.concat(N)}),C},dc={getMdatTrafPairs:V0,parseSamples:q0},H0=Pu.discardEmulationPreventionBytes,z0=Lu.CaptionStream,bo=On,W0=mo,G0=go,{getMdatTrafPairs:K0,parseSamples:X0}=dc,Y0=function(o,c){for(var d=o,h=0;h<c.length;h++){var m=c[h];if(d<m.size)return m;d-=m.size}return null},Q0=function(o,c,d){var h=new DataView(o.buffer,o.byteOffset,o.byteLength),m={logs:[],seiNals:[]},_,E,C,D;for(E=0;E+4<o.length;E+=C)if(C=h.getUint32(E),E+=4,!(C<=0))switch(o[E]&31){case 6:var I=o.subarray(E+1,E+1+C),N=Y0(E,c);if(_={nalUnitType:"sei_rbsp",size:C,data:I,escapedRBSP:H0(I),trackId:d},N)_.pts=N.pts,_.dts=N.dts,D=N;else if(D)_.pts=D.pts,_.dts=D.dts;else{m.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+E+" for trackId "+d+". See mux.js#223."});break}m.seiNals.push(_);break}return m},J0=function(o,c){var d={},h=K0(o);return h.forEach(function(m){var _=m.mdat,E=m.traf,C=bo(E,["tfhd"]),D=G0(C[0]),I=D.trackId,N=bo(E,["tfdt"]),V=N.length>0?W0(N[0]).baseMediaDecodeTime:0,Q=bo(E,["trun"]),z,re;c===I&&Q.length>0&&(z=X0(Q,V,D),re=Q0(_,z,I),d[I]||(d[I]={seiNals:[],logs:[]}),d[I].seiNals=d[I].seiNals.concat(re.seiNals),d[I].logs=d[I].logs.concat(re.logs))}),d},Z0=function(o,c,d){var h;if(c===null)return null;h=J0(o,c);var m=h[c]||{};return{seiNals:m.seiNals,logs:m.logs,timescale:d}},ey=function(){var o=!1,c,d,h,m,_,E;this.isInitialized=function(){return o},this.init=function(C){c=new z0,o=!0,E=C?C.isPartial:!1,c.on("data",function(D){D.startTime=D.startPts/m,D.endTime=D.endPts/m,_.captions.push(D),_.captionStreams[D.stream]=!0}),c.on("log",function(D){_.logs.push(D)})},this.isNewInit=function(C,D){return C&&C.length===0||D&&typeof D=="object"&&Object.keys(D).length===0?!1:h!==C[0]||m!==D[h]},this.parse=function(C,D,I){var N;if(this.isInitialized()){if(!D||!I)return null;if(this.isNewInit(D,I))h=D[0],m=I[h];else if(h===null||!m)return d.push(C),null}else return null;for(;d.length>0;){var V=d.shift();this.parse(V,D,I)}return N=Z0(C,h,m),N&&N.logs&&(_.logs=_.logs.concat(N.logs)),N===null||!N.seiNals?_.logs.length?{logs:_.logs,captions:[],captionStreams:[]}:null:(this.pushNals(N.seiNals),this.flushStream(),_)},this.pushNals=function(C){if(!this.isInitialized()||!C||C.length===0)return null;C.forEach(function(D){c.push(D)})},this.flushStream=function(){if(!this.isInitialized())return null;E?c.partialFlush():c.flush()},this.clearParsedCaptions=function(){_.captions=[],_.captionStreams={},_.logs=[]},this.resetCaptionStream=function(){if(!this.isInitialized())return null;c.reset()},this.clearAllCaptions=function(){this.clearParsedCaptions(),this.resetCaptionStream()},this.reset=function(){d=[],h=null,m=null,_?this.clearParsedCaptions():_={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},ty=ey;const{parseTfdt:iy}=ec,Li=On,{getTimescaleFromMediaHeader:ry}=Ts,{parseSamples:sy,getMdatTrafPairs:ny}=dc;var hc=function(){let o=9e4;this.init=function(c){const d=Li(c,["moov","trak","mdia","mdhd"])[0];d&&(o=ry(d))},this.parseSegment=function(c){const d=[],h=ny(c);let m=0;return h.forEach(function(_){const E=_.mdat,C=_.traf,D=Li(C,["tfdt"])[0],I=Li(C,["tfhd"])[0],N=Li(C,["trun"]);if(D&&(m=iy(D).baseMediaDecodeTime),N.length&&I){const V=sy(N,m,I);let Q=0;V.forEach(function(z){const re="utf-8",ae=new TextDecoder(re),Qe=E.slice(Q,Q+z.size);if(Li(Qe,["vtte"])[0]){Q+=z.size;return}Li(Qe,["vttc"]).forEach(function(vs){const bs=Li(vs,["payl"])[0],xs=Li(vs,["sttg"])[0],Ss=z.pts/o,Fn=(z.pts+z.duration)/o;let Le,Es;if(bs)try{Le=ae.decode(bs)}catch(zt){console.error(zt)}if(xs)try{Es=ae.decode(xs)}catch(zt){console.error(zt)}z.duration&&Le&&d.push({cueText:Le,start:Ss,end:Fn,settings:Es})}),Q+=z.size})}}),d}},xo=vn,fc=function(o){var c=o[1]&31;return c<<=8,c|=o[2],c},Mn=function(o){return!!(o[1]&64)},Un=function(o){var c=0;return(o[3]&48)>>>4>1&&(c+=o[4]+1),c},ay=function(o,c){var d=fc(o);return d===0?"pat":d===c?"pmt":c?"pes":null},oy=function(o){var c=Mn(o),d=4+Un(o);return c&&(d+=o[d]+1),(o[d+10]&31)<<8|o[d+11]},ly=function(o){var c={},d=Mn(o),h=4+Un(o);if(d&&(h+=o[h]+1),!!(o[h+5]&1)){var m,_,E;m=(o[h+1]&15)<<8|o[h+2],_=3+m-4,E=(o[h+10]&15)<<8|o[h+11];for(var C=12+E;C<_;){var D=h+C;c[(o[D+1]&31)<<8|o[D+2]]=o[D],C+=((o[D+3]&15)<<8|o[D+4])+5}return c}},uy=function(o,c){var d=fc(o),h=c[d];switch(h){case xo.H264_STREAM_TYPE:return"video";case xo.ADTS_STREAM_TYPE:return"audio";case xo.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},cy=function(o){var c=Mn(o);if(!c)return null;var d=4+Un(o);if(d>=o.byteLength)return null;var h=null,m;return m=o[d+7],m&192&&(h={},h.pts=(o[d+9]&14)<<27|(o[d+10]&255)<<20|(o[d+11]&254)<<12|(o[d+12]&255)<<5|(o[d+13]&254)>>>3,h.pts*=4,h.pts+=(o[d+13]&6)>>>1,h.dts=h.pts,m&64&&(h.dts=(o[d+14]&14)<<27|(o[d+15]&255)<<20|(o[d+16]&254)<<12|(o[d+17]&255)<<5|(o[d+18]&254)>>>3,h.dts*=4,h.dts+=(o[d+18]&6)>>>1)),h},So=function(o){switch(o){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},dy=function(o){for(var c=4+Un(o),d=o.subarray(c),h=0,m=0,_=!1,E;m<d.byteLength-3;m++)if(d[m+2]===1){h=m+5;break}for(;h<d.byteLength;)switch(d[h]){case 0:if(d[h-1]!==0){h+=2;break}else if(d[h-2]!==0){h++;break}m+3!==h-2&&(E=So(d[m+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0));do h++;while(d[h]!==1&&h<d.length);m=h-2,h+=3;break;case 1:if(d[h-1]!==0||d[h-2]!==0){h+=3;break}E=So(d[m+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0),m=h-2,h+=3;break;default:h+=3;break}return d=d.subarray(m),h-=m,m=0,d&&d.byteLength>3&&(E=So(d[m+3]&31),E==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0)),_},hy={parseType:ay,parsePat:oy,parsePmt:ly,parsePayloadUnitStartIndicator:Mn,parsePesType:uy,parsePesTime:cy,videoPacketContainsKeyFrame:dy},pc=vn,gr=Ou.handleRollover,xe={};xe.ts=hy,xe.aac=uo;var Qi=y.ONE_SECOND_IN_TS,lt=188,Qt=71,fy=function(o,c){for(var d=0,h=lt,m,_;h<o.byteLength;){if(o[d]===Qt&&o[h]===Qt){switch(m=o.subarray(d,h),_=xe.ts.parseType(m,c.pid),_){case"pat":c.pid=xe.ts.parsePat(m);break;case"pmt":var E=xe.ts.parsePmt(m);c.table=c.table||{},Object.keys(E).forEach(function(C){c.table[C]=E[C]});break}d+=lt,h+=lt;continue}d++,h++}},mc=function(o,c,d){for(var h=0,m=lt,_,E,C,D,I,N=!1;m<=o.byteLength;){if(o[h]===Qt&&(o[m]===Qt||m===o.byteLength)){switch(_=o.subarray(h,m),E=xe.ts.parseType(_,c.pid),E){case"pes":C=xe.ts.parsePesType(_,c.table),D=xe.ts.parsePayloadUnitStartIndicator(_),C==="audio"&&D&&(I=xe.ts.parsePesTime(_),I&&(I.type="audio",d.audio.push(I),N=!0));break}if(N)break;h+=lt,m+=lt;continue}h++,m++}for(m=o.byteLength,h=m-lt,N=!1;h>=0;){if(o[h]===Qt&&(o[m]===Qt||m===o.byteLength)){switch(_=o.subarray(h,m),E=xe.ts.parseType(_,c.pid),E){case"pes":C=xe.ts.parsePesType(_,c.table),D=xe.ts.parsePayloadUnitStartIndicator(_),C==="audio"&&D&&(I=xe.ts.parsePesTime(_),I&&(I.type="audio",d.audio.push(I),N=!0));break}if(N)break;h-=lt,m-=lt;continue}h--,m--}},py=function(o,c,d){for(var h=0,m=lt,_,E,C,D,I,N,V,Q,z=!1,re={data:[],size:0};m<o.byteLength;){if(o[h]===Qt&&o[m]===Qt){switch(_=o.subarray(h,m),E=xe.ts.parseType(_,c.pid),E){case"pes":if(C=xe.ts.parsePesType(_,c.table),D=xe.ts.parsePayloadUnitStartIndicator(_),C==="video"&&(D&&!z&&(I=xe.ts.parsePesTime(_),I&&(I.type="video",d.video.push(I),z=!0)),!d.firstKeyFrame)){if(D&&re.size!==0){for(N=new Uint8Array(re.size),V=0;re.data.length;)Q=re.data.shift(),N.set(Q,V),V+=Q.byteLength;if(xe.ts.videoPacketContainsKeyFrame(N)){var ae=xe.ts.parsePesTime(N);ae?(d.firstKeyFrame=ae,d.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(_),re.size+=_.byteLength}break}if(z&&d.firstKeyFrame)break;h+=lt,m+=lt;continue}h++,m++}for(m=o.byteLength,h=m-lt,z=!1;h>=0;){if(o[h]===Qt&&o[m]===Qt){switch(_=o.subarray(h,m),E=xe.ts.parseType(_,c.pid),E){case"pes":C=xe.ts.parsePesType(_,c.table),D=xe.ts.parsePayloadUnitStartIndicator(_),C==="video"&&D&&(I=xe.ts.parsePesTime(_),I&&(I.type="video",d.video.push(I),z=!0));break}if(z)break;h-=lt,m-=lt;continue}h--,m--}},my=function(o,c){if(o.audio&&o.audio.length){var d=c;(typeof d>"u"||isNaN(d))&&(d=o.audio[0].dts),o.audio.forEach(function(_){_.dts=gr(_.dts,d),_.pts=gr(_.pts,d),_.dtsTime=_.dts/Qi,_.ptsTime=_.pts/Qi})}if(o.video&&o.video.length){var h=c;if((typeof h>"u"||isNaN(h))&&(h=o.video[0].dts),o.video.forEach(function(_){_.dts=gr(_.dts,h),_.pts=gr(_.pts,h),_.dtsTime=_.dts/Qi,_.ptsTime=_.pts/Qi}),o.firstKeyFrame){var m=o.firstKeyFrame;m.dts=gr(m.dts,h),m.pts=gr(m.pts,h),m.dtsTime=m.dts/Qi,m.ptsTime=m.pts/Qi}}},gy=function(o){for(var c=!1,d=0,h=null,m=null,_=0,E=0,C;o.length-E>=3;){var D=xe.aac.parseType(o,E);switch(D){case"timed-metadata":if(o.length-E<10){c=!0;break}if(_=xe.aac.parseId3TagSize(o,E),_>o.length){c=!0;break}m===null&&(C=o.subarray(E,E+_),m=xe.aac.parseAacTimestamp(C)),E+=_;break;case"audio":if(o.length-E<7){c=!0;break}if(_=xe.aac.parseAdtsSize(o,E),_>o.length){c=!0;break}h===null&&(C=o.subarray(E,E+_),h=xe.aac.parseSampleRate(C)),d++,E+=_;break;default:E++;break}if(c)return null}if(h===null||m===null)return null;var I=Qi/h,N={audio:[{type:"audio",dts:m,pts:m},{type:"audio",dts:m+d*1024*I,pts:m+d*1024*I}]};return N},yy=function(o){var c={pid:null,table:null},d={};fy(o,c);for(var h in c.table)if(c.table.hasOwnProperty(h)){var m=c.table[h];switch(m){case pc.H264_STREAM_TYPE:d.video=[],py(o,c,d),d.video.length===0&&delete d.video;break;case pc.ADTS_STREAM_TYPE:d.audio=[],mc(o,c,d),d.audio.length===0&&delete d.audio;break}}return d},_y=function(o,c){var d=xe.aac.isLikelyAacData(o),h;return d?h=gy(o):h=yy(o),!h||!h.audio&&!h.video?null:(my(h,c),h)},Ty={inspect:_y,parseAudioPes_:mc};const vy=function(o,c){c.on("data",function(d){const h=d.initSegment;d.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const m=d.data;d.data=m.buffer,o.postMessage({action:"data",segment:d,byteOffset:m.byteOffset,byteLength:m.byteLength},[d.data])}),c.on("done",function(d){o.postMessage({action:"done"})}),c.on("gopInfo",function(d){o.postMessage({action:"gopInfo",gopInfo:d})}),c.on("videoSegmentTimingInfo",function(d){const h={start:{decode:y.videoTsToSeconds(d.start.dts),presentation:y.videoTsToSeconds(d.start.pts)},end:{decode:y.videoTsToSeconds(d.end.dts),presentation:y.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=y.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),c.on("audioSegmentTimingInfo",function(d){const h={start:{decode:y.videoTsToSeconds(d.start.dts),presentation:y.videoTsToSeconds(d.start.pts)},end:{decode:y.videoTsToSeconds(d.end.dts),presentation:y.videoTsToSeconds(d.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(d.baseMediaDecodeTime)};d.prependedContentDuration&&(h.prependedContentDuration=y.videoTsToSeconds(d.prependedContentDuration)),o.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),c.on("id3Frame",function(d){o.postMessage({action:"id3Frame",id3Frame:d})}),c.on("caption",function(d){o.postMessage({action:"caption",caption:d})}),c.on("trackinfo",function(d){o.postMessage({action:"trackinfo",trackInfo:d})}),c.on("audioTimingInfo",function(d){o.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:y.videoTsToSeconds(d.start),end:y.videoTsToSeconds(d.end)}})}),c.on("videoTimingInfo",function(d){o.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:y.videoTsToSeconds(d.start),end:y.videoTsToSeconds(d.end)}})}),c.on("log",function(d){o.postMessage({action:"log",log:d})})};class gc{constructor(c,d){this.options=d||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new d0.Transmuxer(this.options),vy(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new ty,this.captionParser.init());const d=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.captionParser.parse(d,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:d.buffer},[d.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new hc);const d=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(d)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new hc);const d=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.webVttParser.parseSegment(d);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:d.buffer},[d.buffer])}probeMp4StartTime({timescales:c,data:d}){const h=Ts.startTime(c,d);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:d},[d.buffer])}probeMp4Tracks({data:c}){const d=Ts.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:d,data:c},[c.buffer])}probeEmsgID3({data:c,offset:d}){const h=Ts.getEmsgID3(c,d);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:d}){const h=typeof d=="number"&&!isNaN(d)?d*y.ONE_SECOND_IN_TS:void 0,m=Ty.inspect(c,h);let _=null;m&&(_={hasVideo:m.video&&m.video.length===2||!1,hasAudio:m.audio&&m.audio.length===2||!1},_.hasVideo&&(_.videoStart=m.video[0].ptsTime),_.hasAudio&&(_.audioStart=m.audio[0].ptsTime)),this.self.postMessage({action:"probeTs",result:_,data:c},[c.buffer])}clearAllMp4Captions(){this.captionParser&&this.captionParser.clearAllCaptions()}clearParsedMp4Captions(){this.captionParser&&this.captionParser.clearParsedCaptions()}push(c){const d=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(d)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const d=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(y.secondsToVideoTs(d)))}setAudioAppendStart(c){this.transmuxer.setAudioAppendStart(Math.ceil(y.secondsToVideoTs(c.appendStart)))}setRemux(c){this.transmuxer.setRemux(c.remux)}flush(c){this.transmuxer.flush(),self.postMessage({action:"done",type:"transmuxed"})}endTimeline(){this.transmuxer.endTimeline(),self.postMessage({action:"endedtimeline",type:"transmuxed"})}alignGopsWith(c){this.transmuxer.alignGopsWith(c.gopsToAlignWith.slice())}}self.onmessage=function(o){if(o.data.action==="init"&&o.data.options){this.messageHandlers=new gc(self,o.data.options);return}this.messageHandlers||(this.messageHandlers=new gc(self)),o.data&&o.data.action&&o.data.action!=="init"&&this.messageHandlers[o.data.action]&&this.messageHandlers[o.data.action](o.data)}}));var Gx=Mm(Wx);const Kx=(i,e,t)=>{const{type:r,initSegment:s,captions:n,captionStreams:a,metadata:l,videoFrameDtsTime:u,videoFramePtsTime:f}=i.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:l});const p=i.data.segment.boxes||{data:i.data.segment.data},T={type:r,data:new Uint8Array(p.data,p.data.byteOffset,p.data.byteLength),initSegment:new Uint8Array(s.data,s.byteOffset,s.byteLength)};typeof u<"u"&&(T.videoFrameDtsTime=u),typeof f<"u"&&(T.videoFramePtsTime=f),t(T)},Xx=({transmuxedData:i,callback:e})=>{i.buffer=[],e(i)},Yx=(i,e)=>{e.gopInfo=i.data.gopInfo},$m=i=>{const{transmuxer:e,bytes:t,audioAppendStart:r,gopsToAlignWith:s,remux:n,onData:a,onTrackInfo:l,onAudioTimingInfo:u,onVideoTimingInfo:f,onVideoSegmentTimingInfo:p,onAudioSegmentTimingInfo:T,onId3:b,onCaptions:S,onDone:A,onEndedTimeline:v,onTransmuxerLog:L,isEndOfTimeline:P,segment:M,triggerSegmentEventFn:O}=i,U={buffer:[]};let R=P;const q=K=>{e.currentTransmux===i&&(K.data.action==="data"&&Kx(K,U,a),K.data.action==="trackinfo"&&l(K.data.trackInfo),K.data.action==="gopInfo"&&Yx(K,U),K.data.action==="audioTimingInfo"&&u(K.data.audioTimingInfo),K.data.action==="videoTimingInfo"&&f(K.data.videoTimingInfo),K.data.action==="videoSegmentTimingInfo"&&p(K.data.videoSegmentTimingInfo),K.data.action==="audioSegmentTimingInfo"&&T(K.data.audioSegmentTimingInfo),K.data.action==="id3Frame"&&b([K.data.id3Frame],K.data.id3Frame.dispatchType),K.data.action==="caption"&&S(K.data.caption),K.data.action==="endedtimeline"&&(R=!1,v()),K.data.action==="log"&&L(K.data.log),K.data.type==="transmuxed"&&(R||(e.onmessage=null,Xx({transmuxedData:U,callback:A}),jm(e))))},Y=()=>{const K={message:"Received an error message from the transmuxer worker",metadata:{errorType:F.Error.StreamingFailedToTransmuxSegment,segmentInfo:er({segment:M})}};A(null,K)};if(e.onmessage=q,e.onerror=Y,r&&e.postMessage({action:"setAudioAppendStart",appendStart:r}),Array.isArray(s)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),typeof n<"u"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const K=t instanceof ArrayBuffer?t:t.buffer,ie=t instanceof ArrayBuffer?0:t.byteOffset;O({type:"segmenttransmuxingstart",segment:M}),e.postMessage({action:"push",data:K,byteOffset:ie,byteLength:t.byteLength},[K])}P&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},jm=i=>{i.currentTransmux=null,i.transmuxQueue.length&&(i.currentTransmux=i.transmuxQueue.shift(),typeof i.currentTransmux=="function"?i.currentTransmux():$m(i.currentTransmux))},Qd=(i,e)=>{i.postMessage({action:e}),jm(i)},Vm=(i,e)=>{if(!e.currentTransmux){e.currentTransmux=i,Qd(e,i);return}e.transmuxQueue.push(Qd.bind(null,e,i))},Qx=i=>{Vm("reset",i)},Jx=i=>{Vm("endTimeline",i)},qm=i=>{if(!i.transmuxer.currentTransmux){i.transmuxer.currentTransmux=i,$m(i);return}i.transmuxer.transmuxQueue.push(i)},Zx=i=>{const e=new Gx;e.currentTransmux=null,e.transmuxQueue=[];const t=e.terminate;return e.terminate=()=>(e.currentTransmux=null,e.transmuxQueue.length=0,t.call(e)),e.postMessage({action:"init",options:i}),e};var zo={reset:Qx,endTimeline:Jx,transmux:qm,createTransmuxer:Zx};const Nr=function(i){const e=i.transmuxer,t=i.endAction||i.action,r=i.callback,s=Ke({},i,{endAction:null,transmuxer:null,callback:null}),n=a=>{a.data.action===t&&(e.removeEventListener("message",n),a.data.data&&(a.data.data=new Uint8Array(a.data.data,i.byteOffset||0,i.byteLength||a.data.data.byteLength),i.data&&(i.data=a.data.data)),r(a.data))};if(e.addEventListener("message",n),i.data){const a=i.data instanceof ArrayBuffer;s.byteOffset=a?0:i.data.byteOffset,s.byteLength=i.data.byteLength;const l=[a?i.data:i.data.buffer];e.postMessage(s,l)}else e.postMessage(s)},oi={FAILURE:2,TIMEOUT:-101,ABORTED:-102},Hm="wvtt",Tl=i=>{i.forEach(e=>{e.abort()})},eS=i=>({bandwidth:i.bandwidth,bytesReceived:i.bytesReceived||0,roundTripTime:i.roundTripTime||0}),tS=i=>{const e=i.target,r={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return r.bytesReceived=i.loaded,r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3),r},wu=(i,e)=>{const{requestType:t}=e,r=or({requestType:t,request:e,error:i});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:oi.TIMEOUT,xhr:e,metadata:r}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:oi.ABORTED,xhr:e,metadata:r}:i?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:oi.FAILURE,xhr:e,metadata:r}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:oi.FAILURE,xhr:e,metadata:r}:null},Jd=(i,e,t,r)=>(s,n)=>{const a=n.response,l=wu(s,n);if(l)return t(l,i);if(a.byteLength!==16)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:oi.FAILURE,xhr:n},i);const u=new DataView(a),f=new Uint32Array([u.getUint32(0),u.getUint32(4),u.getUint32(8),u.getUint32(12)]);for(let T=0;T<e.length;T++)e[T].bytes=f;const p={uri:n.uri};return r({type:"segmentkeyloadcomplete",segment:i,keyInfo:p}),t(null,i)},iS=(i,e)=>{e===Hm&&i.transmuxer.postMessage({action:"initMp4WebVttParser",data:i.map.bytes})},rS=(i,e,t)=>{e===Hm&&Nr({action:"getMp4WebVttText",data:i.bytes,transmuxer:i.transmuxer,callback:({data:r,mp4VttCues:s})=>{i.bytes=r,t(null,i,{mp4VttCues:s})}})},zm=(i,e)=>{const t=Gl(i.map.bytes);if(t!=="mp4"){const r=i.map.resolvedUri||i.map.uri,s=t||"unknown";return e({internal:!0,message:`Found unsupported ${s} container for initialization segment at URL: ${r}`,code:oi.FAILURE,metadata:{mediaType:s}})}Nr({action:"probeMp4Tracks",data:i.map.bytes,transmuxer:i.transmuxer,callback:({tracks:r,data:s})=>(i.map.bytes=s,r.forEach(function(n){i.map.tracks=i.map.tracks||{},!i.map.tracks[n.type]&&(i.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(i.map.timescales=i.map.timescales||{},i.map.timescales[n.id]=n.timescale),n.type==="text"&&iS(i,n.codec))}),e(null))})},sS=({segment:i,finishProcessingFn:e,triggerSegmentEventFn:t})=>(r,s)=>{const n=wu(r,s);if(n)return e(n,i);const a=new Uint8Array(s.response);if(t({type:"segmentloaded",segment:i}),i.map.key)return i.map.encryptedBytes=a,e(null,i);i.map.bytes=a,zm(i,function(l){if(l)return l.xhr=s,l.status=s.status,e(l,i);e(null,i)})},nS=({segment:i,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:r})=>(s,n)=>{const a=wu(s,n);if(a)return e(a,i);r({type:"segmentloaded",segment:i});const l=t==="arraybuffer"||!n.responseText?n.response:Hx(n.responseText.substring(i.lastReachedChar||0));return i.stats=eS(n),i.key?i.encryptedBytes=new Uint8Array(l):i.bytes=new Uint8Array(l),e(null,i)},aS=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})=>{const A=i.map&&i.map.tracks||{},v=!!(A.audio&&A.video);let L=r.bind(null,i,"audio","start");const P=r.bind(null,i,"audio","end");let M=r.bind(null,i,"video","start");const O=r.bind(null,i,"video","end"),U=()=>qm({bytes:e,transmuxer:i.transmuxer,audioAppendStart:i.audioAppendStart,gopsToAlignWith:i.gopsToAlignWith,remux:v,onData:R=>{R.type=R.type==="combined"?"video":R.type,p(i,R)},onTrackInfo:R=>{t&&(v&&(R.isMuxed=!0),t(i,R))},onAudioTimingInfo:R=>{L&&typeof R.start<"u"&&(L(R.start),L=null),P&&typeof R.end<"u"&&P(R.end)},onVideoTimingInfo:R=>{M&&typeof R.start<"u"&&(M(R.start),M=null),O&&typeof R.end<"u"&&O(R.end)},onVideoSegmentTimingInfo:R=>{const q={pts:{start:R.start.presentation,end:R.end.presentation},dts:{start:R.start.decode,end:R.end.decode}};S({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:q}),s(R)},onAudioSegmentTimingInfo:R=>{const q={pts:{start:R.start.pts,end:R.end.pts},dts:{start:R.start.dts,end:R.end.dts}};S({type:"segmenttransmuxingtiminginfoavailable",segment:i,timingInfo:q}),n(R)},onId3:(R,q)=>{a(i,R,q)},onCaptions:R=>{l(i,[R])},isEndOfTimeline:u,onEndedTimeline:()=>{f()},onTransmuxerLog:b,onDone:(R,q)=>{T&&(R.type=R.type==="combined"?"video":R.type,S({type:"segmenttransmuxingcomplete",segment:i}),T(q,i,R))},segment:i,triggerSegmentEventFn:S});Nr({action:"probeTs",transmuxer:i.transmuxer,data:e,baseStartTime:i.baseStartTime,callback:R=>{i.bytes=e=R.data;const q=R.result;q&&(t(i,{hasAudio:q.hasAudio,hasVideo:q.hasVideo,isMuxed:v}),t=null),U()}})},Wm=({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})=>{let A=new Uint8Array(e);if(D2(A)){i.isFmp4=!0;const{tracks:v}=i.map;if(v.text&&(!v.audio||!v.video)){p(i,{data:A,type:"text"}),rS(i,v.text.codec,T);return}const P={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(P.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(P.videoCodec=v.video.codec),v.video&&v.audio&&(P.isMuxed=!0),t(i,P);const M=(O,U)=>{p(i,{data:A,type:P.hasAudio&&!P.isMuxed?"audio":"video"}),U&&U.length&&a(i,U),O&&O.length&&l(i,O),T(null,i,{})};Nr({action:"probeMp4StartTime",timescales:i.map.timescales,data:A,transmuxer:i.transmuxer,callback:({data:O,startTime:U})=>{e=O.buffer,i.bytes=A=O,P.hasAudio&&!P.isMuxed&&r(i,"audio","start",U),P.hasVideo&&r(i,"video","start",U),Nr({action:"probeEmsgID3",data:A,transmuxer:i.transmuxer,offset:U,callback:({emsgData:R,id3Frames:q})=>{if(e=R.buffer,i.bytes=A=R,!v.video||!R.byteLength||!i.transmuxer){M(void 0,q);return}Nr({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:i.transmuxer,data:A,timescales:i.map.timescales,trackIds:[v.video.id],callback:Y=>{e=Y.data.buffer,i.bytes=A=Y.data,Y.logs.forEach(function(K){b(Te(K,{stream:"mp4CaptionParser"}))}),M(Y.captions,q)}})}})}});return}if(!i.transmuxer){T(null,i,{});return}if(typeof i.container>"u"&&(i.container=Gl(A)),i.container!=="ts"&&i.container!=="aac"){t(i,{hasAudio:!1,hasVideo:!1}),T(null,i,{});return}aS({segment:i,bytes:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})},Gm=function({id:i,key:e,encryptedBytes:t,decryptionWorker:r,segment:s,doneFn:n},a){const l=f=>{if(f.data.source===i){r.removeEventListener("message",l);const p=f.data.decrypted;a(new Uint8Array(p.bytes,p.byteOffset,p.byteLength))}};r.onerror=()=>{const f="An error occurred in the decryption worker",p=er({segment:s}),T={message:f,metadata:{error:new Error(f),errorType:F.Error.StreamingFailedToDecryptSegment,segmentInfo:p,keyInfo:{uri:s.key.resolvedUri||s.map.key.resolvedUri}}};n(T,s)},r.addEventListener("message",l);let u;e.bytes.slice?u=e.bytes.slice():u=new Uint32Array(Array.prototype.slice.call(e.bytes)),r.postMessage(Pm({source:i,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},oS=({decryptionWorker:i,segment:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})=>{S({type:"segmentdecryptionstart"}),Gm({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:i,segment:e,doneFn:T},A=>{e.bytes=A,S({type:"segmentdecryptioncomplete",segment:e}),Wm({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})})},lS=({activeXhrs:i,decryptionWorker:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})=>{let A=0,v=!1;return(L,P)=>{if(!v){if(L)return v=!0,Tl(i),T(L,P);if(A+=1,A===i.length){const M=function(){if(P.encryptedBytes)return oS({decryptionWorker:e,segment:P,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S});Wm({segment:P,bytes:P.bytes,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p,doneFn:T,onTransmuxerLog:b,triggerSegmentEventFn:S})};if(P.endOfAllRequests=Date.now(),P.map&&P.map.encryptedBytes&&!P.map.bytes)return S({type:"segmentdecryptionstart",segment:P}),Gm({decryptionWorker:e,id:P.requestId+"-init",encryptedBytes:P.map.encryptedBytes,key:P.map.key,segment:P,doneFn:T},O=>{P.map.bytes=O,S({type:"segmentdecryptioncomplete",segment:P}),zm(P,U=>{if(U)return Tl(i),T(U,P);M()})});M()}}}},uS=({loadendState:i,abortFn:e})=>t=>{t.target.aborted&&e&&!i.calledAbortFn&&(e(),i.calledAbortFn=!0)},cS=({segment:i,progressFn:e,trackInfoFn:t,timingInfoFn:r,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:l,isEndOfTimeline:u,endedTimelineFn:f,dataFn:p})=>T=>{if(!T.target.aborted)return i.stats=Te(i.stats,tS(T)),!i.stats.firstBytesReceivedAt&&i.stats.bytesReceived&&(i.stats.firstBytesReceivedAt=Date.now()),e(T,i)},dS=({xhr:i,xhrOptions:e,decryptionWorker:t,segment:r,abortFn:s,progressFn:n,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:f,id3Fn:p,captionsFn:T,isEndOfTimeline:b,endedTimelineFn:S,dataFn:A,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:P})=>{const M=[],O=lS({activeXhrs:M,decryptionWorker:t,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:f,id3Fn:p,captionsFn:T,isEndOfTimeline:b,endedTimelineFn:S,dataFn:A,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:P});if(r.key&&!r.key.bytes){const K=[r.key];r.map&&!r.map.bytes&&r.map.key&&r.map.key.resolvedUri===r.key.resolvedUri&&K.push(r.map.key);const ie=Te(e,{uri:r.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),me=Jd(r,K,O,P),le={uri:r.key.resolvedUri};P({type:"segmentkeyloadstart",segment:r,keyInfo:le});const ge=i(ie,me);M.push(ge)}if(r.map&&!r.map.bytes){if(r.map.key&&(!r.key||r.key.resolvedUri!==r.map.key.resolvedUri)){const ge=Te(e,{uri:r.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),ee=Jd(r,[r.map.key],O,P),ce={uri:r.map.key.resolvedUri};P({type:"segmentkeyloadstart",segment:r,keyInfo:ce});const te=i(ge,ee);M.push(te)}const ie=Te(e,{uri:r.map.resolvedUri,responseType:"arraybuffer",headers:yl(r.map),requestType:"segment-media-initialization"}),me=sS({segment:r,finishProcessingFn:O,triggerSegmentEventFn:P});P({type:"segmentloadstart",segment:r});const le=i(ie,me);M.push(le)}const U=Te(e,{uri:r.part&&r.part.resolvedUri||r.resolvedUri,responseType:"arraybuffer",headers:yl(r),requestType:"segment"}),R=nS({segment:r,finishProcessingFn:O,responseType:U.responseType,triggerSegmentEventFn:P});P({type:"segmentloadstart",segment:r});const q=i(U,R);q.addEventListener("progress",cS({segment:r,progressFn:n,trackInfoFn:a,timingInfoFn:l,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:f,id3Fn:p,captionsFn:T,isEndOfTimeline:b,endedTimelineFn:S,dataFn:A})),M.push(q);const Y={};return M.forEach(K=>{K.addEventListener("loadend",uS({loadendState:Y,abortFn:s}))}),()=>Tl(M)},hS=$t("CodecUtils"),fS=function(i){const e=i.attributes||{};if(e.CODECS)return ti(e.CODECS)},Km=(i,e)=>{const t=e.attributes||{};return i&&i.mediaGroups&&i.mediaGroups.AUDIO&&t.AUDIO&&i.mediaGroups.AUDIO[t.AUDIO]},pS=(i,e)=>{if(!Km(i,e))return!0;const t=e.attributes||{},r=i.mediaGroups.AUDIO[t.AUDIO];for(const s in r)if(!r[s].uri&&!r[s].playlists)return!0;return!1},xa=function(i){const e={};return i.forEach(({mediaType:t,type:r,details:s})=>{e[t]=e[t]||[],e[t].push(Zh(`${r}${s}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){hS(`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},Zd=function(i){let e=0;return i.audio&&e++,i.video&&e++,e},Ws=function(i,e){const t=e.attributes||{},r=xa(fS(e)||[]);if(Km(i,e)&&!r.audio&&!pS(i,e)){const s=xa(kv(i,t.AUDIO)||[]);s.audio&&(r.audio=s.audio)}return r},Wn=$t("PlaylistSelector"),eh=function(i){if(!i||!i.playlist)return;const e=i.playlist;return JSON.stringify({id:e.id,bandwidth:i.bandwidth,width:i.width,height:i.height,codecs:e.attributes&&e.attributes.CODECS||""})},Sa=function(i,e){if(!i)return"";const t=k.getComputedStyle(i);return t?t[e]:""},Br=function(i,e){const t=i.slice();i.sort(function(r,s){const n=e(r,s);return n===0?t.indexOf(r)-t.indexOf(s):n})},Du=function(i,e){let t,r;return i.attributes.BANDWIDTH&&(t=i.attributes.BANDWIDTH),t=t||k.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(r=e.attributes.BANDWIDTH),r=r||k.Number.MAX_VALUE,t-r},mS=function(i,e){let t,r;return i.attributes.RESOLUTION&&i.attributes.RESOLUTION.width&&(t=i.attributes.RESOLUTION.width),t=t||k.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(r=e.attributes.RESOLUTION.width),r=r||k.Number.MAX_VALUE,t===r&&i.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?i.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-r};let Xm=function(i,e,t,r,s,n){if(!i)return;const a={bandwidth:e,width:t,height:r,limitRenditionByPlayerDimensions:s};let l=i.playlists;Tt.isAudioOnly(i)&&(l=n.getAudioTrackPlaylists_(),a.audioOnly=!0);let u=l.map(R=>{let q;const Y=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.width,K=R.attributes&&R.attributes.RESOLUTION&&R.attributes.RESOLUTION.height;return q=R.attributes&&R.attributes.BANDWIDTH,q=q||k.Number.MAX_VALUE,{bandwidth:q,width:Y,height:K,playlist:R}});Br(u,(R,q)=>R.bandwidth-q.bandwidth),u=u.filter(R=>!Tt.isIncompatible(R.playlist));let f=u.filter(R=>Tt.isEnabled(R.playlist));f.length||(f=u.filter(R=>!Tt.isDisabled(R.playlist)));const p=f.filter(R=>R.bandwidth*Je.BANDWIDTH_VARIANCE<e);let T=p[p.length-1];const b=p.filter(R=>R.bandwidth===T.bandwidth)[0];if(s===!1){const R=b||f[0]||u[0];if(R&&R.playlist){let q="sortedPlaylistReps";return b&&(q="bandwidthBestRep"),f[0]&&(q="enabledPlaylistReps"),Wn(`choosing ${eh(R)} using ${q} with options`,a),R.playlist}return Wn("could not choose a playlist with options",a),null}const S=p.filter(R=>R.width&&R.height);Br(S,(R,q)=>R.width-q.width);const A=S.filter(R=>R.width===t&&R.height===r);T=A[A.length-1];const v=A.filter(R=>R.bandwidth===T.bandwidth)[0];let L,P,M;v||(L=S.filter(R=>R.width>t||R.height>r),P=L.filter(R=>R.width===L[0].width&&R.height===L[0].height),T=P[P.length-1],M=P.filter(R=>R.bandwidth===T.bandwidth)[0]);let O;if(n.leastPixelDiffSelector){const R=S.map(q=>(q.pixelDiff=Math.abs(q.width-t)+Math.abs(q.height-r),q));Br(R,(q,Y)=>q.pixelDiff===Y.pixelDiff?Y.bandwidth-q.bandwidth:q.pixelDiff-Y.pixelDiff),O=R[0]}const U=O||M||v||b||f[0]||u[0];if(U&&U.playlist){let R="sortedPlaylistReps";return O?R="leastPixelDiffRep":M?R="resolutionPlusOneRep":v?R="resolutionBestRep":b?R="bandwidthBestRep":f[0]&&(R="enabledPlaylistReps"),Wn(`choosing ${eh(U)} using ${R} with options`,a),U.playlist}return Wn("could not choose a playlist with options",a),null};const th=function(){let i=this.useDevicePixelRatio&&k.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),Xm(this.playlists.main,this.systemBandwidth,parseInt(Sa(this.tech_.el(),"width"),10)*i,parseInt(Sa(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)},gS=function(i){let e=-1,t=-1;if(i<0||i>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let r=this.useDevicePixelRatio&&k.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=i*this.systemBandwidth+(1-i)*e,t=this.systemBandwidth),Xm(this.playlists.main,e,parseInt(Sa(this.tech_.el(),"width"),10)*r,parseInt(Sa(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)}},yS=function(i){const{main:e,currentTime:t,bandwidth:r,duration:s,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:l,syncController:u}=i,f=e.playlists.filter(A=>!Tt.isIncompatible(A));let p=f.filter(Tt.isEnabled);p.length||(p=f.filter(A=>!Tt.isDisabled(A)));const b=p.filter(Tt.hasAttribute.bind(null,"BANDWIDTH")).map(A=>{const L=u.getSyncPoint(A,s,l,t)?1:2,M=Tt.estimateSegmentRequestTime(n,r,A)*L-a;return{playlist:A,rebufferingImpact:M}}),S=b.filter(A=>A.rebufferingImpact<=0);return Br(S,(A,v)=>Du(v.playlist,A.playlist)),S.length?S[0]:(Br(b,(A,v)=>A.rebufferingImpact-v.rebufferingImpact),b[0]||null)},_S=function(){const i=this.playlists.main.playlists.filter(Tt.isEnabled);return Br(i,(t,r)=>Du(t,r)),i.filter(t=>!!Ws(this.playlists.main,t).video)[0]||null},TS=i=>{let e=0,t;return i.bytes&&(t=new Uint8Array(i.bytes),i.segments.forEach(r=>{t.set(r,e),e+=r.byteLength})),t};function Ym(i){try{return new URL(i).pathname.split("/").slice(-2).join("/")}catch{return""}}const vS=function(i,e,t){if(!i[t]){e.trigger({type:"usage",name:"vhs-608"});let r=t;/^cc708_/.test(t)&&(r="SERVICE"+t.split("_")[1]);const s=e.textTracks().getTrackById(r);if(s)i[t]=s;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,l=t,u=!1;const f=n[r];f&&(a=f.label,l=f.language,u=f.default),i[t]=e.addRemoteTextTrack({kind:"captions",id:r,default:u,label:a,language:l},!1).track}}},bS=function({inbandTextTracks:i,captionArray:e,timestampOffset:t}){if(!e)return;const r=k.WebKitDataCue||k.VTTCue;e.forEach(s=>{const n=s.stream;s.content?s.content.forEach(a=>{const l=new r(s.startTime+t,s.endTime+t,a.text);l.line=a.line,l.align="left",l.position=a.position,l.positionAlign="line-left",i[n].addCue(l)}):i[n].addCue(new r(s.startTime+t,s.endTime+t,s.text))})},xS=function(i){Object.defineProperties(i.frame,{id:{get(){return F.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),i.value.key}},value:{get(){return F.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),i.value.data}},privateData:{get(){return F.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),i.value.data}}})},SS=({inbandTextTracks:i,metadataArray:e,timestampOffset:t,videoDuration:r})=>{if(!e)return;const s=k.WebKitDataCue||k.VTTCue,n=i.metadataTrack_;if(!n||(e.forEach(p=>{const T=p.cueTime+t;typeof T!="number"||k.isNaN(T)||T<0||!(T<1/0)||!p.frames||!p.frames.length||p.frames.forEach(b=>{const S=new s(T,T,b.value||b.url||b.data||"");S.frame=b,S.value=b,xS(S),n.addCue(S)})}),!n.cues||!n.cues.length))return;const a=n.cues,l=[];for(let p=0;p<a.length;p++)a[p]&&l.push(a[p]);const u=l.reduce((p,T)=>{const b=p[T.startTime]||[];return b.push(T),p[T.startTime]=b,p},{}),f=Object.keys(u).sort((p,T)=>Number(p)-Number(T));f.forEach((p,T)=>{const b=u[p],S=isFinite(r)?r:p,A=Number(f[T+1])||S;b.forEach(v=>{v.endTime=A})})},ES={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"},CS=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),AS=({inbandTextTracks:i,dateRanges:e})=>{const t=i.metadataTrack_;if(!t)return;const r=k.WebKitDataCue||k.VTTCue;e.forEach(s=>{for(const n of Object.keys(s)){if(CS.has(n))continue;const a=new r(s.startTime,s.endTime,"");a.id=s.id,a.type="com.apple.quicktime.HLS",a.value={key:ES[n],data:s[n]},(n==="scte35Out"||n==="scte35In")&&(a.value.data=new Uint8Array(a.value.data.match(/[\da-f]{2}/gi)).buffer),t.addCue(a)}s.processDateRange()})},ih=(i,e,t)=>{i.metadataTrack_||(i.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,F.browser.IS_ANY_SAFARI||(i.metadataTrack_.inBandMetadataTrackDispatchType=e))},Fs=function(i,e,t){let r,s;if(t&&t.cues)for(r=t.cues.length;r--;)s=t.cues[r],s.startTime>=i&&s.endTime<=e&&t.removeCue(s)},wS=function(i){const e=i.cues;if(!e)return;const t={};for(let r=e.length-1;r>=0;r--){const s=e[r],n=`${s.startTime}-${s.endTime}-${s.text}`;t[n]?i.removeCue(s):t[n]=s}},DS=(i,e,t)=>{if(typeof e>"u"||e===null||!i.length)return[];const r=Math.ceil((e-t+3)*tr.ONE_SECOND_IN_TS);let s;for(s=0;s<i.length&&!(i[s].pts>r);s++);return i.slice(s)},IS=(i,e,t)=>{if(!e.length)return i;if(t)return e.slice();const r=e[0].pts;let s=0;for(s;s<i.length&&!(i[s].pts>=r);s++);return i.slice(0,s).concat(e)},kS=(i,e,t,r)=>{const s=Math.ceil((e-r)*tr.ONE_SECOND_IN_TS),n=Math.ceil((t-r)*tr.ONE_SECOND_IN_TS),a=i.slice();let l=i.length;for(;l--&&!(i[l].pts<=n););if(l===-1)return a;let u=l+1;for(;u--&&!(i[u].pts<=s););return u=Math.max(u,0),a.splice(u,l-u+1),a},PS=function(i,e){if(!i&&!e||!i&&e||i&&!e)return!1;if(i===e)return!0;const t=Object.keys(i).sort(),r=Object.keys(e).sort();if(t.length!==r.length)return!1;for(let s=0;s<t.length;s++){const n=t[s];if(n!==r[s]||i[n]!==e[n])return!1}return!0},LS=function(i,e,t){e=e||[];const r=[];let s=0;for(let n=0;n<e.length;n++){const a=e[n];if(i===a.timeline&&(r.push(n),s+=a.duration,s>t))return n}return r.length===0?0:r[r.length-1]},Ls=1,RS=500,rh=i=>typeof i=="number"&&isFinite(i),Gn=1/60,OS=(i,e,t)=>i!=="main"||!e||!t?null:!t.hasAudio&&!t.hasVideo?"Neither audio nor video found in segment.":e.hasVideo&&!t.hasVideo?"Only audio found in segment when we expected video. We can't switch to audio only from a stream that had video. To get rid of this message, please add codec information to the manifest.":!e.hasVideo&&t.hasVideo?"Video found in segment when we expected only audio. We can't switch to a stream with video from an audio only stream. To get rid of this message, please add codec information to the manifest.":null,NS=(i,e,t)=>{let r=e-Je.BACK_BUFFER_LENGTH;i.length&&(r=Math.max(r,i.start(0)));const s=e-t;return Math.min(s,r)},Er=i=>{const{startOfSegment:e,duration:t,segment:r,part:s,playlist:{mediaSequence:n,id:a,segments:l=[]},mediaIndex:u,partIndex:f,timeline:p}=i,T=l.length-1;let b="mediaIndex/partIndex increment";i.getMediaInfoForTime?b=`getMediaInfoForTime (${i.getMediaInfoForTime})`:i.isSyncRequest&&(b="getSyncSegmentCandidate (isSyncRequest)"),i.independent&&(b+=` with independent ${i.independent}`);const S=typeof f=="number",A=i.segment.uri?"segment":"pre-segment",v=S?mm({preloadSegment:r})-1:0;return`${A} [${n+u}/${n+T}]`+(S?` part [${f}/${v}]`:"")+` segment start/end [${r.start} => ${r.end}]`+(S?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${p}] selected by [${b}] playlist [${a}]`},sh=i=>`${i}TimingInfo`,BS=({segmentTimeline:i,currentTimeline:e,startOfSegment:t,buffered:r,overrideCheck:s})=>!s&&i===e?null:i<e?t:r.length?r.end(r.length-1):t,vl=({timelineChangeController:i,currentTimeline:e,segmentTimeline:t,loaderType:r,audioDisabled:s})=>{if(e===t)return!1;if(r==="audio"){const n=i.lastTimelineChange({type:"main"});return!n||n.to!==t}if(r==="main"&&s){const n=i.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},MS=i=>{if(!i)return!1;const e=i.pendingTimelineChange({type:"audio"}),t=i.pendingTimelineChange({type:"main"}),r=e&&t,s=r&&e.to!==t.to;return!!(r&&e.from!==-1&&t.from!==-1&&s)},US=i=>{const e=i.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=i.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},Mi=i=>{const e=i.pendingSegment_;if(!e)return;if(vl({timelineChangeController:i.timelineChangeController_,currentTimeline:i.currentTimeline_,segmentTimeline:e.timeline,loaderType:i.loaderType_,audioDisabled:i.audioDisabled_})&&MS(i.timelineChangeController_)){if(US(i)){i.timelineChangeController_.trigger("audioTimelineBehind");return}i.timelineChangeController_.trigger("fixBadTimelineChange")}},FS=i=>{let e=0;return["video","audio"].forEach(function(t){const r=i[`${t}TimingInfo`];if(!r)return;const{start:s,end:n}=r;let a;typeof s=="bigint"||typeof n=="bigint"?a=k.BigInt(n)-k.BigInt(s):typeof s=="number"&&typeof n=="number"&&(a=n-s),typeof a<"u"&&a>e&&(e=a)}),typeof e=="bigint"&&e<Number.MAX_SAFE_INTEGER&&(e=Number(e)),e},nh=({segmentDuration:i,maxDuration:e})=>i?Math.round(i)>e+ni:!1,$S=(i,e)=>{if(e!=="hls")return null;const t=FS({audioTimingInfo:i.audioTimingInfo,videoTimingInfo:i.videoTimingInfo});if(!t)return null;const r=i.playlist.targetDuration,s=nh({segmentDuration:t,maxDuration:r*2}),n=nh({segmentDuration:t,maxDuration:r}),a=`Segment with index ${i.mediaIndex} from playlist ${i.playlist.id} has a duration of ${t} when the reported duration is ${i.duration} and the target duration is ${r}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;return s||n?{severity:s?"warn":"info",message:a}:null},er=({type:i,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),r=!!(e.map&&!e.map.bytes),s=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:i||e.type,uri:e.resolvedUri||e.uri,start:s,duration:e.duration,isEncrypted:t,isMediaInitialization:r}};class bl extends F.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_=$t(`SegmentLoader[${this.loaderType_}]`),Object.defineProperty(this,"state",{get(){return this.state_},set(r){r!==this.state_&&(this.logger_(`${this.state_} -> ${r}`),this.state_=r,this.trigger("statechange"))}}),this.sourceUpdater_.on("ready",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)}),this.sourceUpdater_.on("codecschange",r=>{this.trigger(Ke({type:"codecschange"},r))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",r=>{this.trigger(Ke({type:"timelinechange"},r)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():Mi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return zo.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_&&k.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,k.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_&&zo.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return et();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:r,isMuxed:s}=e;if(r&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(r)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const r=ba(e);let s=this.initSegments_[r];return t&&!s&&e.bytes&&(this.initSegments_[r]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:e.bytes,tracks:e.tracks,timescales:e.timescales}),s||e}segmentKey(e,t=!1){if(!e)return null;const r=Lm(e);let s=this.keyCache_[r];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[r]=s={resolvedUri:e.resolvedUri,bytes:e.bytes});const n={resolvedUri:(s||e).resolvedUri};return s&&(n.bytes=s.bytes),n}couldBeginLoading_(){return this.playlist_&&!this.paused()}load(){if(this.monitorBuffer_(),!!this.playlist_){if(this.state==="INIT"&&this.couldBeginLoading_())return this.init_();!this.couldBeginLoading_()||this.state!=="READY"&&this.state!=="INIT"||(this.state="READY")}}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}playlist(e,t={}){if(!e||this.playlist_&&this.playlist_.endList&&e.endList&&this.playlist_.uri===e.uri)return;const r=this.playlist_,s=this.pendingSegment_;this.playlist_=e,this.xhrOptions_=t,this.state==="INIT"&&(e.syncInfo={mediaSequence:e.mediaSequence,time:0},this.loaderType_==="main"&&this.syncController_.setDateTimeMappingForStart(e));let n=null;if(r&&(r.id?n=r.id:r.uri&&(n=r.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
205
209
|
currentTime: ${this.currentTime_()}
|
|
206
|
-
bufferedEnd: ${
|
|
207
|
-
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!
|
|
210
|
+
bufferedEnd: ${qo(this.buffered_())}
|
|
211
|
+
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!r||r.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-r.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const l=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!l.parts||!l.parts.length||!l.parts[this.partIndex])){const u=this.mediaIndex;this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`),this.resetLoader(),this.mediaIndex=u}}s&&(s.mediaIndex-=a,s.mediaIndex<0?(s.mediaIndex=null,s.partIndex=null):(s.mediaIndex>=0&&(s.segment=e.segments[s.mediaIndex]),s.partIndex>=0&&s.segment.parts&&(s.part=s.segment.parts[s.partIndex]))),this.syncController_.saveExpiredSegmentInfo(r,e)}pause(){this.checkBufferTimeout_&&(k.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_&&zo.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,r=()=>{},s=!1){if(t===1/0&&(t=this.duration_()),t<=e){this.logger_("skipping remove because end ${end} is <= start ${start}");return}if(!this.sourceUpdater_||!this.getMediaInfo_()){this.logger_("skipping remove because no source updater or starting media info");return}let n=1;const a=()=>{n--,n===0&&r()};(s||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(s||this.loaderType_==="main")&&(this.gopBuffer_=kS(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const l in this.inbandTextTracks_)Fs(e,t,this.inbandTextTracks_[l]);Fs(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=k.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&k.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=k.setTimeout(this.monitorBufferTick_.bind(this),RS)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:er({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_,r=this.partIndex){if(!t||!this.mediaSource_)return!1;const s=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!s||!s.parts||r+1===s.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=qo(e)||0,r=Su(e,this.currentTime_()),s=!this.hasPlayed_()&&r>=1,n=r>=this.goalBufferLength_(),a=this.playlist_.segments;if(!a.length||s||n)return null;this.syncPoint_=this.syncPoint_||this.syncController_.getSyncPoint(this.playlist_,this.duration_(),this.currentTimeline_,this.currentTime_(),this.loaderType_);const l={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(l.isSyncRequest)l.mediaIndex=LS(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${l.mediaIndex}`);else if(this.mediaIndex!==null){const b=a[this.mediaIndex],S=typeof this.partIndex=="number"?this.partIndex:-1;l.startOfSegment=b.end?b.end:t,b.parts&&b.parts[S+1]?(l.mediaIndex=this.mediaIndex,l.partIndex=S+1):l.mediaIndex=this.mediaIndex+1}else{let b,S,A;const v=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
208
212
|
For TargetTime: ${v}.
|
|
209
213
|
CurrentTime: ${this.currentTime_()}
|
|
210
214
|
BufferedEnd: ${t}
|
|
211
215
|
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
212
|
-
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const R=this.getSyncInfoFromMediaSequenceSync_(v);if(!R){const L="No sync info found while using media sequence sync";return this.error({message:L,metadata:{errorType:B.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})`),E=R.segmentIndex,C=R.partIndex,P=R.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const R=ht.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:v,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});E=R.segmentIndex,C=R.partIndex,P=R.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${v}`:`currentTime ${v}`,l.mediaIndex=E,l.startOfSegment=P,l.partIndex=C,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}const h=a[l.mediaIndex];let f=h&&typeof l.partIndex=="number"&&h.parts&&h.parts[l.partIndex];if(!h||typeof l.partIndex=="number"&&!f)return null;typeof l.partIndex!="number"&&h.parts&&(l.partIndex=0,f=h.parts[0]);const m=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&f&&!m&&!f.independent)if(l.partIndex===0){const E=a[l.mediaIndex-1],C=E.parts&&E.parts.length&&E.parts[E.parts.length-1];C&&C.independent&&(l.mediaIndex-=1,l.partIndex=E.parts.length-1,l.independent="previous segment")}else h.parts[l.partIndex-1].independent&&(l.partIndex-=1,l.independent="previous part");const T=this.mediaSource_&&this.mediaSource_.readyState==="ended";return l.mediaIndex>=a.length-1&&T&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(l))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const n=this.mediaSequenceSync_.getSyncInfoForTime(i.end);return n?(n.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),n):null}generateSegmentInfo_(e){const{independent:t,playlist:i,mediaIndex:n,startOfSegment:r,isSyncRequest:a,partIndex:l,forceTimestampOffset:h,getMediaInfoForTime:f}=e,m=i.segments[n],T=typeof l=="number"&&m.parts[l],E={requestId:"segment-loader-"+Math.random(),uri:T&&T.resolvedUri||m.resolvedUri,mediaIndex:n,partIndex:T?l:null,isSyncRequest:a,startOfSegment:r,playlist:i,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:m.timeline,duration:T&&T.duration||m.duration,segment:m,part:T,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:f,independent:t},C=typeof h<"u"?h:this.isPendingTimestampOffset_;E.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:m.timeline,currentTimeline:this.currentTimeline_,startOfSegment:r,buffered:this.buffered_(),overrideCheck:C});const P=za(this.sourceUpdater_.audioBuffered());return typeof P=="number"&&(E.audioAppendStart=P-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(E.gopsToAlignWith=mx(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),E}timestampOffsetForSegment_(e){return Sx(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),i=e.bandwidth,n=this.pendingSegment_.duration,r=ht.estimateSegmentRequestTime(n,i,this.playlist_,e.bytesReceived),a=qv(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(r<=a)return;const l=nx({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:n,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;const f=r-a-l.rebufferingImpact;let m=.5;a<=Xt&&(m=1),!(!l.playlist||l.playlist.uri===this.playlist_.uri||f<m)&&(this.bandwidth=l.playlist.attributes.BANDWIDTH*We.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${es(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:i,hasVideo:n}=t,r={segmentInfo:Mi({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:n}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:r}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},_x(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_():Ti(this))))}handleTimingInfo_(e,t,i,n){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const r=this.pendingSegment_,a=_c(t);r[a]=r[a]||{},r[a][i]=n,this.logger_(`timinginfo: ${t} - ${i} - ${n}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Ti(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(a=>{r[a.stream]=r[a.stream]||{startTime:1/0,captions:[],endTime:0};const l=r[a.stream];l.startTime=Math.min(l.startTime,a.startTime+n),l.endTime=Math.max(l.endTime,a.endTime+n),l.captions.push(a)}),Object.keys(r).forEach(a=>{const{startTime:l,endTime:h,captions:f}=r[a],m=this.inbandTextTracks_;this.logger_(`adding cues from ${l} -> ${h} for ${a}`),ox(m,this.vhs_.tech_,a),un(l,h,m[a]),lx({captionArray:f,inbandTextTracks:m,timestampOffset:n})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,i){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,i));return}this.addMetadataToTextTrack(i,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!_o({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:i,hasVideo:n,isMuxed:r}=t;return!(n&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!r&&!e.audioTimingInfo||_o({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_()){Ti(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const i=this.pendingSegment_;if(this.setTimeMapping_(i.timeline),this.updateMediaSecondsLoaded_(i.part||i.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),i.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),i.isFmp4=e.isFmp4,i.timingInfo=i.timingInfo||{},i.isFmp4)this.trigger("fmp4"),i.timingInfo.start=i[_c(t.type)].start;else{const n=this.getCurrentMediaInfo_(),r=this.loaderType_==="main"&&n&&n.hasVideo;let a;r&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:r,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const n=this.chooseNextRequest_();if(n.mediaIndex!==i.mediaIndex||n.partIndex!==i.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}i.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(i,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:i,playlist:n}){if(i){const r=Ar(i);if(this.activeInitSegmentId_===r)return null;t=this.initSegmentForMap(i,!0).bytes,this.activeInitSegmentId_=r}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=n,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i},n){const r=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();r.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+Ui(r).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+Ui(a).join(", "));const l=r.length?r.start(0):0,h=r.length?r.end(r.length-1):0,f=a.length?a.start(0):0,m=a.length?a.end(a.length-1):0;if(h-l<=tn&&m-f<=tn){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${Ui(r).join(", ")}, video buffer: ${Ui(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const E=this.currentTime_()-tn;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${E}`),this.remove(0,E,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${tn}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=k.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},tn*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},n){if(n){if(n.code===sf){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",n),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:B.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:n,bytes:r}){if(!r){const l=[n];let h=n.byteLength;i&&(l.unshift(i),h+=i.byteLength),r=ax({bytes:h,segments:l})}const a={segmentInfo:Mi({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:r},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:r}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const n=this.pendingSegment_.segment,r=`${e}TimingInfo`;n[r]||(n[r]={}),n[r].transmuxerPrependedSeconds=i.prependedContentDuration||0,n[r].transmuxedPresentationStart=i.start.presentation,n[r].transmuxedDecodeStart=i.start.decode,n[r].transmuxedPresentationEnd=i.end.presentation,n[r].transmuxedDecodeEnd=i.end.decode,n[r].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:n}=t;if(!n||!n.byteLength||i==="audio"&&this.audioDisabled_)return;const r=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:r,data:n})}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_()){Ti(this),this.loadQueue_.push(()=>{const t=je({},e,{forceTimestampOffset:!0});je(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),i=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),n=this.mediaIndex!==null,r=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||n&&r;this.logger_(`Requesting
|
|
213
|
-
${
|
|
214
|
-
${es(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=Jb({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:l,level:h,stream:f})=>{this.logger_(`${es(e)} logged from transmuxer stream ${f} as a ${h}: ${l}`)},triggerSegmentEventFn:({type:l,segment:h,keyInfo:f,trackInfo:m,timingInfo:T})=>{const C={segmentInfo:Mi({segment:h})};f&&(C.keyInfo=f),m&&(C.trackInfo=m),T&&(C.timingInfo=T),this.trigger({type:l,metadata:C})}})}trimBackBuffer_(e){const t=xx(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,n=e.segment.key||e.segment.map&&e.segment.map.key,r=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:n,isMediaInitialization:r},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===t.timeline&&(l.videoTimingInfo?a.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd:l.audioTimingInfo&&(a.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd)),t.key){const h=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=h}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<rr){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${rr}`);return}const i={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:i}),this.bandwidth=t.bandwidth,this.roundTrip=t.roundTripTime}handleTimeout_(){this.mediaRequestsTimedout+=1,this.bandwidth=1,this.roundTrip=NaN,this.trigger("bandwidthupdate"),this.trigger("timeout")}segmentRequestFinished_(e,t,i){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,i));return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_||t.requestId!==this.pendingSegment_.requestId)return;if(e){if(this.pendingSegment_=null,this.state="READY",e.code===Qt.ABORTED)return;if(this.pause(),e.code===Qt.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const n=this.pendingSegment_;this.saveBandwidthRelatedStats_(n.duration,t.stats),n.endOfAllRequests=t.endOfAllRequests,i.gopInfo&&(this.gopBuffer_=gx(this.gopBuffer_,i.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(n)}setTimeMapping_(e){const t=this.syncController_.mappingForTimeline(e);t!==null&&(this.timeMapping_=t)}updateMediaSecondsLoaded_(e){typeof e.start=="number"&&typeof e.end=="number"?this.mediaSecondsLoaded+=e.end-e.start:this.mediaSecondsLoaded+=e.duration}shouldUpdateTransmuxerTimestampOffset_(e){return e===null?!1:this.loaderType_==="main"&&e!==this.sourceUpdater_.videoTimestampOffset()||!this.audioDisabled_&&e!==this.sourceUpdater_.audioTimestampOffset()}trueSegmentStart_({currentStart:e,playlist:t,mediaIndex:i,firstVideoFrameTimeForData:n,currentVideoTimestampOffset:r,useVideoTimingInfo:a,videoTimingInfo:l,audioTimingInfo:h}){if(typeof e<"u")return e;if(!a)return h.start;const f=t.segments[i-1];return i===0||!f||typeof f.start>"u"||f.end!==n+r?n:l.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:n,isMuxed:r}=t,a=this.loaderType_==="main"&&n,l=!this.audioDisabled_&&i&&!r;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++,l&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),l&&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=bx(this.loaderType_,this.getCurrentMediaInfo_(),e);return t?(this.error({message:t,playlistExclusionDuration:1/0}),this.trigger("error"),!0):!1}updateSourceBufferTimestampOffset_(e){if(e.timestampOffset===null||typeof e.timingInfo.start!="number"||e.changedTimestampOffset||this.loaderType_!=="main")return;let t=!1;e.timestampOffset-=this.getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e.segment.videoTimingInfo,audioTimingInfo:e.segment.audioTimingInfo,timingInfo:e.timingInfo}),e.changedTimestampOffset=!0,e.timestampOffset!==this.sourceUpdater_.videoTimestampOffset()&&(this.sourceUpdater_.videoTimestampOffset(e.timestampOffset),t=!0),e.timestampOffset!==this.sourceUpdater_.audioTimestampOffset()&&(this.sourceUpdater_.audioTimestampOffset(e.timestampOffset),t=!0),t&&this.trigger("timestampoffset")}getSegmentStartTimeForTimestampOffsetCalculation_({videoTimingInfo:e,audioTimingInfo:t,timingInfo:i}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:i.start:i.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),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 h={segmentInfo:Mi({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:h})}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=Ix(e,this.sourceType_);if(t&&(t.severity==="warn"?B.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 ${es(e)}`);return}this.logger_(`Appended ${es(e)}`),this.addSegmentMetadataCue_(e),this.fetchAtBuffer_=!0,this.currentTimeline_!==e.timeline&&(this.timelineChangeController_.lastTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline}),this.loaderType_==="main"&&!this.audioDisabled_&&this.timelineChangeController_.lastTimelineChange({type:"audio",from:this.currentTimeline_,to:e.timeline})),this.currentTimeline_=e.timeline,this.trigger("syncinfoupdate");const i=e.segment,n=e.part,r=i.end&&this.currentTime_()-i.end>e.playlist.targetDuration*3,a=n&&n.end&&this.currentTime_()-n.end>e.playlist.partTargetDuration*3;if(r||a){this.logger_(`bad ${r?"segment":"part"} ${es(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<rr){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${rr}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,n=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(n-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,n=t.end;if(!yc(i)||!yc(n))return;un(i,n,this.segmentMetadataTrack_);const r=k.WebKitDataCue||k.VTTCue,a={custom:t.custom,dateTimeObject:t.dateTimeObject,dateTimeString:t.dateTimeString,programDateTime:t.programDateTime,bandwidth:e.playlist.attributes.BANDWIDTH,resolution:e.playlist.attributes.RESOLUTION,codecs:e.playlist.attributes.CODECS,byteLength:e.byteLength,uri:e.uri,timeline:e.timeline,playlist:e.playlist.id,start:i,end:n},l=JSON.stringify(a),h=new r(i,n,l);h.value=a,this.segmentMetadataTrack_.addCue(h)}}function ri(){}const Af=function(s){return typeof s!="string"?s:s.replace(/./,e=>e.toUpperCase())},Ax=["video","audio"],vo=(s,e)=>{const t=e[`${s}Buffer`];return t&&t.updating||e.queuePending[s]},kx=(s,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===s)return t}return null},hs=(s,e)=>{if(e.queue.length===0)return;let t=0,i=e.queue[t];if(i.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),i.action(e),i.doneFn&&i.doneFn(),hs("audio",e),hs("video",e));return}if(s!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||vo(s,e))){if(i.type!==s){if(t=kx(s,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[s]=i,i.action(s,e),!i.doneFn){e.queuePending[s]=null,hs(s,e);return}}},kf=(s,e)=>{const t=e[`${s}Buffer`],i=Af(s);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[s]=null,e[`${s}Buffer`]=null)},Wt=(s,e)=>s&&e&&Array.prototype.indexOf.call(s.sourceBuffers,e)!==-1,yt={appendBuffer:(s,e,t)=>(i,n)=>{const r=n[`${i}Buffer`];if(Wt(n.mediaSource,r)){n.logger_(`Appending segment ${e.mediaIndex}'s ${s.length} bytes to ${i}Buffer`);try{r.appendBuffer(s)}catch(a){n.logger_(`Error with code ${a.code} `+(a.code===sf?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),n.queuePending[i]=null,t(a)}}},remove:(s,e)=>(t,i)=>{const n=i[`${t}Buffer`];if(Wt(i.mediaSource,n)){i.logger_(`Removing ${s} to ${e} from ${t}Buffer`);try{n.remove(s,e)}catch{i.logger_(`Remove ${s} to ${e} from ${t}Buffer failed`)}}},timestampOffset:s=>(e,t)=>{const i=t[`${e}Buffer`];Wt(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${s}`),i.timestampOffset=s)},callback:s=>(e,t)=>{s()},endOfStream:s=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${s||""})`);try{e.mediaSource.endOfStream(s)}catch(t){B.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){B.log.warn("Failed to set media source duration",t)}},abort:()=>(s,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${s}Buffer`];if(Wt(e.mediaSource,t)){e.logger_(`calling abort on ${s}Buffer`);try{t.abort()}catch(i){B.log.warn(`Failed to abort on ${s}Buffer`,i)}}},addSourceBuffer:(s,e)=>t=>{const i=Af(s),n=fs(e);t.logger_(`Adding ${s}Buffer with codec ${e} to mediaSource`);const r=t.mediaSource.addSourceBuffer(n);r.addEventListener("updateend",t[`on${i}UpdateEnd_`]),r.addEventListener("error",t[`on${i}Error_`]),t.codecs[s]=e,t[`${s}Buffer`]=r},removeSourceBuffer:s=>e=>{const t=e[`${s}Buffer`];if(kf(s,e),!!Wt(e.mediaSource,t)){e.logger_(`Removing ${s}Buffer with codec ${e.codecs[s]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){B.log.warn(`Failed to removeSourceBuffer ${s}Buffer`,i)}}},changeType:s=>(e,t)=>{const i=t[`${e}Buffer`],n=fs(s);if(!Wt(t.mediaSource,i))return;const r=s.substring(0,s.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===r)return;const h={codecsChangeInfo:{from:a,to:s}};t.trigger({type:"codecschange",metadata:h}),t.logger_(`changing ${e}Buffer codec from ${a} to ${s}`);try{i.changeType(n),t.codecs[e]=s}catch(f){h.errorType=B.Error.StreamingCodecsChangeError,h.error=f,f.metadata=h,t.error_=f,t.trigger("error"),B.log.warn(`Failed to changeType on ${e}Buffer`,f)}}},_t=({type:s,sourceUpdater:e,action:t,doneFn:i,name:n})=>{e.queue.push({type:s,action:t,doneFn:i,name:n}),hs(s,e)},vc=(s,e)=>t=>{const i=e[`${s}Buffered`](),n=jv(i);if(e.logger_(`received "updateend" event for ${s} Source Buffer: `,n),e.queuePending[s]){const r=e.queuePending[s].doneFn;e.queuePending[s]=null,r&&r(e[`${s}Error_`])}hs(s,e)};class Pf extends B.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>hs("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Pt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=vc("video",this),this.onAudioUpdateEnd_=vc("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){_t({type:"mediaSource",sourceUpdater:this,action:yt.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){_t({type:e,sourceUpdater:this,action:yt.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){B.log.error("removeSourceBuffer is not supported!");return}_t({type:"mediaSource",sourceUpdater:this,action:yt.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!B.browser.IS_FIREFOX&&k.MediaSource&&k.MediaSource.prototype&&typeof k.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return k.SourceBuffer&&k.SourceBuffer.prototype&&typeof k.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){B.log.error("changeType is not supported!");return}_t({type:e,sourceUpdater:this,action:yt.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const i=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,i);this.canChangeType()&&this.changeType(t,i)})}appendBuffer(e,t){const{segmentInfo:i,type:n,bytes:r}=e;if(this.processedAppend_=!0,n==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${r.length} until video append`);return}const a=t;if(_t({type:n,sourceUpdater:this,action:yt.appendBuffer(r,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),n==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach(h=>{this.appendBuffer.apply(this,h)})}}audioBuffered(){return Wt(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:Ke()}videoBuffered(){return Wt(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:Ke()}buffered(){const e=Wt(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=Wt(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Hv(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=ri){_t({type:"mediaSource",sourceUpdater:this,action:yt.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=ri){typeof e!="string"&&(e=void 0),_t({type:"mediaSource",sourceUpdater:this,action:yt.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=ri){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}_t({type:"audio",sourceUpdater:this,action:yt.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=ri){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}_t({type:"video",sourceUpdater:this,action:yt.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(vo("audio",this)||vo("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(_t({type:"audio",sourceUpdater:this,action:yt.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(_t({type:"video",sourceUpdater:this,action:yt.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&_t({type:"audio",sourceUpdater:this,action:yt.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&_t({type:"video",sourceUpdater:this,action:yt.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),Ax.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>kf(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const bc=s=>decodeURIComponent(escape(String.fromCharCode.apply(null,s))),Px=s=>{const e=new Uint8Array(s);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},xc=new Uint8Array(`
|
|
216
|
+
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const L=this.getSyncInfoFromMediaSequenceSync_(v);if(!L){const P="No sync info found while using media sequence sync";return this.error({message:P,metadata:{errorType:F.Error.StreamingFailedToSelectNextSegment,error:new Error(P)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${L.start} --> ${L.end})`),b=L.segmentIndex,S=L.partIndex,A=L.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const L=Tt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:v,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});b=L.segmentIndex,S=L.partIndex,A=L.startTime}l.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${v}`:`currentTime ${v}`,l.mediaIndex=b,l.startOfSegment=A,l.partIndex=S,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${l.mediaIndex} `)}const u=a[l.mediaIndex];let f=u&&typeof l.partIndex=="number"&&u.parts&&u.parts[l.partIndex];if(!u||typeof l.partIndex=="number"&&!f)return null;typeof l.partIndex!="number"&&u.parts&&(l.partIndex=0,f=u.parts[0]);const p=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!r&&f&&!p&&!f.independent)if(l.partIndex===0){const b=a[l.mediaIndex-1],S=b.parts&&b.parts.length&&b.parts[b.parts.length-1];S&&S.independent&&(l.mediaIndex-=1,l.partIndex=b.parts.length-1,l.independent="previous segment")}else u.parts[l.partIndex-1].independent&&(l.partIndex-=1,l.independent="previous part");const T=this.mediaSource_&&this.mediaSource_.readyState==="ended";return l.mediaIndex>=a.length-1&&T&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,l.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(l))}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 r=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!r)return null;if(!r.isAppended)return r;const s=this.mediaSequenceSync_.getSyncInfoForTime(r.end);return s?(s.isAppended&&this.logger_("getSyncInfoFromMediaSequenceSync_: We encounter unexpected scenario where next media sequence sync info is also appended!"),s):null}generateSegmentInfo_(e){const{independent:t,playlist:r,mediaIndex:s,startOfSegment:n,isSyncRequest:a,partIndex:l,forceTimestampOffset:u,getMediaInfoForTime:f}=e,p=r.segments[s],T=typeof l=="number"&&p.parts[l],b={requestId:"segment-loader-"+Math.random(),uri:T&&T.resolvedUri||p.resolvedUri,mediaIndex:s,partIndex:T?l:null,isSyncRequest:a,startOfSegment:n,playlist:r,bytes:null,encryptedBytes:null,timestampOffset:null,timeline:p.timeline,duration:T&&T.duration||p.duration,segment:p,part:T,byteLength:0,transmuxer:this.transmuxer_,getMediaInfoForTime:f,independent:t},S=typeof u<"u"?u:this.isPendingTimestampOffset_;b.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:p.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:S});const A=qo(this.sourceUpdater_.audioBuffered());return typeof A=="number"&&(b.audioAppendStart=A-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(b.gopsToAlignWith=DS(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),b}timestampOffsetForSegment_(e){return BS(e)}earlyAbortWhenNeeded_(e){if(this.vhs_.tech_.paused()||!this.xhrOptions_.timeout||!this.playlist_.attributes.BANDWIDTH||Date.now()-(e.firstBytesReceivedAt||Date.now())<1e3)return;const t=this.currentTime_(),r=e.bandwidth,s=this.pendingSegment_.duration,n=Tt.estimateSegmentRequestTime(s,r,this.playlist_,e.bytesReceived),a=rx(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const l=yS({main:this.vhs_.playlists.main,currentTime:t,bandwidth:r,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!l)return;const f=n-a-l.rebufferingImpact;let p=.5;a<=ni&&(p=1),!(!l.playlist||l.playlist.uri===this.playlist_.uri||f<p)&&(this.bandwidth=l.playlist.attributes.BANDWIDTH*Je.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${Er(e)}`),this.mediaRequestsAborted+=1}handleProgress_(e,t){this.earlyAbortWhenNeeded_(t.stats),!this.checkForAbort_(t.requestId)&&this.trigger("progress")}handleTrackInfo_(e,t){const{hasAudio:r,hasVideo:s}=t,n={segmentInfo:er({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:r,hasVideo:s}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:n}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},PS(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_():Mi(this))))}handleTimingInfo_(e,t,r,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const n=this.pendingSegment_,a=sh(t);n[a]=n[a]||{},n[a][r]=s,this.logger_(`timinginfo: ${t} - ${r} - ${s}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():Mi(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 s=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset(),n={};t.forEach(a=>{n[a.stream]=n[a.stream]||{startTime:1/0,captions:[],endTime:0};const l=n[a.stream];l.startTime=Math.min(l.startTime,a.startTime+s),l.endTime=Math.max(l.endTime,a.endTime+s),l.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:l,endTime:u,captions:f}=n[a],p=this.inbandTextTracks_;this.logger_(`adding cues from ${l} -> ${u} for ${a}`),vS(p,this.vhs_.tech_,a),Fs(l,u,p[a]),bS({captionArray:f,inbandTextTracks:p,timestampOffset:s})}),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}handleId3_(e,t,r){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;if(!this.pendingSegment_.hasAppendedData_){this.metadataQueue_.id3.push(this.handleId3_.bind(this,e,t,r));return}this.addMetadataToTextTrack(r,t,this.duration_())}processMetadataQueue_(){this.metadataQueue_.id3.forEach(e=>e()),this.metadataQueue_.caption.forEach(e=>e()),this.metadataQueue_.id3=[],this.metadataQueue_.caption=[]}processCallQueue_(){const e=this.callQueue_;this.callQueue_=[],e.forEach(t=>t())}processLoadQueue_(){const e=this.loadQueue_;this.loadQueue_=[],e.forEach(t=>t())}hasEnoughInfoToLoad_(){if(this.loaderType_!=="audio")return!0;const e=this.pendingSegment_;return e?this.getCurrentMediaInfo_()?!vl({timelineChangeController:this.timelineChangeController_,currentTimeline:this.currentTimeline_,segmentTimeline:e.timeline,loaderType:this.loaderType_,audioDisabled:this.audioDisabled_}):!0:!1}getCurrentMediaInfo_(e=this.pendingSegment_){return e&&e.trackInfo||this.currentMediaInfo_}getMediaInfo_(e=this.pendingSegment_){return this.getCurrentMediaInfo_(e)||this.startingMediaInfo_}getPendingSegmentPlaylist(){return this.pendingSegment_?this.pendingSegment_.playlist:null}hasEnoughInfoToAppend_(){if(!this.sourceUpdater_.ready()||this.waitingOnRemove_||this.quotaExceededErrorRetryTimeout_)return!1;const e=this.pendingSegment_,t=this.getCurrentMediaInfo_();if(!e||!t)return!1;const{hasAudio:r,hasVideo:s,isMuxed:n}=t;return!(s&&!e.videoTimingInfo||r&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||vl({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_()){Mi(this),this.callQueue_.push(this.handleData_.bind(this,e,t));return}const r=this.pendingSegment_;if(this.setTimeMapping_(r.timeline),this.updateMediaSecondsLoaded_(r.part||r.segment),this.mediaSource_.readyState!=="closed"){if(e.map&&(e.map=this.initSegmentForMap(e.map,!0),r.segment.map=e.map),e.key&&this.segmentKey(e.key,!0),r.isFmp4=e.isFmp4,r.timingInfo=r.timingInfo||{},r.isFmp4)this.trigger("fmp4"),r.timingInfo.start=r[sh(t.type)].start;else{const s=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&s&&s.hasVideo;let a;n&&(a=r.videoTimingInfo.start),r.timingInfo.start=this.trueSegmentStart_({currentStart:r.timingInfo.start,playlist:r.playlist,mediaIndex:r.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:r.videoTimingInfo,audioTimingInfo:r.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(r,t.type),this.updateSourceBufferTimestampOffset_(r),r.isSyncRequest){this.updateTimingInfoEnd_(r),this.syncController_.saveSegmentTimingInfo({segmentInfo:r,shouldSaveTimelineMapping:this.loaderType_==="main"});const s=this.chooseNextRequest_();if(s.mediaIndex!==r.mediaIndex||s.partIndex!==r.partIndex){this.logger_("sync segment was incorrect, not appending");return}this.logger_("sync segment was correct, appending")}r.hasAppendedData_=!0,this.processMetadataQueue_(),this.appendData_(r,t)}}updateAppendInitSegmentStatus(e,t){this.loaderType_==="main"&&typeof e.timestampOffset=="number"&&!e.changedTimestampOffset&&(this.appendInitSegment_={audio:!0,video:!0}),this.playlistOfLastInitSegment_[t]!==e.playlist&&(this.appendInitSegment_[t]=!0)}getInitSegmentAndUpdateState_({type:e,initSegment:t,map:r,playlist:s}){if(r){const n=ba(r);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(r,!0).bytes,this.activeInitSegmentId_=n}return t&&this.appendInitSegment_[e]?(this.playlistOfLastInitSegment_[e]=s,this.appendInitSegment_[e]=!1,this.activeInitSegmentId_=null,t):null}handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r},s){const n=this.sourceUpdater_.audioBuffered(),a=this.sourceUpdater_.videoBuffered();n.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: "+ir(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+ir(a).join(", "));const l=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0,f=a.length?a.start(0):0,p=a.length?a.end(a.length-1):0;if(u-l<=Ls&&p-f<=Ls){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${r.byteLength}, audio buffer: ${ir(n).join(", ")}, video buffer: ${ir(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:r}));const b=this.currentTime_()-Ls;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${b}`),this.remove(0,b,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${Ls}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=k.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},Ls*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:r},s){if(s){if(s.code===Am){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:r});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${r.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:F.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:r,data:s,bytes:n}){if(!n){const l=[s];let u=s.byteLength;r&&(l.unshift(r),u+=r.byteLength),n=TS({bytes:u,segments:l})}const a={segmentInfo:er({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,r){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,n=`${e}TimingInfo`;s[n]||(s[n]={}),s[n].transmuxerPrependedSeconds=r.prependedContentDuration||0,s[n].transmuxedPresentationStart=r.start.presentation,s[n].transmuxedDecodeStart=r.start.decode,s[n].transmuxedPresentationEnd=r.end.presentation,s[n].transmuxedDecodeEnd=r.end.decode,s[n].baseMediaDecodeTime=r.baseMediaDecodeTime}appendData_(e,t){const{type:r,data:s}=t;if(!s||!s.byteLength||r==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:r,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:r,initSegment:n,data:s})}loadSegment_(e){if(this.state="WAITING",this.pendingSegment_=e,this.trimBackBuffer_(e),typeof e.timestampOffset=="number"&&this.transmuxer_&&this.transmuxer_.postMessage({action:"clearAllMp4Captions"}),!this.hasEnoughInfoToLoad_()){Mi(this),this.loadQueue_.push(()=>{const t=Ke({},e,{forceTimestampOffset:!0});Ke(e,this.generateSegmentInfo_(t)),this.isPendingTimestampOffset_=!1,this.updateTransmuxerAndRequestSegment_(e)});return}this.updateTransmuxerAndRequestSegment_(e)}updateTransmuxerAndRequestSegment_(e){this.shouldUpdateTransmuxerTimestampOffset_(e.timestampOffset)&&(this.gopBuffer_.length=0,e.gopsToAlignWith=[],this.timeMapping_=0,this.transmuxer_.postMessage({action:"reset"}),this.transmuxer_.postMessage({action:"setTimestampOffset",timestampOffset:e.timestampOffset}));const t=this.createSimplifiedSegmentObj_(e),r=this.isEndOfStream_(e.mediaIndex,e.playlist,e.partIndex),s=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=r||s&&n;this.logger_(`Requesting
|
|
217
|
+
${Ym(e.uri)}
|
|
218
|
+
${Er(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=dS({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:l,level:u,stream:f})=>{this.logger_(`${Er(e)} logged from transmuxer stream ${f} as a ${u}: ${l}`)},triggerSegmentEventFn:({type:l,segment:u,keyInfo:f,trackInfo:p,timingInfo:T})=>{const S={segmentInfo:er({segment:u})};f&&(S.keyInfo=f),p&&(S.trackInfo=p),T&&(S.timingInfo=T),this.trigger({type:l,metadata:S})}})}trimBackBuffer_(e){const t=NS(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,r=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:r?r.resolvedUri:t.resolvedUri,byterange:r?r.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:n},l=e.playlist.segments[e.mediaIndex-1];if(l&&l.timeline===t.timeline&&(l.videoTimingInfo?a.baseStartTime=l.videoTimingInfo.transmuxedDecodeEnd:l.audioTimingInfo&&(a.baseStartTime=l.audioTimingInfo.transmuxedDecodeEnd)),t.key){const u=t.key.iv||new Uint32Array([0,0,0,e.mediaIndex+e.playlist.mediaSequence]);a.key=this.segmentKey(t.key),a.key.iv=u}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<Gn){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${Gn}`);return}const r={bandwidthInfo:{from:this.bandwidth,to:t.bandwidth}};this.trigger({type:"bandwidthupdated",metadata:r}),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,r){if(this.callQueue_.length){this.callQueue_.push(this.segmentRequestFinished_.bind(this,e,t,r));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===oi.ABORTED)return;if(this.pause(),e.code===oi.TIMEOUT){this.handleTimeout_();return}this.mediaRequestsErrored+=1,this.error(e),this.trigger("error");return}const s=this.pendingSegment_;this.saveBandwidthRelatedStats_(s.duration,t.stats),s.endOfAllRequests=t.endOfAllRequests,r.gopInfo&&(this.gopBuffer_=IS(this.gopBuffer_,r.gopInfo,this.safeAppend_)),this.state="APPENDING",this.trigger("appending"),this.waitForAppendsToComplete_(s)}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:r,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:n,useVideoTimingInfo:a,videoTimingInfo:l,audioTimingInfo:u}){if(typeof e<"u")return e;if(!a)return u.start;const f=t.segments[r-1];return r===0||!f||typeof f.start>"u"||f.end!==s+n?s:l.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:r,hasVideo:s,isMuxed:n}=t,a=this.loaderType_==="main"&&s,l=!this.audioDisabled_&&r&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,l&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),l&&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=OS(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:r}){return this.useDtsForTimestampOffset_?e&&typeof e.transmuxedDecodeStart=="number"?e.transmuxedDecodeStart:t&&typeof t.transmuxedDecodeStart=="number"?t.transmuxedDecodeStart:r.start:r.start}updateTimingInfoEnd_(e){e.timingInfo=e.timingInfo||{};const t=this.getMediaInfo_(),s=this.loaderType_==="main"&&t&&t.hasVideo&&e.videoTimingInfo?e.videoTimingInfo:e.audioTimingInfo;s&&(e.timingInfo.end=typeof s.end=="number"?s.end:s.start+e.duration)}handleAppendsDone_(){if(this.pendingSegment_){const u={segmentInfo:er({type:this.loaderType_,segment:this.pendingSegment_})};this.trigger({type:"appendsdone",metadata:u})}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=$S(e,this.sourceType_);if(t&&(t.severity==="warn"?F.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 ${Er(e)}`);return}this.logger_(`Appended ${Er(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 r=e.segment,s=e.part,n=r.end&&this.currentTime_()-r.end>e.playlist.targetDuration*3,a=s&&s.end&&this.currentTime_()-s.end>e.playlist.partTargetDuration*3;if(n||a){this.logger_(`bad ${n?"segment":"part"} ${Er(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<Gn){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${Gn}`);return}const t=this.throughput.rate,r=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/r*8*1e3);this.throughput.rate+=(s-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,r=t.start,s=t.end;if(!rh(r)||!rh(s))return;Fs(r,s,this.segmentMetadataTrack_);const n=k.WebKitDataCue||k.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:r,end:s},l=JSON.stringify(a),u=new n(r,s,l);u.value=a,this.segmentMetadataTrack_.addCue(u)}}function _i(){}const Qm=function(i){return typeof i!="string"?i:i.replace(/./,e=>e.toUpperCase())},jS=["video","audio"],xl=(i,e)=>{const t=e[`${i}Buffer`];return t&&t.updating||e.queuePending[i]},VS=(i,e)=>{for(let t=0;t<e.length;t++){const r=e[t];if(r.type==="mediaSource")return null;if(r.type===i)return t}return null},Mr=(i,e)=>{if(e.queue.length===0)return;let t=0,r=e.queue[t];if(r.type==="mediaSource"){!e.updating()&&e.mediaSource.readyState!=="closed"&&(e.queue.shift(),r.action(e),r.doneFn&&r.doneFn(),Mr("audio",e),Mr("video",e));return}if(i!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||xl(i,e))){if(r.type!==i){if(t=VS(i,e.queue),t===null)return;r=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[i]=r,r.action(i,e),!r.doneFn){e.queuePending[i]=null,Mr(i,e);return}}},Jm=(i,e)=>{const t=e[`${i}Buffer`],r=Qm(i);t&&(t.removeEventListener("updateend",e[`on${r}UpdateEnd_`]),t.removeEventListener("error",e[`on${r}Error_`]),e.codecs[i]=null,e[`${i}Buffer`]=null)},ii=(i,e)=>i&&e&&Array.prototype.indexOf.call(i.sourceBuffers,e)!==-1,At={appendBuffer:(i,e,t)=>(r,s)=>{const n=s[`${r}Buffer`];if(ii(s.mediaSource,n)){s.logger_(`Appending segment ${e.mediaIndex}'s ${i.length} bytes to ${r}Buffer`);try{n.appendBuffer(i)}catch(a){s.logger_(`Error with code ${a.code} `+(a.code===Am?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${r}Buffer`),s.queuePending[r]=null,t(a)}}},remove:(i,e)=>(t,r)=>{const s=r[`${t}Buffer`];if(ii(r.mediaSource,s)){r.logger_(`Removing ${i} to ${e} from ${t}Buffer`);try{s.remove(i,e)}catch{r.logger_(`Remove ${i} to ${e} from ${t}Buffer failed`)}}},timestampOffset:i=>(e,t)=>{const r=t[`${e}Buffer`];ii(t.mediaSource,r)&&(t.logger_(`Setting ${e}timestampOffset to ${i}`),r.timestampOffset=i)},callback:i=>(e,t)=>{i()},endOfStream:i=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${i||""})`);try{e.mediaSource.endOfStream(i)}catch(t){F.log.warn("Failed to call media source endOfStream",t)}}},duration:i=>e=>{e.logger_(`Setting mediaSource duration to ${i}`);try{e.mediaSource.duration=i}catch(t){F.log.warn("Failed to set media source duration",t)}},abort:()=>(i,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${i}Buffer`];if(ii(e.mediaSource,t)){e.logger_(`calling abort on ${i}Buffer`);try{t.abort()}catch(r){F.log.warn(`Failed to abort on ${i}Buffer`,r)}}},addSourceBuffer:(i,e)=>t=>{const r=Qm(i),s=Ur(e);t.logger_(`Adding ${i}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",t[`on${r}UpdateEnd_`]),n.addEventListener("error",t[`on${r}Error_`]),t.codecs[i]=e,t[`${i}Buffer`]=n},removeSourceBuffer:i=>e=>{const t=e[`${i}Buffer`];if(Jm(i,e),!!ii(e.mediaSource,t)){e.logger_(`Removing ${i}Buffer with codec ${e.codecs[i]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(r){F.log.warn(`Failed to removeSourceBuffer ${i}Buffer`,r)}}},changeType:i=>(e,t)=>{const r=t[`${e}Buffer`],s=Ur(i);if(!ii(t.mediaSource,r))return;const n=i.substring(0,i.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const u={codecsChangeInfo:{from:a,to:i}};t.trigger({type:"codecschange",metadata:u}),t.logger_(`changing ${e}Buffer codec from ${a} to ${i}`);try{r.changeType(s),t.codecs[e]=i}catch(f){u.errorType=F.Error.StreamingCodecsChangeError,u.error=f,f.metadata=u,t.error_=f,t.trigger("error"),F.log.warn(`Failed to changeType on ${e}Buffer`,f)}}},wt=({type:i,sourceUpdater:e,action:t,doneFn:r,name:s})=>{e.queue.push({type:i,action:t,doneFn:r,name:s}),Mr(i,e)},ah=(i,e)=>t=>{const r=e[`${i}Buffered`](),s=ex(r);if(e.logger_(`received "updateend" event for ${i} Source Buffer: `,s),e.queuePending[i]){const n=e.queuePending[i].doneFn;e.queuePending[i]=null,n&&n(e[`${i}Error_`])}Mr(i,e)};class Zm extends F.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>Mr("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=$t("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=ah("video",this),this.onAudioUpdateEnd_=ah("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){wt({type:"mediaSource",sourceUpdater:this,action:At.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){wt({type:e,sourceUpdater:this,action:At.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){F.log.error("removeSourceBuffer is not supported!");return}wt({type:"mediaSource",sourceUpdater:this,action:At.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!F.browser.IS_FIREFOX&&k.MediaSource&&k.MediaSource.prototype&&typeof k.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return k.SourceBuffer&&k.SourceBuffer.prototype&&typeof k.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){F.log.error("changeType is not supported!");return}wt({type:e,sourceUpdater:this,action:At.changeType(t),name:"changeType"})}addOrChangeSourceBuffers(e){if(!e||typeof e!="object"||Object.keys(e).length===0)throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");Object.keys(e).forEach(t=>{const r=e[t];if(!this.hasCreatedSourceBuffers())return this.addSourceBuffer(t,r);this.canChangeType()&&this.changeType(t,r)})}appendBuffer(e,t){const{segmentInfo:r,type:s,bytes:n}=e;if(this.processedAppend_=!0,s==="audio"&&this.videoBuffer&&!this.videoAppendQueued_){this.delayedAudioAppendQueue_.push([e,t]),this.logger_(`delayed audio append of ${n.length} until video append`);return}const a=t;if(wt({type:s,sourceUpdater:this,action:At.appendBuffer(n,r||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const l=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${l.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,l.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return ii(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:et()}videoBuffered(){return ii(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:et()}buffered(){const e=ii(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=ii(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():ix(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=_i){wt({type:"mediaSource",sourceUpdater:this,action:At.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=_i){typeof e!="string"&&(e=void 0),wt({type:"mediaSource",sourceUpdater:this,action:At.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,r=_i){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){r();return}wt({type:"audio",sourceUpdater:this,action:At.remove(e,t),doneFn:r,name:"remove"})}removeVideo(e,t,r=_i){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){r();return}wt({type:"video",sourceUpdater:this,action:At.remove(e,t),doneFn:r,name:"remove"})}updating(){return!!(xl("audio",this)||xl("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(wt({type:"audio",sourceUpdater:this,action:At.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(wt({type:"video",sourceUpdater:this,action:At.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&wt({type:"audio",sourceUpdater:this,action:At.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&wt({type:"video",sourceUpdater:this,action:At.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),jS.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>Jm(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const oh=i=>decodeURIComponent(escape(String.fromCharCode.apply(null,i))),qS=i=>{const e=new Uint8Array(i);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},lh=new Uint8Array(`
|
|
215
219
|
|
|
216
|
-
`.split("").map(
|
|
217
|
-
`,a=
|
|
218
|
-
`,
|
|
219
|
-
`,l++,a=E}),this.end_=a,this.storage_=n,this.diagnostics_=r}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const n=Math.min(...this.storage_.keys());if(e<n){const r=n-e;let a=this.storage_.get(n).segmentSyncInfo.start;for(let l=0;l<r;l++){const h=t[l];a-=h.duration}return a}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class Ec extends Df{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const n=this.parent_.getSyncInfoForMediaSequence(e);return n?n.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const Nx=86400,Ka=[{name:"VOD",run:(s,e,t,i,n)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(s,e,t,i,n,r)=>{const a=s.getMediaSequenceSync(r);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(n);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(s,e,t,i,n)=>{if(!Object.keys(s.timelineToDatetimeMappings).length)return null;let r=null,a=null;const l=uo(e);n=n||0;for(let h=0;h<l.length;h++){const f=e.endList||n===0?h:l.length-(h+1),m=l[f],T=m.segment,E=s.timelineToDatetimeMappings[T.timeline];if(!E||!T.dateTimeObject)continue;let P=T.dateTimeObject.getTime()/1e3+E;if(T.parts&&typeof m.partIndex=="number")for(let R=0;R<m.partIndex;R++)P+=T.parts[R].duration;const v=Math.abs(n-P);if(a!==null&&(v===0||a<v))break;a=v,r={time:P,segmentIndex:m.segmentIndex,partIndex:m.partIndex}}return r}},{name:"Segment",run:(s,e,t,i,n)=>{let r=null,a=null;n=n||0;const l=uo(e);for(let h=0;h<l.length;h++){const f=e.endList||n===0?h:l.length-(h+1),m=l[f],T=m.segment,E=m.part&&m.part.start||T&&T.start;if(T.timeline===i&&typeof E<"u"){const C=Math.abs(n-E);if(a!==null&&a<C)break;(!r||a===null||a>=C)&&(a=C,r={time:E,segmentIndex:m.segmentIndex,partIndex:m.partIndex})}}return r}},{name:"Discontinuity",run:(s,e,t,i,n)=>{let r=null;if(n=n||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const h=e.discontinuityStarts[l],f=e.discontinuitySequence+l+1,m=s.discontinuities[f];if(m){const T=Math.abs(n-m.time);if(a!==null&&a<T)break;(!r||a===null||a>=T)&&(a=T,r={time:m.time,segmentIndex:h,partIndex:null})}}}return r}},{name:"Playlist",run:(s,e,t,i,n)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class Ux extends B.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new Df,i=new Ec(t),n=new Ec(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:n},this.logger_=Pt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,n,r){if(t!==1/0)return Ka.find(({name:h})=>h==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,n,r);if(!a.length)return null;for(const l of a){const{syncPoint:h,strategy:f}=l,{segmentIndex:m,time:T}=h;if(m<0)continue;const E=e.segments[m],C=T,P=C+E.duration;if(this.logger_(`Strategy: ${f}. Current time: ${n}. selected segment: ${m}. Time: [${C} -> ${P}]}`),n>=C&&n<P)return this.logger_("Found sync point with exact match: ",h),h}return this.selectSyncPoint_(a,{key:"time",value:n})}getExpiredTime(e,t){if(!e||!e.segments)return null;const i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const n=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return n.segmentIndex>0&&(n.time*=-1),Math.abs(n.time+mn({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:n.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,n,r){const a=[];for(let l=0;l<Ka.length;l++){const h=Ka[l],f=h.run(this,e,t,i,n,r);f&&(f.strategy=h.name,a.push({strategy:h.name,syncPoint:f}))}return a}selectSyncPoint_(e,t){let i=e[0].syncPoint,n=Math.abs(e[0].syncPoint[t.key]-t.value),r=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<n&&(n=l,i=e[a].syncPoint,r=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${r}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>Nx){B.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let n=i-1;n>=0;n--){const r=e.segments[n];if(r&&typeof r.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+n,time:r.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),n=e.segment;i&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:n.start}));const r=n.dateTimeObject;n.discontinuity&&t&&r&&(this.timelineToDatetimeMappings[n.timeline]=-(r.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,i){const n=e.segment,r=e.part;let a=this.timelines[e.timeline],l,h;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},i&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),l=e.startOfSegment,h=t.end+a.mapping;else if(a)l=t.start+a.mapping,h=t.end+a.mapping;else return!1;return r&&(r.start=l,r.end=h),(!n.start||l<n.start)&&(n.start=l),n.end=h,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,i=e.segment;if(i.discontinuity)this.discontinuities[i.timeline]={time:i.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let n=0;n<t.discontinuityStarts.length;n++){const r=t.discontinuityStarts[n],a=t.discontinuitySequence+n+1,l=r-e.mediaIndex,h=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>h){let f;l<0?f=i.start-mn({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:r}):f=i.end+mn({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:r}),this.discontinuities[a]={time:f,accuracy:h}}}}dispose(){this.trigger("dispose"),this.off()}}class Bx extends B.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:i}){return typeof t=="number"&&typeof i=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:i},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:i}){if(typeof t=="number"&&typeof i=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:i},delete this.pendingTimelineChanges_[e];const n={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:n})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const Fx=mf(gf(function(){var s=function(){function v(){this.listeners={}}var R=v.prototype;return R.on=function(N,U){this.listeners[N]||(this.listeners[N]=[]),this.listeners[N].push(U)},R.off=function(N,U){if(!this.listeners[N])return!1;var F=this.listeners[N].indexOf(U);return this.listeners[N]=this.listeners[N].slice(0),this.listeners[N].splice(F,1),F>-1},R.trigger=function(N){var U=this.listeners[N];if(U)if(arguments.length===2)for(var F=U.length,D=0;D<F;++D)U[D].call(this,arguments[1]);else for(var V=Array.prototype.slice.call(arguments,1),X=U.length,G=0;G<X;++G)U[G].apply(this,V)},R.dispose=function(){this.listeners={}},R.pipe=function(N){this.on("data",function(U){N.push(U)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],R=v[0],L=v[1],N=R[4],U=L[4];let F,D,V;const X=[],G=[];let ae,fe,ve,he,Z,de;for(F=0;F<256;F++)G[(X[F]=F<<1^(F>>7)*283)^F]=F;for(D=V=0;!N[D];D^=ae||1,V=G[V]||1)for(he=V^V<<1^V<<2^V<<3^V<<4,he=he>>8^he&255^99,N[D]=he,U[he]=D,ve=X[fe=X[ae=X[D]]],de=ve*16843009^fe*65537^ae*257^D*16843008,Z=X[he]*257^he*16843008,F=0;F<4;F++)R[F][D]=Z=Z<<24^Z>>>8,L[F][he]=de=de<<24^de>>>8;for(F=0;F<5;F++)R[F]=R[F].slice(0),L[F]=L[F].slice(0);return v};let i=null;class n{constructor(R){i||(i=t()),this._tables=[[i[0][0].slice(),i[0][1].slice(),i[0][2].slice(),i[0][3].slice(),i[0][4].slice()],[i[1][0].slice(),i[1][1].slice(),i[1][2].slice(),i[1][3].slice(),i[1][4].slice()]];let L,N,U;const F=this._tables[0][4],D=this._tables[1],V=R.length;let X=1;if(V!==4&&V!==6&&V!==8)throw new Error("Invalid aes key size");const G=R.slice(0),ae=[];for(this._key=[G,ae],L=V;L<4*V+28;L++)U=G[L-1],(L%V===0||V===8&&L%V===4)&&(U=F[U>>>24]<<24^F[U>>16&255]<<16^F[U>>8&255]<<8^F[U&255],L%V===0&&(U=U<<8^U>>>24^X<<24,X=X<<1^(X>>7)*283)),G[L]=G[L-V]^U;for(N=0;L;N++,L--)U=G[N&3?L:L-4],L<=4||N<4?ae[N]=U:ae[N]=D[0][F[U>>>24]]^D[1][F[U>>16&255]]^D[2][F[U>>8&255]]^D[3][F[U&255]]}decrypt(R,L,N,U,F,D){const V=this._key[1];let X=R^V[0],G=U^V[1],ae=N^V[2],fe=L^V[3],ve,he,Z;const de=V.length/4-2;let ee,Xe=4;const Qe=this._tables[1],Ve=Qe[0],qe=Qe[1],be=Qe[2],me=Qe[3],pt=Qe[4];for(ee=0;ee<de;ee++)ve=Ve[X>>>24]^qe[G>>16&255]^be[ae>>8&255]^me[fe&255]^V[Xe],he=Ve[G>>>24]^qe[ae>>16&255]^be[fe>>8&255]^me[X&255]^V[Xe+1],Z=Ve[ae>>>24]^qe[fe>>16&255]^be[X>>8&255]^me[G&255]^V[Xe+2],fe=Ve[fe>>>24]^qe[X>>16&255]^be[G>>8&255]^me[ae&255]^V[Xe+3],Xe+=4,X=ve,G=he,ae=Z;for(ee=0;ee<4;ee++)F[(3&-ee)+D]=pt[X>>>24]<<24^pt[G>>16&255]<<16^pt[ae>>8&255]<<8^pt[fe&255]^V[Xe++],ve=X,X=G,G=ae,ae=fe,fe=ve}}class r 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(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,R,L){const N=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),U=new n(Array.prototype.slice.call(R)),F=new Uint8Array(v.byteLength),D=new Int32Array(F.buffer);let V,X,G,ae,fe,ve,he,Z,de;for(V=L[0],X=L[1],G=L[2],ae=L[3],de=0;de<N.length;de+=4)fe=a(N[de]),ve=a(N[de+1]),he=a(N[de+2]),Z=a(N[de+3]),U.decrypt(fe,ve,he,Z,D,de),D[de]=a(D[de]^V),D[de+1]=a(D[de+1]^X),D[de+2]=a(D[de+2]^G),D[de+3]=a(D[de+3]^ae),V=fe,X=ve,G=he,ae=Z;return F};class h{constructor(R,L,N,U){const F=h.STEP,D=new Int32Array(R.buffer),V=new Uint8Array(R.byteLength);let X=0;for(this.asyncStream_=new r,this.asyncStream_.push(this.decryptChunk_(D.subarray(X,X+F),L,N,V)),X=F;X<D.length;X+=F)N=new Uint32Array([a(D[X-4]),a(D[X-3]),a(D[X-2]),a(D[X-1])]),this.asyncStream_.push(this.decryptChunk_(D.subarray(X,X+F),L,N,V));this.asyncStream_.push(function(){U(null,e(V))})}static get STEP(){return 32e3}decryptChunk_(R,L,N,U){return function(){const F=l(R,L,N);U.set(F,R.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof re.global<"u"?re.global:typeof self<"u"?self:{},m;typeof window<"u"?m=window:typeof f<"u"?m=f:typeof self<"u"?m=self:m={};var T=m,E=function(R){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(R):R&&R.buffer instanceof ArrayBuffer},C=T.BigInt||Number;C("0x1"),C("0x100"),C("0x10000"),C("0x1000000"),C("0x100000000"),C("0x10000000000"),C("0x1000000000000"),C("0x100000000000000"),C("0x10000000000000000"),function(){var v=new Uint16Array([65484]),R=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return R[0]===255?"big":R[0]===204?"little":"unknown"}();const P=function(v){const R={};return Object.keys(v).forEach(L=>{const N=v[L];E(N)?R[L]={bytes:N.buffer,byteOffset:N.byteOffset,byteLength:N.byteLength}:R[L]=N}),R};self.onmessage=function(v){const R=v.data,L=new Uint8Array(R.encrypted.bytes,R.encrypted.byteOffset,R.encrypted.byteLength),N=new Uint32Array(R.key.bytes,R.key.byteOffset,R.key.byteLength/4),U=new Uint32Array(R.iv.bytes,R.iv.byteOffset,R.iv.byteLength/4);new h(L,N,U,function(F,D){self.postMessage(P({source:R.source,decrypted:D}),[D.buffer])})}}));var $x=pf(Fx);const jx=s=>{let e=s.default?"main":"alternative";return s.characteristics&&s.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},Lf=(s,e)=>{s.abort(),s.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},bo=(s,e)=>{e.activePlaylistLoader=s,s.load()},Vx=(s,e)=>()=>{const{segmentLoaders:{[s]:t,main:i},mediaTypes:{[s]:n}}=e,r=n.activeTrack(),a=n.getActiveGroup(),l=n.activePlaylistLoader,h=n.lastGroup_;if(!(a&&h&&a.id===h.id)&&(n.lastGroup_=a,n.lastTrack_=r,Lf(t,n),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&i.resetEverything();return}t.resyncLoader(),bo(a.playlistLoader,n)}},Hx=(s,e)=>()=>{const{segmentLoaders:{[s]:t},mediaTypes:{[s]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},qx=(s,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[s]:i,main:n},mediaTypes:{[s]:r}}=e,a=r.activeTrack(),l=r.getActiveGroup(),h=r.activePlaylistLoader,f=r.lastTrack_;if(!(f&&a&&f.id===a.id)&&(r.lastGroup_=l,r.lastTrack_=a,Lf(i,r),!!l)){if(l.isMainPlaylist){if(!a||!f||a.id===f.id)return;const m=e.vhs.playlistController_,T=m.selectPlaylist();if(m.media()===T)return;r.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),n.resetEverything(),m.fastQualityChange_(T);return}if(s==="AUDIO"){if(!l.playlistLoader){n.setAudio(!0),n.resetEverything();return}i.setAudio(!0),n.setAudio(!1)}if(h===l.playlistLoader){bo(l.playlistLoader,r);return}i.track&&i.track(a),i.resetEverything(),bo(l.playlistLoader,r)}},Dr={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:t},excludePlaylist:i}=e,n=t.activeTrack(),r=t.activeGroup(),a=(r.filter(h=>h.default)[0]||r[0]).id,l=t.tracks[a];if(n===l){i({error:{message:"Problem encountered loading the default audio track."}});return}B.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const h in t.tracks)t.tracks[h].enabled=t.tracks[h]===l;t.onTrackChanged()},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:t}}=e;B.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},Cc={AUDIO:(s,e,t)=>{if(!e)return;const{tech:i,requestOptions:n,segmentLoaders:{[s]:r}}=t;e.on("loadedmetadata",()=>{const a=e.media();r.playlist(a,n),(!i.paused()||a.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",Dr[s](s,t))},SUBTITLES:(s,e,t)=>{const{tech:i,requestOptions:n,segmentLoaders:{[s]:r},mediaTypes:{[s]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();r.playlist(l,n),r.track(a.activeTrack()),(!i.paused()||l.endList&&i.preload()!=="none")&&r.load()}),e.on("loadedplaylist",()=>{r.playlist(e.media(),n),i.paused()||r.load()}),e.on("error",Dr[s](s,t))}},zx={AUDIO:(s,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[s]:n},requestOptions:r,main:{mediaGroups:a},mediaTypes:{[s]:{groups:l,tracks:h,logger_:f}},mainPlaylistLoader:m}=e,T=wn(m.main);(!a[s]||Object.keys(a[s]).length===0)&&(a[s]={main:{default:{default:!0}}},T&&(a[s].main.default.playlists=m.main.playlists));for(const E in a[s]){l[E]||(l[E]=[]);for(const C in a[s][E]){let P=a[s][E][C],v;if(T?(f(`AUDIO group '${E}' label '${C}' is a main playlist`),P.isMainPlaylist=!0,v=null):i==="vhs-json"&&P.playlists?v=new ns(P.playlists[0],t,r):P.resolvedUri?v=new ns(P.resolvedUri,t,r):P.playlists&&i==="dash"?v=new go(P.playlists[0],t,r,m):v=null,P=ge({id:C,playlistLoader:v},P),Cc[s](s,P.playlistLoader,e),l[E].push(P),typeof h[C]>"u"){const R=new B.AudioTrack({id:C,kind:jx(P),enabled:!1,language:P.language,default:P.default,label:C});h[C]=R}}}n.on("error",Dr[s](s,e))},SUBTITLES:(s,e)=>{const{tech:t,vhs:i,sourceType:n,segmentLoaders:{[s]:r},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[s]:{groups:h,tracks:f}},mainPlaylistLoader:m}=e;for(const T in l[s]){h[T]||(h[T]=[]);for(const E in l[s][T]){if(!i.options_.useForcedSubtitles&&l[s][T][E].forced)continue;let C=l[s][T][E],P;if(n==="hls")P=new ns(C.resolvedUri,i,a);else if(n==="dash"){if(!C.playlists.filter(R=>R.excludeUntil!==1/0).length)return;P=new go(C.playlists[0],i,a,m)}else n==="vhs-json"&&(P=new ns(C.playlists?C.playlists[0]:C.resolvedUri,i,a));if(C=ge({id:E,playlistLoader:P},C),Cc[s](s,C.playlistLoader,e),h[T].push(C),typeof f[E]>"u"){const v=t.addRemoteTextTrack({id:E,kind:"subtitles",default:C.default&&C.autoselect,language:C.language,label:E},!1).track;f[E]=v}}}r.on("error",Dr[s](s,e))},"CLOSED-CAPTIONS":(s,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[s]:{groups:n,tracks:r}}}=e;for(const a in i[s]){n[a]||(n[a]=[]);for(const l in i[s][a]){const h=i[s][a][l];if(!/^(?:CC|SERVICE)/.test(h.instreamId))continue;const f=t.options_.vhs&&t.options_.vhs.captionServices||{};let m={label:l,language:h.language,instreamId:h.instreamId,default:h.default&&h.autoselect};if(f[m.instreamId]&&(m=ge(m,f[m.instreamId])),m.default===void 0&&delete m.default,n[a].push(ge({id:l},h)),typeof r[l]>"u"){const T=t.addRemoteTextTrack({id:m.instreamId,kind:"captions",default:m.default,language:m.language,label:m.label},!1).track;r[l]=T}}}}},Of=(s,e)=>{for(let t=0;t<s.length;t++)if(hl(e,s[t])||s[t].playlists&&Of(s[t].playlists,e))return!0;return!1},Wx=(s,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[s]:{groups:n}}}=e,r=i.media();if(!r)return null;let a=null;r.attributes[s]&&(a=n[r.attributes[s]]);const l=Object.keys(n);if(!a)if(s==="AUDIO"&&l.length>1&&wn(e.main))for(let h=0;h<l.length;h++){const f=n[l[h]];if(Of(f,r)){a=f;break}}else n.main?a=n.main:l.length===1&&(a=n[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(h=>h.id===t.id)[0]||null},Gx={AUDIO:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(s,e)=>()=>{const{mediaTypes:{[s]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},Kx=(s,{mediaTypes:e})=>()=>{const t=e[s].activeTrack();return t?e[s].activeGroup(t):null},Xx=s=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{zx[f](f,s)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:n,segmentLoaders:{["AUDIO"]:r,main:a}}=s;["AUDIO","SUBTITLES"].forEach(f=>{e[f].activeGroup=Wx(f,s),e[f].activeTrack=Gx[f](f,s),e[f].onGroupChanged=Vx(f,s),e[f].onGroupChanging=Hx(f,s),e[f].onTrackChanged=qx(f,s),e[f].getActiveGroup=Kx(f,s)});const l=e.AUDIO.activeGroup();if(l){const f=(l.filter(T=>T.default)[0]||l[0]).id;e.AUDIO.tracks[f].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),r.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanging())});const h=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",h),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),n.on("dispose",()=>{i.audioTracks().removeEventListener("change",h),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const f in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[f])},Yx=()=>{const s={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{s[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:ri,activeTrack:ri,getActiveGroup:ri,onGroupChanged:ri,onTrackChanged:ri,lastTrack_:null,logger_:Pt(`MediaGroups[${e}]`)}}),s};class wc{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_=dt(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 Qx extends B.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new wc,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_=Pt("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const i=t.serverUri||t.serverURL;if(!i){this.logger_(`steering manifest URL is ${i}, cannot request steering manifest.`),this.trigger("error");return}if(i.startsWith("data:")){this.decodeDataUriManifest_(i.substring(i.indexOf(",")+1));return}this.steeringManifest.reloadUri=dt(e,i),this.defaultPathway=t.pathwayId||t.defaultServiceLocation,this.queryBeforeStart=t.queryBeforeStart,this.proxyServerUrl_=t.proxyServerURL,this.defaultPathway&&!this.queryBeforeStart&&this.trigger("content-steering")}requestSteeringManifest(e){const t=this.steeringManifest.reloadUri;if(!t)return;const i=e?t:this.getRequestURI(t);if(!i){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const n={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:n}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(r,a)=>{if(r){if(a.status===410){this.logger_(`manifest request 410 ${r}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const f=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${r}.`),this.logger_(`content steering will retry in ${f} seconds.`),this.startTTLTimeout_(parseInt(f,10));return}this.logger_(`manifest failed to load ${r}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:n});let l;try{l=JSON.parse(this.request_.responseText)}catch(f){const m={errorType:B.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:m})}this.assignSteeringProperties_(l);const h={contentSteeringInfo:n.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:h}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new k.URL(e),i=new k.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(k.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new k.URL(e),i=this.getPathway(),n=this.getBandwidth_();if(i){const r=`_${this.manifestType_}_pathway`;t.searchParams.set(r,i)}if(n){const r=`_${this.manifestType_}_throughput`;t.searchParams.set(r,n)}return t.toString()}assignSteeringProperties_(e){if(this.steeringManifest.version=e.VERSION,!this.steeringManifest.version){this.logger_(`manifest version is ${e.VERSION}, which is not supported.`),this.trigger("error");return}this.steeringManifest.ttl=e.TTL,this.steeringManifest.reloadUri=e["RELOAD-URI"],this.steeringManifest.priority=e["PATHWAY-PRIORITY"]||e["SERVICE-LOCATION-PRIORITY"],this.steeringManifest.pathwayClones=e["PATHWAY-CLONES"],this.nextPathwayClones=this.steeringManifest.pathwayClones,this.availablePathways_.size||(this.logger_("There are no available pathways for content steering. Ending content steering."),this.trigger("error"),this.dispose());const i=(n=>{for(const r of n)if(this.availablePathways_.has(r))return r;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=n=>this.excludedSteeringManifestURLs.has(n);if(this.proxyServerUrl_){const n=this.setProxyServerUrl_(e);if(!t(n))return n}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=k.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){k.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 wc}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&&(dt(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const Jx=(s,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{s.apply(null,i)},e)}},Zx=10;let vi;const e1=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],t1=function(s){return this.audioSegmentLoader_[s]+this.mainSegmentLoader_[s]},i1=function({currentPlaylist:s,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:a,bufferBasedABR:l,log:h}){if(!i)return B.log.warn("We received no playlist to switch to. Please check your stream."),!1;const f=`allowing switch ${s&&s.id||"null"} -> ${i.id}`;if(!s)return h(`${f} as current playlist is not set`),!0;if(i.id===s.id)return!1;const m=!!ss(e,t).length;if(!s.endList)return!m&&typeof s.partTargetDuration=="number"?(h(`not ${f} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(h(`${f} as current playlist is live`),!0);const T=ul(e,t),E=l?We.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:We.MAX_BUFFER_LOW_WATER_LINE;if(a<E)return h(`${f} as duration < max low water line (${a} < ${E})`),!0;const C=i.attributes.BANDWIDTH,P=s.attributes.BANDWIDTH;if(C<P&&(!l||T<r)){let v=`${f} as next bandwidth < current bandwidth (${C} < ${P})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${T} < ${r})`),h(v),!0}if((!l||C>P)&&T>=n){let v=`${f} as forwardBuffer >= bufferLowWaterLine (${T} >= ${n})`;return l&&(v+=` and next bandwidth > current bandwidth (${C} > ${P})`),h(v),!0}return h(`not ${f} as no switching criteria met`),!1};class s1 extends B.EventTarget{constructor(e){super(),this.fastQualityChange_=Jx(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:n,bandwidth:r,externVhs:a,useCueTags:l,playlistExclusionDuration:h,enableLowInitialPlaylist:f,sourceType:m,cacheEncryptionKeys:T,bufferBasedABR:E,leastPixelDiffSelector:C,captionServices:P,experimentalUseMMS:v}=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),vi=a,this.bufferBasedABR=!!E,this.leastPixelDiffSelector=!!C,this.withCredentials=i,this.tech_=n,this.vhs_=n.vhs,this.player_=e.player_,this.sourceType_=m,this.useCueTags_=l,this.playlistExclusionDuration=h,this.maxPlaylistRetries=R,this.enableLowInitialPlaylist=f,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:R,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=Yx(),v&&k.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new k.ManagedMediaSource,this.usingManagedMediaSource_=!0,B.log("Using ManagedMediaSource")):k.MediaSource&&(this.mediaSource=new k.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_=Ke(),this.hasPlayed_=!1,this.syncController_=new Ux(e),this.segmentMetadataTrack_=n.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new $x,this.sourceUpdater_=new Pf(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new Bx,this.keyStatusMap_=new Map;const L={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:P,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:r,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:T,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new go(t,this.vhs_,ge(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new ns(t,this.vhs_,ge(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new To(ge(L,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new To(ge(L,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new Lx(ge(L,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((F,D)=>{function V(){n.off("vttjserror",X),F()}function X(){n.off("vttjsloaded",V),D()}n.one("vttjsloaded",V),n.one("vttjserror",X),n.addWebVttScript_()})}),e);const N=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new Qx(this.vhs_.xhr,N),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),e1.forEach(F=>{this[F+"_"]=t1.bind(this,F)}),this.logger_=Pt("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 U=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(U,()=>{const F=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-F,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,i){const n=this.media(),r=n&&(n.id||n.uri),a=e&&(e.id||e.uri);if(r&&r!==a){this.logger_(`switch media ${r} -> ${a} from ${t}`);const l={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,n=this.contentSteeringController_.getPathway();if(i&&n){const a=(i.length?i[0].playlists:i.playlists).filter(l=>l.attributes.serviceLocation===n);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=k.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(k.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const i=e.mediaGroups.AUDIO,n=Object.keys(i);let r;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)r=this.mediaTypes_.AUDIO.activeTrack();else{const l=i.main||n.length&&i[n[0]];for(const h in l)if(l[h].default){r={label:h};break}}if(!r)return t;const a=[];for(const l in i)if(i[l][r.label]){const h=i[l][r.label];if(h.playlists&&h.playlists.length)a.push.apply(a,h.playlists);else if(h.uri)a.push(h);else if(e.playlists.length)for(let f=0;f<e.playlists.length;f++){const m=e.playlists[f];m.attributes&&m.attributes.AUDIO&&m.attributes.AUDIO===l&&a.push(m)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;co(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),Xx({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let i;if(this.enableLowInitialPlaylist&&(i=this.selectInitialPlaylist()),i||(i=this.selectPlaylist()),!i||!this.shouldSwitchToMedia_(i)||(this.initialMedia_=i,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;co(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=i,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,i=>{this.player_.trigger(je({},i))})})}handleUpdatedMediaPlaylist(e){this.useCueTags_&&this.updateAdCues_(e),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(e,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_&&this.runFastQualitySwitch_(),this.updateDuration(!e.endList),this.tech_.paused()||(this.mainSegmentLoader_.load(),this.audioSegmentLoader_&&this.audioSegmentLoader_.load())}triggerPresenceUsage_(e,t){const i=e.mediaGroups||{};let n=!0;const r=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const l in i.AUDIO[a])i.AUDIO[a][l].uri||(n=!1);n&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(i.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),vi.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),r.length&&Object.keys(i.AUDIO[r[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),n=this.bufferLowWaterLine(),r=this.bufferHighWaterLine(),a=this.tech_.buffered();return i1({buffered:a,currentTime:i,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:n,bufferHighWaterLine:r,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const i=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:i.playlist,error:i})}),this.mainSegmentLoader_.on("appenderror",()=>{this.error=this.mainSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.mainSegmentLoader_.on("timestampoffset",()=>{this.tech_.trigger({type:"usage",name:"vhs-timestamp-offset"})}),this.audioSegmentLoader_.on("syncinfoupdate",()=>{this.onSyncInfoUpdate_()}),this.audioSegmentLoader_.on("appenderror",()=>{this.error=this.audioSegmentLoader_.error_,this.trigger("error")}),this.mainSegmentLoader_.on("ended",()=>{this.logger_("main segment loader ended"),this.onEndOfStream()}),this.timelineChangeController_.on("audioTimelineBehind",()=>{const i=this.audioSegmentLoader_.pendingSegment_;if(!i||!i.segment||!i.segment.syncInfo)return;const n=i.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",i=>{this.bufferBasedABR||(this.delegateLoaders_("all",["abort"]),this.excludePlaylist({error:{message:"Aborted early because there isn't enough bandwidth to complete the request without rebuffering."},playlistExclusionDuration:Zx}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const i=this.getCodecsOrExclude_();i&&this.sourceUpdater_.addOrChangeSourceBuffers(i)};this.mainSegmentLoader_.on("trackinfo",e),this.audioSegmentLoader_.on("trackinfo",e),this.mainSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("fmp4",()=>{this.triggeredFmp4Usage||(this.tech_.trigger({type:"usage",name:"vhs-fmp4"}),this.triggeredFmp4Usage=!0)}),this.audioSegmentLoader_.on("ended",()=>{this.logger_("audioSegmentLoader ended"),this.onEndOfStream()}),["segmentselected","segmentloadstart","segmentloaded","segmentkeyloadstart","segmentkeyloadcomplete","segmentdecryptionstart","segmentdecryptioncomplete","segmenttransmuxingstart","segmenttransmuxingcomplete","segmenttransmuxingtrackinfoavailable","segmenttransmuxingtiminginfoavailable","segmentappendstart","appendsdone","bandwidthupdated","timelinechange","codecschange"].forEach(i=>{this.mainSegmentLoader_.on(i,n=>{this.player_.trigger(je({},n))}),this.audioSegmentLoader_.on(i,n=>{this.player_.trigger(je({},n))}),this.subtitleSegmentLoader_.on(i,n=>{this.player_.trigger(je({},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 i=t.end(0);let n=i;if(e.start){const r=e.start.timeOffset;r<0?n=Math.max(i+r,t.start(0)):n=Math.min(i,r)}this.trigger("firstplay"),this.tech_.setCurrentTime(n)}return this.hasPlayed_=!0,this.load(),!0}handleSourceOpen_(){if(this.tryToCreateSourceBuffers_(),this.tech_.autoplay()){const e=this.tech_.play();typeof e<"u"&&typeof e.then=="function"&&e.then(null,t=>{})}this.trigger("sourceopen")}handleSourceEnded_(){if(!this.inbandTextTracks_.metadataTrack_)return;const e=this.inbandTextTracks_.metadataTrack_.cues;if(!e||!e.length)return;const t=this.duration();e[e.length-1].endTime=isNaN(t)||Math.abs(t)===1/0?Number.MAX_VALUE:t}handleDurationChange_(){this.tech_.trigger("durationchange")}onEndOfStream(){let e=this.mainSegmentLoader_.ended_;if(this.mediaTypes_.AUDIO.activePlaylistLoader){const t=this.mainSegmentLoader_.getCurrentMediaInfo_();!t||t.hasVideo?e=e&&this.audioSegmentLoader_.ended_:e=this.audioSegmentLoader_.ended_}e&&(this.stopABRTimer_(),this.sourceUpdater_.endOfStream())}stuckAtPlaylistEnd_(e){if(!this.seekable().length)return!1;const i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const n=vi.Playlist.playlistEnd(e,i),r=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return n-r<=Yt;const l=a.end(a.length-1);return l-r<=Yt&&n-l<=Yt}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:i}){if(e=e||this.mainPlaylistLoader_.media(),i=i||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const n=this.mainPlaylistLoader_.main.playlists,r=n.filter(na),a=r.length===1&&r[0]===e;if(n.length===1&&i!==1/0)return B.log.warn(`Problem encountered with playlist ${e.id}. Trying again since it is the only playlist.`),this.tech_.trigger("retryplaylist"),this.mainPlaylistLoader_.load(a);if(a){if(this.main().contentSteering){const P=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(P),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(P)},v);return}let C=!1;n.forEach(P=>{if(P===e)return;const v=P.excludeUntil;typeof v<"u"&&v!==1/0&&(C=!0,delete P.excludeUntil)}),C&&(B.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+i*1e3,e.excludeUntil=l,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const h=this.selectPlaylist();if(!h){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const f=t.internal?this.logger_:B.log.warn,m=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${m} Switching to playlist ${h.id}.`),h.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),h.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const T=h.targetDuration/2*1e3||5*1e3,E=typeof h.lastRequest=="number"&&Date.now()-h.lastRequest<=T;return this.switchMedia_(h,"exclude",a||E)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],n=e==="all";(n||e==="main")&&i.push(this.mainPlaylistLoader_);const r=[];(n||e==="audio")&&r.push("AUDIO"),(n||e==="subtitle")&&(r.push("CLOSED-CAPTIONS"),r.push("SUBTITLES")),r.forEach(a=>{const l=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;l&&i.push(l)}),["main","audio","subtitle"].forEach(a=>{const l=this[`${a}SegmentLoader_`];l&&(e===a||e==="all")&&i.push(l)}),i.forEach(a=>t.forEach(l=>{typeof a[l]=="function"&&a[l]()}))}setCurrentTime(e){const t=ss(this.tech_.buffered(),e);if(!(this.mainPlaylistLoader_&&this.mainPlaylistLoader_.media())||!this.mainPlaylistLoader_.media().segments)return 0;if(t&&t.length)return e;this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.resetEverything(),this.mediaTypes_.AUDIO.activePlaylistLoader&&(this.audioSegmentLoader_.pause(),this.audioSegmentLoader_.resetEverything()),this.mediaTypes_.SUBTITLES.activePlaylistLoader&&(this.subtitleSegmentLoader_.pause(),this.subtitleSegmentLoader_.resetEverything()),this.load()}duration(){if(!this.mainPlaylistLoader_)return 0;const e=this.mainPlaylistLoader_.media();return e?e.endList?this.mediaSource?this.mediaSource.duration:vi.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const i=e.media();if(!i)return null;const n=this.syncController_.getMediaSequenceSync(t);if(n&&n.isReliable){const l=n.start,h=n.end;if(!isFinite(l)||!isFinite(h))return null;const f=vi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),m=Math.max(0,h-f);return m<l?null:Ke([[l,m]])}const r=this.syncController_.getExpiredTime(i,this.duration());if(r===null)return null;const a=vi.Playlist.seekable(i,r,vi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),n=e.end(0),r=t.start(0),a=t.end(0);return r>n||i>a?e:Ke([[Math.max(i,r),Math.min(n,a)]])}onSyncInfoUpdate_(){if(!this.mainPlaylistLoader_)return;const e=this.getSeekableRange_(this.mainPlaylistLoader_,"main");if(!e)return;let t;if(this.mediaTypes_.AUDIO.activePlaylistLoader&&(t=this.getSeekableRange_(this.mediaTypes_.AUDIO.activePlaylistLoader,"audio"),!t))return;const i=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||i&&i.length&&this.seekable_.length&&i.start(0)===this.seekable_.start(0)&&i.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${Hh(this.seekable_)}]`);const n={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:n}),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 n=this.seekable();if(!n.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<n.end(n.length-1))&&this.sourceUpdater_.setDuration(n.end(n.length-1));return}const t=this.tech_.buffered();let i=vi.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(i=Math.max(i,t.end(t.length-1))),this.mediaSource.duration!==i&&this.sourceUpdater_.setDuration(i)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.contentSteeringController_.dispose(),this.keyStatusMap_.clear(),this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_),["AUDIO","SUBTITLES"].forEach(e=>{const t=this.mediaTypes_[e].groups;for(const i in t)t[i].forEach(n=>{n.playlistLoader&&n.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),i=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!i)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const i=gn(this.main(),t),n={},r=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(n.video=i.video||e.main.videoCodec||Gy),e.main.isMuxed&&(n.video+=`,${i.audio||e.main.audioCodec||bu}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||r)&&(n.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||bu,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!n.audio&&!n.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(f,m)=>f?dn(m,this.usingManagedMediaSource_):La(m),l={};let h;if(["video","audio"].forEach(function(f){if(n.hasOwnProperty(f)&&!a(e[f].isFmp4,n[f])){const m=e[f].isFmp4?"browser":"muxer";l[m]=l[m]||[],l[m].push(n[f]),f==="audio"&&(h=m)}}),r&&h&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(m=>{(m.attributes&&m.attributes.AUDIO)===f&&m!==t&&(m.excludeUntil=1/0)}),this.logger_(`excluding audio group ${f} as ${h} does not support codec(s): "${n.audio}"`)}if(Object.keys(l).length){const f=Object.keys(l).reduce((m,T)=>(m&&(m+=", "),m+=`${T} does not support codec(s): "${l[T].join(",")}"`,m),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:f},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const f=[];if(["video","audio"].forEach(m=>{const T=(zt(this.sourceUpdater_.codecs[m]||"")[0]||{}).type,E=(zt(n[m]||"")[0]||{}).type;T&&E&&T.toLowerCase()!==E.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[m]}" -> "${n[m]}"`)}),f.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${f.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return n}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(i=>{const n=e[i];if(t.indexOf(n.id)!==-1)return;t.push(n.id);const r=gn(this.main,n),a=[];r.audio&&!La(r.audio)&&!dn(r.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${r.audio}`),r.video&&!La(r.video)&&!dn(r.video,this.usingManagedMediaSource_)&&a.push(`video codec ${r.video}`),r.text&&r.text==="stpp.ttml.im1t"&&a.push(`text codec ${r.text}`),a.length&&(n.excludeUntil=1/0,this.logger_(`excluding ${n.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],i=this.main().playlists,n=kr(zt(e)),r=fc(n),a=n.video&&zt(n.video)[0]||null,l=n.audio&&zt(n.audio)[0]||null;Object.keys(i).forEach(h=>{const f=i[h];if(t.indexOf(f.id)!==-1||f.excludeUntil===1/0)return;t.push(f.id);const m=[],T=gn(this.mainPlaylistLoader_.main,f),E=fc(T);if(!(!T.audio&&!T.video)){if(E!==r&&m.push(`codec count "${E}" !== "${r}"`),!this.sourceUpdater_.canChangeType()){const C=T.video&&zt(T.video)[0]||null,P=T.audio&&zt(T.audio)[0]||null;C&&a&&C.type.toLowerCase()!==a.type.toLowerCase()&&m.push(`video codec "${C.type}" !== "${a.type}"`),P&&l&&P.type.toLowerCase()!==l.type.toLowerCase()&&m.push(`audio codec "${P.type}" !== "${l.type}"`)}m.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${m.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),Rx(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=We.GOAL_BUFFER_LENGTH,i=We.GOAL_BUFFER_LENGTH_RATE,n=Math.max(t,We.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,n)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=We.BUFFER_LOW_WATER_LINE,i=We.BUFFER_LOW_WATER_LINE_RATE,n=Math.max(t,We.MAX_BUFFER_LOW_WATER_LINE),r=Math.max(t,We.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?r:n)}bufferHighWaterLine(){return We.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){gc(this.inbandTextTracks_,"com.apple.streaming",this.tech_),fx({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const n=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();gc(this.inbandTextTracks_,e,this.tech_),cx({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:n,videoDuration:i})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,i=>{this.trigger(je({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const r=this.contentSteeringController_.getAvailablePathways(),a=[];for(const l of t.playlists){const h=l.attributes.serviceLocation;if(h&&(a.push(h),!r.has(h)))return!0}return!!(!a.length&&r.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const i=this.main().playlists,n=new Set;let r=!1;Object.keys(i).forEach(a=>{const l=i[a],h=this.pathwayAttribute_(l),f=h&&e!==h;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!f&&(delete l.excludeUntil,delete l.lastExcludeReason_,r=!0);const T=!l.excludeUntil&&l.excludeUntil!==1/0;!n.has(l.id)&&f&&T&&(n.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const l=this.mediaTypes_[a];if(l.activePlaylistLoader){const h=l.activePlaylistLoader.media_;h&&h.attributes.serviceLocation!==e&&(r=!0)}}),r&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,n=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||n&&n.size){for(const[a,l]of i.entries())n.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(a));for(const[a,l]of n.entries()){const h=i.get(a);if(!h){t.filter(m=>m.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(m=>{this.mainPlaylistLoader_.addClonePathway(l,m)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(h,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(a))}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 i=e["URI-REPLACEMENT"].PARAMS,n=t["URI-REPLACEMENT"].PARAMS;for(const r in i)if(i[r]!==n[r])return!1;for(const r in n)if(i[r]!==n[r])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=this.mainPlaylistLoader_.getKeyIdSet(i);!n||!n.size||n.forEach(r=>{const a="usable",l=this.keyStatusMap_.has(r)&&this.keyStatusMap_.get(r)===a,h=i.lastExcludeReason_===t&&i.excludeUntil===1/0;l?l&&h&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${r} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${r} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const n=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,r=i.excludeUntil===1/0&&i.lastExcludeReason_===t;n&&r&&(delete i.excludeUntil,B.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const r=(typeof e=="string"?e:Px(e)).slice(0,32).toLowerCase();this.logger_(`KeyStatus '${t}' with key ID ${r} added to the keyStatusMap`),this.keyStatusMap_.set(r,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 n1=(s,e,t)=>i=>{const n=s.main.playlists[e],r=dl(n),a=na(n);if(typeof i>"u")return a;i?delete n.disabled:n.disabled=!0;const l={renditionInfo:{id:e,bandwidth:n.attributes.BANDWIDTH,resolution:n.attributes.RESOLUTION,codecs:n.attributes.CODECS},cause:"fast-quality"};return i!==a&&!r&&(i?(t(n),s.trigger({type:"renditionenabled",metadata:l})):s.trigger({type:"renditiondisabled",metadata:l})),i};class r1{constructor(e,t,i){const{playlistController_:n}=e,r=n.fastQualityChange_.bind(n);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=gn(n.main(),t),this.playlist=t,this.id=i,this.enabled=n1(e.playlists,t.id,r)}}const a1=function(s){s.representations=()=>{const e=s.playlistController_.main(),t=wn(e)?s.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!dl(i)).map((i,n)=>new r1(s,i,i.id)):[]}},Ic=["seeking","seeked","pause","playing","error"];class o1 extends B.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_=Pt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),n=()=>this.techWaiting_(),r=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],h={};l.forEach(m=>{h[m]={reset:()=>this.resetSegmentDownloads_(m),updateend:()=>this.checkSegmentDownloads_(m)},a[`${m}SegmentLoader_`].on("appendsdone",h[m].updateend),a[`${m}SegmentLoader_`].on("playlistupdate",h[m].reset),this.tech_.on(["seeked","seeking"],h[m].reset)});const f=m=>{["main","audio"].forEach(T=>{a[`${T}SegmentLoader_`][m]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),f("off"))},this.clearSeekingAppendCheck_=()=>f("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),f("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",n),this.tech_.on(Ic,r),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",n),this.tech_.off(Ic,r),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(m=>{a[`${m}SegmentLoader_`].off("appendsdone",h[m].updateend),a[`${m}SegmentLoader_`].off("playlistupdate",h[m].reset),this.tech_.off(["seeked","seeking"],h[m].reset)}),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=k.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,i=t[`${e}SegmentLoader_`],n=i.buffered_(),r=zv(this[`${e}Buffered_`],n);if(this[`${e}Buffered_`]=n,r){const a={bufferedRanges:n};t.trigger({type:"bufferedrangeschanged",metadata:a}),this.resetSegmentDownloads_(e);return}this[`${e}StalledDownloads_`]++,this.logger_(`found #${this[`${e}StalledDownloads_`]} ${e} appends that did not increase buffer (possible stalled download)`,{playlistId:i.playlist_&&i.playlist_.id,buffered:Ui(n)}),!(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+Yt>=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(Ke([this.lastRecordedTime,e]));const i={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:i}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),i=this.tech_.currentTime(),n=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let r;if(n&&(r=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const P=t.start(0);r=P+(P===t.end(0)?0:Yt)}if(typeof r<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${Hh(t)}. Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0;const a=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),h=a.audioBuffer?a.audioBuffered():null,f=a.videoBuffer?a.videoBuffered():null,m=this.media(),T=m.partTargetDuration?m.partTargetDuration:(m.targetDuration-Xt)*2,E=[h,f];for(let P=0;P<E.length;P++){if(!E[P])continue;if(ul(E[P],i)<T)return!1}const C=sr(l,i);return C.length===0?!1:(r=C.start(0)+Yt,this.logger_(`Buffered region starts (${C.start(0)}) just beyond seek point (${i}). Seeking to ${r}.`),this.tech_.setCurrentTime(r),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=ss(t,e);if(i.length&&e+3<=i.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${i.start(0)} -> ${i.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,n=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:i.audioBuffered(),videoBuffered:i.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=sr(n,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,i,n=!1){if(!e.length)return!1;let r=e.end(e.length-1)+Yt;const a=!i.endList,l=typeof i.partTargetDuration=="number";return a&&(l||n)&&(r=e.end(e.length-1)+i.targetDuration*3),t>r}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let n;if(e.length&&t.length){const r=ss(e,i-3),a=ss(e,i),l=ss(t,i);l.length&&!a.length&&r.length&&(n={start:r.end(0),end:l.end(0)})}else sr(e,i).length||(n=this.gapFromVideoUnderflow_(e,i));return n?(this.logger_(`Encountered a gap in video from ${n.start} to ${n.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),n=sr(t,i);if(this.resetTimeUpdate_(),n.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",n.start(0)),this.tech_.setCurrentTime(n.start(0)+Xt);const r={gapInfo:{from:i,to:n.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:r}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=Vv(e);for(let n=0;n<i.length;n++){const r=i.start(n),a=i.end(n);if(t-r<4&&t-r>2)return{start:r,end:a}}return null}}const l1={errorInterval:30,getSource(s){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return s(t)}},Rf=function(s,e){let t=0,i=0;const n=ge(l1,e);s.ready(()=>{s.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const r=function(){i&&s.currentTime(i)},a=function(m){m!=null&&(i=s.duration()!==1/0&&s.currentTime()||0,s.one("loadedmetadata",r),s.src(m),s.trigger({type:"usage",name:"vhs-error-reload"}),s.play())},l=function(){if(Date.now()-t<n.errorInterval*1e3){s.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!n.getSource||typeof n.getSource!="function"){B.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),n.getSource.call(s,a)},h=function(){s.off("loadedmetadata",r),s.off("error",l),s.off("dispose",h)},f=function(m){h(),Rf(s,m)};s.on("error",l),s.on("dispose",h),s.reloadSourceOnError=f},u1=function(s){Rf(this,s)};var Mf="3.16.2",c1="7.1.0",d1="1.3.1",h1="7.2.0",f1="4.0.2";const Me={PlaylistLoader:ns,Playlist:ht,utils:mb,STANDARD_PLAYLIST_SELECTOR:mc,INITIAL_PLAYLIST_SELECTOR:rx,lastBandwidthSelector:mc,movingAverageBandwidthSelector:sx,comparePlaylistBandwidth:pl,comparePlaylistResolution:ix,xhr:of()};Object.keys(We).forEach(s=>{Object.defineProperty(Me,s,{get(){return B.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),We[s]},set(e){if(B.log.warn(`using Vhs.${s} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){B.log.warn(`value of Vhs.${s} must be greater than or equal to 0`);return}We[s]=e}})});const Nf="videojs-vhs",Uf=function(s,e){const t=e.media();let i=-1;for(let n=0;n<s.length;n++)if(s[n].id===t.id){i=n;break}s.selectedIndex_=i,s.trigger({selectedIndex:i,type:"change"})},p1=function(s,e){e.representations().forEach(t=>{s.addQualityLevel(t)}),Uf(s,e.playlists)};Me.canPlaySource=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const m1=(s,e,t)=>{if(!s)return s;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=kr(zt(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const n=fs(i.video),r=fs(i.audio),a={};for(const l in s)a[l]={},r&&(a[l].audioContentType=r),n&&(a[l].videoContentType=n),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(a[l].pssh=e.contentProtection[l].pssh),typeof s[l]=="string"&&(a[l].url=s[l]);return ge(s,a)},g1=(s,e)=>s.reduce((t,i)=>{if(!i.contentProtection)return t;const n=e.reduce((r,a)=>{const l=i.contentProtection[a];return l&&l.pssh&&(r[a]={pssh:l.pssh}),r},{});return Object.keys(n).length&&t.push(n),t},[]),y1=({player:s,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!s.eme.initializeMediaKeys)return Promise.resolve();const n=t?i.concat([t]):i,r=g1(n,Object.keys(e)),a=[],l=[];return r.forEach(h=>{l.push(new Promise((f,m)=>{s.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,m)=>{s.eme.initializeMediaKeys({keySystems:h},T=>{if(T){m(T);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},_1=({player:s,sourceKeySystems:e,media:t,audioMedia:i})=>{const n=m1(e,t,i);return n?(s.currentSource().keySystems=n,n&&!s.eme?(B.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},Bf=()=>{if(!k.localStorage)return null;const s=k.localStorage.getItem(Nf);if(!s)return null;try{return JSON.parse(s)}catch{return null}},T1=s=>{if(!k.localStorage)return!1;let e=Bf();e=e?ge(e,s):s;try{k.localStorage.setItem(Nf,JSON.stringify(e))}catch{return!1}return e},v1=s=>s.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(s.substring(s.indexOf(",")+1)):s,Ff=(s,e)=>{s._requestCallbackSet||(s._requestCallbackSet=new Set),s._requestCallbackSet.add(e)},$f=(s,e)=>{s._responseCallbackSet||(s._responseCallbackSet=new Set),s._responseCallbackSet.add(e)},jf=(s,e)=>{s._requestCallbackSet&&(s._requestCallbackSet.delete(e),s._requestCallbackSet.size||delete s._requestCallbackSet)},Vf=(s,e)=>{s._responseCallbackSet&&(s._responseCallbackSet.delete(e),s._responseCallbackSet.size||delete s._responseCallbackSet)};Me.supportsNativeHls=function(){if(!K||!K.createElement)return!1;const s=K.createElement("video");return B.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(s.canPlayType(t))}):!1}();Me.supportsNativeDash=function(){return!K||!K.createElement||!B.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(K.createElement("video").canPlayType("application/dash+xml"))}();Me.supportsTypeNatively=s=>s==="hls"?Me.supportsNativeHls:s==="dash"?Me.supportsNativeDash:!1;Me.isSupported=function(){return B.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};Me.xhr.onRequest=function(s){Ff(Me.xhr,s)};Me.xhr.onResponse=function(s){$f(Me.xhr,s)};Me.xhr.offRequest=function(s){jf(Me.xhr,s)};Me.xhr.offResponse=function(s){Vf(Me.xhr,s)};const b1=B.getComponent("Component");class Hf extends b1{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Pt("VhsHandler"),t.options_&&t.options_.playerId){const n=B.getPlayer(t.options_.playerId);this.player_=n}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(K,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],n=>{const r=K.fullscreenElement||K.webkitFullscreenElement||K.mozFullScreenElement||K.msFullscreenElement;r&&r.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_=ge(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 i=Bf();i&&i.bandwidth&&(this.options_.bandwidth=i.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),i&&i.throughput&&(this.options_.throughput=i.throughput,this.tech_.trigger({type:"usage",name:"vhs-throughput-from-local-storage"}))}typeof this.options_.bandwidth!="number"&&(this.options_.bandwidth=We.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===We.INITIAL_BANDWIDTH,["withCredentials","useDevicePixelRatio","customPixelRatio","limitRenditionByPlayerDimensions","bandwidth","customTagParsers","customTagMappers","cacheEncryptionKeys","playlistSelector","initialPlaylistSelector","bufferBasedABR","liveRangeSafeTimeDelta","llhls","useForcedSubtitles","useNetworkInformationApi","useDtsForTimestampOffset","exactManifestTimings","leastPixelDiffSelector"].forEach(i=>{typeof this.source_[i]<"u"&&(this.options_[i]=this.source_[i])}),this.limitRenditionByPlayerDimensions=this.options_.limitRenditionByPlayerDimensions,this.useDevicePixelRatio=this.options_.useDevicePixelRatio;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=v1(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=Me,this.options_.sourceType=ld(t),this.options_.seekTo=r=>{this.tech_.setCurrentTime(r)},this.options_.player_=this.player_,this.playlistController_=new s1(this.options_);const i=ge({liveRangeSafeTimeDelta:Yt},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new o1(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const r=B.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}),r.error(a)});const n=this.options_.bufferBasedABR?Me.movingAverageBandwidthSelector(.55):Me.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):n.bind(this),this.playlistController_.selectInitialPlaylist=Me.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(r){this.playlistController_.selectPlaylist=r.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(r){this.playlistController_.mainSegmentLoader_.throughput.rate=r,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let r=this.playlistController_.mainSegmentLoader_.bandwidth;const a=k.navigator.connection||k.navigator.mozConnection||k.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const h=a.downlink*1e3*1e3;h>=l&&r>=l?r=Math.max(r,h):r=h}return r},set(r){this.playlistController_.mainSegmentLoader_.bandwidth=r,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const r=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(r+a))},set(){B.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:()=>Ui(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:()=>Ui(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&&T1({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{a1(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_=k.URL.createObjectURL(this.playlistController_.mediaSource),(B.browser.IS_ANY_SAFARI||B.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"),y1({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=_1({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",i=>{this.playlistController_.updatePlaylistByKeyStatus(i.keyId,i.status)}),this.handleWaitingForKey_=this.handleWaitingForKey_.bind(this),this.player_.tech_.on("waitingforkey",this.handleWaitingForKey_),!t){this.playlistController_.sourceUpdater_.initializedEme();return}this.createKeySessions_()}setupQualityLevels_(){const e=B.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{p1(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{Uf(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":Mf,"mux.js":c1,"mpd-parser":d1,"m3u8-parser":h1,"aes-decrypter":f1}}version(){return this.constructor.version()}canChangeType(){return Pf.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_&&k.URL.revokeObjectURL&&(k.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return xb({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,n=2){return hf({programTime:e,playlist:this.playlistController_.media(),retryCount:n,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{Ff(this.xhr,e)},this.xhr.onResponse=e=>{$f(this.xhr,e)},this.xhr.offRequest=e=>{jf(this.xhr,e)},this.xhr.offResponse=e=>{Vf(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(i=>{this.playlistController_.on(i,n=>{this.player_.trigger(je({},n))})}),t.forEach(i=>{this.playbackWatcher_.on(i,n=>{this.player_.trigger(je({},n))})})}}const Lr={name:"videojs-http-streaming",VERSION:Mf,canHandleSource(s,e={}){const t=ge(B.options,e);return!t.vhs.experimentalUseMMS&&!dn("avc1.4d400d,mp4a.40.2",!1)?!1:Lr.canPlayType(s.type,t)},handleSource(s,e,t={}){const i=ge(B.options,t);return e.vhs=new Hf(s,e,i),e.vhs.xhr=of(),e.vhs.setupXhrHooks_(),e.vhs.src(s.src,s.type),e.vhs},canPlayType(s,e){const t=ld(s);if(!t)return"";const i=Lr.getOverrideNative(e);return!Me.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(s={}){const{vhs:e={}}=s,t=!(B.browser.IS_ANY_SAFARI||B.browser.IS_IOS),{overrideNative:i=t}=e;return i}},x1=()=>dn("avc1.4d400d,mp4a.40.2",!0);x1()&&B.getTech("Html5").registerSourceHandler(Lr,0);B.VhsHandler=Hf;B.VhsSourceHandler=Lr;B.Vhs=Me;B.use||B.registerComponent("Vhs",Me);B.options.vhs=B.options.vhs||{};(!B.getPlugin||!B.getPlugin("reloadSourceOnError"))&&B.registerPlugin("reloadSourceOnError",u1);class S1{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const i=e.childNodes[t];switch(i.localName){case"AdTagURI":this.adTagURI={templateType:i.getAttribute("templateType"),uri:(i.textContent||i.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=i.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=i;break}}}}function qf(s,e){const t=[];for(const i in s.childNodes){const n=s.childNodes[i];(n.nodeName===e||e===`vmap:${n.nodeName}`||n.nodeName===`vmap:${e}`)&&t.push(n)}return t}function E1(s){if(!s||!s.childNodes)return{};const e=s.childNodes,t=[];for(const n in e){const r=e[n];r.nodeName==="#cdata-section"&&t.push(r)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let i="";for(const n in e){const r=e[n];switch(r.nodeName){case"#text":i+=r.textContent.trim();break;case"#cdata-section":i+=r.data;break}}return i}function ml(s){const e={attributes:{},children:{},value:{}};e.value=E1(s);const t=s.attributes;if(t)for(const n in t){const r=t[n];r.nodeName&&r.nodeValue!==void 0&&r.nodeValue!==null&&(e.attributes[r.nodeName]=r.nodeValue)}const i=s.childNodes;if(i)for(const n in i){const r=i[n];r.nodeName&&r.nodeName.substring(0,1)!=="#"&&(e.children[r.nodeName]=ml(r))}return e}class C1{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const i=e.childNodes[t];switch(i.localName){case"AdSource":this.adSource=new S1(i);break;case"TrackingEvents":for(const n in i.childNodes){const r=i.childNodes[n];r.localName==="Tracking"&&this.trackingEvents.push({event:r.getAttribute("event"),uri:(r.textContent||r.text||"").trim()})}break;case"Extensions":this.extensions=qf(i,"Extension").map(n=>ml(n));break}}}track(e,t){for(const i in this.trackingEvents){const n=this.trackingEvents[i];if(n.event===e){let{uri:r}=n;n.event==="error"&&(r=r.replace("[ERRORCODE]",t)),this.tracker(r)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}}class w1{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const i=e.documentElement.childNodes[t];switch(i.localName){case"AdBreak":this.adBreaks.push(new C1(i));break;case"Extensions":this.extensions=qf(i,"Extension").map(n=>ml(n));break}}}}const I1=(s,e)=>{const t=goog.pal,i=new t.ConsentSettings;i.allowStorage=!1;const n=new t.NonceLoader(i);return async()=>{try{const r=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||Qs.v4(),h=sessionStorage.getItem("sl-ad-session-id");h||(h=Qs.v4(),sessionStorage.setItem("sl-ad-session-id",h)),Qs.validate(l)||(l=Qs.v5(`https://${l}`,Qs.v5.URL)),r.searchParams.get("url")||r.searchParams.set("url","https://streamlayer.io"),r.searchParams.get("description_url")||r.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=r.searchParams.get("vpa")==="auto",a.adWillPlayMuted=r.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=r.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=s.clientHeight,a.videoWidth=s.clientWidth;const f=await n.loadNonceManager(a);return r.searchParams.get("is_lat")==="[placeholder]"&&r.searchParams.set("is_lat","1"),r.searchParams.get("rdid")==="[placeholder]"&&r.searchParams.set("rdid",l),r.searchParams.get("correlator")==="[placeholder]"&&r.searchParams.set("correlator",h),r.searchParams.set("wta","1"),r.searchParams.set("givn",f.getNonce()),{url:r,manager:f}}catch(r){console.log("AdsManager could not be started",r);return}}},A1=new Lc._,k1=s=>s.creatives.find(e=>e.mediaFiles),P1=s=>{var e;const t=s==null?void 0:s.mediaFiles;return t!=null&&t.length&&((e=t.find(i=>i.fileURL))==null?void 0:e.fileURL)||""},sn=Oc.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),D1=(s,e)=>{const[t,i]=Te.useState(),n=Te.useRef(Date.now()),r=Te.useRef(Date.now());return Te.useEffect(()=>{if(!e||!(s!=null&&s.current))return;const a=I1(s.current,e),l=Date.now();n.current=l,sn.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(h=>{n.current===l&&h&&(i(h.url),sn.set({ads:[],autoplay:!0,muted:!1,nonceManager:h.manager}))}).catch(h=>{console.error(h)})},[s,e]),Te.useEffect(()=>{const a=async(l,h)=>{let f=[];if(l.searchParams.get("output")==="vmap"){const C=await fetch(l.toString()),P=new DOMParser,v=await C.text(),R=P.parseFromString(v,"text/xml");f=new w1(R).adBreaks.map(L=>L.adSource.adTagURI.uri)}else f=[l.toString()];const m=await Promise.all(f.map((C,P)=>A1.get(C).then(v=>{if(r.current===h){const R=v.ads.find(U=>U.creatives.length>0);if(!R)return;const L=k1(R),N=P1(L);return{creative:L,order:P,mediaFileUrl:N,ad:R,raw:v}}}))),T=l.searchParams.get("vpa")!=="click",E=l.searchParams.get("vpmute")==="1";sn.set({...sn.get(),ads:m.filter(C=>!!C),autoplay:T,muted:E})};if(t){const l=Date.now();r.current=l,a(t,l)}return()=>{r.current=0}},[t]),sn},L1=s=>{const e=Te.useRef();return Te.useEffect(()=>{if(!e.current&&s.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),s.current.appendChild(t),e.current=B(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},zf={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:s=>{},playMuted:!1,muted:!1,autoplay:!0},Ae=Oc.i(zf),Ac=s=>{if(!s)return 0;const e=s.duration(),t=s.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},O1=(s,e)=>{const t=D1(s,e),i=L1(s),n=Te.useRef(),r=Te.useRef(!1),a=Te.useRef(!1),l=Te.useCallback(()=>{if(a.current)return;const C=t.get().nonceManager;if(C&&r.current)try{C.sendPlaybackEnd()}catch(P){console.warn("[PAL] sendPlaybackEnd failed",P)}a.current=!0},[t]),h=Te.useCallback(()=>{l(),i.current&&(i.current.pause(),i.current.src(void 0)),n.current=void 0,Ae.set({...zf,reset:h})},[i,l]);Te.useEffect(()=>{Ae.setKey("reset",h)},[h]);const f=Te.useCallback(()=>{var C,P,v;const{adPosition:R,adCount:L}=Ae.get();if(i.current){if(R<L){const N=R+1,{ads:U,muted:F,autoplay:D,nonceManager:V}=t.get(),X=U[N-1];if(X){(C=n.current)==null||C.complete(),n.current=new Lc.z(null,X.ad,X.creative),n.current.on("clickthrough",G=>{if(V)try{V.sendAdClick()}catch(ae){console.warn("[PAL] sendAdClick failed",ae)}window.open(G,"_blank")}),Ae.setKey("adPosition",N),Ae.setKey("playMuted",F),Ae.setKey("skipDelay",X.creative.skipDelay||0),Ae.setKey("time",0),Ae.setKey("adAction",G=>{n.current&&n.current.click(null,{CLICKPOS:[G.clientX,G.clientY]})}),Ae.setKey("whyThisAd",X.creative.icons.find(G=>G.program==="GoogleWhyThisAd")||null),Ae.setKey("hasAdUrl",!!((P=X.creative.videoClickThroughURLTemplate)!=null&&P.url)),i.current.src(X.mediaFileUrl),Ae.setKey("playing",!0),R===0?(Ae.setKey("muted",F),Ae.setKey("autoplay",D),F&&i.current.muted(!0),D?i.current.play():(i.current.pause(),Ae.setKey("paused",!0))):i.current.play();return}}(v=n.current)==null||v.complete(),h()}},[i,h,t]),m=Te.useCallback(()=>{if(!i.current)return;const C=i.current.muted();i.current.muted(!C),Ae.setKey("muted",!C),n.current&&n.current.setMuted(!C)},[i]),T=Te.useCallback(()=>{i.current&&(i.current.paused()?(i.current.play(),n.current&&n.current.setPaused(!1)):(i.current.pause(),n.current&&n.current.setPaused(!0)))},[i]),E=Te.useCallback(()=>{i.current&&(n.current&&n.current.skip(),f())},[f,i]);return Te.useEffect(()=>{const C=i.current;if(!C)return()=>{};const P=D=>{if(Ae.setKey("playing",!0),Ae.setKey("paused",!1),Ae.setKey("time",Ac(D.target.player)),!r.current){const V=t.get().nonceManager;if(V)try{V.sendPlaybackStart(),r.current=!0,a.current=!1}catch(X){console.warn("[PAL] sendPlaybackStart failed",X)}}},v=()=>{var D;(D=n.current)==null||D.complete(),f()},R=D=>{Ae.setKey("muted",D.target.player.muted())},L=()=>{Ae.setKey("paused",!0)},N=D=>{D.target.tagName==="VIDEO"&&(Ae.get().autoplay||T())},U=D=>{Ae.setKey("time",Ac(D.target.player)),n.current&&n.current.setProgress(D.target.player.currentTime())},F=()=>{h()};return C.on("play",P),C.on("ended",v),C.on("muted",R),C.on("pause",L),C.on("click",N),C.on("timeupdate",U),C.on("error",F),()=>{C.off("play",P),C.off("ended",v),C.off("muted",R),C.off("pause",L),C.off("click",N),C.off("timeupdate",U),C.off("error",F)}},[T,f,i,h,t]),Te.useEffect(()=>t.subscribe(C=>{C&&(r.current=!1,a.current=!1,Ae.setKey("adCount",C.ads.length),Ae.setKey("adPosition",0),f())}),[t,i,f]),Te.useEffect(()=>()=>{h()},[h]),[Ae,m,T,E,n]},R1=({promotion:s,onClose:e,promotionId:t,externalAd:i,skipAutoClose:n})=>{var r,a,l,h,f;const m=Te.useRef(null),[T,E,C,P]=O1(m,i==null?void 0:i.url),{time:v,adCount:R,adPosition:L,skipDelay:N,playing:U,paused:F,reset:D,muted:V,playMuted:X,autoplay:G,whyThisAd:ae,hasAdUrl:fe,adAction:ve}=Q.useStore(T),he=((r=s.sponsor)==null?void 0:r.logo)&&s.logoMode===re.PromotionLogoMode.CENTER;return W.jsxs(Fc,{className:"PromoOverlay",children:[W.jsxs($c,{children:[W.jsx(jc,{className:Q.cx_default(!he&&Vc),children:W.jsx(qc,{style:{transform:"scale(1.5)"},children:"Ad"})}),W.jsxs(A0,{children:[W.jsx(T0,{time:v,adCount:R,adPosition:L}),!!N&&U&&W.jsx(ur.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{P()},duration:N,isPlaying:!F,skipIcon:!0}),n&&W.jsx(ur.y,{className:"ClosePromoIcon",close:()=>{D(),e==null||e()}})]})]}),W.jsx(Hc,{className:Q.cx_default(lu,U&&uu,!U&&cu),children:W.jsxs(I0,{ref:m,children:[ae&&W.jsx(b0,{whyThisAd:ae}),W.jsxs(x0,{style:(ae==null?void 0:ae.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[X&&W.jsx(E0,{className:Q.cx_default(!V&&"muted"),onClick:()=>E()}),F&&!G&&W.jsx(w0,{onClick:()=>C()})]})]})}),fe&&W.jsx(zc,{className:Q.cx_default(lu,U&&uu,!U&&cu),children:W.jsx(Wc,{as:"button",onClick:ve,style:{backgroundColor:((l=(a=s.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((f=(h=s.banner)==null?void 0:h.ctaButton)==null?void 0:f.textColor)||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":s.type,target:"_blank",children:"Show more"})})]})},kc=s=>{var e,t,i,n,r,a,l,h,f,m,T,E,C,P,v,R,L,N,U,F,D,V,X,G,ae,fe,ve,he,Z,de;const{promotion:ee,open:Xe,advertisementPaused:Qe,togglePause:Ve,controlVideo:qe,skipAutoClose:be,promotionId:me,onClose:pt,markAsViewed:xt,externalAd:Ee,isEventFired:ce,fireEvent:Ue,muted:zi}=s,ui=ee.type===re.PromotionType.INGAME_IAB11_LBAR||ee.type===re.PromotionType.INGAME_IAB11||ee.type===re.PromotionType.INGAME_IAB11_SIDEBAR,ci=((e=ee.sponsor)==null?void 0:e.logo)&&ee.logoMode===re.PromotionLogoMode.CENTER,wi=!!((i=(t=ee.banner)==null?void 0:t.video)!=null&&i.url),mt=ee.autoPlayVideo===re.AutoPlayVideo.ENABLED,di=ee.playVideoMuted===re.PlayVideoMuted.ENABLED;if(Te.useEffect(()=>{Ve==null||Ve(wi||mt),Xe==null||Xe()},[]),Te.useEffect(()=>{me&&ee.type&&xt&&xt()},[me,ee.type,xt]),Te.useEffect(()=>()=>{qe==null||qe({muted:!1})},[qe]),Ee)return W.jsx(R1,{...s,externalAd:Ee});let Ft=(n=ee.banner)==null?void 0:n.url;Ft&&Ft.indexOf("http")!==0&&(Ft=`https://${Ft}`);let Ii=!0;return wi&&(!Qe||!mt?Ii=!0:Ii=!1),W.jsxs(Fc,{className:"PromoOverlay",children:[W.jsxs("div",{children:[W.jsxs($c,{children:[W.jsxs(jc,{className:Q.cx_default(!ci&&Vc),children:[((r=ee.sponsor)==null?void 0:r.logo)&&ee.logoMode===re.PromotionLogoMode.LEFT&&W.jsx(ru,{className:"PromoSponsorLogo",src:(a=ee.sponsor)==null?void 0:a.logo,alt:"promo"}),W.jsxs(h0,{style:{paddingLeft:(l=ee.sponsor)!=null&&l.logo&&ee.logoMode===re.PromotionLogoMode.LEFT?"0px":"8px"},children:[((h=ee.sponsor)==null?void 0:h.logo)&&ee.logoMode===re.PromotionLogoMode.LEFT&&W.jsx(l0,{children:(f=ee.sponsor)==null?void 0:f.name}),W.jsxs(f0,{className:"SponsorText",children:[W.jsx(qc,{children:"AD"}),W.jsx(p0,{children:"SPONSORED"})]})]})]}),W.jsx(ur.y,{className:"ClosePromoIcon",close:pt,autoClose:(m=ee.closeTimer)==null?void 0:m.auto,duration:be?0:(T=ee.closeTimer)==null?void 0:T.seconds,isPlaying:Ii})]}),W.jsxs(Hc,{children:[ci&&W.jsx(ru,{className:c0,src:(E=ee.sponsor)==null?void 0:E.logo,alt:"promo"}),W.jsx(au,{children:(P=(C=ee.banner)==null?void 0:C.video)!=null&&P.url?W.jsx(ur.Et,{source:(R=(v=ee.banner)==null?void 0:v.video)==null?void 0:R.url,poster:(N=(L=ee.banner)==null?void 0:L.video)==null?void 0:N.thumbnailUrl,aspectRatio:ui?"1/1":"2/1",onRender:()=>{ce!=null&&ce("video-rendered")||(qt.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:me,type:ee.type}}),Ue==null||Ue("video-rendered"))},onQuartile:Dt=>{ce!=null&&ce(`video-quartile-${Dt}`)||(qt.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:me,type:ee.type,quartile:Dt}}),Ue==null||Ue(`video-quartile-${Dt}`))},onMute:Dt=>{const Lt=Dt?"muted":"unmuted";ce!=null&&ce(Lt)||(qt.eventBus.emit("advertisement",{action:Dt?"videoMuted":"videoUnmuted",payload:{id:me,type:ee.type}}),Ue==null||Ue(Lt))},onPause:()=>{mt&&(Ve==null||Ve(!0))},onReplay:()=>{ce!=null&&ce("replayed")||(qt.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:me,type:ee.type}}),Ue==null||Ue("replayed"))},onPlay:()=>{ce!=null&&ce("played")||(qt.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:me,type:ee.type}}),Ue==null||Ue("played")),Ve==null||Ve(!1),ce!=null&&ce("played")&&ce!=null&&ce("ended")&&!(ce!=null&&ce("replayed"))&&(qt.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:me,type:ee.type}}),Ue==null||Ue("replayed"))},onEnd:()=>{ce!=null&&ce("ended")||(qt.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:me,type:ee.type}}),Ue==null||Ue("ended"))},controlVideo:qe,autoPlay:mt,playMuted:di,muted:zi}):(U=ee.banner)!=null&&U.imageUrl?W.jsx(u0,{style:ui?{aspectRatio:"1/1"}:{},src:(F=ee.banner)==null?void 0:F.imageUrl,alt:"promo"}):null}),!ui&&W.jsxs(au,{children:[((D=ee.banner)==null?void 0:D.title)&&W.jsx(m0,{className:Q.cx_default("AdvTitle",ci&&g0),children:(V=ee.banner)==null?void 0:V.title}),((X=ee.banner)==null?void 0:X.body)&&W.jsx(d0,{className:"AdvDescription",children:(G=ee.banner)==null?void 0:G.body})]})]})]}),ee.buttonType===re.PromotionButtonType.BASIC&&W.jsx(zc,{children:W.jsx(Wc,{href:Ft,style:{backgroundColor:((fe=(ae=ee.banner)==null?void 0:ae.ctaButton)==null?void 0:fe.color)||"#009dc4",color:((he=(ve=ee.banner)==null?void 0:ve.ctaButton)==null?void 0:he.textColor)||"#fff"},"data-a":"button","data-promo-id":me,"data-promo-type":ee.type,target:"_blank",children:(de=(Z=ee.banner)==null?void 0:Z.ctaButton)==null?void 0:de.label})})]})},M1=Q.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),N1=({children:s,direction:e,style:t,className:i,hiding:n})=>W.jsx(xo,{direction:e,style:t,hiding:n,className:i,children:W.jsx(M1,{children:s})}),Pc=s=>(s==null?void 0:s.type)===re.PromotionType.INGAME_IAB11_LBAR||(s==null?void 0:s.type)===re.PromotionType.INGAME_IAB21_LBAR,U1=s=>(s==null?void 0:s.type)===re.PromotionType.INGAME_IAB11_SIDEBAR||(s==null?void 0:s.type)===re.PromotionType.INGAME_IAB21_SIDEBAR,B1=s=>(s==null?void 0:s.type)===re.PromotionType.INGAME_IAB11||(s==null?void 0:s.type)===re.PromotionType.INGAME_IAB21,F1=({advertisement:s,close:e,skipTypeCheck:t,skipAutoClose:i,layoutMode:n="side-by-side",sidebar:r,isNotification:a,banner:l,markAsViewed:h,open:f,externalAd:m,controlVideo:T,advertisementPaused:E,togglePause:C,isEventFired:P,fireEvent:v,muted:R})=>s.promotion?a&&s.notification?W.jsx(a0,{open:()=>f==null?void 0:f({fromNotification:!0}),notification:s.notification,promotionId:s.question.id,close:e}):!r&&!l&&(t||B1(s.promotion))?W.jsx(o0,{className:"PromoOverlayContainer",children:W.jsx(kc,{markAsViewed:h,promotionId:s.question.id,promotion:s.promotion,onClose:e,open:f,skipAutoClose:i,externalAd:m,controlVideo:T,advertisementPaused:E,togglePause:C,isEventFired:P,fireEvent:v,muted:R})}):r&&(t||Pc(s.promotion)||U1(s.promotion)||m)?W.jsx(N1,{className:"PromoSidebarContainer",direction:r,hiding:!1,children:W.jsx(kc,{markAsViewed:h,promotionId:s.question.id,promotion:s.promotion,externalAd:m,onClose:e,open:f,controlVideo:T,skipAutoClose:i,advertisementPaused:E,togglePause:C,isEventFired:P,fireEvent:v,muted:R})}):l&&Pc(s.promotion)?W.jsx(Rc,{promotionId:s.question.id,hiding:!1,promotion:s.promotion,direction:l,isEventFired:P,fireEvent:v}):null:null,Dc=Q.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),$1=s=>{const e=s.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",i=e.getAttribute("data-promo-type")||re.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&qt.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:i}}),e.getAttribute("data-a")==="banner"&&qt.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:i}})}},j1=({gamification:s,advertisement:e,layoutMode:t,skipAutoClose:i,skipTypeCheck:n,sidebar:r,banner:a,notification:l,isMobileScreen:h,persistent:f,containerId:m,externalAd:T,controlVideo:E,muted:C})=>{var P,v,R,L,N,U,F,D,V,X,G,ae,fe,ve,he,Z,de,ee,Xe,Qe,Ve;const qe=Te.useRef(null),be=Q.useStore(e.$store),me=Q.useStore(s.openedQuestion.$store);Zm.b(qe,{enabled:!!be.data,event:"click",listener:$1});const pt=((R=(v=(P=be.data)==null?void 0:P.question)==null?void 0:v.backgroundImage)==null?void 0:R.landscapeUrl)||((N=(L=be.data)==null?void 0:L.promotion)==null?void 0:N.backgroundImageLandscapeUrl),xt=((D=(F=(U=be.data)==null?void 0:U.question)==null?void 0:F.backgroundImage)==null?void 0:D.portraitUrl)||((X=(V=be.data)==null?void 0:V.promotion)==null?void 0:X.backgroundImagePortraitUrl),Ee=ig.y({containerId:m,landscapeUrl:pt,portraitUrl:xt});if(((G=me==null?void 0:me.attributes)==null?void 0:G.adUnit)===re.AdUnit.STANDART&&(ve=(fe=(ae=me==null?void 0:me.attributes)==null?void 0:ae.adPromotion)==null?void 0:fe.banner)!=null&&ve.imageUrl)return a?W.jsx(Dc,{ref:qe,style:{height:"100%"},className:Q.cx_default("SL-AdvertisementUIWrap",h&&"mobile-view"),children:W.jsx(gg,{cardId:me.id,promotion:{...(he=me==null?void 0:me.attributes)==null?void 0:he.adPromotion,adUnit:(Z=me==null?void 0:me.attributes)==null?void 0:Z.adUnit}})}):null;const ce=!a&&!r;if(be.data===void 0||!f&&be.isViewed)return null;const Ue=((Xe=(ee=(de=be==null?void 0:be.data)==null?void 0:de.notification)==null?void 0:ee.promotion)==null?void 0:Xe.mode)===re.NotificationPromotionMode.LOWER_THIRD;return W.jsxs(Dc,{ref:qe,style:{height:ce?"auto":"100%"},className:Q.cx_default("SL-AdvertisementUIWrap",h&&"mobile-view",Ue&&"SL-AdvertisementUIWrap--lower-third"),children:[!l&&Ee,W.jsx(F1,{skipTypeCheck:n,sidebar:r,banner:a,advertisement:be.data,advertisementPaused:!!be.isPaused,togglePause:be.togglePause,isEventFired:be.isEventFired,fireEvent:be.fireEvent,close:be.close,externalAd:T?be.externalAd:void 0,markAsViewed:(Qe=s.advertisement)==null?void 0:Qe.markAsViewed,open:(Ve=s.advertisement)==null?void 0:Ve.open,layoutMode:t,isNotification:l,skipAutoClose:i,controlVideo:E,muted:C})]})},Wf=({sdk:s,sidebar:e,externalAd:t,banner:i,skipAutoClose:n,skipTypeCheck:r,layoutMode:a,isMobileScreen:l,persistent:h,notification:f,muted:m})=>{const T=Q.useStore(s.featuresList.getStore()),[E,C]=Te.useState(!t),P=Q.useStore(s.options);if(Te.useEffect(()=>{if(t){const R=document.createElement("script");R.async=!0,R.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(R),R.onload=()=>{C(!0)}}},[t]),e&&i)return W.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(i&&t)return W.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!T)return null;const v=s.getFeature(re.SdkOverlayType.GAMES);return!(v!=null&&v.advertisement)||t&&!E?null:W.jsx(j1,{gamification:v,advertisement:v.advertisement,sidebar:e,banner:i,layoutMode:a,isMobileScreen:l,persistent:h,notification:f,skipTypeCheck:r,skipAutoClose:n,externalAd:t,controlVideo:s.controlVideoPlayer,containerId:P.containerId,muted:m})},V1=({event:s,sidebar:e,banner:t,isMobileScreen:i,skipAutoClose:n,persistent:r,theme:a,notification:l,skipTypeCheck:h,externalAd:f,muted:m=!1})=>{const T=Vt.B(),E=Vt.F(),C=Vt.z();return T?f&&!E.promotionExternalAd?s!==void 0&&W.jsx(Vt.j,{event:s}):!f&&E.promotionExternalAd?s!==void 0&&W.jsx(Vt.j,{event:s}):e&&!E.promotionSidebar?s!==void 0&&W.jsx(Vt.j,{event:s}):t&&!E.promotionBanner?s!==void 0&&W.jsx(Vt.j,{event:s}):l&&!E.promotionNotification?s!==void 0&&W.jsx(Vt.j,{event:s}):!t&&!e&&!l&&!E.promotionOverlay&&!h?s!==void 0&&W.jsx(Vt.j,{event:s}):W.jsxs("div",{className:"StreamLayerSDK",children:[W.jsx(Jm.h,{customTheme:a??C.theme,themeMode:C.themeMode,children:W.jsx(Wf,{sdk:T,sidebar:e,banner:t,isMobileScreen:i,persistent:r,notification:l,skipTypeCheck:h,skipAutoClose:n,layoutMode:"side-by-side",externalAd:f,muted:m})}),s!==void 0&&W.jsx(Vt.j,{event:s})]}):null};exports.StreamLayerSDKAdvertisement=V1;exports.StreamLayerSDKAdvertisementUI=Wf;
|
|
220
|
+
`.split("").map(i=>i.charCodeAt(0)));class HS extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class zS extends bl{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 et();const e=this.subtitlesTrack_.cues,t=e[0].startTime,r=e[e.length-1].startTime;return et([[t,r]])}initSegmentForMap(e,t=!1){if(!e)return null;const r=ba(e);let s=this.initSegments_[r];if(t&&!s&&e.bytes){const n=lh.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(lh,e.bytes.byteLength),this.initSegments_[r]=s={resolvedUri:e.resolvedUri,byterange:e.byterange,bytes:a}}return s||e}couldBeginLoading_(){return this.playlist_&&this.subtitlesTrack_&&!this.paused()}init_(){return this.state="READY",this.resetEverything(),this.monitorBuffer_()}track(e){return typeof e>"u"?this.subtitlesTrack_:(this.subtitlesTrack_=e,this.state==="INIT"&&this.couldBeginLoading_()&&this.init_(),this.subtitlesTrack_)}remove(e,t){Fs(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,r){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===oi.TIMEOUT&&this.handleTimeout_(),e.code===oi.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const s=this.pendingSegment_,n=r.mp4VttCues&&r.mp4VttCues.length;n&&(s.mp4VttCues=r.mp4VttCues),this.saveBandwidthRelatedStats_(s.duration,t.stats),t.key&&this.segmentKey(t.key,!0),this.state="APPENDING",this.trigger("appending");const a=s.segment;if(a.map&&(a.map.bytes=t.map.bytes),s.bytes=t.bytes,typeof k.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,r),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(s)}catch(l){this.stopForError({message:l.message,metadata:{errorType:F.Error.StreamingVttParserError,error:l}});return}if(n||this.updateTimeMapping_(s,this.syncController_.timelines[s.timeline],this.playlist_),s.cues.length?s.timingInfo={start:s.cues[0].startTime,end:s.cues[s.cues.length-1].endTime}:s.timingInfo={start:s.startOfSegment,end:s.startOfSegment+s.duration},s.isSyncRequest){this.trigger("syncinfoupdate"),this.pendingSegment_=null,this.state="READY";return}s.byteLength=s.bytes.byteLength,this.mediaSecondsLoaded+=a.duration,s.cues.forEach(l=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new k.VTTCue(l.startTime,l.endTime,l.text):l)}),wS(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const r=e&&e.type==="vtt",s=t&&t.type==="text";r&&s&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(r=>{const s=r.start+t,n=r.end+t,a=new k.VTTCue(s,n,r.cueText);r.settings&&r.settings.split(" ").forEach(l=>{const u=l.split(":"),f=u[0],p=u[1];a[f]=isNaN(p)?p:Number(p)}),e.cues.push(a)})}parseVTTCues_(e){let t,r=!1;if(typeof k.WebVTT!="function")throw new HS;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof k.TextDecoder=="function"?t=new k.TextDecoder("utf8"):(t=k.WebVTT.StringDecoder(),r=!0);const s=new k.WebVTT.Parser(k,k.vttjs,t);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=a=>{e.timestampmap=a},s.onparsingerror=a=>{F.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;r&&(a=oh(a)),s.parse(a)}let n=e.bytes;r&&(n=oh(n)),s.parse(n),s.flush()}updateTimeMapping_(e,t,r){const s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}const{MPEGTS:n,LOCAL:a}=e.timestampmap,u=n/tr.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(f=>{const p=f.endTime-f.startTime,T=this.handleRollover_(f.startTime+u,t.time);f.startTime=Math.max(T,0),f.endTime=Math.max(T+p,0)}),!r.syncInfo){const f=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;r.syncInfo={mediaSequence:r.mediaSequence+e.mediaIndex,time:Math.min(f,p-s.duration)}}}handleRollover_(e,t){if(t===null)return e;let r=e*tr.ONE_SECOND_IN_TS;const s=t*tr.ONE_SECOND_IN_TS;let n;for(s<r?n=-8589934592:n=8589934592;Math.abs(r-s)>4294967296;)r+=n;return r/tr.ONE_SECOND_IN_TS}}const WS=function(i,e){const t=i.cues;for(let r=0;r<t.length;r++){const s=t[r];if(e>=s.adStartTime&&e<=s.adEndTime)return s}return null},GS=function(i,e,t=0){if(!i.segments)return;let r=t,s;for(let n=0;n<i.segments.length;n++){const a=i.segments[n];if(s||(s=WS(e,r+a.duration/2)),s){if("cueIn"in a){s.endTime=r,s.adEndTime=r,r+=a.duration,s=null;continue}if(r<s.endTime){r+=a.duration;continue}s.endTime+=a.duration}else if("cueOut"in a&&(s=new k.VTTCue(r,r+a.duration,a.cueOut),s.adStartTime=r,s.adEndTime=r+parseFloat(a.cueOut),e.addCue(s)),"cueOutCont"in a){const[l,u]=a.cueOutCont.split("/").map(parseFloat);s=new k.VTTCue(r,r+a.duration,""),s.adStartTime=r-l,s.adEndTime=s.adStartTime+u,e.addCue(s)}r+=a.duration}};class uh{constructor({start:e,end:t,segmentIndex:r,partIndex:s=null,appended:n=!1}){this.start_=e,this.end_=t,this.segmentIndex_=r,this.partIndex_=s,this.appended_=n}isInRange(e){return e>=this.start&&e<this.end}markAppended(){this.appended_=!0}resetAppendedStatus(){this.appended_=!1}get isAppended(){return this.appended_}get start(){return this.start_}get end(){return this.end_}get segmentIndex(){return this.segmentIndex_}get partIndex(){return this.partIndex_}}class KS{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 eg{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:r,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(r,s),!!this.isReliable_)return this.updateStorage_(s,r,this.calculateBaseTime_(r,s,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:r}of this.storage_.values())if(r.length){for(const s of r)if(s.isInRange(e))return s}else if(t.isInRange(e))return t;return null}getSyncInfoForMediaSequence(e){return this.storage_.get(e)}updateStorage_(e,t,r){const s=new Map;let n=`
|
|
221
|
+
`,a=r,l=t;this.start_=a,e.forEach((u,f)=>{const p=this.storage_.get(l),T=a,b=T+u.duration,S=!!(p&&p.segmentSyncInfo&&p.segmentSyncInfo.isAppended),A=new uh({start:T,end:b,appended:S,segmentIndex:f});u.syncInfo=A;let v=a;const L=(u.parts||[]).map((P,M)=>{const O=v,U=v+P.duration,R=!!(p&&p.partsSyncInfo&&p.partsSyncInfo[M]&&p.partsSyncInfo[M].isAppended),q=new uh({start:O,end:U,appended:R,segmentIndex:f,partIndex:M});return v=U,n+=`Media Sequence: ${l}.${M} | Range: ${O} --> ${U} | Appended: ${R}
|
|
222
|
+
`,P.syncInfo=q,q});s.set(l,new KS(A,L)),n+=`${Ym(u.resolvedUri)} | Media Sequence: ${l} | Range: ${T} --> ${b} | Appended: ${S}
|
|
223
|
+
`,l++,a=b}),this.end_=a,this.storage_=s,this.diagnostics_=n}calculateBaseTime_(e,t,r){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const s=Math.min(...this.storage_.keys());if(e<s){const n=s-e;let a=this.storage_.get(s).segmentSyncInfo.start;for(let l=0;l<n;l++){const u=t[l];a-=u.duration}return a}return r}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class ch extends eg{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,r){if(!this.storage_.size){const s=this.parent_.getSyncInfoForMediaSequence(e);return s?s.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,r)}}const XS=86400,Wo=[{name:"VOD",run:(i,e,t,r,s)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(i,e,t,r,s,n)=>{const a=i.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const l=a.getSyncInfoForTime(s);return l?{time:l.start,partIndex:l.partIndex,segmentIndex:l.segmentIndex}:null}},{name:"ProgramDateTime",run:(i,e,t,r,s)=>{if(!Object.keys(i.timelineToDatetimeMappings).length)return null;let n=null,a=null;const l=hl(e);s=s||0;for(let u=0;u<l.length;u++){const f=e.endList||s===0?u:l.length-(u+1),p=l[f],T=p.segment,b=i.timelineToDatetimeMappings[T.timeline];if(!b||!T.dateTimeObject)continue;let A=T.dateTimeObject.getTime()/1e3+b;if(T.parts&&typeof p.partIndex=="number")for(let L=0;L<p.partIndex;L++)A+=T.parts[L].duration;const v=Math.abs(s-A);if(a!==null&&(v===0||a<v))break;a=v,n={time:A,segmentIndex:p.segmentIndex,partIndex:p.partIndex}}return n}},{name:"Segment",run:(i,e,t,r,s)=>{let n=null,a=null;s=s||0;const l=hl(e);for(let u=0;u<l.length;u++){const f=e.endList||s===0?u:l.length-(u+1),p=l[f],T=p.segment,b=p.part&&p.part.start||T&&T.start;if(T.timeline===r&&typeof b<"u"){const S=Math.abs(s-b);if(a!==null&&a<S)break;(!n||a===null||a>=S)&&(a=S,n={time:b,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return n}},{name:"Discontinuity",run:(i,e,t,r,s)=>{let n=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let l=0;l<e.discontinuityStarts.length;l++){const u=e.discontinuityStarts[l],f=e.discontinuitySequence+l+1,p=i.discontinuities[f];if(p){const T=Math.abs(s-p.time);if(a!==null&&a<T)break;(!n||a===null||a>=T)&&(a=T,n={time:p.time,segmentIndex:u,partIndex:null})}}}return n}},{name:"Playlist",run:(i,e,t,r,s)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class YS extends F.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new eg,r=new ch(t),s=new ch(t);this.mediaSequenceStorage_={main:t,audio:r,vtt:s},this.logger_=$t("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,r,s,n){if(t!==1/0)return Wo.find(({name:u})=>u==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,r,s,n);if(!a.length)return null;for(const l of a){const{syncPoint:u,strategy:f}=l,{segmentIndex:p,time:T}=u;if(p<0)continue;const b=e.segments[p],S=T,A=S+b.duration;if(this.logger_(`Strategy: ${f}. Current time: ${s}. selected segment: ${p}. Time: [${S} -> ${A}]}`),s>=S&&s<A)return this.logger_("Found sync point with exact match: ",u),u}return this.selectSyncPoint_(a,{key:"time",value:s})}getExpiredTime(e,t){if(!e||!e.segments)return null;const r=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!r.length)return null;const s=this.selectSyncPoint_(r,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+zs({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,r,s,n){const a=[];for(let l=0;l<Wo.length;l++){const u=Wo[l],f=u.run(this,e,t,r,s,n);f&&(f.strategy=u.name,a.push({strategy:u.name,syncPoint:f}))}return a}selectSyncPoint_(e,t){let r=e[0].syncPoint,s=Math.abs(e[0].syncPoint[t.key]-t.value),n=e[0].strategy;for(let a=1;a<e.length;a++){const l=Math.abs(e[a].syncPoint[t.key]-t.value);l<s&&(s=l,r=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${r.time}, segmentIndex:${r.segmentIndex}`+(typeof r.partIndex=="number"?`,partIndex:${r.partIndex}`:"")+"]"),r}saveExpiredSegmentInfo(e,t){const r=t.mediaSequence-e.mediaSequence;if(r>XS){F.log.warn(`Not saving expired segment info. Media sequence gap ${r} is too large.`);return}for(let s=r-1;s>=0;s--){const n=e.segments[s];if(n&&typeof n.start<"u"){t.syncInfo={mediaSequence:e.mediaSequence+s,time:n.start},this.logger_(`playlist refresh sync: [time:${t.syncInfo.time}, mediaSequence: ${t.syncInfo.mediaSequence}]`),this.trigger("syncinfoupdate");break}}}setDateTimeMappingForStart(e){if(this.timelineToDatetimeMappings={},e.segments&&e.segments.length&&e.segments[0].dateTimeObject){const t=e.segments[0],r=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-r}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const r=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;r&&(this.saveDiscontinuitySyncInfo_(e),e.playlist.syncInfo||(e.playlist.syncInfo={mediaSequence:e.playlist.mediaSequence+e.mediaIndex,time:s.start}));const n=s.dateTimeObject;s.discontinuity&&t&&n&&(this.timelineToDatetimeMappings[s.timeline]=-(n.getTime()/1e3))}timestampOffsetForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].time}mappingForTimeline(e){return typeof this.timelines[e]>"u"?null:this.timelines[e].mapping}calculateSegmentTimeMapping_(e,t,r){const s=e.segment,n=e.part;let a=this.timelines[e.timeline],l,u;if(typeof e.timestampOffset=="number")a={time:e.startOfSegment,mapping:e.startOfSegment-t.start},r&&(this.timelines[e.timeline]=a,this.trigger("timestampoffset"),this.logger_(`time mapping for timeline ${e.timeline}: [time: ${a.time}] [mapping: ${a.mapping}]`)),l=e.startOfSegment,u=t.end+a.mapping;else if(a)l=t.start+a.mapping,u=t.end+a.mapping;else return!1;return n&&(n.start=l,n.end=u),(!s.start||l<s.start)&&(s.start=l),s.end=u,!0}saveDiscontinuitySyncInfo_(e){const t=e.playlist,r=e.segment;if(r.discontinuity)this.discontinuities[r.timeline]={time:r.start,accuracy:0};else if(t.discontinuityStarts&&t.discontinuityStarts.length)for(let s=0;s<t.discontinuityStarts.length;s++){const n=t.discontinuityStarts[s],a=t.discontinuitySequence+s+1,l=n-e.mediaIndex,u=Math.abs(l);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let f;l<0?f=r.start-zs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):f=r.end+zs({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:f,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class QS extends F.EventTarget{constructor(){super(),this.pendingTimelineChanges_={},this.lastTimelineChanges_={}}clearPendingTimelineChange(e){this.pendingTimelineChanges_[e]=null,this.trigger("pendingtimelinechange")}pendingTimelineChange({type:e,from:t,to:r}){return typeof t=="number"&&typeof r=="number"&&(this.pendingTimelineChanges_[e]={type:e,from:t,to:r},this.trigger("pendingtimelinechange")),this.pendingTimelineChanges_[e]}lastTimelineChange({type:e,from:t,to:r}){if(typeof t=="number"&&typeof r=="number"){this.lastTimelineChanges_[e]={type:e,from:t,to:r},delete this.pendingTimelineChanges_[e];const s={timelineChangeInfo:{from:t,to:r}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const JS=Um(Fm(function(){var i=function(){function v(){this.listeners={}}var L=v.prototype;return L.on=function(M,O){this.listeners[M]||(this.listeners[M]=[]),this.listeners[M].push(O)},L.off=function(M,O){if(!this.listeners[M])return!1;var U=this.listeners[M].indexOf(O);return this.listeners[M]=this.listeners[M].slice(0),this.listeners[M].splice(U,1),U>-1},L.trigger=function(M){var O=this.listeners[M];if(O)if(arguments.length===2)for(var U=O.length,R=0;R<U;++R)O[R].call(this,arguments[1]);else for(var q=Array.prototype.slice.call(arguments,1),Y=O.length,K=0;K<Y;++K)O[K].apply(this,q)},L.dispose=function(){this.listeners={}},L.pipe=function(M){this.on("data",function(O){M.push(O)})},v}();/*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}/*! @name aes-decrypter @version 4.0.2 @license Apache-2.0 */const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],L=v[0],P=v[1],M=L[4],O=P[4];let U,R,q;const Y=[],K=[];let ie,me,le,ge,ee,ce;for(U=0;U<256;U++)K[(Y[U]=U<<1^(U>>7)*283)^U]=U;for(R=q=0;!M[R];R^=ie||1,q=K[q]||1)for(ge=q^q<<1^q<<2^q<<3^q<<4,ge=ge>>8^ge&255^99,M[R]=ge,O[ge]=R,le=Y[me=Y[ie=Y[R]]],ce=le*16843009^me*65537^ie*257^R*16843008,ee=Y[ge]*257^ge*16843008,U=0;U<4;U++)L[U][R]=ee=ee<<24^ee>>>8,P[U][ge]=ce=ce<<24^ce>>>8;for(U=0;U<5;U++)L[U]=L[U].slice(0),P[U]=P[U].slice(0);return v};let r=null;class s{constructor(L){r||(r=t()),this._tables=[[r[0][0].slice(),r[0][1].slice(),r[0][2].slice(),r[0][3].slice(),r[0][4].slice()],[r[1][0].slice(),r[1][1].slice(),r[1][2].slice(),r[1][3].slice(),r[1][4].slice()]];let P,M,O;const U=this._tables[0][4],R=this._tables[1],q=L.length;let Y=1;if(q!==4&&q!==6&&q!==8)throw new Error("Invalid aes key size");const K=L.slice(0),ie=[];for(this._key=[K,ie],P=q;P<4*q+28;P++)O=K[P-1],(P%q===0||q===8&&P%q===4)&&(O=U[O>>>24]<<24^U[O>>16&255]<<16^U[O>>8&255]<<8^U[O&255],P%q===0&&(O=O<<8^O>>>24^Y<<24,Y=Y<<1^(Y>>7)*283)),K[P]=K[P-q]^O;for(M=0;P;M++,P--)O=K[M&3?P:P-4],P<=4||M<4?ie[M]=O:ie[M]=R[0][U[O>>>24]]^R[1][U[O>>16&255]]^R[2][U[O>>8&255]]^R[3][U[O&255]]}decrypt(L,P,M,O,U,R){const q=this._key[1];let Y=L^q[0],K=O^q[1],ie=M^q[2],me=P^q[3],le,ge,ee;const ce=q.length/4-2;let te,de=4;const ve=this._tables[1],Ve=ve[0],Ye=ve[1],Ce=ve[2],_e=ve[3],St=ve[4];for(te=0;te<ce;te++)le=Ve[Y>>>24]^Ye[K>>16&255]^Ce[ie>>8&255]^_e[me&255]^q[de],ge=Ve[K>>>24]^Ye[ie>>16&255]^Ce[me>>8&255]^_e[Y&255]^q[de+1],ee=Ve[ie>>>24]^Ye[me>>16&255]^Ce[Y>>8&255]^_e[K&255]^q[de+2],me=Ve[me>>>24]^Ye[Y>>16&255]^Ce[K>>8&255]^_e[ie&255]^q[de+3],de+=4,Y=le,K=ge,ie=ee;for(te=0;te<4;te++)U[(3&-te)+R]=St[Y>>>24]<<24^St[K>>16&255]<<16^St[ie>>8&255]<<8^St[me&255]^q[de++],le=Y,Y=K,K=ie,ie=me,me=le}}class n extends i{constructor(){super(i),this.jobs=[],this.delay=1,this.timeout_=null}processJob_(){this.jobs.shift()(),this.jobs.length?this.timeout_=setTimeout(this.processJob_.bind(this),this.delay):this.timeout_=null}push(L){this.jobs.push(L),this.timeout_||(this.timeout_=setTimeout(this.processJob_.bind(this),this.delay))}}const a=function(v){return v<<24|(v&65280)<<8|(v&16711680)>>8|v>>>24},l=function(v,L,P){const M=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),O=new s(Array.prototype.slice.call(L)),U=new Uint8Array(v.byteLength),R=new Int32Array(U.buffer);let q,Y,K,ie,me,le,ge,ee,ce;for(q=P[0],Y=P[1],K=P[2],ie=P[3],ce=0;ce<M.length;ce+=4)me=a(M[ce]),le=a(M[ce+1]),ge=a(M[ce+2]),ee=a(M[ce+3]),O.decrypt(me,le,ge,ee,R,ce),R[ce]=a(R[ce]^q),R[ce+1]=a(R[ce+1]^Y),R[ce+2]=a(R[ce+2]^K),R[ce+3]=a(R[ce+3]^ie),q=me,Y=le,K=ge,ie=ee;return U};class u{constructor(L,P,M,O){const U=u.STEP,R=new Int32Array(L.buffer),q=new Uint8Array(L.byteLength);let Y=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(R.subarray(Y,Y+U),P,M,q)),Y=U;Y<R.length;Y+=U)M=new Uint32Array([a(R[Y-4]),a(R[Y-3]),a(R[Y-2]),a(R[Y-1])]),this.asyncStream_.push(this.decryptChunk_(R.subarray(Y,Y+U),P,M,q));this.asyncStream_.push(function(){O(null,e(q))})}static get STEP(){return 32e3}decryptChunk_(L,P,M,O){return function(){const U=l(L,P,M);O.set(U,L.byteOffset)}}}var f=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof oe.global<"u"?oe.global:typeof self<"u"?self:{},p;typeof window<"u"?p=window:typeof f<"u"?p=f:typeof self<"u"?p=self:p={};var T=p,b=function(L){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(L):L&&L.buffer instanceof ArrayBuffer},S=T.BigInt||Number;S("0x1"),S("0x100"),S("0x10000"),S("0x1000000"),S("0x100000000"),S("0x10000000000"),S("0x1000000000000"),S("0x100000000000000"),S("0x10000000000000000"),function(){var v=new Uint16Array([65484]),L=new Uint8Array(v.buffer,v.byteOffset,v.byteLength);return L[0]===255?"big":L[0]===204?"little":"unknown"}();const A=function(v){const L={};return Object.keys(v).forEach(P=>{const M=v[P];b(M)?L[P]={bytes:M.buffer,byteOffset:M.byteOffset,byteLength:M.byteLength}:L[P]=M}),L};self.onmessage=function(v){const L=v.data,P=new Uint8Array(L.encrypted.bytes,L.encrypted.byteOffset,L.encrypted.byteLength),M=new Uint32Array(L.key.bytes,L.key.byteOffset,L.key.byteLength/4),O=new Uint32Array(L.iv.bytes,L.iv.byteOffset,L.iv.byteLength/4);new u(P,M,O,function(U,R){self.postMessage(A({source:L.source,decrypted:R}),[R.buffer])})}}));var ZS=Mm(JS);const eE=i=>{let e=i.default?"main":"alternative";return i.characteristics&&i.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},tg=(i,e)=>{i.abort(),i.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Sl=(i,e)=>{e.activePlaylistLoader=i,i.load()},tE=(i,e)=>()=>{const{segmentLoaders:{[i]:t,main:r},mediaTypes:{[i]:s}}=e,n=s.activeTrack(),a=s.getActiveGroup(),l=s.activePlaylistLoader,u=s.lastGroup_;if(!(a&&u&&a.id===u.id)&&(s.lastGroup_=a,s.lastTrack_=n,tg(t,s),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){l&&r.resetEverything();return}t.resyncLoader(),Sl(a.playlistLoader,s)}},iE=(i,e)=>()=>{const{segmentLoaders:{[i]:t},mediaTypes:{[i]:r}}=e;r.lastGroup_=null,t.abort(),t.pause()},rE=(i,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[i]:r,main:s},mediaTypes:{[i]:n}}=e,a=n.activeTrack(),l=n.getActiveGroup(),u=n.activePlaylistLoader,f=n.lastTrack_;if(!(f&&a&&f.id===a.id)&&(n.lastGroup_=l,n.lastTrack_=a,tg(r,n),!!l)){if(l.isMainPlaylist){if(!a||!f||a.id===f.id)return;const p=e.vhs.playlistController_,T=p.selectPlaylist();if(p.media()===T)return;n.logger_(`track change. Switching main audio from ${f.id} to ${a.id}`),t.pause(),s.resetEverything(),p.fastQualityChange_(T);return}if(i==="AUDIO"){if(!l.playlistLoader){s.setAudio(!0),s.resetEverything();return}r.setAudio(!0),s.setAudio(!1)}if(u===l.playlistLoader){Sl(l.playlistLoader,n);return}r.track&&r.track(a),r.resetEverything(),Sl(l.playlistLoader,n)}},Ea={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:t},excludePlaylist:r}=e,s=t.activeTrack(),n=t.activeGroup(),a=(n.filter(u=>u.default)[0]||n[0]).id,l=t.tracks[a];if(s===l){r({error:{message:"Problem encountered loading the default audio track."}});return}F.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");for(const u in t.tracks)t.tracks[u].enabled=t.tracks[u]===l;t.onTrackChanged()},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:t}}=e;F.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const r=t.activeTrack();r&&(r.mode="disabled"),t.onTrackChanged()}},dh={AUDIO:(i,e,t)=>{if(!e)return;const{tech:r,requestOptions:s,segmentLoaders:{[i]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,s),(!r.paused()||a.endList&&r.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),r.paused()||n.load()}),e.on("error",Ea[i](i,t))},SUBTITLES:(i,e,t)=>{const{tech:r,requestOptions:s,segmentLoaders:{[i]:n},mediaTypes:{[i]:a}}=t;e.on("loadedmetadata",()=>{const l=e.media();n.playlist(l,s),n.track(a.activeTrack()),(!r.paused()||l.endList&&r.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),r.paused()||n.load()}),e.on("error",Ea[i](i,t))}},sE={AUDIO:(i,e)=>{const{vhs:t,sourceType:r,segmentLoaders:{[i]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[i]:{groups:l,tracks:u,logger_:f}},mainPlaylistLoader:p}=e,T=hn(p.main);(!a[i]||Object.keys(a[i]).length===0)&&(a[i]={main:{default:{default:!0}}},T&&(a[i].main.default.playlists=p.main.playlists));for(const b in a[i]){l[b]||(l[b]=[]);for(const S in a[i][b]){let A=a[i][b][S],v;if(T?(f(`AUDIO group '${b}' label '${S}' is a main playlist`),A.isMainPlaylist=!0,v=null):r==="vhs-json"&&A.playlists?v=new Ir(A.playlists[0],t,n):A.resolvedUri?v=new Ir(A.resolvedUri,t,n):A.playlists&&r==="dash"?v=new _l(A.playlists[0],t,n,p):v=null,A=Te({id:S,playlistLoader:v},A),dh[i](i,A.playlistLoader,e),l[b].push(A),typeof u[S]>"u"){const L=new F.AudioTrack({id:S,kind:eE(A),enabled:!1,language:A.language,default:A.default,label:S});u[S]=L}}}s.on("error",Ea[i](i,e))},SUBTITLES:(i,e)=>{const{tech:t,vhs:r,sourceType:s,segmentLoaders:{[i]:n},requestOptions:a,main:{mediaGroups:l},mediaTypes:{[i]:{groups:u,tracks:f}},mainPlaylistLoader:p}=e;for(const T in l[i]){u[T]||(u[T]=[]);for(const b in l[i][T]){if(!r.options_.useForcedSubtitles&&l[i][T][b].forced)continue;let S=l[i][T][b],A;if(s==="hls")A=new Ir(S.resolvedUri,r,a);else if(s==="dash"){if(!S.playlists.filter(L=>L.excludeUntil!==1/0).length)return;A=new _l(S.playlists[0],r,a,p)}else s==="vhs-json"&&(A=new Ir(S.playlists?S.playlists[0]:S.resolvedUri,r,a));if(S=Te({id:b,playlistLoader:A},S),dh[i](i,S.playlistLoader,e),u[T].push(S),typeof f[b]>"u"){const v=t.addRemoteTextTrack({id:b,kind:"subtitles",default:S.default&&S.autoselect,language:S.language,label:b},!1).track;f[b]=v}}}n.on("error",Ea[i](i,e))},"CLOSED-CAPTIONS":(i,e)=>{const{tech:t,main:{mediaGroups:r},mediaTypes:{[i]:{groups:s,tracks:n}}}=e;for(const a in r[i]){s[a]||(s[a]=[]);for(const l in r[i][a]){const u=r[i][a][l];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const f=t.options_.vhs&&t.options_.vhs.captionServices||{};let p={label:l,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(f[p.instreamId]&&(p=Te(p,f[p.instreamId])),p.default===void 0&&delete p.default,s[a].push(Te({id:l},u)),typeof n[l]>"u"){const T=t.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;n[l]=T}}}}},ig=(i,e)=>{for(let t=0;t<i.length;t++)if(Au(e,i[t])||i[t].playlists&&ig(i[t].playlists,e))return!0;return!1},nE=(i,e)=>t=>{const{mainPlaylistLoader:r,mediaTypes:{[i]:{groups:s}}}=e,n=r.media();if(!n)return null;let a=null;n.attributes[i]&&(a=s[n.attributes[i]]);const l=Object.keys(s);if(!a)if(i==="AUDIO"&&l.length>1&&hn(e.main))for(let u=0;u<l.length;u++){const f=s[l[u]];if(ig(f,n)){a=f;break}}else s.main?a=s.main:l.length===1&&(a=s[l[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},aE={AUDIO:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].enabled)return t[r];return null},SUBTITLES:(i,e)=>()=>{const{mediaTypes:{[i]:{tracks:t}}}=e;for(const r in t)if(t[r].mode==="showing"||t[r].mode==="hidden")return t[r];return null}},oE=(i,{mediaTypes:e})=>()=>{const t=e[i].activeTrack();return t?e[i].activeGroup(t):null},lE=i=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(f=>{sE[f](f,i)});const{mediaTypes:e,mainPlaylistLoader:t,tech:r,vhs:s,segmentLoaders:{["AUDIO"]:n,main:a}}=i;["AUDIO","SUBTITLES"].forEach(f=>{e[f].activeGroup=nE(f,i),e[f].activeTrack=aE[f](f,i),e[f].onGroupChanged=tE(f,i),e[f].onGroupChanging=iE(f,i),e[f].onTrackChanged=rE(f,i),e[f].getActiveGroup=oE(f,i)});const l=e.AUDIO.activeGroup();if(l){const f=(l.filter(T=>T.default)[0]||l[0]).id;e.AUDIO.tracks[f].enabled=!0,e.AUDIO.onGroupChanged(),e.AUDIO.onTrackChanged(),e.AUDIO.getActiveGroup().playlistLoader?(a.setAudio(!1),n.setAudio(!0)):a.setAudio(!0)}t.on("mediachange",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(f=>e[f].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),r.trigger({type:"usage",name:"vhs-audio-change"})};r.audioTracks().addEventListener("change",u),r.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{r.audioTracks().removeEventListener("change",u),r.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),r.clearTracks("audio");for(const f in e.AUDIO.tracks)r.audioTracks().addTrack(e.AUDIO.tracks[f])},uE=()=>{const i={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{i[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:_i,activeTrack:_i,getActiveGroup:_i,onGroupChanged:_i,onTrackChanged:_i,lastTrack_:null,logger_:$t(`MediaGroups[${e}]`)}}),i};class hh{constructor(){this.priority_=[],this.pathwayClones_=new Map}set version(e){e===1&&(this.version_=e)}set ttl(e){this.ttl_=e||300}set reloadUri(e){e&&(this.reloadUri_=_t(this.reloadUri_,e))}set priority(e){e&&e.length&&(this.priority_=e)}set pathwayClones(e){e&&e.length&&(this.pathwayClones_=new Map(e.map(t=>[t.ID,t])))}get version(){return this.version_}get ttl(){return this.ttl_}get reloadUri(){return this.reloadUri_}get priority(){return this.priority_}get pathwayClones(){return this.pathwayClones_}}class cE extends F.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new hh,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_=$t("Content Steering"),this.xhr_=e,this.getBandwidth_=t}assignTagProperties(e,t){this.manifestType_=t.serverUri?"HLS":"DASH";const r=t.serverUri||t.serverURL;if(!r){this.logger_(`steering manifest URL is ${r}, cannot request steering manifest.`),this.trigger("error");return}if(r.startsWith("data:")){this.decodeDataUriManifest_(r.substring(r.indexOf(",")+1));return}this.steeringManifest.reloadUri=_t(e,r),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 r=e?t:this.getRequestURI(t);if(!r){this.logger_("No valid content steering manifest URIs. Stopping content steering."),this.trigger("error"),this.dispose();return}const s={contentSteeringInfo:{uri:r}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:r,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${r} this session.`),this.excludedSteeringManifestURLs.add(r);return}if(a.status===429){const f=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${f} seconds.`),this.startTTLTimeout_(parseInt(f,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let l;try{l=JSON.parse(this.request_.responseText)}catch(f){const p={errorType:F.Error.StreamingContentSteeringParserError,error:f};this.trigger({type:"error",metadata:p})}this.assignSteeringProperties_(l);const u={contentSteeringInfo:s.contentSteeringInfo,contentSteeringManifest:{version:this.steeringManifest.version,reloadUri:this.steeringManifest.reloadUri,priority:this.steeringManifest.priority}};this.trigger({type:"contentsteeringparsed",metadata:u}),this.startTTLTimeout_()})}setProxyServerUrl_(e){const t=new k.URL(e),r=new k.URL(this.proxyServerUrl_);return r.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(r.toString())}decodeDataUriManifest_(e){const t=JSON.parse(k.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new k.URL(e),r=this.getPathway(),s=this.getBandwidth_();if(r){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,r)}if(s){const n=`_${this.manifestType_}_throughput`;t.searchParams.set(n,s)}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 r=(s=>{for(const n of s)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==r&&(this.currentPathway=r,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=s=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){const s=this.setProxyServerUrl_(e);if(!t(s))return s}const r=this.setSteeringParams_(e);return t(r)?null:r}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=k.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){k.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 hh}addAvailablePathway(e){e&&this.availablePathways_.add(e)}clearAvailablePathways(){this.availablePathways_.clear()}excludePathway(e){return this.availablePathways_.delete(e)}didDASHTagChange(e,t){return!t&&this.steeringManifest.reloadUri||t&&(_t(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const dE=(i,e)=>{let t=null;return(...r)=>{clearTimeout(t),t=setTimeout(()=>{i.apply(null,r)},e)}},hE=10;let Ui;const fE=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],pE=function(i){return this.audioSegmentLoader_[i]+this.mainSegmentLoader_[i]},mE=function({currentPlaylist:i,buffered:e,currentTime:t,nextPlaylist:r,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:l,log:u}){if(!r)return F.log.warn("We received no playlist to switch to. Please check your stream."),!1;const f=`allowing switch ${i&&i.id||"null"} -> ${r.id}`;if(!i)return u(`${f} as current playlist is not set`),!0;if(r.id===i.id)return!1;const p=!!Dr(e,t).length;if(!i.endList)return!p&&typeof i.partTargetDuration=="number"?(u(`not ${f} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${f} as current playlist is live`),!0);const T=Su(e,t),b=l?Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:Je.MAX_BUFFER_LOW_WATER_LINE;if(a<b)return u(`${f} as duration < max low water line (${a} < ${b})`),!0;const S=r.attributes.BANDWIDTH,A=i.attributes.BANDWIDTH;if(S<A&&(!l||T<n)){let v=`${f} as next bandwidth < current bandwidth (${S} < ${A})`;return l&&(v+=` and forwardBuffer < bufferHighWaterLine (${T} < ${n})`),u(v),!0}if((!l||S>A)&&T>=s){let v=`${f} as forwardBuffer >= bufferLowWaterLine (${T} >= ${s})`;return l&&(v+=` and next bandwidth > current bandwidth (${S} > ${A})`),u(v),!0}return u(`not ${f} as no switching criteria met`),!1};class gE extends F.EventTarget{constructor(e){super(),this.fastQualityChange_=dE(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:r,tech:s,bandwidth:n,externVhs:a,useCueTags:l,playlistExclusionDuration:u,enableLowInitialPlaylist:f,sourceType:p,cacheEncryptionKeys:T,bufferBasedABR:b,leastPixelDiffSelector:S,captionServices:A,experimentalUseMMS:v}=e;if(!t)throw new Error("A non-empty playlist URL or JSON manifest string is required");let{maxPlaylistRetries:L}=e;(L===null||typeof L>"u")&&(L=1/0),Ui=a,this.bufferBasedABR=!!b,this.leastPixelDiffSelector=!!S,this.withCredentials=r,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=p,this.useCueTags_=l,this.playlistExclusionDuration=u,this.maxPlaylistRetries=L,this.enableLowInitialPlaylist=f,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:r,maxPlaylistRetries:L,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=uE(),v&&k.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new k.ManagedMediaSource,this.usingManagedMediaSource_=!0,F.log("Using ManagedMediaSource")):k.MediaSource&&(this.mediaSource=new k.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_=et(),this.hasPlayed_=!1,this.syncController_=new YS(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new ZS,this.sourceUpdater_=new Zm(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new QS,this.keyStatusMap_=new Map;const P={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:A,mediaSource:this.mediaSource,currentTime:this.tech_.currentTime.bind(this.tech_),seekable:()=>this.seekable(),seeking:()=>this.tech_.seeking(),duration:()=>this.duration(),hasPlayed:()=>this.hasPlayed_,goalBufferLength:()=>this.goalBufferLength(),bandwidth:n,syncController:this.syncController_,decrypter:this.decrypter_,sourceType:this.sourceType_,inbandTextTracks:this.inbandTextTracks_,cacheEncryptionKeys:T,sourceUpdater:this.sourceUpdater_,timelineChangeController:this.timelineChangeController_,exactManifestTimings:e.exactManifestTimings,addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)};this.mainPlaylistLoader_=this.sourceType_==="dash"?new _l(t,this.vhs_,Te(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new Ir(t,this.vhs_,Te(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new bl(Te(P,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new bl(Te(P,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new zS(Te(P,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((U,R)=>{function q(){s.off("vttjserror",Y),U()}function Y(){s.off("vttjsloaded",q),R()}s.one("vttjsloaded",q),s.one("vttjserror",Y),s.addWebVttScript_()})}),e);const M=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new cE(this.vhs_.xhr,M),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),fE.forEach(U=>{this[U+"_"]=pE.bind(this,U)}),this.logger_=$t("pc"),this.triggeredFmp4Usage=!1,this.tech_.preload()==="none"?(this.loadOnPlay_=()=>{this.loadOnPlay_=null,this.mainPlaylistLoader_.load()},this.tech_.one("play",this.loadOnPlay_)):this.mainPlaylistLoader_.load(),this.timeToLoadedData__=-1,this.mainAppendsToLoadedData__=-1,this.audioAppendsToLoadedData__=-1;const O=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(O,()=>{const U=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-U,this.mainAppendsToLoadedData__=this.mainSegmentLoader_.mediaAppends,this.audioAppendsToLoadedData__=this.audioSegmentLoader_.mediaAppends})})}mainAppendsToLoadedData_(){return this.mainAppendsToLoadedData__}audioAppendsToLoadedData_(){return this.audioAppendsToLoadedData__}appendsToLoadedData_(){const e=this.mainAppendsToLoadedData_(),t=this.audioAppendsToLoadedData_();return e===-1||t===-1?-1:e+t}timeToLoadedData_(){return this.timeToLoadedData__}checkABR_(e="abr"){const t=this.selectPlaylist();t&&this.shouldSwitchToMedia_(t)&&this.switchMedia_(t,e)}switchMedia_(e,t,r){const s=this.media(),n=s&&(s.id||s.uri),a=e&&(e.id||e.uri);if(n&&n!==a){this.logger_(`switch media ${n} -> ${a} from ${t}`);const l={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:l}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,r)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],r=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(r&&s){const a=(r.length?r[0].playlists:r.playlists).filter(l=>l.attributes.serviceLocation===s);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=k.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(k.clearInterval(this.abrTimer_),this.abrTimer_=null)}getAudioTrackPlaylists_(){const e=this.main(),t=e&&e.playlists||[];if(!e||!e.mediaGroups||!e.mediaGroups.AUDIO)return t;const r=e.mediaGroups.AUDIO,s=Object.keys(r);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const l=r.main||s.length&&r[s[0]];for(const u in l)if(l[u].default){n={label:u};break}}if(!n)return t;const a=[];for(const l in r)if(r[l][n.label]){const u=r[l][n.label];if(u.playlists&&u.playlists.length)a.push.apply(a,u.playlists);else if(u.uri)a.push(u);else if(e.playlists.length)for(let f=0;f<e.playlists.length;f++){const p=e.playlists[f];p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===l&&a.push(p)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),r=t.targetDuration*1.5*1e3;fl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,t.endList&&this.tech_.preload()!=="none"&&(this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.mainSegmentLoader_.load()),lE({sourceType:this.sourceType_,segmentLoaders:{AUDIO:this.audioSegmentLoader_,SUBTITLES:this.subtitleSegmentLoader_,main:this.mainSegmentLoader_},tech:this.tech_,requestOptions:this.requestOptions_,mainPlaylistLoader:this.mainPlaylistLoader_,vhs:this.vhs_,main:this.main(),mediaTypes:this.mediaTypes_,excludePlaylist:this.excludePlaylist.bind(this)}),this.triggerPresenceUsage_(this.main(),t),this.setupFirstPlay(),!this.mediaTypes_.AUDIO.activePlaylistLoader||this.mediaTypes_.AUDIO.activePlaylistLoader.media()?this.trigger("selectedinitialmedia"):this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata",()=>{this.trigger("selectedinitialmedia")})}),this.mainPlaylistLoader_.on("loadedplaylist",()=>{this.loadOnPlay_&&this.tech_.off("play",this.loadOnPlay_);let t=this.mainPlaylistLoader_.media();if(!t){this.attachContentSteeringListeners_(),this.initContentSteeringController_(),this.excludeUnsupportedVariants_();let r;if(this.enableLowInitialPlaylist&&(r=this.selectInitialPlaylist()),r||(r=this.selectPlaylist()),!r||!this.shouldSwitchToMedia_(r)||(this.initialMedia_=r,this.switchMedia_(this.initialMedia_,"initial"),!(this.sourceType_==="vhs-json"&&this.initialMedia_.segments)))return;t=this.initialMedia_}this.handleUpdatedMediaPlaylist(t)}),this.mainPlaylistLoader_.on("error",()=>{const t=this.mainPlaylistLoader_.error;this.excludePlaylist({playlistToExclude:t.playlist,error:t})}),this.mainPlaylistLoader_.on("mediachanging",()=>{this.mainSegmentLoader_.abort(),this.mainSegmentLoader_.pause()}),this.mainPlaylistLoader_.on("mediachange",()=>{const t=this.mainPlaylistLoader_.media(),r=t.targetDuration*1.5*1e3;fl(this.mainPlaylistLoader_.main,this.mainPlaylistLoader_.media())?this.requestOptions_.timeout=0:this.requestOptions_.timeout=r,this.sourceType_==="dash"&&this.mainPlaylistLoader_.isPaused&&this.mainPlaylistLoader_.load(),this.mainSegmentLoader_.pause(),this.mainSegmentLoader_.playlist(t,this.requestOptions_),this.waitingForFastQualityPlaylistReceived_?this.runFastQualitySwitch_():this.mainSegmentLoader_.load(),this.tech_.trigger({type:"mediachange",bubbles:!0})}),this.mainPlaylistLoader_.on("playlistunchanged",()=>{const t=this.mainPlaylistLoader_.media();if(t.lastExcludeReason_==="playlist-unchanged")return;this.stuckAtPlaylistEnd_(t)&&(this.excludePlaylist({error:{message:"Playlist no longer updating.",reason:"playlist-unchanged"}}),this.tech_.trigger("playliststuck"))}),this.mainPlaylistLoader_.on("renditiondisabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-disabled"})}),this.mainPlaylistLoader_.on("renditionenabled",()=>{this.tech_.trigger({type:"usage",name:"vhs-rendition-enabled"})}),["manifestrequeststart","manifestrequestcomplete","manifestparsestart","manifestparsecomplete","playlistrequeststart","playlistrequestcomplete","playlistparsestart","playlistparsecomplete","renditiondisabled","renditionenabled"].forEach(t=>{this.mainPlaylistLoader_.on(t,r=>{this.player_.trigger(Ke({},r))})})}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 r=e.mediaGroups||{};let s=!0;const n=Object.keys(r.AUDIO);for(const a in r.AUDIO)for(const l in r.AUDIO[a])r.AUDIO[a][l].uri||(s=!1);s&&this.tech_.trigger({type:"usage",name:"vhs-demuxed"}),Object.keys(r.SUBTITLES).length&&this.tech_.trigger({type:"usage",name:"vhs-webvtt"}),Ui.Playlist.isAes(t)&&this.tech_.trigger({type:"usage",name:"vhs-aes"}),n.length&&Object.keys(r.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,r=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return mE({buffered:a,currentTime:r,currentPlaylist:t,nextPlaylist:e,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:this.duration(),bufferBasedABR:this.bufferBasedABR,log:this.logger_})}setupSegmentLoaderListeners_(){this.mainSegmentLoader_.on("bandwidthupdate",()=>{this.checkABR_("bandwidthupdate"),this.tech_.trigger("bandwidthupdate")}),this.mainSegmentLoader_.on("timeout",()=>{this.bufferBasedABR&&this.mainSegmentLoader_.load()}),this.bufferBasedABR||this.mainSegmentLoader_.on("progress",()=>{this.trigger("progress")}),this.mainSegmentLoader_.on("error",()=>{const r=this.mainSegmentLoader_.error();this.excludePlaylist({playlistToExclude:r.playlist,error:r})}),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 r=this.audioSegmentLoader_.pendingSegment_;if(!r||!r.segment||!r.segment.syncInfo)return;const s=r.segment.syncInfo.end+.01;this.tech_.setCurrentTime(s)}),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",r=>{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:hE}))});const e=()=>{if(!this.sourceUpdater_.hasCreatedSourceBuffers())return this.tryToCreateSourceBuffers_();const r=this.getCodecsOrExclude_();r&&this.sourceUpdater_.addOrChangeSourceBuffers(r)};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(r=>{this.mainSegmentLoader_.on(r,s=>{this.player_.trigger(Ke({},s))}),this.audioSegmentLoader_.on(r,s=>{this.player_.trigger(Ke({},s))}),this.subtitleSegmentLoader_.on(r,s=>{this.player_.trigger(Ke({},s))})})}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 r=t.end(0);let s=r;if(e.start){const n=e.start.timeOffset;n<0?s=Math.max(r+n,t.start(0)):s=Math.min(r,n)}this.trigger("firstplay"),this.tech_.setCurrentTime(s)}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 r=this.syncController_.getExpiredTime(e,this.duration());if(r===null)return!1;const s=Ui.Playlist.playlistEnd(e,r),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return s-n<=ai;const l=a.end(a.length-1);return l-n<=ai&&s-l<=ai}excludePlaylist({playlistToExclude:e=this.mainPlaylistLoader_.media(),error:t={},playlistExclusionDuration:r}){if(e=e||this.mainPlaylistLoader_.media(),r=r||t.playlistExclusionDuration||this.playlistExclusionDuration,!e){this.error=t,this.mediaSource.readyState!=="open"?this.trigger("error"):this.sourceUpdater_.endOfStream("network");return}e.playlistErrors_++;const s=this.mainPlaylistLoader_.main.playlists,n=s.filter(eo),a=n.length===1&&n[0]===e;if(s.length===1&&r!==1/0)return F.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 A=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(A),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(A)},v);return}let S=!1;s.forEach(A=>{if(A===e)return;const v=A.excludeUntil;typeof v<"u"&&v!==1/0&&(S=!0,delete A.excludeUntil)}),S&&(F.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let l;e.playlistErrors_>this.maxPlaylistRetries?l=1/0:l=Date.now()+r*1e3,e.excludeUntil=l,t.reason&&(e.lastExcludeReason_=t.reason),this.tech_.trigger("excludeplaylist"),this.tech_.trigger({type:"usage",name:"vhs-rendition-excluded"});const u=this.selectPlaylist();if(!u){this.error="Playback cannot continue. No available working or supported playlists.",this.trigger("error");return}const f=t.internal?this.logger_:F.log.warn,p=t.message?" "+t.message:"";f(`${t.internal?"Internal problem":"Problem"} encountered with playlist ${e.id}.${p} Switching to playlist ${u.id}.`),u.attributes.AUDIO!==e.attributes.AUDIO&&this.delegateLoaders_("audio",["abort","pause"]),u.attributes.SUBTITLES!==e.attributes.SUBTITLES&&this.delegateLoaders_("subtitle",["abort","pause"]),this.delegateLoaders_("main",["abort","pause"]);const T=u.targetDuration/2*1e3||5*1e3,b=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=T;return this.switchMedia_(u,"exclude",a||b)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const r=[],s=e==="all";(s||e==="main")&&r.push(this.mainPlaylistLoader_);const n=[];(s||e==="audio")&&n.push("AUDIO"),(s||e==="subtitle")&&(n.push("CLOSED-CAPTIONS"),n.push("SUBTITLES")),n.forEach(a=>{const l=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;l&&r.push(l)}),["main","audio","subtitle"].forEach(a=>{const l=this[`${a}SegmentLoader_`];l&&(e===a||e==="all")&&r.push(l)}),r.forEach(a=>t.forEach(l=>{typeof a[l]=="function"&&a[l]()}))}setCurrentTime(e){const t=Dr(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:Ui.Playlist.duration(e):1/0:0}seekable(){return this.seekable_}getSeekableRange_(e,t){const r=e.media();if(!r)return null;const s=this.syncController_.getMediaSequenceSync(t);if(s&&s.isReliable){const l=s.start,u=s.end;if(!isFinite(l)||!isFinite(u))return null;const f=Ui.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r),p=Math.max(0,u-f);return p<l?null:et([[l,p]])}const n=this.syncController_.getExpiredTime(r,this.duration());if(n===null)return null;const a=Ui.Playlist.seekable(r,n,Ui.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,r));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const r=e.start(0),s=e.end(0),n=t.start(0),a=t.end(0);return n>s||r>a?e:et([[Math.max(r,n),Math.min(s,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 r=this.seekable_;if(this.seekable_=this.computeFinalSeekable_(e,t),!this.seekable_||r&&r.length&&this.seekable_.length&&r.start(0)===this.seekable_.start(0)&&r.end(0)===this.seekable_.end(0))return;this.logger_(`seekable updated [${fm(this.seekable_)}]`);const s={seekableRanges:this.seekable_};this.trigger({type:"seekablerangeschanged",metadata:s}),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 s=this.seekable();if(!s.length)return;(isNaN(this.mediaSource.duration)||this.mediaSource.duration<s.end(s.length-1))&&this.sourceUpdater_.setDuration(s.end(s.length-1));return}const t=this.tech_.buffered();let r=Ui.Playlist.duration(this.mainPlaylistLoader_.media());t.length>0&&(r=Math.max(r,t.end(t.length-1))),this.mediaSource.duration!==r&&this.sourceUpdater_.setDuration(r)}dispose(){this.trigger("dispose"),this.decrypter_.terminate(),this.mainPlaylistLoader_.dispose(),this.mainSegmentLoader_.dispose(),this.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 r in t)t[r].forEach(s=>{s.playlistLoader&&s.playlistLoader.dispose()})}),this.audioSegmentLoader_.dispose(),this.subtitleSegmentLoader_.dispose(),this.sourceUpdater_.dispose(),this.timelineChangeController_.dispose(),this.stopABRTimer_(),this.updateDuration_&&this.mediaSource.removeEventListener("sourceopen",this.updateDuration_),this.mediaSource.removeEventListener("durationchange",this.handleDurationChange_),this.mediaSource.removeEventListener("sourceopen",this.handleSourceOpen_),this.mediaSource.removeEventListener("sourceended",this.handleSourceEnded_),this.off()}main(){return this.mainPlaylistLoader_.main}media(){return this.mainPlaylistLoader_.media()||this.initialMedia_}areMediaTypesKnown_(){const e=!!this.mediaTypes_.AUDIO.activePlaylistLoader,t=!!this.mainSegmentLoader_.getCurrentMediaInfo_(),r=e?!!this.audioSegmentLoader_.getCurrentMediaInfo_():!0;return!(!t||!r)}getCodecsOrExclude_(){const e={main:this.mainSegmentLoader_.getCurrentMediaInfo_()||{},audio:this.audioSegmentLoader_.getCurrentMediaInfo_()||{}},t=this.mainSegmentLoader_.getPendingSegmentPlaylist()||this.media();e.video=e.main;const r=Ws(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=r.video||e.main.videoCodec||Lv),e.main.isMuxed&&(s.video+=`,${r.audio||e.main.audioCodec||Gc}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=r.audio||e.main.audioCodec||e.audio.audioCodec||Gc,e.audio.isFmp4=e.main.hasAudio&&!e.main.isMuxed?e.main.isFmp4:e.audio.isFmp4),!s.audio&&!s.video){this.excludePlaylist({playlistToExclude:t,error:{message:"Could not determine codecs for playlist."},playlistExclusionDuration:1/0});return}const a=(f,p)=>f?js(p,this.usingManagedMediaSource_):Io(p),l={};let u;if(["video","audio"].forEach(function(f){if(s.hasOwnProperty(f)&&!a(e[f].isFmp4,s[f])){const p=e[f].isFmp4?"browser":"muxer";l[p]=l[p]||[],l[p].push(s[f]),f==="audio"&&(u=p)}}),n&&u&&t.attributes.AUDIO){const f=t.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===f&&p!==t&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${f} as ${u} does not support codec(s): "${s.audio}"`)}if(Object.keys(l).length){const f=Object.keys(l).reduce((p,T)=>(p&&(p+=", "),p+=`${T} does not support codec(s): "${l[T].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:f},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const f=[];if(["video","audio"].forEach(p=>{const T=(ti(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,b=(ti(s[p]||"")[0]||{}).type;T&&b&&T.toLowerCase()!==b.toLowerCase()&&f.push(`"${this.sourceUpdater_.codecs[p]}" -> "${s[p]}"`)}),f.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${f.join(", ")}.`,internal:!0},playlistExclusionDuration:1/0});return}}return s}tryToCreateSourceBuffers_(){if(this.mediaSource.readyState!=="open"||this.sourceUpdater_.hasCreatedSourceBuffers()||!this.areMediaTypesKnown_())return;const e=this.getCodecsOrExclude_();if(!e)return;this.sourceUpdater_.createSourceBuffers(e);const t=[e.video,e.audio].filter(Boolean).join(",");this.excludeIncompatibleVariants_(t)}excludeUnsupportedVariants_(){const e=this.main().playlists,t=[];Object.keys(e).forEach(r=>{const s=e[r];if(t.indexOf(s.id)!==-1)return;t.push(s.id);const n=Ws(this.main,s),a=[];n.audio&&!Io(n.audio)&&!js(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Io(n.video)&&!js(n.video,this.usingManagedMediaSource_)&&a.push(`video codec ${n.video}`),n.text&&n.text==="stpp.ttml.im1t"&&a.push(`text codec ${n.text}`),a.length&&(s.excludeUntil=1/0,this.logger_(`excluding ${s.id} for unsupported: ${a.join(", ")}`))})}excludeIncompatibleVariants_(e){const t=[],r=this.main().playlists,s=xa(ti(e)),n=Zd(s),a=s.video&&ti(s.video)[0]||null,l=s.audio&&ti(s.audio)[0]||null;Object.keys(r).forEach(u=>{const f=r[u];if(t.indexOf(f.id)!==-1||f.excludeUntil===1/0)return;t.push(f.id);const p=[],T=Ws(this.mainPlaylistLoader_.main,f),b=Zd(T);if(!(!T.audio&&!T.video)){if(b!==n&&p.push(`codec count "${b}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const S=T.video&&ti(T.video)[0]||null,A=T.audio&&ti(T.audio)[0]||null;S&&a&&S.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${S.type}" !== "${a.type}"`),A&&l&&A.type.toLowerCase()!==l.type.toLowerCase()&&p.push(`audio codec "${A.type}" !== "${l.type}"`)}p.length&&(f.excludeUntil=1/0,this.logger_(`excluding ${f.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let t=0;const r=this.seekable();r.length&&(t=r.start(0)),GS(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=Je.GOAL_BUFFER_LENGTH,r=Je.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,Je.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*r,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=Je.BUFFER_LOW_WATER_LINE,r=Je.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,Je.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,Je.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*r,this.bufferBasedABR?n:s)}bufferHighWaterLine(){return Je.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){ih(this.inbandTextTracks_,"com.apple.streaming",this.tech_),AS({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,r){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();ih(this.inbandTextTracks_,e,this.tech_),SS({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,videoDuration:r})}pathwayAttribute_(e){return e.attributes["PATHWAY-ID"]||e.attributes.serviceLocation}initContentSteeringController_(){const e=this.main();if(e.contentSteering){for(const t of e.playlists)this.contentSteeringController_.addAvailablePathway(this.pathwayAttribute_(t));if(this.contentSteeringController_.assignTagProperties(e.uri,e.contentSteering),this.contentSteeringController_.queryBeforeStart){this.contentSteeringController_.requestSteeringManifest(!0);return}this.tech_.one("canplay",()=>{this.contentSteeringController_.requestSteeringManifest()})}}resetContentSteeringController_(){this.contentSteeringController_.clearAvailablePathways(),this.contentSteeringController_.dispose(),this.initContentSteeringController_()}attachContentSteeringListeners_(){this.contentSteeringController_.on("content-steering",this.excludeThenChangePathway_.bind(this)),["contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"].forEach(t=>{this.contentSteeringController_.on(t,r=>{this.trigger(Ke({},r))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const l of t.playlists){const u=l.attributes.serviceLocation;if(u&&(a.push(u),!n.has(u)))return!0}return!!(!a.length&&n.size)})())&&this.resetContentSteeringController_()})}excludeThenChangePathway_(){const e=this.contentSteeringController_.getPathway();if(!e)return;this.handlePathwayClones_();const r=this.main().playlists,s=new Set;let n=!1;Object.keys(r).forEach(a=>{const l=r[a],u=this.pathwayAttribute_(l),f=u&&e!==u;l.excludeUntil===1/0&&l.lastExcludeReason_==="content-steering"&&!f&&(delete l.excludeUntil,delete l.lastExcludeReason_,n=!0);const T=!l.excludeUntil&&l.excludeUntil!==1/0;!s.has(l.id)&&f&&T&&(s.add(l.id),l.excludeUntil=1/0,l.lastExcludeReason_="content-steering",this.logger_(`excluding ${l.id} for ${l.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const l=this.mediaTypes_[a];if(l.activePlaylistLoader){const u=l.activePlaylistLoader.media_;u&&u.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,r=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(r&&r.size||s&&s.size){for(const[a,l]of r.entries())s.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(l),this.contentSteeringController_.excludePathway(a));for(const[a,l]of s.entries()){const u=r.get(a);if(!u){t.filter(p=>p.attributes["PATHWAY-ID"]===l["BASE-ID"]).forEach(p=>{this.mainPlaylistLoader_.addClonePathway(l,p)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(u,l)||(this.mainPlaylistLoader_.updateOrDeleteClone(l,!0),this.contentSteeringController_.addAvailablePathway(a))}this.contentSteeringController_.currentPathwayClones=new Map(JSON.parse(JSON.stringify([...s])))}}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 r=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const n in r)if(r[n]!==s[n])return!1;for(const n in s)if(r[n]!==s[n])return!1;return!0}changeSegmentPathway_(){const e=this.selectPlaylist();this.pauseLoading(),this.contentSteeringController_.manifestType_==="DASH"&&this.switchMediaForDASHContentSteering_(),this.switchMedia_(e,"content-steering")}excludeNonUsablePlaylistsByKeyId_(){if(!this.mainPlaylistLoader_||!this.mainPlaylistLoader_.main)return;let e=0;const t="non-usable";this.mainPlaylistLoader_.main.playlists.forEach(r=>{const s=this.mainPlaylistLoader_.getKeyIdSet(r);!s||!s.size||s.forEach(n=>{const a="usable",l=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,u=r.lastExcludeReason_===t&&r.excludeUntil===1/0;l?l&&u&&(delete r.excludeUntil,delete r.lastExcludeReason_,this.logger_(`enabling playlist ${r.id} because key ID ${n} is ${a}`)):(r.excludeUntil!==1/0&&r.lastExcludeReason_!==t&&(r.excludeUntil=1/0,r.lastExcludeReason_=t,this.logger_(`excluding playlist ${r.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(r=>{const s=r&&r.attributes&&r.attributes.RESOLUTION&&r.attributes.RESOLUTION.height<720,n=r.excludeUntil===1/0&&r.lastExcludeReason_===t;s&&n&&(delete r.excludeUntil,F.log.warn(`enabling non-HD playlist ${r.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:qS(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 yE=(i,e,t)=>r=>{const s=i.main.playlists[e],n=Cu(s),a=eo(s);if(typeof r>"u")return a;r?delete s.disabled:s.disabled=!0;const l={renditionInfo:{id:e,bandwidth:s.attributes.BANDWIDTH,resolution:s.attributes.RESOLUTION,codecs:s.attributes.CODECS},cause:"fast-quality"};return r!==a&&!n&&(r?(t(s),i.trigger({type:"renditionenabled",metadata:l})):i.trigger({type:"renditiondisabled",metadata:l})),r};class _E{constructor(e,t,r){const{playlistController_:s}=e,n=s.fastQualityChange_.bind(s);if(t.attributes){const a=t.attributes.RESOLUTION;this.width=a&&a.width,this.height=a&&a.height,this.bandwidth=t.attributes.BANDWIDTH,this.frameRate=t.attributes["FRAME-RATE"]}this.codecs=Ws(s.main(),t),this.playlist=t,this.id=r,this.enabled=yE(e.playlists,t.id,n)}}const TE=function(i){i.representations=()=>{const e=i.playlistController_.main(),t=hn(e)?i.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(r=>!Cu(r)).map((r,s)=>new _E(i,r,r.id)):[]}},fh=["seeking","seeked","pause","playing","error"];class vE extends F.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_=$t("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),r=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,l=["main","subtitle","audio"],u={};l.forEach(p=>{u[p]={reset:()=>this.resetSegmentDownloads_(p),updateend:()=>this.checkSegmentDownloads_(p)},a[`${p}SegmentLoader_`].on("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].on("playlistupdate",u[p].reset),this.tech_.on(["seeked","seeking"],u[p].reset)});const f=p=>{["main","audio"].forEach(T=>{a[`${T}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),f("off"))},this.clearSeekingAppendCheck_=()=>f("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),f("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(fh,n),this.tech_.on("canplay",r),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(fh,n),this.tech_.off("canplay",r),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),l.forEach(p=>{a[`${p}SegmentLoader_`].off("appendsdone",u[p].updateend),a[`${p}SegmentLoader_`].off("playlistupdate",u[p].reset),this.tech_.off(["seeked","seeking"],u[p].reset)}),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&k.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=k.setTimeout(this.monitorCurrentTime_.bind(this),250)}resetSegmentDownloads_(e){const t=this.playlistController_[`${e}SegmentLoader_`];this[`${e}StalledDownloads_`]>0&&this.logger_(`resetting possible stalled download count for ${e} loader`),this[`${e}StalledDownloads_`]=0,this[`${e}Buffered_`]=t.buffered_()}checkSegmentDownloads_(e){const t=this.playlistController_,r=t[`${e}SegmentLoader_`],s=r.buffered_(),n=sx(this[`${e}Buffered_`],s);if(this[`${e}Buffered_`]=s,n){const a={bufferedRanges:s};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:r.playlist_&&r.playlist_.id,buffered:ir(s)}),!(this[`${e}StalledDownloads_`]<10)&&(this.logger_(`${e} loader stalled download exclusion`),this.resetSegmentDownloads_(e),this.tech_.trigger({type:"usage",name:`vhs-${e}-download-exclusion`}),e!=="subtitle"&&t.excludePlaylist({error:{message:`Excessive ${e} segment downloading detected.`},playlistExclusionDuration:1/0}))}checkCurrentTime_(){if(this.tech_.paused()||this.tech_.seeking())return;const e=this.tech_.currentTime(),t=this.tech_.buffered();if(this.lastRecordedTime===e&&(!t.length||e+ai>=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(et([this.lastRecordedTime,e]));const r={playedRanges:this.playedRanges_};this.playlistController_.trigger({type:"playedrangeschanged",metadata:r}),this.consecutiveUpdates=0,this.lastRecordedTime=e}}resetTimeUpdate_(){this.consecutiveUpdates=0}fixesBadSeeks_(){if(!this.tech_.seeking())return!1;const t=this.seekable(),r=this.tech_.currentTime(),s=this.afterSeekableWindow_(t,r,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(s&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,r)){const A=t.start(0);n=A+(A===t.end(0)?0:ai)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${r} with seekable range ${fm(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,l=this.tech_.buffered(),u=a.audioBuffer?a.audioBuffered():null,f=a.videoBuffer?a.videoBuffered():null,p=this.media(),T=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-ni)*2,b=[u,f];for(let A=0;A<b.length;A++){if(!b[A])continue;if(Su(b[A],r)<T)return!1}const S=zn(l,r);return S.length===0?!1:(n=S.start(0)+ai,this.logger_(`Buffered region starts (${S.start(0)}) just beyond seek point (${r}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),r=Dr(t,e);if(r.length&&e+3<=r.end(0)){this.resetTimeUpdate_(),this.tech_.setCurrentTime(e),this.logger_(`Stopped at ${e} while inside a buffered region [${r.start(0)} -> ${r.end(0)}]. Attempting to resume playback by seeking to the current time.`),this.tech_.trigger({type:"usage",name:"vhs-unknown-waiting"});return}}techWaiting_(){const e=this.seekable(),t=this.tech_.currentTime();if(this.tech_.seeking())return!0;if(this.beforeSeekableWindow_(e,t)){const l=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${l}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(l),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const r=this.tech_.vhs.playlistController_.sourceUpdater_,s=this.tech_.buffered();if(this.videoUnderflow_({audioBuffered:r.audioBuffered(),videoBuffered:r.videoBuffered(),currentTime:t}))return this.resetTimeUpdate_(),this.tech_.setCurrentTime(t),this.tech_.trigger({type:"usage",name:"vhs-video-underflow"}),!0;const a=zn(s,t);return a.length>0?(this.logger_(`Stopped at ${t} and seeking to ${a.start(0)}`),this.resetTimeUpdate_(),this.skipTheGap_(t),!0):!1}afterSeekableWindow_(e,t,r,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+ai;const a=!r.endList,l=typeof r.partTargetDuration=="number";return a&&(l||s)&&(n=e.end(e.length-1)+r.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:r}){if(!e)return;let s;if(e.length&&t.length){const n=Dr(e,r-3),a=Dr(e,r),l=Dr(t,r);l.length&&!a.length&&n.length&&(s={start:n.end(0),end:l.end(0)})}else zn(e,r).length||(s=this.gapFromVideoUnderflow_(e,r));return s?(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${r}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),r=this.tech_.currentTime(),s=zn(t,r);if(this.resetTimeUpdate_(),s.length===0||r!==e)return;this.logger_("skipTheGap_:","currentTime:",r,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+ni);const n={gapInfo:{from:r,to:s.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:n}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const r=tx(e);for(let s=0;s<r.length;s++){const n=r.start(s),a=r.end(s);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}const bE={errorInterval:30,getSource(i){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return i(t)}},rg=function(i,e){let t=0,r=0;const s=Te(bE,e);i.ready(()=>{i.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){r&&i.currentTime(r)},a=function(p){p!=null&&(r=i.duration()!==1/0&&i.currentTime()||0,i.one("loadedmetadata",n),i.src(p),i.trigger({type:"usage",name:"vhs-error-reload"}),i.play())},l=function(){if(Date.now()-t<s.errorInterval*1e3){i.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||typeof s.getSource!="function"){F.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),s.getSource.call(i,a)},u=function(){i.off("loadedmetadata",n),i.off("error",l),i.off("dispose",u)},f=function(p){u(),rg(i,p)};i.on("error",l),i.on("dispose",u),i.reloadSourceOnError=f},xE=function(i){rg(this,i)};var sg="3.16.2",SE="7.1.0",EE="1.3.1",CE="7.2.0",AE="4.0.2";const $e={PlaylistLoader:Ir,Playlist:Tt,utils:Dx,STANDARD_PLAYLIST_SELECTOR:th,INITIAL_PLAYLIST_SELECTOR:_S,lastBandwidthSelector:th,movingAverageBandwidthSelector:gS,comparePlaylistBandwidth:Du,comparePlaylistResolution:mS,xhr:km()};Object.keys(Je).forEach(i=>{Object.defineProperty($e,i,{get(){return F.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),Je[i]},set(e){if(F.log.warn(`using Vhs.${i} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){F.log.warn(`value of Vhs.${i} must be greater than or equal to 0`);return}Je[i]=e}})});const ng="videojs-vhs",ag=function(i,e){const t=e.media();let r=-1;for(let s=0;s<i.length;s++)if(i[s].id===t.id){r=s;break}i.selectedIndex_=r,i.trigger({selectedIndex:r,type:"change"})},wE=function(i,e){e.representations().forEach(t=>{i.addQualityLevel(t)}),ag(i,e.playlists)};$e.canPlaySource=function(){return F.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const DE=(i,e,t)=>{if(!i)return i;let r={};e&&e.attributes&&e.attributes.CODECS&&(r=xa(ti(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(r.audio=t.attributes.CODECS);const s=Ur(r.video),n=Ur(r.audio),a={};for(const l in i)a[l]={},n&&(a[l].audioContentType=n),s&&(a[l].videoContentType=s),e.contentProtection&&e.contentProtection[l]&&e.contentProtection[l].pssh&&(a[l].pssh=e.contentProtection[l].pssh),typeof i[l]=="string"&&(a[l].url=i[l]);return Te(i,a)},IE=(i,e)=>i.reduce((t,r)=>{if(!r.contentProtection)return t;const s=e.reduce((n,a)=>{const l=r.contentProtection[a];return l&&l.pssh&&(n[a]={pssh:l.pssh}),n},{});return Object.keys(s).length&&t.push(s),t},[]),kE=({player:i,sourceKeySystems:e,audioMedia:t,mainPlaylists:r})=>{if(!i.eme.initializeMediaKeys)return Promise.resolve();const s=t?r.concat([t]):r,n=IE(s,Object.keys(e)),a=[],l=[];return n.forEach(u=>{l.push(new Promise((f,p)=>{i.tech_.one("keysessioncreated",f)})),a.push(new Promise((f,p)=>{i.eme.initializeMediaKeys({keySystems:u},T=>{if(T){p(T);return}f()})}))}),Promise.race([Promise.all(a),Promise.race(l)])},PE=({player:i,sourceKeySystems:e,media:t,audioMedia:r})=>{const s=DE(e,t,r);return s?(i.currentSource().keySystems=s,s&&!i.eme?(F.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},og=()=>{if(!k.localStorage)return null;const i=k.localStorage.getItem(ng);if(!i)return null;try{return JSON.parse(i)}catch{return null}},LE=i=>{if(!k.localStorage)return!1;let e=og();e=e?Te(e,i):i;try{k.localStorage.setItem(ng,JSON.stringify(e))}catch{return!1}return e},RE=i=>i.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(i.substring(i.indexOf(",")+1)):i,lg=(i,e)=>{i._requestCallbackSet||(i._requestCallbackSet=new Set),i._requestCallbackSet.add(e)},ug=(i,e)=>{i._responseCallbackSet||(i._responseCallbackSet=new Set),i._responseCallbackSet.add(e)},cg=(i,e)=>{i._requestCallbackSet&&(i._requestCallbackSet.delete(e),i._requestCallbackSet.size||delete i._requestCallbackSet)},dg=(i,e)=>{i._responseCallbackSet&&(i._responseCallbackSet.delete(e),i._responseCallbackSet.size||delete i._responseCallbackSet)};$e.supportsNativeHls=function(){if(!X||!X.createElement)return!1;const i=X.createElement("video");return F.getTech("Html5").isSupported()?["application/vnd.apple.mpegurl","audio/mpegurl","audio/x-mpegurl","application/x-mpegurl","video/x-mpegurl","video/mpegurl","application/mpegurl"].some(function(t){return/maybe|probably/i.test(i.canPlayType(t))}):!1}();$e.supportsNativeDash=function(){return!X||!X.createElement||!F.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(X.createElement("video").canPlayType("application/dash+xml"))}();$e.supportsTypeNatively=i=>i==="hls"?$e.supportsNativeHls:i==="dash"?$e.supportsNativeDash:!1;$e.isSupported=function(){return F.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};$e.xhr.onRequest=function(i){lg($e.xhr,i)};$e.xhr.onResponse=function(i){ug($e.xhr,i)};$e.xhr.offRequest=function(i){cg($e.xhr,i)};$e.xhr.offResponse=function(i){dg($e.xhr,i)};const OE=F.getComponent("Component");class hg extends OE{constructor(e,t,r){if(super(t,r.vhs),typeof r.initialBandwidth=="number"&&(this.options_.bandwidth=r.initialBandwidth),this.logger_=$t("VhsHandler"),t.options_&&t.options_.playerId){const s=F.getPlayer(t.options_.playerId);this.player_=s}if(this.tech_=t,this.source_=e,this.stats={},this.ignoreNextSeekingEvent_=!1,this.setOptions_(),this.options_.overrideNative&&t.overrideNativeAudioTracks&&t.overrideNativeVideoTracks)t.overrideNativeAudioTracks(!0),t.overrideNativeVideoTracks(!0);else if(this.options_.overrideNative&&(t.featuresNativeVideoTracks||t.featuresNativeAudioTracks))throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");this.on(X,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],s=>{const n=X.fullscreenElement||X.webkitFullscreenElement||X.mozFullScreenElement||X.msFullscreenElement;n&&n.contains(this.tech_.el())?this.playlistController_.fastQualityChange_():this.playlistController_.checkABR_()}),this.on(this.tech_,"seeking",function(){if(this.ignoreNextSeekingEvent_){this.ignoreNextSeekingEvent_=!1;return}this.setCurrentTime(this.tech_.currentTime())}),this.on(this.tech_,"error",function(){this.tech_.error()&&this.playlistController_&&this.playlistController_.pauseLoading()}),this.on(this.tech_,"play",this.play)}setOptions_(e={}){if(this.options_=Te(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 r=og();r&&r.bandwidth&&(this.options_.bandwidth=r.bandwidth,this.tech_.trigger({type:"usage",name:"vhs-bandwidth-from-local-storage"})),r&&r.throughput&&(this.options_.throughput=r.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(r=>{typeof this.source_[r]<"u"&&(this.options_[r]=this.source_[r])}),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=RE(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=$e,this.options_.sourceType=tf(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new gE(this.options_);const r=Te({liveRangeSafeTimeDelta:ai},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new vE(r),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=F.players[this.tech_.options_.playerId];let a=this.playlistController_.error;typeof a=="object"&&!a.code?a.code=3:typeof a=="string"&&(a={message:a,code:3}),n.error(a)});const s=this.options_.bufferBasedABR?$e.movingAverageBandwidthSelector(.55):$e.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=$e.INITIAL_PLAYLIST_SELECTOR.bind(this),this.playlists=this.playlistController_.mainPlaylistLoader_,this.mediaSource=this.playlistController_.mediaSource,Object.defineProperties(this,{selectPlaylist:{get(){return this.playlistController_.selectPlaylist},set(n){this.playlistController_.selectPlaylist=n.bind(this)}},throughput:{get(){return this.playlistController_.mainSegmentLoader_.throughput.rate},set(n){this.playlistController_.mainSegmentLoader_.throughput.rate=n,this.playlistController_.mainSegmentLoader_.throughput.count=1}},bandwidth:{get(){let n=this.playlistController_.mainSegmentLoader_.bandwidth;const a=k.navigator.connection||k.navigator.mozConnection||k.navigator.webkitConnection,l=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=l&&n>=l?n=Math.max(n,u):n=u}return n},set(n){this.playlistController_.mainSegmentLoader_.bandwidth=n,this.playlistController_.mainSegmentLoader_.throughput={rate:0,count:0}}},systemBandwidth:{get(){const n=1/(this.bandwidth||1);let a;return this.throughput>0?a=1/this.throughput:a=0,Math.floor(1/(n+a))},set(){F.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:()=>ir(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:()=>ir(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&&LE({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{TE(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_=k.URL.createObjectURL(this.playlistController_.mediaSource),(F.browser.IS_ANY_SAFARI||F.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"),kE({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=PE({player:this.player_,sourceKeySystems:this.source_.keySystems,media:this.playlists.media(),audioMedia:e&&e.media()});if(this.player_.tech_.on("keystatuschange",r=>{this.playlistController_.updatePlaylistByKeyStatus(r.keyId,r.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=F.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{wE(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{ag(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":sg,"mux.js":SE,"mpd-parser":EE,"m3u8-parser":CE,"aes-decrypter":AE}}version(){return this.constructor.version()}canChangeType(){return Zm.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_&&k.URL.revokeObjectURL&&(k.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Nx({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,r=!0,s=2){return Nm({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:r,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{lg(this.xhr,e)},this.xhr.onResponse=e=>{ug(this.xhr,e)},this.xhr.offRequest=e=>{cg(this.xhr,e)},this.xhr.offResponse=e=>{dg(this.xhr,e)},this.player_.trigger("xhr-hooks-ready")}attachStreamingEventListeners_(){const e=["seekablerangeschanged","bufferedrangeschanged","contentsteeringloadstart","contentsteeringloadcomplete","contentsteeringparsed"],t=["gapjumped","playedrangeschanged"];e.forEach(r=>{this.playlistController_.on(r,s=>{this.player_.trigger(Ke({},s))})}),t.forEach(r=>{this.playbackWatcher_.on(r,s=>{this.player_.trigger(Ke({},s))})})}}const Ca={name:"videojs-http-streaming",VERSION:sg,canHandleSource(i,e={}){const t=Te(F.options,e);return!t.vhs.experimentalUseMMS&&!js("avc1.4d400d,mp4a.40.2",!1)?!1:Ca.canPlayType(i.type,t)},handleSource(i,e,t={}){const r=Te(F.options,t);return e.vhs=new hg(i,e,r),e.vhs.xhr=km(),e.vhs.setupXhrHooks_(),e.vhs.src(i.src,i.type),e.vhs},canPlayType(i,e){const t=tf(i);if(!t)return"";const r=Ca.getOverrideNative(e);return!$e.supportsTypeNatively(t)||r?"maybe":""},getOverrideNative(i={}){const{vhs:e={}}=i,t=!(F.browser.IS_ANY_SAFARI||F.browser.IS_IOS),{overrideNative:r=t}=e;return r}},NE=()=>js("avc1.4d400d,mp4a.40.2",!0);NE()&&F.getTech("Html5").registerSourceHandler(Ca,0);F.VhsHandler=hg;F.VhsSourceHandler=Ca;F.Vhs=$e;F.use||F.registerComponent("Vhs",$e);F.options.vhs=F.options.vhs||{};(!F.getPlugin||!F.getPlugin("reloadSourceOnError"))&&F.registerPlugin("reloadSourceOnError",xE);class BE{constructor(e){this.id=e.getAttribute("id"),this.allowMultipleAds=e.getAttribute("allowMultipleAds"),this.followRedirects=e.getAttribute("followRedirects"),this.vastAdData=null,this.adTagURI=null,this.customData=null;for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdTagURI":this.adTagURI={templateType:r.getAttribute("templateType"),uri:(r.textContent||r.text||"").trim()};break;case"VASTAdData":for(this.vastAdData=r.firstChild;this.vastAdData&&this.vastAdData.nodeType!==1;)this.vastAdData=this.vastAdData.nextSibling;break;case"CustomAdData":this.customData=r;break}}}}function fg(i,e){const t=[];for(const r in i.childNodes){const s=i.childNodes[r];(s.nodeName===e||e===`vmap:${s.nodeName}`||s.nodeName===`vmap:${e}`)&&t.push(s)}return t}function ME(i){if(!i||!i.childNodes)return{};const e=i.childNodes,t=[];for(const s in e){const n=e[s];n.nodeName==="#cdata-section"&&t.push(n)}if(t&&t.length>0)try{return JSON.parse(t[0].data)}catch{}let r="";for(const s in e){const n=e[s];switch(n.nodeName){case"#text":r+=n.textContent.trim();break;case"#cdata-section":r+=n.data;break}}return r}function Iu(i){const e={attributes:{},children:{},value:{}};e.value=ME(i);const t=i.attributes;if(t)for(const s in t){const n=t[s];n.nodeName&&n.nodeValue!==void 0&&n.nodeValue!==null&&(e.attributes[n.nodeName]=n.nodeValue)}const r=i.childNodes;if(r)for(const s in r){const n=r[s];n.nodeName&&n.nodeName.substring(0,1)!=="#"&&(e.children[n.nodeName]=Iu(n))}return e}class UE{constructor(e){this.timeOffset=e.getAttribute("timeOffset"),this.breakType=e.getAttribute("breakType"),this.breakId=e.getAttribute("breakId"),this.repeatAfter=e.getAttribute("repeatAfter"),this.adSource=null,this.trackingEvents=[],this.extensions=[];for(const t in e.childNodes){const r=e.childNodes[t];switch(r.localName){case"AdSource":this.adSource=new BE(r);break;case"TrackingEvents":for(const s in r.childNodes){const n=r.childNodes[s];n.localName==="Tracking"&&this.trackingEvents.push({event:n.getAttribute("event"),uri:(n.textContent||n.text||"").trim()})}break;case"Extensions":this.extensions=fg(r,"Extension").map(s=>Iu(s));break}}}track(e,t){for(const r in this.trackingEvents){const s=this.trackingEvents[r];if(s.event===e){let{uri:n}=s;s.event==="error"&&(n=n.replace("[ERRORCODE]",t)),this.tracker(n)}}}tracker(e){if(typeof window<"u"&&window!==null){const t=new Image;t.src=e}}}class FE{constructor(e){if(!e||!e.documentElement||e.documentElement.localName!=="VMAP")throw new Error("Not a VMAP document");this.version=e.documentElement.getAttribute("version"),this.adBreaks=[],this.extensions=[];for(const t in e.documentElement.childNodes){const r=e.documentElement.childNodes[t];switch(r.localName){case"AdBreak":this.adBreaks.push(new UE(r));break;case"Extensions":this.extensions=fg(r,"Extension").map(s=>Iu(s));break}}}}const $E=(i,e)=>{const t=goog.pal,r=new t.ConsentSettings;r.allowStorage=!1;const s=new t.NonceLoader(r);return async()=>{try{const n=new URL(e),a=new t.NonceRequest;let l=localStorage.getItem("sl-device-id")||Cs.v4(),u=sessionStorage.getItem("sl-ad-session-id");u||(u=Cs.v4(),sessionStorage.setItem("sl-ad-session-id",u)),Cs.validate(l)||(l=Cs.v5(`https://${l}`,Cs.v5.URL)),n.searchParams.get("url")||n.searchParams.set("url","https://streamlayer.io"),n.searchParams.get("description_url")||n.searchParams.set("description_url","https://streamlayer.io"),a.adWillAutoPlay=n.searchParams.get("vpa")==="auto",a.adWillPlayMuted=n.searchParams.get("vpmute")==="1",a.continuousPlayback=!0,a.descriptionUrl=n.searchParams.get("description_url"),a.iconsSupported=!0,a.sessionId=l,a.supportedApiFrameworks="2,7,9",a.videoHeight=i.clientHeight,a.videoWidth=i.clientWidth;const f=await s.loadNonceManager(a);return n.searchParams.get("is_lat")==="[placeholder]"&&n.searchParams.set("is_lat","1"),n.searchParams.get("rdid")==="[placeholder]"&&n.searchParams.set("rdid",l),n.searchParams.get("correlator")==="[placeholder]"&&n.searchParams.set("correlator",u),n.searchParams.set("wta","1"),n.searchParams.set("givn",f.getNonce()),{url:n,manager:f}}catch(n){console.log("AdsManager could not be started",n);return}}},jE=new hT,VE=i=>i.creatives.find(e=>e.mediaFiles),qE=i=>{var e;const t=i==null?void 0:i.mediaFiles;return t!=null&&t.length&&((e=t.find(r=>r.fileURL))==null?void 0:e.fileURL)||""},Rs=El.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),HE=(i,e)=>{const[t,r]=Se.useState(),s=Se.useRef(Date.now()),n=Se.useRef(Date.now());return Se.useEffect(()=>{if(!e||!(i!=null&&i.current))return;const a=$E(i.current,e),l=Date.now();s.current=l,Rs.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(u=>{s.current===l&&u&&(r(u.url),Rs.set({ads:[],autoplay:!0,muted:!1,nonceManager:u.manager}))}).catch(u=>{console.error(u)})},[i,e]),Se.useEffect(()=>{const a=async(l,u)=>{let f=[];if(l.searchParams.get("output")==="vmap"){const S=await fetch(l.toString()),A=new DOMParser,v=await S.text(),L=A.parseFromString(v,"text/xml");f=new FE(L).adBreaks.map(P=>P.adSource.adTagURI.uri)}else f=[l.toString()];const p=await Promise.all(f.map((S,A)=>jE.get(S).then(v=>{if(n.current===u){const L=v.ads.find(O=>O.creatives.length>0);if(!L)return;const P=VE(L),M=qE(P);return{creative:P,order:A,mediaFileUrl:M,ad:L,raw:v}}}))),T=l.searchParams.get("vpa")!=="click",b=l.searchParams.get("vpmute")==="1";Rs.set({...Rs.get(),ads:p.filter(S=>!!S),autoplay:T,muted:b})};if(t){const l=Date.now();n.current=l,a(t,l)}return()=>{n.current=0}},[t]),Rs},zE=i=>{const e=Se.useRef();return Se.useEffect(()=>{if(!e.current&&i.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),i.current.appendChild(t),e.current=F(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},pg={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:i=>{},playMuted:!1,muted:!1,autoplay:!0},Re=El.f(pg),ph=i=>{if(!i)return 0;const e=i.duration(),t=i.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},WE=(i,e)=>{const t=HE(i,e),r=zE(i),s=Se.useRef(),n=Se.useRef(!1),a=Se.useRef(!1),l=Se.useCallback(()=>{if(a.current)return;const S=t.get().nonceManager;if(S&&n.current)try{S.sendPlaybackEnd()}catch(A){console.warn("[PAL] sendPlaybackEnd failed",A)}a.current=!0},[t]),u=Se.useCallback(()=>{l(),r.current&&(r.current.pause(),r.current.src(void 0)),s.current=void 0,Re.set({...pg,reset:u})},[r,l]);Se.useEffect(()=>{Re.setKey("reset",u)},[u]);const f=Se.useCallback(()=>{var S,A,v;const{adPosition:L,adCount:P}=Re.get();if(r.current){if(L<P){const M=L+1,{ads:O,muted:U,autoplay:R,nonceManager:q}=t.get(),Y=O[M-1];if(Y){(S=s.current)==null||S.complete(),s.current=new fT(null,Y.ad,Y.creative),s.current.on("clickthrough",K=>{if(q)try{q.sendAdClick()}catch(ie){console.warn("[PAL] sendAdClick failed",ie)}window.open(K,"_blank")}),Re.setKey("adPosition",M),Re.setKey("playMuted",U),Re.setKey("skipDelay",Y.creative.skipDelay||0),Re.setKey("time",0),Re.setKey("adAction",K=>{s.current&&s.current.click(null,{CLICKPOS:[K.clientX,K.clientY]})}),Re.setKey("whyThisAd",Y.creative.icons.find(K=>K.program==="GoogleWhyThisAd")||null),Re.setKey("hasAdUrl",!!((A=Y.creative.videoClickThroughURLTemplate)!=null&&A.url)),r.current.src(Y.mediaFileUrl),Re.setKey("playing",!0),L===0?(Re.setKey("muted",U),Re.setKey("autoplay",R),U&&r.current.muted(!0),R?r.current.play():(r.current.pause(),Re.setKey("paused",!0))):r.current.play();return}}(v=s.current)==null||v.complete(),u()}},[r,u,t]),p=Se.useCallback(()=>{if(!r.current)return;const S=r.current.muted();r.current.muted(!S),Re.setKey("muted",!S),s.current&&s.current.setMuted(!S)},[r]),T=Se.useCallback(()=>{r.current&&(r.current.paused()?(r.current.play(),s.current&&s.current.setPaused(!1)):(r.current.pause(),s.current&&s.current.setPaused(!0)))},[r]),b=Se.useCallback(()=>{r.current&&(s.current&&s.current.skip(),f())},[f,r]);return Se.useEffect(()=>{const S=r.current;if(!S)return()=>{};const A=R=>{if(Re.setKey("playing",!0),Re.setKey("paused",!1),Re.setKey("time",ph(R.target.player)),!n.current){const q=t.get().nonceManager;if(q)try{q.sendPlaybackStart(),n.current=!0,a.current=!1}catch(Y){console.warn("[PAL] sendPlaybackStart failed",Y)}}},v=()=>{var R;(R=s.current)==null||R.complete(),f()},L=R=>{Re.setKey("muted",R.target.player.muted())},P=()=>{Re.setKey("paused",!0)},M=R=>{R.target.tagName==="VIDEO"&&(Re.get().autoplay||T())},O=R=>{Re.setKey("time",ph(R.target.player)),s.current&&s.current.setProgress(R.target.player.currentTime())},U=()=>{u()};return S.on("play",A),S.on("ended",v),S.on("muted",L),S.on("pause",P),S.on("click",M),S.on("timeupdate",O),S.on("error",U),()=>{S.off("play",A),S.off("ended",v),S.off("muted",L),S.off("pause",P),S.off("click",M),S.off("timeupdate",O),S.off("error",U)}},[T,f,r,u,t]),Se.useEffect(()=>t.subscribe(S=>{S&&(n.current=!1,a.current=!1,Re.setKey("adCount",S.ads.length),Re.setKey("adPosition",0),f())}),[t,r,f]),Se.useEffect(()=>()=>{u()},[u]),[Re,p,T,b,s]},GE=({promotion:i,onClose:e,promotionId:t,externalAd:r,skipAutoClose:s})=>{var n,a,l,u,f;const p=Se.useRef(null),[T,b,S,A]=WE(p,r==null?void 0:r.url),{time:v,adCount:L,adPosition:P,skipDelay:M,playing:O,paused:U,reset:R,muted:q,playMuted:Y,autoplay:K,whyThisAd:ie,hasAdUrl:me,adAction:le}=J.useStore(T),ge=((n=i.sponsor)==null?void 0:n.logo)&&i.logoMode===oe.PromotionLogoMode.CENTER;return G.jsxs(Sh,{className:"PromoOverlay",children:[G.jsxs(Eh,{children:[G.jsx(Ch,{className:J.cx_default(!ge&&Ah),children:G.jsx(Dh,{style:{transform:"scale(1.5)"},children:"Ad"})}),G.jsxs(X_,{children:[G.jsx($_,{time:v,adCount:L,adPosition:P}),!!M&&O&&G.jsx(Jn.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{A()},duration:M,isPlaying:!U,skipIcon:!0}),s&&G.jsx(Jn.y,{className:"ClosePromoIcon",close:()=>{R(),e==null||e()}})]})]}),G.jsx(wh,{className:J.cx_default(xc,O&&Sc,!O&&Ec),children:G.jsxs(K_,{ref:p,children:[ie&&G.jsx(V_,{whyThisAd:ie}),G.jsxs(q_,{style:(ie==null?void 0:ie.xPosition)==="right"?{left:"8px"}:{right:"8px"},children:[Y&&G.jsx(z_,{className:J.cx_default(!q&&"muted"),onClick:()=>b()}),U&&!K&&G.jsx(G_,{onClick:()=>S()})]})]})}),me&&G.jsx(Ih,{className:J.cx_default(xc,O&&Sc,!O&&Ec),children:G.jsx(kh,{as:"button",onClick:le,style:{backgroundColor:((l=(a=i.banner)==null?void 0:a.ctaButton)==null?void 0:l.color)||"#009dc4",color:((f=(u=i.banner)==null?void 0:u.ctaButton)==null?void 0:f.textColor)||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":i.type,target:"_blank",children:"Show more"})})]})},mh=i=>{var e,t,r,s,n,a,l,u,f,p,T,b,S,A,v,L,P,M,O,U,R,q,Y,K,ie,me,le,ge,ee,ce;const{promotion:te,open:de,advertisementPaused:ve,togglePause:Ve,controlVideo:Ye,skipAutoClose:Ce,promotionId:_e,onClose:St,markAsViewed:Pt,externalAd:Ie,isEventFired:pe,fireEvent:qe,muted:dr}=i,Ai=te.type===oe.PromotionType.INGAME_IAB11_LBAR||te.type===oe.PromotionType.INGAME_IAB11||te.type===oe.PromotionType.INGAME_IAB11_SIDEBAR,wi=((e=te.sponsor)==null?void 0:e.logo)&&te.logoMode===oe.PromotionLogoMode.CENTER,zi=!!((r=(t=te.banner)==null?void 0:t.video)!=null&&r.url),Et=te.autoPlayVideo===oe.AutoPlayVideo.ENABLED,Di=te.playVideoMuted===oe.PlayVideoMuted.ENABLED;if(Se.useEffect(()=>{Ve==null||Ve(zi||Et),de==null||de()},[]),Se.useEffect(()=>{_e&&te.type&&Pt&&Pt()},[_e,te.type,Pt]),Se.useEffect(()=>()=>{Ye==null||Ye({muted:!1})},[Ye]),Ie)return G.jsx(GE,{...i,externalAd:Ie});let Xt=(s=te.banner)==null?void 0:s.url;Xt&&Xt.indexOf("http")!==0&&(Xt=`https://${Xt}`);let Wi=!0;return zi&&(!ve||!Et?Wi=!0:Wi=!1),G.jsxs(Sh,{className:"PromoOverlay",children:[G.jsxs("div",{children:[G.jsxs(Eh,{children:[G.jsxs(Ch,{className:J.cx_default(!wi&&Ah),children:[((n=te.sponsor)==null?void 0:n.logo)&&te.logoMode===oe.PromotionLogoMode.LEFT&&G.jsx(Tc,{className:"PromoSponsorLogo",src:(a=te.sponsor)==null?void 0:a.logo,alt:"promo"}),G.jsxs(R_,{style:{paddingLeft:(l=te.sponsor)!=null&&l.logo&&te.logoMode===oe.PromotionLogoMode.LEFT?"0px":"8px"},children:[((u=te.sponsor)==null?void 0:u.logo)&&te.logoMode===oe.PromotionLogoMode.LEFT&&G.jsx(I_,{children:(f=te.sponsor)==null?void 0:f.name}),G.jsxs(O_,{className:"SponsorText",children:[G.jsx(Dh,{children:"AD"}),G.jsx(N_,{children:"SPONSORED"})]})]})]}),G.jsx(Jn.y,{className:"ClosePromoIcon",close:St,autoClose:(p=te.closeTimer)==null?void 0:p.auto,duration:Ce?0:(T=te.closeTimer)==null?void 0:T.seconds,isPlaying:Wi})]}),G.jsxs(wh,{children:[wi&&G.jsx(Tc,{className:P_,src:(b=te.sponsor)==null?void 0:b.logo,alt:"promo"}),G.jsx(vc,{children:(A=(S=te.banner)==null?void 0:S.video)!=null&&A.url?G.jsx(Jn.Et,{source:(L=(v=te.banner)==null?void 0:v.video)==null?void 0:L.url,poster:(M=(P=te.banner)==null?void 0:P.video)==null?void 0:M.thumbnailUrl,aspectRatio:Ai?"1/1":"2/1",onRender:()=>{pe!=null&&pe("video-rendered")||(ei.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:_e,type:te.type}}),qe==null||qe("video-rendered"))},onQuartile:jt=>{pe!=null&&pe(`video-quartile-${jt}`)||(ei.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:_e,type:te.type,quartile:jt}}),qe==null||qe(`video-quartile-${jt}`))},onMute:jt=>{const Vt=jt?"muted":"unmuted";pe!=null&&pe(Vt)||(ei.eventBus.emit("advertisement",{action:jt?"videoMuted":"videoUnmuted",payload:{id:_e,type:te.type}}),qe==null||qe(Vt))},onPause:()=>{Et&&(Ve==null||Ve(!0))},onReplay:()=>{pe!=null&&pe("replayed")||(ei.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:_e,type:te.type}}),qe==null||qe("replayed"))},onPlay:()=>{pe!=null&&pe("played")||(ei.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:_e,type:te.type}}),qe==null||qe("played")),Ve==null||Ve(!1),pe!=null&&pe("played")&&pe!=null&&pe("ended")&&!(pe!=null&&pe("replayed"))&&(ei.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:_e,type:te.type}}),qe==null||qe("replayed"))},onEnd:()=>{pe!=null&&pe("ended")||(ei.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:_e,type:te.type}}),qe==null||qe("ended"))},controlVideo:Ye,autoPlay:Et,playMuted:Di,muted:dr}):(O=te.banner)!=null&&O.imageUrl?G.jsx(k_,{style:Ai?{aspectRatio:"1/1"}:{},src:(U=te.banner)==null?void 0:U.imageUrl,alt:"promo"}):null}),!Ai&&G.jsxs(vc,{children:[((R=te.banner)==null?void 0:R.title)&&G.jsx(B_,{className:J.cx_default("AdvTitle",wi&&M_),children:(q=te.banner)==null?void 0:q.title}),((Y=te.banner)==null?void 0:Y.body)&&G.jsx(L_,{className:"AdvDescription",children:(K=te.banner)==null?void 0:K.body})]})]})]}),te.buttonType===oe.PromotionButtonType.BASIC&&G.jsx(Ih,{children:G.jsx(kh,{href:Xt,style:{backgroundColor:((me=(ie=te.banner)==null?void 0:ie.ctaButton)==null?void 0:me.color)||"#009dc4",color:((ge=(le=te.banner)==null?void 0:le.ctaButton)==null?void 0:ge.textColor)||"#fff"},"data-a":"button","data-promo-id":_e,"data-promo-type":te.type,target:"_blank",children:(ce=(ee=te.banner)==null?void 0:ee.ctaButton)==null?void 0:ce.label})})]})},KE=J.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),XE=({children:i,direction:e,style:t,className:r,hiding:s})=>G.jsx(Cl,{direction:e,style:t,hiding:s,className:r,children:G.jsx(KE,{children:i})}),gh=i=>(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB11_LBAR||(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB21_LBAR,YE=i=>(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB11_SIDEBAR||(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB21_SIDEBAR,QE=i=>(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB11||(i==null?void 0:i.type)===oe.PromotionType.INGAME_IAB21,JE=({advertisement:i,close:e,skipTypeCheck:t,skipAutoClose:r,layoutMode:s="side-by-side",sidebar:n,isNotification:a,banner:l,markAsViewed:u,open:f,externalAd:p,controlVideo:T,advertisementPaused:b,togglePause:S,isEventFired:A,fireEvent:v,muted:L})=>i.promotion?a&&i.notification?G.jsx(w_,{open:()=>f==null?void 0:f({fromNotification:!0}),notification:i.notification,promotionId:i.question.id,close:e}):!n&&!l&&(t||QE(i.promotion))?G.jsx(D_,{className:"PromoOverlayContainer",children:G.jsx(mh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,onClose:e,open:f,skipAutoClose:r,externalAd:p,controlVideo:T,advertisementPaused:b,togglePause:S,isEventFired:A,fireEvent:v,muted:L})}):n&&(t||gh(i.promotion)||YE(i.promotion)||p)?G.jsx(XE,{className:"PromoSidebarContainer",direction:n,hiding:!1,children:G.jsx(mh,{markAsViewed:u,promotionId:i.question.id,promotion:i.promotion,externalAd:p,onClose:e,open:f,controlVideo:T,skipAutoClose:r,advertisementPaused:b,togglePause:S,isEventFired:A,fireEvent:v,muted:L})}):l&&gh(i.promotion)?G.jsx(_h,{promotionId:i.question.id,hiding:!1,promotion:i.promotion,direction:l,isEventFired:A,fireEvent:v}):null:null,yh=J.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),ZE=i=>{const e=i.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",r=e.getAttribute("data-promo-type")||oe.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&ei.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:r}}),e.getAttribute("data-a")==="banner"&&ei.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:r}})}},eC=({gamification:i,advertisement:e,layoutMode:t,skipAutoClose:r,skipTypeCheck:s,sidebar:n,banner:a,notification:l,isMobileScreen:u,persistent:f,containerId:p,externalAd:T,controlVideo:b,muted:S})=>{var A,v,L,P,M,O,U,R,q,Y,K,ie,me,le,ge,ee,ce,te,de,ve,Ve;const Ye=Se.useRef(null),Ce=J.useStore(e.$store),_e=J.useStore(i.openedQuestion.$store);El.b(Ye,{enabled:!!Ce.data,event:"click",listener:ZE});const St=((L=(v=(A=Ce.data)==null?void 0:A.question)==null?void 0:v.backgroundImage)==null?void 0:L.landscapeUrl)||((M=(P=Ce.data)==null?void 0:P.promotion)==null?void 0:M.backgroundImageLandscapeUrl),Pt=((R=(U=(O=Ce.data)==null?void 0:O.question)==null?void 0:U.backgroundImage)==null?void 0:R.portraitUrl)||((Y=(q=Ce.data)==null?void 0:q.promotion)==null?void 0:Y.backgroundImagePortraitUrl),Ie=Sy.y({containerId:p,landscapeUrl:St,portraitUrl:Pt});if(((K=_e==null?void 0:_e.attributes)==null?void 0:K.adUnit)===oe.AdUnit.STANDART&&(le=(me=(ie=_e==null?void 0:_e.attributes)==null?void 0:ie.adPromotion)==null?void 0:me.banner)!=null&&le.imageUrl)return a?G.jsx(yh,{ref:Ye,style:{height:"100%"},className:J.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view"),children:G.jsx(My,{cardId:_e.id,promotion:{...(ge=_e==null?void 0:_e.attributes)==null?void 0:ge.adPromotion,adUnit:(ee=_e==null?void 0:_e.attributes)==null?void 0:ee.adUnit}})}):null;const pe=!a&&!n;if(Ce.data===void 0||!f&&Ce.isViewed)return null;const qe=((de=(te=(ce=Ce==null?void 0:Ce.data)==null?void 0:ce.notification)==null?void 0:te.promotion)==null?void 0:de.mode)===oe.NotificationPromotionMode.LOWER_THIRD;return G.jsxs(yh,{ref:Ye,style:{height:pe?"auto":"100%"},className:J.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view",qe&&"SL-AdvertisementUIWrap--lower-third"),children:[!l&&Ie,G.jsx(JE,{skipTypeCheck:s,sidebar:n,banner:a,advertisement:Ce.data,advertisementPaused:!!Ce.isPaused,togglePause:Ce.togglePause,isEventFired:Ce.isEventFired,fireEvent:Ce.fireEvent,close:Ce.close,externalAd:T?Ce.externalAd:void 0,markAsViewed:(ve=i.advertisement)==null?void 0:ve.markAsViewed,open:(Ve=i.advertisement)==null?void 0:Ve.open,layoutMode:t,isNotification:l,skipAutoClose:r,controlVideo:b,muted:S})]})},mg=({sdk:i,sidebar:e,externalAd:t,banner:r,skipAutoClose:s,skipTypeCheck:n,layoutMode:a,isMobileScreen:l,persistent:u,notification:f,muted:p})=>{const T=J.useStore(i.featuresList.getStore()),[b,S]=Se.useState(!t),A=J.useStore(i.options);if(Se.useEffect(()=>{if(t){const L=document.createElement("script");L.async=!0,L.src="https://imasdk.googleapis.com/pal/sdkloader/pal.js",document.body.appendChild(L),L.onload=()=>{S(!0)}}},[t]),e&&r)return G.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(r&&t)return G.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!T)return null;const v=i.getFeature(oe.SdkOverlayType.GAMES);return!(v!=null&&v.advertisement)||t&&!b?null:G.jsx(eC,{gamification:v,advertisement:v.advertisement,sidebar:e,banner:r,layoutMode:a,isMobileScreen:l,persistent:u,notification:f,skipTypeCheck:n,skipAutoClose:s,externalAd:t,controlVideo:i.controlVideoPlayer,containerId:A.containerId,muted:p})},tC=({event:i,sidebar:e,banner:t,isMobileScreen:r,skipAutoClose:s,persistent:n,theme:a,notification:l,skipTypeCheck:u,externalAd:f,muted:p=!1})=>{const T=Jt.B(),b=Jt.F(),S=Jt.z();return T?f&&!b.promotionExternalAd?i!==void 0&&G.jsx(Jt.j,{event:i}):!f&&b.promotionExternalAd?i!==void 0&&G.jsx(Jt.j,{event:i}):e&&!b.promotionSidebar?i!==void 0&&G.jsx(Jt.j,{event:i}):t&&!b.promotionBanner?i!==void 0&&G.jsx(Jt.j,{event:i}):l&&!b.promotionNotification?i!==void 0&&G.jsx(Jt.j,{event:i}):!t&&!e&&!l&&!b.promotionOverlay&&!u?i!==void 0&&G.jsx(Jt.j,{event:i}):G.jsxs("div",{className:"StreamLayerSDK",children:[G.jsx(by.h,{customTheme:a??S.theme,themeMode:S.themeMode,children:G.jsx(mg,{sdk:T,sidebar:e,banner:t,isMobileScreen:r,persistent:n,notification:l,skipTypeCheck:u,skipAutoClose:s,layoutMode:"side-by-side",externalAd:f,muted:p})}),i!==void 0&&G.jsx(Jt.j,{event:i})]}):null};exports.StreamLayerSDKAdvertisement=tC;exports.StreamLayerSDKAdvertisementUI=mg;
|