@streamlayer/react 1.23.1 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/app/masters.d.ts +0 -1
- package/lib/cjs/Question.js +1 -1
- package/lib/cjs/advertisement.js +33 -53
- 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 -1
- package/lib/cjs/hooks-n9ax4LRT.js +1 -0
- package/lib/cjs/index-ByUNFvMk.js +5 -0
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/index10.js +1 -1
- package/lib/cjs/index11.js +1 -4
- package/lib/cjs/index12.js +1 -1
- package/lib/cjs/index13.js +1 -1
- package/lib/cjs/index14.js +4 -1
- package/lib/cjs/index15.js +1 -1
- package/lib/cjs/index16.js +2 -2
- package/lib/cjs/index2.js +1 -1
- package/lib/cjs/index4.js +3 -3
- package/lib/cjs/index5.js +1 -1
- package/lib/cjs/index6.js +1 -1
- package/lib/cjs/index7.js +1 -1
- package/lib/cjs/index8.js +1 -1
- package/lib/cjs/index9.js +7 -1
- package/lib/cjs/insight.js +1 -1
- package/lib/cjs/masters.js +1 -1
- package/lib/cjs/masters2.js +5 -10
- 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 +4 -9
- package/lib/cjs/sl-types.js +1 -15
- package/lib/cjs/storage.js +1 -1
- package/lib/cjs/theme.js +1 -17
- package/lib/cjs/useStreamLayerApp.js +1 -1
- package/lib/cjs/useStreamLayerApp2.js +15 -15
- package/lib/cjs/utils.js +8 -8
- package/lib/classic/app/masters.d.ts +0 -1
- package/lib/classic/cjs/Question.js +1 -1
- package/lib/classic/cjs/advertisement.js +33 -53
- 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 -1
- package/lib/classic/cjs/hooks-n9ax4LRT.js +1 -0
- package/lib/classic/cjs/index-ByUNFvMk.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 +3 -3
- 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 -1
- package/lib/classic/cjs/index7.js +7 -1
- package/lib/classic/cjs/index8.js +1 -1
- 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 +4 -9
- package/lib/classic/cjs/sl-types.js +1 -15
- package/lib/classic/cjs/useStreamLayerApp.js +1 -1
- package/lib/classic/cjs/useStreamLayerApp2.js +15 -15
- package/lib/classic/cjs/utils.js +8 -8
- package/lib/classic/es/Question.js +216 -220
- package/lib/classic/es/advertisement.js +14665 -15122
- package/lib/classic/es/analytics.js +9 -9
- package/lib/classic/es/auth.js +1 -1
- package/lib/classic/es/bet-pack.js +637 -650
- package/lib/classic/es/feature.js +29 -33
- package/lib/classic/es/hooks-n9ax4LRT.js +97 -0
- package/lib/classic/es/index-ByUNFvMk.js +3775 -0
- package/lib/classic/es/index.js +13 -16
- package/lib/classic/es/index10.js +2587 -82
- package/lib/classic/es/index11.js +306 -2344
- package/lib/classic/es/index12.js +103 -101
- package/lib/classic/es/index13.js +449 -464
- package/lib/classic/es/index2.js +1244 -1268
- package/lib/classic/es/index3.js +10 -10
- package/lib/classic/es/index4.js +4 -283
- package/lib/classic/es/index5.js +4 -5
- package/lib/classic/es/index6.js +285 -5
- package/lib/classic/es/index7.js +179 -5
- package/lib/classic/es/index8.js +5 -9
- package/lib/classic/es/index9.js +7 -315
- package/lib/classic/es/insight.js +39 -41
- package/lib/classic/es/notification.js +3 -3
- package/lib/classic/es/notification2.js +513 -528
- package/lib/classic/es/pause-ad.js +116 -116
- package/lib/classic/es/points.js +33 -34
- package/lib/classic/es/polymarket.js +1049 -1102
- package/lib/classic/es/sl-types.js +115 -217
- package/lib/classic/es/useStreamLayerApp.js +1 -1
- package/lib/classic/es/useStreamLayerApp2.js +6485 -6405
- package/lib/classic/es/utils.js +6 -6
- package/lib/classic/source.css +110 -0
- package/lib/dist/cjs/index-ByUNFvMk.js +5 -0
- package/lib/dist/cjs/index.js +1 -1
- package/lib/dist/cjs/masters.js +34 -42
- package/lib/dist/es/index-ByUNFvMk.js +3775 -0
- package/lib/dist/es/index.js +7 -11
- package/lib/dist/es/masters.js +13506 -12760
- package/lib/dist/index.d.ts +5 -5
- package/lib/dist/source.css +64 -0
- package/lib/es/Question.js +99 -101
- package/lib/es/advertisement.js +14665 -15122
- package/lib/es/analytics.js +29 -29
- package/lib/es/auth.js +1 -1
- package/lib/es/bet-pack.js +12 -11
- package/lib/es/feature.js +29 -33
- package/lib/es/hooks-n9ax4LRT.js +97 -0
- package/lib/es/index-ByUNFvMk.js +3775 -0
- package/lib/es/index.js +13 -16
- package/lib/es/index10.js +7 -263
- package/lib/es/index11.js +172 -822
- package/lib/es/index12.js +2587 -178
- package/lib/es/index13.js +248 -302
- package/lib/es/index14.js +815 -82
- package/lib/es/index15.js +306 -2344
- package/lib/es/index16.js +451 -454
- package/lib/es/index2.js +737 -757
- package/lib/es/index4.js +626 -639
- package/lib/es/index5.js +10 -10
- package/lib/es/index6.js +5 -285
- package/lib/es/index7.js +7 -5
- package/lib/es/index8.js +283 -5
- package/lib/es/index9.js +179 -8
- package/lib/es/insight.js +39 -41
- package/lib/es/masters.js +4 -5
- package/lib/es/masters2.js +408 -441
- package/lib/es/notification.js +469 -484
- package/lib/es/pause-ad.js +116 -116
- package/lib/es/points.js +42 -43
- package/lib/es/polymarket.js +1049 -1102
- package/lib/es/sl-types.js +114 -235
- package/lib/es/storage.js +22 -22
- package/lib/es/theme.js +3 -44
- package/lib/es/useStreamLayerApp.js +1 -1
- package/lib/es/useStreamLayerApp2.js +6485 -6405
- package/lib/es/utils.js +6 -6
- package/lib/source.css +120 -0
- package/lib/style.css +1 -1
- package/package.json +15 -15
- package/lib/cjs/hooks-WfHlJH12.js +0 -1
- package/lib/cjs/index-eShKGO10.js +0 -5
- package/lib/classic/cjs/hooks-WfHlJH12.js +0 -1
- package/lib/classic/cjs/index-eShKGO10.js +0 -5
- package/lib/classic/es/hooks-WfHlJH12.js +0 -98
- package/lib/classic/es/index-eShKGO10.js +0 -3757
- package/lib/dist/cjs/index-eShKGO10.js +0 -5
- package/lib/dist/es/index-eShKGO10.js +0 -3757
- package/lib/dist/style.css +0 -1
- package/lib/es/hooks-WfHlJH12.js +0 -98
- package/lib/es/index-eShKGO10.js +0 -3757
package/lib/cjs/advertisement.js
CHANGED
|
@@ -1,31 +1,20 @@
|
|
|
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
|
|
3
|
-
* @license
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* <https://github.com/kesla/parse-headers/blob/master/LICENCE>
|
|
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
|
-
`),e.cue.text+=a.replace(/\u2028/g,`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ae=require("react/jsx-runtime"),_g=require("./index7.js"),ge=require("./sl-types.js"),Uo=require("./analytics.js"),Fe=require("react"),_i=require("./index3.js"),Ce=require("./useStreamLayerApp2.js"),Vn=require("./index9.js"),Tg=require("./index8.js"),vn=require("./index15.js"),ui=require("./index12.js"),cs=require("uuid"),vg=require("./utils.js"),gi=require("./hooks-n9ax4LRT.js");function bg(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in r)){const n=Object.getOwnPropertyDescriptor(i,s);n&&Object.defineProperty(r,s,n.get?n:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}function ot(){return ot=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(r[i]=t[i])}return r},ot.apply(null,arguments)}const xg=ge.styled_default("div")({name:"Container",class:"c5b6wdg",propsAsIs:!1}),Sg="a1rlj479",Eg="s35f1di",Cg="sj4471g",Ag="b12050d8",wg="b1d5ybek",Dg=r=>r==="left"||r==="right"?Eg:Ag,Ig=r=>r==="left"||r==="right"?Cg:wg,kg=r=>r==="left"?"avdxyl3":r==="right"?"a1bisd08":r==="top"?"a1u9y2aj":"a1qqaks",$o=({children:r,style:e,className:t,enabled:i=!0,hiding:s,direction:n="left",onAnimationEnd:a})=>ae.jsx(xg,{style:e,className:ge.cx_default(t,Sg,kg(n),i&&!s&&Dg(n),i&&s&&Ig(n)),onAnimationEnd:a,children:r}),Pg=ge.styled_default("a")({name:"Link",class:"l1sgte8c",propsAsIs:!1}),Rg=ge.styled_default("div")({name:"BannerContainer",class:"b7yfc72",propsAsIs:!1}),Lg=()=>Pg,Ng=ge.styled_default(Lg())({name:"BannerLink",class:"bejjq94",propsAsIs:!0}),_d=({promotion:r,promotionId:e,hiding:t,isEventFired:i,fireEvent:s,direction:n="bottom"})=>{const a=r?.adUnit===Ce.AdUnit.STANDART,o=a?r.banner:r.additionalBanner;if(Fe.useEffect(()=>{o?.imageUrl&&r.type&&e&&(i?.("banner-showed")||(_i.eventBus.emit("advertisement",{action:"bannerShown",payload:{id:e,type:r.type}}),s?.("banner-showed")))},[o?.imageUrl,s,i,r.type,e]),!o?.imageUrl)return null;let u=o?.url;return u&&u.indexOf("http")!==0&&(u=`https://${u}`),ae.jsx($o,{direction:n,hiding:t,children:ae.jsx(Rg,{className:"BannerContainer","data-is-ad":a,children:ae.jsx(Ng,{as:u?"a":"span",className:"BannerLink",href:u,style:{backgroundImage:`url(${o.imageUrl})`,cursor:u?"pointer":"default"},"data-promo-id":e,"data-promo-type":r.type,"data-a":"banner",target:"_blank","data-is-ad":a})})})},Og=({cardId:r,promotion:e,direction:t="bottom"})=>ae.jsx(_d,{promotion:e,promotionId:r,direction:t,hiding:!1}),Bg=ge.styled_default("div")({name:"NotificationContent",class:"n18wsqoo",propsAsIs:!1}),Mg=ge.styled_default("div")({name:"Body",class:"b1ia90c2",propsAsIs:!1}),Fg=ge.styled_default("div")({name:"Title",class:"tg2z08v",propsAsIs:!1}),Ug=ge.styled_default("div")({name:"Text",class:"t59zdk1",propsAsIs:!1}),Tr=ge.styled_default("div")({name:"MediaImgBottom",class:"m1ab9fq",propsAsIs:!1}),$g=()=>Tr,jg=ge.styled_default($g())({name:"MediaImgMiddle",class:"m9fsr0y",propsAsIs:!0}),yu=ge.styled_default("img")({name:"CtaIcon",class:"cvi9y5q",propsAsIs:!1}),qg=ge.styled_default("div")({name:"Logo",class:"l5mq0z",propsAsIs:!1}),Vg=ge.styled_default("div")({name:"Footer",class:"f1mse0ft",propsAsIs:!1}),Hg=ge.styled_default("div")({name:"Vector",class:"v1hcloah",propsAsIs:!1}),zg=ge.styled_default("div")({name:"NotificationContainer",class:"n3n65jf",propsAsIs:!1}),Td=ge.styled_default("button")({name:"TVButton",class:"tkkfuqy",propsAsIs:!1}),Wg=()=>Td,Gg=ge.styled_default(Wg())({name:"DismissButton",class:"dh9vato",propsAsIs:!0}),Kg=()=>Td,vd=ge.styled_default(Kg())({name:"OpenButton",class:"oeah8gv",propsAsIs:!0}),Xg={[Ce.NotificationPromotionImagePosition.UNSET]:Tr,[Ce.NotificationPromotionImagePosition.FIT]:Tr,[Ce.NotificationPromotionImagePosition.CENTERED]:Tr,[Ce.NotificationPromotionImagePosition.SOLID]:Tr,[Ce.NotificationPromotionImagePosition.BOTTOM]:Tr,[Ce.NotificationPromotionImagePosition.MIDDLE]:jg},Yg=({src:r,imagePosition:e})=>{const t=Xg[e];return ae.jsx(t,{children:ae.jsx("img",{src:r,alt:""})})},Qg=Vn.b(Gg),Jg=Vn.b(vd),Zg=({notification:r,open:e,close:t,webos:i})=>{if(!r||!r.promotion||r.enabled!==Ce.NotificationEnabled.NOTIFICATION_ENABLED)return null;const{title:s,body:n,image:a,promotion:o}=r,{sponsorLogo:u,sponsorLogoMode:d,imagePosition:p,ctaButton:T}=o;return ae.jsxs(zg,{"data-webos":i,className:"SL_Lower_Third_Notification",onClick:i?void 0:e,children:[ae.jsxs(Bg,{children:[ae.jsx(Yg,{src:a,imagePosition:p}),ae.jsxs(Mg,{children:[s&&ae.jsx(Fg,{children:s}),n&&ae.jsx(Ug,{children:n})]})]}),ae.jsxs(Vg,{children:[d!==Ce.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&ae.jsxs(ae.Fragment,{children:[ae.jsx(qg,{children:ae.jsx("img",{src:u,alt:s})}),ae.jsx(Hg,{})]}),i?ae.jsxs(ae.Fragment,{children:[ae.jsx(Qg,{webos:!0,onClick:t,children:"Dismiss"}),ae.jsxs(Jg,{webos:!0,autoFocus:!0,style:{color:T?.textColor,backgroundColor:T?.color},onClick:e,children:[T?.ctaIcon&&T?.ctaIconMode===Ce.CtaIconMode.CTA_ICON_TRANSPARENT&&ae.jsx(yu,{src:T?.ctaIcon,alt:"cta-icon"}),T?.label||"Open"]})]}):ae.jsxs(vd,{name:"promo-button",style:{color:T?.textColor,backgroundColor:T?.color},children:[T?.ctaIcon&&T?.ctaIconMode===Ce.CtaIconMode.CTA_ICON_TRANSPARENT&&ae.jsx(yu,{src:T?.ctaIcon,alt:"cta-icon"}),T?.label||"Open"]})]})]})},e0=ge.styled_default("div")({name:"NotificationContent",class:"n1ku6hz",propsAsIs:!1}),t0=ge.styled_default("div")({name:"NotificationContainer",class:"nbxqmol",propsAsIs:!1}),i0=ge.styled_default("div")({name:"Body",class:"b1gu3eml",propsAsIs:!1}),r0=ge.styled_default("div")({name:"Title",class:"t1u17zva",propsAsIs:!1}),s0=ge.styled_default("div")({name:"Text",class:"t10ko1g",propsAsIs:!1}),Hn=ge.styled_default("div")({name:"Media",class:"mntc42e",propsAsIs:!1}),n0=()=>Hn,_u=ge.styled_default(n0())({name:"MediaImgFit",class:"ml060eo",propsAsIs:!0}),a0=()=>Hn,bd=ge.styled_default(a0())({name:"MediaImgCentered",class:"m1vqlvig",propsAsIs:!0}),o0=()=>bd,l0=ge.styled_default(o0())({name:"MediaImgBottom",class:"m1e7tvi5",propsAsIs:!0}),u0=()=>Hn,c0=ge.styled_default(u0())({name:"MediaImgSolid",class:"mqvntt2",propsAsIs:!0}),d0=()=>Hn,h0=ge.styled_default(d0())({name:"MediaImgMiddle",class:"m12jtj3u",propsAsIs:!0}),f0=ge.styled_default("img")({name:"CtaIcon",class:"ckq1frv",propsAsIs:!1}),p0=()=>Tg.B1,m0=ge.styled_default(p0())({name:"StyledChevronRight",class:"s9mjmz3",propsAsIs:!0}),g0=ge.styled_default("div")({name:"Logo",class:"l1cf50a7",propsAsIs:!1}),xd=ge.styled_default("button")({name:"TVButton",class:"thdqfl0",propsAsIs:!1}),y0=()=>xd,_0=ge.styled_default(y0())({name:"DismissButton",class:"d11pe8bx",propsAsIs:!0}),T0=()=>xd,v0=ge.styled_default(T0())({name:"OpenButton",class:"oy9k0kp",propsAsIs:!0}),b0={[Ce.NotificationPromotionImagePosition.UNSET]:_u,[Ce.NotificationPromotionImagePosition.FIT]:_u,[Ce.NotificationPromotionImagePosition.CENTERED]:bd,[Ce.NotificationPromotionImagePosition.BOTTOM]:l0,[Ce.NotificationPromotionImagePosition.SOLID]:c0,[Ce.NotificationPromotionImagePosition.MIDDLE]:h0},x0=({src:r,imagePosition:e})=>{const t=b0[e];return ae.jsx(t,{children:ae.jsx("img",{src:r,alt:""})})},S0=Vn.b(_0),E0=Vn.b(v0),C0=({notification:r,open:e,promotionId:t,hiding:i,direction:s="left",close:n,webos:a})=>{if(!r||!r.promotion||r.enabled!==Ce.NotificationEnabled.NOTIFICATION_ENABLED)return null;if(r.promotion.mode===Ce.NotificationPromotionMode.LOWER_THIRD)return ae.jsx(Zg,{notification:r,open:e,close:n,webos:a});const{title:o,body:u,image:d,promotion:p}=r,{sponsorLogo:T,sponsorLogoMode:A,imagePosition:b,ctaButton:k}=p,v=L=>{L.stopPropagation(),n?.()};return ae.jsx($o,{className:"SL_Rich_Notification",direction:s,hiding:i,children:ae.jsxs(t0,{onClick:a?()=>{}:e,children:[A!==Ce.NotificationSponsorLogoMode.NOTIFICATION_SPONSOR_LOGO_NONE&&T&&ae.jsx(g0,{children:ae.jsx("img",{src:T,alt:o})}),ae.jsxs(e0,{children:[ae.jsx(x0,{src:d,imagePosition:b}),ae.jsxs(i0,{children:[o&&ae.jsx(r0,{children:o}),u&&ae.jsx(s0,{children:u})]}),a&&ae.jsx(S0,{webos:!0,onClick:v,children:"Dismiss"}),ae.jsxs(E0,{webos:a,autoFocus:a,onClick:a?e:()=>{},name:"promo-button",style:{color:k?.textColor,backgroundColor:k?.color},children:[k?.ctaIcon&&k?.ctaIconMode===Ce.CtaIconMode.CTA_ICON_TRANSPARENT&&ae.jsx(f0,{src:k?.ctaIcon,alt:"cta-icon"}),k?.label||"Open"]}),ae.jsx(m0,{name:"chevronRight"})]})]})})},A0=ge.styled_default("div")({name:"OverlayContainer",class:"okzhq2w",propsAsIs:!1}),Sd=ge.styled_default("div")({name:"PromoOverlay",class:"pmgz5i",propsAsIs:!1}),Ed=ge.styled_default("div")({name:"Header",class:"hyxi3jt",propsAsIs:!1}),Cd=ge.styled_default("div")({name:"HeaderContent",class:"h149e3gp",propsAsIs:!1}),Ad="h10toh7",Tu=ge.styled_default("img")({name:"SponsorLogo",class:"s1jyea6t",propsAsIs:!1}),w0=ge.styled_default("div")({name:"SponsorName",class:"szpfa3h",propsAsIs:!1}),wd=ge.styled_default("div")({name:"Media",class:"m1crmu01",propsAsIs:!1}),D0=ge.styled_default("img")({name:"PromoImg",class:"p1l37r8s",propsAsIs:!1}),I0="s1nmch9k",vu=ge.styled_default("div")({name:"Content",class:"c1er0ljd",propsAsIs:!1}),k0=ge.styled_default("div")({name:"Description",class:"dydopmr",propsAsIs:!1}),P0=ge.styled_default("div")({name:"Sponsor",class:"s1w6nt04",propsAsIs:!1}),R0=ge.styled_default("div")({name:"SponsorText",class:"s1evcmtq",propsAsIs:!1}),Dd=ge.styled_default("div")({name:"ADLogo",class:"awodx0x",propsAsIs:!1}),L0=ge.styled_default("span")({name:"SponsoredText",class:"s1q3n6oi",propsAsIs:!1}),Id=ge.styled_default("div")({name:"ActionBtnWrap",class:"a8d4xfk",propsAsIs:!1}),kd=ge.styled_default("a")({name:"ActionButton",class:"at6oobh",propsAsIs:!1}),N0=ge.styled_default("div")({name:"Title",class:"t1gyg7tt",propsAsIs:!1}),O0="h17rwbtk",B0=ge.styled_default("div")({name:"Container",class:"c10m2bce",propsAsIs:!1}),bu=ge.styled_default("div")({name:"Item",class:"ig23yq5",propsAsIs:!1}),M0=ge.styled_default("div")({name:"Dot",class:"d1f6aqua",propsAsIs:!1}),F0=({time:r,adCount:e,adPosition:t})=>{const i=Math.floor(r/60),s=r-i*60;return i===0&&s===0&&e===t?null:ae.jsxs(B0,{children:[e>1&&ae.jsxs(ae.Fragment,{children:[ae.jsxs(bu,{children:[t," of ",e]}),ae.jsx(M0,{})]}),ae.jsxs(bu,{children:[i,":",s<10?`0${s}`:s]})]})},U0=ge.styled_default("a")({name:"WhyThisAdLink",class:"w13o8uld",propsAsIs:!1}),$0=({whyThisAd:r})=>{const[e,t]=Fe.useState(!1);return!r.iconClickThroughURLTemplate||!r.staticResource?null:ae.jsxs(U0,{style:{width:r.width,height:r.height,[r.xPosition]:3,[r.yPosition]:11},href:r.iconClickThroughURLTemplate,target:"_blank",rel:"noreferrer",children:[!e&&ae.jsx("img",{alt:"ad choice",src:r.staticResource,onLoad:()=>t(!1),onError:()=>t(!0)}),e&&ae.jsx("span",{children:"ad choice"})]})},j0=ge.styled_default("div")({name:"VideoControls",class:"v1xzooj9",propsAsIs:!1}),Pd=ge.styled_default("button")({name:"ControlBtn",class:"c1bo41vr",propsAsIs:!1}),q0=()=>Pd,V0=ge.styled_default(q0())({name:"MuteIcon",class:"m13efyu8",propsAsIs:!0}),H0=()=>Pd,z0=ge.styled_default(H0())({name:"PauseIcon",class:"pladkgh",propsAsIs:!0}),W0=ge.styled_default("div")({name:"Container",class:"cjnga56",propsAsIs:!1}),G0=ge.styled_default("div")({name:"ControlsContainer",class:"c7qs1am",propsAsIs:!1}),xu="m12n261r",Su="m16vcml8",Eu="m1078nk6";function jo(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:r.id||null,adId:r.adId||null,sequence:r.sequence||null,apiFramework:r.apiFramework||null,universalAdIds:[],creativeExtensions:[]}}const K0=["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 Cu(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const i=[],s=Ld(r);!e.ERRORCODE||t.isCustomCode||/^[0-9]{3}$/.test(e.ERRORCODE)||(e.ERRORCODE=900),e.CACHEBUSTING=Bd(Math.round(1e8*Math.random())),e.TIMESTAMP=new Date().toISOString(),e.RANDOM=e.random=e.CACHEBUSTING;for(const n in e)e[n]=Od(e[n]);for(const n in s){const a=s[n];typeof a=="string"&&i.push(Rd(a,e))}return i}function Rd(r,e){const t=(r=Au(r,e)).match(/[^[\]]+(?=])/g);if(!t)return r;let i=t.filter((s=>K0.indexOf(s)>-1));return i.length===0?r:(i=i.reduce(((s,n)=>(s[n]=-1,s)),{}),Au(r,i))}function Au(r,e){let t=r;for(const i in e){const s=e[i];t=t.replace(new RegExp("(?:\\[|%%)(".concat(i,")(?:\\]|%%)"),"g"),s)}return t}function Ld(r){return Array.isArray(r)?r.map((e=>e&&e.hasOwnProperty("url")?e.url:e)):r}function wu(r){return/^(https?:\/\/|\/\/)/.test(r)}function Du(r,e){for(let t=0;t<e.length;t++)if(Nd(e[t],r))return!0;return!1}function Nd(r,e){if(r&&e){const t=Object.getOwnPropertyNames(r),i=Object.getOwnPropertyNames(e);return t.length===i.length&&r.id===e.id&&r.url===e.url}return!1}function Od(r){return encodeURIComponent(r).replace(/[!'()*]/g,(e=>"%".concat(e.charCodeAt(0).toString(16))))}function Bd(r){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:8;return r.toString().padStart(e,"0")}const Ve={track:function(r,e,t){Cu(r,e,t).forEach((i=>{typeof window<"u"&&window!==null&&(new Image().src=i)}))},resolveURLTemplates:Cu,extractURLsFromTemplates:Ld,filterUrlTemplates:function(r){return r.reduce(((e,t)=>{const i=t.url||t;return wu(i)?e.validUrls.push(i):e.invalidUrls.push(i),e}),{validUrls:[],invalidUrls:[]})},containsTemplateObject:Du,isTemplateObjectEqual:Nd,encodeURIComponentRFC3986:Od,replaceUrlMacros:Rd,isNumeric:function(r){return!isNaN(parseFloat(r))&&isFinite(r)},flatten:function r(e){return e.reduce(((t,i)=>t.concat(Array.isArray(i)?r(i):i)),[])},joinArrayOfUniqueTemplateObjs:function(){let r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];const t=Array.isArray(r)?r:[],i=Array.isArray(e)?e:[];return t.concat(i).reduce(((s,n)=>(Du(n,s)||s.push(n),s)),[])},isValidTimeValue:function(r){return Number.isFinite(r)&&r>=-2},addLeadingZeros:Bd,isValidUrl:wu,isBrowserEnvironment:function(){return typeof window<"u"},formatMacrosValues:function(r){return typeof r!="object"?r:JSON.stringify(r)}};function Iu(r){return["true","TRUE","True","1"].includes(r)}function X0(r){if(r==null)return-1;if(Ve.isNumeric(r))return parseInt(r);const e=r.split(":");if(e.length!==3)return-1;const t=e[2].split(".");let i=parseInt(t[0]);t.length===2&&(i+=parseFloat("0.".concat(t[1])));const s=parseInt(60*e[1]),n=parseInt(60*e[0]*60);return isNaN(n)||isNaN(s)||isNaN(i)||s>3600||i>60?-1:n+s+i}const J={childByName:function(r,e){return Array.from(r.childNodes).find((t=>t.nodeName===e))},childrenByName:function(r,e){return Array.from(r.childNodes).filter((t=>t.nodeName===e))},resolveVastAdTagURI:function(r,e){if(!e)return r;if(r.startsWith("//")){const{protocol:t}=location;return"".concat(t).concat(r)}if(!r.includes("://")){const t=e.slice(0,e.lastIndexOf("/"));return"".concat(t,"/").concat(r)}return r},parseBoolean:Iu,parseNodeText:function(r){return r&&(r.textContent||r.text||"").trim()},copyNodeAttribute:function(r,e,t){const i=e.getAttribute(r);i&&t.setAttribute(r,i)},parseAttributes:function(r){return Array.from(r.attributes).reduce(((e,t)=>(e[t.nodeName]=t.nodeValue,e)),{})},parseDuration:X0,getStandAloneAds:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter((r=>!parseInt(r.sequence,10)))},getSortedAdPods:function(){return(arguments.length>0&&arguments[0]!==void 0?arguments[0]:[]).filter((r=>parseInt(r.sequence,10))).sort(((r,e)=>r.sequence-e.sequence))},assignAttributes:function(r,e){r&&Array.from(r).forEach((t=>{let{nodeName:i,nodeValue:s}=t;if(i&&s&&e.hasOwnProperty(i)){let n=s;typeof e[i]=="boolean"&&(n=Iu(n)),e[i]=n}}))},mergeWrapperAdData:function(r,e){var t;r.errorURLTemplates=e.errorURLTemplates.concat(r.errorURLTemplates),r.impressionURLTemplates=e.impressionURLTemplates.concat(r.impressionURLTemplates),r.extensions=e.extensions.concat(r.extensions),e.viewableImpression.length>0&&(r.viewableImpression=[...r.viewableImpression,...e.viewableImpression]),r.followAdditionalWrappers=e.followAdditionalWrappers,r.allowMultipleAds=e.allowMultipleAds,r.fallbackOnNoAd=e.fallbackOnNoAd;const i=(e.creatives||[]).filter((o=>o&&o.type==="companion")),s=i.reduce(((o,u)=>((u.variations||[]).forEach((d=>{(d.companionClickTrackingURLTemplates||[]).forEach((p=>{Ve.containsTemplateObject(p,o)||o.push(p)}))})),o)),[]);r.creatives=i.concat(r.creatives);const n=e.videoClickTrackingURLTemplates&&e.videoClickTrackingURLTemplates.length,a=e.videoCustomClickURLTemplates&&e.videoCustomClickURLTemplates.length;if(r.creatives.forEach((o=>{if(e.trackingEvents&&e.trackingEvents[o.type])for(const u in e.trackingEvents[o.type]){const d=e.trackingEvents[o.type][u];Array.isArray(o.trackingEvents[u])||(o.trackingEvents[u]=[]),o.trackingEvents[u]=o.trackingEvents[u].concat(d)}o.type==="linear"&&(n&&(o.videoClickTrackingURLTemplates=o.videoClickTrackingURLTemplates.concat(e.videoClickTrackingURLTemplates)),a&&(o.videoCustomClickURLTemplates=o.videoCustomClickURLTemplates.concat(e.videoCustomClickURLTemplates)),!e.videoClickThroughURLTemplate||o.videoClickThroughURLTemplate!==null&&o.videoClickThroughURLTemplate!==void 0||(o.videoClickThroughURLTemplate=e.videoClickThroughURLTemplate)),o.type==="companion"&&s.length&&(o.variations||[]).forEach((u=>{u.companionClickTrackingURLTemplates=Ve.joinArrayOfUniqueTemplateObjs(u.companionClickTrackingURLTemplates,s)}))})),e.adVerifications&&(r.adVerifications=r.adVerifications.concat(e.adVerifications)),e.blockedAdCategories&&(r.blockedAdCategories=r.blockedAdCategories.concat(e.blockedAdCategories)),(t=e.creatives)!==null&&t!==void 0&&t.length){const o=e.creatives.filter((u=>{var d;return((d=u.icons)===null||d===void 0?void 0:d.length)&&!u.mediaFiles.length}));o.length&&(r.creatives=r.creatives.concat(o))}}};function Y0(r,e){const t=(function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:o}=jo(i);return{id:s,adId:n,sequence:a,apiFramework:o,type:"companion",required:null,variations:[]}})(e);return t.required=r.getAttribute("required")||null,t.variations=J.childrenByName(r,"Companion").map((i=>{const s=(function(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return{id:o.id||null,adType:"companionAd",width:o.width||0,height:o.height||0,assetWidth:o.assetWidth||null,assetHeight:o.assetHeight||null,expandedWidth:o.expandedWidth||null,expandedHeight:o.expandedHeight||null,apiFramework:o.apiFramework||null,adSlotId:o.adSlotId||null,pxratio:o.pxratio||"1",renderingMode:o.renderingMode||"default",staticResources:[],htmlResources:[],iframeResources:[],adParameters:null,altText:null,companionClickThroughURLTemplate:null,companionClickTrackingURLTemplates:[],trackingEvents:{}}})(J.parseAttributes(i));s.htmlResources=J.childrenByName(i,"HTMLResource").reduce(((o,u)=>{const d=J.parseNodeText(u);return d?o.concat(d):o}),[]),s.iframeResources=J.childrenByName(i,"IFrameResource").reduce(((o,u)=>{const d=J.parseNodeText(u);return d?o.concat(d):o}),[]),s.staticResources=J.childrenByName(i,"StaticResource").reduce(((o,u)=>{const d=J.parseNodeText(u);return d?o.concat({url:d,creativeType:u.getAttribute("creativeType")||null}):o}),[]),s.altText=J.parseNodeText(J.childByName(i,"AltText"))||null;const n=J.childByName(i,"TrackingEvents");n&&J.childrenByName(n,"Tracking").forEach((o=>{const u=o.getAttribute("event"),d=J.parseNodeText(o);u&&d&&(Array.isArray(s.trackingEvents[u])||(s.trackingEvents[u]=[]),s.trackingEvents[u].push(d))})),s.companionClickTrackingURLTemplates=J.childrenByName(i,"CompanionClickTracking").map((o=>({id:o.getAttribute("id")||null,url:J.parseNodeText(o)}))),s.companionClickThroughURLTemplate=J.parseNodeText(J.childByName(i,"CompanionClickThrough"))||null;const a=J.childByName(i,"AdParameters");return a&&(s.adParameters={value:J.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),s})),t}function Q0(r,e){let t;const i=(function(){let u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:d,adId:p,sequence:T,apiFramework:A}=jo(u);return{id:d,adId:p,sequence:T,apiFramework:A,type:"linear",duration:0,skipDelay:null,mediaFiles:[],mezzanine:null,interactiveCreativeFile:null,closedCaptionFiles:[],videoClickThroughURLTemplate:null,videoClickTrackingURLTemplates:[],videoCustomClickURLTemplates:[],adParameters:null,icons:[],trackingEvents:{}}})(e);i.duration=J.parseDuration(J.parseNodeText(J.childByName(r,"Duration")));const s=r.getAttribute("skipoffset");if(s==null)i.skipDelay=null;else if(s.charAt(s.length-1)==="%"&&i.duration!==-1){const u=parseInt(s,10);i.skipDelay=i.duration*(u/100)}else i.skipDelay=J.parseDuration(s);const n=J.childByName(r,"VideoClicks");if(n){const u=J.childByName(n,"ClickThrough");i.videoClickThroughURLTemplate=u?{id:u.getAttribute("id")||null,url:J.parseNodeText(u)}:null,J.childrenByName(n,"ClickTracking").forEach((d=>{i.videoClickTrackingURLTemplates.push({id:d.getAttribute("id")||null,url:J.parseNodeText(d)})})),J.childrenByName(n,"CustomClick").forEach((d=>{i.videoCustomClickURLTemplates.push({id:d.getAttribute("id")||null,url:J.parseNodeText(d)})}))}const a=J.childByName(r,"AdParameters");a&&(i.adParameters={value:J.parseNodeText(a),xmlEncoded:a.getAttribute("xmlEncoded")||null}),J.childrenByName(r,"TrackingEvents").forEach((u=>{J.childrenByName(u,"Tracking").forEach((d=>{let p=d.getAttribute("event");const T=J.parseNodeText(d);if(p&&T){if(p==="progress"){if(t=d.getAttribute("offset"),!t)return;p=t.charAt(t.length-1)==="%"?"progress-".concat(t):"progress-".concat(J.parseDuration(t))}Array.isArray(i.trackingEvents[p])||(i.trackingEvents[p]=[]),i.trackingEvents[p].push(T)}}))})),J.childrenByName(r,"MediaFiles").forEach((u=>{J.childrenByName(u,"MediaFile").forEach((b=>{i.mediaFiles.push((function(k){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=k.getAttribute("id"),v.fileURL=J.parseNodeText(k),v.deliveryType=k.getAttribute("delivery"),v.codec=k.getAttribute("codec"),v.mimeType=k.getAttribute("type"),v.mediaType=k.getAttribute("mediaType")||"2D",v.apiFramework=k.getAttribute("apiFramework"),v.fileSize=parseInt(k.getAttribute("fileSize")||0),v.bitrate=parseInt(k.getAttribute("bitrate")||0),v.minBitrate=parseInt(k.getAttribute("minBitrate")||0),v.maxBitrate=parseInt(k.getAttribute("maxBitrate")||0),v.width=parseInt(k.getAttribute("width")||0),v.height=parseInt(k.getAttribute("height")||0);const L=k.getAttribute("scalable");L&&typeof L=="string"&&(v.scalable=J.parseBoolean(L));const U=k.getAttribute("maintainAspectRatio");return U&&typeof U=="string"&&(v.maintainAspectRatio=J.parseBoolean(U)),v})(b))}));const d=J.childByName(u,"InteractiveCreativeFile");d&&(i.interactiveCreativeFile=(function(b){const k=(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(b));return k.fileURL=J.parseNodeText(b),k})(d));const p=J.childByName(u,"ClosedCaptionFiles");p&&J.childrenByName(p,"ClosedCaptionFile").forEach((b=>{const k=(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(b));k.fileURL=J.parseNodeText(b),i.closedCaptionFiles.push(k)}));const T=J.childByName(u,"Mezzanine"),A=(function(b,k){const v={};let L=!1;return k.forEach((U=>{b&&b.getAttribute(U)?v[U]=b.getAttribute(U):L=!0})),L?null:v})(T,["delivery","type","width","height"]);if(A){const b={id:null,fileURL:null,delivery:null,codec:null,type:null,width:0,height:0,fileSize:0,mediaType:"2D"};b.id=T.getAttribute("id"),b.fileURL=J.parseNodeText(T),b.delivery=A.delivery,b.codec=T.getAttribute("codec"),b.type=A.type,b.width=parseInt(A.width,10),b.height=parseInt(A.height,10),b.fileSize=parseInt(T.getAttribute("fileSize"),10),b.mediaType=T.getAttribute("mediaType")||"2D",i.mezzanine=b}}));const o=J.childByName(r,"Icons");return o&&J.childrenByName(o,"Icon").forEach((u=>{i.icons.push((function(d){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=d.getAttribute("program"),p.height=parseInt(d.getAttribute("height")||0),p.width=parseInt(d.getAttribute("width")||0),p.xPosition=(function(A){return["left","right"].indexOf(A)!==-1?A:parseInt(A||0)})(d.getAttribute("xPosition")),p.yPosition=(function(A){return["top","bottom"].indexOf(A)!==-1?A:parseInt(A||0)})(d.getAttribute("yPosition")),p.apiFramework=d.getAttribute("apiFramework"),p.pxratio=d.getAttribute("pxratio")||"1",p.offset=J.parseDuration(d.getAttribute("offset")),p.duration=J.parseDuration(d.getAttribute("duration")),p.altText=d.getAttribute("altText"),p.hoverText=d.getAttribute("hoverText"),J.childrenByName(d,"HTMLResource").forEach((A=>{p.type=A.getAttribute("creativeType")||"text/html",p.htmlResource=J.parseNodeText(A)})),J.childrenByName(d,"IFrameResource").forEach((A=>{p.type=A.getAttribute("creativeType")||0,p.iframeResource=J.parseNodeText(A)})),J.childrenByName(d,"StaticResource").forEach((A=>{p.type=A.getAttribute("creativeType")||0,p.staticResource=J.parseNodeText(A)}));const T=J.childByName(d,"IconClicks");if(T){p.iconClickThroughURLTemplate=J.parseNodeText(J.childByName(T,"IconClickThrough")),J.childrenByName(T,"IconClickTracking").forEach((b=>{p.iconClickTrackingURLTemplates.push({id:b.getAttribute("id")||null,url:J.parseNodeText(b)})}));const A=J.childByName(T,"IconClickFallbackImages");A&&J.childrenByName(A,"IconClickFallbackImage").forEach((b=>{p.iconClickFallbackImages.push({url:J.parseNodeText(b)||null,width:b.getAttribute("width")||null,height:b.getAttribute("height")||null})}))}return p.iconViewTrackingURLTemplate=J.parseNodeText(J.childByName(d,"IconViewTracking")),p})(u))})),i}function J0(r,e){const t=(function(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{id:s,adId:n,sequence:a,apiFramework:o}=jo(i);return{id:s,adId:n,sequence:a,apiFramework:o,type:"nonlinear",variations:[],trackingEvents:{}}})(e);return J.childrenByName(r,"TrackingEvents").forEach((i=>{let s,n;J.childrenByName(i,"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(r,"NonLinear").forEach((i=>{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=i.getAttribute("id")||null,s.width=i.getAttribute("width"),s.height=i.getAttribute("height"),s.expandedWidth=i.getAttribute("expandedWidth"),s.expandedHeight=i.getAttribute("expandedHeight"),s.scalable=J.parseBoolean(i.getAttribute("scalable")),s.maintainAspectRatio=J.parseBoolean(i.getAttribute("maintainAspectRatio")),s.minSuggestedDuration=J.parseDuration(i.getAttribute("minSuggestedDuration")),s.apiFramework=i.getAttribute("apiFramework"),J.childrenByName(i,"HTMLResource").forEach((a=>{s.type=a.getAttribute("creativeType")||"text/html",s.htmlResource=J.parseNodeText(a)})),J.childrenByName(i,"IFrameResource").forEach((a=>{s.type=a.getAttribute("creativeType")||0,s.iframeResource=J.parseNodeText(a)})),J.childrenByName(i,"StaticResource").forEach((a=>{s.type=a.getAttribute("creativeType")||0,s.staticResource=J.parseNodeText(a)}));const n=J.childByName(i,"AdParameters");n&&(s.adParameters={value:J.parseNodeText(n),xmlEncoded:n.getAttribute("xmlEncoded")||null}),s.nonlinearClickThroughURLTemplate=J.parseNodeText(J.childByName(i,"NonLinearClickThrough")),J.childrenByName(i,"NonLinearClickTracking").forEach((a=>{s.nonlinearClickTrackingURLTemplates.push({id:a.getAttribute("id")||null,url:J.parseNodeText(a)})})),t.variations.push(s)})),t}function ku(r){const e=[];return r.forEach((t=>{const i=Md(t);i&&e.push(i)})),e}function Md(r){if(r.nodeName==="#comment")return null;const e={name:null,value:null,attributes:{},children:[]},t=r.attributes,i=r.childNodes;if(e.name=r.nodeName,r.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 i)if(i.hasOwnProperty(n)){const a=Md(i[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(r);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 Z0(r){return r.getAttribute("AdID")||r.getAttribute("adID")||r.getAttribute("adId")||null}const gn={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 Pu(r,e){if(!gn[r.nodeName]||!gn[r.nodeName].attributes)return;const t=gn[r.nodeName].attributes.filter((i=>!r.getAttribute(i)));t.length>0&&As({name:r.nodeName,parentName:r.parentNode.nodeName,attributes:t},e)}function Ru(r,e,t){const i=gn[r.nodeName],s=!t&&r.nodeName!=="Wrapper";if(!(!i||s)){if(i.subElements){const n=i.subElements.filter((a=>!J.childByName(r,a)));n.length>0&&As({name:r.nodeName,parentName:r.parentNode.nodeName,subElements:n},e)}!t||!i.oneOfinLineResources||i.oneOfinLineResources.some((n=>J.childByName(r,n)))||As({name:r.nodeName,parentName:r.parentNode.nodeName,oneOfResources:i.oneOfinLineResources},e)}}function Lu(r){return r.children&&r.children.length!==0}function As(r,e){let{name:t,parentName:i,attributes:s,subElements:n,oneOfResources:a}=r,o="Element '".concat(t,"'");o+=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:o,parentElement:i,specVersion:4.1})}const ey={verifyRequiredValues:function r(e,t,i){if(e&&e.nodeName)if(e.nodeName==="InLine"&&(i=!0),Pu(e,t),Lu(e)){Ru(e,t,i);for(let s=0;s<e.children.length;s++)r(e.children[s],t,i)}else J.parseNodeText(e).length===0&&As({name:e.nodeName,parentName:e.parentNode.nodeName},t)},hasSubElements:Lu,emitMissingValueWarning:As,verifyRequiredAttributes:Pu,verifyRequiredSubElements:Ru};function ty(r,e){let{allowMultipleAds:t,followAdditionalWrappers:i}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const s=Array.from(r.childNodes).filter((n=>{const a=n.nodeName.toLowerCase();return a==="inline"||i!==!1&&a==="wrapper"}));for(const n of s){if(J.copyNodeAttribute("id",r,n),J.copyNodeAttribute("sequence",r,n),J.copyNodeAttribute("adType",r,n),n.nodeName==="Wrapper")return{ad:ry(n,e),type:"WRAPPER"};if(n.nodeName==="InLine")return{ad:iy(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 iy(r,e){let{allowMultipleAds:t}=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return t===!1&&r.getAttribute("sequence")?null:Fd(r,e)}function Fd(r,e){let t=[];e&&ey.verifyRequiredValues(r,e);const i=Array.from(r.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(r));return i.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 o=[];return a.forEach((u=>{const d={id:u.getAttribute("id")||null,adId:Z0(u),sequence:u.getAttribute("sequence")||null,apiFramework:u.getAttribute("apiFramework")||null},p=[];let T;J.childrenByName(u,"UniversalAdId").forEach((b=>{const k={idRegistry:b.getAttribute("idRegistry")||"unknown",value:J.parseNodeText(b)};p.push(k)}));const A=J.childByName(u,"CreativeExtensions");A&&(T=ku(J.childrenByName(A,"CreativeExtension")));for(const b in u.childNodes){const k=u.childNodes[b];let v;switch(k.nodeName){case"Linear":v=Q0(k,d);break;case"NonLinearAds":v=J0(k,d);break;case"CompanionAds":v=Y0(k,d)}v&&(p&&(v.universalAdIds=p),T&&(v.creativeExtensions=T),o.push(v))}})),o})(J.childrenByName(n,"Creative"));break;case"Extensions":{const a=J.childrenByName(n,"Extension");s.extensions=ku(a),s.adVerifications.length||(t=(function(o){let u=null,d=[];return o.some((p=>u=J.childByName(p,"AdVerifications"))),u&&(d=Nu(J.childrenByName(u,"Verification"))),d})(a));break}case"AdVerifications":s.adVerifications=Nu(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 o=(u,d)=>{const p=J.parseNodeText(d);return p&&u.push(p),u};return{id:a.getAttribute("id")||null,viewable:J.childrenByName(a,"Viewable").reduce(o,[]),notViewable:J.childrenByName(a,"NotViewable").reduce(o,[]),viewUndetermined:J.childrenByName(a,"ViewUndetermined").reduce(o,[])}})(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 ry(r,e){const t=Fd(r,e),i=r.getAttribute("followAdditionalWrappers"),s=r.getAttribute("allowMultipleAds"),n=r.getAttribute("fallbackOnNoAd");t.followAdditionalWrappers=!i||J.parseBoolean(i),t.allowMultipleAds=!!s&&J.parseBoolean(s),t.fallbackOnNoAd=n?J.parseBoolean(n):null;let a=J.childByName(r,"VASTAdTagURI");if(a?t.nextWrapperURL=J.parseNodeText(a):(a=J.childByName(r,"VASTAdTagURL"),a&&(t.nextWrapperURL=J.parseNodeText(J.childByName(a,"URL")))),t.creatives.forEach((o=>{if(["linear","nonlinear"].includes(o.type)){if(o.trackingEvents){t.trackingEvents||(t.trackingEvents={}),t.trackingEvents[o.type]||(t.trackingEvents[o.type]={});for(const u in o.trackingEvents){const d=o.trackingEvents[u];Array.isArray(t.trackingEvents[o.type][u])||(t.trackingEvents[o.type][u]=[]),d.forEach((p=>{t.trackingEvents[o.type][u].push(p)}))}}o.videoClickTrackingURLTemplates&&(Array.isArray(t.videoClickTrackingURLTemplates)||(t.videoClickTrackingURLTemplates=[]),o.videoClickTrackingURLTemplates.forEach((u=>{t.videoClickTrackingURLTemplates.push(u)}))),o.videoClickThroughURLTemplate&&(t.videoClickThroughURLTemplate=o.videoClickThroughURLTemplate),o.videoCustomClickURLTemplates&&(Array.isArray(t.videoCustomClickURLTemplates)||(t.videoCustomClickURLTemplates=[]),o.videoCustomClickURLTemplates.forEach((u=>{t.videoCustomClickURLTemplates.push(u)})))}})),t.nextWrapperURL)return t}function Nu(r){const e=[];return r.forEach((t=>{const i={resource:null,vendor:null,browserOptional:!1,apiFramework:null,type:null,parameters:null,trackingEvents:{}},s=Array.from(t.childNodes);J.assignAttributes(t.attributes,i),s.forEach((a=>{let{nodeName:o,textContent:u,attributes:d}=a;switch(o){case"JavaScriptResource":case"ExecutableResource":i.resource=u.trim(),J.assignAttributes(d,i);break;case"VerificationParameters":i.parameters=u.trim()}}));const n=J.childByName(t,"TrackingEvents");n&&J.childrenByName(n,"Tracking").forEach((a=>{const o=a.getAttribute("event"),u=J.parseNodeText(a);o&&u&&(Array.isArray(i.trackingEvents[o])||(i.trackingEvents[o]=[]),i.trackingEvents[o].push(u))})),e.push(i)})),e}let Ud=class{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(i,s,n){const a={fired:!1,wrapFn:void 0};function o(){a.fired||(i.off(s,a.wrapFn),a.fired=!0,n.bind(i)(...arguments))}return a.wrapFn=o,o})(this,e,t))}off(e,t){return this._handlers=this._handlers.filter((i=>i.event!==e||i.handler!==t)),this}emit(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),s=1;s<t;s++)i[s-1]=arguments[s];let n=!1;return this._handlers.forEach((a=>{a.event==="*"&&(n=!0,a.handler(e,...i)),a.event===e&&(n=!0,a.handler(...i))})),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,i)=>(i.event===e&&t.push(i.handler),t)),[])}eventNames(){return this._handlers.map((e=>e.event))}},Ou=0,co=0;const $d=(r,e)=>{!r||!e||r<=0||e<=0||(co=(co*Ou+8*r/e)/++Ou)},sy={ERRORCODE:900,extensions:[]},Bu="VAST response version not supported";class ny extends Ud{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 i=arguments.length,s=new Array(i>2?i-2:0),n=2;n<i;n++)s[n-2]=arguments[n];this.emit("VAST-error",Object.assign({},sy,t,...s)),Ve.track(e,t)}getErrorURLTemplates(){return this.rootErrorURLTemplates.concat(this.errorURLTemplates)}getEstimatedBitrate(){return co}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(),$d(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((i=>this.buildVASTResponse(i)))}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((i=>this.buildVASTResponse(i)))}buildVASTResponse(e){const t=(function(i){let{ads:s,errorURLTemplates:n,version:a}=i;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:i=!1,url:s=null,wrapperDepth:n=0,allowMultipleAds:a,followAdditionalWrappers:o}=t;if(!e||!e.documentElement||e.documentElement.nodeName!=="VAST"){var u;this.emit("VAST-ad-parsed",{type:"ERROR",url:s,wrapperDepth:n});const A=(e==null||(u=e.documentElement)===null||u===void 0?void 0:u.nodeName)==="VideoAdServingTemplate";throw new Error(A?Bu:"Invalid VAST XMLDocument")}const d=[],p=e.documentElement.childNodes,T=e.documentElement.getAttribute("version");i&&T&&(this.vastVersion=T);for(const A in p){const b=p[A];if(b.nodeName==="Error"){const k=J.parseNodeText(b);i?this.rootErrorURLTemplates.push(k):this.errorURLTemplates.push(k)}else if(b.nodeName==="Ad"){if(this.vastVersion&&parseFloat(this.vastVersion)<3)a=!0;else if(a===!1&&d.length>1)break;const k=ty(b,this.emit.bind(this),{allowMultipleAds:a,followAdditionalWrappers:o});k.ad?(d.push(k.ad),this.emit("VAST-ad-parsed",{type:k.type,url:s,wrapperDepth:n,adIndex:d.length-1,vastVersion:T})):this.trackVastError(this.getErrorURLTemplates(),{ERRORCODE:101})}}return d}parse(e){let{url:t=null,resolveAll:i=!0,wrapperSequence:s=null,previousUrl:n=null,wrapperDepth:a=0,isRootVAST:o=!1,followAdditionalWrappers:u,allowMultipleAds:d}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},p=[];this.vastVersion&&parseFloat(this.vastVersion)<3&&o&&(d=!0);try{p=this.parseVastXml(e,{isRootVAST:o,url:t,wrapperDepth:a,allowMultipleAds:d,followAdditionalWrappers:u})}catch(T){return Promise.reject(T)}if(p.length===1&&s!=null&&(p[0].sequence=s),i===!1){const T=J.getSortedAdPods(p),A=J.getStandAloneAds(p);T.length?p=T:A.length&&(p=[A.shift()]),this.remainingAds=A}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:i,url:s}=arguments.length>1?arguments[1]:void 0;const n=[];return i=s,e.forEach((a=>{const o=this.resolveWrappers(a,t,i);n.push(o)})),Promise.all(n).then((a=>Ve.flatten(a)))}resolveWrappers(e,t,i){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,i);const o=(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((d=>this.parse(d,{url:s.nextWrapperURL,previousUrl:i,wrapperSequence:u,wrapperDepth:t,followAdditionalWrappers:s.followAdditionalWrappers,allowMultipleAds:o}).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((d=>{s.errorCode=d.message===Bu?102:301,s.errorMessage=d.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 i=e.ads[t],s=!i.creatives.some((n=>{var a,o;return((a=n.mediaFiles)===null||a===void 0?void 0:a.length)>0||((o=n.variations)===null||o===void 0?void 0:o.length)>0}));!i.errorCode&&!s||i.VASTAdTagURI||(this.trackVastError(i.errorURLTemplates.concat(e.errorURLTemplates),{ERRORCODE:i.errorCode||303},{ERRORMESSAGE:i.errorMessage||""},{extensions:i.extensions},{system:i.system}),this.keepFailedAdPod&&i.sequence?i.hasFailed=!0:e.ads.splice(t,1))}}}let Pi=null;const ay={data:{},length:0,getItem(r){return this.data[r]},setItem(r,e){this.data[r]=e,this.length=Object.keys(this.data).length},removeItem(r){delete this.data[r],this.length=Object.keys(this.data).length},clear(){this.data={},this.length=0}};class oy{constructor(){this.storage=this.initStorage()}initStorage(){if(Pi)return Pi;try{Pi=typeof window<"u"&&window!==null?window.localStorage||window.sessionStorage:null}catch{Pi=null}return Pi&&!this.isStorageDisabled(Pi)||(Pi=ay,Pi.clear()),Pi}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 ho=12e4,ly={get:async function(r,e){try{const t=new AbortController,i=setTimeout((()=>{throw t.abort(),new Error("URLHandler: Request timed out after ".concat(e.timeout||ho," ms (408)"))}),e.timeout||ho),s=await fetch(r,{...e,signal:t.signal,credentials:e.withCredentials?"include":"omit"}).finally((()=>{clearTimeout(i)})),n=(function(a){return Ve.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 o=await a.text();let u;return u=Ve.isBrowserEnvironment()?new DOMParser:new(await Promise.resolve().then(()=>u_)).DOMParser,{xml:u.parseFromString(o,"text/xml"),details:{byteLength:o.length,statusCode:a.status,rawXml:o}}})(s)}catch(t){return{error:t,statusCode:t.name==="AbortError"?408:null}}}};let uy=class{constructor(){this.URLTemplateFilters=[]}setOptions(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.urlHandler=e.urlHandler||e.urlhandler||ly,this.fetchingOptions={...e.fetchOptions,timeout:e.timeout||ho,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:i,maxWrapperDepth:s,emitter:n,wrapperDepth:a=0,previousUrl:o=null,wrapperAd:u=null}=e;const d=Date.now();this.URLTemplateFilters.forEach((A=>{i=A(i)})),n("VAST-resolving",{url:i,previousUrl:o,wrapperDepth:a,maxWrapperDepth:s,timeout:this.fetchingOptions.timeout,wrapperAd:u});const p=await this.urlHandler.get(i,this.fetchingOptions),T=Math.round(Date.now()-d);if(n("VAST-resolved",{url:i,previousUrl:o,wrapperDepth:a,error:p?.error||null,duration:T,statusCode:p?.statusCode||null,...p?.details}),$d(p==null||(t=p.details)===null||t===void 0?void 0:t.byteLength,T),p.error)throw new Error(p.error);return p.xml}},cy=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,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:new oy;this.cappingFreeLunch=e,this.cappingMinimumTimeInterval=t,this.fetcher=new uy,this.vastParser=new ny({fetcher:this.fetcher}),this.storage=i,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 i=Date.now();return t.hasOwnProperty("resolveAll")||(t.resolveAll=!1),this.totalCallsTimeout<i?(this.totalCalls=1,this.totalCallsTimeout=i+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=i-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((o=>(t.previousUrl=e,t.isRootVAST=!0,t.url=e,this.vastParser.parse(o,t).then((u=>{const d=this.vastParser.buildVASTResponse(u);s(d)}))))).catch((o=>n(o)))}))}};class dy extends Ud{constructor(e,t,i){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=i,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 o in this.creative.trackingEvents){const u=this.creative.trackingEvents[o];this.trackingEvents[o]=u.slice(0)}this.viewableImpressionTrackers=((s=this.ad.viewableImpression)===null||s===void 0?void 0:s.reduce(((o,u)=>(o.notViewable.push(...u.notViewable),o.viewUndetermined.push(...u.viewUndetermined),o.viewable.push(...u.viewable),o)),{notViewable:[],viewUndetermined:[],viewable:[]}))||{},Object.entries(this.viewableImpressionTrackers).forEach((o=>{let[u,d]=o;d.length&&(this.trackingEvents[u]=d)})),(function(o){return o.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){Ve.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]:{},i=!(arguments.length>2&&arguments[2]!==void 0)||arguments[2];if(!Ve.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(Ve.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 o=this.lastPercentage;o<n;o++)a.push("progress-".concat(o+1,"%"));a.push("progress-".concat(e));for(const o in this.quartiles)this.isQuartileReached(o,this.quartiles[o],e)&&(a.push(o),this._alreadyTriggeredQuartiles[o]=!0);this.lastPercentage=n}a.forEach((o=>{this.track(o,{macros:t,once:i})})),e<this.progress&&(this.track("rewind",{macros:t}),this.trackedProgressEvents&&this.trackedProgressEvents.splice(0))}this.progress=e}isQuartileReached(e,t,i){let s=!1;return t<=i&&!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(Ve.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(Ve.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(Ve.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(Ve.formatMacrosValues(t))})}setSkipDelay(e){Ve.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(Ve.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(Ve.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 i=this.ad.adVerifications.find((n=>n.vendor===e));if(!i)throw new Error("No associated verification element found for vendor: ".concat(e));const s=i.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(Ve.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(Ve.formatMacrosValues(t))});this.clickTrackingURLTemplates&&this.clickTrackingURLTemplates.length&&this.trackURLs(this.clickTrackingURLTemplates,t);const i=this.clickThroughURLTemplate||e,s={...t};if(i){this.progress&&(s.ADPLAYHEAD=this.progressFormatted());const n=Ve.resolveURLTemplates([i],s)[0];this.emit("clickthrough",n)}}trackProgressEvents(e,t,i){const s=parseFloat(e.split("-")[1]);Object.entries(this.trackingEvents).filter((n=>{let[a]=n;return a.startsWith("progress-")})).map((n=>{let[a,o]=n;return{name:a,time:parseFloat(a.split("-")[1]),urls:o}})).filter((n=>{let{time:a}=n;return a<=s&&a>this.progress})).forEach((n=>{let{name:a,urls:o}=n;!i&&this.trackedProgressEvents.includes(a)||(this.emit(a,{trackingURLTemplates:o}),this.trackURLs(o,t),i?delete this.trackingEvents[a]:this.trackedProgressEvents.push(a))}))}track(e){let{macros:t={},once:i=!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,i);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),i&&(delete this.trackingEvents[e],n&&this.emitAlwaysEvents.splice(this.emitAlwaysEvents.indexOf(e),1))}trackURLs(e){var t;let i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const{validUrls:n,invalidUrls:a}=Ve.filterUrlTemplates(e);a.length&&this.emit("TRACKER-error",{message:"Provided urls are malformed. url: ".concat(a)});const o={...i};this.linear&&(this.creative&&this.creative.mediaFiles&&this.creative.mediaFiles[0]&&this.creative.mediaFiles[0].fileURL&&(o.ASSETURI=this.creative.mediaFiles[0].fileURL),this.progress&&(o.ADPLAYHEAD=this.progressFormatted())),(t=this.creative)!==null&&t!==void 0&&(t=t.universalAdIds)!==null&&t!==void 0&&t.length&&(o.UNIVERSALADID=this.creative.universalAdIds.map((u=>u.idRegistry.concat(" ",u.value))).join(",")),this.ad&&(this.ad.sequence&&(o.PODSEQUENCE=this.ad.sequence),this.ad.adType&&(o.ADTYPE=this.ad.adType),this.ad.adServingId&&(o.ADSERVINGID=this.ad.adServingId),this.ad.categories&&this.ad.categories.length&&(o.ADCATEGORIES=this.ad.categories.map((u=>u.value)).join(",")),this.ad.blockedAdCategories&&this.ad.blockedAdCategories.length&&(o.BLOCKEDADCATEGORIES=this.ad.blockedAdCategories.map((u=>u.value)).join(","))),Ve.track(n,o,s)}convertToTimecode(e){if(!Ve.isValidTimeValue(e))return"";const t=1e3*e,i=Math.floor(t/36e5),s=Math.floor(t/6e4%60),n=Math.floor(t/1e3%60),a=Math.floor(t%1e3);return"".concat(Ve.addLeadingZeros(i,2),":").concat(Ve.addLeadingZeros(s,2),":").concat(Ve.addLeadingZeros(n,2),".").concat(Ve.addLeadingZeros(a,3))}progressFormatted(){return this.convertToTimecode(this.progress)}}var Ia,Mu;function zn(){if(Mu)return Ia;Mu=1;var r;return typeof window<"u"?r=window:typeof ui.commonjsGlobal<"u"?r=ui.commonjsGlobal:typeof self<"u"?r=self:r={},Ia=r,Ia}var hy=zn();const N=ui.getDefaultExportFromCjs(hy),fy={},py=Object.freeze(Object.defineProperty({__proto__:null,default:fy},Symbol.toStringTag,{value:"Module"})),my=ui.getAugmentedNamespace(py);var ka,Fu;function jd(){if(Fu)return ka;Fu=1;var r=typeof ui.commonjsGlobal<"u"?ui.commonjsGlobal:typeof window<"u"?window:{},e=my,t;return typeof document<"u"?t=document:(t=r["__GLOBAL_DOCUMENT_CACHE@4"],t||(t=r["__GLOBAL_DOCUMENT_CACHE@4"]=e)),ka=t,ka}var gy=jd();const he=ui.getDefaultExportFromCjs(gy);var ln={exports:{}},Pa={exports:{}},Uu;function yy(){return Uu||(Uu=1,(function(r){function e(){return r.exports=e=Object.assign?Object.assign.bind():function(t){for(var i=1;i<arguments.length;i++){var s=arguments[i];for(var n in s)({}).hasOwnProperty.call(s,n)&&(t[n]=s[n])}return t},r.exports.__esModule=!0,r.exports.default=r.exports,e.apply(null,arguments)}r.exports=e,r.exports.__esModule=!0,r.exports.default=r.exports})(Pa)),Pa.exports}var Ra,$u;function _y(){if($u)return Ra;$u=1,Ra=e;var r=Object.prototype.toString;function e(t){if(!t)return!1;var i=r.call(t);return i==="[object Function]"||typeof t=="function"&&i!=="[object RegExp]"||typeof window<"u"&&(t===window.setTimeout||t===window.alert||t===window.confirm||t===window.prompt)}return Ra}var La,ju;function Ty(){if(ju)return La;ju=1;function r(s,n){var a=typeof Symbol<"u"&&s[Symbol.iterator]||s["@@iterator"];if(a)return(a=a.call(s)).next.bind(a);if(Array.isArray(s)||(a=e(s))||n){a&&(s=a);var o=0;return function(){return o>=s.length?{done:!0}:{done:!1,value:s[o++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function e(s,n){if(s){if(typeof s=="string")return t(s,n);var a=Object.prototype.toString.call(s).slice(8,-1);if(a==="Object"&&s.constructor&&(a=s.constructor.name),a==="Map"||a==="Set")return Array.from(s);if(a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a))return t(s,n)}}function t(s,n){(n==null||n>s.length)&&(n=s.length);for(var a=0,o=new Array(n);a<n;a++)o[a]=s[a];return o}var i=(function(){function s(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1}var n=s.prototype;return n.getIsEnabled=function(){return this.enabled_},n.enable=function(){this.enabled_=!0},n.disable=function(){this.enabled_=!1},n.reset=function(){this.typeToInterceptorsMap_=new Map,this.enabled_=!1},n.addInterceptor=function(o,u){this.typeToInterceptorsMap_.has(o)||this.typeToInterceptorsMap_.set(o,new Set);var d=this.typeToInterceptorsMap_.get(o);return d.has(u)?!1:(d.add(u),!0)},n.removeInterceptor=function(o,u){var d=this.typeToInterceptorsMap_.get(o);return d&&d.has(u)?(d.delete(u),!0):!1},n.clearInterceptorsByType=function(o){var u=this.typeToInterceptorsMap_.get(o);return u?(this.typeToInterceptorsMap_.delete(o),this.typeToInterceptorsMap_.set(o,new Set),!0):!1},n.clear=function(){return this.typeToInterceptorsMap_.size?(this.typeToInterceptorsMap_=new Map,!0):!1},n.getForType=function(o){return this.typeToInterceptorsMap_.get(o)||new Set},n.execute=function(o,u){for(var d=this.getForType(o),p=r(d),T;!(T=p()).done;){var A=T.value;try{u=A(u)}catch{}}return u},s})();return La=i,La}var Na,qu;function vy(){if(qu)return Na;qu=1;var r=(function(){function t(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1}var i=t.prototype;return i.getIsEnabled=function(){return this.enabled_},i.enable=function(){this.enabled_=!0},i.disable=function(){this.enabled_=!1},i.reset=function(){this.maxAttempts_=1,this.delayFactor_=.1,this.fuzzFactor_=.1,this.initialDelay_=1e3,this.enabled_=!1},i.getMaxAttempts=function(){return this.maxAttempts_},i.setMaxAttempts=function(n){this.maxAttempts_=n},i.getDelayFactor=function(){return this.delayFactor_},i.setDelayFactor=function(n){this.delayFactor_=n},i.getFuzzFactor=function(){return this.fuzzFactor_},i.setFuzzFactor=function(n){this.fuzzFactor_=n},i.getInitialDelay=function(){return this.initialDelay_},i.setInitialDelay=function(n){this.initialDelay_=n},i.createRetry=function(n){var a=n===void 0?{}:n,o=a.maxAttempts,u=a.delayFactor,d=a.fuzzFactor,p=a.initialDelay;return new e({maxAttempts:o||this.maxAttempts_,delayFactor:u||this.delayFactor_,fuzzFactor:d||this.fuzzFactor_,initialDelay:p||this.initialDelay_})},t})(),e=(function(){function t(s){this.maxAttempts_=s.maxAttempts,this.delayFactor_=s.delayFactor,this.fuzzFactor_=s.fuzzFactor,this.currentDelay_=s.initialDelay,this.currentAttempt_=1}var i=t.prototype;return i.moveToNextAttempt=function(){this.currentAttempt_++;var n=this.currentDelay_*this.delayFactor_;this.currentDelay_=this.currentDelay_+n},i.shouldRetry=function(){return this.currentAttempt_<this.maxAttempts_},i.getCurrentDelay=function(){return this.currentDelay_},i.getCurrentMinPossibleDelay=function(){return(1-this.fuzzFactor_)*this.currentDelay_},i.getCurrentMaxPossibleDelay=function(){return(1+this.fuzzFactor_)*this.currentDelay_},i.getCurrentFuzzedDelay=function(){var n=this.getCurrentMinPossibleDelay(),a=this.getCurrentMaxPossibleDelay();return n+Math.random()*(a-n)},t})();return Na=r,Na}var Oa,Vu;function by(){if(Vu)return Oa;Vu=1;var r=zn(),e=function(s,n){return n===void 0&&(n=!1),function(a,o,u){if(a){s(a);return}if(o.statusCode>=400&&o.statusCode<=599){var d=u;if(n)if(r.TextDecoder){var p=t(o.headers&&o.headers["content-type"]);try{d=new TextDecoder(p).decode(u)}catch{}}else d=String.fromCharCode.apply(null,new Uint8Array(u));s({cause:d});return}s(null,u)}};function t(i){return i===void 0&&(i=""),i.toLowerCase().split(";").reduce(function(s,n){var a=n.split("="),o=a[0],u=a[1];return o.trim()==="charset"?u.trim():s},"utf-8")}return Oa=e,Oa}var Hu;function xy(){if(Hu)return ln.exports;Hu=1;var r=zn(),e=yy(),t=_y(),i=Ty(),s=vy();d.httpHandler=by(),d.requestInterceptorsStorage=new i,d.responseInterceptorsStorage=new i,d.retryManager=new s;var n=function(k){var v={};return k&&k.trim().split(`
|
|
3
|
+
`).forEach(function(L){var U=L.indexOf(":"),$=L.slice(0,U).trim().toLowerCase(),F=L.slice(U+1).trim();typeof v[$]>"u"?v[$]=F:Array.isArray(v[$])?v[$].push(F):v[$]=[v[$],F]}),v};ln.exports=d,ln.exports.default=d,d.XMLHttpRequest=r.XMLHttpRequest||A,d.XDomainRequest="withCredentials"in new d.XMLHttpRequest?d.XMLHttpRequest:r.XDomainRequest,a(["get","put","post","patch","head","delete"],function(b){d[b==="delete"?"del":b]=function(k,v,L){return v=u(k,v,L),v.method=b.toUpperCase(),p(v)}});function a(b,k){for(var v=0;v<b.length;v++)k(b[v])}function o(b){for(var k in b)if(b.hasOwnProperty(k))return!1;return!0}function u(b,k,v){var L=b;return t(k)?(v=k,typeof b=="string"&&(L={uri:b})):L=e({},k,{uri:b}),L.callback=v,L}function d(b,k,v){return k=u(b,k,v),p(k)}function p(b){if(typeof b.callback>"u")throw new Error("callback argument missing");if(b.requestType&&d.requestInterceptorsStorage.getIsEnabled()){var k={uri:b.uri||b.url,headers:b.headers||{},body:b.body,metadata:b.metadata||{},retry:b.retry,timeout:b.timeout},v=d.requestInterceptorsStorage.execute(b.requestType,k);b.uri=v.uri,b.headers=v.headers,b.body=v.body,b.metadata=v.metadata,b.retry=v.retry,b.timeout=v.timeout}var L=!1,U=function(le,oe,ce){L||(L=!0,b.callback(le,oe,ce))};function $(){V.readyState===4&&!d.responseInterceptorsStorage.getIsEnabled()&&setTimeout(B,0)}function F(){var te=void 0;if(V.response?te=V.response:te=V.responseText||T(V),ne)try{te=JSON.parse(te)}catch{}return te}function H(te){if(clearTimeout(de),clearTimeout(b.retryTimeout),te instanceof Error||(te=new Error(""+(te||"Unknown XMLHttpRequest Error"))),te.statusCode=0,!ie&&d.retryManager.getIsEnabled()&&b.retry&&b.retry.shouldRetry()){b.retryTimeout=setTimeout(function(){b.retry.moveToNextAttempt(),b.xhr=V,p(b)},b.retry.getCurrentFuzzedDelay());return}if(b.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var le={headers:fe.headers||{},body:fe.body,responseUrl:V.responseURL,responseType:V.responseType},oe=d.responseInterceptorsStorage.execute(b.requestType,le);fe.body=oe.body,fe.headers=oe.headers}return U(te,fe)}function B(){if(!ie){var te;clearTimeout(de),clearTimeout(b.retryTimeout),b.useXDR&&V.status===void 0?te=200:te=V.status===1223?204:V.status;var le=fe,oe=null;if(te!==0?(le={body:F(),statusCode:te,method:I,headers:{},url:C,rawRequest:V},V.getAllResponseHeaders&&(le.headers=n(V.getAllResponseHeaders()))):oe=new Error("Internal XMLHttpRequest Error"),b.requestType&&d.responseInterceptorsStorage.getIsEnabled()){var ce={headers:le.headers||{},body:le.body,responseUrl:V.responseURL,responseType:V.responseType},ue=d.responseInterceptorsStorage.execute(b.requestType,ce);le.body=ue.body,le.headers=ue.headers}return U(oe,le,le.body)}}var V=b.xhr||null;V||(b.cors||b.useXDR?V=new d.XDomainRequest:V=new d.XMLHttpRequest);var G,ie,C=V.url=b.uri||b.url,I=V.method=b.method||"GET",W=b.body||b.data,Y=V.headers=b.headers||{},X=!!b.sync,ne=!1,de,fe={body:void 0,headers:{},statusCode:0,method:I,url:C,rawRequest:V};if("json"in b&&b.json!==!1&&(ne=!0,Y.accept||Y.Accept||(Y.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(Y["content-type"]||Y["Content-Type"]||(Y["Content-Type"]="application/json"),W=JSON.stringify(b.json===!0?W:b.json))),V.onreadystatechange=$,V.onload=B,V.onerror=H,V.onprogress=function(){},V.onabort=function(){ie=!0,clearTimeout(b.retryTimeout)},V.ontimeout=H,V.open(I,C,!X,b.username,b.password),X||(V.withCredentials=!!b.withCredentials),!X&&b.timeout>0&&(de=setTimeout(function(){if(!ie){ie=!0,V.abort("timeout");var te=new Error("XMLHttpRequest timeout");te.code="ETIMEDOUT",H(te)}},b.timeout)),V.setRequestHeader)for(G in Y)Y.hasOwnProperty(G)&&V.setRequestHeader(G,Y[G]);else if(b.headers&&!o(b.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in b&&(V.responseType=b.responseType),"beforeSend"in b&&typeof b.beforeSend=="function"&&b.beforeSend(V),V.send(W||null),V}function T(b){try{if(b.responseType==="document")return b.responseXML;var k=b.responseXML&&b.responseXML.documentElement.nodeName==="parsererror";if(b.responseType===""&&!k)return b.responseXML}catch{}return null}function A(){}return ln.exports}var Sy=xy();const qd=ui.getDefaultExportFromCjs(Sy);var Ba={exports:{}},Ma,zu;function Ey(){if(zu)return Ma;zu=1;var r=jd(),e=Object.create||(function(){function C(){}return function(I){if(arguments.length!==1)throw new Error("Object.create shim only accepts one parameter.");return C.prototype=I,new C}})();function t(C,I){this.name="ParsingError",this.code=C.code,this.message=I||C.message}t.prototype=e(Error.prototype),t.prototype.constructor=t,t.Errors={BadSignature:{code:0,message:"Malformed WebVTT signature."},BadTimeStamp:{code:1,message:"Malformed time stamp."}};function i(C){function I(Y,X,ne,de){return(Y|0)*3600+(X|0)*60+(ne|0)+(de|0)/1e3}var W=C.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);return W?W[3]?I(W[1],W[2],W[3].replace(":",""),W[4]):W[1]>59?I(W[1],W[2],0,W[4]):I(0,W[1],W[2],W[4]):null}function s(){this.values=e(null)}s.prototype={set:function(C,I){!this.get(C)&&I!==""&&(this.values[C]=I)},get:function(C,I,W){return W?this.has(C)?this.values[C]:I[W]:this.has(C)?this.values[C]:I},has:function(C){return C in this.values},alt:function(C,I,W){for(var Y=0;Y<W.length;++Y)if(I===W[Y]){this.set(C,I);break}},integer:function(C,I){/^-?\d+$/.test(I)&&this.set(C,parseInt(I,10))},percent:function(C,I){return I.match(/^([\d]{1,3})(\.[\d]*)?%$/)&&(I=parseFloat(I),I>=0&&I<=100)?(this.set(C,I),!0):!1}};function n(C,I,W,Y){var X=Y?C.split(Y):[C];for(var ne in X)if(typeof X[ne]=="string"){var de=X[ne].split(W);if(de.length===2){var fe=de[0].trim(),te=de[1].trim();I(fe,te)}}}function a(C,I,W){var Y=C;function X(){var fe=i(C);if(fe===null)throw new t(t.Errors.BadTimeStamp,"Malformed timestamp: "+Y);return C=C.replace(/^[^\sa-zA-Z-]+/,""),fe}function ne(fe,te){var le=new s;n(fe,function(oe,ce){switch(oe){case"region":for(var ue=W.length-1;ue>=0;ue--)if(W[ue].id===ce){le.set(oe,W[ue].region);break}break;case"vertical":le.alt(oe,ce,["rl","lr"]);break;case"line":var Ee=ce.split(","),Ae=Ee[0];le.integer(oe,Ae),le.percent(oe,Ae)&&le.set("snapToLines",!1),le.alt(oe,Ae,["auto"]),Ee.length===2&&le.alt("lineAlign",Ee[1],["start","center","end"]);break;case"position":Ee=ce.split(","),le.percent(oe,Ee[0]),Ee.length===2&&le.alt("positionAlign",Ee[1],["start","center","end"]);break;case"size":le.percent(oe,ce);break;case"align":le.alt(oe,ce,["start","center","end","left","right"]);break}},/:/,/\s/),te.region=le.get("region",null),te.vertical=le.get("vertical","");try{te.line=le.get("line","auto")}catch{}te.lineAlign=le.get("lineAlign","start"),te.snapToLines=le.get("snapToLines",!0),te.size=le.get("size",100);try{te.align=le.get("align","center")}catch{te.align=le.get("align","middle")}try{te.position=le.get("position","auto")}catch{te.position=le.get("position",{start:0,left:0,center:50,middle:50,end:100,right:100},te.align)}te.positionAlign=le.get("positionAlign",{start:"start",left:"start",center:"center",middle:"center",end:"end",right:"end"},te.align)}function de(){C=C.replace(/^\s+/,"")}if(de(),I.startTime=X(),de(),C.substr(0,3)!=="-->")throw new t(t.Errors.BadTimeStamp,"Malformed time stamp (time stamps must be separated by '-->'): "+Y);C=C.substr(3),de(),I.endTime=X(),de(),ne(C,I)}var o=r.createElement&&r.createElement("textarea"),u={c:"span",i:"i",b:"b",u:"u",ruby:"ruby",rt:"rt",v:"span",lang:"span"},d={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)"},p={v:"title",lang:"lang"},T={rt:"ruby"};function A(C,I){function W(){if(!I)return null;function Ae(_e){return I=I.substr(_e.length),_e}var Te=I.match(/^([^<]*)(<[^>]*>?)?/);return Ae(Te[1]?Te[1]:Te[2])}function Y(Ae){return o.innerHTML=Ae,Ae=o.textContent,o.textContent="",Ae}function X(Ae,Te){return!T[Te.localName]||T[Te.localName]===Ae.localName}function ne(Ae,Te){var _e=u[Ae];if(!_e)return null;var lt=C.document.createElement(_e),dt=p[Ae];return dt&&Te&&(lt[dt]=Te.trim()),lt}for(var de=C.document.createElement("div"),fe=de,te,le=[];(te=W())!==null;){if(te[0]==="<"){if(te[1]==="/"){le.length&&le[le.length-1]===te.substr(2).replace(">","")&&(le.pop(),fe=fe.parentNode);continue}var oe=i(te.substr(1,te.length-2)),ce;if(oe){ce=C.document.createProcessingInstruction("timestamp",oe),fe.appendChild(ce);continue}var ue=te.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);if(!ue||(ce=ne(ue[1],ue[3]),!ce)||!X(fe,ce))continue;if(ue[2]){var Ee=ue[2].split(".");Ee.forEach(function(Ae){var Te=/^bg_/.test(Ae),_e=Te?Ae.slice(3):Ae;if(d.hasOwnProperty(_e)){var lt=Te?"background-color":"color",dt=d[_e];ce.style[lt]=dt}}),ce.className=Ee.join(" ")}le.push(ue[1]),fe.appendChild(ce),fe=ce;continue}fe.appendChild(C.document.createTextNode(Y(te)))}return de}var b=[[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 k(C){for(var I=0;I<b.length;I++){var W=b[I];if(C>=W[0]&&C<=W[1])return!0}return!1}function v(C){var I=[],W="",Y;if(!C||!C.childNodes)return"ltr";function X(fe,te){for(var le=te.childNodes.length-1;le>=0;le--)fe.push(te.childNodes[le])}function ne(fe){if(!fe||!fe.length)return null;var te=fe.pop(),le=te.textContent||te.innerText;if(le){var oe=le.match(/^.*(\n|\r)/);return oe?(fe.length=0,oe[0]):le}if(te.tagName==="ruby")return ne(fe);if(te.childNodes)return X(fe,te),ne(fe)}for(X(I,C);W=ne(I);)for(var de=0;de<W.length;de++)if(Y=W.charCodeAt(de),k(Y))return"rtl";return"ltr"}function L(C){if(typeof C.line=="number"&&(C.snapToLines||C.line>=0&&C.line<=100))return C.line;if(!C.track||!C.track.textTrackList||!C.track.textTrackList.mediaElement)return-1;for(var I=C.track,W=I.textTrackList,Y=0,X=0;X<W.length&&W[X]!==I;X++)W[X].mode==="showing"&&Y++;return++Y*-1}function U(){}U.prototype.applyStyles=function(C,I){I=I||this.div;for(var W in C)C.hasOwnProperty(W)&&(I.style[W]=C[W])},U.prototype.formatStyle=function(C,I){return C===0?0:C+I};function $(C,I,W){U.call(this),this.cue=I,this.cueDiv=A(C,I.text);var Y={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:I.vertical===""?"horizontal-tb":I.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext"};this.applyStyles(Y,this.cueDiv),this.div=C.document.createElement("div"),Y={direction:v(this.cueDiv),writingMode:I.vertical===""?"horizontal-tb":I.vertical==="lr"?"vertical-lr":"vertical-rl",unicodeBidi:"plaintext",textAlign:I.align==="middle"?"center":I.align,font:W.font,whiteSpace:"pre-line",position:"absolute"},this.applyStyles(Y),this.div.appendChild(this.cueDiv);var X=0;switch(I.positionAlign){case"start":case"line-left":X=I.position;break;case"center":X=I.position-I.size/2;break;case"end":case"line-right":X=I.position-I.size;break}I.vertical===""?this.applyStyles({left:this.formatStyle(X,"%"),width:this.formatStyle(I.size,"%")}):this.applyStyles({top:this.formatStyle(X,"%"),height:this.formatStyle(I.size,"%")}),this.move=function(ne){this.applyStyles({top:this.formatStyle(ne.top,"px"),bottom:this.formatStyle(ne.bottom,"px"),left:this.formatStyle(ne.left,"px"),right:this.formatStyle(ne.right,"px"),height:this.formatStyle(ne.height,"px"),width:this.formatStyle(ne.width,"px")})}}$.prototype=e(U.prototype),$.prototype.constructor=$;function F(C){var I,W,Y,X;if(C.div){W=C.div.offsetHeight,Y=C.div.offsetWidth,X=C.div.offsetTop;var ne=(ne=C.div.childNodes)&&(ne=ne[0])&&ne.getClientRects&&ne.getClientRects();C=C.div.getBoundingClientRect(),I=ne?Math.max(ne[0]&&ne[0].height||0,C.height/ne.length):0}this.left=C.left,this.right=C.right,this.top=C.top||X,this.height=C.height||W,this.bottom=C.bottom||X+(C.height||W),this.width=C.width||Y,this.lineHeight=I!==void 0?I:C.lineHeight}F.prototype.move=function(C,I){switch(I=I!==void 0?I:this.lineHeight,C){case"+x":this.left+=I,this.right+=I;break;case"-x":this.left-=I,this.right-=I;break;case"+y":this.top+=I,this.bottom+=I;break;case"-y":this.top-=I,this.bottom-=I;break}},F.prototype.overlaps=function(C){return this.left<C.right&&this.right>C.left&&this.top<C.bottom&&this.bottom>C.top},F.prototype.overlapsAny=function(C){for(var I=0;I<C.length;I++)if(this.overlaps(C[I]))return!0;return!1},F.prototype.within=function(C){return this.top>=C.top&&this.bottom<=C.bottom&&this.left>=C.left&&this.right<=C.right},F.prototype.overlapsOppositeAxis=function(C,I){switch(I){case"+x":return this.left<C.left;case"-x":return this.right>C.right;case"+y":return this.top<C.top;case"-y":return this.bottom>C.bottom}},F.prototype.intersectPercentage=function(C){var I=Math.max(0,Math.min(this.right,C.right)-Math.max(this.left,C.left)),W=Math.max(0,Math.min(this.bottom,C.bottom)-Math.max(this.top,C.top)),Y=I*W;return Y/(this.height*this.width)},F.prototype.toCSSCompatValues=function(C){return{top:this.top-C.top,bottom:C.bottom-this.bottom,left:this.left-C.left,right:C.right-this.right,height:this.height,width:this.width}},F.getSimpleBoxPosition=function(C){var I=C.div?C.div.offsetHeight:C.tagName?C.offsetHeight:0,W=C.div?C.div.offsetWidth:C.tagName?C.offsetWidth:0,Y=C.div?C.div.offsetTop:C.tagName?C.offsetTop:0;C=C.div?C.div.getBoundingClientRect():C.tagName?C.getBoundingClientRect():C;var X={left:C.left,right:C.right,top:C.top||Y,height:C.height||I,bottom:C.bottom||Y+(C.height||I),width:C.width||W};return X};function H(C,I,W,Y){function X(_e,lt){for(var dt,tt=new F(_e),ht=1,Ct=0;Ct<lt.length;Ct++){for(;_e.overlapsOppositeAxis(W,lt[Ct])||_e.within(W)&&_e.overlapsAny(Y);)_e.move(lt[Ct]);if(_e.within(W))return _e;var Qe=_e.intersectPercentage(W);ht>Qe&&(dt=new F(_e),ht=Qe),_e=new F(tt)}return dt||tt}var ne=new F(I),de=I.cue,fe=L(de),te=[];if(de.snapToLines){var le;switch(de.vertical){case"":te=["+y","-y"],le="height";break;case"rl":te=["+x","-x"],le="width";break;case"lr":te=["-x","+x"],le="width";break}var oe=ne.lineHeight,ce=oe*Math.round(fe),ue=W[le]+oe,Ee=te[0];Math.abs(ce)>ue&&(ce=ce<0?-1:1,ce*=Math.ceil(ue/oe)*oe),fe<0&&(ce+=de.vertical===""?W.height:W.width,te=te.reverse()),ne.move(Ee,ce)}else{var Ae=ne.lineHeight/W.height*100;switch(de.lineAlign){case"center":fe-=Ae/2;break;case"end":fe-=Ae;break}switch(de.vertical){case"":I.applyStyles({top:I.formatStyle(fe,"%")});break;case"rl":I.applyStyles({left:I.formatStyle(fe,"%")});break;case"lr":I.applyStyles({right:I.formatStyle(fe,"%")});break}te=["+y","-x","+x","-y"],ne=new F(I)}var Te=X(ne,te);I.move(Te.toCSSCompatValues(W))}function B(){}B.StringDecoder=function(){return{decode:function(C){if(!C)return"";if(typeof C!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(C))}}},B.convertCueToDOMTree=function(C,I){return!C||!I?null:A(C,I)};var V=.05,G="sans-serif",ie="1.5%";return B.processCues=function(C,I,W){if(!C||!I||!W)return null;for(;W.firstChild;)W.removeChild(W.firstChild);var Y=C.document.createElement("div");Y.style.position="absolute",Y.style.left="0",Y.style.right="0",Y.style.top="0",Y.style.bottom="0",Y.style.margin=ie,W.appendChild(Y);function X(oe){for(var ce=0;ce<oe.length;ce++)if(oe[ce].hasBeenReset||!oe[ce].displayState)return!0;return!1}if(!X(I)){for(var ne=0;ne<I.length;ne++)Y.appendChild(I[ne].displayState);return}var de=[],fe=F.getSimpleBoxPosition(Y),te=Math.round(fe.height*V*100)/100,le={font:te+"px "+G};(function(){for(var oe,ce,ue=0;ue<I.length;ue++)ce=I[ue],oe=new $(C,ce,le),Y.appendChild(oe.div),H(C,oe,fe,de),ce.displayState=oe.div,de.push(F.getSimpleBoxPosition(oe))})()},B.Parser=function(C,I,W){W||(W=I,I={}),I||(I={}),this.window=C,this.vttjs=I,this.state="INITIAL",this.buffer="",this.decoder=W||new TextDecoder("utf8"),this.regionList=[]},B.Parser.prototype={reportOrThrowError:function(C){if(C instanceof t)this.onparsingerror&&this.onparsingerror(C);else throw C},parse:function(C){var I=this;C&&(I.buffer+=I.decoder.decode(C,{stream:!0}));function W(){for(var oe=I.buffer,ce=0;ce<oe.length&&oe[ce]!=="\r"&&oe[ce]!==`
|
|
4
|
+
`;)++ce;var ue=oe.substr(0,ce);return oe[ce]==="\r"&&++ce,oe[ce]===`
|
|
5
|
+
`&&++ce,I.buffer=oe.substr(ce),ue}function Y(oe){var ce=new s;if(n(oe,function(Ee,Ae){switch(Ee){case"id":ce.set(Ee,Ae);break;case"width":ce.percent(Ee,Ae);break;case"lines":ce.integer(Ee,Ae);break;case"regionanchor":case"viewportanchor":var Te=Ae.split(",");if(Te.length!==2)break;var _e=new s;if(_e.percent("x",Te[0]),_e.percent("y",Te[1]),!_e.has("x")||!_e.has("y"))break;ce.set(Ee+"X",_e.get("x")),ce.set(Ee+"Y",_e.get("y"));break;case"scroll":ce.alt(Ee,Ae,["up"]);break}},/=/,/\s/),ce.has("id")){var ue=new(I.vttjs.VTTRegion||I.window.VTTRegion);ue.width=ce.get("width",100),ue.lines=ce.get("lines",3),ue.regionAnchorX=ce.get("regionanchorX",0),ue.regionAnchorY=ce.get("regionanchorY",100),ue.viewportAnchorX=ce.get("viewportanchorX",0),ue.viewportAnchorY=ce.get("viewportanchorY",100),ue.scroll=ce.get("scroll",""),I.onregion&&I.onregion(ue),I.regionList.push({id:ce.get("id"),region:ue})}}function X(oe){var ce=new s;n(oe,function(ue,Ee){switch(ue){case"MPEGT":ce.integer(ue+"S",Ee);break;case"LOCA":ce.set(ue+"L",i(Ee));break}},/[^\d]:/,/,/),I.ontimestampmap&&I.ontimestampmap({MPEGTS:ce.get("MPEGTS"),LOCAL:ce.get("LOCAL")})}function ne(oe){oe.match(/X-TIMESTAMP-MAP/)?n(oe,function(ce,ue){ce==="X-TIMESTAMP-MAP"&&X(ue)},/=/):n(oe,function(ce,ue){ce==="Region"&&Y(ue)},/:/)}try{var de;if(I.state==="INITIAL"){if(!/\r\n|\n/.test(I.buffer))return this;de=W();var fe=de.match(/^WEBVTT([ \t].*)?$/);if(!fe||!fe[0])throw new t(t.Errors.BadSignature);I.state="HEADER"}for(var te=!1;I.buffer;){if(!/\r\n|\n/.test(I.buffer))return this;switch(te?te=!1:de=W(),I.state){case"HEADER":/:/.test(de)?ne(de):de||(I.state="ID");continue;case"NOTE":de||(I.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(de)){I.state="NOTE";break}if(!de)continue;I.cue=new(I.vttjs.VTTCue||I.window.VTTCue)(0,0,"");try{I.cue.align="center"}catch{I.cue.align="middle"}if(I.state="CUE",de.indexOf("-->")===-1){I.cue.id=de;continue}case"CUE":try{a(de,I.cue,I.regionList)}catch(oe){I.reportOrThrowError(oe),I.cue=null,I.state="BADCUE";continue}I.state="CUETEXT";continue;case"CUETEXT":var le=de.indexOf("-->")!==-1;if(!de||le&&(te=!0)){I.oncue&&I.oncue(I.cue),I.cue=null,I.state="ID";continue}I.cue.text&&(I.cue.text+=`
|
|
6
|
+
`),I.cue.text+=de.replace(/\u2028/g,`
|
|
13
7
|
`).replace(/u2029/g,`
|
|
14
|
-
`);continue;case"BADCUE":
|
|
8
|
+
`);continue;case"BADCUE":de||(I.state="ID");continue}}}catch(oe){I.reportOrThrowError(oe),I.state==="CUETEXT"&&I.cue&&I.oncue&&I.oncue(I.cue),I.cue=null,I.state=I.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this},flush:function(){var C=this;try{if(C.buffer+=C.decoder.decode(),(C.cue||C.state==="HEADER")&&(C.buffer+=`
|
|
15
9
|
|
|
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
|
-
* The buffer module from node.js, for the browser.
|
|
18
|
-
*
|
|
19
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
20
|
-
* @license MIT
|
|
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(`
|
|
10
|
+
`,C.parse()),C.state==="INITIAL")throw new t(t.Errors.BadSignature)}catch(I){C.reportOrThrowError(I)}return C.onflush&&C.onflush(),this}},Ma=B,Ma}var Fa,Wu;function Cy(){if(Wu)return Fa;Wu=1;var r="auto",e={"":1,lr:1,rl:1},t={start:1,center:1,end:1,left:1,right:1,auto:1,"line-left":1,"line-right":1};function i(a){if(typeof a!="string")return!1;var o=e[a.toLowerCase()];return o?a.toLowerCase():!1}function s(a){if(typeof a!="string")return!1;var o=t[a.toLowerCase()];return o?a.toLowerCase():!1}function n(a,o,u){this.hasBeenReset=!1;var d="",p=!1,T=a,A=o,b=u,k=null,v="",L=!0,U="auto",$="start",F="auto",H="auto",B=100,V="center";Object.defineProperties(this,{id:{enumerable:!0,get:function(){return d},set:function(G){d=""+G}},pauseOnExit:{enumerable:!0,get:function(){return p},set:function(G){p=!!G}},startTime:{enumerable:!0,get:function(){return T},set:function(G){if(typeof G!="number")throw new TypeError("Start time must be set to a number.");T=G,this.hasBeenReset=!0}},endTime:{enumerable:!0,get:function(){return A},set:function(G){if(typeof G!="number")throw new TypeError("End time must be set to a number.");A=G,this.hasBeenReset=!0}},text:{enumerable:!0,get:function(){return b},set:function(G){b=""+G,this.hasBeenReset=!0}},region:{enumerable:!0,get:function(){return k},set:function(G){k=G,this.hasBeenReset=!0}},vertical:{enumerable:!0,get:function(){return v},set:function(G){var ie=i(G);if(ie===!1)throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");v=ie,this.hasBeenReset=!0}},snapToLines:{enumerable:!0,get:function(){return L},set:function(G){L=!!G,this.hasBeenReset=!0}},line:{enumerable:!0,get:function(){return U},set:function(G){if(typeof G!="number"&&G!==r)throw new SyntaxError("Line: an invalid number or illegal string was specified.");U=G,this.hasBeenReset=!0}},lineAlign:{enumerable:!0,get:function(){return $},set:function(G){var ie=s(G);ie?($=ie,this.hasBeenReset=!0):console.warn("lineAlign: an invalid or illegal string was specified.")}},position:{enumerable:!0,get:function(){return F},set:function(G){if(G<0||G>100)throw new Error("Position must be between 0 and 100.");F=G,this.hasBeenReset=!0}},positionAlign:{enumerable:!0,get:function(){return H},set:function(G){var ie=s(G);ie?(H=ie,this.hasBeenReset=!0):console.warn("positionAlign: an invalid or illegal string was specified.")}},size:{enumerable:!0,get:function(){return B},set:function(G){if(G<0||G>100)throw new Error("Size must be between 0 and 100.");B=G,this.hasBeenReset=!0}},align:{enumerable:!0,get:function(){return V},set:function(G){var ie=s(G);if(!ie)throw new SyntaxError("align: an invalid or illegal alignment string was specified.");V=ie,this.hasBeenReset=!0}}}),this.displayState=void 0}return n.prototype.getCueAsHTML=function(){return WebVTT.convertCueToDOMTree(window,this.text)},Fa=n,Fa}var Ua,Gu;function Ay(){if(Gu)return Ua;Gu=1;var r={"":!0,up:!0};function e(s){if(typeof s!="string")return!1;var n=r[s.toLowerCase()];return n?s.toLowerCase():!1}function t(s){return typeof s=="number"&&s>=0&&s<=100}function i(){var s=100,n=3,a=0,o=100,u=0,d=100,p="";Object.defineProperties(this,{width:{enumerable:!0,get:function(){return s},set:function(T){if(!t(T))throw new Error("Width must be between 0 and 100.");s=T}},lines:{enumerable:!0,get:function(){return n},set:function(T){if(typeof T!="number")throw new TypeError("Lines must be set to a number.");n=T}},regionAnchorY:{enumerable:!0,get:function(){return o},set:function(T){if(!t(T))throw new Error("RegionAnchorX must be between 0 and 100.");o=T}},regionAnchorX:{enumerable:!0,get:function(){return a},set:function(T){if(!t(T))throw new Error("RegionAnchorY must be between 0 and 100.");a=T}},viewportAnchorY:{enumerable:!0,get:function(){return d},set:function(T){if(!t(T))throw new Error("ViewportAnchorY must be between 0 and 100.");d=T}},viewportAnchorX:{enumerable:!0,get:function(){return u},set:function(T){if(!t(T))throw new Error("ViewportAnchorX must be between 0 and 100.");u=T}},scroll:{enumerable:!0,get:function(){return p},set:function(T){var A=e(T);A===!1?console.warn("Scroll: an invalid or illegal string was specified."):p=A}}})}return Ua=i,Ua}var Ku;function wy(){if(Ku)return Ba.exports;Ku=1;var r=zn(),e=Ba.exports={WebVTT:Ey(),VTTCue:Cy(),VTTRegion:Ay()};r.vttjs=e,r.WebVTT=e.WebVTT;var t=e.VTTCue,i=e.VTTRegion,s=r.VTTCue,n=r.VTTRegion;return e.shim=function(){r.VTTCue=t,r.VTTRegion=i},e.restore=function(){r.VTTCue=s,r.VTTRegion=n},r.VTTCue||e.shim(),Ba.exports}var Dy=wy();const Xu=ui.getDefaultExportFromCjs(Dy);var Yu="https://example.com",Wn=function(e,t){if(/^[a-z]+:/i.test(t))return t;/^data:/.test(e)&&(e=N.location&&N.location.href||"");var i=/^\/\//.test(e),s=!N.location&&!/\/\//i.test(e);e=new N.URL(e,N.location||Yu);var n=new URL(t,e);return s?n.href.slice(Yu.length):i?n.href.slice(n.protocol.length):n.href},qo=(function(){function r(){this.listeners={}}var e=r.prototype;return e.on=function(i,s){this.listeners[i]||(this.listeners[i]=[]),this.listeners[i].push(s)},e.off=function(i,s){if(!this.listeners[i])return!1;var n=this.listeners[i].indexOf(s);return this.listeners[i]=this.listeners[i].slice(0),this.listeners[i].splice(n,1),n>-1},e.trigger=function(i){var s=this.listeners[i];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 o=Array.prototype.slice.call(arguments,1),u=s.length,d=0;d<u;++d)s[d].apply(this,o)},e.dispose=function(){this.listeners={}},e.pipe=function(i){this.on("data",function(s){i.push(s)})},r})(),Vd={},Gn={};Gn.byteLength=Py;Gn.toByteArray=Ly;Gn.fromByteArray=By;var bi=[],Xt=[],Iy=typeof Uint8Array<"u"?Uint8Array:Array,$a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var mr=0,ky=$a.length;mr<ky;++mr)bi[mr]=$a[mr],Xt[$a.charCodeAt(mr)]=mr;Xt[45]=62;Xt[95]=63;function Hd(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function Py(r){var e=Hd(r),t=e[0],i=e[1];return(t+i)*3/4-i}function Ry(r,e,t){return(e+t)*3/4-t}function Ly(r){var e,t=Hd(r),i=t[0],s=t[1],n=new Iy(Ry(r,i,s)),a=0,o=s>0?i-4:i,u;for(u=0;u<o;u+=4)e=Xt[r.charCodeAt(u)]<<18|Xt[r.charCodeAt(u+1)]<<12|Xt[r.charCodeAt(u+2)]<<6|Xt[r.charCodeAt(u+3)],n[a++]=e>>16&255,n[a++]=e>>8&255,n[a++]=e&255;return s===2&&(e=Xt[r.charCodeAt(u)]<<2|Xt[r.charCodeAt(u+1)]>>4,n[a++]=e&255),s===1&&(e=Xt[r.charCodeAt(u)]<<10|Xt[r.charCodeAt(u+1)]<<4|Xt[r.charCodeAt(u+2)]>>2,n[a++]=e>>8&255,n[a++]=e&255),n}function Ny(r){return bi[r>>18&63]+bi[r>>12&63]+bi[r>>6&63]+bi[r&63]}function Oy(r,e,t){for(var i,s=[],n=e;n<t;n+=3)i=(r[n]<<16&16711680)+(r[n+1]<<8&65280)+(r[n+2]&255),s.push(Ny(i));return s.join("")}function By(r){for(var e,t=r.length,i=t%3,s=[],n=16383,a=0,o=t-i;a<o;a+=n)s.push(Oy(r,a,a+n>o?o:a+n));return i===1?(e=r[t-1],s.push(bi[e>>2]+bi[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],s.push(bi[e>>10]+bi[e>>4&63]+bi[e<<2&63]+"=")),s.join("")}var Vo={};Vo.read=function(r,e,t,i,s){var n,a,o=s*8-i-1,u=(1<<o)-1,d=u>>1,p=-7,T=t?s-1:0,A=t?-1:1,b=r[e+T];for(T+=A,n=b&(1<<-p)-1,b>>=-p,p+=o;p>0;n=n*256+r[e+T],T+=A,p-=8);for(a=n&(1<<-p)-1,n>>=-p,p+=i;p>0;a=a*256+r[e+T],T+=A,p-=8);if(n===0)n=1-d;else{if(n===u)return a?NaN:(b?-1:1)*(1/0);a=a+Math.pow(2,i),n=n-d}return(b?-1:1)*a*Math.pow(2,n-i)};Vo.write=function(r,e,t,i,s,n){var a,o,u,d=n*8-s-1,p=(1<<d)-1,T=p>>1,A=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,b=i?0:n-1,k=i?1:-1,v=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=p):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),a+T>=1?e+=A/u:e+=A*Math.pow(2,1-T),e*u>=2&&(a++,u/=2),a+T>=p?(o=0,a=p):a+T>=1?(o=(e*u-1)*Math.pow(2,s),a=a+T):(o=e*Math.pow(2,T-1)*Math.pow(2,s),a=0));s>=8;r[t+b]=o&255,b+=k,o/=256,s-=8);for(a=a<<s|o,d+=s;d>0;r[t+b]=a&255,b+=k,a/=256,d-=8);r[t+b-k]|=v*128};(function(r){const e=Gn,t=Vo,i=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=p,r.SlowBuffer=B,r.INSPECT_MAX_BYTES=50;const s=2147483647;r.kMaxLength=s;const{Uint8Array:n,ArrayBuffer:a,SharedArrayBuffer:o}=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 S=new n(1),g={foo:function(){return 42}};return Object.setPrototypeOf(g,n.prototype),Object.setPrototypeOf(S,g),S.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 d(S){if(S>s)throw new RangeError('The value "'+S+'" is invalid for option "size"');const g=new n(S);return Object.setPrototypeOf(g,p.prototype),g}function p(S,g,y){if(typeof S=="number"){if(typeof g=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return k(S)}return T(S,g,y)}p.poolSize=8192;function T(S,g,y){if(typeof S=="string")return v(S,g);if(a.isView(S))return U(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(pt(S,a)||S&&pt(S.buffer,a)||typeof o<"u"&&(pt(S,o)||S&&pt(S.buffer,o)))return $(S,g,y);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const P=S.valueOf&&S.valueOf();if(P!=null&&P!==S)return p.from(P,g,y);const j=F(S);if(j)return j;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return p.from(S[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 S)}p.from=function(S,g,y){return T(S,g,y)},Object.setPrototypeOf(p.prototype,n.prototype),Object.setPrototypeOf(p,n);function A(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function b(S,g,y){return A(S),S<=0?d(S):g!==void 0?typeof y=="string"?d(S).fill(g,y):d(S).fill(g):d(S)}p.alloc=function(S,g,y){return b(S,g,y)};function k(S){return A(S),d(S<0?0:H(S)|0)}p.allocUnsafe=function(S){return k(S)},p.allocUnsafeSlow=function(S){return k(S)};function v(S,g){if((typeof g!="string"||g==="")&&(g="utf8"),!p.isEncoding(g))throw new TypeError("Unknown encoding: "+g);const y=V(S,g)|0;let P=d(y);const j=P.write(S,g);return j!==y&&(P=P.slice(0,j)),P}function L(S){const g=S.length<0?0:H(S.length)|0,y=d(g);for(let P=0;P<g;P+=1)y[P]=S[P]&255;return y}function U(S){if(pt(S,n)){const g=new n(S);return $(g.buffer,g.byteOffset,g.byteLength)}return L(S)}function $(S,g,y){if(g<0||S.byteLength<g)throw new RangeError('"offset" is outside of buffer bounds');if(S.byteLength<g+(y||0))throw new RangeError('"length" is outside of buffer bounds');let P;return g===void 0&&y===void 0?P=new n(S):y===void 0?P=new n(S,g):P=new n(S,g,y),Object.setPrototypeOf(P,p.prototype),P}function F(S){if(p.isBuffer(S)){const g=H(S.length)|0,y=d(g);return y.length===0||S.copy(y,0,0,g),y}if(S.length!==void 0)return typeof S.length!="number"||ri(S.length)?d(0):L(S);if(S.type==="Buffer"&&Array.isArray(S.data))return L(S.data)}function H(S){if(S>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return S|0}function B(S){return+S!=S&&(S=0),p.alloc(+S)}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 P=g.length,j=y.length;for(let Q=0,se=Math.min(P,j);Q<se;++Q)if(g[Q]!==y[Q]){P=g[Q],j=y[Q];break}return P<j?-1:j<P?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 P;if(y===void 0)for(y=0,P=0;P<g.length;++P)y+=g[P].length;const j=p.allocUnsafe(y);let Q=0;for(P=0;P<g.length;++P){let se=g[P];if(pt(se,n))Q+se.length>j.length?(p.isBuffer(se)||(se=p.from(se)),se.copy(j,Q)):n.prototype.set.call(j,se,Q);else if(p.isBuffer(se))se.copy(j,Q);else throw new TypeError('"list" argument must be an Array of Buffers');Q+=se.length}return j};function V(S,g){if(p.isBuffer(S))return S.length;if(a.isView(S)||pt(S,a))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const y=S.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&y===0)return 0;let j=!1;for(;;)switch(g){case"ascii":case"latin1":case"binary":return y;case"utf8":case"utf-8":return Ie(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return y*2;case"hex":return y>>>1;case"base64":return ii(S).length;default:if(j)return P?-1:Ie(S).length;g=(""+g).toLowerCase(),j=!0}}p.byteLength=V;function G(S,g,y){let P=!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(S||(S="utf8");;)switch(S){case"hex":return Ee(this,g,y);case"utf8":case"utf-8":return te(this,g,y);case"ascii":return ce(this,g,y);case"latin1":case"binary":return ue(this,g,y);case"base64":return fe(this,g,y);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ae(this,g,y);default:if(P)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),P=!0}}p.prototype._isBuffer=!0;function ie(S,g,y){const P=S[g];S[g]=S[y],S[y]=P}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)ie(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)ie(this,y,y+3),ie(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)ie(this,y,y+7),ie(this,y+1,y+6),ie(this,y+2,y+5),ie(this,y+3,y+4);return this},p.prototype.toString=function(){const g=this.length;return g===0?"":arguments.length===0?te(this,0,g):G.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=r.INSPECT_MAX_BYTES;return g=this.toString("hex",0,y).replace(/(.{2})/g,"$1 ").trim(),this.length>y&&(g+=" ... "),"<Buffer "+g+">"},i&&(p.prototype[i]=p.prototype.inspect),p.prototype.compare=function(g,y,P,j,Q){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),P===void 0&&(P=g?g.length:0),j===void 0&&(j=0),Q===void 0&&(Q=this.length),y<0||P>g.length||j<0||Q>this.length)throw new RangeError("out of range index");if(j>=Q&&y>=P)return 0;if(j>=Q)return-1;if(y>=P)return 1;if(y>>>=0,P>>>=0,j>>>=0,Q>>>=0,this===g)return 0;let se=Q-j,we=P-y;const Ne=Math.min(se,we),Be=this.slice(j,Q),Ue=g.slice(y,P);for(let Le=0;Le<Ne;++Le)if(Be[Le]!==Ue[Le]){se=Be[Le],we=Ue[Le];break}return se<we?-1:we<se?1:0};function C(S,g,y,P,j){if(S.length===0)return-1;if(typeof y=="string"?(P=y,y=0):y>2147483647?y=2147483647:y<-2147483648&&(y=-2147483648),y=+y,ri(y)&&(y=j?0:S.length-1),y<0&&(y=S.length+y),y>=S.length){if(j)return-1;y=S.length-1}else if(y<0)if(j)y=0;else return-1;if(typeof g=="string"&&(g=p.from(g,P)),p.isBuffer(g))return g.length===0?-1:I(S,g,y,P,j);if(typeof g=="number")return g=g&255,typeof n.prototype.indexOf=="function"?j?n.prototype.indexOf.call(S,g,y):n.prototype.lastIndexOf.call(S,g,y):I(S,[g],y,P,j);throw new TypeError("val must be string, number or Buffer")}function I(S,g,y,P,j){let Q=1,se=S.length,we=g.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(S.length<2||g.length<2)return-1;Q=2,se/=2,we/=2,y/=2}function Ne(Ue,Le){return Q===1?Ue[Le]:Ue.readUInt16BE(Le*Q)}let Be;if(j){let Ue=-1;for(Be=y;Be<se;Be++)if(Ne(S,Be)===Ne(g,Ue===-1?0:Be-Ue)){if(Ue===-1&&(Ue=Be),Be-Ue+1===we)return Ue*Q}else Ue!==-1&&(Be-=Be-Ue),Ue=-1}else for(y+we>se&&(y=se-we),Be=y;Be>=0;Be--){let Ue=!0;for(let Le=0;Le<we;Le++)if(Ne(S,Be+Le)!==Ne(g,Le)){Ue=!1;break}if(Ue)return Be}return-1}p.prototype.includes=function(g,y,P){return this.indexOf(g,y,P)!==-1},p.prototype.indexOf=function(g,y,P){return C(this,g,y,P,!0)},p.prototype.lastIndexOf=function(g,y,P){return C(this,g,y,P,!1)};function W(S,g,y,P){y=Number(y)||0;const j=S.length-y;P?(P=Number(P),P>j&&(P=j)):P=j;const Q=g.length;P>Q/2&&(P=Q/2);let se;for(se=0;se<P;++se){const we=parseInt(g.substr(se*2,2),16);if(ri(we))return se;S[y+se]=we}return se}function Y(S,g,y,P){return Lt(Ie(g,S.length-y),S,y,P)}function X(S,g,y,P){return Lt(je(g),S,y,P)}function ne(S,g,y,P){return Lt(ii(g),S,y,P)}function de(S,g,y,P){return Lt(ze(g,S.length-y),S,y,P)}p.prototype.write=function(g,y,P,j){if(y===void 0)j="utf8",P=this.length,y=0;else if(P===void 0&&typeof y=="string")j=y,P=this.length,y=0;else if(isFinite(y))y=y>>>0,isFinite(P)?(P=P>>>0,j===void 0&&(j="utf8")):(j=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const Q=this.length-y;if((P===void 0||P>Q)&&(P=Q),g.length>0&&(P<0||y<0)||y>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");let se=!1;for(;;)switch(j){case"hex":return W(this,g,y,P);case"utf8":case"utf-8":return Y(this,g,y,P);case"ascii":case"latin1":case"binary":return X(this,g,y,P);case"base64":return ne(this,g,y,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return de(this,g,y,P);default:if(se)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),se=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function fe(S,g,y){return g===0&&y===S.length?e.fromByteArray(S):e.fromByteArray(S.slice(g,y))}function te(S,g,y){y=Math.min(S.length,y);const P=[];let j=g;for(;j<y;){const Q=S[j];let se=null,we=Q>239?4:Q>223?3:Q>191?2:1;if(j+we<=y){let Ne,Be,Ue,Le;switch(we){case 1:Q<128&&(se=Q);break;case 2:Ne=S[j+1],(Ne&192)===128&&(Le=(Q&31)<<6|Ne&63,Le>127&&(se=Le));break;case 3:Ne=S[j+1],Be=S[j+2],(Ne&192)===128&&(Be&192)===128&&(Le=(Q&15)<<12|(Ne&63)<<6|Be&63,Le>2047&&(Le<55296||Le>57343)&&(se=Le));break;case 4:Ne=S[j+1],Be=S[j+2],Ue=S[j+3],(Ne&192)===128&&(Be&192)===128&&(Ue&192)===128&&(Le=(Q&15)<<18|(Ne&63)<<12|(Be&63)<<6|Ue&63,Le>65535&&Le<1114112&&(se=Le))}}se===null?(se=65533,we=1):se>65535&&(se-=65536,P.push(se>>>10&1023|55296),se=56320|se&1023),P.push(se),j+=we}return oe(P)}const le=4096;function oe(S){const g=S.length;if(g<=le)return String.fromCharCode.apply(String,S);let y="",P=0;for(;P<g;)y+=String.fromCharCode.apply(String,S.slice(P,P+=le));return y}function ce(S,g,y){let P="";y=Math.min(S.length,y);for(let j=g;j<y;++j)P+=String.fromCharCode(S[j]&127);return P}function ue(S,g,y){let P="";y=Math.min(S.length,y);for(let j=g;j<y;++j)P+=String.fromCharCode(S[j]);return P}function Ee(S,g,y){const P=S.length;(!g||g<0)&&(g=0),(!y||y<0||y>P)&&(y=P);let j="";for(let Q=g;Q<y;++Q)j+=hi[S[Q]];return j}function Ae(S,g,y){const P=S.slice(g,y);let j="";for(let Q=0;Q<P.length-1;Q+=2)j+=String.fromCharCode(P[Q]+P[Q+1]*256);return j}p.prototype.slice=function(g,y){const P=this.length;g=~~g,y=y===void 0?P:~~y,g<0?(g+=P,g<0&&(g=0)):g>P&&(g=P),y<0?(y+=P,y<0&&(y=0)):y>P&&(y=P),y<g&&(y=g);const j=this.subarray(g,y);return Object.setPrototypeOf(j,p.prototype),j};function Te(S,g,y){if(S%1!==0||S<0)throw new RangeError("offset is not uint");if(S+g>y)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=this[g],Q=1,se=0;for(;++se<y&&(Q*=256);)j+=this[g+se]*Q;return j},p.prototype.readUintBE=p.prototype.readUIntBE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=this[g+--y],Q=1;for(;y>0&&(Q*=256);)j+=this[g+--y]*Q;return j},p.prototype.readUint8=p.prototype.readUInt8=function(g,y){return g=g>>>0,y||Te(g,1,this.length),this[g]},p.prototype.readUint16LE=p.prototype.readUInt16LE=function(g,y){return g=g>>>0,y||Te(g,2,this.length),this[g]|this[g+1]<<8},p.prototype.readUint16BE=p.prototype.readUInt16BE=function(g,y){return g=g>>>0,y||Te(g,2,this.length),this[g]<<8|this[g+1]},p.prototype.readUint32LE=p.prototype.readUInt32LE=function(g,y){return g=g>>>0,y||Te(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||Te(g,4,this.length),this[g]*16777216+(this[g+1]<<16|this[g+2]<<8|this[g+3])},p.prototype.readBigUInt64LE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24,Q=this[++g]+this[++g]*2**8+this[++g]*2**16+P*2**24;return BigInt(j)+(BigInt(Q)<<BigInt(32))}),p.prototype.readBigUInt64BE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=y*2**24+this[++g]*2**16+this[++g]*2**8+this[++g],Q=this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+P;return(BigInt(j)<<BigInt(32))+BigInt(Q)}),p.prototype.readIntLE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=this[g],Q=1,se=0;for(;++se<y&&(Q*=256);)j+=this[g+se]*Q;return Q*=128,j>=Q&&(j-=Math.pow(2,8*y)),j},p.prototype.readIntBE=function(g,y,P){g=g>>>0,y=y>>>0,P||Te(g,y,this.length);let j=y,Q=1,se=this[g+--j];for(;j>0&&(Q*=256);)se+=this[g+--j]*Q;return Q*=128,se>=Q&&(se-=Math.pow(2,8*y)),se},p.prototype.readInt8=function(g,y){return g=g>>>0,y||Te(g,1,this.length),this[g]&128?(255-this[g]+1)*-1:this[g]},p.prototype.readInt16LE=function(g,y){g=g>>>0,y||Te(g,2,this.length);const P=this[g]|this[g+1]<<8;return P&32768?P|4294901760:P},p.prototype.readInt16BE=function(g,y){g=g>>>0,y||Te(g,2,this.length);const P=this[g+1]|this[g]<<8;return P&32768?P|4294901760:P},p.prototype.readInt32LE=function(g,y){return g=g>>>0,y||Te(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||Te(g,4,this.length),this[g]<<24|this[g+1]<<16|this[g+2]<<8|this[g+3]},p.prototype.readBigInt64LE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=this[g+4]+this[g+5]*2**8+this[g+6]*2**16+(P<<24);return(BigInt(j)<<BigInt(32))+BigInt(y+this[++g]*2**8+this[++g]*2**16+this[++g]*2**24)}),p.prototype.readBigInt64BE=Tt(function(g){g=g>>>0,He(g,"offset");const y=this[g],P=this[g+7];(y===void 0||P===void 0)&&Ht(g,this.length-8);const j=(y<<24)+this[++g]*2**16+this[++g]*2**8+this[++g];return(BigInt(j)<<BigInt(32))+BigInt(this[++g]*2**24+this[++g]*2**16+this[++g]*2**8+P)}),p.prototype.readFloatLE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),t.read(this,g,!0,23,4)},p.prototype.readFloatBE=function(g,y){return g=g>>>0,y||Te(g,4,this.length),t.read(this,g,!1,23,4)},p.prototype.readDoubleLE=function(g,y){return g=g>>>0,y||Te(g,8,this.length),t.read(this,g,!0,52,8)},p.prototype.readDoubleBE=function(g,y){return g=g>>>0,y||Te(g,8,this.length),t.read(this,g,!1,52,8)};function _e(S,g,y,P,j,Q){if(!p.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(g>j||g<Q)throw new RangeError('"value" argument is out of bounds');if(y+P>S.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(g,y,P,j){if(g=+g,y=y>>>0,P=P>>>0,!j){const we=Math.pow(2,8*P)-1;_e(this,g,y,P,we,0)}let Q=1,se=0;for(this[y]=g&255;++se<P&&(Q*=256);)this[y+se]=g/Q&255;return y+P},p.prototype.writeUintBE=p.prototype.writeUIntBE=function(g,y,P,j){if(g=+g,y=y>>>0,P=P>>>0,!j){const we=Math.pow(2,8*P)-1;_e(this,g,y,P,we,0)}let Q=P-1,se=1;for(this[y+Q]=g&255;--Q>=0&&(se*=256);)this[y+Q]=g/se&255;return y+P},p.prototype.writeUint8=p.prototype.writeUInt8=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,1,255,0),this[y]=g&255,y+1},p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(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,P){return g=+g,y=y>>>0,P||_e(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,P){return g=+g,y=y>>>0,P||_e(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,P){return g=+g,y=y>>>0,P||_e(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 lt(S,g,y,P,j){ti(g,P,j,S,y,7);let Q=Number(g&BigInt(4294967295));S[y++]=Q,Q=Q>>8,S[y++]=Q,Q=Q>>8,S[y++]=Q,Q=Q>>8,S[y++]=Q;let se=Number(g>>BigInt(32)&BigInt(4294967295));return S[y++]=se,se=se>>8,S[y++]=se,se=se>>8,S[y++]=se,se=se>>8,S[y++]=se,y}function dt(S,g,y,P,j){ti(g,P,j,S,y,7);let Q=Number(g&BigInt(4294967295));S[y+7]=Q,Q=Q>>8,S[y+6]=Q,Q=Q>>8,S[y+5]=Q,Q=Q>>8,S[y+4]=Q;let se=Number(g>>BigInt(32)&BigInt(4294967295));return S[y+3]=se,se=se>>8,S[y+2]=se,se=se>>8,S[y+1]=se,se=se>>8,S[y]=se,y+8}p.prototype.writeBigUInt64LE=Tt(function(g,y=0){return lt(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeBigUInt64BE=Tt(function(g,y=0){return dt(this,g,y,BigInt(0),BigInt("0xffffffffffffffff"))}),p.prototype.writeIntLE=function(g,y,P,j){if(g=+g,y=y>>>0,!j){const Ne=Math.pow(2,8*P-1);_e(this,g,y,P,Ne-1,-Ne)}let Q=0,se=1,we=0;for(this[y]=g&255;++Q<P&&(se*=256);)g<0&&we===0&&this[y+Q-1]!==0&&(we=1),this[y+Q]=(g/se>>0)-we&255;return y+P},p.prototype.writeIntBE=function(g,y,P,j){if(g=+g,y=y>>>0,!j){const Ne=Math.pow(2,8*P-1);_e(this,g,y,P,Ne-1,-Ne)}let Q=P-1,se=1,we=0;for(this[y+Q]=g&255;--Q>=0&&(se*=256);)g<0&&we===0&&this[y+Q+1]!==0&&(we=1),this[y+Q]=(g/se>>0)-we&255;return y+P},p.prototype.writeInt8=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,1,127,-128),g<0&&(g=255+g+1),this[y]=g&255,y+1},p.prototype.writeInt16LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,2,32767,-32768),this[y]=g&255,this[y+1]=g>>>8,y+2},p.prototype.writeInt16BE=function(g,y,P){return g=+g,y=y>>>0,P||_e(this,g,y,2,32767,-32768),this[y]=g>>>8,this[y+1]=g&255,y+2},p.prototype.writeInt32LE=function(g,y,P){return g=+g,y=y>>>0,P||_e(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,P){return g=+g,y=y>>>0,P||_e(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=Tt(function(g,y=0){return lt(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),p.prototype.writeBigInt64BE=Tt(function(g,y=0){return dt(this,g,y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function tt(S,g,y,P,j,Q){if(y+P>S.length)throw new RangeError("Index out of range");if(y<0)throw new RangeError("Index out of range")}function ht(S,g,y,P,j){return g=+g,y=y>>>0,j||tt(S,g,y,4),t.write(S,g,y,P,23,4),y+4}p.prototype.writeFloatLE=function(g,y,P){return ht(this,g,y,!0,P)},p.prototype.writeFloatBE=function(g,y,P){return ht(this,g,y,!1,P)};function Ct(S,g,y,P,j){return g=+g,y=y>>>0,j||tt(S,g,y,8),t.write(S,g,y,P,52,8),y+8}p.prototype.writeDoubleLE=function(g,y,P){return Ct(this,g,y,!0,P)},p.prototype.writeDoubleBE=function(g,y,P){return Ct(this,g,y,!1,P)},p.prototype.copy=function(g,y,P,j){if(!p.isBuffer(g))throw new TypeError("argument should be a Buffer");if(P||(P=0),!j&&j!==0&&(j=this.length),y>=g.length&&(y=g.length),y||(y=0),j>0&&j<P&&(j=P),j===P||g.length===0||this.length===0)return 0;if(y<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),g.length-y<j-P&&(j=g.length-y+P);const Q=j-P;return this===g&&typeof n.prototype.copyWithin=="function"?this.copyWithin(y,P,j):n.prototype.set.call(g,this.subarray(P,j),y),Q},p.prototype.fill=function(g,y,P,j){if(typeof g=="string"){if(typeof y=="string"?(j=y,y=0,P=this.length):typeof P=="string"&&(j=P,P=this.length),j!==void 0&&typeof j!="string")throw new TypeError("encoding must be a string");if(typeof j=="string"&&!p.isEncoding(j))throw new TypeError("Unknown encoding: "+j);if(g.length===1){const se=g.charCodeAt(0);(j==="utf8"&&se<128||j==="latin1")&&(g=se)}}else typeof g=="number"?g=g&255:typeof g=="boolean"&&(g=Number(g));if(y<0||this.length<y||this.length<P)throw new RangeError("Out of range index");if(P<=y)return this;y=y>>>0,P=P===void 0?this.length:P>>>0,g||(g=0);let Q;if(typeof g=="number")for(Q=y;Q<P;++Q)this[Q]=g;else{const se=p.isBuffer(g)?g:p.from(g,j),we=se.length;if(we===0)throw new TypeError('The value "'+g+'" is invalid for argument "value"');for(Q=0;Q<P-y;++Q)this[Q+y]=se[Q%we]}return this};const Qe={};function ft(S,g,y){Qe[S]=class extends y{constructor(){super(),Object.defineProperty(this,"message",{value:g.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${S}]`,this.stack,delete this.name}get code(){return S}set code(j){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:j,writable:!0})}toString(){return`${this.name} [${S}]: ${this.message}`}}}ft("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ft("ERR_INVALID_ARG_TYPE",function(S,g){return`The "${S}" argument must be of type number. Received type ${typeof g}`},TypeError),ft("ERR_OUT_OF_RANGE",function(S,g,y){let P=`The value of "${S}" is out of range.`,j=y;return Number.isInteger(y)&&Math.abs(y)>2**32?j=ei(String(y)):typeof y=="bigint"&&(j=String(y),(y>BigInt(2)**BigInt(32)||y<-(BigInt(2)**BigInt(32)))&&(j=ei(j)),j+="n"),P+=` It must be ${g}. Received ${j}`,P},RangeError);function ei(S){let g="",y=S.length;const P=S[0]==="-"?1:0;for(;y>=P+4;y-=3)g=`_${S.slice(y-3,y)}${g}`;return`${S.slice(0,y)}${g}`}function ut(S,g,y){He(g,"offset"),(S[g]===void 0||S[g+y]===void 0)&&Ht(g,S.length-(y+1))}function ti(S,g,y,P,j,Q){if(S>y||S<g){const se=typeof g=="bigint"?"n":"";let we;throw g===0||g===BigInt(0)?we=`>= 0${se} and < 2${se} ** ${(Q+1)*8}${se}`:we=`>= -(2${se} ** ${(Q+1)*8-1}${se}) and < 2 ** ${(Q+1)*8-1}${se}`,new Qe.ERR_OUT_OF_RANGE("value",we,S)}ut(P,j,Q)}function He(S,g){if(typeof S!="number")throw new Qe.ERR_INVALID_ARG_TYPE(g,"number",S)}function Ht(S,g,y){throw Math.floor(S)!==S?(He(S,y),new Qe.ERR_OUT_OF_RANGE("offset","an integer",S)):g<0?new Qe.ERR_BUFFER_OUT_OF_BOUNDS:new Qe.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${g}`,S)}const At=/[^+/0-9A-Za-z-_]/g;function Rt(S){if(S=S.split("=")[0],S=S.trim().replace(At,""),S.length<2)return"";for(;S.length%4!==0;)S=S+"=";return S}function Ie(S,g){g=g||1/0;let y;const P=S.length;let j=null;const Q=[];for(let se=0;se<P;++se){if(y=S.charCodeAt(se),y>55295&&y<57344){if(!j){if(y>56319){(g-=3)>-1&&Q.push(239,191,189);continue}else if(se+1===P){(g-=3)>-1&&Q.push(239,191,189);continue}j=y;continue}if(y<56320){(g-=3)>-1&&Q.push(239,191,189),j=y;continue}y=(j-55296<<10|y-56320)+65536}else j&&(g-=3)>-1&&Q.push(239,191,189);if(j=null,y<128){if((g-=1)<0)break;Q.push(y)}else if(y<2048){if((g-=2)<0)break;Q.push(y>>6|192,y&63|128)}else if(y<65536){if((g-=3)<0)break;Q.push(y>>12|224,y>>6&63|128,y&63|128)}else if(y<1114112){if((g-=4)<0)break;Q.push(y>>18|240,y>>12&63|128,y>>6&63|128,y&63|128)}else throw new Error("Invalid code point")}return Q}function je(S){const g=[];for(let y=0;y<S.length;++y)g.push(S.charCodeAt(y)&255);return g}function ze(S,g){let y,P,j;const Q=[];for(let se=0;se<S.length&&!((g-=2)<0);++se)y=S.charCodeAt(se),P=y>>8,j=y%256,Q.push(j),Q.push(P);return Q}function ii(S){return e.toByteArray(Rt(S))}function Lt(S,g,y,P){let j;for(j=0;j<P&&!(j+y>=g.length||j>=S.length);++j)g[j+y]=S[j];return j}function pt(S,g){return S instanceof g||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===g.name}function ri(S){return S!==S}const hi=(function(){const S="0123456789abcdef",g=new Array(256);for(let y=0;y<16;++y){const P=y*16;for(let j=0;j<16;++j)g[P+j]=S[y]+S[j]}return g})();function Tt(S){return typeof BigInt>"u"?Xi:S}function Xi(){throw new Error("BigInt not supported")}})(Vd);const My=Vd.Buffer;var Fy=function(e){return N.atob?N.atob(e):My.from(e,"base64").toString("binary")};function zd(r){for(var e=Fy(r),t=new Uint8Array(e.length),i=0;i<e.length;i++)t[i]=e.charCodeAt(i);return t}class Uy extends qo{constructor(){super(),this.buffer=""}push(e){let t;for(this.buffer+=e,t=this.buffer.indexOf(`
|
|
22
11
|
`);t>-1;t=this.buffer.indexOf(`
|
|
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,`
|
|
12
|
+
`))this.trigger("data",this.buffer.substring(0,t)),this.buffer=this.buffer.substring(t+1)}}const $y=" ",ja=function(r){const e=/([0-9.]*)?@?([0-9.]*)?/.exec(r||""),t={};return e[1]&&(t.length=parseInt(e[1],10)),e[2]&&(t.offset=parseInt(e[2],10)),t},jy=function(){const t="(?:"+"[^=]*"+")=(?:"+'"[^"]*"|[^,]*'+")";return new RegExp("(?:^|,)("+t+")")},Dt=function(r){const e={};if(!r)return e;const t=r.split(jy());let i=t.length,s;for(;i--;)t[i]!==""&&(s=/([^=]*)=(.*)/.exec(t[i]).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},Qu=r=>{const e=r.split("x"),t={};return e[0]&&(t.width=parseInt(e[0],10)),e[1]&&(t.height=parseInt(e[1],10)),t};class qy extends qo{constructor(){super(),this.customParsers=[],this.tagMappers=[]}push(e){let t,i;if(e=e.trim(),e.length===0)return;if(e[0]!=="#"){this.trigger("data",{type:"uri",uri:e});return}this.tagMappers.reduce((n,a)=>{const o=a(e);return o===e?n:n.concat([o])},[e]).forEach(n=>{for(let a=0;a<this.customParsers.length;a++)if(this.customParsers[a].call(this,n))return;if(n.indexOf("#EXT")!==0){this.trigger("data",{type:"comment",text:n.slice(1)});return}if(n=n.replace("\r",""),t=/^#EXTM3U/.exec(n),t){this.trigger("data",{type:"tag",tagType:"m3u"});return}if(t=/^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(n),t){i={type:"tag",tagType:"inf"},t[1]&&(i.duration=parseFloat(t[1])),t[2]&&(i.title=t[2]),this.trigger("data",i);return}if(t=/^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"targetduration"},t[1]&&(i.duration=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-VERSION:([0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"version"},t[1]&&(i.version=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"media-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(n),t){i={type:"tag",tagType:"discontinuity-sequence"},t[1]&&(i.number=parseInt(t[1],10)),this.trigger("data",i);return}if(t=/^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(n),t){i={type:"tag",tagType:"playlist-type"},t[1]&&(i.playlistType=t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-BYTERANGE:(.*)?$/.exec(n),t){i=ot(ja(t[1]),{type:"tag",tagType:"byterange"}),this.trigger("data",i);return}if(t=/^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(n),t){i={type:"tag",tagType:"allow-cache"},t[1]&&(i.allowed=!/NO/.test(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-MAP:(.*)$/.exec(n),t){if(i={type:"tag",tagType:"map"},t[1]){const a=Dt(t[1]);a.URI&&(i.uri=a.URI),a.BYTERANGE&&(i.byterange=ja(a.BYTERANGE))}this.trigger("data",i);return}if(t=/^#EXT-X-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"stream-inf"},t[1]&&(i.attributes=Dt(t[1]),i.attributes.RESOLUTION&&(i.attributes.RESOLUTION=Qu(i.attributes.RESOLUTION)),i.attributes.BANDWIDTH&&(i.attributes.BANDWIDTH=parseInt(i.attributes.BANDWIDTH,10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),i.attributes["PROGRAM-ID"]&&(i.attributes["PROGRAM-ID"]=parseInt(i.attributes["PROGRAM-ID"],10))),this.trigger("data",i);return}if(t=/^#EXT-X-MEDIA:(.*)$/.exec(n),t){i={type:"tag",tagType:"media"},t[1]&&(i.attributes=Dt(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-ENDLIST/.exec(n),t){this.trigger("data",{type:"tag",tagType:"endlist"});return}if(t=/^#EXT-X-DISCONTINUITY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"discontinuity"});return}if(t=/^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(n),t){i={type:"tag",tagType:"program-date-time"},t[1]&&(i.dateTimeString=t[1],i.dateTimeObject=new Date(t[1])),this.trigger("data",i);return}if(t=/^#EXT-X-KEY:(.*)$/.exec(n),t){i={type:"tag",tagType:"key"},t[1]&&(i.attributes=Dt(t[1]),i.attributes.IV&&(i.attributes.IV.substring(0,2).toLowerCase()==="0x"&&(i.attributes.IV=i.attributes.IV.substring(2)),i.attributes.IV=i.attributes.IV.match(/.{8}/g),i.attributes.IV[0]=parseInt(i.attributes.IV[0],16),i.attributes.IV[1]=parseInt(i.attributes.IV[1],16),i.attributes.IV[2]=parseInt(i.attributes.IV[2],16),i.attributes.IV[3]=parseInt(i.attributes.IV[3],16),i.attributes.IV=new Uint32Array(i.attributes.IV))),this.trigger("data",i);return}if(t=/^#EXT-X-START:(.*)$/.exec(n),t){i={type:"tag",tagType:"start"},t[1]&&(i.attributes=Dt(t[1]),i.attributes["TIME-OFFSET"]=parseFloat(i.attributes["TIME-OFFSET"]),i.attributes.PRECISE=/YES/.test(i.attributes.PRECISE)),this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out-cont"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-OUT:(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-out"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-CUE-IN:?(.*)?$/.exec(n),t){i={type:"tag",tagType:"cue-in"},t[1]?i.data=t[1]:i.data="",this.trigger("data",i);return}if(t=/^#EXT-X-SKIP:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"skip"},i.attributes=Dt(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($y)),this.trigger("data",i);return}if(t=/^#EXT-X-PART:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part"},i.attributes=Dt(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=ja(i.attributes.BYTERANGE)),this.trigger("data",i);return}if(t=/^#EXT-X-SERVER-CONTROL:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"server-control"},i.attributes=Dt(t[1]),["CAN-SKIP-UNTIL","PART-HOLD-BACK","HOLD-BACK"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),["CAN-SKIP-DATERANGES","CAN-BLOCK-RELOAD"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=/YES/.test(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PART-INF:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"part-inf"},i.attributes=Dt(t[1]),["PART-TARGET"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseFloat(i.attributes[a]))}),this.trigger("data",i);return}if(t=/^#EXT-X-PRELOAD-HINT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"preload-hint"},i.attributes=Dt(t[1]),["BYTERANGE-START","BYTERANGE-LENGTH"].forEach(function(a){if(i.attributes.hasOwnProperty(a)){i.attributes[a]=parseInt(i.attributes[a],10);const o=a==="BYTERANGE-LENGTH"?"length":"offset";i.attributes.byterange=i.attributes.byterange||{},i.attributes.byterange[o]=i.attributes[a],delete i.attributes[a]}}),this.trigger("data",i);return}if(t=/^#EXT-X-RENDITION-REPORT:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"rendition-report"},i.attributes=Dt(t[1]),["LAST-MSN","LAST-PART"].forEach(function(a){i.attributes.hasOwnProperty(a)&&(i.attributes[a]=parseInt(i.attributes[a],10))}),this.trigger("data",i);return}if(t=/^#EXT-X-DATERANGE:(.*)$/.exec(n),t&&t[1]){i={type:"tag",tagType:"daterange"},i.attributes=Dt(t[1]),["ID","CLASS"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=String(i.attributes[o]))}),["START-DATE","END-DATE"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=new Date(i.attributes[o]))}),["DURATION","PLANNED-DURATION"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=parseFloat(i.attributes[o]))}),["END-ON-NEXT"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=/YES/i.test(i.attributes[o]))}),["SCTE35-CMD"," SCTE35-OUT","SCTE35-IN"].forEach(function(o){i.attributes.hasOwnProperty(o)&&(i.attributes[o]=i.attributes[o].toString(16))});const a=/^X-([A-Z]+-)+[A-Z]+$/;for(const o in i.attributes){if(!a.test(o))continue;const u=/[0-9A-Fa-f]{6}/g.test(i.attributes[o]),d=/^\d+(\.\d+)?$/.test(i.attributes[o]);i.attributes[o]=u?i.attributes[o].toString(16):d?parseFloat(i.attributes[o]):String(i.attributes[o])}this.trigger("data",i);return}if(t=/^#EXT-X-INDEPENDENT-SEGMENTS/.exec(n),t){this.trigger("data",{type:"tag",tagType:"independent-segments"});return}if(t=/^#EXT-X-I-FRAMES-ONLY/.exec(n),t){this.trigger("data",{type:"tag",tagType:"i-frames-only"});return}if(t=/^#EXT-X-CONTENT-STEERING:(.*)$/.exec(n),t){i={type:"tag",tagType:"content-steering"},i.attributes=Dt(t[1]),this.trigger("data",i);return}if(t=/^#EXT-X-I-FRAME-STREAM-INF:(.*)$/.exec(n),t){i={type:"tag",tagType:"i-frame-playlist"},i.attributes=Dt(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=Qu(i.attributes.RESOLUTION)),i.attributes["AVERAGE-BANDWIDTH"]&&(i.attributes["AVERAGE-BANDWIDTH"]=parseInt(i.attributes["AVERAGE-BANDWIDTH"],10)),i.attributes["FRAME-RATE"]&&(i.attributes["FRAME-RATE"]=parseFloat(i.attributes["FRAME-RATE"])),this.trigger("data",i);return}if(t=/^#EXT-X-DEFINE:(.*)$/.exec(n),t){i={type:"tag",tagType:"define"},i.attributes=Dt(t[1]),this.trigger("data",i);return}this.trigger("data",{type:"tag",data:n.slice(4)})})}addParser({expression:e,customType:t,dataParser:i,segment:s}){typeof i!="function"&&(i=n=>n),this.customParsers.push(n=>{if(e.exec(n))return this.trigger("data",{type:"custom",data:i(n),customType:t,segment:s}),!0})}addTagMapper({expression:e,map:t}){const i=s=>e.test(s)?t(s):s;this.tagMappers.push(i)}}const Vy=r=>r.toLowerCase().replace(/-(\w)/g,e=>e[1].toUpperCase()),$i=function(r){const e={};return Object.keys(r).forEach(function(t){e[Vy(t)]=r[t]}),e},qa=function(r){const{serverControl:e,targetDuration:t,partTargetDuration:i}=r;if(!e)return;const s="#EXT-X-SERVER-CONTROL",n="holdBack",a="partHoldBack",o=t&&t*3,u=i&&i*2;t&&!e.hasOwnProperty(n)&&(e[n]=o,this.trigger("info",{message:`${s} defaulting HOLD-BACK to targetDuration * 3 (${o}).`})),o&&e[n]<o&&(this.trigger("warn",{message:`${s} clamping HOLD-BACK (${e[n]}) to targetDuration * 3 (${o})`}),e[n]=o),i&&!e.hasOwnProperty(a)&&(e[a]=i*3,this.trigger("info",{message:`${s} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${e[a]}).`})),i&&e[a]<u&&(this.trigger("warn",{message:`${s} clamping PART-HOLD-BACK (${e[a]}) to partTargetDuration * 2 (${u}).`}),e[a]=u)};class Hy extends qo{constructor(e={}){super(),this.lineStream=new Uy,this.parseStream=new qy,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 s={},n,a,o=!1;const u=function(){},d={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 A=0,b=0;const k={};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,U;if(t.manifest.definitions){for(const $ in t.manifest.definitions)if(v.uri&&(v.uri=v.uri.replace(`{$${$}}`,t.manifest.definitions[$])),v.attributes)for(const F in v.attributes)typeof v.attributes[F]=="string"&&(v.attributes[F]=v.attributes[F].replace(`{$${$}}`,t.manifest.definitions[$]))}({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 $={};"length"in v&&(s.byterange=$,$.length=v.length,"offset"in v||(v.offset=A)),"offset"in v&&(s.byterange=$,$.offset=v.offset),A=$.offset+$.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=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===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:zd(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=i,this.manifest.mediaGroups=this.manifest.mediaGroups||d,!v.attributes){this.trigger("warn",{message:"ignoring empty stream-inf attributes"});return}s.attributes||(s.attributes={}),ot(s.attributes,v.attributes)},media(){if(this.manifest.mediaGroups=this.manifest.mediaGroups||d,!(v.attributes&&v.attributes.TYPE&&v.attributes["GROUP-ID"]&&v.attributes.NAME)){this.trigger("warn",{message:"ignoring incomplete or missing media group"});return}const $=this.manifest.mediaGroups[v.attributes.TYPE];$[v.attributes["GROUP-ID"]]=$[v.attributes["GROUP-ID"]]||{},L=$[v.attributes["GROUP-ID"]],U={default:/yes/i.test(v.attributes.DEFAULT)},U.default?U.autoselect=!0:U.autoselect=/yes/i.test(v.attributes.AUTOSELECT),v.attributes.LANGUAGE&&(U.language=v.attributes.LANGUAGE),v.attributes.URI&&(U.uri=v.attributes.URI),v.attributes["INSTREAM-ID"]&&(U.instreamId=v.attributes["INSTREAM-ID"]),v.attributes.CHARACTERISTICS&&(U.characteristics=v.attributes.CHARACTERISTICS),v.attributes.FORCED&&(U.forced=/yes/i.test(v.attributes.FORCED)),L[v.attributes.NAME]=U},discontinuity(){T+=1,s.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),s.dateTimeString=v.dateTimeString,s.dateTimeObject=v.dateTimeObject;const{lastProgramDateTime:$}=this;this.lastProgramDateTime=new Date(v.dateTimeString).getTime(),$===null&&this.manifest.segments.reduceRight((F,H)=>(H.programDateTime=F-H.duration*1e3,H.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,qa.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=$i(v.attributes),this.warnOnMissingAttributes_("#EXT-X-SKIP",v.attributes,["SKIPPED-SEGMENTS"])},part(){o=!0;const $=this.manifest.segments.length,F=$i(v.attributes);s.parts=s.parts||[],s.parts.push(F),F.byterange&&(F.byterange.hasOwnProperty("offset")||(F.byterange.offset=b),b=F.byterange.offset+F.byterange.length);const H=s.parts.length-1;this.warnOnMissingAttributes_(`#EXT-X-PART #${H} for segment #${$}`,v.attributes,["URI","DURATION"]),this.manifest.renditionReports&&this.manifest.renditionReports.forEach((B,V)=>{B.hasOwnProperty("lastPart")||this.trigger("warn",{message:`#EXT-X-RENDITION-REPORT #${V} lacks required attribute(s): LAST-PART`})})},"server-control"(){const $=this.manifest.serverControl=$i(v.attributes);$.hasOwnProperty("canBlockReload")||($.canBlockReload=!1,this.trigger("info",{message:"#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"})),qa.call(this,this.manifest),$.canSkipDateranges&&!$.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 $=this.manifest.segments.length,F=$i(v.attributes),H=F.type&&F.type==="PART";s.preloadHints=s.preloadHints||[],s.preloadHints.push(F),F.byterange&&(F.byterange.hasOwnProperty("offset")||(F.byterange.offset=H?b:0,H&&(b=F.byterange.offset+F.byterange.length)));const B=s.preloadHints.length-1;if(this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${B} for segment #${$}`,v.attributes,["TYPE","URI"]),!!F.type)for(let V=0;V<s.preloadHints.length-1;V++){const G=s.preloadHints[V];G.type&&G.type===F.type&&this.trigger("warn",{message:`#EXT-X-PRELOAD-HINT #${B} for segment #${$} has the same TYPE ${F.type} as preload hint #${V}`})}},"rendition-report"(){const $=$i(v.attributes);this.manifest.renditionReports=this.manifest.renditionReports||[],this.manifest.renditionReports.push($);const F=this.manifest.renditionReports.length-1,H=["LAST-MSN","URI"];o&&H.push("LAST-PART"),this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${F}`,v.attributes,H)},"part-inf"(){this.manifest.partInf=$i(v.attributes),this.warnOnMissingAttributes_("#EXT-X-PART-INF",v.attributes,["PART-TARGET"]),this.manifest.partInf.partTarget&&(this.manifest.partTargetDuration=this.manifest.partInf.partTarget),qa.call(this,this.manifest)},daterange(){this.manifest.dateRanges.push($i(v.attributes));const $=this.manifest.dateRanges.length-1;this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${$}`,v.attributes,["ID","START-DATE"]);const F=this.manifest.dateRanges[$];F.endDate&&F.startDate&&new Date(F.endDate)<new Date(F.startDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"}),F.duration&&F.duration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE DURATION must not be negative"}),F.plannedDuration&&F.plannedDuration<0&&this.trigger("warn",{message:"EXT-X-DATERANGE PLANNED-DURATION must not be negative"});const H=!!F.endOnNext;if(H&&!F.class&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"}),H&&(F.duration||F.endDate)&&this.trigger("warn",{message:"EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"}),F.duration&&F.endDate){const V=F.startDate.getTime()+F.duration*1e3;this.manifest.dateRanges[$].endDate=new Date(V)}if(!k[F.id])k[F.id]=F;else{for(const V in k[F.id])if(F[V]&&JSON.stringify(k[F.id][V])!==JSON.stringify(F[V])){this.trigger("warn",{message:"EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes values"});break}const B=this.manifest.dateRanges.findIndex(V=>V.id===F.id);this.manifest.dateRanges[B]=ot(this.manifest.dateRanges[B],F),k[F.id]=ot(k[F.id],F),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=$i(v.attributes),this.warnOnMissingAttributes_("#EXT-X-CONTENT-STEERING",v.attributes,["SERVER-URI"])},define(){this.manifest.definitions=this.manifest.definitions||{};const $=(F,H)=>{if(F in this.manifest.definitions){this.trigger("error",{message:`EXT-X-DEFINE: Duplicate name ${F}`});return}this.manifest.definitions[F]=H};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 F=this.params.get(v.attributes.QUERYPARAM);if(!F){this.trigger("error",{message:`EXT-X-DEFINE: No query param ${v.attributes.QUERYPARAM}`});return}$(v.attributes.QUERYPARAM,decodeURIComponent(F));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}$(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}$(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,i.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),b=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,i){const s=[];i.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(`
|
|
13
|
+
`),this.manifest.dateRanges.length&&this.lastProgramDateTime===null&&this.trigger("warn",{message:"A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"}),this.lastProgramDateTime=null,this.trigger("end")}addParser(e){this.parseStream.addParser(e)}addTagMapper(e){this.parseStream.addTagMapper(e)}}var ar={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^/},zy=["video","audio","text"],Ju=["Video","Audio","Text"],Wd=function(e){return e&&e.replace(/avc1\.(\d+)\.(\d+)/i,function(t,i,s){var n=("00"+Number(i).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(","),i=[];return t.forEach(function(s){s=s.trim();var n;zy.forEach(function(a){var o=ar[a].exec(s.toLowerCase());if(!(!o||o.length<=1)){n=a;var u=s.substring(0,o[1].length),d=s.replace(u,"");i.push({type:u,details:d,mediaType:a})}}),n||i.push({type:s,details:"",mediaType:"unknown"})}),i},Wy=function(e,t){if(!e.mediaGroups.AUDIO||!t)return null;var i=e.mediaGroups.AUDIO[t];if(!i)return null;for(var s in i){var n=i[s];if(n.default&&n.playlists)return Ti(n.playlists[0].attributes.CODECS)}return null},Gd=function(e){return e===void 0&&(e=""),ar.audio.test(e.trim().toLowerCase())},Gy=function(e){return e===void 0&&(e=""),ar.text.test(e.trim().toLowerCase())},Pr=function(e){if(!(!e||typeof e!="string")){var t=e.toLowerCase().split(",").map(function(n){return Wd(n.trim())}),i="video";t.length===1&&Gd(t[0])?i="audio":t.length===1&&Gy(t[0])&&(i="application");var s="mp4";return t.every(function(n){return ar.mp4.test(n)})?s="mp4":t.every(function(n){return ar.webm.test(n)})?s="webm":t.every(function(n){return ar.ogg.test(n)})&&(s="ogg"),i+"/"+s+';codecs="'+e+'"'}},vs=function(e,t){return e===void 0&&(e=""),t===void 0&&(t=!1),N.MediaSource&&N.MediaSource.isTypeSupported&&N.MediaSource.isTypeSupported(Pr(e))||t&&N.ManagedMediaSource&&N.ManagedMediaSource.isTypeSupported&&N.ManagedMediaSource.isTypeSupported(Pr(e))||!1},Va=function(e){return e===void 0&&(e=""),e.toLowerCase().split(",").every(function(t){t=t.trim();for(var i=0;i<Ju.length;i++){var s=Ju[i];if(ar["muxer"+s].test(t))return!0}return!1})},Zu="mp4a.40.2",Ky="avc1.4d400d",Xy=/^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i,Yy=/^application\/dash\+xml/i,Kd=function(e){return Xy.test(e)?"hls":Yy.test(e)?"dash":e==="application/vnd.videojs.vhs+json"?"vhs-json":null},Qy=function(e){return e.toString(2).length},Jy=function(e){return Math.ceil(Qy(e)/8)},Xd=function(e){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer},Zy=function(e){return Xd(e)},be=function(e){return e instanceof Uint8Array?e:(!Array.isArray(e)&&!Zy(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))},vt=N.BigInt||Number,fo=[vt("0x1"),vt("0x100"),vt("0x10000"),vt("0x1000000"),vt("0x100000000"),vt("0x10000000000"),vt("0x1000000000000"),vt("0x100000000000000"),vt("0x10000000000000000")];(function(){var r=new Uint16Array([65484]),e=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);return e[0]===255?"big":e[0]===204?"little":"unknown"})();var e_=function(e,t){var i=t===void 0?{}:t,s=i.signed,n=s===void 0?!1:s,a=i.le,o=a===void 0?!1:a;e=be(e);var u=o?"reduce":"reduceRight",d=e[u]?e[u]:Array.prototype[u],p=d.call(e,function(A,b,k){var v=o?k:Math.abs(k+1-e.length);return A+vt(b)*fo[v]},vt(0));if(n){var T=fo[e.length]/vt(2)-vt(1);p=vt(p),p>T&&(p-=T,p-=T,p-=vt(2))}return Number(p)},t_=function(e,t){var i={},s=i.le,n=s===void 0?!1:s;(typeof e!="bigint"&&typeof e!="number"||typeof e=="number"&&e!==e)&&(e=0),e=vt(e);for(var a=Jy(e),o=new Uint8Array(new ArrayBuffer(a)),u=0;u<a;u++){var d=n?u:Math.abs(u+1-o.length);o[d]=Number(e/fo[u]&vt(255)),e<0&&(o[d]=Math.abs(~o[d]),o[d]-=u===0?1:2)}return o},Yd=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),s=0;s<e.length;s++)i[s]=e.charCodeAt(s);return i},i_=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];if(t=t.filter(function(o){return o&&(o.byteLength||o.length)&&typeof o!="string"}),t.length<=1)return be(t[0]);var s=t.reduce(function(o,u,d){return o+(u.byteLength||u.length)},0),n=new Uint8Array(s),a=0;return t.forEach(function(o){o=be(o),n.set(o,a),a+=o.byteLength}),n},Ze=function(e,t,i){var s=i===void 0?{}:i,n=s.offset,a=n===void 0?0:n,o=s.mask,u=o===void 0?[]:o;e=be(e),t=be(t);var d=t.every?t.every:Array.prototype.every;return t.length&&e.length-a>=t.length&&d.call(t,function(p,T){var A=u[T]?u[T]&e[a+T]:e[a+T];return p===A})},r_=function(e,t,i){t.forEach(function(s){for(var n in e.mediaGroups[s])for(var a in e.mediaGroups[s][n]){var o=e.mediaGroups[s][n][a];i(o,s,n,a)}})},ds={},Ri={},er={},ec;function Kn(){if(ec)return er;ec=1;function r(n,a,o){if(o===void 0&&(o=Array.prototype),n&&typeof o.find=="function")return o.find.call(n,a);for(var u=0;u<n.length;u++)if(Object.prototype.hasOwnProperty.call(n,u)){var d=n[u];if(a.call(void 0,d,u,n))return d}}function e(n,a){return a===void 0&&(a=Object),a&&typeof a.freeze=="function"?a.freeze(n):n}function t(n,a){if(n===null||typeof n!="object")throw new TypeError("target is not an object");for(var o in a)Object.prototype.hasOwnProperty.call(a,o)&&(n[o]=a[o]);return n}var i=e({HTML:"text/html",isHTML:function(n){return n===i.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),s=e({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(n){return n===s.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"});return er.assign=t,er.find=r,er.freeze=e,er.MIME_TYPE=i,er.NAMESPACE=s,er}var tc;function Qd(){if(tc)return Ri;tc=1;var r=Kn(),e=r.find,t=r.NAMESPACE;function i(x){return x!==""}function s(x){return x?x.split(/[\t\n\f\r ]+/).filter(i):[]}function n(x,E){return x.hasOwnProperty(E)||(x[E]=!0),x}function a(x){if(!x)return[];var E=s(x);return Object.keys(E.reduce(n,{}))}function o(x){return function(E){return x&&x.indexOf(E)!==-1}}function u(x,E){for(var M in x)Object.prototype.hasOwnProperty.call(x,M)&&(E[M]=x[M])}function d(x,E){var M=x.prototype;if(!(M instanceof E)){let K=function(){};K.prototype=E.prototype,K=new K,u(M,K),x.prototype=M=K}M.constructor!=x&&(typeof x!="function"&&console.error("unknown Class:"+x),M.constructor=x)}var p={},T=p.ELEMENT_NODE=1,A=p.ATTRIBUTE_NODE=2,b=p.TEXT_NODE=3,k=p.CDATA_SECTION_NODE=4,v=p.ENTITY_REFERENCE_NODE=5,L=p.ENTITY_NODE=6,U=p.PROCESSING_INSTRUCTION_NODE=7,$=p.COMMENT_NODE=8,F=p.DOCUMENT_NODE=9,H=p.DOCUMENT_TYPE_NODE=10,B=p.DOCUMENT_FRAGMENT_NODE=11,V=p.NOTATION_NODE=12,G={},ie={};G.INDEX_SIZE_ERR=(ie[1]="Index size error",1),G.DOMSTRING_SIZE_ERR=(ie[2]="DOMString size error",2);var C=G.HIERARCHY_REQUEST_ERR=(ie[3]="Hierarchy request error",3);G.WRONG_DOCUMENT_ERR=(ie[4]="Wrong document",4),G.INVALID_CHARACTER_ERR=(ie[5]="Invalid character",5),G.NO_DATA_ALLOWED_ERR=(ie[6]="No data allowed",6),G.NO_MODIFICATION_ALLOWED_ERR=(ie[7]="No modification allowed",7);var I=G.NOT_FOUND_ERR=(ie[8]="Not found",8);G.NOT_SUPPORTED_ERR=(ie[9]="Not supported",9);var W=G.INUSE_ATTRIBUTE_ERR=(ie[10]="Attribute in use",10);G.INVALID_STATE_ERR=(ie[11]="Invalid state",11),G.SYNTAX_ERR=(ie[12]="Syntax error",12),G.INVALID_MODIFICATION_ERR=(ie[13]="Invalid modification",13),G.NAMESPACE_ERR=(ie[14]="Invalid namespace",14),G.INVALID_ACCESS_ERR=(ie[15]="Invalid access",15);function Y(x,E){if(E instanceof Error)var M=E;else M=this,Error.call(this,ie[x]),this.message=ie[x],Error.captureStackTrace&&Error.captureStackTrace(this,Y);return M.code=x,E&&(this.message=this.message+": "+E),M}Y.prototype=Error.prototype,u(G,Y);function X(){}X.prototype={length:0,item:function(x){return x>=0&&x<this.length?this[x]:null},toString:function(x,E){for(var M=[],K=0;K<this.length;K++)Ne(this[K],M,x,E);return M.join("")},filter:function(x){return Array.prototype.filter.call(this,x)},indexOf:function(x){return Array.prototype.indexOf.call(this,x)}};function ne(x,E){this._node=x,this._refresh=E,de(this)}function de(x){var E=x._node._inc||x._node.ownerDocument._inc;if(x._inc!==E){var M=x._refresh(x._node);if(Le(x,"length",M.length),!x.$$length||M.length<x.$$length)for(var K=M.length;K in x;K++)Object.prototype.hasOwnProperty.call(x,K)&&delete x[K];u(M,x),x._inc=E}}ne.prototype.item=function(x){return de(this),this[x]||null},d(ne,X);function fe(){}function te(x,E){for(var M=x.length;M--;)if(x[M]===E)return M}function le(x,E,M,K){if(K?E[te(E,K)]=M:E[E.length++]=M,x){M.ownerElement=x;var pe=x.ownerDocument;pe&&(K&<(pe,x,K),_e(pe,x,M))}}function oe(x,E,M){var K=te(E,M);if(K>=0){for(var pe=E.length-1;K<pe;)E[K]=E[++K];if(E.length=pe,x){var Se=x.ownerDocument;Se&&(lt(Se,x,M),M.ownerElement=null)}}else throw new Y(I,new Error(x.tagName+"@"+M))}fe.prototype={length:0,item:X.prototype.item,getNamedItem:function(x){for(var E=this.length;E--;){var M=this[E];if(M.nodeName==x)return M}},setNamedItem:function(x){var E=x.ownerElement;if(E&&E!=this._ownerElement)throw new Y(W);var M=this.getNamedItem(x.nodeName);return le(this._ownerElement,this,x,M),M},setNamedItemNS:function(x){var E=x.ownerElement,M;if(E&&E!=this._ownerElement)throw new Y(W);return M=this.getNamedItemNS(x.namespaceURI,x.localName),le(this._ownerElement,this,x,M),M},removeNamedItem:function(x){var E=this.getNamedItem(x);return oe(this._ownerElement,this,E),E},removeNamedItemNS:function(x,E){var M=this.getNamedItemNS(x,E);return oe(this._ownerElement,this,M),M},getNamedItemNS:function(x,E){for(var M=this.length;M--;){var K=this[M];if(K.localName==E&&K.namespaceURI==x)return K}return null}};function ce(){}ce.prototype={hasFeature:function(x,E){return!0},createDocument:function(x,E,M){var K=new Te;if(K.implementation=this,K.childNodes=new X,K.doctype=M||null,M&&K.appendChild(M),E){var pe=K.createElementNS(x,E);K.appendChild(pe)}return K},createDocumentType:function(x,E,M){var K=new Tt;return K.name=x,K.nodeName=x,K.publicId=E||"",K.systemId=M||"",K}};function ue(){}ue.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(x,E){return Rt(this,x,E)},replaceChild:function(x,E){Rt(this,x,E,At),E&&this.removeChild(E)},removeChild:function(x){return tt(this,x)},appendChild:function(x){return this.insertBefore(x,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(x){return Ue(this.ownerDocument||this,this,x)},normalize:function(){for(var x=this.firstChild;x;){var E=x.nextSibling;E&&E.nodeType==b&&x.nodeType==b?(this.removeChild(E),x.appendData(E.data)):(x.normalize(),x=E)}},isSupported:function(x,E){return this.ownerDocument.implementation.hasFeature(x,E)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(x){for(var E=this;E;){var M=E._nsMap;if(M){for(var K in M)if(Object.prototype.hasOwnProperty.call(M,K)&&M[K]===x)return K}E=E.nodeType==A?E.ownerDocument:E.parentNode}return null},lookupNamespaceURI:function(x){for(var E=this;E;){var M=E._nsMap;if(M&&Object.prototype.hasOwnProperty.call(M,x))return M[x];E=E.nodeType==A?E.ownerDocument:E.parentNode}return null},isDefaultNamespace:function(x){var E=this.lookupPrefix(x);return E==null}};function Ee(x){return x=="<"&&"<"||x==">"&&">"||x=="&"&&"&"||x=='"'&&"""||"&#"+x.charCodeAt()+";"}u(p,ue),u(p,ue.prototype);function Ae(x,E){if(E(x))return!0;if(x=x.firstChild)do if(Ae(x,E))return!0;while(x=x.nextSibling)}function Te(){this.ownerDocument=this}function _e(x,E,M){x&&x._inc++;var K=M.namespaceURI;K===t.XMLNS&&(E._nsMap[M.prefix?M.localName:""]=M.value)}function lt(x,E,M,K){x&&x._inc++;var pe=M.namespaceURI;pe===t.XMLNS&&delete E._nsMap[M.prefix?M.localName:""]}function dt(x,E,M){if(x&&x._inc){x._inc++;var K=E.childNodes;if(M)K[K.length++]=M;else{for(var pe=E.firstChild,Se=0;pe;)K[Se++]=pe,pe=pe.nextSibling;K.length=Se,delete K[K.length]}}}function tt(x,E){var M=E.previousSibling,K=E.nextSibling;return M?M.nextSibling=K:x.firstChild=K,K?K.previousSibling=M:x.lastChild=M,E.parentNode=null,E.previousSibling=null,E.nextSibling=null,dt(x.ownerDocument,x),E}function ht(x){return x&&(x.nodeType===ue.DOCUMENT_NODE||x.nodeType===ue.DOCUMENT_FRAGMENT_NODE||x.nodeType===ue.ELEMENT_NODE)}function Ct(x){return x&&(ft(x)||ei(x)||Qe(x)||x.nodeType===ue.DOCUMENT_FRAGMENT_NODE||x.nodeType===ue.COMMENT_NODE||x.nodeType===ue.PROCESSING_INSTRUCTION_NODE)}function Qe(x){return x&&x.nodeType===ue.DOCUMENT_TYPE_NODE}function ft(x){return x&&x.nodeType===ue.ELEMENT_NODE}function ei(x){return x&&x.nodeType===ue.TEXT_NODE}function ut(x,E){var M=x.childNodes||[];if(e(M,ft)||Qe(E))return!1;var K=e(M,Qe);return!(E&&K&&M.indexOf(K)>M.indexOf(E))}function ti(x,E){var M=x.childNodes||[];function K(Se){return ft(Se)&&Se!==E}if(e(M,K))return!1;var pe=e(M,Qe);return!(E&&pe&&M.indexOf(pe)>M.indexOf(E))}function He(x,E,M){if(!ht(x))throw new Y(C,"Unexpected parent node type "+x.nodeType);if(M&&M.parentNode!==x)throw new Y(I,"child not in parent");if(!Ct(E)||Qe(E)&&x.nodeType!==ue.DOCUMENT_NODE)throw new Y(C,"Unexpected node type "+E.nodeType+" for parent node type "+x.nodeType)}function Ht(x,E,M){var K=x.childNodes||[],pe=E.childNodes||[];if(E.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var Se=pe.filter(ft);if(Se.length>1||e(pe,ei))throw new Y(C,"More than one element or text in fragment");if(Se.length===1&&!ut(x,M))throw new Y(C,"Element in fragment can not be inserted before doctype")}if(ft(E)&&!ut(x,M))throw new Y(C,"Only one element can be added and only after doctype");if(Qe(E)){if(e(K,Qe))throw new Y(C,"Only one doctype is allowed");var qe=e(K,ft);if(M&&K.indexOf(qe)<K.indexOf(M))throw new Y(C,"Doctype can only be inserted before an element");if(!M&&qe)throw new Y(C,"Doctype can not be appended since element is present")}}function At(x,E,M){var K=x.childNodes||[],pe=E.childNodes||[];if(E.nodeType===ue.DOCUMENT_FRAGMENT_NODE){var Se=pe.filter(ft);if(Se.length>1||e(pe,ei))throw new Y(C,"More than one element or text in fragment");if(Se.length===1&&!ti(x,M))throw new Y(C,"Element in fragment can not be inserted before doctype")}if(ft(E)&&!ti(x,M))throw new Y(C,"Only one element can be added and only after doctype");if(Qe(E)){if(e(K,function(Ft){return Qe(Ft)&&Ft!==M}))throw new Y(C,"Only one doctype is allowed");var qe=e(K,ft);if(M&&K.indexOf(qe)<K.indexOf(M))throw new Y(C,"Doctype can only be inserted before an element")}}function Rt(x,E,M,K){He(x,E,M),x.nodeType===ue.DOCUMENT_NODE&&(K||Ht)(x,E,M);var pe=E.parentNode;if(pe&&pe.removeChild(E),E.nodeType===B){var Se=E.firstChild;if(Se==null)return E;var qe=E.lastChild}else Se=qe=E;var bt=M?M.previousSibling:x.lastChild;Se.previousSibling=bt,qe.nextSibling=M,bt?bt.nextSibling=Se:x.firstChild=Se,M==null?x.lastChild=qe:M.previousSibling=qe;do{Se.parentNode=x;var Ft=x.ownerDocument||x;Ie(Se,Ft)}while(Se!==qe&&(Se=Se.nextSibling));return dt(x.ownerDocument||x,x),E.nodeType==B&&(E.firstChild=E.lastChild=null),E}function Ie(x,E){if(x.ownerDocument!==E){if(x.ownerDocument=E,x.nodeType===T&&x.attributes)for(var M=0;M<x.attributes.length;M++){var K=x.attributes.item(M);K&&(K.ownerDocument=E)}for(var pe=x.firstChild;pe;)Ie(pe,E),pe=pe.nextSibling}}function je(x,E){E.parentNode&&E.parentNode.removeChild(E),E.parentNode=x,E.previousSibling=x.lastChild,E.nextSibling=null,E.previousSibling?E.previousSibling.nextSibling=E:x.firstChild=E,x.lastChild=E,dt(x.ownerDocument,x,E);var M=x.ownerDocument||x;return Ie(E,M),E}Te.prototype={nodeName:"#document",nodeType:F,doctype:null,documentElement:null,_inc:1,insertBefore:function(x,E){if(x.nodeType==B){for(var M=x.firstChild;M;){var K=M.nextSibling;this.insertBefore(M,E),M=K}return x}return Rt(this,x,E),Ie(x,this),this.documentElement===null&&x.nodeType===T&&(this.documentElement=x),x},removeChild:function(x){return this.documentElement==x&&(this.documentElement=null),tt(this,x)},replaceChild:function(x,E){Rt(this,x,E,At),Ie(x,this),E&&this.removeChild(E),ft(x)&&(this.documentElement=x)},importNode:function(x,E){return Be(this,x,E)},getElementById:function(x){var E=null;return Ae(this.documentElement,function(M){if(M.nodeType==T&&M.getAttribute("id")==x)return E=M,!0}),E},getElementsByClassName:function(x){var E=a(x);return new ne(this,function(M){var K=[];return E.length>0&&Ae(M.documentElement,function(pe){if(pe!==M&&pe.nodeType===T){var Se=pe.getAttribute("class");if(Se){var qe=x===Se;if(!qe){var bt=a(Se);qe=E.every(o(bt))}qe&&K.push(pe)}}}),K})},createElement:function(x){var E=new ze;E.ownerDocument=this,E.nodeName=x,E.tagName=x,E.localName=x,E.childNodes=new X;var M=E.attributes=new fe;return M._ownerElement=E,E},createDocumentFragment:function(){var x=new y;return x.ownerDocument=this,x.childNodes=new X,x},createTextNode:function(x){var E=new pt;return E.ownerDocument=this,E.appendData(x),E},createComment:function(x){var E=new ri;return E.ownerDocument=this,E.appendData(x),E},createCDATASection:function(x){var E=new hi;return E.ownerDocument=this,E.appendData(x),E},createProcessingInstruction:function(x,E){var M=new P;return M.ownerDocument=this,M.tagName=M.nodeName=M.target=x,M.nodeValue=M.data=E,M},createAttribute:function(x){var E=new ii;return E.ownerDocument=this,E.name=x,E.nodeName=x,E.localName=x,E.specified=!0,E},createEntityReference:function(x){var E=new g;return E.ownerDocument=this,E.nodeName=x,E},createElementNS:function(x,E){var M=new ze,K=E.split(":"),pe=M.attributes=new fe;return M.childNodes=new X,M.ownerDocument=this,M.nodeName=E,M.tagName=E,M.namespaceURI=x,K.length==2?(M.prefix=K[0],M.localName=K[1]):M.localName=E,pe._ownerElement=M,M},createAttributeNS:function(x,E){var M=new ii,K=E.split(":");return M.ownerDocument=this,M.nodeName=E,M.name=E,M.namespaceURI=x,M.specified=!0,K.length==2?(M.prefix=K[0],M.localName=K[1]):M.localName=E,M}},d(Te,ue);function ze(){this._nsMap={}}ze.prototype={nodeType:T,hasAttribute:function(x){return this.getAttributeNode(x)!=null},getAttribute:function(x){var E=this.getAttributeNode(x);return E&&E.value||""},getAttributeNode:function(x){return this.attributes.getNamedItem(x)},setAttribute:function(x,E){var M=this.ownerDocument.createAttribute(x);M.value=M.nodeValue=""+E,this.setAttributeNode(M)},removeAttribute:function(x){var E=this.getAttributeNode(x);E&&this.removeAttributeNode(E)},appendChild:function(x){return x.nodeType===B?this.insertBefore(x,null):je(this,x)},setAttributeNode:function(x){return this.attributes.setNamedItem(x)},setAttributeNodeNS:function(x){return this.attributes.setNamedItemNS(x)},removeAttributeNode:function(x){return this.attributes.removeNamedItem(x.nodeName)},removeAttributeNS:function(x,E){var M=this.getAttributeNodeNS(x,E);M&&this.removeAttributeNode(M)},hasAttributeNS:function(x,E){return this.getAttributeNodeNS(x,E)!=null},getAttributeNS:function(x,E){var M=this.getAttributeNodeNS(x,E);return M&&M.value||""},setAttributeNS:function(x,E,M){var K=this.ownerDocument.createAttributeNS(x,E);K.value=K.nodeValue=""+M,this.setAttributeNode(K)},getAttributeNodeNS:function(x,E){return this.attributes.getNamedItemNS(x,E)},getElementsByTagName:function(x){return new ne(this,function(E){var M=[];return Ae(E,function(K){K!==E&&K.nodeType==T&&(x==="*"||K.tagName==x)&&M.push(K)}),M})},getElementsByTagNameNS:function(x,E){return new ne(this,function(M){var K=[];return Ae(M,function(pe){pe!==M&&pe.nodeType===T&&(x==="*"||pe.namespaceURI===x)&&(E==="*"||pe.localName==E)&&K.push(pe)}),K})}},Te.prototype.getElementsByTagName=ze.prototype.getElementsByTagName,Te.prototype.getElementsByTagNameNS=ze.prototype.getElementsByTagNameNS,d(ze,ue);function ii(){}ii.prototype.nodeType=A,d(ii,ue);function Lt(){}Lt.prototype={data:"",substringData:function(x,E){return this.data.substring(x,x+E)},appendData:function(x){x=this.data+x,this.nodeValue=this.data=x,this.length=x.length},insertData:function(x,E){this.replaceData(x,0,E)},appendChild:function(x){throw new Error(ie[C])},deleteData:function(x,E){this.replaceData(x,E,"")},replaceData:function(x,E,M){var K=this.data.substring(0,x),pe=this.data.substring(x+E);M=K+M+pe,this.nodeValue=this.data=M,this.length=M.length}},d(Lt,ue);function pt(){}pt.prototype={nodeName:"#text",nodeType:b,splitText:function(x){var E=this.data,M=E.substring(x);E=E.substring(0,x),this.data=this.nodeValue=E,this.length=E.length;var K=this.ownerDocument.createTextNode(M);return this.parentNode&&this.parentNode.insertBefore(K,this.nextSibling),K}},d(pt,Lt);function ri(){}ri.prototype={nodeName:"#comment",nodeType:$},d(ri,Lt);function hi(){}hi.prototype={nodeName:"#cdata-section",nodeType:k},d(hi,Lt);function Tt(){}Tt.prototype.nodeType=H,d(Tt,ue);function Xi(){}Xi.prototype.nodeType=V,d(Xi,ue);function S(){}S.prototype.nodeType=L,d(S,ue);function g(){}g.prototype.nodeType=v,d(g,ue);function y(){}y.prototype.nodeName="#document-fragment",y.prototype.nodeType=B,d(y,ue);function P(){}P.prototype.nodeType=U,d(P,ue);function j(){}j.prototype.serializeToString=function(x,E,M){return Q.call(x,E,M)},ue.prototype.toString=Q;function Q(x,E){var M=[],K=this.nodeType==9&&this.documentElement||this,pe=K.prefix,Se=K.namespaceURI;if(Se&&pe==null){var pe=K.lookupPrefix(Se);if(pe==null)var qe=[{namespace:Se,prefix:null}]}return Ne(this,M,x,E,qe),M.join("")}function se(x,E,M){var K=x.prefix||"",pe=x.namespaceURI;if(!pe||K==="xml"&&pe===t.XML||pe===t.XMLNS)return!1;for(var Se=M.length;Se--;){var qe=M[Se];if(qe.prefix===K)return qe.namespace!==pe}return!0}function we(x,E,M){x.push(" ",E,'="',M.replace(/[<>&"\t\n\r]/g,Ee),'"')}function Ne(x,E,M,K,pe){if(pe||(pe=[]),K)if(x=K(x),x){if(typeof x=="string"){E.push(x);return}}else return;switch(x.nodeType){case T:var Se=x.attributes,qe=Se.length,We=x.firstChild,bt=x.tagName;M=t.isHTML(x.namespaceURI)||M;var Ft=bt;if(!M&&!x.prefix&&x.namespaceURI){for(var fi,zt=0;zt<Se.length;zt++)if(Se.item(zt).name==="xmlns"){fi=Se.item(zt).value;break}if(!fi)for(var si=pe.length-1;si>=0;si--){var Wt=pe[si];if(Wt.prefix===""&&Wt.namespace===x.namespaceURI){fi=Wt.namespace;break}}if(fi!==x.namespaceURI)for(var si=pe.length-1;si>=0;si--){var Wt=pe[si];if(Wt.namespace===x.namespaceURI){Wt.prefix&&(Ft=Wt.prefix+":"+bt);break}}}E.push("<",Ft);for(var st=0;st<qe;st++){var Gt=Se.item(st);Gt.prefix=="xmlns"?pe.push({prefix:Gt.localName,namespace:Gt.value}):Gt.nodeName=="xmlns"&&pe.push({prefix:"",namespace:Gt.value})}for(var st=0;st<qe;st++){var Gt=Se.item(st);if(se(Gt,M,pe)){var Ii=Gt.prefix||"",pi=Gt.namespaceURI;we(E,Ii?"xmlns:"+Ii:"xmlns",pi),pe.push({prefix:Ii,namespace:pi})}Ne(Gt,E,M,K,pe)}if(bt===Ft&&se(x,M,pe)){var Ii=x.prefix||"",pi=x.namespaceURI;we(E,Ii?"xmlns:"+Ii:"xmlns",pi),pe.push({prefix:Ii,namespace:pi})}if(We||M&&!/^(?:meta|link|img|br|hr|input)$/i.test(bt)){if(E.push(">"),M&&/^script$/i.test(bt))for(;We;)We.data?E.push(We.data):Ne(We,E,M,K,pe.slice()),We=We.nextSibling;else for(;We;)Ne(We,E,M,K,pe.slice()),We=We.nextSibling;E.push("</",Ft,">")}else E.push("/>");return;case F:case B:for(var We=x.firstChild;We;)Ne(We,E,M,K,pe.slice()),We=We.nextSibling;return;case A:return we(E,x.name,x.value);case b:return E.push(x.data.replace(/[<&>]/g,Ee));case k:return E.push("<![CDATA[",x.data,"]]>");case $:return E.push("<!--",x.data,"-->");case H:var Yi=x.publicId,Re=x.systemId;if(E.push("<!DOCTYPE ",x.name),Yi)E.push(" PUBLIC ",Yi),Re&&Re!="."&&E.push(" ",Re),E.push(">");else if(Re&&Re!=".")E.push(" SYSTEM ",Re,">");else{var Ms=x.internalSubset;Ms&&E.push(" [",Ms,"]"),E.push(">")}return;case U:return E.push("<?",x.target," ",x.data,"?>");case v:return E.push("&",x.nodeName,";");default:E.push("??",x.nodeName)}}function Be(x,E,M){var K;switch(E.nodeType){case T:K=E.cloneNode(!1),K.ownerDocument=x;case B:break;case A:M=!0;break}if(K||(K=E.cloneNode(!1)),K.ownerDocument=x,K.parentNode=null,M)for(var pe=E.firstChild;pe;)K.appendChild(Be(x,pe,M)),pe=pe.nextSibling;return K}function Ue(x,E,M){var K=new E.constructor;for(var pe in E)if(Object.prototype.hasOwnProperty.call(E,pe)){var Se=E[pe];typeof Se!="object"&&Se!=K[pe]&&(K[pe]=Se)}switch(E.childNodes&&(K.childNodes=new X),K.ownerDocument=x,K.nodeType){case T:var qe=E.attributes,bt=K.attributes=new fe,Ft=qe.length;bt._ownerElement=K;for(var fi=0;fi<Ft;fi++)K.setAttributeNode(Ue(x,qe.item(fi),!0));break;case A:M=!0}if(M)for(var zt=E.firstChild;zt;)K.appendChild(Ue(x,zt,M)),zt=zt.nextSibling;return K}function Le(x,E,M){x[E]=M}try{if(Object.defineProperty){let x=function(E){switch(E.nodeType){case T:case B:var M=[];for(E=E.firstChild;E;)E.nodeType!==7&&E.nodeType!==8&&M.push(x(E)),E=E.nextSibling;return M.join("");default:return E.nodeValue}};Object.defineProperty(ne.prototype,"length",{get:function(){return de(this),this.$$length}}),Object.defineProperty(ue.prototype,"textContent",{get:function(){return x(this)},set:function(E){switch(this.nodeType){case T:case B: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}}}),Le=function(E,M,K){E["$$"+M]=K}}}catch{}return Ri.DocumentType=Tt,Ri.DOMException=Y,Ri.DOMImplementation=ce,Ri.Element=ze,Ri.Node=ue,Ri.NodeList=X,Ri.XMLSerializer=j,Ri}var hs={},Ha={},ic;function s_(){return ic||(ic=1,(function(r){var e=Kn().freeze;r.XML_ENTITIES=e({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),r.HTML_ENTITIES=e({Aacute:"Á",aacute:"á",Abreve:"Ă",abreve:"ă",ac:"∾",acd:"∿",acE:"∾̳",Acirc:"Â",acirc:"â",acute:"´",Acy:"А",acy:"а",AElig:"Æ",aelig:"æ",af:"",Afr:"𝔄",afr:"𝔞",Agrave:"À",agrave:"à",alefsym:"ℵ",aleph:"ℵ",Alpha:"Α",alpha:"α",Amacr:"Ā",amacr:"ā",amalg:"⨿",AMP:"&",amp:"&",And:"⩓",and:"∧",andand:"⩕",andd:"⩜",andslope:"⩘",andv:"⩚",ang:"∠",ange:"⦤",angle:"∠",angmsd:"∡",angmsdaa:"⦨",angmsdab:"⦩",angmsdac:"⦪",angmsdad:"⦫",angmsdae:"⦬",angmsdaf:"⦭",angmsdag:"⦮",angmsdah:"⦯",angrt:"∟",angrtvb:"⊾",angrtvbd:"⦝",angsph:"∢",angst:"Å",angzarr:"⍼",Aogon:"Ą",aogon:"ą",Aopf:"𝔸",aopf:"𝕒",ap:"≈",apacir:"⩯",apE:"⩰",ape:"≊",apid:"≋",apos:"'",ApplyFunction:"",approx:"≈",approxeq:"≊",Aring:"Å",aring:"å",Ascr:"𝒜",ascr:"𝒶",Assign:"≔",ast:"*",asymp:"≈",asympeq:"≍",Atilde:"Ã",atilde:"ã",Auml:"Ä",auml:"ä",awconint:"∳",awint:"⨑",backcong:"≌",backepsilon:"϶",backprime:"‵",backsim:"∽",backsimeq:"⋍",Backslash:"∖",Barv:"⫧",barvee:"⊽",Barwed:"⌆",barwed:"⌅",barwedge:"⌅",bbrk:"⎵",bbrktbrk:"⎶",bcong:"≌",Bcy:"Б",bcy:"б",bdquo:"„",becaus:"∵",Because:"∵",because:"∵",bemptyv:"⦰",bepsi:"϶",bernou:"ℬ",Bernoullis:"ℬ",Beta:"Β",beta:"β",beth:"ℶ",between:"≬",Bfr:"𝔅",bfr:"𝔟",bigcap:"⋂",bigcirc:"◯",bigcup:"⋃",bigodot:"⨀",bigoplus:"⨁",bigotimes:"⨂",bigsqcup:"⨆",bigstar:"★",bigtriangledown:"▽",bigtriangleup:"△",biguplus:"⨄",bigvee:"⋁",bigwedge:"⋀",bkarow:"⤍",blacklozenge:"⧫",blacksquare:"▪",blacktriangle:"▴",blacktriangledown:"▾",blacktriangleleft:"◂",blacktriangleright:"▸",blank:"␣",blk12:"▒",blk14:"░",blk34:"▓",block:"█",bne:"=⃥",bnequiv:"≡⃥",bNot:"⫭",bnot:"⌐",Bopf:"𝔹",bopf:"𝕓",bot:"⊥",bottom:"⊥",bowtie:"⋈",boxbox:"⧉",boxDL:"╗",boxDl:"╖",boxdL:"╕",boxdl:"┐",boxDR:"╔",boxDr:"╓",boxdR:"╒",boxdr:"┌",boxH:"═",boxh:"─",boxHD:"╦",boxHd:"╤",boxhD:"╥",boxhd:"┬",boxHU:"╩",boxHu:"╧",boxhU:"╨",boxhu:"┴",boxminus:"⊟",boxplus:"⊞",boxtimes:"⊠",boxUL:"╝",boxUl:"╜",boxuL:"╛",boxul:"┘",boxUR:"╚",boxUr:"╙",boxuR:"╘",boxur:"└",boxV:"║",boxv:"│",boxVH:"╬",boxVh:"╫",boxvH:"╪",boxvh:"┼",boxVL:"╣",boxVl:"╢",boxvL:"╡",boxvl:"┤",boxVR:"╠",boxVr:"╟",boxvR:"╞",boxvr:"├",bprime:"‵",Breve:"˘",breve:"˘",brvbar:"¦",Bscr:"ℬ",bscr:"𝒷",bsemi:"⁏",bsim:"∽",bsime:"⋍",bsol:"\\",bsolb:"⧅",bsolhsub:"⟈",bull:"•",bullet:"•",bump:"≎",bumpE:"⪮",bumpe:"≏",Bumpeq:"≎",bumpeq:"≏",Cacute:"Ć",cacute:"ć",Cap:"⋒",cap:"∩",capand:"⩄",capbrcup:"⩉",capcap:"⩋",capcup:"⩇",capdot:"⩀",CapitalDifferentialD:"ⅅ",caps:"∩︀",caret:"⁁",caron:"ˇ",Cayleys:"ℭ",ccaps:"⩍",Ccaron:"Č",ccaron:"č",Ccedil:"Ç",ccedil:"ç",Ccirc:"Ĉ",ccirc:"ĉ",Cconint:"∰",ccups:"⩌",ccupssm:"⩐",Cdot:"Ċ",cdot:"ċ",cedil:"¸",Cedilla:"¸",cemptyv:"⦲",cent:"¢",CenterDot:"·",centerdot:"·",Cfr:"ℭ",cfr:"𝔠",CHcy:"Ч",chcy:"ч",check:"✓",checkmark:"✓",Chi:"Χ",chi:"χ",cir:"○",circ:"ˆ",circeq:"≗",circlearrowleft:"↺",circlearrowright:"↻",circledast:"⊛",circledcirc:"⊚",circleddash:"⊝",CircleDot:"⊙",circledR:"®",circledS:"Ⓢ",CircleMinus:"⊖",CirclePlus:"⊕",CircleTimes:"⊗",cirE:"⧃",cire:"≗",cirfnint:"⨐",cirmid:"⫯",cirscir:"⧂",ClockwiseContourIntegral:"∲",CloseCurlyDoubleQuote:"”",CloseCurlyQuote:"’",clubs:"♣",clubsuit:"♣",Colon:"∷",colon:":",Colone:"⩴",colone:"≔",coloneq:"≔",comma:",",commat:"@",comp:"∁",compfn:"∘",complement:"∁",complexes:"ℂ",cong:"≅",congdot:"⩭",Congruent:"≡",Conint:"∯",conint:"∮",ContourIntegral:"∮",Copf:"ℂ",copf:"𝕔",coprod:"∐",Coproduct:"∐",COPY:"©",copy:"©",copysr:"℗",CounterClockwiseContourIntegral:"∳",crarr:"↵",Cross:"⨯",cross:"✗",Cscr:"𝒞",cscr:"𝒸",csub:"⫏",csube:"⫑",csup:"⫐",csupe:"⫒",ctdot:"⋯",cudarrl:"⤸",cudarrr:"⤵",cuepr:"⋞",cuesc:"⋟",cularr:"↶",cularrp:"⤽",Cup:"⋓",cup:"∪",cupbrcap:"⩈",CupCap:"≍",cupcap:"⩆",cupcup:"⩊",cupdot:"⊍",cupor:"⩅",cups:"∪︀",curarr:"↷",curarrm:"⤼",curlyeqprec:"⋞",curlyeqsucc:"⋟",curlyvee:"⋎",curlywedge:"⋏",curren:"¤",curvearrowleft:"↶",curvearrowright:"↷",cuvee:"⋎",cuwed:"⋏",cwconint:"∲",cwint:"∱",cylcty:"⌭",Dagger:"‡",dagger:"†",daleth:"ℸ",Darr:"↡",dArr:"⇓",darr:"↓",dash:"‐",Dashv:"⫤",dashv:"⊣",dbkarow:"⤏",dblac:"˝",Dcaron:"Ď",dcaron:"ď",Dcy:"Д",dcy:"д",DD:"ⅅ",dd:"ⅆ",ddagger:"‡",ddarr:"⇊",DDotrahd:"⤑",ddotseq:"⩷",deg:"°",Del:"∇",Delta:"Δ",delta:"δ",demptyv:"⦱",dfisht:"⥿",Dfr:"𝔇",dfr:"𝔡",dHar:"⥥",dharl:"⇃",dharr:"⇂",DiacriticalAcute:"´",DiacriticalDot:"˙",DiacriticalDoubleAcute:"˝",DiacriticalGrave:"`",DiacriticalTilde:"˜",diam:"⋄",Diamond:"⋄",diamond:"⋄",diamondsuit:"♦",diams:"♦",die:"¨",DifferentialD:"ⅆ",digamma:"ϝ",disin:"⋲",div:"÷",divide:"÷",divideontimes:"⋇",divonx:"⋇",DJcy:"Ђ",djcy:"ђ",dlcorn:"⌞",dlcrop:"⌍",dollar:"$",Dopf:"𝔻",dopf:"𝕕",Dot:"¨",dot:"˙",DotDot:"⃜",doteq:"≐",doteqdot:"≑",DotEqual:"≐",dotminus:"∸",dotplus:"∔",dotsquare:"⊡",doublebarwedge:"⌆",DoubleContourIntegral:"∯",DoubleDot:"¨",DoubleDownArrow:"⇓",DoubleLeftArrow:"⇐",DoubleLeftRightArrow:"⇔",DoubleLeftTee:"⫤",DoubleLongLeftArrow:"⟸",DoubleLongLeftRightArrow:"⟺",DoubleLongRightArrow:"⟹",DoubleRightArrow:"⇒",DoubleRightTee:"⊨",DoubleUpArrow:"⇑",DoubleUpDownArrow:"⇕",DoubleVerticalBar:"∥",DownArrow:"↓",Downarrow:"⇓",downarrow:"↓",DownArrowBar:"⤓",DownArrowUpArrow:"⇵",DownBreve:"̑",downdownarrows:"⇊",downharpoonleft:"⇃",downharpoonright:"⇂",DownLeftRightVector:"⥐",DownLeftTeeVector:"⥞",DownLeftVector:"↽",DownLeftVectorBar:"⥖",DownRightTeeVector:"⥟",DownRightVector:"⇁",DownRightVectorBar:"⥗",DownTee:"⊤",DownTeeArrow:"↧",drbkarow:"⤐",drcorn:"⌟",drcrop:"⌌",Dscr:"𝒟",dscr:"𝒹",DScy:"Ѕ",dscy:"ѕ",dsol:"⧶",Dstrok:"Đ",dstrok:"đ",dtdot:"⋱",dtri:"▿",dtrif:"▾",duarr:"⇵",duhar:"⥯",dwangle:"⦦",DZcy:"Џ",dzcy:"џ",dzigrarr:"⟿",Eacute:"É",eacute:"é",easter:"⩮",Ecaron:"Ě",ecaron:"ě",ecir:"≖",Ecirc:"Ê",ecirc:"ê",ecolon:"≕",Ecy:"Э",ecy:"э",eDDot:"⩷",Edot:"Ė",eDot:"≑",edot:"ė",ee:"ⅇ",efDot:"≒",Efr:"𝔈",efr:"𝔢",eg:"⪚",Egrave:"È",egrave:"è",egs:"⪖",egsdot:"⪘",el:"⪙",Element:"∈",elinters:"⏧",ell:"ℓ",els:"⪕",elsdot:"⪗",Emacr:"Ē",emacr:"ē",empty:"∅",emptyset:"∅",EmptySmallSquare:"◻",emptyv:"∅",EmptyVerySmallSquare:"▫",emsp:" ",emsp13:" ",emsp14:" ",ENG:"Ŋ",eng:"ŋ",ensp:" ",Eogon:"Ę",eogon:"ę",Eopf:"𝔼",eopf:"𝕖",epar:"⋕",eparsl:"⧣",eplus:"⩱",epsi:"ε",Epsilon:"Ε",epsilon:"ε",epsiv:"ϵ",eqcirc:"≖",eqcolon:"≕",eqsim:"≂",eqslantgtr:"⪖",eqslantless:"⪕",Equal:"⩵",equals:"=",EqualTilde:"≂",equest:"≟",Equilibrium:"⇌",equiv:"≡",equivDD:"⩸",eqvparsl:"⧥",erarr:"⥱",erDot:"≓",Escr:"ℰ",escr:"ℯ",esdot:"≐",Esim:"⩳",esim:"≂",Eta:"Η",eta:"η",ETH:"Ð",eth:"ð",Euml:"Ë",euml:"ë",euro:"€",excl:"!",exist:"∃",Exists:"∃",expectation:"ℰ",ExponentialE:"ⅇ",exponentiale:"ⅇ",fallingdotseq:"≒",Fcy:"Ф",fcy:"ф",female:"♀",ffilig:"ffi",fflig:"ff",ffllig:"ffl",Ffr:"𝔉",ffr:"𝔣",filig:"fi",FilledSmallSquare:"◼",FilledVerySmallSquare:"▪",fjlig:"fj",flat:"♭",fllig:"fl",fltns:"▱",fnof:"ƒ",Fopf:"𝔽",fopf:"𝕗",ForAll:"∀",forall:"∀",fork:"⋔",forkv:"⫙",Fouriertrf:"ℱ",fpartint:"⨍",frac12:"½",frac13:"⅓",frac14:"¼",frac15:"⅕",frac16:"⅙",frac18:"⅛",frac23:"⅔",frac25:"⅖",frac34:"¾",frac35:"⅗",frac38:"⅜",frac45:"⅘",frac56:"⅚",frac58:"⅝",frac78:"⅞",frasl:"⁄",frown:"⌢",Fscr:"ℱ",fscr:"𝒻",gacute:"ǵ",Gamma:"Γ",gamma:"γ",Gammad:"Ϝ",gammad:"ϝ",gap:"⪆",Gbreve:"Ğ",gbreve:"ğ",Gcedil:"Ģ",Gcirc:"Ĝ",gcirc:"ĝ",Gcy:"Г",gcy:"г",Gdot:"Ġ",gdot:"ġ",gE:"≧",ge:"≥",gEl:"⪌",gel:"⋛",geq:"≥",geqq:"≧",geqslant:"⩾",ges:"⩾",gescc:"⪩",gesdot:"⪀",gesdoto:"⪂",gesdotol:"⪄",gesl:"⋛︀",gesles:"⪔",Gfr:"𝔊",gfr:"𝔤",Gg:"⋙",gg:"≫",ggg:"⋙",gimel:"ℷ",GJcy:"Ѓ",gjcy:"ѓ",gl:"≷",gla:"⪥",glE:"⪒",glj:"⪤",gnap:"⪊",gnapprox:"⪊",gnE:"≩",gne:"⪈",gneq:"⪈",gneqq:"≩",gnsim:"⋧",Gopf:"𝔾",gopf:"𝕘",grave:"`",GreaterEqual:"≥",GreaterEqualLess:"⋛",GreaterFullEqual:"≧",GreaterGreater:"⪢",GreaterLess:"≷",GreaterSlantEqual:"⩾",GreaterTilde:"≳",Gscr:"𝒢",gscr:"ℊ",gsim:"≳",gsime:"⪎",gsiml:"⪐",Gt:"≫",GT:">",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"",InvisibleTimes:"",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",Lt:"≪",LT:"<",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"",NegativeThickSpace:"",NegativeThinSpace:"",NegativeVeryThinSpace:"",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:`
|
|
14
|
+
`,nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:" ",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:" ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"",zwnj:""}),r.entityMap=r.HTML_ENTITIES})(Ha)),Ha}var un={},rc;function n_(){if(rc)return un;rc=1;var r=Kn().NAMESPACE,e=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,t=new RegExp("[\\-\\.0-9"+e.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),i=new RegExp("^"+e.source+t.source+"*(?::"+e.source+t.source+"*)?$"),s=0,n=1,a=2,o=3,u=4,d=5,p=6,T=7;function A(C,I){this.message=C,this.locator=I,Error.captureStackTrace&&Error.captureStackTrace(this,A)}A.prototype=new Error,A.prototype.name=A.name;function b(){}b.prototype={parse:function(C,I,W){var Y=this.domBuilder;Y.startDocument(),H(I,I={}),k(C,I,W,Y,this.errorHandler),Y.endDocument()}};function k(C,I,W,Y,X){function ne(je){if(je>65535){je-=65536;var ze=55296+(je>>10),ii=56320+(je&1023);return String.fromCharCode(ze,ii)}else return String.fromCharCode(je)}function de(je){var ze=je.slice(1,-1);return Object.hasOwnProperty.call(W,ze)?W[ze]:ze.charAt(0)==="#"?ne(parseInt(ze.substr(1).replace("x","0x"))):(X.error("entity not found:"+je),je)}function fe(je){if(je>Te){var ze=C.substring(Te,je).replace(/&#?\w+;/g,de);ue&&te(Te),Y.characters(ze,0,je-Te),Te=je}}function te(je,ze){for(;je>=oe&&(ze=ce.exec(C));)le=ze.index,oe=le+ze[0].length,ue.lineNumber++;ue.columnNumber=je-le+1}for(var le=0,oe=0,ce=/.*(?:\r\n?|\n)|.*$/g,ue=Y.locator,Ee=[{currentNSMap:I}],Ae={},Te=0;;){try{var _e=C.indexOf("<",Te);if(_e<0){if(!C.substr(Te).match(/^\s*$/)){var lt=Y.doc,dt=lt.createTextNode(C.substr(Te));lt.appendChild(dt),Y.currentElement=dt}return}switch(_e>Te&&fe(_e),C.charAt(_e+1)){case"/":var He=C.indexOf(">",_e+3),tt=C.substring(_e+2,He).replace(/[ \t\n\r]+$/g,""),ht=Ee.pop();He<0?(tt=C.substring(_e+2).replace(/[\s<].*/,""),X.error("end tag name: "+tt+" is not complete:"+ht.tagName),He=_e+1+tt.length):tt.match(/\s</)&&(tt=tt.replace(/[\s<].*/,""),X.error("end tag name: "+tt+" maybe not complete"),He=_e+1+tt.length);var Ct=ht.localNSMap,Qe=ht.tagName==tt,ft=Qe||ht.tagName&&ht.tagName.toLowerCase()==tt.toLowerCase();if(ft){if(Y.endElement(ht.uri,ht.localName,tt),Ct)for(var ei in Ct)Object.prototype.hasOwnProperty.call(Ct,ei)&&Y.endPrefixMapping(ei);Qe||X.fatalError("end tag name: "+tt+" is not match the current start tagName:"+ht.tagName)}else Ee.push(ht);He++;break;case"?":ue&&te(_e),He=V(C,_e,Y);break;case"!":ue&&te(_e),He=B(C,_e,Y,X);break;default:ue&&te(_e);var ut=new G,ti=Ee[Ee.length-1].currentNSMap,He=L(C,_e,ut,ti,de,X),Ht=ut.length;if(!ut.closed&&F(C,He,ut.tagName,Ae)&&(ut.closed=!0,W.nbsp||X.warning("unclosed xml attribute")),ue&&Ht){for(var At=v(ue,{}),Rt=0;Rt<Ht;Rt++){var Ie=ut[Rt];te(Ie.offset),Ie.locator=v(ue,{})}Y.locator=At,U(ut,Y,ti)&&Ee.push(ut),Y.locator=ue}else U(ut,Y,ti)&&Ee.push(ut);r.isHTML(ut.uri)&&!ut.closed?He=$(C,He,ut.tagName,de,Y):He++}}catch(je){if(je instanceof A)throw je;X.error("element parse error: "+je),He=-1}He>Te?Te=He:fe(Math.max(_e,Te)+1)}}function v(C,I){return I.lineNumber=C.lineNumber,I.columnNumber=C.columnNumber,I}function L(C,I,W,Y,X,ne){function de(ue,Ee,Ae){W.attributeNames.hasOwnProperty(ue)&&ne.fatalError("Attribute "+ue+" redefined"),W.addValue(ue,Ee.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,X),Ae)}for(var fe,te,le=++I,oe=s;;){var ce=C.charAt(le);switch(ce){case"=":if(oe===n)fe=C.slice(I,le),oe=o;else if(oe===a)oe=o;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(oe===o||oe===n)if(oe===n&&(ne.warning('attribute value must after "="'),fe=C.slice(I,le)),I=le+1,le=C.indexOf(ce,I),le>0)te=C.slice(I,le),de(fe,te,I-1),oe=d;else throw new Error("attribute value no end '"+ce+"' match");else if(oe==u)te=C.slice(I,le),de(fe,te,I),ne.warning('attribute "'+fe+'" missed start quot('+ce+")!!"),I=le+1,oe=d;else throw new Error('attribute value must after "="');break;case"/":switch(oe){case s:W.setTagName(C.slice(I,le));case d:case p:case T:oe=T,W.closed=!0;case u:case n:break;case a:W.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return ne.error("unexpected end of input"),oe==s&&W.setTagName(C.slice(I,le)),le;case">":switch(oe){case s:W.setTagName(C.slice(I,le));case d:case p:case T:break;case u:case n:te=C.slice(I,le),te.slice(-1)==="/"&&(W.closed=!0,te=te.slice(0,-1));case a:oe===a&&(te=fe),oe==u?(ne.warning('attribute "'+te+'" missed quot(")!'),de(fe,te,I)):((!r.isHTML(Y[""])||!te.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+te+'" missed value!! "'+te+'" instead!!'),de(te,te,I));break;case o:throw new Error("attribute value missed!!")}return le;case"":ce=" ";default:if(ce<=" ")switch(oe){case s:W.setTagName(C.slice(I,le)),oe=p;break;case n:fe=C.slice(I,le),oe=a;break;case u:var te=C.slice(I,le);ne.warning('attribute "'+te+'" missed quot(")!!'),de(fe,te,I);case d:oe=p;break}else switch(oe){case a:W.tagName,(!r.isHTML(Y[""])||!fe.match(/^(?:disabled|checked|selected)$/i))&&ne.warning('attribute "'+fe+'" missed value!! "'+fe+'" instead2!!'),de(fe,fe,I),I=le,oe=n;break;case d:ne.warning('attribute space is required"'+fe+'"!!');case p:oe=n,I=le;break;case o:oe=u,I=le;break;case T:throw new Error("elements closed character '/' and '>' must be connected to")}}le++}}function U(C,I,W){for(var Y=C.tagName,X=null,ce=C.length;ce--;){var ne=C[ce],de=ne.qName,fe=ne.value,ue=de.indexOf(":");if(ue>0)var te=ne.prefix=de.slice(0,ue),le=de.slice(ue+1),oe=te==="xmlns"&≤else le=de,te=null,oe=de==="xmlns"&&"";ne.localName=le,oe!==!1&&(X==null&&(X={},H(W,W={})),W[oe]=X[oe]=fe,ne.uri=r.XMLNS,I.startPrefixMapping(oe,fe))}for(var ce=C.length;ce--;){ne=C[ce];var te=ne.prefix;te&&(te==="xml"&&(ne.uri=r.XML),te!=="xmlns"&&(ne.uri=W[te||""]))}var ue=Y.indexOf(":");ue>0?(te=C.prefix=Y.slice(0,ue),le=C.localName=Y.slice(ue+1)):(te=null,le=C.localName=Y);var Ee=C.uri=W[te||""];if(I.startElement(Ee,le,Y,C),C.closed){if(I.endElement(Ee,le,Y),X)for(te in X)Object.prototype.hasOwnProperty.call(X,te)&&I.endPrefixMapping(te)}else return C.currentNSMap=W,C.localNSMap=X,!0}function $(C,I,W,Y,X){if(/^(?:script|textarea)$/i.test(W)){var ne=C.indexOf("</"+W+">",I),de=C.substring(I+1,ne);if(/[&<]/.test(de))return/^script$/i.test(W)?(X.characters(de,0,de.length),ne):(de=de.replace(/&#?\w+;/g,Y),X.characters(de,0,de.length),ne)}return I+1}function F(C,I,W,Y){var X=Y[W];return X==null&&(X=C.lastIndexOf("</"+W+">"),X<I&&(X=C.lastIndexOf("</"+W)),Y[W]=X),X<I}function H(C,I){for(var W in C)Object.prototype.hasOwnProperty.call(C,W)&&(I[W]=C[W])}function B(C,I,W,Y){var X=C.charAt(I+2);switch(X){case"-":if(C.charAt(I+3)==="-"){var ne=C.indexOf("-->",I+4);return ne>I?(W.comment(C,I+4,ne-I-4),ne+3):(Y.error("Unclosed comment"),-1)}else return-1;default:if(C.substr(I+3,6)=="CDATA["){var ne=C.indexOf("]]>",I+9);return W.startCDATA(),W.characters(C,I+9,ne-I-9),W.endCDATA(),ne+3}var de=ie(C,I),fe=de.length;if(fe>1&&/!doctype/i.test(de[0][0])){var te=de[1][0],le=!1,oe=!1;fe>3&&(/^public$/i.test(de[2][0])?(le=de[3][0],oe=fe>4&&de[4][0]):/^system$/i.test(de[2][0])&&(oe=de[3][0]));var ce=de[fe-1];return W.startDTD(te,le,oe),W.endDTD(),ce.index+ce[0].length}}return-1}function V(C,I,W){var Y=C.indexOf("?>",I);if(Y){var X=C.substring(I,Y).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);return X?(X[0].length,W.processingInstruction(X[1],X[2]),Y+2):-1}return-1}function G(){this.attributeNames={}}G.prototype={setTagName:function(C){if(!i.test(C))throw new Error("invalid tagName:"+C);this.tagName=C},addValue:function(C,I,W){if(!i.test(C))throw new Error("invalid attribute:"+C);this.attributeNames[C]=this.length,this[this.length++]={qName:C,value:I,offset:W}},length:0,getLocalName:function(C){return this[C].localName},getLocator:function(C){return this[C].locator},getQName:function(C){return this[C].qName},getURI:function(C){return this[C].uri},getValue:function(C){return this[C].value}};function ie(C,I){var W,Y=[],X=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(X.lastIndex=I,X.exec(C);W=X.exec(C);)if(Y.push(W),W[1])return Y}return un.XMLReader=b,un.ParseError=A,un}var sc;function a_(){if(sc)return hs;sc=1;var r=Kn(),e=Qd(),t=s_(),i=n_(),s=e.DOMImplementation,n=r.NAMESPACE,a=i.ParseError,o=i.XMLReader;function u(L){return L.replace(/\r[\n\u0085]/g,`
|
|
26
15
|
`).replace(/[\r\u0085\u2028]/g,`
|
|
27
|
-
`)}function
|
|
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">
|
|
16
|
+
`)}function d(L){this.options=L||{locator:{}}}d.prototype.parseFromString=function(L,U){var $=this.options,F=new o,H=$.domBuilder||new T,B=$.errorHandler,V=$.locator,G=$.xmlns||{},ie=/\/x?html?$/.test(U),C=ie?t.HTML_ENTITIES:t.XML_ENTITIES;V&&H.setDocumentLocator(V),F.errorHandler=p(B,H,V),F.domBuilder=$.domBuilder||H,ie&&(G[""]=n.HTML),G.xml=G.xml||n.XML;var I=$.normalizeLineEndings||u;return L&&typeof L=="string"?F.parse(I(L),G,C):F.errorHandler.error("invalid doc source"),H.doc};function p(L,U,$){if(!L){if(U instanceof T)return U;L=U}var F={},H=L instanceof Function;$=$||{};function B(V){var G=L[V];!G&&H&&(G=L.length==2?function(ie){L(V,ie)}:L),F[V]=G&&function(ie){G("[xmldom "+V+"] "+ie+b($))}||function(){}}return B("warning"),B("error"),B("fatalError"),F}function T(){this.cdata=!1}function A(L,U){U.lineNumber=L.lineNumber,U.columnNumber=L.columnNumber}T.prototype={startDocument:function(){this.doc=new s().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(L,U,$,F){var H=this.doc,B=H.createElementNS(L,$||U),V=F.length;v(this,B),this.currentElement=B,this.locator&&A(this.locator,B);for(var G=0;G<V;G++){var L=F.getURI(G),ie=F.getValue(G),$=F.getQName(G),C=H.createAttributeNS(L,$);this.locator&&A(F.getLocator(G),C),C.value=C.nodeValue=ie,B.setAttributeNode(C)}},endElement:function(L,U,$){var F=this.currentElement;F.tagName,this.currentElement=F.parentNode},startPrefixMapping:function(L,U){},endPrefixMapping:function(L){},processingInstruction:function(L,U){var $=this.doc.createProcessingInstruction(L,U);this.locator&&A(this.locator,$),v(this,$)},ignorableWhitespace:function(L,U,$){},characters:function(L,U,$){if(L=k.apply(this,arguments),L){if(this.cdata)var F=this.doc.createCDATASection(L);else var F=this.doc.createTextNode(L);this.currentElement?this.currentElement.appendChild(F):/^\s*$/.test(L)&&this.doc.appendChild(F),this.locator&&A(this.locator,F)}},skippedEntity:function(L){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(L){(this.locator=L)&&(L.lineNumber=0)},comment:function(L,U,$){L=k.apply(this,arguments);var F=this.doc.createComment(L);this.locator&&A(this.locator,F),v(this,F)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(L,U,$){var F=this.doc.implementation;if(F&&F.createDocumentType){var H=F.createDocumentType(L,U,$);this.locator&&A(this.locator,H),v(this,H),this.doc.doctype=H}},warning:function(L){console.warn("[xmldom warning] "+L,b(this.locator))},error:function(L){console.error("[xmldom error] "+L,b(this.locator))},fatalError:function(L){throw new a(L,this.locator)}};function b(L){if(L)return`
|
|
17
|
+
@`+(L.systemId||"")+"#[line:"+L.lineNumber+",col:"+L.columnNumber+"]"}function k(L,U,$){return typeof L=="string"?L.substr(U,$):L.length>=U+$||U?new java.lang.String(L,U,$)+"":L}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(L){T.prototype[L]=function(){return null}});function v(L,U){L.currentElement?L.currentElement.appendChild(U):L.doc.appendChild(U)}return hs.__DOMHandler=T,hs.normalizeLineEndings=u,hs.DOMParser=d,hs}var nc;function o_(){if(nc)return ds;nc=1;var r=Qd();return ds.DOMImplementation=r.DOMImplementation,ds.XMLSerializer=r.XMLSerializer,ds.DOMParser=a_().DOMParser,ds}var Ho=o_();const l_=ui.getDefaultExportFromCjs(Ho),u_=bg({__proto__:null,default:l_},[Ho]);const ac=r=>!!r&&typeof r=="object",yt=(...r)=>r.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]):ac(e[i])&&ac(t[i])?e[i]=yt(e[i],t[i]):e[i]=t[i]}),e),{}),Jd=r=>Object.keys(r).map(e=>r[e]),c_=(r,e)=>{const t=[];for(let i=r;i<e;i++)t.push(i);return t},Rr=r=>r.reduce((e,t)=>e.concat(t),[]),Zd=r=>{if(!r.length)return[];const e=[];for(let t=0;t<r.length;t++)e.push(r[t]);return e},d_=(r,e)=>r.reduce((t,i,s)=>(i[e]&&t.push(s),t),[]),h_=(r,e)=>Jd(r.reduce((t,i)=>(i.forEach(s=>{t[e(s)]=s}),t),{}));var Lr={INVALID_NUMBER_OF_PERIOD:"INVALID_NUMBER_OF_PERIOD",DASH_EMPTY_MANIFEST:"DASH_EMPTY_MANIFEST",DASH_INVALID_XML:"DASH_INVALID_XML",NO_BASE_URL:"NO_BASE_URL",SEGMENT_TIME_UNSPECIFIED:"SEGMENT_TIME_UNSPECIFIED",UNSUPPORTED_UTC_TIMING_SCHEME:"UNSUPPORTED_UTC_TIMING_SCHEME"};const ws=({baseUrl:r="",source:e="",range:t="",indexRange:i=""})=>{const s={uri:e,resolvedUri:Wn(r||"",e)};if(t||i){const a=(t||i).split("-");let o=N.BigInt?N.BigInt(a[0]):parseInt(a[0],10),u=N.BigInt?N.BigInt(a[1]):parseInt(a[1],10);o<Number.MAX_SAFE_INTEGER&&typeof o=="bigint"&&(o=Number(o)),u<Number.MAX_SAFE_INTEGER&&typeof u=="bigint"&&(u=Number(u));let d;typeof u=="bigint"||typeof o=="bigint"?d=N.BigInt(u)-N.BigInt(o)+N.BigInt(1):d=u-o+1,typeof d=="bigint"&&d<Number.MAX_SAFE_INTEGER&&(d=Number(d)),s.byterange={length:d,offset:o}}return s},f_=r=>{let e;return typeof r.offset=="bigint"||typeof r.length=="bigint"?e=N.BigInt(r.offset)+N.BigInt(r.length)-N.BigInt(1):e=r.offset+r.length-1,`${r.offset}-${e}`},oc=r=>(r&&typeof r!="number"&&(r=parseInt(r,10)),isNaN(r)?null:r),p_={static(r){const{duration:e,timescale:t=1,sourceDuration:i,periodDuration:s}=r,n=oc(r.endNumber),a=e/t;return typeof n=="number"?{start:0,end:n}:typeof s=="number"?{start:0,end:s/a}:{start:0,end:i/a}},dynamic(r){const{NOW:e,clientOffset:t,availabilityStartTime:i,timescale:s=1,duration:n,periodStart:a=0,minimumUpdatePeriod:o=0,timeShiftBufferDepth:u=1/0}=r,d=oc(r.endNumber),p=(e+t)/1e3,T=i+a,b=p+o-T,k=Math.ceil(b*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 d=="number"?d:Math.min(k,L)}}},m_=r=>e=>{const{duration:t,timescale:i=1,periodStart:s,startNumber:n=1}=r;return{number:n+e,duration:t/i,timeline:s,time:e*t}},zo=r=>{const{type:e,duration:t,timescale:i=1,periodDuration:s,sourceDuration:n}=r,{start:a,end:o}=p_[e](r),u=c_(a,o).map(m_(r));if(e==="static"){const d=u.length-1,p=typeof s=="number"?s:n;u[d].duration=p-t/i*d}return u},eh=r=>{const{baseUrl:e,initialization:t={},sourceDuration:i,indexRange:s="",periodStart:n,presentationTime:a,number:o=0,duration:u}=r;if(!e)throw new Error(Lr.NO_BASE_URL);const d=ws({baseUrl:e,source:t.sourceURL,range:t.range}),p=ws({baseUrl:e,source:e,indexRange:s});if(p.map=d,u){const T=zo(r);T.length&&(p.duration=T[0].duration,p.timeline=T[0].timeline)}else i&&(p.duration=i,p.timeline=n);return p.presentationTime=a||n,p.number=o,[p]},Wo=(r,e,t)=>{const i=r.sidx.map?r.sidx.map:null,s=r.sidx.duration,n=r.timeline||0,a=r.sidx.byterange,o=a.offset+a.length,u=e.timescale,d=e.references.filter(L=>L.referenceType!==1),p=[],T=r.endList?"static":"dynamic",A=r.sidx.timeline;let b=A,k=r.mediaSequence||0,v;typeof e.firstOffset=="bigint"?v=N.BigInt(o)+e.firstOffset:v=o+e.firstOffset;for(let L=0;L<d.length;L++){const U=e.references[L],$=U.referencedSize,F=U.subsegmentDuration;let H;typeof v=="bigint"?H=v+N.BigInt($)-N.BigInt(1):H=v+$-1;const B=`${v}-${H}`,G=eh({baseUrl:t,timescale:u,timeline:n,periodStart:A,presentationTime:b,number:k,duration:F,sourceDuration:s,indexRange:B,type:T})[0];i&&(G.map=i),p.push(G),typeof v=="bigint"?v+=N.BigInt($):v+=$,b+=F/u,k++}return r.segments=p,r},g_=["AUDIO","SUBTITLES"],y_=1/60,th=r=>h_(r,({timeline:e})=>e).sort((e,t)=>e.timeline>t.timeline?1:-1),__=(r,e)=>{for(let t=0;t<r.length;t++)if(r[t].attributes.NAME===e)return r[t];return null},lc=r=>{let e=[];return r_(r,g_,(t,i,s,n)=>{e=e.concat(t.playlists||[])}),e},uc=({playlist:r,mediaSequence:e})=>{r.mediaSequence=e,r.segments.forEach((t,i)=>{t.number=r.mediaSequence+i})},T_=({oldPlaylists:r,newPlaylists:e,timelineStarts:t})=>{e.forEach(i=>{i.discontinuitySequence=t.findIndex(function({timeline:u}){return u===i.timeline});const s=__(r,i.attributes.NAME);if(!s||i.sidx)return;const n=i.segments[0],a=s.segments.findIndex(function(u){return Math.abs(u.presentationTime-n.presentationTime)<y_});if(a===-1){uc({playlist:i,mediaSequence:s.mediaSequence+s.segments.length}),i.segments[0].discontinuity=!0,i.discontinuityStarts.unshift(0),(!s.segments.length&&i.timeline>s.timeline||s.segments.length&&i.timeline>s.segments[s.segments.length-1].timeline)&&i.discontinuitySequence--;return}s.segments[a].discontinuity&&!n.discontinuity&&(n.discontinuity=!0,i.discontinuityStarts.unshift(0),i.discontinuitySequence--),uc({playlist:i,mediaSequence:s.segments[a].number})})},v_=({oldManifest:r,newManifest:e})=>{const t=r.playlists.concat(lc(r)),i=e.playlists.concat(lc(e));return e.timelineStarts=th([r.timelineStarts,e.timelineStarts]),T_({oldPlaylists:t,newPlaylists:i,timelineStarts:e.timelineStarts}),e},Xn=r=>r&&r.uri+"-"+f_(r.byterange),za=r=>{const e=r.reduce(function(i,s){return i[s.attributes.baseUrl]||(i[s.attributes.baseUrl]=[]),i[s.attributes.baseUrl].push(s),i},{});let t=[];return Object.values(e).forEach(i=>{const s=Jd(i.reduce((n,a)=>{const o=a.attributes.id+(a.attributes.lang||"");return n[o]?(a.segments&&(a.segments[0]&&(a.segments[0].discontinuity=!0),n[o].segments.push(...a.segments)),a.attributes.contentProtection&&(n[o].attributes.contentProtection=a.attributes.contentProtection)):(n[o]=a,n[o].attributes.timelineStarts=[]),n[o].attributes.timelineStarts.push({start:a.attributes.periodStart,timeline:a.attributes.periodStart}),n},{}));t=t.concat(s)}),t.map(i=>(i.discontinuityStarts=d_(i.segments||[],"discontinuity"),i))},Go=(r,e)=>{const t=Xn(r.sidx),i=t&&e[t]&&e[t].sidx;return i&&Wo(r,i,r.sidx.resolvedUri),r},b_=(r,e={})=>{if(!Object.keys(e).length)return r;for(const t in r)r[t]=Go(r[t],e);return r},x_=({attributes:r,segments:e,sidx:t,mediaSequence:i,discontinuitySequence:s,discontinuityStarts:n},a)=>{const o={attributes:{NAME:r.id,BANDWIDTH:r.bandwidth,CODECS:r.codecs,"PROGRAM-ID":1},uri:"",endList:r.type==="static",timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,discontinuitySequence:s,discontinuityStarts:n,timelineStarts:r.timelineStarts,mediaSequence:i,segments:e};return r.contentProtection&&(o.contentProtection=r.contentProtection),r.serviceLocation&&(o.attributes.serviceLocation=r.serviceLocation),t&&(o.sidx=t),a&&(o.attributes.AUDIO="audio",o.attributes.SUBTITLES="subs"),o},S_=({attributes:r,segments:e,mediaSequence:t,discontinuityStarts:i,discontinuitySequence:s})=>{typeof e>"u"&&(e=[{uri:r.baseUrl,timeline:r.periodStart,resolvedUri:r.baseUrl||"",duration:r.sourceDuration,number:0}],r.duration=r.sourceDuration);const n={NAME:r.id,BANDWIDTH:r.bandwidth,"PROGRAM-ID":1};r.codecs&&(n.CODECS=r.codecs);const a={attributes:n,uri:"",endList:r.type==="static",timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,timelineStarts:r.timelineStarts,discontinuityStarts:i,discontinuitySequence:s,mediaSequence:t,segments:e};return r.serviceLocation&&(a.attributes.serviceLocation=r.serviceLocation),a},E_=(r,e={},t=!1)=>{let i;const s=r.reduce((n,a)=>{const o=a.attributes.role&&a.attributes.role.value||"",u=a.attributes.lang||"";let d=a.attributes.label||"main";if(u&&!a.attributes.label){const T=o?` (${o})`:"";d=`${a.attributes.lang}${T}`}n[d]||(n[d]={language:u,autoselect:!0,default:o==="main",playlists:[],uri:""});const p=Go(x_(a,t),e);return n[d].playlists.push(p),typeof i>"u"&&o==="main"&&(i=a,i.default=!0),n},{});if(!i){const n=Object.keys(s)[0];s[n].default=!0}return s},C_=(r,e={})=>r.reduce((t,i)=>{const s=i.attributes.label||i.attributes.lang||"text",n=i.attributes.lang||"und";return t[s]||(t[s]={language:n,default:!1,autoselect:!1,playlists:[],uri:""}),t[s].playlists.push(Go(S_(i),e)),t},{}),A_=r=>r.reduce((e,t)=>(t&&t.forEach(i=>{const{channel:s,language:n}=i;e[n]={autoselect:!1,default:!1,instreamId:s,language:n},i.hasOwnProperty("aspectRatio")&&(e[n].aspectRatio=i.aspectRatio),i.hasOwnProperty("easyReader")&&(e[n].easyReader=i.easyReader),i.hasOwnProperty("3D")&&(e[n]["3D"]=i["3D"])}),e),{}),w_=({attributes:r,segments:e,sidx:t,discontinuityStarts:i})=>{const s={attributes:{NAME:r.id,AUDIO:"audio",SUBTITLES:"subs",RESOLUTION:{width:r.width,height:r.height},CODECS:r.codecs,BANDWIDTH:r.bandwidth,"PROGRAM-ID":1},uri:"",endList:r.type==="static",timeline:r.periodStart,resolvedUri:r.baseUrl||"",targetDuration:r.duration,discontinuityStarts:i,timelineStarts:r.timelineStarts,segments:e};return r.frameRate&&(s.attributes["FRAME-RATE"]=r.frameRate),r.contentProtection&&(s.contentProtection=r.contentProtection),r.serviceLocation&&(s.attributes.serviceLocation=r.serviceLocation),t&&(s.sidx=t),s},D_=({attributes:r})=>r.mimeType==="video/mp4"||r.mimeType==="video/webm"||r.contentType==="video",I_=({attributes:r})=>r.mimeType==="audio/mp4"||r.mimeType==="audio/webm"||r.contentType==="audio",k_=({attributes:r})=>r.mimeType==="text/vtt"||r.contentType==="text",P_=(r,e)=>{r.forEach(t=>{t.mediaSequence=0,t.discontinuitySequence=e.findIndex(function({timeline:i}){return i===t.timeline}),t.segments&&t.segments.forEach((i,s)=>{i.number=s})})},cc=r=>r?Object.keys(r).reduce((e,t)=>{const i=r[t];return e.concat(i.playlists)},[]):[],R_=({dashPlaylists:r,locations:e,contentSteering:t,sidxMapping:i={},previousManifest:s,eventStream:n})=>{if(!r.length)return{};const{sourceDuration:a,type:o,suggestedPresentationDelay:u,minimumUpdatePeriod:d}=r[0].attributes,p=za(r.filter(D_)).map(w_),T=za(r.filter(I_)),A=za(r.filter(k_)),b=r.map(H=>H.attributes.captionServices).filter(Boolean),k={allowCache:!0,discontinuityStarts:[],segments:[],endList:!0,mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:"",duration:a,playlists:b_(p,i)};d>=0&&(k.minimumUpdatePeriod=d*1e3),e&&(k.locations=e),t&&(k.contentSteering=t),o==="dynamic"&&(k.suggestedPresentationDelay=u),n&&n.length>0&&(k.eventStream=n);const v=k.playlists.length===0,L=T.length?E_(T,i,v):null,U=A.length?C_(A,i):null,$=p.concat(cc(L),cc(U)),F=$.map(({timelineStarts:H})=>H);return k.timelineStarts=th(F),P_($,k.timelineStarts),L&&(k.mediaGroups.AUDIO.audio=L),U&&(k.mediaGroups.SUBTITLES.subs=U),b.length&&(k.mediaGroups["CLOSED-CAPTIONS"].cc=A_(b)),s?v_({oldManifest:s,newManifest:k}):k},L_=(r,e,t)=>{const{NOW:i,clientOffset:s,availabilityStartTime:n,timescale:a=1,periodStart:o=0,minimumUpdatePeriod:u=0}=r,d=(i+s)/1e3,p=n+o,A=d+u-p;return Math.ceil((A*a-e)/t)},ih=(r,e)=>{const{type:t,minimumUpdatePeriod:i=0,media:s="",sourceDuration:n,timescale:a=1,startNumber:o=1,periodStart:u}=r,d=[];let p=-1;for(let T=0;T<e.length;T++){const A=e[T],b=A.d,k=A.r||0,v=A.t||0;p<0&&(p=v),v&&v>p&&(p=v);let L;if(k<0){const F=T+1;F===e.length?t==="dynamic"&&i>0&&s.indexOf("$Number$")>0?L=L_(r,p,b):L=(n*a-p)/b:L=(e[F].t-p)/b}else L=k+1;const U=o+d.length+L;let $=o+d.length;for(;$<U;)d.push({number:$,duration:b/a,time:p,timeline:u}),p+=b,$++}return d},N_=/\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g,O_=r=>(e,t,i,s)=>{if(e==="$$")return"$";if(typeof r[t]>"u")return e;const n=""+r[t];return t==="RepresentationID"||(i?s=parseInt(s,10):s=1,n.length>=s)?n:`${new Array(s-n.length+1).join("0")}${n}`},dc=(r,e)=>r.replace(N_,O_(e)),B_=(r,e)=>!r.duration&&!e?[{number:r.startNumber||1,duration:r.sourceDuration,time:0,timeline:r.periodStart}]:r.duration?zo(r):ih(r,e),M_=(r,e)=>{const t={RepresentationID:r.id,Bandwidth:r.bandwidth||0},{initialization:i={sourceURL:"",range:""}}=r,s=ws({baseUrl:r.baseUrl,source:dc(i.sourceURL,t),range:i.range});return B_(r,e).map(a=>{t.Number=a.number,t.Time=a.time;const o=dc(r.media||"",t),u=r.timescale||1,d=r.presentationTimeOffset||0,p=r.periodStart+(a.time-d)/u;return{uri:o,timeline:a.timeline,duration:a.duration,resolvedUri:Wn(r.baseUrl||"",o),map:s,number:a.number,presentationTime:p}})},F_=(r,e)=>{const{baseUrl:t,initialization:i={}}=r,s=ws({baseUrl:t,source:i.sourceURL,range:i.range}),n=ws({baseUrl:t,source:e.media,range:e.mediaRange});return n.map=s,n},U_=(r,e)=>{const{duration:t,segmentUrls:i=[],periodStart:s}=r;if(!t&&!e||t&&e)throw new Error(Lr.SEGMENT_TIME_UNSPECIFIED);const n=i.map(u=>F_(r,u));let a;return t&&(a=zo(r)),e&&(a=ih(r,e)),a.map((u,d)=>{if(n[d]){const p=n[d],T=r.timescale||1,A=r.presentationTimeOffset||0;return p.timeline=u.timeline,p.duration=u.duration,p.number=u.number,p.presentationTime=s+(u.time-A)/T,p}}).filter(u=>u)},$_=({attributes:r,segmentInfo:e})=>{let t,i;e.template?(i=M_,t=yt(r,e.template)):e.base?(i=eh,t=yt(r,e.base)):e.list&&(i=U_,t=yt(r,e.list));const s={attributes:r};if(!i)return s;const n=i(t,e.segmentTimeline);if(t.duration){const{duration:a,timescale:o=1}=t;t.duration=a/o}else n.length?t.duration=n.reduce((a,o)=>Math.max(a,Math.ceil(o.duration)),0):t.duration=0;return s.attributes=t,s.segments=n,e.base&&t.indexRange&&(s.sidx=n[0],s.segments=[]),s},j_=r=>r.map($_),et=(r,e)=>Zd(r.childNodes).filter(({tagName:t})=>t===e),Ps=r=>r.textContent.trim(),q_=r=>parseFloat(r.split("/").reduce((e,t)=>e/t)),gr=r=>{const o=/P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/.exec(r);if(!o)return 0;const[u,d,p,T,A,b]=o.slice(1);return parseFloat(u||0)*31536e3+parseFloat(d||0)*2592e3+parseFloat(p||0)*86400+parseFloat(T||0)*3600+parseFloat(A||0)*60+parseFloat(b||0)},V_=r=>(/^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/.test(r)&&(r+="Z"),Date.parse(r)),hc={mediaPresentationDuration(r){return gr(r)},availabilityStartTime(r){return V_(r)/1e3},minimumUpdatePeriod(r){return gr(r)},suggestedPresentationDelay(r){return gr(r)},type(r){return r},timeShiftBufferDepth(r){return gr(r)},start(r){return gr(r)},width(r){return parseInt(r,10)},height(r){return parseInt(r,10)},bandwidth(r){return parseInt(r,10)},frameRate(r){return q_(r)},startNumber(r){return parseInt(r,10)},timescale(r){return parseInt(r,10)},presentationTimeOffset(r){return parseInt(r,10)},duration(r){const e=parseInt(r,10);return isNaN(e)?gr(r):e},d(r){return parseInt(r,10)},t(r){return parseInt(r,10)},r(r){return parseInt(r,10)},presentationTime(r){return parseInt(r,10)},DEFAULT(r){return r}},ct=r=>r&&r.attributes?Zd(r.attributes).reduce((e,t)=>{const i=hc[t.name]||hc.DEFAULT;return e[t.name]=i(t.value),e},{}):{},H_={"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"},Yn=(r,e)=>e.length?Rr(r.map(function(t){return e.map(function(i){const s=Ps(i),n=Wn(t.baseUrl,s),a=yt(ct(i),{baseUrl:n});return n!==s&&!a.serviceLocation&&t.serviceLocation&&(a.serviceLocation=t.serviceLocation),a})})):r,Ko=r=>{const e=et(r,"SegmentTemplate")[0],t=et(r,"SegmentList")[0],i=t&&et(t,"SegmentURL").map(T=>yt({tag:"SegmentURL"},ct(T))),s=et(r,"SegmentBase")[0],n=t||e,a=n&&et(n,"SegmentTimeline")[0],o=t||s||e,u=o&&et(o,"Initialization")[0],d=e&&ct(e);d&&u?d.initialization=u&&ct(u):d&&d.initialization&&(d.initialization={sourceURL:d.initialization});const p={template:d,segmentTimeline:a&&et(a,"S").map(T=>ct(T)),list:t&&yt(ct(t),{segmentUrls:i,initialization:ct(u)}),base:s&&yt(ct(s),{initialization:ct(u)})};return Object.keys(p).forEach(T=>{p[T]||delete p[T]}),p},z_=(r,e,t)=>i=>{const s=et(i,"BaseURL"),n=Yn(e,s),a=yt(r,ct(i)),o=Ko(i);return n.map(u=>({segmentInfo:yt(t,o),attributes:yt(a,u)}))},W_=r=>r.reduce((e,t)=>{const i=ct(t);i.schemeIdUri&&(i.schemeIdUri=i.schemeIdUri.toLowerCase());const s=H_[i.schemeIdUri];if(s){e[s]={attributes:i};const n=et(t,"cenc:pssh")[0];if(n){const a=Ps(n);e[s].pssh=a&&zd(a)}}return e},{}),G_=r=>{if(r.schemeIdUri==="urn:scte:dash:cc:cea-608:2015")return(typeof r.value!="string"?[]:r.value.split(";")).map(t=>{let i,s;return s=t,/^CC\d=/.test(t)?[i,s]=t.split("="):/^CC\d$/.test(t)&&(i=t),{channel:i,language:s}});if(r.schemeIdUri==="urn:scte:dash:cc:cea-708:2015")return(typeof r.value!="string"?[]:r.value.split(";")).map(t=>{const i={channel:void 0,language:void 0,aspectRatio:1,easyReader:0,"3D":0};if(/=/.test(t)){const[s,n=""]=t.split("=");i.channel=s,i.language=t,n.split(",").forEach(a=>{const[o,u]=a.split(":");o==="lang"?i.language=u:o==="er"?i.easyReader=Number(u):o==="war"?i.aspectRatio=Number(u):o==="3D"&&(i["3D"]=Number(u))})}else i.language=t;return i.channel&&(i.channel="SERVICE"+i.channel),i})},K_=r=>Rr(et(r.node,"EventStream").map(e=>{const t=ct(e),i=t.schemeIdUri;return et(e,"Event").map(s=>{const n=ct(s),a=n.presentationTime||0,o=t.timescale||1,u=n.duration||0,d=a/o+r.attributes.start;return{schemeIdUri:i,value:t.value,id:n.id,start:d,end:d+u/o,messageData:Ps(s)||n.messageData,contentEncoding:t.contentEncoding,presentationTimeOffset:t.presentationTimeOffset||0}})})),X_=(r,e,t)=>i=>{const s=ct(i),n=Yn(e,et(i,"BaseURL")),a=et(i,"Role")[0],o={role:ct(a)};let u=yt(r,s,o);const d=et(i,"Accessibility")[0],p=G_(ct(d));p&&(u=yt(u,{captionServices:p}));const T=et(i,"Label")[0];if(T&&T.childNodes.length){const L=T.childNodes[0].nodeValue.trim();u=yt(u,{label:L})}const A=W_(et(i,"ContentProtection"));Object.keys(A).length&&(u=yt(u,{contentProtection:A}));const b=Ko(i),k=et(i,"Representation"),v=yt(t,b);return Rr(k.map(z_(u,n,v)))},Y_=(r,e)=>(t,i)=>{const s=Yn(e,et(t.node,"BaseURL")),n=yt(r,{periodStart:t.attributes.start});typeof t.attributes.duration=="number"&&(n.periodDuration=t.attributes.duration);const a=et(t.node,"AdaptationSet"),o=Ko(t.node);return Rr(a.map(X_(n,s,o)))},Q_=(r,e)=>{if(r.length>1&&e({type:"warn",message:"The MPD manifest should contain no more than one ContentSteering tag"}),!r.length)return null;const t=yt({serverURL:Ps(r[0])},ct(r[0]));return t.queryBeforeStart=t.queryBeforeStart==="true",t},J_=({attributes:r,priorPeriodAttributes:e,mpdType:t})=>typeof r.start=="number"?r.start:e&&typeof e.start=="number"&&typeof e.duration=="number"?e.start+e.duration:!e&&t==="static"?0:null,Z_=(r,e={})=>{const{manifestUri:t="",NOW:i=Date.now(),clientOffset:s=0,eventHandler:n=function(){}}=e,a=et(r,"Period");if(!a.length)throw new Error(Lr.INVALID_NUMBER_OF_PERIOD);const o=et(r,"Location"),u=ct(r),d=Yn([{baseUrl:t}],et(r,"BaseURL")),p=et(r,"ContentSteering");u.type=u.type||"static",u.sourceDuration=u.mediaPresentationDuration||0,u.NOW=i,u.clientOffset=s,o.length&&(u.locations=o.map(Ps));const T=[];return a.forEach((A,b)=>{const k=ct(A),v=T[b-1];k.start=J_({attributes:k,priorPeriodAttributes:v?v.attributes:null,mpdType:u.type}),T.push({node:A,attributes:k})}),{locations:u.locations,contentSteeringInfo:Q_(p,n),representationInfo:Rr(T.map(Y_(u,d))),eventStream:Rr(T.map(K_))}},rh=r=>{if(r==="")throw new Error(Lr.DASH_EMPTY_MANIFEST);const e=new Ho.DOMParser;let t,i;try{t=e.parseFromString(r,"application/xml"),i=t&&t.documentElement.tagName==="MPD"?t.documentElement:null}catch{}if(!i||i&&i.getElementsByTagName("parsererror").length>0)throw new Error(Lr.DASH_INVALID_XML);return i},eT=r=>{const e=et(r,"UTCTiming")[0];if(!e)return null;const t=ct(e);switch(t.schemeIdUri){case"urn:mpeg:dash:utc:http-head:2014":case"urn:mpeg:dash:utc:http-head:2012":t.method="HEAD";break;case"urn:mpeg:dash:utc:http-xsdate:2014":case"urn:mpeg:dash:utc:http-iso:2014":case"urn:mpeg:dash:utc:http-xsdate:2012":case"urn:mpeg:dash:utc:http-iso:2012":t.method="GET";break;case"urn:mpeg:dash:utc:direct:2014":case"urn:mpeg:dash:utc:direct:2012":t.method="DIRECT",t.value=Date.parse(t.value);break;default:throw new Error(Lr.UNSUPPORTED_UTC_TIMING_SCHEME)}return t},tT=(r,e={})=>{const t=Z_(rh(r),e),i=j_(t.representationInfo);return R_({dashPlaylists:i,locations:t.locations,contentSteering:t.contentSteeringInfo,sidxMapping:e.sidxMapping,previousManifest:e.previousManifest,eventStream:t.eventStream})},iT=r=>eT(rh(r));var Wa,fc;function rT(){if(fc)return Wa;fc=1;var r=Math.pow(2,32),e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),s;return i.getBigUint64?(s=i.getBigUint64(0),s<Number.MAX_SAFE_INTEGER?Number(s):s):i.getUint32(0)*r+i.getUint32(4)};return Wa={getUint64:e,MAX_UINT32:r},Wa}var Ga,pc;function sT(){if(pc)return Ga;pc=1;var r=rT().getUint64,e=function(t){var i=new DataView(t.buffer,t.byteOffset,t.byteLength),s={version:t[0],flags:new Uint8Array(t.subarray(1,4)),references:[],referenceId:i.getUint32(4),timescale:i.getUint32(8)},n=12;s.version===0?(s.earliestPresentationTime=i.getUint32(n),s.firstOffset=i.getUint32(n+4),n+=8):(s.earliestPresentationTime=r(t.subarray(n)),s.firstOffset=r(t.subarray(n+8)),n+=16),n+=2;var a=i.getUint16(n);for(n+=2;a>0;n+=12,a--)s.references.push({referenceType:(t[n]&128)>>>7,referencedSize:i.getUint32(n)&2147483647,subsegmentDuration:i.getUint32(n+4),startsWithSap:!!(t[n+8]&128),sapType:(t[n+8]&112)>>>4,sapDeltaTime:i.getUint32(n+8)&268435455});return s};return Ga=e,Ga}var nT=sT();const aT=ui.getDefaultExportFromCjs(nT);var oT=be([73,68,51]),lT=function(e,t){t===void 0&&(t=0),e=be(e);var i=e[t+5],s=e[t+6]<<21|e[t+7]<<14|e[t+8]<<7|e[t+9],n=(i&16)>>4;return n?s+20:s+10},ys=function r(e,t){return t===void 0&&(t=0),e=be(e),e.length-t<10||!Ze(e,oT,{offset:t})?t:(t+=lT(e,t),r(e,t))},mc=function(e){return typeof e=="string"?Yd(e):e},uT=function(e){return Array.isArray(e)?e.map(function(t){return mc(t)}):[mc(e)]},cT=function r(e,t,i){i===void 0&&(i=!1),t=uT(t),e=be(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,o=e.subarray(n+4,n+8);if(a===0)break;var u=n+a;if(u>e.length){if(i)break;u=e.length}var d=e.subarray(n+8,u);Ze(o,t[0])&&(t.length===1?s.push(d):s.push.apply(s,r(d,t.slice(1),i))),n=u}return s},cn={EBML:be([26,69,223,163]),DocType:be([66,130]),Segment:be([24,83,128,103]),SegmentInfo:be([21,73,169,102]),Tracks:be([22,84,174,107]),Track:be([174]),TrackNumber:be([215]),DefaultDuration:be([35,227,131]),TrackEntry:be([174]),TrackType:be([131]),FlagDefault:be([136]),CodecID:be([134]),CodecPrivate:be([99,162]),VideoTrack:be([224]),AudioTrack:be([225]),Cluster:be([31,67,182,117]),Timestamp:be([231]),TimestampScale:be([42,215,177]),BlockGroup:be([160]),BlockDuration:be([155]),Block:be([161]),SimpleBlock:be([163])},po=[128,64,32,16,8,4,2,1],dT=function(e){for(var t=1,i=0;i<po.length&&!(e&po[i]);i++)t++;return t},bn=function(e,t,i,s){i===void 0&&(i=!0),s===void 0&&(s=!1);var n=dT(e[t]),a=e.subarray(t,t+n);return i&&(a=Array.prototype.slice.call(e,t,t+n),a[0]^=po[n-1]),{length:n,value:e_(a,{signed:s}),bytes:a}},gc=function r(e){return typeof e=="string"?e.match(/.{1,2}/g).map(function(t){return r(t)}):typeof e=="number"?t_(e):e},hT=function(e){return Array.isArray(e)?e.map(function(t){return gc(t)}):[gc(e)]},fT=function r(e,t,i){if(i>=t.length)return t.length;var s=bn(t,i,!1);if(Ze(e.bytes,s.bytes))return i;var n=bn(t,i+s.length);return r(e,t,i+n.length+n.value+s.length)},yc=function r(e,t){t=hT(t),e=be(e);var i=[];if(!t.length)return i;for(var s=0;s<e.length;){var n=bn(e,s,!1),a=bn(e,s+n.length),o=s+n.length+a.length;a.value===127&&(a.value=fT(n,e,o),a.value!==e.length&&(a.value-=o));var u=o+a.value>e.length?e.length:o+a.value,d=e.subarray(o,u);Ze(t[0],n.bytes)&&(t.length===1?i.push(d):i=i.concat(r(d,t.slice(1))));var p=n.length+a.length+d.length;s+=p}return i},pT=be([0,0,0,1]),mT=be([0,0,1]),gT=be([0,0,3]),yT=function(e){for(var t=[],i=1;i<e.length-2;)Ze(e.subarray(i,i+3),gT)&&(t.push(i+2),i++),i++;if(t.length===0)return e;var s=e.length-t.length,n=new Uint8Array(s),a=0;for(i=0;i<s;a++,i++)a===t[0]&&(a++,t.shift()),n[i]=e[a];return n},sh=function(e,t,i,s){e=be(e),i=[].concat(i);for(var n=0,a,o=0;n<e.length&&(o<s||a);){var u=void 0;if(Ze(e.subarray(n),pT)?u=4:Ze(e.subarray(n),mT)&&(u=3),!u){n++;continue}if(o++,a)return yT(e.subarray(a,n));var d=void 0;t==="h264"?d=e[n+u]&31:t==="h265"&&(d=e[n+u]>>1&63),i.indexOf(d)!==-1&&(a=n+u),n+=u+(t==="h264"?1:2)}return e.subarray(0,0)},_T=function(e,t,i){return sh(e,"h264",t,i)},TT=function(e,t,i){return sh(e,"h265",t,i)},It={webm:be([119,101,98,109]),matroska:be([109,97,116,114,111,115,107,97]),flac:be([102,76,97,67]),ogg:be([79,103,103,83]),ac3:be([11,119]),riff:be([82,73,70,70]),avi:be([65,86,73]),wav:be([87,65,86,69]),"3gp":be([102,116,121,112,51,103]),mp4:be([102,116,121,112]),fmp4:be([115,116,121,112]),mov:be([102,116,121,112,113,116]),moov:be([109,111,111,118]),moof:be([109,111,111,102])},Nr={aac:function(e){var t=ys(e);return Ze(e,[255,16],{offset:t,mask:[255,22]})},mp3:function(e){var t=ys(e);return Ze(e,[255,2],{offset:t,mask:[255,6]})},webm:function(e){var t=yc(e,[cn.EBML,cn.DocType])[0];return Ze(t,It.webm)},mkv:function(e){var t=yc(e,[cn.EBML,cn.DocType])[0];return Ze(t,It.matroska)},mp4:function(e){if(Nr["3gp"](e)||Nr.mov(e))return!1;if(Ze(e,It.mp4,{offset:4})||Ze(e,It.fmp4,{offset:4})||Ze(e,It.moof,{offset:4})||Ze(e,It.moov,{offset:4}))return!0},mov:function(e){return Ze(e,It.mov,{offset:4})},"3gp":function(e){return Ze(e,It["3gp"],{offset:4})},ac3:function(e){var t=ys(e);return Ze(e,It.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=ys(e);return Ze(e,It.flac,{offset:t})},ogg:function(e){return Ze(e,It.ogg)},avi:function(e){return Ze(e,It.riff)&&Ze(e,It.avi,{offset:8})},wav:function(e){return Ze(e,It.riff)&&Ze(e,It.wav,{offset:8})},h264:function(e){return _T(e,7,3).length},h265:function(e){return TT(e,[32,33],3).length}},mo=Object.keys(Nr).filter(function(r){return r!=="ts"&&r!=="h264"&&r!=="h265"}).concat(["ts","h264","h265"]);mo.forEach(function(r){var e=Nr[r];Nr[r]=function(t){return e(be(t))}});var vT=Nr,Xo=function(e){e=be(e);for(var t=0;t<mo.length;t++){var i=mo[t];if(vT[i](e))return i}return""},bT=function(e){return cT(e,["moof"]).length>0},Ka,_c;function xT(){if(_c)return Ka;_c=1;var r=9e4,e,t,i,s,n,a,o;return e=function(u){return u*r},t=function(u,d){return u*d},i=function(u){return u/r},s=function(u,d){return u/d},n=function(u,d){return e(s(u,d))},a=function(u,d){return t(i(u),d)},o=function(u,d,p){return i(p?u:u-d)},Ka={ONE_SECOND_IN_TS:r,secondsToVideoTs:e,secondsToAudioTs:t,videoTsToSeconds:i,audioTsToSeconds:s,audioTsToVideoTs:n,videoTsToAudioTs:a,metadataTsToSeconds:o},Ka}var sr=xT(),go="8.21.0";const Li={},Wi=function(r,e){return Li[r]=Li[r]||[],e&&(Li[r]=Li[r].concat(e)),Li[r]},ST=function(r,e){Wi(r,e)},nh=function(r,e){const t=Wi(r).indexOf(e);return t<=-1?!1:(Li[r]=Li[r].slice(),Li[r].splice(t,1),!0)},ET=function(r,e){Wi(r,[].concat(e).map(t=>{const i=(...s)=>(nh(r,i),t(...s));return i}))},xn={prefixed:!0},yn=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror","fullscreen"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror","-webkit-full-screen"]],Tc=yn[0];let _s;for(let r=0;r<yn.length;r++)if(yn[r][1]in he){_s=yn[r];break}if(_s){for(let r=0;r<_s.length;r++)xn[Tc[r]]=_s[r];xn.prefixed=_s[0]!==Tc[0]}let Nt=[];const CT=(r,e,t)=>(i,s,n)=>{const a=e.levels[s],o=new RegExp(`^(${a})$`);let u=r;if(i!=="log"&&n.unshift(i.toUpperCase()+":"),t&&(u=`%c${r}`,n.unshift(t)),n.unshift(u+":"),Nt){Nt.push([].concat(n));const p=Nt.length-1e3;Nt.splice(0,p>0?p:0)}if(!N.console)return;let d=N.console[i];!d&&i==="debug"&&(d=N.console.info||N.console.log),!(!d||!a||!o.test(i))&&d[Array.isArray(n)?"apply":"call"](N.console,n)};function yo(r,e=":",t=""){let i="info",s;function n(...a){s("log",i,a)}return s=CT(r,n,t),n.createLogger=(a,o,u)=>{const d=o!==void 0?o:e,p=u!==void 0?u:t,T=`${r} ${d} ${a}`;return yo(T,d,p)},n.createNewLogger=(a,o,u)=>yo(a,o,u),n.levels={all:"debug|log|warn|error",off:"",debug:"debug|log|warn|error",info:"log|warn|error",warn:"warn|error",error:"error",DEFAULT:i},n.level=a=>{if(typeof a=="string"){if(!n.levels.hasOwnProperty(a))throw new Error(`"${a}" in not a valid log level`);i=a}return i},n.history=()=>Nt?[].concat(Nt):[],n.history.filter=a=>(Nt||[]).filter(o=>new RegExp(`.*${a}.*`).test(o[0])),n.history.clear=()=>{Nt&&(Nt.length=0)},n.history.disable=()=>{Nt!==null&&(Nt.length=0,Nt=null)},n.history.enable=()=>{Nt===null&&(Nt=[])},n.error=(...a)=>s("error",i,a),n.warn=(...a)=>s("warn",i,a),n.debug=(...a)=>s("debug",i,a),n}const Pe=yo("VIDEOJS"),ah=Pe.createLogger,AT=Object.prototype.toString,oh=function(r){return Ai(r)?Object.keys(r):[]};function Sr(r,e){oh(r).forEach(t=>e(r[t],t))}function lh(r,e,t=0){return oh(r).reduce((i,s)=>e(i,r[s],s),t)}function Ai(r){return!!r&&typeof r=="object"}function Or(r){return Ai(r)&&AT.call(r)==="[object Object]"&&r.constructor===Object}function $e(...r){const e={};return r.forEach(t=>{t&&Sr(t,(i,s)=>{if(!Or(i)){e[s]=i;return}Or(e[s])||(e[s]={}),e[s]=$e(e[s],i)})}),e}function uh(r={}){const e=[];for(const t in r)if(r.hasOwnProperty(t)){const i=r[t];e.push(i)}return e}function Qn(r,e,t,i=!0){const s=a=>Object.defineProperty(r,e,{value:a,enumerable:!0,writable:!0}),n={configurable:!0,enumerable:!0,get(){const a=t();return s(a),a}};return i&&(n.set=s),Object.defineProperty(r,e,n)}var wT=Object.freeze({__proto__:null,each:Sr,reduce:lh,isObject:Ai,isPlain:Or,merge:$e,values:uh,defineLazyProperty:Qn});let Yo=!1,ch=null,ci=!1,dh,hh=!1,Er=!1,Cr=!1,wi=!1,Qo=null,Jn=null;const DT=!!(N.cast&&N.cast.framework&&N.cast.framework.CastReceiverContext);let fh=null,Sn=!1,Zn=!1,En=!1,ea=!1,Cn=!1,An=!1,wn=!1;const Ds=!!(jr()&&("ontouchstart"in N||N.navigator.maxTouchPoints||N.DocumentTouch&&N.document instanceof N.DocumentTouch)),ji=N.navigator&&N.navigator.userAgentData;ji&&ji.platform&&ji.brands&&(ci=ji.platform==="Android",Er=!!ji.brands.find(r=>r.brand==="Microsoft Edge"),Cr=!!ji.brands.find(r=>r.brand==="Chromium"),wi=!Er&&Cr,Qo=Jn=(ji.brands.find(r=>r.brand==="Chromium")||{}).version||null,Zn=ji.platform==="Windows");if(!Cr){const r=N.navigator&&N.navigator.userAgent||"";Yo=/iPod/i.test(r),ch=(function(){const e=r.match(/OS (\d+)_/i);return e&&e[1]?e[1]:null})(),ci=/Android/i.test(r),dh=(function(){const e=r.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})(),hh=/Firefox/i.test(r),Er=/Edg/i.test(r),Cr=/Chrome/i.test(r)||/CriOS/i.test(r),wi=!Er&&Cr,Qo=Jn=(function(){const e=r.match(/(Chrome|CriOS)\/(\d+)/);return e&&e[2]?parseFloat(e[2]):null})(),fh=(function(){const e=/MSIE\s(\d+)\.\d/.exec(r);let t=e&&parseFloat(e[1]);return!t&&/Trident\/7.0/i.test(r)&&/rv:11.0/.test(r)&&(t=11),t})(),Cn=/Tizen/i.test(r),An=/Web0S/i.test(r),wn=Cn||An,Sn=/Safari/i.test(r)&&!wi&&!ci&&!Er&&!wn,Zn=/Windows/i.test(r),En=/iPad/i.test(r)||Sn&&Ds&&!/iPhone/i.test(r),ea=/iPhone/i.test(r)&&!En}const xt=ea||En||Yo,ta=(Sn||xt)&&!wi;var ph=Object.freeze({__proto__:null,get IS_IPOD(){return Yo},get IOS_VERSION(){return ch},get IS_ANDROID(){return ci},get ANDROID_VERSION(){return dh},get IS_FIREFOX(){return hh},get IS_EDGE(){return Er},get IS_CHROMIUM(){return Cr},get IS_CHROME(){return wi},get CHROMIUM_VERSION(){return Qo},get CHROME_VERSION(){return Jn},IS_CHROMECAST_RECEIVER:DT,get IE_VERSION(){return fh},get IS_SAFARI(){return Sn},get IS_WINDOWS(){return Zn},get IS_IPAD(){return En},get IS_IPHONE(){return ea},get IS_TIZEN(){return Cn},get IS_WEBOS(){return An},get IS_SMART_TV(){return wn},TOUCH_ENABLED:Ds,IS_IOS:xt,IS_ANY_SAFARI:ta});function vc(r){return typeof r=="string"&&!!r.trim()}function IT(r){if(r.indexOf(" ")>=0)throw new Error("class has illegal whitespace characters")}function jr(){return he===N.document}function qr(r){return Ai(r)&&r.nodeType===1}function mh(){try{return N.parent!==N.self}catch{return!0}}function gh(r){return function(e,t){if(!vc(e))return he[r](null);vc(t)&&(t=he.querySelector(t));const i=qr(t)?t:he;return i[r]&&i[r](e)}}function xe(r="div",e={},t={},i){const s=he.createElement(r);return Object.getOwnPropertyNames(e).forEach(function(n){const a=e[n];n==="textContent"?Ki(s,a):(s[n]!==a||n==="tabIndex")&&(s[n]=a)}),Object.getOwnPropertyNames(t).forEach(function(n){s.setAttribute(n,t[n])}),i&&Jo(s,i),s}function Ki(r,e){return typeof r.textContent>"u"?r.innerText=e:r.textContent=e,r}function _o(r,e){e.firstChild?e.insertBefore(r,e.firstChild):e.appendChild(r)}function bs(r,e){return IT(e),r.classList.contains(e)}function or(r,...e){return r.classList.add(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),r}function ia(r,...e){return r?(r.classList.remove(...e.reduce((t,i)=>t.concat(i.split(/\s+/)),[])),r):(Pe.warn("removeClass was called with an element that doesn't exist"),null)}function yh(r,e,t){return typeof t=="function"&&(t=t(r,e)),typeof t!="boolean"&&(t=void 0),e.split(/\s+/).forEach(i=>r.classList.toggle(i,t)),r}function _h(r,e){Object.getOwnPropertyNames(e).forEach(function(t){const i=e[t];i===null||typeof i>"u"||i===!1?r.removeAttribute(t):r.setAttribute(t,i===!0?"":i)})}function Hi(r){const e={},t=["autoplay","controls","playsinline","loop","muted","default","defaultMuted"];if(r&&r.attributes&&r.attributes.length>0){const i=r.attributes;for(let s=i.length-1;s>=0;s--){const n=i[s].name;let a=i[s].value;t.includes(n)&&(a=a!==null),e[n]=a}}return e}function Th(r,e){return r.getAttribute(e)}function Br(r,e,t){r.setAttribute(e,t)}function ra(r,e){r.removeAttribute(e)}function vh(){he.body.focus(),he.onselectstart=function(){return!1}}function bh(){he.onselectstart=function(){return!0}}function Mr(r){if(r&&r.getBoundingClientRect&&r.parentNode){const e=r.getBoundingClientRect(),t={};return["bottom","height","left","right","top","width"].forEach(i=>{e[i]!==void 0&&(t[i]=e[i])}),t.height||(t.height=parseFloat(Fr(r,"height"))),t.width||(t.width=parseFloat(Fr(r,"width"))),t}}function Is(r){if(!r||r&&!r.offsetParent)return{left:0,top:0,width:0,height:0};const e=r.offsetWidth,t=r.offsetHeight;let i=0,s=0;for(;r.offsetParent&&r!==he[xn.fullscreenElement];)i+=r.offsetLeft,s+=r.offsetTop,r=r.offsetParent;return{left:i,top:s,width:e,height:t}}function sa(r,e){const t={x:0,y:0};if(xt){let p=r;for(;p&&p.nodeName.toLowerCase()!=="html";){const T=Fr(p,"transform");if(/^matrix/.test(T)){const A=T.slice(7,-1).split(/,\s/).map(Number);t.x+=A[4],t.y+=A[5]}else if(/^matrix3d/.test(T)){const A=T.slice(9,-1).split(/,\s/).map(Number);t.x+=A[12],t.y+=A[13]}if(p.assignedSlot&&p.assignedSlot.parentElement&&N.WebKitCSSMatrix){const A=N.getComputedStyle(p.assignedSlot.parentElement).transform,b=new N.WebKitCSSMatrix(A);t.x+=b.m41,t.y+=b.m42}p=p.parentNode||p.host}}const i={},s=Is(e.target),n=Is(r),a=n.width,o=n.height;let u=e.offsetY-(n.top-s.top),d=e.offsetX-(n.left-s.left);return e.changedTouches&&(d=e.changedTouches[0].pageX-n.left,u=e.changedTouches[0].pageY+n.top,xt&&(d-=t.x,u-=t.y)),i.y=1-Math.max(0,Math.min(1,u/o)),i.x=Math.max(0,Math.min(1,d/a)),i}function xh(r){return Ai(r)&&r.nodeType===3}function na(r){for(;r.firstChild;)r.removeChild(r.firstChild);return r}function Sh(r){return typeof r=="function"&&(r=r()),(Array.isArray(r)?r:[r]).map(e=>{if(typeof e=="function"&&(e=e()),qr(e)||xh(e))return e;if(typeof e=="string"&&/\S/.test(e))return he.createTextNode(e)}).filter(e=>e)}function Jo(r,e){return Sh(e).forEach(t=>r.appendChild(t)),r}function Eh(r,e){return Jo(na(r),e)}function ks(r){return r.button===void 0&&r.buttons===void 0||r.button===0&&r.buttons===void 0||r.type==="mouseup"&&r.button===0&&r.buttons===0||r.type==="mousedown"&&r.button===0&&r.buttons===0?!0:!(r.button!==0||r.buttons!==1)}const Gi=gh("querySelector"),Ch=gh("querySelectorAll");function Fr(r,e){if(!r||!e)return"";if(typeof N.getComputedStyle=="function"){let t;try{t=N.getComputedStyle(r)}catch{return""}return t?t.getPropertyValue(e)||t[e]:""}return""}function Ah(r){[...he.styleSheets].forEach(e=>{try{const t=[...e.cssRules].map(s=>s.cssText).join(""),i=he.createElement("style");i.textContent=t,r.document.head.appendChild(i)}catch{const i=he.createElement("link");i.rel="stylesheet",i.type=e.type,i.media=e.media.mediaText,i.href=e.href,r.document.head.appendChild(i)}})}var wh=Object.freeze({__proto__:null,isReal:jr,isEl:qr,isInFrame:mh,createEl:xe,textContent:Ki,prependTo:_o,hasClass:bs,addClass:or,removeClass:ia,toggleClass:yh,setAttributes:_h,getAttributes:Hi,getAttribute:Th,setAttribute:Br,removeAttribute:ra,blockTextSelection:vh,unblockTextSelection:bh,getBoundingClientRect:Mr,findPosition:Is,getPointerPosition:sa,isTextNode:xh,emptyEl:na,normalizeContent:Sh,appendContent:Jo,insertContent:Eh,isSingleLeftClick:ks,$:Gi,$$:Ch,computedStyle:Fr,copyStyleSheetsToWindow:Ah});let Dh=!1,To;const kT=function(){if(To.options.autoSetup===!1)return;const r=Array.prototype.slice.call(he.getElementsByTagName("video")),e=Array.prototype.slice.call(he.getElementsByTagName("audio")),t=Array.prototype.slice.call(he.getElementsByTagName("video-js")),i=r.concat(e,t);if(i&&i.length>0)for(let s=0,n=i.length;s<n;s++){const a=i[s];if(a&&a.getAttribute)a.player===void 0&&a.getAttribute("data-setup")!==null&&To(a);else{vo(1);break}}else Dh||vo(1)};function vo(r,e){jr()&&(e&&(To=e),N.setTimeout(kT,r))}function bo(){Dh=!0,N.removeEventListener("load",bo)}jr()&&(he.readyState==="complete"?bo():N.addEventListener("load",bo));const Ih=function(r){const e=he.createElement("style");return e.className=r,e},kh=function(r,e){r.styleSheet?r.styleSheet.cssText=e:r.textContent=e};var Pt=new WeakMap;const PT=3;let RT=PT;function Qt(){return RT++}function bc(r,e){if(!Pt.has(r))return;const t=Pt.get(r);t.handlers[e].length===0&&(delete t.handlers[e],r.removeEventListener?r.removeEventListener(e,t.dispatcher,!1):r.detachEvent&&r.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&&Pt.delete(r)}function Zo(r,e,t,i){t.forEach(function(s){r(e,s,i)})}function aa(r){if(r.fixed_)return r;function e(){return!0}function t(){return!1}if(!r||!r.isPropagationStopped||!r.isImmediatePropagationStopped){const i=r||N.event;r={};const s=["layerX","layerY","keyLocation","path","webkitMovementX","webkitMovementY","mozPressure","mozInputSource"];for(const n in i)s.includes(n)||n==="returnValue"&&i.preventDefault||(r[n]=i[n]);if(r.target||(r.target=r.srcElement||he),r.relatedTarget||(r.relatedTarget=r.fromElement===r.target?r.toElement:r.fromElement),r.preventDefault=function(){i.preventDefault&&i.preventDefault(),r.returnValue=!1,i.returnValue=!1,r.defaultPrevented=!0},r.defaultPrevented=!1,r.stopPropagation=function(){i.stopPropagation&&i.stopPropagation(),r.cancelBubble=!0,i.cancelBubble=!0,r.isPropagationStopped=e},r.isPropagationStopped=t,r.stopImmediatePropagation=function(){i.stopImmediatePropagation&&i.stopImmediatePropagation(),r.isImmediatePropagationStopped=e,r.stopPropagation()},r.isImmediatePropagationStopped=t,r.clientX!==null&&r.clientX!==void 0){const n=he.documentElement,a=he.body;r.pageX=r.clientX+(n&&n.scrollLeft||a&&a.scrollLeft||0)-(n&&n.clientLeft||a&&a.clientLeft||0),r.pageY=r.clientY+(n&&n.scrollTop||a&&a.scrollTop||0)-(n&&n.clientTop||a&&a.clientTop||0)}r.which=r.charCode||r.keyCode,r.button!==null&&r.button!==void 0&&(r.button=r.button&1?0:r.button&4?1:r.button&2?2:0)}return r.fixed_=!0,r}let dn;const LT=function(){if(typeof dn!="boolean"){dn=!1;try{const r=Object.defineProperty({},"passive",{get(){dn=!0}});N.addEventListener("test",null,r),N.removeEventListener("test",null,r)}catch{}}return dn},NT=["touchstart","touchmove"];function qt(r,e,t){if(Array.isArray(e))return Zo(qt,r,e,t);Pt.has(r)||Pt.set(r,{});const i=Pt.get(r);if(i.handlers||(i.handlers={}),i.handlers[e]||(i.handlers[e]=[]),t.guid||(t.guid=Qt()),i.handlers[e].push(t),i.dispatcher||(i.disabled=!1,i.dispatcher=function(s,n){if(i.disabled)return;s=aa(s);const a=i.handlers[s.type];if(a){const o=a.slice(0);for(let u=0,d=o.length;u<d&&!s.isImmediatePropagationStopped();u++)try{o[u].call(r,s,n)}catch(p){Pe.error(p)}}}),i.handlers[e].length===1)if(r.addEventListener){let s=!1;LT()&&NT.indexOf(e)>-1&&(s={passive:!0}),r.addEventListener(e,i.dispatcher,s)}else r.attachEvent&&r.attachEvent("on"+e,i.dispatcher)}function St(r,e,t){if(!Pt.has(r))return;const i=Pt.get(r);if(!i.handlers)return;if(Array.isArray(e))return Zo(St,r,e,t);const s=function(a,o){i.handlers[o]=[],bc(a,o)};if(e===void 0){for(const a in i.handlers)Object.prototype.hasOwnProperty.call(i.handlers||{},a)&&s(r,a);return}const n=i.handlers[e];if(n){if(!t){s(r,e);return}if(t.guid)for(let a=0;a<n.length;a++)n[a].guid===t.guid&&n.splice(a--,1);bc(r,e)}}function Vr(r,e,t){const i=Pt.has(r)?Pt.get(r):{},s=r.parentNode||r.ownerDocument;if(typeof e=="string"?e={type:e,target:r}:e.target||(e.target=r),e=aa(e),i.dispatcher&&i.dispatcher.call(r,e,t),s&&!e.isPropagationStopped()&&e.bubbles===!0)Vr.call(null,s,e,t);else if(!s&&!e.defaultPrevented&&e.target&&e.target[e.type]){Pt.has(e.target)||Pt.set(e.target,{});const n=Pt.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 oa(r,e,t){if(Array.isArray(e))return Zo(oa,r,e,t);const i=function(){St(r,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Qt(),qt(r,e,i)}function el(r,e,t){const i=function(){St(r,e,i),t.apply(this,arguments)};i.guid=t.guid=t.guid||Qt(),qt(r,e,i)}var OT=Object.freeze({__proto__:null,fixEvent:aa,on:qt,off:St,trigger:Vr,one:oa,any:el});const Jt=30,Ge=function(r,e,t){e.guid||(e.guid=Qt());const i=e.bind(r);return i.guid=t?t+"_"+e.guid:e.guid,i},Di=function(r,e){let t=N.performance.now();return function(...s){const n=N.performance.now();n-t>=e&&(r(...s),t=n)}},Ph=function(r,e,t,i=N){let s;const n=()=>{i.clearTimeout(s),s=null},a=function(){const o=this,u=arguments;let d=function(){s=null,d=null,t||r.apply(o,u)};!s&&t&&r.apply(o,u),i.clearTimeout(s),s=i.setTimeout(d,e)};return a.cancel=n,a};var BT=Object.freeze({__proto__:null,UPDATE_REFRESH_INTERVAL:Jt,bind_:Ge,throttle:Di,debounce:Ph});let fs;class Vt{on(e,t){const i=this.addEventListener;this.addEventListener=()=>{},qt(this,e,t),this.addEventListener=i}off(e,t){St(this,e,t)}one(e,t){const i=this.addEventListener;this.addEventListener=()=>{},oa(this,e,t),this.addEventListener=i}any(e,t){const i=this.addEventListener;this.addEventListener=()=>{},el(this,e,t),this.addEventListener=i}trigger(e){const t=e.type||e;typeof e=="string"&&(e={type:t}),e=aa(e),this.allowedEvents_[t]&&this["on"+t]&&this["on"+t](e),Vr(this,e)}queueTrigger(e){fs||(fs=new Map);const t=e.type||e;let i=fs.get(this);i||(i=new Map,fs.set(this,i));const s=i.get(t);i.delete(t),N.clearTimeout(s);const n=N.setTimeout(()=>{i.delete(t),i.size===0&&(i=null,fs.delete(this)),this.trigger(e)},0);i.set(t,n)}}Vt.prototype.allowedEvents_={};Vt.prototype.addEventListener=Vt.prototype.on;Vt.prototype.removeEventListener=Vt.prototype.off;Vt.prototype.dispatchEvent=Vt.prototype.trigger;const la=r=>typeof r.name=="function"?r.name():typeof r.name=="string"?r.name:r.name_?r.name_:r.constructor&&r.constructor.name?r.constructor.name:typeof r,Oi=r=>r instanceof Vt||!!r.eventBusEl_&&["on","one","off","trigger"].every(e=>typeof r[e]=="function"),MT=(r,e)=>{Oi(r)?e():(r.eventedCallbacks||(r.eventedCallbacks=[]),r.eventedCallbacks.push(e))},xo=r=>typeof r=="string"&&/\S/.test(r)||Array.isArray(r)&&!!r.length,Dn=(r,e,t)=>{if(!r||!r.nodeName&&!Oi(r))throw new Error(`Invalid target for ${la(e)}#${t}; must be a DOM node or evented object.`)},Rh=(r,e,t)=>{if(!xo(r))throw new Error(`Invalid event type for ${la(e)}#${t}; must be a non-empty string or array.`)},Lh=(r,e,t)=>{if(typeof r!="function")throw new Error(`Invalid listener for ${la(e)}#${t}; must be a function.`)},Xa=(r,e,t)=>{const i=e.length<3||e[0]===r||e[0]===r.eventBusEl_;let s,n,a;return i?(s=r.eventBusEl_,e.length>=3&&e.shift(),[n,a]=e):(s=e[0],n=e[1],a=e[2]),Dn(s,r,t),Rh(n,r,t),Lh(a,r,t),a=Ge(r,a),{isTargetingSelf:i,target:s,type:n,listener:a}},tr=(r,e,t,i)=>{Dn(r,r,e),r.nodeName?OT[e](r,t,i):r[e](t,i)},FT={on(...r){const{isTargetingSelf:e,target:t,type:i,listener:s}=Xa(this,r,"on");if(tr(t,"on",i,s),!e){const n=()=>this.off(t,i,s);n.guid=s.guid;const a=()=>this.off("dispose",n);a.guid=s.guid,tr(this,"on","dispose",n),tr(t,"on","dispose",a)}},one(...r){const{isTargetingSelf:e,target:t,type:i,listener:s}=Xa(this,r,"one");if(e)tr(t,"one",i,s);else{const n=(...a)=>{this.off(t,i,n),s.apply(null,a)};n.guid=s.guid,tr(t,"one",i,n)}},any(...r){const{isTargetingSelf:e,target:t,type:i,listener:s}=Xa(this,r,"any");if(e)tr(t,"any",i,s);else{const n=(...a)=>{this.off(t,i,n),s.apply(null,a)};n.guid=s.guid,tr(t,"any",i,n)}},off(r,e,t){if(!r||xo(r))St(this.eventBusEl_,r,e);else{const i=r,s=e;Dn(i,this,"off"),Rh(s,this,"off"),Lh(t,this,"off"),t=Ge(this,t),this.off("dispose",t),i.nodeName?(St(i,s,t),St(i,"dispose",t)):Oi(i)&&(i.off(s,t),i.off("dispose",t))}},trigger(r,e){Dn(this.eventBusEl_,this,"trigger");const t=r&&typeof r!="string"?r.type:r;if(!xo(t))throw new Error(`Invalid event type for ${la(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);return Vr(this.eventBusEl_,r,e)}};function tl(r,e={}){const{eventBusKey:t}=e;if(t){if(!r[t].nodeName)throw new Error(`The eventBusKey "${t}" does not refer to an element.`);r.eventBusEl_=r[t]}else r.eventBusEl_=xe("span",{className:"vjs-event-bus"});return Object.assign(r,FT),r.eventedCallbacks&&r.eventedCallbacks.forEach(i=>{i()}),r.on("dispose",()=>{r.off(),[r,r.el_,r.eventBusEl_].forEach(function(i){i&&Pt.has(i)&&Pt.delete(i)}),N.setTimeout(()=>{r.eventBusEl_=null},0)}),r}const UT={state:{},setState(r){typeof r=="function"&&(r=r());let e;return Sr(r,(t,i)=>{this.state[i]!==t&&(e=e||{},e[i]={from:this.state[i],to:t}),this.state[i]=t}),e&&Oi(this)&&this.trigger({changes:e,type:"statechanged"}),e}};function Nh(r,e){return Object.assign(r,UT),r.state=Object.assign({},r.state,e),typeof r.handleStateChanged=="function"&&Oi(r)&&r.on("statechanged",r.handleStateChanged),r}const xs=function(r){return typeof r!="string"?r:r.replace(/./,e=>e.toLowerCase())},nt=function(r){return typeof r!="string"?r:r.replace(/./,e=>e.toUpperCase())},Oh=function(r,e){return nt(r)===nt(e)};var $T=Object.freeze({__proto__:null,toLowerCase:xs,toTitleCase:nt,titleCaseEquals:Oh});class ee{constructor(e,t,i){if(!e&&this.play?this.player_=e=this:this.player_=e,this.isDisposed_=!1,this.parentComponent_=null,this.options_=$e({},this.options_),t=this.options_=$e(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_${Qt()}`}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&&(tl(this,{eventBusKey:this.el_?"el_":null}),this.handleLanguagechange=this.handleLanguagechange.bind(this),this.on(this.player_,"languagechange",this.handleLanguagechange)),Nh(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_=$e(this.options_,e),this.options_):this.options_}el(){return this.el_}createEl(e,t,i){return xe(e,t,i)}localize(e,t,i=e){const s=this.player_.language&&this.player_.language(),n=this.player_.languages&&this.player_.languages(),a=n&&n[s],o=s&&s.split("-")[0],u=n&&n[o];let d=i;return a&&a[e]?d=a[e]:u&&u[e]&&(d=u[e]),t&&(d=d.replace(/\{(\d+)\}/g,function(p,T){const A=t[T-1];let b=A;return typeof A>"u"&&(b=p),b})),d}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,s)=>i.concat(s),[]);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",s=xe("span",{className:"vjs-icon-placeholder vjs-svg-icon"},{"aria-hidden":"true"}),n=he.createElementNS(i,"svg");n.setAttributeNS(null,"viewBox","0 0 512 512");const a=he.createElementNS(i,"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={},i=this.children_.length){let s,n;if(typeof e=="string"){n=nt(e);const a=t.componentClass||n;t.name=n;const o=ee.getComponent(a);if(!o)throw new Error(`Component ${a} does not exist`);if(typeof o!="function")return null;s=new o(this.player_||this,t)}else s=e;if(s.parentComponent_&&s.parentComponent_.removeChild(s),this.children_.splice(i,0,s),s.parentComponent_=this,typeof s.id=="function"&&(this.childIndex_[s.id()]=s),n=n||s.name&&nt(s.name()),n&&(this.childNameIndex_[n]=s,this.childNameIndex_[xs(n)]=s),typeof s.el=="function"&&s.el()){let a=null;this.children_[i+1]&&(this.children_[i+1].el_?a=this.children_[i+1].el_:qr(this.children_[i+1])&&(a=this.children_[i+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_[nt(e.name())]=null,this.childNameIndex_[xs(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 o=a.name;let u=a.opts;if(t[o]!==void 0&&(u=t[o]),u===!1)return;u===!0&&(u={}),u.playerOptions=this.options_.playerOptions;const d=this.addChild(o,u);d&&(this[o]=d)};let s;const n=ee.getComponent("Tech");Array.isArray(e)?s=e:s=Object.keys(e),s.concat(Object.keys(this.options_).filter(function(a){return!s.some(function(o){return typeof o=="string"?a===o:a===o.name})})).map(a=>{let o,u;return typeof a=="string"?(o=a,u=e[o]||this.options_[o]||{}):(o=a.name,u=a),{name:o,opts:u}}).filter(a=>{const o=ee.getComponent(a.opts.componentClass||nt(a.name));return o&&!n.isTech(o)}).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 Gi(e,t||this.contentEl())}$$(e,t){return Ch(e,t||this.contentEl())}hasClass(e){return bs(this.el_,e)}addClass(...e){or(this.el_,...e)}removeClass(...e){ia(this.el_,...e)}toggleClass(e,t){yh(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 Th(this.el_,e)}setAttribute(e,t){Br(this.el_,e,t)}removeAttribute(e){ra(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 s=this.el_.style[e],n=s.indexOf("px");return parseInt(n!==-1?s.slice(0,n):this.el_["offset"+nt(e)],10)}currentDimension(e){let t=0;if(e!=="width"&&e!=="height")throw new Error("currentDimension only accepts width or height value");if(t=Fr(this.el_,e),t=parseFloat(t),t===0||isNaN(t)){const i=`offset${nt(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,s=200;let n;this.on("touchstart",function(o){o.touches.length===1&&(t={pageX:o.touches[0].pageX,pageY:o.touches[0].pageY},e=N.performance.now(),n=!0)}),this.on("touchmove",function(o){if(o.touches.length>1)n=!1;else if(t){const u=o.touches[0].pageX-t.pageX,d=o.touches[0].pageY-t.pageY;Math.sqrt(u*u+d*d)>i&&(n=!1)}});const a=function(){n=!1};this.on("touchleave",a),this.on("touchcancel",a),this.on("touchend",function(o){t=null,n===!0&&N.performance.now()-e<s&&(o.preventDefault(),this.trigger("tap"))})}enableTouchActivity(){if(!this.player()||!this.player().reportUserActivity)return;const e=Ge(this.player(),this.player().reportUserActivity);let t;this.on("touchstart",function(){e(),this.clearInterval(t),t=this.setInterval(e,250)});const i=function(s){e(),this.clearInterval(t)};this.on("touchmove",e),this.on("touchend",i),this.on("touchcancel",i)}setTimeout(e,t){var i;return e=Ge(this,e),this.clearTimersOnDispose_(),i=N.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),N.clearTimeout(e)),e}setInterval(e,t){e=Ge(this,e),this.clearTimersOnDispose_();const i=N.setInterval(e,t);return this.setIntervalIds_.add(i),i}clearInterval(e){return this.setIntervalIds_.has(e)&&(this.setIntervalIds_.delete(e),N.clearInterval(e)),e}requestAnimationFrame(e){this.clearTimersOnDispose_();var t;return e=Ge(this,e),t=N.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=Ge(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),N.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,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=N.getComputedStyle(n,null),o=a.getPropertyValue("visibility");return a.getPropertyValue("display")!=="none"&&!["hidden","collapse"].includes(o)}function i(n){return!(!t(n.parentElement)||!t(n)||n.style.opacity==="0"||N.getComputedStyle(n).height==="0px"||N.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>(he.documentElement.clientWidth||N.innerWidth)||a.y<0||a.y>(he.documentElement.clientHeight||N.innerHeight))return!1;let o=he.elementFromPoint(a.x,a.y);for(;o;){if(o===n)return!0;if(o.parentNode)o=o.parentNode;else return!1}}return e||(e=this.el()),!!(s(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=ee.getComponent("Tech"),s=i&&i.isTech(t),n=ee===t||ee.prototype.isPrototypeOf(t.prototype);if(s||!n){let o;throw s?o="techs must be registered using Tech.registerTech()":o="must be a Component subclass",new Error(`Illegal component, "${e}"; ${o}.`)}e=nt(e),ee.components_||(ee.components_={});const a=ee.getComponent("Player");if(e==="Player"&&a&&a.players){const o=a.players,u=Object.keys(o);if(o&&u.length>0&&u.map(d=>o[d]).every(Boolean))throw new Error("Can not register Player component after player has been created.")}return ee.components_[e]=t,ee.components_[xs(e)]=t,t}static getComponent(e){if(!(!e||!ee.components_))return ee.components_[e]}}ee.registerComponent("Component",ee);function jT(r,e,t){if(typeof e!="number"||e<0||e>t)throw new Error(`Failed to execute '${r}' on 'TimeRanges': The index provided (${e}) is non-numeric or out of bounds (0-${t}).`)}function xc(r,e,t,i){return jT(r,i,t.length-1),t[i][e]}function Ya(r){let e;return r===void 0||r.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:r.length,start:xc.bind(null,"start",0,r),end:xc.bind(null,"end",1,r)},N.Symbol&&N.Symbol.iterator&&(e[N.Symbol.iterator]=()=>(r||[]).values()),e}function li(r,e){return Array.isArray(r)?Ya(r):r===void 0||e===void 0?Ya():Ya([[r,e]])}const Bh=function(r,e){r=r<0?0:r;let t=Math.floor(r%60),i=Math.floor(r/60%60),s=Math.floor(r/3600);const n=Math.floor(e/60%60),a=Math.floor(e/3600);return(isNaN(r)||r===1/0)&&(s=i=t="-"),s=s>0||a>0?s+":":"",i=((s||n>=10)&&i<10?"0"+i:i)+":",t=t<10?"0"+t:t,s+i+t};let il=Bh;function Mh(r){il=r}function Fh(){il=Bh}function dr(r,e=r){return il(r,e)}var qT=Object.freeze({__proto__:null,createTimeRanges:li,createTimeRange:li,setFormatTime:Mh,resetFormatTime:Fh,formatTime:dr});function Uh(r,e){let t=0,i,s;if(!e)return 0;(!r||!r.length)&&(r=li(0,0));for(let n=0;n<r.length;n++)i=r.start(n),s=r.end(n),s>e&&(s=e),t+=s-i;return t/e}function rt(r){if(r instanceof rt)return r;typeof r=="number"?this.code=r:typeof r=="string"?this.message=r:Ai(r)&&(typeof r.code=="number"&&(this.code=r.code),Object.assign(this,r)),this.message||(this.message=rt.defaultMessages[this.code]||"")}rt.prototype.code=0;rt.prototype.message="";rt.prototype.status=null;rt.prototype.metadata=null;rt.errorTypes=["MEDIA_ERR_CUSTOM","MEDIA_ERR_ABORTED","MEDIA_ERR_NETWORK","MEDIA_ERR_DECODE","MEDIA_ERR_SRC_NOT_SUPPORTED","MEDIA_ERR_ENCRYPTED"];rt.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."};rt.MEDIA_ERR_CUSTOM=0;rt.prototype.MEDIA_ERR_CUSTOM=0;rt.MEDIA_ERR_ABORTED=1;rt.prototype.MEDIA_ERR_ABORTED=1;rt.MEDIA_ERR_NETWORK=2;rt.prototype.MEDIA_ERR_NETWORK=2;rt.MEDIA_ERR_DECODE=3;rt.prototype.MEDIA_ERR_DECODE=3;rt.MEDIA_ERR_SRC_NOT_SUPPORTED=4;rt.prototype.MEDIA_ERR_SRC_NOT_SUPPORTED=4;rt.MEDIA_ERR_ENCRYPTED=5;rt.prototype.MEDIA_ERR_ENCRYPTED=5;function Ss(r){return r!=null&&typeof r.then=="function"}function xi(r){Ss(r)&&r.then(null,e=>{})}const So=function(r){return["kind","label","language","id","inBandMetadataTrackDispatchType","mode","src"].reduce((t,i,s)=>(r[i]&&(t[i]=r[i]),t),{cues:r.cues&&Array.prototype.map.call(r.cues,function(t){return{startTime:t.startTime,endTime:t.endTime,text:t.text,id:t.id}})})},VT=function(r){const e=r.$$("track"),t=Array.prototype.map.call(e,s=>s.track);return Array.prototype.map.call(e,function(s){const n=So(s.track);return s.src&&(n.src=s.src),n}).concat(Array.prototype.filter.call(r.textTracks(),function(s){return t.indexOf(s)===-1}).map(So))},HT=function(r,e){return r.forEach(function(t){const i=e.addRemoteTextTrack(t).track;!t.src&&t.cues&&t.cues.forEach(s=>i.addCue(s))}),e.textTracks()};var Sc={textTracksToJson:VT,jsonToTextTracks:HT,trackToJson_:So};const Qa="vjs-modal-dialog";class Hr extends ee{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_=xe("div",{className:`${Qa}-content`},{role:"document"}),this.descEl_=xe("p",{className:`${Qa}-description vjs-control-text`,id:this.el().getAttribute("aria-describedby")}),Ki(this.descEl_,this.description()),this.el_.appendChild(this.descEl_),this.el_.appendChild(this.contentEl_)}createEl(){return super.createEl("div",{className:this.buildCSSClass(),tabIndex:-1},{"aria-describedby":`${this.id()}_description`,"aria-hidden":"true","aria-label":this.label(),role:"dialog","aria-live":"polite"})}dispose(){this.contentEl_=null,this.descEl_=null,this.previouslyActiveEl_=null,super.dispose()}buildCSSClass(){return`${Qa} vjs-hidden ${super.buildCSSClass()}`}label(){return this.localize(this.options_.label||"Modal Window")}description(){let e=this.options_.description||this.localize("This is a modal window.");return this.closeable()&&(e+=" "+this.localize("This modal can be closed by pressing the Escape key or activating the close button.")),e}open(){if(this.opened_){this.options_.fillAlways&&this.fill();return}const e=this.player();this.trigger("beforemodalopen"),this.opened_=!0,(this.options_.fillAlways||!this.hasBeenOpened_&&!this.hasBeenFilled_)&&this.fill(),this.wasPlaying_=!e.paused(),this.options_.pauseOnOpen&&this.wasPlaying_&&e.pause(),this.on("keydown",this.handleKeyDown_),this.hadControls_=e.controls(),e.controls(!1),this.show(),this.conditionalFocus_(),this.el().setAttribute("aria-hidden","false"),this.trigger("modalopen"),this.hasBeenOpened_=!0}opened(e){return typeof e=="boolean"&&this[e?"open":"close"](),this.opened_}close(){if(!this.opened_)return;const e=this.player();this.trigger("beforemodalclose"),this.opened_=!1,this.wasPlaying_&&this.options_.pauseOnOpen&&e.play(),this.off("keydown",this.handleKeyDown_),this.hadControls_&&e.controls(!0),this.hide(),this.el().setAttribute("aria-hidden","true"),this.trigger({type:"modalclose",bubbles:!0}),this.conditionalBlur_(),this.options_.temporary&&this.dispose()}closeable(e){if(typeof e=="boolean"){const t=this.closeable_=!!e;let i=this.getChild("closeButton");if(t&&!i){const s=this.contentEl_;this.contentEl_=this.el_,i=this.addChild("closeButton",{controlText:"Close Modal Dialog"}),this.contentEl_=s,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,s=t.nextSibling;this.trigger("beforemodalfill"),this.hasBeenFilled_=!0,i.removeChild(t),this.empty(),Eh(t,e),this.trigger("modalfill"),s?i.insertBefore(t,s):i.appendChild(t);const n=this.getChild("closeButton");n&&i.appendChild(n.el_),this.trigger("aftermodalfill")}empty(){this.trigger("beforemodalempty"),na(this.contentEl()),this.trigger("modalempty")}content(e){return typeof e<"u"&&(this.content_=e),this.content_}conditionalFocus_(){const e=he.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 s;for(let n=0;n<t.length;n++)if(i===t[n]){s=n;break}he.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 N.HTMLAnchorElement||t instanceof N.HTMLAreaElement)&&t.hasAttribute("href")||(t instanceof N.HTMLInputElement||t instanceof N.HTMLSelectElement||t instanceof N.HTMLTextAreaElement||t instanceof N.HTMLButtonElement)&&!t.hasAttribute("disabled")||t instanceof N.HTMLIFrameElement||t instanceof N.HTMLObjectElement||t instanceof N.HTMLEmbedElement||t.hasAttribute("tabindex")&&t.getAttribute("tabindex")!==-1||t.hasAttribute("contenteditable"))}}Hr.prototype.options_={pauseOnOpen:!0,temporary:!0};ee.registerComponent("ModalDialog",Hr);class Ur extends Vt{constructor(e=[]){super(),this.tracks_=[],Object.defineProperty(this,"length",{get(){return this.tracks_.length}});for(let t=0;t<e.length;t++)this.addTrack(e[t])}addTrack(e){const t=this.tracks_.length;""+t in this||Object.defineProperty(this,t,{get(){return this.tracks_[t]}}),this.tracks_.indexOf(e)===-1&&(this.tracks_.push(e),this.trigger({track:e,type:"addtrack",target:this})),e.labelchange_=()=>{this.trigger({track:e,type:"labelchange",target:this})},Oi(e)&&e.addEventListener("labelchange",e.labelchange_)}removeTrack(e){let t;for(let i=0,s=this.length;i<s;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,s=this.length;i<s;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}Ur.prototype.allowedEvents_={change:"change",addtrack:"addtrack",removetrack:"removetrack",labelchange:"labelchange"};for(const r in Ur.prototype.allowedEvents_)Ur.prototype["on"+r]=null;const Ja=function(r,e){for(let t=0;t<r.length;t++)!Object.keys(r[t]).length||e.id===r[t].id||(r[t].enabled=!1)};class zT extends Ur{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].enabled){Ja(e,e[t]);break}super(e),this.changing_=!1}addTrack(e){e.enabled&&Ja(this,e),super.addTrack(e),e.addEventListener&&(e.enabledChange_=()=>{this.changing_||(this.changing_=!0,Ja(this,e),this.changing_=!1,this.trigger("change"))},e.addEventListener("enabledchange",e.enabledChange_))}removeTrack(e){super.removeTrack(e),e.removeEventListener&&e.enabledChange_&&(e.removeEventListener("enabledchange",e.enabledChange_),e.enabledChange_=null)}}const Za=function(r,e){for(let t=0;t<r.length;t++)!Object.keys(r[t]).length||e.id===r[t].id||(r[t].selected=!1)};class WT extends Ur{constructor(e=[]){for(let t=e.length-1;t>=0;t--)if(e[t].selected){Za(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&&Za(this,e),super.addTrack(e),e.addEventListener&&(e.selectedChange_=()=>{this.changing_||(this.changing_=!0,Za(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 $h extends Ur{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 GT{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,s=this.trackElements_.length;i<s;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 In{constructor(e){In.prototype.setCues_.call(this,e),Object.defineProperty(this,"length",{get(){return this.length_}})}setCues_(e){const t=this.length||0;let i=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(i=t;i<s;i++)n.call(this,i)}getCueById(e){let t=null;for(let i=0,s=this.length;i<s;i++){const n=this[i];if(n.id===e){t=n;break}}return t}}const KT={alternative:"alternative",captions:"captions",main:"main",sign:"sign",subtitles:"subtitles",commentary:"commentary"},XT={alternative:"alternative",descriptions:"descriptions",main:"main","main-desc":"main-desc",translation:"translation",commentary:"commentary"},YT={subtitles:"subtitles",captions:"captions",descriptions:"descriptions",chapters:"chapters",metadata:"metadata"},Ec={disabled:"disabled",hidden:"hidden",showing:"showing"};class rl extends Vt{constructor(e={}){super();const t={id:e.id||"vjs_track_"+Qt(),kind:e.kind||"",language:e.language||""};let i=e.label||"";for(const s in t)Object.defineProperty(this,s,{get(){return t[s]},set(){}});Object.defineProperty(this,"label",{get(){return i},set(s){s!==i&&(i=s,this.trigger("labelchange"))}})}}const sl=function(r){return new URL(r,he.baseURI)},jh=function(r){return new URL(r,he.baseURI).href},nl=function(r){if(typeof r=="string"){const t=/^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/.exec(r);if(t)return t.pop().toLowerCase()}return""},ua=function(r,e=N.location){return sl(r).origin!==e.origin};var QT=Object.freeze({__proto__:null,parseUrl:sl,getAbsoluteURL:jh,getFileExtension:nl,isCrossOrigin:ua});const Cc=function(r,e){const t=new N.WebVTT.Parser(N,N.vttjs,N.WebVTT.StringDecoder()),i=[];t.oncue=function(s){e.addCue(s)},t.onparsingerror=function(s){i.push(s)},t.onflush=function(){e.trigger({type:"loadeddata",target:e})},t.parse(r),i.length>0&&(N.console&&N.console.groupCollapsed&&N.console.groupCollapsed(`Text Track parsing errors for ${e.src}`),i.forEach(s=>Pe.error(s)),N.console&&N.console.groupEnd&&N.console.groupEnd()),t.flush()},Ac=function(r,e){const t={uri:r},i=ua(r);i&&(t.cors=i);const s=e.tech_.crossOrigin()==="use-credentials";s&&(t.withCredentials=s),qd(t,Ge(this,function(n,a,o){if(n)return Pe.error(n,a);e.loaded_=!0,typeof N.WebVTT!="function"?e.tech_&&e.tech_.any(["vttjsloaded","vttjserror"],u=>{if(u.type==="vttjserror"){Pe.error(`vttjs failed to load, stopping trying to process ${e.src}`);return}return Cc(o,e)}):Cc(o,e)}))};class Rs extends rl{constructor(e={}){if(!e.tech)throw new Error("A tech was not provided.");const t=$e(e,{kind:YT[e.kind]||"subtitles",language:e.language||e.srclang||""});let i=Ec[t.mode]||"disabled";const s=t.default;(t.kind==="metadata"||t.kind==="chapters")&&(i="hidden"),super(t),this.tech_=t.tech,this.cues_=[],this.activeCues_=[],this.preload_=this.tech_.preloadTextTracks!==!1;const n=new In(this.cues_),a=new In(this.activeCues_);let o=!1;this.timeupdateHandler=Ge(this,function(d={}){if(!this.tech_.isDisposed()){if(!this.tech_.isReady_){d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler));return}this.activeCues=this.activeCues,o&&(this.trigger("cuechange"),o=!1),d.type!=="timeupdate"&&(this.rvf_=this.tech_.requestVideoFrameCallback(this.timeupdateHandler))}});const u=()=>{this.stopTracking()};this.tech_.one("dispose",u),i!=="disabled"&&this.startTracking(),Object.defineProperties(this,{default:{get(){return s},set(){}},mode:{get(){return i},set(d){Ec[d]&&i!==d&&(i=d,!this.preload_&&i!=="disabled"&&this.cues.length===0&&Ac(this.src,this),this.stopTracking(),i!=="disabled"&&this.startTracking(),this.trigger("modechange"))}},cues:{get(){return this.loaded_?n:null},set(){}},activeCues:{get(){if(!this.loaded_)return null;if(this.cues.length===0)return a;const d=this.tech_.currentTime(),p=[];for(let T=0,A=this.cues.length;T<A;T++){const b=this.cues[T];b.startTime<=d&&b.endTime>=d&&p.push(b)}if(o=!1,p.length!==this.activeCues_.length)o=!0;else for(let T=0;T<p.length;T++)this.activeCues_.indexOf(p[T])===-1&&(o=!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")&&Ac(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 N.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 i=this.tech_.textTracks();for(let s=0;s<i.length;s++)i[s]!==this&&i[s].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}}}}Rs.prototype.allowedEvents_={cuechange:"cuechange"};class qh extends rl{constructor(e={}){const t=$e(e,{kind:XT[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"enabled",{get(){return i},set(s){typeof s!="boolean"||s===i||(i=s,this.trigger("enabledchange"))}}),t.enabled&&(this.enabled=t.enabled),this.loaded_=!0}}class Vh extends rl{constructor(e={}){const t=$e(e,{kind:KT[e.kind]||""});super(t);let i=!1;Object.defineProperty(this,"selected",{get(){return i},set(s){typeof s!="boolean"||s===i||(i=s,this.trigger("selectedchange"))}}),t.selected&&(this.selected=t.selected)}}class Bi extends Vt{constructor(e={}){super();let t;const i=new Rs(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=Bi.NONE,i.addEventListener("loadeddata",()=>{t=Bi.LOADED,this.trigger({type:"load",target:this})})}}Bi.prototype.allowedEvents_={load:"load"};Bi.NONE=0;Bi.LOADING=1;Bi.LOADED=2;Bi.ERROR=3;const Yt={audio:{ListClass:zT,TrackClass:qh,capitalName:"Audio"},video:{ListClass:WT,TrackClass:Vh,capitalName:"Video"},text:{ListClass:$h,TrackClass:Rs,capitalName:"Text"}};Object.keys(Yt).forEach(function(r){Yt[r].getterName=`${r}Tracks`,Yt[r].privateName=`${r}Tracks_`});const $r={remoteText:{ListClass:$h,TrackClass:Rs,capitalName:"RemoteText",getterName:"remoteTextTracks",privateName:"remoteTextTracks_"},remoteTextEl:{ListClass:GT,TrackClass:Bi,capitalName:"RemoteTextTrackEls",getterName:"remoteTextTrackEls",privateName:"remoteTextTrackEls_"}},kt=Object.assign({},Yt,$r);$r.names=Object.keys($r);Yt.names=Object.keys(Yt);kt.names=[].concat($r.names).concat(Yt.names);function JT(r,e,t,i,s={}){const n=r.textTracks();s.kind=e,t&&(s.label=t),i&&(s.language=i),s.tech=r;const a=new kt.text.TrackClass(s);return n.addTrack(a),a}class De extends ee{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}),kt.names.forEach(i=>{const s=kt[i];e&&e[s.getterName]&&(this[s.privateName]=e[s.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 kt.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(Ge(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 li(0,0)}bufferedPercent(){return Uh(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(Yt.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 s=i.length;for(;s--;){const n=i[s];t==="text"&&this.removeRemoteTextTrack(n),i.removeTrack(n)}})}cleanupAutoTextTracks(){const e=this.autoRemoteTextTracks_||[];let t=e.length;for(;t--;){const i=e[t];this.removeRemoteTextTrack(i)}}reset(){}crossOrigin(){}setCrossOrigin(){}error(e){return e!==void 0&&(this.error_=new rt(e),this.trigger("error")),this.error_}played(){return this.hasStarted_?li(0,0):li()}play(){}setScrubbing(e){}scrubbing(){}setCurrentTime(e){this.manualTimeUpdates&&this.trigger({type:"timeupdate",target:this,manuallyTriggered:!0})}initTrackListeners(){Yt.names.forEach(e=>{const t=Yt[e],i=()=>{this.trigger(`${e}trackchange`)},s=this[t.getterName]();s.addEventListener("removetrack",i),s.addEventListener("addtrack",i),this.on("dispose",()=>{s.removeEventListener("removetrack",i),s.removeEventListener("addtrack",i)})})}addWebVttScript_(){if(!N.WebVTT)if(he.body.contains(this.el())){if(!this.options_["vtt.js"]&&Or(Xu)&&Object.keys(Xu).length>0){this.trigger("vttjsloaded");return}const e=he.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}),N.WebVTT=!0,this.el().parentNode.appendChild(e)}else this.ready(this.addWebVttScript_)}emulateTextTracks(){const e=this.textTracks(),t=this.remoteTextTracks(),i=o=>e.addTrack(o.track),s=o=>e.removeTrack(o.track);t.on("addtrack",i),t.on("removetrack",s),this.addWebVttScript_();const n=()=>this.trigger("texttrackchange"),a=()=>{n();for(let o=0;o<e.length;o++){const u=e[o];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",i),t.off("removetrack",s),e.removeEventListener("change",a),e.removeEventListener("addtrack",a),e.removeEventListener("removetrack",a);for(let o=0;o<e.length;o++)e[o].removeEventListener("cuechange",n)})}addTextTrack(e,t,i){if(!e)throw new Error("TextTrack kind is required but was not provided");return JT(this,e,t,i)}createRemoteTextTrack(e){const t=$e(e,{tech:this});return new $r.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=Qt();return!this.isReady_||this.paused()?(this.queuedHanders_.add(t),this.one("playing",()=>{this.queuedHanders_.has(t)&&(this.queuedHanders_.delete(t),e())})):this.requestNamedAnimationFrame(t,e),t}cancelVideoFrameCallback(e){this.queuedHanders_.has(e)?this.queuedHanders_.delete(e):this.cancelNamedAnimationFrame(e)}setPoster(){}playsinline(){}setPlaysinline(){}overrideNativeAudioTracks(e){}overrideNativeVideoTracks(e){}canPlayType(e){return""}static canPlayType(e){return""}static canPlaySource(e,t){return De.canPlayType(e.type)}static isTech(e){return e.prototype instanceof De||e instanceof De||e===De}static registerTech(e,t){if(De.techs_||(De.techs_={}),!De.isTech(t))throw new Error(`Tech ${e} must be a Tech`);if(!De.canPlayType)throw new Error("Techs must have a static canPlayType method on them");if(!De.canPlaySource)throw new Error("Techs must have a static canPlaySource method on them");return e=nt(e),De.techs_[e]=t,De.techs_[xs(e)]=t,e!=="Tech"&&De.defaultTechOrder_.push(e),t}static getTech(e){if(e){if(De.techs_&&De.techs_[e])return De.techs_[e];if(e=nt(e),N&&N.videojs&&N.videojs[e])return Pe.warn(`The ${e} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`),N.videojs[e]}}}kt.names.forEach(function(r){const e=kt[r];De.prototype[e.getterName]=function(){return this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName]}});De.prototype.featuresVolumeControl=!0;De.prototype.featuresMuteControl=!0;De.prototype.featuresFullscreenResize=!1;De.prototype.featuresPlaybackRate=!1;De.prototype.featuresProgressEvents=!1;De.prototype.featuresSourceset=!1;De.prototype.featuresTimeupdateEvents=!1;De.prototype.featuresNativeTextTracks=!1;De.prototype.featuresVideoFrameCallback=!1;De.withSourceHandlers=function(r){r.registerSourceHandler=function(t,i){let s=r.sourceHandlers;s||(s=r.sourceHandlers=[]),i===void 0&&(i=s.length),s.splice(i,0,t)},r.canPlayType=function(t){const i=r.sourceHandlers||[];let s;for(let n=0;n<i.length;n++)if(s=i[n].canPlayType(t),s)return s;return""},r.selectSourceHandler=function(t,i){const s=r.sourceHandlers||[];let n;for(let a=0;a<s.length;a++)if(n=s[a].canHandleSource(t,i),n)return s[a];return null},r.canPlaySource=function(t,i){const s=r.selectSourceHandler(t,i);return s?s.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)})},r.prototype),r.prototype.setSource=function(t){let i=r.selectSourceHandler(t,this.options_);i||(r.nativeSourceHandler?i=r.nativeSourceHandler:Pe.error("No source handler found for the current source.")),this.disposeSourceHandler(),this.off("dispose",this.disposeSourceHandler_),i!==r.nativeSourceHandler&&(this.currentSource_=t),this.sourceHandler_=i.handleSource(t,this,this.options_),this.one("dispose",this.disposeSourceHandler_)},r.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)}};ee.registerComponent("Tech",De);De.registerTech("Tech",De);De.defaultTechOrder_=[];const lr={},kn={},Pn={};function ZT(r,e){lr[r]=lr[r]||[],lr[r].push(e)}function ev(r,e,t){r.setTimeout(()=>ir(e,lr[e.type],t,r),1)}function tv(r,e){r.forEach(t=>t.setTech&&t.setTech(e))}function iv(r,e,t){return r.reduceRight(al(t),e[t]())}function rv(r,e,t,i){return e[t](r.reduce(al(t),i))}function wc(r,e,t,i=null){const s="call"+nt(t),n=r.reduce(al(s),i),a=n===Pn,o=a?null:e[t](n);return av(r,t,o,a),o}const sv={buffered:1,currentTime:1,duration:1,muted:1,played:1,paused:1,seekable:1,volume:1,ended:1},nv={setCurrentTime:1,setMuted:1,setVolume:1},Dc={play:1,pause:1};function al(r){return(e,t)=>e===Pn?Pn:t[r]?t[r](e):e}function av(r,e,t,i){for(let s=r.length-1;s>=0;s--){const n=r[s];n[e]&&n[e](i,t)}}function ov(r){kn.hasOwnProperty(r.id())&&delete kn[r.id()]}function lv(r,e){const t=kn[r.id()];let i=null;if(t==null)return i=e(r),kn[r.id()]=[[e,i]],i;for(let s=0;s<t.length;s++){const[n,a]=t[s];n===e&&(i=a)}return i===null&&(i=e(r),t.push([e,i])),i}function ir(r={},e=[],t,i,s=[],n=!1){const[a,...o]=e;if(typeof a=="string")ir(r,lr[a],t,i,s,n);else if(a){const u=lv(i,a);if(!u.setSource)return s.push(u),ir(r,o,t,i,s,n);u.setSource(Object.assign({},r),function(d,p){if(d)return ir(r,o,t,i,s,n);s.push(u),ir(p,r.type===p.type?o:lr[p.type],t,i,s,n)})}else o.length?ir(r,o,t,i,s,n):n?t(r,s):ir(r,lr["*"],t,i,s,!0)}const uv={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"},Rn=function(r=""){const e=nl(r);return uv[e.toLowerCase()]||""},cv=(r,e)=>{if(!e)return"";if(r.cache_.source.src===e&&r.cache_.source.type)return r.cache_.source.type;const t=r.cache_.sources.filter(s=>s.src===e);if(t.length)return t[0].type;const i=r.$$("source");for(let s=0;s<i.length;s++){const n=i[s];if(n.type&&n.src&&n.src===e)return n.type}return Rn(e)},Hh=function(r){if(Array.isArray(r)){let e=[];r.forEach(function(t){t=Hh(t),Array.isArray(t)?e=e.concat(t):Ai(t)&&e.push(t)}),r=e}else typeof r=="string"&&r.trim()?r=[Ic({src:r})]:Ai(r)&&typeof r.src=="string"&&r.src&&r.src.trim()?r=[Ic(r)]:r=[];return r};function Ic(r){if(!r.type){const e=Rn(r.src);e&&(r.type=e)}return r}var dv=`<svg xmlns="http://www.w3.org/2000/svg">
|
|
29
18
|
<defs>
|
|
30
19
|
<symbol viewBox="0 0 48 48" id="vjs-icon-play">
|
|
31
20
|
<path d="M16 10v28l22-14z"></path>
|
|
@@ -167,8 +156,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
167
156
|
<path d="M1664 896q0 209-103 385.5T1281.5 1561 896 1664q-111 0-218-32 59-93 78-164 9-34 54-211 20 39 73 67.5t114 28.5q121 0 216-68.5t147-188.5 52-270q0-114-59.5-214T1180 449t-255-63q-105 0-196 29t-154.5 77-109 110.5-67 129.5T377 866q0 104 40 183t117 111q30 12 38-20 2-7 8-31t8-30q6-23-11-43-51-61-51-151 0-151 104.5-259.5T904 517q151 0 235.5 82t84.5 213q0 170-68.5 289T980 1220q-61 0-98-43.5T859 1072q8-35 26.5-93.5t30-103T927 800q0-50-27-83t-77-33q-62 0-105 57t-43 142q0 73 25 122l-99 418q-17 70-13 177-206-91-333-281T128 896q0-209 103-385.5T510.5 231 896 128t385.5 103T1561 510.5 1664 896z"></path>
|
|
168
157
|
</symbol>
|
|
169
158
|
</defs>
|
|
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_,`
|
|
159
|
+
</svg>`;const kc=Cn?10009:An?461:8,yr={codes:{play:415,pause:19,ff:417,rw:412,back:kc},names:{415:"play",19:"pause",417:"ff",412:"rw",[kc]:"back"},isEventKey(r,e){return e=e.toLowerCase(),!!(this.names[r.keyCode]&&this.names[r.keyCode]===e)},getEventName(r){if(this.names[r.keyCode])return this.names[r.keyCode];if(this.codes[r.code]){const e=this.codes[r.code];return this.names[e]}return null}},Pc=5;class hv extends Vt{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(yr.isEventKey(t,"play")||yr.isEventKey(t,"pause")||yr.isEventKey(t,"ff")||yr.isEventKey(t,"rw")){t.preventDefault();const i=yr.getEventName(t);this.performMediaAction_(i)}else yr.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()+Pc);break;case"rw":this.userSeek_(this.player_.currentTime()-Pc);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 s=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)&&(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 i(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&&i(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?i(s.children_):s.hasOwnProperty("items")&&s.items.length>0?i(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((o,u)=>{t.push({name:()=>"ModalButton"+(u+1),el:()=>o,getPositions:()=>{const d=o.getBoundingClientRect(),p={x:d.x,y:d.y,width:d.width,height:d.height,top:d.top,right:d.right,bottom:d.bottom,left:d.left},T={x:d.left+d.width/2,y:d.top+d.height/2,width:0,height:0,top:d.top+d.height/2,right:d.left+d.width/2,bottom:d.top+d.height/2,left:d.left+d.width/2};return{boundingClientRect:p,center:T}},getIsAvailableToBeFocused:()=>!0,getIsFocusable:d=>!0,focus:()=>o.focus()})})}}),this.focusableComponents=t,this.focusableComponents}findSuitableDOMChild(e){function t(i){if(e.getIsFocusable(i)&&e.getIsAvailableToBeFocused(i))return i;for(let s=0;s<i.children.length;s++){const n=i.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 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(),s=this.focusableComponents.filter(a=>a!==t&&this.isInDirection_(i.boundingClientRect,a.getPositions().boundingClientRect,e)),n=this.findBestCandidate_(i.center,s,e);n?this.focus(n):this.trigger({type:"endOfFocusableComponents",direction:e,focusedComponent:t})}findBestCandidate_(e,t,i){let s=1/0,n=null;for(const a of t){const o=a.getPositions().center,u=this.calculateDistance_(e,o,i);u<s&&(s=u,n=a)}return n}isInDirection_(e,t,i){switch(i){case"right":return t.left>=e.right;case"left":return t.right<=e.left;case"down":return t.top>=e.bottom;case"up":return t.bottom<=e.top;default:return!1}}refocusComponent(){if(this.lastFocusedComponent_){this.player_.userActive()||this.player_.userActive(!0),this.updateFocusableComponents();for(let e=0;e<this.focusableComponents.length;e++)if(this.focusableComponents[e].name()===this.lastFocusedComponent_.name()){this.focus(this.focusableComponents[e]);return}}else this.focus(this.updateFocusableComponents()[0])}focus(e){typeof e=="object"&&(e.getIsAvailableToBeFocused(e.el())?e.focus():this.findSuitableDOMChild(e)&&this.findSuitableDOMChild(e).focus())}calculateDistance_(e,t,i){const s=Math.abs(e.x-t.x),n=Math.abs(e.y-t.y);let a;switch(i){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 fv extends ee{constructor(e,t,i){const s=$e({createEl:!1},t);if(super(e,s,i),!t.playerOptions.sources||t.playerOptions.sources.length===0)for(let n=0,a=t.playerOptions.techOrder;n<a.length;n++){const o=nt(a[n]);let u=De.getTech(o);if(o||(u=ee.getComponent(o)),u&&u.isSupported()){e.loadTech_(o);break}}else e.src(t.playerOptions.sources)}}ee.registerComponent("MediaLoader",fv);class ca extends ee{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"&&Pe.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 s=xe(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}dispose(){this.controlTextEl_=null,super.dispose()}createControlTextEl(e){return this.controlTextEl_=xe("span",{className:"vjs-control-text"},{"aria-live":"polite"}),e&&e.appendChild(this.controlTextEl_),this.controlText(this.controlText_,e),this.controlTextEl_}controlText(e,t=this.el()){if(e===void 0)return this.controlText_||"Need Text";const i=this.localize(e);this.controlText_=e,Ki(this.controlTextEl_,i),!this.nonIconControl&&!this.player_.options_.noUITitleAttributes&&t.setAttribute("title",i)}buildCSSClass(){return`vjs-control vjs-button ${super.buildCSSClass()}`}enable(){this.enabled_||(this.enabled_=!0,this.removeClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","false"),typeof this.tabIndex_<"u"&&this.el_.setAttribute("tabIndex",this.tabIndex_),this.on(["tap","click"],this.handleClick_),this.on("keydown",this.handleKeyDown_))}disable(){this.enabled_=!1,this.addClass("vjs-disabled"),this.el_.setAttribute("aria-disabled","true"),typeof this.tabIndex_<"u"&&this.el_.removeAttribute("tabIndex"),this.off("mouseover",this.handleMouseOver_),this.off("mouseout",this.handleMouseOut_),this.off(["tap","click"],this.handleClick_),this.off("keydown",this.handleKeyDown_)}handleLanguagechange(){this.controlText(this.controlText_)}handleClick(e){this.options_.clickHandler&&this.options_.clickHandler.call(this,arguments)}handleKeyDown(e){e.key===" "||e.key==="Enter"?(e.preventDefault(),e.stopPropagation(),this.trigger("click")):super.handleKeyDown(e)}}ee.registerComponent("ClickableComponent",ca);class Eo extends ca{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 xe("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(xe("picture",{className:"vjs-poster",tabIndex:-1},{},xe("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()?xi(this.player_.play()):this.player_.pause())}}Eo.prototype.crossorigin=Eo.prototype.crossOrigin;ee.registerComponent("PosterImage",Eo);const Kt="#222",Rc="#ccc",pv={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 eo(r,e){let t;if(r.length===4)t=r[1]+r[1]+r[2]+r[2]+r[3]+r[3];else if(r.length===7)t=r.slice(1);else throw new Error("Invalid color code provided, "+r+"; 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 yi(r,e,t){try{r.style[e]=t}catch{return}}function Lc(r){return r?`${r}px`:""}class mv extends ee{constructor(e,t,i){super(e,t,i);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(Ge(this,function(){if(e.tech_&&e.tech_.featuresNativeTextTracks){this.hide();return}e.on("fullscreenchange",n),e.on("playerresize",n);const a=N.screen.orientation||N,o=N.screen.orientation?"change":"orientationchange";a.addEventListener(o,n),e.on("dispose",()=>a.removeEventListener(o,n));const u=this.options_.playerOptions.tracks||[];for(let d=0;d<u.length;d++)this.player_.addRemoteTextTrack(u[d],!0);this.preselectTrack()}))}preselectTrack(){const e={captions:1,subtitles:1},t=this.player_.textTracks(),i=this.player_.cache_.selectedLanguage;let s,n,a;for(let o=0;o<t.length;o++){const u=t[o];i&&i.enabled&&i.language&&i.language===u.language&&u.kind in e?u.kind===i.kind?a=u:a||(a=u):i&&!i.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 N.WebVTT=="function"&&N.WebVTT.processCues(N,[],this.el_)}updateDisplay(){const e=this.player_.textTracks(),t=this.options_.allowMultipleShowingTracks;if(this.clearDisplay(),t){const a=[];for(let o=0;o<e.length;++o){const u=e[o];u.mode==="showing"&&a.push(u)}this.updateForTrack(a);return}let i=null,s=null,n=e.length;for(;n--;){const a=e[n];a.mode==="showing"&&(a.kind==="descriptions"?i=a:s=a)}if(s?(this.getAttribute("aria-live")!=="off"&&this.setAttribute("aria-live","off"),this.updateForTrack(s)):i&&(this.getAttribute("aria-live")!=="assertive"&&this.setAttribute("aria-live","assertive"),this.updateForTrack(i)),!N.CSS.supports("inset","10px")){const a=this.el_,o=a.querySelectorAll(".vjs-text-track-cue"),u=this.player_.controlBar.el_.getBoundingClientRect().height,d=this.player_.el_.getBoundingClientRect().height;a.style="",yi(a,"position","relative"),yi(a,"height",d-u+"px"),yi(a,"top","unset"),wn?yi(a,"bottom",d+"px"):yi(a,"bottom","0px"),o.length>0&&o.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()||!N.CSS.supports("inset-inline: 10px"))return;const e=this.player_.currentWidth(),t=this.player_.currentHeight(),i=e/t,s=this.player_.videoWidth()/this.player_.videoHeight();let n=0,a=0;Math.abs(i-s)>.1&&(i>s?n=Math.round((e-t*s)/2):a=Math.round((t-e/s)/2)),yi(this.el_,"insetInline",Lc(n)),yi(this.el_,"insetBlock",Lc(a))}updateDisplayState(e){const t=this.player_.textTrackSettings.getValues(),i=e.activeCues;let s=i.length;for(;s--;){const n=i[s];if(!n)continue;const a=n.displayState;if(t.color&&(a.firstChild.style.color=t.color),t.textOpacity&&yi(a.firstChild,"color",eo(t.color||"#fff",t.textOpacity)),t.backgroundColor&&(a.firstChild.style.backgroundColor=t.backgroundColor),t.backgroundOpacity&&yi(a.firstChild,"backgroundColor",eo(t.backgroundColor||"#000",t.backgroundOpacity)),t.windowColor&&(t.windowOpacity?yi(a,"backgroundColor",eo(t.windowColor,t.windowOpacity)):a.style.backgroundColor=t.windowColor),t.edgeStyle&&(t.edgeStyle==="dropshadow"?a.firstChild.style.textShadow=`2px 2px 3px ${Kt}, 2px 2px 4px ${Kt}, 2px 2px 5px ${Kt}`:t.edgeStyle==="raised"?a.firstChild.style.textShadow=`1px 1px ${Kt}, 2px 2px ${Kt}, 3px 3px ${Kt}`:t.edgeStyle==="depressed"?a.firstChild.style.textShadow=`1px 1px ${Rc}, 0 1px ${Rc}, -1px -1px ${Kt}, 0 -1px ${Kt}`:t.edgeStyle==="uniform"&&(a.firstChild.style.textShadow=`0 0 4px ${Kt}, 0 0 4px ${Kt}, 0 0 4px ${Kt}, 0 0 4px ${Kt}`)),t.fontPercent&&t.fontPercent!==1){const o=N.parseFloat(a.style.fontSize);a.style.fontSize=o*t.fontPercent+"px",a.style.height="auto",a.style.top="auto"}t.fontFamily&&t.fontFamily!=="default"&&(t.fontFamily==="small-caps"?a.firstChild.style.fontVariant="small-caps":a.firstChild.style.fontFamily=pv[t.fontFamily])}}updateForTrack(e){if(Array.isArray(e)||(e=[e]),typeof N.WebVTT!="function"||e.every(i=>!i.activeCues))return;const t=[];for(let i=0;i<e.length;++i){const s=e[i];for(let n=0;n<s.activeCues.length;++n)t.push(s.activeCues[n])}N.WebVTT.processCues(N,t,this.el_);for(let i=0;i<e.length;++i){const s=e[i];for(let n=0;n<s.activeCues.length;++n){const a=s.activeCues[n].displayState;or(a,"vjs-text-track-cue","vjs-text-track-cue-"+(s.language?s.language:i)),s.language&&Br(a,"lang",s.language)}this.player_.textTrackSettings&&this.updateDisplayState(s)}}}ee.registerComponent("TextTrackDisplay",mv);class gv extends ee{createEl(){const e=this.player_.isAudio(),t=this.localize(e?"Audio Player":"Video Player"),i=xe("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(i),s}handleLanguagechange(){this.$(".vjs-control-text").textContent=this.localize("{1} is loading.",[this.player_.isAudio()?"Audio Player":"Video Player"])}}ee.registerComponent("LoadingSpinner",gv);class Et extends ca{createEl(e,t={},i={}){e="button",t=Object.assign({className:this.buildCSSClass()},t),i=Object.assign({type:"button"},i);const s=xe(e,t,i);return this.player_.options_.experimentalSvgIcons||s.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),this.createControlTextEl(s),s}addChild(e,t={}){const i=this.constructor.name;return Pe.warn(`Adding an actionable (user controllable) child to a Button (${i}) is not supported; use a ClickableComponent instead.`),ee.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)}}ee.registerComponent("Button",Et);class zh extends Et{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){xi(t),this.player_.tech(!0)&&this.player_.tech(!0).focus();return}const i=this.player_.getChild("controlBar"),s=i&&i.getChild("playToggle");if(!s){this.player_.tech(!0).focus();return}const n=()=>s.focus();Ss(t)?t.then(n,()=>{}):this.setTimeout(n,1)}handleKeyDown(e){this.mouseused_=!1,super.handleKeyDown(e)}handleMouseDown(e){this.mouseused_=!0}}zh.prototype.controlText_="Play Video";ee.registerComponent("BigPlayButton",zh);class yv extends Et{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)}}ee.registerComponent("CloseButton",yv);class Wh extends Et{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()?xi(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))}}Wh.prototype.controlText_="Play";ee.registerComponent("PlayToggle",Wh);class zr extends ee{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=xe("span",{className:"vjs-control-text",textContent:`${this.localize(this.labelText_)} `},{role:"presentation"});return t.appendChild(i),this.contentEl_=xe("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=dr(e),this.formattedTime_!==e&&(this.formattedTime_=e,this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_",()=>{if(!this.contentEl_)return;let t=this.textNode_;t&&this.contentEl_.firstChild!==t&&(t=null,Pe.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.")),this.textNode_=he.createTextNode(this.formattedTime_),this.textNode_&&(t?this.contentEl_.replaceChild(this.textNode_,t):this.contentEl_.appendChild(this.textNode_))}))}updateContent(e){}}zr.prototype.labelText_="Time";zr.prototype.controlText_="Time";ee.registerComponent("TimeDisplay",zr);class ol extends zr{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)}}ol.prototype.labelText_="Current Time";ol.prototype.controlText_="Current Time";ee.registerComponent("CurrentTimeDisplay",ol);class ll extends zr{constructor(e,t){super(e,t);const i=s=>this.updateContent(s);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)}}ll.prototype.labelText_="Duration";ll.prototype.controlText_="Duration";ee.registerComponent("DurationDisplay",ll);class _v extends ee{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}}ee.registerComponent("TimeDivider",_v);class ul extends zr{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(xe("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)}}ul.prototype.labelText_="Remaining Time";ul.prototype.controlText_="Remaining Time";ee.registerComponent("RemainingTimeDisplay",ul);class Tv extends ee{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_=xe("div",{className:"vjs-live-display"},{"aria-live":"off"}),this.contentEl_.appendChild(xe("span",{className:"vjs-control-text",textContent:`${this.localize("Stream Type")} `})),this.contentEl_.appendChild(he.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()}}ee.registerComponent("LiveDisplay",Tv);class Gh extends Et{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_=xe("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()}}Gh.prototype.controlText_="Seek to live, currently playing live";ee.registerComponent("SeekToLive",Gh);function Ls(r,e,t){return r=Number(r),Math.min(t,Math.max(e,isNaN(r)?e:r))}var vv=Object.freeze({__proto__:null,clamp:Ls});class cl extends ee{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"&&!wi&&e.preventDefault(),vh(),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;bh(),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(Ls(this.getPercent(),0,1).toFixed(4))}calculateDistance(e){const t=sa(this.el_,e);return this.vertical()?t.y:t.x}handleKeyDown(e){const t=this.options_.playerOptions.spatialNavigation,i=t&&t.enabled,s=t&&t.horizontalSeek;i?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")}}ee.registerComponent("Slider",cl);const to=(r,e)=>Ls(r/e*100,0,100).toFixed(2)+"%";class bv extends ee{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=xe("span",{className:"vjs-control-text"}),i=xe("span",{textContent:this.localize("Loaded")}),s=he.createTextNode(": ");return this.percentageEl_=xe("span",{className:"vjs-control-text-loaded-percentage",textContent:"0%"}),e.appendChild(t),t.appendChild(i),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,i=this.player_.buffered(),s=t&&t.isLive()?t.seekableEnd():this.player_.duration(),n=this.player_.bufferedEnd(),a=this.partEls_,o=to(n,s);this.percent_!==o&&(this.el_.style.width=o,Ki(this.percentageEl_,o),this.percent_=o);for(let u=0;u<i.length;u++){const d=i.start(u),p=i.end(u);let T=a[u];T||(T=this.el_.appendChild(xe()),a[u]=T),!(T.dataset.start===d&&T.dataset.end===p)&&(T.dataset.start=d,T.dataset.end=p,T.style.left=to(d,n),T.style.width=to(p-d,n))}for(let u=a.length;u>i.length;u--)this.el_.removeChild(a[u-1]);a.length=i.length})}}ee.registerComponent("LoadProgressBar",bv);class xv extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-time-tooltip"},{"aria-hidden":"true"})}update(e,t,i){const s=Is(this.el_),n=Mr(this.player_.el()),a=e.width*t;if(!n||!s)return;let o=e.left-n.left+a,u=e.width-a+(n.right-e.right);u||(u=e.width-a,o=a);let d=s.width/2;o<d?d+=d-o:u<d&&(d=u),d<0?d=0:d>s.width&&(d=s.width),d=Math.round(d),this.el_.style.right=`-${d}px`,this.write(i)}write(e){Ki(this.el_,e)}updateTime(e,t,i,s){this.requestNamedAnimationFrame("TimeTooltip#updateTime",()=>{let n;const a=this.player_.duration();if(this.player_.liveTracker&&this.player_.liveTracker.isLive()){const o=this.player_.liveTracker.liveWindow(),u=o-t*o;n=(u<1?"":"-")+dr(u,o)}else n=dr(i,a);this.update(e,t,n),s&&s()})}}ee.registerComponent("TimeTooltip",xv);class dl extends ee{constructor(e,t){super(e,t),this.setIcon("circle"),this.update=Di(Ge(this,this.update),Jt)}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 s=this.player_.scrubbing()?this.player_.getCache().currentTime:this.player_.currentTime();i.updateTime(e,t,s)}}dl.prototype.options_={children:[]};!xt&&!ci&&dl.prototype.options_.children.push("timeTooltip");ee.registerComponent("PlayProgressBar",dl);class Kh extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}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`})}}Kh.prototype.options_={children:["timeTooltip"]};ee.registerComponent("MouseTimeDisplay",Kh);const hn=5,Nc=12;class da extends cl{constructor(e,t){t=$e(da.prototype.options_,t),t.children=[...t.children];const i=e.options_.disableSeekWhileScrubbingOnMobile&&(xt||ci);(!xt&&!ci||i)&&t.children.splice(1,0,"mouseTimeDisplay"),super(e,t),this.shouldDisableSeekWhileScrubbingOnMobile_=i,this.pendingSeekTime_=null,this.setEventHandlers_()}setEventHandlers_(){this.update_=Ge(this,this.update),this.update=Di(this.update_,Jt),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 he&&"visibilityState"in he&&this.on(he,"visibilitychange",this.toggleVisibility_)}toggleVisibility_(e){he.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,Jt))}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(he.visibilityState==="hidden")return;const t=super.update();return this.requestNamedAnimationFrame("SeekBar#update",()=>{const i=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_!==i||this.duration_!==n)&&(this.el_.setAttribute("aria-valuetext",this.localize("progress bar timing: currentTime={1} duration={2}",[dr(i,n),dr(n,n)],"{1} of {2}")),this.currentTime_=i,this.duration_=n),this.bar&&this.bar.update(Mr(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){ks(e)&&(e.stopPropagation(),this.videoWasPlaying=!this.player_.paused(),this.shouldDisableSeekWhileScrubbingOnMobile_||this.player_.pause(),super.handleMouseDown(e))}handleMouseMove(e,t=!1){if(!ks(e)||isNaN(this.player_.duration()))return;!t&&!this.player_.scrubbing()&&this.player_.scrubbing(!0);let i;const s=this.calculateDistance(e),n=this.player_.liveTracker;if(!n||!n.isLive())i=s*this.player_.duration(),i===this.player_.duration()&&(i=i-.1);else{if(s>=.99){n.seekToLiveEdge();return}const a=n.seekableStart(),o=n.liveCurrentTime();if(i=a+s*n.liveWindow(),i>=o&&(i=o),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?xi(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 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()-hn*Nc)):e.key==="PageUp"?(e.preventDefault(),e.stopPropagation(),this.userSeek_(this.player_.currentTime()+hn*Nc)):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 he&&"visibilityState"in he&&this.off(he,"visibilitychange",this.toggleVisibility_),super.dispose()}}da.prototype.options_={children:["loadProgressBar","playProgressBar"],barName:"playProgressBar"};ee.registerComponent("SeekBar",da);class Xh extends ee{constructor(e,t){super(e,t),this.handleMouseMove=Di(Ge(this,this.handleMouseMove),Jt),this.throttledHandleMouseSeek=Di(Ge(this,this.handleMouseSeek),Jt),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"),s=t.getChild("mouseTimeDisplay");if(!i&&!s)return;const n=t.el(),a=Is(n);let o=sa(n,e).x;o=Ls(o,0,1),s&&s.update(a,o),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&&xi(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()}}Xh.prototype.options_={children:["seekBar"]};ee.registerComponent("ProgressControl",Xh);class Yh extends Et{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(){he.pictureInPictureEnabled&&this.player_.disablePictureInPicture()===!1||this.player_.options_.enableDocumentPictureInPicture&&"documentPictureInPicture"in N?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 he.exitPictureInPicture=="function"&&super.show()}}Yh.prototype.controlText_="Picture-in-Picture";ee.registerComponent("PictureInPictureToggle",Yh);class Qh extends Et{constructor(e,t){super(e,t),this.setIcon("fullscreen-enter"),this.on(e,"fullscreenchange",i=>this.handleFullscreenChange(i)),he[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()}}Qh.prototype.controlText_="Fullscreen";ee.registerComponent("FullscreenToggle",Qh);const Sv=function(r,e){e.tech_&&!e.tech_.featuresVolumeControl&&r.addClass("vjs-hidden"),r.on(e,"loadstart",function(){e.tech_.featuresVolumeControl?r.removeClass("vjs-hidden"):r.addClass("vjs-hidden")})};class Ev extends ee{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}}ee.registerComponent("VolumeLevel",Ev);class Cv extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-volume-tooltip"},{"aria-hidden":"true"})}update(e,t,i,s){if(!i){const n=Mr(this.el_),a=Mr(this.player_.el()),o=e.width*t;if(!a||!n)return;const u=e.left-a.left+o,d=e.width-o+(a.right-e.right);let p=n.width/2;u<p?p+=p-u:d<p&&(p=d),p<0?p=0:p>n.width&&(p=n.width),this.el_.style.right=`-${p}px`}this.write(`${s}%`)}write(e){Ki(this.el_,e)}updateVolume(e,t,i,s,n){this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume",()=>{this.update(e,t,i,s.toFixed(0)),n&&n()})}}ee.registerComponent("VolumeLevelTooltip",Cv);class Jh extends ee{constructor(e,t){super(e,t),this.update=Di(Ge(this,this.update),Jt)}createEl(){return super.createEl("div",{className:"vjs-mouse-display"})}update(e,t,i){const s=100*t;this.getChild("volumeLevelTooltip").updateVolume(e,t,i,s,()=>{i?this.el_.style.bottom=`${e.height*t}px`:this.el_.style.left=`${e.width*t}px`})}}Jh.prototype.options_={children:["volumeLevelTooltip"]};ee.registerComponent("MouseVolumeLevelDisplay",Jh);class ha extends cl{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){ks(e)&&super.handleMouseDown(e)}handleMouseMove(e){const t=this.getChild("mouseVolumeLevelDisplay");if(t){const i=this.el(),s=Mr(i),n=this.vertical();let a=sa(i,e);a=n?a.y:a.x,a=Ls(a,0,1),t.update(s,a,n)}ks(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)})}}ha.prototype.options_={children:["volumeLevel"],barName:"volumeLevel"};!xt&&!ci&&ha.prototype.options_.children.splice(0,0,"mouseVolumeLevelDisplay");ha.prototype.playerEvent="volumechange";ee.registerComponent("VolumeBar",ha);class Zh extends ee{constructor(e,t={}){t.vertical=t.vertical||!1,(typeof t.volumeBar>"u"||Or(t.volumeBar))&&(t.volumeBar=t.volumeBar||{},t.volumeBar.vertical=t.vertical),super(e,t),Sv(this,e),this.throttledHandleMouseMove=Di(Ge(this,this.handleMouseMove),Jt),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)}}Zh.prototype.options_={children:["volumeBar"]};ee.registerComponent("VolumeControl",Zh);const Av=function(r,e){e.tech_&&!e.tech_.featuresMuteControl&&r.addClass("vjs-hidden"),r.on(e,"loadstart",function(){e.tech_.featuresMuteControl?r.removeClass("vjs-hidden"):r.addClass("vjs-hidden")})};class ef extends Et{constructor(e,t){super(e,t),Av(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 s=i<.1?.1:i;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"),xt&&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),ia(this.el_,[0,1,2,3].reduce((i,s)=>i+`${s?" ":""}vjs-vol-${s}`,"")),or(this.el_,`vjs-vol-${t}`)}updateControlText_(){const t=this.player_.muted()||this.player_.volume()===0?"Unmute":"Mute";this.controlText()!==t&&this.controlText(t)}}ef.prototype.controlText_="Mute";ee.registerComponent("MuteToggle",ef);class tf extends ee{constructor(e,t={}){typeof t.inline<"u"?t.inline=t.inline:t.inline=!0,(typeof t.volumeControl>"u"||Or(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"),qt(he,"keyup",this.handleKeyPressHandler_)}handleMouseOut(e){this.removeClass("vjs-hover"),St(he,"keyup",this.handleKeyPressHandler_)}handleKeyPress(e){e.key==="Escape"&&this.handleMouseOut()}}tf.prototype.options_={children:["muteToggle","volumeControl"]};ee.registerComponent("VolumePanel",tf);class rf extends Et{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,s=i&&i.isLive()?i.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]))}}rf.prototype.controlText_="Skip Forward";ee.registerComponent("SkipForward",rf);class sf extends Et{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,s=i&&i.isLive()&&i.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]))}}sf.prototype.controlText_="Skip Backward";ee.registerComponent("SkipBackward",sf);class nf extends ee{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 ee&&(this.on(e,"blur",this.boundHandleBlur_),this.on(e,["tap","click"],this.boundHandleTapClick_))}removeEventListenerForItem(e){e instanceof ee&&(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_=xe(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_),qt(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||he.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(s=>s.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())}}ee.registerComponent("Menu",nf);class hl extends ee{constructor(e,t={}){super(e,t),this.menuButton_=new Et(e,t),this.menuButton_.controlText(this.controlText_),this.menuButton_.el_.setAttribute("aria-haspopup","true");const i=Et.prototype.buildCSSClass();this.menuButton_.el_.className=this.buildCSSClass()+" "+i,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(),qt(he,"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 nf(this.player_,{menuButton:this});if(this.hideThreshold_=0,this.options_.title){const t=xe("li",{className:"vjs-menu-title",textContent:nt(this.options_.title),tabIndex:-1}),i=new ee(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=Et.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"),St(he,"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"),xt&&mh())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()}}ee.registerComponent("MenuButton",hl);class fl extends hl{constructor(e,t){const i=t.tracks;if(super(e,t),this.items.length<=1&&this.hide(),!i)return;const s=Ge(this,this.update);i.addEventListener("removetrack",s),i.addEventListener("addtrack",s),i.addEventListener("labelchange",s),this.player_.on("ready",s),this.player_.on("dispose",function(){i.removeEventListener("removetrack",s),i.removeEventListener("addtrack",s),i.removeEventListener("labelchange",s)})}}ee.registerComponent("TrackButton",fl);class Ns extends ca{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 s=super.createEl("li",Object.assign({className:"vjs-menu-item",tabIndex:-1},t),i),n=xe("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))}}ee.registerComponent("MenuItem",Ns);class Os extends Ns{constructor(e,t){const i=t.track,s=e.textTracks();t.label=i.label||i.language||"Unknown",t.selected=i.mode==="showing",super(e,t),this.track=i,this.kinds=(t.kinds||[t.kind||this.track.kind]).filter(Boolean);const n=(...o)=>{this.handleTracksChange.apply(this,o)},a=(...o)=>{this.handleSelectedLanguageChange.apply(this,o)};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 o;this.on(["tap","click"],function(){if(typeof N.Event!="object")try{o=new N.Event("change")}catch{}o||(o=he.createEvent("Event"),o.initEvent("change",!0,!0)),s.dispatchEvent(o)})}this.handleTracksChange()}handleClick(e){const t=this.track,i=this.player_.textTracks();if(super.handleClick(e),!!i)for(let s=0;s<i.length;s++){const n=i[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()}}ee.registerComponent("TextTrackMenuItem",Os);class af extends Os{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 s=0,n=t.length;s<n;s++){const a=t[s];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 s=0,n=t.length;s<n;s++){const a=t[s];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()}}ee.registerComponent("OffTextTrackMenuItem",af);class Wr extends fl{constructor(e,t={}){t.tracks=e.textTracks(),super(e,t)}createItems(e=[],t=Os){let i;this.label_&&(i=`${this.label_} off`),e.push(new af(this.player_,{kinds:this.kinds_,kind:this.kind_,label:i})),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 o=new t(this.player_,{track:a,kinds:this.kinds_,kind:this.kind_,selectable:!0,multiSelectable:!1});o.addClass(`vjs-${a.kind}-menu-item`),e.push(o)}}return e}}ee.registerComponent("TextTrackButton",Wr);class of extends Ns{constructor(e,t){const i=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=i,this.cue=s}handleClick(e){super.handleClick(),this.player_.currentTime(this.cue.startTime)}}ee.registerComponent("ChaptersTrackMenuItem",of);class pl extends Wr{constructor(e,t,i){super(e,t,i),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 i=e[t];if(i.kind===this.kind_)return i}}getMenuCaption(){return this.track_&&this.track_.label?this.track_.label:this.localize(nt(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,s=t.length;i<s;i++){const n=t[i],a=new of(this.player_,{track:this.track_,cue:n});e.push(a)}return e}}pl.prototype.kind_="chapters";pl.prototype.controlText_="Chapters";ee.registerComponent("ChaptersButton",pl);class ml extends Wr{constructor(e,t,i){super(e,t,i),this.setIcon("audio-description");const s=e.textTracks(),n=Ge(this,this.handleTracksChange);s.addEventListener("change",n),this.on("dispose",function(){s.removeEventListener("change",n)})}handleTracksChange(e){const t=this.player().textTracks();let i=!1;for(let s=0,n=t.length;s<n;s++){const a=t[s];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()}`}}ml.prototype.kind_="descriptions";ml.prototype.controlText_="Descriptions";ee.registerComponent("DescriptionsButton",ml);class gl extends Wr{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()}`}}gl.prototype.kind_="subtitles";gl.prototype.controlText_="Subtitles";ee.registerComponent("SubtitlesButton",gl);class yl extends Os{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()}}ee.registerComponent("CaptionSettingsMenuItem",yl);class _l extends Wr{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 yl(this.player_,{kind:this.kind_})),this.hideThreshold_+=1),super.createItems(e)}}_l.prototype.kind_="captions";_l.prototype.controlText_="Captions";ee.registerComponent("CaptionsButton",_l);class lf extends Os{createEl(e,t,i){const s=super.createEl(e,t,i),n=s.querySelector(".vjs-menu-item-text");return this.options_.track.kind==="captions"&&(this.player_.options_.experimentalSvgIcons?this.setIcon("captions",s):n.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(xe("span",{className:"vjs-control-text",textContent:` ${this.localize("Captions")}`}))),s}}ee.registerComponent("SubsCapsMenuItem",lf);class Tl extends Wr{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(nt(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 yl(this.player_,{kind:this.label_})),this.hideThreshold_+=1),e=super.createItems(e,lf),e}}Tl.prototype.kinds_=["captions","subtitles"];Tl.prototype.controlText_="Subtitles";ee.registerComponent("SubsCapsButton",Tl);class uf extends Ns{constructor(e,t){const i=t.track,s=e.audioTracks();t.label=i.label||i.language||"Unknown",t.selected=i.enabled,super(e,t),this.track=i,this.addClass(`vjs-${i.kind}-menu-item`);const n=(...a)=>{this.handleTracksChange.apply(this,a)};s.addEventListener("change",n),this.on("dispose",()=>{s.removeEventListener("change",n)})}createEl(e,t,i){const s=super.createEl(e,t,i),n=s.querySelector(".vjs-menu-item-text");return["main-desc","descriptions"].indexOf(this.options_.track.kind)>=0&&(n.appendChild(xe("span",{className:"vjs-icon-placeholder"},{"aria-hidden":!0})),n.appendChild(xe("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 i=0;i<t.length;i++){const s=t[i];s!==this.track&&(s.enabled=s===this.track)}}}handleTracksChange(e){this.selected(this.track.enabled)}}ee.registerComponent("AudioTrackMenuItem",uf);class cf extends fl{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 s=t[i];e.push(new uf(this.player_,{track:s,selectable:!0,multiSelectable:!1}))}return e}}cf.prototype.controlText_="Audio Track";ee.registerComponent("AudioTrackButton",cf);class vl extends Ns{constructor(e,t){const i=t.rate,s=parseFloat(i,10);t.label=i,t.selected=s===e.playbackRate(),t.selectable=!0,t.multiSelectable=!1,super(e,t),this.label=i,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)}}vl.prototype.contentElType="button";ee.registerComponent("PlaybackRateMenuItem",vl);class df extends hl{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_=xe("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 vl(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")}}df.prototype.controlText_="Playback Rate";ee.registerComponent("PlaybackRateMenuButton",df);class hf extends ee{buildCSSClass(){return`vjs-spacer ${super.buildCSSClass()}`}createEl(e="div",t={},i={}){return t.className||(t.className=this.buildCSSClass()),super.createEl(e,t,i)}}ee.registerComponent("Spacer",hf);class wv extends hf{buildCSSClass(){return`vjs-custom-control-spacer ${super.buildCSSClass()}`}createEl(){return super.createEl("div",{className:this.buildCSSClass(),textContent:" "})}}ee.registerComponent("CustomControlSpacer",wv);class ff extends ee{createEl(){return super.createEl("div",{className:"vjs-control-bar",dir:"ltr"})}}ff.prototype.options_={children:["playToggle","skipBackward","skipForward","volumePanel","currentTimeDisplay","timeDivider","durationDisplay","progressControl","liveDisplay","seekToLive","remainingTimeDisplay","customControlSpacer","playbackRateMenuButton","chaptersButton","descriptionsButton","subsCapsButton","audioTrackButton","pictureInPictureToggle","fullscreenToggle"]};ee.registerComponent("ControlBar",ff);class pf extends Hr{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):""}}pf.prototype.options_=Object.assign({},Hr.prototype.options_,{pauseOnOpen:!1,fillAlways:!0,temporary:!1,uncloseable:!0});ee.registerComponent("ErrorDisplay",pf);class mf extends ee{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(),xe("select",{id:this.options_.id},{},this.options_.SelectOptions.map(t=>{const i=(this.options_.labelId?this.options_.labelId:`vjs-track-option-${Qt()}`)+"-"+t[1].replace(/\W+/g,""),s=xe("option",{id:i,value:this.localize(t[0]),textContent:this.localize(t[1])});return s.setAttribute("aria-labelledby",`${this.selectLabelledbyIds} ${i}`),s}))}}ee.registerComponent("TextTrackSelect",mf);class ur extends ee{constructor(e,t={}){super(e,t);const i=xe("legend",{textContent:this.localize(this.options_.legendText),id:this.options_.legendId});this.el().appendChild(i);const s=this.options_.selects;for(const n of s){const a=this.options_.selectConfigs[n],o=a.className,u=a.id.replace("%s",this.options_.id_);let d=null;const p=`vjs_select_${Qt()}`;if(this.options_.type==="colors"){d=xe("span",{className:o});const A=xe("label",{id:u,className:"vjs-label",textContent:this.localize(a.label)});A.setAttribute("for",p),d.appendChild(A)}const T=new mf(e,{SelectOptions:a.options,legendId:this.options_.legendId,id:p,labelId:u});this.addChild(T),this.options_.type==="colors"&&(d.appendChild(T.el()),this.el().appendChild(d))}}createEl(){return xe("fieldset",{className:this.options_.className})}}ee.registerComponent("TextTrackFieldset",ur);class gf extends ee{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,s=new ur(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(s);const n=new ur(e,{id_:i,legendId:`captions-background-${i}`,legendText:this.localize("Text Background"),className:"vjs-bg vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"colors"});this.addChild(n);const a=new ur(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 xe("div",{className:"vjs-track-settings-colors"})}}ee.registerComponent("TextTrackSettingsColors",gf);class yf extends ee{constructor(e,t={}){super(e,t);const i=this.options_.textTrackComponentid,s=new ur(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(s);const n=new ur(e,{id_:i,legendId:`captions-edge-style-${i}`,legendText:this.localize("Text Edge Style"),className:"vjs-edge-style vjs-track-setting",selects:this.options_.fieldSets[1],selectConfigs:this.options_.selectConfigs,type:"font"});this.addChild(n);const a=new ur(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 xe("div",{className:"vjs-track-settings-font"})}}ee.registerComponent("TextTrackSettingsFont",yf);class _f extends ee{constructor(e,t={}){super(e,t);const i=this.localize("restore all settings to the default values"),s=new Et(e,{controlText:i,className:"vjs-default-button"});s.el().classList.remove("vjs-control","vjs-button"),s.el().textContent=this.localize("Reset"),this.addChild(s);const n=new Et(e,{controlText:i,className:"vjs-done-button"});n.el().classList.remove("vjs-control","vjs-button"),n.el().textContent=this.localize("Done"),this.addChild(n)}createEl(){return xe("div",{className:"vjs-track-settings-controls"})}}ee.registerComponent("TrackSettingsControls",_f);const io="vjs-text-track-settings",Oc=["#000","Black"],Bc=["#00F","Blue"],Mc=["#0FF","Cyan"],Fc=["#0F0","Green"],Uc=["#F0F","Magenta"],$c=["#F00","Red"],jc=["#FFF","White"],qc=["#FF0","Yellow"],ro=["1","Opaque"],so=["0.5","Semi-Transparent"],Vc=["0","Transparent"],zi={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[Oc,jc,$c,Fc,Bc,qc,Uc,Mc],className:"vjs-bg-color"},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Opacity",options:[ro,so,Vc],className:"vjs-bg-opacity vjs-opacity"},color:{selector:".vjs-text-color > select",id:"captions-foreground-color-%s",label:"Color",options:[jc,Oc,$c,Fc,Bc,qc,Uc,Mc],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:r=>r==="1.00"?null:Number(r)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Opacity",options:[ro,so],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:[Vc,so,ro],className:"vjs-window-opacity vjs-opacity"}};zi.windowColor.options=zi.backgroundColor.options;function Tf(r,e){if(e&&(r=e(r)),r&&r!=="none")return r}function Dv(r,e){const t=r.options[r.options.selectedIndex].value;return Tf(t,e)}function Iv(r,e,t){if(e){for(let i=0;i<r.options.length;i++)if(Tf(r.options[i].value,t)===e){r.selectedIndex=i;break}}}class kv extends Hr{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=this.updateDisplay.bind(this),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.renderModalComponents(e),this.endDialog=xe("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 gf(e,{textTrackComponentid:this.id_,selectConfigs:zi,fieldSets:[["color","textOpacity"],["backgroundColor","backgroundOpacity"],["windowColor","windowOpacity"]]});this.addChild(t);const i=new yf(e,{textTrackComponentid:this.id_,selectConfigs:zi,fieldSets:[["fontPercent"],["edgeStyle"],["fontFamily"]]});this.addChild(i);const s=new _f(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()}),Sr(zi,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 lh(zi,(e,t,i)=>{const s=Dv(this.$(t.selector),t.parser);return s!==void 0&&(e[i]=s),e},{})}setValues(e){Sr(zi,(t,i)=>{Iv(this.$(t.selector),e[i],t.parser)})}setDefaults(){Sr(zi,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(N.localStorage.getItem(io))}catch(t){Pe.warn(t)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?N.localStorage.setItem(io,JSON.stringify(e)):N.localStorage.removeItem(io)}catch(t){Pe.warn(t)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}handleLanguagechange(){this.fill(),this.renderModalComponents(this.player_),this.bindFunctionsToSelectsAndButtons()}}ee.registerComponent("TextTrackSettings",kv);class Pv extends ee{constructor(e,t){let i=t.ResizeObserver||N.ResizeObserver;t.ResizeObserver===null&&(i=!1);const s=$e({createEl:!i,reportTouchActivity:!1},t);super(e,s),this.ResizeObserver=t.ResizeObserver||N.ResizeObserver,this.loadListener_=null,this.resizeObserver_=null,this.debouncedHandler_=Ph(()=>{this.resizeHandler()},100,!1,this),i?(this.resizeObserver_=new this.ResizeObserver(this.debouncedHandler_),this.resizeObserver_.observe(e.el())):(this.loadListener_=()=>{if(!this.el_||!this.el_.contentWindow)return;const n=this.debouncedHandler_;let a=this.unloadListener_=function(){St(this,"resize",n),St(this,"unload",a),a=null};qt(this.el_.contentWindow,"unload",a),qt(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()}}ee.registerComponent("ResizeManager",Pv);const Rv={trackingThreshold:20,liveTolerance:15};class Lv extends ee{constructor(e,t){const i=$e(Rv,t,{createEl:!1});super(e,i),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(N.performance.now().toFixed(4)),i=this.lastTime_===-1?0:(t-this.lastTime_)/1e3;this.lastTime_=t,this.pastSeekEnd_=this.pastSeekEnd()+i;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_,Jt),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()}}ee.registerComponent("LiveTracker",Lv);class Nv extends ee{constructor(e,t){super(e,t),this.on("statechanged",i=>this.updateDom_()),this.updateDom_()}createEl(){return this.els={title:xe("div",{className:"vjs-title-bar-title",id:`vjs-title-bar-title-${Qt()}`}),description:xe("div",{className:"vjs-title-bar-description",id:`vjs-title-bar-description-${Qt()}`})},xe("div",{className:"vjs-title-bar"},{},uh(this.els))}updateDom_(){const e=this.player_.tech_,t=e&&e.el_,i={title:"aria-labelledby",description:"aria-describedby"};["title","description"].forEach(s=>{const n=this.state[s],a=this.els[s],o=i[s];na(a),n&&Ki(a,n),t&&(t.removeAttribute(o),n&&t.setAttribute(o,a.id))}),this.state.title||this.state.description?this.show():this.hide()}update(e){this.setState(e)}dispose(){const e=this.player_.tech_,t=e&&e.el_;t&&(t.removeAttribute("aria-labelledby"),t.removeAttribute("aria-describedby")),super.dispose(),this.els=null}}ee.registerComponent("TitleBar",Nv);const Ov={initialDisplay:4e3,position:[],takeFocus:!1};class Bv extends Et{constructor(e,t){t=$e(Ov,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=xe("button",{},{type:"button",class:this.buildCSSClass()},xe("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()}}ee.registerComponent("TransientButton",Bv);const Co=r=>{const e=r.el();if(e.hasAttribute("src"))return r.triggerSourceset(e.src),!0;const t=r.$$("source"),i=[];let s="";if(!t.length)return!1;for(let n=0;n<t.length;n++){const a=t[n].src;a&&i.indexOf(a)===-1&&i.push(a)}return i.length?(i.length===1&&(s=i[0]),r.triggerSourceset(s),!0):!1},Mv=Object.defineProperty({},"innerHTML",{get(){return this.cloneNode(!0).innerHTML},set(r){const e=he.createElement(this.nodeName.toLowerCase());e.innerHTML=r;const t=he.createDocumentFragment();for(;e.childNodes.length;)t.appendChild(e.childNodes[0]);return this.innerText="",N.Element.prototype.appendChild.call(this,t),this.innerHTML}}),vf=(r,e)=>{let t={};for(let i=0;i<r.length&&(t=Object.getOwnPropertyDescriptor(r[i],e),!(t&&t.set&&t.get));i++);return t.enumerable=!0,t.configurable=!0,t},Fv=r=>vf([r.el(),N.HTMLMediaElement.prototype,N.Element.prototype,Mv],"innerHTML"),Hc=function(r){const e=r.el();if(e.resetSourceWatch_)return;const t={},i=Fv(r),s=n=>(...a)=>{const o=n.apply(e,a);return Co(r),o};["append","appendChild","insertAdjacentHTML"].forEach(n=>{e[n]&&(t[n]=e[n],e[n]=s(t[n]))}),Object.defineProperty(e,"innerHTML",$e(i,{set:s(i.set)})),e.resetSourceWatch_=()=>{e.resetSourceWatch_=null,Object.keys(t).forEach(n=>{e[n]=t[n]}),Object.defineProperty(e,"innerHTML",i)},r.one("sourceset",e.resetSourceWatch_)},Uv=Object.defineProperty({},"src",{get(){return this.hasAttribute("src")?jh(N.Element.prototype.getAttribute.call(this,"src")):""},set(r){return N.Element.prototype.setAttribute.call(this,"src",r),r}}),$v=r=>vf([r.el(),N.HTMLMediaElement.prototype,Uv],"src"),jv=function(r){if(!r.featuresSourceset)return;const e=r.el();if(e.resetSourceset_)return;const t=$v(r),i=e.setAttribute,s=e.load;Object.defineProperty(e,"src",$e(t,{set:n=>{const a=t.set.call(e,n);return r.triggerSourceset(e.src),a}})),e.setAttribute=(n,a)=>{const o=i.call(e,n,a);return/src/i.test(n)&&r.triggerSourceset(e.src),o},e.load=()=>{const n=s.call(e);return Co(r)||(r.triggerSourceset(""),Hc(r)),n},e.currentSrc?r.triggerSourceset(e.currentSrc):Co(r)||Hc(r),e.resetSourceset_=()=>{e.resetSourceset_=null,e.load=s,e.setAttribute=i,Object.defineProperty(e,"src",t),e.resetSourceWatch_&&e.resetSourceWatch_()}};class ye extends De{constructor(e,t){super(e,t);const i=e.source;let s=!1;if(this.featuresVideoFrameCallback=this.featuresVideoFrameCallback&&this.el_.tagName==="VIDEO",i&&(this.el_.currentSrc!==i.src||e.tag&&e.tag.initNetworkState_===3)?this.setSource(i):this.handleLateInit_(this.el_),e.enableSourceset&&this.setupSourcesetHandling_(),this.isScrubbing_=!1,this.el_.hasChildNodes()){const n=this.el_.childNodes;let a=n.length;const o=[];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")&&ua(u.src)&&(s=!0)):o.push(u))}for(let u=0;u<o.length;u++)this.el_.removeChild(o[u])}this.proxyNativeTracks_(),this.featuresNativeTextTracks&&s&&Pe.warn(`Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.
|
|
160
|
+
This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNativePlayer_(),(Ds||ea)&&e.nativeControlsForTouch===!0&&this.setControls(!0),this.proxyWebkitFullscreen_(),this.triggerReady()}dispose(){this.el_&&this.el_.resetSourceset_&&this.el_.resetSourceset_(),ye.disposeMediaElement(this.el_),this.options_=null,super.dispose()}setupSourcesetHandling_(){jv(this)}restoreMetadataTracksInIOSNativePlayer_(){const e=this.textTracks();let t;const i=()=>{t=[];for(let n=0;n<e.length;n++){const a=e[n];a.kind==="metadata"&&t.push({track:a,storedMode:a.mode})}};i(),e.addEventListener("change",i),this.on("dispose",()=>e.removeEventListener("change",i));const 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",i),e.removeEventListener("change",s),e.addEventListener("change",s)}),this.on("webkitendfullscreen",()=>{e.removeEventListener("change",i),e.addEventListener("change",i),e.removeEventListener("change",s)})}overrideNative_(e,t){if(t!==this[`featuresNative${e}Tracks`])return;const i=e.toLowerCase();this[`${i}TracksListeners_`]&&Object.keys(this[`${i}TracksListeners_`]).forEach(s=>{this.el()[`${i}Tracks`].removeEventListener(s,this[`${i}TracksListeners_`][s])}),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=Yt[e],i=this.el()[t.getterName],s=this[t.getterName]();if(!this[`featuresNative${t.capitalName}Tracks`]||!i||!i.addEventListener)return;const n={change:o=>{const u={type:"change",target:s,currentTarget:s,srcElement:s};s.trigger(u),e==="text"&&this[$r.remoteText.getterName]().trigger(u)},addtrack(o){s.addTrack(o.track)},removetrack(o){s.removeTrack(o.track)}},a=function(){const o=[];for(let u=0;u<s.length;u++){let d=!1;for(let p=0;p<i.length;p++)if(i[p]===s[u]){d=!0;break}d||o.push(s[u])}for(;o.length;)s.removeTrack(o.shift())};this[t.getterName+"Listeners_"]=n,Object.keys(n).forEach(o=>{const u=n[o];i.addEventListener(o,u),this.on("dispose",d=>i.removeEventListener(o,u))}),this.on("loadstart",a),this.on("dispose",o=>this.off("loadstart",a))}proxyNativeTracks_(){Yt.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),ye.disposeMediaElement(e),e=i}else{e=he.createElement("video");const i=this.options_.tag&&Hi(this.options_.tag),s=$e({},i);(!Ds||this.options_.nativeControlsForTouch!==!0)&&delete s.controls,_h(e,Object.assign(s,{id:this.options_.techId,class:"vjs-tech"}))}e.playerId=this.options_.playerId}typeof this.options_.preload<"u"&&Br(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 s=t[i],n=this.options_[s];typeof n<"u"&&(n?Br(e,s,s):ra(e,s),e[s]=n)}return e}handleLateInit_(e){if(e.networkState===0||e.networkState===3)return;if(e.readyState===0){let i=!1;const s=function(){i=!0};this.on("loadstart",s);const n=function(){i||this.trigger("loadstart")};this.on("loadedmetadata",n),this.ready(function(){this.off("loadstart",s),this.off("loadedmetadata",n),i||this.trigger("loadstart")});return}const t=["loadstart"];t.push("loadedmetadata"),e.readyState>=2&&t.push("loadeddata"),e.readyState>=3&&t.push("canplay"),e.readyState>=4&&t.push("canplaythrough"),this.ready(function(){t.forEach(function(i){this.trigger(i)},this)})}setScrubbing(e){this.isScrubbing_=e}scrubbing(){return this.isScrubbing_}setCurrentTime(e){try{this.isScrubbing_&&this.el_.fastSeek&&ta?this.el_.fastSeek(e):this.el_.currentTime=e}catch(t){Pe(t,"Video is not ready. (Video.js)")}}duration(){if(this.el_.duration===1/0&&ci&&wi&&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)xi(this.el_.play()),this.setTimeout(function(){e.pause();try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}},0);else try{e.webkitEnterFullScreen()}catch(t){this.trigger("fullscreenerror",t)}}exitFullScreen(){if(!this.el_.webkitDisplayingFullscreen){this.trigger("fullscreenerror",new Error("The video is not fullscreen"));return}this.el_.webkitExitFullScreen()}requestPictureInPicture(){return this.el_.requestPictureInPicture()}requestVideoFrameCallback(e){return this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.requestVideoFrameCallback(e):super.requestVideoFrameCallback(e)}cancelVideoFrameCallback(e){this.featuresVideoFrameCallback&&!this.el_.webkitKeys?this.el_.cancelVideoFrameCallback(e):super.cancelVideoFrameCallback(e)}src(e){if(e===void 0)return this.el_.src;this.setSrc(e)}addSourceElement(e,t){if(!e)return Pe.error("Invalid source URL."),!1;const i={src:e};t&&(i.type=t);const s=xe("source",{},i);return this.el_.appendChild(s),!0}removeSourceElement(e){if(!e)return Pe.error("Source URL is required to remove the source element."),!1;const t=this.el_.querySelectorAll("source");for(const i of t)if(i.src===e)return this.el_.removeChild(i),!0;return Pe.warn(`No matching source element found with src: ${e}`),!1}reset(){ye.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=he.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),N.performance&&(e.creationTime=N.performance.now()),e}}Qn(ye,"TEST_VID",function(){if(!jr())return;const r=he.createElement("video"),e=he.createElement("track");return e.kind="captions",e.srclang="en",e.label="English",r.appendChild(e),r});ye.isSupported=function(){try{ye.TEST_VID.volume=.5}catch{return!1}return!!(ye.TEST_VID&&ye.TEST_VID.canPlayType)};ye.canPlayType=function(r){return ye.TEST_VID.canPlayType(r)};ye.canPlaySource=function(r,e){return ye.canPlayType(r.type)};ye.canControlVolume=function(){try{const r=ye.TEST_VID.volume;ye.TEST_VID.volume=r/2+.1;const e=r!==ye.TEST_VID.volume;return e&&xt?(N.setTimeout(()=>{ye&&ye.prototype&&(ye.prototype.featuresVolumeControl=r!==ye.TEST_VID.volume)}),!1):e}catch{return!1}};ye.canMuteVolume=function(){try{const r=ye.TEST_VID.muted;return ye.TEST_VID.muted=!r,ye.TEST_VID.muted?Br(ye.TEST_VID,"muted","muted"):ra(ye.TEST_VID,"muted","muted"),r!==ye.TEST_VID.muted}catch{return!1}};ye.canControlPlaybackRate=function(){if(ci&&wi&&Jn<58)return!1;try{const r=ye.TEST_VID.playbackRate;return ye.TEST_VID.playbackRate=r/2+.1,r!==ye.TEST_VID.playbackRate}catch{return!1}};ye.canOverrideAttributes=function(){try{const r=()=>{};Object.defineProperty(he.createElement("video"),"src",{get:r,set:r}),Object.defineProperty(he.createElement("audio"),"src",{get:r,set:r}),Object.defineProperty(he.createElement("video"),"innerHTML",{get:r,set:r}),Object.defineProperty(he.createElement("audio"),"innerHTML",{get:r,set:r})}catch{return!1}return!0};ye.supportsNativeTextTracks=function(){return ta||xt&&wi};ye.supportsNativeVideoTracks=function(){return!!(ye.TEST_VID&&ye.TEST_VID.videoTracks)};ye.supportsNativeAudioTracks=function(){return!!(ye.TEST_VID&&ye.TEST_VID.audioTracks)};ye.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([r,e]){Qn(ye.prototype,r,()=>ye[e](),!0)});ye.prototype.featuresVolumeControl=ye.canControlVolume();ye.prototype.movingMediaElementInDOM=!xt;ye.prototype.featuresFullscreenResize=!0;ye.prototype.featuresProgressEvents=!0;ye.prototype.featuresTimeupdateEvents=!0;ye.prototype.featuresVideoFrameCallback=!!(ye.TEST_VID&&ye.TEST_VID.requestVideoFrameCallback);ye.disposeMediaElement=function(r){if(r){for(r.parentNode&&r.parentNode.removeChild(r);r.hasChildNodes();)r.removeChild(r.firstChild);r.removeAttribute("src"),typeof r.load=="function"&&(function(){try{r.load()}catch{}})()}};ye.resetMediaElement=function(r){if(!r)return;const e=r.querySelectorAll("source");let t=e.length;for(;t--;)r.removeChild(e[t]);r.removeAttribute("src"),typeof r.load=="function"&&(function(){try{r.load()}catch{}})()};["muted","defaultMuted","autoplay","controls","loop","playsinline"].forEach(function(r){ye.prototype[r]=function(){return this.el_[r]||this.el_.hasAttribute(r)}});["muted","defaultMuted","autoplay","loop","playsinline"].forEach(function(r){ye.prototype["set"+nt(r)]=function(e){this.el_[r]=e,e?this.el_.setAttribute(r,r):this.el_.removeAttribute(r)}});["paused","currentTime","buffered","volume","poster","preload","error","seeking","seekable","ended","playbackRate","defaultPlaybackRate","disablePictureInPicture","played","networkState","readyState","videoWidth","videoHeight","crossOrigin"].forEach(function(r){ye.prototype[r]=function(){return this.el_[r]}});["volume","src","poster","preload","playbackRate","defaultPlaybackRate","disablePictureInPicture","crossOrigin"].forEach(function(r){ye.prototype["set"+nt(r)]=function(e){this.el_[r]=e}});["pause","load","play"].forEach(function(r){ye.prototype[r]=function(){return this.el_[r]()}});De.withSourceHandlers(ye);ye.nativeSourceHandler={};ye.nativeSourceHandler.canPlayType=function(r){try{return ye.TEST_VID.canPlayType(r)}catch{return""}};ye.nativeSourceHandler.canHandleSource=function(r,e){if(r.type)return ye.nativeSourceHandler.canPlayType(r.type);if(r.src){const t=nl(r.src);return ye.nativeSourceHandler.canPlayType(`video/${t}`)}return""};ye.nativeSourceHandler.handleSource=function(r,e,t){e.setSrc(r.src)};ye.nativeSourceHandler.dispose=function(){};ye.registerSourceHandler(ye.nativeSourceHandler);De.registerTech("Html5",ye);const bf=["progress","abort","suspend","emptied","stalled","loadedmetadata","loadeddata","timeupdate","resize","volumechange","texttrackchange"],no={canplay:"CanPlay",canplaythrough:"CanPlayThrough",playing:"Playing",seeked:"Seeked"},Ao=["tiny","xsmall","small","medium","large","xlarge","huge"],_n={};Ao.forEach(r=>{const e=r.charAt(0)==="x"?`x-${r.substring(1)}`:r;_n[r]=`vjs-layout-${e}`});const qv={tiny:210,xsmall:320,small:425,medium:768,large:1440,xlarge:2560,huge:1/0};class Ye extends ee{constructor(e,t,i){if(e.id=e.id||t.id||`vjs_video_${Qt()}`,t=Object.assign(Ye.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=ah(this.id_),this.fsApi_=xn,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&&Hi(e),this.language(this.options_.language),t.languages){const a={};Object.getOwnPropertyNames(t.languages).forEach(function(o){a[o.toLowerCase()]=t.languages[o]}),this.languages_=a}else this.languages_=Ye.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(),tl(this,{eventBusKey:"el_"}),this.fsApi_.requestFullscreen&&(qt(he,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),this.on(this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_)),this.fluid_&&this.on(["playerreset","resize"],this.boundUpdateStyleEl_);const s=$e(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 o=new N.DOMParser().parseFromString(dv,"image/svg+xml");if(o.querySelector("parsererror"))Pe.warn("Failed to load SVG Icons. Falling back to Font Icons."),this.options_.experimentalSvgIcons=null;else{const d=o.documentElement;d.style.display="none",this.el_.appendChild(d),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 hv(this),this.addClass("vjs-spatial-navigation-enabled")),Ds&&this.addClass("vjs-touch-enabled"),xt||this.addClass("vjs-workinghover"),Ye.players[this.id_]=this;const n=go.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"),St(he,this.fsApi_.fullscreenchange,this.boundDocumentFullscreenChange_),St(he,"keydown",this.boundFullWindowOnEscKey_),this.styleEl_&&this.styleEl_.parentNode&&(this.styleEl_.parentNode.removeChild(this.styleEl_),this.styleEl_=null),Ye.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),ov(this),kt.names.forEach(e=>{const t=kt[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 s=this.tag.tagName.toLowerCase()==="video-js";i?t=this.el_=e.parentNode:s||(t=this.el_=super.createEl("div"));const n=Hi(e);if(s){for(t=this.el_=e,e=this.tag=he.createElement("video");t.children.length;)e.appendChild(t.firstChild);bs(t,"video-js")||or(t,"video-js"),t.appendChild(e),i=this.playerElIngest_=t,Object.keys(t).forEach(u=>{try{e[u]=t[u]}catch{}})}e.setAttribute("tabindex","-1"),n.tabindex="-1",wi&&Zn&&(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=>ph[u]).map(u=>"vjs-device-"+u.substring(3).toLowerCase().replace(/\_/g,"-"));if(this.addClass(...a),N.VIDEOJS_NO_DYNAMIC_STYLE!==!0){this.styleEl_=Ih("vjs-styles-dimensions");const u=Gi(".vjs-styles-defaults"),d=Gi("head");d.insertBefore(this.styleEl_,u?u.nextSibling:d.firstChild)}this.fill_=!1,this.fluid_=!1,this.width(this.options_.width),this.height(this.options_.height),this.fill(this.options_.fill),this.fluid(this.options_.fluid),this.aspectRatio(this.options_.aspectRatio),this.crossOrigin(this.options_.crossOrigin||this.options_.crossorigin);const o=e.getElementsByTagName("a");for(let u=0;u<o.length;u++){const d=o.item(u);or(d,"vjs-hidden"),d.setAttribute("hidden","hidden")}return e.initNetworkState_=e.networkState,e.parentNode&&!i&&e.parentNode.insertBefore(t,e),_o(e,t),this.children_.unshift(e),this.el_.setAttribute("lang",this.language_),this.el_.setAttribute("translate","no"),this.el_=t,t}crossOrigin(e){if(typeof e>"u")return this.techGet_("crossOrigin");if(e!==null&&e!=="anonymous"&&e!=="use-credentials"){Pe.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${e}"`);return}this.techCall_("setCrossOrigin",e),this.posterImage&&this.posterImage.crossOrigin(e)}width(e){return this.dimension("width",e)}height(e){return this.dimension("height",e)}dimension(e,t){const i=e+"_";if(t===void 0)return this[i]||0;if(t===""||t==="auto"){this[i]=void 0,this.updateStyleEl_();return}const s=parseFloat(t);if(isNaN(s)){Pe.error(`Improper value "${t}" supplied for for ${e}`);return}this[i]=s,this.updateStyleEl_()}fluid(e){if(e===void 0)return!!this.fluid_;this.fluid_=!!e,Oi(this)&&this.off(["playerreset","resize"],this.boundUpdateStyleEl_),e?(this.addClass("vjs-fluid"),this.fill(!1),MT(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(N.VIDEOJS_NO_DYNAMIC_STYLE===!0){const o=typeof this.width_=="number"?this.width_:this.options_.width,u=typeof this.height_=="number"?this.height_:this.options_.height,d=this.tech_&&this.tech_.el();d&&(o>=0&&(d.width=o),u>=0&&(d.height=u));return}let e,t,i,s;this.aspectRatio_!==void 0&&this.aspectRatio_!=="auto"?i=this.aspectRatio_:this.videoWidth()>0?i=this.videoWidth()+":"+this.videoHeight():i="16:9";const n=i.split(":"),a=n[1]/n[0];this.width_!==void 0?e=this.width_:this.height_!==void 0?e=this.height_/a:e=this.videoWidth()||300,this.height_!==void 0?t=this.height_:t=e*a,/^[^a-zA-Z]/.test(this.id())?s="dimensions-"+this.id():s=this.id()+"-dimensions",this.addClass(s),kh(this.styleEl_,`
|
|
172
161
|
.${s} {
|
|
173
162
|
width: ${e}px;
|
|
174
163
|
height: ${t}px;
|
|
@@ -177,9 +166,9 @@ This may prevent text tracks from loading.`),this.restoreMetadataTracksInIOSNati
|
|
|
177
166
|
.${s}.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
178
167
|
padding-top: ${a*100}%;
|
|
179
168
|
}
|
|
180
|
-
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const
|
|
169
|
+
`)}loadTech_(e,t){this.tech_&&this.unloadTech_();const i=nt(e),s=e.charAt(0).toLowerCase()+e.slice(1);i!=="Html5"&&this.tag&&(De.getTech("Html5").disposeMediaElement(this.tag),this.tag.player=null,this.tag=null),this.techName_=i,this.isReady_=!1;let n=this.autoplay();(typeof this.autoplay()=="string"||this.autoplay()===!0&&this.options_.normalizeAutoplay)&&(n=!1);const a={source:t,autoplay:n,nativeControlsForTouch:this.options_.nativeControlsForTouch,playerId:this.id(),techId:`${this.id()}_${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};kt.names.forEach(u=>{const d=kt[u];a[d.getterName]=this[d.privateName]}),Object.assign(a,this.options_[i]),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 o=De.getTech(e);if(!o)throw new Error(`No Tech named '${i}' exists! '${i}' should be registered using videojs.registerTech()'`);this.tech_=new o(a),this.tech_.ready(Ge(this,this.handleTechReady_),!0),Sc.jsonToTextTracks(this.textTracksJson_||[],this.tech_),bf.forEach(u=>{this.on(this.tech_,u,d=>this[`handleTech${nt(u)}_`](d))}),Object.keys(no).forEach(u=>{this.on(this.tech_,u,d=>{if(this.tech_.playbackRate()===0&&this.tech_.seeking()){this.queuedCallbacks_.push({callback:this[`handleTech${no[u]}_`].bind(this),event:d});return}this[`handleTech${no[u]}_`](d)})}),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,d)=>this.handleTechFullscreenChange_(u,d)),this.on(this.tech_,"fullscreenerror",(u,d)=>this.handleTechFullscreenError_(u,d)),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()&&(i!=="Html5"||!this.tag)&&_o(this.tech_.el(),this.el()),this.tag&&(this.tag.player=null,this.tag=null)}unloadTech_(){kt.names.forEach(e=>{const t=kt[e];this[t.privateName]=this[t.getterName]()}),this.textTracksJson_=Sc.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&&Pe.warn(`Using the tech directly can be dangerous. I hope you know what you're doing.
|
|
181
170
|
See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
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,`
|
|
171
|
+
`),this.tech_}version(){return{"video.js":go}}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(Ss(a))return a.catch(o=>{throw n(),new Error(`Rejection at manualAutoplay. Restoring muted value. ${o||""}`)})};let i;if(e==="any"&&!this.muted()?(i=this.play(),Ss(i)&&(i=i.catch(t))):e==="muted"&&!this.muted()?i=t():i=this.play(),!!Ss(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=cv(this,t)),this.cache_.source=$e({},e,{src:t,type:i});const s=this.cache_.sources.filter(u=>u.src&&u.src===t),n=[],a=this.$$("source"),o=[];for(let u=0;u<a.length;u++){const d=Hi(a[u]);n.push(d),d.src&&d.src===t&&o.push(d.src)}o.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 i=this.currentSource().src,s=e.src;i&&!/^blob:/.test(i)&&/^blob:/.test(s)&&(!this.lastSource_||this.lastSource_.tech!==s&&this.lastSource_.player!==i)&&(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()?xi(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()&&!he.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 s=he[this.fsApi_.fullscreenElement]===i;!s&&i.matches&&(s=i.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 nv)return rv(this.middleware_,this.tech_,e,t);if(e in Dc)return wc(this.middleware_,this.tech_,e,t);try{this.tech_&&this.tech_[e](t)}catch(i){throw Pe(i),i}},!0)}techGet_(e){if(!(!this.tech_||!this.tech_.isReady_)){if(e in sv)return iv(this.middleware_,this.tech_,e);if(e in Dc)return wc(this.middleware_,this.tech_,e);try{return this.tech_[e]()}catch(t){throw this.tech_[e]===void 0?(Pe(`Video.js: ${e} method not defined for ${this.techName_} playback technology.`,t),t):t.name==="TypeError"?(Pe(`Video.js: ${e} unavailable on ${this.techName_} playback technology element.`,t),this.tech_.isReady_=!1,t):(Pe(t),t)}}}play(){return new Promise(e=>{this.play_(e)})}play_(e=xi){this.playCallbacks_.push(e);const t=!!(!this.changingSrc_&&(this.src()||this.currentSrc())),i=!!(ta||xt);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 s=this.techGet_("play");i&&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(i){i(e)})}pause(){this.techCall_("pause")}paused(){return this.techGet_("paused")!==!1}played(){return this.techGet_("played")||li(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=li(0,0)),e}seekable(){let e=this.techGet_("seekable");return(!e||!e.length)&&(e=li(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 Uh(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,s)=>{function n(){t.off("fullscreenerror",o),t.off("fullscreenchange",a)}function a(){n(),i()}function o(d,p){n(),s(p)}t.one("fullscreenchange",a),t.one("fullscreenerror",o);const u=t.requestFullscreenHelper_(e);u&&(u.then(n,n),u.then(i,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 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 s(){e.off("fullscreenerror",a),e.off("fullscreenchange",n)}function n(){s(),t()}function a(u,d){s(),i(d)}e.one("fullscreenchange",n),e.one("fullscreenerror",a);const o=e.exitFullscreenHelper_();o&&(o.then(s,s),o.then(t,i))})}exitFullscreenHelper_(){if(this.fsApi_.requestFullscreen){const e=he[this.fsApi_.exitFullscreen]();return e&&xi(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=he.documentElement.style.overflow,qt(he,"keydown",this.boundFullWindowOnEscKey_),he.documentElement.style.overflow="hidden",or(he.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,St(he,"keydown",this.boundFullWindowOnEscKey_),he.documentElement.style.overflow=this.docOrigOverflow,ia(he.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&&N.documentPictureInPicture){const e=he.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(xe("p",{className:"vjs-pip-text"},{},this.localize("Playing in picture-in-picture"))),N.documentPictureInPicture.requestWindow({width:this.videoWidth(),height:this.videoHeight()}).then(t=>(Ah(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 s=i.target.querySelector(".video-js");e.parentNode.replaceChild(s,e),this.player_.isInPictureInPicture(!1),this.player_.trigger("leavepictureinpicture")}),t))}return"pictureInPictureEnabled"in he&&this.disablePictureInPicture()===!1?this.techGet_("requestPictureInPicture"):Promise.reject("No PiP mode is available")}exitPictureInPicture(){if(N.documentPictureInPicture&&N.documentPictureInPicture.window)return N.documentPictureInPicture.window.close(),Promise.resolve();if("pictureInPictureEnabled"in he)return he.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:i=a=>e.key.toLowerCase()==="f",muteKey:s=a=>e.key.toLowerCase()==="m",playPauseKey:n=a=>e.key.toLowerCase()==="k"||e.key.toLowerCase()===" "}=t;if(i.call(this,e)){e.preventDefault(),e.stopPropagation();const a=ee.getComponent("FullscreenToggle");he[this.fsApi_.fullscreenEnabled]!==!1&&a.prototype.handleClick.call(this,e)}else s.call(this,e)?(e.preventDefault(),e.stopPropagation(),ee.getComponent("MuteToggle").prototype.handleClick.call(this,e)):n.call(this,e)&&(e.preventDefault(),e.stopPropagation(),ee.getComponent("PlayToggle").prototype.handleClick.call(this,e))}canPlayType(e){let t;for(let i=0,s=this.options_.techOrder;i<s.length;i++){const n=s[i];let a=De.getTech(n);if(a||(a=ee.getComponent(n)),!a){Pe.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(o=>[o,De.getTech(o)]).filter(([o,u])=>u?u.isSupported():(Pe.error(`The "${o}" tech is undefined. Skipped browser support check for that tech.`),!1)),i=function(o,u,d){let p;return o.some(T=>u.some(A=>{if(p=d(T,A),p)return!0})),p};let s;const n=o=>(u,d)=>o(d,u),a=([o,u],d)=>{if(u.canPlaySource(d,this.options_[o.toLowerCase()]))return{source:d,tech:o}};return this.options_.sourceOrder?s=i(e,t,n(a)):s=i(t,e,a),s||!1}handleSrc_(e,t){if(typeof e>"u")return this.cache_.src||"";this.resetRetryOnError_&&this.resetRetryOnError_();const i=Hh(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]),ev(this,i[0],(s,n)=>{if(this.middleware_=n,t||(this.cache_.sources=i),this.updateSourceCaches_(s),this.src_(s)){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}tv(n,this.tech_)}),i.length>1){const s=()=>{this.error(null),this.handleSrc_(i.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?Oh(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();xi(e.then(()=>this.doReset_()))}}doReset_(){this.tech_&&this.tech_.clearTracks("text"),this.removeClass("vjs-playing"),this.addClass("vjs-paused"),this.resetCache_(),this.poster(""),this.loadTech_(this.options_.techOrder[0],null),this.techCall_("reset"),this.resetControlBarUI_(),this.error(null),this.titleBar&&this.titleBar.update({title:void 0,description:void 0}),Oi(this)&&this.trigger("playerreset")}resetControlBarUI_(){this.resetProgressBar_(),this.resetPlaybackRate_(),this.resetVolumeBar_()}resetProgressBar_(){this.currentTime(0);const{currentTimeDisplay:e,durationDisplay:t,progressControl:i,remainingTimeDisplay:s}=this.controlBar||{},{seekBar:n}=i||{};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(Wi("beforeerror").forEach(t=>{const i=t(this,e);if(!(Ai(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 rt(e),this.addClass("vjs-error"),Pe.error(`(CODE:${this.error_.code} ${rt.errorTypes[this.error_.code]})`,this.error_.message,this.error_),this.trigger("error"),Wi("error").forEach(t=>t(this,this.error_))}reportUserActivity(e){this.userActivity_=!0}userActive(e){if(e===void 0)return this.userActive_;if(e=!!e,e!==this.userActive_){if(this.userActive_=e,this.userActive_){this.userActivity_=!0,this.removeClass("vjs-user-inactive"),this.addClass("vjs-user-active"),this.trigger("useractive");return}this.tech_&&this.tech_.one("mousemove",function(t){t.stopPropagation(),t.preventDefault()}),this.userActivity_=!1,this.removeClass("vjs-user-active"),this.addClass("vjs-user-inactive"),this.trigger("userinactive")}}listenForUserActivity_(){let e,t,i;const s=Ge(this,this.reportUserActivity),n=function(T){(T.screenX!==t||T.screenY!==i)&&(t=T.screenX,i=T.screenY,s())},a=function(){s(),this.clearInterval(e),e=this.setInterval(s,250)},o=function(T){s(),this.clearInterval(e)};this.on("mousedown",a),this.on("mousemove",n),this.on("mouseup",o),this.on("mouseleave",o);const u=this.getChild("controlBar");u&&!xt&&!ci&&(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 d;const p=function(){if(!this.userActivity_)return;this.userActivity_=!1,this.userActive(!0),this.clearTimeout(d);const T=this.options_.inactivityTimeout;T<=0||(d=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"),i=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=i,this.on("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.height(i),this.trigger("audioonlymodechange")}disableAudioOnlyUI_(){this.removeClass("vjs-audio-only-mode"),this.off("playerresize",this.boundUpdatePlayerHeightOnAudioOnlyMode_),this.audioOnlyCache_.hiddenChildren.forEach(e=>e.show()),this.height(this.audioOnlyCache_.playerHeight),this.trigger("audioonlymodechange")}audioOnlyMode(e){if(typeof e!="boolean"||e===this.audioOnlyMode_)return this.audioOnlyMode_;if(this.audioOnlyMode_=e,e){const t=[];return this.isInPictureInPicture()&&t.push(this.exitPictureInPicture()),this.isFullscreen()&&t.push(this.exitFullscreen()),this.audioPosterMode()&&t.push(this.audioPosterMode(!1)),Promise.all(t).then(()=>this.enableAudioOnlyUI_())}return Promise.resolve().then(()=>this.disableAudioOnlyUI_())}enablePosterModeUI_(){(this.tech_&&this.tech_).hide(),this.addClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}disablePosterModeUI_(){(this.tech_&&this.tech_).show(),this.removeClass("vjs-audio-poster-mode"),this.trigger("audiopostermodechange")}audioPosterMode(e){return typeof e!="boolean"||e===this.audioPosterMode_?this.audioPosterMode_:(this.audioPosterMode_=e,e?this.audioOnlyMode()?this.audioOnlyMode(!1).then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.enablePosterModeUI_()}):Promise.resolve().then(()=>{this.disablePosterModeUI_()}))}addTextTrack(e,t,i){if(this.tech_)return this.tech_.addTextTrack(e,t,i)}addRemoteTextTrack(e,t){if(this.tech_)return this.tech_.addRemoteTextTrack(e,t)}removeRemoteTextTrack(e={}){let{track:t}=e;if(t||(t=e),this.tech_)return this.tech_.removeRemoteTextTrack(t)}getVideoPlaybackQuality(){return this.techGet_("getVideoPlaybackQuality")}videoWidth(){return this.tech_&&this.tech_.videoWidth&&this.tech_.videoWidth()||0}videoHeight(){return this.tech_&&this.tech_.videoHeight&&this.tech_.videoHeight()||0}language(e){if(e===void 0)return this.language_;this.language_!==String(e).toLowerCase()&&(this.language_=String(e).toLowerCase(),Oi(this)&&this.trigger("languagechange"))}languages(){return $e(Ye.prototype.options_.languages,this.languages_)}toJSON(){const e=$e(this.options_),t=e.tracks;e.tracks=[];for(let i=0;i<t.length;i++){let s=t[i];s=$e(s),s.player=void 0,e.tracks[i]=s}return e}createModal(e,t){t=t||{},t.content=e||"";const i=new Hr(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<Ao.length;i++){const s=Ao[i],n=this.breakpoints_[s];if(t<=n){if(e===s)return;e&&this.removeClass(_n[e]),this.addClass(_n[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({},qv,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 _n[this.breakpoint_]||""}loadMedia(e,t){if(!e||typeof e!="object")return;const i=this.crossOrigin();this.reset(),this.cache_.media=$e(e);const{artist:s,artwork:n,description:a,poster:o,src:u,textTracks:d,title:p}=this.cache_.media;!n&&o&&(this.cache_.media.artwork=[{src:o,type:Rn(o)}]),i&&this.crossOrigin(i),u&&this.src(u),o&&this.poster(o),Array.isArray(d)&&d.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(),i=Array.prototype.map.call(this.remoteTextTracks(),n=>({kind:n.kind,label:n.label,language:n.language,src:n.src})),s={src:t,textTracks:i};return e&&(s.poster=e,s.artwork=[{src:s.poster,type:Rn(s.poster)}]),s}return $e(this.cache_.media)}static getTagSettings(e){const t={sources:[],tracks:[]},i=Hi(e),s=i["data-setup"];if(bs(e,"vjs-fill")&&(i.fill=!0),bs(e,"vjs-fluid")&&(i.fluid=!0),s!==null)try{Object.assign(i,JSON.parse(s||"{}"))}catch(n){Pe.error("data-setup",n)}if(Object.assign(t,i),e.hasChildNodes()){const n=e.childNodes;for(let a=0,o=n.length;a<o;a++){const u=n[a],d=u.nodeName.toLowerCase();d==="source"?t.sources.push(Hi(u)):d==="track"&&t.tracks.push(Hi(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"))}}kt.names.forEach(function(r){const e=kt[r];Ye.prototype[e.getterName]=function(){return this.tech_?this.tech_[e.getterName]():(this[e.privateName]=this[e.privateName]||new e.ListClass,this[e.privateName])}});Ye.prototype.crossorigin=Ye.prototype.crossOrigin;Ye.players={};const ps=N.navigator;Ye.prototype.options_={techOrder:De.defaultTechOrder_,html5:{},enableSourceset:!0,inactivityTimeout:2e3,playbackRates:[],liveui:!1,children:["mediaLoader","posterImage","titleBar","textTrackDisplay","loadingSpinner","bigPlayButton","liveTracker","controlBar","errorDisplay","textTrackSettings","resizeManager"],language: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};bf.forEach(function(r){Ye.prototype[`handleTech${nt(r)}_`]=function(){return this.trigger(r)}});ee.registerComponent("Player",Ye);const Ln="plugin",Ar="activePlugins_",vr={},Nn=r=>vr.hasOwnProperty(r),Tn=r=>Nn(r)?vr[r]:void 0,xf=(r,e)=>{r[Ar]=r[Ar]||{},r[Ar][e]=!0},On=(r,e,t)=>{const i=(t?"before":"")+"pluginsetup";r.trigger(i,e),r.trigger(i+":"+e.name,e)},Vv=function(r,e){const t=function(){On(this,{name:r,plugin:e,instance:null},!0);const i=e.apply(this,arguments);return xf(this,r),On(this,{name:r,plugin:e,instance:i}),i};return Object.keys(e).forEach(function(i){t[i]=e[i]}),t},zc=(r,e)=>(e.prototype.name=r,function(...t){On(this,{name:r,plugin:e,instance:null},!0);const i=new e(this,...t);return this[r]=()=>i,On(this,i.getEventHash()),i});class Mt{constructor(e){if(this.constructor===Mt)throw new Error("Plugin must be sub-classed; not directly instantiated.");this.player=e,this.log||(this.log=this.player.log.createLogger(this.name)),tl(this),delete this.trigger,Nh(this,this.constructor.defaultState),xf(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 Vr(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[Ar][e]=!1,this.player=this.state=null,t[e]=zc(e,vr[e])}static isBasic(e){const t=typeof e=="string"?Tn(e):e;return typeof t=="function"&&!Mt.prototype.isPrototypeOf(t.prototype)}static registerPlugin(e,t){if(typeof e!="string")throw new Error(`Illegal plugin name, "${e}", must be a string, was ${typeof e}.`);if(Nn(e))Pe.warn(`A plugin named "${e}" already exists. You may want to avoid re-registering plugins!`);else if(Ye.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 vr[e]=t,e!==Ln&&(Mt.isBasic(t)?Ye.prototype[e]=Vv(e,t):Ye.prototype[e]=zc(e,t)),t}static deregisterPlugin(e){if(e===Ln)throw new Error("Cannot de-register base plugin.");Nn(e)&&(delete vr[e],delete Ye.prototype[e])}static getPlugins(e=Object.keys(vr)){let t;return e.forEach(i=>{const s=Tn(i);s&&(t=t||{},t[i]=s)}),t}static getPluginVersion(e){const t=Tn(e);return t&&t.VERSION||""}}Mt.getPlugin=Tn;Mt.BASE_PLUGIN_NAME=Ln;Mt.registerPlugin(Ln,Mt);Ye.prototype.usingPlugin=function(r){return!!this[Ar]&&this[Ar][r]===!0};Ye.prototype.hasPlugin=function(r){return!!Nn(r)};function Hv(r,e){let t=!1;return function(...i){return t||Pe.warn(r),t=!0,e.apply(this,i)}}function di(r,e,t,i){return Hv(`${e} is deprecated and will be removed in ${r}.0; please use ${t} instead.`,i)}var zv={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 Sf=r=>r.indexOf("#")===0?r.slice(1):r;function z(r,e,t){let i=z.getPlayer(r);if(i)return e&&Pe.warn(`Player "${r}" is already initialised. Options will not be applied.`),t&&i.ready(t),i;const s=typeof r=="string"?Gi("#"+Sf(r)):r;if(!qr(s))throw new TypeError("The element or ID supplied is not valid. (videojs)");const a=("getRootNode"in s?s.getRootNode()instanceof N.ShadowRoot:!1)?s.getRootNode():s.ownerDocument.body;(!s.ownerDocument.defaultView||!a.contains(s))&&Pe.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)),Wi("beforesetup").forEach(u=>{const d=u(s,$e(e));if(!Ai(d)||Array.isArray(d)){Pe.error("please return an object in beforesetup hooks");return}e=$e(e,d)});const o=ee.getComponent("Player");return i=new o(s,e,t),Wi("setup").forEach(u=>u(i)),i}z.hooks_=Li;z.hooks=Wi;z.hook=ST;z.hookOnce=ET;z.removeHook=nh;if(N.VIDEOJS_NO_DYNAMIC_STYLE!==!0&&jr()){let r=Gi(".vjs-styles-defaults");if(!r){r=Ih("vjs-styles-defaults");const e=Gi("head");e&&e.insertBefore(r,e.firstChild),kh(r,`
|
|
183
172
|
.video-js {
|
|
184
173
|
width: 300px;
|
|
185
174
|
height: 150px;
|
|
@@ -188,36 +177,27 @@ See https://github.com/videojs/video.js/issues/2617 for more info.
|
|
|
188
177
|
.vjs-fluid:not(.vjs-audio-only-mode) {
|
|
189
178
|
padding-top: 56.25%
|
|
190
179
|
}
|
|
191
|
-
`)}}
|
|
192
|
-
`;for(let t=0;t<
|
|
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()};
|
|
180
|
+
`)}}vo(1,z);z.VERSION=go;z.options=Ye.prototype.options_;z.getPlayers=()=>Ye.players;z.getPlayer=r=>{const e=Ye.players;let t;if(typeof r=="string"){const i=Sf(r),s=e[i];if(s)return s;t=Gi("#"+i)}else t=r;if(qr(t)){const{player:i,playerId:s}=t;if(i||e[s])return i||e[s]}};z.getAllPlayers=()=>Object.keys(Ye.players).map(r=>Ye.players[r]).filter(Boolean);z.players=Ye.players;z.getComponent=ee.getComponent;z.registerComponent=(r,e)=>(De.isTech(e)&&Pe.warn(`The ${r} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`),ee.registerComponent.call(ee,r,e));z.getTech=De.getTech;z.registerTech=De.registerTech;z.use=ZT;Object.defineProperty(z,"middleware",{value:{},writeable:!1,enumerable:!0});Object.defineProperty(z.middleware,"TERMINATOR",{value:Pn,writeable:!1,enumerable:!0});z.browser=ph;z.obj=wT;z.mergeOptions=di(9,"videojs.mergeOptions","videojs.obj.merge",$e);z.defineLazyProperty=di(9,"videojs.defineLazyProperty","videojs.obj.defineLazyProperty",Qn);z.bind=di(9,"videojs.bind","native Function.prototype.bind",Ge);z.registerPlugin=Mt.registerPlugin;z.deregisterPlugin=Mt.deregisterPlugin;z.plugin=(r,e)=>(Pe.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead"),Mt.registerPlugin(r,e));z.getPlugins=Mt.getPlugins;z.getPlugin=Mt.getPlugin;z.getPluginVersion=Mt.getPluginVersion;z.addLanguage=function(r,e){return r=(""+r).toLowerCase(),z.options.languages=$e(z.options.languages,{[r]:e}),z.options.languages[r]};z.log=Pe;z.createLogger=ah;z.time=qT;z.createTimeRange=di(9,"videojs.createTimeRange","videojs.time.createTimeRanges",li);z.createTimeRanges=di(9,"videojs.createTimeRanges","videojs.time.createTimeRanges",li);z.formatTime=di(9,"videojs.formatTime","videojs.time.formatTime",dr);z.setFormatTime=di(9,"videojs.setFormatTime","videojs.time.setFormatTime",Mh);z.resetFormatTime=di(9,"videojs.resetFormatTime","videojs.time.resetFormatTime",Fh);z.parseUrl=di(9,"videojs.parseUrl","videojs.url.parseUrl",sl);z.isCrossOrigin=di(9,"videojs.isCrossOrigin","videojs.url.isCrossOrigin",ua);z.EventTarget=Vt;z.any=el;z.on=qt;z.one=oa;z.off=St;z.trigger=Vr;z.xhr=qd;z.TextTrack=Rs;z.AudioTrack=qh;z.VideoTrack=Vh;["isEl","isTextNode","createEl","hasClass","addClass","removeClass","toggleClass","setAttributes","getAttributes","emptyEl","appendContent","insertContent"].forEach(r=>{z[r]=function(){return Pe.warn(`videojs.${r}() is deprecated; use videojs.dom.${r}() instead`),wh[r].apply(null,arguments)}});z.computedStyle=di(9,"videojs.computedStyle","videojs.dom.computedStyle",Fr);z.dom=wh;z.fn=BT;z.num=vv;z.str=$T;z.url=QT;z.Error=zv;class Wv{constructor(e){let t=this;return t.id=e.id,t.label=t.id,t.width=e.width,t.height=e.height,t.bitrate=e.bandwidth,t.frameRate=e.frameRate,t.enabled_=e.enabled,Object.defineProperty(t,"enabled",{get(){return t.enabled_()},set(i){t.enabled_(i)}}),t}}class Bn extends z.EventTarget{constructor(){super();let e=this;return e.levels_=[],e.selectedIndex_=-1,Object.defineProperty(e,"selectedIndex",{get(){return e.selectedIndex_}}),Object.defineProperty(e,"length",{get(){return e.levels_.length}}),e[Symbol.iterator]=()=>e.levels_.values(),e}addQualityLevel(e){let t=this.getQualityLevelById(e.id);if(t)return t;const i=this.levels_.length;return t=new Wv(e),""+i in this||Object.defineProperty(this,i,{get(){return this.levels_[i]}}),this.levels_.push(t),this.trigger({qualityLevel:t,type:"addqualitylevel"}),t}removeQualityLevel(e){let t=null;for(let i=0,s=this.length;i<s;i++)if(this[i]===e){t=this.levels_.splice(i,1)[0],this.selectedIndex_===i?this.selectedIndex_=-1:this.selectedIndex_>i&&this.selectedIndex_--;break}return t&&this.trigger({qualityLevel:e,type:"removequalitylevel"}),t}getQualityLevelById(e){for(let t=0,i=this.length;t<i;t++){const s=this[t];if(s.id===e)return s}return null}dispose(){this.selectedIndex_=-1,this.levels_.length=0}}Bn.prototype.allowedEvents_={change:"change",addqualitylevel:"addqualitylevel",removequalitylevel:"removequalitylevel"};for(const r in Bn.prototype.allowedEvents_)Bn.prototype["on"+r]=null;var Ef="4.1.0";const Gv=function(r,e){const t=r.qualityLevels,i=new Bn,s=function(){i.dispose(),r.qualityLevels=t,r.off("dispose",s)};return r.on("dispose",s),r.qualityLevels=()=>i,r.qualityLevels.VERSION=Ef,i},Cf=function(r){return Gv(this,z.obj.merge({},r))};z.registerPlugin("qualityLevels",Cf);Cf.VERSION=Ef;const Ot=Wn,Mn=(r,e)=>e&&e.responseURL&&r!==e.responseURL?e.responseURL:r,Zt=r=>z.log.debug?z.log.debug.bind(z,"VHS:",`${r} >`):function(){};function Oe(...r){const e=z.obj||z;return(e.merge||e.mergeOptions).apply(e,r)}function _t(...r){const e=z.time||z;return(e.createTimeRanges||e.createTimeRanges).apply(e,r)}function Kv(r){if(r.length===0)return"Buffered Ranges are empty";let e=`Buffered Ranges:
|
|
181
|
+
`;for(let t=0;t<r.length;t++){const i=r.start(t),s=r.end(t);e+=`${i} --> ${s}. Duration (${s-i})
|
|
182
|
+
`}return e}const Si=1/30,Ei=Si*3,Af=function(r,e){const t=[];let i;if(r&&r.length)for(i=0;i<r.length;i++)e(r.start(i),r.end(i))&&t.push([r.start(i),r.end(i)]);return _t(t)},br=function(r,e){return Af(r,function(t,i){return t-Ei<=e&&i+Ei>=e})},fn=function(r,e){return Af(r,function(t){return t-Si>=e})},Xv=function(r){if(r.length<2)return _t();const e=[];for(let t=1;t<r.length;t++){const i=r.end(t-1),s=r.start(t);e.push([i,s])}return _t(e)},Yv=function(r,e){let t=null,i=null,s=0;const n=[],a=[];if(!r||!r.length||!e||!e.length)return _t();let o=r.length;for(;o--;)n.push({time:r.start(o),type:"start"}),n.push({time:r.end(o),type:"end"});for(o=e.length;o--;)n.push({time:e.start(o),type:"start"}),n.push({time:e.end(o),type:"end"});for(n.sort(function(u,d){return u.time-d.time}),o=0;o<n.length;o++)n[o].type==="start"?(s++,s===2&&(t=n[o].time)):n[o].type==="end"&&(s--,s===1&&(i=n[o].time)),t!==null&&i!==null&&(a.push([t,i]),t=null,i=null);return _t(a)},wf=r=>{const e=[];if(!r||!r.length)return"";for(let t=0;t<r.length;t++)e.push(r.start(t)+" => "+r.end(t));return e.join(", ")},Qv=function(r,e,t=1){return((r.length?r.end(r.length-1):0)-e)/t},nr=r=>{const e=[];for(let t=0;t<r.length;t++)e.push({start:r.start(t),end:r.end(t)});return e},Jv=function(r,e){if(r===e)return!1;if(!r&&e||!e&&r||r.length!==e.length)return!0;for(let t=0;t<r.length;t++)if(r.start(t)!==e.start(t)||r.end(t)!==e.end(t))return!0;return!1},ao=function(r){if(!(!r||!r.length||!r.end))return r.end(r.length-1)},bl=function(r,e){let t=0;if(!r||!r.length)return t;for(let i=0;i<r.length;i++){const s=r.start(i),n=r.end(i);if(!(e>n)){if(e>s&&e<=n){t+=n-e;continue}t+=n-s}}return t},xl=(r,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+=r.partTargetDuration)}),t},wo=r=>(r.segments||[]).reduce((e,t,i)=>(t.parts?t.parts.forEach(function(s,n){e.push({duration:s.duration,segmentIndex:i,partIndex:n,part:s,segment:t})}):e.push({duration:t.duration,segmentIndex:i,partIndex:null,segment:t,part:null}),e),[]),Df=r=>{const e=r.segments&&r.segments.length&&r.segments[r.segments.length-1];return e&&e.parts||[]},If=({preloadSegment:r})=>{if(!r)return;const{parts:e,preloadHints:t}=r;let i=(t||[]).reduce((s,n)=>s+(n.type==="PART"?1:0),0);return i+=e&&e.length?e.length:0,i},kf=(r,e)=>{if(e.endList)return 0;if(r&&r.suggestedPresentationDelay)return r.suggestedPresentationDelay;const t=Df(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},Zv=function(r,e){let t=0,i=e-r.mediaSequence,s=r.segments[i];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(;i--;){if(s=r.segments[i],typeof s.end<"u")return{result:t+s.end,precise:!0};if(t+=xl(r,s),typeof s.start<"u")return{result:t+s.start,precise:!0}}return{result:t,precise:!1}},eb=function(r,e){let t=0,i,s=e-r.mediaSequence;for(;s<r.segments.length;s++){if(i=r.segments[s],typeof i.start<"u")return{result:i.start-t,precise:!0};if(t+=xl(r,i),typeof i.end<"u")return{result:i.end-t,precise:!0}}return{result:-1,precise:!1}},Pf=function(r,e,t){if(typeof e>"u"&&(e=r.mediaSequence+r.segments.length),e<r.mediaSequence)return 0;const i=Zv(r,e);if(i.precise)return i.result;const s=eb(r,e);return s.precise?s.result:i.result+t},Rf=function(r,e,t){if(!r)return 0;if(typeof t!="number"&&(t=0),typeof e>"u"){if(r.totalDuration)return r.totalDuration;if(!r.endList)return N.Infinity}return Pf(r,e,t)},Es=function({defaultDuration:r,durationList:e,startIndex:t,endIndex:i}){let s=0;if(t>i&&([t,i]=[i,t]),t<0){for(let n=t;n<Math.min(0,i);n++)s+=r;t=0}for(let n=t;n<i;n++)s+=e[n].duration;return s},Lf=function(r,e,t,i){if(!r||!r.segments)return null;if(r.endList)return Rf(r);if(e===null)return null;e=e||0;let s=Pf(r,r.mediaSequence+r.segments.length,e);return t&&(i=typeof i=="number"?i:kf(null,r),s-=i),Math.max(0,s)},tb=function(r,e,t){const s=e||0;let n=Lf(r,e,!0,t);return n===null?_t():(n<s&&(n=s),_t(s,n))},ib=function({playlist:r,currentTime:e,startingSegmentIndex:t,startingPartIndex:i,startTime:s,exactManifestTimings:n}){let a=e-s;const o=wo(r);let u=0;for(let d=0;d<o.length;d++){const p=o[d];if(t===p.segmentIndex&&!(typeof i=="number"&&typeof p.partIndex=="number"&&i!==p.partIndex)){u=d;break}}if(a<0){if(u>0)for(let d=u-1;d>=0;d--){const p=o[d];if(a+=p.duration,n){if(a<0)continue}else if(a+Si<=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s-Es({defaultDuration:r.targetDuration,durationList:o,startIndex:u,endIndex:d})}}return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e}}if(u<0){for(let d=u;d<0;d++)if(a-=r.targetDuration,a<0)return{partIndex:o[0]&&o[0].partIndex||null,segmentIndex:o[0]&&o[0].segmentIndex||0,startTime:e};u=0}for(let d=u;d<o.length;d++){const p=o[d];a-=p.duration;const T=p.duration>Si,A=a===0,b=T&&a+Si>=0;if(!((A||b)&&d!==o.length-1)){if(n){if(a>0)continue}else if(a-Si>=0)continue;return{partIndex:p.partIndex,segmentIndex:p.segmentIndex,startTime:s+Es({defaultDuration:r.targetDuration,durationList:o,startIndex:u,endIndex:d})}}}return{segmentIndex:o[o.length-1].segmentIndex,partIndex:o[o.length-1].partIndex,startTime:e}},Nf=function(r){return r.excludeUntil&&r.excludeUntil>Date.now()},Sl=function(r){return r.excludeUntil&&r.excludeUntil===1/0},fa=function(r){const e=Nf(r);return!r.disabled&&!e},rb=function(r){return r.disabled},sb=function(r){for(let e=0;e<r.segments.length;e++)if(r.segments[e].key)return!0;return!1},Of=function(r,e){return e.attributes&&e.attributes[r]},nb=function(r,e,t,i=0){return Of("BANDWIDTH",t)?(r*t.attributes.BANDWIDTH-i*8)/e:NaN},Do=(r,e)=>{if(r.playlists.length===1)return!0;const t=e.attributes.BANDWIDTH||Number.MAX_VALUE;return r.playlists.filter(i=>fa(i)?(i.attributes.BANDWIDTH||0)<t:!1).length===0},El=(r,e)=>!r&&!e||!r&&e||r&&!e?!1:!!(r===e||r.id&&e.id&&r.id===e.id||r.resolvedUri&&e.resolvedUri&&r.resolvedUri===e.resolvedUri||r.uri&&e.uri&&r.uri===e.uri),Wc=function(r,e){const t=r&&r.mediaGroups&&r.mediaGroups.AUDIO||{};let i=!1;for(const s in t){for(const n in t[s])if(i=e(t[s][n]),i)break;if(i)break}return!!i},Bs=r=>{if(!r||!r.playlists||!r.playlists.length)return Wc(r,t=>t.playlists&&t.playlists.length||t.uri);for(let e=0;e<r.playlists.length;e++){const t=r.playlists[e],i=t.attributes&&t.attributes.CODECS;if(!(i&&i.split(",").every(n=>Gd(n))||Wc(r,n=>El(t,n))))return!1}return!0};var Bt={liveEdgeDelay:kf,duration:Rf,seekable:tb,getMediaInfoForTime:ib,isEnabled:fa,isDisabled:rb,isExcluded:Nf,isIncompatible:Sl,playlistEnd:Lf,isAes:sb,hasAttribute:Of,estimateSegmentRequestTime:nb,isLowestEnabledRendition:Do,isAudioOnly:Bs,playlistMatch:El,segmentDurationWithParts:xl};const{log:Bf}=z,wr=(r,e)=>`${r}-${e}`,Mf=(r,e,t)=>`placeholder-uri-${r}-${e}-${t}`,ab=({onwarn:r,oninfo:e,manifestString:t,customTagParsers:i=[],customTagMappers:s=[],llhls:n})=>{const a=new Hy;r&&a.on("warn",r),e&&a.on("info",e),i.forEach(d=>a.addParser(d)),s.forEach(d=>a.addTagMapper(d)),a.push(t),a.end();const o=a.manifest;if(n||(["preloadSegment","skip","serverControl","renditionReports","partInf","partTargetDuration"].forEach(function(d){o.hasOwnProperty(d)&&delete o[d]}),o.segments&&o.segments.forEach(function(d){["parts","preloadHints"].forEach(function(p){d.hasOwnProperty(p)&&delete d[p]})})),!o.targetDuration){let d=10;o.segments&&o.segments.length&&(d=o.segments.reduce((p,T)=>Math.max(p,T.duration),0)),r&&r({message:`manifest has no targetDuration defaulting to ${d}`}),o.targetDuration=d}const u=Df(o);if(u.length&&!o.partTargetDuration){const d=u.reduce((p,T)=>Math.max(p,T.duration),0);r&&(r({message:`manifest has no partTargetDuration defaulting to ${d}`}),Bf.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.")),o.partTargetDuration=d}return o},Gr=(r,e)=>{r.mediaGroups&&["AUDIO","SUBTITLES"].forEach(t=>{if(r.mediaGroups[t])for(const i in r.mediaGroups[t])for(const s in r.mediaGroups[t][i]){const n=r.mediaGroups[t][i][s];e(n,t,i,s)}})},Ff=({playlist:r,uri:e,id:t})=>{r.id=t,r.playlistErrors_=0,e&&(r.uri=e),r.attributes=r.attributes||{}},ob=r=>{let e=r.playlists.length;for(;e--;){const t=r.playlists[e];Ff({playlist:t,id:wr(e,t.uri)}),t.resolvedUri=Ot(r.uri,t.uri),r.playlists[t.id]=t,r.playlists[t.uri]=t,t.attributes.BANDWIDTH||Bf.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.")}},lb=r=>{Gr(r,e=>{e.uri&&(e.resolvedUri=Ot(r.uri,e.uri))})},ub=(r,e)=>{const t=wr(0,e),i={mediaGroups:{AUDIO:{},VIDEO:{},"CLOSED-CAPTIONS":{},SUBTITLES:{}},uri:N.location.href,resolvedUri:N.location.href,playlists:[{uri:e,id:t,resolvedUri:e,attributes:{}}]};return i.playlists[t]=i.playlists[0],i.playlists[e]=i.playlists[0],i},Uf=(r,e,t=Mf)=>{r.uri=e;for(let s=0;s<r.playlists.length;s++)if(!r.playlists[s].uri){const n=`placeholder-uri-${s}`;r.playlists[s].uri=n}const i=Bs(r);Gr(r,(s,n,a,o)=>{if(!s.playlists||!s.playlists.length){if(i&&n==="AUDIO"&&!s.uri)for(let u=0;u<r.playlists.length;u++){const d=r.playlists[u];if(d.attributes&&d.attributes.AUDIO&&d.attributes.AUDIO===a)return}s.playlists=[ot({},s)]}s.playlists.forEach(function(u,d){const p=t(n,a,o,u),T=wr(d,p);u.uri?u.resolvedUri=u.resolvedUri||Ot(r.uri,u.uri):(u.uri=d===0?p:T,u.resolvedUri=u.uri),u.id=u.id||T,u.attributes=u.attributes||{},r.playlists[u.id]=u,r.playlists[u.uri]=u})}),ob(r),lb(r)};class Gc{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((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((i,s)=>{if(!this.processedDateRanges_.has(s)&&(i.startTime=i.startDate.getTime()/1e3-this.offset_,i.processDateRange=()=>this.processDateRange(i),t.push(i),!!i.class))if(e[i.class]){const n=e[i.class].push(i);i.classListIndex=n-1}else e[i.class]=[i],i.classListIndex=0});for(const i of t){const s=e[i.class]||[];i.endDate?i.endTime=i.endDate.getTime()/1e3-this.offset_:i.endOnNext&&s[i.classListIndex+1]?i.endTime=s[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,s)=>{i.startDate.getTime()<e&&this.processedDateRanges_.delete(s)})}}const $f=22,cr=({requestType:r,request:e,error:t,parseFailure:i})=>{const s=e.status<200||e.status>299,n=e.status>=400&&e.status<=499,a={uri:e.uri,requestType:r},o=s&&!n||i;if(t&&n)a.error=ot({},t),a.errorType=z.Error.NetworkRequestFailed;else if(e.aborted)a.errorType=z.Error.NetworkRequestAborted;else if(e.timedout)a.erroType=z.Error.NetworkRequestTimeout;else if(o){const u=i?z.Error.NetworkBodyParserFailed:z.Error.NetworkBadStatus;a.errorType=u,a.status=e.status,a.headers=e.headers}return a},{EventTarget:cb}=z,db=(r,e)=>{if(e.endList||!e.serverControl)return r;const t={};if(e.serverControl.canBlockReload){const{preloadSegment:i}=e;let s=e.mediaSequence+e.segments.length;if(i){const n=i.parts||[],a=If(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 i=new N.URL(r);["_HLS_skip","_HLS_msn","_HLS_part"].forEach(function(s){t.hasOwnProperty(s)&&i.searchParams.set(s,t[s])}),r=i.toString()}return r},hb=(r,e)=>{if(!r)return e;const t=Oe(r,e);if(r.preloadHints&&!e.preloadHints&&delete t.preloadHints,r.parts&&!e.parts)delete t.parts;else if(r.parts&&e.parts)for(let i=0;i<e.parts.length;i++)r.parts&&r.parts[i]&&(t.parts[i]=Oe(r.parts[i],e.parts[i]));return!r.skipped&&e.skipped&&(t.skipped=!1),r.preload&&!e.preload&&(t.preload=!1),t},fb=(r,e,t)=>{const i=r.slice(),s=e.slice();t=t||0;const n=[];let a;for(let o=0;o<s.length;o++){const u=i[o+t],d=s[o];u?(a=u.map||a,n.push(hb(u,d))):(a&&!d.map&&(d.map=a),n.push(d))}return n},jf=(r,e)=>{!r.resolvedUri&&r.uri&&(r.resolvedUri=Ot(e,r.uri)),r.key&&!r.key.resolvedUri&&(r.key.resolvedUri=Ot(e,r.key.uri)),r.map&&!r.map.resolvedUri&&(r.map.resolvedUri=Ot(e,r.map.uri)),r.map&&r.map.key&&!r.map.key.resolvedUri&&(r.map.key.resolvedUri=Ot(e,r.map.key.uri)),r.parts&&r.parts.length&&r.parts.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ot(e,t.uri))}),r.preloadHints&&r.preloadHints.length&&r.preloadHints.forEach(t=>{t.resolvedUri||(t.resolvedUri=Ot(e,t.uri))})},qf=function(r){const e=r.segments||[],t=r.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=r.targetDuration,t.preload=!0,e.push(t)}return e},Vf=(r,e)=>r===e||r.segments&&e.segments&&r.segments.length===e.segments.length&&r.endList===e.endList&&r.mediaSequence===e.mediaSequence&&r.preloadSegment===e.preloadSegment,Io=(r,e,t=Vf)=>{const i=Oe(r,{}),s=i.playlists[e.id];if(!s||t(s,e))return null;e.segments=qf(e);const n=Oe(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=fb(s.segments,e.segments,e.mediaSequence-s.mediaSequence)}n.segments.forEach(a=>{jf(a,n.resolvedUri)});for(let a=0;a<i.playlists.length;a++)i.playlists[a].id===e.id&&(i.playlists[a]=n);return i.playlists[e.id]=n,i.playlists[e.uri]=n,Gr(r,(a,o,u,d)=>{if(a.playlists)for(let p=0;p<a.playlists.length;p++)e.id===a.playlists[p].id&&(a.playlists[p]=n)}),i},ko=(r,e)=>{const t=r.segments||[],i=t[t.length-1],s=i&&i.parts&&i.parts[i.parts.length-1],n=s&&s.duration||i&&i.duration;return e&&n?n*1e3:(r.partTargetDuration||r.targetDuration||10)*500},Kc=(r,e,t)=>{if(!r)return;const i=[];return r.forEach(s=>{if(!s.attributes)return;const{BANDWIDTH:n,RESOLUTION:a,CODECS:o}=s.attributes;i.push({id:s.id,bandwidth:n,resolution:a,codecs:o})}),{type:e,isLive:t,renditions:i}};class xr extends cb{constructor(e,t,i={}){if(super(),!e)throw new Error("A non-empty playlist URL or object is required");this.logger_=Zt("PlaylistLoader");const{withCredentials:s=!1}=i;this.src=e,this.vhs_=t,this.withCredentials=s,this.addDateRangesToTextTrack_=i.addDateRangesToTextTrack;const n=t.options_;this.customTagParsers=n&&n.customTagParsers||[],this.customTagMappers=n&&n.customTagMappers||[],this.llhls=n&&n.llhls,this.dateRangesStorage_=new Gc,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=Ot(this.main.uri,e.uri);this.llhls&&(t=db(t,e)),this.state="HAVE_CURRENT_METADATA",this.request=this.vhs_.xhr({uri:t,withCredentials:this.withCredentials,requestType:"hls-playlist"},(i,s)=>{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:s,id:n}=t;this.request=null,i&&(this.state=i),this.error={playlist:this.main.playlists[n],status:e.status,message:`HLS playlist request error at URL: ${s}.`,responseText:e.responseText,code:e.status>=500?4:2,metadata:cr({requestType:e.requestType,request:e,error:e.error})},this.trigger("error")}parseManifest_({url:e,manifestString:t}){try{return ab({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:z.Error.StreamingHlsPlaylistParserError,error:i}}}haveMetadata({playlistString:e,playlistObject:t,url:i,id:s}){this.request=null,this.state="HAVE_METADATA";const n={playlistInfo:{type:"media",uri:i}};this.trigger({type:"playlistparsestart",metadata:n});const a=t||this.parseManifest_({url:i,manifestString:e});a.lastRequest=Date.now(),Ff({playlist:a,uri:i,id:s});const o=Io(this.main,a);this.targetDuration=a.partTargetDuration||a.targetDuration,this.pendingMedia_=null,o?(this.main=o,this.media_=this.main.playlists[s]):this.trigger("playlistunchanged"),this.updateMediaUpdateTimeout_(ko(this.media(),!!o)),n.parsedPlaylist=Kc(this.main.playlists,n.playlistInfo.type,!this.media_.endList),this.trigger({type:"playlistparsecomplete",metadata:n}),this.trigger("loadedplaylist")}dispose(){this.trigger("dispose"),this.stopRequest(),N.clearTimeout(this.mediaUpdateTimeout),N.clearTimeout(this.finalRenditionTimeout),this.dateRangesStorage_=new Gc,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(N.clearTimeout(this.finalRenditionTimeout),t){const o=(e.partTargetDuration||e.targetDuration)/2*1e3||5e3;this.finalRenditionTimeout=N.setTimeout(this.media.bind(this,e,!1),o);return}const i=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"),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange"));return}if(this.updateMediaUpdateTimeout_(ko(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"},(o,u)=>{if(this.request){if(e.lastRequest=Date.now(),e.resolvedUri=Mn(e.resolvedUri,u),o)return this.playlistRequestError(this.request,e,i);this.trigger({type:"playlistrequestcomplete",metadata:a}),this.haveMetadata({playlistString:u.responseText,url:e.uri,id:e.id}),i==="HAVE_MAIN_MANIFEST"?this.trigger("loadedmetadata"):this.trigger("mediachange")}})}pause(){this.mediaUpdateTimeout&&(N.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&&(N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null);const t=this.media();if(e){const i=t?(t.partTargetDuration||t.targetDuration)/2*1e3:5e3;this.mediaUpdateTimeout=N.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&&(N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null),!(!this.media()||this.media().endList)&&(this.mediaUpdateTimeout=N.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=N.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:cr({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=Mn(this.src,i),this.trigger({type:"playlistparsestart",metadata:e});const s=this.parseManifest_({manifestString:i.responseText,url:this.src});e.parsedPlaylist=Kc(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,Uf(this.main,this.srcUri()),e.playlists.forEach(i=>{i.segments=qf(i),i.segments.forEach(s=>{jf(s,i.resolvedUri)})}),this.trigger("loadedplaylist"),this.request||this.media(this.main.playlists[0]);return}const t=this.srcUri()||N.location.href;this.main=ub(e,t),this.haveMetadata({playlistObject:e,url:t,id:this.main.playlists[0].id}),this.trigger("loadedmetadata")}updateOrDeleteClone(e,t){const i=this.main,s=e.ID;let n=i.playlists.length;for(;n--;){const a=i.playlists[n];if(a.attributes["PATHWAY-ID"]===s){const o=a.resolvedUri,u=a.id;if(t){const d=this.createCloneURI_(a.resolvedUri,e),p=wr(s,d),T=this.createCloneAttributes_(s,a.attributes),A=this.createClonePlaylist_(a,p,e,T);i.playlists[n]=A,i.playlists[p]=A,i.playlists[d]=A}else i.playlists.splice(n,1);delete i.playlists[u],delete i.playlists[o]}}this.updateOrDeleteCloneMedia(e,t)}updateOrDeleteCloneMedia(e,t){const i=this.main,s=e.ID;["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(n=>{if(!(!i.mediaGroups[n]||!i.mediaGroups[n][s])){for(const a in i.mediaGroups[n])if(a===s){for(const o in i.mediaGroups[n][a])i.mediaGroups[n][a][o].playlists.forEach((d,p)=>{const T=i.playlists[d.id],A=T.id,b=T.resolvedUri;delete i.playlists[A],delete i.playlists[b]});delete i.mediaGroups[n][a]}}}),t&&this.createClonedMediaGroups_(e)}addClonePathway(e,t={}){const i=this.main,s=i.playlists.length,n=this.createCloneURI_(t.resolvedUri,e),a=wr(e.ID,n),o=this.createCloneAttributes_(e.ID,t.attributes),u=this.createClonePlaylist_(t,a,e,o);i.playlists[s]=u,i.playlists[a]=u,i.playlists[n]=u,this.createClonedMediaGroups_(e)}createClonedMediaGroups_(e){const t=e.ID,i=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===i)s.mediaGroups[n][t]={};else continue;for(const o in s.mediaGroups[n][a]){const u=s.mediaGroups[n][a][o];s.mediaGroups[n][t][o]=ot({},u);const d=s.mediaGroups[n][t][o],p=this.createCloneURI_(u.resolvedUri,e);d.resolvedUri=p,d.uri=p,d.playlists=[],u.playlists.forEach((T,A)=>{const b=s.playlists[T.id],k=Mf(n,t,o),v=wr(t,k);if(b&&!s.playlists[v]){const L=this.createClonePlaylist_(b,v,e),U=L.resolvedUri;s.playlists[v]=L,s.playlists[U]=L}d.playlists[A]=this.createClonePlaylist_(T,v,e)})}}})}createClonePlaylist_(e,t,i,s){const n=this.createCloneURI_(e.resolvedUri,i),a={resolvedUri:n,uri:n,id:t};return e.segments&&(a.segments=[]),s&&(a.attributes=s),Oe(e,a)}createCloneURI_(e,t){const i=new URL(e);i.hostname=t["URI-REPLACEMENT"].HOST;const s=t["URI-REPLACEMENT"].PARAMS;for(const n of Object.keys(s))i.searchParams.set(n,s[n]);return i.href}createCloneAttributes_(e,t){const i={"PATHWAY-ID":e};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(s=>{t[s]&&(i[s]=e)}),i}getKeyIdSet(e){if(e.contentProtection){const t=new Set;for(const i in e.contentProtection){const s=e.contentProtection[i].attributes.keyId;s&&t.add(s.toLowerCase())}return t}}}const Po=function(r,e,t,i){const s=r.responseType==="arraybuffer"?r.response:r.responseText;!e&&s&&(r.responseTime=Date.now(),r.roundTripTime=r.responseTime-r.requestTime,r.bytesReceived=s.byteLength||s.length,r.bandwidth||(r.bandwidth=Math.floor(r.bytesReceived/r.roundTripTime*8*1e3))),t.headers&&(r.responseHeaders=t.headers),e&&e.code==="ETIMEDOUT"&&(r.timedout=!0),!e&&!r.aborted&&t.statusCode!==200&&t.statusCode!==206&&t.statusCode!==0&&(e=new Error("XHR Failed with a response of: "+(r&&(s||r.responseText)))),i(e,r)},pb=(r,e)=>{if(!r||!r.size)return;let t=e;return r.forEach(i=>{t=i(t)}),t},mb=(r,e,t,i)=>{!r||!r.size||r.forEach(s=>{s(e,t,i)})},Hf=function(){const r=function e(t,i){t=Oe({timeout:45e3},t);const s=e.beforeRequest||z.Vhs.xhr.beforeRequest,n=e._requestCallbackSet||z.Vhs.xhr._requestCallbackSet||new Set,a=e._responseCallbackSet||z.Vhs.xhr._responseCallbackSet;s&&typeof s=="function"&&(z.log.warn("beforeRequest is deprecated, use onRequest instead."),n.add(s));const o=z.Vhs.xhr.original===!0?z.xhr:z.Vhs.xhr,u=pb(n,t);n.delete(s);const d=o(u||t,function(T,A){return mb(a,d,T,A),Po(d,T,A,i)}),p=d.abort;return d.abort=function(){return d.aborted=!0,p.apply(d,arguments)},d.uri=t.uri,d.requestType=t.requestType,d.requestTime=Date.now(),d};return r.original=!0,r},gb=function(r){let e;const t=r.offset;return typeof r.offset=="bigint"||typeof r.length=="bigint"?e=N.BigInt(r.offset)+N.BigInt(r.length)-N.BigInt(1):e=r.offset+r.length-1,"bytes="+t+"-"+e},Ro=function(r){const e={};return r.byterange&&(e.Range=gb(r.byterange)),e},yb=function(r,e){return r.start(e)+"-"+r.end(e)},_b=function(r,e){const t=r.toString(16);return"00".substring(0,2-t.length)+t+(e%2?" ":"")},Tb=function(r){return r>=32&&r<126?String.fromCharCode(r):"."},zf=function(r){const e={};return Object.keys(r).forEach(t=>{const i=r[t];Xd(i)?e[t]={bytes:i.buffer,byteOffset:i.byteOffset,byteLength:i.byteLength}:e[t]=i}),e},Fn=function(r){const e=r.byterange||{length:1/0,offset:0};return[e.length,e.offset,r.resolvedUri].join(",")},Wf=function(r){return r.resolvedUri},Gf=r=>{const e=Array.prototype.slice.call(r),t=16;let i="",s,n;for(let a=0;a<e.length/t;a++)s=e.slice(a*t,a*t+t).map(_b).join(""),n=e.slice(a*t,a*t+t).map(Tb).join(""),i+=s+" "+n+`
|
|
183
|
+
`;return i},vb=({bytes:r})=>Gf(r),bb=r=>{let e="",t;for(t=0;t<r.length;t++)e+=yb(r,t)+" ";return e};var xb=Object.freeze({__proto__:null,createTransferableMessage:zf,initSegmentId:Fn,segmentKeyId:Wf,hexDump:Gf,tagDump:vb,textRanges:bb});const Kf=.25,Sb=(r,e)=>{if(!e.dateTimeObject)return null;const t=e.videoTimingInfo.transmuxerPrependedSeconds,s=e.videoTimingInfo.transmuxedPresentationStart+t,n=r-s;return new Date(e.dateTimeObject.getTime()+n*1e3)},Eb=r=>r.transmuxedPresentationEnd-r.transmuxedPresentationStart-r.transmuxerPrependedSeconds,Cb=(r,e)=>{let t;try{t=new Date(r)}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 u=0;u<e.segments.length-1;u++){i=e.segments[u];const d=new Date(e.segments[u+1].dateTimeObject);if(t<d)break}const s=e.segments[e.segments.length-1],n=s.dateTimeObject,a=s.videoTimingInfo?Eb(s.videoTimingInfo):s.duration+s.duration*Kf,o=new Date(n.getTime()+a*1e3);return t>o?null:(t>new Date(n)&&(i=s),{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:Bt.duration(e,e.mediaSequence+e.segments.indexOf(i)),type:i.videoTimingInfo?"accurate":"estimate"})},Ab=(r,e)=>{if(!e||!e.segments||e.segments.length===0)return null;let t=0,i;for(let n=0;n<e.segments.length&&(i=e.segments[n],t=i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationEnd:t+i.duration,!(r<=t));n++);const s=e.segments[e.segments.length-1];if(s.videoTimingInfo&&s.videoTimingInfo.transmuxedPresentationEnd<r)return null;if(r>t){if(r>t+s.duration*Kf)return null;i=s}return{segment:i,estimatedStart:i.videoTimingInfo?i.videoTimingInfo.transmuxedPresentationStart:t-i.duration,type:i.videoTimingInfo?"accurate":"estimate"}},wb=(r,e)=>{let t,i;try{t=new Date(r),i=new Date(e)}catch{}const s=t.getTime();return(i.getTime()-s)/1e3},Db=r=>{if(!r.segments||r.segments.length===0)return!1;for(let e=0;e<r.segments.length;e++)if(!r.segments[e].dateTimeObject)return!1;return!0},Ib=({playlist:r,time:e=void 0,callback:t})=>{if(!t)throw new Error("getProgramTime: callback must be provided");if(!r||e===void 0)return t({message:"getProgramTime: playlist and time must be provided"});const i=Ab(e,r);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 s={mediaSeconds:e},n=Sb(e,i.segment);return n&&(s.programDateTime=n.toISOString()),t(null,s)},Xf=({programTime:r,playlist:e,retryCount:t=2,seekTo:i,pauseAfterSeek:s=!0,tech:n,callback:a})=>{if(!a)throw new Error("seekToProgramTime: callback must be provided");if(typeof r>"u"||!e||!i)return a({message:"seekToProgramTime: programTime, seekTo and playlist must be provided"});if(!e.endList&&!n.hasStarted_)return a({message:"player must be playing a live stream to start buffering"});if(!Db(e))return a({message:"programDateTime tags must be provided in the manifest "+e.resolvedUri});const o=Cb(r,e);if(!o)return a({message:`${r} was not found in the stream`});const u=o.segment,d=wb(u.dateTimeObject,r);if(o.type==="estimate"){if(t===0)return a({message:`${r} is not buffered yet. Try again`});i(o.estimatedStart+d),n.one("seeked",()=>{Xf({programTime:r,playlist:e,retryCount:t-1,seekTo:i,pauseAfterSeek:s,tech:n,callback:a})});return}const p=u.start+d,T=()=>a(null,n.currentTime());n.one("seeked",T),s&&n.pause(),i(p)},oo=(r,e)=>{if(r.readyState===4)return e()},kb=(r,e,t,i)=>{let s=[],n,a=!1;const o=function(T,A,b,k){return A.abort(),a=!0,t(T,A,b,k)},u=function(T,A){if(a)return;if(T)return T.metadata=cr({requestType:i,request:A,error:T}),o(T,A,"",s);const b=A.responseText.substring(s&&s.byteLength||0,A.responseText.length);if(s=i_(s,Yd(b,!0)),n=n||ys(s),s.length<10||n&&s.length<n+2)return oo(A,()=>o(T,A,"",s));const k=Xo(s);return k==="ts"&&s.length<188?oo(A,()=>o(T,A,"",s)):!k&&s.length<376?oo(A,()=>o(T,A,"",s)):o(null,A,k,s)},p=e({uri:r,beforeSend(T){T.overrideMimeType("text/plain; charset=x-user-defined"),T.addEventListener("progress",function({total:A,loaded:b}){return Po(T,null,{statusCode:T.status},u)})}},function(T,A){return Po(p,T,A,u)});return p},{EventTarget:Pb}=z,Xc=function(r,e){if(!Vf(r,e)||r.sidx&&e.sidx&&(r.sidx.offset!==e.sidx.offset||r.sidx.length!==e.sidx.length))return!1;if(!r.sidx&&e.sidx||r.sidx&&!e.sidx||r.segments&&!e.segments||!r.segments&&e.segments)return!1;if(!r.segments&&!e.segments)return!0;for(let t=0;t<r.segments.length;t++){const i=r.segments[t],s=e.segments[t];if(i.uri!==s.uri)return!1;if(!i.byterange&&!s.byterange)continue;const n=i.byterange,a=s.byterange;if(n&&!a||!n&&a||n.offset!==a.offset||n.length!==a.length)return!1}return!0},Rb=(r,e,t,i)=>{const s=i.attributes.NAME||t;return`placeholder-uri-${r}-${e}-${s}`},Lb=({mainXml:r,srcUrl:e,clientOffset:t,sidxMapping:i,previousManifest:s})=>{const n=tT(r,{manifestUri:e,clientOffset:t,sidxMapping:i,previousManifest:s});return Uf(n,e,Rb),n},Nb=(r,e)=>{Gr(r,(t,i,s,n)=>{(!e.mediaGroups[i][s]||!(n in e.mediaGroups[i][s]))&&delete r.mediaGroups[i][s][n]})},Ob=(r,e,t)=>{let i=!0,s=Oe(r,{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=Xn(a.sidx);t&&t[u]&&t[u].sidx&&Wo(a,t[u].sidx,a.sidx.resolvedUri)}const o=Io(s,a,Xc);o&&(s=o,i=!1)}return Gr(e,(n,a,o,u)=>{if(n.playlists&&n.playlists.length){const d=n.playlists[0].id,p=Io(s,n.playlists[0],Xc);p&&(s=p,u in s.mediaGroups[a][o]||(s.mediaGroups[a][o][u]=n),s.mediaGroups[a][o][u].playlists[0]=s.playlists[d],i=!1)}}),Nb(s,e),e.minimumUpdatePeriod!==r.minimumUpdatePeriod&&(i=!1),i?null:s},Bb=(r,e)=>(!r.map&&!e.map||!!(r.map&&e.map&&r.map.byterange.offset===e.map.byterange.offset&&r.map.byterange.length===e.map.byterange.length))&&r.uri===e.uri&&r.byterange.offset===e.byterange.offset&&r.byterange.length===e.byterange.length,Yc=(r,e)=>{const t={};for(const i in r){const n=r[i].sidx;if(n){const a=Xn(n);if(!e[a])break;const o=e[a].sidxInfo;Bb(o,n)&&(t[a]=e[a])}}return t},Mb=(r,e)=>{let i=Yc(r.playlists,e);return Gr(r,(s,n,a,o)=>{if(s.playlists&&s.playlists.length){const u=s.playlists;i=Oe(i,Yc(u,e))}}),i};class Lo extends Pb{constructor(e,t,i={},s){super(),this.isPaused_=!0,this.mainPlaylistLoader_=s||this,s||(this.isMain_=!0);const{withCredentials:n=!1}=i;if(this.vhs_=t,this.withCredentials=n,this.addMetadataToTextTrack=i.addMetadataToTextTrack,!e)throw new Error("A non-empty playlist URL or object is required");this.on("minimumUpdatePeriod",()=>{this.refreshXml_()}),this.on("mediaupdatetimeout",()=>{this.refreshMedia_(this.media().id)}),this.state="HAVE_NOTHING",this.loadedPlaylists_={},this.logger_=Zt("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 s=e.sidx&&Xn(e.sidx);if(!e.sidx||!s||this.mainPlaylistLoader_.sidxMapping_[s]){N.clearTimeout(this.mediaRequest_),this.mediaRequest_=N.setTimeout(()=>i(!1),0);return}const n=Mn(e.sidx.resolvedUri),a=(u,d)=>{if(this.requestErrored_(u,d,t))return;const p=this.mainPlaylistLoader_.sidxMapping_,{requestType:T}=d;let A;try{A=aT(be(d.response).subarray(8))}catch(b){b.metadata=cr({requestType:T,request:d,parseFailure:!0}),this.requestErrored_(b,d,t);return}return p[s]={sidxInfo:e.sidx,sidx:A},Wo(e,A,e.sidx.resolvedUri),i(!0)},o="dash-sidx";this.request=kb(n,this.vhs_.xhr,(u,d,p,T)=>{if(u)return a(u,d);if(!p||p!=="mp4"){const k=p||"unknown";return a({status:d.status,message:`Unsupported ${k} container type for sidx segment at URL: ${n}`,response:"",playlist:e,internal:!0,playlistExclusionDuration:1/0,code:2},d)}const{offset:A,length:b}=e.sidx.byterange;if(T.length>=b+A)return a(u,{response:T.subarray(A,A+b),status:d.status,uri:d.uri});this.request=this.vhs_.xhr({uri:n,responseType:"arraybuffer",requestType:"dash-sidx",headers:Ro({byterange:e.sidx.byterange})},a)},o)}dispose(){this.isPaused_=!0,this.trigger("dispose"),this.stopRequest(),this.loadedPlaylists_={},N.clearTimeout(this.minimumUpdatePeriodTimeout_),N.clearTimeout(this.mediaRequest_),N.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,s=>{this.haveMetadata({startingState:t,playlist:e})}))}haveMetadata({startingState:e,playlist:t}){this.state="HAVE_METADATA",this.loadedPlaylists_[t.id]=t,N.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(),N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null,this.isMain_&&(N.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_),this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_=null),this.state==="HAVE_NOTHING"&&(this.started=!1)}load(e){this.isPaused_=!1,N.clearTimeout(this.mediaUpdateTimeout),this.mediaUpdateTimeout=null;const t=this.media();if(e){const i=t?t.targetDuration/2*1e3:5e3;this.mediaUpdateTimeout=N.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_){N.clearTimeout(this.mediaRequest_),this.mediaRequest_=N.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,s)=>{if(i){const{requestType:a}=s;i.metadata=cr({requestType:a,request:s,error:i})}if(this.requestErrored_(i,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=Mn(this.mainPlaylistLoader_.srcUrl,s),n){this.handleMain_(),this.syncClientServerClock_(()=>e(s,n));return}return e(s,n)})}syncClientServerClock_(e){const t=iT(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:Ot(this.mainPlaylistLoader_.srcUrl,t.value),method:t.method,withCredentials:this.withCredentials,requestType:"dash-clock-sync"},(i,s)=>{if(!this.request)return;if(i){const{requestType:a}=s;return this.error.metadata=cr({requestType:a,request:s,error:i}),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_(){N.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=Lb({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:z.Error.StreamingDashManifestParserError,error:n},this.trigger("error")}e&&(i=Ob(e,i,this.mainPlaylistLoader_.sidxMapping_)),this.mainPlaylistLoader_.main=i||e;const s=this.mainPlaylistLoader_.main.locations&&this.mainPlaylistLoader_.main.locations[0];if(s&&s!==this.mainPlaylistLoader_.srcUrl&&(this.mainPlaylistLoader_.srcUrl=s),(!e||i&&i.minimumUpdatePeriod!==e.minimumUpdatePeriod)&&this.updateMinimumUpdatePeriodTimeout_(),this.addEventStreamToMetadataTrack_(i),i){const{duration:n,endList:a}=i,o=[];i.playlists.forEach(d=>{o.push({id:d.id,bandwidth:d.attributes.BANDWIDTH,resolution:d.attributes.RESOLUTION,codecs:d.attributes.CODECS})});const u={duration:n,isLive:!a,renditions:o};t.parsedManifest=u,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_&&(N.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_=N.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_=Mb(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 s=()=>{this.media().endList||(this.mediaUpdateTimeout=N.setTimeout(()=>{this.trigger("mediaupdatetimeout"),s()},ko(this.media(),!!i)))};s()}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 s=e.contentProtection[i].attributes["cenc:default_KID"];s&&t.add(s.replace(/-/g,"").toLowerCase())}return t}}}var gt={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 Fb=r=>{const e=new Uint8Array(new ArrayBuffer(r.length));for(let t=0;t<r.length;t++)e[t]=r.charCodeAt(t);return e.buffer},Yf=function(r){return r.on=r.addEventListener,r.off=r.removeEventListener,r},Ub=function(r){try{return URL.createObjectURL(new Blob([r],{type:"application/javascript"}))}catch{const t=new BlobBuilder;return t.append(r),URL.createObjectURL(t.getBlob())}},Qf=function(r){return function(){const e=Ub(r),t=Yf(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}},Jf=function(r){return`var browserWorkerPolyFill = ${Yf.toString()};
|
|
195
184
|
browserWorkerPolyFill(self);
|
|
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
|
-
`)},
|
|
185
|
+
`+r},Zf=function(r){return r.toString().replace(/^function.+?{/,"").slice(0,-1)},$b=Jf(Zf(function(){var r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ce.global<"u"?Ce.global:typeof self<"u"?self:{},e=function(){this.init=function(){var l={};this.on=function(c,f){l[c]||(l[c]=[]),l[c]=l[c].concat(f)},this.off=function(c,f){var h;return l[c]?(h=l[c].indexOf(f),l[c]=l[c].slice(),l[c].splice(h,1),h>-1):!1},this.trigger=function(c){var f,h,m,_;if(f=l[c],!!f)if(arguments.length===2)for(m=f.length,h=0;h<m;++h)f[h].call(this,arguments[1]);else{for(_=[],h=arguments.length,h=1;h<arguments.length;++h)_.push(arguments[h]);for(m=f.length,h=0;h<m;++h)f[h].apply(this,_)}},this.dispose=function(){l={}}}};e.prototype.pipe=function(l){return this.on("data",function(c){l.push(c)}),this.on("done",function(c){l.flush(c)}),this.on("partialdone",function(c){l.partialFlush(c)}),this.on("endedtimeline",function(c){l.endTimeline(c)}),this.on("reset",function(c){l.reset(c)}),l},e.prototype.push=function(l){this.trigger("data",l)},e.prototype.flush=function(l){this.trigger("done",l)},e.prototype.partialFlush=function(l){this.trigger("partialdone",l)},e.prototype.endTimeline=function(l){this.trigger("endedtimeline",l)},e.prototype.reset=function(l){this.trigger("reset",l)};var t=e,i=Math.pow(2,32),s=function(l){var c=new DataView(l.buffer,l.byteOffset,l.byteLength),f;return c.getBigUint64?(f=c.getBigUint64(0),f<Number.MAX_SAFE_INTEGER?Number(f):f):c.getUint32(0)*i+c.getUint32(4)},n={getUint64:s,MAX_UINT32:i},a=n.MAX_UINT32,o,u,d,p,T,A,b,k,v,L,U,$,F,H,B,V,G,ie,C,I,W,Y,X,ne,de,fe,te,le,oe,ce,ue,Ee,Ae,Te,_e,lt;(function(){var l;if(X={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],pasp:[],sdtp:[],smhd:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],styp:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[]},!(typeof Uint8Array>"u")){for(l in X)X.hasOwnProperty(l)&&(X[l]=[l.charCodeAt(0),l.charCodeAt(1),l.charCodeAt(2),l.charCodeAt(3)]);ne=new Uint8Array([105,115,111,109]),fe=new Uint8Array([97,118,99,49]),de=new Uint8Array([0,0,0,1]),te=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]),le=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]),oe={video:te,audio:le},Ee=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),ue=new Uint8Array([0,0,0,0,0,0,0,0]),Ae=new Uint8Array([0,0,0,0,0,0,0,0]),Te=Ae,_e=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),lt=Ae,ce=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0])}})(),o=function(l){var c=[],f=0,h,m,_;for(h=1;h<arguments.length;h++)c.push(arguments[h]);for(h=c.length;h--;)f+=c[h].byteLength;for(m=new Uint8Array(f+8),_=new DataView(m.buffer,m.byteOffset,m.byteLength),_.setUint32(0,m.byteLength),m.set(l,4),h=0,f=8;h<c.length;h++)m.set(c[h],f),f+=c[h].byteLength;return m},u=function(){return o(X.dinf,o(X.dref,Ee))},d=function(l){return o(X.esds,new Uint8Array([0,0,0,0,3,25,0,0,0,4,17,64,21,0,6,0,0,0,218,192,0,0,218,192,5,2,l.audioobjecttype<<3|l.samplingfrequencyindex>>>1,l.samplingfrequencyindex<<7|l.channelcount<<3,6,1,2]))},p=function(){return o(X.ftyp,ne,de,ne,fe)},V=function(l){return o(X.hdlr,oe[l])},T=function(l){return o(X.mdat,l)},B=function(l){var c=new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,0,1,95,144,l.duration>>>24&255,l.duration>>>16&255,l.duration>>>8&255,l.duration&255,85,196,0,0]);return l.samplerate&&(c[12]=l.samplerate>>>24&255,c[13]=l.samplerate>>>16&255,c[14]=l.samplerate>>>8&255,c[15]=l.samplerate&255),o(X.mdhd,c)},H=function(l){return o(X.mdia,B(l),V(l.type),b(l))},A=function(l){return o(X.mfhd,new Uint8Array([0,0,0,0,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255]))},b=function(l){return o(X.minf,l.type==="video"?o(X.vmhd,ce):o(X.smhd,ue),u(),ie(l))},k=function(l,c){for(var f=[],h=c.length;h--;)f[h]=I(c[h]);return o.apply(null,[X.moof,A(l)].concat(f))},v=function(l){for(var c=l.length,f=[];c--;)f[c]=$(l[c]);return o.apply(null,[X.moov,U(4294967295)].concat(f).concat(L(l)))},L=function(l){for(var c=l.length,f=[];c--;)f[c]=W(l[c]);return o.apply(null,[X.mvex].concat(f))},U=function(l){var c=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,0,1,95,144,(l&4278190080)>>24,(l&16711680)>>16,(l&65280)>>8,l&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return o(X.mvhd,c)},G=function(l){var c=l.samples||[],f=new Uint8Array(4+c.length),h,m;for(m=0;m<c.length;m++)h=c[m].flags,f[m+4]=h.dependsOn<<4|h.isDependedOn<<2|h.hasRedundancy;return o(X.sdtp,f)},ie=function(l){return o(X.stbl,C(l),o(X.stts,lt),o(X.stsc,Te),o(X.stsz,_e),o(X.stco,Ae))},(function(){var l,c;C=function(f){return o(X.stsd,new Uint8Array([0,0,0,0,0,0,0,1]),f.type==="video"?l(f):c(f))},l=function(f){var h=f.sps||[],m=f.pps||[],_=[],w=[],D,R;for(D=0;D<h.length;D++)_.push((h[D].byteLength&65280)>>>8),_.push(h[D].byteLength&255),_=_.concat(Array.prototype.slice.call(h[D]));for(D=0;D<m.length;D++)w.push((m[D].byteLength&65280)>>>8),w.push(m[D].byteLength&255),w=w.concat(Array.prototype.slice.call(m[D]));if(R=[X.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,(f.width&65280)>>8,f.width&255,(f.height&65280)>>8,f.height&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,19,118,105,100,101,111,106,115,45,99,111,110,116,114,105,98,45,104,108,115,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o(X.avcC,new Uint8Array([1,f.profileIdc,f.profileCompatibility,f.levelIdc,255].concat([h.length],_,[m.length],w))),o(X.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192]))],f.sarRatio){var O=f.sarRatio[0],q=f.sarRatio[1];R.push(o(X.pasp,new Uint8Array([(O&4278190080)>>24,(O&16711680)>>16,(O&65280)>>8,O&255,(q&4278190080)>>24,(q&16711680)>>16,(q&65280)>>8,q&255])))}return o.apply(null,R)},c=function(f){return o(X.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,(f.channelcount&65280)>>8,f.channelcount&255,(f.samplesize&65280)>>8,f.samplesize&255,0,0,0,0,(f.samplerate&65280)>>8,f.samplerate&255,0,0]),d(f))}})(),F=function(l){var c=new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,0,(l.duration&4278190080)>>24,(l.duration&16711680)>>16,(l.duration&65280)>>8,l.duration&255,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,(l.width&65280)>>8,l.width&255,0,0,(l.height&65280)>>8,l.height&255,0,0]);return o(X.tkhd,c)},I=function(l){var c,f,h,m,_,w,D;return c=o(X.tfhd,new Uint8Array([0,0,0,58,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0])),w=Math.floor(l.baseMediaDecodeTime/a),D=Math.floor(l.baseMediaDecodeTime%a),f=o(X.tfdt,new Uint8Array([1,0,0,0,w>>>24&255,w>>>16&255,w>>>8&255,w&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255])),_=92,l.type==="audio"?(h=Y(l,_),o(X.traf,c,f,h)):(m=G(l),h=Y(l,m.length+_),o(X.traf,c,f,h,m))},$=function(l){return l.duration=l.duration||4294967295,o(X.trak,F(l),H(l))},W=function(l){var c=new Uint8Array([0,0,0,0,(l.id&4278190080)>>24,(l.id&16711680)>>16,(l.id&65280)>>8,l.id&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]);return l.type!=="video"&&(c[c.length-1]=0),o(X.trex,c)},(function(){var l,c,f;f=function(h,m){var _=0,w=0,D=0,R=0;return h.length&&(h[0].duration!==void 0&&(_=1),h[0].size!==void 0&&(w=2),h[0].flags!==void 0&&(D=4),h[0].compositionTimeOffset!==void 0&&(R=8)),[0,0,_|w|D|R,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 _,w,D,R,O,q;for(R=h.samples||[],m+=20+16*R.length,D=f(R,m),w=new Uint8Array(D.length+R.length*16),w.set(D),_=D.length,q=0;q<R.length;q++)O=R[q],w[_++]=(O.duration&4278190080)>>>24,w[_++]=(O.duration&16711680)>>>16,w[_++]=(O.duration&65280)>>>8,w[_++]=O.duration&255,w[_++]=(O.size&4278190080)>>>24,w[_++]=(O.size&16711680)>>>16,w[_++]=(O.size&65280)>>>8,w[_++]=O.size&255,w[_++]=O.flags.isLeading<<2|O.flags.dependsOn,w[_++]=O.flags.isDependedOn<<6|O.flags.hasRedundancy<<4|O.flags.paddingValue<<1|O.flags.isNonSyncSample,w[_++]=O.flags.degradationPriority&61440,w[_++]=O.flags.degradationPriority&15,w[_++]=(O.compositionTimeOffset&4278190080)>>>24,w[_++]=(O.compositionTimeOffset&16711680)>>>16,w[_++]=(O.compositionTimeOffset&65280)>>>8,w[_++]=O.compositionTimeOffset&255;return o(X.trun,w)},l=function(h,m){var _,w,D,R,O,q;for(R=h.samples||[],m+=20+8*R.length,D=f(R,m),_=new Uint8Array(D.length+R.length*8),_.set(D),w=D.length,q=0;q<R.length;q++)O=R[q],_[w++]=(O.duration&4278190080)>>>24,_[w++]=(O.duration&16711680)>>>16,_[w++]=(O.duration&65280)>>>8,_[w++]=O.duration&255,_[w++]=(O.size&4278190080)>>>24,_[w++]=(O.size&16711680)>>>16,_[w++]=(O.size&65280)>>>8,_[w++]=O.size&255;return o(X.trun,_)},Y=function(h,m){return h.type==="audio"?l(h,m):c(h,m)}})();var dt={ftyp:p,mdat:T,moof:k,moov:v,initSegment:function(l){var c=p(),f=v(l),h;return h=new Uint8Array(c.byteLength+f.byteLength),h.set(c),h.set(f,c.byteLength),h}},tt=function(l){var c,f,h=[],m=[];for(m.byteLength=0,m.nalCount=0,m.duration=0,h.byteLength=0,c=0;c<l.length;c++)f=l[c],f.nalUnitType==="access_unit_delimiter_rbsp"?(h.length&&(h.duration=f.dts-h.dts,m.byteLength+=h.byteLength,m.nalCount+=h.length,m.duration+=h.duration,m.push(h)),h=[f],h.byteLength=f.data.byteLength,h.pts=f.pts,h.dts=f.dts):(f.nalUnitType==="slice_layer_without_partitioning_rbsp_idr"&&(h.keyFrame=!0),h.duration=f.dts-h.dts,h.byteLength+=f.data.byteLength,h.push(f));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},ht=function(l){var c,f,h=[],m=[];for(h.byteLength=0,h.nalCount=0,h.duration=0,h.pts=l[0].pts,h.dts=l[0].dts,m.byteLength=0,m.nalCount=0,m.duration=0,m.pts=l[0].pts,m.dts=l[0].dts,c=0;c<l.length;c++)f=l[c],f.keyFrame?(h.length&&(m.push(h),m.byteLength+=h.byteLength,m.nalCount+=h.nalCount,m.duration+=h.duration),h=[f],h.nalCount=f.length,h.byteLength=f.byteLength,h.pts=f.pts,h.dts=f.dts,h.duration=f.duration):(h.duration+=f.duration,h.nalCount+=f.length,h.byteLength+=f.byteLength,h.push(f));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},Ct=function(l){var c;return!l[0][0].keyFrame&&l.length>1&&(c=l.shift(),l.byteLength-=c.byteLength,l.nalCount-=c.nalCount,l[0][0].dts=c.dts,l[0][0].pts=c.pts,l[0][0].duration+=c.duration),l},Qe=function(){return{size:0,flags:{isLeading:0,dependsOn:1,isDependedOn:0,hasRedundancy:0,degradationPriority:0,isNonSyncSample:1}}},ft=function(l,c){var f=Qe();return f.dataOffset=c,f.compositionTimeOffset=l.pts-l.dts,f.duration=l.duration,f.size=4*l.length,f.size+=l.byteLength,l.keyFrame&&(f.flags.dependsOn=2,f.flags.isNonSyncSample=0),f},ei=function(l,c){var f,h,m,_,w,D=c||0,R=[];for(f=0;f<l.length;f++)for(_=l[f],h=0;h<_.length;h++)w=_[h],m=ft(w,D),D+=m.size,R.push(m);return R},ut=function(l){var c,f,h,m,_,w,D=0,R=l.byteLength,O=l.nalCount,q=R+4*O,Z=new Uint8Array(q),me=new DataView(Z.buffer);for(c=0;c<l.length;c++)for(m=l[c],f=0;f<m.length;f++)for(_=m[f],h=0;h<_.length;h++)w=_[h],me.setUint32(D,w.data.byteLength),D+=4,Z.set(w.data,D),D+=w.data.byteLength;return Z},ti=function(l,c){var f,h=c||0,m=[];return f=ft(l,h),m.push(f),m},He=function(l){var c,f,h=0,m=l.byteLength,_=l.length,w=m+4*_,D=new Uint8Array(w),R=new DataView(D.buffer);for(c=0;c<l.length;c++)f=l[c],R.setUint32(h,f.data.byteLength),h+=4,D.set(f.data,h),h+=f.data.byteLength;return D},Ht={groupNalsIntoFrames:tt,groupFramesIntoGops:ht,extendFirstKeyFrame:Ct,generateSampleTable:ei,concatenateNalData:ut,generateSampleTableForFrame:ti,concatenateNalDataForFrame:He},At=[33,16,5,32,164,27],Rt=[33,65,108,84,1,2,4,8,168,2,4,8,17,191,252],Ie=function(l){for(var c=[];l--;)c.push(0);return c},je=function(l){return Object.keys(l).reduce(function(c,f){return c[f]=new Uint8Array(l[f].reduce(function(h,m){return h.concat(m)},[])),c},{})},ze,ii=function(){if(!ze){var l={96e3:[At,[227,64],Ie(154),[56]],88200:[At,[231],Ie(170),[56]],64e3:[At,[248,192],Ie(240),[56]],48e3:[At,[255,192],Ie(268),[55,148,128],Ie(54),[112]],44100:[At,[255,192],Ie(268),[55,163,128],Ie(84),[112]],32e3:[At,[255,192],Ie(268),[55,234],Ie(226),[112]],24e3:[At,[255,192],Ie(268),[55,255,128],Ie(268),[111,112],Ie(126),[224]],16e3:[At,[255,192],Ie(268),[55,255,128],Ie(268),[111,255],Ie(269),[223,108],Ie(195),[1,192]],12e3:[Rt,Ie(268),[3,127,248],Ie(268),[6,255,240],Ie(268),[13,255,224],Ie(268),[27,253,128],Ie(259),[56]],11025:[Rt,Ie(268),[3,127,248],Ie(268),[6,255,240],Ie(268),[13,255,224],Ie(268),[27,255,192],Ie(268),[55,175,128],Ie(108),[112]],8e3:[Rt,Ie(268),[3,121,16],Ie(47),[7]]};ze=je(l)}return ze},Lt=9e4,pt,ri,hi,Tt,Xi,S,g;pt=function(l){return l*Lt},ri=function(l,c){return l*c},hi=function(l){return l/Lt},Tt=function(l,c){return l/c},Xi=function(l,c){return pt(Tt(l,c))},S=function(l,c){return ri(hi(l),c)},g=function(l,c,f){return hi(f?l:l-c)};var y={ONE_SECOND_IN_TS:Lt,secondsToVideoTs:pt,secondsToAudioTs:ri,videoTsToSeconds:hi,audioTsToSeconds:Tt,audioTsToVideoTs:Xi,videoTsToAudioTs:S,metadataTsToSeconds:g},P=ii,j=y,Q=function(l){var c,f,h=0;for(c=0;c<l.length;c++)f=l[c],h+=f.data.byteLength;return h},se=function(l,c,f,h){var m,_=0,w=0,D=0,R=0,O,q,Z;if(c.length&&(m=j.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),_=Math.ceil(j.ONE_SECOND_IN_TS/(l.samplerate/1024)),f&&h&&(w=m-Math.max(f,h),D=Math.floor(w/_),R=D*_),!(D<1||R>j.ONE_SECOND_IN_TS/2))){for(O=P()[l.samplerate],O||(O=c[0].data),q=0;q<D;q++)Z=c[0],c.splice(0,0,{data:O,dts:Z.dts-_,pts:Z.pts-_});return l.baseMediaDecodeTime-=Math.floor(j.videoTsToAudioTs(R,l.samplerate)),R}},we=function(l,c,f){return c.minSegmentDts>=f?l:(c.minSegmentDts=1/0,l.filter(function(h){return h.dts>=f?(c.minSegmentDts=Math.min(c.minSegmentDts,h.dts),c.minSegmentPts=c.minSegmentDts,!0):!1}))},Ne=function(l){var c,f,h=[];for(c=0;c<l.length;c++)f=l[c],h.push({size:f.data.byteLength,duration:1024});return h},Be=function(l){var c,f,h=0,m=new Uint8Array(Q(l));for(c=0;c<l.length;c++)f=l[c],m.set(f.data,h),h+=f.data.byteLength;return m},Ue={prefixWithSilence:se,trimAdtsFramesByEarliestDts:we,generateSampleTable:Ne,concatenateFrameData:Be},Le=y.ONE_SECOND_IN_TS,x=function(l,c){typeof c.pts=="number"&&(l.timelineStartInfo.pts===void 0&&(l.timelineStartInfo.pts=c.pts),l.minSegmentPts===void 0?l.minSegmentPts=c.pts:l.minSegmentPts=Math.min(l.minSegmentPts,c.pts),l.maxSegmentPts===void 0?l.maxSegmentPts=c.pts:l.maxSegmentPts=Math.max(l.maxSegmentPts,c.pts)),typeof c.dts=="number"&&(l.timelineStartInfo.dts===void 0&&(l.timelineStartInfo.dts=c.dts),l.minSegmentDts===void 0?l.minSegmentDts=c.dts:l.minSegmentDts=Math.min(l.minSegmentDts,c.dts),l.maxSegmentDts===void 0?l.maxSegmentDts=c.dts:l.maxSegmentDts=Math.max(l.maxSegmentDts,c.dts))},E=function(l){delete l.minSegmentDts,delete l.maxSegmentDts,delete l.minSegmentPts,delete l.maxSegmentPts},M=function(l,c){var f,h,m=l.minSegmentDts;return c||(m-=l.timelineStartInfo.dts),f=l.timelineStartInfo.baseMediaDecodeTime,f+=m,f=Math.max(0,f),l.type==="audio"&&(h=l.samplerate/Le,f*=h,f=Math.floor(f)),f},K={clearDtsInfo:E,calculateTrackBaseMediaDecodeTime:M,collectDtsInfo:x},pe=4,Se=128,qe=function(l){for(var c=0,f={payloadType:-1,payloadSize:0},h=0,m=0;c<l.byteLength&&l[c]!==Se;){for(;l[c]===255;)h+=255,c++;for(h+=l[c++];l[c]===255;)m+=255,c++;if(m+=l[c++],!f.payload&&h===pe){var _=String.fromCharCode(l[c+3],l[c+4],l[c+5],l[c+6]);if(_==="GA94"){f.payloadType=h,f.payloadSize=m,f.payload=l.subarray(c,c+m);break}else f.payload=void 0}c+=m,h=0,m=0}return f},bt=function(l){return l.payload[0]!==181||(l.payload[1]<<8|l.payload[2])!==49||String.fromCharCode(l.payload[3],l.payload[4],l.payload[5],l.payload[6])!=="GA94"||l.payload[7]!==3?null:l.payload.subarray(8,l.payload.length-1)},Ft=function(l,c){var f=[],h,m,_,w;if(!(c[0]&64))return f;for(m=c[0]&31,h=0;h<m;h++)_=h*3,w={type:c[_+2]&3,pts:l},c[_+2]&4&&(w.ccData=c[_+3]<<8|c[_+4],f.push(w));return f},fi=function(l){for(var c=l.byteLength,f=[],h=1,m,_;h<c-2;)l[h]===0&&l[h+1]===0&&l[h+2]===3?(f.push(h+2),h+=2):h++;if(f.length===0)return l;m=c-f.length,_=new Uint8Array(m);var w=0;for(h=0;h<m;w++,h++)w===f[0]&&(w++,f.shift()),_[h]=l[w];return _},zt={parseSei:qe,parseUserData:bt,parseCaptionPackets:Ft,discardEmulationPreventionBytes:fi,USER_DATA_REGISTERED_ITU_T_T35:pe},si=t,Wt=zt,st=function(l){l=l||{},st.prototype.init.call(this),this.parse708captions_=typeof l.parse708captions=="boolean"?l.parse708captions:!0,this.captionPackets_=[],this.ccStreams_=[new Je(0,0),new Je(0,1),new Je(1,0),new Je(1,1)],this.parse708captions_&&(this.cc708Stream_=new Re({captionServices:l.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")))};st.prototype=new si,st.prototype.push=function(l){var c,f,h;if(l.nalUnitType==="sei_rbsp"&&(c=Wt.parseSei(l.escapedRBSP),!!c.payload&&c.payloadType===Wt.USER_DATA_REGISTERED_ITU_T_T35&&(f=Wt.parseUserData(c),!!f))){if(l.dts<this.latestDts_){this.ignoreNextEqualDts_=!0;return}else if(l.dts===this.latestDts_&&this.ignoreNextEqualDts_){this.numSameDts_--,this.numSameDts_||(this.ignoreNextEqualDts_=!1);return}h=Wt.parseCaptionPackets(l.pts,f),this.captionPackets_=this.captionPackets_.concat(h),this.latestDts_!==l.dts&&(this.numSameDts_=0),this.numSameDts_++,this.latestDts_=l.dts}},st.prototype.flushCCStreams=function(l){this.ccStreams_.forEach(function(c){return l==="flush"?c.flush():c.partialFlush()},this)},st.prototype.flushStream=function(l){if(!this.captionPackets_.length){this.flushCCStreams(l);return}this.captionPackets_.forEach(function(c,f){c.presortIndex=f}),this.captionPackets_.sort(function(c,f){return c.pts===f.pts?c.presortIndex-f.presortIndex:c.pts-f.pts}),this.captionPackets_.forEach(function(c){c.type<2?this.dispatchCea608Packet(c):this.dispatchCea708Packet(c)},this),this.captionPackets_.length=0,this.flushCCStreams(l)},st.prototype.flush=function(){return this.flushStream("flush")},st.prototype.partialFlush=function(){return this.flushStream("partialFlush")},st.prototype.reset=function(){this.latestDts_=null,this.ignoreNextEqualDts_=!1,this.numSameDts_=0,this.activeCea608Channel_=[null,null],this.ccStreams_.forEach(function(l){l.reset()})},st.prototype.dispatchCea608Packet=function(l){this.setsTextOrXDSActive(l)?this.activeCea608Channel_[l.type]=null:this.setsChannel1Active(l)?this.activeCea608Channel_[l.type]=0:this.setsChannel2Active(l)&&(this.activeCea608Channel_[l.type]=1),this.activeCea608Channel_[l.type]!==null&&this.ccStreams_[(l.type<<1)+this.activeCea608Channel_[l.type]].push(l)},st.prototype.setsChannel1Active=function(l){return(l.ccData&30720)===4096},st.prototype.setsChannel2Active=function(l){return(l.ccData&30720)===6144},st.prototype.setsTextOrXDSActive=function(l){return(l.ccData&28928)===256||(l.ccData&30974)===4138||(l.ccData&30974)===6186},st.prototype.dispatchCea708Packet=function(l){this.parse708captions_&&this.cc708Stream_.push(l)};var Gt={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},Ii=function(l){var c=Gt[l]||l;return l&4096&&l===c?"":String.fromCharCode(c)},pi=function(l){return 32<=l&&l<=127||160<=l&&l<=255},We=function(l){this.windowNum=l,this.reset()};We.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},We.prototype.getText=function(){return this.rows.join(`
|
|
186
|
+
`)},We.prototype.clearText=function(){this.rows=[""],this.rowIdx=0},We.prototype.newLine=function(l){for(this.rows.length>=this.virtualRowCount&&typeof this.beforeRowOverflow=="function"&&this.beforeRowOverflow(l),this.rows.length>0&&(this.rows.push(""),this.rowIdx++);this.rows.length>this.virtualRowCount;)this.rows.shift(),this.rowIdx--},We.prototype.isEmpty=function(){return this.rows.length===0?!0:this.rows.length===1?this.rows[0]==="":!1},We.prototype.addText=function(l){this.rows[this.rowIdx]+=l},We.prototype.backspace=function(){if(!this.isEmpty()){var l=this.rows[this.rowIdx];this.rows[this.rowIdx]=l.substr(0,l.length-1)}};var Yi=function(l,c,f){this.serviceNum=l,this.text="",this.currentWindow=new We(-1),this.windows=[],this.stream=f,typeof c=="string"&&this.createTextDecoder(c)};Yi.prototype.init=function(l,c){this.startPts=l;for(var f=0;f<8;f++)this.windows[f]=new We(f),typeof c=="function"&&(this.windows[f].beforeRowOverflow=c)},Yi.prototype.setCurrentWindow=function(l){this.currentWindow=this.windows[l]},Yi.prototype.createTextDecoder=function(l){if(typeof TextDecoder>"u")this.stream.trigger("log",{level:"warn",message:"The `encoding` option is unsupported without TextDecoder support"});else try{this.textDecoder_=new TextDecoder(l)}catch(c){this.stream.trigger("log",{level:"warn",message:"TextDecoder could not be created with "+l+" encoding. "+c})}};var Re=function(l){l=l||{},Re.prototype.init.call(this);var c=this,f=l.captionServices||{},h={},m;Object.keys(f).forEach(_=>{m=f[_],/^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(_))}};Re.prototype=new si,Re.prototype.new708Packet=function(){this.current708Packet!==null&&this.push708Packet(),this.current708Packet={data:[],ptsVals:[]}},Re.prototype.add708Bytes=function(l){var c=l.ccData,f=c>>>8,h=c&255;this.current708Packet.ptsVals.push(l.pts),this.current708Packet.data.push(f),this.current708Packet.data.push(h)},Re.prototype.push708Packet=function(){var l=this.current708Packet,c=l.data,f=null,h=null,m=0,_=c[m++];for(l.seq=_>>6,l.sizeCode=_&63;m<c.length;m++)_=c[m++],f=_>>5,h=_&31,f===7&&h>0&&(_=c[m++],f=_),this.pushServiceBlock(f,m,h),h>0&&(m+=h-1)},Re.prototype.pushServiceBlock=function(l,c,f){var h,m=c,_=this.current708Packet.data,w=this.services[l];for(w||(w=this.initService(l,m));m<c+f&&m<_.length;m++)h=_[m],pi(h)?m=this.handleText(m,w):h===24?m=this.multiByteCharacter(m,w):h===16?m=this.extendedCommands(m,w):128<=h&&h<=135?m=this.setCurrentWindow(m,w):152<=h&&h<=159?m=this.defineWindow(m,w):h===136?m=this.clearWindows(m,w):h===140?m=this.deleteWindows(m,w):h===137?m=this.displayWindows(m,w):h===138?m=this.hideWindows(m,w):h===139?m=this.toggleWindows(m,w):h===151?m=this.setWindowAttributes(m,w):h===144?m=this.setPenAttributes(m,w):h===145?m=this.setPenColor(m,w):h===146?m=this.setPenLocation(m,w):h===143?w=this.reset(m,w):h===8?w.currentWindow.backspace():h===12?w.currentWindow.clearText():h===13?w.currentWindow.pendingNewLine=!0:h===14?w.currentWindow.clearText():h===141&&m++},Re.prototype.extendedCommands=function(l,c){var f=this.current708Packet.data,h=f[++l];return pi(h)&&(l=this.handleText(l,c,{isExtended:!0})),l},Re.prototype.getPts=function(l){return this.current708Packet.ptsVals[Math.floor(l/2)]},Re.prototype.initService=function(l,c){var h="SERVICE"+l,f=this,h,m;return h in this.serviceEncodings&&(m=this.serviceEncodings[h]),this.services[l]=new Yi(l,m,f),this.services[l].init(this.getPts(c),function(_){f.flushDisplayed(_,f.services[l])}),this.services[l]},Re.prototype.handleText=function(l,c,f){var h=f&&f.isExtended,m=f&&f.isMultiByte,_=this.current708Packet.data,w=h?4096:0,D=_[l],R=_[l+1],O=c.currentWindow,q,Z;function me(re){return re.map(ve=>("0"+(ve&255).toString(16)).slice(-2)).join("")}if(m?(Z=[D,R],l++):Z=[D],c.textDecoder_&&!h)q=c.textDecoder_.decode(new Uint8Array(Z));else if(m){const re=me(Z);q=String.fromCharCode(parseInt(re,16))}else q=Ii(w|D);return O.pendingNewLine&&!O.isEmpty()&&O.newLine(this.getPts(l)),O.pendingNewLine=!1,O.addText(q),l},Re.prototype.multiByteCharacter=function(l,c){var f=this.current708Packet.data,h=f[l+1],m=f[l+2];return pi(h)&&pi(m)&&(l=this.handleText(++l,c,{isMultiByte:!0})),l},Re.prototype.setCurrentWindow=function(l,c){var f=this.current708Packet.data,h=f[l],m=h&7;return c.setCurrentWindow(m),l},Re.prototype.defineWindow=function(l,c){var f=this.current708Packet.data,h=f[l],m=h&7;c.setCurrentWindow(m);var _=c.currentWindow;return h=f[++l],_.visible=(h&32)>>5,_.rowLock=(h&16)>>4,_.columnLock=(h&8)>>3,_.priority=h&7,h=f[++l],_.relativePositioning=(h&128)>>7,_.anchorVertical=h&127,h=f[++l],_.anchorHorizontal=h,h=f[++l],_.anchorPoint=(h&240)>>4,_.rowCount=h&15,h=f[++l],_.columnCount=h&63,h=f[++l],_.windowStyle=(h&56)>>3,_.penStyle=h&7,_.virtualRowCount=_.rowCount+1,l},Re.prototype.setWindowAttributes=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.winAttr;return h=f[++l],m.fillOpacity=(h&192)>>6,m.fillRed=(h&48)>>4,m.fillGreen=(h&12)>>2,m.fillBlue=h&3,h=f[++l],m.borderType=(h&192)>>6,m.borderRed=(h&48)>>4,m.borderGreen=(h&12)>>2,m.borderBlue=h&3,h=f[++l],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=f[++l],m.effectSpeed=(h&240)>>4,m.effectDirection=(h&12)>>2,m.displayEffect=h&3,l},Re.prototype.flushDisplayed=function(l,c){for(var f=[],h=0;h<8;h++)c.windows[h].visible&&!c.windows[h].isEmpty()&&f.push(c.windows[h].getText());c.endPts=l,c.text=f.join(`
|
|
198
187
|
|
|
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(`
|
|
202
|
-
`)+`
|
|
203
|
-
`+d+" >":E+"<>"}return E+JSON.stringify(C,null,2).split(`
|
|
204
|
-
`).map(function(I,N){return N===0?I:d+" "+I}).join(`
|
|
205
|
-
`)}).join(`
|
|
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:
|
|
188
|
+
`),this.pushCaption(c),c.startPts=l},Re.prototype.pushCaption=function(l){l.text!==""&&(this.trigger("data",{startPts:l.startPts,endPts:l.endPts,text:l.text,stream:"cc708_"+l.serviceNum}),l.text="",l.startPts=l.endPts)},Re.prototype.displayWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible=1);return l},Re.prototype.hideWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible=0);return l},Re.prototype.toggleWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&(c.windows[_].visible^=1);return l},Re.prototype.clearWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&c.windows[_].clearText();return l},Re.prototype.deleteWindows=function(l,c){var f=this.current708Packet.data,h=f[++l],m=this.getPts(l);this.flushDisplayed(m,c);for(var _=0;_<8;_++)h&1<<_&&c.windows[_].reset();return l},Re.prototype.setPenAttributes=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.penAttr;return h=f[++l],m.textTag=(h&240)>>4,m.offset=(h&12)>>2,m.penSize=h&3,h=f[++l],m.italics=(h&128)>>7,m.underline=(h&64)>>6,m.edgeType=(h&56)>>3,m.fontStyle=h&7,l},Re.prototype.setPenColor=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.penColor;return h=f[++l],m.fgOpacity=(h&192)>>6,m.fgRed=(h&48)>>4,m.fgGreen=(h&12)>>2,m.fgBlue=h&3,h=f[++l],m.bgOpacity=(h&192)>>6,m.bgRed=(h&48)>>4,m.bgGreen=(h&12)>>2,m.bgBlue=h&3,h=f[++l],m.edgeRed=(h&48)>>4,m.edgeGreen=(h&12)>>2,m.edgeBlue=h&3,l},Re.prototype.setPenLocation=function(l,c){var f=this.current708Packet.data,h=f[l],m=c.currentWindow.penLoc;return c.currentWindow.pendingNewLine=!0,h=f[++l],m.row=h&15,h=f[++l],m.column=h&63,l},Re.prototype.reset=function(l,c){var f=this.getPts(l);return this.flushDisplayed(f,c),this.initService(c.serviceNum,l)};var Ms={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},Fs=function(l){return l===null?"":(l=Ms[l]||l,String.fromCharCode(l))},Us=14,kp=[4352,4384,4608,4640,5376,5408,5632,5664,5888,5920,4096,4864,4896,5120,5152],Qi=function(){for(var l=[],c=Us+1;c--;)l.push({text:"",indent:0,offset:0});return l},Je=function(l,c){Je.prototype.init.call(this),this.field_=l||0,this.dataChannel_=c||0,this.name_="CC"+((this.field_<<1|this.dataChannel_)+1),this.setConstants(),this.reset(),this.push=function(f){var h,m,_,w,D;if(h=f.ccData&32639,h===this.lastControlCode_){this.lastControlCode_=null;return}if((h&61440)===4096?this.lastControlCode_=h:h!==this.PADDING_&&(this.lastControlCode_=null),_=h>>>8,w=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(f.pts),this.flushDisplayed(f.pts),m=this.displayed_,this.displayed_=this.nonDisplayed_,this.nonDisplayed_=m,this.startPts_=f.pts;else if(h===this.ROLL_UP_2_ROWS_)this.rollUpRows_=2,this.setRollUp(f.pts);else if(h===this.ROLL_UP_3_ROWS_)this.rollUpRows_=3,this.setRollUp(f.pts);else if(h===this.ROLL_UP_4_ROWS_)this.rollUpRows_=4,this.setRollUp(f.pts);else if(h===this.CARRIAGE_RETURN_)this.clearFormatting(f.pts),this.flushDisplayed(f.pts),this.shiftRowsUp_(),this.startPts_=f.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(f.pts),this.displayed_=Qi();else if(h===this.ERASE_NON_DISPLAYED_MEMORY_)this.nonDisplayed_=Qi();else if(h===this.RESUME_DIRECT_CAPTIONING_)this.mode_!=="paintOn"&&(this.flushDisplayed(f.pts),this.displayed_=Qi()),this.mode_="paintOn",this.startPts_=f.pts;else if(this.isSpecialCharacter(_,w))_=(_&3)<<8,D=Fs(_|w),this[this.mode_](f.pts,D),this.column_++;else if(this.isExtCharacter(_,w))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,D=Fs(_|w),this[this.mode_](f.pts,D),this.column_++;else if(this.isMidRowCode(_,w))this.clearFormatting(f.pts),this[this.mode_](f.pts," "),this.column_++,(w&14)===14&&this.addFormatting(f.pts,["i"]),(w&1)===1&&this.addFormatting(f.pts,["u"]);else if(this.isOffsetControlCode(_,w)){const O=w&3;this.nonDisplayed_[this.row_].offset=O,this.column_+=O}else if(this.isPAC(_,w)){var R=kp.indexOf(h&7968);if(this.mode_==="rollUp"&&(R-this.rollUpRows_+1<0&&(R=this.rollUpRows_-1),this.setRollUp(f.pts,R)),R!==this.row_&&R>=0&&R<=14&&(this.clearFormatting(f.pts),this.row_=R),w&1&&this.formatting_.indexOf("u")===-1&&this.addFormatting(f.pts,["u"]),(h&16)===16){const O=(h&14)>>1;this.column_=O*4,this.nonDisplayed_[this.row_].indent+=O}this.isColorPAC(w)&&(w&14)===14&&this.addFormatting(f.pts,["i"])}else this.isNormalChar(_)&&(w===0&&(w=null),D=Fs(_),D+=Fs(w),this[this.mode_](f.pts,D),this.column_+=D.length)}};Je.prototype=new si,Je.prototype.flushDisplayed=function(l){const c=h=>{this.trigger("log",{level:"warn",message:"Skipping a malformed 608 caption at index "+h+"."})},f=[];this.displayed_.forEach((h,m)=>{if(h&&h.text&&h.text.length){try{h.text=h.text.trim()}catch{c(m)}h.text.length&&f.push({text:h.text,line:m+1,position:10+Math.min(70,h.indent*10)+h.offset*2.5})}else h==null&&c(m)}),f.length&&this.trigger("data",{startPts:this.startPts_,endPts:l,content:f,stream:this.name_})},Je.prototype.reset=function(){this.mode_="popOn",this.topRow_=0,this.startPts_=0,this.displayed_=Qi(),this.nonDisplayed_=Qi(),this.lastControlCode_=null,this.column_=0,this.row_=Us,this.rollUpRows_=2,this.formatting_=[]},Je.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},Je.prototype.isSpecialCharacter=function(l,c){return l===this.EXT_&&c>=48&&c<=63},Je.prototype.isExtCharacter=function(l,c){return(l===this.EXT_+1||l===this.EXT_+2)&&c>=32&&c<=63},Je.prototype.isMidRowCode=function(l,c){return l===this.EXT_&&c>=32&&c<=47},Je.prototype.isOffsetControlCode=function(l,c){return l===this.OFFSET_&&c>=33&&c<=35},Je.prototype.isPAC=function(l,c){return l>=this.BASE_&&l<this.BASE_+8&&c>=64&&c<=127},Je.prototype.isColorPAC=function(l){return l>=64&&l<=79||l>=96&&l<=127},Je.prototype.isNormalChar=function(l){return l>=32&&l<=127},Je.prototype.setRollUp=function(l,c){if(this.mode_!=="rollUp"&&(this.row_=Us,this.mode_="rollUp",this.flushDisplayed(l),this.nonDisplayed_=Qi(),this.displayed_=Qi()),c!==void 0&&c!==this.row_)for(var f=0;f<this.rollUpRows_;f++)this.displayed_[c-f]=this.displayed_[this.row_-f],this.displayed_[this.row_-f]={text:"",indent:0,offset:0};c===void 0&&(c=this.row_),this.topRow_=c-this.rollUpRows_+1},Je.prototype.addFormatting=function(l,c){this.formatting_=this.formatting_.concat(c);var f=c.reduce(function(h,m){return h+"<"+m+">"},"");this[this.mode_](l,f)},Je.prototype.clearFormatting=function(l){if(this.formatting_.length){var c=this.formatting_.reverse().reduce(function(f,h){return f+"</"+h+">"},"");this.formatting_=[],this[this.mode_](l,c)}},Je.prototype.popOn=function(l,c){var f=this.nonDisplayed_[this.row_].text;f+=c,this.nonDisplayed_[this.row_].text=f},Je.prototype.rollUp=function(l,c){var f=this.displayed_[this.row_].text;f+=c,this.displayed_[this.row_].text=f},Je.prototype.shiftRowsUp_=function(){var l;for(l=0;l<this.topRow_;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.row_+1;l<Us+1;l++)this.displayed_[l]={text:"",indent:0,offset:0};for(l=this.topRow_;l<this.row_;l++)this.displayed_[l]=this.displayed_[l+1];this.displayed_[this.row_]={text:"",indent:0,offset:0}},Je.prototype.paintOn=function(l,c){var f=this.displayed_[this.row_].text;f+=c,this.displayed_[this.row_].text=f};var Dl={CaptionStream:st,Cea608Stream:Je,Cea708Stream:Re},$s={H264_STREAM_TYPE:27,ADTS_STREAM_TYPE:15,METADATA_STREAM_TYPE:21},Pp=t,Rp=8589934592,Lp=4294967296,Il="shared",pa=function(l,c){var f=1;for(l>c&&(f=-1);Math.abs(c-l)>Lp;)l+=f*Rp;return l},ma=function(l){var c,f;ma.prototype.init.call(this),this.type_=l||Il,this.push=function(h){if(h.type==="metadata"){this.trigger("data",h);return}this.type_!==Il&&h.type!==this.type_||(f===void 0&&(f=h.dts),h.dts=pa(h.dts,f),h.pts=pa(h.pts,f),c=h.dts,this.trigger("data",h))},this.flush=function(){f=c,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.discontinuity=function(){f=void 0,c=void 0},this.reset=function(){this.discontinuity(),this.trigger("reset")}};ma.prototype=new Pp;var kl={TimestampRolloverStream:ma,handleRollover:pa},Np=(l,c,f)=>{if(!l)return-1;for(var h=f;h<l.length;h++)if(l[h]===c)return h;return-1},Op={typedArrayIndexOf:Np},js=Op.typedArrayIndexOf,qs={Utf8:3},Pl=function(l,c,f){var h,m="";for(h=c;h<f;h++)m+="%"+("00"+l[h].toString(16)).slice(-2);return m},Kr=function(l,c,f){return decodeURIComponent(Pl(l,c,f))},Xr=function(l,c,f){return unescape(Pl(l,c,f))},Yr=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Qr={APIC:function(l){var c=1,f,h,m="-->";l.data[0]===qs.Utf8&&(f=js(l.data,0,c),!(f<0)&&(l.mimeType=Xr(l.data,c,f),c=f+1,l.pictureType=l.data[c],c++,h=js(l.data,0,c),!(h<0)&&(l.description=Kr(l.data,c,h),c=h+1,l.mimeType===m?l.url=Xr(l.data,c,l.data.length):l.pictureData=l.data.subarray(c,l.data.length))))},"T*":function(l){l.data[0]===qs.Utf8&&(l.value=Kr(l.data,1,l.data.length).replace(/\0*$/,""),l.values=l.value.split("\0"))},TXXX:function(l){var c;l.data[0]===qs.Utf8&&(c=js(l.data,0,1),c!==-1&&(l.description=Kr(l.data,1,c),l.value=Kr(l.data,c+1,l.data.length).replace(/\0*$/,""),l.data=l.value))},"W*":function(l){l.url=Xr(l.data,0,l.data.length).replace(/\0.*$/,"")},WXXX:function(l){var c;l.data[0]===qs.Utf8&&(c=js(l.data,0,1),c!==-1&&(l.description=Kr(l.data,1,c),l.url=Xr(l.data,c+1,l.data.length).replace(/\0.*$/,"")))},PRIV:function(l){var c;for(c=0;c<l.data.length;c++)if(l.data[c]===0){l.owner=Xr(l.data,0,c);break}l.privateData=l.data.subarray(c+1),l.data=l.privateData}},Bp=function(l){var c,f,h=10,m=0,_=[];if(!(l.length<10||l[0]!==73||l[1]!==68||l[2]!==51)){m=Yr(l.subarray(6,10)),m+=10;var w=l[5]&64;w&&(h+=4,h+=Yr(l.subarray(10,14)),m-=Yr(l.subarray(16,20)));do{if(c=Yr(l.subarray(h+4,h+8)),c<1)break;f=String.fromCharCode(l[h],l[h+1],l[h+2],l[h+3]);var D={id:f,data:l.subarray(h+10,h+c+10)};D.key=D.id,Qr[D.id]?Qr[D.id](D):D.id[0]==="T"?Qr["T*"](D):D.id[0]==="W"&&Qr["W*"](D),_.push(D),h+=10,h+=c}while(h<m);return _}},Rl={parseId3Frames:Bp,parseSyncSafeInteger:Yr,frameParsers:Qr},Mp=t,Fp=$s,Mi=Rl,Vs;Vs=function(l){var c={descriptor:l&&l.descriptor},f=0,h=[],m=0,_;if(Vs.prototype.init.call(this),this.dispatchType=Fp.METADATA_STREAM_TYPE.toString(16),c.descriptor)for(_=0;_<c.descriptor.length;_++)this.dispatchType+=("00"+c.descriptor[_].toString(16)).slice(-2);this.push=function(w){var D,R,O,q,Z,me;if(w.type==="timed-metadata"){if(w.dataAlignmentIndicator&&(m=0,h.length=0),h.length===0&&(w.data.length<10||w.data[0]!==73||w.data[1]!==68||w.data[2]!==51)){this.trigger("log",{level:"warn",message:"Skipping unrecognized metadata packet"});return}if(h.push(w),m+=w.data.byteLength,h.length===1&&(f=Mi.parseSyncSafeInteger(w.data.subarray(6,10)),f+=10),!(m<f)){for(D={data:new Uint8Array(f),frames:[],pts:h[0].pts,dts:h[0].dts},Z=0;Z<f;)D.data.set(h[0].data.subarray(0,f-Z),Z),Z+=h[0].data.byteLength,m-=h[0].data.byteLength,h.shift();R=10,D.data[5]&64&&(R+=4,R+=Mi.parseSyncSafeInteger(D.data.subarray(10,14)),f-=Mi.parseSyncSafeInteger(D.data.subarray(16,20)));do{if(O=Mi.parseSyncSafeInteger(D.data.subarray(R+4,R+8)),O<1){this.trigger("log",{level:"warn",message:"Malformed ID3 frame encountered. Skipping remaining metadata parsing."});break}if(me=String.fromCharCode(D.data[R],D.data[R+1],D.data[R+2],D.data[R+3]),q={id:me,data:D.data.subarray(R+10,R+O+10)},q.key=q.id,Mi.frameParsers[q.id]?Mi.frameParsers[q.id](q):q.id[0]==="T"?Mi.frameParsers["T*"](q):q.id[0]==="W"&&Mi.frameParsers["W*"](q),q.owner==="com.apple.streaming.transportStreamTimestamp"){var re=q.data,ve=(re[3]&1)<<30|re[4]<<22|re[5]<<14|re[6]<<6|re[7]>>>2;ve*=4,ve+=re[7]&3,q.timeStamp=ve,D.pts===void 0&&D.dts===void 0&&(D.pts=q.timeStamp,D.dts=q.timeStamp),this.trigger("timestamp",q)}D.frames.push(q),R+=10,R+=O}while(R<f);this.trigger("data",D)}}}},Vs.prototype=new Mp;var Up=Vs,ga=t,ya=Dl,ni=$s,$p=kl.TimestampRolloverStream,Hs,Jr,zs,hr=188,_a=71;Hs=function(){var l=new Uint8Array(hr),c=0;Hs.prototype.init.call(this),this.push=function(f){var h=0,m=hr,_;for(c?(_=new Uint8Array(f.byteLength+c),_.set(l.subarray(0,c)),_.set(f,c),c=0):_=f;m<_.byteLength;){if(_[h]===_a&&_[m]===_a){this.trigger("data",_.subarray(h,m)),h+=hr,m+=hr;continue}h++,m++}h<_.byteLength&&(l.set(_.subarray(h),0),c=_.byteLength-h)},this.flush=function(){c===hr&&l[0]===_a&&(this.trigger("data",l),c=0),this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")},this.reset=function(){c=0,this.trigger("reset")}},Hs.prototype=new ga,Jr=function(){var l,c,f,h;Jr.prototype.init.call(this),h=this,this.packetsWaitingForPmt=[],this.programMapTable=void 0,l=function(m,_){var w=0;_.payloadUnitStartIndicator&&(w+=m[w]+1),_.type==="pat"?c(m.subarray(w),_):f(m.subarray(w),_)},c=function(m,_){_.section_number=m[7],_.last_section_number=m[8],h.pmtPid=(m[10]&31)<<8|m[11],_.pmtPid=h.pmtPid},f=function(m,_){var w,D,R,O;if(m[5]&1){for(h.programMapTable={video:null,audio:null,"timed-metadata":{}},w=(m[1]&15)<<8|m[2],D=3+w-4,R=(m[10]&15)<<8|m[11],O=12+R;O<D;){var q=m[O],Z=(m[O+1]&31)<<8|m[O+2];q===ni.H264_STREAM_TYPE&&h.programMapTable.video===null?h.programMapTable.video=Z:q===ni.ADTS_STREAM_TYPE&&h.programMapTable.audio===null?h.programMapTable.audio=Z:q===ni.METADATA_STREAM_TYPE&&(h.programMapTable["timed-metadata"][Z]=q),O+=((m[O+3]&15)<<8|m[O+4])+5}_.programMapTable=h.programMapTable}},this.push=function(m){var _={},w=4;if(_.payloadUnitStartIndicator=!!(m[1]&64),_.pid=m[1]&31,_.pid<<=8,_.pid|=m[2],(m[3]&48)>>>4>1&&(w+=m[w]+1),_.pid===0)_.type="pat",l(m.subarray(w),_),this.trigger("data",_);else if(_.pid===this.pmtPid)for(_.type="pmt",l(m.subarray(w),_),this.trigger("data",_);this.packetsWaitingForPmt.length;)this.processPes_.apply(this,this.packetsWaitingForPmt.shift());else this.programMapTable===void 0?this.packetsWaitingForPmt.push([m,w,_]):this.processPes_(m,w,_)},this.processPes_=function(m,_,w){w.pid===this.programMapTable.video?w.streamType=ni.H264_STREAM_TYPE:w.pid===this.programMapTable.audio?w.streamType=ni.ADTS_STREAM_TYPE:w.streamType=this.programMapTable["timed-metadata"][w.pid],w.type="pes",w.data=m.subarray(_),this.trigger("data",w)}},Jr.prototype=new ga,Jr.STREAM_TYPES={h264:27,adts:15},zs=function(){var l=this,c=!1,f={data:[],size:0},h={data:[],size:0},m={data:[],size:0},_,w=function(R,O){var q;const Z=R[0]<<16|R[1]<<8|R[2];O.data=new Uint8Array,Z===1&&(O.packetLength=6+(R[4]<<8|R[5]),O.dataAlignmentIndicator=(R[6]&4)!==0,q=R[7],q&192&&(O.pts=(R[9]&14)<<27|(R[10]&255)<<20|(R[11]&254)<<12|(R[12]&255)<<5|(R[13]&254)>>>3,O.pts*=4,O.pts+=(R[13]&6)>>>1,O.dts=O.pts,q&64&&(O.dts=(R[14]&14)<<27|(R[15]&255)<<20|(R[16]&254)<<12|(R[17]&255)<<5|(R[18]&254)>>>3,O.dts*=4,O.dts+=(R[18]&6)>>>1)),O.data=R.subarray(9+R[8]))},D=function(R,O,q){var Z=new Uint8Array(R.size),me={type:O},re=0,ve=0,ke=!1,mt;if(!(!R.data.length||R.size<9)){for(me.trackId=R.data[0].pid,re=0;re<R.data.length;re++)mt=R.data[re],Z.set(mt.data,ve),ve+=mt.data.byteLength;w(Z,me),ke=O==="video"||me.packetLength<=R.size,(q||ke)&&(R.size=0,R.data.length=0),ke&&l.trigger("data",me)}};zs.prototype.init.call(this),this.push=function(R){({pat:function(){},pes:function(){var O,q;switch(R.streamType){case ni.H264_STREAM_TYPE:O=f,q="video";break;case ni.ADTS_STREAM_TYPE:O=h,q="audio";break;case ni.METADATA_STREAM_TYPE:O=m,q="timed-metadata";break;default:return}R.payloadUnitStartIndicator&&D(O,q,!0),O.data.push(R),O.size+=R.data.byteLength},pmt:function(){var O={type:"metadata",tracks:[]};_=R.programMapTable,_.video!==null&&O.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&O.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),c=!0,l.trigger("data",O)}})[R.type]()},this.reset=function(){f.size=0,f.data.length=0,h.size=0,h.data.length=0,this.trigger("reset")},this.flushStreams_=function(){D(f,"video"),D(h,"audio"),D(m,"timed-metadata")},this.flush=function(){if(!c&&_){var R={type:"metadata",tracks:[]};_.video!==null&&R.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.video,codec:"avc",type:"video"}),_.audio!==null&&R.tracks.push({timelineStartInfo:{baseMediaDecodeTime:0},id:+_.audio,codec:"adts",type:"audio"}),l.trigger("data",R)}c=!1,this.flushStreams_(),this.trigger("done")}},zs.prototype=new ga;var Ll={PAT_PID:0,MP2T_PACKET_LENGTH:hr,TransportPacketStream:Hs,TransportParseStream:Jr,ElementaryStream:zs,TimestampRolloverStream:$p,CaptionStream:ya.CaptionStream,Cea608Stream:ya.Cea608Stream,Cea708Stream:ya.Cea708Stream,MetadataStream:Up};for(var Ta in ni)ni.hasOwnProperty(Ta)&&(Ll[Ta]=ni[Ta]);var jp=Ll,qp=t,Vp=y.ONE_SECOND_IN_TS,Ws,Nl=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];Ws=function(l){var c,f=0;Ws.prototype.init.call(this),this.skipWarn_=function(h,m){this.trigger("log",{level:"warn",message:`adts skiping bytes ${h} to ${m} in frame ${f} outside syncword`})},this.push=function(h){var m=0,_,w,D,R,O;if(l||(f=0),h.type==="audio"){c&&c.length?(D=c,c=new Uint8Array(D.byteLength+h.data.byteLength),c.set(D),c.set(h.data,D.byteLength)):c=h.data;for(var q;m+7<c.length;){if(c[m]!==255||(c[m+1]&246)!==240){typeof q!="number"&&(q=m),m++;continue}if(typeof q=="number"&&(this.skipWarn_(q,m),q=null),w=(~c[m+1]&1)*2,_=(c[m+3]&3)<<11|c[m+4]<<3|(c[m+5]&224)>>5,R=((c[m+6]&3)+1)*1024,O=R*Vp/Nl[(c[m+2]&60)>>>2],c.byteLength-m<_)break;this.trigger("data",{pts:h.pts+f*O,dts:h.dts+f*O,sampleCount:R,audioobjecttype:(c[m+2]>>>6&3)+1,channelcount:(c[m+2]&1)<<2|(c[m+3]&192)>>>6,samplerate:Nl[(c[m+2]&60)>>>2],samplingfrequencyindex:(c[m+2]&60)>>>2,samplesize:16,data:c.subarray(m+7+w,m+_)}),f++,m+=_}typeof q=="number"&&(this.skipWarn_(q,m),q=null),c=c.subarray(m)}},this.flush=function(){f=0,this.trigger("done")},this.reset=function(){c=void 0,this.trigger("reset")},this.endTimeline=function(){c=void 0,this.trigger("endedtimeline")}},Ws.prototype=new qp;var Hp=Ws,Ol;Ol=function(l){var c=l.byteLength,f=0,h=0;this.length=function(){return 8*c},this.bitsAvailable=function(){return 8*c+h},this.loadWord=function(){var m=l.byteLength-c,_=new Uint8Array(4),w=Math.min(4,c);if(w===0)throw new Error("no bytes available");_.set(l.subarray(m,m+w)),f=new DataView(_.buffer).getUint32(0),h=w*8,c-=w},this.skipBits=function(m){var _;h>m?(f<<=m,h-=m):(m-=h,_=Math.floor(m/8),m-=_*8,c-=_,this.loadWord(),f<<=m,h-=m)},this.readBits=function(m){var _=Math.min(h,m),w=f>>>32-_;return h-=_,h>0?f<<=_:c>0&&this.loadWord(),_=m-_,_>0?w<<_|this.readBits(_):w},this.skipLeadingZeros=function(){var m;for(m=0;m<h;++m)if((f&2147483648>>>m)!==0)return f<<=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 zp=Ol,Bl=t,Wp=zp,Gs,Ks,Ml;Ks=function(){var l=0,c,f;Ks.prototype.init.call(this),this.push=function(h){var m;f?(m=new Uint8Array(f.byteLength+h.data.byteLength),m.set(f),m.set(h.data,f.byteLength),f=m):f=h.data;for(var _=f.byteLength;l<_-3;l++)if(f[l+2]===1){c=l+5;break}for(;c<_;)switch(f[c]){case 0:if(f[c-1]!==0){c+=2;break}else if(f[c-2]!==0){c++;break}l+3!==c-2&&this.trigger("data",f.subarray(l+3,c-2));do c++;while(f[c]!==1&&c<_);l=c-2,c+=3;break;case 1:if(f[c-1]!==0||f[c-2]!==0){c+=3;break}this.trigger("data",f.subarray(l+3,c-2)),l=c-2,c+=3;break;default:c+=3;break}f=f.subarray(l),c-=l,l=0},this.reset=function(){f=null,l=0,this.trigger("reset")},this.flush=function(){f&&f.byteLength>3&&this.trigger("data",f.subarray(l+3)),f=null,l=0,this.trigger("done")},this.endTimeline=function(){this.flush(),this.trigger("endedtimeline")}},Ks.prototype=new Bl,Ml={100:!0,110:!0,122:!0,244:!0,44:!0,83:!0,86:!0,118:!0,128:!0,138:!0,139:!0,134:!0},Gs=function(){var l=new Ks,c,f,h,m,_,w,D;Gs.prototype.init.call(this),c=this,this.push=function(R){R.type==="video"&&(f=R.trackId,h=R.pts,m=R.dts,l.push(R))},l.on("data",function(R){var O={trackId:f,pts:h,dts:m,data:R,nalUnitTypeCode:R[0]&31};switch(O.nalUnitTypeCode){case 5:O.nalUnitType="slice_layer_without_partitioning_rbsp_idr";break;case 6:O.nalUnitType="sei_rbsp",O.escapedRBSP=_(R.subarray(1));break;case 7:O.nalUnitType="seq_parameter_set_rbsp",O.escapedRBSP=_(R.subarray(1)),O.config=w(O.escapedRBSP);break;case 8:O.nalUnitType="pic_parameter_set_rbsp";break;case 9:O.nalUnitType="access_unit_delimiter_rbsp";break}c.trigger("data",O)}),l.on("done",function(){c.trigger("done")}),l.on("partialdone",function(){c.trigger("partialdone")}),l.on("reset",function(){c.trigger("reset")}),l.on("endedtimeline",function(){c.trigger("endedtimeline")}),this.flush=function(){l.flush()},this.partialFlush=function(){l.partialFlush()},this.reset=function(){l.reset()},this.endTimeline=function(){l.endTimeline()},D=function(R,O){var q=8,Z=8,me,re;for(me=0;me<R;me++)Z!==0&&(re=O.readExpGolomb(),Z=(q+re+256)%256),q=Z===0?q:Z},_=function(R){for(var O=R.byteLength,q=[],Z=1,me,re;Z<O-2;)R[Z]===0&&R[Z+1]===0&&R[Z+2]===3?(q.push(Z+2),Z+=2):Z++;if(q.length===0)return R;me=O-q.length,re=new Uint8Array(me);var ve=0;for(Z=0;Z<me;ve++,Z++)ve===q[0]&&(ve++,q.shift()),re[Z]=R[ve];return re},w=function(R){var O=0,q=0,Z=0,me=0,re,ve,ke,mt,Ut,Ui,ns,as,os,ls,on,Ke=[1,1],us,oi;if(re=new Wp(R),ve=re.readUnsignedByte(),mt=re.readUnsignedByte(),ke=re.readUnsignedByte(),re.skipUnsignedExpGolomb(),Ml[ve]&&(Ut=re.readUnsignedExpGolomb(),Ut===3&&re.skipBits(1),re.skipUnsignedExpGolomb(),re.skipUnsignedExpGolomb(),re.skipBits(1),re.readBoolean()))for(on=Ut!==3?8:12,oi=0;oi<on;oi++)re.readBoolean()&&(oi<6?D(16,re):D(64,re));if(re.skipUnsignedExpGolomb(),Ui=re.readUnsignedExpGolomb(),Ui===0)re.readUnsignedExpGolomb();else if(Ui===1)for(re.skipBits(1),re.skipExpGolomb(),re.skipExpGolomb(),ns=re.readUnsignedExpGolomb(),oi=0;oi<ns;oi++)re.skipExpGolomb();if(re.skipUnsignedExpGolomb(),re.skipBits(1),as=re.readUnsignedExpGolomb(),os=re.readUnsignedExpGolomb(),ls=re.readBits(1),ls===0&&re.skipBits(1),re.skipBits(1),re.readBoolean()&&(O=re.readUnsignedExpGolomb(),q=re.readUnsignedExpGolomb(),Z=re.readUnsignedExpGolomb(),me=re.readUnsignedExpGolomb()),re.readBoolean()&&re.readBoolean()){switch(us=re.readUnsignedByte(),us){case 1:Ke=[1,1];break;case 2:Ke=[12,11];break;case 3:Ke=[10,11];break;case 4:Ke=[16,11];break;case 5:Ke=[40,33];break;case 6:Ke=[24,11];break;case 7:Ke=[20,11];break;case 8:Ke=[32,11];break;case 9:Ke=[80,33];break;case 10:Ke=[18,11];break;case 11:Ke=[15,11];break;case 12:Ke=[64,33];break;case 13:Ke=[160,99];break;case 14:Ke=[4,3];break;case 15:Ke=[3,2];break;case 16:Ke=[2,1];break;case 255:{Ke=[re.readUnsignedByte()<<8|re.readUnsignedByte(),re.readUnsignedByte()<<8|re.readUnsignedByte()];break}}Ke&&Ke[0]/Ke[1]}return{profileIdc:ve,levelIdc:ke,profileCompatibility:mt,width:(as+1)*16-O*2-q*2,height:(2-ls)*(os+1)*16-Z*2-me*2,sarRatio:Ke}}},Gs.prototype=new Bl;var Gp={H264Stream:Gs},Kp=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],Fl=function(l,c){var f=l[c+6]<<21|l[c+7]<<14|l[c+8]<<7|l[c+9],h=l[c+5],m=(h&16)>>4;return f=f>=0?f:0,m?f+20:f+10},Ul=function(l,c){return l.length-c<10||l[c]!==73||l[c+1]!==68||l[c+2]!==51?c:(c+=Fl(l,c),Ul(l,c))},Xp=function(l){var c=Ul(l,0);return l.length>=c+2&&(l[c]&255)===255&&(l[c+1]&240)===240&&(l[c+1]&22)===16},$l=function(l){return l[0]<<21|l[1]<<14|l[2]<<7|l[3]},Yp=function(l,c,f){var h,m="";for(h=c;h<f;h++)m+="%"+("00"+l[h].toString(16)).slice(-2);return m},Qp=function(l,c,f){return unescape(Yp(l,c,f))},Jp=function(l,c){var f=(l[c+5]&224)>>5,h=l[c+4]<<3,m=l[c+3]&6144;return m|h|f},Zp=function(l,c){return l[c]===73&&l[c+1]===68&&l[c+2]===51?"timed-metadata":l[c]&!0&&(l[c+1]&240)===240?"audio":null},em=function(l){for(var c=0;c+5<l.length;){if(l[c]!==255||(l[c+1]&246)!==240){c++;continue}return Kp[(l[c+2]&60)>>>2]}return null},tm=function(l){var c,f,h,m;c=10,l[5]&64&&(c+=4,c+=$l(l.subarray(10,14)));do{if(f=$l(l.subarray(c+4,c+8)),f<1)return null;if(m=String.fromCharCode(l[c],l[c+1],l[c+2],l[c+3]),m==="PRIV"){h=l.subarray(c+10,c+f+10);for(var _=0;_<h.byteLength;_++)if(h[_]===0){var w=Qp(h,0,_);if(w==="com.apple.streaming.transportStreamTimestamp"){var D=h.subarray(_+1),R=(D[3]&1)<<30|D[4]<<22|D[5]<<14|D[6]<<6|D[7]>>>2;return R*=4,R+=D[7]&3,R}break}}c+=10,c+=f}while(c<l.byteLength);return null},va={isLikelyAacData:Xp,parseId3TagSize:Fl,parseAdtsSize:Jp,parseType:Zp,parseSampleRate:em,parseAacTimestamp:tm},im=t,jl=va,Xs;Xs=function(){var l=new Uint8Array,c=0;Xs.prototype.init.call(this),this.setTimestamp=function(f){c=f},this.push=function(f){var h=0,m=0,_,w,D,R;for(l.length?(R=l.length,l=new Uint8Array(f.byteLength+R),l.set(l.subarray(0,R)),l.set(f,R)):l=f;l.length-m>=3;){if(l[m]===73&&l[m+1]===68&&l[m+2]===51){if(l.length-m<10||(h=jl.parseId3TagSize(l,m),m+h>l.length))break;w={type:"timed-metadata",data:l.subarray(m,m+h)},this.trigger("data",w),m+=h;continue}else if((l[m]&255)===255&&(l[m+1]&240)===240){if(l.length-m<7||(h=jl.parseAdtsSize(l,m),m+h>l.length))break;D={type:"audio",data:l.subarray(m,m+h),pts:c,dts:c},this.trigger("data",D),m+=h;continue}m++}_=l.length-m,_>0?l=l.subarray(m):l=new Uint8Array},this.reset=function(){l=new Uint8Array,this.trigger("reset")},this.endTimeline=function(){l=new Uint8Array,this.trigger("endedtimeline")}},Xs.prototype=new im;var rm=Xs,sm=["audioobjecttype","channelcount","samplerate","samplingfrequencyindex","samplesize"],nm=sm,am=["width","height","profileIdc","levelIdc","profileCompatibility","sarRatio"],om=am,Ys=t,Zr=dt,es=Ht,Qs=Ue,ai=K,ki=jp,Js=y,ql=Hp,lm=Gp.H264Stream,um=rm,cm=va.isLikelyAacData,dm=y.ONE_SECOND_IN_TS,Vl=nm,Hl=om,Zs,ts,en,Ji,hm=function(l,c){c.stream=l,this.trigger("log",c)},zl=function(l,c){for(var f=Object.keys(c),h=0;h<f.length;h++){var m=f[h];m==="headOfPipeline"||!c[m].on||c[m].on("log",hm.bind(l,m))}},Wl=function(l,c){var f;if(l.length!==c.length)return!1;for(f=0;f<l.length;f++)if(l[f]!==c[f])return!1;return!0},Gl=function(l,c,f,h,m,_){var w=f-c,D=h-c,R=m-f;return{start:{dts:l,pts:l+w},end:{dts:l+D,pts:l+R},prependedContentDuration:_,baseMediaDecodeTime:l}};ts=function(l,c){var f=[],h,m=0,_=0,w=1/0;c=c||{},h=c.firstSequenceNumber||0,ts.prototype.init.call(this),this.push=function(D){ai.collectDtsInfo(l,D),l&&Vl.forEach(function(R){l[R]=D[R]}),f.push(D)},this.setEarliestDts=function(D){m=D},this.setVideoBaseMediaDecodeTime=function(D){w=D},this.setAudioAppendStart=function(D){_=D},this.flush=function(){var D,R,O,q,Z,me,re;if(f.length===0){this.trigger("done","AudioSegmentStream");return}D=Qs.trimAdtsFramesByEarliestDts(f,l,m),l.baseMediaDecodeTime=ai.calculateTrackBaseMediaDecodeTime(l,c.keepOriginalTimestamps),re=Qs.prefixWithSilence(l,D,_,w),l.samples=Qs.generateSampleTable(D),O=Zr.mdat(Qs.concatenateFrameData(D)),f=[],R=Zr.moof(h,[l]),q=new Uint8Array(R.byteLength+O.byteLength),h++,q.set(R),q.set(O,R.byteLength),ai.clearDtsInfo(l),Z=Math.ceil(dm*1024/l.samplerate),D.length&&(me=D.length*Z,this.trigger("segmentTimingInfo",Gl(Js.audioTsToVideoTs(l.baseMediaDecodeTime,l.samplerate),D[0].dts,D[0].pts,D[0].dts+me,D[0].pts+me,re||0)),this.trigger("timingInfo",{start:D[0].pts,end:D[0].pts+me})),this.trigger("data",{track:l,boxes:q}),this.trigger("done","AudioSegmentStream")},this.reset=function(){ai.clearDtsInfo(l),f=[],this.trigger("reset")}},ts.prototype=new Ys,Zs=function(l,c){var f,h=[],m=[],_,w;c=c||{},f=c.firstSequenceNumber||0,Zs.prototype.init.call(this),delete l.minPTS,this.gopCache_=[],this.push=function(D){ai.collectDtsInfo(l,D),D.nalUnitType==="seq_parameter_set_rbsp"&&!_&&(_=D.config,l.sps=[D.data],Hl.forEach(function(R){l[R]=_[R]},this)),D.nalUnitType==="pic_parameter_set_rbsp"&&!w&&(w=D.data,l.pps=[D.data]),h.push(D)},this.flush=function(){for(var D,R,O,q,Z,me,re=0,ve,ke;h.length&&h[0].nalUnitType!=="access_unit_delimiter_rbsp";)h.shift();if(h.length===0){this.resetStream_(),this.trigger("done","VideoSegmentStream");return}if(D=es.groupNalsIntoFrames(h),O=es.groupFramesIntoGops(D),O[0][0].keyFrame||(R=this.getGopForFusion_(h[0],l),R?(re=R.duration,O.unshift(R),O.byteLength+=R.byteLength,O.nalCount+=R.nalCount,O.pts=R.pts,O.dts=R.dts,O.duration+=R.duration):O=es.extendFirstKeyFrame(O)),m.length){var mt;if(c.alignGopsAtEnd?mt=this.alignGopsAtEnd_(O):mt=this.alignGopsAtStart_(O),!mt){this.gopCache_.unshift({gop:O.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.resetStream_(),this.trigger("done","VideoSegmentStream");return}ai.clearDtsInfo(l),O=mt}ai.collectDtsInfo(l,O),l.samples=es.generateSampleTable(O),Z=Zr.mdat(es.concatenateNalData(O)),l.baseMediaDecodeTime=ai.calculateTrackBaseMediaDecodeTime(l,c.keepOriginalTimestamps),this.trigger("processedGopsInfo",O.map(function(Ut){return{pts:Ut.pts,dts:Ut.dts,byteLength:Ut.byteLength}})),ve=O[0],ke=O[O.length-1],this.trigger("segmentTimingInfo",Gl(l.baseMediaDecodeTime,ve.dts,ve.pts,ke.dts+ke.duration,ke.pts+ke.duration,re)),this.trigger("timingInfo",{start:O[0].pts,end:O[O.length-1].pts+O[O.length-1].duration}),this.gopCache_.unshift({gop:O.pop(),pps:l.pps,sps:l.sps}),this.gopCache_.length=Math.min(6,this.gopCache_.length),h=[],this.trigger("baseMediaDecodeTime",l.baseMediaDecodeTime),this.trigger("timelineStartInfo",l.timelineStartInfo),q=Zr.moof(f,[l]),me=new Uint8Array(q.byteLength+Z.byteLength),f++,me.set(q),me.set(Z,q.byteLength),this.trigger("data",{track:l,boxes:me}),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(){ai.clearDtsInfo(l),_=void 0,w=void 0},this.getGopForFusion_=function(D){var R=45e3,O=1/0,q,Z,me,re,ve;for(ve=0;ve<this.gopCache_.length;ve++)re=this.gopCache_[ve],me=re.gop,!(!(l.pps&&Wl(l.pps[0],re.pps[0]))||!(l.sps&&Wl(l.sps[0],re.sps[0])))&&(me.dts<l.timelineStartInfo.dts||(q=D.dts-me.dts-me.duration,q>=-1e4&&q<=R&&(!Z||O>q)&&(Z=re,O=q)));return Z?Z.gop:null},this.alignGopsAtStart_=function(D){var R,O,q,Z,me,re,ve,ke;for(me=D.byteLength,re=D.nalCount,ve=D.duration,R=O=0;R<m.length&&O<D.length&&(q=m[R],Z=D[O],q.pts!==Z.pts);){if(Z.pts>q.pts){R++;continue}O++,me-=Z.byteLength,re-=Z.nalCount,ve-=Z.duration}return O===0?D:O===D.length?null:(ke=D.slice(O),ke.byteLength=me,ke.duration=ve,ke.nalCount=re,ke.pts=ke[0].pts,ke.dts=ke[0].dts,ke)},this.alignGopsAtEnd_=function(D){var R,O,q,Z,me,re;for(R=m.length-1,O=D.length-1,me=null,re=!1;R>=0&&O>=0;){if(q=m[R],Z=D[O],q.pts===Z.pts){re=!0;break}if(q.pts>Z.pts){R--;continue}R===m.length-1&&(me=O),O--}if(!re&&me===null)return null;var ve;if(re?ve=O:ve=me,ve===0)return D;var ke=D.slice(ve),mt=ke.reduce(function(Ut,Ui){return Ut.byteLength+=Ui.byteLength,Ut.duration+=Ui.duration,Ut.nalCount+=Ui.nalCount,Ut},{byteLength:0,duration:0,nalCount:0});return ke.byteLength=mt.byteLength,ke.duration=mt.duration,ke.nalCount=mt.nalCount,ke.pts=ke[0].pts,ke.dts=ke[0].dts,ke},this.alignGopsWith=function(D){m=D}},Zs.prototype=new Ys,Ji=function(l,c){this.numberOfTracks=0,this.metadataStream=c,l=l||{},typeof l.remux<"u"?this.remuxTracks=!!l.remux:this.remuxTracks=!0,typeof l.keepOriginalTimestamps=="boolean"?this.keepOriginalTimestamps=l.keepOriginalTimestamps:this.keepOriginalTimestamps=!1,this.pendingTracks=[],this.videoTrack=null,this.pendingBoxes=[],this.pendingCaptions=[],this.pendingMetadata=[],this.pendingBytes=0,this.emittedTracks=0,Ji.prototype.init.call(this),this.push=function(f){if(f.content||f.text)return this.pendingCaptions.push(f);if(f.frames)return this.pendingMetadata.push(f);this.pendingTracks.push(f.track),this.pendingBytes+=f.boxes.byteLength,f.track.type==="video"&&(this.videoTrack=f.track,this.pendingBoxes.push(f.boxes)),f.track.type==="audio"&&(this.audioTrack=f.track,this.pendingBoxes.unshift(f.boxes))}},Ji.prototype=new Ys,Ji.prototype.flush=function(l){var c=0,f={captions:[],captionStreams:{},metadata:[],info:{}},h,m,_,w=0,D;if(this.pendingTracks.length<this.numberOfTracks){if(l!=="VideoSegmentStream"&&l!=="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?(w=this.videoTrack.timelineStartInfo.pts,Hl.forEach(function(R){f.info[R]=this.videoTrack[R]},this)):this.audioTrack&&(w=this.audioTrack.timelineStartInfo.pts,Vl.forEach(function(R){f.info[R]=this.audioTrack[R]},this)),this.videoTrack||this.audioTrack){for(this.pendingTracks.length===1?f.type=this.pendingTracks[0].type:f.type="combined",this.emittedTracks+=this.pendingTracks.length,_=Zr.initSegment(this.pendingTracks),f.initSegment=new Uint8Array(_.byteLength),f.initSegment.set(_),f.data=new Uint8Array(this.pendingBytes),D=0;D<this.pendingBoxes.length;D++)f.data.set(this.pendingBoxes[D],c),c+=this.pendingBoxes[D].byteLength;for(D=0;D<this.pendingCaptions.length;D++)h=this.pendingCaptions[D],h.startTime=Js.metadataTsToSeconds(h.startPts,w,this.keepOriginalTimestamps),h.endTime=Js.metadataTsToSeconds(h.endPts,w,this.keepOriginalTimestamps),f.captionStreams[h.stream]=!0,f.captions.push(h);for(D=0;D<this.pendingMetadata.length;D++)m=this.pendingMetadata[D],m.cueTime=Js.metadataTsToSeconds(m.pts,w,this.keepOriginalTimestamps),f.metadata.push(m);for(f.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",f),D=0;D<f.captions.length;D++)h=f.captions[D],this.trigger("caption",h);for(D=0;D<f.metadata.length;D++)m=f.metadata[D],this.trigger("id3Frame",m)}this.emittedTracks>=this.numberOfTracks&&(this.trigger("done"),this.emittedTracks=0)},Ji.prototype.setRemux=function(l){this.remuxTracks=l},en=function(l){var c=this,f=!0,h,m;en.prototype.init.call(this),l=l||{},this.baseMediaDecodeTime=l.baseMediaDecodeTime||0,this.transmuxPipeline_={},this.setupAacPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="aac",_.metadataStream=new ki.MetadataStream,_.aacStream=new um,_.audioTimestampRolloverStream=new ki.TimestampRolloverStream("audio"),_.timedMetadataTimestampRolloverStream=new ki.TimestampRolloverStream("timed-metadata"),_.adtsStream=new ql,_.coalesceStream=new Ji(l,_.metadataStream),_.headOfPipeline=_.aacStream,_.aacStream.pipe(_.audioTimestampRolloverStream).pipe(_.adtsStream),_.aacStream.pipe(_.timedMetadataTimestampRolloverStream).pipe(_.metadataStream).pipe(_.coalesceStream),_.metadataStream.on("timestamp",function(w){_.aacStream.setTimestamp(w.timeStamp)}),_.aacStream.on("data",function(w){w.type!=="timed-metadata"&&w.type!=="audio"||_.audioSegmentStream||(m=m||{timelineStartInfo:{baseMediaDecodeTime:c.baseMediaDecodeTime},codec:"adts",type:"audio"},_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new ts(m,l),_.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")),zl(this,_)},this.setupTsPipeline=function(){var _={};this.transmuxPipeline_=_,_.type="ts",_.metadataStream=new ki.MetadataStream,_.packetStream=new ki.TransportPacketStream,_.parseStream=new ki.TransportParseStream,_.elementaryStream=new ki.ElementaryStream,_.timestampRolloverStream=new ki.TimestampRolloverStream,_.adtsStream=new ql,_.h264Stream=new lm,_.captionStream=new ki.CaptionStream(l),_.coalesceStream=new Ji(l,_.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(w){var D;if(w.type==="metadata"){for(D=w.tracks.length;D--;)!h&&w.tracks[D].type==="video"?(h=w.tracks[D],h.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime):!m&&w.tracks[D].type==="audio"&&(m=w.tracks[D],m.timelineStartInfo.baseMediaDecodeTime=c.baseMediaDecodeTime);h&&!_.videoSegmentStream&&(_.coalesceStream.numberOfTracks++,_.videoSegmentStream=new Zs(h,l),_.videoSegmentStream.on("log",c.getLogTrigger_("videoSegmentStream")),_.videoSegmentStream.on("timelineStartInfo",function(R){m&&!l.keepOriginalTimestamps&&(m.timelineStartInfo=R,_.audioSegmentStream.setEarliestDts(R.dts-c.baseMediaDecodeTime))}),_.videoSegmentStream.on("processedGopsInfo",c.trigger.bind(c,"gopInfo")),_.videoSegmentStream.on("segmentTimingInfo",c.trigger.bind(c,"videoSegmentTimingInfo")),_.videoSegmentStream.on("baseMediaDecodeTime",function(R){m&&_.audioSegmentStream.setVideoBaseMediaDecodeTime(R)}),_.videoSegmentStream.on("timingInfo",c.trigger.bind(c,"videoTimingInfo")),_.h264Stream.pipe(_.videoSegmentStream).pipe(_.coalesceStream)),m&&!_.audioSegmentStream&&(_.coalesceStream.numberOfTracks++,_.audioSegmentStream=new ts(m,l),_.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(w){w.dispatchType=_.metadataStream.dispatchType,c.trigger("id3Frame",w)}),_.coalesceStream.on("caption",this.trigger.bind(this,"caption")),_.coalesceStream.on("done",this.trigger.bind(this,"done")),zl(this,_)},this.setBaseMediaDecodeTime=function(_){var w=this.transmuxPipeline_;l.keepOriginalTimestamps||(this.baseMediaDecodeTime=_),m&&(m.timelineStartInfo.dts=void 0,m.timelineStartInfo.pts=void 0,ai.clearDtsInfo(m),w.audioTimestampRolloverStream&&w.audioTimestampRolloverStream.discontinuity()),h&&(w.videoSegmentStream&&(w.videoSegmentStream.gopCache_=[]),h.timelineStartInfo.dts=void 0,h.timelineStartInfo.pts=void 0,ai.clearDtsInfo(h),w.captionStream.reset()),w.timestampRolloverStream&&w.timestampRolloverStream.discontinuity()},this.setAudioAppendStart=function(_){m&&this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(_)},this.setRemux=function(_){var w=this.transmuxPipeline_;l.remux=_,w&&w.coalesceStream&&w.coalesceStream.setRemux(_)},this.alignGopsWith=function(_){h&&this.transmuxPipeline_.videoSegmentStream&&this.transmuxPipeline_.videoSegmentStream.alignGopsWith(_)},this.getLogTrigger_=function(_){var w=this;return function(D){D.stream=_,w.trigger("log",D)}},this.push=function(_){if(f){var w=cm(_);w&&this.transmuxPipeline_.type!=="aac"?this.setupAacPipeline():!w&&this.transmuxPipeline_.type!=="ts"&&this.setupTsPipeline(),f=!1}this.transmuxPipeline_.headOfPipeline.push(_)},this.flush=function(){f=!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()}},en.prototype=new Ys;var fm={Transmuxer:en},pm=function(l){return l>>>0},mm=function(l){return("00"+l.toString(16)).slice(-2)},tn={toUnsigned:pm,toHexString:mm},gm=function(l){var c="";return c+=String.fromCharCode(l[0]),c+=String.fromCharCode(l[1]),c+=String.fromCharCode(l[2]),c+=String.fromCharCode(l[3]),c},Kl=gm,ym=tn.toUnsigned,_m=Kl,Xl=function(l,c){var f=[],h,m,_,w,D;if(!c.length)return null;for(h=0;h<l.byteLength;)m=ym(l[h]<<24|l[h+1]<<16|l[h+2]<<8|l[h+3]),_=_m(l.subarray(h+4,h+8)),w=m>1?h+m:l.byteLength,_===c[0]&&(c.length===1?f.push(l.subarray(h+8,w)):(D=Xl(l.subarray(h+8,w),c.slice(1)),D.length&&(f=f.concat(D)))),h=w;return f},ba=Xl,Tm=tn.toUnsigned,vm=n.getUint64,bm=function(l){var c={version:l[0],flags:new Uint8Array(l.subarray(1,4))};return c.version===1?c.baseMediaDecodeTime=vm(l.subarray(4)):c.baseMediaDecodeTime=Tm(l[4]<<24|l[5]<<16|l[6]<<8|l[7]),c},xa=bm,xm=function(l){var c=new DataView(l.buffer,l.byteOffset,l.byteLength),f={version:l[0],flags:new Uint8Array(l.subarray(1,4)),trackId:c.getUint32(4)},h=f.flags[2]&1,m=f.flags[2]&2,_=f.flags[2]&8,w=f.flags[2]&16,D=f.flags[2]&32,R=f.flags[0]&65536,O=f.flags[0]&131072,q;return q=8,h&&(q+=4,f.baseDataOffset=c.getUint32(12),q+=4),m&&(f.sampleDescriptionIndex=c.getUint32(q),q+=4),_&&(f.defaultSampleDuration=c.getUint32(q),q+=4),w&&(f.defaultSampleSize=c.getUint32(q),q+=4),D&&(f.defaultSampleFlags=c.getUint32(q)),R&&(f.durationIsEmpty=!0),!h&&O&&(f.baseDataOffsetIsMoof=!0),f},Yl=xm,Sm=function(l){return{isLeading:(l[0]&12)>>>2,dependsOn:l[0]&3,isDependedOn:(l[1]&192)>>>6,hasRedundancy:(l[1]&48)>>>4,paddingValue:(l[1]&14)>>>1,isNonSyncSample:l[1]&1,degradationPriority:l[2]<<8|l[3]}},Em=Sm,Ql=Em,Cm=function(l){var c={version:l[0],flags:new Uint8Array(l.subarray(1,4)),samples:[]},f=new DataView(l.buffer,l.byteOffset,l.byteLength),h=c.flags[2]&1,m=c.flags[2]&4,_=c.flags[1]&1,w=c.flags[1]&2,D=c.flags[1]&4,R=c.flags[1]&8,O=f.getUint32(4),q=8,Z;for(h&&(c.dataOffset=f.getInt32(q),q+=4),m&&O&&(Z={flags:Ql(l.subarray(q,q+4))},q+=4,_&&(Z.duration=f.getUint32(q),q+=4),w&&(Z.size=f.getUint32(q),q+=4),R&&(c.version===1?Z.compositionTimeOffset=f.getInt32(q):Z.compositionTimeOffset=f.getUint32(q),q+=4),c.samples.push(Z),O--);O--;)Z={},_&&(Z.duration=f.getUint32(q),q+=4),w&&(Z.size=f.getUint32(q),q+=4),D&&(Z.flags=Ql(l.subarray(q,q+4)),q+=4),R&&(c.version===1?Z.compositionTimeOffset=f.getInt32(q):Z.compositionTimeOffset=f.getUint32(q),q+=4),c.samples.push(Z);return c},Jl=Cm,Zl={tfdt:xa,trun:Jl},eu={parseTfdt:Zl.tfdt,parseTrun:Zl.trun},Am=function(l){for(var c=0,f=String.fromCharCode(l[c]),h="";f!=="\0";)h+=f,c++,f=String.fromCharCode(l[c]);return h+=f,h},wm={uint8ToCString:Am},rn=wm.uint8ToCString,Dm=n.getUint64,Im=function(l){var c=4,f=l[0],h,m,_,w,D,R,O,q;if(f===0){h=rn(l.subarray(c)),c+=h.length,m=rn(l.subarray(c)),c+=m.length;var Z=new DataView(l.buffer);_=Z.getUint32(c),c+=4,D=Z.getUint32(c),c+=4,R=Z.getUint32(c),c+=4,O=Z.getUint32(c),c+=4}else if(f===1){var Z=new DataView(l.buffer);_=Z.getUint32(c),c+=4,w=Dm(l.subarray(c)),c+=8,R=Z.getUint32(c),c+=4,O=Z.getUint32(c),c+=4,h=rn(l.subarray(c)),c+=h.length,m=rn(l.subarray(c)),c+=m.length}q=new Uint8Array(l.subarray(c,l.byteLength));var me={scheme_id_uri:h,value:m,timescale:_||1,presentation_time:w,presentation_time_delta:D,event_duration:R,id:O,message_data:q};return Pm(f,me)?me:void 0},km=function(l,c,f,h){return l||l===0?l/c:h+f/c},Pm=function(l,c){var f=c.scheme_id_uri!=="\0",h=l===0&&tu(c.presentation_time_delta)&&f,m=l===1&&tu(c.presentation_time)&&f;return!(l>1)&&h||m},tu=function(l){return l!==void 0||l!==null},Rm={parseEmsgBox:Im,scaleTime:km},is;typeof window<"u"?is=window:typeof r<"u"?is=r:typeof self<"u"?is=self:is={};var iu=is,sn=tn.toUnsigned,rs=tn.toHexString,at=ba,fr=Kl,Sa=Rm,Lm=Yl,Nm=Jl,Om=xa,Bm=n.getUint64,ru,su,nu,au,ou,Ea,lu,Ca=iu,Mm=Rl.parseId3Frames;ru=function(l){var c={},f=at(l,["moov","trak"]);return f.reduce(function(h,m){var _,w,D,R,O;return _=at(m,["tkhd"])[0],!_||(w=_[0],D=w===0?12:20,R=sn(_[D]<<24|_[D+1]<<16|_[D+2]<<8|_[D+3]),O=at(m,["mdia","mdhd"])[0],!O)?null:(w=O[0],D=w===0?12:20,h[R]=sn(O[D]<<24|O[D+1]<<16|O[D+2]<<8|O[D+3]),h)},c)},su=function(l,c){var f;f=at(c,["moof","traf"]);var h=f.reduce(function(m,_){var w=at(_,["tfhd"])[0],D=sn(w[4]<<24|w[5]<<16|w[6]<<8|w[7]),R=l[D]||9e4,O=at(_,["tfdt"])[0],q=new DataView(O.buffer,O.byteOffset,O.byteLength),Z;O[0]===1?Z=Bm(O.subarray(4,12)):Z=q.getUint32(4);let me;return typeof Z=="bigint"?me=Z/Ca.BigInt(R):typeof Z=="number"&&!isNaN(Z)&&(me=Z/R),me<Number.MAX_SAFE_INTEGER&&(me=Number(me)),me<m&&(m=me),m},1/0);return typeof h=="bigint"||isFinite(h)?h:0},nu=function(l,c){var f=at(c,["moof","traf"]),h=0,m=0,_;if(f&&f.length){var w=at(f[0],["tfhd"])[0],D=at(f[0],["trun"])[0],R=at(f[0],["tfdt"])[0];if(w){var O=Lm(w);_=O.trackId}if(R){var q=Om(R);h=q.baseMediaDecodeTime}if(D){var Z=Nm(D);Z.samples&&Z.samples.length&&(m=Z.samples[0].compositionTimeOffset||0)}}var me=l[_]||9e4;typeof h=="bigint"&&(m=Ca.BigInt(m),me=Ca.BigInt(me));var re=(h+m)/me;return typeof re=="bigint"&&re<Number.MAX_SAFE_INTEGER&&(re=Number(re)),re},au=function(l){var c=at(l,["moov","trak"]),f=[];return c.forEach(function(h){var m=at(h,["mdia","hdlr"]),_=at(h,["tkhd"]);m.forEach(function(w,D){var R=fr(w.subarray(8,12)),O=_[D],q,Z,me;R==="vide"&&(q=new DataView(O.buffer,O.byteOffset,O.byteLength),Z=q.getUint8(0),me=Z===0?q.getUint32(12):q.getUint32(20),f.push(me))})}),f},Ea=function(l){var c=l[0],f=c===0?12:20;return sn(l[f]<<24|l[f+1]<<16|l[f+2]<<8|l[f+3])},ou=function(l){var c=at(l,["moov","trak"]),f=[];return c.forEach(function(h){var m={},_=at(h,["tkhd"])[0],w,D;_&&(w=new DataView(_.buffer,_.byteOffset,_.byteLength),D=w.getUint8(0),m.id=D===0?w.getUint32(12):w.getUint32(20));var R=at(h,["mdia","hdlr"])[0];if(R){var O=fr(R.subarray(8,12));O==="vide"?m.type="video":O==="soun"?m.type="audio":m.type=O}var q=at(h,["mdia","minf","stbl","stsd"])[0];if(q){var Z=q.subarray(8);m.codec=fr(Z.subarray(4,8));var me=at(Z,[m.codec])[0],re,ve;me&&(/^[asm]vc[1-9]$/i.test(m.codec)?(re=me.subarray(78),ve=fr(re.subarray(4,8)),ve==="avcC"&&re.length>11?(m.codec+=".",m.codec+=rs(re[9]),m.codec+=rs(re[10]),m.codec+=rs(re[11])):m.codec="avc1.4d400d"):/^mp4[a,v]$/i.test(m.codec)?(re=me.subarray(28),ve=fr(re.subarray(4,8)),ve==="esds"&&re.length>20&&re[19]!==0?(m.codec+="."+rs(re[19]),m.codec+="."+rs(re[20]>>>2&63).replace(/^0/,"")):m.codec="mp4a.40.2"):m.codec=m.codec.toLowerCase())}var ke=at(h,["mdia","mdhd"])[0];ke&&(m.timescale=Ea(ke)),f.push(m)}),f},lu=function(l,c=0){var f=at(l,["emsg"]);return f.map(h=>{var m=Sa.parseEmsgBox(new Uint8Array(h)),_=Mm(m.message_data);return{cueTime:Sa.scaleTime(m.presentation_time,m.timescale,m.presentation_time_delta,c),duration:Sa.scaleTime(m.event_duration,m.timescale),frames:_}})};var ss={findBox:at,parseType:fr,timescale:ru,startTime:su,compositionStartTime:nu,videoTrackIds:au,tracks:ou,getTimescaleFromMediaHeader:Ea,getEmsgID3:lu};const{parseTrun:Fm}=eu,{findBox:uu}=ss;var cu=iu,Um=function(l){var c=uu(l,["moof","traf"]),f=uu(l,["mdat"]),h=[];return f.forEach(function(m,_){var w=c[_];h.push({mdat:m,traf:w})}),h},$m=function(l,c,f){var h=c,m=f.defaultSampleDuration||0,_=f.defaultSampleSize||0,w=f.trackId,D=[];return l.forEach(function(R){var O=Fm(R),q=O.samples;q.forEach(function(Z){Z.duration===void 0&&(Z.duration=m),Z.size===void 0&&(Z.size=_),Z.trackId=w,Z.dts=h,Z.compositionTimeOffset===void 0&&(Z.compositionTimeOffset=0),typeof h=="bigint"?(Z.pts=h+cu.BigInt(Z.compositionTimeOffset),h+=cu.BigInt(Z.duration)):(Z.pts=h+Z.compositionTimeOffset,h+=Z.duration)}),D=D.concat(q)}),D},du={getMdatTrafPairs:Um,parseSamples:$m},jm=zt.discardEmulationPreventionBytes,qm=Dl.CaptionStream,Aa=ba,Vm=xa,Hm=Yl,{getMdatTrafPairs:zm,parseSamples:Wm}=du,Gm=function(l,c){for(var f=l,h=0;h<c.length;h++){var m=c[h];if(f<m.size)return m;f-=m.size}return null},Km=function(l,c,f){var h=new DataView(l.buffer,l.byteOffset,l.byteLength),m={logs:[],seiNals:[]},_,w,D,R;for(w=0;w+4<l.length;w+=D)if(D=h.getUint32(w),w+=4,!(D<=0))switch(l[w]&31){case 6:var O=l.subarray(w+1,w+1+D),q=Gm(w,c);if(_={nalUnitType:"sei_rbsp",size:D,data:O,escapedRBSP:jm(O),trackId:f},q)_.pts=q.pts,_.dts=q.dts,R=q;else if(R)_.pts=R.pts,_.dts=R.dts;else{m.logs.push({level:"warn",message:"We've encountered a nal unit without data at "+w+" for trackId "+f+". See mux.js#223."});break}m.seiNals.push(_);break}return m},Xm=function(l,c){var f={},h=zm(l);return h.forEach(function(m){var _=m.mdat,w=m.traf,D=Aa(w,["tfhd"]),R=Hm(D[0]),O=R.trackId,q=Aa(w,["tfdt"]),Z=q.length>0?Vm(q[0]).baseMediaDecodeTime:0,me=Aa(w,["trun"]),re,ve;c===O&&me.length>0&&(re=Wm(me,Z,R),ve=Km(_,re,O),f[O]||(f[O]={seiNals:[],logs:[]}),f[O].seiNals=f[O].seiNals.concat(ve.seiNals),f[O].logs=f[O].logs.concat(ve.logs))}),f},Ym=function(l,c,f){var h;if(c===null)return null;h=Xm(l,c);var m=h[c]||{};return{seiNals:m.seiNals,logs:m.logs,timescale:f}},Qm=function(){var l=!1,c,f,h,m,_,w;this.isInitialized=function(){return l},this.init=function(D){c=new qm,l=!0,w=D?D.isPartial:!1,c.on("data",function(R){R.startTime=R.startPts/m,R.endTime=R.endPts/m,_.captions.push(R),_.captionStreams[R.stream]=!0}),c.on("log",function(R){_.logs.push(R)})},this.isNewInit=function(D,R){return D&&D.length===0||R&&typeof R=="object"&&Object.keys(R).length===0?!1:h!==D[0]||m!==R[h]},this.parse=function(D,R,O){var q;if(this.isInitialized()){if(!R||!O)return null;if(this.isNewInit(R,O))h=R[0],m=O[h];else if(h===null||!m)return f.push(D),null}else return null;for(;f.length>0;){var Z=f.shift();this.parse(Z,R,O)}return q=Ym(D,h,m),q&&q.logs&&(_.logs=_.logs.concat(q.logs)),q===null||!q.seiNals?_.logs.length?{logs:_.logs,captions:[],captionStreams:[]}:null:(this.pushNals(q.seiNals),this.flushStream(),_)},this.pushNals=function(D){if(!this.isInitialized()||!D||D.length===0)return null;D.forEach(function(R){c.push(R)})},this.flushStream=function(){if(!this.isInitialized())return null;w?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(){f=[],h=null,m=null,_?this.clearParsedCaptions():_={captions:[],captionStreams:{},logs:[]},this.resetCaptionStream()},this.reset()},Jm=Qm;const{parseTfdt:Zm}=eu,Fi=ba,{getTimescaleFromMediaHeader:eg}=ss,{parseSamples:tg,getMdatTrafPairs:ig}=du;var hu=function(){let l=9e4;this.init=function(c){const f=Fi(c,["moov","trak","mdia","mdhd"])[0];f&&(l=eg(f))},this.parseSegment=function(c){const f=[],h=ig(c);let m=0;return h.forEach(function(_){const w=_.mdat,D=_.traf,R=Fi(D,["tfdt"])[0],O=Fi(D,["tfhd"])[0],q=Fi(D,["trun"]);if(R&&(m=Zm(R).baseMediaDecodeTime),q.length&&O){const Z=tg(q,m,O);let me=0;Z.forEach(function(re){const ve="utf-8",ke=new TextDecoder(ve),mt=w.slice(me,me+re.size);if(Fi(mt,["vtte"])[0]){me+=re.size;return}Fi(mt,["vttc"]).forEach(function(ns){const as=Fi(ns,["payl"])[0],os=Fi(ns,["sttg"])[0],ls=re.pts/l,on=(re.pts+re.duration)/l;let Ke,us;if(as)try{Ke=ke.decode(as)}catch(oi){console.error(oi)}if(os)try{us=ke.decode(os)}catch(oi){console.error(oi)}re.duration&&Ke&&f.push({cueText:Ke,start:ls,end:on,settings:us})}),me+=re.size})}}),f}},wa=$s,fu=function(l){var c=l[1]&31;return c<<=8,c|=l[2],c},nn=function(l){return!!(l[1]&64)},an=function(l){var c=0;return(l[3]&48)>>>4>1&&(c+=l[4]+1),c},rg=function(l,c){var f=fu(l);return f===0?"pat":f===c?"pmt":c?"pes":null},sg=function(l){var c=nn(l),f=4+an(l);return c&&(f+=l[f]+1),(l[f+10]&31)<<8|l[f+11]},ng=function(l){var c={},f=nn(l),h=4+an(l);if(f&&(h+=l[h]+1),!!(l[h+5]&1)){var m,_,w;m=(l[h+1]&15)<<8|l[h+2],_=3+m-4,w=(l[h+10]&15)<<8|l[h+11];for(var D=12+w;D<_;){var R=h+D;c[(l[R+1]&31)<<8|l[R+2]]=l[R],D+=((l[R+3]&15)<<8|l[R+4])+5}return c}},ag=function(l,c){var f=fu(l),h=c[f];switch(h){case wa.H264_STREAM_TYPE:return"video";case wa.ADTS_STREAM_TYPE:return"audio";case wa.METADATA_STREAM_TYPE:return"timed-metadata";default:return null}},og=function(l){var c=nn(l);if(!c)return null;var f=4+an(l);if(f>=l.byteLength)return null;var h=null,m;return m=l[f+7],m&192&&(h={},h.pts=(l[f+9]&14)<<27|(l[f+10]&255)<<20|(l[f+11]&254)<<12|(l[f+12]&255)<<5|(l[f+13]&254)>>>3,h.pts*=4,h.pts+=(l[f+13]&6)>>>1,h.dts=h.pts,m&64&&(h.dts=(l[f+14]&14)<<27|(l[f+15]&255)<<20|(l[f+16]&254)<<12|(l[f+17]&255)<<5|(l[f+18]&254)>>>3,h.dts*=4,h.dts+=(l[f+18]&6)>>>1)),h},Da=function(l){switch(l){case 5:return"slice_layer_without_partitioning_rbsp_idr";case 6:return"sei_rbsp";case 7:return"seq_parameter_set_rbsp";case 8:return"pic_parameter_set_rbsp";case 9:return"access_unit_delimiter_rbsp";default:return null}},lg=function(l){for(var c=4+an(l),f=l.subarray(c),h=0,m=0,_=!1,w;m<f.byteLength-3;m++)if(f[m+2]===1){h=m+5;break}for(;h<f.byteLength;)switch(f[h]){case 0:if(f[h-1]!==0){h+=2;break}else if(f[h-2]!==0){h++;break}m+3!==h-2&&(w=Da(f[m+3]&31),w==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0));do h++;while(f[h]!==1&&h<f.length);m=h-2,h+=3;break;case 1:if(f[h-1]!==0||f[h-2]!==0){h+=3;break}w=Da(f[m+3]&31),w==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0),m=h-2,h+=3;break;default:h+=3;break}return f=f.subarray(m),h-=m,m=0,f&&f.byteLength>3&&(w=Da(f[m+3]&31),w==="slice_layer_without_partitioning_rbsp_idr"&&(_=!0)),_},ug={parseType:rg,parsePat:sg,parsePmt:ng,parsePayloadUnitStartIndicator:nn,parsePesType:ag,parsePesTime:og,videoPacketContainsKeyFrame:lg},pu=$s,pr=kl.handleRollover,Me={};Me.ts=ug,Me.aac=va;var Zi=y.ONE_SECOND_IN_TS,wt=188,mi=71,cg=function(l,c){for(var f=0,h=wt,m,_;h<l.byteLength;){if(l[f]===mi&&l[h]===mi){switch(m=l.subarray(f,h),_=Me.ts.parseType(m,c.pid),_){case"pat":c.pid=Me.ts.parsePat(m);break;case"pmt":var w=Me.ts.parsePmt(m);c.table=c.table||{},Object.keys(w).forEach(function(D){c.table[D]=w[D]});break}f+=wt,h+=wt;continue}f++,h++}},mu=function(l,c,f){for(var h=0,m=wt,_,w,D,R,O,q=!1;m<=l.byteLength;){if(l[h]===mi&&(l[m]===mi||m===l.byteLength)){if(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w==="pes"&&(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="audio"&&R&&(O=Me.ts.parsePesTime(_),O&&(O.type="audio",f.audio.push(O),q=!0))),q)break;h+=wt,m+=wt;continue}h++,m++}for(m=l.byteLength,h=m-wt,q=!1;h>=0;){if(l[h]===mi&&(l[m]===mi||m===l.byteLength)){if(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w==="pes"&&(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="audio"&&R&&(O=Me.ts.parsePesTime(_),O&&(O.type="audio",f.audio.push(O),q=!0))),q)break;h-=wt,m-=wt;continue}h--,m--}},dg=function(l,c,f){for(var h=0,m=wt,_,w,D,R,O,q,Z,me,re=!1,ve={data:[],size:0};m<l.byteLength;){if(l[h]===mi&&l[m]===mi){switch(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w){case"pes":if(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="video"&&(R&&!re&&(O=Me.ts.parsePesTime(_),O&&(O.type="video",f.video.push(O),re=!0)),!f.firstKeyFrame)){if(R&&ve.size!==0){for(q=new Uint8Array(ve.size),Z=0;ve.data.length;)me=ve.data.shift(),q.set(me,Z),Z+=me.byteLength;if(Me.ts.videoPacketContainsKeyFrame(q)){var ke=Me.ts.parsePesTime(q);ke?(f.firstKeyFrame=ke,f.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.")}ve.size=0}ve.data.push(_),ve.size+=_.byteLength}break}if(re&&f.firstKeyFrame)break;h+=wt,m+=wt;continue}h++,m++}for(m=l.byteLength,h=m-wt,re=!1;h>=0;){if(l[h]===mi&&l[m]===mi){if(_=l.subarray(h,m),w=Me.ts.parseType(_,c.pid),w==="pes"&&(D=Me.ts.parsePesType(_,c.table),R=Me.ts.parsePayloadUnitStartIndicator(_),D==="video"&&R&&(O=Me.ts.parsePesTime(_),O&&(O.type="video",f.video.push(O),re=!0))),re)break;h-=wt,m-=wt;continue}h--,m--}},hg=function(l,c){if(l.audio&&l.audio.length){var f=c;(typeof f>"u"||isNaN(f))&&(f=l.audio[0].dts),l.audio.forEach(function(_){_.dts=pr(_.dts,f),_.pts=pr(_.pts,f),_.dtsTime=_.dts/Zi,_.ptsTime=_.pts/Zi})}if(l.video&&l.video.length){var h=c;if((typeof h>"u"||isNaN(h))&&(h=l.video[0].dts),l.video.forEach(function(_){_.dts=pr(_.dts,h),_.pts=pr(_.pts,h),_.dtsTime=_.dts/Zi,_.ptsTime=_.pts/Zi}),l.firstKeyFrame){var m=l.firstKeyFrame;m.dts=pr(m.dts,h),m.pts=pr(m.pts,h),m.dtsTime=m.dts/Zi,m.ptsTime=m.pts/Zi}}},fg=function(l){for(var c=!1,f=0,h=null,m=null,_=0,w=0,D;l.length-w>=3;){var R=Me.aac.parseType(l,w);switch(R){case"timed-metadata":if(l.length-w<10){c=!0;break}if(_=Me.aac.parseId3TagSize(l,w),_>l.length){c=!0;break}m===null&&(D=l.subarray(w,w+_),m=Me.aac.parseAacTimestamp(D)),w+=_;break;case"audio":if(l.length-w<7){c=!0;break}if(_=Me.aac.parseAdtsSize(l,w),_>l.length){c=!0;break}h===null&&(D=l.subarray(w,w+_),h=Me.aac.parseSampleRate(D)),f++,w+=_;break;default:w++;break}if(c)return null}if(h===null||m===null)return null;var O=Zi/h,q={audio:[{type:"audio",dts:m,pts:m},{type:"audio",dts:m+f*1024*O,pts:m+f*1024*O}]};return q},pg=function(l){var c={pid:null,table:null},f={};cg(l,c);for(var h in c.table)if(c.table.hasOwnProperty(h)){var m=c.table[h];switch(m){case pu.H264_STREAM_TYPE:f.video=[],dg(l,c,f),f.video.length===0&&delete f.video;break;case pu.ADTS_STREAM_TYPE:f.audio=[],mu(l,c,f),f.audio.length===0&&delete f.audio;break}}return f},mg=function(l,c){var f=Me.aac.isLikelyAacData(l),h;return f?h=fg(l):h=pg(l),!h||!h.audio&&!h.video?null:(hg(h,c),h)},gg={inspect:mg,parseAudioPes_:mu};const yg=function(l,c){c.on("data",function(f){const h=f.initSegment;f.initSegment={data:h.buffer,byteOffset:h.byteOffset,byteLength:h.byteLength};const m=f.data;f.data=m.buffer,l.postMessage({action:"data",segment:f,byteOffset:m.byteOffset,byteLength:m.byteLength},[f.data])}),c.on("done",function(f){l.postMessage({action:"done"})}),c.on("gopInfo",function(f){l.postMessage({action:"gopInfo",gopInfo:f})}),c.on("videoSegmentTimingInfo",function(f){const h={start:{decode:y.videoTsToSeconds(f.start.dts),presentation:y.videoTsToSeconds(f.start.pts)},end:{decode:y.videoTsToSeconds(f.end.dts),presentation:y.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=y.videoTsToSeconds(f.prependedContentDuration)),l.postMessage({action:"videoSegmentTimingInfo",videoSegmentTimingInfo:h})}),c.on("audioSegmentTimingInfo",function(f){const h={start:{decode:y.videoTsToSeconds(f.start.dts),presentation:y.videoTsToSeconds(f.start.pts)},end:{decode:y.videoTsToSeconds(f.end.dts),presentation:y.videoTsToSeconds(f.end.pts)},baseMediaDecodeTime:y.videoTsToSeconds(f.baseMediaDecodeTime)};f.prependedContentDuration&&(h.prependedContentDuration=y.videoTsToSeconds(f.prependedContentDuration)),l.postMessage({action:"audioSegmentTimingInfo",audioSegmentTimingInfo:h})}),c.on("id3Frame",function(f){l.postMessage({action:"id3Frame",id3Frame:f})}),c.on("caption",function(f){l.postMessage({action:"caption",caption:f})}),c.on("trackinfo",function(f){l.postMessage({action:"trackinfo",trackInfo:f})}),c.on("audioTimingInfo",function(f){l.postMessage({action:"audioTimingInfo",audioTimingInfo:{start:y.videoTsToSeconds(f.start),end:y.videoTsToSeconds(f.end)}})}),c.on("videoTimingInfo",function(f){l.postMessage({action:"videoTimingInfo",videoTimingInfo:{start:y.videoTsToSeconds(f.start),end:y.videoTsToSeconds(f.end)}})}),c.on("log",function(f){l.postMessage({action:"log",log:f})})};class gu{constructor(c,f){this.options=f||{},this.self=c,this.init()}init(){this.transmuxer&&this.transmuxer.dispose(),this.transmuxer=new fm.Transmuxer(this.options),yg(this.self,this.transmuxer)}pushMp4Captions(c){this.captionParser||(this.captionParser=new Jm,this.captionParser.init());const f=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.captionParser.parse(f,c.trackIds,c.timescales);this.self.postMessage({action:"mp4Captions",captions:h&&h.captions||[],logs:h&&h.logs||[],data:f.buffer},[f.buffer])}initMp4WebVttParser(c){this.webVttParser||(this.webVttParser=new hu);const f=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.webVttParser.init(f)}getMp4WebVttText(c){this.webVttParser||(this.webVttParser=new hu);const f=new Uint8Array(c.data,c.byteOffset,c.byteLength),h=this.webVttParser.parseSegment(f);this.self.postMessage({action:"getMp4WebVttText",mp4VttCues:h||[],data:f.buffer},[f.buffer])}probeMp4StartTime({timescales:c,data:f}){const h=ss.startTime(c,f);this.self.postMessage({action:"probeMp4StartTime",startTime:h,data:f},[f.buffer])}probeMp4Tracks({data:c}){const f=ss.tracks(c);this.self.postMessage({action:"probeMp4Tracks",tracks:f,data:c},[c.buffer])}probeEmsgID3({data:c,offset:f}){const h=ss.getEmsgID3(c,f);this.self.postMessage({action:"probeEmsgID3",id3Frames:h,emsgData:c},[c.buffer])}probeTs({data:c,baseStartTime:f}){const h=typeof f=="number"&&!isNaN(f)?f*y.ONE_SECOND_IN_TS:void 0,m=gg.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 f=new Uint8Array(c.data,c.byteOffset,c.byteLength);this.transmuxer.push(f)}reset(){this.transmuxer.reset()}setTimestampOffset(c){const f=c.timestampOffset||0;this.transmuxer.setBaseMediaDecodeTime(Math.round(y.secondsToVideoTs(f)))}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(l){if(l.data.action==="init"&&l.data.options){this.messageHandlers=new gu(self,l.data.options);return}this.messageHandlers||(this.messageHandlers=new gu(self)),l.data&&l.data.action&&l.data.action!=="init"&&this.messageHandlers[l.data.action]&&this.messageHandlers[l.data.action](l.data)}}));var jb=Qf($b);const qb=(r,e,t)=>{const{type:i,initSegment:s,captions:n,captionStreams:a,metadata:o,videoFrameDtsTime:u,videoFramePtsTime:d}=r.data.segment;e.buffer.push({captions:n,captionStreams:a,metadata:o});const p=r.data.segment.boxes||{data:r.data.segment.data},T={type:i,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 d<"u"&&(T.videoFramePtsTime=d),t(T)},Vb=({transmuxedData:r,callback:e})=>{r.buffer=[],e(r)},Hb=(r,e)=>{e.gopInfo=r.data.gopInfo},ep=r=>{const{transmuxer:e,bytes:t,audioAppendStart:i,gopsToAlignWith:s,remux:n,onData:a,onTrackInfo:o,onAudioTimingInfo:u,onVideoTimingInfo:d,onVideoSegmentTimingInfo:p,onAudioSegmentTimingInfo:T,onId3:A,onCaptions:b,onDone:k,onEndedTimeline:v,onTransmuxerLog:L,isEndOfTimeline:U,segment:$,triggerSegmentEventFn:F}=r,H={buffer:[]};let B=U;const V=ie=>{e.currentTransmux===r&&(ie.data.action==="data"&&qb(ie,H,a),ie.data.action==="trackinfo"&&o(ie.data.trackInfo),ie.data.action==="gopInfo"&&Hb(ie,H),ie.data.action==="audioTimingInfo"&&u(ie.data.audioTimingInfo),ie.data.action==="videoTimingInfo"&&d(ie.data.videoTimingInfo),ie.data.action==="videoSegmentTimingInfo"&&p(ie.data.videoSegmentTimingInfo),ie.data.action==="audioSegmentTimingInfo"&&T(ie.data.audioSegmentTimingInfo),ie.data.action==="id3Frame"&&A([ie.data.id3Frame],ie.data.id3Frame.dispatchType),ie.data.action==="caption"&&b(ie.data.caption),ie.data.action==="endedtimeline"&&(B=!1,v()),ie.data.action==="log"&&L(ie.data.log),ie.data.type==="transmuxed"&&(B||(e.onmessage=null,Vb({transmuxedData:H,callback:k}),tp(e))))},G=()=>{const ie={message:"Received an error message from the transmuxer worker",metadata:{errorType:z.Error.StreamingFailedToTransmuxSegment,segmentInfo:rr({segment:$})}};k(null,ie)};if(e.onmessage=V,e.onerror=G,i&&e.postMessage({action:"setAudioAppendStart",appendStart:i}),Array.isArray(s)&&e.postMessage({action:"alignGopsWith",gopsToAlignWith:s}),typeof n<"u"&&e.postMessage({action:"setRemux",remux:n}),t.byteLength){const ie=t instanceof ArrayBuffer?t:t.buffer,C=t instanceof ArrayBuffer?0:t.byteOffset;F({type:"segmenttransmuxingstart",segment:$}),e.postMessage({action:"push",data:ie,byteOffset:C,byteLength:t.byteLength},[ie])}U&&e.postMessage({action:"endTimeline"}),e.postMessage({action:"flush"})},tp=r=>{r.currentTransmux=null,r.transmuxQueue.length&&(r.currentTransmux=r.transmuxQueue.shift(),typeof r.currentTransmux=="function"?r.currentTransmux():ep(r.currentTransmux))},Qc=(r,e)=>{r.postMessage({action:e}),tp(r)},ip=(r,e)=>{if(!e.currentTransmux){e.currentTransmux=r,Qc(e,r);return}e.transmuxQueue.push(Qc.bind(null,e,r))},zb=r=>{ip("reset",r)},Wb=r=>{ip("endTimeline",r)},rp=r=>{if(!r.transmuxer.currentTransmux){r.transmuxer.currentTransmux=r,ep(r);return}r.transmuxer.transmuxQueue.push(r)},Gb=r=>{const e=new jb;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:r}),e};var lo={reset:zb,endTimeline:Wb,transmux:rp,createTransmuxer:Gb};const Dr=function(r){const e=r.transmuxer,t=r.endAction||r.action,i=r.callback,s=ot({},r,{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,r.byteOffset||0,r.byteLength||a.data.data.byteLength),r.data&&(r.data=a.data.data)),i(a.data))};if(e.addEventListener("message",n),r.data){const a=r.data instanceof ArrayBuffer;s.byteOffset=a?0:r.data.byteOffset,s.byteLength=r.data.byteLength;const o=[a?r.data:r.data.buffer];e.postMessage(s,o)}else e.postMessage(s)},Ci={FAILURE:2,TIMEOUT:-101,ABORTED:-102},sp="wvtt",No=r=>{r.forEach(e=>{e.abort()})},Kb=r=>({bandwidth:r.bandwidth,bytesReceived:r.bytesReceived||0,roundTripTime:r.roundTripTime||0}),Xb=r=>{const e=r.target,i={bandwidth:1/0,bytesReceived:0,roundTripTime:Date.now()-e.requestTime||0};return i.bytesReceived=r.loaded,i.bandwidth=Math.floor(i.bytesReceived/i.roundTripTime*8*1e3),i},Cl=(r,e)=>{const{requestType:t}=e,i=cr({requestType:t,request:e,error:r});return e.timedout?{status:e.status,message:"HLS request timed-out at URL: "+e.uri,code:Ci.TIMEOUT,xhr:e,metadata:i}:e.aborted?{status:e.status,message:"HLS request aborted at URL: "+e.uri,code:Ci.ABORTED,xhr:e,metadata:i}:r?{status:e.status,message:"HLS request errored at URL: "+e.uri,code:Ci.FAILURE,xhr:e,metadata:i}:e.responseType==="arraybuffer"&&e.response.byteLength===0?{status:e.status,message:"Empty HLS response at URL: "+e.uri,code:Ci.FAILURE,xhr:e,metadata:i}:null},Jc=(r,e,t,i)=>(s,n)=>{const a=n.response,o=Cl(s,n);if(o)return t(o,r);if(a.byteLength!==16)return t({status:n.status,message:"Invalid HLS key at URL: "+n.uri,code:Ci.FAILURE,xhr:n},r);const u=new DataView(a),d=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=d;const p={uri:n.uri};return i({type:"segmentkeyloadcomplete",segment:r,keyInfo:p}),t(null,r)},Yb=(r,e)=>{e===sp&&r.transmuxer.postMessage({action:"initMp4WebVttParser",data:r.map.bytes})},Qb=(r,e,t)=>{e===sp&&Dr({action:"getMp4WebVttText",data:r.bytes,transmuxer:r.transmuxer,callback:({data:i,mp4VttCues:s})=>{r.bytes=i,t(null,r,{mp4VttCues:s})}})},np=(r,e)=>{const t=Xo(r.map.bytes);if(t!=="mp4"){const i=r.map.resolvedUri||r.map.uri,s=t||"unknown";return e({internal:!0,message:`Found unsupported ${s} container for initialization segment at URL: ${i}`,code:Ci.FAILURE,metadata:{mediaType:s}})}Dr({action:"probeMp4Tracks",data:r.map.bytes,transmuxer:r.transmuxer,callback:({tracks:i,data:s})=>(r.map.bytes=s,i.forEach(function(n){r.map.tracks=r.map.tracks||{},!r.map.tracks[n.type]&&(r.map.tracks[n.type]=n,typeof n.id=="number"&&n.timescale&&(r.map.timescales=r.map.timescales||{},r.map.timescales[n.id]=n.timescale),n.type==="text"&&Yb(r,n.codec))}),e(null))})},Jb=({segment:r,finishProcessingFn:e,triggerSegmentEventFn:t})=>(i,s)=>{const n=Cl(i,s);if(n)return e(n,r);const a=new Uint8Array(s.response);if(t({type:"segmentloaded",segment:r}),r.map.key)return r.map.encryptedBytes=a,e(null,r);r.map.bytes=a,np(r,function(o){if(o)return o.xhr=s,o.status=s.status,e(o,r);e(null,r)})},Zb=({segment:r,finishProcessingFn:e,responseType:t,triggerSegmentEventFn:i})=>(s,n)=>{const a=Cl(s,n);if(a)return e(a,r);i({type:"segmentloaded",segment:r});const o=t==="arraybuffer"||!n.responseText?n.response:Fb(n.responseText.substring(r.lastReachedChar||0));return r.stats=Kb(n),r.key?r.encryptedBytes=new Uint8Array(o):r.bytes=new Uint8Array(o),e(null,r)},e2=({segment:r,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{const k=r.map&&r.map.tracks||{},v=!!(k.audio&&k.video);let L=i.bind(null,r,"audio","start");const U=i.bind(null,r,"audio","end");let $=i.bind(null,r,"video","start");const F=i.bind(null,r,"video","end"),H=()=>rp({bytes:e,transmuxer:r.transmuxer,audioAppendStart:r.audioAppendStart,gopsToAlignWith:r.gopsToAlignWith,remux:v,onData:B=>{B.type=B.type==="combined"?"video":B.type,p(r,B)},onTrackInfo:B=>{t&&(v&&(B.isMuxed=!0),t(r,B))},onAudioTimingInfo:B=>{L&&typeof B.start<"u"&&(L(B.start),L=null),U&&typeof B.end<"u"&&U(B.end)},onVideoTimingInfo:B=>{$&&typeof B.start<"u"&&($(B.start),$=null),F&&typeof B.end<"u"&&F(B.end)},onVideoSegmentTimingInfo:B=>{const V={pts:{start:B.start.presentation,end:B.end.presentation},dts:{start:B.start.decode,end:B.end.decode}};b({type:"segmenttransmuxingtiminginfoavailable",segment:r,timingInfo:V}),s(B)},onAudioSegmentTimingInfo:B=>{const V={pts:{start:B.start.pts,end:B.end.pts},dts:{start:B.start.dts,end:B.end.dts}};b({type:"segmenttransmuxingtiminginfoavailable",segment:r,timingInfo:V}),n(B)},onId3:(B,V)=>{a(r,B,V)},onCaptions:B=>{o(r,[B])},isEndOfTimeline:u,onEndedTimeline:()=>{d()},onTransmuxerLog:A,onDone:(B,V)=>{T&&(B.type=B.type==="combined"?"video":B.type,b({type:"segmenttransmuxingcomplete",segment:r}),T(V,r,B))},segment:r,triggerSegmentEventFn:b});Dr({action:"probeTs",transmuxer:r.transmuxer,data:e,baseStartTime:r.baseStartTime,callback:B=>{r.bytes=e=B.data;const V=B.result;V&&(t(r,{hasAudio:V.hasAudio,hasVideo:V.hasVideo,isMuxed:v}),t=null),H()}})},ap=({segment:r,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{let k=new Uint8Array(e);if(bT(k)){r.isFmp4=!0;const{tracks:v}=r.map;if(v.text&&(!v.audio||!v.video)){p(r,{data:k,type:"text"}),Qb(r,v.text.codec,T);return}const U={isFmp4:!0,hasVideo:!!v.video,hasAudio:!!v.audio};v.audio&&v.audio.codec&&v.audio.codec!=="enca"&&(U.audioCodec=v.audio.codec),v.video&&v.video.codec&&v.video.codec!=="encv"&&(U.videoCodec=v.video.codec),v.video&&v.audio&&(U.isMuxed=!0),t(r,U);const $=(F,H)=>{p(r,{data:k,type:U.hasAudio&&!U.isMuxed?"audio":"video"}),H&&H.length&&a(r,H),F&&F.length&&o(r,F),T(null,r,{})};Dr({action:"probeMp4StartTime",timescales:r.map.timescales,data:k,transmuxer:r.transmuxer,callback:({data:F,startTime:H})=>{e=F.buffer,r.bytes=k=F,U.hasAudio&&!U.isMuxed&&i(r,"audio","start",H),U.hasVideo&&i(r,"video","start",H),Dr({action:"probeEmsgID3",data:k,transmuxer:r.transmuxer,offset:H,callback:({emsgData:B,id3Frames:V})=>{if(e=B.buffer,r.bytes=k=B,!v.video||!B.byteLength||!r.transmuxer){$(void 0,V);return}Dr({action:"pushMp4Captions",endAction:"mp4Captions",transmuxer:r.transmuxer,data:k,timescales:r.map.timescales,trackIds:[v.video.id],callback:G=>{e=G.data.buffer,r.bytes=k=G.data,G.logs.forEach(function(ie){A(Oe(ie,{stream:"mp4CaptionParser"}))}),$(G.captions,V)}})}})}});return}if(!r.transmuxer){T(null,r,{});return}if(typeof r.container>"u"&&(r.container=Xo(k)),r.container!=="ts"&&r.container!=="aac"){t(r,{hasAudio:!1,hasVideo:!1}),T(null,r,{});return}e2({segment:r,bytes:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})},op=function({id:r,key:e,encryptedBytes:t,decryptionWorker:i,segment:s,doneFn:n},a){const o=d=>{if(d.data.source===r){i.removeEventListener("message",o);const p=d.data.decrypted;a(new Uint8Array(p.bytes,p.byteOffset,p.byteLength))}};i.onerror=()=>{const d="An error occurred in the decryption worker",p=rr({segment:s}),T={message:d,metadata:{error:new Error(d),errorType:z.Error.StreamingFailedToDecryptSegment,segmentInfo:p,keyInfo:{uri:s.key.resolvedUri||s.map.key.resolvedUri}}};n(T,s)},i.addEventListener("message",o);let u;e.bytes.slice?u=e.bytes.slice():u=new Uint32Array(Array.prototype.slice.call(e.bytes)),i.postMessage(zf({source:r,encrypted:t,key:u,iv:e.iv}),[t.buffer,u.buffer])},t2=({decryptionWorker:r,segment:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{b({type:"segmentdecryptionstart"}),op({id:e.requestId,key:e.key,encryptedBytes:e.encryptedBytes,decryptionWorker:r,segment:e,doneFn:T},k=>{e.bytes=k,b({type:"segmentdecryptioncomplete",segment:e}),ap({segment:e,bytes:e.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})})},i2=({activeXhrs:r,decryptionWorker:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})=>{let k=0,v=!1;return(L,U)=>{if(!v){if(L)return v=!0,No(r),T(L,U);if(k+=1,k===r.length){const $=function(){if(U.encryptedBytes)return t2({decryptionWorker:e,segment:U,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b});ap({segment:U,bytes:U.bytes,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p,doneFn:T,onTransmuxerLog:A,triggerSegmentEventFn:b})};if(U.endOfAllRequests=Date.now(),U.map&&U.map.encryptedBytes&&!U.map.bytes)return b({type:"segmentdecryptionstart",segment:U}),op({decryptionWorker:e,id:U.requestId+"-init",encryptedBytes:U.map.encryptedBytes,key:U.map.key,segment:U,doneFn:T},F=>{U.map.bytes=F,b({type:"segmentdecryptioncomplete",segment:U}),np(U,H=>{if(H)return No(r),T(H,U);$()})});$()}}}},r2=({loadendState:r,abortFn:e})=>t=>{t.target.aborted&&e&&!r.calledAbortFn&&(e(),r.calledAbortFn=!0)},s2=({segment:r,progressFn:e,trackInfoFn:t,timingInfoFn:i,videoSegmentTimingInfoFn:s,audioSegmentTimingInfoFn:n,id3Fn:a,captionsFn:o,isEndOfTimeline:u,endedTimelineFn:d,dataFn:p})=>T=>{if(!T.target.aborted)return r.stats=Oe(r.stats,Xb(T)),!r.stats.firstBytesReceivedAt&&r.stats.bytesReceived&&(r.stats.firstBytesReceivedAt=Date.now()),e(T,r)},n2=({xhr:r,xhrOptions:e,decryptionWorker:t,segment:i,abortFn:s,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:d,id3Fn:p,captionsFn:T,isEndOfTimeline:A,endedTimelineFn:b,dataFn:k,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:U})=>{const $=[],F=i2({activeXhrs:$,decryptionWorker:t,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:d,id3Fn:p,captionsFn:T,isEndOfTimeline:A,endedTimelineFn:b,dataFn:k,doneFn:v,onTransmuxerLog:L,triggerSegmentEventFn:U});if(i.key&&!i.key.bytes){const ie=[i.key];i.map&&!i.map.bytes&&i.map.key&&i.map.key.resolvedUri===i.key.resolvedUri&&ie.push(i.map.key);const C=Oe(e,{uri:i.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),I=Jc(i,ie,F,U),W={uri:i.key.resolvedUri};U({type:"segmentkeyloadstart",segment:i,keyInfo:W});const Y=r(C,I);$.push(Y)}if(i.map&&!i.map.bytes){if(i.map.key&&(!i.key||i.key.resolvedUri!==i.map.key.resolvedUri)){const Y=Oe(e,{uri:i.map.key.resolvedUri,responseType:"arraybuffer",requestType:"segment-key"}),X=Jc(i,[i.map.key],F,U),ne={uri:i.map.key.resolvedUri};U({type:"segmentkeyloadstart",segment:i,keyInfo:ne});const de=r(Y,X);$.push(de)}const C=Oe(e,{uri:i.map.resolvedUri,responseType:"arraybuffer",headers:Ro(i.map),requestType:"segment-media-initialization"}),I=Jb({segment:i,finishProcessingFn:F,triggerSegmentEventFn:U});U({type:"segmentloadstart",segment:i});const W=r(C,I);$.push(W)}const H=Oe(e,{uri:i.part&&i.part.resolvedUri||i.resolvedUri,responseType:"arraybuffer",headers:Ro(i),requestType:"segment"}),B=Zb({segment:i,finishProcessingFn:F,responseType:H.responseType,triggerSegmentEventFn:U});U({type:"segmentloadstart",segment:i});const V=r(H,B);V.addEventListener("progress",s2({segment:i,progressFn:n,trackInfoFn:a,timingInfoFn:o,videoSegmentTimingInfoFn:u,audioSegmentTimingInfoFn:d,id3Fn:p,captionsFn:T,isEndOfTimeline:A,endedTimelineFn:b,dataFn:k})),$.push(V);const G={};return $.forEach(ie=>{ie.addEventListener("loadend",r2({loadendState:G,abortFn:s}))}),()=>No($)},a2=Zt("CodecUtils"),o2=function(r){const e=r.attributes||{};if(e.CODECS)return Ti(e.CODECS)},lp=(r,e)=>{const t=e.attributes||{};return r&&r.mediaGroups&&r.mediaGroups.AUDIO&&t.AUDIO&&r.mediaGroups.AUDIO[t.AUDIO]},l2=(r,e)=>{if(!lp(r,e))return!0;const t=e.attributes||{},i=r.mediaGroups.AUDIO[t.AUDIO];for(const s in i)if(!i[s].uri&&!i[s].playlists)return!0;return!1},Un=function(r){const e={};return r.forEach(({mediaType:t,type:i,details:s})=>{e[t]=e[t]||[],e[t].push(Wd(`${i}${s}`))}),Object.keys(e).forEach(function(t){if(e[t].length>1){a2(`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},Zc=function(r){let e=0;return r.audio&&e++,r.video&&e++,e},Cs=function(r,e){const t=e.attributes||{},i=Un(o2(e)||[]);if(lp(r,e)&&!i.audio&&!l2(r,e)){const s=Un(Wy(r,t.AUDIO)||[]);s.audio&&(i.audio=s.audio)}return i},pn=Zt("PlaylistSelector"),ed=function(r){if(!r||!r.playlist)return;const e=r.playlist;return JSON.stringify({id:e.id,bandwidth:r.bandwidth,width:r.width,height:r.height,codecs:e.attributes&&e.attributes.CODECS||""})},$n=function(r,e){if(!r)return"";const t=N.getComputedStyle(r);return t?t[e]:""},Ir=function(r,e){const t=r.slice();r.sort(function(i,s){const n=e(i,s);return n===0?t.indexOf(i)-t.indexOf(s):n})},Al=function(r,e){let t,i;return r.attributes.BANDWIDTH&&(t=r.attributes.BANDWIDTH),t=t||N.Number.MAX_VALUE,e.attributes.BANDWIDTH&&(i=e.attributes.BANDWIDTH),i=i||N.Number.MAX_VALUE,t-i},u2=function(r,e){let t,i;return r.attributes.RESOLUTION&&r.attributes.RESOLUTION.width&&(t=r.attributes.RESOLUTION.width),t=t||N.Number.MAX_VALUE,e.attributes.RESOLUTION&&e.attributes.RESOLUTION.width&&(i=e.attributes.RESOLUTION.width),i=i||N.Number.MAX_VALUE,t===i&&r.attributes.BANDWIDTH&&e.attributes.BANDWIDTH?r.attributes.BANDWIDTH-e.attributes.BANDWIDTH:t-i};let up=function(r,e,t,i,s,n){if(!r)return;const a={bandwidth:e,width:t,height:i,limitRenditionByPlayerDimensions:s};let o=r.playlists;Bt.isAudioOnly(r)&&(o=n.getAudioTrackPlaylists_(),a.audioOnly=!0);let u=o.map(B=>{let V;const G=B.attributes&&B.attributes.RESOLUTION&&B.attributes.RESOLUTION.width,ie=B.attributes&&B.attributes.RESOLUTION&&B.attributes.RESOLUTION.height;return V=B.attributes&&B.attributes.BANDWIDTH,V=V||N.Number.MAX_VALUE,{bandwidth:V,width:G,height:ie,playlist:B}});Ir(u,(B,V)=>B.bandwidth-V.bandwidth),u=u.filter(B=>!Bt.isIncompatible(B.playlist));let d=u.filter(B=>Bt.isEnabled(B.playlist));d.length||(d=u.filter(B=>!Bt.isDisabled(B.playlist)));const p=d.filter(B=>B.bandwidth*gt.BANDWIDTH_VARIANCE<e);let T=p[p.length-1];const A=p.filter(B=>B.bandwidth===T.bandwidth)[0];if(s===!1){const B=A||d[0]||u[0];if(B&&B.playlist){let V="sortedPlaylistReps";return A&&(V="bandwidthBestRep"),d[0]&&(V="enabledPlaylistReps"),pn(`choosing ${ed(B)} using ${V} with options`,a),B.playlist}return pn("could not choose a playlist with options",a),null}const b=p.filter(B=>B.width&&B.height);Ir(b,(B,V)=>B.width-V.width);const k=b.filter(B=>B.width===t&&B.height===i);T=k[k.length-1];const v=k.filter(B=>B.bandwidth===T.bandwidth)[0];let L,U,$;v||(L=b.filter(B=>B.width>t||B.height>i),U=L.filter(B=>B.width===L[0].width&&B.height===L[0].height),T=U[U.length-1],$=U.filter(B=>B.bandwidth===T.bandwidth)[0]);let F;if(n.leastPixelDiffSelector){const B=b.map(V=>(V.pixelDiff=Math.abs(V.width-t)+Math.abs(V.height-i),V));Ir(B,(V,G)=>V.pixelDiff===G.pixelDiff?G.bandwidth-V.bandwidth:V.pixelDiff-G.pixelDiff),F=B[0]}const H=F||$||v||A||d[0]||u[0];if(H&&H.playlist){let B="sortedPlaylistReps";return F?B="leastPixelDiffRep":$?B="resolutionPlusOneRep":v?B="resolutionBestRep":A?B="bandwidthBestRep":d[0]&&(B="enabledPlaylistReps"),pn(`choosing ${ed(H)} using ${B} with options`,a),H.playlist}return pn("could not choose a playlist with options",a),null};const td=function(){let r=this.useDevicePixelRatio&&N.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(r=this.customPixelRatio),up(this.playlists.main,this.systemBandwidth,parseInt($n(this.tech_.el(),"width"),10)*r,parseInt($n(this.tech_.el(),"height"),10)*r,this.limitRenditionByPlayerDimensions,this.playlistController_)},c2=function(r){let e=-1,t=-1;if(r<0||r>1)throw new Error("Moving average bandwidth decay must be between 0 and 1.");return function(){let i=this.useDevicePixelRatio&&N.devicePixelRatio||1;return isNaN(this.customPixelRatio)||(i=this.customPixelRatio),e<0&&(e=this.systemBandwidth,t=this.systemBandwidth),this.systemBandwidth>0&&this.systemBandwidth!==t&&(e=r*this.systemBandwidth+(1-r)*e,t=this.systemBandwidth),up(this.playlists.main,e,parseInt($n(this.tech_.el(),"width"),10)*i,parseInt($n(this.tech_.el(),"height"),10)*i,this.limitRenditionByPlayerDimensions,this.playlistController_)}},d2=function(r){const{main:e,currentTime:t,bandwidth:i,duration:s,segmentDuration:n,timeUntilRebuffer:a,currentTimeline:o,syncController:u}=r,d=e.playlists.filter(k=>!Bt.isIncompatible(k));let p=d.filter(Bt.isEnabled);p.length||(p=d.filter(k=>!Bt.isDisabled(k)));const A=p.filter(Bt.hasAttribute.bind(null,"BANDWIDTH")).map(k=>{const L=u.getSyncPoint(k,s,o,t)?1:2,$=Bt.estimateSegmentRequestTime(n,i,k)*L-a;return{playlist:k,rebufferingImpact:$}}),b=A.filter(k=>k.rebufferingImpact<=0);return Ir(b,(k,v)=>Al(v.playlist,k.playlist)),b.length?b[0]:(Ir(A,(k,v)=>k.rebufferingImpact-v.rebufferingImpact),A[0]||null)},h2=function(){const r=this.playlists.main.playlists.filter(Bt.isEnabled);return Ir(r,(t,i)=>Al(t,i)),r.filter(t=>!!Cs(this.playlists.main,t).video)[0]||null},f2=r=>{let e=0,t;return r.bytes&&(t=new Uint8Array(r.bytes),r.segments.forEach(i=>{t.set(i,e),e+=i.byteLength})),t};function cp(r){try{return new URL(r).pathname.split("/").slice(-2).join("/")}catch{return""}}const p2=function(r,e,t){if(!r[t]){e.trigger({type:"usage",name:"vhs-608"});let i=t;/^cc708_/.test(t)&&(i="SERVICE"+t.split("_")[1]);const s=e.textTracks().getTrackById(i);if(s)r[t]=s;else{const n=e.options_.vhs&&e.options_.vhs.captionServices||{};let a=t,o=t,u=!1;const d=n[i];d&&(a=d.label,o=d.language,u=d.default),r[t]=e.addRemoteTextTrack({kind:"captions",id:i,default:u,label:a,language:o},!1).track}}},m2=function({inbandTextTracks:r,captionArray:e,timestampOffset:t}){if(!e)return;const i=N.WebKitDataCue||N.VTTCue;e.forEach(s=>{const n=s.stream;s.content?s.content.forEach(a=>{const o=new i(s.startTime+t,s.endTime+t,a.text);o.line=a.line,o.align="left",o.position=a.position,o.positionAlign="line-left",r[n].addCue(o)}):r[n].addCue(new i(s.startTime+t,s.endTime+t,s.text))})},g2=function(r){Object.defineProperties(r.frame,{id:{get(){return z.log.warn("cue.frame.id is deprecated. Use cue.value.key instead."),r.value.key}},value:{get(){return z.log.warn("cue.frame.value is deprecated. Use cue.value.data instead."),r.value.data}},privateData:{get(){return z.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead."),r.value.data}}})},y2=({inbandTextTracks:r,metadataArray:e,timestampOffset:t,videoDuration:i})=>{if(!e)return;const s=N.WebKitDataCue||N.VTTCue,n=r.metadataTrack_;if(!n||(e.forEach(p=>{const T=p.cueTime+t;typeof T!="number"||N.isNaN(T)||T<0||!(T<1/0)||!p.frames||!p.frames.length||p.frames.forEach(A=>{const b=new s(T,T,A.value||A.url||A.data||"");b.frame=A,b.value=A,g2(b),n.addCue(b)})}),!n.cues||!n.cues.length))return;const a=n.cues,o=[];for(let p=0;p<a.length;p++)a[p]&&o.push(a[p]);const u=o.reduce((p,T)=>{const A=p[T.startTime]||[];return A.push(T),p[T.startTime]=A,p},{}),d=Object.keys(u).sort((p,T)=>Number(p)-Number(T));d.forEach((p,T)=>{const A=u[p],b=isFinite(i)?i:p,k=Number(d[T+1])||b;A.forEach(v=>{v.endTime=k})})},_2={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"},T2=new Set(["id","class","startDate","duration","endDate","endOnNext","startTime","endTime","processDateRange"]),v2=({inbandTextTracks:r,dateRanges:e})=>{const t=r.metadataTrack_;if(!t)return;const i=N.WebKitDataCue||N.VTTCue;e.forEach(s=>{for(const n of Object.keys(s)){if(T2.has(n))continue;const a=new i(s.startTime,s.endTime,"");a.id=s.id,a.type="com.apple.quicktime.HLS",a.value={key:_2[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()})},id=(r,e,t)=>{r.metadataTrack_||(r.metadataTrack_=t.addRemoteTextTrack({kind:"metadata",label:"Timed Metadata"},!1).track,z.browser.IS_ANY_SAFARI||(r.metadataTrack_.inBandMetadataTrackDispatchType=e))},Ts=function(r,e,t){let i,s;if(t&&t.cues)for(i=t.cues.length;i--;)s=t.cues[i],s.startTime>=r&&s.endTime<=e&&t.removeCue(s)},b2=function(r){const e=r.cues;if(!e)return;const t={};for(let i=e.length-1;i>=0;i--){const s=e[i],n=`${s.startTime}-${s.endTime}-${s.text}`;t[n]?r.removeCue(s):t[n]=s}},x2=(r,e,t)=>{if(typeof e>"u"||e===null||!r.length)return[];const i=Math.ceil((e-t+3)*sr.ONE_SECOND_IN_TS);let s;for(s=0;s<r.length&&!(r[s].pts>i);s++);return r.slice(s)},S2=(r,e,t)=>{if(!e.length)return r;if(t)return e.slice();const i=e[0].pts;let s=0;for(s;s<r.length&&!(r[s].pts>=i);s++);return r.slice(0,s).concat(e)},E2=(r,e,t,i)=>{const s=Math.ceil((e-i)*sr.ONE_SECOND_IN_TS),n=Math.ceil((t-i)*sr.ONE_SECOND_IN_TS),a=r.slice();let o=r.length;for(;o--&&!(r[o].pts<=n););if(o===-1)return a;let u=o+1;for(;u--&&!(r[u].pts<=s););return u=Math.max(u,0),a.splice(u,o-u+1),a},C2=function(r,e){if(!r&&!e||!r&&e||r&&!e)return!1;if(r===e)return!0;const t=Object.keys(r).sort(),i=Object.keys(e).sort();if(t.length!==i.length)return!1;for(let s=0;s<t.length;s++){const n=t[s];if(n!==i[s]||r[n]!==e[n])return!1}return!0},A2=function(r,e,t){e=e||[];const i=[];let s=0;for(let n=0;n<e.length;n++){const a=e[n];if(r===a.timeline&&(i.push(n),s+=a.duration,s>t))return n}return i.length===0?0:i[i.length-1]},ms=1,w2=500,rd=r=>typeof r=="number"&&isFinite(r),mn=1/60,D2=(r,e,t)=>r!=="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,I2=(r,e,t)=>{let i=e-gt.BACK_BUFFER_LENGTH;r.length&&(i=Math.max(i,r.start(0)));const s=e-t;return Math.min(s,i)},_r=r=>{const{startOfSegment:e,duration:t,segment:i,part:s,playlist:{mediaSequence:n,id:a,segments:o=[]},mediaIndex:u,partIndex:d,timeline:p}=r,T=o.length-1;let A="mediaIndex/partIndex increment";r.getMediaInfoForTime?A=`getMediaInfoForTime (${r.getMediaInfoForTime})`:r.isSyncRequest&&(A="getSyncSegmentCandidate (isSyncRequest)"),r.independent&&(A+=` with independent ${r.independent}`);const b=typeof d=="number",k=r.segment.uri?"segment":"pre-segment",v=b?If({preloadSegment:i})-1:0;return`${k} [${n+u}/${n+T}]`+(b?` part [${d}/${v}]`:"")+` segment start/end [${i.start} => ${i.end}]`+(b?` part start/end [${s.start} => ${s.end}]`:"")+` startOfSegment [${e}] duration [${t}] timeline [${p}] selected by [${A}] playlist [${a}]`},sd=r=>`${r}TimingInfo`,k2=({segmentTimeline:r,currentTimeline:e,startOfSegment:t,buffered:i,overrideCheck:s})=>!s&&r===e?null:r<e?t:i.length?i.end(i.length-1):t,Oo=({timelineChangeController:r,currentTimeline:e,segmentTimeline:t,loaderType:i,audioDisabled:s})=>{if(e===t)return!1;if(i==="audio"){const n=r.lastTimelineChange({type:"main"});return!n||n.to!==t}if(i==="main"&&s){const n=r.pendingTimelineChange({type:"audio"});return!(n&&n.to===t)}return!1},P2=r=>{if(!r)return!1;const e=r.pendingTimelineChange({type:"audio"}),t=r.pendingTimelineChange({type:"main"}),i=e&&t,s=i&&e.to!==t.to;return!!(i&&e.from!==-1&&t.from!==-1&&s)},R2=r=>{const e=r.timelineChangeController_.pendingTimelineChange({type:"audio"}),t=r.timelineChangeController_.pendingTimelineChange({type:"main"});return e&&t&&e.to<t.to},qi=r=>{const e=r.pendingSegment_;if(!e)return;if(Oo({timelineChangeController:r.timelineChangeController_,currentTimeline:r.currentTimeline_,segmentTimeline:e.timeline,loaderType:r.loaderType_,audioDisabled:r.audioDisabled_})&&P2(r.timelineChangeController_)){if(R2(r)){r.timelineChangeController_.trigger("audioTimelineBehind");return}r.timelineChangeController_.trigger("fixBadTimelineChange")}},L2=r=>{let e=0;return["video","audio"].forEach(function(t){const i=r[`${t}TimingInfo`];if(!i)return;const{start:s,end:n}=i;let a;typeof s=="bigint"||typeof n=="bigint"?a=N.BigInt(n)-N.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},nd=({segmentDuration:r,maxDuration:e})=>r?Math.round(r)>e+Si:!1,N2=(r,e)=>{if(e!=="hls")return null;const t=L2({audioTimingInfo:r.audioTimingInfo,videoTimingInfo:r.videoTimingInfo});if(!t)return null;const i=r.playlist.targetDuration,s=nd({segmentDuration:t,maxDuration:i*2}),n=nd({segmentDuration:t,maxDuration:i}),a=`Segment with index ${r.mediaIndex} from playlist ${r.playlist.id} has a duration of ${t} when the reported duration is ${r.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 s||n?{severity:s?"warn":"info",message:a}:null},rr=({type:r,segment:e})=>{if(!e)return;const t=!!(e.key||e.map&&e.map.ke),i=!!(e.map&&!e.map.bytes),s=e.startOfSegment===void 0?e.start:e.startOfSegment;return{type:r||e.type,uri:e.resolvedUri||e.uri,start:s,duration:e.duration,isEncrypted:t,isMediaInitialization:i}};class Bo extends z.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_=Zt(`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_():qi(this)}),this.sourceUpdater_.on("codecschange",i=>{this.trigger(ot({type:"codecschange"},i))}),this.loaderType_==="main"&&this.timelineChangeController_.on("pendingtimelinechange",()=>{this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this)}),this.loaderType_==="audio"&&this.timelineChangeController_.on("timelinechange",i=>{this.trigger(ot({type:"timelinechange"},i)),this.hasEnoughInfoToLoad_()?this.processLoadQueue_():qi(this),this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(this)})}get mediaSequenceSync_(){return this.syncController_.getMediaSequenceSync(this.loaderType_)}createTransmuxer_(){return lo.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_&&N.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,N.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_&&lo.reset(this.transmuxer_),this.gopBuffer_.length=0,this.pause(),this.trigger("ended")}buffered_(){const e=this.getMediaInfo_();if(!this.sourceUpdater_||!e)return _t();if(this.loaderType_==="main"){const{hasAudio:t,hasVideo:i,isMuxed:s}=e;if(i&&t&&!this.audioDisabled_&&!s)return this.sourceUpdater_.buffered();if(i)return this.sourceUpdater_.videoBuffered()}return this.sourceUpdater_.audioBuffered()}initSegmentForMap(e,t=!1){if(!e)return null;const i=Fn(e);let s=this.initSegments_[i];return t&&!s&&e.bytes&&(this.initSegments_[i]=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 i=Wf(e);let s=this.keyCache_[i];this.cacheEncryptionKeys_&&t&&!s&&e.bytes&&(this.keyCache_[i]=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 i=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(i&&(i.id?n=i.id:i.uri&&(n=i.uri)),this.logger_(`playlist update [${n} => ${e.id||e.uri}]`),this.mediaSequenceSync_&&(this.mediaSequenceSync_.update(e,this.currentTime_()),this.logger_(`Playlist update:
|
|
209
189
|
currentTime: ${this.currentTime_()}
|
|
210
|
-
bufferedEnd: ${
|
|
211
|
-
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!
|
|
190
|
+
bufferedEnd: ${ao(this.buffered_())}
|
|
191
|
+
`,this.mediaSequenceSync_.diagnostics)),this.trigger("syncinfoupdate"),this.state==="INIT"&&this.couldBeginLoading_())return this.init_();if(!i||i.uri!==e.uri){this.mediaIndex!==null&&(!e.endList&&typeof e.partTargetDuration=="number"?this.resetLoader():this.resyncLoader()),this.currentMediaInfo_=void 0,this.trigger("playlistupdate");return}const a=e.mediaSequence-i.mediaSequence;if(this.logger_(`live window shift [${a}]`),this.mediaIndex!==null)if(this.mediaIndex-=a,this.mediaIndex<0)this.mediaIndex=null,this.partIndex=null;else{const o=this.playlist_.segments[this.mediaIndex];if(this.partIndex&&(!o.parts||!o.parts.length||!o.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(i,e)}pause(){this.checkBufferTimeout_&&(N.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_&&lo.reset(this.transmuxer_),this.mediaIndex=null,this.partIndex=null,this.syncPoint_=null,this.isPendingTimestampOffset_=!1;const e=this.currentMediaInfo_&&this.currentMediaInfo_.isFmp4;this.sourceType_==="hls"&&!e&&(this.shouldForceTimestampOffsetAfterResync_=!0),this.callQueue_=[],this.loadQueue_=[],this.metadataQueue_.id3=[],this.metadataQueue_.caption=[],this.abort(),this.transmuxer_&&this.transmuxer_.postMessage({action:"clearParsedMp4Captions"})}remove(e,t,i=()=>{},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&&i()};(s||!this.audioDisabled_)&&(n++,this.sourceUpdater_.removeAudio(e,t,a)),(s||this.loaderType_==="main")&&(this.gopBuffer_=E2(this.gopBuffer_,e,t,this.timeMapping_),n++,this.sourceUpdater_.removeVideo(e,t,a));for(const o in this.inbandTextTracks_)Ts(e,t,this.inbandTextTracks_[o]);Ts(e,t,this.segmentMetadataTrack_),a()}monitorBuffer_(){this.checkBufferTimeout_&&N.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=N.setTimeout(this.monitorBufferTick_.bind(this),1)}monitorBufferTick_(){this.state==="READY"&&this.fillBuffer_(),this.checkBufferTimeout_&&N.clearTimeout(this.checkBufferTimeout_),this.checkBufferTimeout_=N.setTimeout(this.monitorBufferTick_.bind(this),w2)}fillBuffer_(){if(this.sourceUpdater_.updating())return;const e=this.chooseNextRequest_();if(!e)return;const t={segmentInfo:rr({type:this.loaderType_,segment:e})};this.trigger({type:"segmentselected",metadata:t}),typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!1,this.timelineChangeController_.pendingTimelineChange({type:this.loaderType_,from:this.currentTimeline_,to:e.timeline})),this.loadSegment_(e)}isEndOfStream_(e=this.mediaIndex,t=this.playlist_,i=this.partIndex){if(!t||!this.mediaSource_)return!1;const s=typeof e=="number"&&t.segments[e],n=e+1===t.segments.length,a=!s||!s.parts||i+1===s.parts.length;return t.endList&&this.mediaSource_.readyState==="open"&&n&&a}chooseNextRequest_(){const e=this.buffered_(),t=ao(e)||0,i=bl(e,this.currentTime_()),s=!this.hasPlayed_()&&i>=1,n=i>=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 o={partIndex:null,mediaIndex:null,startOfSegment:null,playlist:this.playlist_,isSyncRequest:!this.syncPoint_};if(o.isSyncRequest)o.mediaIndex=A2(this.currentTimeline_,a,t),this.logger_(`choose next request. Can not find sync point. Fallback to media Index: ${o.mediaIndex}`);else if(this.mediaIndex!==null){const A=a[this.mediaIndex],b=typeof this.partIndex=="number"?this.partIndex:-1;o.startOfSegment=A.end?A.end:t,A.parts&&A.parts[b+1]?(o.mediaIndex=this.mediaIndex,o.partIndex=b+1):o.mediaIndex=this.mediaIndex+1}else{let A,b,k;const v=this.fetchAtBuffer_?t:this.currentTime_();if(this.mediaSequenceSync_&&this.logger_(`chooseNextRequest_ request after Quality Switch:
|
|
212
192
|
For TargetTime: ${v}.
|
|
213
193
|
CurrentTime: ${this.currentTime_()}
|
|
214
194
|
BufferedEnd: ${t}
|
|
215
195
|
Fetch At Buffer: ${this.fetchAtBuffer_}
|
|
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
|
-
${
|
|
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(`
|
|
196
|
+
`,this.mediaSequenceSync_.diagnostics),this.mediaSequenceSync_&&this.mediaSequenceSync_.isReliable){const L=this.getSyncInfoFromMediaSequenceSync_(v);if(!L){const U="No sync info found while using media sequence sync";return this.error({message:U,metadata:{errorType:z.Error.StreamingFailedToSelectNextSegment,error:new Error(U)}}),this.logger_("chooseNextRequest_ - no sync info found using media sequence sync"),null}this.logger_(`chooseNextRequest_ mediaSequence syncInfo (${L.start} --> ${L.end})`),A=L.segmentIndex,b=L.partIndex,k=L.start}else{this.logger_("chooseNextRequest_ - fallback to a regular segment selection algorithm, based on a syncPoint.");const L=Bt.getMediaInfoForTime({exactManifestTimings:this.exactManifestTimings,playlist:this.playlist_,currentTime:v,startingPartIndex:this.syncPoint_.partIndex,startingSegmentIndex:this.syncPoint_.segmentIndex,startTime:this.syncPoint_.time});A=L.segmentIndex,b=L.partIndex,k=L.startTime}o.getMediaInfoForTime=this.fetchAtBuffer_?`bufferedEnd ${v}`:`currentTime ${v}`,o.mediaIndex=A,o.startOfSegment=k,o.partIndex=b,this.logger_(`choose next request. Playlist switched and we have a sync point. Media Index: ${o.mediaIndex} `)}const u=a[o.mediaIndex];let d=u&&typeof o.partIndex=="number"&&u.parts&&u.parts[o.partIndex];if(!u||typeof o.partIndex=="number"&&!d)return null;typeof o.partIndex!="number"&&u.parts&&(o.partIndex=0,d=u.parts[0]);const p=this.vhs_.playlists&&this.vhs_.playlists.main&&this.vhs_.playlists.main.independentSegments||this.playlist_.independentSegments;if(!i&&d&&!p&&!d.independent)if(o.partIndex===0){const A=a[o.mediaIndex-1],b=A.parts&&A.parts.length&&A.parts[A.parts.length-1];b&&b.independent&&(o.mediaIndex-=1,o.partIndex=A.parts.length-1,o.independent="previous segment")}else u.parts[o.partIndex-1].independent&&(o.partIndex-=1,o.independent="previous part");const T=this.mediaSource_&&this.mediaSource_.readyState==="ended";return o.mediaIndex>=a.length-1&&T&&!this.seeking_()?null:(this.shouldForceTimestampOffsetAfterResync_&&(this.shouldForceTimestampOffsetAfterResync_=!1,o.forceTimestampOffset=!0,this.logger_("choose next request. Force timestamp offset after loader resync")),this.generateSegmentInfo_(o))}getSyncInfoFromMediaSequenceSync_(e){if(!this.mediaSequenceSync_)return null;const t=Math.max(e,this.mediaSequenceSync_.start);e!==t&&this.logger_(`getSyncInfoFromMediaSequenceSync_. Pulled target time from ${e} to ${t}`);const i=this.mediaSequenceSync_.getSyncInfoForTime(t);if(!i)return null;if(!i.isAppended)return i;const s=this.mediaSequenceSync_.getSyncInfoForTime(i.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:i,mediaIndex:s,startOfSegment:n,isSyncRequest:a,partIndex:o,forceTimestampOffset:u,getMediaInfoForTime:d}=e,p=i.segments[s],T=typeof o=="number"&&p.parts[o],A={requestId:"segment-loader-"+Math.random(),uri:T&&T.resolvedUri||p.resolvedUri,mediaIndex:s,partIndex:T?o:null,isSyncRequest:a,startOfSegment:n,playlist:i,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:d,independent:t},b=typeof u<"u"?u:this.isPendingTimestampOffset_;A.timestampOffset=this.timestampOffsetForSegment_({segmentTimeline:p.timeline,currentTimeline:this.currentTimeline_,startOfSegment:n,buffered:this.buffered_(),overrideCheck:b});const k=ao(this.sourceUpdater_.audioBuffered());return typeof k=="number"&&(A.audioAppendStart=k-this.sourceUpdater_.audioTimestampOffset()),this.sourceUpdater_.videoBuffered().length&&(A.gopsToAlignWith=x2(this.gopBuffer_,this.currentTime_()-this.sourceUpdater_.videoTimestampOffset(),this.timeMapping_)),A}timestampOffsetForSegment_(e){return k2(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,s=this.pendingSegment_.duration,n=Bt.estimateSegmentRequestTime(s,i,this.playlist_,e.bytesReceived),a=Qv(this.buffered_(),t,this.vhs_.tech_.playbackRate())-1;if(n<=a)return;const o=d2({main:this.vhs_.playlists.main,currentTime:t,bandwidth:i,duration:this.duration_(),segmentDuration:s,timeUntilRebuffer:a,currentTimeline:this.currentTimeline_,syncController:this.syncController_});if(!o)return;const d=n-a-o.rebufferingImpact;let p=.5;a<=Si&&(p=1),!(!o.playlist||o.playlist.uri===this.playlist_.uri||d<p)&&(this.bandwidth=o.playlist.attributes.BANDWIDTH*gt.BANDWIDTH_VARIANCE+1,this.trigger("earlyabort"))}handleAbort_(e){this.logger_(`Aborting ${_r(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:s}=t,n={segmentInfo:rr({type:this.loaderType_,segment:e}),trackInfo:{hasAudio:i,hasVideo:s}};this.trigger({type:"segmenttransmuxingtrackinfoavailable",metadata:n}),this.earlyAbortWhenNeeded_(e.stats),!this.checkForAbort_(e.requestId)&&(this.checkForIllegalMediaSwitch(t)||(t=t||{},C2(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_():qi(this))))}handleTimingInfo_(e,t,i,s){if(this.earlyAbortWhenNeeded_(e.stats),this.checkForAbort_(e.requestId))return;const n=this.pendingSegment_,a=sd(t);n[a]=n[a]||{},n[a][i]=s,this.logger_(`timinginfo: ${t} - ${i} - ${s}`),this.hasEnoughInfoToAppend_()?this.processCallQueue_():qi(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 o=n[a.stream];o.startTime=Math.min(o.startTime,a.startTime+s),o.endTime=Math.max(o.endTime,a.endTime+s),o.captions.push(a)}),Object.keys(n).forEach(a=>{const{startTime:o,endTime:u,captions:d}=n[a],p=this.inbandTextTracks_;this.logger_(`adding cues from ${o} -> ${u} for ${a}`),p2(p,this.vhs_.tech_,a),Ts(o,u,p[a]),m2({captionArray:d,inbandTextTracks:p,timestampOffset:s})}),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_()?!Oo({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:s,isMuxed:n}=t;return!(s&&!e.videoTimingInfo||i&&!this.audioDisabled_&&!n&&!e.audioTimingInfo||Oo({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_()){qi(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[sd(t.type)].start;else{const s=this.getCurrentMediaInfo_(),n=this.loaderType_==="main"&&s&&s.hasVideo;let a;n&&(a=i.videoTimingInfo.start),i.timingInfo.start=this.trueSegmentStart_({currentStart:i.timingInfo.start,playlist:i.playlist,mediaIndex:i.mediaIndex,currentVideoTimestampOffset:this.sourceUpdater_.videoTimestampOffset(),useVideoTimingInfo:n,firstVideoFrameTimeForData:a,videoTimingInfo:i.videoTimingInfo,audioTimingInfo:i.audioTimingInfo})}if(this.updateAppendInitSegmentStatus(i,t.type),this.updateSourceBufferTimestampOffset_(i),i.isSyncRequest){this.updateTimingInfoEnd_(i),this.syncController_.saveSegmentTimingInfo({segmentInfo:i,shouldSaveTimelineMapping:this.loaderType_==="main"});const s=this.chooseNextRequest_();if(s.mediaIndex!==i.mediaIndex||s.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:s}){if(i){const n=Fn(i);if(this.activeInitSegmentId_===n)return null;t=this.initSegmentForMap(i,!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:i},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: "+nr(n).join(", ")),a.length>1&&this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: "+nr(a).join(", "));const o=n.length?n.start(0):0,u=n.length?n.end(n.length-1):0,d=a.length?a.start(0):0,p=a.length?a.end(a.length-1):0;if(u-o<=ms&&p-d<=ms){this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${i.byteLength}, audio buffer: ${nr(n).join(", ")}, video buffer: ${nr(a).join(", ")}, `),this.error({message:"Quota exceeded error with append of a single segment of content",excludeUntil:1/0}),this.trigger("error");return}this.waitingOnRemove_=!0,this.callQueue_.push(this.appendToSourceBuffer_.bind(this,{segmentInfo:e,type:t,bytes:i}));const A=this.currentTime_()-ms;this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${A}`),this.remove(0,A,()=>{this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${ms}s`),this.waitingOnRemove_=!1,this.quotaExceededErrorRetryTimeout_=N.setTimeout(()=>{this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue"),this.quotaExceededErrorRetryTimeout_=null,this.processCallQueue_()},ms*1e3)},!0)}handleAppendError_({segmentInfo:e,type:t,bytes:i},s){if(s){if(s.code===$f){this.handleQuotaExceededError_({segmentInfo:e,type:t,bytes:i});return}this.logger_("Received non QUOTA_EXCEEDED_ERR on append",s),this.error({message:`${t} append of ${i.length}b failed for segment #${e.mediaIndex} in playlist ${e.playlist.id}`,metadata:{errorType:z.Error.StreamingFailedToAppendSegment}}),this.trigger("appenderror")}}appendToSourceBuffer_({segmentInfo:e,type:t,initSegment:i,data:s,bytes:n}){if(!n){const o=[s];let u=s.byteLength;i&&(o.unshift(i),u+=i.byteLength),n=f2({bytes:u,segments:o})}const a={segmentInfo:rr({type:this.loaderType_,segment:e})};this.trigger({type:"segmentappendstart",metadata:a}),this.sourceUpdater_.appendBuffer({segmentInfo:e,type:t,bytes:n},this.handleAppendError_.bind(this,{segmentInfo:e,type:t,bytes:n}))}handleSegmentTimingInfo_(e,t,i){if(!this.pendingSegment_||t!==this.pendingSegment_.requestId)return;const s=this.pendingSegment_.segment,n=`${e}TimingInfo`;s[n]||(s[n]={}),s[n].transmuxerPrependedSeconds=i.prependedContentDuration||0,s[n].transmuxedPresentationStart=i.start.presentation,s[n].transmuxedDecodeStart=i.start.decode,s[n].transmuxedPresentationEnd=i.end.presentation,s[n].transmuxedDecodeEnd=i.end.decode,s[n].baseMediaDecodeTime=i.baseMediaDecodeTime}appendData_(e,t){const{type:i,data:s}=t;if(!s||!s.byteLength||i==="audio"&&this.audioDisabled_)return;const n=this.getInitSegmentAndUpdateState_({type:i,initSegment:t.initSegment,playlist:e.playlist,map:e.isFmp4?e.segment.map:null});this.appendToSourceBuffer_({segmentInfo:e,type:i,initSegment:n,data: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_()){qi(this),this.loadQueue_.push(()=>{const t=ot({},e,{forceTimestampOffset:!0});ot(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),s=this.mediaIndex!==null,n=e.timeline!==this.currentTimeline_&&e.timeline>0,a=i||s&&n;this.logger_(`Requesting
|
|
197
|
+
${cp(e.uri)}
|
|
198
|
+
${_r(e)}`),t.map&&!t.map.bytes&&(this.logger_("going to request init segment."),this.appendInitSegment_={video:!0,audio:!0}),e.abortRequests=n2({xhr:this.vhs_.xhr,xhrOptions:this.xhrOptions_,decryptionWorker:this.decrypter_,segment:t,abortFn:this.handleAbort_.bind(this,e),progressFn:this.handleProgress_.bind(this),trackInfoFn:this.handleTrackInfo_.bind(this),timingInfoFn:this.handleTimingInfo_.bind(this),videoSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"video",e.requestId),audioSegmentTimingInfoFn:this.handleSegmentTimingInfo_.bind(this,"audio",e.requestId),captionsFn:this.handleCaptions_.bind(this),isEndOfTimeline:a,endedTimelineFn:()=>{this.logger_("received endedtimeline callback")},id3Fn:this.handleId3_.bind(this),dataFn:this.handleData_.bind(this),doneFn:this.segmentRequestFinished_.bind(this),onTransmuxerLog:({message:o,level:u,stream:d})=>{this.logger_(`${_r(e)} logged from transmuxer stream ${d} as a ${u}: ${o}`)},triggerSegmentEventFn:({type:o,segment:u,keyInfo:d,trackInfo:p,timingInfo:T})=>{const b={segmentInfo:rr({segment:u})};d&&(b.keyInfo=d),p&&(b.trackInfo=p),T&&(b.timingInfo=T),this.trigger({type:o,metadata:b})}})}trimBackBuffer_(e){const t=I2(this.seekable_(),this.currentTime_(),this.playlist_.targetDuration||10);t>0&&this.remove(0,t)}createSimplifiedSegmentObj_(e){const t=e.segment,i=e.part,s=e.segment.key||e.segment.map&&e.segment.map.key,n=e.segment.map&&!e.segment.map.bytes,a={resolvedUri:i?i.resolvedUri:t.resolvedUri,byterange:i?i.byterange:t.byterange,requestId:e.requestId,transmuxer:e.transmuxer,audioAppendStart:e.audioAppendStart,gopsToAlignWith:e.gopsToAlignWith,part:e.part,type:this.loaderType_,start:e.startOfSegment,duration:e.duration,isEncrypted:s,isMediaInitialization:n},o=e.playlist.segments[e.mediaIndex-1];if(o&&o.timeline===t.timeline&&(o.videoTimingInfo?a.baseStartTime=o.videoTimingInfo.transmuxedDecodeEnd:o.audioTimingInfo&&(a.baseStartTime=o.audioTimingInfo.transmuxedDecodeEnd)),t.key){const 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<mn){this.logger_(`Ignoring segment's bandwidth because its duration of ${e} is less than the min to record ${mn}`);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===Ci.ABORTED)return;if(this.pause(),e.code===Ci.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,i.gopInfo&&(this.gopBuffer_=S2(this.gopBuffer_,i.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:i,firstVideoFrameTimeForData:s,currentVideoTimestampOffset:n,useVideoTimingInfo:a,videoTimingInfo:o,audioTimingInfo:u}){if(typeof e<"u")return e;if(!a)return u.start;const d=t.segments[i-1];return i===0||!d||typeof d.start>"u"||d.end!==s+n?s:o.start}waitForAppendsToComplete_(e){const t=this.getCurrentMediaInfo_(e);if(!t){this.error({message:"No starting media returned, likely due to an unsupported media format.",playlistExclusionDuration:1/0}),this.trigger("error");return}const{hasAudio:i,hasVideo:s,isMuxed:n}=t,a=this.loaderType_==="main"&&s,o=!this.audioDisabled_&&i&&!n;if(e.waitingOnAppends=0,!e.hasAppendedData_){!e.timingInfo&&typeof e.timestampOffset=="number"&&(this.isPendingTimestampOffset_=!0),e.timingInfo={start:0},e.waitingOnAppends++,this.isPendingTimestampOffset_||(this.updateSourceBufferTimestampOffset_(e),this.processMetadataQueue_()),this.checkAppendsDone_(e);return}a&&e.waitingOnAppends++,o&&e.waitingOnAppends++,a&&this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this,e)),o&&this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this,e))}checkAppendsDone_(e){this.checkForAbort_(e.requestId)||(e.waitingOnAppends--,e.waitingOnAppends===0&&this.handleAppendsDone_())}checkForIllegalMediaSwitch(e){const t=D2(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_(),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:rr({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=N2(e,this.sourceType_);if(t&&(t.severity==="warn"?z.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 ${_r(e)}`);return}this.logger_(`Appended ${_r(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,s=e.part,n=i.end&&this.currentTime_()-i.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"} ${_r(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<mn){this.logger_(`Ignoring segment's throughput because its duration of ${e.duration} is less than the min to record ${mn}`);return}const t=this.throughput.rate,i=Date.now()-e.endOfAllRequests+1,s=Math.floor(e.byteLength/i*8*1e3);this.throughput.rate+=(s-t)/++this.throughput.count}addSegmentMetadataCue_(e){if(!this.segmentMetadataTrack_)return;const t=e.segment,i=t.start,s=t.end;if(!rd(i)||!rd(s))return;Ts(i,s,this.segmentMetadataTrack_);const n=N.WebKitDataCue||N.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:s},o=JSON.stringify(a),u=new n(i,s,o);u.value=a,this.segmentMetadataTrack_.addCue(u)}}function Ni(){}const dp=function(r){return typeof r!="string"?r:r.replace(/./,e=>e.toUpperCase())},O2=["video","audio"],Mo=(r,e)=>{const t=e[`${r}Buffer`];return t&&t.updating||e.queuePending[r]},B2=(r,e)=>{for(let t=0;t<e.length;t++){const i=e[t];if(i.type==="mediaSource")return null;if(i.type===r)return t}return null},kr=(r,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(),kr("audio",e),kr("video",e));return}if(r!=="mediaSource"&&!(!e.ready()||e.mediaSource.readyState==="closed"||Mo(r,e))){if(i.type!==r){if(t=B2(r,e.queue),t===null)return;i=e.queue[t]}if(e.queue.splice(t,1),e.queuePending[r]=i,i.action(r,e),!i.doneFn){e.queuePending[r]=null,kr(r,e);return}}},hp=(r,e)=>{const t=e[`${r}Buffer`],i=dp(r);t&&(t.removeEventListener("updateend",e[`on${i}UpdateEnd_`]),t.removeEventListener("error",e[`on${i}Error_`]),e.codecs[r]=null,e[`${r}Buffer`]=null)},vi=(r,e)=>r&&e&&Array.prototype.indexOf.call(r.sourceBuffers,e)!==-1,$t={appendBuffer:(r,e,t)=>(i,s)=>{const n=s[`${i}Buffer`];if(vi(s.mediaSource,n)){s.logger_(`Appending segment ${e.mediaIndex}'s ${r.length} bytes to ${i}Buffer`);try{n.appendBuffer(r)}catch(a){s.logger_(`Error with code ${a.code} `+(a.code===$f?"(QUOTA_EXCEEDED_ERR) ":"")+`when appending segment ${e.mediaIndex} to ${i}Buffer`),s.queuePending[i]=null,t(a)}}},remove:(r,e)=>(t,i)=>{const s=i[`${t}Buffer`];if(vi(i.mediaSource,s)){i.logger_(`Removing ${r} to ${e} from ${t}Buffer`);try{s.remove(r,e)}catch{i.logger_(`Remove ${r} to ${e} from ${t}Buffer failed`)}}},timestampOffset:r=>(e,t)=>{const i=t[`${e}Buffer`];vi(t.mediaSource,i)&&(t.logger_(`Setting ${e}timestampOffset to ${r}`),i.timestampOffset=r)},callback:r=>(e,t)=>{r()},endOfStream:r=>e=>{if(e.mediaSource.readyState==="open"){e.logger_(`Calling mediaSource endOfStream(${r||""})`);try{e.mediaSource.endOfStream(r)}catch(t){z.log.warn("Failed to call media source endOfStream",t)}}},duration:r=>e=>{e.logger_(`Setting mediaSource duration to ${r}`);try{e.mediaSource.duration=r}catch(t){z.log.warn("Failed to set media source duration",t)}},abort:()=>(r,e)=>{if(e.mediaSource.readyState!=="open")return;const t=e[`${r}Buffer`];if(vi(e.mediaSource,t)){e.logger_(`calling abort on ${r}Buffer`);try{t.abort()}catch(i){z.log.warn(`Failed to abort on ${r}Buffer`,i)}}},addSourceBuffer:(r,e)=>t=>{const i=dp(r),s=Pr(e);t.logger_(`Adding ${r}Buffer with codec ${e} to mediaSource`);const n=t.mediaSource.addSourceBuffer(s);n.addEventListener("updateend",t[`on${i}UpdateEnd_`]),n.addEventListener("error",t[`on${i}Error_`]),t.codecs[r]=e,t[`${r}Buffer`]=n},removeSourceBuffer:r=>e=>{const t=e[`${r}Buffer`];if(hp(r,e),!!vi(e.mediaSource,t)){e.logger_(`Removing ${r}Buffer with codec ${e.codecs[r]} from mediaSource`);try{e.mediaSource.removeSourceBuffer(t)}catch(i){z.log.warn(`Failed to removeSourceBuffer ${r}Buffer`,i)}}},changeType:r=>(e,t)=>{const i=t[`${e}Buffer`],s=Pr(r);if(!vi(t.mediaSource,i))return;const n=r.substring(0,r.indexOf(".")),a=t.codecs[e];if(a.substring(0,a.indexOf("."))===n)return;const u={codecsChangeInfo:{from:a,to:r}};t.trigger({type:"codecschange",metadata:u}),t.logger_(`changing ${e}Buffer codec from ${a} to ${r}`);try{i.changeType(s),t.codecs[e]=r}catch(d){u.errorType=z.Error.StreamingCodecsChangeError,u.error=d,d.metadata=u,t.error_=d,t.trigger("error"),z.log.warn(`Failed to changeType on ${e}Buffer`,d)}}},jt=({type:r,sourceUpdater:e,action:t,doneFn:i,name:s})=>{e.queue.push({type:r,action:t,doneFn:i,name:s}),kr(r,e)},ad=(r,e)=>t=>{const i=e[`${r}Buffered`](),s=Kv(i);if(e.logger_(`received "updateend" event for ${r} Source Buffer: `,s),e.queuePending[r]){const n=e.queuePending[r].doneFn;e.queuePending[r]=null,n&&n(e[`${r}Error_`])}kr(r,e)};class fp extends z.EventTarget{constructor(e){super(),this.mediaSource=e,this.sourceopenListener_=()=>kr("mediaSource",this),this.mediaSource.addEventListener("sourceopen",this.sourceopenListener_),this.logger_=Zt("SourceUpdater"),this.audioTimestampOffset_=0,this.videoTimestampOffset_=0,this.queue=[],this.queuePending={audio:null,video:null},this.delayedAudioAppendQueue_=[],this.videoAppendQueued_=!1,this.codecs={},this.onVideoUpdateEnd_=ad("video",this),this.onAudioUpdateEnd_=ad("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){jt({type:"mediaSource",sourceUpdater:this,action:$t.addSourceBuffer(e,t),name:"addSourceBuffer"})}abort(e){jt({type:e,sourceUpdater:this,action:$t.abort(e),name:"abort"})}removeSourceBuffer(e){if(!this.canRemoveSourceBuffer()){z.log.error("removeSourceBuffer is not supported!");return}jt({type:"mediaSource",sourceUpdater:this,action:$t.removeSourceBuffer(e),name:"removeSourceBuffer"})}canRemoveSourceBuffer(){return!z.browser.IS_FIREFOX&&N.MediaSource&&N.MediaSource.prototype&&typeof N.MediaSource.prototype.removeSourceBuffer=="function"}static canChangeType(){return N.SourceBuffer&&N.SourceBuffer.prototype&&typeof N.SourceBuffer.prototype.changeType=="function"}canChangeType(){return this.constructor.canChangeType()}changeType(e,t){if(!this.canChangeType()){z.log.error("changeType is not supported!");return}jt({type:e,sourceUpdater:this,action:$t.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: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(jt({type:s,sourceUpdater:this,action:$t.appendBuffer(n,i||{mediaIndex:-1},a),doneFn:t,name:"appendBuffer"}),s==="video"){if(this.videoAppendQueued_=!0,!this.delayedAudioAppendQueue_.length)return;const o=this.delayedAudioAppendQueue_.slice();this.logger_(`queuing delayed audio ${o.length} appendBuffers`),this.delayedAudioAppendQueue_.length=0,o.forEach(u=>{this.appendBuffer.apply(this,u)})}}audioBuffered(){return vi(this.mediaSource,this.audioBuffer)&&this.audioBuffer.buffered?this.audioBuffer.buffered:_t()}videoBuffered(){return vi(this.mediaSource,this.videoBuffer)&&this.videoBuffer.buffered?this.videoBuffer.buffered:_t()}buffered(){const e=vi(this.mediaSource,this.videoBuffer)?this.videoBuffer:null,t=vi(this.mediaSource,this.audioBuffer)?this.audioBuffer:null;return t&&!e?this.audioBuffered():e&&!t?this.videoBuffered():Yv(this.audioBuffered(),this.videoBuffered())}setDuration(e,t=Ni){jt({type:"mediaSource",sourceUpdater:this,action:$t.duration(e),name:"duration",doneFn:t})}endOfStream(e=null,t=Ni){typeof e!="string"&&(e=void 0),jt({type:"mediaSource",sourceUpdater:this,action:$t.endOfStream(e),name:"endOfStream",doneFn:t})}removeAudio(e,t,i=Ni){if(!this.audioBuffered().length||this.audioBuffered().end(0)===0){i();return}jt({type:"audio",sourceUpdater:this,action:$t.remove(e,t),doneFn:i,name:"remove"})}removeVideo(e,t,i=Ni){if(!this.videoBuffered().length||this.videoBuffered().end(0)===0){i();return}jt({type:"video",sourceUpdater:this,action:$t.remove(e,t),doneFn:i,name:"remove"})}updating(){return!!(Mo("audio",this)||Mo("video",this))}audioTimestampOffset(e){return typeof e<"u"&&this.audioBuffer&&this.audioTimestampOffset_!==e&&(jt({type:"audio",sourceUpdater:this,action:$t.timestampOffset(e),name:"timestampOffset"}),this.audioTimestampOffset_=e),this.audioTimestampOffset_}videoTimestampOffset(e){return typeof e<"u"&&this.videoBuffer&&this.videoTimestampOffset_!==e&&(jt({type:"video",sourceUpdater:this,action:$t.timestampOffset(e),name:"timestampOffset"}),this.videoTimestampOffset_=e),this.videoTimestampOffset_}audioQueueCallback(e){this.audioBuffer&&jt({type:"audio",sourceUpdater:this,action:$t.callback(e),name:"callback"})}videoQueueCallback(e){this.videoBuffer&&jt({type:"video",sourceUpdater:this,action:$t.callback(e),name:"callback"})}dispose(){this.trigger("dispose"),O2.forEach(e=>{this.abort(e),this.canRemoveSourceBuffer()?this.removeSourceBuffer(e):this[`${e}QueueCallback`](()=>hp(e,this))}),this.videoAppendQueued_=!1,this.delayedAudioAppendQueue_.length=0,this.sourceopenListener_&&this.mediaSource.removeEventListener("sourceopen",this.sourceopenListener_),this.off()}}const od=r=>decodeURIComponent(escape(String.fromCharCode.apply(null,r))),M2=r=>{const e=new Uint8Array(r);return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")},ld=new Uint8Array(`
|
|
219
199
|
|
|
220
|
-
`.split("").map(
|
|
221
|
-
`,a=
|
|
222
|
-
`,
|
|
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;
|
|
200
|
+
`.split("").map(r=>r.charCodeAt(0)));class F2 extends Error{constructor(){super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.")}}class U2 extends Bo{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 _t();const e=this.subtitlesTrack_.cues,t=e[0].startTime,i=e[e.length-1].startTime;return _t([[t,i]])}initSegmentForMap(e,t=!1){if(!e)return null;const i=Fn(e);let s=this.initSegments_[i];if(t&&!s&&e.bytes){const n=ld.byteLength+e.bytes.byteLength,a=new Uint8Array(n);a.set(e.bytes),a.set(ld,e.bytes.byteLength),this.initSegments_[i]=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){Ts(e,t,this.subtitlesTrack_)}fillBuffer_(){const e=this.chooseNextRequest_();if(e){if(this.syncController_.timestampOffsetForTimeline(e.timeline)===null){const t=()=>{this.state="READY",this.paused()||this.monitorBuffer_()};this.syncController_.one("timestampoffset",t),this.state="WAITING_ON_TIMELINE";return}this.loadSegment_(e)}}timestampOffsetForSegment_(){return null}chooseNextRequest_(){return this.skipEmptySegments_(super.chooseNextRequest_())}skipEmptySegments_(e){for(;e&&e.segment.empty;){if(e.mediaIndex+1>=e.playlist.segments.length){e=null;break}e=this.generateSegmentInfo_({playlist:e.playlist,mediaIndex:e.mediaIndex+1,startOfSegment:e.startOfSegment+e.duration,isSyncRequest:e.isSyncRequest})}return e}stopForError(e){this.error(e),this.state="READY",this.pause(),this.trigger("error")}segmentRequestFinished_(e,t,i){if(!this.subtitlesTrack_){this.state="READY";return}if(this.saveTransferStats_(t.stats),!this.pendingSegment_){this.state="READY",this.mediaRequestsAborted+=1;return}if(e){e.code===Ci.TIMEOUT&&this.handleTimeout_(),e.code===Ci.ABORTED?this.mediaRequestsAborted+=1:this.mediaRequestsErrored+=1,this.stopForError(e);return}const s=this.pendingSegment_,n=i.mp4VttCues&&i.mp4VttCues.length;n&&(s.mp4VttCues=i.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 N.WebVTT!="function"&&typeof this.loadVttJs=="function"){this.state="WAITING_ON_VTTJS",this.loadVttJs().then(()=>this.segmentRequestFinished_(e,t,i),()=>this.stopForError({message:"Error loading vtt.js"}));return}a.requested=!0;try{this.parseVTTCues_(s)}catch(o){this.stopForError({message:o.message,metadata:{errorType:z.Error.StreamingVttParserError,error:o}});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(o=>{this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_?new N.VTTCue(o.startTime,o.endTime,o.text):o)}),b2(this.subtitlesTrack_),this.handleAppendsDone_()}handleData_(e,t){const i=e&&e.type==="vtt",s=t&&t.type==="text";i&&s&&super.handleData_(e,t)}updateTimingInfoEnd_(){}parseMp4VttCues_(e){const t=this.sourceUpdater_.videoTimestampOffset()===null?this.sourceUpdater_.audioTimestampOffset():this.sourceUpdater_.videoTimestampOffset();e.mp4VttCues.forEach(i=>{const s=i.start+t,n=i.end+t,a=new N.VTTCue(s,n,i.cueText);i.settings&&i.settings.split(" ").forEach(o=>{const u=o.split(":"),d=u[0],p=u[1];a[d]=isNaN(p)?p:Number(p)}),e.cues.push(a)})}parseVTTCues_(e){let t,i=!1;if(typeof N.WebVTT!="function")throw new F2;if(e.cues=[],e.timestampmap={MPEGTS:0,LOCAL:0},e.mp4VttCues){this.parseMp4VttCues_(e);return}typeof N.TextDecoder=="function"?t=new N.TextDecoder("utf8"):(t=N.WebVTT.StringDecoder(),i=!0);const s=new N.WebVTT.Parser(N,N.vttjs,t);if(s.oncue=e.cues.push.bind(e.cues),s.ontimestampmap=a=>{e.timestampmap=a},s.onparsingerror=a=>{z.log.warn("Error encountered when parsing cues: "+a.message)},e.segment.map){let a=e.segment.map.bytes;i&&(a=od(a)),s.parse(a)}let n=e.bytes;i&&(n=od(n)),s.parse(n),s.flush()}updateTimeMapping_(e,t,i){const s=e.segment;if(!t)return;if(!e.cues.length){s.empty=!0;return}const{MPEGTS:n,LOCAL:a}=e.timestampmap,u=n/sr.ONE_SECOND_IN_TS-a+t.mapping;if(e.cues.forEach(d=>{const p=d.endTime-d.startTime,T=this.handleRollover_(d.startTime+u,t.time);d.startTime=Math.max(T,0),d.endTime=Math.max(T+p,0)}),!i.syncInfo){const d=e.cues[0].startTime,p=e.cues[e.cues.length-1].startTime;i.syncInfo={mediaSequence:i.mediaSequence+e.mediaIndex,time:Math.min(d,p-s.duration)}}}handleRollover_(e,t){if(t===null)return e;let i=e*sr.ONE_SECOND_IN_TS;const s=t*sr.ONE_SECOND_IN_TS;let n;for(s<i?n=-8589934592:n=8589934592;Math.abs(i-s)>4294967296;)i+=n;return i/sr.ONE_SECOND_IN_TS}}const $2=function(r,e){const t=r.cues;for(let i=0;i<t.length;i++){const s=t[i];if(e>=s.adStartTime&&e<=s.adEndTime)return s}return null},j2=function(r,e,t=0){if(!r.segments)return;let i=t,s;for(let n=0;n<r.segments.length;n++){const a=r.segments[n];if(s||(s=$2(e,i+a.duration/2)),s){if("cueIn"in a){s.endTime=i,s.adEndTime=i,i+=a.duration,s=null;continue}if(i<s.endTime){i+=a.duration;continue}s.endTime+=a.duration}else if("cueOut"in a&&(s=new N.VTTCue(i,i+a.duration,a.cueOut),s.adStartTime=i,s.adEndTime=i+parseFloat(a.cueOut),e.addCue(s)),"cueOutCont"in a){const[o,u]=a.cueOutCont.split("/").map(parseFloat);s=new N.VTTCue(i,i+a.duration,""),s.adStartTime=i-o,s.adEndTime=s.adStartTime+u,e.addCue(s)}i+=a.duration}};class ud{constructor({start:e,end:t,segmentIndex:i,partIndex:s=null,appended:n=!1}){this.start_=e,this.end_=t,this.segmentIndex_=i,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 q2{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 pp{constructor(){this.storage_=new Map,this.diagnostics_="",this.isReliable_=!1,this.start_=-1/0,this.end_=1/0}get start(){return this.start_}get end(){return this.end_}get diagnostics(){return this.diagnostics_}get isReliable(){return this.isReliable_}resetAppendedStatus(){this.storage_.forEach(e=>e.resetAppendStatus())}update(e,t){const{mediaSequence:i,segments:s}=e;if(this.isReliable_=this.isReliablePlaylist_(i,s),!!this.isReliable_)return this.updateStorage_(s,i,this.calculateBaseTime_(i,s,t))}getSyncInfoForTime(e){for(const{segmentSyncInfo:t,partsSyncInfo:i}of this.storage_.values())if(i.length){for(const s of i)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,i){const s=new Map;let n=`
|
|
201
|
+
`,a=i,o=t;this.start_=a,e.forEach((u,d)=>{const p=this.storage_.get(o),T=a,A=T+u.duration,b=!!(p&&p.segmentSyncInfo&&p.segmentSyncInfo.isAppended),k=new ud({start:T,end:A,appended:b,segmentIndex:d});u.syncInfo=k;let v=a;const L=(u.parts||[]).map((U,$)=>{const F=v,H=v+U.duration,B=!!(p&&p.partsSyncInfo&&p.partsSyncInfo[$]&&p.partsSyncInfo[$].isAppended),V=new ud({start:F,end:H,appended:B,segmentIndex:d,partIndex:$});return v=H,n+=`Media Sequence: ${o}.${$} | Range: ${F} --> ${H} | Appended: ${B}
|
|
202
|
+
`,U.syncInfo=V,V});s.set(o,new q2(k,L)),n+=`${cp(u.resolvedUri)} | Media Sequence: ${o} | Range: ${T} --> ${A} | Appended: ${b}
|
|
203
|
+
`,o++,a=A}),this.end_=a,this.storage_=s,this.diagnostics_=n}calculateBaseTime_(e,t,i){if(!this.storage_.size)return 0;if(this.storage_.has(e))return this.storage_.get(e).segmentSyncInfo.start;const s=Math.min(...this.storage_.keys());if(e<s){const n=s-e;let a=this.storage_.get(s).segmentSyncInfo.start;for(let o=0;o<n;o++){const u=t[o];a-=u.duration}return a}return i}isReliablePlaylist_(e,t){return e!=null&&Array.isArray(t)&&t.length}}class cd extends pp{constructor(e){super(),this.parent_=e}calculateBaseTime_(e,t,i){if(!this.storage_.size){const s=this.parent_.getSyncInfoForMediaSequence(e);return s?s.segmentSyncInfo.start:0}return super.calculateBaseTime_(e,t,i)}}const V2=86400,uo=[{name:"VOD",run:(r,e,t,i,s)=>t!==1/0?{time:0,segmentIndex:0,partIndex:null}:null},{name:"MediaSequence",run:(r,e,t,i,s,n)=>{const a=r.getMediaSequenceSync(n);if(!a||!a.isReliable)return null;const o=a.getSyncInfoForTime(s);return o?{time:o.start,partIndex:o.partIndex,segmentIndex:o.segmentIndex}:null}},{name:"ProgramDateTime",run:(r,e,t,i,s)=>{if(!Object.keys(r.timelineToDatetimeMappings).length)return null;let n=null,a=null;const o=wo(e);s=s||0;for(let u=0;u<o.length;u++){const d=e.endList||s===0?u:o.length-(u+1),p=o[d],T=p.segment,A=r.timelineToDatetimeMappings[T.timeline];if(!A||!T.dateTimeObject)continue;let k=T.dateTimeObject.getTime()/1e3+A;if(T.parts&&typeof p.partIndex=="number")for(let L=0;L<p.partIndex;L++)k+=T.parts[L].duration;const v=Math.abs(s-k);if(a!==null&&(v===0||a<v))break;a=v,n={time:k,segmentIndex:p.segmentIndex,partIndex:p.partIndex}}return n}},{name:"Segment",run:(r,e,t,i,s)=>{let n=null,a=null;s=s||0;const o=wo(e);for(let u=0;u<o.length;u++){const d=e.endList||s===0?u:o.length-(u+1),p=o[d],T=p.segment,A=p.part&&p.part.start||T&&T.start;if(T.timeline===i&&typeof A<"u"){const b=Math.abs(s-A);if(a!==null&&a<b)break;(!n||a===null||a>=b)&&(a=b,n={time:A,segmentIndex:p.segmentIndex,partIndex:p.partIndex})}}return n}},{name:"Discontinuity",run:(r,e,t,i,s)=>{let n=null;if(s=s||0,e.discontinuityStarts&&e.discontinuityStarts.length){let a=null;for(let o=0;o<e.discontinuityStarts.length;o++){const u=e.discontinuityStarts[o],d=e.discontinuitySequence+o+1,p=r.discontinuities[d];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:(r,e,t,i,s)=>e.syncInfo?{time:e.syncInfo.time,segmentIndex:e.syncInfo.mediaSequence-e.mediaSequence,partIndex:null}:null}];class H2 extends z.EventTarget{constructor(e={}){super(),this.timelines=[],this.discontinuities=[],this.timelineToDatetimeMappings={};const t=new pp,i=new cd(t),s=new cd(t);this.mediaSequenceStorage_={main:t,audio:i,vtt:s},this.logger_=Zt("SyncController")}getMediaSequenceSync(e){return this.mediaSequenceStorage_[e]||null}getSyncPoint(e,t,i,s,n){if(t!==1/0)return uo.find(({name:u})=>u==="VOD").run(this,e,t);const a=this.runStrategies_(e,t,i,s,n);if(!a.length)return null;for(const o of a){const{syncPoint:u,strategy:d}=o,{segmentIndex:p,time:T}=u;if(p<0)continue;const A=e.segments[p],b=T,k=b+A.duration;if(this.logger_(`Strategy: ${d}. Current time: ${s}. selected segment: ${p}. Time: [${b} -> ${k}]}`),s>=b&&s<k)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 i=this.runStrategies_(e,t,e.discontinuitySequence,0);if(!i.length)return null;const s=this.selectSyncPoint_(i,{key:"segmentIndex",value:0});return s.segmentIndex>0&&(s.time*=-1),Math.abs(s.time+Es({defaultDuration:e.targetDuration,durationList:e.segments,startIndex:s.segmentIndex,endIndex:0}))}runStrategies_(e,t,i,s,n){const a=[];for(let o=0;o<uo.length;o++){const u=uo[o],d=u.run(this,e,t,i,s,n);d&&(d.strategy=u.name,a.push({strategy:u.name,syncPoint:d}))}return a}selectSyncPoint_(e,t){let i=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 o=Math.abs(e[a].syncPoint[t.key]-t.value);o<s&&(s=o,i=e[a].syncPoint,n=e[a].strategy)}return this.logger_(`syncPoint for [${t.key}: ${t.value}] chosen with strategy [${n}]: [time:${i.time}, segmentIndex:${i.segmentIndex}`+(typeof i.partIndex=="number"?`,partIndex:${i.partIndex}`:"")+"]"),i}saveExpiredSegmentInfo(e,t){const i=t.mediaSequence-e.mediaSequence;if(i>V2){z.log.warn(`Not saving expired segment info. Media sequence gap ${i} is too large.`);return}for(let s=i-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],i=t.dateTimeObject.getTime()/1e3;this.timelineToDatetimeMappings[t.timeline]=-i}}saveSegmentTimingInfo({segmentInfo:e,shouldSaveTimelineMapping:t}){const i=this.calculateSegmentTimeMapping_(e,e.timingInfo,t),s=e.segment;i&&(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,i){const s=e.segment,n=e.part;let a=this.timelines[e.timeline],o,u;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}]`)),o=e.startOfSegment,u=t.end+a.mapping;else if(a)o=t.start+a.mapping,u=t.end+a.mapping;else return!1;return n&&(n.start=o,n.end=u),(!s.start||o<s.start)&&(s.start=o),s.end=u,!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 s=0;s<t.discontinuityStarts.length;s++){const n=t.discontinuityStarts[s],a=t.discontinuitySequence+s+1,o=n-e.mediaIndex,u=Math.abs(o);if(!this.discontinuities[a]||this.discontinuities[a].accuracy>u){let d;o<0?d=i.start-Es({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex,endIndex:n}):d=i.end+Es({defaultDuration:t.targetDuration,durationList:t.segments,startIndex:e.mediaIndex+1,endIndex:n}),this.discontinuities[a]={time:d,accuracy:u}}}}dispose(){this.trigger("dispose"),this.off()}}class z2 extends z.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 s={timelineChangeInfo:{from:t,to:i}};this.trigger({type:"timelinechange",metadata:s})}return this.lastTimelineChanges_[e]}dispose(){this.trigger("dispose"),this.pendingTimelineChanges_={},this.lastTimelineChanges_={},this.off()}}const W2=Jf(Zf(function(){var r=(function(){function v(){this.listeners={}}var L=v.prototype;return L.on=function($,F){this.listeners[$]||(this.listeners[$]=[]),this.listeners[$].push(F)},L.off=function($,F){if(!this.listeners[$])return!1;var H=this.listeners[$].indexOf(F);return this.listeners[$]=this.listeners[$].slice(0),this.listeners[$].splice(H,1),H>-1},L.trigger=function($){var F=this.listeners[$];if(F)if(arguments.length===2)for(var H=F.length,B=0;B<H;++B)F[B].call(this,arguments[1]);else for(var V=Array.prototype.slice.call(arguments,1),G=F.length,ie=0;ie<G;++ie)F[ie].apply(this,V)},L.dispose=function(){this.listeners={}},L.pipe=function($){this.on("data",function(F){$.push(F)})},v})();function e(v){return v.subarray(0,v.byteLength-v[v.byteLength-1])}const t=function(){const v=[[[],[],[],[],[]],[[],[],[],[],[]]],L=v[0],U=v[1],$=L[4],F=U[4];let H,B,V;const G=[],ie=[];let C,I,W,Y,X,ne;for(H=0;H<256;H++)ie[(G[H]=H<<1^(H>>7)*283)^H]=H;for(B=V=0;!$[B];B^=C||1,V=ie[V]||1)for(Y=V^V<<1^V<<2^V<<3^V<<4,Y=Y>>8^Y&255^99,$[B]=Y,F[Y]=B,W=G[I=G[C=G[B]]],ne=W*16843009^I*65537^C*257^B*16843008,X=G[Y]*257^Y*16843008,H=0;H<4;H++)L[H][B]=X=X<<24^X>>>8,U[H][Y]=ne=ne<<24^ne>>>8;for(H=0;H<5;H++)L[H]=L[H].slice(0),U[H]=U[H].slice(0);return v};let i=null;class s{constructor(L){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 U,$,F;const H=this._tables[0][4],B=this._tables[1],V=L.length;let G=1;if(V!==4&&V!==6&&V!==8)throw new Error("Invalid aes key size");const ie=L.slice(0),C=[];for(this._key=[ie,C],U=V;U<4*V+28;U++)F=ie[U-1],(U%V===0||V===8&&U%V===4)&&(F=H[F>>>24]<<24^H[F>>16&255]<<16^H[F>>8&255]<<8^H[F&255],U%V===0&&(F=F<<8^F>>>24^G<<24,G=G<<1^(G>>7)*283)),ie[U]=ie[U-V]^F;for($=0;U;$++,U--)F=ie[$&3?U:U-4],U<=4||$<4?C[$]=F:C[$]=B[0][H[F>>>24]]^B[1][H[F>>16&255]]^B[2][H[F>>8&255]]^B[3][H[F&255]]}decrypt(L,U,$,F,H,B){const V=this._key[1];let G=L^V[0],ie=F^V[1],C=$^V[2],I=U^V[3],W,Y,X;const ne=V.length/4-2;let de,fe=4;const te=this._tables[1],le=te[0],oe=te[1],ce=te[2],ue=te[3],Ee=te[4];for(de=0;de<ne;de++)W=le[G>>>24]^oe[ie>>16&255]^ce[C>>8&255]^ue[I&255]^V[fe],Y=le[ie>>>24]^oe[C>>16&255]^ce[I>>8&255]^ue[G&255]^V[fe+1],X=le[C>>>24]^oe[I>>16&255]^ce[G>>8&255]^ue[ie&255]^V[fe+2],I=le[I>>>24]^oe[G>>16&255]^ce[ie>>8&255]^ue[C&255]^V[fe+3],fe+=4,G=W,ie=Y,C=X;for(de=0;de<4;de++)H[(3&-de)+B]=Ee[G>>>24]<<24^Ee[ie>>16&255]<<16^Ee[C>>8&255]<<8^Ee[I&255]^V[fe++],W=G,G=ie,ie=C,C=I,I=W}}class n extends r{constructor(){super(r),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},o=function(v,L,U){const $=new Int32Array(v.buffer,v.byteOffset,v.byteLength>>2),F=new s(Array.prototype.slice.call(L)),H=new Uint8Array(v.byteLength),B=new Int32Array(H.buffer);let V,G,ie,C,I,W,Y,X,ne;for(V=U[0],G=U[1],ie=U[2],C=U[3],ne=0;ne<$.length;ne+=4)I=a($[ne]),W=a($[ne+1]),Y=a($[ne+2]),X=a($[ne+3]),F.decrypt(I,W,Y,X,B,ne),B[ne]=a(B[ne]^V),B[ne+1]=a(B[ne+1]^G),B[ne+2]=a(B[ne+2]^ie),B[ne+3]=a(B[ne+3]^C),V=I,G=W,ie=Y,C=X;return H};class u{constructor(L,U,$,F){const H=u.STEP,B=new Int32Array(L.buffer),V=new Uint8Array(L.byteLength);let G=0;for(this.asyncStream_=new n,this.asyncStream_.push(this.decryptChunk_(B.subarray(G,G+H),U,$,V)),G=H;G<B.length;G+=H)$=new Uint32Array([a(B[G-4]),a(B[G-3]),a(B[G-2]),a(B[G-1])]),this.asyncStream_.push(this.decryptChunk_(B.subarray(G,G+H),U,$,V));this.asyncStream_.push(function(){F(null,e(V))})}static get STEP(){return 32e3}decryptChunk_(L,U,$,F){return function(){const H=o(L,U,$);F.set(H,L.byteOffset)}}}var d=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Ce.global<"u"?Ce.global:typeof self<"u"?self:{},p;typeof window<"u"?p=window:typeof d<"u"?p=d:typeof self<"u"?p=self:p={};var T=p,A=function(L){return ArrayBuffer.isView==="function"?ArrayBuffer.isView(L):L&&L.buffer instanceof ArrayBuffer},b=T.BigInt||Number;b("0x1"),b("0x100"),b("0x10000"),b("0x1000000"),b("0x100000000"),b("0x10000000000"),b("0x1000000000000"),b("0x100000000000000"),b("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 k=function(v){const L={};return Object.keys(v).forEach(U=>{const $=v[U];A($)?L[U]={bytes:$.buffer,byteOffset:$.byteOffset,byteLength:$.byteLength}:L[U]=$}),L};self.onmessage=function(v){const L=v.data,U=new Uint8Array(L.encrypted.bytes,L.encrypted.byteOffset,L.encrypted.byteLength),$=new Uint32Array(L.key.bytes,L.key.byteOffset,L.key.byteLength/4),F=new Uint32Array(L.iv.bytes,L.iv.byteOffset,L.iv.byteLength/4);new u(U,$,F,function(H,B){self.postMessage(k({source:L.source,decrypted:B}),[B.buffer])})}}));var G2=Qf(W2);const K2=r=>{let e=r.default?"main":"alternative";return r.characteristics&&r.characteristics.indexOf("public.accessibility.describes-video")>=0&&(e="main-desc"),e},mp=(r,e)=>{r.abort(),r.pause(),e&&e.activePlaylistLoader&&(e.activePlaylistLoader.pause(),e.activePlaylistLoader=null)},Fo=(r,e)=>{e.activePlaylistLoader=r,r.load()},X2=(r,e)=>()=>{const{segmentLoaders:{[r]:t,main:i},mediaTypes:{[r]:s}}=e,n=s.activeTrack(),a=s.getActiveGroup(),o=s.activePlaylistLoader,u=s.lastGroup_;if(!(a&&u&&a.id===u.id)&&(s.lastGroup_=a,s.lastTrack_=n,mp(t,s),!(!a||a.isMainPlaylist))){if(!a.playlistLoader){o&&i.resetEverything();return}t.resyncLoader(),Fo(a.playlistLoader,s)}},Y2=(r,e)=>()=>{const{segmentLoaders:{[r]:t},mediaTypes:{[r]:i}}=e;i.lastGroup_=null,t.abort(),t.pause()},Q2=(r,e)=>()=>{const{mainPlaylistLoader:t,segmentLoaders:{[r]:i,main:s},mediaTypes:{[r]:n}}=e,a=n.activeTrack(),o=n.getActiveGroup(),u=n.activePlaylistLoader,d=n.lastTrack_;if(!(d&&a&&d.id===a.id)&&(n.lastGroup_=o,n.lastTrack_=a,mp(i,n),!!o)){if(o.isMainPlaylist){if(!a||!d||a.id===d.id)return;const p=e.vhs.playlistController_,T=p.selectPlaylist();if(p.media()===T)return;n.logger_(`track change. Switching main audio from ${d.id} to ${a.id}`),t.pause(),s.resetEverything(),p.fastQualityChange_(T);return}if(r==="AUDIO"){if(!o.playlistLoader){s.setAudio(!0),s.resetEverything();return}i.setAudio(!0),s.setAudio(!1)}if(u===o.playlistLoader){Fo(o.playlistLoader,n);return}i.track&&i.track(a),i.resetEverything(),Fo(o.playlistLoader,n)}},jn={AUDIO:(r,e)=>()=>{const{mediaTypes:{[r]:t},excludePlaylist:i}=e,s=t.activeTrack(),n=t.activeGroup(),a=(n.filter(u=>u.default)[0]||n[0]).id,o=t.tracks[a];if(s===o){i({error:{message:"Problem encountered loading the default audio track."}});return}z.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]===o;t.onTrackChanged()},SUBTITLES:(r,e)=>()=>{const{mediaTypes:{[r]:t}}=e;z.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");const i=t.activeTrack();i&&(i.mode="disabled"),t.onTrackChanged()}},dd={AUDIO:(r,e,t)=>{if(!e)return;const{tech:i,requestOptions:s,segmentLoaders:{[r]:n}}=t;e.on("loadedmetadata",()=>{const a=e.media();n.playlist(a,s),(!i.paused()||a.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),i.paused()||n.load()}),e.on("error",jn[r](r,t))},SUBTITLES:(r,e,t)=>{const{tech:i,requestOptions:s,segmentLoaders:{[r]:n},mediaTypes:{[r]:a}}=t;e.on("loadedmetadata",()=>{const o=e.media();n.playlist(o,s),n.track(a.activeTrack()),(!i.paused()||o.endList&&i.preload()!=="none")&&n.load()}),e.on("loadedplaylist",()=>{n.playlist(e.media(),s),i.paused()||n.load()}),e.on("error",jn[r](r,t))}},J2={AUDIO:(r,e)=>{const{vhs:t,sourceType:i,segmentLoaders:{[r]:s},requestOptions:n,main:{mediaGroups:a},mediaTypes:{[r]:{groups:o,tracks:u,logger_:d}},mainPlaylistLoader:p}=e,T=Bs(p.main);(!a[r]||Object.keys(a[r]).length===0)&&(a[r]={main:{default:{default:!0}}},T&&(a[r].main.default.playlists=p.main.playlists));for(const A in a[r]){o[A]||(o[A]=[]);for(const b in a[r][A]){let k=a[r][A][b],v;if(T?(d(`AUDIO group '${A}' label '${b}' is a main playlist`),k.isMainPlaylist=!0,v=null):i==="vhs-json"&&k.playlists?v=new xr(k.playlists[0],t,n):k.resolvedUri?v=new xr(k.resolvedUri,t,n):k.playlists&&i==="dash"?v=new Lo(k.playlists[0],t,n,p):v=null,k=Oe({id:b,playlistLoader:v},k),dd[r](r,k.playlistLoader,e),o[A].push(k),typeof u[b]>"u"){const L=new z.AudioTrack({id:b,kind:K2(k),enabled:!1,language:k.language,default:k.default,label:b});u[b]=L}}}s.on("error",jn[r](r,e))},SUBTITLES:(r,e)=>{const{tech:t,vhs:i,sourceType:s,segmentLoaders:{[r]:n},requestOptions:a,main:{mediaGroups:o},mediaTypes:{[r]:{groups:u,tracks:d}},mainPlaylistLoader:p}=e;for(const T in o[r]){u[T]||(u[T]=[]);for(const A in o[r][T]){if(!i.options_.useForcedSubtitles&&o[r][T][A].forced)continue;let b=o[r][T][A],k;if(s==="hls")k=new xr(b.resolvedUri,i,a);else if(s==="dash"){if(!b.playlists.filter(L=>L.excludeUntil!==1/0).length)return;k=new Lo(b.playlists[0],i,a,p)}else s==="vhs-json"&&(k=new xr(b.playlists?b.playlists[0]:b.resolvedUri,i,a));if(b=Oe({id:A,playlistLoader:k},b),dd[r](r,b.playlistLoader,e),u[T].push(b),typeof d[A]>"u"){const v=t.addRemoteTextTrack({id:A,kind:"subtitles",default:b.default&&b.autoselect,language:b.language,label:A},!1).track;d[A]=v}}}n.on("error",jn[r](r,e))},"CLOSED-CAPTIONS":(r,e)=>{const{tech:t,main:{mediaGroups:i},mediaTypes:{[r]:{groups:s,tracks:n}}}=e;for(const a in i[r]){s[a]||(s[a]=[]);for(const o in i[r][a]){const u=i[r][a][o];if(!/^(?:CC|SERVICE)/.test(u.instreamId))continue;const d=t.options_.vhs&&t.options_.vhs.captionServices||{};let p={label:o,language:u.language,instreamId:u.instreamId,default:u.default&&u.autoselect};if(d[p.instreamId]&&(p=Oe(p,d[p.instreamId])),p.default===void 0&&delete p.default,s[a].push(Oe({id:o},u)),typeof n[o]>"u"){const T=t.addRemoteTextTrack({id:p.instreamId,kind:"captions",default:p.default,language:p.language,label:p.label},!1).track;n[o]=T}}}}},gp=(r,e)=>{for(let t=0;t<r.length;t++)if(El(e,r[t])||r[t].playlists&&gp(r[t].playlists,e))return!0;return!1},Z2=(r,e)=>t=>{const{mainPlaylistLoader:i,mediaTypes:{[r]:{groups:s}}}=e,n=i.media();if(!n)return null;let a=null;n.attributes[r]&&(a=s[n.attributes[r]]);const o=Object.keys(s);if(!a)if(r==="AUDIO"&&o.length>1&&Bs(e.main))for(let u=0;u<o.length;u++){const d=s[o[u]];if(gp(d,n)){a=d;break}}else s.main?a=s.main:o.length===1&&(a=s[o[0]]);return typeof t>"u"?a:t===null||!a?null:a.filter(u=>u.id===t.id)[0]||null},e1={AUDIO:(r,e)=>()=>{const{mediaTypes:{[r]:{tracks:t}}}=e;for(const i in t)if(t[i].enabled)return t[i];return null},SUBTITLES:(r,e)=>()=>{const{mediaTypes:{[r]:{tracks:t}}}=e;for(const i in t)if(t[i].mode==="showing"||t[i].mode==="hidden")return t[i];return null}},t1=(r,{mediaTypes:e})=>()=>{const t=e[r].activeTrack();return t?e[r].activeGroup(t):null},i1=r=>{["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(d=>{J2[d](d,r)});const{mediaTypes:e,mainPlaylistLoader:t,tech:i,vhs:s,segmentLoaders:{["AUDIO"]:n,main:a}}=r;["AUDIO","SUBTITLES"].forEach(d=>{e[d].activeGroup=Z2(d,r),e[d].activeTrack=e1[d](d,r),e[d].onGroupChanged=X2(d,r),e[d].onGroupChanging=Y2(d,r),e[d].onTrackChanged=Q2(d,r),e[d].getActiveGroup=t1(d,r)});const o=e.AUDIO.activeGroup();if(o){const d=(o.filter(T=>T.default)[0]||o[0]).id;e.AUDIO.tracks[d].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(d=>e[d].onGroupChanged())}),t.on("mediachanging",()=>{["AUDIO","SUBTITLES"].forEach(d=>e[d].onGroupChanging())});const u=()=>{e.AUDIO.onTrackChanged(),i.trigger({type:"usage",name:"vhs-audio-change"})};i.audioTracks().addEventListener("change",u),i.remoteTextTracks().addEventListener("change",e.SUBTITLES.onTrackChanged),s.on("dispose",()=>{i.audioTracks().removeEventListener("change",u),i.remoteTextTracks().removeEventListener("change",e.SUBTITLES.onTrackChanged)}),i.clearTracks("audio");for(const d in e.AUDIO.tracks)i.audioTracks().addTrack(e.AUDIO.tracks[d])},r1=()=>{const r={};return["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{r[e]={groups:{},tracks:{},activePlaylistLoader:null,activeGroup:Ni,activeTrack:Ni,getActiveGroup:Ni,onGroupChanged:Ni,onTrackChanged:Ni,lastTrack_:null,logger_:Zt(`MediaGroups[${e}]`)}}),r};class hd{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_=Ot(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 s1 extends z.EventTarget{constructor(e,t){super(),this.currentPathway=null,this.defaultPathway=null,this.queryBeforeStart=!1,this.availablePathways_=new Set,this.steeringManifest=new hd,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_=Zt("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=Ot(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 s={contentSteeringInfo:{uri:i}};this.trigger({type:"contentsteeringloadstart",metadata:s}),this.request_=this.xhr_({uri:i,requestType:"content-steering-manifest"},(n,a)=>{if(n){if(a.status===410){this.logger_(`manifest request 410 ${n}.`),this.logger_(`There will be no more content steering requests to ${i} this session.`),this.excludedSteeringManifestURLs.add(i);return}if(a.status===429){const d=a.responseHeaders["retry-after"];this.logger_(`manifest request 429 ${n}.`),this.logger_(`content steering will retry in ${d} seconds.`),this.startTTLTimeout_(parseInt(d,10));return}this.logger_(`manifest failed to load ${n}.`),this.startTTLTimeout_();return}this.trigger({type:"contentsteeringloadcomplete",metadata:s});let o;try{o=JSON.parse(this.request_.responseText)}catch(d){const p={errorType:z.Error.StreamingContentSteeringParserError,error:d};this.trigger({type:"error",metadata:p})}this.assignSteeringProperties_(o);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 N.URL(e),i=new N.URL(this.proxyServerUrl_);return i.searchParams.set("url",encodeURI(t.toString())),this.setSteeringParams_(i.toString())}decodeDataUriManifest_(e){const t=JSON.parse(N.atob(e));this.assignSteeringProperties_(t)}setSteeringParams_(e){const t=new N.URL(e),i=this.getPathway(),s=this.getBandwidth_();if(i){const n=`_${this.manifestType_}_pathway`;t.searchParams.set(n,i)}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 i=(s=>{for(const n of s)if(this.availablePathways_.has(n))return n;return[...this.availablePathways_][0]})(this.steeringManifest.priority);this.currentPathway!==i&&(this.currentPathway=i,this.trigger("content-steering"))}getPathway(){return this.currentPathway||this.defaultPathway}getRequestURI(e){if(!e)return null;const t=s=>this.excludedSteeringManifestURLs.has(s);if(this.proxyServerUrl_){const s=this.setProxyServerUrl_(e);if(!t(s))return s}const i=this.setSteeringParams_(e);return t(i)?null:i}startTTLTimeout_(e=this.steeringManifest.ttl){const t=e*1e3;this.ttlTimeout_=N.setTimeout(()=>{this.requestSteeringManifest()},t)}clearTTLTimeout_(){N.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 hd}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&&(Ot(e,t.serverURL)!==this.steeringManifest.reloadUri||t.defaultServiceLocation!==this.defaultPathway||t.queryBeforeStart!==this.queryBeforeStart||t.proxyServerURL!==this.proxyServerUrl_)}getAvailablePathways(){return this.availablePathways_}}const n1=(r,e)=>{let t=null;return(...i)=>{clearTimeout(t),t=setTimeout(()=>{r.apply(null,i)},e)}},a1=10;let Vi;const o1=["mediaRequests","mediaRequestsAborted","mediaRequestsTimedout","mediaRequestsErrored","mediaTransferDuration","mediaBytesTransferred","mediaAppends"],l1=function(r){return this.audioSegmentLoader_[r]+this.mainSegmentLoader_[r]},u1=function({currentPlaylist:r,buffered:e,currentTime:t,nextPlaylist:i,bufferLowWaterLine:s,bufferHighWaterLine:n,duration:a,bufferBasedABR:o,log:u}){if(!i)return z.log.warn("We received no playlist to switch to. Please check your stream."),!1;const d=`allowing switch ${r&&r.id||"null"} -> ${i.id}`;if(!r)return u(`${d} as current playlist is not set`),!0;if(i.id===r.id)return!1;const p=!!br(e,t).length;if(!r.endList)return!p&&typeof r.partTargetDuration=="number"?(u(`not ${d} as current playlist is live llhls, but currentTime isn't in buffered.`),!1):(u(`${d} as current playlist is live`),!0);const T=bl(e,t),A=o?gt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE:gt.MAX_BUFFER_LOW_WATER_LINE;if(a<A)return u(`${d} as duration < max low water line (${a} < ${A})`),!0;const b=i.attributes.BANDWIDTH,k=r.attributes.BANDWIDTH;if(b<k&&(!o||T<n)){let v=`${d} as next bandwidth < current bandwidth (${b} < ${k})`;return o&&(v+=` and forwardBuffer < bufferHighWaterLine (${T} < ${n})`),u(v),!0}if((!o||b>k)&&T>=s){let v=`${d} as forwardBuffer >= bufferLowWaterLine (${T} >= ${s})`;return o&&(v+=` and next bandwidth > current bandwidth (${b} > ${k})`),u(v),!0}return u(`not ${d} as no switching criteria met`),!1};class c1 extends z.EventTarget{constructor(e){super(),this.fastQualityChange_=n1(this.fastQualityChange_.bind(this),100);const{src:t,withCredentials:i,tech:s,bandwidth:n,externVhs:a,useCueTags:o,playlistExclusionDuration:u,enableLowInitialPlaylist:d,sourceType:p,cacheEncryptionKeys:T,bufferBasedABR:A,leastPixelDiffSelector:b,captionServices:k,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),Vi=a,this.bufferBasedABR=!!A,this.leastPixelDiffSelector=!!b,this.withCredentials=i,this.tech_=s,this.vhs_=s.vhs,this.player_=e.player_,this.sourceType_=p,this.useCueTags_=o,this.playlistExclusionDuration=u,this.maxPlaylistRetries=L,this.enableLowInitialPlaylist=d,this.usingManagedMediaSource_=!1,this.useCueTags_&&(this.cueTagsTrack_=this.tech_.addTextTrack("metadata","ad-cues"),this.cueTagsTrack_.inBandMetadataTrackDispatchType=""),this.requestOptions_={withCredentials:i,maxPlaylistRetries:L,timeout:null},this.on("error",this.pauseLoading),this.mediaTypes_=r1(),v&&N.ManagedMediaSource?(this.tech_.el_.disableRemotePlayback=!0,this.mediaSource=new N.ManagedMediaSource,this.usingManagedMediaSource_=!0,z.log("Using ManagedMediaSource")):N.MediaSource&&(this.mediaSource=new N.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_=_t(),this.hasPlayed_=!1,this.syncController_=new H2(e),this.segmentMetadataTrack_=s.addRemoteTextTrack({kind:"metadata",label:"segment-metadata"},!1).track,this.decrypter_=new G2,this.sourceUpdater_=new fp(this.mediaSource),this.inbandTextTracks_={},this.timelineChangeController_=new z2,this.keyStatusMap_=new Map;const U={vhs:this.vhs_,parse708captions:e.parse708captions,useDtsForTimestampOffset:e.useDtsForTimestampOffset,captionServices:k,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 Lo(t,this.vhs_,Oe(this.requestOptions_,{addMetadataToTextTrack:this.addMetadataToTextTrack.bind(this)})):new xr(t,this.vhs_,Oe(this.requestOptions_,{addDateRangesToTextTrack:this.addDateRangesToTextTrack_.bind(this)})),this.setupMainPlaylistLoaderListeners_(),this.mainSegmentLoader_=new Bo(Oe(U,{segmentMetadataTrack:this.segmentMetadataTrack_,loaderType:"main"}),e),this.audioSegmentLoader_=new Bo(Oe(U,{loaderType:"audio"}),e),this.subtitleSegmentLoader_=new U2(Oe(U,{loaderType:"vtt",featuresNativeTextTracks:this.tech_.featuresNativeTextTracks,loadVttJs:()=>new Promise((H,B)=>{function V(){s.off("vttjserror",G),H()}function G(){s.off("vttjsloaded",V),B()}s.one("vttjsloaded",V),s.one("vttjserror",G),s.addWebVttScript_()})}),e);const $=()=>this.mainSegmentLoader_.bandwidth;this.contentSteeringController_=new s1(this.vhs_.xhr,$),this.setupSegmentLoaderListeners_(),this.bufferBasedABR&&(this.mainPlaylistLoader_.one("loadedplaylist",()=>this.startABRTimer_()),this.tech_.on("pause",()=>this.stopABRTimer_()),this.tech_.on("play",()=>this.startABRTimer_())),o1.forEach(H=>{this[H+"_"]=l1.bind(this,H)}),this.logger_=Zt("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 F=this.tech_.preload()==="none"?"play":"loadstart";this.tech_.one(F,()=>{const H=Date.now();this.tech_.one("loadeddata",()=>{this.timeToLoadedData__=Date.now()-H,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 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 o={renditionInfo:{id:a,bandwidth:e.attributes.BANDWIDTH,resolution:e.attributes.RESOLUTION,codecs:e.attributes.CODECS},cause:t};this.trigger({type:"renditionselected",metadata:o}),this.tech_.trigger({type:"usage",name:`vhs-rendition-change-${t}`})}this.mainPlaylistLoader_.media(e,i)}switchMediaForDASHContentSteering_(){["AUDIO","SUBTITLES","CLOSED-CAPTIONS"].forEach(e=>{const t=this.mediaTypes_[e],i=t?t.activeGroup():null,s=this.contentSteeringController_.getPathway();if(i&&s){const a=(i.length?i[0].playlists:i.playlists).filter(o=>o.attributes.serviceLocation===s);a.length&&this.mediaTypes_[e].activePlaylistLoader.media(a[0])}})}startABRTimer_(){this.stopABRTimer_(),this.abrTimer_=N.setInterval(()=>this.checkABR_(),250)}stopABRTimer_(){this.tech_.scrubbing&&this.tech_.scrubbing()||(N.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,s=Object.keys(i);let n;if(Object.keys(this.mediaTypes_.AUDIO.groups).length)n=this.mediaTypes_.AUDIO.activeTrack();else{const o=i.main||s.length&&i[s[0]];for(const u in o)if(o[u].default){n={label:u};break}}if(!n)return t;const a=[];for(const o in i)if(i[o][n.label]){const u=i[o][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 d=0;d<e.playlists.length;d++){const p=e.playlists[d];p.attributes&&p.attributes.AUDIO&&p.attributes.AUDIO===o&&a.push(p)}}return a.length?a:t}setupMainPlaylistLoaderListeners_(){this.mainPlaylistLoader_.on("loadedmetadata",()=>{const t=this.mainPlaylistLoader_.media(),i=t.targetDuration*1.5*1e3;Do(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()),i1({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;Do(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(ot({},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 s=!0;const n=Object.keys(i.AUDIO);for(const a in i.AUDIO)for(const o in i.AUDIO[a])i.AUDIO[a][o].uri||(s=!1);s&&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"}),n.length&&Object.keys(i.AUDIO[n[0]]).length>1&&this.tech_.trigger({type:"usage",name:"vhs-alternate-audio"}),this.useCueTags_&&this.tech_.trigger({type:"usage",name:"vhs-playlist-cue-tags"})}shouldSwitchToMedia_(e){const t=this.mainPlaylistLoader_.media()||this.mainPlaylistLoader_.pendingMedia_,i=this.tech_.currentTime(),s=this.bufferLowWaterLine(),n=this.bufferHighWaterLine(),a=this.tech_.buffered();return u1({buffered:a,currentTime:i,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 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 s=i.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",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:a1}))});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,s=>{this.player_.trigger(ot({},s))}),this.audioSegmentLoader_.on(i,s=>{this.player_.trigger(ot({},s))}),this.subtitleSegmentLoader_.on(i,s=>{this.player_.trigger(ot({},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 i=t.end(0);let s=i;if(e.start){const n=e.start.timeOffset;n<0?s=Math.max(i+n,t.start(0)):s=Math.min(i,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 i=this.syncController_.getExpiredTime(e,this.duration());if(i===null)return!1;const s=Vi.Playlist.playlistEnd(e,i),n=this.tech_.currentTime(),a=this.tech_.buffered();if(!a.length)return s-n<=Ei;const o=a.end(a.length-1);return o-n<=Ei&&s-o<=Ei}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 s=this.mainPlaylistLoader_.main.playlists,n=s.filter(fa),a=n.length===1&&n[0]===e;if(s.length===1&&i!==1/0)return z.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 k=this.pathwayAttribute_(e),v=this.contentSteeringController_.steeringManifest.ttl*1e3;this.contentSteeringController_.excludePathway(k),this.excludeThenChangePathway_(),setTimeout(()=>{this.contentSteeringController_.addAvailablePathway(k)},v);return}let b=!1;s.forEach(k=>{if(k===e)return;const v=k.excludeUntil;typeof v<"u"&&v!==1/0&&(b=!0,delete k.excludeUntil)}),b&&(z.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded."),this.tech_.trigger("retryplaylist"))}let o;e.playlistErrors_>this.maxPlaylistRetries?o=1/0:o=Date.now()+i*1e3,e.excludeUntil=o,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 d=t.internal?this.logger_:z.log.warn,p=t.message?" "+t.message:"";d(`${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,A=typeof u.lastRequest=="number"&&Date.now()-u.lastRequest<=T;return this.switchMedia_(u,"exclude",a||A)}pauseLoading(){this.delegateLoaders_("all",["abort","pause"]),this.stopABRTimer_()}delegateLoaders_(e,t){const i=[],s=e==="all";(s||e==="main")&&i.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 o=this.mediaTypes_[a]&&this.mediaTypes_[a].activePlaylistLoader;o&&i.push(o)}),["main","audio","subtitle"].forEach(a=>{const o=this[`${a}SegmentLoader_`];o&&(e===a||e==="all")&&i.push(o)}),i.forEach(a=>t.forEach(o=>{typeof a[o]=="function"&&a[o]()}))}setCurrentTime(e){const t=br(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 s=this.syncController_.getMediaSequenceSync(t);if(s&&s.isReliable){const o=s.start,u=s.end;if(!isFinite(o)||!isFinite(u))return null;const d=Vi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i),p=Math.max(0,u-d);return p<o?null:_t([[o,p]])}const n=this.syncController_.getExpiredTime(i,this.duration());if(n===null)return null;const a=Vi.Playlist.seekable(i,n,Vi.Playlist.liveEdgeDelay(this.mainPlaylistLoader_.main,i));return a.length?a:null}computeFinalSeekable_(e,t){if(!t)return e;const i=e.start(0),s=e.end(0),n=t.start(0),a=t.end(0);return n>s||i>a?e:_t([[Math.max(i,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 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 [${wf(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 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(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_(),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=Cs(this.main(),t),s={},n=!!this.mediaTypes_.AUDIO.activePlaylistLoader;if(e.main.hasVideo&&(s.video=i.video||e.main.videoCodec||Ky),e.main.isMuxed&&(s.video+=`,${i.audio||e.main.audioCodec||Zu}`),(e.main.hasAudio&&!e.main.isMuxed||e.audio.hasAudio||n)&&(s.audio=i.audio||e.main.audioCodec||e.audio.audioCodec||Zu,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=(d,p)=>d?vs(p,this.usingManagedMediaSource_):Va(p),o={};let u;if(["video","audio"].forEach(function(d){if(s.hasOwnProperty(d)&&!a(e[d].isFmp4,s[d])){const p=e[d].isFmp4?"browser":"muxer";o[p]=o[p]||[],o[p].push(s[d]),d==="audio"&&(u=p)}}),n&&u&&t.attributes.AUDIO){const d=t.attributes.AUDIO;this.main().playlists.forEach(p=>{(p.attributes&&p.attributes.AUDIO)===d&&p!==t&&(p.excludeUntil=1/0)}),this.logger_(`excluding audio group ${d} as ${u} does not support codec(s): "${s.audio}"`)}if(Object.keys(o).length){const d=Object.keys(o).reduce((p,T)=>(p&&(p+=", "),p+=`${T} does not support codec(s): "${o[T].join(",")}"`,p),"")+".";this.excludePlaylist({playlistToExclude:t,error:{internal:!0,message:d},playlistExclusionDuration:1/0});return}if(this.sourceUpdater_.hasCreatedSourceBuffers()&&!this.sourceUpdater_.canChangeType()){const d=[];if(["video","audio"].forEach(p=>{const T=(Ti(this.sourceUpdater_.codecs[p]||"")[0]||{}).type,A=(Ti(s[p]||"")[0]||{}).type;T&&A&&T.toLowerCase()!==A.toLowerCase()&&d.push(`"${this.sourceUpdater_.codecs[p]}" -> "${s[p]}"`)}),d.length){this.excludePlaylist({playlistToExclude:t,error:{message:`Codec switching not supported: ${d.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(i=>{const s=e[i];if(t.indexOf(s.id)!==-1)return;t.push(s.id);const n=Cs(this.main,s),a=[];n.audio&&!Va(n.audio)&&!vs(n.audio,this.usingManagedMediaSource_)&&a.push(`audio codec ${n.audio}`),n.video&&!Va(n.video)&&!vs(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=[],i=this.main().playlists,s=Un(Ti(e)),n=Zc(s),a=s.video&&Ti(s.video)[0]||null,o=s.audio&&Ti(s.audio)[0]||null;Object.keys(i).forEach(u=>{const d=i[u];if(t.indexOf(d.id)!==-1||d.excludeUntil===1/0)return;t.push(d.id);const p=[],T=Cs(this.mainPlaylistLoader_.main,d),A=Zc(T);if(!(!T.audio&&!T.video)){if(A!==n&&p.push(`codec count "${A}" !== "${n}"`),!this.sourceUpdater_.canChangeType()){const b=T.video&&Ti(T.video)[0]||null,k=T.audio&&Ti(T.audio)[0]||null;b&&a&&b.type.toLowerCase()!==a.type.toLowerCase()&&p.push(`video codec "${b.type}" !== "${a.type}"`),k&&o&&k.type.toLowerCase()!==o.type.toLowerCase()&&p.push(`audio codec "${k.type}" !== "${o.type}"`)}p.length&&(d.excludeUntil=1/0,this.logger_(`excluding ${d.id}: ${p.join(" && ")}`))}})}updateAdCues_(e){let t=0;const i=this.seekable();i.length&&(t=i.start(0)),j2(e,this.cueTagsTrack_,t)}goalBufferLength(){const e=this.tech_.currentTime(),t=gt.GOAL_BUFFER_LENGTH,i=gt.GOAL_BUFFER_LENGTH_RATE,s=Math.max(t,gt.MAX_GOAL_BUFFER_LENGTH);return Math.min(t+e*i,s)}bufferLowWaterLine(){const e=this.tech_.currentTime(),t=gt.BUFFER_LOW_WATER_LINE,i=gt.BUFFER_LOW_WATER_LINE_RATE,s=Math.max(t,gt.MAX_BUFFER_LOW_WATER_LINE),n=Math.max(t,gt.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);return Math.min(t+e*i,this.bufferBasedABR?n:s)}bufferHighWaterLine(){return gt.BUFFER_HIGH_WATER_LINE}addDateRangesToTextTrack_(e){id(this.inbandTextTracks_,"com.apple.streaming",this.tech_),v2({inbandTextTracks:this.inbandTextTracks_,dateRanges:e})}addMetadataToTextTrack(e,t,i){const s=this.sourceUpdater_.videoBuffer?this.sourceUpdater_.videoTimestampOffset():this.sourceUpdater_.audioTimestampOffset();id(this.inbandTextTracks_,e,this.tech_),y2({inbandTextTracks:this.inbandTextTracks_,metadataArray:t,timestampOffset:s,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(ot({},i))})}),this.sourceType_==="dash"&&this.mainPlaylistLoader_.on("loadedplaylist",()=>{const t=this.main();(this.contentSteeringController_.didDASHTagChange(t.uri,t.contentSteering)||(()=>{const n=this.contentSteeringController_.getAvailablePathways(),a=[];for(const o of t.playlists){const u=o.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 i=this.main().playlists,s=new Set;let n=!1;Object.keys(i).forEach(a=>{const o=i[a],u=this.pathwayAttribute_(o),d=u&&e!==u;o.excludeUntil===1/0&&o.lastExcludeReason_==="content-steering"&&!d&&(delete o.excludeUntil,delete o.lastExcludeReason_,n=!0);const T=!o.excludeUntil&&o.excludeUntil!==1/0;!s.has(o.id)&&d&&T&&(s.add(o.id),o.excludeUntil=1/0,o.lastExcludeReason_="content-steering",this.logger_(`excluding ${o.id} for ${o.lastExcludeReason_}`))}),this.contentSteeringController_.manifestType_==="DASH"&&Object.keys(this.mediaTypes_).forEach(a=>{const o=this.mediaTypes_[a];if(o.activePlaylistLoader){const u=o.activePlaylistLoader.media_;u&&u.attributes.serviceLocation!==e&&(n=!0)}}),n&&this.changeSegmentPathway_()}handlePathwayClones_(){const t=this.main().playlists,i=this.contentSteeringController_.currentPathwayClones,s=this.contentSteeringController_.nextPathwayClones;if(i&&i.size||s&&s.size){for(const[a,o]of i.entries())s.get(a)||(this.mainPlaylistLoader_.updateOrDeleteClone(o),this.contentSteeringController_.excludePathway(a));for(const[a,o]of s.entries()){const u=i.get(a);if(!u){t.filter(p=>p.attributes["PATHWAY-ID"]===o["BASE-ID"]).forEach(p=>{this.mainPlaylistLoader_.addClonePathway(o,p)}),this.contentSteeringController_.addAvailablePathway(a);continue}this.equalPathwayClones_(u,o)||(this.mainPlaylistLoader_.updateOrDeleteClone(o,!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 i=e["URI-REPLACEMENT"].PARAMS,s=t["URI-REPLACEMENT"].PARAMS;for(const n in i)if(i[n]!==s[n])return!1;for(const n in s)if(i[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(i=>{const s=this.mainPlaylistLoader_.getKeyIdSet(i);!s||!s.size||s.forEach(n=>{const a="usable",o=this.keyStatusMap_.has(n)&&this.keyStatusMap_.get(n)===a,u=i.lastExcludeReason_===t&&i.excludeUntil===1/0;o?o&&u&&(delete i.excludeUntil,delete i.lastExcludeReason_,this.logger_(`enabling playlist ${i.id} because key ID ${n} is ${a}`)):(i.excludeUntil!==1/0&&i.lastExcludeReason_!==t&&(i.excludeUntil=1/0,i.lastExcludeReason_=t,this.logger_(`excluding playlist ${i.id} because the key ID ${n} doesn't exist in the keyStatusMap or is not ${a}`)),e++)})}),e>=this.mainPlaylistLoader_.main.playlists.length&&this.mainPlaylistLoader_.main.playlists.forEach(i=>{const s=i&&i.attributes&&i.attributes.RESOLUTION&&i.attributes.RESOLUTION.height<720,n=i.excludeUntil===1/0&&i.lastExcludeReason_===t;s&&n&&(delete i.excludeUntil,z.log.warn(`enabling non-HD playlist ${i.id} because all playlists were excluded due to ${t} key IDs`))})}addKeyStatus_(e,t){const n=(typeof e=="string"?e:M2(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 d1=(r,e,t)=>i=>{const s=r.main.playlists[e],n=Sl(s),a=fa(s);if(typeof i>"u")return a;i?delete s.disabled:s.disabled=!0;const o={renditionInfo:{id:e,bandwidth:s.attributes.BANDWIDTH,resolution:s.attributes.RESOLUTION,codecs:s.attributes.CODECS},cause:"fast-quality"};return i!==a&&!n&&(i?(t(s),r.trigger({type:"renditionenabled",metadata:o})):r.trigger({type:"renditiondisabled",metadata:o})),i};class h1{constructor(e,t,i){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=Cs(s.main(),t),this.playlist=t,this.id=i,this.enabled=d1(e.playlists,t.id,n)}}const f1=function(r){r.representations=()=>{const e=r.playlistController_.main(),t=Bs(e)?r.playlistController_.getAudioTrackPlaylists_():e.playlists;return t?t.filter(i=>!Sl(i)).map((i,s)=>new h1(r,i,i.id)):[]}},fd=["seeking","seeked","pause","playing","error"];class p1 extends z.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_=Zt("PlaybackWatcher"),this.logger_("initialize");const t=()=>this.monitorCurrentTime_(),i=()=>this.monitorCurrentTime_(),s=()=>this.techWaiting_(),n=()=>this.resetTimeUpdate_(),a=this.playlistController_,o=["main","subtitle","audio"],u={};o.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 d=p=>{["main","audio"].forEach(T=>{a[`${T}SegmentLoader_`][p]("appended",this.seekingAppendCheck_)})};this.seekingAppendCheck_=()=>{this.fixesBadSeeks_()&&(this.consecutiveUpdates=0,this.lastRecordedTime=this.tech_.currentTime(),d("off"))},this.clearSeekingAppendCheck_=()=>d("off"),this.watchForBadSeeking_=()=>{this.clearSeekingAppendCheck_(),d("on")},this.tech_.on("seeked",this.clearSeekingAppendCheck_),this.tech_.on("seeking",this.watchForBadSeeking_),this.tech_.on("waiting",s),this.tech_.on(fd,n),this.tech_.on("canplay",i),this.tech_.one("play",t),this.dispose=()=>{this.clearSeekingAppendCheck_(),this.logger_("dispose"),this.tech_.off("waiting",s),this.tech_.off(fd,n),this.tech_.off("canplay",i),this.tech_.off("play",t),this.tech_.off("seeking",this.watchForBadSeeking_),this.tech_.off("seeked",this.clearSeekingAppendCheck_),o.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_&&N.clearTimeout(this.checkCurrentTimeTimeout_),this.resetTimeUpdate_()}}monitorCurrentTime_(){this.checkCurrentTime_(),this.checkCurrentTimeTimeout_&&N.clearTimeout(this.checkCurrentTimeTimeout_),this.checkCurrentTimeTimeout_=N.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_`],s=i.buffered_(),n=Jv(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:i.playlist_&&i.playlist_.id,buffered:nr(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+Ei>=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(_t([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(),s=this.afterSeekableWindow_(t,i,this.media(),this.allowSeeksWithinUnsafeLiveWindow);let n;if(s&&(n=t.end(t.length-1)),this.beforeSeekableWindow_(t,i)){const k=t.start(0);n=k+(k===t.end(0)?0:Ei)}if(typeof n<"u")return this.logger_(`Trying to seek outside of seekable at time ${i} with seekable range ${wf(t)}. Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0;const a=this.playlistController_.sourceUpdater_,o=this.tech_.buffered(),u=a.audioBuffer?a.audioBuffered():null,d=a.videoBuffer?a.videoBuffered():null,p=this.media(),T=p.partTargetDuration?p.partTargetDuration:(p.targetDuration-Si)*2,A=[u,d];for(let k=0;k<A.length;k++){if(!A[k])continue;if(bl(A[k],i)<T)return!1}const b=fn(o,i);return b.length===0?!1:(n=b.start(0)+Ei,this.logger_(`Buffered region starts (${b.start(0)}) just beyond seek point (${i}). Seeking to ${n}.`),this.tech_.setCurrentTime(n),!0)}waiting_(){if(this.techWaiting_())return;const e=this.tech_.currentTime(),t=this.tech_.buffered(),i=br(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 o=e.end(e.length-1);return this.logger_(`Fell out of live window at time ${t}. Seeking to live point (seekable end) ${o}`),this.resetTimeUpdate_(),this.tech_.setCurrentTime(o),this.tech_.trigger({type:"usage",name:"vhs-live-resync"}),!0}const i=this.tech_.vhs.playlistController_.sourceUpdater_,s=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=fn(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,i,s=!1){if(!e.length)return!1;let n=e.end(e.length-1)+Ei;const a=!i.endList,o=typeof i.partTargetDuration=="number";return a&&(o||s)&&(n=e.end(e.length-1)+i.targetDuration*3),t>n}beforeSeekableWindow_(e,t){return!!(e.length&&e.start(0)>0&&t<e.start(0)-this.liveRangeSafeTimeDelta)}videoUnderflow_({videoBuffered:e,audioBuffered:t,currentTime:i}){if(!e)return;let s;if(e.length&&t.length){const n=br(e,i-3),a=br(e,i),o=br(t,i);o.length&&!a.length&&n.length&&(s={start:n.end(0),end:o.end(0)})}else fn(e,i).length||(s=this.gapFromVideoUnderflow_(e,i));return s?(this.logger_(`Encountered a gap in video from ${s.start} to ${s.end}. Seeking to current time ${i}`),!0):!1}skipTheGap_(e){const t=this.tech_.buffered(),i=this.tech_.currentTime(),s=fn(t,i);if(this.resetTimeUpdate_(),s.length===0||i!==e)return;this.logger_("skipTheGap_:","currentTime:",i,"scheduled currentTime:",e,"nextRange start:",s.start(0)),this.tech_.setCurrentTime(s.start(0)+Si);const n={gapInfo:{from:i,to:s.start(0)}};this.playlistController_.trigger({type:"gapjumped",metadata:n}),this.tech_.trigger({type:"usage",name:"vhs-gap-skip"})}gapFromVideoUnderflow_(e,t){const i=Xv(e);for(let s=0;s<i.length;s++){const n=i.start(s),a=i.end(s);if(t-n<4&&t-n>2)return{start:n,end:a}}return null}}const m1={errorInterval:30,getSource(r){const t=this.tech({IWillNotUseThisInPlugins:!0}).currentSource_||this.currentSource();return r(t)}},yp=function(r,e){let t=0,i=0;const s=Oe(m1,e);r.ready(()=>{r.trigger({type:"usage",name:"vhs-error-reload-initialized"})});const n=function(){i&&r.currentTime(i)},a=function(p){p!=null&&(i=r.duration()!==1/0&&r.currentTime()||0,r.one("loadedmetadata",n),r.src(p),r.trigger({type:"usage",name:"vhs-error-reload"}),r.play())},o=function(){if(Date.now()-t<s.errorInterval*1e3){r.trigger({type:"usage",name:"vhs-error-reload-canceled"});return}if(!s.getSource||typeof s.getSource!="function"){z.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");return}return t=Date.now(),s.getSource.call(r,a)},u=function(){r.off("loadedmetadata",n),r.off("error",o),r.off("dispose",u)},d=function(p){u(),yp(r,p)};r.on("error",o),r.on("dispose",u),r.reloadSourceOnError=d},g1=function(r){yp(this,r)};var _p="3.16.2",y1="7.1.0",_1="1.3.1",T1="7.2.0",v1="4.0.2";const it={PlaylistLoader:xr,Playlist:Bt,utils:xb,STANDARD_PLAYLIST_SELECTOR:td,INITIAL_PLAYLIST_SELECTOR:h2,lastBandwidthSelector:td,movingAverageBandwidthSelector:c2,comparePlaylistBandwidth:Al,comparePlaylistResolution:u2,xhr:Hf()};Object.keys(gt).forEach(r=>{Object.defineProperty(it,r,{get(){return z.log.warn(`using Vhs.${r} is UNSAFE be sure you know what you are doing`),gt[r]},set(e){if(z.log.warn(`using Vhs.${r} is UNSAFE be sure you know what you are doing`),typeof e!="number"||e<0){z.log.warn(`value of Vhs.${r} must be greater than or equal to 0`);return}gt[r]=e}})});const Tp="videojs-vhs",vp=function(r,e){const t=e.media();let i=-1;for(let s=0;s<r.length;s++)if(r[s].id===t.id){i=s;break}r.selectedIndex_=i,r.trigger({selectedIndex:i,type:"change"})},b1=function(r,e){e.representations().forEach(t=>{r.addQualityLevel(t)}),vp(r,e.playlists)};it.canPlaySource=function(){return z.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};const x1=(r,e,t)=>{if(!r)return r;let i={};e&&e.attributes&&e.attributes.CODECS&&(i=Un(Ti(e.attributes.CODECS))),t&&t.attributes&&t.attributes.CODECS&&(i.audio=t.attributes.CODECS);const s=Pr(i.video),n=Pr(i.audio),a={};for(const o in r)a[o]={},n&&(a[o].audioContentType=n),s&&(a[o].videoContentType=s),e.contentProtection&&e.contentProtection[o]&&e.contentProtection[o].pssh&&(a[o].pssh=e.contentProtection[o].pssh),typeof r[o]=="string"&&(a[o].url=r[o]);return Oe(r,a)},S1=(r,e)=>r.reduce((t,i)=>{if(!i.contentProtection)return t;const s=e.reduce((n,a)=>{const o=i.contentProtection[a];return o&&o.pssh&&(n[a]={pssh:o.pssh}),n},{});return Object.keys(s).length&&t.push(s),t},[]),E1=({player:r,sourceKeySystems:e,audioMedia:t,mainPlaylists:i})=>{if(!r.eme.initializeMediaKeys)return Promise.resolve();const s=t?i.concat([t]):i,n=S1(s,Object.keys(e)),a=[],o=[];return n.forEach(u=>{o.push(new Promise((d,p)=>{r.tech_.one("keysessioncreated",d)})),a.push(new Promise((d,p)=>{r.eme.initializeMediaKeys({keySystems:u},T=>{if(T){p(T);return}d()})}))}),Promise.race([Promise.all(a),Promise.race(o)])},C1=({player:r,sourceKeySystems:e,media:t,audioMedia:i})=>{const s=x1(e,t,i);return s?(r.currentSource().keySystems=s,s&&!r.eme?(z.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin"),!1):!0):!1},bp=()=>{if(!N.localStorage)return null;const r=N.localStorage.getItem(Tp);if(!r)return null;try{return JSON.parse(r)}catch{return null}},A1=r=>{if(!N.localStorage)return!1;let e=bp();e=e?Oe(e,r):r;try{N.localStorage.setItem(Tp,JSON.stringify(e))}catch{return!1}return e},w1=r=>r.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,")===0?JSON.parse(r.substring(r.indexOf(",")+1)):r,xp=(r,e)=>{r._requestCallbackSet||(r._requestCallbackSet=new Set),r._requestCallbackSet.add(e)},Sp=(r,e)=>{r._responseCallbackSet||(r._responseCallbackSet=new Set),r._responseCallbackSet.add(e)},Ep=(r,e)=>{r._requestCallbackSet&&(r._requestCallbackSet.delete(e),r._requestCallbackSet.size||delete r._requestCallbackSet)},Cp=(r,e)=>{r._responseCallbackSet&&(r._responseCallbackSet.delete(e),r._responseCallbackSet.size||delete r._responseCallbackSet)};it.supportsNativeHls=(function(){if(!he||!he.createElement)return!1;const r=he.createElement("video");return z.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(r.canPlayType(t))}):!1})();it.supportsNativeDash=(function(){return!he||!he.createElement||!z.getTech("Html5").isSupported()?!1:/maybe|probably/i.test(he.createElement("video").canPlayType("application/dash+xml"))})();it.supportsTypeNatively=r=>r==="hls"?it.supportsNativeHls:r==="dash"?it.supportsNativeDash:!1;it.isSupported=function(){return z.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.")};it.xhr.onRequest=function(r){xp(it.xhr,r)};it.xhr.onResponse=function(r){Sp(it.xhr,r)};it.xhr.offRequest=function(r){Ep(it.xhr,r)};it.xhr.offResponse=function(r){Cp(it.xhr,r)};const D1=z.getComponent("Component");class Ap extends D1{constructor(e,t,i){if(super(t,i.vhs),typeof i.initialBandwidth=="number"&&(this.options_.bandwidth=i.initialBandwidth),this.logger_=Zt("VhsHandler"),t.options_&&t.options_.playerId){const s=z.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(he,["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"],s=>{const n=he.fullscreenElement||he.webkitFullscreenElement||he.mozFullScreenElement||he.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_=Oe(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=bp();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=gt.INITIAL_BANDWIDTH),this.options_.enableLowInitialPlaylist=this.options_.enableLowInitialPlaylist&&this.options_.bandwidth===gt.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=w1(this.source_.src),this.options_.tech=this.tech_,this.options_.externVhs=it,this.options_.sourceType=Kd(t),this.options_.seekTo=n=>{this.tech_.setCurrentTime(n)},this.options_.player_=this.player_,this.playlistController_=new c1(this.options_);const i=Oe({liveRangeSafeTimeDelta:Ei},this.options_,{seekable:()=>this.seekable(),media:()=>this.playlistController_.media(),playlistController:this.playlistController_});this.playbackWatcher_=new p1(i),this.attachStreamingEventListeners_(),this.playlistController_.on("error",()=>{const n=z.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?it.movingAverageBandwidthSelector(.55):it.STANDARD_PLAYLIST_SELECTOR;this.playlistController_.selectPlaylist=this.selectPlaylist?this.selectPlaylist.bind(this):s.bind(this),this.playlistController_.selectInitialPlaylist=it.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=N.navigator.connection||N.navigator.mozConnection||N.navigator.webkitConnection,o=1e7;if(this.options_.useNetworkInformationApi&&a){const u=a.downlink*1e3*1e3;u>=o&&n>=o?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(){z.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:()=>nr(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:()=>nr(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&&A1({bandwidth:this.bandwidth,throughput:Math.round(this.throughput)})}),this.playlistController_.on("selectedinitialmedia",()=>{f1(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_=N.URL.createObjectURL(this.playlistController_.mediaSource),(z.browser.IS_ANY_SAFARI||z.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"),E1({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=C1({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=z.players[this.tech_.options_.playerId];!e||!e.qualityLevels||this.qualityLevels_||(this.qualityLevels_=e.qualityLevels(),this.playlistController_.on("selectedinitialmedia",()=>{b1(this.qualityLevels_,this)}),this.playlists.on("mediachange",()=>{vp(this.qualityLevels_,this.playlists)}))}static version(){return{"@videojs/http-streaming":_p,"mux.js":y1,"mpd-parser":_1,"m3u8-parser":T1,"aes-decrypter":v1}}version(){return this.constructor.version()}canChangeType(){return fp.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_&&N.URL.revokeObjectURL&&(N.URL.revokeObjectURL(this.mediaSourceUrl_),this.mediaSourceUrl_=null),this.tech_&&this.tech_.off("waitingforkey",this.handleWaitingForKey_),super.dispose()}convertToProgramTime(e,t){return Ib({playlist:this.playlistController_.media(),time:e,callback:t})}seekToProgramTime(e,t,i=!0,s=2){return Xf({programTime:e,playlist:this.playlistController_.media(),retryCount:s,pauseAfterSeek:i,seekTo:this.options_.seekTo,tech:this.options_.tech,callback:t})}setupXhrHooks_(){this.xhr.onRequest=e=>{xp(this.xhr,e)},this.xhr.onResponse=e=>{Sp(this.xhr,e)},this.xhr.offRequest=e=>{Ep(this.xhr,e)},this.xhr.offResponse=e=>{Cp(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,s=>{this.player_.trigger(ot({},s))})}),t.forEach(i=>{this.playbackWatcher_.on(i,s=>{this.player_.trigger(ot({},s))})})}}const qn={name:"videojs-http-streaming",VERSION:_p,canHandleSource(r,e={}){const t=Oe(z.options,e);return!t.vhs.experimentalUseMMS&&!vs("avc1.4d400d,mp4a.40.2",!1)?!1:qn.canPlayType(r.type,t)},handleSource(r,e,t={}){const i=Oe(z.options,t);return e.vhs=new Ap(r,e,i),e.vhs.xhr=Hf(),e.vhs.setupXhrHooks_(),e.vhs.src(r.src,r.type),e.vhs},canPlayType(r,e){const t=Kd(r);if(!t)return"";const i=qn.getOverrideNative(e);return!it.supportsTypeNatively(t)||i?"maybe":""},getOverrideNative(r={}){const{vhs:e={}}=r,t=!(z.browser.IS_ANY_SAFARI||z.browser.IS_IOS),{overrideNative:i=t}=e;return i}},I1=()=>vs("avc1.4d400d,mp4a.40.2",!0);I1()&&z.getTech("Html5").registerSourceHandler(qn,0);z.VhsHandler=Ap;z.VhsSourceHandler=qn;z.Vhs=it;z.use||z.registerComponent("Vhs",it);z.options.vhs=z.options.vhs||{};(!z.getPlugin||!z.getPlugin("reloadSourceOnError"))&&z.registerPlugin("reloadSourceOnError",g1);class k1{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 wp(r,e){const t=[];for(const i in r.childNodes){const s=r.childNodes[i];(s.nodeName===e||e===`vmap:${s.nodeName}`||s.nodeName===`vmap:${e}`)&&t.push(s)}return t}function P1(r){if(!r||!r.childNodes)return{};const e=r.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 i="";for(const s in e){const n=e[s];switch(n.nodeName){case"#text":i+=n.textContent.trim();break;case"#cdata-section":i+=n.data;break}}return i}function wl(r){const e={attributes:{},children:{},value:{}};e.value=P1(r);const t=r.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 i=r.childNodes;if(i)for(const s in i){const n=i[s];n.nodeName&&n.nodeName.substring(0,1)!=="#"&&(e.children[n.nodeName]=wl(n))}return e}class R1{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 k1(i);break;case"TrackingEvents":for(const s in i.childNodes){const n=i.childNodes[s];n.localName==="Tracking"&&this.trackingEvents.push({event:n.getAttribute("event"),uri:(n.textContent||n.text||"").trim()})}break;case"Extensions":this.extensions=wp(i,"Extension").map(s=>wl(s));break}}}track(e,t){for(const i in this.trackingEvents){const s=this.trackingEvents[i];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 L1{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 R1(i));break;case"Extensions":this.extensions=wp(i,"Extension").map(s=>wl(s));break}}}}const N1=(r,e)=>{const t=goog.pal,i=new t.ConsentSettings;i.allowStorage=!1;const s=new t.NonceLoader(i);return async()=>{try{const n=new URL(e),a=new t.NonceRequest;let o=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(o)||(o=cs.v5(`https://${o}`,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=o,a.supportedApiFrameworks="2,7,9",a.videoHeight=r.clientHeight,a.videoWidth=r.clientWidth;const d=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",o),n.searchParams.get("correlator")==="[placeholder]"&&n.searchParams.set("correlator",u),n.searchParams.set("wta","1"),n.searchParams.set("givn",d.getNonce()),{url:n,manager:d}}catch(n){console.log("AdsManager could not be started",n);return}}},O1=new cy,B1=r=>r.creatives.find(e=>e.mediaFiles),M1=r=>{const e=r?.mediaFiles;return e?.length&&e.find(t=>t.fileURL)?.fileURL||""},gs=Uo.a({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),F1=(r,e)=>{const[t,i]=Fe.useState(),s=Fe.useRef(Date.now()),n=Fe.useRef(Date.now());return Fe.useEffect(()=>{if(!e||!r?.current)return;const a=N1(r.current,e),o=Date.now();s.current=o,gs.set({ads:[],autoplay:!0,muted:!1,nonceManager:void 0}),a().then(u=>{s.current===o&&u&&(i(u.url),gs.set({ads:[],autoplay:!0,muted:!1,nonceManager:u.manager}))}).catch(u=>{console.error(u)})},[r,e]),Fe.useEffect(()=>{const a=async(o,u)=>{let d=[];if(o.searchParams.get("output")==="vmap"){const b=await fetch(o.toString()),k=new DOMParser,v=await b.text(),L=k.parseFromString(v,"text/xml");d=new L1(L).adBreaks.map(U=>U.adSource.adTagURI.uri)}else d=[o.toString()];const p=await Promise.all(d.map((b,k)=>O1.get(b).then(v=>{if(n.current===u){const L=v.ads.find(F=>F.creatives.length>0);if(!L)return;const U=B1(L),$=M1(U);return{creative:U,order:k,mediaFileUrl:$,ad:L,raw:v}}}))),T=o.searchParams.get("vpa")!=="click",A=o.searchParams.get("vpmute")==="1";gs.set({...gs.get(),ads:p.filter(b=>!!b),autoplay:T,muted:A})};if(t){const o=Date.now();n.current=o,a(t,o)}return()=>{n.current=0}},[t]),gs},U1=r=>{const e=Fe.useRef();return Fe.useEffect(()=>{if(!e.current&&r.current){const t=document.createElement("video-js");t.classList.add("vjs-big-play-centered"),r.current.appendChild(t),e.current=z(t,{controls:!1,playsinline:!0})}return()=>{e.current&&(e.current.dispose(),e.current=void 0)}},[]),e},Dp={time:0,adCount:0,adPosition:0,skipDelay:0,playing:!1,paused:!1,reset:()=>{},whyThisAd:null,hasAdUrl:!1,adAction:r=>{},playMuted:!1,muted:!1,autoplay:!0},Xe=Uo.f(Dp),pd=r=>{if(!r)return 0;const e=r.duration(),t=r.currentTime();return e===void 0||isNaN(e)||t===void 0||isNaN(t)?0:Math.round(e-t)},$1=(r,e)=>{const t=F1(r,e),i=U1(r),s=Fe.useRef(),n=Fe.useRef(!1),a=Fe.useRef(!1),o=Fe.useCallback(()=>{if(a.current)return;const b=t.get().nonceManager;if(b&&n.current)try{b.sendPlaybackEnd()}catch(k){console.warn("[PAL] sendPlaybackEnd failed",k)}a.current=!0},[t]),u=Fe.useCallback(()=>{o(),i.current&&(i.current.pause(),i.current.src(void 0)),s.current=void 0,Xe.set({...Dp,reset:u})},[i,o]);Fe.useEffect(()=>{Xe.setKey("reset",u)},[u]);const d=Fe.useCallback(()=>{const{adPosition:b,adCount:k}=Xe.get();if(i.current){if(b<k){const v=b+1,{ads:L,muted:U,autoplay:$,nonceManager:F}=t.get(),H=L[v-1];if(H){s.current?.complete(),s.current=new dy(null,H.ad,H.creative),s.current.on("clickthrough",B=>{if(F)try{F.sendAdClick()}catch(V){console.warn("[PAL] sendAdClick failed",V)}window.open(B,"_blank")}),Xe.setKey("adPosition",v),Xe.setKey("playMuted",U),Xe.setKey("skipDelay",H.creative.skipDelay||0),Xe.setKey("time",0),Xe.setKey("adAction",B=>{s.current&&s.current.click(null,{CLICKPOS:[B.clientX,B.clientY]})}),Xe.setKey("whyThisAd",H.creative.icons.find(B=>B.program==="GoogleWhyThisAd")||null),Xe.setKey("hasAdUrl",!!H.creative.videoClickThroughURLTemplate?.url),i.current.src(H.mediaFileUrl),Xe.setKey("playing",!0),b===0?(Xe.setKey("muted",U),Xe.setKey("autoplay",$),U&&i.current.muted(!0),$?i.current.play():(i.current.pause(),Xe.setKey("paused",!0))):i.current.play();return}}s.current?.complete(),u()}},[i,u,t]),p=Fe.useCallback(()=>{if(!i.current)return;const b=i.current.muted();i.current.muted(!b),Xe.setKey("muted",!b),s.current&&s.current.setMuted(!b)},[i]),T=Fe.useCallback(()=>{i.current&&(i.current.paused()?(i.current.play(),s.current&&s.current.setPaused(!1)):(i.current.pause(),s.current&&s.current.setPaused(!0)))},[i]),A=Fe.useCallback(()=>{i.current&&(s.current&&s.current.skip(),d())},[d,i]);return Fe.useEffect(()=>{const b=i.current;if(!b)return()=>{};const k=B=>{if(Xe.setKey("playing",!0),Xe.setKey("paused",!1),Xe.setKey("time",pd(B.target.player)),!n.current){const V=t.get().nonceManager;if(V)try{V.sendPlaybackStart(),n.current=!0,a.current=!1}catch(G){console.warn("[PAL] sendPlaybackStart failed",G)}}},v=()=>{s.current?.complete(),d()},L=B=>{Xe.setKey("muted",B.target.player.muted())},U=()=>{Xe.setKey("paused",!0)},$=B=>{B.target.tagName==="VIDEO"&&(Xe.get().autoplay||T())},F=B=>{Xe.setKey("time",pd(B.target.player)),s.current&&s.current.setProgress(B.target.player.currentTime())},H=()=>{u()};return b.on("play",k),b.on("ended",v),b.on("muted",L),b.on("pause",U),b.on("click",$),b.on("timeupdate",F),b.on("error",H),()=>{b.off("play",k),b.off("ended",v),b.off("muted",L),b.off("pause",U),b.off("click",$),b.off("timeupdate",F),b.off("error",H)}},[T,d,i,u,t]),Fe.useEffect(()=>t.subscribe(b=>{b&&(n.current=!1,a.current=!1,Xe.setKey("adCount",b.ads.length),Xe.setKey("adPosition",0),d())}),[t,i,d]),Fe.useEffect(()=>()=>{u()},[u]),[Xe,p,T,A,s]},j1=({promotion:r,onClose:e,promotionId:t,externalAd:i,skipAutoClose:s})=>{const n=Fe.useRef(null),[a,o,u,d]=$1(n,i?.url),{time:p,adCount:T,adPosition:A,skipDelay:b,playing:k,paused:v,reset:L,muted:U,playMuted:$,autoplay:F,whyThisAd:H,hasAdUrl:B,adAction:V}=ge.useStore(a),G=r.sponsor?.logo&&r.logoMode===Ce.PromotionLogoMode.CENTER;return ae.jsxs(Sd,{className:"PromoOverlay",children:[ae.jsxs(Ed,{children:[ae.jsx(Cd,{className:ge.cx_default(!G&&Ad),children:ae.jsx(Dd,{style:{transform:"scale(1.5)"},children:"Ad"})}),ae.jsxs(G0,{children:[ae.jsx(F0,{time:p,adCount:T,adPosition:A}),!!b&&k&&ae.jsx(vn.y,{timerClassName:"SkipTimerCount",className:"ClosePromoIcon",close:()=>{d()},duration:b,isPlaying:!v,skipIcon:!0}),s&&ae.jsx(vn.y,{className:"ClosePromoIcon",close:()=>{L(),e?.()}})]})]}),ae.jsx(wd,{className:ge.cx_default(xu,k&&Su,!k&&Eu),children:ae.jsxs(W0,{ref:n,children:[H&&ae.jsx($0,{whyThisAd:H}),ae.jsxs(j0,{style:H?.xPosition==="right"?{left:"8px"}:{right:"8px"},children:[$&&ae.jsx(V0,{className:ge.cx_default(!U&&"muted"),onClick:()=>o()}),v&&!F&&ae.jsx(z0,{onClick:()=>u()})]})]})}),B&&ae.jsx(Id,{className:ge.cx_default(xu,k&&Su,!k&&Eu),children:ae.jsx(kd,{as:"button",onClick:V,style:{backgroundColor:r.banner?.ctaButton?.color||"#009dc4",color:r.banner?.ctaButton?.textColor||"#fff"},"data-a":"button","data-promo-id":t,"data-promo-type":r.type,target:"_blank",children:"Show more"})})]})},md=r=>{const{promotion:e,open:t,advertisementPaused:i,togglePause:s,controlVideo:n,skipAutoClose:a,promotionId:o,onClose:u,markAsViewed:d,externalAd:p,isEventFired:T,fireEvent:A,muted:b}=r,k=e.type===Ce.PromotionType.INGAME_IAB11_LBAR||e.type===Ce.PromotionType.INGAME_IAB11||e.type===Ce.PromotionType.INGAME_IAB11_SIDEBAR,v=e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.CENTER,L=!!e.banner?.video?.url,U=e.autoPlayVideo===Ce.AutoPlayVideo.ENABLED,$=e.playVideoMuted===Ce.PlayVideoMuted.ENABLED;if(Fe.useEffect(()=>{s?.(L||U),t?.()},[]),Fe.useEffect(()=>{o&&e.type&&d&&d()},[o,e.type,d]),Fe.useEffect(()=>()=>{n?.({muted:!1})},[n]),p)return ae.jsx(j1,{...r,externalAd:p});let F=e.banner?.url;F&&F.indexOf("http")!==0&&(F=`https://${F}`);let H=!0;return L&&(!i||!U?H=!0:H=!1),ae.jsxs(Sd,{className:"PromoOverlay",children:[ae.jsxs("div",{children:[ae.jsxs(Ed,{children:[ae.jsxs(Cd,{className:ge.cx_default(!v&&Ad),children:[e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.LEFT&&ae.jsx(Tu,{className:"PromoSponsorLogo",src:e.sponsor?.logo,alt:"promo"}),ae.jsxs(P0,{style:{paddingLeft:e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.LEFT?"0px":"8px"},children:[e.sponsor?.logo&&e.logoMode===Ce.PromotionLogoMode.LEFT&&ae.jsx(w0,{children:e.sponsor?.name}),ae.jsxs(R0,{className:"SponsorText",children:[ae.jsx(Dd,{children:"AD"}),ae.jsx(L0,{children:"SPONSORED"})]})]})]}),ae.jsx(vn.y,{className:"ClosePromoIcon",close:u,autoClose:e.closeTimer?.auto,duration:a?0:e.closeTimer?.seconds,isPlaying:H})]}),ae.jsxs(wd,{children:[v&&ae.jsx(Tu,{className:I0,src:e.sponsor?.logo,alt:"promo"}),ae.jsx(vu,{children:e.banner?.video?.url?ae.jsx(vn.Fe,{source:e.banner?.video?.url,poster:e.banner?.video?.thumbnailUrl,aspectRatio:k?"1/1":"2/1",onRender:()=>{T?.("video-rendered")||(_i.eventBus.emit("advertisement",{action:"videoRendered",payload:{id:o,type:e.type}}),A?.("video-rendered"))},onQuartile:B=>{T?.(`video-quartile-${B}`)||(_i.eventBus.emit("advertisement",{action:"quartileCompleted",payload:{id:o,type:e.type,quartile:B}}),A?.(`video-quartile-${B}`))},onMute:B=>{const V=B?"muted":"unmuted";T?.(V)||(_i.eventBus.emit("advertisement",{action:B?"videoMuted":"videoUnmuted",payload:{id:o,type:e.type}}),A?.(V))},onPause:()=>{U&&s?.(!0)},onReplay:()=>{T?.("replayed")||(_i.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:o,type:e.type}}),A?.("replayed"))},onPlay:()=>{T?.("played")||(_i.eventBus.emit("advertisement",{action:"videoPlay",payload:{id:o,type:e.type}}),A?.("played")),s?.(!1),T?.("played")&&T?.("ended")&&!T?.("replayed")&&(_i.eventBus.emit("advertisement",{action:"videoReplayed",payload:{id:o,type:e.type}}),A?.("replayed"))},onEnd:()=>{T?.("ended")||(_i.eventBus.emit("advertisement",{action:"videoEnd",payload:{id:o,type:e.type}}),A?.("ended"))},controlVideo:n,autoPlay:U,playMuted:$,muted:b}):e.banner?.imageUrl?ae.jsx(D0,{style:k?{aspectRatio:"1/1"}:{},src:e.banner?.imageUrl,alt:"promo"}):null}),!k&&ae.jsxs(vu,{children:[e.banner?.title&&ae.jsx(N0,{className:ge.cx_default("AdvTitle",v&&O0),children:e.banner?.title}),e.banner?.body&&ae.jsx(k0,{className:"AdvDescription",children:e.banner?.body})]})]})]}),e.buttonType===Ce.PromotionButtonType.BASIC&&ae.jsx(Id,{children:ae.jsx(kd,{href:F,style:{backgroundColor:e.banner?.ctaButton?.color||"#009dc4",color:e.banner?.ctaButton?.textColor||"#fff"},"data-a":"button","data-promo-id":o,"data-promo-type":e.type,target:"_blank",children:e.banner?.ctaButton?.label})})]})},q1=ge.styled_default("div")({name:"SidebarContainer",class:"s1abskp8",propsAsIs:!1}),V1=({children:r,direction:e,style:t,className:i,hiding:s})=>ae.jsx($o,{direction:e,style:t,hiding:s,className:i,children:ae.jsx(q1,{children:r})}),gd=r=>r?.type===Ce.PromotionType.INGAME_IAB11_LBAR||r?.type===Ce.PromotionType.INGAME_IAB21_LBAR,H1=r=>r?.type===Ce.PromotionType.INGAME_IAB11_SIDEBAR||r?.type===Ce.PromotionType.INGAME_IAB21_SIDEBAR,z1=r=>r?.type===Ce.PromotionType.INGAME_IAB11||r?.type===Ce.PromotionType.INGAME_IAB21,W1=({advertisement:r,close:e,skipTypeCheck:t,skipAutoClose:i,layoutMode:s="side-by-side",sidebar:n,isNotification:a,banner:o,markAsViewed:u,open:d,externalAd:p,controlVideo:T,advertisementPaused:A,togglePause:b,isEventFired:k,fireEvent:v,muted:L})=>r.promotion?a&&r.notification?ae.jsx(C0,{open:()=>d?.({fromNotification:!0}),notification:r.notification,promotionId:r.question.id,close:e}):!n&&!o&&(t||z1(r.promotion))?ae.jsx(A0,{className:"PromoOverlayContainer",children:ae.jsx(md,{markAsViewed:u,promotionId:r.question.id,promotion:r.promotion,onClose:e,open:d,skipAutoClose:i,externalAd:p,controlVideo:T,advertisementPaused:A,togglePause:b,isEventFired:k,fireEvent:v,muted:L})}):n&&(t||gd(r.promotion)||H1(r.promotion)||p)?ae.jsx(V1,{className:"PromoSidebarContainer",direction:n,hiding:!1,children:ae.jsx(md,{markAsViewed:u,promotionId:r.question.id,promotion:r.promotion,externalAd:p,onClose:e,open:d,controlVideo:T,skipAutoClose:i,advertisementPaused:A,togglePause:b,isEventFired:k,fireEvent:v,muted:L})}):o&&gd(r.promotion)?ae.jsx(_d,{promotionId:r.question.id,hiding:!1,promotion:r.promotion,direction:o,isEventFired:k,fireEvent:v}):null:null,yd=ge.styled_default("div")({name:"AdvertisementUIWrap",class:"aa6pjif",propsAsIs:!1}),G1=r=>{const e=r.target;if(e instanceof HTMLAnchorElement&&e.target==="_blank"){const t=e.getAttribute("data-promo-id")||"",i=e.getAttribute("data-promo-type")||Ce.PromotionType.UNSET;e.getAttribute("data-a")==="button"&&_i.eventBus.emit("advertisement",{action:"buttonSelect",payload:{id:t,type:i}}),e.getAttribute("data-a")==="banner"&&_i.eventBus.emit("advertisement",{action:"bannerSelect",payload:{id:t,type:i}})}},K1=({gamification:r,advertisement:e,layoutMode:t,skipAutoClose:i,skipTypeCheck:s,sidebar:n,banner:a,notification:o,isMobileScreen:u,persistent:d,containerId:p,externalAd:T,controlVideo:A,muted:b})=>{const k=Fe.useRef(null),v=ge.useStore(e.$store),L=ge.useStore(r.openedQuestion.$store);Uo.A(k,{enabled:!!v.data,event:"click",listener:G1});const U=v.data?.question?.backgroundImage?.landscapeUrl||v.data?.promotion?.backgroundImageLandscapeUrl,$=v.data?.question?.backgroundImage?.portraitUrl||v.data?.promotion?.backgroundImagePortraitUrl,F=vg.y({containerId:p,landscapeUrl:U,portraitUrl:$});if(L?.attributes?.adUnit===Ce.AdUnit.STANDART&&L?.attributes?.adPromotion?.banner?.imageUrl)return a?ae.jsx(yd,{ref:k,style:{height:"100%"},className:ge.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view"),children:ae.jsx(Og,{cardId:L.id,promotion:{...L?.attributes?.adPromotion,adUnit:L?.attributes?.adUnit}})}):null;const H=!a&&!n;if(v.data===void 0||!d&&v.isViewed)return null;const B=v?.data?.notification?.promotion?.mode===Ce.NotificationPromotionMode.LOWER_THIRD;return ae.jsxs(yd,{ref:k,style:{height:H?"auto":"100%"},className:ge.cx_default("SL-AdvertisementUIWrap",u&&"mobile-view",B&&"SL-AdvertisementUIWrap--lower-third"),children:[!o&&F,ae.jsx(W1,{skipTypeCheck:s,sidebar:n,banner:a,advertisement:v.data,advertisementPaused:!!v.isPaused,togglePause:v.togglePause,isEventFired:v.isEventFired,fireEvent:v.fireEvent,close:v.close,externalAd:T?v.externalAd:void 0,markAsViewed:r.advertisement?.markAsViewed,open:r.advertisement?.open,layoutMode:t,isNotification:o,skipAutoClose:i,controlVideo:A,muted:b})]})},Ip=({sdk:r,sidebar:e,externalAd:t,banner:i,skipAutoClose:s,skipTypeCheck:n,layoutMode:a,isMobileScreen:o,persistent:u,notification:d,muted:p})=>{const T=ge.useStore(r.featuresList.getStore()),[A,b]=Fe.useState(!t),k=ge.useStore(r.options);if(Fe.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=()=>{b(!0)}}},[t]),e&&i)return ae.jsx("div",{style:{color:"red"},children:"define either sidebar or banner, not both."});if(i&&t)return ae.jsx("div",{style:{color:"red"},children:"externalAd is not supported with banner"});if(!T)return null;const v=r.getFeature(Ce.SdkOverlayType.GAMES);return!v?.advertisement||t&&!A?null:ae.jsx(K1,{gamification:v,advertisement:v.advertisement,sidebar:e,banner:i,layoutMode:a,isMobileScreen:o,persistent:u,notification:d,skipTypeCheck:n,skipAutoClose:s,externalAd:t,controlVideo:r.controlVideoPlayer,containerId:k.containerId,muted:p})},X1=({event:r,sidebar:e,banner:t,isMobileScreen:i,skipAutoClose:s,persistent:n,theme:a,notification:o,skipTypeCheck:u,externalAd:d,muted:p=!1})=>{const T=gi.Y(),A=gi.q(),b=gi._();return T?d&&!A.promotionExternalAd?r!==void 0&&ae.jsx(gi.g,{event:r}):!d&&A.promotionExternalAd?r!==void 0&&ae.jsx(gi.g,{event:r}):e&&!A.promotionSidebar?r!==void 0&&ae.jsx(gi.g,{event:r}):t&&!A.promotionBanner?r!==void 0&&ae.jsx(gi.g,{event:r}):o&&!A.promotionNotification?r!==void 0&&ae.jsx(gi.g,{event:r}):!t&&!e&&!o&&!A.promotionOverlay&&!u?r!==void 0&&ae.jsx(gi.g,{event:r}):ae.jsxs("div",{className:"StreamLayerSDK",children:[ae.jsx(_g.h,{customTheme:a??b.theme,themeMode:b.themeMode,children:ae.jsx(Ip,{sdk:T,sidebar:e,banner:t,isMobileScreen:i,persistent:n,notification:o,skipTypeCheck:u,skipAutoClose:s,layoutMode:"side-by-side",externalAd:d,muted:p})}),r!==void 0&&ae.jsx(gi.g,{event:r})]}):null};exports.StreamLayerSDKAdvertisement=X1;exports.StreamLayerSDKAdvertisementUI=Ip;
|